LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Source for file conf.php

Documentation is available at conf.php

  1. <?php
  2. // BC hack
  3. if (!defined('PATH_SEPARATOR')) {
  4.     if (defined('DIRECTORY_SEPARATOR'&& DIRECTORY_SEPARATOR == "\\"{
  5.         define('PATH_SEPARATOR'';');
  6.     else {
  7.         define('PATH_SEPARATOR'':');
  8.     }
  9. }
  10.  
  11.  
  12. // right definitions
  13. define('READ_TESTS'1);
  14. define('WRITE_TESTS'2);
  15. define('ACCESS'3);
  16. define('LAUNCH_ATOMIC_BOMB'4);
  17. define('FLY_ALIEN_SPACE_CRAFT'5);
  18. define('MAKE_COFFEE'6);
  19. define('DRINK_COFFEE'7);
  20.  
  21. // set this to the path in which the directory for liveuser resides
  22. // more remove the following two lines to test LiveUser in the standard
  23. // PEAR directory
  24. //$path_to_liveuser_dir = './pear/'.PATH_SEPARATOR;
  25. //ini_set('include_path', $path_to_liveuser_dir.ini_get('include_path'));
  26.  
  27. // Data Source Name (DSN)
  28. $dsn 'mysql://root@localhost/liveuser_admin_test_example3';
  29.  
  30. $liveuserConfig = array(
  31.     'session'           => array('name' => 'PHPSESSID','varname' => 'loginInfo'),
  32.     'logout'            => array('destroy'  => true),
  33.     'cookie'            => array(
  34.         'name' => 'loginInfo',
  35.         'path' => null,
  36.         'domain' => null,
  37.         'secure' => false,
  38.         'lifetime' => 30,
  39.         'secret' => 'mysecretkey',
  40.         'savedir' => '.',
  41.     ),
  42.     'authContainers'    => array(
  43.         'DB' => array(
  44.             'type'          => 'MDB2',
  45.             'expireTime'   => 0,
  46.             'idleTime'     => 0,
  47.             'passwordEncryptionMode' => 'PLAIN',
  48.             'storage' => array(
  49.                 'dsn' => $dsn,
  50.                 'alias' => array(
  51.                     'auth_user_id' => 'authuserid',
  52.                     'lastlogin' => 'lastlogin',
  53.                     'is_active' => 'isactive',
  54.                 ),
  55.                 'fields' => array(
  56.                     'lastlogin' => 'timestamp',
  57.                     'is_active' => 'boolean',
  58.                 ),
  59.                 'tables' => array(
  60.                     'users' => array(
  61.                         'fields' => array(
  62.                             'lastlogin' => false,
  63.                             'is_active' => false,
  64.                         ),
  65.                     ),
  66.                 ),
  67.             )
  68.         )
  69.     ),
  70.     'permContainer' => array(
  71.         'type'  => 'Medium',
  72.         'storage' => array(
  73.             'MDB2' => array(
  74.                 'dsn' => $dsn,
  75.                 'prefix' => 'liveuser_',
  76.                 'alias' => array(),
  77.                 'tables' => array(),
  78.                 'fields' => array(),
  79.             ),
  80.         ),
  81.     ),
  82. );
  83.  
  84. // Get LiveUser class definition
  85. require_once 'LiveUser.php';
  86.  
  87. // The error handling stuff is not needed and used only for debugging
  88. // while LiveUser is not yet mature
  89. PEAR::setErrorHandling(PEAR_ERROR_CALLBACK'eHandler');
  90.  
  91. function eHandler($errObj)
  92. {
  93.     echo('<hr /><span style="color: red;">' $errObj->getMessage(':<br />' $errObj->getUserInfo('</span><hr />');
  94.     $debug_backtrace debug_backtrace();
  95.     array_shift($debug_backtrace);
  96.     $message'Debug backtrace:'."\n";
  97.  
  98.     foreach ($debug_backtrace as $trace_item{
  99.         $message.= "\t" '    @ ';
  100.         if (array_key_exists('file'$trace_item)) {
  101.             $message.= basename($trace_item['file']':' $trace_item['line'];
  102.         else {
  103.             $message.= '- PHP inner-code - ';
  104.         }
  105.         $message.= ' -- ';
  106.         if (array_key_exists('class'$trace_item)) {
  107.             $message.= $trace_item['class'$trace_item['type'];
  108.         }
  109.         $message.= $trace_item['function'];
  110.  
  111.         if (array_key_exists('args'$trace_item&& is_array($trace_item['args'])) {
  112.             $message.= '('.@implode(', '$trace_item['args']).')';
  113.         else {
  114.             $message.= '()';
  115.         }
  116.         $message.= "\n";
  117.     }
  118.     echo "<pre>$message</pre>";
  119. }
  120.  
  121. // Create new LiveUser object
  122. $LU =LiveUser::factory($liveuserConfig);
  123.  
  124. if (!$LU->init()) {
  125.     var_dump($LU->getErrors());
  126.     die();
  127. }
  128.  
  129. $handle (array_key_exists('handle'$_REQUEST)) $_REQUEST['handle': null;
  130. $passwd (array_key_exists('passwd'$_REQUEST)) $_REQUEST['passwd': null;
  131. $logout (array_key_exists('logout'$_REQUEST)) $_REQUEST['logout': false;
  132. $remember (array_key_exists('rememberMe'$_REQUEST)) $_REQUEST['rememberMe': false;
  133. if ($logout{
  134.     $LU->logout(true);
  135. elseif(!$LU->isLoggedIn(|| ($handle && $LU->getProperty('handle'!= $handle)) {
  136.     if (!$handle{
  137.         $LU->login(nullnulltrue);
  138.     else {
  139.         $LU->login($handle$passwd$remember);
  140.     }
  141. }
  142.  
  143. require_once 'LiveUser/Admin.php';
  144.  
  145. $luadmin =LiveUser_Admin::factory($liveuserConfig);
  146. $luadmin->init();
  147.  
  148. $language_selected array_key_exists('language'$_GET$_GET['language''de';

Documentation generated on Mon, 11 Mar 2019 15:39:42 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.