本文整理匯總了PHP中isfile函數的典型用法代碼示例。如果您正苦於以下問題:PHP isfile函數的具體用法?PHP isfile怎麽用?PHP isfile使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isfile函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: load_slp
function load_slp($lcode)
{
$slp = "/etc/sealpac/" . $lcode . ".slp";
if (isfile($slp) != "1") {
return 0;
}
sealpac($slp);
return 1;
}
示例2: main_entry
function main_entry($uid)
{
if ($uid == "") {
return "No Child UID !!";
}
/* Check parent is up or not*/
if (isfile("/var/run/CHILD." . $uid . ".UP") == 1) {
cmd("service INET." . $uid . " stop");
} else {
msg("Child interface already stopped. Do nothing.");
}
}
示例3: load_existed_slp
function load_existed_slp()
{
$slp = "/var/sealpac/sealpac.slp";
$slp2 = "/etc/sealpac/en.slp";
if (isfile($slp) != "1") {
if (isfile($slp2) != "1") {
/*unload language pack*/
sealpac("");
} else {
sealpac($slp2);
}
} else {
//+++ Jerry Kao, modified to sync, the language pack info between
// /var/sealpac/sealpac.slp and /runtime/device/langcode
$langcode = sealpac($slp);
SLP_setlangcode($langcode);
}
return 1;
}
示例4: JSTemplate
public function JSTemplate($name, $replacements = FALSE, $head = FALSE)
{
$fn = SITE_ROOT . '/ui/' . $name;
if (isfile($fn)) {
$result = file_get_contents($fn);
if (is_array($replacements)) {
foreach ($replacements as $k => $v) {
$value = str_replace("#@", '' . $this->local_unique, $this->UID() . '_' . $v);
$result = str_replace($k, $value, $result);
}
}
if ($head !== FALSE) {
$this->head_js .= $result;
} else {
$this->inline_js .= $result;
}
return $result;
} else {
plog('ui->JSTemplate(' . $name . ')', 'file not found');
return "";
}
}
示例5: IPT_build_time_command
$timecmd = "";
} else {
$timecmd = IPT_build_time_command($sch);
}
if ($poli == "ACCEPT") {
/*add drop rule*/
fwrite("a", $START, "iptables -A " . $CHAIN . " " . $timecmd . " -m mac --mac-source " . $mac . " -j LOG --log-level notice --log-prefix 'DRP:004:' \n");
fwrite("a", $START, "iptables -A " . $CHAIN . " " . $timecmd . " -m mac --mac-source " . $mac . " -j " . $policy . " \n");
} else {
if ($poli == "DROP") {
/*add accept rule*/
fwrite("a", $START, "iptables -A " . $CHAIN . " " . $timecmd . " -m mac --mac-source " . $mac . " -j RETURN \n");
}
}
XNODE_set_var($CHAIN . ".USED", "1");
}
}
// Modified by sanding chen. adjust the position of the drop rule.
// when poli is DROP, there should be one DROP rule within a chain, and it must be posited at the tail of the chain.
if ($poli == "DROP") {
fwrite("a", $START, "iptables -A " . $CHAIN . " -j LOG --log-level notice --log-prefix 'DRP:004:' \n");
fwrite("a", $START, "iptables -A " . $CHAIN . " -j " . $poli . " \n");
}
$j++;
}
/* if switch level macfilter exist, do it */
if (isfile("/usr/sbin/macfilter") == 1) {
include "/etc/services/SWITCHMACFILTER.php";
}
fwrite("a", $START, "exit 0\n");
fwrite("a", $STOP, "exit 0\n");
示例6: phyinf_setup
function phyinf_setup($ifname)
{
$phyinf = XNODE_getpathbytarget("", "phyinf", "uid", $ifname, 0);
if ($phyinf == "") {
error("9");
return;
}
if (query($phyinf . "/active") != "1") {
error("8");
return;
}
/* Set media */
$media = query($phyinf . "/media/linktype");
if ($media == "") {
$media = "AUTO";
}
phyinf_setmedia($mode, $ifname, $media);
startcmd("# PHYINF." . $ifname . ": media=" . $media . ", VID=" . $vid);
/* Set IPv6 */
if (isfile("/proc/net/if_inet6") == 1) {
/* IPv6 is disabled by default (we modified the kernel code).
* Enable IPv6 here. */
$dev = PHYINF_getifname($ifname);
if ($dev != "") {
startcmd("echo 0 > /proc/sys/net/ipv6/conf/" . $dev . "/disable_ipv6");
stopcmd("echo 1 > /proc/sys/net/ipv6/conf/" . $dev . "/disable_ipv6");
}
}
/* Set the MAC address */
$stsp = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $ifname, 0);
if ($stsp == "") {
/* The LAYOUT service should be start before PHYINF.XXX.
* We should never reach here !! */
fwrite("w", "/dev/console", "PHYINF: The LAYOUT service should be start before PHYINF !!!\n");
} else {
$mac = query($phyinf . "/macaddr");
if ($mac == "") {
$mac = XNODE_get_var("MACADDR_" . $ifname);
}
$mac = tolower($mac);
$curr = tolower(query($stsp . "/macaddr"));
startcmd("# MAC: currrent " . $curr . ", target " . $mac);
if ($mac != $curr) {
SHELL_info($_GLOBALS["START"], "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" . "!!! Bad MAC address. Device may work abnormally. !!!\n" . "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
}
}
}
示例7: session_start
<?php
session_start();
require 'config/config.php';
require 'model/functions.fn.php';
if (isset($_FILES['music']) && !empty($_FILES['music']) && isset($_POST['title']) && !empty($_POST['title'])) {
$file = $_FILES['music'];
// Si le "fichier" reçu est bien un fichier
if (isfile($file)) {
$ext = strtolower(substr(strrchr($file['name'], '.'), 1));
// Vérification des extentions
if (preg_match('/\\.(mp3|ogg)$/i', $file['name'])) {
$filename = md5(uniqid(rand(), true));
$destination = "musics/{$filename}.{$_SESSION['id']}.{$ext}";
move_uploaded_file($filename, $destination);
add_music();
header('Location: dashboard.php');
} else {
$error = 'Erreur, le fichier n\'a pas une extension autorisée !';
}
}
}
include 'view/_header.php';
include 'view/add_music.php';
include 'view/_footer.php';
示例8: i18n
</span>
<span class="delimiter">:</span>
<span class="value" id="st_aftrserver"></span>
</div>
<div class="textinput" >
<span class="name"><?php
echo i18n("DS-Lite DHCPv6 option");
?>
</span>
<span class="delimiter">:</span>
<span class="value" id="st_dslite_dhcp6opt"></span>
</div>
<div class="gap"></div>
</div>
<?php
if (isfile("/htdocs/webinc/body/st_device_3G.php") == 1) {
dophp("load", "/htdocs/webinc/body/st_device_3G.php");
}
?>
<div class="blackbox" id="lan_ethernet_block" style="display:none">
<h2><?php
echo i18n("LAN");
?>
</h2>
<div class="textinput">
<span class="name"><?php
echo i18n("MAC Address");
?>
</span>
<span class="delimiter">:</span>
<span class="value"><?php
示例9: 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";
示例10: query
if ($base == "") {
$cnt = query($diskp . "/entry#") + 1;
$base = $diskp . "/entry:" . $cnt;
} else {
if ($fs != "UNKNOWN") {
$cnt = query($diskp . "/entry#");
} else {
return;
}
}
set($diskp . "/count", $cnt);
set($base . "/uid", $UID);
set($base . "/prefix", $prefix);
set($base . "/pid", $pid);
set($base . "/fs", $fs);
if (isfile("/sbin/sfdisk") == "1" && $pid != "0") {
setattr($base . "/id", "get", "sh /etc/scripts/usbmount_fsid.sh " . $prefix . $pid);
} else {
set($base . "/id", "");
}
set($base . "/mntp", $mntp);
if ($fs == "UNKNOWN") {
set($base . "/state", "NOT MOUNTED");
set($base . "/space/size", "");
set($base . "/space/used", "");
set($base . "/space/available", "");
} else {
set($base . "/state", "MOUNTED");
set($base . "/space/size", "CALCULATING");
set($base . "/space/used", "CALCULATING");
set($base . "/space/available", "CALCULATING");
示例11: phyinf_setup
function phyinf_setup($ifname)
{
$phyinf = XNODE_getpathbytarget("", "phyinf", "uid", $ifname, 0);
if ($phyinf == "") {
pifsetup_error("9");
return;
}
if (query($phyinf . "/active") != "1") {
pifsetup_error("8");
return;
}
/* Get layout mode */
$layout = query("/runtime/device/layout");
if ($layout == "bridge") {
$mode = "1BRIDGE";
} else {
if ($layout == "router") {
$mode = query("/runtime/device/router/mode");
} else {
pifsetup_error("9");
return;
}
}
if ($mode == "") {
$mode = "1W2L";
}
/* Set media */
$media = query($phyinf . "/media/linktype");
phyinf_setmedia($mode, $ifname, $media);
/* Set IPv6 */
if (isfile("/proc/net/if_inet6") == 1) {
/**********************************************************************************
* only enable ipv6 function at br0(LAN) and eth2.2(WAN), other disable by default
*********************************************************************************/
phyinf_setipv6($mode, $ifname);
}
/* Set the MAC address */
$stsp = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $ifname, 0);
if ($stsp == "") {
/* The LAYOUT service should be start before PHYINF.XXX.
* We should never reach here !! */
fwrite("w", "/dev/console", "PHYINF: The LAYOUT service should be start before PHYINF !!!\n");
} else {
if (query($stsp . "/bridge/port#") > 0) {
/* DO NOT allow to change the bridge device's MAC address. */
startcmd("# " . $ifname . " is a bridge device, skip MAC address setting.");
} else {
$mac = PHYINF_gettargetmacaddr($mode, $ifname);
$curr = tolower(query($stsp . "/macaddr"));
if ($mac != $curr) {
fwrite("w", "/dev/console", "PHYINF." . $ifname . ": cfg[" . $mac . "] curr[" . $curr . "], restart the device !!!\n");
//startcmd('xmldbc -t "restart:3:/etc/init0.d/rcS"');
$if_name = query($stsp . "/name");
startcmd('ifconfig ' . $if_name . ' down');
startcmd('ifconfig ' . $if_name . ' hw ether ' . $mac);
startcmd('ifconfig ' . $if_name . ' up');
}
}
}
}
示例12: array_shift
array_shift($files);
array_shift($files);
//skip . and ..
$parent = $currentfolder;
function isfile($f)
{
$r = preg_match('/.jpg/', $f);
//match the jpeg files
if ($r > 0) {
return $f;
} else {
return;
}
}
echo "<p>Current Upload Image Folder:<span id=\"foldername\">{$parent}</span></p>";
echo '<ul>';
//the line below is pure chance !
echo "<li><a href=\"javascript:listimagefolder('{$folder}/')\" />Back</a></li>";
foreach ($files as $folder) {
echo "<li><a href=\"javascript:listimagefolder('{$parent}{$folder}/')\" />{$folder}</a></li>";
}
echo '</ul>';
foreach ($files as $handle) {
//process only files not directory
if (isfile($handle)) {
$image = $myMan->thumbize($handle);
echo "<div class=\"grab\" ><a href=\"{$img}{$image['4']}\">Grab url({$image['0']}x{$image['1']})</a></div><img src=\"{$tld}{$imgdir}{$image['4']}\" width=\"{$image['5']}\" height=\"{$image['6']}\" onclick=\"alert('Image name ={$image['4']}');\" />";
echo "<br style='clear:both' />";
} else {
}
}
示例13: fread
Content-Type: text/xml; charset=utf-8
<?php
echo "\\<\\?xml version='1.0' encoding='utf-8'\\?\\>";
include "/htdocs/phplib/xnode.php";
include "/htdocs/webinc/config.php";
include "/htdocs/phplib/trace.php";
$result = "OK";
$buildver = fread("s", "/etc/config/buildver");
$CurrentMajor = cut($buildver, 0, ".");
$CurrentMinor = substr(cut($buildver, 1, "."), 0, 2);
$CurrentFWVersion = $CurrentMajor . "." . $CurrentMinor;
$path_run_inf_lan1 = XNODE_getpathbytarget("/runtime", "inf", "uid", $LAN1, 0);
$FWUploadUrl = get("", $path_run_inf_lan1 . "/inet/ipv4/ipaddr") . "/fwupload.cgi";
//we run checkfw.sh in hnap.cgi, so we can get fw info. now
if (isfile("/tmp/fwinfo.xml") == 1) {
TRACE_debug("checkfw.sh success!");
$LatesMajor = substr(get("", "/runtime/firmware/fwversion/Major"), 1, 2);
$LatesMinor = get("", "/runtime/firmware/fwversion/Minor");
$LatestFWVersion = $LatesMajor . "." . $LatesMinor;
$FWDownloadUrl = get("", "/runtime/firmware/FWDownloadUrl");
} else {
TRACE_debug("checkfw.sh fail!");
$result = "ERROR";
$LatestFWVersion = "null";
$FWDownloadUrl = "null";
}
?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetFirmwareStatusResponse xmlns="http://purenetworks.com/HNAP1/">
示例14: srviptsetupall
function srviptsetupall($prefix)
{
$i = 1;
while ($i > 0) {
$ifname = $prefix . "-" . $i;
$ifpath = XNODE_getpathbytarget("", "inf", "uid", $ifname, 0);
if ($ifpath == "") {
$i = 0;
break;
}
fwrite("a", $_GLOBALS["START"], "service IPT." . $ifname . " start\n");
fwrite("a", $_GLOBALS["STOP"], "service IPT." . $ifname . " stop\n");
if (isfile("/proc/net/if_inet6") == 1) {
fwrite("a", $_GLOBALS["START"], "service IP6T." . $ifname . " start\n");
fwrite("a", $_GLOBALS["STOP"], "service IP6T." . $ifname . " stop\n");
}
$i++;
}
}
示例15: HTML
public function HTML($html, $replacements = FALSE, $body = TRUE)
{
if (isfile($html, 'html/', FALSE)) {
$html = file_get_contents('html/' . $html);
}
$out = '';
if (false_or_null($replacements) === TRUE) {
if (is_array($html)) {
foreach ($html as $h) {
$out .= $h;
}
} else {
$out = $html;
}
} else {
if (is_array($replacements)) {
if (is_array($html)) {
foreach ($html as $h) {
if (isfile($h, 'html/', FALSE)) {
$replaced = file_get_contents('html/' . $h);
} else {
$replaced = $h;
}
foreach ($replacements as $string => $replace) {
$replaced = str_replace($string, $replace, $replaced);
}
$out .= $replaced;
}
} else {
if (isfile($html, 'html/', FALSE)) {
$replaced = file_get_contents($html);
} else {
$replaced = $html;
}
foreach ($replacements as $string => $replace) {
$replaced = str_replace($string, $replace, $replaced);
}
$out = $replaced;
}
} else {
error('Page:HTML(`' . $html . '`,`' . $replacements . '`', 'replacements provided was not array');
}
}
if ($body === TRUE) {
$this->body[] = $out;
} else {
$this->head[] = $out;
}
return $out;
}