You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1574 lines
55 KiB

svn co http://punbb.informer.com/svn/punbb/trunk/
svn diff -r1168:1655
Index: lang/English/install.php
===================================================================
--- lang/English/install.php (revision 1168)
+++ lang/English/install.php (revision 1655)
@@ -84,7 +84,6 @@
'Default language help' => '(If you remove a language pack you must update this setting)',
'Default announce heading' => 'Sample announcement',
'Default announce message' => '<p>Enter your announcement here.</p>',
-'Default maint message' => "The forums are temporarily down for maintenance. Please try again in a few minutes.<br />\\n<br />\\n/Administrator",
'Default rules' => 'Enter your rules here.',
'Default category name' => 'Test category',
'Default forum name' => 'Test forum',
Index: lang/English/admin_reindex.php
===================================================================
--- lang/English/admin_reindex.php (revision 1168)
+++ lang/English/admin_reindex.php (revision 1655)
@@ -14,8 +14,8 @@
'Starting post info' => 'The post ID to start rebuilding at. The default value is the first available ID in the database. Normally you would not want to change this.',
'Empty index' => 'Empty index',
'Empty index info' => 'Empty search index before rebuilding (see below).',
-'Rebuilding index title' => 'Rebuilding search index &#8230;',
-'Rebuilding index' => 'Rebuilding index &#8230; This might be a good time to put on some coffee :-)',
+'Rebuilding index title' => 'Rebuilding search index…',
+'Rebuilding index' => 'Rebuilding index… This might be a good time to put on some coffee :-)',
'Processing post' => 'Processing post <strong>%s</strong> in topic <strong>%s</strong>.',
'Javascript redirect' => 'JavaScript redirect unsuccessful.',
'Click to continue' => 'Click here to continue',
Index: lang/English/admin_settings.php
===================================================================
--- lang/English/admin_settings.php (revision 1168)
+++ lang/English/admin_settings.php (revision 1655)
@@ -51,7 +51,7 @@
'Setup links legend' => 'Menu items',
'Enter links label' => 'Enter your links',
'Error no board title' => 'You must enter a board title.',
-'Error timeout value' => 'The value of "Timeout online" must be smaller than the value of "Timeout visit".',
+'Error timeout value' => 'The value of "Online timeout" must be smaller than the value of "Visit timeout".',
// Features section
@@ -164,7 +164,7 @@
'Allow form e-mail label' => 'Hide e-mail address but allow e-mail via the forum.',
'Disallow form e-mail label' => 'Hide e-mail address and disallow e-mail via the forum.',
'Registration rules' => 'Forum rules (enable and compose forum rules)',
-'Registration rules info' => 'You may require new users to agree to a set of rules when registering. The rules will always be available through a link in the navigation table at the top of every page. You may enable the use of rules and then compose your rules below.',
+'Registration rules info' => 'You may require new users to agree to a set of rules when registering. The rules will always be available through a link in the navigation menu at the top of every page. You may enable the use of rules and then compose your rules below.',
'Registration rules legend' => 'Forum rules',
'Require rules' => 'Use rules',
'Require rules label' => 'Users must agree to forum rules before registering.',
@@ -196,7 +196,7 @@
// Maintenance section
'Maintenance head' => 'Setup maintenance message and activate maintenance mode',
-'Maintenance mode info' => '<strong>IMPORTANT!</strong> Putting the board into maintenance mode means it will only be available to administrators. This should be used if the board needs to taken down temporarily for maintenance.',
+'Maintenance mode info' => '<strong>IMPORTANT!</strong> Putting the board into maintenance mode means it will only be available to administrators. This should be used if the board needs to be taken down temporarily for maintenance.',
'Maintenance mode warn' => '<strong>WARNING!</strong> DO NOT LOGOUT when the board is in maintenance mode. You will not be able to login again.',
'Maintenance legend' => 'Maintenance',
'Maintenance mode' => 'Maintenance mode',
Index: lang/English/common.php
===================================================================
--- lang/English/common.php (revision 1168)
+++ lang/English/common.php (revision 1655)
@@ -87,6 +87,8 @@
'Info separator' => ' ', // e.g. 1 Page | 10 Topics
'Powered by' => 'Powered by <strong>%s</strong>, supported by <strong>%s</strong>.',
'Maintenance' => 'Maintenance',
+'Installed extension' => 'The %s official extension is installed. Copyright &copy; 2003&ndash;2009 <a href="http://punbb.informer.com/">PunBB</a>.',
+'Installed extensions' => 'Currently installed <span id="extensions-used" title="%s">%s official extensions</span>. Copyright &copy; 2003&ndash;2009 <a href="http://punbb.informer.com/">PunBB</a>.',
// CSRF confirmation form
'Confirm' => 'Confirm', // Button
Index: include/dblayer/common_db.php
===================================================================
--- include/dblayer/common_db.php (revision 1168)
+++ include/dblayer/common_db.php (revision 1655)
@@ -32,10 +32,18 @@
case 'mysql':
require FORUM_ROOT.'include/dblayer/mysql.php';
break;
+
+ case 'mysql_innodb':
+ require FORUM_ROOT.'include/dblayer/mysql_innodb.php';
+ break;
case 'mysqli':
require FORUM_ROOT.'include/dblayer/mysqli.php';
break;
+
+ case 'mysqli_innodb':
+ require FORUM_ROOT.'include/dblayer/mysqli_innodb.php';
+ break;
case 'pgsql':
require FORUM_ROOT.'include/dblayer/pgsql.php';
Index: include/dblayer/mysql_innodb.php
===================================================================
--- include/dblayer/mysql_innodb.php (revision 0)
+++ include/dblayer/mysql_innodb.php (revision 1655)
@@ -0,0 +1,363 @@
+<?php
+/**
+ * A database layer class supporting transactions that relies on the MySQL PHP extension.
+ *
+ * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org
+ * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
+ * @package PunBB
+ */
+
+
+// Make sure we have built in support for MySQL
+if (!function_exists('mysql_connect'))
+ exit('This PHP environment doesn\'t have MySQL support built in. MySQL support is required if you want to use a MySQL database to run this forum. Consult the PHP documentation for further assistance.');
+
+
+class DBLayer
+{
+ var $prefix;
+ var $link_id;
+ var $query_result;
+ var $in_transaction = 0;
+
+ var $saved_queries = array();
+ var $num_queries = 0;
+
+ var $datatype_transformations = array(
+ '/^SERIAL$/' => 'INT(10) UNSIGNED AUTO_INCREMENT'
+ );
+
+
+ function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
+ {
+ $this->prefix = $db_prefix;
+
+ if ($p_connect)
+ $this->link_id = @mysql_pconnect($db_host, $db_username, $db_password);
+ else
+ $this->link_id = @mysql_connect($db_host, $db_username, $db_password);
+
+ if ($this->link_id)
+ {
+ if (!@mysql_select_db($db_name, $this->link_id))
+ error('Unable to select database. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
+ }
+ else
+ error('Unable to connect to MySQL server. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
+
+ // Setup the client-server character set (UTF-8)
+ if (!defined('FORUM_NO_SET_NAMES'))
+ $this->set_names('utf8');
+
+ return $this->link_id;
+ }
+
+
+ function start_transaction()
+ {
+ ++$this->in_transaction;
+
+ mysql_query('START TRANSACTION', $this->link_id);
+ return;
+ }
+
+
+ function end_transaction()
+ {
+ --$this->in_transaction;
+
+ mysql_query('COMMIT', $this->link_id);
+ return;
+ }
+
+
+ function query($sql, $unbuffered = false)
+ {
+ if (strlen($sql) > 140000)
+ exit('Insane query. Aborting.');
+
+ if (defined('FORUM_SHOW_QUERIES'))
+ $q_start = get_microtime();
+
+ if ($unbuffered)
+ $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
+ else
+ $this->query_result = @mysql_query($sql, $this->link_id);
+
+ if ($this->query_result)
+ {
+ if (defined('FORUM_SHOW_QUERIES'))
+ $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
+
+ ++$this->num_queries;
+
+ return $this->query_result;
+ }
+ else
+ {
+ if (defined('FORUM_SHOW_QUERIES'))
+ $this->saved_queries[] = array($sql, 0);
+
+ // Rollback transaction
+ if ($this->in_transaction)
+ mysql_query('ROLLBACK', $this->link_id);
+
+ --$this->in_transaction;
+
+ return false;
+ }
+ }
+
+
+ function result($query_id = 0, $row = 0, $col = 0)
+ {
+ return ($query_id) ? @mysql_result($query_id, $row, $col) : false;
+ }
+
+
+ function fetch_assoc($query_id = 0)
+ {
+ return ($query_id) ? @mysql_fetch_assoc($query_id) : false;
+ }
+
+
+ function fetch_row($query_id = 0)
+ {
+ return ($query_id) ? @mysql_fetch_row($query_id) : false;
+ }
+
+
+ function num_rows($query_id = 0)
+ {
+ return ($query_id) ? @mysql_num_rows($query_id) : false;
+ }
+
+
+ function affected_rows()
+ {
+ return ($this->link_id) ? @mysql_affected_rows($this->link_id) : false;
+ }
+
+
+ function insert_id()
+ {
+ return ($this->link_id) ? @mysql_insert_id($this->link_id) : false;
+ }
+
+
+ function get_num_queries()
+ {
+ return $this->num_queries;
+ }
+
+
+ function get_saved_queries()
+ {
+ return $this->saved_queries;
+ }
+
+
+ function free_result($query_id = false)
+ {
+ return ($query_id) ? @mysql_free_result($query_id) : false;
+ }
+
+
+ function escape($str)
+ {
+ if (is_array($str))
+ return '';
+ else if (function_exists('mysql_real_escape_string'))
+ return mysql_real_escape_string($str, $this->link_id);
+ else
+ return mysql_escape_string($str);
+ }
+
+
+ function error()
+ {
+ $result['error_sql'] = @current(@end($this->saved_queries));
+ $result['error_no'] = @mysql_errno($this->link_id);
+ $result['error_msg'] = @mysql_error($this->link_id);
+
+ return $result;
+ }
+
+
+ function close()
+ {
+ if ($this->link_id)
+ {
+ if ($this->query_result)
+ @mysql_free_result($this->query_result);
+
+ return @mysql_close($this->link_id);
+ }
+ else
+ return false;
+ }
+
+
+ function set_names($names)
+ {
+ return $this->query('SET NAMES \''.$this->escape($names).'\'');
+ }
+
+
+ function get_version()
+ {
+ $result = $this->query('SELECT VERSION()');
+
+ return array(
+ 'name' => 'MySQL Standard (InnoDB)',
+ 'version' => preg_replace('/^([^-]+).*$/', '\\1', $this->result($result))
+ );
+ }
+
+
+ function table_exists($table_name, $no_prefix = false)
+ {
+ $result = $this->query('SHOW TABLES LIKE \''.($no_prefix ? '' : $this->prefix).$this->escape($table_name).'\'');
+ return $this->num_rows($result) > 0;
+ }
+
+
+ function field_exists($table_name, $field_name, $no_prefix = false)
+ {
+ $result = $this->query('SHOW COLUMNS FROM '.($no_prefix ? '' : $this->prefix).$table_name.' LIKE \''.$this->escape($field_name).'\'');
+ return $this->num_rows($result) > 0;
+ }
+
+
+ function index_exists($table_name, $index_name, $no_prefix = false)
+ {
+ $exists = false;
+
+ $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name);
+ while ($cur_index = $this->fetch_assoc($result))
+ {
+ if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)
+ {
+ $exists = true;
+ break;
+ }
+ }
+
+ return $exists;
+ }
+
+
+ function create_table($table_name, $schema, $no_prefix = false)
+ {
+ if ($this->table_exists($table_name, $no_prefix))
+ return;
+
+ $query = 'CREATE TABLE '.($no_prefix ? '' : $this->prefix).$table_name." (\n";
+
+ // Go through every schema element and add it to the query
+ foreach ($schema['FIELDS'] as $field_name => $field_data)
+ {
+ $field_data['datatype'] = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_data['datatype']);
+
+ $query .= $field_name.' '.$field_data['datatype'];
+
+ if (isset($field_data['collation']))
+ $query .= 'CHARACTER SET utf8 COLLATE utf8_'.$field_data['collation'];
+
+ if (!$field_data['allow_null'])
+ $query .= ' NOT NULL';
+
+ if (isset($field_data['default']))
+ $query .= ' DEFAULT '.$field_data['default'];
+
+ $query .= ",\n";
+ }
+
+ // If we have a primary key, add it
+ if (isset($schema['PRIMARY KEY']))
+ $query .= 'PRIMARY KEY ('.implode(',', $schema['PRIMARY KEY']).'),'."\n";
+
+ // Add unique keys
+ if (isset($schema['UNIQUE KEYS']))
+ {
+ foreach ($schema['UNIQUE KEYS'] as $key_name => $key_fields)
+ $query .= 'UNIQUE KEY '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$key_name.'('.implode(',', $key_fields).'),'."\n";
+ }
+
+ // Add indexes
+ if (isset($schema['INDEXES']))
+ {
+ foreach ($schema['INDEXES'] as $index_name => $index_fields)
+ $query .= 'KEY '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name.'('.implode(',', $index_fields).'),'."\n";
+ }
+
+ // We remove the last two characters (a newline and a comma) and add on the ending
+ $query = substr($query, 0, strlen($query) - 2)."\n".') ENGINE = '.(isset($schema['ENGINE']) ? $schema['ENGINE'] : 'InnoDB').' CHARACTER SET utf8';
+
+ $this->query($query) or error(__FILE__, __LINE__);
+ }
+
+
+ function drop_table($table_name, $no_prefix = false)
+ {
+ if (!$this->table_exists($table_name, $no_prefix))
+ return;
+
+ $this->query('DROP TABLE '.($no_prefix ? '' : $this->prefix).$table_name) or error(__FILE__, __LINE__);
+ }
+
+
+ function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false)
+ {
+ if ($this->field_exists($table_name, $field_name, $no_prefix))
+ return;
+
+ $field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type);
+
+ if ($default_value !== null && !is_int($default_value) && !is_float($default_value))
+ $default_value = '\''.$this->escape($default_value).'\'';
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) or error(__FILE__, __LINE__);
+ }
+
+
+ function alter_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false)
+ {
+ if (!$this->field_exists($table_name, $field_name, $no_prefix))
+ return;
+
+ $field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type);
+
+ if ($default_value !== null && !is_int($default_value) && !is_float($default_value))
+ $default_value = '\''.$this->escape($default_value).'\'';
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' MODIFY '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) or error(__FILE__, __LINE__);
+ }
+
+
+ function drop_field($table_name, $field_name, $no_prefix = false)
+ {
+ if (!$this->field_exists($table_name, $field_name, $no_prefix))
+ return;
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' DROP '.$field_name) or error(__FILE__, __LINE__);
+ }
+
+
+ function add_index($table_name, $index_name, $index_fields, $unique = false, $no_prefix = false)
+ {
+ if ($this->index_exists($table_name, $index_name, $no_prefix))
+ return;
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.($unique ? 'UNIQUE ' : '').'INDEX '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name.' ('.implode(',', $index_fields).')') or error(__FILE__, __LINE__);
+ }
+
+
+ function drop_index($table_name, $index_name, $no_prefix = false)
+ {
+ if (!$this->index_exists($table_name, $index_name, $no_prefix))
+ return;
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' DROP INDEX '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) or error(__FILE__, __LINE__);
+ }
+}
Index: include/dblayer/sqlite.php
===================================================================
--- include/dblayer/sqlite.php (revision 1168)
+++ include/dblayer/sqlite.php (revision 1655)
@@ -579,7 +579,8 @@
if (!empty($table['indices']))
{
foreach ($table['indices'] as $cur_index)
- $this->query($cur_index) or error(__FILE__, __LINE__);
+ if (!preg_match('#\(.*'.$field_name.'.*\)#', $cur_index))
+ $this->query($cur_index) or error(__FILE__, __LINE__);
}
//Copy content back
Index: include/dblayer/mysqli_innodb.php
===================================================================
--- include/dblayer/mysqli_innodb.php (revision 0)
+++ include/dblayer/mysqli_innodb.php (revision 1655)
@@ -0,0 +1,363 @@
+<?php
+/**
+ * A database layer class supporting transactions that relies on the MySQLi PHP extension.
+ *
+ * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org
+ * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
+ * @package PunBB
+ */
+
+
+// Make sure we have built in support for MySQL
+if (!function_exists('mysqli_connect'))
+ exit('This PHP environment doesn\'t have Improved MySQL (mysqli) support built in. Improved MySQL support is required if you want to use a MySQL 4.1 (or later) database to run this forum. Consult the PHP documentation for further assistance.');
+
+
+class DBLayer
+{
+ var $prefix;
+ var $link_id;
+ var $query_result;
+
+ var $saved_queries = array();
+ var $num_queries = 0;
+ var $in_transaction = 0;
+
+ var $datatype_transformations = array(
+ '/^SERIAL$/' => 'INT(10) UNSIGNED AUTO_INCREMENT'
+ );
+
+
+ function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $foo)
+ {
+ $this->prefix = $db_prefix;
+
+ // Was a custom port supplied with $db_host?
+ if (strpos($db_host, ':') !== false)
+ list($db_host, $db_port) = explode(':', $db_host);
+
+ if (isset($db_port))
+ $this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name, $db_port);
+ else
+ $this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name);
+
+ if (!$this->link_id)
+ error('Unable to connect to MySQL and select database. MySQL reported: '.mysqli_connect_error(), __FILE__, __LINE__);
+
+ // Setup the client-server character set (UTF-8)
+ if (!defined('FORUM_NO_SET_NAMES'))
+ $this->set_names('utf8');
+
+ return $this->link_id;
+ }
+
+
+ function start_transaction()
+ {
+ ++$this->in_transaction;
+
+ mysqli_query($this->link_id, 'START TRANSACTION');
+ return;
+ }
+
+
+ function end_transaction()
+ {
+ --$this->in_transaction;
+
+ mysqli_query($this->link_id, 'COMMIT');
+ return;
+ }
+
+
+ function query($sql, $unbuffered = false)
+ {
+ if (strlen($sql) > 140000)
+ exit('Insane query. Aborting.');
+
+ if (defined('FORUM_SHOW_QUERIES'))
+ $q_start = get_microtime();
+
+ $this->query_result = @mysqli_query($this->link_id, $sql);
+
+ if ($this->query_result)
+ {
+ if (defined('FORUM_SHOW_QUERIES'))
+ $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
+
+ ++$this->num_queries;
+
+ return $this->query_result;
+ }
+ else
+ {
+ if (defined('FORUM_SHOW_QUERIES'))
+ $this->saved_queries[] = array($sql, 0);
+
+ // Rollback transaction
+ if ($this->in_transaction)
+ mysqli_query($this->link_id, 'ROLLBACK');
+
+ --$this->in_transaction;
+
+ return false;
+ }
+ }
+
+
+ function result($query_id = 0, $row = 0, $col = 0)
+ {
+ if ($query_id)
+ {
+ if ($row)
+ @mysqli_data_seek($query_id, $row);
+
+ $cur_row = @mysqli_fetch_row($query_id);
+ return $cur_row[$col];
+ }
+ else
+ return false;
+ }
+
+
+ function fetch_assoc($query_id = 0)
+ {
+ return ($query_id) ? @mysqli_fetch_assoc($query_id) : false;
+ }
+
+
+ function fetch_row($query_id = 0)
+ {
+ return ($query_id) ? @mysqli_fetch_row($query_id) : false;
+ }
+
+
+ function num_rows($query_id = 0)
+ {
+ return ($query_id) ? @mysqli_num_rows($query_id) : false;
+ }
+
+
+ function affected_rows()
+ {
+ return ($this->link_id) ? @mysqli_affected_rows($this->link_id) : false;
+ }
+
+
+ function insert_id()
+ {
+ return ($this->link_id) ? @mysqli_insert_id($this->link_id) : false;
+ }
+
+
+ function get_num_queries()
+ {
+ return $this->num_queries;
+ }
+
+
+ function get_saved_queries()
+ {
+ return $this->saved_queries;
+ }
+
+
+ function free_result($query_id = false)
+ {
+ return ($query_id) ? @mysqli_free_result($query_id) : false;
+ }
+
+
+ function escape($str)
+ {
+ return is_array($str) ? '' : mysqli_real_escape_string($this->link_id, $str);
+ }
+
+
+ function error()
+ {
+ $result['error_sql'] = @current(@end($this->saved_queries));
+ $result['error_no'] = @mysqli_errno($this->link_id);
+ $result['error_msg'] = @mysqli_error($this->link_id);
+
+ return $result;
+ }
+
+
+ function close()
+ {
+ if ($this->link_id)
+ {
+ if ($this->query_result)
+ @mysqli_free_result($this->query_result);
+
+ return @mysqli_close($this->link_id);
+ }
+ else
+ return false;
+ }
+
+
+ function set_names($names)
+ {
+ return $this->query('SET NAMES \''.$this->escape($names).'\'');
+ }
+
+
+ function get_version()
+ {
+ $result = $this->query('SELECT VERSION()');
+
+ return array(
+ 'name' => 'MySQL Improved (InnoDB)',
+ 'version' => preg_replace('/^([^-]+).*$/', '\\1', $this->result($result))
+ );
+ }
+
+
+ function table_exists($table_name, $no_prefix = false)
+ {
+ $result = $this->query('SHOW TABLES LIKE \''.($no_prefix ? '' : $this->prefix).$this->escape($table_name).'\'');
+ return $this->num_rows($result) > 0;
+ }
+
+
+ function field_exists($table_name, $field_name, $no_prefix = false)
+ {
+ $result = $this->query('SHOW COLUMNS FROM '.($no_prefix ? '' : $this->prefix).$table_name.' LIKE \''.$this->escape($field_name).'\'');
+ return $this->num_rows($result) > 0;
+ }
+
+
+ function index_exists($table_name, $index_name, $no_prefix = false)
+ {
+ $exists = false;
+
+ $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name);
+ while ($cur_index = $this->fetch_assoc($result))
+ {
+ if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name)
+ {
+ $exists = true;
+ break;
+ }
+ }
+
+ return $exists;
+ }
+
+
+ function create_table($table_name, $schema, $no_prefix = false)
+ {
+ if ($this->table_exists($table_name, $no_prefix))
+ return;
+
+ $query = 'CREATE TABLE '.($no_prefix ? '' : $this->prefix).$table_name." (\n";
+
+ // Go through every schema element and add it to the query
+ foreach ($schema['FIELDS'] as $field_name => $field_data)
+ {
+ $field_data['datatype'] = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_data['datatype']);
+
+ $query .= $field_name.' '.$field_data['datatype'];
+
+ if (isset($field_data['collation']))
+ $query .= 'CHARACTER SET utf8 COLLATE utf8_'.$field_data['collation'];
+
+ if (!$field_data['allow_null'])
+ $query .= ' NOT NULL';
+
+ if (isset($field_data['default']))
+ $query .= ' DEFAULT '.$field_data['default'];
+
+ $query .= ",\n";
+ }
+
+ // If we have a primary key, add it
+ if (isset($schema['PRIMARY KEY']))
+ $query .= 'PRIMARY KEY ('.implode(',', $schema['PRIMARY KEY']).'),'."\n";
+
+ // Add unique keys
+ if (isset($schema['UNIQUE KEYS']))
+ {
+ foreach ($schema['UNIQUE KEYS'] as $key_name => $key_fields)
+ $query .= 'UNIQUE KEY '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$key_name.'('.implode(',', $key_fields).'),'."\n";
+ }
+
+ // Add indexes
+ if (isset($schema['INDEXES']))
+ {
+ foreach ($schema['INDEXES'] as $index_name => $index_fields)
+ $query .= 'KEY '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name.'('.implode(',', $index_fields).'),'."\n";
+ }
+
+ // We remove the last two characters (a newline and a comma) and add on the ending
+ $query = substr($query, 0, strlen($query) - 2)."\n".') ENGINE = '.(isset($schema['ENGINE']) ? $schema['ENGINE'] : 'InnoDB').' CHARACTER SET utf8';
+
+ $this->query($query) or error(__FILE__, __LINE__);
+ }
+
+
+ function drop_table($table_name, $no_prefix = false)
+ {
+ if (!$this->table_exists($table_name, $no_prefix))
+ return;
+
+ $this->query('DROP TABLE '.($no_prefix ? '' : $this->prefix).$table_name) or error(__FILE__, __LINE__);
+ }
+
+
+ function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false)
+ {
+ if ($this->field_exists($table_name, $field_name, $no_prefix))
+ return;
+
+ $field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type);
+
+ if ($default_value !== null && !is_int($default_value) && !is_float($default_value))
+ $default_value = '\''.$this->escape($default_value).'\'';
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) or error(__FILE__, __LINE__);
+ }
+
+
+ function alter_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false)
+ {
+ if (!$this->field_exists($table_name, $field_name, $no_prefix))
+ return;
+
+ $field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type);
+
+ if ($default_value !== null && !is_int($default_value) && !is_float($default_value))
+ $default_value = '\''.$this->escape($default_value).'\'';
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' MODIFY '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) or error(__FILE__, __LINE__);
+ }
+
+
+ function drop_field($table_name, $field_name, $no_prefix = false)
+ {
+ if (!$this->field_exists($table_name, $field_name, $no_prefix))
+ return;
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' DROP '.$field_name) or error(__FILE__, __LINE__);
+ }
+
+
+ function add_index($table_name, $index_name, $index_fields, $unique = false, $no_prefix = false)
+ {
+ if ($this->index_exists($table_name, $index_name, $no_prefix))
+ return;
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.($unique ? 'UNIQUE ' : '').'INDEX '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name.' ('.implode(',', $index_fields).')') or error(__FILE__, __LINE__);
+ }
+
+
+ function drop_index($table_name, $index_name, $no_prefix = false)
+ {
+ if (!$this->index_exists($table_name, $index_name, $no_prefix))
+ return;
+
+ $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' DROP INDEX '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) or error(__FILE__, __LINE__);
+ }
+}
Index: include/parser.php
===================================================================
--- include/parser.php (revision 1168)
+++ include/parser.php (revision 1655)
@@ -44,11 +44,11 @@
if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false)
{
list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors);
- $text = implode("\0", $outside);
+ $text = implode("\xc1", $outside);
}
// Tidy up lists
- $pattern = array('/\[list(?:=([1a\*]))?\]((?>(?:(?!\[list(?:=(?:[1a\*]))\]|\[\/list\]).+?)|(?R))*)\[\/list\]/ems');
+ $pattern = array('%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%ise');
$replace = array('preparse_list_tag(\'$2\', \'$1\', $errors)');
$text = preg_replace($pattern, $replace, $text);
@@ -60,7 +60,7 @@
// If we split up the message before we have to concatenate it together again (code tags)
if (isset($inside))
{
- $outside = explode("\0", $text);
+ $outside = explode("\xc1", $text);
$text = '';
$num_tokens = count($outside);
@@ -520,7 +520,7 @@
if (strpos($content,'[list') !== false)
{
- $pattern = array('/\[list(?:=([1a\*]))?\]((?>(?:(?!\[list(?:=(?:[1a\*]))\]|\[\/list\]).+?)|(?R))*)\[\/list\]/ems');
+ $pattern = array('%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%ise');
$replace = array('preparse_list_tag(\'$2\', \'$1\', $errors)');
$content = preg_replace($pattern, $replace, $content);
}
@@ -592,7 +592,7 @@
// Ok, not very pretty :-)
if (!$bbcode)
- $link = ($link == '' || $link == $url) ? ((utf8_strlen($url) > 55) ? utf8_substr($url, 0 , 39).' &#133; '.utf8_substr($url, -10) : $url) : stripslashes($link);
+ $link = ($link == '' || $link == $url) ? ((utf8_strlen($url) > 55) ? utf8_substr($url, 0 , 39).' … '.utf8_substr($url, -10) : $url) : stripslashes($link);
$return = ($hook = get_hook('ps_handle_url_tag_end')) ? eval($hook) : null;
if ($return != null)
@@ -649,7 +649,7 @@
if (strpos($content,'[list') !== false)
{
- $pattern = array('/\[list(?:=([1a\*]))?\]((?>(?:(?!\[list(?:=(?:[1a\*]))\]|\[\/list\]).+?)|(?R))*)\[\/list\]/ems');
+ $pattern = array('%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%ise');
$replace = array('handle_list_tag(\'$2\', \'$1\')');
$content = preg_replace($pattern, $replace, $content);
}
@@ -688,7 +688,7 @@
if (!$is_signature)
{
- $pattern[] = '/\[list(?:=([1a\*]))?\]((?>(?:(?!\[list(?:=(?:[1a\*]))\]|\[\/list\]).+?)|(?R))*)\[\/list\]/ems';
+ $pattern[] = '%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%ise';
$replace[] = 'handle_list_tag(\'$2\', \'$1\')';
}
@@ -752,7 +752,7 @@
{
$text = ' '.$text;
- $text = preg_replace('#(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(https?|ftp|news){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\s\[]*[^\s.,?!\[;:-]?)?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])#ie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5://$6\', \'$5://$6\', true).stripslashes(\'$4$10$11$12\')', $text);
+ $text = preg_replace('#(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(https?|ftp|news){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\s\[]*[^\s.,?!\[;:-])?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])#ie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5://$6\', \'$5://$6\', true).stripslashes(\'$4$10$11$12\')', $text);
$text = preg_replace('#(?<=[\s\]\)])(<)?(\[)?(\()?([\'"]?)(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\s\[]*[^\s.,?!\[;:-])?)\4(?(3)(\)))(?(2)(\]))(?(1)(>))(?![^\s]*\[/(?:url|img)\])#ie', 'stripslashes(\'$1$2$3$4\').handle_url_tag(\'$5.$6\', \'$5.$6\', true).stripslashes(\'$4$10$11$12\')', $text);
return substr($text, 1);
@@ -813,7 +813,7 @@
if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false)
{
list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors);
- $text = implode("\0", $outside);
+ $text = implode("\xc1", $outside);
}
$return = ($hook = get_hook('ps_parse_message_post_split')) ? eval($hook) : null;
@@ -842,7 +842,7 @@
// If we split up the message before we have to concatenate it together again (code tags)
if (isset($inside))
{
- $outside = explode("\0", $text);
+ $outside = explode("\xc1", $text);
$text = '';
$num_tokens = count($outside);
Index: include/cache.php
===================================================================
--- include/cache.php (revision 1168)
+++ include/cache.php (revision 1655)
@@ -297,7 +297,7 @@
$output = array();
while ($cur_hook = $forum_db->fetch_assoc($result))
{
- $load_ext_info = '$ext_info_stack[] = array('."\n".
+ $load_ext_info = '$GLOBALS[\'ext_info_stack\'][] = array('."\n".
'\'id\' => \''.$cur_hook['extension_id'].'\','."\n".
'\'path\' => FORUM_ROOT.\'extensions/'.$cur_hook['extension_id'].'\','."\n".
'\'url\' => $GLOBALS[\'base_url\'].\'/extensions/'.$cur_hook['extension_id'].'\','."\n".
@@ -316,8 +316,8 @@
'\'url\' => $GLOBALS[\'base_url\'].\'/extensions/'.$cur_dependency.'\'),'."\n";
}
- $load_ext_info .= ')'."\n".');'."\n".'$ext_info = $ext_info_stack[count($ext_info_stack) - 1];';
- $unload_ext_info = 'array_pop($ext_info_stack);'."\n".'$ext_info = empty($ext_info_stack) ? array() : $ext_info_stack[count($ext_info_stack) - 1];';
+ $load_ext_info .= ')'."\n".');'."\n".'$ext_info = $GLOBALS[\'ext_info_stack\'][count($GLOBALS[\'ext_info_stack\']) - 1];';
+ $unload_ext_info = 'array_pop($GLOBALS[\'ext_info_stack\']);'."\n".'$ext_info = empty($GLOBALS[\'ext_info_stack\']) ? array() : $GLOBALS[\'ext_info_stack\'][count($GLOBALS[\'ext_info_stack\']) - 1];';
$output[$cur_hook['id']][] = $load_ext_info."\n\n".$cur_hook['code']."\n\n".$unload_ext_info."\n";
}
Index: include/functions.php
===================================================================
--- include/functions.php (revision 1168)
+++ include/functions.php (revision 1655)
@@ -404,6 +404,8 @@
if ($type == FORUM_FT_DATETIME || $type == FORUM_FT_TIME)
$formatted_time .= gmdate($time_format, $timestamp);
+ ($hook = get_hook('fn_format_time_end')) ? eval($hook) : null;
+
return $formatted_time;
}
@@ -749,7 +751,7 @@
global $forum_config, $forum_user;
static $lang_url_replace, $forum_reserved_strings;
- if (!isset($lang_replace))
+ if (!isset($lang_url_replace))
require FORUM_ROOT.'lang/'.$forum_user['language'].'/url_replace.php';
if (!isset($forum_reserved_strings))
@@ -772,6 +774,8 @@
foreach ($forum_reserved_strings as $match => $replace)
if ($str == $match)
return $replace;
+ else if ($match != '')
+ $str = str_replace($match, $replace, $str);
return $str;
}
@@ -1457,6 +1461,9 @@
if ($cur_ban['username'] != '' && utf8_strtolower($forum_user['username']) == utf8_strtolower($cur_ban['username']))
$is_banned = true;
+ if ($cur_ban['email'] != '' && $forum_user['email'] == $cur_ban['email'])
+ $is_banned = true;
+
if ($cur_ban['ip'] != '')
{
$cur_ban_ips = explode(' ', $cur_ban['ip']);
@@ -1539,7 +1546,7 @@
else
{
// If the entry is older than "o_timeout_visit", update last_visit for the user in question, then delete him/her from the online list
- if ($cur_user['idle'] != '0')
+ if ($cur_user['logged'] < ($now - $forum_config['o_timeout_visit']))
{
$query = array(
'UPDATE' => 'users',
@@ -2777,15 +2784,10 @@
// START SUBST - <!-- forum_head -->
+
ob_start();
-?>
-<title><?php echo $lang_common['Maintenance'].$lang_common['Title separator'].forum_htmlencode($forum_config['o_board_title']) ?></title>
-<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $base_url ?>/style/<?php echo $forum_user['style'] ?>/<?php echo $forum_user['style'].'.css' ?>" />
-<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $base_url ?>/style/<?php echo $forum_user['style'] ?>/<?php echo $forum_user['style'].'_cs.css' ?>" />
-<!--[if lte IE 6]><link rel="stylesheet" type="text/css" href="<?php echo $base_url ?>/style/<?php echo $forum_user['style'] ?>/<?php echo $forum_user['style'].'_fix.css' ?>" /><![endif]-->
-<!--[if IE 7]><link rel="stylesheet" type="text/css" href="<?php echo $base_url ?>/style/<?php echo $forum_user['style'] ?>/<?php echo $forum_user['style'].'_fix7.css' ?>" /><![endif]-->
-<?php
+ require FORUM_ROOT.'style/'.$forum_user['style'].'/'.$forum_user['style'].'.php';
$tpl_temp = forum_trim(ob_get_contents());
$tpl_maint = str_replace('<!-- forum_head -->', $tpl_temp, $tpl_maint);
Index: include/essentials.php
===================================================================
--- include/essentials.php (revision 1168)
+++ include/essentials.php (revision 1655)
@@ -9,7 +9,7 @@
// Enable DEBUG mode by removing // from the following line
-//define('FORUM_DEBUG', 1);
+define('FORUM_DEBUG', 1);
if (!defined('FORUM_ROOT'))
exit('The constant FORUM_ROOT must be defined and point to a valid PunBB installation root directory.');
Index: profile.php
===================================================================
--- profile.php (revision 1168)
+++ profile.php (revision 1655)
@@ -959,7 +959,7 @@
$form['date_format'] = (isset($form['date_format'])) ? intval($form['date_format']) : 0;
$form['email_setting'] = intval($form['email_setting']);
- if ($form['email_setting'] < 0 && $form['email_setting'] > 2) $form['email_setting'] = 1;
+ if ($form['email_setting'] < 0 || $form['email_setting'] > 2) $form['email_setting'] = 1;
if ($forum_config['o_subscriptions'] == '1')
{
@@ -2256,7 +2256,7 @@
$forum_page['crumbs'] = array(
array($forum_config['o_board_title'], forum_link($forum_url['index'])),
array(sprintf($lang_profile['Users profile'], $user['username']), forum_link($forum_url['user'], $id)),
- array($lang_profile['Section signature'],forum_link($forum_url['profile_signature'], $id))
+ array($lang_profile['Section signature'], forum_link($forum_url['profile_signature'], $id))
);
// Setup the form
Index: moderate.php
===================================================================
--- moderate.php (revision 1168)
+++ moderate.php (revision 1655)
@@ -63,7 +63,7 @@
// Get some info about the forum we're moderating
$query = array(
- 'SELECT' => 'f.forum_name, f.redirect_url, f.num_topics, f.moderators',
+ 'SELECT' => 'f.forum_name, f.redirect_url, f.num_topics, f.moderators, f.sort_by',
'FROM' => 'forums AS f',
'JOINS' => array(
array(
@@ -1433,7 +1433,7 @@
'SELECT' => 't.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to',
'FROM' => 'topics AS t',
'WHERE' => 'forum_id='.$fid,
- 'ORDER BY' => 't.sticky DESC, last_post DESC',
+ 'ORDER BY' => 't.sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 't.posted' : 't.last_post').' DESC',
'LIMIT' => $forum_page['start_from'].', '.$forum_user['disp_topics']
);
Index: admin/install.php
===================================================================
--- admin/install.php (revision 1168)
+++ admin/install.php (revision 1655)
@@ -62,10 +62,10 @@
if (!file_exists(FORUM_ROOT.'lang/'.$language.'/install.php'))
exit('The language pack you have chosen doesn\'t seem to exist or is corrupt. Please recheck and try again.');
-// Load the language file
+// Load the language files
require FORUM_ROOT.'lang/'.$language.'/install.php';
+require FORUM_ROOT.'lang/'.$language.'/admin_settings.php';
-
if (isset($_POST['generate_config']))
{
header('Content-Type: text/x-delimtext; name="config.php"');
@@ -92,12 +92,18 @@
$dual_mysql = false;
$db_extensions = array();
if (function_exists('mysqli_connect'))
+ {
$db_extensions[] = array('mysqli', 'MySQL Improved');
+ $db_extensions[] = array('mysqli_innodb', 'MySQL Improved (InnoDB)');
+ $mysql_innodb = true;
+ }
if (function_exists('mysql_connect'))
{
$db_extensions[] = array('mysql', 'MySQL Standard');
+ $db_extensions[] = array('mysql_innodb', 'MySQL Standard (InnoDB)');
+ $mysql_innodb = true;
- if (count($db_extensions) > 1)
+ if (count($db_extensions) > 2)
$dual_mysql = true;
}
if (function_exists('sqlite_open'))
@@ -447,11 +453,19 @@
case 'mysql':
require FORUM_ROOT.'include/dblayer/mysql.php';
break;
+
+ case 'mysql_innodb':
+ require FORUM_ROOT.'include/dblayer/mysql_innodb.php';
+ break;
case 'mysqli':
require FORUM_ROOT.'include/dblayer/mysqli.php';
break;
+ case 'mysqli_innodb':
+ require FORUM_ROOT.'include/dblayer/mysqli_innodb.php';
+ break;
+
case 'pgsql':
require FORUM_ROOT.'include/dblayer/pgsql.php';
break;
@@ -497,6 +511,15 @@
error(sprintf($lang_install['PunBB already installed'], $db_prefix, $db_name));
+ // Check if InnoDB is available
+ if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
+ {
+ $result = $db->query('SHOW VARIABLES LIKE \'have_innodb\'');
+ list (, $result) = $db->fetch_row($result);
+ if ((strtoupper($result) != 'YES'))
+ error('InnoDB does not seem to be enabled. Please choose a database layer that does not have InnoDB support, or enable InnoDB on your MySQL server.');
+ }
+
// Start a transaction
$forum_db->start_transaction();
@@ -956,11 +979,14 @@
'ENGINE' => 'HEAP'
);
- if ($db_type == 'mysql' || $db_type == 'mysqli')
+ if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
{
$schema['UNIQUE KEYS']['user_id_ident_idx'] = array('user_id', 'ident(25)');
$schema['INDEXES']['ident_idx'] = array('ident(25)');
}
+
+ if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
+ $schema['ENGINE'] = 'InnoDB';
$forum_db->create_table('online', $schema);
@@ -1020,7 +1046,8 @@
'PRIMARY KEY' => array('id'),
'INDEXES' => array(
'topic_id_idx' => array('topic_id'),
- 'multi_idx' => array('poster_id', 'topic_id')
+ 'multi_idx' => array('poster_id', 'topic_id'),
+ 'posted_idx' => array('posted')
)
);
@@ -1126,7 +1153,7 @@
)
);
- if ($db_type == 'mysql' || $db_type == 'mysqli')
+ if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
$schema['INDEXES']['ident_idx'] = array('ident(8)');
$forum_db->create_table('search_cache', $schema);
@@ -1493,7 +1520,7 @@
)
);
- if ($db_type == 'mysql' || $db_type == 'mysqli')
+ if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
$schema['INDEXES']['username_idx'] = array('username(8)');
$forum_db->create_table('users', $schema);
@@ -1655,7 +1682,7 @@
'o_rules' => "'0'",
'o_rules_message' => "'".$lang_install['Default rules']."'",
'o_maintenance' => "'0'",
- 'o_maintenance_message' => "'".$lang_install['Default maint message']."'",
+ 'o_maintenance_message' => "'".$lang_admin_settings['Maintenance message default']."'",
'o_default_dst' => "'0'",
'p_message_bbcode' => "'1'",
'p_message_img_tag' => "'1'",
Index: admin/db_update.php
===================================================================
--- admin/db_update.php (revision 1168)
+++ admin/db_update.php (revision 1655)
@@ -1169,6 +1169,10 @@
}
}
+ // Add the index for the post time
+ if (!$forum_db->index_exists('posts', 'posted_idx'))
+ $forum_db->add_index('posts', 'posted_idx', array('posted'));
+
// Move any users with the old unverified status to their new group
$query = array(
'UPDATE' => 'users',
@@ -1207,7 +1211,9 @@
}
// Should we do charset conversion or not?
- if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset']))
+ if (strpos($cur_version, '1.3') === 0)
+ $query_str = '?stage=finish';
+ elseif (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset']))
$query_str = '?stage=conv_misc&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE;
else
$query_str = '?stage=conv_tables';
Index: admin/index.php
===================================================================
--- admin/index.php (revision 1168)
+++ admin/index.php (revision 1655)
@@ -140,7 +140,7 @@
else if (ini_get('eaccelerator.enable'))
$php_accelerator = '<a href="http://eaccelerator.net/">eAccelerator</a>';
else if (ini_get('xcache.cacher'))
- $php_accelerator = '<a href="http://trac.lighttpd.net/xcache/">XCache</a>';
+ $php_accelerator = '<a href="http://xcache.lighttpd.net/">XCache</a>';
else
$php_accelerator = $lang_admin_index['Not applicable'];
Index: search.php
===================================================================
--- search.php (revision 1168)
+++ search.php (revision 1655)
@@ -533,25 +533,29 @@
($hook = get_hook('se_qr_get_cats_and_forums')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
-$cur_category = 0;
-while ($cur_forum = $forum_db->fetch_assoc($result))
+if ($forum_db->num_rows($result) > 0)
{
- ($hook = get_hook('se_forum_loop_start')) ? eval($hook) : null;
-
- if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
+ $cur_category = 0;
+ while ($cur_forum = $forum_db->fetch_assoc($result))
{
- if ($cur_category)
- echo "\t\t\t\t\t\t\t".'</fieldset>'."\n";
+ ($hook = get_hook('se_forum_loop_start')) ? eval($hook) : null;
- echo "\t\t\t\t\t\t\t".'<fieldset>'."\n\t\t\t\t\t\t\t\t".'<legend><span>'.forum_htmlencode($cur_forum['cat_name']).':</span></legend>'."\n";
- $cur_category = $cur_forum['cid'];
+ if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
+ {
+ if ($cur_category)
+ echo "\t\t\t\t\t\t\t".'</fieldset>'."\n";
+
+ echo "\t\t\t\t\t\t\t".'<fieldset>'."\n\t\t\t\t\t\t\t\t".'<legend><span>'.forum_htmlencode($cur_forum['cat_name']).':</span></legend>'."\n";
+ $cur_category = $cur_forum['cid'];
+ }
+
+ echo "\t\t\t\t\t\t\t\t".'<div class="checklist-item"><span class="fld-input"><input type="checkbox" id="fld'.(++$forum_page['fld_count']).'" name="forum[]" value="'.$cur_forum['fid'].'" /></span> <label for="fld'.$forum_page['fld_count'].'">'.forum_htmlencode($cur_forum['forum_name']).'</label></div>'."\n";
}
- echo "\t\t\t\t\t\t\t\t".'<div class="checklist-item"><span class="fld-input"><input type="checkbox" id="fld'.(++$forum_page['fld_count']).'" name="forum[]" value="'.$cur_forum['fid'].'" /></span> <label for="fld'.$forum_page['fld_count'].'">'.forum_htmlencode($cur_forum['forum_name']).'</label></div>'."\n";
+ echo "\t\t\t\t\t\t\t".'</fieldset>'."\n";
}
?>
- </fieldset>
</div>
</div>
<?php ($hook = get_hook('se_pre_forum_fieldset_end')) ? eval($hook) : null; ?>
Index: extern.php
===================================================================
--- extern.php (revision 1168)
+++ extern.php (revision 1655)
@@ -128,7 +128,7 @@
echo "\t\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n";
echo "\t\t\t".'<link>'.$item['link'].'</link>'."\n";
echo "\t\t\t".'<description><![CDATA['.escape_cdata($item['description']).']]></description>'."\n";
- echo "\t\t\t".'<author><![CDATA['.(isset($item['author']['email']) ? escape_cdata($item['author']['email']) : 'dummy@example.com').' ('.escape_cdata($item['author']['name']).')]]></author>'."\n";
+ echo "\t\t\t".'<author><![CDATA['.(isset($item['author']['email']) ? escape_cdata($item['author']['email']) : 'null@example.com').' ('.escape_cdata($item['author']['name']).')]]></author>'."\n";
echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n";
echo "\t\t\t".'<guid>'.$item['link'].'</guid>'."\n";
@@ -335,16 +335,16 @@
'JOINS' => array(
array(
'INNER JOIN' => 'users AS u',
- 'ON' => 'u.id = p.poster_id'
+ 'ON' => 'u.id = p.poster_id'
)
),
'WHERE' => 'p.topic_id='.$tid,
'ORDER BY' => 'p.posted DESC',
'LIMIT' => $show
);
-
($hook = get_hook('ex_qr_get_posts')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
+
while ($cur_post = $forum_db->fetch_assoc($result))
{
if ($forum_config['o_censoring'] == '1')
@@ -401,22 +401,22 @@
if (count($fids) == 1)
{
- // Fetch forum name
- $query = array(
- 'SELECT' => 'f.forum_name',
- 'FROM' => 'forums AS f',
- 'JOINS' => array(
- array(
- 'LEFT JOIN' => 'forum_perms AS fp',
- 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')'
- )
- ),
- 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fids[0]
- );
+ // Fetch forum name
+ $query = array(
+ 'SELECT' => 'f.forum_name',
+ 'FROM' => 'forums AS f',
+ 'JOINS' => array(
+ array(
+ 'LEFT JOIN' => 'forum_perms AS fp',
+ 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')'
+ )
+ ),
+ 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fids[0]
+ );
- $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
- if ($forum_db->num_rows($result))
- $forum_name = $lang_common['Title separator'].$forum_db->result($result);
+ $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
+ if ($forum_db->num_rows($result))
+ $forum_name = $lang_common['Title separator'].$forum_db->result($result);
}
}
@@ -441,24 +441,24 @@
// Fetch $show topics
$query = array(
- 'SELECT' => 't.id, t.poster, t.subject, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email',
+ 'SELECT' => 't.id, t.poster, t.posted, t.subject, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email',
'FROM' => 'topics AS t',
'JOINS' => array(
array(
'INNER JOIN' => 'posts AS p',
- 'ON' => 'p.id=t.first_post_id'
+ 'ON' => 'p.id = t.first_post_id'
),
array(
- 'INNER JOIN' => 'users AS u',
+ 'INNER JOIN' => 'users AS u',
'ON' => 'u.id = p.poster_id'
),
array(
'LEFT JOIN' => 'forum_perms AS fp',
- 'ON' => '(fp.forum_id=t.forum_id AND fp.group_id='.$forum_user['g_id'].')'
+ 'ON' => '(fp.forum_id = t.forum_id AND fp.group_id = '.$forum_user['g_id'].')'
)
),
- 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL',
- 'ORDER BY' => 't.last_post DESC',
+ 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum = 1) AND t.moved_to IS NULL',
+ 'ORDER BY' => 't.posted DESC',
'LIMIT' => $show
);
@@ -483,9 +483,9 @@
'link' => forum_link($forum_url['topic_new_posts'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))),
'description' => $cur_topic['message'],
'author' => array(
- 'name' => $cur_topic['last_poster']
+ 'name' => $cur_topic['poster']
),
- 'pubdate' => $cur_topic['last_post']
+ 'pubdate' => $cur_topic['posted']
);
if ($cur_topic['poster_id'] > 1)
Index: index.php
===================================================================
--- index.php (revision 1168)
+++ index.php (revision 1655)
@@ -347,7 +347,8 @@
?>
<div id="brd-online" class="gen-content">
<h3 class="hn"><span><?php printf($lang_index['Currently online'], implode($lang_index['Online stats separator'], $forum_page['online_info'])) ?></span></h3>
-<?php if (!empty($users)): ?> <p><?php echo implode($lang_index['Online list separator'], $users) ?></p>
+<?php if (!empty($users)): ?>
+ <p><?php echo implode($lang_index['Online list separator'], $users) ?></p>
<?php endif; ($hook = get_hook('in_new_online_data')) ? eval($hook) : null; ?>
</div>
<?php
Index: viewtopic.php
===================================================================
--- viewtopic.php (revision 1168)
+++ viewtopic.php (revision 1655)
@@ -259,7 +259,7 @@
<?php
if (!empty($forum_page['main_head_options']))
- echo "\n\t\t".'<p class="options">'.implode(' ', $forum_page['main_head_options']).'</p>';
+ echo "\t\t".'<p class="options">'.implode(' ', $forum_page['main_head_options']).'</p>'."\n";
?>
<h2 class="hn"><span><?php echo $forum_page['items_info'] ?></span></h2>
Index: style/Oxygen/Oxygen.css
===================================================================
--- style/Oxygen/Oxygen.css (revision 1168)
+++ style/Oxygen/Oxygen.css (revision 1655)
@@ -716,14 +716,14 @@
#extensions-used {
border-bottom: 1px dotted;
-}
+ }
/* Main and Content Options
-------------------------------------------------------------*/
.brd p.options {
border-top: none;
- float:right;
+ float: right;
}
.brd .main-modoptions .options {
@@ -845,11 +845,11 @@
}
.brd .main-content .main-item .hn .item-status {
- font-weight:normal;
+ font-weight: normal;
}
.brd .main-content .main-item .hn .item-status em {
- font-style:normal;
+ font-style: normal;
}
.brd .main-content .main-item .item-subject,
@@ -1288,7 +1288,6 @@
padding: 0 0 0 2.25em;
float: none;
height: 100%;
- background-color: #fff;
}
.brd .checklist .checklist-item .fld-input {
@@ -1881,5 +1880,4 @@
border-bottom-style: dashed;
border-bottom-width: 1px;
margin-bottom: 0.5em;
- color: #294F6E
}
Index: style/Oxygen/Oxygen_ie6.css
===================================================================
--- style/Oxygen/Oxygen_ie6.css (revision 1168)
+++ style/Oxygen/Oxygen_ie6.css (revision 1655)
@@ -85,10 +85,6 @@
/* Fix for index.php: no backgroud for the first main-head. */
.brd #brd-index .main-head { position: relative; }
-.brd .main-content .main-item .hn .posted-mark {
- left: 0.2em;
- }
-
/* Footer
-------------------------------------------------------------*/
Index: style/Oxygen/Oxygen_cs.css
===================================================================
--- style/Oxygen/Oxygen_cs.css (revision 1168)
+++ style/Oxygen/Oxygen_cs.css (revision 1655)
@@ -182,6 +182,10 @@
background: #f4f4f4;
}
+.brd .help-box .hn {
+ color: #294F6E
+ }
+
.brd .frm-buttons, .brd .extension .options, .brd .hotfix .options {
border-color: #DBE0E4;
}
@@ -356,7 +360,7 @@
#extensions-used {
border-bottom-color: #999;
-}
+ }
/* Status indicators
@@ -378,7 +382,7 @@
border-color: #ACACAC #979797 #898989 #7A7A7A;
}
-.brd .main-content .sticky .closed .icon {
+.brd .main-content .sticky.closed .icon {
border-color: #D7E5F3 #C3CFDC #898989 #7A7A7A;
}
@@ -390,6 +394,10 @@
/* Multi Checkbox Widget
-------------------------------------------------------------*/
+.brd .checklist .checklist-item label {
+ background: #fff;
+ }
+
.brd .checklist .checklist-item label:hover {
background: #EDF1F5;
}
Index: viewforum.php
===================================================================
--- viewforum.php (revision 1168)
+++ viewforum.php (revision 1655)
@@ -220,10 +220,11 @@
($hook = get_hook('vf_topic_loop_moved_topic_pre_item_subject_merge')) ? eval($hook) : null;
+ $forum_page['item_body']['info']['replies'] = '<li class="info-replies"><span class="label">'.$lang_forum['No replies info'].'</span></li>';
+
if ($forum_config['o_topic_views'] == '1')
$forum_page['item_body']['info']['views'] = '<li class="info-views"><span class="label">'.$lang_forum['No views info'].'</span></li>';
- $forum_page['item_body']['info']['replies'] = '<li class="info-replies"><span class="label">'.$lang_forum['No replies info'].'</span></li>';
$forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">'.$lang_forum['No lastpost info'].'</span></li>';
}
else
Index: header.php
===================================================================
--- header.php (revision 1168)
+++ header.php (revision 1655)
@@ -76,7 +76,7 @@
if (!defined('FORUM_ALLOW_INDEX'))
$forum_head['robots'] = '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />';
else
- $forum_head['descriptions'] = '<meta name="description" content="'.generate_crumbs(true).' '.$lang_common['Title separator'].' '.forum_htmlencode($forum_config['o_board_desc']).'" />';
+ $forum_head['descriptions'] = '<meta name="description" content="'.generate_crumbs(true).$lang_common['Title separator'].forum_htmlencode($forum_config['o_board_desc']).'" />';
// Should we output a MicroID? http://microid.org/
if (strpos(FORUM_PAGE, 'profile') === 0)