Skip to content

Commit

Permalink
Merge branch 'issue245-revision-view'
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlawrence committed Jan 28, 2016
2 parents 24c1319 + 6e03c22 commit 86e55fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions history.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<th valign=top align=right><?php echo msg('historypage_revision');
?></th><td>
<div id="revision_current">
<?php
<?php
if (isset($revision_id)) {
if ($revision_id == 0) {
echo msg('historypage_original_revision');
Expand Down Expand Up @@ -241,7 +241,7 @@

$extra_message = '';
if (is_file($GLOBALS['CONFIG']['revisionDir'] . $id . '/' . $id . "_$revision.dat")) {
echo '<td align=center><font size="-1"> <a href="details.php?id=' . e::h($id) . '_' . e::h($revision) . '&state=' . (e::h($_REQUEST['state'] - 1)) . '"><div class="revision">' . e::h(($revision + 1)) . '</div></a>' . e::h($extra_message);
echo '<td align=center><font size="-1"> <a href="details.php?id=' . e::h($id) . '_' . e::h($revision) . '&state=' . (e::h($_REQUEST['state'])) . '"><div class="revision">' . e::h(($revision + 1)) . '</div></a>' . e::h($extra_message);
} else {
echo '<td><font size="-1">' . e::h($revision) . e::h($extra_message);
}
Expand Down
14 changes: 10 additions & 4 deletions view_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@
$prefix = (substr($realname, 0, (strrpos($realname, "."))));
$suffix = strtolower((substr($realname, ((strrpos($realname, ".")+1)))));
}


// If we have a revision ID lets use the original
// request id that included the file id and revision number (ex. 1_0)
if (isset($revision_id)) {
$file_id = $request_id;
}

$mimetype = File::mime_by_ext($suffix);

$GLOBALS['smarty']->assign('mimetype', $mimetype);
Expand Down Expand Up @@ -93,12 +99,12 @@
}
} elseif ($_GET['submit'] == 'Download') {
$file_obj = new FileData($_REQUEST['id'], $pdo);

// Added this check to keep unauthorized users from downloading - Thanks to Chad Bloomquist
checkUserPermission($_REQUEST['id'], $file_obj->READ_RIGHT, $file_obj);

$realname = $file_obj->getName();

if (isset($revision_id)) {
$filename = $revision_dir . $request_id . ".dat";
} elseif ($file_obj->isArchived()) {
Expand Down

0 comments on commit 86e55fe

Please sign in to comment.