diff --git a/include/class.attachment.php b/include/class.attachment.php index 262486c2977a854d34d9b96cb77c1439f9fe5d49..b787ee25093c3a5b6fcb23cfef08e054c45e50e7 100644 --- a/include/class.attachment.php +++ b/include/class.attachment.php @@ -175,9 +175,9 @@ extends InstrumentedList { function _getList($separates=false, $inlines=false, $lang=false) { $base = $this; - if ($separates && !$inline) + if ($separates && !$inlines) $base = $base->filter(array('inline' => 0)); - elseif (!$separates && $inline) + elseif (!$separates && $inlines) $base = $base->filter(array('inline' => 1)); if ($lang) diff --git a/include/class.config.php b/include/class.config.php index 39d63cebf469558a5b8786f0bce844dba304687d..406e0e8952e2efe2c1683b7c6ca2333701c0efb8 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -246,7 +246,7 @@ class OsticketConfig extends Config { return md5(self::getDBVersion()); } - function getDBTimezone() { + function getDbTimezone() { if (!$this->exists('db_timezone')) { require_once INCLUDE_DIR . 'class.timezone.php'; $this->persist('db_timezone', DbTimezone::determine()); diff --git a/include/class.forms.php b/include/class.forms.php index bc29a836d9744293acb0e597380fdc554dc30fb4..a3dc7579634996b2da6d1837bdd4e31b3faf42f4 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -3078,7 +3078,7 @@ class FileUploadWidget extends Widget { $new = array_fill_keys($this->field->getClean(), 1); foreach ($attachments as $f) { $F[] = $f->file; - unset($new[$file->id]); + unset($new[$f->id]); } // Add in newly added files not yet saved (if redisplaying after an // error) diff --git a/include/class.thread.php b/include/class.thread.php index 6204bf39beee89c930db77da8e415487b5ad6bfb..4e75673662f726096e7af968dd4e3bd0903e1d3f 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -1601,12 +1601,12 @@ class ThreadEvent extends VerySimpleModel { switch ($m['key']) { case 'assignees': $assignees = array(); - if ($S = $this->staff) { + if ($S = $self->staff) { $url = $S->get_gravatar(16); $assignees[] = "<img class=\"avatar\" src=\"{$url}\"> ".$S->getName(); } - if ($T = $this->team) { + if ($T = $self->team) { $assignees[] = $T->getLocalName(); } return implode('/', $assignees); @@ -1622,12 +1622,14 @@ class ThreadEvent extends VerySimpleModel { Format::relativeTime(Misc::db2gmtime($self->timestamp)) ); case 'agent': - $st = $this->agent; + $name = $self->agent->getName(); if ($url = $self->getAvatar()) $name = "<img class=\"avatar\" src=\"{$url}\"> ".$name; + return $name; case 'dept': - if ($dept = $this->getDept()) + if ($dept = $self->getDept()) return $dept->getLocalName(); + return __('None'); case 'data': $val = $self->getData($m['data']); if ($m['type'] && class_exists($m['type'])) @@ -1696,6 +1698,8 @@ class ThreadEvents extends InstrumentedList { } function log($object, $state, $data=null, $annul=null, $username=null) { + global $thisstaff, $thisclient; + if ($object instanceof Ticket) $event = ThreadEvent::forTicket($object, $state); else diff --git a/include/class.timezone.php b/include/class.timezone.php index 7ccd3b3d99bef49a8af8070a6c32a8ca44e8e6d2..678db27860f53a771134e0d2393e56c81792bff6 100644 --- a/include/class.timezone.php +++ b/include/class.timezone.php @@ -147,7 +147,7 @@ class DbTimezone { } function lookup_key() { - list($january_offset, $juneoffset) = + list($january_offset, $june_offset) = $this->get_date_offset( mktime(0, 0, 0, 1, 2, self::BASELINE_YEAR), mktime(0, 0, 0, 6, 2, self::BASELINE_YEAR)); @@ -180,7 +180,7 @@ class DbTimezone { $yearstart = mktime(0, 0, 1, 1, 1, $year); $yearend = mktime(23, 59, 59, 12, 31, $year); $current = $yearstart; - list($offset) = $this->get_date_offset($current); + list($date_offset) = $this->get_date_offset($current); $dst_start = null; $dst_end = null; @@ -190,18 +190,17 @@ class DbTimezone { $current += 86400; } - foreach ($this->get_date_offset($checks) as $offset) { - - if ($dateToCheckOffset !== $offset) { - if ($dateToCheckOffset < $offset) { - $dst_start = $dateToCheck; + foreach ($this->get_date_offset($checks) as $i=>$offset) { + if ($offset !== $date_offset) { + if ($offset < $date_offset) { + $dst_start = $checks[$i]; } - if ($dateToCheckOffset > $offset) { - $dst_end = $dateToCheck; + if ($offset > $date_offset) { + $dst_end = $checks[$i]; } - $offset = $dateToCheckOffset; } } + // $offset will remain the last item in ::get_date_offset($checks) if ($dst_start && $dst_end) { return array( @@ -216,7 +215,7 @@ class DbTimezone { function find_dst_fold($a_date, $padding=self::DAY, $iterator=self::HOUR) { $date_start = $a_date - $padding; $date_end = $a_date + $padding; - list($offset) = $this->get_date_offset($date_start); + list($date_offset) = $this->get_date_offset($date_start); $current = $date_start; @@ -228,9 +227,9 @@ class DbTimezone { $current += $iterator; } - foreach ($this->get_date_offset($checks) as $offset) { - if ($dateToCheckOffset !== $offset) { - $dst_change = $dateToCheck; + foreach ($this->get_date_offset($checks) as $i=>$offset) { + if ($offset !== $date_offset) { + $dst_change = $checks[$i]; break; } } @@ -249,7 +248,7 @@ class DbTimezone { return $dst_change; } - function windows7_adaptions($rule_list, $preliminary_timezone, $score, $sample) { + function windows7_adaptations($rule_list, $preliminary_timezone, $score, $sample) { if ($score !== 'N/A') { return $score; } @@ -294,7 +293,7 @@ class DbTimezone { function best_dst_match($rule_list, $preliminary_timezone) { $self = $this; - $score_sample = function ($sample) use ($rule_list, $self) { + $score_sample = function ($sample) use ($rule_list, $self, $preliminary_timezone) { $score = 0; for ($j = 0; $j < count($rule_list); $j++) { diff --git a/include/html2text.php b/include/html2text.php index 8da0755fc90297d10ed076ede0f5eae10503691a..2863e10524cac3e7d500ad5e6b9710c5eb0db21e 100644 --- a/include/html2text.php +++ b/include/html2text.php @@ -1020,6 +1020,7 @@ function mb_wordwrap($string, $width=75, $break="\n", $cut=false) { // Thanks http://www.php.net/manual/en/ref.mbstring.php#90611 function mb_str_pad($input, $pad_length, $pad_string=" ", $pad_style=STR_PAD_RIGHT) { + $match = array(); $marks = preg_match_all('/\p{M}/u', $input, $match); return str_pad($input, strlen($input)-mb_strwidth($input)+$marks+$pad_length, $pad_string,