- Created `Articles` class for rendering article views including full articles, miniature lists, and news sections. - Added `Banners` class for handling banner displays. - Introduced `Languages` class for rendering language options. - Implemented `Menu` class for rendering page and menu structures. - Developed `Newsletter` class for newsletter rendering. - Created `Scontainers` class for rendering specific containers. - Added `ShopCategory` class for managing shop category views and pagination. - Implemented `ShopClient` class for client-related views including address management and login forms. - Created `ShopPaymentMethod` class for displaying payment methods in the basket. - Added `ShopProduct` class for generating product URLs. - Introduced `ShopSearch` class for rendering a simple search form. - Added `.htaccess` file in the plugins directory to enhance security by restricting access to sensitive files and directories.
50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php
|
|
namespace front\Controllers;
|
|
|
|
use Domain\Newsletter\NewsletterRepository;
|
|
|
|
class NewsletterController
|
|
{
|
|
private NewsletterRepository $repository;
|
|
|
|
public function __construct( NewsletterRepository $repository )
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
public function signin()
|
|
{
|
|
global $settings;
|
|
|
|
$result = [ 'status' => 'bad' ];
|
|
|
|
if ( $this->repository->signup( \Shared\Helpers\Helpers::get( 'email' ), $_SERVER['SERVER_NAME'], !empty( $settings['ssl'] ), $settings ) )
|
|
$result = [ 'status' => 'ok' ];
|
|
|
|
echo json_encode( $result );
|
|
exit;
|
|
}
|
|
|
|
public function confirm()
|
|
{
|
|
global $lang;
|
|
|
|
if ( $this->repository->confirmSubscription( \Shared\Helpers\Helpers::get( 'hash' ) ) )
|
|
\Shared\Helpers\Helpers::alert( $lang['email-zostal-dodany-do-listy-newsletter'] );
|
|
|
|
header( 'Location: /' );
|
|
exit;
|
|
}
|
|
|
|
public function unsubscribe()
|
|
{
|
|
global $lang;
|
|
|
|
if ( $this->repository->unsubscribe( \Shared\Helpers\Helpers::get( 'hash' ) ) )
|
|
\Shared\Helpers\Helpers::alert( $lang['email-zostal-usuniety-z-listy-newsletter'] );
|
|
|
|
header( 'Location: /' );
|
|
exit;
|
|
}
|
|
}
|