Changeset 502 for trunk/bin


Ignore:
Timestamp:
Dec 30, 2014 10:24:51 PM (9 years ago)
Author:
anonymous
Message:

Many minor fixes during pulso development

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/acl.cli.php

    r484 r502  
    4444// Make sure necessary files exist.
    4545define('COMMON_BASE', realpath('.'));
    46 $db_quth_file = COMMON_BASE . '/global/db_auth.inc.php';
    47 if (!file_exists($db_quth_file)) {
    48     die(sprintf("%s error: the current directory must be common site directory (i.e. the parent directory of the document root) AND the global/db_auth.inc.php file must exist.\n", $this_script));
    49 }
    50 
    51 if (fileowner($db_quth_file) != getmyuid()) {
     46$db_auth_file = false;
     47$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(COMMON_BASE));
     48$rii->setMaxDepth(2);
     49foreach ($rii as $filename => $file) {
     50    if (mb_strpos($filename, 'db_auth.inc.php') !== false) {
     51        $db_auth_file = $filename;
     52        break;
     53    }
     54}
     55if (!$db_auth_file) {
     56    die(sprintf("%s error: the current directory must be common site directory (i.e. the parent directory of the document root) AND the db_auth.inc.php file must exist.\n", $this_script));
     57}
     58if (fileowner($db_auth_file) != getmyuid()) {
    5259    die(sprintf("%s error: you must execute this script as the owner of the web files.\n", $this_script));
    5360}
    5461
    5562// Set include path.
    56 ini_set('include_path', get_include_path()
    57     . PATH_SEPARATOR . COMMON_BASE
    58 );
     63ini_set('include_path', get_include_path() . PATH_SEPARATOR . COMMON_BASE);
    5964
    6065/********************************************************************
     
    8388    'log_filename' => 'site_log',
    8489));
    85 require_once 'global/db_auth.inc.php';
     90require_once $db_auth_file;
    8691
    8792// Start application-based functionality: database, session, environment, ini setup, etc.
     
    104109if (!$db->tableExists('acl_tbl')) {
    105110    printf("This project doesn't appear to be using ACL (there is no acl_tbl in the %s DB).\n", $app->getParam('db_name'));
     111    $app->stop();
    106112    die;
    107113}
     
    220226    break;
    221227}
     228
     229$app->stop();
     230die;
    222231
    223232
     
    309318    case 'aro' :
    310319        $tbl = 'aro_tbl';
    311         printf("%-35s %-5s %-5s %s\n", 'Request objects', 'lft', 'rgt', 'Added');
     320        printf("%-45s %s\n", 'Request objects', 'Added');
    312321        break;
    313322    case 'aco' :
    314323        $tbl = 'aco_tbl';
    315         printf("%-35s %-5s %-5s %s\n", 'Control objects', 'lft', 'rgt', 'Added');
     324        printf("%-45s %s\n", 'Control objects', 'Added');
    316325        break;
    317326    case 'axo' :
    318327        $tbl = 'axo_tbl';
    319         printf("%-35s %-5s %-5s %s\n", 'Xtra objects', 'lft', 'rgt', 'Added');
     328        printf("%-45s %s\n", 'Xtra objects', 'Added');
    320329        break;
    321330    default :
     
    325334    }
    326335
    327     echo "-----------------------------------------------------------\n";
     336    echo "---------------------------------------------------------------------\n";
    328337
    329338    // Retrieve the left and right value of the $root node.
     
    342351
    343352        // Display indented node title.
    344         printf("%-35s %-5s %-5s %s\n", str_repeat('    ', sizeof($depth)) . $name, $lft, $rgt, date($app->getParam('date_format'), strtotime($added_datetime)));
     353        printf("%-45s %s\n", str_repeat('    ', sizeof($depth)) . $name, date($app->getParam('date_format') . ' ' . $app->getParam('time_format'), strtotime($added_datetime)));
    345354
    346355        // Add this node to the stack.
     
    373382    ");
    374383    echo "\n";
    375     printf("%-25s %-25s %-25s %-6s %-10s\n", 'Request objects', 'Control objects', 'Xtra objects', '', 'Added');
     384    printf("%-25s %-25s %-25s %-6s %-10s\n", 'Request objects', 'Control objects', 'Xtra objects', 'Grant', 'Added');
    376385    echo "------------------------------------------------------------------------------------------------\n";
    377386    while ($p = mysql_fetch_assoc($qid)) {
Note: See TracChangeset for help on using the changeset viewer.