Пример #1
0
function listParameterFaxMail($smarty, $module_name, $local_templates_dir, $pDB, $credentials)
{
    $arrData = array();
    $oFax = new paloFax($pDB);
    global $arrPermission;
    $smarty->assign("EDIT", in_array('edit', $arrPermission));
    if (getParameter("submit_apply_change")) {
        $arrParameterFaxMail = $_POST;
    } else {
        $arrParameterFaxMail = $oFax->getConfigurationSendingFaxMailOrg($credentials['id_organization']);
        if ($arrParameterFaxMail === false) {
            $smarty->assign("mb_title", "ERROR");
            $smarty->assign("mb_message", "An error has ocurred to retrieved email fax configutaion");
        }
    }
    // Definición del formulario
    $smarty->assign("REQUIRED_FIELD", _tr("Required field"));
    $smarty->assign("CANCEL", _tr("Cancel"));
    $smarty->assign("APPLY_CHANGES", _tr("Apply changes"));
    $smarty->assign("SAVE", _tr("Save"));
    $smarty->assign("EDIT", _tr("Edit"));
    $smarty->assign("EDIT_PARAMETERS", _tr("Edit Parameters"));
    $smarty->assign("icon", "web/apps/{$module_name}/images/fax_email_template.png");
    $arrFaxConfig = createForm();
    $oForm = new paloForm($smarty, $arrFaxConfig);
    if (getParameter("submit_apply_change") || getParameter("submit_edit")) {
        $oForm->setEditMode();
    } else {
        $oForm->setViewMode();
    }
    return $oForm->fetchForm("{$local_templates_dir}/parameterFaxMail.tpl", _tr("Configuration Sending Fax Mail"), $arrParameterFaxMail);
}
 function deleteUserOrganization($idUser)
 {
     $pACL = new paloACL($this->_DB);
     $pEmail = new paloEmail($this->_DB);
     $pFax = new paloFax($this->_DB);
     $Exito = false;
     //1)se comprueba de que el ID de USUARIO se un numero
     //2)se verifica que exista dicho usuario
     //3)se recompila los datos del usuario de las tablas acl_user y user_properties
     //4)se elimina al usuario de la base
     //5)se elimina la extension de uso del usuario y la extension de fax
     //6)se trata de eliminar la cuenta de fax
     //7)se elimina el buzon de correo
     if (!preg_match('/^[[:digit:]]+$/', "{$idUser}")) {
         $this->errMsg = _tr("User ID is not numeric");
         return false;
     } else {
         $arrUser = $pACL->getUsers($idUser);
         if ($arrUser === false || count($arrUser) == 0) {
             $this->errMsg = _tr("User dosen't exist");
             return false;
         }
     }
     $idDomain = $arrUser[0][4];
     $query = "Select domain from organization where id=?";
     $getDomain = $this->_DB->getFirstRowQuery($query, false, array($idDomain));
     if ($getDomain == false) {
         $this->errMsg = $this->_DB->errMsg;
         return false;
     }
     $pDevice = new paloDevice($getDomain[0], "sip", $this->_DB);
     $arrExten = $pDevice->getExtension($arrUser[0][5]);
     $faxList = $pFax->getFaxList($arrUser[0][6], $getDomain[0]);
     $arrFaxExten = $faxList[0];
     $this->_DB->beginTransaction();
     //tomamos un backup de las extensiones que se van a eliminar de la base astDB por si algo sale mal
     //y ahi que restaurar la extension
     $arrExt = $pDevice->backupAstDBEXT($arrUser[0][5]);
     if ($pDevice->deleteExtension($arrUser[0][5])) {
         if ($pFax->deleteFaxByUser($idUser)) {
             if ($pACL->deleteUser($idUser)) {
                 if ($pEmail->deleteAccount($arrUser[0][1])) {
                     $Exito = true;
                     $this->_DB->commit();
                     $pDevice->tecnologia->prunePeer($arrExten["device"], $arrExten["tech"]);
                     $pDevice->tecnologia->prunePeer($arrFaxExten["device"], $arrFaxExten["tech"]);
                     $pFax->restartService();
                 } else {
                     $this->errMsg = _tr("Email Account cannot be deleted") . $pEmail->errMsg;
                     $this->_DB->rollBack();
                     $pDevice->restoreBackupAstDBEXT($arrExt);
                     $pFax->createFaxFileConfig($arrFaxExten['dev_id'], $getDomain[0]);
                 }
             } else {
                 $this->errMsg = $pACL->errMsg;
                 $this->_DB->rollBack();
                 $pDevice->restoreBackupAstDBEXT($arrExt);
                 $pFax->createFaxFileConfig($arrFaxExten['dev_id'], $getDomain[0]);
             }
         } else {
             $this->errMsg = _tr("Fax cannot be deleted") . $pFax->errMsg;
             $this->_DB->rollBack();
             $pDevice->restoreBackupAstDBEXT($arrExt);
         }
     } else {
         $this->errMsg = _tr("User Extension can't be deleted") . $pDevice->errMsg;
         $this->_DB->rollBack();
         $pDevice->restoreBackupAstDBEXT($arrExt);
     }
     return $Exito;
 }
Пример #3
0
function listParameterFaxMail($smarty, $module_name, $local_templates_dir, $oForm)
{
    global $arrLang;
    $arrData = array();
    $oFax = new paloFax();
    $arrParameterFaxMail = $oFax->getConfigurationSendingFaxMail();
    $oForm->setViewMode();
    return $oForm->fetchForm("{$local_templates_dir}/parameterFaxMail.tpl", $arrLang["Configuration Sending Fax Mail"], $arrParameterFaxMail);
}
Пример #4
0
function checkFaxStatus()
{
    session_commit();
    $jobid = getParameter('jobid');
    $modem = getParameter('modem');
    $oldhash = getParameter('outputhash');
    $startTime = time();
    do {
        $faxinfo = paloFax::getFaxStatus();
        $faxstatus = array('state' => 'F', 'modemstatus' => '(invalid modem)', 'status' => '(invalid jobid)');
        if (isset($faxinfo['modems'][$modem])) {
            $faxstatus['modemstatus'] = $modem . ': ' . $faxinfo['modems'][$modem];
        }
        if (isset($faxinfo['jobs'][$jobid])) {
            $faxstatus = array_merge($faxstatus, $faxinfo['jobs'][$jobid]);
        }
        $newhash = md5(serialize($faxstatus));
        if ($oldhash == $newhash) {
            usleep(2 * 1000000);
        }
    } while ($oldhash == $newhash && time() - $startTime < 30);
    $jsonObject = new PalosantoJSON();
    $jsonObject->set_status($oldhash != $newhash ? 'CHANGED' : 'NOCHANGED');
    $jsonObject->set_message(array('faxstatus' => $faxstatus, 'outputhash' => $newhash));
    Header('Content-Type: application/json');
    return $jsonObject->createJSON();
}
Пример #5
0
function enumerarFaxesPendientes()
{
    $faxstatus = paloFax::getFaxStatus();
    $jobs = array();
    foreach ($faxstatus['jobs'] as $k => $t) {
        if (!in_array($t['state'], array('F', 'D'))) {
            $jobs[$k] = $t;
        }
    }
    return $jobs;
}
Пример #6
0
function viewFormUser($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
    $pACL = new paloACL($pDB);
    $pORGZ = new paloSantoOrganization($pDB);
    $arrFill = array();
    $action = getParameter("action");
    $arrOrgz = array(0 => "Select one Organization");
    if ($credentials["userlevel"] == "superadmin") {
        $orgTmp = $pORGZ->getOrganization(array());
    } else {
        $orgTmp = $pORGZ->getOrganization(array("id" => $credentials["id_organization"]));
    }
    if ($orgTmp === false) {
        $smarty->assign("mb_title", _tr("ERROR"));
        $smarty->assign("mb_message", _tr($pORGZ->errMsg));
        return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
    } elseif (count($orgTmp) == 0) {
        $smarty->assign("mb_title", _tr("ERROR"));
        $smarty->assign("mb_message", _tr("You need yo have at least one organization created before you can create a user"));
        return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
    } else {
        if (($action == "new_user" || $action == "save_new") && count($orgTmp) <= 1) {
            $smarty->assign("mb_title", _tr("ERROR"));
            $smarty->assign("mb_message", _tr("It's necesary you create a new organization so you can create new user"));
            return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
        }
        foreach ($orgTmp as $value) {
            $arrOrgz[$value["id"]] = $value["name"];
            $arrDomains[$value["id"]] = $value["domain"];
        }
        $smarty->assign("ORGANIZATION", htmlentities($orgTmp[0]["name"], ENT_COMPAT, 'UTF-8'));
    }
    $idUser = getParameter("id");
    $arrFill = $_POST;
    if ($action == "view" || getParameter("edit") || getParameter("save_edit")) {
        if (!isset($idUser)) {
            $smarty->assign("mb_title", _tr("ERROR"));
            $smarty->assign("mb_message", _tr("Invalid User"));
            return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
        } else {
            if ($credentials["userlevel"] == "superadmin") {
                $arrUsers = $pACL->getUsers($idUser);
            } else {
                $arrUsers = $pACL->getUsers($idUser, $credentials["id_organization"], null, null);
            }
        }
        if ($arrUsers === false) {
            $smarty->assign("mb_title", _tr("ERROR"));
            $smarty->assign("mb_message", _tr($pACL->errMsg));
            return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
        } else {
            if (count($arrUsers) == 0) {
                $smarty->assign("mb_title", _tr("ERROR"));
                $smarty->assign("mb_message", _tr("User doesn't exist"));
                return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
            } else {
                $picture = $pACL->getUserPicture($idUser);
                if ($picture !== false) {
                    $smarty->assign("ShowImg", 1);
                }
                foreach ($arrUsers as $value) {
                    $arrFill["username"] = $value[1];
                    $arrFill["name"] = $value[2];
                    $arrFill["password1"] = "";
                    $arrFill["password2"] = "";
                    $arrFill["organization"] = $value[4];
                    $arrFill["group"] = $value[7];
                    $extu = isset($value[5]) ? $value[5] : _tr("Not assigned yet");
                    $extf = isset($value[6]) ? $value[6] : _tr("Not assigned yet");
                    $arrFill["extension"] = $extu;
                    $arrFill["fax_extension"] = $extf;
                }
                if ($arrFill["organization"] != 1) {
                    $smarty->assign("ORGANIZATION", htmlentities($arrOrgz[$arrFill["organization"]], ENT_COMPAT, 'UTF-8'));
                }
                $smarty->assign("USERNAME", $arrFill["username"]);
                $nGroup = $pACL->getGroupNameByid($arrFill["group"]);
                if ($nGroup == "superadmin") {
                }
                $nGroup = _tr("NONE");
                $smarty->assign("GROUP", $nGroup);
                $_POST["organization"] = $arrFill["organization"];
                //ahora obtenemos las configuraciones de fax dle usuario
                $pFax = new paloFax($pACL->_DB);
                $listFaxs = $pFax->getFaxList(array("exten" => $extf, "organization_domain" => $arrDomains[$arrFill["organization"]]));
                if ($listFaxs != false) {
                    $faxUser = $listFaxs[0];
                    $arrFill["country_code"] = $faxUser["country_code"];
                    $arrFill["area_code"] = $faxUser["area_code"];
                    $arrFill["clid_number"] = $faxUser["clid_number"];
                    $arrFill["clid_name"] = $faxUser["clid_name"];
                }
                //ahora obtenemos la cuenta del email
                $arrFill["email_quota"] = $pACL->getUserProp($idUser, "email_quota");
                if ($idUser == "1") {
                    $arrFill["email_contact"] = $pACL->getUserProp($idUser, "email_contact");
                }
                $smarty->assign("EMAILQOUTA", $arrFill["email_quota"]);
                $smarty->assign("EXTENSION", $extu);
                $smarty->assign("FAX_EXTENSION", $extf);
                if (getParameter("save_edit")) {
                    $arrFill = $_POST;
                }
            }
        }
    }
    if ($credentials["userlevel"] != "superadmin") {
        $idOrgSel = $credentials["id_organization"];
    } else {
        $idOrgSel = getParameter("organization");
    }
    if (!isset($idOrgSel)) {
        $idOrgSel = 0;
    }
    if ($idOrgSel == 0) {
        $arrGrupos = array();
    } else {
        $temp = $pACL->getGroupsPaging(null, null, $idOrgSel);
        if ($temp === false) {
            $smarty->assign("mb_title", _tr("ERROR"));
            $smarty->assign("mb_message", _tr($pACL->errMsg));
            return reportUser($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentiasls);
        }
        foreach ($temp as $value) {
            $arrGrupos[$value[0]] = $value[1];
        }
    }
    if (getParameter("create_user")) {
        $arrFill["country_code"] = $pORGZ->getOrganizationProp($idOrgSel, "country_code");
        $arrFill["area_code"] = $pORGZ->getOrganizationProp($idOrgSel, "area_code");
        $arrFill["email_quota"] = $pORGZ->getOrganizationProp($idOrgSel, "email_quota");
    }
    $arrFormOrgz = createFieldForm($arrGrupos, $arrOrgz);
    $oForm = new paloForm($smarty, $arrFormOrgz);
    $smarty->assign("HEIGHT", "310px");
    $smarty->assign("MARGIN_PIC", 'style="margin-top: 40px;"');
    $smarty->assign("MARGIN_TAB", "");
    if ($action == "view") {
        $smarty->assign("HEIGHT", "220px");
        $smarty->assign("MARGIN_PIC", "");
        $smarty->assign("MARGIN_TAB", "margin-top: 10px;");
        $oForm->setViewMode();
        $arrFill["password1"] = "*****";
        $arrFill["password2"] = "*****";
        $smarty->assign("HEIGHT", "220px");
    } else {
        if (getParameter("edit") || getParameter("save_edit")) {
            $oForm->setEditMode();
        }
    }
    global $arrPermission;
    if (in_array('create_user', $arrPermission)) {
        $smarty->assign("CREATE_USER", true);
    }
    if (in_array('edit_user', $arrPermission)) {
        $smarty->assign("EDIT_USER", true);
    }
    if (in_array('delete_user', $arrPermission)) {
        $smarty->assign("DEL_USER", true);
    }
    $smarty->assign("REQUIRED_FIELD", _tr("Required field"));
    $smarty->assign("CANCEL", _tr("Cancel"));
    $smarty->assign("APPLY_CHANGES", _tr("Apply changes"));
    $smarty->assign("SAVE", _tr("Save"));
    $smarty->assign("EDIT", _tr("Edit"));
    $smarty->assign("DELETE", _tr("Delete"));
    $smarty->assign("CONFIRM_CONTINUE", _tr("Are you sure you wish to continue?"));
    $smarty->assign("icon", "../web/_common/images/user_info.png");
    $smarty->assign("FAX_SETTINGS", _tr("Fax Settings"));
    $smarty->assign("EMAIL_SETTINGS", _tr("Email Settings"));
    $smarty->assign("MODULE_NAME", $module_name);
    $smarty->assign("userLevel", $credentials["userlevel"]);
    $smarty->assign("id_user", $idUser);
    if (isset($arrUsers[0][1])) {
        $smarty->assign("isSuperAdmin", $pACL->isUserSuperAdmin($arrUsers[0][1]));
    } else {
        $smarty->assign("isSuperAdmin", FALSE);
    }
    $htmlForm = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("User"), $arrFill);
    $content = "<form  method='POST' enctype='multipart/form-data' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>";
    return $content;
}
Пример #7
0
function _moduleContent(&$smarty, $module_name)
{
    include_once "libs/paloSantoForm.class.php";
    include_once "libs/paloSantoFax.class.php";
    include_once "libs/paloSantoDB.class.php";
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.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'];
    $contenidoModulo = '';
    $arrFormElements = array("name" => array("LABEL" => $arrLang["Virtual Fax Name"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "email" => array("LABEL" => $arrLang["Destination Email"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "email", "VALIDATION_EXTRA_PARAM" => ""), "extension" => array("LABEL" => "{$arrLang['Fax Extension']} (IAX)", "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""), "secret" => array("LABEL" => "{$arrLang['Secret']} (IAX)", "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "clid_name" => array("LABEL" => $arrLang["Caller ID Name"], "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "clid_number" => array("LABEL" => $arrLang["Caller ID Number"], "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "country_code" => array("LABEL" => $arrLang["Country Code"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""), "area_code" => array("LABEL" => $arrLang["Area Code"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""), "port" => array("LABEL" => "Port", "REQUIRED" => "no", "INPUT_TYPE" => "HIDDEN", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "dev_id" => array("LABEL" => "DevId", "REQUIRED" => "no", "INPUT_TYPE" => "HIDDEN", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""));
    $oForm = new paloForm($smarty, $arrFormElements);
    $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]);
    $smarty->assign("CANCEL", $arrLang["Cancel"]);
    $smarty->assign("APPLY_CHANGES", $arrLang["Apply changes"]);
    $smarty->assign("SAVE", $arrLang["Save"]);
    $smarty->assign("EDIT", $arrLang["Edit"]);
    $smarty->assign("DELETE", $arrLang["Delete"]);
    $smarty->assign("CONFIRM_CONTINUE", $arrLang["Are you sure you wish to continue?"]);
    $smarty->assign("icon", "/modules/{$module_name}/images/fax_virtual_fax_list.png");
    if (isset($_POST['save'])) {
        if ($oForm->validateForm($_POST)) {
            // Exito, puedo procesar los datos ahora.
            $oFax = new paloFax();
            // TODO: Debo revisar por errores aqui
            $oFax->createFaxExtension($_POST['name'], $_POST['extension'], $_POST['secret'], $_POST['email'], $_POST['clid_name'], $_POST['clid_number'], $_POST['country_code'], $_POST['area_code']);
            header("Location: ?menu=faxlist");
        } else {
            // Error
            $smarty->assign("mb_title", $arrLang["Validation Error"]);
            $arrErrores = $oForm->arrErroresValidacion;
            $strErrorMsg = "<b>{$arrLang['The following fields contain errors']}:</b><br>";
            foreach ($arrErrores as $k => $v) {
                $strErrorMsg .= "{$k}, ";
            }
            $strErrorMsg .= "";
            $smarty->assign("mb_message", $strErrorMsg);
            $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["New Virtual Fax"], $_POST);
        }
    } else {
        if (isset($_POST['apply_changes'])) {
            $oForm->setEditMode();
            if ($oForm->validateForm($_POST)) {
                // Exito, puedo procesar los datos ahora.
                $oFax = new paloFax();
                $oFax->editFaxExtension($_POST['id_fax'], $_POST['name'], $_POST['extension'], $_POST['secret'], $_POST['email'], $_POST['clid_name'], $_POST['clid_number'], $_POST['dev_id'], $_POST['port'], $_POST['country_code'], $_POST['area_code']);
                header("Location: ?menu=faxlist");
            } else {
                // Error
                $smarty->assign("mb_title", $arrLang["Validation Error"]);
                $arrErrores = $oForm->arrErroresValidacion;
                $strErrorMsg = "<b>{$arrLang['The following fields contain errors']}:</b><br>";
                foreach ($arrErrores as $k => $v) {
                    $strErrorMsg .= "{$k}, ";
                }
                $strErrorMsg .= "";
                $smarty->assign("mb_message", $strErrorMsg);
                $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["Edit Virtual Fax"], $_POST);
                /////////////////////////////////
            }
        } else {
            if (isset($_POST['delete'])) {
                //- TODO: Validar el id de fax
                $oFax = new paloFax();
                $oFax->deleteFaxExtensionById($_POST['id_fax']);
                header("Location: ?menu=faxlist");
            } else {
                if (isset($_POST['edit'])) {
                    //- TODO: Tengo que validar que el id sea valido, si no es valido muestro un mensaje de error
                    // Aqui hago un query por el id de fax
                    $oFax = new paloFax();
                    $oForm->setEditMode();
                    // Esto es para activar el modo "edit"
                    $arrFax = $oFax->getFaxById($_GET['id']);
                    $smarty->assign("id_fax", $_GET['id']);
                    $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["Edit Virtual Fax"], $arrFax);
                    // hay que pasar el arreglo
                } else {
                    if (isset($_GET['action']) && $_GET['action'] == "view") {
                        //- TODO: Tengo que validar que el id sea valido, si no es valido muestro un mensaje de error
                        // Aqui hago un query por el id de fax
                        $oFax = new paloFax();
                        $oForm->setViewMode();
                        // Esto es para activar el modo "preview"
                        $arrFax = $oFax->getFaxById($_GET['id']);
                        $smarty->assign("id_fax", $_GET['id']);
                        $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["View Virtual Fax"], $arrFax);
                        // hay que pasar el arreglo
                    } else {
                        //incializar los valores
                        if (!isset($_POST['name'])) {
                            $_POST['name'] = '';
                        }
                        if (!isset($_POST['email'])) {
                            $_POST['email'] = '';
                        }
                        if (!isset($_POST['extension'])) {
                            $_POST['extension'] = '';
                        }
                        if (!isset($_POST['secret'])) {
                            $_POST['secret'] = '';
                        }
                        if (!isset($_POST['clid_name'])) {
                            $_POST['clid_name'] = '';
                        }
                        if (!isset($_POST['clid_number'])) {
                            $_POST['clid_number'] = '';
                        }
                        if (!isset($_POST['port'])) {
                            $_POST['port'] = '';
                        }
                        if (!isset($_POST['dev_id'])) {
                            $_POST['dev_id'] = '';
                        }
                        if (!isset($_POST['country_code'])) {
                            $_POST['country_code'] = '';
                        }
                        if (!isset($_POST['area_code'])) {
                            $_POST['area_code'] = '';
                        }
                        $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", $arrLang["New Virtual Fax"], $_POST);
                    }
                }
            }
        }
    }
    return $contenidoModulo;
}
Пример #8
0
function faxListStatus($smarty, $module_name, $local_templates_dir, $arrConf, $arrLang)
{
    $oFax = new paloFax();
    $arrFax = $oFax->getFaxList();
    $status = TRUE;
    $end = count($arrFax);
    $arrFaxStatus = $oFax->getFaxStatus();
    $arrData = array();
    foreach ($arrFax as $fax) {
        $arrData[$fax['extension']] = $arrFaxStatus['modems']['ttyIAX' . $fax['dev_id']] . ' on ttyIAX' . $fax['dev_id'];
    }
    $statusArr = thereChanges($arrData);
    if (empty($statusArr)) {
        $status = FALSE;
    }
    $jsonObject = new PaloSantoJSON();
    if ($status) {
        //este status es true solo cuando el tecnico acepto al customer (al hacer click)
        //sleep(2); //por si acaso se desincroniza en la tabla customer el campo attended y llenarse los datos de id_chat y id_chat_time
        $msgResponse["faxes"] = $statusArr;
        $jsonObject->set_status("CHANGED");
        $jsonObject->set_message($msgResponse);
    } else {
        $jsonObject->set_status("NOCHANGED");
    }
    return array("there_was_change" => $status, "data" => $jsonObject->createJSON());
}
 function editFaxExten($arrProp)
 {
     require_once "libs/paloSantoPBX.class.php";
     $errorData = array();
     $errorBoolean = false;
     $arrProp['idUser'] = $this->idUser;
     if ($arrProp['clid_name'] == '') {
         $errorData['field'][] = "CID_NAME";
         $errorBoolean = true;
     }
     if ($arrProp['clid_number'] == '') {
         $errorData['field'][] = "CID_NUMBER";
         $errorBoolean = true;
     } elseif (!preg_match('/^[0-9]+$/', $arrProp['clid_number'])) {
         $errorData['field'][] = "CID_NUMBER";
         $errorBoolean = true;
     }
     if ($arrProp['country_code'] == '') {
         $errorData['field'][] = "COUNTRY_CODE";
         $errorBoolean = true;
     } elseif (!preg_match('/^[0-9]+$/', $arrProp['country_code'])) {
         $errorData['field'][] = "COUNTRY_CODE";
         $errorBoolean = true;
     }
     if ($arrProp['area_code'] == '') {
         $errorData['field'][] = "AREA_CODE";
         $errorBoolean = true;
     } elseif (!preg_match('/^[0-9]+$/', $arrProp['area_code'])) {
         $errorData['field'][] = "AREA_CODE";
         $errorBoolean = true;
     }
     if ($arrProp['fax_subject'] == '') {
         $errorData['field'][] = "FAX_SUBJECT";
         $errorBoolean = true;
     }
     if ($arrProp['fax_content'] == '') {
         $errorData['field'][] = "FAX_CONTENT";
         $errorBoolean = true;
     }
     if ($errorBoolean) {
         $errorData['stringError'] = "Some fields are wrong";
         $this->errMsg = $errorData;
         return false;
     }
     $pMyFax = new paloFax($this->_DB);
     if (!$pMyFax->editFaxToUser($arrProp)) {
         $this->errMsg = array('stringError' => $pMyFax->errMsg);
         return false;
     }
     if (!$pMyFax->restartService()) {
         $this->errMsg = $pMyFax->errMsg;
     }
     return true;
 }