From 5651d3dca82d1aad4350acf0edec094213d6ba7b Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 31 Aug 2021 16:00:12 +0200 Subject: [PATCH] Improved the ajax controller. --- README.md | 4 +- admin/README.txt | 4 +- admin/access.xml | 1 - admin/assets/images/icons/field_add.png | Bin 7715 -> 0 bytes .../joomla_3/JControllerLegacyAjax.php | 20 +- .../joomla_3/JControllerLegacyAjaxSite.php | 21 +- admin/compiler/joomla_3/ajax.json.php | 4 +- admin/compiler/joomla_3/ajax.php | 2 +- admin/controllers/ajax.json.php | 362 ++++++++++++------ admin/helpers/compiler/e_Interpretation.php | 26 +- .../en-GB/en-GB.com_componentbuilder.ini | 7 +- .../en-GB/en-GB.com_componentbuilder.sys.ini | 2 - admin/models/componentbuilder.php | 3 +- componentbuilder.xml | 2 +- script.php | 2 +- 15 files changed, 307 insertions(+), 153 deletions(-) delete mode 100644 admin/assets/images/icons/field_add.png diff --git a/README.md b/README.md index 8bac9f332..c61f1f52b 100644 --- a/README.md +++ b/README.md @@ -143,11 +143,11 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 27th August, 2021 ++ *Last Build*: 31st August, 2021 + *Version*: 2.12.11 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **292163** ++ *Line count*: **292284** + *Field count*: **1630** + *File count*: **1936** + *Folder count*: **322** diff --git a/admin/README.txt b/admin/README.txt index 8bac9f332..c61f1f52b 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -143,11 +143,11 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 27th August, 2021 ++ *Last Build*: 31st August, 2021 + *Version*: 2.12.11 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **292163** ++ *Line count*: **292284** + *Field count*: **1630** + *File count*: **1936** + *Folder count*: **322** diff --git a/admin/access.xml b/admin/access.xml index 45a3a54d4..7464de0f4 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -274,7 +274,6 @@ - diff --git a/admin/assets/images/icons/field_add.png b/admin/assets/images/icons/field_add.png deleted file mode 100644 index a207756a7deb11072d82e48758492aab0b05c115..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7715 zcmbVxWmr`2*7pqE4N?O`hY~|K0}Mk*w+P4pBaHOW2uP=NOE*Y~gn&webRz-{Y0FY{^!wfLT;J<$YJj}jV z0WpF(FnFq(c^bMt_4GlYkpLw-R~sZ)!x>?ZG(aNk{M?6-asUAKQ3~xAMu z${4`l|IvlHl4p1D^mLOE67uo!5%duibVb_>L8PUn|H=>%5x`Igc=)+^B76m0JUIT5 z07H7%qET+1C|4KoUx^4CS1(U_b_~*go8auGt^HrYE*}4J6vkyjz6duVh@h~Lv-4lO z{zdKKX@LB{F#bns4us9!_^CIifzw(239eY0P~unTJ0vu ze`QerlYWReL<%M*DJAi5yQNg6rKB*ZVPe7(a2O1O{olNH|35wx!hjL_8yx>nu>3QG ziNL?7{|$Z2#eb6r>4M1^G$u8Uby9r*07gR%n39q2;!jIrPoufH6`x-pcv5|Q!{5nK zK_jBgX^Ep}`LEwNI2LurnX}ebj^KByF21gQcJi*D&OM}g(zs!}9{Rm)(x90ircS#l z045}4Bmd2w=%;w_^~Hg#&-BpdI7c?2*6_t!ou?um2iZdlS3eui6rLaS#uO8fWC|HM z5zu1`3*%W^lXST~QqFV2CnY6)Hz*lO{NxN~!J$wFH;&xw|7;^C?8-{K{Enou)^t*!K8L!Vj@%x_cc71+yo;Tn)tB=zW zvCqW$_Ph(5JbDnx-rKK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36cf1a9 100644 --- a/admin/compiler/joomla_3/JControllerLegacyAjax.php +++ b/admin/compiler/joomla_3/JControllerLegacyAjax.php @@ -29,20 +29,29 @@ class ###Component###ControllerAjax extends JControllerLegacy parent::__construct($config); // make sure all json stuff are set JFactory::getDocument()->setMimeEncoding( 'application/json' ); - JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"'); - JResponse::setHeader("Access-Control-Allow-Origin", "*"); + // get the application + $app = JFactory::getApplication(); + $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); + $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks ###REGISTER_AJAX_TASK### } public function ajax() { + // get the user for later use $user = JFactory::getUser(); + // get the input values $jinput = JFactory::getApplication()->input; + // check if we should return raw + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + // return to a callback function + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { + // get the task $task = $this->getTask(); switch($task) {###AJAX_INPUT_RETURN### @@ -50,10 +59,15 @@ class ###Component###ControllerAjax extends JControllerLegacy } else { - if($callback = $jinput->get('callback', null, 'CMD')) + // return to a callback function + if($callback) { echo $callback."(".json_encode(false).");"; } + elseif($returnRaw) + { + echo json_encode(false); + } else { echo "(".json_encode(false).");"; diff --git a/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php b/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php index 2873aad62..0ddcc119e 100644 --- a/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php +++ b/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php @@ -29,20 +29,29 @@ class ###Component###ControllerAjax extends JControllerLegacy parent::__construct($config); // make sure all json stuff are set JFactory::getDocument()->setMimeEncoding( 'application/json' ); - JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"'); - JResponse::setHeader("Access-Control-Allow-Origin", "*"); + // get the application + $app = JFactory::getApplication(); + $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); + $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks ###REGISTER_SITE_AJAX_TASK### } public function ajax() { + // get the user for later use $user = JFactory::getUser(); + // get the input values $jinput = JFactory::getApplication()->input; + // check if we should return raw + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + // return to a callback function + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { + // get the task $task = $this->getTask(); switch($task) {###AJAX_SITE_INPUT_RETURN### @@ -50,10 +59,16 @@ class ###Component###ControllerAjax extends JControllerLegacy } else { - if($callback = $jinput->get('callback', null, 'CMD')) + // return to a callback function + if($callback) { echo $callback."(".json_encode(false).");"; } + // return raw + elseif($returnRaw) + { + echo json_encode(false); + } else { echo "(".json_encode(false).");"; diff --git a/admin/compiler/joomla_3/ajax.json.php b/admin/compiler/joomla_3/ajax.json.php index 0d168f68d..6883172ef 100644 --- a/admin/compiler/joomla_3/ajax.json.php +++ b/admin/compiler/joomla_3/ajax.json.php @@ -27,8 +27,8 @@ class ###Component###ControllerAjax extends JControllerLegacy parent::__construct($config); // make sure all json stuff are set JFactory::getDocument()->setMimeEncoding( 'application/json' ); - JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"'); - JResponse::setHeader("Access-Control-Allow-Origin", "*"); + JFactory::getApplication()->setHeader('Content-Disposition','attachment;filename="getajax.json"'); + JFactory::getApplication()->setHeader("Access-Control-Allow-Origin", "*"); // load the tasks $this->registerTask('fieldRequired', 'ajax'); } diff --git a/admin/compiler/joomla_3/ajax.php b/admin/compiler/joomla_3/ajax.php index 5beef4772..198a571f4 100644 --- a/admin/compiler/joomla_3/ajax.php +++ b/admin/compiler/joomla_3/ajax.php @@ -60,7 +60,7 @@ class ###Component###ModelAjax extends JModelList $fields = array($name); } } - // load the remaining values to seesion + // load the remaining values to session if(###Component###Helper::checkArray($fields)) { $session->set($form.'_requiredFieldFix', $fields); diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index df2d66761..c6fbccf9b 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -24,8 +24,10 @@ class ComponentbuilderControllerAjax extends JControllerLegacy parent::__construct($config); // make sure all json stuff are set JFactory::getDocument()->setMimeEncoding( 'application/json' ); - JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"'); - JResponse::setHeader("Access-Control-Allow-Origin", "*"); + // get the application + $app = JFactory::getApplication(); + $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); + $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks $this->registerTask('isNew', 'ajax'); $this->registerTask('isRead', 'ajax'); @@ -69,20 +71,26 @@ class ComponentbuilderControllerAjax extends JControllerLegacy public function ajax() { + // get the user for later use $user = JFactory::getUser(); + // get the input values $jinput = JFactory::getApplication()->input; + // check if we should return raw + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + // return to a callback function + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { + // get the task $task = $this->getTask(); switch($task) { case 'isNew': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { @@ -92,7 +100,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -107,10 +115,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -120,7 +132,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'isRead': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { @@ -130,7 +141,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -145,10 +156,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -158,7 +173,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getComponentDetails': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { @@ -168,7 +182,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -183,10 +197,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -196,7 +214,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getCronPath': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $getTypeValue = $jinput->get('getType', NULL, 'WORD'); if($getTypeValue && $user->id != 0) { @@ -206,7 +223,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -221,10 +238,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -234,7 +255,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getJCBpackageInfo': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $urlValue = $jinput->get('url', NULL, 'STRING'); if($urlValue && $user->id != 0) { @@ -244,7 +264,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -259,10 +279,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -272,7 +296,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getCrowdinDetails': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $identifierValue = $jinput->get('identifier', NULL, 'CMD'); $keyValue = $jinput->get('key', NULL, 'ALNUM'); if($identifierValue && $user->id != 0 && $keyValue) @@ -283,7 +306,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -298,10 +321,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -311,7 +338,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getModuleCode': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $dataValue = $jinput->get('data', NULL, 'STRING'); if($dataValue && $user->id != 0) { @@ -321,7 +347,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -336,10 +362,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -349,7 +379,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getClassCode': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); $typeValue = $jinput->get('type', NULL, 'WORD'); if($idValue && $user->id != 0 && $typeValue) @@ -360,7 +389,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -375,10 +404,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -388,7 +421,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getClassCodeIds': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); $typeValue = $jinput->get('type', NULL, 'WORD'); if($idValue && $user->id != 0 && $typeValue) @@ -399,7 +431,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -414,10 +446,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -427,7 +463,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getClassHeaderCode': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); $typeValue = $jinput->get('type', NULL, 'WORD'); if($idValue && $user->id != 0 && $typeValue) @@ -438,7 +473,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -453,10 +488,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -466,7 +505,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'tableColumns': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $tableValue = $jinput->get('table', NULL, 'WORD'); if($tableValue && $user->id != 0) { @@ -476,7 +514,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -491,10 +529,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -504,7 +546,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'fieldSelectOptions': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { @@ -514,7 +555,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -529,10 +570,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -542,7 +587,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getDynamicScripts': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $typeValue = $jinput->get('type', NULL, 'WORD'); if($typeValue && $user->id != 0) { @@ -552,7 +596,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -567,10 +611,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -580,7 +628,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getButton': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $typeValue = $jinput->get('type', NULL, 'WORD'); $sizeValue = $jinput->get('size', NULL, 'INT'); if($typeValue && $user->id != 0 && $sizeValue) @@ -591,7 +638,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -606,10 +653,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -619,7 +670,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getButtonID': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $typeValue = $jinput->get('type', NULL, 'WORD'); $sizeValue = $jinput->get('size', NULL, 'INT'); if($typeValue && $user->id != 0 && $sizeValue) @@ -630,7 +680,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -645,10 +695,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -658,7 +712,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getAjaxDisplay': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $typeValue = $jinput->get('type', NULL, 'WORD'); if($typeValue && $user->id != 0) { @@ -668,7 +721,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -683,10 +736,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -696,7 +753,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getLinked': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $typeValue = $jinput->get('type', NULL, 'ALNUM'); if($typeValue && $user->id != 0) { @@ -706,7 +762,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -721,10 +777,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -734,7 +794,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'checkAliasField': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $typeValue = $jinput->get('type', NULL, 'ALNUM'); if($typeValue && $user->id != 0) { @@ -744,7 +803,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -759,10 +818,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -772,7 +835,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'checkCategoryField': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $typeValue = $jinput->get('type', NULL, 'ALNUM'); if($typeValue && $user->id != 0) { @@ -782,7 +844,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -797,10 +859,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -810,7 +876,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'templateDetails': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', null, 'INT'); if($idValue && $user->id != 0) { @@ -820,7 +885,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -835,10 +900,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -848,7 +917,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getLayoutDetails': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { @@ -858,7 +926,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -873,10 +941,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -886,7 +958,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'dbTableColumns': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $nameValue = $jinput->get('name', NULL, 'WORD'); $asValue = $jinput->get('as', NULL, 'WORD'); $typeValue = $jinput->get('type', NULL, 'INT'); @@ -898,7 +969,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -913,10 +984,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -926,7 +1001,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'viewTableColumns': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); $asValue = $jinput->get('as', NULL, 'WORD'); $typeValue = $jinput->get('type', NULL, 'INT'); @@ -938,7 +1012,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -953,10 +1027,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -966,7 +1044,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getDynamicValues': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); $viewValue = $jinput->get('view', NULL, 'WORD'); if($idValue && $user->id != 0 && $viewValue) @@ -977,7 +1054,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -992,10 +1069,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1005,7 +1086,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'checkFunctionName': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $functioNameValue = $jinput->get('functioName', NULL, 'STRING'); $idValue = $jinput->get('id', NULL, 'INT'); if($functioNameValue && $user->id != 0 && $idValue) @@ -1016,7 +1096,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1031,10 +1111,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1044,7 +1128,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'usedin': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $functioNameValue = $jinput->get('functioName', NULL, 'WORD'); $idValue = $jinput->get('id', NULL, 'INT'); $targetValue = $jinput->get('target', NULL, 'WORD'); @@ -1056,7 +1139,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1071,10 +1154,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1084,7 +1171,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getEditCustomCodeButtons': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { @@ -1094,7 +1180,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1109,10 +1195,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1122,7 +1212,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'placedin': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $placeholderValue = $jinput->get('placeholder', NULL, 'WORD'); $idValue = $jinput->get('id', NULL, 'INT'); $targetValue = $jinput->get('target', NULL, 'WORD'); @@ -1134,7 +1223,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1149,10 +1238,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1162,7 +1255,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'checkPlaceholderName': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); $placeholderNameValue = $jinput->get('placeholderName', NULL, 'STRING'); if($idValue && $user->id != 0 && $placeholderNameValue) @@ -1173,7 +1265,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1188,10 +1280,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1201,7 +1297,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getExistingValidationRuleCode': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $nameValue = $jinput->get('name', NULL, 'WORD'); if($nameValue && $user->id != 0) { @@ -1211,7 +1306,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1226,10 +1321,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1239,7 +1338,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getValidationRulesTable': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { @@ -1249,7 +1347,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1264,10 +1362,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1277,7 +1379,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'checkRuleName': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $nameValue = $jinput->get('name', NULL, 'STRING'); $idValue = $jinput->get('id', NULL, 'INT'); if($nameValue && $user->id != 0 && $idValue) @@ -1288,7 +1389,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1303,10 +1404,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1316,7 +1421,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'fieldTypeProperties': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); if($idValue) { @@ -1326,7 +1430,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1341,10 +1445,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1354,7 +1462,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getFieldPropertyDesc': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $propertyValue = $jinput->get('property', NULL, 'WORD'); $fieldtypeValue = $jinput->get('fieldtype', NULL, 'ALNUM'); if($propertyValue && $user->id != 0 && $fieldtypeValue) @@ -1365,7 +1472,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1380,10 +1487,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1393,7 +1504,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getCodeGlueOptions': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $listfieldValue = $jinput->get('listfield', NULL, 'INT'); $joinfieldsValue = $jinput->get('joinfields', NULL, 'STRING'); $typeValue = $jinput->get('type', NULL, 'INT'); @@ -1406,7 +1516,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1421,10 +1531,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1434,7 +1548,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'snippetDetails': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { @@ -1444,7 +1557,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1459,10 +1572,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1472,7 +1589,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'setSnippetGithub': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $pathValue = $jinput->get('path', NULL, 'STRING'); $statusValue = $jinput->get('status', NULL, 'WORD'); if($pathValue && $user->id != 0 && $statusValue) @@ -1483,7 +1599,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1498,10 +1614,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1511,7 +1631,6 @@ class ComponentbuilderControllerAjax extends JControllerLegacy case 'getSnippets': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $librariesValue = $jinput->get('libraries', NULL, 'STRING'); if($librariesValue && $user->id != 0) { @@ -1521,7 +1640,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -1536,10 +1655,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -1550,10 +1673,15 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } else { - if($callback = $jinput->get('callback', null, 'CMD')) + // return to a callback function + if($callback) { echo $callback."(".json_encode(false).");"; } + elseif($returnRaw) + { + echo json_encode(false); + } else { echo "(".json_encode(false).");"; diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 85f04eb01..5dc92f7ce 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -4344,13 +4344,13 @@ class Interpretation extends Fields . $default['on_field'] . " is an array with values."; $methods .= PHP_EOL . $this->_t(2) . "\$array = (" - . $this->fileContentStatic[$this->hhh - . 'Component' . $this->hhh] - . "Helper::checkJson(\$" - . $default['on_field'] - . ", true)) ? json_decode(\$" - . $default['on_field'] . ",true) : \$" - . $default['on_field'] . ";"; + . $this->fileContentStatic[$this->hhh + . 'Component' . $this->hhh] + . "Helper::checkJson(\$" + . $default['on_field'] + . ", true)) ? json_decode(\$" + . $default['on_field'] . ",true) : \$" + . $default['on_field'] . ";"; $methods .= PHP_EOL . $this->_t(2) . "if (isset(\$array) && " . $this->fileContentStatic[$this->hhh @@ -17900,8 +17900,6 @@ class Interpretation extends Fields $cases .= PHP_EOL . $this->_t(4) . "case '" . $task . "':"; $cases .= PHP_EOL . $this->_t(5) . "try"; $cases .= PHP_EOL . $this->_t(5) . "{"; - $cases .= PHP_EOL . $this->_t(6) - . "\$returnRaw = \$jinput->get('raw', false, 'BOOLEAN');"; foreach ($input[$task] as $string) { $cases .= PHP_EOL . $this->_t(6) . $string; @@ -17936,7 +17934,7 @@ class Interpretation extends Fields } // continue the build $cases .= PHP_EOL . $this->_t(6) - . "if(\$callback = \$jinput->get('callback', null, 'CMD'))"; + . "if(\$callback)"; $cases .= PHP_EOL . $this->_t(6) . "{"; $cases .= PHP_EOL . $this->_t(7) . "echo \$callback . \"(\".json_encode(\$result).\");\";"; @@ -17955,11 +17953,17 @@ class Interpretation extends Fields $cases .= PHP_EOL . $this->_t(5) . "catch(Exception \$e)"; $cases .= PHP_EOL . $this->_t(5) . "{"; $cases .= PHP_EOL . $this->_t(6) - . "if(\$callback = \$jinput->get('callback', null, 'CMD'))"; + . "if(\$callback)"; $cases .= PHP_EOL . $this->_t(6) . "{"; $cases .= PHP_EOL . $this->_t(7) . "echo \$callback.\"(\".json_encode(\$e).\");\";"; $cases .= PHP_EOL . $this->_t(6) . "}"; + $cases .= PHP_EOL . $this->_t(6) + . "elseif(\$returnRaw)"; + $cases .= PHP_EOL . $this->_t(6) . "{"; + $cases .= PHP_EOL . $this->_t(7) + . "echo json_encode(\$e);"; + $cases .= PHP_EOL . $this->_t(6) . "}"; $cases .= PHP_EOL . $this->_t(6) . "else"; $cases .= PHP_EOL . $this->_t(6) . "{"; $cases .= PHP_EOL . $this->_t(7) diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 6bf26ab69..a10d04495 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -864,13 +864,13 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LABEL="Name" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_DESCRIPTION="The name of the list of records in this view" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_HINT="List of Records Name Here" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_LABEL="Name (list of records)
-Naming Conventions" +Naming Conventions" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_MESSAGE="Error! Please add list of records name here." COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_DESCRIPTION="Type null if single record view is not to be set" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_HINT="Single Record Name Here" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_LABEL="Name (single record)
-Naming Conventions" +Naming Conventions" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_MESSAGE="Error! Please add single record name here." COM_COMPONENTBUILDER_ADMIN_VIEW_NEW="A New Admin View" COM_COMPONENTBUILDER_ADMIN_VIEW_NEW_TAB="New Tab" @@ -4278,7 +4278,6 @@ COM_COMPONENTBUILDER_DASHBOARD_FIELDS="Fields

" COM_COMPONENTBUILDER_DASHBOARD_FIELDS_CATID="Categories For
Fields" COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES="Fieldtypes

" COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES_CATID="Categories For
Fieldtypes" -COM_COMPONENTBUILDER_DASHBOARD_FIELD_ADD="Add Field

" COM_COMPONENTBUILDER_DASHBOARD_GET_SNIPPETS="Get Snippets

" COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENTS="Help Documents

" COM_COMPONENTBUILDER_DASHBOARD_IMPORTJCBPACKAGES="Import JCB Packages

" @@ -4663,8 +4662,6 @@ COM_COMPONENTBUILDER_FIELDS_BATCH_USE="Fields Batch Use" COM_COMPONENTBUILDER_FIELDS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch fields" COM_COMPONENTBUILDER_FIELDS_CREATE="Fields Create" COM_COMPONENTBUILDER_FIELDS_CREATE_DESC="Allows the users in this group to create create fields" -COM_COMPONENTBUILDER_FIELDS_DASHBOARD_ADD="Fields Dashboard Add" -COM_COMPONENTBUILDER_FIELDS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of field" COM_COMPONENTBUILDER_FIELDS_DASHBOARD_LIST="Fields Dashboard List" COM_COMPONENTBUILDER_FIELDS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of field" COM_COMPONENTBUILDER_FIELDS_DELETE="Fields Delete" diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini index bc6fe0238..2586687a3 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini @@ -534,8 +534,6 @@ COM_COMPONENTBUILDER_FIELDS_BATCH_USE="Fields Batch Use" COM_COMPONENTBUILDER_FIELDS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch fields" COM_COMPONENTBUILDER_FIELDS_CREATE="Fields Create" COM_COMPONENTBUILDER_FIELDS_CREATE_DESC="Allows the users in this group to create create fields" -COM_COMPONENTBUILDER_FIELDS_DASHBOARD_ADD="Fields Dashboard Add" -COM_COMPONENTBUILDER_FIELDS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of field" COM_COMPONENTBUILDER_FIELDS_DASHBOARD_LIST="Fields Dashboard List" COM_COMPONENTBUILDER_FIELDS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of field" COM_COMPONENTBUILDER_FIELDS_DELETE="Fields Delete" diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index 402e58bb6..95a3c6889 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -25,7 +25,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList $icons = array(); // view groups array $viewGroups = array( - 'main' => array('png.compiler', 'png.joomla_components', 'png.joomla_modules', 'png.joomla_plugins', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=joomla_components&task=joomla_components.smartImport', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_field', 'png.fieldtypes', 'png.fieldtypes.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_fieldtype', 'png.language_translations', 'png.servers', 'png.help_documents') + 'main' => array('png.compiler', 'png.joomla_components', 'png.joomla_modules', 'png.joomla_plugins', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=joomla_components&task=joomla_components.smartImport', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.fields', 'png.fields.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_field', 'png.fieldtypes', 'png.fieldtypes.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_fieldtype', 'png.language_translations', 'png.servers', 'png.help_documents') ); // view access array $viewAccess = array( @@ -114,7 +114,6 @@ class ComponentbuilderModelComponentbuilder extends JModelList 'field.access' => 'field.access', 'fields.submenu' => 'field.submenu', 'fields.dashboard_list' => 'field.dashboard_list', - 'field.dashboard_add' => 'field.dashboard_add', 'fieldtype.create' => 'fieldtype.create', 'fieldtypes.access' => 'fieldtype.access', 'fieldtype.access' => 'fieldtype.access', diff --git a/componentbuilder.xml b/componentbuilder.xml index e213ed676..5c244e2e3 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 27th August, 2021 + 31st August, 2021 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com diff --git a/script.php b/script.php index c859e4694..9fc8f2423 100644 --- a/script.php +++ b/script.php @@ -6631,7 +6631,7 @@ class com_componentbuilderInstallerScript { $rule_length = $db->loadResult(); // Check the size of the rules column - if ($rule_length <= 94400) + if ($rule_length <= 94240) { // Fix the assets table rules column size $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to MEDIUMTEXT by JCB';";