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

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