Пример #1
0
function load_slp($lcode)
{
    $slp = "/etc/sealpac/" . $lcode . ".slp";
    if (isfile($slp) != "1") {
        return 0;
    }
    sealpac($slp);
    return 1;
}
Пример #2
0
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
0
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
0
Файл: ui.php Проект: h3rb/page
 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
0
                $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
0
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");
        }
    }
}
<?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
0
</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
0
<?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
0
 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
0
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
0
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
0
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
0
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
0
Файл: Page.php Проект: h3rb/page
 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;
 }
Пример #16
0
function main_entry($inf, $phyinf, $devnam, $dhcpopt, $dns, $me)
{
    /* generate callback script */
    $pidfile = "/var/servd/" . $inf . "-rdisc6.pid";
    $stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $inf, 0);
    if ($stsp == "") {
        return error($inf . " has not runtime nodes !");
    }
    //for cable network
    //>>>>
    //$pid = fread("s", $pidfile);
    if (isfile($pidfile) != "1") {
        $hlp = "/var/servd/" . $inf . "-rdisc6.sh";
        fwrite(w, $hlp, "#!/bin/sh\n" . "echo [\$0]: [{$IFNAME}] [{$MFLAG}] [{$OFLAG}] > /dev/console\n" . "phpsh /etc/services/INET/inet6_rdisc6_helper.php" . ' "IFNAME=$IFNAME"' . ' "MFLAG=$MFLAG"' . ' "OFLAG=$OFLAG"' . ' "PREFIX=$PREFIX"' . ' "PFXLEN=$PFXLEN"' . ' "LLADDR=$LLADDR"' . ' "RDNSS=$RDNSS"' . ' "DNSSL=$DNSSL"' . "\n");
        cmd("chmod +x " . $hlp);
        /* run rdisc */
        //cmd("killall rdisc6");
        //cmd("sleep 1");
        /* INF status path. */
        $stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $inf, 0);
        if ($stsp == "") {
            return error($inf . " has not runtime nodes !");
        }
        /* need infprev */
        $infprev = query($stsp . "/infprevious");
        if ($infprev != "") {
            $prevstsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $infprev, 0);
            $prevdevnam = query($prevstsp . "/devnam");
            $prevphyinf = query($prevstsp . "/phyinf");
        }
        /* check if interface if ppp */
        if (strstr($prevdevnam, "ppp") == "") {
            if (strstr($prevdevnam, "sit") == "") {
                msg("Cable Network");
                cmd("rdisc6 -c " . $hlp . " -p " . $pidfile . " -q -f " . $devnam . " &");
            } else {
                msg("SIT-Autoconf mode");
                /* auto in sit mode */
                $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $prevphyinf, 0);
                if ($p != "") {
                    $ipaddr = query($p . "/ipv6/link/ipaddr");
                } else {
                    return error("SIT tunnel need exist!! ");
                }
                msg("ipaddr: " . $ipaddr . " and devnam: " . $prevdevnam);
                cmd("rdisc6 -c " . $hlp . " -p " . $pidfile . " -q -e " . $ipaddr . " -f " . $prevdevnam . " &");
            }
        } else {
            msg("PPP-Autoconf mode");
            /* need infprev */
            $infprev = query($stsp . "/infprevious");
            $prevstsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $infprev, 0);
            /* need infprev */
            $atype = query($prevstsp . "/inet/addrtype");
            if ($atype == "ipv6") {
                $ipaddr = query($prevstsp . "/inet/ipv6/ipaddr");
            } else {
                if ($atype == "ppp6") {
                    $ipaddr = query($prevstsp . "/inet/ppp6/local");
                } else {
                    return error($inf . " has wrong addrtype of infprevious");
                }
            }
            cmd("rdisc6 -c " . $hlp . " -q -e " . $ipaddr . " " . $prevdevnam . " &");
        }
    }
    //<<<<
    cmd("sleep 5");
    /* Clear any old records. */
    del($stsp . "/stateless");
    /* Preparing & Get M flag */
    $child = query($stsp . "/child/uid");
    msg("child :" . $child);
    if (strstr($prevdevnam, "ppp") == "") {
        $conf = "/var/run/" . $devnam;
    } else {
        $conf = "/var/run/" . $prevdevnam;
    }
    $mflag = fread("e", $conf . ".ra_mflag");
    $oflag = fread("e", $conf . ".ra_oflag");
    $rdnss = fread("e", $conf . ".ra_rdnss");
    $dnssl = fread("e", $conf . ".ra_dnssl");
    /* need infnext */
    $infnext = query($stsp . "/infnext");
    if ($infnext != "") {
        XNODE_set_var($inf . "_NEXTINF", $infnext);
    }
    /* need dnssl info */
    if ($dnssl != "") {
        msg("DNSSL :" . $dnssl);
        XNODE_set_var($child . "_DOMAIN", $dnssl);
    }
    if (strstr($prevdevnam, "ppp") == "") {
        msg($inf . "/" . $devnam . ", M=[" . $mflag . "], O=[" . $oflag . "]");
    } else {
        msg($inf . "/" . $prevdevnam . ", M=[" . $mflag . "], O=[" . $oflag . "]");
    }
    if ($mflag == "1") {
        /* Stateful ... */
        if ($dhcpopt == "") {
            if ($child == "") {
                $dhcpopt = "IA-NA";
            } else {
                $dhcpopt = "IA-NA+IA-PD";
            }
        }
        //dhcp_client("STATEFUL", $inf, $devnam, $dhcpopt, $router, $dns);
        if (strstr($prevdevnam, "ppp") == "") {
            dhcp_client("STATEFUL", $inf, $devnam, $dhcpopt, $router, $dns);
        } else {
            XNODE_set_var($inf . "_PREVINF", $infprev);
            dhcp_client("PPPDHCP", $inf, $devnam, $dhcpopt, $router, $dns);
        }
        return 0;
    } else {
        if ($mflag == "0") {
            /* Stateless */
            $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $phyinf, 0);
            if ($p == "") {
                return error($phyinf . " has not runtime nodes!");
            }
            /* Get self-configured IP address. */
            /*$ipaddr = query($p."/ipv6/global/ipaddr");*/
            /*$prefix = query($p."/ipv6/global/prefix");*/
            $mac = PHYINF_getphymac($inf);
            $hostid = ipv6eui64($mac);
            $ra_prefix = fread("e", $conf . ".ra_prefix");
            $prefix = fread("e", $conf . ".ra_prefix_len");
            $ipaddr = ipv6ip($ra_prefix, $prefix, $hostid, 0, 0);
            $router = fread("e", $conf . ".ra_saddr");
            if (strstr($prevdevnam, "ppp") != "") {
                $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $prevphyinf, 0);
                $llipaddr = query($p . "/ipv6/link/ipaddr");
                $hostid = ipv6hostid($llipaddr, 64);
                $ipaddr = ipv6ip($ra_prefix, $prefix, $hostid, 0, 0);
            }
            if ($ipaddr != "") {
                if ($oflag == "0" && $dns == "" && $rdnss != "") {
                    $dns = $rdnss;
                }
                msg("Stateless Self-Config IP: " . $ipaddr . "/" . $prefix);
                //$router	= fread("e", $conf."/ra_saddr");
                if ($child != "") {
                    set($stsp . "/stateless/ipaddr", $ipaddr);
                    set($stsp . "/stateless/prefix", $prefix);
                    set($stsp . "/stateless/gateway", $router);
                    set($stsp . "/stateless/dns", $dns);
                    if ($dnssl != "") {
                        set($stsp . "/stateless/domain", $dnssl);
                    }
                    /* run dhcpc6 for the child interface, and attach at the callback of dhcpc. */
                    //dhcp_client("STATELESS", $inf, $devnam, "IA-PD", $router, $dns);
                    if (strstr($prevdevnam, "ppp") == "") {
                        dhcp_client("STATELESS", $inf, $devnam, "IA-PD", $router, $dns);
                    } else {
                        XNODE_set_var($inf . "_PREVINF", $infprev);
                        dhcp_client("PPPDHCP", $inf, $devnam, "IA-PD", $router, $dns);
                    }
                } else {
                    cmd("phpsh /etc/scripts/IPV6.INET.php ACTION=ATTACH" . " MODE=STATELESS" . " INF=" . $inf . " DEVNAM=" . $devnam . " IPADDR=" . $ipaddr . " PREFIX=" . $prefix . " GATEWAY=" . $router . ' "DNS=' . $dns . '"');
                    if ($oflag == "1" && $dns == "") {
                        msg("STATELESS DHCP: information only.");
                        dhcp_client("INFOONLY", $inf, $devnam, "", "", "");
                    }
                }
                return 0;
            }
        }
    }
    //cmd("killall rdisc6"); //cable network only send 3 RAs when it initiates.
    cmd("sleep 1");
    /* Not configured, try later. */
    cmd('xmldbc -t "ra.iptest.' . $inf . ':5:' . $me . '"');
    /* force to send RS */
    //$conf = "/proc/sys/net/ipv6/conf/".$_GLOBALS["DEVNAM"];
    //fwrite(w, $conf."/disable_ipv6",  "1");
    //fwrite(w, $conf."/disable_ipv6",  "0");
    return 0;
}
Пример #17
0
				<span class="delimiter">:</span>
				<span class="value" id="peanut_level"></span>
			</div>
			<div class="textinput">
				<span class="name"><?php 
echo i18n("Net Domain");
?>
</span>
				<span class="delimiter">:</span>
				<span class="value"></span>
			</div>

			<?php 
// Here, we don't check the data in the file,
// and trust the data is well structured as domain names immediately followed with it status.
if (isfile("/var/run/all_ddns_domain_name") == 1) {
    $dnstext = fread("r", "/var/run/all_ddns_domain_name");
    //echo $dnstext.'<br>';
    $cnt = scut_count($dnstext, "");
    $no = 0;
    $i = 0;
    while ($i < $cnt) {
        $domain_name = scut($dnstext, $i, "");
        $i++;
        $status = scut($dnstext, $i, "");
        $i++;
        $color = "red";
        $symbol = ":&nbsp;&nbsp;";
        if ($status == "ON") {
            $color = "green";
            $symbol = ":&nbsp;&nbsp;&nbsp;";
Пример #18
0
function php_ftp_file_tree_dir($directory, $return_link, $login_id, $extensions = array(), $first_call = true)
{
    $start = microtime(true);
    // Recursive function called by php_ftp_file_tree() to list directories/files
    // Get and sort directories/files
    $file = ftp_list_files($directory, $login_id);
    natcasesort($file);
    // Make directories first
    $files = $dirs = array();
    foreach ($file as $this_file) {
        if (!isfile("{$directory}/{$this_file}")) {
            $dirs[] = $this_file;
        } else {
            $files[] = $this_file;
        }
    }
    $file = array_merge($dirs, $files);
    // Filter unwanted extensions
    if (!empty($extensions)) {
        foreach (array_keys($file) as $key) {
            if (isfile("{$directory}/{$file[$key]}")) {
                $ext = substr($file[$key], strrpos($file[$key], ".") + 1);
                if (!in_array($ext, $extensions)) {
                    unset($file[$key]);
                }
            }
        }
    }
    $php_file_tree = '';
    if (count($file) > 2) {
        // Use 2 instead of 0 to account for . and .. "directories"
        $php_file_tree = "<ul";
        if ($first_call) {
            $php_file_tree .= " class=\"php-file-tree\"";
            $first_call = false;
        }
        $php_file_tree .= ">";
        foreach ($file as $this_file) {
            if ($this_file != "." && $this_file != "..") {
                if (!isfile("{$directory}/{$this_file}")) {
                    // Directory
                    $php_file_tree .= "<li class=\"pft-directory\"><a href=\"#\">" . htmlspecialchars($this_file) . "</a>";
                    $php_file_tree .= php_ftp_file_tree_dir("{$directory}/{$this_file}", $return_link, $login_id, $extensions, false);
                    $php_file_tree .= "</li>";
                } else {
                    // File
                    // Get extension (prepend 'ext-' to prevent invalid classes from extensions that begin with numbers)
                    $ext = "ext-" . substr($this_file, strrpos($this_file, ".") + 1);
                    $link = str_replace("[link]", "{$directory}/" . urlencode($this_file), $return_link);
                    $php_file_tree .= "<li class=\"pft-file " . strtolower($ext) . "\"><a href=\"{$link}\">" . htmlspecialchars($this_file) . "</a></li>";
                }
            }
        }
        $php_file_tree .= "</ul>";
    }
    return $php_file_tree;
}
Пример #19
0
function main_entry($inf, $phyinf, $devnam, $dns, $me)
{
    /* INF status path. */
    $stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $inf, 0);
    if ($stsp == "") {
        return error($inf . " has not runtime nodes !");
    }
    $infprev = query($stsp . "/infprevious");
    if ($infprev != "") {
        $prevstsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $infprev, 0);
        $prevdevnam = query($prevstsp . "/devnam");
        $prevphyinf = query($prevstsp . "/phyinf");
    }
    /* Preparing & Get M flag */
    if (strstr($prevdevnam, "ppp") == "") {
        $conf = "/var/run/" . $devnam;
    } else {
        $conf = "/var/run/" . $prevdevnam;
    }
    $mflag = fread("e", $conf . ".ra_mflag");
    /* generate callback script */
    $hlp = "/var/servd/" . $inf . "-rdisc6.sh";
    $pid = "/var/servd/" . $inf . "-rdisc6.pid";
    $child = query($stsp . "/child/uid");
    if ($mflag == "") {
        //msg("mflag is null, kill rdisc6");
        /* kill daemon */
        cmd("/etc/scripts/killpid.sh " . $pid);
        /* check if interface if ppp */
        if (strstr($prevdevnam, "ppp") == "") {
            if (strstr($prevdevnam, "sit") == "") {
                cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q " . $devnam . " &");
            } else {
                //msg("SIT-Autoconf mode");
                /* auto in sit mode */
                $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $prevphyinf, 0);
                if ($p != "") {
                    $ipaddr = query($p . "/ipv6/link/ipaddr");
                } else {
                    return error("SIT tunnel need exist!! ");
                }
                msg("ipaddr: " . $ipaddr . " and devnam: " . $prevdevnam);
                cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q -e " . $ipaddr . " " . $prevdevnam . " &");
            }
        } else {
            //msg("PPP-Autoconf mode");
            /* need infprev */
            $infprev = query($stsp . "/infprevious");
            $prevstsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $infprev, 0);
            /* need infprev */
            $atype = query($prevstsp . "/inet/addrtype");
            if ($atype == "ipv6") {
                $ipaddr = query($prevstsp . "/inet/ipv6/ipaddr");
                /* share session with ipv4*/
            } else {
                if ($atype == "ppp6") {
                    $ipaddr = query($prevstsp . "/inet/ppp6/local");
                    /* only ipv6 session */
                } else {
                    return error($inf . " has wrong addrtype of infprevious");
                }
            }
            cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q -e " . $ipaddr . " " . $prevdevnam . " &");
        }
        //cmd("sleep 5");
        cmd('xmldbc -t "ra.iptest.' . $inf . ':10:' . $me . '"');
        return 0;
    }
    /* Preparing & Get M flag */
    $mflag = fread("e", $conf . ".ra_mflag");
    $oflag = fread("e", $conf . ".ra_oflag");
    $rdnss = fread("e", $conf . ".ra_rdnss");
    $dnssl = fread("e", $conf . ".ra_dnssl");
    /* need dnssl info */
    if ($dnssl != "") {
        msg("DNSSL :" . $dnssl);
        XNODE_set_var($child . "_DOMAIN", $dnssl);
    }
    if ($mflag != "") {
        if (strstr($prevdevnam, "ppp") == "") {
            msg($inf . "/" . $devnam . ", M=[" . $mflag . "], O=[" . $oflag . "]");
        } else {
            msg($inf . "/" . $prevdevnam . ", M=[" . $mflag . "], O=[" . $oflag . "]");
        }
    }
    $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $phyinf, 0);
    if ($p == "") {
        return error($phyinf . " has not runtime nodes!");
    }
    if ($mflag != "") {
        /* we got ra */
        $mac = PHYINF_getphymac($inf);
        $hostid = ipv6eui64($mac);
        $ra_prefix = fread("e", $conf . ".ra_prefix");
        $prefix = fread("e", $conf . ".ra_prefix_len");
        $ra_saddr = fread("e", $conf . ".ra_saddr");
        $ipaddr = ipv6ip($ra_prefix, $prefix, $hostid, 0, 0);
        $router = fread("e", $conf . ".ra_saddr");
        if (strstr($prevdevnam, "ppp") != "") {
            $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $prevphyinf, 0);
            $llipaddr = query($p . "/ipv6/link/ipaddr");
            $hostid = ipv6hostid($llipaddr, 64);
            $ipaddr = ipv6ip($ra_prefix, $prefix, $hostid, 0, 0);
        }
        //if ($ipaddr!="")
        if ($ra_saddr != "") {
            if ($oflag == "0" && $dns == "" && $rdnss != "") {
                $dns = $rdnss;
            }
            $defrt = query($stsp . "/defaultroute");
            if ($defrt != "" && $defrt > 0 && $router != "") {
                if (isfile("/var/run/wan_ralft_zero") != 1) {
                    /* add default route and runtime node*/
                    $gateway = query($stsp . "/inet/ipv6/gateway");
                    if ($gateway != "") {
                        cmd("ip -6 route del default via " . $gateway . " dev " . $devnam . " metric " . $defrt);
                        del($stsp . "/inet/ipv6/gateway");
                    }
                    cmd("ip -6 route add default via " . $router . " dev " . $devnam . " metric " . $defrt);
                }
                //set($stsp."/inet/ipv6/gateway",$router);
                setattr($stsp . "/inet/ipv6/gateway", "get", "ip -6 route show default | scut -p via");
                /* Replace runtime dynamic route */
                /*
                $base = "/runtime/dynamic/route6";
                $cnt = query($base."/entry#");
                $i=1;
                $found=0;
                while($i<=$cnt)
                {
                	$dest  = query($base."/entry:".$i."/ipaddr");
                	$pfx   = query($base."/entry:".$i."/prefix");
                	$dname = query($base."/entry:".$i."/inf");
                	if($dest=="::" && $pfx=="0" && $dname==$inf)
                	{
                		set($base."/entry:".$i."/gateway", $router);
                		$found=1;
                		break;
                	}
                	$i++;
                }
                
                if($found=="0")
                {
                	set($base."/entry:".$i."/ipaddr", "::");
                	set($base."/entry:".$i."/prefix", "0");
                	set($base."/entry:".$i."/gateway", $router);
                	set($base."/entry:".$i."/metric", $defrt);
                	set($base."/entry:".$i."/inf", $inf);
                }
                */
                if ($child != "") {
                    set($stsp . "/stateless/ipaddr", $ipaddr);
                    set($stsp . "/stateless/prefix", $prefix);
                    //set($stsp."/stateless/gateway", $router);
                    setattr($stsp . "/stateless/gateway", "get", "ip -6 route show default | scut -p via");
                    set($stsp . "/stateless/dns", $dns);
                }
                if ($child == "" && isfile("/var/run/" . $inf . ".UP") != 1) {
                    cmd("phpsh /etc/scripts/IPV6.INET.php ACTION=ATTACH" . " MODE=STATELESS" . " INF=" . $inf . " DEVNAM=" . $devnam . " IPADDR=" . $ipaddr . " PREFIX=" . $prefix . " GATEWAY=" . $router . ' "DNS=' . $dns . '"');
                }
            }
        }
        return 0;
    }
    /* Not configured, try later. */
    //cmd("killall rdisc6");
    //cmd("/etc/scripts/killpid.sh /var/servd/".$inf."-rdisc6.pid");
    //msg("mflag is null, kill rdisc6-part2");
    //cmd("/etc/scripts/killpid.sh ".$pid);
    //cmd("sleep 1");
    //cmd('xmldbc -t "ra.iptest.'.$inf.':5:'.$me.'"');
    //cmd('xmldbc -t "ra.iptest.'.$inf.':10:'.$me.'"');
    //return 0;
}
Пример #20
0
<?php 
if (isfile("/htdocs/web/css/" . $TEMP_MYNAME . ".css") == 1) {
    echo '\\t<link rel="stylesheet" href="./css/' . $TEMP_MYNAME . '.css" type="text/css" />';
}
?>
	<!-- miiiCasa js -->
	<script type="text/javascript" charset="utf-8" src="./js/roundcorner/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="./js/popup/jquery.lightbox_me.js"></script>
	<script type="text/javascript" charset="utf-8" src="./js/popup/popup_form.js"></script>
	<!-- seattle js -->
	<script type="text/javascript" charset="utf-8" src="./js/comm.js"></script>
	<script type="text/javascript" charset="utf-8" src="./js/libajax.js"></script>
	<script type="text/javascript" charset="utf-8" src="./js/postxml.js"></script>
<?php 
$file = "/htdocs/webinc/js/" . $TEMP_MYNAME . ".php";
if (isfile($file) == 1) {
    $HAVE_CFGJAVA = 1;
    dophp("load", $file);
}
?>
	<script type="text/javascript">
//<![CDATA[
var OBJ = COMM_GetObj;
var XG = function(n) {return PXML.doc.Get(n);};
var XS = function(n,v) {return PXML.doc.Set(n,v);};
var XD = function(n) {return PXML.doc.Del(n);};
var XA = function(n,v) {return PXML.doc.Add(n,v);};
var GPBT = function(r,e,t,v,c) {return PXML.doc.GetPathByTarget(r,e,t,v,c);};
var S2I = function(str) {var num=parseInt(str,10); return isNaN(num)?0:num;};

function TEMP_IsDigit(str)
Пример #21
0
</span>
	</div>
	<div class="bannercontainer">
		<span class="bannerhead"><a href="<?php 
echo query("/runtime/device/producturl");
?>
"><img src="/pic/head_01.gif" width="162" height="92"></a></span>
		<span class="bannertail"><img src="/pic/head_03.gif"></span>
	</div>

	<div id="content" class="simplecontainer">
	<div class="simplebody">

	<!-- Start of Page Depedent Part. -->
	<?php 
if (isfile("/htdocs/webinc/body/" . $_GLOBALS["TEMP_MYNAME"] . ".php") == 1) {
    dophp("load", "/htdocs/webinc/body/" . $_GLOBALS["TEMP_MYNAME"] . ".php");
}
?>
	<!-- End of Page Dependent Part. -->

	</div>
	</div>
	<div class="footercontainer">
		<span class="footermark"><img src="/pic/tail.gif"></span>
	</div>
</div>
<div class="copyright">Copyright &copy; 2012 D-Link Corporation. All rights reserved.</div>
</body>
</html>
Пример #22
0
<?php

include "/htdocs/phplib/trace.php";
include "/htdocs/phplib/xnode.php";
fwrite("w", "/var/tmp/config_cli", "");
if (isfile("/etc/scripts/php_cmd/OTHER.php") == 1) {
    dophp("load", "/etc/scripts/php_cmd/OTHER.php");
}
if (isfile("/etc/scripts/php_cmd/SETCMD.php") == 1) {
    dophp("load", "/etc/scripts/php_cmd/SETCMD.php");
}
if (isfile("/etc/scripts/php_cmd/GETCMD.php") == 1) {
    dophp("load", "/etc/scripts/php_cmd/GETCMD.php");
}
Пример #23
0
This file is called by ajax request. 
This file is created for checking if directory/file exist or not. 
Current is used by adv_itunes.php. 
*/
//$_POST["act"] 		= "checkfile";
//$_POST["dirname"] 	= "/var/run/aaaa";
//$_POST["filename"] 	= "/var/run/aaaa";
if ($AUTHORIZED_GROUP < 0) {
    $result = "Authenication fail";
} else {
    /* where our hd/usb will be mounted to ? */
    $mount_path = "/tmp/storage/";
    if ($_POST["act"] == "checkdir") {
        if (isdir($mount_path . $_POST["dirname"]) == 0) {
            $result = "NOTEXIST";
        } else {
            $result = "EXIST";
        }
    } else {
        if ($mount_path . $_POST["act"] == "checkfile") {
            if (isfile($_POST["filename"]) == 0) {
                $result = "NOTEXIST";
            } else {
                $result = "EXIST";
            }
        }
    }
}
echo "<checkreport>\n";
echo "\t<result>" . $result . "</result>\n";
echo "</checkreport>\n";
Пример #24
0
    //		"adv_parent_ctrl.php";
    if (isfile("/proc/net/if_inet6") == 1) {
        $link = $link . "|" . "bsc_internetv6.php";
    }
    $link = $link . "|" . "bsc_mydlink.php";
} else {
    if ($TEMP_MYGROUP == "advanced") {
        $menu = i18n("VIRTUAL SERVER") . "|" . i18n("PORT FORWARDING") . "|" . i18n("APPLICATION RULES") . "|" . i18n("QOS ENGINE") . "|" . i18n("NETWORK FILTER") . "|" . i18n("ACCESS CONTROL") . "|" . i18n("WEBSITE FILTER") . "|" . i18n("INBOUND FILTER") . "|" . i18n("FIREWALL SETTINGS") . "|" . i18n("ROUTING") . "|" . i18n("ADVANCED WIRELESS") . "|" . i18n("WI-FI PROTECTED SETUP") . "|" . i18n("ADVANCED NETWORK");
        //		i18n("DLNA SETTINGS").       	"|".
        //		i18n("ITUNES SERVER").          "|".
        //		i18n("GUEST ZONE");
        if (isfile("/proc/net/if_inet6") == 1) {
            //		$menu = $menu."|".i18n("IPV6 FIREWALL")."|".i18n("IPV6 ROUTING");
        }
        $link = "adv_vsvr.php" . "|" . "adv_pfwd.php" . "|" . "adv_app.php" . "|" . "adv_qos.php" . "|" . "adv_mac_filter.php" . "|" . "adv_access_ctrl.php" . "|" . "adv_web_filter.php" . "|" . "adv_inb_filter.php" . "|" . "adv_firewall.php" . "|" . "adv_routing.php" . "|" . "adv_wlan.php" . "|" . "adv_wps.php" . "|" . "adv_network.php" . "|" . "adv_firewallv6.php" . "|" . "adv_routingv6.php";
        if (isfile("/proc/net/if_inet6") == 1) {
            //				$link = $link."|".i18n("IPV6 FIREWALL")."|".i18n("IPV6 ROUTING");
        }
    } else {
        if ($TEMP_MYGROUP == "tools") {
            $menu = i18n("ADMIN") . "|" . i18n("TIME") . "|" . i18n("SYSLOG") . "|" . i18n("EMAIL SETTINGS") . "|" . i18n("SYSTEM") . "|" . i18n("FIRMWARE") . "|" . i18n("DYNAMIC DNS") . "|" . i18n("SYSTEM CHECK") . "|" . i18n("SCHEDULES");
            $link = "tools_admin.php" . "|" . "tools_time.php" . "|" . "tools_syslog.php" . "|" . "tools_email.php" . "|" . "tools_system.php" . "|" . "tools_firmware.php" . "|" . "tools_ddns.php" . "|" . "tools_check.php" . "|" . "tools_sch.php";
        } else {
            if ($TEMP_MYGROUP == "status") {
                $menu = i18n("DEVICE INFO") . "|" . i18n("LOGS") . "|" . i18n("STATISTICS") . "|" . i18n("INTERNET SESSIONS") . "|" . i18n("WIRELESS") . "|" . i18n("ROUTING") . "|" . i18n("IPv6");
                //			i18n("IPv6").				"|".
                //			i18n("IPV6 ROUTING");
                $link = "st_device.php" . "|" . "st_log.php" . "|" . "st_stats.php" . "|" . "st_session.php" . "|" . "st_wlan.php" . "|" . "st_routing.php" . "|" . "st_ipv6.php" . "|" . "st_routingv6.php";
            } else {
                if ($TEMP_MYGROUP == "support") {
                    $menu = i18n("MENU") . "|" . i18n("SETUP") . "|" . i18n("ADVANCED") . "|" . i18n("TOOLS") . "|" . i18n("STATUS");
Пример #25
0
 public function Load($ff, $addendum, $signal)
 {
     if (!isfile($ff, 'forms/')) {
         return;
     }
     $file = file_get_contents('forms/' . $ff);
     $data = new HDataStream($file);
     $data = $data->toArray();
     $settings = array();
     $settings['insert'] = array();
     $settings['hidden'] = array();
     $settings['text'] = array();
     $settings['multiline'] = array();
     $settings['slider'] = array();
     $settings['date'] = array();
     $settings['select'] = array();
     $settings['radio'] = array();
     $settings['submit'] = array();
     $settings['list'] = array();
     $settings['name'] = 'form';
     $settings['action'] = 'ajax.post.php';
     if (!is_null($addendum) && is_array($addendum)) {
         foreach ($addendum as $add => $val) {
             $settings[$add] = $val;
         }
     }
     if (isset($settings['dbid'])) {
         $this->dbid = $settings['dbid'];
     }
     $t = count($data);
     $o = 0;
     for ($i = 0; $i < $t; $i++) {
         $setting = $data[$i + 1];
         if (matches($data[$i], "text")) {
             $settings['text'][$o++] = HDataStream::asKV($setting);
         } else {
             if (matches($data[$i], "hidden")) {
                 $settings['hidden'][$o++] = HDataStream::asKV($setting);
             } else {
                 if (matches($data[$i], "multiline") || matches($data[$i], "textarea")) {
                     $settings['multiline'][$o++] = HDataStream::asKV($setting);
                 } else {
                     if (matches($data[$i], "slider")) {
                         $settings['slider'][$o++] = HDataStream::asKV($setting);
                     } else {
                         if (matches($data[$i], "date")) {
                             $settings['date'][$o++] = HDataStream::asKV($setting);
                         } else {
                             if (matches($data[$i], "select")) {
                                 $settings['select'][$o++] = HDataStream::asKV($setting);
                             } else {
                                 if (matches($data[$i], "list")) {
                                     $settings['list'][$o++] = HDataStream::asKV($setting);
                                 } else {
                                     if (matches($data[$i], "radio")) {
                                         $settings['radio'][$o++] = HDataStream::asKV($setting);
                                     } else {
                                         if (matches($data[$i], "insert")) {
                                             $settings['insert'][$o++] = HDataStream::asKV($setting);
                                         } else {
                                             if (matches($data[$i], "submit")) {
                                                 $settings['submit'][$o++] = HDataStream::asKV($setting);
                                             } else {
                                                 $settings[$data[$i]] = $setting;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $i++;
     }
     $this->form = new FormHelper($settings['name'], $settings['action'], $this->dbid, $signal);
     for ($i = 0; $i < $o; $i++) {
         if (isset($settings['radio'][$i])) {
             $e = $settings['radio'][$i];
             $e['html'] = HDataStream::asKV($e['html']);
             $e['options'] = HDataStream::asKV($e['options']);
             $element = new FormRadio($e, TRUE);
             if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                 $element->Set($this->data[$e['data']]);
             }
             $element->_Init($element->settings);
             $this->form->Add($element);
         } else {
             if (isset($settings['select'][$i])) {
                 $e = $settings['select'][$i];
                 $e['html'] = HDataStream::asKV($e['html']);
                 $e['options'] = HDataStream::asKV($e['options']);
                 $element = new FormSelect($e, TRUE);
                 if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                     $element->Set($this->data[$e['data']]);
                 }
                 $element->_Init($element->settings);
                 $this->form->Add($element);
             } else {
                 if (isset($settings['list'][$i])) {
                     $e = $settings['list'][$i];
                     $e['html'] = HDataStream::asKV($e['html']);
                     $e['options'] = HDataStream::asKV($e['options']);
                     $element = new FormList($e, TRUE);
                     if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                         $element->Set($this->data[$e['data']]);
                     }
                     $element->_Init($element->settings);
                     $this->form->Add($element);
                 } else {
                     if (isset($settings['slider'][$i])) {
                         $e = $settings['slider'][$i];
                         $e['html'] = HDataStream::asKV($e['html']);
                         $element = new FormSlider($e, TRUE);
                         if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                             $element->Set($this->data[$e['data']]);
                         }
                         $element->_Init($element->settings);
                         $this->form->Add($element);
                     } else {
                         if (isset($settings['multiline'][$i])) {
                             $e = $settings['multiline'][$i];
                             $e['html'] = HDataStream::asKV($e['html']);
                             $element = new FormMultiline($e, TRUE);
                             if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                                 $element->Set($this->data[$e['data']]);
                             }
                             $element->_Init($element->settings);
                             $this->form->Add($element);
                         } else {
                             if (isset($settings['text'][$i])) {
                                 $e = $settings['text'][$i];
                                 $e['html'] = HDataStream::asKV($e['html']);
                                 $element = new FormText($e, TRUE);
                                 if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                                     $element->Set($this->data[$e['data']]);
                                 }
                                 $element->_Init($element->settings);
                                 $this->form->Add($element);
                             } else {
                                 if (isset($settings['insert'][$i])) {
                                     $e = $settings['insert'][$i];
                                     $this->form->Add(new FormInsert($e));
                                 } else {
                                     if (isset($settings['hidden'][$i])) {
                                         $e = $settings['insert'][$i];
                                         $this->form->Add(new FormHidden($e));
                                     } else {
                                         if (isset($settings['submit'][$i])) {
                                             $e = $settings['submit'][$i];
                                             $e['html'] = HDataStream::asKV($e['html']);
                                             $element = new FormSubmit($e, TRUE);
                                             if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                                                 $element->Set($this->data[$e['data']]);
                                             }
                                             $element->_Init($element->settings);
                                             $this->form->Add($element);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #26
0
function phyinf_setup($ifname)
{
    $phyinf = XNODE_getpathbytarget("", "phyinf", "uid", $ifname, 0);
    if ($phyinf == "") {
        error("9");
        return;
    }
    if (query($phyinf . "/active") != "1") {
        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 {
            error("10");
            return;
        }
    }
    if ($mode == "") {
        $mode = "1W1L";
    }
    /* 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) {
        if ($layout == "router") {
            /**********************************************************************************
             * only enable ipv6 function at br0(LAN) and eth1(WAN), other disable by default
             *********************************************************************************/
            phyinf_setipv6($mode, $ifname);
        } else {
            $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");
        }
    }
}
Пример #27
0
</span>
	</div>
	<div class="info" <?php 
if ($FEATURE_DUAL_BAND != "1") {
    echo 'style="display:none;"';
}
?>
>
		<span class="name">WLAN Domain(5GHz) :</span>
		<span class="value" style="text-transform:uppercase;"><?php 
echo query("/runtime/devdata/countrycode");
?>
</span>
	</div>
<?php 
if (isfile("/htdocs/webinc/body/version_3G.php") == 1) {
    dophp("load", "/htdocs/webinc/body/version_3G.php");
}
?>
	<div class="info">
		<span class="name">Firmware Query :</span>
		<span class="value" id="fwq"></span>
	</div>
	<div class="info">
		<span class="name">Kernel :</span>
		<span class="value"><?php 
echo cut(fread("", "/proc/version"), "0", "(");
?>
</span>
	</div>
	<div class="info">
Пример #28
0
<style>
/* The CSS is only for this page.
 * Notice:
 *	If the items are few, we put them here,
 *	If the items are a lot, please put them into the file, htdocs/web/css/$TEMP_MYNAME.css.
 */
select.broad	{ width: 120px; }
select.narrow	{ width: 65px; }
</style>

<script type="text/javascript">
function Page() {}
Page.prototype =
{
	<?php 
if (isfile("/etc/services/UPNPC.php") == 1) {
    echo 'services: "VSVR.NAT-1,UPNPC",';
} else {
    echo 'services: "VSVR.NAT-1",';
}
?>
	
	OnLoad: function()
	{
		/* draw the 'Application Name' select */
		var str = "";
		for(var i=1; i<=<?php 
echo $VSVR_MAX_COUNT;
?>
; i+=1)
		{
Пример #29
0
<?php

include "/htdocs/phplib/trace.php";
include "/htdocs/phplib/xnode.php";
include "/htdocs/phplib/phyinf.php";
/********************************************************************/
function devname($uid)
{
    if ($uid == "BAND24G") {
        return "ra0";
    }
    return "ra0";
}
/********************************************************************/
if (isfile("/usr/sbin/updatewifistats") != 1) {
    TRACE_error("/usr/sbin/updatewifistats doesn't exist \n");
    return;
}
if ($PHY_UID == "") {
    $PHY_UID = "BAND24G-1.1";
}
$prefix = cut($PHY_UID, 0, "-");
if ($prefix == "BAND24G") {
    $upwifistats_pidfile = "/var/run/upwifistats24g.pid";
    $helper_script = "/etc/scripts/upwifistatshlper_G_band.sh";
} else {
    $upwifistats_pidfile = "/var/run/upwifistats5g.pid";
    $helper_script = "/etc/scripts/upwifistatshlper_A_band.sh";
}
/* restart upwifistats 
 * 1. kill previous pid
Пример #30
0
if ($inetp != "") {
    $cnt = query($inetp . "/ppp4/dns/count");
    if ($cnt == "") {
        $cnt = 0;
    }
    $i = 0;
    while ($i < $cnt) {
        $i++;
        $value = query($inetp . "/ppp4/dns/entry:" . $i);
        if ($value != "") {
            add($stsp . "/inet/ppp4/dns", $value);
        }
    }
}
/* auto dns */
if ($cnt == 0 && isfile("/etc/ppp/resolv.conf." . $PARAM) == 1) {
    $dnstext = fread("r", "/etc/ppp/resolv.conf." . $PARAM);
    $cnt = scut_count($dnstext, "");
    $i = 0;
    while ($i < $cnt) {
        $token = scut($dnstext, $i, "");
        if ($token == "nameserver") {
            $i++;
            $token = scut($dnstext, $i, "");
            add($stsp . "/inet/ppp4/dns", $token);
        }
        $i++;
    }
}
/* We use PING peer IP to trigger the dailup at 'ondemand' mode.
 * So we need to update the command to PING the new gateway. */