X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fsitenoticeadminpanel.php;h=72c9f9a1289486fde08783bc69e4e52c116d7250;hb=7da925ca70c74c3466fd0477403109ed40d02175;hp=3931aa9825f7482ca81ac8e9a8dec148cd51db9f;hpb=b8001ea1079c4c8895fd2323e1e4a47c0d71fde3;p=quix0rs-gnu-social.git diff --git a/actions/sitenoticeadminpanel.php b/actions/sitenoticeadminpanel.php index 3931aa9825..72c9f9a128 100644 --- a/actions/sitenoticeadminpanel.php +++ b/actions/sitenoticeadminpanel.php @@ -27,11 +27,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} - -require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php'; +if (!defined('GNUSOCIAL')) { exit(1); } /** * Update the site-wide notice text @@ -42,7 +38,6 @@ require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class SitenoticeadminpanelAction extends AdminPanelAction { /** @@ -50,9 +45,9 @@ class SitenoticeadminpanelAction extends AdminPanelAction * * @return string page title */ - function title() { + // TRANS: Page title for site-wide notice tab in admin panel. return _('Site Notice'); } @@ -61,9 +56,9 @@ class SitenoticeadminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { + // TRANS: Instructions for site-wide notice tab in admin panel. return _('Edit site-wide message'); } @@ -72,7 +67,6 @@ class SitenoticeadminpanelAction extends AdminPanelAction * * @return void */ - function showForm() { $form = new SiteNoticeAdminPanelForm($this); @@ -85,7 +79,6 @@ class SitenoticeadminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { $siteNotice = $this->trimmed('site-notice'); @@ -93,14 +86,15 @@ class SitenoticeadminpanelAction extends AdminPanelAction // assert(all values are valid); // This throws an exception on validation errors - $this->validate(&$siteNotice); + $this->validate($siteNotice); $config = new Config(); $result = Config::save('site', 'notice', $siteNotice); if (!$result) { - $this->ServerError(_("Unable to save site notice.")); + // TRANS: Server error displayed when saving a site-wide notice was impossible. + $this->ServerError(_('Unable to save site notice.')); } } @@ -110,18 +104,15 @@ class SitenoticeadminpanelAction extends AdminPanelAction if (mb_strlen($siteNotice) > 255) { $this->clientError( - _('Max length for the site-wide notice is 255 chars') + // TRANS: Client error displayed when a site-wide notice was longer than allowed. + _('Maximum length for the site-wide notice is 255 characters.') ); } // scrub HTML input - - $config = array( - 'safe' => 1, - 'deny_attribute' => 'id,style,on*' - ); - - $siteNotice = htmLawed($siteNotice, $config); + require_once INSTALLDIR.'/extlib/HTMLPurifier/HTMLPurifier.auto.php'; + $purifier = new HTMLPurifier(); + $siteNotice = $purifier->purify($siteNotice); } } @@ -173,9 +164,11 @@ class SiteNoticeAdminPanelForm extends AdminForm $this->out->elementStart('li'); $this->out->textarea( 'site-notice', + // TRANS: Label for site-wide notice text field in admin panel. _('Site notice text'), common_config('site', 'notice'), - _('Site-wide notice text (255 chars max; HTML okay)') + // TRANS: Tooltip for site-wide notice text field in admin panel. + _('Site-wide notice text (255 characters maximum; HTML allowed)') ); $this->out->elementEnd('li'); @@ -192,10 +185,12 @@ class SiteNoticeAdminPanelForm extends AdminForm { $this->out->submit( 'submit', - _('Save'), + // TRANS: Button text for saving site notice in admin panel. + _m('BUTTON','Save'), 'submit', null, - _('Save site notice') + // TRANS: Button title to save site notice in admin panel. + _('Save site notice.') ); } }