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

Commit

Permalink
Merge pull request #79 from flatCore/develop
Browse files Browse the repository at this point in the history
Merge Develop Branch
  • Loading branch information
patkon committed Feb 10, 2022
2 parents 7b83151 + f3c6220 commit 43b6fd6
Show file tree
Hide file tree
Showing 15 changed files with 196 additions and 5,763 deletions.
2 changes: 1 addition & 1 deletion acp/core/functions.php
Expand Up @@ -915,7 +915,7 @@ function fc_write_media_data($filename,$title=NULL,$notes=NULL,$keywords=NULL,$t
$keywords = fc_return_clean_value($keywords);
$text = fc_return_clean_value($text);
$alt = fc_return_clean_value($alt);
$priority = (int) $alt;
$priority = (int) $priority;
$credit = fc_return_clean_value($credit);
$license = fc_return_clean_value($license);
$version = fc_return_clean_value($version);
Expand Down
27 changes: 26 additions & 1 deletion acp/core/functions_index.php
Expand Up @@ -524,8 +524,16 @@ function fc_delete_url($url) {
*/

function fc_get_indexed_pages() {

$dbh = new PDO("sqlite:".INDEX_DB);
$sql = "SELECT * FROM pages ORDER BY indexed_time ASC";

$limit = (int) $_SESSION['limit_index_items'];

if($limit == 0) {
$sql = "SELECT * FROM pages ORDER BY indexed_time ASC";
} else {
$sql = "SELECT * FROM pages ORDER BY indexed_time ASC LIMIT 0,$limit";
}

$items = $dbh->query($sql);
$items = $items->fetchAll(PDO::FETCH_ASSOC);
Expand All @@ -535,6 +543,23 @@ function fc_get_indexed_pages() {
return $items;
}

/**
* get the number of entries from pages table
* return int
*/

function fc_get_nbr_of_indexed_pages() {

$dbh = new PDO("sqlite:".INDEX_DB);
$sql = "SELECT COUNT(*) AS nbr FROM pages";
$items = $dbh->query($sql);
$items = $items->fetch(PDO::FETCH_ASSOC);
$dbh = null;

return (int) $items['nbr'];

}




Expand Down
27 changes: 24 additions & 3 deletions acp/core/pages.index.php
Expand Up @@ -64,15 +64,36 @@
fc_crawler_bulk();
}

if(isset($_POST['limit_index_items'])) {
$_SESSION['limit_index_items'] = (int) $_POST['limit_index_items'];
}

if(!isset($_SESSION['limit_index_items'])) {
$_SESSION['limit_index_items'] = 10;
}


// $active_btn10 ... $active_btn25 ... $active_btn0
${active_btn.$_SESSION['limit_index_items']} = 'active';

$cnt_all_indexed_entries = fc_get_nbr_of_indexed_pages();
$indexed_entries = fc_get_indexed_pages();
$cnt_indexed_entries = count($indexed_entries);
$cnt_get_indexed_entries = count($indexed_entries);

echo '<fieldset>';
echo '<legend>' . $lang['page_index'] . ' ('.$cnt_indexed_entries.')</legend>';
echo '<legend>' . $lang['page_index'] . ' ('.$cnt_all_indexed_entries.')</legend>';

echo '<div class="well well-sm">';
echo '<form action="?tn=pages&sub=index" method="POST">';
echo '<button class="btn btn-fc '.$active_btn10.'" name="limit_index_items" value="10">10</button>';
echo '<button class="btn btn-fc '.$active_btn25.'" name="limit_index_items" value="25">25</button>';
echo '<button class="btn btn-fc '.$active_btn50.'" name="limit_index_items" value="50">50</button>';
echo '<button class="btn btn-fc '.$active_btn100.'" name="limit_index_items" value="100">100</button>';
echo '<button class="btn btn-fc '.$active_btn0.'" name="limit_index_items" value="0">All (slow)</button>';
echo '<input type="hidden" name="csrf_token" value="'.$_SESSION['token'].'">';
echo '</form>';
echo '</div>';

echo '<div class="scroll-box">';
echo '<div class="p-3">';

Expand All @@ -93,7 +114,7 @@
$ce_description = 0;
$ce_title = 0;

for($i=0;$i<$cnt_indexed_entries;$i++) {
for($i=0;$i<$cnt_get_indexed_entries;$i++) {

/* reset error counter for each page */
$ce_page_img_title = 0;
Expand Down
22 changes: 17 additions & 5 deletions acp/core/pages.list.php
Expand Up @@ -7,7 +7,7 @@

unset($result);
/* $_SESSION[filter_string] was defined in inc.pages.php */
$sql = "SELECT page_id, page_language, page_linkname, page_title, page_meta_description, page_sort, page_lastedit, page_lastedit_from, page_status, page_template, page_modul, page_authorized_users, page_permalink, page_redirect, page_redirect_code, page_labels, page_psw
$sql = "SELECT page_id, page_thumbnail, page_language, page_linkname, page_title, page_meta_description, page_sort, page_lastedit, page_lastedit_from, page_status, page_template, page_modul, page_authorized_users, page_permalink, page_redirect, page_redirect_code, page_labels, page_psw
FROM fc_pages
$_SESSION[filter_string]
ORDER BY page_language ASC, page_sort *1 ASC, LENGTH(page_sort), page_sort ASC, page_linkname ASC";
Expand Down Expand Up @@ -74,6 +74,12 @@
$page_modul = $result[$i]['page_modul'];
$page_cnt_comments = $result[$i]['cnt_comments'];
$page_labels = explode(',',$result[$i]['page_labels']);
$page_thumbs = explode('<->',$result[$i]['page_thumbnail']);

$page_thumb_src = 'images/fc-logo.svg';
if($page_thumbs[0] != '') {
$page_thumb_src = $page_thumbs[0];
}

$page_lang_thumb = '<img src="/lib/lang/'.$page_language.'/flag.png" width="15" title="'.$page_language.'" alt="'.$page_language.'">';

Expand Down Expand Up @@ -186,13 +192,13 @@


$str = array(
'{status-label}','{item-linkname}','{item-title}',
'{status-label}','{item-linkname}','{item-title}','{item-tmb-src}',
'{item-mod}','{item-class}','{item-indent}','{edit-btn}','{duplicate-btn}','{info-btn}',
'{comment-btn}','{item-permalink}','{item-lastedit}','{item-pagesort}','{item-template}',
'{item-redirect}','{frontend-link}','{item-description}','{item-lang}', '{page_labels}','{item-pi}','{hidden_csrf_tokken}'
);
$rplc = array(
$status_label,$page_linkname,$page_title,
$status_label,$page_linkname,$page_title,$page_thumb_src,
$show_mod,$item_class,$indent,$edit_button,$duplicate_button,$info_button,
$page_comments_link,$page_permalink,$last_edit,$page_sort, $show_template_name,
$page_redirect,$frontend_link,$page_description,$page_lang_thumb,$label,$pi,$hidden_csrf_token
Expand Down Expand Up @@ -255,6 +261,12 @@
$page_modul = $result[$i]['page_modul'];
$page_cnt_comments = $result[$i]['cnt_comments'];
$page_labels = explode(',',$result[$i]['page_labels']);
$page_thumbs = explode('<->',$result[$i]['page_thumbnail']);

$page_thumb_src = 'images/fc-logo.svg';
if($page_thumbs[0] != '') {
$page_thumb_src = $page_thumbs[0];
}

$page_lang_thumb = '<img src="/lib/lang/'.$page_language.'/flag.png" width="15" title="'.$page_language.'" alt="'.$page_language.'">';

Expand Down Expand Up @@ -365,13 +377,13 @@
$page_comments_link = '';

$str = array(
'{status-label}','{item-linkname}','{item-title}',
'{status-label}','{item-linkname}','{item-title}','{item-tmb-src}',
'{item-mod}','{item-class}','{item-indent}','{edit-btn}','{duplicate-btn}','{info-btn}',
'{comment-btn}','{item-permalink}','{item-lastedit}','{item-pagesort}','{item-template}',
'{item-redirect}','{frontend-link}','{item-description}','{item-lang}', '{page_labels}','{item-pi}','{hidden_csrf_tokken}'
);
$rplc = array(
$status_label,$page_linkname,$page_title,
$status_label,$page_linkname,$page_title,$page_thumb_src,
$show_mod,$item_class,$indent,$edit_button,$duplicate_button,$info_button,
$page_comments_link,$page_permalink,$last_edit,$page_sort, $show_template_name,
$page_redirect,$frontend_link,$page_description,$page_lang_thumb,$label,$pi,$hidden_csrf_token
Expand Down

0 comments on commit 43b6fd6

Please sign in to comment.