Skip to content

Commit e83d76b

Browse files
committed
More urlFor in view
1 parent f42f622 commit e83d76b

33 files changed

+134
-122
lines changed

featherbb/Controller/Admin/Plugins.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,27 @@ public function index()
4949
)->addTemplate('admin/plugins.php')->display();
5050
}
5151

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

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

65-
$plugin = new $class;
65+
$plugin = new $pluginName;
6666
try {
67-
$plugin->activate($class);
67+
$plugin->activate($pluginName);
6868
} catch (\Exception $e) {
6969
Url::redirect($this->feather->urlFor('adminPlugins'), $e->getMessage());
7070
}
7171
// Plugin has been activated, confirm and redirect
72-
Url::redirect($this->feather->urlFor('adminPlugins'), 'Plugin "'.$class::$name.'" activated!');
72+
Url::redirect($this->feather->urlFor('adminPlugins'), 'Plugin "'.$pluginName::$name.'" activated!');
7373
}
7474

7575
public function deactivate()

featherbb/routes.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@
117117

118118
// Moderate routes
119119
$feather->group('/moderate', $isAdmmod, $canReadBoard, function() use ($feather) {
120-
$feather->get('/forum/:id(/:name)(/page/:page)(/)', '\FeatherBB\Controller\Moderate:display')->conditions(array('id' => '[0-9]+', 'page' => '[0-9]+'))->name('moderateForum');
120+
$feather->get('/forum/:id(/)', '\FeatherBB\Controller\Moderate:display')->conditions(array('id' => '[0-9]+', 'page' => '[0-9]+'))->name('moderateForum');
121+
$feather->get('/forum/:id(/page/:page)(/)', '\FeatherBB\Controller\Moderate:display')->conditions(array('id' => '[0-9]+', 'page' => '[0-9]+'))->name('moderateForumPage');
121122
$feather->get('/get-host/post/:pid(/)', '\FeatherBB\Controller\Moderate:gethostpost')->conditions(array('pid' => '[0-9]+'))->name('getHostPost');
122123
$feather->get('/get-host/ip/:ip(/)', '\FeatherBB\Controller\Moderate:gethostip')->name('getHostIp');
123124
$feather->map('/topic/:id/forum/:fid/action/:action(/param/:param)(/)', '\FeatherBB\Controller\Moderate:moderatetopic')->conditions(array('id' => '[0-9]+', 'fid' => '[0-9]+', 'param' => '[0-9]+'))->via('GET', 'POST')->name('moderateTopic');
124-
$feather->map('/topic/:id/forum/:fid/action/:action(/page/:param)(/)', '\FeatherBB\Controller\Moderate:moderatetopic')->conditions(array('id' => '[0-9]+', 'fid' => '[0-9]+', 'param' => '[0-9]+'))->via('GET', 'POST')->name('moderateTopicPage');
125+
$feather->map('/topic/:id/forum/:fid/action/:action(/page/:page)(/)', '\FeatherBB\Controller\Moderate:moderatetopic')->conditions(array('id' => '[0-9]+', 'fid' => '[0-9]+', 'page' => '[0-9]+'))->via('GET', 'POST')->name('moderateTopicPage');
125126
$feather->post('/forum/:fid(/page/:page)(/)', '\FeatherBB\Controller\Moderate:dealposts')->conditions(array('fid' => '[0-9]+', 'page' => '[0-9]+'))->name('dealPosts');
126127
});
127128

@@ -192,8 +193,9 @@
192193
// Admin plugins
193194
$feather->group('/plugins', function() use ($feather) {
194195
$feather->map('/(/)', '\FeatherBB\Controller\Admin\Plugins:index')->via('GET', 'POST')->name('adminPlugins');
195-
$feather->map('/activate(/)', '\FeatherBB\Controller\Admin\Plugins:activate')->via('GET')->name('activatePlugin');
196-
$feather->map('/deactivate(/)', '\FeatherBB\Controller\Admin\Plugins:deactivate')->via('GET')->name('deactivatePlugin');
196+
$feather->map('/:name(/)', '\FeatherBB\Controller\Admin\Plugins:index')->via('GET', 'POST')->name('infoPlugin');
197+
$feather->map('/activate/:name(/)', '\FeatherBB\Controller\Admin\Plugins:activate')->via('GET')->name('activatePlugin');
198+
$feather->map('/deactivate/:name(/)', '\FeatherBB\Controller\Admin\Plugins:deactivate')->via('GET')->name('deactivatePlugin');
197199
// $feather->map('/loader(/)', '\FeatherBB\Controller\Admin\Plugins:display')->via('GET', 'POST');
198200
});
199201

style/themes/FeatherBB/view/admin/menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<?php
104104

105105
foreach ($plugins as $plugin_name => $plugin) {
106-
echo "\t\t\t\t\t".'<li'.(($page == $plugin_name) ? ' class="isactive"' : '').'><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"x x-first">Url::get('admin/loader/?plugin='.$plugin_name).'">'.str_replace('_', ' ', $plugin).'</a></li>'."\n";
106+
echo "\t\t\t\t\t".'<li'.(($page == $plugin_name) ? ' class="isactive"' : '').'><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"pl-s1">$feather->urlFor('infoPlugin', ['name' => $plugin_name]).'">'.str_replace('_', ' ', $plugin).'</a></li>'."\n";
107107
}
108108

109109
?>

style/themes/FeatherBB/view/admin/options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@
416416
<label class="conl"><input type="radio" name="form_censoring" value="0"<?php if ($feather->forum_settings['o_censoring'] == '0') {
417417
echo ' checked="checked"';
418418
} ?> />&#160;<strong><?php _e('No') ?></strong></label>
419-
<span class="clearb"><?php printf(__('Censor words help'), '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"x x-first">Url::get('admin/censoring/').'">'.__('Censoring').'</a>') ?></span>
419+
<span class="clearb"><?php printf(__('Censor words help'), '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"pl-s1">$feather->urlFor('adminCensoring').'">'.__('Censoring').'</a>') ?></span>
420420
</td>
421421
</tr>
422422
<tr>

style/themes/FeatherBB/view/admin/plugins.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
<strong><?= $class::$name; ?></strong>
4949
<div class="plugin-actions">
5050
<?php if (array_key_exists($class, $activePlugins)) { ?>
51-
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?= Url::get('/admin/plugins/deactivate?plugin='.$class) ?>">Deactivate</a>
51+
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?= $feather->urlFor('deactivatePlugin', ['name' => $class]) ?>">Deactivate</a>
5252
<?php } else { ?>
53-
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?= Url::get('/admin/plugins/activate?plugin='.$class) ?>">Activate</a>
53+
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?= $feather->urlFor('activatePlugin', ['name' => $class]) ?>">Activate</a>
5454
<?php } ?>
5555
</div>
5656
</td>

style/themes/FeatherBB/view/admin/reports.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use FeatherBB\Core\Url;
1111
use FeatherBB\Core\Utils;
12+
use FeatherBB\Core\AdminUtils;
1213

1314
// Make sure no one attempts to run this script "directly"
1415
if (!defined('FEATHER')) {
@@ -31,10 +32,14 @@
3132
<div class="infldset">
3233
<table class="aligntop">
3334
<tr>
34-
<th scope="row"><?php printf(__('Reported by'), ($report['reporter'] != '') ? '<a href="'.Url::get('users/'.$report['reported_by'].'/').'">'.Utils::escape($report['reporter']).'</a>' : __('Deleted user')) ?></th>
35-
<td class="location"><?= \FeatherBB\Core\AdminUtils::breadcrumbs_admin(array($report['forum_name'] => Url::get('forum/'.$report['forum_id'].'/'.$feather->url->url_friendly($report['forum_name']).'/'),
36-
$report['subject'] => Url::get('forum/'.$report['topic_id'].'/'.$feather->url->url_friendly($report['subject'])),
37-
sprintf(__('Post ID'), $report['pid']) => $feather->urlFor('viewPost', ['pid' => $report['pid']]).'#p'.$report['pid'])) ?></td>
35+
<th scope="row"><?php printf(__('Reported by'), ($report['reporter'] != '') ? '<a href="'.$feather->urlFor('userProfile', ['id' => $report['reported_by']]).'">'.Utils::escape($report['reporter']).'</a>' : __('Deleted user')) ?></th>
36+
<td class="location">
37+
<?= AdminUtils::breadcrumbs_admin(array(
38+
$report['forum_name'] => $feather->urlFor('Forum', ['id' => $report['forum_id'], 'name' => Url::url_friendly($report['forum_name'])]),
39+
$report['subject'] => $feather->urlFor('Forum', ['id' => $report['topic_id'], 'name' => Url::url_friendly($report['subject'])]),
40+
sprintf(__('Post ID'), $report['pid']) => $feather->urlFor('viewPost', ['pid' => $report['pid']]).'#p'.$report['pid']
41+
)); ?>
42+
</td>
3843
</tr>
3944
<tr>
4045
<th scope="row"><?php _e('Reason') ?><div><input type="submit" name="zap_id[<?= $report['id'] ?>]" value="<?php _e('Zap') ?>" /></div></th>
@@ -77,14 +82,18 @@
7782
?>
7883
<div class="inform">
7984
<fieldset>
80-
<legend><?php printf(__('Zapped subhead'), $feather->utils->format_time($report['zapped']), ($report['zapped_by'] != '') ? '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"x x-first">Url::get('user/'.$report['zapped_by_id'].'/').'">'.Utils::escape($report['zapped_by']).'</a>' : __('NA')) ?></legend>
85+
<legend><?php printf(__('Zapped subhead'), $feather->utils->format_time($report['zapped']), ($report['zapped_by'] != '') ? '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"pl-s1">$feather->urlFor('userProfile', ['id' => $report['zapped_by_id']]).'">'.Utils::escape($report['zapped_by']).'</a>' : __('NA')) ?></legend>
8186
<div class="infldset">
8287
<table class="aligntop">
8388
<tr>
84-
<th scope="row"><?php printf(__('Reported by'), ($report['reporter'] != '') ? '<a href="'.Url::get('users/'.$report['reported_by'].'/').'">'.Utils::escape($report['reporter']).'</a>' : __('Deleted user')) ?></th>
85-
<td class="location"><?= \FeatherBB\Core\AdminUtils::breadcrumbs_admin(array($report['forum_name'] => Url::get('forum/'.$report['forum_id'].'/'.$feather->url->url_friendly($report['forum_name']).'/'),
86-
$report['subject'] => Url::get('forum/'.$report['topic_id'].'/'.$feather->url->url_friendly($report['subject'])),
87-
sprintf(__('Post ID'), $report['pid']) => $feather->urlFor('viewPost', ['pid' => $report['pid']]).'#p'.$report['pid'])) ?></td>
89+
<th scope="row"><?php printf(__('Reported by'), ($report['reporter'] != '') ? '<a href="'.$feather->urlFor('userProfile', ['id' => $report['reported_by']]).'">'.Utils::escape($report['reporter']).'</a>' : __('Deleted user')) ?></th>
90+
<td class="location">
91+
<?= AdminUtils::breadcrumbs_admin(array(
92+
$report['forum_name'] => $feather->urlFor('Forum', ['id' => $report['forum_id'], 'name' => Url::url_friendly($report['forum_name'])]),
93+
$report['subject'] => $feather->urlFor('Forum', ['id' => $report['topic_id'], 'name' => Url::url_friendly($report['subject'])]),
94+
sprintf(__('Post ID'), $report['pid']) => $feather->urlFor('viewPost', ['pid' => $report['pid']]).'#p'.$report['pid']
95+
)) ?>
96+
</td>
8897
</tr>
8998
<tr>
9099
<th scope="row"><?php _e('Reason') ?></th>

style/themes/FeatherBB/view/admin/statistics.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<?php if ($feather->user->g_id == FEATHER_ADMIN): ?> <dt><?php _e('Environment label') ?></dt>
2929
<dd>
3030
<?php printf(__('Environment data OS'), PHP_OS) ?><br />
31-
<?php printf(__('Environment data version'), phpversion(), '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"x x-first">Url::get('admin/phpinfo/').'">'.__('Show info').'</a>') ?><br />
31+
<?php printf(__('Environment data version'), phpversion(), '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"pl-s1">$feather->urlFor('phpinfo').'">'.__('Show info').'</a>') ?><br />
3232
<?php printf(__('Environment data acc')."\n", $php_accelerator) ?>
3333
</dd>
3434
<dt><?php _e('Database label') ?></dt>
@@ -42,4 +42,4 @@
4242
</div>
4343
</div>
4444
<div class="clearer"></div>
45-
</div>
45+
</div>

style/themes/FeatherBB/view/admin/users/ban_users.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<div class="blockform">
1919
<h2><span><?php _e('Ban users') ?></span></h2>
2020
<div class="box">
21-
<form id="bans2" name="confirm_ban_users" method="post" action="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?php echo Url::get('admin/users') ?>">
21+
<form id="bans2" name="confirm_ban_users" method="post" action="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?php echo $feather->urlFor('adminUsers') ?>">
2222
<input type="hidden" name="<?php echo $csrf_key; ?>" value="<?php echo $csrf_token; ?>">
2323
<input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" />
2424
<div class="inform">
@@ -57,4 +57,4 @@
5757
</div>
5858
</div>
5959
<div class="clearer"></div>
60-
</div>
60+
</div>

style/themes/FeatherBB/view/admin/users/delete_users.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<div class="blockform">
1919
<h2><span><?php _e('Delete users') ?></span></h2>
2020
<div class="box">
21-
<form name="confirm_del_users" method="post" action="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?php echo Url::get('admin/users') ?>">
21+
<form name="confirm_del_users" method="post" action="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?php echo $feather->urlFor('adminUsers') ?>">
2222
<input type="hidden" name="<?php echo $csrf_key; ?>" value="<?php echo $csrf_token; ?>">
2323
<input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" />
2424
<div class="inform">
@@ -38,4 +38,4 @@
3838
</div>
3939
</div>
4040
<div class="clearer"></div>
41-
</div>
41+
</div>

style/themes/FeatherBB/view/admin/users/find_users.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div class="linkst">
2020
<div class="inbox crumbsplus">
2121
<ul class="crumbs">
22-
<li><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?php echo Url::get('admin/index/') ?>"><?php _e('Admin').' '.__('Index') ?></a></li>
22+
<li><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?php echo $feather->urlFor('adminIndex') ?>"><?php _e('Admin').' '.__('Index') ?></a></li>
2323
<li><span>»&#160;</span><a href="<?php echo $feather->urlFor('adminUsers') ?>"><?php _e('Users') ?></a></li>
2424
<li><span>»&#160;</span><strong><?php _e('Results head') ?></strong></li>
2525
</ul>
@@ -57,12 +57,12 @@
5757
foreach ($user_data as $user) {
5858
?>
5959
<tr>
60-
<td class="tcl"><?php echo '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"x x-first">Url::get('user/'.$user['id'].'/').'">'.Utils::escape($user['username']).'</a>' ?></td>
60+
<td class="tcl"><?php echo '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"pl-s1">$feather->urlFor('userProfile', ['id' => $user['id']]).'">'.Utils::escape($user['username']).'</a>' ?></td>
6161
<td class="tc2"><a href="mailto:<?php echo Utils::escape($user['email']) ?>"><?php echo Utils::escape($user['email']) ?></a></td>
6262
<td class="tc3"><?php echo $user['user_title'] ?></td>
6363
<td class="tc4"><?php echo Utils::forum_number_format($user['num_posts']) ?></td>
6464
<td class="tc5"><?php echo($user['admin_note'] != '') ? Utils::escape($user['admin_note']) : '&#160;' ?></td>
65-
<td class="tcr"><?php echo '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"x x-first">Url::get('admin/users/ip-stats/id/'.$user['id'].'/').'">'.__('Results view IP link').'</a> | <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"x x-first">Url::get('search/?action=show_user_posts&amp;user_id='.$user['id']).'">'.__('Results show posts link').'</a>' ?></td>
65+
<td class="tcr"><?php echo '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"pl-s1">$feather->urlFor('usersIpStats', ['id' => $user['id']]).'">'.__('Results view IP link').'</a> | <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.%3Cspan+class%3D"pl-s1">$feather->urlFor('search').'?action=show_user_posts&amp;user_id='.$user['id'].'">'.__('Results show posts link').'</a>' ?></td>
6666
<?php if ($can_action): ?> <td class="tcmod"><input type="checkbox" name="users[<?php echo $user['id'] ?>]" value="1" /></td>
6767
<?php endif;
6868
?>
@@ -93,7 +93,7 @@
9393
?>
9494
</div>
9595
<ul class="crumbs">
96-
<li><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?php echo Url::get('admin/index/') ?>"><?php _e('Admin').' '.__('Index') ?></a></li>
96+
<li><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-ent"><?php echo $feather->urlFor('adminIndex') ?>"><?php _e('Admin').' '.__('Index') ?></a></li>
9797
<li><span>»&#160;</span><a href="<?php echo $feather->urlFor('adminUsers') ?>"><?php _e('Users') ?></a></li>
9898
<li><span>»&#160;</span><strong><?php _e('Results head') ?></strong></li>
9999
</ul>

0 commit comments

Comments
 (0)