Skip to content
Prev Previous commit
Next Next commit
More urlFor()
  • Loading branch information
beaver-dev committed Sep 6, 2015
commit 013f9b139c8d512a8096f1ff9b3eae195f71d194
2 changes: 1 addition & 1 deletion cache/85f15bc57d6c4e8a3a00b5f5c72a639f5f734f32.cache

Large diffs are not rendered by default.

53 changes: 3 additions & 50 deletions cache/cache_parser_data.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // File: cache_parser_data.php. Automatically generated: 2015-09-06 07:19:39. DO NOT EDIT!!!
<?php // File: cache_parser_data.php. Automatically generated: 2015-09-06 08:04:01. DO NOT EDIT!!!
$pd = array (
'newer_php_version' => true,
'in_signature' => false,
Expand Down Expand Up @@ -73,7 +73,7 @@
're_bbcode' => '% # re_bbcode Rev:20110220_1200
# First, match opening tag of syntax: "[TAGNAME (= ("\')ATTRIBUTE("\') )]";
\\[ # Match opening bracket of outermost opening TAGNAME tag.
(?>(b|code|color|colour|del|email|em|h|img|ins|i|table|tr|th|td|list|\\*|quote|sub|sup|s|tt|url|u|center|right|left|justify|youtube|large|small|err|dbug)\\s*+) # $1:
(?>(b|code|color|colour|del|email|em|h|img|ins|i|table|tr|th|td|list|\\*|quote|sub|sup|s|tt|url|u|center|right|left|justify|youtube|large|small|err)\\s*+) # $1:
(?> # Atomically group remainder of opening tag.
(?: # Optional attribute.
(=)\\s*+ # $2: = Optional attribute\'s equals sign delimiter, ws.
Expand Down Expand Up @@ -112,7 +112,7 @@
're_bbtag' => '%# re_bbtag Rev:20110220_1200
# Match open or close BBtag.
\\[/?+ # Match opening bracket of outermost opening TAGNAME tag.
(?>(b|code|color|colour|del|email|em|h|img|ins|i|table|tr|th|td|list|\\*|quote|sub|sup|s|tt|url|u|center|right|left|justify|youtube|large|small|err|dbug)\\s*+) #$1:
(?>(b|code|color|colour|del|email|em|h|img|ins|i|table|tr|th|td|list|\\*|quote|sub|sup|s|tt|url|u|center|right|left|justify|youtube|large|small|err)\\s*+) #$1:
(?: # Optional attribute.
(=)\\s*+ # $2: = Optional attribute\'s equals sign delimiter, ws.
(?: # Group for 1-line attribute value alternatives.
Expand Down Expand Up @@ -284,7 +284,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'code' =>
Expand Down Expand Up @@ -343,7 +342,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'colour' =>
Expand Down Expand Up @@ -374,7 +372,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'del' =>
Expand Down Expand Up @@ -405,7 +402,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'email' =>
Expand Down Expand Up @@ -444,7 +440,6 @@
'*' => true,
'quote' => true,
'url' => true,
'dbug' => true,
),
),
'em' =>
Expand Down Expand Up @@ -475,7 +470,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'h' =>
Expand Down Expand Up @@ -506,7 +500,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'img' =>
Expand Down Expand Up @@ -566,7 +559,6 @@
'large' => true,
'small' => true,
'err' => true,
'dbug' => true,
),
),
'ins' =>
Expand Down Expand Up @@ -597,7 +589,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'i' =>
Expand Down Expand Up @@ -628,7 +619,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'table' =>
Expand Down Expand Up @@ -681,7 +671,6 @@
'youtube' => true,
'large' => true,
'small' => true,
'dbug' => true,
),
'tags_only' => true,
),
Expand Down Expand Up @@ -738,7 +727,6 @@
'youtube' => true,
'large' => true,
'small' => true,
'dbug' => true,
),
'tags_only' => true,
),
Expand Down Expand Up @@ -862,7 +850,6 @@
'large' => true,
'small' => true,
'err' => true,
'dbug' => true,
),
'tags_only' => true,
),
Expand Down Expand Up @@ -948,7 +935,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'sup' =>
Expand Down Expand Up @@ -979,7 +965,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
's' =>
Expand Down Expand Up @@ -1010,7 +995,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'tt' =>
Expand Down Expand Up @@ -1071,7 +1055,6 @@
'*' => true,
'quote' => true,
'url' => true,
'dbug' => true,
),
),
'u' =>
Expand Down Expand Up @@ -1102,7 +1085,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'center' =>
Expand Down Expand Up @@ -1133,7 +1115,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'right' =>
Expand Down Expand Up @@ -1164,7 +1145,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'left' =>
Expand Down Expand Up @@ -1195,7 +1175,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'justify' =>
Expand Down Expand Up @@ -1226,7 +1205,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'youtube' =>
Expand Down Expand Up @@ -1289,7 +1267,6 @@
'large' => true,
'small' => true,
'err' => true,
'dbug' => true,
),
'x_padding' => 20,
'y_padding' => 45,
Expand Down Expand Up @@ -1322,7 +1299,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'small' =>
Expand Down Expand Up @@ -1353,7 +1329,6 @@
'list' => true,
'*' => true,
'quote' => true,
'dbug' => true,
),
),
'err' =>
Expand Down Expand Up @@ -1384,28 +1359,6 @@
array (
),
),
'dbug' =>
array (
'depth' => 0,
'depth_max' => 5,
'handlers' =>
array (
'ATTRIB' =>
array (
'a_type' => 'text',
'c_type' => 'text',
'format' => '</p><p class="debug" title="%a_str%">%c_str%</p><p>',
),
),
'html_type' => 'block',
'in_post' => true,
'in_sig' => true,
'nest_type' => 'err',
'tag_type' => 'normal',
'tags_excluded' =>
array (
),
),
'_ROOT_' =>
array (
'depth' => 0,
Expand Down
6 changes: 3 additions & 3 deletions featherbb/Controller/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function login()
Url::redirect($this->feather->urlFor('home'), __('Login redirect'));
}
}
throw new \FeatherBB\Core\Error(__('Wrong user/pass').' <a href="'.Url::get('login/action/forget/').'">'.__('Forgotten pass').'</a>', 403);
throw new \FeatherBB\Core\Error(__('Wrong user/pass').' <a href="'.$this->feather->urlFor('resetPassword').'">'.__('Forgotten pass').'</a>', 403);
} else {
$this->feather->template->setPageInfo(array(
'active_page' => 'login',
Expand All @@ -72,7 +72,7 @@ public function logout($token)
{
$token = $this->feather->hooks->fire('logout_start', $token);

if ($this->feather->user->is_guest || !isset($token) || $token != \FeatherBB\Utils::feather_hash($this->feather->user->id.\FeatherBB\Utils::feather_hash($this->feather->request->getIp()))) {
if ($this->feather->user->is_guest || !isset($token) || $token != Utils::hash($this->feather->user->id.Utils::hash($this->feather->request->getIp()))) {
Url::redirect($this->feather->urlFor('home'), 'Not logged in');
}

Expand Down Expand Up @@ -131,7 +131,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
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, 'page' => $p]));
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('Forum', ['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('Forum', ['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
6 changes: 3 additions & 3 deletions featherbb/Controller/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,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 \FeatherBB\Core\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 \FeatherBB\Core\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 = 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
Loading