mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 19:38:53 +00:00
some fixes today
- most important change is the consolidation of the display attachment functions; merging them together to have one function we need to call. git-svn-id: file:///svn/phpbb/trunk@6803 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
9cc0b364bc
commit
ae1cb0316e
20 changed files with 506 additions and 428 deletions
|
@ -32,7 +32,7 @@ switch ($mode)
|
|||
break;
|
||||
|
||||
default:
|
||||
$l_title = $user->lang['FAQ'];
|
||||
$l_title = $user->lang['FAQ_EXPLAIN'];
|
||||
$user->add_lang('faq', false, true);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -181,17 +181,17 @@ class acp_bots
|
|||
}
|
||||
|
||||
$user_id = user_add(array(
|
||||
'user_type' => (int) USER_IGNORE,
|
||||
'group_id' => (int) $group_row['group_id'],
|
||||
'username' => (string) $bot_row['bot_name'],
|
||||
'user_regdate' => time(),
|
||||
'user_password' => '',
|
||||
'user_colour' => (string) $group_row['group_colour'],
|
||||
'user_email' => '',
|
||||
'user_lang' => (string) $bot_row['bot_lang'],
|
||||
'user_style' => (int) $bot_row['bot_style'],
|
||||
'user_options' => 0)
|
||||
);
|
||||
'user_type' => (int) USER_IGNORE,
|
||||
'group_id' => (int) $group_row['group_id'],
|
||||
'username' => (string) $bot_row['bot_name'],
|
||||
'user_regdate' => time(),
|
||||
'user_password' => '',
|
||||
'user_colour' => (string) $group_row['group_colour'],
|
||||
'user_email' => '',
|
||||
'user_lang' => (string) $bot_row['bot_lang'],
|
||||
'user_style' => (int) $bot_row['bot_style'],
|
||||
'user_allow_massemail' => 0,
|
||||
));
|
||||
|
||||
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
'user_id' => (int) $user_id,
|
||||
|
|
|
@ -26,6 +26,8 @@ class acp_inactive
|
|||
global $config, $db, $user, $auth, $template;
|
||||
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
|
||||
$user->add_lang('memberlist');
|
||||
|
||||
$action = request_var('action', '');
|
||||
|
@ -43,7 +45,8 @@ class acp_inactive
|
|||
{
|
||||
case 'activate':
|
||||
case 'delete':
|
||||
$sql = 'SELECT username
|
||||
|
||||
$sql = 'SELECT user_id, username
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $mark);
|
||||
$result = $db->sql_query($sql);
|
||||
|
@ -51,13 +54,12 @@ class acp_inactive
|
|||
$user_affected = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$user_affected[] = $row['username'];
|
||||
$user_affected[$row['user_id']] = $row['username'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($action == 'activate')
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
user_active_flip('activate', $mark);
|
||||
}
|
||||
else if ($action == 'delete')
|
||||
|
@ -67,14 +69,14 @@ class acp_inactive
|
|||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ' . USER_GROUP_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $mark);
|
||||
$db->sql_query($sql);
|
||||
$sql = 'DELETE FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $mark);
|
||||
$db->sql_query($sql);
|
||||
|
||||
add_log('admin', 'LOG_INACTIVE_' . strtoupper($action), implode(', ', $user_affected));
|
||||
foreach ($mark as $user_id)
|
||||
{
|
||||
user_delete('retain', $user_id, $user_affected[$user_id]);
|
||||
}
|
||||
}
|
||||
|
||||
add_log('admin', 'LOG_INACTIVE_' . strtoupper($action), implode(', ', $user_affected));
|
||||
|
||||
break;
|
||||
|
||||
case 'remind':
|
||||
|
|
|
@ -1887,6 +1887,12 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
|
|||
// append/replace SID (may change during the session for AOL users)
|
||||
$redirect = reapply_sid($redirect);
|
||||
|
||||
// Special case... the user is effectively banned, but we allow founders to login
|
||||
if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
meta_refresh(3, $redirect);
|
||||
trigger_error($message . '<br /><br />' . sprintf($l_redirect, '<a href="' . $redirect . '">', '</a>'));
|
||||
}
|
||||
|
@ -2439,24 +2445,288 @@ function smiley_text($text, $force_option = false)
|
|||
}
|
||||
|
||||
/**
|
||||
* Inline Attachment processing
|
||||
* General attachment parsing
|
||||
*
|
||||
* @param int $forum_id The forum id the attachments are displayed in (0 for private messages)
|
||||
* @param string &$message The post/private message
|
||||
* @param array &$attachments The attachments to parse for (inline) display. The attachments array will hold templated data after parsing.
|
||||
* @param array &$update_count The attachment counts to be updated - will be filled
|
||||
* @param bool $preview If set to true the attachments are parsed for preview. Within preview mode the comments are fetched from the given $attachments array and not fetched from the database.
|
||||
*/
|
||||
function parse_inline_attachments(&$text, &$attachments, &$update_count, $forum_id = 0, $preview = false)
|
||||
function parse_attachments($forum_id, &$message, &$attachments, &$update_count, $preview = false)
|
||||
{
|
||||
global $config, $user;
|
||||
|
||||
if (!function_exists('display_attachments'))
|
||||
if (!sizeof($attachments))
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
include("{$phpbb_root_path}includes/functions_display.$phpEx");
|
||||
return;
|
||||
}
|
||||
|
||||
$attachments = display_attachments($forum_id, NULL, $attachments, $update_count, false, true);
|
||||
global $template, $cache, $user;
|
||||
global $extensions, $config, $phpbb_root_path, $phpEx;
|
||||
|
||||
//
|
||||
$force_physical = false;
|
||||
$compiled_attachments = array();
|
||||
|
||||
if (!isset($template->filename['attachment_tpl']))
|
||||
{
|
||||
$template->set_filenames(array(
|
||||
'attachment_tpl' => 'attachment.html')
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($extensions) || !is_array($extensions))
|
||||
{
|
||||
$extensions = $cache->obtain_attach_extensions();
|
||||
}
|
||||
|
||||
// Look for missing attachment information...
|
||||
$attach_ids = array();
|
||||
foreach ($attachments as $pos => $attachment)
|
||||
{
|
||||
// If is_orphan is set, we need to retrieve the attachments again...
|
||||
if (!isset($attachment['extension']) && !isset($attachment['physical_filename']))
|
||||
{
|
||||
$attach_ids[(int) $attachment['attach_id']] = $pos;
|
||||
}
|
||||
}
|
||||
|
||||
// Grab attachments (security precaution)
|
||||
if (sizeof($attach_ids))
|
||||
{
|
||||
global $db;
|
||||
|
||||
$new_attachment_data = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('attach_id', array_keys($attach_ids));
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!isset($attach_ids[$row['attach_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we preview attachments we will set some retrieved values here
|
||||
if ($preview)
|
||||
{
|
||||
$row['attach_comment'] = $attachments[$attach_ids[$row['attach_id']]]['attach_comment'];
|
||||
}
|
||||
|
||||
$new_attachment_data[$attach_ids[$row['attach_id']]] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$attachments = $new_attachment_data;
|
||||
unset($new_attachment_data);
|
||||
}
|
||||
|
||||
// Sort correctly
|
||||
if ($config['display_order'])
|
||||
{
|
||||
// Ascending sort
|
||||
krsort($attachments);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Descending sort
|
||||
ksort($attachments);
|
||||
}
|
||||
|
||||
foreach ($attachments as $attachment)
|
||||
{
|
||||
if (!sizeof($attachment))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// We need to reset/empty the _file block var, because this function might be called more than once
|
||||
$template->destroy_block_vars('_file');
|
||||
|
||||
$block_array = array();
|
||||
|
||||
// Some basics...
|
||||
$attachment['extension'] = strtolower(trim($attachment['extension']));
|
||||
$filename = $phpbb_root_path . $config['upload_path'] . '/' . basename($attachment['physical_filename']);
|
||||
$thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . basename($attachment['physical_filename']);
|
||||
|
||||
$upload_icon = '';
|
||||
|
||||
if (isset($extensions[$attachment['extension']]))
|
||||
{
|
||||
if ($user->img('icon_topic_attach', '') && !$extensions[$attachment['extension']]['upload_icon'])
|
||||
{
|
||||
$upload_icon = $user->img('icon_topic_attach', '');
|
||||
}
|
||||
else if ($extensions[$attachment['extension']]['upload_icon'])
|
||||
{
|
||||
$upload_icon = '<img src="' . $phpbb_root_path . $config['upload_icons_path'] . '/' . trim($extensions[$attachment['extension']]['upload_icon']) . '" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
$filesize = $attachment['filesize'];
|
||||
$size_lang = ($filesize >= 1048576) ? $user->lang['MB'] : ( ($filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] );
|
||||
$filesize = ($filesize >= 1048576) ? round((round($filesize / 1048576 * 100) / 100), 2) : (($filesize >= 1024) ? round((round($filesize / 1024 * 100) / 100), 2) : $filesize);
|
||||
|
||||
$comment = str_replace("\n", '<br />', censor_text($attachment['attach_comment']));
|
||||
|
||||
$block_array += array(
|
||||
'UPLOAD_ICON' => $upload_icon,
|
||||
'FILESIZE' => $filesize,
|
||||
'SIZE_LANG' => $size_lang,
|
||||
'DOWNLOAD_NAME' => basename($attachment['real_filename']),
|
||||
'COMMENT' => $comment,
|
||||
);
|
||||
|
||||
$denied = false;
|
||||
|
||||
if (!extension_allowed($forum_id, $attachment['extension'], $extensions))
|
||||
{
|
||||
$denied = true;
|
||||
|
||||
$block_array += array(
|
||||
'S_DENIED' => true,
|
||||
'DENIED_MESSAGE' => sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])
|
||||
);
|
||||
}
|
||||
|
||||
if (!$denied)
|
||||
{
|
||||
$l_downloaded_viewed = $download_link = '';
|
||||
$display_cat = $extensions[$attachment['extension']]['display_cat'];
|
||||
|
||||
if ($display_cat == ATTACHMENT_CATEGORY_IMAGE)
|
||||
{
|
||||
if ($attachment['thumbnail'])
|
||||
{
|
||||
$display_cat = ATTACHMENT_CATEGORY_THUMB;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($config['img_display_inlined'])
|
||||
{
|
||||
if ($config['img_link_width'] || $config['img_link_height'])
|
||||
{
|
||||
list($width, $height) = @getimagesize($filename);
|
||||
|
||||
$display_cat = (!$width && !$height) ? ATTACHMENT_CATEGORY_IMAGE : (($width <= $config['img_link_width'] && $height <= $config['img_link_height']) ? ATTACHMENT_CATEGORY_IMAGE : ATTACHMENT_CATEGORY_NONE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$display_cat = ATTACHMENT_CATEGORY_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$download_link = (!$force_physical && $attachment['attach_id']) ? append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&f=' . $forum_id) : $filename;
|
||||
|
||||
switch ($display_cat)
|
||||
{
|
||||
// Images
|
||||
case ATTACHMENT_CATEGORY_IMAGE:
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
|
||||
$block_array += array(
|
||||
'S_IMAGE' => true,
|
||||
);
|
||||
|
||||
$update_count[] = $attachment['attach_id'];
|
||||
break;
|
||||
|
||||
// Images, but display Thumbnail
|
||||
case ATTACHMENT_CATEGORY_THUMB:
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
$thumbnail_link = (!$force_physical && $attachment['attach_id']) ? append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&t=1&f=' . $forum_id) : $thumbnail_filename;
|
||||
|
||||
$block_array += array(
|
||||
'S_THUMBNAIL' => true,
|
||||
'THUMB_IMAGE' => $thumbnail_link,
|
||||
);
|
||||
break;
|
||||
|
||||
// Windows Media Streams
|
||||
case ATTACHMENT_CATEGORY_WM:
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
|
||||
// Giving the filename directly because within the wm object all variables are in local context making it impossible
|
||||
// to validate against a valid session (all params can differ)
|
||||
$download_link = $filename;
|
||||
|
||||
$block_array += array(
|
||||
'U_FORUM' => generate_board_url(),
|
||||
'S_WM_FILE' => true,
|
||||
);
|
||||
|
||||
// Viewed/Heared File ... update the download count
|
||||
$update_count[] = $attachment['attach_id'];
|
||||
break;
|
||||
|
||||
// Real Media Streams
|
||||
case ATTACHMENT_CATEGORY_RM:
|
||||
case ATTACHMENT_CATEGORY_QUICKTIME:
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
|
||||
$block_array += array(
|
||||
'S_RM_FILE' => ($display_cat == ATTACHMENT_CATEGORY_RM) ? true : false,
|
||||
'S_QUICKTIME_FILE' => ($display_cat == ATTACHMENT_CATEGORY_QUICKTIME) ? true : false,
|
||||
'U_FORUM' => generate_board_url(),
|
||||
'ATTACH_ID' => $attachment['attach_id'],
|
||||
);
|
||||
|
||||
// Viewed/Heared File ... update the download count
|
||||
$update_count[] = $attachment['attach_id'];
|
||||
break;
|
||||
|
||||
// Macromedia Flash Files
|
||||
case ATTACHMENT_CATEGORY_FLASH:
|
||||
list($width, $height) = @getimagesize($filename);
|
||||
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
|
||||
$block_array += array(
|
||||
'S_FLASH_FILE' => true,
|
||||
'WIDTH' => $width,
|
||||
'HEIGHT' => $height,
|
||||
);
|
||||
|
||||
// Viewed/Heared File ... update the download count
|
||||
$update_count[] = $attachment['attach_id'];
|
||||
break;
|
||||
|
||||
default:
|
||||
$l_downloaded_viewed = $user->lang['DOWNLOADED'];
|
||||
|
||||
$block_array += array(
|
||||
'S_FILE' => true,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$l_download_count = (!isset($attachment['download_count']) || $attachment['download_count'] == 0) ? $user->lang['DOWNLOAD_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang['DOWNLOAD_COUNT'], $attachment['download_count']) : sprintf($user->lang['DOWNLOAD_COUNTS'], $attachment['download_count']));
|
||||
|
||||
$block_array += array(
|
||||
'U_DOWNLOAD_LINK' => $download_link,
|
||||
'L_DOWNLOADED_VIEWED' => $l_downloaded_viewed,
|
||||
'L_DOWNLOAD_COUNT' => $l_download_count
|
||||
);
|
||||
}
|
||||
|
||||
$template->assign_block_vars('_file', $block_array);
|
||||
|
||||
$compiled_attachments[] = $template->assign_display('attachment_tpl');
|
||||
}
|
||||
|
||||
$attachments = $compiled_attachments;
|
||||
unset($compiled_attachments);
|
||||
|
||||
$tpl_size = sizeof($attachments);
|
||||
|
||||
$unset_tpl = array();
|
||||
|
||||
preg_match_all('#<!\-\- ia([0-9]+) \-\->(.*?)<!\-\- ia\1 \-\->#', $text, $matches, PREG_PATTERN_ORDER);
|
||||
preg_match_all('#<!\-\- ia([0-9]+) \-\->(.*?)<!\-\- ia\1 \-\->#', $message, $matches, PREG_PATTERN_ORDER);
|
||||
|
||||
$replace = array();
|
||||
foreach ($matches[0] as $num => $capture)
|
||||
|
@ -2472,10 +2742,16 @@ function parse_inline_attachments(&$text, &$attachments, &$update_count, $forum_
|
|||
|
||||
if (isset($replace['from']))
|
||||
{
|
||||
$text = str_replace($replace['from'], $replace['to'], $text);
|
||||
$message = str_replace($replace['from'], $replace['to'], $message);
|
||||
}
|
||||
|
||||
return array_unique($unset_tpl);
|
||||
$unset_tpl = array_unique($unset_tpl);
|
||||
|
||||
// Needed to let not display the inlined attachments at the end of the post again
|
||||
foreach ($unset_tpl as $index)
|
||||
{
|
||||
unset($attachments[$index]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -688,274 +688,6 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Attachments
|
||||
*/
|
||||
function display_attachments($forum_id, $blockname, &$attachment_data, &$update_count, $force_physical = false, $return = false)
|
||||
{
|
||||
global $template, $cache, $user;
|
||||
global $extensions, $config, $phpbb_root_path, $phpEx;
|
||||
|
||||
$return_tpl = array();
|
||||
|
||||
$template->set_filenames(array(
|
||||
'attachment_tpl' => 'attachment.html')
|
||||
);
|
||||
|
||||
if (!sizeof($attachment_data))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
if (empty($extensions) || !is_array($extensions))
|
||||
{
|
||||
$extensions = $cache->obtain_attach_extensions();
|
||||
}
|
||||
|
||||
// Look for missing attachment information...
|
||||
$attach_ids = array();
|
||||
foreach ($attachment_data as $pos => $attachment)
|
||||
{
|
||||
// If is_orphan is set, we need to retrieve the attachments again...
|
||||
if (!isset($attachment['extension']) && !isset($attachment['physical_filename']))
|
||||
{
|
||||
$attach_ids[(int) $attachment['attach_id']] = $pos;
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($attach_ids))
|
||||
{
|
||||
global $db;
|
||||
|
||||
$attachment_data = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('attach_id', array_keys($attach_ids));
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!isset($attach_ids[$row['attach_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$attachment_data[$attach_ids[$row['attach_id']]] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Sort correctly (please note that the attachment_data array itself get changed by this
|
||||
if ($config['display_order'])
|
||||
{
|
||||
// Ascending sort
|
||||
krsort($attachment_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Descending sort
|
||||
ksort($attachment_data);
|
||||
}
|
||||
|
||||
foreach ($attachment_data as $attachment)
|
||||
{
|
||||
if (!sizeof($attachment))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// We need to reset/empty the _file block var, because this function might be called more than once
|
||||
$template->destroy_block_vars('_file');
|
||||
|
||||
$block_array = array();
|
||||
|
||||
// Some basics...
|
||||
$attachment['extension'] = strtolower(trim($attachment['extension']));
|
||||
$filename = $phpbb_root_path . $config['upload_path'] . '/' . basename($attachment['physical_filename']);
|
||||
$thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . basename($attachment['physical_filename']);
|
||||
|
||||
$upload_icon = '';
|
||||
|
||||
if (isset($extensions[$attachment['extension']]))
|
||||
{
|
||||
if ($user->img('icon_topic_attach', '') && !$extensions[$attachment['extension']]['upload_icon'])
|
||||
{
|
||||
$upload_icon = $user->img('icon_topic_attach', '');
|
||||
}
|
||||
else if ($extensions[$attachment['extension']]['upload_icon'])
|
||||
{
|
||||
$upload_icon = '<img src="' . $phpbb_root_path . $config['upload_icons_path'] . '/' . trim($extensions[$attachment['extension']]['upload_icon']) . '" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
$filesize = $attachment['filesize'];
|
||||
$size_lang = ($filesize >= 1048576) ? $user->lang['MB'] : ( ($filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] );
|
||||
$filesize = ($filesize >= 1048576) ? round((round($filesize / 1048576 * 100) / 100), 2) : (($filesize >= 1024) ? round((round($filesize / 1024 * 100) / 100), 2) : $filesize);
|
||||
|
||||
$comment = str_replace("\n", '<br />', censor_text($attachment['attach_comment']));
|
||||
|
||||
$block_array += array(
|
||||
'UPLOAD_ICON' => $upload_icon,
|
||||
'FILESIZE' => $filesize,
|
||||
'SIZE_LANG' => $size_lang,
|
||||
'DOWNLOAD_NAME' => basename($attachment['real_filename']),
|
||||
'COMMENT' => $comment,
|
||||
);
|
||||
|
||||
$denied = false;
|
||||
|
||||
if (!extension_allowed($forum_id, $attachment['extension'], $extensions))
|
||||
{
|
||||
$denied = true;
|
||||
|
||||
$block_array += array(
|
||||
'S_DENIED' => true,
|
||||
'DENIED_MESSAGE' => sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])
|
||||
);
|
||||
}
|
||||
|
||||
if (!$denied)
|
||||
{
|
||||
$l_downloaded_viewed = $download_link = '';
|
||||
$display_cat = $extensions[$attachment['extension']]['display_cat'];
|
||||
|
||||
if ($display_cat == ATTACHMENT_CATEGORY_IMAGE)
|
||||
{
|
||||
if ($attachment['thumbnail'])
|
||||
{
|
||||
$display_cat = ATTACHMENT_CATEGORY_THUMB;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($config['img_display_inlined'])
|
||||
{
|
||||
if ($config['img_link_width'] || $config['img_link_height'])
|
||||
{
|
||||
list($width, $height) = @getimagesize($filename);
|
||||
|
||||
$display_cat = (!$width && !$height) ? ATTACHMENT_CATEGORY_IMAGE : (($width <= $config['img_link_width'] && $height <= $config['img_link_height']) ? ATTACHMENT_CATEGORY_IMAGE : ATTACHMENT_CATEGORY_NONE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$display_cat = ATTACHMENT_CATEGORY_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$download_link = (!$force_physical && $attachment['attach_id']) ? append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&f=' . $forum_id) : $filename;
|
||||
|
||||
switch ($display_cat)
|
||||
{
|
||||
// Images
|
||||
case ATTACHMENT_CATEGORY_IMAGE:
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
|
||||
$block_array += array(
|
||||
'S_IMAGE' => true,
|
||||
);
|
||||
|
||||
$update_count[] = $attachment['attach_id'];
|
||||
break;
|
||||
|
||||
// Images, but display Thumbnail
|
||||
case ATTACHMENT_CATEGORY_THUMB:
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
$thumbnail_link = (!$force_physical && $attachment['attach_id']) ? append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&t=1&f=' . $forum_id) : $thumbnail_filename;
|
||||
|
||||
$block_array += array(
|
||||
'S_THUMBNAIL' => true,
|
||||
'THUMB_IMAGE' => $thumbnail_link,
|
||||
);
|
||||
break;
|
||||
|
||||
// Windows Media Streams
|
||||
case ATTACHMENT_CATEGORY_WM:
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
|
||||
// Giving the filename directly because within the wm object all variables are in local context making it impossible
|
||||
// to validate against a valid session (all params can differ)
|
||||
$download_link = $filename;
|
||||
|
||||
$block_array += array(
|
||||
'U_FORUM' => generate_board_url(),
|
||||
'S_WM_FILE' => true,
|
||||
);
|
||||
|
||||
// Viewed/Heared File ... update the download count
|
||||
$update_count[] = $attachment['attach_id'];
|
||||
break;
|
||||
|
||||
// Real Media Streams
|
||||
case ATTACHMENT_CATEGORY_RM:
|
||||
case ATTACHMENT_CATEGORY_QUICKTIME:
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
|
||||
$block_array += array(
|
||||
'S_RM_FILE' => ($display_cat == ATTACHMENT_CATEGORY_RM) ? true : false,
|
||||
'S_QUICKTIME_FILE' => ($display_cat == ATTACHMENT_CATEGORY_QUICKTIME) ? true : false,
|
||||
'U_FORUM' => generate_board_url(),
|
||||
'ATTACH_ID' => $attachment['attach_id'],
|
||||
);
|
||||
|
||||
// Viewed/Heared File ... update the download count
|
||||
$update_count[] = $attachment['attach_id'];
|
||||
break;
|
||||
|
||||
// Macromedia Flash Files
|
||||
case ATTACHMENT_CATEGORY_FLASH:
|
||||
list($width, $height) = @getimagesize($filename);
|
||||
|
||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||
|
||||
$block_array += array(
|
||||
'S_FLASH_FILE' => true,
|
||||
'WIDTH' => $width,
|
||||
'HEIGHT' => $height,
|
||||
);
|
||||
|
||||
// Viewed/Heared File ... update the download count
|
||||
$update_count[] = $attachment['attach_id'];
|
||||
break;
|
||||
|
||||
default:
|
||||
$l_downloaded_viewed = $user->lang['DOWNLOADED'];
|
||||
|
||||
$block_array += array(
|
||||
'S_FILE' => true,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$l_download_count = (!isset($attachment['download_count']) || $attachment['download_count'] == 0) ? $user->lang['DOWNLOAD_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang['DOWNLOAD_COUNT'], $attachment['download_count']) : sprintf($user->lang['DOWNLOAD_COUNTS'], $attachment['download_count']));
|
||||
|
||||
$block_array += array(
|
||||
'U_DOWNLOAD_LINK' => $download_link,
|
||||
'L_DOWNLOADED_VIEWED' => $l_downloaded_viewed,
|
||||
'L_DOWNLOAD_COUNT' => $l_download_count
|
||||
);
|
||||
}
|
||||
|
||||
$template->assign_block_vars('_file', $block_array);
|
||||
|
||||
$tpl = $template->assign_display('attachment_tpl');
|
||||
|
||||
if (!$return)
|
||||
{
|
||||
$template->assign_block_vars($blockname, array(
|
||||
'DISPLAY_ATTACHMENT' => $tpl)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$return_tpl[] = $tpl;
|
||||
}
|
||||
}
|
||||
|
||||
return $return_tpl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign/Build custom bbcodes for display in screens supporting using of bbcodes
|
||||
* The custom bbcodes buttons will be placed within the template block 'custom_codes'
|
||||
|
|
|
@ -45,9 +45,21 @@ class messenger
|
|||
*/
|
||||
function to($address, $realname = '')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$pos = isset($this->addresses['to']) ? sizeof($this->addresses['to']) : 0;
|
||||
|
||||
$this->addresses['to'][$pos]['email'] = trim($address);
|
||||
$this->addresses['to'][$pos]['name'] = trim($realname);
|
||||
|
||||
// If empty sendmail_path on windows, PHP changes the to line
|
||||
if (!$config['smtp_delivery'] && strpos(strtolower(PHP_OS), 'win') === 0)
|
||||
{
|
||||
$this->addresses['to'][$pos]['name'] = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->addresses['to'][$pos]['name'] = trim($realname);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,6 +69,11 @@ class p_master
|
|||
$cache->put('_modules_' . $this->p_class, $this->module_cache);
|
||||
}
|
||||
|
||||
if (empty($this->module_cache))
|
||||
{
|
||||
$this->module_cache = array('modules' => array(), 'parents' => array());
|
||||
}
|
||||
|
||||
// We "could" build a true tree with this function - maybe mod authors want to use this...
|
||||
// Functions for traversing and manipulating the tree are not available though
|
||||
// We might re-structure the module system to use true trees in 3.2.x...
|
||||
|
@ -370,7 +375,7 @@ class p_master
|
|||
if (defined('IN_ADMIN'))
|
||||
{
|
||||
// Not being able to overwrite ;)
|
||||
$this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_id}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}";
|
||||
$this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -384,7 +389,7 @@ class p_master
|
|||
$this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name'];
|
||||
}
|
||||
|
||||
$this->module->u_action = append_sid($this->module->u_action, "i={$this->p_id}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}";
|
||||
$this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}";
|
||||
}
|
||||
|
||||
// Assign the module path for re-usage
|
||||
|
@ -394,7 +399,7 @@ class p_master
|
|||
// Users are able to call the main method after this function to be able to assign additional parameters manually
|
||||
if ($execute_module)
|
||||
{
|
||||
$this->module->main(($this->p_name) ? $this->p_name : $this->p_id, $this->p_mode);
|
||||
$this->module->main($this->p_name, $this->p_mode);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -275,6 +275,18 @@ function user_delete($mode, $user_id, $post_username = false)
|
|||
global $cache, $config, $db, $user, $auth;
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id = ' . $user_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$user_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$user_row)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$db->sql_transaction('begin');
|
||||
|
||||
switch ($mode)
|
||||
|
@ -312,18 +324,12 @@ function user_delete($mode, $user_id, $post_username = false)
|
|||
$db->sql_query($sql);
|
||||
|
||||
// Since we change every post by this author, we need to count this amount towards the anonymous user
|
||||
$sql = 'SELECT user_posts
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id = ' . $user_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$num_posts = (int) $db->sql_fetchfield('user_posts');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Update the post count for the anonymous user
|
||||
if ($num_posts)
|
||||
if ($user_row['user_posts'])
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_posts = user_posts + ' . $num_posts . '
|
||||
SET user_posts = user_posts + ' . $user_row['user_posts'] . '
|
||||
WHERE user_id = ' . ANONYMOUS;
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
@ -333,7 +339,7 @@ function user_delete($mode, $user_id, $post_username = false)
|
|||
|
||||
if (!function_exists('delete_posts'))
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
}
|
||||
|
||||
$sql = 'SELECT topic_id, COUNT(post_id) AS total_posts
|
||||
|
@ -391,8 +397,6 @@ function user_delete($mode, $user_id, $post_username = false)
|
|||
|
||||
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
||||
|
||||
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
|
||||
|
||||
// Remove any undelivered mails...
|
||||
$sql = 'SELECT msg_id, user_id
|
||||
FROM ' . PRIVMSGS_TO_TABLE . '
|
||||
|
@ -456,7 +460,11 @@ function user_delete($mode, $user_id, $post_username = false)
|
|||
update_last_username();
|
||||
}
|
||||
|
||||
set_config('num_users', $config['num_users'] - 1, true);
|
||||
// Decrement number of users if this user is active
|
||||
if ($user_row['user_type'] != USER_INACTIVE && $user_row['user_type'] != USER_IGNORE)
|
||||
{
|
||||
set_config('num_users', $config['num_users'] - 1, true);
|
||||
}
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
|
||||
|
@ -1247,7 +1255,7 @@ function validate_email($email)
|
|||
{
|
||||
list(, $domain) = explode('@', $email);
|
||||
|
||||
if (phpbb_checkdnsrr($domain, 'MX') === false)
|
||||
if (phpbb_checkdnsrr($domain, 'A') === false && phpbb_checkdnsrr($domain, 'MX') === false)
|
||||
{
|
||||
return 'DOMAIN_NO_MX_RECORD';
|
||||
}
|
||||
|
@ -1603,12 +1611,19 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
|||
$sql = 'UPDATE ' . GROUPS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE group_id = $group_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Since we may update the name too, we need to do this on other tables too...
|
||||
$sql = 'UPDATE ' . MODERATOR_CACHE_TABLE . "
|
||||
SET group_name = '" . $db->sql_escape($sql_ary['group_name']) . "'
|
||||
WHERE group_id = $group_id";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'INSERT INTO ' . GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
$db->sql_query($sql);
|
||||
|
||||
if (!$group_id)
|
||||
{
|
||||
|
|
|
@ -50,11 +50,11 @@ class mcp_queue
|
|||
|
||||
if ($action == 'approve')
|
||||
{
|
||||
approve_post($post_id_list, $mode);
|
||||
approve_post($post_id_list, 'queue', $mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
disapprove_post($post_id_list, $mode);
|
||||
disapprove_post($post_id_list, 'queue', $mode);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -372,7 +372,7 @@ class mcp_queue
|
|||
/**
|
||||
* Approve Post/Topic
|
||||
*/
|
||||
function approve_post($post_id_list, $mode)
|
||||
function approve_post($post_id_list, $id, $mode)
|
||||
{
|
||||
global $db, $template, $user, $config;
|
||||
global $phpEx, $phpbb_root_path;
|
||||
|
@ -386,7 +386,7 @@ function approve_post($post_id_list, $mode)
|
|||
$success_msg = '';
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
'i' => 'queue',
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'post_id_list' => $post_id_list,
|
||||
'action' => 'approve',
|
||||
|
@ -617,7 +617,7 @@ function approve_post($post_id_list, $mode)
|
|||
/**
|
||||
* Disapprove Post/Topic
|
||||
*/
|
||||
function disapprove_post($post_id_list, $mode)
|
||||
function disapprove_post($post_id_list, $id, $mode)
|
||||
{
|
||||
global $db, $template, $user, $config;
|
||||
global $phpEx, $phpbb_root_path;
|
||||
|
@ -633,7 +633,7 @@ function disapprove_post($post_id_list, $mode)
|
|||
$success_msg = $additional_msg = '';
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
'i' => 'queue',
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'post_id_list' => $post_id_list,
|
||||
'action' => 'disapprove',
|
||||
|
|
|
@ -57,6 +57,21 @@ function mcp_topic_view($id, $mode, $action)
|
|||
$subject = $topic_info['topic_title'];
|
||||
}
|
||||
|
||||
// Approve posts?
|
||||
if ($action == 'approve' && $auth->acl_get('m_approve', $topic_info['forum_id']))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/mcp/mcp_queue.' . $phpEx);
|
||||
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
||||
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
||||
|
||||
if (!sizeof($post_id_list))
|
||||
{
|
||||
trigger_error('NO_POST_SELECTED');
|
||||
}
|
||||
|
||||
approve_post($post_id_list, $id, $mode);
|
||||
}
|
||||
|
||||
// Jumpbox, sort selects and that kind of things
|
||||
make_jumpbox($url . "&i=$id&mode=forum_view", $topic_info['forum_id'], false, 'm_');
|
||||
$where_sql = ($action == 'reports') ? 'WHERE post_reported = 1 AND ' : 'WHERE';
|
||||
|
|
|
@ -1213,7 +1213,22 @@ class parse_message extends bbcode_firstpass
|
|||
|
||||
$add_file = (isset($_POST['add_file'])) ? true : false;
|
||||
$delete_file = (isset($_POST['delete_file'])) ? true : false;
|
||||
$edit_comment = (isset($_POST['edit_comment'])) ? true : false;
|
||||
|
||||
// First of all adjust comments if changed
|
||||
$actual_comment_list = utf8_normalize_nfc(request_var('comment_list', array(''), true));
|
||||
|
||||
foreach ($actual_comment_list as $comment_key => $comment)
|
||||
{
|
||||
if (!isset($this->attachment_data[$comment_key]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->attachment_data[$comment_key]['attach_comment'] != $actual_comment_list[$comment_key])
|
||||
{
|
||||
$this->attachment_data[$comment_key]['attach_comment'] = $actual_comment_list[$comment_key];
|
||||
}
|
||||
}
|
||||
|
||||
$cfg = array();
|
||||
$cfg['max_attachments'] = ($is_message) ? $config['max_attachments_pm'] : $config['max_attachments'];
|
||||
|
@ -1284,7 +1299,6 @@ class parse_message extends bbcode_firstpass
|
|||
|
||||
if (!empty($this->attachment_data[$index]))
|
||||
{
|
||||
|
||||
// delete selected attachment
|
||||
if ($this->attachment_data[$index]['is_orphan'])
|
||||
{
|
||||
|
@ -1321,58 +1335,46 @@ class parse_message extends bbcode_firstpass
|
|||
$this->attachment_data = array_values($this->attachment_data);
|
||||
}
|
||||
}
|
||||
else if ($edit_comment || $add_file || $preview)
|
||||
else if (($add_file || $preview) && $upload_file)
|
||||
{
|
||||
if ($edit_comment)
|
||||
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_', $forum_id))
|
||||
{
|
||||
$actual_comment_list = utf8_normalize_nfc(request_var('comment_list', array(''), true));
|
||||
$filedata = upload_attachment($form_name, $forum_id, false, '', $is_message);
|
||||
$error = array_merge($error, $filedata['error']);
|
||||
|
||||
$edit_comment = request_var('edit_comment', array(0 => ''));
|
||||
$edit_comment = key($edit_comment);
|
||||
$this->attachment_data[$edit_comment]['attach_comment'] = $actual_comment_list[$edit_comment];
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'physical_filename' => $filedata['physical_filename'],
|
||||
'attach_comment' => $this->filename_data['filecomment'],
|
||||
'real_filename' => $filedata['real_filename'],
|
||||
'extension' => $filedata['extension'],
|
||||
'mimetype' => $filedata['mimetype'],
|
||||
'filesize' => $filedata['filesize'],
|
||||
'filetime' => $filedata['filetime'],
|
||||
'thumbnail' => $filedata['thumbnail'],
|
||||
'is_orphan' => 1,
|
||||
'in_message' => ($is_message) ? 1 : 0,
|
||||
'poster_id' => $user->data['user_id'],
|
||||
);
|
||||
|
||||
$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||
|
||||
$new_entry = array(
|
||||
'attach_id' => $db->sql_nextid(),
|
||||
'is_orphan' => 1,
|
||||
'real_filename' => $filedata['real_filename'],
|
||||
'attach_comment'=> $this->filename_data['filecomment'],
|
||||
);
|
||||
|
||||
$this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data);
|
||||
$this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "'[attachment='.(\\1 + 1).']\\2[/attachment]'", $this->message);
|
||||
$this->filename_data['filecomment'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (($add_file || $preview) && $upload_file)
|
||||
else
|
||||
{
|
||||
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_', $forum_id))
|
||||
{
|
||||
$filedata = upload_attachment($form_name, $forum_id, false, '', $is_message);
|
||||
$error = array_merge($error, $filedata['error']);
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'physical_filename' => $filedata['physical_filename'],
|
||||
'attach_comment' => $this->filename_data['filecomment'],
|
||||
'real_filename' => $filedata['real_filename'],
|
||||
'extension' => $filedata['extension'],
|
||||
'mimetype' => $filedata['mimetype'],
|
||||
'filesize' => $filedata['filesize'],
|
||||
'filetime' => $filedata['filetime'],
|
||||
'thumbnail' => $filedata['thumbnail'],
|
||||
'is_orphan' => 1,
|
||||
'in_message' => ($is_message) ? 1 : 0,
|
||||
'poster_id' => $user->data['user_id'],
|
||||
);
|
||||
|
||||
$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||
|
||||
$new_entry = array(
|
||||
'attach_id' => $db->sql_nextid(),
|
||||
'is_orphan' => 1,
|
||||
'real_filename' => $filedata['real_filename'],
|
||||
'attach_comment'=> $this->filename_data['filecomment'],
|
||||
);
|
||||
|
||||
$this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data);
|
||||
$this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "'[attachment='.(\\1 + 1).']\\2[/attachment]'", $this->message);
|
||||
$this->filename_data['filecomment'] = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $cfg['max_attachments']);
|
||||
}
|
||||
$error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $cfg['max_attachments']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -651,7 +651,7 @@ class session
|
|||
* and update the users information from the relevant session data. It will then
|
||||
* grab guest user information.
|
||||
*/
|
||||
function session_kill()
|
||||
function session_kill($new_session = true)
|
||||
{
|
||||
global $SID, $_SID, $db, $config, $phpbb_root_path, $phpEx;
|
||||
|
||||
|
@ -712,7 +712,10 @@ class session
|
|||
$this->session_id = $_SID = '';
|
||||
|
||||
// To make sure a valid session is created we create one for the anonymous user
|
||||
$this->session_create(ANONYMOUS);
|
||||
if ($new_session)
|
||||
{
|
||||
$this->session_create(ANONYMOUS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -820,6 +823,11 @@ class session
|
|||
{
|
||||
global $config, $db;
|
||||
|
||||
if (defined('IN_CHECK_BAN'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$banned = false;
|
||||
|
||||
$sql = 'SELECT ban_ip, ban_userid, ban_email, ban_exclude, ban_give_reason, ban_end
|
||||
|
@ -927,6 +935,23 @@ class session
|
|||
$this->session_kill();
|
||||
}
|
||||
|
||||
// We show a login box here to allow founders accessing the board if banned by IP
|
||||
if (defined('IN_LOGIN') && $this->data['user_id'] == ANONYMOUS)
|
||||
{
|
||||
global $phpEx;
|
||||
|
||||
// Set as a precaution to allow login_box() handling this case correctly as well as this function not being executed again.
|
||||
define('IN_CHECK_BAN', 1);
|
||||
|
||||
$this->setup('ucp');
|
||||
$this->data['is_registered'] = $this->data['is_bot'] = false;
|
||||
|
||||
login_box("index.$phpEx");
|
||||
|
||||
// The false here is needed, else the user is able to circumvent the ban.
|
||||
$this->session_kill(false);
|
||||
}
|
||||
|
||||
// Determine which message to output
|
||||
$till_date = ($ban_row['ban_end']) ? $this->format_date($ban_row['ban_end']) : '';
|
||||
$message = ($ban_row['ban_end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM';
|
||||
|
|
|
@ -48,7 +48,7 @@ function compose_pm($id, $mode, $action)
|
|||
$add_to = (isset($_REQUEST['add_to'])) ? true : false;
|
||||
$add_bcc = (isset($_REQUEST['add_bcc'])) ? true : false;
|
||||
|
||||
$refresh = isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['edit_comment']) || $save || $load
|
||||
$refresh = isset($_POST['add_file']) || isset($_POST['delete_file']) || $save || $load
|
||||
|| $remove_u || $remove_g || $add_to || $add_bcc;
|
||||
|
||||
$action = ($delete && !$preview && !$refresh && $submit) ? 'delete' : $action;
|
||||
|
@ -514,14 +514,17 @@ function compose_pm($id, $mode, $action)
|
|||
}
|
||||
|
||||
// Subject defined
|
||||
if (!$subject && !($remove_u || $remove_g || $add_to || $add_bcc))
|
||||
if ($submit)
|
||||
{
|
||||
$error[] = $user->lang['EMPTY_SUBJECT'];
|
||||
}
|
||||
if (!$subject)
|
||||
{
|
||||
$error[] = $user->lang['EMPTY_SUBJECT'];
|
||||
}
|
||||
|
||||
if (!sizeof($address_list))
|
||||
{
|
||||
$error[] = $user->lang['NO_RECIPIENT'];
|
||||
if (!sizeof($address_list))
|
||||
{
|
||||
$error[] = $user->lang['NO_RECIPIENT'];
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc))
|
||||
|
@ -597,10 +600,20 @@ function compose_pm($id, $mode, $action)
|
|||
// Attachment Preview
|
||||
if (sizeof($message_parser->attachment_data))
|
||||
{
|
||||
$extensions = $update_count = array();
|
||||
|
||||
$template->assign_var('S_HAS_ATTACHMENTS', true);
|
||||
display_attachments(0, 'attachment', $message_parser->attachment_data, $update_count);
|
||||
|
||||
$update_count = array();
|
||||
$attachment_data = $message_parser->attachment_data;
|
||||
|
||||
parse_attachments(0, $preview_message, $attachment_data, $update_count, true);
|
||||
|
||||
foreach ($attachment_data as $i => $attachment)
|
||||
{
|
||||
$template->assign_block_vars('attachment', array(
|
||||
'DISPLAY_ATTACHMENT' => $attachment)
|
||||
);
|
||||
}
|
||||
unset($attachment_data);
|
||||
}
|
||||
|
||||
$preview_subject = censor_text($subject);
|
||||
|
|
|
@ -117,16 +117,10 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
|||
}
|
||||
|
||||
// Assign inline attachments
|
||||
if (isset($attachments) && sizeof($attachments))
|
||||
if (!empty($attachments))
|
||||
{
|
||||
$update_count = array();
|
||||
$unset_attachments = parse_inline_attachments($message, $attachments, $update_count, 0);
|
||||
|
||||
// Needed to let not display the inlined attachments at the end of the message again
|
||||
foreach ($unset_attachments as $index)
|
||||
{
|
||||
unset($attachments[$index]);
|
||||
}
|
||||
parse_attachments(0, $message, $attachments, $update_count);
|
||||
|
||||
// Update the attachment download counts
|
||||
if (sizeof($update_count))
|
||||
|
|
|
@ -1670,17 +1670,18 @@ class install_install extends module
|
|||
foreach ($this->bot_list as $bot_name => $bot_ary)
|
||||
{
|
||||
$user_row = array(
|
||||
'user_type' => USER_IGNORE,
|
||||
'group_id' => $group_id,
|
||||
'username' => $bot_name,
|
||||
'user_regdate' => time(),
|
||||
'user_password' => '',
|
||||
'user_colour' => '9E8DA7',
|
||||
'user_email' => '',
|
||||
'user_lang' => $default_lang,
|
||||
'user_style' => 1,
|
||||
'user_timezone' => 0,
|
||||
'user_dateformat' => $lang['default_dateformat'],
|
||||
'user_type' => USER_IGNORE,
|
||||
'group_id' => $group_id,
|
||||
'username' => $bot_name,
|
||||
'user_regdate' => time(),
|
||||
'user_password' => '',
|
||||
'user_colour' => '9E8DA7',
|
||||
'user_email' => '',
|
||||
'user_lang' => $default_lang,
|
||||
'user_style' => 1,
|
||||
'user_timezone' => 0,
|
||||
'user_dateformat' => $lang['default_dateformat'],
|
||||
'user_allow_massemail' => 0,
|
||||
);
|
||||
|
||||
$user_id = user_add($user_row);
|
||||
|
|
|
@ -396,7 +396,7 @@ INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id,
|
|||
INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('Test Forum 1', 'This is just a test forum.', 2, 3, 1, 1, 1, 1, 1, 1, 2, 'Admin', 'AA0000', 'Welcome to phpBB 3', 972086460, '', '', '', '', '', '', '', 0, 0, '');
|
||||
|
||||
# -- Users / Anonymous user
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0);
|
||||
|
||||
# -- username: Admin password: admin (change this or remove it once everything is working!)
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
|
||||
|
|
|
@ -39,7 +39,7 @@ $load = (isset($_POST['load'])) ? true : false;
|
|||
$delete = (isset($_POST['delete'])) ? true : false;
|
||||
$cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false;
|
||||
|
||||
$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['edit_comment']) || isset($_POST['cancel_unglobalise']) || $save || $load) ? true : false;
|
||||
$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load) ? true : false;
|
||||
$mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var('mode', '');
|
||||
|
||||
$error = $post_data = array();
|
||||
|
@ -733,7 +733,7 @@ if ($submit || $preview || $refresh)
|
|||
}
|
||||
|
||||
// Parse subject
|
||||
if (!$refresh && !$post_data['post_subject'] && ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id)))
|
||||
if (!$preview && !$refresh && !$post_data['post_subject'] && ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id)))
|
||||
{
|
||||
$error[] = $user->lang['EMPTY_SUBJECT'];
|
||||
}
|
||||
|
@ -999,17 +999,12 @@ if (!sizeof($error) && $preview)
|
|||
// Attachment Preview
|
||||
if (sizeof($message_parser->attachment_data))
|
||||
{
|
||||
$extensions = $update_count = array();
|
||||
|
||||
$template->assign_var('S_HAS_ATTACHMENTS', true);
|
||||
|
||||
$update_count = array();
|
||||
$attachment_data = $message_parser->attachment_data;
|
||||
$unset_attachments = parse_inline_attachments($preview_message, $attachment_data, $update_count, $forum_id, true);
|
||||
|
||||
foreach ($unset_attachments as $index)
|
||||
{
|
||||
unset($attachment_data[$index]);
|
||||
}
|
||||
parse_attachments($forum_id, $preview_message, $attachment_data, $update_count, true);
|
||||
|
||||
foreach ($attachment_data as $i => $attachment)
|
||||
{
|
||||
|
@ -1017,7 +1012,7 @@ if (!sizeof($error) && $preview)
|
|||
'DISPLAY_ATTACHMENT' => $attachment)
|
||||
);
|
||||
}
|
||||
unset($attachment_data, $attachment);
|
||||
unset($attachment_data);
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
|
|
|
@ -822,9 +822,9 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
|
||||
}
|
||||
|
||||
if (isset($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]))
|
||||
if (!empty($attachments[$row['post_id']]))
|
||||
{
|
||||
parse_inline_attachments($message, $attachments[$row['post_id']], $update_count, $forum_id);
|
||||
parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);
|
||||
|
||||
// we only display inline attachments
|
||||
unset($attachments[$row['post_id']]);
|
||||
|
|
|
@ -68,9 +68,6 @@
|
|||
<td><textarea class="post" name="comment_list[{attach_row.ASSOC_INDEX}]" rows="3" cols="35" wrap="virtual">{attach_row.FILE_COMMENT}</textarea> </td>
|
||||
<td valign="top">
|
||||
<table border="0" cellspacing="4" cellpadding="0">
|
||||
<tr>
|
||||
<td><input class="btnlite" type="submit" style="width:150px" name="edit_comment[{attach_row.ASSOC_INDEX}]" value="{L_UPDATE_COMMENT}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input class="btnlite" type="submit" style="width:150px" name="delete_file[{attach_row.ASSOC_INDEX}]" value="{L_DELETE_FILE}" /></td>
|
||||
</tr>
|
||||
|
|
|
@ -1266,15 +1266,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
|||
// Always process smilies after parsing bbcodes
|
||||
$message = smiley_text($message);
|
||||
|
||||
if (isset($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]))
|
||||
if (!empty($attachments[$row['post_id']]))
|
||||
{
|
||||
$unset_attachments = parse_inline_attachments($message, $attachments[$row['post_id']], $update_count, $forum_id);
|
||||
|
||||
// Needed to let not display the inlined attachments at the end of the post again
|
||||
foreach ($unset_attachments as $index)
|
||||
{
|
||||
unset($attachments[$row['post_id']][$index]);
|
||||
}
|
||||
parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);
|
||||
}
|
||||
|
||||
// Highlight active words (primarily for search)
|
||||
|
|
Loading…
Add table
Reference in a new issue