summaryrefslogtreecommitdiffstats
path: root/application/views/file
diff options
context:
space:
mode:
Diffstat (limited to 'application/views/file')
-rw-r--r--application/views/file/client.php49
-rw-r--r--application/views/file/deleted.php11
-rw-r--r--application/views/file/file_info.php32
-rw-r--r--application/views/file/html_footer.php6
-rw-r--r--application/views/file/html_header.php96
-rw-r--r--application/views/file/nav_history.php18
-rw-r--r--application/views/file/non_existent.php3
-rw-r--r--application/views/file/show_url.php8
-rw-r--r--application/views/file/upload_form.php98
-rw-r--r--application/views/file/upload_history.php33
-rw-r--r--application/views/file/upload_history_thumbnails.php28
11 files changed, 382 insertions, 0 deletions
diff --git a/application/views/file/client.php b/application/views/file/client.php
new file mode 100644
index 000000000..37d442267
--- /dev/null
+++ b/application/views/file/client.php
@@ -0,0 +1,49 @@
+<h1>Client</h1>
+
+<p>
+ Development (git): <?php echo anchor("http://git.server-speed.net/users/flo/fb/"); ?><br />
+ Latest release: <?php echo $client_link ? anchor($client_link) : "unknown"; ?><br />
+ GPG sigs, older versions: <a href="<?php echo $client_link_dir; ?>"><?php echo $client_link_dir; ?></a>
+</p>
+
+<p>To authenticate add the following to your ~/.netrc:</p>
+
+<pre>
+machine <?php echo $domain; ?> login my_username password my_secret_password
+</pre>
+
+<p>
+ If you are using fb-client &ge;1.2 you can
+ <a href="<?php echo site_url("user/apikeys"); ?>">create an API key</a>,
+ save it in <code>~/.config/fb-client/apikey</code> and remove
+ your password from <code>.netrc</code>. Please refer to <code>man
+ 1 fb</code> for further details.
+</p>
+
+<p>
+ If you are using fb-client &ge;1.1 you can use
+ <code>~/.config/fb-client/config</code> to upload to a different
+ pastebin URL (https or you own installation). Please refer to
+ <code>man 1 fb</code> for further details.
+</p>
+
+<h2>Linux</h2>
+<p>
+ Arch Linux: pacman -S fb-client<br />
+ Debian: <?php echo anchor($client_link_deb); ?><br />
+ Gentoo: Add <a href="http://git.rout0r.org/fluxnet/overlay/blobs/master/README.md">this overlay</a> and run <code>emerge -a fb-client</code><br />
+ Slackware: <?php echo anchor($client_link_slackware); ?>
+</p>
+
+<h2>OS X</h2>
+<p>
+ Get <a href="http://brew.sh">Homebrew</a> and run <code>brew install fb-client</code>.
+</p>
+
+<h1>Shell</h1>
+
+<pre>
+curl -n -F "file=@/home/user/foo" <?php echo site_url("file/do_upload"); ?> (binary safe)
+cat file | curl -n -F "file=@-;filename=stdin" <?php echo site_url("file/do_upload"); ?> (binary safe)
+</pre>
+
diff --git a/application/views/file/deleted.php b/application/views/file/deleted.php
new file mode 100644
index 000000000..8a5818f2d
--- /dev/null
+++ b/application/views/file/deleted.php
@@ -0,0 +1,11 @@
+<div class="center">
+ <?php if (!empty($errors)) {
+ echo "<p>";
+ foreach ($errors as $error) {
+ echo "${error["id"]}: ${error["reason"]}<br>\n";
+ }
+ echo "</p>";
+ } ?>
+
+ <p><?php echo $deleted_count; ?> of <?php echo $total_count; ?> deleted.</p>
+</div>
diff --git a/application/views/file/file_info.php b/application/views/file/file_info.php
new file mode 100644
index 000000000..6c2772a21
--- /dev/null
+++ b/application/views/file/file_info.php
@@ -0,0 +1,32 @@
+<div class="center">
+ <?php if($filedata): ?>
+ <div class="table-responive">
+ <table class="table" style="margin: auto">
+ <tr>
+ <td class="title">ID</td>
+ <td class="text"><a href="<?php echo site_url($id); ?>/"><?php echo $id; ?></a></td>
+ </tr>
+ <tr>
+ <td class="title">Filename</td>
+ <td class="text"><?php echo htmlspecialchars($filedata["filename"]); ?></td>
+ </tr>
+ <tr>
+ <td class="title">Date of upload</td>
+ <td class="text"><?php echo date("r", $filedata["date"]); ?></td>
+ </tr>
+ <tr>
+ <td class="title">Date of removal</td>
+ <td class="text"><?php echo $timeout; ?></td>
+ </tr>
+ <tr>
+ <td class="title">Size</td>
+ <td class="text"><?php echo format_bytes($filedata["filesize"]); ?></td>
+ </tr>
+ <tr>
+ <td class="title">Mimetype</td>
+ <td class="text"><?php echo $filedata["mimetype"]; ?></td>
+ </tr>
+ </table>
+ </div>
+ <?php endif; ?>
+</div>
diff --git a/application/views/file/html_footer.php b/application/views/file/html_footer.php
new file mode 100644
index 000000000..bbec7ebd1
--- /dev/null
+++ b/application/views/file/html_footer.php
@@ -0,0 +1,6 @@
+ </div>
+ </div>
+
+<?php
+$force_full_html = true;
+include(FCPATH."application/views/footer.php");
diff --git a/application/views/file/html_header.php b/application/views/file/html_header.php
new file mode 100644
index 000000000..2c556720c
--- /dev/null
+++ b/application/views/file/html_header.php
@@ -0,0 +1,96 @@
+<?php
+$force_full_html = true;
+include(FCPATH."application/views/header.php"); ?>
+
+</div>
+
+<script type="text/javascript">
+ /* <![CDATA[ */
+ window.lexers = <?php echo json_encode($lexers); ?>;
+ window.paste_base = '<?php echo site_url($id) ?>';
+ /* ]]> */
+</script>
+
+<?php if (isset($error_message)) { ?>
+<div class="alert alert-danger" style="text-align: center; border-radius: 0;">
+ <?php echo $error_message; ?>
+</div>
+<?php } ?>
+
+<div class="container paste-container">
+ <div style="border:1px solid #ccc;">
+ <div class="navbar navbar-default navbar-static-top navbar-paste">
+ <ul class="nav navbar-nav navbar-left dont-float">
+ <li><a href="#file-info" class="navbar-brand" data-toggle="modal"><?php echo $title ?></a></li>
+ <li class="divider"></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="language-toggle">
+ Language: <?php echo htmlspecialchars($current_highlight); ?>
+ <b class="caret"></b>
+ </a>
+ <div class="dropdown-menu" style="padding: 15px;">
+ <form>
+ <input type="text" id="language" placeholder="Language" class="form-control">
+ </form>
+ </div>
+ </li>
+ <li class="divider"></li>
+ <li>
+ <a href="#file-info" role="button" data-toggle="modal">Info</a>
+ </li>
+ <li class="divider"></li>
+ <li><a href="<?php echo site_url('file/index?repaste='.$id); ?>" role="button">Repaste</a></li>
+ </ul>
+ <div class="btn-group navbar-right" style="margin: 8px;">
+ <a id="linewrap" class="btn btn-default" rel="tooltip" title="Toggle wrapping of long lines">Linewrap</a>
+ <a href="<?php echo site_url($id."/plain") ?>" class="btn btn-default" rel="tooltip" title="View as plain text">Plain</a>
+ <a href="<?php echo site_url($id) ?>" class="btn btn-default" rel="tooltip" title="View as raw file (org. mime type)">Raw</a>
+ <?php if ($current_highlight === 'rmd') { ?>
+ <a href="<?php echo site_url($id)."/" ?>" class="btn btn-default" rel="tooltip" title="Render as Code">Code</a>
+ <?php } else { ?>
+ <a href="<?php echo site_url($id."/rmd") ?>" class="btn btn-default" rel="tooltip" title="Render as Markdown">Markdown</a>
+ <?php } ?>
+ </div>
+ </div> <!-- .navbar -->
+ <div id="file-info" class="modal fade" role="dialog" aria-labelledby="file-info" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal">&times;</button>
+ <h3 class="modal-title">Paste Information</h3>
+ </div>
+ <div class="modal-body">
+ <table class="table">
+ <tr>
+ <td style="border:0;">Filename:</td>
+ <td style="border:0;"><?php echo htmlspecialchars($filedata["filename"]) ?></td>
+ </tr>
+ <tr>
+ <td>Size:</td>
+ <td><?php echo format_bytes($filedata["filesize"]) ?></td>
+ </tr>
+ <tr>
+ <td>Mimetype:</td>
+ <td><?php echo $filedata["mimetype"] ?></td>
+ </tr>
+ <tr>
+ <td>Uploaded:</td>
+ <td><?php echo date("r", $filedata["date"]) ?></td>
+ </tr>
+ <tr>
+ <td>Removal:</td>
+ <td><?php echo $timeout ?></td>
+ </tr>
+ </table>
+ </div>
+ <div class="modal-footer">
+ <?php echo form_open("file/do_delete/", array("style" => "display: inline")); ?>
+ <input type="hidden" name="ids[<?php echo $id; ?>]" value="<?php echo $id; ?>">
+ <button class="btn btn-danger pull-left" aria-hidden="true">Delete</button>
+ </form>
+ <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
+ </div>
+ </div>
+ </div>
+ </div> <!-- .modal -->
+ <div>
diff --git a/application/views/file/nav_history.php b/application/views/file/nav_history.php
new file mode 100644
index 000000000..bbb695fd6
--- /dev/null
+++ b/application/views/file/nav_history.php
@@ -0,0 +1,18 @@
+<ul class="nav nav-tabs nav-history">
+<?php
+$nav = array(
+ "List" => "file/upload_history",
+ "Thumbnails" => "file/upload_history_thumbnails",
+);
+
+$CI =& get_instance();
+
+foreach ($nav as $key => $item) {
+ ?>
+ <li <?php echo $CI->uri->uri_string() == $item ? 'class="active"' : ''; ?>>
+ <a href="<?php echo site_url($item); ?>"><?php echo $key; ?></a>
+ </li>
+ <?php
+}
+?>
+</ul>
diff --git a/application/views/file/non_existent.php b/application/views/file/non_existent.php
new file mode 100644
index 000000000..13d8c6950
--- /dev/null
+++ b/application/views/file/non_existent.php
@@ -0,0 +1,3 @@
+<div class="center">
+ <p>I'm sorry, but the requested file doesn't exist.</p>
+</div>
diff --git a/application/views/file/show_url.php b/application/views/file/show_url.php
new file mode 100644
index 000000000..a3d965717
--- /dev/null
+++ b/application/views/file/show_url.php
@@ -0,0 +1,8 @@
+<div class="center">
+ <p>You can get your file(s) here:</p>
+ <p>
+ <?php foreach ($urls as $key => $url) { ?>
+ <a href="<?php echo $url; ?>"><?php echo $url; ?></a><br />
+ <?php } ?>
+ </p>
+</div>
diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php
new file mode 100644
index 000000000..c74bb2ba1
--- /dev/null
+++ b/application/views/file/upload_form.php
@@ -0,0 +1,98 @@
+<?php if (isset($user_logged_in) && $user_logged_in) { ?>
+<div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-upload-form">
+ <?php echo form_open_multipart('file/do_paste'); ?>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Text paste</h3>
+ </div>
+ <div class="panel-body">
+ <textarea name="content" class="form-control text-upload"><?php
+ if (isset($textarea_content)) {
+ echo $textarea_content;
+ }
+ ?></textarea><br>
+ <button type="submit" class="btn btn-primary">Paste it!</button>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+<div class="row">
+ <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
+ <?php echo form_open_multipart('file/do_upload'); ?>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">File upload</h3>
+ </div>
+ <div class="panel-body">
+ <input class="file-upload" type="file" name="file[]" multiple="multiple"><br>
+ <button type="submit" id="upload_button" class="btn btn-primary">Upload it!</button>
+ </div>
+ </div>
+ </form>
+ </div>
+ <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
+ <div class="panel panel-info">
+ <div class="panel-heading">
+ <h3 class="panel-title">Notice!</h3>
+ </div>
+ <div class="panel-body">
+ <p>
+ Uploads/pastes are <?php if ($upload_max_age > 0) {
+ echo "deleted after ".$upload_max_age." days";
+ if ($small_upload_size > 0) {
+ echo " unless they are smaller than ".format_bytes($small_upload_size);
+ }
+ } else {
+ echo "stored forever";
+ } ?>. Maximum upload size is <?php echo format_bytes($max_upload_size); ?>.
+ You can upload a maximum of <?php echo ini_get("max_file_uploads"); ?> files at once.
+ </p>
+ </div>
+ </div>
+ </div>
+</div>
+
+<script type="text/javascript">
+ /* <![CDATA[ */
+ var max_upload_size = "<?php echo $max_upload_size; ?>";
+ /* ]]> */
+</script>
+
+<?php } else { ?>
+ <?php echo form_open('user/login', array('class' => 'form-inline')); ?>
+ <input type="text" name="username" placeholder="Username" autofocus class="form-control inline-input"/>
+ <input type="password" name="password" placeholder="Password" class="form-control inline-input"/>
+ <input type="submit" class="btn btn-primary" value="Login" name="process" />
+ <?php if(auth_driver_function_implemented("can_reset_password")) { ?>
+ <p class="help-block"><?php echo anchor("user/reset_password", "Forgot your password?"); ?></p>
+ <?php } ?>
+ </form>
+<?php } ?>
+<div class="row">
+ <div class="col-lg-6">
+ <div class="page-header"><h1>Features</h1></div>
+ <p>For shell uploading/pasting and download information for the client go to <a href="<?php echo site_url("file/client"); ?>"><?php echo site_url("file/client"); ?></a></p>
+ <p>You can use the <?php echo anchor("file/upload_history", "history"); ?> to find old uploads.</p>
+ <h3>How to link your pastes:</h3>
+ <dl class="dl-horizontal">
+ <dt>/&lt;ID&gt;/</dt><dd>automatically highlight the paste</dd>
+ <dt>/&lt;ID&gt;</dt><dd>set the detected MIME type and let the browser do the rest</dd>
+ <dt>/&lt;ID&gt;/plain</dt><dd>force the MIME type to be text/plain</dd>
+ <dt>/&lt;ID&gt;/&lt;file extension&gt;</dt><dd>override auto detection and use the supplied file extension or language name for highlighting</dd>
+ <dt>/&lt;ID&gt;/qr</dt><dd>display a qr code containing a link to <span class="example">/&lt;ID&gt;/</span></dd>
+ <dt>/&lt;ID&gt;/rmd</dt><dd>convert markdown to HTML</dd>
+ <dt>/&lt;ID&gt;/ascii</dt><dd>convert text with ANSI (shell) escape codes to HTML</dd>
+ <dt>/&lt;ID&gt;/info</dt><dd>display some information about the ID</dd>
+ </dl>
+ <p>If your upload is not detected as text, only <b>/&lt;ID&gt;/qr</b>, <b>/&lt;ID&gt;/plain</b> and <b>/&lt;ID&gt;/info</b> will work as above and all others will simply return the file with the detected MIME type.</p>
+ </div>
+ <div class="col-lg-6">
+ <div class="page-header"><h1>Information</h1></div>
+ <p>This website's primary goal is aiding developers, power users, students and alike in solving problems, debugging software, sharing their configuration, etc. It is not intended to distribute confidential or harmful information, scripts or software.</p>
+ <?php if(auth_driver_function_implemented("can_register_new_users")) { ?>
+ <p>If you believe you deserve an account, ask someone who is already using this service to <a href="<?php echo site_url("user/invite"); ?>">invite</a> you.</p>
+ <?php } ?>
+ </div>
+</div>
diff --git a/application/views/file/upload_history.php b/application/views/file/upload_history.php
new file mode 100644
index 000000000..634ad5935
--- /dev/null
+++ b/application/views/file/upload_history.php
@@ -0,0 +1,33 @@
+<?php register_js_include("/data/js/jquery.tablesorter.min.js"); ?>
+<?php include 'nav_history.php'; ?>
+<?php echo form_open("file/do_delete") ?>
+ <div class="table-responsive">
+ <table id="upload_history" class="table table-striped tablesorter">
+ <thead>
+ <tr>
+ <th><input type="checkbox" name="all-ids" id="history-all"></th>
+ <th>ID</th>
+ <th>Filename</th>
+ <th>Mimetype
+ <th>Date</th>
+ <th>Size</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach($query as $key => $item): ?>
+ <tr>
+ <td><input type="checkbox" name="ids[<?php echo $item["id"] ?>]" value="<?php echo $item["id"] ?>" class="delete-history"></td>
+ <td><a href="<?php echo site_url("/".$item["id"]) ?>/"><?php echo $item["id"] ?></a></td>
+ <td class="wrap"><?php echo htmlspecialchars($item["filename"]); ?></td>
+ <td><?php echo $item["mimetype"] ?></td>
+ <td class="nowrap"><?php echo date("r", $item["date"]); ?><span class="hidden">t=<?php echo $item["date"]; ?></span></td>
+ <td><?php echo $item["filesize"] ?></td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ </div>
+ <input class="btn btn-danger" type="submit" value="Delete checked" name="process">
+</form>
+
+<p>Total sum of your distinct uploads: <?php echo $total_size; ?>.</p>
diff --git a/application/views/file/upload_history_thumbnails.php b/application/views/file/upload_history_thumbnails.php
new file mode 100644
index 000000000..bcafc44ca
--- /dev/null
+++ b/application/views/file/upload_history_thumbnails.php
@@ -0,0 +1,28 @@
+<div class="pull-right">
+ <?php echo form_open("file/do_delete/", array("id" => "delete_form", "style" => "display: inline")); ?>
+ <button class="btn btn-danger" id="delete_button" style="display: none">Delete selected</button>
+ </form>
+ <button class="btn btn-default" id="toggle_delete_mode" style="display: inline">Delete mode</button>
+</div>
+
+<?php include 'nav_history.php'; ?>
+
+<!-- Comment markers background: http://stackoverflow.com/a/14776780/953022 -->
+<div class="upload_history_thumbnails"><!--
+ <?php foreach($query as $key => $item): ?>
+ --><a href="<?php echo site_url("/".$item["id"]); ?>" title="<?php echo htmlentities($item["filename"]); ?>" data-content="<?php echo htmlentities($item["tooltip"]); ?>" data-id="<?php echo $item["id"]; ?>"><img class="thumb" src="<?php echo site_url("file/thumbnail/".$item["id"]); ?>"></a><!--
+ <?php endforeach; ?>
+ -->
+</div>
+
+<div class="row-fluid">
+ <div class="span12 alert alert-block alert-info">
+ <h4 class="alert-heading">Notice!</h4>
+ <p>
+ Currently only jpeg, png and gif images are displayed here. If you are
+ looking for something else, please switch to the
+ <a href="<?php echo site_url("file/upload_history"); ?>">list view</a>
+ which contains your complete history.
+ </p>
+ </div>
+</div>