Changeset 1762

Show
Ignore:
Timestamp:
09/30/2008 04:25:12 PM (2 months ago)
Author:
driehle
Message:

Bugfix #199

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/scripts/settings.class.php

    r1761 r1762  
    467467    // no quotes for bolean and numbers 
    468468    $no_quotes = array ( 
    469       'jlog_clean_url'
    470       'jlog_max_blog_orginal'
    471       'jlog_max_blog_big'
    472       'jlog_max_blog_small'
    473       'jlog_sub_current'
    474       'jlog_start_year'
    475       'jlog_info_by_comment' 
     469      'jlog_clean_url' => 'bool'
     470      'jlog_max_blog_orginal' => 'int'
     471      'jlog_max_blog_big' => 'int'
     472      'jlog_max_blog_small' => 'int'
     473      'jlog_sub_current' => 'int'
     474      'jlog_start_year' => 'int'
     475      'jlog_info_by_comment' => 'bool' 
    476476    ); 
    477477 
     
    480480 
    481481    foreach($this->d as $key => $value) { 
    482       $key = strtoupper($key); 
    483482      $output = ''; 
    484       if(!in_array($key, $no_quotes)) { 
     483      if(isset($no_quotes[$key])) { 
    485484        // boolean values 
    486         if($key == 'JLOG_CLEAN_URL' OR $key == 'JLOG_INFO_BY_COMMENT') { 
     485        if($no_quotes[$key] == 'bool') { 
    487486          if($value == 'true' OR $value === true) $output = 'true'; 
    488487          else $output = 'false'; 
     
    497496        $output = '"' . $this->escapeForPhp($value) . '"'; 
    498497      } 
    499       $file_content .= 'define("' . $key . '", ' . $output . ');' . PHP_EOL; 
     498      $file_content .= 'define(\'' . $key . '\', \'' . $output . '\');' . PHP_EOL; 
    500499    } 
    501500 
     
    513512   * escapeForPhp() 
    514513   *  
    515    * escapes $value so that it can be used between double quotes in a 
    516    * PHP script    
     514   * escapes $value so that it can be used between single quotes in a 
     515   * PHP script, single quotes are better than double qoutes, as therein no 
     516   * further substituions are performed    
    517517   * 
    518518   * @access public 
     
    521521   */ 
    522522  function escapeForPhp($value) { 
    523     $value = str_replace("\0", '\0', $value); 
    524     $value = str_replace("\r", '\r', $value); 
    525     $value = str_replace("\n", '\n', $value); 
    526     $value = str_replace('"',  '\"', $value); 
     523    $value = str_replace('\\', '\\\\', $value); 
     524    $value = str_replace("\0", '', $value); 
     525    $value = str_replace("\r", "'.chr(13).'", $value); 
     526    $value = str_replace("\n", "'.chr(10).'", $value); 
     527    $value = str_replace("'",  "\'", $value); 
    527528    return $value; 
    528529  } 
  • trunk/scripts/update/102To110.php

    r1741 r1762  
    3737            // read current settings from environment and POSTed data 
    3838            $update = new Settings($l); 
    39             $update->get_data(); 
    40             $update->get_userdata(); 
     39            $update->getDataByConstants(); 
    4140    
    4241            // convert all settings to utf8