本文整理汇总了PHP中TRACE_debug函数的典型用法代码示例。如果您正苦于以下问题:PHP TRACE_debug函数的具体用法?PHP TRACE_debug怎么用?PHP TRACE_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRACE_debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_datetime
function check_datetime($prefix)
{
$date = query($prefix . "/date");
$time = query($prefix . "/time");
$month = cut($date, 0, "/");
$day = cut($date, 1, "/");
$year = cut($date, 2, "/");
$hour = cut($time, 0, ":");
$min = cut($time, 1, ":");
$sec = cut($time, 2, ":");
TRACE_debug("FATLADY: RUNTIME.TIME: " . $year . "/" . $month . "/" . $day);
TRACE_debug("FATLADY: RUNTIME.TIME: " . $hour . ":" . $min . ":" . $sec);
/* The latest time linux can support is: Tue Jan 19 11:14:07 CST 2038. */
if (isdigit($year) == 0 || $year < 1999 || $year > 2037) {
set_result("FAILED", $prefix . "/date", i18n("Invalid year") . " - " . $year);
return;
}
if (isdigit($month) == 0 || $month <= 0 || $month > 12) {
set_result("FAILED", $prefix . "/date", i18n("Invalid month"));
return;
}
if (isdigit($day) == 0 || $day <= 0 || $day > 31) {
set_result("FAILED", $prefix . "/date", i18n("Invalid day"));
return;
}
if ($month == 2 || $month == 4 || $month == 6 || $month == 9 || $month == 11) {
if ($day > 30) {
set_result("FAILED", $prefix . "/date", i18n("Invalid day"));
return;
}
if ($month == 2) {
if (is29year($year) == 1) {
if ($day > 29) {
set_result("FAILED", $prefix . "/date", i18n("Invalid day"));
return;
}
} else {
if ($day > 28) {
set_result("FAILED", $prefix . "/date", i18n("Invalid day"));
return;
}
}
}
}
if (isdigit($hour) == 0 || $hour < 0 || $hour > 23) {
set_result("FAILED", $prefix . "/time", i18n("Invalid hour"));
return;
}
if (isdigit($min) == 0 || $min < 0 || $min > 59) {
set_result("FAILED", $prefix . "/time", i18n("Invalid minute"));
return;
}
if (isdigit($sec) == 0 || $sec < 0 || $sec > 59) {
set_result("FAILED", $prefix . "/time", i18n("Invalid second"));
return;
}
set_result("OK", "", "");
}
示例2: check_remote
function check_remote($entry)
{
$port = query($entry . "/inf/web");
if ($port != "") {
if (isdigit($port) != "1") {
set_result("FAILED", $entry . "/inf/web", i18n("Invalid port number"));
return 0;
}
if ($port < 1 || $port > 65535) {
set_result("FAILED", $entry . "/inf/web", i18n("Invalid port range"));
return 0;
}
// Check with VSVR and PFWD. Currently only with NAT-1;
$nat = XNODE_getpathbytarget("/nat", "entry", "uid", "NAT-1");
if ($nat != "") {
$i = 1;
while ($i <= 2) {
if ($i == 1) {
$target = "portforward";
$svr_str = i18n("PORT FORWARDING");
} else {
$target = "virtualserver";
$svr_str = i18n("VIRTUAL SERVER");
}
$count = query($nat . "/" . $target . "/entry#");
TRACE_debug("FATLADY: check HTTP.WAN with " . $nat . "/" . $target . " count:" . $count);
$j = 1;
while ($j <= $count) {
$CurBase = $nat . "/" . $target . "/entry:" . $j;
if (query($CurBase . "/protocol") == "TCP+UDP" || query($CurBase . "/protocol") == "TCP") {
if ($port >= query($CurBase . "/external/start") && $port <= query($CurBase . "/external/end")) {
set_result("FAILED", $entry . "/inf/web", i18n("The port number is used by") . " " . i18n($svr_str) . ".");
return 0;
}
}
$j++;
}
$i++;
}
}
}
$host = query($entry . "/inf/weballow/hostv4ip");
if ($host != "") {
if (INET_validv4addr($host) != "1") {
set_result("FAILED", $entry . "/inf/weballow/hostv4ip", i18n("Invalid host IP address"));
return 0;
}
}
set_result("OK", "", "");
return 1;
}
示例3: check_tz_dst
function check_tz_dst($prefix)
{
$maxtz = query("/runtime/services/timezone/zone#");
$tz = query($prefix . "/timezone");
if ($tz > $maxtz || $tz <= 0) {
set_result("FAILED", $prefix . "/timezone", i18n("Invalid timezone setting."));
return;
}
if (query("device/time/dst") != "1") {
set("device/time/dst", "0");
}
TRACE_debug("FATLADY: DEVICE.TIME: timezone=" . $tz . ", dst=" . query("device/time/dst"));
set_result("OK", "", "");
}
示例4: setup_dhcpc
function setup_dhcpc($prefix)
{
$i = 1;
while ($i > 0) {
$ifname = $prefix . "-" . $i;
$ifpath = XNODE_getpathbytarget("/runtime", "inf", "uid", $ifname, 0);
if ($ifpath == "") {
$i = 0;
break;
}
if (query($ifpath . "/inet/addrtype") == "ipv4" && query($ifpath . "/inet/ipv4/static") == "0" && query($ifpath . "/inet/ipv4/valid") == "1") {
TRACE_debug("Restart DHCP client: ifname = " . $ifname);
startcmd("service INET." . $ifname . " restart");
}
$i++;
}
}
示例5: query
{
$_GLOBALS["FATLADY_result"] = $result;
$_GLOBALS["FATLADY_node"] = $node;
$_GLOBALS["FATLADY_message"] = $message;
}
$wfaprefix = $FATLADY_prefix . "/webaccess";
$enable = query($wfaprefix . "/enable");
$httpenable = query($wfaprefix . "/httpenable");
$httpsenable = query($wfaprefix . "/httpsenable");
$httpport = query($wfaprefix . "/httpport");
$httpsport = query($wfaprefix . "/httpsport");
if ($enable != "1") {
set($wfaprefix . "/enable", 0);
}
if ($httpenable != "1") {
set($wfaprefix . "/httpenable", 0);
}
if ($httpsenable != "1") {
set($wfaprefix . "/httpsenable", 0);
}
TRACE_debug("httpport=" . $httpenable . "https=" . $httpsenable);
if ($httpport < 1 || $httpport > 65535) {
set_result("FAILED", $wfaprefix . "/httpport", i18n("Invalid HTTP port number."));
} else {
if ($httpsport < 1 || $httpsport > 65535) {
set_result("FAILED", $wfaprefix . "/httpsenable", i18n("Invalid HTTPS port number."));
} else {
set($FATLADY_prefix . "/valid", "1");
set_result("OK", "", "");
}
}
示例6: query
<?php
/* fatlady is used to validate the configuration for the specific service.
* FATLADY_prefix was defined to the path of Session Data.
* 3 variables should be returned for the result:
* FATLADY_result, FATLADY_node & FATLADY_message. */
include "/htdocs/phplib/trace.php";
$inet_host = query($FATLADY_prefix . "/device/diagnostic/chkconn/host/entry:4");
TRACE_debug("FATLADY: DEVICE.DIAGNOSTIC: FATLADY_prefix=" . $FATLADY_prefix);
TRACE_debug("FATLADY: DEVICE.DIAGNOSTIC: internet host=" . $inet_host);
if (isdomain($inet_host) != "0" || $inet_host == "") {
set($FATLADY_prefix . "/valid", "1");
$_GLOBALS["FATLADY_result"] = "OK";
$_GLOBALS["FATLADY_node"] = "";
$_GLOBALS["FATLADY_message"] = "";
} else {
$_GLOBALS["FATLADY_result"] = "FAILED";
$_GLOBALS["FATLADY_node"] = $FATLADY_prefix . "/device/diagnostic/chkconn/host/entry:4";
$_GLOBALS["FATLADY_message"] = i18n("Invalid Internet Host");
}
示例7: TRACE_debug
<?php
/* setcfg is used to move the validated session data to the configuration database.
* The variable, 'SETCFG_prefix', will indicate the path of the session data. */
include "/htdocs/phplib/trace.php";
include "/htdocs/phplib/xnode.php";
/*
* Internet Usage Meter.
*/
TRACE_debug("enable==============" . query($SETCFG_prefix . "/callmgr/mobile/flowmeter/enable"));
movc($SETCFG_prefix . "/callmgr/mobile/flowmeter", "/callmgr/mobile/flowmeter");
TRACE_debug("enable==============" . query("/callmgr/mobile/flowmeter/enable"));
示例8: set_result
function set_result($result, $node, $message)
{
$_GLOBALS["FATLADY_result"] = $result;
$_GLOBALS["FATLADY_node"] = $node;
$_GLOBALS["FATLADY_message"] = $message;
}
set_result("FAILED", "", "");
$rlt = "0";
$cnt = query($FATLADY_prefix . "/device/account/count");
TRACE_debug("FATLADY: DEVICE.ACCOUNT got " . $cnt . " accounts");
$i = 0;
while ($i < $cnt) {
$i++;
$name = query($FATLADY_prefix . "/device/account/entry:" . $i . "/name");
$passwd = query($FATLADY_prefix . "/device/account/entry:" . $i . "/password");
TRACE_debug("FATLADY: account[" . $i . "]: name=" . $name . ",passwd=" . $passwd);
if ($name == "") {
set_result("FAILED", $FATLADY_prefix . "/device/account/entry:" . $i . "/password", i18n("Login Name cannot be empty."));
$rlt = "-1";
break;
}
$p = "/device/account/entry:" . $i;
if (query($FATLADY_prefix . $p . "/confirmcurrentpassword/enable") == 1) {
if (query($FATLADY_prefix . $p . "/confirmcurrentpassword/password") != query($p . "/password")) {
set_result("FAILED", $FATLADY_prefix . $p . "/confirmcurrentpassword/password", i18n("The current password doesn't match."));
$rlt = "-1";
}
break;
}
}
if ($rlt == "0") {
示例9: check_ipv4
function check_ipv4($path, $needgw)
{
anchor($path);
$static = query("static");
if ($static != "1") {
set("static", "0");
}
TRACE_debug("FATLADY: INET_IPV4: static = " . $static);
if ($static == "1") {
$ip = query("ipaddr");
$mask = query("mask");
$dhcps4 = INF_getinfinfo($_GLOBALS["FATLADY_INF_UID"], "dhcps4");
TRACE_debug("FATLADY: INET_IPV4: ip = " . $ip);
TRACE_debug("FATLADY: INET_IPV4: mask = " . $mask);
if (INET_validv4addr($ip) == 0) {
set_result("FAILED", $path . "/ipaddr", i18n("Invalid IP address"));
return;
}
if ($mask == "") {
set_result("FAILED", $path . "/mask", i18n("No Subnet Mask value"));
return;
}
if ($mask < 0 || $mask > 32) {
set_result("FAILED", $path . "/mask", i18n("Invalid Subnet Mask value"));
return;
}
if (INET_validv4host($ip, $mask) == 0) {
set_result("FAILED", $path . "/ipaddr", i18n("Invalid IP address"));
return;
}
if (INET_addr_strip0($gw) == $ip) {
set_result("FAILED", $path . "/gateway", i18n("The IP address and gateway address cannot be the same"));
return;
}
set("ipaddr", INET_addr_strip0($ip));
$ip = query("ipaddr");
$gw = query("gateway");
TRACE_debug("FATLADY: INET_IPV4: gw=" . $gw);
if ($gw == "") {
if ($needgw == "1" && $static == "1") {
set_result("FAILED", $path . "/gateway", i18n("No default gateway IP address"));
return;
}
} else {
if (INET_validv4host($gw, $mask) == 0) {
set_result("FAILED", $path . "/gateway", i18n("Invalid default gateway IP address"));
return;
}
if (ipv4networkid($gw, $mask) != ipv4networkid($ip, $mask)) {
set_result("FAILED", $path . "/gateway", i18n("The default gateway should be in the same network"));
return;
}
if (INET_addr_strip0($gw) == $ip) {
set_result("FAILED", $path . "/gateway", i18n("The IP address and gateway address cannot be the same"));
return;
}
set("gateway", INET_addr_strip0($gw));
}
} else {
if (query("dhcpplus/enable") != "") {
/* User Name & Password */
if (query("dhcpplus/enable") == "1" && query("dhcpplus/username") == "") {
set_result("FAILED", $path . "/dhcpplus/username", i18n("The user name cannot be empty"));
return;
}
}
}
$cnt = query("dns/count");
$i = 0;
while ($i < $cnt) {
$i++;
$value = query("dns/entry:" . $i);
TRACE_debug("FATLADY: INET_IPV4: dns" . $i . "=" . $value);
if (INET_validv4addr($value) == 0) {
set_result("FAILED", $path . "/dns/entry:" . $i, i18n("Invalid DNS address"));
return;
}
set("dns/entry:" . $i, INET_addr_strip0($value));
if ($static == "1") {
if (ipv4networkid($value, $mask) == ipv4networkid($ip, $mask)) {
TRACE_debug("FATLADY: INET_IPV4: dns" . $i . "=" . $value . " is in the same network as IP:" . $ip);
if (INET_validv4host($value, $mask) == 0) {
set_result("FAILED", $path . "/dns/entry:" . $i, i18n("Invalid DNS address"));
return;
}
if ($value == $ip) {
set_result("FAILED", $path . "/dns/entry:" . $i, i18n("Invalid DNS address"));
return;
}
}
}
if ($i > 1) {
$j = $i - 1;
$k = 0;
while ($k < $j) {
$k++;
$dns = query("dns/entry:" . $k);
if ($value == $dns) {
set_result("FAILED", $path . "/dns/entry:2", i18n("Secondary DNS server should not be the same as Primary DNS server."));
return;
//.........这里部分代码省略.........
示例10: TRACE_debug
<?php
echo "<?";
?>
xml version="1.0" encoding="utf-8"<?php
echo "?>";
?>
<?php
include "/htdocs/phplib/trace.php";
echo "<" . $SIGNATURE . ">\n<runtime>\n<session>\n<" . $SESSION . ">\n";
TRACE_debug("GETCFG: serivce = " . $GETCFG_SVC);
if ($GETCFG_SVC != "") {
$file = "/htdocs/webinc/getcfg/" . $GETCFG_SVC . ".xml.php";
/* GETCFG_SVC will be passed to the child process. */
if (isfile($file) == "1") {
dophp("load", $file);
}
}
echo "</" . $SESSION . ">\n</session>\n</runtime>\n</" . $SIGNATURE . ">\n";
示例11: query
<?php
/* fatlady is used to validate the configuration for the specific service.
* FATLADY_prefix was defined to the path of Session Data.
* 3 variables should be returned for the result:
* FATLADY_result, FATLADY_node & FATLADY_message. */
include "/htdocs/phplib/trace.php";
$layout = query($FATLADY_prefix . "/device/layout");
TRACE_debug("FATLADY: DEVICE.LAYOUT: layout=" . $layout);
if ($layout == "router" || $layout == "bridge" || $layout == "auto") {
set($FATLADY_prefix . "/valid", "1");
$_GLOBALS["FATLADY_result"] = "OK";
$_GLOBALS["FATLADY_node"] = "";
$_GLOBALS["FATLADY_message"] = "";
} else {
$_GLOBALS["FATLADY_result"] = "FAILED";
$_GLOBALS["FATLADY_node"] = $FATLADY_prefix . "/device/layout";
$_GLOBALS["FATLADY_message"] = "unknown layout value";
/* internal error, no i18n. */
}
示例12: set_result
$_GLOBALS["FATLADY_result"] = $result;
$_GLOBALS["FATLADY_node"] = $node;
$_GLOBALS["FATLADY_message"] = $message;
}
set_result("FAILED", "", "");
$rlt = "0";
$val = query($FATLADY_prefix . "/callmgr/voice_service:1/phone/analog:1/enable");
if ($val != "0") {
set($FATLADY_prefix . "/callmgr/voice_service:1/phone/analog:1/enable", "1");
}
$val = query($FATLADY_prefix . "/callmgr/voice_service:1/phone/analog:1/callerid_display");
if ($val != "0") {
set($FATLADY_prefix . "/callmgr/voice_service:1/phone/analog:1/callid_display", "1");
}
$service_state = query($FATLADY_prefix . "/runtime/callmgr/voice_service:1/mobile/service_state");
TRACE_debug("FATLADY: service_state" . $service_state);
if ($service_state != 0 && $servcie_state == "") {
/*
* The following check "Caller ID Delivery", "Call waiting" and all "Call forwarding"
*/
$val = query($FATLADY_prefix . "/runtime/callmgr/voice_service:1/mobile/callerid_delivery");
if ($val != "0") {
set($FATLADY_prefix . "/runtime/callmgr/voice_service:1/mobile/callerid_delivery", "1");
}
$val = query($FATLADY_prefix . "/runtime/callmgr/voice_service:1/mobile/callwaiting");
if ($val != "0") {
set($FATLADY_prefix . "/runtime/callmgr/voice_service:1/mobile/callwaiting", "1");
}
if (query($FATLADY_prefix . "/runtime/callmgr/voice_service:1/mobile/call_forward/unconditional") == 1) {
$number = query($FATLADY_prefix . "/runtime/callmgr/voice_service:1/mobile/call_forward/unconditional_number");
//TRACE_debug("FATLADY: unconditional_number".$number);
示例13: fwrite
$str = "Router Status";
}
}
}
fwrite("w", $logfile, "\n[" . $str . "]\n");
fwrite("a", $logfile, "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
DUMPLOG_append_to_file($logfile, $path);
del($path);
echo 'logger -p 192.1 "Log of [' . $str . '] is full."\\n';
}
} else {
/*write rg.log*/
$logfile = "/var/run/rg.log";
DUMPLOG_all_to_file($logfile);
}
TRACE_debug("SendMailFlag=" . $SendMailFlag);
$enable = query("/device/log/email/enable");
if ($enable == "1" && $SendMailFlag == 1) {
$from = query("/device/log/email/from");
$email_addr = query("/device/log/email/to");
$mail_subject = get(s, "/device/log/email/subject");
$mail_server = query("/device/log/email/smtp/server");
$mail_port = query("/device/log/email/smtp/port");
if ($mail_port == "") {
$mail_port = "25";
}
$authenable = query("/device/log/email/authenable");
$username = query("/device/log/email/smtp/user");
$password = query("/device/log/email/smtp/password");
fwrite("w", "/var/log/subject", $mail_subject);
if ($from == "" || $email_addr == "" || $mail_server == "") {
示例14: TRACE_debug
HTTP/1.1 200 OK
Content-Type: text/xml
<?php
include "/htdocs/phplib/trace.php";
if ($AUTHORIZED_GROUP < 0) {
$result = "Authenication fail";
} else {
$result = "OK";
$code = "";
$message = "";
TRACE_debug("CHECK_NODE=================" . $_POST["CHECK_NODE"]);
// get value.
if ($_POST["CHECK_NODE"] != "") {
$code = query($_POST["CHECK_NODE"]);
TRACE_debug("code=============" . $code);
}
}
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<status>\n";
echo "\t<result>" . $result . "</result>\n";
echo "\t<code>" . $code . "</code>\n";
echo "\t<message></message>\n";
echo "</status>\n";
示例15: TRACE_debug
<?php
include "/htdocs/phplib/trace.php";
include "/htdocs/phplib/xnode.php";
$i = 0;
TRACE_debug("COUNT=" . $COUNT);
TRACE_debug("PREFIX=" . $PREFIX);
while ($i < $COUNT) {
$VALUE = "VALUE" . $i;
TRACE_debug("VALUE" . $i . "=" . ${$VALUE});
$i++;
}
$path_lan = XNODE_getpathbytarget($PREFIX . "/module", "inf", "uid", "LAN-1", 0);
if ($COUNT == 0) {
$lan_dns = query($path_lan . "/dns4");
if ($lan_dns == "DNS4-1") {
echo "LAN DNS ENABLED\n";
} else {
echo "LAN DNS DISABLED\n";
}
set($PREFIX . "/statue", "0");
} else {
/*invalid parameter*/
set($PREFIX . "/statue", "7");
}