From 8675e30366dbe0e9baf35a3398019da500198549 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 24 Sep 2003 19:41:14 +0000 Subject: some small fixes got rid of iframe (topic review)... tested new div method with various browsers, further testing and oppinions would be nice. ;) NOTE: New css element added to theme git-svn-id: file:///svn/phpbb/trunk@4510 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_attachments.php | 20 ++++----- phpBB/includes/functions_posting.php | 2 +- phpBB/includes/message_parser.php | 44 +++++++++++-------- phpBB/posting.php | 51 +++++----------------- .../subSilver/template/posting_topic_review.html | 19 ++------ phpBB/styles/subSilver/theme/stylesheet.css | 6 ++- phpBB/viewonline.php | 1 - 7 files changed, 57 insertions(+), 86 deletions(-) (limited to 'phpBB') diff --git a/phpBB/adm/admin_attachments.php b/phpBB/adm/admin_attachments.php index 7f4ca15563..6513ca2984 100644 --- a/phpBB/adm/admin_attachments.php +++ b/phpBB/adm/admin_attachments.php @@ -348,11 +348,11 @@ if ($submit && $mode == 'ext_groups') // Add Extensions Group ? $extension_group = (isset($_POST['add_extension_group'])) ? trim(strip_tags($_POST['add_extension_group'])) : ''; $download_mode = (isset($_POST['add_download_mode'])) ? $_POST['add_download_mode'] : ''; - $cat_id = (isset($_POST['add_category'])) ? $_POST['add_category'] : ''; - $upload_icon = (isset($_POST['add_upload_icon'])) ? $_POST['add_upload_icon'] : ''; + $cat_id = (isset($_POST['add_category'])) ? (int) $_POST['add_category'] : 0; + $upload_icon = (isset($_POST['add_upload_icon'])) ? htmlspecialchars($_POST['add_upload_icon']) : ''; $filesize = (isset($_POST['add_max_filesize'])) ? $_POST['add_max_filesize'] : ''; - $size_select = (isset($_POST['add_size_select'])) ? $_POST['add_size_select'] : ''; - $is_allowed = (isset($_POST['add_allowed'])) ? 1 : 0; + $size_select = (isset($_POST['add_size_select'])) ? htmlspecialchars($_POST['add_size_select']) : ''; + $is_allowed = (isset($_POST['add_allowed'])) ? TRUE : FALSE; $add = (isset($_POST['add_extension_group_check'])) ? TRUE : FALSE; if ($extension_group != '' && $add) @@ -953,7 +953,7 @@ function size_select($select_name, $size_compare) } // Build Select for category items -function category_select($select_name, $group_id = -1) +function category_select($select_name, $group_id = FALSE) { global $db, $user; @@ -964,7 +964,7 @@ function category_select($select_name, $group_id = -1) RM_CAT => $user->lang['CAT_RM_FILES'] ); - if ($group_id != -1) + if ($group_id) { $sql = 'SELECT cat_id FROM ' . EXTENSION_GROUPS_TABLE . ' @@ -994,7 +994,7 @@ function category_select($select_name, $group_id = -1) } // Extension group select -function group_select($select_name, $default_group = -1) +function group_select($select_name, $default_group = '-1') { global $db, $user; @@ -1018,7 +1018,7 @@ function group_select($select_name, $default_group = -1) for ($i = 0; $i < count($group_name); $i++) { - if ($default_group == -1) + if ($default_group == '-1') { $selected = ($i == 0) ? ' selected="selected"' : ''; } @@ -1036,7 +1036,7 @@ function group_select($select_name, $default_group = -1) } // Build select for download modes -function download_select($select_name, $group_id = -1) +function download_select($select_name, $group_id = FALSE) { global $db, $user; @@ -1045,7 +1045,7 @@ function download_select($select_name, $group_id = -1) PHYSICAL_LINK => $user->lang['MODE_PHYSICAL'] ); - if ($group_id != -1) + if ($group_id) { $sql = "SELECT download_mode FROM " . EXTENSION_GROUPS_TABLE . " diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 065d3021f1..0358672e5c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -66,7 +66,7 @@ function generate_smilies($mode) { $template->assign_vars(array( 'S_SHOW_EMOTICON_LINK' => TRUE, - 'U_MORE_SMILIES' => "posting.$phpEx$SID&mode=smilies") + 'U_MORE_SMILIES' => $phpbb_root_path . "posting.$phpEx$SID&mode=smilies") ); } } diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 6c4113e5b2..dad0f5d723 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -639,14 +639,16 @@ class parse_message FROM ' . SMILIES_TABLE; $result = $db->sql_query($sql); + // TEMP - maybe easier regular expression processing... at the moment two newlines prevents smilie substitution. + $this->message = str_replace("\n", "\\n", $this->message); + if ($row = $db->sql_fetchrow($result)) { $match = $replace = array(); do { -// $match[] = '#(' . preg_quote($row['code'], '#') . ')#'; - $match[] = "#(?<=.\W|\W.|^\W)" . preg_quote($row['code'], '#') . "(?=.\W|\W.|\W$)#"; + $match[] = "#(?<=.\W|\W.|\W)" . preg_quote($row['code'], '#') . "(?=.\W|\W.|\W$)#"; $replace[] = '' . $row['emoticon'] . ''; } while ($row = $db->sql_fetchrow($result)); @@ -657,12 +659,14 @@ class parse_message if ($num_matches !== FALSE && $num_matches > intval($config['max_post_smilies'])) { + $this->message = str_replace("\\n", "\n", $this->message); $this->warn_msg[] = $user->lang['TOO_MANY_SMILIES']; return; } } $this->message = trim(preg_replace($match, $replace, ' ' . $this->message . ' ')); + $this->message = str_replace("\\n", "\n", $this->message); } } @@ -727,27 +731,33 @@ class parse_message // Perform actions on temporary attachments if ($delete_file) { - foreach ($_POST['delete_file'] as $index => $value) + $index = (int) key($_POST['delete_file']); + + // delete selected attachment + if ($this->attachment_data[$index]['attach_id'] == '-1') { - // delete selected attachment - if ($this->attachment_data[$index]['attach_id'] == '-1') - { - phpbb_unlink($this->attachment_data[$index]['physical_filename'], 'file'); + phpbb_unlink($this->attachment_data[$index]['physical_filename'], 'file'); - if ($this->attachment_data[$index]['thumbnail']) - { - phpbb_unlink('t_' . $this->attachment_data[$index]['physical_filename'], 'thumbnail'); - } - } - else + if ($this->attachment_data[$index]['thumbnail']) { - delete_attachments($post_id, intval($this->attachment_data[$index]['attach_id'])); + phpbb_unlink('t_' . $this->attachment_data[$index]['physical_filename'], 'thumbnail'); } - unset($this->attachment_data[$index]); + } + else + { + delete_attachments($post_id, intval($this->attachment_data[$index]['attach_id'])); } - // a quick way to reindex the array. :) - $this->attachment_data = array_merge($this->attachment_data); + unset($this->attachment_data[$index]); + + // Reindex Array + $attachment_data = $this->attachment_data; + unset($this->attachment_data); + foreach ($attachment_data as $element) + { + $this->attachment_data[] = $element; + } + unset($attachment_data); } else if ($edit_comment || $add_file || $preview) { diff --git a/phpBB/posting.php b/phpBB/posting.php index f5c32ea32f..5eeae10773 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -56,7 +56,7 @@ if ($cancel || time() - $lastclick < 2) redirect($redirect); } -if (in_array($mode, array('post', 'reply', 'quote', 'edit', 'delete', 'topicreview')) && !$forum_id) +if (in_array($mode, array('post', 'reply', 'quote', 'edit', 'delete')) && !$forum_id) { trigger_error($user->lang['NO_FORUM']); } @@ -101,15 +101,6 @@ switch ($mode) OR f.forum_id = $forum_id)"; break; - case 'topicreview': - if (!$topic_id) - { - trigger_error($user->lang['NO_TOPIC']); - } - - topic_review($topic_id, $forum_id, FALSE); - break; - case 'smilies': generate_smilies('window'); break; @@ -370,8 +361,10 @@ if ($mode == 'delete') $html_status = ($config['allow_html'] && $auth->acl_get('f_html', $forum_id)) ? TRUE : FALSE; $bbcode_status = ($config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? TRUE : FALSE; $smilies_status = ($config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? TRUE : FALSE; -$img_status = ($config['allow_img'] && $auth->acl_get('f_img', $forum_id)) ? TRUE : FALSE; -$flash_status = ($config['allow_flash'] && $auth->acl_get('f_flash', $forum_id)) ? TRUE : FALSE; +//$img_status = ($config['allow_img'] && $auth->acl_get('f_img', $forum_id)) ? TRUE : FALSE; +$img_status = ($auth->acl_get('f_img', $forum_id)) ? TRUE : FALSE; +//$flash_status = ($config['allow_flash'] && $auth->acl_get('f_flash', $forum_id)) ? TRUE : FALSE; +$flash_status = ($auth->acl_get('f_flash', $forum_id)) ? TRUE : FALSE; // Save Draft @@ -981,7 +974,6 @@ $template->assign_vars(array( 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=" . $forum_id, 'U_VIEWTOPIC' => ($mode != 'post') ? "viewtopic.$phpEx$SID&$forum_id&t=$topic_id" : '', - 'U_REVIEW_TOPIC' => ($mode != 'post') ? "posting.$phpEx$SID&mode=topicreview&f=$forum_id&t=$topic_id" : '', 'S_DISPLAY_PREVIEW' => ($preview && !sizeof($error)), 'S_EDIT_POST' => ($mode == 'edit'), @@ -1096,7 +1088,7 @@ make_jumpbox('viewforum.'.$phpEx); // Topic review if ($mode == 'reply' || $mode == 'quote') { - topic_review($topic_id, $forum_id, TRUE); + topic_review($topic_id, $forum_id); } page_footer(); @@ -1367,22 +1359,10 @@ function user_notification($mode, $subject, $forum_id, $topic_id, $post_id) } } - // Topic Review -function topic_review($topic_id, $forum_id, $is_inline_review = FALSE) +function topic_review($topic_id, $forum_id) { - global $template; - - if ($is_inline_review) - { - $template->assign_vars(array( - 'S_DISPLAY_INLINE' => TRUE) - ); - - return; - } - - global $user, $auth, $db, $template, $bbcode; + global $user, $auth, $db, $template, $bbcode, $template; global $censors, $config, $phpbb_root_path, $phpEx, $SID; // Define censored word matches @@ -1491,19 +1471,10 @@ function topic_review($topic_id, $forum_id, $is_inline_review = FALSE) unset($rowset[$i]); } - // $template->assign_var('QUOTE_IMG', $user->img('btn_quote', $user->lang['QUOTE_POST'])); - - // - page_header($page_title); - - $template->set_filenames(array( - 'body' => 'posting_topic_review.html') - ); - - page_footer(); } + // Temp Function - strtolower - borrowed from php.net function phpbb_strtolower($string) { @@ -2042,7 +2013,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_ $db->sql_query($sql); } } -/* + if (count($attach_data)) { $sql = 'UPDATE ' . POSTS_TABLE . ' @@ -2055,7 +2026,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_ WHERE topic_id = ' . $data['topic_id']; $db->sql_query($sql); } -*/ + } $db->sql_transaction('commit'); diff --git a/phpBB/styles/subSilver/template/posting_topic_review.html b/phpBB/styles/subSilver/template/posting_topic_review.html index d4664a1cff..f3efe31c1e 100644 --- a/phpBB/styles/subSilver/template/posting_topic_review.html +++ b/phpBB/styles/subSilver/template/posting_topic_review.html @@ -1,17 +1,11 @@ - - - + +
{L_TOPIC_REVIEW}
- - - - diff --git a/phpBB/styles/subSilver/theme/stylesheet.css b/phpBB/styles/subSilver/theme/stylesheet.css index 90a72a8909..764d7198df 100644 --- a/phpBB/styles/subSilver/theme/stylesheet.css +++ b/phpBB/styles/subSilver/theme/stylesheet.css @@ -34,7 +34,6 @@ h3 { font-size: 120%; font-weight: bold; font-family: Verdana, serif; line-heigh .mainmenu { color: black; font-size: 70%; } .titles { color: black; font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 130%; text-decoration: none; } - /* TABLE */ @@ -86,3 +85,8 @@ select { color: black; background-color: white; font-family: Verdana, serif; fon .syntaxhtml { color: #000000; } .syntaxkeyword { color: #007700; } .syntaxstring { color: #DD0000; } + +/* + DIV +*/ +div.postreview { overflow: auto; width: 100%; height: 300px; border: 1px; } diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 0329ab3153..64c4c9fe8d 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -127,7 +127,6 @@ while ($row = $db->sql_fetchrow($result)) switch ($on_page[1]) { case 'reply': - case 'topicreview': $location = sprintf($user->lang['REPLYING_MESSAGE'], $forum_data[$forum_id]); break; default: -- cgit v1.2.1