1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-21 16:22:22 +02:00

- remove output buffering options from download.php (not needed anymore)

- optimized viewtopic.php a little bit
- removed the create_function (was consuming too much memory) from viewtopic
- check for manually added convert[.exe] program name to imagemagick path in admin_attachments
- reduced filesize checking for imagemagick program (some installations require less than 20k)
- added checked="checked" for "not selected" topic icon
- moved parse_text_display function from functions_posting.php to functions.php (see comment above function)
- check for user_id != ANONYMOUS in page_footer for displaying the administration link (there seems to be a problem checking for global options)
- rewrote attachment thumbnail functions - utilize GD2 functions if available, more uptodate checks...
- changed final thumbnail size calculation
- define S_ROW_COUNT within template class itself
- added SID to template vars in page_header
- added ability to view topic/forum within admin_viewlogs
- added optional acl checking to make_jumpbox, no need to duplicate the function for this small need
- added custom body file for confirm_box


git-svn-id: file:///svn/phpbb/trunk@4920 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2004-07-08 22:41:04 +00:00
parent 48eeecb258
commit 05f1315ebb
29 changed files with 304 additions and 319 deletions

View File

@ -481,6 +481,9 @@ if ($mode == 'attach')
$new['img_imagick'] = search_imagemagick();
}
// We strip eventually manual added convert program, we only want the patch
$new['img_imagick'] = str_replace(array('convert', '.exe'), array('', ''), $new['img_imagick']);
$select_size_mode = size_select('size', $size);
$select_quota_size_mode = size_select('quota_size', $quota_size);
$select_pm_size_mode = size_select('pm_size', $pm_size);
@ -1467,7 +1470,7 @@ function search_imagemagick()
foreach ($locations as $location)
{
if (file_exists($location . 'convert' . $exe) && @is_readable($location . 'convert' . $exe) && @filesize($location . 'convert' . $exe) > 80000)
if (file_exists($location . 'convert' . $exe) && @is_readable($location . 'convert' . $exe) && @filesize($location . 'convert' . $exe) > 10000)
{
$imagick = str_replace('\\', '/', $location);
continue;

View File

@ -227,7 +227,7 @@ switch ($mode)
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
// Split text rules (we saved the status and bbcode codes here)
if (!strstr($forum_rules_flags, ':') && is_numeric($forum_rules_flags))
if (strpos($forum_rules_flags, ':') === false && is_numeric($forum_rules_flags))
{
// text not parsed yet... a hard time for us...
$forum_rules_flags = 0;

View File

@ -152,13 +152,31 @@ if ($log_count)
for($i = 0; $i < sizeof($log_data); $i++)
{
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $log_data[$i]['username']; ?></td>
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $log_data[$i]['ip']; ?></td>
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $user->format_date($log_data[$i]['time']); ?></td>
<td class="<?php echo $row_class; ?>"><?php echo $log_data[$i]['action']; ?></td>
<td class="<?php echo $row_class; ?>"><?php
echo $log_data[$i]['action'];
$data = array();
foreach (array('viewtopic', 'viewlogs', 'viewforum') as $check)
{
if ($log_data[$i][$check])
{
$data[] = '<a href="' . $log_data[$i][$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
}
}
if (sizeof($data))
{
echo '<br />&#187; <span class="gensmall">[ ' . implode(' | ', $data) . ' ]</span>';
}
?>
</td>
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><input type="checkbox" name="mark[]" value="<?php echo $log_data[$i]['id']; ?>" /></td>
</tr>
<?php

View File

@ -193,10 +193,8 @@ function send_file_to_browser($attachment, $upload_dir, $category)
// Now the tricky part... let's dance
// TODO: needs a little bit more testing... seems to break on some configurations (incomplete files)
@ob_end_clean();
@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
header('Content-Transfer-Encoding: none');
// header('Content-Transfer-Encoding: none');
// Send out the Headers
header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $attachment['real_filename'] . '"');

View File

@ -90,14 +90,12 @@ for ($i = 0; $i < count($help_block); $i++)
'FAQ_QUESTION' => $help_block[$i][$j]['question'],
'FAQ_ANSWER' => $help_block[$i][$j]['answer'],
'S_ROW_COUNT' => $j,
'U_FAQ_ID' => $help_block[$i][$j]['id'])
);
$template->assign_block_vars('faq_block_link.faq_row_link', array(
'FAQ_LINK' => $help_block[$i][$j]['question'],
'S_ROW_COUNT' => $j,
'U_FAQ_LINK' => '#' . $help_block[$i][$j]['id'])
);
}

View File

@ -117,6 +117,49 @@ function get_userdata($user)
return ($row = $db->sql_fetchrow($result)) ? $row : false;
}
// prepare text to be displayed/previewed...
// This function is here to save memory (this function is used by viewforum/viewtopic/posting... and to include another huge file is pure memory waste)
function parse_text_display($text, $text_rules)
{
global $bbcode, $user;
$text_flags = explode(':', $text_rules);
$allow_bbcode = (int) $text_flags[0] & 1;
$allow_smilies = (int) $text_flags[0] & 2;
$allow_magic_url = (int) $text_flags[0] & 4;
$bbcode_uid = trim($text_flags[1]);
$bbcode_bitfield = (int) $text_flags[2];
// Really, really process bbcode only if we have something to process...
if (!$bbcode && $allow_bbcode && strpos($text, '[') !== false)
{
global $phpbb_root_path, $phpEx;
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode();
}
// Second parse bbcode here
if ($allow_bbcode)
{
$bbcode->bbcode_second_pass($text, $bbcode_uid, $bbcode_bitfield);
}
// If we allow users to disable display of emoticons we'll need an appropriate
// check and preg_replace here
if ($allow_smilies)
{
$text = smilie_text($text, !$allow_smilies);
}
// Replace naughty words such as farty pants
$text = str_replace("\n", '<br />', censor_text($text));
return $text;
}
// Create forum rules for given forum
function generate_forum_rules($forum_data)
{
@ -129,7 +172,6 @@ function generate_forum_rules($forum_data)
if ($forum_data['forum_rules'])
{
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
$text_flags = explode(':', $forum_data['forum_rules_flags']);
}
@ -155,22 +197,22 @@ function generate_forum_nav(&$forum_data)
list($parent_name, $parent_type) = array_values($parent_data);
$template->assign_block_vars('navlinks', array(
'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false,
'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false,
'FORUM_NAME' => $parent_name,
'FORUM_ID' => $parent_forum_id,
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f=$parent_forum_id")
'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false,
'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false,
'FORUM_NAME' => $parent_name,
'FORUM_ID' => $parent_forum_id,
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f=$parent_forum_id")
);
}
$template->assign_block_vars('navlinks', array(
'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_ID' => $forum_data['forum_id'],
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f=" . $forum_data['forum_id'])
'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_ID' => $forum_data['forum_id'],
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f=" . $forum_data['forum_id'])
);
$template->assign_vars(array(
@ -188,6 +230,7 @@ function get_forum_parents(&$forum_data)
global $db;
$forum_parents = array();
if ($forum_data['parent_id'] > 0)
{
if ($forum_data['forum_parents'] == '')
@ -309,7 +352,7 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key,
return;
}
function make_jumpbox($action, $forum_id = false, $select_all = false)
function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false)
{
global $config, $auth, $template, $user, $db, $phpEx, $SID;
@ -326,7 +369,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false)
$right = $cat_right = $padding = 0;
$padding_store = array('0' => 0);
$display_jumpbox = false;
$iteration = 1;
$iteration = 0;
while ($row = $db->sql_fetchrow($result))
{
@ -341,7 +384,12 @@ function make_jumpbox($action, $forum_id = false, $select_all = false)
// if the user does not have permissions to list this forum skip
continue;
}
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
{
continue;
}
if (!$display_jumpbox)
{
$template->assign_block_vars('jumpbox_forums', array(
@ -984,6 +1032,9 @@ function redirect($url)
$cache->unload();
}
// Make sure no &amp;'s are in, this will break the redirect
$url = str_replace('&amp;', '&', $url);
// Local redirect? If not, prepend the boards url
$url = (!strstr($url, '://')) ? (generate_board_url() . preg_replace('#^/?(.*?)/?$#', '/\1', trim($url))) : $url;
@ -1011,7 +1062,7 @@ function meta_refresh($time, $url)
}
// Build Confirm box
function confirm_box($check, $title = '', $hidden = '')
function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html')
{
global $user, $template, $_POST, $SID, $db;
@ -1059,7 +1110,7 @@ function confirm_box($check, $title = '', $hidden = '')
page_header($user->lang[$title]);
$template->set_filenames(array(
'body' => 'confirm_body.html')
'body' => $html_body)
);
// If activation key already exist, we better do not re-use the key (something very strange is going on...)
@ -1067,7 +1118,7 @@ function confirm_box($check, $title = '', $hidden = '')
{
$user->cur_page = preg_replace('#^(.*?)[&|\?]act_key=[A-Z0-9]{10}(.*?)#', '\1\2', str_replace('&amp;', '&', $user->cur_page));
}
$user_page = $user->cur_page . ((strstr($user->cur_page, '?')) ? '&' : '?') . 'act_key=' . $act_key;
$user_page = $user->cur_page . ((strpos($user->cur_page, '?') !== false) ? '&' : '?') . 'act_key=' . $act_key;
$user_page = str_replace('&amp;', '&', $user_page);
$template->assign_vars(array(
@ -1623,6 +1674,7 @@ function page_header($page_title = '')
'RECORD_USERS' => $l_online_record,
'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
'SID' => $SID,
'L_LOGIN_LOGOUT' => $l_login_logout,
'L_INDEX' => $user->lang['FORUM_INDEX'],
@ -1708,7 +1760,7 @@ function page_footer()
'PHPBB_VERSION' => $config['version'],
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
'U_ACP' => ($auth->acl_get('a_')) ? "adm/index.$phpEx?sid=" . $user->data['session_id'] : '')
'U_ACP' => ($auth->acl_get('a_') && $user->data['user_id'] != ANONYMOUS) ? "adm/index.$phpEx?sid=" . $user->data['session_id'] : '')
);
$template->display('body');

View File

@ -207,7 +207,7 @@ function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png')
}
// Posts and topics manipulation
function move_topics($topic_ids, $forum_id, $auto_sync = TRUE)
function move_topics($topic_ids, $forum_id, $auto_sync = true)
{
global $db;
@ -219,16 +219,6 @@ function move_topics($topic_ids, $forum_id, $auto_sync = TRUE)
AND forum_id = " . $forum_id;
$db->sql_query($sql);
$table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE);
foreach ($table_ary as $table)
{
$sql = "UPDATE $table
SET forum_id = $forum_id
WHERE topic_id " . $sql_where;
$db->sql_query($sql);
}
unset($table_ary);
if ($auto_sync)
{
$sql = 'SELECT DISTINCT forum_id
@ -241,8 +231,21 @@ function move_topics($topic_ids, $forum_id, $auto_sync = TRUE)
$forum_ids[] = $row['forum_id'];
}
$db->sql_freeresult($result);
}
$table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE);
foreach ($table_ary as $table)
{
$sql = "UPDATE $table
SET forum_id = $forum_id
WHERE topic_id " . $sql_where;
$db->sql_query($sql);
}
unset($table_ary);
sync('forum', 'forum_id', $forum_ids, TRUE);
if ($auto_sync)
{
sync('forum', 'forum_id', $forum_ids, true);
unset($forum_ids);
}
}
@ -318,11 +321,11 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
if (!count($where_ids))
{
return array('topics' => 0, 'posts' => '0');
return array('topics' => 0, 'posts' => 0);
}
$return = array(
'posts' => delete_posts($where_type, $where_ids, FALSE)
'posts' => delete_posts($where_type, $where_ids, false)
);
$sql = 'SELECT topic_id, forum_id
@ -337,9 +340,9 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
}
$db->sql_freeresult();
$return['topics'] = count($topic_ids);
$return['topics'] = sizeof($topic_ids);
if (!count($topic_ids))
if (!sizeof($topic_ids))
{
return $return;
}
@ -367,30 +370,10 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
if ($auto_sync)
{
sync('forum', 'forum_id', $forum_ids, TRUE);
sync('forum', 'forum_id', $forum_ids, true);
sync('topic_reported', $where_type, $where_ids);
}
// Not an option here, deleting one post takes > 200 seconds for me (only this query)
/*
// Optimize/vacuum tables
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$table_ary = array(TOPICS_TRACK_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE);
$sql = 'OPTIMIZE TABLE ' . implode(', ', $table_ary);
$db->sql_query($sql);
unset($table_ary);
break;
case 'postgresql':
$db->sql_query('VACUUM');
break;
}
*/
return $return;
}
@ -439,38 +422,18 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE)
}
unset($table_ary);
delete_attachments('post', $post_ids, FALSE);
delete_attachments('post', $post_ids, false);
$db->sql_transaction('commit');
if ($auto_sync)
{
sync('reported', 'topic_id', $topic_ids);
sync('topic', 'topic_id', $topic_ids, TRUE);
sync('forum', 'forum_id', $forum_ids, TRUE);
sync('topic', 'topic_id', $topic_ids, true);
sync('forum', 'forum_id', $forum_ids, true);
}
// Not an option here, deleting one post takes > 200 seconds for me (only this query)
/*
// Optimize/vacuum tables
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$table_ary = array(POSTS_TABLE, RATINGS_TABLE, REPORTS_TABLE, SEARCH_MATCH_TABLE);
$sql = 'OPTIMIZE TABLE ' . implode(', ', $table_ary);
$db->sql_query($sql);
unset($table_ary);
break;
case 'postgresql':
$db->sql_query('VACUUM');
break;
}
*/
return count($post_ids);
return sizeof($post_ids);
}
// Delete Attachments
@ -1841,6 +1804,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
$log[$i]['time'] = $row['log_time'];
$log[$i]['forum_id'] = $row['forum_id'];
$log[$i]['topic_id'] = $row['topic_id'];
$log[$i]['viewforum'] = ($row['forum_id'] && $auth->acl_get('f_read', $row['forum_id'])) ? ((defined('IN_ADMIN')) ? '../' : '') . "viewforum.$phpEx$SID&amp;f=" . $row['forum_id'] : '';
$log[$i]['action'] = (!empty($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : ucfirst(str_replace('_', ' ', $row['log_operation']));
@ -1896,7 +1860,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
foreach ($log as $key => $row)
{
$log[$key]['viewtopic'] = (isset($is_auth[$row['topic_id']])) ? ((defined('IN_ADMIN')) ? '../' : '') . "viewtopic.$phpEx$SID&amp;f=" . $is_auth[$row['topic_id']] . '&amp;t=' . $row['topic_id'] : '';
$log[$key]['viewlogs'] = (isset($is_mod[$row['topic_id']])) ? ((defined('IN_ADMIN')) ? '../' : '') . "mcp.$phpEx$SID&amp;mode=viewlogs&amp;t=" . $row['topic_id'] : '';
$log[$key]['viewlogs'] = (isset($is_mod[$row['topic_id']])) ? ((defined('IN_ADMIN')) ? '../' : '') . "mcp.$phpEx$SID&amp;mode=topic_view&amp;action=viewlogs&amp;t=" . $row['topic_id'] : '';
}
}

View File

@ -172,7 +172,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$redirect = (!empty($_SERVER['REQUEST_URI'])) ? preg_replace('#^(.*?)&(amp;)?mark=.*$#', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])) : "index.$phpEx$SID";
meta_refresh(3, $redirect);
$message = (strstr('viewforum', $redirect)) ? 'RETURN_FORUM' : 'RETURN_INDEX';
$message = (strstr($redirect, 'viewforum')) ? 'RETURN_FORUM' : 'RETURN_INDEX';
$message = $user->lang['FORUMS_MARKED'] . '<br /><br />' . sprintf($user->lang[$message], '<a href="' . $redirect . '">', '</a> ');
trigger_error($message);
}
@ -185,6 +185,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
// Loop through the forums
$root_id = $root_data['forum_id'];
foreach ($forum_rows as $row)
{
if ($row['parent_id'] == $root_id && !$row['parent_id'])
@ -317,7 +318,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
'LAST_POSTER' => $last_poster,
'MODERATORS' => $moderators_list,
'SUBFORUMS' => $subforums_list,
'L_SUBFORUM_STR' => $l_subforums,
'L_MODERATOR_STR' => $l_moderator,
'L_FORUM_FOLDER_ALT'=> $folder_alt,

View File

@ -173,47 +173,6 @@ function parse_text_insert($text, $allow_bbcode, $allow_smilies, $allow_magic_ur
return $message_parser->message;
}
// prepare text to be displayed/previewed...
function parse_text_display($text, $text_rules)
{
global $bbcode, $user;
$text_flags = explode(':', $text_rules);
$allow_bbcode = (int) $text_flags[0] & 1;
$allow_smilies = (int) $text_flags[0] & 2;
$allow_magic_url = (int) $text_flags[0] & 4;
$bbcode_uid = trim($text_flags[1]);
$bbcode_bitfield = (int) $text_flags[2];
if (!$bbcode && $allow_bbcode)
{
global $phpbb_root_path, $phpEx;
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode();
}
// Second parse bbcode here
if ($allow_bbcode)
{
$bbcode->bbcode_second_pass($text, $bbcode_uid, $bbcode_bitfield);
}
// If we allow users to disable display of emoticons we'll need an appropriate
// check and preg_replace here
if ($allow_smilies)
{
$text = smilie_text($text, !$allow_smilies);
}
// Replace naughty words such as farty pants
$text = str_replace("\n", '<br />', censor_text($text));
return $text;
}
// prepare text to be displayed within a form (fetched from db)
function parse_text_form_display($text, $text_rules)
{
@ -285,7 +244,7 @@ function upload_attachment($forum_id, $filename, $local = false, $local_storage
$filedata['mimetype'] = (!$local) ? $_FILES['fileupload']['type'] : 'application/octet-stream';
// Opera adds the name to the mime type
$filedata['mimetype'] = ( strstr($filedata['mimetype'], '; name') ) ? str_replace(strstr($filedata['mimetype'], '; name'), '', $filedata['mimetype']) : $filedata['mimetype'];
$filedata['mimetype'] = (strstr($filedata['mimetype'], '; name')) ? str_replace(strstr($filedata['mimetype'], '; name'), '', $filedata['mimetype']) : $filedata['mimetype'];
$filedata['extension'] = array_pop(explode('.', strtolower($filename)));
$filedata['filesize'] = (!@filesize($file)) ? intval($_FILES['size']) : @filesize($file);
@ -451,9 +410,9 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata)
$source = $config['upload_dir'] . '/' . $destination_filename;
$destination = $config['upload_dir'] . '/thumb_' . $destination_filename;
if (!create_thumbnail($source_filename, $destination_filename, $filedata['mimetype']))
if (!create_thumbnail($source, $destination, $filedata['mimetype']))
{
if (!create_thumbnail($source, $destination, $filedata['mimetype']))
if (!create_thumbnail($source_filename, 'thumb_' . $destination_filename, $filedata['mimetype']))
{
$filedata['thumbnail'] = 0;
}
@ -464,67 +423,63 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata)
}
// Calculate the needed size for Thumbnail
// I am sure i had this grabbed from some site... source: unknown
function get_img_size_format($width, $height)
{
// Change these two values to define the Thumbnail Size
// Maximum Width the Image can take
$max_width = 400;
$max_height = 200;
if ($height > $max_height)
{
$new_width = ($max_height / $height) * $width;
$new_height = $max_height;
if ($new_width > $max_width)
{
$new_height = ($max_width / $new_width) * $new_height;
$new_width = $max_width;
}
}
else if ($width > $max_width)
if ($width > $height)
{
$new_height = ($max_width / $width) * $height;
$new_width = $max_width;
if ($new_height > $max_height)
{
$new_width = ($max_height / $new_height) * $new_width;
$new_height = $max_height;
}
return array(
round($width * ($max_width / $width)),
round($height * ($max_width / $width))
);
}
else
else
{
$new_width = $width;
$new_height = $height;
return array(
round($width * ($max_width / $height)),
round($height * ($max_width / $height))
);
}
return array(
round($new_width),
round($new_height)
);
}
function get_supported_image_types()
function get_supported_image_types($type)
{
$types = array();
if (@extension_loaded('gd'))
{
if (@function_exists('imagegif'))
$format = imagetypes();
$new_type = 0;
switch ($type)
{
$types[] = '1';
case 1:
$new_type = ($format & IMG_GIF) ? IMG_GIF : 0;
break;
case 2:
case 9:
case 10:
case 11:
case 12:
$new_type = ($format & IMG_JPG) ? IMG_JPG : 0;
break;
case 3:
$new_type = ($format & IMG_PNG) ? IMG_PNG : 0;
break;
case 6:
case 15:
$new_type = ($format & IMG_WBMP) ? IMG_WBMP : 0;
break;
}
if (@function_exists('imagejpeg'))
{
$types[] = '2';
}
if (@function_exists('imagepng'))
{
$types[] = '3';
}
}
return $types;
return array(
'gd' => ($new_type) ? true : false,
'format' => $new_type,
'version' => (function_exists('imagecreatetruecolor')) ? 2 : 1
);
}
return array('gd' => false);
}
// Create Thumbnail
@ -542,61 +497,76 @@ function create_thumbnail($source, $new_file, $mimetype)
return false;
}
$size = getimagesize($source);
list($width, $height, $type, ) = getimagesize($source);
if ($size[0] == 0 && $size[1] == 0)
if (!$width || !$height)
{
return false;
}
$new_size = get_img_size_format($size[0], $size[1]);
$tmp_path = $old_file = '';
list($new_width, $new_height) = get_img_size_format($width, $height);
$used_imagick = false;
if ($config['img_imagick'])
{
if (is_array($size) && count($size) > 0)
passthru($config['img_imagick'] . 'convert' . ((defined('PHP_OS') && preg_match('#win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -antialias -sample ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $new_file) . '"');
if (file_exists($new_file))
{
passthru($config['img_imagick'] . 'convert' . ((defined('PHP_OS') && preg_match('#win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -antialias -sample ' . $new_size[0] . 'x' . $new_size[1] . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $new_file) . '"');
if (file_exists($new_file))
{
$used_imagick = true;
}
$used_imagick = true;
}
}
if (!$used_imagick)
{
$type = $size[2];
$supported_types = get_supported_image_types();
$type = get_supported_image_types($type);
if (in_array($type, $supported_types))
if ($type['gd'])
{
switch ($type)
switch ($type['format'])
{
case '1' :
case IMG_GIF:
$image = imagecreatefromgif($source);
$new_image = imagecreate($new_size[0], $new_size[1]);
imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]);
imagegif($new_image, $new_file);
break;
case '2' :
case IMG_JPG:
$image = imagecreatefromjpeg($source);
$new_image = imagecreate($new_size[0], $new_size[1]);
imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]);
imagejpeg($new_image, $new_file, 90);
break;
case '3' :
case IMG_PNG:
$image = imagecreatefrompng($source);
$new_image = imagecreate($new_size[0], $new_size[1]);
imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]);
imagepng($new_image, $new_file);
break;
case IMG_WBMP:
$image = imagecreatefromwbmp($source);
break;
}
if ($type['version'] == 1)
{
$new_image = imagecreate($new_width, $new_height);
imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
}
else
{
$new_image = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
}
switch ($type['format'])
{
case IMG_GIF:
imagegif($new_image, $new_file);
break;
case IMG_JPG:
imagejpeg($new_image, $new_file, 90);
break;
case IMG_PNG:
imagepng($new_image, $new_file);
break;
case IMG_WBMP:
imagewbmp($new_image, $new_file);
break;
}
imagedestroy($new_image);
}
}
@ -605,7 +575,6 @@ function create_thumbnail($source, $new_file, $mimetype)
return false;
}
@chmod($new_file, 0666);
return true;
@ -702,6 +671,11 @@ function posting_gen_topic_icons($mode, $icon_id)
$icons = array();
obtain_icons($icons);
if (!$icon_id)
{
$template->assign_var('S_NO_ICON_CHECKED', ' checked="checked"');
}
if (sizeof($icons))
{
foreach ($icons as $id => $data)
@ -714,6 +688,7 @@ function posting_gen_topic_icons($mode, $icon_id)
'ICON_WIDTH' => $data['width'],
'ICON_HEIGHT' => $data['height'],
'S_CHECKED' => ($id == $icon_id) ? true : false,
'S_ICON_CHECKED' => ($id == $icon_id) ? ' checked="checked"' : '')
);
}
@ -907,7 +882,6 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
if (sizeof($draftrows))
{
$row_count = 0;
$template->assign_var('S_SHOW_DRAFTS', true);
foreach ($draftrows as $draft)
@ -946,7 +920,6 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
'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)

View File

@ -355,7 +355,8 @@ function place_pm_into_folder($global_privmsgs_rules, $release = false)
{
case ACTION_PLACE_INTO_FOLDER:
$folder_action = true;
$move_into_folder[$rule_ary['folder_id']][] = $msg_id;
$_folder_id = (int) $rule_ary['folder_id'];
$move_into_folder[$_folder_id][] = $msg_id;
$num_new++;
break;

View File

@ -255,7 +255,7 @@ class template
// Assign key variable pairs from an array to a specified block
function assign_block_vars($blockname, $vararray)
{
if (strstr($blockname, '.'))
if (strpos($blockname, '.') !== false)
{
// Nested block.
$blocks = explode('.', $blockname);
@ -271,6 +271,7 @@ class template
// Now we add the block that we're actually assigning to.
// We're adding a new iteration to this block with the given
// variable assignments.
$vararray['S_ROW_COUNT'] = sizeof($str[$blocks[$blockcount]]);
$str[$blocks[$blockcount]][] = &$vararray;
}
else
@ -278,6 +279,7 @@ class template
// Top-level block.
// Add a new iteration to this block with the variable assignments
// we were given.
$vararray['S_ROW_COUNT'] = sizeof($this->_tpldata[$blockname]);
$this->_tpldata[$blockname][] = &$vararray;
}

View File

@ -122,12 +122,13 @@ class ucp_attachments extends module
'POST_ID' => $row['post_msg_id'],
'TOPIC_ID' => $row['topic_id'],
'S_ROW_COUNT' => $row_count++,
'S_IN_MESSAGE' => $row['in_message'],
'U_VIEW_ATTACHMENT' => $phpbb_root_path . 'download.' . $phpEx . $SID . '&amp;id=' . $row['attach_id'],
'U_VIEW_TOPIC' => $view_topic)
);
$row_count++;
}
while ($row = $db->sql_fetchrow($result));
}

View File

@ -57,7 +57,6 @@ class ucp_main extends module
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track'])) : array();
$i = 0;
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
$folder = 'folder_announce';
$folder_new = $folder . '_new';
@ -137,13 +136,10 @@ class ucp_main extends module
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', '') : '',
'S_ROW_COUNT' => $i,
'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false,
'U_VIEW_TOPIC' => $view_topic_url)
);
$i++;
}
$db->sql_freeresult($result);
@ -328,7 +324,6 @@ class ucp_main extends module
ORDER BY left_id';
$result = $db->sql_query($sql);
$i = 0;
while ($row = $db->sql_fetchrow($result))
{
$forum_id = $row['forum_id'];
@ -378,9 +373,7 @@ class ucp_main extends module
'U_LAST_POST_AUTHOR'=> $last_poster_url,
'U_LAST_POST' => $last_post_url,
'U_VIEWFORUM' => "viewforum.$phpEx$SID&amp;f=" . $row['forum_id'],
'S_ROW_COUNT' => $i++)
'U_VIEWFORUM' => "viewforum.$phpEx$SID&amp;f=" . $row['forum_id'])
);
}
$db->sql_freeresult($result);
@ -400,7 +393,6 @@ class ucp_main extends module
ORDER BY t.topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $config['topics_per_page']);
$i = 0;
while ($row = $db->sql_fetchrow($result))
{
$forum_id = $row['forum_id'];
@ -515,7 +507,6 @@ class ucp_main extends module
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', '') : '',
'S_ROW_COUNT' => $i++,
'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false,
'U_VIEW_TOPIC' => $view_topic_url)
@ -620,7 +611,6 @@ class ucp_main extends module
ORDER BY b.order_id ASC';
$result = $db->sql_query($sql);
$i = 0;
while ($row = $db->sql_fetchrow($result))
{
$forum_id = $row['forum_id'];
@ -678,9 +668,7 @@ class ucp_main extends module
'U_VIEW_TOPIC' => $view_topic_url,
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f={$row['forum_id']}",
'U_MOVE_UP' => ($row['order_id'] != 1) ? "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=main&amp;mode=bookmarks&amp;move_up={$row['order_id']}" : '',
'U_MOVE_DOWN' => ($row['order_id'] != $max_order_id) ? "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=main&amp;mode=bookmarks&amp;move_down={$row['order_id']}" : '',
'S_ROW_COUNT' => $i++)
'U_MOVE_DOWN' => ($row['order_id'] != $max_order_id) ? "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=main&amp;mode=bookmarks&amp;move_down={$row['order_id']}" : '')
);
}
@ -839,12 +827,12 @@ class ucp_main extends module
'U_VIEW_EDIT' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode&amp;edit=" . $draft['draft_id'],
'U_INSERT' => $insert_url,
'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
);
$row_count++;
($edit) ? $template->assign_vars($template_row) : $template->assign_block_vars('draftrow', $template_row);
}

View File

@ -118,7 +118,6 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
unset($recipient_list, $address);
}
$i = 0;
$url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id";
foreach ($folder_info['pm_list'] as $message_id)
@ -160,7 +159,6 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
'PM_IMG' => ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '',
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $row['message_attachment'] && $config['pm_attachments'] && $config['auth_download_pm']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['message_attachment'])) : '',
'S_ROW_COUNT' => $i,
'S_PM_REPORTED' => (!empty($row['message_reported']) && $auth->acl_get('m_')) ? true : false,
'U_VIEW_PM' => $view_message_url,

View File

@ -286,7 +286,6 @@ function message_history($msg_id, $user_id, $message_row, $folder)
$title = censor_text($title);
$i = 1;
$url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=pm";
$next_history_pm = $previous_history_pm = $prev_id = 0;
@ -329,13 +328,10 @@ function message_history($msg_id, $user_id, $message_row, $folder)
'U_VIEW_MESSAGE'=> "$url&amp;f=$folder_id&amp;p=" . $row['msg_id'],
'U_AUTHOR_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=$author_id",
'U_QUOTE' => ($config['auth_quote_pm'] && $auth->acl_get('u_sendpm') && $author_id != $user->data['user_id']) ? "$url&amp;mode=compose&amp;action=quote&amp;f=" . $folder_id . "&amp;p=" . $row['msg_id'] : '',
'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $auth->acl_get('u_sendpm')) ? "$url&amp;mode=compose&amp;action=reply&amp;f=$folder_id&amp;p=" . $row['msg_id'] : '',
'S_ROW_COUNT' => $i)
'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $auth->acl_get('u_sendpm')) ? "$url&amp;mode=compose&amp;action=reply&amp;f=$folder_id&amp;p=" . $row['msg_id'] : '')
);
unset($rowset[$id]);
$prev_id = $id;
$i++;
}
$template->assign_vars(array(

View File

@ -403,7 +403,7 @@ if ($stage == 0)
foreach ($locations as $location)
{
if (@file_exists($location . 'convert' . $exe) && @is_readable($location . 'convert' . $exe) && @filesize($location . 'convert' . $exe) > 30000)
if (@file_exists($location . 'convert' . $exe) && @is_readable($location . 'convert' . $exe) && @filesize($location . 'convert' . $exe) > 10000)
{
print $location;
$img_imagick = str_replace('\\', '/', $location);

View File

@ -1786,7 +1786,7 @@ $lang += array(
'MIN_THUMB_FILESIZE' => 'Minimum thumbnail filesize',
'MIN_THUMB_FILESIZE_EXPLAIN' => 'Do not create a thumbnail for images smaller than this.',
'IMAGICK_PATH' => 'Imagemagick path',
'IMAGICK_PATH_EXPLAIN' => 'Full path to the imagemagick convert application, e.g. /usr/bin/convert',
'IMAGICK_PATH_EXPLAIN' => 'Full path to the imagemagick convert application, e.g. /usr/bin/',
'SEARCH_IMAGICK' => 'Search for Imagemagick',
'MAX_IMAGE_SIZE' => 'Maximum Image Dimensions',
'MAX_IMAGE_SIZE_EXPLAIN' => 'Maximum size of image attachments, 0px by 0px disables image attachments.',

View File

@ -263,6 +263,7 @@ $lang += array(
'POSTS' => 'Posts',
'POST_BY_FOE' => 'This post was made by <b>%1$s</b> who is currently on your ignore list. To display this post click %2$sHERE%3$s.',
'POST_DAY' => '%.2f posts per day',
'POST_DETAILS' => 'Post Details',
'POST_PCT' => '%.2f%% of all posts',
'POST_REPORTED' => 'Click to view reports',
'POST_SUBJECT' => 'Post Subject',

View File

@ -73,7 +73,7 @@ $lang += array(
'DELETE_MESSAGE' => 'Delete Message',
'DELETE_MESSAGE_CONFIRM' => 'Are you sure you want to delete this message?',
'DELETE_OWN_POSTS' => 'Sorry but you can only delete your own posts.',
'DELETE_POST' => 'Delete',
'DELETE_POST' => 'Delete Post',
'DELETE_POST_CONFIRM' => 'Are you sure you want to delete this message?',
'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered',
'DISABLE_BBCODE' => 'Disable BBCode',
@ -139,6 +139,8 @@ $lang += array(
'POSTED_ATTACHMENTS' => 'Posted attachments',
'POST_ANNOUNCEMENT' => 'Announce',
'POST_DELETED' => 'Your message has been deleted successfully',
'POST_EDITED' => 'Your message has been edited successfully',
'POST_EDITED_MOD' => 'Your message has been edited but requires approval',
'POST_GLOBAL' => 'Global',
'POST_ICON' => 'Post icon',
'POST_NORMAL' => 'Normal',

View File

@ -336,7 +336,7 @@ switch ($mode)
$active_f_name = $active_f_row['forum_name'];
$active_f_id = $active_f_row['forum_id'];
$active_f_count = $active_f_row['num_posts'];
$active_f_pct = ($active_f_count / $member['user_posts']) * 100;
$active_f_pct = ($member['user_posts']) ? ($active_f_count / $member['user_posts']) * 100 : 0;
}
unset($active_f_row);
@ -346,7 +346,7 @@ switch ($mode)
$active_t_name = $active_t_row['topic_title'];
$active_t_id = $active_t_row['topic_id'];
$active_t_count = $active_t_row['num_posts'];
$active_t_pct = ($active_t_count / $member['user_posts']) * 100;
$active_t_pct = ($member['user_posts']) ? ($active_t_count / $member['user_posts']) * 100 : 0;
}
unset($active_t_row);
@ -807,9 +807,6 @@ switch ($mode)
$template->assign_block_vars('memberrow', array_merge(show_profile($row), array(
'ROW_NUMBER' => $i + ($start + 1),
'S_ROW_COUNT' => $i,
'U_VIEWPROFILE' => "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id']))
);

View File

@ -721,7 +721,7 @@ if ($submit || $preview || $refresh)
$user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['user_id'] != ANONYMOUS && $user->data['user_id'] == $topic_poster) ? 'USER_' : '';
add_log('mod', $forum_id, $topic_id, sprintf($user->lang['LOGM_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK')], '<a href="' . generate_board_url() . "/viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id" . '" class="gen" target="_blank">' . $topic_title . '</a>'));
add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), $topic_title);
}
// Lock/Unlock Post Edit
@ -909,6 +909,8 @@ switch ($mode)
$forum_data = array(
'parent_id' => $parent_id,
'left_id' => $left_id,
'right_id' => $right_id,
'forum_parents' => $forum_parents,
'forum_name' => $forum_name,
'forum_id' => $forum_id,
@ -1341,9 +1343,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
'U_POST_ID' => $row['post_id'],
'U_MINI_POST' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;p=" . $row['post_id'] . '#' . $row['post_id'],
'U_QUOTE' => ($auth->acl_get('f_quote', $forum_id)) ? 'javascript:addquote(' . $row['post_id'] . ", '" . str_replace("'", "\\'", $poster) . "')" : '',
'S_ROW_COUNT' => $i)
'U_QUOTE' => ($auth->acl_get('f_quote', $forum_id)) ? 'javascript:addquote(' . $row['post_id'] . ", '" . str_replace("'", "\\'", $poster) . "')" : '')
);
unset($rowset[$i]);
}
@ -1497,7 +1497,7 @@ function delete_post($mode, $post_id, $topic_id, $forum_id, $data)
// Submit Post
function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_uid, $poll, $attach_data, $filename_data, $data)
{
global $db, $auth, $user, $config, $phpEx, $SID, $template;
global $db, $auth, $user, $config, $phpEx, $SID, $template, $phpbb_root_path;
// We do not handle erasing posts here
if ($mode == 'delete')
@ -2003,10 +2003,12 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
user_notification($mode, stripslashes($subject), stripslashes($data['topic_title']), stripslashes($data['forum_name']), $data['forum_id'], $data['topic_id'], $data['post_id']);
}
meta_refresh(3, "viewtopic.$phpEx$SID&amp;f=" . $data['forum_id'] . '&amp;t=' . $data['topic_id'] . '&amp;p=' . $data['post_id'] . '#' . $data['post_id']);
$url = "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f={$data['forum_id']}&amp;t={$data['topic_id']}&amp;p={$data['post_id']}#{$data['post_id']}";
$message = ($auth->acl_get('f_moderate', $data['forum_id'])) ? 'POST_STORED_MOD' : 'POST_STORED';
$message = $user->lang[$message] . ((!$auth->acl_get('f_moderate', $data['forum_id'])) ? '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="viewtopic.' . $phpEx . $SID .'&amp;f=' . $data['forum_id'] . '&amp;t=' . $data['topic_id'] . '&amp;p=' . $data['post_id'] . '#' . $data['post_id'] . '">', '</a>') : '') . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID .'&amp;f=' . $data['forum_id'] . '">', '</a>');
meta_refresh(3, $url);
$message = ($auth->acl_get('f_moderate', $data['forum_id'])) ? (($mode == 'edit') ? 'POST_EDITED_MOD' : 'POST_STORED_MOD') : (($mode == 'edit') ? 'POST_EDITED' : 'POST_STORED');
$message = $user->lang[$message] . ((!$auth->acl_get('f_moderate', $data['forum_id'])) ? '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $url . '">', '</a>') : '') . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID .'&amp;f=' . $data['forum_id'] . '">', '</a>');
trigger_error($message);
}

View File

@ -50,7 +50,7 @@ if ($post_id)
AND p.topic_id = t.topic_id
AND p.forum_id = f.forum_id";
}
else
else if ($msg_id)
{
// Only the user itself is able to report his Private Messages
$sql = 'SELECT p.*, t.*
@ -59,6 +59,11 @@ else
AND t.user_id = " . $user->data['user_id'] . '
AND t.msg_id = p.msg_id';
}
else
{
trigger_error('INVALID_MODE');
}
$result = $db->sql_query($sql);
if (!($report_data = $db->sql_fetchrow($result)))

View File

@ -914,10 +914,10 @@ while ($row = $db->sql_fetchrow($result))
'KEYWORDS' => $split_words,
'TIME' => $user->format_date($row['search_time']),
'U_KEYWORDS' => "search.$phpEx$SID&amp;search_keywords=" . urlencode($split_words),
'S_ROW_COUNT' => $i++)
'U_KEYWORDS' => "search.$phpEx$SID&amp;search_keywords=" . urlencode($split_words))
);
$i++;
}
$db->sql_freeresult($result);

View File

@ -54,15 +54,15 @@
<td width="100%"><b class="gen">{VISITED}</td>
</tr>
<tr>
<td class="gen" align="right" nowrap="nowrap">{L_TOTAL_POSTS}: </td>
<td class="gen" align="right" valign="top" nowrap="nowrap">{L_TOTAL_POSTS}: </td>
<td><!-- IF POSTS_PCT neq 0 --><b class="gen">{POSTS}</b><br /><span class="genmed">[{POSTS_PCT} / {POSTS_DAY}]<br /><a href="{U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a></span><!-- ELSE --><b class="gen">{POSTS}<b><!-- ENDIF --></td>
</tr>
<tr>
<td class="gen" align="right" nowrap="nowrap">{L_ACTIVE_IN_FORUM}: </td>
<td class="gen" align="right" valign="top" nowrap="nowrap">{L_ACTIVE_IN_FORUM}: </td>
<td><!-- IF ACTIVE_FORUM_PCT neq 0 --><b><a class="gen" href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></b><br /><span class="genmed">[ {ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT} ]</span><!-- ELSE --><span class="gen">-</span><!-- ENDIF --></td>
</tr>
<tr>
<td class="gen" align="right" nowrap="nowrap">{L_ACTIVE_IN_TOPIC}: </td>
<td class="gen" align="right" valign="top" nowrap="nowrap">{L_ACTIVE_IN_TOPIC}: </td>
<td><!-- IF ACTIVE_TOPIC_PCT neq 0 --><b><a class="gen" href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></b><br /><span class="gensmall">[ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]</span><!-- ELSE --><span class="gen">-</span><!-- ENDIF --></td>
</tr>
</table></td>

View File

@ -168,7 +168,7 @@ function checkForm()
<td class="row1"><b class="genmed">{L_ICON}:</b></td>
<td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><input type="radio" name="icon" value="0" /><span class="genmed">{L_NONE}</span> <!-- BEGIN topic_icon --><input type="radio" name="icon" value="{topic_icon.ICON_ID}"{topic_icon.S_ICON_CHECKED} /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /> <!-- END topic_icon --></td>
<td><input type="radio" name="icon" value="0"{S_NO_ICON_CHECKED} /><span class="genmed">{L_NONE}</span> <!-- BEGIN topic_icon --><input type="radio" name="icon" value="{topic_icon.ICON_ID}"{topic_icon.S_ICON_CHECKED} /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /> <!-- END topic_icon --></td>
</tr>
</table></td>
</tr>

View File

@ -53,13 +53,8 @@
<td class="row2" width="50" align="center"><p class="topicdetails">{topicrow.VIEWS}</p></td>
<td class="row1" width="120" align="center">
<p class="topicdetails">{topicrow.LAST_POST_TIME}</p>
<p class="topicdetails">
<!-- IF topicrow.U_LAST_POST_AUTHOR -->
<a href="{topicrow.U_LAST_POST_AUTHOR}">{topicrow.LAST_POST_AUTHOR}</a>
<!-- ELSE -->
{topicrow.LAST_POST_AUTHOR}
<!-- ENDIF -->
<a href="{topicrow.U_LAST_POST}">{topicrow.LAST_POST_IMG}</a>
<p class="topicdetails"><!-- IF topicrow.U_LAST_POST_AUTHOR --><a href="{topicrow.U_LAST_POST_AUTHOR}">{topicrow.LAST_POST_AUTHOR}</a><!-- ELSE -->{topicrow.LAST_POST_AUTHOR}<!-- ENDIF -->
<a href="{topicrow.U_LAST_POST}">{topicrow.LAST_POST_IMG}</a>
</p>
</td>
</tr>
@ -173,13 +168,8 @@
<td class="row2" width="50" align="center"><p class="topicdetails">{topicrow.VIEWS}</p></td>
<td class="row1" width="120" align="center">
<p class="topicdetails">{topicrow.LAST_POST_TIME}</p>
<p class="topicdetails">
<!-- IF topicrow.U_LAST_POSTER -->
<a href="{topicrow.U_LAST_POST_AUTHOR}">{topicrow.LAST_POST_AUTHOR}</a>
<!-- ELSE -->
{topicrow.LAST_POST_AUTHOR}
<!-- ENDIF -->
<a href="{topicrow.U_LAST_POST}">{topicrow.LAST_POST_IMG}</a>
<p class="topicdetails"><!-- IF topicrow.U_LAST_POST_AUTHOR --><a href="{topicrow.U_LAST_POST_AUTHOR}">{topicrow.LAST_POST_AUTHOR}</a><!-- ELSE -->{topicrow.LAST_POST_AUTHOR}<!-- ENDIF -->
<a href="{topicrow.U_LAST_POST}">{topicrow.LAST_POST_IMG}</a>
</p>
</td>
</tr>
@ -197,11 +187,11 @@
<tr align="center">
<!-- IF S_TOPIC_ICONS -->
<td class="cat" colspan="8"><form method="post" action="{S_TOPIC_ACTION}">
<td class="cat" colspan="8">
<!-- ELSE -->
<td class="cat" colspan="7" >
<!-- ENDIF -->
<span class="gensmall">{L_DISPLAY_TOPICS}:</span>&nbsp;{S_SELECT_SORT_DAYS}&nbsp;<span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}&nbsp;<input class="btnlite" type="submit" name="sort" value="{L_GO}" /></form></td>
<form method="post" action="{S_TOPIC_ACTION}"><span class="gensmall">{L_DISPLAY_TOPICS}:</span>&nbsp;{S_SELECT_SORT_DAYS}&nbsp;<span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}&nbsp;<input class="btnlite" type="submit" name="sort" value="{L_GO}" /></form></td>
</tr>
</table>

View File

@ -393,7 +393,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
$mark_forum_read = true;
$i = $s_type_switch = 0;
$s_type_switch = 0;
foreach ($topic_list as $topic_id)
{
$row =& $rowset[$topic_id];
@ -531,14 +531,10 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
// Generate all the URIs ...
$view_topic_url = "viewtopic.$phpEx$SID&amp;f=" . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&amp;t=$topic_id";
$last_post_img = "<a href=\"$view_topic_url&amp;p=" . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '</a>';
$topic_author = ($row['topic_poster'] != ANONYMOUS) ? "<a href=\"memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['topic_poster'] . '">' : '';
$topic_author .= ($row['topic_poster'] != ANONYMOUS) ? $row['topic_first_poster_name'] : (($row['topic_first_poster_name'] != '') ? $row['topic_first_poster_name'] : $user->lang['GUEST']);
$topic_author .= ($row['topic_poster'] != ANONYMOUS) ? '</a>' : '';
$last_post_author = ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : "<a href=\"memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['topic_last_poster_id'] . '">' . $row['topic_last_poster_name'] . '</a>';
// This will allow the style designer to output a different header
// or even seperate the list of announcements from sticky and normal
// topics
@ -552,20 +548,19 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
'FIRST_POST_TIME' => $user->format_date($row['topic_time'], $config['board_timezone']),
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']),
'LAST_POST_AUTHOR' => $last_post_author,
'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'],
'GOTO_PAGE' => $goto_page,
'REPLIES' => ($auth->acl_get('m_approve')) ? $row['topic_replies_real'] : $row['topic_replies'],
'VIEWS' => $row['topic_views'],
'TOPIC_TITLE' => censor_text($row['topic_title']),
'TOPIC_TYPE' => $topic_type,
'LAST_POST_IMG' => $last_post_img,
'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
'NEWEST_POST_IMG' => $newest_post_img,
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['topic_attachment'])) : '',
'S_ROW_COUNT' => $i,
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test,
'S_TOPIC_TYPE' => $row['topic_type'],
'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false,
@ -573,14 +568,14 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_', $forum_id)) ? TRUE : FALSE,
'S_TOPIC_UNAPPROVED' => (!$row['topic_approved'] && $auth->acl_gets('m_approve', $forum_id)) ? TRUE : FALSE,
'U_LAST_POSTER' => '',
'U_LAST_POST' => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'],
'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u={$row['topic_last_poster_id']}" : '',
'U_VIEW_TOPIC' => $view_topic_url,
'U_MCP_REPORT' => "mcp.$phpEx?sid={$user->session_id}&amp;mode=reports&amp;t=$topic_id",
'U_MCP_QUEUE' => "mcp.$phpEx?sid={$user->session_id}&amp;mode=mod_queue&amp;t=$topic_id")
);
$s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
$i++;
if ($config['load_db_lastread'])
{

View File

@ -224,8 +224,6 @@ while ($row = $db->sql_fetchrow($result))
'FORUM_LOCATION'=> $location,
'USER_IP' => ($auth->acl_get('a_')) ? (($mode == 'lookup' && $session_id == $row['session_id']) ? gethostbyaddr($row['session_ip']) : $row['session_ip']) : '',
'S_ROW_COUNT' => $$which_counter,
'U_USER_PROFILE' => ($row['user_type'] <> USER_IGNORE) ? "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] : '',
'U_USER_IP' => "viewonline.$phpEx$SID" . (($mode != 'lookup' || $row['session_id'] != $session_id) ? '&amp;mode=lookup&amp;s=' . $row['session_id'] : ''),
'U_WHOIS' => "viewonline.$phpEx$SID&amp;mode=whois&amp;s=" . $row['session_id'],

View File

@ -478,7 +478,7 @@ $template->assign_vars(array(
'S_SELECT_SORT_DAYS' => $s_limit_days,
'S_TOPIC_ACTION' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;start=$start",
'S_TOPIC_MOD' => ($topic_mod != '') ? '<select name="mode">' . $topic_mod . '</select>' : '',
'S_MOD_ACTION' => "mcp.$phpEx?sid=" . $user->session_id . "&amp;t=$topic_id&amp;quickmod=1",
'S_MOD_ACTION' => "mcp.$phpEx?sid=" . $user->session_id . "&amp;t=$topic_id&amp;f=$forum_id&amp;quickmod=1",
'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('f_search', $forum_id)) ? true : false,
'S_SEARCHBOX_ACTION' => "search.$phpEx$SID&amp;f=$forum_id",
@ -809,6 +809,7 @@ while ($row = $db->sql_fetchrow($result))
'sig_bbcode_uid' => '',
'sig_bbcode_bitfield' => '',
'online' => false,
'avatar' => '',
'rank_title' => '',
'rank_image' => '',
@ -852,6 +853,7 @@ while ($row = $db->sql_fetchrow($result))
'avatar' => '',
'online' => false,
'profile' => "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=$poster_id",
'www' => $row['user_website'],
'aim' => ($row['user_aim']) ? "memberlist.$phpEx$SID&amp;mode=contact&amp;action=aim&amp;u=$poster_id" : '',
@ -881,12 +883,12 @@ while ($row = $db->sql_fetchrow($result))
if (!empty($row['user_rank']))
{
$user_cache[$poster_id]['rank_title'] = $ranks['special'][$row['user_rank']]['rank_title'];
$user_cache[$poster_id]['rank_title'] = (isset($ranks['special'][$row['user_rank']])) ? $ranks['special'][$row['user_rank']]['rank_title'] : '';
$user_cache[$poster_id]['rank_image'] = (!empty($ranks['special'][$row['user_rank']]['rank_image'])) ? '<img src="' . $config['ranks_path'] . '/' . $ranks['special'][$row['user_rank']]['rank_image'] . '" border="0" alt="' . $ranks['special'][$row['user_rank']]['rank_title'] . '" title="' . $ranks['special'][$row['user_rank']]['rank_title'] . '" /><br />' : '';
}
else
{
if (sizeof($ranks['normal']))
if (isset($ranks['normal']) && sizeof($ranks['normal']))
{
foreach ($ranks['normal'] as $rank)
{
@ -957,7 +959,7 @@ if ($config['load_onlinetrack'] && sizeof($id_cache))
unset($id_cache);
// Pull attachment data
if (count($attach_list))
if (sizeof($attach_list))
{
if ($auth->acl_gets('f_download', 'u_download', $forum_id))
{
@ -977,7 +979,7 @@ if (count($attach_list))
$db->sql_freeresult($result);
// No attachments exist, but post table thinks they do so go ahead and reset post_attach flags
if (!count($attachments))
if (!sizeof($attachments))
{
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_attachment = 0
@ -985,7 +987,7 @@ if (count($attach_list))
$db->sql_query($sql);
// We need to update the topic indicator too if the complete topic is now without an attachment
if (count($rowset) != $total_posts)
if (sizeof($rowset) != $total_posts)
{
// Not all posts are displayed so we query the db to find if there's any attachment for this topic
$sql = 'SELECT a.post_msg_id as post_id
@ -1039,12 +1041,12 @@ $i_total = sizeof($rowset) - 1;
$prev_post_id = '';
$template->assign_vars(array(
'S_NUM_POSTS' => count($post_list))
'S_NUM_POSTS' => sizeof($post_list))
);
// Output the posts
//foreach ($rowset as $i => $row)
for ($i = 0; $i < count($post_list); ++$i)
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
{
$row =& $rowset[$post_list[$i]];
$poster_id = $row['user_id'];
@ -1057,8 +1059,6 @@ for ($i = 0; $i < count($post_list); ++$i)
{
$template->assign_block_vars('postrow', array(
'S_IGNORE_POST' => true,
'S_ROW_COUNT' => $i,
'L_IGNORE_POST' => sprintf($user->lang['POST_BY_FOE'], $row['poster'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;p=" . $row['post_id'] . '&amp;view=show#' . $row['post_id'] . '">', '</a>'))
);
@ -1074,8 +1074,6 @@ for ($i = 0; $i < count($post_list); ++$i)
{
$template->assign_block_vars('postrow', array(
'S_IGNORE_POST' => true,
'S_ROW_COUNT' => $i,
'L_IGNORE_POST' => sprintf($user->lang['POST_ENCODING'], $row['poster'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;p=' . $row['post_id'] . '&amp;view=encoding#' . $row['post_id'] . '">', '</a>'))
);
@ -1177,7 +1175,6 @@ for ($i = 0; $i < count($post_list); ++$i)
$l_bumped_by = '';
}
// Assign inline attachments, only one preg_replace... yeah baby, you got it. :D
if (isset($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]))
{
$tpl = &$attachments[$row['post_id']];
@ -1186,23 +1183,29 @@ for ($i = 0; $i < count($post_list); ++$i)
$unset_tpl = array();
$message = preg_replace_callback('#<!\-\- ia([0-9]+) \-\->(.*?)<!\-\- ia\1 \-\->#', create_function('$matches', '
global $tpl, $user, $config, $tpl_size, $unset_tpl;
preg_match_all('#<!\-\- ia([0-9]+) \-\->(.*?)<!\-\- ia\1 \-\->#', $message, $matches);
$replace = array();
foreach ($matches[0] as $num => $capture)
{
// Flip index if we are displaying the reverse way
$index = ($config["display_order"]) ? ($tpl_size-($matches[1] + 1)) : $matches[1];
$return = (isset($tpl[$index])) ? $tpl[$index] : sprintf($user->lang["MISSING_INLINE_ATTACHMENT"], $matches[0]);
$index = ($config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num];
$replace['from'][] = $matches[0][$index];
$replace['to'][] = (isset($tpl[$index])) ? $tpl[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][$num]);
$unset_tpl[] = $index;
return $return;
'), $message);
}
unset($tpl, $tpl_size);
foreach (array_unique($unset_tpl) as $index)
if (isset($replace['from']))
{
unset($attachments[$row['post_id']][$index]);
$message = str_replace($replace['from'], $replace['to'], $message);
foreach (array_unique($unset_tpl) as $index)
{
unset($attachments[$row['post_id']][$index]);
}
}
}
@ -1237,7 +1240,7 @@ for ($i = 0; $i < count($post_list); ++$i)
'U_EDIT' => (($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - $config['edit_time'] || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? "posting.$phpEx$SID&amp;mode=edit&amp;f=$forum_id&amp;p=" . $row['post_id'] : '',
'U_QUOTE' => ($auth->acl_get('f_quote', $forum_id)) ? "posting.$phpEx$SID&amp;mode=quote&amp;f=$forum_id&amp;p=" . $row['post_id'] : '',
'U_IP' => ($auth->acl_get('m_ip', $forum_id)) ? "mcp.$phpEx?sid=" . $user->session_id . "&amp;mode=post_details&amp;p=" . $row['post_id'] . "&amp;t=$topic_id#ip" : '',
'U_IP' => ($auth->acl_get('m_ip', $forum_id)) ? "mcp.$phpEx?sid=" . $user->session_id . "&amp;mode=post_details&amp;p=" . $row['post_id'] . "#ip" : '',
'U_DELETE' => (($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - $config['edit_time'] || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? "posting.$phpEx$SID&amp;mode=delete&amp;f=$forum_id&amp;p=" . $row['post_id'] : '',
'U_PROFILE' => $user_cache[$poster_id]['profile'],
@ -1263,7 +1266,6 @@ for ($i = 0; $i < count($post_list); ++$i)
'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$i + 1])) ? $rowset[$i + 1]['post_id'] : '',
'U_PREV_POST_ID' => $prev_post_id,
'S_ROW_COUNT' => $i,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? TRUE : FALSE,
'S_POST_UNAPPROVED' => ($row['post_approved']) ? FALSE : TRUE,
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_', $forum_id)) ? TRUE : FALSE,
@ -1284,7 +1286,7 @@ for ($i = 0; $i < count($post_list); ++$i)
foreach ($attachments[$row['post_id']] as $attachment)
{
$template->assign_block_vars('postrow.attachment', array(
'DISPLAY_ATTACHMENT' => $attachment)
'DISPLAY_ATTACHMENT' => $attachment)
);
}
}