X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fchannel.php;h=ae9b2d214f602e8b68a35feeedeaa4bf2655f37f;hb=f1bfbece06d7db20fa144fe5ac8a2f6c589eff45;hp=05437b4e9eaa44c3720b9ed9a192cbb7cbf43807;hpb=20d6a7caed6636c28cc7b95c584549691dff4388;p=quix0rs-gnu-social.git diff --git a/lib/channel.php b/lib/channel.php index 05437b4e9e..ae9b2d214f 100644 --- a/lib/channel.php +++ b/lib/channel.php @@ -19,6 +19,9 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } +/** + * @todo Needs documentation. + */ class Channel { function on($user) @@ -47,6 +50,25 @@ class Channel } } +class CLIChannel extends Channel +{ + function source() + { + return 'cli'; + } + + function output($user, $text) + { + $site = common_config('site', 'name'); + print "[{$user->nickname}@{$site}] $text\n"; + } + + function error($user, $text) + { + $this->output($user, $text); + } +} + class WebChannel extends Channel { var $out = null; @@ -78,6 +100,7 @@ class WebChannel extends Channel # depending on what command was run $this->out->startHTML(); $this->out->elementStart('head'); + // TRANS: Title for command results. $this->out->element('title', null, _('Command results')); $this->out->elementEnd('head'); $this->out->elementStart('body'); @@ -98,6 +121,7 @@ class AjaxWebChannel extends WebChannel { $this->out->startHTML('text/xml;charset=utf-8'); $this->out->elementStart('head'); + // TRANS: Title for command results. $this->out->element('title', null, _('Command results')); $this->out->elementEnd('head'); $this->out->elementStart('body'); @@ -110,7 +134,8 @@ class AjaxWebChannel extends WebChannel { $this->out->startHTML('text/xml;charset=utf-8'); $this->out->elementStart('head'); - $this->out->element('title', null, _('Ajax Error')); + // TRANS: Title for command results. + $this->out->element('title', null, _('AJAX error')); $this->out->elementEnd('head'); $this->out->elementStart('body'); $this->out->element('p', array('id' => 'error'), $text); @@ -121,7 +146,6 @@ class AjaxWebChannel extends WebChannel class MailChannel extends Channel { - var $addr = null; function source() @@ -136,20 +160,20 @@ class MailChannel extends Channel function on($user) { - return $this->set_notify($user, 1); + return $this->setNotify($user, 1); } function off($user) { - return $this->set_notify($user, 0); + return $this->setNotify($user, 0); } function output($user, $text) { - $headers['From'] = $user->incomingemail; $headers['To'] = $this->addr; + // TRANS: E-mail subject when a command has completed. $headers['Subject'] = _('Command complete'); return mail_send(array($this->addr), $headers, $text); @@ -157,16 +181,16 @@ class MailChannel extends Channel function error($user, $text) { - $headers['From'] = $user->incomingemail; $headers['To'] = $this->addr; + // TRANS: E-mail subject when a command has failed. $headers['Subject'] = _('Command failed'); return mail_send(array($this->addr), $headers, $text); } - function set_notify($user, $value) + function setNotify($user, $value) { $orig = clone($user); $user->smsnotify = $value;