- Timestamp:
- Dec 30, 2014 10:24:51 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/acl.cli.php
r484 r502 44 44 // Make sure necessary files exist. 45 45 define('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); 49 foreach ($rii as $filename => $file) { 50 if (mb_strpos($filename, 'db_auth.inc.php') !== false) { 51 $db_auth_file = $filename; 52 break; 53 } 54 } 55 if (!$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 } 58 if (fileowner($db_auth_file) != getmyuid()) { 52 59 die(sprintf("%s error: you must execute this script as the owner of the web files.\n", $this_script)); 53 60 } 54 61 55 62 // Set include path. 56 ini_set('include_path', get_include_path() 57 . PATH_SEPARATOR . COMMON_BASE 58 ); 63 ini_set('include_path', get_include_path() . PATH_SEPARATOR . COMMON_BASE); 59 64 60 65 /******************************************************************** … … 83 88 'log_filename' => 'site_log', 84 89 )); 85 require_once 'global/db_auth.inc.php';90 require_once $db_auth_file; 86 91 87 92 // Start application-based functionality: database, session, environment, ini setup, etc. … … 104 109 if (!$db->tableExists('acl_tbl')) { 105 110 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(); 106 112 die; 107 113 } … … 220 226 break; 221 227 } 228 229 $app->stop(); 230 die; 222 231 223 232 … … 309 318 case 'aro' : 310 319 $tbl = 'aro_tbl'; 311 printf("%- 35s %-5s %-5s %s\n", 'Request objects', 'lft', 'rgt', 'Added');320 printf("%-45s %s\n", 'Request objects', 'Added'); 312 321 break; 313 322 case 'aco' : 314 323 $tbl = 'aco_tbl'; 315 printf("%- 35s %-5s %-5s %s\n", 'Control objects', 'lft', 'rgt', 'Added');324 printf("%-45s %s\n", 'Control objects', 'Added'); 316 325 break; 317 326 case 'axo' : 318 327 $tbl = 'axo_tbl'; 319 printf("%- 35s %-5s %-5s %s\n", 'Xtra objects', 'lft', 'rgt', 'Added');328 printf("%-45s %s\n", 'Xtra objects', 'Added'); 320 329 break; 321 330 default : … … 325 334 } 326 335 327 echo "----------------------------------------------------------- \n";336 echo "---------------------------------------------------------------------\n"; 328 337 329 338 // Retrieve the left and right value of the $root node. … … 342 351 343 352 // 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))); 345 354 346 355 // Add this node to the stack. … … 373 382 "); 374 383 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'); 376 385 echo "------------------------------------------------------------------------------------------------\n"; 377 386 while ($p = mysql_fetch_assoc($qid)) {
Note: See TracChangeset
for help on using the changeset viewer.