Ejemplo n.º 1
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $url = OSSMail_Record_Model::GetSite_URL() . 'modules/OSSMail/roundcube/';
     $config = Settings_Mail_Config_Model::getConfig('autologin');
     if ($config['autologinActive'] == 'true') {
         $account = OSSMail_Autologin_Model::getAutologinUsers();
         if ($account) {
             $rcUser = isset($_SESSION['AutoLoginUser']) && array_key_exists($_SESSION['AutoLoginUser'], $account) ? $account[$_SESSION['AutoLoginUser']] : reset($account);
             require_once 'modules/OSSMail/RoundcubeLogin.class.php';
             $rcl = new RoundcubeLogin($url, false);
             //$rcl->setHostname('fdc.org.pl');
             //$rcl->setPort(143);
             //$rcl->setSSL(false);
             try {
                 if ($rcl->isLoggedIn()) {
                     if ($rcl->getUsername() != $rcUser['username']) {
                         $rcl->logout();
                         $rcl->login($rcUser['username'], $rcUser['password']);
                     }
                 } else {
                     $rcl->login($rcUser['username'], $rcUser['password']);
                 }
             } catch (RoundcubeLoginException $ex) {
                 $log = vglobal('log');
                 $log->error('OSSMail_index_View|RoundcubeLoginException: ' . $ex->getMessage());
             }
         }
     }
     $viewer = $this->getViewer($request);
     $viewer->assign('URL', $url);
     $viewer->view('index.tpl', $moduleName);
 }
Ejemplo n.º 2
0
 public function updateSignature(Vtiger_Request $request)
 {
     $val = $request->get('val');
     Settings_Mail_Config_Model::updateConfig('signature', $val, 'signature');
     $response = new Vtiger_Response();
     $response->setResult(array('success' => true, 'message' => vtranslate('LBL_SAVED_SIGNATURE', $request->getModule(false))));
     $response->emit();
 }
Ejemplo n.º 3
0
 public function process(Vtiger_Request $request)
 {
     $qualifiedModuleName = $request->getModule(false);
     $viewer = $this->getViewer($request);
     $viewer->assign('MODULE_MODEL', Settings_Mail_Config_Model::getInstance());
     $viewer->assign('ERROR_MESSAGE', $request->get('errorMessage'));
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->view('Config.tpl', $qualifiedModuleName);
 }
Ejemplo n.º 4
0
 public function preProcess(Vtiger_Request $request, $display = true)
 {
     $config = Settings_Mail_Config_Model::getConfig('autologin');
     if ($config['autologinActive'] == 'true') {
         $account = OSSMail_Autologin_Model::getAutologinUsers();
         if ($account) {
             $rcUser = isset($_SESSION['AutoLoginUser']) && array_key_exists($_SESSION['AutoLoginUser'], $account) ? $account[$_SESSION['AutoLoginUser']] : reset($account);
             require_once 'modules/OSSMail/RoundcubeLogin.class.php';
             $rcl = new RoundcubeLogin(self::$mainUrl, false);
             try {
                 if ($rcl->isLoggedIn()) {
                     if ($rcl->getUsername() != $rcUser['username']) {
                         $rcl->logout();
                         $rcl->login($rcUser['username'], $rcUser['password']);
                     }
                 } else {
                     $rcl->login($rcUser['username'], $rcUser['password']);
                 }
             } catch (RoundcubeLoginException $ex) {
                 $log = vglobal('log');
                 $log->error('OSSMail_index_View|RoundcubeLoginException: ' . $ex->getMessage());
             }
         }
     }
     $config = OSSMail_Module_Model::getComposeParameters();
     $param = OSSMail_Module_Model::getComposeUrlParam($request->get('crmModule'), $request->get('crmRecord'), $request->get('crmView'));
     if ($request->get('id') != '' && $request->get('type') != '') {
         $param .= '&crmid=' . (int) $request->get('id') . '&type=' . $request->get('type');
     }
     $this->mainUrl = $this->mainUrl . $param;
     if ($config['popup'] && $request->get('popup') == 1) {
         header('Location: ' . $this->mainUrl . '&_extwin=1');
         exit;
     }
     parent::preProcess($request, true);
 }
Ejemplo n.º 5
0
 public function process(Vtiger_Request $request)
 {
     $url = '';
     if ($request->get('to') != '') {
         $to = $request->get('to');
     }
     if ($request->get('subject') != '') {
         $subject = $request->get('subject');
     }
     if (!empty($_SESSION['POST']['to'])) {
         $to = implode(",", $_SESSION['POST']['to']);
     }
     if (!empty($_SESSION['POST']['cc'])) {
         $cc = implode(",", $_SESSION['POST']['cc']);
     }
     if (!empty($_SESSION['POST']['bcc'])) {
         $bcc = implode(",", $_SESSION['POST']['bcc']);
     }
     if (!empty($_SESSION['POST']['subject'])) {
         $subject = implode(",", $_SESSION['POST']['subject']);
     }
     $mod = $_SESSION['POST']['sourceModule'];
     if ($mod == 'Campaigns') {
         if ($to != '') {
             $url .= '&bcc=' . $to;
         }
         if ($_SESSION['POST']['sourceRecord'] != '') {
             $Record_Model = Vtiger_Record_Model::getInstanceById($_SESSION['POST']['sourceRecord'], $mod);
             $campaign_no = $Record_Model->get('campaign_no');
             $url .= '&subject=' . $campaign_no . ': ' . $Record_Model->get('campaignname');
         }
     } else {
         if ($to != '') {
             $url .= '&to=' . $to;
         }
         if ($cc != '') {
             $url .= '&cc=' . $cc;
         }
         if ($bcc != '') {
             $url .= '&bcc=' . $bcc;
         }
     }
     if ($subject != '') {
         $url .= '&subject=' . $subject;
     }
     $pdfPath = $request->get('pdf_path');
     if ($pdfPath) {
         $url .= '&pdf_path=' . $pdfPath;
     }
     if ($url == '' && $request->get('record') != '' && $request->get('mod') != '') {
         $UrlToCompose = OSSMail_Record_Model::getUrlToCompose($request->get('mod'), $request->get('record'));
         $url .= $UrlToCompose;
     }
     if ($url == '' && $request->get('id') != '' && $request->get('type') != '') {
         $url .= '&crmid=' . (int) $request->get('id') . '&type=' . $request->get('type');
     }
     $mainUrl = OSSMail_Record_Model::GetSite_URL() . 'modules/OSSMail/roundcube/?_task=mail&_action=compose';
     $url = $mainUrl . $url;
     $config = Settings_Mail_Config_Model::getConfig('autologin');
     if ($config['autologinActive'] == 'true') {
         $account = OSSMail_Autologin_Model::getAutologinUsers();
         if ($account) {
             $rcUser = isset($_SESSION['AutoLoginUser']) && array_key_exists($_SESSION['AutoLoginUser'], $account) ? $account[$_SESSION['AutoLoginUser']] : reset($account);
             require_once 'modules/OSSMail/RoundcubeLogin.class.php';
             $rcl = new RoundcubeLogin($mainUrl, false);
             try {
                 if ($rcl->isLoggedIn()) {
                     if ($rcl->getUsername() != $rcUser['username']) {
                         $rcl->logout();
                         $rcl->login($rcUser['username'], $rcUser['password']);
                     }
                 } else {
                     $rcl->login($rcUser['username'], $rcUser['password']);
                 }
             } catch (RoundcubeLoginException $ex) {
                 $log = vglobal('log');
                 $log->error('OSSMail_index_View|RoundcubeLoginException: ' . $ex->getMessage());
             }
         }
     }
     $viewer = $this->getViewer($request);
     $viewer->assign("URL", $url);
     $viewer->view('index.tpl', 'OSSMail');
 }