本文整理汇总了PHP中FreePBX::create方法的典型用法代码示例。如果您正苦于以下问题:PHP FreePBX::create方法的具体用法?PHP FreePBX::create怎么用?PHP FreePBX::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreePBX
的用法示例。
在下文中一共展示了FreePBX::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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;
}
示例2: 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();
}
示例3: 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();
}
示例4: 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";
}
示例5: 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();
}
示例6: 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");
}
示例7: checkDatabase
/** This is our pseudo-__construct, called whenever our public functions are called. */
private static function checkDatabase()
{
// Have we already run?
if (self::$checked != false) {
return;
}
if (!isset(self::$db)) {
self::$db = \FreePBX::create()->Database;
}
// Definitions
$create = "CREATE TABLE IF NOT EXISTS " . self::$dbname . " ( `module` CHAR(64) NOT NULL, `key` CHAR(255) NOT NULL, `val` LONGBLOB, `type` CHAR(16) DEFAULT NULL, `id` CHAR(255) DEFAULT NULL)";
// These are limited to 50 chars as prefixes are limited to 255 chars in total (or 1000 in later versions
// of mysql), and UTF can cause that to overflow. 50 is plenty.
$index['index1'] = "ALTER TABLE " . self::$dbname . " ADD INDEX index1 (`key`(50))";
$index['index3'] = "ALTER TABLE " . self::$dbname . " ADD UNIQUE INDEX index3 (`module`, `key`(50), `id`(50))";
$index['index5'] = "ALTER TABLE " . self::$dbname . " ADD INDEX index5 (`module`, `id`(50))";
// Check to make sure our Key/Value table exists.
try {
$res = self::$db->query("SELECT * FROM `" . self::$dbname . "` LIMIT 1");
} catch (\Exception $e) {
if ($e->getCode() == "42S02") {
// Table does not exist
self::$db->query($create);
} else {
self::checkException($e);
}
}
// Check for indexes.
// TODO: This only works on MySQL
$res = self::$db->query("SHOW INDEX FROM `" . self::$dbname . "`");
$out = $res->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP, 2);
foreach ($out as $i => $null) {
// Do we not know about this index? (Are we upgrading?)
if (!isset($index[$i])) {
self::$db->query("ALTER TABLE " . self::$dbname . " DROP INDEX {$i}");
}
}
// Now lets make sure all our indexes exist.
foreach ($index as $i => $sql) {
if (!isset($out[$i])) {
self::$db->query($sql);
}
}
// Add our stored procedures
self::$dbGet = self::$db->prepare("SELECT `val`, `type` FROM `" . self::$dbname . "` WHERE `module` = :mod AND `key` = :key AND `id` = :id");
self::$dbGetAll = self::$db->prepare("SELECT `key` FROM `" . self::$dbname . "` WHERE `module` = :mod AND `id` = :id ORDER BY `key`");
self::$dbDel = self::$db->prepare("DELETE FROM `" . self::$dbname . "` WHERE `module` = :mod AND `key` = :key AND `id` = :id");
self::$dbAdd = self::$db->prepare("INSERT INTO `" . self::$dbname . "` ( `module`, `key`, `val`, `type`, `id` ) VALUES ( :mod, :key, :val, :type, :id )");
self::$dbDelId = self::$db->prepare("DELETE FROM `" . self::$dbname . "` WHERE `module` = :mod AND `id` = :id");
self::$dbDelMod = self::$db->prepare("DELETE FROM `" . self::$dbname . "` WHERE `module` = :mod");
// Now this has run, everything IS JUST FINE.
self::$checked = true;
}
示例8: setUpBeforeClass
public static function setUpBeforeClass()
{
include 'setuptests.php';
self::$f = FreePBX::create();
// Ensure that our /etc/freepbx.secure directory exists
if (!is_dir("/etc/freepbx.secure")) {
if (posix_geteuid() !== 0) {
throw new \Exception("Can't create /etc/freepbx.secure, not runnign tests as root");
} else {
mkdir("/etc/freepbx.secure");
}
}
chmod("/etc/freepbx.secure", 0644);
}
示例9: setUpBeforeClass
public static function setUpBeforeClass()
{
include "setuptests.php";
self::$f = FreePBX::create();
self::$config_file = basename(tempnam(sys_get_temp_dir(), "utest"));
self::$config_file2 = basename(tempnam(sys_get_temp_dir(), "utest"));
self::$config_dir = sys_get_temp_dir() . "/";
$config = <<<'EOF'
; Config file parser test
;-- Multi-line comment
in the header --;firstvalue=is not in a section!
[template-section](!)
foobar=barfoo
[first-section]
foo=bar
bar=[bracketed value]
one => two
hey =this is a big long\r\n
hey+= multi-line value\r\n
hey +=that goes on and on
;-- block comment on one line! --;
[second_section](template-section)
setting=>value ;comment at the end
setting2=>value with a \; semicolon
setting3 = value;-- multiline comment starts here
and continues
and ends here--;setting4 =>value
;--a comment
[bad_section]
--;;another =>comment? i hope so
setting5 => value
setting=value 2
#include foo.conf
[first-section](+)
baz=bix
[voicemail]
9876 => 1234,Typical voicemail,,,attach=no|saycid=no|envelope=no|delete=no
5432=>1234,Typical voicemail,,,attach=no|saycid=no|envelope=no|delete=no
EOF;
file_put_contents(self::$config_dir . self::$config_file, $config);
$config = str_replace("setting=value 2", "[invalid section]", $config);
file_put_contents(self::$config_dir . self::$config_file2, $config);
}
示例10: __construct
public function __construct()
{
$this->conf = \FreePBX::create()->ConfigFile("modules.conf");
$this->ProcessedConfig =& $this->conf->config->ProcessedConfig;
// Now, is it empty? We want some defaults..
if (sizeof($this->ProcessedConfig) == 0) {
$this->conf->addEntry("modules", "autoload=yes");
$this->conf->addEntry("modules", "preload=pbx_config.so");
$this->conf->addEntry("modules", "preload=chan_local.so");
$this->conf->addEntry("modules", "preload=res_mwi_blf.so");
$this->conf->addEntry("modules", "noload=chan_also.so");
$this->conf->addEntry("modules", "noload=chan_oss.so");
$this->conf->addEntry("modules", "noload=app_directory_odbcstorage.so");
$this->conf->addEntry("modules", "noload=app_voicemail_odbcstorage.so");
}
}
示例11: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$args = $input->getArgument('args');
$command = isset($args[0]) ? $args[0] : '';
$soundlang = \FreePBX::create()->Userman;
switch ($command) {
case "auth":
break;
case "migrate":
break;
default:
$output->writeln("<error>The command provided is not valid.</error>");
$output->writeln("Avalible commands are:");
$output->writeln("<info>auth <user> <password></info> - Authenticate user and get information about user back");
$output->writeln("<info>migrate<id></info> - Migrate/Update voicemail users into User Manager");
exit(4);
break;
}
}
示例12: __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->detect = new \Mobile_Detect();
// Ensure the local object is available
self::$obj = $this;
}
示例13: __construct
public function __construct()
{
$this->conf = \FreePBX::create()->ConfigFile("modules.conf");
$this->ProcessedConfig =& $this->conf->config->ProcessedConfig;
// Now, is it empty? We want some defaults..
if (sizeof($this->ProcessedConfig) == 0) {
$this->conf->addEntry("modules", "autoload=yes");
$this->conf->addEntry("modules", "preload=pbx_config.so");
$this->conf->addEntry("modules", "preload=chan_local.so");
$this->conf->addEntry("modules", "preload=res_mwi_blf.so");
$this->conf->addEntry("modules", "preload=func_db.so");
$this->conf->addEntry("modules", "noload=chan_also.so");
$this->conf->addEntry("modules", "noload=chan_oss.so");
$this->conf->addEntry("modules", "noload=app_directory_odbcstorage.so");
$this->conf->addEntry("modules", "noload=app_voicemail_odbcstorage.so");
}
//https://issues.asterisk.org/jira/browse/ASTERISK-25966
if (empty($this->ProcessedConfig['modules']['preload']) || is_array($this->ProcessedConfig['modules']['preload']) && !in_array("func_db.so", $this->ProcessedConfig['modules']['preload']) || is_string($this->ProcessedConfig['modules']['preload']) && $this->ProcessedConfig['modules']['preload'] != "func_db.so") {
$this->conf->addEntry("modules", "preload=func_db.so");
}
}
示例14: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$args = $input->getArgument('args');
$command = isset($args[0]) ? $args[0] : '';
$userman = \FreePBX::create()->Userman;
switch ($command) {
case "sync":
$auth = $userman->getAuthObject();
if (method_exists($auth, "sync")) {
$output->write("Starting Sync...");
$auth->sync($output);
$output->writeln("Finished");
} else {
$output->writeln("<comment>The active authentication driver does not support syncing.</comment>");
}
break;
default:
$output->writeln("<error>The command provided is not valid.</error>");
$output->writeln("Avalible commands are:");
$output->writeln("<info>sync</info> - Syncronize User/Group information for an authentication engine");
exit(4);
break;
}
}
示例15: setUpBeforeClass
public static function setUpBeforeClass()
{
include 'setuptests.php';
self::$f = FreePBX::create();
}