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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
patkon committed Feb 5, 2021
2 parents 62ddf4d + a5955e7 commit 6208dce
Show file tree
Hide file tree
Showing 30 changed files with 263 additions and 42 deletions.
4 changes: 0 additions & 4 deletions acp/core/dashboard.addons.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
$poster_img = '<img src="images/poster-addons.jpg" class="card-img-top">';
}

if($i % 6 == 0) {
echo '<div class="w-100"></div>';
}

if(is_file("$mod_info_file")) {

unset($mod,$modnav);
Expand Down
7 changes: 6 additions & 1 deletion acp/core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,12 @@ function generate_xml_sitemap() {


$results = $db_content->select("fc_pages", "*", [
"ORDER" => ["page_lastedit" => "DESC"]
"AND" => [
"page_status[!]" => ["draft","private","ghost"]
],
"ORDER" => [
"page_lastedit" => "DESC"
]
]);

$cnt_results = count($results);
Expand Down
62 changes: 62 additions & 0 deletions acp/core/linklist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

/**
* list all pages
* used in tinyMCE's links popup
*
* {title: 'My page', value: '/my_page/'}, ...
*/

require '../../lib/Medoo.php';
use Medoo\Medoo;

include '../../config.php';
include 'functions.php';

$counter = 0;

if(is_file('../../config_database.php')) {
include '../../config_database.php';
$db_type = 'mysql';

$database = new Medoo([

'database_type' => 'mysql',
'database_name' => "$database_name",
'server' => "$database_host",
'username' => "$database_user",
'password' => "$database_psw",

'charset' => 'utf8',
'port' => $database_port,

'prefix' => DB_PREFIX
]);

$db_content = $database;

} else {
$db_type = 'sqlite';
$db_content = new Medoo([
'database_type' => 'sqlite',
'database_file' => CONTENT_DB
]);
}

$page_data = $db_content->select("fc_pages", [
"page_permalink",
"page_title"
]);

foreach($page_data as $page) {
$pages[$counter]['title'] = $page['page_title']. '-> (/'.$page['page_permalink'].')';
$pages[$counter]['value'] = '/'.$page['page_permalink'];
$counter++;
}

header('Content-type: text/javascript');
header('pragma: no-cache');
header('expires: 0');
echo json_encode($pages);

?>
5 changes: 5 additions & 0 deletions acp/core/pages.edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
"page_linkname" => "$page_linkname",
"page_permalink" => "$page_permalink",
"page_permalink_short" => "$page_permalink_short",
"page_classes" => "$page_classes",
"page_hash" => "$page_hash",
"page_type_of_use" => "$page_type_of_use",
"page_redirect" => "$page_redirect",
Expand Down Expand Up @@ -337,6 +338,7 @@
"page_linkname" => "$page_linkname",
"page_permalink" => "$page_permalink",
"page_permalink_short" => "$page_permalink_short",
"page_classes" => "$page_classes",
"page_hash" => "$page_hash",
"page_type_of_use" => "$page_type_of_use",
"page_redirect" => "$page_redirect",
Expand Down Expand Up @@ -395,6 +397,7 @@
"page_linkname" => "$page_linkname",
"page_permalink" => "$page_permalink",
"page_permalink_short" => "$page_permalink_short",
"page_classes" => "$page_classes",
"page_hash" => "$page_hash",
"page_type_of_use" => "$page_type_of_use",
"page_redirect" => "$page_redirect",
Expand Down Expand Up @@ -466,6 +469,7 @@
"page_linkname" => "$page_linkname",
"page_permalink" => "$page_language",
"page_permalink_short" => "$page_permalink_short",
"page_classes" => "$page_classes",
"page_hash" => "$page_hash",
"page_type_of_use" => "$page_type_of_use",
"page_redirect" => "$page_redirect",
Expand Down Expand Up @@ -530,6 +534,7 @@
"page_linkname" => "$page_linkname",
"page_permalink" => "$page_language",
"page_permalink_short" => "$page_permalink_short",
"page_classes" => "$page_classes",
"page_hash" => "$page_hash",
"page_type_of_use" => "$page_type_of_use",
"page_redirect" => "$page_redirect",
Expand Down
7 changes: 5 additions & 2 deletions acp/core/pages.edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,13 @@
echo'<div class="tab-pane fade show active" id="info">';

echo '<div class="row">';
echo '<div class="col-md-9">';
echo '<div class="col-md-5">';
echo tpl_form_control_group('',$lang['f_page_linkname'],'<input class="form-control" type="text" name="page_linkname" value="'.$page_linkname.'">');
echo '</div>';
echo '<div class="col-md-3">';
echo '<div class="col-md-4">';
echo tpl_form_control_group('',$lang['f_page_classes'],"<input class='form-control' type='text' name='page_classes' value='$page_classes'>");
echo '</div>';
echo '<div class="col-md-2 offset-md-1">';
echo tpl_form_control_group('',$lang['f_page_hash'],"<input class='form-control' type='text' name='page_hash' value='$page_hash'>");
echo '</div>';
echo '</div>';
Expand Down
23 changes: 20 additions & 3 deletions acp/core/posts.edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,17 @@
$select_tax .= '<option value="3" '.$sel_tax_3.'>'.$fc_preferences['prefs_posts_products_tax_alt2'].'</option>';
$select_tax .= '</select>';

$post_product_price_net = $post_data['post_product_price_net'];
if($post_product_price_net == '') {
$post_product_price_net = '0,00';
}

$post_product_currency = $post_data['post_product_currency'];
if($post_product_currency == '') {
$post_product_currency = $fc_preferences['prefs_posts_products_default_currency'];
}


/* add text snippet to prices */

$snippet_select_pricelist = '<select class="form-control custom-select" name="post_product_textlib_price">';
Expand Down Expand Up @@ -450,11 +461,17 @@
} else if ($_GET['new'] == 'g' OR $post_data['post_type'] == 'g') {
$form_tpl = file_get_contents('templates/post_gallery.tpl');

if($post_data['post_id'] == '') {
$form_tpl = str_replace('{disabled_upload_btn}','disabled', $form_tpl);
} else {
$form_tpl = str_replace('{disabled_upload_btn}','', $form_tpl);
}


$form_upload_tpl = file_get_contents('templates/gallery_upload_form.tpl');
$form_upload_tpl = str_replace('{token}',$_SESSION['token'], $form_upload_tpl);
$form_upload_tpl = str_replace('{post_id}',$post_data['post_id'], $form_upload_tpl);
$form_upload_tpl = str_replace('{disabled_upload_btn}','disabled', $form_upload_tpl);


$form_sort_tpl = file_get_contents('templates/gallery_sort_form.tpl');

Expand Down Expand Up @@ -521,11 +538,11 @@
$form_tpl = str_replace('{post_product_number}', $post_data['post_product_number'], $form_tpl);
$form_tpl = str_replace('{post_product_manufacturer}', $post_data['post_product_manufacturer'], $form_tpl);
$form_tpl = str_replace('{post_product_supplier}', $post_data['post_product_supplier'], $form_tpl);
$form_tpl = str_replace('{post_product_currency}', $post_data['post_product_currency'], $form_tpl);
$form_tpl = str_replace('{post_product_currency}', $post_product_currency, $form_tpl);
$form_tpl = str_replace('{post_product_price_label}', $post_data['post_product_price_label'], $form_tpl);
$form_tpl = str_replace('{post_product_amount}', $post_data['post_product_amount'], $form_tpl);
$form_tpl = str_replace('{post_product_unit}', $post_data['post_product_unit'], $form_tpl);
$form_tpl = str_replace('{post_product_price_net}', $post_data['post_product_price_net'], $form_tpl);
$form_tpl = str_replace('{post_product_price_net}', $post_product_price_net, $form_tpl);
$form_tpl = str_replace('{post_product_price_gross}', $post_product_price_gross, $form_tpl);
$form_tpl = str_replace('{select_tax}', $select_tax, $form_tpl);
$form_tpl = str_replace('{snippet_select_pricelist}', $snippet_select_pricelist, $form_tpl);
Expand Down
14 changes: 13 additions & 1 deletion acp/core/posts.list.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,22 @@
$show_items_price = '';
if($get_posts[$i]['post_type'] == 'p') {

$post_price_gross = $get_posts[$i]['post_product_price_net']*($get_posts[$i]['post_product_tax']+100)/100;
if($get_posts[$i]['post_product_tax'] == '1') {
$tax = $fc_preferences['prefs_posts_products_default_tax'];
} else if($get_posts[$i]['post_product_tax'] == '2') {
$tax = $fc_preferences['prefs_posts_products_tax_alt1'];
} else {
$tax = $fc_preferences['prefs_posts_products_tax_alt2'];
}

$post_price_net = str_replace('.', '', $get_posts[$i]['post_product_price_net']);
$post_price_net = str_replace(',', '.', $post_price_net);

$post_price_gross = $post_price_net*($tax+100)/100;
$post_price_gross = fc_post_print_currency($post_price_gross);

$show_items_price = '<div class="float-right small well well-sm">';
$show_items_price .= $post_price_net . ' ('.$tax.'%)<br>';
$show_items_price .= $post_price_gross;
$show_items_price .= '</div>';
}
Expand Down
6 changes: 5 additions & 1 deletion acp/templates/gallery_upload_form.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
</div>
</div>

<form action="acp.php?tn=posts&sub=edit" method="POST" id="reload_form">
<input type="hidden" name="post_id" value="{post_id}">
</form>

<script>
$(function() {
$('#uploadGalModal').on('hidden.bs.modal', function (e) {
window.location.assign("acp.php?tn=posts&sub=edit&post_id={post_id}")
$("#reload_form").submit();
});
});
</script>
6 changes: 3 additions & 3 deletions acp/versions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$fc_version_date = '2021-01-04';
$fc_version_name = '2.0.0';
$fc_version_build = '139';
$fc_version_date = '2021-02-05';
$fc_version_name = '2.0.1';
$fc_version_build = '143';
?>
7 changes: 5 additions & 2 deletions core/functions/func_get_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function get_content($page, $mode = 'p') {
$nav_sql_filter = "WHERE page_status != 'draft' AND page_status != 'ghost' AND page_language = '$languagePack'";
}

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

$fc_nav = $db_content->query("$nav_sql")->fetchAll();
Expand Down Expand Up @@ -156,7 +156,10 @@ function fc_get_type_of_use_pages($type) {
global $languagePack;

$page = $db_content->get("fc_pages", ["page_permalink", "page_funnel_uri"], [
"page_type_of_use" => "$type"
"AND" => [
"page_type_of_use" => "$type",
"page_language" => "$languagePack"
]
]);

return $page;
Expand Down
3 changes: 3 additions & 0 deletions core/functions/func_navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function show_mainmenu() {
$menu[$i]['page_title'] = stripslashes($fc_nav[$i]['page_title']);
$menu[$i]['page_permalink'] = $fc_nav[$i]['page_permalink'];
$menu[$i]['page_hash'] = $fc_nav[$i]['page_hash'];
$menu[$i]['page_classes'] = $fc_nav[$i]['page_classes'];
$menu[$i]['link_status'] = $fc_defs['main_nav_class'];

if(left_string($current_page_sort) == left_string($menu[$i]['page_sort']) ) {
Expand Down Expand Up @@ -149,6 +150,7 @@ function build_submenu($index,$level=1) {
$submenu[$index]['page_sort'] = $fc_nav[$index]['page_sort'];
$submenu[$index]['page_permalink'] = $fc_nav[$index]['page_permalink'];
$submenu[$index]['page_hash'] = $fc_nav[$index]['page_hash'];
$submenu[$index]['page_classes'] = $fc_nav[$index]['page_classes'];
$submenu[$index]['page_linkname'] = stripslashes($fc_nav[$index]['page_linkname']);
$submenu[$index]['page_title'] = stripslashes($fc_nav[$index]['page_title']);

Expand Down Expand Up @@ -194,6 +196,7 @@ function show_sitemap() {
$page_title = $fc_nav[$i]['page_title'];
$page_status = $fc_nav[$i]['page_status'];
$page_hash = $fc_nav[$i]['page_hash'];
$page_classes = $fc_nav[$i]['page_classes'];
$page_permalink = $fc_nav[$i]['page_permalink'];

$li_class = '';
Expand Down
42 changes: 40 additions & 2 deletions core/posts-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@
$post_lastedit = date('Y-m-d H:i',$post_data['lastedit']);
$post_lastedit_from = $post_data['post_lastedit_from'];

/* categories */
$tpl_category_link = fc_load_posts_tpl($fc_template,'link-categories.tpl');
$cat_links_array = explode('<->',$post_data['post_categories']);

foreach($all_categories as $cats) {

$link = $tpl_category_link;

if(in_array($cats['cat_id'],$cat_links_array)) {
$post_cats_string .= $cats['cat_name'] .' ';
$cat_href = '/'.$fct_slug.$cats['cat_name_clean'];
$link = str_replace('{cat_href}', $cat_href, $link);
$link = str_replace('{cat_name}', $cats['cat_name'], $link);
$post_cats_btn .= $link;

}
}


/* event dates */

Expand Down Expand Up @@ -104,6 +122,11 @@
$this_entry = str_replace("{post_type}", $post_data['post_type'], $this_entry);
$this_entry = str_replace('{post_img_src}', $first_post_image, $this_entry);

$this_entry = str_replace("{post_source}", $post_data['post_source'], $this_entry);
$this_entry = str_replace("{post_product_manufacturer}", $post_data['post_product_manufacturer'], $this_entry);
$this_entry = str_replace("{post_product_supplier}", $post_data['post_product_supplier'], $this_entry);
$this_entry = str_replace("{post_product_number}", $post_data['post_product_number'], $this_entry);

$this_entry = str_replace("{post_releasedate_ts}", $post_data['post_releasedate'], $this_entry); /* timestring */
$this_entry = str_replace("{post_releasedate}", $post_releasedate, $this_entry);
$this_entry = str_replace("{post_releasedate_year}", $post_releasedate_year, $this_entry);
Expand All @@ -127,7 +150,8 @@

$this_entry = str_replace("{video_id}", $video['v'], $this_entry);
$this_entry = str_replace("{post_external_link}", $post_data['post_link'], $this_entry);
$this_entry = str_replace("{post_cats}", $cat_links_string, $this_entry);
$this_entry = str_replace("{post_cats}", $post_cats_btn, $this_entry);
$this_entry = str_replace("{post_cats_string}", $post_cats_string, $this_entry);
$this_entry = str_replace("{back_to_overview}", $lang['back_to_overview'], $this_entry);
$this_entry = str_replace("{back_link}", "/$fct_slug", $this_entry);

Expand All @@ -139,9 +163,23 @@
$this_entry = str_replace("{post_file_attachment}", $filepath, $this_entry);

/* products */
$post_price_gross = $post_data['post_product_price_net']*($post_data['post_product_tax']+100)/100;;
if($post_data['post_product_tax'] == '1') {
$tax = $fc_prefs['prefs_posts_products_default_tax'];
} else if($post_data['post_product_tax'] == '2') {
$tax = $fc_prefs['prefs_posts_products_tax_alt1'];
} else {
$tax = $fc_prefs['prefs_posts_products_tax_alt2'];
}

$post_product_price_net = str_replace('.', '', $post_data['post_product_price_net']);
$post_product_price_net = str_replace(',', '.', $post_product_price_net);

$post_price_gross = $post_product_price_net*($tax+100)/100;
$post_price_gross = fc_post_print_currency($post_price_gross);
$post_price_net = fc_post_print_currency($post_product_price_net);
$this_entry = str_replace("{post_price_gross}", $post_price_gross, $this_entry);
$this_entry = str_replace("{post_price_net}", $post_price_net, $this_entry);
$this_entry = str_replace("{post_price_tax}", $tax, $this_entry);
$this_entry = str_replace("{post_currency}", $post_data['post_product_currency'], $this_entry);
$this_entry = str_replace("{post_product_unit}", $post_data['post_product_unit'], $this_entry);
$this_entry = str_replace("{post_product_amount}", $post_data['post_product_amount'], $this_entry);
Expand Down
Loading

0 comments on commit 6208dce

Please sign in to comment.