Changeset 132
- Timestamp:
- May 30, 2006 10:05:54 PM (18 years ago)
- Location:
- branches/2.0singleton
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0singleton/bin/module_maker/skel/admin.php
r130 r132 32 32 // The object to validate form input. 33 33 $fv = new FormValidator(); 34 35 $cache =& SessionCache::getInstance(); 34 36 35 37 %SORT_ORDER% … … 56 58 if (getFormData('break_list_cache', false)) { 57 59 // Break the cache because we are changing the list data. 58 SessionCache::breakCache($_SERVER['PHP_SELF']);60 $cache->breakCache($_SERVER['PHP_SELF']); 59 61 } 60 62 … … 248 250 global $lock; 249 251 $db =& DB::getInstance(); 252 $cache =& SessionCache::getInstance(); 250 253 251 254 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id); … … 255 258 256 259 // Break the cache because we are changing the list data. 257 SessionCache::breakCache($_SERVER['PHP_SELF']);260 $cache->breakCache($_SERVER['PHP_SELF']); 258 261 259 262 // Get the information for this object. … … 282 285 global $auth; 283 286 $db =& DB::getInstance(); 287 $cache =& SessionCache::getInstance(); 284 288 285 289 // Break the cache because we are changing the list data. 286 SessionCache::breakCache($_SERVER['PHP_SELF']);290 $cache->breakCache($_SERVER['PHP_SELF']); 287 291 288 292 %INSERT% … … 300 304 function updateRecord($frm) 301 305 { 302 global $auth, $lock; 303 306 global $auth, $lock; 307 $app =& App::getInstance(); 308 $cache =& SessionCache::getInstance(); 309 304 310 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%']); 305 311 if ($lock->isLocked() && !$lock->isMine()) { … … 308 314 309 315 // Break the cache because we are changing the list data. 310 SessionCache::breakCache($_SERVER['PHP_SELF']);316 $cache->breakCache($_SERVER['PHP_SELF']); 311 317 312 318 %UPDATE% … … 327 333 global $so; 328 334 $db =& DB::getInstance(); 335 $prefs =& Prefs::getInstance(); 336 $cache =& SessionCache::getInstance(); 329 337 330 338 $where_clause = ''; … … 375 383 // without knowing the hash. 376 384 $cache_hash = md5($sql . '|' . $page->total_items); 377 if ( Prefs::getValue('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) {378 SessionCache::breakCache($_SERVER['PHP_SELF']);379 Prefs::setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);380 } 381 382 if ( SessionCache::isCached($_SERVER['PHP_SELF'])) {385 if ($prefs->getValue('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) { 386 $cache->breakCache($_SERVER['PHP_SELF']); 387 $prefs->setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']); 388 } 389 390 if ($cache->isCached($_SERVER['PHP_SELF'])) { 383 391 // Get the cached results. 384 $list = SessionCache::getCache($_SERVER['PHP_SELF']);392 $list = $cache->getCache($_SERVER['PHP_SELF']); 385 393 } else { 386 394 // If the list is not already cached, query now. … … 393 401 if (isset($list) && !empty($list)) { 394 402 // Cache the results. 395 SessionCache::putCache($list, $_SERVER['PHP_SELF']);403 $cache->putCache($list, $_SERVER['PHP_SELF']); 396 404 } 397 405 } … … 403 411 { 404 412 $db =& DB::getInstance(); 413 $cache =& SessionCache::getInstance(); 405 414 406 415 if (!is_array($ranks)) { … … 410 419 411 420 // Break the cache because we are changing the list data. 412 SessionCache::breakCache($_SERVER['PHP_SELF']);421 $cache->breakCache($_SERVER['PHP_SELF']); 413 422 414 423 // Count the ranks with invalid numbers -
branches/2.0singleton/lib/PageNumbers.inc.php
r130 r132 72 72 function setPerPage($per_page, $default=25, $save_value=true) 73 73 { 74 // (1) By provided argument, if valid. 74 $prefs =& Prefs::getInstance(); 75 76 // (1) By provided argument, if valid. 75 77 // (2) By saved preference, if available. 76 78 // (3) Set to default value if provided and valid. … … 79 81 $this->_per_page = $per_page; 80 82 if ($save_value) { 81 Prefs::setValue('items_per_page', $this->_per_page, $_SERVER['PHP_SELF']);82 } 83 } else if ($save_value && Prefs::exists('items_per_page', $_SERVER['PHP_SELF'])) {84 $this->_per_page = (int) Prefs::getValue('items_per_page', $_SERVER['PHP_SELF']);83 $prefs->setValue('items_per_page', $this->_per_page, $_SERVER['PHP_SELF']); 84 } 85 } else if ($save_value && $prefs->exists('items_per_page', $_SERVER['PHP_SELF'])) { 86 $this->_per_page = (int)$prefs->getValue('items_per_page', $_SERVER['PHP_SELF']); 85 87 } else if (is_numeric($default) && $default > 0) { 86 88 $this->_per_page = $default; … … 94 96 function setPageNumber($page_number, $save_value=true) 95 97 { 96 // (1) By provided argument, if valid. 98 $prefs =& Prefs::getInstance(); 99 100 // (1) By provided argument, if valid. 97 101 // (2) By saved preference, if available. 98 102 // (3) Don't change from what was provided at class instantiation. … … 105 109 } 106 110 if ($save_value) { 107 Prefs::setValue('page_number', $this->current_page, $_SERVER['PHP_SELF']);108 } 109 } else if ($save_value && Prefs::exists('page_number', $_SERVER['PHP_SELF'])) {110 $this->current_page = (int) Prefs::getValue('page_number', $_SERVER['PHP_SELF']);111 $prefs->setValue('page_number', $this->current_page, $_SERVER['PHP_SELF']); 112 } 113 } else if ($save_value && $prefs->exists('page_number', $_SERVER['PHP_SELF'])) { 114 $this->current_page = (int)$prefs->getValue('page_number', $_SERVER['PHP_SELF']); 111 115 } 112 116 $this->set_page_number_initialized = true; -
branches/2.0singleton/lib/SortOrder.inc.php
r130 r132 69 69 function setDefault($default_sort = '', $default_order = '') 70 70 { 71 $prefs =& Prefs::getInstance(); 72 71 73 // Which column to sort by? 72 74 // (1) By GET or POST specification, if available. … … 76 78 if (!empty($new_sort_by)) { 77 79 $this->sort_by = $new_sort_by; 78 Prefs::setValue('sort_by', $this->sort_by, $_SERVER['PHP_SELF']);79 } else if ( Prefs::exists('sort_by', $_SERVER['PHP_SELF'])) {80 $this->sort_by = Prefs::getValue('sort_by', $_SERVER['PHP_SELF']);80 $prefs->setValue('sort_by', $this->sort_by, $_SERVER['PHP_SELF']); 81 } else if ($prefs->exists('sort_by', $_SERVER['PHP_SELF'])) { 82 $this->sort_by = $prefs->getValue('sort_by', $_SERVER['PHP_SELF']); 81 83 } else { 82 84 $this->sort_by = $default_sort; … … 90 92 if (!empty($new_order)) { 91 93 $this->order = $new_order; 92 Prefs::setValue('sort_order', $this->order, $_SERVER['PHP_SELF']);93 } else if ( Prefs::exists('sort_order', $_SERVER['PHP_SELF'])) {94 $this->order = Prefs::getValue('sort_order', $_SERVER['PHP_SELF']);94 $prefs->setValue('sort_order', $this->order, $_SERVER['PHP_SELF']); 95 } else if ($prefs->exists('sort_order', $_SERVER['PHP_SELF'])) { 96 $this->order = $prefs->getValue('sort_order', $_SERVER['PHP_SELF']); 95 97 } else { 96 98 $this->order = $default_order; … … 109 111 function set($sort = null, $order = null) 110 112 { 113 $prefs =& Prefs::getInstance(); 114 111 115 // Set new sort value. 112 116 if (isset($sort)) { 113 117 $this->sort_by = $sort; 114 Prefs::setValue('sort_by', $this->sort_by, $_SERVER['PHP_SELF']);118 $prefs->setValue('sort_by', $this->sort_by, $_SERVER['PHP_SELF']); 115 119 } 116 120 … … 118 122 if (isset($order)) { 119 123 $this->order = $order; 120 Prefs::setValue('sort_order', $this->order, $_SERVER['PHP_SELF']);124 $prefs->setValue('sort_order', $this->order, $_SERVER['PHP_SELF']); 121 125 } 122 126 } -
branches/2.0singleton/services/admins.php
r130 r132 29 29 // The object to validate form input. 30 30 $fv = new FormValidator(); 31 32 $cache =& SessionCache::getInstance(); 31 33 32 34 // Instantiate a sorting object with the default sort and order. Add SQL for each column. … … 69 71 if (getFormData('break_list_cache', false)) { 70 72 // Break the cache because we are changing the list data. 71 SessionCache::breakCache($_SERVER['PHP_SELF']);73 $cache->breakCache($_SERVER['PHP_SELF']); 72 74 } 73 75 … … 317 319 $app =& App::getInstance(); 318 320 $db =& DB::getInstance(); 321 $cache =& SessionCache::getInstance(); 319 322 320 323 $lock->select('admin_tbl', 'admin_id', $id); … … 324 327 325 328 // Break the cache because we are changing the list data. 326 SessionCache::breakCache($_SERVER['PHP_SELF']);329 $cache->breakCache($_SERVER['PHP_SELF']); 327 330 328 331 // Get the information for this object. … … 364 367 $app =& App::getInstance(); 365 368 $db =& DB::getInstance(); 369 $cache =& SessionCache::getInstance(); 366 370 367 371 // Break the cache because we are changing the list data. 368 SessionCache::breakCache($_SERVER['PHP_SELF']);372 $cache->breakCache($_SERVER['PHP_SELF']); 369 373 370 374 // Insert record data. … … 407 411 $app =& App::getInstance(); 408 412 $db =& DB::getInstance(); 413 $cache =& SessionCache::getInstance(); 409 414 410 415 $lock->select('admin_tbl', 'admin_id', $frm['admin_id']); … … 414 419 415 420 // Break the cache because we are changing the list data. 416 SessionCache::breakCache($_SERVER['PHP_SELF']);421 $cache->breakCache($_SERVER['PHP_SELF']); 417 422 418 423 // If the userpass is left blank or with the filler **** characters, we don't want to update it. … … 450 455 global $so; 451 456 $db =& DB::getInstance(); 457 $prefs =& Prefs::getInstance(); 458 $cache =& SessionCache::getInstance(); 452 459 453 454 460 $where_clause = ''; 455 461 … … 501 507 // without knowing the hash. 502 508 $cache_hash = md5($sql . '|' . $page->total_items); 503 if ( Prefs::getValue('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) {504 SessionCache::breakCache($_SERVER['PHP_SELF']);505 Prefs::setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);506 } 507 508 if ( SessionCache::isCached($_SERVER['PHP_SELF']) && false) {509 if ($prefs->getValue('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) { 510 $cache->breakCache($_SERVER['PHP_SELF']); 511 $prefs->setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']); 512 } 513 514 if ($cache->isCached($_SERVER['PHP_SELF']) && false) { 509 515 // Get the cached results. 510 $list = SessionCache::getCache($_SERVER['PHP_SELF']);516 $list = $cache->getCache($_SERVER['PHP_SELF']); 511 517 } else { 512 518 // If the list is not already cached, query now. … … 519 525 if (isset($list) && !empty($list)) { 520 526 // Cache the results. 521 SessionCache::putCache($list, $_SERVER['PHP_SELF']);527 $cache->putCache($list, $_SERVER['PHP_SELF']); 522 528 } 523 529 } -
branches/2.0singleton/services/logs.php
r129 r132 39 39 40 40 // Set the defaults and catch incoming settings. 41 Prefs::setDefault('log_file', $app->getParam('log_filename'), 'logs_module'); 42 Prefs::setValue('log_file', getFormData('log'), 'logs_module'); 41 $prefs =& Prefs::getInstance(); 42 $prefs->setDefault('log_file', $app->getParam('log_filename'), 'logs_module'); 43 $prefs->setValue('log_file', getFormData('log'), 'logs_module'); 43 44 44 45 // Titles and navigation header. 45 $nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), Prefs::getValue('log_file', 'logs_module')), '/admin/logs.php');46 $nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), $prefs->getValue('log_file', 'logs_module')), '/admin/logs.php'); 46 47 47 48 /****************************************************************************** … … 56 57 case 'delete' : 57 58 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 58 deleteLog( Prefs::getValue('log_file', 'logs_module'));59 Prefs::setValue('log_file', $app->getParam('log_filename'), 'logs_module');59 deleteLog($prefs->getValue('log_file', 'logs_module')); 60 $prefs->setValue('log_file', $app->getParam('log_filename'), 'logs_module'); 60 61 if ($app->validBoomerangURL('app_log')) { 61 62 // Display boomerang page. … … 68 69 case 'clear' : 69 70 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 70 clearLog( Prefs::getValue('log_file', 'logs_module'));71 clearLog($prefs->getValue('log_file', 'logs_module')); 71 72 if ($app->validBoomerangURL('app_log')) { 72 73 // Display boomerang page. … … 79 80 case 'archive' : 80 81 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 81 if (archiveLog( Prefs::getValue('log_file', 'logs_module'))) {82 if (archiveLog($prefs->getValue('log_file', 'logs_module'))) { 82 83 // Now flush current log. 83 84 $app->dieURL($_SERVER['PHP_SELF'] . '?op=clear'); … … 97 98 case 'download' : 98 99 header('Content-Type: application/octet-stream'); 99 header(sprintf('Content-Disposition: attachment; filename=%s.txt', Prefs::getValue('log_file', 'logs_module')));100 printLog( Prefs::getValue('log_file', 'logs_module'));100 header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->getValue('log_file', 'logs_module'))); 101 printLog($prefs->getValue('log_file', 'logs_module')); 101 102 die; 102 103 break; 103 104 104 105 default : 105 $list =& getLog( Prefs::getValue('log_file', 'logs_module'), getFormData('search_query'));106 $list =& getLog($prefs->getValue('log_file', 'logs_module'), getFormData('search_query')); 106 107 $main_template = 'log_list.ihtml'; 107 108 break; … … 125 126 include 'header.ihtml'; 126 127 if ('output' == $main_template) { 127 printLog( Prefs::getValue('log_file', 'logs_module'));128 printLog($prefs->getValue('log_file', 'logs_module')); 128 129 } else { 129 130 include 'codebase/services/templates/' . $main_template; -
branches/2.0singleton/services/templates/log_list.ihtml
r131 r132 10 10 <tr class="commandtext"> 11 11 <td> 12 <?php if ($l['filename'] == Prefs::getValue('log_file', 'logs_module')) { ?>12 <?php if ($l['filename'] == $prefs->getValue('log_file', 'logs_module')) { ?> 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.