function set_profile($phy) { if ($_GLOBALS["1xenable"] == "1") { //eap=%s\n } else { set($phy . "/authtype", toupper($_GLOBALS["auth"])); set($phy . "/encrtype", toupper($_GLOBALS["encr"])); set($phy . "/wps/configured", "1"); if ($_GLOBALS["auth"] != "open" && $_GLOBALS["auth"] != "shared") { set($phy . "/nwkey/psk/key", $_GLOBALS["key"]); } else { if ($_GLOBALS["encr"] == "WEP") { set($phy . "/nwkey/wep/key", $_GLOBALS["key"]); set($phy . "/nwkey/wep/defkey", $_GLOBALS["keyindex"]); $key_len = strlen($_GLOBALS["key"]); if ($key_len == "5" || $key_len == "13") { set($phy . "/nwkey/wep/ascii", "1"); } else { set($phy . "/nwkey/wep/ascii", "0"); set($phy . "/nwkey/wep/ascii", "0"); } } } } }
function changes_default_wifi($phyinfuid, $ssid, $password, $mac, $country) { $authtype = "WPA+2PSK"; $encrtype = "TKIP+AES"; $p = XNODE_getpathbytarget("", "phyinf", "uid", $phyinfuid, 0); $wifi = XNODE_getpathbytarget("/wifi", "entry", "uid", query($p . "/wifi"), 0); if ($p == "" || $wifi == "") { return; } anchor($wifi); if ($ssid == "") { $n5 = cut($mac, 4, ":"); $n6 = cut($mac, 5, ":"); $ssidsuffix = $n5 . $n6; $ssid = query("ssid"); if ($ssidsuffix != "") { //For dlink product, make the default SSID "dlink-mac" for 2.4GHz and "dlink-5GHz-mac" for 5GHz. if (substr($ssid, 0, 5) == "dlink") { $ssid1 = "dlink"; $ssid2 = scut($ssid, 0, "dlink"); $ssid = $ssid1 . $ssid2 . "-" . toupper($ssidsuffix); } } } //set default value for CN if ($country == "CN") { //$ssid = "D-Link_DIR-802"; $authtype = "OPEN"; $encrtype = "NONE"; set("authtype", $authtype); set("encrtype", $encrtype); set("ssid", $ssid); set("nwkey/psk/passphrase", ""); //20130812 jack add for hostapd error set("nwkey/psk/key", ""); return; } //TRACE_error("ssid=".$ssid."=password="******""); if ($password != "" && $ssid != "") { //chanhe the mode to wpa-auto psk set("authtype", "WPA+2PSK"); set("encrtype", "TKIP+AES"); set("wps/configured", "1"); set("ssid", $ssid); set("nwkey/psk/passphrase", "1"); set("nwkey/psk/key", $password); set("nwkey/wpa/groupintv", "3600"); set("nwkey/rekey/gtk", "1800"); } else { TRACE_error("the mfc do not init wifi password,using default"); } }
function find_hotstname($mac, $inf) { $path = XNODE_getpathbytarget("/runtime", "inf", "uid", $inf, 0); $entry_path = $path . "/dhcps4/leases/entry"; $cnt = query($entry_path . "#"); while ($cnt > 0) { $mac2 = query($entry_path . ":" . $cnt . "/macaddr"); $hostname = query($entry_path . ":" . $cnt . "/hostname"); if (toupper($mac2) == toupper($mac)) { return $hostname; } $cnt--; } return ""; }
public static function GetBatch($arMessages = array()) { global $APPLICATION; if (is_array($arMessages) && count($arMessages) <= 0) { return false; } $batch_modificator = ";3;"; $batch = ""; foreach ($arMessages as $token => $messages) { if (!count($messages)) { continue; } $mess = 0; $messCount = count($messages); while ($mess < $messCount) { $message = new CGoogleMessage($token); if ("UTF-8" != toupper(SITE_CHARSET)) { $messages[$mess] = $APPLICATION->ConvertCharsetArray($messages[$mess], SITE_CHARSET, "utf-8"); } $text = $messages[$mess]["MESSAGE"]; $message->setText($text); if ($messages[$mess]["TITLE"]) { $message->setTitle($messages[$mess]["TITLE"]); } $message->setSound(); $message->setExpiry(14400); if ($messages[$mess]["PARAMS"]) { $params = $messages[$mess]["PARAMS"]; if (is_array($messages[$mess]["PARAMS"])) { $params = json_encode($messages[$mess]["PARAMS"]); } $message->setCustomProperty('params', $params); } if (strlen($batch) > 0) { $batch .= ";"; } $batch .= $message->getBatch(); $mess++; } } if (strlen($batch) == 0) { return $batch; } return $batch_modificator . $batch; }
function changes_default_wifi($phyinfuid, $ssid, $password, $mac) { $p = XNODE_getpathbytarget("", "phyinf", "uid", $phyinfuid, 0); $wifi = XNODE_getpathbytarget("/wifi", "entry", "uid", query($p . "/wifi"), 0); if ($p == "" || $wifi == "") { return; } anchor($wifi); if ($ssid == "") { $n5 = cut($mac, 4, ":"); $n6 = cut($mac, 5, ":"); $ssidsuffix = $n5 . $n6; $ssid = query("ssid"); if ($ssidsuffix != "") { //For dlink product, make the default SSID "dlink-mac" for 2.4GHz and "dlink-mac-media" for 5GHz. if (substr($ssid, 0, 5) == "dlink") { $ssid1 = "dlink"; $ssid2 = scut($ssid, 0, "dlink"); $ssid = $ssid1 . "-" . toupper($ssidsuffix) . $ssid2; } } } //TRACE_error("ssid=".$ssid."=password="******""); if ($password != "" && $ssid != "") { //chanhe the mode to wpa-auto psk set("authtype", "WPA+2PSK"); set("encrtype", "TKIP+AES"); set("wps/configured", "1"); set("ssid", $ssid); set("nwkey/psk/passphrase", "1"); set("nwkey/psk/key", $password); set("nwkey/wpa/groupintv", "3600"); set("nwkey/rekey/gtk", "1800"); } else { TRACE_error("the mfc do not init wifi password,using default"); } }
protected function getBatchWithModifier($appMessages = array(), $modifier = "") { global $APPLICATION; $batch = ""; if (!is_array($appMessages) || count($appMessages) <= 0) { return $batch; } foreach ($appMessages as $appID => $arMessages) { $appModifier = ";tkey=" . $appID . ";"; foreach ($arMessages as $token => $messages) { if (!count($messages)) { continue; } $mess = 0; $messCount = count($messages); while ($mess < $messCount) { /** * @var CPushMessage $message; */ if (!$this->allowEmptyMessage && strlen(trim($messages[$mess]["MESSAGE"])) <= 0) { $mess++; continue; } $message = static::getMessageInstance($token); $id = rand(1, 10000); $message->setCustomIdentifier($id); if ("UTF-8" != toupper(SITE_CHARSET)) { $text = $APPLICATION->ConvertCharset($messages[$mess]["MESSAGE"], SITE_CHARSET, "utf-8"); } else { $text = $messages[$mess]["MESSAGE"]; } $message->setText($text); $message->setTitle($messages[$mess]["TITLE"]); if (strlen($text) > 0) { if (strlen($messages[$mess]["SOUND"]) > 0) { $message->setSound($messages[$mess]["SOUND"]); } } else { $message->setSound(''); } if ($messages[$mess]["PARAMS"]) { $params = $messages[$mess]["PARAMS"]; if (is_array($messages[$mess]["PARAMS"])) { $params = json_encode($messages[$mess]["PARAMS"]); } $message->setCustomProperty('params', $params); } if ($messages[$mess]["ACTION"]) { $message->setCustomProperty('action', $messages[$mess]["ACTION"]); } if ($messages[$mess]["JSEVENT"]) { $message->setCustomProperty('jsevent', $messages[$mess]["JSEVENT"]); } if ($messages[$mess]["CATEGORY"]) { $message->setCategory($messages[$mess]["CATEGORY"]); } $message->setCustomProperty('target', md5($messages[$mess]["USER_ID"] . CMain::GetServerUniqID())); if (array_key_exists("EXPIRY", $messages[$mess])) { $expiry = $messages[$mess]["EXPIRY"]; if ($expiry === 0 || $expiry === "0") { $message->setExpiry(0); } else { $message->setExpiry(intval($expiry) > 0 ? intval($expiry) : self::DEFAULT_EXPIRY); } } $badge = intval($messages[$mess]["BADGE"]); if (array_key_exists("BADGE", $messages[$mess]) && $badge >= 0) { $message->setBadge($badge); } if (strlen($batch) > 0) { $batch .= ";"; } $batch .= $message->getBatch(); $mess++; } } $batch = $appModifier . $batch; } if (strlen($batch) == 0) { return $batch; } return $modifier . $batch; }
} setattr($path . "/space/used", "get", ""); setattr($path . "/space/available", "get", ""); set($path . "/state", "FORMATTING"); set($path . "/fmt_result", ""); set($path . "/space/size", ""); set($path . "/space/used", ""); set($path . "/space/available", ""); } else { if ($action == "format") { echo "#!/bin/sh\n"; echo "mkfs.ext3 /dev/" . $dev . " -F\n"; echo "if [ \$? -eq 0 ]; then\n"; echo "\tphpsh " . $PHPFILE . " dev=" . $dev . " action=update state=SUCCESS\n"; echo "else\n"; echo "\tphpsh " . $PHPFILE . " dev=" . $dev . " action=update state=FAILED\n"; echo "fi\n"; } else { if ($action == "update") { if ($state == "SUCCESS") { set($path . "/state", "FORMATED"); set($path . "/fmt_result", "SUCCESS"); } else { set($path . "/state", "FORMAT FAILED"); set($path . "/fmt_result", "FAILED"); } event("MOUNT." . toupper($dev)); } } } }
function PHYINF_validmacaddr($macaddr) { if (cut_count($macaddr, ":") == 6) { $delimiter = ":"; } else { return 0; } $i = 0; while ($i < 6) { $v = cut($macaddr, $i, $delimiter); if (strlen($v) != 2 || isxdigit($v) != 1) { return 0; } if ($i == 0) { //hendry : check for multicast mac $val = strtoul($v, 16); $ismulti = $val % 2; if ($ismulti == 1) { return 0; } } $i++; } if (toupper($macaddr) == "FF:FF:FF:FF:FF:FF" || $macaddr == "01:11:11:11:11:11" || $macaddr == "00:00:00:00:00:00") { return 0; } return 1; }
function GetQueryEx($arFilter, &$arJoins, $level = 0) { global $DB; if (!is_array($arFilter)) { return ""; } $length_func = $DB->type == "MSSQL" ? "LEN" : "LENGTH"; $logic = false; if (isset($arFilter['LOGIC'])) { $logic = $arFilter["LOGIC"]; unset($arFilter["LOGIC"]); } if ($logic !== "OR") { $logic = "AND"; } $result = array(); foreach ($arFilter as $key => $value) { if (is_numeric($key)) { $arRecursiveJoins = $arJoins; $value = $this->GetQueryEx($value, $arRecursiveJoins, $level + 1); if (strlen($value) > 0) { $result[] = "(" . $value . "\n" . str_repeat("\t", $level) . ")"; } foreach ($arRecursiveJoins as $TABLE_ALIAS => $bLeftJoin) { if ($bLeftJoin) { if ($logic == "OR") { $arJoins[$TABLE_ALIAS] |= true; } else { $arJoins[$TABLE_ALIAS] &= true; } } else { if ($logic == "OR") { $arJoins[$TABLE_ALIAS] |= false; } else { $arJoins[$TABLE_ALIAS] &= false; } } } } else { $operation = $this->MakeOperation($key); $key = strtoupper($operation["FIELD"]); $operation = $operation["OPERATION"]; if (isset($this->fields[$key])) { $FIELD_NAME = $this->fields[$key]["FIELD_NAME"]; $FIELD_TYPE = $this->fields[$key]["FIELD_TYPE"]; if ($operation == "G") { $FIELD_OPERATION = " > "; } elseif ($operation == "L") { $FIELD_OPERATION = " < "; } elseif ($operation == "GE") { $FIELD_OPERATION = " >= "; } elseif ($operation == "LE") { $FIELD_OPERATION = " <= "; } //Handle joins logic $this->c_joins[$key]++; if (($operation == "I" || $operation == "E" || $operation == "S" || $operation == "M") && (is_scalar($value) && ($FIELD_TYPE == "int" && intval($value) == 0 || $FIELD_TYPE == "double" && doubleval($value) == 0 || strlen($value) <= 0)) || ($operation == "NI" || $operation == "N" || $operation == "NS" || $operation == "NB" || $operation == "NM") && (is_array($value) || ($FIELD_TYPE == "int" && intval($value) != 0 || $FIELD_TYPE == "double" && doubleval($value) != 0 || $FIELD_TYPE != "int" && $FIELD_TYPE != "double" && strlen($value) > 0))) { if ($logic == "OR") { $arJoins[$this->fields[$key]["TABLE_ALIAS"]] |= true; } else { $arJoins[$this->fields[$key]["TABLE_ALIAS"]] &= true; } } else { if ($logic == "OR") { $arJoins[$this->fields[$key]["TABLE_ALIAS"]] |= false; } else { $arJoins[$this->fields[$key]["TABLE_ALIAS"]] &= false; } } switch ($FIELD_TYPE) { case "file": case "enum": case "int": if (is_array($value)) { $FIELD_VALUE = array(); foreach ($value as $val) { $FIELD_VALUE[] = intval($val); } } elseif (is_object($value)) { $FIELD_VALUE = $value; } else { $FIELD_VALUE = intval($value); } switch ($operation) { case "I": case "E": case "S": case "M": if (is_array($FIELD_VALUE)) { if (count($FIELD_VALUE)) { $_result = $FIELD_NAME . " in (" . implode(", ", $FIELD_VALUE) . ")"; if (in_array(0, $FIELD_VALUE, true)) { $_result = '(' . $_result . ' OR ' . $FIELD_NAME . ' IS NULL)'; } $result[] = $_result; } else { $result[] = "1=0"; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } } elseif (is_object($FIELD_VALUE)) { $result[] = $FIELD_NAME . " = " . $FIELD_VALUE->compile(); } elseif ($FIELD_VALUE == 0) { $result[] = "(" . $FIELD_NAME . " IS NULL OR " . $FIELD_NAME . " = 0)"; } else { $result[] = $FIELD_NAME . " = " . $FIELD_VALUE; } break; case "NI": case "N": case "NS": case "NM": if (is_array($FIELD_VALUE)) { if (count($FIELD_VALUE)) { $result[] = $FIELD_NAME . " not in (" . implode(", ", $FIELD_VALUE) . ")"; } else { $result[] = "1=1"; } } elseif ($FIELD_VALUE == 0) { $result[] = "(" . $FIELD_NAME . " IS NOT NULL AND " . $FIELD_NAME . " <> 0)"; } else { $result[] = $FIELD_NAME . " <> " . $FIELD_VALUE; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "G": case "L": case "GE": case "LE": if (is_array($FIELD_VALUE)) { $result[] = $FIELD_NAME . $FIELD_OPERATION . $FIELD_VALUE[0]; } else { $result[] = $FIELD_NAME . $FIELD_OPERATION . $FIELD_VALUE; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "B": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) { $result[] = $FIELD_NAME . " between " . $FIELD_VALUE[0] . " AND " . $FIELD_VALUE[1]; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "NB": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) { $result[] = $FIELD_NAME . " not between " . $FIELD_VALUE[0] . " AND " . $FIELD_VALUE[1]; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; } break; case "double": if (is_array($value)) { $FIELD_VALUE = array(); foreach ($value as $val) { $FIELD_VALUE[] = doubleval($val); } } else { $FIELD_VALUE = doubleval($value); } switch ($operation) { case "I": case "E": case "S": case "M": if (is_array($FIELD_VALUE)) { $result[] = $FIELD_NAME . " in (" . implode(", ", $FIELD_VALUE) . ")"; } elseif ($FIELD_VALUE == 0) { $result[] = "(" . $FIELD_NAME . " IS NULL OR " . $FIELD_NAME . " = 0)"; } else { $result[] = $FIELD_NAME . " = " . $FIELD_VALUE; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "NI": case "N": case "NS": case "NM": if (is_array($FIELD_VALUE)) { $result[] = $FIELD_NAME . " not in (" . implode(", ", $FIELD_VALUE) . ")"; } elseif ($FIELD_VALUE == 0) { $result[] = "(" . $FIELD_NAME . " IS NOT NULL AND " . $FIELD_NAME . " <> 0)"; } else { $result[] = $FIELD_NAME . " <> " . $FIELD_VALUE; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "G": case "L": case "GE": case "LE": if (is_array($FIELD_VALUE)) { $result[] = $FIELD_NAME . $FIELD_OPERATION . $FIELD_VALUE[0]; } else { $result[] = $FIELD_NAME . $FIELD_OPERATION . $FIELD_VALUE; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "B": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) { $result[] = $FIELD_NAME . " between " . $FIELD_VALUE[0] . " AND " . $FIELD_VALUE[1]; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "NB": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) { $result[] = $FIELD_NAME . " not between " . $FIELD_VALUE[0] . " AND " . $FIELD_VALUE[1]; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; } break; case "string": if (is_array($value)) { $FIELD_VALUE = array(); if ($operation == "S" || $operation == "NS") { foreach ($value as $val) { $FIELD_VALUE[] = $this->ForLIKE(toupper($val)); } } else { foreach ($value as $val) { $FIELD_VALUE[] = $DB->ForSQL($val); } } } elseif (is_object($value)) { $FIELD_VALUE = $value; } else { if ($operation == "S" || $operation == "NS") { $FIELD_VALUE = $this->ForLIKE(toupper($value)); } else { $FIELD_VALUE = $DB->ForSQL($value); } } switch ($operation) { case "I": if (is_array($FIELD_VALUE)) { $result[] = $this->_StringIN($FIELD_NAME, $FIELD_VALUE); if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } } elseif (is_object($FIELD_VALUE)) { $result[] = $this->_ExprEQ($FIELD_NAME, $FIELD_VALUE); } elseif (strlen($FIELD_VALUE) <= 0) { $result[] = $this->_Empty($FIELD_NAME); } else { $result[] = $this->_StringEQ($FIELD_NAME, $FIELD_VALUE); } break; case "E": if (is_array($FIELD_VALUE)) { $result[] = "(" . $this->_Upper($FIELD_NAME) . " like '" . implode("' OR " . $this->_Upper($FIELD_NAME) . " like '", $FIELD_VALUE) . "')"; } elseif (is_object($FIELD_VALUE)) { $result[] = $this->_ExprEQ($FIELD_NAME, $FIELD_VALUE); } elseif (strlen($FIELD_VALUE) <= 0) { $result[] = $this->_Empty($FIELD_NAME); } else { //kinda optimization for digits only if (preg_match("/[^0-9]/", $FIELD_VALUE)) { $result[] = $this->_Upper($FIELD_NAME) . " like '" . $FIELD_VALUE . "'"; } else { $result[] = $this->_StringEQ($FIELD_NAME, $FIELD_VALUE); } } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "S": if (is_array($FIELD_VALUE)) { $result[] = "(" . $this->_Upper($FIELD_NAME) . " like '%" . implode("%' ESCAPE '!' OR " . $this->_Upper($FIELD_NAME) . " like '%", $FIELD_VALUE) . "%' ESCAPE '!')"; } elseif (is_object($FIELD_VALUE)) { $result[] = $this->_Upper($FIELD_NAME) . " like " . $FIELD_VALUE->compile() . " ESCAPE '!'"; } elseif (strlen($FIELD_VALUE) <= 0) { $result[] = $this->_Empty($FIELD_NAME); } else { $result[] = $this->_Upper($FIELD_NAME) . " like '%" . $FIELD_VALUE . "%' ESCAPE '!'"; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "M": if (is_array($FIELD_VALUE)) { $result[] = "(" . $FIELD_NAME . " like '" . implode("' OR " . $FIELD_NAME . " like '", $FIELD_VALUE) . "')"; } elseif (is_object($FIELD_VALUE)) { $result[] = $this->_ExprEQ($FIELD_NAME, $FIELD_VALUE); } elseif (strlen($FIELD_VALUE) <= 0) { $result[] = $this->_Empty($FIELD_NAME); } else { //kinda optimization for digits only if (preg_match("/[^0-9]/", $FIELD_VALUE)) { $result[] = $FIELD_NAME . " like '" . $FIELD_VALUE . "'"; } else { $result[] = $this->_StringEQ($FIELD_NAME, $FIELD_VALUE); } } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "NI": if (is_array($FIELD_VALUE)) { $result[] = $this->_StringNotIN($FIELD_NAME, $FIELD_VALUE); } elseif (is_object($FIELD_VALUE)) { $result[] = $this->_ExprNotEQ($FIELD_NAME, $FIELD_VALUE); } elseif (strlen($FIELD_VALUE) <= 0) { $result[] = $this->_NotEmpty($FIELD_NAME); } else { $result[] = $this->_StringNotEQ($FIELD_NAME, $FIELD_VALUE); } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "N": if (is_array($FIELD_VALUE)) { $result[] = "(" . $this->_Upper($FIELD_NAME) . " not like '" . implode("' AND " . $this->_Upper($FIELD_NAME) . " not like '", $FIELD_VALUE) . "')"; } elseif (is_object($FIELD_VALUE)) { $result[] = $this->_Upper($FIELD_NAME) . " not like " . $FIELD_VALUE->compile(); } elseif (strlen($FIELD_VALUE) <= 0) { $result[] = $this->_NotEmpty($FIELD_NAME); } else { $result[] = $this->_Upper($FIELD_NAME) . " not like '" . $FIELD_VALUE . "'"; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "NS": if (is_array($FIELD_VALUE)) { $result[] = "(" . $this->_Upper($FIELD_NAME) . " not like '%" . implode("%' ESCAPE '!' AND " . $this->_Upper($FIELD_NAME) . " not like '%", $FIELD_VALUE) . "%' ESCAPE '!')"; } elseif (is_object($FIELD_VALUE)) { $result[] = $this->_Upper($FIELD_NAME) . " not like " . $FIELD_VALUE->compile(); } elseif (strlen($FIELD_VALUE) <= 0) { $result[] = $this->_NotEmpty($FIELD_NAME); } else { $result[] = $this->_Upper($FIELD_NAME) . " not like '%" . $FIELD_VALUE . "%' ESCAPE '!'"; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "NM": if (is_array($FIELD_VALUE)) { $result[] = "(" . $FIELD_NAME . " not like '" . implode("' AND " . $FIELD_NAME . " not like '", $FIELD_VALUE) . "')"; } elseif (is_object($FIELD_VALUE)) { $result[] = $FIELD_NAME . " not like " . $FIELD_VALUE->compile(); } elseif (strlen($FIELD_VALUE) <= 0) { $result[] = $this->_NotEmpty($FIELD_NAME); } else { $result[] = $FIELD_NAME . " not like '" . $FIELD_VALUE . "'"; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "G": case "L": case "GE": case "LE": if (is_array($FIELD_VALUE)) { $result[] = $FIELD_NAME . $FIELD_OPERATION . "'" . $FIELD_VALUE[0] . "'"; } elseif (is_object($FIELD_VALUE)) { $result[] = $FIELD_NAME . $FIELD_OPERATION . $FIELD_VALUE->compile(); } else { $result[] = $FIELD_NAME . $FIELD_OPERATION . "'" . $FIELD_VALUE . "'"; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "B": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) { $result[] = $FIELD_NAME . " between '" . $FIELD_VALUE[0] . "' AND '" . $FIELD_VALUE[1] . "'"; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "NB": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) { $result[] = $FIELD_NAME . " not between '" . $FIELD_VALUE[0] . "' AND '" . $FIELD_VALUE[1] . "'"; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "?": if (is_scalar($FIELD_VALUE) && strlen($FIELD_VALUE)) { $q = GetFilterQuery($FIELD_NAME, $FIELD_VALUE); // Check if error ("0" was returned) if ($q !== '0') { $result[] = $q; } } break; } break; case "date": case "datetime": if ($FIELD_TYPE == "date") { $format = "SHORT"; } else { $format = "FULL"; } if (is_array($value)) { $FIELD_VALUE = array(); foreach ($value as $val) { $FIELD_VALUE[] = $DB->CharToDateFunction($val, $format); } } elseif (strlen($value)) { $FIELD_VALUE = $DB->CharToDateFunction($value, $format); } else { $FIELD_VALUE = ''; } switch ($operation) { case "I": case "E": case "S": case "M": if (is_array($FIELD_VALUE)) { $result[] = $FIELD_NAME . " in (" . implode(", ", $FIELD_VALUE) . ")"; if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } } elseif (strlen($value) <= 0) { $result[] = "(" . $FIELD_NAME . " IS NULL)"; } else { $result[] = $FIELD_NAME . " = " . $FIELD_VALUE; } break; case "NI": case "N": case "NS": case "NM": if (is_array($FIELD_VALUE)) { $result[] = $FIELD_NAME . " not in (" . implode(", ", $FIELD_VALUE) . ")"; } elseif (strlen($value) <= 0) { $result[] = "(" . $FIELD_NAME . " IS NOT NULL)"; } else { $result[] = $FIELD_NAME . " <> " . $FIELD_VALUE; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "G": case "L": case "GE": case "LE": if (is_array($FIELD_VALUE)) { $result[] = $FIELD_NAME . $FIELD_OPERATION . $FIELD_VALUE[0]; } else { $result[] = $FIELD_NAME . $FIELD_OPERATION . $FIELD_VALUE; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "B": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) { $result[] = $FIELD_NAME . " between " . $FIELD_VALUE[0] . " AND " . $FIELD_VALUE[1]; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; case "NB": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) { $result[] = $FIELD_NAME . " not between " . $FIELD_VALUE[0] . " AND " . $FIELD_VALUE[1]; } if ($this->fields[$key]["MULTIPLE"] === "Y") { $this->bDistinctReqired = true; } break; } break; case "callback": $res = call_user_func_array($this->fields[$key]["CALLBACK"], array($FIELD_NAME, $operation, $value)); if (strlen($res)) { $result[] = $res; } break; } } } } if (count($result) > 0) { return "\n" . str_repeat("\t", $level) . implode("\n" . str_repeat("\t", $level) . $logic . " ", $result); } else { return ""; } }
function addStringFilter(&$result, $isMultiple, $FIELD_NAME, $operation, $value) { global $DB; if (is_array($value)) { $FIELD_VALUE = array(); if ($operation=="S" || $operation=="NS") { foreach ($value as $val) $FIELD_VALUE[] = $this->ForLIKE(toupper($val)); } else { foreach ($value as $val) $FIELD_VALUE[] = $DB->ForSQL($val); } } elseif (is_object($value)) { $FIELD_VALUE = $value; } else { if ($operation=="S" || $operation=="NS") $FIELD_VALUE = $this->ForLIKE(toupper($value)); else $FIELD_VALUE = $DB->ForSQL($value); } switch ($operation) { case "I": if (is_array($FIELD_VALUE)) { $result[] = $this->_StringIN($FIELD_NAME, $FIELD_VALUE); if ($isMultiple) $this->bDistinctReqired = true; } elseif (is_object($FIELD_VALUE)) { $result[] = $this->_ExprEQ($FIELD_NAME, $FIELD_VALUE); } elseif (strlen($FIELD_VALUE) <= 0) $result[] = $this->_Empty($FIELD_NAME); else $result[] = $this->_StringEQ($FIELD_NAME, $FIELD_VALUE); break; case "E": if (is_array($FIELD_VALUE)) $result[] = "(".$this->_Upper($FIELD_NAME)." like upper('".implode("') OR ".$this->_Upper($FIELD_NAME)." like upper('", $FIELD_VALUE)."'))"; elseif (is_object($FIELD_VALUE)) $result[] = $this->_ExprEQ($FIELD_NAME, $FIELD_VALUE); elseif(strlen($FIELD_VALUE)<=0) $result[] = $this->_Empty($FIELD_NAME); else { //kinda optimization for digits only if (preg_match("/[^0-9]/", $FIELD_VALUE)) $result[] = $this->_Upper($FIELD_NAME)." like upper('".$FIELD_VALUE."')"; else $result[] = $this->_StringEQ($FIELD_NAME, $FIELD_VALUE); } if ($isMultiple) $this->bDistinctReqired = true; break; case "S": if (is_array($FIELD_VALUE)) $result[] = "(".$this->_Upper($FIELD_NAME)." like '%".implode("%' ESCAPE '!' OR ".$this->_Upper($FIELD_NAME)." like '%", $FIELD_VALUE)."%' ESCAPE '!')"; elseif (is_object($FIELD_VALUE)) $result[] = $this->_Upper($FIELD_NAME)." like ".$FIELD_VALUE->compile()." ESCAPE '!'"; elseif (strlen($FIELD_VALUE) <= 0) $result[] = $this->_Empty($FIELD_NAME); else $result[] = $this->_Upper($FIELD_NAME)." like '%".$FIELD_VALUE."%' ESCAPE '!'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "M": if (is_array($FIELD_VALUE)) $result[] = "(".$FIELD_NAME." like '".implode("' OR ".$FIELD_NAME." like '", $FIELD_VALUE)."')"; elseif (is_object($FIELD_VALUE)) $result[] = $this->_ExprEQ($FIELD_NAME, $FIELD_VALUE); elseif (strlen($FIELD_VALUE) <= 0) $result[] = $this->_Empty($FIELD_NAME); else { //kinda optimization for digits only if (preg_match("/[^0-9]/", $FIELD_VALUE)) $result[] = $FIELD_NAME." like '".$FIELD_VALUE."'"; else $result[] = $this->_StringEQ($FIELD_NAME, $FIELD_VALUE); } if ($isMultiple) $this->bDistinctReqired = true; break; case "NI": if (is_array($FIELD_VALUE)) $result[] = $this->_StringNotIN($FIELD_NAME, $FIELD_VALUE); elseif (is_object($FIELD_VALUE)) $result[] = $this->_ExprNotEQ($FIELD_NAME, $FIELD_VALUE); elseif (strlen($FIELD_VALUE) <= 0) $result[] = $this->_NotEmpty($FIELD_NAME); else $result[] = $this->_StringNotEQ($FIELD_NAME, $FIELD_VALUE); if ($isMultiple) $this->bDistinctReqired = true; break; case "N": if (is_array($FIELD_VALUE)) $result[] = "(".$this->_Upper($FIELD_NAME)." not like '".implode("' AND ".$this->_Upper($FIELD_NAME)." not like '", $FIELD_VALUE)."')"; elseif (is_object($FIELD_VALUE)) $result[] = $this->_Upper($FIELD_NAME)." not like ".$FIELD_VALUE->compile(); elseif (strlen($FIELD_VALUE) <= 0) $result[] = $this->_NotEmpty($FIELD_NAME); else $result[] = $this->_Upper($FIELD_NAME)." not like '".$FIELD_VALUE."'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "NS": if (is_array($FIELD_VALUE)) $result[] = "(".$this->_Upper($FIELD_NAME)." not like '%".implode("%' ESCAPE '!' AND ".$this->_Upper($FIELD_NAME)." not like '%", $FIELD_VALUE)."%' ESCAPE '!')"; elseif (is_object($FIELD_VALUE)) $result[] = $this->_Upper($FIELD_NAME)." not like ".$FIELD_VALUE->compile(); elseif (strlen($FIELD_VALUE) <= 0) $result[] = $this->_NotEmpty($FIELD_NAME); else $result[] = $this->_Upper($FIELD_NAME)." not like '%".$FIELD_VALUE."%' ESCAPE '!'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "NM": if(is_array($FIELD_VALUE)) $result[] = "(".$FIELD_NAME." not like '".implode("' AND ".$FIELD_NAME." not like '", $FIELD_VALUE)."')"; elseif (is_object($FIELD_VALUE)) $result[] = $FIELD_NAME." not like ".$FIELD_VALUE->compile(); elseif (strlen($FIELD_VALUE) <= 0) $result[] = $this->_NotEmpty($FIELD_NAME); else $result[] = $FIELD_NAME." not like '".$FIELD_VALUE."'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "G": if (is_array($FIELD_VALUE)) $result[] = $FIELD_NAME." > '".$FIELD_VALUE[0]."'"; elseif (is_object($FIELD_VALUE)) $result[] = $FIELD_NAME." > ".$FIELD_VALUE->compile(); else $result[] = $FIELD_NAME." > '".$FIELD_VALUE."'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "L": if (is_array($FIELD_VALUE)) $result[] = $FIELD_NAME." < '".$FIELD_VALUE[0]."'"; elseif (is_object($FIELD_VALUE)) $result[] = $FIELD_NAME." < ".$FIELD_VALUE->compile(); else $result[] = $FIELD_NAME." < '".$FIELD_VALUE."'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "GE": if (is_array($FIELD_VALUE)) $result[] = $FIELD_NAME." >= '".$FIELD_VALUE[0]."'"; elseif (is_object($FIELD_VALUE)) $result[] = $FIELD_NAME." >= ".$FIELD_VALUE->compile(); else $result[] = $FIELD_NAME." >= '".$FIELD_VALUE."'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "LE": if (is_array($FIELD_VALUE)) $result[] = $FIELD_NAME." <= '".$FIELD_VALUE[0]."'"; elseif (is_object($FIELD_VALUE)) $result[] = $FIELD_NAME." <= ".$FIELD_VALUE->compile(); else $result[] = $FIELD_NAME." <= '".$FIELD_VALUE."'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "B": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) $result[] = $FIELD_NAME." between '".$FIELD_VALUE[0]."' AND '".$FIELD_VALUE[1]."'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "NB": if (is_array($FIELD_VALUE) && count($FIELD_VALUE) > 1) $result[] = $FIELD_NAME." not between '".$FIELD_VALUE[0]."' AND '".$FIELD_VALUE[1]."'"; if ($isMultiple) $this->bDistinctReqired = true; break; case "?": if (is_scalar($FIELD_VALUE) && strlen($FIELD_VALUE)) { $q = GetFilterQuery($FIELD_NAME, $FIELD_VALUE); // Check if error ("0" was returned) if ($q !== '0') $result[] = $q; } break; case "IN": if(is_object($FIELD_VALUE)) $result[] = $FIELD_NAME." IN (".$FIELD_VALUE->compile().")"; elseif(is_array($FIELD_VALUE)) $result[] = $FIELD_NAME." IN ('".implode("', '", $FIELD_VALUE)."')"; else $result[] = $FIELD_NAME." IN ('".$FIELD_VALUE."')"; break; case "NIN": if(is_object($FIELD_VALUE)) $result[] = $FIELD_NAME." NOT IN (".$FIELD_VALUE->compile().")"; elseif(is_array($FIELD_VALUE)) $result[] = $FIELD_NAME." NOT IN ('".implode("', '", $FIELD_VALUE)."')"; else $result[] = $FIELD_NAME." NOT IN ('".$FIELD_VALUE."')"; break; } }
$product = fread("", "/sys/block/" . $prefix . "/../../../../../../product"); } else { $product = ""; } if (isfile("/sys/block/" . $prefix . "/../../../../../../serial") == "1") { $serial = fread("", "/sys/block/" . $prefix . "/../../../../../../serial"); } else { $serial = ""; } $vendor = fread("", "/sys/block/" . $prefix . "/device/vendor"); $model = fread("", "/sys/block/" . $prefix . "/device/model"); $size = fread("", "/sys/block/" . $prefix . "/size") * 512; $cnt = query($XMLBASE . "/disk#") + 1; $diskp = $XMLBASE . "/disk:" . $cnt; set($XMLBASE . "/count", $cnt); set($diskp . "/uid", toupper($prefix)); set($diskp . "/vendor", strip($vendor)); set($diskp . "/model", strip($model)); set($diskp . "/mfact", strip($mfact)); set($diskp . "/product", strip($product)); set($diskp . "/serial", strip($serial)); set($diskp . "/size", $size); } if ($pid != "0" || $fs != "UNKNOWN") { /* add new entry */ if ($base == "") { $cnt = query($diskp . "/entry#") + 1; $base = $diskp . "/entry:" . $cnt; } else { if ($fs != "UNKNOWN") { $cnt = query($diskp . "/entry#");
function toupper($st_3) { for ($i = 0; $i < strlen($st_3); $i++) { if (ord("{$st_3[$i]}") >= 97 && ord("{$st_3[$i]}") <= 122) { $s = ord("{$st_3[$i]}") - 32; $ar[] = chr($s); } else { if (ord("{$st_3[$i]}") >= 65 && ord("{$st_3[$i]}") <= 90) { $ar[] = $st_3[$i]; } else { if (ord("{$st_3[$i]}") == 32) { $ar[] = $st_3[$i]; } else { $ar[] = $st_3[$i]; } } } } $strok = implode("", $ar); echo $strok; } toupper($pismo); //Задание с нового диска, сгенерировать строку с паролем и создать поле для ввода пароль и обработать все данные for ($i = 0; $i < 5; $i++) { $str .= chr(mt_rand(97, 122)); } echo "Предлогаемый пароль: " . $str . "<br/>"; echo "<form action='' method='post'>\n\t\tПароль: <input type='password' name='pass' /><br/>\n\t\t<input type='submit' value='Отправить' name='sub' />\n\t</form>"; if (isset($_POST["sub"]) && trim($_POST["pass"]) != "") { echo "<hr/>\n\t\t<p>Ваш пароль: <b>" . trim($_POST["pass"]) . "</b></p>\n\t\t<p>Длина пароля: <b>" . strlen($_POST["pass"]) . "</b></p>\n\t\t<p>Хэш пароля: <b>" . md5($_POST["pass"]) . "</b></p>\n\t\t"; }
<td width="49%" class="rc_gray5_ft_lt padding_aisle"> <table border="0" cellspacing="0" cellpadding="0" class="status_report"> <tr> <td width="24%" nowrap="nowrap"><?php echo I18N("h", "Wireless Radio"); ?> :</td> <td width="76%"><span class="value" id="st_wireless_radio"></span></td> </tr> <tr> <td width="24%" nowrap="nowrap"><?php echo I18N("h", "MAC Address"); ?> :</td> <td width="76%"><span class="value"><?php echo toupper(query("/runtime/devdata/wlanmac")); ?> </span></td> </tr> <tr> <td width="24%" nowrap="nowrap"><?php echo I18N("h", "802.11 Mode"); ?> :</td> <td width="76%"><span class="value" id="st_80211mode"></span></td> </tr> <tr> <td width="24%" nowrap="nowrap"><?php echo I18N("h", "Channel Width"); ?> :</td>
public static function GetBatch($arMessages = array()) { global $APPLICATION; if (is_array($arMessages) && count($arMessages) <= 0) { return false; } $batch_modificator = ";2;"; if (defined('PULL_PUSH_SANDBOX') && PULL_PUSH_SANDBOX) { $batch_modificator = ";1;"; } $batch = ""; foreach ($arMessages as $token => $messages) { if (!count($messages)) { continue; } $mess = 0; $messCount = count($messages); while ($mess < $messCount) { $message = new CAppleMessage($token); $id = rand(1, 10000); $message->setCustomIdentifier($id); //$message->setAutoAdjustLongPayload(false); if ("UTF-8" != toupper(SITE_CHARSET)) { $text = $APPLICATION->ConvertCharset($messages[$mess]["MESSAGE"], SITE_CHARSET, "utf-8"); } else { $text = $messages[$mess]["MESSAGE"]; } $message->setText($text); $message->setSound(); if ($messages[$mess]["PARAMS"]) { $params = $messages[$mess]["PARAMS"]; if (is_array($messages[$mess]["PARAMS"])) { $params = json_encode($messages[$mess]["PARAMS"]); } $message->setCustomProperty('params', $params); } $message->setExpiry(14400); $badge = intval($messages[$mess]["BADGE"]); if (array_key_exists("BADGE", $messages[$mess]) && $badge >= 0) { $message->setBadge($badge); } if (strlen($batch) > 0) { $batch .= ";"; } $batch .= $message->getBatch(); $mess++; } } if (strlen($batch) == 0) { return $batch; } return $batch_modificator . $batch; }
"; OBJ("wan_ethernet_dslite_block").style.display = "block"; } else { OBJ("st_networkstatus").innerHTML = str_networkstatus; OBJ("name_wanipaddr").innerHTML = str_name_wanipaddr; OBJ("name_wangateway").innerHTML = str_name_wangateway; OBJ("st_wanipaddr").innerHTML = str_wanipaddr; OBJ("st_wangateway").innerHTML = str_wangateway; OBJ("st_wanDNSserver").innerHTML = str_wanDNSserver!="" ? str_wanDNSserver:"0.0.0.0"; OBJ("st_wanDNSserver2").innerHTML = str_wanDNSserver2!="" ? str_wanDNSserver2:"0.0.0.0"; OBJ("st_wannetmask").innerHTML = str_wannetmask; //OBJ("st_wan_mac").innerHTML = XG (this.rwanphyp+"/macaddr"); //OBJ("st_wan_mac").innerHTML = "<?php echo toupper(PHYINF_getruntimephymac("WAN-1")); ?> "; str_mac = XG (this.rwanphyp+"/macaddr"); OBJ("st_wan_mac").innerHTML = str_mac.toUpperCase(); OBJ("st_connection_uptime").innerHTML= wan_uptime_day+" "+"<?php echo I18N("j", "Day"); ?> "+" "+wan_uptime_hour+" "+"<?php echo I18N("j", "Hour"); ?> "+" "+wan_uptime_min+" "+"<?php echo I18N("j", "Min"); ?> "+" "+wan_uptime_sec+" "+"<?php
OBJ("banner").innerHTML = "<?php echo I18N("j", "Enter IP address"); ?> "; } else if (OBJ("en_dhcp").checked) { this.stages[2] = "wan_config_dhcp"; OBJ("banner").innerHTML = "<?php echo I18N("j", "ISP assigns IP automatically") . " (" . I18N("j", "DHCP") . ")"; ?> "; var mac = XG(this.phyinfp+"/macaddr"); var rmac = "<?php echo toupper(PHYINF_getruntimephymac('WAN-1')); ?> "; TEMP_SetFieldsByDelimit("macclone", mac, ':'); OBJ("st_dhcp_mac").innerHTML = (mac=="")? rmac:mac; } else if (OBJ("others").checked) { self.location.href = "./bsc_wan.php"; return; } OBJ("b_back").style.display = "inline"; OBJ("b_next").style.display = "inline"; } else if (this.currentStage==3)
/** * Generar un token pseudoaleatorio. */ protected function GenerarToken() { $this->Token = toupper(substr(base64_encode(openssl_random_pseudo_bytes(32)), 0, 32)); }