if ($do_on_click_new != 'show_url') { $ext_url_new = ''; } if ($do_on_click_new != 'run_code') { $code_new = ''; } $state_rec['CODE'] = $code_new; $state_rec['SCRIPT_ID'] = $script_id_new; $state_rec['MENU_ITEM_ID'] = $menu_item_id_new; $state_rec['ACTION_OBJECT'] = $action_object_new; $state_rec['ACTION_METHOD'] = $action_method_new; $state_rec['HOMEPAGE_ID'] = (int) $homepage_id_new; $state_rec['OPEN_SCENE_ID'] = (int) $open_scene_id_new; $state_rec['EXT_URL'] = $ext_url_new; if ($state_rec['CONDITION_ADVANCED']) { $errors = php_syntax_error($state_rec['CONDITION_ADVANCED']); if ($errors) { $state_rec['CONDITION_ADVANCED'] = ''; } } $state_rec['SWITCH_SCENE'] = (int) $switch_scene_new; if ($state_rec['ID']) { SQLUpdate('elm_states', $state_rec); } else { $state_rec['ID'] = SQLInsert('elm_states', $state_rec); $state_id = $state_rec['ID']; } } elseif ($element['TYPE'] == 'container') { $state_rec['TITLE'] = 'default'; $state_rec['ELEMENT_ID'] = $element['ID']; $state_rec['TITLE'] = $state_title_new;
$ok = 1; //updating 'HOSTNAME' (varchar) global $title; $rec['TITLE'] = $title; global $code; $rec['CODE'] = $code; global $run_type; if ($run_type == 'script') { global $script_id; $rec['SCRIPT_ID'] = $script_id; } else { $rec['SCRIPT_ID'] = 0; } if ($rec['CODE'] != '' && $run_type == 'code') { //echo $content; $errors = php_syntax_error($code); if ($errors) { $out['ERR_CODE'] = 1; $out['ERRORS'] = nl2br($errors); $ok = 0; } } //updating 'ONLINE_INTERVAL' (int) global $online_interval; $rec['ONLINE_INTERVAL'] = (int) $online_interval; //UPDATING RECORD if ($ok) { $rec['STATUS'] = 0; $rec['CHECK_LATEST'] = ''; $rec['CHECK_NEXT'] = date('Y-m-d H:i:s'); if ($rec['ID']) {
if ($errors) { $out['ERR_CODE_ONLINE'] = 1; $out['ERRORS_ONLINE'] = nl2br($errors); $ok = 0; } } global $run_type_offline; if ($run_type_offline == 'script') { global $script_id_offline; $rec['SCRIPT_ID_OFFLINE'] = $script_id_offline; } else { $rec['SCRIPT_ID_OFFLINE'] = 0; } if ($rec['CODE_OFFLINE'] != '' && $run_type_offline == 'code') { //echo $content; $errors = php_syntax_error($code_offline); if ($errors) { $out['ERR_CODE_OFFLINE'] = 1; $out['ERRORS_OFFLINE'] = nl2br($errors); $ok = 0; } } //updating 'OFFLINE_INTERVAL' (int) global $offline_interval; $rec['OFFLINE_INTERVAL'] = (int) $offline_interval; //updating 'ONLINE_INTERVAL' (int) global $online_interval; $rec['ONLINE_INTERVAL'] = (int) $online_interval; //UPDATING RECORD if ($ok) { $rec['STATUS'] = 0;
global $linked_property; $rec['LINKED_PROPERTY']=trim($linked_property); global $onchange_object; $rec['ONCHANGE_OBJECT']=trim($onchange_object); global $onchange_method; $rec['ONCHANGE_METHOD']=trim($onchange_method); global $script_id; $rec['SCRIPT_ID']=$script_id; global $code; $rec['CODE']=$code; if ($rec['CODE']!='') { //echo $content; $errors=php_syntax_error($rec['CODE']); if ($errors) { $out['ERR_CODE']=1; $out['ERRORS']=nl2br($errors); $ok=0; } } } //updating 'COMMAND' (varchar) global $command; $rec['COMMAND']=$command; global $window; $rec['WINDOW']=$window;
/** * usbdevices edit/add * * @access public */ function edit_usbdevices(&$out, $id) { $rec = SQLSelectOne("SELECT * FROM usbdevices WHERE ID='" . (int) $id . "'"); if ($this->mode == 'update') { global $title; global $user_id; global $script; $rec['TITLE'] = $title; $rec['SCRIPT'] = trim($script); global $run_type; if ($run_type == 'script') { global $script_id; $rec['SCRIPT_ID'] = $script_id; } else { $rec['SCRIPT_ID'] = 0; } if ($rec['SCRIPT'] != '' && $run_type == 'code') { //echo $content; $errors = php_syntax_error($rec['SCRIPT']); if ($errors) { $out['ERR_SCRIPT'] = 1; $out['ERRORS'] = nl2br($errors); $ok = 0; } } $rec['USER_ID'] = $user_id; SQLUpdate('usbdevices', $rec); $this->redirect("?"); } $rec['LOG'] = nl2br($rec['LOG']); outHash($rec, $out); $out['USERS'] = SQLSelect("SELECT * FROM users ORDER BY NAME"); $out['SCRIPTS'] = SQLSelect("SELECT ID, TITLE FROM scripts ORDER BY TITLE"); }
global $code; global $call_parent; global $run_type; $my_meth['CODE'] = $code; $my_meth['CALL_PARENT'] = $call_parent; $my_meth['TITLE'] = $method['TITLE']; $my_meth['OBJECT_ID'] = $rec['ID']; if ($run_type == 'script') { global $script_id; $my_meth['SCRIPT_ID'] = $script_id; } else { $my_meth['SCRIPT_ID'] = 0; } if ($run_type == 'code' && $my_meth['CODE'] != '') { //echo $content; $errors = php_syntax_error($my_meth['CODE']); if ($errors) { $out['ERR_CODE'] = 1; $out['ERRORS'] = nl2br($errors); $ok = 0; } $out['CODE'] = $my_meth['CODE']; } if ($ok) { if ($my_meth['ID']) { SQLUpdate('methods', $my_meth); } else { $my_meth['ID'] = SQLInsert('methods', $my_meth); } $out['OK'] = 1; }
/** * Ajax function php syntax check */ function PortaMx_PHPsyntax($data) { global $context, $boarddir; $line = '<img onclick="Hide_SyntaxCheck(this.parentNode)" style="padding-left:10px;cursor:pointer;" alt="close" src="' . $context['pmx_imageurl'] . 'cross.png" class="pmxright" />'; // call the syntaxCheck $result = php_syntax_error($data); // setup result if (empty($result)) { $line .= '<b>No syntax errors detected.</b>'; } else { $errline = empty($result[1]) ? '1' : $result[1]; $line .= '<b>' . $result[0] . ' on line: ' . $errline . '</b>'; $line .= ' <img style="vertical-align:-2px;width:14px;height:14px;cursor:pointer;" onclick="php_showerrline(\'@elm@\', ' . $errline . ')" src="' . $context['pmx_imageurl'] . 'opt_nofilter.png" alt="*" title="' . $errline . '" />'; } return $line .= '<br />'; }
global $timeout; $rec['TIMEOUT'] = (int) $timeout; global $is_last; $rec['IS_LAST'] = (int) $is_last; global $priority; $rec['PRIORITY'] = (int) $priority; global $skipsystem; $rec['SKIPSYSTEM'] = (int) $skipsystem; global $onetime; $rec['ONETIME'] = (int) $onetime; global $timeout_context_id; $rec['TIMEOUT_CONTEXT_ID'] = (int) $timeout_context_id; global $timeout_script; if ($timeout_script != '') { $rec['TIMEOUT_SCRIPT'] = $timeout_script; $errors = php_syntax_error($rec['TIMEOUT_SCRIPT']); if ($errors) { $out['ERR_TIMEOUT_SCRIPT'] = 1; $out['ERRORS_TIMEOUT_SCRIPT'] = nl2br($errors); $ok = 0; } } else { $rec['TIMEOUT_SCRIPT'] = ''; } $rec['PARENT_ID'] = (int) $parent_id; if ($rec['PATTERN_TYPE'] == 1) { $rec['PARENT_ID'] = 0; global $linked_object; $rec['LINKED_OBJECT'] = $linked_object; global $linked_property; $rec['LINKED_PROPERTY'] = $linked_property;
$rec['SCRIPT']=trim($script); global $run_type; if ($run_type=='script') { global $script_id; $rec['SCRIPT_ID']=$script_id; } else { $rec['SCRIPT_ID']=0; } if ($rec['SCRIPT']!='' && $run_type=='code') { //echo $content; $errors=php_syntax_error($rec['SCRIPT']); if ($errors) { $out['ERR_SCRIPT']=1; $out['ERRORS']=nl2br($errors); $ok=0; } } //updating 'TIME_LIMIT' (int, required) global $time_limit; $rec['TIME_LIMIT']=(int)$time_limit; /* if (!$rec['TIME_LIMIT']) { $out['ERR_TIME_LIMIT']=1; $ok=0; }