[geeklog-cvs] Geeklog-1.x/public_html/admin/install index.php, 1.38, 1.39

Dirk Haun dhaun at qs1489.pair.com
Thu May 1 09:23:30 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/public_html/admin/install
In directory qs1489.pair.com:/tmp/cvs-serv93479

Modified Files:
	index.php 
Log Message:
Handle $_CONF['default_charset'] for upgrades


Index: index.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/admin/install/index.php,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** index.php	1 May 2008 09:52:56 -0000	1.38
--- index.php	1 May 2008 13:23:28 -0000	1.39
***************
*** 334,340 ****
  
                          // for the default charset, patch siteconfig.php again
!                         if (!INST_setDefaultCharset($siteconfig_path, $utf8)) {
!                             exit($LANG_INSTALL[26] . ' ' . $siteconfig_path
!                                  . $LANG_INSTALL[58]);
                          }
  
--- 334,343 ----
  
                          // for the default charset, patch siteconfig.php again
!                         if ($install_type != 'upgrade') {
!                             if (!INST_setDefaultCharset($siteconfig_path,
!                                     ($utf8 ? 'utf-8' : $LANG_CHARSET))) {
!                                 exit($LANG_INSTALL[26] . ' ' . $siteconfig_path
!                                      . $LANG_INSTALL[58]);
!                             }
                          }
  
***************
*** 628,633 ****
  
  /**
!  * Check to see if config.php and lib-common.php are writeable by the web
!  * server. If they aren't display a warning message.
   *
   * @param   array   $files              list of files to check
--- 631,635 ----
  
  /**
!  * Check to see if required files are writeable by the web server.
   *
   * @param   array   $files              list of files to check
***************
*** 639,643 ****
      $writable = true;
      foreach ($files as $file) {
!         if (!$tmp_file = @fopen ($file, 'a')) {
              // Unable to modify
              $writable = false;
--- 641,645 ----
      $writable = true;
      foreach ($files as $file) {
!         if (!$tmp_file = @fopen($file, 'a')) {
              // Unable to modify
              $writable = false;
***************
*** 1362,1365 ****
--- 1364,1374 ----
                      $config->set($key, $val);
                  }
+ 
+                 if (!INST_setDefaultCharset($siteconfig_path,
+                                             $_CONF['default_charset'])) {
+                     exit($LANG_INSTALL[26] . ' ' . $siteconfig_path
+                          . $LANG_INSTALL[58]);
+                 }
+ 
                  require $siteconfig_path;
                  require $dbconfig_path;
***************
*** 1500,1512 ****
  *
  * @param   string   $siteconfig_path  complete path to siteconfig.php
! * @param   boolen   $utf8             true: use UTF-8
  * @return  boolean                    true: success; false: an error occured
  * @note    Yes, this means that we need to patch siteconfig.php a second time.
  *
  */
! function INST_setDefaultCharset($siteconfig_path, $utf8 = false)
  {
-     global $LANG_CHARSET;
- 
      $result = true;
  
--- 1509,1519 ----
  *
  * @param   string   $siteconfig_path  complete path to siteconfig.php
! * @param   string   $charset          default character set to use
  * @return  boolean                    true: success; false: an error occured
  * @note    Yes, this means that we need to patch siteconfig.php a second time.
  *
  */
! function INST_setDefaultCharset($siteconfig_path, $charset)
  {
      $result = true;
  
***************
*** 1515,1529 ****
      fclose($siteconfig_file);
  
!     if ($utf8) {
!         $new_charset = 'utf-8';
!     } else {
!         $new_charset = $LANG_CHARSET;
!     }
! 
!     require_once $siteconfig_path;
! 
!     $siteconfig_data = str_replace("\$_CONF['default_charset'] = '{$_CONF['default_charset']}';",
!                                    "\$_CONF['default_charset'] = '{$new_charset}';",
!                                    $siteconfig_data);
  
      $siteconfig_file = fopen($siteconfig_path, 'w');
--- 1522,1531 ----
      fclose($siteconfig_file);
  
!     $siteconfig_data = preg_replace
!             (
!              '/\$_CONF\[\'default_charset\'\] = \'[^\']*\';/',
!              "\$_CONF['default_charset'] = '" . $charset . "';",
!              $siteconfig_data
!             );
  
      $siteconfig_file = fopen($siteconfig_path, 'w');




More information about the geeklog-cvs mailing list