Changeset 152
- Timestamp:
- Jun 7, 2006 5:35:16 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/skel/admin.php
r151 r152 14 14 15 15 require_once 'codebase/lib/PageNumbers.inc.php'; 16 require_once 'codebase/lib/ SessionCache.inc.php';16 require_once 'codebase/lib/Cache.inc.php'; 17 17 require_once 'codebase/lib/FormValidator.inc.php'; 18 18 require_once 'codebase/lib/SortOrder.inc.php'; … … 33 33 $fv = new FormValidator(); 34 34 35 $cache =& Cache::getInstance(); 35 // Configure the prefs object. 36 $prefs =& Prefs::getInstance('%NAME_PLURAL%'); 37 $prefs->setParam(array('persistent' => false)); 38 39 // Configure the cache object. 40 $cache =& Cache::getInstance('%NAME_PLURAL%'); 41 $cache->setParam(array('enable' => true)); 36 42 37 43 %SORT_ORDER% 38 44 39 // Instantiate page numbers. Total items are set and calculation is done in the get RecordList function.45 // Instantiate page numbers. Total items are set and calculation is done in the getCachedList function. 40 46 $page = new PageNumbers(); 41 47 $page->setPerPage(getFormData('per_page'), 100); … … 57 63 58 64 if (getFormData('break_list_cache', false)) { 59 // Break the cache because we are changing thelist data.60 $cache->delete( $_SERVER['PHP_SELF']);65 // Remove any stale cached list data. 66 $cache->delete('list'); 61 67 } 62 68 … … 171 177 default : 172 178 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_LIST, _("Permission to view %NAME_PLURAL% list denied.")); 173 $list =& get RecordList();179 $list =& getCachedList(); 174 180 $main_template = '%ADMIN_LIST_TEMPLATE%'; 175 181 break; … … 250 256 global $lock; 251 257 $db =& DB::getInstance(); 252 $cache =& Cache::getInstance( );258 $cache =& Cache::getInstance('%NAME_PLURAL%'); 253 259 254 260 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id); … … 257 263 } 258 264 259 // Break the cache because we are changing thelist data.260 $cache->delete( $_SERVER['PHP_SELF']);265 // Remove any stale cached list data. 266 $cache->delete('list'); 261 267 262 268 // Get the information for this object. … … 285 291 global $auth; 286 292 $db =& DB::getInstance(); 287 $cache =& Cache::getInstance( );293 $cache =& Cache::getInstance('%NAME_PLURAL%'); 288 294 289 // Break the cache because we are changing thelist data.290 $cache->delete( $_SERVER['PHP_SELF']);295 // Remove any stale cached list data. 296 $cache->delete('list'); 291 297 292 298 %INSERT% … … 306 312 global $auth, $lock; 307 313 $app =& App::getInstance(); 308 $cache =& Cache::getInstance( );314 $cache =& Cache::getInstance('%NAME_PLURAL%'); 309 315 310 316 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%']); … … 313 319 } 314 320 315 // Break the cache because we are changing thelist data.316 $cache->delete( $_SERVER['PHP_SELF']);321 // Remove any stale cached list data. 322 $cache->delete('list'); 317 323 318 324 %UPDATE% … … 328 334 } 329 335 330 function &get RecordList()336 function &getCachedList() 331 337 { 332 338 global $page; 333 339 global $so; 334 $db =& DB::getInstance(); 335 $prefs =& Prefs::getInstance( );336 $cache =& Cache::getInstance( );337 340 $db =& DB::getInstance(); 341 $prefs =& Prefs::getInstance('%NAME_PLURAL%'); 342 $cache =& Cache::getInstance('%NAME_PLURAL%'); 343 338 344 $where_clause = ''; 339 345 … … 377 383 "; 378 384 385 // Use a cash hash to determine if the result-set has changed. 379 386 // A unique key for this query, with the total_items in case db records 380 387 // were added since the last cache. This identifies a unique set of … … 383 390 // without knowing the hash. 384 391 $cache_hash = md5($sql . '|' . $page->total_items); 385 if ($prefs->get('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) { 386 $cache->delete($_SERVER['PHP_SELF']); 387 $prefs->set('cache_hash', $cache_hash, $_SERVER['PHP_SELF']); 388 } 389 390 if ($cache->exists($_SERVER['PHP_SELF'])) { 391 // Get the cached results. 392 $list = $cache->get($_SERVER['PHP_SELF']); 393 } else { 394 // If the list is not already cached, query now. 395 $qid = $db->query($sql); 396 // Fill an array with the items for this page. 397 while ($row = mysql_fetch_assoc($qid)) { 398 $list[] = $row; 399 } 400 401 if (isset($list) && !empty($list)) { 402 // Cache the results. 403 $cache->set($list, $_SERVER['PHP_SELF']); 404 } 392 if ($prefs->get('cache_hash') != $cache_hash) { 393 $cache->delete('list'); 394 $prefs->set('cache_hash', $cache_hash); 395 } 396 397 // First try to return from the cache. 398 if ($cache->exists('list')) { 399 return $cache->get('list'); 400 } 401 402 // The list was not cached, so issue the real query. 403 $qid = $db->query($sql); 404 while ($row = mysql_fetch_assoc($qid)) { 405 $list[] = $row; 406 } 407 408 // Save this list into the cache. 409 if (isset($list) && !empty($list)) { 410 $cache->set('list', $list); 405 411 } 406 412 … … 411 417 { 412 418 $db =& DB::getInstance(); 413 $cache =& Cache::getInstance( );419 $cache =& Cache::getInstance('%NAME_PLURAL%'); 414 420 415 421 if (!is_array($ranks)) { … … 418 424 } 419 425 420 // Break the cache because we are changing thelist data.421 $cache->delete( $_SERVER['PHP_SELF']);426 // Remove any stale cached list data. 427 $cache->delete('list'); 422 428 423 429 // Count the ranks with invalid numbers -
trunk/lib/Cache.inc.php
r146 r152 13 13 14 14 // Flags. 15 define('CACHE_ IGNORE_SIZE', 1);15 define('CACHE_ALLOW_OVERSIZED', 1); 16 16 17 17 class Cache { 18 18 19 // Namespace of this instance of Prefs. 20 var $_ns; 21 22 // Configuration parameters for this object. 19 23 var $_params = array( 24 25 // If false nothing will be cached or retreived. Useful for testing realtime data requests. 20 26 'enabled' => true, 21 'soft_limit' => 204800, 22 'hard_limit' => 4194304, 23 'min_items' => 3, 27 28 // The maximum size in bytes of any one variable. 29 'item_size_limit' => 4194304, // 4 MB 30 31 // The maximum size in bytes before the cache will begin flushing out old items. 32 'stack_size_limit' => 4194304, // 4 MB 33 34 // The minimum items to keep in the cache regardless of item or cache size. 35 'min_items' => 5, 24 36 ); 37 38 /* 39 * Constructor 40 * 41 * @access public 42 * @param string $namespace This object will store data under this realm. 43 * @author Quinn Comendant <quinn@strangecode.com> 44 * @version 1.0 45 * @since 05 Jun 2006 23:14:21 46 */ 47 function Cache($namespace='') 48 { 49 $this->_ns = '_cache' . $namespace; 50 51 if (!isset($_SESSION[$this->_ns])) { 52 $this->clear(); 53 } 54 } 25 55 26 56 /** … … 31 61 * @static 32 62 */ 33 function &getInstance( )34 { 35 static $instance = null;36 37 if ( $instance === null) {38 $instance = new Cache();39 } 40 41 return $instance ;63 function &getInstance($namespace='') 64 { 65 static $instances = array(); 66 67 if (!array_key_exists($namespace, $instances)) { 68 $instances[$namespace] = new Cache($namespace); 69 } 70 71 return $instances[$namespace]; 42 72 } 43 73 … … 81 111 /** 82 112 * Stores a new variable in the session cache. The $key is is md5'ed 83 * because if a variable id is a very large integer, the array_shift function113 * because if a key is numeric, the array_shift function 84 114 * will reset the key to the next largest int key. Weird behavior I can't 85 * understand. $session_cache[32341234123] will become $session_cache[0] 86 * for example. Usage warning: if the variable is too big to fit, or is 87 * old and discarded, you must provide alternative ways of accessing the data. 115 * understand. For example $cache["123"] will become $cache[0] 88 116 * 89 117 * @param str $key An identifier for the cached object. 90 * @param mixed $var 118 * @param mixed $var The var to store in the session cache. 91 119 * @param bool $flags If we have something really big that we 92 * still want to cache, setting this to 93 * CACHE_IGNORE_SIZE allows this. 94 * 95 * @return bool True on success, false otherwise. 120 * still want to cache, setting this to 121 * CACHE_ALLOW_OVERSIZED allows this. 122 * @return bool True on success, false otherwise. 96 123 */ 97 124 function set($key, $var, $flags=0) … … 99 126 $app =& App::getInstance(); 100 127 101 if ( !$this->getParam('enabled')) {128 if (true !== $this->getParam('enabled')) { 102 129 $app->logMsg(sprintf('Cache not enabled, not saving data.', null), LOG_DEBUG, __FILE__, __LINE__); 103 130 return false; … … 105 132 106 133 $key = md5($key); 107 $serialized_var = serialize($var); 108 $serialized_var_len = strlen($serialized_var); 109 110 if ($flags & CACHE_IGNORE_SIZE > 0 && $serialized_var_len >= $this->getParam('soft_limit')) { 111 $app->logMsg(sprintf('Serialized variable (%s bytes) more than soft_limit (%s bytes).', $serialized_var_len, $this->getParam('soft_limit')), LOG_NOTICE, __FILE__, __LINE__); 112 return false; 113 } 114 115 if ($serialized_var_len >= $this->getParam('hard_limit')) { 116 $app->logMsg(sprintf('Serialized variable (%s bytes) more than hard_limit (%s bytes).', $serialized_var_len, $this->getParam('hard_limit')), LOG_NOTICE, __FILE__, __LINE__); 117 return false; 118 } 119 120 if (!isset($_SESSION['_session_cache'])) { 121 $_SESSION['_session_cache'] = array(); 122 } else { 123 unset($_SESSION['_session_cache'][$key]); 124 // Continue to prune the cache if it's length is too long for the new variable to fit, but keep at least MIN_ITEMS at least. 125 while (strlen(serialize($_SESSION['_session_cache'])) + $serialized_var_len >= $this->getParam('soft_limit') 126 && sizeof($_SESSION['_session_cache']) >= $this->getParam('min_items')) { 127 array_shift($_SESSION['_session_cache']); 128 } 129 } 130 $_SESSION['_session_cache'][$key] =& $serialized_var; 131 132 if ($serialized_var_len >= 1024000) { 133 $app->logMsg(sprintf('Successfully cached oversized variable (%s bytes).', $serialized_var_len), LOG_DEBUG, __FILE__, __LINE__); 134 $var = serialize($var); 135 $var_len = strlen($var); 136 137 if ($var_len >= $this->getParam('item_size_limit')) { 138 $app->logMsg(sprintf('Serialized variable (%s bytes) more than item_size_limit (%s bytes).', $var_len, $this->getParam('item_size_limit')), LOG_NOTICE, __FILE__, __LINE__); 139 return false; 140 } 141 142 if ($flags & CACHE_ALLOW_OVERSIZED == 0 && $var_len >= $this->getParam('stack_size_limit')) { 143 $app->logMsg(sprintf('Serialized variable (%s bytes) more than stack_size_limit (%s bytes).', $var_len, $this->getParam('stack_size_limit')), LOG_NOTICE, __FILE__, __LINE__); 144 return false; 145 } 146 147 // Remove any value already stored under this key. 148 unset($_SESSION[$this->_ns][$key]); 149 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]); 153 } 154 155 // Save this value under the specified key. 156 $_SESSION[$this->_ns][$key] =& $var; 157 158 if ($var_len >= 1024000) { 159 $app->logMsg(sprintf('Successfully cached oversized variable (%s bytes).', $var_len), LOG_DEBUG, __FILE__, __LINE__); 134 160 } 135 161 … … 144 170 * 145 171 * @param string $key The key for the datum to retrieve. 146 *147 172 * @return mixed The requested datum, or false on failure. 148 173 */ 149 174 function get($key) 150 175 { 151 if ( !$this->getParam('enabled')) {152 return false; 153 } 154 155 $key = md5($key); 156 if (isset($_SESSION[ '_session_cache'][$key])) {176 if (true !== $this->getParam('enabled')) { 177 return false; 178 } 179 180 $key = md5($key); 181 if (isset($_SESSION[$this->_ns][$key])) { 157 182 // Move the accessed cached datum to the top of the stack. Maybe somebody knows a better way to do this? 158 $tmp =& $_SESSION[ '_session_cache'][$key];159 unset($_SESSION[ '_session_cache'][$key]);160 $_SESSION[ '_session_cache'][$key] =& $tmp;183 $tmp =& $_SESSION[$this->_ns][$key]; 184 unset($_SESSION[$this->_ns][$key]); 185 $_SESSION[$this->_ns][$key] =& $tmp; 161 186 // Return the unserialized datum. 162 return unserialize($_SESSION[ '_session_cache'][$key]);187 return unserialize($_SESSION[$this->_ns][$key]); 163 188 } else { 164 189 return false; … … 170 195 * 171 196 * @param string $key The key of the object to check. 172 *173 197 * @return bool The return from isset(). 174 198 */ 175 199 function exists($key) 176 200 { 177 if ( !$this->getParam('enabled')) {178 return false; 179 } 180 181 $key = md5($key); 182 return isset($_SESSION['_session_cache'][$key]);201 if (true !== $this->getParam('enabled')) { 202 return false; 203 } 204 205 $key = md5($key); 206 return array_key_exists($key, $_SESSION[$this->_ns]); 183 207 } 184 208 … … 187 211 * 188 212 * @param string $key The key of the object to check. 189 *190 213 * @return bool The return from isset(). 191 214 */ … … 193 216 { 194 217 $key = md5($key); 195 if (isset($_SESSION['_session_cache'][$key])) { 196 unset($_SESSION['_session_cache'][$key]); 197 } 218 unset($_SESSION[$this->_ns][$key]); 219 } 220 221 /* 222 * Delete all existing items from the cache. 223 * 224 * @access public 225 * @author Quinn Comendant <quinn@strangecode.com> 226 * @version 1.0 227 * @since 05 Jun 2006 23:51:34 228 */ 229 function clear() 230 { 231 $_SESSION[$this->_ns] = array(); 198 232 } 199 233 -
trunk/lib/ImageThumb.inc.php
r146 r152 9 9 */ 10 10 11 // Image resizeoptions.11 // Image proprtion options. 12 12 define('IMAGETHUMB_FIT_WIDTH', 1); 13 13 define('IMAGETHUMB_FIT_HEIGHT', 2); … … 15 15 define('IMAGETHUMB_STRETCH', 4); 16 16 define('IMAGETHUMB_NO_SCALE', 5); 17 18 // Image resize options. 17 19 define('IMAGETHUMB_METHOD_NETPBM', 6); 18 20 define('IMAGETHUMB_METHOD_GD', 7); … … 32 34 33 35 // Permissions of autocreated directories. Must be at least 0700 with owner=apache. 34 'dest_dir_perms' => 07 77,36 'dest_dir_perms' => 0700, 35 37 36 38 // Require file to have one of the following file name extentions. … … 50 52 51 53 // Default image size specs. 52 var $default_image_specs = array( 53 // The destination for an image thumbnail size. Path relative to source_dir (eg: ../thumbs). 54 var $_default_image_specs = array( 55 // The destination for an image thumbnail size. 56 // Use initial / to specify absolute paths, leave off to specify a path relative to source_dir (eg: ../thumbs). 54 57 'dest_dir' => null, 55 58 … … 85 88 86 89 // Final specifications for image sizes, set with setSpec(). 87 var $ image_specs = array();90 var $_image_specs = array(); 88 91 89 92 /** … … 99 102 if (isset($params) && is_array($params)) { 100 103 101 // Enforce valid upload_pathparameter.104 // Enforce valid source_dir parameter. 102 105 if (isset($params['source_dir'])) { 103 106 $params['source_dir'] = realpath($params['source_dir']); 104 // Must be directory.107 // Source must be directory. 105 108 if (!is_dir($params['source_dir'])) { 106 $app->logMsg(sprintf('Source directory invalid: %s', $params['source_dir']), LOG_ERR, __FILE__, __LINE__); 107 trigger_error(sprintf('Source directory invalid: %s', $params['source_dir']), E_USER_ERROR); 108 } 109 // Must be readable. 109 $app->logMsg(sprintf('Attempting to auto-create source directory: %s', $params['source_dir']), LOG_NOTICE, __FILE__, __LINE__); 110 if (phpversion() > '5') { 111 // Recursive. 112 mkdir($params['source_dir'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true); 113 } else { 114 mkdir($params['source_dir'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms')); 115 } 116 if (!is_dir($params['source_dir'])) { 117 $app->logMsg(sprintf('Source directory invalid: %s', $params['source_dir']), LOG_ERR, __FILE__, __LINE__); 118 trigger_error(sprintf('Source directory invalid: %s', $params['source_dir']), E_USER_ERROR); 119 } 120 } 121 // Source must be readable. 110 122 if (!is_readable($params['source_dir'])) { 111 123 $app->logMsg(sprintf('Source directory not readable: %s', $params['source_dir']), LOG_ERR, __FILE__, __LINE__); … … 151 163 152 164 // A little sanity checking. 153 if (!isset($spec['dest_dir']) || '' == $spec['dest_dir']) {165 if (!isset($spec['dest_dir']) || '' == trim($spec['dest_dir'])) { 154 166 $app->logMsg('setSpec error: dest_dir not specified.', LOG_ERR, __FILE__, __LINE__); 167 } else { 168 $spec['dest_dir'] = trim($spec['dest_dir']); 155 169 } 156 170 if (isset($spec['dest_file_type'])) { … … 198 212 } 199 213 200 if (isset($index) && isset($this->image_specs[$index])) { 201 // Merge with previous. 202 $final_spec = array_merge($this->image_specs[$index], $spec); 203 $this->image_specs[$index] = $final_spec; 214 // Add to _image_specs array. 215 if (isset($index) && isset($this->_image_specs[$index])) { 216 // Merge with existing spec if index is provided. 217 $final_spec = array_merge($this->_image_specs[$index], $spec); 218 $this->_image_specs[$index] = $final_spec; 204 219 } else { 205 // Merge with defaults.206 $final_spec = array_merge($this-> default_image_specs, $spec);207 $this-> image_specs[] = $final_spec;220 // Merge with spec defaults. 221 $final_spec = array_merge($this->_default_image_specs, $spec); 222 $this->_image_specs[] = $final_spec; 208 223 } 209 224 … … 245 260 return 0 === $return_val; 246 261 } else { 247 $app->logMsg(sprintf('No images found to thumbnail in directory %s.', $this->getParam('source_dir')), LOG_NOTICE, __FILE__, __LINE__);262 $app->logMsg(sprintf('No source images found in directory: %s', $this->getParam('source_dir')), LOG_NOTICE, __FILE__, __LINE__); 248 263 return false; 249 264 } … … 266 281 267 282 // Ensure we have a source. 268 if (sizeof($this-> image_specs) < 1) {283 if (sizeof($this->_image_specs) < 1) { 269 284 if (is_array($runtime_specs)) { 270 285 $this->setSpec($runtime_specs, 0); … … 284 299 if (!file_exists($source_file)) { 285 300 $this->_raiseMsg(sprintf(_("Image resizing failed: source image %s was not found."), $file_name), MSG_ERR, __FILE__, __LINE__); 286 $app->logMsg(sprintf('Source image not found: %s', $source_file), LOG_ ALERT, __FILE__, __LINE__);301 $app->logMsg(sprintf('Source image not found: %s', $source_file), LOG_WARNING, __FILE__, __LINE__); 287 302 return false; 288 303 } … … 291 306 if (!is_readable($source_file)) { 292 307 $this->_raiseMsg(sprintf(_("Image resizing failed: source image %s is not readable."), $file_name), MSG_ERR, __FILE__, __LINE__); 293 $app->logMsg(sprintf('Source image not readable: %s', $source_file), LOG_ ALERT, __FILE__, __LINE__);308 $app->logMsg(sprintf('Source image not readable: %s', $source_file), LOG_WARNING, __FILE__, __LINE__); 294 309 return false; 295 310 } … … 298 313 if (filesize($source_file) <= 0) { 299 314 $this->_raiseMsg(sprintf(_("Image resizing failed: source image %s is zero bytes."), $file_name), MSG_ERR, __FILE__, __LINE__); 300 $app->logMsg(sprintf('Source image is zero bytes: %s', $source_file), LOG_ ALERT, __FILE__, __LINE__);315 $app->logMsg(sprintf('Source image is zero bytes: %s', $source_file), LOG_WARNING, __FILE__, __LINE__); 301 316 return false; 302 317 } … … 310 325 311 326 // Ensure destination directories are created. This will only be called once per page load. 312 $this->_createDestDirs(); 327 if (!$this->_createDestDirs()) { 328 return false; 329 } 313 330 314 331 // To keep this script running even if user tries to stop browser. … … 320 337 $return_val = 0; 321 338 322 foreach ($this-> image_specs as $index => $spec) {339 foreach ($this->_image_specs as $index => $spec) { 323 340 324 341 if (is_array($runtime_specs)) { … … 328 345 329 346 // Destination filename uses the extention defined by dest_file_extention. 330 $dest_file = realpath(sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extention'])); 347 if ('/' == $spec['dest_dir']{0}) { 348 // Absolute path. 349 $dest_file = sprintf('%s/%s.%s', $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extention']); 350 } else { 351 // Relative path. 352 $dest_file = sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extention']); 353 } 354 355 // Ensure destination directory exists and is writable. 356 if (!is_dir(dirname($dest_file)) || !is_writable(dirname($dest_file))) { 357 $this->_createDestDirs($dest_file); 358 if (!is_dir(dirname($dest_file)) || !is_writable(dirname($dest_file))) { 359 $app->logMsg(sprintf('Image resizing failed, dest_dir invalid: %s', dirname($dest_file)), LOG_ERR, __FILE__, __LINE__); 360 $return_val++; 361 continue; 362 } 363 } 331 364 332 365 // Skip existing thumbnails with file size below $spec['keep_filesize']. … … 343 376 if ($image_size['0'] <= $spec['width'] && $image_size['1'] <= $spec['height'] && !$spec['allow_upscaling']) { 344 377 $spec['scaling_type'] = IMAGETHUMB_NO_SCALE; 345 $app->logMsg(sprintf('Image %s smaller than specified %s thumbnail size. Keeping original size.', $file_name, $spec['dest_dir']), LOG_DEBUG, __FILE__, __LINE__);378 $app->logMsg(sprintf('Image %s smaller than specified %s thumbnail size. Keeping original size.', $file_name, basename($spec['dest_dir'])), LOG_DEBUG, __FILE__, __LINE__); 346 379 } 347 380 … … 349 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'))) { 350 383 // Resize using Netpbm binaries. 351 $app->logMsg(sprintf('Resizing with Netpbm ...', null), LOG_DEBUG, __FILE__, __LINE__);384 $app->logMsg(sprintf('Resizing with Netpbm: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__); 352 385 $return_val += $this->_resizeWithNetpbm($source_file, $dest_file, $spec); 353 386 } else if (IMAGETHUMB_METHOD_GD === $this->getParam('resize_method') && extension_loaded('gd')) { 354 387 // Resize with GD. 355 $app->logMsg(sprintf('Resizing with GD ...', null), LOG_DEBUG, __FILE__, __LINE__);388 $app->logMsg(sprintf('Resizing with GD: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__); 356 389 $return_val += $this->_resizeWithGD($source_file, $dest_file, $spec); 357 390 } else { 358 $app->logMsg(sprintf('Image thumbnailing failed. Neither Netpbm or GD is available.', null), LOG_DEBUG, __FILE__, __LINE__);391 $app->logMsg(sprintf('Image thumbnailing canceled. Neither Netpbm or GD is available.', null), LOG_ERR, __FILE__, __LINE__); 359 392 return false; 360 393 } 361 394 } 362 395 363 // If > 0, there was a problem thumb -nailing.396 // If > 0, there was a problem thumbnailing. 364 397 return 0 === $return_val; 365 398 } … … 516 549 if (!imagecopyresampled($dest_image_resource, $source_image_resource, 0, 0, 0, 0, $dest_image_width, $dest_image_height, $source_image_width, $source_image_height)) { 517 550 $app->logMsg(sprintf('Error resampling image %s', $source_file), LOG_WARNING, __FILE__, __LINE__); 551 // Always cleanup images from memory. 552 imagedestroy($source_image_resource); 553 imagedestroy($dest_image_resource); 518 554 return 1; 519 555 } … … 543 579 default : 544 580 $app->logMsg(sprintf('Destination image type %s not supported for image %s.', $spec['dest_file_type'], $dest_file), LOG_WARNING, __FILE__, __LINE__); 581 // Always cleanup images from memory. 582 imagedestroy($source_image_resource); 583 imagedestroy($dest_image_resource); 545 584 return 1; 546 585 break; 547 586 } 587 588 // Always cleanup images from memory. 589 imagedestroy($source_image_resource); 590 imagedestroy($dest_image_resource); 548 591 549 592 if ($return_val) { 550 593 // Success! 551 594 // Make the thumbnail writable so the user can delete it over ftp without being 'apache'. 552 chmod($dest_file, $this->getParam('dest_file_perms')); 553 $app->logMsg(sprintf('Successfully resized image %s', $dest_file), LOG_DEBUG, __FILE__, __LINE__); 595 if (!chmod($dest_file, $this->getParam('dest_file_perms'))) { 596 $app->logMsg(sprintf('chmod failed on file: %s', $dest_file), LOG_ERR, __FILE__, __LINE__); 597 } 598 $app->logMsg(sprintf('Successfully resized image: %s', $dest_file), LOG_DEBUG, __FILE__, __LINE__); 554 599 return 0; 555 600 } else { 556 601 // An error occurred. 557 $app->logMsg(sprintf(' Image %s failed resizing.', $dest_file), LOG_ERR, __FILE__, __LINE__);602 $app->logMsg(sprintf('Failed resizing image: %s', $dest_file), LOG_ERR, __FILE__, __LINE__); 558 603 return 1; 559 604 } … … 578 623 579 624 $return_val = 0; 580 foreach ($this->image_specs as $spec) { 581 $dest_file = realpath(sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extention'])); 625 foreach ($this->_image_specs as $spec) { 626 if ('/' == $spec['dest_dir']{0}) { 627 // Absolute path. 628 $dest_file = realpath(sprintf('%s/%s.%s', $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extention'])); 629 } else { 630 // Relative path. 631 $dest_file = realpath(sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extention'])); 632 } 582 633 if (file_exists($dest_file)) { 583 634 if (!unlink($dest_file)) { … … 657 708 * @return bool true on success, false on failure. 658 709 */ 659 function _createDestDirs() 660 { 661 $app =& App::getInstance(); 662 663 static $already_checked = false; 664 665 if (!$already_checked) { 710 function _createDestDirs($filename=null) 711 { 712 $app =& App::getInstance(); 713 714 // Keep track of directories we've already created. 715 $dd_hash = md5(isset($filename) ? dirname($filename) : 'none'); 716 static $already_checked = array(); 717 718 $return_val = 0; 719 720 if (!isset($already_checked[$dd_hash])) { 666 721 // Ensure we have a source. 667 722 if ('' == $this->getParam('source_dir')) { … … 671 726 672 727 // Loop through specs and ensure all dirs are created. 673 $return_val = 0; 674 foreach ($this->image_specs as $spec) { 675 if (!file_exists($this->getParam('source_dir') . '/' . $spec['dest_dir'])) { 676 if (!mkdir($this->getParam('source_dir') . '/' . $spec['dest_dir'], $this->getParam('dest_dir_perms'))) { 677 $return_val++; 678 $app->logMsg(sprintf('mkdir failure: %s', $this->getParam('source_dir') . '/' . $spec['dest_dir']), LOG_ERR, __FILE__, __LINE__); 728 foreach ($this->_image_specs as $spec) { 729 if (isset($filename)) { 730 $dest_dir = dirname($filename); 731 } else { 732 if ('/' == $spec['dest_dir']{0}) { 733 // Absolute path. 734 $dest_dir = $spec['dest_dir']; 735 } else { 736 // Relative path. 737 $dest_dir = sprintf('%s/%s', $this->getParam('source_dir'), $spec['dest_dir']); 679 738 } 680 739 } 681 } 682 683 // If > 0, there was a problem creating dest dirs. 684 return 0 === $return_val; 685 } 686 687 $already_checked = true; 740 if (!file_exists($dest_dir)) { 741 if (phpversion() > '5' && false) { /// 742 // Recursive. 743 if (! ($ret = mkdir($dest_dir, $this->getParam('dest_dir_perms'), true))) { 744 $return_val++; 745 $app->logMsg(sprintf('mkdir failure: %s', $dest_dir), LOG_ERR, __FILE__, __LINE__); 746 } 747 } else { 748 // Recursive mkdir for php 4. 749 $path = ''; 750 foreach (array_diff(explode('/', $dest_dir), array('')) as $dir) { 751 $path .= '/' . $dir; 752 if (! ($ret = file_exists($path) ? true : mkdir($path, $this->getParam('dest_dir_perms')))) { 753 $return_val++; 754 $app->logMsg(sprintf('mkdir failure: %s', $path), LOG_ERR, __FILE__, __LINE__); 755 break; 756 } 757 } 758 } 759 760 if ($ret) { 761 $app->logMsg(sprintf('mkdir success: %s', $dest_dir), LOG_DEBUG, __FILE__, __LINE__); 762 } 763 } 764 } 765 } 766 767 $already_checked[$dd_hash] = true; 768 769 // If > 0, there was a problem creating dest dirs. 770 return 0 === $return_val; 688 771 } 689 772 -
trunk/lib/PageNumbers.inc.php
r136 r152 72 72 function setPerPage($per_page, $default=25, $save_value=true) 73 73 { 74 $prefs =& Prefs::getInstance(); 74 $prefs =& Prefs::getInstance($_SERVER['PHP_SELF']); 75 $prefs->setParam(array('persistent' => false)); 75 76 76 77 // (1) By provided argument, if valid. … … 81 82 $this->_per_page = $per_page; 82 83 if ($save_value) { 83 $prefs->set('items_per_page', $this->_per_page , $_SERVER['PHP_SELF']);84 } 85 } else if ($save_value && $prefs->exists('items_per_page' , $_SERVER['PHP_SELF'])) {86 $this->_per_page = (int)$prefs->get('items_per_page' , $_SERVER['PHP_SELF']);84 $prefs->set('items_per_page', $this->_per_page); 85 } 86 } else if ($save_value && $prefs->exists('items_per_page')) { 87 $this->_per_page = (int)$prefs->get('items_per_page'); 87 88 } else if (is_numeric($default) && $default > 0) { 88 89 $this->_per_page = $default; … … 96 97 function setPageNumber($page_number, $save_value=true) 97 98 { 98 $prefs =& Prefs::getInstance(); 99 $prefs =& Prefs::getInstance($_SERVER['PHP_SELF']); 100 $prefs->setParam(array('persistent' => false)); 99 101 100 // (1) By provided argument, if valid.102 // (1) By provided argument, if valid. 101 103 // (2) By saved preference, if available. 102 104 // (3) Don't change from what was provided at class instantiation. … … 109 111 } 110 112 if ($save_value) { 111 $prefs->set('page_number', $this->current_page , $_SERVER['PHP_SELF']);112 } 113 } else if ($save_value && $prefs->exists('page_number' , $_SERVER['PHP_SELF'])) {114 $this->current_page = (int)$prefs->get('page_number' , $_SERVER['PHP_SELF']);113 $prefs->set('page_number', $this->current_page); 114 } 115 } else if ($save_value && $prefs->exists('page_number')) { 116 $this->current_page = (int)$prefs->get('page_number'); 115 117 } 116 118 $this->set_page_number_initialized = true; -
trunk/lib/Prefs.inc.php
r151 r152 14 14 // Load preferences for the user's session. 15 15 require_once 'codebase/lib/Prefs.inc.php'; 16 $prefs = new Prefs('bURB');16 $prefs =& Prefs::getInstance('my-namespace'); 17 17 $prefs->setParam(array( 18 ' enable_db' => $auth->isLoggedIn(),18 'persistent' => $auth->isLoggedIn(), 19 19 'user_id' => $auth->get('user_id'), 20 20 )); … … 37 37 var $_ns; 38 38 39 // Configuration ofthis object.39 // Configuration parameters for this object. 40 40 var $_params = array( 41 41 42 // The current user_id for which to load/save preferences. 42 // Enable database storage. If this is false, all prefs will live only as long as the session. 43 'persistent' => false, 44 45 // The current user_id for which to load/save persistent preferences. 43 46 'user_id' => null, 44 47 45 // How long before we force a reload of the p refs data? 3600 = once every hour.48 // How long before we force a reload of the persistent prefs data? 3600 = once every hour. 46 49 'load_timeout' => 3600, 47 50 48 // Enable database storage. 49 'enable_db' => true, 50 51 // Name of database table to store prefs. 51 // Name of database table to store persistent prefs. 52 52 'db_table' => 'pref_tbl', 53 53 … … 74 74 $this->setParam(array('create_table' => $app->getParam('db_create_tables'))); 75 75 } 76 } 77 78 /** 79 * This method enforces the singleton pattern for this class. 80 * 81 * @return object Reference to the global Prefs object. 82 * @access public 83 * @static 84 */ 85 function &getInstance($namespace='') 86 { 87 static $instances = array(); 88 89 if (!array_key_exists($namespace, $instances)) { 90 $instances[$namespace] = new Prefs($namespace); 91 } 92 93 return $instances[$namespace]; 76 94 } 77 95 … … 167 185 * This function determins what data is saved to the database. Ensure clean values! 168 186 * 169 * @param string $key The name of the preference to modify. 170 * @param string $val The new value for this preference. 187 * @param string $key The name of the preference to modify. 188 * @param string $val The new value for this preference. 189 * @param bool $persistent Save this value forever? Set to false and value will exist as long as the session is in use. 171 190 */ 172 191 function set($key, $val) 173 192 { 174 193 $app =& App::getInstance(); 194 175 195 if ('' == $key) { 176 196 $app->logMsg(sprintf('Key is empty (provided with value: %s)', $val), LOG_NOTICE, __FILE__, __LINE__); 177 197 return false; 178 198 } 199 179 200 if (!isset($_SESSION[$this->_ns]['defaults'][$key]) || $_SESSION[$this->_ns]['defaults'][$key] != $val || isset($_SESSION[$this->_ns]['persistent'][$key])) { 180 201 $_SESSION[$this->_ns]['persistent'][$key] = $val; … … 193 214 { 194 215 $app =& App::getInstance(); 195 if ( isset($_SESSION[$this->_ns]['persistent'][$key])) {216 if (array_key_exists($key, $_SESSION[$this->_ns]['persistent'])) { 196 217 return $_SESSION[$this->_ns]['persistent'][$key]; 197 } else if ( isset($_SESSION[$this->_ns]['defaults'][$key])) {218 } else if (array_key_exists($key, $_SESSION[$this->_ns]['defaults'])) { 198 219 return $_SESSION[$this->_ns]['defaults'][$key]; 199 220 } else { 200 $app->logMsg(sprintf('Key not defined in default or persistentprefs cache: %s', $key), LOG_NOTICE, __FILE__, __LINE__);221 $app->logMsg(sprintf('Key not found in prefs cache: %s', $key), LOG_NOTICE, __FILE__, __LINE__); 201 222 return null; 202 223 } … … 204 225 205 226 /** 206 * To see if a p ersistent preference has been set.227 * To see if a preference has been set. 207 228 * 208 229 * @param string $key The name of the preference to check. … … 211 232 function exists($key) 212 233 { 213 return isset($_SESSION[$this->_ns]['persistent'][$key]);234 return array_key_exists($key, $_SESSION[$this->_ns]['persistent']); 214 235 } 215 236 … … 254 275 255 276 // Skip this method if not using the db. 256 if (true !== $this->getParam(' enable_db')) {277 if (true !== $this->getParam('persistent')) { 257 278 return true; 258 279 } … … 332 353 333 354 // Skip this method if not using the db. 334 if (true !== $this->getParam(' enable_db')) {355 if (true !== $this->getParam('persistent')) { 335 356 return true; 336 357 } -
trunk/lib/SortOrder.inc.php
r136 r152 69 69 function setDefault($default_sort = '', $default_order = '') 70 70 { 71 $prefs =& Prefs::getInstance(); 71 $prefs =& Prefs::getInstance($_SERVER['PHP_SELF']); 72 $prefs->setParam(array('persistent' => false)); 72 73 73 74 // Which column to sort by? … … 78 79 if (!empty($new_sort_by)) { 79 80 $this->sort_by = $new_sort_by; 80 $prefs->set('sort_by', $this->sort_by , $_SERVER['PHP_SELF']);81 } else if ($prefs->exists('sort_by' , $_SERVER['PHP_SELF'])) {82 $this->sort_by = $prefs->get('sort_by' , $_SERVER['PHP_SELF']);81 $prefs->set('sort_by', $this->sort_by); 82 } else if ($prefs->exists('sort_by')) { 83 $this->sort_by = $prefs->get('sort_by'); 83 84 } else { 84 85 $this->sort_by = $default_sort; … … 92 93 if (!empty($new_order)) { 93 94 $this->order = $new_order; 94 $prefs->set('sort_order', $this->order , $_SERVER['PHP_SELF']);95 } else if ($prefs->exists('sort_order' , $_SERVER['PHP_SELF'])) {96 $this->order = $prefs->get('sort_order' , $_SERVER['PHP_SELF']);95 $prefs->set('sort_order', $this->order); 96 } else if ($prefs->exists('sort_order')) { 97 $this->order = $prefs->get('sort_order'); 97 98 } else { 98 99 $this->order = $default_order; … … 111 112 function set($sort = null, $order = null) 112 113 { 113 $prefs =& Prefs::getInstance(); 114 $prefs =& Prefs::getInstance($_SERVER['PHP_SELF']); 115 $prefs->setParam(array('persistent' => false)); 114 116 115 117 // Set new sort value. 116 118 if (isset($sort)) { 117 119 $this->sort_by = $sort; 118 $prefs->set('sort_by', $this->sort_by , $_SERVER['PHP_SELF']);120 $prefs->set('sort_by', $this->sort_by); 119 121 } 120 122 … … 122 124 if (isset($order)) { 123 125 $this->order = $order; 124 $prefs->set('sort_order', $this->order , $_SERVER['PHP_SELF']);126 $prefs->set('sort_order', $this->order); 125 127 } 126 128 } -
trunk/lib/Upload.inc.php
r146 r152 63 63 if (isset($params['upload_path'])) { 64 64 $params['upload_path'] = realpath($params['upload_path']); 65 // Must be directory.65 // Source must be directory. 66 66 if (!is_dir($params['upload_path'])) { 67 67 $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $params['upload_path']), LOG_NOTICE, __FILE__, __LINE__); 68 mkdir($params['upload_path'], $this->getParam('dest_dir_perms')); 68 if (phpversion() > '5') { 69 // Recursive. 70 mkdir($params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true); 71 } else { 72 mkdir($params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms')); 73 } 69 74 if (!is_dir($params['upload_path'])) { 70 75 $app->logMsg(sprintf('Upload directory invalid: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); … … 72 77 } 73 78 } 74 // Must be writable.79 // Source must be writable. 75 80 if (!is_writable($params['upload_path'])) { 76 81 $app->logMsg(sprintf('Upload directory not writable: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); -
trunk/services/admins.php
r147 r152 30 30 $fv = new FormValidator(); 31 31 32 $cache =& Cache::getInstance(); 32 // Configure the prefs object. 33 $prefs =& Prefs::getInstance('admins'); 34 $prefs->setParam(array('persistent' => false)); 35 36 // Configure the cache object. 37 $cache =& Cache::getInstance('admins'); 38 $cache->setParam(array('enable' => true)); 33 39 34 40 // Instantiate a sorting object with the default sort and order. Add SQL for each column. … … 70 76 71 77 if (getFormData('break_list_cache', false)) { 72 // Break the cache because we are changing thelist data.73 $cache->delete( $_SERVER['PHP_SELF']);78 // Remove any stale cached list data. 79 $cache->delete('list'); 74 80 } 75 81 … … 319 325 $app =& App::getInstance(); 320 326 $db =& DB::getInstance(); 321 $cache =& Cache::getInstance( );327 $cache =& Cache::getInstance('admins'); 322 328 323 329 $lock->select('admin_tbl', 'admin_id', $id); … … 326 332 } 327 333 328 // Break the cache because we are changing thelist data.329 $cache->delete( $_SERVER['PHP_SELF']);334 // Remove any stale cached list data. 335 $cache->delete('list'); 330 336 331 337 // Get the information for this object. … … 367 373 $app =& App::getInstance(); 368 374 $db =& DB::getInstance(); 369 $cache =& Cache::getInstance( );375 $cache =& Cache::getInstance('admins'); 370 376 371 // Break the cache because we are changing thelist data.372 $cache->delete( $_SERVER['PHP_SELF']);377 // Remove any stale cached list data. 378 $cache->delete('list'); 373 379 374 380 // Insert record data. … … 411 417 $app =& App::getInstance(); 412 418 $db =& DB::getInstance(); 413 $cache =& Cache::getInstance( );419 $cache =& Cache::getInstance('admins'); 414 420 415 421 $lock->select('admin_tbl', 'admin_id', $frm['admin_id']); … … 418 424 } 419 425 420 // Break the cache because we are changing thelist data.421 $cache->delete( $_SERVER['PHP_SELF']);426 // Remove any stale cached list data. 427 $cache->delete('list'); 422 428 423 429 // If the userpass is left blank or with the filler **** characters, we don't want to update it. … … 455 461 global $so; 456 462 $db =& DB::getInstance(); 457 $prefs =& Prefs::getInstance( );458 $cache =& Cache::getInstance( );463 $prefs =& Prefs::getInstance('admins'); 464 $cache =& Cache::getInstance('admins'); 459 465 460 466 $where_clause = ''; … … 501 507 "; 502 508 509 // Use a cash hash to determine if the result-set has changed. 503 510 // A unique key for this query, with the total_items in case db records 504 511 // were added since the last cache. This identifies a unique set of … … 507 514 // without knowing the hash. 508 515 $cache_hash = md5($sql . '|' . $page->total_items); 509 if ($prefs->get('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) { 510 $cache->delete($_SERVER['PHP_SELF']); 511 $prefs->set('cache_hash', $cache_hash, $_SERVER['PHP_SELF']); 512 } 513 514 if ($cache->exists($_SERVER['PHP_SELF']) && false) { 515 // Get the cached results. 516 $list = $cache->get($_SERVER['PHP_SELF']); 517 } else { 518 // If the list is not already cached, query now. 519 $qid = $db->query($sql); 520 // Fill an array with the items for this page. 521 while ($row = mysql_fetch_assoc($qid)) { 522 $list[] = $row; 523 } 524 525 if (isset($list) && !empty($list)) { 526 // Cache the results. 527 $cache->set($list, $_SERVER['PHP_SELF']); 528 } 516 if ($prefs->get('cache_hash') != $cache_hash) { 517 $cache->delete('list'); 518 $prefs->set('cache_hash', $cache_hash); 519 } 520 521 // First try to return from the cache. 522 if ($cache->exists('list')) { 523 return $cache->get('list'); 524 } 525 526 // The list was not cached, so issue the real query. 527 $qid = $db->query($sql); 528 while ($row = mysql_fetch_assoc($qid)) { 529 $list[] = $row; 530 } 531 532 // Save this list into the cache. 533 if (isset($list) && !empty($list)) { 534 $cache->set('list', $list); 529 535 } 530 536 -
trunk/services/logs.php
r143 r152 39 39 40 40 // Set the defaults and catch incoming settings. 41 $prefs =& Prefs::getInstance(); 42 $prefs->setDefault('log_file', $app->getParam('log_filename'), 'logs_module'); 43 $prefs->set('log_file', getFormData('log'), 'logs_module'); 41 $prefs =& Prefs::getInstance('admin_logs'); 42 $prefs->setDefaults(array( 43 'log_file' => $app->getParam('log_filename') 44 )); 45 $prefs->set('log_file', getFormData('log')); 44 46 45 47 // Titles and navigation header. 46 $nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), $prefs->get('log_file' , 'logs_module')), '/admin/logs.php');48 $nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), $prefs->get('log_file')), '/admin/logs.php'); 47 49 48 50 /******************************************************************** … … 57 59 case 'delete' : 58 60 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 59 deleteLog($prefs->get('log_file' , 'logs_module'));60 $prefs->set('log_file', $app->getParam('log_filename') , 'logs_module');61 deleteLog($prefs->get('log_file')); 62 $prefs->set('log_file', $app->getParam('log_filename')); 61 63 if ($app->validBoomerangURL('app_log')) { 62 64 // Display boomerang page. … … 69 71 case 'clear' : 70 72 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 71 clearLog($prefs->get('log_file' , 'logs_module'));73 clearLog($prefs->get('log_file')); 72 74 if ($app->validBoomerangURL('app_log')) { 73 75 // Display boomerang page. … … 80 82 case 'archive' : 81 83 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 82 if (archiveLog($prefs->get('log_file' , 'logs_module'))) {84 if (archiveLog($prefs->get('log_file'))) { 83 85 // Now flush current log. 84 86 $app->dieURL($_SERVER['PHP_SELF'] . '?op=clear'); … … 98 100 case 'download' : 99 101 header('Content-Type: application/octet-stream'); 100 header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->get('log_file' , 'logs_module')));101 printLog($prefs->get('log_file' , 'logs_module'));102 header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->get('log_file'))); 103 printLog($prefs->get('log_file')); 102 104 die; 103 105 break; 104 106 105 107 default : 106 $list =& getLog($prefs->get('log_file' , 'logs_module'), getFormData('search_query'));108 $list =& getLog($prefs->get('log_file'), getFormData('search_query')); 107 109 $main_template = 'log_list.ihtml'; 108 110 break; … … 126 128 include 'header.ihtml'; 127 129 if ('output' == $main_template) { 128 printLog($prefs->get('log_file' , 'logs_module'));130 printLog($prefs->get('log_file')); 129 131 } else { 130 132 include 'codebase/services/templates/' . $main_template; -
trunk/services/templates/log_list.ihtml
r136 r152 10 10 <tr class="commandtext"> 11 11 <td> 12 <?php if ($l['filename'] == $prefs->get('log_file' , 'logs_module')) { ?>12 <?php if ($l['filename'] == $prefs->get('log_file')) { ?> 13 13 <span class="commanditem"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></span> 14 14 <?php } else { ?>
Note: See TracChangeset
for help on using the changeset viewer.