function ScanMailBox($uid) { $ct = new user($uid); $sock = new sockets(); $username = $uid; $password = $ct->password; $zarafa_sock = "file:///var/run/zarafa"; $ZarafaServerListenIP = $sock->GET_INFO("ZarafaServerListenIP"); if ($ZarafaServerListenIP == null) { $ZarafaServerListenIP = "127.0.0.1"; } if ($ZarafaServerListenIP == "0.0.0.0") { $ZarafaServerListenIP = "127.0.0.1"; } $ZarafaServerListenPort = intval($sock->GET_INFO("ZarafaServerListenPort")); if ($ZarafaServerListenPort == 0) { $ZarafaServerListenPort = 236; } $zarafaServer = "http://{$ZarafaServerListenIP}:{$ZarafaServerListenPort}/zarafa"; $session = mapi_logon_zarafa($username, $password, $zarafaServer); $hard_delete_messages = true; $folder_to_process = 'Sent Items'; $total_deleted = 0; if (!$session) { print "Unable to open session {$username}@{$zarafaServer} `{$password}`\n"; return; } $msgstorestable = mapi_getmsgstorestable($session); if (!$msgstorestable) { print "Unable to open message stores table\n"; return; } $msgstores = mapi_table_queryallrows($msgstorestable, array(PR_DEFAULT_STORE, PR_ENTRYID)); foreach ($msgstores as $row) { if ($row[PR_DEFAULT_STORE]) { $default_store_entry_id = $row[PR_ENTRYID]; } } $default_store = mapi_openmsgstore($session, $default_store_entry_id); if (!$default_store) { print "Unable to open default store\n"; exit(1); } $root = mapi_msgstore_openentry($default_store); // get folders $folders = mapi_folder_gethierarchytable($root, CONVENIENT_DEPTH); // loop over every folder while (1) { $rows = mapi_table_queryrows($folders, array(PR_DISPLAY_NAME, PR_FOLDER_TYPE, PR_ENTRYID), 0, 100); if (count($rows) == 0) { break; } foreach ($rows as $row) { // skip searchfolders if (isset($row[PR_FOLDER_TYPE]) && $row[PR_FOLDER_TYPE] == FOLDER_SEARCH) { continue; } // operate only on folders, whose name is specified in the config section. // Like 'Sent Objects'. if ($row[PR_DISPLAY_NAME] == $folder_to_process) { parse_messages($default_store, $row[PR_ENTRYID]); } } } }
//main smarty instance $smarty = new smarty_connect(); $smarty->debugging_ctrl = $_SERVER['SERVER_NAME'] == 'localhost' ? 'URL' : 'NONE'; if (isset($_GET['site']) && $_GET['site'] == 'complete_login') { complete_login(); return true; } elseif (isset($_GET['site']) && $_GET['site'] == 'complete_logout') { complete_logout(); return true; } if (!isset($_SESSION['customer_id']) || !isset($_GET['site'])) { $smarty->display('login.tpl'); return true; } display_visitor_info(); parse_messages(); switch ($_GET['site']) { case 'jobs': display_jobs(); break; case 'add_email': $smarty->assign('content', $smarty->fetch("add_email.tpl")); break; case 'complete_add_email': complete_add_email(); break; } //assigning page parts that are always visible //$smarty->assign('head', $smarty->fetch("head.tpl")); $smarty->assign('left_navi', $smarty->fetch("left_navi.tpl")); //$smarty->assign('right_navi', $smarty->fetch("right_navi.tpl"));