本文整理汇总了PHP中FreePBX::Create方法的典型用法代码示例。如果您正苦于以下问题:PHP FreePBX::Create方法的具体用法?PHP FreePBX::Create怎么用?PHP FreePBX::Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreePBX
的用法示例。
在下文中一共展示了FreePBX::Create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$FreePBX = \FreePBX::Create();
$args = $input->getArgument('args');
session_id($args[0]);
session_start();
$output->writeln(sprintf(_('Unlocking: %s'), $args[0]));
if (!isset($_SESSION["AMP_user"])) {
$_SESSION["AMP_user"] = new \ampuser('fwconsole');
$_SESSION["AMP_user"]->setAdmin();
$output->writeln(_('Session Should be unlocked now'));
}
}
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$FreePBX = \FreePBX::Create();
$args = $input->getArgument('args');
//If we don't have a session file, it is probably not a valid session
if (!file_exists(session_save_path() . '/sess_' . $args[0])) {
$output->writeln(sprintf(_('Unlocking: %s Failed, Invalid session'), $args[0]));
return;
}
session_id($args[0]);
session_start();
$output->writeln(sprintf(_('Unlocking: %s'), $args[0]));
if (!isset($_SESSION["AMP_user"])) {
$_SESSION["AMP_user"] = new \ampuser('fwconsole');
$_SESSION["AMP_user"]->setAdmin();
$output->writeln(_('Session Should be unlocked now'));
}
}
示例5: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$args = $input->getArgument('args');
$FreePBX = \FreePBX::Create();
$astMan = $FreePBX->astman;
if ($astMan->connected()) {
$astMan->Command('dialplan reload');
$res = $astMan->Command('dialplan show ' . $args[0]);
$lines = explode("\n", $res['data']);
$output->writeln('Context ' . $args[0] . ': ');
foreach ($lines as $line) {
if (strpos($line, '=>')) {
$i++;
$output->writeln($line);
}
}
if ($i < 1) {
$output->writeln(_('May be invalid Check your spelling'));
}
}
}
示例6: abortShutdown
private function abortShutdown($output)
{
$freepbx = \FreePBX::Create();
$astman = $freepbx->astman;
if (is_object($astman) && $astman->Connected()) {
$astman->send_request('Command', array('Command' => 'core abort shutdown'));
}
}