Skip to content

Commit

Permalink
Small Tweaks / Fixes, Cron Clean, Unnecessary Files Removal, README
Browse files Browse the repository at this point in the history
  • Loading branch information
RaJiska committed Oct 23, 2017
1 parent aba1b45 commit d409205
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 6,107 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# BeyondPaste
Simple self hosted Pastebin-like tool allowing you to have the pastes uploaded on your own server.
Running on PHP7, it is using Bootstrap 4 for its frontend, Geshi for the syntax highlighting.

# Features
* Paste upload
* Syntax Highlighting
* Unlisted Pastes
* One Time Read Paste
* Paste auto remove

# Screenshots
**Paste creation**
![alt text](https://i.gyazo.com/c6270e7c1068d4bbb463e10c2940a382.png)
---------------------
**Paste View**
![alt text](https://i.gyazo.com/abedef0e0aca81f07894fd0e7802fec0.png)

# Credits
Design inspired by **Popoliito's** securePaste project.
5 changes: 4 additions & 1 deletion classes/Paste.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public function getPasteLink()

private function expirationToTimestamp(&$expiration)
{
$time = time();
$timeToAdd = 0;

switch ($expiration)
Expand All @@ -289,9 +290,11 @@ private function expirationToTimestamp(&$expiration)
case '1y':
$timeToAdd = (12 * 30 * 24 * 60 * 60);
break;
case 'never':
$timeToAdd = -($time);
}

return (time() + $timeToAdd);
return ($time + $timeToAdd);
}

/* Getters / Setters */
Expand Down
8 changes: 8 additions & 0 deletions cron/clean.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
require_once "../config/config.php";

require_once "../classes/Base.php";
require_once "../classes/Database.php";

$current_epoch = time();
$stmt = $Database->query("DELETE FROM `paste` WHERE deleted = '1';");
2 changes: 1 addition & 1 deletion cron/cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
require_once "../classes/Database.php";

$current_epoch = time();
$stmt = $Database->query("UPDATE `paste` SET deleted = '1' WHERE $current_epoch >= expiration_epoch;");
$stmt = $Database->query("UPDATE `paste` SET deleted = '1' WHERE expiration_epoch != 0 && $current_epoch >= expiration_epoch;");
134 changes: 0 additions & 134 deletions lib/geshi/contrib/aliased.php

This file was deleted.

Loading

0 comments on commit d409205

Please sign in to comment.