diff options
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/file/folder.php | 56 | ||||
-rw-r--r-- | tpl/file/index.php | 61 | ||||
-rw-r--r-- | tpl/file/upload-ok.php (renamed from tpl/image/upload-ok.php) | 8 | ||||
-rw-r--r-- | tpl/file/upload.php (renamed from tpl/image/upload.php) | 8 | ||||
-rw-r--r-- | tpl/general/top.php | 6 | ||||
-rw-r--r-- | tpl/image/folder.php | 52 | ||||
-rw-r--r-- | tpl/image/index.php | 55 |
7 files changed, 128 insertions, 118 deletions
diff --git a/tpl/file/folder.php b/tpl/file/folder.php new file mode 100644 index 0000000..d7ebd73 --- /dev/null +++ b/tpl/file/folder.php @@ -0,0 +1,56 @@ +<?php +require("tpl/general/top.php"); + +if ($can_edit) { + echo '<div class="small_right"><a href="editfld-file-' . $fldid . '">edit folder info</a> | '; + echo '<a href="delfld-file-' . $fldid . '">delete folder</a></div>'; +} + +echo $fld['comment_html']; + +if (count($files) == 0) { + echo '<div class="message">This folder has no files.</div>'; +} else { + echo '<div class="ordering_links">' . filters_html_full() . '</div>'; + echo '<table><tr><th width="' . ($img_mini_width) . 'px"></th><th>Info</th><th>Date</th></tr>'; + foreach ($files as $fl) { + $min = $baseurl . $fl['id'] . "-min." . $fl['extension']; + $flf = $baseurl . $fl['id'] . "." . $fl['extension']; + echo '<tr><td style="text-align: center; vertical-align: middle"><a href="' . $flf . '">'; + if (has_mini($fl['extension'])) { + echo '<img src="' . $min . '" />'; + } else { + echo 'download'; + } + echo '</a></td>'; + echo '<td><strong>' . $fl['name'] . '</strong>'; + echo '<br />' . $fl['comment_html'] . '<br />'; + echo '</td>'; + echo '<td>' . $fl['upl_date'] . '<br />'; + if ($can_edit) echo '<br /><a href="delete-file-' . $fl['id'] . '">delete</a>'; + if ($can_edit) echo '<br /><a href="editinfo-file-' . $fl['id'] . '">edit info</a>'; + echo '</td></tr>'; + } + echo '</table>'; +} + +echo '</div><div class="contents-left">'; +if ($is_owner) { + echo '<h1>Your folders</h1>'; +} else { + echo '<h1>' . $fld["ownername"] . "'s folders</h1>"; +} +echo '<ul>'; +foreach ($folders as $f) { + if ($f['id'] == $fldid) { + echo '<li>' . $f['name'] . '</li>'; + } else { + echo '<li><a href="folder-file-' . $f['id'] . '">' . $f['name'] . '</a></li>'; + } +} +if ($is_owner) { + echo '<li><a class="tool_link" href="newfld-file">[+] New folder</a></li>'; +} +echo '</ul>'; + +require("tpl/general/bottom.php"); diff --git a/tpl/file/index.php b/tpl/file/index.php new file mode 100644 index 0000000..dc8cb52 --- /dev/null +++ b/tpl/file/index.php @@ -0,0 +1,61 @@ +<?php +require("tpl/general/top.php"); + +if (count($files) == 0) { + echo '<div class="message">You have uploaded no files yet.</div>'; +} else { + echo '<p>You have uploaded ' . count($files) .' files.</p>'; + echo '<div class="ordering_links">' . filters_html_full() . '</div>'; + echo '<table><tr><th width="' . ($img_mini_width) . 'px"></th><th>Info</th><th>Date</th></tr>'; + foreach ($files as $fl) { + $min = $baseurl . $fl['id'] . "-min." . $fl['extension']; + $flf = $baseurl . $fl['id'] . "." . $fl['extension']; + echo '<tr><td style="text-align: center; vertical-align: middle"><a href="' . $flf . '">'; + if (has_mini($fl['extension'])) { + echo '<img src="' . $min . '" />'; + } else { + echo 'download'; + } + echo '</a></td>'; + echo '<td><strong>' . $fl['name'] . '</strong>'; + if ($fl['folder_id'] != 0) { + echo ' (in folder: <a href="folder-file-' . $fl['folder_id'] . '">' . $fl['folder_name'] . '</a>)'; + } + echo '<br /><strong>MD:</strong> <code>' . (has_mini($fl['extension']) ? '!' : '') . '['.$fl['name'].']('.$flf.')</code>'; + echo '<br />' . $fl['comment_html'] . '<br />'; + /*echo '<strong>Miniature:</strong> <a href="' . $min . '">' . $min . '</a><br />'; + echo '<strong>Image:</strong> <a href="' . $flf . '">' . $flf . '</a><br />'; */ + echo '</td>'; + echo '<td>' . $fl['upl_date'] . '<br />'; + if ($can_delete) echo '<br /><a href="delete-file-' . $fl['id'] . '">delete</a>'; + if ($can_rename) echo '<br /><a href="editinfo-file-' . $fl['id'] . '">edit info</a>'; + echo '</td></tr>'; + } + echo '</table>'; +} + +if ($can_upload) { +?> +</div> +<div class="contents-left"> +<h1>Upload a file</h1> +<form method="POST" action="index.php?p=upload-file" enctype="multipart/form-data"> +If you upload an image, a <?php echo $img_mini_width; ?>px preview will be created.<br /><br /> +Title : <input type="text" name="name" style="width: 200px;" ><br /> +<input type="file" name="file" /><br /> +<input type="submit" value="Upload" /></form> + +<br /><br /> +<h1>Your folders</h1> +<ul> +<?php +foreach ($folders as $f) { + echo '<li><a href="folder-file-' . $f['id'] . '">' . $f['name'] . '</a></li>'; +} +?> +<li><a class="tool_link" href="newfld-file">[+] New folder</a></li> +</ul> +<?php +} + +require("tpl/general/bottom.php"); diff --git a/tpl/image/upload-ok.php b/tpl/file/upload-ok.php index 6242d93..a0edee1 100644 --- a/tpl/image/upload-ok.php +++ b/tpl/file/upload-ok.php @@ -7,13 +7,13 @@ $imgurl = $baseurl . $id . "." . $type; ?> <p>Preview : <a href="<?php echo $minurl; ?>"><?php echo $minurl; ?></a><br /> Image : <a href="<?php echo $imgurl; ?>"><?php echo $imgurl; ?></a><br /> - Markdown code : <code>![<?php echo $name; ?>](<?php echo $imgurl; ?>)</code></p> + Markdown code : <code><?php echo (has_mini($type) ? '!' : '') . '[' . $name; ?>](<?php echo $imgurl; ?>)</code></p> <p> <p> - <a href="upload-image">Back to upload form</a> + <a href="upload-file">Back to upload form</a> <?php - if ($user['priv'] >= $apps['image']['index']) - echo ' - <a href="index-image">back to list of uploaded images</a>'; + if ($user['priv'] >= $apps['file']['index']) + echo ' - <a href="index-file">back to list of uploaded files</a>'; ?> </p> <?php diff --git a/tpl/image/upload.php b/tpl/file/upload.php index 71283cf..31bdda7 100644 --- a/tpl/image/upload.php +++ b/tpl/file/upload.php @@ -1,12 +1,12 @@ <?php -$title = "Upload an image"; +$title = "Upload a file"; -if ($user['id'] == 0) $message = "You should create an account so that you can track images you have uploaded."; +if ($user['id'] == 0) $message = "You should create an account so that you can track files you have uploaded."; -$form_message = "A $miniature_width"."px preview will be created."; +$form_message = "If you upload an image, a $img_mini_width"."px preview will be created."; $need_file = true; $fields = array( - array("label" => "Image file : ", "type" => "file", "name" => "image"), + array("label" => "Image file : ", "type" => "file", "name" => "file"), array("label" => "Image title (optionnal) : ", "type" => "text", "name" => "name") ); $validate = "Upload"; diff --git a/tpl/general/top.php b/tpl/general/top.php index 08481fd..e2b168a 100644 --- a/tpl/general/top.php +++ b/tpl/general/top.php @@ -34,11 +34,11 @@ if ($user['id'] == 0) { <?php if ($user['id'] != 0) { echo '<a href="study">My studies</a>'; - echo '<a href="image">Uploaded images</a>'; + echo '<a href="file">Uploaded files</a>'; } else { echo '<a href="study">Studies</a>'; - if ($user['priv'] >= $apps['image']['upload']) { - echo '<a href="upload-image">Upload image</a>'; + if ($user['priv'] >= $apps['file']['upload']) { + echo '<a href="upload-file">Upload file</a>'; } } ?> diff --git a/tpl/image/folder.php b/tpl/image/folder.php deleted file mode 100644 index 5d5e57b..0000000 --- a/tpl/image/folder.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -require("tpl/general/top.php"); - -if ($can_edit) { - echo '<div class="small_right"><a href="editfld-image-' . $fldid . '">edit folder info</a> | '; - echo '<a href="delfld-image-' . $fldid . '">delete folder</a></div>'; -} - -echo $fld['comment_html']; - -if (count($images) == 0) { - echo '<div class="message">This folder has no images.</div>'; -} else { - echo '<div class="ordering_links">' . filters_html_full() . '</div>'; - echo '<table><tr><th width="' . ($miniature_width) . 'px">Preview</th><th>Info</th><th>Date</th></tr>'; - foreach ($images as $img) { - $min = $baseurl . $img['id'] . "-min." . $img['extension']; - $imgf = $baseurl . $img['id'] . "." . $img['extension']; - echo '<tr><td><a href="' . $imgf . '"><img src="' . $min . '" /></a></td>'; - echo '<td><strong>' . $img['name'] . '</strong>'; - echo '<br />' . $img['comment_html'] . '<br />'; - /*echo '<strong>Miniature:</strong> <a href="' . $min . '">' . $min . '</a><br />'; - echo '<strong>Image:</strong> <a href="' . $imgf . '">' . $imgf . '</a><br />'; */ - echo '</td>'; - echo '<td>' . $img['upl_date'] . '<br />'; - if ($can_edit) echo '<br /><a href="delete-image-' . $img['id'] . '">delete</a>'; - if ($can_edit) echo '<br /><a href="editinfo-image-' . $img['id'] . '">edit info</a>'; - echo '</td></tr>'; - } - echo '</table>'; -} - -echo '</div><div class="contents-left">'; -if ($is_owner) { - echo '<h1>Your folders</h1>'; -} else { - echo '<h1>' . $fld["ownername"] . "'s folders</h1>"; -} -echo '<ul>'; -foreach ($folders as $f) { - if ($f['id'] == $fldid) { - echo '<li>' . $f['name'] . '</li>'; - } else { - echo '<li><a href="folder-image-' . $f['id'] . '">' . $f['name'] . '</a></li>'; - } -} -if ($is_owner) { - echo '<li><a class="tool_link" href="newfld-image">[+] New folder</a></li>'; -} -echo '</ul>'; - -require("tpl/general/bottom.php"); diff --git a/tpl/image/index.php b/tpl/image/index.php deleted file mode 100644 index a89d024..0000000 --- a/tpl/image/index.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -require("tpl/general/top.php"); - -if (count($images) == 0) { - echo '<div class="message">You have uploaded no images yet.</div>'; -} else { - echo '<p>You have uploaded ' . count($images) .' images.</p>'; - echo '<div class="ordering_links">' . filters_html_full() . '</div>'; - echo '<table><tr><th width="' . ($miniature_width) . 'px">Preview</th><th>Info</th><th>Date</th></tr>'; - foreach ($images as $img) { - $min = $baseurl . $img['id'] . "-min." . $img['extension']; - $imgf = $baseurl . $img['id'] . "." . $img['extension']; - echo '<tr><td><a href="' . $imgf . '"><img src="' . $min . '" /></a></td>'; - echo '<td><strong>' . $img['name'] . '</strong>'; - if ($img['folder_id'] != 0) { - echo ' (in folder: <a href="folder-image-' . $img['folder_id'] . '">' . $img['folder_name'] . '</a>)'; - } - echo '<br /><strong>MD:</strong> <code>!['.$img['name'].']('.$imgf.')</code>'; - echo '<br />' . $img['comment_html'] . '<br />'; - /*echo '<strong>Miniature:</strong> <a href="' . $min . '">' . $min . '</a><br />'; - echo '<strong>Image:</strong> <a href="' . $imgf . '">' . $imgf . '</a><br />'; */ - echo '</td>'; - echo '<td>' . $img['upl_date'] . '<br />'; - if ($can_delete) echo '<br /><a href="delete-image-' . $img['id'] . '">delete</a>'; - if ($can_rename) echo '<br /><a href="editinfo-image-' . $img['id'] . '">edit info</a>'; - echo '</td></tr>'; - } - echo '</table>'; -} - -if ($can_upload) { -?> -</div> -<div class="contents-left"> -<h1>Upload an image</h1> -<form method="POST" action="index.php?p=upload-image" enctype="multipart/form-data"> -A <?php echo $miniature_width; ?>px preview will be created.<br /><br /> -Title : <input type="text" name="name" style="width: 200px;" ><br /> -<input type="file" name="image" /><br /> -<input type="submit" value="Upload" /></form> - -<br /><br /> -<h1>Your folders</h1> -<ul> -<?php -foreach ($folders as $f) { - echo '<li><a href="folder-image-' . $f['id'] . '">' . $f['name'] . '</a></li>'; -} -?> -<li><a class="tool_link" href="newfld-image">[+] New folder</a></li> -</ul> -<?php -} - -require("tpl/general/bottom.php"); |