} else {
common_debug('Prepare failed for Action.');
}
- }
-
- $this->flush();
- Event::handle('EndActionExecute', array($this));
+ $this->flush();
+ Event::handle('EndActionExecute', array($this));
+ }
}
/**
*
* @return nothing
*/
- function showPage()
+ public function showPage()
{
if (GNUsocial::isAjax()) {
self::showAjax();
$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));
}
$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'
// TRANS: Localized tooltip for '...' expansion button on overlong remote messages.
$messages['showmore_tooltip'] = _m('TOOLTIP', 'Show more');
-
- // TRANS: Inline reply form submit button: submits a reply comment.
- $messages['reply_submit'] = _m('BUTTON', 'Reply');
-
- // TRANS: Placeholder text for inline reply form. Clicking in this box will turn it into a mini notice form.
- $messages['reply_placeholder'] = _m('Write a reply...');
+ $messages['popup_close_button'] = _m('TOOLTIP', 'Close popup');
$messages = array_merge($messages, $this->getScriptMessages());
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:
*
*/
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));
}
}
function showExportData()
{
$feeds = $this->getFeeds();
- if ($feeds) {
- $fl = new FeedList($this);
- $fl->show($feeds);
+ if (!empty($feeds)) {
+ $fl = new FeedList($this, $feeds);
+ $fl->show();
}
}
}
}
+ /**
+ * This is a cheap hack to avoid a bug in DB_DataObject
+ * where '' is non-type-aware compared to 0, which means it
+ * will always be true for values like false and 0 too...
+ *
+ * Upstream bug is::
+ * https://pear.php.net/bugs/bug.php?id=20291
+ */
+ function booleanintstring($key, $def=false)
+ {
+ return $this->boolean($key, $def) ? '1' : '0';
+ }
+
/**
* Integer value of an argument
*
}
$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':
*/
function getFeeds()
{
- return null;
+ return array();
}
/**