Changeset 153 for trunk/services


Ignore:
Timestamp:
Jun 7, 2006 8:41:19 PM (18 years ago)
Author:
scdev
Message:

Q - decided to use standard instantiation for Prefs and Cache instead of singleton methods.

Location:
trunk/services
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/services/admins.php

    r152 r153  
    3131
    3232// Configure the prefs object.
    33 $prefs =& Prefs::getInstance('admins');
    34 $prefs->setParam(array('persistent' => false));
     33$tmp_prefs = new Prefs('admins');
     34$tmp_prefs->setParam(array('persistent' => false));
    3535
    3636// Configure the cache object.
    37 $cache =& Cache::getInstance('admins');
     37$cache = new Cache('admins');
    3838$cache->setParam(array('enable' => true));
    3939
     
    322322function deleteRecord($id)
    323323{
    324     global $auth, $lock;
     324    global $auth;
     325    global $lock;
     326    global $cache;
    325327    $app =& App::getInstance();
    326328    $db =& DB::getInstance();
    327     $cache =& Cache::getInstance('admins');
    328329   
    329330    $lock->select('admin_tbl', 'admin_id', $id);
     
    371372{
    372373    global $auth;
     374    global $cache;
    373375    $app =& App::getInstance();
    374376    $db =& DB::getInstance();
    375     $cache =& Cache::getInstance('admins');
    376377   
    377378    // Remove any stale cached list data.
     
    414415function updateRecord($frm)
    415416{
    416     global $auth, $lock;
     417    global $auth;
     418    global $lock;
     419    global $cache;
    417420    $app =& App::getInstance();
    418421    $db =& DB::getInstance();
    419     $cache =& Cache::getInstance('admins');
    420422   
    421423    $lock->select('admin_tbl', 'admin_id', $frm['admin_id']);
     
    460462    global $page;
    461463    global $so;
     464    global $tmp_prefs;
     465    global $cache;
    462466    $db =& DB::getInstance();
    463     $prefs =& Prefs::getInstance('admins');
    464     $cache =& Cache::getInstance('admins');
    465467   
    466468    $where_clause = '';
     
    514516    // without knowing the hash.
    515517    $cache_hash = md5($sql . '|' . $page->total_items);
    516     if ($prefs->get('cache_hash') != $cache_hash) {
     518    if ($tmp_prefs->get('cache_hash') != $cache_hash) {
    517519        $cache->delete('list');
    518         $prefs->set('cache_hash', $cache_hash);
     520        $tmp_prefs->set('cache_hash', $cache_hash);
    519521    }
    520522
  • trunk/services/logs.php

    r152 r153  
    3737$no_download_files = '/^$/';
    3838
    39 
    40 // Set the defaults and catch incoming settings.
    41 $prefs =& Prefs::getInstance('admin_logs');
    42 $prefs->setDefaults(array(
     39// Configure the prefs object.
     40$tmp_prefs = new Prefs('admin_logs');
     41$tmp_prefs->setParam(array('persistent' => false));
     42$tmp_prefs->setDefaults(array(
    4343    'log_file' => $app->getParam('log_filename')
    4444));
    45 $prefs->set('log_file', getFormData('log'));
     45$tmp_prefs->set('log_file', getFormData('log'));
    4646
    4747// Titles and navigation header.
    48 $nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), $prefs->get('log_file')), '/admin/logs.php');
     48$nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), $tmp_prefs->get('log_file')), '/admin/logs.php');
    4949
    5050/********************************************************************
     
    5959case 'delete' :
    6060//     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
    61     deleteLog($prefs->get('log_file'));
    62     $prefs->set('log_file', $app->getParam('log_filename'));
     61    deleteLog($tmp_prefs->get('log_file'));
     62    $tmp_prefs->set('log_file', $app->getParam('log_filename'));
    6363    if ($app->validBoomerangURL('app_log')) {
    6464        // Display boomerang page.
     
    7171case 'clear' :
    7272//     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
    73     clearLog($prefs->get('log_file'));
     73    clearLog($tmp_prefs->get('log_file'));
    7474    if ($app->validBoomerangURL('app_log')) {
    7575        // Display boomerang page.
     
    8282case 'archive' :
    8383//     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
    84     if (archiveLog($prefs->get('log_file'))) {
     84    if (archiveLog($tmp_prefs->get('log_file'))) {
    8585        // Now flush current log.
    8686        $app->dieURL($_SERVER['PHP_SELF'] . '?op=clear');
     
    100100case 'download' :
    101101    header('Content-Type: application/octet-stream');
    102     header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->get('log_file')));
    103     printLog($prefs->get('log_file'));
     102    header(sprintf('Content-Disposition: attachment; filename=%s.txt', $tmp_prefs->get('log_file')));
     103    printLog($tmp_prefs->get('log_file'));
    104104    die;
    105105    break;
    106106
    107107default :
    108     $list =& getLog($prefs->get('log_file'), getFormData('search_query'));
     108    $list =& getLog($tmp_prefs->get('log_file'), getFormData('search_query'));
    109109    $main_template = 'log_list.ihtml';
    110110    break;
     
    128128include 'header.ihtml';
    129129if ('output' == $main_template) {
    130     printLog($prefs->get('log_file'));
     130    printLog($tmp_prefs->get('log_file'));
    131131} else {
    132132    include 'codebase/services/templates/' . $main_template;
  • trunk/services/templates/log_list.ihtml

    r152 r153  
    1010        <tr class="commandtext">
    1111            <td>
    12                 <?php if ($l['filename'] == $prefs->get('log_file')) { ?>
     12                <?php if ($l['filename'] == $tmp_prefs->get('log_file')) { ?>
    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.