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

Commit c00df88

Browse files
committed
Initial commit
0 parents  commit c00df88

18 files changed

+1607
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.DS_Store
2+
.DS_Store?
3+
._*
4+
.Spotlight-V100
5+
.Trashes
6+
Icon?
7+
ehthumbs.db
8+
Thumbs.db
9+
10+
index.html

LICENSE

+674
Large diffs are not rendered by default.

ajaxform/form.tpl

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<form id="ajaxform">
2+
<label>Name <sup>*</sup></label>
3+
<input type="text" name="af_sender_name" class="form-control mb-2" value="{sender_name}">
4+
<label>E-Mail <sup>*</sup></label>
5+
<input type="email" name="af_sender_mail" class="form-control mb-2" value="{sender_mail}">
6+
<label>Message <sup>*</sup></label>
7+
<textarea name="af_sender_message" class="form-control mb-2">{sender_message}</textarea>
8+
9+
<div class="checkbox">
10+
<label>
11+
<input type="checkbox" name="privacy_policy" value="accept"> I have read, understood and accept the privacy policy.
12+
</label>
13+
</div>
14+
15+
<button class="btn btn-success" type="submit" name="sendform" value="send">SEND</button>
16+
<input type="hidden" name="csrf_token" value="{csrf_token}">
17+
</form>
18+
<p><sup>*</sup> mandatory fields</p>

ajaxform/index.php

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
/**
4+
* Plugin: SIMPLE E-MAIL FORM
5+
* Version: Version: 0.1
6+
* Requirement: flatCore 2.0.+
7+
* License: GPL-3.0 License
8+
* copyright (c) 2021, Patrick Konstandin
9+
*
10+
*/
11+
12+
$plugin = array();
13+
$plugin['title'] = 'contact form';
14+
$plugin['description'] = '<p>send requests via e-mail to prefs_mailer_adr</p>';
15+
$plugin['version'] = '1.0';
16+
$plugin['author'] = 'flatCore.org';
17+
18+
if(FC_SOURCE == 'frontend') {
19+
20+
global $fc_prefs;
21+
global $fct_slug;
22+
23+
$tpl = file_get_contents('content/plugins/ajaxform/form.tpl');
24+
$tpl = str_replace('{sender_name}', '', $tpl);
25+
$tpl = str_replace('{sender_mail}', '', $tpl);
26+
$tpl = str_replace('{sender_message}', '', $tpl);
27+
$tpl = str_replace('{csrf_token}', $_SESSION['visitor_csrf_token'], $tpl);
28+
29+
echo '<div id="ajaxform_response"></div>';
30+
31+
echo '<div class="card p-3 mb-3">';
32+
echo $tpl;
33+
echo '</div>';
34+
}
35+
36+
?>
37+
38+
<script>
39+
$(function () {
40+
41+
$('#ajaxform').on('submit', function (e) {
42+
43+
e.preventDefault();
44+
45+
$.ajax({
46+
type: 'POST',
47+
url: 'content/plugins/ajaxform/send.php',
48+
data: $('#ajaxform').serialize(),
49+
dataType : 'json',
50+
success: function(response) {
51+
52+
if(response.type == 'error') {
53+
output = '<div class="alert alert-danger">'+response.text+'</div>';
54+
} else {
55+
output = '<div class="alert alert-success">'+response.text+'</div>';
56+
57+
$('#ajaxform input[type=text]').val('');
58+
$('#ajaxform input[type=email]').val('');
59+
$('#ajaxform textarea').val('');
60+
$('#ajaxform input[type=checkbox]').prop('checked', false);
61+
}
62+
63+
$("#ajaxform_response").hide().html(output).slideDown();
64+
65+
},
66+
async: false
67+
});
68+
});
69+
});
70+
</script>

ajaxform/send.php

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
3+
error_reporting(0);
4+
5+
define('FC_SOURCE', 'frontend');
6+
7+
include_once '../../../config.php';
8+
include_once '../../../database.php';
9+
include_once '../../../global/functions.php';
10+
11+
$fc_prefs = fc_get_preferences();
12+
13+
$recipient['name'] = $fc_prefs['prefs_mailer_name'];
14+
$recipient['mail'] = $fc_prefs['prefs_mailer_adr'];
15+
16+
$prefs_mailer_adr = $recipient['mail'];
17+
$prefs_mailer_name = $recipient['name'];
18+
19+
if(is_file('../../../content/config_smtp.php')) {
20+
include '../../../content/config_smtp.php';
21+
$prefs_mailer_type = 'smtp';
22+
}
23+
24+
$send_mail = 'true';
25+
$error_msg = '';
26+
27+
if(!function_exists('phpform_user_inputs')) {
28+
function phpform_user_inputs($user_submit) {
29+
$user_submit = strip_tags($user_submit);
30+
$user_submit = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "",$user_submit);
31+
$user_submit = preg_replace('/\r\n|\r|\n/', '<br>', $user_submit);
32+
return $user_submit;
33+
}
34+
}
35+
36+
37+
foreach($_POST as $key => $val) {
38+
${"checked_$key"} = phpform_user_inputs($val);
39+
}
40+
41+
/* check user inputs */
42+
43+
if($_POST['visitor_csrf_token'] !== $_SESSION['visitor_csrf_token']) {
44+
$send_mail = "false";
45+
$error_msg .= '<li>Unable to process your request.</li>';
46+
}
47+
48+
if(($checked_af_sender_name == "") || ($checked_af_sender_mail == "") || ($checked_af_sender_message == "")) {
49+
$send_mail = "false";
50+
$error_msg .= '<li>All mandatory fields (*) must be filled out</li>';
51+
}
52+
53+
if(!filter_var($checked_af_sender_mail, FILTER_VALIDATE_EMAIL)) {
54+
$send_mail = "false";
55+
$error_msg .= '<li>Something seems to be wrong with your email address.</li>';
56+
}
57+
58+
if($_POST['privacy_policy'] != 'accept') {
59+
$send_mail = "false";
60+
$error_msg .= '<li>You need to confirm that you have read the privacy policy</li>';
61+
}
62+
63+
if($error_msg !== '') {
64+
65+
$response = '<strong>One or more errors occurred:</strong>';
66+
$response .= '<ul>'.$error_msg.'</ul>';
67+
68+
$output = json_encode(array('type' => 'error', 'text' => "$response"));
69+
die($output);
70+
}
71+
72+
/* checks passed succesfully */
73+
74+
$send_date = date('Y-m-d h:i:s');
75+
$send_subject = 'Message from '.$checked_af_sender_name;
76+
77+
$send_text = '<body>';
78+
$send_text .= '<table cellpadding="2" border="0">';
79+
$send_text .= '<tr><td>Name:</td><td>'.$checked_af_sender_name.'</td></tr>';
80+
$send_text .= '<tr><td>E-Mail:</td><td>'.$checked_af_sender_mail.'</td></tr>';
81+
$send_text .= '<tr><td>Message:</td><td>'.$checked_af_sender_message.'</td></tr>';
82+
$send_text .= '<tr><td>Time:</td><td>'.$send_date.'</td></tr>';
83+
$send_text .= '</table>';
84+
$send_text .= '</body>';
85+
86+
$phpform_sendmail = fc_send_mail($recipient,$send_subject,$send_text);
87+
if($phpform_sendmail == 1) {
88+
$output = json_encode(array('type' => 'success', 'text' => 'Thank you for your message.'));
89+
die($output);
90+
} else {
91+
92+
$output = json_encode(array('type' => 'error', 'text' => 'There has been an error. Please try again.'));
93+
die($output);
94+
}
95+
96+
97+
?>

bs-carousel.php

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
/**
4+
* Create Twitter Bootstrap Carousel
5+
* Filter uploaded images by keyword and order by priority
6+
* example: [plugin=bs-carousel.php]key=keyword[/plugin]
7+
*
8+
* Requirement: flatCore Theme which Bootstrap 5
9+
* License: GPL-3.0 License
10+
* copyright (c) 2021, Patrick Konstandin
11+
*/
12+
13+
if(FC_SOURCE == 'frontend') {
14+
15+
global $db_content;
16+
global $languagePack;
17+
18+
$slides = $db_content->select("fc_media", "*",[
19+
"media_keywords" => $key,
20+
"media_lang" => $languagePack,
21+
22+
"ORDER" => [
23+
"media_priority" => "DESC"
24+
]
25+
]);
26+
27+
28+
$cnt_slides = count($slides);
29+
30+
31+
for($i=0;$i<$cnt_slides;$i++) {
32+
33+
unset($active_item);
34+
if($i==0) { $active_item = 'active'; }
35+
36+
$item_src = str_replace('../content/', '/content/', $slides[$i]['media_file']);
37+
38+
$carousel_imgs_str .= '
39+
<div class="carousel-item '.$active_item.'">
40+
<img src="'.$item_src.'" alt="'.$slides[$i]['media_file'].'">
41+
</div>';
42+
43+
}
44+
45+
echo '<div id="carousel'.$key.'" class="carousel slide" data-bs-ride="carousel">';
46+
47+
echo '<div class="carousel-inner">';
48+
echo $carousel_imgs_str;
49+
echo '</div>';
50+
51+
echo '</div>';
52+
}

bs-modal.php

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
/**
4+
* Show Textsnippets in Bootstrap Modal
5+
* [plugin=bs-modal.php]fcs=snippet[/plugin]
6+
* snippet = name of your snippet
7+
*
8+
* Modal: http://getbootstrap.com/javascript/#modals
9+
*/
10+
11+
/* backend */
12+
13+
$plugin = array();
14+
$plugin['title'] = 'Modal Plugin';
15+
$plugin['description'] = '<p>Show Textsnippets in Bootstrap Modal</p>';
16+
$plugin['version'] = '0.1';
17+
$plugin['author'] = 'Patrick Konstandin';
18+
19+
/* frontend */
20+
21+
if(FC_SOURCE == 'frontend') {
22+
23+
global $db_content;
24+
global $languagePack;
25+
26+
$textlibData = $db_content->get("fc_textlib", "*",[
27+
"textlib_name" => $fcs,
28+
"textlib_lang" => $languagePack
29+
]);
30+
31+
foreach($textlibData as $k => $v) {
32+
$$k = stripslashes($v);
33+
}
34+
35+
36+
echo '<button class="btn btn-primary btn-lg" data-bs-toggle="modal" data-bs-target="#bsModal'.$fcs.'">'.$textlib_title.'</button>';
37+
38+
echo '
39+
<div class="modal fade" id="bsModal'.$fcs.'" tabindex="-1" role="dialog">
40+
<div class="modal-dialog">
41+
<div class="modal-content">
42+
<div class="modal-header">
43+
<h4 class="modal-title">'.$textlib_title.'</h4>
44+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
45+
</div>
46+
<div class="modal-body">
47+
'.$textlib_content.'
48+
</div>
49+
</div>
50+
</div>
51+
</div>';
52+
}
53+
?>

bs-tabs.php

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
/**
4+
* Show Snippets in Bootstrap tabs
5+
* [plugin=bs-tabs.php]key=word[/plugin]
6+
* key = keyword of your snippets
7+
*/
8+
9+
/* backend */
10+
$plugin = array();
11+
$plugin['title'] = 'Tabs Plugin';
12+
$plugin['description'] = '<p>Show Textsnippets in Bootstrap3 Tabs</p>';
13+
$plugin['version'] = '0.1';
14+
$plugin['author'] = 'flatCore DevTeam';
15+
16+
/* frontend */
17+
18+
if(FC_SOURCE == 'frontend') {
19+
20+
global $db_content;
21+
global $languagePack;
22+
23+
$tabs = $db_content->select("fc_textlib", "*",[
24+
"textlib_keywords" => $key,
25+
"textlib_lang" => $languagePack,
26+
27+
"ORDER" => [
28+
"textlib_priority" => "DESC"
29+
]
30+
]);
31+
32+
33+
echo '<div class="card p-3 mt-3">';
34+
echo '<nav>';
35+
echo '<div class="nav nav-tabs" id="nav-tab" role="tablist">';
36+
37+
$x = 0;
38+
foreach($tabs as $tab) {
39+
40+
$id = 'tabid'.$tab['textlib_id'];
41+
42+
if($x==0) {
43+
$class = 'nav-link active';
44+
} else {
45+
$class = 'nav-link';
46+
}
47+
48+
echo '<button class="'.$class.'" data-bs-toggle="tab" data-bs-target="#'.$id.'" type="button" role="tab">'.$tab['textlib_permalink_name'].'</button>';
49+
$x++;
50+
}
51+
echo '</div>';
52+
echo '</nav>';
53+
54+
55+
echo '<div class="tab-content p-2" id="myTabContent">';
56+
57+
$x = 0;
58+
foreach($tabs as $tab) {
59+
$id = 'tabid'.$tab['textlib_id'];
60+
if($x==0) {
61+
$class = 'tab-pane fade show active';
62+
} else {
63+
$class = 'tab-pane fade';
64+
}
65+
echo '<div class="'.$class.'" id="'.$id.'" role="tabpanel">';
66+
echo '<h5>'.$tab['textlib_title'].'</h5>';
67+
echo $tab['textlib_content'];
68+
echo '</div>';
69+
$x++;
70+
}
71+
72+
echo '</div>';
73+
echo '</div>';
74+
75+
76+
77+
}
78+
79+
?>

captcha/UbuntuMono-B.ttf

187 KB
Binary file not shown.

0 commit comments

Comments
 (0)