示例#1
0
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('emails.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
if (!Access::canAccessAssociateEmails(Auth::getUserID())) {
    $tpl->assign('no_access', 1);
    $tpl->displayTemplate();
    exit;
}
$pagerRow = Support::getParam('pagerRow');
if (empty($pagerRow)) {
    $pagerRow = 0;
}
$rows = Support::getParam('rows');
if (empty($rows)) {
    $rows = APP_DEFAULT_PAGER_SIZE;
}
$options = Support::saveSearchParams();
$tpl->assign('options', $options);
$tpl->assign('sorting', Support::getSortingInfo($options));
$list = Support::getEmailListing($options, $pagerRow, $rows);
$tpl->assign('list', $list['list']);
$tpl->assign('list_info', $list['info']);
$tpl->assign('issues', Issue::getColList());
$tpl->assign('accounts', Email_Account::getAssocList(Auth::getCurrentProject()));
$prefs = Prefs::get(Auth::getUserID());
$tpl->assign('refresh_rate', $prefs['email_refresh_rate'] * 60);
$tpl->assign('refresh_page', 'emails.php');
$tpl->displayTemplate();
示例#2
0
// | Boston, MA 02110-1301, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$tpl = new Template_Helper();
$tpl->setTemplate('view_email.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = Support::getIssueFromEmail($_GET['id']);
if ($issue_id != 0 && !Issue::canAccess($issue_id, $usr_id) || $issue_id == 0 && User::getRoleByUser($usr_id, $prj_id) < User::ROLE_USER) {
    $tpl->setTemplate('permission_denied.tpl.html');
    $tpl->displayTemplate();
    exit;
}
$email = Support::getEmailDetails($_GET['ema_id'], $_GET['id']);
$email['seb_body'] = str_replace('&amp;nbsp;', '&nbsp;', $email['seb_body']);
$tpl->assign(array('email' => $email, 'issue_id' => $issue_id, 'extra_title' => ev_gettext('Issue #%1$s Email #%3$s: %2$s', $issue_id, $email['sup_subject'], Support::getSequenceByID($_GET['id'])), 'email_accounts' => Email_Account::getAssocList(array_keys(Project::getAssocList(Auth::getUserID())), true), 'recipients' => Mail_Queue::getMessageRecipients(array('customer_email', 'other_email'), $_GET['id'])));
if (@$_GET['cat'] == 'list_emails') {
    $sides = Support::getListingSides($_GET['id']);
    $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
} elseif (@$_GET['cat'] == 'move_email' && Auth::getCurrentRole() >= User::getRoleID('Standard User')) {
    $res = Support::moveEmail(@$_GET['id'], @$_GET['ema_id'], @$_GET['new_ema_id']);
    $tpl->assign('move_email_result', $res);
    $tpl->assign('current_user_prefs', Prefs::get(Auth::getUserID()));
} else {
    $sides = Support::getIssueSides($issue_id, $_GET['id']);
    $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
}
$tpl->displayTemplate();
示例#3
0
        fatal('Wrong number of parameters given. Expected parameters related to the email account:', ' 1 - username', ' 2 - hostname', ' 3 - mailbox (only required if IMAP account)', 'Example: php download_emails.php user example.com INBOX');
    } else {
        fatal('Wrong number of parameters given. Expected parameters related to email account:', 'download_emails.php?username=<i>username</i>&hostname=<i>hostname</i>&mailbox=<i>mailbox</i>');
    }
}
// get the account ID early since we need it also for unlocking.
$account_id = Email_Account::getAccountID($config['username'], $config['hostname'], $config['mailbox']);
if (!$account_id && !$config['fix-lock']) {
    fatal('Could not find a email account with the parameter provided.', 'Please verify your email account settings and try again.');
}
if ($config['fix-lock']) {
    // if there is no account id, unlock all accounts
    if (!$account_id) {
        $prj_ids = array_keys(Project::getAll());
        foreach ($prj_ids as $prj_id) {
            $ema_ids = Email_Account::getAssocList($prj_id);
            foreach ($ema_ids as $ema_id => $ema_title) {
                $lockfile = 'download_emails_' . $ema_id;
                if (Lock::release($lockfile)) {
                    msg("Removed lock file '{$lockfile}'.");
                }
            }
        }
    } else {
        $lockfile = 'download_emails_' . $account_id;
        if (Lock::release($lockfile)) {
            msg("Removed lock file '{$lockfile}'.");
        }
    }
    exit(0);
}
示例#4
0
include_once APP_INC_PATH . "class.issue.php";
include_once APP_INC_PATH . "class.misc.php";
include_once APP_INC_PATH . "class.support.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("view_email.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$email = Support::getEmailDetails($HTTP_GET_VARS["ema_id"], $HTTP_GET_VARS["id"]);
$email["message"] = str_replace("&amp;nbsp;", "&nbsp;", $email["message"]);
$issue_id = Support::getIssueFromEmail($HTTP_GET_VARS["id"]);
if (!Issue::canAccess($issue_id, Auth::getUserID())) {
    $tpl->setTemplate("permission_denied.tpl.html");
    $tpl->displayTemplate();
    exit;
}
$tpl->bulkAssign(array("email" => $email, "issue_id" => $issue_id, 'extra_title' => "Email #" . $HTTP_GET_VARS['id'] . ": " . $email['sup_subject'], 'email_accounts' => Email_Account::getAssocList(array_keys(Project::getAssocList(Auth::getUserID())), true)));
if (@$HTTP_GET_VARS['cat'] == 'list_emails') {
    $sides = Support::getListingSides($HTTP_GET_VARS["id"]);
    $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
} elseif (@$HTTP_GET_VARS['cat'] == 'move_email' && Auth::getCurrentRole() >= User::getRoleID("Standard User")) {
    $res = Support::moveEmail(@$HTTP_GET_VARS['id'], @$HTTP_GET_VARS['ema_id'], @$HTTP_GET_VARS['new_ema_id']);
    $tpl->assign("move_email_result", $res);
    $tpl->assign("current_user_prefs", Prefs::get(Auth::getUserID()));
} else {
    $sides = Support::getIssueSides($issue_id, $HTTP_GET_VARS["id"]);
    $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
}
// set the page charset to whatever is set on this email
$charset = Mime_Helper::getCharacterSet($email['seb_full_email']);
if (!empty($charset)) {
    header("Content-Type: text/html; charset=" . $charset);