]> source.dussan.org Git - nextcloud-server.git/commitdiff
php is not perl
authorJakob Sack <kde@jakobsack.de>
Fri, 15 Apr 2011 17:24:23 +0000 (19:24 +0200)
committerJakob Sack <kde@jakobsack.de>
Fri, 15 Apr 2011 17:24:23 +0000 (19:24 +0200)
lib/Group/database.php
lib/User/database.php
lib/appconfig.php
lib/base.php
lib/preferences.php

index e99f8486af7e36110336752c109c14fae6c7c817..c10f6db80e00987603d1189bd61734d974b6cc9f 100644 (file)
@@ -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()){
index b6305220f3d38d05364af39f42b1c46211161cd3..45aab061e39384c5e6a9a57459a5a673eaa467cb 100644 (file)
@@ -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;
index 81e5717f6476524b83b3960408efea27bffd420e..df338a412db0a70104332d992356386561e4134c 100644 (file)
@@ -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;
        }
index f013cb8213da6ee3b7d137f3e789322a30d87516..054ba2415e038f5e1ef49acfea4a98c6da4b7f55 100644 (file)
@@ -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 );
 
index 7b510e5b7ded5ec05eb7659b46a9f29e88380ebe..6fb3cf1312f714250edbab236781fcc335cdb288 100644 (file)
@@ -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;
        }