本文整理汇总了PHP中mwexec函数的典型用法代码示例。如果您正苦于以下问题:PHP mwexec函数的具体用法?PHP mwexec怎么用?PHP mwexec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mwexec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_static_route
function delete_static_route($id)
{
global $config, $a_routes;
if (!isset($a_routes[$id])) {
return;
}
$targets = array();
if (is_alias($a_routes[$id]['network'])) {
foreach (filter_expand_alias_array($a_routes[$id]['network']) as $tgt) {
if (is_ipaddrv4($tgt)) {
$tgt .= "/32";
} elseif (is_ipaddrv6($tgt)) {
$tgt .= "/128";
}
if (!is_subnet($tgt)) {
continue;
}
$targets[] = $tgt;
}
} else {
$targets[] = $a_routes[$id]['network'];
}
foreach ($targets as $tgt) {
$family = is_subnetv6($tgt) ? "-inet6" : "-inet";
mwexec("/sbin/route delete {$family} " . escapeshellarg($tgt));
}
unset($targets);
}
示例2: exec_shell_xmlrpc
function exec_shell_xmlrpc($raw_params)
{
global $config, $xmlrpc_g;
$params = xmlrpc_params_to_php($raw_params);
if (!xmlrpc_auth($params)) {
return $xmlrpc_g['return']['authfail'];
}
$shell_cmd = $params[0];
mwexec($shell_cmd);
return $xmlrpc_g['return']['true'];
}
示例3: prepare_compressed_mdir_data
function prepare_compressed_mdir_data($type)
{
global $CURRENT_USER;
/* prepare directories */
mwexec("mkdir -m 0755 -p /tmp/dspam-data/{$CURRENT_USER}/mdir");
switch ($type) {
case 0:
move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/" . $_FILES['archfile']['name']);
mwexec("/usr/local/bin/unzip /tmp/{$_FILES['archfile']['name']} -d /tmp/dspam-data/{$CURRENT_USER}/mdir");
unlink("/tmp/{$_FILES['archfile']['name']}");
break;
case 1:
move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/dspam-data/" . $_SESSION['Username'] . "/mdir/" . $_FILES['archfile']['name']);
mwexec("/usr/bin/gunzip /tmp/dspam-data/{$CURRENT_USER}/mdir/{$_FILES['archfile']['name']}");
break;
case 2:
move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/dspam-data/" . $_SESSION['Username'] . "/mdir/" . $_FILES['archfile']['name']);
mwexec("/usr/bin/bunzip2 /tmp/dspam-data/{$CURRENT_USER}/mdir/{$_FILES['archfile']['name']}");
break;
}
}
示例4: DAMAGES
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require "guiconfig.inc";
/* Defaults to this page but if no settings are present, redirect to setup page */
if (!$config['installedpackages']['miniupnpd']['config'][0]['iface_array'] || !$config['installedpackages']['miniupnpd']['config'][0]['enable']) {
Header("Location: /pkg_edit.php?xml=miniupnpd.xml&id=0");
}
if ($_POST) {
if ($_POST['clear'] == "Clear") {
mwexec("/bin/sh /usr/local/etc/rc.d/miniupnpd.sh restart");
$savemsg = "Rules have been cleared and the daemon restarted";
}
}
$rdr_entries = array();
exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret);
$now = time();
$year = date("Y");
$pgtitle = "Status: UPnP Status";
include "head.inc";
/* put your custom HTML head content here */
/* using some of the $pfSenseHead function calls */
//$pfSenseHead->addMeta("<meta http-equiv=\"refresh\" content=\"120;url={$_SERVER['SCRIPT_NAME']}\" />");
//echo $pfSenseHead->getHTML();
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
示例5: array
$dhcpdconf['range'] = array();
}
$dhcpd_enable_changed = false;
// Global Options
if (!is_numeric($pool) && !($act == "newpool")) {
$old_dhcpd_enable = isset($dhcpdconf['enable']);
$new_dhcpd_enable = $_POST['enable'] ? true : false;
if ($old_dhcpd_enable != $new_dhcpd_enable) {
/* DHCP has been enabled or disabled. The pf ruleset will need to be rebuilt to allow or disallow DHCP. */
$dhcpd_enable_changed = true;
}
$dhcpdconf['enable'] = $new_dhcpd_enable;
$dhcpdconf['staticarp'] = $_POST['staticarp'] ? true : false;
$previous = $dhcpdconf['failover_peerip'];
if ($previous != $_POST['failover_peerip']) {
mwexec("/bin/rm -rf /var/dhcpd/var/db/*");
}
$dhcpdconf['failover_peerip'] = $_POST['failover_peerip'];
$dhcpdconf['dhcpleaseinlocaltime'] = $_POST['dhcpleaseinlocaltime'];
} else {
// Options that exist only in pools
$dhcpdconf['descr'] = $_POST['descr'];
}
// Options that can be global or per-pool.
$dhcpdconf['range']['from'] = $_POST['range_from'];
$dhcpdconf['range']['to'] = $_POST['range_to'];
$dhcpdconf['defaultleasetime'] = $_POST['deftime'];
$dhcpdconf['maxleasetime'] = $_POST['maxtime'];
$dhcpdconf['netmask'] = $_POST['netmask'];
unset($dhcpdconf['winsserver']);
if ($_POST['wins1']) {
示例6: unset
$config['system'][$outdnsgwname] = $thisdnsgwname;
$pconfig[$outdnsgwname] = $thisdnsgwname;
} else {
// Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
unset($config['system'][$outdnsgwname]);
$pconfig[$outdnsgwname] = "";
}
}
if ($olddnsgwname != "" && $olddnsgwname != "none" && ($olddnsgwname != $thisdnsgwname || $olddnsservers[$dnscounter - 1] != $_POST[$dnsname])) {
// A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
// Remove the route. Later calls will add the correct new route if needed.
if (is_ipaddrv4($olddnsservers[$dnscounter - 1])) {
mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter - 1]));
} else {
if (is_ipaddrv6($olddnsservers[$dnscounter - 1])) {
mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter - 1]));
}
}
}
}
if ($changecount > 0) {
write_config($changedesc);
}
$retval = 0;
$retval = system_hostname_configure();
$retval |= system_hosts_generate();
$retval |= system_resolvconf_generate();
if (isset($config['dnsmasq']['enable'])) {
$retval |= services_dnsmasq_configure();
} elseif (isset($config['unbound']['enable'])) {
$retval |= services_unbound_configure();
示例7: gettext
echo gettext("invalid input");
}
return;
}
if (isset($_POST['filter']) && isset($_POST['killfilter'])) {
if (is_ipaddr($_POST['filter'])) {
$tokill = escapeshellarg($_POST['filter'] . "/32");
} elseif (is_subnet($_POST['filter'])) {
$tokill = escapeshellarg($_POST['filter']);
} else {
// Invalid filter
$tokill = "";
}
if (!empty($tokill)) {
$retval = mwexec("/sbin/pfctl -k {$tokill} -k 0/0");
$retval = mwexec("/sbin/pfctl -k 0.0.0.0/0 -k {$tokill}");
}
}
$pgtitle = array(gettext("Diagnostics"), gettext("Show States"));
include "head.inc";
?>
<body onload="<?php
echo $jsevents["body"]["onload"];
?>
">
<?php
include "fbegin.inc";
?>
<script type="text/javascript">
示例8: gettext
}
}
return false;
}
if ($_GET['act'] == "del") {
if (!isset($_GET['id'])) {
$input_errors[] = gettext("Wrong parameters supplied");
} else {
if (empty($a_gifs[$_GET['id']])) {
$input_errors[] = gettext("Wrong index supplied");
/* check if still in use */
} else {
if (gif_inuse($_GET['id'])) {
$input_errors[] = gettext("This gif TUNNEL cannot be deleted because it is still being used as an interface.");
} else {
mwexec("/sbin/ifconfig " . $a_gifs[$_GET['id']]['gifif'] . " destroy");
unset($a_gifs[$_GET['id']]);
write_config();
header("Location: interfaces_gif.php");
exit;
}
}
}
}
$pgtitle = array(gettext("Interfaces"), gettext("GIFs"));
$shortcut_section = "interfaces";
include "head.inc";
if ($input_errors) {
print_input_errors($input_errors);
}
$tab_array = array();
示例9: build_link_list
function build_link_list()
{
global $config, $pconfig;
$linklist = array('list' => array(), 'selected' => array());
$selected_ports = array();
if (is_array($pconfig['interfaces'])) {
$selected_ports = $pconfig['interfaces'];
} elseif (!empty($pconfig['interfaces'])) {
$selected_ports = explode(',', $pconfig['interfaces']);
}
if (!is_dir("/var/spool/lock")) {
mwexec("/bin/mkdir -p /var/spool/lock");
}
if ($pconfig['type'] == 'ppp') {
$serialports = glob("/dev/cua[a-zA-Z][0-9]{,.[0-9],.[0-9][0-9],[0-9],[0-9].[0-9],[0-9].[0-9][0-9]}", GLOB_BRACE);
$serport_count = 0;
foreach ($serialports as $port) {
$serport_count++;
$linklist['list'][$port] = trim($port);
if (in_array($port, $selected_ports)) {
array_push($linklist['selected'], $port);
}
}
} else {
$port_count = 0;
$portlist = get_interface_list();
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
foreach ($config['vlans']['vlan'] as $vlan) {
$portlist[$vlan['vlanif']] = $vlan;
}
}
foreach ($portlist as $ifn => $ifinfo) {
$port_count++;
$string = "";
if (is_array($ifinfo)) {
$string .= $ifn;
if ($ifinfo['mac']) {
$string .= " ({$ifinfo['mac']})";
}
if ($ifinfo['friendly']) {
$string .= " - {$ifinfo['friendly']}";
}
if ($ifinfo['descr']) {
$string .= " - {$ifinfo['descr']}";
}
} else {
$string .= $ifinfo;
}
$linklist['list'][$ifn] = $string;
if (in_array($ifn, $selected_ports)) {
array_push($linklist['selected'], $ifn);
}
}
if ($serport_count > $port_count) {
$port_count = $serport_count;
}
}
return $linklist;
}
示例10: isset
$pconfig['enable'] = isset($config['syslog']['enable']);
$pconfig['logdefaultblock'] = empty($config['syslog']['nologdefaultblock']);
$pconfig['logdefaultpass'] = empty($config['syslog']['nologdefaultpass']);
$pconfig['logbogons'] = empty($config['syslog']['nologbogons']);
$pconfig['logprivatenets'] = empty($config['syslog']['nologprivatenets']);
$pconfig['loglighttpd'] = empty($config['syslog']['nologlighttpd']);
$pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions'];
$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
$pconfig['logfilesize'] = !empty($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : null;
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($_POST['action']) && $_POST['action'] == "resetlogs") {
clear_all_log_files();
$savemsg = gettext("The log files have been reset.");
} elseif (!empty($_POST['action']) && $_POST['action'] == "ResetRRD") {
$savemsg = gettext('RRD data has been cleared.');
mwexec('/bin/rm /var/db/rrd/*');
enable_rrd_graphing();
setup_gateways_monitor();
} else {
$input_errors = array();
$pconfig = $_POST;
/* input validation */
if (!empty($pconfig['enable']) && !is_valid_syslog_server($pconfig['remoteserver'])) {
$input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1.");
}
if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver2']) && !is_valid_syslog_server($pconfig['remoteserver2'])) {
$input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2.");
}
if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver3']) && !is_valid_syslog_server($_POST['remoteserver3'])) {
$input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #3.");
}
示例11: sprintf
if ($cpent['zone'] == $_POST['zone']) {
$input_errors[] = sprintf("[%s] %s.", $_POST['zone'], gettext("already exists"));
break;
}
}
if (!$input_errors) {
$cpzone = strtolower($_POST['zone']);
$a_cp[$cpzone] = array();
$a_cp[$cpzone]['zone'] = str_replace(" ", "", $_POST['zone']);
$a_cp[$cpzone]['descr'] = $_POST['descr'];
write_config();
/* make sure ipfw is loaded */
if (!is_module_loaded("ipfw.ko")) {
filter_load_ipfw();
}
mwexec("/usr/local/sbin/ipfw_context -a {$cpzone}", true);
header("Location: services_captiveportal.php?zone={$cpzone}");
exit;
}
}
include "head.inc";
include "fbegin.inc";
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php
if ($input_errors) {
print_input_errors($input_errors);
}
?>
<form action="services_captiveportal_zones_edit.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
示例12: pconfig_to_address
pconfig_to_address($ipsecent['local-subnet'], $_POST['localnet'], $_POST['localnetmask']);
$ipsecent['remote-subnet'] = $_POST['remotenet'] . "/" . $_POST['remotebits'];
/* if the old endpoint is different from the new one we make sure to purge
* the old policy and add a new one. If the old endpoint IP is empty we
* only add new SPD entries. */
if (!is_ipaddr($oldipsecent['remote-gateway'])) {
$oldipsecent['remote-gateway'] = resolve_retry($oldipsecent['remote-gateway']);
}
if ($ipsecent['remote-gateway'] != $_POST['remotegw']) {
if (!is_ipaddr($ipsecent['remote-gateway'])) {
$ipsecent['remote-gateway'] = resolve_retry($ipsecent['remote-gateway']);
}
/* if the remote gateway changed and the interface is not WAN then remove route */
/* the vpn_ipsec_configure() handles adding the route */
if ($_POST['interface'] != "wan") {
mwexec("/sbin/route delete -host {$ipsecent['remote-gateway']}");
}
}
$ipsecent['remote-gateway'] = $_POST['remotegw'];
$ipsecent['dpddelay'] = $_POST['dpddelay'];
$ipsecent['p1']['mode'] = $_POST['p1mode'];
$ipsecent['p1']['myident'] = array();
switch ($_POST['p1myidentt']) {
case 'myaddress':
$ipsecent['p1']['myident']['myaddress'] = true;
break;
case 'address':
$ipsecent['p1']['myident']['address'] = $_POST['p1myident'];
break;
case 'fqdn':
$ipsecent['p1']['myident']['fqdn'] = $_POST['p1myident'];
示例13: service_control_stop
function service_control_stop($name, $extras)
{
switch ($name) {
case 'radvd':
killbypid("/var/run/radvd.pid");
break;
case 'ntpd':
killbyname("ntpd");
break;
case 'apinger':
killbypid("/var/run/apinger.pid");
break;
case 'bsnmpd':
killbypid("/var/run/snmpd.pid");
break;
case 'choparp':
killbyname("choparp");
break;
case 'dhcpd':
killbyname("dhcpd");
break;
case 'dhcrelay':
killbypid("/var/run/dhcrelay.pid");
break;
case 'dhcrelay6':
killbypid("/var/run/dhcrelay6.pid");
break;
case 'dnsmasq':
killbypid("/var/run/dnsmasq.pid");
break;
case 'unbound':
killbypid("/var/run/unbound.pid");
break;
case 'igmpproxy':
killbyname("igmpproxy");
break;
case 'miniupnpd':
upnp_action('stop');
break;
case 'sshd':
killbyname("sshd");
break;
case 'ipsec':
exec("/usr/local/sbin/ipsec stop");
break;
case 'openvpn':
$vpnmode = htmlspecialchars($extras['vpnmode']);
if ($vpnmode == "server" or $vpnmode == "client") {
$id = htmlspecialchars($extras['id']);
$pidfile = "/var/run/openvpn_{$vpnmode}{$id}.pid";
killbypid($pidfile);
}
break;
case 'relayd':
mwexec('pkill relayd');
break;
case 'squid':
configd_run("proxy stop");
break;
case 'suricata':
configd_run("ids stop");
break;
default:
log_error(sprintf(gettext("Could not stop unknown service `%s'"), $name));
break;
}
return sprintf(gettext("%s has been stopped."), htmlspecialchars($name));
}
示例14: array_diff
$addmembers = array_diff($nmembers, $omembers);
if (count($delmembers) > 0 || count($addmembers) > 0) {
$fd = fopen("{$g['tmp_path']}/netgraphcmd", "w");
foreach ($delmembers as $tag) {
fwrite($fd, "shutdown {$qinqentry['vlanif']}h{$tag}:\n");
fwrite($fd, "msg {$qinqentry['vlanif']}qinq: delfilter \\\"{$qinqentry['vlanif']}{$tag}\\\"\n");
}
foreach ($addmembers as $member) {
$qinq = array();
$qinq['if'] = $qinqentry['vlanif'];
$qinq['tag'] = $member;
$macaddr = get_interface_mac($qinqentry['vlanif']);
interface_qinq2_configure($qinq, $fd, $macaddr);
}
fclose($fd);
mwexec("/usr/sbin/ngctl -f {$g['tmp_path']}/netgraphcmd");
}
$a_qinqs[$id] = $qinqentry;
} else {
interface_qinq_configure($qinqentry);
$a_qinqs[] = $qinqentry;
}
if ($_POST['autogroup'] == "yes") {
if (!is_array($config['ifgroups']['ifgroupentry'])) {
$config['ifgroups']['ifgroupentry'] = array();
}
foreach ($config['ifgroups']['ifgroupentry'] as $gid => $group) {
if ($group['ifname'] == "QinQ") {
$found = true;
break;
}
示例15: array
// Display the page title, based on the constants defined in lang.inc
$pgtitle = array(_THEBRIG_EXTN, _THEBRIG_TITLE, _THEBRIG_TARBALL_MGMT);
// add array Freebsd ftp servers
$ftp_servers = array("ftp1.freebsd.org", "ftp2.freebsd.org", "ftp3.freebsd.org", "ftp4.freebsd.org", "ftp5.freebsd.org", "ftp.freebsd.org", "ftp6.freebsd.org", "ftp7.freebsd.org", "ftp10.FreeBSD.org", "ftp11.FreeBSD.org", "ftp13.FreeBSD.org", "ftp14.FreeBSD.org");
// This checks if we have successfully contacted a ftp server - the existence of /tmp/ftpsen gives us a clue about that. If the file
// exists, then we should read the number stored there - it will tell us which server to use. If it doesn't exist, start at 0.
if (!is_file("/tmp/ftpsen")) {
file_put_contents("/tmp/ftpsen", "0");
}
if (!isset($config['thebrig']['rootfolder']) || !is_dir($config['thebrig']['rootfolder'] . "work")) {
$input_errors[] = _THEBRIG_NOT_CONFIRMED;
}
// end of elseif
if ($_POST) {
$cmd = "touch " . $config['thebrig']['rootfolder'] . "thebrigerror.txt";
mwexec($cmd);
unset($input_errors);
// clear out the input errors array
$pconfig = $_POST;
mwexec2("uname -m", $arch);
// Obtain the machine architecture
$arch = $arch[0];
// Extract the first string from the array
mwexec2("uname -r | cut -d- -f1-2", $rel);
// Obtain the current kernel release
$rel = $rel[0];
// Extract the first string from the array
// This first error check is verifying that at least one file was selected for deletion.
// If the "Delete" button was pressed, then we need to check for that, and then grab
// the list of files selected, and see how big that array is (count). If the size is less than
// one (implying that it is 0), then nothing has been selected, and we need to let the user know.