A bit of UX improvement to upgrade UI; updated readme for 1.1.4
authorDan
Tue, 10 Jun 2008 00:21:34 -0400
changeset 568 3700f7124c2b
parent 567 7f196509bf78
child 569 6ba792bc9071
A bit of UX improvement to upgrade UI; updated readme for 1.1.4
README
includes/clientside/jsres.php
includes/clientside/static/acl.js
includes/clientside/static/l10n.js
includes/plugins.php
includes/sessions.php
install/images/css/installer.css
install/images/icons/pimp.png
install/index.php
install/upgrade.php
language/english/install.json
themes/oxygen/header.tpl
--- a/README	Mon Jun 09 20:52:34 2008 -0400
+++ b/README	Tue Jun 10 00:21:34 2008 -0400
@@ -1,5 +1,5 @@
 Enano CMS
-Version 1.1.3
+Version 1.1.4
 -----------------------------
 
 Thanks for downloading Enano! If you're looking for an installation guide,
@@ -44,28 +44,25 @@
 from other projects that are also released under Free licenses; see the various
 files under the licenses/ directory included with this release for details.
 
-If you are planning to make a commercial fork of Enano, all of the software and
-libraries included with Enano are available under licenses that allow you to do
-so; however, in compliance with the GPL, you must:
+Please be reminded that if you create a commercial fork of Enano, that while
+all of the components included with Enano are licensed in such a way that you
+are allowed to do so, you must make the project in its entirety available under
+the GNU General Public License, notwithstanding licenses for specific
+components of Enano named in /licenses/index.html and in various source code
+files.
 
-a) provide attribution to the Enano team in source code files and on the
-   (renamed) Special:About_Enano page,
-b) remove all instances of the word Enano and the Enano logo from your
-   derivative work, with the exception of the following phrase, which must
-   be shown on the (renamed) Special:About_Enano page:
+We also ask that if you fork Enano, you provide attribution to the Enano team
+by including the following notice on the (renamed) Special:About_Enano page:
 
-    "The software used on this website was based on Enano CMS. Copyright
-     (C) 2006-2007 Dan Fuhry."
+  "This software is based on Enano CMS, copyright (C) 2006-2008 Dan Fuhry."
 
-   The words "Enano CMS" must link to the page <http://enanocms.org/>. You may
-   (at your option) also include a notice of non-endorsement by the Enano
-   Foundation, unless you're lucky enough to become an official fork
-   maintainer.
-
-c) Provide the complete source code for your modified version of Enano under
-   the terms of the GNU General Public License, and
-d) Include the complete and unmodified licenses/ directory, which contains
-   licensing information for third-party libraries that Enano uses.
+While you have no legal obligation to do so, we ask that any forks of Enano
+be renamed so that they do not contain the word "Enano" anywhere in the
+product name. This is for identity and support reasons - users may get
+confused as to which one is the "real" Enano CMS. We also strongly recommend
+that you include a notice of non-endorsement from Dan Fuhry and the Enano
+Foundation and a disclaimer of liability for damages incurred through the use
+of the software.
 
 As permitted by the GPL, you may charge for the service of downloading Enano
 from your server; however, you may not prevent others from distributing Enano
@@ -74,7 +71,7 @@
 CHANGES IN THIS RELEASE
 -----------------------------
 
-Please see <http://enanocms.org/Release_notes/1.1.3> for a list of changes in
+Please see <http://enanocms.org/Release_notes/1.1.4> for a list of changes in
 this release.
 
 UPGRADING FROM PREVIOUS RELEASES
--- a/includes/clientside/jsres.php	Mon Jun 09 20:52:34 2008 -0400
+++ b/includes/clientside/jsres.php	Tue Jun 10 00:21:34 2008 -0400
@@ -102,6 +102,35 @@
 header('Content-type: text/javascript');
 $everything = '';
 
+// if we only want the tiny version of the API (just enough to get by until the full one is loaded), send that
+// with a simple ETag and far future expires header
+if ( isset($_GET['early']) )
+{
+  header('ETag: enanocms-lib-early-r1');
+  header('Expires: Wed, 1 Jan 2020 00:00:00 GMT');
+  
+  echo <<<JSEOF
+var onload_hooks = new Array();
+
+function addOnloadHook(func)
+{
+  if ( typeof ( func ) == 'function' )
+  {
+    if ( typeof(onload_hooks.push) == 'function' )
+    {
+      onload_hooks.push(func);
+    }
+    else
+    {
+      onload_hooks[onload_hooks.length] = func;
+    }
+  }
+}
+JSEOF;
+  
+  exit();
+}
+
 // Load and parse enano_lib_basic
 $file = @file_get_contents('includes/clientside/static/enano-lib-basic.js');
 
--- a/includes/clientside/static/acl.js	Mon Jun 09 20:52:34 2008 -0400
+++ b/includes/clientside/static/acl.js	Tue Jun 10 00:21:34 2008 -0400
@@ -5,6 +5,10 @@
 var aclDataCache = false;
 
 // Can be set to true by slow themes (St. Patty)
+if ( typeof(pref_disable_js_fx) != 'boolean' )
+{
+  var pref_disable_js_fx = false;
+}
 var aclDisableTransitionFX = ( is_firefox2 || pref_disable_js_fx ) ? true : false;
 
 function ajaxOpenACLManager(page_id, namespace)
--- a/includes/clientside/static/l10n.js	Mon Jun 09 20:52:34 2008 -0400
+++ b/includes/clientside/static/l10n.js	Tue Jun 10 00:21:34 2008 -0400
@@ -71,7 +71,7 @@
 {
   if ( window.console )
   {
-    window.console.info('Delaying language init by 0.2s because language_onload decided that enano_lang[ENANO_LANG_ID] isn\'t ready');
+    // window.console.info('Delaying language init by 0.2s because language_onload decided that enano_lang[ENANO_LANG_ID] isn\'t ready');
   }
   setTimeout('language_onload();', 200);
 }
--- a/includes/plugins.php	Mon Jun 09 20:52:34 2008 -0400
+++ b/includes/plugins.php	Tue Jun 10 00:21:34 2008 -0400
@@ -64,6 +64,14 @@
   function loadAll() 
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    
+    // if we're in an upgrade, just skip this step
+    if ( defined('IN_ENANO_UPGRADE') )
+    {
+      $this->load_list = array();
+      return false;
+    }
+    
     $dir = ENANO_ROOT.'/plugins/';
     
     $this->load_list = $this->system_plugins;
--- a/includes/sessions.php	Mon Jun 09 20:52:34 2008 -0400
+++ b/includes/sessions.php	Tue Jun 10 00:21:34 2008 -0400
@@ -513,7 +513,7 @@
         $this->real_name =     $userdata['real_name'];
         $this->email =         $userdata['email'];
         $this->unread_pms =    $userdata['num_pms'];
-        $this->user_title =    $userdata['user_title'];
+        $this->user_title =    ( isset($userdata['user_title']) ) ? $userdata['user_title'] : null;
         if(!$this->compat)
         {
           $this->theme =         $userdata['theme'];
@@ -1075,7 +1075,7 @@
         $this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary) VALUES(\'security\', \'auth_bad\', '.time().', \''.enano_date('d M Y h:i a').'\', \''.$db->escape($username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\')');
         
       // Do we also need to increment the lockout countdown?
-      if ( $policy != 'disable' && !defined('IN_ENANO_INSTALL') )
+      if ( !defined('IN_ENANO_INSTALL') && $policy != 'disable' )
       {
         $ipaddr = $db->escape($_SERVER['REMOTE_ADDR']);
         // increment fail count
@@ -1326,7 +1326,7 @@
       $fail = true;
       if ( defined('IN_ENANO_UPGRADE') )
       {
-        if ( installer_enano_version() == '1.1.3' && substr($ip, 0, 10) == substr($row['source_ip'], 0, 10) )
+        if ( substr($ip, 0, 10) == substr($row['source_ip'], 0, 10) )
           $fail = false;
       }
       // Failed IP address check
--- a/install/images/css/installer.css	Mon Jun 09 20:52:34 2008 -0400
+++ b/install/images/css/installer.css	Tue Jun 10 00:21:34 2008 -0400
@@ -124,7 +124,7 @@
   border-color: #D0D0D0;
   -moz-border-radius: 5px;
 }
-a.icon {
+a.icon, span.icon {
   display: block;
   font-size: 18pt;
   line-height: 48px;
@@ -134,22 +134,22 @@
   color: #002266;
   text-decoration: none !important;
 }
-a.icon:hover {
+a.icon:hover, span.icon:hover {
   cursor: pointer;
   color: #002266 !important;
   background-color: #F0F0F0;
 }
-a.icon-disabled {
+a.icon-disabled, span.icon-disabled {
   color: #808080 !important;
   opacity: 0.7;
   filter: alpha(opacity=70);
 }
-a.icon-disabled:hover {
+a.icon-disabled:hover, span.icon-disabled:hover {
   color: #808080 !important;
   background-color: #FCFCFC;
   border-color: #F8F8F8;
 }
-a.icon small, a.icon-disabled small {
+a.icon small, a.icon-disabled small, span.icon small, span.icon-disabled small {
   display: block;
   font-size: 8pt;
   line-height: normal;
@@ -167,7 +167,7 @@
 a.upgrade {
   background-image: url(../icons/upgrade.png);
 }
-a.upgrade-disabled {
+a.upgrade-disabled, span.upgrade-disabled {
   background-image: url(../icons/upgrade-disabled.png);
 }
 
@@ -204,14 +204,14 @@
   border-width: 1px;
   border-style: solid;
 }
-input[type ^="submit"] {
+input[type ^="submit"], button.submit {
   background-color: #4F729A;
   color: #FFFFFF;
   border-width: 1px;
   border-style: solid;
   border-color: #1F426A #7FA2CA #7FA2CA #1F426A;
 }
-input[type ^="submit"]:hover, input[type ^="submit"]:focus {
+input[type ^="submit"]:hover, input[type ^="submit"]:focus, button.submit:hover, button.submit:focus {
   background-color: #5f82aa;
 }
 input[type ^="text"], input[type ^="password"] {
Binary file install/images/icons/pimp.png has changed
--- a/install/index.php	Mon Jun 09 20:52:34 2008 -0400
+++ b/install/index.php	Tue Jun 10 00:21:34 2008 -0400
@@ -36,6 +36,9 @@
   require('includes/common.php');
 }
 
+// are we in PHP5?
+define('HAVE_PHP5', version_compare(PHP_VERSION, '5.0.0', '>='));
+
 ?>
 
           <div id="installnotice">
@@ -112,7 +115,18 @@
                   }
                   else
                   {
-                    echo '<li><a href="upgrade.php" class="upgrade icon">Upgrade</a></li>';
+                    if ( HAVE_PHP5 && !isset($_GET['debug_warn_php4']) )
+                      echo '<li><a href="upgrade.php" class="upgrade icon">Upgrade</a></li>';
+                    else
+                      echo '<li>
+                    <span class="upgrade-disabled icon icon-disabled">
+                      Upgrade
+                      <small>
+                        Your server doesn\'t have PHP 5 or later installed. Enano 1.2 does not have support for PHP 4.
+                        <a href="install.php?debug_warn_php4">Learn more &raquo;</a>
+                      </small> <!-- CSS takes care of making this position properly -->
+                    </span>
+                  </li>';
                   }
                   endif;
                   ?>
--- a/install/upgrade.php	Mon Jun 09 20:52:34 2008 -0400
+++ b/install/upgrade.php	Tue Jun 10 00:21:34 2008 -0400
@@ -33,59 +33,27 @@
 require_once('includes/libenanoinstall.php');
 
 // when the installer's common is loaded, it runs chdir() to the ENANO_ROOT, thus making this Enano's common.php
+// PHP5 notice removed in 1.1.4 since the existing common is loaded and that loads lang and json2, which will
+// give syntax errors on PHP4. So much for that. The installer will warn about this anyway.
 require_once('includes/common.php');
 @ini_set('display_errors', 'on');
 
 $ui = new Enano_Installer_UI('Enano upgrader', false);
-if ( version_compare(PHP_VERSION, '5.0.0', '<') )
-{
-  $ui->__construct('Enano upgrader', false);
-}
+
 $stg_welcome = $ui->add_stage('Welcome', true);
 $stg_confirm = $ui->add_stage('Confirmation', true);
 $stg_upgrade = $ui->add_stage('Perform upgrade', true);
 $stg_finish  = $ui->add_stage('Finish', true);
-$stg_php4 = $ui->add_stage('PHP4 compatibility notice', false);
 
-if ( version_compare(PHP_VERSION, '5.0.0', '<') || isset($_GET['debug_warn_php4']) )
-{
-  $ui->set_visible_stage($stg_php4);
-  $ui->step = '';
-  
-  $ui->show_header();
-  
-  // This isn't localized because all localization code is dependent on
-  // PHP 5 (loading lang.php will throw a parser error under PHP4). This
-  // one message probably doesn't need to be localized anyway.
-  
-  ?>
-  <h2 class="heading-error">
-    Your server doesn't have support for PHP 5.
-  </h2>
-  <p>
-    PHP 5 is the latest version of the language on which Enano was built. Its many new features have been available since early 2004, yet
-    many web hosts have not migrated to it because of the work involved. In 2007, Zend Corporation announced that support for the aging
-    PHP 4.x would be discontinued at the end of the year. An initiative called <a href="http://gophp5.org/">GoPHP5</a> was started to
-    encourage web hosts to migrate to PHP 5.
-  </p>
-  <p>
-    Because of the industry's decision to not support PHP 4 any longer, the Enano team decided that it was time to begin using the powerful
-    features of PHP 5 at the expense of PHP 4 compatibility. Therefore, this version of Enano cannot be installed on your server until it
-    is upgraded to at least PHP 5.0.0, and preferably the latest available version.
-    <!-- No, not even removing the check in this installer script will help. As soon as the PHP4 check is passed, the installer shows the
-         language selection page, after which the language code is loaded. The language code and libjson2 will trigger parse errors under
-         PHP <5.0.0. -->
-  </p>
-  <p>
-    If you need to use Enano but can't upgrade your PHP because you're on a shared or reseller hosting service, you can use the
-    <a href="http://enanocms.org/download?series=1.0">1.0.x series of Enano</a> on your site. While the Enano team attempts to make this
-    older series work on PHP 4, official support is not provided for installations of Enano on PHP 4.
-  </p>
-  <?php
-  
-  $ui->show_footer();
-  exit(0);
-}
+// init languages
+$lang_id_list = array_keys($languages);
+$lang_id = $lang_id_list[0];
+$language_dir = $languages[$lang_id]['dir'];
+
+// load the language file
+$lang = new Language($lang_id);
+$lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/install.json');
+$lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/user.json');
 
 // Version check
 if ( enano_version() == installer_enano_version() )
@@ -106,35 +74,57 @@
     {
       $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_MEMBER);
     }
-    $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_ADMIN);
-    if ( $result['success'] )
+    if ( !isset($result) || ( isset($result) && $result['success']) )
     {
-      header('HTTP/1.1 302 Some kind of redirect with implied no content');
-      header('Location: ' . scriptPath . '/install/' . $session->append_sid('upgrade.php'));
-      exit();
+      $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_ADMIN);
+      if ( $result['success'] )
+      {
+        header('HTTP/1.1 302 Some kind of redirect with implied no content');
+        header('Location: ' . scriptPath . '/install/' . $session->append_sid('upgrade.php'));
+        exit();
+      }
     }
   }
   
   $ui->show_header();
   
   ?>
-  <h3>Authentication needed</h3>
+  <h3><?php echo $lang->get('upgrade_login_msg_auth_needed_title'); ?></h3>
   <?php
   
   echo '<form action="upgrade.php" method="post">';
   
   if ( isset($result) )
   {
-    echo '<b>Session manager returned error:</b>' . '<pre>' . print_r($result, true) . '</pre>';
+    echo '<b>' . $lang->get('upgrade_login_err_failed', array('error_code' => $result['error'])) . '</b>';
   }
   
   ?>
-  <p>You need <?php if ( !$session->user_logged_in ) echo 'to be logged in and have '; ?>an active admin session to continue.</p>
-  <p>
-    Username:&nbsp;&nbsp;&nbsp;<input type="text" name="username" /><br />
-    Password:&nbsp;&nbsp;&nbsp;<input type="password" name="password" /><br />
-    <input type="submit" name="do_login" value="Log in" />
-  </p>
+  <p><?php
+  if ( $session->user_logged_in )
+  {
+    echo $lang->get('upgrade_login_msg_auth_needed_body_level2');
+  }
+  else
+  {
+    echo $lang->get('upgrade_login_msg_auth_needed_body_level1');
+  }
+  ?></p>
+  <table border="0" cellspacing="0" cellpadding="5" style="margin: 0 auto;">
+  <tr>
+    <td><?php echo $lang->get('user_login_field_username'); ?>:</td>
+    <td><input type="text" name="username" tabindex="1" /></td>
+  </tr>
+  <tr>
+    <td><?php echo $lang->get('user_login_field_password'); ?>:</td>
+    <td><input type="password" name="password" tabindex="2" /></td>
+  </tr>
+  <tr>
+    <td colspan="2" style="text-align: center;">
+      <input type="submit" name="do_login" value="<?php echo $lang->get('upgrade_login_btn_login'); ?>" tabindex="3" />
+    </td>
+  </tr>
+  </table>
   <?php
   
   echo '</form>';
@@ -213,7 +203,19 @@
 else
 {
   ?>
-  <p>Nothing's really implemented for now except the actual migration code, which is not very smart. Just <a href="<?php echo $session->append_sid('upgrade.php?stage=pimpmyenano'); ?>">do the upgrade and get it over with</a>.</p>
+  <h3><?php echo $lang->get('upgrade_confirm_title'); ?></h3>
+  <p><?php echo $lang->get('upgrade_confirm_body', array('enano_version' => installer_enano_version())); ?></p>
+  <ul>
+    <li><?php echo $lang->get('upgrade_confirm_objective_backup_fs', array('dir' => ENANO_ROOT)); ?></li>
+    <li><?php echo $lang->get('upgrade_confirm_objective_backup_db', array('dbname' => $dbname)); ?></li>
+  </ul>
+  <form method="get" action="upgrade.php" style="text-align: center;">
+    <input type="hidden" name="auth" value="<?php echo $session->sid_super; ?>" />
+    <button name="stage" value="pimpmyenano" class="submit">
+      <img src="images/icons/pimp.png" />
+      <?php echo $lang->get('upgrade_confirm_btn_upgrade'); ?>
+    </button>
+  </form>
   <?php
 }
 
--- a/language/english/install.json	Mon Jun 09 20:52:34 2008 -0400
+++ b/language/english/install.json	Tue Jun 10 00:21:34 2008 -0400
@@ -15,7 +15,7 @@
 
 var enano_lang_install = {
   categories: [
-    'meta', 'language', 'welcome', 'license', 'sysreqs', 'database', 'dbmysql', 'dbpgsql', 'website', 'login', 'confirm', 'install', 'finish', 'pophelp',
+    'meta', 'language', 'welcome', 'license', 'sysreqs', 'database', 'dbmysql', 'dbpgsql', 'website', 'login', 'confirm', 'install', 'finish', 'pophelp', 'upgrade'
   ],
   strings: {
     meta: {
@@ -360,6 +360,19 @@
                             With this scheme, URLs at your site will look like <tt>http://yoursite.com/path-to-enano/Main_Page</tt>.</p>
                             </p>',
       btn_close_window: 'Close window',
+    },
+    upgrade: {
+      login_msg_auth_needed_title: 'Authentication needed',
+      login_msg_auth_needed_body_level1: 'To continue, you need to log in. Please enter an administrator username and password below.',
+      login_msg_auth_needed_body_level2: 'To confirm the upgrade, you need to re-enter your login information. Please enter your username and password below.',
+      login_btn_login: 'Log in',
+      login_err_failed: 'The following error occurred during the login process: %error_code%.',
+      
+      confirm_title: 'Confirm upgrade',
+      confirm_body: 'You are about to upgrade to Enano version <b>%enano_version%</b>. You should make sure that you\'ve done the following before you continue:',
+      confirm_objective_backup_fs: 'Back up Enano installation directory (<b>%dir%</b>)',
+      confirm_objective_backup_db: 'Back up Enano database, including non-Enano tables if any (<b>%dbname%</b>)',
+      confirm_btn_upgrade: 'Pimp my Enano!',
     }
   }
 }
--- a/themes/oxygen/header.tpl	Mon Jun 09 20:52:34 2008 -0400
+++ b/themes/oxygen/header.tpl	Tue Jun 10 00:21:34 2008 -0400
@@ -7,6 +7,9 @@
     <link id="mdgCss" rel="stylesheet" href="{SCRIPTPATH}/themes/{THEME_ID}/css/{STYLE_ID}.css" type="text/css" />
     {JS_DYNAMIC_VARS}
     
+    <!-- Only load a basic set of functions for now. Let the rest of the API load when the page is finished. -->
+    <script type="text/javascript" src="{SCRIPTPATH}/includes/clientside/jsres.php?early"></script>
+    
     <script type="text/javascript">
       var tinymce_skin = 'o2k7';
     </script>