Re: Re: LiveUser Digest, Vol 34, Issue 9

Aireal <[email protected]> Wed, 16 Nov 2005 22:20:29 +0100
Newsgroups gmane.comp.php.pear.liveuser
Message-ID <[email protected]>
Maybe you can help me with this code ?
The error is
Debug Error: C:\Program Files\EasyPHP1-8\php\pear\LiveUser\Auth\MDB2.php 
line 78 - Class liveuser_auth_mdb2:  Cannot inherit from undefined class 
liveuser_auth_common

SOMETIMES it crashes inside
    if (!$usr->init($handle, $passwd, $logout, $remember))
SOMETIMES inside
    $admin->setAdminContainers();
SOMETIMES inside
    $currentApp = $admin->_perm->getCurrentApplication();

This depends somehow on wheather the user is logged in or not or is a 
"returning" user
I really cannot figure out what the problem is, please advise

The database is from the Liveuser example with news, I think example 5


My conviction is that somehow Common.h from Liveuser/Admin/Auth and 
Common.h from Liveuser/Auth are in collision


<?php
error_reporting(E_ALL);

require_once 'MDB2.php';
require_once 'Var_Dump.php';
require_once 'LiveUser.php';
require_once 'LiveUser/Admin.php';
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';



function echoQuery(&$db, $scope, $message)
{
    Var_Dump::display($scope.': '.$message);
}


$storage = 'MDB2';
$dsn = 'mysql://nido:nido@localhost/asilo_nido';
$db_options = array(
//            'debug' => true
//          ,'debug_handler' => 'echoQuery'
);

$db = MDB2::connect($dsn, $db_options);

if (PEAR::isError($db)) {
    echo $db->getMessage() . ' ' . $db->getUserInfo();
}
$exdb=$db->loadModule('Extended');

$db->setFetchMode(MDB2_FETCHMODE_ASSOC);


$conf_liveuser =
        array(
            'debug' => true,
            'session'  => array(
                'name'     => 'PHPSESSION',
                'varname'  => 'ludata'
            ),
            'login' => array(
                'force'    => false,
            ),
            'logout' => array(
                'destroy'  => true,
            ),
            'authContainers' => array(
                'DB' => array(
                    'type' => $storage,
                    'loginTimeout'  => 0,
                    'expireTime'    => 3600,
                    'idleTime'      => 1800,
                    'allowDuplicateHandles' => false,
                    'storage' => array(
                        'connection' => $db,
                        'dsn' => $dsn,
                        'prefix' => 'liveuser_',
                        'tables' => array(
                            'users' => array(
                                'fields' => array(
                                    'name' => false,
                                    'email' => false,
                                    'level' => false,
                                    'owner_app_id' => false
                                ),
                            ),
                        ),
                        'fields' => array(
                            'name' => 'text',
                            'email' => 'text',
                            'level' => 'integer',
                            'owner_app_id' => 'integer',
                        ),
                        'alias' => array(
                            'name' => 'name',
                            'email' => 'email',
                            'level' => 'level',
                            'owner_app_id' => 'owner_app_id',
                            'auth_user_id' => 'user_id',
                        ),
                        // 'force_seq' => false
                    ),
                )
            ),
            'permContainer' => array(
                'type'  => 'Simple',
                'alias' => array(),
                'storage' => array(
                    $storage => array(
                        'connection' => $db,
                        'dsn' => $dsn,
                        'prefix' => 'liveuser_',
                        'tables' => array(),
                        'fields' => array(),
                        'alias' => array(),
                        // 'force_seq' => false
                    ),
                ),
            ),
        );

                   
PEAR::setErrorHandling(PEAR_ERROR_RETURN);

$usr = &LiveUser::singleton($conf_liveuser, "nido");

$handle = (array_key_exists('handle', $_REQUEST)) ? $_REQUEST['handle'] 
: null;
$passwd = (array_key_exists('passwd', $_REQUEST)) ? $_REQUEST['passwd'] 
: null;
$logout = (array_key_exists('logout', $_REQUEST)) ? $_REQUEST['logout'] 
: false;
$remember = (array_key_exists('rememberMe', $_REQUEST)) ? 
$_REQUEST['rememberMe'] : false;

if (array_key_exists('doLogin', $_REQUEST)) {   
    if (!$usr->init($handle, $passwd, $logout, $remember)) {
        var_dump($usr->getErrors());
        die();
    }
}

$admin =& LiveUser_Admin::factory($conf_liveuser,"nidi");
$logconf = array('mode' => 0666, 'timeFormat' => '%X %x');
$logger = &Log::factory('file', 'liveuser_admin.log', 'ident', $logconf);
$admin->log->addChild($logger);
$admin->setAdminContainers();


if ($usr->isLoggedIn()) {
    echo $usr->getProperty('handle');
    $currentApp = $admin->_perm->getCurrentApplication();
    echo '<strong>'.$currentApp.'</strong> is our current application 
now.<br />';
}



?>




Lukas Kahwe Smith wrote:
> Aireal wrote:
>
>> First require_once 'LiveUser\Auth\Common.php is ': is done
>> After require_once 'LiveUser\Admin\Auth\Common.php'; doesn't include 
>> anything because it thinks Common.php is already included
>
> you seem to be confused about how include path works or how includes 
> work. since the files are in a different directory they will not 
> collide. there is probably something else screwed up or you are not 
> pasting the code you actually use.
>
> regards,
> Lukas
>
>
>