aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJakob Sack <kde@jakobsack.de>2011-04-15 19:24:23 +0200
committerJakob Sack <kde@jakobsack.de>2011-04-15 19:24:23 +0200
commit3d89b2caa41bc99f48b8377c87e9c653f467631d (patch)
tree6aafbd2f185f7ce2ea9340c0370480766e5d1bfc /lib
parent3c01e307484a2738ed0314b7acf829cb7c9d8cdb (diff)
downloadnextcloud-server-3d89b2caa41bc99f48b8377c87e9c653f467631d.tar.gz
nextcloud-server-3d89b2caa41bc99f48b8377c87e9c653f467631d.zip
php is not perl
Diffstat (limited to 'lib')
-rw-r--r--lib/Group/database.php13
-rw-r--r--lib/User/database.php10
-rw-r--r--lib/appconfig.php12
-rw-r--r--lib/base.php40
-rw-r--r--lib/preferences.php18
5 files changed, 45 insertions, 48 deletions
diff --git a/lib/Group/database.php b/lib/Group/database.php
index e99f8486af7..c10f6db80e0 100644
--- a/lib/Group/database.php
+++ b/lib/Group/database.php
@@ -53,14 +53,14 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
*/
public static function createGroup( $gid ){
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups` WHERE `gid` = ?" );
- $result = $query->execute( $gid );
+ $result = $query->execute( array( $gid ));
if( $result->numRows() > 0 ){
return false;
}
else{
$query = OC_DB::prepare( "INSERT INTO `*PREFIX*groups` ( `gid` ) VALUES( ? )" );
- $result = $query->prepare( $gid );
+ $result = $query->execute( array( $gid ));
return $result ? true : false;
}
@@ -74,8 +74,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
*/
public static function inGroup( $username, $groupName ){
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` = ?" );
- $result = $query->execute( $groupName, $username );
-var_dump( $result );
+ $result = $query->execute( array( $groupName, $username ));
return $result->numRows() > 0 ? true : false;
}
@@ -89,7 +88,7 @@ var_dump( $result );
public static function addToGroup( $username, $groupName ){
if( !self::inGroup( $username, $groupName )){
$query = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" );
- $result = $query->execute( $username, $groupName );
+ $result = $query->execute( array( $username, $groupName ));
}
}
@@ -101,7 +100,7 @@ var_dump( $result );
*/
public static function removeFromGroup( $username, $groupName ){
$query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?" );
- $result = $query->execute( $username, $groupName );
+ $result = $query->execute( array( $username, $groupName ));
}
/**
@@ -111,7 +110,7 @@ var_dump( $result );
*/
public static function getUserGroups( $username ){
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE `uid` = ?" );
- $result = $query->execute( $username );
+ $result = $query->execute( array( $username ));
$groups = array();
while( $row = $result->fetchRow()){
diff --git a/lib/User/database.php b/lib/User/database.php
index b6305220f3d..45aab061e39 100644
--- a/lib/User/database.php
+++ b/lib/User/database.php
@@ -50,7 +50,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
*/
public static function createUser( $uid, $password ){
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*users` WHERE `uid` = ?" );
- $result = $query->execute( $uid );
+ $result = $query->execute( array( $uid ));
// Check if the user already exists
if ( $result->numRows() > 0 ){
@@ -58,7 +58,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
}
else{
$query = OC_DB::prepare( "INSERT INTO `*PREFIX*users` ( `uid`, `password` ) VALUES( ?, ? )" );
- $result = $query->prepare( $uid, sha1( $password ));
+ $result = $query->execute( array( $uid, sha1( $password )));
return $result ? true : false;
}
@@ -72,7 +72,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
*/
public static function login( $username, $password ){
$query = OC_DB::prepare( "SELECT `uid`, `name` FROM `*PREFIX*users` WHERE `uid` = ? AND `password` = ?" );
- $result = $query->execute( $username, sha1( $password ));
+ $result = $query->execute( array( $username, sha1( $password )));
if( $result->numRows() > 0 ){
$row = $result->fetchRow();
@@ -121,7 +121,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
*/
public static function setPassword( $username, $password ){
$query = OC_DB::prepare( "UPDATE `*PREFIX*users` SET `password` = ? WHERE `uid` = ?" );
- $result = $query->execute( sha1( $password ), $username );
+ $result = $query->execute( array( sha1( $password ), $username ));
if( $result->numRows() > 0 ){
return true;
@@ -139,7 +139,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
*/
public static function checkPassword( $username, $password ){
$query = OC_DB::prepare( "SELECT `uid` FROM `*PREFIX*users` WHERE `uid` = ? AND `password` = ?" );
- $result = $query->execute( $username, sha1( $password ));
+ $result = $query->execute( array( $username, sha1( $password )));
if( $result->numRows() > 0 ){
return true;
diff --git a/lib/appconfig.php b/lib/appconfig.php
index 81e5717f647..df338a412db 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -69,7 +69,7 @@ class OC_APPCONFIG{
public static function getKeys( $app ){
// No magic in here as well
$query = OC_DB::prepare( 'SELECT `key` FROM `*PREFIX*appconfig` WHERE `appid` = ?' );
- $result = $query->execute( $app );
+ $result = $query->execute( array( $app ));
$keys = array();
while( $row = $result->fetchRow()){
@@ -92,7 +92,7 @@ class OC_APPCONFIG{
public static function getValue( $app, $key, $default = null ){
// At least some magic in here :-)
$query = OC_DB::prepare( 'SELECT `value` FROM `*PREFIX*appconfig` WHERE `appid` = ? AND `key` = ?' );
- $result = $query->execute( $app, $key );
+ $result = $query->execute( array( $app, $key ));
if( !$result->numRows()){
return $default;
@@ -119,11 +119,11 @@ class OC_APPCONFIG{
// null: does not exist
if( is_null( $exists )){
$query = OC_DB::prepare( 'INSERT INTO `*PREFIX*appconfig` ( `appid`, `key`, `value` ) VALUES( ?, ?, ? )' );
- $query->execute( $app, $key, $value );
+ $query->execute( array( $app, $key, $value ));
}
else{
$query = OC_DB::prepare( 'UPDATE `*PREFIX*appconfig` SET `value` = ? WHERE `appid` = ? AND `key` = ?' );
- $query->execute( $value, $app, $key );
+ $query->execute( array( $value, $app, $key ));
}
}
@@ -138,7 +138,7 @@ class OC_APPCONFIG{
public static function deleteKey( $app, $key ){
// Boring!
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*appconfig` WHERE `appid` = ? AND `key` = ?' );
- $query->execute( $app, $key );
+ $query->execute( array( $app, $key ));
return true;
}
@@ -153,7 +153,7 @@ class OC_APPCONFIG{
public static function deleteApp( $app ){
// Nothing special
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*appconfig` WHERE `appid` = ?' );
- $query->execute( $app );
+ $query->execute( array( $app ));
return true;
}
diff --git a/lib/base.php b/lib/base.php
index f013cb8213d..054ba2415e0 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -1,24 +1,24 @@
<?php
/**
-* ownCloud
-*
-* @author Frank Karlitschek
-* @copyright 2010 Frank Karlitschek karlitschek@kde.org
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
+ * ownCloud
+ *
+ * @author Frank Karlitschek
+ * @copyright 2010 Frank Karlitschek karlitschek@kde.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
// set some stuff
@@ -478,8 +478,6 @@ class OC_DB {
$query = self::processQuery( $query );
self::connect();
- //fix differences between sql versions
-
// return the result
$result = self::$DBConnection->prepare( $query );
diff --git a/lib/preferences.php b/lib/preferences.php
index 7b510e5b7de..6fb3cf1312f 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -69,7 +69,7 @@ class OC_PREFERENCES{
public static function getApps( $user ){
// No need for more comments
$query = OC_DB::prepare( 'SELECT DISTINCT( `appid` ) FROM `*PREFIX*preferences` WHERE `userid` = ?' );
- $result = $query->execute( $user );
+ $result = $query->execute( array( $user ));
$apps = array();
while( $row = $result->fetchRow()){
@@ -91,7 +91,7 @@ class OC_PREFERENCES{
public static function getKeys( $user, $app ){
// No need for more comments
$query = OC_DB::prepare( 'SELECT `key` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' );
- $result = $query->execute( $user, $app );
+ $result = $query->execute( array( $user, $app ));
$keys = array();
while( $row = $result->fetchRow()){
@@ -115,7 +115,7 @@ class OC_PREFERENCES{
public static function getValue( $user, $app, $key, $default = null ){
// Try to fetch the value, return default if not exists.
$query = OC_DB::prepare( 'SELECT `value` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `key` = ?' );
- $result = $query->execute( $user, $app, $key );
+ $result = $query->execute( array( $user, $app, $key ));
if( !$result->numRows()){
return $default;
@@ -144,11 +144,11 @@ class OC_PREFERENCES{
// null: does not exist. Insert.
if( is_null( $exists )){
$query = OC_DB::prepare( 'INSERT INTO `*PREFIX*preferences` ( `userid`, `appid`, `key`, `value` ) VALUES( ?, ?, ?, ? )' );
- $query->execute( $user, $app, $key, $value );
+ $query->execute( array( $user, $app, $key, $value ));
}
else{
$query = OC_DB::prepare( 'UPDATE `*PREFIX*preferences` SET `value` = ? WHERE `userid` = ? AND `appid` = ? AND `key` = ?' );
- $query->execute( $value, $user, $app, $key );
+ $query->execute( array( $value, $user, $app, $key ));
}
}
@@ -164,7 +164,7 @@ class OC_PREFERENCES{
public static function deleteKey( $user, $app, $key ){
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `key` = ?' );
- $result = $query->execute( $user, $app, $key );
+ $result = $query->execute( array( $user, $app, $key ));
return true;
}
@@ -180,7 +180,7 @@ class OC_PREFERENCES{
public static function deleteApp( $user, $app ){
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' );
- $result = $query->execute( $user, $app );
+ $result = $query->execute( array( $user, $app ));
return true;
}
@@ -195,7 +195,7 @@ class OC_PREFERENCES{
public static function deleteUser( $user ){
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?' );
- $result = $query->execute( $user );
+ $result = $query->execute( array( $user ));
return true;
}
@@ -210,7 +210,7 @@ class OC_PREFERENCES{
public static function deleteAppFromAllUsers( $app ){
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `appid` = ?' );
- $result = $query->execute( $app );
+ $result = $query->execute( array( $app ));
return true;
}