本文整理汇总了PHP中FreePBX类的典型用法代码示例。如果您正苦于以下问题:PHP FreePBX类的具体用法?PHP FreePBX怎么用?PHP FreePBX使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FreePBX类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$filename = $input->getArgument('filename');
$type = $input->getOption('type');
if (file_exists($filename)) {
$data = \FreePBX::Bulkhandler()->fileToArray($filename);
} else {
$output->writeln('<error>The specified file does not exist or we cannot read it</error>');
return false;
}
if (!$data) {
$output->writeln('<error>The file provided did not process properly. Check the file formatting</error>');
return false;
}
switch ($type) {
case 'dids':
$output->writeln('Importing bulk dids');
$ret = \FreePBX::Bulkhandler()->import('dids', $data);
break;
case 'extensions':
$output->writeln('Importing bulk extensions');
$ret = \FreePBX::Bulkhandler()->import('extensions', $data);
break;
default:
$output->writeln('<error>You must specify the file type of --type=dids or --type=extensions</error>');
return false;
break;
}
if (!$ret) {
$output->writeln('<error>The import failed</error>');
return false;
} else {
return true;
}
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:35,代码来源:Bulkimport.class.php
示例2: 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);
}
开发者ID:lidl,项目名称:backup,代码行数:28,代码来源:functions.inc.php
示例3: __construct
function __construct($mode = 'local')
{
if ($mode == 'local') {
//Setup our objects for use
//FreePBX is the FreePBX Object
$this->FreePBX = \FreePBX::create();
//UCP is the UCP Specific Object from BMO
$this->Ucp = $this->FreePBX->Ucp;
//System Notifications Class
//TODO: pull this from BMO
$this->notifications = \notifications::create();
//database subsystem
$this->db = $this->FreePBX->Database;
//This causes crazy errors later on. Dont use it
//$this->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
}
$this->emoji = new Client(new Ruleset());
$this->emoji->imagePathPNG = 'assets/images/emoji/png/';
// defaults to jsdelivr's free CDN
$this->emoji->imagePathSVG = 'assets/images/emoji/svg/';
// defaults to jsdelivr's free CDN
$this->detect = new \Mobile_Detect();
// Ensure the local object is available
self::$uobj = $this;
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:25,代码来源:UCP.class.php
示例4: customappsreg_getdestinfo
/** If this is ours, we return it, otherwise we return false
* We use just use customappsreg and not the display because it
* is a per-module routine
*/
function customappsreg_getdestinfo($dest)
{
global $active_modules;
$allDests = \FreePBX::Customappsreg()->getAllCustomDests();
// Look for $dest in allDests. If we know about it, then return
// the details. If we don't, return false.
// Is it a new one?
if (substr($dest, 0, 12) == "customdests,") {
if (!preg_match("/customdests,dest-(\\d+),1/", $dest, $matches)) {
throw new \Exception("Unable to validate dest {$dest}");
}
if (!isset($allDests[$matches[1]])) {
return false;
} else {
// Found it.
$cd = $allDests[$matches[1]];
$tmparr = array('description' => sprintf(_("Custom Destination: %s"), $cd['description']), 'edit_url' => "config.php?display=customdests&destid=" . $cd['destid']);
return $tmparr;
}
}
foreach ($allDests as $cd) {
if ($cd['target'] == $dest) {
// Found it.
$tmparr = array('description' => sprintf(_("Custom Destination: %s"), $cd['description']), 'edit_url' => "config.php?display=customdests&destid=" . $cd['destid']);
return $tmparr;
}
}
// Didn't find it.
return false;
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:34,代码来源:functions.inc.php
示例5: getSections
public function getSections()
{
$sections = array();
$users = \FreePBX::Core()->listUsers(true);
$ret = array();
$ret['title'] = _("Users");
$featurecodes = \featurecodes_getAllFeaturesDetailed();
$ret['textdesc'] = _('User');
$ret['numdesc'] = _('Extension');
$ret['items'] = array();
foreach ($users as $user) {
$ret['items'][] = array($user[1], $user[0]);
}
$sections[] = $ret;
$hookdata = \FreePBX::Hooks()->processHooks();
foreach ($hookdata as $key => $value) {
$sections[] = $value;
}
$html .= '<div class="row holder">';
$html .= '<div class="col-sm-12">';
foreach ($sections as $k => $v) {
$html .= '<div class="row">';
$html .= '<h3>' . $v['title'] . '</h3>';
$html .= '<ul class="list-group">';
foreach ($v['items'] as $item) {
$html .= ' <li class="list-group-item col-sm-6"><b>' . $item[1] . '</b> - ' . $item[0] . '</li>';
}
$html .= '</ul>';
$html .= '<br/>';
$html .= ' </div>';
}
$html .= '</div>';
$html .= '</div>';
return $html;
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:35,代码来源:Printextensions.class.php
示例6: __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/";
}
开发者ID:lidl,项目名称:framework,代码行数:29,代码来源:Installer.class.php
示例7: 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);
}
}
开发者ID:powerpbx,项目名称:framework,代码行数:28,代码来源:Curl.class.php
示例8: sql
function sql($sql, $type = "query", $fetchmode = 'default')
{
global $db;
if (empty($db) || !is_object($db) || get_class($db) != "DB") {
$dbh = FreePBX::Create()->Database();
$db = new DB($dbh);
}
switch ($fetchmode) {
case 'DB_FETCHMODE_ASSOC':
//You guessed it, looking for string constants!
//You guessed it, looking for string constants!
case DB_FETCHMODE_ASSOC:
//simulate craptacular function from previous versions
//that didn't even work correctly! sweet :-/
//(The integer shouldnt go there)
if ($type == 'getAssoc') {
$results = $db->{$type}($sql, true);
} else {
$results = $db->{$type}($sql, array(), DB_FETCHMODE_ASSOC);
}
break;
case DB_FETCHMODE_ORDERED:
$results = $db->{$type}($sql, array(), DB_FETCHMODE_ORDERED);
break;
case 'default':
$results = $db->sql($sql, $type);
break;
default:
throw new Exception("Unknown SQL fetchmode of {$fetchmode}");
break;
}
return $results;
}
开发者ID:powerpbx,项目名称:framework,代码行数:33,代码来源:sql.functions.php
示例9: certman_devices_configprocess
function certman_devices_configprocess()
{
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$extension = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
$tech = isset($_POST['tech']) ? $_POST['tech'] : null;
switch ($action) {
case 'add':
$extension = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : null;
case 'edit':
if ($_POST['dtls_enable'] == 'yes') {
$settings = array();
foreach ($_POST as $key => $value) {
if (preg_match('/^dtls_(.*)/', $key, $matches)) {
$settings[$matches[1]] = $value;
}
}
FreePBX::Certman()->addDTLSOptions($extension, $settings);
} else {
FreePBX::Certman()->removeDTLSOptions($extension);
}
break;
case 'del':
FreePBX::Certman()->removeDTLSOptions($extension);
break;
}
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:26,代码来源:hook_core.php
示例10: setUpBeforeClass
public static function setUpBeforeClass()
{
global $amp_conf, $db;
include "/etc/freepbx.conf";
include __DIR__ . '/../classes/DiskUsage.class.php';
self::$f = FreePBX::create();
self::$d = new DiskUsage();
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:8,代码来源:diskTest.php
示例11: configure
protected function configure()
{
$this->setName('motd')->setDescription(_('Prints MOTD'))->setDefinition(array(new InputArgument('args', InputArgument::IS_ARRAY, null, null)));
//banners should be base64 encoded, Why? Because php likes to randomly shift multiline variables. Also makes it all look super cryptic :-/
$this->banner = "IF9fX19fICAgICAgICAgICAgICBfX19fICBfX19fX18gIF9fDQp8ICBfX198IF9fIF9fXyAgX19ffCAgXyBcfCBfXyApIFwvIC8NCnwgfF8gfCAnX18vIF8gXC8gXyBcIHxfKSB8ICBfIFxcICAvIA0KfCAgX3x8IHwgfCAgX18vICBfXy8gIF9fL3wgfF8pIC8gIFwgDQp8X3wgIHxffCAgXF9fX3xcX19ffF98ICAgfF9fX18vXy9cX1wgICAgIA==";
$this->supporturl = 'http://www.freepbx.org/support-and-professional-services';
$this->FreePBX = \FreePBX::Create();
}
开发者ID:powerpbx,项目名称:framework,代码行数:8,代码来源:Motd.class.php
示例12: setUpBeforeClass
public static function setUpBeforeClass()
{
include 'setuptests.php';
self::$p = FreePBX::PKCS();
`rm -rf /tmp/ssltest`;
`mkdir /tmp/ssltest`;
self::$p->setKeysLocation("/tmp/ssltest");
}
开发者ID:ntadmin,项目名称:framework,代码行数:8,代码来源:PKCSTest.php
示例13: 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;
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:8,代码来源:Callback.class.php
示例14: setUpBeforeClass
public static function setUpBeforeClass()
{
global $amp_conf, $db;
include "/etc/freepbx.conf";
include __DIR__ . '/../classes/AsteriskInfo.class.php';
self::$f = FreePBX::create();
self::$a = new AsteriskInfo2();
}
开发者ID:lidl,项目名称:dashboard,代码行数:8,代码来源:asteriskTest.php
示例15: ajaxHandler
public function ajaxHandler()
{
$request = $_REQUEST;
if (!empty($_REQUEST['oldval']) && $_REQUEST['command'] == 'add') {
$_REQUEST['command'] = 'edit';
}
switch ($_REQUEST['command']) {
case 'add':
$this->numberAdd($request);
return array('status' => true);
break;
case 'edit':
$this->numberDel($request['oldval']);
$this->numberAdd($request);
return array('status' => true);
break;
case 'bulkdelete':
$numbers = isset($_REQUEST['numbers']) ? $_REQUEST['numbers'] : array();
$numbers = json_decode($numbers, true);
foreach ($numbers as $number) {
$this->numberDel($number);
}
return array('status' => 'true', 'message' => _("Numbers Deleted"));
break;
case 'del':
$ret = $this->numberDel($request['number']);
return array('status' => $ret);
break;
case 'calllog':
$number = $request['number'];
$sql = 'SELECT calldate FROM asteriskcdrdb.cdr WHERE src = ?';
$stmt = \FreePBX::Database()->prepare($sql);
$stmt->execute(array($number));
$ret = $stmt->fetchAll(\PDO::FETCH_ASSOC);
return $ret;
break;
case 'getJSON':
switch ($request['jdata']) {
case 'grid':
$ret = array();
$blacklist = $this->getBlacklist();
foreach ($blacklist as $item) {
$number = $item['number'];
$description = $item['description'];
if ($number == 'dest' || $number == 'blocked') {
continue;
} else {
$ret[] = array('number' => $number, 'description' => $description);
}
}
return $ret;
break;
}
break;
}
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:56,代码来源:Blacklist.class.php
示例16: setUpBeforeClass
public static function setUpBeforeClass()
{
global $amp_conf, $db;
include "/etc/freepbx.conf";
if (!class_exists('MemInfo')) {
include __DIR__ . '/../classes/MemInfo.class.php';
}
self::$f = FreePBX::create();
self::$m = new MemInfo();
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:10,代码来源:memTest.php
示例17: setUpBeforeClass
public static function setUpBeforeClass()
{
include 'setuptests.php';
self::$f = FreePBX::create();
$_REQUEST['test1'] = 1;
$_REQUEST['test2'] = "two";
$_REQUEST['test3'] = "3";
$_REQUEST['test4'] = "'<>\"";
$_REQUEST['radio'] = "radio=poot";
}
开发者ID:powerpbx,项目名称:framework,代码行数:10,代码来源:RequestTest.php
示例18: __construct
public function __construct()
{
// Is firewall enabled and active?
try {
$this->fwobj = \FreePBX::Firewall();
$this->fw = $this->fwobj->isEnabled();
} catch (\Exception $e) {
// Firewall not active, or not enabled, don't do anything
return;
}
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:11,代码来源:FirewallAPI.class.php
示例19: runHook
public static function runHook($hook)
{
if (strpos($hook, "builtin_") === 0) {
// It's a builtin module.
return FreePBX::create()->Dashboard->doBuiltInHook($hook);
}
if (strpos($hook, "freepbx_ha_") === 0) {
return "This is not the hook you want";
}
throw new Exception("Extra hooks not done yet");
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:11,代码来源:DashboardHooks.class.php
示例20: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
$output->write(_("Connecting to the Database..."));
try {
$db = \FreePBX::Database();
} catch (\Exception $e) {
$output->writeln("<error>" . _("Unable to connect to database!") . "</error>");
return;
}
$output->writeln(_("Connected"));
$driver = $db->getAttribute(\PDO::ATTR_DRIVER_NAME);
$bundles = array();
while (true) {
$question = new Question($driver . '>', '');
$question->setAutocompleterValues($bundles);
$answer = $helper->ask($input, $output, $question);
if (preg_match("/^exit/i", $answer)) {
exit;
}
$bundles[] = $answer;
try {
$time_start = microtime(true);
$ob = $db->query($answer);
$time_end = microtime(true);
} catch (\Exception $e) {
$output->writeln("<error>" . $e->getMessage() . "</error>");
continue;
}
if (!$ob) {
$output->writeln("<error>" . $db->errorInfo() . "</error>");
continue;
}
//if we get rows back from a query fetch them
if ($ob->rowCount()) {
$gotRows = $ob->fetchAll(\PDO::FETCH_ASSOC);
} else {
$gotRows = array();
}
if (!empty($gotRows)) {
$rows = array();
foreach ($gotRows as $row) {
$rows[] = array_values($row);
}
$table = new Table($output);
$table->setHeaders(array_keys($gotRows[0]))->setRows($rows);
$table->render();
$output->writeln(sprintf(_("%s rows in set (%s sec)"), $ob->rowCount(), round($time_end - $time_start, 2)));
} else {
$output->writeln(_("Successfully executed"));
}
}
}
开发者ID:powerpbx,项目名称:framework,代码行数:53,代码来源:Mysql.class.php
注:本文中的FreePBX类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论