diff --git a/include/class.email.php b/include/class.email.php index e6b10c3892ece68f9d0410a77116f67cf7de61dd..c38144c4b1281fabf18ffd90b7e4a3937ff4cd90 100644 --- a/include/class.email.php +++ b/include/class.email.php @@ -142,7 +142,6 @@ class Email { function send($to, $subject, $message, $attachments=null, $options=null) { - $mailer = new Mailer($this); if($attachments) $mailer->addAttachments($attachments); @@ -150,6 +149,16 @@ class Email { return $mailer->send($to, $subject, $message, $options); } + function sendAutoReply($to, $subject, $message, $attachments=null, $options=array()) { + $options+= array('autoreply' => true); + return $this->send($to, $subject, $message, $attachments, $options); + } + + function sendAlert($to, $subject, $message, $attachments=null, $options=array()) { + $options+= array('bulk' => true); + return $this->send($to, $subject, $message, $attachments, $options); + } + function update($vars,&$errors) { $vars=$vars; $vars['cpasswd']=$this->getPasswd(); //Current decrypted password. diff --git a/include/class.file.php b/include/class.file.php index 364e7f14ac570d3cc0c2bb2fa074bb05eef1c29a..da8ad76dc0ed9e9917596829fa7a6450f8176b2d 100644 --- a/include/class.file.php +++ b/include/class.file.php @@ -181,7 +181,7 @@ class AttachmentFile { $sql='INSERT INTO '.FILE_TABLE.' SET created=NOW() ' .',type='.db_input($file['type']) .',size='.db_input($file['size']) - .',name='.db_input($file['name']) + .',name='.db_input(Format::file_name($file['name'])) .',hash='.db_input($file['hash']); if (!(db_query($sql) && ($id=db_insert_id()))) diff --git a/include/class.filter.php b/include/class.filter.php index b6f5305959ab64c9be3df7789c7fe2cb6bd9ae2a..0af8330b8022393162450c803031b000a7471ab0 100644 --- a/include/class.filter.php +++ b/include/class.filter.php @@ -879,7 +879,7 @@ class TicketFilter { 'Precedence' => array('AUTO_REPLY', 'BULK', 'JUNK', 'LIST'), 'Subject' => array('OUT OF OFFICE', 'AUTO-REPLY:', 'AUTORESPONSE'), 'X-Autoreply' => 'YES', - 'X-Auto-Response-Suppress' => 'OOF', + 'X-Auto-Response-Suppress' => array('ALL', 'DR', 'RN', 'NRN', 'OOF', 'AutoReply'), 'X-Autoresponse' => '', 'X-Auto-Reply-From' => '' ); diff --git a/include/class.format.php b/include/class.format.php index aaa6667d32c2fce14da2cb9f5e15387ec9608b0c..b510221e02b41a8da8b4bfd27278cfdb9e5d5e9d 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -31,10 +31,7 @@ class Format { } function file_name($filename) { - - $search = array('/ß/','/ä/','/Ä/','/ö/','/Ö/','/ü/','/Ü/','([^[:alnum:]._])'); - $replace = array('ss','ae','Ae','oe','Oe','ue','Ue','_'); - return preg_replace($search,$replace,$filename); + return preg_replace('/\s+/', '_', $filename); } /* re-arrange $_FILES array for the sane */ diff --git a/include/class.mailer.php b/include/class.mailer.php index a227b8fc52951c563d56ccd4d59684149ae15336..57242e61605b77f241c5ec09973d28a1518b4836 100644 --- a/include/class.mailer.php +++ b/include/class.mailer.php @@ -107,7 +107,20 @@ class Mailer { 'Date'=> date('D, d M Y H:i:s O'), 'Message-ID' => $messageId, 'X-Mailer' =>'osTicket Mailer' - ); + ); + + //Set bulk/auto-response headers. + if($options && ($options['autoreply'] or $options['bulk'])) { + $headers+= array( + 'X-Autoreply' => 'yes', + 'X-Auto-Response-Suppress' => 'ALL, AutoReply', + 'Auto-Submitted' => 'auto-replied'); + + if($options['bulk']) + $headers+= array('Precedence' => 'bulk'); + else + $headers+= array('Precedence' => 'auto_reply'); + } $mime = new Mail_mime(); $mime->setTXTBody($body); diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index fce15f537eb6125b5689ebef37879d267e90f850..c567819cbdb27b6e4fe5910865b4a36c0c01faa9 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -196,23 +196,25 @@ class MailFetcher { //Convert text to desired encoding..defaults to utf8 function mime_encode($text, $charset=null, $enc='utf-8') { //Thank in part to afterburner - if(function_exists('iconv') and $text) { + if(function_exists('iconv') and ($charset or function_exists('mb_detect_encoding'))) { if($charset) return iconv($charset, $enc.'//IGNORE', $text); elseif(function_exists('mb_detect_encoding')) return iconv(mb_detect_encoding($text, $this->encodings), $enc, $text); + } elseif(function_exists('iconv_mime_decode')) { + return iconv_mime_decode($text, 0, $enc); } return utf8_encode($text); } - //Generic decoder - mirrors imap_utf8 + //Generic decoder - resuting text is utf8 encoded -> mirrors imap_utf8 function mime_decode($text) { $str = ''; $parts = imap_mime_header_decode($text); foreach ($parts as $part) - $str.= $part->text; + $str.= $this->mime_encode($part->text, ($part->charset=='default'?'ASCII':$part->charset), 'utf-8'); return $str?$str:imap_utf8($text); } @@ -310,15 +312,31 @@ class MailFetcher { if($part && !$part->parts) { //Check if the part is an attachment. $filename = ''; - if($part->ifdisposition && in_array(strtolower($part->disposition), array('attachment', 'inline'))) + if($part->ifdisposition && in_array(strtolower($part->disposition), array('attachment', 'inline'))) { $filename = $part->dparameters[0]->value; - elseif($part->ifparameters && $part->type == 5) //inline image without disposition. + //Some inline attachments have multiple parameters. + if(count($part->dparameters)>1) { + foreach($part->dparameters as $dparameter) { + if(strcasecmp($dparameter->attribute, 'FILENAME')) continue; + $filename = $dparameter->value; + break; + } + } + } elseif($part->ifparameters && $part->type == 5) { //inline image without disposition. $filename = $part->parameters[0]->value; + if(count($part->parameters)>1) { + foreach($part->parameters as $parameter) { + if(strcasecmp($parameter->attribute, 'FILENAME')) continue; + $filename = $parameter->value; + break; + } + } + } if($filename) { return array( array( - 'name' => $filename, + 'name' => $this->mime_decode($filename), 'mime' => $this->getMimeType($part), 'encoding' => $part->encoding, 'index' => ($index?$index:1) diff --git a/include/class.osticket.php b/include/class.osticket.php index 86d206f212d6450db9755ac4f5c77926ff2a53c8..fd300184a96b985b1c1b1022817b2b11e85fc4aa 100644 --- a/include/class.osticket.php +++ b/include/class.osticket.php @@ -26,7 +26,16 @@ define('LOG_WARN',LOG_WARNING); class osTicket { var $loglevel=array(1=>'Error','Warning','Debug'); + + //Page errors. var $errors; + + //System + var $system; + + + + var $warning; var $message; @@ -136,14 +145,19 @@ class osTicket { $errors=0; foreach($files as &$file) { - if(!$this->isFileTypeAllowed($file)) - $file['error']='Invalid file type for '.$file['name']; + //skip no file upload "error" - why PHP calls it an error is beyond me. + if($file['error'] && $file['error']==UPLOAD_ERR_NO_FILE) continue; + + if($file['error']) //PHP defined error! + $file['error'] = 'File upload error #'.$file['error']; + elseif(!$file['tmp_name'] || !is_uploaded_file($file['tmp_name'])) + $file['error'] = 'Invalid or bad upload POST'; + elseif(!$this->isFileTypeAllowed($file)) + $file['error'] = 'Invalid file type for '.$file['name']; elseif($file['size']>$this->getConfig()->getMaxFileSize()) - $file['error']=sprintf('File (%s) is too big. Maximum of %s allowed', + $file['error'] = sprintf('File (%s) is too big. Maximum of %s allowed', $file['name'], Format::file_size($this->getConfig()->getMaxFileSize())); - elseif(!$file['error'] && !is_uploaded_file($file['tmp_name'])) - $file['error']='Invalid or bad upload POST'; - + if($file['error']) $errors++; } @@ -182,18 +196,15 @@ class osTicket { } function setErrors($errors) { - if(!is_array($errors)) - return $this->setError($errors); - $this->errors = $errors; } function getError() { - return $this->errors['err']; + return $this->system['err']; } function setError($error) { - $this->errors['err'] = $error; + $this->system['error'] = $error; } function clearError() { @@ -201,11 +212,11 @@ class osTicket { } function getWarning() { - return $this->warning; + return $this->system['warning']; } - function setWarning($warn) { - $this->warning = $warn; + function setWarning($warning) { + $this->system['warning'] = $warning; } function clearWarning() { @@ -213,16 +224,16 @@ class osTicket { } - function getMessage() { - return $this->message; + function getNotice() { + return $this->system['notice']; } - function setMessage($msg) { - $this->message = $msg; + function setNotice($notice) { + $this->system['notice'] = $notice; } - function clearMessage() { - $this->setMessage(''); + function clearNotice() { + $this->setNotice(''); } @@ -242,7 +253,7 @@ class osTicket { $email=$this->getConfig()->getDefaultEmail(); //will take the default email. if($email) { - $email->send($to, $subject, $message); + $email->sendAlert($to, $subject, $message); } else {//no luck - try the system mail. Email::sendmail($to, $subject, $message, sprintf('"osTicket Alerts"<%s>',$to)); } diff --git a/include/class.ticket.php b/include/class.ticket.php index b4b7952b5f5740ab71301f324059a6eb7730eb98..5a3fd83f3883c432b17bf89d4ac08d6b4ee95de6 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -867,8 +867,7 @@ class Ticket { if($cfg->stripQuotedReply() && ($tag=$cfg->getReplySeparator())) $msg['body'] ="\n$tag\n\n".$msg['body']; - //TODO: add auto flags....be nice to mail servers and sysadmins!! - $email->send($this->getEmail(), $msg['subj'], $msg['body']); + $email->sendAutoReply($this->getEmail(), $msg['subj'], $msg['body']); } if(!($email=$cfg->getAlertEmail())) @@ -885,7 +884,7 @@ class Ticket { //Alert admin?? if($cfg->alertAdminONNewTicket()) { $alert = str_replace('%{recipient}', 'Admin', $msg['body']); - $email->send($cfg->getAdminEmail(), $msg['subj'], $alert); + $email->sendAlert($cfg->getAdminEmail(), $msg['subj'], $alert); $sentlist[]=$cfg->getAdminEmail(); } @@ -901,7 +900,7 @@ class Ticket { foreach( $recipients as $k=>$staff){ if(!is_object($staff) || !$staff->isAvailable() || in_array($staff->getEmail(),$sentlist)) continue; $alert = str_replace('%{recipient}', $staff->getFirstName(), $msg['body']); - $email->send($staff->getEmail(), $msg['subj'], $alert); + $email->sendAlert($staff->getEmail(), $msg['subj'], $alert); $sentlist[] = $staff->getEmail(); } @@ -934,7 +933,7 @@ class Ticket { $msg = $this->replaceVars($msg, array('signature' => ($dept && $dept->isPublic())?$dept->getSignature():'')); - $email->send($this->getEmail(), $msg['subj'], $msg['body']); + $email->sendAutoReply($this->getEmail(), $msg['subj'], $msg['body']); } $client= $this->getClient(); @@ -997,7 +996,7 @@ class Ticket { if($cfg->stripQuotedReply() && ($tag=$cfg->getReplySeparator())) $msg['body'] ="\n$tag\n\n".$msg['body']; - $email->send($this->getEmail(), $msg['subj'], $msg['body']); + $email->sendAutoReply($this->getEmail(), $msg['subj'], $msg['body']); } } @@ -1056,7 +1055,7 @@ class Ticket { foreach( $recipients as $k=>$staff) { if(!is_object($staff) || !$staff->isAvailable() || in_array($staff->getEmail(),$sentlist)) continue; $alert = str_replace('%{recipient}', $staff->getFirstName(), $msg['body']); - $email->send($staff->getEmail(), $msg['subj'], $alert); + $email->sendAlert($staff->getEmail(), $msg['subj'], $alert); $sentlist[] = $staff->getEmail(); } } @@ -1109,7 +1108,7 @@ class Ticket { foreach( $recipients as $k=>$staff){ if(!is_object($staff) || !$staff->isAvailable() || in_array($staff->getEmail(),$sentlist)) continue; $alert = str_replace("%{recipient}", $staff->getFirstName(), $msg['body']); - $email->send($staff->getEmail(), $msg['subj'], $alert); + $email->sendAlert($staff->getEmail(), $msg['subj'], $alert); $sentlist[] = $staff->getEmail(); } @@ -1294,7 +1293,7 @@ class Ticket { foreach( $recipients as $k=>$staff){ if(!is_object($staff) || !$staff->isAvailable() || in_array($staff->getEmail(),$sentlist)) continue; $alert = str_replace('%{recipient}',$staff->getFirstName(), $msg['body']); - $email->send($staff->getEmail(), $msg['subj'], $alert); + $email->sendAlert($staff->getEmail(), $msg['subj'], $alert); $sentlist[] = $staff->getEmail(); } } @@ -1453,7 +1452,7 @@ class Ticket { foreach( $recipients as $k=>$staff){ if(!$staff || !$staff->getEmail() || !$staff->isAvailable() || in_array($staff->getEmail(), $sentlist)) continue; $alert = str_replace('%{recipient}', $staff->getFirstName(), $msg['body']); - $email->send($staff->getEmail(), $msg['subj'], $alert); + $email->sendAlert($staff->getEmail(), $msg['subj'], $alert); $sentlist[] = $staff->getEmail(); } } @@ -1503,7 +1502,7 @@ class Ticket { $msg['body'] ="\n$tag\n\n".$msg['body']; $attachments =($cfg->emailAttachments() && $files)?$this->getAttachments($respId, 'R'):array(); - $email->send($this->getEmail(), $msg['subj'], $msg['body'], $attachments); + $email->sendAutoReply($this->getEmail(), $msg['subj'], $msg['body'], $attachments); } return $respId; @@ -1717,7 +1716,7 @@ class Ticket { if(!$staff || !is_object($staff) || !$staff->getEmail() || !$staff->isAvailable()) continue; if(in_array($staff->getEmail(),$sentlist) || ($staffId && $staffId==$staff->getId())) continue; $alert = str_replace('%{recipient}',$staff->getFirstName(), $msg['body']); - $email->send($staff->getEmail(), $msg['subj'], $alert, $attachments); + $email->sendAlert($staff->getEmail(), $msg['subj'], $alert, $attachments); $sentlist[] = $staff->getEmail(); } } diff --git a/include/class.upgrader.php b/include/class.upgrader.php index 012f88d1160bea1fb09d2104129d19e8fccebd3e..e437fcad7acd8d9b69045eb65655fa0f4ad835a5 100644 --- a/include/class.upgrader.php +++ b/include/class.upgrader.php @@ -67,7 +67,7 @@ class Upgrader extends SetupWizard { $subject = 'Upgrader Error'; if($email) { - $email->send($thisstaff->getEmail(), $subject, $error); + $email->sendAlert($thisstaff->getEmail(), $subject, $error); } else {//no luck - try the system mail. Mailer::sendmail($thisstaff->getEmail(), $subject, $error, sprintf('"osTicket Alerts"<%s>', $thisstaff->getEmail())); } diff --git a/include/staff/footer.inc.php b/include/staff/footer.inc.php index d789c14474ef63caf5c06f61d60cdfb6df881bcc..90373479f3b1270bc0375826953a92c6657db403 100644 --- a/include/staff/footer.inc.php +++ b/include/staff/footer.inc.php @@ -13,5 +13,9 @@ if(is_object($thisstaff) && $thisstaff->isStaff()) { ?> } ?> </div> <div id="overlay"></div> +<div id="loading"> + <h4>Please Wait!</h4> + <p>Please wait... it will take a second!</p> +</div> </body> </html> diff --git a/include/staff/header.inc.php b/include/staff/header.inc.php index a349cb3c6ecb662f2d82f64086fc4984e295c263..8475f328606a9e70892a97daef6ebb0e96aa7352 100644 --- a/include/staff/header.inc.php +++ b/include/staff/header.inc.php @@ -31,6 +31,14 @@ </head> <body> <div id="container"> + <?php + if($ost->getError()) + echo sprintf('<div id="error_bar">%s</div>', $ost->getError()); + elseif($ost->getWarning()) + echo sprintf('<div id="warning_bar">%s</div>', $ost->getWarning()); + elseif($ost->getNotice()) + echo sprintf('<div id="notice_bar">%s</div>', $ost->getNotice()); + ?> <div id="header"> <a href="index.php" id="logo">osTicket - Customer Support System</a> <p id="info">Howdy, <strong><?php echo $thisstaff->getUserName(); ?></strong> diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 888ff2c0920d14c3f09a440a5b62c0ec7166b6c9..b14a4654af003d0c5dd6b85635d8d91a63048940 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -514,7 +514,7 @@ if(!$cfg->showNotesInline()) { ?> <span class="error">* <?php echo $errors['note']; ?></span></div> <textarea name="note" id="internal_note" cols="80" rows="9" wrap="soft"><?php echo $info['note']; ?></textarea><br> <div> - <span class="faded">Note title - sumarry of the note (optional)</span> + <span class="faded">Note title - summarry of the note (optional)</span> <span class="error" <?php echo $errors['title']; ?></span> </div> <input type="text" name="title" id="title" size="60" value="<?php echo $info['title']; ?>" > diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 341867b3ea2c9829d9c4a0e8e1f489c369a4d7f8..d6fab690cdcd76cc9a8c7dd9e590a6c60231a6b4 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -190,37 +190,40 @@ $sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_ur $orderWays=array('DESC'=>'DESC','ASC'=>'ASC'); //Sorting options... +$queue = isset($_REQUEST['status'])?strtolower($_REQUEST['status']):$status; $order_by=$order=null; if($_REQUEST['sort'] && $sortOptions[$_REQUEST['sort']]) $order_by =$sortOptions[$_REQUEST['sort']]; -elseif(!strcasecmp($status, 'open') && !$showanswered && $sortOptions[$_SESSION['tickets']['sort']]) { - $_REQUEST['sort'] = $_SESSION['tickets']['sort']; - $_REQUEST['order'] = $_SESSION['tickets']['order']; +elseif($sortOptions[$_SESSION[$queue.'_tickets']['sort']]) { + $_REQUEST['sort'] = $_SESSION[$queue.'_tickets']['sort']; + $_REQUEST['order'] = $_SESSION[$queue.'_tickets']['order']; - $order_by = $sortOptions[$_SESSION['tickets']['sort']]; - $order = $_SESSION['tickets']['order']; + $order_by = $sortOptions[$_SESSION[$queue.'_tickets']['sort']]; + $order = $_SESSION[$queue.'_tickets']['order']; } if($_REQUEST['order'] && $orderWays[strtoupper($_REQUEST['order'])]) $order=$orderWays[strtoupper($_REQUEST['order'])]; //Save sort order for sticky sorting. -if(!strcasecmp($status, 'open') && $_REQUEST['sort']) { - $_SESSION['tickets']['sort'] = $_REQUEST['sort']; - $_SESSION['tickets']['order'] = $_REQUEST['order']; +if($_REQUEST['sort'] && $queue) { + $_SESSION[$queue.'_tickets']['sort'] = $_REQUEST['sort']; + $_SESSION[$queue.'_tickets']['order'] = $_REQUEST['order']; } -if(!$order_by && $showanswered) { - $order_by='ticket.lastresponse, ticket.created'; //No priority sorting for answered tickets. -}elseif(!$order_by && !strcasecmp($status,'closed')){ - $order_by='ticket.closed, ticket.created'; //No priority sorting for closed tickets. +//Set default sort by columns. +if(!$order_by ) { + if($showanswered) + $order_by='ticket.lastresponse, ticket.created'; //No priority sorting for answered tickets. + elseif(!strcasecmp($status,'closed')) + $order_by='ticket.closed, ticket.created'; //No priority sorting for closed tickets. + else + $order_by='priority_urgency ASC, effective_date, ticket.created'; } -$order_by =$order_by?$order_by:'priority_urgency, effective_date, ticket.created'; -$order=$order?$order:'ASC'; - -if($order_by && strpos($order_by,',')) - $order_by=str_replace(','," $order,",$order_by); +$order=$order?$order:'DESC'; +if($order_by && strpos($order_by,',') && $order) + $order_by=preg_replace('/(?<!ASC|DESC),/', " $order,", $order_by); $sort=$_REQUEST['sort']?strtolower($_REQUEST['sort']):'urgency'; //Urgency is not on display table. $x=$sort.'_sort'; @@ -304,7 +307,7 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting.. <a class="refresh" href="<?php echo $_SERVER['REQUEST_URI']; ?>">Refresh</a> <input type="hidden" name="a" value="mass_process" > <input type="hidden" name="do" id="action" value="" > - <input type="hidden" name="status" value="<?php echo $status; ?>" > + <input type="hidden" name="status" value="<?php echo $_REQUEST['status']; ?>" > <table class="list" border="0" cellspacing="1" cellpadding="2" width="940"> <caption><?php echo $showing; ?> <?php echo $results_type; ?></caption> <thead> @@ -470,6 +473,11 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting.. <input class="button" type="submit" name="close" value="Close"> <?php break; + case 'overdue': + ?> + <input class="button" type="submit" name="close" value="Close"> + <?php + break; default: //search?? ?> <input class="button" type="submit" name="close" value="Close" > diff --git a/include/upgrader/upgrade.inc.php b/include/upgrader/upgrade.inc.php index 7c8a8aae47e692d9337a51c46a46f2114c4a2848..fae6947d94849c6cfbd4a7df849df708e470f1de 100644 --- a/include/upgrader/upgrade.inc.php +++ b/include/upgrader/upgrade.inc.php @@ -32,7 +32,7 @@ $action=$upgrader->getNextAction(); <p>3. We can help, feel free to <a href="http://osticket.com/support/" target="_blank">contact us </a> for professional help.</p> </div> <div class="clear"></div> - <div id="loading"> + <div id="upgrading"> <h4><?php echo $action; ?></h4> Please wait... while we upgrade your osTicket installation! <div id="msg" style="font-weight: bold;padding-top:10px;">Smile!</div> diff --git a/scp/admin.inc.php b/scp/admin.inc.php index 8a41c54db7f690b3caec9ee7728345bba1570000..66fca5d976bb3b9c4a76eed99b71657ab28f0d64 100644 --- a/scp/admin.inc.php +++ b/scp/admin.inc.php @@ -25,6 +25,7 @@ define('OSTADMININC',TRUE); //checked by admin include files define('ADMINPAGE',TRUE); //Used by the header to swap menus. //Some security related warnings - bitch until fixed!!! :) +$sysnotice= ''; if($ost->isUpgradePending()) { $errors['err']=$sysnotice='System upgrade is pending <a href="upgrade.php">Upgrade Now</a>'; if(!in_array(basename($_SERVER['SCRIPT_NAME']), array('upgrade.php', 'logs.php'))) { @@ -57,6 +58,9 @@ if($ost->isUpgradePending()) { $sysnotice='Please consider turning off register globals if possible'; } +//System notice displayed as a warning (if any). +$ost->setWarning($sysnotice); + //Admin navigation - overwrites what was set in staff.inc.php $nav = new AdminNav($thisstaff); diff --git a/scp/css/scp.css b/scp/css/scp.css index 67e6212512c0bf617d934fbf1feabd369784fd80..04bd90d604e5a6265b159e49279792db58fbe4ef 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -43,12 +43,18 @@ a { color: #555; } -#msg_notice { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; margin-bottom: 10px; border: 1px solid #0a0; background: url('../images/icons/ok.png?1300763726') 10px 50% no-repeat #e0ffe0; } +#msg_notice { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; margin-bottom: 10px; border: 1px solid #0a0; background: url('../images/icons/ok.png') 10px 50% no-repeat #e0ffe0; } -#msg_warning { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; margin-bottom: 10px; border: 1px solid #f26522; background: url('../images/icons/alert.png?1307823786') 10px 50% no-repeat #ffffdd; } +#msg_warning { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; margin-bottom: 10px; border: 1px solid #f26522; background: url('../images/icons/alert.png') 10px 50% no-repeat #ffffdd; } #msg_error { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; margin-bottom: 10px; border: 1px solid #a00; background: url('../images/icons/error.png') 10px 50% no-repeat #fff0f0; } +#notice_bar { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; border: 1px solid #0a0; background: url('../images/icons/ok.png') 10px 50% no-repeat #e0ffe0; } + +#warning_bar { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; border: 1px solid #f26522; background: url('../images/icons/alert.png') 10px 50% no-repeat #ffffdd; } + +#error_bar { margin: 0; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; border: 1px solid #a00; background: url('../images/icons/error.png') 10px 50% no-repeat #fff0f0; } + #container { width:960px; @@ -1373,8 +1379,28 @@ ul.progress li.no small {color:red;} #bar.error { background: #ffd; text-align: center; color: #a00; font-weight: bold; } /* Overlay */ -#overlay { display: none; position: fixed; background: #000; z-index: 1000; } +#overlay { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: #000; + z-index: 1000; + -webkit-transform: translate3d(0,0,0); +} + +#loading, #upgrading { + border:1px solid #2a67ac; + padding: 10px 10px 10px 60px; + width: 300px; + height: 100px; + background: rgb( 255, 255, 255) url('../images/FhHRx-Spinner.gif') 10px 50% no-repeat; + position: fixed; + display: none; + z-index: 3000; +} -#loading { padding: 10px 10px 10px 60px; width: 300px; height: 100px; background: url('../images/ajax-loader.gif?1312925608') 10px 50% no-repeat white; position: fixed; display: none; z-index: 3000; } -#loading h4 { margin: 3px 0 0 0; padding: 0; color: #d80; } +#loading h4, #upgrading h4 { margin: 3px 0 0 0; padding: 0; color: #d80; } diff --git a/scp/emailtest.php b/scp/emailtest.php index 0ca1d7308cc8c62f0f9852a57f45d4e8802e805a..b39e5c7edaf82004217ad39f6c9bf8fe6b99e995 100644 --- a/scp/emailtest.php +++ b/scp/emailtest.php @@ -47,7 +47,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); $nav->setTabActive('emails'); require(STAFFINC_DIR.'header.inc.php'); ?> -<form action="emailtest.php" method="post" id="emailtest"> +<form action="emailtest.php" method="post" id="save"> <?php csrf_token(); ?> <input type="hidden" name="do" value="<?php echo $action; ?>"> <h2>Test Outgoing Email</h2> diff --git a/scp/images/FhHRx-Spinner.gif b/scp/images/FhHRx-Spinner.gif new file mode 100644 index 0000000000000000000000000000000000000000..574b1d4a161707c6c7f0ba9d2bc531bead4a3028 Binary files /dev/null and b/scp/images/FhHRx-Spinner.gif differ diff --git a/scp/js/scp.js b/scp/js/scp.js index 71d0e69a823e0869f38ec3e9a5562bec296a7baa..cf32e42d8b638ff1b465cb23eb9a196e72be31ba 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -103,6 +103,14 @@ $(document).ready(function(){ return false; }); + $(window).scroll(function () { + + $('.dialog').css({ + top : (($(this).height() /5)+$(this).scrollTop()), + left : ($(this).width() / 2 - 300) + }); + }); + if($.browser.msie) { $('.inactive').mouseenter(function() { var elem = $(this); @@ -137,9 +145,9 @@ $(document).ready(function(){ } }); - $('form#save').submit(function() { + $('form#save, form:has(table.list)').submit(function() { $(window).unbind('beforeunload'); - + $('#overlay, #loading').show(); return true; }); @@ -316,9 +324,7 @@ $(document).ready(function(){ $('#overlay').css({ opacity : 0.3, top : 0, - left : 0, - width : $(window).width(), - height : $(window).height() + left : 0 }); //Dialog @@ -341,6 +347,12 @@ $(document).ready(function(){ left : ($(window).width() / 2 - 300) }); + /* loading ... */ + $("#loading").css({ + top : ($(window).height() / 3), + left : ($(window).width() / 2 - 160) + }); + $('#go-advanced').click(function(e) { e.preventDefault(); $('#result-count').html(''); diff --git a/scp/js/upgrader.js b/scp/js/upgrader.js index 09bde7766c6f39e9f95e0b50ccf3c0efc3bbb2fb..8fe378193842494d7bed4df290828e05e091a263 100644 --- a/scp/js/upgrader.js +++ b/scp/js/upgrader.js @@ -17,7 +17,7 @@ jQuery(function($) { e.preventDefault(); var form = $(this); $('input[type=submit]', this).attr('disabled', 'disabled'); - $('#overlay, #loading').show(); + $('#overlay, #upgrading').show(); doTasks('upgrade.php',form.serialize()); return false; diff --git a/scp/staff.inc.php b/scp/staff.inc.php index 8553a8bac1fef78482532de7789723af43e6c20d..8a91e4774803886deed8abce8e62bab01ffaff87 100644 --- a/scp/staff.inc.php +++ b/scp/staff.inc.php @@ -119,10 +119,11 @@ $nav = new StaffNav($thisstaff); if($thisstaff->forcePasswdChange() && !$exempt) { # XXX: Call staffLoginPage() for AJAX and API requests _not_ to honor # the request + $sysnotice = 'Password change required to continue'; require('profile.php'); //profile.php must request this file as require_once to avoid problems. exit; } - +$ost->setWarning($sysnotice); $ost->setPageTitle('osTicket :: Staff Control Panel'); ?> diff --git a/scp/tickets.php b/scp/tickets.php index fd30b899ee8417b63c839942e7cbb00257284a16..cf033aa86c47bc7ca976afb03f73f03ad55c88d8 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -346,7 +346,7 @@ if($_POST && !$errors): foreach($_POST['tids'] as $k=>$v) { if(($t=Ticket::lookup($v)) && $t->isClosed() && @$t->reopen()) { $i++; - $t->logNote('Ticket Reopened', $note); + $t->logNote('Ticket Reopened', $note, $thisstaff); } } @@ -366,7 +366,7 @@ if($_POST && !$errors): foreach($_POST['tids'] as $k=>$v) { if(($t=Ticket::lookup($v)) && $t->isOpen() && @$t->close()) { $i++; - $t->logNote('Ticket Closed', $note); + $t->logNote('Ticket Closed', $note, $thisstaff); } } @@ -385,7 +385,7 @@ if($_POST && !$errors): foreach($_POST['tids'] as $k=>$v) { if(($t=Ticket::lookup($v)) && !$t->isOverdue() && $t->markOverdue()) { $i++; - $t->logNote('Ticket Marked Overdue', $note); + $t->logNote('Ticket Marked Overdue', $note, $thisstaff); } } @@ -475,8 +475,8 @@ if($cfg->showAnsweredTickets()) { } if($stats['assigned']) { - if(!$sysnotice && $stats['assigned']>10) - $sysnotice=$stats['assigned'].' assigned to you!'; + if(!$ost->getWarning() && $stats['assigned']>3) + $ost->setWarning($stats['assigned'].' tickets assigned to you! Do something about it!'); $nav->addSubMenu(array('desc'=>'My Tickets ('.$stats['assigned'].')', 'title'=>'Assigned Tickets', diff --git a/setup/inc/class.installer.php b/setup/inc/class.installer.php index 2d284ecedca1e48b25a2fdfd25ad912ec449912a..f355fbe04cf8a55aaa50bac9e9672131b3c3354a 100644 --- a/setup/inc/class.installer.php +++ b/setup/inc/class.installer.php @@ -89,6 +89,13 @@ class Installer extends SetupWizard { $this->errors['db']='Unable to create the database.'; } elseif(!db_select_database($vars['dbname'])) { $this->errors['dbname']='Unable to select the database'; + } else { + //Abort if we have another installation (or table) with same prefix. + $sql = 'SELECT * FROM `'.$vars['prefix'].'config` LIMIT 1'; + if(mysql_query($sql)) { + $this->errors['err'] = 'We have a problem - another installation with same table prefix exists!'; + $this->errors['prefix'] = 'Prefix already in-use'; + } } } diff --git a/setup/inc/file-perm.inc.php b/setup/inc/file-perm.inc.php index 7f93a302c266cabeb4a466e3f3951e14b508c90e..6a158082ddecadbb7552f52f43503cf29f7ac3bb 100644 --- a/setup/inc/file-perm.inc.php +++ b/setup/inc/file-perm.inc.php @@ -9,9 +9,9 @@ if(!defined('SETUPINC')) die('Kwaheri!'); </p> </div> <h3>Solution: <font color="red"><?php echo $errors['err']; ?></font></h3> - Please follow the instructions below to give read and write access to the web server. + Please follow the instructions below to give read and write access to the web server user. <ul> - <li><b>CLI</b>:<br><i>chmod 0777 include/ost-config.php</i></li> + <li><b>CLI</b>:<br><i>chmod 0666 include/ost-config.php</i></li> <li><b>FTP</b>:<br>Using WS_FTP this would be right hand clicking on the fil, selecting chmod, and then giving all permissions to the file.</li> <li><b>Cpanel</b>:<br>Click on the file, select change permission, and then giving all permissions to the file.</li> </ul> diff --git a/setup/inc/file-unclean.inc.php b/setup/inc/file-unclean.inc.php index 309fad10bc150d3beac23c937df1ebd448d42238..3c194b60ac2f078ecaef85cb3811ac9ed0741a6d 100644 --- a/setup/inc/file-unclean.inc.php +++ b/setup/inc/file-unclean.inc.php @@ -4,7 +4,7 @@ if(!defined('SETUPINC')) die('Kwaheri!'); <div id="main"> <h1 style="color:#FF7700;">osTicket is already installed?</h1> <div id="intro"> - <p>Configuration file already changed - which could mean osTicket is already installed or the config file is currupted. If you are trying to upgrade osTicket, then go to <a href="../scp/" >Admin Panel</a>.</p> + <p>Configuration file already changed - which could mean osTicket is already installed or the config file is currupted. If you are trying to upgrade osTicket, then go to <a href="../scp/admin.php" >Admin Panel</a>.</p> <p>If you believe this is in error, please try replacing the config file with a unchanged template copy and try again or get technical help.</p> <p>Refer to the <a target="_blank" href="http://osticket.com/wiki/Installation">Installation Guide</a> on the wiki for more information.</p> diff --git a/setup/inc/install.inc.php b/setup/inc/install.inc.php index 7f050baef479582a393d41e452b0adb3e42b4b8b..cb5f2d82bfd15b2fcb9e95087b443844d0f3a02a 100644 --- a/setup/inc/install.inc.php +++ b/setup/inc/install.inc.php @@ -16,13 +16,13 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):array('prefix'=>'ost_','dbho </div> <div class="row"> <label>Helpdesk Name:</label> - <input type="text" name="name" size="30" tabindex="1" value="<?php echo $info['name']; ?>"> + <input type="text" name="name" size="45" tabindex="1" value="<?php echo $info['name']; ?>"> <a class="tip" href="#t1">?</a> <font class="error"><?php echo $errors['name']; ?></font> </div> <div class="row"> <label>Default Email:</label> - <input type="text" name="email" size="30" tabindex="2" value="<?php echo $info['email']; ?>"> + <input type="text" name="email" size="45" tabindex="2" value="<?php echo $info['email']; ?>"> <a class="tip" href="#t2">?</a> <font class="error"><?php echo $errors['email']; ?></font> </div> @@ -31,37 +31,37 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):array('prefix'=>'ost_','dbho <span class="subhead">Your primary administrator account - you can add more users later.</span> <div class="row"> <label>First Name:</label> - <input type="text" name="fname" size="30" tabindex="3" value="<?php echo $info['fname']; ?>"> + <input type="text" name="fname" size="45" tabindex="3" value="<?php echo $info['fname']; ?>"> <a class="tip" href="#t3">?</a> <font class="error"><?php echo $errors['fname']; ?></font> </div> <div class="row"> <label>Last Name:</label> - <input type="text" name="lname" size="30" tabindex="4" value="<?php echo $info['lname']; ?>"> + <input type="text" name="lname" size="45" tabindex="4" value="<?php echo $info['lname']; ?>"> <a class="tip" href="#t4">?</a> <font class="error"><?php echo $errors['lname']; ?></font> </div> <div class="row"> <label>Email Address:</label> - <input type="text" name="admin_email" size="30" tabindex="5" value="<?php echo $info['admin_email']; ?>"> + <input type="text" name="admin_email" size="45" tabindex="5" value="<?php echo $info['admin_email']; ?>"> <a class="tip" href="#t5">?</a> <font class="error"><?php echo $errors['admin_email']; ?></font> </div> <div class="row"> <label>Username:</label> - <input type="text" name="username" size="30" tabindex="6" value="<?php echo $info['username']; ?>" autocomplete="off"> + <input type="text" name="username" size="45" tabindex="6" value="<?php echo $info['username']; ?>" autocomplete="off"> <a class="tip" href="#t6">?</a> <font class="error"><?php echo $errors['username']; ?></font> </div> <div class="row"> <label> Password:</label> - <input type="password" name="passwd" size="30" tabindex="7" value="<?php echo $info['passwd']; ?>" autocomplete="off"> + <input type="password" name="passwd" size="45" tabindex="7" value="<?php echo $info['passwd']; ?>" autocomplete="off"> <a class="tip" href="#t7">?</a> <font class="error"><?php echo $errors['passwd']; ?></font> </div> <div class="row"> <label>Retype Password:</label> - <input type="password" name="passwd2" size="30" tabindex="8" value="<?php echo $info['passwd2']; ?>"> + <input type="password" name="passwd2" size="45" tabindex="8" value="<?php echo $info['passwd2']; ?>"> <a class="tip" href="#t8">?</a> <font class="error"><?php echo $errors['passwd2']; ?></font> </div> @@ -70,31 +70,31 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):array('prefix'=>'ost_','dbho <span class="subhead">Database connection information <font class="error"><?php echo $errors['db']; ?></font></span> <div class="row"> <label>MySQL Table Prefix:</label> - <input type="text" name="prefix" size="30" tabindex="9" value="<?php echo $info['prefix']; ?>"> + <input type="text" name="prefix" size="45" tabindex="9" value="<?php echo $info['prefix']; ?>"> <a class="tip" href="#t9">?</a> <font class="error"><?php echo $errors['prefix']; ?></font> </div> <div class="row"> <label>MySQL Hostname:</label> - <input type="text" name="dbhost" size="30" tabindex="10" value="<?php echo $info['dbhost']; ?>"> + <input type="text" name="dbhost" size="45" tabindex="10" value="<?php echo $info['dbhost']; ?>"> <a class="tip" href="#t10">?</a> <font class="error"><?php echo $errors['dbhost']; ?></font> </div> <div class="row"> <label>MySQL Database:</label> - <input type="text" name="dbname" size="30" tabindex="11" value="<?php echo $info['dbname']; ?>"> + <input type="text" name="dbname" size="45" tabindex="11" value="<?php echo $info['dbname']; ?>"> <a class="tip" href="#t11">?</a> <font class="error"><?php echo $errors['dbname']; ?></font> </div> <div class="row"> <label>MySQL Username:</label> - <input type="text" name="dbuser" size="30" tabindex="12" value="<?php echo $info['dbuser']; ?>"> + <input type="text" name="dbuser" size="45" tabindex="12" value="<?php echo $info['dbuser']; ?>"> <a class="tip" href="#t12">?</a> <font class="error"><?php echo $errors['dbuser']; ?></font> </div> <div class="row"> <label>MySQL Password:</label> - <input type="password" name="dbpass" size="30" tabindex="13" value="<?php echo $info['dbpass']; ?>"> + <input type="password" name="dbpass" size="45" tabindex="13" value="<?php echo $info['dbpass']; ?>"> <a class="tip" href="#t13">?</a> <font class="error"><?php echo $errors['dbpass']; ?></font> </div> diff --git a/setup/install.php b/setup/install.php index d019598e55de7099c9dbb517b4a9aa1663886ad0..5f590da1c915d1c2c794e8363b41abb8a5bb3afa 100644 --- a/setup/install.php +++ b/setup/install.php @@ -80,7 +80,6 @@ if($_POST && $_POST['s']) { $_SESSION['ost_installer']['s']='done'; } - switch(strtolower($_SESSION['ost_installer']['s'])) { case 'config': case 'install': @@ -105,7 +104,11 @@ switch(strtolower($_SESSION['ost_installer']['s'])) { $inc='install-prereq.inc.php'; break; default: - $inc='install-prereq.inc.php'; + //Fail IF any of the old config files exists. + if(file_exists(INCLUDE_DIR.'settings.php') || file_exists(ROOT_DIR.'ostconfig.php')) + $inc='file-unclean.inc.php'; + else + $inc='install-prereq.inc.php'; } require(INC_DIR.'header.inc.php');