2016-01-30 20:28:43 +00:00
|
|
|
<?php
|
2021-03-05 03:08:47 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2022-07-09 15:45:08 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
2022-05-25 08:30:55 +00:00
|
|
|
use Joomla\CMS\MVC\Controller\BaseController;
|
2021-03-05 03:08:47 +00:00
|
|
|
use Joomla\Utilities\ArrayHelper;
|
|
|
|
|
|
|
|
/**
|
2022-05-25 08:30:55 +00:00
|
|
|
* Componentbuilder Ajax Base Controller
|
2021-03-05 03:08:47 +00:00
|
|
|
*/
|
2022-05-25 08:30:55 +00:00
|
|
|
class ComponentbuilderControllerAjax extends BaseController
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
public function __construct($config)
|
|
|
|
{
|
|
|
|
parent::__construct($config);
|
|
|
|
// make sure all json stuff are set
|
|
|
|
JFactory::getDocument()->setMimeEncoding( 'application/json' );
|
2021-08-31 14:00:12 +00:00
|
|
|
// get the application
|
|
|
|
$app = JFactory::getApplication();
|
|
|
|
$app->setHeader('Content-Disposition','attachment;filename="getajax.json"');
|
|
|
|
$app->setHeader('Access-Control-Allow-Origin', '*');
|
2016-01-30 20:28:43 +00:00
|
|
|
// load the tasks
|
2016-10-31 21:47:21 +00:00
|
|
|
$this->registerTask('isNew', 'ajax');
|
|
|
|
$this->registerTask('isRead', 'ajax');
|
2017-02-17 18:35:18 +00:00
|
|
|
$this->registerTask('getComponentDetails', 'ajax');
|
2017-08-20 17:52:35 +00:00
|
|
|
$this->registerTask('getCronPath', 'ajax');
|
2022-07-09 15:16:21 +00:00
|
|
|
$this->registerTask('getWiki', 'ajax');
|
2022-07-09 20:37:56 +00:00
|
|
|
$this->registerTask('getVersion', 'ajax');
|
2018-05-01 22:17:38 +00:00
|
|
|
$this->registerTask('getJCBpackageInfo', 'ajax');
|
2019-05-15 17:39:27 +00:00
|
|
|
$this->registerTask('getCrowdinDetails', 'ajax');
|
2019-12-10 23:18:55 +00:00
|
|
|
$this->registerTask('getModuleCode', 'ajax');
|
2019-07-15 20:00:46 +00:00
|
|
|
$this->registerTask('getClassCode', 'ajax');
|
|
|
|
$this->registerTask('getClassCodeIds', 'ajax');
|
2019-07-19 02:17:15 +00:00
|
|
|
$this->registerTask('getClassHeaderCode', 'ajax');
|
2016-01-30 20:28:43 +00:00
|
|
|
$this->registerTask('tableColumns', 'ajax');
|
|
|
|
$this->registerTask('fieldSelectOptions', 'ajax');
|
2018-01-23 22:05:57 +00:00
|
|
|
$this->registerTask('getDynamicScripts', 'ajax');
|
2017-10-12 23:14:17 +00:00
|
|
|
$this->registerTask('getButton', 'ajax');
|
|
|
|
$this->registerTask('getButtonID', 'ajax');
|
2017-10-26 16:43:51 +00:00
|
|
|
$this->registerTask('getAjaxDisplay', 'ajax');
|
2018-01-15 15:54:05 +00:00
|
|
|
$this->registerTask('getLinked', 'ajax');
|
2018-03-28 09:46:14 +00:00
|
|
|
$this->registerTask('checkAliasField', 'ajax');
|
2021-01-06 10:02:55 +00:00
|
|
|
$this->registerTask('checkCategoryField', 'ajax');
|
2016-01-30 20:28:43 +00:00
|
|
|
$this->registerTask('templateDetails', 'ajax');
|
2017-10-06 14:53:22 +00:00
|
|
|
$this->registerTask('getLayoutDetails', 'ajax');
|
2016-01-30 20:28:43 +00:00
|
|
|
$this->registerTask('dbTableColumns', 'ajax');
|
|
|
|
$this->registerTask('viewTableColumns', 'ajax');
|
2017-10-06 14:53:22 +00:00
|
|
|
$this->registerTask('getDynamicValues', 'ajax');
|
2017-02-13 23:24:38 +00:00
|
|
|
$this->registerTask('checkFunctionName', 'ajax');
|
|
|
|
$this->registerTask('usedin', 'ajax');
|
2019-01-31 21:44:21 +00:00
|
|
|
$this->registerTask('getEditCustomCodeButtons', 'ajax');
|
2019-02-23 13:28:54 +00:00
|
|
|
$this->registerTask('placedin', 'ajax');
|
|
|
|
$this->registerTask('checkPlaceholderName', 'ajax');
|
2018-03-27 09:57:16 +00:00
|
|
|
$this->registerTask('getExistingValidationRuleCode', 'ajax');
|
|
|
|
$this->registerTask('getValidationRulesTable', 'ajax');
|
|
|
|
$this->registerTask('checkRuleName', 'ajax');
|
2020-01-11 16:29:54 +00:00
|
|
|
$this->registerTask('fieldTypeProperties', 'ajax');
|
2018-04-11 20:05:47 +00:00
|
|
|
$this->registerTask('getFieldPropertyDesc', 'ajax');
|
2018-05-24 13:56:56 +00:00
|
|
|
$this->registerTask('getCodeGlueOptions', 'ajax');
|
2022-10-30 22:34:54 +00:00
|
|
|
$this->registerTask('doSearch', 'ajax');
|
|
|
|
$this->registerTask('replaceAll', 'ajax');
|
2022-10-20 14:40:18 +00:00
|
|
|
$this->registerTask('getSearchValue', 'ajax');
|
|
|
|
$this->registerTask('getReplaceValue', 'ajax');
|
|
|
|
$this->registerTask('setValue', 'ajax');
|
2017-10-06 14:53:22 +00:00
|
|
|
$this->registerTask('snippetDetails', 'ajax');
|
2017-11-17 16:18:47 +00:00
|
|
|
$this->registerTask('setSnippetGithub', 'ajax');
|
2021-03-05 03:08:47 +00:00
|
|
|
$this->registerTask('getSnippets', 'ajax');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax()
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
// get the user for later use
|
2021-03-05 03:08:47 +00:00
|
|
|
$user = JFactory::getUser();
|
2021-08-31 14:00:12 +00:00
|
|
|
// get the input values
|
2021-03-05 03:08:47 +00:00
|
|
|
$jinput = JFactory::getApplication()->input;
|
2021-08-31 14:00:12 +00:00
|
|
|
// check if we should return raw
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
// return to a callback function
|
|
|
|
$callback = $jinput->get('callback', null, 'CMD');
|
2021-03-05 03:08:47 +00:00
|
|
|
// Check Token!
|
|
|
|
$token = JSession::getFormToken();
|
|
|
|
$call_token = $jinput->get('token', 0, 'ALNUM');
|
|
|
|
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
// get the task
|
2021-03-05 03:08:47 +00:00
|
|
|
$task = $this->getTask();
|
|
|
|
switch($task)
|
2017-12-14 23:10:47 +00:00
|
|
|
{
|
2016-10-31 21:47:21 +00:00
|
|
|
case 'isNew':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$noticeValue = $jinput->get('notice', NULL, 'STRING');
|
|
|
|
if($noticeValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->isNew($noticeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-10-31 21:47:21 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-10-31 21:47:21 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-10-31 21:47:21 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'isRead':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$noticeValue = $jinput->get('notice', NULL, 'STRING');
|
|
|
|
if($noticeValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->isRead($noticeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-10-31 21:47:21 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-10-31 21:47:21 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-10-31 21:47:21 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-02-17 18:35:18 +00:00
|
|
|
case 'getComponentDetails':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getComponentDetails($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-08-20 17:52:35 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-08-20 17:52:35 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2017-08-20 17:52:35 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getCronPath':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$getTypeValue = $jinput->get('getType', NULL, 'WORD');
|
|
|
|
if($getTypeValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getCronPath($getTypeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-07-09 15:16:21 +00:00
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getWiki':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$nameValue = $jinput->get('name', NULL, 'WORD');
|
|
|
|
if($nameValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getWiki($nameValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-07-09 20:37:56 +00:00
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getVersion':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$versionValue = $jinput->get('version', NULL, 'INT');
|
|
|
|
if($versionValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getVersion($versionValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-08-20 17:52:35 +00:00
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-05-01 22:17:38 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-05-01 22:17:38 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2018-05-01 22:17:38 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getJCBpackageInfo':
|
|
|
|
try
|
|
|
|
{
|
2022-06-02 12:05:34 +00:00
|
|
|
$packageValue = $jinput->get('package', NULL, 'BASE64');
|
|
|
|
if($packageValue && $user->id != 0)
|
2018-05-01 22:17:38 +00:00
|
|
|
{
|
2022-06-02 12:05:34 +00:00
|
|
|
$result = $this->getModel('ajax')->getJCBpackageInfo($packageValue);
|
2018-05-01 22:17:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-02-17 18:35:18 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-02-17 18:35:18 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2017-02-17 18:35:18 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-05-15 17:39:27 +00:00
|
|
|
case 'getCrowdinDetails':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$identifierValue = $jinput->get('identifier', NULL, 'CMD');
|
|
|
|
$keyValue = $jinput->get('key', NULL, 'ALNUM');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($identifierValue && $user->id != 0 && $keyValue)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getCrowdinDetails($identifierValue, $keyValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2019-05-15 17:39:27 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-12-10 23:18:55 +00:00
|
|
|
case 'getModuleCode':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$dataValue = $jinput->get('data', NULL, 'STRING');
|
|
|
|
if($dataValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getModuleCode($dataValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-12-10 23:18:55 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-12-10 23:18:55 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2019-12-10 23:18:55 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-07-15 20:00:46 +00:00
|
|
|
case 'getClassCode':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'WORD');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($idValue && $user->id != 0 && $typeValue)
|
2019-07-15 20:00:46 +00:00
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getClassCode($idValue, $typeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-07-15 20:00:46 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-07-15 20:00:46 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2019-07-15 20:00:46 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getClassCodeIds':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'WORD');
|
2021-10-18 20:12:19 +00:00
|
|
|
$keyValue = $jinput->get('key', 1, 'INT');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($idValue && $user->id != 0 && $typeValue)
|
2019-07-15 20:00:46 +00:00
|
|
|
{
|
2021-10-18 20:12:19 +00:00
|
|
|
$result = $this->getModel('ajax')->getClassCodeIds($idValue, $typeValue, $keyValue);
|
2019-07-19 02:17:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-07-19 02:17:15 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-07-19 02:17:15 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2019-07-19 02:17:15 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getClassHeaderCode':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'WORD');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($idValue && $user->id != 0 && $typeValue)
|
2019-07-19 02:17:15 +00:00
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getClassHeaderCode($idValue, $typeValue);
|
2019-07-15 20:00:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-07-15 20:00:46 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-07-15 20:00:46 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2019-07-15 20:00:46 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2016-01-30 20:28:43 +00:00
|
|
|
case 'tableColumns':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$tableValue = $jinput->get('table', NULL, 'WORD');
|
|
|
|
if($tableValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getTableColumns($tableValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2016-04-22 12:03:43 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'fieldSelectOptions':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getFieldSelectOptions($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2016-04-22 12:03:43 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2018-01-23 22:05:57 +00:00
|
|
|
case 'getDynamicScripts':
|
2016-05-04 04:53:33 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'WORD');
|
|
|
|
if($typeValue && $user->id != 0)
|
|
|
|
{
|
2018-01-23 22:05:57 +00:00
|
|
|
$result = $this->getModel('ajax')->getDynamicScripts($typeValue);
|
2016-05-04 04:53:33 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-05-04 04:53:33 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-05-04 04:53:33 +00:00
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-05-04 04:53:33 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-05-04 04:53:33 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-05-04 04:53:33 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-12 23:14:17 +00:00
|
|
|
case 'getButton':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'WORD');
|
2018-03-28 09:46:14 +00:00
|
|
|
$sizeValue = $jinput->get('size', NULL, 'INT');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($typeValue && $user->id != 0 && $sizeValue)
|
2017-10-12 23:14:17 +00:00
|
|
|
{
|
2018-03-28 09:46:14 +00:00
|
|
|
$result = $this->getModel('ajax')->getButton($typeValue, $sizeValue);
|
2017-10-12 23:14:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-10-12 23:14:17 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-10-12 23:14:17 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2017-10-12 23:14:17 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getButtonID':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'WORD');
|
2017-10-14 15:56:04 +00:00
|
|
|
$sizeValue = $jinput->get('size', NULL, 'INT');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($typeValue && $user->id != 0 && $sizeValue)
|
2017-10-12 23:14:17 +00:00
|
|
|
{
|
2017-10-14 15:56:04 +00:00
|
|
|
$result = $this->getModel('ajax')->getButtonID($typeValue, $sizeValue);
|
2017-10-14 03:37:18 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-10-14 03:37:18 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-10-14 03:37:18 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2017-10-14 03:37:18 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-26 16:43:51 +00:00
|
|
|
case 'getAjaxDisplay':
|
2017-10-14 03:37:18 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'WORD');
|
|
|
|
if($typeValue && $user->id != 0)
|
|
|
|
{
|
2017-10-26 16:43:51 +00:00
|
|
|
$result = $this->getModel('ajax')->getAjaxDisplay($typeValue);
|
2017-10-12 23:14:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-10-12 23:14:17 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-10-12 23:14:17 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2017-10-12 23:14:17 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2018-01-15 15:54:05 +00:00
|
|
|
case 'getLinked':
|
2017-11-26 00:29:08 +00:00
|
|
|
try
|
|
|
|
{
|
2019-12-10 23:18:55 +00:00
|
|
|
$typeValue = $jinput->get('type', NULL, 'ALNUM');
|
2018-01-15 15:54:05 +00:00
|
|
|
if($typeValue && $user->id != 0)
|
2017-11-26 00:29:08 +00:00
|
|
|
{
|
2018-01-15 15:54:05 +00:00
|
|
|
$result = $this->getModel('ajax')->getLinked($typeValue);
|
2017-11-26 00:29:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-11-26 00:29:08 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
2018-03-28 09:46:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-03-28 09:46:14 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2018-03-28 09:46:14 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'checkAliasField':
|
|
|
|
try
|
|
|
|
{
|
2019-12-10 23:18:55 +00:00
|
|
|
$typeValue = $jinput->get('type', NULL, 'ALNUM');
|
2018-03-28 09:46:14 +00:00
|
|
|
if($typeValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->checkAliasField($typeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-03-28 09:46:14 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
2021-01-06 10:02:55 +00:00
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2021-01-06 10:02:55 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2021-01-06 10:02:55 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'checkCategoryField':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'ALNUM');
|
|
|
|
if($typeValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->checkCategoryField($typeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2021-01-06 10:02:55 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
2018-03-28 09:46:14 +00:00
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
2017-11-26 00:29:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-11-26 00:29:08 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2017-11-26 00:29:08 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2016-01-30 20:28:43 +00:00
|
|
|
case 'templateDetails':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', null, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getTemplateDetails($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2016-04-22 12:03:43 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-06 14:53:22 +00:00
|
|
|
case 'getLayoutDetails':
|
2016-01-30 20:28:43 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$result = $this->getModel('ajax')->getLayoutDetails($idValue);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2016-04-22 12:03:43 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-06 14:53:22 +00:00
|
|
|
case 'dbTableColumns':
|
2016-01-30 20:28:43 +00:00
|
|
|
try
|
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$nameValue = $jinput->get('name', NULL, 'WORD');
|
|
|
|
$asValue = $jinput->get('as', NULL, 'WORD');
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'INT');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($nameValue && $user->id != 0 && $asValue && $typeValue)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$result = $this->getModel('ajax')->getDbTableColumns($nameValue, $asValue, $typeValue);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2016-04-22 12:03:43 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-06 14:53:22 +00:00
|
|
|
case 'viewTableColumns':
|
2016-01-30 20:28:43 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
2017-10-06 14:53:22 +00:00
|
|
|
$asValue = $jinput->get('as', NULL, 'WORD');
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'INT');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($idValue && $user->id != 0 && $asValue && $typeValue)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$result = $this->getModel('ajax')->getViewTableColumns($idValue, $asValue, $typeValue);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2016-04-22 12:03:43 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-06 14:53:22 +00:00
|
|
|
case 'getDynamicValues':
|
2016-01-30 20:28:43 +00:00
|
|
|
try
|
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
$viewValue = $jinput->get('view', NULL, 'WORD');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($idValue && $user->id != 0 && $viewValue)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$result = $this->getModel('ajax')->getDynamicValues($idValue, $viewValue);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2016-04-22 12:03:43 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-06 14:53:22 +00:00
|
|
|
case 'checkFunctionName':
|
2016-01-30 20:28:43 +00:00
|
|
|
try
|
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$functioNameValue = $jinput->get('functioName', NULL, 'STRING');
|
2016-01-30 20:28:43 +00:00
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($functioNameValue && $user->id != 0 && $idValue)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$result = $this->getModel('ajax')->checkFunctionName($functioNameValue, $idValue);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2016-04-22 12:03:43 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-06 14:53:22 +00:00
|
|
|
case 'usedin':
|
2017-02-13 23:24:38 +00:00
|
|
|
try
|
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$functioNameValue = $jinput->get('functioName', NULL, 'WORD');
|
2017-02-13 23:24:38 +00:00
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
2017-10-06 14:53:22 +00:00
|
|
|
$targetValue = $jinput->get('target', NULL, 'WORD');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($functioNameValue && $user->id != 0 && $idValue && $targetValue)
|
2017-02-13 23:24:38 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$result = $this->getModel('ajax')->usedin($functioNameValue, $idValue, $targetValue);
|
2017-02-13 23:24:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-02-13 23:24:38 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
2018-03-27 09:57:16 +00:00
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-03-27 09:57:16 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2018-03-27 09:57:16 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-01-31 21:44:21 +00:00
|
|
|
case 'getEditCustomCodeButtons':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getEditCustomCodeButtons($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-01-31 21:44:21 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-01-31 21:44:21 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2019-01-31 21:44:21 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-02-23 13:28:54 +00:00
|
|
|
case 'placedin':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$placeholderValue = $jinput->get('placeholder', NULL, 'WORD');
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
$targetValue = $jinput->get('target', NULL, 'WORD');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($placeholderValue && $user->id != 0 && $idValue && $targetValue)
|
2019-02-23 13:28:54 +00:00
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->placedin($placeholderValue, $idValue, $targetValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-02-23 13:28:54 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-02-23 13:28:54 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2019-02-23 13:28:54 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'checkPlaceholderName':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
$placeholderNameValue = $jinput->get('placeholderName', NULL, 'STRING');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($idValue && $user->id != 0 && $placeholderNameValue)
|
2019-02-23 13:28:54 +00:00
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->checkPlaceholderName($idValue, $placeholderNameValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-02-23 13:28:54 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2019-02-23 13:28:54 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2019-02-23 13:28:54 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2018-03-27 09:57:16 +00:00
|
|
|
case 'getExistingValidationRuleCode':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$nameValue = $jinput->get('name', NULL, 'WORD');
|
|
|
|
if($nameValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getExistingValidationRuleCode($nameValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-03-27 09:57:16 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-03-27 09:57:16 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2018-03-27 09:57:16 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getValidationRulesTable':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getValidationRulesTable($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-03-27 09:57:16 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-03-27 09:57:16 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2018-03-27 09:57:16 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'checkRuleName':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$nameValue = $jinput->get('name', NULL, 'STRING');
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($nameValue && $user->id != 0 && $idValue)
|
2018-03-27 09:57:16 +00:00
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->checkRuleName($nameValue, $idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-03-27 09:57:16 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
2017-02-13 23:24:38 +00:00
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-02-13 23:24:38 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2017-02-13 23:24:38 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2020-01-11 16:29:54 +00:00
|
|
|
case 'fieldTypeProperties':
|
2018-01-15 15:54:05 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue)
|
|
|
|
{
|
2020-01-11 16:29:54 +00:00
|
|
|
$result = $this->getModel('ajax')->getFieldTypeProperties($idValue);
|
2018-01-15 15:54:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-01-15 15:54:05 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-04-11 20:05:47 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2018-04-11 20:05:47 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getFieldPropertyDesc':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$propertyValue = $jinput->get('property', NULL, 'WORD');
|
2018-04-13 15:24:06 +00:00
|
|
|
$fieldtypeValue = $jinput->get('fieldtype', NULL, 'ALNUM');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($propertyValue && $user->id != 0 && $fieldtypeValue)
|
2018-04-11 20:05:47 +00:00
|
|
|
{
|
2018-04-13 15:24:06 +00:00
|
|
|
$result = $this->getModel('ajax')->getFieldPropertyDesc($propertyValue, $fieldtypeValue);
|
2018-04-11 20:05:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-04-11 20:05:47 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-05-24 13:56:56 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2018-05-24 13:56:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getCodeGlueOptions':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$listfieldValue = $jinput->get('listfield', NULL, 'INT');
|
|
|
|
$joinfieldsValue = $jinput->get('joinfields', NULL, 'STRING');
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'INT');
|
|
|
|
$areaValue = $jinput->get('area', NULL, 'INT');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($listfieldValue && $user->id != 0 && $joinfieldsValue && $typeValue && $areaValue)
|
2018-05-24 13:56:56 +00:00
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getCodeGlueOptions($listfieldValue, $joinfieldsValue, $typeValue, $areaValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-05-24 13:56:56 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2022-09-14 15:40:02 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2022-10-30 22:34:54 +00:00
|
|
|
case 'doSearch':
|
2022-09-14 15:40:02 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
|
|
|
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
|
|
|
|
$match_caseValue = $jinput->get('match_case', 0, 'INT');
|
|
|
|
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
|
|
|
|
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
|
|
|
|
$component_idValue = $jinput->get('component_id', 0, 'INT');
|
|
|
|
if($table_nameValue && $user->id != 0 && $search_valueValue)
|
|
|
|
{
|
2022-10-30 22:34:54 +00:00
|
|
|
$result = $this->getModel('ajax')->doSearch($table_nameValue, $search_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
|
2022-09-14 15:40:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2022-10-30 22:34:54 +00:00
|
|
|
case 'replaceAll':
|
2022-09-14 15:40:02 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
|
|
|
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
|
|
|
|
$replace_valueValue = $jinput->get('replace_value', NULL, 'RAW');
|
|
|
|
$match_caseValue = $jinput->get('match_case', 0, 'INT');
|
|
|
|
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
|
|
|
|
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
|
|
|
|
$component_idValue = $jinput->get('component_id', 0, 'INT');
|
|
|
|
if($table_nameValue && $user->id != 0 && $search_valueValue)
|
|
|
|
{
|
2022-10-30 22:34:54 +00:00
|
|
|
$result = $this->getModel('ajax')->replaceAll($table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
|
2022-09-14 15:40:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2022-10-20 14:40:18 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getSearchValue':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
|
|
|
|
$row_idValue = $jinput->get('row_id', NULL, 'INT');
|
|
|
|
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
|
|
|
if($field_nameValue && $user->id != 0 && $row_idValue && $table_nameValue)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getSearchValue($field_nameValue, $row_idValue, $table_nameValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getReplaceValue':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
|
|
|
|
$row_idValue = $jinput->get('row_id', NULL, 'INT');
|
|
|
|
$line_nrValue = $jinput->get('line_nr', 0, 'STRING');
|
|
|
|
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
|
|
|
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
|
|
|
|
$replace_valueValue = $jinput->get('replace_value', NULL, 'RAW');
|
|
|
|
$match_caseValue = $jinput->get('match_case', 0, 'INT');
|
|
|
|
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
|
|
|
|
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
|
|
|
|
if($field_nameValue && $user->id != 0 && $row_idValue && $table_nameValue && $search_valueValue)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getReplaceValue($field_nameValue, $row_idValue, $line_nrValue, $table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'setValue':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$valueValue = $jinput->get('value', NULL, 'RAW');
|
|
|
|
$row_idValue = $jinput->get('row_id', NULL, 'INT');
|
|
|
|
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
|
|
|
|
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
|
|
|
if($valueValue && $user->id != 0 && $row_idValue && $field_nameValue && $table_nameValue)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->setValue($valueValue, $row_idValue, $field_nameValue, $table_nameValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback)
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2018-05-24 13:56:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2018-01-15 15:54:05 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2018-01-15 15:54:05 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-06 14:53:22 +00:00
|
|
|
case 'snippetDetails':
|
2017-02-13 23:24:38 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
2017-10-06 14:53:22 +00:00
|
|
|
if($idValue && $user->id != 0)
|
2017-02-13 23:24:38 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$result = $this->getModel('ajax')->getSnippetDetails($idValue);
|
2017-02-13 23:24:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-02-13 23:24:38 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-02-13 23:24:38 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2017-02-13 23:24:38 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-11-17 16:18:47 +00:00
|
|
|
case 'setSnippetGithub':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$pathValue = $jinput->get('path', NULL, 'STRING');
|
|
|
|
$statusValue = $jinput->get('status', NULL, 'WORD');
|
2019-08-15 14:26:46 +00:00
|
|
|
if($pathValue && $user->id != 0 && $statusValue)
|
2017-11-17 16:18:47 +00:00
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->setSnippetGithub($pathValue, $statusValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-11-17 16:18:47 +00:00
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2017-11-17 16:18:47 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2017-11-17 16:18:47 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2018-01-15 15:54:05 +00:00
|
|
|
case 'getSnippets':
|
2016-01-30 20:28:43 +00:00
|
|
|
try
|
|
|
|
{
|
2018-01-15 15:54:05 +00:00
|
|
|
$librariesValue = $jinput->get('libraries', NULL, 'STRING');
|
|
|
|
if($librariesValue && $user->id != 0)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2018-01-15 15:54:05 +00:00
|
|
|
$result = $this->getModel('ajax')->getSnippets($librariesValue);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback . "(".json_encode($result).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2016-04-22 12:03:43 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
if($callback)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode($e).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($e);
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
2021-03-05 03:08:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-08-31 14:00:12 +00:00
|
|
|
// return to a callback function
|
|
|
|
if($callback)
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode(false).");";
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode(false);
|
|
|
|
}
|
2021-03-05 03:08:47 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode(false).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|