Try to make owncloud working again

remotes/origin/stable
Jakob Sack 14 years ago
parent 149793f2e7
commit 3c01e30748
  1. 2
      admin/appinfo/app.php
  2. 2
      admin/index.php
  3. 2
      admin/plugins.php
  4. 2
      admin/system.php
  5. 2
      admin/users.php
  6. 2
      files/admin.php
  7. 3
      lib/Group/database.php
  8. 6
      lib/base.php
  9. 16
      lib/group.php

@ -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" ));
}

@ -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();
}

@ -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();
}

@ -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();
}

@ -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();
}

@ -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();
}

@ -75,6 +75,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 );
return $result->numRows() > 0 ? true : false;
}
@ -86,7 +87,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
* @param string $groupName Name of the group in which add the user
*/
public static function addToGroup( $username, $groupName ){
if( !OC_USER::inGroup( $username, $groupName )){
if( !self::inGroup( $username, $groupName )){
$query = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" );
$result = $query->execute( $username, $groupName );
}

@ -99,6 +99,7 @@ if(!isset($CONFIG_BACKEND)){
$CONFIG_BACKEND='database';
}
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
@ -388,8 +389,7 @@ class OC_DB {
'log_line_break' => '<br>',
'idxname_format' => '%s',
'debug' => true,
'quote_identifier' => true,
);
'quote_identifier' => true );
// Add the dsn according to the database type
if( $CONFIG_DBTYPE == 'sqlite' ){

@ -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
*

Loading…
Cancel
Save