diff --git a/include/class.migrater.php b/include/class.migrater.php index 4cc096be5533121c4ebb30aa9974438de993ad7d..93854d797d72c150f71dc13a30831509ee9665c7 100644 --- a/include/class.migrater.php +++ b/include/class.migrater.php @@ -3,7 +3,7 @@ class.migrater.php Migration utils required by upgrader. - + Jared Hancock <jared@osticket.com> Copyright (c) 2006-2013 osTicket http://www.osticket.com @@ -34,11 +34,11 @@ class DatabaseMigrater { var $sqldir; function DatabaseMigrater($start, $end, $sqldir) { - + $this->start = $start; $this->end = $end; $this->sqldir = $sqldir; - + } function getPatches($stop=null) { @@ -50,14 +50,13 @@ class DatabaseMigrater { while (true) { $next = glob($this->sqldir . substr($start, 0, 8) . '-*.patch.sql'); - if (count($next) == 1) { + if(!$next || empty($next)) { + # No patches leaving the current signature. + # Assume that we've applied all the available patches + break; + } elseif (count($next) == 1) { $patches[] = $next[0]; $start = substr(basename($next[0]), 9, 8); - } elseif (count($next) == 0) { - # There are no patches leaving the current signature. We - # have to assume that we've applied all the available - # patches. - break; } else { # Problem -- more than one patch exists from this snapshot. # We probably need a graph approach to solve this. @@ -69,7 +68,7 @@ class DatabaseMigrater { break; } - return $patches; + return array_filter($patches); } } @@ -159,7 +158,7 @@ class AttachmentMigrater { } # Get the mime/type of each file # XXX: Use finfo_buffer for PHP 5.3+ - if(function_exists('mime_content_type')) { + if(function_exists('mime_content_type')) { //XXX: function depreciated in newer versions of PHP!!!!! $info['type'] = mime_content_type($info['path']); } elseif (function_exists('finfo_file')) { // PHP 5.3.0+ @@ -193,7 +192,7 @@ class AttachmentMigrater { /* static */ function queueAttachments($limit=0){ global $cfg, $ost; - # Since the queue is persistent - we want to make sure we get to empty + # Since the queue is persistent - we want to make sure we get to empty # before we find more attachments. if(($qc=$this->getQueueLength())) return $qc; @@ -231,9 +230,9 @@ class AttachmentMigrater { ); $filename15=sprintf("%s/%s_%s",rtrim($dir,'/'),$key,$name); $filename16=sprintf("%s/%s/%s_%s",rtrim($dir,'/'),$month,$key,$name); //new destination. - if (file_exists($filename15)) { + if (file_exists($filename15)) { $info['path'] = $filename15; - } elseif (file_exists($filename16)) { + } elseif (file_exists($filename16)) { $info['path'] = $filename16; } else { # XXX Cannot find file for attachment diff --git a/include/class.ticket.php b/include/class.ticket.php index 21a4bd8f1777e100d839dedaf44525c61455f381..60d26d7eb31ba73f5b176a47168314d4bf166f6f 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1549,8 +1549,11 @@ class Ticket { $attachments = $note->getAttachments(); $sentlist=array(); foreach( $recipients as $k=>$staff) { - if(!$staff || !is_object($staff) || !$staff->getEmail() || !$staff->isAvailable()) continue; - if(in_array($staff->getEmail(), $sentlist) || ($staffId && $staffId==$staff->getId())) continue; + if(!is_object($staff) + || !$staff->isAvailable() //Don't bother vacationing staff. + || in_array($staff->getEmail(), $sentlist) //No duplicates. + || $note->getStaffId() == $staff->getId()) //No need to alert the poster! + continue; $alert = str_replace('%{recipient}', $staff->getFirstName(), $msg['body']); $email->sendAlert($staff->getEmail(), $msg['subj'], $alert, $attachments); $sentlist[] = $staff->getEmail(); diff --git a/setup/scripts/rcron.php b/setup/scripts/rcron.php index 53c2da007f91ab84007afcc20409b32a8da822ed..a15a152ec910104d157faa2b9ab6971a1b7361bd 100755 --- a/setup/scripts/rcron.php +++ b/setup/scripts/rcron.php @@ -16,12 +16,12 @@ **********************************************************************/ # Configuration: Enter the url and key. That is it. -# url => URL to api/task/cron e.g http://yourdomain.com/support/api/task/cron +# url => URL to api/task/cron e.g http://yourdomain.com/support/api/tasks/cron # key => API's Key (see admin panel on how to generate a key) # $config = array( - 'url'=>'http://yourdomain.com/support/api/task/cron', + 'url'=>'http://yourdomain.com/support/api/tasks/cron', 'key'=>'API KEY HERE' ); @@ -32,8 +32,8 @@ function_exists('curl_version') or die('CURL support required'); set_time_limit(30); #curl post -$ch = curl_init(); -curl_setopt($ch, CURLOPT_URL, $config['url']); +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, $config['url']); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, ''); curl_setopt($ch, CURLOPT_USERAGENT, 'osTicket API Client v1.7'); @@ -41,7 +41,7 @@ curl_setopt($ch, CURLOPT_HEADER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Expect:', 'X-API-Key: '.$config['key'])); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); -$result=curl_exec($ch); +$result=curl_exec($ch); curl_close($ch); if(preg_match('/HTTP\/.* ([0-9]+) .*/', $result, $status) && $status[1] == 200)