本文整理汇总了PHP中orm::name方法的典型用法代码示例。如果您正苦于以下问题:PHP orm::name方法的具体用法?PHP orm::name怎么用?PHP orm::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类orm
的用法示例。
在下文中一共展示了orm::name方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'backup';
$array[$x]['default_setting_subcategory'] = 'path';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = $_SESSION['switch']['db']['dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_category = 'backup' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$x = 0;
foreach ($array as $row) {
$found = false;
foreach ($default_settings as $field) {
if ($row['default_setting_subcategory'] == $field['default_setting_subcategory']) {
$found = true;
$break;
}
}
if (!$found) {
$orm = new orm();
$orm->name('default_settings');
$orm->save($array[$x]);
$message = $orm->message;
}
$x++;
}
}
示例2: strtolower
$device_profiles[0]["device_profile_name"] = $device_profiles[0]["device_profile_name"] . "-" . strtolower($text['button-copy']);
$device_profiles[0]["device_profile_description"] = $text['button-copy'] . " " . $device_profiles[0]["device_profile_description"];
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_profile_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
//$x = 0;
//foreach ($device_settings as $row) {
// unset($device_settings[$x]["device_uuid"]);
// unset($device_settings[$x]["device_setting_uuid"]);
// $x++;
//}
//create the device array
$device_profile = $device_profiles[0];
$device_profile["device_keys"] = $device_keys;
//$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm();
$orm->name('device_profiles');
$orm->save($device_profile);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: device_profiles.php");
return;
示例3: dialplan
/**
* Add a dialplan for call center
* @var string $domain_uuid the multi-tenant id
* @var string $value string to be cached
*/
public function dialplan()
{
//normalize the fax forward number
if (strlen($this->fax_forward_number) > 3) {
//$fax_forward_number = preg_replace("~[^0-9]~", "",$fax_forward_number);
$this->fax_forward_number = str_replace(" ", "", $this->fax_forward_number);
$this->fax_forward_number = str_replace("-", "", $this->fax_forward_number);
}
//set the forward prefix
if (strripos($this->fax_forward_number, '$1') === false) {
$this->forward_prefix = '';
//not found
} else {
$this->forward_prefix = $this->forward_prefix . $this->fax_forward_number . '#';
//found
}
//delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) {
//delete the previous dialplan
$sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
$sql = "delete from v_dialplan_details ";
$sql .= "where dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
unset($sql);
}
unset($prep_statement);
//build the dialplan array
$dialplan["app_uuid"] = "24108154-4ac3-1db6-1551-4731703a4440";
$dialplan["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_name"] = $this->fax_name != '' ? $this->fax_name : format_phone($this->destination_number);
$dialplan["dialplan_number"] = $this->fax_extension;
$dialplan["dialplan_context"] = $_SESSION['context'];
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_order"] = "310";
$dialplan["dialplan_enabled"] = "true";
$dialplan["dialplan_description"] = $this->fax_description;
$dialplan_detail_order = 10;
//add the public condition
$y = 1;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^" . $this->destination_number . "\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "fax_uuid=" . $this->fax_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "api_hangup_hook=lua app/fax/resources/scripts/hangup_rx.lua";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
foreach ($_SESSION['fax']['variable'] as $data) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (substr($data, 0, 8) == "inbound:") {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($data, 8, strlen($data));
} elseif (substr($data, 0, 9) == "outbound:") {
} else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $data;
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (strlen($_SESSION['fax']['last_fax']['text']) > 0) {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=" . $_SESSION['fax']['last_fax']['text'];
} else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=\${caller_id_number}-\${strftime(%Y-%m-%d-%H-%M-%S)}";
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
//.........这里部分代码省略.........
示例4: unset
$_POST["ring_group_destinations"][$x]["domain_uuid"] = $_SESSION['domain_uuid'];
}
//unset the empty row
if (strlen($_POST["ring_group_destinations"][$x]["destination_number"]) == 0) {
unset($_POST["ring_group_destinations"][$x]);
}
//unset ring_group_destination_uuid if the field has no value
if (strlen($row["ring_group_destination_uuid"]) == 0) {
unset($_POST["ring_group_destinations"][$x]["ring_group_destination_uuid"]);
}
//increment the row
$x++;
}
//save to the data
$orm = new orm();
$orm->name('ring_groups');
if (strlen($ring_group_uuid) > 0) {
$orm->uuid($ring_group_uuid);
}
$orm->save($_POST);
$message = $orm->message;
if (strlen($ring_group_uuid) == 0) {
$ring_group_uuid = $message['uuid'];
$_GET["id"] = $ring_group_uuid;
}
}
//delete the dialplan details
$sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
$sql .= "and dialplan_uuid = '" . $dialplan_uuid . "' ";
$db->exec(check_sql($sql));
示例5: unset
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm();
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
示例6: header
}
header("Location: time_condition_edit.php?id=" . $dialplan_uuid . ($app_uuid != '' ? "&app_uuid=" . $app_uuid : null));
return;
}
//end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//get existing data to pre-populate form
if ($dialplan_uuid != '' && $_POST["persistformvar"] != "true") {
//add the dialplan permission
$p = new permissions();
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//get main dialplan entry
$orm = new orm();
$orm->name('dialplans');
$orm->uuid($dialplan_uuid);
$result = $orm->find()->get();
//$message = $orm->message;
foreach ($result as &$row) {
$domain_uuid = $row["domain_uuid"];
//$app_uuid = $row["app_uuid"];
$dialplan_name = $row["dialplan_name"];
$dialplan_number = $row["dialplan_number"];
$dialplan_order = $row["dialplan_order"];
$dialplan_continue = $row["dialplan_continue"];
$dialplan_context = $row["dialplan_context"];
$dialplan_enabled = $row["dialplan_enabled"];
$dialplan_description = $row["dialplan_description"];
}
unset($prep_statement);
示例7: header
if ($action == "update") {
$_SESSION["message"] = $text['message-update'];
}
header("Location: destination_edit.php?id=" . $destination_uuid);
return;
}
//if ($_POST["persistformvar"] != "true")
}
//(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)
//initialize the destinations object
$destination = new destinations();
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$destination_uuid = $_GET["id"];
$orm = new orm();
$orm->name('destinations');
$orm->uuid($destination_uuid);
$result = $orm->find()->get();
foreach ($result as &$row) {
$domain_uuid = $row["domain_uuid"];
$dialplan_uuid = $row["dialplan_uuid"];
$destination_type = $row["destination_type"];
$destination_number = $row["destination_number"];
$destination_caller_id_name = $row["destination_caller_id_name"];
$destination_caller_id_number = $row["destination_caller_id_number"];
$destination_cid_name_prefix = $row["destination_cid_name_prefix"];
$destination_context = $row["destination_context"];
$fax_uuid = $row["fax_uuid"];
$destination_enabled = $row["destination_enabled"];
$destination_description = $row["destination_description"];
$currency = $row["currency"];
示例8: dialplan
/**
* Add a dialplan for call center
* @var string $domain_uuid the multi-tenant id
* @var string $value string to be cached
*/
public function dialplan()
{
//delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) {
//delete the previous dialplan
$sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
$sql = "delete from v_dialplan_details ";
$sql .= "where dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
unset($sql);
}
unset($prep_statement);
//build the dialplan array
$dialplan["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370";
$dialplan["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_name"] = $this->queue_name != '' ? $this->queue_name : format_phone($this->destination_number);
$dialplan["dialplan_number"] = $this->destination_number;
$dialplan["dialplan_context"] = $_SESSION['context'];
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_order"] = "210";
$dialplan["dialplan_enabled"] = "true";
$dialplan["dialplan_description"] = $this->queue_description;
$dialplan_detail_order = 10;
//add the public condition
$y = 1;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^([^#]+#)(.*)\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "never";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "caller_id_name=\$2";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^" . $this->destination_number . "\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "hangup_after_bridge=true";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_cid_prefix) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=" . $this->queue_cid_prefix . "#\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "callcenter";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $this->queue_name . '@' . $_SESSION["domain_name"];
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_timeout_action) > 0) {
$action_array = explode(":", $this->queue_timeout_action);
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $action_array[0];
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($this->queue_timeout_action, strlen($action_array[0]) + 1, strlen($this->queue_timeout_action));
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
//.........这里部分代码省略.........
示例9: dialplan
public function dialplan($field)
{
//set global variables
global $db;
//action add or update
if (strlen($field['dialplan_uuid']) == 0) {
$field['dialplan_uuid'] = uuid();
$action = "add";
} else {
$action = "update";
}
//delete child data
if ($action == "update") {
$sql = "delete from v_dialplan_details ";
$sql .= "where dialplan_uuid = '" . $field["dialplan_uuid"] . "'; ";
$db->query($sql);
unset($sql);
}
//get dialplan details from the database
if ($action == "update") {
$sql = "select * from v_dialplan_details ";
$sql .= "where dialplan_uuid = '" . $field["dialplan_uuid"] . "' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$dialplan_details = $prep_statement->fetchAll(PDO::FETCH_NAMED);
}
unset($sql, $prep_statement, $row);
}
//get the array from the database
/*
$database = new database;
if ($this->db) { $database->db = $this->db; }
$database->table = "v_ivr_menu_details";
$database->where[0]['name'] = 'ivr_menu_uuid';
$database->where[0]['value'] = $field["ivr_menu_uuid"];
$database->where[0]['operator'] = '=';
$ivr_menu_details = $database->find();
*/
//add the details array
$x = 0;
$details[$x]['dialplan_detail_tag'] = 'condition';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'destination_number';
$details[$x]['dialplan_detail_data'] = '^' . $field['ivr_menu_extension'] . '$';
$details[$x]['dialplan_detail_order'] = '005';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'answer';
$details[$x]['dialplan_detail_data'] = '';
$details[$x]['dialplan_detail_order'] = '010';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'sleep';
$details[$x]['dialplan_detail_data'] = '1000';
$details[$x]['dialplan_detail_order'] = '015';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'set';
$details[$x]['dialplan_detail_data'] = 'hangup_after_bridge=true';
$details[$x]['dialplan_detail_order'] = '020';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'set';
if ($field['ivr_menu_ringback'] == "music" || $field['ivr_menu_ringback'] == "") {
$details[$x]['dialplan_detail_data'] = 'ringback=${hold_music}';
} else {
$details[$x]['dialplan_detail_data'] = 'ringback=' . $field['ivr_menu_ringback'];
}
$details[$x]['dialplan_detail_order'] = '025';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'set';
if ($field['ivr_menu_ringback'] == "music" || $field['ivr_menu_ringback'] == "") {
$details[$x]['dialplan_detail_data'] = 'transfer_ringback=${hold_music}';
} else {
$details[$x]['dialplan_detail_data'] = 'transfer_ringback=' . $field['ivr_menu_ringback'];
}
$details[$x]['dialplan_detail_order'] = '030';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'set';
$details[$x]['dialplan_detail_data'] = 'ivr_menu_uuid=' . $this->ivr_menu_uuid;
$details[$x]['dialplan_detail_order'] = '035';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
if ($_SESSION['ivr menu']['application']['text'] == "lua") {
$details[$x]['dialplan_detail_type'] = 'lua';
$details[$x]['dialplan_detail_data'] = 'ivr_menu.lua';
} else {
$details[$x]['dialplan_detail_type'] = 'ivr';
$details[$x]['dialplan_detail_data'] = $this->ivr_menu_uuid;
}
//.........这里部分代码省略.........
示例10: settings
/**
* settings Set switch directories in default settings
*/
public function settings()
{
//define the variables
if (!isset($this->event_socket_ip_address)) {
$this->event_socket_ip_address = $_SESSION['event_socket_ip_address'];
}
if (!isset($this->event_socket_port)) {
$this->event_socket_port = $_SESSION['event_socket_port'];
}
if (!isset($this->event_socket_password)) {
$this->event_socket_password = $_SESSION['event_socket_password'];
}
//connect to event socket
$esl = new event_socket();
$esl->connect($this->event_socket_ip_address, $this->event_socket_port, $this->event_socket_password);
//run the api command
$result = $esl->request('api global_getvar');
//close event socket
fclose($fp);
//set the result as a named array
$vars = array();
foreach (explode("\n", $result) as $row) {
$a = explode("=", $row);
if (substr($a[0], -4) == "_dir") {
$vars[$a[0]] = $a[1];
}
}
//set the bin directory
if ($vars['base_dir'] == "/usr/local/freeswitch") {
$bin = "/usr/local/freeswitch/bin";
} else {
$bin = "";
}
//create the default settings array
$x = 0;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'bin';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $bin;
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'base';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['base_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'call_center';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['conf_dir'] . '/autoload_configs';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'conf';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['conf_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'db';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['db_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'dialplan';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['conf_dir'] . '/dialplan';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'extensions';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['conf_dir'] . '/directory';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'grammar';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['grammar_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'switch';
$array[$x]['default_setting_subcategory'] = 'log';
$array[$x]['default_setting_name'] = 'dir';
$array[$x]['default_setting_value'] = $vars['log_dir'];
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
//.........这里部分代码省略.........