Skip to content

Commit

Permalink
Resolve conflicting function names
Browse files Browse the repository at this point in the history
This is partial sync with torrentpier/experimental, required to resolve
conflicts with laravel helper functions
  • Loading branch information
yukoff committed Aug 2, 2017
1 parent 9fc3756 commit 104c7f3
Show file tree
Hide file tree
Showing 27 changed files with 70 additions and 70 deletions.
10 changes: 5 additions & 5 deletions admin/admin_cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
define('BB_ROOT', './../');
require BB_ROOT . 'common.php';
$user->session_start();
redirect('admin/' . basename(__FILE__) . '?mode=list');
redirectToUrl('admin/' . basename(__FILE__) . '?mode=list');
} else {
require __DIR__ . '/pagestart.php';
}
Expand Down Expand Up @@ -109,12 +109,12 @@
if (file_exists('../triggers/cron_running')) {
rename('../triggers/cron_running', '../triggers/cron_allowed');
}
redirect('admin/' . basename(__FILE__) . '?mode=list');
redirectToUrl('admin/' . basename(__FILE__) . '?mode=list');
break;

case 'run':
run_jobs($job_id);
redirect('admin/' . basename(__FILE__) . '?mode=list');
redirectToUrl('admin/' . basename(__FILE__) . '?mode=list');
break;

case 'edit':
Expand Down Expand Up @@ -210,7 +210,7 @@
} elseif (($cron_action == 'disable' || $cron_action == 'enable') && $jobs) {
toggle_active($jobs, $cron_action);
}
redirect('admin/' . basename(__FILE__) . '?mode=list');
redirectToUrl('admin/' . basename(__FILE__) . '?mode=list');
} elseif (validate_cron_post($_POST) == 1) {
if ($_POST['mode'] == 'edit') {
update_cron_job($_POST);
Expand All @@ -220,7 +220,7 @@
bb_die('Mode error');
}

redirect('admin/' . basename(__FILE__) . '?mode=list');
redirectToUrl('admin/' . basename(__FILE__) . '?mode=list');
} else {
bb_die(validate_cron_post($_POST));
}
Expand Down
6 changes: 3 additions & 3 deletions admin/admin_ug_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@
$ug_data = $this_userdata;
$ug_data['session_logged_in'] = 1;

$u_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data, array(), UG_PERM_USER_ONLY);
$g_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data, array(), UG_PERM_GROUP_ONLY);
$u_access = auth_user(AUTH_ALL, AUTH_LIST_ALL, $ug_data, array(), UG_PERM_USER_ONLY);
$g_access = auth_user(AUTH_ALL, AUTH_LIST_ALL, $ug_data, array(), UG_PERM_GROUP_ONLY);

foreach ($forums['c'] as $c_id => $c_data) {
$template->assign_block_vars('c', array(
Expand Down Expand Up @@ -319,7 +319,7 @@
$base_url = basename(__FILE__) . "?mode=group&g=$group_id";

$ug_data = array('group_id' => $group_id);
$u_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data);
$u_access = auth_user(AUTH_ALL, AUTH_LIST_ALL, $ug_data);

foreach ($forums['c'] as $c_id => $c_data) {
$template->assign_block_vars('c', array(
Expand Down
4 changes: 2 additions & 2 deletions admin/pagestart.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
$user->session_start();

if (IS_GUEST) {
redirect(LOGIN_URL . '?redirect=admin/index.php');
redirectToUrl(LOGIN_URL . '?redirect=admin/index.php');
}

if (!IS_ADMIN) {
Expand All @@ -43,5 +43,5 @@

if (!$userdata['session_admin']) {
$redirect = url_arg($_SERVER['REQUEST_URI'], 'admin', 1);
redirect("login.php?redirect=$redirect");
redirectToUrl("login.php?redirect=$redirect");
}
2 changes: 1 addition & 1 deletion dl.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function send_file_to_browser($attachment, $upload_dir)
$forum_id = $row['forum_id'];

$is_auth = array();
$is_auth = auth(AUTH_ALL, $forum_id, $userdata);
$is_auth = auth_user(AUTH_ALL, $forum_id, $userdata);
set_die_append_msg($forum_id, $topic_id);

if ($is_auth['auth_download']) {
Expand Down
12 changes: 6 additions & 6 deletions dl_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@

// Check if user logged in
if (!$userdata['session_logged_in']) {
redirect(LOGIN_URL . "?redirect=$redirect_type&$redirect");
redirectToUrl(LOGIN_URL . "?redirect=$redirect_type&$redirect");
}

// Check if user did not confirm
if (isset($_POST['cancel']) && $_POST['cancel']) {
redirect("$redirect_type?$redirect");
redirectToUrl("$redirect_type?$redirect");
}

// Delete DL-list
Expand All @@ -86,7 +86,7 @@
bb_die('Could not obtain forum_id for this topic');
}

$is_auth = auth(AUTH_ALL, $row['forum_id'], $userdata);
$is_auth = auth_user(AUTH_ALL, $row['forum_id'], $userdata);

if (!$is_auth['auth_mod']) {
bb_die($lang['NOT_MODERATOR']);
Expand All @@ -107,7 +107,7 @@
}

clear_dl_list($topic_id);
redirect("$redirect_type?$redirect");
redirectToUrl("$redirect_type?$redirect");
}

// Update DL status
Expand Down Expand Up @@ -149,7 +149,7 @@

DB()->query("REPLACE INTO " . BB_BT_DLSTATUS . " $new_dlstatus_sql");

redirect("$redirect_type?$redirect");
redirectToUrl("$redirect_type?$redirect");
}

redirect("index.php");
redirectToUrl("index.php");
8 changes: 4 additions & 4 deletions feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
}
}
if (file_exists($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') > $timecheck) {
redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
redirectToUrl($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
} else {
require_once INC_DIR . '/functions_atom.php';
if (update_forum_feed($id, $forum_data)) {
redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
redirectToUrl($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_FORUM']);
}
Expand All @@ -69,11 +69,11 @@
bb_simple_die($lang['ATOM_ERROR'] . ' #3');
}
if (file_exists($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) {
redirect($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
redirectToUrl($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
require_once INC_DIR . '/functions_atom.php';
if (update_user_feed($id, $username)) {
redirect($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
redirectToUrl($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_USER']);
}
Expand Down
2 changes: 1 addition & 1 deletion group.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function build_group($params)
));
} else {
if (IS_ADMIN) {
redirect('admin/admin_groups.php');
redirectToUrl('admin/admin_groups.php');
} else {
bb_die($lang['NO_GROUPS_EXIST']);
}
Expand Down
2 changes: 1 addition & 1 deletion group_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@
if ($group_id) {
$redirect = GROUP_URL . $group_id;
}
redirect($redirect);
redirectToUrl($redirect);
}
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

// Validate requested category id
if ($viewcat && !($viewcat =& $forums['c'][$viewcat]['cat_id'])) {
redirect("index.php");
redirectToUrl("index.php");
}

// Forums
Expand Down
6 changes: 3 additions & 3 deletions library/ajax/posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
$this->ajax_die('not post');
}

$is_auth = auth(AUTH_ALL, $post['forum_id'], $userdata, $post);
$is_auth = auth_user(AUTH_ALL, $post['forum_id'], $userdata, $post);
if ($post['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod']) {
$this->ajax_die($lang['TOPIC_LOCKED']);
}
Expand All @@ -60,7 +60,7 @@
$this->ajax_die('not post');
}

$is_auth = auth(AUTH_ALL, $post['forum_id'], $userdata, $post);
$is_auth = auth_user(AUTH_ALL, $post['forum_id'], $userdata, $post);
}

if (!defined('WORD_LIST_OBTAINED')) {
Expand Down Expand Up @@ -172,7 +172,7 @@

$this->response['html'] = bbcode2html($text);
} else {
$is_auth = auth(AUTH_ALL, $post['forum_id'], $userdata, $post);
$is_auth = auth_user(AUTH_ALL, $post['forum_id'], $userdata, $post);
if ($post['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod']) {
$this->ajax_die($lang['TOPIC_LOCKED']);
} elseif (!$is_auth['auth_edit']) {
Expand Down
2 changes: 1 addition & 1 deletion library/ajax/view_post.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
} elseif ($post_data['auth_read'] != AUTH_ALL) {
$is_auth = auth(AUTH_READ, $post_data['forum_id'], $user->data, $post_data);
$is_auth = auth_user(AUTH_READ, $post_data['forum_id'], $user->data, $post_data);
if (!$is_auth['auth_read']) {
$this->ajax_die($lang['TOPIC_POST_NOT_EXIST']);
}
Expand Down
10 changes: 5 additions & 5 deletions library/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function is_unread($ref, $topic_id = 0, $forum_id = 0)
define('AUTH_ACL', 2);
define('AUTH_ADMIN', 5);

// forum_perm bitfields - backward compatible with auth($type)
// forum_perm bitfields - backward compatible with auth_user($type)
define('AUTH_ALL', 0);
define('AUTH_VIEW', 1);
define('AUTH_READ', 2);
Expand Down Expand Up @@ -259,7 +259,7 @@ function setbit(&$int, $bit_num, $on)
forum auth levels, this will prevent the auth function having to do its own
lookup
*/
function auth($type, $forum_id, $ug_data, array $f_access = array(), $group_perm = UG_PERM_BOTH)
function auth_user($type, $forum_id, $ug_data, array $f_access = array(), $group_perm = UG_PERM_BOTH)
{
global $lang, $bf, $datastore;

Expand Down Expand Up @@ -1402,7 +1402,7 @@ function bb_realpath($path)

function login_redirect($url = '')
{
redirect(LOGIN_URL . '?redirect=' . (($url) ?: (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/')));
redirectToUrl(LOGIN_URL . '?redirect=' . (($url) ?: (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/')));
}

function meta_refresh($url, $time = 5)
Expand All @@ -1412,7 +1412,7 @@ function meta_refresh($url, $time = 5)
$template->assign_var('META', '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />');
}

function redirect($url)
function redirectToUrl($url)
{
global $bb_cfg;

Expand Down Expand Up @@ -2133,7 +2133,7 @@ function hash_search($hash)
$info_hash = DB()->escape(pack("H*", $hash));

if ($row = DB()->fetch_row("SELECT topic_id FROM " . BB_BT_TORRENTS . " WHERE info_hash = '$info_hash'")) {
redirect(TOPIC_URL . $row['topic_id']);
redirectToUrl(TOPIC_URL . $row['topic_id']);
} else {
bb_die(sprintf($lang['HASH_NOT_FOUND'], $hash));
}
Expand Down
2 changes: 1 addition & 1 deletion library/includes/functions_torrent.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function torrent_auth_check($forum_id, $poster_id)
return true;
}

$is_auth = auth(AUTH_ALL, $forum_id, $userdata);
$is_auth = auth_user(AUTH_ALL, $forum_id, $userdata);

if ($poster_id != $userdata['user_id'] && !$is_auth['auth_mod']) {
bb_die($lang['NOT_MODERATOR']);
Expand Down
2 changes: 1 addition & 1 deletion library/includes/posting_tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

if (!$f_data['forum_tpl_id'] || !$tpl_data = DB()->fetch_row($sql)) {
if (!$edit_tpl_mode) {
redirect(POSTING_URL . "?mode=newtopic&f=$forum_id");
redirectToUrl(POSTING_URL . "?mode=newtopic&f=$forum_id");
}
}

Expand Down
4 changes: 2 additions & 2 deletions library/includes/ucp/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

// Is send through board enabled? No, return to index
if (!$bb_cfg['board_email_form']) {
redirect("index.php");
redirectToUrl("index.php");
}

set_die_append_msg();
Expand All @@ -41,7 +41,7 @@
}

if (!$userdata['session_logged_in']) {
redirect(LOGIN_URL . "?redirect=profile.php&mode=email&" . POST_USERS_URL . "=$user_id");
redirectToUrl(LOGIN_URL . "?redirect=profile.php&mode=email&" . POST_USERS_URL . "=$user_id");
}

$errors = array();
Expand Down
2 changes: 1 addition & 1 deletion library/includes/ucp/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
*/
case 'register':
if (!$can_register) {
redirect('index.php');
redirectToUrl('index.php');
}

if (!IS_ADMIN) {
Expand Down
2 changes: 1 addition & 1 deletion library/includes/ucp/viewprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}

if (!$userdata['session_logged_in']) {
redirect(LOGIN_URL . "?redirect={$_SERVER['REQUEST_URI']}");
redirectToUrl(LOGIN_URL . "?redirect={$_SERVER['REQUEST_URI']}");
}

if (!$ranks = $datastore->get('ranks')) {
Expand Down
8 changes: 4 additions & 4 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
if (!IS_GUEST) {
$user->session_end();
}
redirect("index.php");
redirectToUrl("index.php");
}

$redirect_url = "index.php";
Expand Down Expand Up @@ -88,7 +88,7 @@
if (isset($_POST['login'])) {
if (!$mod_admin_login) {
if (!IS_GUEST) {
redirect('index.php');
redirectToUrl('index.php');
}
if ($login_username == '' || $login_password == '') {
$login_errors[] = $lang['ENTER_PASSWORD'];
Expand All @@ -109,7 +109,7 @@
if ($redirect_url == '/' . LOGIN_URL || $redirect_url == LOGIN_URL) {
$redirect_url = 'index.php';
}
redirect($redirect_url);
redirectToUrl($redirect_url);
}

$login_errors[] = $lang['ERROR_LOGIN'];
Expand Down Expand Up @@ -142,4 +142,4 @@
print_page('login.tpl');
}

redirect($redirect_url);
redirectToUrl($redirect_url);
6 changes: 3 additions & 3 deletions modcp.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ function validate_mode_condition($request_index, $mod_action = '')
if ($topic_id || $forum_id) {
$redirect = ($topic_id) ? TOPIC_URL . $topic_id : FORUM_URL . $forum_id;
}
redirect($redirect);
redirectToUrl($redirect);
}

// Start auth check
$is_auth = auth(AUTH_ALL, $forum_id, $userdata);
$is_auth = auth_user(AUTH_ALL, $forum_id, $userdata);
$is_moderator = (IS_AM);

if ($mode == 'ip') {
Expand All @@ -185,7 +185,7 @@ function validate_mode_condition($request_index, $mod_action = '')
// Redirect to login page if not admin session
if ($is_moderator && !$userdata['session_admin']) {
$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : $_SERVER['REQUEST_URI'];
redirect(LOGIN_URL . "?redirect=$redirect&admin=1");
redirectToUrl(LOGIN_URL . "?redirect=$redirect&admin=1");
}

//
Expand Down
Loading

0 comments on commit 104c7f3

Please sign in to comment.