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

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