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
2 changes: 1 addition & 1 deletion featherbb/Controller/Admin/Forums.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct()
$this->config = $this->feather->config;
$this->user = $this->feather->user;
$this->request = $this->feather->request;
$this->model = new \FeatherBB\Model\Admin\forums();
$this->model = new \FeatherBB\Model\Admin\Forums();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/forums.mo');
}

Expand Down
2 changes: 1 addition & 1 deletion featherbb/Controller/Admin/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct()
$this->config = $this->feather->config;
$this->user = $this->feather->user;
$this->request = $this->feather->request;
$this->model = new \FeatherBB\Model\Admin\groups();
$this->model = new \FeatherBB\Model\Admin\Groups();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/groups.mo');
}

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

public function remove_install_folder($directory)
{
foreach(glob("{$directory}/*") as $file)
{
if(is_dir($file)) {
$this->remove_install_folder($file);
} else {
unlink($file);
}
}
$deleted = rmdir($directory);

return $deleted;
}

public function display($action = null)
{
// Check for upgrade
Expand All @@ -60,24 +45,14 @@ public function display($action = null)
Url::redirect($this->feather->urlFor('adminIndex'), sprintf(__('New version available message'), '<a href="http://featherbb.org/">FeatherBB.org</a>'));
}
}
// Remove /install
elseif ($action == 'remove_install_file') {
$deleted = $this->remove_install_folder($this->feather->forum_env['FEATHER_ROOT'].'install');

if ($deleted) {
Url::redirect($this->feather->urlFor('adminIndex'), __('Deleted install.php redirect'));
} else {
throw new Error(__('Delete install.php failed'), 500);
}
}

AdminUtils::generateAdminMenu('index');

$this->feather->template->setPageInfo(array(
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Index')),
'active_page' => 'admin',
'admin_console' => true
)
)->addTemplate('admin/index.php')->display();
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Index')),
'active_page' => 'admin',
'admin_console' => true
)
)->addTemplate('admin/index.php')->display();
}
}
2 changes: 1 addition & 1 deletion featherbb/Controller/Admin/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct()
$this->config = $this->feather->config;
$this->user = $this->feather->user;
$this->request = $this->feather->request;
$this->model = new \FeatherBB\Model\Admin\options();
$this->model = new \FeatherBB\Model\Admin\Options();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/options.mo');
}

Expand Down
3 changes: 1 addition & 2 deletions featherbb/Controller/Admin/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct()
$this->config = $this->feather->config;
$this->user = $this->feather->user;
$this->request = $this->feather->request;
$this->model = new \FeatherBB\Model\Admin\parser();
$this->model = new \FeatherBB\Model\Admin\Parser();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/parser.mo');
}

Expand Down Expand Up @@ -53,7 +53,6 @@ public function display()

if ($this->request->post('form_sent')) {


// Upload new smiley image to style/img/smilies
if ($this->request->post('upload') && isset($_FILES['new_smiley']) && isset($_FILES['new_smiley']['error'])) {
$f = $_FILES['new_smiley'];
Expand Down
2 changes: 1 addition & 1 deletion featherbb/Controller/Admin/Permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct()
$this->config = $this->feather->config;
$this->user = $this->feather->user;
$this->request = $this->feather->request;
$this->model = new \FeatherBB\Model\Admin\permissions();
$this->model = new \FeatherBB\Model\Admin\Permissions();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/permissions.mo');
}

Expand Down
39 changes: 0 additions & 39 deletions featherbb/Controller/Admin/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,43 +73,4 @@ public function deactivate($plugin = null)
Url::redirect($this->feather->urlFor('adminPlugins'), array('warning', 'Plugin deactivated!'));
}

public function display()
{
// The plugin to load should be supplied via GET
$plugin = $this->request->get('plugin') ? $this->request->get('plugin') : '';
if (!preg_match('%^AM?P_(\w*?)\.php$%i', $plugin)) {
throw new Error(__('Bad request'), 400);
}

// AP_ == Admins only, AMP_ == admins and moderators
$prefix = substr($plugin, 0, strpos($plugin, '_'));
if ($this->user->g_moderator == '1' && $prefix == 'AP') {
throw new Error(__('No permission'), 403);
}

// Make sure the file actually exists
if (!file_exists($this->feather->forum_env['FEATHER_ROOT'].'plugins/'.$plugin)) {
throw new Error(sprintf(__('No plugin message'), Utils::escape($plugin)), 400);
}

// Construct REQUEST_URI if it isn't set TODO?
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
}

// Attempt to load the plugin. We don't use @ here to suppress error messages,
// because if we did and a parse error occurred in the plugin, we would only
// get the "blank page of death"
include $this->feather->forum_env['FEATHER_ROOT'].'plugins/'.$plugin;
if (!defined('FEATHER_PLUGIN_LOADED')) {
throw new Error(sprintf(__('Plugin failed message'), Utils::escape($plugin)));
}

$this->feather->template->setPageInfo(array(
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), str_replace('_', ' ', substr($plugin, strpos($plugin, '_') + 1, -4))),
'active_page' => 'admin',
'admin_console' => true,
)
)->addTemplate('admin/loader.php')->display();
}
}
8 changes: 6 additions & 2 deletions featherbb/Controller/Admin/Reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use FeatherBB\Core\AdminUtils;
use FeatherBB\Core\Utils;
use FeatherBB\Core\Url;

class Reports
{
Expand All @@ -21,15 +22,18 @@ public function __construct()
$this->config = $this->feather->config;
$this->user = $this->feather->user;
$this->request = $this->feather->request;
$this->model = new \FeatherBB\Model\Admin\reports();
$this->model = new \FeatherBB\Model\Admin\Reports();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/reports.mo');
}

public function display()
{
// Zap a report
if ($this->feather->request->isPost()) {
$this->model->zap_report();
$zap_id = intval(key($this->request->post('zap_id')));
$user_id = $this->user->id;
$this->model->zap_report($zap_id, $user_id);
Url::redirect($this->feather->urlFor('adminReports'), __('Report zapped redirect'));
}

AdminUtils::generateAdminMenu('reports');
Expand Down
2 changes: 1 addition & 1 deletion featherbb/Controller/Admin/Statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct()
$this->config = $this->feather->config;
$this->user = $this->feather->user;
$this->request = $this->feather->request;
$this->model = new \FeatherBB\Model\Admin\statistics();
$this->model = new \FeatherBB\Model\Admin\Statistics();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/index.mo');
}

Expand Down
2 changes: 1 addition & 1 deletion featherbb/Controller/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct()
$this->config = $this->feather->config;
$this->user = $this->feather->user;
$this->request = $this->feather->request;
$this->model = new \FeatherBB\Model\edit();
$this->model = new \FeatherBB\Model\Edit();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/register.mo');
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/prof_reg.mo');
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/post.mo');
Expand Down
2 changes: 1 addition & 1 deletion featherbb/Controller/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Install
public function __construct()
{
$this->feather = \Slim\Slim::getInstance();
$this->model = new \FeatherBB\Model\install();
$this->model = new \FeatherBB\Model\Install();
$this->available_langs = Lister::getLangs();
$this->feather->template->setStyle('FeatherBB');
}
Expand Down
12 changes: 3 additions & 9 deletions featherbb/Model/Admin/Reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,24 @@
namespace FeatherBB\Model\Admin;

use DB;
use FeatherBB\Core\Url;

class Reports
{
public function __construct()
{
$this->feather = \Slim\Slim::getInstance();
$this->start = $this->feather->start;
$this->config = $this->feather->config;
$this->user = $this->feather->user;
$this->request = $this->feather->request;
$this->hook = $this->feather->hooks;
}

public function zap_report()
public function zap_report($zap_id, $user_id)
{
$zap_id = intval(key($this->request->post('zap_id')));
$zap_id = $this->hook->fire('reports.zap_report.zap_id', $zap_id);

$result = DB::for_table('reports')->where('id', $zap_id);
$result = $this->hook->fireDB('reports.zap_report.query', $result);
$result = $result->find_one_col('zapped');

$set_zap_report = array('zapped' => time(), 'zapped_by' => $this->user->id);
$set_zap_report = array('zapped' => time(), 'zapped_by' => $user_id);
$set_zap_report = $this->hook->fire('reports.zap_report.set_zap_report', $set_zap_report);

// Update report to indicate it has been zapped
Expand All @@ -59,7 +53,7 @@ public function zap_report()
->delete_many();
}

Url::redirect($this->feather->urlFor('adminReports'), __('Report zapped redirect'));
return true;
}

public function get_reports()
Expand Down
2 changes: 1 addition & 1 deletion featherbb/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
});

// Admin plugins
$feather->group('/plugins', function() use ($feather) {
$feather->group('/plugins', $isAdmin, function() use ($feather) {
$feather->map('(/)', '\FeatherBB\Controller\Admin\Plugins:index')->via('GET', 'POST')->name('adminPlugins');
$feather->map('/:name(/)', '\FeatherBB\Controller\Admin\Plugins:index')->via('GET', 'POST')->name('infoPlugin');
$feather->get('/activate/:name(/)', '\FeatherBB\Controller\Admin\Plugins:activate')->conditions(array('name' => '[a-zA-Z\-]+'))->name('activatePlugin');
Expand Down