page preview via token

This commit is contained in:
Diego Najar 2019-05-09 17:20:35 +02:00
parent 9d436f8a76
commit 07df697618
1 changed files with 19 additions and 5 deletions

View File

@ -34,7 +34,7 @@ function buildErrorPage() {
// This function is only used from the rule 69.pages.php, DO NOT use this function! // This function is only used from the rule 69.pages.php, DO NOT use this function!
// This function generate a particular page from the current slug of the url // This function generate a particular page from the current slug of the url
// If the slug has not a page associacted returns FALSE and is set not-found as true // If the slug has not a page associacted returns FALSE and set not-found as true
function buildThePage() { function buildThePage() {
global $url; global $url;
@ -46,10 +46,12 @@ function buildThePage() {
return false; return false;
} }
if ( $page->draft() || $page->scheduled() ) { if ($page->draft() || $page->scheduled()) {
if ($url->parameter('preview')!==md5($page->uuid())) {
$url->setNotFound(); $url->setNotFound();
return false; return false;
} }
}
return $page; return $page;
} }
@ -806,7 +808,19 @@ function ajaxResponse($status=0, $message="", $data=array()) {
exit (json_encode($output)); exit (json_encode($output));
} }
function uploadImage($file, $imageDir, $thumbnailDir) { /*
| This function checks the image extension,
| generate a new filename to not overwrite the exists,
| generate the thumbnail,
| and move the image to a proper place
|
| @file string Path and filename of the image
| @imageDir string Path where the image is going to be stored
| @thumbnailDir string Path where the thumbnail is going to be stored, if you don't set the variable is not going to create the thumbnail
|
| @return string/boolean Path and filename of the new image or FALSE if there were some error
*/
function transformImage($file, $imageDir, $thumbnailDir=false) {
global $site; global $site;
// Check image extension // Check image extension