3 * StatusNet, the distributed open-source microblogging tool
5 * Base class for all actions (~views)
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Evan Prodromou <evan@status.net>
25 * @author Sarven Capadisli <csarven@status.net>
26 * @copyright 2008 StatusNet, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://status.net/
31 if (!defined('STATUSNET') && !defined('LACONICA')) {
35 require_once INSTALLDIR.'/lib/noticeform.php';
36 require_once INSTALLDIR.'/lib/htmloutputter.php';
39 * Base class for all actions
41 * This is the base class for all actions in the package. An action is
42 * more or less a "view" in an MVC framework.
44 * Actions are responsible for extracting and validating parameters; using
45 * model classes to read and write to the database; and doing ouput.
49 * @author Evan Prodromou <evan@status.net>
50 * @author Sarven Capadisli <csarven@status.net>
51 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
52 * @link http://status.net/
56 class Action extends HTMLOutputter // lawsuit
63 * Just wraps the HTMLOutputter constructor.
65 * @param string $output URI to output to, default = stdout
66 * @param boolean $indent Whether to indent output, default true
68 * @see XMLOutputter::__construct
69 * @see HTMLOutputter::__construct
71 function __construct($output='php://output', $indent=null)
73 parent::__construct($output, $indent);
77 * For initializing members of the class.
79 * @param array $argarray misc. arguments
81 * @return boolean true
83 function prepare($argarray)
85 $this->args =& common_copy_args($argarray);
90 * Show page, a template method.
96 if (Event::handle('StartShowHTML', array($this))) {
98 Event::handle('EndShowHTML', array($this));
100 if (Event::handle('StartShowHead', array($this))) {
102 Event::handle('EndShowHead', array($this));
104 if (Event::handle('StartShowBody', array($this))) {
106 Event::handle('EndShowBody', array($this));
108 if (Event::handle('StartEndHTML', array($this))) {
110 Event::handle('EndEndHTML', array($this));
115 * Show head, a template method.
121 // XXX: attributes (profile?)
122 $this->elementStart('head');
123 if (Event::handle('StartShowHeadElements', array($this))) {
125 $this->showShortcutIcon();
126 $this->showStylesheets();
127 $this->showOpenSearch();
129 $this->showDescription();
131 Event::handle('EndShowHeadElements', array($this));
133 $this->elementEnd('head');
137 * Show title, a template method.
143 $this->element('title', null,
144 sprintf(_("%s - %s"),
146 common_config('site', 'name')));
150 * Returns the page title
154 * @return string page title
159 return _("Untitled page");
163 * Show themed shortcut icon
167 function showShortcutIcon()
169 if (is_readable(INSTALLDIR . '/theme/' . common_config('site', 'theme') . '/favicon.ico')) {
170 $this->element('link', array('rel' => 'shortcut icon',
171 'href' => Theme::path('favicon.ico')));
173 $this->element('link', array('rel' => 'shortcut icon',
174 'href' => common_path('favicon.ico')));
177 if (common_config('site', 'mobile')) {
178 if (is_readable(INSTALLDIR . '/theme/' . common_config('site', 'theme') . '/apple-touch-icon.png')) {
179 $this->element('link', array('rel' => 'apple-touch-icon',
180 'href' => Theme::path('apple-touch-icon.png')));
182 $this->element('link', array('rel' => 'apple-touch-icon',
183 'href' => common_path('apple-touch-icon.png')));
193 function showStylesheets()
195 if (Event::handle('StartShowStyles', array($this))) {
197 // Use old name for StatusNet for compatibility on events
199 if (Event::handle('StartShowStatusNetStyles', array($this)) &&
200 Event::handle('StartShowLaconicaStyles', array($this))) {
201 $this->cssLink('css/display.css',null,'screen, projection, tv');
202 if (common_config('site', 'mobile')) {
203 // TODO: "handheld" CSS for other mobile devices
204 $this->cssLink('css/mobile.css','base','only screen and (max-device-width: 480px)'); // Mobile WebKit
206 $this->cssLink('css/print.css','base','print');
207 Event::handle('EndShowStatusNetStyles', array($this));
208 Event::handle('EndShowLaconicaStyles', array($this));
211 if (Event::handle('StartShowUAStyles', array($this))) {
212 $this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
213 'href="'.Theme::path('css/ie.css', 'base').'?version='.STATUSNET_VERSION.'" /><![endif]');
214 foreach (array(6,7) as $ver) {
215 if (file_exists(Theme::file('css/ie'.$ver.'.css', 'base'))) {
216 // Yes, IE people should be put in jail.
217 $this->comment('[if lte IE '.$ver.']><link rel="stylesheet" type="text/css" '.
218 'href="'.Theme::path('css/ie'.$ver.'.css', 'base').'?version='.STATUSNET_VERSION.'" /><![endif]');
221 $this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
222 'href="'.Theme::path('css/ie.css', null).'?version='.STATUSNET_VERSION.'" /><![endif]');
223 Event::handle('EndShowUAStyles', array($this));
226 if (Event::handle('StartShowDesign', array($this))) {
228 $user = common_current_user();
230 if (empty($user) || $user->viewdesigns) {
231 $design = $this->getDesign();
233 if (!empty($design)) {
234 $design->showCSS($this);
238 Event::handle('EndShowDesign', array($this));
240 Event::handle('EndShowStyles', array($this));
245 * Show javascript headers
249 function showScripts()
251 if (Event::handle('StartShowScripts', array($this))) {
252 if (Event::handle('StartShowJQueryScripts', array($this))) {
253 $this->script('js/jquery.min.js');
254 $this->script('js/jquery.form.js');
255 $this->script('js/jquery.cookie.js');
256 $this->script('js/jquery.joverlay.min.js');
257 Event::handle('EndShowJQueryScripts', array($this));
259 if (Event::handle('StartShowStatusNetScripts', array($this)) &&
260 Event::handle('StartShowLaconicaScripts', array($this))) {
261 $this->script('js/xbImportNode.js');
262 $this->script('js/util.js');
263 $this->script('js/geometa.js');
264 // Frame-busting code to avoid clickjacking attacks.
265 $this->element('script', array('type' => 'text/javascript'),
266 'if (window.top !== window.self) { window.top.location.href = window.self.location.href; }');
267 Event::handle('EndShowStatusNetScripts', array($this));
268 Event::handle('EndShowLaconicaScripts', array($this));
270 Event::handle('EndShowScripts', array($this));
275 * Show OpenSearch headers
279 function showOpenSearch()
281 $this->element('link', array('rel' => 'search',
282 'type' => 'application/opensearchdescription+xml',
283 'href' => common_local_url('opensearch', array('type' => 'people')),
284 'title' => common_config('site', 'name').' People Search'));
285 $this->element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml',
286 'href' => common_local_url('opensearch', array('type' => 'notice')),
287 'title' => common_config('site', 'name').' Notice Search'));
300 $feeds = $this->getFeeds();
303 foreach ($feeds as $feed) {
304 $this->element('link', array('rel' => $feed->rel(),
305 'href' => $feed->url,
306 'type' => $feed->mimeType(),
307 'title' => $feed->title));
319 function showDescription()
321 // does nothing by default
325 * Show extra stuff in <head>.
333 // does nothing by default
339 * Calls template methods
345 $this->elementStart('body', (common_current_user()) ? array('id' => $this->trimmed('action'),
346 'class' => 'user_in')
347 : array('id' => $this->trimmed('action')));
348 $this->elementStart('div', array('id' => 'wrap'));
349 if (Event::handle('StartShowHeader', array($this))) {
351 Event::handle('EndShowHeader', array($this));
354 if (Event::handle('StartShowFooter', array($this))) {
356 Event::handle('EndShowFooter', array($this));
358 $this->elementEnd('div');
359 $this->showScripts();
360 $this->elementEnd('body');
364 * Show header of the page.
366 * Calls template methods
370 function showHeader()
372 $this->elementStart('div', array('id' => 'header'));
374 $this->showPrimaryNav();
375 $this->showSiteNotice();
376 if (common_logged_in()) {
377 $this->showNoticeForm();
379 $this->showAnonymousMessage();
381 $this->elementEnd('div');
385 * Show configured logo.
391 $this->elementStart('address', array('id' => 'site_contact',
392 'class' => 'vcard'));
393 if (Event::handle('StartAddressData', array($this))) {
394 $this->elementStart('a', array('class' => 'url home bookmark',
395 'href' => common_local_url('public')));
396 if (common_config('site', 'logo') || file_exists(Theme::file('logo.png'))) {
397 $this->element('img', array('class' => 'logo photo',
398 'src' => (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png'),
399 'alt' => common_config('site', 'name')));
401 $this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
402 $this->elementEnd('a');
403 Event::handle('EndAddressData', array($this));
405 $this->elementEnd('address');
409 * Show primary navigation.
413 function showPrimaryNav()
415 $user = common_current_user();
417 if (common_config('xmpp', 'enabled')) {
418 $connect = 'imsettings';
419 } else if (common_config('sms', 'enabled')) {
420 $connect = 'smssettings';
421 } else if (common_config('twitter', 'enabled')) {
422 $connect = 'twittersettings';
425 $this->elementStart('dl', array('id' => 'site_nav_global_primary'));
426 $this->element('dt', null, _('Primary site navigation'));
427 $this->elementStart('dd');
428 $this->elementStart('ul', array('class' => 'nav'));
429 if (Event::handle('StartPrimaryNav', array($this))) {
431 $this->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
432 _('Home'), _('Personal profile and friends timeline'), false, 'nav_home');
433 $this->menuItem(common_local_url('profilesettings'),
434 _('Account'), _('Change your email, avatar, password, profile'), false, 'nav_account');
436 $this->menuItem(common_local_url($connect),
437 _('Connect'), _('Connect to services'), false, 'nav_connect');
439 if ($user->hasRight(Right::CONFIGURESITE)) {
440 $this->menuItem(common_local_url('siteadminpanel'),
441 _('Admin'), _('Change site configuration'), false, 'nav_admin');
443 if (common_config('invite', 'enabled')) {
444 $this->menuItem(common_local_url('invite'),
446 sprintf(_('Invite friends and colleagues to join you on %s'),
447 common_config('site', 'name')),
448 false, 'nav_invitecontact');
450 $this->menuItem(common_local_url('logout'),
451 _('Logout'), _('Logout from the site'), false, 'nav_logout');
454 if (!common_config('site', 'closed')) {
455 $this->menuItem(common_local_url('register'),
456 _('Register'), _('Create an account'), false, 'nav_register');
458 $this->menuItem(common_local_url('login'),
459 _('Login'), _('Login to the site'), false, 'nav_login');
461 $this->menuItem(common_local_url('doc', array('title' => 'help')),
462 _('Help'), _('Help me!'), false, 'nav_help');
463 if ($user || !common_config('site', 'private')) {
464 $this->menuItem(common_local_url('peoplesearch'),
465 _('Search'), _('Search for people or text'), false, 'nav_search');
467 Event::handle('EndPrimaryNav', array($this));
469 $this->elementEnd('ul');
470 $this->elementEnd('dd');
471 $this->elementEnd('dl');
479 function showSiteNotice()
481 // Revist. Should probably do an hAtom pattern here
482 $text = common_config('site', 'notice');
484 $this->elementStart('dl', array('id' => 'site_notice',
485 'class' => 'system_notice'));
486 $this->element('dt', null, _('Site notice'));
487 $this->elementStart('dd', null);
489 $this->elementEnd('dd');
490 $this->elementEnd('dl');
497 * MAY overload if no notice form needed... or direct message box????
501 function showNoticeForm()
503 $notice_form = new NoticeForm($this);
504 $notice_form->show();
508 * Show anonymous message.
514 function showAnonymousMessage()
516 // needs to be defined by the class
522 * Shows local navigation, content block and aside.
528 $this->elementStart('div', array('id' => 'core'));
529 if (Event::handle('StartShowLocalNavBlock', array($this))) {
530 $this->showLocalNavBlock();
531 Event::handle('EndShowLocalNavBlock', array($this));
533 if (Event::handle('StartShowContentBlock', array($this))) {
534 $this->showContentBlock();
535 Event::handle('EndShowContentBlock', array($this));
537 if (Event::handle('StartShowAside', array($this))) {
539 Event::handle('EndShowAside', array($this));
541 $this->elementEnd('div');
545 * Show local navigation block.
549 function showLocalNavBlock()
551 $this->elementStart('dl', array('id' => 'site_nav_local_views'));
552 $this->element('dt', null, _('Local views'));
553 $this->elementStart('dd');
554 $this->showLocalNav();
555 $this->elementEnd('dd');
556 $this->elementEnd('dl');
560 * Show local navigation.
566 function showLocalNav()
568 // does nothing by default
572 * Show content block.
576 function showContentBlock()
578 $this->elementStart('div', array('id' => 'content'));
579 $this->showPageTitle();
580 $this->showPageNoticeBlock();
581 $this->elementStart('div', array('id' => 'content_inner'));
582 // show the actual content (forms, lists, whatever)
583 $this->showContent();
584 $this->elementEnd('div');
585 $this->elementEnd('div');
593 function showPageTitle()
595 $this->element('h1', null, $this->title());
599 * Show page notice block.
601 * Only show the block if a subclassed action has overrided
602 * Action::showPageNotice(), or an event handler is registered for
603 * the StartShowPageNotice event, in which case we assume the
604 * 'page_notice' definition list is desired. This is to prevent
605 * empty 'page_notice' definition lists from being output everywhere.
609 function showPageNoticeBlock()
611 $rmethod = new ReflectionMethod($this, 'showPageNotice');
612 $dclass = $rmethod->getDeclaringClass()->getName();
614 if ($dclass != 'Action' || Event::hasHandler('StartShowPageNotice')) {
616 $this->elementStart('dl', array('id' => 'page_notice',
617 'class' => 'system_notice'));
618 $this->element('dt', null, _('Page notice'));
619 $this->elementStart('dd');
620 if (Event::handle('StartShowPageNotice', array($this))) {
621 $this->showPageNotice();
622 Event::handle('EndShowPageNotice', array($this));
624 $this->elementEnd('dd');
625 $this->elementEnd('dl');
632 * SHOULD overload (unless there's not a notice)
636 function showPageNotice()
643 * MUST overload (unless there's not a notice)
647 function showContent()
659 $this->elementStart('div', array('id' => 'aside_primary',
660 'class' => 'aside'));
661 if (Event::handle('StartShowExportData', array($this))) {
662 $this->showExportData();
663 Event::handle('EndShowExportData', array($this));
665 if (Event::handle('StartShowSections', array($this))) {
666 $this->showSections();
667 Event::handle('EndShowSections', array($this));
669 $this->elementEnd('div');
673 * Show export data feeds.
678 function showExportData()
680 $feeds = $this->getFeeds();
682 $fl = new FeedList($this);
694 function showSections()
696 // for each section, show it
704 function showFooter()
706 $this->elementStart('div', array('id' => 'footer'));
707 $this->showSecondaryNav();
708 $this->showLicenses();
709 $this->elementEnd('div');
713 * Show secondary navigation.
717 function showSecondaryNav()
719 $this->elementStart('dl', array('id' => 'site_nav_global_secondary'));
720 $this->element('dt', null, _('Secondary site navigation'));
721 $this->elementStart('dd', null);
722 $this->elementStart('ul', array('class' => 'nav'));
723 if (Event::handle('StartSecondaryNav', array($this))) {
724 $this->menuItem(common_local_url('doc', array('title' => 'help')),
726 $this->menuItem(common_local_url('doc', array('title' => 'about')),
728 $this->menuItem(common_local_url('doc', array('title' => 'faq')),
730 $bb = common_config('site', 'broughtby');
732 $this->menuItem(common_local_url('doc', array('title' => 'tos')),
735 $this->menuItem(common_local_url('doc', array('title' => 'privacy')),
737 $this->menuItem(common_local_url('doc', array('title' => 'source')),
739 $this->menuItem(common_local_url('doc', array('title' => 'contact')),
741 $this->menuItem(common_local_url('doc', array('title' => 'badge')),
743 Event::handle('EndSecondaryNav', array($this));
745 $this->elementEnd('ul');
746 $this->elementEnd('dd');
747 $this->elementEnd('dl');
755 function showLicenses()
757 $this->elementStart('dl', array('id' => 'licenses'));
758 $this->showStatusNetLicense();
759 $this->showContentLicense();
760 $this->elementEnd('dl');
764 * Show StatusNet license.
768 function showStatusNetLicense()
770 $this->element('dt', array('id' => 'site_statusnet_license'), _('StatusNet software license'));
771 $this->elementStart('dd', null);
772 if (common_config('site', 'broughtby')) {
773 $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). ');
775 $instr = _('**%%site.name%%** is a microblogging service. ');
777 $instr .= sprintf(_('It runs the [StatusNet](http://status.net/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), STATUSNET_VERSION);
778 $output = common_markup_to_html($instr);
780 $this->elementEnd('dd');
785 * Show content license.
789 function showContentLicense()
791 $this->element('dt', array('id' => 'site_content_license'), _('Site content license'));
792 $this->elementStart('dd', array('id' => 'site_content_license_cc'));
793 $this->elementStart('p');
794 $this->element('img', array('id' => 'license_cc',
795 'src' => common_config('license', 'image'),
796 'alt' => common_config('license', 'title'),
799 //TODO: This is dirty: i18n
800 $this->text(_('All '.common_config('site', 'name').' content and data are available under the '));
801 $this->element('a', array('class' => 'license',
802 'rel' => 'external license',
803 'href' => common_config('license', 'url')),
804 common_config('license', 'title'));
805 $this->text(_('license.'));
806 $this->elementEnd('p');
807 $this->elementEnd('dd');
811 * Return last modified, if applicable.
815 * @return string last modified http header
817 function lastModified()
819 // For comparison with If-Last-Modified
820 // If not applicable, return null
825 * Return etag, if applicable.
829 * @return string etag http header
837 * Return true if read only.
841 * @param array $args other arguments
843 * @return boolean is read only action?
846 function isReadOnly($args)
852 * Returns query argument or default value if not found
854 * @param string $key requested argument
855 * @param string $def default value to return if $key is not provided
857 * @return boolean is read only action?
859 function arg($key, $def=null)
861 if (array_key_exists($key, $this->args)) {
862 return $this->args[$key];
869 * Returns trimmed query argument or default value if not found
871 * @param string $key requested argument
872 * @param string $def default value to return if $key is not provided
874 * @return boolean is read only action?
876 function trimmed($key, $def=null)
878 $arg = $this->arg($key, $def);
879 return is_string($arg) ? trim($arg) : $arg;
885 * @param array $argarray is ignored since it's now passed in in prepare()
887 * @return boolean is read only action?
889 function handle($argarray=null)
891 header('Vary: Accept-Encoding,Cookie');
892 $lm = $this->lastModified();
893 $etag = $this->etag();
895 header('ETag: ' . $etag);
898 header('Last-Modified: ' . date(DATE_RFC1123, $lm));
899 if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
900 $if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
901 $ims = strtotime($if_modified_since);
903 $if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ?
904 $_SERVER['HTTP_IF_NONE_MATCH'] : null;
905 if (!$if_none_match ||
907 $this->_hasEtag($etag, $if_none_match)) {
908 header('HTTP/1.1 304 Not Modified');
909 // Better way to do this?
918 * HasĀ etag? (private)
920 * @param string $etag etag http header
921 * @param string $if_none_match ifNoneMatch http header
926 function _hasEtag($etag, $if_none_match)
928 $etags = explode(',', $if_none_match);
929 return in_array($etag, $etags) || in_array('*', $etags);
933 * Boolean understands english (yes, no, true, false)
935 * @param string $key query key we're interested in
936 * @param string $def default value
938 * @return boolean interprets yes/no strings as boolean
940 function boolean($key, $def=false)
942 $arg = strtolower($this->trimmed($key));
946 } else if (in_array($arg, array('true', 'yes', '1'))) {
948 } else if (in_array($arg, array('false', 'no', '0'))) {
956 * Integer value of an argument
958 * @param string $key query key we're interested in
959 * @param string $defValue optional default value (default null)
960 * @param string $maxValue optional max value (default null)
961 * @param string $minValue optional min value (default null)
963 * @return integer integer value
966 function int($key, $defValue=null, $maxValue=null, $minValue=null)
968 $arg = strtolower($this->trimmed($key));
970 if (is_null($arg) || !is_integer($arg)) {
974 if (!is_null($maxValue)) {
975 $arg = min($arg, $maxValue);
978 if (!is_null($minValue)) {
979 $arg = max($arg, $minValue);
988 * @param string $msg error message to display
989 * @param integer $code http error code, 500 by default
994 function serverError($msg, $code=500)
996 $action = $this->trimmed('action');
997 common_debug("Server error '$code' on '$action': $msg", __FILE__);
998 throw new ServerException($msg, $code);
1004 * @param string $msg error message to display
1005 * @param integer $code http error code, 400 by default
1010 function clientError($msg, $code=400)
1012 $action = $this->trimmed('action');
1013 common_debug("User error '$code' on '$action': $msg", __FILE__);
1014 throw new ClientException($msg, $code);
1018 * Returns the current URL
1020 * @return string current URL
1025 list($action, $args) = $this->returnToArgs();
1026 return common_local_url($action, $args);
1030 * Returns arguments sufficient for re-constructing URL
1032 * @return array two elements: action, other args
1035 function returnToArgs()
1037 $action = $this->trimmed('action');
1038 $args = $this->args;
1039 unset($args['action']);
1040 if (common_config('site', 'fancy')) {
1043 if (array_key_exists('submit', $args)) {
1044 unset($args['submit']);
1046 foreach (array_keys($_COOKIE) as $cookie) {
1047 unset($args[$cookie]);
1049 return array($action, $args);
1053 * Generate a menu item
1055 * @param string $url menu URL
1056 * @param string $text menu name
1057 * @param string $title title attribute, null by default
1058 * @param boolean $is_selected current menu item, false by default
1059 * @param string $id element id, null by default
1063 function menuItem($url, $text, $title=null, $is_selected=false, $id=null)
1065 // Added @id to li for some control.
1066 // XXX: We might want to move this to htmloutputter.php
1069 $lattrs['class'] = 'current';
1072 (is_null($id)) ? $lattrs : $lattrs['id'] = $id;
1074 $this->elementStart('li', $lattrs);
1075 $attrs['href'] = $url;
1077 $attrs['title'] = $title;
1079 $this->element('a', $attrs, $text);
1080 $this->elementEnd('li');
1084 * Generate pagination links
1086 * @param boolean $have_before is there something before?
1087 * @param boolean $have_after is there something after?
1088 * @param integer $page current page
1089 * @param string $action current action
1090 * @param array $args rest of query arguments
1094 function pagination($have_before, $have_after, $page, $action, $args=null)
1096 // Does a little before-after block for next/prev page
1097 if ($have_before || $have_after) {
1098 $this->elementStart('dl', 'pagination');
1099 $this->element('dt', null, _('Pagination'));
1100 $this->elementStart('dd', null);
1101 $this->elementStart('ul', array('class' => 'nav'));
1104 $pargs = array('page' => $page-1);
1105 $this->elementStart('li', array('class' => 'nav_prev'));
1106 $this->element('a', array('href' => common_local_url($action, $args, $pargs),
1109 $this->elementEnd('li');
1112 $pargs = array('page' => $page+1);
1113 $this->elementStart('li', array('class' => 'nav_next'));
1114 $this->element('a', array('href' => common_local_url($action, $args, $pargs),
1117 $this->elementEnd('li');
1119 if ($have_before || $have_after) {
1120 $this->elementEnd('ul');
1121 $this->elementEnd('dd');
1122 $this->elementEnd('dl');
1127 * An array of feeds for this action.
1129 * Returns an array of potential feeds for this action.
1131 * @return array Feed object to show in head and links
1140 * A design for this action
1142 * @return Design a design object to use
1145 function getDesign()
1147 return Design::siteDesign();
1151 * Check the session token.
1153 * Checks that the current form has the correct session token,
1154 * and throw an exception if it does not.
1159 function checkSessionToken()
1162 $token = $this->trimmed('token');
1163 if (empty($token) || $token != common_session_token()) {
1164 $this->clientError(_('There was a problem with your session token.'));