Skip to content
Permalink
Browse files
Merge pull request #721 from Zaitsev-ap/patch-1
Update common.class.php в части runScriptSafe
  • Loading branch information
sergejey committed Apr 8, 2020
2 parents baa2e31 + a1f5bae commit 7f9fbe5877dd61695cc5319f2eb0ef2eaf3e37a4
Showing 1 changed file with 11 additions and 9 deletions.
@@ -662,13 +662,15 @@ function runScript($id, $params = '')
return $sc->runScript($id, $params);
}


function runScriptSafe($id, $params = '')
{
$current_call = 'script.' . $id;
$call_stack = array();
if (is_array($params)) {
$current_call.='.'.md5(json_encode($params));
$current_call .= '.' . md5(json_encode($params));
$call_stack = $params['m_c_s'];
}
$call_stack = array();
if (IsSet($_SERVER['REQUEST_URI']) && ($_SERVER['REQUEST_URI'] != '')) {
if (isset($_GET['m_c_s']) && is_array($_GET['m_c_s'])) {
$call_stack = $_GET['m_c_s'];
@@ -679,19 +681,19 @@ function runScriptSafe($id, $params = '')
return 0;
}
}
$call_stack[] = $current_call;

if (!is_array($params)) {
$params = array();
}
if (isSet($_SERVER['REQUEST_URI'])) {

$call_stack[] = $current_call;
$params['m_c_s'] = $call_stack;

if (IsSet($_SERVER['REQUEST_URI']) && ($_SERVER['REQUEST_URI'] != '') && count($call_stack)>1) {
$result = runScript($id,$params);
} else {
$params['m_c_s'] = $call_stack;
if (session_id()) {
$params[session_name()] = session_id();
}
$result = callAPI('/api/script/' . urlencode($id), 'GET', $params);
}
}
return $result;
}

0 comments on commit 7f9fbe5

Please sign in to comment.