Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Get rid of legacy constants
  • Loading branch information
beaver-dev committed Sep 8, 2015
commit 4e084cb2883038d7c784dd2bff55071d40fda4d8
2 changes: 1 addition & 1 deletion featherbb/Controller/Admin/Bans.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct()
$this->model = new \FeatherBB\Model\Admin\Bans();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/bans.mo');

if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
throw new Error(__('No permission'), '403');
}
}
Expand Down
10 changes: 5 additions & 5 deletions featherbb/Controller/Admin/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function display()
{
// Move multiple users to other user groups
if ($this->request->post('move_users') || $this->request->post('move_users_comply')) {
if ($this->user->g_id > FEATHER_ADMIN) {
if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
throw new Error(__('No permission'), 403);
}

Expand All @@ -54,7 +54,7 @@ public function display()

// Delete multiple users
if ($this->request->post('delete_users') || $this->request->post('delete_users_comply')) {
if ($this->user->g_id > FEATHER_ADMIN) {
if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
throw new Error(__('No permission'), 403);
}

Expand All @@ -72,7 +72,7 @@ public function display()

// Ban multiple users
if ($this->request->post('ban_users') || $this->request->post('ban_users_comply')) {
if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
throw new Error(__('No permission'), 403);
}

Expand Down Expand Up @@ -107,8 +107,8 @@ public function display()
$paging_links = '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate_old($num_pages, $p, '?find_user=&amp;'.implode('&amp;', $search['query_str']));

// Some helper variables for permissions
$can_delete = $can_move = $this->user->g_id == FEATHER_ADMIN;
$can_ban = $this->user->g_id == FEATHER_ADMIN || ($this->user->g_moderator == '1' && $this->user->g_mod_ban_users == '1');
$can_delete = $can_move = $this->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'];
$can_ban = $this->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || ($this->user->g_moderator == '1' && $this->user->g_mod_ban_users == '1');
$can_action = ($can_delete || $can_ban || $can_move) && $num_users > 0;
$this->feather->template->addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript'));

Expand Down
2 changes: 1 addition & 1 deletion featherbb/Controller/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function login()
if (!empty($user->password)) {
$form_password_hash = Random::hash($form_password); // Will result in a SHA-1 hash
if ($user->password == $form_password_hash) {
if ($user->group_id == FEATHER_UNVERIFIED) {
if ($user->group_id == $this->feather->forum_env['FEATHER_UNVERIFIED']) {
ModelAuth::update_group($user->id, $this->feather->forum_settings['o_default_user_group']);
if (!$this->feather->cache->isCached('users_info')) {
$this->feather->cache->store('users_info', Cache::get_users_info());
Expand Down
4 changes: 2 additions & 2 deletions featherbb/Controller/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function deletepost($id)

// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array();
$is_admmod = ($this->feather->user->g_id == FEATHER_ADMIN || ($this->feather->user->g_moderator == '1' && array_key_exists($this->feather->user->username, $mods_array))) ? true : false;
$is_admmod = ($this->feather->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || ($this->feather->user->g_moderator == '1' && array_key_exists($this->feather->user->username, $mods_array))) ? true : false;

$is_topic_post = ($id == $cur_post['first_post_id']) ? true : false;

Expand All @@ -46,7 +46,7 @@ public function deletepost($id)
throw new Error(__('No permission'), 403);
}

if ($is_admmod && $this->feather->user->g_id != FEATHER_ADMIN && in_array($cur_post['poster_id'], Utils::get_admin_ids())) {
if ($is_admmod && $this->feather->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && in_array($cur_post['poster_id'], Utils::get_admin_ids())) {
throw new Error(__('No permission'), 403);
}

Expand Down
4 changes: 2 additions & 2 deletions featherbb/Controller/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function editpost($id)

// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array();
$is_admmod = ($this->user->g_id == FEATHER_ADMIN || ($this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array))) ? true : false;
$is_admmod = ($this->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || ($this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array))) ? true : false;

$can_edit_subject = $id == $cur_post['first_post_id'];

Expand All @@ -50,7 +50,7 @@ public function editpost($id)
throw new Error(__('No permission'), 403);
}

if ($is_admmod && $this->user->g_id != FEATHER_ADMIN && in_array($cur_post['poster_id'], Utils::get_admin_ids())) {
if ($is_admmod && $this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && in_array($cur_post['poster_id'], Utils::get_admin_ids())) {
throw new Error(__('No permission'), 403);
}

Expand Down
2 changes: 1 addition & 1 deletion featherbb/Controller/Forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function display($fid, $name = null, $page = null)

// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array();
$is_admmod = ($this->feather->user->g_id == FEATHER_ADMIN || ($this->feather->user->g_moderator == '1' && array_key_exists($this->feather->user->username, $mods_array))) ? true : false;
$is_admmod = ($this->feather->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || ($this->feather->user->g_moderator == '1' && array_key_exists($this->feather->user->username, $mods_array))) ? true : false;

$sort_by = $this->model->sort_forum_by($cur_forum['sort_by']);

Expand Down
83 changes: 0 additions & 83 deletions featherbb/Controller/Login.php

This file was deleted.

6 changes: 3 additions & 3 deletions featherbb/Controller/Moderate.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function moderatetopic($id = null, $fid = null, $action = null, $param =
$moderators = $this->model->get_moderators($id);
$mods_array = ($moderators != '') ? unserialize($moderators) : array();

if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator == '0' || !array_key_exists($this->user->username, $mods_array))) {
if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator == '0' || !array_key_exists($this->user->username, $mods_array))) {
throw new Error(__('No permission'), 403);
}

Expand Down Expand Up @@ -199,7 +199,7 @@ public function display($id, $name = null, $page = null)
$moderators = $this->model->get_moderators($id);
$mods_array = ($moderators != '') ? unserialize($moderators) : array();

if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator == '0' || !array_key_exists($this->user->username, $mods_array))) {
if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator == '0' || !array_key_exists($this->user->username, $mods_array))) {
throw new Error(__('No permission'), 403);
}

Expand Down Expand Up @@ -241,7 +241,7 @@ public function dealposts($fid)
$moderators = $this->model->get_moderators($fid);
$mods_array = ($moderators != '') ? unserialize($moderators) : array();

if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator == '0' || !array_key_exists($this->user->username, $mods_array))) {
if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator == '0' || !array_key_exists($this->user->username, $mods_array))) {
throw new Error(__('No permission'), 403);
}

Expand Down
2 changes: 1 addition & 1 deletion featherbb/Controller/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function newpost($fid = null, $tid = null, $qid = null)

// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = ($cur_posting['moderators'] != '') ? unserialize($cur_posting['moderators']) : array();
$is_admmod = ($this->feather->user->g_id == FEATHER_ADMIN || ($this->feather->user->g_moderator == '1' && array_key_exists($this->feather->user->username, $mods_array))) ? true : false;
$is_admmod = ($this->feather->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || ($this->feather->user->g_moderator == '1' && array_key_exists($this->feather->user->username, $mods_array))) ? true : false;

// Do we have permission to post?
if ((($tid && (($cur_posting['post_replies'] == '' && $this->feather->user->g_post_replies == '0') || $cur_posting['post_replies'] == '0')) ||
Expand Down
18 changes: 9 additions & 9 deletions featherbb/Controller/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@ public function display($id, $section = null)
require $this->feather->forum_env['FEATHER_ROOT'].'featherbb/Helpers/utf8/strcasecmp.php';

if ($this->request->post('update_group_membership')) {
if ($this->user->g_id > FEATHER_ADMIN) {
if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
throw new Error(__('No permission'), 403);
}

$this->model->update_group_membership($id, $this->feather);
} elseif ($this->request->post('update_forums')) {
if ($this->user->g_id > FEATHER_ADMIN) {
if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
throw new Error(__('No permission'), 403);
}

$this->model->update_mod_forums($id, $this->feather);
} elseif ($this->request->post('ban')) {
if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
throw new Error(__('No permission'), 403);
}

$this->model->ban_user($id);
} elseif ($this->request->post('delete_user') || $this->request->post('delete_user_comply')) {
if ($this->user->g_id > FEATHER_ADMIN) {
if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
throw new Error(__('No permission'), 403);
}

Expand All @@ -80,9 +80,9 @@ public function display($id, $section = null)

if ($this->user->id != $id && // If we aren't the user (i.e. editing your own profile)
(!$this->user->is_admmod || // and we are not an admin or mod
($this->user->g_id != FEATHER_ADMIN && // or we aren't an admin and ...
($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && // or we aren't an admin and ...
($this->user->g_mod_edit_users == '0' || // mods aren't allowed to edit users
$info['group_id'] == FEATHER_ADMIN || // or the user is an admin
$info['group_id'] == $this->feather->forum_env['FEATHER_ADMIN'] || // or the user is an admin
$info['is_moderator'])))) { // or the user is another mod
throw new Error(__('No permission'), 403);
}
Expand All @@ -99,9 +99,9 @@ public function display($id, $section = null)
// View or edit?
if ($this->user->id != $id && // If we aren't the user (i.e. editing your own profile)
(!$this->user->is_admmod || // and we are not an admin or mod
($this->user->g_id != FEATHER_ADMIN && // or we aren't an admin and ...
($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && // or we aren't an admin and ...
($this->user->g_mod_edit_users == '0' || // mods aren't allowed to edit users
$user['g_id'] == FEATHER_ADMIN || // or the user is an admin
$user['g_id'] == $this->feather->forum_env['FEATHER_ADMIN'] || // or the user is an admin
$user['g_moderator'] == '1')))) { // or the user is another mod
$user_info = $this->model->parse_user_info($user);

Expand Down Expand Up @@ -312,7 +312,7 @@ public function action($id, $action)

Url::redirect($this->feather->urlFor('profileSection', array('id' => $id, 'section' => 'personality')), __('Avatar deleted redirect'));
} elseif ($action == 'promote') {
if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator != '1' || $this->user->g_mod_promote_users == '0')) {
if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator != '1' || $this->user->g_mod_promote_users == '0')) {
throw new Error(__('No permission'), 403);
}

Expand Down
Loading