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.             'loginTimeout' => 0,
  46.             'expireTime'   => 0,
  47.             'idleTime'     => 0,
  48.             'allowDuplicateHandles'  => 1,
  49.             'passwordEncryptionMode' => 'PLAIN',
  50.             'storage' => array(
  51.                 'dsn' => $dsn,
  52.                 'alias' => array(
  53.                     'auth_user_id' => 'authuserid',
  54.                     'lastlogin' => 'lastlogin',
  55.                     'is_active' => 'isactive',
  56.                 ),
  57.                 'fields' => array(
  58.                     'lastlogin' => 'timestamp',
  59.                     'is_active' => 'boolean',
  60.                 ),
  61.                 'tables' => array(
  62.                     'users' => array(
  63.                         'fields' => array(
  64.                             'lastlogin' => false,
  65.                             'is_active' => false,
  66.                         ),
  67.                     ),
  68.                 ),
  69.             )
  70.         )
  71.     ),
  72.     'permContainer' => array(
  73.         'type'  => 'Medium',
  74.         'alias' => array(),
  75.         'storage' => array(
  76.             'MDB2' => array(
  77.                 'dsn' => $dsn,
  78.                 'prefix' => 'liveuser_',
  79.                 'tables' => array(),
  80.                 'fields' => array(),
  81.             ),
  82.         ),
  83.     ),
  84. );
  85.  
  86. // Get LiveUser class definition
  87. require_once 'LiveUser.php';
  88.  
  89. // The error handling stuff is not needed and used only for debugging
  90. // while LiveUser is not yet mature
  91. PEAR::setErrorHandling(PEAR_ERROR_CALLBACK'eHandler');
  92.  
  93. function eHandler($errObj)
  94. {
  95.     echo('<hr /><span style="color: red;">' $errObj->getMessage(':<br />' $errObj->getUserInfo('</span><hr />');
  96.     $debug_backtrace debug_backtrace();
  97.     array_shift($debug_backtrace);
  98.     $message'Debug backtrace:'."\n";
  99.  
  100.     foreach ($debug_backtrace as $trace_item{
  101.         $message.= "\t" '    @ ';
  102.         if (isset($trace_item['file'])) {
  103.             $message.= basename($trace_item['file']':' $trace_item['line'];
  104.         else {
  105.             $message.= '- PHP inner-code - ';
  106.         }
  107.         $message.= ' -- ';
  108.         if (isset($trace_item['class'])) {
  109.             $message.= $trace_item['class'$trace_item['type'];
  110.         }
  111.         $message.= $trace_item['function'];
  112.  
  113.         if (isset($trace_item['args']&& is_array($trace_item['args'])) {
  114.             $message.= '('.@implode(', '$trace_item['args']).')';
  115.         else {
  116.             $message.= '()';
  117.         }
  118.         $message.= "\n";
  119.     }
  120.     echo "<pre>$message</pre>";
  121. }
  122.  
  123. // Create new LiveUser object
  124. $LU =LiveUser::factory($liveuserConfig);
  125.  
  126. $handle (isset($_REQUEST['handle'])) $_REQUEST['handle': null;
  127. $passwd (isset($_REQUEST['passwd'])) $_REQUEST['passwd': null;
  128. $logout (isset($_REQUEST['logout'])) $_REQUEST['logout': false;
  129. $remember (isset($_REQUEST['rememberMe'])) $_REQUEST['rememberMe': false;
  130.  
  131. if (!$LU->init($handle$passwd$logout$remember)) {
  132.     var_dump($LU->getErrors());
  133.     die();
  134. }
  135.  
  136. require_once 'LiveUser/Admin.php';
  137.  
  138. $luadmin =LiveUser_Admin::factory($liveuserConfig);
  139. $luadmin->setAdminContainers();
  140.  
  141. $language_selected = isset($_GET['language']$_GET['language''de';

Documentation generated on Mon, 11 Mar 2019 14:16:43 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.