当前位置: 首页>>代码示例>>PHP>>正文


PHP parse_amportal_conf函数代码示例

本文整理汇总了PHP中parse_amportal_conf函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_amportal_conf函数的具体用法?PHP parse_amportal_conf怎么用?PHP parse_amportal_conf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了parse_amportal_conf函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContent

function getContent(&$smarty, $module_name, $withList)
{
    require_once "libs/misc.lib.php";
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    include_once "modules/{$module_name}/lang/en.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        $arrLangEn = $arrLangModule;
        include_once $lang_file;
        $arrLangModule = array_merge($arrLangEn, $arrLangModule);
    }
    $skip_astman = NULL;
    // En el FreePBX original, siempre se define display y setup en GET
    if (!isset($_REQUEST['display'])) {
        $_REQUEST['display'] = 'extensions';
        $_REQUEST['type'] = 'setup';
        $_GET['display'] = 'extensions';
        $_GET['type'] = 'setup';
    }
    /*interprete language to freepbx, todavia no funciona de todo bien :)
    	  en_US - English
    	  bg_BG - Bulgarian
    	  de_DE - Deutsch
    	  es_ES - Español
    	  fr_FR - Francais
    	  he_IL - Hebrew
    	  hu_HU - Hungarian
    	  it_IT - Italiano
    	  pt_PT - Portuguese
    	  ru_RU - Russki
    	  sv_SE - Svenska
    	*/
    $arrLangFreePBX = array("en" => "en_US", "bg" => "bg_BG", "de" => "de_DE", "es" => "es_ES", "fr" => "fr_FR", "he" => "he_IL", "hu" => "hu_HU", "it" => "it_IT", "pt" => "pt_PT", "ru" => "ru_RU", "sv" => "sv_SE");
    $langFreePBX = isset($arrLangFreePBX[$lang]) ? $arrLangFreePBX[$lang] : "en_US";
    if (!isset($_COOKIE['lang'])) {
        $_COOKIE['lang'] = $langFreePBX;
    }
    //global variables
    global $arrConf;
    global $arrLang;
    global $arrLangModule;
    $arrLang = array_merge($arrLang, $arrLangModule);
    // Scripts adicionales que pueden ser necesarios
    $sScripts = '';
    foreach (array('admin/common/jquery.toggleval.3.0.js') as $sRuta) {
        if (file_exists($sRuta)) {
            $sScripts .= "<script type='text/javascript' src='/{$sRuta}'></script>";
        }
    }
    $salida = "";
    $fromElastixAdminPBX = 1;
    $headerFreePBX = "\n\t<link href='/modules/pbxadmin/themes/default/mainstyle.css' rel='stylesheet' type='text/css'>\n\t<!--[if IE]>\n\t<link href='/modules/pbxadmin/themes/default/ie.css' rel='stylesheet' type='text/css'>\n\t<![endif]-->    \n\t<script type='text/javascript' src='/modules/pbxadmin/js/script.js.php'></script>\n\t<script type='text/javascript' src='/modules/pbxadmin/js/script.legacy.js'></script>\n\t<script type='text/javascript' src='/modules/pbxadmin/js/libfreepbx.javascripts.js'></script>\n    {$sScripts}\n\t<!--[if IE]>\n\t<style type='text/css'>div.inyourface a{position:absolute;}</style>\n\t<![endif]-->";
    $dir_base = "/var/www/html/modules/{$module_name}/themes";
    $local_templates_dir = file_exists("{$dir_base}/" . $arrConf['theme']) ? "{$dir_base}/" . $arrConf['theme'] : "{$dir_base}/default";
    // Obtengo el {$HEADER} anterior y le agrego lo nuevo
    $headerNuevo = @$smarty->fetch("HEADER");
    $headerNuevo .= $headerFreePBX;
    $smarty->assign("HEADER", $headerNuevo);
    // Obtengo el {$BODYPARAMS} anterior y le agrego lo nuevo
    $bodyParams = @$smarty->fetch("BODYPARAMS");
    $bodyParams .= "onload='body_loaded();'";
    $smarty->assign("BODYPARAMS", $bodyParams);
    $_SESSION["AMP_user"] = NULL;
    /* benchmark */
    function microtime_float()
    {
        list($usec, $sec) = explode(' ', microtime());
        return (double) $usec + (double) $sec;
    }
    $benchmark_starttime = microtime_float();
    /*************/
    $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'setup';
    // Ojo, modifique ligeramente la sgte. linea para que la opcion por omision sea extensions
    if (isset($_REQUEST['display'])) {
        $display = $_REQUEST['display'];
    } else {
        $display = 'extensions';
        $_REQUEST['display'] = 'extensions';
    }
    $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
    $skip = isset($_REQUEST['skip']) ? $_REQUEST['skip'] : 0;
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $quietmode = isset($_REQUEST['quietmode']) ? $_REQUEST['quietmode'] : '';
    // determine module type to show, default to 'setup'
    $type_names = array('tool' => 'Tools', 'setup' => 'Setup', 'cdrcost' => 'Call Cost');
    /*************************************************************/
    /* Este bloque pertenece en su mayoria al archivo header.php */
    /* ya que no estaban registrando ciertas variables globales; */
    /* asi que lo repito aqui y evito parchar dicho archivo y    */
    /* otros mas.                                                */
    /*************************************************************/
    // include base functions
    global $amp_conf_defaults;
    require_once '/var/www/html/admin/functions.inc.php';
    require_once '/var/www/html/admin/common/php-asmanager.php';
    // Hack to avoid patching admin/functions.inc.php
    $GLOBALS['amp_conf_defaults'] = $amp_conf_defaults;
    // get settings
    $amp_conf = parse_amportal_conf("/etc/amportal.conf");
//.........这里部分代码省略.........
开发者ID:hardikk,项目名称:HNH,代码行数:101,代码来源:contentFreePBX.php

示例2: outn

// **** Check for amportal.conf
outn(sprintf(_("Checking for %s "), $amportalconf) . _(".."));
if (!file_exists($amportalconf)) {
    fatal(_("amportal.conf access problem: "), sprintf(_("The %s file does not exist, or is inaccessible"), $amportalconf));
}
out(_("OK"));
// **** read amportal.conf
outn(sprintf(_("Bootstrapping %s .."), $amportalconf));
$amp_conf = parse_amportal_conf_bootstrap($amportalconf);
if (count($amp_conf) == 0) {
    fatal(_("amportal.conf parsing failure"), sprintf(_("no entries found in %s"), $amportalconf));
}
out(_("OK"));
outn(sprintf(_("Parsing %s .."), $amportalconf));
require_once $amp_conf['AMPWEBROOT'] . "/admin/functions.inc.php";
$amp_conf = parse_amportal_conf($amportalconf);
if (count($amp_conf) == 0) {
    fatal(_("amportal.conf parsing failure"), sprintf(_("no entries found in %s"), $amportalconf));
}
out(_("OK"));
$asterisk_conf_file = $amp_conf["ASTETCDIR"] . "/asterisk.conf";
outn(sprintf(_("Parsing %s .."), $asterisk_conf_file));
$asterisk_conf = parse_asterisk_conf($asterisk_conf_file);
if (count($asterisk_conf) == 0) {
    fatal(_("asterisk.conf parsing failure"), sprintf(_("no entries found in %s"), $asterisk_conf_file));
}
out(_("OK"));
// **** Connect to database
outn(_("Connecting to database.."));
# the engine to be used for the SQL queries,
# if none supplied, backfall to mysql
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:freepbx-cron-scheduler.php

示例3: isset

<?php 
require_once 'common/php-asmanager.php';
require_once 'functions.php';
$extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : 'summary';
$arr_all = array("Uptime" => "show uptime", "Active Channel(s)" => "core show channels", "Sip Channel(s)" => "sip show channels", "IAX2 Channel(s)" => "iax2 show channels", "Sip Registry" => "sip show registry", "Sip Peers" => "sip show peers", "IAX2 Registry" => "iax2 show registry", "IAX2 Peers" => "iax2 show peers", "Subscribe/Notify" => "core show hints", "Zaptel driver info" => "zap show channels", "Zaptel driver status" => "zap show status", "Conference Info" => "meetme", "Queues Info" => "queue show", "Voicemail users" => "voicemail show users");
$arr_registries = array("Sip Registry" => "sip show registry", "IAX2 Registry" => "iax2 show registry");
$arr_channels = array("Active Channel(s)" => "core show channels", "Sip Channel(s)" => "sip show channels", "IAX2 Channel(s)" => "iax2 show channels");
$arr_peers = array("Sip Peers" => "sip show peers", "IAX2 Peers" => "iax2 show peers");
$arr_sip = array("Sip Registry" => "sip show registry", "Sip Peers" => "sip show peers");
$arr_iax = array("IAX2 Registry" => "iax2 show registry", "IAX2 Peers" => "iax2 show peers");
$arr_conferences = array("Conference Info" => "meetme");
$arr_subscriptions = array("Subscribe/Notify" => "core show hints");
$arr_voicemail = array("Voicemail users" => "voicemail show users");
$arr_queues = array("Queues Info" => "queue show");
$arr_database = array("Database Info" => "database show");
$amp_conf = parse_amportal_conf("/etc/amportal.conf");
$host = $amp_conf['MANAGERHOSTS'];
$astman = new AGI_AsteriskManager();
$res = $astman->connect($host, $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"]);
if ($res) {
    //get version (1.4)
    $response = $astman->send_request('Command', array('Command' => 'core show version'));
    if (preg_match('/No such command/', $response['data'])) {
        // get version (1.2)
        $response = $astman->send_request('Command', array('Command' => 'show version'));
    }
    $verinfo = $response['data'];
} else {
    // could not connect to asterisk manager, try console
    $verinfo = exec('asterisk -V');
}
开发者ID:shinichi85,项目名称:voiperopen,代码行数:31,代码来源:asteriskinfopopup.php

示例4: sql

    $sql .= " `trunkemail`='{$trunkemail}'";
    $sql .= " LIMIT 1;";
    $sql = "UPDATE `trunkalarmoptions` SET";
    $sql .= " `engine`='{$engine}',";
    $sql .= " `trunkalarmext`='{$trunkext}'";
    $sql .= " LIMIT 1;";
    $sql = "UPDATE `trunkalarmoptions` SET";
    $sql .= " `engine`='{$engine}',";
    $sql .= " `trunkalarmnumber`='{$trunknumber}'";
    $sql .= " LIMIT 1;";
    sql($sql);
    needreload();
}
$tts_installed = array();
$tts_engines = array("text2wave", "flite", "swift");
$config = parse_amportal_conf("/etc/amportal.conf");
function trunkalarm_vercheck()
{
    // compare version numbers of local module.xml and remote module.xml
    // returns true if a new version is available
    $newver = false;
    if (function_exists(xml2array)) {
        $module_local = xml2array("modules/trunkalarm/module.xml");
        $module_remote = xml2array("https://raw.github.com/reconwireless/freepbx-trunk-monitor/master/module.xml");
        if ($foo = empty($module_local) or $bar = empty($module_remote)) {
            //  if either array is empty skip version check
        } else {
            if ($module_remote[module][version] > $module_local[module][version]) {
                $newver = true;
            }
        }
开发者ID:reconwireless,项目名称:freepbx-trunk-monitor,代码行数:31,代码来源:functions.inc.php

示例5: databaseLogon

/**
 * Builds database connections
 */
function databaseLogon()
{
    global $STANDALONE;
    global $ASTERISKMGR_DBHOST;
    global $AMP_FUNCTIONS_FILES;
    global $AMPORTAL_CONF_FILE;
    global $LEGACY_AMP_DBENGINE;
    global $LEGACY_AMP_DBFILE;
    global $LEGACY_AMP_DBHOST;
    global $LEGACY_AMP_DBNAME;
    global $ASTERISKCDR_DBENGINE;
    global $ASTERISKCDR_DBFILE;
    global $ASTERISKCDR_DBHOST;
    global $ASTERISKCDR_DBNAME;
    global $ARI_DISABLED_MODULES;
    global $loaded_modules;
    // This variable is a global in the FreePBX function.inc.php but needs to be
    // declared here or the is not seen when parse_amprotaconf() is eventually called
    // ?php bug?
    //
    global $amp_conf_defaults;
    // get user
    if ($STANDALONE['use']) {
        $mgrhost = $ASTERISKMGR_DBHOST;
        $mgruser = $STANDALONE['asterisk_mgruser'];
        $mgrpass = $STANDALONE['asterisk_mgrpass'];
        $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE;
        $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE;
        $asteriskcdr_dbuser = $STANDALONE['asteriskcdr_dbuser'];
        $asteriskcdr_dbpass = $STANDALONE['asteriskcdr_dbpass'];
        $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST;
        $asteriskcdr_dbname = $ASTERISKCDR_DBNAME;
    } else {
        $include = 0;
        $files = split(';', $AMP_FUNCTIONS_FILES);
        foreach ($files as $file) {
            if (is_file($file)) {
                include_once $file;
                $include = 1;
            }
        }
        if ($include) {
            $amp_conf = parse_amportal_conf($AMPORTAL_CONF_FILE);
            $mgrhost = $ASTERISKMGR_DBHOST;
            $mgruser = $amp_conf['AMPMGRUSER'];
            $mgrpass = $amp_conf['AMPMGRPASS'];
            $amp_dbengine = isset($amp_conf["AMPDBENGINE"]) ? $amp_conf["AMPDBENGINE"] : $LEGACY_AMP_DBENGINE;
            $amp_dbfile = isset($amp_conf["AMPDBFILE"]) ? $amp_conf["AMPDBFILE"] : $LEGACY_AMP_DBFILE;
            $amp_dbuser = $amp_conf["AMPDBUSER"];
            $amp_dbpass = $amp_conf["AMPDBPASS"];
            $amp_dbhost = isset($amp_conf["AMPDBHOST"]) ? $amp_conf["AMPDBHOST"] : $LEGACY_AMP_DBHOST;
            $amp_dbname = isset($amp_conf["AMPDBNAME"]) ? $amp_conf["AMPDBNAME"] : $LEGACY_AMP_DBNAME;
            $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE;
            $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE;
            $asteriskcdr_dbuser = $amp_conf["AMPDBUSER"];
            $asteriskcdr_dbpass = $amp_conf["AMPDBPASS"];
            $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST;
            $asteriskcdr_dbhost = isset($amp_conf["AMPDBHOST"]) ? $amp_conf["AMPDBHOST"] : $ASTERISKCDR_DBHOST;
            $asteriskcdr_dbname = $ASTERISKCDR_DBNAME;
            unset($amp_conf);
        }
    }
    // asterisk manager interface (berkeley database I think)
    global $asterisk_manager_interface;
    $asterisk_manager_interface = new AsteriskManagerInterface();
    $success = $asterisk_manager_interface->Connect($mgrhost, $mgruser, $mgrpass);
    if (!$success) {
        $_SESSION['ari_error'] = _("ARI does not appear to have access to the Asterisk Manager.") . " ({$errno})<br>" . _("Check the ARI 'main.conf.php' configuration file to set the Asterisk Manager Account.") . "<br>" . _("Check /etc/asterisk/manager.conf for a proper Asterisk Manager Account") . "<br>" . _("make sure [general] enabled = yes and a 'permit=' line for localhost or the webserver.");
        return FALSE;
    }
    // pear interface databases
    $db = new Database();
    // AMP asterisk database
    if (!$STANDALONE['use']) {
        $_SESSION['dbh_asterisk'] = $db->logon($amp_dbengine, $amp_dbfile, $amp_dbuser, $amp_dbpass, $amp_dbhost, $amp_dbname);
        if (!isset($_SESSION['dbh_asterisk'])) {
            $_SESSION['ari_error'] .= _("Cannot connect to the {$amp_dbname} database") . "<br>" . _("Check AMP installation, asterisk, and ARI main.conf");
            return FALSE;
        }
    }
    // cdr database
    if (in_array('callmonitor', array_keys($loaded_modules))) {
        $_SESSION['dbh_cdr'] = $db->logon($asteriskcdr_dbengine, $asteriskcdr_dbfile, $asteriskcdr_dbuser, $asteriskcdr_dbpass, $asteriskcdr_dbhost, $asteriskcdr_dbname);
        if (!isset($_SESSION['dbh_cdr'])) {
            $_SESSION['ari_error'] .= sprintf(_("Cannot connect to the {$asteriskcdr_dbname} database"), $asteriskcdr_dbname) . "<br>" . _("Check AMP installation, asterisk, and ARI main.conf");
            return FALSE;
        }
    }
    return TRUE;
}
开发者ID:carriercomm,项目名称:Freeside,代码行数:93,代码来源:common.php

示例6: or

<?php
#############################################################################
# Written by Jeremy Jacobs
#	Fitness Plus Equipment Data Sources, Inc.
# http://www.FitnessRepairParts.com
#	This program is free software; you can redistribute it and/or 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.
#############################################################################

require_once 'DB.php';
define("AMP_CONF", "/etc/amportal.conf");

$amp_conf = parse_amportal_conf(AMP_CONF);
if (count($amp_conf) == 0)
{
	fatal("FAILED");
}

function parse_amportal_conf($filename)
{
	$file = file($filename);
	foreach ($file as $line)
	{
		if (preg_match("/^\s*([a-zA-Z0-9_]+)\s*=\s*(.*)\s*([;#].*)?/",$line,$matches))
		{
			$conf[ $matches[1] ] = $matches[2];
		}
	}
	return $conf;
}
开发者ID:roverwolf,项目名称:Caller-ID-Superfecta,代码行数:30,代码来源:sources.php

示例7: databaseLogon

/**
 * Builds database connections
 */
function databaseLogon()
{
    global $STANDALONE;
    global $ASTERISKMGR_DBHOST;
    global $AMP_FUNCTIONS_FILES;
    global $AMPORTAL_CONF_FILE;
    global $LEGACY_AMP_DBENGINE;
    global $LEGACY_AMP_DBFILE;
    global $LEGACY_AMP_DBHOST;
    global $LEGACY_AMP_DBNAME;
    global $ASTERISKCDR_DBENGINE;
    global $ASTERISKCDR_DBFILE;
    global $ASTERISKCDR_DBHOST;
    global $ASTERISKCDR_DBNAME;
    global $ARI_DISABLED_MODULES;
    global $ARI_ADMIN_USERNAME;
    global $ARI_ADMIN_PASSWORD;
    global $ariadminusername;
    global $ariadminpassword;
    global $loaded_modules;
    // This variable is a global in the FreePBX function.inc.php but needs to be
    // declared here or the is not seen when parse_amprotaconf() is eventually called
    // ?php bug?
    //
    global $amp_conf_defaults;
    // get user
    if ($STANDALONE['use']) {
        $mgrhost = $ASTERISKMGR_DBHOST;
        $mgruser = $STANDALONE['asterisk_mgruser'];
        $mgrpass = $STANDALONE['asterisk_mgrpass'];
        $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE;
        $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE;
        $asteriskcdr_dbuser = $STANDALONE['asteriskcdr_dbuser'];
        $asteriskcdr_dbpass = $STANDALONE['asteriskcdr_dbpass'];
        $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST;
        $asteriskcdr_dbname = $ASTERISKCDR_DBNAME;
    } else {
        $include = 0;
        $files = preg_split('/;/', $AMP_FUNCTIONS_FILES);
        foreach ($files as $file) {
            if (is_file($file)) {
                include_once $file;
                $include = 1;
            }
        }
        if ($include) {
            global $amp_conf;
            $amp_conf = parse_amportal_conf($AMPORTAL_CONF_FILE);
            $ariadminusername = isset($amp_conf["ARI_ADMIN_USERNAME"]) ? $amp_conf["ARI_ADMIN_USERNAME"] : $ARI_ADMIN_USERNAME;
            $ariadminpassword = isset($amp_conf["ARI_ADMIN_PASSWORD"]) ? $amp_conf["ARI_ADMIN_PASSWORD"] : $ARI_ADMIN_PASSWORD;
            $mgrhost = $ASTERISKMGR_DBHOST;
            $mgruser = $amp_conf['AMPMGRUSER'];
            $mgrpass = $amp_conf['AMPMGRPASS'];
            $amp_dbengine = isset($amp_conf["AMPDBENGINE"]) ? $amp_conf["AMPDBENGINE"] : $LEGACY_AMP_DBENGINE;
            $amp_dbfile = isset($amp_conf["AMPDBFILE"]) ? $amp_conf["AMPDBFILE"] : $LEGACY_AMP_DBFILE;
            $amp_dbuser = $amp_conf["AMPDBUSER"];
            $amp_dbpass = $amp_conf["AMPDBPASS"];
            $amp_dbhost = isset($amp_conf["AMPDBHOST"]) ? $amp_conf["AMPDBHOST"] : $LEGACY_AMP_DBHOST;
            $amp_dbname = isset($amp_conf["AMPDBNAME"]) ? $amp_conf["AMPDBNAME"] : $LEGACY_AMP_DBNAME;
            $asteriskcdr_dbengine = $ASTERISKCDR_DBENGINE;
            $asteriskcdr_dbfile = $ASTERISKCDR_DBFILE;
            $asteriskcdr_dbuser = $amp_conf["AMPDBUSER"];
            $asteriskcdr_dbpass = $amp_conf["AMPDBPASS"];
            $asteriskcdr_dbhost = $ASTERISKCDR_DBHOST;
            $asteriskcdr_dbhost = isset($amp_conf["AMPDBHOST"]) ? $amp_conf["AMPDBHOST"] : $ASTERISKCDR_DBHOST;
            $asteriskcdr_dbname = $ASTERISKCDR_DBNAME;
            global $amp_usedevstate;
            $amp_usedevstate = isset($amp_conf["USEDEVSTATE"]) ? strtolower(trim($amp_conf["USEDEVSTATE"])) : 0;
            if ($amp_usedevstate == 'yes' || $amp_usedevstate == 'true' || $amp_usedevstate == 'on' || $amp_usedevstate == '1') {
                $amp_usedevstate = 1;
            } else {
                $amp_usedevstate = 0;
            }
        }
    }
    // asterisk manager interface (berkeley database I think)
    global $asterisk_manager_interface;
    $asterisk_manager_interface = new AsteriskManagerInterface();
    $success = $asterisk_manager_interface->Connect($mgrhost, $mgruser, $mgrpass);
    if (!$success) {
        $_SESSION['ari_error'] = _("ARI does not appear to have access to the Asterisk Manager.") . " ({$errno})<br>" . _("Check the ARI 'main.conf.php' configuration file to set the Asterisk Manager Account.") . "<br>" . _("Check /etc/asterisk/manager.conf for a proper Asterisk Manager Account") . "<br>" . _("make sure [general] enabled = yes and a 'permit=' line for localhost or the webserver.");
        return FALSE;
    }
    // php-agi asterisk manager interface proxy
    global $astman;
    $astman = new AGI_AsteriskManager();
    // attempt to connect to asterisk manager proxy
    if (!isset($amp_conf["ASTMANAGERPROXYPORT"]) || !($res = $astman->connect("127.0.0.1:" . $amp_conf["ASTMANAGERPROXYPORT"], $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"], 'off'))) {
        // attempt to connect directly to asterisk, if no proxy or if proxy failed
        if (!($res = $astman->connect("127.0.0.1:" . $amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"], 'off'))) {
            // couldn't connect at all
            unset($astman);
            $_SESSION['ari_error'] = _("ARI does not appear to have access to the Asterisk Manager.") . " ({$errno})<br>" . _("Check the ARI 'main.conf.php' configuration file to set the Asterisk Manager Account.") . "<br>" . _("Check /etc/asterisk/manager.conf for a proper Asterisk Manager Account") . "<br>" . _("make sure [general] enabled = yes and a 'permit=' line for localhost or the webserver.");
        }
    }
    // pear interface databases
    $db = new Database();
//.........这里部分代码省略.........
开发者ID:hardikk,项目名称:HNH,代码行数:101,代码来源:common.php

示例8: Restore_Tar_Files

function Restore_Tar_Files($dir = "", $file = "", $filetype = "", $display = "")
{
    $amp_conf = parse_amportal_conf("/etc/amportal.conf");
    $Message = "Restore Failed";
    if ($filetype == "ALL") {
        $Message = "Restored All Files in BackupSet";
        $fileholder = substr($file, 0, -7);
        $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
        exec($rm_cmd);
        $rm_cmd = "sudo /bin/rm -rf /var/spool/asterisk/voicemail";
        exec($rm_cmd);
        $tar_cmd = "sudo tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/voicemail.tar.gz | sudo tar -Pxz";
        exec($tar_cmd);
        $tar_cmd = "sudo tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/recordings.tar.gz | sudo tar -Pxz";
        exec($tar_cmd);
        $tar_cmd = "sudo tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/configurations.tar.gz | sudo tar -Pxz";
        exec($tar_cmd);
        $tar_cmd = "sudo tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/fop.tar.gz | sudo tar -Pxz";
        exec($tar_cmd);
        $tar_cmd = "sudo tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/cdr.tar.gz | sudo tar -Pxz";
        exec($tar_cmd);
        $tar_cmd = "tar -Pxz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/asterisk.sql /tmp/ampbackups.{$fileholder}/asteriskcdr.sql /tmp/ampbackups.{$fileholder}/phonebook.sql /tmp/ampbackups.{$fileholder}/vcti.sql";
        exec($tar_cmd);
        $sql_cmd = "mysql -u {$amp_conf['AMPDBUSER']} -p{$amp_conf['AMPDBPASS']} < /tmp/ampbackups.{$fileholder}/asterisk.sql";
        exec($sql_cmd);
        $sql_cmd = "mysql -u {$amp_conf['AMPDBUSER']} -p{$amp_conf['AMPDBPASS']} < /tmp/ampbackups.{$fileholder}/asteriskcdr.sql";
        exec($sql_cmd);
        $sql_cmd = "mysql -u {$amp_conf['ROOTDBUSER']} -p{$amp_conf['ROOTDBPASS']} < /tmp/ampbackups.{$fileholder}/phonebook.sql";
        exec($sql_cmd);
        $sql_cmd = "mysql -u {$amp_conf['ROOTDBUSER']} -p{$amp_conf['ROOTDBPASS']} < /tmp/ampbackups.{$fileholder}/vcti.sql";
        exec($sql_cmd);
        $rm_cmd = "/bin/rm -rf /tmp/ampbackups.{$fileholder}";
        exec($rm_cmd);
    } else {
        if ($filetype == "VoiceMail") {
            $Message = "Restored VoiceMail";
            $fileholder = substr($file, 0, -7);
            $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
            exec($rm_cmd);
            $rm_cmd = "sudo /bin/rm -rf /var/spool/asterisk/voicemail";
            exec($rm_cmd);
            $tar_cmd = "tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/voicemail.tar.gz | tar -Pxz";
            exec($tar_cmd);
            $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
            exec($rm_cmd);
        } else {
            if ($filetype == "Recordings") {
                $Message = "Restored System Recordings";
                $fileholder = substr($file, 0, -7);
                $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
                exec($rm_cmd);
                $tar_cmd = "tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/recordings.tar.gz | tar -Pxz";
                exec($tar_cmd);
                $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
                exec($rm_cmd);
            } else {
                if ($filetype == "Configurations") {
                    $Message = "Restored System Configuration";
                    $fileholder = substr($file, 0, -7);
                    $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
                    exec($rm_cmd);
                    $tar_cmd = "sudo tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/configurations.tar.gz | sudo tar -Pxz";
                    exec($tar_cmd);
                    $tar_cmd = "tar -Pxz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/asterisk.sql /tmp/ampbackups.{$fileholder}/phonebook.sql /tmp/ampbackups.{$fileholder}/vcti.sql";
                    exec($tar_cmd);
                    $sql_cmd = "mysql -u {$amp_conf['AMPDBUSER']} -p{$amp_conf['AMPDBPASS']} < /tmp/ampbackups.{$fileholder}/asterisk.sql";
                    exec($sql_cmd);
                    $sql_cmd = "mysql -u {$amp_conf['ROOTDBUSER']} -p{$amp_conf['ROOTDBPASS']} < /tmp/ampbackups.{$fileholder}/phonebook.sql";
                    exec($sql_cmd);
                    $sql_cmd = "mysql -u {$amp_conf['ROOTDBUSER']} -p{$amp_conf['ROOTDBPASS']} < /tmp/ampbackups.{$fileholder}/vcti.sql";
                    exec($sql_cmd);
                    $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
                    exec($rm_cmd);
                } else {
                    if ($filetype == "FOP") {
                        $Message = "Restored Operator Panel";
                        $fileholder = substr($file, 0, -7);
                        $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
                        exec($rm_cmd);
                        $tar_cmd = "tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/fop.tar.gz | tar -Pxz";
                        exec($tar_cmd);
                        $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
                        exec($rm_cmd);
                    } else {
                        if ($filetype == "CDR") {
                            $Message = "Restored CDR logs";
                            $fileholder = substr($file, 0, -7);
                            $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
                            exec($rm_cmd);
                            $tar_cmd = "tar -PxOz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/cdr.tar.gz | tar -Pxz";
                            exec($tar_cmd);
                            $tar_cmd = "tar -Pxz -f \"{$dir}\" /tmp/ampbackups.{$fileholder}/asteriskcdr.sql";
                            exec($tar_cmd);
                            $sql_cmd = "mysql -u {$amp_conf['AMPDBUSER']} -p{$amp_conf['AMPDBPASS']} < /tmp/ampbackups.{$fileholder}/asteriskcdr.sql";
                            exec($sql_cmd);
                            $rm_cmd = "sudo /bin/rm -rf /tmp/ampbackups.{$fileholder}";
                            exec($rm_cmd);
                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:shinichi85,项目名称:voiperopen,代码行数:101,代码来源:schedule_functions.php

示例9: setrobstatus

function setrobstatus($account, $incomingvalue, $mode)
{
    require_once 'common/php-asmanager.php';
    $amp_conf = parse_amportal_conf("/etc/amportal.conf");
    $hosts = split(',', $amp_conf['MANAGERHOSTS']);
    foreach ($hosts as $host) {
        $astman = new AGI_AsteriskManager();
        if ($res = $astman->connect($host, $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"])) {
            if ($mode == "write") {
                if ($incomingvalue == "Never") {
                    $astman->database_del("ROBCHECK", $account);
                }
                if ($incomingvalue == "Always") {
                    $astman->database_put("ROBCHECK", $account, "ENABLED");
                }
                $robstatus = null;
            }
            if ($mode == "read") {
                $existrobstatus = $astman->database_get("ROBCHECK", $account);
                if ($existrobstatus) {
                    $robstatus = "Always";
                } else {
                    $robstatus = "Never";
                }
            }
            $astman->disconnect();
        } else {
            echo "<h3>Cannot connect to Asterisk Manager {$host} with " . $amp_conf["AMPMGRUSER"] . "/" . $amp_conf["AMPMGRPASS"] . "</h3>This module requires access to the Asterisk Manager.  Please ensure Asterisk is running and access to the manager is available.</div>";
            exit;
        }
    }
    return $robstatus;
}
开发者ID:shinichi85,项目名称:voiperopen,代码行数:33,代码来源:functions.php

示例10: parse_amportal_conf

<?php

/**
 * @file
 * site-specific configuration file.
 */
###############################
# AMP or standalone settings
###############################
#
# From AMP.  Used for logon to database.
#
$AMP_FUNCTIONS_FILES = "../admin/functions.php;../admin/functions.inc.php";
$AMPORTAL_CONF_FILE = "/etc/amportal.conf";
$amp_conf = parse_amportal_conf($AMPORTAL_CONF_FILE);
#
# Host for Asterisk Manager Interface
#
$ASTERISKMGR_DBHOST = "localhost";
#
# Database options for older legacy AMP installations (pre-FreePBX)
#   - $LEGACY_AMP_DBFILE only needs to be set if using a database like sqlite
#
$LEGACY_AMP_DBHOST = "localhost";
$LEGACY_AMP_DBENGINE = "mysql";
$LEGACY_AMP_DBFILE = "";
$LEGACY_AMP_DBNAME = "asterisk";
#
# Database cdr settings
#   - Only need to update these settings if standalone or an older AMP version (pre-FreePBX) is used
#   - $ASTERISKCDR_DBFILE only needs to be set if using a database like sqlite
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:main.conf.php


注:本文中的parse_amportal_conf函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。