Add B2B form email saving
This commit is contained in:
29
.vscode/settings.json
vendored
29
.vscode/settings.json
vendored
@@ -1,17 +1,14 @@
|
|||||||
{
|
{
|
||||||
"liveSassCompile.settings.formats": [
|
"liveSassCompile.settings.formats": [
|
||||||
{
|
{
|
||||||
"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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|||||||
44
ajax.php
44
ajax.php
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
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
File diff suppressed because it is too large
Load Diff
@@ -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,
|
||||||
|
|||||||
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