(ini_get("max_execution_time") - 5)) ) { $get_requiredcsv = new UploadCsvFile (null,null,$_GET['line_no']); $get_requiredcsv -> createCsvMailBox(); unsetsession(); if (isset($_SESSION['errorMail'])) $mode = 'incomplete'; else $mode = 'complete'; $smarty->assign ('mode', $mode); } else { $fDomain = safeget('domain', $list_domains[0]); $fDomain = escape_string($fDomain); if(!in_array($fDomain, $list_domains)) { die("Invalid domain name selected, or you tried to select a domain you are not an admin for"); } $tDomain = $fDomain; $get_requiredcsv = new UploadCsvFile(); /* this template is only require to upload a CSV file */ $smarty->assign ('mode', 'upload'); } } if ($_SERVER['REQUEST_METHOD'] == "POST") { $fUploadFile = array(); $fDomain = safepost('fDomain'); if (isset ($_FILES['fBulkmail'])) $fUploadFile =& $_FILES["fBulkmail"]; $delimiter = safepost('delimiter_name'); $csvupload = safepost('upload'); $csvcancel = safepost('cancel'); if (!empty($csvupload)) { $get_requiredcsv = new UploadCsvFile (); $get_requiredcsv -> createCsvMailBox(); if (isset($_SESSION['errorMail'])) $mode = 'incomplete'; else $mode = 'complete'; unsetsession(); $smarty->assign ('mode', $mode); } elseif (!empty($csvcancel)) { // free the session $smarty->assign ('mode', 'upload'); $get_requiredcsv = new UploadCsvFile (); unsetsession(); } else { $get_requiredcsv = new UploadCsvFile ($fUploadFile,$fDomain,null,$delimiter); $smarty->assign ('mode', 'upload'); if($get_requiredcsv -> check_for_CSV_file()) { $readVal = $get_requiredcsv -> scanCsvfile(); if (!$get_requiredcsv -> checkForSeperator()){ flash_error($PALANG['pCreate_upload_delimiterror']); }elseif(!$readVal) { flash_error($PALANG['pCreate_upload_headererror']); } //TODO: Need to specify the number for mail box to using check_mailbox //}elseif (!check_mailbox($fDomain)) // flash_error($PALANG['pCreate_mailbox_domain_limit'].'
'. $PALANG['pCreate_domain_limit_request']); else { $smarty->assign ('mode', 'csvOutput'); $smarty->assign ('csvdomain',$fDomain); $smarty->assign ('outputcsv', $readVal); } } else flash_error($PALANG['pCreate_mailbox_fileerror']); } } // Errors will be displayed after creating the mail boxes. if (isset($_SESSION['errorMail'])) { foreach($_SESSION['errorMail'] as $i => $mailerror) flash_error($mailerror); // Cannot call under unsetsession function unset ($_SESSION['errorMail']); } $smarty->assign ('select_options', select_options ($list_domains, array ($tDomain)), false); $smarty->assign ('select_options_csv_delimiter', select_options($get_requiredcsv->get_CSV_delimitor(), array(',')),false); $smarty->assign ('smarty_template', 'upload-mailbox'); $smarty->display ('index.tpl'); function unsetsession() { unset( $_SESSION["mailBox"]); unset( $_SESSION["domain"]); } ?>