本文整理汇总了PHP中generarDSNSistema函数的典型用法代码示例。如果您正苦于以下问题:PHP generarDSNSistema函数的具体用法?PHP generarDSNSistema怎么用?PHP generarDSNSistema使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generarDSNSistema函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _formatReportForExtension
protected function _formatReportForExtension($smarty, $module_name, $extension, &$respuesta)
{
$dsnAsteriskCDR = generarDSNSistema("asteriskuser", "asteriskcdrdb");
$pDB = new paloDB($dsnAsteriskCDR);
if (!empty($pDB->errMsg)) {
$respuesta['status'] = 'error';
$respuesta['message'] = _tr('Error at read yours calls.') . $pDB->errMsg;
} else {
$sql = <<<SQL_LLAMADAS_RECIBIDAS
SELECT calldate, src, duration, disposition FROM cdr
WHERE dst = ? OR SUBSTRING_INDEX(SUBSTRING_INDEX(dstchannel,'-',1),'/',-1) = ?
ORDER BY calldate DESC LIMIT ?
SQL_LLAMADAS_RECIBIDAS;
$recordset = $pDB->fetchTable($sql, TRUE, array($extension, $extension, MAX_CALL_RECORDS));
if (!is_array($recordset)) {
$respuesta['status'] = 'error';
$respuesta['message'] = _tr('Error at read yours calls.') . $pDB->errMsg;
} elseif (count($recordset) <= 0) {
$respuesta['html'] = _tr("You don't recibed calls");
} else {
$estadoLlamadas = array();
foreach ($recordset as $tupla) {
$answ = $tupla['disposition'] == 'ANSWERED';
$estadoLlamadas[] = str_replace(array('{status}', '{date}', '{source}'), array($answ ? _tr('answered') : _tr('missed'), $tupla['calldate'], empty($tupla['src']) ? _tr('unknow') : $tupla['src']), _tr('call record')) . ($answ ? str_replace('{time}', $tupla['duration'], _tr('call duration')) : '.');
}
$respuesta['html'] = implode('<br/>', $estadoLlamadas);
}
}
}
示例2: _moduleContent
function _moduleContent(&$smarty, $module_name)
{
global $arrConf;
//folder path for custom templates
$local_templates_dir = getWebDirModule($module_name);
//conexion resource
$dsn = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
$pDB = new paloDB($dsn);
//user credentials
global $arrCredentials;
$action = getAction();
$content = "";
switch ($action) {
case 'delete':
$content = deleteRecord($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
break;
case 'download':
$content = downloadFile($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
break;
case "display_record":
$content = display_record($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
break;
default:
$content = reportMonitoring($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
break;
}
return $content;
}
示例3: paloSantoReportCall
function paloSantoReportCall(&$pDB_cdr, &$pDB_billing = null)
{
$this->CargarIdiomas();
// Se recibe como parámetro una referencia a una conexión paloDB
if (is_object($pDB_cdr)) {
$this->_DB_cdr =& $pDB_cdr;
$this->errMsg = $this->_DB_cdr->errMsg;
} else {
if ($pDB_cdr == '') {
$pDB_cdr = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
}
$dsn = (string) $pDB_cdr;
$this->_DB_cdr = new paloDB($dsn);
if (!$this->_DB_cdr->connStatus) {
$this->errMsg = $this->_DB_cdr->errMsg;
// debo llenar alguna variable de error
} else {
// debo llenar alguna variable de error
}
}
if (is_object($pDB_billing)) {
$this->_DB_billing =& $pDB_billing;
$this->errMsg = $this->_DB_billing->errMsg;
} else {
$dsn = (string) $pDB_billing;
$this->_DB_billing = new paloDB($dsn);
if (!$this->_DB_billing->connStatus) {
$this->errMsg = $this->_DB_billing->errMsg;
// debo llenar alguna variable de error
} else {
// debo llenar alguna variable de error
}
}
}
示例4: core_AddressBook
/**
* Constructor
*
*/
public function core_AddressBook()
{
$this->_id_user = NULL;
$this->_pACL = NULL;
$this->errMsg = NULL;
$this->_dbCache = array();
$this->_astDSN = generarDSNSistema('asteriskuser', 'asterisk', $_SERVER['DOCUMENT_ROOT'] . '/');
}
示例5: _moduleContent
function _moduleContent(&$smarty, $module_name)
{
//include module files
include_once "modules/{$module_name}/configs/default.conf.php";
include_once "modules/{$module_name}/libs/paloSantoMyExtension.class.php";
//include file language agree to elastix configuration
//if file language not exists, then include language by default (en)
$lang = get_language();
$base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
$lang_file = "modules/{$module_name}/lang/{$lang}.lang";
if (file_exists("{$base_dir}/{$lang_file}")) {
include_once "{$lang_file}";
} else {
include_once "modules/{$module_name}/lang/en.lang";
}
//global variables
global $arrConf;
global $arrConfModule;
global $arrLang;
global $arrLangModule;
$arrConf = array_merge($arrConf, $arrConfModule);
$arrLang = array_merge($arrLang, $arrLangModule);
//folder path for custom templates
$templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
$local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
//conexion resource
$arrConf['dsn_conn_database'] = generarDSNSistema('asteriskuser', 'asterisk');
$pDB = new paloDB($arrConf['dsn_conn_database']);
$pDBACL = new paloDB($arrConf['elastix_dsn']['acl']);
$pACL = new paloACL($pDBACL);
$user = isset($_SESSION['elastix_user']) ? $_SESSION['elastix_user'] : "";
$extension = $pACL->getUserExtension($user);
$isAdministrator = $pACL->isUserAdministratorGroup($user);
if ($extension == "" || is_null($extension)) {
if ($isAdministrator) {
$smarty->assign("mb_message", "<b>" . $arrLang["no_extension"] . "</b>");
} else {
$smarty->assign("mb_message", "<b>" . $arrLang["contact_admin"] . "</b>");
}
return "";
}
//actions
$action = getAction();
$content = "";
switch ($action) {
case "save_new":
$content = saveNewMyExtension($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang, $extension, $isAdministrator);
break;
default:
// view_form
$content = viewFormMyExtension($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang, $extension);
break;
}
return $content;
}
示例6: _moduleContent
function _moduleContent(&$smarty, $module_name)
{
//include module files
include_once "modules/{$module_name}/configs/default.conf.php";
include_once "modules/{$module_name}/libs/paloSantoMissedCalls.class.php";
//include file language agree to elastix configuration
//if file language not exists, then include language by default (en)
$lang = get_language();
$base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
$lang_file = "modules/{$module_name}/lang/{$lang}.lang";
if (file_exists("{$base_dir}/{$lang_file}")) {
include_once "{$lang_file}";
} else {
include_once "modules/{$module_name}/lang/en.lang";
}
//global variables
global $arrConf;
global $arrConfModule;
global $arrLang;
global $arrLangModule;
$arrConf = array_merge($arrConf, $arrConfModule);
$arrLang = array_merge($arrLang, $arrLangModule);
//folder path for custom templates
$templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
$local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
// cdr connection
$dsn = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
$pDB_cdr = new paloDB($dsn);
// call_center connection
$pDB_callcenter = new paloDB($arrConf['cadena_dsn']);
$pDBACL = new paloDB($arrConf['elastix_dsn']['acl']);
if (!empty($pDBACL->errMsg)) {
return "ERROR DE DB: {$pDBACL->errMsg}";
}
$pACL = new paloACL($pDBACL);
if (!empty($pACL->errMsg)) {
return "ERROR DE ACL: {$pACL->errMsg}";
}
//actions
$action = getAction();
switch ($action) {
case 'call2phone':
$content = call2phone();
break;
default:
$content = reportMissedCalls($smarty, $module_name, $local_templates_dir, $pDB_callcenter, $pDBACL, $pACL, $arrConf, $pDB_cdr);
break;
}
return $content;
}
示例7: Obtain_Protocol_Current_User
function Obtain_Protocol_Current_User($arrConf)
{
$pDB_acl = new paloDB($arrConf['elastix_dsn']['acl']);
$pACL = new paloACL($pDB_acl);
$username = $_SESSION["elastix_user"];
$extension = $pACL->getUserExtension($username);
if ($extension) {
$dsnAsterisk = generarDSNSistema('asteriskuser', 'asterisk');
$pDB = new paloDB($dsnAsterisk);
$query = "SELECT dial, description, id FROM devices WHERE id={$extension}";
$result = $pDB->getFirstRowQuery($query, TRUE);
if ($result != FALSE) {
return $result;
} else {
return FALSE;
}
} else {
return FALSE;
}
}
示例8: formularioModificarCola
function formularioModificarCola($pDB, $smarty, $module_name, $local_templates_dir, $idCola)
{
require_once "libs/paloSantoForm.class.php";
require_once "libs/paloSantoQueue.class.php";
// Si se ha indicado cancelar, volver a listado sin hacer nada más
if (isset($_POST['cancel'])) {
Header("Location: ?menu={$module_name}");
return '';
}
$smarty->assign(array('FRAMEWORK_TIENE_TITULO_MODULO' => existeSoporteTituloFramework(), 'icon' => 'images/kfaxview.png', 'SAVE' => _tr('guardar'), 'CANCEL' => _tr('cancelar'), 'id_queue' => $idCola));
// Leer todas las colas disponibles
$dsnAsterisk = generarDSNSistema('asteriskuser', 'asterisk');
$oDBAsterisk = new paloDB($dsnAsterisk);
$oQueue = new paloQueue($oDBAsterisk);
$arrQueues = $oQueue->getQueue();
if (!is_array($arrQueues)) {
$smarty->assign("mb_title", _tr('Unable to read queues'));
$smarty->assign("mb_message", _tr('Cannot read queues') . ' - ' . $oQueue->errMsg);
$arrQueues = array();
}
$oColas = new paloSantoColaEntrante($pDB);
// Leer todos los datos de la cola entrante, si es necesario
$arrColaEntrante = NULL;
if (!is_null($idCola)) {
$arrColaEntrante = $oColas->leerColas($idCola);
if (!is_array($arrColaEntrante) || count($arrColaEntrante) == 0) {
$smarty->assign("mb_title", _tr('Unable to read incoming queue'));
$smarty->assign("mb_message", _tr('Cannot read incoming queue') . ' - ' . $oColas->errMsg);
return '';
}
}
/* Para nueva cola, se deben remover las colas ya usadas. Para cola
* modificada, sólo se muestra la cola que ya estaba asignada. */
if (is_null($idCola)) {
// Filtrar las colas que ya han sido usadas
$arrFilterQueues = $oColas->filtrarColasUsadas($arrQueues);
} else {
// Colocar sólo la información de la cola asignada
$arrFilterQueues = array();
foreach ($arrQueues as $tuplaQueue) {
if ($tuplaQueue[0] == $arrColaEntrante[0]['queue']) {
$arrFilterQueues[] = $tuplaQueue;
}
}
}
$arrDataQueues = array();
foreach ($arrFilterQueues as $tuplaQueue) {
$arrDataQueues[$tuplaQueue[0]] = $tuplaQueue[1];
}
// Valores por omisión para primera carga
if (is_null($idCola)) {
if (!isset($_POST['select_queue']) && count($arrFilterQueues) > 0) {
$_POST['select_queue'] = $arrFilterQueues[0][0];
}
if (!isset($_POST['rte_script'])) {
$_POST['rte_script'] = '';
}
} else {
$_POST['select_queue'] = $arrColaEntrante[0]['queue'];
if (!isset($_POST['rte_script'])) {
$_POST['rte_script'] = $arrColaEntrante[0]['script'];
}
}
// rte_script es un HTML complejo que debe de construirse con Javascript.
$smarty->assign("rte_script", adaptar_formato_rte($_POST['rte_script']));
// Generación del objeto de formulario
$form_campos = array("script" => array("LABEL" => _tr('Script'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "", "VALIDATION_EXTRA_PARAM" => ""), 'select_queue' => array("REQUIRED" => "yes", "LABEL" => is_null($idCola) ? _tr('Select Queue') . ' :' : _tr('Queue'), "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrDataQueues, "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""));
$oForm = new paloForm($smarty, $form_campos);
// Ejecutar el guardado de los cambios
if (isset($_POST['save'])) {
if (!$oForm->validateForm($_POST) || (!isset($_POST['rte_script']) || $_POST['rte_script'] == '')) {
// Falla la validación básica del formulario
$smarty->assign("mb_title", _tr("Validation Error"));
$arrErrores = $oForm->arrErroresValidacion;
$strErrorMsg = "<b>" . _tr('The following fields contain errors') . ":</b><br/>";
if (is_array($arrErrores) && count($arrErrores) > 0) {
foreach ($arrErrores as $k => $v) {
$strErrorMsg .= "{$k}, ";
}
}
if (!isset($_POST['rte_script']) || $_POST['rte_script'] == '') {
$strErrorMsg .= _tr("Script");
}
$strErrorMsg .= "";
$smarty->assign("mb_message", $strErrorMsg);
} else {
$bExito = $oColas->iniciarMonitoreoCola($_POST['select_queue'], $_POST['rte_script']);
if (!$bExito) {
$smarty->assign("mb_title", _tr('Unable to save incoming queue'));
$smarty->assign("mb_message", $oColas->errMsg);
} else {
Header("Location: ?menu={$module_name}");
}
}
}
return $oForm->fetchForm("{$local_templates_dir}/form.tpl", is_null($idCola) ? _tr('Select Queue') : _tr('Edit Queue'), null);
}
示例9: Obtain_Protocol
function Obtain_Protocol($extension)
{
if ($extension) {
$dsnAsterisk = generarDSNSistema('asteriskuser', 'asterisk');
$pDB = new paloDB($dsnAsterisk);
$query = "SELECT dial, description, id FROM devices WHERE id=?";
$result = $pDB->getFirstRowQuery($query, TRUE, array($extension));
if ($result != FALSE) {
return $result;
} else {
return FALSE;
}
} else {
return FALSE;
}
}
示例10: generarDSNSistema
| The contents of this file are subject to the General Public License |
| (GPL) Version 2 (the "License"); you may not use this file except in |
| compliance with the License. You may obtain a copy of the License at |
| http://www.opensource.org/licenses/gpl-license.php |
| |
| Software distributed under the License is distributed on an "AS IS" |
| basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See |
| the License for the specific language governing rights and |
| limitations under the License. |
+----------------------------------------------------------------------+
| The Original Code is: Elastix Open Source. |
| The Initial Developer of the Original Code is PaloSanto Solutions |
+----------------------------------------------------------------------+
$Id: default.conf.php,v 1.1.1.1 2007/07/06 21:31:56 gcarrillo Exp $ */
global $arrConf;
$arrConf['dsn_mysql_elastix'] = generarDSNSistema("asteriskuser", "elxpbx");
$arrConf['elastix_dbdir'] = '/var/www/db';
$arrConf['elastix_dsn'] = array("elastix" => $arrConf['dsn_mysql_elastix'], "acl" => $arrConf['dsn_mysql_elastix'], "samples" => "sqlite3:///{$arrConf['elastix_dbdir']}/samples.db");
$arrConf['documentRoot'] = '/var/www/html';
$arrConf['basePath'] = '/var/www/html';
$arrConf['webCommon'] = 'web/_common';
$arrConf['elxPath'] = '/usr/share/elastix';
$arrConf['theme'] = 'default';
//theme personal para los modulos esencialmente
// Verifico si las bases del framework están, debido a la migración de dichas bases como archivos .db a archivos .sql
checkFrameworkDatabases($arrConf['elastix_dbdir']);
$arrConf['elastix_version'] = load_version_elastix($arrConf['basePath'] . "/");
//la version y le release del sistema elastix
$arrConf['defaultMenu'] = 'config';
$arrConf['language'] = 'en';
$arrConf['cadena_dsn'] = "mysql://asterisk:asterisk@localhost/call_center";
示例11: showMessageReload
function showMessageReload($module_name, &$pDB, $credentials)
{
$pDBMySQL = new paloDB(generarDSNSistema("asteriskuser", "elxpbx"));
$pAstConf = new paloSantoASteriskConfig($pDB);
$params = array();
$msgs = "";
$query = "SELECT domain, id from organization";
//si es superadmin aparece un link por cada organizacion que necesite reescribir su plan de mnarcada
if ($credentials["userlevel"] != "superadmin") {
$query .= " where id=?";
$params[] = $credentials["id_organization"];
}
$mensaje = _tr("Click here to reload dialplan");
$result = $pDB->fetchTable($query, false, $params);
if (is_array($result)) {
foreach ($result as $value) {
if ($value[1] != 1) {
$showmessage = $pAstConf->getReloadDialplan($value[0]);
if ($showmessage == "yes") {
$append = $credentials["userlevel"] == "superadmin" ? " {$value['0']}" : "";
$msgs .= "<div id='msg_status_{$value['1']}' class='mensajeStatus'><a href='?menu={$module_name}&action=reloadAsterisk&organization_id={$value['1']}'/><b>" . $mensaje . $append . "</b></a></div>";
}
}
}
}
return $msgs;
}
示例12: Copyright
+----------------------------------------------------------------------+
| Elastix version 2.0.4-5 |
| http://www.elastix.org |
+----------------------------------------------------------------------+
| Copyright (c) 2006 Palosanto Solutions S. A. |
+----------------------------------------------------------------------+
| Cdla. Nueva Kennedy Calle E 222 y 9na. Este |
| Telfs. 2283-268, 2294-440, 2284-356 |
| Guayaquil - Ecuador |
| http://www.palosanto.com |
+----------------------------------------------------------------------+
| The contents of this file are subject to the General Public License |
| (GPL) Version 2 (the "License"); you may not use this file except in |
| compliance with the License. You may obtain a copy of the License at |
| http://www.opensource.org/licenses/gpl-license.php |
| |
| Software distributed under the License is distributed on an "AS IS" |
| basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See |
| the License for the specific language governing rights and |
| limitations under the License. |
+----------------------------------------------------------------------+
| The Original Code is: Elastix Open Source. |
| The Initial Developer of the Original Code is PaloSanto Solutions |
+----------------------------------------------------------------------+
$Id: default.conf.php,v 1.1 2011-05-13 11:05:31 Estefanía Morán Meza emoran@palosanto.com Exp $ */
global $arrConf;
global $arrConfModule;
$arrConfModule['module_name'] = 'sec_advanced_settings';
$arrConfModule['templates_dir'] = 'themes';
$arrConfModule['dsn_conn_database'] = generarDSNSistema('root', 'asterisk', '/var/www/html/');
$arrConfModule['arr_conf_file'] = array(array("name" => "amportal.conf", "pass_name" => "AMPDBPASS", "path" => "/etc/"), array("name" => "res_mysql.conf", "pass_name" => "dbpass", "path" => "/etc/asterisk/"), array("name" => "cbmysql.conf", "pass_name" => "password", "path" => "/etc/asterisk/"), array("name" => "cdr_mysql.conf", "pass_name" => "password", "path" => "/etc/asterisk/"));
示例13: _moduleContent
function _moduleContent(&$smarty, $module_name)
{
//include module files
include_once "modules/{$module_name}/configs/default.conf.php";
include_once "modules/{$module_name}/libs/paloSantoCalendar.class.php";
// include_once "modules/$module_name/libs/JSON.php";
//include file language agree to elastix configuration
//if file language not exists, then include language by default (en)
$lang = get_language();
$base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
$lang_file = "modules/{$module_name}/lang/{$lang}.lang";
if (file_exists("{$base_dir}/{$lang_file}")) {
include_once "{$lang_file}";
} else {
include_once "modules/{$module_name}/lang/en.lang";
}
//global variables
global $arrConf;
global $arrConfModule;
global $arrLang;
global $arrLangModule;
$arrConf = array_merge($arrConf, $arrConfModule);
$arrLang = array_merge($arrLang, $arrLangModule);
//folder path for custom templates
$templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
$local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
//conexion resource
$pDB = new paloDB($arrConf['dsn_conn_database']);
//actions
$action = getAction();
$content = "";
switch ($action) {
case "save_new":
$content = saveEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
break;
case "edit":
$content = viewForm_NewEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
break;
case "delete":
$content = deleteEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
break;
case "save_edit":
$content = saveEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
break;
case "get_lang":
$content = getLanguages($arrLangModule, $arrConf);
break;
case "get_data":
$content = getDataCalendar($arrLang, $pDB, $module_name, $arrConf);
break;
case "get_num_ext":
$content = getNumExtesion($arrConf, $pDB, $arrLang);
break;
case "setData":
$content = setDataCalendar($arrLang, $pDB, $arrConf);
break;
case "view_box":
$content = viewBoxCalendar($arrConf, $arrLang, $pDB, $local_templates_dir, $smarty, $module_name);
break;
case "new_box":
$content = newBoxCalendar($arrConf, $arrLang, $pDB, $local_templates_dir, $smarty, $module_name);
break;
case "delete_box":
$content = deleteBoxCalendar($arrConf, $arrLang, $pDB, $module_name);
break;
case "download_icals":
$content = download_icals($arrLang, $pDB, $module_name, $arrConf);
break;
case "get_contacts2":
$content = getContactEmails2($arrConf);
break;
case "getTextToSpeach":
$content = getTextToSpeach($arrLang, $pDB);
break;
case "display":
$content = viewCalendarById($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
break;
case "phone_numbers":
// Include language file for EN, then for local, and merge the two.
$arrLangModule = NULL;
include_once "modules/address_book/lang/en.lang";
$lang_file = "modules/address_book/lang/{$lang}.lang";
if (file_exists("{$base_dir}/{$lang_file}")) {
$arrLanEN = $arrLangModule;
include_once $lang_file;
$arrLangModule = array_merge($arrLanEN, $arrLangModule);
}
$arrLang = array_merge($arrLang, $arrLangModule);
//solo para obtener los devices (extensiones) creadas.
$dsnAsterisk = generarDSNSistema('asteriskuser', 'asterisk');
$pDB_addressbook = new paloDB($arrConf['dsn_conn_database3']);
$pDB_acl = new paloDB($arrConf['dsn_conn_database1']);
$html = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB_addressbook, $pDB_acl, $arrLang, $dsnAsterisk);
$smarty->assign("CONTENT", $html);
$smarty->assign("THEMENAME", $arrConf['mainTheme']);
$smarty->assign("path", "");
$content = $smarty->display("{$local_templates_dir}/address_book_list.tpl");
break;
default:
// view_form
//.........这里部分代码省略.........
示例14: _obtenerConexion
private function _obtenerConexion($sConn)
{
global $arrConf;
switch ($sConn) {
case 'asterisk':
if (!is_null($this->_oDB_asterisk)) {
return $this->_oDB_asterisk;
}
$sDSN = generarDSNSistema('asteriskuser', 'asterisk');
$oDB = new paloDB($sDSN);
if ($oDB->connStatus) {
$this->_errMsg = '(internal) Unable to create asterisk DB conn - ' . $oDB->errMsg;
die($this->_errMsg);
}
$this->_oDB_asterisk = $oDB;
return $this->_oDB_asterisk;
break;
case 'call_center':
if (!is_null($this->_oDB_call_center)) {
return $this->_oDB_call_center;
}
$sDSN = $arrConf['cadena_dsn'];
$oDB = new paloDB($sDSN);
if ($oDB->connStatus) {
$this->_errMsg = '(internal) Unable to create asterisk DB conn - ' . $oDB->errMsg;
die($this->_errMsg);
}
$this->_oDB_call_center = $oDB;
return $this->_oDB_call_center;
break;
case 'ECCP':
if (!is_null($this->_eccp)) {
return $this->_eccp;
}
$sUsernameECCP = 'agentconsole';
$sPasswordECCP = 'agentconsole';
// Verificar si existe la contraseña de ECCP, e insertar si necesario
$dbConnCC = $this->_obtenerConexion('call_center');
$md5_passwd = $dbConnCC->getFirstRowQuery('SELECT md5_password FROM eccp_authorized_clients WHERE username = ?', TRUE, array($sUsernameECCP));
if (is_array($md5_passwd)) {
if (count($md5_passwd) <= 0) {
$dbConnCC->genQuery('INSERT INTO eccp_authorized_clients (username, md5_password) VALUES(?, md5(?))', array($sUsernameECCP, $sPasswordECCP));
}
}
$oECCP = new ECCP();
// TODO: configurar credenciales
$cr = $oECCP->connect("localhost", $sUsernameECCP, $sPasswordECCP);
if (isset($cr->failure)) {
throw new ECCPUnauthorizedException(_tr('Failed to authenticate to ECCP') . ': ' . (string) $cr->failure->message);
}
if (!is_null($this->_agent)) {
$oECCP->setAgentNumber($this->_agent);
/* Privilegio de localhost - se puede recuperar la clave del
* agente sin tener que pedirla explícitamente */
$tupla = $dbConnCC->getFirstRowQuery("SELECT eccp_password FROM agent WHERE CONCAT(type,'/',number) = ? AND estatus='A'", FALSE, array($this->_agent));
if (!is_array($tupla)) {
throw new ECCPConnFailedException(_tr('Failed to retrieve agent password'));
}
if (count($tupla) <= 0) {
throw new ECCPUnauthorizedException(_tr('Agent not found'));
}
if (is_null($tupla[0])) {
throw new ECCPUnauthorizedException(_tr('Agent not authorized for ECCP - ECCP password not set'));
}
$oECCP->setAgentPass($tupla[0]);
// Filtrar los eventos sólo para el agente actual
$oECCP->filterbyagent();
}
$this->_eccp = $oECCP;
return $this->_eccp;
break;
}
return NULL;
}
示例15: getListMailbox
function getListMailbox()
{
try {
$userAccounts = array();
$regexpUsuario = '/^[a-z0-9]+([\\._\\-]?[a-z0-9]+[_\\-]?)*@[a-z0-9]+([\\._\\-]?[a-z0-9]+)*(\\.[a-z0-9]{2,6})+$/';
$arrDBConn = parseDSN(generarDSNSistema("asteriskuser", "elxpbx"));
$conn = new PDO($arrDBConn["dsn"], $arrDBConn["user"], $arrDBConn["passwd"]);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sqlEmailInfo = <<<EMAIL_INFO
SELECT username FROM acl_user
EMAIL_INFO;
foreach ($conn->query($sqlEmailInfo) as $row) {
if (preg_match($regexpUsuario, $row['username'])) {
$userAccounts[] = $row['username'];
}
}
return $userAccounts;
} catch (PDOException $e) {
wlog("ERR: failed to read account information - " . $e->getMessage() . "\n");
return false;
}
}