51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* @version $Id: website_newsletter_registration.php
|
|
* @package Easyshop
|
|
* @copyright Copyright (C) 2005 - 2011 TA-EDV
|
|
* @license proprietary
|
|
* @author Richard Kammermayer <rk@ta-edv.de>
|
|
* Easyshop is a web shop system
|
|
*/
|
|
|
|
class website_newsletter_registration {
|
|
private $base_object;
|
|
private $layout_object;
|
|
|
|
public function __construct($base_object, $layout_object) {
|
|
$this->base_object = $base_object;
|
|
$this->layout_object = $layout_object;
|
|
}
|
|
|
|
function run() {
|
|
$form_data = array(
|
|
'state' => 0
|
|
);
|
|
|
|
// create opinion
|
|
if (isset($_POST['form_data'])) {
|
|
$form_data = $_POST['form_data'];
|
|
if (
|
|
$form_data['firstname'] &&
|
|
$form_data['surname'] &&
|
|
$form_data['email']
|
|
) {
|
|
include_once './core/newsletter_subscriber.class.php';
|
|
$newsletter_subscriber_object = new Newsletter_subscriber($this->base_object);
|
|
$result = $newsletter_subscriber_object->save($form_data, false);
|
|
if ($result) {
|
|
$form_data['state'] = 1;
|
|
} else {
|
|
$form_data['state'] = 3;
|
|
}
|
|
}
|
|
else {
|
|
$form_data['state'] = 2;
|
|
}
|
|
}
|
|
|
|
$this->layout_object->assign('formdata', $form_data);
|
|
|
|
return $this->layout_object->_fetch('content_newsletter_registration.tpl');
|
|
}
|
|
} |