mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-09 02:06:32 +02:00
fix some issues with oop, fixing small bugs and prepare the next steps...
NOTE TO DEVS: have a look at adm/admin_board.php (new config layout) git-svn-id: file:///svn/phpbb/trunk@4883 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -188,7 +188,12 @@ class acm
|
||||
$this->load();
|
||||
}
|
||||
|
||||
return (time() > $this->var_expires[$var_name]) ? FALSE : isset($this->vars[$var_name]);
|
||||
if (!isset($this->var_expires[$var_name]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (time() > $this->var_expires[$var_name]) ? false : isset($this->vars[$var_name]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +230,7 @@ class acm
|
||||
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
|
||||
$query_id = 'Cache id #' . count($this->sql_rowset);
|
||||
|
||||
include($this->cache_dir . 'sql_' . md5($query) . ".$phpEx");
|
||||
@include($this->cache_dir . 'sql_' . md5($query) . ".$phpEx");
|
||||
if (!isset($expired))
|
||||
{
|
||||
return FALSE;
|
||||
|
@@ -46,10 +46,8 @@ class bbcode
|
||||
return $message;
|
||||
}
|
||||
|
||||
if (empty($this->bbcode_cache))
|
||||
{
|
||||
$this->bbcode_cache_init();
|
||||
}
|
||||
// Init those added with a new bbcode_bitfield (already stored codes will not get parsed again)
|
||||
$this->bbcode_cache_init();
|
||||
|
||||
$str = array('search' => array(), 'replace' => array());
|
||||
$preg = array('search' => array(), 'replace' => array());
|
||||
|
@@ -206,7 +206,7 @@ class sql_db
|
||||
|
||||
$query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')';
|
||||
}
|
||||
else if ($query == 'UPDATE')
|
||||
else if ($query == 'UPDATE' || $query == 'SELECT')
|
||||
{
|
||||
$values = array();
|
||||
foreach ($assoc_ary as $key => $var)
|
||||
@@ -224,7 +224,7 @@ class sql_db
|
||||
$values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var";
|
||||
}
|
||||
}
|
||||
$query = implode(', ', $values);
|
||||
$query = implode(($query == 'UPDATE') ? ', ' : ' AND ', $values);
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
@@ -68,13 +68,13 @@ function set_config($config_name, $config_value, $is_dynamic = FALSE)
|
||||
|
||||
$sql = 'UPDATE ' . CONFIG_TABLE . "
|
||||
SET config_value = '" . $db->sql_escape($config_value) . "'
|
||||
WHERE config_name = '$config_name'";
|
||||
WHERE config_name = '" . $db->sql_escape($config_name) . "'";
|
||||
$db->sql_query($sql);
|
||||
|
||||
if (!$db->sql_affectedrows() && !isset($config[$config_name]))
|
||||
{
|
||||
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
|
||||
VALUES ('$config_name', '" . $db->sql_escape($config_value) . "')";
|
||||
VALUES ('" . $db->sql_escape($config_name) . "', '" . $db->sql_escape($config_value) . "')";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
@@ -422,6 +422,7 @@ function tz_select($default = '')
|
||||
{
|
||||
global $sys_timezone, $user;
|
||||
|
||||
$tz_select = '';
|
||||
foreach ($user->lang['tz'] as $offset => $zone)
|
||||
{
|
||||
if (is_numeric($offset))
|
||||
@@ -551,21 +552,25 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_array($forum_id))
|
||||
{
|
||||
$forum_id = array($forum_id);
|
||||
}
|
||||
|
||||
// Default tracking type
|
||||
$type = TRACK_NORMAL;
|
||||
$current_time = ($marktime) ? $marktime : time();
|
||||
$topic_id = (int) $topic_id;
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'mark':
|
||||
if ($config['load_db_lastread'])
|
||||
{
|
||||
$sql_where = (is_array($forum_id)) ? ' IN (' . implode(', ', array_map('intval', $forum_id)) . ')' : ' = ' . (int) $forum_id;
|
||||
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . FORUMS_TRACK_TABLE . '
|
||||
WHERE user_id = ' . $user->data['user_id'] . "
|
||||
AND forum_id $sql_where";
|
||||
WHERE user_id = ' . $user->data['user_id'] . '
|
||||
AND forum_id IN (' . implode(', ', array_map('intval', $forum_id)) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$sql_update = array();
|
||||
@@ -623,12 +628,10 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
|
||||
{
|
||||
$tracking = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track'])) : array();
|
||||
|
||||
$forum_id_ary = (!is_array($forum_id)) ? array($forum_id) : $forum_id;
|
||||
|
||||
foreach ($forum_id_ary as $forum_id)
|
||||
foreach ($forum_id as $f_id)
|
||||
{
|
||||
unset($tracking[$forum_id]);
|
||||
$tracking[$forum_id][0] = base_convert($current_time - $config['board_startdate'], 10, 36);
|
||||
unset($tracking[$f_id]);
|
||||
$tracking[$f_id][0] = base_convert($current_time - $config['board_startdate'], 10, 36);
|
||||
}
|
||||
|
||||
setcookie($config['cookie_name'] . '_track', serialize($tracking), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
|
||||
@@ -641,6 +644,8 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
|
||||
$type = TRACK_POSTED;
|
||||
|
||||
case 'topic':
|
||||
$forum_id = (int) $forum_id[0];
|
||||
|
||||
// Mark a topic as read
|
||||
if ($config['load_db_lastread'] || ($config['load_db_track'] && $type == TRACK_POSTED))
|
||||
{
|
||||
@@ -668,7 +673,7 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
|
||||
{
|
||||
$tracking = unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track']));
|
||||
|
||||
// If the cookie grows larger than 3000 characters we will remove
|
||||
// If the cookie grows larger than 2000 characters we will remove
|
||||
// the smallest value
|
||||
if (strlen($_COOKIE[$config['cookie_name'] . '_track']) > 2000)
|
||||
{
|
||||
@@ -906,8 +911,15 @@ function obtain_attach_extensions(&$extensions)
|
||||
$extensions[$extension]['upload_icon'] = trim($row['upload_icon']);
|
||||
$extensions[$extension]['max_filesize'] = (int) $row['max_filesize'];
|
||||
|
||||
$allowed_forums = ($row['allowed_forums']) ? unserialize(trim($row['allowed_forums'])) : array();
|
||||
|
||||
if ($row['allow_in_pm'])
|
||||
{
|
||||
$allowed_forums = array_merge($allowed_forums, array(0));
|
||||
}
|
||||
|
||||
// Store allowed extensions forum wise
|
||||
$extensions['_allowed_'][$extension] = (!$row['allowed_forums']) ? 0 : unserialize(trim($row['allowed_forums']));
|
||||
$extensions['_allowed_'][$extension] = (!sizeof($allowed_forums)) ? 0 : $allowed_forums;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@@ -967,6 +979,42 @@ function meta_refresh($time, $url)
|
||||
);
|
||||
}
|
||||
|
||||
// Build Confirm box with session id and user id check
|
||||
function confirm_box($check, $title = '', $url = '', $hidden = '')
|
||||
{
|
||||
global $user, $template;
|
||||
|
||||
if ($check)
|
||||
{
|
||||
$user_id = request_var('user_id', 0);
|
||||
$session_id = request_var('sess', 0);
|
||||
|
||||
if ($user_id != $user->data['user_id'] || $session_id != $user->session_id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$s_hidden_fields = '<input type="hidden" name="user_id" value="' . $user->data['user_id'] . '" /><input type="hidden" name="sess" value="' . $user->session_id . '" />';
|
||||
|
||||
page_header($user->lang[$title]);
|
||||
|
||||
$template->set_filenames(array(
|
||||
'body' => 'confirm_body.html')
|
||||
);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'MESSAGE_TITLE' => $user->lang[$title],
|
||||
'MESSAGE_TEXT' => $user->lang[$title . '_CONFIRM'],
|
||||
|
||||
'S_CONFIRM_ACTION' => $url,
|
||||
'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields)
|
||||
);
|
||||
|
||||
page_footer();
|
||||
}
|
||||
|
||||
// Generate login box or verify password
|
||||
function login_box($s_action, $s_hidden_fields = '', $login_explain = '', $ucp_login = false)
|
||||
@@ -1149,7 +1197,7 @@ function smilie_text($text, $force_option = false)
|
||||
return ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $text);
|
||||
}
|
||||
|
||||
// Check if extension is allowed to be posted within forum X
|
||||
// Check if extension is allowed to be posted within forum X (forum_id 0 == private messaging)
|
||||
function extension_allowed($forum_id, $extension)
|
||||
{
|
||||
global $extensions;
|
||||
@@ -1160,14 +1208,36 @@ function extension_allowed($forum_id, $extension)
|
||||
obtain_attach_extensions($extensions);
|
||||
}
|
||||
|
||||
return (is_array($extensions['_allowed_'][$extension]) && !in_array($forum_id, $extensions['_allowed_'][$extension])) || !isset($extensions['_allowed_'][$extension]);
|
||||
if (!isset($extensions['_allowed_'][$extension]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$check = $extensions['_allowed_'][$extension];
|
||||
|
||||
if (is_array($check))
|
||||
{
|
||||
// Check for private messaging
|
||||
if (sizeof($check) == 1 && $check[0] == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return (!in_array($forum_id, $check)) ? false : true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ($forum_id == 0) ? false : true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Error and message handler, call with trigger_error if reqd
|
||||
function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||
{
|
||||
global $cache, $db, $auth, $template, $config, $user;
|
||||
global $phpEx, $phpbb_root_path, $starttime;
|
||||
global $phpEx, $phpbb_root_path, $starttime, $display_header;
|
||||
|
||||
switch ($errno)
|
||||
{
|
||||
@@ -1218,6 +1288,8 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||
}
|
||||
|
||||
$msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text;
|
||||
$msg_title = (!isset($msg_title)) ? $user->lang['INFORMATION'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title);
|
||||
$display_header = (!isset($display_header)) ? false : (bool) $display_header;
|
||||
|
||||
if (defined('IN_ADMIN'))
|
||||
{
|
||||
@@ -1231,7 +1303,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||
);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'MESSAGE_TITLE' => $msg_title,
|
||||
'MESSAGE_TITLE' => (isset($msg_title)) ? $msg_title : $user->lang['INFORMATION'],
|
||||
'MESSAGE_TEXT' => $msg_text)
|
||||
);
|
||||
|
||||
@@ -1410,7 +1482,7 @@ function page_header($page_title = '')
|
||||
$l_message_new = ($user->data['user_new_privmsg'] == 1) ? $user->lang['NEW_PM'] : $user->lang['NEW_PMS'];
|
||||
$l_privmsgs_text = sprintf($l_message_new, $user->data['user_new_privmsg']);
|
||||
|
||||
if ($user->data['user_last_privmsg'] > $user->data['session_last_visit'])
|
||||
if (!$user->data['user_last_privmsg'] || $user->data['user_last_privmsg'] > $user->data['session_last_visit'])
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_last_privmsg = ' . $user->data['session_last_visit'] . '
|
||||
@@ -1430,15 +1502,13 @@ function page_header($page_title = '')
|
||||
$s_privmsg_new = false;
|
||||
}
|
||||
|
||||
if ($user->data['user_unread_privmsg'])
|
||||
$l_privmsgs_text_unread = '';
|
||||
|
||||
if ($user->data['user_unread_privmsg'] && $user->data['user_unread_privmsg'] != $user->data['user_new_privmsg'])
|
||||
{
|
||||
$l_message_unread = ($user->data['user_unread_privmsg'] == 1) ? $user->lang['UNREAD_PM'] : $user->lang['UNREAD_PMS'];
|
||||
$l_privmsgs_text_unread = sprintf($l_message_unread, $user->data['user_unread_privmsg']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$l_privmsgs_text_unread = $user->lang['NO_UNREAD_PM'];
|
||||
}
|
||||
}
|
||||
|
||||
// Which timezone?
|
||||
@@ -1462,7 +1532,9 @@ function page_header($page_title = '')
|
||||
'L_INDEX' => $user->lang['FORUM_INDEX'],
|
||||
'L_ONLINE_EXPLAIN' => $l_online_time,
|
||||
|
||||
'U_PRIVATEMSGS' => $phpbb_root_path . 'ucp.'.$phpEx.$SID.'&mode=pm&folder=inbox',
|
||||
'U_PRIVATEMSGS' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=" . (($user->data['user_new_privmsg'] || $l_privmsgs_text_unread) ? 'unread' : 'view_messages'),
|
||||
'U_RETURN_INBOX' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&folder=inbox",
|
||||
'U_POPUP_PM' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=popup",
|
||||
'U_MEMBERLIST' => "{$phpbb_root_path}memberlist.$phpEx$SID",
|
||||
'U_VIEWONLINE' => "{$phpbb_root_path}viewonline.$phpEx$SID",
|
||||
'U_MEMBERSLIST' => "{$phpbb_root_path}memberlist.$phpEx$SID",
|
||||
@@ -1481,7 +1553,7 @@ function page_header($page_title = '')
|
||||
'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false,
|
||||
'S_USER_PM_POPUP' => $user->optionget('popuppm'),
|
||||
'S_USER_LANG' => $user->data['user_lang'],
|
||||
'S_USER_BROWSER' => $user->data['session_browser'],
|
||||
'S_USER_BROWSER' => (isset($user->data['session_browser'])) ? $user->data['session_browser'] : $user->lang['UNKNOWN_BROWSER'],
|
||||
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],
|
||||
'S_CONTENT_ENCODING' => $user->lang['ENCODING'],
|
||||
'S_CONTENT_DIR_LEFT' => $user->lang['LEFT'],
|
||||
@@ -1489,9 +1561,9 @@ function page_header($page_title = '')
|
||||
'S_TIMEZONE' => ($user->data['user_dst'] || ($user->data['user_id'] == ANONYMOUS && $config['board_dst'])) ? sprintf($user->lang['ALL_TIMES'], $user->lang['tz'][$tz], $user->lang['tz']['dst']) : sprintf($user->lang['ALL_TIMES'], $user->lang['tz'][$tz], ''),
|
||||
'S_DISPLAY_ONLINE_LIST' => (!empty($config['load_online'])) ? 1 : 0,
|
||||
'S_DISPLAY_SEARCH' => (!empty($config['load_search'])) ? 1 : 0,
|
||||
'S_DISPLAY_PM' => (empty($config['privmsg_disable'])) ? 1 : 0,
|
||||
'S_DISPLAY_PM' => (!empty($config['allow_privmsg'])) ? 1 : 0,
|
||||
'S_DISPLAY_MEMBERLIST' => (isset($auth)) ? $auth->acl_get('u_viewprofile') : 0,
|
||||
'S_NEW_PM' => $s_privmsg_new,
|
||||
'S_NEW_PM' => ($s_privmsg_new) ? 1 : 0,
|
||||
|
||||
'T_THEME_PATH' => "{$phpbb_root_path}styles/" . $user->theme['primary']['theme_path'] . '/theme',
|
||||
'T_TEMPLATE_PATH' => "{$phpbb_root_path}styles/" . $user->theme['primary']['template_path'] . '/template',
|
||||
|
@@ -292,7 +292,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = TRUE)
|
||||
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . "
|
||||
SET topic_id = $topic_id
|
||||
WHERE post_id IN (" . implode(', ', $post_ids) . ')';
|
||||
AND in_message = 0
|
||||
WHERE post_msg_id IN (" . implode(', ', $post_ids) . ')';
|
||||
$db->sql_query($sql);
|
||||
|
||||
if ($auto_sync)
|
||||
@@ -490,14 +491,14 @@ function delete_attachments($mode, $ids, $resync = TRUE)
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql_id = ($mode == 'user') ? 'poster_id' : (($mode == 'post') ? 'post_id' : (($mode == 'topic') ? 'topic_id' : 'attach_id'));
|
||||
$sql_id = ($mode == 'user') ? 'poster_id' : (($mode == 'post') ? 'post_msg_id' : (($mode == 'topic') ? 'topic_id' : 'attach_id'));
|
||||
|
||||
$post_ids = $topic_ids = $physical = array();
|
||||
|
||||
// Collect post and topics ids for later use
|
||||
if ($mode == 'attach' || $mode == 'user' || ($mode == 'topic' && $resync))
|
||||
{
|
||||
$sql = 'SELECT post_id, topic_id, physical_filename, thumbnail, filesize
|
||||
$sql = 'SELECT post_msg_id as post_id, topic_id, physical_filename, thumbnail, filesize
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE ' . $sql_id . ' IN (' . implode(', ', $ids) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
@@ -515,7 +516,8 @@ function delete_attachments($mode, $ids, $resync = TRUE)
|
||||
{
|
||||
$sql = 'SELECT topic_id, physical_filename, thumbnail, filesize
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE post_id IN (' . implode(', ', $ids) . ')';
|
||||
WHERE post_msg_id IN (' . implode(', ', $ids) . ')
|
||||
AND in_message = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
@@ -581,14 +583,15 @@ function delete_attachments($mode, $ids, $resync = TRUE)
|
||||
{
|
||||
$remaining = array();
|
||||
|
||||
$sql = 'SELECT post_id
|
||||
$sql = 'SELECT post_msg_id
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
|
||||
WHERE post_msg_id IN (' . implode(', ', $post_ids) . ')
|
||||
AND in_message = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$remaining[] = $row['post_id'];
|
||||
$remaining[] = $row['post_msg_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@@ -599,6 +602,28 @@ function delete_attachments($mode, $ids, $resync = TRUE)
|
||||
SET post_attachment = 0
|
||||
WHERE post_id IN (' . implode(', ', $unset_ids) . ')');
|
||||
}
|
||||
|
||||
$remaining = array();
|
||||
|
||||
$sql = 'SELECT post_msg_id
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE post_msg_id IN (' . implode(', ', $post_ids) . ')
|
||||
AND in_message = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$remaining[] = $row['post_msg_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$unset_ids = array_diff($post_ids, $remaining);
|
||||
if (sizeof($unset_ids))
|
||||
{
|
||||
$db->sql_query('UPDATE ' . PRIVMSGS_TABLE . '
|
||||
SET message_attachment = 0
|
||||
WHERE msg_id IN (' . implode(', ', $unset_ids) . ')');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
}
|
||||
|
||||
// Display list of active topics for this category?
|
||||
$show_active = ($root_data['forum_flags'] & 16) ? true : false;
|
||||
$show_active = (isset($root_data['forum_flags']) && $root_data['forum_flags'] & 16) ? true : false;
|
||||
|
||||
if ($config['load_db_lastread'] && $user->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
@@ -353,6 +353,7 @@ function display_attachments($forum_id, $blockname, $attachment_data, &$update_c
|
||||
$attachment_tpl = array();
|
||||
|
||||
// Generate Template
|
||||
// TODO: secondary template
|
||||
$template_filename = $phpbb_root_path . 'styles/' . $user->theme['primary']['template_path'] . '/template/attachment.html';
|
||||
if (!($fp = @fopen($template_filename, 'rb')))
|
||||
{
|
||||
@@ -411,7 +412,7 @@ function display_attachments($forum_id, $blockname, $attachment_data, &$update_c
|
||||
|
||||
$denied = false;
|
||||
|
||||
if (extension_allowed($forum_id, $attachment['extension']))
|
||||
if (!extension_allowed($forum_id, $attachment['extension']))
|
||||
{
|
||||
$denied = true;
|
||||
|
||||
|
@@ -19,19 +19,21 @@ function generate_smilies($mode, $forum_id)
|
||||
|
||||
if ($mode == 'window')
|
||||
{
|
||||
if (!$forum_id && !$topic_id)
|
||||
if ($forum_id)
|
||||
{
|
||||
trigger_error('NO_TOPIC');
|
||||
$sql = 'SELECT forum_style
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE forum_id = $forum_id";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$user->setup('posting', (int) $row['forum_style']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user->setup('posting');
|
||||
}
|
||||
|
||||
$sql = 'SELECT forum_style
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE forum_id = $forum_id";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$user->setup('posting', (int) $row['forum_style']);
|
||||
|
||||
page_header($user->lang['SMILIES']);
|
||||
|
||||
@@ -89,22 +91,27 @@ function generate_smilies($mode, $forum_id)
|
||||
}
|
||||
|
||||
// Format text to be displayed - from viewtopic.php - centralizing this would be nice ;)
|
||||
function format_display(&$message, &$signature, $uid, $siguid, $html, $bbcode, $url, $smilies, $sig)
|
||||
function format_display(&$message, &$signature, $uid, $siguid, $enable_html, $enable_bbcode, $enable_url, $enable_smilies, $enable_sig, $bbcode = '')
|
||||
{
|
||||
global $auth, $forum_id, $config, $user, $bbcode, $phpbb_root_path;
|
||||
global $auth, $forum_id, $config, $user, $phpbb_root_path;
|
||||
|
||||
if (!$bbcode)
|
||||
{
|
||||
global $bbcode;
|
||||
}
|
||||
|
||||
// Second parse bbcode here
|
||||
$bbcode->bbcode_second_pass($message, $uid);
|
||||
|
||||
// If we allow users to disable display of emoticons we'll need an appropriate
|
||||
// check and preg_replace here
|
||||
$message = smilie_text($message, !$smilies);
|
||||
$message = smilie_text($message, !$enbale_smilies);
|
||||
|
||||
// Replace naughty words such as farty pants
|
||||
$message = str_replace("\n", '<br />', censor_text($message));
|
||||
|
||||
// Signature
|
||||
if ($sig && $config['allow_sig'] && $signature && $auth->acl_get('f_sigs', $forum_id))
|
||||
if ($enable_sig && $config['allow_sig'] && $signature && $auth->acl_get('f_sigs', $forum_id))
|
||||
{
|
||||
$signature = trim($signature);
|
||||
|
||||
@@ -162,7 +169,7 @@ function update_last_post_information($type, $id)
|
||||
}
|
||||
|
||||
// Upload Attachment - filedata is generated here
|
||||
function upload_attachment($forum_id, $filename, $local = false, $local_storage = '')
|
||||
function upload_attachment($forum_id, $filename, $local = false, $local_storage = '', $is_message = false)
|
||||
{
|
||||
global $auth, $user, $config, $db;
|
||||
|
||||
@@ -188,14 +195,17 @@ function upload_attachment($forum_id, $filename, $local = false, $local_storage
|
||||
obtain_attach_extensions($extensions);
|
||||
|
||||
// Check Extension
|
||||
if (extension_allowed($forum_id, $filedata['extension']))
|
||||
if (!extension_allowed($forum_id, $filedata['extension']))
|
||||
{
|
||||
$filedata['error'][] = sprintf($user->lang['DISALLOWED_EXTENSION'], $filedata['extension']);
|
||||
$filedata['post_attach'] = false;
|
||||
return $filedata;
|
||||
}
|
||||
}
|
||||
|
||||
$allowed_filesize = ($extensions[$filedata['extension']]['max_filesize'] != 0) ? $extensions[$filedata['extension']]['max_filesize'] : $config['max_filesize'];
|
||||
$cfg = array();
|
||||
$cfg['max_filesize'] = ($is_message) ? $config['max_filesize_pm'] : $config['max_filesize'];
|
||||
|
||||
$allowed_filesize = ($extensions[$filedata['extension']]['max_filesize'] != 0) ? $extensions[$filedata['extension']]['max_filesize'] : $cfg['max_filesize'];
|
||||
$cat_id = $extensions[$filedata['extension']]['display_cat'];
|
||||
|
||||
// check Filename
|
||||
@@ -253,7 +263,7 @@ function upload_attachment($forum_id, $filename, $local = false, $local_storage
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - Check Free Disk Space - need testing under windows [commented out]
|
||||
// TODO - Check Free Disk Space - need testing under windows
|
||||
if ($free_space = disk_free_space($config['upload_dir']))
|
||||
{
|
||||
if ($free_space <= $filedata['filesize'])
|
||||
@@ -508,14 +518,14 @@ function create_thumbnail($source, $new_file, $mimetype)
|
||||
//
|
||||
|
||||
// DECODE TEXT -> This will/should be handled by bbcode.php eventually
|
||||
function decode_text(&$message, $bbcode_uid)
|
||||
function decode_text(&$message, $bbcode_uid = '')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
|
||||
$server_port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/';
|
||||
|
||||
$search = array(
|
||||
$match = array(
|
||||
'<br />',
|
||||
"[/*:m:$bbcode_uid]",
|
||||
":u:$bbcode_uid",
|
||||
@@ -531,7 +541,7 @@ function decode_text(&$message, $bbcode_uid)
|
||||
''
|
||||
);
|
||||
|
||||
$message = ($bbcode_uid) ? str_replace($search, $replace, $message) : str_replace('<br />', "\n", $message);
|
||||
$message = ($bbcode_uid) ? str_replace($match, $replace, $message) : str_replace('<br />', "\n", $message);
|
||||
|
||||
$match = array(
|
||||
'#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#',
|
||||
@@ -569,4 +579,286 @@ function decode_text(&$message, $bbcode_uid)
|
||||
return;
|
||||
}
|
||||
|
||||
// Temp Function - strtolower - borrowed from php.net
|
||||
function phpbb_strtolower($string)
|
||||
{
|
||||
$new_string = '';
|
||||
|
||||
for ($i = 0; $i < strlen($string); $i++)
|
||||
{
|
||||
if (ord(substr($string, $i, 1)) > 0xa0)
|
||||
{
|
||||
$new_string .= strtolower(substr($string, $i, 2));
|
||||
$i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_string .= strtolower($string{$i});
|
||||
}
|
||||
}
|
||||
|
||||
return $new_string;
|
||||
}
|
||||
|
||||
function posting_gen_topic_icons($mode, $icon_id)
|
||||
{
|
||||
global $phpbb_root_path, $config, $template;
|
||||
|
||||
// Grab icons
|
||||
$icons = array();
|
||||
obtain_icons($icons);
|
||||
|
||||
if (sizeof($icons))
|
||||
{
|
||||
foreach ($icons as $id => $data)
|
||||
{
|
||||
if ($data['display'])
|
||||
{
|
||||
$template->assign_block_vars('topic_icon', array(
|
||||
'ICON_ID' => $id,
|
||||
'ICON_IMG' => $phpbb_root_path . $config['icons_path'] . '/' . $data['img'],
|
||||
'ICON_WIDTH' => $data['width'],
|
||||
'ICON_HEIGHT' => $data['height'],
|
||||
|
||||
'S_ICON_CHECKED' => ($id == $icon_id && $mode != 'reply') ? ' checked="checked"' : '')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function posting_gen_inline_attachments($message_parser)
|
||||
{
|
||||
global $template;
|
||||
|
||||
if (sizeof($message_parser->attachment_data))
|
||||
{
|
||||
$s_inline_attachment_options = '';
|
||||
|
||||
foreach ($message_parser->attachment_data as $i => $attachment)
|
||||
{
|
||||
$s_inline_attachment_options .= '<option value="' . $i . '">' . $attachment['real_filename'] . '</option>';
|
||||
}
|
||||
|
||||
$template->assign_var('S_INLINE_ATTACHMENT_OPTIONS', $s_inline_attachment_options);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
|
||||
{
|
||||
global $auth, $user, $template;
|
||||
|
||||
$toggle = false;
|
||||
|
||||
$topic_types = array(
|
||||
'sticky' => array('const' => POST_STICKY, 'lang' => 'POST_STICKY'),
|
||||
'announce' => array('const' => POST_ANNOUNCE, 'lang' => 'POST_ANNOUNCEMENT'),
|
||||
'global' => array('const' => POST_GLOBAL, 'lang' => 'POST_GLOBAL')
|
||||
);
|
||||
|
||||
$topic_type_array = array();
|
||||
|
||||
foreach ($topic_types as $auth_key => $topic_value)
|
||||
{
|
||||
// Temp - we do not have a special post global announcement permission
|
||||
$auth_key = ($auth_key == 'global') ? 'announce' : $auth_key;
|
||||
|
||||
if ($auth->acl_get('f_' . $auth_key, $forum_id))
|
||||
{
|
||||
$toggle = true;
|
||||
|
||||
$topic_type_array[] = array(
|
||||
'VALUE' => $topic_value['const'],
|
||||
'S_CHECKED' => ($cur_topic_type == $topic_value['const'] || ($forum_id == 0 && $topic_value['const'] == POST_GLOBAL)) ? ' checked="checked"' : '',
|
||||
'L_TOPIC_TYPE' => $user->lang[$topic_value['lang']]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($toggle)
|
||||
{
|
||||
$topic_type_array = array_merge(array(0 => array(
|
||||
'VALUE' => POST_NORMAL,
|
||||
'S_CHECKED' => ($topic_type == POST_NORMAL) ? ' checked="checked"' : '',
|
||||
'L_TOPIC_TYPE' => $user->lang['POST_NORMAL'])),
|
||||
|
||||
$topic_type_array
|
||||
);
|
||||
|
||||
foreach ($topic_type_array as $array)
|
||||
{
|
||||
$template->assign_block_vars('topic_type', $array);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_TOPIC_TYPE_STICKY' => ($auth->acl_get('f_sticky', $forum_id)),
|
||||
'S_TOPIC_TYPE_ANNOUNCE' => ($auth->acl_get('f_announce', $forum_id)))
|
||||
);
|
||||
}
|
||||
|
||||
return $toggle;
|
||||
}
|
||||
|
||||
function posting_gen_attachment_entry($message_parser)
|
||||
{
|
||||
global $template, $config, $phpbb_root_path, $SID, $phpEx;
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_SHOW_ATTACH_BOX' => true)
|
||||
);
|
||||
|
||||
if (sizeof($message_parser->attachment_data))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_HAS_ATTACHMENTS' => true)
|
||||
);
|
||||
|
||||
$count = 0;
|
||||
foreach ($message_parser->attachment_data as $attach_row)
|
||||
{
|
||||
$hidden = '';
|
||||
$attach_row['real_filename'] = stripslashes($attach_row['real_filename']);
|
||||
|
||||
foreach ($attach_row as $key => $value)
|
||||
{
|
||||
$hidden .= '<input type="hidden" name="attachment_data[' . $count . '][' . $key . ']" value="' . $value . '" />';
|
||||
}
|
||||
|
||||
$download_link = (!$attach_row['attach_id']) ? $config['upload_dir'] . '/' . $attach_row['physical_filename'] : $phpbb_root_path . "download.$phpEx$SID&id=" . intval($attach_row['attach_id']);
|
||||
|
||||
$template->assign_block_vars('attach_row', array(
|
||||
'FILENAME' => $attach_row['real_filename'],
|
||||
'ATTACH_FILENAME' => $attach_row['physical_filename'],
|
||||
'FILE_COMMENT' => $attach_row['comment'],
|
||||
'ATTACH_ID' => $attach_row['attach_id'],
|
||||
'ASSOC_INDEX' => $count,
|
||||
|
||||
'U_VIEW_ATTACHMENT' => $download_link,
|
||||
'S_HIDDEN' => $hidden)
|
||||
);
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'FILE_COMMENT' => $message_parser->filename_data['filecomment'],
|
||||
'FILESIZE' => $config['max_filesize'],
|
||||
'FILENAME' => $message_parser->filename_data['filename'])
|
||||
);
|
||||
|
||||
return sizeof($message_parser->attachment_data);
|
||||
}
|
||||
|
||||
// Load Drafts
|
||||
function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
||||
{
|
||||
global $user, $db, $template, $phpEx, $SID, $auth;
|
||||
|
||||
// Only those fitting into this forum...
|
||||
if ($forum_id || $topic_id)
|
||||
{
|
||||
$sql = 'SELECT d.draft_id, d.topic_id, d.forum_id, d.draft_subject, d.save_time, f.forum_name
|
||||
FROM ' . DRAFTS_TABLE . ' d, ' . FORUMS_TABLE . ' f
|
||||
WHERE d.user_id = ' . $user->data['user_id'] . '
|
||||
AND f.forum_id = d.forum_id ' .
|
||||
(($forum_id) ? " AND f.forum_id = $forum_id" : '') . '
|
||||
ORDER BY d.save_time DESC';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . DRAFTS_TABLE . '
|
||||
WHERE user_id = ' . $user->data['user_id'] . '
|
||||
AND forum_id = 0
|
||||
AND topic_id = 0
|
||||
ORDER BY save_time DESC';
|
||||
}
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$draftrows = $topic_ids = array();
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['topic_id'])
|
||||
{
|
||||
$topic_ids[] = (int) $row['topic_id'];
|
||||
}
|
||||
$draftrows[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($topic_ids))
|
||||
{
|
||||
$sql = 'SELECT topic_id, forum_id, topic_title
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_id IN (' . implode(',', array_unique($topic_ids)) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$topic_rows[$row['topic_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
unset($topic_ids);
|
||||
|
||||
if (sizeof($draftrows))
|
||||
{
|
||||
$row_count = 0;
|
||||
$template->assign_var('S_SHOW_DRAFTS', true);
|
||||
|
||||
foreach ($draftrows as $draft)
|
||||
{
|
||||
$link_topic = $link_forum = $link_pm = false;
|
||||
$insert_url = $view_url = $title = '';
|
||||
|
||||
if (isset($topic_rows[$draft['topic_id']]) && $auth->acl_get('f_read', $topic_rows[$draft['topic_id']]['forum_id']))
|
||||
{
|
||||
$link_topic = true;
|
||||
$view_url = "viewtopic.$phpEx$SID&f=" . $topic_rows[$draft['topic_id']]['forum_id'] . "&t=" . $draft['topic_id'];
|
||||
$title = $topic_rows[$draft['topic_id']]['topic_title'];
|
||||
|
||||
$insert_url = "posting.$phpEx$SID&f=" . $topic_rows[$draft['topic_id']]['forum_id'] . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id'];
|
||||
}
|
||||
else if ($auth->acl_get('f_read', $draft['forum_id']))
|
||||
{
|
||||
$link_forum = true;
|
||||
$view_url = "viewforum.$phpEx$SID&f=" . $draft['forum_id'];
|
||||
$title = $draft['forum_name'];
|
||||
|
||||
$insert_url = "posting.$phpEx$SID&f=" . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$link_pm = true;
|
||||
$insert_url = "ucp.$phpEx$SID&i=$id&mode=compose&d=" . $draft['draft_id'];
|
||||
}
|
||||
|
||||
$template->assign_block_vars('draftrow', array(
|
||||
'DRAFT_ID' => $draft['draft_id'],
|
||||
'DATE' => $user->format_date($draft['save_time']),
|
||||
'DRAFT_SUBJECT' => $draft['draft_subject'],
|
||||
|
||||
'TITLE' => $title,
|
||||
'U_VIEW' => $view_url,
|
||||
'U_INSERT' => $insert_url,
|
||||
|
||||
'S_ROW_COUNT' => $row_count++,
|
||||
'S_LINK_PM' => $link_pm,
|
||||
'S_LINK_TOPIC' => $link_topic,
|
||||
'S_LINK_FORUM' => $link_forum)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -1114,7 +1114,7 @@ function group_create($group_id, $type, $name, $desc)
|
||||
'group_type' => (int) $type,
|
||||
);
|
||||
|
||||
$attribute_ary = array('group_colour' => 'string', 'group_rank' => 'int', 'group_avatar' => 'string', 'group_avatar_type' => 'int', 'group_avatar_width' => 'int', 'group_avatar_height' => 'int');
|
||||
$attribute_ary = array('group_colour' => 'string', 'group_rank' => 'int', 'group_avatar' => 'string', 'group_avatar_type' => 'int', 'group_avatar_width' => 'int', 'group_avatar_height' => 'int', 'group_receive_pm' => 'int', 'group_message_limit' => 'int');
|
||||
|
||||
$i = 4;
|
||||
foreach ($attribute_ary as $attribute => $type)
|
||||
|
@@ -134,11 +134,10 @@ class parse_message
|
||||
$server_protocol = ( $config['cookie_secure'] ) ? 'https://' : 'http://';
|
||||
$server_port = ( $config['server_port'] <> 80 ) ? ':' . trim($config['server_port']) . '/' : '/';
|
||||
|
||||
$match = array();
|
||||
$replace = array();
|
||||
$match = $replace = array();
|
||||
|
||||
// relative urls for this board
|
||||
$match[] = '#(^|[\n ])' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '$1', trim($config['script_path'])) . '(?:/[^ \t\n\r<"\']*)?)#i';
|
||||
$match[] = '#((^|[\n ])' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '$1', trim($config['script_path'])) . '(?:/[^ \t\n\r<"\']*)?)#i';
|
||||
$replace[] = '<!-- l --><a href="$1" target="_blank">$1</a><!-- l -->';
|
||||
|
||||
// matches a xxxx://aaaaa.bbb.cccc. ...
|
||||
@@ -291,6 +290,7 @@ class parse_message
|
||||
}
|
||||
}
|
||||
|
||||
// Hardcode inline attachments [ia]
|
||||
function bbcode_attachment($stx, $in)
|
||||
{
|
||||
$out = '[attachment=' . $stx . ':' . $this->bbcode_uid . ']<!-- ia' . $stx . ' -->' . $in . '<!-- ia' . $stx . ' -->[/attachment:' . $this->bbcode_uid . ']';
|
||||
@@ -704,14 +704,14 @@ class parse_message
|
||||
}
|
||||
|
||||
// Parse Attachments
|
||||
function parse_attachments($mode, $post_id, $submit, $preview, $refresh)
|
||||
function parse_attachments($mode, $post_id, $submit, $preview, $refresh, $is_message = false)
|
||||
{
|
||||
global $config, $auth, $user, $forum_id;
|
||||
global $_FILES, $_POST;
|
||||
|
||||
$error = array();
|
||||
|
||||
$num_attachments = count($this->attachment_data);
|
||||
$num_attachments = sizeof($this->attachment_data);
|
||||
$this->filename_data['filecomment'] = preg_replace('#&(\#[0-9]+;)#', '&\1', request_var('filecomment', ''));
|
||||
$this->filename_data['filename'] = ($_FILES['fileupload']['name'] != 'none') ? trim($_FILES['fileupload']['name']) : '';
|
||||
|
||||
@@ -719,15 +719,19 @@ class parse_message
|
||||
$delete_file = (isset($_POST['delete_file']));
|
||||
$edit_comment = (isset($_POST['edit_comment']));
|
||||
|
||||
$cfg = array();
|
||||
$cfg['max_attachments'] = ($is_message) ? $config['max_attachments_pm'] : $config['max_attachments'];
|
||||
$forum_id = ($is_message) ? 0 : $forum_id;
|
||||
|
||||
if ($submit && in_array($mode, array('post', 'reply', 'quote', 'edit')) && $this->filename_data['filename'])
|
||||
{
|
||||
if ($num_attachments < $config['max_attachments'] || $auth->acl_gets('m_', 'a_'))
|
||||
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_'))
|
||||
{
|
||||
$filedata = upload_attachment($forum_id, $this->filename_data['filename']);
|
||||
$filedata = upload_attachment($forum_id, $this->filename_data['filename'], false, '', $is_message);
|
||||
|
||||
$error = $filedata['error'];
|
||||
|
||||
if ($filedata['post_attach'] && !count($error))
|
||||
if ($filedata['post_attach'] && !sizeof($error))
|
||||
{
|
||||
$new_entry = array(
|
||||
'physical_filename' => $filedata['destination_filename'],
|
||||
@@ -759,7 +763,7 @@ class parse_message
|
||||
}
|
||||
else
|
||||
{
|
||||
$error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $config['max_attachments']);
|
||||
$error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $cfg['max_attachments']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -805,10 +809,10 @@ class parse_message
|
||||
|
||||
if (($add_file || $preview) && $this->filename_data['filename'])
|
||||
{
|
||||
if ($num_attachments < $config['max_attachments'] || $auth->acl_gets('m_', 'a_'))
|
||||
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_'))
|
||||
{
|
||||
$filedata = upload_attachment($forum_id, $this->filename_data['filename']);
|
||||
|
||||
$filedata = upload_attachment($forum_id, $this->filename_data['filename'], false, '', $is_message);
|
||||
|
||||
$error = array_merge($error, $filedata['error']);
|
||||
|
||||
if (!count($error))
|
||||
@@ -832,7 +836,7 @@ class parse_message
|
||||
}
|
||||
else
|
||||
{
|
||||
$error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $config['max_attachments']);
|
||||
$error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $cfg['max_attachments']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -844,6 +848,35 @@ class parse_message
|
||||
}
|
||||
}
|
||||
|
||||
// Get Attachment Data
|
||||
function get_submitted_attachment_data()
|
||||
{
|
||||
global $_FILES, $_POST;
|
||||
|
||||
$this->filename_data['filecomment'] = preg_replace('#&(\#[0-9]+;)#', '&\1', request_var('filecomment', ''));
|
||||
$this->filename_data['filename'] = ($_FILES['fileupload']['name'] != 'none') ? trim($_FILES['fileupload']['name']) : '';
|
||||
|
||||
$this->attachment_data = (isset($_POST['attachment_data'])) ? $_POST['attachment_data'] : array();
|
||||
|
||||
//
|
||||
$data_prepare = array('physical_filename' => 's', 'real_filename' => 's', 'comment' => 's', 'extension' => 's', 'mimetype' => 's',
|
||||
'filesize' => 'i', 'filetime' => 'i', 'attach_id' => 'i', 'thumbnail' => 'i');
|
||||
foreach ($this->attachment_data as $pos => $var_ary)
|
||||
{
|
||||
foreach ($data_prepare as $var => $type)
|
||||
{
|
||||
if ($type == 's')
|
||||
{
|
||||
$this->attachment_data[$pos][$var] = htmlspecialchars(trim(stripslashes(preg_replace(array("#[ \xFF]{2,}#s", "#[\r\n]{2,}#s"), array(' ', "\n"), $this->attachment_data[$pos][$var]))));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->attachment_data[$pos][$var] = (int) $this->attachment_data[$pos][$var];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse Poll
|
||||
function parse_poll(&$poll, $poll_data)
|
||||
{
|
||||
|
@@ -420,7 +420,7 @@ class template
|
||||
default:
|
||||
$this->compile_var_tags($blocks[0][$curr_tb]);
|
||||
$trim_check = trim($blocks[0][$curr_tb]);
|
||||
$compile_blocks[] = (!$do_not_echo) ? ((!empty($trim_check)) ? $blocks[0][$curr_tb] : '') : ((!empty($trim_check)) ? $blocks[0][$curr_tb] : '');
|
||||
$compile_blocks[] = (!$no_echo) ? ((!empty($trim_check)) ? $blocks[0][$curr_tb] : '') : ((!empty($trim_check)) ? $blocks[0][$curr_tb] : '');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -644,7 +644,7 @@ class template
|
||||
|
||||
function compile_tag_define($tag_args, $op)
|
||||
{
|
||||
preg_match('#^(([a-z0-9\-_]+?\.)+?)?\$([A-Z][A-Z0-9_\-]*?) = (\'?)(.*?)(\'?)$#', $tag_args, $match);
|
||||
preg_match('#^(([a-z0-9\-_]+?\.)+?)?\$([A-Z][A-Z0-9_\-]*?) = (\'?)(.*?)(\'?)$#', $tag_args, $match);
|
||||
|
||||
if (empty($match[3]) || empty($match[5]))
|
||||
{
|
||||
|
@@ -107,7 +107,7 @@ class ucp_attachments extends module
|
||||
$view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . '#' . $row['post_id'];
|
||||
|
||||
$template->assign_block_vars('attachrow', array(
|
||||
'ROW_NUMBER' => $i + ($start + 1),
|
||||
'ROW_NUMBER' => $row_count + ($start + 1),
|
||||
'FILENAME' => $row['real_filename'],
|
||||
'COMMENT' => str_replace("\n", '<br />', $row['comment']),
|
||||
'EXTENSION' => $row['extension'],
|
||||
|
@@ -502,6 +502,11 @@ class ucp_main extends module
|
||||
break;
|
||||
|
||||
case 'drafts':
|
||||
global $ucp;
|
||||
|
||||
$pm_drafts = ($ucp->name == 'pm') ? true : false;
|
||||
|
||||
$user->add_lang('posting');
|
||||
|
||||
$edit = (isset($_REQUEST['edit'])) ? true : false;
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
@@ -558,12 +563,24 @@ class ucp_main extends module
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT d.*, f.forum_name
|
||||
FROM ' . DRAFTS_TABLE . ' d, ' . FORUMS_TABLE . ' f
|
||||
WHERE d.user_id = ' . $user->data['user_id'] . ' ' .
|
||||
(($edit) ? "AND d.draft_id = $draft_id" : '') . '
|
||||
AND f.forum_id = d.forum_id
|
||||
ORDER BY save_time DESC';
|
||||
if (!$pm_drafts)
|
||||
{
|
||||
$sql = 'SELECT d.*, f.forum_name
|
||||
FROM ' . DRAFTS_TABLE . ' d, ' . FORUMS_TABLE . ' f
|
||||
WHERE d.user_id = ' . $user->data['user_id'] . ' ' .
|
||||
(($edit) ? "AND d.draft_id = $draft_id" : '') . '
|
||||
AND f.forum_id = d.forum_id
|
||||
ORDER BY d.save_time DESC';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT * FROM ' . DRAFTS_TABLE . '
|
||||
WHERE user_id = ' . $user->data['user_id'] . ' ' .
|
||||
(($edit) ? "AND draft_id = $draft_id" : '') . '
|
||||
AND forum_id = 0
|
||||
AND topic_id = 0
|
||||
ORDER BY save_time DESC';
|
||||
}
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$draftrows = $topic_ids = array();
|
||||
@@ -598,7 +615,7 @@ class ucp_main extends module
|
||||
$row_count = 0;
|
||||
foreach ($draftrows as $draft)
|
||||
{
|
||||
$link_topic = $link_forum = 0;
|
||||
$link_topic = $link_forum = $link_pm = false;
|
||||
$insert_url = $view_url = $title = '';
|
||||
|
||||
if (isset($topic_rows[$draft['topic_id']]) && $auth->acl_get('f_read', $topic_rows[$draft['topic_id']]['forum_id']))
|
||||
@@ -617,6 +634,11 @@ class ucp_main extends module
|
||||
|
||||
$insert_url = "posting.$phpEx$SID&f=" . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id'];
|
||||
}
|
||||
else if ($pm_drafts)
|
||||
{
|
||||
$link_pm = true;
|
||||
$insert_url = "ucp.$phpEx$SID&i=$id&mode=compose&d=" . $draft['draft_id'];
|
||||
}
|
||||
|
||||
$template_row = array(
|
||||
'DATE' => $user->format_date($draft['save_time']),
|
||||
@@ -635,6 +657,7 @@ class ucp_main extends module
|
||||
'S_ROW_COUNT' => $row_count++,
|
||||
'S_LINK_TOPIC' => $link_topic,
|
||||
'S_LINK_FORUM' => $link_forum,
|
||||
'S_LINK_PM' => $link_pm,
|
||||
'S_HIDDEN_FIELDS' => $s_hidden_fields
|
||||
);
|
||||
|
||||
@@ -643,7 +666,7 @@ class ucp_main extends module
|
||||
|
||||
if (!$edit)
|
||||
{
|
||||
$template->assign_vars('S_DRAFT_ROWS', $row_count);
|
||||
$template->assign_var('S_DRAFT_ROWS', $row_count);
|
||||
}
|
||||
|
||||
break;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -125,7 +125,7 @@ class ucp_profile extends module
|
||||
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
|
||||
{
|
||||
// Grab an array of user_id's with a_user permissions
|
||||
$admin_ary = auth::acl_get_list(false, 'a_user', false);
|
||||
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
|
||||
|
||||
$sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type
|
||||
FROM ' . USERS_TABLE . '
|
||||
|
@@ -200,7 +200,7 @@ class ucp_register extends module
|
||||
if (sizeof($cp_data))
|
||||
{
|
||||
$cp_data['user_id'] = (int) $user_id;
|
||||
$sql = 'INSERT INTO ' CUSTOM_PROFILE_DATA . ' ' . $db->sql_build_array('INSERT', $cp->build_insert_sql_array($cp_data));
|
||||
$sql = 'INSERT INTO ' . CUSTOM_PROFILE_DATA . ' ' . $db->sql_build_array('INSERT', $cp->build_insert_sql_array($cp_data));
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ class ucp_register extends module
|
||||
{
|
||||
// Grab an array of user_id's with a_user permissions ... these users
|
||||
// can activate a user
|
||||
$admin_ary = auth::acl_get_list(false, 'a_user', false);
|
||||
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
|
||||
|
||||
$sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type
|
||||
FROM ' . USERS_TABLE . '
|
||||
|
@@ -93,7 +93,7 @@ class ucp_zebra extends module
|
||||
if ($mode == 'foes')
|
||||
{
|
||||
$perms = array();
|
||||
foreach (auth::acl_get_list($user_id_ary, array('a_', 'm_')) as $forum_id => $forum_ary)
|
||||
foreach ($auth->acl_get_list($user_id_ary, array('a_', 'm_')) as $forum_id => $forum_ary)
|
||||
{
|
||||
foreach ($forum_ary as $auth_option => $user_ary)
|
||||
{
|
||||
|
Reference in New Issue
Block a user