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

Dirk Haun dhaun at qs1489.pair.com
Sun Apr 20 04:26:52 EDT 2008


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

Modified Files:
	index.php 
Log Message:
Set the language used during the install as the site's default language.


Index: index.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/admin/install/index.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** index.php	21 Mar 2008 16:11:13 -0000	1.35
--- index.php	20 Apr 2008 08:26:50 -0000	1.36
***************
*** 519,522 ****
--- 519,528 ----
                              $config->set_default('default_photo', urldecode($site_url) . '/default.jpg');
  
+                             $charset = ''; // TBD: needs to be set ...
+                             $lng = INST_getDefaultLanguage($gl_path . 'language/', $language, $charset);
+                             if (!empty($lng)) {
+                                 $config->set('language', $lng);
+                             }
+ 
                              // Now we're done with the installation so redirect the user to success.php
                              header('Location: success.php?type=install&language=' . $language);
***************
*** 882,885 ****
--- 888,921 ----
          }
      }
+ }
+ 
+ /**
+ * Derive site's default language from available information
+ *
+ * @param    string  $langpath   path where the language files are kept
+ * @param    string  $language   language used in the install script
+ * @param    string  $charset    character set: UTF-8 or something else
+ * @return   string              name of default language (for the config)
+ *
+ */
+ function INST_getDefaultLanguage($langpath, $language, $charset = '')
+ {
+     if (strcasecmp('UTF-8', $charset) == 0) {
+         $lngname = $language . '_' . strtolower($charset);
+     } else {
+         $lngname = $language;
+     }
+     $lngfile = $lngname . '.php';
+ 
+     if (!file_exists($langpath . $lngfile)) {
+         // doesn't exist - fall back to English
+         if (strcasecmp('UTF-8', $charset) == 0) {
+             $lngname = 'english_' . strtolower($charset);
+         } else {
+             $lngname = 'english';
+         }
+     }
+ 
+     return $lngname;
  }
  




More information about the geeklog-cvs mailing list