intval($page_id)]) && \defender::safe()) { switch ($_POST['table_action']) { case "publish": dbquery("UPDATE ".DB_CUSTOM_PAGES." SET page_status=:status WHERE page_id=:pageid", [':status' => '1', ':pageid' => intval($page_id)]); break; case "unpublish": dbquery("UPDATE ".DB_CUSTOM_PAGES." SET page_status=:status WHERE page_id=:pageid", [':status' => '0', ':pageid' => intval($page_id)]); break; case "delete": dbquery("DELETE FROM ".DB_CUSTOM_PAGES." WHERE page_id=:pageid", [':pageid' => intval($page_id)]); dbquery("DELETE FROM ".DB_CUSTOM_PAGES_CONTENT." WHERE page_id=:pageid", [':pageid' => intval($page_id)]); dbquery("DELETE FROM ".DB_CUSTOM_PAGES_GRID." WHERE page_id=:pageid", [':pageid' => intval($page_id)]); break; default: redirect(FUSION_REQUEST); } } } addNotice('success', self::$locale['page_0402']); redirect(FUSION_REQUEST); } addNotice('warning', self::$locale['page_0442']); redirect(FUSION_REQUEST); } if (isset($_POST['page_clear'])) { redirect(FUSION_SELF.fusion_get_aidlink()); } $search_string = []; if (isset($_POST['p-submit-page_title'])) { $search_string['cp.page_title'] = [ "input" => form_sanitizer($_POST['page_title'], "", "page_title"), "operator" => "LIKE" ]; } if (!empty($_POST['page_status']) && isnum($_POST['page_status'])) { switch ($_POST['page_status']) { case 1: // is a draft $search_string['cp.page_status'] = ["input" => 1, "operator" => "="]; break; case 2: // is a sticky $search_string['cp.page_status'] = ["input" => 0, "operator" => "="]; break; } } if (!empty($_POST['page_access'])) { $search_string['cp.page_access'] = [ "input" => form_sanitizer($_POST['page_access'], "", "page_access"), "operator" => "=" ]; } if (!empty($_POST['page_cat'])) { $search_string['cp.page_cat'] = [ "input" => form_sanitizer($_POST['page_cat'], "", "page_cat"), "operator" => "=" ]; } // This one cannot - must be ".in_group() if (!empty($_POST['page_language'])) { $language = form_sanitizer($_POST['page_language'], '', 'page_language'); $search_string['cp.page_language'] = [ "input" => '', "operator" => '', 'concat' => in_group('cp.page_language', $language), ]; } if (!empty($_POST['page_user'])) { $search_string['cp.page_user'] = [ "input" => form_sanitizer($_POST['page_user'], "", "page_user"), "operator" => "=" ]; } if (isset($_GET['pref']) && isnum($_GET['pref'])) { $search_string['cp.page_cat'] = [ 'input' => intval($_GET['pref']), 'operator' => '=' ]; } $sql_condition = ''; if (!empty($search_string)) { $i = 0; foreach ($search_string as $key => $values) { if ($i > 0) { $sql_condition .= " AND "; } if (isset($values['concat'])) { $sql_condition .= $values['concat']; } else { $sql_condition .= " $key ".$values['operator'].($values['operator'] == "LIKE" ? "'%" : "'").$values['input'].($values['operator'] == "LIKE" ? "%'" : "'"); } $i++; } } $max_search_query = "SELECT COUNT(cp.page_id) 'max_page' FROM ".DB_CUSTOM_PAGES." cp LEFT JOIN ".DB_CUSTOM_PAGES." cp2 ON cp.page_cat=cp2.page_id ".($sql_condition ? "WHERE $sql_condition" : ''); $max_pages = dbresult(dbquery($max_search_query), 0); $rowstart = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $max_pages ? $_GET['rowstart'] : 0; $page_per_query = 20; $page_query = "SELECT cp.*, cp2.page_title 'page_cat_title', count(cp2.page_id) 'page_sub_count', u.user_id, u.user_name, u.user_status, u.user_avatar FROM ".DB_CUSTOM_PAGES." cp LEFT JOIN ".DB_USERS." u ON u.user_id=cp.page_user LEFT JOIN ".DB_CUSTOM_PAGES." cp2 ON cp.page_cat=cp2.page_id ".($sql_condition ? "WHERE " : '')." $sql_condition GROUP BY cp.page_id ORDER BY cp.page_status DESC, cp.page_datestamp DESC LIMIT $rowstart, $page_per_query "; $page_result = dbquery($page_query); ?>
\n"; echo "
\n"; echo " ".self::$locale['page_0200'].""; echo ""; echo ""; echo ""; echo "
\n"; $filter_values = [ "page_title" => !empty($_POST['page_title']) ? form_sanitizer($_POST['page_title'], "", "page_title") : "", "page_status" => !empty($_POST['page_status']) ? form_sanitizer($_POST['page_status'], "", "page_status") : "", "page_cat" => !empty($_POST['page_cat']) ? form_sanitizer($_POST['page_cat'], "", "page_cat") : "", "page_access" => !empty($_POST['page_access']) ? form_sanitizer($_POST['page_access'], "", "page_access") : "", "page_language" => !empty($_POST['page_language']) ? form_sanitizer($_POST['page_language'], "", "page_language") : "", "page_user" => !empty($_POST['page_user']) ? form_sanitizer($_POST['page_user'], "", "page_user") : "", ]; $filter_empty = TRUE; foreach ($filter_values as $val) { if ($val) { $filter_empty = FALSE; } } echo "
\n"; echo form_text("page_title", "", $filter_values['page_title'], [ "placeholder" => self::$locale['page_0101'], "append_button" => TRUE, "append_value" => "", "append_form_value" => "search_page", "width" => "250px", "group_size" => "sm" ]); echo "
\n"; echo "
"; echo "".self::$locale['page_0107']." \n"; echo form_button("page_clear", self::$locale['page_0108'], self::$locale['page_0108'], ['class' => 'btn-default btn-sm']); echo "
\n"; echo "
\n"; add_to_jquery(" $('#toggle_options').bind('click', function(e) { e.preventDefault(); $('#page_filter_options').slideToggle(); var caret_status = $('#filter_caret').hasClass('fa-caret-down'); if (caret_status == 1) { $('#filter_caret').removeClass('fa-caret-down').addClass('fa-caret-up'); $(this).removeClass('btn-default').addClass('btn-info'); } else { $('#filter_caret').removeClass('fa-caret-up').addClass('fa-caret-down'); $(this).removeClass('btn-info').addClass('btn-default'); } }); // Select change $('#page_status, #page_access, #page_cat, #page_language, #page_user').bind('change', function(e){ $(this).closest('form').submit(); }); "); unset($filter_values['page_title']); echo "\n"; echo closeform(); ?> 0) { add_to_jquery(" $('.qform').hide(); $('#delete').bind('click', function() { confirm('".self::$locale['page_0413']."'); }); "); if ($max_pages > $rowCount) { $page_uri = clean_request('', ['aid'], TRUE); echo "
\n"; echo makepagenav($rowstart, $page_per_query, $max_pages, 3, $page_uri.'&', 'rowstart'); echo "
\n"; } echo openform('cp_table', 'post', FUSION_REQUEST); echo form_hidden('table_action', '', ''); echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; while ($pageData = dbarray($page_result)) { $pageLanguage = ''; $pageLang = explode(".", $pageData['page_language']); foreach ($pageLang as $languages) { $pageLanguage .= "".translate_lang_names($languages)."\n"; } //$pageParent = $pageData['page_cat'] == 0 ? self::$locale['page_0106'] : "".$pageData['page_cat_title']."\n"; $pageStatus = $pageData['page_status'] == 1 ? self::$locale['published'] : self::$locale['unpublished']; $edit_link = FUSION_SELF.$aidlink."&section=compose_frm&action=edit&cpid=".$pageData['page_id']; // Disable until later releases //$pageLink = clean_request('pref='.$pageData['page_id'], array('pref'), FALSE); echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; } echo "\n"; echo "
".self::$locale['page_0101']."".$locale['page_0102']."".$locale['page_0103']."".$locale['status']."".$locale['page_0118']."".$locale['page_0106']."
".form_checkbox('cp[]', '', '', [ 'value' => $pageData['page_id'], 'input_id' => 'cp-'.$pageData['page_id'], 'class' => 'm-b-0' ])."".$pageData['page_title']."".getgroupname($pageData['page_access'])."".$pageLanguage."$pageStatus\n"; if ($pageData['page_status'] == 1) { echo "".$locale['preview']." ·\n"; } echo "".$locale['edit']." ·\n"; echo "".$locale['delete']."\n"; echo "".$pageData['page_id']."
\n"; echo "
"; echo closeform(); if ($max_pages > $rowCount) { $page_uri = clean_request('', ['aid'], TRUE); echo "
\n"; echo makepagenav($rowstart, $page_per_query, $max_pages, 3, $page_uri.'&', 'rowstart'); echo "
\n"; } } else { echo "
\n".$locale['page_0440']."
"; } if (fusion_get_settings('tinymce_enabled')) { add_to_jquery(" function SetTinyMCE(val) { now=new Date();\n"."now.setTime(now.getTime()+1000*60*60*24*365); expire=(now.toGMTString());\n"."document.cookie=\"custom_pages_tinymce=\"+escape(val)+\";expires=\"+expire; location.href='".FUSION_SELF.fusion_get_aidlink()."§ion=cp2'; } "); } } }