first commit

This commit is contained in:
2023-09-04 21:59:34 +02:00
commit 650ef5b3e1
196 changed files with 24080 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace newsletter;
class FNewsletter {
public function signEmail( $type, $email )
{
global $db;
if ( !\System::checkEmail( $email ) )
return \System::setAlert( 'Podany adres email jest nieprawidłowy.' );
$query = $db -> prepare( 'SELECT id FROM pp_newsletter_emails WHERE email = :email' );
$query -> bindValue( ':email', $email, \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() && $type )
return \System::setAlert( 'Podany adres email jest już zapisany do Newslettera.' );
else if ( $query -> rowCount() && !$type )
{
$query2 = $db -> prepare( 'DELETE FROM pp_newsletter_emails WHERE email = :email' );
$query2 -> bindValue( ':email', $email, \PDO::PARAM_STR );
$query2 -> execute();
if ( $query2 -> rowCount() )
return \System::setAlert( 'Podany adres email został usunięty z Newslettera.' );
$query2 -> closeCursor();
}
else if ( !$query -> rowCount() && !$type )
return \System::alert( 'Podany adres email nie jest zapisany do Newslettera.' );
else if ( !$query -> rowCOunt() && $type )
{
$query2 = $db -> prepare( 'INSERT INTO pp_newsletter_emails ( email ) VALUES ( :email )' );
$query2 -> bindValue( ':email', $email, \PDO::PARAM_STR );
$query2 -> execute();
if ( $query2 -> rowCount() )
return \System::setAlert( 'Podany adres email został dodany do Newslettera.' );
$query2 -> closeCursor();
}
return false;
}
}
?>

View File

@@ -0,0 +1,12 @@
<?php
namespace newsletter;
class VNewsletter {
public static function drawNewsletterSignForm()
{
$tpl = new \Savant3;
return $tpl -> fetch( 'newsletter/sign-form' );
}
}
?>