Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
fix - drafts and ghost pages are only for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
patkon committed Jan 18, 2018
1 parent 909126e commit d312e28
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions core/functions/func_get_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,20 @@ function get_content($page, $mode = 'p') {
$page_contents['page_language'] = $languagePack;
}

if(!empty($_SESSION['user_class']) && $_SESSION['user_class'] != 'administrator') {
$nav_sql_filter = "WHERE page_language = :language";
if(empty($_SESSION['user_class']) && $_SESSION['user_class'] != 'administrator') {
$nav_sql_filter = "WHERE page_status != 'draft' AND page_status != 'ghost' AND page_language = :language";
} else {
$nav_sql_filter = "WHERE page_language = :language";
}

$nav_sql = "SELECT page_id, page_hash, page_language, page_linkname, page_permalink, page_title, page_sort, page_status
FROM fc_pages $nav_sql_filter ORDER BY page_sort";

$sth = $dbh->prepare($nav_sql);
$sth->bindParam(':language', $page_contents['page_language'], PDO::PARAM_STR);
$sth->execute();

$fc_nav = $sth->fetchAll();

$dbh = null;
$fc_nav = fc_array_multisort($fc_nav, 'page_language', SORT_ASC, 'page_sort', SORT_ASC, SORT_NATURAL);

Expand All @@ -79,7 +78,7 @@ function get_content($page, $mode = 'p') {
*/

function fc_check_shortlinks($shortlink) {

global $fc_db_content;

$dbh = new PDO("sqlite:$fc_db_content");
Expand Down

0 comments on commit d312e28

Please sign in to comment.