Example #1
0
 public static function i($connection = '')
 {
     if (!isset(self::$instance)) {
         list($host, $email, $password) = explode('~', $connection);
         debug::output("Starting Connection to {$email} ({$host})");
         self::$instance = new imap();
         self::$instance->connect($host, $email, $password);
     }
     return self::$instance;
 }
Example #2
0
 public function editImapAccount()
 {
     $_POST = mswMultiDimensionalArrayMap('mswSafeImportString', $_POST);
     // Defaults if not set..
     $_POST['im_piping'] = isset($_POST['im_piping']) ? 'yes' : 'no';
     $_POST['im_flags'] = isset($_POST['im_flags']) ? imap::filterImapFlag($_POST['im_flags']) : '';
     $_POST['im_attach'] = isset($_POST['im_attach']) ? 'yes' : 'no';
     $_POST['im_ssl'] = isset($_POST['im_ssl']) ? 'yes' : 'no';
     $_POST['im_port'] = (int) $_POST['im_port'];
     $_POST['im_messages'] = (int) $_POST['im_messages'];
     $_POST['im_move'] = isset($_POST['im_move']) ? $_POST['im_move'] : '';
     $_POST['im_spam'] = isset($_POST['im_spam']) ? 'yes' : 'no';
     $_POST['im_spam_purge'] = isset($_POST['im_spam_purge']) ? 'yes' : 'no';
     $_GET['edit'] = (int) $_GET['edit'];
     mysql_query("UPDATE `" . DB_PREFIX . "imap` SET\n  `im_piping`      = '{$_POST['im_piping']}',\n  `im_protocol`    = 'imap',\n  `im_host`        = '{$_POST['im_host']}',\n  `im_user`        = '{$_POST['im_user']}',\n  `im_pass`        = '{$_POST['im_pass']}',\n  `im_port`        = '{$_POST['im_port']}',\n  `im_name`        = '{$_POST['im_name']}',\n  `im_flags`       = '{$_POST['im_flags']}',\n  `im_attach`      = '{$_POST['im_attach']}',\n  `im_move`        = '{$_POST['im_move']}',\n  `im_messages`    = '{$_POST['im_messages']}',\n  `im_ssl`         = '{$_POST['im_ssl']}',\n  `im_priority`    = '{$_POST['im_priority']}',\n  `im_dept`        = '{$_POST['im_dept']}',\n  `im_email`       = '{$_POST['im_email']}',\n  `im_spam`        = '{$_POST['im_spam']}',\n  `im_spam_purge`  = '{$_POST['im_spam_purge']}',\n  `im_score`       = '{$_POST['im_score']}'\n  WHERE `id`       = '{$_GET['edit']}'\n  ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__));
 }
Example #3
0
 public function __construct($input, $live)
 {
     parent::__construct($input, $live);
     $sql = "TRUNCATE log_check_lost_bag_inbox_notified";
     mysql::i()->query($sql);
     $host = config::get('sita_imap_host');
     $email_address = config::get('sita_imap_email_address');
     $password = config::get('sita_imap_password');
     $connection = $host . '~' . $email_address . '~' . $password;
     imap::i($connection);
     $mc = imap::i()->check();
     $result = imap::i()->fetch_overview("1:{$mc->Nmsgs}");
     if (!empty($result)) {
         $this->old_lost_tags_notified = $this->getPreviousSITAEmailsNotified();
         $old_lost_tags_invalid = $this->getPreviousSITAEmailsInvalid();
         foreach ($result as $overview) {
             $message_body = imap::i()->fetch_body($overview->msgno);
             $message_body = utils::removeMultiSpaces($message_body);
             list($prefix, $tag, $iata, $world_tracer_ref) = explode(' ', $message_body);
             if (empty($tag)) {
                 debug::output("No tag!\n");
                 continue;
             }
             //skip any tags already handled
             if ($this->old_lost_tags_notified[$tag]) {
                 debug::output("{$tag} owner previously notified\n");
                 continue;
             }
             debug::output("Checking tag format for tag {$tag}...");
             if (parent::checkTagFormat($tag) == true) {
                 debug::output("{$tag} valid format");
                 //do one query to establish if tag exists in database and is associated with a customer
                 $tag_registered = $this->getCustomer($tag);
                 //check that the tag is registered
                 if ($tag_registered == true) {
                     //Check has user got a registered email address ?
                     if (!empty($this->customer_details['email'])) {
                         //is the account 'active'?
                         if ($this->customer_details['status'] == 'ACTIVE') {
                             debug::output("Tag Active. Notify user by email.");
                             $lostBag = utils::getAirportbyIATA($iata);
                             //Owner recieves email containing the report
                             //****This mail function is for mailing ACTIVE Tag holder email****//
                             $mail = new Mail();
                             $mail->protocol = config::get('config_mail_protocol');
                             $mail->parameter = config::get('config_mail_parameter');
                             $mail->hostname = config::get('config_smtp_host');
                             $mail->username = config::get('config_smtp_username');
                             $mail->password = config::get('config_smtp_password');
                             $mail->port = config::get('config_smtp_port');
                             $mail->timeout = config::get('config_smtp_timeout');
                             $mail->setTo($this->customer_details['email']);
                             $mail->setFrom('');
                             $mail->setSender('');
                             $mail->setSubject(html_entity_decode(sprintf('Lost Bag Report')));
                             $report_foundbag_emailtext = "Dear " . $this->customer_details['firstname'] . " <br />  \n\nA lost bag report has been completed and your tag number has been reported.<br /><br />\n\nDetails of the find<br />\n<b>Tag Number: OC </b>" . $this->customer_details['tag_no'] . "<br />\n<b>Name of Finder:</b>" . " " . $this->customer_details['firstname'] . " " . $this->customer_details['lastname'] . "<br />\n<b>Email Address of Finder:</b>" . " " . $this->customer_details['email'] . "<br />\n<b>Telephone Number of Finder:</b>" . " " . $this->customer_details['telephone'] . "<br />\n<b>Mobile Number:</b>" . " " . $this->customer_details['mobile'] . "<br />\n<b>Post Code:</b>" . " " . $this->customer_details['postcode'] . "<br />\n<b>Location of Bag:</b> {$lostBag['airport']}, {$lostBag['place']}, {$lostBag['state']}, {$lostBag['country']}<br /><br />\n\nSincerely</n>\nLost Baggage Team";
                             $mail->setText(strip_tags($report_foundbag_emailtext));
                             //                        echo "<pre>";
                             //                        print_r($mail);
                             //                        die;
                             $mail->send();
                             // End mail for ACTIVE TagNo
                             $this->logCheckLostBagTagInboxNotified($tag, $iata, $world_tracer_ref, true, 'email', $this->customer_details['email']);
                             $this->logDB->logCheckLostBagEmail($this->customer_details['customer_id'], strip_tags($report_foundbag_emailtext), $this->customer_details['email'], $status, $tag);
                         } else {
                             //not active
                             debug::output("{$tag} inactive. Notify user by email.");
                             /* Owner recieves an email to ask them to contact  
                              * who will provide them with the information once they 
                              * have paid a fee. 
                              * (Would like to automate this so email is kept in 
                              * user's acocunt until they have paid a premium of 
                              * £15.00 then they can view the report)*/
                             //****This mail function is for mailing ACTIVE Tag holder email****//
                             $mail = new Mail();
                             $mail->protocol = config::get('config_mail_protocol');
                             $mail->parameter = config::get('config_mail_parameter');
                             $mail->hostname = config::get('config_smtp_host');
                             $mail->username = config::get('config_smtp_username');
                             $mail->password = config::get('config_smtp_password');
                             $mail->port = config::get('config_smtp_port');
                             $mail->timeout = config::get('config_smtp_timeout');
                             $mail->setTo($this->customer_details['email']);
                             $mail->setFrom('');
                             $mail->setSender('');
                             $mail->setSubject(html_entity_decode(sprintf('Lost Bag Report')));
                             //print_r($this->customer_details);
                             $report_foundbag_emailtext = "Dear " . $this->customer_details['firstname'] . " <br />  \nA lost bag report has been completed and your tag number has been reported.<br /><br />                            \nBut we are sorry, your tag is not ACTIVE please call " . config::get('lost_bag_number') . " to reactivate your tag.<br /><br />\n\nSincerely</n>\nLost Baggage Team";
                             $mail->setText(strip_tags($report_foundbag_emailtext));
                             //                        echo "<pre>";
                             //                        print_r($mail);
                             //                        die;
                             $mail->send();
                             // End mail for ACTIVE TagNo
                             $this->logCheckLostBagTagInboxNotified($tag, $iata, $world_tracer_ref, true, 'email', $this->customer_details['email']);
                             $this->logDB->logCheckLostBagEmail($this->customer_details['customer_id'], strip_tags($report_foundbag_emailtext), $this->customer_details['email'], $status, $tag);
                         }
                         //else
                     } else {
                         //not registered
                         debug::output("{$tag} has no registered email address ");
                         //is the account 'active'?
                         if ($this->checkTagNoStatus($tag) == 'ACTIVE') {
                             debug::output("{$tag} active\n");
                             //Owner receives SMS to say a report is waiting for you, please text YES to receive the details, text costs £1.50 or NO to cancel
                             $this->send['destinations'] = utils::formatPhoneNumber($this->customer_details['telephone']);
                             $this->logCheckLostBagTagInboxNotified($tag, $iata, $world_tracer_ref, true, 'sms', $this->send['destinations']);
                             $this->send['body'] = 'Lost bag report available for tag ' . $tag . '. For details text PIN REPORT. Text costs £1.50 each plus standard network rate. Text PIN STOP to cancel.';
                             parent::sendSMS();
                         } else {
                             debug::output("{$tag} inactive\n");
                             //not active
                             /*user recieves text to say account not active please contact
                              * directly on [telephone number] potentially we automate this and 
                              * have them go online to pay the fee before receiving the info - 
                              * your thoughts would be helpful*/
                             $this->send['destinations'] = utils::formatPhoneNumber($this->customer_details['telephone']);
                             $this->send['body'] = 'Lost bag report available for EXPIRED tag ' . $tag . '. Please contact customer services on ' . config::get('lost_bag_number') . ' Text PIN STOP to cancel.';
                             parent::sendSMS();
                             $this->logCheckLostBagTagInboxNotified($tag, $iata, $world_tracer_ref, true, 'sms', $this->send['destinations']);
                         }
                         //else
                     }
                     //else not registered
                 } else {
                     debug::output("{$tag} not registered to customer in database");
                     if (!$old_lost_tags_invalid[$tag]) {
                         $this->logDB->logCheckLostBagInvalidTag($tag);
                         //only log the tag once
                     }
                 }
             } else {
                 debug::output("{$tag} invalid format\n");
                 $this->logDB->logCheckLostBagInvalidTag($tag, $old_lost_tags_invalid);
             }
             unset($this->send);
         }
         //for each message
     } else {
         debug::output("No messages in Inbox\n");
     }
     //empty
     imap::i()->close();
 }
Example #4
0
 function getImapFolders($host, $port, $email, $password, $use_ssl, $novalidate_cert)
 {
     $inbox = new toC_InboundEmail();
     if ($inbox->open($host, 'imap', $port, $email, $password, null, null, $use_ssl, $novalidate_cert)) {
         $mailboxes = $inbox->get_mailboxes();
         $folders = array();
         foreach ($mailboxes as $mailbox) {
             $folders[] = array(imap::utf7_imap_decode($mailbox['name']));
         }
         $inbox->close();
         return $folders;
     }
     $inbox->close();
     return false;
 }
Example #5
0
  Copyright Intermesh 2003
  Author: Merijn Schering <*****@*****.**>
  Version: 1.0 Release date: 08 July 2003

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('email');
require $GO_CONFIG->class_path . "imap.class.inc";
require $GO_MODULES->class_path . "email.class.inc";
require $GO_LANGUAGE->get_language_file('email');
$mail = new imap();
$email = new email();
$em_settings = $email->get_settings($GO_SECURITY->user_id);
$account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : 0;
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : 0;
$max_rows = isset($_REQUEST['max_rows']) ? $_REQUEST['max_rows'] : $_SESSION['GO_SESSION']['max_rows_list'];
$first_row = isset($_REQUEST['first_row']) ? $_REQUEST['first_row'] : 0;
$table_tabindex = isset($_REQUEST['table_tabindex']) ? $_REQUEST['table_tabindex'] : null;
$mailbox = isset($_REQUEST['mailbox']) ? smartstrip($_REQUEST['mailbox']) : 'INBOX';
$link_back = $GO_MODULES->url . 'index.php?account_id=' . $account_id . '&mailbox=' . $mailbox . '&first_row=' . $first_row;
if (!($account = $email->get_account($account_id))) {
    $account = $email->get_account(0);
}
if ($account && $account["user_id"] != $GO_SECURITY->user_id) {
    header('Location: ' . $GO_CONFIG->host . 'error_docs/403.php');
Example #6
0
 //set Line enidng to \r\n for Cyrus IMAP
 $mail->LE = "\r\n";
 $mime = $mail->GetMime();
 if (isset($_SESSION['attach_array'])) {
     while ($attachment = array_shift($_SESSION['attach_array'])) {
         @unlink($attachment->tmp_file);
     }
 }
 // We need to unregister the attachments array and num_attach
 unset($_SESSION['num_attach']);
 unset($_SESSION['attach_array']);
 if ($profile["type"] == "imap") {
     $sent_folder = $profile['sent'];
     if ($sent_folder != '') {
         require $GO_CONFIG->class_path . "imap.class.inc";
         $imap_stream = new imap();
         if ($imap_stream->open($profile["host"], "imap", $profile["port"], $profile["username"], $GO_CRYPTO->decrypt($profile["password"]), $sent_folder)) {
             if ($imap_stream->append_message($sent_folder, $mime, "\\Seen")) {
                 if (isset($_REQUEST['action']) && ($_REQUEST['action'] == "reply" || $_REQUEST['action'] == "reply_all")) {
                     $uid = array($_REQUEST['uid']);
                     $imap_stream->set_message_flag($_POST['mailbox'], $uid, "\\Answered");
                 }
                 $imap_stream->close();
                 require $GO_THEME->theme_path . "header.inc";
                 echo "<script type=\"text/javascript\">\r\nwindow.close();\r\n</script>\r\n";
                 require $GO_THEME->theme_path . "footer.inc";
                 exit;
             }
         }
         require $GO_THEME->theme_path . "header.inc";
         echo "<script type=\"text/javascript\">\r\nalert('" . $ml_sent_items_fail . "');\r\nwindow.close();\r\n</script>\r\n";
Example #7
0
 function saveAccount()
 {
     global $toC_Json, $osC_Language;
     $error = false;
     $feedback = '';
     $accounts_id = isset($_REQUEST['accounts_id']) && !empty($_REQUEST['accounts_id']) ? $_REQUEST['accounts_id'] : null;
     $data['user_id'] = $_SESSION['admin']['id'];
     $data['accounts_name'] = isset($_REQUEST['accounts_name']) ? $_REQUEST['accounts_name'] : '';
     $data['accounts_email'] = isset($_REQUEST['accounts_email']) ? $_REQUEST['accounts_email'] : '';
     $data['signature'] = isset($_REQUEST['signature']) ? $_REQUEST['signature'] : '';
     $data['type'] = $_REQUEST['type'];
     $data['host'] = $_REQUEST['host'];
     $data['port'] = $_REQUEST['port'];
     $data['username'] = $_REQUEST['username'];
     $data['password'] = $_REQUEST['password'];
     $data['sent'] = $_REQUEST['sent'];
     $data['drafts'] = $_REQUEST['drafts'];
     $data['trash'] = $_REQUEST['trash'];
     $data['save_copy_on_server'] = isset($_REQUEST['save_copy_on_server']) && $_REQUEST['save_copy_on_server'] == 'on' ? 1 : 0;
     $data['mbroot'] = isset($_REQUEST['mbroot']) ? imap::utf7_imap_encode($_REQUEST['mbroot']) : 'INBOX';
     $data['use_ssl'] = isset($_REQUEST['use_ssl']) && $_REQUEST['use_ssl'] == 'on' ? 1 : 0;
     $data['novalidate_cert'] = isset($_REQUEST['novalidate_cert']) && $_REQUEST['novalidate_cert'] == 'on' ? 1 : 0;
     $data['examine_headers'] = isset($_REQUEST['examine_headers']) && $_REQUEST['examine_headers'] == 'on' ? 1 : 0;
     $data['use_system_mailer'] = isset($_REQUEST['use_system_mailer']) && $_REQUEST['use_system_mailer'] == 'on' ? 1 : 0;
     $data['smtp_host'] = isset($_REQUEST['smtp_host']) ? $_REQUEST['smtp_host'] : '';
     $data['smtp_port'] = isset($_REQUEST['smtp_port']) ? $_REQUEST['smtp_port'] : 25;
     $data['smtp_encryption'] = isset($_REQUEST['smtp_encryption']) ? $_REQUEST['smtp_encryption'] : '';
     $data['smtp_username'] = isset($_REQUEST['smtp_username']) ? $_REQUEST['smtp_username'] : '';
     $data['smtp_password'] = isset($_REQUEST['smtp_password']) ? $_REQUEST['smtp_password'] : '';
     if (toC_Email_Accounts_Admin::checkEmailAccount($data['username'], $accounts_id)) {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_email_account_already_exist'));
     } else {
         if ($accounts_id == null) {
             $error_info = null;
             if (toC_Email_Accounts_Admin::checkEmailAccountOnSever($data, $error_info) === false) {
                 $error = true;
                 $response = array('success' => false, 'feedback' => sprintf($osC_Language->get('ms_error_connect_server_failed'), $error_info));
             }
         }
         if ($error === false) {
             $accounts_id = toC_Email_Accounts_Admin::saveAccount($accounts_id, $data);
             $node = array('id' => $accounts_id, 'text' => $data['accounts_email'], 'iconCls' => 'icon-folder-account-record', 'expanded' => true, 'type' => 'account', 'children' => toC_Email_Accounts_Admin::getMailBoxNodes($accounts_id, 0), 'protocol' => $data['type']);
             $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'), 'accounts_node' => $node);
         }
     }
     echo $toC_Json->encode($response);
 }
Example #8
0
  Author: Merijn Schering <*****@*****.**>
  Version: 1.0 Release date: 08 July 2003

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('email');
require $GO_CONFIG->class_path . "imap.class.inc";
require $GO_MODULES->class_path . "email.class.inc";
require $GO_CONFIG->class_path . "filetypes.class.inc";
$filetypes = new filetypes();
$mail = new imap();
$email = new email();
require $GO_LANGUAGE->get_language_file('email');
$em_settings = $email->get_settings($GO_SECURITY->user_id);
$link_back = isset($_REQUEST['link_back']) && $_REQUEST['link_back'] != '' ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI'];
$to = '';
$texts = '';
$images = '';
$account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : 0;
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
$mailbox = isset($_REQUEST['mailbox']) ? $_REQUEST['mailbox'] : "INBOX";
$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : 0;
$max_rows = isset($_REQUEST['max_rows']) ? $_REQUEST['max_rows'] : $_SESSION['GO_SESSION']['max_rows_list'];
$first_row = isset($_REQUEST['first_row']) ? $_REQUEST['first_row'] : 0;
$table_tabindex = isset($_REQUEST['table_tabindex']) ? $_REQUEST['table_tabindex'] : null;
$return_to = isset($_REQUEST['return_to']) && $_REQUEST['return_to'] != '' ? $_REQUEST['return_to'] : null;
Example #9
0
Copyright Intermesh 2003
Author: Merijn Schering <*****@*****.**>
Version: 1.0 Release date: 08 July 2003

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('email');
require $GO_CONFIG->class_path . "imap.class.inc";
require $GO_MODULES->class_path . "email.class.inc";
require $GO_LANGUAGE->get_language_file('email');
$mail = new imap();
$email = new email();
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
$return_to = isset($_REQUEST['return_to']) && $_REQUEST['return_to'] != '' ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];
$link_back = isset($_REQUEST['link_back']) && $_REQUEST['link_back'] != '' ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI'];
$account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : 0;
$account = $email->get_account($account_id);
if ($account && $mail->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']), 'INBOX', 0, $account['use_ssl'], $account['novalidate_cert'])) {
    if ($task == 'create_folder') {
        $name = smartstrip(trim($_POST['name']));
        if ($name == '') {
            $feedback = '<p class="Error">' . $error_missing_field . '</p>';
        } else {
            $parent_folder_name = isset($_POST['parent_folder_name']) ? smartstrip($_POST['parent_folder_name']) : '';
            if ($parent_folder_name != '' && substr($parent_folder_name, -1) != $_POST['delimiter']) {
                $parent_folder_name .= $_POST['delimiter'];
  Copyright Intermesh 2003
  Author: Merijn Schering <*****@*****.**>
  Version: 1.0 Release date: 08 July 2003

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('squirrelmail');
require $GO_CONFIG->class_path . "imap.class.inc";
require $GO_MODULES->class_path . "email.class.inc";
require $GO_LANGUAGE->get_language_file('squirrelmail');
$mail = new imap();
$email = new email();
$em_settings = $email->get_settings($GO_SECURITY->user_id);
$account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : 0;
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : 0;
$max_rows = isset($_REQUEST['max_rows']) ? $_REQUEST['max_rows'] : $_SESSION['GO_SESSION']['max_rows_list'];
$first_row = isset($_REQUEST['first_row']) ? $_REQUEST['first_row'] : 0;
$table_tabindex = isset($_REQUEST['table_tabindex']) ? $_REQUEST['table_tabindex'] : null;
$mailbox = isset($_REQUEST['mailbox']) ? smartstrip($_REQUEST['mailbox']) : 'INBOX';
$link_back = $GO_MODULES->url . 'index.php?account_id=' . $account_id . '&mailbox=' . $mailbox . '&first_row=' . $first_row;
if (!($account = $email->get_account($account_id))) {
    $account = $email->get_account(0);
}
if ($account && $account["user_id"] != $GO_SECURITY->user_id) {
    header('Location: ' . $GO_CONFIG->host . 'error_docs/403.php');
Example #11
0
<?php

ini_set("display_errors", 0);
error_reporting();
require_once 'class/class.imap.php';
$imap = new imap();
$imap->check_all_mailboxes();
$imap->read_email("21");
Example #12
0
}
if (!defined('LOG')) {
    define('LOG', true);
}
if (!defined('DELIVER')) {
    define('DELIVER', false);
}
/* Instantiate general output and error: */
$output = new Output();
$error = new ErrorControl();
$output->say("+++ QMID DISPATCHER +++", 2);
$output->say("> Started at: " . date(DATEFORMAT));
/* New dispatcher wich parses the rules: */
$dispatcher = new Dispatcher();
/* Imap: */
$imap = new imap();
$output->say("> " . $imap->count() . " messages to process.");
$dispatcher->imap = $imap;
/* Process the mail */
$dispatcher->processMailbox();
/* END */
unset($imap);
$error->Finish();
/*
 * All imap work.
 */
class imap
{
    private $conn;
    private $output;
    private $error;
  Author: Merijn Schering <*****@*****.**>
  Version: 1.0 Release date: 08 July 2003

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('email');
require $GO_CONFIG->class_path . "imap.class.inc";
require $GO_MODULES->class_path . "email.class.inc";
require $GO_CONFIG->class_path . "filetypes.class.inc";
$filetypes = new filetypes();
$mail = new imap();
$email = new email();
require $GO_LANGUAGE->get_language_file('email');
$texts = '';
$images = '';
$mailbox = isset($_REQUEST['mailbox']) ? $_REQUEST['mailbox'] : "INBOX";
$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : 0;
$part = isset($_REQUEST['part']) ? $_REQUEST['part'] : '';
$account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : 0;
$account = $email->get_account($account_id);
if ($account && $mail->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']), $mailbox, 0, $account['use_ssl'], $account['novalidate_cert'])) {
    $content = $mail->get_message($uid, 'html', $part);
    $subject = isset($content["subject"]) ? $content["subject"] : $ml_no_subject;
} else {
    require $GO_THEME->theme_path . 'header.inc';
    echo '<table border="0" cellpadding="10" width="100%"><tr><td>';
Example #14
0
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  
  This File: imap.php
  Description: System File

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
if (!defined('PARENT')) {
    $HEADERS->err403(true);
}
// Access..
if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') {
    $HEADERS->err403(true);
}
// Class..
include_once PATH . 'control/classes/class.imap.php';
$MSIMAP = new imap();
// Show imap folders..
if (isset($_GET['showImapFolders'])) {
    $html = '';
    $msg = '';
    $action = 'err';
    $_POST = array_map('mswCleanData', $_POST);
    if (function_exists('imap_open')) {
        $mbox = @imap_open('{' . ($_POST['host'] ? $_POST['host'] : 'xx') . ':' . ($_POST['port'] ? $_POST['port'] : '1') . '/imap' . ($_POST['flags'] ? $_POST['flags'] : '') . '}', $_POST['user'], $_POST['pass']);
        if ($mbox) {
            $list = @imap_list($mbox, '{' . $_POST['host'] . '}', '*');
            if (is_array($list)) {
                sort($list);
                $html = '<option value="0">' . $msg_imap26 . '</option>';
                foreach ($list as $box) {
                    $box = str_replace('{' . $_POST['host'] . '}', '', imap_utf7_decode($box));
Example #15
0
  E-Mail: support@maianscriptworld.co.uk
  Software Website: http://www.maiansupport.com
  Script Portal: http://www.maianscriptworld.co.uk

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  
  This File: imapfilter.php
  Description: System File

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
if (!defined('PARENT')) {
    $HEADERS->err403(true);
}
// Access..
if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') {
    $HEADERS->err403(true);
}
// Class..
include_once PATH . 'control/classes/class.imap.php';
$MSIMAP = new imap();
// Update..
if (isset($_POST['process'])) {
    $MSIMAP->updateB8();
    $OK = true;
}
$title = $msg_adheader62;
$loadJQAlertify = true;
$loadJQNyroModal = true;
include PATH . 'templates/header.php';
include PATH . 'templates/system/imap/imap-filters.php';
include PATH . 'templates/footer.php';
Example #16
0
    $todos = new todos();
    $remind_events = $cal->get_events_to_remind($GO_SECURITY->user_id);
    $remind_todos = $todos->get_todos_to_remind($GO_SECURITY->user_id);
    if ($remind_events || $remind_todos) {
        echo '<script language="javascript" type="text/javascript">popup("' . $calendar_module['url'] . 'reminder.php", "500", "200", "reminder");</script>';
    }
    unset($cal);
}
$_SESSION['notified_new_mail'] = isset($_SESSION['notified_new_mail']) ? $_SESSION['notified_new_mail'] : 0;
$_SESSION['new_mail'] = 0;
//check for email
$email_module = $GO_MODULES->get_module('email');
if ($email_module && ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $email_module['acl_read']) || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $email_module['acl_write']))) {
    require_once $email_module['class_path'] . 'email.class.inc';
    require_once $GO_CONFIG->class_path . 'imap.class.inc';
    $imap = new imap();
    $email1 = new email();
    $email2 = new email();
    $email1->get_accounts($GO_SECURITY->user_id);
    while ($email1->next_record()) {
        if ($email1->f('auto_check') == '1') {
            $account = $email1->Record;
            if ($imap->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']))) {
                if ($account['type'] == 'imap') {
                    $status = $imap->status('INBOX');
                    if ($status->unseen > 0) {
                        $_SESSION['new_mail'] += $status->unseen;
                    }
                    $email2->get_folders($email1->f('id'));
                    while ($email2->next_record()) {
                        if ($email2->f('name') != 'INBOX') {
 function moveImapMessage($id, $target_folders_id)
 {
     $message = toC_Email_Accounts_Admin::getCachedMessage($id);
     $src_folder = toC_Email_Accounts_Admin::getFolderData($message['folders_id']);
     $target_folder = toC_Email_Accounts_Admin::getFolderData($target_folders_id);
     if ($this->connectMailServer($src_folder['folders_name'])) {
         if ($this->_inbox->move(imap::utf7_imap_encode($target_folder['folders_name']), array($message['uid']))) {
             $this->closeMailServer();
             return $this->moveCachedMessage($id, $target_folders_id);
         }
     }
     $this->closeMailServer();
     return false;
 }
Copyright Intermesh 2003
Author: Merijn Schering <*****@*****.**>
Version: 1.0 Release date: 08 July 2003

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('squirrelmail');
require $GO_LANGUAGE->get_language_file('squirrelmail');
require $GO_CONFIG->class_path . "imap.class.inc";
require $GO_MODULES->class_path . "email.class.inc";
$mail = new imap();
$email = new email();
$account = $email->get_account($_REQUEST['account_id']);
if ($mail->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']), $_REQUEST['mailbox'], 0, $account['use_ssl'], $account['novalidate_cert'])) {
    $content = $mail->get_message($_REQUEST['uid']);
}
$page_title = $fbProperties;
require $GO_THEME->theme_path . "header.inc";
?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
	<td height="50">
	<h1><?php 
echo $fbProperties;
?>
</h1>
Example #19
0
  Copyright Intermesh 2003
  Author: Merijn Schering <*****@*****.**>
  Version: 1.0 Release date: 08 July 2003

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('squirrelmail');
require $GO_CONFIG->class_path . "imap.class.inc";
require $GO_MODULES->class_path . "email.class.inc";
require $GO_LANGUAGE->get_language_file('squirrelmail');
$mail = new imap();
$email = new email();
$em_settings = $email->get_settings($GO_SECURITY->user_id);
$account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : 0;
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : 0;
$max_rows = isset($_REQUEST['max_rows']) ? $_REQUEST['max_rows'] : $_SESSION['GO_SESSION']['max_rows_list'];
$first_row = isset($_REQUEST['first_row']) ? $_REQUEST['first_row'] : 0;
$table_tabindex = isset($_REQUEST['table_tabindex']) ? $_REQUEST['table_tabindex'] : null;
$mailbox = isset($_REQUEST['mailbox']) ? smartstrip($_REQUEST['mailbox']) : 'INBOX';
$link_back = $GO_MODULES->url . 'index.php?account_id=' . $account_id . '&mailbox=' . $mailbox . '&first_row=' . $first_row;
$return_to = isset($_REQUEST['return_to']) && $_REQUEST['return_to'] != '' ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];
$query = isset($_REQUEST['query']) ? base64_decode($_REQUEST['query']) : '';
$link_back = 'search.php';
if (!($account = $email->get_account($account_id))) {
    $account = $email->get_account(0);
Author: Merijn Schering <*****@*****.**>
Version: 1.0 Release date: 08 July 2003

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('email');
require $GO_CONFIG->class_path . "imap.class.inc";
require $GO_MODULES->class_path . "email.class.inc";
require $GO_CONFIG->class_path . 'filetypes.class.inc';
$filetypes = new filetypes();
$mail = new imap();
$email = new email();
$account = $email->get_account($_REQUEST['account_id']);
if ($mail->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']), $_REQUEST['mailbox'], 0, $account['use_ssl'], $account['novalidate_cert'])) {
    $file = $mail->view_part($_REQUEST['uid'], $_REQUEST['part'], $_REQUEST['transfer'], $_REQUEST['mime']);
    $mail->close();
    $filename = smartstrip($_REQUEST['filename']);
    $extension = get_extension($filename);
    $type = $filetypes->get_type($extension);
    $browser = detect_browser();
    //header('Content-Length: '.strlen($file));
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    if ($browser['name'] == 'MSIE') {
        header('Content-Type: application/download');
        header('Content-Disposition: attachment; filename="' . $filename . '"');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
Example #21
0
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  
  This File: imapman.php
  Description: System File

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
if (!defined('PARENT')) {
    $HEADERS->err403(true);
}
// Access..
if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') {
    $HEADERS->err403(true);
}
// Class..
include_once PATH . 'control/classes/class.imap.php';
$MSIMAP = new imap();
// Enable/disable (Ajax)..
if (isset($_GET['changeState'])) {
    $MSIMAP->enableDisable();
    echo $JSON->encode(array('ok'));
    exit;
}
// Delete..
if (isset($_POST['delete']) && USER_DEL_PRIV == 'yes') {
    $count = $MSIMAP->deleteImapAccounts();
    $OK1 = true;
}
$title = $msg_adheader40;
$loadJQAlertify = true;
$loadJQNyroModal = true;
include PATH . 'templates/header.php';