From dce994f6134799ced067f53fd49a0e1ec4d5ee05 Mon Sep 17 00:00:00 2001 From: Dark Nightmare Date: Sun, 10 Aug 2014 19:46:09 +0600 Subject: [PATCH] Using constant links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Использование заранее определенных констант для ссылок Исправление некорректного редиректа viewtopic.php --- upload/admin/admin_attach_cp.php | 2 +- upload/attach_mod/displaying.php | 12 ++++++------ upload/attach_mod/displaying_torrent.php | 2 +- upload/attach_mod/posting_attachments.php | 2 +- upload/groupcp.php | 2 +- upload/posting.php | 2 +- upload/viewforum.php | 5 ++--- upload/viewtopic.php | 20 ++++++++++---------- 8 files changed, 23 insertions(+), 24 deletions(-) diff --git a/upload/admin/admin_attach_cp.php b/upload/admin/admin_attach_cp.php index 06a253f7c..274b673bb 100644 --- a/upload/admin/admin_attach_cp.php +++ b/upload/admin/admin_attach_cp.php @@ -524,7 +524,7 @@ if ($view == 'attachments') 'S_DELETE_BOX' => $delete_box, 'S_HIDDEN' => $hidden_field, - 'U_VIEW_ATTACHMENT' => BB_ROOT . 'dl.php?id=' . $attachments[$i]['attach_id'], + 'U_VIEW_ATTACHMENT' => BB_ROOT . DOWNLOAD_URL . $attachments[$i]['attach_id'], )); } diff --git a/upload/attach_mod/displaying.php b/upload/attach_mod/displaying.php index dd0a72038..dda71b925 100644 --- a/upload/attach_mod/displaying.php +++ b/upload/attach_mod/displaying.php @@ -273,12 +273,12 @@ function display_attachments($post_id) // Images // NOTE: If you want to use the dl.php everytime an image is displayed inlined, replace the // Section between BEGIN and END with (Without the // of course): - // $img_source = BB_ROOT . 'dl.php?id=' . $attachments['_' . $post_id][$i]['attach_id']; + // $img_source = BB_ROOT . DOWNLOAD_URL . $attachments['_' . $post_id][$i]['attach_id']; // $download_link = TRUE; // Check if we can reach the file or if it is stored outside of the webroot if ($attach_config['upload_dir'][0] == '/' || ( $attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':')) { - $img_source = BB_ROOT . 'dl.php?id=' . $attachments['_' . $post_id][$i]['attach_id']; + $img_source = BB_ROOT . DOWNLOAD_URL . $attachments['_' . $post_id][$i]['attach_id']; $download_link = TRUE; } else @@ -317,11 +317,11 @@ function display_attachments($post_id) // Images, but display Thumbnail // NOTE: If you want to use the dl.php everytime an thumnmail is displayed inlined, replace the // Section between BEGIN and END with (Without the // of course): - // $thumb_source = BB_ROOT . 'dl.php?id=' . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1'; + // $thumb_source = BB_ROOT . DOWNLOAD_URL . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1'; // Check if we can reach the file or if it is stored outside of the webroot if ($attach_config['upload_dir'][0] == '/' || ( $attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':')) { - $thumb_source = BB_ROOT . 'dl.php?id=' . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1'; + $thumb_source = BB_ROOT . DOWNLOAD_URL . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1'; } else { @@ -334,7 +334,7 @@ function display_attachments($post_id) 'DOWNLOAD_NAME' => $display_name, 'S_UPLOAD_IMAGE' => $upload_image, - 'IMG_SRC' => BB_ROOT . 'dl.php?id=' . $attachments['_' . $post_id][$i]['attach_id'], + 'IMG_SRC' => BB_ROOT . DOWNLOAD_URL . $attachments['_' . $post_id][$i]['attach_id'], 'IMG_THUMB_SRC' => $thumb_source, 'FILESIZE' => $filesize, 'COMMENT' => $comment, @@ -352,7 +352,7 @@ function display_attachments($post_id) // display attachment $template->assign_block_vars('postrow.attach.attachrow', array( - 'U_DOWNLOAD_LINK' => BB_ROOT . 'dl.php?id=' . $attachments['_' . $post_id][$i]['attach_id'], + 'U_DOWNLOAD_LINK' => BB_ROOT . DOWNLOAD_URL . $attachments['_' . $post_id][$i]['attach_id'], 'S_UPLOAD_IMAGE' => $upload_image, 'DOWNLOAD_NAME' => $display_name, diff --git a/upload/attach_mod/displaying_torrent.php b/upload/attach_mod/displaying_torrent.php index d9dfbd90b..6ee7e12f6 100644 --- a/upload/attach_mod/displaying_torrent.php +++ b/upload/attach_mod/displaying_torrent.php @@ -75,7 +75,7 @@ $tor_auth_del = ($tor_auth && $tor_reged); $tracker_link = ($tor_reged) ? $lang['BT_REG_YES'] : $lang['BT_REG_NO']; -$download_link = "dl.php?id=$attach_id"; +$download_link = DOWNLOAD_URL . $attach_id; $description = ($comment) ? $comment : preg_replace("#.torrent$#i", '', $display_name); if ($tor_auth_reg || $tor_auth_del) diff --git a/upload/attach_mod/posting_attachments.php b/upload/attach_mod/posting_attachments.php index 4ae925b00..60e91d161 100644 --- a/upload/attach_mod/posting_attachments.php +++ b/upload/attach_mod/posting_attachments.php @@ -806,7 +806,7 @@ class attach_parent } else { - $download_link = BB_ROOT . 'dl.php?id=' . $this->attachment_id_list[$i]; + $download_link = BB_ROOT . DOWNLOAD_URL . $this->attachment_id_list[$i]; } $template->assign_block_vars('attach_row', array( diff --git a/upload/groupcp.php b/upload/groupcp.php index f5e09354b..0b715176d 100644 --- a/upload/groupcp.php +++ b/upload/groupcp.php @@ -556,7 +556,7 @@ else 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_MODE_SELECT' => $select_sort_mode, 'S_ORDER_SELECT' => $select_sort_order, - 'S_GROUPCP_ACTION' => "groupcp.php?" . POST_GROUPS_URL . "=$group_id", + 'S_GROUPCP_ACTION' => GROUP_URL . $group_id, )); // Dump out the remaining users diff --git a/upload/posting.php b/upload/posting.php index acef3fa9f..922229a2e 100644 --- a/upload/posting.php +++ b/upload/posting.php @@ -671,7 +671,7 @@ $template->assign_vars(array( 'SUBJECT' => $subject, 'MESSAGE' => $message, - 'U_VIEWTOPIC' => ( $mode == 'reply' ) ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&postorder=desc" : '', + 'U_VIEWTOPIC' => ( $mode == 'reply' ) ? POST_URL ."$topic_id&postorder=desc" : '', 'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '', 'S_TYPE_TOGGLE' => $topic_type_toggle, diff --git a/upload/viewforum.php b/upload/viewforum.php index 44a4deaaf..105831625 100644 --- a/upload/viewforum.php +++ b/upload/viewforum.php @@ -68,9 +68,8 @@ if (!$is_auth['auth_view']) { if (IS_GUEST) { - $redirect = "f=$forum_id"; $redirect .= ($start) ? "&start=$start" : ''; - redirect(LOGIN_URL . "?redirect=viewforum.php&$redirect"); + redirect(LOGIN_URL . "?redirect=". FORUM_URL . $forum_id ."&$redirect"); } // The user is not authed to read this forum ... $message = sprintf($lang['SORRY_AUTH_VIEW'], $is_auth['auth_view_type']); @@ -282,7 +281,7 @@ if (!empty($_REQUEST['topicdays'])) // Correct $start value if ($start > $forum_topics) { - redirect("viewforum.php?f=$forum_id"); + redirect(FORUM_URL . $forum_id); } // Generate SORT and ORDER selects diff --git a/upload/viewtopic.php b/upload/viewtopic.php index 088e8e77e..3e85082ef 100644 --- a/upload/viewtopic.php +++ b/upload/viewtopic.php @@ -179,7 +179,7 @@ if (!$is_auth['auth_read']) { $redirect = ($post_id) ? POST_URL ."$post_id#$post_id" : TOPIC_URL . $topic_id; $redirect .= ($start && !$post_id) ? "&start=$start" : ''; - redirect(LOGIN_URL . "?redirect=viewtopic.php&$redirect"); + redirect(LOGIN_URL . "?redirect=$redirect"); } bb_die($lang['TOPIC_POST_NOT_EXIST']); } @@ -313,7 +313,7 @@ if ($bb_cfg['topic_notify_enabled']) { if ($_GET['unwatch'] == 'topic') { - redirect(LOGIN_URL . "?redirect=viewtopic.php&t=$topic_id&unwatch=topic"); + redirect(LOGIN_URL . "?redirect=". TOPIC_URL . "$topic_id&unwatch=topic"); } } } @@ -434,9 +434,9 @@ if ( count($orig_word) ) // $new_topic_url = POSTING_URL . "?mode=newtopic&f=$forum_id"; $reply_topic_url = POSTING_URL . "?mode=reply&t=$topic_id"; -$view_forum_url = "viewforum.php?f=$forum_id"; -$view_prev_topic_url = "viewtopic.php?t=$topic_id&view=previous#newest"; -$view_next_topic_url = "viewtopic.php?t=$topic_id&view=next#newest"; +$view_forum_url = FORUM_URL . $forum_id; +$view_prev_topic_url = TOPIC_URL ."$topic_id&view=previous#newest"; +$view_next_topic_url = TOPIC_URL ."$topic_id&view=next#newest"; $reply_img = ( $t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED) ? $images['reply_locked'] : $images['reply_new']; $reply_alt = ( $t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED) ? $lang['TOPIC_LOCKED_SHORT'] : $lang['REPLY_TO_TOPIC']; @@ -518,13 +518,13 @@ if ( $can_watch_topic ) { if ( $is_watching_topic ) { - $s_watching_topic = "' . $lang['STOP_WATCHING_TOPIC'] . ''; - $s_watching_topic_img = ( isset($images['topic_un_watch']) ) ? "' . $lang['STOP_WATCHING_TOPIC'] . '' : ''; + $s_watching_topic = "' . $lang['STOP_WATCHING_TOPIC'] . ''; + $s_watching_topic_img = ( isset($images['topic_un_watch']) ) ? "' . $lang['STOP_WATCHING_TOPIC'] . '' : ''; } else { - $s_watching_topic = "' . $lang['START_WATCHING_TOPIC'] . ''; - $s_watching_topic_img = ( isset($images['Topic_watch']) ) ? "' . $lang['START_WATCHING_TOPIC'] . '' : ''; + $s_watching_topic = "' . $lang['START_WATCHING_TOPIC'] . ''; + $s_watching_topic_img = ( isset($images['Topic_watch']) ) ? "' . $lang['START_WATCHING_TOPIC'] . '' : ''; } } @@ -601,7 +601,7 @@ $template->assign_vars(array( 'S_SELECT_POST_DAYS' => build_select('postdays', array_flip($sel_previous_days), $post_days), 'S_SELECT_POST_ORDER' => build_select('postorder', $sel_post_order_ary, $post_order), - 'S_POST_DAYS_ACTION' => "viewtopic.php?t=$topic_id&start=$start", + 'S_POST_DAYS_ACTION' => TOPIC_URL ."$topic_id&start=$start", 'S_AUTH_LIST' => $s_auth_can, 'S_TOPIC_ADMIN' => $topic_mod, 'S_WATCH_TOPIC' => $s_watching_topic,