diff --git a/include/class.file.php b/include/class.file.php index e5a3db128fd69ba4c5b1fb8dc79492144fdb9c0d..84689f02011afd73cb2871582adb43aa5f3c07cb 100644 --- a/include/class.file.php +++ b/include/class.file.php @@ -363,13 +363,18 @@ class AttachmentFile { // otherwise. $succeeded = false; foreach ($bks as $bk) { - if (isset($file['tmp_name'])) { - if ($bk->upload($file['tmp_name'])) { + try { + if (isset($file['tmp_name'])) { + if ($bk->upload($file['tmp_name'])) { + $succeeded = true; break; + } + } + elseif ($bk->write($file['data']) && $bk->flush()) { $succeeded = true; break; } } - elseif ($bk->write($file['data']) && $bk->flush()) { - $succeeded = true; break; + catch (Exception $e) { + // Try next backend } // Fallthrough to default backend if different? } @@ -418,11 +423,17 @@ class AttachmentFile { // TODO: Make this resumable so that if the file cannot be migrated // in the max_execution_time, the migration can be continued // the next time the cron runs - while ($block = $source->read($target->getBlockSize())) { - hash_update($before, $block); - $target->write($block); + try { + while ($block = $source->read($target->getBlockSize())) { + hash_update($before, $block); + $target->write($block); + } + $target->flush(); + } + catch (Exception $e) { + // Migration failed + return false; } - $target->flush(); // Ask the backend to generate its own hash if at all possible if (!($target_hash = $target->getHashDigest($common_algo))) { diff --git a/include/class.thread.php b/include/class.thread.php index dcb4ec2afd8144c1c3bf06f3d95592b035a513f3..9ab7958e775436837571fb33f0c8e50e7d8e8eff 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -1064,7 +1064,7 @@ Class ThreadEntry { // content-id will be discarded, only the unique hash-code // will be available to retrieve the image later if ($a['cid'] && $a['key']) { - $body = preg_replace('/src=("|\'|\b)cid:'.$a['cid'].'\1/i', + $body = preg_replace('/src=("|\'|\b)(?:cid:)?'.$a['cid'].'\1/i', 'src="cid:'.$a['key'].'"', $body); } } diff --git a/include/client/view.inc.php b/include/client/view.inc.php index deaa097d9a92692728e0fe5fb3eddb49b2a27581..90897fd8a652399e0c75384125612b2c3a63d896 100644 --- a/include/client/view.inc.php +++ b/include/client/view.inc.php @@ -25,7 +25,7 @@ if ($thisclient && $thisclient->isGuest() <td colspan="2" width="100%"> <h1> Ticket #<?php echo $ticket->getNumber(); ?> - <a href="view.php?id=<?php echo $ticket->getId(); ?>" title="Reload"><span class="Icon refresh"> </span></a> + <a href="tickets.php?id=<?php echo $ticket->getId(); ?>" title="Reload"><span class="Icon refresh"> </span></a> <?php if ($cfg->allowClientUpdates()) { ?> <a class="action-button" href="tickets.php?a=edit&id=<?php echo $ticket->getId(); ?>"><i class="icon-edit"></i> Edit</a> diff --git a/view.php b/view.php index abf7d805ac5acf5f82353ab66201ac787c9357bf..7e865d6a6bd3544ea3c3dbdd9f8aaafababf1839 100644 --- a/view.php +++ b/view.php @@ -19,7 +19,10 @@ require_once('client.inc.php'); // Try autologin the user // Authenticated user can be of type ticket owner or collaborator $errors = array(); -$user = UserAuthenticationBackend::processSignOn($errors, false); +if (isset($_GET['auth']) || isset($_GET['t'])) + // TODO: Consider receiving an AccessDenied object + $user = UserAuthenticationBackend::processSignOn($errors, false); + if ($user && $user->getTicketId()) Http::redirect('tickets.php?id='.$user->getTicketId());