Commit f3fc38f7 authored by Sergey Antonovich's avatar Sergey Antonovich 🇯🇵

Update class-synergy.php

parent 9ca54cdc
......@@ -15,8 +15,7 @@
self::$dataUUID = $dataUUID;
return $res;
}
public static function getValue()
{
public static function getValue(){
if (!self::$formData) return;
$args = func_get_args();
$data = null;
......@@ -72,8 +71,7 @@
}
}
}
public static function tableData($tableID)
{
public static function tableData($tableID){
if (!self::$formData) return;
$data = self::getValue($tableID);
$convert = array();
......@@ -87,8 +85,7 @@
}
return $convert;
}
public static function save($callback = null)
{
public static function save($callback = null){
if (!self::$formData) return;
self::fixManualTags();
$save = self::api('asforms/data/save', 'POST', array(
......@@ -98,8 +95,7 @@
if ($save['errorCode'] != 13 && $callback) $callback(self::$dataUUID);
return $save;
}
private static function fixManualTags($recursiveIndex = null)
{
private static function fixManualTags($recursiveIndex = null){
if (!self::$formData) return;
if ($recursiveIndex) {
if (!array_key_exists('data', self::$formData['data'][$recursiveIndex])) return;
......@@ -122,13 +118,13 @@
public static function curl($url, $type = 'GET', $params = false, &$data = null){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ($params && strtoupper($type) == 'GET' ? $url .= '?' . http_build_query($params) : $url));
if (stristr($url, 'synergy/rest/api') !== false) {
if (stristr($url, 'synergy/rest/api') !== false){
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, self::$superUser);
}
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
if (strtoupper($type) == 'POST') {
if (strtoupper($type) == 'POST'){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment