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", "format": "compressed",
"extensionName": ".css", "extensionName": ".css",
"savePath": "", "savePath": "~/../style-css/",
"savePathSegmentKeys": null, "savePathSegmentKeys": null,
"savePathReplaceSegmentsWith": null "savePathReplaceSegmentsWith": null
} }
], ],
"liveSassCompile.settings.generateMap": true, "liveSassCompile.settings.generateMap": true,
"liveSassCompile.settings.autoprefix": "defaults", "liveSassCompile.settings.autoprefix": "defaults",
"liveSassCompile.settings.watchOnLaunch": true, "liveSassCompile.settings.watchOnLaunch": true
"liveSassCompile.settings.includeItems": [
"/wp-content/themes/bridge-child/styles/*.scss"
]
} }

View File

@@ -26,6 +26,31 @@ $mdb = new medoo( [
'charset' => 'utf8' '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' ) ) if ( !$lang_id = \S::get_session( 'current-lang' ) )
{ {
$lang_id = \front\factory\Languages::default_language(); $lang_id = \front\factory\Languages::default_language();
@@ -117,12 +142,19 @@ if ( \S::get( 'a' ) == 'contrast' )
exit; exit;
} }
if ( \S::get( 'a' ) == 'article_unlock' ) if (\S::get('a') == 'article_unlock') {
{ $article_id = \S::get('article_id');
\front\controls\Articles::article_unlock( $email = \S::get('email');
\S::get( 'password' ),
\S::get( 'article_id' ) $success = \front\controls\Articles::article_unlock(
\front\factory\Articles::article_password($article_id),
$article_id
); );
if ($success) {
saveArticleUnlockData($email);
}
exit; exit;
} }

View File

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

View File

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