2016-01-30 20:28:43 +00:00
|
|
|
<?php
|
2018-05-18 06:28:27 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
|
|
|
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
|
|
|
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
|
|
|
* @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
// import Joomla controllerform library
|
|
|
|
jimport('joomla.application.component.controller');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Componentbuilder Ajax Controller
|
|
|
|
*/
|
|
|
|
class ComponentbuilderControllerAjax extends JControllerLegacy
|
|
|
|
{
|
|
|
|
public function __construct($config)
|
|
|
|
{
|
|
|
|
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", "*");
|
|
|
|
// 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');
|
2018-05-01 22:17:38 +00:00
|
|
|
$this->registerTask('getJCBpackageInfo', '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');
|
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');
|
2018-03-27 09:57:16 +00:00
|
|
|
$this->registerTask('getExistingValidationRuleCode', 'ajax');
|
|
|
|
$this->registerTask('getValidationRulesTable', 'ajax');
|
|
|
|
$this->registerTask('checkRuleName', 'ajax');
|
2018-01-15 15:54:05 +00:00
|
|
|
$this->registerTask('fieldOptions', 'ajax');
|
2018-04-11 20:05:47 +00:00
|
|
|
$this->registerTask('getFieldPropertyDesc', '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');
|
2018-01-15 15:54:05 +00:00
|
|
|
$this->registerTask('getSnippets', 'ajax');
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax()
|
|
|
|
{
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
$jinput = JFactory::getApplication()->input;
|
|
|
|
// Check Token!
|
|
|
|
$token = JSession::getFormToken();
|
|
|
|
$call_token = $jinput->get('token', 0, 'ALNUM');
|
|
|
|
if($token == $call_token)
|
2017-12-14 23:10:47 +00:00
|
|
|
{
|
2016-01-30 20:28:43 +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
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$noticeValue = $jinput->get('notice', NULL, 'STRING');
|
|
|
|
if($noticeValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->isNew($noticeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'isRead':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$noticeValue = $jinput->get('notice', NULL, 'STRING');
|
|
|
|
if($noticeValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->isRead($noticeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-02-17 18:35:18 +00:00
|
|
|
case 'getComponentDetails':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getComponentDetails($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getCronPath':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$getTypeValue = $jinput->get('getType', NULL, 'WORD');
|
|
|
|
if($getTypeValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getCronPath($getTypeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2018-05-01 22:17:38 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getJCBpackageInfo':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$urlValue = $jinput->get('url', NULL, 'STRING');
|
|
|
|
if($urlValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getJCBpackageInfo($urlValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2017-08-20 17:52:35 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2016-01-30 20:28:43 +00:00
|
|
|
case 'tableColumns':
|
|
|
|
try
|
|
|
|
{
|
2016-04-22 12:03:43 +00:00
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
2016-01-30 20:28:43 +00:00
|
|
|
$tableValue = $jinput->get('table', NULL, 'WORD');
|
|
|
|
if($tableValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getTableColumns($tableValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'fieldSelectOptions':
|
|
|
|
try
|
|
|
|
{
|
2016-04-22 12:03:43 +00:00
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
2016-01-30 20:28:43 +00:00
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getFieldSelectOptions($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$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;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-10-12 23:14:17 +00:00
|
|
|
case 'getButton':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'WORD');
|
2018-03-28 09:46:14 +00:00
|
|
|
$sizeValue = $jinput->get('size', NULL, 'INT');
|
|
|
|
if($typeValue && $sizeValue && $user->id != 0)
|
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;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getButtonID':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'WORD');
|
2017-10-14 15:56:04 +00:00
|
|
|
$sizeValue = $jinput->get('size', NULL, 'INT');
|
|
|
|
if($typeValue && $sizeValue && $user->id != 0)
|
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;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
2018-01-15 15:54:05 +00:00
|
|
|
$typeValue = $jinput->get('type', NULL, 'INT');
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'checkAliasField':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$typeValue = $jinput->get('type', NULL, 'INT');
|
|
|
|
if($typeValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->checkAliasField($typeValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
2017-11-26 00:29:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2016-01-30 20:28:43 +00:00
|
|
|
case 'templateDetails':
|
|
|
|
try
|
|
|
|
{
|
2016-04-22 12:03:43 +00:00
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
2016-01-30 20:28:43 +00:00
|
|
|
$idValue = $jinput->get('id', null, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getTemplateDetails($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
2016-04-22 12:03:43 +00:00
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
2016-01-30 20:28:43 +00:00
|
|
|
$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;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
2016-04-22 12:03:43 +00:00
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
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');
|
|
|
|
if($nameValue && $asValue && $typeValue && $user->id != 0)
|
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;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
2016-04-22 12:03:43 +00:00
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
2016-01-30 20:28:43 +00:00
|
|
|
$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');
|
|
|
|
if($idValue && $asValue && $typeValue && $user->id != 0)
|
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;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
2016-04-22 12:03:43 +00:00
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
2017-10-06 14:53:22 +00:00
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
$viewValue = $jinput->get('view', NULL, 'WORD');
|
|
|
|
if($idValue && $viewValue && $user->id != 0)
|
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;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
2016-04-22 12:03:43 +00:00
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
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');
|
2017-10-06 14:53:22 +00:00
|
|
|
if($functioNameValue && $idValue && $user->id != 0)
|
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;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
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');
|
|
|
|
if($functioNameValue && $idValue && $targetValue && $user->id != 0)
|
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;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getExistingValidationRuleCode':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$nameValue = $jinput->get('name', NULL, 'WORD');
|
|
|
|
if($nameValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getExistingValidationRuleCode($nameValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getValidationRulesTable':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getValidationRulesTable($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'checkRuleName':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$nameValue = $jinput->get('name', NULL, 'STRING');
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($nameValue && $idValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->checkRuleName($nameValue, $idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2018-01-15 15:54:05 +00:00
|
|
|
case 'fieldOptions':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$idValue = $jinput->get('id', NULL, 'INT');
|
|
|
|
if($idValue)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->getFieldOptions($idValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
2018-04-11 20:05:47 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'getFieldPropertyDesc':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$propertyValue = $jinput->get('property', NULL, 'WORD');
|
2018-04-13 15:24:06 +00:00
|
|
|
$fieldtypeValue = $jinput->get('fieldtype', NULL, 'ALNUM');
|
|
|
|
if($propertyValue && $fieldtypeValue && $user->id != 0)
|
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;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
2018-01-15 15:54:05 +00:00
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-11-17 16:18:47 +00:00
|
|
|
case 'setSnippetGithub':
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
|
|
|
$pathValue = $jinput->get('path', NULL, 'STRING');
|
|
|
|
$statusValue = $jinput->get('status', NULL, 'WORD');
|
|
|
|
if($pathValue && $statusValue && $user->id != 0)
|
|
|
|
{
|
|
|
|
$result = $this->getModel('ajax')->setSnippetGithub($pathValue, $statusValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback . "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
elseif($returnRaw)
|
|
|
|
{
|
|
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($result).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception $e)
|
|
|
|
{
|
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
|
|
|
{
|
|
|
|
echo $callback."(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
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
|
|
|
|
{
|
2016-04-22 12:03:43 +00:00
|
|
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
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;
|
|
|
|
}
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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)
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
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
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "(".json_encode($e).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-12-14 23:10:47 +00:00
|
|
|
else
|
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
if($callback = $jinput->get('callback', null, 'CMD'))
|
2017-12-14 23:10:47 +00:00
|
|
|
{
|
2016-06-24 14:23:01 +00:00
|
|
|
echo $callback."(".json_encode(false).");";
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2017-12-14 23:10:47 +00:00
|
|
|
else
|
|
|
|
{
|
2016-01-30 20:28:43 +00:00
|
|
|
echo "(".json_encode(false).");";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|