本文整理汇总了PHP中featurecode::setDefault方法的典型用法代码示例。如果您正苦于以下问题:PHP featurecode::setDefault方法的具体用法?PHP featurecode::setDefault怎么用?PHP featurecode::setDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类featurecode
的用法示例。
在下文中一共展示了featurecode::setDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
$fcc->setDescription("{$id}: Call Flow Toggle");
}
$fcc->setDefault('*28' . $id);
if ($code != '*28' && $code != '') {
$fcc->setCode($code . $id);
}
if (!$enabled) {
$fcc->setEnabled(false);
}
$fcc->update();
unset($fcc);
}
}
$fcc = new featurecode('daynight', 'toggle-mode-all');
$fcc->setDescription("All: Call Flow Toggle");
$fcc->setDefault('*28');
if ($delete_old) {
if ($code != '*28' && $code != '') {
$fcc->setCode($code);
}
if (!$enabled) {
$fcc->setEnabled(false);
}
}
$fcc->update();
unset($fcc);
// Sqlite3 does not like this syntax, but no migration needed since it started in 2.5
//
if ($amp_conf["AMPDBENGINE"] != "sqlite3") {
outn(_("changing primary keys to all fields.."));
$sql = 'ALTER TABLE `daynight` DROP PRIMARY KEY , ADD PRIMARY KEY ( `ext` , `dmode` , `dest` )';
示例2: VALUES
echo "The file {$filename} is not writable";
}
?>
Verifying / Installing cronjob into the FreePBX cron manager.<br>
<?php
$sql = "SELECT * FROM `cronmanager` WHERE `module` = 't' LIMIT 1;";
$res = $db->query($sql);
if ($res->numRows() != 2) {
$sql = "INSERT INTO\tcronmanager (module,id,time,freq,command) VALUES ('trunkalarm','every_day',23,24,'/usr/bin/find /var/lib/asterisk/sounds/tts -name \"*.wav\" -mtime +1 -exec rm {} \\\\;')";
$sql = "INSERT INTO\tcronmanager (module,id,time,freq,command) VALUES ('trunkalarm',*,15,*,'/asterisk/agi-bin/monitor_trunk.php \\\\;')";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not create values in cronmanager table: " . $check->getMessage() . "\n");
}
}
?>
Verifying / Creating TTS Folder.<br>
<?php
$parm_tts_dir = '/var/lib/asterisk/sounds/tts';
if (!is_dir($parm_tts_dir)) {
mkdir($parm_tts_dir, 0775);
}
?>
Creating Feature Code.<br>
<?php
// Register FeatureCode - Trunk Monitor;
$fcc = new featurecode('trunkalarm', 'trunkalarm');
$fcc->setDescription('Trunk Alarm');
$fcc->setDefault('*878625');
$fcc->update();
unset($fcc);
示例3: featurecode
<?php
global $db;
global $amp_conf;
// Add Feature Codes for Toggle Queues - Using *45
$fcc = new featurecode('queues', 'que_toggle');
$fcc->setDescription('Queue Toggle');
$fcc->setDefault('*45');
$fcc->update();
unset($fcc);
if (!function_exists("out")) {
function out($text)
{
echo $text . "<br />";
}
}
if (!function_exists("outn")) {
function outn($text)
{
echo $text;
}
}
$results = array();
$sql = "SELECT args, extension, priority FROM extensions WHERE context = 'ext-queues' AND descr = 'jump'";
$results = $db->getAll($sql, DB_FETCHMODE_ASSOC);
if (!DB::IsError($results)) {
// error - table must not be there
foreach ($results as $result) {
$old_dest = $result['args'];
$extension = $result['extension'];
$priority = $result['priority'];
示例4: recordings_update
function recordings_update($id, $rname, $descr, $request, $fcode = 0, $fcode_pass = '')
{
global $db;
// Update the descriptive fields
$fcode_pass = preg_replace("/[^0-9*]/", "", trim($fcode_pass));
$results = sql("UPDATE recordings SET displayname = '" . $db->escapeSimple($rname) . "', description = '" . $db->escapeSimple($descr) . "', fcode='{$fcode}', fcode_pass='" . $fcode_pass . "' WHERE id = '{$id}'");
// Build the file list from _REQUEST
$astsnd = isset($asterisk_conf['astvarlibdir']) ? $asterisk_conf['astvarlibdir'] : '/var/lib/asterisk';
$astsnd .= "/sounds/";
$recordings = array();
// Set the file names from the submitted page, sysrec[N]
// We don't set if feature code was selected, we use what was already there
// because the fields will have been disabled and won't be accessible in the
// $_REQUEST array anyhow
//
if ($fcode != 1) {
// delete the feature code if it existed
//
$fcc = new featurecode('recordings', 'edit-recording-' . $id);
$fcc->delete();
unset($fcc);
foreach ($request as $key => $val) {
$res = strpos($key, 'sysrec');
if ($res !== false) {
// strip out any relative paths, since this is coming from a URL
str_replace('..', '', $val);
$recordings[substr($key, 6)] = $val;
}
}
// Stick the filename in the database
recordings_set_file($id, implode('&', $recordings));
} else {
// Add the feature code if it is needed
//
$fcc = new featurecode('recordings', 'edit-recording-' . $id);
$fcc->setDescription("Edit Recording: {$rname}");
$fcc->setDefault('*29' . $id);
$fcc->update();
unset($fcc);
}
// In _REQUEST there are also various actions (possibly)
// up[N] - Move file id N up one place
// down[N] - Move fid N down one place
// del[N] - Delete fid N
foreach ($request as $key => $val) {
if (strpos($key, "_") == 0) {
$up = strpos($key, "up");
$down = strpos($key, "down");
$del = strpos($key, "del");
}
if ($up !== false) {
$up = substr($key, 2);
recordings_move_file_up($id, $up);
}
if ($del !== false) {
$del = substr($key, 3);
recordings_delete_file($id, $del);
}
if ($down !== false) {
$down = substr($key, 4);
recordings_move_file_down($id, $down);
}
}
}
示例5: VARCHAR
//for translation only
if (false) {
_("Findme Follow Toggle");
}
global $db;
global $amp_conf;
global $astman;
$sql = "\nCREATE TABLE IF NOT EXISTS `findmefollow` \n( \n\t`grpnum` VARCHAR( 20 ) NOT NULL , \n\t`strategy` VARCHAR( 50 ) NOT NULL , \n\t`grptime` SMALLINT NOT NULL , \n\t`grppre` VARCHAR( 100 ) NULL , \n\t`grplist` VARCHAR( 255 ) NOT NULL , \n\t`annmsg_id` INTEGER,\n\t`postdest` VARCHAR( 255 ) NULL , \n\t`dring` VARCHAR ( 255 ) NULL , \n\t`remotealert_id` INTEGER,\n\t`needsconf` VARCHAR ( 10 ), \n\t`toolate_id` INTEGER,\n\t`pre_ring` SMALLINT NOT NULL DEFAULT 0, \n\tPRIMARY KEY (`grpnum`) \n)\n";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not create annoucment table");
}
//TODO: Also need to create all the states if enabled
$fcc = new featurecode('findmefollow', 'fmf_toggle');
$fcc->setDescription('Findme Follow Toggle');
$fcc->setDefault('*21');
$fcc->update();
unset($fcc);
// Adding support for a pre_ring before follow-me group
$sql = "SELECT pre_ring FROM findmefollow";
$check = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (DB::IsError($check)) {
// add new field
$sql = "ALTER TABLE findmefollow ADD pre_ring SMALLINT( 6 ) NOT NULL DEFAULT 0 ;";
$result = $db->query($sql);
if (DB::IsError($result)) {
die_freepbx($result->getDebugInfo());
}
}
// If there is no needsconf then this is a really old upgrade. We create the 2 old fields
// here and then the migration code below will change them as needed but will work properly
示例6: VALUES
} else {
echo "The file {$filename} is not writable";
}
?>
Verifying / Installing cronjob into the FreePBX cron manager.<br>
<?php
$sql = "SELECT * FROM `cronmanager` WHERE `module` = 't' LIMIT 1;";
$res = $db->query($sql);
if ($res->numRows() != 1) {
$sql = "INSERT INTO\tcronmanager (module,id,time,freq,command) VALUES ('xtide','every_day',23,24,'/usr/bin/find /var/lib/asterisk/sounds/tts -name \"*.wav\" -mtime +1 -exec rm {} \\\\;')";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not create values in cronmanager table: " . $check->getMessage() . "\n");
}
}
?>
Verifying / Creating TTS Folder.<br>
<?php
$parm_tts_dir = '/var/lib/asterisk/sounds/tts';
if (!is_dir($parm_tts_dir)) {
mkdir($parm_tts_dir, 0775);
}
?>
Creating Feature Code.<br>
<?php
// Register FeatureCode - Xtide Reports;
$fcc = new featurecode('xtide', 'xtide');
$fcc->setDescription('Xtide Reports');
$fcc->setDefault('8433');
$fcc->update();
unset($fcc);
示例7: daynight_edit
function daynight_edit($post, $id = 0)
{
global $db;
// TODO: Probably have separate add and edit (and change in page.daynight.php also)
// Need to set the day/night mode in the system if new
// Delete all the old dests
if ($post['action'] != "add") {
sql("DELETE FROM daynight WHERE dmode IN ('day', 'night', 'password', 'fc_description','day_recording_id','night_recording_id') AND ext = {$id}");
}
$day = isset($post[$post['goto0'] . '0']) ? $post[$post['goto0'] . '0'] : '';
$night = isset($post[$post['goto1'] . '1']) ? $post[$post['goto1'] . '1'] : '';
sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'day', '{$day}')");
sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'night', '{$night}')");
if (isset($post['password']) && trim($post['password'] != "")) {
$password = trim($post['password']);
sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'password', '{$password}')");
}
$fc_description = isset($post['fc_description']) ? trim($post['fc_description']) : "";
sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'fc_description', '" . $db->escapeSimple($fc_description) . "')");
$day_recording_id = isset($post['day_recording_id']) ? trim($post['day_recording_id']) : "";
sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'day_recording_id', '{$day_recording_id}')");
$night_recording_id = isset($post['night_recording_id']) ? trim($post['night_recording_id']) : "";
sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'night_recording_id', '{$night_recording_id}')");
$dn = new dayNightObject($id);
$dn->del();
$dn->create($post['state']);
$fcc = new featurecode('daynight', 'toggle-mode-' . $id);
if ($fc_description) {
$fcc->setDescription("{$id}: {$fc_description}");
} else {
$fcc->setDescription("{$id}: Call Flow Toggle Control");
}
$fcc->setDefault('*28' . $id);
$fcc->setProvideDest();
$fcc->update();
unset($fcc);
needreload();
}
示例8: timeconditions_updatedb
$id = $item['timeconditions_id'];
$displayname = $item['displayname'];
$fcc = new featurecode('timeconditions', 'toggle-mode-' . $id);
if ($displayname) {
$fcc->setDescription("{$id}: {$displayname}");
} else {
$fcc->setDescription($id . _(": Time Condition Override"));
}
$fcc->setDefault('*27' . $id);
$fcc->update();
unset($fcc);
}
}
$fcc = new featurecode('timeconditions', 'toggle-mode-all');
$fcc->setDescription("All: Time Condition Override");
$fcc->setDefault('*27');
$fcc->update();
unset($fcc);
out(_("OK"));
// bring db up to date on install/upgrade
//
function timeconditions_updatedb()
{
$ver = modules_getversion('timeconditions');
if ($ver !== null && version_compare_freepbx($ver, '2.5', 'lt')) {
outn(_("Checking for old timeconditions to upgrade.."));
$upgradelist = timeconditions_list_forupgrade();
if (isset($upgradelist)) {
// we have old conditions to upgrade
//
out(_("starting migration"));
示例9: die
<?php
if (!defined('FREEPBX_IS_AUTH')) {
die('No direct script access allowed');
}
global $db;
global $amp_conf;
$fcc = new featurecode('conferences', 'conf_status');
$fcc->setDescription('Conference Status');
$fcc->setDefault('*87');
$fcc->update();
unset($fcc);
示例10: featurecode
// Add Feature Codes for Toggle Queues - Using *45
$fcc = new featurecode('queues', 'que_toggle');
$fcc->setDescription(_('Allow Dynamic Members of a Queue to login or logout. See the Queues Module for how to assign a Dynamic Member to a Queue.'));
$fcc->setDefault('*45');
$fcc->update();
unset($fcc);
// Add Feature Codes for Toggle Queue Pause- Using *46
$fcc = new featurecode('queues', 'que_pause_toggle');
$fcc->setDescription(_('Queue Pause Toggle'));
$fcc->setDefault('*46');
$fcc->update();
unset($fcc);
// Add Feature Codes for Queue Callers - Using *47
$fcc = new featurecode('queues', 'que_callers');
$fcc->setDescription(_('Playback Queue Caller Count'));
$fcc->setDefault('*47');
$fcc->update();
unset($fcc);
$results = array();
$sql = "SELECT args, extension, priority FROM extensions WHERE context = 'ext-queues' AND descr = 'jump'";
$results = $db->getAll($sql, DB_FETCHMODE_ASSOC);
if (!DB::IsError($results)) {
// error - table must not be there
foreach ($results as $result) {
$old_dest = $result['args'];
$extension = $result['extension'];
$priority = $result['priority'];
$new_dest = merge_ext_followme(trim($old_dest));
if ($new_dest != $old_dest) {
$sql = "UPDATE extensions SET args = '{$new_dest}' WHERE extension = '{$extension}' AND priority = '{$priority}' AND context = 'ext-queues' AND descr = 'jump' AND args = '{$old_dest}'";
$results = $db->query($sql);
示例11: foreach
}
unset($fcc);
// If we found the old one then we must create all the new ones
//
if ($delete_old) {
$list = daynight_list();
foreach ($list as $item) {
$id = $item['ext'];
$fc_description = $item['dest'];
$fcc = new featurecode('daynight', 'toggle-mode-' . $id);
if ($fc_description) {
$fcc->setDescription("{$id}: {$fc_description}");
} else {
$fcc->setDescription("{$id}: Day Night Control");
}
$fcc->setDefault('*28' . $id);
if ($code != '*28' && $code != '') {
$fcc->setCode($code . $id);
}
if (!$enabled) {
$fcc->setEnabled(false);
}
$fcc->update();
unset($fcc);
}
}
// Sqlite3 does not like this syntax, but no migration needed since it started in 2.5
//
if ($amp_conf["AMPDBENGINE"] != "sqlite3") {
outn(_("changing primary keys to all fields.."));
$sql = 'ALTER TABLE `daynight` DROP PRIMARY KEY , ADD PRIMARY KEY ( `ext` , `dmode` , `dest` )';
示例12: createFeatureCode
public function createFeatureCode($id, $displayname = '')
{
$fcc = new \featurecode('timeconditions', 'toggle-mode-' . $id);
if ($displayname) {
$fcc->setDescription("{$id}: {$displayname}");
} else {
$fcc->setDescription($id . _(": Time Condition Override"));
}
$fcc->setDefault('*27' . $id);
$fcc->setProvideDest();
$fcc->update();
unset($fcc);
$this->setState($id, '');
}
示例13: isset
{
echo $text;
}
}
$recordings_astsnd_path = isset($amp_conf['ASTVARLIBDIR']) ? $amp_conf['ASTVARLIBDIR'] : '/var/lib/asterisk';
$recordings_astsnd_path .= "/sounds/";
$autoincrement = $amp_conf["AMPDBENGINE"] == "sqlite" || $amp_conf["AMPDBENGINE"] == "sqlite3" ? "AUTOINCREMENT" : "AUTO_INCREMENT";
require_once $amp_conf['AMPWEBROOT'] . '/admin/modules/recordings/functions.inc.php';
$fcc = new featurecode('recordings', 'record_save');
$fcc->setDescription('Save Recording');
$fcc->setDefault('*77');
$fcc->update();
unset($fcc);
$fcc = new featurecode('recordings', 'record_check');
$fcc->setDescription('Check Recording');
$fcc->setDefault('*99');
$fcc->update();
unset($fcc);
// Make sure table exists
if ($amp_conf["AMPDBENGINE"] == 'sqlite3') {
$sql = "CREATE TABLE IF NOT EXISTS recordings ( \n\t\t`id` integer NOT NULL PRIMARY KEY AUTOINCREMENT, \n\t\tdisplayname VARCHAR(50) , filename BLOB, description \n\t\tVARCHAR(254))\n\t;";
} else {
$sql = "CREATE TABLE IF NOT EXISTS recordings ( \n\t\tid INTEGER NOT NULL PRIMARY KEY {$autoincrement},\n\t\tdisplayname VARCHAR(50) , \n\t\tfilename BLOB, \n\t\tdescription VARCHAR(254))\n\t;";
}
$result = $db->query($sql);
if (DB::IsError($result)) {
die_freepbx($result->getDebugInfo());
}
// load up any recordings that might be in the directory
$recordings_directory = $recordings_astsnd_path . "custom/";
if (!file_exists($recordings_directory)) {
示例14: out
} else {
out(_("unknown error"));
}
} else {
out(_("done"));
}
outn(_("Updating simu_fax in miscdest table.."));
$check = $db->query("UPDATE miscdests set destdial = '{fax:simu_fax}' WHERE destdial = '{core:simu_fax}'");
if (DB::IsError($check)) {
out(_("not needed"));
} else {
out(_("done"));
}
$fcc = new featurecode('fax', 'simu_fax');
$fcc->setDescription('Dial System FAX');
$fcc->setDefault('666');
$fcc->setProvideDest();
$fcc->update();
unset($fcc);
//check to make sure that min/maxrate and ecm are set; if not set them to defaults
$settings = sql('SELECT * FROM fax_details', 'getAssoc', 'DB_FETCHMODE_ASSOC');
foreach ($settings as $setting => $value) {
$set[$setting] = $value['0'];
}
if (!is_array($set)) {
$set = array();
}
//never return a null value
if (!$set['minrate']) {
$sql[] = 'REPLACE INTO fax_details (`key`, `value`) VALUES ("minrate","14400")';
}
示例15: edit
public function edit($miscapps_id, $description, $ext, $dest, $enabled = true)
{
$db = $this->db;
$sql = 'UPDATE miscapps SET description = ?, ext = ?, dest = ? WHERE miscapps_id = ?';
$q = $db->prepare($sql);
$q->execute(array($description, $ext, $dest, $miscapps_id));
if ($q) {
$fc = new \featurecode('miscapps', 'miscapp_' . $miscapps_id);
$fc->setDescription($description);
$fc->setDefault($ext, true);
$fc->setEnabled($enabled);
$fc->update();
}
}