Ignore:
Timestamp:
Jun 1, 2006 7:42:53 AM (18 years ago)
Author:
scdev
Message:

Q - Finished integrating singleton methods into existing code. Renamed SessionCache? to Cache, and renamed methods in Cache and Prefs

Location:
branches/2.0singleton/services
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0singleton/services/admins.php

    r132 r135  
    1111
    1212require_once 'codebase/lib/PageNumbers.inc.php';
    13 require_once 'codebase/lib/SessionCache.inc.php';
     13require_once 'codebase/lib/Cache.inc.php';
    1414require_once 'codebase/lib/FormValidator.inc.php';
    1515require_once 'codebase/lib/SortOrder.inc.php';
     
    3030$fv = new FormValidator();
    3131
    32 $cache =& SessionCache::getInstance();
     32$cache =& Cache::getInstance();
    3333
    3434// Instantiate a sorting object with the default sort and order. Add SQL for each column.
     
    7171if (getFormData('break_list_cache', false)) {
    7272    // Break the cache because we are changing the list data.
    73     $cache->breakCache($_SERVER['PHP_SELF']);
     73    $cache->delete($_SERVER['PHP_SELF']);
    7474}
    7575
     
    319319    $app =& App::getInstance();
    320320    $db =& DB::getInstance();
    321     $cache =& SessionCache::getInstance();
     321    $cache =& Cache::getInstance();
    322322   
    323323    $lock->select('admin_tbl', 'admin_id', $id);
     
    327327
    328328    // Break the cache because we are changing the list data.
    329     $cache->breakCache($_SERVER['PHP_SELF']);
     329    $cache->delete($_SERVER['PHP_SELF']);
    330330
    331331    // Get the information for this object.
     
    367367    $app =& App::getInstance();
    368368    $db =& DB::getInstance();
    369     $cache =& SessionCache::getInstance();
     369    $cache =& Cache::getInstance();
    370370   
    371371    // Break the cache because we are changing the list data.
    372     $cache->breakCache($_SERVER['PHP_SELF']);
     372    $cache->delete($_SERVER['PHP_SELF']);
    373373
    374374    // Insert record data.
     
    411411    $app =& App::getInstance();
    412412    $db =& DB::getInstance();
    413     $cache =& SessionCache::getInstance();
     413    $cache =& Cache::getInstance();
    414414   
    415415    $lock->select('admin_tbl', 'admin_id', $frm['admin_id']);
     
    419419
    420420    // Break the cache because we are changing the list data.
    421     $cache->breakCache($_SERVER['PHP_SELF']);
     421    $cache->delete($_SERVER['PHP_SELF']);
    422422
    423423    // If the userpass is left blank or with the filler **** characters, we don't want to update it.
     
    456456    $db =& DB::getInstance();
    457457    $prefs =& Prefs::getInstance();
    458     $cache =& SessionCache::getInstance();
     458    $cache =& Cache::getInstance();
    459459   
    460460    $where_clause = '';
     
    507507    // without knowing the hash.
    508508    $cache_hash = md5($sql . '|' . $page->total_items);
    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    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) {
    515515        // Get the cached results.
    516         $list = $cache->getCache($_SERVER['PHP_SELF']);
     516        $list = $cache->get($_SERVER['PHP_SELF']);
    517517    } else {
    518518        // If the list is not already cached, query now.
     
    525525        if (isset($list) && !empty($list)) {
    526526            // Cache the results.
    527             $cache->putCache($list, $_SERVER['PHP_SELF']);
     527            $cache->set($list, $_SERVER['PHP_SELF']);
    528528        }
    529529    }
  • branches/2.0singleton/services/logout.php

    r129 r135  
    55 */
    66
    7 if (is_a($auth, 'Auth_SQL')) {
     7if (isset($auth) && method_exists($auth, 'getVal')) {
    88    // Delete the current user's record locks.
    99    require_once 'codebase/lib/RecordLock.inc.php';
  • branches/2.0singleton/services/logs.php

    r132 r135  
    4040// Set the defaults and catch incoming settings.
    4141$prefs =& Prefs::getInstance();
    42 $prefs->setDefault('log_file', $app->getParam('log_filename'), 'logs_module');
    43 $prefs->setValue('log_file', getFormData('log'), 'logs_module');
     42$prefs->default('log_file', $app->getParam('log_filename'), 'logs_module');
     43$prefs->set('log_file', getFormData('log'), 'logs_module');
    4444
    4545// Titles and navigation header.
    46 $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->get('log_file', 'logs_module')), '/admin/logs.php');
    4747
    4848/******************************************************************************
     
    5757case 'delete' :
    5858//     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
    59     deleteLog($prefs->getValue('log_file', 'logs_module'));
    60     $prefs->setValue('log_file', $app->getParam('log_filename'), 'logs_module');
     59    deleteLog($prefs->get('log_file', 'logs_module'));
     60    $prefs->set('log_file', $app->getParam('log_filename'), 'logs_module');
    6161    if ($app->validBoomerangURL('app_log')) {
    6262        // Display boomerang page.
     
    6969case 'clear' :
    7070//     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
    71     clearLog($prefs->getValue('log_file', 'logs_module'));
     71    clearLog($prefs->get('log_file', 'logs_module'));
    7272    if ($app->validBoomerangURL('app_log')) {
    7373        // Display boomerang page.
     
    8080case 'archive' :
    8181//     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
    82     if (archiveLog($prefs->getValue('log_file', 'logs_module'))) {
     82    if (archiveLog($prefs->get('log_file', 'logs_module'))) {
    8383        // Now flush current log.
    8484        $app->dieURL($_SERVER['PHP_SELF'] . '?op=clear');
     
    9898case 'download' :
    9999    header('Content-Type: application/octet-stream');
    100     header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->getValue('log_file', 'logs_module')));
    101     printLog($prefs->getValue('log_file', 'logs_module'));
     100    header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->get('log_file', 'logs_module')));
     101    printLog($prefs->get('log_file', 'logs_module'));
    102102    die;
    103103    break;
    104104
    105105default :
    106     $list =& getLog($prefs->getValue('log_file', 'logs_module'), getFormData('search_query'));
     106    $list =& getLog($prefs->get('log_file', 'logs_module'), getFormData('search_query'));
    107107    $main_template = 'log_list.ihtml';
    108108    break;
     
    126126include 'header.ihtml';
    127127if ('output' == $main_template) {
    128     printLog($prefs->getValue('log_file', 'logs_module'));
     128    printLog($prefs->get('log_file', 'logs_module'));
    129129} else {
    130130    include 'codebase/services/templates/' . $main_template;
  • branches/2.0singleton/services/templates/log_list.ihtml

    r132 r135  
    1010        <tr class="commandtext">
    1111            <td>
    12                 <?php if ($l['filename'] == $prefs->getValue('log_file', 'logs_module')) { ?>
     12                <?php if ($l['filename'] == $prefs->get('log_file', 'logs_module')) { ?>
    1313                    <span class="commanditem"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></span>
    1414                <?php } else { ?>
Note: See TracChangeset for help on using the changeset viewer.