Skip to content
3 changes: 1 addition & 2 deletions featherbb/Controller/Admin/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public function display($action = null)
$this->feather->template->setPageInfo(array(
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Index')),
'active_page' => 'admin',
'admin_console' => true,
'install_file_exists' => is_dir($this->feather->forum_env['FEATHER_ROOT'].'install'),
'admin_console' => true
)
)->addTemplate('admin/index.php')->display();
}
Expand Down
2 changes: 1 addition & 1 deletion featherbb/Controller/Admin/Maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Maintenance
public function __construct()
{
$this->feather = \Slim\Slim::getInstance();
$this->model = new \FeatherBB\Model\Admin\maintenance();
$this->model = new \FeatherBB\Model\Admin\Maintenance();
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->feather->user->language.'/admin/maintenance.mo');
}

Expand Down
16 changes: 8 additions & 8 deletions featherbb/Controller/Admin/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,27 @@ public function index()
)->addTemplate('admin/plugins.php')->display();
}

public function activate()
public function activate($pluginName = null)
{
// The plugin to load should be supplied via GET
$class = $this->request->get('plugin') ? $this->request->get('plugin') : null;
if (!$class) {
// $pluginName = $this->request->get('plugin') ? $this->request->get('plugin') : null;
if (!$pluginName) {
throw new Error(__('Bad request'), 400);
}

// Check if plugin follows PSR-4 conventions and extends base forum plugin
if (!class_exists($class) || !property_exists($class, 'isValidFBPlugin')) {
throw new Error(sprintf(__('No plugin message'), Utils::escape($class)), 400);
if (!class_exists($pluginName) || !property_exists($pluginName, 'isValidFBPlugin')) {
throw new Error(sprintf(__('No plugin message'), Utils::escape($pluginName)), 400);
}

$plugin = new $class;
$plugin = new $pluginName;
try {
$plugin->activate($class);
$plugin->activate($pluginName);
} catch (\Exception $e) {
Url::redirect($this->feather->urlFor('adminPlugins'), $e->getMessage());
}
// Plugin has been activated, confirm and redirect
Url::redirect($this->feather->urlFor('adminPlugins'), 'Plugin "'.$class::$name.'" activated!');
Url::redirect($this->feather->urlFor('adminPlugins'), 'Plugin "'.$pluginName::$name.'" activated!');
}

public function deactivate()
Expand Down
4 changes: 2 additions & 2 deletions featherbb/Controller/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function login()
Url::redirect($this->feather->urlFor('home'), __('Login redirect'));
}
}
throw new Error(__('Wrong user/pass').' <a href="'.Url::get('login/action/forget/').'">'.__('Forgotten pass').'</a>', 403);
throw new Error(__('Wrong user/pass').' <a href="'.$this->feather->urlFor('resetPassword').'">'.__('Forgotten pass').'</a>', 403);
} else {
$this->feather->template->setPageInfo(array(
'active_page' => 'login',
Expand Down Expand Up @@ -135,7 +135,7 @@ public function forget()

// Do the user specific replacements to the template
$cur_mail_message = str_replace('<username>', $user->username, $mail_message);
$cur_mail_message = str_replace('<activation_url>', Url::get('user/'.$user->id.'/action/change_pass/?key='.$new_password_key), $cur_mail_message);
$cur_mail_message = str_replace('<activation_url>', $this->feather->urlFor('profileAction', ['action' => 'change_pass']).'?key='.$new_password_key, $cur_mail_message);
$cur_mail_message = str_replace('<new_password>', $new_password, $cur_mail_message);
$cur_mail_message = $this->feather->hooks->fire('cur_mail_message_password_forgotten', $cur_mail_message);

Expand Down
3 changes: 1 addition & 2 deletions featherbb/Controller/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public function editpost($id)
// Edit the post
$this->model->edit_post($id, $can_edit_subject, $post, $cur_post, $is_admmod);

// Url::redirect($this->feather->urlFor('viewPost', array('pid' => $id)), __('Post redirect'));
Url::redirect($this->feather->url->get('post/'.$id.'/#p'.$id), __('Post redirect'));
Url::redirect($this->feather->urlFor('viewPost', ['pid' => $id]).'#p'.$id, __('Post redirect'));
}
} else {
$post = '';
Expand Down
26 changes: 13 additions & 13 deletions featherbb/Controller/Forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public function __autoload($class_name)
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
}

public function display($id, $name = null, $page = null)
public function display($fid, $name = null, $page = null)
{
// Fetch some informations about the forum
$cur_forum = $this->model->get_info_forum($id);
$cur_forum = $this->model->get_info_forum($fid);

// Is this a redirect forum? In that case, redirect!
if ($cur_forum['redirect_url'] != '') {
Expand All @@ -45,7 +45,7 @@ public function display($id, $name = null, $page = null)

// Can we or can we not post new topics?
if (($cur_forum['post_topics'] == '' && $this->feather->user->g_post_topics == '1') || $cur_forum['post_topics'] == '1' || $is_admmod) {
$post_link = "\t\t\t".'<p class="postlink conr"><a href="'.Url::get('post/new-topic/'.$id.'/').'">'.__('Post topic').'</a></p>'."\n";
$post_link = "\t\t\t".'<p class="postlink conr"><a href="'.$this->feather->urlFor('newTopic', ['fid' => $fid]).'">'.__('Post topic').'</a></p>'."\n";
} else {
$post_link = '';
}
Expand All @@ -58,24 +58,24 @@ public function display($id, $name = null, $page = null)
$url_forum = Url::url_friendly($cur_forum['forum_name']);

// Generate paging links
$paging_links = '<span class="pages-label">'.__('Pages').' </span>'.Url::paginate($num_pages, $p, 'forum/'.$id.'/'.$url_forum.'/#');
$paging_links = '<span class="pages-label">'.__('Pages').' </span>'.Url::paginate($num_pages, $p, 'forum/'.$fid.'/'.$url_forum.'/#');

$forum_actions = $this->model->get_forum_actions($id, $this->feather->forum_settings['o_forum_subscriptions'], $cur_forum['is_subscribed']);
$forum_actions = $this->model->get_forum_actions($fid, $this->feather->forum_settings['o_forum_subscriptions'], $cur_forum['is_subscribed']);

$this->feather->template->addAsset('canonical', Url::get('forum/'.$id.'/'.$url_forum.'/'));
$this->feather->template->addAsset('canonical', $this->feather->urlFor('Forum', ['id' => $fid, 'name' => $url_forum]));
if ($num_pages > 1) {
if ($p > 1) {
$this->feather->template->addAsset('prev', Url::get('forum/'.$id.'/'.$url_forum.'/page/'.($p - 1).'/'));
$this->feather->template->addAsset('prev', $this->feather->urlFor('ForumPaginate', ['id' => $fid, 'name' => $url_forum, 'page' => intval($p-1)]));
}
if ($p < $num_pages) {
$this->feather->template->addAsset('next', Url::get('forum/'.$id.'/'.$url_forum.'/page/'.($p + 1).'/'));
$this->feather->template->addAsset('next', $this->feather->urlFor('ForumPaginate', ['id' => $fid, 'name' => $url_forum, 'page' => intval($p+1)]));
}
}

if ($this->feather->forum_settings['o_feed_type'] == '1') {
$this->feather->template->addAsset('feed', 'extern.php?action=feed&amp;fid='.$id.'&amp;type=rss', array('title' => __('RSS forum feed')));
$this->feather->template->addAsset('feed', 'extern.php?action=feed&amp;fid='.$fid.'&amp;type=rss', array('title' => __('RSS forum feed')));
} elseif ($this->feather->forum_settings['o_feed_type'] == '2') {
$this->feather->template->addAsset('feed', 'extern.php?action=feed&amp;fid='.$id.'&amp;type=atom', array('title' => __('Atom forum feed')));
$this->feather->template->addAsset('feed', 'extern.php?action=feed&amp;fid='.$fid.'&amp;type=atom', array('title' => __('Atom forum feed')));
}

$this->feather->template->setPageInfo(array(
Expand All @@ -84,9 +84,9 @@ public function display($id, $name = null, $page = null)
'page_number' => $p,
'paging_links' => $paging_links,
'is_indexed' => true,
'id' => $id,
'fid' => $id,
'forum_data' => $this->model->print_topics($id, $sort_by, $start_from),
'id' => $fid,
'fid' => $fid,
'forum_data' => $this->model->print_topics($fid, $sort_by, $start_from),
'cur_forum' => $cur_forum,
'post_link' => $post_link,
'start_from' => $start_from,
Expand Down
8 changes: 4 additions & 4 deletions featherbb/Controller/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function newpost($fid = null, $tid = null, $qid = null)
$this->model->increment_post_count($post, $new['tid']);
}

Url::redirect(Url::get('post/'.$new['pid'].'/#p'.$new['pid']), __('Post redirect'));
Url::redirect($this->feather->urlFor('viewPost', ['pid' => $new['pid']]).'#p'.$new['pid'], __('Post redirect'));
}
}

Expand All @@ -133,18 +133,18 @@ public function newpost($fid = null, $tid = null, $qid = null)
// If a topic ID was specified in the url (it's a reply)
if ($tid) {
$action = __('Post a reply');
$form = '<form id="post" method="post" action="'.Url::get('post/reply/'.$tid.'/').'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
$form = '<form id="post" method="post" action="'.$this->feather->urlFor('newReply', ['tid' => $tid]).'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';

// If a quote ID was specified in the url
if (isset($qid)) {
$quote = $this->model->get_quote_message($qid, $tid);
$form = '<form id="post" method="post" action="'.Url::get('post/reply/'.$tid.'/quote/'.$qid.'/').'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
$form = '<form id="post" method="post" action="'.$this->feather->urlFor('newQuoteReply', ['pid' => $tid, 'qid' => $qid]).'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
}
}
// If a forum ID was specified in the url (new topic)
elseif ($fid) {
$action = __('Post new topic');
$form = '<form id="post" method="post" action="'.Url::get('post/new-topic/'.$fid.'/').'" onsubmit="return process_form(this)">';
$form = '<form id="post" method="post" action="'.$this->feather->urlFor('newTopic', ['fid' => $fid]).'" onsubmit="return process_form(this)">';
} else {
throw new Error(__('Bad request'), 404);
}
Expand Down
6 changes: 3 additions & 3 deletions featherbb/Controller/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ public function display($id, $section = null)
throw new Error(__('Bad request'), 404);
}

$avatar_field = '<span><a href="'.Url::get('user/'.$id.'/action/upload_avatar/').'">'.__('Change avatar').'</a></span>';
$avatar_field = '<span><a href="'.$this->feather->urlFor('profileAction', ['id' => $id, 'action' => 'upload_avatar']).'">'.__('Change avatar').'</a></span>';

$user_avatar = Utils::generate_avatar_markup($id);
if ($user_avatar) {
$avatar_field .= ' <span><a href="'.Url::get('user/'.$id.'/action/delete_avatar/').'">'.__('Delete avatar').'</a></span>';
$avatar_field .= ' <span><a href="'.$this->feather->urlFor('profileAction', ['id' => $id, 'action' => 'delete_avatar']).'">'.__('Delete avatar').'</a></span>';
} else {
$avatar_field = '<span><a href="'.Url::get('user/'.$id.'/action/upload_avatar/').'">'.__('Upload avatar').'</a></span>';
$avatar_field = '<span><a href="'.$this->feather->urlFor('profileAction', ['id' => $id, 'action' => 'upload_avatar']).'">'.__('Upload avatar').'</a></span>';
}

if ($user['signature'] != '') {
Expand Down
6 changes: 3 additions & 3 deletions featherbb/Controller/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ public function display()

public function cancel()
{
$this->feather->redirect($this->feather->urlFor('home'));
Url::redirect($this->feather->urlFor('home'));
}

public function rules()
{
// If we are logged in, we shouldn't be here
if (!$this->user->is_guest) {
$this->feather->redirect($this->feather->urlFor('home'));
Url::redirect($this->feather->urlFor('home'));
}

// Display an error message if new registrations are disabled
Expand All @@ -97,7 +97,7 @@ public function rules()
}

if ($this->config['o_rules'] != '1') {
$this->feather->redirect($this->feather->urlFor('register'));
Url::redirect($this->feather->urlFor('register'));
}

$this->feather->template->setPageInfo(array(
Expand Down
6 changes: 3 additions & 3 deletions featherbb/Controller/Topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ public function display($id = null, $name = null, $page = null, $pid = null)
'promptQuote' => __('promptQuote')
);

$this->feather->template->addAsset('canonical', Url::get('forum/'.$id.'/'.$url_forum.'/'));
$this->feather->template->addAsset('canonical', $this->feather->urlFor('Forum', ['id' => $id, 'name' => $url_forum]));
if ($num_pages > 1) {
if ($p > 1) {
$this->feather->template->addAsset('prev', Url::get('forum/'.$id.'/'.$url_forum.'/page/'.($p - 1).'/'));
$this->feather->template->addAsset('prev', $this->feather->urlFor('ForumPaginate', ['id' => $id, 'name' => $url_forum, 'page' => intval($p-1)]));
}
if ($p < $num_pages) {
$this->feather->template->addAsset('next', Url::get('forum/'.$id.'/'.$url_forum.'/page/'.($p + 1).'/'));
$this->feather->template->addAsset('next', $this->feather->urlFor('ForumPaginate', ['id' => $id, 'name' => $url_forum, 'page' => intval($p+1)]));
}
}

Expand Down
2 changes: 1 addition & 1 deletion featherbb/Core/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ private function _parse_bbcode_callback($matches)
$attribute .= ' '.__('wrote'); // Append language-specific "wrote:".
if ($this->pd['config']['quote_links'])
{
$attribute = ' <a href="'. $this->feather->url->get('post/'.$m[1].'/#p'.$m[1]) .'">'. $attribute .'</a>';
$attribute = ' <a href="'. $this->feather->urlFor('viewPost', ['pid' => $m[1]]).'#p'.$m[1] .'">'. $attribute .'</a>';
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion featherbb/Model/Admin/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function delete_category($cat_to_delete)

foreach ($forums_in_cat as $forum) {
// Prune all posts and topics
$this->maintenance = new \FeatherBB\Model\Admin\maintenance();
$this->maintenance = new \FeatherBB\Model\Admin\Maintenance();
$this->maintenance->prune($forum->id, 1, -1);

// Delete forum
Expand Down
5 changes: 1 addition & 4 deletions featherbb/Model/Admin/Forums.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,10 @@ public function update_forum($forum_id, array $forum_data)

public function delete_forum($forum_id)
{
// Load the maintenance.php model file for prune public function
require $this->feather->forum_env['FEATHER_ROOT'] . 'model/admin/maintenance.php';

$forum_id = $this->hook->fire('delete_forum_start', $forum_id);

// Prune all posts and topics
$this->maintenance = new \FeatherBB\Model\Admin\maintenance();
$this->maintenance = new \FeatherBB\Model\Admin\Maintenance();
$this->maintenance->prune($forum_id, 1, -1);

// Delete the forum
Expand Down
2 changes: 1 addition & 1 deletion featherbb/Model/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function handle_deletion($is_topic_post, $id, $tid, $fid)

$post = $post->find_one();

Url::redirect(Url::get('post/'.$post['id'].'/#p'.$post['id']), __('Post del redirect'));
Url::redirect($this->feather->urlFor('viewPost', ['pid' => $post['id']]).'#p'.$post['id'], __('Post del redirect'));
}
}

Expand Down
Loading