first commit
This commit is contained in:
76
autoload/front/controls/class.Articles.php
Normal file
76
autoload/front/controls/class.Articles.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
namespace front\controls;
|
||||
class Articles
|
||||
{
|
||||
public static function pixieset_save_favorite_images( $hash )
|
||||
{
|
||||
return \front\factory\Articles::pixieset_save_favorite_images( $hash );
|
||||
}
|
||||
|
||||
public static function pixieset_image_favorite( $image_id, $hash )
|
||||
{
|
||||
return \front\factory\Articles::pixieset_image_favorite( $image_id, $hash );
|
||||
}
|
||||
|
||||
public static function images_download( $hash )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$results = $mdb -> query( 'SELECT * FROM ('
|
||||
. 'SELECT id, MD5( CONCAT( id, date_add ) ) AS hash FROM pp_articles ) AS q1'
|
||||
. ' WHERE hash = \'' . $hash . '\'' ) -> fetchAll( \PDO::FETCH_ASSOC );
|
||||
if ( is_array( $results ) and count( $results ) ) foreach ( $results as $row )
|
||||
{
|
||||
$zip = new \ZipArchive;
|
||||
$tmp_file = 'temp/' . $hash . '.zip';
|
||||
|
||||
if ( file_exists( $tmp_file ) )
|
||||
return $tmp_file;
|
||||
|
||||
if ( $zip -> open( $tmp_file, \ZipArchive::CREATE ) )
|
||||
{
|
||||
$results2 = $mdb -> select( 'pp_articles_images', 'src', [ 'article_id' => $row['id'] ] );
|
||||
if ( is_array( $results2 ) and count( $results2 ) ) foreach ( $results2 as $row2 )
|
||||
{
|
||||
$file = substr( $row2, 1, strlen( $row2 ) );
|
||||
$zip -> addFile( $file, basename( $file ) );
|
||||
}
|
||||
|
||||
$zip -> close();
|
||||
|
||||
return $tmp_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function image()
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$results = $mdb -> query( 'SELECT * FROM ('
|
||||
. 'SELECT id, src, MD5( CONCAT( id, src ) ) AS hash FROM pp_articles_images ) AS q1'
|
||||
. ' WHERE hash = \'' . \S::get( 'hash' ) . '\'' ) -> fetchAll( \PDO::FETCH_ASSOC );
|
||||
if ( is_array( $results ) and count( $results ) )
|
||||
{
|
||||
$file = substr( $results[0]['src'], 1, strlen( $results[0]['src'] ) );
|
||||
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="' . basename( $file ) . '"');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize( $file ) );
|
||||
flush();
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function article_unlock( $password, $article_id )
|
||||
{
|
||||
if ( $password == \front\factory\Articles::article_password( $article_id ) )
|
||||
\S::set_session( 'article-' . $article_id . '-' . $password, true );
|
||||
}
|
||||
}
|
||||
63
autoload/front/controls/class.AuditSEO.php
Normal file
63
autoload/front/controls/class.AuditSEO.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
namespace front\controls;
|
||||
class AuditSEO
|
||||
{
|
||||
public static function semstorm()
|
||||
{
|
||||
echo json_encode( \front\factory\AuditSEO::semstorm( \S::get( 'url' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function data08()
|
||||
{
|
||||
echo json_encode( \front\factory\AuditSEO::data08( \S::get( 'url' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function data07()
|
||||
{
|
||||
echo json_encode( \front\factory\AuditSEO::data07( \S::get( 'url' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function data06()
|
||||
{
|
||||
echo json_encode( \front\factory\AuditSEO::data06( \S::get( 'url' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function data05()
|
||||
{
|
||||
echo json_encode( \front\factory\AuditSEO::data05( \S::get( 'url' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function data04()
|
||||
{
|
||||
echo json_encode( \front\factory\AuditSEO::data04( \S::get( 'url' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function data03()
|
||||
{
|
||||
echo json_encode( \front\factory\AuditSEO::data03( \S::get( 'url' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function data02()
|
||||
{
|
||||
echo json_encode( \front\factory\AuditSEO::data02( \S::get( 'url' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function data01()
|
||||
{
|
||||
echo json_encode( \front\factory\AuditSEO::data01( \S::get( 'url' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function main_view()
|
||||
{
|
||||
return \Tpl::view( 'audit-seo/main-view' );
|
||||
}
|
||||
}
|
||||
38
autoload/front/controls/class.Newsletter.php
Normal file
38
autoload/front/controls/class.Newsletter.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace front\controls;
|
||||
|
||||
class Newsletter
|
||||
{
|
||||
public static function signin()
|
||||
{
|
||||
$result = [ 'status' => 'bad' ];
|
||||
|
||||
if ( \front\factory\Newsletter::newsletter_signin( \S::get( 'email' ) ) )
|
||||
$result = [ 'status' => 'ok' ];
|
||||
|
||||
echo json_encode( $result );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function confirm()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if ( \front\factory\Newsletter::newsletter_confirm( \S::get( 'hash' ) ) )
|
||||
\S::alert( $lang['email-zostal-dodany-do-listy-newsletter'] );
|
||||
|
||||
header( 'Location: /' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function unsubscribe()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if ( \front\factory\Newsletter::newsletter_unsubscribe( \S::get( 'hash' ) ) )
|
||||
\S::alert( $lang['email-zostal-usuniety-z-listy-newsletter'] );
|
||||
|
||||
header( 'Location: /' );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
122
autoload/front/controls/class.Site.php
Normal file
122
autoload/front/controls/class.Site.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
namespace front\controls;
|
||||
|
||||
class Site
|
||||
{
|
||||
public static function route()
|
||||
{
|
||||
global $page, $lang_id;
|
||||
|
||||
if ( \S::get( 'search' ) )
|
||||
{
|
||||
if ( $_POST['search_txt'] )
|
||||
{
|
||||
\S::set_session( 'search_txt', \S::get( 'search_txt' ) );
|
||||
header( "Location: " . $_SERVER['REQUEST_URI'] );
|
||||
exit;
|
||||
}
|
||||
return \front\view\Search::search_results(
|
||||
\front\factory\Search::search_results( \S::get_session( 'search_txt' ), $lang_id )
|
||||
);
|
||||
}
|
||||
|
||||
if ( \S::get( 'tag' ) )
|
||||
return \front\view\Articles::articles_list(
|
||||
\front\factory\Articles::articles_by_tags( \S::get( 'tag' ), $lang_id )
|
||||
);
|
||||
|
||||
if ( \S::get( 'article' ) )
|
||||
{
|
||||
$article = new \Article( \S::get( 'article' ), $lang_id );
|
||||
if ( !\S::get_session( 'article-view-' . $article -> id ) )
|
||||
{
|
||||
$article -> updateView();
|
||||
\S::set_session( 'article-view-' . $article -> id, true );
|
||||
}
|
||||
|
||||
if ( $article['password'] and !\S::get_session( 'article-' . $article['id'] . '-' . $article['password'] ) )
|
||||
return \front\view\Articles::password_view( [ 'article' => $article ] );
|
||||
else
|
||||
return \front\view\Articles::article( [ 'article' => $article ] );
|
||||
}
|
||||
|
||||
if ( $page['page_type'] !== null )
|
||||
{
|
||||
switch ( $page['page_type'] )
|
||||
{
|
||||
/* pełne artykuły */
|
||||
case 0:
|
||||
return \front\view\Articles::full_articles_list( $page, $lang_id, \S::get( 'bs' ) );
|
||||
break;
|
||||
|
||||
/* wprowadzenia */
|
||||
case 1:
|
||||
return \front\view\Articles::entry_articles_list( $page, $lang_id, \S::get( 'bs' ) );
|
||||
break;
|
||||
|
||||
/* miniaturki */
|
||||
case 2:
|
||||
return \front\view\Articles::miniature_articles_list( $page, $lang_id, \S::get( 'bs' ) );
|
||||
break;
|
||||
|
||||
/* strona kontaktu */
|
||||
case 4:
|
||||
$out = \front\view\Articles::full_articles_list( $page, $lang_id, \S::get( 'bs' ) );
|
||||
$out .= \front\view\Site::contact();
|
||||
return $out;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !\S::get( 'module' ) || !\S::get( 'action' ) )
|
||||
return false;
|
||||
|
||||
$class = '\front\controls\\' . ucfirst( \S::get( 'module' ) );
|
||||
$action = \S::get( 'action' );
|
||||
|
||||
if ( class_exists( $class ) and method_exists( new $class, $action ) )
|
||||
return call_user_func_array( array( $class, $action ), array() );
|
||||
}
|
||||
|
||||
public static function check_url_params()
|
||||
{
|
||||
global $lang, $config;
|
||||
|
||||
$a = \S::get( 'a' );
|
||||
|
||||
switch ( $a )
|
||||
{
|
||||
case 'page':
|
||||
$page = \front\factory\Pages::page_details( \S::get( 'id' ) );
|
||||
\S::set_session( 'page', $page );
|
||||
break;
|
||||
|
||||
case 'change_language':
|
||||
\S::set_session( 'current-lang', \S::get( 'id' ) );
|
||||
header( 'Location: /' );
|
||||
exit;
|
||||
break;
|
||||
|
||||
case 'newsletter-sign':
|
||||
if ( \front\factory\Newsletter::newsletter_signin( \S::get( 'email' ) ) )
|
||||
\S::alert( 'Dziękujemy za zapisanie się do newslettera.' );
|
||||
header( 'Location: ' . $_SERVER['REQUEST_URI'] );
|
||||
exit;
|
||||
break;
|
||||
|
||||
case 'newsletter-signout':
|
||||
if ( \front\factory\Newsletter::newsletter_signout( \S::get( 'email' ) ) )
|
||||
\S::alert( 'Twój adres email został usunięty z naszej bazy.' );
|
||||
header( 'Location: ' . $_SERVER['REQUEST_URI'] );
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( \S::get( 'lang' ) )
|
||||
\S::set_session( 'current-lang', \S::get( 'lang' ) );
|
||||
|
||||
if ( file_exists( 'modules/actions.php' ) )
|
||||
include 'modules/actions.php';
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user