function compile_statement($options) { $child = del($options, 'chainChild'); $cond = $this->condition->compile($options, LEVEL_PAREN); $options['indent'] .= TAB; $body = $this->ensure_block($this->body)->compile($options); if ($body) { $body = "\n{$body}\n{$this->tab}"; } $if_part = "if ({$cond}) {{$body}}"; if (!$child) { $if_part = $this->tab . $if_part; } if (!$this->else_body) { return $if_part; } $ret = $if_part . ' else '; if ($this->is_chain()) { $options['indent'] = $this->tab; $options['chainChild'] = TRUE; $ret .= $this->else_body->unwrap()->compile($options, LEVEL_TOP); } else { $ret .= "{\n" . $this->else_body->compile($options, LEVEL_TOP) . "\n{$this->tab}}"; } return $ret; }
function compile_statement($options) { $child = del($options, 'chainChild'); $exeq = del($options, 'isExistentialEquals'); if ($exeq) { return yy('If', $this->condition->invert(), $this->else_body_node(), array('type' => 'if'))->compile($options); } $cond = $this->condition->compile($options, LEVEL_PAREN); $options['indent'] .= TAB; $body = $this->ensure_block($this->body); $if_part = "if ({$cond}) {\n" . $body->compile($options) . "\n{$this->tab}}"; if (!$child) { $if_part = $this->tab . $if_part; } if (!$this->else_body) { return $if_part; } $ret = $if_part . ' else '; if ($this->is_chain()) { $options['indent'] = $this->tab; $options['chainChild'] = TRUE; $ret .= $this->else_body->unwrap()->compile($options, LEVEL_TOP); } else { $ret .= "{\n" . $this->else_body->compile($options, LEVEL_TOP) . "\n{$this->tab}}"; } return $ret; }
function copy_dhcps4($from, $to) { set($to . "/start", query($from . "/start")); set($to . "/end", query($from . "/end")); set($to . "/domain", query($from . "/domain")); set($to . "/leasetime", query($from . "/leasetime")); set($to . "/router", query($from . "/router")); set($to . "/broadcast", query($from . "/broadcast")); //for netbios set($to . "/netbios/active", query($from . "/netbios/active")); set($to . "/netbios/learnfromwan", query($from . "/netbios/learnfromwan")); set($to . "/netbios/scope", query($from . "/netbios/scope")); set($to . "/netbios/ntype", query($from . "/netbios/ntype")); del($to . "/dns"); del($to . "/wins"); del($to . "/staticleases"); $cnt = query($from . "/dns/count"); set($to . "/dns/count", $cnt); if ($cnt > 0) { copy_entry($from . "/dns", $to . "/dns", $cnt); } $cnt = query($from . "/wins/count"); set($to . "/wins/count", $cnt); if ($cnt > 0) { copy_entry($from . "/wins", $to . "/wins", $cnt); } mov($from . "/staticleases", $to); }
function setup_mdns($uid, $port, $srvname, $srvcfg) { $dirty = 0; $stsp = XNODE_getpathbytarget("/runtime/services/mdnsresponder", "server", "uid", $uid, 0); if ($stsp == "") { if ($port != "0") { $dirty++; $stsp = XNODE_getpathbytarget("/runtime/services/mdnsresponder", "server", "uid", $uid, 1); set($stsp . "/srvname", $srvname); set($stsp . "/port", $port); set($stsp . "/srvcfg", $srvcfg); } } else { if ($port == "0") { $dirty++; del($stsp); } else { if (query($stsp . "/srvname") != $srvname) { $dirty++; set($stsp . "/srvname", $srvname); } if (query($stsp . "/port") != $port) { $dirty++; set($stsp . "/port", $port); } if (query($stsp . "/srvcfg") != $srvcfg) { $dirty++; set($stsp . "/srvcfg", $srvcfg); } } } return $dirty; }
function exe_ouside_cmd($cmd) { $ext_node = "/runtime/webaccess/ext_node"; setattr($ext_node, "get", $cmd); get("x", $ext_node); del($ext_node); }
function delAll($delAll) { $result = query($delAll); foreach ($result as $r) { del($r, false); } alert('删除成功'); }
function set($name, $value = false) { \cf\session::open(); if ($value) { \cf\session::set($name, $value); } else { del($name); } }
function del($dirname) { if (!is_dir($dirname)) { return false; } foreach (glob($dirname . '/*') as $v) { is_dir($v) ? del($v) : unlink($v); } return rmdir($dirname); }
function set($uid, $ts) { global $sched; del($uid); $sched[1][$uid] = $ts; if (!array_key_exists($ts, $sched[0])) { $sched[0][$ts] = array(); } $sched[0][$ts][] = $uid; }
function shift_entry($total, $base) { while ($total > 0) { $f_idx = $total - 1; $to_idx = $total; del($base . "entry:" . $to_idx . "/date"); del($base . "entry:" . $to_idx . "/time"); del($base . "entry:" . $to_idx . "/domain"); movc($base . "entry:" . $f_idx, $base . "entry:" . $to_idx); $total = $total - 1; } }
function del($parent) { $result = mysql_query("select id from wp_structure where parent={$parent}"); if (mysql_num_rows($result)) { while ($row = mysql_fetch_array($result)) { del($row['id']); } } //echo "delete from wp_structure where parent=$parent and id != 191063".'<br>'; mysql_query("delete from wp_structure where parent={$parent}"); mysql_query("delete from wp_structure where id={$parent}"); }
function del($s) { if (scandir($s)) { $var = scandir($s); for ($i = 2; $i < sizeof($var); $i++) { del($s . "/" . $var[$i]); } rmdir($s); } else { unlink($s); } }
function del($pid) { $public_function = new public_function(); $sql = "select * from blog_menu where menu_pid='{$pid}'"; $delsql = "delete from blog_menu where menu_id='{$pid}'"; $result = $public_function->getresult($sql); $num = $public_function->getnum($result); for ($i = 0; $i < $num; $i++) { $array = $public_function->getarray($result); del($array['menu_id']); } $result1 = $public_function->getresult($delsql); echo "<script>location.href='../add_new_menu.php?'</script>"; }
function edit($act_as_admin) { global $del_x, $cancel, $sess, $ok_edit; if (isset($ok_edit)) { proceed($act_as_admin); } elseif (isset($cancel)) { cancel(); } else { del($act_as_admin); } /*$sess->unregister("mytrail"); $sess->unregister("action"); $sess->unregister("thislink"); */ }
public function responseMsg() { //get post data, May be due to the different environments $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; //extract post data if (!empty($postStr)) { $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); $fromUsername = $postObj->FromUserName; $toUsername = $postObj->ToUserName; $keyword = trim($postObj->Content); $time = time(); //查询网站内容,并赋值 //初始化curl $ch = curl_init() or die(curl_error()); //设置URL参数 curl_setopt($ch, CURLOPT_URL, "http://122.226.139.162:9090/oa/cms/"); //要求CURL返回数据 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //执行请求 $result = curl_exec($ch) or die(curl_error()); //取得返回的结果,并显示 //echo $result; //echo curl_error($ch); //关闭CURL curl_close($ch); $pa = '%<div class="flow_top"*?>(.*?)<div class="flow_bottom">%si'; preg_match_all($pa, $result, $match); $result = $match[1]; $data = array(); foreach ($result as $val) { $after = pregstring($val); $data .= $after . ' '; } // $lastresult=del($data).$today; // echo($data); $textTpl = "<xml> \n <ToUserName><![CDATA[%s]]></ToUserName> \n <FromUserName><![CDATA[%s]]></FromUserName> \n <CreateTime>%s</CreateTime> \n <MsgType><![CDATA[%s]]></MsgType> \n<Content><![CDATA[医院最新公告\n %s END]]></Content> \n <FuncFlag>0</FuncFlag> \n </xml>"; if (!empty($postStr)) { $msgType = "text"; $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, del($data)); echo $resultStr; } else { echo "none"; } } else { echo "none"; exit; } }
function del(&$array, $recursive, $i) { if (array_key_exists($recursive[$i], $array)) { $y = $i + 1; if ($y == count($recursive)) { unset($array[$recursive[$i]]); return true; } elseif (is_array($array[$i])) { $i++; del($array[$i], $recursive, $i); } else { return false; // no need to continue farther } } }
function doit() { global $sess, $kat, $mytrail, $create, $txt_title, $txt_description, $ok, $cancel, $HTTP_POST_VARS; if (isset($cancel)) { cancel(); exit; } elseif (isset($kat)) { create($kat, $txt_title, $txt_description); exit; } elseif (isset($ok)) { edit($mytrail, $txt_description, $txt_title, false, isset($HTTP_POST_VARS['field_admin_do'])); exit; } elseif ($HTTP_POST_VARS['ok'] == "" and $HTTP_POST_VARS['cancel'] == "" and $HTTP_POST_VARS['create'] == "") { del($mytrail['id'], isset($HTTP_POST_VARS['field_admin_do'])); exit; } }
function wandetectIPV4($inf) { $infp = XNODE_getpathbytarget("", "inf", "uid", $inf, 0); $phyinf = query($infp . "/phyinf"); $phyinfp = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $phyinf, 0); $ifname = PHYINF_getifname($phyinf); $linkstatus = query($phyinfp . "/linkstatus"); if ($linkstatus == "") { return "ERROR"; } del("/runtime/wanispppoe"); del("/runtime/wanisdhcp"); addevent("detectpppoe", "xmldbc -s /runtime/wanispppoe \\`pppd pty_pppoe pppoe_discovery pppoe_device " . $ifname . "\\` &"); addevent("detectdhcp", "xmldbc -s /runtime/wanisdhcp \\`udhcpc -i " . $ifname . " -d -D 1 -R 3\\`&"); event("detectpppoe"); event("detectdhcp"); return "OK"; }
function setProduct($productId, $qty) { $user = \cf\User::getLoggedIn(); if (!$qty) { del($productId); } if ($user) { $cartId = create(); \cf\execQuery('DELETE FROM cf_products_in_cart WHERE cart_id=:cid AND product_id=:pid', array('cid' => $cartId, 'pid' => $productId)); \cf\execQuery('INSERT INTO cf_products_in_cart (cart_id,product_id,amount) VALUES(:cid,:pid,:num)', array('cid' => $cartId, 'pid' => $productId, 'num' => $qty)); } else { $c = create(); $products = $c->getParam('ready'); $products[$productId] = (int) $qty; $c->setParam('ready', $products); $c->set(); } return getList(); }
function main() { global $result; switch ($_REQUEST['query']) { case "add": add(); break; case "modify": modify(); break; case "delete": del(); break; default: $result['status'] = 404; $result['msg'] = "No such query type" . $_REQUEST['query']; } echo json_encode($result); }
function compile_simple($options) { list($from, $to) = array($this->from_num, $this->to_num); $idx = del($options, 'index'); $step = del($options, 'step'); if ($step) { $stepvar = $options['scope']->free_variable('step'); } $var_part = "{$idx} = {$from}"; if ($step) { $var_part .= ", {$stepvar} = " . $step->compile($options); } $cond_part = $from <= $to ? "{$idx} <{$this->equals} {$to}" : "{$idx} >{$this->equals} {$to}"; if ($step) { $step_part = "{$idx} += {$stepvar}"; } else { $step_part = $from <= $to ? "{$idx}++" : "{$idx}--"; } return "{$var_part}; {$cond_part}; {$step_part}"; }
function del($pid) { $public_function = new public_function(); $sql = "select * from flow_sort where sort_parent='{$pid}'"; $delsql = "delete from flow_sort where sort_id='{$pid}'"; $result = $public_function->getresult($sql); $num = $public_function->getnum($result); for ($i = 0; $i < $num; $i++) { $array = $public_function->getarray($result); del($array['sort_id']); } $result1 = $public_function->getresult($delsql); $public_function->getresult("delete from flow_type where flow_sort not in(select sort_id from flow_sort)"); $public_function->getresult("delete from flow_print_tpl where flow_id not in(select flow_id from flow_type)"); $public_function->getresult("delete from flow_process where flow_id not in(select flow_id from flow_type)"); $public_function->getresult("delete from flow_query_tpl where flow_id not in(select flow_id from flow_type)"); $public_function->getresult("delete from flow_rule where flow_id not in(select flow_id from flow_type)"); $public_function->getresult("delete from flow_run where flow_id not in(select flow_id from flow_type)"); $public_function->getresult("delete from flow_run_log where flow_id not in(select flow_id from flow_type)"); $public_function->getresult("delete from flow_timer where flow_id not in(select flow_id from flow_type)"); echo "<script>location.href='../update_flow_type.php'</script>"; }
function copy_dhcps4($from, $to) { set($to . "/start", query($from . "/start")); set($to . "/end", query($from . "/end")); set($to . "/domain", query($from . "/domain")); set($to . "/leasetime", query($from . "/leasetime")); set($to . "/router", query($from . "/router")); del($to . "/dns"); del($to . "/wins"); del($to . "/staticleases"); $cnt = query($from . "/dns/count"); set($to . "/dns/count", $cnt); if ($cnt > 0) { copy_entry($from . "/dns", $to . "/dns", $cnt); } $cnt = query($from . "/wins/count"); set($to . "/wins/count", $cnt); if ($cnt > 0) { copy_entry($from . "/wins", $to . "/wins", $cnt); } mov($from . "/staticleases", $to); }
function wandetect($inf) { $infp = XNODE_getpathbytarget("", "inf", "uid", $inf, 0); $phyinf = query($infp . "/phyinf"); $phyinfp = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $phyinf, 0); $ifname = PHYINF_getifname($phyinf); $linkstatus = query($phyinfp . "/linkstatus"); if ($linkstatus == "") { return "UNKNOWN"; } setattr("/runtime/detectpppoe", "get", "pppd pty_pppoe pppoe_discovery pppoe_device " . $ifname); $ret = query("/runtime/detectpppoe"); del("/runtime/detectpppoe"); if ($ret == "yes") { return "PPPOE"; } setattr("/runtime/detectdhcp", "get", "udhcpc -i " . $ifname . " -d -D 1 -R 2"); $ret = query("/runtime/detectdhcp"); del("/runtime/detectdhcp"); if ($ret == "yes") { return "DHCP"; } return "UNKNOWN"; }
function del ($file) { global $delim; if (!@is_link($file) && !file_exists($file)) return false; if (!@is_link($file) && @is_dir($file)) { if ($dir = @opendir($file)) { $error = false; while (($f = readdir($dir)) !== false) { if ($f != '.' && $f != '..' && !del($file . $delim . $f)) { $error = true; } } closedir($dir); if (!$error) return @rmdir($file); return !$error; } else { return false; } } else { return @unlink($file); } }
function compile_node($options) { $options['scope'] = new Scope($options['scope'], $this->body, $this); $options['scope']->shared = del($options, 'sharedScope'); $options['indent'] .= TAB; unset($options['bare']); unset($options['isExistentialEquals']); $params = array(); $exprs = array(); foreach ($this->param_names() as $name) { if (!$options['scope']->check($name)) { $options['scope']->parameter($name); } } foreach ($this->params as $param) { if ($param->splat) { if (isset($param->name->value) && $param->name->value) { $options['scope']->add($param->name->value, 'var', TRUE); } $params = array(); foreach ($this->params as $p) { $params[] = $p->as_reference($options); } $splats = yy('Assign', yy('Value', yy('Arr', $params)), yy('Value', yy('Literal', 'arguments'))); break; } } foreach ($this->params as $param) { if ($param->is_complex()) { $val = $ref = $param->as_reference($options); if (isset($param->value) && $param->value) { $val = yy('Op', '?', $ref, $param->value); } $exprs[] = yy('Assign', yy('Value', $param->name), $val, '=', array('param' => TRUE)); } else { $ref = $param; if ($param->value) { $lit = yy('Literal', $ref->name->value . ' == null'); $val = yy('Assign', yy('Value', $param->name), $param->value, '='); $exprs[] = yy('If', $lit, $val); } } if (!(isset($splats) && $splats)) { $params[] = $ref; } } $was_empty = $this->body->is_empty(); if (isset($splats) && $splats) { array_unshift($exprs, $splats); } if ($exprs) { foreach (array_reverse($exprs) as $expr) { array_unshift($this->body->expressions, $expr); } } foreach ($params as $i => $p) { $options['scope']->parameter($params[$i] = $p->compile($options)); } $uniqs = array(); foreach ($this->param_names() as $name) { if (in_array($name, $uniqs)) { throw new SyntaxError("multiple parameters named {$name}"); } $uniqs[] = $name; } if (!($was_empty || $this->no_return)) { $this->body->make_return(); } if ($this->bound) { if (isset($options['scope']->parent->method->bound) && $options['scope']->parent->method->bound) { $this->bound = $this->context = $options['scope']->parent->method->context; } else { if (!(isset($this->static) && $this->static)) { $options['scope']->parent->assign('_this', 'this'); } } } $idt = $options['indent']; $code = 'function'; if ($this->ctor) { $code .= ' ' . $this->name; } $code .= '(' . implode(', ', $params) . ') {'; if (!$this->body->is_empty()) { $code .= "\n" . $this->body->compile_with_declarations($options) . "\n{$this->tab}"; } $code .= '}'; if ($this->ctor) { return $this->tab . $code; } return $this->front || $options['level'] >= LEVEL_ACCESS ? "({$code})" : $code; }
function compile_variables($options) { $options = array_merge($options, array('top' => TRUE)); list($this->from_c, $this->from_var) = $this->from->cache($options, LEVEL_LIST); list($this->to_c, $this->to_var) = $this->to->cache($options, LEVEL_LIST); if ($step = del($options, 'step')) { list($this->step, $this->step_var) = $step->cache($options, LEVEL_LIST); } if (preg_match(SIMPLENUM, $this->from_var, $m)) { $this->from_num = $m[0]; } if (preg_match(SIMPLENUM, $this->to_var, $m)) { $this->to_num = $m[0]; } if (isset($this->step_var) && $this->step_var && preg_match(SIMPLENUM, $this->step_var, $m)) { $this->step_num = $m[0]; } }
<body > <?php switch ($action) { case "show": if (!empty($_REQUEST['files'])) { $GLOBALS['picurl'] = $_REQUEST['files']; } show(); break; case "del": $GLOBALS['picurl'] = $_REQUEST['files']; del(); break; case "newload": $GLOBALS['picurl'] = $_REQUEST['files']; del(); break; default: upload(); break; } function show() { if (!file_exists(SYS_PATH . $GLOBALS['picurl'])) { echo "<script language='javascript'>window.location.href='uploadfile.php?action=&ty=" . $_REQUEST['ty'] . "&tyy=" . (isset($_REQUEST['tyy']) && !empty($_REQUEST['tyy']) ? trim($_REQUEST['tyy']) : trim($_REQUEST['ty'])) . "';</script>"; exit; } echo '<script> parent.document.getElementById("' . trim($_REQUEST['ty']) . '").value="' . $GLOBALS['picurl'] . '"; parent.document.getElementById("' . trim($_REQUEST['ty']) . '").style.display="none"; </script>'; echo "上传成功,[<a href='" . SITE_URL . '/' . $GLOBALS['picurl'] . "' title='点击预览上传的文件' target='_blank'>预览</a>],[<a href='uploadfile.php?action=newload&ty=" . $_REQUEST['ty'] . "&tyy=" . (isset($_REQUEST['tyy']) && !empty($_REQUEST['tyy']) ? trim($_REQUEST['tyy']) : trim($_REQUEST['ty'])) . "&files=" . $GLOBALS['picurl'] . "' onclick='return(confirm(\"确定要重新上传文件吗?\"))'>重新上传</a>],[<a href='uploadfile.php?action=del&ty=" . $_REQUEST['ty'] . "&tyy=" . (isset($_REQUEST['tyy']) && !empty($_REQUEST['tyy']) ? trim($_REQUEST['tyy']) : trim($_REQUEST['ty'])) . "&files=" . $GLOBALS['picurl'] . "' onclick='return del(\"" . (isset($_REQUEST['tyy']) && !empty($_REQUEST['tyy']) ? trim($_REQUEST['tyy']) : trim($_REQUEST['ty'])) . "\");'>删除</a>]"; } function del()
if (file_exists($arg2 . $logfile)) { $lines = file($arg2 . $logfile); foreach ($lines as $chkline) { if (strpos($chkline, 'All OK') !== FALSE) { echo 'File has successfully been extracted!'; if (file_exists($arg2 . $logfile)) { del($arg2 . $logfile); } } } } } // unzip if (strcasecmp('zip', $arg3) == 0) { if (file_exists($arg2 . $logfile)) { del($arg2 . $logfile); } $Command = escapeshellarg($arg4) . ' ' . escapeshellarg($arg1) . ' -d ' . escapeshellarg($arg2); $unzippid = shell_exec("nohup {$Command} > " . escapeshellarg($arg2 . $logfile) . " 2>&1 & echo \$!"); echo 'Uncompressing file...<BR>PID is: ' . $unzippid . '<BR>'; while (is_running($unzippid)) { /* occupy time to cause popup window load bar to load in conjunction with unzip progress */ } } //debug: echo variables if (strcasecmp('debug', $arg3) == 0) { echo $arg1 . '<BR>'; echo $arg2 . '<BR>'; echo $arg3 . '<BR>'; echo $arg4 . '<BR>'; echo $arg5 . '<BR>';
$cnt = query($base . "/entry#"); if ($cnt == "") { $cnt = 0; } if ($cnt >= $max) { if ($archive != "") { set($archive . "/type", $type); $archive = $archive . "/" . $type; del($archive); set($archive, ""); movc($base, $archive); event("LOGFULL"); } else { while ($cnt >= $max) { $cnt--; del($base . "/entry:1"); } } } $cnt = query($base . "/entry#"); if ($cnt == "") { $cnt = 0; } $cnt++; $runtime_node = "/runtime/services/globals"; set($base . "/entry:" . $cnt . "/time", $TIME); set($base . "/entry:" . $cnt . "/message", $TEXT); $HOSTIP = query("/device/log/remote/ipv4/ipaddr"); /*set($runtime_node."/name",SYSLOG_NODE); set($runtime_node."/value",$TEXT);i*/ $enable = query("/device/log/remote/enable");