mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 14:40:09 +01:00
fix: weird encryption with editing unencrypted pastes
This commit is contained in:
parent
f2efc54d0a
commit
ca28f037f7
2 changed files with 12 additions and 6 deletions
|
@ -126,11 +126,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
$paste_password = password_hash($paste_password, PASSWORD_DEFAULT);
|
$paste_password = password_hash($paste_password, PASSWORD_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If it's a new paste or the existing paste is encrypted, encrypt the paste
|
||||||
|
// This is to prevent legacy pastes from getting weird
|
||||||
|
if ($editing && !$paste->encrypt) {
|
||||||
|
$paste_content = $_POST['paste_data'];
|
||||||
|
} else {
|
||||||
$paste_content = openssl_encrypt(
|
$paste_content = openssl_encrypt(
|
||||||
$_POST['paste_data'],
|
$_POST['paste_data'],
|
||||||
PP_ENCRYPTION_ALGO,
|
PP_ENCRYPTION_ALGO,
|
||||||
PP_ENCRYPTION_KEY
|
PP_ENCRYPTION_KEY
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Set expiry time
|
// Set expiry time
|
||||||
$expires = calculatePasteExpiry($p_expiry);
|
$expires = calculatePasteExpiry($p_expiry);
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<!-- Text area -->
|
<!-- Text area -->
|
||||||
<textarea class="textarea" rows="15" id="code" name="paste_data" onkeyup="countChars(this);"
|
<textarea class="textarea" rows="15" id="code" name="paste_data" onkeyup="countChars(this);"
|
||||||
onkeydown="return catchTab(this,event)"
|
onkeydown="return catchTab(this,event)"
|
||||||
placeholder="Paste Or Drop Text File Here."><?php echo (isset($_POST['paste_data'])) ? pp_html_escape($_POST['paste_data']) : ''; ?></textarea>
|
placeholder="Paste or drop text file here."><?php echo (isset($_POST['paste_data'])) ? pp_html_escape($_POST['paste_data']) : ''; ?></textarea>
|
||||||
<p id="charNum"><b>File Size: </b><span style="color: green;">1000/1000Kb</span></p>
|
<p id="charNum"><b>File Size: </b><span style="color: green;">1000/1000Kb</span></p>
|
||||||
<!-- Tag system -->
|
<!-- Tag system -->
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue