Localized default sidebar; installer should work now including the lang import; l10n in installer to follow
authorDan
Tue, 06 Nov 2007 13:35:40 -0500
changeset 240 f0149a27df5f
parent 239 0f1b353570a7
child 241 c671f3bb8aed
Localized default sidebar; installer should work now including the lang import; l10n in installer to follow
includes/pageutils.php
install.php
schema.sql
--- a/includes/pageutils.php	Tue Nov 06 11:10:18 2007 -0500
+++ b/includes/pageutils.php	Tue Nov 06 13:35:40 2007 -0500
@@ -1413,6 +1413,11 @@
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
     global $lang;
+    if ( !is_object($lang) && defined('IN_ENANO_INSTALL') )
+    {
+      // This is a special exception for the Enano installer, which doesn't init languages yet.
+      $lang = new Language('eng');
+    }
     if(!$session->get_permissions('clear_logs'))
     {
       return $lang->get('etc_access_denied');
--- a/install.php	Tue Nov 06 11:10:18 2007 -0500
+++ b/install.php	Tue Nov 06 13:35:40 2007 -0500
@@ -27,6 +27,9 @@
 define('ENANO_VERSION', '1.1.1');
 // In beta versions, define ENANO_BETA_VERSION here
 
+// This is required to make installation work right
+define("ENANO_ALLOW_LOAD_NOLANG", 1);
+
 if(!defined('scriptPath')) {
   $sp = dirname($_SERVER['REQUEST_URI']);
   if($sp == '/' || $sp == '\\') $sp = '';
@@ -119,20 +122,22 @@
 function start_install_table()
 {
   echo '<table border="0" cellspacing="0" cellpadding="0">' . "\n";
+  ob_start();
 }
 
 function close_install_table()
 {
   echo '</table>' . "\n\n";
+  ob_end_flush();
 }
 
 function echo_stage_success($stage_id, $stage_name)
 {
   global $neutral_color;
   $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A';
-  ob_start();
   echo '<tr><td style="width: 500px; background-color: #' . "{$neutral_color}{$neutral_color}FF{$neutral_color}{$neutral_color}" . '; padding: 0 5px;">' . htmlspecialchars($stage_name) . '</td><td style="padding: 0 5px;"><img alt="Done" src="images/good.gif" /></td></tr>' . "\n";
-  ob_end_flush();
+  ob_flush();
+  flush();
 }
 
 function echo_stage_failure($stage_id, $stage_name, $failure_explanation, $resume_stack)
@@ -140,9 +145,9 @@
   global $neutral_color;
   
   $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A';
-  ob_start();
   echo '<tr><td style="width: 500px; background-color: #' . "FF{$neutral_color}{$neutral_color}{$neutral_color}{$neutral_color}" . '; padding: 0 5px;">' . htmlspecialchars($stage_name) . '</td><td style="padding: 0 5px;"><img alt="Failed" src="images/bad.gif" /></td></tr>' . "\n";
-  ob_end_flush();
+  ob_flush();
+  flush();
   close_install_table();
   $post_data = '';
   $mysql_error = mysql_error();
@@ -574,6 +579,19 @@
   return false;
 }
 
+function stg_import_language()
+{
+  global $db, $session, $paths, $template, $plugins; // Common objects
+  
+  $lang_file = ENANO_ROOT . "/language/english/enano.json";
+  install_language("eng", "English", "English", $lang_file);
+  
+  $lang = new Language('eng');
+  $lang->import($lang_file);
+  
+  return true;
+}
+
 function stg_init_logs()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
@@ -1572,6 +1590,8 @@
       $session->start();
       $paths->init();
       
+      run_installer_stage('importlang', 'Import default language', 'stg_import_language', 'Enano couldn\'t import the English language file.');
+      
       run_installer_stage('initlogs', 'Initialize logs', 'stg_init_logs', '<b>The session manager denied the request to flush logs for the main page.</b><br />
                            While under most circumstances you can still <a href="install.php?mode=finish">finish the installation</a>, you should be aware that some servers cannot
                            properly set cookies due to limitations with PHP. These limitations are exposed primarily when this issue is encountered during installation. If you choose
--- a/schema.sql	Tue Nov 06 11:10:18 2007 -0500
+++ b/schema.sql	Tue Nov 06 13:35:40 2007 -0500
@@ -338,13 +338,14 @@
 
 INSERT INTO {{TABLE_PREFIX}}group_members(group_id,user_id,is_mod) VALUES(2, 2, 1);
 
-INSERT INTO {{TABLE_PREFIX}}acl(target_type,target_id,page_id,namespace,rules) VALUES(1,2,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=4;clear_logs=4;vote_delete=4;vote_reset=4;delete_page=4;tag_create=4;tag_delete_own=4;tag_delete_other=4;set_wiki_mode=4;password_set=4;password_reset=4;mod_misc=4;edit_cat=4;even_when_protected=4;upload_files=4;upload_new_version=4;create_page=4;php_in_pages={{ADMIN_EMBED_PHP}};edit_acl=4;'),
+INSERT INTO {{TABLE_PREFIX}}acl(target_type,target_id,page_id,namespace,rules) VALUES
+  (1,2,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=4;clear_logs=4;vote_delete=4;vote_reset=4;delete_page=4;tag_create=4;tag_delete_own=4;tag_delete_other=4;set_wiki_mode=4;password_set=4;password_reset=4;mod_misc=4;edit_cat=4;even_when_protected=4;upload_files=4;upload_new_version=4;create_page=4;php_in_pages={{ADMIN_EMBED_PHP}};edit_acl=4;'),
   (1,3,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=3;clear_logs=2;vote_delete=4;vote_reset=4;delete_page=4;set_wiki_mode=2;password_set=2;password_reset=2;mod_misc=2;edit_cat=4;even_when_protected=4;upload_files=2;upload_new_version=3;create_page=3;php_in_pages=2;edit_acl=2;');
 
 INSERT INTO {{TABLE_PREFIX}}sidebar(item_id, item_order, sidebar_id, block_name, block_type, block_content) VALUES
-  (1, 1, 1, 'Navigation', 1, '[[Main Page|Home]]'),
-  (2, 2, 1, 'Tools', 1, '[[$NS_SPECIAL$CreatePage|Create a page]]\n[[$NS_SPECIAL$UploadFile|Upload file]]\n[[$NS_SPECIAL$SpecialPages|Special pages]]\n{if auth_admin}\n[[$NS_SPECIAL$EditSidebar|Edit the sidebar]]\n$ADMIN_LINK$\n{/if}'),
-  (3, 3, 1, '$USERNAME$', 1, '[[$NS_USER$$USERNAME$|User page]]\n[[$NS_SPECIAL$Contributions/$USERNAME$|My Contributions]]\n{if user_logged_in}\n[[$NS_SPECIAL$Preferences|Preferences]]\n[[$NS_SPECIAL$PrivateMessages|Private messages]]\n[[$NS_SPECIAL$Usergroups|Group control panel]]\n$THEME_LINK$\n{/if}\n{if user_logged_in}\n$LOGOUT_LINK$\n{else}\n[[$NS_SPECIAL$Register|Create an account]]\n$LOGIN_LINK$\n[[$NS_SPECIAL$Login/$NS_SPECIAL$PrivateMessages|Private messages]]\n{/if}'),
-  (4, 4, 1, 'Search', 1, '<div class="slideblock2" style="padding: 0px;"><form action="$CONTENTPATH$$NS_SPECIAL$Search" method="get" style="padding: 0; margin: 0;"><p><input type="hidden" name="title" value="$NS_SPECIAL$Search" />$INPUT_AUTH$<input name="q" alt="Search box" type="text" size="10" style="width: 70%" /> <input type="submit" value="Go" style="width: 20%" /></p></form></div>'),
-  (5, 2, 2, 'Links', 4, 'Links');
+  (1, 1, 1, '{lang:sidebar_title_navigation}', 1, '{lang:sidebar_btn_home}'),
+  (2, 2, 1, '{lang:sidebar_title_tools}', 1, '[[$NS_SPECIAL$CreatePage|{lang:sidebar_btn_createpage}]]\n[[$NS_SPECIAL$UploadFile|{lang:sidebar_btn_uploadfile}]]\n[[$NS_SPECIAL$SpecialPages|{lang:sidebar_btn_specialpages}]]\n{if auth_admin}\n$ADMIN_LINK$\n[[$NS_SPECIAL$EditSidebar|{lang:sidebar_btn_editsidebar}]]\n{/if}'),
+  (3, 3, 1, '$USERNAME$', 1, '[[$NS_USER$$USERNAME$|{lang:sidebar_btn_userpage}]]\n[[$NS_SPECIAL$Contributions/$USERNAME$|{lang:sidebar_btn_mycontribs}]]\n{if user_logged_in}\n[[$NS_SPECIAL$Preferences|{lang:sidebar_btn_preferences}]]\n[[$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n[[$NS_SPECIAL$Usergroups|{lang:sidebar_btn_groupcp}]]\n$THEME_LINK$\n{/if}\n{if user_logged_in}\n$LOGOUT_LINK$\n{else}\n[[$NS_SPECIAL$Register|{lang:sidebar_btn_register}]]\n$LOGIN_LINK$\n[[$NS_SPECIAL$Login/$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n{/if}'),
+  (4, 4, 1, '{lang:sidebar_title_search}', 1, '<div class="slideblock2" style="padding: 0px;"><form action="$CONTENTPATH$$NS_SPECIAL$Search" method="get" style="padding: 0; margin: 0;"><p><input type="hidden" name="title" value="$NS_SPECIAL$Search" />$INPUT_AUTH$<input name="q" alt="Search box" type="text" size="10" style="width: 70%" /> <input type="submit" value="{lang:sidebar_btn_search_go}" style="width: 20%" /></p></form></div>'),
+  (5, 2, 2, '{lang:sidebar_title_links}', 4, 'Links');