Commit 6fad887c by Maiyannah Bishop

Merge branch 'bashrc/gnusocial-removals' into 'master'

Replace GNUsocial with postActiv

Replaces some GNUsocial names and also has some whitespace removal.

See merge request !14
2 parents 3af66a0c 9735426c
......@@ -64,7 +64,7 @@ class CancelsubscriptionAction extends FormAction
common_debug('Tried to cancel a non-existing pending subscription');
}
if (GNUsocial::isAjax()) {
if (postActiv::isAjax()) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Title after unsubscribing from a group.
......@@ -80,4 +80,4 @@ class CancelsubscriptionAction extends FormAction
common_redirect(common_local_url('subscriptions', array('nickname' => $this->scoped->getNickname())), 303);
}
}
?>
\ No newline at end of file
?>
......@@ -133,7 +133,7 @@ class NewnoticeAction extends FormAction
$cmd = $inter->handle_command($user, $content);
if ($cmd) {
if (GNUsocial::isAjax()) {
if (postActiv::isAjax()) {
$cmd->execute(new AjaxWebChannel($this));
} else {
$cmd->execute(new WebChannel($this));
......@@ -220,7 +220,7 @@ class NewnoticeAction extends FormAction
Event::handle('EndSaveNewNoticeWeb', array($this, $user, &$content, &$options));
if (!GNUsocial::isAjax()) {
if (!postActiv::isAjax()) {
$url = common_local_url('shownotice', array('notice' => $this->stored->id));
common_redirect($url, 303);
}
......@@ -257,4 +257,4 @@ class NewnoticeAction extends FormAction
// pass
}
}
?>
\ No newline at end of file
?>
......@@ -83,7 +83,7 @@ class ShownoticeAction extends ManagedAction
{
parent::prepare($args);
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
$this->notice = $this->getNotice();
......@@ -264,4 +264,4 @@ class ShownoticeAction extends ManagedAction
'content' => $this->notice->content));
}
}
?>
\ No newline at end of file
?>
......@@ -185,7 +185,7 @@ class AttachmentListItem extends Widget
break;
case 'text/html':
if (!empty($this->attachment->filename)
&& (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) {
&& (postActiv::isAjax() || common_config('attachments', 'show_html'))) {
// Locally-uploaded HTML. Scrub and display inline.
$this->showHtmlFile($this->attachment);
break;
......@@ -271,4 +271,4 @@ class AttachmentListItem extends Widget
$this->out->elementEnd('li');
}
}
?>
\ No newline at end of file
?>
......@@ -105,8 +105,8 @@ class DocFile
$paths = array(INSTALLDIR.'/local/doc-src/',
INSTALLDIR.'/doc-src/');
$site = GNUsocial::currentSite();
$site = postActiv::currentSite();
if (!empty($site)) {
array_unshift($paths, INSTALLDIR.'/local/doc-src/'.$site.'/');
}
......@@ -119,8 +119,8 @@ class DocFile
$paths = array(INSTALLDIR.'/local/mail-src/',
INSTALLDIR.'/mail-src/');
$site = GNUsocial::currentSite();
$site = postActiv::currentSite();
if (!empty($site)) {
array_unshift($paths, INSTALLDIR.'/local/mail-src/'.$site.'/');
}
......@@ -143,4 +143,4 @@ class DocFile
return $defaultFilename;
}
}
?>
\ No newline at end of file
?>
......@@ -436,7 +436,7 @@ class StompQueueManager extends QueueManager
$con->subscribe($sub);
}
}
/**
* Grab a full list of stomp-side queue subscriptions.
* Will include:
......@@ -496,7 +496,7 @@ class StompQueueManager extends QueueManager
if ($this->isDeadletter($frame, $message)) {
$this->stats('deadletter', $queue);
return false;
return false;
}
// @fixme detect failing site switches
......@@ -550,28 +550,28 @@ class StompQueueManager extends QueueManager
protected function isDeadLetter($frame, $message)
{
if (isset($frame->headers['redelivered']) && $frame->headers['redelivered'] == 'true') {
// Message was redelivered, possibly indicating a previous failure.
// Message was redelivered, possibly indicating a previous failure.
$msgId = $frame->headers['message-id'];
$site = $message['site'];
$queue = $message['handler'];
$msgInfo = "message $msgId for $site in queue $queue";
$msgInfo = "message $msgId for $site in queue $queue";
$deliveries = $this->incDeliveryCount($msgId);
if ($deliveries > common_config('queue', 'max_retries')) {
$info = "DEAD-LETTER FILE: Gave up after retry $deliveries on $msgInfo";
$deliveries = $this->incDeliveryCount($msgId);
if ($deliveries > common_config('queue', 'max_retries')) {
$info = "DEAD-LETTER FILE: Gave up after retry $deliveries on $msgInfo";
$outdir = common_config('queue', 'dead_letter_dir');
if ($outdir) {
$filename = $outdir . "/$site-$queue-" . rawurlencode($msgId);
$info .= ": dumping to $filename";
file_put_contents($filename, $message['payload']);
}
$outdir = common_config('queue', 'dead_letter_dir');
if ($outdir) {
$filename = $outdir . "/$site-$queue-" . rawurlencode($msgId);
$info .= ": dumping to $filename";
file_put_contents($filename, $message['payload']);
}
common_log(LOG_ERR, $info);
return true;
} else {
common_log(LOG_INFO, "retry $deliveries on $msgInfo");
}
common_log(LOG_ERR, $info);
return true;
} else {
common_log(LOG_INFO, "retry $deliveries on $msgInfo");
}
}
return false;
}
......@@ -587,18 +587,18 @@ class StompQueueManager extends QueueManager
*/
function incDeliveryCount($msgId)
{
$count = 0;
$cache = Cache::instance();
if ($cache) {
$key = 'statusnet:stomp:message-retries:' . $msgId;
$count = $cache->increment($key);
if (!$count) {
$count = 1;
$cache->set($key, $count, null, 3600);
$got = $cache->get($key);
}
}
return $count;
$count = 0;
$cache = Cache::instance();
if ($cache) {
$key = 'statusnet:stomp:message-retries:' . $msgId;
$count = $cache->increment($key);
if (!$count) {
$count = 1;
$cache->set($key, $count, null, 3600);
$got = $cache->get($key);
}
}
return $count;
}
/**
......@@ -640,9 +640,9 @@ class StompQueueManager extends QueueManager
*/
function switchSite($site)
{
if ($site != GNUsocial::currentSite()) {
if ($site != postActiv::currentSite()) {
$this->stats('switch');
GNUsocial::switchSite($site);
postActiv::switchSite($site);
$this->initialize();
}
}
......@@ -685,7 +685,7 @@ class StompQueueManager extends QueueManager
protected function queueName($queue)
{
$group = $this->queueGroup($queue);
$site = GNUsocial::currentSite();
$site = postActiv::currentSite();
$specs = array("$group/$queue/$site",
"$group/$queue");
......@@ -763,4 +763,4 @@ class StompQueueManager extends QueueManager
}
}
}
?>
\ No newline at end of file
?>
......@@ -49,7 +49,7 @@ abstract class ActivityVerbHandlerPlugin extends ActivityHandlerPlugin
}
protected function showActionContent(ManagedAction $action, $verb, Notice $target, Profile $scoped)
{
if (!GNUsocial::isAjax()) {
if (!postActiv::isAjax()) {
$nl = new NoticeListItem($target, $action, array('options'=>false, 'attachments'=>false,
'item_tag'=>'div', 'id_prefix'=>'fave'));
$nl->show();
......
......@@ -135,7 +135,7 @@ class NewmessageAction extends FormAction
$message = Message::saveNew($this->scoped->id, $this->other->id, $this->content, 'web');
$message->notify();
if (GNUsocial::isAjax()) {
if (postActiv::isAjax()) {
// TRANS: Confirmation text after sending a direct message.
// TRANS: %s is the direct message recipient.
return sprintf(_('Direct message to %s sent.'), $this->other->getNickname());
......
......@@ -100,7 +100,7 @@ if (have_option('u', 'universe')) {
while ($sn->fetch()) {
try {
$server = $sn->getServerName();
GNUsocial::init($server);
postActiv::init($server);
// Different queue manager, maybe!
$qm = QueueManager::get();
foreach ($reminders as $reminder) {
......
......@@ -42,7 +42,7 @@ if (have_option('u', 'universe')) {
if ($sn->find()) {
while ($sn->fetch()) {
$server = $sn->getServerName();
GNUsocial::init($server);
postActiv::init($server);
// Different queue manager, maybe!
$qm = QueueManager::get();
$qm->enqueue(1, 'sitesum');
......
......@@ -166,7 +166,7 @@ class OembedPlugin extends Plugin
if($metadata->thumbnail_url == 'https://s0.wp.com/i/blank.jpg') {
unset($metadata->thumbnail_url);
}
// FIXME: this is also true of locally-installed wordpress so we should watch out for that.
}
return true;
......@@ -387,7 +387,7 @@ class OembedPlugin extends Plugin
case 'video':
case 'link':
if (!empty($oembed->html)
&& (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) {
&& (postActiv::isAjax() || common_config('attachments', 'show_html'))) {
require_once INSTALLDIR.'/extlib/HTMLPurifier/HTMLPurifier.auto.php';
$purifier = new HTMLPurifier();
// FIXME: do we allow <object> and <embed> here? we did that when we used htmLawed, but I'm not sure anymore...
......@@ -407,7 +407,7 @@ class OembedPlugin extends Plugin
// $imgPath = the path to the created thumbnail
// $media = media type the thumbnail was created for
// Man that name is a mouthful.
// This event executes when postActiv is creating a file thumbnail entry in
// This event executes when postActiv is creating a file thumbnail entry in
// the database. We glom onto this to create proper information for oEmbed
// object thumbnails. Returns true if it succeeds (including non-action
// states where it isn't oEmbed data, so it doesn't mess up the event handle
......@@ -499,9 +499,9 @@ class OembedPlugin extends Plugin
// -------------------------------------------------------------------------
// OembedPlugin::isRemoteImage($url) private function.
// A private helper function that uses a CURL lookup to check the mime type
// of a remote URL to see it it's an image. Returns true if the remote URL
// of a remote URL to see it it's an image. Returns true if the remote URL
// is an image, or false otherwise.
// FIXME: We should probably sanity-check the input to make sure it's a
// FIXME: We should probably sanity-check the input to make sure it's a
// valid URL.
private function isRemoteImage($url) {
if ($url==null) {
......@@ -530,7 +530,7 @@ class OembedPlugin extends Plugin
// An internal helper function that parses the php.ini file size limit from
// the 'human-readable' shorthand into something we can use to test against
// in conditionals.
// Returns the php.ini upload limit in machine-readable format, or the
// Returns the php.ini upload limit in machine-readable format, or the
// exception if it fails.
// FIXME: We could probably move this to a public utility library.
private function getPHPUploadLimit() {
......
......@@ -129,7 +129,7 @@ class NewPollAction extends Action
function newPoll()
{
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
try {
if (empty($this->question)) {
......
......@@ -30,7 +30,7 @@
* @license https://www.gnu.org/licenses/agpl.html
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
......@@ -78,7 +78,7 @@ class RespondPollAction extends Action
{
parent::prepare($args);
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
$this->user = common_current_user();
......
......@@ -30,7 +30,7 @@
* @license https://www.gnu.org/licenses/agpl.html
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
......@@ -78,7 +78,7 @@ class QnaclosequestionAction extends Action
{
parent::prepare($args);
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
$this->user = common_current_user();
......
......@@ -30,7 +30,7 @@
* @license https://www.gnu.org/licenses/agpl.html
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
......@@ -78,7 +78,7 @@ class QnanewanswerAction extends Action
{
parent::prepare($args);
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
common_debug("in qnanewanswer");
$this->user = common_current_user();
......
......@@ -125,7 +125,7 @@ class QnanewquestionAction extends Action
function newQuestion()
{
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
try {
if (empty($this->title)) {
......
......@@ -30,7 +30,7 @@
* @license https://www.gnu.org/licenses/agpl.html
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
......@@ -77,7 +77,7 @@ class QnareviseanswerAction extends Action
{
parent::prepare($args);
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
$this->user = common_current_user();
......
......@@ -78,7 +78,7 @@ class Qnavote extends Action
{
parent::prepare($args);
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
$this->user = common_current_user();
......
......@@ -70,7 +70,7 @@ class SearchsubAction extends Action
{
parent::prepare($args);
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
// Only allow POST requests
......
......@@ -70,7 +70,7 @@ class TagsubAction extends Action
{
parent::prepare($args);
if ($this->boolean('ajax')) {
GNUsocial::setApi(true);
postActiv::setApi(true);
}
// Only allow POST requests
......
......@@ -49,7 +49,7 @@ class OembedproxyAction extends OembedAction
function handle()
{
// Trigger short error responses; not a human-readable web page.
GNUsocial::setApi(true);
postActiv::setApi(true);
// We're not a general oEmbed proxy service; limit to valid sessions.
$token = $this->trimmed('token');
......
......@@ -62,7 +62,7 @@ if (have_option('u', 'universe')) {
if ($sn->find()) {
while ($sn->fetch()) {
$server = $sn->getServerName();
GNUsocial::init($server);
postActiv::init($server);
cleanupChannels();
}
}
......
......@@ -43,7 +43,7 @@ class StrictTransportSecurityPlugin extends Plugin
function onArgsInitialize($args)
{
$path = common_config('site', 'path');
if (GNUsocial::useHTTPS() && ($path == '/' || mb_strlen($path)==0 )) {
if (postActiv::useHTTPS() && ($path == '/' || mb_strlen($path)==0 )) {
header('Strict-Transport-Security: max-age=' . $this->max_age
. ($this->includeSubDomains ? '; includeSubDomains' : '')
. ($this->preloadToken ? '; preload' : ''));
......
......@@ -63,7 +63,7 @@ class MirrorSettingsAction extends SettingsAction
function showContent()
{
$provider = $this->trimmed('provider');
if (!empty($provider) || GNUsocial::isAjax()) {
if (!empty($provider) || postActiv::isAjax()) {
$this->showAddFeedForm($provider);
} else {
$this->elementStart('div', array('id' => 'add-mirror'));
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!