Changeset 154


Ignore:
Timestamp:
Jun 8, 2006 5:36:10 AM (18 years ago)
Author:
scdev
Message:

${1}

Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/form_template.cli.php

    r136 r154  
    3434
    3535$exclude = array('added_by_user_id', 'added_datetime', 'hit_count', 'modified_datetime', 'modified_by_user_id');
    36 $primary_key = '<##>';
     36$primary_key = '__///__';
    3737$output = array();
    3838
     
    6464
    6565<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    66 <select name="$field" id="$field" class="sc-small"><\x3fphp printSelectForm('<##>_tbl', "CONCAT(<##>_id, '&mdash;', <##>)", '$field', \$frm['$field'], true, 'ORDER BY $field ASC'); \x3f></select>
    67     <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('<##>.php?op=add&boomerang=true'); \x3f>" onClick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo _("Add <##>") \x3f></a></span>
    68     <\x3fphp if ('' != \$frm['<##>_id']) { \x3f>
    69     <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('<##>.php?op=edit&boomerang=true&<##>_id=' . \$frm['<##>_id']); \x3f>" onClick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo sprintf(_("Edit <##> <em>%s</em>"), \$frm['<##>']) \x3f></a></span>
     66<select name="$field" id="$field" class="sc-small"><\x3fphp printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', __///__)", '$field', \$frm['$field'], true, 'ORDER BY $field ASC'); \x3f></select>
     67    <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=add&boomerang=true'); \x3f>" onClick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo _("Add __///__") \x3f></a></span>
     68    <\x3fphp if ('' != \$frm['__///___id']) { \x3f>
     69    <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=edit&boomerang=true&__///___id=' . \$frm['__///___id']); \x3f>" onClick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo sprintf(_("Edit __///__ <em>%s</em>"), \$frm['__///__']) \x3f></a></span>
    7070    <\x3fphp } \x3f>
    7171E_O_F;
     
    8080<input type="file" name="$field" id="$field" />
    8181    <\x3fphp if ('' != \$upload->getFilenameGlob(getFormData('$primary_key') . '_*') && getFormData('op') == 'edit' || getFormData('op') == 'update') { \x3f>
    82     <div class="sc-help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\\$s\"><strong>%2\\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/<##>', \$upload->getFilenameGlob(getFormData('$primary_key') . '_*')) \x3f></div>
     82    <div class="sc-help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\\$s\"><strong>%2\\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/__///__', \$upload->getFilenameGlob(getFormData('$primary_key') . '_*')) \x3f></div>
    8383    <\x3fphp } \x3f>
    8484    <div class="sc-help"><\x3fphp printf(_("File to upload must have one of the following file-name extensions: %s."), join(', ', \$upload->getParam('valid_file_extensions'))) \x3f></div>
  • trunk/bin/module_maker/list_template.cli.php

    r151 r154  
    4646}
    4747
    48 $primary_key = '<##>';
     48$primary_key = '__///__';
    4949
    5050// Loop through columns
     
    111111<form action="<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>" method="get">
    112112<\x3fphp \$app->printHiddenSession(false); \x3f>
    113     <span class="sc-nowrap commandtext"><a href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=add'); \x3f>"><\x3fphp echo _("Add <##>"); \x3f></a></span>
     113    <span class="sc-nowrap commandtext"><a href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=add'); \x3f>"><\x3fphp echo _("Add __///__"); \x3f></a></span>
    114114    <br />
    115115
    116     <input type="text" class="sc-small" size="20" name="search_query" value="<\x3fphp echo getFormData('search_query'); \x3f>" title="<\x3fphp echo oTxt(_("Fields searched: <##>.")); \x3f>" />
    117     <select name="filter_<##>">
    118         <\x3fphp // printSelectForm('<##>_tbl', "CONCAT(<##>_id, '&mdash;', city, '&mdash;', title)", '<##>_id', getFormData('filter_<##>'), array('Any <##>'), 'ORDER BY <##> ASC'); \x3f>
     116    <input type="text" class="sc-small" size="20" name="search_query" value="<\x3fphp echo getFormData('search_query'); \x3f>" title="<\x3fphp echo oTxt(_("Fields searched: __///__.")); \x3f>" />
     117    <select name="filter___///__">
     118        <\x3fphp // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); \x3f>
    119119    </select>
    120120    <input type="submit" name="list" value="<\x3fphp echo _("Search"); \x3f>" />
     
    149149    <\x3fphp for (\$i = 0; \$i <= \$page->last_item - \$page->first_item && \$page->total_items > 0; \$i++) { \x3f>
    150150    <tr>
    151         <td class="sc-nowrap"><a title="<\x3fphp printf(_("Edit %s"), oTxt(\$list[\$i]['<##>'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=edit&$primary_key=' . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
    152         <td class="sc-nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['<##>'])) \x3f>" href="<\x3fphp echo \$app->oHREF("/admin/versions.php?record_table=$db_tbl&record_key=$primary_key&boomerang=true&record_val=" . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
     151        <td class="sc-nowrap"><a title="<\x3fphp printf(_("Edit %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=edit&$primary_key=' . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
     152        <td class="sc-nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF("/admin/versions.php?record_table=$db_tbl&record_key=$primary_key&boomerang=true&record_val=" . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
    153153
    154154E_O_F;
     
    164164
    165165echo isset($op) ? '' : <<<E_O_F
    166         <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['<##>'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onClick="javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['<##>'])) \x3f>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
     166        <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onClick="javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['__///__'])) \x3f>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
    167167    </tr>
    168168    <\x3fphp } \x3f>
  • trunk/bin/module_maker/module.cli.php

    r151 r154  
    223223if ($upload_file_capability) {
    224224    // Form arguments
    225     $replace['admin_form_tag_init'] = "<form enctype=\"multipart/form-data\" method=\"post\" action=\"<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>\" class=\"sc-form\">\n<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"<##>\" />";
     225    $replace['admin_form_tag_init'] = "<form enctype=\"multipart/form-data\" method=\"post\" action=\"<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>\" class=\"sc-form\">\n<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"__///__\" />";
    226226
    227227    // Include statement.
     
    234234\$upload = new Upload();
    235235\$upload->setParam(array(
    236     'upload_path' => COMMON_BASE . '/html/_db_files/<##>',
     236    'upload_path' => COMMON_BASE . '/html/_db_files/__///__',
    237237    'dest_file_perms' => 0666,
    238238    'allow_overwriting' => false,
     
    246246
    247247// Copy uploaded image name into form data.
    248 \$_POST['<##>'] = isset(\$_FILES['<##>']) ? \$_FILES['<##>']['name'] : '';
     248\$_POST['__///__'] = isset(\$_FILES['__///__']) ? \$_FILES['__///__']['name'] : '';
    249249
    250250
     
    264264
    265265        // Upload files with prepended primary key.
    266         \$new_file = \$upload->process('<##>',  \$%PRIMARY_KEY% . '_' . getFormData('<##>'));
     266        \$new_file = \$upload->process('__///__',  \$%PRIMARY_KEY% . '_' . getFormData('__///__'));
    267267
    268268        // If file upload errors, redirect to edit operation for the inserted record.
     
    276276
    277277        // Upload new files.
    278         if (getFormData('<##>')) {
     278        if (getFormData('__///__')) {
    279279            // Get old file names for deletion.
    280280            \$old_file = \$upload->getFilenameGlob(getFormData('%PRIMARY_KEY%') . '_*');
    281281            // Process new file upload with prepended primary key.
    282             \$new_file = \$upload->process('<##>',  getFormData('%PRIMARY_KEY%') . '_' . getFormData('<##>'));
     282            \$new_file = \$upload->process('__///__',  getFormData('%PRIMARY_KEY%') . '_' . getFormData('__///__'));
    283283            if (false === \$new_file || \$upload->anyErrors()) {
    284284                // Upload failed. Reload form. Display errors.
  • trunk/bin/module_maker/skel/adm_list.ihtml

    r136 r154  
    88    <br />
    99
    10     <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: <##> %SEARCH_FIELDS%.")); ?>" />
    11     <select name="filter_<##>">
    12         <?php // printSelectForm('<##>_tbl', "CONCAT(<##>_id, '&mdash;', city, '&mdash;', title)", '<##>_id', getFormData('filter_<##>'), array('Any <##>'), 'ORDER BY <##> ASC'); ?>
     10    <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: __///__ %SEARCH_FIELDS%.")); ?>" />
     11    <select name="filter___///__">
     12        <?php // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); ?>
    1313    </select>
    1414    <input type="submit" value="<?php echo _("Search"); ?>" />
     
    2828    <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
    2929    <tr>
    30         <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['<##>'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
    31         <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['<##>'])) ?>" href="<?php echo $app->oHREF('/admin/versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
     30        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
     31        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF('/admin/versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
    3232%ADM_LIST_ROWS%
    33         <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['<##>'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&%PRIMARY_KEY%=" . $list[$i]['%PRIMARY_KEY%']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['<##>'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
     33        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&%PRIMARY_KEY%=" . $list[$i]['%PRIMARY_KEY%']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['__///__'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
    3434    </tr>
    3535    <?php } ?>
  • trunk/bin/module_maker/skel/admin.php

    r153 r154  
    5050// Search limiters retain their values between page requests.
    5151$app->carryQuery('search_query');
    52 $app->carryQuery('filter_<##>');
     52$app->carryQuery('filter___///__');
    5353%ADMIN_UPLOAD_CONFIG%
    5454/********************************************************************
     
    235235
    236236    // Lock this record.
    237     $lock->set('%DB_TBL%', '%PRIMARY_KEY%', $id, $frm['<##>']);
     237    $lock->set('%DB_TBL%', '%PRIMARY_KEY%', $id, $frm['__///__']);
    238238
    239239    // Set misc values for the form.
     
    268268    // Get the information for this object.
    269269    $qid = $db->query("
    270         SELECT <##>
     270        SELECT __///__
    271271        FROM %DB_TBL%
    272272        WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "'
     
    301301    // Create version.
    302302    $version = Version::getInstance($GLOBALS['auth']);
    303     $version->create('%DB_TBL%', '%PRIMARY_KEY%', $last_insert_id, $frm['<##>']);
    304 
    305     $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <em>%s</em> has been added."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);
     303    $version->create('%DB_TBL%', '%PRIMARY_KEY%', $last_insert_id, $frm['__///__']);
     304
     305    $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <em>%s</em> has been added."), $frm['__///__']), MSG_SUCCESS, __FILE__, __LINE__);
    306306
    307307    return $last_insert_id;
     
    326326    // Create version.
    327327    $version = Version::getInstance($GLOBALS['auth']);
    328     $version->create('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%'], $frm['<##>']);
    329 
    330     $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <em>%s</em> has been updated."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);
     328    $version->create('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%'], $frm['__///__']);
     329
     330    $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <em>%s</em> has been updated."), $frm['__///__']), MSG_SUCCESS, __FILE__, __LINE__);
    331331
    332332    // Unlock record.
     
    352352    }
    353353
    354     if (getFormData('filter_<##>', false)) {
     354    if (getFormData('filter___///__', false)) {
    355355        // Limit by filter.
    356         $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " <##> = '" . $db->escapeString(getFormData('filter_<##>')) . "'";
     356        $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " __///__ = '" . $db->escapeString(getFormData('filter___///__')) . "'";
    357357    }
    358358
  • trunk/bin/module_maker/skel/public.ihtml

    r136 r154  
    11<p><?php echo nl2br(fancyTxt(oTxt($item['content'], true))); ?></p>
    2 <p><em><?php echo sprintf(_("Published %s"), date($app->getParam('date_format'), strtotime($item['<##>']))); ?></em></p>
     2<p><em><?php echo sprintf(_("Published %s"), date($app->getParam('date_format'), strtotime($item['__///__']))); ?></em></p>
    33
    44<!--
  • trunk/bin/module_maker/skel/public.php

    r143 r154  
    3838        WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "'
    3939        AND publish = 'true'
    40         <##>AND (publish_date <= CURDATE() OR publish_date = '0000-00-00')
    41         <##>AND (expire_date > CURDATE() OR expire_date = '0000-00-00')
     40        __///__AND (publish_date <= CURDATE() OR publish_date = '0000-00-00')
     41        __///__AND (expire_date > CURDATE() OR expire_date = '0000-00-00')
    4242    ");
    4343    if (!$item = mysql_fetch_assoc($qid)) {
     
    5454
    5555    // Set title and main template.
    56     $nav->addPage($item['<##>']);
     56    $nav->addPage($item['__///__']);
    5757    $main_template = '%PUBLIC_DETAIL_TEMPLATE%';
    5858
  • trunk/bin/module_maker/skel/public_list.ihtml

    r136 r154  
    1010        <?php } ?>
    1111        <p>
    12         <em><?php echo date($app->getParam('date_format'), strtotime($%NAME_SINGULAR%_list[$i]['<##>'])); ?></em> &mdash; <?php echo nl2br(fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['summary'], true))); ?>
     12        <em><?php echo date($app->getParam('date_format'), strtotime($%NAME_SINGULAR%_list[$i]['__///__'])); ?></em> &mdash; <?php echo nl2br(fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['summary'], true))); ?>
    1313
    1414        <?php if (strlen(trim($%NAME_SINGULAR%_list[$i]['content'])) > 0) { // Link only if content is available. ?>
  • trunk/bin/module_maker/sql.cli.php

    r151 r154  
    5252
    5353$sort_columns = '';
    54 $primary_key = '<##>';
     54$primary_key = '__///__';
    5555
    5656// Loop through columns
  • trunk/docs/example_script_template.php

    r143 r154  
    11<?php
    22/**
    3  * <##>
     3 * __///__
    44 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information.
    55 * @author  Quinn Comendant <quinn@strangecode.com>
    66 * @version 1.0
    7  * @since   <##>
     7 * @since   __///__
    88 */
    99
  • trunk/lib/App.inc.php

    r144 r154  
    152152    {
    153153        // Set namespace of application instance.
    154         $this->_ns = '_app_' . $namespace;
     154        $this->_ns = $namespace;
    155155
    156156        // Initialize default parameters.
     
    281281            session_start();
    282282
    283             if (!isset($_SESSION[$this->_ns])) {
     283            if (!isset($_SESSION['_app'][$this->_ns])) {
    284284                // Access session data using: $_SESSION['...'].
    285285                // Initialize here _after_ session has started.
    286                 $_SESSION[$this->_ns] = array(
     286                $_SESSION['_app'][$this->_ns] = array(
    287287                    'messages' => array(),
    288288                    'boomerang' => array('url'),
     
    363363        // Save message in session under unique key to avoid duplicate messages.
    364364        $msg_id = md5($type . $message . $file . $line);
    365         $_SESSION[$this->_ns]['messages'][$msg_id] = array(
     365        $_SESSION['_app'][$this->_ns]['messages'][$msg_id] = array(
    366366            'type'    => $type,
    367367            'message' => $message,
    368368            'file'    => $file,
    369369            'line'    => $line,
    370             'count'   => (isset($_SESSION[$this->_ns]['messages'][$msg_id]['count']) ? (1 + $_SESSION[$this->_ns]['messages'][$msg_id]['count']) : 1)
     370            'count'   => (isset($_SESSION['_app'][$this->_ns]['messages'][$msg_id]['count']) ? (1 + $_SESSION['_app'][$this->_ns]['messages'][$msg_id]['count']) : 1)
    371371        );
    372372
     
    391391        }
    392392
    393         return isset($_SESSION[$this->_ns]['messages']) ? $_SESSION[$this->_ns]['messages'] : array();
     393        return isset($_SESSION['_app'][$this->_ns]['messages']) ? $_SESSION['_app'][$this->_ns]['messages'] : array();
    394394    }
    395395   
     
    408408        }
    409409       
    410         $_SESSION[$this->_ns]['messages'] = array();
     410        $_SESSION['_app'][$this->_ns]['messages'] = array();
    411411    }
    412412
     
    843843        // Get URL from stored boomerang. Allow non specific URL if ID not valid.
    844844        if ($this->validBoomerangURL($id, true)) {
    845             if (isset($id) && isset($_SESSION[$this->_ns]['boomerang']['url'][$id])) {
    846                 $url = $_SESSION[$this->_ns]['boomerang']['url'][$id];
     845            if (isset($id) && isset($_SESSION['_app'][$this->_ns]['boomerang']['url'][$id])) {
     846                $url = $_SESSION['_app'][$this->_ns]['boomerang']['url'][$id];
    847847                $this->logMsg(sprintf('dieBoomerangURL(%s) found: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__);
    848848            } else {
    849                 $url = end($_SESSION[$this->_ns]['boomerang']['url']);
     849                $url = end($_SESSION['_app'][$this->_ns]['boomerang']['url']);
    850850                $this->logMsg(sprintf('dieBoomerangURL(%s) using: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__);
    851851            }
     
    866866        // A redirection will never happen immediately twice.
    867867        // Set the time so ensure this doesn't happen.
    868         $_SESSION[$this->_ns]['boomerang']['time'] = time();
     868        $_SESSION['_app'][$this->_ns]['boomerang']['time'] = time();
    869869        $this->dieURL($url, $carry_args);
    870870    }
     
    890890            $url = preg_replace('/boomerang=[\w]+/', '', $url);
    891891
    892             if (isset($_SESSION[$this->_ns]['boomerang']['url']) && is_array($_SESSION[$this->_ns]['boomerang']['url']) && !empty($_SESSION[$this->_ns]['boomerang']['url'])) {
     892            if (isset($_SESSION['_app'][$this->_ns]['boomerang']['url']) && is_array($_SESSION['_app'][$this->_ns]['boomerang']['url']) && !empty($_SESSION['_app'][$this->_ns]['boomerang']['url'])) {
    893893                // If the URL currently exists in the boomerang array, delete.
    894                 while ($existing_key = array_search($url, $_SESSION[$this->_ns]['boomerang']['url'])) {
    895                     unset($_SESSION[$this->_ns]['boomerang']['url'][$existing_key]);
     894                while ($existing_key = array_search($url, $_SESSION['_app'][$this->_ns]['boomerang']['url'])) {
     895                    unset($_SESSION['_app'][$this->_ns]['boomerang']['url'][$existing_key]);
    896896                }
    897897            }
    898898
    899899            if (isset($id)) {
    900                 $_SESSION[$this->_ns]['boomerang']['url'][$id] = $url;
     900                $_SESSION['_app'][$this->_ns]['boomerang']['url'][$id] = $url;
    901901            } else {
    902                 $_SESSION[$this->_ns]['boomerang']['url'][] = $url;
     902                $_SESSION['_app'][$this->_ns]['boomerang']['url'][] = $url;
    903903            }
    904904            $this->logMsg(sprintf('setBoomerangURL(%s): %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__);
     
    923923
    924924        if (isset($id)) {
    925             if (isset($_SESSION[$this->_ns]['boomerang']['url'][$id])) {
    926                 return $_SESSION[$this->_ns]['boomerang']['url'][$id];
     925            if (isset($_SESSION['_app'][$this->_ns]['boomerang']['url'][$id])) {
     926                return $_SESSION['_app'][$this->_ns]['boomerang']['url'][$id];
    927927            } else {
    928928                return '';
    929929            }
    930         } else if (is_array($_SESSION[$this->_ns]['boomerang']['url'])) {
    931             return end($_SESSION[$this->_ns]['boomerang']['url']);
     930        } else if (is_array($_SESSION['_app'][$this->_ns]['boomerang']['url'])) {
     931            return end($_SESSION['_app'][$this->_ns]['boomerang']['url']);
    932932        } else {
    933933            return false;
     
    949949        $this->logMsg(sprintf('deleteBoomerangURL(%s): %s', $id, $this->getBoomerangURL($id)), LOG_DEBUG, __FILE__, __LINE__);
    950950
    951         if (isset($id) && isset($_SESSION[$this->_ns]['boomerang']['url'][$id])) {
    952             unset($_SESSION[$this->_ns]['boomerang']['url'][$id]);
    953         } else if (is_array($_SESSION[$this->_ns]['boomerang']['url'])) {
    954             array_pop($_SESSION[$this->_ns]['boomerang']['url']);
     951        if (isset($id) && isset($_SESSION['_app'][$this->_ns]['boomerang']['url'][$id])) {
     952            unset($_SESSION['_app'][$this->_ns]['boomerang']['url'][$id]);
     953        } else if (is_array($_SESSION['_app'][$this->_ns]['boomerang']['url'])) {
     954            array_pop($_SESSION['_app'][$this->_ns]['boomerang']['url']);
    955955        }
    956956    }
     
    969969        }
    970970
    971         if (!isset($_SESSION[$this->_ns]['boomerang']['url'])) {
     971        if (!isset($_SESSION['_app'][$this->_ns]['boomerang']['url'])) {
    972972            $this->logMsg(sprintf('validBoomerangURL(%s) no boomerang URL set.', $id), LOG_DEBUG, __FILE__, __LINE__);
    973973            return false;
     
    977977        // a boomerang redirection will always occur at least several seconds after the last boomerang redirect
    978978        // or a boomerang being set.
    979         $boomerang_time = isset($_SESSION[$this->_ns]['boomerang']['time']) ? $_SESSION[$this->_ns]['boomerang']['time'] : 0;
     979        $boomerang_time = isset($_SESSION['_app'][$this->_ns]['boomerang']['time']) ? $_SESSION['_app'][$this->_ns]['boomerang']['time'] : 0;
    980980
    981981        $url = '';
    982         if (isset($id) && isset($_SESSION[$this->_ns]['boomerang']['url'][$id])) {
    983             $url = $_SESSION[$this->_ns]['boomerang']['url'][$id];
     982        if (isset($id) && isset($_SESSION['_app'][$this->_ns]['boomerang']['url'][$id])) {
     983            $url = $_SESSION['_app'][$this->_ns]['boomerang']['url'][$id];
    984984        } else if (!isset($id) || $use_nonspecificboomerang) {
    985985            // Use non specific boomerang if available.
    986             $url = end($_SESSION[$this->_ns]['boomerang']['url']);
     986            $url = end($_SESSION['_app'][$this->_ns]['boomerang']['url']);
    987987        }
    988988
  • trunk/lib/Auth_File.inc.php

    r149 r154  
    6868    function Auth_File($namespace='null')
    6969    {
    70         $this->_ns = '_auth_' . $namespace;
     70        $this->_ns = $namespace;
    7171
    7272        // Initialize default parameters.
     
    114114    function clear()
    115115    {
    116         $_SESSION[$this->_ns] = array('authenticated' => false);
     116        $_SESSION['_auth_file'][$this->_ns] = array('authenticated' => false);
    117117    }
    118118
     
    127127    function set($key, $val)
    128128    {
    129         if (!isset($_SESSION[$this->_ns]['user_data'])) {
    130             $_SESSION[$this->_ns]['user_data'] = array();
    131         }
    132         $_SESSION[$this->_ns]['user_data'][$key] = $val;
     129        if (!isset($_SESSION['_auth_file'][$this->_ns]['user_data'])) {
     130            $_SESSION['_auth_file'][$this->_ns]['user_data'] = array();
     131        }
     132        $_SESSION['_auth_file'][$this->_ns]['user_data'][$key] = $val;
    133133    }
    134134
     
    143143    function get($key, $default='')
    144144    {
    145         if (isset($_SESSION[$this->_ns][$key])) {
    146             return $_SESSION[$this->_ns][$key];
    147         } else if (isset($_SESSION[$this->_ns]['user_data'][$key])) {
    148             return $_SESSION[$this->_ns]['user_data'][$key];
     145        if (isset($_SESSION['_auth_file'][$this->_ns][$key])) {
     146            return $_SESSION['_auth_file'][$this->_ns][$key];
     147        } else if (isset($_SESSION['_auth_file'][$this->_ns]['user_data'][$key])) {
     148            return $_SESSION['_auth_file'][$this->_ns]['user_data'][$key];
    149149        } else {
    150150            return $default;
     
    209209        }
    210210       
    211         $_SESSION[$this->_ns] = array(
     211        $_SESSION['_auth_file'][$this->_ns] = array(
    212212            'authenticated' => true,
    213213            'username' => $username,
     
    238238        if ($trusted_net = ipInRange(getRemoteAddr(), $this->_params['trusted_networks'])) {
    239239            $user_in_trusted_network = true;
    240             $app->logMsg(sprintf('User %s accessing from trusted network %s', $_SESSION[$this->_ns]['username'], $trusted_net), LOG_DEBUG, __FILE__, __LINE__);
     240            $app->logMsg(sprintf('User %s accessing from trusted network %s', $_SESSION['_auth_file'][$this->_ns]['username'], $trusted_net), LOG_DEBUG, __FILE__, __LINE__);
    241241        } else if (preg_match('/proxy.aol.com$/i', getRemoteAddr(true))) {
    242242            $user_in_trusted_network = true;
    243             $app->logMsg(sprintf('User %s accessing from trusted network proxy.aol.com', $_SESSION[$this->_ns]['username']), LOG_DEBUG, __FILE__, __LINE__);
     243            $app->logMsg(sprintf('User %s accessing from trusted network proxy.aol.com', $_SESSION['_auth_file'][$this->_ns]['username']), LOG_DEBUG, __FILE__, __LINE__);
    244244        } else {
    245245            $user_in_trusted_network = false;
     
    247247
    248248        // Test login with information stored in session. Skip IP matching for users from trusted networks.
    249         if (isset($_SESSION[$this->_ns])
    250             && true === $_SESSION[$this->_ns]['authenticated']
    251             && !empty($_SESSION[$this->_ns]['username'])
    252             && strtotime($_SESSION[$this->_ns]['login_datetime']) > time() - $this->_params['login_timeout']
    253             && strtotime($_SESSION[$this->_ns]['last_access_datetime']) > time() - $this->_params['idle_timeout']
    254             && ($_SESSION[$this->_ns]['remote_ip'] == getRemoteAddr() || $user_in_trusted_network)
     249        if (isset($_SESSION['_auth_file'][$this->_ns])
     250            && true === $_SESSION['_auth_file'][$this->_ns]['authenticated']
     251            && !empty($_SESSION['_auth_file'][$this->_ns]['username'])
     252            && strtotime($_SESSION['_auth_file'][$this->_ns]['login_datetime']) > time() - $this->_params['login_timeout']
     253            && strtotime($_SESSION['_auth_file'][$this->_ns]['last_access_datetime']) > time() - $this->_params['idle_timeout']
     254            && ($_SESSION['_auth_file'][$this->_ns]['remote_ip'] == getRemoteAddr() || $user_in_trusted_network)
    255255        ) {
    256256            // User is authenticated!
    257             $_SESSION[$this->_ns]['last_access_datetime'] = date('Y-m-d H:i:s');
     257            $_SESSION['_auth_file'][$this->_ns]['last_access_datetime'] = date('Y-m-d H:i:s');
    258258            return true;
    259         } else if (isset($_SESSION[$this->_ns]) && true === $_SESSION[$this->_ns]['authenticated']) {
    260             if (strtotime($_SESSION[$this->_ns]['last_access_datetime']) > time() - 43200) {
     259        } else if (isset($_SESSION['_auth_file'][$this->_ns]) && true === $_SESSION['_auth_file'][$this->_ns]['authenticated']) {
     260            if (strtotime($_SESSION['_auth_file'][$this->_ns]['last_access_datetime']) > time() - 43200) {
    261261                // Only raise message if last session is less than 12 hours old.
    262262                $app->raiseMsg(_("Your session has closed. You need to log-in again."), MSG_NOTICE, __FILE__, __LINE__);
     
    265265            // Log the reason for login expiration.
    266266            $expire_reasons = array();
    267             if (empty($_SESSION[$this->_ns]['username'])) {
     267            if (empty($_SESSION['_auth_file'][$this->_ns]['username'])) {
    268268                $expire_reasons[] = 'username not found';
    269269            }
    270             if (strtotime($_SESSION[$this->_ns]['login_datetime']) <= time() - $this->_params['login_timeout']) {
     270            if (strtotime($_SESSION['_auth_file'][$this->_ns]['login_datetime']) <= time() - $this->_params['login_timeout']) {
    271271                $expire_reasons[] = 'login_timeout expired';
    272272            }
    273             if (strtotime($_SESSION[$this->_ns]['last_access_datetime']) <= time() - $this->_params['idle_timeout']) {
     273            if (strtotime($_SESSION['_auth_file'][$this->_ns]['last_access_datetime']) <= time() - $this->_params['idle_timeout']) {
    274274                $expire_reasons[] = 'idle_timeout expired';
    275275            }
    276             if ($_SESSION[$this->_ns]['remote_ip'] != getRemoteAddr() && !$user_in_trusted_network) {
    277                 $expire_reasons[] = sprintf('remote_ip not matched (%s != %s)', $_SESSION[$this->_ns]['remote_ip'], getRemoteAddr());
    278             }
    279             $app->logMsg(sprintf('User %s session expired: %s', $_SESSION[$this->_ns]['username'], join(', ', $expire_reasons)), LOG_INFO, __FILE__, __LINE__);
     276            if ($_SESSION['_auth_file'][$this->_ns]['remote_ip'] != getRemoteAddr() && !$user_in_trusted_network) {
     277                $expire_reasons[] = sprintf('remote_ip not matched (%s != %s)', $_SESSION['_auth_file'][$this->_ns]['remote_ip'], getRemoteAddr());
     278            }
     279            $app->logMsg(sprintf('User %s session expired: %s', $_SESSION['_auth_file'][$this->_ns]['username'], join(', ', $expire_reasons)), LOG_INFO, __FILE__, __LINE__);
    280280        }
    281281
  • trunk/lib/Auth_SQL.inc.php

    r149 r154  
    100100        $app =& App::getInstance();
    101101       
    102         $this->_ns = '_auth_' . $namespace;
     102        $this->_ns = $namespace;
    103103
    104104        // Initialize default parameters.
     
    264264            WHERE " . $this->_params['db_primary_key'] . " = '" . $this->get('user_id') . "'
    265265        ");
    266         $_SESSION[$this->_ns] = array('authenticated' => false);
     266        $_SESSION['_auth_sql'][$this->_ns] = array('authenticated' => false);
    267267    }
    268268
     
    276276    function set($key, $val)
    277277    {
    278         if (!isset($_SESSION[$this->_ns]['user_data'])) {
    279             $_SESSION[$this->_ns]['user_data'] = array();
    280         }
    281         $_SESSION[$this->_ns]['user_data'][$key] = $val;
     278        if (!isset($_SESSION['_auth_sql'][$this->_ns]['user_data'])) {
     279            $_SESSION['_auth_sql'][$this->_ns]['user_data'] = array();
     280        }
     281        $_SESSION['_auth_sql'][$this->_ns]['user_data'][$key] = $val;
    282282    }
    283283
     
    292292    function get($key, $default='')
    293293    {
    294         if (isset($_SESSION[$this->_ns][$key])) {
    295             return $_SESSION[$this->_ns][$key];
    296         } else if (isset($_SESSION[$this->_ns]['user_data'][$key])) {
    297             return $_SESSION[$this->_ns]['user_data'][$key];
     294        if (isset($_SESSION['_auth_sql'][$this->_ns][$key])) {
     295            return $_SESSION['_auth_sql'][$this->_ns][$key];
     296        } else if (isset($_SESSION['_auth_sql'][$this->_ns]['user_data'][$key])) {
     297            return $_SESSION['_auth_sql'][$this->_ns]['user_data'][$key];
    298298        } else {
    299299            return $default;
     
    373373
    374374        // Register authenticated session.
    375         $_SESSION[$this->_ns] = array(
     375        $_SESSION['_auth_sql'][$this->_ns] = array(
    376376            'authenticated'         => true,
    377377            'user_id'               => $user_data['user_id'],
     
    497497
    498498        // User login test need only be run once per script execution. We cache the result in the session.
    499         if ($this->_authentication_tested && isset($_SESSION[$this->_ns]['authenticated'])) {
    500             return $_SESSION[$this->_ns]['authenticated'];
     499        if ($this->_authentication_tested && isset($_SESSION['_auth_sql'][$this->_ns]['authenticated'])) {
     500            return $_SESSION['_auth_sql'][$this->_ns]['authenticated'];
    501501        }
    502502
     
    521521
    522522        // Test login with information stored in session. Skip IP matching for users from trusted networks.
    523         if (isset($_SESSION[$this->_ns])
    524             && true === $_SESSION[$this->_ns]['authenticated']
    525             && !empty($_SESSION[$this->_ns]['username'])
    526             && strtotime($_SESSION[$this->_ns]['login_datetime']) > time() - $this->_params['login_timeout']
    527             && strtotime($_SESSION[$this->_ns]['last_access_datetime']) > time() - $this->_params['idle_timeout']
    528             && ($_SESSION[$this->_ns]['remote_ip'] == getRemoteAddr() || $user_in_trusted_network)
     523        if (isset($_SESSION['_auth_sql'][$this->_ns])
     524            && true === $_SESSION['_auth_sql'][$this->_ns]['authenticated']
     525            && !empty($_SESSION['_auth_sql'][$this->_ns]['username'])
     526            && strtotime($_SESSION['_auth_sql'][$this->_ns]['login_datetime']) > time() - $this->_params['login_timeout']
     527            && strtotime($_SESSION['_auth_sql'][$this->_ns]['last_access_datetime']) > time() - $this->_params['idle_timeout']
     528            && ($_SESSION['_auth_sql'][$this->_ns]['remote_ip'] == getRemoteAddr() || $user_in_trusted_network)
    529529        ) {
    530530            // User is authenticated!
    531             $_SESSION[$this->_ns]['last_access_datetime'] = date('Y-m-d H:i:s');
     531            $_SESSION['_auth_sql'][$this->_ns]['last_access_datetime'] = date('Y-m-d H:i:s');
    532532
    533533            // Update the DB with the last_access_datetime and increment the seconds_online.
     
    544544                $app->logMsg(sprintf('User update failed. Record not found for user %s (%s).', $this->get('user_id'), $this->get('username')), LOG_NOTICE, __FILE__, __LINE__);
    545545            }
    546         } else if (isset($_SESSION[$this->_ns]) && true === $_SESSION[$this->_ns]['authenticated']) {
     546        } else if (isset($_SESSION['_auth_sql'][$this->_ns]) && true === $_SESSION['_auth_sql'][$this->_ns]['authenticated']) {
    547547            // User is authenticated, but login has expired.
    548             if (strtotime($_SESSION[$this->_ns]['last_access_datetime']) > time() - 43200) {
     548            if (strtotime($_SESSION['_auth_sql'][$this->_ns]['last_access_datetime']) > time() - 43200) {
    549549                // Only raise message if last session is less than 12 hours old.
    550550                $app->raiseMsg(_("Your session has expired. You need to log-in again."), MSG_NOTICE, __FILE__, __LINE__);
     
    553553            // Log the reason for login expiration.
    554554            $expire_reasons = array();
    555             if (empty($_SESSION[$this->_ns]['username'])) {
     555            if (empty($_SESSION['_auth_sql'][$this->_ns]['username'])) {
    556556                $expire_reasons[] = 'username not found';
    557557            }
    558             if (strtotime($_SESSION[$this->_ns]['login_datetime']) <= time() - $this->_params['login_timeout']) {
     558            if (strtotime($_SESSION['_auth_sql'][$this->_ns]['login_datetime']) <= time() - $this->_params['login_timeout']) {
    559559                $expire_reasons[] = 'login_timeout expired';
    560560            }
    561             if (strtotime($_SESSION[$this->_ns]['last_access_datetime']) <= time() - $this->_params['idle_timeout']) {
     561            if (strtotime($_SESSION['_auth_sql'][$this->_ns]['last_access_datetime']) <= time() - $this->_params['idle_timeout']) {
    562562                $expire_reasons[] = 'idle_timeout expired';
    563563            }
    564             if ($_SESSION[$this->_ns]['remote_ip'] != getRemoteAddr() && !$user_in_trusted_network) {
    565                 $expire_reasons[] = sprintf('remote_ip not matched (%s != %s)', $_SESSION[$this->_ns]['remote_ip'], getRemoteAddr());
     564            if ($_SESSION['_auth_sql'][$this->_ns]['remote_ip'] != getRemoteAddr() && !$user_in_trusted_network) {
     565                $expire_reasons[] = sprintf('remote_ip not matched (%s != %s)', $_SESSION['_auth_sql'][$this->_ns]['remote_ip'], getRemoteAddr());
    566566            }
    567567            $app->logMsg(sprintf('User %s (%s) session expired: %s', $this->get('user_id'), $this->get('username'), join(', ', $expire_reasons)), LOG_INFO, __FILE__, __LINE__);
  • trunk/lib/Cache.inc.php

    r153 r154  
    4747    function Cache($namespace='')
    4848    {
    49         $this->_ns = '_cache' . $namespace;
    50        
    51         if (!isset($_SESSION[$this->_ns])) {
     49        $this->_ns = $namespace;
     50       
     51        if (!isset($_SESSION['_cache'][$this->_ns])) {
    5252            $this->clear();
    5353        }
     
    146146
    147147        // Remove any value already stored under this key.
    148         unset($_SESSION[$this->_ns][$keyhash]);
     148        unset($_SESSION['_cache'][$this->_ns][$keyhash]);
    149149
    150150        // Continue to prune the cache if its size is greater than stack_size_limit, but keep at least min_items.
    151         while (strlen(serialize($_SESSION[$this->_ns])) + $var_len >= $this->getParam('stack_size_limit') && sizeof($_SESSION[$this->_ns]) >= $this->getParam('min_items')) {
    152             array_shift($_SESSION[$this->_ns]);
     151        while (strlen(serialize($_SESSION['_cache'][$this->_ns])) + $var_len >= $this->getParam('stack_size_limit') && sizeof($_SESSION['_cache'][$this->_ns]) >= $this->getParam('min_items')) {
     152            array_shift($_SESSION['_cache'][$this->_ns]);
    153153        }
    154154
    155155        // Save this value under the specified key.
    156         $_SESSION[$this->_ns][$keyhash] =& $var;
     156        $_SESSION['_cache'][$this->_ns][$keyhash] =& $var;
    157157
    158158        if ($var_len >= 1024000) {
     
    182182
    183183        $keyhash = md5($key);
    184         if (isset($_SESSION[$this->_ns][$keyhash])) {
     184        if (isset($_SESSION['_cache'][$this->_ns][$keyhash])) {
    185185            $app->logMsg(sprintf('Retreiving %s from cache.', $key), LOG_DEBUG, __FILE__, __LINE__);
    186186            // Move the accessed cached datum to the top of the stack. Maybe somebody knows a better way to do this?
    187             $tmp =& $_SESSION[$this->_ns][$keyhash];
    188             unset($_SESSION[$this->_ns][$keyhash]);
    189             $_SESSION[$this->_ns][$keyhash] =& $tmp;
     187            $tmp =& $_SESSION['_cache'][$this->_ns][$keyhash];
     188            unset($_SESSION['_cache'][$this->_ns][$keyhash]);
     189            $_SESSION['_cache'][$this->_ns][$keyhash] =& $tmp;
    190190            // Return the unserialized datum.
    191             return unserialize($_SESSION[$this->_ns][$keyhash]);
     191            return unserialize($_SESSION['_cache'][$this->_ns][$keyhash]);
    192192        } else {
    193193            return false;
     
    208208
    209209        $keyhash = md5($key);
    210         return array_key_exists($keyhash, $_SESSION[$this->_ns]);
     210        return array_key_exists($keyhash, $_SESSION['_cache'][$this->_ns]);
    211211    }
    212212
     
    220220    {
    221221        $keyhash = md5($key);
    222         unset($_SESSION[$this->_ns][$keyhash]);
     222        unset($_SESSION['_cache'][$this->_ns][$keyhash]);
    223223    }
    224224   
     
    233233    function clear()
    234234    {
    235         $_SESSION[$this->_ns] = array();
     235        $_SESSION['_cache'][$this->_ns] = array();
    236236    }
    237237
  • trunk/lib/ImageThumb.inc.php

    r152 r154  
    320320        if (!$this->_validFileExtension($file_name)) {
    321321            $this->_raiseMsg(sprintf(_("Image resizing failed: source image %s not a valid type. It must have one of the following file name extensions: %s"), $file_name, join(', ', $this->getParam('valid_file_extensions'))), MSG_ERR, __FILE__, __LINE__);
    322             $app->logMsg(sprintf('Image resizing failed: source image not of valid type: %s', $source_file), LOG_ERR, __FILE__, __LINE__);
     322            $app->logMsg(sprintf('Image resizing failed: source image not of valid type: %s', $source_file), LOG_WARNING, __FILE__, __LINE__);
    323323            return false;
    324324        }
     
    382382            if (IMAGETHUMB_METHOD_NETPBM === $this->getParam('resize_method') && file_exists($this->getParam('anytopnm_binary')) && file_exists($this->getParam('pnmscale_binary')) && file_exists($this->getParam('cjpeg_binary'))) {
    383383                // Resize using Netpbm binaries.
    384                 $app->logMsg(sprintf('Resizing with Netpbm: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
     384                // $app->logMsg(sprintf('Resizing with Netpbm: %s', $source_file), LOG_DEBUG, __FILE__, __LINE__);
    385385                $return_val += $this->_resizeWithNetpbm($source_file, $dest_file, $spec);
    386386            } else if (IMAGETHUMB_METHOD_GD === $this->getParam('resize_method') && extension_loaded('gd')) {
    387387                // Resize with GD.
    388                 $app->logMsg(sprintf('Resizing with GD: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
     388                // $app->logMsg(sprintf('Resizing with GD: %s', $source_file), LOG_DEBUG, __FILE__, __LINE__);
    389389                $return_val += $this->_resizeWithGD($source_file, $dest_file, $spec);
    390390            } else {
     
    739739                }
    740740                if (!file_exists($dest_dir)) {
    741                     if (phpversion() > '5' && false) { ///
     741                    if (phpversion() > '5') {
    742742                        // Recursive.
    743                         if (! ($ret = mkdir($dest_dir, $this->getParam('dest_dir_perms'), true))) {
     743                        if (!file_exists($dest_dir) && !($ret = mkdir($dest_dir, $this->getParam('dest_dir_perms'), true))) {
    744744                            $return_val++;
    745745                            $app->logMsg(sprintf('mkdir failure: %s', $dest_dir), LOG_ERR, __FILE__, __LINE__);
  • trunk/lib/PageNumbers.inc.php

    r153 r154  
    6666        $this->url_base = $_SERVER['PHP_SELF'] . '?page_number=';
    6767       
    68         $this->prefs = new Prefs();
     68        $this->prefs = new Prefs($_SERVER['PHP_SELF']);
    6969        $this->prefs->setParam(array('persistent' => false));
    7070    }
  • trunk/lib/Prefs.inc.php

    r153 r154  
    6363        $app =& App::getInstance();
    6464
    65         $this->_ns = '_prefs_' . $namespace;
     65        $this->_ns = $namespace;
    6666       
    6767        // Initialized the prefs array.
    68         if (!isset($_SESSION[$this->_ns])) {
     68        if (!isset($_SESSION['_prefs'][$this->_ns])) {
    6969            $this->clear();
    7070        }
     
    158158    {
    159159        if (isset($defaults) && is_array($defaults)) {
    160             $_SESSION[$this->_ns]['defaults'] = array_merge($_SESSION[$this->_ns]['defaults'], $defaults);
     160            $_SESSION['_prefs'][$this->_ns]['defaults'] = array_merge($_SESSION['_prefs'][$this->_ns]['defaults'], $defaults);
    161161        }
    162162    }
     
    180180        }
    181181       
    182         if (!isset($_SESSION[$this->_ns]['defaults'][$key]) || $_SESSION[$this->_ns]['defaults'][$key] != $val || isset($_SESSION[$this->_ns]['persistent'][$key])) {
    183             $_SESSION[$this->_ns]['persistent'][$key] = $val;           
     182        if (!isset($_SESSION['_prefs'][$this->_ns]['defaults'][$key]) || $_SESSION['_prefs'][$this->_ns]['defaults'][$key] != $val || isset($_SESSION['_prefs'][$this->_ns]['persistent'][$key])) {
     183            $_SESSION['_prefs'][$this->_ns]['persistent'][$key] = $val;           
    184184        }
    185185    }
     
    196196    {
    197197        $app =& App::getInstance();
    198         if (array_key_exists($key, $_SESSION[$this->_ns]['persistent'])) {
    199             return $_SESSION[$this->_ns]['persistent'][$key];
    200         } else if (array_key_exists($key, $_SESSION[$this->_ns]['defaults'])) {
    201             return $_SESSION[$this->_ns]['defaults'][$key];
     198        if (array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['persistent'])) {
     199            return $_SESSION['_prefs'][$this->_ns]['persistent'][$key];
     200        } else if (array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['defaults'])) {
     201            return $_SESSION['_prefs'][$this->_ns]['defaults'][$key];
    202202        } else {
    203             $app->logMsg(sprintf('Key not found in prefs cache: %s', $key), LOG_NOTICE, __FILE__, __LINE__);
     203            $app->logMsg(sprintf('Key not found in prefs cache: %s', $key), LOG_DEBUG, __FILE__, __LINE__);
    204204            return null;
    205205        }
     
    214214    function exists($key)
    215215    {
    216         return array_key_exists($key, $_SESSION[$this->_ns]['persistent']);
     216        return array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['persistent']);
    217217    }
    218218
     
    224224    function delete($key)
    225225    {
    226         unset($_SESSION[$this->_ns]['persistent'][$key]);
     226        unset($_SESSION['_prefs'][$this->_ns]['persistent'][$key]);
    227227    }
    228228
     
    233233    function clear()
    234234    {
    235         $_SESSION[$this->_ns] = array(
     235        $_SESSION['_prefs'][$this->_ns] = array(
    236236            'loaded' => false,
    237237            'load_datetime' => '1970-01-01',
     
    286286        ");
    287287        while (list($key, $val) = mysql_fetch_row($qid)) {
    288             $_SESSION[$this->_ns]['persistent'][$key] = $val;
     288            $_SESSION['_prefs'][$this->_ns]['persistent'][$key] = $val;
    289289        }
    290290       
    291         $app->logMsg(sprintf('Loaded %s prefs from database.', sizeof($_SESSION[$this->_ns]['persistent'])), LOG_DEBUG, __FILE__, __LINE__);
     291        $app->logMsg(sprintf('Loaded %s prefs from database.', sizeof($_SESSION['_prefs'][$this->_ns]['persistent'])), LOG_DEBUG, __FILE__, __LINE__);
    292292       
    293293        // Data loaded only once per session.
    294         $_SESSION[$this->_ns]['loaded'] = true;
    295         $_SESSION[$this->_ns]['load_datetime'] = date('Y-m-d H:i:s');
     294        $_SESSION['_prefs'][$this->_ns]['loaded'] = true;
     295        $_SESSION['_prefs'][$this->_ns]['load_datetime'] = date('Y-m-d H:i:s');
    296296       
    297297        return true;
     
    310310    function _isLoaded()
    311311    {
    312         if (isset($_SESSION[$this->_ns]['load_datetime'])
    313         && strtotime($_SESSION[$this->_ns]['load_datetime']) > time() - $this->getParam('load_timeout')
    314         && isset($_SESSION[$this->_ns]['loaded'])
    315         && true === $_SESSION[$this->_ns]['loaded']) {
     312        if (isset($_SESSION['_prefs'][$this->_ns]['load_datetime'])
     313        && strtotime($_SESSION['_prefs'][$this->_ns]['load_datetime']) > time() - $this->getParam('load_timeout')
     314        && isset($_SESSION['_prefs'][$this->_ns]['loaded'])
     315        && true === $_SESSION['_prefs'][$this->_ns]['loaded']) {
    316316            return true;
    317317        } else {
     
    347347        $this->initDB();
    348348
    349         if (isset($_SESSION[$this->_ns]['persistent']) && is_array($_SESSION[$this->_ns]['persistent'])) {
     349        if (isset($_SESSION['_prefs'][$this->_ns]['persistent']) && is_array($_SESSION['_prefs'][$this->_ns]['persistent'])) {
    350350            // Delete old prefs from database.
    351351            $db->query("
     
    357357            // Insert new prefs.
    358358            $insert_values = array();
    359             foreach ($_SESSION[$this->_ns]['persistent'] as $key => $val) {
     359            foreach ($_SESSION['_prefs'][$this->_ns]['persistent'] as $key => $val) {
    360360                $insert_values[] = sprintf("('%s', '%s', '%s', '%s')", $db->escapeString($this->getParam('user_id')), $db->escapeString($this->_ns), $db->escapeString($key), $db->escapeString($val));
    361361            }
  • trunk/lib/SortOrder.inc.php

    r153 r154  
    3535    function SortOrder($default_sort = '', $default_order = '')
    3636    {
     37        $this->prefs = new Prefs($_SERVER['PHP_SELF']);
     38        $this->prefs->setParam(array('persistent' => false));
     39
    3740        $this->setDefault($default_sort, $default_order);
    3841
    3942        $this->default_sort = $default_sort;
    40         $this->default_order = $default_order;
    41        
    42         $this->prefs = new Prefs();
    43         $this->prefs->setParam(array('persistent' => false));
     43        $this->default_order = $default_order;       
    4444    }
    4545
  • trunk/lib/Utilities.inc.php

    r136 r154  
    250250 * @version     1.1.0
    251251 */
    252 function humanFileSize($size, $unit=null, $format='%01.2f %s')
     252function humanFileSize($size, $max_unit=null, $format='%01.2f %s')
    253253{
    254254    // Units
     
    257257
    258258    // Max unit
    259     $unit = array_search((string) $unit, $units);
    260     if ($unit === null || $unit === false) {
    261         $unit = $ii;
     259    $max_unit = array_search((string) $max_unit, $units);
     260    if ($max_unit === null || $max_unit === false) {
     261        $max_unit = $ii;
    262262    }
    263263
    264264    // Loop
    265265    $i = 0;
    266     while ($unit != $i && $size >= 1024 && $i < $ii) {
     266    while ($max_unit != $i && $size >= 1024 && $i < $ii) {
    267267        $size /= 1024;
    268268        $i++;
  • trunk/tests/AppTest.php

    r136 r154  
    8383        $expected = 'My message';
    8484        $app->raiseMsg($expected, MSG_NOTICE, __FILE__, __LINE__);
    85         $msg = current($_SESSION[$this->App->_ns]['messages']);
     85        $msg = current($_SESSION['_app'][$this->App->_ns]['messages']);
    8686        $this->assertEquals($expected, $msg['message']);
    8787    }
  • trunk/tests/Auth_FileTest.php

    r149 r154  
    4545        $result = $this->Auth_File->login('testuser', 'testpass');
    4646        $this->assertTrue($result, 'testuser login failed.');
    47         $this->assertTrue($_SESSION[$this->Auth_File->_ns]['authenticated'], 'testuser authentication not found in session.');
     47        $this->assertTrue($_SESSION['_auth_file'][$this->Auth_File->_ns]['authenticated'], 'testuser authentication not found in session.');
    4848    }
    4949
     
    5252        $result = $this->Auth_File->login('testuser', 'testpass');
    5353        $this->Auth_File->clear();
    54         $this->assertFalse($_SESSION[$this->Auth_File->_ns]['authenticated'], 'testuser authentication not false in session.');
     54        $this->assertFalse($_SESSION['_auth_file'][$this->Auth_File->_ns]['authenticated'], 'testuser authentication not false in session.');
    5555    }
    5656
  • trunk/tests/Auth_SQLTest.php

    r149 r154  
    7070    {
    7171        $this->Auth_SQL->set('testuserkey', 'testuserval');
    72         $this->assertEquals('testuserval', $_SESSION[$this->Auth_SQL->_ns]['user_data']['testuserkey']);
     72        $this->assertEquals('testuserval', $_SESSION['_auth_sql'][$this->Auth_SQL->_ns]['user_data']['testuserkey']);
    7373    }
    7474
    7575    function test_get()
    7676    {
    77         $_SESSION[$this->Auth_SQL->_ns]['user_data']['testuserkey'] = 'testuserval';
     77        $_SESSION['_auth_sql'][$this->Auth_SQL->_ns]['user_data']['testuserkey'] = 'testuserval';
    7878        $val = $this->Auth_SQL->get('testuserkey');
    7979        $this->assertEquals('testuserval', $val);
  • trunk/tests/EmailTest.php

    r42 r154  
    9494        $this->assertEquals(41, $gc, 'Unexpected good count.');
    9595        $this->assertEquals(47, $bc, 'Unexpected bad count.');
    96         echo "Good addresses: $gc\n";
    97         echo "Bad addresses: $bc\n";
     96        // echo "Good addresses: $gc\n";
     97        // echo "Bad addresses: $bc\n";
    9898//         echo join("\n", $bad);
    9999//         echo "\n";
Note: See TracChangeset for help on using the changeset viewer.