aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/db/mysql.php2
-rw-r--r--phpBB/includes/functions.php11
-rw-r--r--phpBB/includes/functions_privmsgs.php7
-rw-r--r--phpBB/includes/session.php33
-rw-r--r--phpBB/includes/ucp/ucp_pm.php2
-rw-r--r--phpBB/includes/ucp/ucp_pm_viewfolder.php6
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php93
-rw-r--r--phpBB/install/schemas/firebird_schema.sql11
-rw-r--r--phpBB/install/schemas/mssql_schema.sql12
-rw-r--r--phpBB/install/schemas/mysql_schema.sql9
-rw-r--r--phpBB/install/schemas/postgres_schema.sql7
-rw-r--r--phpBB/language/en/common.php1
-rw-r--r--phpBB/language/en/ucp.php5
-rw-r--r--phpBB/posting.php7
-rw-r--r--phpBB/style.php50
-rw-r--r--phpBB/styles/subSilver/template/posting_body.html3
-rw-r--r--phpBB/styles/subSilver/template/ucp_prefs_view.html24
-rw-r--r--phpBB/styles/subSilver/template/viewforum_body.html3
-rw-r--r--phpBB/styles/subSilver/template/viewtopic_body.html3
-rw-r--r--phpBB/viewforum.php8
-rw-r--r--phpBB/viewtopic.php10
21 files changed, 221 insertions, 86 deletions
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php
index ec9f17bf27..aa9e6c1a39 100644
--- a/phpBB/includes/db/mysql.php
+++ b/phpBB/includes/db/mysql.php
@@ -263,8 +263,6 @@ class sql_db
$query_id = $this->query_result;
}
- // This method is called too often... do not waste memory by calling/checking unneeded things
-// if (method_exists($cache, 'sql_fetchrow') && $cache->sql_exists($query_id))
if (isset($cache->sql_rowset[$query_id]))
{
return $cache->sql_fetchrow($query_id);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index e75b01714c..f3cb791438 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -562,12 +562,9 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
}
else
{
- if (isset($_GET['unwatch']))
+ if (isset($_GET['unwatch']) && $_GET['unwatch'] == $mode)
{
- if ($_GET['unwatch'] == $mode)
- {
- login_box();
- }
+ login_box();
}
else
{
@@ -1016,8 +1013,8 @@ function redirect($url)
// Make sure no &'s are in, this will break the redirect
$url = str_replace('&', '&', $url);
- // Local redirect? If not, prepend the boards url
- if (strpos($url, '://') === false && strpos($url, '/') !== 0)
+ // If relative path, prepend board url
+ if (strpos($url, '://') === false && $url{0} != '/')
{
$url = generate_board_url() . preg_replace('#^/?(.*?)/?$#', '/\1', trim($url));
}
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 1682df0d1e..73171f318f 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -101,7 +101,7 @@ $global_rule_conditions = array(
);
// Get all folder
-function get_folder($user_id, &$folder, $folder_id = false, $mode = '')
+function get_folder($user_id, &$folder, $folder_id = false)
{
global $db, $user, $template;
@@ -110,11 +110,6 @@ function get_folder($user_id, &$folder, $folder_id = false, $mode = '')
$folder = array();
}
- if ($mode == 'unread')
- {
- $folder['unread'] = array('folder_name' => $user->lang['UNREAD_MESSAGES']);
- }
-
// Get folder informations
$sql = 'SELECT folder_id, COUNT(msg_id) as num_messages, SUM(unread) as num_unread
FROM ' . PRIVMSGS_TO_TABLE . "
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 46a99c2d38..f71d133378 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -590,6 +590,24 @@ class user extends session
$this->theme[$style_priority]['pagination_sep'] = ', ';
}
+ // TEMP
+ $this->theme['primary']['parse_css_file'] = false;
+ if (!$this->theme['primary']['theme_storedb'] && $this->theme['primary']['parse_css_file'])
+ {
+ $this->theme['primary']['theme_storedb'] = 1;
+
+ $sql_ary = array(
+ 'theme_data' => implode('', file("{$phpbb_root_path}styles/" . $this->theme['primary']['theme_path'] . '/theme/stylesheet.css')),
+ 'theme_mtime' => time(),
+ 'theme_storedb' => 1
+ );
+
+ $db->sql_query('UPDATE ' . STYLES_CSS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
+ WHERE theme_id = ' . $style);
+
+ unset($sql_ary);
+ }
+
$template->set_template();
$this->img_lang = (file_exists($phpbb_root_path . 'styles/' . $this->theme['primary']['imageset_path'] . '/imageset/' . $this->lang_name)) ? $this->lang_name : $config['default_lang'];
@@ -703,17 +721,20 @@ class user extends session
$midnight = gmmktime(0, 0, 0, $m, $d, $y) - $this->timezone - $this->dst;
}
- if ($gmepoch > $midnight && !$forcedate)
+ if (strpos($format, '|') === false || (!($gmepoch > $midnight && !$forcedate) && !($gmepoch > $midnight - 86400 && !$forcedate)))
{
- return preg_replace('#\|.*?\|#', $this->lang['datetime']['TODAY'], strtr(@gmdate($format, $gmepoch + $this->timezone + $this->dst), $lang_dates));
+ return strtr(@gmdate(str_replace('|', '', $format), $gmepoch + $this->timezone + $this->dst), $lang_dates);
}
- else if ($gmepoch > $midnight - 86400 && !$forcedate)
+
+ if ($gmepoch > $midnight && !$forcedate)
{
- return preg_replace('#\|.*?\|#', $this->lang['datetime']['YESTERDAY'], strtr(@gmdate($format, $gmepoch + $this->timezone + $this->dst), $lang_dates));
+ $format = substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1);
+ return str_replace('||', $this->lang['datetime']['TODAY'], strtr(@gmdate($format, $gmepoch + $this->timezone + $this->dst), $lang_dates));
}
- else
+ else if ($gmepoch > $midnight - 86400 && !$forcedate)
{
- return strtr(@gmdate(str_replace('|', '', $format), $gmepoch + $this->timezone + $this->dst), $lang_dates);
+ $format = substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1);
+ return str_replace('||', $this->lang['datetime']['YESTERDAY'], strtr(@gmdate($format, $gmepoch + $this->timezone + $this->dst), $lang_dates));
}
}
diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php
index fdb6396133..21962ea215 100644
--- a/phpBB/includes/ucp/ucp_pm.php
+++ b/phpBB/includes/ucp/ucp_pm.php
@@ -288,7 +288,7 @@ class ucp_pm extends module
update_unread_status($message_row['unread'], $message_row['msg_id'], $user->data['user_id'], $folder_id);
}
- get_folder($user->data['user_id'], $folder, $folder_id, $mode);
+ get_folder($user->data['user_id'], $folder, $folder_id);
$s_folder_options = $s_to_folder_options = '';
foreach ($folder as $f_id => $folder_ary)
diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php
index 059760c500..8edac192ad 100644
--- a/phpBB/includes/ucp/ucp_pm_viewfolder.php
+++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php
@@ -187,9 +187,9 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder')
$start = request_var('start', 0);
- $sort_days = (isset($_REQUEST['st'])) ? max(intval($_REQUEST['st']), 0) : ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0);
- $sort_key = (!empty($_REQUEST['sk'])) ? htmlspecialchars($_REQUEST['sk']) : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't');
- $sort_dir = (!empty($_REQUEST['sd'])) ? htmlspecialchars($_REQUEST['sd']) : ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd');
+ $sort_days = request_var('st', ((!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0));
+ $sort_key = request_var('sk', ((!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'));
+ $sort_dir = request_var('sd', ((!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'));
// PM ordering options
$limit_days = array(0 => $user->lang['ALL_MESSAGES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index dde3442002..2464df2164 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -162,9 +162,13 @@ class ucp_prefs extends module
if ($submit)
{
$var_ary = array(
- 'sk' => (string) 't',
- 'sd' => (string) 'd',
- 'st' => 0,
+ 'topic_sk' => (string) 't',
+ 'topic_sd' => (string) 'd',
+ 'topic_st' => 0,
+
+ 'post_sk' => (string) 't',
+ 'post_sd' => (string) 'a',
+ 'post_st' => 0,
'images' => true,
'flash' => false,
@@ -180,8 +184,10 @@ class ucp_prefs extends module
}
$var_ary = array(
- 'sk' => array('string', false, 1, 1),
- 'sd' => array('string', false, 1, 1),
+ 'topic_sk' => array('string', false, 1, 1),
+ 'topic_sd' => array('string', false, 1, 1),
+ 'post_sk' => array('string', false, 1, 1),
+ 'post_sd' => array('string', false, 1, 1),
);
$error = validate_data($data, $var_ary);
@@ -201,10 +207,14 @@ class ucp_prefs extends module
}
$sql_ary = array(
- 'user_options' => $user->data['user_options'],
- 'user_sortby_type' => $sk,
- 'user_sortby_dir' => $sd,
- 'user_show_days' => $st,
+ 'user_options' => $user->data['user_options'],
+ 'user_topic_sortby_type'=> $topic_sk,
+ 'user_post_sortby_type' => $post_sk,
+ 'user_topic_sortby_dir' => $topic_sd,
+ 'user_post_sortby_dir' => $post_sd,
+
+ 'user_topic_show_days' => $topic_st,
+ 'user_post_show_days' => $post_st,
);
$sql = 'UPDATE ' . USERS_TABLE . '
@@ -221,18 +231,55 @@ class ucp_prefs extends module
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
- $sk = (isset($sk)) ? $sk : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't');
- $sd = (isset($sd)) ? $sd : ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd');
- $st = (isset($st)) ? $st : ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0);
+ $topic_sk = (isset($topic_sk)) ? $topic_sk : ((!empty($user->data['user_tpic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't');
+ $post_sk = (isset($post_sk)) ? $post_sk : ((!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't');
+
+ $topic_sd = (isset($topic_sd)) ? $topic_sd : ((!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd');
+ $post_sd = (isset($post_sd)) ? $post_sd : ((!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'd');
+
+ $topic_st = (isset($topic_st)) ? $topic_st : ((!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0);
+ $post_st = (isset($post_st)) ? $post_st : ((!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0);
+
+ $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
+
+ // Topic ordering options
+ $limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
+
+ $sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
+ $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
+
+ // Post ordering options
+ $limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
+
+ $sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
+ $sort_by_post_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject');
- // Topic ordering display
- $limit_days = array(0 => $user->lang['ALL_TOPICS'], 0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
+ foreach (array('topic', 'post') as $sort_option)
+ {
+ ${'s_limit_' . $sort_option . '_days'} = '<select name="' . $sort_option . '_st">';
+ foreach (${'limit_' . $sort_option . '_days'} as $day => $text)
+ {
+ $selected = (${$sort_option . '_st'} == $day) ? ' selected="selected"' : '';
+ ${'s_limit_' . $sort_option . '_days'} .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
+ }
+ ${'s_limit_' . $sort_option . '_days'} .= '</select>';
- $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
- $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
+ ${'s_sort_' . $sort_option . '_key'} = '<select name="' . $sort_option . '_sk">';
+ foreach (${'sort_by_' . $sort_option . '_text'} as $key => $text)
+ {
+ $selected = (${$sort_option . '_sk'} == $key) ? ' selected="selected"' : '';
+ ${'s_sort_' . $sort_option . '_key'} .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
+ }
+ ${'s_sort_' . $sort_option . '_key'} .= '</select>';
- $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
- gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
+ ${'s_sort_' . $sort_option . '_dir'} = '<select name="' . $sort_option . '_sd">';
+ foreach ($sort_dir_text as $key => $value)
+ {
+ $selected = (${$sort_option . '_sd'} == $key) ? ' selected="selected"' : '';
+ ${'s_sort_' . $sort_option . '_dir'} .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
+ }
+ ${'s_sort_' . $sort_option . '_dir'} .= '</select>';
+ }
$images = (isset($images)) ? $images : $user->optionget('viewimg');
$images_yes = ($images) ? ' checked="checked"' : '';
@@ -270,9 +317,13 @@ class ucp_prefs extends module
'DISABLE_CENSORS_NO' => $wordcensor_no,
'S_CHANGE_CENSORS' => ($auth->acl_get('u_chgcensors')) ? true : false,
- 'S_SELECT_SORT_DAYS' => $s_limit_days,
- 'S_SELECT_SORT_KEY' => $s_sort_key,
- 'S_SELECT_SORT_DIR' => $s_sort_dir)
+
+ 'S_TOPIC_SORT_DAYS' => $s_limit_topic_days,
+ 'S_TOPIC_SORT_KEY' => $s_sort_topic_key,
+ 'S_TOPIC_SORT_DIR' => $s_sort_topic_dir,
+ 'S_POST_SORT_DAYS' => $s_limit_post_days,
+ 'S_POST_SORT_KEY' => $s_sort_post_key,
+ 'S_POST_SORT_DIR' => $s_sort_post_dir)
);
break;
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index a5eeb65efc..edd5c53e32 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -755,9 +755,14 @@ CREATE TABLE phpbb_users (
user_message_rules INTEGER DEFAULT 0 NOT NULL,
user_full_folder INTEGER DEFAULT -3 NOT NULL,
user_emailtime INTEGER DEFAULT 0 NOT NULL,
- user_sortby_type VARCHAR(1) NOT NULL,
- user_sortby_dir VARCHAR(1) NOT NULL,
- user_show_days INTEGER DEFAULT 0 NOT NULL,
+ user_sortby_type VARCHAR(2) NOT NULL,
+ user_sortby_dir VARCHAR(2) NOT NULL,
+ user_topic_show_days INTEGER DEFAULT 0 NOT NULL,
+ user_topic_sortby_type VARCHAR(1) NOT NULL,
+ user_topic_sortby_dir VARCHAR(1) NOT NULL,
+ user_post_show_days INTEGER DEFAULT 0 NOT NULL,
+ user_post_sortby_type VARCHAR(2) NOT NULL,
+ user_post_sortby_dir VARCHAR(2) NOT NULL,
user_notify INTEGER DEFAULT 0 NOT NULL,
user_notify_pm INTEGER DEFAULT 1 NOT NULL,
user_notify_type INTEGER DEFAULT 0 NOT NULL,
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 7fd24a8de6..0af42cb739 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -760,9 +760,12 @@ CREATE TABLE [phpbb_users] (
[user_message_rules] [int] NOT NULL ,
[user_full_folder] [int] NOT NULL ,
[user_emailtime] [int] NOT NULL ,
- [user_sortby_type] [varchar] (1) NOT NULL ,
- [user_sortby_dir] [varchar] (1) NOT NULL ,
- [user_show_days] [int] NOT NULL ,
+ [user_post_show_days] [int] NOT NULL ,
+ [user_post_sortby_type] [varchar] (1) NOT NULL ,
+ [user_post_sortby_dir] [varchar] (1) NOT NULL ,
+ [user_topic_show_days] [int] NOT NULL ,
+ [user_topic_sortby_type] [varchar] (1) NOT NULL ,
+ [user_topic_sortby_dir] [varchar] (1) NOT NULL ,
[user_notify] [int] NOT NULL ,
[user_notify_pm] [int] NOT NULL ,
[user_notify_type] [int] NOT NULL ,
@@ -1557,7 +1560,8 @@ ALTER TABLE [phpbb_users] WITH NOCHECK ADD
CONSTRAINT [DF_users__user_message_rules] DEFAULT (0) FOR [user_message_rules],
CONSTRAINT [DF_users__user_full_folder] DEFAULT ((-3)) FOR [user_full_folder],
CONSTRAINT [DF_users__user_emailtime] DEFAULT (0) FOR [user_emailtime],
- CONSTRAINT [DF_users__user_show_days] DEFAULT (0) FOR [user_show_days],
+ CONSTRAINT [DF_users__user_topic_show_days] DEFAULT (0) FOR [user_topic_show_days],
+ CONSTRAINT [DF_users__user_post_show_days] DEFAULT (0) FOR [user_post_show_days],
CONSTRAINT [DF_users__user_notify] DEFAULT (0) FOR [user_notify],
CONSTRAINT [DF_users__user_notify_pm] DEFAULT (1) FOR [user_notify_pm],
CONSTRAINT [DF_users__user_notify_type] DEFAULT (0) FOR [user_notify_type],
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index e3dbb9d4ca..84eb54444f 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -874,9 +874,12 @@ CREATE TABLE phpbb_users (
user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
user_full_folder int(11) DEFAULT '-3' NOT NULL,
user_emailtime int(11) DEFAULT '0' NOT NULL,
- user_sortby_type varchar(1) DEFAULT '' NOT NULL,
- user_sortby_dir varchar(1) DEFAULT '' NOT NULL,
- user_show_days tinyint(1) DEFAULT '' NOT NULL,
+ user_topic_show_days smallint(4) DEFAULT 0 NOT NULL,
+ user_topic_sortby_type varchar(1) DEFAULT '' NOT NULL,
+ user_topic_sortby_dir varchar(1) DEFAULT '' NOT NULL,
+ user_post_show_days smallint(4) DEFAULT 0 NOT NULL,
+ user_post_sortby_type varchar(1) DEFAULT '' NOT NULL,
+ user_post_sortby_dir varchar(1) DEFAULT '' NOT NULL,
user_notify tinyint(1) DEFAULT '0' NOT NULL,
user_notify_pm tinyint(1) DEFAULT '1' NOT NULL,
user_notify_type tinyint(4) DEFAULT '0' NOT NULL,
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index d656f2968d..0de7a6421a 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1165,7 +1165,12 @@ CREATE TABLE phpbb_users (
user_emailtime INT4 DEFAULT '0' NOT NULL,
user_sortby_type varchar(1) DEFAULT '' NOT NULL,
user_sortby_dir varchar(1) DEFAULT '' NOT NULL,
- user_show_days INT2 DEFAULT '' NOT NULL,
+ user_topic_show_days INT4 DEFAULT '0' NOT NULL,
+ user_topic_sortby_type varchar(1) DEFAULT '' NOT NULL,
+ user_topic_sortby_dir varchar(1) DEFAULT '' NOT NULL,
+ user_post_show_days INT4 DEFAULT '0' NOT NULL,
+ user_post_sortby_type varchar(1) DEFAULT '' NOT NULL,
+ user_post_sortby_dir varchar(1) DEFAULT '' NOT NULL,
user_notify INT2 DEFAULT '0' NOT NULL,
user_notify_pm INT2 DEFAULT '1' NOT NULL,
user_notify_type INT2 DEFAULT '0' NOT NULL,
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index d1d5ccb622..daf9a9d41e 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -120,6 +120,7 @@ $lang += array(
'FORUM_LOCATION' => 'Forum Location',
'FORUM_LOCKED' => 'Forum Locked',
'FORUM_RULES' => 'Forum Rules',
+ 'FORUM_RULES_LINK' => 'Please click to view the forum rules',
'FROM' => 'from',
'GO' => 'Go',
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index cb0c4d0452..101f60a723 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -59,7 +59,7 @@ $lang += array(
'BIRTHDAY' => 'Birthday',
'BIRTHDAY_EXPLAIN' => 'Setting a year will list your age when it is your birthday.',
'BOARD_DATE_FORMAT' => 'My date format',
- 'BOARD_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP <a href=\"http://www.php.net/date\" target=\"_other\">date()</a> function',
+ 'BOARD_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP <a href="http://www.php.net/date" target="_other">date()</a> function',
'BOARD_DST' => 'Daylight Saving Time is in effect',
'BOARD_LANGUAGE' => 'My language',
'BOARD_STYLE' => 'My board style',
@@ -379,6 +379,9 @@ $lang += array(
'VIEW_TOPICS_DAYS' => 'Display topics from previous days',
'VIEW_TOPICS_DIR' => 'Display topic order direction',
'VIEW_TOPICS_KEY' => 'Display topics ordering by',
+ 'VIEW_POSTS_DAYS' => 'Display posts from previous days',
+ 'VIEW_POSTS_DIR' => 'Display post order direction',
+ 'VIEW_POSTS_KEY' => 'Display posts ordering by',
'WATCHED_FORUMS' => 'Watched Forums',
'WATCHED_TOPICS' => 'Watched Topics',
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 05067f28f8..e8f43b6c81 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1373,6 +1373,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'edit_first_post':
case 'edit':
+
if (!$auth->acl_gets('m_', 'a_') || $data['post_edit_reason'])
{
$sql_data[POSTS_TABLE]['sql'] = array(
@@ -1383,7 +1384,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
case 'edit_last_post':
- if ($data['post_edit_reason'])
+ case 'edit_topic':
+
+ if (($post_mode == 'edit_last_post' || $post_mode == 'edit_topic') && $data['post_edit_reason'])
{
$sql_data[POSTS_TABLE]['sql'] = array(
'post_edit_time' => $current_time
@@ -1392,8 +1395,6 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1';
}
- case 'edit_topic':
-
if (!isset($sql_data[POSTS_TABLE]['sql']))
{
$sql_data[POSTS_TABLE]['sql'] = array();
diff --git a/phpBB/style.php b/phpBB/style.php
index f1e14b21b4..b9c2c27cd1 100644
--- a/phpBB/style.php
+++ b/phpBB/style.php
@@ -52,26 +52,52 @@ if (!empty($_GET['id']) && !empty($_GET['sid']))
$sid = htmlspecialchars($_GET['sid']);
$id = intval($_GET['id']);
- $sql = "SELECT session_id
- FROM {$table_prefix}sessions
- WHERE session_id = '" . ((!get_magic_quotes_gpc()) ? $db->sql_escape($sid) : $sid) . "'";
+ $sql = "SELECT s.session_id, u.user_lang
+ FROM {$table_prefix}sessions s, {$table_prefix}users u
+ WHERE s.session_id = '" . ((!get_magic_quotes_gpc()) ? $db->sql_escape($sid) : $sid) . "'
+ AND s.session_user_id = u.user_id";
$result = $db->sql_query($sql);
- if ($db->sql_fetchrow($result))
+ if ($user = $db->sql_fetchrow($result))
{
- $sql = "SELECT theme_data
- FROM {$table_prefix}styles_theme
- WHERE theme_id = $id";
+ $sql = "SELECT s.style_id, c.theme_data, c.theme_path, c.theme_mtime, i.imageset_path, t.template_path
+ FROM {$table_prefix}styles s, {$table_prefix}styles_template t, {$table_prefix}styles_theme c, {$table_prefix}styles_imageset i
+ WHERE s.style_id = $id
+ AND t.template_id = s.template_id
+ AND c.theme_id = s.theme_id
+ AND i.imageset_id = s.imageset_id";
$result2 = $db->sql_query($sql, 300);
- if ($row = $db->sql_fetchrow($result2))
+ if (!($theme = $db->sql_fetchrow($result2)))
{
- header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
- header('Content-type: text/css');
-
- echo $row['theme_data'];
+ exit;
}
$db->sql_freeresult($result2);
+
+ if ($theme['theme_mtime'] < filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
+ {
+ $theme['theme_data'] = implode('', file("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'));
+
+ $db->sql_query("UPDATE {$table_prefix}styles_theme SET theme_data = '" . $db->sql_escape($theme['theme_data']) . "', theme_mtime = " . time() . "
+ WHERE theme_id = $id");
+ }
+
+ header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
+ header('Content-type: text/css');
+
+ // Parse Theme Data
+ $replace = array(
+ '{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme',
+ '{T_TEMPLATE_PATH}' => "{$phpbb_root_path}styles/" . $theme['template_path'] . '/template',
+ '{T_IMAGESET_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset',
+ '{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset/' . $user['user_lang'],
+ '{T_STYLESHEET_NAME}' => $theme['theme_name'],
+ '{S_USER_LANG}' => $user['user_lang']
+ );
+
+ $theme['theme_data'] = str_replace(array_keys($replace), array_values($replace), $theme['theme_data']);
+
+ echo $theme['theme_data'];
}
$db->sql_freeresult($result);
diff --git a/phpBB/styles/subSilver/template/posting_body.html b/phpBB/styles/subSilver/template/posting_body.html
index ca094c11a6..9111beb699 100644
--- a/phpBB/styles/subSilver/template/posting_body.html
+++ b/phpBB/styles/subSilver/template/posting_body.html
@@ -50,7 +50,8 @@ function checkForm()
<!-- IF S_FORUM_RULES -->
<div class="forumrules">
<!-- IF U_FORUM_RULES -->
- <a href="{U_FORUM_RULES}">{L_FORUM_RULES}</a>
+ <h3 style="color:red">{L_FORUM_RULES}</h3><br />
+ <a href="{U_FORUM_RULES}"><b>{L_FORUM_RULES_LINK}</b></a>
<!-- ELSE -->
<h3 style="color:red">{L_FORUM_RULES}</h3><br />
{FORUM_RULES}
diff --git a/phpBB/styles/subSilver/template/ucp_prefs_view.html b/phpBB/styles/subSilver/template/ucp_prefs_view.html
index 52d6513691..4f69846c1b 100644
--- a/phpBB/styles/subSilver/template/ucp_prefs_view.html
+++ b/phpBB/styles/subSilver/template/ucp_prefs_view.html
@@ -37,17 +37,35 @@
<td class="row2"><input type="radio" name="wordcensor" value="1"{DISABLE_CENSORS_YES} /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" name="wordcensor" value="0"{DISABLE_CENSORS_NO} /><span class="gen">{L_NO}</span></td>
</tr>
<!-- ENDIF -->
+ <tr>
+ <td colspan="2" class="spacer"></td>
+ </tr>
<tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_DAYS}:</b></td>
- <td class="row2">{S_SELECT_SORT_DAYS}</td>
+ <td class="row2">{S_TOPIC_SORT_DAYS}</td>
</tr>
<tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_KEY}:</b></td>
- <td class="row2">{S_SELECT_SORT_KEY}</td>
+ <td class="row2">{S_TOPIC_SORT_KEY}</td>
</tr>
<tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_DIR}:</b></td>
- <td class="row2">{S_SELECT_SORT_DIR}</td>
+ <td class="row2">{S_TOPIC_SORT_DIR}</td>
+ </tr>
+ <tr>
+ <td colspan="2" class="spacer"></td>
+ </tr>
+ <tr>
+ <td class="row1" width="50%"><b class="genmed">{L_VIEW_POSTS_DAYS}:</b></td>
+ <td class="row2">{S_POST_SORT_DAYS}</td>
+ </tr>
+ <tr>
+ <td class="row1" width="50%"><b class="genmed">{L_VIEW_POSTS_KEY}:</b></td>
+ <td class="row2">{S_POST_SORT_KEY}</td>
+ </tr>
+ <tr>
+ <td class="row1" width="50%"><b class="genmed">{L_VIEW_POSTS_DIR}:</b></td>
+ <td class="row2">{S_POST_SORT_DIR}</td>
</tr>
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html
index d47cfe7d41..76d408f506 100644
--- a/phpBB/styles/subSilver/template/viewforum_body.html
+++ b/phpBB/styles/subSilver/template/viewforum_body.html
@@ -5,7 +5,8 @@
<!-- IF S_FORUM_RULES -->
<div class="forumrules">
<!-- IF U_FORUM_RULES -->
- <a href="{U_FORUM_RULES}">{L_FORUM_RULES}</a>
+ <h3 style="color:red">{L_FORUM_RULES}</h3><br />
+ <a href="{U_FORUM_RULES}"><b>{L_FORUM_RULES_LINK}</b></a>
<!-- ELSE -->
<h3 style="color:red">{L_FORUM_RULES}</h3><br />
{FORUM_RULES}
diff --git a/phpBB/styles/subSilver/template/viewtopic_body.html b/phpBB/styles/subSilver/template/viewtopic_body.html
index 8b4ee1d40b..008bade3be 100644
--- a/phpBB/styles/subSilver/template/viewtopic_body.html
+++ b/phpBB/styles/subSilver/template/viewtopic_body.html
@@ -5,7 +5,8 @@
<!-- IF S_FORUM_RULES -->
<div class="forumrules">
<!-- IF U_FORUM_RULES -->
- <a href="{U_FORUM_RULES}">{L_FORUM_RULES}</a>
+ <h3 style="color:red">{L_FORUM_RULES}</h3><br />
+ <a href="{U_FORUM_RULES}"><b>{L_FORUM_RULES_LINK}</b></a>
<!-- ELSE -->
<h3 style="color:red">{L_FORUM_RULES}</h3><br />
{FORUM_RULES}
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index cba25c1b85..e36c321329 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -26,9 +26,9 @@ $forum_id = request_var('f', 0);
$mark_read = request_var('mark', '');
$start = request_var('start', 0);
-$sort_days = request_var('st', ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0));
-$sort_key = request_var('sk', ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't'));
-$sort_dir = request_var('sd', ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd'));
+$sort_days = request_var('st', ((!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0));
+$sort_key = request_var('sk', ((!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'));
+$sort_dir = request_var('sd', ((!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'));
// Check if the user has actually sent a forum ID with his/her request
// If not give them a nice error page.
@@ -209,6 +209,8 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
+ $sort_key = (!in_array($sort_key, array('a', 't', 'r', 's', 'v'))) ? 't' : $sort_key;
+
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 96d84aee44..cac180d3cf 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -29,9 +29,11 @@ $voted_id = request_var('vote_id', 0);;
$start = request_var('start', 0);
$view = request_var('view', '');
$rate = request_var('rate', 0);
-$sort_days = request_var('st', ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0));
-$sort_key = request_var('sk', 't');
-$sort_dir = request_var('sd', 'a');
+
+$sort_days = request_var('st', ((!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0));
+$sort_key = request_var('sk', ((!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'));
+$sort_dir = request_var('sd', ((!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'));
+
$update = request_var('update', false);
$hilit_words = request_var('hilit', '');
@@ -1171,7 +1173,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
if (!sizeof($post_edit_list) && $row['post_edit_reason'])
{
// Remove all post_ids already parsed (we do not have to check them)
- $post_storage_list = array_slice($post_list, $i);
+ $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i);
$sql = 'SELECT DISTINCT u.user_id, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u