Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 1 addition & 6 deletions featherbb/Controller/Admin/Bans.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ 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');
}
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

public function display()
{
// Display bans
Expand Down
5 changes: 0 additions & 5 deletions featherbb/Controller/Admin/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/categories.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'].$class_name.'.php';
}

public function add_category()
{
$cat_name = Utils::trim($this->request->post('cat_name'));
Expand Down
5 changes: 0 additions & 5 deletions featherbb/Controller/Admin/Censoring.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/censoring.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

public function display()
{
// Add a censor word
Expand Down
5 changes: 0 additions & 5 deletions featherbb/Controller/Admin/Forums.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/forums.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

//
// CRUD
//
Expand Down
5 changes: 0 additions & 5 deletions featherbb/Controller/Admin/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/groups.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

public function display()
{
$groups = $this->model->fetch_groups();
Expand Down
5 changes: 0 additions & 5 deletions featherbb/Controller/Admin/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/index.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

public function remove_install_folder($directory)
{
foreach(glob("{$directory}/*") as $file)
Expand Down
5 changes: 0 additions & 5 deletions featherbb/Controller/Admin/Permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/permissions.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

public function display()
{
// Update permissions
Expand Down
17 changes: 10 additions & 7 deletions featherbb/Controller/Admin/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace FeatherBB\Controller\Admin;

use FeatherBB\Core\AdminUtils;
use FeatherBB\Core\Lister;
use FeatherBB\Core\Error;
use FeatherBB\Core\Utils;
Expand All @@ -32,18 +33,20 @@ public function index()
// AdminUtils::generateAdminMenu('plugins');
$this->feather->template->addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript'));

$plugins = Lister::getPlugins();
// var_dump($plugins);
$availablePlugins = Lister::getPlugins();
// var_dump($availablePlugins);
$activePlugins = $this->feather->cache->isCached('active_plugins') ? $this->feather->cache->retrieve('active_plugins') : array();
// var_dump($activePlugins);
// $this->feather->cache->delete('active_plugins');

AdminUtils::generateAdminMenu('plugins');

$this->feather->template->setPageInfo(array(
'admin_console' => true,
'active_page' => 'admin',
'plugins' => $plugins,
'activePlugins' => $activePlugins,
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Extension')),
'admin_console' => true,
'active_page' => 'admin',
'availablePlugins' => $availablePlugins,
'activePlugins' => $activePlugins,
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Extension')),
)
)->addTemplate('admin/plugins.php')->display();
}
Expand Down
5 changes: 0 additions & 5 deletions featherbb/Controller/Admin/Reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/reports.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

public function display()
{
// Zap a report
Expand Down
15 changes: 5 additions & 10 deletions featherbb/Controller/Admin/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,11 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/users.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

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 +49,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 +67,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 +102,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
7 changes: 1 addition & 6 deletions featherbb/Controller/Forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->feather->user->language.'/forum.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

public function display($fid, $name = null, $page = null)
{
// Fetch some informations about the forum
Expand All @@ -39,7 +34,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
5 changes: 0 additions & 5 deletions featherbb/Controller/Help.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ public function __construct()
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/help.mo');
}

public function __autoload($class_name)
{
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

public function display()
{
$this->feather->template->setPageInfo(array(
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
Loading