Add B2B form email saving

This commit is contained in:
Roman Pyrih
2025-03-07 12:38:32 +01:00
parent f2698d53d0
commit d4690a42af
9 changed files with 1768 additions and 1690 deletions

View File

@@ -3,15 +3,12 @@
{
"format": "compressed",
"extensionName": ".css",
"savePath": "",
"savePath": "~/../style-css/",
"savePathSegmentKeys": null,
"savePathReplaceSegmentsWith": null
}
],
"liveSassCompile.settings.generateMap": true,
"liveSassCompile.settings.autoprefix": "defaults",
"liveSassCompile.settings.watchOnLaunch": true,
"liveSassCompile.settings.includeItems": [
"/wp-content/themes/bridge-child/styles/*.scss"
]
"liveSassCompile.settings.watchOnLaunch": true
}

View File

@@ -26,6 +26,31 @@ $mdb = new medoo( [
'charset' => 'utf8'
] );
function saveArticleUnlockData($email = '') {
$filePath = $_SERVER['DOCUMENT_ROOT'] . '/autoinstalator/wordpress6/b2b_users.csv';
$data = array(
'Email' => $email,
'Timestamp' => date('Y-m-d H:i:s')
);
if (!file_exists($filePath)) {
$header = array_keys($data);
$history = array($header);
} else {
$history = array_map('str_getcsv', file($filePath));
}
$history[] = $data;
$csvContent = fopen($filePath, 'w');
foreach ($history as $row) {
fputcsv($csvContent, $row);
}
fclose($csvContent);
}
if ( !$lang_id = \S::get_session( 'current-lang' ) )
{
$lang_id = \front\factory\Languages::default_language();
@@ -117,12 +142,19 @@ if ( \S::get( 'a' ) == 'contrast' )
exit;
}
if ( \S::get( 'a' ) == 'article_unlock' )
{
\front\controls\Articles::article_unlock(
\S::get( 'password' ),
\S::get( 'article_id' )
if (\S::get('a') == 'article_unlock') {
$article_id = \S::get('article_id');
$email = \S::get('email');
$success = \front\controls\Articles::article_unlock(
\front\factory\Articles::article_password($article_id),
$article_id
);
if ($success) {
saveArticleUnlockData($email);
}
exit;
}

View File

@@ -70,7 +70,10 @@ class Articles
public static function article_unlock( $password, $article_id )
{
if ( $password == \front\factory\Articles::article_password( $article_id ) )
if ( $password == \front\factory\Articles::article_password( $article_id ) ){
\S::set_session( 'article-' . $article_id . '-' . $password, true );
return true;
}
return false;
}
}

0
b2b_users.csv Normal file
View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -61,7 +61,7 @@ a {
position: relative;
&.parent {
>a {
> a {
@include respond-above(xs) {
pointer-events: none;
}
@@ -97,17 +97,17 @@ a {
.level-0 {
justify-content: space-between;
>li {
> li {
display: flex;
align-items: center;
>a {
> a {
color: $cTxtGray;
text-transform: uppercase;
}
&#link-8 {
>a {
> a {
color: $cTxtWhite;
font-weight: 800;
font-size: 23px;
@@ -675,14 +675,14 @@ header {
li {
&.parent {
&:hover {
>a {
> a {
&::before {
width: calc(100% - 23px);
}
}
}
>a {
> a {
&::after {
content: url('/upload/filemanager/Icons/mini_arrow_bottom_new.svg');
display: inline-block;
@@ -698,7 +698,7 @@ header {
@include respond-below(md) {
li {
&.parent {
>a {
> a {
display: flex;
flex-direction: row;
justify-content: space-between;
@@ -722,7 +722,7 @@ header {
li {
&.parent {
>a {
> a {
width: fit-content;
@include respond-above(md) {
@@ -732,7 +732,7 @@ header {
}
&:hover {
>a {
> a {
&::before {
width: 100%;
}
@@ -814,7 +814,7 @@ header {
padding-right: 15px;
}
>li {
> li {
position: relative;
@include respond-below(md) {
@@ -877,10 +877,10 @@ header {
display: none;
}
>li {
> li {
@include respond-above(md) {
&:hover {
>a {
> a {
&::after {
transform: rotate(-90deg);
}
@@ -924,7 +924,7 @@ header {
}
}
>a {
> a {
padding: 5px 0;
}
@@ -1003,7 +1003,7 @@ header {
height: 400px;
}
>div {
> div {
width: 100%;
}
@@ -1272,7 +1272,7 @@ header {
background-color: $cSandDarker;
}
>.row {
> .row {
align-items: center;
}
@@ -1290,7 +1290,8 @@ header {
}
}
.col-right {}
.col-right {
}
@include respond-below(md) {
&::before {
@@ -2001,7 +2002,8 @@ header {
flex-direction: column;
row-gap: 12px;
input[type='password'] {
input[type='password'],
input[type='email'] {
height: 46px;
border: 1px solid #000;
border-radius: 0;

View File

@@ -24,7 +24,7 @@ function saveContactData(
$invoiceNumber = ''
) {
$contactHistoryFile = $_SERVER['DOCUMENT_ROOT'] . '/autoinstalator/wordpress14/forms.csv';
$contactHistoryFile = $_SERVER['DOCUMENT_ROOT'] . '/autoinstalator/wordpress6/forms.csv';
$contactData = array(
'Name' => $name,

View File

@@ -0,0 +1,44 @@
<div class="article-password" id="article-password-<?= $this -> article['id'];?>">
<div class="row">
<div class="col-12">
<p><?= \S::lang( 'ten-artykul-jest-chroniony-podaj-haslo-aby-odblokowac-zawartosc-artykulu' );?></p>
<form metho="POST" id="form-<?= $this -> article['id'];?>">
<!-- <input type="password" name="password" id="password-<?= $this -> article['id'];?>" required="required"> -->
<input type="email" name="email" id="email-<?= $this -> article['id'];?>" required="required">
<input type="submit" class="btn btn-success" id="submit-<?= $this -> article['id'];?>" value="<?= \S::lang( 'odblokuj' );?>">
</form>
</div>
</div>
</div>
<script class="footer" type="text/javascript">
$( function()
{
$( 'body' ).on( click_event, '#submit-<?= $this -> article['id'];?>', function(e)
{
if ( $.trim( $( "#email-<?= $this -> article['id'];?>" ).val() ) !== '' )
{
e.preventDefault();
var email = $( '#email-<?= $this -> article['id'];?>' ).val();
$.ajax(
{
type: 'POST',
cache: false,
url: '/ajax.php',
data:
{
a: 'article_unlock',
email: email,
article_id: <?= $this -> article['id'];?>
},
success: function( data )
{
location.reload();
}
});
return false;
}
});
});
</script>