Changeset 220


Ignore:
Timestamp:
Dec 18, 2006 7:18:55 AM (17 years ago)
Author:
quinn
Message:

Q - fixed bug relating to strtotime usage.

Location:
tags/2.0.2/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tags/2.0.2/lib/FormValidator.inc.php

    r106 r220  
    491491    function validateStrDate($form_name, $msg='')
    492492    {
    493         if (($timestamp = strtotime(getFormData($form_name, '0'))) === -1) {
     493        $timestamp = strtotime(getFormData($form_name, '0'));
     494        if ($timestamp === -1 || $timestamp === false) {
    494495            $this->addError($form_name, $msg);
    495496            App::logMsg(sprintf('The string date %s is not valid.', getFormData($form_name)), LOG_DEBUG, __FILE__, __LINE__);
  • tags/2.0.2/lib/Upload.inc.php

    r118 r220  
    6060            // Enforce valid upload_path parameter.
    6161            if (isset($params['upload_path'])) {
    62                 $params['upload_path'] = realpath($params['upload_path']);
     62                // $params['upload_path'] = realpath($params['upload_path']);
     63                $params['upload_path'] = $params['upload_path'];
    6364                // Must be directory.
    6465                if (!is_dir($params['upload_path'])) {
  • tags/2.0.2/lib/Utilities.inc.php

    r193 r220  
    494494{
    495495    // Translate the human string date into SQL-safe date format.
    496     if (empty($date) || '0000-00-00' == $date || strtotime($date) === -1) {
    497         $sql_date = '0000-00-00';
    498     } else {
    499         $sql_date = date($format, strtotime($date));
    500     }
    501 
    502     return $sql_date;
     496    if (empty($date) || strpos($date, '0000-00-00') !== false || strtotime($date) === -1 || strtotime($date) === false) {
     497        return '0000-00-00';
     498    } else {
     499        return date($format, strtotime($date));
     500    }
    503501}
    504502
Note: See TracChangeset for help on using the changeset viewer.