From 46c785a6f88e762ef115eee6a182129c51669bb6 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 22 Mar 2021 20:11:20 +0100 Subject: [PATCH 01/11] add labels to shortcodes --- acp/core/pages.shortcodes.php | 70 +++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/acp/core/pages.shortcodes.php b/acp/core/pages.shortcodes.php index bbc49993..8c897fc2 100644 --- a/acp/core/pages.shortcodes.php +++ b/acp/core/pages.shortcodes.php @@ -6,6 +6,15 @@ /*save or update shortcode */ if(isset($_POST['write_shortcode'])) { + /* labels */ + $arr_labels = $_POST['shortcode_labels']; + if(is_array($arr_labels)) { + sort($arr_labels); + $string_labels = implode(",", $arr_labels); + } else { + $string_labels = ""; + } + if($_POST['shortcode_id'] != '') { $db_mode = 'update'; @@ -20,6 +29,7 @@ $data = $db_content->update("fc_textlib", [ "textlib_content" => $_POST['longcode'], "textlib_shortcode" => $_POST['shortcode'], + "textlib_labels" => $string_labels, "textlib_type" => "shortcode" ],[ "textlib_id" => $shortcode_id @@ -31,6 +41,7 @@ $data = $db_content->insert("fc_textlib", [ "textlib_content" => $_POST['longcode'], "textlib_shortcode" => $_POST['shortcode'], + "textlib_labels" => $string_labels, "textlib_type" => "shortcode" ]); @@ -71,7 +82,7 @@ echo '
'; -echo '
'; +echo '
'; echo ''; @@ -79,6 +90,7 @@ echo ''; echo ''; echo ''; +echo ''; echo ''; echo ''; echo ''; @@ -92,9 +104,33 @@ $btn_delete .= ''; $btn_delete .= ''; + $get_sc_labels = explode(',',$shortcodes[$i]['textlib_labels']); + + + $label = ''; + if($shortcodes[$i]['textlib_labels'] != '') { + foreach($get_sc_labels as $sc_label) { + + foreach($fc_labels as $l) { + if($sc_label == $l['label_id']) { + $label_color = $l['label_color']; + $label_title = $l['label_title']; + } + } + + $label .= ''; + } + } + + $longcode = htmlentities($shortcodes[$i]['textlib_content']); + if(strlen($longcode) > 75) { + $longcode = substr($longcode, 0,75). ' (...)'; + } + echo ''; echo ''; - echo ''; + echo ''; + echo ''; echo ''; echo ''; } @@ -104,7 +140,7 @@ echo ''; -echo '
'; +echo '
'; echo '
'; echo '
'; @@ -120,6 +156,34 @@ echo '
'; + +$cnt_labels = count($fc_labels); +$arr_checked_labels = explode(",", $get_shortcode['textlib_labels']); + +for($i=0;$i<$cnt_labels;$i++) { + $label_title = $fc_labels[$i]['label_title']; + $label_id = $fc_labels[$i]['label_id']; + $label_color = $fc_labels[$i]['label_color']; + + if(in_array("$label_id", $arr_checked_labels)) { + $checked_label = "checked"; + } else { + $checked_label = ""; + } + + $checkbox_set_labels .= '
'; + $checkbox_set_labels .= ''; + $checkbox_set_labels .= ''; + $checkbox_set_labels .= '
'; +} + +echo '
'; +echo '

'.$lang['labels'].'

'; +echo $checkbox_set_labels; +echo '
'; + + + echo ''; if($get_shortcode['textlib_id'] != '') { From 8c60783579038f26765c2f8d6d707a13e3b24011 Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 23 Mar 2021 09:31:25 +0100 Subject: [PATCH 02/11] do not show shortcodes in snippets list --- acp/core/pages.snippets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acp/core/pages.snippets.php b/acp/core/pages.snippets.php index 8d5d5f09..808ced0e 100644 --- a/acp/core/pages.snippets.php +++ b/acp/core/pages.snippets.php @@ -210,7 +210,7 @@ } $snippet_label_filter = substr("$snippet_label_filter", 0, -3); // cut the last ' OR' -$filter_string = "WHERE textlib_id IS NOT NULL"; +$filter_string = "WHERE textlib_id IS NOT NULL AND textlib_type NOT IN('shortcode')"; if($_SESSION['type'] == 'all') { $filter_type = ''; From c8f0a32ad5f9dfdb0cf338c0ec819c134f2ce57e Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 23 Mar 2021 19:50:03 +0100 Subject: [PATCH 03/11] fix - reset theme options --- acp/core/list.themes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acp/core/list.themes.php b/acp/core/list.themes.php index a7299f27..961618aa 100644 --- a/acp/core/list.themes.php +++ b/acp/core/list.themes.php @@ -132,7 +132,7 @@ echo '
'; - + unset($theme_options); if(is_file("../styles/$template/php/options.php")) { include '../styles/'.$template.'/php/options.php'; } From ee9ea89c0845cfaebb22ecbf6076859fa029a888 Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 23 Mar 2021 20:21:36 +0100 Subject: [PATCH 04/11] add reload button --- acp/core/upload_addons.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acp/core/upload_addons.php b/acp/core/upload_addons.php index 0362d593..377e10ec 100644 --- a/acp/core/upload_addons.php +++ b/acp/core/upload_addons.php @@ -287,7 +287,7 @@ echo ''.$lang['label_ready_to_install'].''; if(count($all_uploads) < 1) { - echo '

'.$lang['msg_nothing_to_install'].'

'; + echo '

'.$lang['msg_nothing_to_install'].' '.$icon['sync_alt'].' reload

'; } else { echo '
ShortcodeLongcodeLabel
'.$shortcodes[$i]['textlib_shortcode'].''.htmlentities($shortcodes[$i]['textlib_content']).''.$longcode.''.$label.''.$btn_edit.' '.$btn_delete.'
'; From 69bc2815397446cef1ca6d309f3aa1e0798cbc57 Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 23 Mar 2021 21:27:50 +0100 Subject: [PATCH 05/11] new - let the user choose a theme --- index.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/index.php b/index.php index ef3cd468..ed00e945 100644 --- a/index.php +++ b/index.php @@ -221,6 +221,23 @@ } +/* reset of the user-defined theme */ +if(isset($_POST['reset_theme'])) { + unset($_SESSION['prefs_template']); +} + +/* set the theme defined by the user */ +if(isset($_POST['set_theme'])) { + $set_theme = 'styles/'.sanitizeUserInputs($_POST['set_theme']); + if(is_dir($set_theme)) { + $_SESSION['prefs_template'] = sanitizeUserInputs($_POST['set_theme']); + } +} + +if($_SESSION['prefs_template'] != '') { + $prefs_template = $_SESSION['prefs_template']; +} + // default template $fc_template = $prefs_template; $fc_template_layout = $prefs_template_layout; From 1083eb40b4ff3ef2e44ccda8a5ac432050d288d5 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 24 Mar 2021 09:11:24 +0100 Subject: [PATCH 06/11] fix - deleting single pages --- acp/core/pages.edit.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/acp/core/pages.edit.php b/acp/core/pages.edit.php index c144b46e..66028c86 100755 --- a/acp/core/pages.edit.php +++ b/acp/core/pages.edit.php @@ -81,12 +81,14 @@ ] ]); } else { - $subpages = ''; + $subpages = array(); } - if(count($subpages) > 0) { + $cnt_subpages = count($subpages); + + if($cnt_subpages > 0) { echo '
'; - echo $lang['msg_error_deleting_sub_pages']; + echo $lang['msg_error_deleting_sub_pages'] .' ('.$cnt_subpages.')'; echo '
    '; foreach($subpages as $pages) { echo '
  1. '.$pages['page_title'].'
  2. '; From bf5a9fc5a536f3a74b33af514a2244d0ac8cde0e Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 25 Mar 2021 09:02:13 +0100 Subject: [PATCH 07/11] reduced height, a little bit --- acp/core/dashboard.top.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/acp/core/dashboard.top.php b/acp/core/dashboard.top.php index 45dd0412..4183cb78 100644 --- a/acp/core/dashboard.top.php +++ b/acp/core/dashboard.top.php @@ -53,10 +53,12 @@ } $user_latest5 .= ''; $user_latest5 .= '
    '; - $user_latest5 .= '
    '.$user_nick.'
    '; + $user_latest5 .= '
    '; + $user_latest5 .= '
    '.$user_nick.'
    '; + $user_latest5 .= ''.$user_name.''; + $user_latest5 .= '
    '; $user_latest5 .= ''.$user_registerdate.''; $user_latest5 .= '
    '; - $user_latest5 .= ''.$user_name.''; $user_latest5 .= '
    '; } @@ -104,13 +106,16 @@ $top5pages .= '
    '; $top5pages .= '
    '; + $top5pages .= '
    '; $top5pages .= '
    '.$page_linkname.' '; $top5pages .= '('.$last_edit.')
    '; + $top5pages .= ''.$page_title.''; + $top5pages .= '
    '; $top5pages .= '
    '; $top5pages .= ''; $top5pages .= ''; $top5pages .= '
    '; - $top5pages .= ''.$page_title.''; + $top5pages .= '
    '; } @@ -147,13 +152,16 @@ $top5posts .= '
    '; $top5posts .= '
    '; + $top5posts .= '
    '; $top5posts .= '
    '.$allPosts[$i]['post_title'].' '; $top5posts .= '('.$last_edit.')
    '; + $top5posts .= ''.$post_teaser.''; + $top5posts .= '
    '; $top5posts .= '
    '; $top5posts .= ''; $top5posts .= ''; $top5posts .= '
    '; - $top5posts .= ''.$post_teaser.''; + $top5posts .= '
    '; } @@ -182,14 +190,16 @@ $top5comments .= '
    '; $top5comments .= '
    '; + $top5comments .= '
    '; $top5comments .= '
    '.$allComments[$i]['comment_author'].' '; $top5comments .= '('.$last_edit.')
    '; + $top5comments .= ''.$comment_text.''; + $top5comments .= '
    '; $top5comments .= '
    '; $top5comments .= ''; $top5comments .= ''; $top5comments .= '
    '; - $top5comments .= ''.$comment_text.''; - $top5comments .= '
    '; + $top5comments .= '
'; } From 9c2a09ebab456b9437f9246f0ad7b57d376bf93e Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 25 Mar 2021 10:26:12 +0100 Subject: [PATCH 08/11] add some buttons to perform certain actions faster --- acp/core/dashboard.top.php | 36 +++++++++++++++++++++++++++++++++ acp/templates/dashboard_top.tpl | 15 ++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/acp/core/dashboard.top.php b/acp/core/dashboard.top.php index 4183cb78..bc14994b 100644 --- a/acp/core/dashboard.top.php +++ b/acp/core/dashboard.top.php @@ -3,6 +3,19 @@ //prohibit unauthorized access require 'core/access.php'; +if(isset($_GET['a'])) { + + if($_GET['a'] == 'delete_cache') { + fc_delete_smarty_cache('all'); + } + if($_GET['a'] == 'update_index') { + fc_update_bulk_page_index(); + } + +} + + + $tpl_file = file_get_contents('templates/dashboard_top.tpl'); /* get latest infos from user database */ @@ -271,6 +284,29 @@ $tpl_file = str_replace('{tab_user}', $lang['tn_usermanagement'], $tpl_file); $tpl_file = str_replace('{tab_user_stats}', $lang['h_status'], $tpl_file); +$btn_page_overview = ''.$icon['sitemap'].''; +$btn_new_page = ''.$icon['plus'].' '.$lang['new_page'].''; +$btn_update_index = ''.$icon['sync_alt'].' Index'; +$btn_delete_cache = ''.$icon['trash_alt'].' Cache'; + +$btn_post_overview = ''.$lang['tn_posts'].''; +$btn_new_post = ''.$icon['plus'].' '.$lang['label_new_post'].''; +$btn_comments_overview = ''.$lang['tn_comments'].''; + +$btn_user_overview = ''.$lang['list_user'].''; +$btn_new_user = ''.$icon['plus'].' '.$lang['new_user'].''; + +$tpl_file = str_replace('{btn_page_overview}', $btn_page_overview, $tpl_file); +$tpl_file = str_replace('{btn_new_page}', $btn_new_page, $tpl_file); +$tpl_file = str_replace('{btn_update_index}', $btn_update_index, $tpl_file); +$tpl_file = str_replace('{btn_delete_cache}', $btn_delete_cache, $tpl_file); + +$tpl_file = str_replace('{btn_post_overview}', $btn_post_overview, $tpl_file); +$tpl_file = str_replace('{btn_new_post}', $btn_new_post, $tpl_file); +$tpl_file = str_replace('{btn_comments_overview}', $btn_comments_overview, $tpl_file); + +$tpl_file = str_replace('{btn_user_overview}', $btn_user_overview, $tpl_file); +$tpl_file = str_replace('{btn_new_user}', $btn_new_user, $tpl_file); echo $tpl_file; diff --git a/acp/templates/dashboard_top.tpl b/acp/templates/dashboard_top.tpl index 416e9095..3935d785 100644 --- a/acp/templates/dashboard_top.tpl +++ b/acp/templates/dashboard_top.tpl @@ -8,6 +8,7 @@ +
{pages_list} @@ -18,6 +19,10 @@
+ +
@@ -27,6 +32,7 @@
+
{posts_list} @@ -35,6 +41,10 @@ {comments_list}
+
+ @@ -45,6 +55,7 @@ +
{user_list} @@ -55,6 +66,10 @@
+ + From ae4ee1e9e5679ef7128e44487f4bf8838c62411c Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 26 Mar 2021 09:14:22 +0100 Subject: [PATCH 09/11] add date and time settings --- acp/core/system.syspref.php | 112 ++++++++++++++++++++++++++++ install/contents/fc_preferences.php | 6 ++ lib/lang/de/dict-backend.php | 5 ++ lib/lang/en/dict-backend.php | 5 ++ 4 files changed, 128 insertions(+) diff --git a/acp/core/system.syspref.php b/acp/core/system.syspref.php index 15adf7b7..a066a5a3 100644 --- a/acp/core/system.syspref.php +++ b/acp/core/system.syspref.php @@ -50,6 +50,20 @@ } +/* save date/time settings */ + +if(isset($_POST['save_datetime'])) { + + $data = $db_content->update("fc_preferences", [ + "prefs_timezone" => $prefs_timezone, + "prefs_dateformat" => $prefs_dateformat, + "prefs_timeformat" => $prefs_timeformat + ], [ + "prefs_id" => 1 + ]); + +} + @@ -242,7 +256,105 @@ echo ''; echo ''; +$timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL); + +/* date and time settings */ +echo '
'; + +echo '
'; +echo ''.$lang['label_datetime_settings'].''; +echo '
'; + +echo '
'; +echo ''; +echo ''; +echo '
'; + + +$date_formats = array("Y-m-d","d.m.Y","d/m/Y","m/d/Y"); + +echo '
'; +echo ''; +echo ''; +echo '
'; + +$time_formats = array("H:i","g:i a","g:i A"); + +echo '
'; +echo ''; +echo ''; +echo '
'; + + + +echo ''; +echo ''; +echo ''; +echo '
'; /* User Preferences */ echo '
'; diff --git a/install/contents/fc_preferences.php b/install/contents/fc_preferences.php index 2976e864..6a05ef6e 100644 --- a/install/contents/fc_preferences.php +++ b/install/contents/fc_preferences.php @@ -54,6 +54,12 @@ "prefs_anonymize_ip" => "VARCHAR(20) NOT NULL DEFAULT ''", "prefs_xml_sitemap" => "VARCHAR(20) NOT NULL DEFAULT ''", + /* Date and Time */ + + "prefs_timezone" => "VARCHAR(20) NOT NULL DEFAULT ''", + "prefs_dateformat" => "VARCHAR(100) NOT NULL DEFAULT ''", + "prefs_timeformat" => "VARCHAR(100) NOT NULL DEFAULT ''", + /* E-Mail */ "prefs_mailer_adr" => "VARCHAR(100) NOT NULL DEFAULT ''", diff --git a/lib/lang/de/dict-backend.php b/lib/lang/de/dict-backend.php index c32076c7..fc8fbf5e 100644 --- a/lib/lang/de/dict-backend.php +++ b/lib/lang/de/dict-backend.php @@ -456,6 +456,11 @@ $lang['acp_session_lifetime'] = 'ACP Session Lifetime (Sekunden)'; +$lang['label_datetime_settings'] = 'Datums- und Uhrzeit-Einstellungen'; +$lang['label_datetime_timezone'] = 'Zeitzone'; +$lang['label_datetime_dateformat'] = 'Datumsformat'; +$lang['label_datetime_timeformat'] = 'Zeitformat'; + /* Rights Management */ $lang['drm_description'] = "Der Benutzer darf folgende Aktionen durchführen"; diff --git a/lib/lang/en/dict-backend.php b/lib/lang/en/dict-backend.php index 3b6be252..7ca5c499 100644 --- a/lib/lang/en/dict-backend.php +++ b/lib/lang/en/dict-backend.php @@ -456,6 +456,11 @@ $lang['acp_session_lifetime'] = 'ACP Session Lifetime (Seconds)'; +$lang['label_datetime_settings'] = 'Date and Time Settings'; +$lang['label_datetime_timezone'] = 'Timezone'; +$lang['label_datetime_dateformat'] = 'Dateformat'; +$lang['label_datetime_timeformat'] = 'Timeformat'; + /* rights management */ From 27ff5f76a8ee531d4677b1d8450dd0c810d7159a Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 26 Mar 2021 09:25:25 +0100 Subject: [PATCH 10/11] use date/time settings from preferences --- core/posts-display.php | 2 +- core/posts-list.php | 5 ++--- index.php | 11 +++++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/core/posts-display.php b/core/posts-display.php index 8c54bde6..160020cc 100644 --- a/core/posts-display.php +++ b/core/posts-display.php @@ -7,7 +7,7 @@ $post_images = explode("<->", $post_data['post_images']); -$post_releasedate = date('Y-m-d H:i',$post_data['post_releasedate']); +$post_releasedate = date("$prefs_dateformat $prefs_timeformat",$post_data['post_releasedate']); $post_releasedate_year = date('Y',$post_data['post_releasedate']); $post_releasedate_month = date('m',$post_data['post_releasedate']); $post_releasedate_day = date('d',$post_data['post_releasedate']); diff --git a/core/posts-list.php b/core/posts-list.php index 3473e1b3..9fffd077 100644 --- a/core/posts-list.php +++ b/core/posts-list.php @@ -126,11 +126,11 @@ $posts_list = ''; foreach($get_posts as $k => $post) { - $post_releasedate = date('Y-m-d',$get_posts[$k]['post_releasedate']); + $post_releasedate = date($prefs_dateformat,$get_posts[$k]['post_releasedate']); $post_releasedate_year = date('Y',$get_posts[$k]['post_releasedate']); $post_releasedate_month = date('m',$get_posts[$k]['post_releasedate']); $post_releasedate_day = date('d',$get_posts[$k]['post_releasedate']); - $post_releasedate_time = date('H:i:s',$get_posts[$k]['post_releasedate']); + $post_releasedate_time = date($prefs_timeformat,$get_posts[$k]['post_releasedate']); /* event dates */ @@ -224,7 +224,6 @@ $post_teaser = htmlspecialchars_decode($get_posts[$k]['post_teaser']); $post_text = htmlspecialchars_decode($get_posts[$k]['post_text']); - $post_releasedate = date('d.m.Y',$get_posts[$k]['post_releasedate']); $post_categories = explode('<->',$get_posts[$k]['post_categories']); $cat_str = ''; diff --git a/index.php b/index.php index ed00e945..876b2972 100644 --- a/index.php +++ b/index.php @@ -194,6 +194,17 @@ $$key = stripslashes($val); } + +if($prefs_dateformat == '') { + $prefs_dateformat = 'Y-m-d'; +} + +if($prefs_timeformat == '') { + $prefs_timeformat = 'H:i:s'; +} + + + if(!empty($page_contents['page_modul'])) { include 'modules/'.$page_contents['page_modul'].'/index.php'; } From e810a1c98b76de553c6db163b9a4ed9aecc72e51 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 26 Mar 2021 09:26:41 +0100 Subject: [PATCH 11/11] increase version information (build 155) --- acp/versions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acp/versions.php b/acp/versions.php index 1019df85..865e91ee 100755 --- a/acp/versions.php +++ b/acp/versions.php @@ -1,5 +1,5 @@ \ No newline at end of file