diff --git a/administrator/components/com_admin/sql/updates/mysql/3.2.0.sql b/administrator/components/com_admin/sql/updates/mysql/3.2.0.sql index 9f3c26ddc700e..c7b583f693bb1 100644 --- a/administrator/components/com_admin/sql/updates/mysql/3.2.0.sql +++ b/administrator/components/com_admin/sql/updates/mysql/3.2.0.sql @@ -1,3 +1,17 @@ +# Placeholder file for database changes for version 3.2.0 +INSERT INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`) VALUES +(36, 1, 69, 70, 1, 'com_services', 'com_services', '{}'); + +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(30, 'com_services', 'component', 'com_services', '', 1, 1, 0, 0, '{"name":"com_services","type":"component","creationDate":"2013-06-31","author":"Joomla! Project","copyright":"Copyright Info","authorEmail":"Joomla@joomla.com","authorUrl":"http:\/\/joomla.org","version":"1.0.0","description":"Front End Admin Services Configuration Manager","group":""}', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(318, 'mod_admin_services', 'module', 'mod_admin_services', '', 0, 1, 0, 0, '{"name":"mod_admin_services","type":"module","creationDate":"June 2013","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2013 Open Source Matters. All rights\n\t\treserved.\n\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.2.0","description":"MOD_ADMIN_SERVICES_XML_DESCRIPTION","group":""}', '{"config_visible":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0); + +INSERT INTO `#__modules` (`title` , `note` , `content` , `ordering` , `position` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `published` , `module` , `access` , `showtitle` , `params` , `client_id` , `language`) VALUES +('Admin Services', '', '', 1, 'position-7', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_admin_services', 1, 1, '{"config_visible":"1","templates_visible":"1","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 0, '*'); + +INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES +(LAST_INSERT_ID(), 0); + CREATE TABLE IF NOT EXISTS `#__ucm_history` ( `version_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ucm_item_id` int(10) unsigned NOT NULL, diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.2.0.sql b/administrator/components/com_admin/sql/updates/postgresql/3.2.0.sql index bf7326a2b7b8b..cf2c97a8f6cb5 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/3.2.0.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/3.2.0.sql @@ -1,3 +1,17 @@ +# Placeholder file for database changes for version 3.2.0 +INSERT INTO "#__assets" ("id", "parent_id", "lft", "rgt", "level", "name", "title", "rules") VALUES +(36,1,69,70,1, 'com_services', 'com_services', '{}'); + +INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES +(30, 'com_services', 'component', 'com_services', '', 1, 1, 0, 0, '{"name":"com_services","type":"component","creationDate":"2013-06-31","author":"Joomla! Project","copyright":"Copyright Info","authorEmail":"Joomla@joomla.com","authorUrl":"http:\/\/joomla.org","version":"1.0.0","description":"Front End Admin Services Configuration Manager","group":""}', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(318, 'mod_admin_services', 'module', 'mod_admin_services', '', 0, 1, 0, 0, '{"name":"mod_admin_services","type":"module","creationDate":"June 2013","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2013 Open Source Matters. All rights\n\t\treserved.\n\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.2.0","description":"MOD_ADMIN_SERVICES_XML_DESCRIPTION","group":""}', '{"config_visible":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0); + +INSERT INTO "#__modules" ("title", "note", "content", "ordering", "position", "name", "checked_out", "checked_out_time", "publish_up", "publish_down", "published", "module", "access", "showtitle", "params", "client_id", "language") VALUES +('Admin Services', '', '', 1, 'position-7', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_admin_services', 1, 1, '{"config_visible":"1","templates_visible":"1","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 0, '*'); + +INSERT INTO "#__modules_menu" ("moduleid", "menuid") VALUES +(LAST_INSERT_ID(), 0); + INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES (31, 'com_ajax', 'component', 'com_ajax', '', 1, 1, 0, 0, '{"name":"com_ajax","type":"component","creationDate":"August 2013","author":"Joomla! Project","copyright":"(C) 2005 - 2013 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.2.0","description":"COM_AJAX_DESC","group":""}', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (105, 'FOF', 'library', 'fof', '', 0, 1, 1, 1, '{"legacy":false,"name":"FOF","type":"library","creationDate":"2013-09-03","author":"Nicholas K. Dionysopoulos \/ Akeeba Ltd","copyright":"(C)2011-2013 Nicholas K. Dionysopoulos","authorEmail":"nicholas@akeebabackup.com","authorUrl":"https:\/\/www.akeebabackup.com","version":"2.1.rc2","description":"Framework-on-Framework (FOF) - A rapid component development framework for Joomla!","group":""}', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0), diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.2.0.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.2.0.sql index f5593b09d81a7..a977f691b8320 100644 --- a/administrator/components/com_admin/sql/updates/sqlazure/3.2.0.sql +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.2.0.sql @@ -1,3 +1,27 @@ +# Placeholder file for database changes for version 3.2.0 +SET IDENTITY_INSERT #__assets ON; + +INSERT INTO #__assets (id,parent_id,lft,rgt,level,name,title,rules) +SELECT 36,1,69,70,1,'com_services','com_services','{}'; + +SET IDENTITY_INSERT #__assets OFF; + +SET IDENTITY_INSERT #__extensions ON; + +INSERT INTO #__extensions (extension_id, name, type, element, folder, client_id, enabled, access, protected, manifest_cache, params, custom_data, system_data, checked_out, checked_out_time, ordering, state) +SELECT 30, 'com_services', 'component', 'com_services', '', 1, 1, 0, 0, '{"name":"com_services","type":"component","creationDate":"2013-06-31","author":"Joomla! Project","copyright":"Copyright Info","authorEmail":"Joomla@joomla.com","authorUrl":"http:\/\/joomla.org","version":"1.0.0","description":"Front End Admin Services Configuration Manager","group":""}', '{}', '', '', 0, '1900-01-01 00:00:00', 0, 0 +UNION ALL +SELECT 318, 'mod_admin_services', 'module', 'mod_admin_services', '', 0, 1, 0, 0, '{"name":"mod_admin_services","type":"module","creationDate":"June 2013","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2013 Open Source Matters. All rights\n\t\treserved.\n\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.2.0","description":"MOD_ADMIN_SERVICES_XML_DESCRIPTION","group":""}', '{"config_visible":"1"}', '', '', 0, '1900-01-01 00:00:00', 0, 0; + +SET IDENTITY_INSERT #__extensions OFF; + +SET IDENTITY_INSERT #__modules ON; + +INSERT INTO #__modules (title, note, content, ordering, position, name, checked_out, checked_out_time, publish_up, publish_down, published, module, access, showtitle, params, client_id, language) +SELECT 'Admin Services', '', '', 1, 'position-7', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_admin_services', 1, 1, '{"config_visible":"1","templates_visible":"1","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 0, '*'; + +SET IDENTITY_INSERT #__modules OFF; + SET IDENTITY_INSERT #__extensions ON; INSERT INTO #__extensions (extension_id, name, type, element, folder, client_id, enabled, access, protected, manifest_cache, params, custom_data, system_data, checked_out, checked_out_time, ordering, state) diff --git a/administrator/components/com_config/access.xml b/administrator/components/com_config/access.xml new file mode 100644 index 0000000000000..f67aea973a22d --- /dev/null +++ b/administrator/components/com_config/access.xml @@ -0,0 +1,6 @@ + + +
+ +
+
\ No newline at end of file diff --git a/administrator/components/com_config/config.php b/administrator/components/com_config/config.php index d4b609276571c..33648c8f0783d 100644 --- a/administrator/components/com_config/config.php +++ b/administrator/components/com_config/config.php @@ -7,14 +7,40 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; -JHtml::_('behavior.tabstate'); +// No direct access +defined('_JEXEC') or die('Restricted access'); -// Access checks are done internally because of different requirements for the two controllers. +// Sessions +jimport('joomla.session.session'); + +// Load classes +JLoader::registerPrefix('Config', JPATH_COMPONENT); // Tell the browser not to cache this page. JFactory::getApplication()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT', true); -$controller = JControllerLegacy::getInstance('Config'); -$controller->execute(JFactory::getApplication()->input->get('task')); -$controller->redirect(); +// Application +$app = JFactory::getApplication(); + +$view = $app->input->get('view'); + +if (empty($view)) +{ + $app->input->set('view', 'application'); +} + +$controllerHelper = new JControllerHelper(); +$controller = $controllerHelper->parseController($app); + +$controller->prefix = 'Config'; + +// Check if component mentioned +$component = $app->input->get('component'); + +if (!empty($component)) +{ + $controller->component = $component; +} + +// Perform the Request task +$controller->execute(); diff --git a/administrator/components/com_config/config.xml b/administrator/components/com_config/config.xml index 45af554b59037..bbc8d23fcc9cd 100644 --- a/administrator/components/com_config/config.xml +++ b/administrator/components/com_config/config.xml @@ -16,7 +16,9 @@ index.html controllers models - views + controller + model + view language/en-GB.com_config.ini diff --git a/administrator/components/com_config/controller.php b/administrator/components/com_config/controller.php index dba68b1147fe8..0f0da805576a9 100644 --- a/administrator/components/com_config/controller.php +++ b/administrator/components/com_config/controller.php @@ -21,6 +21,7 @@ class ConfigController extends JControllerLegacy /** * @var string The default view. * @since 1.6 + * @deprecated 4.0 */ protected $default_view = 'application'; @@ -33,41 +34,28 @@ class ConfigController extends JControllerLegacy * @return JController This object to support chaining. * * @since 1.5 + * @deprecated 4.0 */ public function display($cachable = false, $urlparams = false) { - // Get the document object. - $document = JFactory::getDocument(); // Set the default view name and format from the Request. $vName = $this->input->get('view', 'application'); - $vFormat = $document->getType(); - $lName = $this->input->get('layout', 'default'); - // Get and render the view. - if ($view = $this->getView($vName, $vFormat)) - { - if ($vName != 'close') - { - // Get the model for the view. - $model = $this->getModel($vName); - - // Access check. - if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option'))) - { - return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); - } + JLog::add('ConfigController is deprecated. Use ConfigControllerApplicationDiaplay or ConfigControllerComponentDiaplay instead.', JLog::WARNING, 'deprecated'); - // Push the model into the view (as default). - $view->setModel($model, true); - } - - $view->setLayout($lName); + if (ucfirst($vName) == 'Application') + { + include_once JPATH_ADMINISTRATOR . '/components/com_config/controller/application/display.php'; + $controller = new ConfigControllerApplicationDisplay; + } + else if (ucfirst($vName) == 'Component') + { + include_once JPATH_ADMINISTRATOR . '/components/com_config/controller/component/display.php'; + $controller = new ConfigControllerComponentDisplay; + } - // Push document object into the view. - $view->document = $document; + return $controller->execute(); - $view->display(); - } } } diff --git a/administrator/components/com_config/controller/application/cancel.php b/administrator/components/com_config/controller/application/cancel.php new file mode 100644 index 0000000000000..c9622217cb896 --- /dev/null +++ b/administrator/components/com_config/controller/application/cancel.php @@ -0,0 +1,47 @@ +authorise('core.admin', 'com_config')) + { + JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); + + return; + } + + $this->context = 'com_config.config.global'; + + $this->redirect = 'index.php?option=com_cpanel'; + + parent::execute(); + + } +} diff --git a/administrator/components/com_config/controller/application/display.php b/administrator/components/com_config/controller/application/display.php new file mode 100644 index 0000000000000..bda1db32a0be3 --- /dev/null +++ b/administrator/components/com_config/controller/application/display.php @@ -0,0 +1,38 @@ +redirect(JRoute::_('index.php?option=com_config', false), JText::_('COM_CONFIG_ERROR_HELPREFRESH_FETCH'), 'error'); + } + elseif (!JFile::write(JPATH_BASE . '/help/helpsites.xml', $data)) + { + $app->redirect(JRoute::_('index.php?option=com_config', false), JText::_('COM_CONFIG_ERROR_HELPREFRESH_ERROR_STORE'), 'error'); + } + else + { + $app->redirect(JRoute::_('index.php?option=com_config', false), JText::_('COM_CONFIG_HELPREFRESH_SUCCESS')); + } + } +} diff --git a/administrator/components/com_config/controller/application/removeroot.php b/administrator/components/com_config/controller/application/removeroot.php new file mode 100644 index 0000000000000..9fce246cec059 --- /dev/null +++ b/administrator/components/com_config/controller/application/removeroot.php @@ -0,0 +1,67 @@ +redirect('index.php', JText::_('JINVALID_TOKEN')); + } + + // Check if the user is authorized to do this. + if (!JFactory::getUser()->authorise('core.admin')) + { + JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); + + return; + } + + // Initialise model. + $model = new ConfigModelsApplication; + + // Attempt to save the configuration and remove root. + $return = $model->removeroot(); + + // Check the return value. + if ($return === false) + { + // Save failed, go back to the screen and display a notice. + JFactory::getApplication()->redirect(JRoute::_('index.php', false), JText::sprintf('JERROR_SAVE_FAILED', $model->getError()), 'error'); + + return false; + } + + // Set the success message. + $message = JText::_('COM_CONFIG_SAVE_SUCCESS'); + + // Set the redirect based on the task. + JFactory::getApplication()->redirect(JRoute::_('index.php', false), $message); + + return true; + } +} diff --git a/administrator/components/com_config/controller/application/save.php b/administrator/components/com_config/controller/application/save.php new file mode 100644 index 0000000000000..639615b33aa1f --- /dev/null +++ b/administrator/components/com_config/controller/application/save.php @@ -0,0 +1,135 @@ +redirect('index.php', JText::_('JINVALID_TOKEN')); + } + + // Check if the user is authorized to do this. + if (!JFactory::getUser()->authorise('core.admin')) + { + JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); + + return; + } + + // Set FTP credentials, if given. + JClientHelper::setCredentialsFromRequest('ftp'); + + $app = JFactory::getApplication(); + $model = new ConfigModelApplication; + $data = $this->input->post->get('jform', array(), 'array'); + + // Complete data array if needed + $oldData = $model->getData(); + $data = array_replace($oldData, $data); + + // Get request type + $saveFormat = JFactory::getDocument()->getType(); + + // Handle service requests + if ($saveFormat == 'json') + { + $return = $model->save($data); + + return $return; + } + + // Must load after serving service-requests + $form = $model->getForm(); + + // Validate the posted data. + $return = $model->validate($form, $data); + + // Check for validation errors. + if ($return === false) + { + // Get the validation messages. + $errors = $model->getErrors(); + + // Push up to three validation messages out to the user. + for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) + { + if ($errors[$i] instanceof Exception) + { + $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); + } + else + { + $app->enqueueMessage($errors[$i], 'warning'); + } + } + + // Save the data in the session. + $app->setUserState('com_config.config.global.data', $data); + + // Redirect back to the edit screen. + $app->redirect(JRoute::_('index.php?option=com_config&controller=application.display', false)); + + return false; + } + + // Attempt to save the configuration. + $data = $return; + $return = $model->save($data); + + // Check the return value. + if ($return === false) + { + // Save the data in the session. + $app->setUserState('com_config.config.global.data', $data); + + // Save failed, go back to the screen and display a notice. + $message = JText::sprintf('JERROR_SAVE_FAILED', $model->getError()); + + $app->redirect(JRoute::_('index.php?option=com_config&controller=application.display', false), $message, 'error'); + + return false; + } + + // Set the success message. + $message = JText::_('COM_CONFIG_SAVE_SUCCESS'); + + // Set the redirect based on the task. + switch ($this->options[3]) + { + case 'apply': + $app->redirect(JRoute::_('index.php?option=com_config', false), $message); + break; + + case 'save': + default: + $app->redirect(JRoute::_('index.php', false), $message); + break; + } + + return true; + } +} diff --git a/administrator/components/com_config/controller/component/cancel.php b/administrator/components/com_config/controller/component/cancel.php new file mode 100644 index 0000000000000..0688ea640d56c --- /dev/null +++ b/administrator/components/com_config/controller/component/cancel.php @@ -0,0 +1,39 @@ +context = 'com_config.config.global'; + + + $this->redirect = 'index.php?option=' . $this->component; + + parent::execute(); + + } +} diff --git a/administrator/components/com_config/controller/component/display.php b/administrator/components/com_config/controller/component/display.php new file mode 100644 index 0000000000000..94e9966eb3547 --- /dev/null +++ b/administrator/components/com_config/controller/component/display.php @@ -0,0 +1,91 @@ +getApplication(); + + // Get the document object. + $document = JFactory::getDocument(); + + $viewName = $this->input->getWord('view', 'component'); + $viewFormat = $document->getType(); + $layoutName = $this->input->getWord('layout', 'default'); + + + + // Register the layout paths for the view + $paths = new SplPriorityQueue; + $paths->insert(JPATH_ADMINISTRATOR . '/components/com_config/view/' . $viewName . '/tmpl', 'normal'); + + $viewClass = 'ConfigView' . ucfirst($viewName) . ucfirst($viewFormat); + $modelClass = 'ConfigModel' . ucfirst($viewName); + + if (class_exists($viewClass)) + { + if ($viewName != 'close') + { + + $model = new $modelClass; + $state = $model->getState(); + + // Access check. + if (!JFactory::getUser()->authorise('core.admin', $state->get('component.option'))) + { + $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); + + return; + + } + + } + + $view = new $viewClass($model, $paths); + + $view->setLayout($layoutName); + + // Push document object into the view. + $view->document = $document; + + // Reply for service requests + if ($viewFormat == 'json') + { + + return $view->render(); + } + + // Render view. + echo $view->render(); + } + + return true; + } + +} +*/ \ No newline at end of file diff --git a/administrator/components/com_config/views/application/index.html b/administrator/components/com_config/controller/component/index.html similarity index 100% rename from administrator/components/com_config/views/application/index.html rename to administrator/components/com_config/controller/component/index.html diff --git a/administrator/components/com_config/controller/component/save.php b/administrator/components/com_config/controller/component/save.php new file mode 100644 index 0000000000000..3e40d6e35e9df --- /dev/null +++ b/administrator/components/com_config/controller/component/save.php @@ -0,0 +1,139 @@ +redirect('index.php', JText::_('JINVALID_TOKEN')); + } + + // Set FTP credentials, if given. + JClientHelper::setCredentialsFromRequest('ftp'); + + $app = JFactory::getApplication(); + $model = new ConfigModelComponent; + $form = $model->getForm(); + $data = $this->input->get('jform', array(), 'array'); + $id = $this->input->getInt('id'); + $option = $this->input->get('component'); + + // Check if the user is authorized to do this. + if (!JFactory::getUser()->authorise('core.admin', $option)) + { + JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); + + return; + } + + $returnUri = $this->input->post->get('return', null, 'base64'); + + if (!empty($returnUri)) + { + $redirect = '&return=' . urlencode($returnUri); + } + + // Validate the posted data. + $return = $model->validate($form, $data); + + // Check for validation errors. + if ($return === false) + { + // Get the validation messages. + $errors = $model->getErrors(); + + // Push up to three validation messages out to the user. + for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) + { + if ($errors[$i] instanceof Exception) + { + $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); + } + else + { + $app->enqueueMessage($errors[$i], 'warning'); + } + } + + // Save the data in the session. + $app->setUserState('com_config.config.global.data', $data); + + // Redirect back to the edit screen. + $app->redirect(JRoute::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false)); + + return false; + } + + // Attempt to save the configuration. + $data = array( + 'params' => $return, + 'id' => $id, + 'option' => $option + ); + $return = $model->save($data); + + // Check the return value. + if ($return === false) + { + // Save the data in the session. + $app->setUserState('com_config.config.global.data', $data); + + // Save failed, go back to the screen and display a notice. + $message = JText::sprintf('JERROR_SAVE_FAILED', $model->getError()); + + $app->redirect(JRoute::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false), $message, 'error'); + + return false; + } + + + // Set the redirect based on the task. + switch ($this->options[3]) + { + case 'apply': + $message = JText::_('COM_CONFIG_SAVE_SUCCESS'); + + $app->redirect(JRoute::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false), $message); + break; + + case 'save': + default: + $redirect = 'index.php?option=' . $this->component; + + if (!empty($returnUri)) + { + $redirect = base64_decode($returnUri); + } + + $app->redirect(JRoute::_($redirect, false)); + break; + } + + return true; + } +} diff --git a/administrator/components/com_config/controllers/application.php b/administrator/components/com_config/controllers/application.php index 03714275cdb33..c814046ee3fe5 100644 --- a/administrator/components/com_config/controllers/application.php +++ b/administrator/components/com_config/controllers/application.php @@ -15,6 +15,7 @@ * @package Joomla.Administrator * @subpackage com_config * @since 1.5 + * @deprecated 4.0 */ class ConfigControllerApplication extends JControllerLegacy { @@ -26,6 +27,7 @@ class ConfigControllerApplication extends JControllerLegacy * @return void * * @since 1.5 + * @deprecated 4.0 */ public function __construct($config = array()) { @@ -41,112 +43,46 @@ public function __construct($config = array()) * @return bool True on success, false on failure. * * @since 1.5 + * @deprecated 4.0 Use ConfigControllerApplicationSave instead. */ public function save() { - // Check for request forgeries. - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - - // Check if the user is authorized to do this. - if (!JFactory::getUser()->authorise('core.admin')) - { - $this->setRedirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); - $this->redirect(); - } - - // Set FTP credentials, if given. - JClientHelper::setCredentialsFromRequest('ftp'); - - $app = JFactory::getApplication(); - $model = $this->getModel('Application'); - $form = $model->getForm(); - $data = $this->input->post->get('jform', array(), 'array'); - - // Validate the posted data. - $return = $model->validate($form, $data); - - // Check for validation errors. - if ($return === false) - { - // Get the validation messages. - $errors = $model->getErrors(); - - // Push up to three validation messages out to the user. - for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) - { - if ($errors[$i] instanceof Exception) - { - $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); - } - else - { - $app->enqueueMessage($errors[$i], 'warning'); - } - } - - // Save the data in the session. - $app->setUserState('com_config.config.global.data', $data); - - // Redirect back to the edit screen. - $this->setRedirect(JRoute::_('index.php?option=com_config&view=application', false)); - return false; - } - - // Attempt to save the configuration. - $data = $return; - $return = $model->save($data); - - // Check the return value. - if ($return === false) - { - // Save the data in the session. - $app->setUserState('com_config.config.global.data', $data); - - // Save failed, go back to the screen and display a notice. - $message = JText::sprintf('JERROR_SAVE_FAILED', $model->getError()); - $this->setRedirect('index.php?option=com_config&view=application', $message, 'error'); - return false; - } - - // Set the success message. - $message = JText::_('COM_CONFIG_SAVE_SUCCESS'); - - // Set the redirect based on the task. - switch ($this->getTask()) - { - case 'apply': - $this->setRedirect('index.php?option=com_config', $message); - break; - - case 'save': - default: - $this->setRedirect('index.php', $message); - break; - } - - return true; + + JLog::add('ConfigControllerApplication is deprecated. Use ConfigControllerApplicationSave instead.', JLog::WARNING, 'deprecated'); + + + include_once JPATH_ADMINISTRATOR . '/components/com_config/controller/application/save.php'; + $controller = new ConfigControllerApplicationSave; + + return $controller->execute(); + } /** * Cancel operation + * @deprecated 4.0 Use ConfigControllerApplicationCancel instead. */ public function cancel() { - // Check if the user is authorized to do this. - if (!JFactory::getUser()->authorise('core.admin', 'com_config')) - { - $this->setRedirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); - $this->redirect(); - } - // Set FTP credentials, if given - JClientHelper::setCredentialsFromRequest('ftp'); + JLog::add('ConfigControllerApplication is deprecated. Use ConfigControllerApplicationCancel instead.', JLog::WARNING, 'deprecated'); - // Clean the session data. - $app = JFactory::getApplication(); - $app->setUserState('com_config.config.global.data', null); + include_once JPATH_ADMINISTRATOR . '/components/com_config/controller/application/cancel.php'; + $controller = new ConfigControllerApplicationCancel; + + return $controller->execute(); + } + + public function refreshHelp() + { + + JLog::add('ConfigControllerApplication is deprecated. Use ConfigControllerApplicationRefreshhelp instead.', JLog::WARNING, 'deprecated'); + + include_once JPATH_ADMINISTRATOR . '/components/com_config/controller/application/refreshhelp.php'; + $controller = new ConfigControllerApplicationRefreshhelp; + + $controller->execute(); - $this->setRedirect('index.php'); } /** @@ -155,40 +91,16 @@ public function cancel() * @return bool True on success, false on failure. * * @since 1.5 + * @deprecated 4.0 Use ConfigControllerApplicationRemoveroot instead. */ public function removeroot() { - // Check for request forgeries. - JSession::checkToken('get') or die('Invalid Token'); - - // Check if the user is authorized to do this. - if (!JFactory::getUser()->authorise('core.admin')) - { - $this->setRedirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); - $this->redirect(); - } - - // Initialise model. - $model = $this->getModel('Application'); - - // Attempt to save the configuration and remove root. - $return = $model->removeroot(); - - // Check the return value. - if ($return === false) - { - // Save failed, go back to the screen and display a notice. - $this->setMessage(JText::sprintf('JERROR_SAVE_FAILED', $model->getError()), 'error'); - $this->setRedirect('index.php'); - return false; - } - - // Set the success message. - $message = JText::_('COM_CONFIG_SAVE_SUCCESS'); - - // Set the redirect based on the task. - $this->setRedirect('index.php', $message); - - return true; + + JLog::add('ConfigControllerApplication is deprecated. Use ConfigControllerApplicationRemoveroot instead.', JLog::WARNING, 'deprecated'); + + include_once JPATH_ADMINISTRATOR . '/components/com_config/controller/application/removeroot.php'; + $controller = new ConfigControllerApplicationRemoveroot; + + return $controller->execute(); } } diff --git a/administrator/components/com_config/controllers/component.php b/administrator/components/com_config/controllers/component.php index fdf86fce88bda..ae64f67b6728f 100644 --- a/administrator/components/com_config/controllers/component.php +++ b/administrator/components/com_config/controllers/component.php @@ -15,6 +15,7 @@ * @package Joomla.Administrator * @subpackage com_config * @since 1.5 + * @deprecated 4.0 */ class ConfigControllerComponent extends JControllerLegacy { @@ -26,6 +27,7 @@ class ConfigControllerComponent extends JControllerLegacy * @return void * * @since 1.5 + * @deprecated 4.0 */ public function __construct($config = array()) { @@ -41,125 +43,30 @@ public function __construct($config = array()) * @return void * * @since 3.0 + * @deprecated 4.0 Use ConfigControllerComponentCancel instead. */ function cancel() { - // Clean the session data. - $app = JFactory::getApplication(); - $app->setUserState('com_config.config.global.data', null); - $return = $this->input->post->get('return', null, 'base64'); - $redirect = 'index.php'; - if (!empty($return)) - { - $redirect = base64_decode($return); - } + JLog::add('ConfigControllerComponent is deprecated. Use ConfigControllerComponentCancel instead.', JLog::WARNING, 'deprecated'); + include_once JPATH_ADMINISTRATOR . '/components/com_config/controller/component/cancel.php'; + $controller = new ConfigControllerComponentCancel; - $this->setRedirect($redirect); + $controller->execute(); } /** * Save the configuration + * @deprecated 4.0 Use ConfigControllerComponentSave instead. */ public function save() { - // Check for request forgeries. - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - // Set FTP credentials, if given. - JClientHelper::setCredentialsFromRequest('ftp'); + JLog::add('ConfigControllerComponent is deprecated. Use ConfigControllerComponentSave instead.', JLog::WARNING, 'deprecated'); + include_once JPATH_ADMINISTRATOR . '/components/com_config/controller/component/save.php'; + $controller = new ConfigControllerComponentSave; - $app = JFactory::getApplication(); - $model = $this->getModel('Component'); - $form = $model->getForm(); - $data = $this->input->get('jform', array(), 'array'); - $id = $this->input->getInt('id'); - $option = $this->input->get('component'); + return $controller->execute(); - // Check if the user is authorized to do this. - if (!JFactory::getUser()->authorise('core.admin', $option)) - { - $this->setRedirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); - $this->redirect(); - } - - $returnUri = $this->input->post->get('return', null, 'base64'); - if (!empty($returnUri)) - { - $redirect = '&return=' . urlencode($returnUri); - } - - // Validate the posted data. - $return = $model->validate($form, $data); - - // Check for validation errors. - if ($return === false) - { - // Get the validation messages. - $errors = $model->getErrors(); - - // Push up to three validation messages out to the user. - for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) - { - if ($errors[$i] instanceof Exception) - { - $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); - } - else - { - $app->enqueueMessage($errors[$i], 'warning'); - } - } - - // Save the data in the session. - $app->setUserState('com_config.config.global.data', $data); - - // Redirect back to the edit screen. - $this->setRedirect(JRoute::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false)); - return false; - } - - // Attempt to save the configuration. - $data = array( - 'params' => $return, - 'id' => $id, - 'option' => $option - ); - $return = $model->save($data); - - // Check the return value. - if ($return === false) - { - // Save the data in the session. - $app->setUserState('com_config.config.global.data', $data); - - // Save failed, go back to the screen and display a notice. - $message = JText::sprintf('JERROR_SAVE_FAILED', $model->getError()); - $this->setRedirect('index.php?option=com_config&view=component&component=' . $option . $redirect, $message, 'error'); - return false; - } - - // Set the redirect based on the task. - switch ($this->getTask()) - { - case 'apply': - $message = JText::_('COM_CONFIG_SAVE_SUCCESS'); - - $this->setRedirect('index.php?option=com_config&view=component&component=' . $option . $redirect, $message); - break; - - case 'save': - default: - $redirect = 'index.php'; - if (!empty($returnUri)) - { - $redirect = base64_decode($returnUri); - } - - $this->setRedirect($redirect); - break; - } - - return true; } } diff --git a/administrator/components/com_config/helper/component.php b/administrator/components/com_config/helper/config.php similarity index 98% rename from administrator/components/com_config/helper/component.php rename to administrator/components/com_config/helper/config.php index 6484c4576f9d5..52b2386261e5c 100644 --- a/administrator/components/com_config/helper/component.php +++ b/administrator/components/com_config/helper/config.php @@ -16,7 +16,7 @@ * @subpackage com_config * @since 3.0 */ -class ConfigHelperComponent +class ConfigHelperConfig extends JHelperContent { /** * Get an array of all enabled components. diff --git a/administrator/components/com_config/model/application.php b/administrator/components/com_config/model/application.php new file mode 100644 index 0000000000000..f93e67adb16df --- /dev/null +++ b/administrator/components/com_config/model/application.php @@ -0,0 +1,295 @@ +loadForm('com_config.application', 'application', array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($form)) + { + return false; + } + + return $form; + } + + /** + * Method to get the configuration data. + * + * This method will load the global configuration data straight from + * JConfig. If configuration data has been saved in the session, that + * data will be merged into the original data, overwriting it. + * + * @return array An array containg all global config data. + * + * @since 1.6 + */ + public function getData() + { + // Get the config data. + $config = new JConfig; + $data = JArrayHelper::fromObject($config); + + // Prime the asset_id for the rules. + $data['asset_id'] = 1; + + // Get the text filter data + $params = JComponentHelper::getParams('com_config'); + $data['filters'] = JArrayHelper::fromObject($params->get('filters')); + + // If no filter data found, get from com_content (update of 1.6/1.7 site) + if (empty($data['filters'])) + { + $contentParams = JComponentHelper::getParams('com_content'); + $data['filters'] = JArrayHelper::fromObject($contentParams->get('filters')); + } + + // Check for data in the session. + $temp = JFactory::getApplication()->getUserState('com_config.config.global.data'); + + // Merge in the session data. + if (!empty($temp)) + { + $data = array_merge($data, $temp); + } + + return $data; + } + + /** + * Method to save the configuration data. + * + * @param array $data An array containing all global config data. + * + * @return bool True on success, false on failure. + * + * @since 1.6 + */ + public function save($data) + { + // Save the rules + if (isset($data['rules'])) + { + $rules = new JAccessRules($data['rules']); + + // Check that we aren't removing our Super User permission + // Need to get groups from database, since they might have changed + $myGroups = JAccess::getGroupsByUser(JFactory::getUser()->get('id')); + $myRules = $rules->getData(); + $hasSuperAdmin = $myRules['core.admin']->allow($myGroups); + + if (!$hasSuperAdmin) + { + $this->setError(JText::_('COM_CONFIG_ERROR_REMOVING_SUPER_ADMIN')); + + return false; + } + + $asset = JTable::getInstance('asset'); + + if ($asset->loadByName('root.1')) + { + $asset->rules = (string) $rules; + + if (!$asset->check() || !$asset->store()) + { + $app->enqueueMessage(JText::_('SOME_ERROR_CODE'), 'error'); + + return; + + } + } + else + { + $this->setError(JText::_('COM_CONFIG_ERROR_ROOT_ASSET_NOT_FOUND')); + + return false; + } + unset($data['rules']); + } + + // Save the text filters + if (isset($data['filters'])) + { + $registry = new JRegistry; + $registry->loadArray(array('filters' => $data['filters'])); + + $extension = JTable::getInstance('extension'); + + // Get extension_id + $extension_id = $extension->find(array('name' => 'com_config')); + + if ($extension->load((int) $extension_id)) + { + $extension->params = (string) $registry; + + if (!$extension->check() || !$extension->store()) + { + $app->enqueueMessage(JText::_('SOME_ERROR_CODE'), 'error'); + + return; + + } + } + else + { + $this->setError(JText::_('COM_CONFIG_ERROR_CONFIG_EXTENSION_NOT_FOUND')); + + return false; + } + unset($data['filters']); + } + + // Get the previous configuration. + $prev = new JConfig; + $prev = JArrayHelper::fromObject($prev); + + // Merge the new data in. We do this to preserve values that were not in the form. + $data = array_merge($prev, $data); + + /* + * Perform miscellaneous options based on configuration settings/changes. + */ + // Escape the offline message if present. + if (isset($data['offline_message'])) + { + $data['offline_message'] = JFilterOutput::ampReplace($data['offline_message']); + } + + // Purge the database session table if we are changing to the database handler. + if ($prev['session_handler'] != 'database' && $data['session_handler'] == 'database') + { + $table = JTable::getInstance('session'); + $table->purge(-1); + } + + if (empty($data['cache_handler'])) + { + $data['caching'] = 0; + } + + // Clean the cache if disabled but previously enabled. + if (!$data['caching'] && $prev['caching']) + { + $cache = JFactory::getCache(); + $cache->clean(); + } + + // Create the new configuration object. + $config = new JRegistry('config'); + $config->loadArray($data); + + // Overwrite the old FTP credentials with the new ones. + $temp = JFactory::getConfig(); + $temp->set('ftp_enable', $data['ftp_enable']); + $temp->set('ftp_host', $data['ftp_host']); + $temp->set('ftp_port', $data['ftp_port']); + $temp->set('ftp_user', $data['ftp_user']); + $temp->set('ftp_pass', $data['ftp_pass']); + $temp->set('ftp_root', $data['ftp_root']); + + // Clear cache of com_config component. + $this->cleanCache('_system'); + + // Write the configuration file. + return $this->writeConfigFile($config); + } + + /** + * Method to unset the root_user value from configuration data. + * + * This method will load the global configuration data straight from + * JConfig and remove the root_user value for security, then save the configuration. + * + * @since 1.6 + */ + public function removeroot() + { + // Get the previous configuration. + $prev = new JConfig; + $prev = JArrayHelper::fromObject($prev); + + // Create the new configuration object, and unset the root_user property + $config = new JRegistry('config'); + unset($prev['root_user']); + $config->loadArray($prev); + + // Write the configuration file. + return $this->writeConfigFile($config); + } + + /** + * Method to write the configuration to a file. + * + * @param JRegistry $config A JRegistry object containing all global config data. + * + * @return bool True on success, false on failure. + * + * @since 2.5.4 + */ + private function writeConfigFile(JRegistry $config) + { + jimport('joomla.filesystem.path'); + jimport('joomla.filesystem.file'); + + // Set the configuration file path. + $file = JPATH_CONFIGURATION . '/configuration.php'; + + // Get the new FTP credentials. + $ftp = JClientHelper::getCredentials('ftp', true); + + $app = JFactory::getApplication(); + + // Attempt to make the file writeable if using FTP. + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) + { + $app->enqueueMessage(JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'), 'notice'); + + } + + // Attempt to write the configuration file as a PHP class named JConfig. + $configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false)); + + if (!JFile::write($file, $configuration)) + { + $app->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error'); + + return false; + } + + // Attempt to make the file unwriteable if using FTP. + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) + { + $app->enqueueMessage(JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'), 'notice'); + } + + return true; + } +} diff --git a/administrator/components/com_config/model/component.php b/administrator/components/com_config/model/component.php new file mode 100644 index 0000000000000..ec411597de351 --- /dev/null +++ b/administrator/components/com_config/model/component.php @@ -0,0 +1,198 @@ +input; + + // Set the component (option) we are dealing with. + $component = $input->get('component'); + $state = $this->loadState(); + $state->set('component.option', $component); + + // Set an alternative path for the configuration file. + if ($path = $input->getString('path')) + { + $path = JPath::clean(JPATH_SITE . '/' . $path); + JPath::check($path); + $state->set('component.path', $path); + } + + $this->setState($state); + + } + + /** + * Method to get a form object. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true) + { + $state = $this->getState(); + + if ($path = $state->get('component.path')) + { + // Add the search path for the admin component config.xml file. + JForm::addFormPath($path); + } + else + { + // Add the search path for the admin component config.xml file. + JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/' . $state->get('component.option')); + } + + // Get the form. + $form = $this->loadForm( + 'com_config.component', + 'config', + array('control' => 'jform', 'load_data' => $loadData), + false, + '/config' + ); + + if (empty($form)) + { + + return false; + } + + return $form; + } + + /** + * Get the component information. + * + * @return object + * + * @since 1.6 + */ + function getComponent() + { + $state = $this->getState(); + $option = $state->get('component.option'); + + // Load common and local language files. + $lang = JFactory::getLanguage(); + $lang->load($option, JPATH_BASE, null, false, false) + || $lang->load($option, JPATH_BASE . "/components/$option", null, false, false) + || $lang->load($option, JPATH_BASE, $lang->getDefault(), false, false) + || $lang->load($option, JPATH_BASE . "/components/$option", $lang->getDefault(), false, false); + + $result = JComponentHelper::getComponent($option); + + return $result; + } + + /** + * Method to save the configuration data. + * + * @param array $data An array containing all global config data. + * + * @return bool True on success, false on failure. + * + * @since 1.6 + */ + public function save($data) + { + $table = JTable::getInstance('extension'); + + // Save the rules. + if (isset($data['params']) && isset($data['params']['rules'])) + { + $rules = new JAccessRules($data['params']['rules']); + $asset = JTable::getInstance('asset'); + + if (!$asset->loadByName($data['option'])) + { + $root = JTable::getInstance('asset'); + $root->loadByName('root.1'); + $asset->name = $data['option']; + $asset->title = $data['option']; + $asset->setLocation($root->id, 'last-child'); + } + $asset->rules = (string) $rules; + + if (!$asset->check() || !$asset->store()) + { + $this->setError($asset->getError()); + + return false; + } + + // We don't need this anymore + unset($data['option']); + unset($data['params']['rules']); + } + + // Load the previous Data + if (!$table->load($data['id'])) + { + $this->setError($table->getError()); + + return false; + } + + unset($data['id']); + + // Bind the data. + if (!$table->bind($data)) + { + $this->setError($table->getError()); + + return false; + } + + // Check the data. + if (!$table->check()) + { + $this->setError($table->getError()); + + return false; + } + + // Store the data. + if (!$table->store()) + { + $this->setError($table->getError()); + + return false; + } + + // Clean the component cache. + $this->cleanCache('_system'); + + return true; + } +} diff --git a/administrator/components/com_config/model/field/filters.php b/administrator/components/com_config/model/field/filters.php new file mode 100644 index 0000000000000..9ae55d54e0a28 --- /dev/null +++ b/administrator/components/com_config/model/field/filters.php @@ -0,0 +1,132 @@ +getUserGroups(); + // Build the form control. + $html = array(); + + // Open the table. + $html[] = ''; + + // The table heading. + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + + // The table body. + $html[] = ' '; + + foreach ($groups as $group) { + if (!isset($this->value[$group->value])) { + $this->value[$group->value] = array('filter_type' => 'BL', 'filter_tags' => '', 'filter_attributes' => ''); + } + $group_filter = $this->value[$group->value]; + + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + } + $html[] = ' '; + + // Close the table. + $html[] = '
'; + $html[] = ' '.JText::_('JGLOBAL_FILTER_GROUPS_LABEL').''; + $html[] = ' '; + $html[] = ' '.JText::_('JGLOBAL_FILTER_TYPE_LABEL').''; + $html[] = ' '; + $html[] = ' '.JText::_('JGLOBAL_FILTER_TAGS_LABEL').''; + $html[] = ' '; + $html[] = ' '.JText::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL').''; + $html[] = '
'; + $html[] = ' '.str_repeat('|—', $group->level).$group->text; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = ' '; + $html[] = '
'; + + // Add notes + $html[] = '
'; + $html[] = '

' . JText::_('JGLOBAL_FILTER_TYPE_DESC') . '

'; + $html[] = '

' . JText::_('JGLOBAL_FILTER_TAGS_DESC') . '

'; + $html[] = '

' . JText::_('JGLOBAL_FILTER_ATTRIBUTES_DESC') . '

'; + $html[] = '
'; + + return implode("\n", $html); + } + + /** + * A helper to get the list of user groups. + * + * @return array + * @since 1.6 + */ + protected function getUserGroups() + { + // Get a database object. + $db = JFactory::getDBO(); + // Get the user groups from the database. + $query = $db->getQuery(true); + $query->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level'); + $query->from('#__usergroups AS a'); + $query->join('LEFT', '#__usergroups AS b on a.lft > b.lft AND a.rgt < b.rgt'); + $query->group('a.id, a.title, a.lft'); + $query->order('a.lft ASC'); + $db->setQuery($query); + $options = $db->loadObjectList(); + + return $options; + } +} diff --git a/administrator/components/com_config/models/fields/index.html b/administrator/components/com_config/model/field/index.html similarity index 100% rename from administrator/components/com_config/models/fields/index.html rename to administrator/components/com_config/model/field/index.html diff --git a/administrator/components/com_config/models/forms/application.xml b/administrator/components/com_config/model/form/application.xml similarity index 100% rename from administrator/components/com_config/models/forms/application.xml rename to administrator/components/com_config/model/form/application.xml diff --git a/administrator/components/com_config/views/application/tmpl/index.html b/administrator/components/com_config/model/form/index.html similarity index 100% rename from administrator/components/com_config/views/application/tmpl/index.html rename to administrator/components/com_config/model/form/index.html diff --git a/administrator/components/com_config/views/close/index.html b/administrator/components/com_config/model/index.html similarity index 100% rename from administrator/components/com_config/views/close/index.html rename to administrator/components/com_config/model/index.html diff --git a/administrator/components/com_config/models/application.php b/administrator/components/com_config/models/application.php index a43440a3f848d..2e8486c8f1907 100644 --- a/administrator/components/com_config/models/application.php +++ b/administrator/components/com_config/models/application.php @@ -14,266 +14,8 @@ * * @package Joomla.Administrator * @subpackage com_config + * @deprecated 4.0 */ -class ConfigModelApplication extends JModelForm -{ - /** - * Method to get a form object. - * - * @param array $data Data for the form. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * - * @return mixed A JForm object on success, false on failure - * - * @since 1.6 - */ - public function getForm($data = array(), $loadData = true) - { - // Get the form. - $form = $this->loadForm('com_config.application', 'application', array('control' => 'jform', 'load_data' => $loadData)); - if (empty($form)) - { - return false; - } - return $form; - } - - /** - * Method to get the configuration data. - * - * This method will load the global configuration data straight from - * JConfig. If configuration data has been saved in the session, that - * data will be merged into the original data, overwriting it. - * - * @return array An array containg all global config data. - * - * @since 1.6 - */ - public function getData() - { - // Get the config data. - $config = new JConfig; - $data = JArrayHelper::fromObject($config); - - // Prime the asset_id for the rules. - $data['asset_id'] = 1; - - // Get the text filter data - $params = JComponentHelper::getParams('com_config'); - $data['filters'] = JArrayHelper::fromObject($params->get('filters')); - - // If no filter data found, get from com_content (update of 1.6/1.7 site) - if (empty($data['filters'])) - { - $contentParams = JComponentHelper::getParams('com_content'); - $data['filters'] = JArrayHelper::fromObject($contentParams->get('filters')); - } - - // Check for data in the session. - $temp = JFactory::getApplication()->getUserState('com_config.config.global.data'); - - // Merge in the session data. - if (!empty($temp)) - { - $data = array_merge($data, $temp); - } - - $this->preprocessData('com_config.application', $data); - - return $data; - } - - /** - * Method to save the configuration data. - * - * @param array $data An array containing all global config data. - * - * @return bool True on success, false on failure. - * - * @since 1.6 - */ - public function save($data) - { - // Save the rules - if (isset($data['rules'])) - { - $rules = new JAccessRules($data['rules']); - - // Check that we aren't removing our Super User permission - // Need to get groups from database, since they might have changed - $myGroups = JAccess::getGroupsByUser(JFactory::getUser()->get('id')); - $myRules = $rules->getData(); - $hasSuperAdmin = $myRules['core.admin']->allow($myGroups); - if (!$hasSuperAdmin) - { - $this->setError(JText::_('COM_CONFIG_ERROR_REMOVING_SUPER_ADMIN')); - return false; - } - - $asset = JTable::getInstance('asset'); - if ($asset->loadByName('root.1')) - { - $asset->rules = (string) $rules; - - if (!$asset->check() || !$asset->store()) - { - JError::raiseNotice('SOME_ERROR_CODE', $asset->getError()); - } - } - else - { - $this->setError(JText::_('COM_CONFIG_ERROR_ROOT_ASSET_NOT_FOUND')); - return false; - } - unset($data['rules']); - } - - // Save the text filters - if (isset($data['filters'])) - { - $registry = new JRegistry; - $registry->loadArray(array('filters' => $data['filters'])); - - $extension = JTable::getInstance('extension'); - - // Get extension_id - $extension_id = $extension->find(array('name' => 'com_config')); - - if ($extension->load((int) $extension_id)) - { - $extension->params = (string) $registry; - if (!$extension->check() || !$extension->store()) - { - JError::raiseNotice('SOME_ERROR_CODE', $extension->getError()); - } - } - else - { - $this->setError(JText::_('COM_CONFIG_ERROR_CONFIG_EXTENSION_NOT_FOUND')); - return false; - } - unset($data['filters']); - } - - // Get the previous configuration. - $prev = new JConfig; - $prev = JArrayHelper::fromObject($prev); - - // Merge the new data in. We do this to preserve values that were not in the form. - $data = array_merge($prev, $data); - - /* - * Perform miscellaneous options based on configuration settings/changes. - */ - // Escape the offline message if present. - if (isset($data['offline_message'])) - { - $data['offline_message'] = JFilterOutput::ampReplace($data['offline_message']); - } - - // Purge the database session table if we are changing to the database handler. - if ($prev['session_handler'] != 'database' && $data['session_handler'] == 'database') - { - $table = JTable::getInstance('session'); - $table->purge(-1); - } - - if (empty($data['cache_handler'])) - { - $data['caching'] = 0; - } - - // Clean the cache if disabled but previously enabled. - if (!$data['caching'] && $prev['caching']) - { - $cache = JFactory::getCache(); - $cache->clean(); - } - - // Create the new configuration object. - $config = new JRegistry('config'); - $config->loadArray($data); - - // Overwrite the old FTP credentials with the new ones. - $temp = JFactory::getConfig(); - $temp->set('ftp_enable', $data['ftp_enable']); - $temp->set('ftp_host', $data['ftp_host']); - $temp->set('ftp_port', $data['ftp_port']); - $temp->set('ftp_user', $data['ftp_user']); - $temp->set('ftp_pass', $data['ftp_pass']); - $temp->set('ftp_root', $data['ftp_root']); - - // Clear cache of com_config component. - $this->cleanCache('_system'); - - // Write the configuration file. - return $this->writeConfigFile($config); - } - - /** - * Method to unset the root_user value from configuration data. - * - * This method will load the global configuration data straight from - * JConfig and remove the root_user value for security, then save the configuration. - * - * @since 1.6 - */ - public function removeroot() - { - // Get the previous configuration. - $prev = new JConfig; - $prev = JArrayHelper::fromObject($prev); - - // Create the new configuration object, and unset the root_user property - $config = new JRegistry('config'); - unset($prev['root_user']); - $config->loadArray($prev); - - // Write the configuration file. - return $this->writeConfigFile($config); - } - - /** - * Method to write the configuration to a file. - * - * @param JRegistry $config A JRegistry object containing all global config data. - * - * @return bool True on success, false on failure. - * - * @since 2.5.4 - */ - private function writeConfigFile(JRegistry $config) - { - jimport('joomla.filesystem.path'); - jimport('joomla.filesystem.file'); - - // Set the configuration file path. - $file = JPATH_CONFIGURATION . '/configuration.php'; - - // Get the new FTP credentials. - $ftp = JClientHelper::getCredentials('ftp', true); - - // Attempt to make the file writeable if using FTP. - if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) - { - JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE')); - } - - // Attempt to write the configuration file as a PHP class named JConfig. - $configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false)); - if (!JFile::write($file, $configuration)) - { - $this->setError(JText::_('COM_CONFIG_ERROR_WRITE_FAILED')); - return false; - } - - // Attempt to make the file unwriteable if using FTP. - if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) - { - JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE')); - } - - return true; - } -} +JLog::add('models/ConfigModelApplication is deprecated. Use model/ConfigModelApplication instead.', JLog::WARNING, 'deprecated'); +include_once JPATH_ADMINISTRATOR . '/components/com_config/model/application.php'; diff --git a/administrator/components/com_config/models/component.php b/administrator/components/com_config/models/component.php index e19f0839b82e5..2cd09c4f58d66 100644 --- a/administrator/components/com_config/models/component.php +++ b/administrator/components/com_config/models/component.php @@ -15,203 +15,8 @@ * @package Joomla.Administrator * @subpackage com_config * @since 1.5 + * @deprecated 4.0 */ -class ConfigModelComponent extends JModelForm -{ - /** - * The event to trigger before saving the data. - * - * @var string - * @since 3.1.0 - */ - protected $event_before_save = 'onConfigurationBeforeSave'; - /** - * The event to trigger before deleting the data. - * - * @var string - * @since 3.1.0 - */ - protected $event_after_save = 'onConfigurationAfterSave'; - - /** - * Method to auto-populate the model state. - * - * Note. Calling getState in this method will result in recursion. - * - * @return void - * - * @since 1.6 - */ - protected function populateState() - { - $input = JFactory::getApplication()->input; - - // Set the component (option) we are dealing with. - $component = $input->get('component'); - $this->setState('component.option', $component); - - // Set an alternative path for the configuration file. - if ($path = $input->getString('path')) - { - $path = JPath::clean(JPATH_SITE . '/' . $path); - JPath::check($path); - $this->setState('component.path', $path); - } - } - - /** - * Method to get a form object. - * - * @param array $data Data for the form. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * - * @return mixed A JForm object on success, false on failure - * - * @since 1.6 - */ - public function getForm($data = array(), $loadData = true) - { - if ($path = $this->getState('component.path')) - { - // Add the search path for the admin component config.xml file. - JForm::addFormPath($path); - } - else - { - // Add the search path for the admin component config.xml file. - JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/' . $this->getState('component.option')); - } - - // Get the form. - $form = $this->loadForm( - 'com_config.component', - 'config', - array('control' => 'jform', 'load_data' => $loadData), - false, - '/config' - ); - - if (empty($form)) - { - return false; - } - - return $form; - } - - /** - * Get the component information. - * - * @return object - * - * @since 1.6 - */ - function getComponent() - { - $option = $this->getState('component.option'); - - // Load common and local language files. - $lang = JFactory::getLanguage(); - $lang->load($option, JPATH_BASE, null, false, false) - || $lang->load($option, JPATH_BASE . "/components/$option", null, false, false) - || $lang->load($option, JPATH_BASE, $lang->getDefault(), false, false) - || $lang->load($option, JPATH_BASE . "/components/$option", $lang->getDefault(), false, false); - - $result = JComponentHelper::getComponent($option); - - $this->preprocessData('com_config.component', $result); - - return $result; - } - - /** - * Method to save the configuration data. - * - * @param array $data An array containing all global config data. - * - * @return bool True on success, false on failure. - * - * @since 1.6 - */ - public function save($data) - { - $dispatcher = JEventDispatcher::getInstance(); - $table = JTable::getInstance('extension'); - $isNew = true; - - // Save the rules. - if (isset($data['params']) && isset($data['params']['rules'])) - { - $rules = new JAccessRules($data['params']['rules']); - $asset = JTable::getInstance('asset'); - - if (!$asset->loadByName($data['option'])) - { - $root = JTable::getInstance('asset'); - $root->loadByName('root.1'); - $asset->name = $data['option']; - $asset->title = $data['option']; - $asset->setLocation($root->id, 'last-child'); - } - $asset->rules = (string) $rules; - - if (!$asset->check() || !$asset->store()) - { - $this->setError($asset->getError()); - return false; - } - - // We don't need this anymore - unset($data['option']); - unset($data['params']['rules']); - } - - // Load the previous Data - if (!$table->load($data['id'])) - { - $this->setError($table->getError()); - return false; - } - - unset($data['id']); - - // Bind the data. - if (!$table->bind($data)) - { - $this->setError($table->getError()); - return false; - } - - // Check the data. - if (!$table->check()) - { - $this->setError($table->getError()); - return false; - } - - // Trigger the onConfigurationBeforeSave event. - $result = $dispatcher->trigger($this->event_before_save, array($this->option . '.' . $this->name, $table, $isNew)); - - if (in_array(false, $result, true)) - { - $this->setError($table->getError()); - return false; - } - - // Store the data. - if (!$table->store()) - { - $this->setError($table->getError()); - return false; - } - - // Clean the component cache. - $this->cleanCache('_system'); - - // Trigger the onConfigurationAfterSave event. - $dispatcher->trigger($this->event_after_save, array($this->option . '.' . $this->name, $table, $isNew)); - - return true; - } -} +JLog::add('models/ConfigModelComponent is deprecated. Use model/ConfigModelComponent instead.', JLog::WARNING, 'deprecated'); +include_once JPATH_ADMINISTRATOR . '/components/com_config/model/component.php'; diff --git a/administrator/components/com_config/models/fields/filters.php b/administrator/components/com_config/models/fields/filters.php deleted file mode 100644 index f5964cb4242f0..0000000000000 --- a/administrator/components/com_config/models/fields/filters.php +++ /dev/null @@ -1,136 +0,0 @@ -getUserGroups(); - // Build the form control. - $html = array(); - - // Open the table. - $html[] = ''; - - // The table heading. - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - - // The table body. - $html[] = ' '; - - foreach ($groups as $group) - { - if (!isset($this->value[$group->value])) - { - $this->value[$group->value] = array('filter_type' => 'BL', 'filter_tags' => '', 'filter_attributes' => ''); - } - $group_filter = $this->value[$group->value]; - - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - } - $html[] = ' '; - - // Close the table. - $html[] = '
'; - $html[] = ' ' . JText::_('JGLOBAL_FILTER_GROUPS_LABEL') . ''; - $html[] = ' '; - $html[] = ' ' . JText::_('JGLOBAL_FILTER_TYPE_LABEL') . ''; - $html[] = ' '; - $html[] = ' ' . JText::_('JGLOBAL_FILTER_TAGS_LABEL') . ''; - $html[] = ' '; - $html[] = ' ' . JText::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL') . ''; - $html[] = '
'; - $html[] = ' ' . str_repeat('|—', $group->level) . $group->text; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = ' '; - $html[] = '
'; - - // Add notes - $html[] = '
'; - $html[] = '

' . JText::_('JGLOBAL_FILTER_TYPE_DESC') . '

'; - $html[] = '

' . JText::_('JGLOBAL_FILTER_TAGS_DESC') . '

'; - $html[] = '

' . JText::_('JGLOBAL_FILTER_ATTRIBUTES_DESC') . '

'; - $html[] = '
'; - - return implode("\n", $html); - } - - /** - * A helper to get the list of user groups. - * - * @return array - * - * @since 1.6 - */ - protected function getUserGroups() - { - // Get a database object. - $db = JFactory::getDbo(); - // Get the user groups from the database. - $query = $db->getQuery(true) - ->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level') - ->from('#__usergroups AS a') - ->join('LEFT', '#__usergroups AS b on a.lft > b.lft AND a.rgt < b.rgt') - ->group('a.id, a.title, a.lft') - ->order('a.lft ASC'); - $db->setQuery($query); - $options = $db->loadObjectList(); - - return $options; - } -} diff --git a/administrator/components/com_config/models/index.html b/administrator/components/com_config/models/index.html index 2efb97f319a35..3af63015d2219 100644 --- a/administrator/components/com_config/models/index.html +++ b/administrator/components/com_config/models/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/administrator/components/com_config/views/application/view.html.php b/administrator/components/com_config/view/application/html.php similarity index 59% rename from administrator/components/com_config/views/application/view.html.php rename to administrator/components/com_config/view/application/html.php index c2328187b0e10..73976bf99f9cd 100644 --- a/administrator/components/com_config/views/application/view.html.php +++ b/administrator/components/com_config/view/application/html.php @@ -3,22 +3,21 @@ * @package Joomla.Administrator * @subpackage com_config * - * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; -require_once dirname(dirname(__DIR__)) . '/helper/component.php'; /** * View for the global configuration * * @package Joomla.Administrator * @subpackage com_config - * @since 1.5 + * @since 3.2 */ -class ConfigViewApplication extends JViewLegacy +class ConfigViewApplicationHtml extends JViewHtmlCms { public $state; @@ -28,26 +27,36 @@ class ConfigViewApplication extends JViewLegacy /** * Method to display the view. + * + * @param string $tpl Layout + * + * @return void + * */ - public function display($tpl = null) + public function render() { - $form = $this->get('Form'); - $data = $this->get('Data'); - $user = JFactory::getUser(); + $form = null; + $data = null; + + try + { + // Load Form and Data + $form = $this->model->getForm(); + $data = $this->model->getData(); + $user = JFactory::getUser(); + $app = JFactory::getApplication(); - // Check for model errors. - if ($errors = $this->get('Errors')) + } + catch (Exception $e) { - JError::raiseError(500, implode('
', $errors)); - return false; + $app->enqueueMessage($e->getMessage(), 'error'); } - // Bind the form to the data. + // Bind data if ($form && $data) { $form->bind($data); } - // Get the params for com_users. $usersParams = JComponentHelper::getParams('com_users'); @@ -63,27 +72,29 @@ public function display($tpl = null) $this->usersParams = &$usersParams; $this->mediaParams = &$mediaParams; - $this->components = ConfigHelperComponent::getComponentsWithConfig(); - ConfigHelperComponent::loadLanguageForComponents($this->components); + $this->components = ConfigHelperConfig::getComponentsWithConfig(); + ConfigHelperConfig::loadLanguageForComponents($this->components); $this->userIsSuperAdmin = $user->authorise('core.admin'); $this->addToolbar(); - parent::display($tpl); + return parent::render(); } /** * Add the page title and toolbar. * - * @since 1.6 + * @return void + * + * @since 3.2 */ protected function addToolbar() { JToolbarHelper::title(JText::_('COM_CONFIG_GLOBAL_CONFIGURATION'), 'config.png'); - JToolbarHelper::apply('application.apply'); - JToolbarHelper::save('application.save'); + JToolbarHelper::apply('config.save.application.apply'); + JToolbarHelper::save('config.save.application'); JToolbarHelper::divider(); - JToolbarHelper::cancel('application.cancel'); + JToolbarHelper::cancel('config.cancel.application'); JToolbarHelper::divider(); JToolbarHelper::help('JHELP_SITE_GLOBAL_CONFIGURATION'); } diff --git a/administrator/components/com_config/views/component/index.html b/administrator/components/com_config/view/application/index.html similarity index 100% rename from administrator/components/com_config/views/component/index.html rename to administrator/components/com_config/view/application/index.html diff --git a/administrator/components/com_config/view/application/json.php b/administrator/components/com_config/view/application/json.php new file mode 100644 index 0000000000000..e83771796b2ff --- /dev/null +++ b/administrator/components/com_config/view/application/json.php @@ -0,0 +1,73 @@ +data = $this->model->getData(); + + try + { + $user = JFactory::getUser(); + $app = JFactory::getApplication(); + } + catch (Exception $e) + { + $app->enqueueMessage($e->getMessage(), 'error'); + } + + $this->userIsSuperAdmin = $user->authorise('core.admin'); + + // Required data + $requiredData = array("sitename" => null, + "offline" => null, + "access" => null, + "list_limit" => null, + "MetaDesc" => null, + "MetaKeys" => null, + "MetaRights" => null, + "sef" => null, + "sitename_pagetitles" => null, + "debug" => null, + "debug_lang" =>null, + "error_reporting" => null, + "mailfrom" => null, + "fromname" => null + ); + + $this->data = array_intersect_key($this->data,$requiredData); + + return json_encode($this->data); + } + +} diff --git a/administrator/components/com_config/view/application/tmpl/default.php b/administrator/components/com_config/view/application/tmpl/default.php new file mode 100644 index 0000000000000..63db7814551cc --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default.php @@ -0,0 +1,114 @@ + + + +
+
+ + + + +
+ +
+
+
+
+ loadTemplate('site'); ?> + loadTemplate('metadata'); ?> +
+
+ loadTemplate('seo'); ?> + loadTemplate('cookie'); ?> +
+
+
+
+
+
+ loadTemplate('system'); ?> + loadTemplate('debug'); ?> + loadTemplate('cache'); ?> + loadTemplate('session'); ?> +
+
+
+
+
+
+ loadTemplate('server'); ?> + loadTemplate('locale'); ?> + loadTemplate('ftp'); ?> +
+
+ loadTemplate('database'); ?> + loadTemplate('mail'); ?> +
+
+
+
+
+ loadTemplate('permissions'); ?> +
+
+
+
+ loadTemplate('filters'); ?> +
+
+ ftp) : ?> +
+ loadTemplate('ftplogin'); ?> +
+ + + +
+
+ +
+
diff --git a/administrator/components/com_config/view/application/tmpl/default_cache.php b/administrator/components/com_config/view/application/tmpl/default_cache.php new file mode 100644 index 0000000000000..2869ed0f4955a --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_cache.php @@ -0,0 +1,42 @@ + +
+ + form->getFieldset('cache') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ + data['cache_handler']) && + $this->data['cache_handler'] == 'memcache' || + $this->data['session_handler'] == 'memcache' || + $this->data['cache_handler'] == 'memcached' || + $this->data['session_handler'] == 'memcached' + ) : ?> + + form->getFieldset('memcache') as $mfield): + ?> +
+
label; ?>
+
input; ?>
+
+ + +
diff --git a/administrator/components/com_config/view/application/tmpl/default_cookie.php b/administrator/components/com_config/view/application/tmpl/default_cookie.php new file mode 100644 index 0000000000000..287b7e37e1da0 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_cookie.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('cookie') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_database.php b/administrator/components/com_config/view/application/tmpl/default_database.php new file mode 100644 index 0000000000000..e3d0edcbe9441 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_database.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('database') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_debug.php b/administrator/components/com_config/view/application/tmpl/default_debug.php new file mode 100644 index 0000000000000..b03efad410cfa --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_debug.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('debug') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_filters.php b/administrator/components/com_config/view/application/tmpl/default_filters.php new file mode 100644 index 0000000000000..109557b46048e --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_filters.php @@ -0,0 +1,21 @@ + +
+ +

+ form->getFieldset('filters') as $field): ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_ftp.php b/administrator/components/com_config/view/application/tmpl/default_ftp.php new file mode 100644 index 0000000000000..5b9f9f8df0cfd --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_ftp.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('ftp') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/views/application/tmpl/default_ftplogin.php b/administrator/components/com_config/view/application/tmpl/default_ftplogin.php similarity index 67% rename from administrator/components/com_config/views/application/tmpl/default_ftplogin.php rename to administrator/components/com_config/view/application/tmpl/default_ftplogin.php index 625ad800c2ade..b5f6beeab5267 100644 --- a/administrator/components/com_config/views/application/tmpl/default_ftplogin.php +++ b/administrator/components/com_config/view/application/tmpl/default_ftplogin.php @@ -3,7 +3,7 @@ * @package Joomla.Administrator * @subpackage com_config * - * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -12,19 +12,15 @@
- ftp instanceof Exception) : ?> + ftp instanceof Exception): ?>

ftp->message); ?>

-
- -
+
-
- -
+
diff --git a/administrator/components/com_config/view/application/tmpl/default_locale.php b/administrator/components/com_config/view/application/tmpl/default_locale.php new file mode 100644 index 0000000000000..0178d1a7de627 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_locale.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('locale') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_mail.php b/administrator/components/com_config/view/application/tmpl/default_mail.php new file mode 100644 index 0000000000000..25531129e88b5 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_mail.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('mail') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_metadata.php b/administrator/components/com_config/view/application/tmpl/default_metadata.php new file mode 100644 index 0000000000000..f28e0f50a82c5 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_metadata.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('metadata') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_navigation.php b/administrator/components/com_config/view/application/tmpl/default_navigation.php new file mode 100644 index 0000000000000..9b5570b8c7db1 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_navigation.php @@ -0,0 +1,30 @@ + + diff --git a/administrator/components/com_config/view/application/tmpl/default_permissions.php b/administrator/components/com_config/view/application/tmpl/default_permissions.php new file mode 100644 index 0000000000000..6cc0ca4ced5f5 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_permissions.php @@ -0,0 +1,19 @@ + +
+ + form->getFieldset('permissions') as $field): ?> +
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_seo.php b/administrator/components/com_config/view/application/tmpl/default_seo.php new file mode 100644 index 0000000000000..63e24876c7446 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_seo.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('seo') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_server.php b/administrator/components/com_config/view/application/tmpl/default_server.php new file mode 100644 index 0000000000000..d978c24c21ee6 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_server.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('server') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_session.php b/administrator/components/com_config/view/application/tmpl/default_session.php new file mode 100644 index 0000000000000..990f2cdeb92a9 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_session.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('session') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_site.php b/administrator/components/com_config/view/application/tmpl/default_site.php new file mode 100644 index 0000000000000..34a4063a10b29 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_site.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('site') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/view/application/tmpl/default_system.php b/administrator/components/com_config/view/application/tmpl/default_system.php new file mode 100644 index 0000000000000..811e2e6bceef4 --- /dev/null +++ b/administrator/components/com_config/view/application/tmpl/default_system.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('system') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/administrator/components/com_config/views/component/tmpl/index.html b/administrator/components/com_config/view/application/tmpl/index.html similarity index 100% rename from administrator/components/com_config/views/component/tmpl/index.html rename to administrator/components/com_config/view/application/tmpl/index.html diff --git a/administrator/components/com_config/view/component/html.php b/administrator/components/com_config/view/component/html.php new file mode 100644 index 0000000000000..59764ef0cd23f --- /dev/null +++ b/administrator/components/com_config/view/component/html.php @@ -0,0 +1,95 @@ +model->getForm(); + $component = $this->model->getComponent(); + $user = JFactory::getUser(); + $app = JFactory::getApplication(); + } + catch (Exception $e) + { + $app->enqueueMessage($e->getMessage(), 'error'); + } + + // Bind the form to the data. + if ($form && $component->params) + { + $form->bind($component->params); + } + + $this->form = &$form; + $this->component = &$component; + + $this->components = ConfigHelperConfig::getComponentsWithConfig(); + ConfigHelperConfig::loadLanguageForComponents($this->components); + + $this->userIsSuperAdmin = $user->authorise('core.admin'); + $this->currentComponent = JFactory::getApplication()->input->get('component'); + $this->return = $app->input->get('return', '', 'base64'); + + $this->addToolbar(); + $app->input->set('hidemainmenu', true); + + return parent::render(); + + } + + /** + * Add the page title and toolbar. + * + * @return void + * + * @since 3.2 + */ + protected function addToolbar() + { + JToolbarHelper::title(JText::_($this->component->option . '_configuration'), 'config.png'); + JToolbarHelper::apply('config.save.component.apply'); + JToolbarHelper::save('config.save.component'); + JToolbarHelper::divider(); + JToolbarHelper::cancel('config.cancel.component'); + JToolbarHelper::divider(); + JToolbarHelper::help('JHELP_SITE_GLOBAL_CONFIGURATION'); + } +} diff --git a/administrator/components/com_config/views/index.html b/administrator/components/com_config/view/component/index.html similarity index 100% rename from administrator/components/com_config/views/index.html rename to administrator/components/com_config/view/component/index.html diff --git a/administrator/components/com_config/view/component/tmpl/default.php b/administrator/components/com_config/view/component/tmpl/default.php new file mode 100644 index 0000000000000..1b6b18d551609 --- /dev/null +++ b/administrator/components/com_config/view/component/tmpl/default.php @@ -0,0 +1,91 @@ +getTemplate(); + +// Load the tooltip behavior. +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +?> + +
+
+ + + +
+ +
+ form->getFieldsets(); + foreach ($fieldSets as $name => $fieldSet) : + ?> +
+ description) && !empty($fieldSet->description)) : + echo '

'.JText::_($fieldSet->description).'

'; + endif; + foreach ($this->form->getFieldset($name) as $field): + ?> +
+ hidden && $name != "permissions") : ?> +
+ label; ?> +
+ +
controls"> + input; ?> +
+
+ +
+ +
+
+
+
+ + + + + +
+
+ diff --git a/administrator/components/com_config/view/component/tmpl/default_navigation.php b/administrator/components/com_config/view/component/tmpl/default_navigation.php new file mode 100644 index 0000000000000..086b079acf9d9 --- /dev/null +++ b/administrator/components/com_config/view/component/tmpl/default_navigation.php @@ -0,0 +1,34 @@ + + diff --git a/administrator/components/com_config/view/component/tmpl/index.html b/administrator/components/com_config/view/component/tmpl/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/administrator/components/com_config/view/component/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/administrator/components/com_config/view/index.html b/administrator/components/com_config/view/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/administrator/components/com_config/view/index.html @@ -0,0 +1 @@ + diff --git a/administrator/components/com_config/views/application/tmpl/default.php b/administrator/components/com_config/views/application/tmpl/default.php deleted file mode 100644 index 0fbbf87b636d2..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default.php +++ /dev/null @@ -1,114 +0,0 @@ - - - -
-
- - - - -
- 'page-site')); ?> - - -
-
- loadTemplate('site'); ?> - loadTemplate('metadata'); ?> -
-
- loadTemplate('seo'); ?> - loadTemplate('cookie'); ?> -
-
- - - -
-
- loadTemplate('system'); ?> - loadTemplate('debug'); ?> -
-
- loadTemplate('cache'); ?> - loadTemplate('session'); ?> -
-
- - - -
-
- loadTemplate('server'); ?> - loadTemplate('locale'); ?> - loadTemplate('ftp'); ?> -
-
- loadTemplate('database'); ?> - loadTemplate('mail'); ?> -
-
- - - -
- loadTemplate('permissions'); ?> -
- - - -
- loadTemplate('filters'); ?> -
- - - ftp) : ?> - - loadTemplate('ftplogin'); ?> - - - - - - - -
- -
-
diff --git a/administrator/components/com_config/views/application/tmpl/default_cache.php b/administrator/components/com_config/views/application/tmpl/default_cache.php deleted file mode 100644 index 89bbab8989eb0..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_cache.php +++ /dev/null @@ -1,23 +0,0 @@ -name = JText::_('COM_CONFIG_CACHE_SETTINGS'); -$this->fieldsname = 'cache'; -if (isset($this->data['cache_handler']) - && $this->data['cache_handler'] == 'memcache' - || $this->data['session_handler'] == 'memcache' - || $this->data['cache_handler'] == 'memcached' - || $this->data['session_handler'] == 'memcached' -) -{ - $this->fieldsname .= ',memcache'; -} -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_cookie.php b/administrator/components/com_config/views/application/tmpl/default_cookie.php deleted file mode 100644 index 2e8ad2092ee10..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_cookie.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_COOKIE_SETTINGS'); -$this->fieldsname = 'cookie'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_database.php b/administrator/components/com_config/views/application/tmpl/default_database.php deleted file mode 100644 index b4c39dfd9c114..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_database.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_DATABASE_SETTINGS'); -$this->fieldsname = 'database'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_debug.php b/administrator/components/com_config/views/application/tmpl/default_debug.php deleted file mode 100644 index 2e6196ad55028..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_debug.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_DEBUG_SETTINGS'); -$this->fieldsname = 'debug'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_filters.php b/administrator/components/com_config/views/application/tmpl/default_filters.php deleted file mode 100644 index ab9d3444f6346..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_filters.php +++ /dev/null @@ -1,15 +0,0 @@ -name = JText::_('COM_CONFIG_TEXT_FILTER_SETTINGS'); -$this->fieldsname = 'filters'; -$this->description = JText::_('COM_CONFIG_TEXT_FILTERS_DESC'); -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_ftp.php b/administrator/components/com_config/views/application/tmpl/default_ftp.php deleted file mode 100644 index 67f231adfa81c..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_ftp.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_FTP_SETTINGS'); -$this->fieldsname = 'ftp'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_locale.php b/administrator/components/com_config/views/application/tmpl/default_locale.php deleted file mode 100644 index f875d1061ab28..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_locale.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_LOCATION_SETTINGS'); -$this->fieldsname = 'locale'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_mail.php b/administrator/components/com_config/views/application/tmpl/default_mail.php deleted file mode 100644 index 5f47ee6dc880d..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_mail.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_MAIL_SETTINGS'); -$this->fieldsname = 'mail'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_metadata.php b/administrator/components/com_config/views/application/tmpl/default_metadata.php deleted file mode 100644 index a6ffd4dde914c..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_metadata.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_METADATA_SETTINGS'); -$this->fieldsname = 'metadata'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_navigation.php b/administrator/components/com_config/views/application/tmpl/default_navigation.php deleted file mode 100644 index 296aad9ce1dd0..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_navigation.php +++ /dev/null @@ -1,26 +0,0 @@ - - diff --git a/administrator/components/com_config/views/application/tmpl/default_permissions.php b/administrator/components/com_config/views/application/tmpl/default_permissions.php deleted file mode 100644 index 6855183fa1069..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_permissions.php +++ /dev/null @@ -1,16 +0,0 @@ -name = JText::_('COM_CONFIG_PERMISSION_SETTINGS'); -$this->fieldsname = 'permissions'; -$this->formclass = 'form-vertical'; -$this->showlabel = false; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_seo.php b/administrator/components/com_config/views/application/tmpl/default_seo.php deleted file mode 100644 index a57edab3cab99..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_seo.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_SEO_SETTINGS'); -$this->fieldsname = 'seo'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_server.php b/administrator/components/com_config/views/application/tmpl/default_server.php deleted file mode 100644 index 3307f7e5170af..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_server.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_SERVER_SETTINGS'); -$this->fieldsname = 'server'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_session.php b/administrator/components/com_config/views/application/tmpl/default_session.php deleted file mode 100644 index 0fdac2af1ecdf..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_session.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_SESSION_SETTINGS'); -$this->fieldsname = 'session'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_site.php b/administrator/components/com_config/views/application/tmpl/default_site.php deleted file mode 100644 index b3456ca3db7a4..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_site.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_SITE_SETTINGS'); -$this->fieldsname = 'site'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/application/tmpl/default_system.php b/administrator/components/com_config/views/application/tmpl/default_system.php deleted file mode 100644 index c78d4fc12fe08..0000000000000 --- a/administrator/components/com_config/views/application/tmpl/default_system.php +++ /dev/null @@ -1,14 +0,0 @@ -name = JText::_('COM_CONFIG_SYSTEM_SETTINGS'); -$this->fieldsname = 'system'; -echo JLayoutHelper::render('joomla.content.options_default', $this); diff --git a/administrator/components/com_config/views/close/view.html.php b/administrator/components/com_config/views/close/view.html.php deleted file mode 100644 index 5894ae9327db6..0000000000000 --- a/administrator/components/com_config/views/close/view.html.php +++ /dev/null @@ -1,32 +0,0 @@ -addScriptDeclaration(' - window.parent.location.href=window.parent.location.href; - window.parent.SqueezeBox.close(); - '); - } -} diff --git a/administrator/components/com_config/views/component/tmpl/default.php b/administrator/components/com_config/views/component/tmpl/default.php deleted file mode 100644 index 90e7e437b063d..0000000000000 --- a/administrator/components/com_config/views/component/tmpl/default.php +++ /dev/null @@ -1,77 +0,0 @@ -getTemplate(); - -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -?> - -
-
- - - -
- -
- form->getFieldsets(); ?> - $fieldSet) : ?> -
- description) && !empty($fieldSet->description)) : ?> -

description); ?>

- - form->getFieldset($name) as $field): ?> -
- hidden && $name != "permissions") : ?> -
- label; ?> -
- -
controls"> - input; ?> -
-
- -
- -
-
-
-
- - - - - -
-
- diff --git a/administrator/components/com_config/views/component/tmpl/default_navigation.php b/administrator/components/com_config/views/component/tmpl/default_navigation.php deleted file mode 100644 index a95a39651af09..0000000000000 --- a/administrator/components/com_config/views/component/tmpl/default_navigation.php +++ /dev/null @@ -1,31 +0,0 @@ - - diff --git a/administrator/components/com_config/views/component/view.html.php b/administrator/components/com_config/views/component/view.html.php deleted file mode 100644 index 62f2a866f4c73..0000000000000 --- a/administrator/components/com_config/views/component/view.html.php +++ /dev/null @@ -1,121 +0,0 @@ - 'JHELP_COMPONENTS_BANNER_MANAGER_OPTIONS', - 'com_cache' => 'JHELP_COMPONENTS_CACHE_MANAGER_SETTINGS', - 'com_checkin' => 'JHELP_COMPONENTS_CHECK-IN_CONFIGURATION', - 'com_contact' => 'JHELP_COMPONENTS_CONTACT_MANAGER_OPTIONS', - 'com_content' => 'JHELP_COMPONENTS_ARTICLE_MANAGER_OPTIONS', - 'com_finder' => 'JHELP_COMPONENTS_SMART_SEARCH_CONFIGURATION', - 'com_installer' => 'JHELP_COMPONENTS_INSTALLER_CONFIGURATION', - 'com_joomlaupdate' => 'JHELP_COMPONENTS_JOOMLA_UPDATE_CONFIGURATION', - 'com_languages' => 'JHELP_COMPONENTS_LANGUAGE_MANAGER_OPTIONS', - 'com_media' => 'JHELP_COMPONENTS_MEDIA_MANAGER_OPTIONS', - 'com_menus' => 'JHELP_COMPONENTS_MENUS_CONFIGURATION', - 'com_messages' => 'JHELP_COMPONENTS_MESSAGES_CONFIGURATION', - 'com_modules' => 'JHELP_COMPONENTS_MODULE_MANAGER_OPTIONS', - 'com_newsfeeds' => 'JHELP_COMPONENTS_NEWS_FEED_MANAGER_OPTIONS', - 'com_plugins' => 'JHELP_COMPONENTS_PLUG-IN_MANAGER_OPTIONS', - 'com_redirect' => 'JHELP_COMPONENTS_REDIRECT_MANAGER_OPTIONS', - 'com_search' => 'JHELP_COMPONENTS_SEARCH_MANAGER_OPTIONS', - 'com_tags' => 'JHELP_COMPONENTS_TAGS_MANAGER_OPTIONS', - 'com_templates' => 'JHELP_COMPONENTS_TEMPLATE_MANAGER_OPTIONS', - 'com_users' => 'JHELP_COMPONENTS_USERS_CONFIGURATION', - 'com_weblinks' => 'JHELP_COMPONENTS_WEB_LINKS_MANAGER_OPTIONS', - ); - - /** - * Execute and display a template script. - * - * @param string $tpl The name of the template file to parse; automatically searches through the template paths. - * - * @return mixed A string if successful, otherwise a Error object. - * - * @since 1.5 - */ - public function display($tpl = null) - { - $form = $this->get('Form'); - $component = $this->get('Component'); - $user = JFactory::getUser(); - $app = JFactory::getApplication(); - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - JError::raiseError(500, implode("\n", $errors)); - return false; - } - - // Bind the form to the data. - if ($form && $component->params) - { - $form->bind($component->params); - } - - $this->form = &$form; - $this->component = &$component; - - $this->components = ConfigHelperComponent::getComponentsWithConfig(); - ConfigHelperComponent::loadLanguageForComponents($this->components); - - $this->userIsSuperAdmin = $user->authorise('core.admin'); - $this->currentComponent = JFactory::getApplication()->input->get('component'); - $this->return = $app->input->get('return', '', 'base64'); - - $this->addToolbar(); - parent::display($tpl); - $app->input->set('hidemainmenu', true); - } - - /** - * Add the page title and toolbar. - * - * @since 3.0 - */ - protected function addToolbar() - { - JToolbarHelper::title(JText::_($this->component->option . '_configuration'), 'config.png'); - JToolbarHelper::apply('component.apply'); - JToolbarHelper::save('component.save'); - JToolbarHelper::divider(); - JToolbarHelper::cancel('component.cancel'); - JToolbarHelper::divider(); - - // Get the correct help key for this screen - if (isset($this->helpScreenArray[$this->component->option])) - { - JToolbarHelper::help($this->helpScreenArray[$this->component->option]); - } - else - { - JToolbarHelper::help('JHELP_SITE_GLOBAL_CONFIGURATION'); - } - } -} diff --git a/administrator/components/com_services/access.xml b/administrator/components/com_services/access.xml new file mode 100644 index 0000000000000..19cc71a3b1335 --- /dev/null +++ b/administrator/components/com_services/access.xml @@ -0,0 +1,8 @@ + + +
+ + +
+ +
\ No newline at end of file diff --git a/administrator/components/com_services/config.xml b/administrator/components/com_services/config.xml new file mode 100644 index 0000000000000..7c4e4ec2c36ab --- /dev/null +++ b/administrator/components/com_services/config.xml @@ -0,0 +1,21 @@ + + + +
+ + +
+ +
+ diff --git a/administrator/components/com_services/index.html b/administrator/components/com_services/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_services/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_services/services.php b/administrator/components/com_services/services.php new file mode 100644 index 0000000000000..897bef77e7309 --- /dev/null +++ b/administrator/components/com_services/services.php @@ -0,0 +1,26 @@ +redirect(JRoute::_('index.php?option=com_config&view=component&component=com_services', false), ''); diff --git a/administrator/components/com_services/services.xml b/administrator/components/com_services/services.xml new file mode 100644 index 0000000000000..b649b2f25bc03 --- /dev/null +++ b/administrator/components/com_services/services.xml @@ -0,0 +1,42 @@ + + + com_services + 2013-06-31 + Joomla! Project + Joomla@joomla.com + http://joomla.org + Copyright Info + License Info + 1.0.0 + Front End Admin Services Configuration Manager + + + + controller + model + view + index.html + services.php + + + language/en-GB.com_services.ini + + + + + + + access.xml + config.xml + index.html + services.php + + + + language/en-GB.com_services.ini + + language/en-GB.com_services.sys.ini + + + + \ No newline at end of file diff --git a/administrator/components/com_templates/controller.php b/administrator/components/com_templates/controller.php index f612bf1ccf4bd..a0279fc98d4e0 100644 --- a/administrator/components/com_templates/controller.php +++ b/administrator/components/com_templates/controller.php @@ -39,6 +39,28 @@ public function display($cachable = false, $urlparams = false) $layout = $this->input->get('layout', 'default'); $id = $this->input->getInt('id'); + $document = JFactory::getDocument(); + + // For JSON requests + if($document->getType() == 'json') + { + + $view = new TemplatesViewStyle; + + // Get/Create the model + if ($model = new TemplatesModelStyle()) + { + $model->addTablePath(JPATH_ADMINISTRATOR . '/components/com_templates/tables'); + + // Push the model into the view (as default) + $view->setModel($model, true); + } + + $view->document = $document; + + return $view->display(); + } + // Check for edit form. if ($view == 'style' && $layout == 'edit' && !$this->checkEditId('com_templates.edit.style', $id)) { diff --git a/administrator/components/com_templates/controllers/style.php b/administrator/components/com_templates/controllers/style.php index 0edfe1fff1d61..7ffcc7d33b4fe 100644 --- a/administrator/components/com_templates/controllers/style.php +++ b/administrator/components/com_templates/controllers/style.php @@ -24,4 +24,134 @@ class TemplatesControllerStyle extends JControllerForm */ protected $text_prefix = 'COM_TEMPLATES_STYLE'; + public function save($key = null, $urlVar = null) + { + if (!JSession::checkToken()) + { + JFactory::getApplication()->redirect('index.php', JText::_('JINVALID_TOKEN')); + } + + $document = JFactory::getDocument(); + + if ($document->getType() == 'json') + { + + $app = JFactory::getApplication(); + $lang = JFactory::getLanguage(); + $model = $this->getModel(); + $table = $model->getTable(); + $data = $this->input->post->get('jform', array(), 'array'); + $checkin = property_exists($table, 'checked_out'); + $context = "$this->option.edit.$this->context"; + $task = $this->getTask(); + + $item = $model->getItem($app->getTemplate('template')->id); + + // Setting received params + $item->set('params', $data['params']); + + $data = $item->getProperties(); + unset($data['xml']); + + $key = $table->getKeyName(); + $urlVar = $key; + + $recordId = $this->input->getInt($urlVar); + + // Access check. + if (!$this->allowSave($data, $key)) + { + + $app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error'); + + return false; + } + + JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_templates/models/forms'); + + // Validate the posted data. + // Sometimes the form needs some posted data, such as for plugins and modules. + $form = $model->getForm($data, false); + + if (!$form) + { + $app->enqueueMessage($model->getError(), 'error'); + + return false; + } + + // Test whether the data is valid. + $validData = $model->validate($form, $data); + + if ($validData === false) + { + // Get the validation messages. + $errors = $model->getErrors(); + + // Push up to three validation messages out to the user. + for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) + { + if ($errors[$i] instanceof Exception) + { + $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); + } + else + { + $app->enqueueMessage($errors[$i], 'warning'); + } + } + + // Save the data in the session. + $app->setUserState($context . '.data', $data); + + return false; + } + + if (!isset($validData['tags'])) + { + $validData['tags'] = null; + } + + // Attempt to save the data. + if (!$model->save($validData)) + { + // Save the data in the session. + $app->setUserState($context . '.data', $validData); + + $app->enqueueMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error'); + + return false; + } + + // Save succeeded, so check-in the record. + if ($checkin && $model->checkin($validData[$key]) === false) + { + // Save the data in the session. + $app->setUserState($context . '.data', $validData); + + // Check-in failed, so go back to the record and display a notice. + $app->enqueueMessage(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'error'); + + return false; + } + + // Redirect the user and adjust session state + // Set the record data in the session. + $recordId = $model->getState($this->context . '.id'); + $this->holdEditId($context, $recordId); + $app->setUserState($context . '.data', null); + $model->checkout($recordId); + + // Invoke the postSave method to allow for the child class to access the model. + $this->postSaveHook($model, $validData); + + return true; + + } + else + { + parent::save($key, $urlVar); + } + } + } diff --git a/administrator/components/com_templates/views/style/view.json.php b/administrator/components/com_templates/views/style/view.json.php new file mode 100644 index 0000000000000..a4288f8139e4f --- /dev/null +++ b/administrator/components/com_templates/views/style/view.json.php @@ -0,0 +1,56 @@ +item = $this->get('Item'); + + } + catch (Exception $e) + { + $app->enqueueMessage($e->getMessage(), 'error'); + + return false; + } + + $paramsList = $this->item->getProperties(); + + unset($paramsList['xml']); + + $paramsList = json_encode($paramsList); + + return $paramsList; + + } + +} diff --git a/administrator/language/en-GB/en-GB.com_services.ini b/administrator/language/en-GB/en-GB.com_services.ini new file mode 100644 index 0000000000000..a6652a4b7a28e --- /dev/null +++ b/administrator/language/en-GB/en-GB.com_services.ini @@ -0,0 +1,30 @@ +; Joomla! Project +; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +COM_SERVICES="Admin Services" +COM_SERVICES_CONFIGURATION="Admin Services Configuration" +COM_SERVICES_FIELD_DEFAULT_ACCESS_LEVEL_DESC="Select the default access level for new content, menu items, and other items created on your site." +COM_SERVICES_FIELD_DEFAULT_ACCESS_LEVEL_LABEL="Default Access Level" +COM_SERVICES_FIELD_DEFAULT_LIST_LIMIT_DESC="Sets the default length of lists in the Control Panel for all users" +COM_SERVICES_FIELD_DEFAULT_LIST_LIMIT_LABEL="Default List Limit" +COM_SERVICES_FIELD_METADESC_DESC="Enter a description of the overall Web site that is to be used by search engines. Generally, a maximum of 20 words is optimal." +COM_SERVICES_FIELD_METADESC_LABEL="Site Meta Description" +COM_SERVICES_FIELD_METAKEYS_DESC="Enter the keywords and phrases that best describe your Web site. Separate keywords and phrases with a comma." +COM_SERVICES_FIELD_METAKEYS_LABEL="Site Meta Keywords" +COM_SERVICES_FIELD_SEF_URL_DESC="Select whether or not the URLs are optimised for Search Engines." +COM_SERVICES_FIELD_SEF_URL_LABEL="Search Engine Friendly URLs" +COM_SERVICES_FIELD_SITE_NAME_DESC="Enter the name of your Web site. This will be used in various locations (e.g. the backend browser title bar and Site Offline pages)." +COM_SERVICES_FIELD_SITE_NAME_LABEL="Site Name" +COM_SERVICES_FIELD_VALUE_AFTER="After" +COM_SERVICES_FIELD_VALUE_BEFORE="Before" +COM_SERVICES_FIELD_SITE_OFFLINE_DESC="Select whether access to the Site frontend is available. If Yes, the frontend will display or not a message depending on the settings below." +COM_SERVICES_FIELD_SITE_OFFLINE_LABEL="Site Offline" +COM_SERVICES_FIELD_SITENAME_PAGETITLES_DESC="Begin or end all Page Titles with the site name (for example, My Site Name - My Article Name)." +COM_SERVICES_FIELD_SITENAME_PAGETITLES_LABEL="Include Site Name in Page Titles" +COM_SERVICES_METADATA_SETTINGS="Metadata Settings" +COM_SERVICES_SAVE_SUCCESS="Configuration successfully saved." +COM_SERVICES_SEO_SETTINGS="SEO Settings" +COM_SERVICES_SITE_SETTINGS="Site Settings" +COM_SERVICES_XML_DESCRIPTION="Front End Admin Services Configuration Manager" \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.com_services.sys.ini b/administrator/language/en-GB/en-GB.com_services.sys.ini new file mode 100644 index 0000000000000..84db2ecf4608a --- /dev/null +++ b/administrator/language/en-GB/en-GB.com_services.sys.ini @@ -0,0 +1,11 @@ +; Joomla! Project +; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +COM_SERVICES="Admin Services" +COM_SERVICES_XML_DESCRIPTION="Front End Admin Services Configuration Manager" +COM_SERVICES_CONFIG_VIEW_DEFAULT_DESC="Displays basic site configuration options" +COM_SERVICES_CONFIG_VIEW_DEFAULT_TITLE="Display Site Configuration Options" +COM_SERVICES_VIEW_TEMPLATES_DEFAULT_DESC="Displays template parameter options if the template allows this." +COM_SERVICES_VIEW_TEMPLATES_DEFAULT_TITLE="Display Template Options" diff --git a/components/com_services/controller/config/display.php b/components/com_services/controller/config/display.php new file mode 100644 index 0000000000000..a16b157db8bc7 --- /dev/null +++ b/components/com_services/controller/config/display.php @@ -0,0 +1,106 @@ +getApplication(); + + // Get the document object. + $document = JFactory::getDocument(); + + $viewName = $this->input->getWord('view', 'config'); + $viewFormat = $document->getType(); + $layoutName = $this->input->getWord('layout', 'default'); + + // Access back-end com_config + JLoader::registerPrefix(ucfirst($viewName), JPATH_ADMINISTRATOR . '/components/com_config'); + $displayClass = new ConfigControllerApplicationDisplay; + + // Set back-end required params + $document->setType('json'); + $app->input->set('view', 'application'); + + // Execute back-end controller + $serviceData = json_decode($displayClass->execute(), true); + + // Reset params back after requesting from service + $document->setType('html'); + $app->input->set('view', $viewName); + + // Register the layout paths for the view + $paths = new SplPriorityQueue; + $paths->insert(JPATH_COMPONENT . '/view/' . $viewName . '/tmpl', 'normal'); + + $viewClass = 'ServicesView' . ucfirst($viewName) . ucfirst($viewFormat); + $modelClass = 'ServicesModel' . ucfirst($viewName); + + if (class_exists($viewClass)) + { + + if ($viewName != 'close') + { + $model = new $modelClass; + + // Access check. + if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option'))) + { + $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); + + return; + + } + + } + + $view = new $viewClass($model, $paths); + + $view->setLayout($layoutName); + + // Push document object into the view. + $view->document = $document; + + // Load form and bind data + $form = $model->getForm(); + + if ($form) + { + $form->bind($serviceData); + } + + // Set form and data to the view + $view->form = &$form; + $view->data = &$serviceData; + + // Render view. + echo $view->render(); + } + return true; + } + +} diff --git a/components/com_services/controller/config/index.html b/components/com_services/controller/config/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/controller/config/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/controller/config/save.php b/components/com_services/controller/config/save.php new file mode 100644 index 0000000000000..d251535a4ce65 --- /dev/null +++ b/components/com_services/controller/config/save.php @@ -0,0 +1,123 @@ +redirect('index.php', JText::_('JINVALID_TOKEN')); + } + + // Check if the user is authorized to do this. + if (!JFactory::getUser()->authorise('core.admin')) + { + JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); + + return; + } + + // Set FTP credentials, if given. + JClientHelper::setCredentialsFromRequest('ftp'); + + $app = JFactory::getApplication(); + $model = new ServicesModelConfig; + $form = $model->getForm(); + $data = $this->input->post->get('jform', array(), 'array'); + + // Validate the posted data. + $return = $model->validate($form, $data); + + // Check for validation errors. + if ($return === false) + { + // Get the validation messages. + $errors = $model->getErrors(); + + // Push up to three validation messages out to the user. + for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) + { + if ($errors[$i] instanceof Exception) + { + $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); + } + else + { + $app->enqueueMessage($errors[$i], 'warning'); + } + } + + // Save the data in the session. + $app->setUserState('com_services.config.global.data', $data); + + // Redirect back to the edit screen. + $app->redirect(JRoute::_('index.php?option=com_services&controller=services.display.config', false)); + + return false; + } + + // Attempt to save the configuration. + $data = $return; + + // Access back-end com_config + JLoader::registerPrefix('Config', JPATH_ADMINISTRATOR . '/components/com_config'); + $saveClass = new ConfigControllerApplicationSave; + + // Get a document object + $document = JFactory::getDocument(); + + // Set back-end required params + $document->setType('json'); + + // Execute back-end controller + $return = $saveClass->execute(); + + // Reset params back after requesting from service + $document->setType('html'); + + // Check the return value. + if ($return === false) + { + // Save the data in the session. + $app->setUserState('com_services.config.global.data', $data); + + // Save failed, go back to the screen and display a notice. + $message = JText::sprintf('JERROR_SAVE_FAILED', $model->getError()); + + $app->redirect(JRoute::_('index.php?option=com_services&controller=services.display.config', false), $message, 'error'); + + return false; + } + + // Set the success message. + $message = JText::_('COM_SERVICES_SAVE_SUCCESS'); + + // Redirect back to com_services display + $app->redirect(JRoute::_('index.php?option=com_services&controller=services.display.config', false), $message); + + return true; + } +} diff --git a/components/com_services/controller/index.html b/components/com_services/controller/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/controller/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/controller/templates/display.php b/components/com_services/controller/templates/display.php new file mode 100644 index 0000000000000..5c97ff7ec774d --- /dev/null +++ b/components/com_services/controller/templates/display.php @@ -0,0 +1,109 @@ +getApplication(); + + // Get the document object. + $document = JFactory::getDocument(); + + $viewName = $this->input->getWord('view', 'templates'); + $viewFormat = $document->getType(); + $layoutName = $this->input->getWord('layout', 'default'); + + // Access back-end com_config + JLoader::register('TemplatesController', JPATH_ADMINISTRATOR . '/components/com_templates/controller.php'); + JLoader::register('TemplatesViewStyle', JPATH_ADMINISTRATOR . '/components/com_templates/views/style/view.json.php'); + JLoader::register('TemplatesModelStyle', JPATH_ADMINISTRATOR . '/components/com_templates/models/style.php'); + + $displayClass = new TemplatesController; + + // Set back-end required params + $document->setType('json'); + $this->input->set('id', $app->getTemplate('template')->id); + + // Execute back-end controller + $serviceData = json_decode($displayClass->display(), true); + + // Reset params back after requesting from service + $document->setType('html'); + $this->input->set('view', $viewName); + + // Register the layout paths for the view + $paths = new SplPriorityQueue; + $paths->insert(JPATH_COMPONENT . '/view/' . $viewName . '/tmpl', 'normal'); + + $viewClass = 'ServicesView' . ucfirst($viewName) . ucfirst($viewFormat); + $modelClass = 'ServicesModel' . ucfirst($viewName); + + if (class_exists($viewClass)) + { + + if ($viewName != 'close') + { + $model = new $modelClass; + + // Access check. + if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option'))) + { + $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); + + return; + + } + + } + + $view = new $viewClass($model, $paths); + + $view->setLayout($layoutName); + + // Push document object into the view. + $view->document = $document; + + // Load form and bind data + $form = $model->getForm(); + + if ($form) + { + $form->bind($serviceData); + } + + // Set form and data to the view + $view->form = &$form; + + // Render view. + echo $view->render(); + } + + return true; + } + +} diff --git a/components/com_services/controller/templates/index.html b/components/com_services/controller/templates/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/controller/templates/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/controller/templates/save.php b/components/com_services/controller/templates/save.php new file mode 100644 index 0000000000000..f44eb45c63247 --- /dev/null +++ b/components/com_services/controller/templates/save.php @@ -0,0 +1,89 @@ +redirect('index.php', JText::_('JINVALID_TOKEN')); + } + + // Check if the user is authorized to do this. + if (!JFactory::getUser()->authorise('core.admin')) + { + JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); + + return; + } + + // Set FTP credentials, if given. + JClientHelper::setCredentialsFromRequest('ftp'); + + $app = JFactory::getApplication(); + + // Access back-end com_templates + JLoader::register('TemplatesControllerStyle', JPATH_ADMINISTRATOR . '/components/com_templates/controllers/style.php'); + JLoader::register('TemplatesModelStyle', JPATH_ADMINISTRATOR . '/components/com_templates/models/style.php'); + JLoader::register('TemplatesTableStyle', JPATH_ADMINISTRATOR . '/components/com_templates/tables/style.php'); + $controllerClass = new TemplatesControllerStyle; + + // Get a document object + $document = JFactory::getDocument(); + + // Set back-end required params + $document->setType('json'); + $this->input->set('id', $app->getTemplate()->id); + + // Execute back-end controller + $return = $controllerClass->save(); + + // Reset params back after requesting from service + $document->setType('html'); + + // Check the return value. + if ($return === false) + { + // Save the data in the session. + $app->setUserState('com_services.config.global.data', $data); + + // Save failed, go back to the screen and display a notice. + $message = JText::sprintf('JERROR_SAVE_FAILED'); + + $app->redirect(JRoute::_('index.php?option=com_services&controller=services.display.templates', false), $message, 'error'); + + return false; + } + + // Set the success message. + $message = JText::_('COM_SERVICES_SAVE_SUCCESS'); + + // Redirect back to com_services display + $app->redirect(JRoute::_('index.php?option=com_services&controller=services.display.templates', false), $message); + + return true; + } +} diff --git a/components/com_services/index.html b/components/com_services/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/model/config.php b/components/com_services/model/config.php new file mode 100644 index 0000000000000..d117f4a9faa2f --- /dev/null +++ b/components/com_services/model/config.php @@ -0,0 +1,44 @@ +loadForm('com_services.config', 'config', array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($form)) + { + return false; + } + + return $form; + } + +} diff --git a/components/com_services/model/form/config.xml b/components/com_services/model/form/config.xml new file mode 100644 index 0000000000000..eca256d876f0b --- /dev/null +++ b/components/com_services/model/form/config.xml @@ -0,0 +1,135 @@ + +
+
+ + + + + + +
+ +
+ + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
diff --git a/components/com_services/model/form/index.html b/components/com_services/model/form/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/model/form/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/model/form/templates.xml b/components/com_services/model/form/templates.xml new file mode 100644 index 0000000000000..2df7c8c56764b --- /dev/null +++ b/components/com_services/model/form/templates.xml @@ -0,0 +1,44 @@ + +
+
+ + + + + + + + + + +
+
diff --git a/components/com_services/model/index.html b/components/com_services/model/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/model/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/model/templates.php b/components/com_services/model/templates.php new file mode 100644 index 0000000000000..c35f5a1e1f53c --- /dev/null +++ b/components/com_services/model/templates.php @@ -0,0 +1,134 @@ +loadState(); + + // Load the parameters. + $params = JComponentHelper::getParams('com_templates'); + $state->set('params', $params); + + $this->setState($state); + } + + /** + * Method to get the record form. + * + * @param array $data An optional array of data for the form to interogate. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return JForm A JForm object on success, false on failure + * + * @since 3.2 + */ + public function getForm($data = array(), $loadData = true) + { + // Get the form. + $form = $this->loadForm('com_services.templates', 'templates', array('control' => 'jform', 'load_data' => $loadData)); +/* + try + { + $form = new JForm('com_services.templates'); + $data = array(); + $this->preprocessForm($form, $data); + + // Load the data into the form + $form->bind($data); + } + catch (Exception $e) + { + + $app = JFactory::getApplication(); + $app->enqueueMessage($e->getMessage()); + + return false; + } +*/ + + if (empty($form)) + { + return false; + } + + return $form; + } + + /** + * @param object $form A form object. + * @param mixed $data The data expected for the form. + * + * @throws Exception if there is an error in the form event. + * @since 3.2 + */ + protected function preprocessForm(JForm $form, $data, $group = 'content') + { + + $lang = JFactory::getLanguage(); + $app = JFactory::getApplication(); + + $template = $app->getTemplate(); + + jimport('joomla.filesystem.path'); + + // Load the core and/or local language file(s). + $lang->load('tpl_' . $template, JPATH_BASE, null, false, false) + || $lang->load('tpl_' . $template, JPATH_BASE . '/templates/' . $template, null, false, false) + || $lang->load('tpl_' . $template, JPATH_BASE, $lang->getDefault(), false, false) + || $lang->load('tpl_' . $template, JPATH_BASE . '/templates/' . $template, $lang->getDefault(), false, false); + + // Look for com_services.xml, which contains fileds to display + $formFile = JPath::clean(JPATH_BASE . '/templates/' . $template . '/com_services.xml'); + + if (!file_exists($formFile)) + { + // If com_services.xml not found, fall back to templateDetails.xml + $formFile = JPath::clean(JPATH_BASE . '/templates/' . $template . '/templateDetails.xml'); + } + + if (file_exists($formFile)) + { + // Get the template form. + if (!$form->loadFile($formFile, false, '//config')) + { + throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); + } + } + + // Attempt to load the xml file. + if (!$xml = simplexml_load_file($formFile)) + { + throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); + } + + // Trigger the default form events. + parent::preprocessForm($form, $data, $group); + } + +} diff --git a/components/com_services/services.php b/components/com_services/services.php new file mode 100644 index 0000000000000..1c4da85923d4e --- /dev/null +++ b/components/com_services/services.php @@ -0,0 +1,31 @@ +parseController($app); + +$controller->prefix = 'Services'; + +// Perform the Request task +$controller->execute(); diff --git a/components/com_services/view/config/html.php b/components/com_services/view/config/html.php new file mode 100644 index 0000000000000..13e0c41372321 --- /dev/null +++ b/components/com_services/view/config/html.php @@ -0,0 +1,42 @@ +userIsSuperAdmin = $user->authorise('core.admin'); + + return parent::render(); + } + +} diff --git a/components/com_services/view/config/index.html b/components/com_services/view/config/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/view/config/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/view/config/tmpl/default.php b/components/com_services/view/config/tmpl/default.php new file mode 100644 index 0000000000000..619fdd280e0b2 --- /dev/null +++ b/components/com_services/view/config/tmpl/default.php @@ -0,0 +1,64 @@ + + + +
+
+ + +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+ loadTemplate('site'); ?> + loadTemplate('metadata'); ?> + loadTemplate('seo'); ?> + +
+
+
+ + + + +
+ +
+
diff --git a/components/com_services/view/config/tmpl/default.xml b/components/com_services/view/config/tmpl/default.xml new file mode 100644 index 0000000000000..ff29b22884bb4 --- /dev/null +++ b/components/com_services/view/config/tmpl/default.xml @@ -0,0 +1,19 @@ + + + + + + + + + +
+ +
+
+
\ No newline at end of file diff --git a/components/com_services/view/config/tmpl/default_metadata.php b/components/com_services/view/config/tmpl/default_metadata.php new file mode 100644 index 0000000000000..8bd28c641dd0c --- /dev/null +++ b/components/com_services/view/config/tmpl/default_metadata.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('metadata') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/components/com_services/view/config/tmpl/default_seo.php b/components/com_services/view/config/tmpl/default_seo.php new file mode 100644 index 0000000000000..06b01d224fae4 --- /dev/null +++ b/components/com_services/view/config/tmpl/default_seo.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('seo') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/components/com_services/view/config/tmpl/default_site.php b/components/com_services/view/config/tmpl/default_site.php new file mode 100644 index 0000000000000..9ffafbd720ff4 --- /dev/null +++ b/components/com_services/view/config/tmpl/default_site.php @@ -0,0 +1,24 @@ + +
+ + form->getFieldset('site') as $field): + ?> +
+
label; ?>
+
input; ?>
+
+ +
diff --git a/components/com_services/view/config/tmpl/index.html b/components/com_services/view/config/tmpl/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/view/config/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/view/index.html b/components/com_services/view/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/view/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/view/templates/html.php b/components/com_services/view/templates/html.php new file mode 100644 index 0000000000000..55efa6a9059d1 --- /dev/null +++ b/components/com_services/view/templates/html.php @@ -0,0 +1,41 @@ +userIsSuperAdmin = $user->authorise('core.admin'); + + return parent::render(); + } + +} diff --git a/components/com_services/view/templates/index.html b/components/com_services/view/templates/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/components/com_services/view/templates/index.html @@ -0,0 +1 @@ + diff --git a/components/com_services/view/templates/tmpl/default.php b/components/com_services/view/templates/tmpl/default.php new file mode 100644 index 0000000000000..3af3415c0545e --- /dev/null +++ b/components/com_services/view/templates/tmpl/default.php @@ -0,0 +1,66 @@ + + + +
+ +
+ + +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+ loadTemplate('options'); ?> + +
+
+
+ + + + +
+ +
+ +
diff --git a/components/com_services/view/templates/tmpl/default.xml b/components/com_services/view/templates/tmpl/default.xml new file mode 100644 index 0000000000000..965134071e4a1 --- /dev/null +++ b/components/com_services/view/templates/tmpl/default.xml @@ -0,0 +1,19 @@ + + + + + + + + + +
+ +
+
+
\ No newline at end of file diff --git a/components/com_services/view/templates/tmpl/default_options.php b/components/com_services/view/templates/tmpl/default_options.php new file mode 100644 index 0000000000000..570dcfcd8c67e --- /dev/null +++ b/components/com_services/view/templates/tmpl/default_options.php @@ -0,0 +1,69 @@ + +form->getFieldsets('params'); +?> + + + + + +
+ +form->getFieldset('com_services') as $field) : ?> +
+
+ label; ?> +
+
+ input; ?> +
+
+ + + +
+ + $fieldSet) : + $label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_SERVICES_' . $name . '_FIELDSET_LABEL'; + + if (isset($fieldSet->description) && trim($fieldSet->description)) : + echo '

' . $this->escape(JText::_($fieldSet->description)) . '

'; + endif; + ?> + +
+ + form->getFieldset($name) as $field) : ?> +
+
+ label; ?> +
+
+ input; ?> +
+
+ +
+ diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index d63991dcd012a..362495ad64949 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -68,6 +68,7 @@ INSERT INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `titl (35, 1, 67, 68, 1, 'com_tags', 'com_tags', '{"core.admin":[],"core.manage":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), (36, 1, 69, 70, 1, 'com_contenthistory', 'com_contenthistory', '{}'), (37, 1, 71, 72, 1, 'com_ajax', 'com_ajax', '{}'); +(38, 1, 69, 70, 1, 'com_services', 'com_services', '{}'); -- -------------------------------------------------------- @@ -501,6 +502,9 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (29, 'com_tags', 'component', 'com_tags', '', 1, 1, 1, 1, '', '{"show_tag_title":"0","tag_list_show_tag_image":"0","tag_list_show_tag_description":"0","tag_list_image":"","show_tag_num_items":"0","tag_list_orderby":"title","tag_list_orderby_direction":"ASC","show_headings":"0","tag_list_show_date":"0","tag_list_show_item_image":"0","tag_list_show_item_description":"0","tag_list_item_maximum_characters":0,"return_any_or_all":"1","include_children":"0","maximum":200,"tag_list_language_filter":"all","tags_layout":"_:default","all_tags_orderby":"title","all_tags_orderby_direction":"ASC","all_tags_show_tag_image":"0","all_tags_show_tag_descripion":"0","all_tags_tag_maximum_characters":20,"all_tags_show_tag_hits":"0","filter_field":"1","show_pagination_limit":"1","show_pagination":"2","show_pagination_results":"1","tag_field_ajax_mode":"1","show_feed_link":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (30, 'com_contenthistory', 'component', 'com_contenthistory', '', 1, 1, 1, 0, '', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (31, 'com_ajax', 'component', 'com_ajax', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(32, 'com_services', 'component', 'com_services', '', 1, 1, 0, 0, '{"name":"com_services","type":"component","creationDate":"2013-06-31","author":"Joomla! Project","copyright":"Copyright Info","authorEmail":"Joomla@joomla.com","authorUrl":"http:\/\/joomla.org","version":"1.0.0","description":"Front End Admin Services Configuration Manager","group":""}', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0), + + (100, 'PHPMailer', 'library', 'phpmailer', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (101, 'SimplePie', 'library', 'simplepie', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (102, 'phputf8', 'library', 'phputf8', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), @@ -548,6 +552,8 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (315, 'mod_stats_admin', 'module', 'mod_stats_admin', '', 1, 1, 1, 0, '', '{"serverinfo":"0","siteinfo":"0","counter":"0","increase":"0","cache":"1","cache_time":"900","cachemode":"static"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (316, 'mod_tags_popular', 'module', 'mod_tags_popular', '', 0, 1, 1, 0, '', '{"maximum":"5","timeframe":"alltime","owncache":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (317, 'mod_tags_similar', 'module', 'mod_tags_similar', '', 0, 1, 1, 0, '', '{"maximum":"5","matchtype":"any","owncache":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(318, 'mod_admin_services', 'module', 'mod_admin_services', '', 0, 1, 0, 0, '{"name":"mod_admin_services","type":"module","creationDate":"June 2013","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2013 Open Source Matters. All rights\n\t\treserved.\n\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.2.0","description":"MOD_ADMIN_SERVICES_XML_DESCRIPTION","group":""}', '{"config_visible":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), + (400, 'plg_authentication_gmail', 'plugin', 'gmail', 'authentication', 0, 0, 1, 0, '', '{"applysuffix":"0","suffix":"","verifypeer":"1","user_blacklist":""}', '', '', 0, '0000-00-00 00:00:00', 1, 0), (401, 'plg_authentication_joomla', 'plugin', 'joomla', 'authentication', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (402, 'plg_authentication_ldap', 'plugin', 'ldap', 'authentication', 0, 0, 1, 0, '', '{"host":"","port":"389","use_ldapV3":"0","negotiate_tls":"0","no_referrals":"0","auth_method":"bind","base_dn":"","search_string":"","users_dn":"","username":"admin","password":"bobby7","ldap_fullname":"fullName","ldap_email":"mail","ldap_uid":"uid"}', '', '', 0, '0000-00-00 00:00:00', 3, 0), @@ -1364,6 +1370,7 @@ INSERT INTO `#__modules` (`id`, `title`, `note`, `content`, `ordering`, `positio (15, 'Title', '', '', 1, 'title', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_title', 3, 1, '', 1, '*'), (16, 'Login Form', '', '', 7, 'position-7', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_login', 1, 1, '{"greeting":"1","name":"0"}', 0, '*'), (17, 'Breadcrumbs', '', '', 1, 'position-2', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_breadcrumbs', 1, 1, '{"moduleclass_sfx":"","showHome":"1","homeText":"","showComponent":"1","separator":"","cache":"1","cache_time":"900","cachemode":"itemid"}', 0, '*'), +(18, 'Admin Services', '', '', 1, 'position-7', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_admin_services', 1, 1, '{"config_visible":"1","templates_visible":"1","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 0, '*'), (79, 'Multilanguage status', '', '', 1, 'status', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 'mod_multilangstatus', 3, 1, '{"layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*'), (86, 'Joomla Version', '', '', 1, 'footer', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_version', 3, 1, '{"format":"short","product":"1","layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*'); @@ -1399,6 +1406,7 @@ INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES (15, 0), (16, 0), (17, 0), +(18, 0), (79, 0), (86, 0); diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index 603e7d7ea11e6..00b46d0d8063d 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -74,7 +74,8 @@ VALUES (34, 1, 65, 66, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), (35, 1, 67, 68, 1, 'com_tags', 'com_tags', '{"core.admin":[],"core.manage":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), (36, 1, 69, 70, 1, 'com_contenthistory', 'com_contenthistory', '{}'), -(37, 1, 71, 72, 1, 'com_ajax', 'com_ajax', '{}'); +(37, 1, 71, 72, 1, 'com_ajax', 'com_ajax', '{}'), +(38,1,69,70,1, 'com_services', 'com_services', '{}'); -- -- Table: #__associations @@ -503,6 +504,7 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" (28, 'com_joomlaupdate', 'component', 'com_joomlaupdate', '', 1, 1, 0, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (29, 'com_tags', 'component', 'com_tags', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (31, 'com_ajax', 'component', 'com_ajax', '', 1, 1, 0, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); +(32, 'com_services', 'component', 'com_services', '', 1, 1, 0, 0, '{"name":"com_services","type":"component","creationDate":"2013-06-31","author":"Joomla! Project","copyright":"Copyright Info","authorEmail":"Joomla@joomla.com","authorUrl":"http:\/\/joomla.org","version":"1.0.0","description":"Front End Admin Services Configuration Manager","group":""}', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0); -- Libraries INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES @@ -560,6 +562,8 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" (315, 'mod_stats_admin', 'module', 'mod_stats_admin', '', 1, 1, 1, 0, '', '{"serverinfo":"0","siteinfo":"0","counter":"0","increase":"0","cache":"1","cache_time":"900","cachemode":"static"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (316, 'mod_tags_popular', 'module', 'mod_tags_popular', '', 0, 1, 1, 0, '', '{"maximum":"5","timeframe":"alltime","owncache":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (317, 'mod_tags_similar', 'module', 'mod_tags_similar', '', 0, 1, 1, 0, '', '{"maximum":"5","matchtype":"any","owncache":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0); +(318, 'mod_admin_services', 'module', 'mod_admin_services', '', 0, 1, 0, 0, '{"name":"mod_admin_services","type":"module","creationDate":"June 2013","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2013 Open Source Matters. All rights\n\t\treserved.\n\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.2.0","description":"MOD_ADMIN_SERVICES_XML_DESCRIPTION","group":""}', '{"config_visible":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0); + -- Plug-ins INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES @@ -1914,6 +1918,7 @@ INSERT INTO "#__modules" VALUES (15, 'Title', '', '', 1, 'title', 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 1, 'mod_title', 3, 1, '', 1, '*'), (16, 'Login Form', '', '', 7, 'position-7', 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 1, 'mod_login', 1, 1, '{"greeting":"1","name":"0"}', 0, '*'), (17, 'Breadcrumbs', '', '', 1, 'position-2', 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 1, 'mod_breadcrumbs', 1, 1, '{"moduleclass_sfx":"","showHome":"1","homeText":"","showComponent":"1","separator":"","cache":"1","cache_time":"900","cachemode":"itemid"}', 0, '*'), +(18, 'Admin Services', '', '', 1, 'position-7', 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 1, 'mod_admin_services', 1, 1, '{"config_visible":"1","templates_visible":"1","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 0, '*'), (79, 'Multilanguage status', '', '', 1, 'status', 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 0, 'mod_multilangstatus', 3, 1, '{"layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*'), (86, 'Joomla Version', '', '', 1, 'footer', 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 1, 'mod_version', 3, 1, '{"format":"short","product":"1","layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*'); @@ -1949,6 +1954,7 @@ INSERT INTO "#__modules_menu" VALUES (15,0), (16,0), (17,0), +(18,0), (79,0), (86,0); diff --git a/installation/sql/sqlazure/joomla.sql b/installation/sql/sqlazure/joomla.sql index 6fc8c712d9de9..711ad6e70fb28 100644 --- a/installation/sql/sqlazure/joomla.sql +++ b/installation/sql/sqlazure/joomla.sql @@ -107,6 +107,9 @@ UNION ALL SELECT 36,1,69,70,1,'com_contenthistory','com_contenthistory','{}' UNION ALL SELECT 37,1,71,72,1,'com_ajax','com_ajax','{}'; +UNION ALL +SELECT 38,1,69,70,1,'com_services','com_services','{}'; + SET IDENTITY_INSERT #__assets OFF; @@ -792,6 +795,9 @@ UNION ALL SELECT 29, 'com_tags', 'component', 'com_tags', '', 1, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL SELECT 31, 'com_ajax', 'component', 'com_ajax', '', 1, 1, 0, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0; +UNION ALL +SELECT 32, 'com_services', 'component', 'com_services', '', 1, 1, 0, 0, '{"name":"com_services","type":"component","creationDate":"2013-06-31","author":"Joomla! Project","copyright":"Copyright Info","authorEmail":"Joomla@joomla.com","authorUrl":"http:\/\/joomla.org","version":"1.0.0","description":"Front End Admin Services Configuration Manager","group":""}', '{}', '', '', 0, '1900-01-01 00:00:00', 0, 0; + INSERT INTO #__extensions (extension_id, name, type, element, folder, client_id, enabled, access, protected, manifest_cache, params, custom_data, system_data, checked_out, checked_out_time, ordering, state) SELECT 100, 'PHPMailer', 'library', 'phpmailer', '', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0 @@ -888,7 +894,9 @@ SELECT 313, 'mod_multilangstatus', 'module', 'mod_multilangstatus', '', 1, 1, 1, UNION ALL SELECT 314, 'mod_version', 'module', 'mod_version', '', 1, 1, 1, 0, '', '{"format":"short","product":"1","cache":"0"}', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL -SELECT 315, 'mod_stats_admin', 'module', 'mod_stats_admin', '', 1, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0; +SELECT 315, 'mod_stats_admin', 'module', 'mod_stats_admin', '', 1, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0 +UNION ALL +SELECT 318, 'mod_admin_services', 'module', 'mod_admin_services', '', 0, 1, 0, 0, '{"name":"mod_admin_services","type":"module","creationDate":"June 2013","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2013 Open Source Matters. All rights\n\t\treserved.\n\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.2.0","description":"MOD_ADMIN_SERVICES_XML_DESCRIPTION","group":""}', '{"config_visible":"1"}', '', '', 0, '1900-01-01 00:00:00', 0, 0; INSERT INTO #__extensions (extension_id, name, type, element, folder, client_id, enabled, access, protected, manifest_cache, params, custom_data, system_data, checked_out, checked_out_time, ordering, state) SELECT 400, 'plg_authentication_gmail', 'plugin', 'gmail', 'authentication', 0, 0, 1, 0, '', '{"applysuffix":"0","suffix":"","verifypeer":"1","user_blacklist":""}', '', '', 0, '1900-01-01 00:00:00', 1, 0 @@ -2154,6 +2162,8 @@ SELECT 16, 'Login Form', '', '', 7, 'position-7', 0, '1900-01-01 00:00:00', '190 UNION ALL SELECT 17, 'Breadcrumbs', '', '', 1, 'position-2', 0, '1900-01-01 00:00:00', '1900-01-01 00:00:00', '1900-01-01 00:00:00', 1, 'mod_breadcrumbs', 1, 1, '{"moduleclass_sfx":"","showHome":"1","homeText":"","showComponent":"1","separator":"","cache":"1","cache_time":"900","cachemode":"itemid"}', 0, '*' UNION ALL +SELECT 18, 'Admin Services', '', '', 1, 'position-7', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_admin_services', 1, 1, '{"config_visible":"1","templates_visible":"1","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 0, '*' +UNION ALL SELECT 79, 'Multilanguage status', '', '', 1, 'status', 0, '1900-01-01 00:00:00', '1900-01-01 00:00:00', '1900-01-01 00:00:00', 0, 'mod_multilangstatus', 3, 1, '{"layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*' UNION ALL SELECT 86, 'Joomla Version', '', '', 1, 'footer', 0, '1900-01-01 00:00:00', '1900-01-01 00:00:00', '1900-01-01 00:00:00', 1, 'mod_version', 3, 1, '{"format":"short","product":"1","layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*'; @@ -2206,6 +2216,8 @@ SELECT 16,0 UNION ALL SELECT 17,0 UNION ALL +SELECT 18,0 +UNION ALL SELECT 79,0 UNION ALL SELECT 86,0; diff --git a/language/en-GB/en-GB.com_services.ini b/language/en-GB/en-GB.com_services.ini new file mode 100644 index 0000000000000..50348034c6ce3 --- /dev/null +++ b/language/en-GB/en-GB.com_services.ini @@ -0,0 +1,32 @@ +; Joomla! Project +; Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +COM_SERVICES="Admin Services" +COM_SERVICES_CONFIGURATION="Admin Services Configuration" +COM_SERVICES_ERROR_CONTROLLER_NOT_FOUND="Controller Not found!" +COM_SERVICES_FIELD_DEFAULT_ACCESS_LEVEL_DESC="Select the default access level for new content, menu items, and other items created on your site." +COM_SERVICES_FIELD_DEFAULT_ACCESS_LEVEL_LABEL="Default Access Level" +COM_SERVICES_FIELD_DEFAULT_LIST_LIMIT_DESC="Sets the default length of lists in the Control Panel for all users" +COM_SERVICES_FIELD_DEFAULT_LIST_LIMIT_LABEL="Default List Limit" +COM_SERVICES_FIELD_METADESC_DESC="Enter a description of the overall Web site that is to be used by search engines. Generally, a maximum of 20 words is optimal." +COM_SERVICES_FIELD_METADESC_LABEL="Site Meta Description" +COM_SERVICES_FIELD_METAKEYS_DESC="Enter the keywords and phrases that best describe your Web site. Separate keywords and phrases with a comma." +COM_SERVICES_FIELD_METAKEYS_LABEL="Site Meta Keywords" +COM_SERVICES_FIELD_SEF_URL_DESC="Select whether or not the URLs are optimised for Search Engines." +COM_SERVICES_FIELD_SEF_URL_LABEL="Search Engine Friendly URLs" +COM_SERVICES_FIELD_SITE_NAME_DESC="Enter the name of your Web site. This will be used in various locations (e.g. the backend browser title bar and Site Offline pages)." +COM_SERVICES_FIELD_SITE_NAME_LABEL="Site Name" +COM_SERVICES_FIELD_VALUE_AFTER="After" +COM_SERVICES_FIELD_VALUE_BEFORE="Before" +COM_SERVICES_FIELD_SITE_OFFLINE_DESC="Select whether access to the Site frontend is available. If Yes, the frontend will display or not a message depending on the settings below." +COM_SERVICES_FIELD_SITE_OFFLINE_LABEL="Site Offline" +COM_SERVICES_FIELD_SITENAME_PAGETITLES_DESC="Begin or end all Page Titles with the site name (for example, My Site Name - My Article Name)." +COM_SERVICES_FIELD_SITENAME_PAGETITLES_LABEL="Include Site Name in Page Titles" +COM_SERVICES_METADATA_SETTINGS="Metadata Settings" +COM_SERVICES_SAVE_SUCCESS="Configuration successfully saved." +COM_SERVICES_SEO_SETTINGS="SEO Settings" +COM_SERVICES_SITE_SETTINGS="Site Settings" +COM_SERVICES_TEMPLATE_SETTINGS="Template Settings" +COM_SERVICES_XML_DESCRIPTION="Front End Admin Services Configuration Manager" \ No newline at end of file diff --git a/language/en-GB/en-GB.mod_admin_services.ini b/language/en-GB/en-GB.mod_admin_services.ini new file mode 100644 index 0000000000000..17dd4fc34f4d5 --- /dev/null +++ b/language/en-GB/en-GB.mod_admin_services.ini @@ -0,0 +1,11 @@ +; Joomla! Project +; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 - No BOM + +MOD_ADMIN_SERVICES = "Admin Services"; +MOD_ADMIN_SERVICES_FIELD_CONFIG_VISIBLE_LABEL = "Show Configurations menu item"; +MOD_ADMIN_SERVICES_FIELD_CONFIG_VISIBLE_DESCRIPTION = "To Show/Hide Configurations entry in Admin Services menu"; +MOD_ADMIN_SERVICES_FIELD_TEMPLATES_VISIBLE_LABEL = "Show Templates menu item"; +MOD_ADMIN_SERVICES_FIELD_TEMPLATES_VISIBLE_DESCRIPTION = "To Show/Hide Templates entry in Admin Services menu"; +MOD_ADMIN_SERVICES_XML_DESCRIPTION = "This module can configure front end admin services menu."; \ No newline at end of file diff --git a/language/en-GB/en-GB.mod_admin_services.sys.ini b/language/en-GB/en-GB.mod_admin_services.sys.ini new file mode 100644 index 0000000000000..d893c4340d542 --- /dev/null +++ b/language/en-GB/en-GB.mod_admin_services.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 - No BOM + +MOD_ADMIN_SERVICES = "Admin Services"; +MOD_ADMIN_SERVICES_XML_DESCRIPTION = "This module can configure front end admin services menu." \ No newline at end of file diff --git a/libraries/cms/controller/cancel.php b/libraries/cms/controller/cancel.php new file mode 100644 index 0000000000000..57c6a781aa08d --- /dev/null +++ b/libraries/cms/controller/cancel.php @@ -0,0 +1,37 @@ +app->redirect(JURI::base()); + + return true; + } +} diff --git a/libraries/cms/controller/canceladmin.php b/libraries/cms/controller/canceladmin.php new file mode 100644 index 0000000000000..05d9bd44e7015 --- /dev/null +++ b/libraries/cms/controller/canceladmin.php @@ -0,0 +1,84 @@ +app->redirect('index.php', JText::_('JINVALID_TOKEN')); + } + + if (empty($this->context)) + { + $this->context = $this->option.edit . $this->context ; + } + + // Redirect. + $this->app->setUserState($this->context . '.data', null); + + if (!empty($this->redirect)) + { + $this->app->redirect(JURI::base()); + } + else + { + parent::execute(); + } + + return true; + + } +} diff --git a/libraries/cms/controller/cmsbase.php b/libraries/cms/controller/cmsbase.php new file mode 100644 index 0000000000000..d0158650f9459 --- /dev/null +++ b/libraries/cms/controller/cmsbase.php @@ -0,0 +1,48 @@ +app = $this->getApplication(); + $this->app->redirect('index.php?option=' . $this->input->get('option', 'com_cpanel')); + + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JInvalid_Token')); + + $this->componentFolder = $this->input->getWord('option', 'com_content'); + $this->viewName = $this->input->getWord('view', 'articles'); + + return $this; + + } +} \ No newline at end of file diff --git a/libraries/cms/controller/display.php b/libraries/cms/controller/display.php new file mode 100644 index 0000000000000..288289e1873fb --- /dev/null +++ b/libraries/cms/controller/display.php @@ -0,0 +1,95 @@ +getApplication(); + + // Get the document object. + $document = JFactory::getDocument(); + + $componentFolder = $this->input->getWord('option', 'com_content'); + $viewName = $this->input->getWord('view'); + $viewFormat = $document->getType(); + $layoutName = $this->input->getWord('layout', 'default'); + + // Register the layout paths for the view + $paths = new SplPriorityQueue; + + if ($app->isAdmin()) + { + $paths->insert(JPATH_ADMINISTRATOR . '/components/' . $componentFolder . '/view/' . $viewName . '/tmpl', 'normal'); + } + else + { + $paths->insert(JPATH_BASE . '/components/' . $componentFolder . '/view/' . $viewName . '/tmpl', 'normal'); + } + + + $viewClass = $this->prefix . 'View' . ucfirst($viewName) . ucfirst($viewFormat); + $modelClass = $this->prefix . 'Model' . ucfirst($viewName); + + if (class_exists($viewClass)) + { + $model = new $modelClass; + + // Access check. + if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option'))) + { + + $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); + + return; + } + + $view = new $viewClass($model, $paths); + + $view->setLayout($layoutName); + + // Push document object into the view. + $view->document = $document; + + // Reply for service requests + if ($viewFormat == 'json') + { + + return $view->render(); + } + + // Render view. + echo $view->render(); + } + + return true; + } +} \ No newline at end of file diff --git a/libraries/cms/controller/helper.php b/libraries/cms/controller/helper.php new file mode 100644 index 0000000000000..939c40d20ed1f --- /dev/null +++ b/libraries/cms/controller/helper.php @@ -0,0 +1,112 @@ +input->get('controller')) + { + // Temporary solution + if (strpos($controllerTask, '/') !== false) + { + $tasks = explode('/', $controllerTask); + } + else + { + $tasks = explode('.', $controllerTask); + } + } + else + { + // Checking for old MVC task + $task = $app->input->get('task'); + + // Toolbar expects old style but we are using new style + // Remove when toolbar can handle either directly + if (strpos($task, '/') !== false) + { + $tasks = explode('/', $task); + } + else + { + $tasks = explode('.', $task); + } + } + + if (empty($tasks[0]) || $tasks[0] == 'j') + { + $location = 'J'; + } + else + { + $location = ucfirst(strtolower($tasks[0])); + } + + if (empty($tasks[1])) + { + $activity = 'Display'; + } + else + { + $activity = ucfirst(strtolower($tasks[1])); + } + + $view = ''; + + if (empty($tasks[2]) && $location != 'J') + { + $view = ucfirst(strtolower($app->input->get('view'))); + } + elseif ($location != 'J') + { + $view = ucfirst(strtolower($tasks[2])); + } + + $controllerName = $location . 'Controller' . $view . $activity; + + if (!class_exists($controllerName)) + { + return false; + } + + $controller = new $controllerName; + $controller->options = array(); + $controller->options = $tasks; + + return $controller; + } +} \ No newline at end of file diff --git a/libraries/cms/model/cms.php b/libraries/cms/model/cms.php new file mode 100644 index 0000000000000..86b698f241eb8 --- /dev/null +++ b/libraries/cms/model/cms.php @@ -0,0 +1,317 @@ +option)) + { + $r = null; + + if (!preg_match('/(.*)Model/i', get_class($this), $r)) + { + throw new Exception(JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME'), 500); + } + + $this->option = 'com_' . strtolower($r[1]); + } + + // Set the view name + if (empty($this->name)) + { + if (array_key_exists('name', $config)) + { + $this->name = $config['name']; + } + else + { + $this->name = $this->getName(); + } + } + + // Set the model state + if (array_key_exists('state', $config)) + { + $this->state = $config['state']; + } + else + { + $this->state = new JObject; + } + + // Set the model dbo + if (array_key_exists('dbo', $config)) + { + $this->_db = $config['dbo']; + } + else + { + $this->_db = JFactory::getDbo(); + } + + // Register the paths for the form + $paths = $this->registerTablePaths($config); + + // Set the internal state marker - used to ignore setting state from the request + if (!empty($config['ignore_request'])) + { + $this->__state_set = true; + } + + // Set the clean cache event + if (isset($config['event_clean_cache'])) + { + $this->event_clean_cache = $config['event_clean_cache']; + } + elseif (empty($this->event_clean_cache)) + { + $this->event_clean_cache = 'onContentCleanCache'; + } + + $state = new JRegistry($config); + + parent::__construct($state); + } + + /** + * Method to get the model name + * + * The model name. By default parsed using the classname or it can be set + * by passing a $config['name'] in the class constructor + * + * @return string The name of the model + * + * @since 3.2 + * @throws Exception + */ + public function getName() + { + if (empty($this->name)) + { + $r = null; + if (!preg_match('/Model(.*)/i', get_class($this), $r)) + { + throw new Exception(JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME'), 500); + } + $this->name = strtolower($r[1]); + } + + return $this->name; + } + + /** + * Method to get model state variables + * + * + * @return object The property where specified, the state object where omitted + * + * @since 3.2 + */ + public function getState() + { + if (!$this->__state_set) + { + // Protected method to auto-populate the model state. + $this->populateState(); + + // Set the model state set flag to true. + $this->__state_set = true; + } + + return $this->state; + } + + /** + * Method to get a table object, load it if necessary. + * + * @param string $name The table name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $options Configuration array for model. Optional. + * + * @return JTable A JTable object + * + * @since 3.2 + * @throws Exception + */ + public function getTable($name = '', $prefix = 'Table', $options = array()) + { + if (empty($name)) + { + $name = $this->getName(); + } + + if ($table = $this->_createTable($name, $prefix, $options)) + { + return $table; + } + + throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_TABLE_NAME_NOT_SUPPORTED', $name), 0); + } + + /** + * Method to register paths for tables + * + * @return object The property where specified, the state object where omitted + * + * @since 3.2 + */ + public function registerTablePaths($config = array()) + { + // Set the default view search path + if (array_key_exists('table_path', $config)) + { + $this->addTablePath($config['table_path']); + } + elseif (defined('JPATH_COMPONENT_ADMINISTRATOR')) + { + // Register the paths for the form + $paths = new SplPriorityQueue; + $paths->insert(JPATH_COMPONENT_ADMINISTRATOR . '/table', 'normal'); + + // For legacy purposes. Remove for 4.0 + $paths->insert(JPATH_COMPONENT_ADMINISTRATOR . '/tables', 'normal'); + + } + } + + /** + * Clean the cache + * + * @param string $group The cache group + * @param integer $client_id The ID of the client + * + * @return void + * + * @since 3.2 + */ + protected function cleanCache($group = null, $client_id = 0) + { + $conf = JFactory::getConfig(); + $dispatcher = JEventDispatcher::getInstance(); + + $options = array( + 'defaultgroup' => ($group) ? $group : (isset($this->option) ? $this->option : JFactory::getApplication()->input->get('option')), + 'cachebase' => ($client_id) ? JPATH_ADMINISTRATOR . '/cache' : $conf->get('cache_path', JPATH_SITE . '/cache')); + + $cache = JCache::getInstance('callback', $options); + $cache->clean(); + + // Trigger the onContentCleanCache event. + $dispatcher->trigger($this->event_clean_cache, $options); + } + + /** + * Method to auto-populate the model state. + * + * This method should only be called once per instantiation and is designed + * to be called on the first call to the getState() method unless the model + * configuration flag to ignore the request is set. + * + * @return void + * + * @note Calling getState in this method will result in recursion. + * @since 3.2 + */ + protected function populateState() + { + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 3.2 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + $user = JFactory::getUser(); + + return $user->authorise('core.delete', $this->option); + + } + } + + + + /** + * Method to test whether a record can have its state changed. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 3.2 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + + return $user->authorise('core.edit.state', $this->option); + } +} \ No newline at end of file diff --git a/libraries/cms/model/cms/form.php b/libraries/cms/model/cms/form.php new file mode 100644 index 0000000000000..9413a25de5ed5 --- /dev/null +++ b/libraries/cms/model/cms/form.php @@ -0,0 +1,327 @@ +getTable(); + if (!$table->load($pk)) + { + $this->setError($table->getError()); + return false; + } + + // Check if this is the user has previously checked out the row. + if ($table->checked_out > 0 && $table->checked_out != $user->get('id') && !$user->authorise('core.admin', 'com_checkin')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_CHECKIN_USER_MISMATCH')); + return false; + } + + // Attempt to check the row in. + if (!$table->checkin($pk)) + { + $this->setError($table->getError()); + return false; + } + } + + return true; + } + + /** + * Method to check-out a row for editing. + * + * @param integer $pk The numeric id of the primary key. + * + * @return boolean False on failure or error, true otherwise. + * + * @since 3.2 + */ + public function checkout($pk = null) + { + // Only attempt to check the row in if it exists. + if ($pk) + { + $user = JFactory::getUser(); + + // Get an instance of the row to checkout. + $table = $this->getTable(); + + if (!$table->load($pk)) + { + $this->setError($table->getError()); + return false; + } + + // Check if this is the user having previously checked out the row. + if ($table->checked_out > 0 && $table->checked_out != $user->get('id')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_CHECKOUT_USER_MISMATCH')); + return false; + } + + // Attempt to check the row out. + if (!$table->checkout($user->get('id'), $pk)) + { + $this->setError($table->getError()); + return false; + } + } + + return true; + } + + /** + * Abstract method for getting the form from the model. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since 3.2 + */ + abstract public function getForm($data = array(), $loadData = true); + + /** + * Method to get a form object. + * + * @param string $name The name of the form. + * @param string $source The form source. Can be XML string if file flag is set to false. + * @param array $options Optional array of options for the form creation. + * @param boolean $clear Optional argument to force load a new form. + * @param string $xpath An optional xpath to search for the fields. + * + * @return mixed JForm object on success, False on error. + * + * @see JForm + * @since 3.2 + */ + protected function loadForm($name, $source = null, $options = array(), $clear = false, $xpath = false) + { + // Handle the optional arguments. + $options['control'] = JArrayHelper::getValue($options, 'control', false); + + // Create a signature hash. + $hash = sha1($source . serialize($options)); + + // Check if we can use a previously loaded form. + if (isset($this->_forms[$hash]) && !$clear) + { + return $this->_forms[$hash]; + } + + // Get the form. + // Register the paths for the form -- failing here + $paths = new SplPriorityQueue; + $paths->insert(JPATH_COMPONENT . '/model/form', 'normal'); + $paths->insert(JPATH_COMPONENT . '/model/field', 'normal'); + $paths->insert(JPATH_COMPONENT . '/model/rule', 'normal'); + + //Legacy support to be removed in 4.0. -- failing here + $paths->insert(JPATH_COMPONENT . '/models/forms', 'normal'); + $paths->insert(JPATH_COMPONENT . '/models/fields', 'normal'); + $paths->insert(JPATH_COMPONENT . '/models/rules', 'normal'); + + // Solution until JForm supports splqueue + JForm::addFormPath(JPATH_COMPONENT . '/models/forms'); + JForm::addFieldPath(JPATH_COMPONENT . '/models/fields'); + JForm::addFormPath(JPATH_COMPONENT . '/model/form'); + JForm::addFieldPath(JPATH_COMPONENT . '/model/field'); + + try + { + $form = JForm::getInstance($name, $source, $options, false, $xpath); + + if (isset($options['load_data']) && $options['load_data']) + { + // Get the data for the form. + $data = $this->loadFormData(); + } + else + { + $data = array(); + } + + // Allow for additional modification of the form, and events to be triggered. + // We pass the data because plugins may require it. + $this->preprocessForm($form, $data); + + // Load the data into the form after the plugins have operated. + $form->bind($data); + + } + catch (Exception $e) + { + + $app = JFactory::getApplication(); + $app->enqueueMessage($e->getMessage()); + + return false; + } + + // Store the form for later. + $this->_forms[$hash] = $form; + + return $form; + } + + /** + * Method to get the data that should be injected in the form. + * + * @return array The default data is an empty array. + * + * @since 3.2 + */ + protected function loadFormData() + { + return array(); + } + + /** + * Method to allow derived classes to preprocess the data. + * + * @param string $context The context identifier. + * @param mixed &$data The data to be processed. It gets altered directly. + * + * @return void + * + * @since 3.2 + */ + protected function preprocessData($context, &$data) + { + // Get the dispatcher and load the users plugins. + $dispatcher = JEventDispatcher::getInstance(); + JPluginHelper::importPlugin('content'); + + // Trigger the data preparation event. + $results = $dispatcher->trigger('onContentPrepareData', array($context, $data)); + + // Check for errors encountered while preparing the data. + if (count($results) > 0 && in_array(false, $results, true)) + { + $this->setError($dispatcher->getError()); + } + } + + /** + * Method to allow derived classes to preprocess the form. + * + * @param JForm $form A JForm object. + * @param mixed $data The data expected for the form. + * @param string $group The name of the plugin group to import (defaults to "content"). + * + * @return void + * + * @see JFormField + * @since 3.2 + * @throws Exception if there is an error in the form event. + */ + protected function preprocessForm(JForm $form, $data, $group = 'content') + { + // Import the appropriate plugin group. + JPluginHelper::importPlugin($group); + + // Get the dispatcher. + $dispatcher = JEventDispatcher::getInstance(); + + // Trigger the form preparation event. + $results = $dispatcher->trigger('onContentPrepareForm', array($form, $data)); + + // Check for errors encountered while preparing the form. + if (count($results) && in_array(false, $results, true)) + { + // Get the last error. + $error = $dispatcher->getError(); + + if (!($error instanceof Exception)) + { + throw new Exception($error); + } + } + } + + /** + * Method to validate the form data. + * + * @param JForm $form The form to validate against. + * @param array $data The data to validate. + * @param string $group The name of the field group to validate. + * + * @return mixed Array of filtered data if valid, false otherwise. + * + * @see JFormRule + * @see JFilterInput + * @since 3.2 + */ + public function validate($form, $data, $group = null) + { + // Filter and validate the form data. + $data = $form->filter($data); + $return = $form->validate($data, $group); + + // Check for an error. + if ($return instanceof Exception) + { + $this->setError($return->getMessage()); + return false; + } + + // Check the validation results. + if ($return === false) + { + // Get the validation messages from the form. + foreach ($form->getErrors() as $message) + { + $this->setError($message); + } + + return false; + } + + return $data; + } +} diff --git a/libraries/cms/view/html/cms.php b/libraries/cms/view/html/cms.php new file mode 100644 index 0000000000000..7c259d6b9cdda --- /dev/null +++ b/libraries/cms/view/html/cms.php @@ -0,0 +1,232 @@ + array(), 'helper' => array()); + + /** + * Layout extension + * + * @var string + */ + protected $_layoutExt = 'php'; + + /** + * Method to instantiate the view. + * + * @param JModel $model The model object. + * @param SplPriorityQueue $paths The paths queue. + * + * @since 12.1 + */ + public function __construct(JModel $model, SplPriorityQueue $paths = null) + { + + $app = JFactory::getApplication(); + $component = JApplicationHelper::getComponentName(); + $component = preg_replace('/[^A-Z0-9_\.-]/i', '', $component); + + if(isset($paths)) + { + $paths->insert(JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $this->getName(), 'normal'); + } + + parent::__construct($model, $paths); + + } + + /** + * Load a template file -- first look in the templates folder for an override + * + * @param string $tpl The name of the template source file; automatically searches the template paths and compiles as needed. + * + * @return string The output of the the template script. + * + * @since 3.2 + * @throws Exception + */ + public function loadTemplate($tpl = null) + { + // Clear prior output + $this->_output = null; + + $template = JFactory::getApplication()->getTemplate(); + $layout = $this->getLayout(); + + // Create the template file name based on the layout + $file = isset($tpl) ? $layout . '_' . $tpl : $layout; + + // Clean the file name + $file = preg_replace('/[^A-Z0-9_\.-]/i', '', $file); + $tpl = isset($tpl) ? preg_replace('/[^A-Z0-9_\.-]/i', '', $tpl) : $tpl; + + // Load the language file for the template + $lang = JFactory::getLanguage(); + $lang->load('tpl_' . $template, JPATH_BASE, null, false, false) + || $lang->load('tpl_' . $template, JPATH_THEMES . "/$template", null, false, false) + || $lang->load('tpl_' . $template, JPATH_BASE, $lang->getDefault(), false, false) + || $lang->load('tpl_' . $template, JPATH_THEMES . "/$template", $lang->getDefault(), false, false); + + // Change the template folder if alternative layout is in different template + /* if (isset($layoutTemplate) && $layoutTemplate != '_' && $layoutTemplate != $template) + { + $this->_path['template'] = str_replace($template, $layoutTemplate, $this->_path['template']); + } */ + + // Prevents adding path twise + if (empty($this->_path['template'])) + { + // Adding template paths + $this->paths->top(); + $defaultPath =$this->paths->current(); + $this->paths->next(); + $templatePath = $this->paths->current(); + $this->_path['template'] = array($defaultPath, $templatePath); + } + + // Load the template script + jimport('joomla.filesystem.path'); + $filetofind = $this->_createFileName('template', array('name' => $file)); + $this->_template = JPath::find($this->_path['template'], $filetofind); + + // If alternate layout can't be found, fall back to default layout + if ($this->_template == false) + { + $filetofind = $this->_createFileName('', array('name' => 'default' . (isset($tpl) ? '_' . $tpl : $tpl))); + $this->_template = JPath::find($this->_path['template'], $filetofind); + } + + if ($this->_template != false) + { + // Unset so as not to introduce into template scope + unset($tpl); + unset($file); + + // Never allow a 'this' property + if (isset($this->this)) + { + unset($this->this); + } + + // Start capturing output into a buffer + ob_start(); + + // Include the requested template filename in the local scope + // (this will execute the view logic). + include $this->_template; + + // Done with the requested template; get the buffer and + // clear it. + $this->_output = ob_get_contents(); + ob_end_clean(); + + return $this->_output; + } + else + { + + throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file), 500); + } + } + + /** + * Create the filename for a resource + * + * @param string $type The resource type to create the filename for + * @param array $parts An associative array of filename information + * + * @return string The filename + * + * @since 3.2 + */ + protected function _createFileName($type, $parts = array()) + { + $filename = ''; + + switch ($type) + { + case 'template': + $filename = strtolower($parts['name']) . '.' . $this->_layoutExt; + break; + + default: + $filename = strtolower($parts['name']) . '.php'; + break; + } + return $filename; + } + + /** + * Method to get the view name + * + * The model name by default parsed using the classname, or it can be set + * by passing a $config['name'] in the class constructor + * + * @return string The name of the model + * + * @since 3.2 + * @throws Exception + */ + public function getName() + { + if (empty($this->_name)) + { + $classname = get_class($this); + $viewpos = strpos($classname, 'View'); + + if ($viewpos === false) + { + throw new Exception(JText::_('JLIB_APPLICATION_ERROR_VIEW_GET_NAME'), 500); + } + + $lastPart = substr($classname, $viewpos + 4); + $pathParts = explode(' ', JStringNormalise::fromCamelCase($lastPart)); + + if (!empty($pathParts[1])) + { + $this->_name = strtolower($pathParts[0]); + } + else + { + $this->_name = strtolower($lastPart); + } + } + + return $this->_name; + } +} \ No newline at end of file diff --git a/libraries/cms/view/json.php b/libraries/cms/view/json.php new file mode 100644 index 0000000000000..807822aec8e37 --- /dev/null +++ b/libraries/cms/view/json.php @@ -0,0 +1,39 @@ +data = $this->model->getData(); + + return json_encode($this->data); + } +} \ No newline at end of file diff --git a/modules/mod_admin_services/helper.php b/modules/mod_admin_services/helper.php new file mode 100644 index 0000000000000..66eb3f5a69909 --- /dev/null +++ b/modules/mod_admin_services/helper.php @@ -0,0 +1,34 @@ +get('config_visible') == 1) + { + $configUrl = JURI::base() . 'index.php?option=com_services&view=config&controller=services.display.config'; + $result .= '
  • Configurations +
  • '; + } + + if ($params->get('templates_visible') == 1) + { + $templatesUrl = JURI::base() . 'index.php?option=com_services&view=templates&controller=services.display.templates'; + $result .= '
  • Templates +
  • '; + } + + return $result; + } +} diff --git a/modules/mod_admin_services/index.html b/modules/mod_admin_services/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/modules/mod_admin_services/index.html @@ -0,0 +1 @@ + diff --git a/modules/mod_admin_services/mod_admin_services.php b/modules/mod_admin_services/mod_admin_services.php new file mode 100644 index 0000000000000..aa5f5bea24a51 --- /dev/null +++ b/modules/mod_admin_services/mod_admin_services.php @@ -0,0 +1,26 @@ +id, 'core.admin')) +{ + + return; +} + +// Get javascript +$result = modAdminServicesHelper::execute($params); + +//Display javascript +require(JModuleHelper::getLayoutPath('mod_admin_services')); \ No newline at end of file diff --git a/modules/mod_admin_services/mod_admin_services.xml b/modules/mod_admin_services/mod_admin_services.xml new file mode 100644 index 0000000000000..4b1870bc779ab --- /dev/null +++ b/modules/mod_admin_services/mod_admin_services.xml @@ -0,0 +1,51 @@ + + + mod_admin_services + Joomla! Project + June 2013 + Copyright (C) 2005 - 2013 Open Source Matters. All rights + reserved. + + GNU General Public License version 2 or later; see LICENSE.txt + + admin@joomla.org + www.joomla.org + 3.2.0 + MOD_ADMIN_SERVICES_XML_DESCRIPTION + + mod_admin_services.php + tmpl + language + helper.php + index.html + mod_admin_services.xml + + + language/en-GB/en-GB.mod_admin_services.ini + + language/en-GB/en-GB.mod_admin_services.sys.ini + + + + +
    + + + + + + + + +
    +
    +
    +
    \ No newline at end of file diff --git a/modules/mod_admin_services/tmpl/default.php b/modules/mod_admin_services/tmpl/default.php new file mode 100644 index 0000000000000..cc3f8b00f40c5 --- /dev/null +++ b/modules/mod_admin_services/tmpl/default.php @@ -0,0 +1,13 @@ + + diff --git a/modules/mod_admin_services/tmpl/index.html b/modules/mod_admin_services/tmpl/index.html new file mode 100644 index 0000000000000..2efb97f319a35 --- /dev/null +++ b/modules/mod_admin_services/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/tests/system/webdriver/tests/phpunit.xml.dist b/tests/system/webdriver/tests/phpunit.xml.dist index 2866c2ec5fcd4..37a034a43b65c 100644 --- a/tests/system/webdriver/tests/phpunit.xml.dist +++ b/tests/system/webdriver/tests/phpunit.xml.dist @@ -8,7 +8,8 @@ control_panel extensions menus - users + users + services diff --git a/tests/unit/suites/libraries/joomla/crypt/cipher/JCryptCipher3DesTest.php b/tests/unit/suites/libraries/joomla/crypt/cipher/JCryptCipher3DesTest.php deleted file mode 100644 index 48379dcb11265..0000000000000 --- a/tests/unit/suites/libraries/joomla/crypt/cipher/JCryptCipher3DesTest.php +++ /dev/null @@ -1,154 +0,0 @@ -markTestSkipped('The mcrypt extension must be available for this test to run.'); - } - - $this->_cipher = new JCryptCipher3Des; - - // Build the key for testing. - $this->key = new JCryptKey('3des'); - $this->key->private = file_get_contents(__DIR__ . '/stubs/encrypted/3des/key.priv'); - $this->key->public = file_get_contents(__DIR__ . '/stubs/encrypted/3des/key.pub'); - } - - /** - * Cleans up the environment after running a test. - * - * @return void - * - * @since 12.1 - */ - protected function tearDown() - { - $this->_cipher = null; - - parent::tearDown(); - } - - /** - * Test... - * - * @return array - */ - public function data() - { - return array( - array( - '1.txt', - 'c-;3-(Is>{DJzOHMCv_<#yKuN/G`/Us{GkgicWG$M|HW;kI0BVZ^|FY/"Obt53?PNaWwhmRtH;lWkWE4vlG5CIFA!abu&F=Xo#Qw}gAp3;GL\'k])%D}C+W&ne6_F$3P5'), - array( - '2.txt', - 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ' . - 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor ' . - 'in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt ' . - 'in culpa qui officia deserunt mollit anim id est laborum.'), - array('3.txt', 'لا أحد يحب الألم بذاته، يسعى ورائه أو يبتغيه، ببساطة لأنه الألم...'), - array('4.txt', - 'Широкая электрификация южных губерний даст мощный ' . - 'толчок подъёму сельского хозяйства'), - array('5.txt', 'The quick brown fox jumps over the lazy dog.') - ); - } - - /** - * Tests JCryptCipher3Des->decrypt() - * - * @param string $file @todo - * @param string $data @todo - * - * @return void - * - * @dataProvider data - * @since 12.1 - */ - public function testDecrypt($file, $data) - { - $encrypted = file_get_contents(__DIR__ . '/stubs/encrypted/3des/' . $file); - $decrypted = $this->_cipher->decrypt($encrypted, $this->key); - - // Assert that the decrypted values are the same as the expected ones. - $this->assertEquals($data, $decrypted); - } - - /** - * Tests JCryptCipher3Des->encrypt() - * - * @param string $file @todo - * @param string $data @todo - * - * @return void - * - * @dataProvider data - * @since 12.1 - */ - public function testEncrypt($file, $data) - { - $encrypted = $this->_cipher->encrypt($data, $this->key); - - // Assert that the encrypted value is not the same as the clear text value. - $this->assertNotEquals($data, $encrypted); - - // Assert that the encrypted values are the same as the expected ones. - $this->assertStringEqualsFile(__DIR__ . '/stubs/encrypted/3des/' . $file, $encrypted); - } - - /** - * Tests JCryptCipher3Des->generateKey() - * - * @return void - * - * @since 12.1 - */ - public function testGenerateKey() - { - $key = $this->_cipher->generateKey(); - - // Assert that the key is the correct type. - $this->assertInstanceOf('JCryptKey', $key); - - // Assert that the private key is 24 bytes long. - $this->assertEquals(24, strlen($key->private)); - - // Assert the key is of the correct type. - $this->assertAttributeEquals('3des', 'type', $key); - } -}