- bugfixes

- default sort options for posts too
- adjusted format_date to remove the (time intensive) preg_ calls
- temporary style.php code.


git-svn-id: file:///svn/phpbb/trunk@5068 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2005-01-20 20:57:45 +00:00
parent a7ef13c639
commit 9c1a4bdac1
21 changed files with 221 additions and 86 deletions

View file

@ -263,8 +263,6 @@ class sql_db
$query_id = $this->query_result; $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])) if (isset($cache->sql_rowset[$query_id]))
{ {
return $cache->sql_fetchrow($query_id); return $cache->sql_fetchrow($query_id);

View file

@ -562,12 +562,9 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
} }
else else
{ {
if (isset($_GET['unwatch'])) if (isset($_GET['unwatch']) && $_GET['unwatch'] == $mode)
{ {
if ($_GET['unwatch'] == $mode) login_box();
{
login_box();
}
} }
else else
{ {
@ -1016,8 +1013,8 @@ function redirect($url)
// Make sure no &'s are in, this will break the redirect // Make sure no &'s are in, this will break the redirect
$url = str_replace('&', '&', $url); $url = str_replace('&', '&', $url);
// Local redirect? If not, prepend the boards url // If relative path, prepend board url
if (strpos($url, '://') === false && strpos($url, '/') !== 0) if (strpos($url, '://') === false && $url{0} != '/')
{ {
$url = generate_board_url() . preg_replace('#^/?(.*?)/?$#', '/\1', trim($url)); $url = generate_board_url() . preg_replace('#^/?(.*?)/?$#', '/\1', trim($url));
} }

View file

@ -101,7 +101,7 @@ $global_rule_conditions = array(
); );
// Get all folder // 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; global $db, $user, $template;
@ -110,11 +110,6 @@ function get_folder($user_id, &$folder, $folder_id = false, $mode = '')
$folder = array(); $folder = array();
} }
if ($mode == 'unread')
{
$folder['unread'] = array('folder_name' => $user->lang['UNREAD_MESSAGES']);
}
// Get folder informations // Get folder informations
$sql = 'SELECT folder_id, COUNT(msg_id) as num_messages, SUM(unread) as num_unread $sql = 'SELECT folder_id, COUNT(msg_id) as num_messages, SUM(unread) as num_unread
FROM ' . PRIVMSGS_TO_TABLE . " FROM ' . PRIVMSGS_TO_TABLE . "

View file

@ -590,6 +590,24 @@ class user extends session
$this->theme[$style_priority]['pagination_sep'] = ', '; $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(); $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']; $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; $midnight = gmmktime(0, 0, 0, $m, $d, $y) - $this->timezone - $this->dst;
} }
if (strpos($format, '|') === false || (!($gmepoch > $midnight && !$forcedate) && !($gmepoch > $midnight - 86400 && !$forcedate)))
{
return strtr(@gmdate(str_replace('|', '', $format), $gmepoch + $this->timezone + $this->dst), $lang_dates);
}
if ($gmepoch > $midnight && !$forcedate) if ($gmepoch > $midnight && !$forcedate)
{ {
return preg_replace('#\|.*?\|#', $this->lang['datetime']['TODAY'], 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 if ($gmepoch > $midnight - 86400 && !$forcedate) else if ($gmepoch > $midnight - 86400 && !$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']['YESTERDAY'], strtr(@gmdate($format, $gmepoch + $this->timezone + $this->dst), $lang_dates));
else
{
return strtr(@gmdate(str_replace('|', '', $format), $gmepoch + $this->timezone + $this->dst), $lang_dates);
} }
} }

View file

@ -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); 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 = ''; $s_folder_options = $s_to_folder_options = '';
foreach ($folder as $f_id => $folder_ary) foreach ($folder as $f_id => $folder_ary)

View file

@ -187,9 +187,9 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder')
$start = request_var('start', 0); $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_days = request_var('st', ((!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0));
$sort_key = (!empty($_REQUEST['sk'])) ? htmlspecialchars($_REQUEST['sk']) : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't'); $sort_key = request_var('sk', ((!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'));
$sort_dir = (!empty($_REQUEST['sd'])) ? htmlspecialchars($_REQUEST['sd']) : ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd'); $sort_dir = request_var('sd', ((!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'));
// PM ordering options // 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']); $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']);

View file

@ -162,9 +162,13 @@ class ucp_prefs extends module
if ($submit) if ($submit)
{ {
$var_ary = array( $var_ary = array(
'sk' => (string) 't', 'topic_sk' => (string) 't',
'sd' => (string) 'd', 'topic_sd' => (string) 'd',
'st' => 0, 'topic_st' => 0,
'post_sk' => (string) 't',
'post_sd' => (string) 'a',
'post_st' => 0,
'images' => true, 'images' => true,
'flash' => false, 'flash' => false,
@ -180,8 +184,10 @@ class ucp_prefs extends module
} }
$var_ary = array( $var_ary = array(
'sk' => array('string', false, 1, 1), 'topic_sk' => array('string', false, 1, 1),
'sd' => 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); $error = validate_data($data, $var_ary);
@ -201,10 +207,14 @@ class ucp_prefs extends module
} }
$sql_ary = array( $sql_ary = array(
'user_options' => $user->data['user_options'], 'user_options' => $user->data['user_options'],
'user_sortby_type' => $sk, 'user_topic_sortby_type'=> $topic_sk,
'user_sortby_dir' => $sd, 'user_post_sortby_type' => $post_sk,
'user_show_days' => $st, '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 . ' $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); $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'); $topic_sk = (isset($topic_sk)) ? $topic_sk : ((!empty($user->data['user_tpic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't');
$sd = (isset($sd)) ? $sd : ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd'); $post_sk = (isset($post_sk)) ? $post_sk : ((!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't');
$st = (isset($st)) ? $st : ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0);
// Topic ordering display $topic_sd = (isset($topic_sd)) ? $topic_sd : ((!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd');
$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']); $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_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_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
$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_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; // Topic ordering options
gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); $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');
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>';
${'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_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 = (isset($images)) ? $images : $user->optionget('viewimg');
$images_yes = ($images) ? ' checked="checked"' : ''; $images_yes = ($images) ? ' checked="checked"' : '';
@ -270,9 +317,13 @@ class ucp_prefs extends module
'DISABLE_CENSORS_NO' => $wordcensor_no, 'DISABLE_CENSORS_NO' => $wordcensor_no,
'S_CHANGE_CENSORS' => ($auth->acl_get('u_chgcensors')) ? true : false, '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_TOPIC_SORT_DAYS' => $s_limit_topic_days,
'S_SELECT_SORT_DIR' => $s_sort_dir) '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; break;

View file

@ -755,9 +755,14 @@ CREATE TABLE phpbb_users (
user_message_rules INTEGER DEFAULT 0 NOT NULL, user_message_rules INTEGER DEFAULT 0 NOT NULL,
user_full_folder INTEGER DEFAULT -3 NOT NULL, user_full_folder INTEGER DEFAULT -3 NOT NULL,
user_emailtime INTEGER DEFAULT 0 NOT NULL, user_emailtime INTEGER DEFAULT 0 NOT NULL,
user_sortby_type VARCHAR(1) NOT NULL, user_sortby_type VARCHAR(2) NOT NULL,
user_sortby_dir VARCHAR(1) NOT NULL, user_sortby_dir VARCHAR(2) NOT NULL,
user_show_days INTEGER DEFAULT 0 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 INTEGER DEFAULT 0 NOT NULL,
user_notify_pm INTEGER DEFAULT 1 NOT NULL, user_notify_pm INTEGER DEFAULT 1 NOT NULL,
user_notify_type INTEGER DEFAULT 0 NOT NULL, user_notify_type INTEGER DEFAULT 0 NOT NULL,

View file

@ -760,9 +760,12 @@ CREATE TABLE [phpbb_users] (
[user_message_rules] [int] NOT NULL , [user_message_rules] [int] NOT NULL ,
[user_full_folder] [int] NOT NULL , [user_full_folder] [int] NOT NULL ,
[user_emailtime] [int] NOT NULL , [user_emailtime] [int] NOT NULL ,
[user_sortby_type] [varchar] (1) NOT NULL , [user_post_show_days] [int] NOT NULL ,
[user_sortby_dir] [varchar] (1) NOT NULL , [user_post_sortby_type] [varchar] (1) NOT NULL ,
[user_show_days] [int] 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] [int] NOT NULL ,
[user_notify_pm] [int] NOT NULL , [user_notify_pm] [int] NOT NULL ,
[user_notify_type] [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_message_rules] DEFAULT (0) FOR [user_message_rules],
CONSTRAINT [DF_users__user_full_folder] DEFAULT ((-3)) FOR [user_full_folder], 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_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] DEFAULT (0) FOR [user_notify],
CONSTRAINT [DF_users__user_notify_pm] DEFAULT (1) FOR [user_notify_pm], CONSTRAINT [DF_users__user_notify_pm] DEFAULT (1) FOR [user_notify_pm],
CONSTRAINT [DF_users__user_notify_type] DEFAULT (0) FOR [user_notify_type], CONSTRAINT [DF_users__user_notify_type] DEFAULT (0) FOR [user_notify_type],

View file

@ -874,9 +874,12 @@ CREATE TABLE phpbb_users (
user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
user_full_folder int(11) DEFAULT '-3' NOT NULL, user_full_folder int(11) DEFAULT '-3' NOT NULL,
user_emailtime int(11) DEFAULT '0' NOT NULL, user_emailtime int(11) DEFAULT '0' NOT NULL,
user_sortby_type varchar(1) DEFAULT '' NOT NULL, user_topic_show_days smallint(4) DEFAULT 0 NOT NULL,
user_sortby_dir varchar(1) DEFAULT '' NOT NULL, user_topic_sortby_type varchar(1) DEFAULT '' NOT NULL,
user_show_days tinyint(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 tinyint(1) DEFAULT '0' NOT NULL,
user_notify_pm tinyint(1) DEFAULT '1' NOT NULL, user_notify_pm tinyint(1) DEFAULT '1' NOT NULL,
user_notify_type tinyint(4) DEFAULT '0' NOT NULL, user_notify_type tinyint(4) DEFAULT '0' NOT NULL,

View file

@ -1165,7 +1165,12 @@ CREATE TABLE phpbb_users (
user_emailtime INT4 DEFAULT '0' NOT NULL, user_emailtime INT4 DEFAULT '0' NOT NULL,
user_sortby_type varchar(1) DEFAULT '' NOT NULL, user_sortby_type varchar(1) DEFAULT '' NOT NULL,
user_sortby_dir 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 INT2 DEFAULT '0' NOT NULL,
user_notify_pm INT2 DEFAULT '1' NOT NULL, user_notify_pm INT2 DEFAULT '1' NOT NULL,
user_notify_type INT2 DEFAULT '0' NOT NULL, user_notify_type INT2 DEFAULT '0' NOT NULL,

View file

@ -120,6 +120,7 @@ $lang += array(
'FORUM_LOCATION' => 'Forum Location', 'FORUM_LOCATION' => 'Forum Location',
'FORUM_LOCKED' => 'Forum Locked', 'FORUM_LOCKED' => 'Forum Locked',
'FORUM_RULES' => 'Forum Rules', 'FORUM_RULES' => 'Forum Rules',
'FORUM_RULES_LINK' => 'Please click to view the forum rules',
'FROM' => 'from', 'FROM' => 'from',
'GO' => 'Go', 'GO' => 'Go',

View file

@ -59,7 +59,7 @@ $lang += array(
'BIRTHDAY' => 'Birthday', 'BIRTHDAY' => 'Birthday',
'BIRTHDAY_EXPLAIN' => 'Setting a year will list your age when it is your birthday.', 'BIRTHDAY_EXPLAIN' => 'Setting a year will list your age when it is your birthday.',
'BOARD_DATE_FORMAT' => 'My date format', '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_DST' => 'Daylight Saving Time is in effect',
'BOARD_LANGUAGE' => 'My language', 'BOARD_LANGUAGE' => 'My language',
'BOARD_STYLE' => 'My board style', 'BOARD_STYLE' => 'My board style',
@ -379,6 +379,9 @@ $lang += array(
'VIEW_TOPICS_DAYS' => 'Display topics from previous days', 'VIEW_TOPICS_DAYS' => 'Display topics from previous days',
'VIEW_TOPICS_DIR' => 'Display topic order direction', 'VIEW_TOPICS_DIR' => 'Display topic order direction',
'VIEW_TOPICS_KEY' => 'Display topics ordering by', '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_FORUMS' => 'Watched Forums',
'WATCHED_TOPICS' => 'Watched Topics', 'WATCHED_TOPICS' => 'Watched Topics',

View file

@ -1373,6 +1373,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'edit_first_post': case 'edit_first_post':
case 'edit': case 'edit':
if (!$auth->acl_gets('m_', 'a_') || $data['post_edit_reason']) if (!$auth->acl_gets('m_', 'a_') || $data['post_edit_reason'])
{ {
$sql_data[POSTS_TABLE]['sql'] = array( $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': 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( $sql_data[POSTS_TABLE]['sql'] = array(
'post_edit_time' => $current_time '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'; $sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1';
} }
case 'edit_topic':
if (!isset($sql_data[POSTS_TABLE]['sql'])) if (!isset($sql_data[POSTS_TABLE]['sql']))
{ {
$sql_data[POSTS_TABLE]['sql'] = array(); $sql_data[POSTS_TABLE]['sql'] = array();

View file

@ -52,26 +52,52 @@ if (!empty($_GET['id']) && !empty($_GET['sid']))
$sid = htmlspecialchars($_GET['sid']); $sid = htmlspecialchars($_GET['sid']);
$id = intval($_GET['id']); $id = intval($_GET['id']);
$sql = "SELECT session_id $sql = "SELECT s.session_id, u.user_lang
FROM {$table_prefix}sessions FROM {$table_prefix}sessions s, {$table_prefix}users u
WHERE session_id = '" . ((!get_magic_quotes_gpc()) ? $db->sql_escape($sid) : $sid) . "'"; 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); $result = $db->sql_query($sql);
if ($db->sql_fetchrow($result)) if ($user = $db->sql_fetchrow($result))
{ {
$sql = "SELECT theme_data $sql = "SELECT s.style_id, c.theme_data, c.theme_path, c.theme_mtime, i.imageset_path, t.template_path
FROM {$table_prefix}styles_theme FROM {$table_prefix}styles s, {$table_prefix}styles_template t, {$table_prefix}styles_theme c, {$table_prefix}styles_imageset i
WHERE theme_id = $id"; 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); $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)); exit;
header('Content-type: text/css');
echo $row['theme_data'];
} }
$db->sql_freeresult($result2); $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); $db->sql_freeresult($result);

View file

@ -50,7 +50,8 @@ function checkForm()
<!-- IF S_FORUM_RULES --> <!-- IF S_FORUM_RULES -->
<div class="forumrules"> <div class="forumrules">
<!-- IF U_FORUM_RULES --> <!-- 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 --> <!-- ELSE -->
<h3 style="color:red">{L_FORUM_RULES}</h3><br /> <h3 style="color:red">{L_FORUM_RULES}</h3><br />
{FORUM_RULES} {FORUM_RULES}

View file

@ -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> <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> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<tr>
<td colspan="2" class="spacer"></td>
</tr>
<tr> <tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_DAYS}:</b></td> <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>
<tr> <tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_KEY}:</b></td> <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>
<tr> <tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_DIR}:</b></td> <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>
<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> <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>

View file

@ -5,7 +5,8 @@
<!-- IF S_FORUM_RULES --> <!-- IF S_FORUM_RULES -->
<div class="forumrules"> <div class="forumrules">
<!-- IF U_FORUM_RULES --> <!-- 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 --> <!-- ELSE -->
<h3 style="color:red">{L_FORUM_RULES}</h3><br /> <h3 style="color:red">{L_FORUM_RULES}</h3><br />
{FORUM_RULES} {FORUM_RULES}

View file

@ -5,7 +5,8 @@
<!-- IF S_FORUM_RULES --> <!-- IF S_FORUM_RULES -->
<div class="forumrules"> <div class="forumrules">
<!-- IF U_FORUM_RULES --> <!-- 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 --> <!-- ELSE -->
<h3 style="color:red">{L_FORUM_RULES}</h3><br /> <h3 style="color:red">{L_FORUM_RULES}</h3><br />
{FORUM_RULES} {FORUM_RULES}

View file

@ -26,9 +26,9 @@ $forum_id = request_var('f', 0);
$mark_read = request_var('mark', ''); $mark_read = request_var('mark', '');
$start = request_var('start', 0); $start = request_var('start', 0);
$sort_days = request_var('st', ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0)); $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_sortby_type'])) ? $user->data['user_sortby_type'] : 't')); $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_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd')); $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 // Check if the user has actually sent a forum ID with his/her request
// If not give them a nice error page. // 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_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_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 = ''; $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); 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);

View file

@ -29,9 +29,11 @@ $voted_id = request_var('vote_id', 0);;
$start = request_var('start', 0); $start = request_var('start', 0);
$view = request_var('view', ''); $view = request_var('view', '');
$rate = request_var('rate', 0); $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_days = request_var('st', ((!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0));
$sort_dir = request_var('sd', 'a'); $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); $update = request_var('update', false);
$hilit_words = request_var('hilit', ''); $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']) if (!sizeof($post_edit_list) && $row['post_edit_reason'])
{ {
// Remove all post_ids already parsed (we do not have to check them) // 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 $sql = 'SELECT DISTINCT u.user_id, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u