]> source.dussan.org Git - nextcloud-server.git/commitdiff
Try to make owncloud working again
authorJakob Sack <kde@jakobsack.de>
Fri, 15 Apr 2011 16:13:49 +0000 (18:13 +0200)
committerJakob Sack <kde@jakobsack.de>
Fri, 15 Apr 2011 16:13:49 +0000 (18:13 +0200)
admin/appinfo/app.php
admin/index.php
admin/plugins.php
admin/system.php
admin/users.php
files/admin.php
lib/Group/database.php
lib/base.php
lib/group.php

index f4a361609368da1cf7c55458460e07ea372edffd..a0ee0a0e55b55a274f1213de51825cf542a0faee 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 OC_APP::register( array( "order" => 1, "id" => "admin", "name" => "Administration" ));
-if( OC_USER::ingroup( $_SESSION['username'], 'admin' ))
+if( OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' ))
 {
        OC_APP::addNavigationEntry( array( "id" => "admin_index", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "index.php" ), "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ), "name" => "Administration" ));
 }
index 5d8ac1405117600b07d710be6c3bc368f5abf484..36c9229d2f5376aa50473e0d1ef214fc26778854 100644 (file)
@@ -23,7 +23,7 @@
 
 require_once('../lib/base.php');
 oc_require( 'template.php' );
-if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){
+if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
        header( "Location: ".OC_HELPER::linkTo( "index.php" ));
        exit();
 }
index d281f897ecbe13fed562a8fe90690d60b43024d4..ae6d35c3227f53248ecc17ddc92b7e5636a4412e 100644 (file)
@@ -23,7 +23,7 @@
 
 require_once('../lib/base.php');
 oc_require( 'template.php' );
-if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){
+if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
        header( "Location: ".OC_HELPER::linkTo( "index.php" ));
        exit();
 }
index 5d8ac1405117600b07d710be6c3bc368f5abf484..36c9229d2f5376aa50473e0d1ef214fc26778854 100644 (file)
@@ -23,7 +23,7 @@
 
 require_once('../lib/base.php');
 oc_require( 'template.php' );
-if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){
+if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
        header( "Location: ".OC_HELPER::linkTo( "index.php" ));
        exit();
 }
index d4eebb44178947e1ed38ae5153628150f20369bc..cfcb7a253fbdd9c7bf700fe9070af31a25358636 100644 (file)
@@ -23,7 +23,7 @@
 
 require_once('../lib/base.php');
 oc_require( 'template.php' );
-if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){
+if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
        header( "Location: ".OC_HELPER::linkTo( "index.php" ));
        exit();
 }
index 4c442c4b11169f74230c7a0e5cfba618cac1463b..9470bcf90bd2f46dd80eca49b84e077a1bdacebe 100644 (file)
@@ -27,7 +27,7 @@ require_once('../lib/base.php');
 oc_require( 'template.php' );
 
 // Check if we are a user
-if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){
+if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
        header( "Location: ".OC_HELPER::linkTo( "index.php" ));
        exit();
 }
index 8e7f1203cd2f54b78083f3301e9bef44eb666e44..e99f8486af7e36110336752c109c14fae6c7c817 100644 (file)
@@ -72,9 +72,10 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
         * @param  string  $username   Name of the user to check
         * @param  string  $groupName  Name of the group
         */
-       public static function inGroup($username,$groupName) {
+       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 );
 
                return $result->numRows() > 0 ? true : false;
        }
@@ -85,8 +86,8 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
         * @param  string  $username   Name of the user to add to group
         * @param  string  $groupName  Name of the group in which add the user
         */
-       public static function addToGroup($username, $groupName) {
-               if( !OC_USER::inGroup( $username, $groupName )){
+       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 );
                }
@@ -98,7 +99,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
         * @param  string  $username   Name of the user to remove from group
         * @param  string  $groupName  Name of the group from which remove the user
         */
-       public static function removeFromGroup($username,$groupName){
+       public static function removeFromGroup( $username, $groupName ){
                $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?" );
                $result = $query->execute( $username, $groupName );
        }
@@ -108,7 +109,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
         *
         * @param  string  $username  Name of the user
         */
-       public static function getUserGroups($username) {
+       public static function getUserGroups( $username ){
                $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE `uid` = ?" );
                $result = $query->execute( $username );
 
@@ -124,7 +125,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
         * get a list of all groups
         *
         */
-       public static function getGroups() {
+       public static function getGroups(){
                $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups`" );
                $result = $query->execute();
 
index e29cf5292c2d72689c674a8be07a89c42aa90558..f013cb8213da6ee3b7d137f3e789322a30d87516 100644 (file)
@@ -98,7 +98,8 @@ OC_PLUGIN::loadPlugins( "" );
 if(!isset($CONFIG_BACKEND)){
        $CONFIG_BACKEND='database';
 }
-OC_USER::setBackend($CONFIG_BACKEND);
+OC_USER::setBackend( $CONFIG_BACKEND );
+OC_GROUP::setBackend( $CONFIG_BACKEND );
 
 // Set up file system unless forbidden
 if( !$RUNTIME_NOSETUPFS ){
@@ -149,7 +150,7 @@ class OC_UTIL {
 
                // If we are not forced to load a specific user we load the one that is logged in
                if( $user == "" && OC_USER::isLoggedIn()){
-                       $user = $_SESSION['username_clean'];
+                       $user = $_SESSION['user_id'];
                }
 
                if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem
@@ -384,22 +385,21 @@ class OC_DB {
 
                        // Prepare options array
                        $options = array(
-                               'portability' => MDB2_PORTABILITY_ALL,
-                               'log_line_break' => '<br>',
-                               'idxname_format' => '%s',
-                               'debug' => true,
-                               'quote_identifier' => true,
-                       );
+                         'portability' => MDB2_PORTABILITY_ALL,
+                         'log_line_break' => '<br>',
+                         'idxname_format' => '%s',
+                         'debug' => true,
+                         'quote_identifier' => true  );
 
                        // Add the dsn according to the database type
-                       if($CONFIG_DBTYPE=='sqlite'){
+                       if( $CONFIG_DBTYPE == 'sqlite' ){
                                // sqlite
                                $dsn = array(
                                  'phptype'  => 'sqlite',
                                  'database' => "$SERVERROOT/$CONFIG_DBNAME",
                                  'mode' => '0644' );
                        }
-                       elseif($CONFIG_DBTYPE=='mysql'){
+                       elseif( $CONFIG_DBTYPE == 'mysql' ){
                                // MySQL
                                $dsn = array(
                                  'phptype'  => 'mysql',
@@ -408,7 +408,7 @@ class OC_DB {
                                  'hostspec' => $CONFIG_DBHOST,
                                  'database' => $CONFIG_DBNAME );
                        }
-                       elseif($CONFIG_DBTYPE=='pgsql'){
+                       elseif( $CONFIG_DBTYPE == 'pgsql' ){
                                // PostgreSQL
                                $dsn = array(
                                  'phptype'  => 'pgsql',
index 0701627e4eeca30fb723b7f4d634f757aac8b38a..06c91bc2436161cb3cbb070fe632ac0e119fa223 100644 (file)
@@ -68,26 +68,16 @@ class OC_GROUP {
                        case 'database':
                        case 'mysql':
                        case 'sqlite':
-                               oc_require_once('User/database.php');
-                               self::$_backend = new OC_USER_DATABASE();
+                               oc_require_once('Group/database.php');
+                               self::$_backend = new OC_GROUP_DATABASE();
                                break;
                        default:
-                               $className = 'OC_USER_' . strToUpper($backend);
+                               $className = 'OC_GROUP_' . strToUpper($backend);
                                self::$_backend = new $className();
                                break;
                }
        }
 
-       /**
-        * Get the name of a group
-        *
-        * @param  string  $groupId  ID of the group
-        * @param  boolean $noCache  If false the cache is used to find the name of the group
-        */
-       public static function getGroupName($groupId, $noCache=false) {
-               return self::$_backend->getGroupName($groupId, $noCache);
-       }
-
        /**
         * Check if a user belongs to a group
         *