update to version 1.0.2

This commit is contained in:
Llewellyn van der Merwe 2018-12-27 13:06:27 +02:00
parent e683b47eb8
commit aa78275365
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
134 changed files with 3200 additions and 2440 deletions

View File

@ -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**

View File

@ -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**

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage admin.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage dashboard.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help_document.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help_documents.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage admin.js

View File

@ -141,7 +141,8 @@
description="COM_QUESTIONSANSWERS_CONFIG_DOCUMENT_FORMATS_DESCRIPTION"
class="list_class"
multiple="true"
filter="ARRAY">
filter="ARRAY"
default="">
<!-- Option Set. -->
<option value="doc">
COM_QUESTIONSANSWERS_CONFIG_DOC</option>
@ -180,7 +181,8 @@
description="COM_QUESTIONSANSWERS_CONFIG_IMAGE_FORMATS_DESCRIPTION"
class="list_class"
multiple="true"
filter="ARRAY">
filter="ARRAY"
default="">
<!-- Option Set. -->
<option value="jpg">
COM_QUESTIONSANSWERS_CONFIG_JPG</option>

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage controller.php
@ -26,9 +26,6 @@
// 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
*/

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage ajax.json.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/**
* Questionsanswers Ajax Controller
*/

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage download.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/**
* Questionsanswers Help Controller
*/

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help_document.php
@ -26,9 +26,6 @@
// 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);
}
/**
@ -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');
// Setup redirect info.
// get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
$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,17 +205,29 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
*/
public function cancel($key = null)
{
// get the referal details
// 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 = 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 = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
@ -245,16 +247,6 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
)
);
}
}
else
{
// Redirect to the items screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
)
);
}
return $cancel;
}
@ -270,11 +262,15 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
*/
public function save($key = null, $urlVar = null)
{
// get the referal details
// 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(

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help_documents.php
@ -26,24 +26,33 @@
// 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())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
protected $text_prefix = 'COM_QUESTIONSANSWERS_HELP_DOCUMENTS';
return $model;
/**
* 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))
{
return parent::getModel($name, $prefix, $config);
}
public function exportData()

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage import.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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
@ -26,9 +26,6 @@
// 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);
}
/**
@ -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');
// Setup redirect info.
// get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
$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,17 +204,29 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/
public function cancel($key = null)
{
// get the referal details
// 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 = 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 = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
@ -244,16 +246,6 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
)
);
}
}
else
{
// Redirect to the items screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
)
);
}
return $cancel;
}
@ -269,11 +261,15 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/
public function save($key = null, $urlVar = null)
{
// get the referal details
// 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(

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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
@ -26,24 +26,33 @@
// 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())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
protected $text_prefix = 'COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS';
return $model;
/**
* 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))
{
return parent::getModel($name, $prefix, $config);
}
public function exportData()

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage questionsanswers.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/**
* Questionsanswers Controller
*/

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage headercheck.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage batch_.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage questionsanswers.php
@ -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]))
{
@ -268,8 +276,13 @@ abstract class QuestionsanswersHelper
* @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)
{
// make sure data is a string & placeholders is an array
if (self::checkString($data) && self::checkArray($placeholders))
{
// store in memory in case it is build multiple times
$keyMD5 = md5($data.json_encode($placeholders));
if (!isset(self::$dynamicData[$keyMD5]))
{
if (self::checkArray($placeholders))
{
// 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 $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
@ -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');
// 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)
{
// check target action filter
if ($checkTarget && self::filterActions($view, $action->name, $target))
{
continue;
}
// set to use component default
$fallback= true;
if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name,$componentActions))
$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))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->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))
{
// allow edit
$result->set($action->name, true);
// set not to use component default
$fallback= false;
// set not to use global default
// because we already validated it
$fallback = false;
}
else
{
// do not allow edit
$result->set($action->name, false);
// set not to use component default
$fallback= false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_questionsanswers.'.$view.'.' . (int) $record->id))
{
// 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;
}
$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);
if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false )
{
$coreCheck[0] = 'core';
$categoryCheck = implode('.',$coreCheck);
$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))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
// 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))
{
// allow edit
$result->set($action->name, true);
// set not to use component default
$fallback= false;
// set not to use global default
// because we already validated it
$fallback = false;
}
else
{
// do not allow edit
$result->set($action->name, false);
// set not to use component default
$fallback= false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_questionsanswers.'.$views.'.category.' . (int) $record->catid))
{
// 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;
}
$fallback = false;
}
}
}
@ -2517,12 +2561,47 @@ 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;
}
/**
* 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
**/
@ -2570,7 +2649,7 @@ abstract class QuestionsanswersHelper
/**
* 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;
@ -2632,7 +2711,12 @@ abstract class QuestionsanswersHelper
/**
* Gets the default asset Rules for a component/view.
*/
protected static function getDefaultAssetRules($component,$view)
protected static function getDefaultAssetRules($component, $view, $inherit = true)
{
// if new or inherited
$assetId = 0;
// Only get the actual item rules if not inheriting
if (!$inherit)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
@ -2642,10 +2726,14 @@ abstract class QuestionsanswersHelper
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);
$db->execute();
if ($db->loadRowList())
// check that there is a value
if ($db->getNumRows())
{
// asset alread set so use saved rules
// asset already set so use saved rules
$assetId = (int) $db->loadResult();
}
}
// get asset rules
$result = JAccess::getAssetRules($assetId);
if ($result instanceof JAccessRules)
{
@ -2659,7 +2747,7 @@ abstract class QuestionsanswersHelper
// remove since it is not part of this view
unset($_result->$name);
}
else
elseif ($inherit)
{
// clear the value since we inherit
$rule = array();
@ -2672,14 +2760,12 @@ abstract class QuestionsanswersHelper
$_result = array($_result);
// Instantiate and return the JAccessRules object for the asset rules.
$rules = new JAccessRules($_result);
// return filtered rules
return $rules;
}
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
/**
* xmlAppend
@ -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('<field/>');
// 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('<field/>');
// button attributes
$buttonAttributes = array(
'type' => 'radio',
@ -2800,22 +2924,12 @@ 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;
}
/**
@ -2856,11 +2970,11 @@ abstract class QuestionsanswersHelper
*
* @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,7 +2988,7 @@ abstract class QuestionsanswersHelper
}
return self::checkArray($array, false);
}
return true;
return $nr;
}
return false;
}
@ -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;
@ -2998,7 +3112,7 @@ abstract class QuestionsanswersHelper
*
* @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);
// 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')
{

View File

@ -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="<div id='upload-drop-answer-documents' class='uk-placeholder'><br /><br /><i class='uk-icon-cloud-upload uk-icon-medium uk-text-muted uk-margin-small-right'></i> Upload Your <strong>answer documents</span></strong> by dropping the file here or <a class='uk-form-file'>selecting the file from your computer<input id='upload-select-answer-documents' type='file'></a> (formates allowed: <span id='answer-documents-formats'></span>)<br /><br /><br /></div><div id='progressbar-answer-documents' class='uk-progress uk-hidden'><div class='uk-progress-bar' style='width: 0%;'>...</div></div>"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS_UPLOADER_DESCRIPTION="
<div id='uikittwo-answer-documents-uploader' style='display:none'>
<div id='uikittwo-upload-drop-answer-documents' class='uk-placeholder uk-text-center'>
<br /><br />
<i class='uk-icon-cloud-upload uk-icon-medium uk-text-muted uk-margin-small-right'></i>
Upload Your <strong>answer</strong> by dropping the file here or
<a class='uk-form-file'>selecting the file from your device<input id='uikittwo-upload-select-answer-documents' type='file'></a> (formats allowed: <span id='answer-documents-formats'></span>)
<br /><br /><br />
</div>
<div id='uikittwo-progressbar-answer-documents' class='uk-progress uk-hidden'><div class='uk-progress-bar' style='width: 0%;'>...</div></div>
</div>
<div id='uikitthree-answer-documents-uploader' style='display:none'>
<div id='uikitthree-upload-answer-documents' class='uk-placeholder uk-text-center'>
<span uk-icon='icon: cloud-upload'></span>
<span class='uk-text-middle'>Upload Your <strong>answer</strong> by dropping the file here or
<div uk-form-custom>
<input type='file' multiple>
<span class='uk-link'>selecting the file from your device</span> (formats allowed: <span id='answer-documents-formats'></span>)
</div>
</div>
<progress id='uikitthree-progressbar-answer-documents' class='uk-progress' value='0' max='100' hidden></progress>
</div>
<div id='error-answer-documents-uploader'></div>"
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="<div id='upload-drop-main-image' class='uk-placeholder'><br /><br /><i class='uk-icon-cloud-upload uk-icon-medium uk-text-muted uk-margin-small-right'></i> Upload Your <strong>image <span id='size-main'></span></strong> by dropping the file here or <a class='uk-form-file'>selecting the file from your computer<input id='upload-select-main-image' type='file'></a> (formates allowed: <span id='main-image-formats'></span>)<br /><br /><br /></div><div id='progressbar-main-image' class='uk-progress uk-hidden'><div class='uk-progress-bar' style='width: 0%;'>...</div></div>"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE_UPLOADER_DESCRIPTION="
<div id='uikittwo-main-image-uploader' style='display:none'>
<div id='uikittwo-upload-drop-main-image' class='uk-placeholder uk-text-center'>
<br /><br />
<i class='uk-icon-cloud-upload uk-icon-medium uk-text-muted uk-margin-small-right'></i>
Upload Your <strong>main image <span id='size-main'></span></strong> by dropping the file here or
<a class='uk-form-file'>selecting the file from your computer<input id='uikittwo-upload-select-main-image' type='file'></a> (formats allowed: <span id='main-image-formats'></span>)
<br /><br /><br />
</div>
<div id='uikittwo-progressbar-main-image' class='uk-progress uk-hidden'><div class='uk-progress-bar' style='width: 0%;'>...</div></div>
</div>
<div id='uikitthree-main-image-uploader' style='display:none'>
<div id='uikitthree-upload-main-image' class='uk-placeholder uk-text-center'>
<span uk-icon='icon: cloud-upload'></span>
<span class='uk-text-middle'>Upload Your <strong>main image <span id='size-main'></span></strong> by dropping the file here or</span>
<div uk-form-custom>
<input type='file' multiple>
<span class='uk-link'>selecting the file from your computer</span> (formats allowed: <span id='main-image-formats'></span>)
</div>
</div>
<progress id='uikitthree-progressbar-main-image' class='uk-progress' value='0' max='100' hidden></progress>
</div>
<div id='error-main-image-uploader'></div>"
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"

View File

@ -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."

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage batchselection.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage details_above.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage details_fullwidth.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage details_left.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage details_right.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage details_under.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage publishing.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage publlshing.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage details_fullwidth.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage details_rightside.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage details_under.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage metadata.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage publishing.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage ajax.php
@ -26,8 +26,6 @@
// 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]))

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage adminviewfolderlist.php
@ -47,7 +47,7 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList
*
* @return array An array of JHtml options.
*/
public function getOptions()
protected function getOptions()
{
// get custom folder files
$localfolder = JPATH_COMPONENT_ADMINISTRATOR.'/views';

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage articles.php
@ -47,7 +47,7 @@ class JFormFieldArticles extends JFormFieldList
*
* @return array An array of JHtml options.
*/
public function getOptions()
protected function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage siteviewfolderlist.php
@ -47,7 +47,7 @@ class JFormFieldSiteviewfolderlist extends JFormFieldList
*
* @return array An array of JHtml options.
*/
public function getOptions()
protected function getOptions()
{
// get custom folder files
$localfolder = JPATH_COMPONENT_SITE.'/views';

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help_document.js
@ -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);

View File

@ -101,7 +101,8 @@
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TYPE_DESCRIPTION"
class="list_class"
multiple="false"
required="true">
required="true"
default="">
<!-- Option Set. -->
<option value="">
COM_QUESTIONSANSWERS_HELP_DOCUMENT_SELECT_AN_OPTION</option>
@ -128,6 +129,7 @@
label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_LABEL"
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_DESCRIPTION"
class="btn-group"
default=""
required="true">
<!-- Option Set. -->
<option value="1">
@ -143,6 +145,7 @@
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION"
class="list_class"
multiple="false"
default=""
required="true"
button="false"
/>
@ -154,6 +157,7 @@
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_SITE_VIEW_DESCRIPTION"
class="list_class"
multiple="false"
default=""
required="true"
button="false"
/>
@ -191,6 +195,7 @@
label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_URL_LABEL"
size="60"
maxlength="150"
default=""
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_URL_DESCRIPTION"
class="text_area"
required="true"
@ -207,6 +212,7 @@
label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TARGET_LABEL"
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TARGET_DESCRIPTION"
class="btn-group"
default=""
required="true">
<!-- Option Set. -->
<option value="1">

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage question_and_answer.js
@ -97,8 +97,12 @@ function setFile(filename, fileFormat, target, type){
return true;
}
function removeFileCheck(clearServer, target, type){
UIkit.modal.confirm('Are you sure you want to delete this '+target+'?', function(){ removeFile(clearServer, target, 1, type); });
function removeFileCheck(clearServer, target, type, uiVer){
if (3 == uiVer) {
UIkit.modal.confirm('Are you sure you want to delete this '+target+'?').then(function(){ removeFile(clearServer, target, 1, type); });
} else {
UIkit2.modal.confirm('Are you sure you want to delete this '+target+'?', function(){ removeFile(clearServer, target, 1, type); });
}
}
function removeFile(clearServer, target, flush, type){
@ -135,16 +139,16 @@ function removeFile(clearServer, target, flush, type){
}
function removeFile_server(currentFileName, target, flush, type){
var getUrl = JRouter("index.php?option=com_questionsanswers&task=ajax.removeFile&format=json&vdm="+vastDevMod);
var getUrl = JRouter("index.php?option=com_questionsanswers&task=ajax.removeFile&format=json&raw=true&vdm="+vastDevMod);
if(token.length > 0 && target.length > 0 && type.length > 0){
var request = 'token='+token+'&filename='+currentFileName+'&target='+target+'&flush='+flush+'&type='+type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
dataType: 'json',
data: request,
jsonp: 'callback'
jsonp: false
});
}
function isJsonString(str) {

View File

@ -110,6 +110,7 @@
label="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_QUESTION_LABEL"
rows="2"
cols="5"
default=""
description="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_QUESTION_DESCRIPTION"
class="text_area span12"
filter="STRING"
@ -121,6 +122,7 @@
type="editor"
name="answer"
label="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_LABEL"
default=""
width="100%"
height="500"
buttons="false"
@ -134,6 +136,7 @@
name="catid"
label="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_CATID_LABEL"
extension="com_questionsanswers.questions_and_answers"
default=""
description="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_CATID_DESCRIPTION"
class="inputbox"
/>

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help_document.php
@ -28,9 +28,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
/**
* Questionsanswers Help_document Model
*/
@ -63,6 +60,9 @@ class QuestionsanswersModelHelp_document extends JModelAdmin
*/
public function getTable($type = 'help_document', $prefix = 'QuestionsanswersTable', $config = array())
{
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_questionsanswers/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config);
}
@ -116,15 +116,18 @@ class QuestionsanswersModelHelp_document extends JModelAdmin
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @param array $options Optional array of options for the form creation.
*
* @return mixed A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{
// set load data option
$options['load_data'] = $loadData;
// Get the form.
$form = $this->loadForm('com_questionsanswers.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData));
$form = $this->loadForm('com_questionsanswers.help_document', 'help_document', $options);
if (empty($form))
{
@ -185,17 +188,20 @@ class QuestionsanswersModelHelp_document extends JModelAdmin
// Only load these values if no id is found
if (0 == $id)
{
// Set redirected field name
$redirectedField = $jinput->get('ref', null, 'STRING');
// Set redirected field value
$redirectedValue = $jinput->get('refid', 0, 'INT');
// Set redirected view name
$redirectedView = $jinput->get('ref', null, 'STRING');
// Set field name (or fall back to view name)
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
// Set redirected view id
$redirectedId = $jinput->get('refid', 0, 'INT');
// Set field id (or fall back to redirected view id)
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
if (0 != $redirectedValue && $redirectedField)
{
// Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue);
}
}
return $form;
}

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help_documents.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/**
* Help_documents Model
*/
@ -122,11 +119,9 @@ class QuestionsanswersModelHelp_documents extends JModelList
// set values to display correctly.
if (QuestionsanswersHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('help_document.access', 'com_questionsanswers.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_questionsanswers'));
$access = (JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers.help_document.' . (int) $item->id) && JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers'));
if (!$access)
{
unset($items[$nr]);
@ -325,11 +320,9 @@ class QuestionsanswersModelHelp_documents extends JModelList
// set values to display correctly.
if (QuestionsanswersHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('help_document.access', 'com_questionsanswers.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_questionsanswers'));
$access = (JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers.help_document.' . (int) $item->id) && JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers'));
if (!$access)
{
unset($items[$nr]);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage import.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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
@ -28,9 +28,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
/**
* Questionsanswers Question_and_answer Model
*/
@ -63,6 +60,9 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
*/
public function getTable($type = 'question_and_answer', $prefix = 'QuestionsanswersTable', $config = array())
{
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_questionsanswers/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config);
}
@ -86,9 +86,14 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
}
else
{
// set the vast development method key
$this->vastDevMod = QuestionsanswersHelper::randomkey(50);
QuestionsanswersHelper::set($this->vastDevMod, 'question_and_answer__'.$id);
QuestionsanswersHelper::set('question_and_answer__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
QuestionsanswersHelper::set($this->vastDevMod . '__return', $return);
}
}
return $this->vastDevMod;
@ -156,9 +161,14 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
}
else
{
// set the vast development method key
$this->vastDevMod = QuestionsanswersHelper::randomkey(50);
QuestionsanswersHelper::set($this->vastDevMod, 'question_and_answer__'.$id);
QuestionsanswersHelper::set('question_and_answer__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
QuestionsanswersHelper::set($this->vastDevMod . '__return', $return);
}
// build download links
$item->links = array();
@ -209,15 +219,18 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @param array $options Optional array of options for the form creation.
*
* @return mixed A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{
// set load data option
$options['load_data'] = $loadData;
// Get the form.
$form = $this->loadForm('com_questionsanswers.question_and_answer', 'question_and_answer', array('control' => 'jform', 'load_data' => $loadData));
$form = $this->loadForm('com_questionsanswers.question_and_answer', 'question_and_answer', $options);
if (empty($form))
{
@ -285,6 +298,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('question', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('question', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('question'))
{
// Disable fields while saving.
@ -301,6 +315,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('answer', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('answer', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('answer'))
{
// Disable fields while saving.
@ -317,6 +332,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('catid', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('catid', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('catid'))
{
// Disable fields while saving.
@ -333,6 +349,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('answer_documents', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('answer_documents', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('answer_documents'))
{
// Disable fields while saving.
@ -349,6 +366,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('main_image_uploader', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('main_image_uploader', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('main_image_uploader'))
{
// Disable fields while saving.
@ -360,17 +378,20 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
// Only load these values if no id is found
if (0 == $id)
{
// Set redirected field name
$redirectedField = $jinput->get('ref', null, 'STRING');
// Set redirected field value
$redirectedValue = $jinput->get('refid', 0, 'INT');
// Set redirected view name
$redirectedView = $jinput->get('ref', null, 'STRING');
// Set field name (or fall back to view name)
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
// Set redirected view id
$redirectedId = $jinput->get('refid', 0, 'INT');
// Set field id (or fall back to redirected view id)
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
if (0 != $redirectedValue && $redirectedField)
{
// Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue);
}
}
return $form;
}

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/**
* Questions_and_answers Model
*/
@ -110,11 +107,9 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList
// set values to display correctly.
if (QuestionsanswersHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('question_and_answer.access', 'com_questionsanswers.question_and_answer.' . (int) $item->id) && $user->authorise('question_and_answer.access', 'com_questionsanswers'));
$access = (JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers.question_and_answer.' . (int) $item->id) && JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers'));
if (!$access)
{
unset($items[$nr]);
@ -272,11 +267,9 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList
// set values to display correctly.
if (QuestionsanswersHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('question_and_answer.access', 'com_questionsanswers.question_and_answer.' . (int) $item->id) && $user->authorise('question_and_answer.access', 'com_questionsanswers'));
$access = (JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers.question_and_answer.' . (int) $item->id) && JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers'));
if (!$access)
{
unset($items[$nr]);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage questionsanswers.php
@ -26,10 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
jimport('joomla.application.component.helper');
/**
* Questionsanswers Model
*/

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage questionsanswers.php
@ -25,33 +25,26 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_questionsanswers'))
{
return JError::raiseWaring(404, JText::_('JERROR_ALERTNOAUTHOR'));
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
};
// Load cms libraries
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
// Load joomla libraries without overwrite
JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false);
// Add CSS file for all pages
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_questionsanswers/assets/css/admin.css');
$document->addScript('components/com_questionsanswers/assets/js/admin.js');
// require helper files
JLoader::register('QuestionsanswersHelper', dirname(__FILE__) . '/helpers/questionsanswers.php');
JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php');
JLoader::register('QuestionsanswersHelper', __DIR__ . '/helpers/questionsanswers.php');
JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
// Triger the Global Admin Event
QuestionsanswersHelper::globalEvent($document);
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by Questionsanswers
$controller = JControllerLegacy::getInstance('Questionsanswers');

View File

@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS `#__questionsanswers_question_and_answer` (
KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`),
KEY `idx_catid` (`catid`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__questionsanswers_help_document` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS `#__questionsanswers_help_document` (
KEY `idx_article` (`article`),
KEY `idx_target` (`target`),
KEY `idx_alias` (`alias`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help_document.php
@ -28,9 +28,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
// import Joomla table library
jimport('joomla.database.table');
/**
* Help_documents Table class
*/
@ -237,7 +234,7 @@ class QuestionsanswersTableHelp_document extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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
@ -28,9 +28,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
// import Joomla table library
jimport('joomla.database.table');
/**
* Questions_and_answers Table class
*/
@ -237,7 +234,7 @@ class QuestionsanswersTableQuestion_and_answer extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage submitbutton.js

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage edit.php
@ -31,7 +31,7 @@ JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
$componentParams = JComponentHelper::getParams('com_questionsanswers');
$componentParams = $this->params; // will be removed just use $this->params instead
?>
<script type="text/javascript">
// waiting spinner
@ -56,7 +56,7 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
});
</script>
<div id="questionsanswers_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_questionsanswers&layout=edit&id='.(int) $this->item->id.$this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<form action="<?php echo JRoute::_('index.php?option=com_questionsanswers&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<?php echo JLayoutHelper::render('help_document.details_above', $this); ?>
<div class="form-horizontal">
@ -79,6 +79,10 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
<?php $this->tab_name = 'help_documentTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('help_document.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('help_document.edit.state') || $this->canDo->get('core.edit.created')) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'help_documentTab', 'publishing', JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop">

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Help_document View class
*/
@ -40,27 +37,37 @@ class QuestionsanswersViewHelp_document extends JViewLegacy
*/
public function display($tpl = null)
{
// set params
$this->params = JComponentHelper::getParams('com_questionsanswers');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->script = $this->get('Script');
$this->state = $this->get('State');
// get action permissions
$this->canDo = QuestionsanswersHelper::getActions('help_document',$this->item);
$this->canDo = QuestionsanswersHelper::getActions('help_document', $this->item);
// get input
$jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid)
if ($this->refid && $this->ref)
{
// return to the item that refered to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
// return to the item that referred to this item
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that refered to this item
$this->referral = '&ref='.(string)$this->ref;
// return to the list view that referred to this item
$this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
}
// Set the toolbar
@ -92,7 +99,7 @@ class QuestionsanswersViewHelp_document extends JViewLegacy
JToolbarHelper::title( JText::_($isNew ? 'COM_QUESTIONSANSWERS_HELP_DOCUMENT_NEW' : 'COM_QUESTIONSANSWERS_HELP_DOCUMENT_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if ($this->refid || $this->ref)
if (QuestionsanswersHelper::checkString($this->referral))
{
if ($this->canDo->get('help_document.create') && $isNew)
{

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_batch_body.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_batch_footer.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_body.php
@ -75,16 +75,16 @@ $edit = "index.php?option=com_questionsanswers&view=help_documents&task=help_doc
<?php endif; ?>
</td>
<td class="nowrap">
<?php if ($canDo->get('help_document.edit')): ?>
<div class="name">
<?php if ($canDo->get('help_document.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->title); ?></a>
<?php if ($item->checked_out): ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'help_documents.', $canCheckin); ?>
<?php endif; ?>
</div>
<?php else: ?>
<div class="name"><?php echo $this->escape($item->title); ?></div>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
</div>
</td>
<td class="hidden-phone">
<?php echo JText::_($item->type); ?>

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_foot.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_head.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_toolbar.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Questionsanswers View class for the Help_documents
*/
@ -54,6 +51,8 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy
$this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = $this->listOrder == 'ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions
$this->canDo = QuestionsanswersHelper::getActions('help_document');
$this->canEdit = $this->canDo->get('help_document.edit');
@ -246,7 +245,7 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy
}
// Set Admin View Selection
$this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->getOptions();
$this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->options;
if ($this->admin_viewOptions)
{
// Admin View Filter
@ -268,7 +267,7 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy
}
// Set Site View Selection
$this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->getOptions();
$this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->options;
if ($this->site_viewOptions)
{
// Site View Filter

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Questionsanswers Import View
*/

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage submitbutton.js

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage edit.php
@ -31,7 +31,7 @@ JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
$componentParams = JComponentHelper::getParams('com_questionsanswers');
$componentParams = $this->params; // will be removed just use $this->params instead
?>
<script type="text/javascript">
// waiting spinner
@ -56,7 +56,7 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
});
</script>
<div id="questionsanswers_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_questionsanswers&layout=edit&id='.(int) $this->item->id.$this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<form action="<?php echo JRoute::_('index.php?option=com_questionsanswers&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div class="form-horizontal">
<div class="span9">
@ -73,6 +73,10 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
<?php $this->tab_name = 'question_and_answerTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('question_and_answer.delete') || $this->canDo->get('question_and_answer.edit.created_by') || $this->canDo->get('question_and_answer.edit.state') || $this->canDo->get('question_and_answer.edit.created')) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'question_and_answerTab', 'publishing', JText::_('COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop">
@ -126,9 +130,41 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
<?php if ($formats = $componentParams->get('image_formats', null)) : ?>
jQuery(function($){
var progressbar = $("#progressbar-main-image"),
<?php if ($formats = $this->params->get('image_formats', null)) : ?>
<?php $uikitVersion = $this->params->get('uikit_version', 2); // get Uikit Version ?>
// set some details
var sizeNotice = '';
<?php if ($resize = $this->params->get('crop_main', null)) : ?>
var sizemain = '(';
<?php if ($width = $this->params->get('main_width', null)): ?>
sizemain += 'width: <?php echo $width; ?>px';
<?php else: ?>
sizemain += 'width: <?php echo JText::_('COM_QUESTIONSANSWERS_PROPORTIONALLY'); ?>';
<?php endif; ?>
<?php if ($height = $this->params->get('main_height', null)): ?>
sizemain += ' height: <?php echo $height; ?>px';
<?php else: ?>
sizemain += ' height: <?php echo JText::_('COM_QUESTIONSANSWERS_PROPORTIONALLY'); ?>';
<?php endif; ?>
sizemain += ')';
<?php if (2 == $uikitVersion) : ?>
sizeNotice = '<span data-uk-tooltip title="<?php echo JText::_('COM_QUESTIONSANSWERS_THE_MAIN_WILL_BE_CROPPED_TO_THIS_SIZE'); ?>">'+sizemain+'</span>';
<?php else: ?>
sizeNotice = '<span uk-tooltip title="<?php echo JText::_('COM_QUESTIONSANSWERS_THE_MAIN_WILL_BE_CROPPED_TO_THIS_SIZE'); ?>">'+sizemain+'</span>';
<?php endif; ?>
<?php endif; ?>
// load the UIKIT script
<?php if (2 == $uikitVersion) : ?>
// load uikit 2 uploader script
jQuery(function($){
// prep the placeholder uploading divs
$('#uikittwo-main-image-uploader').show();
$('#uikitthree-main-image-uploader').remove();
$('#error-main-image-uploader').remove();
$('#size-main').html(sizeNotice);
$('#main-image-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
// get progressbar
var progressbar = $("#uikittwo-progressbar-main-image"),
bar = progressbar.find('.uk-progress-bar'),
settings = {
@ -160,35 +196,101 @@ jQuery(function($){
setFilekey(response.success, response.fileformat, 'main', 'image');
}
}
};
};
var select = UIkit.uploadSelect($("#upload-select-main-image"), settings),
drop = UIkit.uploadDrop($("#upload-drop-main-image"), settings);
});
jQuery('#main-image-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
<?php if ($resize = $componentParams->get('crop_main', null)) : ?>
var sizemain = '(';
<?php if ($width = $componentParams->get('main_width', null)): ?>
sizemain += 'width: <?php echo $width; ?>px';
var select = UIkit2.uploadSelect($("#uikittwo-upload-select-main-image"), settings),
drop = UIkit2.uploadDrop($("#uikittwo-upload-drop-main-image"), settings);
});
<?php else: ?>
sizemain += 'width: <?php echo JText::_('COM_QUESTIONSANSWERS_PROPORTIONALLY'); ?>';
// load uikit 3 uploader script
jQuery(function($){
// prep the placeholder uploading divs
$('#uikitthree-main-image-uploader').show();
$('#uikittwo-main-image-uploader').remove();
$('#error-main-image-uploader').remove();
$('#size-main').html(sizeNotice);
$('#main-image-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
// get progressbar
var bar = document.getElementById('uikitthree-progressbar-main-image');
UIkit.upload('#uikitthree-upload-main-image', {
url: JRouter('index.php?option=com_questionsanswers&task=ajax.uploadfile&format=json&type=image&target=main&raw=true&token='+token+'&vdm='+vastDevMod), // upload url
multiple: true,
allow : '*.(<?php echo implode('|', $formats); ?>)', // allow uploads
beforeSend: function (environment) {
// console.log('beforeSend', arguments);
// The environment object can still be modified here.
// var {data, method, headers, xhr, responseType} = environment;
},
beforeAll: function () {
// console.log('beforeAll', arguments);
},
load: function () {
// console.log('load', arguments);
},
error: function () {
// console.log('error', arguments);
},
complete: function () {
// console.log('complete', arguments);
},
loadStart: function (e) {
jQuery(".success-main-image-8768").remove();
bar.removeAttribute('hidden');
bar.max = e.total;
bar.value = e.loaded;
},
progress: function (e) {
bar.max = e.total;
bar.value = e.loaded;
},
loadEnd: function (e) {
bar.max = e.total;
bar.value = e.loaded;
},
completeAll: function (response) {
setTimeout(function () {
bar.setAttribute('hidden', 'hidden');
}, 250);
// act upon the response
if (response.response) {
response = JSON.parse(response.response);
if (response.error){
alert(response.error);
} else if (response.success) {
// set the new file name and if another is found delete it
setFilekey(response.success, response.fileformat, 'main', 'image');
}
}
}
});
});
<?php endif; ?>
<?php if ($height = $componentParams->get('main_height', null)): ?>
sizemain += ' height: <?php echo $height; ?>px';
<?php else: ?>
sizemain += ' height: <?php echo JText::_('COM_QUESTIONSANSWERS_PROPORTIONALLY'); ?>';
<?php endif; ?>
sizemain += ')';
sizeNotice = '<span data-uk-tooltip title="<?php echo JText::_('COM_QUESTIONSANSWERS_THE_MAIN_WILL_BE_CROPPED_TO_THIS_SIZE'); ?>">'+sizemain+'</span>';
jQuery('#size-main').html(sizeNotice);
<?php endif; ?>
<?php else: ?>
jQuery('#upload-drop-main-image').html('<b><?php echo JText::_('COM_QUESTIONSANSWERS_ALLOWED_IMAGE_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR'); ?></b>');
jQuery('#error-main-image-uploader').html('<b><?php echo JText::_('COM_QUESTIONSANSWERS_ALLOWED_IMAGE_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR'); ?></b>');
<?php endif; ?>
<?php if ($formats = $componentParams->get('document_formats', null)) : ?>
jQuery(function($){
var progressbar = $("#progressbar-answer-documents"),
<?php if ($formats = $this->params->get('document_formats', null)) : ?>
<?php $uikitVersion = $this->params->get('uikit_version', 2); // get Uikit Version ?>
// load the UIKIT script
<?php if (2 == $uikitVersion) : ?>
// load uikit 2 uploader script
jQuery(function($){
// prep the placeholder uploading divs
$('#uikittwo-answer-documents-uploader').show();
$('#uikitthree-answer-documents-uploader').remove();
$('#error-answer-documents-uploader').remove();
$('#answer-documents-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
// get progressbar
var progressbar = $("#uikittwo-progressbar-answer-documents"),
bar = progressbar.find('.uk-progress-bar'),
settings = {
@ -216,20 +318,89 @@ jQuery(function($){
if (response.error){
alert(response.error);
} else if (response.success) {
// load the link to the document links object
documentsLinks[response.key] = response.link;
// set the new file name and if another is found delete it
setFilekey(response.success, response.fileformat, 'answer', 'documents');
}
}
};
};
var select = UIkit.uploadSelect($("#upload-select-answer-documents"), settings),
drop = UIkit.uploadDrop($("#upload-drop-answer-documents"), settings);
});
jQuery('#answer-documents-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
var select = UIkit2.uploadSelect($("#uikittwo-upload-select-answer-documents"), settings),
drop = UIkit2.uploadDrop($("#uikittwo-upload-drop-answer-documents"), settings);
});
<?php else: ?>
// load uikit 3 uploader script
jQuery(function($){
// prep the placeholder uploading divs
$('#uikitthree-answer-documents-uploader').show();
$('#uikittwo-answer-documents-uploader').remove();
$('#error-answer-documents-uploader').remove();
$('#answer-documents-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
// get progressbar
var bar = document.getElementById('uikitthree-progressbar-answer-documents');
UIkit.upload('#uikitthree-upload-answer-documents', {
url: JRouter('index.php?option=com_questionsanswers&task=ajax.uploadfile&format=json&type=documents&target=answer&raw=true&token='+token+'&vdm='+vastDevMod), // upload url
multiple: true,
allow : '*.(<?php echo implode('|', $formats); ?>)', // allow uploads
beforeSend: function (environment) {
// console.log('beforeSend', arguments);
// The environment object can still be modified here.
// var {data, method, headers, xhr, responseType} = environment;
},
beforeAll: function () {
// console.log('beforeAll', arguments);
},
load: function () {
// console.log('load', arguments);
},
error: function () {
// console.log('error', arguments);
},
complete: function () {
// console.log('complete', arguments);
},
loadStart: function (e) {
jQuery(".success-answer-documents-8768").remove();
bar.removeAttribute('hidden');
bar.max = e.total;
bar.value = e.loaded;
},
progress: function (e) {
bar.max = e.total;
bar.value = e.loaded;
},
loadEnd: function (e) {
bar.max = e.total;
bar.value = e.loaded;
},
completeAll: function (response) {
setTimeout(function () {
bar.setAttribute('hidden', 'hidden');
}, 250);
// act upon the response
if (response.response) {
response = JSON.parse(response.response);
if (response.error){
alert(response.error);
} else if (response.success) {
// set the new file name and if another is found delete it
setFilekey(response.success, response.fileformat, 'answer', 'documents');
}
}
}
});
});
<?php endif; ?>
<?php else: ?>
jQuery('#upload-drop-answer-documents').html('<b><?php echo JText::_('COM_QUESTIONSANSWERS_ALLOWED_DOCUMENT_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR'); ?></b>');
jQuery('#error-answer-documents-uploader').html('<b><?php echo JText::_('COM_QUESTIONSANSWERS_ALLOWED_DOCUMENT_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR'); ?></b>');
<?php endif; ?>
<?php
@ -250,12 +421,14 @@ function JRouter(link) {
}
function getFile(filename, fileFormat, target, type){
// set uikit version
var uiVer = <?php echo (int) $this->params->get('uikit_version', 2); ?>;
// set the link
var link = '<?php echo QuestionsanswersHelper::getFolderPath('url'); ?>';
// build the return
if (type === 'image') {
var thePath = link+filename+'.'+fileFormat;
var thedelete = '<button onclick="removeFileCheck(\''+filename+'\', \''+target+'\', \''+type+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+target+' '+type+'</button></div>';
var thedelete = '<button onclick="removeFileCheck(\''+filename+'\', \''+target+'\', \''+type+'\', \''+uiVer+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+target+' '+type+'</button></div>';
return '<img alt="'+target+' Image" src="'+thePath+'" /><br /><br />'+thedelete;
} else if (type === 'images') {
var imageNum = filename.length;
@ -275,7 +448,7 @@ function getFile(filename, fileFormat, target, type){
imagesBox += '<div class="uk-panel">';
var fileFormat = item.split('_')[2];
var thePath = link+item+'.'+fileFormat;
var thedelete = '<button onclick="removeFileCheck(\''+item+'\', \''+target+'\', \''+type+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+target+' '+type+'</button>';
var thedelete = '<button onclick="removeFileCheck(\''+item+'\', \''+target+'\', \''+type+'\', \''+uiVer+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+target+' '+type+'</button>';
imagesBox += '<img alt="'+target+' Image" src="'+thePath+'" /><br /><br />'+thedelete;
if (perRow == counter) {
counter = 0;
@ -316,7 +489,7 @@ function getFile(filename, fileFormat, target, type){
if (documentsLinks.hasOwnProperty(item)) {
thedownload = '<a href="'+JRouter(documentsLinks[item])+'" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-success"><i class="uk-icon-download"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_DOWNLOAD'); ?> '+fileName+'</a>';
}
var thedelete = '<button onclick="removeFileCheck(\''+item+'\', \''+target+'\', \''+type+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+fileName+'</button>';
var thedelete = '<button onclick="removeFileCheck(\''+item+'\', \''+target+'\', \''+type+'\', \''+uiVer+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+fileName+'</button>';
fileBox += theplaceholder+thedownload+thedelete;
if (perRow == counter) {
counter = 0;
@ -342,7 +515,7 @@ function getFile(filename, fileFormat, target, type){
if (documentsLinks.hasOwnProperty(filename)) {
thedownload = '<a href="'+JRouter(documentsLinks[filename])+'" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-success"><i class="uk-icon-download"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_DOWNLOAD'); ?> '+fileName+'</a>';
}
var thedelete = '<button onclick="removeFileCheck(\''+filename+'\', \''+target+'\', \''+type+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+fileName+'</button>';
var thedelete = '<button onclick="removeFileCheck(\''+filename+'\', \''+target+'\', \''+type+'\', \''+uiVer+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+fileName+'</button>';
return theplaceholder+thedownload+thedelete + '</div>';
}
}

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Question_and_answer View class
*/
@ -40,27 +37,37 @@ class QuestionsanswersViewQuestion_and_answer extends JViewLegacy
*/
public function display($tpl = null)
{
// set params
$this->params = JComponentHelper::getParams('com_questionsanswers');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->script = $this->get('Script');
$this->state = $this->get('State');
// get action permissions
$this->canDo = QuestionsanswersHelper::getActions('question_and_answer',$this->item);
$this->canDo = QuestionsanswersHelper::getActions('question_and_answer', $this->item);
// get input
$jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid)
if ($this->refid && $this->ref)
{
// return to the item that refered to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
// return to the item that referred to this item
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that refered to this item
$this->referral = '&ref='.(string)$this->ref;
// return to the list view that referred to this item
$this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
}
// Set the toolbar
@ -92,7 +99,7 @@ class QuestionsanswersViewQuestion_and_answer extends JViewLegacy
JToolbarHelper::title( JText::_($isNew ? 'COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_NEW' : 'COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if ($this->refid || $this->ref)
if (QuestionsanswersHelper::checkString($this->referral))
{
if ($this->canDo->get('question_and_answer.create') && $isNew)
{

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_batch_body.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_batch_footer.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_body.php
@ -75,16 +75,16 @@ $edit = "index.php?option=com_questionsanswers&view=questions_and_answers&task=q
<?php endif; ?>
</td>
<td class="nowrap">
<?php if ($canDo->get('question_and_answer.edit')): ?>
<div class="name">
<?php if ($canDo->get('question_and_answer.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->question); ?></a>
<?php if ($item->checked_out): ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'questions_and_answers.', $canCheckin); ?>
<?php endif; ?>
</div>
<?php else: ?>
<div class="name"><?php echo $this->escape($item->question); ?></div>
<?php echo $this->escape($item->question); ?>
<?php endif; ?>
</div>
</td>
<td class="hidden-phone">
<?php echo $this->escape($item->answer); ?>

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_foot.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_head.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_toolbar.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Questionsanswers View class for the Questions_and_answers
*/
@ -54,6 +51,8 @@ class QuestionsanswersViewQuestions_and_answers extends JViewLegacy
$this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = $this->listOrder == 'ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions
$this->canDo = QuestionsanswersHelper::getActions('question_and_answer');
$this->canEdit = $this->canDo->get('question_and_answer.edit');

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_main.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_readme_information.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_vast_development_method_notice_board.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage default_vdm.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Questionsanswers View class
*/

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage A4.print.css

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_QUESTIONSANSWERS</name>
<creationDate>5th May, 2018</creationDate>
<creationDate>27th December, 2018</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://www.vdm.io/</authorUrl>
@ -53,6 +53,9 @@
<filename>index.html</filename>
<filename>router.php</filename>
<filename>questionsanswers.php</filename>
<filename>questionsanswers.php</filename>
<filename>router.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>controllers</folder>
@ -75,9 +78,14 @@
<files folder="admin">
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>###WHMCS_ENCRYPT_FILE###
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>questionsanswers.php</filename>
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>questionsanswers.php</filename>
<filename>README.txt</filename>
<filename>README.txt</filename>
<folder>assets</folder>
<folder>controllers</folder>

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage script.php
@ -27,8 +27,6 @@
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.modal');
jimport('joomla.installer.installer');
jimport('joomla.installer.helper');
/**
* Script File of Questionsanswers Component
@ -83,7 +81,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query);
// Execute the query to remove Question_and_answer items
$question_and_answer_done = $db->execute();
if ($question_and_answer_done);
if ($question_and_answer_done)
{
// If succesfully remove Question_and_answer add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the <b>#__content_type</b> table'));
@ -98,7 +96,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query);
// Execute the query to remove Question_and_answer items
$question_and_answer_done = $db->execute();
if ($question_and_answer_done);
if ($question_and_answer_done)
{
// If succesfully remove Question_and_answer add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
@ -113,7 +111,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query);
// Execute the query to remove Question_and_answer items
$question_and_answer_done = $db->execute();
if ($question_and_answer_done);
if ($question_and_answer_done)
{
// If succesfully remove Question_and_answer add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the <b>#__ucm_content</b> table'));
@ -169,7 +167,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query);
// Execute the query to remove Question_and_answer catid items
$question_and_answer_catid_done = $db->execute();
if ($question_and_answer_catid_done);
if ($question_and_answer_catid_done)
{
// If succesfully remove Question_and_answer catid add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.questions_and_answers.category) type alias was removed from the <b>#__content_type</b> table'));
@ -184,7 +182,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query);
// Execute the query to remove Question_and_answer catid items
$question_and_answer_catid_done = $db->execute();
if ($question_and_answer_catid_done);
if ($question_and_answer_catid_done)
{
// If succesfully remove Question_and_answer catid add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.questions_and_answers.category) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
@ -199,7 +197,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query);
// Execute the query to remove Question_and_answer catid items
$question_and_answer_catid_done = $db->execute();
if ($question_and_answer_catid_done);
if ($question_and_answer_catid_done)
{
// If succesfully remove Question_and_answer catid add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.questions_and_answers.category) type alias was removed from the <b>#__ucm_content</b> table'));
@ -255,7 +253,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query);
// Execute the query to remove Help_document items
$help_document_done = $db->execute();
if ($help_document_done);
if ($help_document_done)
{
// If succesfully remove Help_document add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the <b>#__content_type</b> table'));
@ -270,7 +268,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query);
// Execute the query to remove Help_document items
$help_document_done = $db->execute();
if ($help_document_done);
if ($help_document_done)
{
// If succesfully remove Help_document add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
@ -285,7 +283,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query);
// Execute the query to remove Help_document items
$help_document_done = $db->execute();
if ($help_document_done);
if ($help_document_done)
{
// If succesfully remove Help_document add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the <b>#__ucm_content</b> table'));
@ -329,7 +327,7 @@ class com_questionsanswersInstallerScript
$query->where($questionsanswers_condition);
$db->setQuery($query);
$help_document_done = $db->execute();
if ($help_document_done);
if ($help_document_done)
{
// If succesfully remove questionsanswers add queued success message.
$app->enqueueMessage(JText::_('All related items was removed from the <b>#__assets</b> table'));

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage category.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage downloads.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage site.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage site.js

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage controller.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controller library
jimport('joomla.application.component.controller');
/**
* Questionsanswers Component Controller
*/

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage ajax.json.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/**
* Questionsanswers Ajax Controller
*/

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage download.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x
@build 5th May, 2018
@build 27th December, 2018
@created 30th January, 2017
@package Questions and Answers
@subpackage help.php
@ -26,9 +26,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/**
* Questionsanswers Help Controller
*/

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@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
@ -26,9 +26,6 @@
// 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 default site 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);
}
/**
@ -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');
// Setup redirect info.
// get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
$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,17 +204,29 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/
public function cancel($key = null)
{
// get the referal details
// 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 = 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 = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
@ -235,7 +237,7 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
}
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
$redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
@ -244,16 +246,6 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
)
);
}
}
else
{
// Redirect to the items screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
)
);
}
return $cancel;
}
@ -269,11 +261,15 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/
public function save($key = null, $urlVar = null)
{
// get the referal details
// 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(

Some files were not shown because too many files have changed in this diff Show More