Changeset 154
- Timestamp:
- Jun 8, 2006 5:36:10 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/form_template.cli.php
r136 r154 34 34 35 35 $exclude = array('added_by_user_id', 'added_datetime', 'hit_count', 'modified_datetime', 'modified_by_user_id'); 36 $primary_key = ' <##>';36 $primary_key = '__///__'; 37 37 $output = array(); 38 38 … … 64 64 65 65 <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, '—', <##>)", '$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, '—', __///__)", '$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> 70 70 <\x3fphp } \x3f> 71 71 E_O_F; … … 80 80 <input type="file" name="$field" id="$field" /> 81 81 <\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> 83 83 <\x3fphp } \x3f> 84 84 <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 46 46 } 47 47 48 $primary_key = ' <##>';48 $primary_key = '__///__'; 49 49 50 50 // Loop through columns … … 111 111 <form action="<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>" method="get"> 112 112 <\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> 114 114 <br /> 115 115 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, '—', city, '—', 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, '—', city, '—', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); \x3f> 119 119 </select> 120 120 <input type="submit" name="list" value="<\x3fphp echo _("Search"); \x3f>" /> … … 149 149 <\x3fphp for (\$i = 0; \$i <= \$page->last_item - \$page->first_item && \$page->total_items > 0; \$i++) { \x3f> 150 150 <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> </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> </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> </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> </td> 153 153 154 154 E_O_F; … … 164 164 165 165 echo 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> </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> </td> 167 167 </tr> 168 168 <\x3fphp } \x3f> -
trunk/bin/module_maker/module.cli.php
r151 r154 223 223 if ($upload_file_capability) { 224 224 // 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=\"__///__\" />"; 226 226 227 227 // Include statement. … … 234 234 \$upload = new Upload(); 235 235 \$upload->setParam(array( 236 'upload_path' => COMMON_BASE . '/html/_db_files/ <##>',236 'upload_path' => COMMON_BASE . '/html/_db_files/__///__', 237 237 'dest_file_perms' => 0666, 238 238 'allow_overwriting' => false, … … 246 246 247 247 // Copy uploaded image name into form data. 248 \$_POST[' <##>'] = isset(\$_FILES['<##>']) ? \$_FILES['<##>']['name'] : '';248 \$_POST['__///__'] = isset(\$_FILES['__///__']) ? \$_FILES['__///__']['name'] : ''; 249 249 250 250 … … 264 264 265 265 // Upload files with prepended primary key. 266 \$new_file = \$upload->process(' <##>', \$%PRIMARY_KEY% . '_' . getFormData('<##>'));266 \$new_file = \$upload->process('__///__', \$%PRIMARY_KEY% . '_' . getFormData('__///__')); 267 267 268 268 // If file upload errors, redirect to edit operation for the inserted record. … … 276 276 277 277 // Upload new files. 278 if (getFormData(' <##>')) {278 if (getFormData('__///__')) { 279 279 // Get old file names for deletion. 280 280 \$old_file = \$upload->getFilenameGlob(getFormData('%PRIMARY_KEY%') . '_*'); 281 281 // 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('__///__')); 283 283 if (false === \$new_file || \$upload->anyErrors()) { 284 284 // Upload failed. Reload form. Display errors. -
trunk/bin/module_maker/skel/adm_list.ihtml
r136 r154 8 8 <br /> 9 9 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, '—', city, '—', 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, '—', city, '—', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); ?> 13 13 </select> 14 14 <input type="submit" value="<?php echo _("Search"); ?>" /> … … 28 28 <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?> 29 29 <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> </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> </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> </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> </td> 32 32 %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> </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> </td> 34 34 </tr> 35 35 <?php } ?> -
trunk/bin/module_maker/skel/admin.php
r153 r154 50 50 // Search limiters retain their values between page requests. 51 51 $app->carryQuery('search_query'); 52 $app->carryQuery('filter_ <##>');52 $app->carryQuery('filter___///__'); 53 53 %ADMIN_UPLOAD_CONFIG% 54 54 /******************************************************************** … … 235 235 236 236 // Lock this record. 237 $lock->set('%DB_TBL%', '%PRIMARY_KEY%', $id, $frm[' <##>']);237 $lock->set('%DB_TBL%', '%PRIMARY_KEY%', $id, $frm['__///__']); 238 238 239 239 // Set misc values for the form. … … 268 268 // Get the information for this object. 269 269 $qid = $db->query(" 270 SELECT <##>270 SELECT __///__ 271 271 FROM %DB_TBL% 272 272 WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "' … … 301 301 // Create version. 302 302 $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__); 306 306 307 307 return $last_insert_id; … … 326 326 // Create version. 327 327 $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__); 331 331 332 332 // Unlock record. … … 352 352 } 353 353 354 if (getFormData('filter_ <##>', false)) {354 if (getFormData('filter___///__', false)) { 355 355 // 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___///__')) . "'"; 357 357 } 358 358 -
trunk/bin/module_maker/skel/public.ihtml
r136 r154 1 1 <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> 3 3 4 4 <!-- -
trunk/bin/module_maker/skel/public.php
r143 r154 38 38 WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' 39 39 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') 42 42 "); 43 43 if (!$item = mysql_fetch_assoc($qid)) { … … 54 54 55 55 // Set title and main template. 56 $nav->addPage($item[' <##>']);56 $nav->addPage($item['__///__']); 57 57 $main_template = '%PUBLIC_DETAIL_TEMPLATE%'; 58 58 -
trunk/bin/module_maker/skel/public_list.ihtml
r136 r154 10 10 <?php } ?> 11 11 <p> 12 <em><?php echo date($app->getParam('date_format'), strtotime($%NAME_SINGULAR%_list[$i][' <##>'])); ?></em> — <?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> — <?php echo nl2br(fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['summary'], true))); ?> 13 13 14 14 <?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 52 52 53 53 $sort_columns = ''; 54 $primary_key = ' <##>';54 $primary_key = '__///__'; 55 55 56 56 // Loop through columns -
trunk/docs/example_script_template.php
r143 r154 1 1 <?php 2 2 /** 3 * <##>3 * __///__ 4 4 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information. 5 5 * @author Quinn Comendant <quinn@strangecode.com> 6 6 * @version 1.0 7 * @since <##>7 * @since __///__ 8 8 */ 9 9 -
trunk/lib/App.inc.php
r144 r154 152 152 { 153 153 // Set namespace of application instance. 154 $this->_ns = '_app_' .$namespace;154 $this->_ns = $namespace; 155 155 156 156 // Initialize default parameters. … … 281 281 session_start(); 282 282 283 if (!isset($_SESSION[ $this->_ns])) {283 if (!isset($_SESSION['_app'][$this->_ns])) { 284 284 // Access session data using: $_SESSION['...']. 285 285 // Initialize here _after_ session has started. 286 $_SESSION[ $this->_ns] = array(286 $_SESSION['_app'][$this->_ns] = array( 287 287 'messages' => array(), 288 288 'boomerang' => array('url'), … … 363 363 // Save message in session under unique key to avoid duplicate messages. 364 364 $msg_id = md5($type . $message . $file . $line); 365 $_SESSION[ $this->_ns]['messages'][$msg_id] = array(365 $_SESSION['_app'][$this->_ns]['messages'][$msg_id] = array( 366 366 'type' => $type, 367 367 'message' => $message, 368 368 'file' => $file, 369 369 '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) 371 371 ); 372 372 … … 391 391 } 392 392 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(); 394 394 } 395 395 … … 408 408 } 409 409 410 $_SESSION[ $this->_ns]['messages'] = array();410 $_SESSION['_app'][$this->_ns]['messages'] = array(); 411 411 } 412 412 … … 843 843 // Get URL from stored boomerang. Allow non specific URL if ID not valid. 844 844 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]; 847 847 $this->logMsg(sprintf('dieBoomerangURL(%s) found: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 848 848 } else { 849 $url = end($_SESSION[ $this->_ns]['boomerang']['url']);849 $url = end($_SESSION['_app'][$this->_ns]['boomerang']['url']); 850 850 $this->logMsg(sprintf('dieBoomerangURL(%s) using: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 851 851 } … … 866 866 // A redirection will never happen immediately twice. 867 867 // Set the time so ensure this doesn't happen. 868 $_SESSION[ $this->_ns]['boomerang']['time'] = time();868 $_SESSION['_app'][$this->_ns]['boomerang']['time'] = time(); 869 869 $this->dieURL($url, $carry_args); 870 870 } … … 890 890 $url = preg_replace('/boomerang=[\w]+/', '', $url); 891 891 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'])) { 893 893 // 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]); 896 896 } 897 897 } 898 898 899 899 if (isset($id)) { 900 $_SESSION[ $this->_ns]['boomerang']['url'][$id] = $url;900 $_SESSION['_app'][$this->_ns]['boomerang']['url'][$id] = $url; 901 901 } else { 902 $_SESSION[ $this->_ns]['boomerang']['url'][] = $url;902 $_SESSION['_app'][$this->_ns]['boomerang']['url'][] = $url; 903 903 } 904 904 $this->logMsg(sprintf('setBoomerangURL(%s): %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); … … 923 923 924 924 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]; 927 927 } else { 928 928 return ''; 929 929 } 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']); 932 932 } else { 933 933 return false; … … 949 949 $this->logMsg(sprintf('deleteBoomerangURL(%s): %s', $id, $this->getBoomerangURL($id)), LOG_DEBUG, __FILE__, __LINE__); 950 950 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']); 955 955 } 956 956 } … … 969 969 } 970 970 971 if (!isset($_SESSION[ $this->_ns]['boomerang']['url'])) {971 if (!isset($_SESSION['_app'][$this->_ns]['boomerang']['url'])) { 972 972 $this->logMsg(sprintf('validBoomerangURL(%s) no boomerang URL set.', $id), LOG_DEBUG, __FILE__, __LINE__); 973 973 return false; … … 977 977 // a boomerang redirection will always occur at least several seconds after the last boomerang redirect 978 978 // 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; 980 980 981 981 $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]; 984 984 } else if (!isset($id) || $use_nonspecificboomerang) { 985 985 // Use non specific boomerang if available. 986 $url = end($_SESSION[ $this->_ns]['boomerang']['url']);986 $url = end($_SESSION['_app'][$this->_ns]['boomerang']['url']); 987 987 } 988 988 -
trunk/lib/Auth_File.inc.php
r149 r154 68 68 function Auth_File($namespace='null') 69 69 { 70 $this->_ns = '_auth_' .$namespace;70 $this->_ns = $namespace; 71 71 72 72 // Initialize default parameters. … … 114 114 function clear() 115 115 { 116 $_SESSION[ $this->_ns] = array('authenticated' => false);116 $_SESSION['_auth_file'][$this->_ns] = array('authenticated' => false); 117 117 } 118 118 … … 127 127 function set($key, $val) 128 128 { 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; 133 133 } 134 134 … … 143 143 function get($key, $default='') 144 144 { 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]; 149 149 } else { 150 150 return $default; … … 209 209 } 210 210 211 $_SESSION[ $this->_ns] = array(211 $_SESSION['_auth_file'][$this->_ns] = array( 212 212 'authenticated' => true, 213 213 'username' => $username, … … 238 238 if ($trusted_net = ipInRange(getRemoteAddr(), $this->_params['trusted_networks'])) { 239 239 $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__); 241 241 } else if (preg_match('/proxy.aol.com$/i', getRemoteAddr(true))) { 242 242 $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__); 244 244 } else { 245 245 $user_in_trusted_network = false; … … 247 247 248 248 // 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) 255 255 ) { 256 256 // 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'); 258 258 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) { 261 261 // Only raise message if last session is less than 12 hours old. 262 262 $app->raiseMsg(_("Your session has closed. You need to log-in again."), MSG_NOTICE, __FILE__, __LINE__); … … 265 265 // Log the reason for login expiration. 266 266 $expire_reasons = array(); 267 if (empty($_SESSION[ $this->_ns]['username'])) {267 if (empty($_SESSION['_auth_file'][$this->_ns]['username'])) { 268 268 $expire_reasons[] = 'username not found'; 269 269 } 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']) { 271 271 $expire_reasons[] = 'login_timeout expired'; 272 272 } 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']) { 274 274 $expire_reasons[] = 'idle_timeout expired'; 275 275 } 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__); 280 280 } 281 281 -
trunk/lib/Auth_SQL.inc.php
r149 r154 100 100 $app =& App::getInstance(); 101 101 102 $this->_ns = '_auth_' .$namespace;102 $this->_ns = $namespace; 103 103 104 104 // Initialize default parameters. … … 264 264 WHERE " . $this->_params['db_primary_key'] . " = '" . $this->get('user_id') . "' 265 265 "); 266 $_SESSION[ $this->_ns] = array('authenticated' => false);266 $_SESSION['_auth_sql'][$this->_ns] = array('authenticated' => false); 267 267 } 268 268 … … 276 276 function set($key, $val) 277 277 { 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; 282 282 } 283 283 … … 292 292 function get($key, $default='') 293 293 { 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]; 298 298 } else { 299 299 return $default; … … 373 373 374 374 // Register authenticated session. 375 $_SESSION[ $this->_ns] = array(375 $_SESSION['_auth_sql'][$this->_ns] = array( 376 376 'authenticated' => true, 377 377 'user_id' => $user_data['user_id'], … … 497 497 498 498 // 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']; 501 501 } 502 502 … … 521 521 522 522 // 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) 529 529 ) { 530 530 // 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'); 532 532 533 533 // Update the DB with the last_access_datetime and increment the seconds_online. … … 544 544 $app->logMsg(sprintf('User update failed. Record not found for user %s (%s).', $this->get('user_id'), $this->get('username')), LOG_NOTICE, __FILE__, __LINE__); 545 545 } 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']) { 547 547 // 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) { 549 549 // Only raise message if last session is less than 12 hours old. 550 550 $app->raiseMsg(_("Your session has expired. You need to log-in again."), MSG_NOTICE, __FILE__, __LINE__); … … 553 553 // Log the reason for login expiration. 554 554 $expire_reasons = array(); 555 if (empty($_SESSION[ $this->_ns]['username'])) {555 if (empty($_SESSION['_auth_sql'][$this->_ns]['username'])) { 556 556 $expire_reasons[] = 'username not found'; 557 557 } 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']) { 559 559 $expire_reasons[] = 'login_timeout expired'; 560 560 } 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']) { 562 562 $expire_reasons[] = 'idle_timeout expired'; 563 563 } 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()); 566 566 } 567 567 $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 47 47 function Cache($namespace='') 48 48 { 49 $this->_ns = '_cache' .$namespace;50 51 if (!isset($_SESSION[ $this->_ns])) {49 $this->_ns = $namespace; 50 51 if (!isset($_SESSION['_cache'][$this->_ns])) { 52 52 $this->clear(); 53 53 } … … 146 146 147 147 // Remove any value already stored under this key. 148 unset($_SESSION[ $this->_ns][$keyhash]);148 unset($_SESSION['_cache'][$this->_ns][$keyhash]); 149 149 150 150 // 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]); 153 153 } 154 154 155 155 // Save this value under the specified key. 156 $_SESSION[ $this->_ns][$keyhash] =& $var;156 $_SESSION['_cache'][$this->_ns][$keyhash] =& $var; 157 157 158 158 if ($var_len >= 1024000) { … … 182 182 183 183 $keyhash = md5($key); 184 if (isset($_SESSION[ $this->_ns][$keyhash])) {184 if (isset($_SESSION['_cache'][$this->_ns][$keyhash])) { 185 185 $app->logMsg(sprintf('Retreiving %s from cache.', $key), LOG_DEBUG, __FILE__, __LINE__); 186 186 // 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; 190 190 // Return the unserialized datum. 191 return unserialize($_SESSION[ $this->_ns][$keyhash]);191 return unserialize($_SESSION['_cache'][$this->_ns][$keyhash]); 192 192 } else { 193 193 return false; … … 208 208 209 209 $keyhash = md5($key); 210 return array_key_exists($keyhash, $_SESSION[ $this->_ns]);210 return array_key_exists($keyhash, $_SESSION['_cache'][$this->_ns]); 211 211 } 212 212 … … 220 220 { 221 221 $keyhash = md5($key); 222 unset($_SESSION[ $this->_ns][$keyhash]);222 unset($_SESSION['_cache'][$this->_ns][$keyhash]); 223 223 } 224 224 … … 233 233 function clear() 234 234 { 235 $_SESSION[ $this->_ns] = array();235 $_SESSION['_cache'][$this->_ns] = array(); 236 236 } 237 237 -
trunk/lib/ImageThumb.inc.php
r152 r154 320 320 if (!$this->_validFileExtension($file_name)) { 321 321 $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__); 323 323 return false; 324 324 } … … 382 382 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'))) { 383 383 // 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__); 385 385 $return_val += $this->_resizeWithNetpbm($source_file, $dest_file, $spec); 386 386 } else if (IMAGETHUMB_METHOD_GD === $this->getParam('resize_method') && extension_loaded('gd')) { 387 387 // 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__); 389 389 $return_val += $this->_resizeWithGD($source_file, $dest_file, $spec); 390 390 } else { … … 739 739 } 740 740 if (!file_exists($dest_dir)) { 741 if (phpversion() > '5' && false) { ///741 if (phpversion() > '5') { 742 742 // Recursive. 743 if (! 743 if (!file_exists($dest_dir) && !($ret = mkdir($dest_dir, $this->getParam('dest_dir_perms'), true))) { 744 744 $return_val++; 745 745 $app->logMsg(sprintf('mkdir failure: %s', $dest_dir), LOG_ERR, __FILE__, __LINE__); -
trunk/lib/PageNumbers.inc.php
r153 r154 66 66 $this->url_base = $_SERVER['PHP_SELF'] . '?page_number='; 67 67 68 $this->prefs = new Prefs( );68 $this->prefs = new Prefs($_SERVER['PHP_SELF']); 69 69 $this->prefs->setParam(array('persistent' => false)); 70 70 } -
trunk/lib/Prefs.inc.php
r153 r154 63 63 $app =& App::getInstance(); 64 64 65 $this->_ns = '_prefs_' .$namespace;65 $this->_ns = $namespace; 66 66 67 67 // Initialized the prefs array. 68 if (!isset($_SESSION[ $this->_ns])) {68 if (!isset($_SESSION['_prefs'][$this->_ns])) { 69 69 $this->clear(); 70 70 } … … 158 158 { 159 159 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); 161 161 } 162 162 } … … 180 180 } 181 181 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; 184 184 } 185 185 } … … 196 196 { 197 197 $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]; 202 202 } 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__); 204 204 return null; 205 205 } … … 214 214 function exists($key) 215 215 { 216 return array_key_exists($key, $_SESSION[ $this->_ns]['persistent']);216 return array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['persistent']); 217 217 } 218 218 … … 224 224 function delete($key) 225 225 { 226 unset($_SESSION[ $this->_ns]['persistent'][$key]);226 unset($_SESSION['_prefs'][$this->_ns]['persistent'][$key]); 227 227 } 228 228 … … 233 233 function clear() 234 234 { 235 $_SESSION[ $this->_ns] = array(235 $_SESSION['_prefs'][$this->_ns] = array( 236 236 'loaded' => false, 237 237 'load_datetime' => '1970-01-01', … … 286 286 "); 287 287 while (list($key, $val) = mysql_fetch_row($qid)) { 288 $_SESSION[ $this->_ns]['persistent'][$key] = $val;288 $_SESSION['_prefs'][$this->_ns]['persistent'][$key] = $val; 289 289 } 290 290 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__); 292 292 293 293 // 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'); 296 296 297 297 return true; … … 310 310 function _isLoaded() 311 311 { 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']) { 316 316 return true; 317 317 } else { … … 347 347 $this->initDB(); 348 348 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'])) { 350 350 // Delete old prefs from database. 351 351 $db->query(" … … 357 357 // Insert new prefs. 358 358 $insert_values = array(); 359 foreach ($_SESSION[ $this->_ns]['persistent'] as $key => $val) {359 foreach ($_SESSION['_prefs'][$this->_ns]['persistent'] as $key => $val) { 360 360 $insert_values[] = sprintf("('%s', '%s', '%s', '%s')", $db->escapeString($this->getParam('user_id')), $db->escapeString($this->_ns), $db->escapeString($key), $db->escapeString($val)); 361 361 } -
trunk/lib/SortOrder.inc.php
r153 r154 35 35 function SortOrder($default_sort = '', $default_order = '') 36 36 { 37 $this->prefs = new Prefs($_SERVER['PHP_SELF']); 38 $this->prefs->setParam(array('persistent' => false)); 39 37 40 $this->setDefault($default_sort, $default_order); 38 41 39 42 $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; 44 44 } 45 45 -
trunk/lib/Utilities.inc.php
r136 r154 250 250 * @version 1.1.0 251 251 */ 252 function humanFileSize($size, $ unit=null, $format='%01.2f %s')252 function humanFileSize($size, $max_unit=null, $format='%01.2f %s') 253 253 { 254 254 // Units … … 257 257 258 258 // 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; 262 262 } 263 263 264 264 // Loop 265 265 $i = 0; 266 while ($ unit != $i && $size >= 1024 && $i < $ii) {266 while ($max_unit != $i && $size >= 1024 && $i < $ii) { 267 267 $size /= 1024; 268 268 $i++; -
trunk/tests/AppTest.php
r136 r154 83 83 $expected = 'My message'; 84 84 $app->raiseMsg($expected, MSG_NOTICE, __FILE__, __LINE__); 85 $msg = current($_SESSION[ $this->App->_ns]['messages']);85 $msg = current($_SESSION['_app'][$this->App->_ns]['messages']); 86 86 $this->assertEquals($expected, $msg['message']); 87 87 } -
trunk/tests/Auth_FileTest.php
r149 r154 45 45 $result = $this->Auth_File->login('testuser', 'testpass'); 46 46 $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.'); 48 48 } 49 49 … … 52 52 $result = $this->Auth_File->login('testuser', 'testpass'); 53 53 $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.'); 55 55 } 56 56 -
trunk/tests/Auth_SQLTest.php
r149 r154 70 70 { 71 71 $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']); 73 73 } 74 74 75 75 function test_get() 76 76 { 77 $_SESSION[ $this->Auth_SQL->_ns]['user_data']['testuserkey'] = 'testuserval';77 $_SESSION['_auth_sql'][$this->Auth_SQL->_ns]['user_data']['testuserkey'] = 'testuserval'; 78 78 $val = $this->Auth_SQL->get('testuserkey'); 79 79 $this->assertEquals('testuserval', $val); -
trunk/tests/EmailTest.php
r42 r154 94 94 $this->assertEquals(41, $gc, 'Unexpected good count.'); 95 95 $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"; 98 98 // echo join("\n", $bad); 99 99 // echo "\n";
Note: See TracChangeset
for help on using the changeset viewer.