diff --git a/README.md b/README.md index 8d0bcd4..0ef21d7 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,14 @@ Just a basic Questions & Answers. + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Questions and Answers](https://www.vdm.io/) + *First Build*: 30th January, 2017 -+ *Last Build*: 5th May, 2018 ++ *Last Build*: 27th December, 2018 + *Version*: 1.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html # Component Number -+ *Line count*: **28377** ++ *Line count*: **29049** + *File count*: **201** + *Folder count*: **62** diff --git a/admin/README.txt b/admin/README.txt index 8d0bcd4..0ef21d7 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -12,14 +12,14 @@ Just a basic Questions & Answers. + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Questions and Answers](https://www.vdm.io/) + *First Build*: 30th January, 2017 -+ *Last Build*: 5th May, 2018 ++ *Last Build*: 27th December, 2018 + *Version*: 1.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html # Component Number -+ *Line count*: **28377** ++ *Line count*: **29049** + *File count*: **201** + *Folder count*: **62** diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 6bcb81e..528d8ed 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -5,21 +5,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage admin.css - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ /* CSS Document */ diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 809a505..bbb8a3c 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -5,21 +5,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage dashboard.css - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ /* CSS Document */ diff --git a/admin/assets/css/help_document.css b/admin/assets/css/help_document.css index eddd073..cdce6f3 100644 --- a/admin/assets/css/help_document.css +++ b/admin/assets/css/help_document.css @@ -5,21 +5,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage help_document.css - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ /* CSS Document */ diff --git a/admin/assets/css/help_documents.css b/admin/assets/css/help_documents.css index 77e4608..ca05d33 100644 --- a/admin/assets/css/help_documents.css +++ b/admin/assets/css/help_documents.css @@ -5,21 +5,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage help_documents.css - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ /* CSS Document */ diff --git a/admin/assets/css/question_and_answer.css b/admin/assets/css/question_and_answer.css index b6e94d3..3361207 100644 --- a/admin/assets/css/question_and_answer.css +++ b/admin/assets/css/question_and_answer.css @@ -5,21 +5,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.css - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ /* CSS Document */ diff --git a/admin/assets/css/questions_and_answers.css b/admin/assets/css/questions_and_answers.css index d93dc50..8d2f0f4 100644 --- a/admin/assets/css/questions_and_answers.css +++ b/admin/assets/css/questions_and_answers.css @@ -5,21 +5,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage questions_and_answers.css - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ /* CSS Document */ diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js index 1fe4df4..882a196 100644 --- a/admin/assets/js/admin.js +++ b/admin/assets/js/admin.js @@ -5,21 +5,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage admin.js - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ /* JS Document */ diff --git a/admin/config.xml b/admin/config.xml index c1b70df..bba717c 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -141,7 +141,8 @@ description="COM_QUESTIONSANSWERS_CONFIG_DOCUMENT_FORMATS_DESCRIPTION" class="list_class" multiple="true" - filter="ARRAY"> + filter="ARRAY" + default=""> @@ -180,7 +181,8 @@ description="COM_QUESTIONSANSWERS_CONFIG_IMAGE_FORMATS_DESCRIPTION" class="list_class" multiple="true" - filter="ARRAY"> + filter="ARRAY" + default=""> diff --git a/admin/controller.php b/admin/controller.php index 40c8c6a..e4ec118 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -6,29 +6,26 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage controller.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controller library -jimport('joomla.application.component.controller'); - /** * General Controller of Questionsanswers component */ diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 0aa3606..4ae08c2 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -6,29 +6,26 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage ajax.json.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controllerform library -jimport('joomla.application.component.controller'); - /** * Questionsanswers Ajax Controller */ diff --git a/admin/controllers/download.php b/admin/controllers/download.php index 249afd3..1cfd59f 100644 --- a/admin/controllers/download.php +++ b/admin/controllers/download.php @@ -6,21 +6,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage download.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file diff --git a/admin/controllers/help.php b/admin/controllers/help.php index 01e2f57..43a383c 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -6,29 +6,26 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage help.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controllerform library -jimport('joomla.application.component.controller'); - /** * Questionsanswers Help Controller */ diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index 20143b8..0dedc68 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -6,29 +6,26 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage help_document.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controllerform library -jimport('joomla.application.component.controllerform'); - /** * Help_document Controller */ @@ -43,6 +40,13 @@ class QuestionsanswersControllerHelp_document extends JControllerForm */ protected $task; + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ public function __construct($config = array()) { $this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view. @@ -60,14 +64,17 @@ class QuestionsanswersControllerHelp_document extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers'); + $access = $user->authorise('help_document.access', 'com_questionsanswers'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('help_document.create', $this->option); + return $user->authorise('help_document.create', $this->option); } /** @@ -83,9 +90,9 @@ class QuestionsanswersControllerHelp_document extends JControllerForm protected function allowEdit($data = array(), $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = JFactory::getUser(); // get record id. - $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. @@ -141,42 +148,25 @@ class QuestionsanswersControllerHelp_document extends JControllerForm * * @return string The arguments to append to the redirect URL. * - * @since 12.2 + * @since 1.6 */ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') { - $tmpl = $this->input->get('tmpl'); - $layout = $this->input->get('layout', 'edit', 'string'); + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); - $ref = $this->input->get('ref', 0, 'string'); - $refid = $this->input->get('refid', 0, 'int'); + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); - // Setup redirect info. - - $append = ''; - - if ($refid) + // set the referral options + if ($refid && $ref) { - $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; } elseif ($ref) { - $append .= '&ref='.(string)$ref; - } - - if ($tmpl) - { - $append .= '&tmpl=' . $tmpl; - } - - if ($layout) - { - $append .= '&layout=' . $layout; - } - - if ($recordId) - { - $append .= '&' . $urlVar . '=' . $recordId; + $append = '&ref='. (string)$ref . $append; } return $append; @@ -215,43 +205,45 @@ class QuestionsanswersControllerHelp_document extends JControllerForm */ public function cancel($key = null) { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if ($this->refid) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + $redirect = base64_decode($return); - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -270,11 +262,15 @@ class QuestionsanswersControllerHelp_document extends JControllerForm */ public function save($key = null, $urlVar = null) { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) { // to make sure the item is checkedin on redirect $this->task = 'save'; @@ -282,9 +278,22 @@ class QuestionsanswersControllerHelp_document extends JControllerForm $saved = parent::save($key, $urlVar); - if ($this->refid && $saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; // Redirect to the item screen. $this->setRedirect( @@ -293,9 +302,9 @@ class QuestionsanswersControllerHelp_document extends JControllerForm ) ); } - elseif ($this->ref && $saved) + elseif ($this->ref) { - $redirect = '&view='.(string)$this->ref; + $redirect = '&view=' . (string)$this->ref; // Redirect to the list screen. $this->setRedirect( diff --git a/admin/controllers/help_documents.php b/admin/controllers/help_documents.php index c4db6c3..b0e598a 100644 --- a/admin/controllers/help_documents.php +++ b/admin/controllers/help_documents.php @@ -6,44 +6,53 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage help_documents.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controlleradmin library -jimport('joomla.application.component.controlleradmin'); - /** * Help_documents Controller */ class QuestionsanswersControllerHelp_documents extends JControllerAdmin { - protected $text_prefix = 'COM_QUESTIONSANSWERS_HELP_DOCUMENTS'; /** - * Proxy for getModel. - * @since 2.5 + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 */ - public function getModel($name = 'Help_document', $prefix = 'QuestionsanswersModel', $config = array()) + protected $text_prefix = 'COM_QUESTIONSANSWERS_HELP_DOCUMENTS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Help_document', $prefix = 'QuestionsanswersModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -107,5 +116,5 @@ class QuestionsanswersControllerHelp_documents extends JControllerAdmin $message = JText::_('COM_QUESTIONSANSWERS_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_questionsanswers&view=help_documents', false), $message, 'error'); return; - } + } } diff --git a/admin/controllers/import.php b/admin/controllers/import.php index 593ef83..e106ed0 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -6,21 +6,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage import.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file diff --git a/admin/controllers/question_and_answer.php b/admin/controllers/question_and_answer.php index 4547fa7..85db451 100644 --- a/admin/controllers/question_and_answer.php +++ b/admin/controllers/question_and_answer.php @@ -6,29 +6,26 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage question_and_answer.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controllerform library -jimport('joomla.application.component.controllerform'); - /** * Question_and_answer Controller */ @@ -43,6 +40,13 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm */ protected $task; + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ public function __construct($config = array()) { $this->view_list = 'Questions_and_answers'; // safeguard for setting the return view listing to the main view. @@ -60,14 +64,17 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers'); + $access = $user->authorise('question_and_answer.access', 'com_questionsanswers'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('question_and_answer.create', $this->option); + return $user->authorise('question_and_answer.create', $this->option); } /** @@ -82,9 +89,9 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm */ protected function allowEdit($data = array(), $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = JFactory::getUser(); // get record id. - $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. @@ -140,42 +147,25 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm * * @return string The arguments to append to the redirect URL. * - * @since 12.2 + * @since 1.6 */ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') { - $tmpl = $this->input->get('tmpl'); - $layout = $this->input->get('layout', 'edit', 'string'); + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); - $ref = $this->input->get('ref', 0, 'string'); - $refid = $this->input->get('refid', 0, 'int'); + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); - // Setup redirect info. - - $append = ''; - - if ($refid) + // set the referral options + if ($refid && $ref) { - $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; } elseif ($ref) { - $append .= '&ref='.(string)$ref; - } - - if ($tmpl) - { - $append .= '&tmpl=' . $tmpl; - } - - if ($layout) - { - $append .= '&layout=' . $layout; - } - - if ($recordId) - { - $append .= '&' . $urlVar . '=' . $recordId; + $append = '&ref='. (string)$ref . $append; } return $append; @@ -214,43 +204,45 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm */ public function cancel($key = null) { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if ($this->refid) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + $redirect = base64_decode($return); - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -269,11 +261,15 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm */ public function save($key = null, $urlVar = null) { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) { // to make sure the item is checkedin on redirect $this->task = 'save'; @@ -281,9 +277,22 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm $saved = parent::save($key, $urlVar); - if ($this->refid && $saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; // Redirect to the item screen. $this->setRedirect( @@ -292,9 +301,9 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm ) ); } - elseif ($this->ref && $saved) + elseif ($this->ref) { - $redirect = '&view='.(string)$this->ref; + $redirect = '&view=' . (string)$this->ref; // Redirect to the list screen. $this->setRedirect( diff --git a/admin/controllers/questions_and_answers.php b/admin/controllers/questions_and_answers.php index 3d3bef4..14692d4 100644 --- a/admin/controllers/questions_and_answers.php +++ b/admin/controllers/questions_and_answers.php @@ -6,44 +6,53 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage questions_and_answers.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controlleradmin library -jimport('joomla.application.component.controlleradmin'); - /** * Questions_and_answers Controller */ class QuestionsanswersControllerQuestions_and_answers extends JControllerAdmin { - protected $text_prefix = 'COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS'; /** - * Proxy for getModel. - * @since 2.5 + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 */ - public function getModel($name = 'Question_and_answer', $prefix = 'QuestionsanswersModel', $config = array()) + protected $text_prefix = 'COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Question_and_answer', $prefix = 'QuestionsanswersModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -107,5 +116,5 @@ class QuestionsanswersControllerQuestions_and_answers extends JControllerAdmin $message = JText::_('COM_QUESTIONSANSWERS_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_questionsanswers&view=questions_and_answers', false), $message, 'error'); return; - } + } } diff --git a/admin/controllers/questionsanswers.php b/admin/controllers/questionsanswers.php index 91fc23a..1a057cb 100644 --- a/admin/controllers/questionsanswers.php +++ b/admin/controllers/questionsanswers.php @@ -6,29 +6,26 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage questionsanswers.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controlleradmin library -jimport('joomla.application.component.controlleradmin'); - /** * Questionsanswers Controller */ diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index b9fcf21..544d303 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -6,21 +6,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage headercheck.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index ee0065f..e2c3ba1 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -6,21 +6,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage batch_.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file diff --git a/admin/helpers/questionsanswers.php b/admin/helpers/questionsanswers.php index b6b51cf..d839659 100644 --- a/admin/helpers/questionsanswers.php +++ b/admin/helpers/questionsanswers.php @@ -6,21 +6,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage questionsanswers.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file @@ -39,7 +39,7 @@ abstract class QuestionsanswersHelper { // the Session keeps track of all data related to the current session of this user self::loadSession(); - } + } /** * the globals @@ -77,6 +77,10 @@ abstract class QuestionsanswersHelper **/ public static function set($key, $value) { + if (!isset(self::$session) || !self::checkObject(self::$session)) + { + self::$session = JFactory::getSession(); + } // set to local memory to speed up program self::$localSession[$key] = $value; // load to session for later use @@ -88,6 +92,10 @@ abstract class QuestionsanswersHelper **/ public static function get($key, $default = null) { + if (!isset(self::$session) || !self::checkObject(self::$session)) + { + self::$session = JFactory::getSession(); + } // check if in local memory if (!isset(self::$localSession[$key])) { @@ -258,18 +266,23 @@ abstract class QuestionsanswersHelper /** - * Get the file path or url + * Get the file path or url * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found * - * @return string On success the path or url is returned based on the type requested + * @return string On success the path or url is returned based on the type requested * */ - public static function getFolderPath($type = 'path', $target = 'folderpath', $default = JPATH_SITE . '/images/', $createIfNotSet = true) + public static function getFolderPath($type = 'path', $target = 'folderpath', $default = '', $createIfNotSet = true) { + // make sure to always have a string/path + if(!self::checkString($default)) + { + $default = JPATH_SITE . '/images/'; + } // get the global settings if (!self::checkObject(self::$params)) { @@ -311,8 +324,13 @@ abstract class QuestionsanswersHelper * @return string On success the path or url is returned based on the type requested * */ - public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = JPATH_SITE . '/images/', $createIfNotSet = true) + public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true) { + // make sure to always have a string/path + if(!self::checkString($default)) + { + $default = JPATH_SITE . '/images/'; + } // get the global settings if (!self::checkObject(self::$params)) { @@ -477,6 +495,30 @@ abstract class QuestionsanswersHelper return date('G:i',$time); } + /** + * set the date as 2004/05 (for charts) + */ + public static function setYearMonth($date) + { + if (!self::isValidTimeStamp($date)) + { + $date = strtotime($date); + } + return date('Y/m', $date); + } + + /** + * set the date as 2004/05/03 (for charts) + */ + public static function setYearMonthDay($date) + { + if (!self::isValidTimeStamp($date)) + { + $date = strtotime($date); + } + return date('Y/m/d', $date); + } + /** * Check if string is a valid time stamp */ @@ -514,26 +556,53 @@ abstract class QuestionsanswersHelper } + /** + * The Dynamic Data Array + * + * @var array + */ protected static $dynamicData = array(); + /** + * Set the Dynamic Data + * + * @param string $data The data to update + * @param array $placeholders The placeholders to use to update data + * + * @return string of updated data + * + */ public static function setDynamicData($data, $placeholders) { - $keyMD5 = md5($data.json_encode($placeholders)); - if (!isset(self::$dynamicData[$keyMD5])) + // make sure data is a string & placeholders is an array + if (self::checkString($data) && self::checkArray($placeholders)) { - if (self::checkArray($placeholders)) + // store in memory in case it is build multiple times + $keyMD5 = md5($data.json_encode($placeholders)); + if (!isset(self::$dynamicData[$keyMD5])) { + // remove all values that are not strings (just to be safe) + $placeholders = array_filter($placeholders, function ($val){ if (self::checkArray($val) || self::checkObject($val)) { return false; } return true; }); + // model (basic) based on logic self::setTheIF($data, $placeholders); + // update the string and store in memory self::$dynamicData[$keyMD5] = str_replace(array_keys($placeholders), array_values($placeholders), $data); } - else - { - self::$dynamicData[$keyMD5] = $data; - } + // return updated string + return self::$dynamicData[$keyMD5]; } - return self::$dynamicData[$keyMD5]; + return $data; } + /** + * Set the IF statements + * + * @param string $string The string to update + * @param array $placeholders The placeholders to use to update string + * + * @return void + * + */ protected static function setTheIF(&$string, $placeholders) { // only normal if endif @@ -578,6 +647,15 @@ abstract class QuestionsanswersHelper } } + /** + * Set the remainder IF + * + * @param array $match The match search + * @param array $placeholders The placeholders to use to match + * + * @return string of remainder + * + */ protected static function remainderIF(&$match, &$placeholders) { // default we keep nothing @@ -608,7 +686,7 @@ abstract class QuestionsanswersHelper { $keep = addcslashes($match[$length - 1], '$'); } - return $keep; + return $keep; } public static function hasEditAccess($recordId, $userId = null, $to = 'question_and_answer') @@ -1693,7 +1771,7 @@ abstract class QuestionsanswersHelper return 'application/octet-stream'; } /** - * Load the Component xml manifest. + * Load the Component xml manifest. **/ public static function manifest() { @@ -1702,12 +1780,12 @@ abstract class QuestionsanswersHelper } /** - * Joomla version object + * Joomla version object **/ protected static $JVersion; /** - * set/get Joomla version + * set/get Joomla version **/ public static function jVersion() { @@ -1720,7 +1798,7 @@ abstract class QuestionsanswersHelper } /** - * Load the Contributors details. + * Load the Contributors details. **/ public static function getContributors() { @@ -1758,8 +1836,8 @@ abstract class QuestionsanswersHelper } /** - * Load the Component Help URLs. - **/ + * Load the Component Help URLs. + **/ public static function getHelpUrl($view) { $user = JFactory::getUser(); @@ -1796,15 +1874,15 @@ abstract class QuestionsanswersHelper // set joomla article case 1: return self::loadArticleLink($help->article); - break; + break; // set help text case 2: return self::loadHelpTextLink($help->id); - break; + break; // set Link case 3: return $help->url; - break; + break; } } } @@ -1813,16 +1891,16 @@ abstract class QuestionsanswersHelper } /** - * Get the Article Link. - **/ + * Get the Article Link. + **/ protected static function loadArticleLink($id) { return JURI::root().'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal'; } /** - * Get the Help Text Link. - **/ + * Get the Help Text Link. + **/ protected static function loadHelpTextLink($id) { $token = JSession::getFormToken(); @@ -1830,7 +1908,7 @@ abstract class QuestionsanswersHelper } /** - * Configure the Linkbar. + * Configure the Linkbar. **/ public static function addSubmenu($submenu) { @@ -1847,11 +1925,11 @@ abstract class QuestionsanswersHelper { JHtmlSidebar::addEntry(JText::_('COM_QUESTIONSANSWERS_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_questionsanswers&view=help_documents', $submenu === 'help_documents'); } - } + } /** - * UIKIT Component Classes - **/ + * UIKIT Component Classes + **/ public static $uk_components = array( 'data-uk-grid' => array( 'grid' ), @@ -1905,15 +1983,15 @@ abstract class QuestionsanswersHelper 'upload-drop' => array( 'upload', 'form-file' ) ); - + /** - * Add UIKIT Components - **/ + * Add UIKIT Components + **/ public static $uikit = false; /** - * Get UIKIT Components - **/ + * Get UIKIT Components + **/ public static function getUikitComp($content,$classes = array()) { if (strpos($content,'class="uk-') !== false) @@ -1943,13 +2021,13 @@ abstract class QuestionsanswersHelper } return $temp; } - } + } if (self::checkArray($classes)) { return $classes; } return false; - } + } /** * Prepares the xml document @@ -1979,19 +2057,19 @@ abstract class QuestionsanswersHelper { $subjectTab = 'Sheet1'; } - - // make sure the file is loaded + + // make sure the file is loaded JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers'); - + // Create new PHPExcel object $objPHPExcel = new PHPExcel(); - + // Set document properties $objPHPExcel->getProperties()->setCreator($creator) - ->setCompany('Vast Development Method') - ->setLastModifiedBy($modified) - ->setTitle($title) - ->setSubject($subjectTab); + ->setCompany('Vast Development Method') + ->setLastModifiedBy($modified) + ->setTitle($title) + ->setSubject($subjectTab); if (!$description) { $objPHPExcel->getProperties()->setDescription($description); @@ -2004,7 +2082,7 @@ abstract class QuestionsanswersHelper { $objPHPExcel->getProperties()->setCategory($category); } - + // Some styles $headerStyles = array( 'font' => array( @@ -2026,7 +2104,7 @@ abstract class QuestionsanswersHelper 'size' => 11, 'name' => 'Verdana' )); - + // Add some data if (self::checkArray($rows)) { @@ -2053,43 +2131,43 @@ abstract class QuestionsanswersHelper { return false; } - + // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle($subjectTab); - + // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); - + // Redirect output to a client's web browser (Excel5) header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="'.$fileName.'.xls"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); - + // If you're serving to IE over SSL, then the following may be needed header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Pragma: public'); // HTTP/1.0 - + $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); jexit(); } - + /** - * Get CSV Headers - */ + * Get CSV Headers + */ public static function getFileHeaders($dataType) - { - // make sure these files are loaded + { + // make sure these files are loaded JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers'); JLoader::import('ChunkReadFilter', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/PHPExcel/Reader'); // get session object - $session = JFactory::getSession(); - $package = $session->get('package', null); - $package = json_decode($package, true); + $session = JFactory::getSession(); + $package = $session->get('package', null); + $package = json_decode($package, true); // set the headers if(isset($package['dir'])) { @@ -2267,16 +2345,16 @@ abstract class QuestionsanswersHelper { if ($external) { - if ($name = self::getVar(null, $val, $id, $name, '=', $table)) + if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) { - $names[] = $name; + $names[] = $_name; } } else { - if ($name = self::getVar($table, $val, $id, $name)) + if ($_name = self::getVar($table, $val, $id, $name)) { - $names[] = $name; + $names[] = $_name; } } } @@ -2332,183 +2410,149 @@ abstract class QuestionsanswersHelper } /** - * Get the actions permissions + * Get the action permissions + * + * @param string $view The related view name + * @param int $record The item to act upon + * @param string $views The related list view name + * @param mixed $target Only get this permission (like edit, create, delete) + * @param string $component The target component + * + * @return object The JObject of permission/authorised actions + * **/ - public static function getActions($view,&$record = null,$views = null) + public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'questionsanswers') { - jimport('joomla.access.access'); - - $user = JFactory::getUser(); - $result = new JObject; - $view = self::safeString($view); + // get the user object + $user = JFactory::getUser(); + // load the JObject + $result = new JObject; + // make view name safe (just incase) + $view = self::safeString($view); if (self::checkString($views)) { $views = self::safeString($views); } // get all actions from component - $actions = JAccess::getActions('com_questionsanswers', 'component'); - // set acctions only set in component settiongs - $componentActions = array('core.admin','core.manage','core.options','core.export'); + $actions = JAccess::getActionsFromFile( + JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', + "/access/section[@name='component']/" + ); + // if non found then return empty JObject + if (empty($actions)) + { + return $result; + } + // get created by if not found + if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + { + $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + } + // set actions only set in component settings + $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); + // check if we have a target + $checkTarget = false; + if ($target) + { + // convert to an array + if (self::checkString($target)) + { + $target = array($target); + } + // check if we are good to go + if (self::checkArray($target)) + { + $checkTarget = true; + } + } // loop the actions and set the permissions foreach ($actions as $action) { - // set to use component default - $fallback= true; - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name,$componentActions)) + // check target action filter + if ($checkTarget && self::filterActions($view, $action->name, $target)) { + continue; + } + // set to use component default + $fallback = true; + // reset permission per/action + $permission = false; + $catpermission = false; + // set area + $area = 'comp'; + // check if the record has an ID and the action is item related (not a component action) + if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) + { + // we are in item + $area = 'item'; // The record has been set. Check the record permissions. - $permission = $user->authorise($action->name, 'com_questionsanswers.'.$view.'.' . (int) $record->id); - if (!$permission) // TODO removed && !is_null($permission) + $permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id); + // if no permission found, check edit own + if (!$permission) { - if ($action->name == 'core.edit' || $action->name == $view.'.edit') + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) { - if ($user->authorise('core.edit.own', 'com_questionsanswers.'.$view.'.' . (int) $record->id)) + // the correct target + $coreCheck = (array) explode('.', $action->name); + // check that we have both local and global access + if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) && + $user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component)) { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; } - elseif ($user->authorise($view.'edit.own', 'com_questionsanswers.'.$view.'.' . (int) $record->id)) + else { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } - } - elseif ($user->authorise('core.edit.own', 'com_questionsanswers')) - { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } - } - elseif ($user->authorise($view.'edit.own', 'com_questionsanswers')) - { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } + // do not allow edit + $result->set($action->name, false); + $fallback = false; } } } elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) { + // we are in item + $area = 'category'; + // set the core check + $coreCheck = explode('.', $action->name); + $core = $coreCheck[0]; // make sure we use the core. action check for the categories - if (strpos($action->name,$view) !== false && strpos($action->name,'core.') === false ) { - $coreCheck = explode('.',$action->name); - $coreCheck[0] = 'core'; - $categoryCheck = implode('.',$coreCheck); + if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false ) + { + $coreCheck[0] = 'core'; + $categoryCheck = implode('.', $coreCheck); } else { $categoryCheck = $action->name; } // The record has a category. Check the category permissions. - $catpermission = $user->authorise($categoryCheck, 'com_questionsanswers.'.$views.'.category.' . (int) $record->catid); + $catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid); if (!$catpermission && !is_null($catpermission)) { - if ($action->name == 'core.edit' || $action->name == $view.'.edit') + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) { - if ($user->authorise('core.edit.own', 'com_questionsanswers.'.$views.'.category.' . (int) $record->catid)) + // check that we have both local and global access + if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) && + $user->authorise($core . '.edit.own', 'com_' . $component)) { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; } - elseif ($user->authorise($view.'edit.own', 'com_questionsanswers.'.$views.'.category.' . (int) $record->catid)) + else { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } - } - elseif ($user->authorise('core.edit.own', 'com_questionsanswers')) - { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } - } - elseif ($user->authorise($view.'edit.own', 'com_questionsanswers')) - { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } + // do not allow edit + $result->set($action->name, false); + $fallback = false; } } } @@ -2517,14 +2561,49 @@ abstract class QuestionsanswersHelper // if allowed then fallback on component global settings if ($fallback) { - $result->set($action->name, $user->authorise($action->name, 'com_questionsanswers')); + // if item/category blocks access then don't fall back on global + if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission)) + { + // do not allow + $result->set($action->name, false); + } + // Finally remember the global settings have the final say. (even if item allow) + // The local item permissions can block, but it can't open and override of global permissions. + // Since items are created by users and global permissions is set by system admin. + else + { + $result->set($action->name, $user->authorise($action->name, 'com_' . $component)); + } } } return $result; } /** - * Get any component's model + * Filter the action permissions + * + * @param string $action The action to check + * @param array $targets The array of target actions + * + * @return boolean true if action should be filtered out + * + **/ + protected static function filterActions(&$view, &$action, &$targets) + { + foreach ($targets as $target) + { + if (strpos($action, $view . '.' . $target) !== false || + strpos($action, 'core.' . $target) !== false) + { + return false; + break; + } + } + return true; + } + + /** + * Get any component's model **/ public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $component = 'Questionsanswers', $config = array()) { @@ -2568,9 +2647,9 @@ abstract class QuestionsanswersHelper } /** - * Add to asset Table + * Add to asset Table */ - public static function setAsset($id,$table) + public static function setAsset($id, $table, $inherit = true) { $parent = JTable::getInstance('Asset'); $parent->loadByName('com_questionsanswers'); @@ -2602,7 +2681,7 @@ abstract class QuestionsanswersHelper $asset->name = $name; $asset->title = $title; // get the default asset rules - $rules = self::getDefaultAssetRules('com_questionsanswers',$table); + $rules = self::getDefaultAssetRules('com_questionsanswers', $table, $inherit); if ($rules instanceof JAccessRules) { $asset->rules = (string) $rules; @@ -2630,55 +2709,62 @@ abstract class QuestionsanswersHelper } /** - * Gets the default asset Rules for a component/view. + * Gets the default asset Rules for a component/view. */ - protected static function getDefaultAssetRules($component,$view) + protected static function getDefaultAssetRules($component, $view, $inherit = true) { - // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select($db->quoteName('id')) - ->from($db->quoteName('#__assets')) - ->where($db->quoteName('name') . ' = ' . $db->quote($component)); - $db->setQuery($query); - $db->execute(); - if ($db->loadRowList()) + // if new or inherited + $assetId = 0; + // Only get the actual item rules if not inheriting + if (!$inherit) { - // asset alread set so use saved rules - $assetId = (int) $db->loadResult(); - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + // check that there is a value + if ($db->getNumRows()) { - $_result = (string) $result; - $_result = json_decode($_result); - foreach ($_result as $name => &$rule) - { - $v = explode('.', $name); - if ($view !== $v[0]) - { - // remove since it is not part of this view - unset($_result->$name); - } - else - { - // clear the value since we inherit - $rule = array(); - } - } - // check if there are any view values remaining - if (count($_result)) - { - $_result = json_encode($_result); - $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); - - return $rules; - } - return $result; + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); } } - return JAccess::getAssetRules(0); + // get asset rules + $result = JAccess::getAssetRules($assetId); + if ($result instanceof JAccessRules) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($view !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + elseif ($inherit) + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count($_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules($_result); + // return filtered rules + return $rules; + } + } + return $result; } /** @@ -2772,6 +2858,46 @@ abstract class QuestionsanswersHelper } } + /** + * get the field object + * + * @param array $attributes The array of attributes + * @param string $default The default of the field + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldObject(&$attributes, $default = '', $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes) && isset($attributes['type'])) + { + // make sure the form helper class is loaded + if (!method_exists('JFormHelper', 'loadFieldType')) + { + jimport('joomla.form.form'); + } + // get field type + $field = JFormHelper::loadFieldType($attributes['type'],true); + // start field xml + $XML = new SimpleXMLElement(''); + // load the attributes + self::xmlAddAttributes($XML, $attributes); + // check if we have options + if (self::checkArray($options)) + { + // load the options + self::xmlAddOptions($XML, $options); + } + // setup the field + $field->setup($XML, $default); + // return the field object + return $field; + } + return false; + } + /** * Render Bool Button * @@ -2790,8 +2916,6 @@ abstract class QuestionsanswersHelper $args = func_get_args(); // check if there is additional button class $additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time - // start the xml - $buttonXML = new SimpleXMLElement(''); // button attributes $buttonAttributes = array( 'type' => 'radio', @@ -2800,30 +2924,20 @@ abstract class QuestionsanswersHelper 'class' => 'btn-group', 'filter' => 'INT', 'default' => isset($args[2]) ? (int) $args[2] : 0); - // load the haskey attributes - self::xmlAddAttributes($buttonXML, $buttonAttributes); // set the button options $buttonOptions = array( '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); - // load the button options - self::xmlAddOptions($buttonXML, $buttonOptions); - - // get the radio element - $button = JFormHelper::loadFieldType('radio'); - - // run - $button->setup($buttonXML, $buttonAttributes['default']); - - return $button->input; + // return the input + return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; } /** - * Check if have an json string + * Check if have an json string * - * @input string The json string to check + * @input string The json string to check * - * @returns bool true on success + * @returns bool true on success **/ public static function checkJson($string) { @@ -2836,11 +2950,11 @@ abstract class QuestionsanswersHelper } /** - * Check if have an object with a length + * Check if have an object with a length * - * @input object The object to check + * @input object The object to check * - * @returns bool true on success + * @returns bool true on success **/ public static function checkObject($object) { @@ -2852,15 +2966,15 @@ abstract class QuestionsanswersHelper } /** - * Check if have an array with a length + * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * - * @returns bool true on success + * @returns bool/int number of items in array on success **/ public static function checkArray($array, $removeEmptyString = false) { - if (isset($array) && is_array($array) && count($array) > 0) + if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) { // also make sure the empty strings are removed if ($removeEmptyString) @@ -2874,17 +2988,17 @@ abstract class QuestionsanswersHelper } return self::checkArray($array, false); } - return true; + return $nr; } return false; } /** - * Check if have a string with a length + * Check if have a string with a length * - * @input string The string to check + * @input string The string to check * - * @returns bool true on success + * @returns bool true on success **/ public static function checkString($string) { @@ -2896,10 +3010,10 @@ abstract class QuestionsanswersHelper } /** - * Check if we are connected - * Thanks https://stackoverflow.com/a/4860432/1429677 + * Check if we are connected + * Thanks https://stackoverflow.com/a/4860432/1429677 * - * @returns bool true on success + * @returns bool true on success **/ public static function isConnected() { @@ -2921,11 +3035,11 @@ abstract class QuestionsanswersHelper } /** - * Merge an array of array's + * Merge an array of array's * - * @input array The arrays you would like to merge + * @input array The arrays you would like to merge * - * @returns array on success + * @returns array on success **/ public static function mergeArrays($arrays) { @@ -2951,11 +3065,11 @@ abstract class QuestionsanswersHelper } /** - * Shorten a string + * Shorten a string * - * @input string The you would like to shorten + * @input string The you would like to shorten * - * @returns string on success + * @returns string on success **/ public static function shorten($string, $length = 40, $addTip = true) { @@ -2963,7 +3077,7 @@ abstract class QuestionsanswersHelper { $initial = strlen($string); $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); - $words_count = count($words); + $words_count = count((array)$words); $word_length = 0; $last_word = 0; @@ -2992,13 +3106,13 @@ abstract class QuestionsanswersHelper } /** - * Making strings safe (various ways) + * Making strings safe (various ways) * - * @input string The you would like to make safe + * @input string The you would like to make safe * - * @returns string on success + * @returns string on success **/ - public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true) + public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) { if ($replaceNumbers === true) { @@ -3027,7 +3141,16 @@ abstract class QuestionsanswersHelper $string = trim($string); $string = preg_replace('/'.$spacer.'+/', ' ', $string); $string = preg_replace('/\s+/', ' ', $string); - $string = preg_replace("/[^A-Za-z ]/", '', $string); + // remove all and keep only characters + if ($keepOnlyCharacters) + { + $string = preg_replace("/[^A-Za-z ]/", '', $string); + } + // keep both numbers and characters + else + { + $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); + } // select final adaptations if ($type === 'L' || $type === 'strtolower') { @@ -3127,11 +3250,11 @@ abstract class QuestionsanswersHelper } /** - * Convert an integer into an English word string - * Thanks to Tom Nicholson + * Convert an integer into an English word string + * Thanks to Tom Nicholson * - * @input an int - * @returns a string + * @input an int + * @returns a string **/ public static function numberToString($x) { @@ -3218,9 +3341,9 @@ abstract class QuestionsanswersHelper } /** - * Random Key + * Random Key * - * @returns a string + * @returns a string **/ public static function randomkey($size) { diff --git a/admin/language/en-GB/en-GB.com_questionsanswers.ini b/admin/language/en-GB/en-GB.com_questionsanswers.ini index 6d1a97f..b6afbba 100644 --- a/admin/language/en-GB/en-GB.com_questionsanswers.ini +++ b/admin/language/en-GB/en-GB.com_questionsanswers.ini @@ -113,7 +113,7 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group t COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE="Help Documents Create" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List" -COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the help document" +COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of help document" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE="Help Documents Delete" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE_DESC="Allows the users in this group to delete delete help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_EDIT="Help Documents Edit" @@ -146,7 +146,7 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_UNFEATURED_1="%s Help Document unfea COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED="%s Help Documents unpublished." COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED_1="%s Help Document unpublished." COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU="Help Documents Submenu" -COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the help document" +COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to submenu of help document" COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN="Admin" COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW="Admin View" COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION="Select the view being target." @@ -271,29 +271,29 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_BATCH_USE_DESC="Allows users in this COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE="Questions And Answers Create" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE_DESC="Allows the users in this group to create create questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD="Questions And Answers Dashboard Add" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST="Questions And Answers Dashboard List" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE="Questions And Answers Delete" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE_DESC="Allows the users in this group to delete delete questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT="Questions And Answers Edit" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER="Questions And Answers Edit Answer" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DESC="Allows the users in this group to update the edit answer of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DESC="Allows the users in this group to edit answer of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS="Questions And Answers Edit Answer Documents" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS_DESC="Allows the users in this group to update the edit answer documents of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS_DESC="Allows the users in this group to edit answer documents of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID="Questions And Answers Edit Catid" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID_DESC="Allows the users in this group to update the edit catid of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID_DESC="Allows the users in this group to edit catid of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY="Questions And Answers Edit Created By" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE="Questions And Answers Edit Created Date" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_DESC="Allows the users in this group to edit the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER="Questions And Answers Edit Main Image Uploader" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER_DESC="Allows the users in this group to update the edit main image uploader of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER_DESC="Allows the users in this group to edit main image uploader of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN="Questions And Answers Edit Own" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own questions and answers created by them" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION="Questions And Answers Edit Question" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION_DESC="Allows the users in this group to update the edit question of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION_DESC="Allows the users in this group to edit question of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE="Questions And Answers Edit State" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_VERSION="Questions And Answers Edit Version" @@ -320,11 +320,33 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_UNFEATURED_1="%s Question and COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_UNPUBLISHED="%s Questions and Answers unpublished." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_UNPUBLISHED_1="%s Question and Answer unpublished." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU="Questions And Answers Submenu" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU_DESC="Allows the users in this group to update the submenu of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU_DESC="Allows the users in this group to submenu of question and answer" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER="Question and Answer" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER="Answer" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS="Answer Documents" -COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS_UPLOADER_DESCRIPTION="


Upload Your answer documents by dropping the file here or selecting the file from your computer (formates allowed: )


...
" +COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS_UPLOADER_DESCRIPTION=" + + +
" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS_UPLOADER_LABEL="Answer Documents" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_LABEL="Answer" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_CATID_DESCRIPTION="select one of the following categories" @@ -338,7 +360,29 @@ COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_EDIT="Editing the Question and Answer" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ERROR_UNIQUE_ALIAS="Another Question and Answer has the same alias." COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ID="Id" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE="Main Image" -COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE_UPLOADER_DESCRIPTION="


Upload Your image by dropping the file here or selecting the file from your computer (formates allowed: )


...
" +COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE_UPLOADER_DESCRIPTION=" + + +
" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE_UPLOADER_LABEL="Image" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MODIFIED_BY_DESC="The last user that modified this Question and Answer." COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MODIFIED_BY_LABEL="Modified By" diff --git a/admin/language/en-GB/en-GB.com_questionsanswers.sys.ini b/admin/language/en-GB/en-GB.com_questionsanswers.sys.ini index 135588e..4b05e8d 100644 --- a/admin/language/en-GB/en-GB.com_questionsanswers.sys.ini +++ b/admin/language/en-GB/en-GB.com_questionsanswers.sys.ini @@ -15,7 +15,7 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group t COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE="Help Documents Create" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List" -COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the help document" +COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of help document" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE="Help Documents Delete" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE_DESC="Allows the users in this group to delete delete help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_EDIT="Help Documents Edit" @@ -31,7 +31,7 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENTS_EXPORT_DESC="Allows the users in this group COM_QUESTIONSANSWERS_HELP_DOCUMENTS_IMPORT="Help Documents Import" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_IMPORT_DESC="Allows the users in this group to import import help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU="Help Documents Submenu" -COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the help document" +COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to submenu of help document" COM_QUESTIONSANSWERS_IMPORT_DATA="Import Data" COM_QUESTIONSANSWERS_IMPORT_DATA_DESC=" Allows users in this group to import data." COM_QUESTIONSANSWERS_MENU="Questions and Answers" @@ -52,29 +52,29 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_BATCH_USE_DESC="Allows users in this COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE="Questions And Answers Create" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE_DESC="Allows the users in this group to create create questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD="Questions And Answers Dashboard Add" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST="Questions And Answers Dashboard List" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE="Questions And Answers Delete" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE_DESC="Allows the users in this group to delete delete questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT="Questions And Answers Edit" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER="Questions And Answers Edit Answer" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DESC="Allows the users in this group to update the edit answer of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DESC="Allows the users in this group to edit answer of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS="Questions And Answers Edit Answer Documents" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS_DESC="Allows the users in this group to update the edit answer documents of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS_DESC="Allows the users in this group to edit answer documents of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID="Questions And Answers Edit Catid" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID_DESC="Allows the users in this group to update the edit catid of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID_DESC="Allows the users in this group to edit catid of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY="Questions And Answers Edit Created By" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE="Questions And Answers Edit Created Date" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_DESC="Allows the users in this group to edit the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER="Questions And Answers Edit Main Image Uploader" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER_DESC="Allows the users in this group to update the edit main image uploader of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER_DESC="Allows the users in this group to edit main image uploader of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN="Questions And Answers Edit Own" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own questions and answers created by them" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION="Questions And Answers Edit Question" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION_DESC="Allows the users in this group to update the edit question of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION_DESC="Allows the users in this group to edit question of question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE="Questions And Answers Edit State" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_VERSION="Questions And Answers Edit Version" @@ -84,6 +84,6 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EXPORT_DESC="Allows the users in this COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_IMPORT="Questions And Answers Import" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_IMPORT_DESC="Allows the users in this group to import import questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU="Questions And Answers Submenu" -COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU_DESC="Allows the users in this group to update the submenu of the question and answer" +COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU_DESC="Allows the users in this group to submenu of question and answer" COM_QUESTIONSANSWERS_USE_BATCH="Use Batch" COM_QUESTIONSANSWERS_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method." \ No newline at end of file diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 5492a00..6f1eddb 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -6,29 +6,29 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage batchselection.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('JPATH_BASE') or die; JHtmlBehavior::core(); -$divWrapper = range(1,120,2); -$counter = 0; +$divWrapper = range(1,120,2); +$counter = 0; ?> ListSelection) : ?>
diff --git a/admin/layouts/help_document/details_above.php b/admin/layouts/help_document/details_above.php index 7dd82b0..2d0eeb1 100644 --- a/admin/layouts/help_document/details_above.php +++ b/admin/layouts/help_document/details_above.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage details_above.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/help_document/details_fullwidth.php b/admin/layouts/help_document/details_fullwidth.php index 31149b1..bf3e575 100644 --- a/admin/layouts/help_document/details_fullwidth.php +++ b/admin/layouts/help_document/details_fullwidth.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage details_fullwidth.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/help_document/details_left.php b/admin/layouts/help_document/details_left.php index d86270c..1c040bf 100644 --- a/admin/layouts/help_document/details_left.php +++ b/admin/layouts/help_document/details_left.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage details_left.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/help_document/details_right.php b/admin/layouts/help_document/details_right.php index 45fdb45..d516860 100644 --- a/admin/layouts/help_document/details_right.php +++ b/admin/layouts/help_document/details_right.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage details_right.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/help_document/details_under.php b/admin/layouts/help_document/details_under.php index fb6a0dc..e04d520 100644 --- a/admin/layouts/help_document/details_under.php +++ b/admin/layouts/help_document/details_under.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage details_under.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/help_document/publishing.php b/admin/layouts/help_document/publishing.php index 4135ae0..c229060 100644 --- a/admin/layouts/help_document/publishing.php +++ b/admin/layouts/help_document/publishing.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage publishing.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $app = JFactory::getApplication(); diff --git a/admin/layouts/help_document/publlshing.php b/admin/layouts/help_document/publlshing.php index 7e7109a..7b2c7c2 100644 --- a/admin/layouts/help_document/publlshing.php +++ b/admin/layouts/help_document/publlshing.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage publlshing.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $app = JFactory::getApplication(); diff --git a/admin/layouts/question_and_answer/details_fullwidth.php b/admin/layouts/question_and_answer/details_fullwidth.php index 138446b..14a973c 100644 --- a/admin/layouts/question_and_answer/details_fullwidth.php +++ b/admin/layouts/question_and_answer/details_fullwidth.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage details_fullwidth.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/question_and_answer/details_rightside.php b/admin/layouts/question_and_answer/details_rightside.php index b57a062..a7ba948 100644 --- a/admin/layouts/question_and_answer/details_rightside.php +++ b/admin/layouts/question_and_answer/details_rightside.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage details_rightside.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/question_and_answer/details_under.php b/admin/layouts/question_and_answer/details_under.php index 614eed6..efa74ba 100644 --- a/admin/layouts/question_and_answer/details_under.php +++ b/admin/layouts/question_and_answer/details_under.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage details_under.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/question_and_answer/metadata.php b/admin/layouts/question_and_answer/metadata.php index 34d0c0a..ba29c78 100644 --- a/admin/layouts/question_and_answer/metadata.php +++ b/admin/layouts/question_and_answer/metadata.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage metadata.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/question_and_answer/publishing.php b/admin/layouts/question_and_answer/publishing.php index 8e915b6..994d125 100644 --- a/admin/layouts/question_and_answer/publishing.php +++ b/admin/layouts/question_and_answer/publishing.php @@ -6,25 +6,24 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage publishing.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $app = JFactory::getApplication(); diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 38223a4..b9a3759 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -6,28 +6,26 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage ajax.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -jimport('joomla.application.component.helper'); - /** * Questionsanswers Ajax Model */ @@ -56,6 +54,7 @@ class QuestionsanswersModelAjax extends JModelList $vdm = $jinput->get('vdm', null, 'WORD'); if ($vdm) { + // set view and id if ($view = QuestionsanswersHelper::get($vdm)) { $current = (array) explode('__', $view); @@ -68,6 +67,14 @@ class QuestionsanswersModelAjax extends JModelList ); } } + // set return if found + if ($return = QuestionsanswersHelper::get($vdm . '__return')) + { + if (QuestionsanswersHelper::checkString($return)) + { + $this->viewid[$call]['a_return'] = $return; + } + } } } if (isset($this->viewid[$call])) diff --git a/admin/models/fields/adminviewfolderlist.php b/admin/models/fields/adminviewfolderlist.php index 01aa83c..052f28d 100644 --- a/admin/models/fields/adminviewfolderlist.php +++ b/admin/models/fields/adminviewfolderlist.php @@ -6,21 +6,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage adminviewfolderlist.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file @@ -45,9 +45,9 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of JHtml options. */ - public function getOptions() + protected function getOptions() { // get custom folder files $localfolder = JPATH_COMPONENT_ADMINISTRATOR.'/views'; diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php index b870a64..5e99fae 100644 --- a/admin/models/fields/articles.php +++ b/admin/models/fields/articles.php @@ -6,21 +6,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage articles.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file @@ -45,9 +45,9 @@ class JFormFieldArticles extends JFormFieldList /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of JHtml options. */ - public function getOptions() + protected function getOptions() { $db = JFactory::getDBO(); $query = $db->getQuery(true); diff --git a/admin/models/fields/siteviewfolderlist.php b/admin/models/fields/siteviewfolderlist.php index 5bf561b..cf5d46d 100644 --- a/admin/models/fields/siteviewfolderlist.php +++ b/admin/models/fields/siteviewfolderlist.php @@ -6,21 +6,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage siteviewfolderlist.php - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file @@ -45,9 +45,9 @@ class JFormFieldSiteviewfolderlist extends JFormFieldList /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of JHtml options. */ - public function getOptions() + protected function getOptions() { // get custom folder files $localfolder = JPATH_COMPONENT_SITE.'/views'; diff --git a/admin/models/forms/help_document.js b/admin/models/forms/help_document.js index 28a924c..4ee28f1 100644 --- a/admin/models/forms/help_document.js +++ b/admin/models/forms/help_document.js @@ -5,21 +5,21 @@ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| - | | - |_| + | | + |_| /-------------------------------------------------------------------------------------------------------------------------------/ @version 1.0.x - @build 5th May, 2018 + @build 27th December, 2018 @created 30th January, 2017 @package Questions and Answers @subpackage help_document.js - @author Llewellyn van der Merwe + @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Questions & Answers - + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Questions & Answers + /-----------------------------------------------------------------------------------------------------------------------------*/ // Some Global Values @@ -59,6 +59,7 @@ function vvvvvvv(location_vvvvvvv) if (location_vvvvvvv == 1) { jQuery('#jform_admin_view').closest('.control-group').show(); + // add required attribute to admin_view field if (jform_vvvvvvvvvv_required) { updateFieldRequired('admin_view',0); @@ -67,11 +68,11 @@ function vvvvvvv(location_vvvvvvv) jQuery('#jform_admin_view').addClass('required'); jform_vvvvvvvvvv_required = false; } - } else { jQuery('#jform_admin_view').closest('.control-group').hide(); + // remove required attribute from admin_view field if (!jform_vvvvvvvvvv_required) { updateFieldRequired('admin_view',1); @@ -90,6 +91,7 @@ function vvvvvvw(location_vvvvvvw) if (location_vvvvvvw == 2) { jQuery('#jform_site_view').closest('.control-group').show(); + // add required attribute to site_view field if (jform_vvvvvvwvvw_required) { updateFieldRequired('site_view',0); @@ -98,11 +100,11 @@ function vvvvvvw(location_vvvvvvw) jQuery('#jform_site_view').addClass('required'); jform_vvvvvvwvvw_required = false; } - } else { jQuery('#jform_site_view').closest('.control-group').hide(); + // remove required attribute from site_view field if (!jform_vvvvvvwvvw_required) { updateFieldRequired('site_view',1); @@ -134,6 +136,7 @@ function vvvvvvx(type_vvvvvvx) if (type) { jQuery('#jform_url').closest('.control-group').show(); + // add required attribute to url field if (jform_vvvvvvxvvx_required) { updateFieldRequired('url',0); @@ -142,11 +145,11 @@ function vvvvvvx(type_vvvvvvx) jQuery('#jform_url').addClass('required'); jform_vvvvvvxvvx_required = false; } - } else { jQuery('#jform_url').closest('.control-group').hide(); + // remove required attribute from url field if (!jform_vvvvvvxvvx_required) { updateFieldRequired('url',1); @@ -189,6 +192,7 @@ function vvvvvvy(type_vvvvvvy) if (type) { jQuery('#jform_article').closest('.control-group').show(); + // add required attribute to article field if (jform_vvvvvvyvvy_required) { updateFieldRequired('article',0); @@ -197,11 +201,11 @@ function vvvvvvy(type_vvvvvvy) jQuery('#jform_article').addClass('required'); jform_vvvvvvyvvy_required = false; } - } else { jQuery('#jform_article').closest('.control-group').hide(); + // remove required attribute from article field if (!jform_vvvvvvyvvy_required) { updateFieldRequired('article',1); @@ -244,6 +248,7 @@ function vvvvvvz(type_vvvvvvz) if (type) { jQuery('#jform_content-lbl').closest('.control-group').show(); + // add required attribute to content field if (jform_vvvvvvzvvz_required) { updateFieldRequired('content',0); @@ -252,11 +257,11 @@ function vvvvvvz(type_vvvvvvz) jQuery('#jform_content').addClass('required'); jform_vvvvvvzvvz_required = false; } - } else { jQuery('#jform_content-lbl').closest('.control-group').hide(); + // remove required attribute from content field if (!jform_vvvvvvzvvz_required) { updateFieldRequired('content',1); @@ -286,6 +291,7 @@ function vvvvvwa(target_vvvvvwa) if (target_vvvvvwa == 1) { jQuery('#jform_groups').closest('.control-group').show(); + // add required attribute to groups field if (jform_vvvvvwavwa_required) { updateFieldRequired('groups',0); @@ -294,11 +300,11 @@ function vvvvvwa(target_vvvvvwa) jQuery('#jform_groups').addClass('required'); jform_vvvvvwavwa_required = false; } - } else { jQuery('#jform_groups').closest('.control-group').hide(); + // remove required attribute from groups field if (!jform_vvvvvwavwa_required) { updateFieldRequired('groups',1); diff --git a/admin/models/forms/help_document.xml b/admin/models/forms/help_document.xml index 0867a01..ed4f813 100644 --- a/admin/models/forms/help_document.xml +++ b/admin/models/forms/help_document.xml @@ -101,7 +101,8 @@ description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TYPE_DESCRIPTION" class="list_class" multiple="false" - required="true"> + required="true" + default=""> @@ -128,6 +129,7 @@ label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_LABEL" description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_DESCRIPTION" class="btn-group" + default="" required="true">