Merged WINDOWS_MOD_REWRITE_WORKAROUNDS changes from stable.
authorDan
Sun, 21 Dec 2008 06:22:17 -0500
changeset 771 5e85d7db8ee5
parent 770 62fed244fa1c
child 772 fe9364353f90
Merged WINDOWS_MOD_REWRITE_WORKAROUNDS changes from stable.
includes/constants.php
includes/paths.php
install/includes/stages/website.php
language/english/install.json
--- a/includes/constants.php	Sun Dec 21 04:26:56 2008 -0500
+++ b/includes/constants.php	Sun Dec 21 06:22:17 2008 -0500
@@ -143,6 +143,8 @@
 define('SEARCH_RESULTS_PER_PAGE', 10);
 define('MYSQL_MAX_PACKET_SIZE', 1048576); // 1MB; this is the default in MySQL 4.x I think
 define('ENANO_SUPPORT_AVATARS', 1);
+// don't change this next line in upstream (it has to be auto-patched by the dynamic download script)
+// define('WINDOWS_MOD_REWRITE_WORKAROUNDS', '');
 
 // Sidebar
 
--- a/includes/paths.php	Sun Dec 21 04:26:56 2008 -0500
+++ b/includes/paths.php	Sun Dec 21 06:22:17 2008 -0500
@@ -38,18 +38,19 @@
     
     // DEFINE NAMESPACES HERE
     // The key names should NOT EVER be changed, or Enano will be very broken
+    $namespace_delimiter = ( defined('WINDOWS_MOD_REWRITE_WORKAROUNDS') ) ? '.' : ':';
     $this->nslist = Array(
-      'Article' =>'',
-      'User'    =>'User:',
-      'File'    =>'File:',
-      'Help'    =>'Help:',
-      'Admin'   =>'Admin:',
-      'Special' =>'Special:',
-      'System'  =>'Enano:',
-      'Template'=>'Template:',
-      'Category'=>'Category:',
-      'API'=>'SystemAPI:',
-      'Project' =>sanitize_page_id(getConfig('site_name')).':',
+      'Article'  => '',
+      'User'     => 'User' . $namespace_delimiter,
+      'File'     => 'File' . $namespace_delimiter,
+      'Help'     => 'Help' . $namespace_delimiter,
+      'Admin'    => 'Admin' . $namespace_delimiter,
+      'Special'  => 'Special' . $namespace_delimiter,
+      'System'   => 'Enano' . $namespace_delimiter,
+      'Template' => 'Template' . $namespace_delimiter,
+      'Category' => 'Category' . $namespace_delimiter,
+      'API'      => 'SystemAPI' . $namespace_delimiter,
+      'Project'  => sanitize_page_id(getConfig('site_name')) . $namespace_delimiter,
       );
     
     // ACL types
--- a/install/includes/stages/website.php	Sun Dec 21 04:26:56 2008 -0500
+++ b/install/includes/stages/website.php	Sun Dec 21 06:22:17 2008 -0500
@@ -147,8 +147,34 @@
   $scriptpath_full = 'http' . ( $https ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'] . scriptPath . '/';
   ?>
   
+  <?php
+  $patch_necessary = ( strtolower(PHP_OS) == 'win32' && substr(@$_SERVER['SERVER_SOFTWARE'], 'Apache/2.2') );
+  if ( defined('WINDOWS_MOD_REWRITE_WORKAROUNDS') )
+  {
+    ?>
+      <div class="usermessage">
+        <b><?php echo $lang->get('website_msg_modwrite_enabled'); ?></b><br />
+        <?php if ( $patch_necessary ): ?>
+          <?php echo $lang->get('website_msg_modrewrite_necessary'); ?>
+        <?php else: ?>
+          <?php echo $lang->get('website_msg_modrewrite_unnecessary'); ?>
+        <?php endif; ?>
+      </div>
+    <?php
+  }
+  else
+  {
+    if ( $patch_necessary ):
+    ?>
+      <div class="usermessage">
+        <b><?php echo $lang->get('website_msg_modwrite_disabled'); ?></b><br />
+        <?php echo $lang->get('website_msg_modrewrite_maybeneeded'); ?>
+    <?php
+    endif;
+  }
+  ?>
+  
   <table border="0" cellspacing="0" cellpadding="10">
-  
     <tr>
       <td>
         <b><?php echo $lang->get('website_field_name'); ?></b><br />
--- a/language/english/install.json	Sun Dec 21 04:26:56 2008 -0500
+++ b/language/english/install.json	Sun Dec 21 06:22:17 2008 -0500
@@ -216,6 +216,11 @@
       msg_bestmethod_rewrite: 'The installer has detected that using rewritten URLs is the best level that will work.',
       msg_bestmethod_shortened: 'The installer has detected that using shortened URLs is the best level that will work.',
       msg_bestmethod_standard: 'The installer has detected that using standard URLs is the only level that will work.',
+      msg_modrewrite_enabled: 'Your copy of Enano has the Windows mod_rewrite workaround patch enabled.',
+      msg_modrewrite_necessary: 'If you don\'t plan to use the Tiny URLs option below, you should go back and re-download Enano without this workaround enabled. The mod_rewrite issues Enano faces under Windows are caused by a security change in Apache 2.2 that is not present in Apache 2.0. <a href="http://enanocms.org/windows-patch" onclick="window.open(this.href); return false;">Learn more</a>',
+      msg_modrewrite_unnecessary: 'The Enano installer has detected that you\'re probably not running Apache 2.2 under Windows. You don\'t need this workaround unless you\'re using this specific software stack. Unless you\'re sure that you are running Apache 2.2 under Windows on your server, it is recommended that you disable the <tt>WINDOWS_MOD_REWRITE_WORKAROUNDS</tt> constant in includes/constants.php. <a href="http://enanocms.org/windows-patch" onclick="window.open(this.href); return false;">Learn more</a>',
+      msg_modrewrite_disabled: 'Your server is running Apache 2.2 on Windows, but the Windows mod_rewrite workaround patch is disabled.',
+      msg_modrewrite_maybeneeded: 'Do not use Rewritten URLs unless you re-download Enano with the Windows Patch enabled or uncomment the <tt>WINDOWS_MOD_REWRITE_WORKAROUNDS</tt> line in <tt>includes/constants.php</tt>. Otherwise you may have trouble accessing login and administration pages due to a bug in Apache. <a href="http://enanocms.org/windows-patch" onclick="window.open(this.href); return false;">Learn more</a>',
       
       field_name: 'Pick a name',
       field_name_hint: 'Now for the fun part - it\'s time to name your website. Try to pick something that doesn\'t include any special characters, since this can make project-page URLs look botched.',