$_REQUEST['params'] = is_string($_REQUEST['params']) ? stripslashes($_REQUEST['params']) : $_REQUEST['params']; } $classFunctionName = $_REQUEST['className'] . '::' . $_REQUEST['functionName']; $result = array(); switch ($classFunctionName) { case 'ShefB24Uploader::checkProject': $result = ShefB24Uploader::checkProject($_REQUEST['params'], $_REQUEST['projectId']); break; case 'ShefB24Uploader::uploadProjectFiles': $result = ShefB24Uploader::uploadProjectFiles($_REQUEST['params'], $_REQUEST['projectId']); break; case 'ShefB24Uploader::compileProject': $result = ShefB24Uploader::compileProject($_REQUEST['params'], $_REQUEST['projectId']); break; case 'ShefBitrix24Lead::insert': $result = ShefBitrix24Lead::insert($_REQUEST['params'], $_REQUEST['projectId']); break; case 'ShefBitrix24Test::testConnect': $result = ShefBitrix24Test::testConnect($_REQUEST['params'], $_REQUEST['projectId']); break; case 'ShefB24Uploader::getVer': $result = array('response' => array('status' => 'ok', 'message' => iLPB24HOSTINGVER), 'values' => array()); break; case 'ShefAutoUpdate::makeUpdate': $result = AutoUpdate::makeUpdate($_REQUEST['params']); break; default: $result = array('response' => array('status' => 'error', 'message' => 'bad name space'), 'values' => array()); break; } Response::setValue('response', $result['response']);
public static function testConnect($params, $projectId) { $conect = ShBitrix24::connectToBitrix24($params, $projectId); if ($conect === true) { $arResult = ShefBitrix24Lead::insertTest($projectId); if (isset($arResult['error']) || intval($arResult['result']) < 1) { $conect = array('response' => array('status' => 'error', 'message' => $arResult['error_description']), 'values' => array()); } else { $conect = array('response' => array('status' => 'ok', 'message' => 'test lead add'), 'values' => array(intval($arResult['result']))); } $b24 = ShBitrix24::getInstance(); $b24->setToken(null, null, null); } return $conect; }