This commit is contained in:
sHa
2018-12-21 11:13:17 +02:00
parent abfc58d585
commit d31f50ef19
15 changed files with 245 additions and 13 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
vendor/*
composer.lock

View File

@@ -1,5 +1,5 @@
{
"remotePath": "./",
"remotePath": "./slavforest.com.ua",
"host": "uvh12.mirohost.net",
"username": "slavforest",
"password": "cAAed7MU",
@@ -14,7 +14,8 @@
"ignore": [
"\\.vscode",
"\\.git",
"\\.DS_Store"
"\\.DS_Store",
"\\.db"
],
"generatedFiles": {
"uploadOnSave": false,

7
composer.json Normal file
View File

@@ -0,0 +1,7 @@
{
"require": {
"slim/slim": "^3.0",
"mailgun/mailgun-php": "^2.6",
"slim/php-view": "^2.2"
}
}

View File

@@ -6,7 +6,7 @@
//E-mail address. Enter your email
define("__TO__", "youremail@domain.com");
define("__TO__", "sha@shadoll.work");
//Success message
define('__SUCCESS_MESSAGE__', "Your message has been sent. We will reply soon. Thank you!");
@@ -41,11 +41,11 @@ function send_mail($to,$subject,$message,$headers){
}
//Get data form and send mail
if(isset($_POST['name']) and isset($_POST['mail']) and isset($_POST['messageForm'])){
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['message'])){
$name = $_POST['name'];
$mail = $_POST['mail'];
$subjectForm = $_POST['subjectForm'];
$messageForm = $_POST['messageForm'];
$mail = $_POST['email'];
$subjectForm = $_POST['subject'];
$messageForm = $_POST['message'];
if($name == '') {
echo json_encode(array('info' => 'error', 'msg' => "Please enter your name."));
@@ -96,4 +96,3 @@ if(isset($_POST['name']) and isset($_POST['mail']) and isset($_POST['messageForm
} else {
echo json_encode(array('info' => 'error', 'msg' => __MESSAGE_EMPTY_FIELDS__));
}
?>

86
contactengine.php Normal file
View File

@@ -0,0 +1,86 @@
<?php
$sendfrom = "site@slavforest.com.ua";
$sendto = "sha@shadoll.work; info@slavforest.com.ua";
$subject = "📨 Повідомлення з сайту slavforest.com.ua";
$username = !empty($_POST['name'])?trim(stripslashes($_POST['name'])):'';
$userphone = !empty($_POST['phone'])?trim(stripslashes($_POST['phone'])):'';
$usermail = !empty($_POST['email'])?trim(stripslashes($_POST['email'])):'';
$order = !empty($_POST['order'])?trim(stripslashes($_POST['order'])):'';
$subj = !empty($_POST['subject'])?trim(stripslashes($_POST['subject'])):'';
$message = !empty($_POST['message'])?trim(stripslashes($_POST['message'])):'';
$referer = !empty($_POST['referer'])?trim(stripslashes($_POST['referer'])):'';
$ip = $_SERVER['REMOTE_ADDR']; // the IP address to query
$query = @unserialize(file_get_contents('http://ip-api.com/php/'.$ip));
if($query && $query['status'] == 'success') {
$detect = true;
$country_code = $query['countryCode'];
$country = $query['country'];
$region = $query['regionName'];
$city = $query['city'];
$provider = $query['isp'];
}
else
$detect = false;
$headers = "From:".strip_tags($sendfrom)."\r\n";
if(!empty($usermail))
$headers .= "Reply-To: ".strip_tags($usermail)."\r\n";
else
$headers .= "Reply-To: ".strip_tags($sendto)."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html;charset=utf-8 \r\n";
$msg = "<html><body style='font-family:Arial,sans-serif;'>";
$msg .= '<img src="https://zebnits.com/images/logo_black.png" alt="logo">';
$msg .= "<h2 style='font-weight:bold;border-bottom:1px dotted #ccc;'>".$subject."</h2>\r\n";
$msg .= "<p><strong>Від кого:</strong> ".$username."</p>\r\n";
if(!empty($userphone))
$msg .= "<p><strong>Телефон:</strong> ".$userphone."</p>\r\n";
if(!empty($usermail))
$msg .= "<p><strong>Email:</strong> ".$usermail."</p>\r\n";
$msg .= "<hr>\r\n";
if(!empty($subj))
$msg .= "<p><strong>Тема:</strong>\r\n".$subj."</p>\r\n";
if(!empty($order))
$msg .= "<p><strong>Заказ:</strong>\r\n".$order."</p>\r\n";
if(!empty($message))
$msg .= "<p><strong>Повідомлення:</strong>\r\n".$message."</p>\r\n";
$msg .= "<hr>\r\n";
$msg .= "<p><strong>Реферал:</strong> ".$referer."</p>\r\n";
$msg .= "<p><strong>IP-адреса відправника:</strong> ".$ip."</p>\r\n";
if($detect){
$msg .= "<p><strong>Провайдер:</strong> ".$provider."</p>\r\n";
$msg .= "<p><strong>Країна:</strong> ".$country." <img style='height:14px; width:auto' src='http://www.geognos.com/api/en/countries/flag/".$country_code.".png'></p>\r\n";
$msg .= "<p><strong>Регіон:</strong> ".$region."</p>\r\n";
$msg .= "<p><strong>Населений пункт:</strong> ".$city."</p>\r\n";
}
$msg .= "</body></html>";
if(empty($username)){
echo json_encode([
'message'=>'Please enter your name.',
'callback'=>'error',
'focus'=>'name'
]);
}
elseif(empty($usermail)){
echo json_encode([
'message'=>'Please enter valid e-mail.',
'callback'=>'error',
'focus'=>'email'
]);
}
else{
$success = @mail($sendto, $subject, $msg, $headers);
echo json_encode([
'html'=>'our message has been sent. We will reply soon. Thank you!',
'target'=>".response",
'callback'=>"message_send"
]);
}

View File

@@ -142,6 +142,7 @@ p {
background: url(../images/home.jpg);
background-size: cover;
background-repeat: no-repeat;
background-color: #a9773a;
}
.header .section_overlay {
background-color: rgba(33, 33, 33, .75);

View File

@@ -0,0 +1 @@
google-site-verification: google625b316c457672b3.html

View File

@@ -266,7 +266,7 @@
<li>Виробляються брикети РУФ без використання смол, тому вони не забруднюють димохід і дають приємний запах</li>
<li>Паливні брикети з тирси виділяють СО<sup>2</sup> в десять разів менше, ніж природний газ і в п&#39;ятдесят разів менше, ніж вугілля.</li>
</ul>
<p>Брикет упаковано в пачки по 12 штук в термозбіжний пакет, що захищає їх від проникнення пилу, бруду і вологи. Вага однієї пачки близько 12 кг, загальна вага піддона 1 тонна.</p>
<p>Брикет упаковано в пачки по 12 штук в термозбіжний пакет, що захищає їх від проникнення пилу, бруду і вологи. Вага однієї пачки близько 10 кг, загальна вага піддона 1 тонна.</p>
</div>
</div>
</div>

View File

@@ -285,7 +285,7 @@
</ul>
<p>
Our briquettes are packed into shrinkbags in sets of 12 pcs., which provides
protection against dust, dirt and moisture. The weight of each bag is approx. 12 kg,
protection against dust, dirt and moisture. The weight of each bag is approx 10 kg,
total weight of a pallet is 1 ton.</p>
</div>
</div>

96
js/_actions.js Normal file
View File

@@ -0,0 +1,96 @@
/**
*
* @author sHa <sha@shadoll.com>
* @package sCore
* @version 17.5.9 (17.5.16 fixed)
*
*/
;
/* AutoLoader */
jQuery(document).ready(function(){
jQuery("[data-autoload='true']").each(function(){
load_objects(jQuery("#"+$(this).attr("id")));
});
});
/*
Виклик:
load_objects(jQuery("#container_id"));
Параметри data- контейнеру:
* - будь-які данні, будуть передані в викликаємий метод класу
action - клас та метод що маємо викликати, якщо не задано берем з href
method - метод Post або Get
callback - функція яку буде викона після виконання запиту
target - якщо вказано, то значення змінної html відповіді буде розміщенно всередені тегу
якщо target не визначено, а відповідь має змінну html, то її значення буде розміщено в середені контейнеру
template - ім'я php шаблону для формування змінної html
autoload - true|false - автоматичне виконання запиту при завантаженні сторінки
*/
var load_objects = function(container){
if(jQuery(container)!=undefined){
var action = container.data('action');
if (action==undefined)
action = container.attr('href');
var method = container.data('method');
if(method==undefined)
method = 'GET';
// Отримуємо необхідну форму,
// якщо не знайшли, беремо всі форми
var form_data = jQuery("form[data-group='"+container.attr('id')+"']").serializeArray();
// if (form_data[0] == undefined)
// var form_data = jQuery('form').serializeArray();
// перетворюємо значення форми на об'ект data
var data = new Object();
jQuery.each(form_data, function() {
if(this.value!='')
data[this.name] = this.value;
});
// додаємо до об'єкту data значання data- полів контейнеру
jQuery.each(container.data(),function(n, v){
if(n!='action' && n!='callback')
data[n] = v;
});
// додамо поточний url (хай буде)
data["uri_source"] = window.location.href;
jQuery.ajax({
url: action,
type: method,
data: data
}).
done(function(data){
var response = jQuery.parseJSON(data);
var target = jQuery(response.target);
console.log(target);
if(target!=undefined)
jQuery(target).html(response.html);
else
container.html(response.html);
if(response.callback!==undefined){
callback = response.callback;
}
else if(container.data('callback')!==undefined){
callback = container.data('callback');
}
else{
callback = undefined;
}
if(callback!==undefined && typeof window[callback] == 'function') {
window[callback](container,response);
}
}).
fail(function( jqXHR, textStatus ){
container.html("Request failed: " + textStatus);
});
}
}

View File

@@ -1,3 +1,19 @@
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js', { scope: './' })
.then(function(registration) {
console.log('ServiceWorker registration successful with scope: ', registration.scope);
})
.catch(function(whut) {
console.error('error... ');
console.error(whut);
});
window.addEventListener('beforeinstallprompt', function(e) {
console.log('beforeinstallprompt Event fired');
});
});
}
//LOADER/SPINNER
$(window).bind("load", function() {
@@ -257,10 +273,10 @@ $(document).ready(function() {
}
if (name && emaild && message) {
$.ajax({
url: 'contact.php',
url: 'contactengine.php',
data: {
name: name,
emaild: emaild,
email: emaild,
subject: subject,
message: message
},

15
manifest.json Normal file
View File

@@ -0,0 +1,15 @@
{
"short_name": "SlavForest",
"name": "SlavForest - Production of High-Quality Timber Products",
"icons": [
{
"src": "images/logo_w.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": "/",
"background_color": "#a9773a",
"theme_color": "#a9773a",
"display": "standalone"
}

View File

@@ -1,2 +1,2 @@
User-agent: *
Disallow: /
Host: slavforest.com.ua

5
sitemap.xml Normal file
View File

@@ -0,0 +1,5 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>https://slavforest.com.ua/index.html</loc>
</url>
</urlset>

3
sw.js Normal file
View File

@@ -0,0 +1,3 @@
/*
This service worker doesn't actually do anything!
*/