// Print the error screen if the account has auth errors, or session timeout. if ($atmail->status == 1) { $atmail->auth_error(); } if ($atmail->status == 2) { $atmail->session_error(); } // Which function $var['func'] = $_REQUEST['func']; // Check for an attachment upload that has gone over post_max_size // Set func to 'attachment' as $_POST will be empty. if (isset($_GET['sending_attachment']) && !count($_POST) && !count($_FILES)) { $var['func'] = 'attachment'; } // Load the account preferences $atmail->loadprefs(); // Parse the users custom stylesheet $var['atmailstyle'] = $atmail->parse("html/{$atmail->Language}/{$atmail->LoginType}/atmailstyle.css"); // Load the time to display in the compose window $var['localtime'] = strftime("%c"); // Create a unique number - Each compose screen is unique. Used to // reference which attachments are for what window. Based on the // PID and a random number. $var['unique'] = $atmail->param_escape('unique'); $var['delete'] = $_REQUEST['delete']; if (!$var['unique']) { $var['unique'] = getmypid() + rand(0, 1000); } // Avoid any fake/malformed unique ID, e.g ../ in pathname $var['unique'] = basename($var['unique']); // see if something is cached
$atmail->clean_tmp(); // clear tmp directory if ($handle = opendir($pref['install_dir'] . '/tmp/')) { while (false !== ($file_name = readdir($handle))) { if ($file_name != "." && $file_name != ".." && $file_name != '.htaccess' && is_file($file_name)) { if (strtotime("+ 180 seconds") > fileatime($file_name)) { unlink($file_name); } } } closedir($handle); } // If we have expunge on logout ( e.g PDMF IMAP server) if ($pref['expunge_logout'] == '1') { $atmail->status = $auth->getuser($atmail->SessionID); $atmail->loadprefs(1); require_once 'GetMail.php'; $mail = new GetMail(array('Username' => $atmail->username, 'Pop3host' => $atmail->pop3host, 'Password' => $auth->password, 'Mode' => $atmail->Mode, 'Type' => $atmail->MailType)); if ($atmail->MailType == 'imap') { $mail->login(); $folders = $mail->listfolders(); // Create a new folder-tree element $mail->newfolder_tree(); // Loop through each of the folders foreach ($folders as $folder) { $mail->expunge($folder); } } } session_destroy(); }