Changeset 817


Ignore:
Timestamp:
Aug 20, 2024 4:21:17 AM (4 weeks ago)
Author:
anonymous
Message:

Minor fixes. Set default cache expiration to 900 seconds (15 minutes).

Location:
trunk/lib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Cache.inc.php

    r638 r817  
    6363        // How long in seconds before items in the cache are considered expired.
    6464        // When the cache expires, Cache->get() returns null.
    65         'expires' => 3600,
     65        'expires' => 900,
    6666    );
    6767
  • trunk/lib/ImageThumb.inc.php

    r775 r817  
    252252    *
    253253    * @access   public
    254     * @param    string  $key    Key to return. See _default_image_specs above for a list.
    255     * @param    int     $index  The index in the spec array of the value to retrieve. The first if not specified.
    256     * @return   mixed           Value of requested index.
     254    * @param    string  $key        Key to return. See _default_image_specs above for a list.
     255    * @param    int     $index      The index in the spec array of the value to retrieve. The first if not specified.
     256    * @param    string  $dest_dir   Return the spec matching this dest_dir (if used, the provided $index is ignored).
     257    * @return   mixed               Value of requested $key for the spec selected by $index or $dest_dir.
    257258    * @author   Quinn Comendant <quinn@strangecode.com>
    258259    * @version  1.0
    259260    * @since    08 May 2007 15:26:39
    260261    */
    261     public function getSpec($key, $index=null)
     262    public function getSpec($key, $index=null, $dest_dir=null)
    262263    {
    263264        $index = isset($index) ? $index : 0;
     265        if (isset($dest_dir)) {
     266            $index = array_search($dest_dir, array_column($this->_image_specs, 'dest_dir'));
     267        }
    264268        return $this->_image_specs[$index][$key];
    265269    }
  • trunk/lib/PageNumbers.inc.php

    r812 r817  
    9595    private function _validNumber($num)
    9696    {
    97         if (!isset($num) || '' == $num) {
     97        if (!isset($num) || '' === $num) {
    9898            return false;
    9999        }
  • trunk/lib/Prefs.inc.php

    r784 r817  
    311311            return false;
    312312        }
    313         if ('' == trim($key)) {
    314             $app->logMsg(sprintf('Key is empty (along with value: %s)', $val), LOG_NOTICE, __FILE__, __LINE__);
     313        if ('' === trim($key)) {
     314            $app->logMsg(sprintf('Key is empty (val=%s)', $val), LOG_NOTICE, __FILE__, __LINE__);
    315315            return false;
    316316        }
     
    529529
    530530        // User_id must not be empty.
    531         if ('' == $this->getParam('user_id')) {
     531        if ('' === $this->getParam('user_id')) {
    532532            $app->logMsg(sprintf('Cannot load prefs because user_id not set.', null), LOG_WARNING, __FILE__, __LINE__);
    533533            return false;
     
    603603
    604604        // User_id must not be empty.
    605         if ('' == $this->getParam('user_id')) {
     605        if ('' === $this->getParam('user_id')) {
    606606            $app->logMsg(sprintf('Cannot save prefs because user_id not set.', null), LOG_DEBUG, __FILE__, __LINE__);
    607607            return false;
  • trunk/lib/Upload.inc.php

    r806 r817  
    182182            $file_path_name = '';
    183183
    184             if ('' == trim($files['name'][$i])) {
     184            if ('' === trim($files['name'][$i])) {
    185185                // User may not have attached a file.
    186186                $app->logMsg(sprintf('Skipping file %s with empty name', $i), LOG_DEBUG, __FILE__, __LINE__);
  • trunk/lib/Utilities.inc.php

    r816 r817  
    253253    $app =& App::getInstance();
    254254
    255     if ('' == $text) {
     255    if ('' === $text) {
    256256        return '';
    257257    }
     
    999999            // If the prefix is empty, use the $key as the name of the first dimension of the "array".
    10001000            // ...otherwise, append the key as a new dimension of the "array".
    1001             $new_prefix = ('' == $prefix) ? urlencode($key) : $prefix . '[' . urlencode($key) . ']';
     1001            $new_prefix = ('' === $prefix) ? urlencode($key) : $prefix . '[' . urlencode($key) . ']';
    10021002            // Enter recursion.
    10031003            urlEncodeArray($val, $new_prefix, false);
     
    13901390    $app =& App::getInstance();
    13911391
    1392     if ('' == trim($val)) {
     1392    if ('' === trim($val)) {
    13931393        $app->logMsg(sprintf('Cannot add signature to an empty string.', null), LOG_INFO, __FILE__, __LINE__);
    13941394        return '';
     
    14391439    // Strip the value from the signed value.
    14401440    $val = removeSignature($signed_val);
    1441     if ('' == $val) {
     1441    if ('' === $val) {
    14421442        // Removing the signature failed because it was empty or did not contain a hyphen.
    14431443        $app->logMsg(sprintf('Invalid signature ("%s" is not a valid signed value).', $signed_val), LOG_DEBUG, __FILE__, __LINE__);
     
    15931593function ipInRange($addr, $networks)
    15941594{
    1595     if (null == $addr || '' == trim($addr)) {
     1595    if (null == $addr || '' === trim($addr)) {
    15961596        return false;
    15971597    }
  • trunk/lib/Validator.inc.php

    r807 r817  
    107107    {
    108108        $app =& App::getInstance();
    109         if ('' == trim((string)$val) || is_string($val)) {
     109        if ('' === trim((string)$val) || is_string($val)) {
    110110            return true;
    111111        } else {
     
    127127    {
    128128        $app =& App::getInstance();
    129         if ('' == trim((string)$val) || is_numeric($val)) {
     129        if ('' === trim((string)$val) || is_numeric($val)) {
    130130            return true;
    131131        } else {
     
    149149        $app =& App::getInstance();
    150150        $pattern = $negative_ok ? '/^-?[[:digit:]]+$/' : '/^[[:digit:]]+$/';
    151         if ('' == trim((string)$val) || (is_numeric($val) && preg_match($pattern, $val))) {
     151        if ('' === trim((string)$val) || (is_numeric($val) && preg_match($pattern, $val))) {
    152152            return true;
    153153        } else {
     
    173173        $app =& App::getInstance();
    174174        $pattern = $negative_ok ? '/^-?[[:digit:]]*(?:\.?[[:digit:]]+)$/' : '/^[[:digit:]]*(?:\.?[[:digit:]]+)$/';
    175         if ('' == trim((string)$val) || (is_numeric($val) && preg_match($pattern, $val))) {
     175        if ('' === trim((string)$val) || (is_numeric($val) && preg_match($pattern, $val))) {
    176176            return true;
    177177        } else {
     
    198198    {
    199199        $app =& App::getInstance();
    200         if ('' == trim((string)$val)) {
     200        if ('' === trim((string)$val)) {
    201201            return true;
    202202        }
     
    229229    {
    230230        $app =& App::getInstance();
    231         if ((is_string($val) && '' == trim((string)$val)) || is_array($val)) {
     231        if ((is_string($val) && '' === trim((string)$val)) || is_array($val)) {
    232232            return true;
    233233        } else {
     
    296296    {
    297297        $app =& App::getInstance();
    298         if ('' == trim((string)$val) || (is_numeric($val) && $val >= $min && $val <= $max)) {
     298        if ('' === trim((string)$val) || (is_numeric($val) && $val >= $min && $val <= $max)) {
    299299            return true;
    300300        } else {
     
    535535        if (is_array($_FILES[$form_name]['name'])) {
    536536            foreach($_FILES[$form_name]['name'] as $f) {
    537                 if ('' == $f) {
     537                if ('' === $f) {
    538538                    $app->logMsg(sprintf('%s (line %s) failed: %s', __METHOD__, __LINE__, getDump($_FILES)), $type, $file, $line);
    539539                    return false;
     
    541541            }
    542542        } else {
    543             if ('' == $_FILES[$form_name]['name']) {
     543            if ('' === $_FILES[$form_name]['name']) {
    544544                $app->logMsg(sprintf('%s (line %s) failed: %s', __METHOD__, __LINE__, getDump($_FILES)), $type, $file, $line);
    545545                return false;
Note: See TracChangeset for help on using the changeset viewer.