Add B2B form email saving
This commit is contained in:
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@@ -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
|
||||
}
|
||||
42
ajax.php
42
ajax.php
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
0
b2b_users.csv
Normal file
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
44
templates_user/articles/password-view.php
Normal file
44
templates_user/articles/password-view.php
Normal 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>
|
||||
Reference in New Issue
Block a user