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

Source for file config.inc.php

Documentation is available at config.inc.php

  1. <?php
  2. require_once 'LiveUser/Admin.php';
  3. // Please configure the following file according to your environment
  4.  
  5. $GLOBALS['_LIVEUSER_DEBUG'= true;
  6.  
  7. $db_user 'root';
  8. $db_pass '';
  9. $db_host 'localhost';
  10. $db_name 'liveuser_admin_test_example1';
  11.  
  12. $dsn = "mysql://$db_user:$db_pass@$db_host/$db_name";
  13.  
  14. $backends = array(
  15.     'DB' => array(
  16.         'options' => array()
  17.     )
  18.     'MDB' => array(
  19.         'options' => array()
  20.     ),
  21.     'MDB2' => array(
  22.         'options' => array(
  23.             'debug' => true,
  24.             'debug_handler' => 'echoQuery',
  25.         )
  26.     )
  27. );
  28.  
  29. if (!isset($_GET['storage'])) {
  30.     $storage 'MDB2';
  31. elseif (isset($backends[$_GET['storage']])) {
  32.     $storage strtoupper($_GET['storage']);
  33. else {
  34.     exit('storage Backend not found.');
  35. }
  36.  
  37. require_once $storage.'.php';
  38.  
  39. function echoQuery(&$db$scope$message)
  40. {
  41.     Var_Dump::display($scope.': '.$message);
  42. }
  43.  
  44. $dummy = new $storage;
  45. $db $dummy->connect($dsn$backends[$storage]['options']);
  46.  
  47. if (PEAR::isError($db)) {
  48.     echo $db->getMessage(' ' $db->getUserInfo();
  49.     die();
  50. }
  51.  
  52. $db->setFetchMode(constant($storage.'_FETCHMODE_ASSOC'));
  53.  
  54. $conf =
  55.     array(
  56.         'autoInit' => false,
  57.         'session'  => array(
  58.             'name'     => 'PHPSESSION',
  59.             'varname'  => 'ludata'
  60.         ),
  61.         'login' => array(
  62.             'force'    => false,
  63.         ),
  64.         'logout' => array(
  65.             'destroy'  => true,
  66.         ),
  67.         'authContainers' => array(
  68.             'DB_Local' => array(
  69.                 'type' => $storage,
  70.                 'loginTimeout'  => 0,
  71.                 'expireTime'    => 3600,
  72.                 'idleTime'      => 1800,
  73.                 'allowDuplicateHandles' => false,
  74.                 'storage' => array(
  75.                     'connection' => $db,
  76.                     'dsn' => $dsn,
  77.                     'prefix' => 'liveuser_',
  78.                     'tables' => array(
  79.                         'users' => array(
  80.                             'fields' => array(
  81.                                 'name' => false,
  82.                                 'email' => false,
  83.                             ),
  84.                         ),
  85.                     ),
  86.                     'fields' => array(
  87.                         'name' => 'text',
  88.                         'email' => 'text',
  89.                     ),
  90.                     'alias' => array(
  91.                         'name' => 'name',
  92.                         'email' => 'email',
  93.                         'auth_user_id' => 'user_id',
  94.                     ),
  95.                     // 'force_seq' => false
  96.                 ),
  97.             )
  98.         ),
  99.         'permContainer' => array(
  100.             'type'  => 'Complex',
  101.             'alias' => array(),
  102.             'storage' => array(
  103.                 $storage => array(
  104.                     'connection' => $db,
  105.                     'dsn' => $dsn,
  106.                     'prefix' => 'liveuser_',
  107.                     'tables' => array(),
  108.                     'fields' => array(),
  109.                     'alias' => array(),
  110.                     // 'force_seq' => false
  111.                 ),
  112.             ),
  113.         ),
  114.     );
  115.  
  116. $admin =LiveUser_Admin::factory($conf);
  117. $logconf = array('mode' => 0666'timeFormat' => '%X %x');
  118. $logger &Log::factory('file''liveuser_test.log''ident'$logconf);
  119. $admin->addErrorLog($logger);
  120. $admin->setAdminContainers();

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