I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
authorDan
Thu, 05 Jul 2007 10:37:36 -0400
changeset 42 45ebe475ff75
parent 41 7c7920b65f42
child 43 30d2fb25afff
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
includes/clientside/css/enano-shared.css
includes/clientside/static/acl.js
includes/rijndael.php
includes/sessions.php
index.php
plugins/SpecialAdmin.php
schema.sql
--- a/includes/clientside/css/enano-shared.css	Tue Jul 03 14:21:33 2007 -0400
+++ b/includes/clientside/css/enano-shared.css	Thu Jul 05 10:37:36 2007 -0400
@@ -9,11 +9,11 @@
 div.question-box                  { background-image: url(../../../images/question.png); background-position: 8px 8px; background-repeat: no-repeat; background-color: #F4FFF4; border: 1px dashed #406080; padding: 10px 10px 10px 50px; margin: 1em 0 0 0; min-height: 25px; }
 div.wait-box                      { background-image: url(../../../images/wait.png);     background-position: 8px 8px; background-repeat: no-repeat; background-color: #FFF4FF; border: 1px dashed #406080; padding: 10px 10px 10px 50px; margin: 1em 0 0 0; min-height: 25px; }
 
-div.error-box-mini                { background-image: url(../../../images/mini-error.png);    background-position: 5px 5px; background-repeat: no-repeat; background-color: #FFF4F4; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
-div.info-box-mini                 { background-image: url(../../../images/mini-info.png);     background-position: 5px 5px; background-repeat: no-repeat; background-color: #F4F4FF; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
-div.warning-box-mini              { background-image: url(../../../images/mini-warning.png);  background-position: 5px 5px; background-repeat: no-repeat; background-color: #FFFFF4; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
-div.question-box-mini             { background-image: url(../../../images/mini-question.png); background-position: 5px 5px; background-repeat: no-repeat; background-color: #F4FFF4; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
-div.wait-box-mini                 { background-image: url(../../../images/mini-wait.png);     background-position: 5px 5px; background-repeat: no-repeat; background-color: #FFF4FF; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
+div.error-box-mini                { background-image: url(../../../images/mini-error.png);    background-position: 5px center; background-repeat: no-repeat; background-color: #FFF4F4; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
+div.info-box-mini                 { background-image: url(../../../images/mini-info.png);     background-position: 5px center; background-repeat: no-repeat; background-color: #F4F4FF; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
+div.warning-box-mini              { background-image: url(../../../images/mini-warning.png);  background-position: 5px center; background-repeat: no-repeat; background-color: #FFFFF4; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
+div.question-box-mini             { background-image: url(../../../images/mini-question.png); background-position: 5px center; background-repeat: no-repeat; background-color: #F4FFF4; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
+div.wait-box-mini                 { background-image: url(../../../images/mini-wait.png);     background-position: 5px center; background-repeat: no-repeat; background-color: #FFF4FF; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
 
 /* Similar to the Mediawiki-ish alert box (usermessage) */
 
--- a/includes/clientside/static/acl.js	Tue Jul 03 14:21:33 2007 -0400
+++ b/includes/clientside/static/acl.js	Thu Jul 05 10:37:36 2007 -0400
@@ -105,6 +105,12 @@
   lbl.style.display = 'block';
   span.appendChild(grpsel);
   
+  anoninfo = document.createElement('div');
+  anoninfo.className = 'info-box-mini';
+  anoninfo.appendChild(document.createTextNode('To edit permissions for guests, select "a specific user", and enter Anonymous as the username.'));
+  span.appendChild(document.createElement('br'));
+  span.appendChild(anoninfo);
+  
   usrb = document.createElement('input');
   usrb.type = 'radio';
   usrb.name  = 'target_type';
@@ -174,7 +180,7 @@
   container = document.createElement('div');
   container.style.margin = 'auto';
   container.style.width = '360px';
-  container.style.paddingTop = '70px';
+  container.style.paddingTop = '100px';
   
   head = document.createElement('h2');
   head.appendChild(document.createTextNode('Manage page access'));
@@ -367,6 +373,8 @@
               document.getElementById(aclManagerID + '_main').innerHTML += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'Do you really want to delete this rule?\')) __aclDeleteRule(); return false;" style="color: red;">Delete this rule</a></p>';
             //fadeInfoBoxes();
             document.getElementById(aclManagerID+'_main').scrollTop = 0;
+            
+            aclDataCache.mode = 'save_edit';
             break;
           case 'delete':
             
@@ -389,6 +397,9 @@
                 note = document.createElement('div');
                 note.className = 'info-box';
                 note.style.marginLeft = '0';
+                note.style.position = 'absolute';
+                note.style.width = '558px';
+                note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000);
                 b = document.createElement('b');
                 b.appendChild(document.createTextNode('Entry deleted'));
                 note.appendChild(b);
@@ -397,7 +408,7 @@
                 note.appendChild(document.createElement('br'));
                 a = document.createElement('a');
                 a.href = '#';
-                a.onclick = function() { this.parentNode.parentNode.removeChild(this.parentNode); return false; };
+                a.onclick = function() { opacity(this.parentNode.id, 100, 0, 1000); setTimeout('var div = document.getElementById("' + this.parentNode.id + '"); div.parentNode.removeChild(div);', 1100); return false; };
                 a.appendChild(document.createTextNode('[ dismiss :'));
                 note.appendChild(a);
                 a = document.createElement('a');
@@ -714,8 +725,22 @@
 
 function __aclDeleteRule()
 {
-  if(!aclDataCache) return false;
-  if(aclDataCache.mode != 'seltarget') return false;
+  if(!aclDataCache) 
+  {
+    if ( window.console )
+    {
+      try{ console.error('ACL editor: can\'t load data cache on delete'); } catch(e) {};
+    }
+    return false;
+  }
+  if(aclDataCache.mode != 'seltarget' && aclDataCache.mode != 'save_new' && aclDataCache.mode != 'save_edit')
+  {
+    if ( window.console )
+    {
+      try{ console.error('ACL editor: wrong mode on aclDataCache: ' + aclDataCache.mode); } catch(e) {};
+    }
+    return false;
+  }
   parms = {
     'target_type' : aclDataCache.target_type,
     'target_id' : aclDataCache.target_id,
--- a/includes/rijndael.php	Tue Jul 03 14:21:33 2007 -0400
+++ b/includes/rijndael.php	Thu Jul 05 10:37:36 2007 -0400
@@ -770,7 +770,7 @@
       $cryptext = $this->rijndaelEncrypt($text, $key, 'ECB');
       if(!is_array($cryptext))
       {
-        echo 'Warning: encryption failed for string: '.$text.'<br />';
+        echo 'Warning: encryption failed for string: '.print_r($text,true).'<br />';
         return false;
       }
       switch($return_encoding)
--- a/includes/sessions.php	Tue Jul 03 14:21:33 2007 -0400
+++ b/includes/sessions.php	Thu Jul 05 10:37:36 2007 -0400
@@ -1396,7 +1396,7 @@
       $db->free_result();
       
       $user_id =& $row['user_id'];
-      $this->sql('INSERT INTO '.table_prefix.'user_extra(user_id) VALUES(' . $user_id . ');');
+      $this->sql('INSERT INTO '.table_prefix.'users_extra(user_id) VALUES(' . $user_id . ');');
     }
     
     // Require the account to be activated?
--- a/index.php	Tue Jul 03 14:21:33 2007 -0400
+++ b/index.php	Thu Jul 05 10:37:36 2007 -0400
@@ -11,38 +11,38 @@
  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
  *
  */
-
+ 
   // Set up gzip encoding before any output is sent
-
+  
   $aggressive_optimize_html = false;
-
+  
   global $do_gzip;
   $do_gzip = false;
-
+  
   if(isset($_SERVER['PATH_INFO'])) $v = $_SERVER['PATH_INFO'];
   elseif(isset($_GET['title'])) $v = $_GET['title'];
   else $v = '';
-
+  
   error_reporting(E_ALL);
-
+  
   // if(!strstr($v, 'CSS') && !strstr($v, 'UploadFile') && !strstr($v, 'DownloadFile')) // These pages are blacklisted because we can't have debugConsole's HTML output disrupting the flow of header() calls and whatnot
   // {
   //   $do_gzip = ( function_exists('gzcompress') && ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') ) ) ? true : false;
   //   // Uncomment the following line to enable debugConsole (requires PHP 5 or later)
   //   // define('ENANO_DEBUG', '');
   // }
-
+  
   if(defined('ENANO_DEBUG')) $do_gzip = false;
-
+  
   if($aggressive_optimize_html || $do_gzip)
   {
     ob_start();
   }
-
+  
   require('includes/common.php');
-
+  
   global $db, $session, $paths, $template, $plugins; // Common objects
-
+  
   if(!isset($_GET['do'])) $_GET['do'] = 'view';
   switch($_GET['do'])
   {
@@ -129,7 +129,7 @@
         <br />
         ';
       if($paths->wiki_mode)
-        echo 'Edit summary: <input name="edit_summary" type="text" size="40" /><br /><label><input type="checkbox" name="minor" /> This is a minor edit</label><br />';
+        echo 'Edit summary: <input name="edit_summary" type="text" size="40" /><br /><label><input type="checkbox" name="minor" /> This is a minor edit</label><br />';  
       echo '<br />
           <input type="submit" name="_save" value="Save changes" style="font-weight: bold;" />
           <input type="submit" name="_preview" value="Preview changes" />
@@ -223,7 +223,7 @@
                  echo 'None;</b> Warning: request validation will fail after clicking submit<b>';
              }
            ?></b></p>
-        <p><input type="submit" value="Protect page" style="font-weight: bold;" /></p>
+        <p><input type="submit" value="Protect page" style="font-weight: bold;" /></p> 
       </form>
       <?php
       $template->footer();
@@ -240,10 +240,10 @@
         <?php if(isset($_POST['newname'])) echo '<p style="color: red;">Error: you must enter a new name for this page.</p>'; ?>
         <p>Please enter a new name for this page:</p>
         <p><input type="text" name="newname" size="40" /></p>
-        <p><input type="submit" value="Rename page" style="font-weight: bold;" /></p>
+        <p><input type="submit" value="Rename page" style="font-weight: bold;" /></p> 
       </form>
       <?php
-      $template->footer();
+      $template->footer();    
       break;
     case 'flushlogs':
       if(!$session->get_permissions('clear_logs')) die_friendly('Access denied', '<p>Flushing the logs for a page <u>requires</u> administrative rights.</p>');
@@ -360,7 +360,7 @@
       PageUtils::aclmanager($data);
       break;
   }
-
+  
   //
   // Optimize HTML by replacing newlines with spaces (excludes <pre>, <script>, and <style> blocks)
   //
@@ -369,11 +369,11 @@
     // Load up the HTML
     $html = ob_get_contents();
     ob_end_clean();
-
+    
     // Which tags to strip - you can change this if needed
     $strip_tags = Array('pre', 'script', 'style', 'enano:no-opt');
     $strip_tags = implode('|', $strip_tags);
-
+    
     // Strip out the tags and replace with placeholders
     preg_match_all("#<($strip_tags)(.*?)>(.*?)</($strip_tags)>#is", $html, $matches);
     $seed = md5(microtime() . mt_rand()); // Random value used for placeholders
@@ -381,32 +381,32 @@
     {
       $html = str_replace("<{$matches[1][$i]}{$matches[2][$i]}>{$matches[3][$i]}</{$matches[4][$i]}>", "{DONT_STRIP_ME_NAKED:$seed:$i}", $html);
     }
-
+    
     // Finally, process the HTML
     $html = preg_replace("#\n([ ]*)#", " ", $html);
-
+    
     // Remove annoying spaces between tags
     $html = preg_replace("#>([ ]*?){2,}<#", "> <", $html);
-
+    
     // Re-insert untouchable tags
     for ($i = 0;$i < sizeof($matches[1]); $i++)
     {
       $html = str_replace("{DONT_STRIP_ME_NAKED:$seed:$i}", "<{$matches[1][$i]}{$matches[2][$i]}>{$matches[3][$i]}</{$matches[4][$i]}>", $html);
     }
-
+    
     // Remove <enano:no-opt> blocks (can be used by themes that don't want their HTML optimized)
     $html = preg_replace('#<(\/|)enano:no-opt(.*?)>#', '', $html);
-
+    
     // Tell snoopish users what's going on
     $html = str_replace('<html>', "\n<!-- NOTE: This HTML document has been Aggressively Optimized(TM) by Enano to make page loading faster. -->\n<html>", $html);
-
+    
     // Re-enable output buffering to allow the Gzip function (below) to work
     ob_start();
-
+    
     // Done, send it to the user
     echo( $html );
   }
-
+  
   //
   // Compress buffered output if required and send to browser
   //
@@ -417,20 +417,20 @@
     //
     $gzip_contents = ob_get_contents();
     ob_end_clean();
-
+  
     $gzip_size = strlen($gzip_contents);
     $gzip_crc = crc32($gzip_contents);
-
+  
     $gzip_contents = gzcompress($gzip_contents, 9);
     $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
-
+  
     header('Content-encoding: gzip');
     echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
     echo $gzip_contents;
     echo pack('V', $gzip_crc);
     echo pack('V', $gzip_size);
   }
-
+  
   $db->close();
 
 ?>
--- a/plugins/SpecialAdmin.php	Tue Jul 03 14:21:33 2007 -0400
+++ b/plugins/SpecialAdmin.php	Thu Jul 05 10:37:36 2007 -0400
@@ -110,10 +110,14 @@
   $hash = md5($dbpasswd);
   unset($dbname, $dbhost, $dbuser, $dbpasswd);
   unset($dbname, $dbhost, $dbuser, $dbpasswd); // PHP5 Zend bug
-  if ( defined('ENANO_DEMO_MODE') && !isset($_GET[ $hash ]) )
+  if ( defined('ENANO_DEMO_MODE') && !isset($_GET[ $hash ]) && substr($_SERVER['REMOTE_ADDR'], 0, 8) != '192.168.' )
   {
     echo '<tr><td class="row1" colspan="4">Logs are recorded but not displayed for privacy purposes in the demo.</td></tr>';
   }
+  else if ( defined('ENANO_DEMO_MODE') && isset($_GET['hash']) && $_GET['hash'] != $hash && substr($_SERVER['REMOTE_ADDR'], 0, 8) != '192.168.' )
+  {
+    echo '<tr><td class="row1" colspan="4">Invalid hash. Cheater.</td></tr>';
+  }
   else
   {
     if(isset($_GET['fulllog']))
--- a/schema.sql	Tue Jul 03 14:21:33 2007 -0400
+++ b/schema.sql	Thu Jul 05 10:37:36 2007 -0400
@@ -283,3 +283,4 @@
   (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="$SCRIPTPATH$/$NS_SPECIAL$Search" method="get" style="padding: 0; margin: 0;"><p><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');
+