Using constant links

Использование заранее определенных констант для ссылок
Исправление некорректного редиректа viewtopic.php
This commit is contained in:
Dark Nightmare 2014-08-10 19:46:09 +06:00
commit dce994f613
8 changed files with 23 additions and 24 deletions

View file

@ -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'],
));
}

View file

@ -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,

View file

@ -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)

View file

@ -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(

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -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 = "<a href=\"viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['STOP_WATCHING_TOPIC'] . '</a>';
$s_watching_topic_img = ( isset($images['topic_un_watch']) ) ? "<a href=\"viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_un_watch'] . '" alt="' . $lang['STOP_WATCHING_TOPIC'] . '" title="' . $lang['STOP_WATCHING_TOPIC'] . '" border="0"></a>' : '';
$s_watching_topic = "<a href=\"". TOPIC_URL ."$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['STOP_WATCHING_TOPIC'] . '</a>';
$s_watching_topic_img = ( isset($images['topic_un_watch']) ) ? "<a href=\"" . TOPIC_URL . "$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_un_watch'] . '" alt="' . $lang['STOP_WATCHING_TOPIC'] . '" title="' . $lang['STOP_WATCHING_TOPIC'] . '" border="0"></a>' : '';
}
else
{
$s_watching_topic = "<a href=\"viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['START_WATCHING_TOPIC'] . '</a>';
$s_watching_topic_img = ( isset($images['Topic_watch']) ) ? "<a href=\"viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['START_WATCHING_TOPIC'] . '" title="' . $lang['START_WATCHING_TOPIC'] . '" border="0"></a>' : '';
$s_watching_topic = "<a href=\"". TOPIC_URL ."$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['START_WATCHING_TOPIC'] . '</a>';
$s_watching_topic_img = ( isset($images['Topic_watch']) ) ? "<a href=\"". TOPIC_URL ."$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['START_WATCHING_TOPIC'] . '" title="' . $lang['START_WATCHING_TOPIC'] . '" border="0"></a>' : '';
}
}
@ -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&amp;start=$start",
'S_POST_DAYS_ACTION' => TOPIC_URL ."$topic_id&amp;start=$start",
'S_AUTH_LIST' => $s_auth_can,
'S_TOPIC_ADMIN' => $topic_mod,
'S_WATCH_TOPIC' => $s_watching_topic,