X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Faction.php;h=c2d60e11e974bec1414fe2b9b143b4babdb4ce0d;hb=da2f179ae97766b32f84d8180068830a605c9510;hp=f4bbb85f82feac7cc78b2d9d05c10ea53af34c13;hpb=8abc2d3b8d603d45d1228684f7366b5e4e8ab8de;p=quix0rs-gnu-social.git diff --git a/lib/action.php b/lib/action.php index f4bbb85f82..c2d60e11e9 100644 --- a/lib/action.php +++ b/lib/action.php @@ -125,11 +125,10 @@ class Action extends HTMLOutputter // lawsuit } else { common_debug('Prepare failed for Action.'); } - } - - $this->flush(); - Event::handle('EndActionExecute', array($this)); + $this->flush(); + Event::handle('EndActionExecute', array($this)); + } } /** @@ -206,7 +205,7 @@ class Action extends HTMLOutputter // lawsuit * * @return nothing */ - function showPage() + public function showPage() { if (GNUsocial::isAjax()) { self::showAjax(); @@ -418,7 +417,6 @@ class Action extends HTMLOutputter // lawsuit $this->script('extlib/jquery-ui/jquery-ui.js'); $this->script('extlib/jquery.cookie.js'); $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/extlib/json2.js', GNUsocial::isHTTPS()).'"); }'); - $this->script('extlib/jquery.infieldlabel.js'); Event::handle('EndShowJQueryScripts', array($this)); } @@ -432,6 +430,7 @@ class Action extends HTMLOutputter // lawsuit $this->inlineScript('var _peopletagAC = "' . common_local_url('peopletagautocomplete') . '";'); $this->showScriptMessages(); + $this->showScriptVariables(); // Anti-framing code to avoid clickjacking attacks in older browsers. // This will show a blank page if the page is being framed, which is // consistent with the behavior of the 'X-Frame-Options: SAMEORIGIN' @@ -461,6 +460,7 @@ class Action extends HTMLOutputter // lawsuit // TRANS: Localized tooltip for '...' expansion button on overlong remote messages. $messages['showmore_tooltip'] = _m('TOOLTIP', 'Show more'); + $messages['popup_close_button'] = _m('TOOLTIP', 'Close popup'); $messages = array_merge($messages, $this->getScriptMessages()); @@ -474,6 +474,19 @@ class Action extends HTMLOutputter // lawsuit return $messages; } + protected function showScriptVariables() + { + $vars = array(); + + if (Event::handle('StartScriptVariables', array($this, &$vars))) { + $vars['urlNewNotice'] = common_local_url('newnotice'); + } + if (!empty($vars)) { + $this->inlineScript('SN.V = ' . json_encode($vars)); + } + return $vars; + } + /** * If the action will need localizable text strings, export them here like so: * @@ -522,15 +535,11 @@ class Action extends HTMLOutputter // lawsuit */ function showFeeds() { - $feeds = $this->getFeeds(); - - if ($feeds) { - foreach ($feeds as $feed) { - $this->element('link', array('rel' => $feed->rel(), - 'href' => $feed->url, - 'type' => $feed->mimeType(), - 'title' => $feed->title)); - } + foreach ($this->getFeeds() as $feed) { + $this->element('link', array('rel' => $feed->rel(), + 'href' => $feed->url, + 'type' => $feed->mimeType(), + 'title' => $feed->title)); } } @@ -1023,9 +1032,9 @@ class Action extends HTMLOutputter // lawsuit function showExportData() { $feeds = $this->getFeeds(); - if ($feeds) { - $fl = new FeedList($this); - $fl->show($feeds); + if (!empty($feeds)) { + $fl = new FeedList($this, $feeds); + $fl->show(); } } @@ -1358,7 +1367,7 @@ class Action extends HTMLOutputter // lawsuit * Upstream bug is:: * https://pear.php.net/bugs/bug.php?id=20291 */ - function booleanintstring($key, $def) + function booleanintstring($key, $def=false) { return $this->boolean($key, $def) ? '1' : '0'; } @@ -1481,7 +1490,7 @@ class Action extends HTMLOutputter // lawsuit } $this->initDocument('json'); $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']); - $this->text(json_encode($error_array)); + print(json_encode($error_array)); $this->endDocument('json'); break; case 'text': @@ -1646,7 +1655,7 @@ class Action extends HTMLOutputter // lawsuit */ function getFeeds() { - return null; + return array(); } /**