本文整理汇总了PHP中FreePBX::Config方法的典型用法代码示例。如果您正苦于以下问题:PHP FreePBX::Config方法的具体用法?PHP FreePBX::Config怎么用?PHP FreePBX::Config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreePBX
的用法示例。
在下文中一共展示了FreePBX::Config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: globalSearch
public function globalSearch()
{
$modules = \FreePBX::Modules()->getActiveModules();
// If I'm in device and user mode, don't display Extensions, and vice-versa.
$mode = \FreePBX::Config()->get('AMPEXTENSIONS');
$retarr = array();
foreach ($modules as $rawname => $m) {
if (isset($m['items'])) {
foreach ($m['items'] as $k => $v) {
if ($mode == "deviceanduser" && $v['name'] == "Extensions") {
continue;
} elseif ($mode == "extensions" && ($v['name'] == "Devices" || $v['name'] == "Users")) {
continue;
}
\modgettext::push_textdomain(strtolower($m['rawname']));
$retarr[] = array("rawname" => $rawname, "rawtext" => $v['name'], "text" => _($v['name']), "type" => "get", "dest" => !empty($v['href']) ? $v['href'] : "?display={$k}");
\modgettext::pop_textdomain();
}
}
}
$hooks = $this->FreePBX->Hooks->returnHooks();
foreach ($hooks as $hook) {
$mod = $hook['module'];
$hook = $hook['method'];
$out = \FreePBX::$mod()->{$hook}($retarr);
if (!empty($out)) {
$retarr = $out;
}
}
return $retarr;
}
示例2: getContent
public function getContent($section)
{
if (!class_exists('TimeUtils')) {
include dirname(__DIR__) . '/classes/TimeUtils.class.php';
}
if (!defined('DASHBOARD_FREEPBX_BRAND')) {
if (!empty($_SESSION['DASHBOARD_FREEPBX_BRAND'])) {
define('DASHBOARD_FREEPBX_BRAND', $_SESSION['DASHBOARD_FREEPBX_BRAND']);
} else {
define('DASHBOARD_FREEPBX_BRAND', \FreePBX::Config()->get("DASHBOARD_FREEPBX_BRAND"));
}
} else {
$_SESSION['DASHBOARD_FREEPBX_BRAND'] = DASHBOARD_FREEPBX_BRAND;
}
$brand = DASHBOARD_FREEPBX_BRAND;
if (\FreePBX::Config()->get("FREEPBX_SYSTEM_IDENT")) {
$idline = sprintf(_("<strong>'%s'</strong><br><i>(You can change this name in Advanced Settings)</i>"), \FreePBX::Config()->get("FREEPBX_SYSTEM_IDENT"));
} else {
$idline = "";
}
try {
$getsi = \FreePBX::create()->Dashboard->getSysInfo();
} catch (\Exception $e) {
}
$since = time() - $getsi['timestamp'];
$notifications = $this->getNotifications(isset($_COOKIE['dashboardShowAll']) && $_COOKIE['dashboardShowAll'] == "true");
$nots = $notifications['nots'];
$alerts = $this->getAlerts($nots);
return load_view(dirname(__DIR__) . '/views/sections/overview.php', array("showAllMessage" => $notifications['showAllMessage'], "nots" => $nots, "alerts" => $alerts, "brand" => $brand, "idline" => $idline, "version" => get_framework_version(), "since" => $since, "services" => $this->getSummary()));
}
示例3: backup__
/**
* do variable substitution
*/
function backup__($var)
{
global $amp_conf;
/*
* Substitues Config vars for __VARNAME__.
*
* If no __VAR__, return $var
* If Config var doesn't exist, throws an exception.
*/
if (!preg_match("/__(.+)__/", $var, $out)) {
return $var;
}
$ampvar = $out[1];
if (!\FreePBX::Config()->conf_setting_exists($ampvar)) {
if (isset($amp_conf[$ampvar])) {
// This is for things like AMPDBHOST which are defined in /etc/freepbx.conf
$replace = $amp_conf[$ampvar];
} else {
throw new \Exception("Was asked for FreePBX Setting '{$var}', but it doesn't exist. Can't continue.");
}
} else {
$replace = \FreePBX::Config()->get($ampvar);
}
return str_replace("__{$ampvar}__", $replace, $var);
}
示例4: __construct
public function __construct($test = false)
{
// Asterisk Directories
$this->agidir = \FreePBX::Config()->get('ASTAGIDIR');
$this->varlibdir = \FreePBX::Config()->get('ASTVARLIBDIR');
$moh = \FreePBX::Config()->get('MOHDIR');
$this->mohdir = $this->varlibdir . "/" . (!empty($moh) ? $moh : "moh");
$this->etcdir = \FreePBX::Config()->get('ASTETCDIR');
$this->logdir = \FreePBX::Config()->get('ASTLOGDIR');
$this->moddir = \FreePBX::Config()->get('ASTMODDIR');
$this->rundir = \FreePBX::Config()->get('ASTRUNDIR');
$this->spooldir = \FreePBX::Config()->get('ASTSPOOLDIR');
$this->webroot = \FreePBX::Config()->get('AMPWEBROOT');
$this->sbindir = \FreePBX::Config()->get('AMPSBIN');
$this->bindir = \FreePBX::Config()->get('AMPBIN');
$vars = array("agidir", "varlibdir", "mohdir", "etcdir", "logdir", "moddir", "rundir", "spooldir", "webroot", "sbindir", "bindir");
foreach ($vars as $v) {
if (empty($this->{$v})) {
throw new \Exception("I couldn't find {$v}");
}
if (substr($this->{$v}, -1) != "/") {
// If it doesn't end with a slash
$this->{$v} = $this->{$v} . "/";
// Add it.
}
}
// Assumptions...
$this->soundsdir = $this->varlibdir . "sounds/";
}
示例5: getProxySettings
public function getProxySettings()
{
$conf = FreePBX::Config();
if ($conf->get('PROXY_ENABLED')) {
$url = trim($conf->get('PROXY_ADDRESS'));
if (!$url) {
// It's blank? Whut?
return array("enabled" => false);
}
$retarr = array("enabled" => true, "type" => "http", "url" => $url);
// We don't want any prefix before the proxy host for the 'host' tag.
if (preg_match("/\\/\\/(.+)/", $url, $out)) {
$retarr['host'] = $out[1];
} else {
$retarr['host'] = $url;
}
// Do we have a valid username and password?
$user = $conf->get('PROXY_USERNAME');
$pass = $conf->get('PROXY_PASSWORD');
if ($user && $pass) {
$retarr['username'] = $user;
$retarr['password'] = $pass;
}
return $retarr;
} else {
return array("enabled" => false);
}
}
示例6: chownFreePBX
public function chownFreePBX()
{
$webroot = \FreePBX::Config()->get('AMPWEBROOT');
$modulebindir = $webroot . '/admin/modules/callback/bin/';
$files = array();
$files[] = array('type' => 'file', 'path' => $modulebindir . 'callback', 'perms' => 0755);
return $files;
}
示例7: __construct
public function __construct($freepbx = null)
{
if ($freepbx == null) {
throw new Exception("Not given a FreePBX Object");
}
$this->FreePBX = $freepbx;
$this->Userman = $this->FreePBX->Userman;
$this->db = $freepbx->Database;
$this->brand = \FreePBX::Config()->get("DASHBOARD_FREEPBX_BRAND");
}
示例8: doDialplanHook
public function doDialplanHook(&$ext, $engine, $priority)
{
// While we're here, we should check that our cronjob is
// still there.
$file = \FreePBX::Config()->get('AMPWEBROOT') . "/admin/modules/dashboard/" . $this->sched;
$cmd = "[ -x {$file} ] && {$file}";
// Ensure we instantiate cron with the correct user
$c = \FreePBX::create()->Cron(\FreePBX::Config()->get('AMPASTERISKWEBUSER'));
$c->addLine("* * * * * {$cmd}");
}
示例9: __construct
public function __construct($freepbx = null)
{
$this->FreePBX = $freepbx;
$this->db = $freepbx->Database;
$this->brand = \FreePBX::Config()->get("DASHBOARD_FREEPBX_BRAND");
if (!interface_exists('FreePBX\\modules\\Userman\\Auth\\Base')) {
include __DIR__ . "/functions.inc/auth/Base.php";
}
if (!class_exists('FreePBX\\modules\\Userman\\Auth\\Auth')) {
include __DIR__ . "/functions.inc/auth/Auth.php";
}
$this->switchAuth($this->getConfig('auth'));
}
示例10: getSections
public function getSections($order)
{
if (!defined('DASHBOARD_FREEPBX_BRAND')) {
if (!empty($_SESSION['DASHBOARD_FREEPBX_BRAND'])) {
define('DASHBOARD_FREEPBX_BRAND', $_SESSION['DASHBOARD_FREEPBX_BRAND']);
} else {
define('DASHBOARD_FREEPBX_BRAND', \FreePBX::Config()->get("DASHBOARD_FREEPBX_BRAND"));
}
} else {
$_SESSION['DASHBOARD_FREEPBX_BRAND'] = DASHBOARD_FREEPBX_BRAND;
}
$brand = DASHBOARD_FREEPBX_BRAND;
return array(array("title" => "{$brand} " . _("Statistics"), "group" => _("Statistics"), "width" => "550px", "order" => isset($order['statistics']) ? $order['statistics'] : '300', "section" => "statistics"));
}
示例11: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->updateVars();
$edgemode = \FreePBX::Config()->get('MODULEADMINEDGE');
$alerts = \FreePBX::Notifications()->get_num_active();
$output->write(base64_decode($this->banner));
$output->writeln("");
$output->writeln("");
if ($alerts != 0) {
$output->writeln("<fg=red>" . sprintf(_("NOTICE! You have %s notifications! Please log into the UI to see them!"), $alerts) . "</fg=red>");
}
if ($edgemode == 1) {
$output->writeln("<fg=red>" . sprintf(_("NOTICE! This system had EDGE mode enabled. For more information visit %s"), 'http://wiki.freepbx.org/x/boi3Aw') . "</fg=red>");
}
$output->writeln("");
$output->writeln("<info>" . _("Current Network Configuration") . "</info>");
$iflist = $this->listIFS();
if ($iflist) {
$rows = array();
foreach ($iflist as $if => $info) {
$rows[] = array($if, $info['mac'], $info['ip']);
}
$table = new Table($output);
$table->setHeaders(array(_('Interface'), _('MAC Address'), _('IP Addresses')))->setRows($rows);
$table->render();
} else {
$output->writeln("-------------------");
$output->writeln(_("No interfaces found"));
$output->writeln("-------------------");
}
$messages = $this->externalMessages();
if (isset($messages['pre'])) {
foreach ($messages['pre'] as $o) {
$output->writeln($o);
}
}
if (!$messages['cancel']) {
$output->writeln("");
$output->writeln(_("Please note most tasks should be handled through the GUI."));
$output->writeln(_("You can access the GUI by typing one of the above IPs in to your web browser."));
$output->writeln(_("For support please visit: "));
$output->writeln(" " . $this->supporturl);
$output->writeln("");
}
if (isset($messages['post'])) {
foreach ($messages['post'] as $o) {
$output->writeln($o);
}
}
}
示例12: __construct
public function __construct()
{
$feeds = \FreePBX::Config()->get('RSSFEEDS');
$feeds = str_replace("\r", "", $feeds);
if (!empty($feeds)) {
$feeds = explode("\n", $feeds);
$i = 0;
$this->urls = array();
foreach ($feeds as $feed) {
$this->urls['rss-' . $i] = $feed;
$i++;
}
}
}
示例13: __construct
public function __construct($freepbx = null)
{
if ($freepbx == null) {
throw new Exception("Not given a FreePBX Object");
}
$this->FreePBX = $freepbx;
$this->db = $freepbx->Database;
$this->mohdir = $freepbx->Config->get('MOHDIR');
$this->varlibdir = $freepbx->Config->get('ASTVARLIBDIR');
$this->mohpath = $this->varlibdir . '/' . $this->mohdir;
$this->config = $this->loadMoHConfig();
$this->tmp = \FreePBX::Config()->get("ASTSPOOLDIR") . "/tmp";
if (!file_exists($this->tmp)) {
mkdir($this->tmp, 0777, true);
}
}
示例14: getContent
public function getContent($section)
{
$feeds = \FreePBX::Config()->get('RSSFEEDS');
$feeds = str_replace("\r", "", $feeds);
if (empty($feeds)) {
return '';
}
$feeds = explode("\n", $feeds);
if (empty($feeds[$section])) {
return '';
}
$feed = $this->getFeed($feeds[$section]);
if (empty($feed)) {
return '';
}
return load_view(dirname(__DIR__) . '/views/sections/blog.php', array("items" => $feed->items, "limit" => 5));
}
示例15: __construct
public function __construct($freepbx = null)
{
if ($freepbx == null) {
throw new \Exception("NO");
}
$this->FreePBX = $freepbx;
$this->db = $freepbx->Database;
if (!defined('DASHBOARD_FREEPBX_BRAND')) {
if (!empty($_SESSION['DASHBOARD_FREEPBX_BRAND'])) {
define('DASHBOARD_FREEPBX_BRAND', $_SESSION['DASHBOARD_FREEPBX_BRAND']);
} else {
define('DASHBOARD_FREEPBX_BRAND', \FreePBX::Config()->get("DASHBOARD_FREEPBX_BRAND"));
}
} else {
$_SESSION['DASHBOARD_FREEPBX_BRAND'] = DASHBOARD_FREEPBX_BRAND;
}
$this->brand = DASHBOARD_FREEPBX_BRAND;
}