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

Source for file conf.php

Documentation is available at conf.php

  1. <?php
  2. define('EMAIL_WEBMASTER''krausbn@php.net');
  3.  
  4. // PEAR path
  5. //$path_to_liveuser_dir = 'path/to/pear/'.PATH_SEPARATOR;
  6. //ini_set('include_path', $path_to_liveuser_dir . ini_get('include_path'));
  7.  
  8. error_reporting(E_ALL ^ E_NOTICE);
  9.  
  10. function php_error_handler($errno$errstr$errfile$errline)
  11. {
  12.     include_once 'HTML/Template/IT.php';
  13.     $tpl = new HTML_Template_IT();
  14.     $tpl->loadTemplatefile('error-page.tpl.php');
  15.  
  16.     $tpl->setVariable('error_msg'"<b>$errfile ($errline)</b><br />$errstr");
  17.  
  18.     $tpl->show();
  19.      exit();
  20. }
  21.  
  22. set_error_handler('php_error_handler');
  23.  
  24. require_once 'PEAR.php';
  25.  
  26. function pear_error_handler($err_obj)
  27. {
  28.     $error_string $err_obj->getMessage('<br />' $err_obj->getUserinfo();
  29.     trigger_error($error_stringE_USER_ERROR);
  30. }
  31.  
  32. PEAR::setErrorHandling(PEAR_ERROR_CALLBACK'pear_error_handler');
  33.  
  34. function showLoginForm($liveUserObj = false)
  35. {
  36.     include_once 'HTML/Template/IT.php';
  37.     $tpl = new HTML_Template_IT();
  38.     $tpl->loadTemplatefile('loginform.tpl.php');
  39.  
  40.     $tpl->setVariable('form_action'$_SERVER['PHP_SELF']);
  41.  
  42.     if (is_object($liveUserObj)) {
  43.         if ($liveUserObj->status{
  44.             switch ($liveUserObj->status{
  45.                 case LIVEUSER_STATUS_ISINACTIVE:
  46.                     $tpl->touchBlock('inactive');
  47.                     break;
  48.                 case LIVEUSER_STATUS_IDLED:
  49.                     $tpl->touchBlock('idled');
  50.                     break;
  51.                 case LIVEUSER_STATUS_EXPIRED:
  52.                     $tpl->touchBlock('expired');
  53.                     break;
  54.                 default:
  55.                     $tpl->touchBlock('failure');
  56.                     break;
  57.             }
  58.         }
  59.     }
  60.  
  61.     $tpl->show();
  62.     exit();
  63. }
  64.  
  65.  
  66. require_once 'DB.php';
  67.  
  68. // Data Source Name (DSN)
  69. //$dsn = '{dbtype}://{user}:{passwd}@{dbhost}/{dbname}';
  70. $dsn 'mysql://root:@localhost/pear_test';
  71.  
  72. $db =DB::connect($dsntrue);
  73. $db->setFetchMode(DB_FETCHMODE_ASSOC);
  74.  
  75.  
  76. require_once 'HTML/Template/IT.php';
  77. $tpl = new HTML_Template_IT();
  78.  
  79. require_once 'LiveUser.php';
  80. $LUOptions = array(
  81.     'autoInit'       => true,
  82.     'login'          => array('function' => 'showLoginForm',
  83.                               'force'    => true),
  84.     'logout' => array(
  85.         'trigger'  => 'logout',
  86.         'redirect' => '',
  87.         'destroy'  => true,
  88.         'method'   => 'get',
  89.         'function' => ''
  90.          ),
  91.     'authContainers' => array(array('type'          => 'DB',
  92.                                     'dsn'           => $dsn,
  93.                                     'loginTimeout'  => 0,
  94.                                     'expireTime'    => 3600,
  95.                                     'idleTime'      => 1800,
  96.                                     'allowDuplicateHandles' => 0,
  97.                                     'authTable'     => 'liveuser_users',
  98.                                     'authTableCols' => array(
  99.                                         'required' => array(
  100.                                             'auth_user_id' => array('name' => 'auth_user_id''type' => ''),
  101.                                             'handle'       => array('name' => 'handle',       'type' => ''),
  102.                                             'passwd'       => array('name' => 'passwd',       'type' => ''),
  103.                                         ),
  104.                                         'optional' => array(
  105.                                             'lastlogin'    => array('name' => 'lastlogin',    'type' => ''),
  106.                                             'is_active'    => array('name' => 'is_active',    'type' => '')
  107.                                         )
  108.                                     )
  109.                                 )
  110.                             ),
  111.     'permContainer'  => array('type'     => 'DB_Complex',
  112.                             'dsn' => $dsn,
  113.                             'prefix'     => 'liveuser_')
  114.     );
  115.  
  116. $LU &LiveUser::factory($LUOptions);
  117.  
  118. define('AREA_NEWS',          1);
  119. define('RIGHT_NEWS_NEW',     1);
  120. define('RIGHT_NEWS_CHANGE',  2);
  121. define('RIGHT_NEWS_DELETE',  3);

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