mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Change in format of module db data, add zebra, many things probably "damaged goods" for now ... don't panic Mr. Mainwaring, don't panic
git-svn-id: file:///svn/phpbb/trunk@4522 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
64177fa87e
commit
860dc47114
14 changed files with 599 additions and 391 deletions
|
@ -162,6 +162,7 @@ define('ICONS_TABLE', $table_prefix.'icons');
|
||||||
define('LANG_TABLE', $table_prefix.'lang');
|
define('LANG_TABLE', $table_prefix.'lang');
|
||||||
define('LOG_TABLE', $table_prefix.'log');
|
define('LOG_TABLE', $table_prefix.'log');
|
||||||
define('MODERATOR_TABLE', $table_prefix.'moderator_cache');
|
define('MODERATOR_TABLE', $table_prefix.'moderator_cache');
|
||||||
|
define('MODULES_TABLE', $table_prefix . 'modules');
|
||||||
define('POSTS_TABLE', $table_prefix.'posts');
|
define('POSTS_TABLE', $table_prefix.'posts');
|
||||||
define('PRIVMSGS_TABLE', $table_prefix.'privmsgs');
|
define('PRIVMSGS_TABLE', $table_prefix.'privmsgs');
|
||||||
define('PRIVMSGS_TEXT_TABLE', $table_prefix.'privmsgs_text');
|
define('PRIVMSGS_TEXT_TABLE', $table_prefix.'privmsgs_text');
|
||||||
|
@ -188,6 +189,7 @@ define('USERS_TABLE', $table_prefix.'users');
|
||||||
define('WORDS_TABLE', $table_prefix.'words');
|
define('WORDS_TABLE', $table_prefix.'words');
|
||||||
define('POLL_OPTIONS_TABLE', $table_prefix.'poll_results');
|
define('POLL_OPTIONS_TABLE', $table_prefix.'poll_results');
|
||||||
define('POLL_VOTES_TABLE', $table_prefix.'poll_voters');
|
define('POLL_VOTES_TABLE', $table_prefix.'poll_voters');
|
||||||
|
define('ZEBRA_TABLE', $table_prefix.'zebra');
|
||||||
|
|
||||||
// Set PHP error handler to ours
|
// Set PHP error handler to ours
|
||||||
set_error_handler('msg_handler');
|
set_error_handler('msg_handler');
|
||||||
|
|
|
@ -14,29 +14,6 @@
|
||||||
//
|
//
|
||||||
// User functions
|
// User functions
|
||||||
//
|
//
|
||||||
function request_var($var_name, $default)
|
|
||||||
{
|
|
||||||
if (!isset($_REQUEST[$var_name]))
|
|
||||||
{
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$var = $_REQUEST[$var_name];
|
|
||||||
$type = gettype($default);
|
|
||||||
settype($var, $type);
|
|
||||||
|
|
||||||
// Prevent use of , excess spaces or other html entity forms in profile strings,
|
|
||||||
// not generally applicable elsewhere
|
|
||||||
if ($type == 'string')
|
|
||||||
{
|
|
||||||
$var = trim(stripslashes(preg_replace(array("#[ \xFF]{2,}#s", "#[\r\n]{2,}#s"), array(' ', "\n"), strtr($var, array_flip(get_html_translation_table(HTML_ENTITIES))))));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $var;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validate_data($data, $val_ary)
|
function validate_data($data, $val_ary)
|
||||||
{
|
{
|
||||||
$error = array();
|
$error = array();
|
||||||
|
@ -460,14 +437,7 @@ function add_to_group($action, $group_id, $user_id_ary, $username_ary, $colour,
|
||||||
$user_id_ary = array($user_id_ary);
|
$user_id_ary = array($user_id_ary);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_in = array();
|
$sql_in = ($which_ary == 'user_id_ary') ? array_map('intval', $$which_ary) : preg_replace('#^[\s]*?(.*?)[\s]*?$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", $$which_ary);
|
||||||
foreach ($$which_ary as $v)
|
|
||||||
{
|
|
||||||
if ($v = trim($v))
|
|
||||||
{
|
|
||||||
$sql_in[] = ($which_ary == 'user_id_ary') ? $v : "'$v'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($$which_ary);
|
unset($$which_ary);
|
||||||
|
|
||||||
// Grab the user id/username records
|
// Grab the user id/username records
|
||||||
|
@ -539,6 +509,7 @@ function add_to_group($action, $group_id, $user_id_ary, $username_ary, $colour,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
|
case 'mssql-odbc':
|
||||||
case 'sqlite':
|
case 'sqlite':
|
||||||
$sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, group_leader)
|
$sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, group_leader)
|
||||||
" . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id, $group_leader)", $add_id_ary));
|
" . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id, $group_leader)", $add_id_ary));
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
//
|
//
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
class ucp_activate extends ucp
|
class ucp_activate extends module
|
||||||
{
|
{
|
||||||
function main($module_id)
|
function main($module_id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
// released or distributed in any way under a licence other
|
// released or distributed in any way under a licence other
|
||||||
// than the GPL. We will be watching ... ;)
|
// than the GPL. We will be watching ... ;)
|
||||||
|
|
||||||
class ucp_confirm extends ucp
|
class ucp_confirm extends module
|
||||||
{
|
{
|
||||||
function main($id)
|
function ucp_confirm($id, $mode)
|
||||||
{
|
{
|
||||||
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
|
|
@ -11,23 +11,13 @@
|
||||||
//
|
//
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
class ucp_main extends ucp
|
class ucp_main extends module
|
||||||
{
|
{
|
||||||
function main($id)
|
function ucp_main($id, $mode)
|
||||||
{
|
{
|
||||||
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
$submode = ($_REQUEST['mode']) ? htmlspecialchars($_REQUEST['mode']) : 'front';
|
switch ($mode)
|
||||||
|
|
||||||
// Setup internal subsection display
|
|
||||||
$submodules['FRONT'] = "i=$id&mode=front";
|
|
||||||
$submodules['WATCHED'] = "i=$id&mode=watched";
|
|
||||||
$submodules['DRAFTS'] = "i=$id&mode=drafts";
|
|
||||||
|
|
||||||
$this->menu($id, $submodules, $submode);
|
|
||||||
unset($submodules);
|
|
||||||
|
|
||||||
switch ($submode)
|
|
||||||
{
|
{
|
||||||
case 'front':
|
case 'front':
|
||||||
|
|
||||||
|
@ -155,23 +145,11 @@ class ucp_main extends ucp
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
//TODO
|
|
||||||
$sql_and = '';
|
|
||||||
$sql = 'SELECT COUNT(post_id) AS total_posts
|
|
||||||
FROM ' . POSTS_TABLE . '
|
|
||||||
WHERE post_time > ' . $user->data['user_lastvisit'] . "
|
|
||||||
$sql_and";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$row = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$user_id = $user->data['user_id'];
|
|
||||||
|
|
||||||
// Grab all the relevant data
|
// Grab all the relevant data
|
||||||
$sql = "SELECT COUNT(p.post_id) AS num_posts
|
$sql = 'SELECT COUNT(p.post_id) AS num_posts
|
||||||
FROM " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f
|
FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f
|
||||||
WHERE p.poster_id = $user_id
|
WHERE p.poster_id = ' . $user->data['user_id'] . "
|
||||||
AND f.forum_id = p.forum_id
|
AND f.forum_id = p.forum_id
|
||||||
$post_count_sql";
|
$post_count_sql";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
@ -179,9 +157,9 @@ class ucp_main extends ucp
|
||||||
$num_real_posts = min($user->data['user_posts'], $db->sql_fetchfield('num_posts', 0, $result));
|
$num_real_posts = min($user->data['user_posts'], $db->sql_fetchfield('num_posts', 0, $result));
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sql = "SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts
|
$sql = 'SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts
|
||||||
FROM " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f
|
FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f
|
||||||
WHERE p.poster_id = $user_id
|
WHERE p.poster_id = ' . $user->data['user_id'] . "
|
||||||
AND f.forum_id = p.forum_id
|
AND f.forum_id = p.forum_id
|
||||||
$post_count_sql
|
$post_count_sql
|
||||||
GROUP BY f.forum_id, f.forum_name
|
GROUP BY f.forum_id, f.forum_name
|
||||||
|
@ -191,9 +169,9 @@ class ucp_main extends ucp
|
||||||
$active_f_row = $db->sql_fetchrow($result);
|
$active_f_row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sql = "SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts
|
$sql = 'SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts
|
||||||
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
|
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f
|
||||||
WHERE p.poster_id = $user_id
|
WHERE p.poster_id = ' . $user->data['user_id'] . "
|
||||||
AND t.topic_id = p.topic_id
|
AND t.topic_id = p.topic_id
|
||||||
AND f.forum_id = t.forum_id
|
AND f.forum_id = t.forum_id
|
||||||
$post_count_sql
|
$post_count_sql
|
||||||
|
@ -205,8 +183,8 @@ class ucp_main extends ucp
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Do the relevant calculations
|
// Do the relevant calculations
|
||||||
$memberdays = max(1, round((time() - $row['user_regdate']) / 86400));
|
$memberdays = max(1, round((time() - $user->data['user_regdate']) / 86400));
|
||||||
$posts_per_day = $row['user_posts'] / $memberdays;
|
$posts_per_day = $user->data['user_posts'] / $memberdays;
|
||||||
$percentage = ($config['num_posts']) ? min(100, ($num_real_posts / $config['num_posts']) * 100) : 0;
|
$percentage = ($config['num_posts']) ? min(100, ($num_real_posts / $config['num_posts']) * 100) : 0;
|
||||||
|
|
||||||
$active_f_name = $active_f_id = $active_f_count = $active_f_pct = '';
|
$active_f_name = $active_f_id = $active_f_count = $active_f_pct = '';
|
||||||
|
@ -215,7 +193,7 @@ class ucp_main extends ucp
|
||||||
$active_f_name = $active_f_row['forum_name'];
|
$active_f_name = $active_f_row['forum_name'];
|
||||||
$active_f_id = $active_f_row['forum_id'];
|
$active_f_id = $active_f_row['forum_id'];
|
||||||
$active_f_count = $active_f_row['num_posts'];
|
$active_f_count = $active_f_row['num_posts'];
|
||||||
$active_f_pct = ($active_f_count / $row['user_posts']) * 100;
|
$active_f_pct = ($active_f_count / $user->data['user_posts']) * 100;
|
||||||
}
|
}
|
||||||
unset($active_f_row);
|
unset($active_f_row);
|
||||||
|
|
||||||
|
@ -225,19 +203,18 @@ class ucp_main extends ucp
|
||||||
$active_t_name = $active_t_row['topic_title'];
|
$active_t_name = $active_t_row['topic_title'];
|
||||||
$active_t_id = $active_t_row['topic_id'];
|
$active_t_id = $active_t_row['topic_id'];
|
||||||
$active_t_count = $active_t_row['num_posts'];
|
$active_t_count = $active_t_row['num_posts'];
|
||||||
$active_t_pct = ($active_t_count / $row['user_posts']) * 100;
|
$active_t_pct = ($active_t_count / $user->data['user_posts']) * 100;
|
||||||
}
|
}
|
||||||
unset($active_t_row);
|
unset($active_t_row);
|
||||||
|
|
||||||
// $template->assign_vars(show_profile($row));
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'USER_COLOR' => (!empty($user->data['user_colour'])) ? $user->data['user_colour'] : '',
|
'USER_COLOR' => (!empty($user->data['user_colour'])) ? $user->data['user_colour'] : '',
|
||||||
'RANK_TITLE' => $rank_title,
|
'RANK_TITLE' => $rank_title,
|
||||||
'KARMA' => (!empty($row['user_karma'])) ? $user->data['user_karma'] : 0,
|
'KARMA' => $user->lang['KARMA'][$user->data['user_karma']],
|
||||||
'JOINED' => $user->format_date($user->data['user_regdate'], $user->lang['DATE_FORMAT']),
|
'JOINED' => $user->format_date($user->data['user_regdate'], $user->lang['DATE_FORMAT']),
|
||||||
'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit, $user->lang['DATE_FORMAT']),
|
'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit, $user->lang['DATE_FORMAT']),
|
||||||
'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0,
|
'POSTS' => ($user->data['user_posts']) ? $user->data['user_posts'] : 0,
|
||||||
'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day),
|
'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day),
|
||||||
'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage),
|
'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage),
|
||||||
'ACTIVE_FORUM' => $active_f_name,
|
'ACTIVE_FORUM' => $active_f_name,
|
||||||
|
@ -250,15 +227,17 @@ class ucp_main extends ucp
|
||||||
'OCCUPATION' => (!empty($row['user_occ'])) ? $row['user_occ'] : '',
|
'OCCUPATION' => (!empty($row['user_occ'])) ? $row['user_occ'] : '',
|
||||||
'INTERESTS' => (!empty($row['user_interests'])) ? $row['user_interests'] : '',
|
'INTERESTS' => (!empty($row['user_interests'])) ? $row['user_interests'] : '',
|
||||||
|
|
||||||
|
'KARMA_IMG' => '<img src="images/karma' . $user->data['user_karma'] . '.gif" alt="' . $user->lang['KARMA_LEVEL'] . ': ' . $user->lang['KARMA'][$user->data['user_karma']] . '" title="' . $user->lang['KARMA_LEVEL'] . ': ' . $user->lang['KARMA'][$user->data['user_karma']] . '" />',
|
||||||
|
|
||||||
'S_GROUP_OPTIONS' => $group_options,
|
'S_GROUP_OPTIONS' => $group_options,
|
||||||
|
|
||||||
|
'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? "search.$phpEx$SID&search_author=" . urlencode($user->data['username']) . "&show_results=posts" : '',
|
||||||
'U_ACTIVE_FORUM' => "viewforum.$phpEx$SID&f=$active_f_id",
|
'U_ACTIVE_FORUM' => "viewforum.$phpEx$SID&f=$active_f_id",
|
||||||
'U_ACTIVE_TOPIC' => "viewtopic.$phpEx$SID&t=$active_t_id",)
|
'U_ACTIVE_TOPIC' => "viewtopic.$phpEx$SID&t=$active_t_id",)
|
||||||
);
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'watched':
|
case 'subscribed':
|
||||||
|
|
||||||
if ($_POST['unwatch'])
|
if ($_POST['unwatch'])
|
||||||
{
|
{
|
||||||
|
@ -540,9 +519,9 @@ class ucp_main extends ucp
|
||||||
AND user_id = " .$user->data['user_id'];
|
AND user_id = " .$user->data['user_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$message = $user->lang['DRAFTS_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
$message = $user->lang['DRAFTS_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
|
|
||||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,9 +546,9 @@ class ucp_main extends ucp
|
||||||
AND user_id = " . $user->data['user_id'];
|
AND user_id = " . $user->data['user_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$message = $user->lang['DRAFT_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
$message = $user->lang['DRAFT_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
|
|
||||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -654,7 +633,7 @@ class ucp_main extends ucp
|
||||||
'POST_SUBJECT' => ($submit) ? $post_subject : $draft['post_subject'],
|
'POST_SUBJECT' => ($submit) ? $post_subject : $draft['post_subject'],
|
||||||
|
|
||||||
'U_VIEW_TOPIC' => $view_topic_url,
|
'U_VIEW_TOPIC' => $view_topic_url,
|
||||||
'U_VIEW_EDIT' => "ucp.$phpEx$SID&i=$id&mode=$submode&edit=" . $draft['draft_id'],
|
'U_VIEW_EDIT' => "ucp.$phpEx$SID&i=$id&mode=$mode&edit=" . $draft['draft_id'],
|
||||||
|
|
||||||
'S_ROW_COUNT' => $row_count++,
|
'S_ROW_COUNT' => $row_count++,
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields
|
'S_HIDDEN_FIELDS' => $s_hidden_fields
|
||||||
|
@ -676,15 +655,34 @@ class ucp_main extends ucp
|
||||||
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'L_TITLE' => $user->lang['UCP_' . strtoupper($submode)],
|
'L_TITLE' => $user->lang['UCP_' . strtoupper($mode)],
|
||||||
|
|
||||||
'S_DISPLAY_MARK_ALL' => ($submode == 'watched' || ($submode == 'drafts' && !isset($_GET['edit']))) ? true : false,
|
'S_DISPLAY_MARK_ALL' => ($mode == 'watched' || ($mode == 'drafts' && !isset($_GET['edit']))) ? true : false,
|
||||||
'S_DISPLAY_' . strtoupper($submode) => true,
|
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$submode")
|
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$mode")
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->display($user->lang['UCP_MAIN'], 'ucp_main.html');
|
$this->display($user->lang['UCP_MAIN'], 'ucp_main_' . $mode . '.html');
|
||||||
|
}
|
||||||
|
|
||||||
|
function install()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
function module()
|
||||||
|
{
|
||||||
|
$details = array(
|
||||||
|
'name' => 'UCP - Main',
|
||||||
|
'description' => 'Front end for User Control Panel',
|
||||||
|
'filename' => 'main',
|
||||||
|
'version' => '1.0.0',
|
||||||
|
'phpbbversion' => '2.2.0'
|
||||||
|
);
|
||||||
|
return $details;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,25 +11,16 @@
|
||||||
//
|
//
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
class ucp_prefs extends ucp
|
class ucp_prefs extends module
|
||||||
{
|
{
|
||||||
function main($id)
|
function ucp_prefs($id, $mode)
|
||||||
{
|
{
|
||||||
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
$submode = (!empty($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : 'personal';
|
|
||||||
$submit = (isset($_POST['submit'])) ? true : false;
|
$submit = (isset($_POST['submit'])) ? true : false;
|
||||||
$error = $data = array();
|
$error = $data = array();
|
||||||
|
|
||||||
// Setup internal subsection display
|
switch($mode)
|
||||||
$submodules['PERSONAL'] = "i=$id&mode=personal";
|
|
||||||
$submodules['VIEW'] = "i=$id&mode=view";
|
|
||||||
$submodules['POST'] = "i=$id&mode=post";
|
|
||||||
|
|
||||||
$this->menu($id, $submodules, $submode);
|
|
||||||
unset($submodules);
|
|
||||||
|
|
||||||
switch($submode)
|
|
||||||
{
|
{
|
||||||
case 'personal':
|
case 'personal':
|
||||||
|
|
||||||
|
@ -84,8 +75,8 @@ class ucp_prefs extends ucp
|
||||||
WHERE user_id = ' . $user->data['user_id'];
|
WHERE user_id = ' . $user->data['user_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
|
||||||
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,8 +182,8 @@ class ucp_prefs extends ucp
|
||||||
WHERE user_id = ' . $user->data['user_id'];
|
WHERE user_id = ' . $user->data['user_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
|
||||||
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,8 +285,8 @@ class ucp_prefs extends ucp
|
||||||
WHERE user_id = ' . $user->data['user_id'];
|
WHERE user_id = ' . $user->data['user_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
|
||||||
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,11 +325,11 @@ class ucp_prefs extends ucp
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'L_TITLE' => $user->lang['UCP_' . strtoupper($submode)],
|
'L_TITLE' => $user->lang['UCP_' . strtoupper($mode)],
|
||||||
|
|
||||||
'S_DISPLAY_' . strtoupper($submode) => true,
|
'S_DISPLAY_' . strtoupper($mode) => true,
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$submode")
|
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$mode")
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->display($user->lang['UCP_PROFILE'], 'ucp_prefs.html');
|
$this->display($user->lang['UCP_PROFILE'], 'ucp_prefs.html');
|
||||||
|
|
|
@ -11,27 +11,18 @@
|
||||||
//
|
//
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
class ucp_profile extends ucp
|
class ucp_profile extends module
|
||||||
{
|
{
|
||||||
function main($id)
|
function ucp_profile($id, $mode)
|
||||||
{
|
{
|
||||||
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
$submode = (isset($_GET['mode'])) ? htmlspecialchars($_GET['mode']) : 'reg_details';
|
$preview = (!empty($_POST['preview'])) ? true : false;
|
||||||
$preview = (isset($_POST['preview'])) ? true : false;
|
$submit = (!empty($_POST['submit'])) ? true : false;
|
||||||
$submit = (isset($_POST['submit'])) ? true : false;
|
$delete = (!empty($_POST['delete'])) ? true : false;
|
||||||
$delete = (isset($_POST['delete'])) ? true : false;
|
|
||||||
$error = $data = array();
|
$error = $data = array();
|
||||||
|
|
||||||
$submodules['REG_DETAILS'] = "i=$id&mode=reg_details";
|
switch ($mode)
|
||||||
$submodules['PROFILE_INFO'] = "i=$id&mode=profile_info";
|
|
||||||
$submodules['SIGNATURE'] = "i=$id&mode=signature";
|
|
||||||
$submodules['AVATAR'] = "i=$id&mode=avatar";
|
|
||||||
|
|
||||||
$this->menu($id, $submodules, $submode);
|
|
||||||
unset($submodules);
|
|
||||||
|
|
||||||
switch ($submode)
|
|
||||||
{
|
{
|
||||||
case 'reg_details':
|
case 'reg_details':
|
||||||
|
|
||||||
|
@ -100,8 +91,8 @@ class ucp_profile extends ucp
|
||||||
update_username($user->data['username'], $username);
|
update_username($user->data['username'], $username);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
|
||||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,8 +186,8 @@ class ucp_profile extends ucp
|
||||||
WHERE user_id = ' . $user->data['user_id'];
|
WHERE user_id = ' . $user->data['user_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
|
||||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,7 +285,7 @@ class ucp_profile extends ucp
|
||||||
WHERE user_id = ' . $user->data['user_id'];
|
WHERE user_id = ' . $user->data['user_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,8 +428,8 @@ class ucp_profile extends ucp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
|
||||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,11 +480,11 @@ class ucp_profile extends ucp
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'L_TITLE' => $user->lang['UCP_' . strtoupper($submode)],
|
'L_TITLE' => $user->lang['UCP_' . strtoupper($mode)],
|
||||||
|
|
||||||
'S_DISPLAY_' . strtoupper($submode) => true,
|
'S_DISPLAY_' . strtoupper($mode) => true,
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$submode")
|
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$mode")
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->display($user->lang['UCP_PROFILE'], 'ucp_profile.html');
|
$this->display($user->lang['UCP_PROFILE'], 'ucp_profile.html');
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
//
|
//
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
class ucp_register extends ucp
|
class ucp_register extends module
|
||||||
{
|
{
|
||||||
function main($id)
|
function ucp_register($id, $mode)
|
||||||
{
|
{
|
||||||
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
//
|
//
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
class ucp_remind extends ucp
|
class ucp_remind extends module
|
||||||
{
|
{
|
||||||
function main($id)
|
function ucp_remind($id, $mode)
|
||||||
{
|
{
|
||||||
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,178 @@
|
||||||
<?php
|
<?php
|
||||||
/***************************************************************************
|
// -------------------------------------------------------------
|
||||||
* usercp_profile.php
|
//
|
||||||
* -------------------
|
// $Id$
|
||||||
* begin : Saturday, Feb 21, 2003
|
//
|
||||||
* copyright : (C) 2001 The phpBB Group
|
// FILENAME : ucp_zebra.php
|
||||||
* email : support@phpbb.com
|
// STARTED : Sun Sep 28, 2003
|
||||||
*
|
// COPYRIGHT : © 2001, 2003 phpBB Group
|
||||||
* $Id$
|
// WWW : http://www.phpbb.com/
|
||||||
*
|
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
|
||||||
*
|
//
|
||||||
***************************************************************************/
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
/***************************************************************************
|
class ucp_zebra extends module
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
class ucp_zebra extends ucp
|
|
||||||
{
|
{
|
||||||
function main($module_id)
|
function ucp_zebra($id, $mode)
|
||||||
{
|
{
|
||||||
return;
|
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
$submit = (!empty($_POST['submit'])) ? true : false;
|
||||||
|
|
||||||
|
if ($submit)
|
||||||
|
{
|
||||||
|
$var_ary = array(
|
||||||
|
'usernames' => 0,
|
||||||
|
'add' => '',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($var_ary as $var => $default)
|
||||||
|
{
|
||||||
|
$data[$var] = request_var($var, $default);
|
||||||
|
}
|
||||||
|
|
||||||
|
$var_ary = array(
|
||||||
|
'add' => array('string', false)
|
||||||
|
);
|
||||||
|
|
||||||
|
$error = validate_data($data, $var_ary);
|
||||||
|
extract($data);
|
||||||
|
unset($data);
|
||||||
|
|
||||||
|
if ($add)
|
||||||
|
{
|
||||||
|
$add = explode("\n", $add);
|
||||||
|
|
||||||
|
// Do these name/s exist on a list already? If so, ignore ... we could be
|
||||||
|
// 'nice' and automatically handle names added to one list present on
|
||||||
|
// the other (by removing the existing one) ... but I have a feeling this
|
||||||
|
// may lead to complaints
|
||||||
|
$sql = 'SELECT z.*, u.username
|
||||||
|
FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u
|
||||||
|
WHERE z.user_id = ' . $user->data['user_id'] . "
|
||||||
|
AND u.user_id = z.zebra_id";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$friends = $foes = array();
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
if ($row['friend'])
|
||||||
|
{
|
||||||
|
$friends[] = $row['username'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$foes[] = $row['username'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$add = array_diff($add, $friends, $foes, array($user->data['user_id']));
|
||||||
|
unset($friends);
|
||||||
|
unset($foes);
|
||||||
|
|
||||||
|
$add = implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", $add));
|
||||||
|
|
||||||
|
$sql = 'SELECT user_id, user_permissions, user_founder
|
||||||
|
FROM ' . USERS_TABLE . '
|
||||||
|
WHERE username IN (' . $add . ')';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
if ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$user_id_ary = array();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$user_id_ary[] = $row['user_id'];
|
||||||
|
}
|
||||||
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
|
||||||
|
// Remove users from foe list if they are admins or moderators
|
||||||
|
if ($mode == 'foes')
|
||||||
|
{
|
||||||
|
// This isn't right ...
|
||||||
|
$user_id_ary = array_diff($user_id_ary, array_keys(discover_auth($user_id_ary, array('a_', 'm_'))));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeof($user_id_ary))
|
||||||
|
{
|
||||||
|
$sql_mode = ($mode == 'friends') ? 'friend' : 'foe';
|
||||||
|
|
||||||
|
switch (SQL_LAYER)
|
||||||
|
{
|
||||||
|
case 'mysql':
|
||||||
|
case 'mysql4':
|
||||||
|
$sql = 'INSERT INTO ' . ZEBRA_TABLE . " (user_id, zebra_id, $sql_mode)
|
||||||
|
VALUES " . implode(', ', preg_replace('#^([0-9]+)$#', '(' . $user->data['user_id'] . ", \\1, 1)", $user_id_ary));
|
||||||
|
$db->sql_query($sql);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'mssql':
|
||||||
|
case 'mssql-odbc':
|
||||||
|
case 'sqlite':
|
||||||
|
$sql = 'INSERT INTO ' . ZEBRA_TABLE . " (user_id, zebra_id, $sql_mode)
|
||||||
|
" . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', '(' . $user->data['user_id'] . ", \\1, 1)", $user_id_ary));
|
||||||
|
$db->sql_query($sql);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
foreach ($user_id_ary as $zebra_id)
|
||||||
|
{
|
||||||
|
$sql = 'INSERT INTO ' . ZEBRA_TABLE . " (user_id, zebra_id, $sql_mode)
|
||||||
|
VALUES (" . $user->data['user_id'] . ", $zebra_id, 1)";
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($user_id_ary);
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
else if ($usernames)
|
||||||
|
{
|
||||||
|
// Force integer values
|
||||||
|
$usernames = array_map('intval', $usernames);
|
||||||
|
|
||||||
|
$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
|
||||||
|
WHERE user_id = ' . $user->data['user_id'] . '
|
||||||
|
AND zebra_id IN (' . implode(', ', $usernames) . ')';
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
|
||||||
|
$message = $user->lang[strtoupper($mode) . '_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$mode\">", '</a>');
|
||||||
|
trigger_error($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_and = ($mode == 'friends') ? 'z.friend = 1' : 'z.foe = 1';
|
||||||
|
$sql = 'SELECT z.*, u.username
|
||||||
|
FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u
|
||||||
|
WHERE z.user_id = ' . $user->data['user_id'] . "
|
||||||
|
AND $sql_and
|
||||||
|
AND u.user_id = z.zebra_id";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$s_username_options = '';
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$s_username_options .= '<option value="' . $row['zebra_id'] . '">' . $row['username'] . '</option>';
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'L_TITLE' => $user->lang['UCP_' . strtoupper($mode)],
|
||||||
|
|
||||||
|
'U_SEARCH_USER' => "memberlist.$phpEx$SID&mode=searchuser&form=ucp&field=add",
|
||||||
|
|
||||||
|
'S_USERNAME_OPTIONS' => $s_username_options,
|
||||||
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
|
'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$mode")
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->display($user->lang['UCP_ZEBRA'], 'ucp_zebra_' . $mode . '.html');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -443,6 +443,7 @@ $lang += array(
|
||||||
'NO_OLDER_TOPICS' => 'There are no older topics in this forum',
|
'NO_OLDER_TOPICS' => 'There are no older topics in this forum',
|
||||||
'POST_IGNORE' => 'This post was made by <b>%1$s</b> who is on your ignore list. To display this post click %sHERE%s.',
|
'POST_IGNORE' => 'This post was made by <b>%1$s</b> who is on your ignore list. To display this post click %sHERE%s.',
|
||||||
'POST_BELOW_KARMA' => 'This post was made by <b>%1$s</b> whose karma rating of <b>%2$d</b> is below your desired minimum. To display this post click %3$sHERE%4$s.',
|
'POST_BELOW_KARMA' => 'This post was made by <b>%1$s</b> whose karma rating of <b>%2$d</b> is below your desired minimum. To display this post click %3$sHERE%4$s.',
|
||||||
|
'POST_BY_FOE' => 'This post was made by <b>%1$s</b> who is currently on your ignore list. To display this post click %2$sHERE%3$s.',
|
||||||
'POST_ENCODING' => 'This post by <b>%1$s</b> was made in a character set different to yours. To view this post in its proper encoding click %2$sHERE%3$s.',
|
'POST_ENCODING' => 'This post by <b>%1$s</b> was made in a character set different to yours. To view this post in its proper encoding click %2$sHERE%3$s.',
|
||||||
'DISPLAY_POSTS' => 'Display posts from previous',
|
'DISPLAY_POSTS' => 'Display posts from previous',
|
||||||
'ALL_POSTS' => 'All Posts',
|
'ALL_POSTS' => 'All Posts',
|
||||||
|
@ -678,8 +679,13 @@ $lang += array(
|
||||||
|
|
||||||
// ucp
|
// ucp
|
||||||
$lang += array(
|
$lang += array(
|
||||||
'UCP' => 'User Control Panel',
|
'UCP' => 'User Control Panel',
|
||||||
'UCP_OPTIONS' => 'Options',
|
'UCP_OPTIONS' => 'Options',
|
||||||
|
'FRIENDS' => 'Friends',
|
||||||
|
'FRIENDS_ONLINE' => 'Online',
|
||||||
|
'FRIENDS_OFFLINE' => 'Offline',
|
||||||
|
'NO_FRIENDS_ONLINE' => 'No friends online',
|
||||||
|
'NO_FRIENDS_OFFLINE'=> 'No friends offline',
|
||||||
|
|
||||||
'UCP_MAIN' => 'Overview',
|
'UCP_MAIN' => 'Overview',
|
||||||
|
|
||||||
|
@ -693,7 +699,10 @@ $lang += array(
|
||||||
'UNREAD_PMS' => 'You have $d unread private messages',
|
'UNREAD_PMS' => 'You have $d unread private messages',
|
||||||
'TOTAL_NO_PM' => '0 private messages in total',
|
'TOTAL_NO_PM' => '0 private messages in total',
|
||||||
'TOTAL_PM' => '1 private messages in total',
|
'TOTAL_PM' => '1 private messages in total',
|
||||||
'TOTAL_PMS' => '$d private messages in total',
|
'TOTAL_PMS' => '$d private messages in total',
|
||||||
|
'YOUR_KARMA' => 'Your Karma level',
|
||||||
|
'YOUR_WARNINGS' => 'Your Warning level',
|
||||||
|
'SEARCH_YOUR_POSTS' => 'Show your posts',
|
||||||
|
|
||||||
'UCP_WATCHED' => 'Watched items',
|
'UCP_WATCHED' => 'Watched items',
|
||||||
'WATCHED_FORUMS' => 'Watched Forums',
|
'WATCHED_FORUMS' => 'Watched Forums',
|
||||||
|
@ -781,50 +790,6 @@ $lang += array(
|
||||||
'PROFILE_UPDATED' => 'Your profile has been updated.',
|
'PROFILE_UPDATED' => 'Your profile has been updated.',
|
||||||
|
|
||||||
|
|
||||||
'UCP_PREFERENCES' => 'Preferences',
|
|
||||||
|
|
||||||
'UCP_PERSONAL' => 'Personal Settings',
|
|
||||||
'HIDE_ONLINE' => 'Hide my online status',
|
|
||||||
'NOTIFY_ON_PM' => 'Email me on new private messages',
|
|
||||||
'POPUP_ON_PM' => 'Pop up window on new private message',
|
|
||||||
'SHOW_EMAIL' => 'Users can contact me by email',
|
|
||||||
'ADMIN_EMAIL' => 'Administrators can email me information',
|
|
||||||
'BOARD_STYLE' => 'My board style',
|
|
||||||
'BOARD_LANGUAGE' => 'My language',
|
|
||||||
'BOARD_TIMEZONE' => 'My timezone',
|
|
||||||
'BOARD_DST' => 'Daylight Saving Time is in effect',
|
|
||||||
'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',
|
|
||||||
|
|
||||||
'UCP_VIEW' => 'Viewing Posts',
|
|
||||||
'VIEW_IMAGES' => 'Display Images within posts',
|
|
||||||
'VIEW_FLASH' => 'Display Flash animations',
|
|
||||||
'VIEW_SMILIES' => 'Display Smileys as images',
|
|
||||||
'VIEW_SIGS' => 'Display Signatures',
|
|
||||||
'VIEW_AVATARS' => 'Display Avatars',
|
|
||||||
'DISABLE_CENSORS' => 'Enable Word censoring',
|
|
||||||
'MINIMUM_KARMA' => 'Minimum User Karma',
|
|
||||||
'MINIMUM_KARMA_EXPLAIN'=> 'Posts by users with Karma less than this will be ignored.',
|
|
||||||
'VIEW_TOPICS_DAYS' => 'Display topics from previous days',
|
|
||||||
'VIEW_TOPICS_KEY' => 'Display topics ordering by',
|
|
||||||
'VIEW_TOPICS_DIR' => 'Display topic order direction',
|
|
||||||
|
|
||||||
'UCP_POST' => 'Posting Messages',
|
|
||||||
'DEFAULT_SMILE' => 'Enable smilies by default',
|
|
||||||
'DEFAULT_HTML' => 'Enable HTML by default',
|
|
||||||
'DEFAULT_BBCODE' => 'Enable BBCode by default',
|
|
||||||
'DEFAULT_ADD_SIG' => 'Attach my signature by default',
|
|
||||||
'DEFAULT_NOTIFY' => 'Notify me upon replies by default',
|
|
||||||
|
|
||||||
'PREFERENCES_UPDATED' => 'Your preferences have been updated.',
|
|
||||||
|
|
||||||
|
|
||||||
'UCP_MESSAGING' => 'Messaging',
|
|
||||||
|
|
||||||
|
|
||||||
'UCP_LISTS' => 'Buddy/Ignore',
|
|
||||||
|
|
||||||
|
|
||||||
'REGISTRATION' => 'Registration',
|
'REGISTRATION' => 'Registration',
|
||||||
'COPPA_BIRTHDAY' => 'To continue with the registration procedure please tell us when you were born.',
|
'COPPA_BIRTHDAY' => 'To continue with the registration procedure please tell us when you were born.',
|
||||||
'UCP_COPPA_BEFORE' => 'Before %s',
|
'UCP_COPPA_BEFORE' => 'Before %s',
|
||||||
|
@ -880,14 +845,6 @@ $lang += array(
|
||||||
|
|
||||||
|
|
||||||
'PASSWORD_MISMATCH' => 'The passwords you entered did not match',
|
'PASSWORD_MISMATCH' => 'The passwords you entered did not match',
|
||||||
'Current_password_mismatch' => 'The current password you supplied does not match that stored in the database',
|
|
||||||
'Password_long' => 'Your password must be no more than 32 characters',
|
|
||||||
'Username_taken' => 'Sorry but this username has already been taken',
|
|
||||||
'Username_invalid' => 'Sorry but this username contains an invalid character such as \'',
|
|
||||||
'Username_disallowed' => 'Sorry but this username has been disallowed',
|
|
||||||
'Email_taken' => 'Sorry but that email address is already registered to a user',
|
|
||||||
'Email_banned' => 'Sorry but this email address has been banned',
|
|
||||||
'Email_invalid' => 'Sorry but this email address is invalid',
|
|
||||||
'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.',
|
'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.',
|
||||||
'TOO_MANY_REGISTERS' => 'You have exceeded the maximum number of registration attempts for this session. Please try again later.',
|
'TOO_MANY_REGISTERS' => 'You have exceeded the maximum number of registration attempts for this session. Please try again later.',
|
||||||
|
|
||||||
|
@ -910,7 +867,71 @@ $lang += array(
|
||||||
'COPPA' => 'Your account has been created but has to be approved, please check your email for details.',
|
'COPPA' => 'Your account has been created but has to be approved, please check your email for details.',
|
||||||
);
|
);
|
||||||
|
|
||||||
// usercp_messaging
|
// ucp_prefs
|
||||||
|
$lang += array(
|
||||||
|
'UCP_PREFS' => 'Preferences',
|
||||||
|
|
||||||
|
'UCP_PERSONAL' => 'Personal Settings',
|
||||||
|
'HIDE_ONLINE' => 'Hide my online status',
|
||||||
|
'NOTIFY_ON_PM' => 'Email me on new private messages',
|
||||||
|
'POPUP_ON_PM' => 'Pop up window on new private message',
|
||||||
|
'SHOW_EMAIL' => 'Users can contact me by email',
|
||||||
|
'ADMIN_EMAIL' => 'Administrators can email me information',
|
||||||
|
'BOARD_STYLE' => 'My board style',
|
||||||
|
'BOARD_LANGUAGE' => 'My language',
|
||||||
|
'BOARD_TIMEZONE' => 'My timezone',
|
||||||
|
'BOARD_DST' => 'Daylight Saving Time is in effect',
|
||||||
|
'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',
|
||||||
|
|
||||||
|
'UCP_VIEW' => 'Viewing Posts',
|
||||||
|
'VIEW_IMAGES' => 'Display Images within posts',
|
||||||
|
'VIEW_FLASH' => 'Display Flash animations',
|
||||||
|
'VIEW_SMILIES' => 'Display Smileys as images',
|
||||||
|
'VIEW_SIGS' => 'Display Signatures',
|
||||||
|
'VIEW_AVATARS' => 'Display Avatars',
|
||||||
|
'DISABLE_CENSORS' => 'Enable Word censoring',
|
||||||
|
'MINIMUM_KARMA' => 'Minimum User Karma',
|
||||||
|
'MINIMUM_KARMA_EXPLAIN'=> 'Posts by users with Karma less than this will be ignored.',
|
||||||
|
'VIEW_TOPICS_DAYS' => 'Display topics from previous days',
|
||||||
|
'VIEW_TOPICS_KEY' => 'Display topics ordering by',
|
||||||
|
'VIEW_TOPICS_DIR' => 'Display topic order direction',
|
||||||
|
|
||||||
|
'UCP_POST' => 'Posting Messages',
|
||||||
|
'DEFAULT_SMILE' => 'Enable smilies by default',
|
||||||
|
'DEFAULT_HTML' => 'Enable HTML by default',
|
||||||
|
'DEFAULT_BBCODE' => 'Enable BBCode by default',
|
||||||
|
'DEFAULT_ADD_SIG' => 'Attach my signature by default',
|
||||||
|
'DEFAULT_NOTIFY' => 'Notify me upon replies by default',
|
||||||
|
|
||||||
|
'PREFS_UPDATED' => 'Your preferences have been updated.',
|
||||||
|
);
|
||||||
|
|
||||||
|
// ucp_zebra
|
||||||
|
$lang += array(
|
||||||
|
'UCP_ZEBRA' => 'Friends and Foes',
|
||||||
|
'UCP_FRIENDS' => 'Friends',
|
||||||
|
'UCP_FOES' => 'Foes',
|
||||||
|
|
||||||
|
'FRIENDS_EXPLAIN' => 'Friends enable you quick access to members you communicate with frequently. If the template has relevant support any posts made by a friend may be highlighted.',
|
||||||
|
'YOUR_FRIENDS' => 'Your friends',
|
||||||
|
'YOUR_FRIENDS_EXPLAIN' => 'To remove usernames select them and click submit',
|
||||||
|
'ADD_FRIENDS' => 'Add new friends',
|
||||||
|
'ADD_FRIENDS_EXPLAIN' => 'You may enter several usernames each on a different line',
|
||||||
|
'NO_FRIENDS' => 'No friends currently defined',
|
||||||
|
|
||||||
|
'FOES_EXPLAIN' => 'Foes are users which will be ignored by default. Posts by these users will not be fully visible and personal messages will not be permitted. Please note that you cannot ignore moderators or administrators.',
|
||||||
|
'YOUR_FOES' => 'Your foes',
|
||||||
|
'YOUR_FOES_EXPLAIN' => 'To remove usernames select them and click submit',
|
||||||
|
'ADD_FOES' => 'Add new foes',
|
||||||
|
'ADD_FOES_EXPLAIN' => 'You may enter several usernames each on a different line',
|
||||||
|
'NO_FOES' => 'No foes currently defined',
|
||||||
|
|
||||||
|
'FRIENDS_UPDATED' => 'Your friends list has been updated successfully',
|
||||||
|
'FOES_UPDATED' => 'Your foes list has been updated successfully',
|
||||||
|
);
|
||||||
|
|
||||||
|
// ucp_pm
|
||||||
$lang += array(
|
$lang += array(
|
||||||
'Private_Messaging' => 'Private Messaging',
|
'Private_Messaging' => 'Private Messaging',
|
||||||
'Unread_message' => 'Unread message',
|
'Unread_message' => 'Unread message',
|
||||||
|
|
285
phpBB/ucp.php
285
phpBB/ucp.php
|
@ -47,99 +47,186 @@ include($phpbb_root_path . '/includes/functions_user.'.$phpEx);
|
||||||
// ---------
|
// ---------
|
||||||
// FUNCTIONS
|
// FUNCTIONS
|
||||||
//
|
//
|
||||||
|
class module
|
||||||
// Handles manipulation of user data. Primary used in registration
|
|
||||||
// and user profile manipulation
|
|
||||||
class ucp extends user
|
|
||||||
{
|
{
|
||||||
var $modules = array();
|
var $id = 0;
|
||||||
var $error = array();
|
var $type;
|
||||||
|
var $name;
|
||||||
|
var $mode;
|
||||||
|
|
||||||
// Loads a given module (if it isn't already available), instantiates
|
// Private methods, should not be overwritten
|
||||||
// a new object, and where appropriate calls the modules init method
|
function create($module_type, $module_url, $selected_mod = false, $selected_submod = false)
|
||||||
function load_module($module_name)
|
|
||||||
{
|
{
|
||||||
if (!class_exists('ucp_' . $module_name))
|
global $template, $auth, $db, $user;
|
||||||
|
|
||||||
|
$sql = 'SELECT module_id, module_title, module_filename, module_subs, module_acl
|
||||||
|
FROM ' . MODULES_TABLE . "
|
||||||
|
WHERE module_type = '{$module_type}'
|
||||||
|
AND module_enabled = 1
|
||||||
|
ORDER BY module_order ASC";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
// Authorisation is required for the basic module
|
||||||
|
if ($row['module_acl'])
|
||||||
require_once($phpbb_root_path . 'includes/ucp/ucp_' . $module_name . '.'.$phpEx);
|
|
||||||
eval('$this->module = new ucp_' . $module_name . '();');
|
|
||||||
|
|
||||||
if (method_exists($this->module, 'init'))
|
|
||||||
{
|
{
|
||||||
$this->module->init();
|
$is_auth = FALSE;
|
||||||
}
|
foreach (explode(',', $row['module_acl']) as $auth_option)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is replaced by the loaded module
|
|
||||||
function main($module_id = false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This generates the block template variable for outputting the list
|
|
||||||
// of submodules, should be called with an associative array of modules
|
|
||||||
// in the form 'LANG_STRING' => 'LINK'
|
|
||||||
function menu(&$id, &$module_ary, &$selected_module)
|
|
||||||
{
|
|
||||||
global $template, $user, $phpEx, $SID, $s_modules;
|
|
||||||
|
|
||||||
foreach ($s_modules as $module_id => $section_data)
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('ucp_section', array(
|
|
||||||
'L_TITLE' => $section_data['title'],
|
|
||||||
|
|
||||||
'S_SELECTED'=> $section_data['selected'],
|
|
||||||
|
|
||||||
'U_TITLE' => $section_data['url'])
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($module_id == $id)
|
|
||||||
{
|
|
||||||
foreach ($module_ary as $section_title => $module_link)
|
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('ucp_section.ucp_subsection', array(
|
if ($auth->acl_get($auth_option))
|
||||||
'L_TITLE' => $user->lang['UCP_' . $section_title],
|
{
|
||||||
|
$is_auth = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
'S_SELECTED'=> ($section_title == strtoupper($selected_module)) ? true : false,
|
// The user is not authorised to use this module, skip it
|
||||||
|
if (!$is_auth)
|
||||||
'U_TITLE' => "ucp.$phpEx$SID&$module_link")
|
{
|
||||||
);
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$selected = ($row['module_filename'] == $selected_mod || $row['module_id'] == $selected_mod || (!$selected_mod && !$i)) ? true : false;
|
||||||
|
|
||||||
|
// Get the localised lang string if available, or make up our own otherwise
|
||||||
|
$template->assign_block_vars($module_type . '_section', array(
|
||||||
|
'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . $row['module_title']])) ? $user->lang[strtoupper($module_type) . '_' . $row['module_title']] : ucfirst(str_replace('_', ' ', strtolower($row['module_title']))),
|
||||||
|
'S_SELECTED' => $selected,
|
||||||
|
'U_TITLE' => $module_url . '&i=' . $row['module_id'])
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($selected)
|
||||||
|
{
|
||||||
|
$module_id = $row['module_id'];
|
||||||
|
$module_name = $row['module_filename'];
|
||||||
|
|
||||||
|
if ($row['module_subs'])
|
||||||
|
{
|
||||||
|
$j = 0;
|
||||||
|
$submodules_ary = explode("\n", $row['module_subs']);
|
||||||
|
foreach ($submodules_ary as $submodule)
|
||||||
|
{
|
||||||
|
$submodule = explode(',', trim($submodule));
|
||||||
|
$submodule_title = array_shift($submodule);
|
||||||
|
|
||||||
|
$is_auth = true;
|
||||||
|
foreach ($submodule as $auth_option)
|
||||||
|
{
|
||||||
|
if (!$auth->acl_get($auth_option))
|
||||||
|
{
|
||||||
|
$is_auth = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$is_auth)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$selected = ($submodule_title == $selected_submod || (!$selected_submod && !$j)) ? true : false;
|
||||||
|
|
||||||
|
// Get the localised lang string if available, or make up our own otherwise
|
||||||
|
$template->assign_block_vars("{$module_type}_section.{$module_type}_subsection", array(
|
||||||
|
'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)])) ? $user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)] : ucfirst(str_replace('_', ' ', strtolower($submodule_title))),
|
||||||
|
'S_SELECTED' => $selected,
|
||||||
|
'U_TITLE' => $module_url . '&i=' . $module_id . '&mode=' . $submodule_title
|
||||||
|
));
|
||||||
|
|
||||||
|
if ($selected)
|
||||||
|
{
|
||||||
|
$this->mode = $submodule_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (!$module_id)
|
||||||
|
{
|
||||||
|
trigger_error('MODULE_NOT_EXIST');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($module_ary as $section_title => $module_link)
|
$this->type = $module_type;
|
||||||
|
$this->id = $module_id;
|
||||||
|
$this->name = $module_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
function load($type = false, $name = false, $mode = false, $run = true)
|
||||||
|
{
|
||||||
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
if ($type)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('ucp_subsection', array(
|
$this->type = $type;
|
||||||
'L_TITLE' => $user->lang['UCP_' . $section_title],
|
}
|
||||||
|
|
||||||
'S_SELECTED'=> ($section_title == strtoupper($selected_module)) ? true : false,
|
if ($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
'U_TITLE' => "ucp.$phpEx$SID&$module_link")
|
if (!class_exists($this->type . '_' . $this->name))
|
||||||
);
|
{
|
||||||
|
require_once($phpbb_root_path . "includes/{$this->type}/{$this->type}_{$this->name}.$phpEx");
|
||||||
|
|
||||||
|
if ($run)
|
||||||
|
{
|
||||||
|
eval("\$this->module = new {$this->type}_{$this->name}(\$this->id, \$this->mode);");
|
||||||
|
if (method_exists($this->module, 'init'))
|
||||||
|
{
|
||||||
|
$this->module->init();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Displays the appropriate template with the given title
|
// Displays the appropriate template with the given title
|
||||||
function display(&$page_title, $tpl_name)
|
function display($page_title, $tpl_name)
|
||||||
{
|
{
|
||||||
global $template, $phpEx;
|
global $template;
|
||||||
|
|
||||||
page_header($page_title);
|
page_header($page_title);
|
||||||
|
|
||||||
$template->set_filenames(array(
|
$template->set_filenames(array(
|
||||||
'body' => $tpl_name)
|
'body' => $tpl_name)
|
||||||
);
|
);
|
||||||
make_jumpbox('viewforum.'.$phpEx);
|
|
||||||
|
|
||||||
page_footer();
|
page_footer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalises supplied data dependant on required type/length, errors
|
|
||||||
// on incorrect data
|
// Public methods to be overwritten by modules
|
||||||
|
function module()
|
||||||
|
{
|
||||||
|
// Module name
|
||||||
|
// Module filename
|
||||||
|
// Module description
|
||||||
|
// Module version
|
||||||
|
// Module compatibility
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function install()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// FUNCTIONS
|
// FUNCTIONS
|
||||||
|
@ -151,26 +238,23 @@ $user->start();
|
||||||
$auth->acl($user->data);
|
$auth->acl($user->data);
|
||||||
$user->setup();
|
$user->setup();
|
||||||
|
|
||||||
|
$ucp = new module();
|
||||||
|
|
||||||
// Basic parameter data
|
// Basic parameter data
|
||||||
$mode = (!empty($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
|
$mode = (!empty($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : false;
|
||||||
$module = (!empty($_REQUEST['i'])) ? intval($_REQUEST['i']) : 1;
|
$module = (!empty($_REQUEST['i'])) ? intval($_REQUEST['i']) : false;
|
||||||
|
|
||||||
|
|
||||||
// Instantiate a new ucp object
|
|
||||||
$ucp = new ucp();
|
|
||||||
|
|
||||||
|
|
||||||
// Basic "global" modes
|
// Basic "global" modes
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 'activate':
|
case 'activate':
|
||||||
$ucp->load_module('activate');
|
$ucp->load('ucp', 'activate');
|
||||||
$ucp->module->main();
|
$ucp->module->ucp_activate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'remind':
|
case 'remind':
|
||||||
$ucp->load_module('remind');
|
$ucp->load('ucp', 'remind');
|
||||||
$ucp->module->main();
|
$ucp->module->ucp_remind();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'register':
|
case 'register':
|
||||||
|
@ -179,13 +263,13 @@ switch ($mode)
|
||||||
redirect("index.$phpEx$SID");
|
redirect("index.$phpEx$SID");
|
||||||
}
|
}
|
||||||
|
|
||||||
$ucp->load_module('register');
|
$ucp->load('ucp', 'register');
|
||||||
$ucp->module->main();
|
$ucp->module->ucp_register();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'confirm':
|
case 'confirm':
|
||||||
$ucp->load_module('confirm');
|
$ucp->load('ucp', 'confirm');
|
||||||
$ucp->module->main();
|
$ucp->module->ucp_confirm();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'login':
|
case 'login':
|
||||||
|
@ -222,39 +306,34 @@ $censors = array();
|
||||||
obtain_word_list($censors);
|
obtain_word_list($censors);
|
||||||
|
|
||||||
|
|
||||||
// Grab the other enabled UCP modules
|
// Output listing of friends online
|
||||||
$sql = 'SELECT module_id, module_title, module_filename
|
$sql = 'SELECT DISTINCT u.user_id, u.username, MAX(s.session_time) as online_time, MIN(s.session_allow_viewonline) AS viewonline
|
||||||
FROM ' . UCP_MODULES_TABLE . '
|
FROM ((' . ZEBRA_TABLE . ' z
|
||||||
ORDER BY module_order ASC';
|
LEFT JOIN ' . SESSIONS_TABLE . ' s ON s.session_user_id = z.zebra_id), ' . USERS_TABLE . ' u)
|
||||||
|
WHERE z.user_id = ' . $user->data['user_id'] . '
|
||||||
|
AND z.friend = 1
|
||||||
|
AND u.user_id = z.zebra_id
|
||||||
|
GROUP BY z.zebra_id';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$s_modules = array();
|
$update_time = $config['load_online_time'] * 60;
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('ucp_sections', array(
|
$which = (time() - $update_time < $row['online_time']) ? 'online' : 'offline';
|
||||||
'SECTION' => $user->lang['UCP_' . $row['module_title']],
|
|
||||||
|
|
||||||
'U_SECTION' => "ucp.$phpEx$SID&i=" . $row['module_id'],
|
$template->assign_block_vars("friends_{$which}", array(
|
||||||
|
'U_PROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'],
|
||||||
|
|
||||||
'S_IS_TAB' => ($row['module_id'] == $module) ? true : false)
|
'USERNAME' => $row['username'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$s_modules[$row['module_id']]['title'] = $user->lang['UCP_' . $row['module_title']];
|
|
||||||
$s_modules[$row['module_id']]['url'] = "ucp.$phpEx$SID&i=" . $row['module_id'];
|
|
||||||
$s_modules[$row['module_id']]['selected'] = ($row['module_id'] == $module) ? true : false;
|
|
||||||
|
|
||||||
if ($row['module_id'] == $module)
|
|
||||||
{
|
|
||||||
$selected_module = $row['module_filename'];
|
|
||||||
$selected_id = $row['module_id'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($selected_module)
|
|
||||||
{
|
// Instantiate module system and generate list of available modules
|
||||||
$ucp->load_module($selected_module);
|
$ucp->create('ucp', "ucp.$phpEx$SID", $module, $mode);
|
||||||
$ucp->module->main($selected_id);
|
|
||||||
}
|
// Load and execute the relevant module
|
||||||
|
$ucp->load();
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -29,7 +29,6 @@ $sort_days = (isset($_REQUEST['st'])) ? max(intval($_REQUEST['st']), 0) : ((!emp
|
||||||
$sort_key = (!empty($_REQUEST['sk'])) ? htmlspecialchars($_REQUEST['sk']) : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't');
|
$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_dir = (!empty($_REQUEST['sd'])) ? htmlspecialchars($_REQUEST['sd']) : ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_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.
|
||||||
if (!$forum_id)
|
if (!$forum_id)
|
||||||
|
@ -37,7 +36,6 @@ if (!$forum_id)
|
||||||
trigger_error('NO_FORUM');
|
trigger_error('NO_FORUM');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Grab appropriate forum data
|
// Grab appropriate forum data
|
||||||
if ($user->data['user_id'] == ANONYMOUS)
|
if ($user->data['user_id'] == ANONYMOUS)
|
||||||
{
|
{
|
||||||
|
@ -87,7 +85,6 @@ if (!($forum_data = $db->sql_fetchrow($result)))
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
|
||||||
// Is this forum a link? ... User got here either because the
|
// Is this forum a link? ... User got here either because the
|
||||||
// number of clicks is being tracked or they guessed the id
|
// number of clicks is being tracked or they guessed the id
|
||||||
if ($forum_data['forum_link'])
|
if ($forum_data['forum_link'])
|
||||||
|
@ -104,11 +101,9 @@ if ($forum_data['forum_link'])
|
||||||
redirect($forum_data['forum_link']);
|
redirect($forum_data['forum_link']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Configure style, language, etc.
|
// Configure style, language, etc.
|
||||||
$user->setup(false, $forum_data['forum_style']);
|
$user->setup(false, $forum_data['forum_style']);
|
||||||
|
|
||||||
|
|
||||||
// Forum is passworded ... check whether access has been granted to this
|
// Forum is passworded ... check whether access has been granted to this
|
||||||
// user this session, if not show login box
|
// user this session, if not show login box
|
||||||
if ($forum_data['forum_password'])
|
if ($forum_data['forum_password'])
|
||||||
|
@ -116,9 +111,8 @@ if ($forum_data['forum_password'])
|
||||||
login_forum_box($forum_data);
|
login_forum_box($forum_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Permissions check
|
// Permissions check
|
||||||
if (!$auth->acl_gets('f_read', $forum_id))
|
if (!$auth->acl_get('f_read', $forum_id))
|
||||||
{
|
{
|
||||||
if ($user->data['user_id'] != ANONYMOUS)
|
if ($user->data['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
|
@ -128,11 +122,9 @@ if (!$auth->acl_gets('f_read', $forum_id))
|
||||||
login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['LOGIN_VIEWFORUM']);
|
login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['LOGIN_VIEWFORUM']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Build navigation links
|
// Build navigation links
|
||||||
generate_forum_nav($forum_data);
|
generate_forum_nav($forum_data);
|
||||||
|
|
||||||
|
|
||||||
// Do we have subforums?
|
// Do we have subforums?
|
||||||
$moderators = array();
|
$moderators = array();
|
||||||
|
|
||||||
|
@ -238,9 +230,6 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||||
$sql_limit_time = '';
|
$sql_limit_time = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select the sort order
|
|
||||||
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
|
||||||
|
|
||||||
// Basic pagewide vars
|
// Basic pagewide vars
|
||||||
$post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LOCKED'] : $user->lang['POST_NEW_TOPIC'];
|
$post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LOCKED'] : $user->lang['POST_NEW_TOPIC'];
|
||||||
|
|
||||||
|
@ -282,7 +271,6 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||||
'U_MARK_READ' => "viewforum.$phpEx$SID&f=$forum_id&mark=topics")
|
'U_MARK_READ' => "viewforum.$phpEx$SID&f=$forum_id&mark=topics")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = array();
|
$icons = array();
|
||||||
obtain_icons($icons);
|
obtain_icons($icons);
|
||||||
|
@ -302,12 +290,12 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||||
$sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1';
|
$sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1';
|
||||||
$sql_select = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? ', tt.mark_type, tt.mark_time' : '';
|
$sql_select = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? ', tt.mark_type, tt.mark_time' : '';
|
||||||
|
|
||||||
// Obtain announcements
|
// Obtain announcements ... removed sort ordering, sort by time in all cases
|
||||||
$sql = "SELECT t.* $sql_select
|
$sql = "SELECT t.* $sql_select
|
||||||
FROM $sql_from
|
FROM $sql_from
|
||||||
WHERE t.forum_id IN ($forum_id, 0)
|
WHERE t.forum_id IN ($forum_id, 0)
|
||||||
AND t.topic_type IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ")
|
AND t.topic_type IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ')
|
||||||
ORDER BY $sql_sort_order";
|
ORDER BY t.topic_time DESC';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
@ -320,7 +308,6 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||||
// If the user is trying to reach late pages, start searching from the end
|
// If the user is trying to reach late pages, start searching from the end
|
||||||
$store_reverse = FALSE;
|
$store_reverse = FALSE;
|
||||||
$sql_limit = $config['topics_per_page'];
|
$sql_limit = $config['topics_per_page'];
|
||||||
|
|
||||||
if ($start > $topics_count / 2)
|
if ($start > $topics_count / 2)
|
||||||
{
|
{
|
||||||
$store_reverse = TRUE;
|
$store_reverse = TRUE;
|
||||||
|
@ -330,16 +317,20 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||||
$sql_limit = min($config['topics_per_page'], max(1, $topics_count - $start));
|
$sql_limit = min($config['topics_per_page'], max(1, $topics_count - $start));
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_sort_order = preg_replace('/(ASC|DESC)/e', "('\$1' == 'ASC') ? 'DESC' : 'ASC'", $sql_sort_order);
|
// Select the sort order
|
||||||
|
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC');
|
||||||
$sql_start = max(0, $topics_count - $sql_limit - $start);
|
$sql_start = max(0, $topics_count - $sql_limit - $start);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Select the sort order
|
||||||
|
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
||||||
$sql_start = $start;
|
$sql_start = $start;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtain other topics
|
// Obtain other topics
|
||||||
$sql = "SELECT t.* $sql_select
|
$sql_rownum = (SQL_LAYER != 'oracle') ? '' : ', ROWNUM rnum ';
|
||||||
|
$sql = "SELECT t.* $sql_select$sql_rownum
|
||||||
FROM $sql_from
|
FROM $sql_from
|
||||||
WHERE t.forum_id = $forum_id
|
WHERE t.forum_id = $forum_id
|
||||||
AND t.topic_type NOT IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ")
|
AND t.topic_type NOT IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ")
|
||||||
|
@ -355,14 +346,7 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($store_reverse)
|
$topic_list = ($store_reverse) ? array_merge($announcement_list, array_reverse($topic_list)) : array_merge($announcement_list, $topic_list);
|
||||||
{
|
|
||||||
$topic_list = array_merge($announcement_list, array_reverse($topic_list));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$topic_list = array_merge($announcement_list, $topic_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Okay, lets dump out the page ...
|
// Okay, lets dump out the page ...
|
||||||
if (count($topic_list))
|
if (count($topic_list))
|
||||||
|
|
|
@ -309,31 +309,12 @@ if ($rate)
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// What is start equal to?
|
// What is start equal to?
|
||||||
if (!empty($post_id))
|
if (!empty($post_id))
|
||||||
{
|
{
|
||||||
$start = floor(($prev_posts - 1) / $config['posts_per_page']) * $config['posts_per_page'];
|
$start = floor(($prev_posts - 1) / $config['posts_per_page']) * $config['posts_per_page'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fill extension informations, if this topic has attachments
|
|
||||||
$extensions = array();
|
|
||||||
if ($topic_attachment)
|
|
||||||
{
|
|
||||||
obtain_attach_extensions($extensions);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Are we watching this topic?
|
|
||||||
$s_watching_topic = $s_watching_topic_img = '';
|
|
||||||
if ($config['email_enable'] && $config['allow_topic_notify'])
|
|
||||||
{
|
|
||||||
watch_topic_forum('topic', $s_watching_topic, $s_watching_topic_img, $user->data['user_id'], $topic_id, $notify_status);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Post ordering options
|
// Post ordering options
|
||||||
$limit_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']);
|
$limit_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']);
|
||||||
|
|
||||||
|
@ -369,8 +350,19 @@ else
|
||||||
$limit_posts_time = '';
|
$limit_posts_time = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select the sort order
|
// Fill extension informations, if this topic has attachments
|
||||||
$sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
$extensions = array();
|
||||||
|
if ($topic_attachment)
|
||||||
|
{
|
||||||
|
obtain_attach_extensions($extensions);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Are we watching this topic?
|
||||||
|
$s_watching_topic = $s_watching_topic_img = '';
|
||||||
|
if ($config['email_enable'] && $config['allow_topic_notify'])
|
||||||
|
{
|
||||||
|
watch_topic_forum('topic', $s_watching_topic, $s_watching_topic_img, $user->data['user_id'], $topic_id, $notify_status);
|
||||||
|
}
|
||||||
|
|
||||||
// Grab ranks
|
// Grab ranks
|
||||||
$ranks = array();
|
$ranks = array();
|
||||||
|
@ -414,7 +406,7 @@ $topic_mod .= ($auth->acl_get('f_announce', $forum_id) && $topic_type != POST_GL
|
||||||
$topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '<option value="viewlogs">' . $user->lang['VIEW_TOPIC_LOGS'] . '</option>' : '';
|
$topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '<option value="viewlogs">' . $user->lang['VIEW_TOPIC_LOGS'] . '</option>' : '';
|
||||||
|
|
||||||
// If we've got a hightlight set pass it on to pagination.
|
// If we've got a hightlight set pass it on to pagination.
|
||||||
$pagination_url = "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&" . (($highlight_match) ? "&hilit=$highlight" : '');
|
$pagination_url = "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&sk=$sort_key&st=$sort_days&sd=$sort_dir" . (($highlight_match) ? "&hilit=$highlight" : '');
|
||||||
$pagination = generate_pagination($pagination_url, $total_posts, $config['posts_per_page'], $start);
|
$pagination = generate_pagination($pagination_url, $total_posts, $config['posts_per_page'], $start);
|
||||||
|
|
||||||
// Grab censored words
|
// Grab censored words
|
||||||
|
@ -659,16 +651,10 @@ if (!empty($poll_start))
|
||||||
unset($voted_id);
|
unset($voted_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container for user details, only process once
|
|
||||||
$user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = array();
|
|
||||||
$has_attachments = $display_notice = FALSE;
|
|
||||||
$force_encoding = '';
|
|
||||||
$bbcode_bitfield = $i = $i_total = 0;
|
|
||||||
|
|
||||||
// If the user is trying to reach the second half of the topic, fetch it starting from the end
|
// If the user is trying to reach the second half of the topic, fetch it starting from the end
|
||||||
$store_reverse = FALSE;
|
$store_reverse = FALSE;
|
||||||
$limit = $config['posts_per_page'];
|
$limit = $config['posts_per_page'];
|
||||||
|
|
||||||
if ($start > $total_posts / 2)
|
if ($start > $total_posts / 2)
|
||||||
{
|
{
|
||||||
$store_reverse = TRUE;
|
$store_reverse = TRUE;
|
||||||
|
@ -678,13 +664,25 @@ if ($start > $total_posts / 2)
|
||||||
$limit = min($config['posts_per_page'], max(1, $total_posts - $start));
|
$limit = min($config['posts_per_page'], max(1, $total_posts - $start));
|
||||||
}
|
}
|
||||||
|
|
||||||
$sort_order = preg_replace('/(ASC|DESC)/e', "('\$1' == 'ASC') ? 'DESC' : 'ASC'", $sort_order);
|
$sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC');
|
||||||
$start = max(0, $total_posts - $limit - $start);
|
$start = max(0, $total_posts - $limit - $start);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Select the sort order
|
||||||
|
$sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Container for user details, only process once
|
||||||
|
$user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = array();
|
||||||
|
$has_attachments = $display_notice = FALSE;
|
||||||
|
$force_encoding = '';
|
||||||
|
$bbcode_bitfield = $i = $i_total = 0;
|
||||||
|
|
||||||
// Go ahead and pull all data for this topic
|
// Go ahead and pull all data for this topic
|
||||||
$sql = 'SELECT u.username, u.user_id, u.user_colour, u.user_posts, u.user_from, u.user_karma, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_jabber, u.user_regdate, u.user_msnm, u.user_allow_viewemail, u.user_allow_viewonline, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, p.*
|
$sql = 'SELECT u.username, u.user_id, u.user_colour, u.user_posts, u.user_from, u.user_karma, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_jabber, u.user_regdate, u.user_msnm, u.user_allow_viewemail, u.user_allow_viewonline, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, z.friend, z.foe, p.*
|
||||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
|
FROM ((' . POSTS_TABLE . ' p
|
||||||
|
LEFT JOIN ' . ZEBRA_TABLE . ' z ON (z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id)), ' . USERS_TABLE . " u)
|
||||||
WHERE p.topic_id = $topic_id
|
WHERE p.topic_id = $topic_id
|
||||||
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1') . "
|
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1') . "
|
||||||
$limit_posts_time
|
$limit_posts_time
|
||||||
|
@ -704,16 +702,29 @@ do
|
||||||
$poster_id = $row['poster_id'];
|
$poster_id = $row['poster_id'];
|
||||||
$poster = ($poster_id == ANONYMOUS) ? ((!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'];
|
$poster = ($poster_id == ANONYMOUS) ? ((!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'];
|
||||||
|
|
||||||
if ($row['user_karma'] < $user->data['user_min_karma'] && (!$view || $view != 'karma' || $post_id != $row['post_id']))
|
if (!$view || $view != 'show' || $post_id != $row['post_id'])
|
||||||
{
|
{
|
||||||
$rowset[] = array(
|
if ($row['user_karma'] < $user->data['user_min_karma'])
|
||||||
'below_karma' => TRUE,
|
{
|
||||||
'post_id' => $row['post_id'],
|
$rowset[] = array(
|
||||||
'poster' => $poster,
|
'below_karma' => TRUE,
|
||||||
'user_karma' => $row['user_karma']
|
'post_id' => $row['post_id'],
|
||||||
);
|
'poster' => $poster,
|
||||||
|
'user_karma' => $row['user_karma']
|
||||||
|
);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
else if ($row['foe'])
|
||||||
|
{
|
||||||
|
$rowset[] = array(
|
||||||
|
'foe' => TRUE,
|
||||||
|
'post_id' => $row['post_id'],
|
||||||
|
'poster' => $poster,
|
||||||
|
);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does post have an attachment? If so, add it to the list
|
// Does post have an attachment? If so, add it to the list
|
||||||
|
@ -749,7 +760,8 @@ do
|
||||||
'bbcode_bitfield' => $row['bbcode_bitfield'],
|
'bbcode_bitfield' => $row['bbcode_bitfield'],
|
||||||
'enable_html' => $row['enable_html'],
|
'enable_html' => $row['enable_html'],
|
||||||
'enable_smilies' => $row['enable_smilies'],
|
'enable_smilies' => $row['enable_smilies'],
|
||||||
'enable_sig' => $row['enable_sig']
|
'enable_sig' => $row['enable_sig'],
|
||||||
|
'friend' => $row['friend'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -774,7 +786,8 @@ do
|
||||||
'bbcode_bitfield' => $row['bbcode_bitfield'],
|
'bbcode_bitfield' => $row['bbcode_bitfield'],
|
||||||
'enable_html' => $row['enable_html'],
|
'enable_html' => $row['enable_html'],
|
||||||
'enable_smilies' => $row['enable_smilies'],
|
'enable_smilies' => $row['enable_smilies'],
|
||||||
'enable_sig' => $row['enable_sig']
|
'enable_sig' => $row['enable_sig'],
|
||||||
|
'friend' => $row['friend'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1020,7 +1033,18 @@ foreach ($rowset as $i => $row)
|
||||||
'S_IGNORE_POST' => true,
|
'S_IGNORE_POST' => true,
|
||||||
'S_ROW_COUNT' => $i,
|
'S_ROW_COUNT' => $i,
|
||||||
|
|
||||||
'L_IGNORE_POST' => sprintf($user->lang['POST_BELOW_KARMA'], $row['poster'], $row['user_karma'], "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&p=" . $row['post_id'] . '&view=karma#' . $row['post_id'] . '">', '</a>'))
|
'L_IGNORE_POST' => sprintf($user->lang['POST_BELOW_KARMA'], $row['poster'], $row['user_karma'], "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&p=" . $row['post_id'] . '&view=show#' . $row['post_id'] . '">', '</a>'))
|
||||||
|
);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ($row['foe'])
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('postrow', array(
|
||||||
|
'S_IGNORE_POST' => true,
|
||||||
|
'S_ROW_COUNT' => $i,
|
||||||
|
|
||||||
|
'L_IGNORE_POST' => sprintf($user->lang['POST_BY_FOE'], $row['poster'], "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&p=" . $row['post_id'] . '&view=show#' . $row['post_id'] . '">', '</a>'))
|
||||||
);
|
);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -1169,7 +1193,8 @@ foreach ($rowset as $i => $row)
|
||||||
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? TRUE : FALSE,
|
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? TRUE : FALSE,
|
||||||
'S_POST_UNAPPROVED' => ($row['post_approved']) ? FALSE : TRUE,
|
'S_POST_UNAPPROVED' => ($row['post_approved']) ? FALSE : TRUE,
|
||||||
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_', $forum_id)) ? TRUE : FALSE,
|
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_', $forum_id)) ? TRUE : FALSE,
|
||||||
'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'])
|
'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'],
|
||||||
|
'S_FRIEND' => ($row['friend']) ? true : false)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Process Attachments for this post
|
// Process Attachments for this post
|
||||||
|
|
Loading…
Add table
Reference in a new issue