@copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html A sermon distributor that links to Dropbox. /----------------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); /** * Sermondistributor Help Controller */ class SermondistributorControllerHelp extends JControllerLegacy { public function __construct($config) { parent::__construct($config); // load the tasks $this->registerTask('getText', 'help'); } public function help() { $user = JFactory::getUser(); $jinput = JFactory::getApplication()->input; // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($token == $call_token) { $task = $this->getTask(); switch($task){ case 'getText': try { $idValue = $jinput->get('id', 0, 'INT'); if($idValue) { $result = $this->getHelpDocumentText($idValue); } else { $result = ''; } echo $result; // stop execution gracefully jexit(); } catch(Exception $e) { // stop execution gracefully jexit(); } break; } } else { // stop execution gracefully jexit(); } } protected function getHelpDocumentText($id) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.title','a.content')); $query->from('#__sermondistributor_help_document AS a'); $query->where('a.id = '.(int) $id); $query->where('a.published = 1'); $query->where('a.location = 2'); $db->setQuery($query); $db->execute(); if($db->getNumRows()) { $text = array(); $document = $db->loadObject(); // fix image issue $images['src="images'] = 'src="'.JURI::root().'images'; $images["src='images"] = "src='".JURI::root()."images"; $images['src="/images'] = 'src="'.JURI::root().'images'; $images["src='/images"] = "src='".JURI::root()."images"; // set document template $text[] = ""; $text[] = ''; $text[] = "
"; $text[] = ''; $text[] = "