Example #1
0
 $data = '# AUTO-GENERATED BY GEMEINSCHAFT' . "\n";
 $data .= '# template:' . "\n";
 $data .= '# ' . $tpl_file . "\n";
 $data .= "\n";
 $data .= $tpl . "\n";
 $cmd = 'echo -n ' . qsa($data) . ' > ' . qsa('/etc/ntp.conf') . ' 2>>/dev/null';
 $err = 0;
 $out = array();
 @exec('sudo sh -c ' . qsa($cmd) . ' 2>>/dev/null', $out, $err);
 # generate /etc/dhcp3/dhcpd.conf
 #
 $tpl_file = '/var/lib/gemeinschaft/setup/etc-dhcp3-dhcpd.conf-tpl';
 $err = 0;
 $out = array();
 @exec('sudo chmod a+r ' . qsa($tpl_file) . ' 2>>/dev/null', $out, $err);
 $tpl = gs_file_get_contents($tpl_file);
 $tpl = preg_replace('/\\r\\n?/', "\n", $tpl);
 $tpl = trim(preg_replace('/^[ \\t]*#[^\\n]*\\n?/m', '', $tpl));
 $tpl = preg_replace('/\\n{3,}/', "\n\n", $tpl);
 $exclude_from_range = array($dotted_network);
 $tpl = preg_replace('/__GEMEINSCHAFT_DHCPD_OPTION_NETMASK__/', 'option subnet-mask ' . $dotted_netmask . ';', $tpl);
 $tpl = preg_replace('/__GEMEINSCHAFT_DHCPD_OPTION_BCASTADDR__/', 'option broadcast-address ' . $dotted_bcastaddr . ';', $tpl);
 $arr = array();
 if ($form_router) {
     $arr[] = $form_router;
     $exclude_from_range[] = $form_router;
 }
 $tpl = preg_replace('/__GEMEINSCHAFT_DHCPD_OPTION_ROUTERS__/', count($arr) > 0 ? 'option routers ' . $form_router . ';' : '', $tpl);
 $arr = array();
 if ($form_dns1) {
     $arr[] = $form_dns1;
        echo '<div style="position:relative;top:0;left:0;" class="fl">', "\n";
        echo '<h1 style="margin:0;padding:0;">', "\n";
        echo '<img style="position:absolute;top:2px;left:2px;z-index:1;" alt=" " src="', GS_URL_PATH, 'img/gpbx-shadow-32.png" />', "\n";
        echo '<img style="position:absolute;top:0px;left:0px;z-index:2;" alt="GPBX" src="', GS_URL_PATH, 'img/gpbx-32.png" />', "\n";
        echo '</h1>', "\n";
        echo '</div>', "\n";
        break;
    default:
        echo '<img alt=" " src="', GS_URL_PATH, 'img/gemeinschaft-32.png" class="fl" />', "\n";
        //echo '<h1>', __('Telefon-Manager') ,'</h1>' ,"\n";
        echo '<h1>', 'Gemeinschaft';
        if (extension_loaded('apc')) {
            # determine version if APC storage is available only
            $vers = apc_fetch('gemeinschaft_version', $was_stored);
            if (!$was_stored) {
                $vers = trim(@gs_file_get_contents('/etc/gemeinschaft/.gemeinschaft-version'));
                apc_store('gemeinschaft_version', $vers, 20);
                # store for 20 seconds
            }
            echo ' <span class="version">', htmlEnt($vers), '</span>';
            unset($was_stored, $vers);
        }
        echo '</h1>', "\n";
}
?>
</div>
<div class="tty"><a href="#a-content"><?php 
echo __('Navigation &uuml;berspringen');
?>
</a></div>
Example #3
0
">
<?php 
echo gs_form_hidden($SECTION, $MODULE);
?>
<input type="hidden" name="action" value="set-auto-check" />
<fieldset style="background:#dfd; max-width:48em;">
<legend style="font-weight:bold;"><?php 
echo 'Automatisch suchen';
?>
</legend>
<p class="text" style="margin-bottom:0; padding-bottom:1px;"><?php 
echo 'Soll automatisch regelm&auml;&szlig;ig nach verf&uuml;gbaren Upgrades gesucht werden? (Dazu m&uuml;ssen Informationen &uuml;ber die momentan installierte Version und die Hardware &uuml;bermittelt werden.)';
?>
</p>
<?php 
$auto_check = trim(@gs_file_get_contents($gpbx_userdata . 'upgrades/auto-check'));
?>
<input type="checkbox" name="auto_check" id="ipt-auto_check" value="1"<?php 
if ($auto_check === 'yes') {
    echo ' checked="checked"';
}
?>
 />
 <label for="ipt-auto_check"><?php 
echo 'Automatisch suchen';
?>
</label><br />
<input type="submit" value="<?php 
echo 'Speichern';
?>
" style="margin-top:5px;" />
Example #4
0
    $out = trim(implode("\n", $out));
    echo "<pre style=\"margin:0.1em 0.5em 1.2em 0.5em;\">\n";
    $out = htmlEnt($out);
    $out = preg_replace('/(\\/dev(?:\\/[a-zA-Z0-9\\-_.]+)+)/', '<b>$1</b>', $out);
    # needs to match e.g. "/dev/hda1", "/dev/mapper/VolGroup00-LogVol00"
    echo $out;
    echo "\n</pre>\n";
} else {
    echo "<p>?</p>\n";
}
#####################################################################
#   net dev
#####################################################################
echo '<h3>Network devices</h3>', "\n";
if (file_exists('/proc/net/dev')) {
    $out = trim(gs_file_get_contents('/proc/net/dev'));
    echo "<pre style=\"margin:0.1em 0.5em 1.2em 0.5em;\">\n";
    echo htmlEnt($out);
    echo "\n</pre>\n";
} else {
    echo "<p>?</p>\n";
}
#####################################################################
#   Asterisk version
#####################################################################
echo '<h3>Asterisk version</h3>', "\n";
$err = 0;
$out = array();
@exec('sudo asterisk -rx \'core show version\' 2>>/dev/null', $out, $err);
if ($err === 0) {
    $out = trim(implode(' ', $out));
Example #5
0
{
    return preg_replace_callback('/\\\\([0-7]{1,3})/S', create_function('$m', 'return chr(octDec($m[1]));'), $str);
}
function binary_to_hex($str)
{
    $ret = '';
    $c = strLen($str);
    for ($i = 0; $i < $c; ++$i) {
        if ($i !== 0) {
            $ret .= '-';
        }
        $ret .= str_pad(decHex(ord(@$str[$i])), 2, '0', STR_PAD_LEFT);
    }
    return $ret;
}
$data = @gs_file_get_contents($leases_file);
//echo "<pre>\n";
$leases = array();
$m = array();
preg_match_all('/^lease\\s+([0-9.]{7,15})\\s+\\{[^}]*\\}/msS', $data, $m, PREG_SET_ORDER);
unset($data);
foreach ($m as $lease_def) {
    $ip_addr = $lease_def[1];
    $lease = array('start' => null, 'end' => null, 'hwt' => null, 'mac' => null, 'name' => null, 'bstate' => 'active');
    $lease_def = subStr($lease_def[0], 6 + strLen($ip_addr) + 1);
    $lm = array();
    preg_match_all('/^\\s*([a-z\\-]+)\\s*([^;\\n$]*)/mS', $lease_def, $lm, PREG_SET_ORDER);
    foreach ($lm as $line_def) {
        switch ($line_def[1]) {
            case 'starts':
                if (preg_match('/^[0-6]\\s+([0-9]{4})\\/([0-9]{2})\\/([0-9]{2})\\s+([0-9]{2}):([0-9]{2}):([0-9]{2})/S', $line_def[2], $p)) {
Example #6
0
File: dhcpd.php Project: rkania/GS3
echo __('Verwerfen');
?>
" />
			<input type="submit" value="<?php 
echo __('Speichern');
?>
" />
		</td>
	</tr>
</tbody>
</table>
</form>

<?php 
if ($action === 'save' && !$new_dhcp_daemon_start) {
    $dhcpdconf = @gs_file_get_contents('/etc/dhcp3/dhcpd.conf');
    $dhcpdconf = preg_replace('/\\r\\n?/', "\n", $dhcpdconf);
    $dhcpdconf = trim(preg_replace('/^[ \\t]*#[^\\n]*\\n?/m', '', $dhcpdconf));
    $dhcpdconf = preg_replace('/\\n{3,}/', "\n\n", $dhcpdconf);
    ?>
<hr />
<p>
	<?php 
    echo __('Bitte konfigurieren Sie Ihren vorhandenen DHCP-Server wie folgt (Beispiel f&uuml;r den ISC DHCPd 3)');
    ?>
</p>

<textarea cols="50" rows="60" readonly="readonly" style="width:99%; padding:2px 0 2px 4px;"><?php 
    echo htmlEnt($dhcpdconf), "\n";
    unset($dhcpdconf);
    ?>
Example #7
0
        }
    }
}
# list
#
$conf_files = array();
$files = glob('/etc/gemeinschaft/asterisk/manager.conf.d-available/*.conf');
foreach ($files as $filename) {
    $filename_basename = baseName($filename);
    if (!preg_match('/^[a-zA-Z0-9\\-_.]+$/', $filename_basename)) {
        continue;
    }
    if ($filename_basename === 'ignore.conf') {
        continue;
    }
    $data = @gs_file_get_contents($filename);
    if ($data === false) {
        # file not readable
        continue;
    }
    $info = array();
    $lines = preg_split('/\\r\\n?|\\n/', $data);
    unset($data);
    $info['definition'] = array();
    $in_info_block = false;
    $after_info_block = false;
    $key = '';
    $value = '';
    foreach ($lines as $line) {
        if (!$in_info_block) {
            if (!$after_info_block) {