Changeset 152 for trunk/services
- Timestamp:
- Jun 7, 2006 5:35:16 AM (18 years ago)
- Location:
- trunk/services
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/services/admins.php
r147 r152 30 30 $fv = new FormValidator(); 31 31 32 $cache =& Cache::getInstance(); 32 // Configure the prefs object. 33 $prefs =& Prefs::getInstance('admins'); 34 $prefs->setParam(array('persistent' => false)); 35 36 // Configure the cache object. 37 $cache =& Cache::getInstance('admins'); 38 $cache->setParam(array('enable' => true)); 33 39 34 40 // Instantiate a sorting object with the default sort and order. Add SQL for each column. … … 70 76 71 77 if (getFormData('break_list_cache', false)) { 72 // Break the cache because we are changing thelist data.73 $cache->delete( $_SERVER['PHP_SELF']);78 // Remove any stale cached list data. 79 $cache->delete('list'); 74 80 } 75 81 … … 319 325 $app =& App::getInstance(); 320 326 $db =& DB::getInstance(); 321 $cache =& Cache::getInstance( );327 $cache =& Cache::getInstance('admins'); 322 328 323 329 $lock->select('admin_tbl', 'admin_id', $id); … … 326 332 } 327 333 328 // Break the cache because we are changing thelist data.329 $cache->delete( $_SERVER['PHP_SELF']);334 // Remove any stale cached list data. 335 $cache->delete('list'); 330 336 331 337 // Get the information for this object. … … 367 373 $app =& App::getInstance(); 368 374 $db =& DB::getInstance(); 369 $cache =& Cache::getInstance( );375 $cache =& Cache::getInstance('admins'); 370 376 371 // Break the cache because we are changing thelist data.372 $cache->delete( $_SERVER['PHP_SELF']);377 // Remove any stale cached list data. 378 $cache->delete('list'); 373 379 374 380 // Insert record data. … … 411 417 $app =& App::getInstance(); 412 418 $db =& DB::getInstance(); 413 $cache =& Cache::getInstance( );419 $cache =& Cache::getInstance('admins'); 414 420 415 421 $lock->select('admin_tbl', 'admin_id', $frm['admin_id']); … … 418 424 } 419 425 420 // Break the cache because we are changing thelist data.421 $cache->delete( $_SERVER['PHP_SELF']);426 // Remove any stale cached list data. 427 $cache->delete('list'); 422 428 423 429 // If the userpass is left blank or with the filler **** characters, we don't want to update it. … … 455 461 global $so; 456 462 $db =& DB::getInstance(); 457 $prefs =& Prefs::getInstance( );458 $cache =& Cache::getInstance( );463 $prefs =& Prefs::getInstance('admins'); 464 $cache =& Cache::getInstance('admins'); 459 465 460 466 $where_clause = ''; … … 501 507 "; 502 508 509 // Use a cash hash to determine if the result-set has changed. 503 510 // A unique key for this query, with the total_items in case db records 504 511 // were added since the last cache. This identifies a unique set of … … 507 514 // without knowing the hash. 508 515 $cache_hash = md5($sql . '|' . $page->total_items); 509 if ($prefs->get('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) { 510 $cache->delete($_SERVER['PHP_SELF']); 511 $prefs->set('cache_hash', $cache_hash, $_SERVER['PHP_SELF']); 512 } 513 514 if ($cache->exists($_SERVER['PHP_SELF']) && false) { 515 // Get the cached results. 516 $list = $cache->get($_SERVER['PHP_SELF']); 517 } else { 518 // If the list is not already cached, query now. 519 $qid = $db->query($sql); 520 // Fill an array with the items for this page. 521 while ($row = mysql_fetch_assoc($qid)) { 522 $list[] = $row; 523 } 524 525 if (isset($list) && !empty($list)) { 526 // Cache the results. 527 $cache->set($list, $_SERVER['PHP_SELF']); 528 } 516 if ($prefs->get('cache_hash') != $cache_hash) { 517 $cache->delete('list'); 518 $prefs->set('cache_hash', $cache_hash); 519 } 520 521 // First try to return from the cache. 522 if ($cache->exists('list')) { 523 return $cache->get('list'); 524 } 525 526 // The list was not cached, so issue the real query. 527 $qid = $db->query($sql); 528 while ($row = mysql_fetch_assoc($qid)) { 529 $list[] = $row; 530 } 531 532 // Save this list into the cache. 533 if (isset($list) && !empty($list)) { 534 $cache->set('list', $list); 529 535 } 530 536 -
trunk/services/logs.php
r143 r152 39 39 40 40 // Set the defaults and catch incoming settings. 41 $prefs =& Prefs::getInstance(); 42 $prefs->setDefault('log_file', $app->getParam('log_filename'), 'logs_module'); 43 $prefs->set('log_file', getFormData('log'), 'logs_module'); 41 $prefs =& Prefs::getInstance('admin_logs'); 42 $prefs->setDefaults(array( 43 'log_file' => $app->getParam('log_filename') 44 )); 45 $prefs->set('log_file', getFormData('log')); 44 46 45 47 // Titles and navigation header. 46 $nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), $prefs->get('log_file' , 'logs_module')), '/admin/logs.php');48 $nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), $prefs->get('log_file')), '/admin/logs.php'); 47 49 48 50 /******************************************************************** … … 57 59 case 'delete' : 58 60 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 59 deleteLog($prefs->get('log_file' , 'logs_module'));60 $prefs->set('log_file', $app->getParam('log_filename') , 'logs_module');61 deleteLog($prefs->get('log_file')); 62 $prefs->set('log_file', $app->getParam('log_filename')); 61 63 if ($app->validBoomerangURL('app_log')) { 62 64 // Display boomerang page. … … 69 71 case 'clear' : 70 72 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 71 clearLog($prefs->get('log_file' , 'logs_module'));73 clearLog($prefs->get('log_file')); 72 74 if ($app->validBoomerangURL('app_log')) { 73 75 // Display boomerang page. … … 80 82 case 'archive' : 81 83 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 82 if (archiveLog($prefs->get('log_file' , 'logs_module'))) {84 if (archiveLog($prefs->get('log_file'))) { 83 85 // Now flush current log. 84 86 $app->dieURL($_SERVER['PHP_SELF'] . '?op=clear'); … … 98 100 case 'download' : 99 101 header('Content-Type: application/octet-stream'); 100 header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->get('log_file' , 'logs_module')));101 printLog($prefs->get('log_file' , 'logs_module'));102 header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->get('log_file'))); 103 printLog($prefs->get('log_file')); 102 104 die; 103 105 break; 104 106 105 107 default : 106 $list =& getLog($prefs->get('log_file' , 'logs_module'), getFormData('search_query'));108 $list =& getLog($prefs->get('log_file'), getFormData('search_query')); 107 109 $main_template = 'log_list.ihtml'; 108 110 break; … … 126 128 include 'header.ihtml'; 127 129 if ('output' == $main_template) { 128 printLog($prefs->get('log_file' , 'logs_module'));130 printLog($prefs->get('log_file')); 129 131 } else { 130 132 include 'codebase/services/templates/' . $main_template; -
trunk/services/templates/log_list.ihtml
r136 r152 10 10 <tr class="commandtext"> 11 11 <td> 12 <?php if ($l['filename'] == $prefs->get('log_file' , 'logs_module')) { ?>12 <?php if ($l['filename'] == $prefs->get('log_file')) { ?> 13 13 <span class="commanditem"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></span> 14 14 <?php } else { ?>
Note: See TracChangeset
for help on using the changeset viewer.