mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
made encryption work again.
I did something.
This commit is contained in:
parent
f5e5e54be6
commit
3ae82cf630
2 changed files with 11 additions and 13 deletions
14
index.php
14
index.php
|
@ -132,6 +132,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
$p_code = trim(htmlspecialchars($_POST['format']));
|
$p_code = trim(htmlspecialchars($_POST['format']));
|
||||||
$p_expiry = trim(htmlspecialchars($_POST['paste_expire_date']));
|
$p_expiry = trim(htmlspecialchars($_POST['paste_expire_date']));
|
||||||
$p_password = $_POST['pass'];
|
$p_password = $_POST['pass'];
|
||||||
|
$tag_input = $_POST['tag_input'];
|
||||||
|
|
||||||
if (empty($p_password)) {
|
if (empty($p_password)) {
|
||||||
$p_password = null;
|
$p_password = null;
|
||||||
|
@ -139,13 +140,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
$p_password = password_hash($p_password, PASSWORD_DEFAULT);
|
$p_password = password_hash($p_password, PASSWORD_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
$p_encrypt = $_POST['encrypted'] === '1';
|
$p_encrypt = $_POST['encrypted'];
|
||||||
|
if ($p_encrypt == "" || $p_encrypt == null) {
|
||||||
$tag_input = $_POST['tag_input'];
|
$p_encrypt = "0";
|
||||||
|
} else {
|
||||||
if ($p_encrypt) {
|
// Encrypt option
|
||||||
|
$p_encrypt = "1";
|
||||||
$p_content = openssl_encrypt($p_content, PP_ENCRYPTION_ALGO, PP_ENCRYPTION_KEY);
|
$p_content = openssl_encrypt($p_content, PP_ENCRYPTION_ALGO, PP_ENCRYPTION_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set expiry time
|
// Set expiry time
|
||||||
$expires = calculatePasteExpiry($p_expiry);
|
$expires = calculatePasteExpiry($p_expiry);
|
||||||
|
|
10
paste.php
10
paste.php
|
@ -57,13 +57,9 @@ $row = $conn->querySelectOne(
|
||||||
// This is used in the theme files.
|
// This is used in the theme files.
|
||||||
$totalpastes = getSiteTotalPastes($conn);
|
$totalpastes = getSiteTotalPastes($conn);
|
||||||
|
|
||||||
$notfound = null;
|
if (!$row) {
|
||||||
$is_private = false;
|
|
||||||
|
|
||||||
if ($row === null) {
|
|
||||||
header('HTTP/1.1 404 Not Found');
|
header('HTTP/1.1 404 Not Found');
|
||||||
$notfound = $lang['notfound']; // "Not found";
|
$notfound = $lang['notfound']; // "Not found";
|
||||||
goto Not_Valid_Paste;
|
|
||||||
} else {
|
} else {
|
||||||
$paste_title = $row['title'];
|
$paste_title = $row['title'];
|
||||||
$paste_code = $row['code'];
|
$paste_code = $row['code'];
|
||||||
|
@ -105,7 +101,7 @@ if ($row === null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($p_encrypt) {
|
if ($p_encrypt == 1) {
|
||||||
$p_content = openssl_decrypt($p_content, PP_ENCRYPTION_ALGO, PP_ENCRYPTION_KEY);
|
$p_content = openssl_decrypt($p_content, PP_ENCRYPTION_ALGO, PP_ENCRYPTION_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +256,7 @@ if ($p_password == "NONE" || $p_password === null) {
|
||||||
|
|
||||||
Not_Valid_Paste:
|
Not_Valid_Paste:
|
||||||
// Private paste not valid
|
// Private paste not valid
|
||||||
if ($is_private || $notfound) {
|
if ($is_private == '1') {
|
||||||
// Display errors
|
// Display errors
|
||||||
require_once('theme/' . $default_theme . '/header.php');
|
require_once('theme/' . $default_theme . '/header.php');
|
||||||
require_once('theme/' . $default_theme . '/errors.php');
|
require_once('theme/' . $default_theme . '/errors.php');
|
||||||
|
|
Loading…
Add table
Reference in a new issue