From 2fa463cdeb5d8e4f2373aa834154ca27ea21c97a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 16 Sep 2004 18:33:22 +0000 Subject: - more updates, mostly bugfixes to the bbcode parser - changed current_user in sessions (please review) - give more flexibility to style authors in regard to the pagination elements - profile fields updates (included a sample constuct into viewtopic_body.html - have to be documented extensivly) - code optimizations (use of strpos, sizeof, loops not iterating functions on every call, memory savings...) - and last but not least --- hopefully not introduced more bugs than healthy (*cough*) git-svn-id: file:///svn/phpbb/trunk@4984 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_posting.php | 38 ++++++++---------------------------- 1 file changed, 8 insertions(+), 30 deletions(-) (limited to 'phpBB/includes/functions_posting.php') diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index c44d539716..5946183b21 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -149,9 +149,9 @@ 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'] = (strpos($filedata['mimetype'], '; name') !== false) ? 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); + $filedata['filesize'] = (!@filesize($file)) ? (int) $_FILES['size'] : @filesize($file); $extensions = array(); obtain_attach_extensions($extensions); @@ -187,7 +187,7 @@ function upload_attachment($forum_id, $filename, $local = false, $local_storage } // Check Image Size, if it is an image - if (!$auth->acl_gets('m_', 'a_') && $cat_id == IMAGE_CAT) + if (!$auth->acl_gets('m_', 'a_') && $cat_id == ATTACHMENT_CATEGORY_IMAGE) { list($width, $height) = getimagesize($file); @@ -248,7 +248,7 @@ function upload_attachment($forum_id, $filename, $local = false, $local_storage $filedata['filename'] = str_replace("'", "\'", $filedata['filename']); // Do we have to create a thumbnail ? - if ($cat_id == IMAGE_CAT && $config['img_create_thumbnail']) + if ($cat_id == ATTACHMENT_CATEGORY_IMAGE && $config['img_create_thumbnail']) { $filedata['thumbnail'] = 1; } @@ -491,44 +491,22 @@ function decode_message(&$message, $bbcode_uid = '') { global $config; - $server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://'; - $server_port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/'; - $match = array('
', "[/*:m:$bbcode_uid]", ":u:$bbcode_uid", ":o:$bbcode_uid", ":$bbcode_uid"); $replace = array("\n", '', '', '', ''); $message = ($bbcode_uid) ? str_replace($match, $replace, $message) : str_replace('
', "\n", $message); - // HTML - if ($config['allow_html_tags']) - { - // If $html is true then "allowed_tags" are converted back from entity - // form, others remain - $allowed_tags = split(',', $config['allow_html_tags']); - - if (sizeof($allowed_tags)) - { - $message = preg_replace('#\<(\/?)(' . str_replace('*', '.*?', implode('|', $allowed_tags)) . ')\>#is', '<$1$2>', $message); - } - } - $match = array( '#.*?#', '#.*?#', '#.*?#', '#.*?#', '#