Viewing file: checknewxml.php (4.29 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
############################################################################
# DWmail
# - version 4.0
# - Copyright (c) 2003-2006 Dominion Web Design
# - http://www.dominion-web.com/products/dwmail/
############################################################################
#
# The contents of this file are subject to the DWmail License version
# 2.2 ('License'). You may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.dominion-web.com/products/dwmail/license.php
# Software distributed under the License is distributed on an "AS IS" basis,
# without warranty of any kind, either express or implied.
#
# This code is Copyright (c) 2003-2006 Dominion Web Design.
# All rights reserved.
#
# This software may not be redistributed outside the terms of the
# license agreement.
#
############################################################################
*/
require ("./includes/init.inc.php");
require ("./includes/global.inc.php");
require ("./includes/imap.inc.php");
require ("./includes/functions.inc.php");
require ("./includes/config.inc.php");
$MainSettings = new GlobalInit();
$TransIDEnabled = $MainSettings->INIGet('session.use_trans_sid');
session_cache_limiter($DefaultSessionCache);
session_start();
if (!$_SESSION['DefaultLang']) {
$_SESSION['DefaultLang'] = $DefaultLang;
}
require ("./lang/" . strip_tags(str_replace("..", "", trim($_SESSION['DefaultLang']))) . "/global.inc.php");
require ("./lang/" . strip_tags(str_replace("..", "", trim($_SESSION['DefaultLang']))) . "/mailbox.inc.php");
@setlocale(LC_TIME, $AvailLangs[$_SESSION['DefaultLang']]['locale']);
$folder = "INBOX";
$folderencode = urlencode($folder);
$_SESSION['sort'] = "SORTDATE";
$_SESSION['order'] = 1;
$hash = strip_tags(stripslashes($_GET['key']));
$userid = strip_tags(stripslashes($_GET['userid']));
if ($UseDatabase == 1) {
switch ($DatabaseType) {
case 'mysqli':
$DBLib = 'mysqli';
break;
case 'postgresql':
$DBLib = 'postgresql';
break;
default:
$DBLib = 'mysql';
break;
}
require_once ("./includes/db_" . $DBLib . ".inc.php");
$MySQLConnection = new DB_Connection($MySQLServer, $MySQLUsername, $MySQLPassword, $MySQLDBName);
$MySQLMakeConnection = $MySQLConnection->DB_MakeConnection();
}
$MySQLConnection->_DBUserID = $userid;
$rsshash = $MySQLConnection->DB_GetHash($hash, $MySQLConnection->_DBUserID);
if ($rsshash == FALSE) {
exit;
}
$GetRSS = trim($MySQLConnection->DB_GetPrefs('rss'));
$GetRSS = $MainSettings->CheckSlashes($GetRSS);
$UserDetails = unserialize($GetRSS);
if ($UserDetails['enabled'] <> 1) {
exit;
}
if ($_SERVER['HTTPS'] == "on") {
$currenturl = 'https://';
}
else {
$currenturl = 'http://';
}
$currenturl .= $_SERVER["HTTP_HOST"];
$directory = str_replace("checknewxml.php", "", $_SERVER["PHP_SELF"]);
$currenturl .= $directory;
header ("Content-type: text/xml; charset=UTF-8");
echo ("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
$_SESSION['sess_u'] = $UserDetails['sess_u'];
$_SESSION['sess_p'] = $UserDetails['sess_p'];
$_SESSION['mailserver'] = $UserDetails['mailserver'];
$_SESSION['sess_domain'] = $UserDetails['sess_domain'];
$_SESSION['servertype'] = $UserDetails['servertype'];
$_SESSION['portnumber'] = $UserDetails['portnumber'];
$_SESSION['ssl'] = $UserDetails['ssl'];
$_SESSION['sess_e'] = $UserDetails['sess_e'];
$_SESSION['currentemailaddress'] = $UserDetails['currentemailaddress'];
$_SESSION['folder'] = "INBOX";
$_SESSION['compatibilitymode'] = $CompatibilityMode;
$IMAPConnection = new WM_IMAPConnection($_SESSION);
$mailbox = $IMAPConnection->WM_IMAPConnect();
$imapstatus = $IMAPConnection->WM_IMAPStatus($_SESSION['folder']);
$totalmessages = $imapstatus->messages;
$numberofnewmessages = $imapstatus->unseen;
$mailboxinfo = $IMAPConnection->WM_IMAPMailboxInfo();
$numberofpages = ceil($totalmessages / $messagesperpage);
$counter = 1;
?>
<DWmail>
<new><?php echo $numberofnewmessages; ?></new>
<total><?php echo $totalmessages; ?></total>
<type><?php echo $_SESSION['servertype']; ?></type>
</DWmail>
<?php
if ($UseDatabase == 1) {
$MySQLCloseConnection = $MySQLConnection->DB_CloseConnection();
}
$IMAPConnection->WM_IMAPClose();
session_unset();
session_destroy();
?>
|