Example #1
0
function gs_setup_autoshow()
{
    if (gs_setup_possible()) {
        @(include_once GS_DIR . 'inc/keyval.php');
        $val = gs_keyval_get('setup_pwd');
        if ($val == '') {
            return true;
        }
        $val = gs_keyval_get('setup_show');
        if ($val === 'autoshow') {
            return true;
        }
    }
    return false;
}
Example #2
0
function gs_get_listen_to_ips($primary_only = false)
{
    /*
    if (gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
    	# return special address
    	//return ($primary_only ? array('255.255.255.255') : array('255.255.255.255'));
    	return array('255.255.255.255');
    }
    */
    //if (gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
    if (gs_get_conf('GS_INSTALLATION_TYPE') === 'gpbx') {
        return array(trim(gs_keyval_get('vlan_0_ipaddr')));
    }
    $file = GS_DIR . 'etc/listen-to-ip';
    if (!@file_exists($file)) {
        # kann entweder passieren wenn wir ein Gemeinschaft-Node sind
        # (dann ist es extrem schlecht wenn die Datei fehlt) oder wenn
        # wir ein Web-Server ohne Asterisk sind (dann ist es ok)
        gs_log(GS_LOG_DEBUG, "File \"{$file}\" not found");
        return false;
    }
    if (!is_array($lines = @file($file))) {
        gs_log(GS_LOG_DEBUG, "Failed to read \"{$file}\"");
        return false;
    }
    $ips = array();
    foreach ($lines as $line) {
        $line = trim($line);
        if ($line == '' || @$line[0] == '#') {
            continue;
        }
        if (!preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $line, $m)) {
            continue;
        }
        $ips[] = normalizeIPs($m[0]);
        if ($primary_only) {
            # only return the first IP address (our main one)
            return $ips;
        }
    }
    // remove duplicates:
    $ips = array_flip(array_flip($ips));
    sort($ips);
    return $ips;
}
Example #3
0
function _getUser_gemeinschaft()
{
    $user_entered = strToLower(trim(@$_REQUEST['login_user']));
    $pwd_entered = @$_REQUEST['login_pwd'];
    if ($user_entered == '' || $pwd_entered == '') {
        return false;
    }
    if ($user_entered === 'sysadmin' && in_array(gs_get_conf('GS_INSTALLATION_TYPE'), array('gpbx', 'single'), true)) {
        require_once GS_DIR . 'inc/keyval.php';
        $pin = trim(gs_keyval_get('setup_pwd'));
        if ($pin == '') {
            $pin = false;
        }
    } else {
        $db = gs_db_slave_connect();
        if (!$db) {
            return false;
        }
        $pin = $db->executeGetOne('SELECT `pin` FROM `users` WHERE `user`=\'' . $db->escape($user_entered) . '\'');
    }
    return $pin === $pwd_entered ? $user_entered : false;
}
Example #4
0
function gs_keyval_set($key, $val)
{
    if (!gs_keyval_is_valid_key($key)) {
        return false;
    }
    if ($val === gs_keyval_get($key)) {
        return true;
    }
    # unchanged
    /*
    $val = gs_keyval_enc($val);
    $fh = @fOpen( '/var/lib/gemeinschaft/vars/'.$key, 'wb' );
    if (! $fh) return false;
    @stream_set_write_buffer($fh, 0);
    $ok = (bool)@fWrite($fh, $val, strLen($val));
    @fClose($fh);
    return $ok;
    */
    $cmd = 'echo -n ' . qsa(gs_keyval_enc($val)) . ' > ' . qsa('/var/lib/gemeinschaft/vars/' . $key) . ' 2>>/dev/null';
    $err = 0;
    $out = array();
    @exec('sudo sh -c ' . qsa($cmd) . ' 2>>/dev/null', $out, $err);
    return $err === 0;
}
Example #5
0
	</td>
</tr>
<tr>
	<th class="r transp">
		&nbsp;
	</th>
	<td colspan="2" class="transp">
		<small><?php 
echo __('PCRE-Muster f&uuml;r Nummern ohne Vorwahl, z.B. <code>110</code>, <code>112</code>, <code>19222</code>. In Deutschland: <code>^1(?:1[0-9]{1,5}|9222)</code>');
?>
</small>
	</td>
</tr>

<?php 
$val = trim(gs_keyval_get('canonize_cbc_prefix'));
?>
<tr>
	<th class="r">
		<label for="ipt-canonize_cbc_prefix"><?php 
echo __('Call-by-Call-Pr&auml;fix');
?>
:</label>
	</th>
	<td>
		<input type="text" name="canonize_cbc_prefix" id="ipt-canonize_cbc_prefix" value="<?php 
echo htmlEnt($val);
?>
" size="10" maxlength="8" class="_admincfg" />
	</td>
	<td class="transp">
Example #6
0
File: done.php Project: rkania/GS3
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
\*******************************************************************/
defined('GS_VALID') or die('No direct access.');
if (trim(gs_keyval_get('setup_show')) === 'autoshow') {
    gs_keyval_set('setup_show', 'password');
}
?>

<div style="width:550px; border:1px solid #ccc; margin: 2em auto; padding:0 1em 1em 1em; background-color:#eee;">
<h1><?php 
echo __('Fertig');
?>
</h1>
<p>
<?php 
switch ($GS_INSTALLATION_TYPE) {
    case 'gpbx':
        echo __('Die grundlegende Netzwerk-Konfiguration der GPBX ist jetzt abgeschlossen. Bitte nehmen Sie die weiteren Einstellungen im Administrator-Bereich der normalen Web-Oberfl&auml;che vor. Nat&uuml;rlich k&ouml;nnen Sie auch sp&auml;ter wieder das Setup aufrufen.');
        break;
Example #7
0
        echo __('OK');
        ?>
" />
	</div>
	
	</form>
</div>

<?php 
    }
    ?>

<br />
<hr />
<?php 
    $can_continue = trim(gs_keyval_get('setup_net_has_changes')) !== 'yes' && $action !== 'save2';
    switch ($GS_INSTALLATION_TYPE) {
        # "system-check" unnecessary for the GPBX
        case 'gpbx':
            $prev_step = 'user';
            break;
        default:
            $prev_step = 'system-check';
            break;
    }
    echo '<div class="fl"><a href="', GS_URL_PATH, 'setup/?step=', $prev_step, '">', __('zur&uuml;ck'), '</a></div>', "\n";
    echo '<div class="fr">';
    if ($can_continue) {
        echo '<a href="', GS_URL_PATH, 'setup/?step=dhcpd"><big>', __('weiter'), '</big></a>';
    } else {
        echo '<span style="color:#999;">', __('weiter'), '</span>';
Example #8
0
File: index.php Project: rkania/GS3
        echo '<div style="margin:0 0 0 125px;"><b>[', 'setup', ']</b></div>', "\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>', 'Gemeinschaft', ' ', 'Setup', '</h1>', "\n";
}
?>
</div>
</div>

<div>
<div class="fl l" style="width:40%;">
<?php 
if (gs_keyval_get('setup_show') !== 'autoshow' && gs_keyval_get('setup_pwd') !== '') {
    echo '<a href="', gs_get_conf('GS_URL_PATH'), '">', __('zum normalen Web-Interface'), '</a>', "\n";
}
?>
</div>
<div class="fr r" style="width:60%;">
<?php 
if (@$_SESSION['login_ok'] && $step !== 'network') {
    ?>
	<form class="inline" method="post" action="<?php 
    echo GS_URL_PATH, 'setup/?step=reboot';
    ?>
">
		<input type="hidden" name="action" value="reboot" />
		<input type="submit" value="<?php 
    echo __('Neustarten');
$AASTRA_PROV_PB_NUM_RESULTS = 10;
//-----------------[  Siemens OpenStage  ]----------------//
$SIEMENS_PROV_ENABLED = false;
//...
/***********************************************************
*    CANONICAL PHONE NUMBERS (FQTN)
***********************************************************/
$CANONIZE_OUTBOUND = trim(gs_keyval_get('canonize_outbound')) === 'yes';
$CANONIZE_INTL_PREFIX = trim(gs_keyval_get('canonize_intl_prefix'));
$CANONIZE_COUNTRY_CODE = trim(gs_keyval_get('canonize_country_code'));
$CANONIZE_NATL_PREFIX = trim(gs_keyval_get('canonize_natl_prefix'));
$CANONIZE_NATL_PREFIX_INTL = trim(gs_keyval_get('canonize_natl_prefix_intl')) === 'yes';
$CANONIZE_AREA_CODE = trim(gs_keyval_get('canonize_area_code'));
$CANONIZE_LOCAL_BRANCH = trim(gs_keyval_get('canonize_local_branch'));
$CANONIZE_SPECIAL = '/' . trim(gs_keyval_get('canonize_special')) . '/';
$CANONIZE_CBC_PREFIX = trim(gs_keyval_get('canonize_cbc_prefix'));
/***********************************************************
*    DIALPLAN SETTINGS
***********************************************************/
$DP_SUBSYSTEM = false;
$DP_DIALTIMEOUT_IN = 90;
$DP_PRV_CALL_PREFIX = '*7*';
$DP_FORWARD_REQ_EXT_NUM = false;
$DP_ALLOW_DIRECT_DIAL = true;
$DP_CONNID = false;
/***********************************************************
*    MISC
***********************************************************/
$LOCK_DIR = '/tmp/';
$CALL_INIT_FROM_NET = '0.0.0.0/0';
//FIXME
Example #10
0
</form>


<?php 
}
#####################################################################
#                         change password }
#####################################################################
?>


<hr />
<?php 
//echo '<div class="fl"><a href="', GS_URL_PATH ,'setup/">', 'zur&uuml;ck' ,'</a></div>' ,"\n";
echo '<div class="fr">';
if (gs_keyval_get('setup_pwd') == '') {
    $can_continue = false;
}
/*if ($can_continue) {
	switch ($GS_INSTALLATION_TYPE) {
		# "system-check" unnecessary for the GPBX
		case 'gpbx': $next_step = 'network'     ; break;
		default    : $next_step = 'system-check'; break;
	}*/
$next_step = 'user';
echo '<a href="', GS_URL_PATH, 'setup/?step=', $next_step, '"><big>', __('weiter'), '</big></a>';
/*} else {
	echo '<span style="color:#999;">', __('weiter') ,'</span>';
}*/
echo '</div>', "\n";
echo '<br class="nofloat" />', "\n";
Example #11
0
* MA 02110-1301, USA.
\*******************************************************************/
defined('GS_VALID') or die('No direct access.');
include_once GS_DIR . 'inc/util.php';
require_once GS_DIR . 'inc/find_executable.php';
require_once GS_DIR . 'inc/keyval.php';
echo '<h2>';
if (@$MODULES[$SECTION]['icon']) {
    echo '<img alt=" " src="', GS_URL_PATH, str_replace('%s', '32', $MODULES[$SECTION]['icon']), '" /> ';
}
if (count($MODULES[$SECTION]['sub']) > 1) {
    echo $MODULES[$SECTION]['title'], ' - ';
}
echo $MODULES[$SECTION]['sub'][$MODULE]['title'];
echo '</h2>', "\n";
if (gs_keyval_get('dhcp_daemon_start') !== 'yes') {
    echo __('Der DHCP-Server auf diesem System ist nicht aktiviert.');
    return;
}
if (file_exists('/var/lib/dhcp3/dhcpd.leases')) {
    # Debian 4
    $leases_file = '/var/lib/dhcp3/dhcpd.leases';
} elseif (file_exists('/var/lib/dhcp/dhcpd.leases')) {
    # Debian 5?
    $leases_file = '/var/lib/dhcp/dhcpd.leases';
} elseif (file_exists('/var/lib/dhcpd/dhcpd.leases')) {
    # RedHat
    $leases_file = '/var/lib/dhcpd/dhcpd.leases';
} else {
    echo 'dhcpd.leases not found.';
    return;
Example #12
0
File: dhcpd.php Project: rkania/GS3
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
\*******************************************************************/
defined('GS_VALID') or die('No direct access.');
$can_continue = true;
$current_dhcp_daemon_start = trim(gs_keyval_get('dhcp_daemon_start')) === 'yes';
$action = @$_REQUEST['action'];
if ($action === 'save') {
    $new_dhcp_daemon_start = (bool) @$_REQUEST['dhcpd'];
    gs_keyval_set('dhcp_daemon_start', $new_dhcp_daemon_start ? 'yes' : 'no');
    $err = 0;
    $out = array();
    @exec('sudo /etc/init.d/dhcp3-server ' . ($new_dhcp_daemon_start ? 'restart' : 'stop') . ' 2>>/dev/null');
    $current_dhcp_daemon_start = $new_dhcp_daemon_start;
    gs_keyval_set('setup_show', 'password');
}
?>

<script type="text/javascript" src="<?php 
echo GS_URL_PATH;
?>
Example #13
0
$ports_protocols = array(1 => 'ptp', 2 => 'ptp', 3 => 'ptp', 4 => 'ptp');
//$err=0; $out=array();
//@exec('sudo /opt/gemeinschaft/sbin/gs-get-keyval cards_bri_1_ports_te_ptp 2>>/dev/null', $out, $err);
//if (preg_match_all('/[0-9]+/', @$out[0], $m)) {
if (preg_match_all('/[0-9]+/', gs_keyval_get('cards_bri_1_ports_te_ptp'), $m)) {
    foreach ($m[0] as $port) {
        $port = (int) $port;
        if (array_key_exists($port, $ports_protocols)) {
            $ports_protocols[$port] = 'ptp';
        }
    }
}
//$err=0; $out=array();
//@exec('sudo /opt/gemeinschaft/sbin/gs-get-keyval cards_bri_1_ports_te_ptmp 2>>/dev/null', $out, $err);
//if (preg_match_all('/[0-9]+/', @$out[0], $m)) {
if (preg_match_all('/[0-9]+/', gs_keyval_get('cards_bri_1_ports_te_ptmp'), $m)) {
    foreach ($m[0] as $port) {
        $port = (int) $port;
        if (array_key_exists($port, $ports_protocols)) {
            $ports_protocols[$port] = 'ptmp';
        }
    }
}
$asterisk_misdn_ports = array();
$err = 0;
$out = array();
@exec('sudo asterisk -rx \'misdn show stacks\' | grep -E \'Port [0-9]+\' 2>>/dev/null', $out, $err);
/*
  * Port 1 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:0
  * Port 2 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:0
  * Port 3 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:0