| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * StatusNet, the distributed open-source microblogging tool | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Paths administration panel | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * PHP version 5 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * LICENCE: This program is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU Affero General Public License as published by | 
					
						
							|  |  |  |  * the Free Software Foundation, either version 3 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU Affero General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Affero General Public License | 
					
						
							|  |  |  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category  Settings | 
					
						
							|  |  |  |  * @package   StatusNet | 
					
						
							|  |  |  |  * @author    Evan Prodromou <evan@status.net> | 
					
						
							|  |  |  |  * @author    Zach Copley <zach@status.net> | 
					
						
							|  |  |  |  * @author    Sarven Capadisli <csarven@status.net> | 
					
						
							| 
									
										
										
										
											2010-01-26 15:11:09 -08:00
										 |  |  |  * @copyright 2008-2010 StatusNet, Inc. | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 | 
					
						
							|  |  |  |  * @link      http://status.net/ | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (!defined('STATUSNET')) { | 
					
						
							|  |  |  |     exit(1); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Paths settings | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category Admin | 
					
						
							|  |  |  |  * @package  StatusNet | 
					
						
							|  |  |  |  * @author   Evan Prodromou <evan@status.net> | 
					
						
							|  |  |  |  * @author   Zach Copley <zach@status.net> | 
					
						
							|  |  |  |  * @author   Sarven Capadisli <csarven@status.net> | 
					
						
							|  |  |  |  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 | 
					
						
							|  |  |  |  * @link     http://status.net/ | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class PathsadminpanelAction extends AdminPanelAction | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Returns the page title | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string page title | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function title() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         // TRANS: Title for Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         return _('Paths'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Instructions for using this form. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string instructions | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function getInstructions() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         // TRANS: Form instructions for Path admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-09-17 14:32:18 -07:00
										 |  |  |         return _('Path and server settings for this StatusNet site'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Show the paths admin panel form | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function showForm() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $form = new PathsAdminPanelForm($this); | 
					
						
							|  |  |  |         $form->show(); | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Save settings from the form | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function saveSettings() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         static $settings = array( | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |                                  'site' => array('path', 'locale_path', 'ssl', 'sslserver'), | 
					
						
							|  |  |  |                                  'theme' => array('server', 'dir', 'path', 'sslserver', 'sslpath'), | 
					
						
							|  |  |  |                                  'avatar' => array('server', 'dir', 'path'), | 
					
						
							|  |  |  |                                  'background' => array('server', 'dir', 'path', 'sslserver', 'sslpath'), | 
					
						
							|  |  |  |                                  'attachments' => array('server', 'dir', 'path', 'sslserver', 'sslpath') | 
					
						
							|  |  |  |                                  ); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         // XXX: If we're only going to have one boolean on thi page we
 | 
					
						
							|  |  |  |         // can remove some of the boolean processing code --Z
 | 
					
						
							| 
									
										
										
										
											2010-01-26 15:11:09 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         static $booleans = array('site' => array('fancy')); | 
					
						
							| 
									
										
										
										
											2010-01-26 15:11:09 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $values = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         foreach ($settings as $section => $parts) { | 
					
						
							|  |  |  |             foreach ($parts as $setting) { | 
					
						
							|  |  |  |                 $values[$section][$setting] = $this->trimmed("$section-$setting"); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-26 15:11:09 -08:00
										 |  |  |         foreach ($booleans as $section => $parts) { | 
					
						
							|  |  |  |             foreach ($parts as $setting) { | 
					
						
							|  |  |  |                 $values[$section][$setting] = ($this->boolean($setting)) ? 1 : 0; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->validate($values); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // assert(all values are valid);
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $config = new Config(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $config->query('BEGIN'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         foreach ($settings as $section => $parts) { | 
					
						
							|  |  |  |             foreach ($parts as $setting) { | 
					
						
							|  |  |  |                 Config::save($section, $setting, $values[$section][$setting]); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         foreach ($booleans as $section => $parts) { | 
					
						
							|  |  |  |             foreach ($parts as $setting) { | 
					
						
							| 
									
										
										
										
											2010-01-26 15:11:09 -08:00
										 |  |  |                 Config::save($section, $setting, $values[$section][$setting]); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-01-26 15:11:09 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $config->query('COMMIT'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Attempt to validate setting values | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function validate(&$values) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // Validate theme dir
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (!empty($values['theme']['dir']) && !is_readable($values['theme']['dir'])) { | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |             // TRANS: Client error in Paths admin panel.
 | 
					
						
							|  |  |  |             // TRANS: %s is the directory that could not be read from.
 | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |             $this->clientError(sprintf(_('Theme directory not readable: %s.'), $values['theme']['dir'])); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Validate avatar dir
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (empty($values['avatar']['dir']) || !is_writable($values['avatar']['dir'])) { | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |             // TRANS: Client error in Paths admin panel.
 | 
					
						
							|  |  |  |             // TRANS: %s is the avatar directory that could not be written to.
 | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |             $this->clientError(sprintf(_('Avatar directory not writable: %s.'), $values['avatar']['dir'])); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Validate background dir
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (empty($values['background']['dir']) || !is_writable($values['background']['dir'])) { | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |             // TRANS: Client error in Paths admin panel.
 | 
					
						
							|  |  |  |             // TRANS: %s is the background directory that could not be written to.
 | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |             $this->clientError(sprintf(_('Background directory not writable: %s.'), $values['background']['dir'])); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Validate locales dir
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // XXX: What else do we need to validate for lacales path here? --Z
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (!empty($values['site']['locale_path']) && !is_readable($values['site']['locale_path'])) { | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |             // TRANS: Client error in Paths admin panel.
 | 
					
						
							|  |  |  |             // TRANS: %s is the locales directory that could not be read from.
 | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |             $this->clientError(sprintf(_('Locales directory not readable: %s.'), $values['site']['locale_path'])); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-24 15:25:59 -06:00
										 |  |  |         // Validate SSL setup
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-24 16:50:28 -06:00
										 |  |  |         if (mb_strlen($values['site']['sslserver']) > 255) { | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |             // TRANS: Client error in Paths admin panel.
 | 
					
						
							|  |  |  |             // TRANS: %s is the SSL server URL that is too long.
 | 
					
						
							| 
									
										
										
										
											2010-04-10 00:58:57 +02:00
										 |  |  |             $this->clientError(_('Invalid SSL server. The maximum length is 255 characters.')); | 
					
						
							| 
									
										
										
										
											2009-12-24 15:25:59 -06:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PathsAdminPanelForm extends AdminForm | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * ID of the form | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return int ID of the form | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function id() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return 'form_paths_admin_panel'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * class of the form | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string class of the form | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function formClass() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return 'form_settings'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Action of the form | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string URL of the action | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function action() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return common_local_url('pathsadminpanel'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Data elements of the form | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function formData() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->out->elementStart('fieldset', array('id' => 'settings_paths_locale')); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         // TRANS: Fieldset legend in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->out->element('legend', null, _('Site'), 'site'); | 
					
						
							|  |  |  |         $this->out->elementStart('ul', 'form_data'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('server', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Server'), | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |                      // TRANS: Field title in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |                      _('Site\'s server hostname.')); | 
					
						
							| 
									
										
										
										
											2010-01-26 15:11:09 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('path', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Path'), | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |                      // TRANS: Field title in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:29:59 +02:00
										 |  |  |                      _('Site path.')); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('locale_path', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Locale directory'), | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |                      // TRANS: Field title in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:29:59 +02:00
										 |  |  |                      _('Directory path to locales.'), | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |                      'site'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->out->checkbox('fancy', | 
					
						
							|  |  |  |                              // TRANS: Checkbox label in Paths admin panel.
 | 
					
						
							|  |  |  |                              _('Fancy URLs'), | 
					
						
							| 
									
										
										
										
											2010-01-26 15:11:09 -08:00
										 |  |  |                              (bool) $this->value('fancy'), | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |                              // TRANS: Field title in Paths admin panel.
 | 
					
						
							|  |  |  |                              _('Use fancy URLs (more readable and memorable)?')); | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->unli(); | 
					
						
							| 
									
										
										
										
											2010-01-26 15:11:09 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->out->elementEnd('ul'); | 
					
						
							|  |  |  |         $this->out->elementEnd('fieldset'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementStart('fieldset', array('id' => 'settings_paths_theme')); | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |         // TRANS: Fieldset legend in Paths admin panel.
 | 
					
						
							|  |  |  |         $this->out->element('legend', null, _m('LEGEND','Theme')); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementStart('ul', 'form_data'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('server', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Server'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Server for themes.'), | 
					
						
							|  |  |  |                      'theme'); | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('path', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Path'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Web path to themes.'), | 
					
						
							|  |  |  |                      'theme'); | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('sslserver', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('SSL server'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('SSL server for themes (default: SSL server).'), | 
					
						
							|  |  |  |                      'theme'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('sslpath', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('SSL path'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('SSL path to themes (default: /theme/).'), | 
					
						
							|  |  |  |                      'theme'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('dir', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Directory'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Directory where themes are located.'), | 
					
						
							|  |  |  |                      'theme'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementEnd('ul'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementEnd('fieldset'); | 
					
						
							|  |  |  |         $this->out->elementStart('fieldset', array('id' => 'settings_avatar-paths')); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         // TRANS: Fieldset legend in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->out->element('legend', null, _('Avatars')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementStart('ul', 'form_data'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('server', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Avatar server'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Server for avatars.'), | 
					
						
							|  |  |  |                      'avatar'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('path', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Avatar path'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:29:59 +02:00
										 |  |  |                      _('Web path to avatars.'), | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |                      'avatar'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('dir', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Avatar directory'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Directory where avatars are located.'), | 
					
						
							|  |  |  |                      'avatar'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementEnd('ul'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementEnd('fieldset'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementStart('fieldset', array('id' => | 
					
						
							| 
									
										
										
										
											2011-06-09 16:20:19 -04:00
										 |  |  |                                                    'settings_attachments-paths')); | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         // TRANS: Fieldset legens in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->out->element('legend', null, _('Attachments')); | 
					
						
							|  |  |  |         $this->out->elementStart('ul', 'form_data'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('server', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Server'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Server for attachments.'), | 
					
						
							|  |  |  |                      'attachments'); | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('path', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Path'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Web path to attachments.'), | 
					
						
							|  |  |  |                      'attachments'); | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('sslserver', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('SSL server'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Server for attachments on SSL pages.'), | 
					
						
							|  |  |  |                      'attachments'); | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('sslpath', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('SSL path'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Web path to attachments on SSL pages.'), | 
					
						
							|  |  |  |                      'attachments'); | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('dir', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Directory'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('Directory where attachments are located.'), | 
					
						
							|  |  |  |                      'attachments'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementEnd('ul'); | 
					
						
							|  |  |  |         $this->out->elementEnd('fieldset'); | 
					
						
							| 
									
										
										
										
											2009-12-24 15:25:59 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementStart('fieldset', array('id' => 'settings_admin_ssl')); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         // TRANS: Fieldset legend in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2011-03-11 17:07:27 +01:00
										 |  |  |         $this->out->element('legend', null, _m('LEGEND','SSL')); | 
					
						
							| 
									
										
										
										
											2009-12-24 15:25:59 -06:00
										 |  |  |         $this->out->elementStart('ul', 'form_data'); | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         // TRANS: Drop down option in Paths admin panel (option for "When to use SSL").
 | 
					
						
							| 
									
										
										
										
											2009-12-24 15:25:59 -06:00
										 |  |  |         $ssl = array('never' => _('Never'), | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |                      // TRANS: Drop down option in Paths admin panel (option for "When to use SSL").
 | 
					
						
							| 
									
										
										
										
											2009-12-24 15:25:59 -06:00
										 |  |  |                      'sometimes' => _('Sometimes'), | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |                       // TRANS: Drop down option in Paths admin panel (option for "When to use SSL").
 | 
					
						
							| 
									
										
										
										
											2009-12-24 15:25:59 -06:00
										 |  |  |                      'always' => _('Always')); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->out->dropdown('site-ssl', | 
					
						
							| 
									
										
										
										
											2011-03-18 13:48:47 +01:00
										 |  |  |                              // TRANS: Drop down label in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |                              _('Use SSL'), | 
					
						
							|  |  |  |                              // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:29:59 +02:00
										 |  |  |                              $ssl, _('When to use SSL.'), | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |                              false, | 
					
						
							|  |  |  |                              $this->value('ssl', 'site')); | 
					
						
							| 
									
										
										
										
											2009-12-24 15:25:59 -06:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->li(); | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         $this->input('sslserver', | 
					
						
							|  |  |  |                      // TRANS: Field label in Paths admin panel.
 | 
					
						
							|  |  |  |                      _('SSL server'), | 
					
						
							|  |  |  |                      // TRANS: Tooltip for field label in Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-10-20 20:29:59 +02:00
										 |  |  |                      _('Server to direct SSL requests to.'), | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |                      'site'); | 
					
						
							| 
									
										
										
										
											2009-12-24 15:25:59 -06:00
										 |  |  |         $this->unli(); | 
					
						
							|  |  |  |         $this->out->elementEnd('ul'); | 
					
						
							|  |  |  |         $this->out->elementEnd('fieldset'); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Action elements | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function formActions() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-10-20 20:28:04 +02:00
										 |  |  |         // TRANS: Button text to store form data in the Paths admin panel.
 | 
					
						
							|  |  |  |         $this->out->submit('save', _m('BUTTON','Save'), 'submit', | 
					
						
							|  |  |  |                            // TRANS: Button title text to store form data in the Paths admin panel.
 | 
					
						
							| 
									
										
										
										
											2010-10-15 13:46:21 -04:00
										 |  |  |                            'save', _('Save paths')); | 
					
						
							| 
									
										
										
										
											2009-11-19 11:55:07 -08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Utility to simplify some of the duplicated code around | 
					
						
							|  |  |  |      * params and settings. Overriding the input() in the base class | 
					
						
							|  |  |  |      * to handle a whole bunch of cases of settings with the same | 
					
						
							|  |  |  |      * name under different sections. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $setting      Name of the setting | 
					
						
							|  |  |  |      * @param string $title        Title to use for the input | 
					
						
							|  |  |  |      * @param string $instructions Instructions for this field | 
					
						
							|  |  |  |      * @param string $section      config section, default = 'site' | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function input($setting, $title, $instructions, $section='site') | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->out->input("$section-$setting", $title, $this->value($setting, $section), $instructions); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |