Merging in fixes and updates from stable
authorDan
Sun, 18 Nov 2007 20:37:08 -0500
changeset 271 f088805540ae
parent 266 917dcc6c4ceb (diff)
parent 270 5bcdee999015 (current diff)
child 278 53ba55d33abb
Merging in fixes and updates from stable
includes/common.php
includes/dbal.php
includes/functions.php
includes/pageutils.php
includes/sessions.php
install.php
plugins/SpecialAdmin.php
plugins/SpecialUserFuncs.php
--- a/ajax.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/ajax.php	Sun Nov 18 20:37:08 2007 -0500
@@ -1,425 +1,425 @@
-<?php
-
-/*
- * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.2 (Coblynau)
- * Copyright (C) 2006-2007 Dan Fuhry
- *
- * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- */
- 
-  // fillusername should be done without the help of the rest of Enano - all we need is the DBAL
-  if ( isset($_GET['_mode']) && $_GET['_mode'] == 'fillusername' )
-  {
-    // setup and load a very basic, specialized instance of the Enano API
-    function dc_here($m)     { return false; }
-    function dc_dump($a, $g) { return false; }
-    function dc_watch($n)    { return false; }
-    function dc_start_timer($u) { return false; }
-    function dc_stop_timer($m) { return false; }
-    // Determine directory (special case for development servers)
-    if ( strpos(__FILE__, '/repo/') && file_exists('.enanodev') )
-    {
-      $filename = str_replace('/repo/', '/', __FILE__);
-    }
-    else
-    {
-      $filename = __FILE__;
-    }
-    define('ENANO_ROOT', dirname($filename));
-    require(ENANO_ROOT.'/includes/functions.php');
-    require(ENANO_ROOT.'/includes/dbal.php');
-    require(ENANO_ROOT.'/includes/json.php');
-    $db = new mysql();
-    $db->connect();
-    
-    // result is sent using JSON
-    $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
-    $return = Array(
-        'mode' => 'success',
-        'users_real' => Array()
-      );
-    
-    // should be connected to the DB now
-    $name = (isset($_GET['name'])) ? $db->escape($_GET['name']) : false;
-    if ( !$name )
-    {
-      $return = array(
-        'mode' => 'error',
-        'error' => 'Invalid URI'
-      );
-      die( $json->encode($return) );
-    }
-    $allowanon = ( isset($_GET['allowanon']) && $_GET['allowanon'] == '1' ) ? '' : ' AND user_id > 1';
-    $q = $db->sql_query('SELECT username FROM '.table_prefix.'users WHERE lcase(username) LIKE lcase(\'%'.$name.'%\')' . $allowanon . ' ORDER BY username ASC;');
-    if ( !$q )
-    {
-      $return = array(
-        'mode' => 'error',
-        'error' => 'MySQL error selecting username data: '.addslashes(mysql_error())
-      );
-      die( $json->encode($return) );
-    }
-    $i = 0;
-    while($r = $db->fetchrow())
-    {
-      $return['users_real'][] = $r['username'];
-      $i++;
-    }
-    $db->free_result();
-    
-    // all done! :-)
-    $db->close();
-    
-    echo $json->encode( $return );
-    
-    exit;
-  }
- 
-  require('includes/common.php');
-  
-  global $db, $session, $paths, $template, $plugins; // Common objects
-  if(!isset($_GET['_mode'])) die('This script cannot be accessed directly.');
-  
-  $_ob = '';
-  
-  switch($_GET['_mode']) {
-    case "checkusername":
-      echo PageUtils::checkusername($_GET['name']);
-      break;
-    case "getsource":
-      $p = ( isset($_GET['pagepass']) ) ? $_GET['pagepass'] : false;
-      echo PageUtils::getsource($paths->page, $p);
-      break;
-    case "getpage":
-      // echo PageUtils::getpage($paths->page, false, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
-      $revision_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
-      $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $revision_id );
-      
-      $pagepass = ( isset($_REQUEST['pagepass']) ) ? $_REQUEST['pagepass'] : '';
-      $page->password = $pagepass;
-            
-      $page->send();
-      break;
-    case "savepage":
-      $summ = ( isset($_POST['summary']) ) ? $_POST['summary'] : '';
-      $minor = isset($_POST['minor']);
-      $e = PageUtils::savepage($paths->cpage['urlname_nons'], $paths->namespace, $_POST['text'], $summ, $minor);
-      if($e=='good')
-      {
-        $page = new PageProcessor($paths->cpage['urlname_nons'], $paths->namespace);
-        $page->send();
-      }
-      else
-      {
-        echo '<p>Error saving the page: '.$e.'</p>';
-      }
-      break;
-    case "protect":
-      echo PageUtils::protect($paths->cpage['urlname_nons'], $paths->namespace, (int)$_POST['level'], $_POST['reason']);
-      break;
-    case "histlist":
-      echo PageUtils::histlist($paths->cpage['urlname_nons'], $paths->namespace);
-      break;
-    case "rollback":
-      echo PageUtils::rollback( (int)$_GET['id'] );
-      break;
-    case "comments":
-      $comments = new Comments($paths->cpage['urlname_nons'], $paths->namespace);
-      if ( isset($_POST['data']) )
-      {
-        $comments->process_json($_POST['data']);
-      }
-      else
-      {
-        die('{ "mode" : "error", "error" : "No input" }');
-      }
-      break;
-    case "rename":
-      echo PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newtitle']);
-      break;
-    case "flushlogs":
-      echo PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace);
-      break;
-    case "deletepage":
-      $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false;
-      if ( empty($reason) )
-        die('Please enter a reason for deleting this page.');
-      echo PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason);
-      break;
-    case "delvote":
-      echo PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace);
-      break;
-    case "resetdelvotes":
-      echo PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace);
-      break;
-    case "getstyles":
-      echo PageUtils::getstyles($_GET['id']);
-      break;
-    case "catedit":
-      echo PageUtils::catedit($paths->cpage['urlname_nons'], $paths->namespace);
-      break;
-    case "catsave":
-      echo PageUtils::catsave($paths->cpage['urlname_nons'], $paths->namespace, $_POST);
-      break;
-    case "setwikimode":
-      echo PageUtils::setwikimode($paths->cpage['urlname_nons'], $paths->namespace, (int)$_GET['mode']);
-      break;
-    case "setpass":
-      echo PageUtils::setpass($paths->cpage['urlname_nons'], $paths->namespace, $_POST['password']);
-      break;
-    case "fillusername":
-      break;
-    case "fillpagename":
-      $name = (isset($_GET['name'])) ? $_GET['name'] : false;
-      if(!$name) die('userlist = new Array(); namelist = new Array(); errorstring=\'Invalid URI\'');
-      $nd = RenderMan::strToPageID($name);
-      $c = 0;
-      $u = Array();
-      $n = Array();
-      
-      $name = sanitize_page_id($name);
-      $name = str_replace('_', ' ', $name);
-      
-      for($i=0;$i<sizeof($paths->pages)/2;$i++)
-      {
-        if( ( 
-            preg_match('#'.preg_quote($name).'(.*)#i', $paths->pages[$i]['name']) ||
-            preg_match('#'.preg_quote($name).'(.*)#i', $paths->pages[$i]['urlname']) ||
-            preg_match('#'.preg_quote($name).'(.*)#i', $paths->pages[$i]['urlname_nons']) ||
-            preg_match('#'.preg_quote(str_replace(' ', '_', $name)).'(.*)#i', $paths->pages[$i]['name']) ||
-            preg_match('#'.preg_quote(str_replace(' ', '_', $name)).'(.*)#i', $paths->pages[$i]['urlname']) ||
-            preg_match('#'.preg_quote(str_replace(' ', '_', $name)).'(.*)#i', $paths->pages[$i]['urlname_nons'])
-            ) &&
-           ( ( $nd[1] != 'Article' && $paths->pages[$i]['namespace'] == $nd[1] ) || $nd[1] == 'Article' )
-            && $paths->pages[$i]['visible']
-           )
-        {
-          $c++;
-          $u[] = $paths->pages[$i]['name'];
-          $n[] = $paths->pages[$i]['urlname'];
-        }
-      }
-      if($c > 0)
-      {
-        echo 'userlist = new Array(); namelist = new Array(); errorstring = false; '."\n";
-        for($i=0;$i<sizeof($u);$i++) // Can't use foreach because we need the value of $i and we need to use both $u and $n
-        {
-          echo "userlist[$i] = '".addslashes($n[$i])."';\n";
-          echo "namelist[$i] = '".addslashes(htmlspecialchars($u[$i]))."';\n";
-        }
-      } else {
-        die('userlist = new Array(); namelist = new Array(); errorstring=\'No page matches found.\'');
-      }
-      break;
-    case "preview":
-      echo PageUtils::genPreview($_POST['text']);
-      break;
-    case "pagediff":
-      $id1 = ( isset($_GET['diff1']) ) ? (int)$_GET['diff1'] : false;
-      $id2 = ( isset($_GET['diff2']) ) ? (int)$_GET['diff2'] : false;
-      if(!$id1 || !$id2) { echo '<p>Invalid request.</p>'; $template->footer(); break; }
-      if(!preg_match('#^([0-9]+)$#', (string)$_GET['diff1']) ||
-         !preg_match('#^([0-9]+)$#', (string)$_GET['diff2']  )) { echo '<p>SQL injection attempt</p>'; $template->footer(); break; }
-      echo PageUtils::pagediff($paths->cpage['urlname_nons'], $paths->namespace, $id1, $id2);
-      break;
-    case "jsres":
-      die('// ERROR: this section is deprecated and has moved to includes/clientside/static/enano-lib-basic.js.');
-      break;
-    case "rdns":
-      if(!$session->get_permissions('mod_misc')) die('Go somewhere else for your reverse DNS info!');
-      $ip = $_GET['ip'];
-      $rdns = gethostbyaddr($ip);
-      if($rdns == $ip) echo 'Unable to get reverse DNS information. Perhaps the DNS server is down or the PTR record no longer exists.';
-      else echo $rdns;
-      break;
-    case 'acljson':
-      $parms = ( isset($_POST['acl_params']) ) ? rawurldecode($_POST['acl_params']) : false;
-      echo PageUtils::acl_json($parms);
-      break;
-    case "change_theme":
-      if ( !isset($_POST['theme_id']) || !isset($_POST['style_id']) )
-      {
-        die('Invalid input');
-      }
-      if ( !preg_match('/^([a-z0-9_-]+)$/i', $_POST['theme_id']) || !preg_match('/^([a-z0-9_-]+)$/i', $_POST['style_id']) )
-      {
-        die('Invalid input');
-      }
-      if ( !file_exists(ENANO_ROOT . '/themes/' . $_POST['theme_id'] . '/css/' . $_POST['style_id'] . '.css') )
-      {
-        die('Can\'t find theme file: ' . ENANO_ROOT . '/themes/' . $_POST['theme_id'] . '/css/' . $_POST['style_id'] . '.css');
-      }
-      if ( !$session->user_logged_in )
-      {
-        die('You must be logged in to change your theme');
-      }
-      // Just in case something slipped through...
-      $theme_id = $db->escape($_POST['theme_id']);
-      $style_id = $db->escape($_POST['style_id']);
-      $e = $db->sql_query('UPDATE ' . table_prefix . "users SET theme='$theme_id', style='$style_id' WHERE user_id=$session->user_id;");
-      if ( !$e )
-        die( $db->get_error() );
-      die('GOOD');
-      break;
-    case 'get_tags':
-      $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
-      
-      $ret = array('tags' => array(), 'user_level' => $session->user_level, 'can_add' => $session->get_permissions('tag_create'));
-      $q = $db->sql_query('SELECT t.tag_id, t.tag_name, pg.pg_target IS NOT NULL AS used_in_acl, t.user FROM '.table_prefix.'tags AS t
-        LEFT JOIN '.table_prefix.'page_groups AS pg
-          ON ( ( pg.pg_type = ' . PAGE_GRP_TAGGED . ' AND pg.pg_target=t.tag_name ) OR ( pg.pg_type IS NULL AND pg.pg_target IS NULL ) )
-        WHERE t.page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND t.namespace=\'' . $db->escape($paths->namespace) . '\';');
-      if ( !$q )
-        $db->_die();
-      
-      while ( $row = $db->fetchrow() )
-      {
-        $can_del = true;
-        
-        $perm = ( $row['user'] != $session->user_id ) ?
-                'tag_delete_other' :
-                'tag_delete_own';
-        
-        if ( $row['user'] == 1 && !$session->user_logged_in )
-          // anonymous user trying to delete tag (hardcode blacklisted)
-          $can_del = false;
-          
-        if ( !$session->get_permissions($perm) )
-          $can_del = false;
-        
-        if ( $row['used_in_acl'] == 1 && !$session->get_permissions('edit_acl') && $session->user_level < USER_LEVEL_ADMIN )
-          $can_del = false;
-        
-        $ret['tags'][] = array(
-          'id' => $row['tag_id'],
-          'name' => $row['tag_name'],
-          'can_del' => $can_del,
-          'acl' => ( $row['used_in_acl'] == 1 )
-        );
-      }
-      
-      echo $json->encode($ret);
-      
-      break;
-    case 'addtag':
-      $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
-      $resp = array(
-          'success' => false,
-          'error' => 'No error',
-          'can_del' => ( $session->get_permissions('tag_delete_own') && $session->user_logged_in ),
-          'in_acl' => false
-        );
-      
-      // first of course, are we allowed to tag pages?
-      if ( !$session->get_permissions('tag_create') )
-      {
-        $resp['error'] = 'You are not permitted to tag pages.';
-        die($json->encode($resp));
-      }
-      
-      // sanitize the tag name
-      $tag = sanitize_tag($_POST['tag']);
-      $tag = $db->escape($tag);
-      
-      if ( strlen($tag) < 2 )
-      {
-        $resp['error'] = 'Tags must consist of at least 2 alphanumeric characters.';
-        die($json->encode($resp));
-      }
-      
-      // check if tag is already on page
-      $q = $db->sql_query('SELECT 1 FROM '.table_prefix.'tags WHERE page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $db->escape($paths->namespace) . '\' AND tag_name=\'' . $tag . '\';');
-      if ( !$q )
-        $db->_die();
-      if ( $db->numrows() > 0 )
-      {
-        $resp['error'] = 'This page already has this tag.';
-        die($json->encode($resp));
-      }
-      $db->free_result();
-      
-      // tricky: make sure this tag isn't being used in some page group, and thus adding it could affect page access
-      $can_edit_acl = ( $session->get_permissions('edit_acl') || $session->user_level >= USER_LEVEL_ADMIN );
-      $q = $db->sql_query('SELECT 1 FROM '.table_prefix.'page_groups WHERE pg_type=' . PAGE_GRP_TAGGED . ' AND pg_target=\'' . $tag . '\';');
-      if ( !$q )
-        $db->_die();
-      if ( $db->numrows() > 0 && !$can_edit_acl )
-      {
-        $resp['error'] = 'This tag is used in an ACL page group, and thus can\'t be added to a page by people without administrator privileges.';
-        die($json->encode($resp));
-      }
-      $resp['in_acl'] = ( $db->numrows() > 0 );
-      $db->free_result();
-      
-      // we're good
-      $q = $db->sql_query('INSERT INTO '.table_prefix.'tags(tag_name,page_id,namespace,user) VALUES(\'' . $tag . '\', \'' . $db->escape($paths->cpage['urlname_nons']) . '\', \'' . $db->escape($paths->namespace) . '\', ' . $session->user_id . ');');
-      if ( !$q )
-        $db->_die();
-      
-      $resp['success'] = true;
-      $resp['tag'] = $tag;
-      $resp['tag_id'] = $db->insert_id();
-      
-      echo $json->encode($resp);
-      break;
-    case 'deltag':
-      
-      $tag_id = intval($_POST['tag_id']);
-      if ( empty($tag_id) )
-        die('Invalid tag ID');
-      
-      $q = $db->sql_query('SELECT t.tag_id, t.user, t.page_id, t.namespace, pg.pg_target IS NOT NULL AS used_in_acl FROM '.table_prefix.'tags AS t
-  LEFT JOIN '.table_prefix.'page_groups AS pg
-    ON ( pg.pg_id IS NULL OR ( pg.pg_target = t.tag_name AND pg.pg_type = ' . PAGE_GRP_TAGGED . ' ) )
-  WHERE t.tag_id=' . $tag_id . ';');
-      
-      if ( !$q )
-        $db->_die();
-      
-      if ( $db->numrows() < 1 )
-        die('Could not find a tag with that ID');
-      
-      $row = $db->fetchrow();
-      $db->free_result();
-      
-      if ( $row['page_id'] == $paths->cpage['urlname_nons'] && $row['namespace'] == $paths->namespace )
-        $perms =& $session;
-      else
-        $perms = $session->fetch_page_acl($row['page_id'], $row['namespace']);
-        
-      $perm = ( $row['user'] != $session->user_id ) ?
-                'tag_delete_other' :
-                'tag_delete_own';
-      
-      if ( $row['user'] == 1 && !$session->user_logged_in )
-        // anonymous user trying to delete tag (hardcode blacklisted)
-        die('You are not authorized to delete this tag.');
-        
-      if ( !$perms->get_permissions($perm) )
-        die('You are not authorized to delete this tag.');
-      
-      if ( $row['used_in_acl'] == 1 && !$perms->get_permissions('edit_acl') && $session->user_level < USER_LEVEL_ADMIN )
-        die('You are not authorized to delete this tag.');
-      
-      // We're good
-      $q = $db->sql_query('DELETE FROM '.table_prefix.'tags WHERE tag_id = ' . $tag_id . ';');
-      if ( !$q )
-        $db->_die();
-      
-      echo 'success';
-      
-      break;
-    case 'ping':
-      echo 'pong';
-      break;
-    default:
-      die('Hacking attempt');
-      break;
-  }
-  
+<?php
+
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.1.1
+ * Copyright (C) 2006-2007 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+ 
+  // fillusername should be done without the help of the rest of Enano - all we need is the DBAL
+  if ( isset($_GET['_mode']) && $_GET['_mode'] == 'fillusername' )
+  {
+    // setup and load a very basic, specialized instance of the Enano API
+    function dc_here($m)     { return false; }
+    function dc_dump($a, $g) { return false; }
+    function dc_watch($n)    { return false; }
+    function dc_start_timer($u) { return false; }
+    function dc_stop_timer($m) { return false; }
+    // Determine directory (special case for development servers)
+    if ( strpos(__FILE__, '/repo/') && file_exists('.enanodev') )
+    {
+      $filename = str_replace('/repo/', '/', __FILE__);
+    }
+    else
+    {
+      $filename = __FILE__;
+    }
+    define('ENANO_ROOT', dirname($filename));
+    require(ENANO_ROOT.'/includes/functions.php');
+    require(ENANO_ROOT.'/includes/dbal.php');
+    require(ENANO_ROOT.'/includes/json.php');
+    $db = new mysql();
+    $db->connect();
+    
+    // result is sent using JSON
+    $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
+    $return = Array(
+        'mode' => 'success',
+        'users_real' => Array()
+      );
+    
+    // should be connected to the DB now
+    $name = (isset($_GET['name'])) ? $db->escape($_GET['name']) : false;
+    if ( !$name )
+    {
+      $return = array(
+        'mode' => 'error',
+        'error' => 'Invalid URI'
+      );
+      die( $json->encode($return) );
+    }
+    $allowanon = ( isset($_GET['allowanon']) && $_GET['allowanon'] == '1' ) ? '' : ' AND user_id > 1';
+    $q = $db->sql_query('SELECT username FROM '.table_prefix.'users WHERE lcase(username) LIKE lcase(\'%'.$name.'%\')' . $allowanon . ' ORDER BY username ASC;');
+    if ( !$q )
+    {
+      $return = array(
+        'mode' => 'error',
+        'error' => 'MySQL error selecting username data: '.addslashes(mysql_error())
+      );
+      die( $json->encode($return) );
+    }
+    $i = 0;
+    while($r = $db->fetchrow())
+    {
+      $return['users_real'][] = $r['username'];
+      $i++;
+    }
+    $db->free_result();
+    
+    // all done! :-)
+    $db->close();
+    
+    echo $json->encode( $return );
+    
+    exit;
+  }
+ 
+  require('includes/common.php');
+  
+  global $db, $session, $paths, $template, $plugins; // Common objects
+  if(!isset($_GET['_mode'])) die('This script cannot be accessed directly.');
+  
+  $_ob = '';
+  
+  switch($_GET['_mode']) {
+    case "checkusername":
+      echo PageUtils::checkusername($_GET['name']);
+      break;
+    case "getsource":
+      $p = ( isset($_GET['pagepass']) ) ? $_GET['pagepass'] : false;
+      echo PageUtils::getsource($paths->page, $p);
+      break;
+    case "getpage":
+      // echo PageUtils::getpage($paths->page, false, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
+      $revision_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
+      $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $revision_id );
+      
+      $pagepass = ( isset($_REQUEST['pagepass']) ) ? $_REQUEST['pagepass'] : '';
+      $page->password = $pagepass;
+            
+      $page->send();
+      break;
+    case "savepage":
+      $summ = ( isset($_POST['summary']) ) ? $_POST['summary'] : '';
+      $minor = isset($_POST['minor']);
+      $e = PageUtils::savepage($paths->cpage['urlname_nons'], $paths->namespace, $_POST['text'], $summ, $minor);
+      if($e=='good')
+      {
+        $page = new PageProcessor($paths->cpage['urlname_nons'], $paths->namespace);
+        $page->send();
+      }
+      else
+      {
+        echo '<p>Error saving the page: '.$e.'</p>';
+      }
+      break;
+    case "protect":
+      echo PageUtils::protect($paths->cpage['urlname_nons'], $paths->namespace, (int)$_POST['level'], $_POST['reason']);
+      break;
+    case "histlist":
+      echo PageUtils::histlist($paths->cpage['urlname_nons'], $paths->namespace);
+      break;
+    case "rollback":
+      echo PageUtils::rollback( (int)$_GET['id'] );
+      break;
+    case "comments":
+      $comments = new Comments($paths->cpage['urlname_nons'], $paths->namespace);
+      if ( isset($_POST['data']) )
+      {
+        $comments->process_json($_POST['data']);
+      }
+      else
+      {
+        die('{ "mode" : "error", "error" : "No input" }');
+      }
+      break;
+    case "rename":
+      echo PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newtitle']);
+      break;
+    case "flushlogs":
+      echo PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace);
+      break;
+    case "deletepage":
+      $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false;
+      if ( empty($reason) )
+        die('Please enter a reason for deleting this page.');
+      echo PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason);
+      break;
+    case "delvote":
+      echo PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace);
+      break;
+    case "resetdelvotes":
+      echo PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace);
+      break;
+    case "getstyles":
+      echo PageUtils::getstyles($_GET['id']);
+      break;
+    case "catedit":
+      echo PageUtils::catedit($paths->cpage['urlname_nons'], $paths->namespace);
+      break;
+    case "catsave":
+      echo PageUtils::catsave($paths->cpage['urlname_nons'], $paths->namespace, $_POST);
+      break;
+    case "setwikimode":
+      echo PageUtils::setwikimode($paths->cpage['urlname_nons'], $paths->namespace, (int)$_GET['mode']);
+      break;
+    case "setpass":
+      echo PageUtils::setpass($paths->cpage['urlname_nons'], $paths->namespace, $_POST['password']);
+      break;
+    case "fillusername":
+      break;
+    case "fillpagename":
+      $name = (isset($_GET['name'])) ? $_GET['name'] : false;
+      if(!$name) die('userlist = new Array(); namelist = new Array(); errorstring=\'Invalid URI\'');
+      $nd = RenderMan::strToPageID($name);
+      $c = 0;
+      $u = Array();
+      $n = Array();
+      
+      $name = sanitize_page_id($name);
+      $name = str_replace('_', ' ', $name);
+      
+      for($i=0;$i<sizeof($paths->pages)/2;$i++)
+      {
+        if( ( 
+            preg_match('#'.preg_quote($name).'(.*)#i', $paths->pages[$i]['name']) ||
+            preg_match('#'.preg_quote($name).'(.*)#i', $paths->pages[$i]['urlname']) ||
+            preg_match('#'.preg_quote($name).'(.*)#i', $paths->pages[$i]['urlname_nons']) ||
+            preg_match('#'.preg_quote(str_replace(' ', '_', $name)).'(.*)#i', $paths->pages[$i]['name']) ||
+            preg_match('#'.preg_quote(str_replace(' ', '_', $name)).'(.*)#i', $paths->pages[$i]['urlname']) ||
+            preg_match('#'.preg_quote(str_replace(' ', '_', $name)).'(.*)#i', $paths->pages[$i]['urlname_nons'])
+            ) &&
+           ( ( $nd[1] != 'Article' && $paths->pages[$i]['namespace'] == $nd[1] ) || $nd[1] == 'Article' )
+            && $paths->pages[$i]['visible']
+           )
+        {
+          $c++;
+          $u[] = $paths->pages[$i]['name'];
+          $n[] = $paths->pages[$i]['urlname'];
+        }
+      }
+      if($c > 0)
+      {
+        echo 'userlist = new Array(); namelist = new Array(); errorstring = false; '."\n";
+        for($i=0;$i<sizeof($u);$i++) // Can't use foreach because we need the value of $i and we need to use both $u and $n
+        {
+          echo "userlist[$i] = '".addslashes($n[$i])."';\n";
+          echo "namelist[$i] = '".addslashes(htmlspecialchars($u[$i]))."';\n";
+        }
+      } else {
+        die('userlist = new Array(); namelist = new Array(); errorstring=\'No page matches found.\'');
+      }
+      break;
+    case "preview":
+      echo PageUtils::genPreview($_POST['text']);
+      break;
+    case "pagediff":
+      $id1 = ( isset($_GET['diff1']) ) ? (int)$_GET['diff1'] : false;
+      $id2 = ( isset($_GET['diff2']) ) ? (int)$_GET['diff2'] : false;
+      if(!$id1 || !$id2) { echo '<p>Invalid request.</p>'; $template->footer(); break; }
+      if(!preg_match('#^([0-9]+)$#', (string)$_GET['diff1']) ||
+         !preg_match('#^([0-9]+)$#', (string)$_GET['diff2']  )) { echo '<p>SQL injection attempt</p>'; $template->footer(); break; }
+      echo PageUtils::pagediff($paths->cpage['urlname_nons'], $paths->namespace, $id1, $id2);
+      break;
+    case "jsres":
+      die('// ERROR: this section is deprecated and has moved to includes/clientside/static/enano-lib-basic.js.');
+      break;
+    case "rdns":
+      if(!$session->get_permissions('mod_misc')) die('Go somewhere else for your reverse DNS info!');
+      $ip = $_GET['ip'];
+      $rdns = gethostbyaddr($ip);
+      if($rdns == $ip) echo 'Unable to get reverse DNS information. Perhaps the DNS server is down or the PTR record no longer exists.';
+      else echo $rdns;
+      break;
+    case 'acljson':
+      $parms = ( isset($_POST['acl_params']) ) ? rawurldecode($_POST['acl_params']) : false;
+      echo PageUtils::acl_json($parms);
+      break;
+    case "change_theme":
+      if ( !isset($_POST['theme_id']) || !isset($_POST['style_id']) )
+      {
+        die('Invalid input');
+      }
+      if ( !preg_match('/^([a-z0-9_-]+)$/i', $_POST['theme_id']) || !preg_match('/^([a-z0-9_-]+)$/i', $_POST['style_id']) )
+      {
+        die('Invalid input');
+      }
+      if ( !file_exists(ENANO_ROOT . '/themes/' . $_POST['theme_id'] . '/css/' . $_POST['style_id'] . '.css') )
+      {
+        die('Can\'t find theme file: ' . ENANO_ROOT . '/themes/' . $_POST['theme_id'] . '/css/' . $_POST['style_id'] . '.css');
+      }
+      if ( !$session->user_logged_in )
+      {
+        die('You must be logged in to change your theme');
+      }
+      // Just in case something slipped through...
+      $theme_id = $db->escape($_POST['theme_id']);
+      $style_id = $db->escape($_POST['style_id']);
+      $e = $db->sql_query('UPDATE ' . table_prefix . "users SET theme='$theme_id', style='$style_id' WHERE user_id=$session->user_id;");
+      if ( !$e )
+        die( $db->get_error() );
+      die('GOOD');
+      break;
+    case 'get_tags':
+      $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
+      
+      $ret = array('tags' => array(), 'user_level' => $session->user_level, 'can_add' => $session->get_permissions('tag_create'));
+      $q = $db->sql_query('SELECT t.tag_id, t.tag_name, pg.pg_target IS NOT NULL AS used_in_acl, t.user FROM '.table_prefix.'tags AS t
+        LEFT JOIN '.table_prefix.'page_groups AS pg
+          ON ( ( pg.pg_type = ' . PAGE_GRP_TAGGED . ' AND pg.pg_target=t.tag_name ) OR ( pg.pg_type IS NULL AND pg.pg_target IS NULL ) )
+        WHERE t.page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND t.namespace=\'' . $db->escape($paths->namespace) . '\';');
+      if ( !$q )
+        $db->_die();
+      
+      while ( $row = $db->fetchrow() )
+      {
+        $can_del = true;
+        
+        $perm = ( $row['user'] != $session->user_id ) ?
+                'tag_delete_other' :
+                'tag_delete_own';
+        
+        if ( $row['user'] == 1 && !$session->user_logged_in )
+          // anonymous user trying to delete tag (hardcode blacklisted)
+          $can_del = false;
+          
+        if ( !$session->get_permissions($perm) )
+          $can_del = false;
+        
+        if ( $row['used_in_acl'] == 1 && !$session->get_permissions('edit_acl') && $session->user_level < USER_LEVEL_ADMIN )
+          $can_del = false;
+        
+        $ret['tags'][] = array(
+          'id' => $row['tag_id'],
+          'name' => $row['tag_name'],
+          'can_del' => $can_del,
+          'acl' => ( $row['used_in_acl'] == 1 )
+        );
+      }
+      
+      echo $json->encode($ret);
+      
+      break;
+    case 'addtag':
+      $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
+      $resp = array(
+          'success' => false,
+          'error' => 'No error',
+          'can_del' => ( $session->get_permissions('tag_delete_own') && $session->user_logged_in ),
+          'in_acl' => false
+        );
+      
+      // first of course, are we allowed to tag pages?
+      if ( !$session->get_permissions('tag_create') )
+      {
+        $resp['error'] = 'You are not permitted to tag pages.';
+        die($json->encode($resp));
+      }
+      
+      // sanitize the tag name
+      $tag = sanitize_tag($_POST['tag']);
+      $tag = $db->escape($tag);
+      
+      if ( strlen($tag) < 2 )
+      {
+        $resp['error'] = 'Tags must consist of at least 2 alphanumeric characters.';
+        die($json->encode($resp));
+      }
+      
+      // check if tag is already on page
+      $q = $db->sql_query('SELECT 1 FROM '.table_prefix.'tags WHERE page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $db->escape($paths->namespace) . '\' AND tag_name=\'' . $tag . '\';');
+      if ( !$q )
+        $db->_die();
+      if ( $db->numrows() > 0 )
+      {
+        $resp['error'] = 'This page already has this tag.';
+        die($json->encode($resp));
+      }
+      $db->free_result();
+      
+      // tricky: make sure this tag isn't being used in some page group, and thus adding it could affect page access
+      $can_edit_acl = ( $session->get_permissions('edit_acl') || $session->user_level >= USER_LEVEL_ADMIN );
+      $q = $db->sql_query('SELECT 1 FROM '.table_prefix.'page_groups WHERE pg_type=' . PAGE_GRP_TAGGED . ' AND pg_target=\'' . $tag . '\';');
+      if ( !$q )
+        $db->_die();
+      if ( $db->numrows() > 0 && !$can_edit_acl )
+      {
+        $resp['error'] = 'This tag is used in an ACL page group, and thus can\'t be added to a page by people without administrator privileges.';
+        die($json->encode($resp));
+      }
+      $resp['in_acl'] = ( $db->numrows() > 0 );
+      $db->free_result();
+      
+      // we're good
+      $q = $db->sql_query('INSERT INTO '.table_prefix.'tags(tag_name,page_id,namespace,user) VALUES(\'' . $tag . '\', \'' . $db->escape($paths->cpage['urlname_nons']) . '\', \'' . $db->escape($paths->namespace) . '\', ' . $session->user_id . ');');
+      if ( !$q )
+        $db->_die();
+      
+      $resp['success'] = true;
+      $resp['tag'] = $tag;
+      $resp['tag_id'] = $db->insert_id();
+      
+      echo $json->encode($resp);
+      break;
+    case 'deltag':
+      
+      $tag_id = intval($_POST['tag_id']);
+      if ( empty($tag_id) )
+        die('Invalid tag ID');
+      
+      $q = $db->sql_query('SELECT t.tag_id, t.user, t.page_id, t.namespace, pg.pg_target IS NOT NULL AS used_in_acl FROM '.table_prefix.'tags AS t
+  LEFT JOIN '.table_prefix.'page_groups AS pg
+    ON ( pg.pg_id IS NULL OR ( pg.pg_target = t.tag_name AND pg.pg_type = ' . PAGE_GRP_TAGGED . ' ) )
+  WHERE t.tag_id=' . $tag_id . ';');
+      
+      if ( !$q )
+        $db->_die();
+      
+      if ( $db->numrows() < 1 )
+        die('Could not find a tag with that ID');
+      
+      $row = $db->fetchrow();
+      $db->free_result();
+      
+      if ( $row['page_id'] == $paths->cpage['urlname_nons'] && $row['namespace'] == $paths->namespace )
+        $perms =& $session;
+      else
+        $perms = $session->fetch_page_acl($row['page_id'], $row['namespace']);
+        
+      $perm = ( $row['user'] != $session->user_id ) ?
+                'tag_delete_other' :
+                'tag_delete_own';
+      
+      if ( $row['user'] == 1 && !$session->user_logged_in )
+        // anonymous user trying to delete tag (hardcode blacklisted)
+        die('You are not authorized to delete this tag.');
+        
+      if ( !$perms->get_permissions($perm) )
+        die('You are not authorized to delete this tag.');
+      
+      if ( $row['used_in_acl'] == 1 && !$perms->get_permissions('edit_acl') && $session->user_level < USER_LEVEL_ADMIN )
+        die('You are not authorized to delete this tag.');
+      
+      // We're good
+      $q = $db->sql_query('DELETE FROM '.table_prefix.'tags WHERE tag_id = ' . $tag_id . ';');
+      if ( !$q )
+        $db->_die();
+      
+      echo 'success';
+      
+      break;
+    case 'ping':
+      echo 'pong';
+      break;
+    default:
+      die('Hacking attempt');
+      break;
+  }
+  
 ?>
\ No newline at end of file
--- a/includes/clientside/static/acl.js	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/clientside/static/acl.js	Sun Nov 18 20:37:08 2007 -0500
@@ -59,7 +59,7 @@
       {
         document.getElementById(aclManagerID+'_main').innerHTML = '';
         document.getElementById(aclManagerID + '_back').style.display = 'none';
-        document.getElementById(aclManagerID + '_next').value = 'Next >';
+        document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next');
         groups = parseJSON(ajax.responseText);
         if ( groups.mode == 'error' )
         {
@@ -104,13 +104,13 @@
   grpb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'block'; document.getElementById('enACL_usrbox_'+seed).style.display = 'none'; };
   lbl = document.createElement('label');
   lbl.appendChild(grpb);
-  lbl.appendChild(document.createTextNode('A usergroup'));
+  lbl.appendChild(document.createTextNode($lang.get('acl_radio_usergroup')));
   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.'));
+  anoninfo.appendChild(document.createTextNode($lang.get('acl_msg_guest_howto')));
   span.appendChild(document.createElement('br'));
   span.appendChild(anoninfo);
   
@@ -122,7 +122,7 @@
   usrb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'none'; document.getElementById('enACL_usrbox_'+seed).style.display = 'block'; };
   lbl2 = document.createElement('label');
   lbl2.appendChild(usrb);
-  lbl2.appendChild(document.createTextNode('A specific user'));
+  lbl2.appendChild(document.createTextNode($lang.get('acl_radio_user')));
   lbl2.style.display = 'block';
   
   usrsel = document.createElement('input');
@@ -167,21 +167,21 @@
     lblPage = document.createElement('label');
       lblPage.style.display = 'block';
       lblPage.appendChild(scopeRadioPage);
-      lblPage.appendChild(document.createTextNode('Only this page'));
+      lblPage.appendChild(document.createTextNode($lang.get('acl_radio_scope_thispage')));
     lblGlobal = document.createElement('label');
       lblGlobal.style.display = 'block';
       lblGlobal.appendChild(scopeRadioGlobal);
-      lblGlobal.appendChild(document.createTextNode('The entire website'));
+      lblGlobal.appendChild(document.createTextNode($lang.get('acl_radio_scope_wholesite')));
     lblGroup = document.createElement('label');
       lblGroup.style.display = 'block';
       lblGroup.appendChild(scopeRadioGroup);
-      lblGroup.appendChild(document.createTextNode('A group of pages'));
+      lblGroup.appendChild(document.createTextNode($lang.get('acl_radio_scope_pagegroup')));
     scopediv1.appendChild(lblPage);
     scopediv2.appendChild(lblGroup);
     scopediv3.appendChild(lblGlobal);
     
     scopedesc = document.createElement('p');
-    scopedesc.appendChild(document.createTextNode('What should this access rule control?'));
+    scopedesc.appendChild(document.createTextNode($lang.get('acl_lbl_scope')));
     
     scopePGrp = document.createElement('select');
     scopePGrp.style.marginLeft = '13px';
@@ -219,10 +219,10 @@
   container.style.paddingTop = '50px';
   
   head = document.createElement('h2');
-  head.appendChild(document.createTextNode('Manage page access'));
+  head.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_title')));
   
   desc = document.createElement('p');
-  desc.appendChild(document.createTextNode('Please select who should be affected by this access rule.'));
+  desc.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_body')));
   
   container.appendChild(head);
   container.appendChild(desc);
@@ -319,11 +319,14 @@
             
             // Build the ACL edit form
             // try {
-              act_desc = ( data.type == 'new' ) ? 'Create access rule' : 'Editing permissions';
-              target_type_t = ( data.target_type == 1 ) ? 'group' : 'user';
-              target_name_t = data.target_name;
-              var scope_type = ( data.page_id == false && data.namespace == false ) ? 'this entire site' : ( data.namespace == '__PageGroup' ) ? 'this group of pages' : 'this page';
-              html = '<h2>'+act_desc+'</h2><p>This panel allows you to edit what the '+target_type_t+' "<b>'+target_name_t+'</b>" can do on <b>' + scope_type + '</b>. Unless you set a permission to "Deny", these permissions may be overridden by other rules.</p>';
+            
+              var act_desc = ( data.type == 'new' ) ? $lang.get('acl_lbl_editwin_title_create') : $lang.get('acl_lbl_editwin_title_edit');
+              var target_type_t = ( data.target_type == 1 ) ? $lang.get('acl_target_type_group') : $lang.get('acl_target_type_user');
+              var target_name_t = data.target_name;
+              var scope_type = ( data.page_id == false && data.namespace == false ) ? $lang.get('acl_scope_type_wholesite') : ( data.namespace == '__PageGroup' ) ? $lang.get('acl_scope_type_pagegroup') : $lang.get('acl_scope_type_thispage');
+              
+              html = '<h2>'+act_desc+'</h2>';
+              html += '<p>' + $lang.get('acl_lbl_editwin_body', { target_type: target_type_t, target: target_name_t, scope_type: scope_type }) + '</p>';
               parser = new templateParser(data.template.acl_field_begin);
               html += parser.run();
               
@@ -335,7 +338,14 @@
                   cls = ( cls == 'row1' ) ? 'row2' : 'row1';
                   p = new templateParser(data.template.acl_field_item);
                   vars = new Object();
-                  vars['FIELD_DESC'] = data.acl_descs[i];
+                  if ( data.acl_descs[i].match(/^([a-z0-9_]+)$/) )
+                  {
+                    vars['FIELD_DESC'] = $lang.get(data.acl_descs[i]);
+                  }
+                  else
+                  {
+                    vars['FIELD_DESC'] = data.acl_descs[i];
+                  }
                   vars['FIELD_DENY_CHECKED'] = '';
                   vars['FIELD_DISALLOW_CHECKED'] = '';
                   vars['FIELD_WIKIMODE_CHECKED'] = '';
@@ -367,7 +377,7 @@
               html += parser.run();
               
               if(data.type == 'edit')
-                html += '<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>';
+                html += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'' + $lang.get('acl_msg_deleterule_confirm') + '\')) __aclDeleteRule(); return false;" style="color: red;">' + $lang.get('acl_lbl_deleterule') + '</a></p>';
               
               var main = document.getElementById(aclManagerID + '_main');
               main.innerHTML = html;
@@ -383,7 +393,7 @@
               aclPermList = array_keys(data.acl_types);
               
               document.getElementById(aclManagerID + '_back').style.display = 'inline';
-              document.getElementById(aclManagerID + '_next').value = 'Save Changes';
+              document.getElementById(aclManagerID + '_next').value = $lang.get('etc_save_changes');
               
             // } catch(e) { alert(e); aclDebug(ajax.responseText); }
             
@@ -393,24 +403,24 @@
             note.className = 'info-box';
             note.style.marginLeft = '0';
             var b = document.createElement('b');
-            b.appendChild(document.createTextNode('Permissions updated'));
+            b.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_title')));
             note.appendChild(b);
             note.appendChild(document.createElement('br'));
-            note.appendChild(document.createTextNode('The permissions for '+data.target_name+' on this page have been updated successfully. If you changed permissions that affect your user account, you may not see changes until you reload the page.'));
+            note.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_body', { target_name: data.target_name })));
             note.appendChild(document.createElement('br'));
             var a = document.createElement('a');
             a.href = 'javascript:void(0);';
             a.onclick = function() { this.parentNode.parentNode.removeChild(this.parentNode); return false; };
-            a.appendChild(document.createTextNode('[ dismiss :'));
+            a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :'));
             note.appendChild(a);
             var a2 = document.createElement('a');
             a2.href = 'javascript:void(0);';
             a2.onclick = function() { killACLManager(); return false; };
-            a2.appendChild(document.createTextNode(': close manager ]'));
+            a2.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]'));
             note.appendChild(a2);
             document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild);
             if(!document.getElementById(aclManagerID+'_deletelnk'))
-              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>';
+              document.getElementById(aclManagerID + '_main').innerHTML += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'' + $lang.get('acl_msg_deleterule_confirm') + '\')) __aclDeleteRule(); return false;" style="color: red;">' + $lang.get('acl_lbl_deleterule') + '</a></p>';
             //fadeInfoBoxes();
             document.getElementById(aclManagerID+'_main').scrollTop = 0;
             
@@ -428,7 +438,7 @@
               {
                 document.getElementById(aclManagerID+'_main').innerHTML = '';
                 document.getElementById(aclManagerID + '_back').style.display = 'none';
-                document.getElementById(aclManagerID + '_next').value = 'Next >';
+                document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next');
                 var thispage = strToPageID(title);
                 groups.page_id = thispage[0];
                 groups.namespace = thispage[1];
@@ -441,20 +451,20 @@
                 note.style.width = '558px';
                 note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000);
                 b = document.createElement('b');
-                b.appendChild(document.createTextNode('Entry deleted'));
+                b.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_title')));
                 note.appendChild(b);
                 note.appendChild(document.createElement('br'));
-                note.appendChild(document.createTextNode('The access rules for '+aclDataCache.target_name+' on this page have been deleted.'));
+                note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_title', { target_name: aclDataCache.target_name })));
                 note.appendChild(document.createElement('br'));
                 a = document.createElement('a');
                 a.href = '#';
                 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 :'));
+                a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :'));
                 note.appendChild(a);
                 a = document.createElement('a');
                 a.href = '#';
                 a.onclick = function() { killACLManager(); return false; };
-                a.appendChild(document.createTextNode(': close manager ]'));
+                a.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]'));
                 note.appendChild(a);
                 document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild);
                 //fadeInfoBoxes();
@@ -542,7 +552,7 @@
   
   back = document.createElement('input');
   back.type = 'button';
-  back.value = '< Back';
+  back.value = $lang.get('etc_wizard_back');
   back.style.fontWeight = 'normal';
   back.onclick = function() { ajaxACLSwitchToSelector(); return false; };
   back.style.display = 'none';
@@ -550,14 +560,14 @@
   
   saver = document.createElement('input');
   saver.type = 'submit';
-  saver.value = 'Next >';
+  saver.value = $lang.get('etc_wizard_next');
   saver.style.fontWeight = 'bold';
   saver.id = aclManagerID + '_next';
   
   closer = document.createElement('input');
   closer.type = 'button';
-  closer.value = 'Cancel Changes';
-  closer.onclick = function() { if(!confirm('Do you really want to close the ACL manager?')) return false; killACLManager(); return false; }
+  closer.value = $lang.get('etc_cancel_changes');
+  closer.onclick = function() { if(!confirm($lang.get('acl_msg_closeacl_confirm'))) return false; killACLManager(); return false; }
   
   spacer1 = document.createTextNode('  ');
   spacer2 = document.createTextNode('  ');
@@ -624,7 +634,7 @@
       var target_type = parseInt(getRadioState(thefrm, 'target_type', ['1', '2']));
       if(isNaN(target_type))
       {
-        alert('Please select a target type.');
+        alert($lang.get('acl_err_pleaseselect_targettype'));
         return false;
       }
       target_id = ( target_type == 1 ) ? parseInt(thefrm.group_id.value) : thefrm.username.value;
@@ -666,7 +676,7 @@
       }
       if(target_id == '')
       {
-        alert('Please enter a username.');
+        alert($lang.get('acl_err_pleaseselect_username'));
         return false;
       }
       __aclJSONSubmitAjaxHandler(obj);
--- a/includes/clientside/static/ajax.js	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/clientside/static/ajax.js	Sun Nov 18 20:37:08 2007 -0500
@@ -71,7 +71,7 @@
       if(ajax.readyState == 4) {
         unsetAjaxLoading();
         if(edit_open) {
-          c=confirm('Do you really want to revert your changes?');
+          c=confirm($lang.get('editor_msg_revert_confirm'));
           if(!c) return;
         }
         edit_open = true;
@@ -82,18 +82,18 @@
           // Allow the textarea grippifier to re-create the resizer control on the textarea
           grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas));
         }
-        disableUnload('If you do, any changes that you have made to this page will be lost.');
+        disableUnload($lang.get('editor_msg_unload'));
         var switcher = ( readCookie('enano_editor_mode') == 'tinymce' ) ?
-                        '<a href="#" onclick="setEditorText(); return false;">wikitext editor</a>  |  graphical editor' :
-                        'wikitext editor  |  <a href="#" onclick="setEditorMCE(); return false;">graphical editor</a>' ;
+                        '<a href="#" onclick="setEditorText(); return false;">' + $lang.get('editor_btn_wikitext') + '</a>  |  ' + $lang.get('editor_btn_graphical') :
+                        $lang.get('editor_btn_wikitext') + '  |  <a href="#" onclick="setEditorMCE(); return false;">' + $lang.get('editor_btn_graphical') + '</a>' ;
         document.getElementById('ajaxEditContainer').innerHTML = '\
         <div id="mdgPreviewContainer"></div> \
         <span id="switcher">' + switcher + '</span><br />\
         <form name="mdgAjaxEditor" method="get" action="#" onsubmit="ajaxSavePage(); return false;">\
         <textarea id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\
-          Edit summary: <input id="ajaxEditSummary" size="40" /><br />\
-          <input id="ajaxEditMinor" name="minor" type="checkbox" /> <label for="ajaxEditMinor">This is a minor edit</label><br />\
-          <a href="#" onclick="void(ajaxSavePage()); return false;">save changes</a>  |  <a href="#" onclick="void(ajaxShowPreview()); return false;">preview changes</a>  |  <a href="#" onclick="void(ajaxEditor()); return false;">revert changes</a>  |  <a href="#" onclick="void(ajaxDiscard()); return false;">discard changes</a>\
+          ' + $lang.get('editor_lbl_edit_summary') + ' <input id="ajaxEditSummary" size="40" /><br />\
+          <input id="ajaxEditMinor" name="minor" type="checkbox" /> <label for="ajaxEditMinor">' + $lang.get('editor_lbl_minor_edit') + '</label><br />\
+          <a href="#" onclick="void(ajaxSavePage()); return false;">' + $lang.get('editor_btn_save') + '</a>  |  <a href="#" onclick="void(ajaxShowPreview()); return false;">' + $lang.get('editor_btn_preview') + '</a>  |  <a href="#" onclick="void(ajaxEditor()); return false;">' + $lang.get('editor_btn_revert') + '</a>  |  <a href="#" onclick="void(ajaxDiscard()); return false;">' + $lang.get('editor_btn_cancel') + '</a>\
           <br />\
           '+editNotice+'\
         </form>';
@@ -110,14 +110,14 @@
 {
   $('ajaxEditArea').switchToMCE();
   createCookie('enano_editor_mode', 'tinymce', 365);
-  $('switcher').object.innerHTML = '<a href="#" onclick="setEditorText(); return false;">wikitext editor</a>  |  graphical editor';
+  $('switcher').object.innerHTML = '<a href="#" onclick="setEditorText(); return false;">' + $lang.get('editor_btn_wikitext') + '</a>  |  ' + $lang.get('editor_btn_graphical');
 }
 
 function setEditorText()
 {
   $('ajaxEditArea').destroyMCE();
   createCookie('enano_editor_mode', 'text', 365);
-  $('switcher').object.innerHTML = 'wikitext editor  |  <a href="#" onclick="setEditorMCE(); return false;">graphical editor</a>';
+  $('switcher').object.innerHTML = $lang.get('editor_btn_wikitext') + '  |  <a href="#" onclick="setEditorMCE(); return false;">' + $lang.get('editor_btn_graphical') + '</a>';
 }
 
 function ajaxViewSource()
@@ -129,11 +129,7 @@
   ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() {
       if(ajax.readyState == 4) {
         unsetAjaxLoading();
-        if(edit_open) {
-          c=confirm('Do you really want to revert your changes?');
-          if(!c) return;
-        }
-        edit_open = true;
+        edit_open = false;
         selectButtonMajor('article');
         selectButtonMinor('edit');
         if(in_array('ajaxEditArea', grippied_textareas))
@@ -144,7 +140,7 @@
         document.getElementById('ajaxEditContainer').innerHTML = '\
           <form method="get" action="#" onsubmit="ajaxSavePage(); return false;">\
             <textarea readonly="readonly" id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\
-            <a href="#" onclick="void(ajaxReset()); return false;">close viewer</a>\
+            <a href="#" onclick="void(ajaxReset()); return false;">' + $lang.get('editor_btn_closeviewer') + '</a>\
           </form>';
         initTextareas();
       }
@@ -194,7 +190,7 @@
   // IE <6 pseudo-compatibility
   if ( KILL_SWITCH )
     return true;
-  c = confirm('Do you really want to discard your changes?');
+  c = confirm($lang.get('editor_msg_discard_confirm'));
   if(!c) return;
   ajaxReset();
 }
@@ -204,6 +200,9 @@
   // IE <6 pseudo-compatibility
   if ( KILL_SWITCH )
     return true;
+  var ns_id = strToPageID(title);
+  if ( ns_id[1] == 'Special' || ns_id[1] == 'Admin' )
+    return false;
   enableUnload();
   setAjaxLoading();
   ajaxGet(stdAjaxPrefix+'&_mode=getpage&noheaders', function() {
@@ -226,7 +225,7 @@
   if(shift) {
     r = 'NO_REASON';
   } else {
-    r = prompt('Reason for (un)protecting:');
+    r = prompt($lang.get('ajax_protect_prompt_reason'));
     if(!r || r=='') return;
   }
   setAjaxLoading();
@@ -248,7 +247,7 @@
   // IE <6 pseudo-compatibility
   if ( KILL_SWITCH )
     return true;
-  r = prompt('What title should this page be renamed to?\nNote: This does not and will never change the URL of this page, that must be done from the admin panel.');
+  r = prompt($lang.get('ajax_rename_prompt'));
   if(!r || r=='') return;
   setAjaxLoading();
   ajaxPost(stdAjaxPrefix+'&_mode=rename', 'newtitle='+escape(r), function() {
@@ -278,12 +277,12 @@
   // IE <6 pseudo-compatibility
   if ( KILL_SWITCH )
     return true;
-  var reason = prompt('Please enter your reason for deleting this page.');
+  var reason = prompt($lang.get('ajax_delete_prompt_reason'));
   if ( !reason || reason == '' )
   {
     return false;
   }
-  c = confirm('You are about to REVERSIBLY delete this page. Do you REALLY want to do this?\n\n(Comments and categorization data, as well as any attached files, will be permanently lost)');
+  c = confirm($lang.get('ajax_delete_confirm'));
   if(!c)
   {
     return;
@@ -303,7 +302,7 @@
   // IE <6 pseudo-compatibility
   if ( KILL_SWITCH )
     return true;
-  c = confirm('Are you sure that you want to vote that this page be deleted?');
+  c = confirm($lang.get('ajax_delvote_confirm'));
   if(!c) return;
   setAjaxLoading();
   ajaxGet(stdAjaxPrefix+'&_mode=delvote', function() {
@@ -319,7 +318,7 @@
   // IE <6 pseudo-compatibility
   if ( KILL_SWITCH )
     return true;
-  c = confirm('This will reset the number of votes against this page to zero. Do you really want to do this?');
+  c = confirm($lang.get('ajax_delvote_reset_confirm'));
   if(!c) return;
   setAjaxLoading();
   ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function() {
@@ -457,9 +456,9 @@
   // IE <6 pseudo-compatibility
   if ( KILL_SWITCH )
     return true;
-  c = confirm('You are about to DESTROY all log entries for this page. As opposed to (example) deleting this page, this action is completely IRREVERSIBLE and should not be used except in dire circumstances. Do you REALLY want to do this?');
+  c = confirm($lang.get('ajax_clearlogs_confirm'));
   if(!c) return;
-  c = confirm('You\'re ABSOLUTELY sure???');
+  c = confirm($lang.get('ajax_clearlogs_confirm_nag'));
   if(!c) return;
   setAjaxLoading();
   ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() {
@@ -563,13 +562,13 @@
   if ( KILL_SWITCH )
     return true;
   var inner_html = '';
-  inner_html += '<p><label>Theme: ';
+  inner_html += '<p><label>' + $lang.get('ajax_changestyle_lbl_theme') + ' ';
   inner_html += '  <select id="chtheme_sel_theme" onchange="ajaxGetStyles(this.value);">';
-  inner_html += '    <option value="_blank" selected="selected">[Select]</option>';
+  inner_html += '    <option value="_blank" selected="selected">' + $lang.get('ajax_changestyle_select') + '</option>';
   inner_html +=      ENANO_THEME_LIST;
   inner_html += '  </select>';
   inner_html += '</label></p>';
-  var chtheme_mb = new messagebox(MB_OKCANCEL|MB_ICONQUESTION, 'Change your theme', inner_html);
+  var chtheme_mb = new messagebox(MB_OKCANCEL|MB_ICONQUESTION, $lang.get('ajax_changestyle_title'), inner_html);
   chtheme_mb.onbeforeclick['OK'] = ajaxChangeStyleComplete;
 }
 
@@ -614,7 +613,7 @@
         var p_parent = document.createElement('p');
         var label  = document.createElement('label');
         p_parent.id = 'chtheme_sel_style_parent';
-        label.appendChild(document.createTextNode('Style: '));
+        label.appendChild(document.createTextNode($lang.get('ajax_changestyle_lbl_style') + ' '));
         var select = document.createElement('select');
         select.id = 'chtheme_sel_style';
         for ( var i in options )
@@ -643,7 +642,7 @@
   var style = $('chtheme_sel_style');
   if ( !theme.object || !style.object )
   {
-    alert('Please select a theme from the list.');
+    alert($lang.get('ajax_changestyle_pleaseselect_theme'));
     return true;
   }
   var theme_id = theme.object.value;
@@ -667,7 +666,7 @@
       {
         if ( ajax.responseText == 'GOOD' )
         {
-          var c = confirm('Your theme preference has been changed.\nWould you like to reload the page now to see the changes?');
+          var c = confirm($lang.get('ajax_changestyle_success'));
           if ( c )
             window.location.reload();
         }
@@ -876,7 +875,7 @@
   // IE <6 pseudo-compatibility
   if ( KILL_SWITCH )
     return true;
-  if ( !confirm('Are you really sure you want to do this? Some pages might not function if this emergency-only feature is activated.') )
+  if ( !confirm($lang.get('ajax_killphp_confirm')) )
     return false;
   var $killdiv = $dynano('php_killer');
   if ( !$killdiv.object )
@@ -897,7 +896,7 @@
           var newdiv = document.createElement('div');
           // newdiv.style = $killdiv.object.style;
           newdiv.className = $killdiv.object.className;
-          newdiv.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />Embedded PHP in pages has been disabled.';
+          newdiv.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />' + $lang.get('ajax_killphp_success');
           $killdiv.object.parentNode.appendChild(newdiv);
           $killdiv.object.parentNode.removeChild($killdiv.object);
         }
@@ -934,14 +933,14 @@
         if ( !catbox )
           return false;
         var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
-        linkbox.firstChild.nodeValue = 'show page categorization';
+        linkbox.firstChild.nodeValue = $lang.get('catedit_catbox_link_showcategorization');
         linkbox.onclick = function() { ajaxTagToCat(); return false; };
         catHTMLBuf = catbox.innerHTML;
         catbox.innerHTML = '';
-        catbox.appendChild(document.createTextNode('Page tags: '));
+        catbox.appendChild(document.createTextNode($lang.get('tags_lbl_page_tags')+' '));
         if ( json.tags.length < 1 )
         {
-          catbox.appendChild(document.createTextNode('No tags on this page'));
+          catbox.appendChild(document.createTextNode($lang.get('tags_lbl_no_tags')));
         }
         for ( var i = 0; i < json.tags.length; i++ )
         {
@@ -965,7 +964,7 @@
           var addlink = document.createElement('a');
           addlink.href = '#';
           addlink.onclick = function() { try { ajaxAddTagStage1(); } catch(e) { }; return false; };
-          addlink.appendChild(document.createTextNode('(add a tag)'));
+          addlink.appendChild(document.createTextNode($lang.get('tags_btn_add_tag')));
           catbox.appendChild(addlink);
         }
       }
@@ -984,7 +983,7 @@
   var addlink = document.createElement('a');
   addlink.href = '#';
   addlink.onclick = function() { ajaxAddTagStage2(this.parentNode.firstChild.nextSibling.value, this.parentNode); return false; };
-  addlink.appendChild(document.createTextNode('+ Add'));
+  addlink.appendChild(document.createTextNode($lang.get('tags_btn_add')));
   text.type = 'text';
   text.size = '15';
   text.onkeyup = function(e)
@@ -996,7 +995,7 @@
   }
   
   adddiv.style.margin = '5px 0 0 0';
-  adddiv.appendChild(document.createTextNode('Add a tag: '));
+  adddiv.appendChild(document.createTextNode($lang.get('tags_lbl_add_tag')+' '));
   adddiv.appendChild(text);
   adddiv.appendChild(document.createTextNode(' '));
   adddiv.appendChild(addlink);
@@ -1038,7 +1037,7 @@
           var node = parent.childNodes[1];
           var insertafter = false;
           var nukeafter = false;
-          if ( node.nodeValue == 'No tags on this page' )
+          if ( node.nodeValue == $lang.get('tags_lbl_no_tags') )
           {
             nukeafter = true;
           }
@@ -1079,12 +1078,12 @@
   var writeNoTags = false;
   if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == ', ' )
     arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling);
-  else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' )
+  else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' )
     arrDelete.push(parentobj.nextSibling);
   
-  if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' &&
+  if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' &&
        parentobj.nextSibling.nextSibling.firstChild )
-    if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == '(add a tag)')
+    if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == $lang.get('tags_btn_add_tag'))
       writeNoTags = true;
     
   ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function()
@@ -1102,7 +1101,7 @@
           }
           if ( writeNoTags )
           {
-            var node1 = document.createTextNode('No tags on this page');
+            var node1 = document.createTextNode($lang.get('tags_lbl_no_tags'));
             var node2 = document.createTextNode(' ');
             insertAfter(parent, node1, parent.firstChild);
             insertAfter(parent, node2, node1);
@@ -1125,7 +1124,7 @@
     return false;
   addtag_open = false;
   var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
-  linkbox.firstChild.nodeValue = 'show page tags';
+  linkbox.firstChild.nodeValue = $lang.get('tags_catbox_link');
   linkbox.onclick = function() { ajaxCatToTag(); return false; };
   catbox.innerHTML = catHTMLBuf;
   catHTMLBuf = false;
@@ -1148,7 +1147,7 @@
     if ( keepalive_interval )
       clearInterval(keepalive_interval);
     var span = document.getElementById('keepalivestat');
-    span.firstChild.nodeValue = 'Turn on keep-alive';
+    span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off');
   }
   else
   {
@@ -1156,7 +1155,7 @@
     if ( !keepalive_interval )
       keepalive_interval = setInterval('ajaxPingServer();', 600000);
     var span = document.getElementById('keepalivestat');
-    span.firstChild.nodeValue = 'Turn off keep-alive';
+    span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on');
     ajaxPingServer();
   }
 }
@@ -1168,19 +1167,50 @@
     if ( !keepalive_interval )
       keepalive_interval = setInterval('ajaxPingServer();', 600000);
     var span = document.getElementById('keepalivestat');
-    span.firstChild.nodeValue = 'Turn off keep-alive';
+    span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on');
   }
   else
   {
     if ( keepalive_interval )
       clearInterval(keepalive_interval);
     var span = document.getElementById('keepalivestat');
-    span.firstChild.nodeValue = 'Turn on keep-alive';
+    span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off');
   }
 };
 
 function aboutKeepAlive()
 {
-  new messagebox(MB_OK|MB_ICONINFORMATION, 'About the keep-alive feature', 'Keep-alive is a new Enano feature that keeps your administrative session from timing out while you are using the administration panel. This feature can be useful if you are editing a large page or doing something in the administration interface that will take longer than 15 minutes.<br /><br />For security reasons, Enano mandates that high-privilege logins last only 15 minutes, with the time being reset each time a page is loaded (or, more specifically, each time the session API is started). The consequence of this is that if you are performing an action in the administration panel that takes more than 15 minutes, your session may be terminated. The keep-alive feature attempts to relieve this by sending a "ping" to the server every 10 minutes.<br /><br />Please note that keep-alive state is determined by a cookie. Thus, if you log out and then back in as a different administrator, keep-alive will use the same setting that was used when you were logged in as the first administrative user. In the same way, if you log into the administration panel under your account from another computer, keep-alive will be set to "off".<br /><br /><b>For more information:</b><br /><a href="http://docs.enanocms.org/Help:Appendix_B" onclick="window.open(this.href); return false;">Overview of Enano'+"'"+'s security model');
+  new messagebox(MB_OK|MB_ICONINFORMATION, $lang.get('user_keepalive_info_title'), $lang.get('user_keepalive_info_body'));
 }
 
+function ajaxShowCaptcha(code)
+{
+  var mydiv = document.createElement('div');
+  mydiv.style.backgroundColor = '#FFFFFF';
+  mydiv.style.padding = '10px';
+  mydiv.style.position = 'absolute';
+  mydiv.style.top = '0px';
+  mydiv.id = 'autoCaptcha';
+  mydiv.style.zIndex = String( getHighestZ() + 1 );
+  var img = document.createElement('img');
+  img.onload = function()
+  {
+    if ( this.loaded )
+      return true;
+    var mydiv = document.getElementById('autoCaptcha');
+    var width = getWidth();
+    var divw = $(mydiv).Width();
+    var left = ( width / 2 ) - ( divw / 2 );
+    mydiv.style.left = left + 'px';
+    fly_in_top(mydiv, false, true);
+    this.loaded = true;
+  };
+  img.src = makeUrlNS('Special', 'Captcha/' + code);
+  img.onclick = function() { this.src = this.src + '/a'; };
+  img.style.cursor = 'pointer';
+  mydiv.appendChild(img);
+  domObjChangeOpac(0, mydiv);
+  var body = document.getElementsByTagName('body')[0];
+  body.appendChild(mydiv);
+}
+
--- a/includes/clientside/static/comments.js	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/clientside/static/comments.js	Sun Nov 18 20:37:08 2007 -0500
@@ -48,7 +48,7 @@
           annihiliateComment(response.id);
           break;
         case 'materialize':
-          alert('Your comment has been posted. If it does not appear right away, it is probably awaiting approval.');
+          alert($lang.get('comment_msg_comment_posted'));
           hideCommentForm();
           materializeComment(response);
           break;
@@ -70,36 +70,43 @@
   
   // Header
   
-    html += '<h3>Article Comments</h3>';
+    html += '<h3>' + $lang.get('comment_heading') + '</h3>';
     
-    var ns = ( strToPageID(title)[1]=='Article' ) ? 'article' : ( strToPageID(title)[1].toLowerCase() ) + ' page';
+    var ns = ENANO_PAGE_TYPE;
   
     // Counters
     if ( data.auth_mod_comments )
     {
       var cnt = ( data.auth_mod_comments ) ? data.count_total : data.count_appr;
-      if ( cnt == 0 ) cnt = 'no';
-      var s  = ( cnt == 1 ) ? '' : 's';
-      var is = ( cnt == 1 ) ? 'is' : 'are';
-      html += "<p id=\"comment_status\">There "+is+" " + cnt + " comment"+s+" on this "+ns+".";
+      
+      var subst = {
+        num_comments: cnt,
+        page_type: ns
+      }
+      var count_msg = ( cnt == 0 ) ? $lang.get('comment_msg_count_zero', subst) : ( ( cnt == 1 ) ? $lang.get('comment_msg_count_one', subst) : $lang.get('comment_msg_count_plural', subst) );
+      
+      html += "<p id=\"comment_status\"><span>" + count_msg + '</span>';
       if ( data.count_unappr > 0 )
       {
-        html += ' <span style="color: #D84308">' + data.count_unappr + ' of those are unapproved.</span>';
+        html += ' <span style="color: #D84308" id="comment_status_unapp">' + $lang.get('comment_msg_count_unapp_mod', { num_unapp: data.count_unappr }) + '</span>';
       }
       html += '</p>';
     }
     else
     {
       var cnt = data.count_appr;
-      if ( cnt == 0 ) cnt = 'no';
-      var s  = ( cnt == 1 ) ? '' : 's';
-      var is = ( cnt == 1 ) ? 'is' : 'are';
-      html += "<p id=\"comment_status\">There "+is+" " + cnt + " comment"+s+" on this "+ns+".";
+      
+      var subst = {
+        num_comments: cnt,
+        page_type: ns
+      }
+      var count_msg = ( cnt == 0 ) ? $lang.get('comment_msg_count_zero', subst) : ( ( cnt == 1 ) ? $lang.get('comment_msg_count_one', subst) : $lang.get('comment_msg_count_plural', subst) );
+      
+      html += "<p id=\"comment_status\">" + count_msg;
       if ( data.count_unappr > 0 )
       {
-        var s  = ( data.count_unappr == 1 ) ? '' : 's';
-        var is = ( data.count_unappr == 1 ) ? 'is' : 'are';
-        html += ' However, there '+is+' '+data.count_unappr+' additional comment'+s+' awaiting approval.';
+        var unappr_msg  = ( data.count_unappr == 1 ) ? $lang.get('comment_msg_count_unapp_one') : $lang.get('comment_msg_count_unapp_plural', { num_unapp: data.count_unappr });
+        html += ' ' + unappr_msg;
       }
       html += '</p>';
     }
@@ -118,28 +125,28 @@
     
     // Posting form
   
-    html += '<h3>Got something to say?</h3>';
-    html += '<p>If you have comments or suggestions on this article, you can shout it out here.';
+    html += '<h3>' + $lang.get('comment_postform_title') + '</h3>';
+    html += '<p>' + $lang.get('comment_postform_blurb');
     if ( data.approval_needed )
-      html+=' Before your post will be visible to the public, a moderator will have to approve it.';
-    html += ' <a id="leave_comment_button" href="#" onclick="displayCommentForm(); return false;">Leave a comment...</a></p>';
+      html+=' ' + $lang.get('comment_postform_blurb_unapp');
+    html += ' <a id="leave_comment_button" href="#" onclick="displayCommentForm(); return false;">' + $lang.get('comment_postform_blurb_link') + '</a></p>';
     html += '<div id="comment_form" style="display: none;">';
     html += '  <table border="0">';
-    html += '    <tr><td>Your name/screen name:</td><td>';
+    html += '    <tr><td>' + $lang.get('comment_postform_field_name') + '</td><td>';
     if ( data.user_id > 1 ) html += data.username + '<input id="commentform_name" type="hidden" value="'+data.username+'" size="40" />';
     else html += '<input id="commentform_name" type="text" size="40" />';
     html += '    </td></tr>';
-    html += '    <tr><td>Comment subject:</td><td><input id="commentform_subject" type="text" size="40" /></td></tr>';
-    html += '    <tr><td>Comment:</td><td><textarea id="commentform_message" rows="15" cols="50"></textarea></td></tr>';
+    html += '    <tr><td>' + $lang.get('comment_postform_field_subject') + '</td><td><input id="commentform_subject" type="text" size="40" /></td></tr>';
+    html += '    <tr><td>' + $lang.get('comment_postform_field_comment') + '</td><td><textarea id="commentform_message" rows="15" cols="50"></textarea></td></tr>';
     if ( !data.logged_in && data.guest_posting == '1' )
     {
-      html += '  <tr><td>Visual confirmation:<br /><small>Please enter the confirmation code seen in the image on the right into the box. If you cannot read the code, please click on the image to generate a new one. This helps to prevent automated bot posting.</small></td><td>';
+      html += '  <tr><td>' + $lang.get('comment_postform_field_captcha_title') + '<br /><small>' + $lang.get('comment_postform_field_captcha_blurb') + '</small></td><td>';
       html += '  <img alt="CAPTCHA image" src="'+makeUrlNS('Special', 'Captcha/' + data.captcha)+'" onclick="this.src=\''+makeUrlNS('Special', 'Captcha/' + data.captcha)+'/\'+Math.floor(Math.random()*10000000);" style="cursor: pointer;" /><br />';
-      html += '  Confirmation code: <input type="text" size="8" id="commentform_captcha" />';
+      html += '  ' + $lang.get('comment_postform_field_captcha_label') + ' <input type="text" size="8" id="commentform_captcha" />';
       html += '  <!-- This input is used to track the ID of the CAPTCHA image --> <input type="hidden" id="commentform_captcha_id" value="'+data.captcha+'" />';
       html += '  </td></tr>';
     }
-    html += '    <tr><td colspan="2" style="text-align: center;"><input type="button" onclick="submitComment();" value="Submit comment" /></td></tr>';
+    html += '    <tr><td colspan="2" style="text-align: center;"><input type="button" onclick="submitComment();" value="' + $lang.get('comment_postform_btn_submit') + '" /></td></tr>';
     html += '  </table>';
     html += '</div>';
     
@@ -171,7 +178,7 @@
   tplvars.SIGNATURE = this_comment.signature;
   
   if ( this_comment.approved != '1' )
-    tplvars.SUBJECT += ' <span style="color: #D84308">(Unapproved)</span>';
+    tplvars.SUBJECT += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>';
   
   // Name
   tplvars.NAME = this_comment.name;
@@ -179,29 +186,29 @@
     tplvars.NAME = '<a href="' + makeUrlNS('User', this_comment.name) + '">' + this_comment.name + '</a>';
   
   // User level
-  tplvars.USER_LEVEL = 'Guest';
-  if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = 'Member';
-  if ( this_comment.user_level >= data.user_level.mod )    tplvars.USER_LEVEL = 'Moderator';
-  if ( this_comment.user_level >= data.user_level.admin )  tplvars.USER_LEVEL = 'Administrator';
-                              
+  tplvars.USER_LEVEL = $lang.get('user_type_guest');
+  if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = $lang.get('user_type_member');
+  if ( this_comment.user_level >= data.user_level.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod');
+  if ( this_comment.user_level >= data.user_level.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin');
+  
   // Send PM link
-  tplvars.SEND_PM_LINK=(this_comment.user_id>1 && data.logged_in)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( this_comment.name.replace(/ /g, '_') )) +'">Send private message</a><br />':'';
+  tplvars.SEND_PM_LINK=(this_comment.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( this_comment.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_send_privmsg') + '</a><br />':'';
   
   // Add buddy link
-  tplvars.ADD_BUDDY_LINK=(this_comment.user_id>1 && data.logged_in && this_comment.is_buddy != 1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( this_comment.name.replace(/ /g, '_') )) +'">Add to buddy list</a><br />':'';
+  tplvars.ADD_BUDDY_LINK=(this_comment.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( this_comment.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_add_buddy') + '</a><br />':'';
   
   // Edit link
-  tplvars.EDIT_LINK='<a href="#edit_'+i+'" onclick="editComment(\''+i+'\', this); return false;" id="cmteditlink_'+i+'">edit</a>';
+  tplvars.EDIT_LINK='<a href="#edit_'+i+'" onclick="editComment(\''+i+'\', this); return false;" id="cmteditlink_'+i+'">' + $lang.get('comment_btn_edit') + '</a>';
   
   // Delete link
-  tplvars.DELETE_LINK='<a href="#delete_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">delete</a>';
+  tplvars.DELETE_LINK='<a href="#delete_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_delete') + '</a>';
   
   // Moderation: (Un)approve link
-  var appr = ( this_comment.approved == 1 ) ? 'Unapprove' : 'Approve';
+  var appr = ( this_comment.approved == 1 ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve');
   tplvars.MOD_APPROVE_LINK='<a href="#approve_'+i+'" id="comment_approve_'+i+'" onclick="approveComment(\''+i+'\'); return false;">'+appr+'</a>';
   
   // Moderation: Delete post link
-  tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">Delete</a>';
+  tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_mod_delete') + '</a>';
   
   var tplbool = new Object();
   
@@ -212,9 +219,9 @@
   tplbool.is_foe = ( this_comment.is_buddy == 1 && this_comment.is_friend == 0 );
   
   if ( tplbool.is_friend )
-    tplvars.USER_LEVEL += '<br /><b>On your friend list</b>';
+    tplvars.USER_LEVEL += '<br /><b>' + $lang.get('comment_on_friend_list') + '</b>';
   else if ( tplbool.is_foe )
-    tplvars.USER_LEVEL += '<br /><b>On your foe list</b>';
+    tplvars.USER_LEVEL += '<br /><b>' + $lang.get('comment_on_foe_list') + '</b>';
   
   parser.assign_vars(tplvars);
   parser.assign_bool(tplbool);
@@ -255,7 +262,7 @@
   cmt.appendChild(ta);
   
   link.style.fontWeight = 'bold';
-  link.innerHTML = 'save';
+  link.innerHTML = $lang.get('comment_btn_save');
   link.onclick = function() { var id = this.id.substr(this.id.indexOf('_')+1); saveComment(id, this); return false; };
 }
 
@@ -273,7 +280,7 @@
     'subj' : subj
   };
   link.style.fontWeight = 'normal';
-  link.innerHTML = 'edit';
+  link.innerHTML = $lang.get('comment_btn_edit');
   link.onclick = function() { var id = this.id.substr(this.id.indexOf('_')+1); editComment(id, this); return false; };
   ajaxComments(req);
 }
@@ -282,7 +289,7 @@
 {
   if ( !shift )
   {
-    var c = confirm('Do you really want to delete this comment?');
+    var c = confirm($lang.get('comment_msg_delete_confirm'));
     if(!c)
       return false;
   }
@@ -340,36 +347,17 @@
   }
   if ( data.approved && data.approved != '1' )
   {
-    document.getElementById('subject_' + data.id).innerHTML += ' <span style="color: #D84308">(Unapproved)</span>';
+    document.getElementById('subject_' + data.id).innerHTML += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>';
   }
   if ( data.approved && ( typeof(data.approve_updated) == 'string' && data.approve_updated == 'yes' ) )
   {
-    var appr = ( data.approved == '1' ) ? 'Unapprove' : 'Approve';
+    var appr = ( data.approved == '1' ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve');
     document.getElementById('comment_approve_'+data.id).innerHTML = appr;
     
-    // Update approval status
-    var p = document.getElementById('comment_status');
-    var count = p.firstChild.nodeValue.split(' ')[2];
-    
-    if ( p.firstChild.nextSibling )
-    {
-      var span = p.firstChild.nextSibling;
-      var is = ( data.approved == '1' ) ? -1 : 1;
-      var n_unapp = parseInt(span.firstChild.nodeValue.split(' ')[0]) + is;
-      n_unapp = n_unapp + '';
-    }
+    if ( data.approved == '1' )
+      comment_decrement_unapproval();
     else
-    {
-      var span = document.createElement('span');
-      p.innerHTML += ' ';
-      span.innerHTML = ' ';
-      span.style.color = '#D84308';
-      var n_unapp = '1';
-      p.appendChild(span);
-    }
-    span.innerHTML = n_unapp + ' of those are unapproved.';
-    if ( n_unapp == '0' )
-      p.removeChild(span);
+      comment_increment_unapproval();
   }
   if ( data.text )
   {
@@ -396,41 +384,24 @@
 // Does the actual DOM object removal
 function annihiliateComment(id) // Did I spell that right?
 {
-  // Approved?
-  var p = document.getElementById('comment_status');
-  
+  var approved = true;
   if(document.getElementById('comment_approve_'+id))
   {
     var appr = document.getElementById('comment_approve_'+id).firstChild.nodeValue;
-    if ( p.firstChild.nextSibling && appr == 'Approve' )
+    if ( appr == $lang.get('comment_btn_mod_approve') )
     {
-      var span = p.firstChild.nextSibling;
-      var t = span.firstChild.nodeValue;
-      var n_unapp = ( parseInt(t.split(' ')[0]) ) - 1;
-      if ( n_unapp == 0 )
-        p.removeChild(span);
-      else
-        span.firstChild.nodeValue = n_unapp + t.substr(t.indexOf(' '));
+      approved = false;
     }
   }
   
   var div = document.getElementById('comment_holder_'+id);
   div.parentNode.removeChild(div);
-  var t = p.firstChild.nodeValue.split(' ');
-  t[2] = ( parseInt(t[2]) - 1 ) + '';
-  delete(t.toJSONString);
-  if ( t[2] == '1' )
+  
+  // update approval status
+  if ( document.getElementById('comment_count_unapp_inner') && !approved )
   {
-    t[1] = 'is';
-    t[3] = 'comment';
+    comment_decrement_unapproval();
   }
-  else
-  {
-    t[1] = 'are';
-    t[3] = 'comments';
-  }
-  t = implode(' ', t);
-  p.firstChild.nodeValue = t;
 }
 
 function materializeComment(data)
@@ -465,32 +436,32 @@
     tplvars.NAME = '<a href="' + makeUrlNS('User', data.name) + '">' + data.name + '</a>';
   
   if ( data.approved != '1' )
-    tplvars.SUBJECT += ' <span style="color: #D84308">(Unapproved)</span>';
+    tplvars.SUBJECT += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>';
   
   // User level
-  tplvars.USER_LEVEL = 'Guest';
-  if ( data.user_level >= data.user_level_list.member ) tplvars.USER_LEVEL = 'Member';
-  if ( data.user_level >= data.user_level_list.mod ) tplvars.USER_LEVEL = 'Moderator';
-  if ( data.user_level >= data.user_level_list.admin ) tplvars.USER_LEVEL = 'Administrator';
+  tplvars.USER_LEVEL = $lang.get('user_type_guest');
+  if ( data.user_level >= data.user_level_list.member ) tplvars.USER_LEVEL = $lang.get('user_type_member');
+  if ( data.user_level >= data.user_level_list.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod');
+  if ( data.user_level >= data.user_level_list.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin');
   
   // Send PM link
-  tplvars.SEND_PM_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( data.name.replace(/ /g, '_') )) +'">Send private message</a><br />':'';
+  tplvars.SEND_PM_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_send_privmsg') + '</a><br />':'';
   
   // Add buddy link
-  tplvars.ADD_BUDDY_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( data.name.replace(/ /g, '_') )) +'">Add to buddy list</a><br />':'';
+  tplvars.ADD_BUDDY_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_add_buddy') + '</a><br />':'';
   
   // Edit link
-  tplvars.EDIT_LINK='<a href="#edit_'+i+'" onclick="editComment(\''+i+'\', this); return false;" id="cmteditlink_'+i+'">edit</a>';
+  tplvars.EDIT_LINK='<a href="#edit_'+i+'" onclick="editComment(\''+i+'\', this); return false;" id="cmteditlink_'+i+'">' + $lang.get('comment_btn_edit') + '</a>';
   
   // Delete link
-  tplvars.DELETE_LINK='<a href="#delete_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">delete</a>';
+  tplvars.DELETE_LINK='<a href="#delete_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_delete') + '</a>';
   
   // Moderation: (Un)approve link
-  var appr = ( data.approved == 1 ) ? 'Unapprove' : 'Approve';
+  var appr = ( data.approved == 1 ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve');
   tplvars.MOD_APPROVE_LINK='<a href="#approve_'+i+'" id="comment_approve_'+i+'" onclick="approveComment(\''+i+'\'); return false;">'+appr+'</a>';
   
   // Moderation: Delete post link
-  tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">Delete</a>';
+  tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_mod_delete') + '</a>';
   
   var tplbool = new Object();
   
@@ -519,50 +490,80 @@
   
   document.getElementById('comment_source_'+i).value = data.comment_source;
   
-  var p = document.getElementById('comment_status');
-  var t = p.firstChild.nodeValue.split(' ');
-  var n = ( isNaN(parseInt(t[2])) ) ? 0 : parseInt(t[2]);
-  t[2] = ( n + 1 ) + '';
-  delete(t.toJSONString);
-  if ( t[2] == '1' )
-  {
-    t[1] = 'is';
-    t[3] = 'comment';
+  var cnt = document.getElementById('comment_count_inner').innerHTML;
+  cnt = parseInt(cnt);
+  if ( isNaN(cnt) )
+    cnt = 0;
+  
+  var subst = {
+    num_comments: cnt,
+    page_type: ENANO_PAGE_TYPE
   }
-  else
-  {
-    t[1] = 'are';
-    t[3] = 'comments';
-  }
-  t = implode(' ', t);
-  p.firstChild.nodeValue = t;
+  
+  var count_msg = ( cnt == 0 ) ? $lang.get('comment_msg_count_zero', subst) : ( ( cnt == 1 ) ? $lang.get('comment_msg_count_one', subst) : $lang.get('comment_msg_count_plural', subst) );
+  
+  document.getElementById('comment_status').firstChild.innerHTML = count_msg;
   
   if(document.getElementById('comment_approve_'+i))
   {
-    var appr = document.getElementById('comment_approve_'+i).firstChild.nodeValue;
-    if ( p.firstChild.nextSibling && appr == 'Approve' )
+    var is_unappr = document.getElementById('comment_approve_'+i).firstChild.nodeValue;
+    is_unappr = ( is_unappr == $lang.get('comment_btn_mod_approve') );
+    if ( is_unappr )
     {
-      var span = p.firstChild.nextSibling;
-      var t = span.firstChild.nodeValue;
-      var n_unapp = ( parseInt(t.split(' ')[0]) ) - 1;
-      if ( n_unapp == 0 )
-        p.removeChild(span);
-      else
-        span.firstChild.nodeValue = n_unapp + t.substr(t.indexOf(' '));
-    }
-    else if ( appr == 'Approve' && !p.firstChild.nextSibling )
-    {
-      var span = document.createElement('span');
-      p.innerHTML += ' ';
-      span.innerHTML = '1 of those are unapproved.';
-      span.style.color = '#D84308';
-      var n_unapp = '1';
-      p.appendChild(span);
+      comment_increment_unapproval();
     }
   }
   
 }
 
+function comment_decrement_unapproval()
+{
+  if ( document.getElementById('comment_count_unapp_inner') )
+  {
+    var num_unapp = parseInt(document.getElementById('comment_count_unapp_inner').innerHTML);
+    if ( !isNaN(num_unapp) )
+    {
+      num_unapp = num_unapp - 1;
+      if ( num_unapp == 0 )
+      {
+        var p = document.getElementById('comment_status');
+        p.removeChild(p.childNodes[2]);
+        p.removeChild(p.childNodes[1]);
+      }
+      else
+      {
+        var count_msg = $lang.get('comment_msg_count_unapp_mod', { num_unapp: num_unapp });
+        document.getElementById('comment_count_unapp_inner').parentNode.innerHTML = count_msg;
+      }
+    }
+  }
+}
+
+function comment_increment_unapproval()
+{
+  if ( document.getElementById('comment_count_unapp_inner') )
+  {
+    var num_unapp = parseInt(document.getElementById('comment_count_unapp_inner').innerHTML);
+    if ( isNaN(num_unapp) )
+      num_unapp = 0;
+    num_unapp = num_unapp + 1;
+    var count_msg = $lang.get('comment_msg_count_unapp_mod', { num_unapp: num_unapp });
+    document.getElementById('comment_count_unapp_inner').parentNode.innerHTML = count_msg;
+  }
+  else
+  {
+    var count_msg = $lang.get('comment_msg_count_unapp_mod', { num_unapp: 1 });
+    var status = document.getElementById('comment_status');
+    if ( !status.childNodes[1] )
+      status.appendChild(document.createTextNode(' '));
+    var span = document.createElement('span');
+    span.id = 'comment_status_unapp';
+    span.style.color = '#D84308';
+    span.innerHTML = count_msg;
+    status.appendChild(span);
+  }
+}
+
 function htmlspecialchars(text)
 {
   text = text.replace(/</g, '&lt;');
--- a/includes/clientside/static/enano-lib-basic.js	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/clientside/static/enano-lib-basic.js	Sun Nov 18 20:37:08 2007 -0500
@@ -277,6 +277,7 @@
   'toolbar.js',
   'windows.js',
   'rijndael.js',
+  'l10n.js',
   'template-compiler.js',
   'acl.js',
   'comments.js',
--- a/includes/clientside/static/faders.js	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/clientside/static/faders.js	Sun Nov 18 20:37:08 2007 -0500
@@ -184,7 +184,8 @@
   {
     btn = document.createElement('input');
     btn.type = 'button';
-    btn.value = 'OK';
+    btn.value = $lang.get('etc_ok');
+    btn._GenericName = 'OK';
     btn.onclick = this.clickHandler;
     btn.style.margin = '0 3px';
     buttondiv.appendChild(btn);
@@ -194,14 +195,16 @@
   {
     btn = document.createElement('input');
     btn.type = 'button';
-    btn.value = 'OK';
+    btn.value = $lang.get('etc_ok');
+    btn._GenericName = 'OK';
     btn.onclick = this.clickHandler;
     btn.style.margin = '0 3px';
     buttondiv.appendChild(btn);
     
     btn = document.createElement('input');
     btn.type = 'button';
-    btn.value = 'Cancel';
+    btn.value = $lang.get('etc_cancel');
+    btn._GenericName = 'Cancel';
     btn.onclick = this.clickHandler;
     btn.style.margin = '0 3px';
     buttondiv.appendChild(btn);
@@ -211,14 +214,16 @@
   {
     btn = document.createElement('input');
     btn.type = 'button';
-    btn.value = 'Yes';
+    btn.value = $lang.get('etc_yes');
+    btn._GenericName = 'Yes';
     btn.onclick = this.clickHandler;
     btn.style.margin = '0 3px';
     buttondiv.appendChild(btn);
     
     btn = document.createElement('input');
     btn.type = 'button';
-    btn.value = 'No';
+    btn.value = $lang.get('etc_no');
+    btn._GenericName = 'No';
     btn.onclick = this.clickHandler;
     btn.style.margin = '0 3px';
     buttondiv.appendChild(btn);
@@ -228,21 +233,24 @@
   {
     btn = document.createElement('input');
     btn.type = 'button';
-    btn.value = 'Yes';
+    btn.value = $lang.get('etc_yes');
+    btn._GenericName = 'Yes';
     btn.onclick = this.clickHandler;
     btn.style.margin = '0 3px';
     buttondiv.appendChild(btn);
     
     btn = document.createElement('input');
     btn.type = 'button';
-    btn.value = 'No';
+    btn.value = $lang.get('etc_no');
+    btn._GenericName = 'No';
     btn.onclick = this.clickHandler;
     btn.style.margin = '0 3px';
     buttondiv.appendChild(btn);
     
     btn = document.createElement('input');
     btn.type = 'button';
-    btn.value = 'Cancel';
+    btn.value = $lang.get('etc_cancel');
+    btn._GenericName = 'Cancel';
     btn.onclick = this.clickHandler;
     btn.style.margin = '0 3px';
     buttondiv.appendChild(btn);
@@ -295,7 +303,7 @@
 
 function messagebox_click(obj, mb)
 {
-  val = obj.value;
+  val = ( typeof ( obj._GenericName ) == 'string' ) ? obj._GenericName : obj.value;
   if(typeof mb.onbeforeclick[val] == 'function')
   {
     var o = mb.onbeforeclick[val];
@@ -441,7 +449,7 @@
 
 function mb_logout()
 {
-  var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, 'Are you sure you want to log out?', 'If you log out, you will no longer be able to access your user preferences, your private messages, or certain areas of this site until you log in again.');
+  var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title'), $lang.get('user_logout_confirm_body'));
   mb.onclick['Yes'] = function()
     {
       window.location = makeUrlNS('Special', 'Logout/' + title);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/clientside/static/l10n.js	Sun Nov 18 20:37:08 2007 -0500
@@ -0,0 +1,60 @@
+/*
+ * Enano client-side localization library
+ */
+
+var Language = function(lang_id)
+{
+  if ( typeof(enano_lang) != 'object' )
+    return false;
+  if ( typeof(enano_lang[lang_id]) != 'object' )
+    return false;
+  this.strings = enano_lang[lang_id];
+  
+  this.get = function(string_id, subst)
+  {
+    var catname = string_id.substr(0, string_id.indexOf('_'));
+    var string_name = string_id.substr(string_id.indexOf('_') + 1);
+    if ( typeof(this.strings[catname]) != 'object' )
+      return string_id;
+    if ( typeof(this.strings[catname][string_name]) != 'string' )
+      return string_id;
+    return '[LJS] ' + this.perform_subst(this.strings[catname][string_name], subst);
+  }
+  
+  this.perform_subst = function(str, subst)
+  {
+    // var this_regex = /%this\.([a-z0-9_]+)%/;
+    // var match;
+    // while ( str.match(this_regex) )
+    // {
+    //   match = str.match(this_regex);
+    //   alert(match);
+    // }
+    // hackish workaround for %config.*%
+    str = str.replace(/%config\.([a-z0-9_]+)%/g, '%$1%');
+    if ( typeof(subst) == 'object' )
+    {
+      for ( var i in subst )
+      {
+        if ( !i.match(/^([a-z0-9_]+)$/) )
+          continue;
+        var regex = new RegExp('%' + i + '%', 'g');
+        str = str.replace(regex, subst[i]);
+      }
+    }
+    return str;
+  }
+  
+}
+
+var $lang;
+
+var language_onload = function()
+{
+  $lang = new Language(ENANO_LANG_ID);
+  // for debugging :-)
+  // alert( $lang.get('user_err_invalid_credentials_lockout_captcha', { lockout_fails: '3', lockout_threshold: '5', lockout_duration: '15' }) );
+}
+
+addOnloadHook(language_onload);
+
--- a/includes/clientside/static/misc.js	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/clientside/static/misc.js	Sun Nov 18 20:37:08 2007 -0500
@@ -302,6 +302,62 @@
 var ajax_auth_mb_cache = false;
 var ajax_auth_level_cache = false;
 var ajax_auth_error_string = false;
+var ajax_auth_show_captcha = false;
+
+function ajaxAuthErrorToString($data)
+{
+  var $errstring = $data.error;
+  // this was literally copied straight from the PHP code.
+  switch($data.error)
+  {
+    case 'key_not_found':
+      $errstring = $lang.get('user_err_key_not_found');
+      break;
+    case 'key_wrong_length':
+      $errstring = $lang.get('user_err_key_wrong_length');
+      break;
+    case 'too_big_for_britches':
+      $errstring = $lang.get('user_err_too_big_for_britches');
+      break;
+    case 'invalid_credentials':
+      $errstring = $lang.get('user_err_invalid_credentials');
+      var subst = {
+        lockout_fails: $data.lockout_fails,
+        lockout_threshold: $data.lockout_threshold,
+        lockout_duration: $data.lockout_duration
+      }
+      if ( $data.lockout_policy == 'lockout' )
+      {
+        $errstring += $lang.get('user_err_invalid_credentials_lockout', subst);
+      }
+      else if ( $data.lockout_policy == 'captcha' )
+      {
+        $errstring += $lang.get('user_err_invalid_credentials_lockout_captcha', subst);
+      }
+      break;
+    case 'backend_fail':
+      $errstring = $lang.get('user_err_backend_fail');
+      break;
+    case 'locked_out':
+      $attempts = parseInt($data['lockout_fails']);
+      if ( $attempts > $data['lockout_threshold'])
+        $attempts = $data['lockout_threshold'];
+      $time_rem = $data.time_rem;
+      $s = ( $time_rem == 1 ) ? '' : $lang.get('meta_plural');
+      
+      var subst = {
+        lockout_threshold: $data.lockout_threshold,
+        time_rem: $time_rem,
+        plural: $s,
+        captcha_blurb: ( $data.lockout_policy == 'captcha' ? $lang.get('user_err_locked_out_captcha_blurb') : '' )
+      }
+      
+      $errstring = $lang.get('user_err_locked_out', subst);
+      
+      break;
+  }
+  return $errstring;
+}
 
 function ajaxPromptAdminAuth(call_on_ok, level)
 {
@@ -313,13 +369,24 @@
     level = USER_LEVEL_MEMBER;
   ajax_auth_level_cache = level;
   var loading_win = '<div align="center" style="text-align: center;"> \
-      <p>Fetching an encryption key...</p> \
-      <p><small>Not working? Use the <a href="'+makeUrlNS('Special', 'Login/' + title)+'">alternate login form</a>.</p> \
+      <p>' + $lang.get('user_login_ajax_fetching_key') + '</p> \
+      <p><small>' + $lang.get('user_login_ajax_link_fullform', { link_full_form: makeUrlNS('Special', 'Login/' + title) }) + '</p> \
       <p><img alt="Please wait..." src="'+scriptPath+'/images/loading-big.gif" /></p> \
     </div>';
-  var title = ( level > USER_LEVEL_MEMBER ) ? 'You are requesting a sensitive operation.' : 'Please enter your username and password to continue.';
+  var title = ( level > USER_LEVEL_MEMBER ) ? $lang.get('user_login_ajax_prompt_title_elev') : $lang.get('user_login_ajax_prompt_title');
   ajax_auth_mb_cache = new messagebox(MB_OKCANCEL|MB_ICONLOCK, title, loading_win);
   ajax_auth_mb_cache.onbeforeclick['OK'] = ajaxValidateLogin;
+  ajax_auth_mb_cache.onbeforeclick['Cancel'] = function()
+  {
+    if ( document.getElementById('autoCaptcha') )
+    {
+      var to = fly_out_top(document.getElementById('autoCaptcha'), false, true);
+      setTimeout(function() {
+          var d = document.getElementById('autoCaptcha');
+          d.parentNode.removeChild(d);
+        }, to);
+    }
+  }
   ajaxAuthLoginInnerSetup();
 }
 
@@ -335,6 +402,20 @@
           return false;
         }
         response = parseJSON(response);
+        var disable_controls = false;
+        if ( response.locked_out && !ajax_auth_error_string )
+        {
+          response.error = 'locked_out';
+          ajax_auth_error_string = ajaxAuthErrorToString(response);
+          if ( response.lockout_policy == 'captcha' )
+          {
+            ajax_auth_show_captcha = response.captcha;
+          }
+          else
+          {
+            disable_controls = true;
+          }
+        }
         var level = ajax_auth_level_cache;
         var form_html = '';
         var shown_error = false;
@@ -346,26 +427,40 @@
         }
         else if ( level > USER_LEVEL_MEMBER )
         {
-          form_html += 'Please re-enter your login details, to verify your identity.<br /><br />';
+          form_html += $lang.get('user_login_ajax_prompt_body_elev') + '<br /><br />';
         }
+        if ( ajax_auth_show_captcha )
+         {
+           var captcha_html = ' \
+             <tr> \
+               <td>' + $lang.get('user_login_field_captcha') + ':</td> \
+               <td><input type="hidden" id="ajaxlogin_captcha_hash" value="' + ajax_auth_show_captcha + '" /><input type="text" tabindex="3" size="25" id="ajaxlogin_captcha_code" /> \
+             </tr>';
+         }
+         else
+         {
+           var captcha_html = '';
+         }
+         var disableme = ( disable_controls ) ? 'disabled="disabled" ' : '';
         form_html += ' \
           <table border="0" align="center"> \
             <tr> \
-              <td>Username:</td><td><input tabindex="1" id="ajaxlogin_user" type="text"     size="25" /> \
+              <td>' + $lang.get('user_login_field_username') + ':</td><td><input tabindex="1" id="ajaxlogin_user" type="text"     ' + disableme + 'size="25" /> \
             </tr> \
             <tr> \
-              <td>Password:</td><td><input tabindex="2" id="ajaxlogin_pass" type="password" size="25" /> \
+              <td>' + $lang.get('user_login_field_password') + ':</td><td><input tabindex="2" id="ajaxlogin_pass" type="password" ' + disableme + 'size="25" /> \
             </tr> \
+            ' + captcha_html + ' \
             <tr> \
               <td colspan="2" style="text-align: center;"> \
-                <br /><small>Trouble logging in? Try the <a href="'+makeUrlNS('Special', 'Login/' + title, 'level=' + level)+'">full login form</a>.<br />';
+                <small>' + $lang.get('user_login_ajax_link_fullform', { link_full_form: makeUrlNS('Special', 'Login/' + title, 'level=' + level) }) + '<br />';
        if ( level <= USER_LEVEL_MEMBER )
        {
          form_html += ' \
-                Did you <a href="'+makeUrlNS('Special', 'PasswordReset')+'">forget your password</a>?<br /> \
-                Maybe you need to <a href="'+makeUrlNS('Special', 'Register')+'">create an account</a>.</small>';
+                ' + $lang.get('user_login_ajax_link_forgotpass', { forgotpass_link: makeUrlNS('Special', 'PasswordReset') }) + '<br /> \
+                ' + $lang.get('user_login_createaccount_blurb', { reg_link: makeUrlNS('Special', 'Register') });
        }
-       form_html += ' \
+       form_html += '</small> \
               </td> \
             </tr> \
           </table> \
@@ -383,8 +478,21 @@
         {
           $('ajaxlogin_user').object.focus();
         }
-        $('ajaxlogin_pass').object.onblur = function(e) { if ( !shift ) $('messageBox').object.nextSibling.firstChild.focus(); };
-        $('ajaxlogin_pass').object.onkeypress = function(e) { if ( !e && IE ) return true; if ( e.keyCode == 13 ) $('messageBox').object.nextSibling.firstChild.click(); };
+        if ( ajax_auth_show_captcha )
+        {
+          $('ajaxlogin_captcha_code').object.onblur = function(e) { if ( !shift ) $('messageBox').object.nextSibling.firstChild.focus(); };
+          $('ajaxlogin_captcha_code').object.onkeypress = function(e) { if ( !e && IE ) return true; if ( e.keyCode == 13 ) $('messageBox').object.nextSibling.firstChild.click(); };
+        }
+        else
+        {
+          $('ajaxlogin_pass').object.onblur = function(e) { if ( !shift ) $('messageBox').object.nextSibling.firstChild.focus(); };
+          $('ajaxlogin_pass').object.onkeypress = function(e) { if ( !e && IE ) return true; if ( e.keyCode == 13 ) $('messageBox').object.nextSibling.firstChild.click(); };
+        }
+        if ( disable_controls )
+        {
+          var panel = document.getElementById('messageBoxButtons');
+          panel.firstChild.disabled = true;
+        }
         /*
         ## This causes the background image to disappear under Fx 2
         if ( shown_error )
@@ -398,6 +506,11 @@
           fader.start();
         }
         */
+        if ( ajax_auth_show_captcha )
+        {
+          ajaxShowCaptcha(ajax_auth_show_captcha);
+          ajax_auth_show_captcha = false;
+        }
       }
     });
 }
@@ -412,6 +525,15 @@
   password = document.getElementById('ajaxlogin_pass').value;
   auth_enabled = false;
   
+  if ( document.getElementById('autoCaptcha') )
+  {
+    var to = fly_out_top(document.getElementById('autoCaptcha'), false, true);
+    setTimeout(function() {
+        var d = document.getElementById('autoCaptcha');
+        d.parentNode.removeChild(d);
+      }, to);
+  }
+  
   disableJSONExts();
   
   //
@@ -467,11 +589,17 @@
     'level' : ajax_auth_level_cache
   };
   
+  if ( document.getElementById('ajaxlogin_captcha_hash') )
+  {
+    json_data.captcha_hash = document.getElementById('ajaxlogin_captcha_hash').value;
+    json_data.captcha_code = document.getElementById('ajaxlogin_captcha_code').value;
+  }
+  
   json_data = toJSONString(json_data);
   json_data = encodeURIComponent(json_data);
   
   var loading_win = '<div align="center" style="text-align: center;"> \
-      <p>Logging in...</p> \
+      <p>' + $lang.get('user_login_ajax_loggingin') + '</p> \
       <p><img alt="Please wait..." src="'+scriptPath+'/images/loading-big.gif" /></p> \
     </div>';
     
@@ -509,18 +637,23 @@
             }
             break;
           case 'error':
-            if ( response.error == 'The username and/or password is incorrect.' )
+            if ( response.data.error == 'invalid_credentials' || response.data.error == 'locked_out' )
             {
-              ajax_auth_error_string = response.error;
+              ajax_auth_error_string = ajaxAuthErrorToString(response.data);
               mb_current_obj.updateContent('');
               document.getElementById('messageBox').style.backgroundColor = '#C0C0C0';
               var mb_parent = document.getElementById('messageBox').parentNode;
               new Spry.Effect.Shake(mb_parent, {duration: 1500}).start();
               setTimeout("document.getElementById('messageBox').style.backgroundColor = '#FFF'; ajaxAuthLoginInnerSetup();", 2500);
+              
+              if ( response.data.lockout_policy == 'captcha' && response.data.error == 'locked_out' )
+              {
+                ajax_auth_show_captcha = response.captcha;
+              }
             }
             else
             {
-              alert(response.error);
+              ajax_auth_error_string = ajaxAuthErrorToString(response.data);
               ajaxAuthLoginInnerSetup();
             }
             break;
--- a/includes/clientside/static/template-compiler.js	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/clientside/static/template-compiler.js	Sun Nov 18 20:37:08 2007 -0500
@@ -54,6 +54,7 @@
   code = code.replace(new RegExp(unescape('%0A'), 'g'), '\\n');
   code = "'" + code + "'";
   code = code.replace(/\{([A-z0-9_-]+)\}/ig, "' + this.tpl_strings['$1'] + '");
+  code = code.replace(/\{lang:([a-z0-9_]+)\}/g, "' + $lang.get('$1') + '");
   code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- BEGINELSE \1 --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '$3' ) + '");
   code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '' ) + '");
   return code;
--- a/includes/common.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/common.php	Sun Nov 18 20:37:08 2007 -0500
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.2 (Coblynau)
+ * Version 1.1.1
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
@@ -23,7 +23,7 @@
   exit;
 }
 
-$version = '1.0.2';
+$version = '1.1.1';
 
 function microtime_float()
 {
@@ -81,6 +81,7 @@
 require_once(ENANO_ROOT.'/includes/sessions.php');
 require_once(ENANO_ROOT.'/includes/template.php');
 require_once(ENANO_ROOT.'/includes/plugins.php');
+require_once(ENANO_ROOT.'/includes/lang.php');
 require_once(ENANO_ROOT.'/includes/comment.php');
 require_once(ENANO_ROOT.'/includes/wikiformat.php');
 require_once(ENANO_ROOT.'/includes/diff.php');
@@ -106,6 +107,7 @@
                       // In addition, $enano_config is used to fetch config information if die_semicritical() is called.
                       
 global $email;
+global $lang;
 
 if(!isset($_SERVER['HTTP_HOST'])) grinding_halt('Cannot get hostname', '<p>Your web browser did not provide the HTTP Host: field. This site requires a modern browser that supports the HTTP 1.1 standard.</p>');
                      
@@ -190,6 +192,27 @@
   }
 }
 
+// Is there no default language?
+if ( getConfig('lang_default') === false )
+{
+  $q = $db->sql_query('SELECT lang_id FROM '.table_prefix.'language LIMIT 1;');
+  if ( !$q )
+    $db->_die('common.php - setting default language');
+  if ( $db->numrows() < 1 && !defined('ENANO_ALLOW_LOAD_NOLANG') )
+  {
+    grinding_halt('No languages', '<p>There are no languages installed on this site.</p>
+        <p>If you are the website administrator, you may install a language by writing and executing a simple PHP script to install it:</p>
+        <pre>
+&lt;?php
+define("ENANO_ALLOW_LOAD_NOLANG", 1);
+$_GET["title"] = "langinstall";
+require("includes/common.php");
+install_language("eng", "English", "English", ENANO_ROOT . "/language/english/enano.json");</pre>');
+  }
+  $row = $db->fetchrow();
+  setConfig('default_language', $row['lang_id']);
+}
+
 // Our list of tables included in Enano
 $system_table_list = Array(
     table_prefix.'categories',
--- a/includes/constants.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/constants.php	Sun Nov 18 20:37:08 2007 -0500
@@ -39,6 +39,9 @@
 define('PAGE_GRP_NORMAL', 3);
 define('PAGE_GRP_REGEX', 4);
 
+// Identifier for the default meta-language
+define('LANG_DEFAULT', 0);
+
 //
 // User types - don't touch these
 //
--- a/includes/dbal.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/dbal.php	Sun Nov 18 20:37:08 2007 -0500
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.2 (Coblynau)
+ * Version 1.1.1
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/includes/functions.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/functions.php	Sun Nov 18 20:37:08 2007 -0500
@@ -273,15 +273,19 @@
  * @param string $timeout Timeout, in seconds, to delay the redirect. Defaults to 3.
  */
 
-function redirect($url, $title = 'Redirecting...', $message = 'Please wait while you are redirected.', $timeout = 3)
+function redirect($url, $title = 'etc_redirect_title', $message = 'etc_redirect_body', $timeout = 3)
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
 
   if ( $timeout == 0 )
   {
     header('Location: ' . $url);
     header('HTTP/1.1 307 Temporary Redirect');
   }
+  
+  $title = $lang->get($title);
+  $message = $lang->get($message);
 
   $template->add_header('<meta http-equiv="refresh" content="' . $timeout . '; url=' . str_replace('"', '\\"', $url) . '" />');
   $template->add_header('<script type="text/javascript">
@@ -295,7 +299,12 @@
 
   $template->tpl_strings['PAGE_NAME'] = $title;
   $template->header(true);
-  echo '<p>' . $message . '</p><p>If you are not redirected within ' . ( $timeout + 1 ) . ' seconds, <a href="' . str_replace('"', '\\"', $url) . '">please click here</a>.</p>';
+  echo '<p>' . $message . '</p>';
+  $subst = array(
+      'timeout' => ( $timeout + 1 ),
+      'redirect_url' => str_replace('"', '\\"', $url)
+    );
+  echo '<p>' . $lang->get('etc_redirect_timeout', $subst) . '</p>';
   $template->footer(true);
 
   $db->close();
@@ -423,7 +432,9 @@
   $str = '0x';
   foreach($nums as $n)
   {
-    $str .= (string)dechex($n);
+    $byte = (string)dechex($n);
+    if ( strlen($byte) < 2 )
+      $byte = '0' . $byte;
   }
   return $str;
 }
@@ -630,6 +641,7 @@
 function show_category_info()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   
   if ( $paths->namespace == 'Category' )
   {
@@ -745,9 +757,9 @@
   {
     echo '<div class="mdg-comment" style="margin: 10px 0 0 0;" id="category_box_wrapper">';
     echo '<div style="float: right;">';
-    echo '(<a href="#" onclick="ajaxCatToTag(); return false;">show page tags</a>)';
+    echo '(<a href="#" onclick="ajaxCatToTag(); return false;">' . $lang->get('tags_catbox_link') . '</a>)';
     echo '</div>';
-    echo '<div id="mdgCatBox">Categories: ';
+    echo '<div id="mdgCatBox">' . $lang->get('catedit_catbox_lbl_categories') . ' ';
     
     $where = '( c.page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND c.namespace=\'' . $db->escape($paths->namespace) . '\' )';
     $prefix = table_prefix;
@@ -777,13 +789,13 @@
     }
     else
     {
-      echo '(Uncategorized)';
+      echo $lang->get('catedit_catbox_lbl_uncategorized');
     }
     
     $can_edit = ( $session->get_permissions('edit_cat') && ( !$paths->page_protected || $session->get_permissions('even_when_protected') ) );
     if ( $can_edit )
     {
-      $edit_link = '<a href="' . makeUrl($paths->page, 'do=catedit', true) . '" onclick="ajaxCatEdit(); return false;">edit categorization</a>';
+      $edit_link = '<a href="' . makeUrl($paths->page, 'do=catedit', true) . '" onclick="ajaxCatEdit(); return false;">' . $lang->get('catedit_catbox_link_edit') . '</a>';
       echo ' [ ' . $edit_link . ' ]';
     }
     
@@ -874,23 +886,19 @@
 function display_page_headers()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if($session->get_permissions('vote_reset') && $paths->cpage['delvotes'] > 0)
   {
     $delvote_ips = unserialize($paths->cpage['delvote_ips']);
     $hr = htmlspecialchars(implode(', ', $delvote_ips['u']));
-    $is = 'is';
-    $s = '';
-    $s2 = 's';
-    if ( $paths->cpage['delvotes'] > 1)
-    {
-      $is = 'are';
-      $s = 's';
-      $s2 = '';
-    }
+    
+    $string_id = ( $paths->cpage['delvotes'] == 1 ) ? 'delvote_lbl_votes_one' : 'delvote_lbl_votes_plural';
+    $string = $lang->get($string_id, array('num_users' => $paths->cpage['delvotes']));
+    
     echo '<div class="info-box" style="margin-left: 0; margin-top: 5px;" id="mdgDeleteVoteNoticeBox">
-            <b>Notice:</b> There '.$is.' '.$paths->cpage['delvotes'].' user'.$s.' that think'.$s2.' this page should be deleted.<br />
-            <b>Users that voted:</b> ' . $hr . '<br />
-            <a href="'.makeUrl($paths->page, 'do=deletepage').'" onclick="ajaxDeletePage(); return false;">Delete page</a>  |  <a href="'.makeUrl($paths->page, 'do=resetvotes').'" onclick="ajaxResetDelVotes(); return false;">Reset votes</a>
+            <b>' . $lang->get('etc_lbl_notice') . '</b> ' . $string . '<br />
+            <b>' . $lang->get('delvote_lbl_users_that_voted') . '</b> ' . $hr . '<br />
+            <a href="'.makeUrl($paths->page, 'do=deletepage').'" onclick="ajaxDeletePage(); return false;">' . $lang->get('delvote_btn_deletepage') . '</a>  |  <a href="'.makeUrl($paths->page, 'do=resetvotes').'" onclick="ajaxResetDelVotes(); return false;">' . $lang->get('delvote_btn_resetvotes') . '</a>
           </div>';
   }
 }
@@ -3249,6 +3257,55 @@
 }
 
 /**
+ * Installs a language.
+ * @param string The ISO-639-3 identifier for the language. Maximum of 6 characters, usually 3.
+ * @param string The name of the language in English (Spanish)
+ * @param string The name of the language natively (Español)
+ * @param string The path to the file containing the language's strings. Optional.
+ */
+
+function install_language($lang_code, $lang_name_neutral, $lang_name_local, $lang_file = false)
+{
+  global $db, $session, $paths, $template, $plugins; // Common objects
+  
+  $q = $db->sql_query('SELECT 1 FROM '.table_prefix.'language WHERE lang_code = "' . $db->escape($lang_code) . '";');
+  if ( !$q )
+    $db->_die('functions.php - checking for language existence');
+  
+  if ( $db->numrows() > 0 )
+    // Language already exists
+    return false;
+  
+  $q = $db->sql_query('INSERT INTO ' . table_prefix . 'language(lang_code, lang_name_default, lang_name_native) 
+                         VALUES(
+                           "' . $db->escape($lang_code) . '",
+                           "' . $db->escape($lang_name_neutral) . '",
+                           "' . $db->escape($lang_name_native) . '"
+                         );');
+  if ( !$q )
+    $db->_die('functions.php - installing language');
+  
+  $lang_id = $db->insert_id();
+  if ( empty($lang_id) || $lang_id == 0 )
+  {
+    $db->_die('functions.php - invalid returned lang_id');
+  }
+  
+  // Do we also need to install a language file?
+  if ( is_string($lang_file) && file_exists($lang_file) )
+  {
+    $lang = new Language($lang_id);
+    $lang->import($lang_file);
+  }
+  else if ( is_string($lang_file) && !file_exists($lang_file) )
+  {
+    echo '<b>Notice:</b> Can\'t load language file, so the specified language wasn\'t fully installed.<br />';
+    return false;
+  }
+  return true;
+}
+
+/**
  * Scales an image to the specified width and height, and writes the output to the specified
  * file. Will use ImageMagick if present, but if not will attempt to scale with GD. This will
  * always scale images proportionally.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/lang.php	Sun Nov 18 20:37:08 2007 -0500
@@ -0,0 +1,511 @@
+<?php
+
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.1.1
+ * Copyright (C) 2006-2007 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+
+/**
+ * Language class - processes, stores, and retrieves language strings.
+ * @package Enano
+ * @subpackage Localization
+ * @copyright 2007 Dan Fuhry
+ * @license GNU General Public License
+ */
+
+class Language
+{
+  
+  /**
+   * The numerical ID of the loaded language.
+   * @var int
+   */
+  
+  var $lang_id;
+  
+  /**
+   * The ISO-639-3 code for the loaded language. This should be grabbed directly from the database.
+   * @var string
+   */
+  
+  var $lang_code;
+
+  /**
+   * Used to track when a language was last changed, to allow browsers to cache language data
+   * @var int
+   */
+  
+  var $lang_timestamp;
+  
+  /**
+   * Will be an object that holds an instance of the class configured with the site's default language. Only instanciated when needed.
+   * @var object
+   */
+  
+  var $default;
+  
+  /**
+   * The list of loaded strings.
+   * @var array
+   * @access private
+   */
+  
+  var $strings = array();
+  
+  /**
+   * Constructor.
+   * @param int|string Language ID or code to load.
+   */
+  
+  function __construct($lang)
+  {
+    global $db, $session, $paths, $template, $plugins; // Common objects
+    
+    if ( defined('IN_ENANO_INSTALL') )
+    {
+      // special case for the Enano installer: it will load its own strings from a JSON file and just use this API for fetching and templatizing them.
+      $this->lang_id   = 1;
+      $this->lang_code = $lang;
+      return true;
+    }
+    if ( is_string($lang) )
+    {
+      $sql_col = 'lang_code="' . $db->escape($lang) . '"';
+    }
+    else if ( is_int($lang) )
+    {
+      $sql_col = 'lang_id=' . $lang . '';
+    }
+    else
+    {
+      $db->_die('lang.php - attempting to pass invalid value to constructor');
+    }
+    
+    $lang_default = ( $x = getConfig('default_language') ) ? intval($x) : '\'def\'';
+    $q = $db->sql_query("SELECT lang_id, lang_code, last_changed, ( lang_id = $lang_default ) AS is_default FROM " . table_prefix . "language WHERE $sql_col OR lang_id = $lang_default ORDER BY is_default DESC LIMIT 1;");
+    
+    if ( !$q )
+      $db->_die('lang.php - main select query');
+    
+    if ( $db->numrows() < 1 )
+      $db->_die('lang.php - There are no languages installed');
+    
+    $row = $db->fetchrow();
+    
+    $this->lang_id   = intval( $row['lang_id'] );
+    $this->lang_code = $row['lang_code'];
+    $this->lang_timestamp = $row['last_changed'];
+  }
+  
+  /**
+   * PHP 4 constructor.
+   * @param int|string Language ID or code to load.
+   */
+  
+  function Language($lang)
+  {
+    $this->__construct($lang);
+  }
+  
+  /**
+   * Fetches language strings from the database, or a cache file if it's available.
+   * @param bool If true (default), allows the cache to be used.
+   */
+  
+  function fetch($allow_cache = true)
+  {
+    global $db, $session, $paths, $template, $plugins; // Common objects
+    
+    $lang_file = ENANO_ROOT . "/cache/lang_{$this->lang_id}.php";
+    // Attempt to load the strings from a cache file
+    if ( file_exists($lang_file) && $allow_cache )
+    {
+      // Yay! found it
+      $this->load_cache_file($lang_file);
+    }
+    else
+    {
+      // No cache file - select and retrieve from the database
+      $q = $db->sql_unbuffered_query("SELECT string_category, string_name, string_content FROM " . table_prefix . "language_strings WHERE lang_id = {$this->lang_id};");
+      if ( !$q )
+        $db->_die('lang.php - selecting language string data');
+      if ( $row = $db->fetchrow() )
+      {
+        $strings = array();
+        do
+        {
+          $cat =& $row['string_category'];
+          if ( !is_array($strings[$cat]) )
+          {
+            $strings[$cat] = array();
+          }
+          $strings[$cat][ $row['string_name'] ] = $row['string_content'];
+        }
+        while ( $row = $db->fetchrow() );
+        // all done fetching
+        $this->merge($strings);
+      }
+      else
+      {
+        if ( !defined('ENANO_ALLOW_LOAD_NOLANG') )
+          $db->_die('lang.php - No strings for language ' . $this->lang_code);
+      }
+    }
+  }
+  
+  /**
+   * Loads a file from the disk cache (treated as PHP) and merges it into RAM.
+   * @param string File to load
+   */
+  
+  function load_cache_file($file)
+  {
+    global $db, $session, $paths, $template, $plugins; // Common objects
+    
+    // We're using eval() here because it makes handling scope easier.
+    
+    if ( !file_exists($file) )
+      $db->_die('lang.php - requested cache file doesn\'t exist');
+    
+    $contents = file_get_contents($file);
+    $contents = preg_replace('/([\s]*)<\?php/', '', $contents);
+    
+    @eval($contents);
+    
+    if ( !isset($lang_cache) || ( isset($lang_cache) && !is_array($lang_cache) ) )
+      $db->_die('lang.php - the cache file is invalid (didn\'t set $lang_cache as an array)');
+    
+    $this->merge($lang_cache);
+  }
+  
+  /**
+   * Loads a JSON language file and parses the strings into RAM. Will use the cache if possible, but stays far away from the database,
+   * which we assume doesn't exist yet.
+   */
+  
+  function load_file($file)
+  {
+    global $db, $session, $paths, $template, $plugins; // Common objects
+    
+    if ( !file_exists($file) )
+      $db->_die('lang.php - requested JSON file doesn\'t exist');
+    
+    $contents = trim(@file_get_contents($file));
+    if ( empty($contents) )
+      $db->_die('lang.php - empty language file...');
+    
+    // Trim off all text before and after the starting and ending braces
+    $contents = preg_replace('/^([^{]+)\{/', '{', $contents);
+    $contents = preg_replace('/\}([^}]+)$/', '}', $contents);
+    $contents = trim($contents);
+    
+    if ( empty($contents) )
+      $db->_die('lang.php - no meat to the language file...');
+    
+    $checksum = md5($contents);
+    if ( file_exists("./cache/lang_json_{$checksum}.php") )
+    {
+      $this->load_cache_file("./cache/lang_json_{$checksum}.php");
+    }
+    else
+    {
+      $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
+      $langdata = $json->decode($contents);
+    
+      if ( !is_array($langdata) )
+        $db->_die('lang.php - invalid language file');
+      
+      if ( !isset($langdata['categories']) || !isset($langdata['strings']) )
+        $db->_die('lang.php - language file does not contain the proper items');
+      
+      $this->merge($langdata['strings']);
+      
+      $lang_file = "./cache/lang_json_{$checksum}.php";
+      
+      $handle = @fopen($lang_file, 'w');
+      if ( !$handle )
+        // Couldn't open the file. Silently fail and let the strings come from RAM.
+        return false;
+        
+      // The file's open, that means we should be good.
+      fwrite($handle, '<?php
+// This file was generated automatically by Enano. You should not edit this file because any changes you make
+// to it will not be visible in the ACP and all changes will be lost upon any changes to strings in the admin panel.
+
+$lang_cache = ');
+      
+      $exported = $this->var_export_string($this->strings);
+      if ( empty($exported) )
+        // Ehh, that's not good
+        $db->_die('lang.php - load_file(): var_export_string() failed');
+      
+      fwrite($handle, $exported . '; ?>');
+      
+      // Clean up
+      unset($exported, $langdata);
+      
+      // Done =)
+      fclose($handle);
+    }
+  }
+  
+  /**
+   * Merges a standard language assoc array ($arr[cat][stringid]) with the master in RAM.
+   * @param array
+   */
+  
+  function merge($strings)
+  {
+    // This is stupidly simple.
+    foreach ( $strings as $cat_id => $contents )
+    {
+      if ( !isset($this->strings[$cat_id]) || ( isset($this->strings[$cat_id]) && !is_array($this->strings[$cat_id]) ) )
+        $this->strings[$cat_id] = array();
+      foreach ( $contents as $string_id => $string )
+      {
+        $this->strings[$cat_id][$string_id] = $string;
+      }
+    }
+  }
+  
+  /**
+   * Imports a JSON-format language file into the database and merges with current strings.
+   * @param string Path to the JSON file to load
+   */
+  
+  function import($file)
+  {
+    global $db, $session, $paths, $template, $plugins; // Common objects
+    
+    if ( !file_exists($file) )
+      $db->_die('lang.php - can\'t import language file: string file doesn\'t exist');
+    
+    if ( $this->lang_id == 0 )
+      $db->_die('lang.php - BUG: trying to perform import when $lang->lang_id == 0');
+    
+    $contents = trim(@file_get_contents($file));
+    
+    if ( empty($contents) )
+      $db->_die('lang.php - can\'t load the contents of the language file');
+    
+    // Trim off all text before and after the starting and ending braces
+    $contents = preg_replace('/^([^{]+)\{/', '{', $contents);
+    $contents = preg_replace('/\}([^}]+)$/', '}', $contents);
+    
+    $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
+    $langdata = $json->decode($contents);
+    
+    if ( !is_array($langdata) )
+      $db->_die('lang.php - invalid language file');
+    
+    if ( !isset($langdata['categories']) || !isset($langdata['strings']) )
+      $db->_die('lang.php - language file does not contain the proper items');
+    
+    $insert_list = array();
+    $delete_list = array();
+    
+    foreach ( $langdata['categories'] as $category )
+    {
+      if ( isset($langdata['strings'][$category]) )
+      {
+        foreach ( $langdata['strings'][$category] as $string_name => $string_value )
+        {
+          $string_name = $db->escape($string_name);
+          $string_value = $db->escape($string_value);
+          $category_name = $db->escape($category);
+          $insert_list[] = "({$this->lang_id}, '$category_name', '$string_name', '$string_value')";
+          $delete_list[] = "( lang_id = {$this->lang_id} AND string_category = '$category_name' AND string_name = '$string_name' )";
+        }
+      }
+    }
+    
+    $delete_list = implode(" OR\n  ", $delete_list);
+    $sql = "DELETE FROM " . table_prefix . "language_strings WHERE $delete_list;";
+    
+    // Free some memory
+    unset($delete_list);
+    
+    // Run the query
+    $q = $db->sql_query($sql);
+    if ( !$q )
+      $db->_die('lang.php - couldn\'t kill off them old strings');
+    
+    $insert_list = implode(",\n  ", $insert_list);
+    $sql = "INSERT INTO " . table_prefix . "language_strings(lang_id, string_category, string_name, string_content) VALUES\n  $insert_list;";
+    
+    // Free some memory
+    unset($insert_list);
+    
+    // Run the query
+    $q = $db->sql_query($sql);
+    if ( !$q )
+      $db->_die('lang.php - couldn\'t insert strings in import()');
+    
+    // YAY! done!
+    // This will regenerate the cache file if possible.
+    $this->regen_caches();
+  }
+  
+  /**
+   * Refetches the strings and writes out the cache file.
+   */
+  
+  function regen_caches()
+  {
+    global $db, $session, $paths, $template, $plugins; // Common objects
+    
+    $lang_file = ENANO_ROOT . "/cache/lang_{$this->lang_id}.php";
+    
+    // Refresh the strings in RAM to the latest copies in the DB
+    $this->fetch(false);
+    
+    $handle = @fopen($lang_file, 'w');
+    if ( !$handle )
+      // Couldn't open the file. Silently fail and let the strings come from the database.
+      return false;
+      
+    // The file's open, that means we should be good.
+    fwrite($handle, '<?php
+// This file was generated automatically by Enano. You should not edit this file because any changes you make
+// to it will not be visible in the ACP and all changes will be lost upon any changes to strings in the admin panel.
+
+$lang_cache = ');
+    
+    $exported = $this->var_export_string($this->strings);
+    if ( empty($exported) )
+      // Ehh, that's not good
+      $db->_die('lang.php - var_export_string() failed');
+    
+    fwrite($handle, $exported . '; ?>');
+    
+    // Update timestamp in database
+    $q = $db->sql_query('UPDATE ' . table_prefix . 'language SET last_changed = ' . time() . ' WHERE lang_id = ' . $this->lang_id . ';');
+    if ( !$q )
+      $db->_die('lang.php - updating timestamp on language');
+    
+    // Done =)
+    fclose($handle);
+  }
+  
+  /**
+   * Calls var_export() on whatever, and returns the function's output.
+   * @param mixed Whatever you want var_exported. Usually an array.
+   * @return string
+   */
+  
+  function var_export_string($val)
+  {
+    ob_start();
+    var_export($val);
+    $contents = ob_get_contents();
+    ob_end_clean();
+    return $contents;
+  }
+  
+  /**
+   * Fetches a language string from the cache in RAM. If it isn't there, it will call fetch() again and then try. If it still can't find it, it will ask for the string
+   * in the default language. If even then the string can't be found, this function will return what was passed to it.
+   *
+   * This will also templatize strings. If a string contains variables in the format %foo%, you may specify the second parameter as an associative array in the format
+   * of 'foo' => 'foo substitute'.
+   *
+   * @param string ID of the string to fetch. This will always be in the format of category_stringid.
+   * @param array Optional. Associative array of substitutions.
+   * @return string
+   */
+  
+  function get($string_id, $substitutions = false)
+  {
+    // Extract the category and string ID
+    $category = substr($string_id, 0, ( strpos($string_id, '_') ));
+    $string_name = substr($string_id, ( strpos($string_id, '_') + 1 ));
+    $found = false;
+    if ( isset($this->strings[$category]) && isset($this->strings[$category][$string_name]) )
+    {
+      $found = true;
+      $string = $this->strings[$category][$string_name];
+    }
+    if ( !$found )
+    {
+      // Ehh, the string wasn't found. Rerun fetch() and try again.
+      if ( defined('IN_ENANO_INSTALL') )
+      {
+        return $string_id;
+      }
+      $this->fetch();
+      if ( isset($this->strings[$category]) && isset($this->strings[$category][$string_name]) )
+      {
+        $found = true;
+        $string = $this->strings[$category][$string_name];
+      }
+      if ( !$found )
+      {
+        // STILL not found. Check the default language.
+        $lang_default = ( $x = getConfig('default_language') ) ? intval($x) : $this->lang_id;
+        if ( $lang_default != $this->lang_id )
+        {
+          if ( !is_object($this->default) )
+            $this->default = new Language($lang_default);
+          return $this->default->get($string_id, $substitutions);
+        }
+      }
+    }
+    if ( !$found )
+    {
+      // Alright, it's nowhere. Return the input, grumble grumble...
+      return $string_id;
+    }
+    // Found it!
+    // Perform substitutions.
+    // if ( is_array($substitutions) )
+    //   die('<pre>' . print_r($substitutions, true) . '</pre>');
+    if ( !is_array($substitutions) )
+      $substitutions = array();
+    return $this->substitute($string, $substitutions);
+  }
+  
+  /**
+   * Processes substitutions.
+   * @param string
+   * @param array
+   * @return string
+   */
+  
+  function substitute($string, $subs)
+  {
+    preg_match_all('/%this\.([a-z0-9_]+)%/', $string, $matches);
+    if ( count($matches[0]) > 0 )
+    {
+      foreach ( $matches[1] as $i => $string_id )
+      {
+        $result = $this->get($string_id);
+        $string = str_replace($matches[0][$i], $result, $string);
+      }
+    }
+    preg_match_all('/%config\.([a-z0-9_]+)%/', $string, $matches);
+    if ( count($matches[0]) > 0 )
+    {
+      foreach ( $matches[1] as $i => $string_id )
+      {
+        $result = getConfig($string_id);
+        $string = str_replace($matches[0][$i], $result, $string);
+      }
+    }
+    foreach ( $subs as $key => $value )
+    {
+      $subs[$key] = strval($value);
+      $string = str_replace("%{$key}%", "{$subs[$key]}", $string);
+    }
+    return "{$string}*";
+  }
+  
+} // class Language
+
+?>
--- a/includes/pageutils.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/pageutils.php	Sun Nov 18 20:37:08 2007 -0500
@@ -1,7 +1,8 @@
 <?php
+
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.2 (Coblynau)
+ * Version 1.1.1
  * Copyright (C) 2006-2007 Dan Fuhry
  * pageutils.php - a class that handles raw page manipulations, used mostly by AJAX requests or their old-fashioned form-based counterparts
  *
@@ -546,6 +547,7 @@
   function histlist($page_id, $namespace)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     
     if(!$session->get_permissions('history_view'))
       return 'Access denied';
@@ -558,14 +560,17 @@
     
     $q = 'SELECT time_id,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action=\'edit\' AND page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' ORDER BY time_id DESC;';
     if(!$db->sql_query($q)) $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.');
-    echo 'History of edits and actions<h3>Edits:</h3>';
+    echo $lang->get('history_page_subtitle') . '
+          <h3>' . $lang->get('history_heading_edits') . '</h3>';
     $numrows = $db->numrows();
-    if($numrows < 1) echo 'No history entries in this category.';
+    if ( $numrows < 1 )
+    {
+      echo $lang->get('history_no_entries');
+    }
     else
     {
-      
       echo '<form action="'.makeUrlNS($namespace, $page_id, 'do=diff').'" onsubmit="ajaxHistDiff(); return false;" method="get">
-            <input type="submit" value="Compare selected revisions" />
+            <input type="submit" value="' . $lang->get('history_btn_compare') . '" />
             ' . ( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars($paths->nslist[$namespace] . $page_id) . '" />' : '' ) . '
             ' . ( $session->sid_super ? '<input type="hidden" name="auth"  value="' . $session->sid_super . '" />' : '') . '
             <input type="hidden" name="do" value="diff" />
@@ -573,17 +578,18 @@
             <div class="tblholder">
             <table border="0" width="100%" cellspacing="1" cellpadding="4">
             <tr>
-              <th colspan="2">Diff</th>
-              <th>Date/time</th>
-              <th>User</th>
-              <th>Edit summary</th>
-              <th>Minor</th>
-              <th colspan="3">Actions</th>
+              <th colspan="2">' . $lang->get('history_col_diff') . '</th>
+              <th>' . $lang->get('history_col_datetime') . '</th>
+              <th>' . $lang->get('history_col_user') . '</th>
+              <th>' . $lang->get('history_col_summary') . '</th>
+              <th>' . $lang->get('history_col_minor') . '</th>
+              <th colspan="3">' . $lang->get('history_col_actions') . '</th>
             </tr>'."\n"."\n";
       $cls = 'row2';
       $ticker = 0;
       
-      while($r = $db->fetchrow()) {
+      while ( $r = $db->fetchrow() )
+      {
         
         $ticker++;
         
@@ -617,7 +623,7 @@
         // User
         if ( $session->get_permissions('mod_misc') && is_valid_ip($r['author']) )
         {
-          $rc = ' style="cursor: pointer;" title="Click cell background for reverse DNS info" onclick="ajaxReverseDNS(this, \'' . $r['author'] . '\');"';
+          $rc = ' style="cursor: pointer;" title="' . $lang->get('history_tip_rdns') . '" onclick="ajaxReverseDNS(this, \'' . $r['author'] . '\');"';
         }
         else
         {
@@ -631,15 +637,19 @@
         echo '>' . $r['author'] . '</a></td class="' . $cls . '">'."\n";
         
         // Edit summary
+        if ( $r['edit_summary'] == 'Automatic backup created when logs were purged' )
+        {
+          $r['edit_summary'] = $lang->get('history_summary_clearlogs');
+        }
         echo '<td class="' . $cls . '">' . $r['edit_summary'] . '</td>'."\n";
         
         // Minor edit
         echo '<td class="' . $cls . '" style="text-align: center;">'. (( $r['minor_edit'] ) ? 'M' : '' ) .'</td>'."\n";
         
         // Actions!
-        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrlNS($namespace, $page_id, 'oldid=' . $r['time_id']) . '" onclick="ajaxHistView(\'' . $r['time_id'] . '\'); return false;">View revision</a></td>'."\n";
-        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrl($paths->nslist['Special'].'Contributions/' . $r['author']) . '">View user contribs</a></td>'."\n";
-        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrlNS($namespace, $page_id, 'do=rollback&amp;id=' . $r['time_id']) . '" onclick="ajaxRollback(\'' . $r['time_id'] . '\'); return false;">Revert to this revision</a></td>'."\n";
+        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrlNS($namespace, $page_id, 'oldid=' . $r['time_id']) . '" onclick="ajaxHistView(\'' . $r['time_id'] . '\'); return false;">' . $lang->get('history_action_view') . '</a></td>'."\n";
+        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrl($paths->nslist['Special'].'Contributions/' . $r['author']) . '">' . $lang->get('history_action_contrib') . '</a></td>'."\n";
+        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrlNS($namespace, $page_id, 'do=rollback&amp;id=' . $r['time_id']) . '" onclick="ajaxRollback(\'' . $r['time_id'] . '\'); return false;">' . $lang->get('history_action_restore') . '</a></td>'."\n";
         
         echo '</tr>'."\n"."\n";
         
@@ -648,18 +658,33 @@
             </div>
             <br />
             <input type="hidden" name="do" value="diff" />
-            <input type="submit" value="Compare selected revisions" />
+            <input type="submit" value="' . $lang->get('history_btn_compare') . '" />
             </form>
             <script type="text/javascript">if ( !KILL_SWITCH ) { buildDiffList(); }</script>';
     }
     $db->free_result();
-    echo '<h3>Other changes:</h3>';
+    echo '<h3>' . $lang->get('history_heading_other') . '</h3>';
     $q = 'SELECT time_id,action,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action!=\'edit\' AND page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $paths->namespace . '\' ORDER BY time_id DESC;';
-    if(!$db->sql_query($q)) $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.');
-    if($db->numrows() < 1) echo 'No history entries in this category.';
-    else {
+    if ( !$db->sql_query($q) )
+    {
+      $db->_die('The history data for the page "' . htmlspecialchars($paths->cpage['name']) . '" could not be selected.');
+    }
+    if ( $db->numrows() < 1 )
+    {
+      echo $lang->get('history_no_entries');
+    }
+    else
+    {
       
-      echo '<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><th>Date/time</th><th>User</th><th>Minor</th><th>Action taken</th><th>Extra info</th><th colspan="2"></th></tr>';
+      echo '<div class="tblholder">
+              <table border="0" width="100%" cellspacing="1" cellpadding="4"><tr>
+                <th>' . $lang->get('history_col_datetime') . '</th>
+                <th>' . $lang->get('history_col_user') . '</th>
+                <th>' . $lang->get('history_col_minor') . '</th>
+                <th>' . $lang->get('history_col_action_taken') . '</th>
+                <th>' . $lang->get('history_col_extra') . '</th>
+                <th colspan="2"></th>
+              </tr>';
       $cls = 'row2';
       while($r = $db->fetchrow()) {
         
@@ -683,23 +708,18 @@
         // Action taken
         echo '<td class="' . $cls . '">';
         // Some of these are sanitized at insert-time. Others follow the newer Enano policy of stripping HTML at runtime.
-        if    ($r['action']=='prot')     echo 'Protected page</td><td class="' . $cls . '">Reason: ' . $r['edit_summary'];
-        elseif($r['action']=='unprot')   echo 'Unprotected page</td><td class="' . $cls . '">Reason: ' . $r['edit_summary'];
-        elseif($r['action']=='semiprot') echo 'Semi-protected page</td><td class="' . $cls . '">Reason: ' . $r['edit_summary'];
-        elseif($r['action']=='rename')   echo 'Renamed page</td><td class="' . $cls . '">Old title: '.htmlspecialchars($r['edit_summary']);
-        elseif($r['action']=='create')   echo 'Created page</td><td class="' . $cls . '">';
-        elseif($r['action']=='delete')   echo 'Deleted page</td><td class="' . $cls . '">Reason: ' . $r['edit_summary'];
-        elseif($r['action']=='reupload') echo 'Uploaded new file version</td><td class="' . $cls . '">Reason: '.htmlspecialchars($r['edit_summary']);
+        if    ($r['action']=='prot')     echo $lang->get('history_log_protect') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary'];
+        elseif($r['action']=='unprot')   echo $lang->get('history_log_unprotect') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary'];
+        elseif($r['action']=='semiprot') echo $lang->get('history_log_semiprotect') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary'];
+        elseif($r['action']=='rename')   echo $lang->get('history_log_rename') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_oldtitle') . ' '.htmlspecialchars($r['edit_summary']);
+        elseif($r['action']=='create')   echo $lang->get('history_log_create') . '</td><td class="' . $cls . '">';
+        elseif($r['action']=='delete')   echo $lang->get('history_log_delete') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary'];
+        elseif($r['action']=='reupload') echo $lang->get('history_log_uploadnew') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' '.htmlspecialchars($r['edit_summary']);
         echo '</td>';
         
         // Actions!
-        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrl($paths->nslist['Special'].'Contributions/' . $r['author']) . '">View user contribs</a></td>';
-        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrlNS($namespace, $page_id, 'do=rollback&amp;id=' . $r['time_id']) . '" onclick="ajaxRollback(\'' . $r['time_id'] . '\'); return false;">Revert action</a></td>';
-        
-        //echo '(<a href="#" onclick="ajaxRollback(\'' . $r['time_id'] . '\'); return false;">rollback</a>) <i>' . $r['date_string'] . '</i> ' . $r['author'] . ' (<a href="'.makeUrl($paths->nslist['User'].$r['author']).'">Userpage</a>, <a href="'.makeUrl($paths->nslist['Special'].'Contributions/' . $r['author']) . '">Contrib</a>): ';
-        
-        if($r['minor_edit']) echo '<b> - minor edit</b>';
-        echo '<br />';
+        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrl($paths->nslist['Special'].'Contributions/' . $r['author']) . '">' . $lang->get('history_action_contrib') . '</a></td>';
+        echo '<td class="' . $cls . '" style="text-align: center;"><a href="'.makeUrlNS($namespace, $page_id, 'do=rollback&amp;id=' . $r['time_id']) . '" onclick="ajaxRollback(\'' . $r['time_id'] . '\'); return false;">' . $lang->get('history_action_revert') . '</a></td>';
         
         echo '</tr>';
       }
@@ -922,6 +942,7 @@
   function comments_raw($page_id, $namespace, $action = false, $flags = Array(), $_ob = '')
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     
     $pname = $paths->nslist[$namespace] . $page_id;
     
@@ -962,8 +983,8 @@
         $q = 'UPDATE ' . table_prefix.'comments SET approved=' . $a . ' WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' AND ' . $where . ';';
         $e=$db->sql_query($q);
         if(!$e) die('alert(unesape(\''.rawurlencode('Error during query: '.mysql_error().'\n\nQuery:\n' . $q) . '\'));');
-        if($a=='1') $v = 'Unapprove';
-        else $v = 'Approve';
+        if($a=='1') $v = $lang->get('comment_btn_mod_unapprove');
+        else $v = $lang->get('comment_btn_mod_approve');
         echo 'document.getElementById("mdgApproveLink'.intval($_GET['id']).'").innerHTML="' . $v . '";';
         break;
       }
@@ -991,22 +1012,32 @@
                   WHERE page_id=\'' . $page_id . '\'
                   AND namespace=\'' . $namespace . '\' ORDER BY c.time ASC;');
     if(!$lq) _die('The comment text data could not be selected. '.mysql_error());
-    $_ob .= '<h3>Article Comments</h3>';
+    $_ob .= '<h3>' . $lang->get('comment_heading') . '</h3>';
+    
     $n = ( $session->get_permissions('mod_comments')) ? $db->numrows() : $num_app;
-    if($n==1) $s = 'is ' . $n . ' comment'; else $s = 'are ' . $n . ' comments';
-    if($n < 1)
+    
+    $subst = array(
+        'num_comments' => $n,
+        'page_type' => $template->namespace_string
+      );
+    
+    $_ob .= '<p>';
+    $_ob .= ( $n == 0 ) ? $lang->get('comment_msg_count_zero', $subst) : ( $n == 1 ? $lang->get('comment_msg_count_one', $subst) : $lang->get('comment_msg_count_plural', $subst) );
+    
+    if ( $session->get_permissions('mod_comments') && $num_unapp > 0 )
     {
-      $_ob .= '<p>There are currently no comments on this '.strtolower($namespace).'';
-      if($namespace != 'Article') $_ob .= ' page';
-      $_ob .= '.</p>';
-    } else $_ob .= '<p>There ' . $s . ' on this article.';
-    if($session->get_permissions('mod_comments') && $num_unapp > 0) $_ob .= ' <span style="color: #D84308">' . $num_unapp . ' of those are unapproved.</span>';
-    elseif(!$session->get_permissions('mod_comments') && $num_unapp > 0) { $u = ($num_unapp == 1) ? "is $num_unapp comment" : "are $num_unapp comments"; $_ob .= ' However, there ' . $u . ' awating approval.'; }
+      $_ob .= ' <span style="color: #D84308">' . $lang->get('comment_msg_count_unapp_mod', array( 'num_unapp' => $num_unapp )) . '</span>';
+    }
+    else if ( !$session->get_permissions('mod_comments') && $num_unapp > 0 )
+    {
+      $ls = ( $num_unapp == 1 ) ? 'comment_msg_count_unapp_one' : 'comment_msg_count_unapp_plural';
+      $_ob .= ' <span>' . $lang->get($ls, array( 'num_unapp' => $num_unapp )) . '</span>';
+    }
     $_ob .= '</p>';
     $list = 'list = { ';
     // _die(htmlspecialchars($ttext));
     $i = -1;
-    while($row = $db->fetchrow($lq))
+    while ( $row = $db->fetchrow($lq) )
     {
       $i++;
       $strings = Array();
@@ -1020,14 +1051,14 @@
         
         // Determine the name, and whether to link to the user page or not
         $name = '';
-        if($row['user_id'] > 0) $name .= '<a href="'.makeUrlNS('User', str_replace(' ', '_', $row['name'])).'">';
+        if($row['user_id'] > 1) $name .= '<a href="'.makeUrlNS('User', str_replace(' ', '_', $row['name'])).'">';
         $name .= $row['name'];
-        if($row['user_id'] > 0) $name .= '</a>';
+        if($row['user_id'] > 1) $name .= '</a>';
         $strings['NAME'] = $name; unset($name);
         
         // Subject
         $s = $row['subject'];
-        if(!$row['approved']) $s .= ' <span style="color: #D84308">(Unapproved)</span>';
+        if(!$row['approved']) $s .= ' <span style="color: #D84308">' . $lang->get('comment_msg_note_unapp') . '</span>';
         $strings['SUBJECT'] = $s;
         
         // Date and time
@@ -1038,16 +1069,17 @@
         {
           default:
           case USER_LEVEL_GUEST:
-            $l = 'Guest';
+            $l = $lang->get('user_type_guest');
             break;
           case USER_LEVEL_MEMBER:
-            $l = 'Member';
+          case USER_LEVEL_CHPREF:
+            $l = $lang->get('user_type_member');
             break;
           case USER_LEVEL_MOD:
-            $l = 'Moderator';
+            $l = $lang->get('user_type_mod');
             break;
           case USER_LEVEL_ADMIN:
-            $l = 'Administrator';
+            $l = $lang->get('user_type_admin');
             break;
         }
         $strings['USER_LEVEL'] = $l; unset($l);
@@ -1058,10 +1090,10 @@
         if($session->get_permissions('edit_comments'))
         {
           // Edit link
-          $strings['EDIT_LINK'] = '<a href="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=editcomment&amp;id=' . $row['comment_id']) . '" id="editbtn_' . $i . '">edit</a>';
+          $strings['EDIT_LINK'] = '<a href="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=editcomment&amp;id=' . $row['comment_id']) . '" id="editbtn_' . $i . '">' . $lang->get('comment_btn_edit') . '</a>';
         
           // Delete link
-          $strings['DELETE_LINK'] = '<a href="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=deletecomment&amp;id=' . $row['comment_id']) . '">delete</a>';
+          $strings['DELETE_LINK'] = '<a href="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=deletecomment&amp;id=' . $row['comment_id']) . '">' . $lang->get('comment_btn_delete') . '</a>';
         }
         else
         {
@@ -1073,19 +1105,19 @@
         }
         
         // Send PM link
-        $strings['SEND_PM_LINK'] = ( $session->user_logged_in && $row['user_id'] > 0 ) ? '<a href="'.makeUrlNS('Special', 'PrivateMessages/Compose/To/' . $row['name']) . '">Send private message</a><br />' : '';
+        $strings['SEND_PM_LINK'] = ( $session->user_logged_in && $row['user_id'] > 1 ) ? '<a href="'.makeUrlNS('Special', 'PrivateMessages/Compose/To/' . $row['name']) . '">' . $lang->get('comment_btn_send_privmsg') . '</a><br />' : '';
         
         // Add Buddy link
-        $strings['ADD_BUDDY_LINK'] = ( $session->user_logged_in && $row['user_id'] > 0 ) ? '<a href="'.makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' . $row['name']) . '">Add to buddy list</a>' : '';
+        $strings['ADD_BUDDY_LINK'] = ( $session->user_logged_in && $row['user_id'] > 1 ) ? '<a href="'.makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' . $row['name']) . '">' . $lang->get('comment_btn_add_buddy') . '</a>' : '';
         
         // Mod links
         $applink = '';
         $applink .= '<a href="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=admin&amp;action=approve&amp;id=' . $row['comment_id']) . '" id="mdgApproveLink' . $i . '">';
-        if($row['approved']) $applink .= 'Unapprove';
-        else $applink .= 'Approve';
+        if($row['approved']) $applink .= $lang->get('comment_btn_mod_unapprove');
+        else $applink .= $lang->get('comment_btn_mod_approve');
         $applink .= '</a>';
         $strings['MOD_APPROVE_LINK'] = $applink; unset($applink);
-        $strings['MOD_DELETE_LINK'] = '<a href="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=admin&amp;action=delete&amp;id=' . $row['comment_id']) . '">Delete</a>';
+        $strings['MOD_DELETE_LINK'] = '<a href="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=admin&amp;action=delete&amp;id=' . $row['comment_id']) . '">' . $lang->get('comment_btn_mod_delete') . '</a>';
         
         // Signature
         $strings['SIGNATURE'] = '';
@@ -1103,32 +1135,31 @@
     }
     if(getConfig('comments_need_login') != '2' || $session->user_logged_in)
     {
-      if(!$session->get_permissions('post_comments'))
-      {
-        $_ob .= '<h3>Got something to say?</h3><p>Access to post comments on this page is denied.</p>';
-      }
-      else
+      if($session->get_permissions('post_comments'))
       {
-        $_ob .= '<h3>Got something to say?</h3>If you have comments or suggestions on this article, you can shout it out here.';
-        if(getConfig('approve_comments')=='1') $_ob .= '  Before your comment will be visible to the public, a moderator will have to approve it.';
-        if(getConfig('comments_need_login') == '1' && !$session->user_logged_in) $_ob .= ' Because you are not logged in, you will need to enter a visual confirmation before your comment will be posted.';
+        $_ob .= '<h3>' . $lang->get('comment_postform_title') . '</h3>';
+        $_ob .= $lang->get('comment_postform_blurb');
+        if(getConfig('approve_comments')=='1') $_ob .= ' ' . $lang->get('comment_postform_blurb_unapp');
+        if(getConfig('comments_need_login') == '1' && !$session->user_logged_in)
+        {
+          $_ob .= ' ' . $lang->get('comment_postform_blurb_captcha');
+        }
         $sn = $session->user_logged_in ? $session->username . '<input name="name" id="mdgScreenName" type="hidden" value="' . $session->username . '" />' : '<input name="name" id="mdgScreenName" type="text" size="35" />';
-        $_ob .= '  <a href="#" id="mdgCommentFormLink" style="display: none;" onclick="document.getElementById(\'mdgCommentForm\').style.display=\'block\';this.style.display=\'none\';return false;">Leave a comment...</a>
+        $_ob .= '  <a href="#" id="mdgCommentFormLink" style="display: none;" onclick="document.getElementById(\'mdgCommentForm\').style.display=\'block\';this.style.display=\'none\';return false;">' . $lang->get('comment_postform_blurb_link') . '</a>
         <div id="mdgCommentForm">
-        <h3>Comment form</h3>
         <form action="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=postcomment').'" method="post" style="margin-left: 1em">
         <table border="0">
-        <tr><td>Your name or screen name:</td><td>' . $sn . '</td></tr>
-        <tr><td>Comment subject:</td><td><input name="subj" id="mdgSubject" type="text" size="35" /></td></tr>';
+        <tr><td>' . $lang->get('comment_postform_field_name') . '</td><td>' . $sn . '</td></tr>
+        <tr><td>' . $lang->get('comment_postform_field_subject') . '</td><td><input name="subj" id="mdgSubject" type="text" size="35" /></td></tr>';
         if(getConfig('comments_need_login') == '1' && !$session->user_logged_in)
         {
           $session->kill_captcha();
           $captcha = $session->make_captcha();
-          $_ob .= '<tr><td>Visual confirmation:<br /><small>Please enter the code you see on the right.</small></td><td><img src="'.makeUrlNS('Special', 'Captcha/' . $captcha) . '" alt="Visual confirmation" style="cursor: pointer;" onclick="this.src = \''.makeUrlNS("Special", "Captcha/".$captcha).'/\'+Math.floor(Math.random() * 100000);" /><input name="captcha_id" id="mdgCaptchaID" type="hidden" value="' . $captcha . '" /><br />Code: <input name="captcha_input" id="mdgCaptchaInput" type="text" size="10" /><br /><small><script type="text/javascript">document.write("If you can\'t read the code, click on the image to generate a new one.");</script><noscript>If you can\'t read the code, please refresh this page to generate a new one.</noscript></small></td></tr>';
+          $_ob .= '<tr><td>' . $lang->get('comment_postform_field_captcha_title') . '<br /><small>' . $lang->get('comment_postform_field_captcha_blurb') . '</small></td><td><img src="'.makeUrlNS('Special', 'Captcha/' . $captcha) . '" alt="Visual confirmation" style="cursor: pointer;" onclick="this.src = \''.makeUrlNS("Special", "Captcha/".$captcha).'/\'+Math.floor(Math.random() * 100000);" /><input name="captcha_id" id="mdgCaptchaID" type="hidden" value="' . $captcha . '" /><br />' . $lang->get('comment_postform_field_captcha_label') . ' <input name="captcha_input" id="mdgCaptchaInput" type="text" size="10" /><br /><small><script type="text/javascript">document.write("' . $lang->get('comment_postform_field_captcha_cantread_js') . '");</script><noscript>' . $lang->get('comment_postform_field_captcha_cantread_nojs') . '</noscript></small></td></tr>';
         }
         $_ob .= '
-        <tr><td valign="top">Comment text:<br />(most HTML will be stripped)</td><td><textarea name="text" id="mdgCommentArea" rows="10" cols="40"></textarea></td></tr>
-        <tr><td colspan="2" style="text-align: center;"><input type="submit" value="Submit Comment" /></td></tr>
+        <tr><td valign="top">' . $lang->get('comment_postform_field_comment') . '</td><td><textarea name="text" id="mdgCommentArea" rows="10" cols="40"></textarea></td></tr>
+        <tr><td colspan="2" style="text-align: center;"><input type="submit" value="' . $lang->get('comment_postform_btn_submit') . '" /></td></tr>
         </table>
         </form>
         </div>';
@@ -1359,6 +1390,7 @@
   function rename($page_id, $namespace, $name)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     
     $pname = $paths->nslist[$namespace] . $page_id;
     
@@ -1367,7 +1399,7 @@
     
     if( empty($name)) 
     {
-      die('Name is too short');
+      return($lang->get('ajax_rename_too_short'));
     }
     if( ( $session->get_permissions('rename') && ( ( $prot && $session->get_permissions('even_when_protected') ) || !$prot ) ) && ( $paths->namespace != 'Special' && $paths->namespace != 'Admin' ))
     {
@@ -1383,12 +1415,16 @@
       }
       else
       {
-        return('The page "' . $paths->pages[$pname]['name'] . '" has been renamed to "' . $name . '". You are encouraged to leave a comment explaining your action.' . "\n\n" . 'You will see the change take effect the next time you reload this page.');
+        $subst = array(
+          'page_name_old' => $paths->pages[$pname]['name'],
+          'page_name_new' => $name
+          );
+        return $lang->get('ajax_rename_success', $subst);
       }
     }
     else
     {
-      return('Access is denied.');
+      return($lang->get('etc_access_denied'));
     }
   }
   
@@ -1402,7 +1438,16 @@
   function flushlogs($page_id, $namespace)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
-    if(!$session->get_permissions('clear_logs')) die('Administrative privileges are required to flush logs, you loser.');
+    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');
+    }
     $e = $db->sql_query('DELETE FROM ' . table_prefix.'logs WHERE page_id=\'' . $db->escape($page_id) . '\' AND namespace=\'' . $db->escape($namespace) . '\';');
     if(!$e) $db->_die('The log entries could not be deleted.');
     
@@ -1417,7 +1462,7 @@
       $q='INSERT INTO ' . table_prefix.'logs(log_type,action,time_id,date_string,page_id,namespace,page_text,char_tag,author,edit_summary,minor_edit) VALUES(\'page\', \'edit\', '.time().', \''.date('d M Y h:i a').'\', \'' . $page_id . '\', \'' . $namespace . '\', \'' . $db->escape($row['page_text']) . '\', \'' . $row['char_tag'] . '\', \'' . $session->username . '\', \''."Automatic backup created when logs were purged".'\', '.'false'.');';
       if(!$db->sql_query($q)) $db->_die('The history (log) entry could not be inserted into the logs table.');
     }
-    return('The logs for this page have been cleared. A backup of this page has been added to the logs table so that this page can be restored in case of vandalism or spam later.');
+    return $lang->get('ajax_clearlogs_success');
   }
   
   /**
@@ -1431,11 +1476,12 @@
   function deletepage($page_id, $namespace, $reason)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     $perms = $session->fetch_page_acl($page_id, $namespace);
     $x = trim($reason);
     if ( empty($x) )
     {
-      return 'Invalid reason for deletion passed';
+      return $lang->get('ajax_delete_need_reason');
     }
     if(!$perms->get_permissions('delete_page')) return('Administrative privileges are required to delete pages, you loser.');
     $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'delete\', \'' . $page_id . '\', \'' . $namespace . '\', \'' . $session->username . '\', \'' . $db->escape(htmlspecialchars($reason)) . '\')');
@@ -1450,7 +1496,7 @@
     if(!$e) $db->_die('The page entry could not be deleted.');
     $e = $db->sql_query('DELETE FROM ' . table_prefix.'files WHERE page_id=\'' . $page_id . '\'');
     if(!$e) $db->_die('The file entry could not be deleted.');
-    return('This page has been deleted. Note that there is still a log of edits and actions in the database, and anyone with admin rights can raise this page from the dead unless the log is cleared. If the deleted file is an image, there may still be cached thumbnails of it in the cache/ directory, which is inaccessible to users.');
+    return $lang->get('ajax_delete_success');
   }
   
   /**
@@ -1463,9 +1509,10 @@
   function delvote($page_id, $namespace)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     if ( !$session->get_permissions('vote_delete') )
     {
-      return 'Access denied';
+      return $lang->get('etc_access_denied');
     }
     
     if ( $namespace == 'Admin' || $namespace == 'Special' || $namespace == 'System' )
@@ -1504,7 +1551,7 @@
     
     if ( in_array($session->username, $ips['u']) || in_array($_SERVER['REMOTE_ADDR'], $ips['ip']) )
     {
-      return 'It appears that you have already voted to have this page deleted.';
+      return $lang->get('ajax_delvote_already_voted');
     }
     
     $ips['u'][] = $session->username;
@@ -1516,7 +1563,7 @@
     $q = 'UPDATE ' . table_prefix.'pages SET delvotes=' . $cv . ',delvote_ips=\'' . $ips . '\' WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'';
     $w = $db->sql_query($q);
     
-    return 'Your vote to have this page deleted has been cast.'."\nYou are encouraged to leave a comment explaining the reason for your vote.";
+    return $lang->get('ajax_delvote_success');
   }
   
   /**
@@ -1529,11 +1576,18 @@
   function resetdelvotes($page_id, $namespace)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
-    if(!$session->get_permissions('vote_reset')) die('You need moderator rights in order to do this, stinkin\' hacker.');
+    global $lang;
+    if(!$session->get_permissions('vote_reset'))
+    {
+      return $lang->get('etc_access_denied');
+    }
     $q = 'UPDATE ' . table_prefix.'pages SET delvotes=0,delvote_ips=\'' . $db->escape(serialize(array('ip'=>array(),'u'=>array()))) . '\' WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'';
     $e = $db->sql_query($q);
     if(!$e) $db->_die('The number of delete votes was not reset.');
-    else return('The number of votes for having this page deleted has been reset to zero.');
+    else
+    {
+      return $lang->get('ajax_delvote_reset_success');
+    }
   }
   
   /**
@@ -1594,6 +1648,8 @@
   function catedit_raw($page_id, $namespace)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
+    
     ob_start();
     $_ob = '';
     $e = $db->sql_query('SELECT category_id FROM ' . table_prefix.'categories WHERE page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $paths->namespace . '\'');
@@ -1631,11 +1687,11 @@
     }
     
     echo 'catlist = new Array();'; // Initialize the client-side category list
-    $_ob .= '<h3>Select which categories this page should be included in.</h3>
+    $_ob .= '<h3>' . $lang->get('catedit_title') . '</h3>
              <form name="mdgCatForm" action="'.makeUrlNS($namespace, $page_id, 'do=catedit').'" method="post">';
     if ( sizeof($cat_info) < 1 )
     {
-      $_ob .= '<p>There are no categories on this site yet.</p>';
+      $_ob .= '<p>' . $lang->get('catedit_no_categories') . '</p>';
     }
     for ( $i = 0; $i < sizeof($cat_info) / 2; $i++ )
     {
@@ -1656,7 +1712,7 @@
     
     $disabled = ( sizeof($cat_info) < 1 ) ? 'disabled="disabled"' : '';
       
-    $_ob .= '<div style="border-top: 1px solid #CCC; padding-top: 5px; margin-top: 10px;"><input name="__enanoSaveButton" ' . $disabled . ' style="font-weight: bold;" type="submit" onclick="ajaxCatSave(); return false;" value="Save changes" /> <input name="__enanoCatCancel" type="submit" onclick="ajaxReset(); return false;" value="Cancel" /></div></form>';
+    $_ob .= '<div style="border-top: 1px solid #CCC; padding-top: 5px; margin-top: 10px;"><input name="__enanoSaveButton" ' . $disabled . ' style="font-weight: bold;" type="submit" onclick="ajaxCatSave(); return false;" value="' . $lang->get('etc_save_changes') . '" /> <input name="__enanoCatCancel" type="submit" onclick="ajaxReset(); return false;" value="' . $lang->get('etc_cancel') . '" /></div></form>';
     
     $cont = ob_get_contents();
     ob_end_clean();
@@ -1771,13 +1827,14 @@
   function setpass($page_id, $namespace, $pass)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     // Determine permissions
     if($paths->pages[$paths->nslist[$namespace].$page_id]['password'] != '')
       $a = $session->get_permissions('password_reset');
     else
       $a = $session->get_permissions('password_set');
     if(!$a)
-      return 'Access is denied';
+      return $lang->get('etc_access_denied');
     if(!isset($pass)) return('Password was not set on URL');
     $p = $pass;
     if ( !preg_match('#([0-9a-f]){40,40}#', $p) )
@@ -1795,9 +1852,12 @@
     // Is the new password blank?
     if ( $p == '' )
     {
-      return('The password for this page has been disabled.');
+      return $lang->get('ajax_password_disable_success');
     }
-    else return('The password for this page has been set.');
+    else
+    {
+      return $lang->get('ajax_password_success');
+    }
   }
   
   /**
@@ -1808,7 +1868,8 @@
    
   function genPreview($text)
   {
-    $ret = '<div class="info-box"><b>Reminder:</b> This is only a preview - your changes to this page have not yet been saved.</div><div style="background-color: #F8F8F8; padding: 10px; border: 1px dashed #406080; max-height: 250px; overflow: auto; margin: 1em 0 1em 1em;">';
+    global $lang;
+    $ret = '<div class="info-box">' . $lang->get('editor_preview_blurb') . '</div><div style="background-color: #F8F8F8; padding: 10px; border: 1px dashed #406080; max-height: 250px; overflow: auto; margin: 1em 0 1em 1em;">';
     $text = RenderMan::render(RenderMan::preprocess_text($text, false, false));
     ob_start();
     eval('?>' . $text);
@@ -1843,8 +1904,9 @@
   function pagediff($page_id, $namespace, $id1, $id2)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     if(!$session->get_permissions('history_view'))
-      return 'Access denied';
+      return $lang->get('etc_access_denied');
     if(!preg_match('#^([0-9]+)$#', (string)$id1) ||
        !preg_match('#^([0-9]+)$#', (string)$id2  )) return 'SQL injection attempt';
     // OK we made it through security
@@ -1861,7 +1923,7 @@
     $time1 = date('F d, Y h:i a', $id1);
     $time2 = date('F d, Y h:i a', $id2);
     $_ob = "
-    <p>Comparing revisions: {$time1} &rarr; {$time2}</p>
+    <p>" . $lang->get('history_lbl_comparingrevisions') . " {$time1} &rarr; {$time2}</p>
     ";
     // Free some memory
     unset($row1, $row2, $q1, $q2);
@@ -1872,8 +1934,6 @@
   
   /**
    * Gets ACL information about the selected page for target type X and target ID Y.
-   * @param string $page_id The page ID
-   * @param string $namespace The namespace
    * @param array $parms What to select. This is an array purely for JSON compatibility. It should be an associative array with keys target_type and target_id.
    * @return array
    */
@@ -1881,11 +1941,13 @@
   function acl_editor($parms = Array())
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
+    
     if(!$session->get_permissions('edit_acl') && $session->user_level < USER_LEVEL_ADMIN)
     {
       return Array(
         'mode' => 'error',
-        'error' => 'You are not authorized to view or edit access control lists.'
+        'error' => $lang->get('acl_err_access_denied')
         );
     }
     $parms['page_id'] = ( isset($parms['page_id']) ) ? $parms['page_id'] : false;
@@ -1903,7 +1965,7 @@
     {
       return Array(
         'mode' => 'error',
-        'error' => 'It seems that (a) the file acledit.tpl is missing from these theme, and (b) the JSON response is working.',
+        'error' => $lang->get('acl_err_missing_template'),
       );
     }
     $return['template'] = $template->extract_vars('acledit.tpl');
@@ -1964,7 +2026,7 @@
                 if(!$q)
                   return(Array('mode'=>'error','error'=>mysql_error()));
                 if($db->numrows() < 1)
-                  return Array('mode'=>'error','error'=>'The username you entered was not found.');
+                  return Array('mode'=>'error','error'=>$lang->get('acl_err_user_not_found'));
                 $row = $db->fetchrow();
                 $return['target_name'] = $return['target_id'];
                 $return['target_id'] = intval($row['user_id']);
@@ -2011,7 +2073,7 @@
                 if(!$q)
                   return(Array('mode'=>'error','error'=>mysql_error()));
                 if($db->numrows() < 1)
-                  return Array('mode'=>'error','error'=>'The group ID you submitted is not valid.');
+                  return Array('mode'=>'error','error'=>$lang->get('acl_err_bad_group_id'));
                 $row = $db->fetchrow();
                 $return['target_name'] = $row['group_name'];
                 $return['target_id'] = intval($row['group_id']);
@@ -2053,7 +2115,7 @@
         case 'save_edit':
           if ( defined('ENANO_DEMO_MODE') )
           {
-            return Array('mode'=>'error','error'=>'Editing access control lists is disabled in the administration demo.');
+            return Array('mode'=>'error','error'=>$lang->get('acl_err_demo'));
           }
           $q = $db->sql_query('DELETE FROM ' . table_prefix.'acl WHERE target_type='.intval($parms['target_type']).' AND target_id='.intval($parms['target_id']).'
             ' . $page_where_clause_lite . ';');
@@ -2064,7 +2126,7 @@
           {
             return array(
                 'mode' => 'error', 
-                'error' => 'Supplied rule list has a length of zero'
+                'error' => $lang->get('acl_err_zero_list')
               );
           }
           $q = ($page_id && $namespace) ? 'INSERT INTO ' . table_prefix.'acl ( target_type, target_id, page_id, namespace, rules )
@@ -2084,7 +2146,7 @@
         case 'delete':
           if ( defined('ENANO_DEMO_MODE') )
           {
-            return Array('mode'=>'error','error'=>'Editing access control lists is disabled in the administration demo.');
+            return Array('mode'=>'error','error'=>$lang->get('acl_err_demo'));
           }
           $q = $db->sql_query('DELETE FROM ' . table_prefix.'acl WHERE target_type='.intval($parms['target_type']).' AND target_id='.intval($parms['target_id']).'
             ' . $page_where_clause_lite . ';');
@@ -2131,6 +2193,7 @@
   function aclmanager($parms)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     ob_start();
     // Convenience
     $formstart = '<form 
@@ -2151,20 +2214,21 @@
         echo '<pre>' . htmlspecialchars($response['text']) . '</pre>';
         break;
       case 'stage1':
-        echo '<h3>Manage page access</h3>
-              <p>Please select who should be affected by this access rule.</p>';
+        echo '<h3>' . $lang->get('acl_lbl_welcome_title') . '</h3>
+              <p>' . $lang->get('acl_lbl_welcome_body') . '</p>';
         echo $formstart;
-        echo '<p><label><input type="radio" name="data[target_type]" value="' . ACL_TYPE_GROUP . '" checked="checked" /> A usergroup</label></p>
+        echo '<p><label><input type="radio" name="data[target_type]" value="' . ACL_TYPE_GROUP . '" checked="checked" /> ' . $lang->get('acl_radio_usergroup') . '</label></p>
               <p><select name="data[target_id_grp]">';
         foreach ( $response['groups'] as $group )
         {
           echo '<option value="' . $group['id'] . '">' . $group['name'] . '</option>';
         }
+        
         // page group selector
         $groupsel = '';
         if ( count($response['page_groups']) > 0 )
         {
-          $groupsel = '<p><label><input type="radio" name="data[scope]" value="page_group" /> A group of pages</label></p>
+          $groupsel = '<p><label><input type="radio" name="data[scope]" value="page_group" /> ' . $lang->get('acl_radio_scope_pagegroup') . '</label></p>
                        <p><select name="data[pg_id]">';
           foreach ( $response['page_groups'] as $grp )
           {
@@ -2174,24 +2238,24 @@
         }
         
         echo '</select></p>
-              <p><label><input type="radio" name="data[target_type]" value="' . ACL_TYPE_USER . '" /> A specific user</label></p>
+              <p><label><input type="radio" name="data[target_type]" value="' . ACL_TYPE_USER . '" /> ' . $lang->get('acl_radio_user') . '</label></p>
               <p>' . $template->username_field('data[target_id_user]') . '</p>
-              <p>What should this access rule control?</p>
-              <p><label><input name="data[scope]" value="only_this" type="radio" checked="checked" /> Only this page</p>
+              <p>' . $lang->get('acl_lbl_scope') . '</p>
+              <p><label><input name="data[scope]" value="only_this" type="radio" checked="checked" /> ' . $lang->get('acl_radio_scope_thispage') . '</p>
               ' . $groupsel . '
-              <p><label><input name="data[scope]" value="entire_site" type="radio" /> The entire site</p>
+              <p><label><input name="data[scope]" value="entire_site" type="radio" /> ' . $lang->get('acl_radio_scope_wholesite') . '</p>
               <div style="margin: 0 auto 0 0; text-align: right;">
                 <input name="data[mode]" value="seltarget" type="hidden" />
                 <input type="hidden" name="data[page_id]" value="' . $paths->cpage['urlname_nons'] . '" />
                 <input type="hidden" name="data[namespace]" value="' . $paths->namespace . '" />
-                <input type="submit" value="Next &gt;" />
+                <input type="submit" value="' . htmlspecialchars($lang->get('etc_wizard_next')) . '" />
               </div>';
         echo $formend;
         break;
       case 'success':
         echo '<div class="info-box">
-                <b>Permissions updated</b><br />
-                The permissions for ' . $response['target_name'] . ' on this page have been updated successfully.<br />
+                <b>' . $lang->get('acl_lbl_save_success_title') . '</b><br />
+                ' . $lang->get('acl_lbl_save_success_body', array( 'target_name' => $response['target_name'] )) . '<br />
                 ' . $formstart . '
                 <input type="hidden" name="data[mode]" value="seltarget" />
                 <input type="hidden" name="data[target_type]" value="' . $response['target_type'] . '" />
@@ -2200,14 +2264,14 @@
                 <input type="hidden" name="data[scope]" value="' . ( ( $response['page_id'] ) ? 'only_this' : 'entire_site' ) . '" />
                 <input type="hidden" name="data[page_id]" value="' . ( ( $response['page_id'] ) ? $response['page_id'] : 'false' ) . '" />
                 <input type="hidden" name="data[namespace]" value="' . ( ( $response['namespace'] ) ? $response['namespace'] : 'false' ) . '" />
-                <input type="submit" value="Return to ACL editor" /> <input type="submit" name="data[act_go_stage1]" value="Return to user/scope selection" />
+                <input type="submit" value="' . $lang->get('acl_btn_returnto_editor') . '" /> <input type="submit" name="data[act_go_stage1]" value="' . $lang->get('acl_btn_returnto_userscope') . '" />
                 ' . $formend . '
               </div>';
         break;
       case 'delete':
         echo '<div class="info-box">
-                <b>Rule deleted</b><br />
-                The selected access rule has been successfully deleted.<br />
+                <b>' . $lang->get('acl_lbl_delete_success_title') . '</b><br />
+                ' . $lang->get('acl_lbl_delete_success_body', array('target_name' => $response['target_name'])) . '<br />
                 ' . $formstart . '
                 <input type="hidden" name="data[mode]" value="seltarget" />
                 <input type="hidden" name="data[target_type]" value="' . $response['target_type'] . '" />
@@ -2216,22 +2280,27 @@
                 <input type="hidden" name="data[scope]" value="' . ( ( $response['page_id'] ) ? 'only_this' : 'entire_site' ) . '" />
                 <input type="hidden" name="data[page_id]" value="' . ( ( $response['page_id'] ) ? $response['page_id'] : 'false' ) . '" />
                 <input type="hidden" name="data[namespace]" value="' . ( ( $response['namespace'] ) ? $response['namespace'] : 'false' ) . '" />
-                <input type="submit" value="Return to ACL editor" /> <input type="submit" name="data[act_go_stage1]" value="Return to user/scope selection" />
+                <input type="submit" value="' . $lang->get('acl_btn_returnto_editor') . '" /> <input type="submit" name="data[act_go_stage1]" value="' . $lang->get('acl_btn_returnto_userscope') . '" />
                 ' . $formend . '
               </div>';
         break;
       case 'seltarget':
         if ( $response['type'] == 'edit' )
         {
-          echo '<h3>Editing permissions</h3>';
+          echo '<h3>' . $lang->get('acl_lbl_editwin_title_edit') . '</h3>';
         }
         else
         {
-          echo '<h3>Create new rule</h3>';
+          echo '<h3>' . $lang->get('acl_lbl_editwin_title_create') . '</h3>';
         }
-        $type  = ( $response['target_type'] == ACL_TYPE_GROUP ) ? 'group' : 'user';
-        $scope = ( $response['page_id'] ) ? ( $response['namespace'] == '__PageGroup' ? 'this group of pages' : 'this page' ) : 'this entire site';
-        echo 'This panel allows you to edit what the ' . $type . ' "' . $response['target_name'] . '" can do on <b>' . $scope . '</b>. Unless you set a permission to "Deny", these permissions may be overridden by other rules.';
+        $type  = ( $response['target_type'] == ACL_TYPE_GROUP ) ? $lang->get('acl_target_type_group') : $lang->get('acl_target_type_user');
+        $scope = ( $response['page_id'] ) ? ( $response['namespace'] == '__PageGroup' ? $lang->get('acl_scope_type_pagegroup') : $lang->get('acl_scope_type_thispage') ) : $lang->get('acl_scope_type_wholesite');
+        $subs = array(
+            'target_type' => $type,
+            'target' => $response['target_name'],
+            'scope_type' => $scope
+          );
+        echo $lang->get('acl_lbl_editwin_body', $subs);
         echo $formstart;
         $parser = $template->makeParserText( $response['template']['acl_field_begin'] );
         echo $parser->run();
@@ -2265,7 +2334,14 @@
               break;
           }
           $vars['FIELD_NAME'] = 'data[perms][' . $acl_type . ']';
-          $vars['FIELD_DESC'] = $response['acl_descs'][$acl_type];
+          if ( preg_match('/^([a-z0-9_]+)$/', $response['acl_descs'][$acl_type]) )
+          {
+            $vars['FIELD_DESC'] = $lang->get($response['acl_descs'][$acl_type]);
+          }
+          else
+          {
+            $vars['FIELD_DESC'] = $response['acl_descs'][$acl_type];
+          }
           $parser->assign_vars($vars);
           echo $parser->run();
         }
@@ -2278,7 +2354,7 @@
                 <input type="hidden" name="data[target_type]" value="' . $response['target_type'] . '" />
                 <input type="hidden" name="data[target_id]" value="' . $response['target_id'] . '" />
                 <input type="hidden" name="data[target_name]" value="' . $response['target_name'] . '" />
-                ' . ( ( $response['type'] == 'edit' ) ? '<input type="submit" value="Save changes" />&nbsp;&nbsp;<input type="submit" name="data[act_delete_rule]" value="Delete rule" style="color: #AA0000;" onclick="return confirm(\'Do you really want to delete this ACL rule?\');" />' : '<input type="submit" value="Create rule" />' ) . '
+                ' . ( ( $response['type'] == 'edit' ) ? '<input type="submit" value="' . $lang->get('etc_save_changes') . '" />&nbsp;&nbsp;<input type="submit" name="data[act_delete_rule]" value="' . $lang->get('acl_btn_deleterule') . '" style="color: #AA0000;" onclick="return confirm(\'' . addslashes($lang->get('acl_msg_deleterule_confirm')) . '\');" />' : '<input type="submit" value="' . $lang->get('acl_btn_createrule') . '" />' ) . '
               </div>';
         echo $formend;
         break;
--- a/includes/paths.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/paths.php	Sun Nov 18 20:37:08 2007 -0500
@@ -2,7 +2,7 @@
 
 /**
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.2 (Coblynau)
+ * Version 1.1.1
  * Copyright (C) 2006-2007 Dan Fuhry
  * paths.php - The part of Enano that actually manages content. Everything related to page handling and namespaces is in here.
  *
@@ -46,52 +46,52 @@
     // ACL types
     // These can also be added from within plugins
     
-    $session->register_acl_type('read',                   AUTH_ALLOW,    'Read page(s)');
-    $session->register_acl_type('post_comments',          AUTH_ALLOW,    'Post comments',                                                                                            Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('edit_comments',          AUTH_ALLOW,    'Edit own comments',                                                                                        Array('post_comments'),                                   'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('edit_page',              AUTH_WIKIMODE, 'Edit page',                                                                                                Array('view_source'),                                     'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('view_source',            AUTH_WIKIMODE, 'View source',                                                                                              Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category'); // Only used if the page is protected
-    $session->register_acl_type('mod_comments',           AUTH_DISALLOW, 'Moderate comments',                                                                                        Array('edit_comments'),                                   'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('history_view',           AUTH_WIKIMODE, 'View history/diffs',                                                                                       Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('history_rollback',       AUTH_DISALLOW, 'Rollback history',                                                                                         Array('history_view'),                                    'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('history_rollback_extra', AUTH_DISALLOW, 'Undelete page(s)',                                                                                         Array('history_rollback'),                                'Article|User|Project|Template|File|Help|System|Category|Special');
-    $session->register_acl_type('protect',                AUTH_DISALLOW, 'Protect page(s)',                                                                                          Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('rename',                 AUTH_WIKIMODE, 'Rename page(s)',                                                                                           Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('clear_logs',             AUTH_DISALLOW, 'Clear page logs (dangerous)',                                                                              Array('read', 'protect', 'even_when_protected'),          'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('vote_delete',            AUTH_ALLOW,    'Vote to delete',                                                                                           Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('vote_reset',             AUTH_DISALLOW, 'Reset delete votes',                                                                                       Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('delete_page',            AUTH_DISALLOW, 'Delete page(s)',                                                                                           Array(),                                                  'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('tag_create',             AUTH_ALLOW,    'Tag page(s)',                                                                                              Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('tag_delete_own',         AUTH_ALLOW,    'Remove own page tags',                                                                                     Array('read', 'tag_create'),                              'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('tag_delete_other',       AUTH_DISALLOW, 'Remove others\' page tags',                                                                                Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('set_wiki_mode',          AUTH_DISALLOW, 'Set per-page wiki mode',                                                                                   Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('password_set',           AUTH_DISALLOW, 'Set password',                                                                                             Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('password_reset',         AUTH_DISALLOW, 'Disable/reset password',                                                                                   Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('mod_misc',               AUTH_DISALLOW, 'Super moderator (generate SQL backtraces, view IP addresses, and send large numbers of private messages)', Array(),                                                  'All');
-    $session->register_acl_type('edit_cat',               AUTH_WIKIMODE, 'Edit categorization',                                                                                      Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('even_when_protected',    AUTH_DISALLOW, 'Allow editing, renaming, and categorization even when protected',                                          Array('edit_page', 'rename', 'mod_comments', 'edit_cat'), 'Article|User|Project|Template|File|Help|System|Category');
-    $session->register_acl_type('upload_files',           AUTH_DISALLOW, 'Upload files',                                                                                             Array('create_page'),                                     'Article|User|Project|Template|File|Help|System|Category|Special');
-    $session->register_acl_type('upload_new_version',     AUTH_WIKIMODE, 'Upload new versions of files',                                                                             Array('upload_files'),                                    'Article|User|Project|Template|File|Help|System|Category|Special');
-    $session->register_acl_type('create_page',            AUTH_WIKIMODE, 'Create pages',                                                                                             Array(),                                                  'Article|User|Project|Template|File|Help|System|Category|Special');
-    $session->register_acl_type('php_in_pages',           AUTH_DISALLOW, 'Embed PHP code in pages',                                                                                  Array('edit_page'),                                       'Article|User|Project|Template|File|Help|System|Category|Admin');
-    $session->register_acl_type('edit_acl',               AUTH_DISALLOW, 'Edit access control lists', Array('read', 'post_comments', 'edit_comments', 'edit_page', 'view_source', 'mod_comments', 'history_view', 'history_rollback', 'history_rollback_extra', 'protect', 'rename', 'clear_logs', 'vote_delete', 'vote_reset', 'delete_page', 'set_wiki_mode', 'password_set', 'password_reset', 'mod_misc', 'edit_cat', 'even_when_protected', 'upload_files', 'upload_new_version', 'create_page', 'php_in_pages'));
+    $session->register_acl_type('read',                   AUTH_ALLOW,    'perm_read');
+    $session->register_acl_type('post_comments',          AUTH_ALLOW,    'perm_post_comments',          Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('edit_comments',          AUTH_ALLOW,    'perm_edit_comments',          Array('post_comments'),                                   'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('edit_page',              AUTH_WIKIMODE, 'perm_edit_page',              Array('view_source'),                                     'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('view_source',            AUTH_WIKIMODE, 'perm_view_source',            Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category'); // Only used if the page is protected
+    $session->register_acl_type('mod_comments',           AUTH_DISALLOW, 'perm_mod_comments',           Array('edit_comments'),                                   'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('history_view',           AUTH_WIKIMODE, 'perm_history_view',           Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('history_rollback',       AUTH_DISALLOW, 'perm_history_rollback',       Array('history_view'),                                    'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('history_rollback_extra', AUTH_DISALLOW, 'perm_history_rollback_extra', Array('history_rollback'),                                'Article|User|Project|Template|File|Help|System|Category|Special');
+    $session->register_acl_type('protect',                AUTH_DISALLOW, 'perm_protect',                Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('rename',                 AUTH_WIKIMODE, 'perm_rename',                 Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('clear_logs',             AUTH_DISALLOW, 'perm_clear_logs',             Array('read', 'protect', 'even_when_protected'),          'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('vote_delete',            AUTH_ALLOW,    'perm_vote_delete',            Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('vote_reset',             AUTH_DISALLOW, 'perm_vote_reset',             Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('delete_page',            AUTH_DISALLOW, 'perm_delete_page',            Array(),                                                  'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('tag_create',             AUTH_ALLOW,    'perm_tag_create',             Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('tag_delete_own',         AUTH_ALLOW,    'perm_tag_delete_own',         Array('read', 'tag_create'),                              'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('tag_delete_other',       AUTH_DISALLOW, 'perm_tag_delete_other',       Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('set_wiki_mode',          AUTH_DISALLOW, 'perm_set_wiki_mode',          Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('password_set',           AUTH_DISALLOW, 'perm_password_set',           Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('password_reset',         AUTH_DISALLOW, 'perm_password_reset',         Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('mod_misc',               AUTH_DISALLOW, 'perm_mod_misc',               Array(),                                                  'All');
+    $session->register_acl_type('edit_cat',               AUTH_WIKIMODE, 'perm_edit_cat',               Array('read'),                                            'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('even_when_protected',    AUTH_DISALLOW, 'perm_even_when_protected',    Array('edit_page', 'rename', 'mod_comments', 'edit_cat'), 'Article|User|Project|Template|File|Help|System|Category');
+    $session->register_acl_type('upload_files',           AUTH_DISALLOW, 'perm_upload_files',           Array('create_page'),                                     'Article|User|Project|Template|File|Help|System|Category|Special');
+    $session->register_acl_type('upload_new_version',     AUTH_WIKIMODE, 'perm_upload_new_version',     Array('upload_files'),                                    'Article|User|Project|Template|File|Help|System|Category|Special');
+    $session->register_acl_type('create_page',            AUTH_WIKIMODE, 'perm_create_page',            Array(),                                                  'Article|User|Project|Template|File|Help|System|Category|Special');
+    $session->register_acl_type('php_in_pages',           AUTH_DISALLOW, 'perm_php_in_pages',           Array('edit_page'),                                       'Article|User|Project|Template|File|Help|System|Category|Admin');
+    $session->register_acl_type('edit_acl',               AUTH_DISALLOW, 'perm_edit_acl',               Array('read', 'post_comments', 'edit_comments', 'edit_page', 'view_source', 'mod_comments', 'history_view', 'history_rollback', 'history_rollback_extra', 'protect', 'rename', 'clear_logs', 'vote_delete', 'vote_reset', 'delete_page', 'set_wiki_mode', 'password_set', 'password_reset', 'mod_misc', 'edit_cat', 'even_when_protected', 'upload_files', 'upload_new_version', 'create_page', 'php_in_pages'));
     
     // DO NOT add new admin pages here! Use a plugin to call $paths->addAdminNode();
-    $this->addAdminNode('General', 'General Configuration', 'GeneralConfig');
-    $this->addAdminNode('General', 'File uploads', 'UploadConfig');
-    $this->addAdminNode('General', 'Allowed file types', 'UploadAllowedMimeTypes');
-    $this->addAdminNode('General', 'Manage Plugins', 'PluginManager');
-    $this->addAdminNode('General', 'Backup database', 'DBBackup');
-    $this->addAdminNode('Content', 'Manage Pages', 'PageManager');
-    $this->addAdminNode('Content', 'Edit page content', 'PageEditor');
-    $this->addAdminNode('Content', 'Manage page groups', 'PageGroups');
-    $this->addAdminNode('Appearance', 'Manage themes', 'ThemeManager');
-    $this->addAdminNode('Users', 'Manage users', 'UserManager');
-    $this->addAdminNode('Users', 'Edit groups', 'GroupManager');
-    $this->addAdminNode('Users', 'COPPA support', 'COPPA');
-    $this->addAdminNode('Users', 'Mass e-mail', 'MassEmail');
-    $this->addAdminNode('Security', 'Security log', 'SecurityLog');
-    $this->addAdminNode('Security', 'Ban control', 'BanControl');
+    $this->addAdminNode('adm_cat_general',    'adm_page_general_config', 'GeneralConfig');
+    $this->addAdminNode('adm_cat_general',    'adm_page_file_uploads',   'UploadConfig');
+    $this->addAdminNode('adm_cat_general',    'adm_page_file_types',     'UploadAllowedMimeTypes');
+    $this->addAdminNode('adm_cat_general',    'adm_page_plugins',        'PluginManager');
+    $this->addAdminNode('adm_cat_general',    'adm_page_db_backup',      'DBBackup');
+    $this->addAdminNode('adm_cat_content',    'adm_page_manager',        'PageManager');
+    $this->addAdminNode('adm_cat_content',    'adm_page_editor',         'PageEditor');
+    $this->addAdminNode('adm_cat_content',    'adm_page_pg_groups',      'PageGroups');
+    $this->addAdminNode('adm_cat_appearance', 'adm_page_themes',         'ThemeManager');
+    $this->addAdminNode('adm_cat_users',      'adm_page_users',          'UserManager');
+    $this->addAdminNode('adm_cat_users',      'adm_page_user_groups',    'GroupManager');
+    $this->addAdminNode('adm_cat_users',      'adm_page_coppa',          'COPPA');
+    $this->addAdminNode('adm_cat_users',      'adm_page_mass_email',     'MassEmail');
+    $this->addAdminNode('adm_cat_security',   'adm_page_security_log',   'SecurityLog');
+    $this->addAdminNode('adm_cat_security',   'adm_page_ban_control',    'BanControl');
     
     $code = $plugins->setHook('acl_rule_init');
     foreach ( $code as $cmd )
@@ -493,24 +493,29 @@
   // Parses a (very carefully formed) array into Javascript code compatible with the Tigra Tree Menu used in the admin menu
   function parseAdminTree() 
   {
+    global $lang;
+    
     $k = array_keys($this->admin_tree);
     $i = 0;
     $ret = '';
-    $ret .= "var TREE_ITEMS = [\n  ['Administration panel home', 'javascript:ajaxPage(\'".$this->nslist['Admin']."Home\');',\n    ";
+    $ret .= "var TREE_ITEMS = [\n  ['" . $lang->get('adm_btn_home') . "', 'javascript:ajaxPage(\'".$this->nslist['Admin']."Home\');',\n    ";
     foreach($k as $key)
     {
       $i++;
-      $ret .= "['".$key."', 'javascript:trees[0].toggle($i)', \n";
+      $name = ( preg_match('/^[a-z0-9_]+$/', $key) ) ? $lang->get($key) : $key;
+      $ret .= "['".$name."', 'javascript:trees[0].toggle($i)', \n";
       foreach($this->admin_tree[$key] as $c)
       {
         $i++;
-        $ret .= "        ['".$c['name']."', 'javascript:ajaxPage(\\'".$this->nslist['Admin'].$c['pageid']."\\');'],\n";
+        $name = ( preg_match('/^[a-z0-9_]+$/', $key) ) ? $lang->get($c['name']) : $c['name'];
+        
+        $ret .= "        ['".$name."', 'javascript:ajaxPage(\\'".$this->nslist['Admin'].$c['pageid']."\\');'],\n";
       }
       $ret .= "      ],\n";
     }
-    $ret .= "    ['Log out of admin panel', 'javascript:ajaxPage(\\'".$this->nslist['Admin']."AdminLogout\\');'],\n";
-    $ret .= "    ['<span id=\\'keepalivestat\\'>Loading keep-alive control...</span>', 'javascript:ajaxToggleKeepalive();', 
-                   ['About keep-alive', 'javascript:aboutKeepAlive();']
+    $ret .= "    ['" . $lang->get('adm_btn_logout') . "', 'javascript:ajaxPage(\\'".$this->nslist['Admin']."AdminLogout\\');'],\n";
+    $ret .= "    ['<span id=\\'keepalivestat\\'>" . $lang->get('adm_btn_keepalive_loading') . "</span>', 'javascript:ajaxToggleKeepalive();', 
+                   ['" . $lang->get('adm_btn_keepalive_about') . "', 'javascript:aboutKeepAlive();']
                  ],\n";
     // I used this while I painstakingly wrote the Runt code that auto-expands certain nodes based on the value of a bitfield stored in a cookie. *shudders*
     // $ret .= "    ['(debug) Clear menu bitfield', 'javascript:createCookie(\\'admin_menu_state\\', \\'1\\', 365);'],\n";
--- a/includes/sessions.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/sessions.php	Sun Nov 18 20:37:08 2007 -0500
@@ -371,6 +371,7 @@
   function start()
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     if($this->started) return;
     $this->started = true;
     $user = false;
@@ -390,6 +391,9 @@
         
         if(!$this->compat && $userdata['account_active'] != 1 && $data[1] != 'Special' && $data[1] != 'Admin')
         {
+          $language = intval(getConfig('default_language'));
+          $lang = new Language($language);
+          
           $this->logout();
           $a = getConfig('account_activation');
           switch($a)
@@ -489,6 +493,13 @@
         }
         $user = true;
         
+        // Set language
+        if ( !defined('ENANO_ALLOW_LOAD_NOLANG') )
+        {
+          $lang_id = intval($userdata['user_lang']);
+          $lang = new Language($lang_id);
+        }
+        
         if(isset($_REQUEST['auth']) && !$this->sid_super)
         {
           // Now he thinks he's a moderator. Or maybe even an administrator. Let's find out if he's telling the truth.
@@ -556,14 +567,55 @@
    * @param string $aes_key The MD5 hash of the encryption key, hex-encoded
    * @param string $challenge The 256-bit MD5 challenge string - first 128 bits should be the hash, the last 128 should be the challenge salt
    * @param int $level The privilege level we're authenticating for, defaults to 0
+   * @param array $captcha_hash Optional. If we're locked out and the lockout policy is captcha, this should be the identifier for the code.
+   * @param array $captcha_code Optional. If we're locked out and the lockout policy is captcha, this should be the code the user entered.
    * @return string 'success' on success, or error string on failure
    */
    
-  function login_with_crypto($username, $aes_data, $aes_key_id, $challenge, $level = USER_LEVEL_MEMBER)
+  function login_with_crypto($username, $aes_data, $aes_key_id, $challenge, $level = USER_LEVEL_MEMBER, $captcha_hash = false, $captcha_code = false)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
     
     $privcache = $this->private_key;
+
+    if ( !defined('IN_ENANO_INSTALL') )
+    {
+      // Lockout stuff
+      $threshold = ( $_ = getConfig('lockout_threshold') ) ? intval($_) : 5;
+      $duration  = ( $_ = getConfig('lockout_duration') ) ? intval($_) : 15;
+      // convert to minutes
+      $duration  = $duration * 60;
+      $policy = ( $x = getConfig('lockout_policy') && in_array(getConfig('lockout_policy'), array('lockout', 'disable', 'captcha')) ) ? getConfig('lockout_policy') : 'lockout';
+      if ( $policy == 'captcha' && $captcha_hash && $captcha_code )
+      {
+        // policy is captcha -- check if it's correct, and if so, bypass lockout check
+        $real_code = $this->get_captcha($captcha_hash);
+      }
+      if ( $policy != 'disable' && !( $policy == 'captcha' && isset($real_code) && $real_code == $captcha_code ) )
+      {
+        $ipaddr = $db->escape($_SERVER['REMOTE_ADDR']);
+        $timestamp_cutoff = time() - $duration;
+        $q = $this->sql('SELECT timestamp FROM '.table_prefix.'lockout WHERE timestamp > ' . $timestamp_cutoff . ' AND ipaddr = \'' . $ipaddr . '\' ORDER BY timestamp DESC;');
+        $fails = $db->numrows();
+        if ( $fails >= $threshold )
+        {
+          // ooh boy, somebody's in trouble ;-)
+          $row = $db->fetchrow();
+          $db->free_result();
+          return array(
+              'success' => false,
+              'error' => 'locked_out',
+              'lockout_threshold' => $threshold,
+              'lockout_duration' => ( $duration / 60 ),
+              'lockout_fails' => $fails,
+              'lockout_policy' => $policy,
+              'time_rem' => ( $duration / 60 ) - round( ( time() - $row['timestamp'] ) / 60 ),
+              'lockout_last_time' => $row['timestamp']
+            );
+        }
+        $db->free_result();
+      }
+    }
     
     // Instanciate the Rijndael encryption object
     $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
@@ -572,13 +624,19 @@
     
     $aes_key = $this->fetch_public_key($aes_key_id);
     if(!$aes_key)
-      return 'Couldn\'t look up public key "'.htmlspecialchars($aes_key_id).'" for decryption';
+      return array(
+        'success' => false,
+        'error' => 'key_not_found'
+        );
     
     // Convert the key to a binary string
     $bin_key = hexdecode($aes_key);
     
     if(strlen($bin_key) != AES_BITS / 8)
-      return 'The decryption key is the wrong length';
+      return array(
+        'success' => false,
+        'error' => 'key_wrong_length'
+        );
     
     // Decrypt our password
     $password = $aes->decrypt($aes_data, $bin_key, ENC_HEX);
@@ -600,7 +658,29 @@
         $this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary,page_text) VALUES(\'security\', \'admin_auth_bad\', '.time().', \''.date('d M Y h:i a').'\', \''.$db->escape($username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', ' . intval($level) . ')');
       else
         $this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary) VALUES(\'security\', \'auth_bad\', '.time().', \''.date('d M Y h:i a').'\', \''.$db->escape($username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\')');
-      return "The username and/or password is incorrect.";  
+    
+      if ( $policy != 'disable' && !defined('IN_ENANO_INSTALL') )
+      {
+        $ipaddr = $db->escape($_SERVER['REMOTE_ADDR']);
+        // increment fail count
+        $this->sql('INSERT INTO '.table_prefix.'lockout(ipaddr, timestamp, action) VALUES(\'' . $ipaddr . '\', UNIX_TIMESTAMP(), \'credential\');');
+        $fails++;
+        // ooh boy, somebody's in trouble ;-)
+        return array(
+            'success' => false,
+            'error' => ( $fails >= $threshold ) ? 'locked_out' : 'invalid_credentials',
+            'lockout_threshold' => $threshold,
+            'lockout_duration' => ( $duration / 60 ),
+            'lockout_fails' => $fails,
+            'time_rem' => ( $duration / 60 ),
+            'lockout_policy' => $policy
+          );
+      }
+      
+      return array(
+          'success' => false,
+          'error' => 'invalid_credentials'
+        );
     }
     $row = $db->fetchrow();
     
@@ -651,7 +731,10 @@
     if($success)
     {
       if($level > $row['user_level'])
-        return 'You are not authorized for this level of access.';
+        return array(
+          'success' => false,
+          'error' => 'too_big_for_britches'
+        );
       
       $sess = $this->register_session(intval($row['user_id']), $username, $password, $level);
       if($sess)
@@ -671,10 +754,15 @@
         {
           eval($cmd);
         }
-        return 'success';
+        return array(
+          'success' => true
+        );
       }
       else
-        return 'Your login credentials were correct, but an internal error occurred while registering the session key in the database.';
+        return array(
+          'success' => false,
+          'error' => 'backend_fail'
+        );
     }
     else
     {
@@ -683,7 +771,28 @@
       else
         $this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary) VALUES(\'security\', \'auth_bad\', '.time().', \''.date('d M Y h:i a').'\', \''.$db->escape($username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\')');
         
-      return 'The username and/or password is incorrect.';
+      // Do we also need to increment the lockout countdown?
+      if ( $policy != 'disable' && !defined('IN_ENANO_INSTALL') )
+      {
+        $ipaddr = $db->escape($_SERVER['REMOTE_ADDR']);
+        // increment fail count
+        $this->sql('INSERT INTO '.table_prefix.'lockout(ipaddr, timestamp, action) VALUES(\'' . $ipaddr . '\', UNIX_TIMESTAMP(), \'credential\');');
+        $fails++;
+        return array(
+            'success' => false,
+            'error' => ( $fails >= $threshold ) ? 'locked_out' : 'invalid_credentials',
+            'lockout_threshold' => $threshold,
+            'lockout_duration' => ( $duration / 60 ),
+            'lockout_fails' => $fails,
+            'time_rem' => ( $duration / 60 ),
+            'lockout_policy' => $policy
+          );
+      }
+        
+      return array(
+        'success' => false,
+        'error' => 'invalid_credentials'
+      );
     }
   }
   
@@ -713,6 +822,45 @@
       return $this->login_compat($username, $pass_hashed, $level);
     }
     
+    if ( !defined('IN_ENANO_INSTALL') )
+    {
+      // Lockout stuff
+      $threshold = ( $_ = getConfig('lockout_threshold') ) ? intval($_) : 5;
+      $duration  = ( $_ = getConfig('lockout_duration') ) ? intval($_) : 15;
+      // convert to minutes
+      $duration  = $duration * 60;
+      $policy = ( $x = getConfig('lockout_policy') && in_array(getConfig('lockout_policy'), array('lockout', 'disable', 'captcha')) ) ? getConfig('lockout_policy') : 'lockout';
+      if ( $policy == 'captcha' && $captcha_hash && $captcha_code )
+      {
+        // policy is captcha -- check if it's correct, and if so, bypass lockout check
+        $real_code = $this->get_captcha($captcha_hash);
+      }
+      if ( $policy != 'disable' && !( $policy == 'captcha' && isset($real_code) && $real_code == $captcha_code ) )
+      {
+        $ipaddr = $db->escape($_SERVER['REMOTE_ADDR']);
+        $timestamp_cutoff = time() - $duration;
+        $q = $this->sql('SELECT timestamp FROM '.table_prefix.'lockout WHERE timestamp > ' . $timestamp_cutoff . ' AND ipaddr = \'' . $ipaddr . '\' ORDER BY timestamp DESC;');
+        $fails = $db->numrows();
+        if ( $fails > $threshold )
+        {
+          // ooh boy, somebody's in trouble ;-)
+          $row = $db->fetchrow();
+          $db->free_result();
+          return array(
+              'success' => false,
+              'error' => 'locked_out',
+              'lockout_threshold' => $threshold,
+              'lockout_duration' => ( $duration / 60 ),
+              'lockout_fails' => $fails,
+              'lockout_policy' => $policy,
+              'time_rem' => $duration - round( ( time() - $row['timestamp'] ) / 60 ),
+              'lockout_last_time' => $row['timestamp']
+            );
+        }
+        $db->free_result();
+      }
+    }
+    
     // Instanciate the Rijndael encryption object
     $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
     
@@ -721,14 +869,35 @@
     
     // Retrieve the real password from the database
     $this->sql('SELECT password,old_encryption,user_id,user_level,temp_password,temp_password_time FROM '.table_prefix.'users WHERE lcase(username)=\''.$this->prepare_text(strtolower($username)).'\';');
-    if ( $db->numrows() < 1 )
+    if($db->numrows() < 1)
     {
       // This wasn't logged in <1.0.2, dunno how it slipped through
       if($level > USER_LEVEL_MEMBER)
         $this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary,page_text) VALUES(\'security\', \'admin_auth_bad\', '.time().', \''.date('d M Y h:i a').'\', \''.$db->escape($username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', ' . intval($level) . ')');
       else
         $this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary) VALUES(\'security\', \'auth_bad\', '.time().', \''.date('d M Y h:i a').'\', \''.$db->escape($username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\')');
-      return "The username and/or password is incorrect.";  
+      
+      // Do we also need to increment the lockout countdown?
+      if ( $policy != 'disable' && !defined('IN_ENANO_INSTALL') )
+      {
+        $ipaddr = $db->escape($_SERVER['REMOTE_ADDR']);
+        // increment fail count
+        $this->sql('INSERT INTO '.table_prefix.'lockout(ipaddr, timestamp, action) VALUES(\'' . $ipaddr . '\', UNIX_TIMESTAMP(), \'credential\');');
+        $fails++;
+        return array(
+            'success' => false,
+            'error' => ( $fails >= $threshold ) ? 'locked_out' : 'invalid_credentials',
+            'lockout_threshold' => $threshold,
+            'lockout_duration' => ( $duration / 60 ),
+            'lockout_fails' => $fails,
+            'lockout_policy' => $policy
+          );
+      }
+      
+      return array(
+        'success' => false,
+        'error' => 'invalid_credentials'
+      );
     }
     $row = $db->fetchrow();
     
@@ -778,7 +947,10 @@
     if($success)
     {
       if((int)$level > (int)$row['user_level'])
-        return 'You are not authorized for this level of access.';
+        return array(
+          'success' => false,
+          'error' => 'too_big_for_britches'
+        );
       $sess = $this->register_session(intval($row['user_id']), $username, $real_pass, $level);
       if($sess)
       {
@@ -793,10 +965,15 @@
           eval($cmd);
         }
         
-        return 'success';
+        return array(
+          'success' => true
+          );
       }
       else
-        return 'Your login credentials were correct, but an internal error occured while registering the session key in the database.';
+        return array(
+          'success' => false,
+          'error' => 'backend_fail'
+        );
     }
     else
     {
@@ -805,7 +982,27 @@
       else
         $this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary) VALUES(\'security\', \'auth_bad\', '.time().', \''.date('d M Y h:i a').'\', \''.$db->escape($username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\')');
         
-      return 'The username and/or password is incorrect.';
+      // Do we also need to increment the lockout countdown?
+      if ( $policy != 'disable' && !defined('IN_ENANO_INSTALL') )
+      {
+        $ipaddr = $db->escape($_SERVER['REMOTE_ADDR']);
+        // increment fail count
+        $this->sql('INSERT INTO '.table_prefix.'lockout(ipaddr, timestamp, action) VALUES(\'' . $ipaddr . '\', UNIX_TIMESTAMP(), \'credential\');');
+        $fails++;
+        return array(
+            'success' => false,
+            'error' => ( $fails >= $threshold ) ? 'locked_out' : 'invalid_credentials',
+            'lockout_threshold' => $threshold,
+            'lockout_duration' => ( $duration / 60 ),
+            'lockout_fails' => $fails,
+            'lockout_policy' => $policy
+          );
+      }
+        
+      return array(
+        'success' => false,
+        'error' => 'invalid_credentials'
+      );
     }
   }
   
@@ -939,6 +1136,7 @@
   function register_guest_session()
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     $this->username = $_SERVER['REMOTE_ADDR'];
     $this->user_level = USER_LEVEL_GUEST;
     if($this->compat || defined('IN_ENANO_INSTALL'))
@@ -952,6 +1150,12 @@
       $this->style = ( isset($_GET['style']) && file_exists(ENANO_ROOT.'/themes/'.$this->theme . '/css/'.$_GET['style'].'.css' )) ? $_GET['style'] : substr($template->named_theme_list[$this->theme]['default_style'], 0, strlen($template->named_theme_list[$this->theme]['default_style'])-4);
     }
     $this->user_id = 1;
+    if ( !defined('ENANO_ALLOW_LOAD_NOLANG') )
+    {
+      // This is a VERY special case we are allowing. It lets the installer create languages using the Enano API.
+      $language = intval(getConfig('default_language'));
+      $lang = new Language($language);
+    }
   }
   
   /**
@@ -979,7 +1183,7 @@
     }
     $keyhash = md5($key);
     $salt = $db->escape($keydata[3]);
-    $query = $db->sql_query('SELECT u.user_id AS uid,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,u.reg_time,u.account_active,u.activation_key,k.source_ip,k.time,k.auth_level,COUNT(p.message_id) AS num_pms,x.* FROM '.table_prefix.'session_keys AS k
+    $query = $db->sql_query('SELECT u.user_id AS uid,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,u.reg_time,u.account_active,u.activation_key,k.source_ip,k.time,k.auth_level,COUNT(p.message_id) AS num_pms,u.user_lang,x.* FROM '.table_prefix.'session_keys AS k
                                LEFT JOIN '.table_prefix.'users AS u
                                  ON ( u.user_id=k.user_id )
                                LEFT JOIN '.table_prefix.'users_extra AS x
@@ -1134,7 +1338,10 @@
     if($level > USER_LEVEL_CHPREF)
     {
       $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE);
-      if(!$this->user_logged_in || $this->auth_level < USER_LEVEL_MOD) return 'success';
+      if(!$this->user_logged_in || $this->auth_level < USER_LEVEL_MOD)
+      {
+        return 'success';
+      }
       // Destroy elevated privileges
       $keyhash = md5(strrev($this->sid_super));
       $this->sql('DELETE FROM '.table_prefix.'session_keys WHERE session_key=\''.$keyhash.'\' AND user_id=\'' . $this->user_id . '\';');
--- a/includes/template.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/template.php	Sun Nov 18 20:37:08 2007 -0500
@@ -135,6 +135,7 @@
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
     global $email;
+    global $lang;
     
     dc_here("template: initializing all variables");
     
@@ -197,37 +198,38 @@
     switch($paths->namespace) {
       case "Article":
       default:
-        $ns = 'article';
+        $ns = $lang->get('onpage_lbl_page_article');
         break;
       case "Admin":
-        $ns = 'administration page';
+        $ns = $lang->get('onpage_lbl_page_admin');
         break;
       case "System":
-        $ns = 'system message';
+        $ns = $lang->get('onpage_lbl_page_system');
         break;
       case "File":
-        $ns = 'uploaded file';
+        $ns = $lang->get('onpage_lbl_page_file');
         break;
       case "Help":
-        $ns = 'documentation page';
+        $ns = $lang->get('onpage_lbl_page_help');
         break;
       case "User":
-        $ns = 'user page';
+        $ns = $lang->get('onpage_lbl_page_user');
         break;
       case "Special":
-        $ns = 'special page';
+        $ns = $lang->get('onpage_lbl_page_special');
         break;
       case "Template":
-        $ns = 'template';
+        $ns = $lang->get('onpage_lbl_page_template');
         break;
       case "Project":
-        $ns = 'project page';
+        $ns = $lang->get('onpage_lbl_page_project');
         break;
       case "Category":
-        $ns = 'category';
+        $ns = $lang->get('onpage_lbl_page_category');
         break;
     }
     $this->namespace_string = $ns;
+    unset($ns);
     $code = $plugins->setHook('page_type_string_set');
     foreach ( $code as $cmd )
     {
@@ -244,7 +246,7 @@
     $parser = $this->makeParserText($btn_selected);
     
     $parser->assign_vars(array(
-        'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxReset()); return false; }" title="View the page contents, all of the page contents, and nothing but the page contents (alt-a)" accesskey="a"',
+        'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxReset()); return false; }" title="' . $lang->get('onpage_tip_article') . '" accesskey="a"',
         'PARENTFLAGS' => 'id="mdgToolbar_article"',
         'HREF' => makeUrl($paths->page, null, true),
         'TEXT' => $this->namespace_string
@@ -284,14 +286,25 @@
       $n = ( $session->get_permissions('mod_comments') ) ? (string)$nc : (string)$na;
       if ( $session->get_permissions('mod_comments') && $nu > 0 )
       {
-        $n .= ' total/'.$nu.' unapp.';
+        $subst = array(
+            'num_comments' => $nc,
+            'num_unapp' => $nu
+          );
+        $btn_text = $lang->get('onpage_btn_discussion_unapp', $subst);
+      }
+      else
+      {
+        $subst = array(
+          'num_comments' => $nc
+        );
+        $btn_text = $lang->get('onpage_btn_discussion', $subst);
       }
       
       $button->assign_vars(array(
-          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxComments()); return false; }" title="View the comments that other users have posted about this page (alt-c)" accesskey="c"',
+          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxComments()); return false; }" title="' . $lang->get('onpage_tip_comments') . '" accesskey="c"',
           'PARENTFLAGS' => 'id="mdgToolbar_discussion"',
           'HREF' => makeUrl($paths->page, 'do=comments', true),
-          'TEXT' => 'discussion ('.$n.')',
+          'TEXT' => $btn_text,
         ));
       
       $tb .= $button->run();
@@ -300,10 +313,10 @@
     if($session->get_permissions('read') && ($paths->namespace != 'Special' && $paths->namespace != 'Admin') && ( $session->get_permissions('edit_page') && ( ( $paths->page_protected && $session->get_permissions('even_when_protected') ) || !$paths->page_protected ) ) )
     {
       $button->assign_vars(array(
-        'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxEditor()); return false; }" title="Edit the contents of this page (alt-e)" accesskey="e"',
+        'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxEditor()); return false; }" title="' . $lang->get('onpage_tip_edit') . '" accesskey="e"',
         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
         'HREF' => makeUrl($paths->page, 'do=edit', true),
-        'TEXT' => 'edit this page'
+        'TEXT' => $lang->get('onpage_btn_edit')
         ));
       $tb .= $button->run();
     // View source button
@@ -311,10 +324,10 @@
     else if($session->get_permissions('view_source') && ( !$session->get_permissions('edit_page') || !$session->get_permissions('even_when_protected') && $paths->page_protected ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin') 
     {
       $button->assign_vars(array(
-        'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxViewSource()); return false; }" title="View the source code (wiki markup) that this page uses (alt-e)" accesskey="e"',
+        'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxViewSource()); return false; }" title="' . $lang->get('onpage_tip_viewsource') . '" accesskey="e"',
         'PARENTFLAGS' => 'id="mdgToolbar_edit"',
         'HREF' => makeUrl($paths->page, 'do=viewsource', true),
-        'TEXT' => 'view source'
+        'TEXT' => $lang->get('onpage_btn_viewsource')
         ));
       $tb .= $button->run();
     }
@@ -322,10 +335,10 @@
     if ( $session->get_permissions('read') /* && $paths->wiki_mode */ && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('history_view') )
     {
       $button->assign_vars(array(
-        'FLAGS'       => 'onclick="if ( !KILL_SWITCH ) { void(ajaxHistory()); return false; }" title="View a log of actions taken on this page (alt-h)" accesskey="h"',
+        'FLAGS'       => 'onclick="if ( !KILL_SWITCH ) { void(ajaxHistory()); return false; }" title="' . $lang->get('onpage_tip_history') . '" accesskey="h"',
         'PARENTFLAGS' => 'id="mdgToolbar_history"',
         'HREF'        => makeUrl($paths->page, 'do=history', true),
-        'TEXT'        => 'history'
+        'TEXT'        => $lang->get('onpage_btn_history')
         ));
       $tb .= $button->run();
     }
@@ -337,9 +350,9 @@
     if ( $session->get_permissions('read') && $paths->page_exists && ( $session->get_permissions('rename') && ( $paths->page_protected && $session->get_permissions('even_when_protected') || !$paths->page_protected ) ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
     {
       $menubtn->assign_vars(array(
-          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxRename()); return false; }" title="Change the display name of this page (alt-r)" accesskey="r"',
+          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxRename()); return false; }" title="' . $lang->get('onpage_tip_rename') . '" accesskey="r"',
           'HREF'  => makeUrl($paths->page, 'do=rename', true),
-          'TEXT'  => 'rename',
+          'TEXT'  => $lang->get('onpage_btn_rename'),
         ));
       $this->toolbar_menu .= $menubtn->run();
     }
@@ -348,9 +361,9 @@
     if ( $paths->wiki_mode && $session->get_permissions('vote_delete') && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin')
     {
       $menubtn->assign_vars(array(
-          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxDelVote()); return false; }" title="Vote to have this page deleted (alt-d)" accesskey="d"',
+          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxDelVote()); return false; }" title="' . $lang->get('onpage_tip_delvote') . '" accesskey="d"',
           'HREF'  => makeUrl($paths->page, 'do=delvote', true),
-          'TEXT'  => 'vote to delete this page',
+          'TEXT'  => $lang->get('onpage_btn_votedelete'),
         ));
       $this->toolbar_menu .= $menubtn->run();
     }
@@ -359,9 +372,9 @@
     if ( $session->get_permissions('read') && $paths->wiki_mode && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('vote_reset') && $paths->cpage['delvotes'] > 0)
     {
       $menubtn->assign_vars(array(
-          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxResetDelVotes()); return false; }" title="Vote to have this page deleted (alt-y)" accesskey="y"',
+          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxResetDelVotes()); return false; }" title="' . $lang->get('onpage_tip_resetvotes') . '" accesskey="y"',
           'HREF'  => makeUrl($paths->page, 'do=resetvotes', true),
-          'TEXT'  => 'reset deletion votes',
+          'TEXT'  => $lang->get('onpage_btn_votedelete_reset'),
         ));
       $this->toolbar_menu .= $menubtn->run();
     }
@@ -370,9 +383,9 @@
     if ( $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
     {
       $menubtn->assign_vars(array(
-          'FLAGS' => 'title="View a version of this page that is suitable for printing"',
+          'FLAGS' => 'title="' . $lang->get('onpage_tip_printable') . '"',
           'HREF'  => makeUrl($paths->page, 'printable=yes', true),
-          'TEXT'  => 'view printable version',
+          'TEXT'  => $lang->get('onpage_btn_printable'),
         ));
       $this->toolbar_menu .= $menubtn->run();
     }
@@ -382,7 +395,7 @@
     {
       
       $label = $this->makeParserText($tplvars['toolbar_label']);
-      $label->assign_vars(array('TEXT' => 'protection:'));
+      $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_protect')));
       $t0 = $label->run();
       
       $ctmp = ''; 
@@ -391,9 +404,9 @@
         $ctmp=' style="text-decoration: underline;"';
       }
       $menubtn->assign_vars(array(
-          'FLAGS' => 'accesskey="i" onclick="if ( !KILL_SWITCH ) { ajaxProtect(1); return false; }" id="protbtn_1" title="Prevents all non-administrators from editing this page. [alt-i]"'.$ctmp,
+          'FLAGS' => 'accesskey="i" onclick="if ( !KILL_SWITCH ) { ajaxProtect(1); return false; }" id="protbtn_1" title="' . $lang->get('onpage_tip_protect_on') . '"'.$ctmp,
           'HREF'  => makeUrl($paths->page, 'do=protect&level=1', true),
-          'TEXT'  => 'on'
+          'TEXT'  => $lang->get('onpage_btn_protect_on')
         ));
       $t1 = $menubtn->run();
       
@@ -403,9 +416,9 @@
         $ctmp=' style="text-decoration: underline;"';
       }
       $menubtn->assign_vars(array(
-          'FLAGS' => 'accesskey="o" onclick="if ( !KILL_SWITCH ) { ajaxProtect(0); return false; }" id="protbtn_0" title="Allows everyone to edit this page. [alt-o]"'.$ctmp,
+          'FLAGS' => 'accesskey="o" onclick="if ( !KILL_SWITCH ) { ajaxProtect(0); return false; }" id="protbtn_0" title="' . $lang->get('onpage_tip_protect_off') . '"'.$ctmp,
           'HREF'  => makeUrl($paths->page, 'do=protect&level=0', true),
-          'TEXT'  => 'off'
+          'TEXT'  => $lang->get('onpage_btn_protect_off')
         ));
       $t2 = $menubtn->run();
       
@@ -415,9 +428,9 @@
         $ctmp = ' style="text-decoration: underline;"';
       }
       $menubtn->assign_vars(array(
-          'FLAGS' => 'accesskey="p" onclick="if ( !KILL_SWITCH ) { ajaxProtect(2); return false; }" id="protbtn_2" title="Allows only users who have been registered for 4 days to edit this page. [alt-p]"'.$ctmp,
+          'FLAGS' => 'accesskey="p" onclick="if ( !KILL_SWITCH ) { ajaxProtect(2); return false; }" id="protbtn_2" title="' . $lang->get('onpage_tip_protect_semi') . '"'.$ctmp,
           'HREF'  => makeUrl($paths->page, 'do=protect&level=2', true),
-          'TEXT'  => 'semi'
+          'TEXT'  => $lang->get('onpage_btn_protect_semi')
         ));
       $t3 = $menubtn->run();
       
@@ -436,7 +449,7 @@
     {
       // label at start
       $label = $this->makeParserText($tplvars['toolbar_label']);
-      $label->assign_vars(array('TEXT' => 'page wiki mode:'));
+      $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_wikimode')));
       $t0 = $label->run();
       
       // on button
@@ -448,7 +461,7 @@
       $menubtn->assign_vars(array(
           'FLAGS' => /* 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(1); return false; }" id="wikibtn_1" title="Forces wiki functions to be allowed on this page."'. */ $ctmp,
           'HREF' => makeUrl($paths->page, 'do=setwikimode&level=1', true),
-          'TEXT' => 'on'
+          'TEXT' => $lang->get('onpage_btn_wikimode_on')
         ));
       $t1 = $menubtn->run();
       
@@ -461,7 +474,7 @@
       $menubtn->assign_vars(array(
           'FLAGS' => /* 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(0); return false; }" id="wikibtn_0" title="Forces wiki functions to be disabled on this page."'. */ $ctmp,
           'HREF' => makeUrl($paths->page, 'do=setwikimode&level=0', true),
-          'TEXT' => 'off'
+          'TEXT' => $lang->get('onpage_btn_wikimode_off')
         ));
       $t2 = $menubtn->run();
       
@@ -474,7 +487,7 @@
       $menubtn->assign_vars(array(
           'FLAGS' => /* 'onclick="if ( !KILL_SWITCH ) { ajaxSetWikiMode(2); return false; }" id="wikibtn_2" title="Causes this page to use the global wiki mode setting (default)"'. */ $ctmp,
           'HREF' => makeUrl($paths->page, 'do=setwikimode&level=2', true),
-          'TEXT' => 'global'
+          'TEXT' => $lang->get('onpage_btn_wikimode_global')
         ));
       $t3 = $menubtn->run();
       
@@ -493,9 +506,9 @@
     if ( $session->get_permissions('read') && $session->get_permissions('clear_logs') && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
     {
       $menubtn->assign_vars(array(
-          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxClearLogs()); return false; }" title="Remove all edit and action logs for this page from the database. IRREVERSIBLE! (alt-l)" accesskey="l"',
+          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxClearLogs()); return false; }" title="' . $lang->get('onpage_tip_flushlogs') . '" accesskey="l"',
           'HREF'  => makeUrl($paths->page, 'do=flushlogs', true),
-          'TEXT'  => 'clear page logs',
+          'TEXT'  => $lang->get('onpage_btn_clearlogs'),
         ));
       $this->toolbar_menu .= $menubtn->run();
     }
@@ -503,14 +516,22 @@
     // Delete page button
     if ( $session->get_permissions('read') && $session->get_permissions('delete_page') && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' )
     {
-      $s = 'delete this page';
+      $s = $lang->get('onpage_btn_deletepage');
       if ( $paths->cpage['delvotes'] == 1 )
       {
-        $s .= ' (<b>'.$paths->cpage['delvotes'].'</b> vote)';
+        $subst = array(
+          'num_votes' => $paths->cpage['delvotes'],
+          'plural' => ''
+          );
+        $s .= $lang->get('onpage_btn_deletepage_votes', $subst);
       }
       else if ( $paths->cpage['delvotes'] > 1 )
       {
-        $s .= ' (<b>'.$paths->cpage['delvotes'].'</b> votes)';
+        $subst = array(
+          'num_votes' => $paths->cpage['delvotes'],
+          'plural' => $lang->get('meta_plural')
+          );
+        $s .= $lang->get('onpage_btn_deletepage_votes', $subst);
       }
       
       $menubtn->assign_vars(array(
@@ -542,13 +563,13 @@
     {
       // label at start
       $label = $this->makeParserText($tplvars['toolbar_label']);
-      $label->assign_vars(array('TEXT' => 'page password:'));
+      $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_password')));
       $t0 = $label->run();
       
       $menubtn->assign_vars(array(
-          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxSetPassword()); return false; }" title="Require a password in order for this page to be viewed"',
+          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxSetPassword()); return false; }" title="' . $lang->get('onpage_tip_password') . '"',
           'HREF'  => '#',
-          'TEXT'  => 'set',
+          'TEXT'  => $lang->get('onpage_btn_password_set'),
         ));
       $t = $menubtn->run();
       
@@ -559,9 +580,9 @@
     if($session->get_permissions('edit_acl') || $session->user_level >= USER_LEVEL_ADMIN)
     {
       $menubtn->assign_vars(array(
-          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="Manage who can do what with this page (alt-m)" accesskey="m"',
+          'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="' . $lang->get('onpage_tip_aclmanager') . '" accesskey="m"',
           'HREF'  => makeUrl($paths->page, 'do=aclmanager', true),
-          'TEXT'  => 'manage page access',
+          'TEXT'  => $lang->get('onpage_btn_acl'),
         ));
       $this->toolbar_menu .= $menubtn->run();
     }
@@ -572,7 +593,7 @@
       $menubtn->assign_vars(array(
           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxAdminPage()); return false; }" title="Administrative options for this page" accesskey="g"',
           'HREF'  => makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'PageManager', true),
-          'TEXT'  => 'administrative options',
+          'TEXT'  => $lang->get('onpage_btn_admin'),
         ));
       $this->toolbar_menu .= $menubtn->run();
     }
@@ -583,7 +604,7 @@
         'FLAGS'       => 'id="mdgToolbar_moreoptions" onclick="if ( !KILL_SWITCH ) { return false; }" title="Additional options for working with this page"',
         'PARENTFLAGS' => '',
         'HREF'        => makeUrl($paths->page, 'do=moreoptions', true),
-        'TEXT'        => 'more options'
+        'TEXT'        => $lang->get('onpage_btn_moreoptions')
         ));
       $tb .= $button->run();
     }
@@ -632,6 +653,10 @@
     // Add the e-mail address client code to the header
     $this->add_header($email->jscode());
     
+    // Add language file
+    $lang_uri = makeUrlNS('Special', 'LangExportJSON/' . $lang->lang_id, false, true);
+    $this->add_header("<script type=\"text/javascript\" src=\"$lang_uri\"></script>");
+    
     // Generate the code for the Log out and Change theme sidebar buttons
     // Once again, the new template parsing system can be used here
     
@@ -640,7 +665,7 @@
     $parser->assign_vars(Array(
         'HREF'=>makeUrlNS('Special', 'Logout'),
         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { mb_logout(); return false; }"',
-        'TEXT'=>'Log out',
+        'TEXT'=>$lang->get('sidebar_btn_logout'),
       ));
     
     $logout_link = $parser->run();
@@ -648,7 +673,7 @@
     $parser->assign_vars(Array(
         'HREF'=>makeUrlNS('Special', 'Login/' . $paths->page),
         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxStartLogin(); return false; }"',
-        'TEXT'=>'Log in',
+        'TEXT'=>$lang->get('sidebar_btn_login'),
       ));
     
     $login_link = $parser->run();
@@ -656,7 +681,7 @@
     $parser->assign_vars(Array(
         'HREF'=>makeUrlNS('Special', 'ChangeStyle/'.$paths->page),
         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxChangeStyle(); return false; }"',
-        'TEXT'=>'Change theme',
+        'TEXT'=>$lang->get('sidebar_btn_changestyle'),
       ));
     
     $theme_link = $parser->run();
@@ -664,7 +689,7 @@
     $parser->assign_vars(Array(
         'HREF'=>makeUrlNS('Special', 'Administration'),
         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { void(ajaxStartAdminLogin()); return false; }"',
-        'TEXT'=>'Administration',
+        'TEXT'=>$lang->get('sidebar_btn_administration'),
       ));
     
     $admin_link = $parser->run();
@@ -710,7 +735,9 @@
             }
           }
       $js_dynamic .= '\';
-      var ENANO_CURRENT_THEME = \''. $session->theme .'\';';
+      var ENANO_CURRENT_THEME = \''. $session->theme .'\';
+      var ENANO_LANG_ID = ' . $lang->lang_id . ';
+      var ENANO_PAGE_TYPE = "' . addslashes($this->namespace_string) . '";';
       foreach($paths->nslist as $k => $c)
       {
         $js_dynamic .= "namespace_list['{$k}'] = '$c';";
@@ -772,6 +799,8 @@
   function header($simple = false) 
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
+    
     ob_start();
     
     if(!$this->theme_loaded)
@@ -798,7 +827,7 @@
     {
       $login_link = makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . $session->user_level, true);
       echo '<div class="usermessage">';
-      echo '<b>Your administrative session has timed out.</b> <a href="' . $login_link . '" onclick="ajaxPromptAdminAuth(function(k){ ENANO_SID = k; window.location = append_sid(makeUrl(title)); }, ' . $session->user_level . '); return false;">Log in again</a>';
+      echo $lang->get('user_msg_elev_timed_out', array( 'login_link' => $login_link ));
       echo '</div>';
     }
     if ( $this->site_disabled && $session->user_level >= USER_LEVEL_ADMIN && ( $paths->page != $paths->nslist['Special'] . 'Administration' ) )
@@ -1139,7 +1168,7 @@
       // matches the MD5 of the file that the compiled file was compiled from.
       if ( isset($md5) && $md5 == md5($text) )
       {
-        return str_replace('\\"', '"', $tpl_text);
+        return $this->compile_template_text_post(str_replace('\\"', '"', $tpl_text));
       }
     }
     
@@ -1178,7 +1207,7 @@
       fclose($h);
     }
     
-    return $text; //('<pre>'.htmlspecialchars($text).'</pre>');
+    return $this->compile_template_text_post($text); //('<pre>'.htmlspecialchars($text).'</pre>');
   }
   
   
@@ -1191,7 +1220,7 @@
   function compile_template_text($text)
   {
     // this might do something else in the future, possibly cache large templates
-    return $this->compile_tpl_code($text);
+    return $this->compile_template_text_post($this->compile_tpl_code($text));
   }
   
   /**
@@ -1203,9 +1232,30 @@
   function parse($text)
   {
     $text = $this->compile_template_text($text);
+    $text = $this->compile_template_text_post($text);
     return eval($text);
   }
   
+  /**
+   * Post-processor for template code. Basically what this does is it localizes {lang:foo} blocks.
+   * @param string Mostly-processed TPL code
+   * @return string
+   */
+  
+  function compile_template_text_post($text)
+  {
+    global $lang;
+    preg_match_all('/\{lang:([a-z0-9]+_[a-z0-9_]+)\}/', $text, $matches);
+    foreach ( $matches[1] as $i => $string_id )
+    {
+      $string = $lang->get($string_id);
+      $string = str_replace('\\', '\\\\', $string);
+      $string = str_replace('\'', '\\\'', $string);
+      $text = str_replace_once($matches[0][$i], $string, $text);
+    }
+    return $text;
+  }
+  
   // Steps to turn this:
   //   [[Project:Community Portal]]
   // into this:
@@ -1235,6 +1285,8 @@
   function tplWikiFormat($message, $filter_links = false, $filename = 'elements.tpl')
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
+    
     $filter_links = false;
     $tplvars = $this->extract_vars($filename);
     if($session->sid_super) $as = htmlspecialchars(urlSeparator).'auth='.$session->sid_super;
@@ -1363,6 +1415,15 @@
       }
     }
     
+    preg_match_all('/\{lang:([a-z0-9]+_[a-z0-9_]+)\}/', $message, $matches);
+    foreach ( $matches[1] as $i => $string_id )
+    {
+      $string = $lang->get($string_id);
+      $string = str_replace('\\', '\\\\', $string);
+      $string = str_replace('\'', '\\\'', $string);
+      $message = str_replace_once($matches[0][$i], $string, $message);
+    }
+    
     /*
      * HTML RENDERER
      */
@@ -1833,13 +1894,14 @@
   {
     global $sideinfo;
     global $this_page;
+    global $lang;
     global $db, $session, $paths, $template, $plugins; // Common objects
     $tplvars = $this->extract_vars('elements.tpl');
     $tb = '';
     // Get the "article" button text (depends on namespace)
-    if(defined('IN_ENANO_INSTALL')) $ns = 'installation page';
+    if(defined('IN_ENANO_INSTALL')) $ns = $lang->get('meta_btn_article');
     else $ns = 'system error page';
-    $t = str_replace('{FLAGS}', 'onclick="if ( !KILL_SWITCH ) { return false; }" title="Hey! A button that doesn\'t do anything. Clever..." accesskey="a"', $tplvars['toolbar_button']);
+    $t = str_replace('{FLAGS}', 'onclick="return false;" title="Hey! A button that doesn\'t do anything. Clever..." accesskey="a"', $tplvars['toolbar_button']);
     $t = str_replace('{HREF}', '#', $t);
     $t = str_replace('{TEXT}', $ns, $t);
     $tb .= $t;
@@ -1862,22 +1924,31 @@
     
     $title = ( is_object($paths) ) ? $paths->page : 'Critical error';
     
+    $headers = '<style type="text/css">div.pagenav { border-top: 1px solid #CCC; padding-top: 7px; margin-top: 10px; }</style>';
+    
+    $js_dynamic = '';
+    if ( defined('IN_ENANO_INSTALL') )
+    {
+      $js_dynamic .= '<script type="text/javascript" src="install.php?mode=langjs"></script>';
+    }
+    $js_dynamic .= '<script type="text/javascript">var title="'. $title .'"; var scriptPath="'.scriptPath.'"; var ENANO_SID=""; var AES_BITS='.AES_BITS.'; var AES_BLOCKSIZE=' . AES_BLOCKSIZE . '; var pagepass=\'\'; var ENANO_LANG_ID = 1;</script>';
+    
     // The rewritten template engine will process all required vars during the load_template stage instead of (cough) re-processing everything each time around.
     $tpl_strings = Array(
       'PAGE_NAME'=>$this_page,
       'PAGE_URLNAME'=>'Null',
-      'SITE_NAME'=>'Enano Installation',
+      'SITE_NAME'=>$lang->get('meta_site_name'),
       'USERNAME'=>'admin',
-      'SITE_DESC'=>'Install Enano on your server.',
+      'SITE_DESC'=>$lang->get('meta_site_desc'),
       'TOOLBAR'=>$tb,
       'SCRIPTPATH'=>scriptPath,
       'CONTENTPATH'=>contentPath,
       'ADMIN_SID_QUES'=>$asq,
       'ADMIN_SID_AMP'=>$asa,
       'ADMIN_SID_AMP_HTML'=>'',
-      'ADDITIONAL_HEADERS'=>'<style type="text/css">div.pagenav { border-top: 1px solid #CCC; padding-top: 7px; margin-top: 10px; }</style>',
+      'ADDITIONAL_HEADERS'=>$headers,
       'SIDEBAR_EXTRA'=>'',
-      'COPYRIGHT'=>'Enano and all of its code, graphics, and more code is copyright &copy; 2006 Dan Fuhry.<br />This program is Free Software; see the file "GPL" included with this package for details.',
+      'COPYRIGHT'=>$lang->get('meta_enano_copyright'),
       'TOOLBAR_EXTRAS'=>'',
       'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'],
       'STYLE_LINK'=>$slink,
@@ -1886,7 +1957,7 @@
       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
       'THEME_ID'=>$this->theme,
       'STYLE_ID'=>$this->style,
-      'JS_DYNAMIC_VARS'=>'<script type="text/javascript">var title="'. $title .'"; var scriptPath="'.scriptPath.'"; var ENANO_SID=""; var AES_BITS='.AES_BITS.'; var AES_BLOCKSIZE=' . AES_BLOCKSIZE . '; var pagepass=\'\';</script>',
+      'JS_DYNAMIC_VARS'=>$js_dynamic,
       'SIDEBAR_RIGHT'=>'',
       );
     $this->tpl_strings = array_merge($tpl_strings, $this->tpl_strings);
@@ -1903,7 +1974,7 @@
       }
       $p = $this->makeParserText($tplvars['sidebar_section']);
       $p->assign_vars(Array(
-          'TITLE'=>'Installation progress',
+          'TITLE'=>$lang->get('meta_sidebar_heading'),
           'CONTENT'=>$sidebar,
         ));
       $sidebar = $p->run();
--- a/index.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/index.php	Sun Nov 18 20:37:08 2007 -0500
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.2 (Coblynau)
+ * Version 1.1.1
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
@@ -18,7 +18,7 @@
  
   // Set up gzip encoding before any output is sent
   
-  $aggressive_optimize_html = true;
+  $aggressive_optimize_html = false;
   
   global $do_gzip;
   $do_gzip = true;
@@ -92,11 +92,12 @@
           if(!$q) $db->_die('The comment data could not be selected.');
           $row = $db->fetchrow();
           $db->free_result();
+          $row['subject'] = str_replace('\'', '&#039;', $row['subject']);
           echo '<form action="'.makeUrl($paths->page, 'do=comments&amp;sub=savecomment').'" method="post">';
           echo "<br /><div class='tblholder'><table border='0' width='100%' cellspacing='1' cellpadding='4'>
-                  <tr><td class='row1'>Subject:</td><td class='row1'><input type='text' name='subj' value='{$row['subject']}' /></td></tr>
-                  <tr><td class='row2'>Comment:</td><td class='row2'><textarea rows='10' cols='40' style='width: 98%;' name='text'>{$row['comment_data']}</textarea></td></tr>
-                  <tr><td class='row1' colspan='2' class='row1' style='text-align: center;'><input type='hidden' name='id' value='{$row['comment_id']}' /><input type='submit' value='Save Changes' /></td></tr>
+                  <tr><td class='row1'>" . $lang->get('comment_postform_field_subject') . "</td><td class='row1'><input type='text' name='subj' value='{$row['subject']}' /></td></tr>
+                  <tr><td class='row2'>" . $lang->get('comment_postform_field_comment') . "</td><td class='row2'><textarea rows='10' cols='40' style='width: 98%;' name='text'>{$row['comment_data']}</textarea></td></tr>
+                  <tr><td class='row1' colspan='2' class='row1' style='text-align: center;'><input type='hidden' name='id' value='{$row['comment_id']}' /><input type='submit' value='" . $lang->get('etc_save_changes') . "' /></td></tr>
                 </table></div>";
           echo '</form>';
           break;
@@ -127,8 +128,12 @@
       {
         $text = $_POST['page_text'];
         echo PageUtils::genPreview($_POST['page_text']);
+        $text = htmlspecialchars($text);
       }
-      else $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false);
+      else
+      {
+        $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false);
+      }
       echo '
         <form action="'.makeUrl($paths->page, 'do=edit').'" method="post" enctype="multipart/form-data">
         <br />
@@ -136,12 +141,12 @@
         <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 $lang->get('editor_lbl_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" />
-          <input type="submit" name="_revert" value="Revert changes" />
-          <input type="submit" name="_cancel" value="Cancel" />
+          <input type="submit" name="_save"    value="' . $lang->get('editor_btn_save') . '" style="font-weight: bold;" />
+          <input type="submit" name="_preview" value="' . $lang->get('editor_btn_preview') . '" />
+          <input type="submit" name="_revert"  value="' . $lang->get('editor_btn_revert') . '" />
+          <input type="submit" name="_cancel"  value="' . $lang->get('editor_btn_cancel') . '" />
         </form>
       ';
       if ( getConfig('wiki_edit_notice') == '1' )
@@ -159,7 +164,7 @@
         <br />
         <textarea readonly="readonly" name="page_text" rows="20" cols="60" style="width: 97%;">'.$text.'</textarea>';
       echo '<br />
-          <input type="submit" name="_cancel" value="Close viewer" />
+          <input type="submit" name="_cancel" value="' . $lang->get('editor_btn_closeviewer') . '" />
         </form>
       ';
       $template->footer();
@@ -201,7 +206,7 @@
       break;
     case 'moreoptions':
       $template->header();
-      echo '<div class="menu_nojs" style="width: 150px; padding: 0;"><ul style="display: block;"><li><div class="label">More options for this page</div><div style="clear: both;"></div></li>'.$template->tpl_strings['TOOLBAR_EXTRAS'].'</ul></div>';
+      echo '<div class="menu_nojs" style="width: 150px; padding: 0;"><ul style="display: block;"><li><div class="label">' . $lang->get('ajax_lbl_moreoptions_nojs') . '</div><div style="clear: both;"></div></li>'.$template->toolbar_menu.'</ul></div>';
       $template->footer();
       break;
     case 'protect':
@@ -210,32 +215,33 @@
       {
         if(!preg_match('#^([0-2]*){1}$#', $_POST['level'])) die_friendly('Error protecting page', '<p>Request validation failed</p>');
         PageUtils::protect($paths->cpage['urlname_nons'], $paths->namespace, intval($_POST['level']), $_POST['reason']);
-        die_friendly('Page protected', '<p>The protection setting has been applied. <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>');
+        
+        die_friendly($lang->get('page_protect_lbl_success_title'), '<p>' . $lang->get('page_protect_lbl_success_body', array( 'page_link' => makeUrl($paths->page) )) . '</p>');
       }
       $template->header();
       ?>
       <form action="<?php echo makeUrl($paths->page, 'do=protect'); ?>" method="post">
         <input type="hidden" name="level" value="<?php echo $_REQUEST['level']; ?>" />
-        <?php if(isset($_POST['reason'])) echo '<p style="color: red;">Error: you must enter a reason for protecting this page.</p>'; ?>
-        <p>Reason for protecting the page:</p>
+        <?php if(isset($_POST['reason'])) echo '<p style="color: red;">' . $lang->get('page_protect_err_need_reason') . '</p>'; ?>
+        <p><?php echo $lang->get('page_protect_lbl_reason'); ?></p>
         <p><input type="text" name="reason" size="40" /><br />
-           Protecion level to be applied: <b><?php
+           <?php echo $lang->get('page_protect_lbl_level'); ?> <b><?php
              switch($_REQUEST['level'])
              {
                case '0':
-                 echo 'No protection';
+                 echo $lang->get('page_protect_lbl_level_none');
                  break;
                case '1':
-                 echo 'Full protection';
+                 echo $lang->get('page_protect_lbl_level_full');
                  break;
                case '2':
-                 echo 'Semi-protection';
+                 echo $lang->get('page_protect_lbl_level_semi');
                  break;
                default:
                  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="<?php echo htmlspecialchars($lang->get('page_protect_btn_submit')) ?>" style="font-weight: bold;" /></p> 
       </form>
       <?php
       $template->footer();
@@ -244,37 +250,37 @@
       if(!empty($_POST['newname']))
       {
         $r = PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newname']);
-        die_friendly('Page renamed', '<p>'.nl2br($r).' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>');
+        die_friendly('Page renamed', '<p>'.nl2br($r).' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>');
       }
       $template->header();
       ?>
       <form action="<?php echo makeUrl($paths->page, 'do=rename'); ?>" method="post">
-        <?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>
+        <?php if(isset($_POST['newname'])) echo '<p style="color: red;">' . $lang->get('page_rename_err_need_name') . '</p>'; ?>
+        <p><?php echo $lang->get('page_rename_lbl'); ?></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="<?php echo htmlspecialchars($lang->get('page_rename_btn_submit')); ?>" style="font-weight: bold;" /></p> 
       </form>
       <?php
       $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>');
+      if(!$session->get_permissions('clear_logs'))
+      {
+        die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>');
+      }
       if(isset($_POST['_downthejohn']))
       {
         $template->header();
           $result = PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace);
-          echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
+          echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>';
         $template->footer();
         break;
       }
       $template->header();
         ?>
         <form action="<?php echo makeUrl($paths->page, 'do=flushlogs'); ?>" method="post">
-          <h3>You are about to <span style="color: red;">destroy</span> all logged edits and actions on this page.</h3>
-           <p>Unlike deleting or editing this page, this action is <u>not reversible</u>! You should only do this if you are desparate for
-              database space.</p>
-           <p>Do you really want to continue?</p>
-           <p><input type="submit" name="_downthejohn" value="Flush logs" style="color: red; font-weight: bold;" /></p>
+           <?php echo $lang->get('page_flushlogs_warning_stern'); ?>
+           <p><input type="submit" name="_downthejohn" value="<?php echo htmlspecialchars($lang->get('page_flushlogs_btn_submit')); ?>" style="color: red; font-weight: bold;" /></p>
         </form>
         <?php
       $template->footer();
@@ -284,55 +290,66 @@
       {
         $template->header();
         $result = PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace);
-        echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
+        echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>';
         $template->footer();
         break;
       }
       $template->header();
         ?>
         <form action="<?php echo makeUrl($paths->page, 'do=delvote'); ?>" method="post">
-          <h3>Your vote counts.</h3>
-           <p>If you think that this page is not relavent to the content on this site, or if it looks like this page was only created in
-              an attempt to spam the site, you can request that this page be deleted by an administrator.</p>
-           <p>After you vote, you should leave a comment explaining the reason for your vote, especially if you are the first person to
-              vote against this page.</p>
-           <p>So far, <?php echo ( $paths->cpage['delvotes'] == 1 ) ? $paths->cpage['delvotes'] . ' person has' : $paths->cpage['delvotes'] . ' people have'; ?> voted to delete this page.</p>
-           <p><input type="submit" name="_ballotbox" value="Vote to delete this page" /></p>
+           <?php
+             echo $lang->get('page_delvote_warning_stern');
+             echo '<p>';
+             switch($paths->cpage['delvotes'])
+             {
+               case 0:  echo $lang->get('page_delvote_count_zero'); break;
+               case 1:  echo $lang->get('page_delvote_count_one'); break;
+               default: echo $lang->get('page_delvote_count_plural', array('delvotes' => $paths->cpage['delvotes'])); break;
+             }
+             echo '</p>';
+           ?>
+           <p><input type="submit" name="_ballotbox" value="<?php echo htmlspecialchars($lang->get('page_delvote_btn_submit')); ?>" /></p>
         </form>
         <?php
       $template->footer();
       break;
     case 'resetvotes':
-      if(!$session->get_permissions('vote_reset')) die_friendly('Access denied', '<p>Resetting the deletion votes against this page <u>requires</u> admin rights.</p>');
+      if(!$session->get_permissions('vote_reset'))
+      {
+        die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>');
+      }
       if(isset($_POST['_youmaylivealittlelonger']))
       {
         $template->header();
           $result = PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace);
-          echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
+          echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>';
         $template->footer();
         break;
       }
       $template->header();
         ?>
         <form action="<?php echo makeUrl($paths->page, 'do=resetvotes'); ?>" method="post">
-          <p>This action will reset the number of votes against this page to zero. Are you sure you want to do this?</p>
-          <p><input type="submit" name="_youmaylivealittlelonger" value="Reset votes" /></p>
+          <p><?php echo $lang->get('ajax_delvote_reset_confirm'); ?></p>
+          <p><input type="submit" name="_youmaylivealittlelonger" value="<?php echo htmlspecialchars($lang->get('page_delvote_reset_btn_submit')); ?>" /></p>
         </form>
         <?php
       $template->footer();
       break;
     case 'deletepage':
-      if(!$session->get_permissions('delete_page')) die_friendly('Access denied', '<p>Deleting pages <u>requires</u> admin rights.</p>');
+      if(!$session->get_permissions('delete_page'))
+      {
+        die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>');
+      }
       if(isset($_POST['_adiossucker']))
       {
         $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false;
         if ( empty($reason) )
-          $error = 'Please enter a reason for deleting this page.';
+          $error = $lang->get('ajax_delete_prompt_reason');
         else
         {
           $template->header();
             $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason);
-            echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
+            echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>';
           $template->footer();
           break;
         }
@@ -340,19 +357,19 @@
       $template->header();
         ?>
         <form action="<?php echo makeUrl($paths->page, 'do=deletepage'); ?>" method="post">
-          <h3>You are about to <span style="color: red;">destroy</span> this page.</h3>
-           <p>While the deletion of the page itself is completely reversible, it is impossible to recover any comments or category information on this page. If this is a file page, the file along with all older revisions of it will be permanently deleted. Also, any custom information that this page is tagged with, such as a custom name, protection status, or additional settings such as whether to allow comments, will be permanently lost.</p>
-           <p>Are you <u>absolutely sure</u> that you want to continue?<br />
-              You will not be asked again.</p>
+           <?php echo $lang->get('page_delete_warning_stern'); ?>
            <?php if ( isset($error) ) echo "<p>$error</p>"; ?>
-           <p>Reason for deleting: <input type="text" name="reason" size="50" /></p>
-           <p><input type="submit" name="_adiossucker" value="Delete this page" style="color: red; font-weight: bold;" /></p>
+           <p><?php echo $lang->get('page_delete_lbl_reason'); ?> <input type="text" name="reason" size="50" /></p>
+           <p><input type="submit" name="_adiossucker" value="<?php echo htmlspecialchars($lang->get('page_delete_btn_submit')); ?>" style="color: red; font-weight: bold;" /></p>
         </form>
         <?php
       $template->footer();
       break;
     case 'setwikimode':
-      if(!$session->get_permissions('set_wiki_mode')) die_friendly('Access denied', '<p>Changing the wiki mode setting <u>requires</u> admin rights.</p>');
+      if(!$session->get_permissions('set_wiki_mode'))
+      {
+        die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>');
+      }
       if ( isset($_POST['finish']) )
       {
         $level = intval($_POST['level']);
@@ -363,7 +380,7 @@
         $q = $db->sql_query('UPDATE '.table_prefix.'pages SET wiki_mode=' . $level . ' WHERE urlname=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $paths->namespace . '\';');
         if ( !$q )
           $db->_die();
-        redirect(makeUrl($paths->page), htmlspecialchars($paths->cpage['name']), 'Wiki mode for this page has been set. Redirecting you to the page...', 2);
+        redirect(makeUrl($paths->page), htmlspecialchars($paths->cpage['name']), $lang->get('page_wikimode_success_redirect'), 2);
       }
       else
       {
@@ -377,17 +394,13 @@
         echo '<form action="' . makeUrl($paths->page, 'do=setwikimode', true) . '" method="post">';
         echo '<input type="hidden" name="finish" value="foo" />';
         echo '<input type="hidden" name="level" value="' . $level . '" />';
-        $level_txt = ( $level == 0 ) ? 'disabled' : ( ( $level == 1 ) ? 'enabled' : 'use the global setting' );
-        $blurb = ( $level == 0 || ( $level == 2 && getConfig('wiki_mode') != '1' ) ) ? 'Because this will disable the wiki behavior on this page, several features, most
-           notably the ability for users to vote to have this page deleted, will be disabled as they are not relevant to non-wiki pages. In addition, users will not be able
-           to edit this page unless an ACL rule specifically permits them.' : 'Because this will enable the wiki behavior on this page, users will gain the ability to
-           freely edit this page unless an ACL rule specifically denies them. If your site is public and gets good traffic, you should be aware of the possiblity of vandalism, and you need to be ready to revert
-           malicious edits to this page.';
+        $level_txt = ( $level == 0 ) ? 'page_wikimode_level_off' : ( ( $level == 1 ) ? 'page_wikimode_level_on' : 'page_wikimode_level_global' );
+        $blurb = ( $level == 0 || ( $level == 2 && getConfig('wiki_mode') != '1' ) ) ? 'page_wikimode_blurb_disable' : 'page_wikimode_blurb_enable';
         ?>
-        <h3>You are changing wiki mode for this page.</h3>
-        <p>Wiki features will be set to <?php echo $level_txt; ?>. <?php echo $blurb; ?></p>
-        <p>If you want to continue, please click the button below.</p>
-        <p><input type="submit" value="Set wiki mode" /></p>
+        <h3><?php echo $lang->get('page_wikimode_heading'); ?></h3>
+        <p><?php echo $lang->get($level_txt) . ' ' . $lang->get($blurb); ?></p>
+        <p><?php echo $lang->get('page_wikimode_warning'); ?></p>
+        <p><input type="submit" value="<?php echo htmlspecialchars($lang->get('page_wikimode_btn_submit')); ?>" /></p>
         <?php
         echo '</form>';
         $template->footer();
@@ -406,16 +419,16 @@
     case 'detag':
       if ( $session->user_level < USER_LEVEL_ADMIN )
       {
-        die_friendly('Access denied', '<p>You need to be an administrator to detag pages.</p>');
+        die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>');
       }
       if ( $paths->page_exists )
       {
-        die_friendly('Invalid request', '<p>The detag action is only valid for pages that have been deleted in the past.</p>');
+        die_friendly($lang->get('etc_invalid_request_short'), '<p>' . $lang->get('page_detag_err_page_exists') . '</p>');
       }
       $q = $db->sql_query('DELETE FROM '.table_prefix.'tags WHERE page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $paths->namespace . '\';');
       if ( !$q )
         $db->_die('Detag query, index.php:'.__LINE__);
-      die_friendly('Page detagged', '<p>All stale tags have been removed from this page.</p>');
+      die_friendly($lang->get('page_detag_success_title'), '<p>' . $lang->get('page_detag_success_body') . '</p>');
       break;
     case 'aclmanager':
       $data = ( isset($_POST['data']) ) ? $_POST['data'] : Array('mode' => 'listgroups');
--- a/install.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/install.php	Sun Nov 18 20:37:08 2007 -0500
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.2 (Coblynau)
+ * Version 1.1.1
  * Copyright (C) 2006-2007 Dan Fuhry
  * install.php - handles everything related to installation and initial configuration
  *
@@ -24,9 +24,13 @@
 
 define('IN_ENANO_INSTALL', 'true');
 
-define('ENANO_VERSION', '1.0.2');
+define('ENANO_VERSION', '1.1.1');
+define('ENANO_CODE_NAME', 'Germination');
 // 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 = '';
@@ -62,14 +66,18 @@
 require('includes/constants.php');
 require('includes/rijndael.php');
 require('includes/functions.php');
+require('includes/dbal.php');
+require('includes/lang.php');
+require('includes/json.php');
 
 strip_magic_quotes_gpc();
-$neutral_color = 'C';
 
 //
 // INSTALLER LIBRARY
 //
 
+$neutral_color = 'C';
+
 function run_installer_stage($stage_id, $stage_name, $function, $failure_explanation, $allow_skip = true)
 {
   static $resumed = false;
@@ -118,7 +126,7 @@
 
 function start_install_table()
 {
-  echo '<table border="0" cellspacing="0" cellpadding="0">' . "\n";
+  echo '<table border="0" cellspacing="0" cellpadding="0" style="margin-top: 10px;">' . "\n";
   ob_start();
 }
 
@@ -139,6 +147,7 @@
 function echo_stage_failure($stage_id, $stage_name, $failure_explanation, $resume_stack)
 {
   global $neutral_color;
+  global $lang;
   
   $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A';
   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";
@@ -156,11 +165,11 @@
   echo '<form action="install.php?mode=install&amp;stage=' . $stage_id . '" method="post">
           ' . $post_data . '
           <input type="hidden" name="resume_stack" value="' . htmlspecialchars(implode('|', $resume_stack)) . '" />
-          <h3>Enano installation failed.</h3>
+          <h3>' . $lang->get('meta_msg_err_stagefailed_title') . '</h3>
            <p>' . $failure_explanation . '</p>
-           ' . ( !empty($mysql_error) ? "<p>The error returned from MySQL was: $mysql_error</p>" : '' ) . '
-           <p>When you have corrected the error, click the button below to attempt to continue the installation.</p>
-           <p style="text-align: center;"><input type="submit" value="Retry installation" /></p>
+           ' . ( !empty($mysql_error) ? "<p>" . $lang->get('meta_msg_err_stagefailed_mysqlerror') . " $mysql_error</p>" : '' ) . '
+           <p>' . $lang->get('meta_msg_err_stagefailed_body') . '</p>
+           <p style="text-align: center;"><input type="submit" value="' . $lang->get('meta_btn_retry_installation') . '" /></p>
         </form>';
   global $template, $template_bak;
   if ( is_object($template_bak) )
@@ -594,6 +603,16 @@
   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);
+  
+  return true;
+}
+
 function stg_init_logs()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
@@ -662,22 +681,37 @@
   if($val)
   {
     if($cv) $color='CCFFCC'; else $color='AAFFAA';
-    echo "<tr><td style='background-color: #$color; width: 500px;'>$desc</td><td style='padding-left: 10px;'><img alt='Test passed' src='images/good.gif' /></td></tr>";
+    echo "<tr><td style='background-color: #$color; width: 500px; padding: 5px;'>$desc</td><td style='padding-left: 10px;'><img alt='Test passed' src='images/good.gif' /></td></tr>";
   } elseif(!$val && $warn) {
     if($cv) $color='FFFFCC'; else $color='FFFFAA';
-    echo "<tr><td style='background-color: #$color; width: 500px;'>$desc<br /><b>$extended_desc</b></td><td style='padding-left: 10px;'><img alt='Test passed with warning' src='images/unknown.gif' /></td></tr>";
+    echo "<tr><td style='background-color: #$color; width: 500px; padding: 5px;'>$desc<br /><b>$extended_desc</b></td><td style='padding-left: 10px;'><img alt='Test passed with warning' src='images/unknown.gif' /></td></tr>";
     $warned = true;
   } else {
     if($cv) $color='FFCCCC'; else $color='FFAAAA';
-    echo "<tr><td style='background-color: #$color; width: 500px;'>$desc<br /><b>$extended_desc</b></td><td style='padding-left: 10px;'><img alt='Test failed' src='images/bad.gif' /></td></tr>";
+    echo "<tr><td style='background-color: #$color; width: 500px; padding: 5px;'>$desc<br /><b>$extended_desc</b></td><td style='padding-left: 10px;'><img alt='Test failed' src='images/bad.gif' /></td></tr>";
     $failed = true;
   }
 }
-function is_apache() { $r = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? true : false; return $r; }
+function is_apache()
+{
+  return strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? true : false;
+}
 
 require_once('includes/template.php');
 
-if(!isset($_GET['mode'])) $_GET['mode'] = 'welcome';
+//
+// Startup localization
+//
+
+// We need $db just for the _die function
+$db = new mysql();
+
+$lang = new Language('eng');
+$lang->load_file('./language/english/install.json');
+
+if ( !isset($_GET['mode']) )
+  $_GET['mode'] = 'welcome';
+
 switch($_GET['mode'])
 {
   case 'mysql_test':
@@ -757,25 +791,15 @@
     switch($topic)
     {
       case 'admin_embed_php':
-        $title = 'Allow administrators to embed PHP';
-        $content = '<p>This option allows you to control whether anything between the standard &lt;?php and ?&gt; tags will be treated as
-                        PHP code by Enano. If this option is enabled, and members of the Administrators group use these tags, Enano will
-                        execute that code when the page is loaded. There are obvious potential security implications here, which should
-                        be carefully considered before enabling this option.</p>
-                    <p>If you are the only administrator of this site, or if you have a high level of trust for those will be administering
-                       the site with you, you should enable this to allow extreme customization of pages.</p>
-                    <p>Leave this option off if you are at all concerned about security – if your account is compromised and PHP embedding
-                       is enabled, an attacker can run arbitrary code on your server! Enabling this will also allow administrators to
-                       embed Javascript and arbitrary HTML and CSS.</p>
-                    <p>If you don\'t have experience coding in PHP, you can safely disable this option. You may change this at any time
-                       using the ACL editor by selecting the Administrators group and This Entire Website under the scope selection. <!-- , or by
-                       using the "embedded PHP kill switch" in the administration panel. --></p>';
+        $title = $lang->get('pophelp_admin_embed_php_title');
+        $content = $lang->get('pophelp_admin_embed_php_body');
         break;
       default:
         $title = 'Invalid topic';
         $content = 'Invalid help topic.';
         break;
     }
+    $close_window = $lang->get('pophelp_btn_close_window');
     echo <<<EOF
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html>
@@ -800,30 +824,44 @@
     <h2>{$title}</h2>
     {$content}
     <p style="text-align: right;">
-      <a href="#" onclick="window.close(); return false;">Close window</a>
+      <a href="#" onclick="window.close(); return false;">{$close_window}</a>
     </p>
   </body>
 </html>
 EOF;
     exit;
     break;
+  case 'langjs':
+    header('Content-type: text/javascript');
+    $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
+    $lang_js = $json->encode($lang->strings);
+    // use EEOF here because jEdit misinterprets "typ'eof'"
+    echo <<<EEOF
+if ( typeof(enano_lang) != 'object' )
+  var enano_lang = new Object();
+
+enano_lang[1] = $lang_js;
+
+EEOF;
+    exit;
+    break;
   default:
     break;
 }
 
 $template = new template_nodb();
-$template->load_theme('oxygen', 'bleu', false);
+$template->load_theme('stpatty', 'shamrock', false);
 
 $modestrings = Array(
-              'welcome' => 'Welcome',
-              'license' => 'License Agreement',
-              'sysreqs' => 'Server requirements',
-              'database'=> 'Database information',
-              'website' => 'Website configuration',
-              'login'   => 'Administration login',
-              'confirm' => 'Confirm installation',
-              'install' => 'Database installation',
-              'finish'  => 'Installation complete'
+              'welcome' => $lang->get('welcome_modetitle'),
+              'license' => $lang->get('license_modetitle'),
+              'sysreqs' => $lang->get('sysreqs_modetitle'),
+              'database'=> $lang->get('database_modetitle'),
+              'website' => $lang->get('website_modetitle'),
+              'login'   => $lang->get('login_modetitle'),
+              'confirm' => $lang->get('confirm_modetitle'),
+              'install' => $lang->get('install_modetitle'),
+              'finish'  => $lang->get('finish_modetitle')
             );
 
 $sideinfo = '';
@@ -857,6 +895,26 @@
   exit;
 }
 
+if ( defined('ENANO_IS_STABLE') )
+  $branch = 'stable';
+else if ( defined('ENANO_IS_UNSTABLE') )
+  $branch = 'unstable';
+else
+{
+  $version = explode('.', ENANO_VERSION);
+  if ( !isset($version[1]) )
+    // unknown branch, really
+    $branch = 'unstable';
+  else
+  {
+    $version[1] = intval($version[1]);
+    if ( $version[1] % 2 == 1 )
+      $branch = 'unstable';
+    else
+      $branch = 'stable';
+  }
+}
+
 $template->header();
 if(!isset($_GET['mode'])) $_GET['mode'] = 'license';
 switch($_GET['mode'])
@@ -865,65 +923,72 @@
   case 'welcome':
     ?>
     <div style="text-align: center; margin-top: 10px;">
-      <img alt="[ Enano CMS Project logo ]" src="images/enano-artwork/installer-greeting-blue.png" style="display: block; margin: 0 auto; padding-left: 100px;" />
-      <h2>Welcome to Enano</h2>
-      <h3>version 1.0.2 &ndash; stable<br />
-      <span style="font-weight: normal;">also affectionately known as "coblynau" <tt>:)</tt></span></h3>
+      <img alt="[ Enano CMS Project logo ]" src="images/enano-artwork/installer-greeting-green.png" style="display: block; margin: 0 auto; padding-left: 100px;" />
+      <h2><?php echo $lang->get('welcome_heading'); ?></h2>
+      <h3>
+        <?php
+        $branch_l = $lang->get("welcome_branch_$branch");
+        
+        $v_string = sprintf('%s %s &ndash; %s', $lang->get('welcome_version'), ENANO_VERSION, $branch_l);
+        echo $v_string;
+        ?>
+      </h3>
       <?php
-      if ( file_exists('./_nightly.php') )
-      {
-        echo '<div class="warning-box" style="text-align: left; margin: 10px 0;"><b>You are about to install a NIGHTLY BUILD of Enano.</b><br />Nightly builds are NOT upgradeable and may contain serious flaws, security problems, or extraneous debugging information. Installing this version of Enano on a production site is NOT recommended.</div>';
-      }
+        if ( defined('ENANO_CODE_NAME') )
+        {
+          echo '<p>';
+          echo $lang->get('welcome_aka', array(
+              'codename' => strtolower(ENANO_CODE_NAME)
+            ));
+          echo '</p>';
+        }
       ?>
       <form action="install.php?mode=license" method="post">
-        <input type="submit" value="Start installation" />
+        <input type="submit" value="<?php echo $lang->get('welcome_btn_start'); ?>" />
       </form>
     </div>
     <?php
     break;
   case "license":
     ?>
-    <h3>Welcome to the Enano installer.</h3>
-     <p>Thank you for choosing Enano as your CMS. You've selected the finest in design, the strongest in security, and the latest in Web 2.0 toys. Trust us, you'll like it.</p>
-     <p>To get started, please read and accept the following license agreement. You've probably seen it before.</p>
+    <h3><?php echo $lang->get('license_heading'); ?></h3>
+     <p><?php echo $lang->get('license_blurb_thankyou'); ?></p>
+     <p><?php echo $lang->get('license_blurb_pleaseread'); ?></p>
      <div style="height: 500px; clip: rect(0px,auto,500px,auto); overflow: auto; padding: 10px; border: 1px dashed #456798; margin: 1em;">
-       <h2>GNU General Public License</h2>
-       <h3>Declaration of license usage</h3>
-       <p>Enano is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>
-       <p>This program is distributed in the hope that it will be useful, but <u>without any warranty</u>; without even the implied warranty of <u>merchantability</u> or <u>fitness for a particular purpose</u>. See the GNU General Public License (below) for more details.</p>
-       <p><b>By clicking the button below or otherwise continuing the installation, you indicate your acceptance of this license agreement.</b></p>
-       <h3>Human-readable version</h3>
-       <p>Enano is distributed under certain licensing terms that we believe make it of the greatest possible use to the public. The license we distribute it under, the GNU General Public License, provides certain terms and conditions that, rather than limit your use of Enano, allow you to get the most out of it. If you would like to read the full text, it can be found below. Here is a human-readable version that we think is a little easier to understand.</p>
-       <ul>
-       <li>You may to run Enano for any purpose.</li>
-       <li>You may study how Enano works and adapt it to your needs.</li>
-       <li>You may redistribute copies so you can help your neighbor.</li>
-       <li>You may improve Enano and release your improvements to the public, so that the whole community benefits.</li>
-       </ul>
-       <p>You may exercise the freedoms specified here provided that you comply with the express conditions of this license. The principal conditions are:</p>
-       <ul>
-       <li>You must conspicuously and appropriately publish on each copy distributed an appropriate copyright notice and disclaimer of warranty and keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of Enano a copy of the GNU General Public License along with Enano. Any translation of the GNU General Public License must be accompanied by the GNU General Public License.</li>
-       <li>If you modify your copy or copies of Enano or any portion of it, or develop a program based upon it, you may distribute the resulting work provided you do so under the GNU General Public License. Any translation of the GNU General Public License must be accompanied by the GNU General Public License.</li>
-       <li>If you copy or distribute Enano, you must accompany it with the complete corresponding machine-readable source code or with a written offer, valid for at least three years, to furnish the complete corresponding machine-readable source code.</li>
-       </ul>
-       <p><b>Disclaimer</b>: The above text is not a license. It is simply a handy reference for understanding the Legal Code (the full license) &ndash; it is a human-readable expression of some of its key terms. Think of it as the user-friendly interface to the Legal Code beneath. The above text itself has no legal value, and its contents do not appear in the actual license.<br /><span style="color: #CCC">Text copied from the <a href="http://creativecommons.org/licenses/GPL/2.0/">Creative Commons GPL Deed page</a></span></p>
        <?php
-       if ( defined('ENANO_BETA_VERSION') )
+       if ( !file_exists('./GPL') || !file_exists('./language/english/install/license-deed.html') )
+       {
+         echo 'Cannot find the license files.';
+       }
+       echo file_get_contents('./language/english/install/license-deed.html');
+       if ( defined('ENANO_BETA_VERSION') || $branch == 'unstable' )
        {
          ?>
-         <h3>Notice for prerelease versions</h3>
-         <p>This version of Enano is designed only for testing and evaluation purposes. <b>It is not yet completely stable, and should not be used on production websites.</b> As with any Enano version, Dan Fuhry and the Enano team cannot be responsible for any damage, physical or otherwise, to any property as a result of the use of Enano. While security is a number one priority, sometimes things slip through.</p>
+         <h3><?php echo $lang->get('license_info_unstable_title'); ?></h3>
+         <p><?php echo $lang->get('license_info_unstable_body'); ?></p>
          <?php
        }
        ?>
-       <h3>Lawyer-readable version</h3>
+       <h3><?php echo $lang->get('license_section_gpl_heading'); ?></h3>
+       <?php if ( $lang->lang_code != 'eng' ): ?>
+       <p><i><?php echo $lang->get('license_gpl_blurb_inenglish'); ?></i></p>
+       <?php endif; ?>
        <?php echo wikiFormat(file_get_contents(ENANO_ROOT . '/GPL')); ?>
      </div>
      <div class="pagenav">
        <form action="install.php?mode=sysreqs" method="post">
          <table border="0">
          <tr>
-         <td><input type="submit" value="I agree to the license terms" /></td><td><p><span style="font-weight: bold;">Before clicking continue:</span><br />&bull; Ensure that you agree with the terms of the license<br />&bull; Have your database host, name, username, and password available</p></td>
+           <td>
+             <input type="submit" value="<?php echo $lang->get('license_btn_i_agree'); ?>" />
+           </td>
+           <td>
+             <p>
+               <span style="font-weight: bold;"><?php echo $lang->get('meta_lbl_before_continue'); ?></span><br />
+               &bull; <?php echo $lang->get('license_objective_ensure_agree'); ?><br />
+               &bull; <?php echo $lang->get('license_objective_have_db_info'); ?>
+             </p>
+           </td>
          </tr>
          </table>
        </form>
@@ -933,19 +998,18 @@
   case "sysreqs":
     error_reporting(E_ALL);
     ?>
-    <h3>Checking your server</h3>
-     <p>Enano has several requirements that must be met before it can be installed. If all is good then note any warnings and click Continue below.</p>
+    <h3><?php echo $lang->get('sysreqs_heading'); ?></h3>
+     <p><?php echo $lang->get('sysreqs_blurb'); ?></p>
     <table border="0" cellspacing="0" cellpadding="0">
     <?php
-    run_test('return version_compare(\'4.3.0\', PHP_VERSION, \'<\');', 'PHP Version >=4.3.0', 'It seems that the version of PHP that your server is running is too old to support Enano properly. If this is your server, please upgrade to the most recent version of PHP, remembering to use the --with-mysql configure option if you compile it yourself. If this is not your server, please contact your webhost and ask them if it would be possible to upgrade PHP. If this is not possible, you will need to switch to a different webhost in order to use Enano.');
-    run_test('return function_exists(\'mysql_connect\');', 'MySQL extension for PHP', 'It seems that your PHP installation does not have the MySQL extension enabled. If this is your own server, you may need to just enable the "libmysql.so" extension in php.ini. If you do not have the MySQL extension installed, you will need to either use your distribution\'s package manager to install it, or you will have to compile PHP from source. If you compile PHP from source, please remember to use the "--with-mysql" configure option, and you will have to have the MySQL development files installed (they usually are). If this is not your server, please contact your hosting company and ask them to install the PHP MySQL extension.');
-    run_test('return @ini_get(\'file_uploads\');', 'File upload support', 'It seems that your server does not support uploading files. Enano *requires* this functionality in order to work properly. Please ask your server administrator to set the "file_uploads" option in php.ini to "On".');
-    run_test('return is_apache();', 'Apache HTTP Server', 'Apparently your server is running a web server other than Apache. Enano will work nontheless, but there are some known bugs with non-Apache servers, and the "fancy" URLs will not work properly. The "Standard URLs" option will be set on the website configuration page, only change it if you are absolutely certain that your server is running Apache.', true);
-    //run_test('return function_exists(\'finfo_file\');', 'Fileinfo PECL extension', 'The MIME magic PHP extension is used to determine the type of a file by looking for a certain "magic" string of characters inside it. This functionality is used by Enano to more effectively prevent malicious file uploads. The MIME magic option will be disabled by default.', true);
-    run_test('return is_writable(ENANO_ROOT.\'/config.new.php\');', 'Configuration file writable', 'It looks like the configuration file, config.new.php, is not writable. Enano needs to be able to write to this file in order to install.<br /><br /><b>If you are installing Enano on a SourceForge web site:</b><br />SourceForge mounts the web partitions read-only now, so you will need to use the project shell service to symlink config.php to a file in the /tmp/persistent directory.');
-    run_test('return file_exists(\'/usr/bin/convert\');', 'ImageMagick support', 'Enano uses ImageMagick to scale images into thumbnails. Because ImageMagick was not found on your server, Enano will use the width= and height= attributes on the &lt;img&gt; tag to scale images. This can cause somewhat of a performance increase, but bandwidth usage will be higher, especially if you use high-resolution images on your site.<br /><br />If you are sure that you have ImageMagick, you can set the location of the "convert" program using the administration panel after installation is complete.', true);
-    run_test('return is_writable(ENANO_ROOT.\'/cache/\');', 'Cache directory writable', 'Apparently the cache/ directory is not writable. Enano will still work, but you will not be able to cache thumbnails, meaning the server will need to re-render them each time they are requested. In some cases, this can cause a significant slowdown.', true);
-    run_test('return is_writable(ENANO_ROOT.\'/files/\');', 'File uploads directory writable', 'It seems that the directory where uploaded files are stored (' . ENANO_ROOT . '/files) cannot be written by the server. Enano will still function, but file uploads will not function, and will be disabled by default.', true);
+    run_test('return version_compare(\'4.3.0\', PHP_VERSION, \'<\');', $lang->get('sysreqs_req_php'), $lang->get('sysreqs_req_desc_php') );
+    run_test('return function_exists(\'mysql_connect\');', $lang->get('sysreqs_req_mysql'), $lang->get('sysreqs_req_desc_mysql') );
+    run_test('return @ini_get(\'file_uploads\');', $lang->get('sysreqs_req_uploads'), $lang->get('sysreqs_req_desc_uploads') );
+    run_test('return is_apache();', $lang->get('sysreqs_req_apache'), $lang->get('sysreqs_req_desc_apache'), true);
+    run_test('return is_writable(ENANO_ROOT.\'/config.new.php\');', $lang->get('sysreqs_req_config'), $lang->get('sysreqs_req_desc_config') );
+    run_test('return file_exists(\'/usr/bin/convert\');', $lang->get('sysreqs_req_magick'), $lang->get('sysreqs_req_desc_magick'), true);
+    run_test('return is_writable(ENANO_ROOT.\'/cache/\');', $lang->get('sysreqs_req_cachewriteable'), $lang->get('sysreqs_req_desc_cachewriteable'), true);
+    run_test('return is_writable(ENANO_ROOT.\'/files/\');', $lang->get('sysreqs_req_fileswriteable'), $lang->get('sysreqs_req_desc_fileswriteable'), true);
     echo '</table>';
     if(!$failed)
     {
@@ -955,27 +1019,39 @@
       <?php
       if($warned) {
         echo '<table border="0" cellspacing="0" cellpadding="0">';
-        run_test('return false;', 'Some scalebacks were made due to your server configuration.', 'Enano has detected that some of the features or configuration settings on your server are not optimal for the best behavior and/or performance for Enano. As a result, certain features or enhancements that are part of Enano have been disabled to prevent further errors. You have seen those "fatal error" notices that spew from PHP, haven\'t you?<br /><br />Fatal error:</b> call to undefined function wannahokaloogie() in file <b>'.__FILE__.'</b> on line <b>'.__LINE__.'', true);
+        run_test('return false;', $lang->get('sysreqs_summary_warn_title'), $lang->get('sysreqs_summary_warn_body'), true);
         echo '</table>';
       } else {
         echo '<table border="0" cellspacing="0" cellpadding="0">';
-        run_test('return true;', '<b>Your server meets all the requirements for running Enano.</b><br />Click the button below to continue the installation.', 'You should never see this text. Congratulations for being an Enano hacker!');
+        run_test('return true;', '<b>' . $lang->get('sysreqs_summary_success_title') . '</b><br />' . $lang->get('sysreqs_summary_success_body'), 'You should never see this text. Congratulations for being an Enano hacker!');
         echo '</table>';
       }
       ?>
-       <form action="install.php?mode=database" method="post">
-         <table border="0">
-         <tr>
-         <td><input type="submit" value="Continue" /></td><td><p><span style="font-weight: bold;">Before clicking continue:</span><br />&bull; Ensure that you are satisfied with any scalebacks that may have been made to accomodate your server configuration<br />&bull; Have your database host, name, username, and password available</p></td>
-         </tr>
-         </table>
-       </form>
-     </div>
-     <?php
-    } else {
-      if($failed) {
+      <form action="install.php?mode=database" method="post">
+        <table border="0">
+        <tr>
+          <td>
+            <input type="submit" value="<?php echo $lang->get('meta_btn_continue'); ?>" />
+          </td>
+          <td>
+            <p>
+              <span style="font-weight: bold;"><?php echo $lang->get('meta_lbl_before_continue'); ?></span><br />
+              &bull; <?php echo $lang->get('sysreqs_objective_scalebacks'); ?><br />
+              &bull; <?php echo $lang->get('license_objective_have_db_info'); ?>
+            </p>
+          </td>
+        </tr>
+        </table>
+      </form>
+      </div>
+    <?php
+    }
+    else
+    {
+      if ( $failed )
+      {
         echo '<div class="pagenav"><table border="0" cellspacing="0" cellpadding="0">';
-        run_test('return false;', 'Your server does not meet the requirements for Enano to run.', 'As a precaution, Enano will not install until the above requirements have been met. Contact your server administrator or hosting company and convince them to upgrade. Good luck.');
+        run_test('return false;', $lang->get('sysreqs_summary_fail_title'), $lang->get('sysreqs_summary_fail_body'));
         echo '</table></div>';
       }
     }
@@ -1024,7 +1100,7 @@
         v = verify();
         if(!v)
         {
-          alert('One or more of the form fields is incorrect. Please correct any information in the form that has an "X" next to it.');
+          alert($lang.get('meta_msg_err_verification'));
           return false;
         }
         var frm = document.forms.dbinfo;
@@ -1047,10 +1123,10 @@
                 document.getElementById('s_db_name').src='images/good.gif';
                 document.getElementById('s_db_auth').src='images/good.gif';
                 document.getElementById('s_db_root').src='images/good.gif';
-                if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = '<b>Warning:<\/b> The database you specified does not exist. It will be created during installation.';
-                if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = '<b>Warning:<\/b> The specified regular user does not exist or the password is incorrect. The user will be created during installation. If the user already exists, the password will be reset.';
+                if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = $lang.get('database_msg_warn_creating_db');
+                if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = $lang.get('database_msg_warn_creating_user');
                 document.getElementById('s_mysql_version').src='images/good.gif';
-                document.getElementById('e_mysql_version').innerHTML = 'Your version of MySQL meets Enano requirements.';
+                document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_info_mysql_good');
               }
               else
               {
@@ -1061,50 +1137,50 @@
                   document.getElementById('s_db_name').src='images/unknown.gif';
                   document.getElementById('s_db_auth').src='images/unknown.gif';
                   document.getElementById('s_db_root').src='images/unknown.gif';
-                  document.getElementById('e_db_host').innerHTML = '<b>Error:<\/b> The database server "'+document.forms.dbinfo.db_host.value+'" couldn\'t be contacted.<br \/>'+t;
-                  document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
+                  document.getElementById('e_db_host').innerHTML = $lang.get('database_msg_err_mysql_connect', { db_host: document.forms.dbinfo.db_host.value, mysql_error: t });
+                  document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version');
                   break;
                 case 'auth':
                   document.getElementById('s_db_host').src='images/good.gif';
                   document.getElementById('s_db_name').src='images/unknown.gif';
                   document.getElementById('s_db_auth').src='images/bad.gif';
                   document.getElementById('s_db_root').src='images/unknown.gif';
-                  document.getElementById('e_db_auth').innerHTML = '<b>Error:<\/b> Access to MySQL under the specified credentials was denied.<br \/>'+t;
-                  document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
+                  document.getElementById('e_db_auth').innerHTML = $lang.get('database_msg_err_mysql_auth', { mysql_error: t });
+                  document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version');
                   break;
                 case 'perm':
                   document.getElementById('s_db_host').src='images/good.gif';
                   document.getElementById('s_db_name').src='images/bad.gif';
                   document.getElementById('s_db_auth').src='images/good.gif';
                   document.getElementById('s_db_root').src='images/unknown.gif';
-                  document.getElementById('e_db_name').innerHTML = '<b>Error:<\/b> Access to the specified database using those login credentials was denied.<br \/>'+t;
-                  document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
+                  document.getElementById('e_db_name').innerHTML = $lang.get('database_msg_err_mysql_dbperm', { mysql_error: t });
+                  document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version');
                   break;
                 case 'name':
                   document.getElementById('s_db_host').src='images/good.gif';
                   document.getElementById('s_db_name').src='images/bad.gif';
                   document.getElementById('s_db_auth').src='images/good.gif';
                   document.getElementById('s_db_root').src='images/unknown.gif';
-                  document.getElementById('e_db_name').innerHTML = '<b>Error:<\/b> The specified database does not exist<br \/>'+t;
-                  document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
+                  document.getElementById('e_db_name').innerHTML = $lang.get('database_msg_err_mysql_dbexist', { mysql_error: t });
+                  document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version');
                   break;
                 case 'root':
                   document.getElementById('s_db_host').src='images/good.gif';
                   document.getElementById('s_db_name').src='images/unknown.gif';
                   document.getElementById('s_db_auth').src='images/unknown.gif';
                   document.getElementById('s_db_root').src='images/bad.gif';
-                  document.getElementById('e_db_root').innerHTML = '<b>Error:<\/b> Access to MySQL under the specified credentials was denied.<br \/>'+t;
-                  document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
+                  document.getElementById('e_db_root').innerHTML = $lang.get('database_msg_err_mysql_auth', { mysql_error: t });
+                  document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version');
                   break;
                 case 'vers':
                   document.getElementById('s_db_host').src='images/good.gif';
                   document.getElementById('s_db_name').src='images/good.gif';
                   document.getElementById('s_db_auth').src='images/good.gif';
                   document.getElementById('s_db_root').src='images/good.gif';
-                  if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = '<b>Warning:<\/b> The database you specified does not exist. It will be created during installation.';
-                  if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = '<b>Warning:<\/b> The specified regular user does not exist or the password is incorrect. The user will be created during installation. If the user already exists, the password will be reset.';
+                  if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = $lang.get('database_msg_warn_creating_db');
+                  if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = $lang.get('database_msg_warn_creating_user');
                   
-                  document.getElementById('e_mysql_version').innerHTML = '<b>Error:<\/b> Your version of MySQL ('+t+') is older than 4.1.17. Enano will still work, but there is a known bug with the comment system and MySQL 4.1.11 that involves some comments not being displayed, due to an issue with the PHP function mysql_fetch_row().';
+                  document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_err_mysql_version', { mysql_version: t });
                   document.getElementById('s_mysql_version').src='images/bad.gif';
                 default:
                   alert(t);
@@ -1131,7 +1207,7 @@
           document.getElementById('s_db_host').src='images/bad.gif';
           ret = false;
         }
-        if(frm.db_name.value.match(/^([a-z0-9_-]+)$/g))
+        if(frm.db_name.value.match(/^([a-z0-9_]+)$/g))
         {
           document.getElementById('s_db_name').src='images/unknown.gif';
         }
@@ -1177,46 +1253,151 @@
       }
       window.onload = verify;
     </script>
-    <p>Now we need some information that will allow Enano to contact your database server. Enano uses MySQL as a data storage backend,
-       and we need to have access to a MySQL server in order to continue.</p>
-    <p>If you do not have access to a MySQL server, and you are using your own server, you can download MySQL for free from
-       <a href="http://www.mysql.com/">MySQL.com</a>. <b>Please note that, like Enano, MySQL is licensed under the GNU GPL.</b>
-       If you need to modify MySQL and then distribute your modifications, you must either distribute them under the terms of the GPL
-       or purchase a proprietary license.</p>
+    <p><?php echo $lang->get('database_blurb_needdb'); ?></p>
+    <p><?php echo $lang->get('database_blurb_howtomysql'); ?></p>
     <?php
-    if ( @file_exists('/etc/enano-is-virt-appliance') )
+    if ( file_exists('/etc/enano-is-virt-appliance') )
     {
-      echo '<p><b>MySQL login information for this virtual appliance:</b><br /><br />Database hostname: localhost<br />Database login: username "enano", password: "clurichaun" (without quotes)<br />Database name: enano_www1</p>';
+      echo '<p>
+              ' . $lang->get('database_vm_login_info', array( 'host' => 'localhost', 'user' => 'enano', 'pass' => 'clurichaun', 'name' => 'enano_www1' )) . '
+            </p>';
     }
     ?>
     <form name="dbinfo" action="install.php?mode=website" method="post">
       <table border="0">
-        <tr><td colspan="3" style="text-align: center"><h3>Database information</h3></td></tr>
-        <tr><td><b>Database hostname</b><br />This is the hostname (or sometimes the IP address) of your MySQL server. In many cases, this is "localhost".<br /><span style="color: #993300" id="e_db_host"></span></td><td><input onkeyup="verify();" name="db_host" size="30" type="text" /></td><td><img id="s_db_host" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
-        <tr><td><b>Database name</b><br />The name of the actual database. If you don't already have a database, you can create one here, if you have the username and password of a MySQL user with administrative rights.<br /><span style="color: #993300" id="e_db_name"></span></td><td><input onkeyup="verify();" name="db_name" size="30" type="text" /></td><td><img id="s_db_name" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
-        <tr><td rowspan="2"><b>Database login</b><br />These fields should be the username and password of a user with "select", "insert", "update", "delete", "create table", and "replace" privileges for your database.<br /><span style="color: #993300" id="e_db_auth"></span></td><td><input onkeyup="verify();" name="db_user" size="30" type="text" /></td><td rowspan="2"><img id="s_db_auth" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
-        <tr><td><input name="db_pass" size="30" type="password" /></td></tr>
-        <tr><td colspan="3" style="text-align: center"><h3>Optional information</h3></td></tr>
-        <tr><td><b>Table prefix</b><br />The value that you enter here will be added to the beginning of the name of each Enano table. You may use lowercase letters (a-z), numbers (0-9), and underscores (_).</td><td><input onkeyup="verify();" name="table_prefix" size="30" type="text" /></td><td><img id="s_table_prefix" alt="Good/bad icon" src="images/good.gif" /></td></tr>
-        <tr><td rowspan="2"><b>Database administrative login</b><br />If the MySQL database or username that you entered above does not exist yet, you can create them here, assuming that you have the login information for an administrative user (such as root). Leave these fields blank unless you need to use them.<br /><span style="color: #993300" id="e_db_root"></span></td><td><input onkeyup="verify();" name="db_root_user" size="30" type="text" /></td><td rowspan="2"><img id="s_db_root" alt="Good/bad icon" src="images/good.gif" /></td></tr>
-        <tr><td><input onkeyup="verify();" name="db_root_pass" size="30" type="password" /></td></tr>
-        <tr><td><b>MySQL version</b></td><td id="e_mysql_version">MySQL version information will be checked when you click "Test Connection".</td><td><img id="s_mysql_version" alt="Good/bad icon" src="images/unknown.gif" /></td></tr>
-        <tr><td><b>Delete existing tables?</b><br />If this option is checked, all the tables that will be used by Enano will be dropped (deleted) before the schema is executed. Do NOT use this option unless specifically instructed to.</td><td><input type="checkbox" name="drop_tables" id="dtcheck" />  <label for="dtcheck">Drop existing tables</label></td></tr>
-        <tr><td colspan="3" style="text-align: center"><input type="button" value="Test connection" onclick="ajaxTestConnection();" /></td></tr>
+        <tr>
+          <td colspan="3" style="text-align: center">
+            <h3><?php echo $lang->get('database_table_title'); ?></h3>
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('database_field_hostname_title'); ?></b>
+            <br /><?php echo $lang->get('database_field_hostname_body'); ?>
+            <br /><span style="color: #993300" id="e_db_host"></span>
+          </td>
+          <td>
+            <input onkeyup="verify();" name="db_host" size="30" type="text" />
+          </td>
+          <td>
+            <img id="s_db_host" alt="Good/bad icon" src="images/bad.gif" />
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('database_field_dbname_title'); ?></b><br />
+            <?php echo $lang->get('database_field_dbname_body'); ?><br />
+            <span style="color: #993300" id="e_db_name"></span>
+          </td>
+          <td>
+            <input onkeyup="verify();" name="db_name" size="30" type="text" />
+          </td>
+          <td>
+            <img id="s_db_name" alt="Good/bad icon" src="images/bad.gif" />
+          </td>
+        </tr>
+        <tr>
+          <td rowspan="2">
+            <b><?php echo $lang->get('database_field_dbauth_title'); ?></b><br />
+            <?php echo $lang->get('database_field_dbauth_body'); ?><br />
+            <span style="color: #993300" id="e_db_auth"></span>
+          </td>
+          <td>
+            <input onkeyup="verify();" name="db_user" size="30" type="text" />
+          </td>
+          <td rowspan="2">
+            <img id="s_db_auth" alt="Good/bad icon" src="images/bad.gif" />
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <input name="db_pass" size="30" type="password" />
+          </td>
+        </tr>
+        <tr>
+          <td colspan="3" style="text-align: center">
+            <h3><?php echo $lang->get('database_heading_optionalinfo'); ?></h3>
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('database_field_tableprefix_title'); ?></b><br />
+            <?php echo $lang->get('database_field_tableprefix_body'); ?>
+          </td>
+          <td>
+            <input onkeyup="verify();" name="table_prefix" size="30" type="text" />
+          </td>
+          <td>
+            <img id="s_table_prefix" alt="Good/bad icon" src="images/good.gif" />
+          </td>
+        </tr>
+        <tr>
+          <td rowspan="2">
+            <b><?php echo $lang->get('database_field_rootauth_title'); ?></b><br />
+            <?php echo $lang->get('database_field_rootauth_body'); ?><br />
+            <span style="color: #993300" id="e_db_root"></span>
+          </td>
+          <td>
+            <input onkeyup="verify();" name="db_root_user" size="30" type="text" />
+          </td>
+          <td rowspan="2">
+            <img id="s_db_root" alt="Good/bad icon" src="images/good.gif" />
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <input onkeyup="verify();" name="db_root_pass" size="30" type="password" />
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('database_field_mysqlversion_title'); ?></b>
+          </td>
+          <td id="e_mysql_version">
+            <?php echo $lang->get('database_field_mysqlversion_blurb_willbechecked'); ?>
+          </td>
+          <td>
+            <img id="s_mysql_version" alt="Good/bad icon" src="images/unknown.gif" />
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('database_field_droptables_title'); ?></b><br />
+            <?php echo $lang->get('database_field_droptables_body'); ?>
+          </td>
+          <td>
+            <input type="checkbox" name="drop_tables" id="dtcheck" />  <label for="dtcheck"><?php echo $lang->get('database_field_droptables_lbl'); ?></label>
+          </td>
+        </tr>
+        <tr>
+          <td colspan="3" style="text-align: center">
+            <input type="button" value="<?php echo $lang->get('database_btn_testconnection'); ?>" onclick="ajaxTestConnection();" />
+          </td>
+        </tr>
       </table>
       <div class="pagenav">
-       <table border="0">
-       <tr>
-       <td><input type="submit" value="Continue" onclick="return verify();" name="_cont" /></td><td><p><span style="font-weight: bold;">Before clicking continue:</span><br />&bull; Check your MySQL connection using the "Test Connection" button.<br />&bull; Be aware that your database information will be transmitted unencrypted several times.</p></td>
-       </tr>
-       </table>
-     </div>
+        <table border="0">
+          <tr>
+            <td>
+              <input type="submit" value="<?php echo $lang->get('meta_btn_continue'); ?>" onclick="return verify();" name="_cont" />
+            </td>
+            <td>
+              <p>
+                <span style="font-weight: bold;"><?php echo $lang->get('meta_lbl_before_continue'); ?></span><br />
+                &bull; <?php echo $lang->get('database_objective_test'); ?><br />
+                &bull; <?php echo $lang->get('database_objective_uncrypt'); ?>
+              </p>
+            </td>
+          </tr>
+        </table>
+      </div>
     </form>
     <?php
     break;
   case "website":
-    if(!isset($_POST['_cont'])) {
-      echo 'No POST data signature found. Please <a href="install.php?mode=sysreqs">restart the installation</a>.';
+    if ( !isset($_POST['_cont']) )
+    {
+      echo 'No POST data signature found. Please <a href="install.php?mode=license">restart the installation</a>.';
       $template->footer();
       exit;
     }
@@ -1267,19 +1448,81 @@
           echo '<input type="hidden" name="'.htmlspecialchars($k[$i]).'" value="'.htmlspecialchars($_POST[$k[$i]]).'" />'."\n";
         }
       ?>
-      <p>The next step is to enter some information about your website. You can always change this information later, using the administration panel.</p>
+      <p><?php echo $lang->get('website_header_blurb'); ?></p>
       <table border="0">
-        <tr><td><b>Website name</b><br />The display name of your website. Allowed characters are uppercase and lowercase letters, numerals, and spaces. This must not be blank or "Enano".</td><td><input onkeyup="verify();" name="sitename" type="text" size="30" /></td><td><img id="s_name" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
-        <tr><td><b>Website description</b><br />This text will be shown below the name of your website.</td><td><input onkeyup="verify();" name="sitedesc" type="text" size="30" /></td><td><img id="s_desc" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
-        <tr><td><b>Copyright info</b><br />This should be a one-line legal notice that will appear at the bottom of all your pages.</td><td><input onkeyup="verify();" name="copyright" type="text" size="30" /></td><td><img id="s_copyright" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
-        <tr><td><b>Wiki mode</b><br />This feature allows people to create and edit pages on your site. Enano keeps a history of all page modifications, and you can protect pages to prevent editing.</td><td><input name="wiki_mode" type="checkbox" id="wmcheck" />  <label for="wmcheck">Yes, make my website a wiki.</label></td><td></td></tr>
-        <tr><td><b>URL scheme</b><br />Choose how the page URLs will look. Depending on your server configuration, you may need to select the first option. If you don't know, select the first option, and you can always change it later.</td><td colspan="2"><input type="radio" <?php if(!is_apache()) echo 'checked="checked" '; ?>name="urlscheme" value="ugly" id="ugly">  <label for="ugly">Standard URLs - compatible with any web server (www.example.com/index.php?title=Page_name)</label><br /><input type="radio" <?php if(is_apache()) echo 'checked="checked" '; ?>name="urlscheme" value="short" id="short">  <label for="short">Short URLs - requires Apache with a PHP module (www.example.com/index.php/Page_name)</label><br /><input type="radio" name="urlscheme" value="tiny" id="petite">  <label for="petite">Tiny URLs - requires Apache on Linux/Unix/BSD with PHP module and mod_rewrite enabled (www.example.com/Page_name)</label></td></tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('website_field_name_title'); ?></b><br />
+            <?php echo $lang->get('website_field_name_body'); ?>
+          </td>
+          <td>
+            <input onkeyup="verify();" name="sitename" type="text" size="30" />
+          </td>
+          <td>
+            <img id="s_name" alt="Good/bad icon" src="images/bad.gif" />
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('website_field_desc_title'); ?></b><br />
+            <?php echo $lang->get('website_field_desc_body'); ?>
+          </td>
+          <td>
+            <input onkeyup="verify();" name="sitedesc" type="text" size="30" />
+          </td>
+          <td>
+            <img id="s_desc" alt="Good/bad icon" src="images/bad.gif" />
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('website_field_copyright_title'); ?></b><br />
+            <?php echo $lang->get('website_field_copyright_body'); ?>
+          </td>
+          <td>
+            <input onkeyup="verify();" name="copyright" type="text" size="30" />
+          </td>
+          <td>
+            <img id="s_copyright" alt="Good/bad icon" src="images/bad.gif" />
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('website_field_wikimode_title'); ?></b><br />
+            <?php echo $lang->get('website_field_wikimode_body'); ?>
+          </td>
+          <td>
+            <input name="wiki_mode" type="checkbox" id="wmcheck" />  <label for="wmcheck"><?php echo $lang->get('website_field_wikimode_checkbox'); ?></label>
+          </td>
+          <td>
+            &nbsp;
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <b><?php echo $lang->get('website_field_urlscheme_title'); ?></b><br />
+            <?php echo $lang->get('website_field_urlscheme_body'); ?>
+          </td>
+          <td colspan="2">
+            <input type="radio" <?php if(!is_apache()) echo 'checked="checked" '; ?>name="urlscheme" value="ugly" id="ugly"  />  <label for="ugly"><?php echo $lang->get('website_field_urlscheme_ugly'); ?></label><br />
+            <input type="radio" <?php if(is_apache()) echo 'checked="checked" '; ?>name="urlscheme" value="short" id="short" />  <label for="short"><?php echo $lang->get('website_field_urlscheme_short'); ?></label><br />
+            <input type="radio" name="urlscheme" value="tiny" id="petite">  <label for="petite"><?php echo $lang->get('website_field_urlscheme_tiny'); ?></label>
+          </td>
+        </tr>
       </table>
       <div class="pagenav">
        <table border="0">
-       <tr>
-       <td><input type="submit" value="Continue" onclick="return verify();" name="_cont" /></td><td><p><span style="font-weight: bold;">Before clicking continue:</span><br />&bull; Verify that your site information is correct. Again, all of the above settings can be changed from the administration panel.</p></td>
-       </tr>
+         <tr>
+           <td>
+             <input type="submit" value="<?php echo $lang->get('meta_btn_continue'); ?>" onclick="return verify();" name="_cont" />
+           </td>
+           <td>
+             <p>
+               <span style="font-weight: bold;"><?php echo $lang->get('meta_lbl_before_continue'); ?></span><br />
+               &bull; <?php echo $lang->get('website_objective_verify'); ?>
+             </p>
+           </td>
+         </tr>
        </table>
      </div>
     </form>
@@ -1287,7 +1530,7 @@
     break;
   case "login":
     if(!isset($_POST['_cont'])) {
-      echo 'No POST data signature found. Please <a href="install.php?mode=sysreqs">restart the installation</a>.';
+      echo 'No POST data signature found. Please <a href="install.php?mode=license">restart the installation</a>.';
       $template->footer();
       exit;
     }
@@ -1304,7 +1547,7 @@
       $handle = @fopen(ENANO_ROOT.'/config.new.php', 'w');
       if(!$handle)
       {
-        echo '<p>ERROR: Cannot open config.php for writing - exiting!</p>';
+        echo '<p>ERROR: Despite my repeated attempts to verify that the configuration file can be written, I was indeed prevented from opening it for writing. Maybe you\'re still on <del>crack</del> Windows?</p>';
         $template->footer();
         exit;
       }
@@ -1365,40 +1608,69 @@
           echo '<input type="hidden" name="'.htmlspecialchars($k[$i]).'" value="'.htmlspecialchars($_POST[$k[$i]]).'" />'."\n";
         }
       ?>
-      <p>Next, enter your desired username and password. The account you create here will be used to administer your site.</p>
+      <p><?php echo $lang->get('login_header_blurb'); ?></p>
       <table border="0">
-        <tr><td><b>Administration username</b><br /><small>The administration username you will use to log into your site.<br />This cannot be "anonymous" or in the form of an IP address.</small></td><td><input onkeyup="verify();" name="admin_user" type="text" size="30" /></td><td><img id="s_user" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
-        <tr><td>Administration password:</td><td><input onkeyup="verify();" name="admin_pass" type="password" size="30" /></td><td rowspan="2"><img id="s_password" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
-        <tr><td>Enter it again to confirm:</td><td><input onkeyup="verify();" name="admin_pass_confirm" type="password" size="30" /></td></tr>
-        <tr><td>Your e-mail address:</td><td><input onkeyup="verify();" name="admin_email" type="text" size="30" /></td><td><img id="s_email" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
+        <tr>
+          <td><b><?php echo $lang->get('login_field_username_title'); ?></b><br /><small><?php echo $lang->get('login_field_username_body'); ?></small></td>
+          <td><input onkeyup="verify();" name="admin_user" type="text" size="30" /></td>
+          <td><img id="s_user" alt="Good/bad icon" src="images/bad.gif" /></td>
+        </tr>
+        <tr>
+          <td><?php echo $lang->get('login_field_password_title'); ?></td>
+          <td><input onkeyup="verify();" name="admin_pass" type="password" size="30" /></td>
+          <td rowspan="2"><img id="s_password" alt="Good/bad icon" src="images/bad.gif" /></td>
+        </tr>
+        <tr>
+          <td><?php echo $lang->get('login_field_password_confirm'); ?></td>
+          <td><input onkeyup="verify();" name="admin_pass_confirm" type="password" size="30" /></td>
+        </tr>
+        <tr>
+          <td><?php echo $lang->get('login_field_email_title'); ?></td>
+          <td><input onkeyup="verify();" name="admin_email" type="text" size="30" /></td>
+          <td><img id="s_email" alt="Good/bad icon" src="images/bad.gif" /></td>
+        </tr>
         <tr>
           <td>
-            Allow administrators to embed PHP code into pages:<br />
-            <small><span style="color: #D84308">Do not under any circumstances enable this option without reading these
-                   <a href="install.php?mode=pophelp&amp;topic=admin_embed_php"
-                      onclick="window.open(this.href, 'pophelpwin', 'width=550,height=400,status=no,toolbars=no,toolbar=no,address=no,scroll=yes'); return false;"
-                      style="color: #D84308; text-decoration: underline;">important security implications</a>.
-            </span></small>
+            <?php echo $lang->get('login_field_allowphp_title'); ?><br />
+            <small>
+              <span style="color: #D84308">
+                <?php
+                  echo $lang->get('login_field_allowphp_body',
+                    array(
+                      'important_notes' => '<a href="install.php?mode=pophelp&amp;topic=admin_embed_php" onclick="window.open(this.href, \'pophelpwin\', \'width=550,height=400,status=no,toolbars=no,toolbar=no,address=no,scroll=yes\'); return false;" style="color: #D84308; text-decoration: underline;">' . $lang->get('login_field_allowphp_isi') . '</a>'
+                      )
+                    );
+                ?>
+              </span>
+            </small>
           </td>
           <td>
-            <label><input type="radio" name="admin_embed_php" value="2" checked="checked" /> Disabled</label>&nbsp;&nbsp;
-            <label><input type="radio" name="admin_embed_php" value="4" /> Enabled</label>
+            <label><input type="radio" name="admin_embed_php" value="2" checked="checked" /> <?php echo $lang->get('login_field_allowphp_disabled'); ?></label>&nbsp;&nbsp;
+            <label><input type="radio" name="admin_embed_php" value="4" /> <?php echo $lang->get('login_field_allowphp_enabled'); ?></label>
           </td>
           <td></td>
         </tr>
-        <tr><td colspan="3">If your browser supports Javascript, the password you enter here will be encrypted with AES before it is sent to the server.</td></tr>
+        <tr><td colspan="3"><?php echo $lang->get('login_aes_blurb'); ?></td></tr>
       </table>
       <div class="pagenav">
        <table border="0">
-       <tr>
-       <td><input type="submit" value="Continue" onclick="return cryptdata();" name="_cont" /></td><td><p><span style="font-weight: bold;">Before clicking continue:</span><br />&bull; Remember the username and password you enter here! You will not be able to administer your site without the information you enter on this page.</p></td>
-       </tr>
+         <tr>
+           <td>
+             <input type="submit" value="<?php echo $lang->get('meta_btn_continue'); ?>" onclick="return cryptdata();" name="_cont" />
+           </td>
+           <td>
+             <p>
+               <span style="font-weight: bold;"><?php echo $lang->get('meta_lbl_before_continue'); ?></span><br />
+               &bull; <?php echo $lang->get('login_objective_remember'); ?>
+             </p>
+           </td>
+         </tr>
        </table>
       </div>
       <div id="cryptdebug"></div>
-     <input type="hidden" name="use_crypt" value="no" />
-     <input type="hidden" name="crypt_key" value="<?php echo $cryptkey; ?>" />
-     <input type="hidden" name="crypt_data" value="" />
+      <input type="hidden" name="use_crypt" value="no" />
+      <input type="hidden" name="crypt_key" value="<?php echo $cryptkey; ?>" />
+      <input type="hidden" name="crypt_data" value="" />
     </form>
     <script type="text/javascript">
     // <![CDATA[
@@ -1488,23 +1760,31 @@
           echo '<input type="hidden" name="'.htmlspecialchars($k[$i]).'" value="'.htmlspecialchars($_POST[$k[$i]]).'" />'."\n";
         }
       ?>
-      <h3>Enano is ready to install.</h3>
-       <p>The wizard has finished collecting information and is ready to install the database schema. Please review the information below,
-          and then click the button below to install the database.</p>
+      <h3><?php echo $lang->get('confirm_header_blurb_title'); ?></h3>
+       <p><?php echo $lang->get('confirm_header_blurb_body'); ?></p>
       <ul>
-        <li>Database hostname: <?php echo $_POST['db_host']; ?></li>
-        <li>Database name: <?php echo $_POST['db_name']; ?></li>
-        <li>Database user: <?php echo $_POST['db_user']; ?></li>
-        <li>Database password: &lt;hidden&gt;</li>
-        <li>Site name: <?php echo $_POST['sitename']; ?></li>
-        <li>Site description: <?php echo $_POST['sitedesc']; ?></li>
-        <li>Administration username: <?php echo $_POST['admin_user']; ?></li>
-        <li>Cipher strength: <?php echo (string)AES_BITS; ?>-bit AES<br /><small>Cipher strength is defined in the file constants.php; if you desire to change the cipher strength, you may do so and then restart installation. Unless your site is mission-critical, changing the cipher strength is not necessary.</small></li>
+        <li><?php echo $lang->get('confirm_lbl_db_host'); ?> <?php echo $_POST['db_host']; ?></li>
+        <li><?php echo $lang->get('confirm_lbl_db_name'); ?> <?php echo $_POST['db_name']; ?></li>
+        <li><?php echo $lang->get('confirm_lbl_db_user'); ?> <?php echo $_POST['db_user']; ?></li>
+        <li><?php echo $lang->get('confirm_lbl_db_pass'); ?></li>
+        <li><?php echo $lang->get('confirm_lbl_sitename'); ?> <?php echo $_POST['sitename']; ?></li>
+        <li><?php echo $lang->get('confirm_lbl_sitedesc'); ?> <?php echo $_POST['sitedesc']; ?></li>
+        <li><?php echo $lang->get('confirm_lbl_adminuser'); ?> <?php echo $_POST['admin_user']; ?></li>
+        <li><?php echo $lang->get('confirm_lbl_aesbits'); ?> <?php echo $lang->get('confirm_lbl_aes_strength', array( 'aes_bits' => AES_BITS )); ?><br /><small><?php echo $lang->get('confirm_lbl_aes_change'); ?></small></li>
       </ul>
       <div class="pagenav">
         <table border="0">
           <tr>
-            <td><input type="submit" value="Install Enano!" name="_cont" /></td><td><p><span style="font-weight: bold;">Before clicking continue:</span><br />&bull; Pray.</p></td>
+            <td>
+              <input type="submit" value="<?php echo $lang->get('confirm_btn_install_enano'); ?>" name="_cont" />
+            </td>
+            <td>
+              <p>
+                <span style="font-weight: bold;"><?php echo $lang->get('meta_lbl_before_continue'); ?></span><br />
+                <!-- Like this even needs to be localized. :-P -->
+                &bull; <?php echo $lang->get('confirm_objective_pray'); ?>
+              </p>
+            </td>
           </tr>
         </table>
       </div>
@@ -1525,7 +1805,7 @@
        !isset($_POST['urlscheme'])
        )
     {
-      echo 'The installer has detected that one or more required form values is not set. Please <a href="install.php?mode=sysreqs">restart the installation</a>.';
+      echo 'The installer has detected that one or more required form values is not set. Please <a href="install.php?mode=license">restart the installation</a>.';
       $template->footer();
       exit;
     }
@@ -1546,7 +1826,7 @@
     
     // $stages = array('connect', 'decrypt', 'genkey', 'parse', 'sql', 'writeconfig', 'renameconfig', 'startapi', 'initlogs');
     
-    if ( !preg_match('/^[a-z0-9_]*$/', $_POST['table_prefix']) )
+    if ( !preg_match('/^[a-z0-9_-]*$/', $_POST['table_prefix']) )
       err('Hacking attempt was detected in table_prefix.');
     
       start_install_table();
@@ -1557,17 +1837,17 @@
       
         // The stages connect, decrypt, genkey, and parse are preprocessing and don't do any actual data modification.
         // Thus, they need to be run on each retry, e.g. never skipped.
-        run_installer_stage('connect', 'Connect to MySQL', 'stg_mysql_connect', 'MySQL denied our attempt to connect to the database. This is most likely because your login information was incorrect. You will most likely need to <a href="install.php?mode=license">restart the installation</a>.', false);
+        run_installer_stage('connect', $lang->get('install_stg_connect_title'), 'stg_mysql_connect', $lang->get('install_stg_connect_body'), false);
         if ( isset($_POST['drop_tables']) )
         {
           // Are we supposed to drop any existing tables? If so, do it now
-          run_installer_stage('drop', 'Drop existing Enano tables', 'stg_drop_tables', 'This step never returns failure');
+          run_installer_stage('drop', $lang->get('install_stg_drop_title'), 'stg_drop_tables', 'This step never returns failure');
         }
-        run_installer_stage('decrypt', 'Decrypt administration password', 'stg_decrypt_admin_pass', 'The administration password you entered couldn\'t be decrypted. It is possible that your server did not properly store the encryption key in the configuration file. Please check the file permissions on config.new.php. You may have to return to the login stage of the installation, clear your browser cache, and then rerun this installation.', false);
-        run_installer_stage('genkey', 'Generate ' . AES_BITS . '-bit AES private key', 'stg_generate_aes_key', 'Enano encountered an internal error while generating the site encryption key. Please contact the Enano team for support.', false);
-        run_installer_stage('parse', 'Prepare to execute schema file', 'stg_parse_schema', 'Enano encountered an internal error while parsing the SQL file that contains the database structure and initial data. Please contact the Enano team for support.', false);
-        run_installer_stage('sql', 'Execute installer schema', 'stg_install', 'The installation failed because an SQL query wasn\'t quite correct. It is possible that you entered malformed data into a form field, or there may be a bug in Enano with your version of MySQL. Please contact the Enano team for support.', false);
-        run_installer_stage('writeconfig', 'Write configuration files', 'stg_write_config', 'Enano was unable to write the configuration file with your site\'s database credentials. This is almost always because your configuration file does not have the correct permissions. On Windows servers, you may see this message even if the check on the System Requirements page passed. Temporarily running IIS as the Administrator user may help.');
+        run_installer_stage('decrypt', $lang->get('install_stg_decrypt_title'), 'stg_decrypt_admin_pass', $lang->get('install_stg_decrypt_body'), false);
+        run_installer_stage('genkey', $lang->get('install_stg_genkey_title', array( 'aes_bits' => AES_BITS )), 'stg_generate_aes_key', $lang->get('install_stg_genkey_body'), false);
+        run_installer_stage('parse', $lang->get('install_stg_parse_title'), 'stg_parse_schema', $lang->get('install_stg_parse_body'), false);
+        run_installer_stage('sql', $lang->get('install_stg_sql_title'), 'stg_install', $lang->get('install_stg_sql_body'), false);
+        run_installer_stage('writeconfig', $lang->get('install_stg_writeconfig_title'), 'stg_write_config', $lang->get('install_stg_writeconfig_body'));
         
         // Mainstream installation complete - Enano should be usable now
         // The stage of starting the API is special because it has to be called out of function context.
@@ -1582,11 +1862,11 @@
         
         if ( is_object($db) && is_object($session) )
         {
-          run_installer_stage('startapi', 'Start the Enano API', 'stg_start_api_success', '...', false);
+          run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_start_api_success', '...', false);
         }
         else
         {
-          run_installer_stage('startapi', 'Start the Enano API', 'stg_start_api_failure', 'The Enano API could not be started. This is an error that should never occur; please contact the Enano team for support.', false);
+          run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_start_api_failure', $lang->get('install_stg_startapi_body'), false);
         }
         
         // We need to be logged in (with admin rights) before logs can be flushed
@@ -1597,10 +1877,8 @@
         $session->start();
         $paths->init();
         
-        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> after renaming your configuration files, 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
-                             to finish the installation, please be aware that you may be unable to log into your site.');
+        run_installer_stage('importlang', $lang->get('install_stg_importlang_title'), 'stg_import_language', $lang->get('install_stg_importlang_body'));
+        run_installer_stage('initlogs', $lang->get('install_stg_initlogs_title'), 'stg_init_logs', $lang->get('install_stg_initlogs_body'));
         
         /*
          * HACKERS:
@@ -1621,33 +1899,23 @@
       // In early revisions of 1.0.2, this step was performed prior to the initialization of the Enano API. It was decided to move
       // this stage to the end because it will fail more often than any other stage, thus making alternate routes imperative. If this
       // stage fails, then no big deal, we'll just have the user rename the files manually and then let them see the pretty success message.
-      run_installer_stage('renameconfig', 'Rename configuration files', 'stg_rename_config', 'Enano couldn\'t rename the configuration files to their correct production names. Please CHMOD the folder where your Enano files are to 777 and click the retry button below, <b><u>or</u></b> perform the following rename operations and then <a href="install.php?mode=finish">finish the installation</a>.<ul><li>Rename config.new.php to config.php</li><li>Rename .htaccess.new to .htaccess (only if you selected Tiny URLs)</li></ul>');
+      run_installer_stage('renameconfig', $lang->get('install_stg_rename_title'), 'stg_rename_config', $lang->get('install_stg_rename_body'));
       
       close_install_table();
       
       unset($template);
       $template =& $template_bak;
     
-      echo '<h3>Installation of Enano is complete.</h3><p>Review any warnings above, and then <a href="install.php?mode=finish">click here to finish the installation</a>.';
+      echo '<h3>' . $lang->get('install_msg_complete_title') . '</h3>';
+      echo '<p>' . $lang->get('install_msg_complete_body', array('finish_link' => 'install.php?mode=finish')) . '</p>';
       
       // echo '<script type="text/javascript">window.location="'.scriptPath.'/install.php?mode=finish";</script>';
       
     break;
   case "finish":
-    echo '<h3>Congratulations!</h3>
-           <p>You have finished installing Enano on this server.</p>
-          <h3>Now what?</h3>
-           <p>Click the link below to see the main page for your website. Where to go from here:</p>
-           <ul>
-             <li>The first thing you should do is log into your site using the Log in link on the sidebar.</li>
-             <li>Go into the Administration panel, expand General, and click General Configuration. There you will be able to configure some basic information about your site.</li>
-             <li>Visit the <a href="http://enanocms.org/Category:Plugins" onclick="window.open(this.href); return false;">Enano Plugin Gallery</a> to download and use plugins on your site.</li>
-             <li>Periodically create a backup of your database and filesystem, in case something goes wrong. This should be done at least once a week &ndash; more for wiki-based sites.</li>
-             <li>Hire some moderators, to help you keep rowdy users tame.</li>
-             <li>Tell the <a href="http://enanocms.org/Contact_us">Enano team</a> what you think.</li>
-             <li><b>Spread the word about Enano by adding a link to the Enano homepage on your sidebar!</b> You can enable this option in the General Configuration section of the administration panel.</li>
-           </ul>
-           <p><a href="index.php">Go to your website...</a></p>';
+    echo '<h3>' . $lang->get('finish_msg_congratulations') . '</h3>
+           ' . $lang->get('finish_body') . '
+           <p>' . $lang->get('finish_link_mainpage', array('mainpage_link' => 'index.php')) . '</p>';
     break;
 }
 $template->footer();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/language/english/enano.json	Sun Nov 18 20:37:08 2007 -0500
@@ -0,0 +1,573 @@
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.1.1
+ * Copyright (C) 2006-2007 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+
+// This is the main language file for Enano. Feel free to use it as a base for your own translations.
+// All text in this file before the first left curly brace and all text after the last curly brace will
+// be trimmed. So you can use a limited amount of Javascript in this so that the language can be imported
+// via Javascript as well.
+
+var enano_lang = {
+  categories: [
+    'adm', 'meta', 'user', 'page', 'comment', 'onpage', 'etc', 'editor', 'history', 'catedit', 'tags', 'delvote', 'ajax', 'sidebar', 'acl',
+    'perm',
+  ],
+  strings: {
+    meta: {
+      adm: 'Administration panel nav menu',
+      meta: 'Language category strings',
+      user: 'Login, logout, and authentication',
+      page: 'Page creation and control',
+      comment: 'Comment display',
+      onpage: 'On-page buttons and controls',
+      etc: 'Miscellaneous strings',
+      editor: 'Page editor interface',
+      history: 'Page history and log viewer',
+      catedit: 'Categorization box and editor',
+      tags: 'Page tagging interface',
+      delvote: 'Page deletion vote interface',
+      ajax: 'On-page AJAX applets',
+      sidebar: 'Default sidebar blocks and buttons',
+      acl: 'Access control list editor',
+      perm: 'Page actions (for ACLs)',
+      plural: 's',
+      enano_about_poweredby: '<p>This website is powered by <a href="http://enanocms.org/">Enano</a>, the lightweight and open source CMS that everyone can use. Enano is copyright &copy; 2006-2007 Dan Fuhry. For legal information, along with a list of libraries that Enano uses, please see <a href="http://enanocms.org/Legal_information">Legal Information</a>.</p><p>The developers and maintainers of Enano strongly believe that software should not only be free to use, but free to be modified, distributed, and used to create derivative works. For more information about Free Software, check out the <a href="http://en.wikipedia.org/wiki/Free_Software" onclick="window.open(this.href); return false;">Wikipedia page</a> or the <a href="http://www.fsf.org/" onclick="window.open(this.href); return false;">Free Software Foundation\'s</a> homepage.</p>',
+      enano_about_gpl: '<p>This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p><p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.</p><p>You should have received <a href="%gpl_link%">a copy of the GNU General Public License</a> along with this program; if not, write to:</p><p style="margin-left 2em;">Free Software Foundation, Inc.,<br />51 Franklin Street, Fifth Floor<br />Boston, MA 02110-1301, USA</p><p>Alternatively, you can <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">read it online</a>.</p>',
+      enano_about_lbl_enanoversion: '<a href="http://enanocms.org">Enano</a> version:',
+      enano_about_lbl_webserver: 'Web server:',
+      enano_about_lbl_serverplatform: 'Server platform:',
+      enano_about_lbl_phpversion: '<a href="http://www.php.net/">PHP</a> version:',
+      enano_about_lbl_mysqlversion: '<a href="http://www.mysql.com/">MySQL</a> version:',
+    },
+    user: {
+      login_message_short: 'Please enter your username and password to log in.',
+      login_message_short_elev: 'Please re-enter your login details',
+      login_body: 'Logging in enables you to use your preferences and access member information. If you don\'t have a username and password here, you can <a href="%reg_link%">create an account</a>.',
+      login_body_elev: 'You are requesting that a sensitive operation be performed. To continue, please re-enter your password to confirm your identity.',
+      login_field_username: 'Username',
+      login_field_password: 'Password',
+      login_forgotpass_blurb: 'Forgot your password? <a href="%forgotpass_link%">No problem.</a>',
+      login_createaccount_blurb: 'Maybe you need to <a href="%reg_link%">create an account</a>.',
+      login_field_captcha: 'Code in image',
+      login_nocrypt_title: 'Important note regarding cryptography:',
+      login_nocrypt_body: 'Some countries do not allow the import or use of cryptographic technology. If you live in one of the countries listed below, you should <a href="%nocrypt_link%">log in without using encryption</a>.',
+      login_nocrypt_countrylist: 'This restriction applies to the following countries: Belarus, China, India, Israel, Kazakhstan, Mongolia, Pakistan, Russia, Saudi Arabia, Singapore, Tunisia, Venezuela, and Vietnam.',
+      login_usecrypt_title: 'Encryption is currently turned off.',
+      login_usecrypt_body: 'If you are not in one of the countries listed below, you should <a href="%usecrypt_link%">enable encryption</a> to secure the logon process.',
+      login_usecrypt_countrylist: 'The cryptography restriction applies to the following countries: Belarus, China, India, Israel, Kazakhstan, Mongolia, Pakistan, Russia, Saudi Arabia, Singapore, Tunisia, Venezuela, and Vietnam.',
+      login_success_title: 'Login successful',
+      login_success_body: 'You have successfully logged into the %config.site_name% site as "%username%". Redirecting to %redir_target%...',
+      login_success_body_mainpage: 'the main page',
+      
+      login_ajax_fetching_key: 'Fetching an encryption key...',
+      login_ajax_prompt_title: 'Please enter your username and password to continue.',
+      login_ajax_prompt_title_elev: 'You are requesting a sensitive operation.',
+      login_ajax_prompt_body_elev: 'Please re-enter your login details, to verify your identity.',
+      login_ajax_link_fullform: 'Trouble logging in? Try the <a href="%link_full_form%">full login form</a>.',
+      login_ajax_link_forgotpass: 'Did you <a href="%forgotpass_link%">forget your password</a>?',
+      login_ajax_loggingin: 'Logging in...',
+      
+      err_key_not_found: 'Enano couldn\'t look up the encryption key used to encrypt your password. This most often happens if a cache rotation occurred during your login attempt, or if you refreshed the login page.',
+      err_key_wrong_length: 'The encryption key was the wrong length.',
+      err_too_big_for_britches: 'You are trying to authenticate at a level that your user account does not permit.',
+      err_invalid_credentials: 'You have entered an invalid username or password. Please enter your login details again.',
+      err_invalid_credentials_lockout: ' You have used up %fails% out of %config.lockout_threshold% login attempts. After you have used up all %config.lockout_threshold% login attempts, you will be locked out from logging in for %config.lockout_duration% minutes.',
+      err_invalid_credentials_lockout_captcha: ' You have used up %lockout_fails% out of %config.lockout_threshold% login attempts. After you have used up all %config.lockout_threshold% login attempts, you will have to enter a visual confirmation code while logging in, effective for %config.lockout_duration% minutes.',
+      err_backend_fail: 'You entered the right credentials and everything was validated, but for some reason Enano couldn\'t register your session. This is an internal problem with the site and you are encouraged to contact site administration.',
+      err_locked_out: 'You have used up all %config.lockout_threshold% allowed login attempts. Please wait %time_rem% minute%plural% before attempting to log in again%captcha_blurb%.',
+      err_locked_out_captcha_blurb: ', or enter the visual confirmation code shown above in the appropriate box',
+      
+      logout_success_title: 'Logged out',
+      logout_success_body: 'You have been successfully logged out, and all cookies have been cleared. You will now be transferred to the main page.',
+      logout_confirm_title: 'Are you sure you want to log out?',
+      logout_confirm_body: 'If you log out, you will no longer be able to access your user preferences, your private messages, or certain areas of this site until you log in again.',
+      logout_confirm_title_elev: 'Are you sure you want to de-authenticate?',
+      logout_confirm_body_elev: 'If you de-authenticate, you will no longer be able to use the administration panel until you re-authenticate again. You may do so at any time using the Administration button on the sidebar.',
+      logout_err_title: 'An error occurred during the logout process.',
+      // Unused at this point
+      logout_err_not_loggedin: 'You don\'t seem to be logged in.',
+      
+      keepalive_info_title: 'About the keep-alive feature',
+      keepalive_info_body: 'Keep-alive is a new Enano feature that keeps your administrative session from timing out while you are using the administration panel. This feature can be useful if you are editing a large page or doing something in the administration interface that will take longer than 15 minutes.<br /><br />For security reasons, Enano mandates that high-privilege logins last only 15 minutes, with the time being reset each time a page is loaded (or, more specifically, each time the session API is started). The consequence of this is that if you are performing an action in the administration panel that takes more than 15 minutes, your session may be terminated. The keep-alive feature attempts to relieve this by sending a "ping" to the server every 10 minutes.<br /><br />Please note that keep-alive state is determined by a cookie. Thus, if you log out and then back in as a different administrator, keep-alive will use the same setting that was used when you were logged in as the first administrative user. In the same way, if you log into the administration panel under your account from another computer, keep-alive will be set to "off".<br /><br /><b>For more information:</b><br /><a href="http://docs.enanocms.org/Help:Appendix_B" onclick="window.open(this.href); return false;">Overview of Enano\'s security model</a>',
+      
+      type_guest: 'Guest',
+      type_member: 'Member',
+      type_mod: 'Moderator',
+      type_admin: 'Administrator',
+      
+      msg_elev_timed_out: '<b>Your administrative session has timed out.</b> <a href="%login_link%">Log in again</a>',
+      
+      reg_err_captcha: 'The confirmation code you entered was incorrect.',
+      reg_err_disabled_title: 'Registration disabled',
+      reg_err_disabled_body: 'The administrator has disabled the registration of new accounts on this site.',
+      reg_err_disabled_body_adminblurb: 'Oops...it seems that you <em>are</em> the administrator...hehe...you can also <a href="%reg_link%">force account registration to work</a>.',
+      reg_err_username_invalid: 'Your username must be at least two characters in length and may not contain any of the following characters: &lt; &gt; _ &amp; ? \' " % / \\.',
+      // Not exactly an error
+      reg_err_password_good: 'The password you entered is valid.',
+      reg_err_alert_password_tooshort: 'Your password must be 6 characters or greater in length.',
+      reg_err_alert_password_nomatch: 'The passwords you entered do not match.',
+      reg_err_missing_key: 'Couldn\'t look up public encryption key',
+      
+      reg_msg_greatercontrol: 'A user account enables you to have greater control over your browsing experience.',
+      reg_msg_table_title: 'Create a user account',
+      reg_msg_table_subtitle: 'Please tell us a little bit about yourself.',
+      reg_msg_username_checking: 'Checking availability...',
+      reg_msg_username_available: 'This username is available.',
+      reg_msg_username_unavailable: 'This username is already taken.',
+      reg_msg_password_length: 'Your password must be at least six characters in length.',
+      reg_msg_password_score: 'It needs to score at least <b>%config.pw_strength_minimum%</b> for your registration to be accepted.',
+      reg_msg_password_needmatch: 'The passwords you entered do not match.',
+      reg_msg_email_activuser: 'An e-mail with an account activation key will be sent to this address, so please ensure that it is correct.',
+      reg_msg_realname_optional: 'Giving your real name is totally optional. If you choose to provide your real name, it will be used to provide attribution for any edits or contributions you may make to this site.',
+      reg_msg_captcha_pleaseenter: 'Please enter the code shown in the image to the right into the text box. This process helps to ensure that this registration is not being performed by an automated bot. If the image to the right is illegible, you can <a %regen_flags%>generate a new image</a>.',
+      reg_msg_captcha_blind: 'If you are visually impaired or otherwise cannot read the text shown to the right, please contact the site management and they will create an account for you.',
+      reg_msg_success_title: 'Registration successful',
+      reg_msg_success_body: 'Thank you for registering, your user account has been created.',
+      reg_msg_success_activ_none: 'You may now <a href="%login_link%">log in</a> with the username and password that you created.',
+      reg_msg_success_activ_user: 'Because this site requires account activation, you have been sent an e-mail with further instructions. Please follow the instructions in that e-mail to continue your registration.',
+      reg_msg_success_activ_admin: 'Because this site requires administrative account activation, you cannot use your account at the moment. A notice has been sent to the site administration team that will alert them that your account has been created.',
+      reg_msg_success_activ_coppa: 'However, in compliance with the Childrens\' Online Privacy Protection Act, you must have your parent or legal guardian activate your account. Please ask them to check their e-mail for further information.',
+      
+      reg_lbl_field_username: 'Preferred username:',
+      reg_lbl_field_password: 'Password:',
+      reg_lbl_field_password_confirm: 'Enter your password again to confirm.',
+      reg_lbl_field_email: 'E-mail address:',
+      reg_lbl_field_email_coppa: 'Your parent or guardian\'s e-mail address:',
+      reg_lbl_field_realname: 'Real name:',
+      reg_lbl_field_captcha: 'Visual confirmation',
+      reg_lbl_field_captcha_code: 'Code:',
+      
+      reg_coppa_title: 'Before you can register, please tell us your age.',
+      reg_coppa_link_atleast13: 'I was born <b>on or before</b> %yo13_date% and am <b>at least</b> 13 years of age',
+      reg_coppa_link_not13: 'I was born <b>after</b> %yo13_date% and am <b>less than</b> 13 years of age',
+    },
+    onpage: {
+      lbl_pagetools: 'Page tools',
+      lbl_page_article: 'article',
+      lbl_page_admin: 'administration page',
+      lbl_page_system: 'system message',
+      lbl_page_file: 'uploaded file',
+      lbl_page_help: 'documentation page',
+      lbl_page_user: 'user page',
+      lbl_page_special: 'special page',
+      lbl_page_template: 'template',
+      lbl_page_project: 'project page',
+      lbl_page_category: 'category',
+      
+      btn_discussion: 'discussion (%num_comments%)',
+      btn_discussion_unapp: 'discussion (%num_comments% total, %num_unapp% unapp.)',
+      btn_edit: 'edit this page',
+      btn_viewsource: 'view source',
+      btn_history: 'history',
+      btn_moreoptions: 'more options',
+      
+      btn_rename: 'rename',
+      btn_printable: 'view printable version',
+      btn_votedelete: 'vote to delete this page',
+      btn_votedelete_reset: 'reset deletion votes',
+      lbl_wikimode: 'page wiki mode:',
+      btn_wikimode_on: 'on',
+      btn_wikimode_off: 'off',
+      btn_wikimode_global: 'global',
+      lbl_protect: 'protection:',
+      btn_protect_on: 'on',
+      btn_protect_off: 'off',
+      btn_protect_semi: 'semi',
+      btn_clearlogs: 'clear page logs',
+      btn_deletepage: 'delete this page',
+      btn_deletepage_votes: ' (<b>%num_votes%</b> vote%plural%)',
+      lbl_password: 'page password:',
+      btn_password_set: 'set',
+      btn_acl: 'manage page access',
+      btn_admin: 'administrative options',
+      
+      tip_article: 'View the page contents, all of the page contents, and nothing but the page contents (alt-a)',
+      tip_comments: 'View the comments that other users have posted about this page (alt-c)',
+      tip_edit: 'Edit the contents of this page (alt-e)',
+      tip_viewsource: 'View the source code (wiki markup) that this page uses (alt-e)',
+      tip_history: 'View a log of actions taken on this page (alt-h)',
+      tip_rename: 'Change the display name of this page (alt-r)',
+      tip_delvote: 'Vote to have this page deleted (alt-d)',
+      tip_resetvotes: 'Clear the list of votes for deletion against this page (alt-y)',
+      tip_printable: 'View a version of this page that is suitable for printing',
+      tip_protect_on: 'Prevents all non-administrators from editing this page. [alt-i]',
+      tip_protect_off: 'Allows everyone to edit this page. [alt-o]',
+      tip_protect_semi: 'Allows only users who have been registered for 4 days to edit this page. [alt-p]',
+      tip_flushlogs: 'Remove all edit and action logs for this page from the database. IRREVERSIBLE! (alt-l)',
+      tip_password: 'Require a password in order for this page to be viewed',
+      tip_aclmanager: 'Manage who can do what with this page (alt-m)',
+      
+    },
+    comment: {
+      lbl_subject: 'Subject',
+      lbl_mod_options: 'Moderator options:',
+      heading: 'Article comments',
+      btn_send_privmsg: 'Send private message',
+      btn_add_buddy: 'Add to buddy list',
+      btn_edit: 'edit',
+      btn_delete: 'delete',
+      btn_mod_approve: 'Approve',
+      btn_mod_unapprove: 'Unapprove',
+      btn_mod_delete: 'Delete',
+      btn_save: 'save',
+      
+      msg_comment_posted: 'Your comment has been posted. If it does not appear right away, it is probably awaiting approval.',
+      
+      msg_count_zero: 'There are <span id="comment_count_inner">no</span> comments on this %page_type%.',
+      msg_count_one: 'There is <span id="comment_count_inner">1</span> comment on this %page_type%.',
+      msg_count_plural: 'There are <span id="comment_count_inner">%num_comments%</span> comments on this %page_type%.',
+      
+      msg_count_unapp_mod: '<span id="comment_count_unapp_inner">%num_unapp%</span> of those are unapproved.',
+      msg_count_unapp_one: 'However, there is <span id="comment_count_unapp_inner">1</span> additional comment awaiting approval.',
+      msg_count_unapp_plural: 'However, there are <span id="comment_count_unapp_inner">%num_unapp%</span> additional comments awaiting approval.',
+      
+      msg_note_unapp: '(Unapproved)',
+      
+      msg_delete_confirm: 'Do you really want to delete this comment?',
+      
+      postform_title: 'Got something to say?',
+      postform_blurb: 'If you have comments or suggestions on this article, you can shout it out here.',
+      postform_blurb_unapp: 'Before your post will be visible to the public, a moderator will have to approve it.',
+      postform_blurb_captcha: 'Because you are not logged in, you will need to enter a visual confirmation before your comment will be posted.',
+      postform_blurb_link: 'Leave a comment...',
+      postform_field_name: 'Your name/screen name:',
+      postform_field_subject: 'Comment subject:',
+      postform_field_comment: 'Comment:',
+      postform_field_captcha_title: 'Visual confirmation:',
+      postform_field_captcha_blurb: 'Please enter the confirmation code seen in the image on the right into the box. If you cannot read the code, please click on the image to generate a new one. This helps to prevent automated bot posting.',
+      postform_field_captcha_label: 'Confirmation code:',
+      postform_field_captcha_cantread_js: 'If you can\'t read the code, click on the image to generate a new one.',
+      postform_field_captcha_cantread_nojs: 'If you can\'t read the code, please refresh this page to generate a new one.',
+      postform_btn_submit: 'Submit comment',
+      
+      on_friend_list: 'On your friend list',
+      on_foe_list: 'On your foe list',
+    },
+    adm: {
+      cat_general: 'General',
+      cat_content: 'Content',
+      cat_appearance: 'Appearance',
+      cat_users: 'Users',
+      cat_security: 'Security',
+      cat_plugins: 'Plugin configuration',
+      
+      page_general_config: 'General configuration',
+      page_file_uploads: 'File uploads',
+      page_file_types: 'Allowed file types',
+      page_plugins: 'Manage plugins',
+      page_db_backup: 'Backup database',
+      
+      page_manager: 'Manage pages',
+      page_editor: 'Edit page content',
+      page_pg_groups: 'Manage page groups',
+      
+      page_themes: 'Manage themes',
+      
+      page_users: 'Manage users',
+      page_user_groups: 'Edit user groups',
+      page_coppa: 'COPPA support',
+      page_mass_email: 'Mass e-mail',
+      
+      page_security_log: 'Security log',
+      page_ban_control: 'Ban control',
+      
+      btn_home: 'Administration panel home',
+      btn_logout: 'Log out of admin panel',
+      btn_keepalive_off: 'Turn on keep-alive',
+      btn_keepalive_on: 'Turn off keep-alive',
+      btn_keepalive_about: 'About keep-alive',
+      btn_keepalive_loading: 'Loading keep-alive button...',
+      
+      err_not_auth_title: 'Error: Not authenticated',
+      err_not_auth_body: 'It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="%login_link%">re-authenticate</a> to continue.',
+    },
+    editor: {
+      msg_revert_confirm: 'Do you really want to revert your changes?',
+      msg_discard_confirm: 'Do you really want to discard your changes?',
+      msg_unload: 'If you do, any changes that you have made to this page will be lost.',
+      btn_graphical: 'graphical editor',
+      btn_wikitext: 'wikitext editor',
+      lbl_edit_summary: 'Edit summary:',
+      lbl_minor_edit: 'This is a minor edit',
+      btn_save: 'Save changes',
+      btn_preview: 'Show preview',
+      btn_revert: 'Revert changes',
+      btn_cancel: 'Cancel and return to page',
+      btn_closeviewer: 'Close viewer',
+      preview_blurb: '<b>Reminder:</b> This is only a preview - your changes to this page have not yet been saved.',
+    },
+    history: {
+      summary_clearlogs: 'Automatic backup created when logs were purged',
+      page_subtitle: 'History of edits and actions',
+      heading_edits: 'Edits:',
+      heading_other: 'Other changes:',
+      no_entries: 'No history entries in this category.',
+      btn_compare: 'Compare selected revisions',
+      col_diff: 'Diff',
+      col_datetime: 'Date/time',
+      col_user: 'User',
+      col_summary: 'Edit summary',
+      col_minor: 'Minor',
+      col_actions: 'Actions',
+      col_action_taken: 'Action taken',
+      col_extra: 'Extra info',
+      extra_reason: 'Reason:',
+      extra_oldtitle: 'Old title:',
+      tip_rdns: 'Click cell background for reverse DNS info',
+      action_view: 'View',
+      action_contrib: 'User contribs',
+      action_restore: 'Restore',
+      action_revert: 'Revert action',
+      log_protect: 'Protected page',
+      log_unprotect: 'Unprotected page',
+      log_semiprotect: 'Semi-protected page',
+      log_rename: 'Renamed page',
+      log_create: 'Created page',
+      log_delete: 'Deleted page',
+      log_uploadnew: 'Uploaded new file version',
+      lbl_comparingrevisions: 'Comparing revisions:',
+    },
+    page: {
+      protect_lbl_success_title: 'Page protected',
+      protect_lbl_success_body: 'The protection setting has been applied. <a href="%page_link%">Return to the page</a>.',
+      protect_err_need_reason: 'Error: you must enter a reason for protecting this page.',
+      protect_lbl_reason: 'Reason for protecting the page:',
+      protect_lbl_level: 'Protecion level to be applied:',
+      protect_lbl_level_none: 'No protection',
+      protect_lbl_level_semi: 'Semi-protection',
+      protect_lbl_level_full: 'Full protection',
+      protect_btn_submit: 'Protect page',
+      
+      rename_err_need_name: 'Error: you must enter a new name for this page.',
+      rename_lbl: 'Please enter a new name for this page:',
+      rename_btn_submit: 'Rename page',
+      
+      flushlogs_warning_stern: '<h3>You are about to <span style="color: red;">destroy</span> all logged edits and actions on this page.</h3><p>Unlike deleting or editing this page, this action is <u>not reversible</u>! You should only do this if you are desparate for database space.</p><p>Do you really want to continue?</p>',
+      flushlogs_btn_submit: 'Flush logs',
+      
+      delvote_warning_stern: '<h3>Your vote counts.</h3><p>If you think that this page is not relavent to the content on this site, or if it looks like this page was only created in an attempt to spam the site, you can request that this page be deleted by an administrator.</p><p>After you vote, you should leave a comment explaining the reason for your vote, especially if you are the first person to vote against this page.</p>',
+      
+      delvote_count_zero: 'So far, no one has voted for the deletion of this page.',
+      delvote_count_one: 'So far, one person has voted to delete this page.',
+      delvote_count_plural: 'So far, %delvotes% people have voted to delete this page.',
+      delvote_btn_submit: 'Vote to delete this page',
+      delvote_reset_btn_submit: 'Reset votes',
+      
+      delete_warning_stern: '<h3>You are about to <span style="color: red;">destroy</span> this page.</h3><p>While the deletion of the page itself is completely reversible, it is impossible to recover any comments or category information on this page. If this is a file page, the file along with all older revisions of it will be permanently deleted. Also, any custom information that this page is tagged with, such as a custom name, protection status, or additional settings such as whether to allow comments, will be permanently lost.</p><p>Are you <u>absolutely sure</u> that you want to continue?<br />You will not be asked again.</p>',
+      delete_btn_submit: 'Delete this page',
+      delete_lbl_reason: 'Reason for deleting:',
+      
+      wikimode_success_redirect: 'Wiki mode for this page has been set. Redirecting you to the page...',
+      wikimode_level_on: 'Wiki features will be enabled.',
+      wikimode_level_off: 'Wiki features will be disabled.',
+      wikimode_level_global: 'Wiki features will be synchronized to the global setting.',
+      wikimode_heading: 'You are changing wiki mode for this page.',
+      wikimode_warning: 'If you want to continue, please click the button below.',
+      wikimode_blurb_disable: 'Because this will disable the wiki behavior on this page, several features, most notably the ability for users to vote to have this page deleted, will be disabled as they are not relevant to non-wiki pages. In addition, users will not be able to edit this page unless an ACL rule specifically permits them.',
+      wikimode_blurb_enable: 'Because this will enable the wiki behavior on this page, users will gain the ability to freely edit this page unless an ACL rule specifically denies them. If your site is public and gets good traffic, you should be aware of the possiblity of vandalism, and you need to be ready to revert malicious edits to this page.',
+      wikimode_btn_submit: 'Set wiki mode',
+      
+      detag_err_page_exists: 'The detag action is only valid for pages that have been deleted in the past.',
+      detag_success_title: 'Page detagged',
+      detag_success_body: 'All stale tags have been removed from this page.',
+    },
+    catedit: {
+      title: 'Select which categories this page should be included in.',
+      no_categories: 'There are no categories on this site yet.',
+      catbox_lbl_categories: 'Categories:',
+      catbox_lbl_uncategorized: '(Uncategorized)',
+      catbox_link_edit: 'edit categorization',
+      catbox_link_showcategorization: 'show page categorization',
+    },
+    tags: {
+      catbox_link: 'show page tags',
+      lbl_page_tags: 'Page tags:',
+      lbl_no_tags: 'No tags on this page',
+      btn_add_tag: '(add a tag)',
+      lbl_add_tag: 'Add a tag:',
+      btn_add: '+ Add',
+    },
+    delvote: {
+      lbl_votes_one: 'There is one user that thinks this page should be deleted.',
+      lbl_votes_plural: 'There are %num_users% users that think this page should be deleted.',
+      lbl_users_that_voted: 'Users that voted:',
+      btn_deletepage: 'Delete page',
+      btn_resetvotes: 'Reset votes',
+    },
+    ajax: {
+      // Client-side messages
+      protect_prompt_reason: 'Reason for (un)protecting:',
+      rename_prompt: 'What title should this page be renamed to?\nNote: This does not and will never change the URL of this page, that must be done from the admin panel.',
+      delete_prompt_reason: 'Please enter your reason for deleting this page.',
+      delete_confirm: 'You are about to REVERSIBLY delete this page. Do you REALLY want to do this?\n\n(Comments and categorization data, as well as any attached files, will be permanently lost)',
+      delvote_confirm: 'Are you sure that you want to vote that this page be deleted?',
+      delvote_reset_confirm: 'This action will reset the number of votes against this page to zero. Do you really want to do this?',
+      clearlogs_confirm: 'You are about to DESTROY all log entries for this page. As opposed to (example) deleting this page, this action is completely IRREVERSIBLE and should not be used except in dire circumstances. Do you REALLY want to do this?',
+      clearlogs_confirm_nag: 'You\'re ABSOLUTELY sure???',
+      changestyle_select: '[Select]',
+      changestyle_title: 'Change your theme',
+      changestyle_pleaseselect_theme: 'Please select a theme from the list.',
+      changestyle_lbl_theme: 'Theme:',
+      changestyle_lbl_style: 'Style:',
+      changestyle_success: 'Your theme preference has been changed.\nWould you like to reload the page now to see the changes?',
+      killphp_confirm: 'Are you really sure you want to do this? Some pages might not function if this emergency-only feature is activated.',
+      killphp_success: 'Embedded PHP in pages has been disabled.',
+      lbl_moreoptions_nojs: 'More options for this page',
+      
+      // Server-side responses
+      rename_too_short: 'The name you entered is too short. Please enter a longer name for this page.',
+      rename_success: 'The page "%page_name_old%" has been renamed to "%page_name_new%". You are encouraged to leave a comment explaining your action.\n\nYou will see the change take effect the next time you reload this page.',
+      clearlogs_success: 'The logs for this page have been cleared. A backup of this page has been added to the logs table so that this page can be restored in case of vandalism or spam later.',
+      delete_need_reason: 'Invalid reason for deletion passed. Please enter a reason for deleting this page.',
+      delete_success: 'This page has been deleted. Note that there is still a log of edits and actions in the database, and anyone with admin rights can raise this page from the dead unless the log is cleared. If the deleted file is an image, there may still be cached thumbnails of it in the cache/ directory, which is inaccessible to users.',
+      delvote_success: 'Your vote to have this page deleted has been cast.\nYou are encouraged to leave a comment explaining the reason for your vote.',
+      delvote_already_voted: 'It appears that you have already voted to have this page deleted.',
+      delvote_reset_success: 'The number of votes for having this page deleted has been reset to zero.',
+      password_success: 'The password for this page has been set.',
+      password_disable_success: 'The password for this page has been disabled.',
+      
+    },
+    sidebar: {
+      title_navigation: 'Navigation',
+      title_tools: 'Tools',
+      title_search: 'Search',
+      title_links: 'Links',
+      
+      btn_home: 'Home',
+      btn_createpage: 'Create a page',
+      btn_uploadfile: 'Upload file',
+      btn_specialpages: 'Special pages',
+      btn_administration: 'Administration',
+      btn_editsidebar: 'Edit the sidebar',
+      btn_search_go: 'Go',
+      
+      btn_userpage: 'User page',
+      btn_mycontribs: 'My contributions',
+      btn_preferences: 'Preferences',
+      btn_privatemessages: 'Private messages',
+      btn_groupcp: 'Group control panel',
+      btn_register: 'Create an account',
+      btn_login: 'Log in',
+      btn_logout: 'Log out',
+      btn_changestyle: 'Change theme',
+    },
+    acl: {
+      err_access_denied: 'You are not authorized to view or edit access control lists.',
+      err_missing_template: 'It seems that (a) the file acledit.tpl is missing from this theme, and (b) the JSON response is working.',
+      err_user_not_found: 'The username you entered was not found.',
+      err_bad_group_id: 'The group ID you submitted is not valid.',
+      err_demo: 'Editing access control lists is disabled in the administration demo.',
+      err_zero_list: 'Supplied rule list has a length of zero',
+      err_pleaseselect_targettype: 'Please select a target type.',
+      err_pleaseselect_username: 'Please enter a username.',
+      
+      radio_usergroup: 'A usergroup',
+      radio_user: 'A specific user',
+      radio_scope_thispage: 'Only this page',
+      radio_scope_wholesite: 'The entire website',
+      radio_scope_pagegroup: 'A group of pages',
+      
+      lbl_scope: 'What should this access rule control?',
+      lbl_welcome_title: 'Manage page access',
+      lbl_welcome_body: 'Please select who should be affected by this access rule.',
+      lbl_editwin_title_create: 'Create access rule',
+      lbl_editwin_title_edit: 'Editing permissions',
+      lbl_editwin_body: 'This panel allows you to edit what the %target_type% "<b>%target%</b>" can do on <b>%scope_type%</b>. Unless you set a permission to "Deny", these permissions may be overridden by other rules.',
+      lbl_deleterule: 'Delete this rule',
+      lbl_save_success_title: 'Permissions updated',
+      lbl_save_success_body: 'The permissions for %target_name% on this page have been updated successfully. If you changed permissions that affect your user account, you may not see changes until you reload the page.',
+      lbl_delete_success_title: 'Rule deleted',
+      lbl_delete_success_body: 'The access rules for %target_name% on this page have been deleted.',
+      lbl_field_deny: 'Deny',
+      lbl_field_disallow: 'Disallow',
+      lbl_field_wikimode: 'Wiki mode',
+      lbl_field_allow: 'Allow',
+      lbl_help: '<p><b>Permission types:</b></p><ul><li><b>Allow</b> means that the user is allowed to access the item</li><li><b>Wiki mode</b> means the user can access the item if wiki mode is active (per-page wiki mode is taken into account)</li><li><b>Disallow</b> means the user is denied access unless something allows it.</li><li><b>Deny</b> means that the user is denied access to the item. This setting overrides all other permissions.</li></ul>',
+      
+      scope_type_wholesite: 'this entire site',
+      scope_type_thispage: 'this page',
+      scope_type_pagegroup: 'this group of pages',
+      
+      target_type_user: 'user',
+      target_type_group: 'group',
+      
+      msg_guest_howto: 'To edit permissions for guests, select "a specific user", and enter Anonymous as the username.',
+      msg_deleterule_confirm: 'Do you really want to delete this rule?',
+      msg_closeacl_confirm: 'Do you really want to close the ACL manager?',
+      
+      btn_success_dismiss: 'dismiss',
+      btn_success_close: 'close manager',
+      btn_deleterule: 'Delete rule',
+      btn_createrule: 'Create rule',
+      btn_returnto_editor: 'Return to ACL editor',
+      btn_returnto_userscope: 'Return to user/scope selection',
+    },
+    perm: {
+      read: 'Read page(s)',
+      post_comments: 'Post comments',
+      edit_comments: 'Edit own comments',
+      edit_page: 'Edit page',
+      view_source: 'View source',
+      mod_comments: 'Moderate comments',
+      history_view: 'View history/diffs',
+      history_rollback: 'Rollback history',
+      history_rollback_extra: 'Undelete page(s)',
+      protect: 'Protect page(s)',
+      rename: 'Rename page(s)',
+      clear_logs: 'Clear page logs (dangerous)',
+      vote_delete: 'Vote to delete',
+      vote_reset: 'Reset delete votes',
+      delete_page: 'Delete page(s)',
+      tag_create: 'Tag page(s)',
+      tag_delete_own: 'Remove own page tags',
+      tag_delete_other: 'Remove others\' page tags',
+      set_wiki_mode: 'Set per-page wiki mode',
+      password_set: 'Set password',
+      password_reset: 'Disable/reset password',
+      mod_misc: 'Super moderator (generate SQL backtraces, view IP addresses, and send large numbers of private messages)',
+      edit_cat: 'Edit categorization',
+      even_when_protected: 'Allow editing, renaming, and categorization even when protected',
+      upload_files: 'Upload files',
+      upload_new_version: 'Upload new versions of files',
+      create_page: 'Create pages',
+      php_in_pages: 'Embed PHP code in pages',
+      edit_acl: 'Edit access control lists',
+    },
+    etc: {
+      redirect_title: 'Redirecting...',
+      redirect_body: 'Please wait while you are redirected.',
+      redirect_timeout: 'If you are not redirected within %timeout% seconds, please <a href="%redirect_url%">click here</a>.',
+      // Generic "Save Changes" button
+      save_changes: 'Save changes',
+      // Generic "Cancel changes" button
+      cancel_changes: 'Cancel changes',
+      // Generic wizard buttons
+      wizard_next: 'Next >',
+      wizard_back: '< Back',
+      wizard_previous: '< Previous',
+      // Generic "Notice:" label
+      lbl_notice: 'Notice:',
+      // Generic "Access denied"
+      access_denied: 'Access to the specified file, resource, or action is denied.',
+      access_denied_short: 'Access denied',
+      return_to_page: 'Return to the page',
+      invalid_request_short: 'Invalid request',
+      // Message box buttons
+      ok: 'OK',
+      cancel: 'Cancel',
+      yes: 'Yes',
+      no: 'No'
+    }
+  }
+};
+
+// All done! :-)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/language/english/install.json	Sun Nov 18 20:37:08 2007 -0500
@@ -0,0 +1,259 @@
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.1.1
+ * Copyright (C) 2006-2007 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+
+// Enano installer strings
+// Language: ISO-639-3 eng (English)
+
+var enano_lang_install = {
+  categories: [
+    'meta', 'welcome', 'license', 'sysreqs', 'database', 'website', 'login', 'confirm', 'install', 'finish', 'pophelp',
+  ],
+  strings: {
+    meta: {
+      site_name: 'Enano installation',
+      site_desc: 'Install Enano on your server.',
+      enano_copyright: 'Enano and its various components, related documentation, and artwork are copyright &copy; 2006 Dan Fuhry.<br />This program is Free Software; see the file "GPL" included with this package for details.',
+      sidebar_heading: 'Installation progress',
+      btn_article: 'installation page',
+      btn_continue: 'Continue',
+      lbl_before_continue: 'Before continuing:',
+      
+      msg_err_verification: 'One or more of the form fields is incorrect. Please correct any information in the form that has an "X" next to it.',
+      
+      msg_err_stagefailed_title: 'Enano installation failed.',
+      msg_err_stagefailed_body: 'When you have corrected the error, click the button below to attempt to continue the installation.',
+      msg_err_stagefailed_mysqlerror: 'The error returned from MySQL was:',
+      btn_retry_installation: 'Retry installation',
+    },
+    welcome: {
+      modetitle: 'Welcome',
+      heading: 'Welcome to Enano',
+      version: 'version',
+      branch_stable: 'stable',
+      branch_unstable: 'unstable',
+      aka: 'also affectionately known as "%codename%" <tt>:)</tt>',
+      btn_start: 'Start installation',
+    },
+    license: {
+      modetitle: 'License agreement',
+      heading: 'Welcome to the Enano installer.',
+      blurb_thankyou: 'Thank you for choosing Enano as your CMS. You\'ve selected the finest in design, the strongest in security, and the latest in Web 2.0 toys. Trust us, you\'ll like it.',
+      blurb_pleaseread: 'To get started, please read and accept the following license agreement. You\'ve probably seen it before.',
+      info_unstable_title: 'Notice for prerelease versions',
+      info_unstable_body: 'This version of Enano is designed only for testing and evaluation purposes. <b>It is not yet completely stable, and should not be used on production websites.</b> As with any Enano version, Dan Fuhry and the Enano team cannot be responsible for any damage, physical or otherwise, to any property as a result of the use of Enano. While security is a number one priority, sometimes things slip through.',
+      section_gpl_heading: 'Lawyer-readable version',
+      btn_i_agree: 'I agree to the license terms',
+      objective_ensure_agree: 'Ensure that you agree with the terms of the license',
+      objective_have_db_info: 'Have your database host, name, username, and password available',
+      gpl_blurb_inenglish: 'You may view a copy of the GNU General Public License in English in the file GPL-EN included with this package.',
+    },
+    sysreqs: {
+      modetitle: 'Server requirements',
+      heading: 'Checking your server',
+      blurb: 'Enano has several requirements that must be met before it can be installed. If all is good then note any warnings and click Continue below.',
+      req_php: 'PHP Version >=4.3.0',
+      req_mysql: 'MySQL extension for PHP',
+      req_uploads: 'File upload support',
+      req_apache: 'Apache HTTP Server',
+      req_config: 'Configuration file writable',
+      req_magick: 'ImageMagick support',
+      req_cachewriteable: 'Cache directory writable',
+      req_fileswriteable: 'File uploads directory writable',
+      
+      req_desc_php: 'It seems that the version of PHP that your server is running is too old to support Enano properly. If this is your server, please upgrade to the most recent version of PHP, remembering to use the --with-mysql configure option if you compile it yourself. If this is not your server, please contact your webhost and ask them if it would be possible to upgrade PHP. If this is not possible, you will need to switch to a different webhost in order to use Enano.',
+      req_desc_mysql: 'It seems that your PHP installation does not have the MySQL extension enabled. If this is your own server, you may need to just enable the "libmysql.so" extension in php.ini. If you do not have the MySQL extension installed, you will need to either use your distribution\'s package manager to install it, or you will have to compile PHP from source. If you compile PHP from source, please remember to use the "--with-mysql" configure option, and you will have to have the MySQL development files installed (they usually are). If this is not your server, please contact your hosting company and ask them to install the PHP MySQL extension.',
+      req_desc_uploads: 'It seems that your server does not support uploading files. Enano *requires* this functionality in order to work properly. Please ask your server administrator to set the "file_uploads" option in php.ini to "On".',
+      req_desc_apache: 'Apparently your server is running a web server other than Apache. Enano will work nontheless, but there are some known bugs with non-Apache servers, and the "fancy" URLs will not work properly. The "Standard URLs" option will be set on the website configuration page, only change it if you are absolutely certain that your server is running Apache.',
+      req_desc_config: 'It looks like the configuration file, config.new.php, is not writable. Enano needs to be able to write to this file in order to install.<br /><br /><b>If you are installing Enano on a SourceForge web site:</b><br />SourceForge mounts the web partitions read-only now, so you will need to use the project shell service to symlink config.php to a file in the /tmp/persistent directory.',
+      req_desc_magick: 'Enano uses ImageMagick to scale images into thumbnails. Because ImageMagick was not found on your server, Enano will use the width= and height= attributes on the &lt;img&gt; tag to scale images. This can cause somewhat of a performance increase, but bandwidth usage will be higher, especially if you use high-resolution images on your site.<br /><br />If you are sure that you have ImageMagick, you can set the location of the "convert" program using the administration panel after installation is complete.',
+      req_desc_cachewriteable: 'Apparently the cache/ directory is not writable. Enano will still work, but you will not be able to cache thumbnails, meaning the server will need to re-render them each time they are requested. In some cases, this can cause a significant slowdown.',
+      req_desc_fileswriteable: 'It seems that the directory where uploaded files are stored (%enano_root%/files) cannot be written by the server. Enano will still function, but file uploads will not function, and will be disabled by default.',
+      
+      summary_success_title: 'Your server meets all the requirements for running Enano.',
+      summary_success_body: 'Click the button below to continue the installation.',
+      
+      summary_warn_title: 'Some of the features of Enano have been turned off to accommodate your server.',
+      summary_warn_body: 'Enano has detected that some of the features or configuration settings on your server are not optimal for the best behavior and/or performance for Enano. As a result, Enano has disabled these features as a precaution to prevent errors and potential security issues.',
+      
+      summary_fail_title: 'Your server does not meet the requirements for Enano to run.',
+      summary_fail_body: 'As a precaution, Enano will not install until the above requirements have been met. Contact your server administrator or hosting company and convince them to upgrade. Good luck.',
+      
+      objective_scalebacks: 'Review the list above to ensure that you are satisfied with any of Enano\'s workarounds for your server. If you need a particular feature and that feature is listed as disabled above, you should take the opportunity now to correct the problem.'
+    },
+    database: {
+      modetitle: 'Database information',
+      heading_optionalinfo: 'Optional information',
+      
+      msg_err_mysql_connect: '<b>Error:</b> The database server "%db_host%" couldn\'t be contacted.<br />%mysql_error%',
+      msg_err_mysql_auth: '<b>Error:</b> Access to MySQL under the specified credentials was denied.<br />%mysql_error%',
+      msg_err_mysql_dbperm: '<b>Error:</b> Access to the specified database using those login credentials was denied.<br />%mysql_error%',
+      msg_err_mysql_dbexist: '<b>Error:</b> The specified database does not exist<br />%mysql_error%',
+      msg_err_mysql_version: '<b>Error:</b> Your version of MySQL (%mysql_version%) is older than 4.1.17. Enano will still work, but there is a known bug with the comment system and MySQL 4.1.11 that involves some comments not being displayed, due to an issue with the PHP function mysql_fetch_row().',
+      
+      msg_warn_creating_db: '<b>Warning:</b> The database you specified does not exist. It will be created during installation.',
+      msg_warn_creating_user: '<b>Warning:</b> The specified regular user does not exist or the password is incorrect. The user will be created during installation. If the user already exists, the password will be reset.',
+      msg_warn_mysql_version: 'The MySQL version that your server is running could not be determined.',
+      
+      msg_info_mysql_good: 'Your version of MySQL meets Enano requirements.',
+      
+      blurb_needdb: 'Now we need some information that will allow Enano to contact your database server. Enano uses MySQL as a data storage backend, and we need to have access to a MySQL server in order to continue.',
+      blurb_howtomysql: 'If you do not have access to a MySQL server, and you are using your own server, you can download MySQL for free from <a href="http://www.mysql.com/">MySQL.com</a>. <b>Please note that, like Enano, MySQL is licensed under the GNU GPL.</b> If you need to modify MySQL and then distribute your modifications, you must either distribute them under the terms of the GPL or purchase a proprietary license.',
+      
+      vm_login_info: '<b>MySQL login information for this virtual appliance:</b><br /><br />Database hostname: %host%<br />Database login: username "%user%", password: "%pass%" (without quotes)<br />Database name: %name%',
+      
+      table_title: 'Database information',
+      
+      field_hostname_title: 'Database hostname',
+      field_hostname_body: 'This is the hostname (or sometimes the IP address) of your MySQL server. In many cases, this is "localhost".',
+      field_dbname_title: 'Database name',
+      field_dbname_body: 'The name of the actual database. If you don\'t already have a database, you can create one here, if you have the username and password of a MySQL user with administrative rights.',
+      field_dbauth_title: 'Database login',
+      field_dbauth_body: 'These fields should be the username and password of a user with "select", "insert", "update", "delete", "create table", and "replace" privileges for your database.',
+      field_tableprefix_title: 'Table prefix',
+      field_tableprefix_body: 'The value that you enter here will be added to the beginning of the name of each Enano table. You may use lowercase letters (a-z), numbers (0-9), and underscores (_).',
+      field_rootauth_title: 'Database administrative login',
+      field_rootauth_body: 'If the MySQL database or username that you entered above does not exist yet, you can create them here, assuming that you have the login information for an administrative user (such as root). Leave these fields blank unless you need to use them.',
+      field_mysqlversion_title: 'MySQL version',
+      field_mysqlversion_blurb_willbechecked: 'MySQL version information will be checked when you click "Test Connection".',
+      field_droptables_title: 'Delete existing tables?',
+      field_droptables_body: 'If this option is checked, all the tables that will be used by Enano will be dropped (deleted) before the schema is executed. Do NOT use this option unless specifically instructed to.',
+      field_droptables_lbl: 'Drop existing tables',
+      
+      btn_testconnection: 'Test connection',
+      
+      objective_test: 'Check your MySQL connection using the "Test Connection" button.',
+      objective_uncrypt: 'Be aware that your database information will be transmitted unencrypted several times.',
+    },
+    website: {
+      modetitle: 'Website configuration',
+      header_blurb: 'The next step is to enter some information about your website. You can always change this information later, using the administration panel.',
+      
+      field_name_title: 'Website name',
+      field_name_body: 'The display name of your website. Allowed characters are uppercase and lowercase letters, numerals, and spaces. This must not be blank or "Enano".',
+      field_desc_title: 'Website description',
+      field_desc_body: 'This text will be shown below the name of your website.',
+      field_copyright_title: 'Copyright info',
+      field_copyright_body: 'This should be a one-line legal notice that will appear at the bottom of all your pages.',
+      field_wikimode_title: 'Wiki mode',
+      field_wikimode_body: 'This feature allows people to create and edit pages on your site. Enano keeps a history of all page modifications, and you can protect pages to prevent editing.',
+      field_wikimode_checkbox: 'Yes, make my website a wiki.',
+      field_urlscheme_title: 'URL scheme',
+      field_urlscheme_body: 'Choose how the page URLs will look. Depending on your server configuration, you may need to select the first option. If you don\'t know, select the first option, and you can always change it later.',
+      field_urlscheme_ugly: 'Standard URLs - compatible with any web server (www.example.com/index.php?title=Page_name)',
+      field_urlscheme_short: 'Short URLs - requires Apache with a PHP module (www.example.com/index.php/Page_name)',
+      field_urlscheme_tiny: 'Tiny URLs - requires Apache on Linux/Unix/BSD with PHP module and mod_rewrite enabled (www.example.com/Page_name)',
+      
+      objective_verify: 'Verify that your site information is correct. Again, all of the above settings can be changed from the administration panel.',
+    },
+    login: {
+      modetitle: 'Administration login',
+      header_blurb: 'Next, enter your desired username and password. The account you create here will be used to administer your site.',
+      
+      field_username_title: 'Administration username',
+      field_username_body: 'The administration username you will use to log into your site.<br />This cannot be "anonymous" or in the form of an IP address.',
+      field_password_title: 'Administration password:',
+      field_password_confirm: 'Enter it again to confirm:',
+      field_email_title: 'Your e-mail address:',
+      field_allowphp_title: 'Allow administrators to embed PHP code into pages:',
+      field_allowphp_body: 'Do not under any circumstances enable this option without reading these %important_notes%.',
+      field_allowphp_isi: 'important security implications',
+      field_allowphp_disabled: 'Disabled',
+      field_allowphp_enabled: 'Enabled',
+      
+      aes_blurb: 'If your browser supports Javascript, the password you enter here will be encrypted with AES before it is sent to the server.',
+      
+      objective_remember: 'Remember the username and password you enter here! You will not be able to administer your site without the information you enter on this page.',
+    },
+    confirm: {
+      modetitle: 'Confirm installation',
+      
+      header_blurb_title: 'Enano is ready to install.',
+      header_blurb_body: 'The wizard has finished collecting information and is ready to install the database schema. Please review the information below, and then click the button below to install the database.',
+      
+      lbl_db_host: 'Database hostname:',
+      lbl_db_name: 'Database name:',
+      lbl_db_user: 'Database user:',
+      lbl_db_pass: 'Database password: &lt;hidden&gt;',
+      lbl_sitename: 'Site name:',
+      lbl_sitedesc: 'Site description:',
+      lbl_adminuser: 'Administration username:',
+      lbl_aesbits: 'Cipher strength:',
+      lbl_aes_strength: '%aes_bits%-bit AES',
+      lbl_aes_change: 'Cipher strength is defined in the file constants.php; if you desire to change the cipher strength, you may do so and then restart installation. Unless your site is mission-critical, changing the cipher strength is not necessary.',
+      
+      objective_pray: 'Pray.',
+      btn_install_enano: 'Install Enano!',
+    },
+    install: {
+      modetitle: 'Database installation',
+      
+      stg_connect_title: 'Connect to MySQL',
+      stg_connect_body: 'MySQL denied our attempt to connect to the database. This is most likely because your login information was incorrect. You will most likely need to <a href="install.php?mode=license">restart the installation</a>.',
+      stg_drop_title: 'Drop existing Enano tables',
+      stg_decrypt_title: 'Decrypt administration password',
+      stg_decrypt_body: 'The administration password you entered couldn\'t be decrypted. It is possible that your server did not properly store the encryption key in the configuration file. Please check the file permissions on config.new.php. You may have to return to the login stage of the installation, clear your browser cache, and then rerun this installation.',
+      stg_genkey_title: 'Generate %aes_bits%-bit AES private key',
+      stg_genkey_body: 'Enano encountered an internal error while generating the site encryption key. Please contact the Enano team for support.',
+      stg_parse_title: 'Prepare to execute schema file',
+      stg_parse_body: 'Enano encountered an internal error while parsing the SQL file that contains the database structure and initial data. Please contact the Enano team for support.',
+      stg_sql_title: 'Execute installer schema',
+      stg_sql_body: 'The installation failed because an SQL query wasn\'t quite correct. It is possible that you entered malformed data into a form field, or there may be a bug in Enano with your version of MySQL. Please contact the Enano team for support.',
+      stg_writeconfig_title: 'Write configuration files',
+      stg_writeconfig_body: 'Enano was unable to write the configuration file with your site\'s database credentials. This is almost always because your configuration file does not have the correct permissions. On Windows servers, you may see this message even if the check on the System Requirements page passed. Temporarily running IIS as the Administrator user may help.',
+      stg_rename_title: 'Rename configuration files',
+      stg_rename_body: 'Enano couldn\'t rename the configuration files to their correct production names. On some UNIX systems, you need to CHMOD the directory with your Enano files to 777 in order for this stage to succeed.',
+      stg_startapi_title: 'Start the Enano API',
+      stg_startapi_body: 'The Enano API could not be started. This is an error that should never occur; please contact the Enano team for support.',
+      stg_importlang_title: 'Import default language',
+      stg_importlang_body: 'Enano couldn\'t import the English language file.',
+      stg_initlogs_title: 'Initialize logs',
+      stg_initlogs_body: '<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
+                           to finish the installation, please be aware that you may be unable to log into your site.',
+      msg_complete_title: 'Installation of Enano is complete.',
+      msg_complete_body: 'Review any warnings above, and then <a href="%finish_link%">click here to finish the installation</a>.',
+    },
+    finish: {
+      modetitle: 'Installation complete',
+      msg_congratulations: 'Congratulations!',
+      body: '<p>You have finished installing Enano on this server.</p>
+            <h3>Now what?</h3>
+             <p>Click the link below to see the main page for your website. Where to go from here:</p>
+             <ul>
+               <li>The first thing you should do is log into your site using the Log in link on the sidebar.</li>
+               <li>Go into the Administration panel, expand General, and click General Configuration. There you will be able to configure some basic information about your site.</li>
+               <li>Visit the <a href="http://enanocms.org/Category:Plugins" onclick="window.open(this.href); return false;">Enano Plugin Gallery</a> to download and use plugins on your site.</li>
+               <li>Periodically create a backup of your database and filesystem, in case something goes wrong. This should be done at least once a week &ndash; more for wiki-based sites.</li>
+               <li>Hire some moderators, to help you keep rowdy users tame.</li>
+               <li>Tell the <a href="http://enanocms.org/Contact_us">Enano team</a> what you think.</li>
+               <li><b>Spread the word about Enano by adding a link to the Enano homepage on your sidebar!</b> You can enable this option in the General Configuration section of the administration panel.</li>
+             </ul>',
+      link_mainpage: '<a href="%mainpage_link%">Go to your website...</a>',
+    },
+    pophelp: {
+      admin_embed_php_title: 'Allow administrators to embed PHP',
+      admin_embed_php_body: '<p>This option allows you to control whether anything between the standard &lt;?php and ?&gt; tags will be treated as
+                                PHP code by Enano. If this option is enabled, and members of the Administrators group use these tags, Enano will
+                                execute that code when the page is loaded. There are obvious potential security implications here, which should
+                                be carefully considered before enabling this option.</p>
+                             <p>If you are the only administrator of this site, or if you have a high level of trust for those will be administering
+                                the site with you, you should enable this to allow extreme customization of pages.</p>
+                             <p>Leave this option off if you are at all concerned about security – if your account is compromised and PHP embedding
+                                is enabled, an attacker can run arbitrary code on your server! Enabling this will also allow administrators to
+                                embed Javascript and arbitrary HTML and CSS.</p>
+                             <p>If you don\'t have experience coding in PHP, you can safely disable this option. You may change this at any time
+                                using the ACL editor by selecting the Administrators group and This Entire Website under the scope selection.</p>',
+      btn_close_window: 'Close window',
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/language/english/install/license-deed.html	Sun Nov 18 20:37:08 2007 -0500
@@ -0,0 +1,25 @@
+<h2>GNU General Public License</h2>
+
+<h3>Declaration of license usage</h3>
+
+<p>Enano is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>
+<p>This program is distributed in the hope that it will be useful, but <u>without any warranty</u>; without even the implied warranty of <u>merchantability</u> or <u>fitness for a particular purpose</u>. See the GNU General Public License (below) for more details.</p>
+<p><b>By clicking the button below or otherwise continuing the installation, you indicate your acceptance of this license agreement.</b></p>
+
+<h3>Human-readable version</h3>
+<p>Enano is distributed under certain licensing terms that we believe make it of the greatest possible use to the public. The license we distribute it under, the GNU General Public License, provides certain terms and conditions that, rather than limit your use of Enano, allow you to get the most out of it. If you would like to read the full text, it can be found below. Here is a human-readable version that we think is a little easier to understand.</p>
+<ul>
+  <li>You may to run Enano for any purpose.</li>
+  <li>You may study how Enano works and adapt it to your needs.</li>
+  <li>You may redistribute copies so you can help your neighbor.</li>
+  <li>You may improve Enano and release your improvements to the public, so that the whole community benefits.</li>
+</ul>
+<p>You may exercise the freedoms specified here provided that you comply with the express conditions of this license. The principal conditions are:</p>
+<ul>
+  <li>You must conspicuously and appropriately publish on each copy distributed an appropriate copyright notice and disclaimer of warranty and keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of Enano a copy of the GNU General Public License along with Enano. Any translation of the GNU General Public License must be accompanied by the GNU General Public License.</li>
+  <li>If you modify your copy or copies of Enano or any portion of it, or develop a program based upon it, you may distribute the resulting work provided you do so under the GNU General Public License. Any translation of the GNU General Public License must be accompanied by the GNU General Public License.</li>
+  <li>If you copy or distribute Enano, you must accompany it with the complete corresponding machine-readable source code or with a written offer, valid for at least three years, to furnish the complete corresponding machine-readable source code.</li>
+</ul>
+<p>
+  <b>Disclaimer</b>: The above text is not a license. It is simply a handy reference for understanding the Legal Code (the full license) &ndash; it is a human-readable expression of some of its key terms. Think of it as the user-friendly interface to the Legal Code beneath. The above text itself has no legal value, and its contents do not appear in the actual license.<br /><span style="color: #CCC">Text copied from the <a href="http://creativecommons.org/licenses/GPL/2.0/">Creative Commons GPL Deed page</a></span>
+</p>
--- a/plugins/PrivateMessages.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/plugins/PrivateMessages.php	Sun Nov 18 20:37:08 2007 -0500
@@ -35,12 +35,18 @@
 function page_Special_PrivateMessages()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
-  if(!$session->user_logged_in) die_friendly('Access denied', '<p>You need to <a href="'.makeUrlNS('Special', 'Login/'.$paths->page).'">log in</a> to view your private messages.</p>');
+  if ( !$session->user_logged_in )
+  {
+    die_friendly('Access denied', '<p>You need to <a href="'.makeUrlNS('Special', 'Login/'.$paths->page).'">log in</a> to view your private messages.</p>');
+  }
   $argv = Array();
   $argv[] = $paths->getParam(0);
   $argv[] = $paths->getParam(1);
   $argv[] = $paths->getParam(2);
-  if(!$argv[0]) $argv[0] = 'InVaLiD';
+  if ( !$argv[0] )
+  {
+    $argv[0] = 'InVaLiD';
+  }
   switch($argv[0])
   {
     default:
@@ -48,17 +54,29 @@
       break;
     case 'View':
       $id = $argv[1];
-      if(!preg_match('#^([0-9]+)$#', $id)) die_friendly('Message error', '<p>Invalid message ID</p>');
+      if ( !preg_match('#^([0-9]+)$#', $id) )
+      {
+        die_friendly('Message error', '<p>Invalid message ID</p>');
+      }
       $q = $db->sql_query('SELECT p.message_from, p.message_to, p.subject, p.message_text, p.date, p.folder_name, u.signature FROM '.table_prefix.'privmsgs AS p LEFT JOIN '.table_prefix.'users AS u ON (p.message_from=u.username) WHERE message_id='.$id.'');
-      if(!$q) $db->_die('The message data could not be selected.');
+      if ( !$q )
+      {
+        $db->_die('The message data could not be selected.');
+      }
       $r = $db->fetchrow();
       $db->free_result();
-      if( ($r['message_to'] != $session->username && $r['message_from'] != $session->username ) || $r['folder_name']=='drafts' ) die_friendly('Access denied', '<p>You are not authorized to view this message.</p>');
-      if($r['message_to'] == $session->username)
+      if ( ($r['message_to'] != $session->username && $r['message_from'] != $session->username ) || $r['folder_name']=='drafts' )
+      {
+        die_friendly('Access denied', '<p>You are not authorized to view this message.</p>');
+      }
+      if ( $r['message_to'] == $session->username )
       {
         $q = $db->sql_query('UPDATE '.table_prefix.'privmsgs SET message_read=1 WHERE message_id='.$id.'');
         $db->free_result();
-        if(!$q) $db->_die('Could not mark message as read');
+        if ( !$q )
+        {
+          $db->_die('Could not mark message as read');
+        }
       }
       $template->header();
       userprefs_show_menu();
@@ -69,7 +87,7 @@
           <tr><td class="row1">Subject:</td><td class="row1"><?php echo $r['subject']; ?></td></tr>
           <tr><td class="row2">Date:</td><td class="row2"><?php echo date('M j, Y G:i', $r['date']); ?></td></tr>
           <tr><td class="row1">Message:</td><td class="row1"><?php echo RenderMan::render($r['message_text']);
-          if($r['signature'] != '')
+          if ( $r['signature'] != '' )
           {
             echo '<hr style="margin-left: 1em; width: 200px;" />';
             echo RenderMan::render($r['signature']);
@@ -82,33 +100,60 @@
       break;
     case 'Move':
       $id = $argv[1];
-      if(!preg_match('#^([0-9]+)$#', $id)) die_friendly('Message error', '<p>Invalid message ID</p>');
+      if ( !preg_match('#^([0-9]+)$#', $id) )
+      {
+        die_friendly('Message error', '<p>Invalid message ID</p>');
+      }
       $q = $db->sql_query('SELECT message_to FROM '.table_prefix.'privmsgs WHERE message_id='.$id.'');
-      if(!$q) $db->_die('The message data could not be selected.');
+      if ( !$q )
+      {
+        $db->_die('The message data could not be selected.');
+      }
       $r = $db->fetchrow();
       $db->free_result();
-      if($r['message_to'] != $session->username) die_friendly('Access denied', '<p>You are not authorized to alter this message.</p>');
+      if ( $r['message_to'] != $session->username )
+      {
+        die_friendly('Access denied', '<p>You are not authorized to alter this message.</p>');
+      }
       $fname = $argv[2];
-      if(!$fname || ( $fname != 'Inbox' && $fname != 'Outbox' && $fname != 'Sent' && $fname != 'Drafts' && $fname != 'Archive' ) ) die_friendly('Invalid request', '<p>The folder name "'.$fname.'" is invalid.</p>');
+      if ( !$fname || ( $fname != 'Inbox' && $fname != 'Outbox' && $fname != 'Sent' && $fname != 'Drafts' && $fname != 'Archive' ) )
+      {
+        die_friendly('Invalid request', '<p>The folder name "'.$fname.'" is invalid.</p>');
+      }
       $q = $db->sql_query('UPDATE '.table_prefix.'privmsgs SET folder_name=\''.strtolower($fname).'\' WHERE message_id='.$id.';');
       $db->free_result();
-      if(!$q) $db->_die('The message was not successfully moved.');
+      if ( !$q )
+      {
+        $db->_die('The message was not successfully moved.');
+      }
       die_friendly('Message status', '<p>Your message has been moved to the folder "'.$fname.'".</p><p><a href="'.makeUrlNS('Special', 'PrivateMessages/Folder/Inbox').'">Return to inbox</a></p>');
       break;
     case 'Delete':
       $id = $argv[1];
-      if(!preg_match('#^([0-9]+)$#', $id)) die_friendly('Message error', '<p>Invalid message ID</p>');
+      if ( !preg_match('#^([0-9]+)$#', $id) )
+      {
+        die_friendly('Message error', '<p>Invalid message ID</p>');
+      }
       $q = $db->sql_query('SELECT message_to FROM '.table_prefix.'privmsgs WHERE message_id='.$id.'');
-      if(!$q) $db->_die('The message data could not be selected.');
+      if ( !$q )
+      {
+        $db->_die('The message data could not be selected.');
+      }
       $r = $db->fetchrow();
-      if($r['message_to'] != $session->username) die_friendly('Access denied', '<p>You are not authorized to delete this message.</p>');
+      if ( $r['message_to'] != $session->username )
+      {
+        die_friendly('Access denied', '<p>You are not authorized to delete this message.</p>');
+      }
       $q = $db->sql_query('DELETE FROM '.table_prefix.'privmsgs WHERE message_id='.$id.';');
-      if(!$q) $db->_die('The message was not successfully deleted.');
+      if ( !$q )
+      {
+        $db->_die('The message was not successfully deleted.');
+      }
       $db->free_result();
       die_friendly('Message status', '<p>The message has been deleted.</p><p><a href="'.makeUrlNS('Special', 'PrivateMessages/Folder/Inbox').'">Return to inbox</a></p>');
       break;
     case 'Compose':
-      if($argv[1]=='Send' && isset($_POST['_send']))
+      if ( $argv[1]=='Send' && isset($_POST['_send']) )
       {
         // Check each POST DATA parameter...
         if(!isset($_POST['to']) || ( isset($_POST['to']) && $_POST['to'] == '')) die_friendly('Sending of message failed', '<p>Please enter the username to which you want to send your message.</p>');
@@ -191,10 +236,26 @@
         ?>
         <br />
         <div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">
-          <tr><th colspan="2">Compose new private message</th></tr>
-          <tr><td class="row1">To:<br /><small>Separate multiple names with a single comma; you<br />can send this message to up to <b><?php echo (string)MAX_PMS_PER_BATCH; ?></b> users.</small></td><td class="row1"><?php echo $template->username_field('to', (isset($_POST['_savedraft'])) ? $_POST['to'] : $to ); ?></td></tr>
-          <tr><td class="row2">Subject:</td><td class="row2"><input name="subject" type="text" size="30" value="<?php if(isset($_POST['_savedraft'])) echo $_POST['subject']; else echo $subj; ?>" /></td></tr>
-          <tr><td class="row1">Message:</td><td class="row1" style="min-width: 80%;"><textarea rows="20" cols="40" name="message" style="width: 100%;"><?php if(isset($_POST['_savedraft'])) echo $_POST['message']; else echo $text; ?></textarea></td></tr>
+          <tr>
+            <th colspan="2">Compose new private message</th>
+          </tr>
+          <tr>
+            <td class="row1">
+              To:<br />
+              <small>Separate multiple names with a single comma; you<br />
+                     may send this message to up to <b><?php echo (string)MAX_PMS_PER_BATCH; ?></b> users.</small>
+            </td>
+            <td class="row1">
+              <?php echo $template->username_field('to', (isset($_POST['_savedraft'])) ? $_POST['to'] : $to ); ?>
+            </td>
+          </tr>
+          <tr>
+            <td class="row2">
+              Subject:
+            </td>
+            <td class="row2">
+              <input name="subject" type="text" size="30" value="<?php if(isset($_POST['_savedraft'])) echo htmlspecialchars($_POST['subject']); else echo $subj; ?>" /></td></tr>
+          <tr><td class="row1">Message:</td><td class="row1" style="min-width: 80%;"><textarea rows="20" cols="40" name="message" style="width: 100%;"><?php if(isset($_POST['_savedraft'])) echo htmlspecialchars($_POST['message']); else echo $text; ?></textarea></td></tr>
           <tr><th colspan="2"><input type="submit" name="_send" value="Send message" />  <input type="submit" name="_savedraft" value="Save as draft" /> <input type="submit" name="_inbox" value="Back to Inbox" /></th></tr>
         </table></div>
         <?php
@@ -254,9 +315,9 @@
         <br />
         <div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">
           <tr><th colspan="2">Edit draft</th></tr>
-          <tr><td class="row1">To:<br /><small>Separate multiple names with a single comma</small></td><td class="row1"><input name="to" type="text" size="30" value="<?php if(isset($_POST['_savedraft'])) echo $_POST['to']; else echo $r['message_to']; ?>" /></td></tr>
-          <tr><td class="row2">Subject:</td><td class="row2"><input name="subject" type="text" size="30" value="<?php if(isset($_POST['_savedraft'])) echo $_POST['subject']; else echo $r['subject']; ?>" /></td></tr>
-          <tr><td class="row1">Message:</td><td class="row1"><textarea rows="20" cols="40" name="message" style="width: 100%;"><?php if(isset($_POST['_savedraft'])) echo $_POST['message']; else echo $r['message_text']; ?></textarea></td></tr>
+          <tr><td class="row1">To:<br /><small>Separate multiple names with a single comma</small></td><td class="row1"><input name="to" type="text" size="30" value="<?php if(isset($_POST['_savedraft'])) echo htmlspecialchars($_POST['to']); else echo $r['message_to']; ?>" /></td></tr>
+          <tr><td class="row2">Subject:</td><td class="row2"><input name="subject" type="text" size="30" value="<?php if(isset($_POST['_savedraft'])) echo htmlspecialchars($_POST['subject']); else echo $r['subject']; ?>" /></td></tr>
+          <tr><td class="row1">Message:</td><td class="row1"><textarea rows="20" cols="40" name="message" style="width: 100%;"><?php if(isset($_POST['_savedraft'])) echo htmlspecialchars($_POST['message']); else echo $r['message_text']; ?></textarea></td></tr>
           <tr><th colspan="2"><input type="submit" name="_send" value="Send message" />  <input type="submit" name="_savedraft" value="Save as draft" /></th></tr>
         </table></div>
         <?php
--- a/plugins/SpecialAdmin.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/plugins/SpecialAdmin.php	Sun Nov 18 20:37:08 2007 -0500
@@ -10,7 +10,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.2 (Coblynau)
+ * Version 1.1.1
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
@@ -48,9 +48,12 @@
 
 function page_Admin_Home() {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -115,9 +118,12 @@
 
 function page_Admin_GeneralConfig() {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -203,6 +209,16 @@
       setConfig('pw_strength_minimum', $strength);
     }
     
+    // Account lockout policy
+    if ( preg_match('/^[0-9]+$/', $_POST['lockout_threshold']) )
+      setConfig('lockout_threshold', $_POST['lockout_threshold']);
+    
+    if ( preg_match('/^[0-9]+$/', $_POST['lockout_duration']) )
+      setConfig('lockout_duration', $_POST['lockout_duration']);
+    
+    if ( in_array($_POST['lockout_policy'], array('disable', 'captcha', 'lockout')) )
+      setConfig('lockout_policy', $_POST['lockout_policy']);
+    
     echo '<div class="info-box">Your changes to the site configuration have been saved.</div><br />';
     
   }
@@ -351,6 +367,43 @@
         </td>
       </tr>
       
+    <!-- Account lockout -->
+    
+      <tr><th colspan="2">Account lockouts</th></tr>
+      
+      <tr><td class="row3" colspan="2">Configure Enano to prevent or restrict logins for a specified period of time if a user enters an incorrect password a specific number of times.</td></tr>
+      
+      <tr>
+        <td class="row2">Lockout threshold:<br />
+          <small>How many times can a user enter wrong credentials before a lockout goes into effect?</small>
+        </td>
+        <td class="row2">
+          <input type="text" name="lockout_threshold" value="<?php echo ( $_ = getConfig('lockout_threshold') ) ? $_ : '5' ?>" />
+        </td>
+      </tr>
+      
+      <tr>
+        <td class="row1">Lockout duration:<br />
+          <small>This is how long an account lockout should last, in minutes.</small>
+        </td>
+        <td class="row1">
+          <input type="text" name="lockout_duration" value="<?php echo ( $_ = getConfig('lockout_duration') ) ? $_ : '15' ?>" />
+        </td>
+      </tr>
+      
+      <tr>
+        <td class="row2">Lockout policy:<br />
+          <small>What should be done when a lockout goes into effect?</small>
+        </td>
+        <td class="row2">
+          <label><input type="radio" name="lockout_policy" value="disable" <?php if ( getConfig('lockout_policy') == 'disable' ) echo 'checked="checked"'; ?> /> Don't do anything</label><br />
+          <label><input type="radio" name="lockout_policy" value="captcha" <?php if ( getConfig('lockout_policy') == 'captcha' ) echo 'checked="checked"'; ?> /> Require visual confirmation</label><br />
+          <label><input type="radio" name="lockout_policy" value="lockout" <?php if ( getConfig('lockout_policy') == 'lockout' || !getConfig('lockout_policy') ) echo 'checked="checked"'; ?> /> Prevent all login attempts</label>
+        </td>
+      </tr>
+      
+    <!-- Password strength -->
+      
       <tr><th colspan="2">Password strength</th></tr>
       
       <tr>
@@ -464,9 +517,12 @@
 function page_Admin_UploadConfig()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -581,9 +637,12 @@
 
 function page_Admin_PluginManager() {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -722,9 +781,12 @@
 function page_Admin_UploadAllowedMimeTypes()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -785,9 +847,12 @@
 function page_Admin_Sidebar()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -842,9 +907,12 @@
 /*
 function page_Admin_UserManager() {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -1112,9 +1180,12 @@
 function page_Admin_GroupManager()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -1471,9 +1542,12 @@
 function page_Admin_COPPA()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -1544,9 +1618,12 @@
 function page_Admin_PageManager()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -1740,9 +1817,12 @@
 function page_Admin_PageEditor()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -1840,9 +1920,12 @@
 {
   
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -2103,15 +2186,18 @@
 function page_Admin_BanControl()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
   if(isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id']) && $_GET['id'] != '')
   {
-    $e = $db->sql_query('DELETE FROM '.table_prefix.'banlist WHERE ban_id=' . $db->escape($_GET['id']) . '');
+    $e = $db->sql_query('DELETE FROM '.table_prefix.'banlist WHERE ban_id=' . intval($_GET['id']) . '');
     if(!$e) $db->_die('The ban list entry was not deleted.');
   }
   if(isset($_POST['create']) && !defined('ENANO_DEMO_MODE'))
@@ -2212,9 +2298,12 @@
 function page_Admin_MassEmail()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -2428,9 +2517,12 @@
 function page_Admin_DBBackup()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -2532,9 +2624,12 @@
 function page_Admin_AdminLogout()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
   {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
     return;
   }
   
@@ -2545,6 +2640,7 @@
 function page_Special_Administration()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   
   if($session->auth_level < USER_LEVEL_ADMIN) {
     redirect(makeUrlNS('Special', 'Login/'.$paths->page, 'level='.USER_LEVEL_ADMIN), 'Not authorized', 'You need an authorization level of '.USER_LEVEL_ADMIN.' to use this page, your auth level is: ' . $session->auth_level, 0);
@@ -2570,7 +2666,7 @@
       }
       if ( t == namespace_list.Admin + 'AdminLogout' )
       {
-        var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, 'Are you sure you want to de-authenticate?', 'If you de-authenticate, you will no longer be able to use the administration panel until you re-authenticate again. You may do so at any time using the Administration button on the sidebar.');
+        var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title_elev'), $lang.get('user_logout_confirm_body_elev'));
         mb.onclick['Yes'] = function() {
           var tigraentry = document.getElementById('i_div0_0').parentNode;
           var tigraobj = $(tigraentry);
@@ -2682,7 +2778,7 @@
           } 
           else 
           {
-            echo '<div class="wait-box">Please wait while the administration panel loads. You need to be using a recent browser with AJAX support in order to use Runt.</div>';
+            echo '<script type="text/javascript">document.write(\'<div class="wait-box">Please wait while the administration panel loads. You need to be using a recent browser with AJAX support in order to use Runt.</div>\');</script><noscript><div class="error-box">It looks like Javascript isn\'t enabled in your browser. Please enable Javascript or use a different browser to continue.</div></noscript>';
           }
           ?>
           </div>
@@ -2707,6 +2803,7 @@
 function page_Special_EditSidebar()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   
   if($session->auth_level < USER_LEVEL_ADMIN) 
   {
@@ -3191,7 +3288,7 @@
           $c = ($template->fetch_block($row['block_content'])) ? $template->fetch_block($row['block_content']) : 'Can\'t find plugin block';
           break;
       }
-      $block_name = $template->tplWikiFormat($row['block_name']);
+      $block_name = $row['block_name']; // $template->tplWikiFormat($row['block_name']);
       if ( empty($block_name) )
         $block_name = '&lt;Unnamed&gt;';
       $t = '<span title="Double-click to rename this block" id="sbrename_' . $row['item_id'] . '" ondblclick="ajaxRenameSidebarStage1(this, \''.$row['item_id'].'\'); return false;">' . $block_name . '</span>';
--- a/plugins/SpecialPageFuncs.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/plugins/SpecialPageFuncs.php	Sun Nov 18 20:37:08 2007 -0500
@@ -358,6 +358,8 @@
 function page_Special_About_Enano()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
+  
   $platform = 'Unknown';
   $uname = @file_get_contents('/proc/sys/kernel/ostype');
   if($uname == "Linux\n")
@@ -378,23 +380,52 @@
   <div class="tblholder">
     <table border="0" cellspacing="1" cellpadding="4">
       <tr><th colspan="2" style="text-align: left;">About the Enano Content Management System</th></tr>
-      <tr><td colspan="2" class="row3"><p>This website is powered by <a href="http://enanocms.org/">Enano</a>, the lightweight and open source
-      CMS that everyone can use. Enano is copyright &copy; 2006-2007 Dan Fuhry. For legal information, along with a list of libraries that Enano
-      uses, please see <a href="http://enanocms.org/Legal_information">Legal Information</a>.</p>
-      <p>The developers and maintainers of Enano strongly believe that software should not only be free to use, but free to be modified,
-         distributed, and used to create derivative works. For more information about Free Software, check out the
-         <a href="http://en.wikipedia.org/wiki/Free_Software" onclick="window.open(this.href); return false;">Wikipedia page</a> or
-         the <a href="http://www.fsf.org/" onclick="window.open(this.href); return false;">Free Software Foundation's</a> homepage.</p>
-      <p>This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License
-      as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>
-      <p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-      warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.</p>
-      <p>You should have received <a href="<?php echo makeUrlNS('Special', 'GNU_General_Public_License'); ?>">a copy of
-         the GNU General Public License</a> along with this program; if not, write to:</p>
-      <p style="margin-left 2em;">Free Software Foundation, Inc.,<br />
-         51 Franklin Street, Fifth Floor<br />
-         Boston, MA 02110-1301, USA</p>
-      <p>Alternatively, you can <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">read it online</a>.</p>
+      <tr><td colspan="2" class="row3">
+        <?php
+        echo $lang->get('meta_enano_about_poweredby');
+        $subst = array(
+            'gpl_link' => makeUrlNS('Special', 'GNU_General_Public_License')
+          );
+        echo $lang->get('meta_enano_about_gpl', $subst);
+        if ( $lang->lang_code != 'eng' ):
+        // Do not remove this block of code. Doing so is a violation of the GPL. (A copy of the GPL in other languages
+        // must be accompanied by a copy of the English GPL.)
+        ?>
+        <h3>(English)</h3>
+        <p>
+          This website is powered by <a href="http://enanocms.org/">Enano</a>, the lightweight and open source CMS that everyone can use.
+          Enano is copyright &copy; 2006-2007 Dan Fuhry. For legal information, along with a list of libraries that Enano uses, please
+          see <a href="http://enanocms.org/Legal_information">Legal Information</a>.
+        </p>
+        <p>
+          The developers and maintainers of Enano strongly believe that software should not only be free to use, but free to be modified,
+          distributed, and used to create derivative works. For more information about Free Software, check out the
+          <a href="http://en.wikipedia.org/wiki/Free_Software" onclick="window.open(this.href); return false;">Wikipedia page</a> or
+          the <a href="http://www.fsf.org/" onclick="window.open(this.href); return false;">Free Software Foundation's</a> homepage.
+        </p>
+        <p>
+          This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License
+          as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+        </p>
+        <p>
+          This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+          warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+        </p>
+        <p>
+          You should have received <a href="<?php echo makeUrlNS('Special', 'GNU_General_Public_License'); ?>">a copy of
+          the GNU General Public License</a> along with this program; if not, write to:
+        </p>
+        <p style="margin-left 2em;">
+          Free Software Foundation, Inc.,<br />
+          51 Franklin Street, Fifth Floor<br />
+          Boston, MA 02110-1301, USA
+        </p>
+        <p>
+          Alternatively, you can <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">read it online</a>.
+        </p>
+        <?php
+        endif;
+        ?>
       </td></tr>
       <tr>
         <td class="row2" colspan="2">
@@ -417,11 +448,11 @@
           </table>
         </td>
       </tr>
-      <tr><td style="width: 100px;" class="row1"><a href="http://enanocms.org">Enano</a> version:</td><td class="row1"><?php echo enano_version(true) . ' (' . enano_codename() . ')'; ?></td></tr>
-      <tr><td style="width: 100px;" class="row2">Web server:</td><td class="row2"><?php if(isset($_SERVER['SERVER_SOFTWARE'])) echo $_SERVER['SERVER_SOFTWARE']; else echo 'Unable to determine web server software.'; ?></td></tr>
-      <tr><td style="width: 100px;" class="row1">Server platform:</td><td class="row1"><?php echo $platform; ?></td></tr>
-      <tr><td style="width: 100px;" class="row2"><a href="http://www.php.net/">PHP</a> version:</td><td class="row2"><?php echo PHP_VERSION; ?></td></tr>
-      <tr><td style="width: 100px;" class="row1"><a href="http://www.mysql.com/">MySQL</a> version:</td><td class="row1"><?php echo mysql_get_server_info($db->_conn); ?></td></tr>
+      <tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_enanoversion'); ?></td><td class="row1"><?php echo enano_version(true) . ' (' . enano_codename() . ')'; ?></td></tr>
+      <tr><td style="width: 100px;" class="row2"><?php echo $lang->get('meta_enano_about_lbl_webserver'); ?></td><td class="row2"><?php if(isset($_SERVER['SERVER_SOFTWARE'])) echo $_SERVER['SERVER_SOFTWARE']; else echo 'Unable to determine web server software.'; ?></td></tr>
+      <tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_serverplatform'); ?></td><td class="row1"><?php echo $platform; ?></td></tr>
+      <tr><td style="width: 100px;" class="row2"><?php echo $lang->get('meta_enano_about_lbl_phpversion'); ?></td><td class="row2"><?php echo PHP_VERSION; ?></td></tr>
+      <tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_mysqlversion'); ?></td><td class="row1"><?php echo mysql_get_server_info($db->_conn); ?></td></tr>
     </table>
   </div>
   <?php
--- a/plugins/SpecialUpdownload.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/plugins/SpecialUpdownload.php	Sun Nov 18 20:37:08 2007 -0500
@@ -210,7 +210,7 @@
     <?php
     $template->footer();
   }
-}                                                                                                                                                          
+}                                                     
 
 function page_Special_DownloadFile()
 {
--- a/plugins/SpecialUserFuncs.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/plugins/SpecialUserFuncs.php	Sun Nov 18 20:37:08 2007 -0500
@@ -90,6 +90,14 @@
       \'namespace\'=>\'Special\',
       \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
       ));
+      
+    $paths->add_page(Array(
+      \'name\'=>\'Language exporter\',
+      \'urlname\'=>\'LangExportJSON\',
+      \'namespace\'=>\'Special\',
+      \'special\'=>0,\'visible\'=>0,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
+      ));
+      
     ');
 
 // function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace>
@@ -100,18 +108,65 @@
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
   global $__login_status;
+  global $lang;
   
   $pubkey = $session->rijndael_genkey();
   $challenge = $session->dss_rand();
   
+  $locked_out = false;
+  // are we locked out?
+  $threshold = ( $_ = getConfig('lockout_threshold') ) ? intval($_) : 5;
+  $duration  = ( $_ = getConfig('lockout_duration') ) ? intval($_) : 15;
+  // convert to minutes
+  $duration  = $duration * 60;
+  $policy = ( $x = getConfig('lockout_policy') && in_array(getConfig('lockout_policy'), array('lockout', 'disable', 'captcha')) ) ? getConfig('lockout_policy') : 'lockout';
+  if ( $policy != 'disable' )
+  {
+    $ipaddr = $db->escape($_SERVER['REMOTE_ADDR']);
+    $timestamp_cutoff = time() - $duration;
+    $q = $session->sql('SELECT timestamp FROM '.table_prefix.'lockout WHERE timestamp > ' . $timestamp_cutoff . ' AND ipaddr = \'' . $ipaddr . '\' ORDER BY timestamp DESC;');
+    $fails = $db->numrows();
+    if ( $fails >= $threshold )
+    {
+      $row = $db->fetchrow();
+      $locked_out = true;
+      $lockdata = array(
+          'locked_out' => true,
+          'lockout_threshold' => $threshold,
+          'lockout_duration' => ( $duration / 60 ),
+          'lockout_fails' => $fails,
+          'lockout_policy' => $policy,
+          'lockout_last_time' => $row['timestamp'],
+          'time_rem' => ( $duration / 60 ) - round( ( time() - $row['timestamp'] ) / 60 ),
+          'captcha' => ''
+        );
+      if ( $policy == 'captcha' )
+      {
+        $lockdata['captcha'] = $session->make_captcha();
+      }
+    }
+    $db->free_result();
+  }
+  
   if ( isset($_GET['act']) && $_GET['act'] == 'getkey' )
   {
     $username = ( $session->user_logged_in ) ? $session->username : false;
     $response = Array(
       'username' => $username,
       'key' => $pubkey,
-      'challenge' => $challenge
+      'challenge' => $challenge,
+      'locked_out' => false
       );
+    
+    if ( $locked_out )
+    {
+      foreach ( $lockdata as $x => $y )
+      {
+        $response[$x] = $y;
+      }
+      unset($x, $y);
+    }
+    
     $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
     $response = $json->encode($response);
     echo $response;
@@ -135,10 +190,53 @@
     $paths->main_page();
   $template->header();
   echo '<form action="'.makeUrl($paths->nslist['Special'].'Login').'" method="post" name="loginform" onsubmit="runEncryption();">';
-  $header = ( $level > USER_LEVEL_MEMBER ) ? 'Please re-enter your login details' : 'Please enter your username and password to log in.';
+  $header = ( $level > USER_LEVEL_MEMBER ) ? $lang->get('user_login_message_short_elev') : $lang->get('user_login_message_short');
   if ( isset($_POST['login']) )
   {
-    echo '<p>'.$__login_status.'</p>';
+    $errstring = $__login_status['error'];
+    switch($__login_status['error'])
+    {
+      case 'key_not_found':
+        $errstring = $lang->get('user_err_key_not_found');
+        break;
+      case 'key_wrong_length':
+        $errstring = $lang->get('user_err_key_wrong_length');
+        break;
+      case 'too_big_for_britches':
+        $errstring = $lang->get('user_err_too_big_for_britches');
+        break;
+      case 'invalid_credentials':
+        $errstring = $lang->get('user_err_invalid_credentials');
+        if ( $__login_status['lockout_policy'] == 'lockout' )
+        {
+          $errstring .= $lang->get('err_invalid_credentials_lockout', array('lockout_fails' => $__login_status['lockout_fails']));
+        }
+        else if ( $__login_status['lockout_policy'] == 'captcha' )
+        {
+          $errstring .= $lang->get('user_err_invalid_credentials_lockout_captcha', array('lockout_fails' => $__login_status['lockout_fails']));
+        }
+        break;
+      case 'backend_fail':
+        $errstring = $lang->get('user_err_backend_fail');
+        break;
+      case 'locked_out':
+        $attempts = intval($__login_status['lockout_fails']);
+        if ( $attempts > $__login_status['lockout_threshold'])
+          $attempts = $__login_status['lockout_threshold'];
+        
+        $server_time = time();
+        $time_rem = ( $__login_status['lockout_last_time'] == time() ) ? $__login_status['lockout_duration'] : $__login_status['lockout_duration'] - round( ( $server_time - $__login_status['lockout_last_time'] ) / 60 );
+        if ( $time_rem < 1 )
+          $time_rem = $__login_status['lockout_duration'];
+        
+        $s = ( $time_rem == 1 ) ? '' : $lang->get('meta_plural');
+        
+        $captcha_string = ( $__login_status['lockout_policy'] == 'captcha' ) ? $lang->get('err_locked_out_captcha_blurb') : '';
+        $errstring = $lang->get('user_err_locked_out', array('plural' => $s, 'captcha_blurb' => $captcha_string, 'time_rem' => $time_rem));
+        
+        break;
+    }
+    echo '<div class="error-box-mini">'.$errstring.'</div>';
   }
   if ( $p = $paths->getAllParams() )
   {
@@ -159,18 +257,18 @@
             <?php
             if ( $level <= USER_LEVEL_MEMBER )
             {
-              echo '<p>Logging in enables you to use your preferences and access member information. If you don\'t have a username and password here, you can <a href="'.makeUrl($paths->nslist['Special'].'Register').'">create an account</a>.</p>';
+              echo '<p>' . $lang->get('user_login_body', array('reg_link' => makeUrlNS('Special', 'Register'))) . '</p>';
             }
             else
             {
-              echo '<p>You are requesting that a sensitive operation be performed. To continue, please re-enter your password to confirm your identity.</p>';
+              echo '<p>' . $lang->get('user_login_body_elev') . '</p>';
             }
             ?>
           </td>
         </tr>
         <tr>
           <td class="row2">
-            Username:
+            <?php echo $lang->get('user_login_field_username'); ?>:
           </td>
           <td class="row1">
             <input name="username" size="25" type="text" <?php
@@ -189,23 +287,52 @@
               ?> />
           </td>
           <?php if ( $level <= USER_LEVEL_MEMBER ) { ?>
-          <td rowspan="2" class="row3">
-            <small>Forgot your password? <a href="<?php echo makeUrlNS('Special', 'PasswordReset'); ?>">No problem.</a><br />
-            Maybe you need to <a href="<?php echo makeUrlNS('Special', 'Register'); ?>">create an account</a>.</small>
+          <td rowspan="<?php echo ( ( $locked_out && $lockdata['lockout_policy'] == 'captcha' ) ) ? '4' : '2'; ?>" class="row3">
+            <small><?php echo $lang->get('user_login_forgotpass_blurb', array('forgotpass_link' => makeUrlNS('Special', 'PasswordReset'))); ?><br />
+            <?php echo $lang->get('user_login_createaccount_blurb', array('reg_link' => makeUrlNS('Special', 'Register'))); ?></small>
           </td>
           <?php } ?>
         </tr>
         <tr>
-          <td class="row2">Password:<br /></td><td class="row1"><input name="pass" size="25" type="password" tabindex="<?php echo ( $level <= USER_LEVEL_MEMBER ) ? '2' : '1'; ?>" /></td>
+          <td class="row2">
+            <?php echo $lang->get('user_login_field_password'); ?>:
+          </td><td class="row1"><input name="pass" size="25" type="password" tabindex="<?php echo ( $level <= USER_LEVEL_MEMBER ) ? '2' : '1'; ?>" /></td>
          </tr>
-         <?php if ( $level <= USER_LEVEL_MEMBER ) { ?>
+         <?php
+         if ( $locked_out && $lockdata['lockout_policy'] == 'captcha' )
+         {
+           ?>
+           <tr>
+             <td class="row2" rowspan="2"><?php echo $lang->get('user_login_field_captcha'); ?>:<br /></td><td class="row1"><input type="hidden" name="captcha_hash" value="<?php echo $lockdata['captcha']; ?>" /><input name="captcha_code" size="25" type="text" tabindex="<?php echo ( $level <= USER_LEVEL_MEMBER ) ? '3' : '4'; ?>" /></td>
+           </tr>
+           <tr>
+             <td class="row3">
+               <img src="<?php echo makeUrlNS('Special', 'Captcha/' . $lockdata['captcha']) ?>" onclick="this.src=this.src+'/a';" style="cursor: pointer;" />
+             </td>
+           </tr>
+           <?php
+         }
+         ?>
          <tr>
            <td class="row3" colspan="3">
-             <p><b>Important note regarding cryptography:</b> Some countries do not allow the import or use of cryptographic technology. If you live in one of the countries listed below, you should <a href="<?php if($p=$paths->getParam(0))$u='/'.$p;else $u='';echo makeUrl($paths->page.$u, 'level='.$level.'&use_crypt=0', true); ?>">log in without using encryption</a>.</p>
-             <p>This restriction applies to the following countries: Belarus, China, India, Israel, Kazakhstan, Mongolia, Pakistan, Russia, Saudi Arabia, Singapore, Tunisia, Venezuela, and Vietnam.</p>
+             <?php
+             if ( $level <= USER_LEVEL_MEMBER && ( !isset($_GET['use_crypt']) || ( isset($_GET['use_crypt']) && $_GET['use_crypt']!='0' ) ) )
+             {
+               $returnpage_link = ( $return = $paths->getAllParams() ) ? '/' . $return : '';
+               $nocrypt_link = makeUrlNS('Special', "Login$returnpage_link", "level=$level&use_crypt=0", true);
+               echo '<p><b>' . $lang->get('user_login_nocrypt_title') . '</b> ' . $lang->get('user_login_nocrypt_body', array('nocrypt_link' => $nocrypt_link)) . '</p>';
+               echo '<p>' . $lang->get('user_login_nocrypt_countrylist') . '</p>';
+             }
+             else if ( $level <= USER_LEVEL_MEMBER && ( isset($_GET['use_crypt']) && $_GET['use_crypt']=='0' ) )
+             {
+               $returnpage_link = ( $return = $paths->getAllParams() ) ? '/' . $return : '';
+               $usecrypt_link = makeUrlNS('Special', "Login$returnpage_link", "level=$level&use_crypt=1", true);
+               echo '<p><b>' . $lang->get('user_login_usecrypt_title') . '</b> ' . $lang->get('user_login_usecrypt_body', array('usecrypt_link' => $usecrypt_link)) . '</p>';
+               echo '<p>' . $lang->get('user_login_usecrypt_countrylist') . '</p>';
+             }
+             ?>
            </td>
          </tr>
-         <?php } ?>
          <tr>
            <th colspan="3" style="text-align: center" class="subhead"><input type="submit" name="login" value="Log in" tabindex="<?php echo ( $level <= USER_LEVEL_MEMBER ) ? '3' : '2'; ?>" /></th>
          </tr>
@@ -237,17 +364,18 @@
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
   global $__login_status;
+  global $lang;
   if ( isset($_GET['act']) && $_GET['act'] == 'ajaxlogin' )
   {
     $plugins->attachHook('login_password_reset', 'SpecialLogin_SendResponse_PasswordReset($row[\'user_id\'], $row[\'temp_password\']);');
     $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
     $data = $json->decode($_POST['params']);
+    $captcha_hash = ( isset($data['captcha_hash']) ) ? $data['captcha_hash'] : false;
+    $captcha_code = ( isset($data['captcha_code']) ) ? $data['captcha_code'] : false;
     $level = ( isset($data['level']) ) ? intval($data['level']) : USER_LEVEL_MEMBER;
-    $result = $session->login_with_crypto($data['username'], $data['crypt_data'], $data['crypt_key'], $data['challenge'], $level);
+    $result = $session->login_with_crypto($data['username'], $data['crypt_data'], $data['crypt_key'], $data['challenge'], $level, $captcha_hash, $captcha_code);
     $session->start();
-    //echo "$result\n$session->sid_super";
-    //exit;
-    if ( $result == 'success' )
+    if ( $result['success'] )
     {
       $response = Array(
           'result' => 'success',
@@ -256,9 +384,16 @@
     }
     else
     {
+      $captcha = '';
+      if ( $result['error'] == 'locked_out' && $result['lockout_policy'] == 'captcha' )
+      {
+        $session->kill_captcha();
+        $captcha = $session->make_captcha();
+      }
       $response = Array(
           'result' => 'error',
-          'error' => $result
+          'data' => $result,
+          'captcha' => $captcha
         );
     }
     $response = $json->encode($response);
@@ -267,27 +402,37 @@
     exit;
   }
   if(isset($_POST['login'])) {
+    $captcha_hash = ( isset($_POST['captcha_hash']) ) ? $_POST['captcha_hash'] : false;
+    $captcha_code = ( isset($_POST['captcha_code']) ) ? $_POST['captcha_code'] : false;
     if($_POST['use_crypt'] == 'yes')
     {
-      $result = $session->login_with_crypto($_POST['username'], $_POST['crypt_data'], $_POST['crypt_key'], $_POST['challenge_data'], intval($_POST['auth_level']));
+      $result = $session->login_with_crypto($_POST['username'], $_POST['crypt_data'], $_POST['crypt_key'], $_POST['challenge_data'], intval($_POST['auth_level']), $captcha_hash, $captcha_code);
     }
     else
     {
-      $result = $session->login_without_crypto($_POST['username'], $_POST['pass'], false, intval($_POST['auth_level']));
+      $result = $session->login_without_crypto($_POST['username'], $_POST['pass'], false, intval($_POST['auth_level']), $captcha_hash, $captcha_code);
     }
     $session->start();
     $paths->init();
-    if($result == 'success')
+    if($result['success'])
     {
       $template->load_theme($session->theme, $session->style);
       if(isset($_POST['return_to']))
       {
         $name = ( isset($paths->pages[$_POST['return_to']]['name']) ) ? $paths->pages[$_POST['return_to']]['name'] : $_POST['return_to'];
-        redirect( makeUrl($_POST['return_to'], false, true), 'Login successful', 'You have successfully logged into the '.getConfig('site_name').' site as "'.$session->username.'". Redirecting to ' . $name . '...' );
+        $subst = array(
+            'username' => $session->username,
+            'redir_target' => $name
+          );
+        redirect( makeUrl($_POST['return_to'], false, true), $lang->get('user_login_success_title'), $lang->get('user_login_success_body', $subst) );
       }
       else
       {
-        redirect( makeUrl(getConfig('main_page'), false, true), 'Login successful', 'You have successfully logged into the '.getConfig('site_name').' site as "'.$session->username.'". Redirecting to the main page...' );
+        $subst = array(
+            'username' => $session->username,
+            'redir_target' => $lang->get('user_login_success_body_mainpage')
+          );
+        redirect( makeUrl(getConfig('main_page'), false, true), $lang->get('user_login_success_title'), $lang->get('user_login_success_body', $subst) );
       }
     }
     else
@@ -317,22 +462,26 @@
 
 function page_Special_Logout() {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   if ( !$session->user_logged_in )
     $paths->main_page();
   
   $l = $session->logout();
   if ( $l == 'success' )
   {
-    redirect(makeUrl(getConfig('main_page'), false, true), 'Logged out', 'You have been successfully logged out, and all cookies have been cleared. You will now be transferred to the main page.', 4);
+    
+    redirect(makeUrl(getConfig('main_page'), false, true), $lang->get('user_logout_success_title'), $lang->get('user_logout_success_body'), 4);
   }
   $template->header();
-  echo '<h3>An error occurred during the logout process.</h3><p>'.$l.'</p>';
+  echo '<h3>' . $lang->get('user_logout_err_title') . '</h3>';
+  echo '<p>' . $l . '</p>';
   $template->footer();
 }
 
 function page_Special_Register()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   
   // form field trackers
   $username = '';
@@ -341,8 +490,8 @@
   
   if(getConfig('account_activation') == 'disable' && ( ( $session->user_level >= USER_LEVEL_ADMIN && !isset($_GET['IWannaPlayToo']) ) || $session->user_level < USER_LEVEL_ADMIN || !$session->user_logged_in ))
   {
-    $s = ($session->user_level >= USER_LEVEL_ADMIN) ? '<p>Oops...it seems that you <em>are</em> the administrator...hehe...you can also <a href="'.makeUrl($paths->page, 'IWannaPlayToo', true).'">force account registration to work</a>.</p>' : '';
-    die_friendly('Registration disabled', '<p>The administrator has disabled new user registration on this site.</p>' . $s);
+    $s = ($session->user_level >= USER_LEVEL_ADMIN) ? '<p>' . $lang->get('user_reg_err_disabled_body_adminblurb', array( 'reg_link' => makeUrl($paths->page, 'IWannaPlayToo&coppa=no', true) )) . '</p>' : '';
+    die_friendly($lang->get('user_reg_err_disabled_title'), '<p>' . $lang->get('user_reg_err_disabled_body') . '</p>' . $s);
   }
   if ( $session->user_level < USER_LEVEL_ADMIN && $session->user_logged_in )
   {
@@ -356,7 +505,7 @@
     $session->kill_captcha();
     if($captcharesult != $_POST['captchacode'])
     {
-      $s = 'The confirmation code you entered was incorrect.';
+      $s = $lang->get('user_reg_err_captcha');
     }
     else
     {
@@ -380,7 +529,7 @@
           $crypt_key = $session->fetch_public_key($_POST['crypt_key']);
           if ( !$crypt_key )
           {
-            $s = 'Couldn\'t look up public encryption key';
+            $s = $lang->get('user_reg_err_missing_key');
           }
           else
           {
@@ -407,28 +556,28 @@
       {
         case "none":
         default:
-          $str = 'You may now <a href="'.makeUrlNS('Special', 'Login').'">log in</a> with the username and password that you created.';
+          $str = $lang->get('user_reg_msg_success_activ_none', array('login_link' => makeUrlNS('Special', 'Login', false, true)));
           break;
         case "user":
-          $str = 'Because this site requires account activation, you have been sent an e-mail with further instructions. Please follow the instructions in that e-mail to continue your registration.';
+          $str = $lang->get('user_reg_msg_success_activ_user');
           break;
         case "admin":
-          $str = 'Because this site requires administrative account activation, you cannot use your account at the moment. A notice has been sent to the site administration team that will alert them that your account has been created.';
+          $str = $lang->get('user_reg_msg_success_activ_admin');
           break;
       }
-      die_friendly('Registration successful', '<p>Thank you for registering, your user account has been created. '.$str.'</p>');
+      die_friendly($lang->get('user_reg_msg_success_title'), '<p>' . $lang->get('user_reg_msg_success_body') . ' ' . $str . '</p>');
     }
     else if ( $s == 'success' && $coppa )
     {
-      $str = 'However, in compliance with the Childrens\' Online Privacy Protection Act, you must have your parent or legal guardian activate your account. Please ask them to check their e-mail for further information.';
-      die_friendly('Registration successful', '<p>Thank you for registering, your user account has been created. '.$str.'</p>');
+      $str = $lang->get('user_reg_msg_success_activ_coppa');
+      die_friendly($lang->get('user_reg_msg_success_title'), '<p>' . $lang->get('user_reg_msg_success_body') . ' ' . $str . '</p>');
     }
     $username = htmlspecialchars($_POST['username']);
     $email    = htmlspecialchars($_POST['email']);
     $realname = htmlspecialchars($_POST['real_name']);
   }
   $template->header();
-  echo 'A user account enables you to have greater control over your browsing experience.';
+  echo $lang->get('user_reg_msg_greatercontrol');
   
   if ( getConfig('enable_coppa') != '1' || ( isset($_GET['coppa']) && in_array($_GET['coppa'], array('yes', 'no')) ) )
   {
@@ -440,22 +589,22 @@
     $challenge = $session->dss_rand();
     
     ?>
-      <h3>Create a user account</h3>
-      <form name="regform" action="<?php echo makeUrl($paths->page); ?>" method="post" onsubmit="runEncryption();">
+      <h3><?php echo $lang->get('user_reg_msg_table_title'); ?></h3>
+      <form name="regform" action="<?php echo makeUrl($paths->page); ?>" method="post" onsubmit="return runEncryption();">
         <div class="tblholder">
           <table border="0" width="100%" cellspacing="1" cellpadding="4">
-            <tr><th class="subhead" colspan="3">Please tell us a little bit about yourself.</th></tr>
+            <tr><th class="subhead" colspan="3"><?php echo $lang->get('user_reg_msg_table_subtitle'); ?></th></tr>
             
             <?php if(isset($_POST['submit'])) echo '<tr><td colspan="3" class="row2" style="color: red;">'.$s.'</td></tr>'; ?>
             
             <!-- FIELD: Username -->
             <tr>
               <td class="row1" style="width: 50%;">
-                Preferred username:
+                <?php echo $lang->get('user_reg_lbl_field_username'); ?>
                 <span id="e_username"></span>
               </td>
               <td class="row1" style="width: 50%;">
-                <input tabindex="1" type="text" name="username" size="30" value="<?php echo $username; ?>" onkeyup="namegood = false; validateForm();" onblur="checkUsername();" />
+                <input tabindex="1" type="text" name="username" size="30" value="<?php echo $username; ?>" onkeyup="namegood = false; validateForm(this);" onblur="checkUsername();" />
               </td>
               <td class="row1" style="max-width: 24px;">
                 <img alt="Good/bad icon" src="<?php echo scriptPath; ?>/images/bad.gif" id="s_username" />
@@ -465,14 +614,14 @@
             <!-- FIELD: Password -->
             <tr>
               <td class="row3" style="width: 50%;" rowspan="<?php echo ( getConfig('pw_strength_enable') == '1' ) ? '3' : '2'; ?>">
-                Password:
+                <?php echo $lang->get('user_reg_lbl_field_password'); ?>
                 <span id="e_password"></span>
                 <?php if ( getConfig('pw_strength_enable') == '1' && getConfig('pw_strength_minimum') > -10 ): ?>
-                <small>It needs to score at least <b><?php echo getConfig('pw_strength_minimum'); ?></b> for your registration to be accepted.</small>
+                <small><?php echo $lang->get('user_reg_msg_password_score'); ?></small>
                 <?php endif; ?>
               </td>
               <td class="row3" style="width: 50%;">
-                <input tabindex="2" type="password" name="password" size="15" onkeyup="<?php if ( getConfig('pw_strength_enable') == '1' ): ?>password_score_field(this); <?php endif; ?>validateForm();" /><?php if ( getConfig('pw_strength_enable') == '1' ): ?><span class="password-checker" style="font-weight: bold; color: #aaaaaa;"> Loading...</span><?php endif; ?>
+                <input tabindex="2" type="password" name="password" size="15" onkeyup="<?php if ( getConfig('pw_strength_enable') == '1' ): ?>password_score_field(this); <?php endif; ?>validateForm(this);" /><?php if ( getConfig('pw_strength_enable') == '1' ): ?><span class="password-checker" style="font-weight: bold; color: #aaaaaa;"> Loading...</span><?php endif; ?>
               </td>
               <td rowspan="<?php echo ( getConfig('pw_strength_enable') == '1' ) ? '3' : '2'; ?>" class="row3" style="max-width: 24px;">
                 <img alt="Good/bad icon" src="<?php echo scriptPath; ?>/images/bad.gif" id="s_password" />
@@ -482,7 +631,7 @@
             <!-- FIELD: Password confirmation -->
             <tr>
               <td class="row3" style="width: 50%;">
-                <input tabindex="3" type="password" name="password_confirm" size="15" onkeyup="validateForm();" /> <small>Enter your password again to confirm.</small>
+                <input tabindex="3" type="password" name="password_confirm" size="15" onkeyup="validateForm(this);" /> <small><?php echo $lang->get('user_reg_lbl_field_password_confirm'); ?></small>
               </td>
             </tr>
             
@@ -500,18 +649,24 @@
             <tr>
               <td class="row1" style="width: 50%;">
                 <?php
-                  if ( $coppa ) echo 'Your parent or guardian\'s e'; 
-                  else echo 'E';
-                ?>-mail address:
+                  if ( $coppa )
+                  {
+                    echo $lang->get('user_reg_lbl_field_email_coppa');
+                  }
+                  else
+                  {
+                    echo $lang->get('user_reg_lbl_field_email');
+                  }
+                ?>
                 <?php
                   if ( ( $x = getConfig('account_activation') ) == 'user' )
                   {
-                    echo '<br /><small>An e-mail with an account activation key will be sent to this address, so please ensure that it is correct.</small>';
+                    echo '<br /><small>' . $lang->get('user_reg_msg_email_activuser') . '</small>';
                   }
                 ?>
               </td>
               <td class="row1" style="width: 50%;">
-                <input tabindex="4" type="text" name="email" size="30" value="<?php echo $email; ?>" onkeyup="validateForm();" />
+                <input tabindex="4" type="text" name="email" size="30" value="<?php echo $email; ?>" onkeyup="validateForm(this);" />
               </td>
               <td class="row1" style="max-width: 24px;">
                 <img alt="Good/bad icon" src="<?php echo scriptPath; ?>/images/bad.gif" id="s_email" />
@@ -521,8 +676,8 @@
             <!-- FIELD: Real name -->
             <tr>
               <td class="row3" style="width: 50%;">
-                Real name:<br />
-                <small>Giving your real name is totally optional. If you choose to provide your real name, it will be used to provide attribution for any edits or contributions you may make to this site.</small>
+                <?php echo $lang->get('user_reg_lbl_field_realname'); ?><br />
+                <small><?php echo $lang->get('user_reg_msg_realname_optional'); ?></small>
               </td>
               <td class="row3" style="width: 50%;">
                 <input tabindex="5" type="text" name="real_name" size="30" value="<?php echo $realname; ?>" /></td><td class="row3" style="max-width: 24px;">
@@ -532,11 +687,11 @@
             <!-- FIELD: CAPTCHA image -->
             <tr>
               <td class="row1" style="width: 50%;" rowspan="2">
-                Visual confirmation<br />
+                <?php echo $lang->get('user_reg_lbl_field_captcha'); ?><br />
                 <small>
-                  Please enter the code shown in the image to the right into the text box. This process helps to ensure that this registration is not being performed by an automated bot. If the image to the right is illegible, you can <a href="#" onclick="regenCaptcha(); return false;">generate a new image</a>.<br />
+                  <?php echo $lang->get('user_reg_msg_captcha_pleaseenter', array('regen_flags' => 'href="#" onclick="regenCaptcha(); return false;"')); ?><br />
                   <br />
-                  If you are visually impaired or otherwise cannot read the text shown to the right, please contact the site management and they will create an account for you.
+                  <?php echo $lang->get('user_reg_msg_captcha_blind'); ?>
                 </small>
               </td>
               <td colspan="2" class="row1">
@@ -548,7 +703,7 @@
             <!-- FIELD: CAPTCHA input field -->
             <tr>
               <td class="row1" colspan="2">
-                Code:
+                <?php echo $lang->get('user_reg_lbl_field_captcha_code'); ?>
                 <input tabindex="6" name="captchacode" type="text" size="10" />
                 <input type="hidden" name="captchahash" value="<?php echo $captchacode; ?>" />
               </td>
@@ -598,6 +753,18 @@
           var frm = document.forms.regform;
           if ( frm.password.value.length < 1 )
             return true;
+          pass1 = frm.password.value;
+          pass2 = frm.password_confirm.value;
+          if ( pass1 != pass2 )
+          {
+            alert($lang.get('user_reg_err_alert_password_nomatch'));
+            return false;
+          }
+          if ( pass1.length < 6 && pass1.length > 0 )
+          {
+            alert($lang.get('user_reg_err_alert_password_tooshort'));
+            return false;
+          }
           if(aes_testpassed)
           {
             frm.use_crypt.value = 'yes';
@@ -610,21 +777,6 @@
               len = ( typeof cryptkey == 'string' || typeof cryptkey == 'object' ) ? '\nLen: '+cryptkey.length : '';
               alert('The key is messed up\nType: '+typeof(cryptkey)+len);
             }
-          }
-          pass1 = frm.password.value;
-          pass2 = frm.password_confirm.value;
-          if ( pass1 != pass2 )
-          {
-            alert('The passwords you entered do not match.');
-            return false;
-          }
-          if ( pass1.length < 6 && pass1.length > 0 )
-          {
-            alert('The new password must be 6 characters or greater in length.');
-            return false;
-          }
-          if(aes_testpassed)
-          {
             pass = frm.password.value;
             pass = stringToByteArray(pass);
             cryptstring = rijndaelEncrypt(pass, cryptkey, 'ECB');
@@ -646,24 +798,37 @@
         <script type="text/javascript">
           // <![CDATA[
           var namegood = false;
-          function validateForm()
+          function validateForm(field)
           {
+            if ( typeof(field) != 'object' )
+            {
+              field = {
+                name: '_nil',
+                value: '_nil',
+              }
+            }
+            // wait until $lang is initted
+            if ( typeof($lang) != 'object' )
+            {
+              setTimeout('validateForm();', 200);
+              return false;
+            }
             var frm = document.forms.regform;
             failed = false;
             
             // Username
-            if(!namegood)
+            if(!namegood && ( field.name == 'username' || field.name == '_nil' ) ) 
             {
               //if(frm.username.value.match(/^([A-z0-9 \!@\-\(\)]+){2,}$/ig))
               var regex = new RegExp('^([^<>&\?]+){2,}$', 'ig');
               if ( frm.username.value.match(regex) )
               {
                 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/unknown.gif';
-                document.getElementById('e_username').innerHTML = ''; // '<br /><small><b>Checking availability...</b></small>';
+                document.getElementById('e_username').innerHTML = '&nbsp;';
               } else {
                 failed = true;
                 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/bad.gif';
-                document.getElementById('e_username').innerHTML = '<br /><small>Your username must be at least two characters in length and may contain only alphanumeric characters (A-Z and 0-9), spaces, and the following characters: :, !, @, #, *.</small>';
+                document.getElementById('e_username').innerHTML = '<br /><small>' + $lang.get('user_reg_err_username_invalid') + '</small>';
               }
             }
             document.getElementById('b_username').innerHTML = '';
@@ -673,31 +838,34 @@
             }
             
             // Password
-            if(frm.password.value.match(/^(.+){6,}$/ig) && frm.password_confirm.value.match(/^(.+){6,}$/ig) && frm.password.value == frm.password_confirm.value)
+            if ( field.name == 'password' || field.name == 'password_confirm' || field.name == '_nil' )
             {
-              document.getElementById('s_password').src='<?php echo scriptPath; ?>/images/good.gif';
-              document.getElementById('e_password').innerHTML = '<br /><small>The password you entered is valid.</small>';
-            } else {
-              failed = true;
-              if(frm.password.value.length < 6)
+              if(frm.password.value.match(/^(.+){6,}$/ig) && frm.password_confirm.value.match(/^(.+){6,}$/ig) && frm.password.value == frm.password_confirm.value )
               {
-                document.getElementById('e_password').innerHTML = '<br /><small>Your password must be at least six characters in length.</small>';
+                document.getElementById('s_password').src='<?php echo scriptPath; ?>/images/good.gif';
+                document.getElementById('e_password').innerHTML = '<br /><small>' + $lang.get('user_reg_err_password_good') + '</small>';
+              } else {
+                failed = true;
+                if(frm.password.value.length < 6)
+                {
+                  document.getElementById('e_password').innerHTML = '<br /><small>' + $lang.get('user_reg_msg_password_length') + '</small>';
+                }
+                else if(frm.password.value != frm.password_confirm.value)
+                {
+                  document.getElementById('e_password').innerHTML = '<br /><small>' + $lang.get('user_reg_msg_password_needmatch') + '</small>';
+                }
+                else
+                {
+                  document.getElementById('e_password').innerHTML = '';
+                }
+                document.getElementById('s_password').src='<?php echo scriptPath; ?>/images/bad.gif';
               }
-              else if(frm.password.value != frm.password_confirm.value)
-              {
-                document.getElementById('e_password').innerHTML = '<br /><small>The passwords you entered do not match.</small>';
-              }
-              else
-              {
-                document.getElementById('e_password').innerHTML = '';
-              }
-              document.getElementById('s_password').src='<?php echo scriptPath; ?>/images/bad.gif';
             }
             
             // E-mail address
             
             // workaround for idiot jEdit bug
-            if ( validateEmail(frm.email.value) )
+            if ( validateEmail(frm.email.value) && ( field.name == 'email' || field.name == '_nil' ) )
             {
               document.getElementById('s_email').src='<?php echo scriptPath; ?>/images/good.gif';
             } else {
@@ -721,25 +889,25 @@
               if ( frm.username.value.match(regex) )
               {
                 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/unknown.gif';
-                document.getElementById('e_username').innerHTML = '';
+                document.getElementById('e_username').innerHTML = '&nbsp;';
               } else {
                 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/bad.gif';
-                document.getElementById('e_username').innerHTML = '<br /><small>Your username must be at least two characters in length and may contain only alphanumeric characters (A-Z and 0-9), spaces, and the following characters: :, !, @, #, *.</small>';
+                document.getElementById('e_username').innerHTML = '<br /><small>' + $lang.get('user_reg_err_username_invalid') + '</small>';
                 return false;
               }
             }
             
-            document.getElementById('e_username').innerHTML = '<br /><small><b>Checking availability...</b></small>';
+            document.getElementById('e_username').innerHTML = '<br /><small><b>' + $lang.get('user_reg_msg_username_checking') + '</b></small>';
             ajaxGet('<?php echo scriptPath; ?>/ajax.php?title=null&_mode=checkusername&name='+escape(frm.username.value), function() {
               if(ajax.readyState == 4)
                 if(ajax.responseText == 'good')
                 {
                   document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/good.gif';
-                  document.getElementById('e_username').innerHTML = '<br /><small><b>This username is available.</b></small>';
+                  document.getElementById('e_username').innerHTML = '<br /><small><b>' + $lang.get('user_reg_msg_username_available') + '</b></small>';
                   namegood = true;
                 } else if(ajax.responseText == 'bad') {
                   document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/bad.gif';
-                  document.getElementById('e_username').innerHTML = '<br /><small><b>Error: that username is already taken.</b></small>';
+                  document.getElementById('e_username').innerHTML = '<br /><small><b>' + $lang.get('user_reg_msg_username_unavailable') + '</b></small>';
                   namegood = false;
                 } else {
                   document.getElementById('e_username').innerHTML = ajax.responseText;
@@ -778,13 +946,13 @@
     echo '<table border="0" cellspacing="1" cellpadding="4">';
     echo '<tr>
             <td class="row1">
-              Before you can register, please tell us your age.
+              ' . $lang->get('user_reg_coppa_title') . '
             </td>
           </tr>
           <tr>
             <td class="row3">
-              <a href="' . $link_coppa_no  . '">I was born <b>on or before</b> ' . $yo13_date . ' and am <b>at least</b> 13 years of age</a><br />
-              <a href="' . $link_coppa_yes . '">I was born <b>after</b> ' . $yo13_date . ' and am <b>less than</b> 13 years of age</a>
+              <a href="' . $link_coppa_no  . '">' . $lang->get('user_reg_coppa_link_atleast13', array( 'yo13_date' => $yo13_date )) . '</a><br />
+              <a href="' . $link_coppa_yes . '">' . $lang->get('user_reg_coppa_link_not13', array( 'yo13_date' => $yo13_date )) . '</a>
             </td>
           </tr>';
     echo '</table>';
@@ -1538,4 +1706,31 @@
   }
 }
 
+function page_Special_LangExportJSON()
+{
+  global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
+  
+  $lang_id = ( $x = $paths->getParam(0) ) ? intval($x) : $lang->lang_id;
+  
+  if ( $lang->lang_id == $lang_id )
+    $lang_local =& $lang;
+  else
+    $lang_local = new Language($lang_id);
+  
+  $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
+  
+  $timestamp = date('D, j M Y H:i:s T', $lang_local->lang_timestamp);
+  header("Last-Modified: $timestamp");
+  header("Date: $timestamp");
+  header('Content-type: text/javascript');
+  
+  $lang_local->fetch();
+  echo "if ( typeof(enano_lang) != 'object' )
+  var enano_lang = new Object();
+
+enano_lang[{$lang->lang_id}] = " . $json->encode($lang_local->strings) . ";";
+  
+}
+
 ?>
\ No newline at end of file
--- a/plugins/admin/UserManager.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/plugins/admin/UserManager.php	Sun Nov 18 20:37:08 2007 -0500
@@ -2,7 +2,7 @@
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.2 (Coblynau)
+ * Version 1.1.1
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
@@ -409,18 +409,18 @@
         {
           $row = $db->fetchrow();
           $db->free_result();
-          if($session->activate_account($_GET['user'], $row['activation_key'])) { echo '<div class="info-box">The user account "'.$_GET['user'].'" has been activated.</div>'; $db->sql_query('DELETE FROM '.table_prefix.'logs WHERE time_id=' . $db->escape($_GET['logid'])); }
-          else echo '<div class="warning-box">The user account "'.$_GET['user'].'" has NOT been activated, possibly because the account is already active.</div>';
+          if($session->activate_account($_GET['user'], $row['activation_key'])) { echo '<div class="info-box">The user account "' . htmlspecialchars($_GET['user']) . '" has been activated.</div>'; $db->sql_query('DELETE FROM '.table_prefix.'logs WHERE time_id=' . $db->escape($_GET['logid'])); }
+          else echo '<div class="warning-box">The user account "' . htmlspecialchars($_GET['user']) . '" has NOT been activated, possibly because the account is already active.</div>';
         } else echo '<div class="error-box">Error activating account: '.mysql_error().'</div>';
         break;
       case "sendemail":
-        if($session->send_activation_mail($_GET['user'])) { echo '<div class="info-box">The user "'.$_GET['user'].'" has been sent an e-mail with an activation link.</div>'; $db->sql_query('DELETE FROM '.table_prefix.'logs WHERE time_id=' . $db->escape($_GET['logid'])); }
-        else echo '<div class="error-box">The user account "'.$_GET['user'].'" has not been activated, probably because of a bad SMTP configuration.</div>';
+        if($session->send_activation_mail($_GET['user'])) { echo '<div class="info-box">The user "' . htmlspecialchars($_GET['user']) . '" has been sent an e-mail with an activation link.</div>'; $db->sql_query('DELETE FROM '.table_prefix.'logs WHERE time_id=' . $db->escape($_GET['logid'])); }
+        else echo '<div class="error-box">The user account "' . htmlspecialchars($_GET['user']) . '" has not been activated, probably because of a bad SMTP configuration.</div>';
         break;
       case "deny":
-        $e = $db->sql_query('DELETE FROM '.table_prefix.'logs WHERE log_type=\'admin\' AND action=\'activ_req\' AND edit_summary=\'' . $db->escape($_GET['user']) . '\';');
+        $e = $db->sql_query('DELETE FROM '.table_prefix.'logs WHERE log_type=\'admin\' AND action=\'activ_req\' AND time_id=\'' . $db->escape($_GET['logid']) . '\';');
         if(!$e) echo '<div class="error-box">Error during row deletion: '.mysql_error().'</div>';
-        else echo '<div class="info-box">All activation requests for the user "'.$_GET['user'].'" have been deleted.</div>';
+        else echo '<div class="info-box">All activation requests for the user "' . htmlspecialchars($_GET['user']) . '" have been deleted.</div>';
         break;
     }
   }
--- a/schema.sql	Sun Nov 18 18:44:55 2007 -0500
+++ b/schema.sql	Sun Nov 18 20:37:08 2007 -0500
@@ -105,6 +105,7 @@
   temp_password text,
   temp_password_time int(12) NOT NULL DEFAULT 0,
   user_coppa tinyint(1) NOT NULL DEFAULT 0,
+  user_lang smallint(5) NOT NULL,
   PRIMARY KEY  (user_id)
 ) CHARACTER SET `utf8`;
 
@@ -255,6 +256,38 @@
   PRIMARY KEY ( tag_id )
 ) CHARACTER SET `utf8`;
 
+-- Added in 1.1.1
+
+CREATE TABLE {{TABLE_PREFIX}}lockout(
+  id int(12) NOT NULL auto_increment,
+  ipaddr varchar(40) NOT NULL,
+  action ENUM('credential', 'level') NOT NULL DEFAULT 'credential',
+  timestamp int(12) NOT NULL DEFAULT 0,
+  PRIMARY KEY ( id )
+) CHARACTER SET `utf8`;
+
+-- Added in 1.1.1
+
+CREATE TABLE {{TABLE_PREFIX}}language(
+  lang_id smallint(5) NOT NULL auto_increment,
+  lang_code varchar(16) NOT NULL,
+  lang_name_default varchar(64) NOT NULL,
+  lang_name_native varchar(64) NOT NULL,
+  last_changed int(12) NOT NULL DEFAULT 0,
+  PRIMARY KEY ( lang_id )
+) CHARACTER SET `utf8`;
+
+-- Added in 1.1.1
+
+CREATE TABLE {{TABLE_PREFIX}}language_strings(
+  string_id bigint(15) NOT NULL auto_increment,
+  lang_id smallint(5) NOT NULL,
+  string_category varchar(32) NOT NULL,
+  string_name varchar(64) NOT NULL,
+  string_content longtext NOT NULL,
+  PRIMARY KEY ( string_id )
+);
+
 INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES
   ('site_name', '{{SITE_NAME}}'),
   ('main_page', 'Main_Page'),
@@ -284,7 +317,7 @@
   ('powered_btn', '1');
 
 INSERT INTO {{TABLE_PREFIX}}page_text(page_id, namespace, page_text, char_tag) VALUES
-  ('Main_Page', 'Article', '=== Enano has been successfully installed and is working. ===\n\nIf you can see this message, it means that you\'ve finished the Enano setup process and are ready to start building your website. Congratulations!\n\nTo edit this front page, click the Log In button to the left, enter the credentials you provided during the installation, and click the Edit This Page button that appears on the blue toolbar just above this text. You can also [http://docs.enanocms.org/Help:2.4 learn more] about editing pages.\n\nTo create more pages, use the Create a Page button to the left. If you enabled wiki mode, you don\'t have to log in first, however your IP address will be shown in the page history.\n\nVisit the [http://docs.enanocms.org/Help:Contents Enano documentation project website] to learn more about administering your site effectively and keeping things secure.', '');
+  ('Main_Page', 'Article', '=== Enano has been successfully installed and is working. ===\n\nIf you can see this message, it means that you\'ve finished the Enano setup process and are ready to start building your website. Congratulations!\n\nTo edit this front page, click the Log In button to the left, enter the credentials you provided during the installation, and click the Edit This Page button that appears on the blue toolbar just above this text. You can also [http://docs.enanocms.org/Help:2.4 learn more] about editing pages.\n\nTo create more pages, use the Create a Page button to the left. If you enabled wiki mode, you don\'t have to log in first, however your IP address will be shown in the page history.\n\nVisit the [http://docs.enanocms.org/Help:Contents Enano documentation project website] to learn more about administering your site effectively and keeping things secure.\n\n\'\'\'NOTE:\'\'\' You\'ve just installed an unstable version of Enano. This release is completely unsupported and may contain security issues or serious usability bugs. You should not use this release on a production website. The Enano team will not provide any type of support at all for this experimental release.', '');
 
 INSERT INTO {{TABLE_PREFIX}}pages(page_order, name, urlname, namespace, special, visible, comments_on, protected, delvotes, delvote_ips) VALUES
   (NULL, 'Main Page', 'Main_Page', 'Article', 0, 1, 1, 1, 0, '');
@@ -306,13 +339,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, '[[Main_Page|{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');
 
--- a/themes/oxygen/acledit.tpl	Sun Nov 18 18:44:55 2007 -0500
+++ b/themes/oxygen/acledit.tpl	Sun Nov 18 20:37:08 2007 -0500
@@ -3,10 +3,10 @@
   <table border="0" cellspacing="1" cellpadding="4" style="width: 100%;">
     <tr>
       <th></th>
-      <th style='cursor: pointer;' title="Click to change all columns" onclick="__aclSetAllRadios('1');">Deny</th>
-      <th style='cursor: pointer;' title="Click to change all columns" onclick="__aclSetAllRadios('2');">Disallow</th>
-      <th style='cursor: pointer;' title="Click to change all columns" onclick="__aclSetAllRadios('3');">Wiki mode</th>
-      <th style='cursor: pointer;' title="Click to change all columns" onclick="__aclSetAllRadios('4');">Allow</th>
+      <th style='cursor: pointer;' title="Click to change all columns" onclick="__aclSetAllRadios('1');">{lang:acl_lbl_field_deny}</th>
+      <th style='cursor: pointer;' title="Click to change all columns" onclick="__aclSetAllRadios('2');">{lang:acl_lbl_field_disallow}</th>
+      <th style='cursor: pointer;' title="Click to change all columns" onclick="__aclSetAllRadios('3');">{lang:acl_lbl_field_wikimode}</th>
+      <th style='cursor: pointer;' title="Click to change all columns" onclick="__aclSetAllRadios('4');">{lang:acl_lbl_field_allow}</th>
     </tr>
 <!-- ENDVAR acl_field_begin -->
 <!-- VAR acl_field_item -->
@@ -21,13 +21,7 @@
 <!-- VAR acl_field_end -->
     <tr>
       <td colspan="5" class="row3">
-        <p><b>Permission types:</b></p>
-        <ul>
-          <li><b>Allow</b> means that the user is allowed to access the item</li>
-          <li><b>Wiki mode</b> means the user can access the item if wiki mode is active (per-page wiki mode is taken into account)</li>
-          <li><b>Disallow</b> means the user is denied access unless something allows it.</li>
-          <li><b>Deny</b> means that the user is denied access to the item. This setting overrides all other permissions.</li>
-        </ul>
+        {lang:acl_lbl_help}
       </td>
     </tr>
   </table>
--- a/themes/oxygen/comment.tpl	Sun Nov 18 18:44:55 2007 -0500
+++ b/themes/oxygen/comment.tpl	Sun Nov 18 20:37:08 2007 -0500
@@ -20,7 +20,7 @@
         </table>
       </td>
       <td class="row2">
-        <b>Subject:</b> <span id="subject_{ID}">{SUBJECT}</span>
+        <b>{lang:comment_lbl_subject}</b> <span id="subject_{ID}">{SUBJECT}</span>
       </td>
     </tr>
     <tr>
@@ -42,7 +42,7 @@
     <!-- BEGIN auth_mod -->
     <tr>
       <td class="row1">
-        <b>Moderation options:</b> {MOD_APPROVE_LINK} {MOD_DELETE_LINK}
+        <b>{lang:comment_lbl_mod_options}</b> {MOD_APPROVE_LINK} {MOD_DELETE_LINK}
       </td>
     </tr>
     <!-- END auth_mod -->
--- a/themes/oxygen/header.tpl	Sun Nov 18 18:44:55 2007 -0500
+++ b/themes/oxygen/header.tpl	Sun Nov 18 20:37:08 2007 -0500
@@ -154,7 +154,7 @@
           <td id="mdg-bl"></td>
           <td class="menu_bg">
           <div class="menu_nojs" id="pagebar_main">
-            <div class="label">Page tools</div>
+            <div class="label">{lang:onpage_lbl_pagetools}</div>
             {TOOLBAR}
             <ul>
               {TOOLBAR_EXTRAS}
--- a/upgrade.php	Sun Nov 18 18:44:55 2007 -0500
+++ b/upgrade.php	Sun Nov 18 20:37:08 2007 -0500
@@ -61,7 +61,7 @@
 // Everything related to versions goes here!
 
 // Valid versions to upgrade from
-$valid_versions = Array('1.0b1', '1.0b2', '1.0b3', '1.0b4', '1.0RC1', '1.0RC2', '1.0RC3', '1.0', '1.0.1', '1.0.1.1', '1.0.2b1');
+$valid_versions = Array('1.0b1', '1.0b2', '1.0b3', '1.0b4', '1.0RC1', '1.0RC2', '1.0RC3', '1.0', '1.0.1', '1.0.1.1', '1.0.2b1', '1.0.2', 'Stable1.0ToUnstable1.1');
 
 // Basically a list of dependencies, which should be resolved automatically
 // If, for example, upgrading from 1.0b1 to 1.0RC1 requires one extra query that would not
@@ -76,9 +76,11 @@
     '1.0RC3' => Array('1.0'),
     '1.0' => Array('1.0.1'),
     '1.0.1' => Array('1.0.1.1'),
-    '1.0.1.1' => Array('1.0.2b1')
+    '1.0.1.1' => Array('1.0.2b1'),
+    '1.0.2b1' => Array('Stable1.0ToUnstable1.1'),
+    'Stable1.0ToUnstable1.1' => Array('1.1.1')
   );
-$this_version   = '1.0.2';
+$this_version   = '1.1.1';
 $func_list = Array(
     '1.0' => Array('u_1_0_1_update_del_votes'),
     '1.0b4' => Array('u_1_0_RC1_update_user_ids', 'u_1_0_RC1_add_admins_to_group', 'u_1_0_RC1_alter_files_table', 'u_1_0_RC1_destroy_session_cookie', 'u_1_0_RC1_set_contact_email', 'u_1_0_RC1_update_page_text'), // ,
@@ -445,7 +447,7 @@
     {
       if(isset($_POST['login']))
       {
-        $session->login_without_crypto($_POST['username'], $_POST['password'], false, $ul_admin);
+        $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, $ul_admin);
         if($session->sid_super)
         {
           header('Location: upgrade.php?mode=welcome&auth='.$session->sid_super);
@@ -462,7 +464,7 @@
         <?php
         if(isset($_POST['login']))
         {
-          echo '<tr><td colspan="2"><p style="color: red;">Login failed. Bad password?</p></td></tr>';
+          echo '<tr><td colspan="2"><p style="color: red;">Login failed: '. $result['error'] . '</p></td></tr>';
         }
         ?>
         <tr>
--- a/upgrade.sql	Sun Nov 18 18:44:55 2007 -0500
+++ b/upgrade.sql	Sun Nov 18 20:37:08 2007 -0500
@@ -3,7 +3,18 @@
 -- ALL NON-SQL LINES, even otherwise blank lines, must start with "--" or they will get sent to MySQL!
 -- Common tasks (version numbers)
 DELETE FROM {{TABLE_PREFIX}}config WHERE config_name='enano_version' OR config_name='enano_beta_version' OR config_name='enano_alpha_version' OR config_name='enano_rc_version';
-INSERT INTO {{TABLE_PREFIX}}config (config_name, config_value) VALUES( 'enano_version', '1.0.2' );
+INSERT INTO {{TABLE_PREFIX}}config (config_name, config_value) VALUES( 'enano_version', '1.1.1' );
+---BEGIN Stable1.0ToUnstable1.1---
+-- UPDATE {{TABLE_PREFIX}}groups SET group_id=9998 WHERE group_id=4;
+-- UPDATE {{TABLE_PREFIX}}group_members SET group_id=9998 WHERE group_id=4;
+-- INSERT INTO {{TABLE_PREFIX}}groups(group_id,group_name,group_type,system_group) VALUES(4, 'Regular members', 3, 1);
+CREATE TABLE {{TABLE_PREFIX}}lockout( id int(12) NOT NULL auto_increment, ipaddr varchar(40) NOT NULL, action ENUM('credential', 'level') NOT NULL DEFAULT 'credential', timestamp int(12) NOT NULL DEFAULT 0, PRIMARY KEY ( id ) ) CHARACTER SET `utf8`;
+CREATE TABLE {{TABLE_PREFIX}}language( lang_id smallint(5) NOT NULL auto_increment, lang_code varchar(16) NOT NULL, lang_name_default varchar(64) NOT NULL, lang_name_native varchar(64) NOT NULL, last_changed int(12) NOT NULL DEFAULT 0, PRIMARY KEY ( lang_id ) ) CHARACTER SET `utf8`;
+CREATE TABLE {{TABLE_PREFIX}}language_strings( string_id bigint(15) NOT NULL auto_increment, lang_id smallint(5) NOT NULL, string_category varchar(32) NOT NULL, string_name varchar(64) NOT NULL, string_content longtext NOT NULL, PRIMARY KEY ( string_id ) );
+ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_lang smallint(5) NOT NULL;
+---END Stable1.0ToUnstable1.1---
+---BEGIN 1.0.2---
+---END 1.0.2---
 ---BEGIN 1.0.2b1---
 -- This is really optional, but could reduce confusion if regex page groups get truncated for no apparent reason.
 ALTER TABLE {{TABLE_PREFIX}}page_groups MODIFY COLUMN pg_target text DEFAULT NULL;