X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Faction.php;h=e2427755852120fa61d1b5b8cb6576b1170dba49;hb=4f213f985f292bab3d54671325954cae34c23fd3;hp=80f398fbd77e25b8736af0a5c7cb33cae06cb5fd;hpb=ec6a38a62786c85e8ee30c5726ea81f82465b39d;p=quix0rs-gnu-social.git diff --git a/lib/action.php b/lib/action.php index 80f398fbd7..e242775585 100644 --- a/lib/action.php +++ b/lib/action.php @@ -68,7 +68,7 @@ class Action extends HTMLOutputter // lawsuit * @see XMLOutputter::__construct * @see HTMLOutputter::__construct */ - function __construct($output='php://output', $indent=true) + function __construct($output='php://output', $indent=null) { parent::__construct($output, $indent); } @@ -141,7 +141,7 @@ class Action extends HTMLOutputter // lawsuit function showTitle() { $this->element('title', null, - sprintf(_("%s - %s"), + sprintf(_("%1\$s - %2\$s"), $this->title(), common_config('site', 'name'))); } @@ -199,10 +199,6 @@ class Action extends HTMLOutputter // lawsuit if (Event::handle('StartShowStatusNetStyles', array($this)) && Event::handle('StartShowLaconicaStyles', array($this))) { $this->cssLink('css/display.css',null,'screen, projection, tv'); - if (common_config('site', 'mobile')) { - // TODO: "handheld" CSS for other mobile devices - $this->cssLink('css/mobile.css','base','only screen and (max-device-width: 480px)'); // Mobile WebKit - } $this->cssLink('css/print.css','base','print'); Event::handle('EndShowStatusNetStyles', array($this)); Event::handle('EndShowLaconicaStyles', array($this)); @@ -252,6 +248,8 @@ class Action extends HTMLOutputter // lawsuit if (Event::handle('StartShowJQueryScripts', array($this))) { $this->script('js/jquery.min.js'); $this->script('js/jquery.form.js'); + $this->script('js/jquery.cookie.js'); + $this->script('js/json2.js'); $this->script('js/jquery.joverlay.min.js'); Event::handle('EndShowJQueryScripts', array($this)); } @@ -259,6 +257,7 @@ class Action extends HTMLOutputter // lawsuit Event::handle('StartShowLaconicaScripts', array($this))) { $this->script('js/xbImportNode.js'); $this->script('js/util.js'); + $this->script('js/geometa.js'); // Frame-busting code to avoid clickjacking attacks. $this->element('script', array('type' => 'text/javascript'), 'if (window.top !== window.self) { window.top.location.href = window.self.location.href; }'); @@ -370,7 +369,11 @@ class Action extends HTMLOutputter // lawsuit $this->elementStart('div', array('id' => 'header')); $this->showLogo(); $this->showPrimaryNav(); - $this->showSiteNotice(); + if (Event::handle('StartShowSiteNotice', array($this))) { + $this->showSiteNotice(); + + Event::handle('EndShowSiteNotice', array($this)); + } if (common_logged_in()) { $this->showNoticeForm(); } else { @@ -434,6 +437,10 @@ class Action extends HTMLOutputter // lawsuit $this->menuItem(common_local_url($connect), _('Connect'), _('Connect to services'), false, 'nav_connect'); } + if ($user->hasRight(Right::CONFIGURESITE)) { + $this->menuItem(common_local_url('siteadminpanel'), + _('Admin'), _('Change site configuration'), false, 'nav_admin'); + } if (common_config('invite', 'enabled')) { $this->menuItem(common_local_url('invite'), _('Invite'), @@ -730,6 +737,8 @@ class Action extends HTMLOutputter // lawsuit _('Privacy')); $this->menuItem(common_local_url('doc', array('title' => 'source')), _('Source')); + $this->menuItem(common_local_url('version'), + _('Version')); $this->menuItem(common_local_url('doc', array('title' => 'contact')), _('Contact')); $this->menuItem(common_local_url('doc', array('title' => 'badge')), @@ -782,23 +791,45 @@ class Action extends HTMLOutputter // lawsuit */ function showContentLicense() { - $this->element('dt', array('id' => 'site_content_license'), _('Site content license')); - $this->elementStart('dd', array('id' => 'site_content_license_cc')); - $this->elementStart('p'); - $this->element('img', array('id' => 'license_cc', - 'src' => common_config('license', 'image'), - 'alt' => common_config('license', 'title'), - 'width' => '80', - 'height' => '15')); - //TODO: This is dirty: i18n - $this->text(_('All '.common_config('site', 'name').' content and data are available under the ')); - $this->element('a', array('class' => 'license', - 'rel' => 'external license', - 'href' => common_config('license', 'url')), - common_config('license', 'title')); - $this->text(_('license.')); - $this->elementEnd('p'); - $this->elementEnd('dd'); + if (Event::handle('StartShowContentLicense', array($this))) { + $this->element('dt', array('id' => 'site_content_license'), _('Site content license')); + $this->elementStart('dd', array('id' => 'site_content_license_cc')); + + switch (common_config('license', 'type')) { + case 'private': + $this->element('p', null, sprintf(_('Content and data of %1$s are private and confidential.'), + common_config('site', 'name'))); + // fall through + case 'allrightsreserved': + if (common_config('license', 'owner')) { + $this->element('p', null, sprintf(_('Content and data copyright by %1$s. All rights reserved.'), + common_config('license', 'owner'))); + } else { + $this->element('p', null, _('Content and data copyright by contributors. All rights reserved.')); + } + break; + case 'cc': // fall through + default: + $this->elementStart('p'); + $this->element('img', array('id' => 'license_cc', + 'src' => common_config('license', 'image'), + 'alt' => common_config('license', 'title'), + 'width' => '80', + 'height' => '15')); + //TODO: This is dirty: i18n + $this->text(_('All '.common_config('site', 'name').' content and data are available under the ')); + $this->element('a', array('class' => 'license', + 'rel' => 'external license', + 'href' => common_config('license', 'url')), + common_config('license', 'title')); + $this->text(_('license.')); + $this->elementEnd('p'); + break; + } + + $this->elementEnd('dd'); + Event::handle('EndShowContentLicense', array($this)); + } } /** @@ -946,6 +977,36 @@ class Action extends HTMLOutputter // lawsuit } } + /** + * Integer value of an argument + * + * @param string $key query key we're interested in + * @param string $defValue optional default value (default null) + * @param string $maxValue optional max value (default null) + * @param string $minValue optional min value (default null) + * + * @return integer integer value + */ + + function int($key, $defValue=null, $maxValue=null, $minValue=null) + { + $arg = strtolower($this->trimmed($key)); + + if (is_null($arg) || !is_integer($arg)) { + return $defValue; + } + + if (!is_null($maxValue)) { + $arg = min($arg, $maxValue); + } + + if (!is_null($minValue)) { + $arg = max($arg, $minValue); + } + + return $arg; + } + /** * Server error * @@ -985,6 +1046,18 @@ class Action extends HTMLOutputter // lawsuit */ function selfUrl() + { + list($action, $args) = $this->returnToArgs(); + return common_local_url($action, $args); + } + + /** + * Returns arguments sufficient for re-constructing URL + * + * @return array two elements: action, other args + */ + + function returnToArgs() { $action = $this->trimmed('action'); $args = $this->args; @@ -998,8 +1071,7 @@ class Action extends HTMLOutputter // lawsuit foreach (array_keys($_COOKIE) as $cookie) { unset($args[$cookie]); } - - return common_local_url($action, $args); + return array($action, $args); } /** @@ -1048,8 +1120,7 @@ class Action extends HTMLOutputter // lawsuit { // Does a little before-after block for next/prev page if ($have_before || $have_after) { - $this->elementStart('div', array('class' => 'pagination')); - $this->elementStart('dl', null); + $this->elementStart('dl', 'pagination'); $this->element('dt', null, _('Pagination')); $this->elementStart('dd', null); $this->elementStart('ul', array('class' => 'nav')); @@ -1074,7 +1145,6 @@ class Action extends HTMLOutputter // lawsuit $this->elementEnd('ul'); $this->elementEnd('dd'); $this->elementEnd('dl'); - $this->elementEnd('div'); } }