This commit is contained in:
2026-03-02 16:32:35 +01:00
parent 03114778b9
commit 89f2f7fcac
15 changed files with 1130 additions and 720 deletions

View File

@@ -8,13 +8,13 @@ RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ %{REQUEST_SCHEME}://%1%{REQUEST_URI} [L,R=301]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$
RewriteCond %{REQUEST_URI} !^/admin(/|$) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.+)$ %{REQUEST_SCHEME}://%{HTTP_HOST}/$1/ [L,R=301]
RewriteRule ^(.+)$ https://%{HTTP_HOST}/$1/ [L,R=301]
ErrorDocument 404 /404.html

BIN
autoload/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -1,71 +1,216 @@
<?php
namespace admin;
class Site
{
// define APP_SECRET_KEY
const APP_SECRET_KEY = 'c3cb2537d25c0efc9e573d059d79c3b8';
public static function special_actions()
{
$sa = \S::get( 's-action' );
$domain = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );
$cookie_name = str_replace( '.', '-', $domain );
switch ( $sa )
$sa = \S::get('s-action');
$domain = preg_replace('#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME']);
$cookie_name = str_replace('.', '-', $domain);
switch ($sa)
{
case 'user-logon':
$result = \admin\factory\Users::logon( \S::get( 'login' ), \S::get( 'password' ) );
if ( $result == 1 )
{
if(\S::get('remember'))
$login = \S::get('login');
$pass = \S::get('password');
$result = \admin\factory\Users::logon($login, $pass);
if ($result == 1)
{
$password = md5( \S::get( 'password' ) );
$login = \S::get( 'login' );
$value = [ login => $login , hash => $password ];
$value = json_encode( $value );
$user = \admin\factory\Users::details($login);
setcookie( $cookie_name, $value, time() +(86400 * 14), "/", $domain );
if ($user['twofa_enabled'] == 1)
{
\S::set_session('twofa_pending', [
'uid' => (int)$user['id'],
'login' => $login,
'remember' => (bool)\S::get('remember'),
'started' => time(),
]);
if (!\admin\factory\Users::send_twofa_code((int)$user['id']))
{
\S::alert('Nie udało się wysłać kodu 2FA. Spróbuj ponownie.');
\S::delete_session('twofa_pending');
header('Location: /admin/');
exit;
}
header('Location: /admin/user/twofa/');
exit;
}
else
{
$user = \admin\factory\Users::details($login);
self::finalize_admin_login(
$user,
$domain,
$cookie_name,
(bool)\S::get('remember')
);
header('Location: /admin/articles/view_list/');
exit;
}
}
\S::set_session( 'user', \admin\factory\Users::details( \S::get( 'login' ) ) );
}
else
{
if ( $result == -1 )
\S::alert( 'Z powodu nieudanych 5 prób logowania Twoje konto zostało zablokowane.' );
else
\S::alert( 'Podane hasło jest nieprawidłowe, lub brak użytkownika o podanym loginie.' );
{
if ($result == -1)
{
\S::alert('Z powodu 5 nieudanych prób Twoje konto zostało zablokowane.');
}
else
{
\S::alert('Podane hasło jest nieprawidłowe lub użytkownik nie istnieje.');
}
header('Location: /admin/');
exit;
}
}
header( 'Location: /admin/articles/view_list/' );
exit;
break;
break;
case 'user-2fa-verify':
{
$pending = \S::get_session('twofa_pending');
if (!$pending || empty($pending['uid']))
{
\S::alert('Sesja 2FA wygasła. Zaloguj się ponownie.');
header('Location: /admin/');
exit;
}
$code = trim((string)\S::get('twofa'));
if (!preg_match('/^\d{6}$/', $code))
{
\S::alert('Nieprawidłowy format kodu.');
header('Location: /admin/user/twofa/');
exit;
}
$ok = \admin\factory\Users::verify_twofa_code((int)$pending['uid'], $code);
if (!$ok)
{
\S::alert('Błędny lub wygasły kod.');
header('Location: /admin/user/twofa/');
exit;
}
// 2FA OK — finalna sesja
$user = \admin\factory\Users::details($pending['login']);
\S::set_session('user', $user);
\S::delete_session('twofa_pending');
// Remember me BEZPIECZNY podpis HMAC:
if (!empty($pending['remember']))
{
$payloadArr = ['login' => $user['login'], 'ts' => time()];
$json = json_encode($payloadArr, JSON_UNESCAPED_SLASHES);
$sig = hash_hmac('sha256', $json, APP_SECRET_KEY);
$payload = base64_encode($json . '.' . $sig);
setcookie($cookie_name, $payload, [
'expires' => time() + (86400 * 14),
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);
}
header('Location: /admin/articles/view_list/');
exit;
}
break;
case 'user-2fa-resend':
{
$pending = \S::get_session('twofa_pending');
if (!$pending || empty($pending['uid']))
{
\S::alert('Sesja 2FA wygasła. Zaloguj się ponownie.');
header('Location: /admin/');
exit;
}
if (!\admin\factory\Users::send_twofa_code((int)$pending['uid'], true))
{
\S::alert('Kod można wysłać ponownie po krótkiej przerwie.');
}
else
{
\S::alert('Nowy kod został wysłany.');
}
header('Location: /admin/user/twofa/');
exit;
}
break;
case 'user-logout':
setcookie( $cookie_name, "", time() -(86400), "/", $domain );
session_destroy();
header( 'Location: /admin/' );
exit;
break;
{
setcookie($cookie_name, "", time() - 86400, "/", $domain);
\S::delete_session('twofa_pending');
session_destroy();
header('Location: /admin/');
exit;
}
break;
}
}
public static function route()
{
$_SESSION['admin'] = true;
$class = '\admin\controls\\';
$results = explode( '_', \S::get( 'module' ) );
if ( is_array( $results ) ) foreach ( $results as $row )
$class .= ucfirst( $row );
$results = explode('_', \S::get('module'));
if (is_array($results)) foreach ($results as $row)
$class .= ucfirst($row);
$action = \S::get( 'action' );
$action = \S::get('action');
if ( class_exists( $class ) and method_exists( new $class, $action ) )
return call_user_func_array( array( $class, $action ), array() );
if (class_exists($class) and method_exists(new $class, $action))
return call_user_func_array(array($class, $action), array());
else
{
\S::alert( 'Nieprawidłowy adres url.' );
\S::alert('Nieprawidłowy adres url.');
return false;
}
}
static public function finalize_admin_login(array $user, string $domain, string $cookie_name, bool $remember = false) {
\S::set_session('user', $user);
\S::delete_session('twofa_pending');
if ($remember)
{
$payloadArr = [
'login' => $user['login'],
'ts' => time()
];
$json = json_encode($payloadArr, JSON_UNESCAPED_SLASHES);
$sig = hash_hmac('sha256', $json, self::APP_SECRET_KEY);
$payload = base64_encode($json . '.' . $sig);
setcookie($cookie_name, $payload, [
'expires' => time() + (86400 * 14),
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);
}
}
}

View File

@@ -27,6 +27,22 @@ class Articles
exit;
}
static public function files_order_save()
{
global $user;
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
{
echo json_encode( [ 'status' => 'error', 'msg' => 'Nie masz uprawnień' ] );
exit;
}
if ( \admin\factory\Articles::files_order_save( \S::get( 'article_id' ), \S::get( 'order' ) ) )
echo json_encode( [ 'status' => 'ok', 'msg' => 'Artykuł został zapisany.' ] );
exit;
}
public static function gallery_order_save()
{
global $user;
@@ -98,8 +114,8 @@ class Articles
$values['params'] = $params;
if ( $id = \admin\factory\Articles::article_save(
$values['id'], $values['title'], $values['main_image'], $values['entry'], $values['text'], $values['table_of_contents'], $values['status'], $values['show_title'], $values['show_date_add'], $values['date_add'],
$values['show_date_modify'], $values['seo_link'], $values['meta_title'], $values['meta_description'], $values['meta_keywords'], $values['layout_id'],
$values['id'], $values['title'], $values['main_image'], $values['entry'], $values['text'], $values['table_of_contents'], $values['status'], $values['show_title'], $values['show_table_of_contents'], $values['show_date_add'], $values['date_add'],
$values['show_date_modify'], $values['date_modify'], $values['seo_link'], $values['meta_title'], $values['meta_description'], $values['meta_keywords'], $values['layout_id'],
$values['pages'], $values['noindex'], $values['repeat_entry'], $values['copy_from'], $values['social_icons'], $values['event_date'], $values['hidden-tags'], $values['block_direct_access'],
$values['priority'], $values['password'], $values['pixieset'], $values['id_author'], $params
) )
@@ -115,23 +131,23 @@ class Articles
{
global $user;
if ( !\admin\factory\Users::check_privileges( 'article_administration',
$user['id'] ) )
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
return \S::alert( 'Nie masz uprawnień' );
\admin\factory\Articles::delete_nonassigned_images();
\admin\factory\Articles::delete_nonassigned_files();
return \admin\view\Articles::article_edit( [
'article' => \admin\factory\Articles::article_details( \S::get( 'id' ) ),
'menus' => \admin\factory\Pages::menus_list(),
'languages' => \admin\factory\Languages::languages_list(),
'layouts' => \admin\factory\Layouts::layouts_list(),
'additional_params_lon' => \admin\factory\Articles::additional_params( 1 ),
'additional_params_loff' => \admin\factory\Articles::additional_params( 0 ),
'settings' => \admin\factory\Settings::settings_details(),
'authors' => \admin\factory\Authors::get_simple_list()
] );
'article' => \admin\factory\Articles::article_details( \S::get( 'id' ) ),
'menus' => \admin\factory\Pages::menus_list(),
'languages' => \admin\factory\Languages::languages_list(),
'layouts' => \admin\factory\Layouts::layouts_list(),
'additional_params_lon' => \admin\factory\Articles::additional_params( 1 ),
'additional_params_loff' => \admin\factory\Articles::additional_params( 0 ),
'settings' => \admin\factory\Settings::settings_details(),
'authors' => \admin\factory\Authors::get_simple_list(),
'user' => $user
] );
}
public static function view_list()

View File

@@ -26,7 +26,7 @@ class Users
$values = \S::json_to_array( \S::get( 'values' ) );
$response = \admin\factory\Users::user_save(
$values['id'], $values['login'], $values['status'], $values['active_to'], $values['password'], $values['password_re'], $values['admin'], $values['privileges']
$values['id'], $values['login'], $values['status'], $values['active_to'], $values['password'], $values['password_re'], $values['admin'], $values['privileges'], $values['twofa_enabled'], $values['twofa_email']
);
echo json_encode( $response );
exit;
@@ -55,5 +55,11 @@ class Users
return \admin\view\Users::users_list();
}
static public function twofa() {
return \Tpl::view( 'site/unlogged', [
'content' => \Tpl::view( 'users/user-2fa' )
] );
}
}
?>

View File

@@ -86,6 +86,24 @@ class Articles
return true;
}
static public function files_order_save( $article_id, $order )
{
global $mdb;
$order = explode( ';', $order );
if ( is_array( $order ) and !empty( $order ) ) foreach ( $order as $file_id )
{
$mdb -> update( 'pp_articles_files', [
'o' => (int)$i++
], [
'AND' => [
'article_id' => $article_id,
'id' => $file_id
]
] );
}
}
public static function gallery_order_save( $article_id, $order )
{
global $mdb;
@@ -222,7 +240,7 @@ class Articles
$article['languages'][ $row['lang_id'] ] = $row;
$article['images'] = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC' ] ] );
$article['files'] = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id ] );
$article['files'] = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC' ] ] );
$article['pages'] = $mdb -> select( 'pp_articles_pages', 'page_id', [ 'article_id' => (int)$article_id ] );
$article['tags'] = $mdb -> select( 'pp_tags', [ '[><]pp_articles_tags' => [ 'id' => 'tag_id' ] ], 'name', [ 'article_id' => (int)$article_id ] );
$article['params'] = $mdb -> select( 'pp_articles_additional_values', [ 'param_id', 'value', 'language_id' ], [ 'article_id' => (int)$article_id ] );
@@ -238,7 +256,7 @@ class Articles
}
public static function article_save(
$article_id, $title, $main_image, $entry, $text, $table_of_contents, $status, $show_title, $show_date_add, $date_add, $show_date_modify, $seo_link, $meta_title, $meta_description,
$article_id, $title, $main_image, $entry, $text, $table_of_contents, $status, $show_title, $show_table_of_contents, $show_date_add, $date_add, $show_date_modify, $date_modify, $seo_link, $meta_title, $meta_description,
$meta_keywords, $layout_id, $pages, $noindex, $repeat_entry, $copy_from, $social_icons, $event_date, $tags, $block_direct_access, $priority,
$password, $pixieset, $id_author, $params )
{
@@ -251,10 +269,11 @@ class Articles
{
$mdb -> insert( 'pp_articles', [
'show_title' => $show_title == 'on' ? 1 : 0,
'show_table_of_contents' => $show_table_of_contents == 'on' ? 1 : 0,
'show_date_add' => $show_date_add == 'on' ? 1 : 0,
'show_date_modify' => $show_date_modify == 'on' ? 1 : 0,
'date_add' => $date_add ? $date_add : date( 'Y-m-d H:i:s' ),
'date_modify' => $date_add ? $date_add : date( 'Y-m-d H:i:s' ),
'date_add' => date( 'Y-m-d H:i:s' ),
'date_modify' => date( 'Y-m-d H:i:s' ),
'modify_by' => $user['id'],
'layout_id' => $layout_id ? (int)$layout_id : null,
'status' => $status == 'on' ? 1 : 0,
@@ -435,9 +454,11 @@ class Articles
{
$mdb -> update( 'pp_articles', [
'show_title' => $show_title == 'on' ? 1 : 0,
'show_table_of_contents' => $show_table_of_contents == 'on' ? 1 : 0,
'show_date_add' => $show_date_add == 'on' ? 1 : 0,
'date_add' => $date_add,
'show_date_modify' => $show_date_modify == 'on' ? 1 : 0,
'date_modify' => date( 'Y-m-d H:i:s' ),
'date_modify' => $date_modify ? $date_modify : date( 'Y-m-d H:i:s' ),
'modify_by' => $user['id'],
'layout_id' => $layout_id ? (int)$layout_id : null,
'status' => $status == 'on' ? 1 : 0,

View File

@@ -1,185 +1,306 @@
<?php
namespace admin\factory;
class Users
{
public static function user_delete( $user_id )
public static function user_delete($user_id)
{
global $mdb;
return $mdb -> delete( 'pp_users', [ 'id' => (int)$user_id ] );
return $mdb->delete('pp_users', ['id' => (int)$user_id]);
}
public static function user_details( $user_id )
public static function user_details($user_id)
{
global $mdb;
return $mdb -> get( 'pp_users', '*', [ 'id' => (int)$user_id ] );
return $mdb->get('pp_users', '*', ['id' => (int)$user_id]);
}
public static function user_privileges( $user_id )
public static function user_privileges($user_id)
{
global $mdb;
return $mdb -> select( 'pp_users_privileges', '*', ['id_user' => (int)$user_id]);
return $mdb->select('pp_users_privileges', '*', ['id_user' => (int)$user_id]);
}
public static function user_save( $user_id, $login, $status, $active_to, $password, $password_re, $admin, $privileges )
public static function user_save($user_id, $login, $status, $active_to, $password, $password_re, $admin, $privileges, $twofa_enabled = 0, $twofa_email = '' )
{
global $mdb, $lang;
$mdb -> delete( 'pp_users_privileges', [ 'id_user' => (int) $user_id ] );
$mdb->delete('pp_users_privileges', ['id_user' => (int) $user_id]);
if ( !$user_id )
if (!$user_id)
{
if ( strlen( $password ) < 5 )
return $response = [ 'status' => 'error', 'msg' => 'Podane hasło jest zbyt krótkie.' ];
if (strlen($password) < 5)
return $response = ['status' => 'error', 'msg' => 'Podane hasło jest zbyt krótkie.'];
if ( $password != $password_re )
return $response = [ 'status' => 'error', 'msg' => 'Podane hasła są różne' ];
if ($password != $password_re)
return $response = ['status' => 'error', 'msg' => 'Podane hasła są różne'];
if ( $mdb -> insert( 'pp_users',
[
'login' => $login,
'status' => $status == 'on' ? 1 : 0,
'active_to' => $active_to == '' ? NULL : $active_to,
'admin' => $admin,
'password' => md5( $password ),
] ) )
$id_user = $mdb -> get( 'pp_users', 'id', [ 'ORDER' => [ 'id' => 'DESC' ] ] );
if ($mdb->insert(
'pp_users',
[
'login' => $login,
'status' => $status == 'on' ? 1 : 0,
'active_to' => $active_to == '' ? NULL : $active_to,
'admin' => $admin,
'password' => md5($password),
'twofa_enabled' => $twofa_enabled == 'on' ? 1 : 0,
'twofa_email' => $twofa_email
]
))
$id_user = $mdb->get('pp_users', 'id', ['ORDER' => ['id' => 'DESC']]);
if ( is_array( $privileges ) )
if (is_array($privileges))
{
foreach ( $privileges as $pri )
foreach ($privileges as $pri)
{
$mdb -> insert( 'pp_users_privileges',
[
'name' => $pri,
'id_user' => $id_user
] );
$mdb->insert(
'pp_users_privileges',
[
'name' => $pri,
'id_user' => $id_user
]
);
}
}
else
{
$mdb -> insert( 'pp_users_privileges',
[
'name' => $privileges,
'id_user' => $id_user
] );
$mdb->insert(
'pp_users_privileges',
[
'name' => $privileges,
'id_user' => $id_user
]
);
}
return $response = [ 'status' => 'ok', 'msg' => 'Użytkownik został zapisany.' ];
return $response = ['status' => 'ok', 'msg' => 'Użytkownik został zapisany.'];
}
else
{
if ( $password and strlen( $password ) < 5 )
return $response = [ 'status' => 'error', 'msg' => 'Podane hasło jest zbyt krótkie.' ];
if ($password and strlen($password) < 5)
return $response = ['status' => 'error', 'msg' => 'Podane hasło jest zbyt krótkie.'];
if ( $password and $password != $password_re )
return $response = [ 'status' => 'error', 'msg' => 'Podane hasła są różne' ];
if ($password and $password != $password_re)
return $response = ['status' => 'error', 'msg' => 'Podane hasła są różne'];
if ( $password )
$mdb -> update( 'pp_users', [
'password' => md5( $password )
], [
'id' => (int) $user_id
] );
if ($password)
$mdb->update('pp_users', [
'password' => md5($password)
], [
'id' => (int) $user_id
]);
$mdb -> update( 'pp_users', [
'login' => $login,
'admin' => $admin,
'status' => $status == 'on' ? 1 : 0,
'active_to' => $active_to == '' ? NULL : $active_to,
'error_logged_count' => 0
], [
'id' => (int) $user_id
] );
$mdb->update('pp_users', [
'login' => $login,
'admin' => $admin,
'status' => $status == 'on' ? 1 : 0,
'active_to' => $active_to == '' ? NULL : $active_to,
'error_logged_count' => 0,
'twofa_enabled' => $twofa_enabled == 'on' ? 1 : 0,
'twofa_email' => $twofa_email
], [
'id' => (int) $user_id
]);
if ( is_array( $privileges ) )
if (is_array($privileges))
{
foreach ( $privileges as $pri )
foreach ($privileges as $pri)
{
$mdb -> insert( 'pp_users_privileges', [
'name' => $pri,
'id_user' => $user_id
] );
$mdb->insert('pp_users_privileges', [
'name' => $pri,
'id_user' => $user_id
]);
}
}
else
{
$mdb -> insert( 'pp_users_privileges', [
'name' => $privileges,
'id_user' => $user_id
] );
$mdb->insert('pp_users_privileges', [
'name' => $privileges,
'id_user' => $user_id
]);
}
return $response = [ 'status' => 'ok', 'msg' => 'Uzytkownik został zapisany.' ];
return $response = ['status' => 'ok', 'msg' => 'Uzytkownik został zapisany.'];
}
\S::delete_cache();
}
public static function check_login( $login, $user_id )
public static function check_login($login, $user_id)
{
global $mdb;
if ( $mdb -> get( 'pp_users', 'login', [ 'AND' => [ 'login' => $login, 'id[!]' => (int)$user_id ] ] ) )
return $response = [ 'status' => 'error', 'msg' => 'Podany login jest już zajęty.' ];
if ($mdb->get('pp_users', 'login', ['AND' => ['login' => $login, 'id[!]' => (int)$user_id]]))
return $response = ['status' => 'error', 'msg' => 'Podany login jest już zajęty.'];
return $response = [ 'status' => 'ok' ];
return $response = ['status' => 'ok'];
}
public static function logon( $login, $password )
public static function logon($login, $password)
{
global $mdb;
if ( !$mdb -> get( 'pp_users', '*', [ 'login' => $login ] ) )
if (!$mdb->get('pp_users', '*', ['login' => $login]))
return 0;
if ( !$mdb -> get( 'pp_users', '*', [ 'AND' => [ 'login' => $login, 'status' => 1, 'error_logged_count[<]' => 5 ] ] ) )
return -1;
if (!$mdb->get('pp_users', '*', ['AND' => ['login' => $login, 'status' => 1, 'error_logged_count[<]' => 5]]))
return -1;
if ( $mdb -> get( 'pp_users', '*', [
'AND' => [
'login' => $login, 'status' => 1, 'password' => md5( $password ),
'OR' => [ 'active_to[>=]' => date('Y-m-d'), 'active_to' => null ]
]
] ) )
if ($mdb->get('pp_users', '*', [
'AND' => [
'login' => $login,
'status' => 1,
'password' => md5($password),
'OR' => ['active_to[>=]' => date('Y-m-d'), 'active_to' => null]
]
]))
{
$mdb -> update( 'pp_users', [ 'last_logged' => date( 'Y-m-d H:i:s' ), 'error_logged_count' => 0 ], [ 'login' => $login ] );
$mdb->update('pp_users', ['last_logged' => date('Y-m-d H:i:s'), 'error_logged_count' => 0], ['login' => $login]);
return 1;
}
else
{
$mdb -> update( 'pp_users', [ 'last_error_logged' => date( 'Y-m-d H:i:s' ), 'error_logged_count[+]' => 1 ], [ 'login' => $login ] );
if ( $mdb -> get( 'pp_users', 'error_logged_count', [ 'login' => $login ] ) >= 5 )
$mdb->update('pp_users', ['last_error_logged' => date('Y-m-d H:i:s'), 'error_logged_count[+]' => 1], ['login' => $login]);
if ($mdb->get('pp_users', 'error_logged_count', ['login' => $login]) >= 5)
{
$mdb -> update( 'pp_users', [ 'status' => 0 ], [ 'login' => $login ] );
$mdb->update('pp_users', ['status' => 0], ['login' => $login]);
return -1;
}
}
return 0;
}
public static function details( $login )
public static function details($login)
{
global $mdb;
return $mdb -> get( 'pp_users', '*', [ 'login' => $login ] );
return $mdb->get('pp_users', '*', ['login' => $login]);
}
public static function check_privileges( $name, $user_id )
public static function check_privileges($name, $user_id)
{
global $mdb;
if ( $user_id == 1 )
if ($user_id == 1)
return true;
else
{
if ( !$privilages = \Cache::fetch( "check_privileges:$user_id:$name-tmp" ) )
{
$privilages = $mdb -> count( 'pp_users_privileges', [ 'AND' => ['name' => $name, 'id_user' => (int)$user_id ]]);
\Cache::store( "check_privileges:$user_id:$name", $privilages );
}
return $privilages;
if (!$privilages = \Cache::fetch("check_privileges:$user_id:$name-tmp"))
{
$privilages = $mdb->count('pp_users_privileges', ['AND' => ['name' => $name, 'id_user' => (int)$user_id]]);
\Cache::store("check_privileges:$user_id:$name", $privilages);
}
return $privilages;
}
}
static public function get_by_id(int $userId): ?array
{
global $mdb;
return $mdb->get('pp_users', '*', ['id' => $userId]) ?: null;
}
static public function send_twofa_code(int $userId, bool $resend = false): bool
{
$user = self::get_by_id($userId);
if (!$user)
return false;
if ((int)$user['twofa_enabled'] !== 1)
{
return false;
}
$to = $user['twofa_email'] ?: $user['login'];
if (!filter_var($to, FILTER_VALIDATE_EMAIL))
{
return false;
}
if ($resend && !empty($user['twofa_sent_at']))
{
$last = strtotime($user['twofa_sent_at']);
if ($last && (time() - $last) < 30)
{
return false;
}
}
$code = random_int(100000, 999999);
$hash = password_hash((string)$code, PASSWORD_DEFAULT);
self::update_by_id($userId, [
'twofa_code_hash' => $hash,
'twofa_expires_at' => date('Y-m-d H:i:s', time() + 10 * 60), // 10 minut
'twofa_sent_at' => date('Y-m-d H:i:s'),
'twofa_failed_attempts' => 0,
]);
$subject = 'Twój kod logowania 2FA';
$body = "Twój kod logowania do panelu administratora: {$code}. Kod jest ważny przez 10 minut. Jeśli to nie Ty inicjowałeś logowanie zignoruj tę wiadomość i poinformuj administratora.";
$sent = \S::send_email($to, $subject, $body);
if (!$sent) {
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=UTF-8\r\n";
$headers .= "From: no-reply@" . ($_SERVER['HTTP_HOST'] ?? 'localhost') . "\r\n";
$encodedSubject = mb_encode_mimeheader($subject, 'UTF-8');
$sent = mail($to, $encodedSubject, $body, $headers);
}
return $sent;
}
static public function update_by_id(int $userId, array $data): bool
{
global $mdb;
return (bool)$mdb->update('pp_users', $data, ['id' => $userId]);
}
static public function verify_twofa_code(int $userId, string $code): bool
{
$user = self::get_by_id( $userId );
if (!$user) return false;
if ((int)$user['twofa_failed_attempts'] >= 5)
{
return false; // zbyt wiele prób
}
// sprawdź ważność
if (empty($user['twofa_expires_at']) || time() > strtotime($user['twofa_expires_at']))
{
// wyczyść po wygaśnięciu
self::update_by_id($userId, [
'twofa_code_hash' => null,
'twofa_expires_at' => null,
]);
return false;
}
$ok = (!empty($user['twofa_code_hash']) && password_verify($code, $user['twofa_code_hash']));
if ($ok)
{
// sukces: czyścimy wszystko
self::update_by_id($userId, [
'twofa_code_hash' => null,
'twofa_expires_at' => null,
'twofa_sent_at' => null,
'twofa_failed_attempts' => 0,
'last_logged' => date('Y-m-d H:i:s'),
]);
return true;
}
// zła próba — inkrementacja
self::update_by_id($userId, [
'twofa_failed_attempts' => (int)$user['twofa_failed_attempts'] + 1,
'last_error_logged' => date('Y-m-d H:i:s'),
]);
return false;
}
}
?>

View File

@@ -7,6 +7,10 @@ class Page {
{
global $user;
if ( $_GET['module'] == 'user' && $_GET['action'] == 'twofa' ) {
return \admin\controls\Users::twofa();
}
if ( !$user || !$user['admin'] )
return \admin\view\Users::login_form();

View File

@@ -782,13 +782,13 @@ class S
/* htaccess */
if ($row2['page_type'] != 3)
{
if ($row['start'] and $row2['start'])
if ( $row['start'] and $row2['start'] )
{
$htaccess_data .= PHP_EOL . 'RewriteRule ^$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]' . PHP_EOL;
if ($row2['seo_link'])
if ( $row2['seo_link'] )
{
$htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/' . \S::seo($row2['seo_link']) . '$';
$htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/' . \S::seo( $row2['seo_link'] ) . '(|/)$';
$htaccess_data .= PHP_EOL . 'RewriteRule ^(.*)$ ' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . ' [R=301,L]';
$htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/' . \S::seo($row2['seo_link']) . '/s/1$';
@@ -938,93 +938,49 @@ class S
else
$site_map[$url] .= '</urlset>';
$scheme = $settings['ssl'] ? 'https' : 'http';
$redirect = 'RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$'. PHP_EOL;
if ( $settings['ssl'] )
{
if ( $settings['link_version'] )
{
$redirect = 'RewriteCond %{HTTP_HOST} !^www\.' . PHP_EOL
. 'RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
. 'RewriteCond %{SERVER_PORT} !=443' . PHP_EOL
. 'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL;
if ( !$settings['url_version'] )
$redirect .= '## Remove trailing slash' . PHP_EOL
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
. 'RewriteRule ^(.*)/$ https://%{HTTP_HOST}/$1 [L,R=301]';
else
$redirect .= '## Add trailing slash' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !(/$|\.)' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
. 'RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]';
$htaccess_data = str_replace( '{REDIRECT}', $redirect, $htaccess_data );
}
else
{
$redirect = 'RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]' . PHP_EOL
. 'RewriteRule ^(.*)$ https://%1/$1 [R=301,L]' . PHP_EOL
. 'RewriteCond %{SERVER_PORT} !=443' . PHP_EOL
. 'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL;
if ( !$settings['url_version'] )
$redirect .= '## Remove trailing slash' . PHP_EOL
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
. 'RewriteRule ^(.*)/$ https://%{HTTP_HOST}/$1 [L,R=301]';
else
$redirect .= '## Add trailing slash' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !(/$|\.)' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
. 'RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]';
$htaccess_data = str_replace( '{REDIRECT}', $redirect, $htaccess_data );
}
$redirect .= 'RewriteCond %{HTTPS} off' . PHP_EOL
. 'RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]' . PHP_EOL;
}
else
{
if ($settings['link_version'])
{
$redirect = 'RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]' . PHP_EOL
. 'RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL
. 'RewriteCond %{SERVER_PORT} =443' . PHP_EOL
. 'RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL;
if ( !$settings['url_version'] )
$redirect .= '## Remove trailing slash' . PHP_EOL
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
. 'RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [L,R=301]';
else
$redirect .= '## Add trailing slash' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !(/$|\.)' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
. 'RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]';
$htaccess_data = str_replace( '{REDIRECT}', $redirect, $htaccess_data );
}
else
{
$redirect = 'RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]' . PHP_EOL
. 'RewriteRule ^(.*)$ http://%1/$1 [R=301,L]' . PHP_EOL
. 'RewriteCond %{SERVER_PORT} =443' . PHP_EOL
. 'RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]' . PHP_EOL;
if ( !$settings['url_version'] )
$redirect .= '## Remove trailing slash' . PHP_EOL
. 'RewriteCond %{REQUEST_FILENAME} !-d [NC]' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
. 'RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [L,R=301]';
else
$redirect .= '## Add trailing slash' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !(/$|\.)' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]' . PHP_EOL
. 'RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]';
$htaccess_data = str_replace( '{REDIRECT}', $redirect, $htaccess_data );
}
$redirect .= 'RewriteCond %{HTTPS} on' . PHP_EOL
. 'RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]' . PHP_EOL;
}
$redirect .= 'RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$'. PHP_EOL;
if ( $settings['link_version'] )
{
$redirect .= 'RewriteCond %{HTTP_HOST} !^www\. [NC]' . PHP_EOL
. 'RewriteRule ^ ' . $scheme . '://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]' . PHP_EOL;
}
else
{
$redirect .= 'RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]' . PHP_EOL
. 'RewriteRule ^ ' . $scheme . '://%1%{REQUEST_URI} [L,R=301]' . PHP_EOL;
}
$redirect .= 'RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$'. PHP_EOL;
if ( $settings['url_version'] )
{
$redirect .= 'RewriteCond %{REQUEST_URI} !^/admin(?:/.*)?$ [NC]' . PHP_EOL
. 'RewriteRule ^(.+)/$ ' . $scheme . '://%{HTTP_HOST}/$1 [L,R=301]' . PHP_EOL;
}
else
{
$redirect .= 'RewriteCond %{REQUEST_URI} !^/admin(/|$) [NC]' . PHP_EOL
. 'RewriteCond %{REQUEST_FILENAME} !-f' . PHP_EOL
. 'RewriteCond %{REQUEST_FILENAME} !-d' . PHP_EOL
. 'RewriteCond %{REQUEST_URI} !/$' . PHP_EOL
. 'RewriteRule ^(.+)$ ' . $scheme . '://%{HTTP_HOST}/$1/ [L,R=301]' . PHP_EOL;
}
$htaccess_data = str_replace( '{REDIRECT}', $redirect, $htaccess_data );
$additional_classes = file_get_contents('../libraries/additional-classes.ini');
$additional_classes = explode(PHP_EOL, $additional_classes);
$additional_classes = array_filter($additional_classes);
@@ -1267,14 +1223,15 @@ class S
{
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
public static function send_email($email, $subject, $text, $replay = '', $file = '')
public static function send_email( $email, $subject, $text, $replay = '', $file = '' )
{
global $settings;
if (file_exists('libraries/phpmailer/class.phpmailer.php')) require_once 'libraries/phpmailer/class.phpmailer.php';
if (file_exists('libraries/phpmailer/class.smtp.php')) require_once 'libraries/phpmailer/class.smtp.php';
if (file_exists('../libraries/phpmailer/class.phpmailer.php')) require_once '../libraries/phpmailer/class.phpmailer.php';
if (file_exists('../libraries/phpmailer/class.smtp.php')) require_once '../libraries/phpmailer/class.smtp.php';
if ($email and $subject)
if ( file_exists('libraries/phpmailer/class.phpmailer.php') ) require_once 'libraries/phpmailer/class.phpmailer.php';
if ( file_exists('libraries/phpmailer/class.smtp.php') ) require_once 'libraries/phpmailer/class.smtp.php';
if ( file_exists('../libraries/phpmailer/class.phpmailer.php') ) require_once '../libraries/phpmailer/class.phpmailer.php';
if ( file_exists('../libraries/phpmailer/class.smtp.php') ) require_once '../libraries/phpmailer/class.smtp.php';
if ( $email and $subject )
{
$mail = new PHPMailer();
$mail->IsSMTP();
@@ -1295,12 +1252,12 @@ class S
if (self::email_check($replay))
{
$mail->AddReplyTo($replay, $replay);
$mail -> SetFrom( $settings['email_login'], $settings['email_login'] );
$mail->SetFrom($settings['contact_email'], $settings['contact_email']);
}
else
{
$mail->AddReplyTo( $settings['contact_email'], $settings['firm_name'] );
$mail->SetFrom( $settings['email_login'], $settings['firm_name']);
$mail->AddReplyTo($settings['contact_email'], $settings['firm_name']);
$mail->SetFrom($settings['contact_email'], $settings['firm_name']);
}
$mail->AddAddress($email, '');
@@ -1320,8 +1277,8 @@ class S
$mail->AddAttachment($file);
}
$mail->IsHTML(true);
return $mail->Send();
return $mail -> Send();
}
return false;
return true;
}
}

View File

@@ -1,85 +1,183 @@
<?php
namespace front\factory;
class Articles
{
public static function pixieset_save_favorite_images( $hash ) {
static public function generateTableOfContents($content)
{
$result = '';
$prevLevel = 0;
$stack = [];
// Tylko h1h3
preg_match_all('/<(h[1-3])([^>]*)>(.*?)<\/\1>/i', $content, $matches, PREG_SET_ORDER);
if (empty($matches))
{
return '';
}
foreach ($matches as $match)
{
$level = (int)substr($match[1], 1);
$text = trim($match[3]);
// Pobierz lub wygeneruj ID
preg_match('/\sid=["\']?([^"\']+)["\']?/', $match[2], $idMatch);
$id = isset($idMatch[1])
? $idMatch[1]
: strtolower(preg_replace('/[^a-z0-9]+/u', '-', html_entity_decode(strip_tags($text), ENT_QUOTES, 'UTF-8')));
if ($prevLevel === 0)
{
$prevLevel = $level;
$stack[] = $level;
}
if ($level > $prevLevel)
{
for ($i = $prevLevel; $i < $level; $i++)
{
$result .= '<ol>';
$stack[] = $i + 1;
}
}
elseif ($level < $prevLevel)
{
for ($i = $prevLevel; $i > $level; $i--)
{
$result .= '</li></ol>';
array_pop($stack);
}
$result .= '</li>';
}
else
{
$result .= '</li>';
}
$result .= '<li><a href="#' . htmlspecialchars($id) . '">' . $text . '</a>';
$prevLevel = $level;
}
// Zamknij pozostałe listy
while (!empty($stack))
{
$result .= '</li></ol>';
array_pop($stack);
}
return '<ol>' . $result . '</ol>';
}
// funkcja wywoływana dla każdego dopasowania do wyrażenia regularnego
static public function processHeaders($matches)
{
$level = $matches[1];
$attrs = $matches[2];
$content = $matches[3];
$id_attr = 'id=';
$id_attr_pos = strpos($attrs, $id_attr);
if ($id_attr_pos === false)
{ // jeśli nie ma atrybutu id
$id = \S::seo($content);
$attrs .= sprintf(' id="%s"', $id);
}
$html = sprintf('<h%d%s>%s</h%d>', $level, $attrs, $content, $level);
return $html;
}
static public function generateHeadersIds($text)
{
$pattern = '/<h([1-6])(.*?)>(.*?)<\/h\1>/si';
$text = preg_replace_callback($pattern, array(__CLASS__, 'processHeaders'), $text);
return $text;
}
public static function pixieset_save_favorite_images($hash)
{
global $mdb, $settings;
\S::delete_dir( 'temp/' );
\S::delete_dir('temp/');
$rows = $mdb -> select( 'pp_articles', [ 'id' ], [ 'hash' => $hash ] );
if ( is_array( $rows ) ) foreach ( $rows as $row ) {
$article = \front\factory\Articles::article_details( $row['id'], 'pl' );
$rows = $mdb->select('pp_articles', ['id'], ['hash' => $hash]);
if (is_array($rows)) foreach ($rows as $row)
{
$article = \front\factory\Articles::article_details($row['id'], 'pl');
$text = '<p>Witaj,<br />';
$text .= 'Użytkownik zatwierdził listę wybranych przez siebie zdjęć.<br />';
$text .= 'Poniżej znajdziesz nazwy wybranych zdjęć.</p>';
$text .= '<ul>';
if ( is_array( $article['images'] ) ) foreach ( $article['images'] as $image )
if ( $image['favorite'] )
$text .= '<li>' . basename( $image['src'] ) . '</li>';
if (is_array($article['images'])) foreach ($article['images'] as $image)
if ($image['favorite'])
$text .= '<li>' . basename($image['src']) . '</li>';
$text .= '</ul>';
\S::send_email( $settings['contact_email'], 'Powiadomienie ze strony: ' . $_SERVER['SERVER_NAME'], $text );
\S::send_email($settings['contact_email'], 'Powiadomienie ze strony: ' . $_SERVER['SERVER_NAME'], $text);
return true;
}
return false;
}
public static function pixieset_image_favorite( $image_id, $hash )
public static function pixieset_image_favorite($image_id, $hash)
{
global $mdb;
$rows = $mdb -> select( 'pp_articles', [ 'id' ], [ 'hash' => $hash ] );
if ( is_array( $rows ) ) foreach ( $rows as $row )
$rows = $mdb->select('pp_articles', ['id'], ['hash' => $hash]);
if (is_array($rows)) foreach ($rows as $row)
{
$status = $mdb -> get( 'pp_articles_images', 'favorite', [ 'AND' => [ 'article_id' => $row['id'], 'id' => $image_id ] ] );
$mdb -> update( 'pp_articles_images', [ 'favorite' => !$status ], [ 'AND' => [ 'article_id' => $row['id'], 'id' => $image_id ] ] );
$status = $mdb->get('pp_articles_images', 'favorite', ['AND' => ['article_id' => $row['id'], 'id' => $image_id]]);
$mdb->update('pp_articles_images', ['favorite' => !$status], ['AND' => ['article_id' => $row['id'], 'id' => $image_id]]);
\S::delete_dir( 'temp/' );
\S::delete_dir('temp/');
return !$status;
}
}
public static function article_password( $article_id )
public static function article_password($article_id)
{
global $mdb;
return $mdb -> get( 'pp_articles', 'password', [ 'id' => $article_id ] );
return $mdb->get('pp_articles', 'password', ['id' => $article_id]);
}
public static function articles_by_tags( $tag_id, $lang_id )
public static function articles_by_tags($tag_id, $lang_id)
{
global $mdb;
if ( !$articles = \Cache::fetch( "articles_by_tags:$tag_id:$lang_id" ) )
if (!$articles = \Cache::fetch("articles_by_tags:$tag_id:$lang_id"))
{
$results = $mdb -> query( 'SELECT '
. 'pa.id '
. 'FROM '
. 'pp_articles AS pa '
. 'INNER JOIN pp_articles_tags AS pat ON pat.article_id = pa.id '
. 'WHERE '
. 'status = 1 '
. 'AND '
. 'tag_id = ' . (int)$tag_id ) -> fetchAll();
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
$articles[] = \front\factory\Articles::article_details( $row['id'], $lang_id );
$results = $mdb->query('SELECT '
. 'pa.id '
. 'FROM '
. 'pp_articles AS pa '
. 'INNER JOIN pp_articles_tags AS pat ON pat.article_id = pa.id '
. 'WHERE '
. 'status = 1 '
. 'AND '
. 'tag_id = ' . (int)$tag_id)->fetchAll();
if (is_array($results) and !empty($results)) foreach ($results as $row)
$articles[] = \front\factory\Articles::article_details($row['id'], $lang_id);
\Cache::store( "articles_by_tags:$tag_id:$lang_id", $articles );
\Cache::store("articles_by_tags:$tag_id:$lang_id", $articles);
}
return $articles;
}
public static function tag_details( $tag_id )
public static function tag_details($tag_id)
{
global $mdb;
if ( !$tag = \Cache::fetch( "tag_details:$tag_id" ) )
if (!$tag = \Cache::fetch("tag_details:$tag_id"))
{
$tag = $mdb -> get( 'pp_tags', '*', [ 'id' => (int)$tag_id ] );
$tag = $mdb->get('pp_tags', '*', ['id' => (int)$tag_id]);
\Cache::store( "tag_details:$tag_id", $tag );
\Cache::store("tag_details:$tag_id", $tag);
}
return $tag;
}
@@ -88,269 +186,293 @@ class Articles
{
global $mdb;
if ( !$tags = \Cache::fetch( 'tags' ) )
if (!$tags = \Cache::fetch('tags'))
{
$tags = $mdb -> query( 'SELECT '
. 'name, COUNT( tag_id ) AS c '
. 'FROM '
. 'pp_tags AS pt '
. 'INNER JOIN pp_articles_tags ON pt.id = tag_id '
. 'GROUP BY '
. 'tag_id '
. 'ORDER BY '
. 'c DESC '
. 'LIMIT 20'
) -> fetchAll();
$tags = $mdb->query(
'SELECT '
. 'name, COUNT( tag_id ) AS c '
. 'FROM '
. 'pp_tags AS pt '
. 'INNER JOIN pp_articles_tags ON pt.id = tag_id '
. 'GROUP BY '
. 'tag_id '
. 'ORDER BY '
. 'c DESC '
. 'LIMIT 20'
)->fetchAll();
\Cache::store( 'tags', $tags );
\Cache::store('tags', $tags);
}
return $tags;
}
public static function articles_by_date( $month, $year, $lang_id )
public static function articles_by_date($month, $year, $lang_id)
{
global $mdb;
if ( !$articles = \Cache::fetch( "articles_by_date:$month:$year:$lang_id" ) )
if (!$articles = \Cache::fetch("articles_by_date:$month:$year:$lang_id"))
{
$results = $mdb -> query( 'SELECT '
. 'id '
. 'FROM '
. 'pp_articles '
. 'WHERE '
. 'status = 1 '
. 'AND '
. '( '
. '( date_start BETWEEN \'' . date( 'Y-m-d', strtotime( '01-' . $month . '-' . $year ) ) . '\' AND \'' . date( 'Y-m-t', strtotime( '01-' . $month . '-' . $year ) ) . '\' ) '
. 'OR '
. '( date_end BETWEEN \'' . date( 'Y-m-d', strtotime( '01-' . $month . '-' . $year ) ) . '\' AND \'' . date( 'Y-m-t', strtotime( '01-' . $month . '-' . $year ) ) . '\' ) '
. 'OR '
. '( date_start <= \'' . date( 'Y-m-t', strtotime( '01-' . $month . '-' . $year ) ) . '\' AND date_end >= \'' . date( 'Y-m-t', strtotime( '01-' . $month . '-' . $year ) ) . '\' ) '
. ')' ) -> fetchAll();
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
$articles[] = \front\factory\Articles::article_details( $row['id'], $lang_id );
$results = $mdb->query('SELECT '
. 'id '
. 'FROM '
. 'pp_articles '
. 'WHERE '
. 'status = 1 '
. 'AND '
. '( '
. '( date_start BETWEEN \'' . date('Y-m-d', strtotime('01-' . $month . '-' . $year)) . '\' AND \'' . date('Y-m-t', strtotime('01-' . $month . '-' . $year)) . '\' ) '
. 'OR '
. '( date_end BETWEEN \'' . date('Y-m-d', strtotime('01-' . $month . '-' . $year)) . '\' AND \'' . date('Y-m-t', strtotime('01-' . $month . '-' . $year)) . '\' ) '
. 'OR '
. '( date_start <= \'' . date('Y-m-t', strtotime('01-' . $month . '-' . $year)) . '\' AND date_end >= \'' . date('Y-m-t', strtotime('01-' . $month . '-' . $year)) . '\' ) '
. ')')->fetchAll();
if (is_array($results) and !empty($results)) foreach ($results as $row)
$articles[] = \front\factory\Articles::article_details($row['id'], $lang_id);
\Cache::store( "articles_by_date:$month:$year:$lang_id", $articles );
\Cache::store("articles_by_date:$month:$year:$lang_id", $articles);
}
return $articles;
}
public static function news( $page_id, $limit = 6, $lang_id )
public static function news($page_id, $limit = 6, $lang_id)
{
$sort = \front\factory\Pages::page_sort( $page_id );
$sort = \front\factory\Pages::page_sort($page_id);
$articles_id = \front\factory\Articles::artciles_id( (int)$page_id, $lang_id, $limit, $sort, 0 );
if ( is_array( $articles_id ) and !empty( $articles_id ) ) foreach ( $articles_id as $article_id )
$articles[] = \front\factory\Articles::article_details( $article_id, $lang_id );
$articles_id = \front\factory\Articles::artciles_id((int)$page_id, $lang_id, $limit, $sort, 0);
if (is_array($articles_id) and !empty($articles_id)) foreach ($articles_id as $article_id)
$articles[] = \front\factory\Articles::article_details($article_id, $lang_id);
return $articles;
}
public static function get_image( $article, $skip_entry = false )
public static function get_image($article, $skip_entry = false)
{
if ( !$skip_entry )
if ($article['language']['main_image'])
{
if (file_exists(substr($article['language']['main_image'], 1, strlen($article['language']['main_image']))))
return $article['language']['main_image'];
}
if (!$skip_entry)
{
$dom = new \DOMDocument();
$dom -> loadHTML( mb_convert_encoding( $article['language']['entry'], 'HTML-ENTITIES', "UTF-8" ) );
$images = $dom -> getElementsByTagName( 'img' );
foreach ( $images as $img )
$dom->loadHTML(mb_convert_encoding($article['language']['entry'], 'HTML-ENTITIES', "UTF-8"));
$images = $dom->getElementsByTagName('img');
foreach ($images as $img)
{
$src = $img -> getAttribute( 'src' );
if ( file_exists( substr( $src, 1, strlen( $src ) ) ) )
$src = $img->getAttribute('src');
if (file_exists(substr($src, 1, strlen($src))))
return $src;
}
}
$dom = new \DOMDocument();
$dom -> loadHTML( mb_convert_encoding( $article['language']['text'], 'HTML-ENTITIES', "UTF-8" ) );
$images = $dom -> getElementsByTagName( 'img' );
foreach ( $images as $img )
$dom->loadHTML(mb_convert_encoding($article['language']['text'], 'HTML-ENTITIES', "UTF-8"));
$images = $dom->getElementsByTagName('img');
foreach ($images as $img)
{
$src = $img -> getAttribute( 'src' );
if ( file_exists( substr( $src, 1, strlen( $src ) ) ) )
$src = $img->getAttribute('src');
if (file_exists(substr($src, 1, strlen($src))))
return $src;
}
if ( $article['images'] )
if ($article['images'])
return $article['images'][0]['src'];
return false;
}
public static function article_noindex( $article_id )
public static function article_noindex($article_id)
{
global $mdb, $lang;
if ( !$noindex = \Cache::fetch( "article_noindex:$article_id:" . $lang[0] ) )
if (!$noindex = \Cache::fetch("article_noindex:$article_id:" . $lang[0]))
{
$noindex = $mdb -> get( 'pp_articles_langs', 'noindex', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $lang[0] ] ] );
$noindex = $mdb->get('pp_articles_langs', 'noindex', ['AND' => ['article_id' => (int)$article_id, 'lang_id' => $lang[0]]]);
\Cache::store( "article_noindex:$article_id:" . $lang[0], $noindex );
\Cache::store("article_noindex:$article_id:" . $lang[0], $noindex);
}
return $noindex;
}
public static function page_articles( $page, $lang_id, $bs )
public static function page_articles($page, $lang_id, $bs)
{
$count = \front\factory\Articles::page_articles_count( $page['id'], $lang_id );
$ls = ceil( $count / $page['articles_limit'] );
$count = \front\factory\Articles::page_articles_count($page['id'], $lang_id);
$ls = ceil($count / $page['articles_limit']);
if ( $bs < 1 )
if ($bs < 1)
$bs = 1;
else if ( $bs > $ls )
else if ($bs > $ls)
$bs = $ls;
$from = $page['articles_limit'] * ( $bs - 1 );
$from = $page['articles_limit'] * ($bs - 1);
if ( $from < 0 )
if ($from < 0)
$from = 0;
$results['articles'] = \front\factory\Articles::artciles_id( (int)$page['id'], $lang_id, (int)$page['articles_limit'], $page['sort_type'], $from );
$results['articles'] = \front\factory\Articles::artciles_id((int)$page['id'], $lang_id, (int)$page['articles_limit'], $page['sort_type'], $from);
$results['ls'] = $ls;
return $results;
}
public static function article_details( $article_id, $lang_id )
public static function article_details($article_id, $lang_id)
{
global $mdb;
if ( !$article = \Cache::fetch( "article_details:$lang_id:$article_id" ) )
if (!$article = \Cache::fetch("article_details:$lang_id:$article_id"))
{
$article = $mdb -> get( 'pp_articles', '*', [ 'id' => (int)$article_id ] );
$article = $mdb->get('pp_articles', '*', ['id' => (int)$article_id]);
$results = $mdb -> select( 'pp_articles_langs', '*', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $lang_id ] ] );
if ( is_array( $results ) ) foreach ( $results as $row )
$results = $mdb->select('pp_articles_langs', '*', ['AND' => ['article_id' => (int)$article_id, 'lang_id' => $lang_id]]);
if (is_array($results)) foreach ($results as $row)
{
if ( $row['copy_from'] )
if ($row['copy_from'])
{
$results2 = $mdb -> select( 'pp_articles_langs', '*', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $row['copy_from'] ] ] );
if ( is_array( $results2 ) ) foreach ( $results2 as $row2 )
$results2 = $mdb->select('pp_articles_langs', '*', ['AND' => ['article_id' => (int)$article_id, 'lang_id' => $row['copy_from']]]);
if (is_array($results2)) foreach ($results2 as $row2)
$article['language'] = $row2;
}
else
$article['language'] = $row;
preg_match_all( \front\view\Site::container_pattern, $article['language']['entry'], $container_list );
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
preg_match_all(\front\view\Site::container_pattern, $article['language']['entry'], $container_list);
if (is_array($container_list[0])) foreach ($container_list[0] as $container_list_tmp)
{
$container_list_tmp = explode( ':', $container_list_tmp );
$article['language']['entry'] = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $article['language']['entry'] );
$container_list_tmp = explode(':', $container_list_tmp);
$article['language']['entry'] = str_replace('[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer($container_list_tmp[1]), $article['language']['entry']);
}
preg_match_all( \front\view\Site::container_pattern, $article['language']['text'], $container_list );
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
preg_match_all(\front\view\Site::container_pattern, $article['language']['text'], $container_list);
if (is_array($container_list[0])) foreach ($container_list[0] as $container_list_tmp)
{
$container_list_tmp = explode( ':', $container_list_tmp );
$article['language']['text'] = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $article['language']['text'] );
$container_list_tmp = explode(':', $container_list_tmp);
$article['language']['text'] = str_replace('[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer($container_list_tmp[1]), $article['language']['text']);
}
}
$article['images'] = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC' ] ] );
$article['files'] = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id ] );
$article['pages'] = $mdb -> select( 'pp_articles_pages', 'page_id', [ 'article_id' => (int)$article_id ] );
$article['tags'] = $mdb -> select( 'pp_tags', [ '[><]pp_articles_tags' => [ 'id' => 'tag_id' ] ], 'name', [ 'article_id' => (int)$article_id ] );
$results = $mdb -> select( 'pp_articles_additional_params', [ '[><]pp_articles_additional_values' => [ 'id' => 'param_id' ] ], [ 'name', 'value', 'language_id' ], [ 'article_id' => (int)$article_id ] );
if ( is_array( $results ) ) foreach ( $results as $row )
$article['images'] = $mdb->select('pp_articles_images', '*', ['article_id' => (int)$article_id, 'ORDER' => ['o' => 'ASC', 'id' => 'ASC'] ] );
// załączniki
$article['files'] = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC'] ] );
$article['pages'] = $mdb->select('pp_articles_pages', 'page_id', ['article_id' => (int)$article_id]);
$article['tags'] = $mdb->select('pp_tags', ['[><]pp_articles_tags' => ['id' => 'tag_id']], 'name', ['article_id' => (int)$article_id]);
$results = $mdb->select('pp_articles_additional_params', ['[><]pp_articles_additional_values' => ['id' => 'param_id']], ['name', 'value', 'language_id'], ['article_id' => (int)$article_id]);
if (is_array($results)) foreach ($results as $row)
{
if ( !$row['language_id'] )
$params[ $row['name'] ] = $row['value'];
if (!$row['language_id'])
$params[$row['name']] = $row['value'];
else
$params[ $row['name'] ][$row['language_id']] = $row['value'];
$params[$row['name']][$row['language_id']] = $row['value'];
}
$article['params'] = $params;
\Cache::store( "article_details:$lang_id:$article_id", $article );
\Cache::store("article_details:$lang_id:$article_id", $article);
}
return $article;
}
public static function artciles_id( $page_id, $lang_id, $articles_limit, $sort_type, $from )
public static function artciles_id($page_id, $lang_id, $articles_limit, $sort_type, $from)
{
global $mdb;
switch ( $sort_type )
switch ($sort_type)
{
case 0: $order = 'priority DESC, date_add ASC'; break;
case 1: $order = 'priority DESC, date_add DESC'; break;
case 2: $order = 'priority DESC, date_modify ASC'; break;
case 3: $order = 'priority DESC, date_modify DESC'; break;
case 4: $order = 'priority DESC, o ASC'; break;
case 5: $order = 'priority DESC, title ASC'; break;
case 6: $order = 'priority DESC, title DESC'; break;
default: $order = 'priority DESC, id ASC'; break;
case 0:
$order = 'priority DESC, date_add ASC';
break;
case 1:
$order = 'priority DESC, date_add DESC';
break;
case 2:
$order = 'priority DESC, date_modify ASC';
break;
case 3:
$order = 'priority DESC, date_modify DESC';
break;
case 4:
$order = 'priority DESC, o ASC';
break;
case 5:
$order = 'priority DESC, title ASC';
break;
case 6:
$order = 'priority DESC, title DESC';
break;
default:
$order = 'priority DESC, id ASC';
break;
}
if ( !$output = \Cache::fetch( "artciles_id:$page_id:$lang_id:$order:$from:$articles_limit" ) )
if (!$output = \Cache::fetch("artciles_id:$page_id:$lang_id:$order:$from:$articles_limit"))
{
$results = $mdb -> query( 'SELECT * FROM ( '
. 'SELECT '
. 'a.id, date_modify, date_add, o, priority, '
. '( CASE '
. 'WHEN copy_from IS NULL THEN title '
. 'WHEN copy_from IS NOT NULL THEN ( '
. 'SELECT '
. 'title '
. 'FROM '
. 'pp_articles_langs '
. 'WHERE '
. 'lang_id = al.copy_from AND article_id = a.id '
. ') '
. 'END ) AS title '
. 'FROM '
. 'pp_articles_pages AS ap '
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
. 'WHERE '
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
. ') AS q1 '
. 'WHERE '
. 'q1.title IS NOT NULL '
. 'ORDER BY '
. 'q1.' . $order . ' '
. 'LIMIT '
. (int)$from . ',' . (int)$articles_limit ) -> fetchAll();
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
$results = $mdb->query('SELECT * FROM ( '
. 'SELECT '
. 'a.id, date_modify, date_add, o, priority, '
. '( CASE '
. 'WHEN copy_from IS NULL THEN title '
. 'WHEN copy_from IS NOT NULL THEN ( '
. 'SELECT '
. 'title '
. 'FROM '
. 'pp_articles_langs '
. 'WHERE '
. 'lang_id = al.copy_from AND article_id = a.id '
. ') '
. 'END ) AS title '
. 'FROM '
. 'pp_articles_pages AS ap '
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
. 'WHERE '
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
. ') AS q1 '
. 'WHERE '
. 'q1.title IS NOT NULL '
. 'ORDER BY '
. 'q1.' . $order . ' '
. 'LIMIT '
. (int)$from . ',' . (int)$articles_limit)->fetchAll();
if (is_array($results) and !empty($results)) foreach ($results as $row)
$output[] = $row['id'];
\Cache::store( "artciles_id:$page_id:$lang_id:$order:$from:$articles_limit", $output );
\Cache::store("artciles_id:$page_id:$lang_id:$order:$from:$articles_limit", $output);
}
return $output;
}
public static function page_articles_count( $page_id, $lang_id )
public static function page_articles_count($page_id, $lang_id)
{
global $mdb;
if ( !$output = \Cache::fetch( "page_articles_count:$page_id:$lang_id" ) )
if (!$output = \Cache::fetch("page_articles_count:$page_id:$lang_id"))
{
$results = $mdb -> query( 'SELECT COUNT(0) FROM ( '
. 'SELECT '
. 'a.id, '
. '( CASE '
. 'WHEN copy_from IS NULL THEN title '
. 'WHEN copy_from IS NOT NULL THEN ( '
. 'SELECT '
. 'title '
. 'FROM '
. 'pp_articles_langs '
. 'WHERE '
. 'lang_id = al.copy_from AND article_id = a.id '
. ') '
. 'END ) AS title '
. 'FROM '
. 'pp_articles_pages AS ap '
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
. 'WHERE '
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
. ') AS q1 '
. 'WHERE '
. 'q1.title IS NOT NULL' ) -> fetchAll();
$results = $mdb->query('SELECT COUNT(0) FROM ( '
. 'SELECT '
. 'a.id, '
. '( CASE '
. 'WHEN copy_from IS NULL THEN title '
. 'WHEN copy_from IS NOT NULL THEN ( '
. 'SELECT '
. 'title '
. 'FROM '
. 'pp_articles_langs '
. 'WHERE '
. 'lang_id = al.copy_from AND article_id = a.id '
. ') '
. 'END ) AS title '
. 'FROM '
. 'pp_articles_pages AS ap '
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
. 'WHERE '
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
. ') AS q1 '
. 'WHERE '
. 'q1.title IS NOT NULL')->fetchAll();
$output = $results[0][0];
\Cache::store( "page_articles_count:$page_id:$lang_id", $output );
\Cache::store("page_articles_count:$page_id:$lang_id", $output);
}
return $output;
}

View File

@@ -3,22 +3,22 @@ namespace front\factory;
class Menu
{
public static function submenu_details( $page_id )
public static function submenu_details( $page_id, $lang_id )
{
return self::subpages( $page_id );
return self::subpages( $page_id, $lang_id );
}
public static function subpages( $page_id )
static public function subpages( $page_id, $lang_id )
{
global $mdb;
if ( !$pages = \Cache::fetch( "subpages:$page_id" ) )
if ( !$pages = \Cache::fetch( "subpages:$page_id:$lang_id" ) )
{
$results = $mdb -> select( 'pp_pages', [ 'id' ], [ 'AND' => [ 'status' => 1, 'parent_id' => $page_id ], 'ORDER' => [ 'o' => 'ASC' ] ] );
if ( is_array( $results ) ) foreach ( $results as $row )
{
$page = \front\factory\Pages::page_details( $row['id'] );
$page['pages'] = self::subpages( $row['id'] );
$page['pages'] = self::subpages( $row['id'], $lang_id );
$pages[] = $page;
}

View File

@@ -31,12 +31,17 @@ class Articles
return $tpl -> render( 'articles/tags-cloud' );
}
public static function news( $page_id, $articles )
public static function news( $page_id, $articles, $template = '' )
{
$tpl = new \Tpl;
$tpl -> page_id = $page_id;
$tpl -> articles = $articles;
return $tpl -> render( 'articles/news' );
if ( $template )
$tpl = $template;
else
$tpl = 'articles/news';
return \Tpl::view( $tpl, [
'page_id' => $page_id,
'articles' => $articles
] );
}
public static function articles_list( $articles )
@@ -123,9 +128,10 @@ class Articles
$out .= \front\view\Articles::password_view( [ 'article' => $article ] );
else
{
$tpl = new \Tpl;
$tpl -> article = $article_details;
$out .= $tpl -> render( 'articles/article-full' );
$out .= \Tpl::view( 'articles/article-full', [
'article' => $article_details,
'table_of_contents' => \front\factory\Articles::generateTableOfContents( $article_details['language']['text'] )
] );
}
}

View File

@@ -1,4 +1,5 @@
<?php
namespace front\view;
class Site
@@ -8,7 +9,7 @@ class Site
const submenu_pattern = '/SUBMENU:[0-9]*/';
const container_pattern = '/KONTENER:[0-9]*/';
const language_pattern = '/LANG:[a-zA-Z0-9_-]*/';
const news_pattern = '/AKTUALNOSCI:([0-9]*)((:([0-9]*))?)/';
const news_pattern = '/AKTUALNOSCI:([0-9]+)(?::([0-9]*))?(?::([^:\]]+))?/';
const news_list_pattern = '/AKTUALNOSCI_LISTA:([0-9]*)((:([0-9]*))?)/';
const top_news_pattern = '/NAJPOULARNIEJSZE_ARTYKULY:([0-9]*)((:([0-9]*))?)/';
const article_pattern = '/ARTYKUL:[0-9]*/';
@@ -20,181 +21,193 @@ class Site
$settings['link_version'] ? $www = 'www.' : $www = '';
$settings['ssl'] == true ? $domain_prefix = 'https' : $domain_prefix = 'http';
$url = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );
$url = preg_replace('#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME']);
if ( \S::get( 'article' ) )
$layout = \front\factory\Layouts::article_layout( \S::get( 'article' ) );
if (\S::get('article'))
$layout = \front\factory\Layouts::article_layout(\S::get('article'));
if ( !$layout )
$layout = \front\factory\Layouts::active_layout( $page['id'] );
if (!$layout)
$layout = \front\factory\Layouts::active_layout($page['id']);
if ( \S::get( 'layout_id' ) )
$layout = \front\factory\Layouts::layout_details( \S::get( 'layout_id' ) );
if (\S::get('layout_id'))
$layout = \front\factory\Layouts::layout_details(\S::get('layout_id'));
if ( $settings['devel'] == true and file_exists( 'devel.html' ) )
$html = file_get_contents( 'devel.html' );
if ($settings['devel'] == true and file_exists('devel.html'))
$html = file_get_contents('devel.html');
else
{
if ( \S::is_mobile() and !empty( $layout['m_html'] ) )
if (\S::is_mobile() and !empty($layout['m_html']))
$html = $layout['m_html'];
else
$html = $layout['html'];
}
\S::set_session( 'layout_id', $layout['layout_id'] ? $layout['layout_id'] : $layout['id'] );
\S::set_session('layout_id', $layout['layout_id'] ? $layout['layout_id'] : $layout['id']);
if ( $settings['google_search_console'] )
$html = str_replace( '</head>', '<meta name="google-site-verification" content="' . $settings['google_search_console'] . '"></head>', $html );
if ($settings['google_search_console'])
$html = str_replace('</head>', '<meta name="google-site-verification" content="' . $settings['google_search_console'] . '"></head>', $html);
if ( \S::get_session( 'contrast' ) )
$html = str_replace( '</head>', '<link rel="stylesheet" type="text/css" href="/layout/contrast.css"></head>', $html );
if (\S::get_session('contrast'))
$html = str_replace('</head>', '<link rel="stylesheet" type="text/css" href="/layout/contrast.css"></head>', $html);
if ( $settings['facebook_link'] )
$html = str_replace( '</body>', \front\view\Site::facebook( $settings['facebook_link'] ) . '</body>', $html );
if ($settings['facebook_link'])
$html = str_replace('</body>', \front\view\Site::facebook($settings['facebook_link']) . '</body>', $html);
if ( strpos( $html, '[BANER_STRONA_GLOWNA]' ) === false )
$html = str_replace( '</body>', '[BANER_STRONA_GLOWNA]' . '</body>', $html );
if (strpos($html, '[BANER_STRONA_GLOWNA]') === false)
$html = str_replace('</body>', '[BANER_STRONA_GLOWNA]' . '</body>', $html);
if ( strpos( $html, '[WIDGET_TELEFON]' ) === false )
$html = str_replace( '</body>', '[WIDGET_TELEFON]' . '</body>', $html );
if (strpos($html, '[WIDGET_TELEFON]') === false)
$html = str_replace('</body>', '[WIDGET_TELEFON]' . '</body>', $html);
if ( $settings['ssl'] == true )
if ($settings['ssl'] == true)
{
$layout['css'] = str_replace( 'http://', 'https://', $layout['css'] );
$layout['js'] = str_replace( 'http://', 'https://', $layout['js'] );
$layout['m_css'] = str_replace( 'http://', 'https://', $layout['m_css'] );
$layout['m_js'] = str_replace( 'http://', 'https://', $layout['m_js'] );
$layout['css'] = str_replace('http://', 'https://', $layout['css']);
$layout['js'] = str_replace('http://', 'https://', $layout['js']);
$layout['m_css'] = str_replace('http://', 'https://', $layout['m_css']);
$layout['m_js'] = str_replace('http://', 'https://', $layout['m_js']);
}
$html = str_replace( '[COPYRIGHT]', \front\view\Site::copyright(), $html );
$html = str_replace( '[BANER_STRONA_GLOWNA]', \front\view\Banners::main_banner( \front\factory\Banners::main_banner() ), $html );
$html = str_replace( '[BANERY]', \front\view\Banners::banners( \front\factory\Banners::banners() ), $html );
$html = str_replace( '[LICZNIK_ODWIEDZIN]', \front\view\Site::visit_counter( \S::get_session( 'visits' ) ), $html );
$html = str_replace( '[WYSZUKIWARKA]', \front\view\Search::search_form(), $html );
$html = str_replace( '[CHMURA_TAGOW]', \front\view\Articles::tags_cloud(), $html );
$html = str_replace( '[KONTRAST]', \front\view\Site::contrast(), $html );
$html = str_replace( '[NEWSLETTER]', \front\view\Newsletter::newsletter(), $html );
$html = str_replace( '[WIDGET_TELEFON]', $settings['widget_phone'] == 1 ? \front\view\Site::widget_phone() : '', $html );
$html = str_replace('[COPYRIGHT]', \front\view\Site::copyright(), $html);
$html = str_replace('[BANER_STRONA_GLOWNA]', \front\view\Banners::main_banner(\front\factory\Banners::main_banner()), $html);
$html = str_replace('[BANERY]', \front\view\Banners::banners(\front\factory\Banners::banners()), $html);
$html = str_replace('[LICZNIK_ODWIEDZIN]', \front\view\Site::visit_counter(\S::get_session('visits')), $html);
$html = str_replace('[WYSZUKIWARKA]', \front\view\Search::search_form(), $html);
$html = str_replace('[CHMURA_TAGOW]', \front\view\Articles::tags_cloud(), $html);
$html = str_replace('[KONTRAST]', \front\view\Site::contrast(), $html);
$html = str_replace('[NEWSLETTER]', \front\view\Newsletter::newsletter(), $html);
$html = str_replace('[WIDGET_TELEFON]', $settings['widget_phone'] == 1 ? \front\view\Site::widget_phone() : '', $html);
if ( \S::is_mobile() and !empty( $layout['m_html'] ) )
$html = str_replace( '[CSS]', $layout['m_css'], $html );
if (\S::is_mobile() and !empty($layout['m_html']))
$html = str_replace('[CSS]', $layout['m_css'], $html);
else
$html = str_replace( '[CSS]', $layout['css'], $html );
$html = str_replace('[CSS]', $layout['css'], $html);
if ( \S::is_mobile() and !empty( $layout['m_html'] ) )
$html = str_replace( '[JAVA_SCRIPT]', $layout['m_js'], $html );
if (\S::is_mobile() and !empty($layout['m_html']))
$html = str_replace('[JAVA_SCRIPT]', $layout['m_js'], $html);
else
$html = str_replace( '[JAVA_SCRIPT]', $layout['js'], $html );
$html = str_replace('[JAVA_SCRIPT]', $layout['js'], $html);
preg_match_all( self::menu_pattern, $html, $menu );
if ( is_array( $menu[0] ) ) foreach( $menu[0] as $menu_tmp )
preg_match_all(self::menu_pattern, $html, $menu);
if (is_array($menu[0])) foreach ($menu[0] as $menu_tmp)
{
$menu_tmp = explode( ':', $menu_tmp );
$html = str_replace( '[MENU:' . $menu_tmp[1] . ']', \front\view\Menu::menu(
\front\factory\Menu::menu_details( $menu_tmp[1] ), $page['id']
), $html );
$menu_tmp = explode(':', $menu_tmp);
$html = str_replace('[MENU:' . $menu_tmp[1] . ']', \front\view\Menu::menu(
\front\factory\Menu::menu_details($menu_tmp[1]),
$page['id']
), $html);
}
preg_match_all( self::main_menu_pattern, $html, $menu );
if ( is_array( $menu[0] ) ) foreach( $menu[0] as $menu_tmp )
preg_match_all(self::main_menu_pattern, $html, $menu);
if (is_array($menu[0])) foreach ($menu[0] as $menu_tmp)
{
$menu_tmp = explode( ':', $menu_tmp );
$html = str_replace( '[MENU_GLOWNE:' . $menu_tmp[1] . ']', \front\view\Menu::main_menu(
\front\factory\Menu::menu_details( $menu_tmp[1] ), $page['id']
), $html );
$menu_tmp = explode(':', $menu_tmp);
$html = str_replace('[MENU_GLOWNE:' . $menu_tmp[1] . ']', \front\view\Menu::main_menu(
\front\factory\Menu::menu_details($menu_tmp[1]),
$page['id']
), $html);
}
preg_match_all( self::submenu_pattern, $html, $submenu );
if ( is_array( $submenu[0] ) ) foreach( $submenu[0] as $submenu_tmp )
preg_match_all(self::submenu_pattern, $html, $submenu);
if (is_array($submenu[0])) foreach ($submenu[0] as $submenu_tmp)
{
$submenu_tmp = explode( ':', $submenu_tmp );
$html = str_replace( '[SUBMENU:' . $submenu_tmp[1] . ']', \front\view\Menu::submenu(
\front\factory\Menu::submenu_details( $submenu_tmp[1] ), $page['id'], $submenu_tmp[1]
), $html );
$submenu_tmp = explode(':', $submenu_tmp);
$html = str_replace('[SUBMENU:' . $submenu_tmp[1] . ']', \front\view\Menu::submenu(
\front\factory\Menu::submenu_details($submenu_tmp[1], $lang_id),
$page['id'],
$submenu_tmp[1]
), $html);
}
preg_match_all( self::container_pattern, $html, $container_list );
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
preg_match_all(self::container_pattern, $html, $container_list);
if (is_array($container_list[0])) foreach ($container_list[0] as $container_list_tmp)
{
$container_list_tmp = explode( ':', $container_list_tmp );
$html = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $html );
$container_list_tmp = explode(':', $container_list_tmp);
$html = str_replace('[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer($container_list_tmp[1]), $html);
}
$html = str_replace( '[ZAWARTOSC]', \front\controls\Site::route(), $html );
$html = str_replace('[ZAWARTOSC]', \front\controls\Site::route(), $html);
preg_match_all( self::news_pattern, $html, $news_list );
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
if ( is_array( $news_list[0] ) )
{
$news_list_tmp = explode( ':', $news_list_tmp );
foreach ( $news_list[0] as $index => $news_list_tmp )
{
$id = $news_list[1][$index];
$limit = $news_list[2][$index] ?: $settings['news_limit'];
$extra = $news_list[3][$index] ?? '';
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
$pattern_parts = ['AKTUALNOSCI', $id];
if ($news_list[2][$index] !== '') $pattern_parts[] = $limit;
if ($extra !== '') $pattern_parts[] = $extra;
$pattern = '[' . implode(':', $pattern_parts) . ']';
$news_list_tmp[2] != '' ? $pattern = '[AKTUALNOSCI:' . $news_list_tmp[1] . ':' . $news_list_tmp[2] . ']' : $pattern = '[AKTUALNOSCI:' . $news_list_tmp[1] . ']';
$html = str_replace( $pattern, \front\view\Articles::news(
$news_list_tmp[1],
\front\factory\Articles::news( $news_list_tmp[1], $news_limit, $lang_id )
), $html );
$html = str_replace(
$pattern,
\front\view\Articles::news( $id, \front\factory\Articles::news( $id, $limit, $lang_id ), $extra ),
$html
);
}
}
// prosta lista aktualności z wybranej podstrony
preg_match_all( self::news_list_pattern, $html, $news_list );
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
preg_match_all(self::news_list_pattern, $html, $news_list);
if (is_array($news_list[0])) foreach ($news_list[0] as $news_list_tmp)
{
$news_list_tmp = explode( ':', $news_list_tmp );
$news_list_tmp = explode(':', $news_list_tmp);
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
$news_list_tmp[2] != '' ? $pattern = '[AKTUALNOSCI_LISTA:' . $news_list_tmp[1] . ':' . $news_list_tmp[2] . ']' : $pattern = '[AKTUALNOSCI_LISTA:' . $news_list_tmp[1] . ']';
$news_list = \Article::getNews( $news_list_tmp[1], $news_limit, $lang_id );
$view_news_list = \Article::newsList( $news_list );
$html = str_replace( $pattern, $view_news_list, $html );
$news_list = \Article::getNews($news_list_tmp[1], $news_limit, $lang_id);
$view_news_list = \Article::newsList($news_list);
$html = str_replace($pattern, $view_news_list, $html);
}
// prosta lista z najpopularniejszymi artykułami
preg_match_all( self::top_news_pattern, $html, $news_list );
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
preg_match_all(self::top_news_pattern, $html, $news_list);
if (is_array($news_list[0])) foreach ($news_list[0] as $news_list_tmp)
{
$news_list_tmp = explode( ':', $news_list_tmp );
$news_list_tmp = explode(':', $news_list_tmp);
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
$news_list_tmp[2] != '' ? $pattern = '[NAJPOULARNIEJSZE_ARTYKULY:' . $news_list_tmp[1] . ':' . $news_list_tmp[2] . ']' : $pattern = '[NAJPOULARNIEJSZE_ARTYKULY:' . $news_list_tmp[1] . ']';
$news_list = \Article::getTopNews( $news_list_tmp[1], $news_limit, $lang_id );
$view_news_list = \Article::newsList( $news_list );
$html = str_replace( $pattern, $view_news_list, $html );
$news_list = \Article::getTopNews($news_list_tmp[1], $news_limit, $lang_id);
$view_news_list = \Article::newsList($news_list);
$html = str_replace($pattern, $view_news_list, $html);
}
preg_match_all( self::language_pattern, $html, $language_list );
if ( is_array( $language_list[0] ) ) foreach( $language_list[0] as $language_list_tmp )
preg_match_all(self::language_pattern, $html, $language_list);
if (is_array($language_list[0])) foreach ($language_list[0] as $language_list_tmp)
{
$language_list_tmp = explode( ':', $language_list_tmp );
$html = str_replace( '[LANG:' . $language_list_tmp[1] . ']', \S::lang( $language_list_tmp[1] ), $html );
$language_list_tmp = explode(':', $language_list_tmp);
$html = str_replace('[LANG:' . $language_list_tmp[1] . ']', \S::lang($language_list_tmp[1]), $html);
}
if ( \S::get( 'article' ) )
if (\S::get('article'))
{
$article = \front\factory\Articles::article_details( \S::get( 'article' ), $lang_id );
$article = \front\factory\Articles::article_details(\S::get('article'), $lang_id);
$title = $article['language']['meta_title'] ? $article['language']['meta_title'] : $article['language']['title'];
$meta_keywords = $article['language']['meta_keywords'];
$meta_description = $article['language']['meta_description'];
$og_image = $article['language']['main_image'] ? $article['language']['main_image'] : null;
}
else if ( \S::get( 'tag' ) )
else if (\S::get('tag'))
{
$tag = \front\factory\Articles::tag_details( \S::get( 'tag' ) );
$tag = \front\factory\Articles::tag_details(\S::get('tag'));
$title = 'Tag: ' . $tag['name'];
$meta_keywords = $tag['name'];
$meta_description = 'Artykuły oznaczone tagiem: ' . $tag['name'];
}
else if ( \S::get( 'search' ) )
else if (\S::get('search'))
{
$title = 'Wyniki wyszukiwania: ' . \S::get_session( 'search_txt' );
$meta_keywords = \S::get_session( 'search_txt' );
$meta_description = 'Wyniki wyszukiwania: ' . \S::get_session( 'search_txt' );
$title = 'Wyniki wyszukiwania: ' . \S::get_session('search_txt');
$meta_keywords = \S::get_session('search_txt');
$meta_description = 'Wyniki wyszukiwania: ' . \S::get_session('search_txt');
}
else
{
if ( $page['language']['meta_title'] )
if ($page['language']['meta_title'])
$title = $page['language']['meta_title'];
else
$title = $page['language']['title'] . ' ● ' . $settings['firm_name'];
@@ -204,80 +217,80 @@ class Site
}
$seo_additional = \front\factory\SeoAdditional::seo_active();
if ( is_array( $seo_additional ) and count( $seo_additional ) ) foreach ( $seo_additional as $seo )
if (is_array($seo_additional) and count($seo_additional)) foreach ($seo_additional as $seo)
{
preg_match( '/' . str_replace( '/', '\/', $seo['url'] ) . '/', $_SERVER['REQUEST_URI'], $seo_results );
if ( is_array( $seo_results ) and count( $seo_results ) )
preg_match('/' . str_replace('/', '\/', $seo['url']) . '/', $_SERVER['REQUEST_URI'], $seo_results);
if (is_array($seo_results) and count($seo_results))
{
if ( $seo['title'] )
if ($seo['title'])
$title = $seo['title'];
if ( $seo['keywords'] )
if ($seo['keywords'])
$meta_keywords = $seo['keywords'];
if ( $meta_description )
if ($meta_description)
$meta_description = $seo['description'];
if ( $seo['text'] )
$html = str_replace( '[DODATKOWA_TRESC]', '<div class="seo-additional-text">' . $seo['text'] . '</div>', $html );
if ($seo['text'])
$html = str_replace('[DODATKOWA_TRESC]', '<div class="seo-additional-text">' . $seo['text'] . '</div>', $html);
else
$html = str_replace( '[DODATKOWA_TRESC]', '', $html );
$html = str_replace('[DODATKOWA_TRESC]', '', $html);
}
}
$html = str_replace( '[DODATKOWA_TRESC]', '', $html );
$html = str_replace( '[TITLE]', $title, $html );
$html = str_replace( '[META_KEYWORDS]', $meta_keywords, $html );
$html = str_replace( '[META_DESCRIPTION]', $meta_description, $html );
$html = str_replace( '[OG_URL]', $domain_prefix . '://' . $www . $url . $_SERVER["REQUEST_URI"], $html );
$html = str_replace( '[OG_IMG]', $og_image ? ( $domain_prefix . '://' . $www . $url . '/' . $og_image ) : '', $html );
$html = str_replace( '[JEZYKI]', \front\view\Languages::languages(), $html );
$html = str_replace( '[KALENDARZ]', \front\view\Site::calendar(), $html );
$html = str_replace( '[TYTUL_STRONY]', \front\view\Site::title(
$page['language']['title'],
$page['show_title'],
$page['language']['site_title']
), $html );
$html = str_replace( '[STRONA_GLOWNA]', \front\factory\Pages::lang_url(
\front\factory\Pages::main_page_id(),
$lang_id,
\S::get_domain( $_SERVER['HTTP_HOST'] ),
\front\factory\Languages::default_domain()
), $html );
$html = str_replace('[DODATKOWA_TRESC]', '', $html);
$html = str_replace('[TITLE]', $title, $html);
$html = str_replace('[META_KEYWORDS]', $meta_keywords, $html);
$html = str_replace('[META_DESCRIPTION]', $meta_description, $html);
$html = str_replace('[OG_URL]', $domain_prefix . '://' . $www . $url . $_SERVER["REQUEST_URI"], $html);
$html = str_replace('[OG_IMG]', $og_image ? ($domain_prefix . '://' . $www . $url . '/' . $og_image) : '', $html);
$html = str_replace('[JEZYKI]', \front\view\Languages::languages(), $html);
$html = str_replace('[KALENDARZ]', \front\view\Site::calendar(), $html);
$html = str_replace('[TYTUL_STRONY]', \front\view\Site::title(
$page['language']['title'],
$page['show_title'],
$page['language']['site_title']
), $html);
$html = str_replace('[STRONA_GLOWNA]', \front\factory\Pages::lang_url(
\front\factory\Pages::main_page_id(),
$lang_id,
\S::get_domain($_SERVER['HTTP_HOST']),
\front\factory\Languages::default_domain()
), $html);
preg_match_all( self::article_pattern, $html, $articles_list );
if ( is_array( $articles_list[0] ) ) foreach( $articles_list[0] as $article_tmp )
preg_match_all(self::article_pattern, $html, $articles_list);
if (is_array($articles_list[0])) foreach ($articles_list[0] as $article_tmp)
{
$article_tmp = explode( ':', $article_tmp );
$html = str_replace( '[ARTYKUL:' . $article_tmp[1] . ']', \front\view\Articles::article_full( $article_tmp[1], $lang_id ), $html );
$article_tmp = explode(':', $article_tmp);
$html = str_replace('[ARTYKUL:' . $article_tmp[1] . ']', \front\view\Articles::article_full($article_tmp[1], $lang_id), $html);
}
/* atrybut noindex */
if ( \S::get( 'article' ) )
if (\S::get('article'))
{
\front\factory\Articles::article_noindex( \S::get( 'article' ) ) === '1' ? $noindex = 'noindex' : $noindex = 'index, follow';
$html = str_replace( '[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html );
\front\factory\Articles::article_noindex(\S::get('article')) === '1' ? $noindex = 'noindex' : $noindex = 'index, follow';
$html = str_replace('[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html);
}
else
{
$page['language']['noindex'] === '1' ? $noindex = 'noindex' : $noindex = 'index, follow';
$html = str_replace( '[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html );
$html = str_replace('[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html);
}
if ( $page['language']['canonical'] )
$html = str_replace( '</head>', '<link rel="canonical" href="' . $page['language']['canonical'] . '" /></head>', $html );
if ($page['language']['canonical'])
$html = str_replace('</head>', '<link rel="canonical" href="' . $page['language']['canonical'] . '" /></head>', $html);
while ( strpos( $html, '[PHP]' ) !== false )
while (strpos($html, '[PHP]') !== false)
{
$text = explode( '[PHP]', $html );
$text = explode('[PHP]', $html);
$before = $text[0];
for ( $i = 1; $i < count( $text ); $i++ )
for ($i = 1; $i < count($text); $i++)
{
$temp = explode( '[/PHP]' , $text[$i] );
$temp = explode('[/PHP]', $text[$i]);
$code = $temp[0];
ob_start();
eval( str_replace( '&#39;', '"', $code ) );
eval(str_replace('&#39;', '"', $code));
$out .= ob_get_contents();
ob_end_clean();
@@ -286,19 +299,19 @@ class Site
$html = $before . $out;
}
preg_match_all( self::maps_pattern, $html, $maps_list );
if ( is_array( $maps_list[1] ) and !empty( $maps_list[1] ) )
preg_match_all(self::maps_pattern, $html, $maps_list);
if (is_array($maps_list[1]) and !empty($maps_list[1]))
{
$html = strrev( implode( strrev( '<link class="footer" rel="stylesheet" type="text/css" href="/libraries/leaflet/leaflet.css"><script class="footer" type="text/javascript" src="/libraries/leaflet/leaflet.js"></script></head>' ), explode( strrev( '</head>' ), strrev( $html ), 2 ) ) );
foreach( $maps_list[1] as $map_tmp )
$html = strrev(implode(strrev('<link class="footer" rel="stylesheet" type="text/css" href="/libraries/leaflet/leaflet.css"><script class="footer" type="text/javascript" src="/libraries/leaflet/leaflet.js"></script></head>'), explode(strrev('</head>'), strrev($html), 2)));
foreach ($maps_list[1] as $map_tmp)
{
++$map_counter;
$map_settings = explode( '|', $map_tmp );
$html = str_replace( '[MAPA]' . $map_tmp . '[/MAPA]', \front\view\Articles::map( $map_settings, $map_counter ), $html );
$map_settings = explode('|', $map_tmp);
$html = str_replace('[MAPA]' . $map_tmp . '[/MAPA]', \front\view\Articles::map($map_settings, $map_counter), $html);
}
}
$html = str_replace( '[ALERT]', \front\view\Site::alert(), $html );
$html = str_replace('[ALERT]', \front\view\Site::alert(), $html);
return $html;
}
@@ -306,91 +319,90 @@ class Site
public static function widget_phone()
{
$tpl = new \Tpl;
return $tpl -> render( 'widgets/widget-phone' );
return $tpl->render('widgets/widget-phone');
}
public static function facebook( $facebook_link )
public static function facebook($facebook_link)
{
$tpl = new \Tpl;
$tpl -> facebook_link = $facebook_link;
return $tpl -> render( 'site/facebook' );
$tpl->facebook_link = $facebook_link;
return $tpl->render('site/facebook');
}
public static function title( $title, $show_title, $site_title )
public static function title($title, $show_title, $site_title)
{
if ( !$show_title )
if (!$show_title)
return false;
if ( $site_title )
if ($site_title)
$title = $site_title;
$tpl = new \Tpl;
$tpl -> title = $title;
return $tpl -> render( 'site/title' );
$tpl->title = $title;
return $tpl->render('site/title');
}
static public function alert()
{
if ( $alert = \S::get_session( 'alert' ) )
if ($alert = \S::get_session('alert'))
{
\S::delete_session( 'alert' );
\S::delete_session( 'alert-class' );
\S::delete_session('alert');
\S::delete_session('alert-class');
return \Tpl::view( 'site/alert', [
return \Tpl::view('site/alert', [
'alert' => $alert,
'alert_class' => \S::get_session( 'alert-class' )
] );
'alert_class' => \S::get_session('alert-class')
]);
}
}
public static function copyright()
{
$tpl = new \Tpl;
return $tpl -> render( 'site/copyright' );
return $tpl->render('site/copyright');
}
public static function contact()
{
$tpl = new \Tpl;
return $tpl -> render( 'site/contact' );
return $tpl->render('site/contact');
}
public static function cookie_information()
{
$tpl = new \Tpl;
return $tpl -> render( 'site/cookie-information' );
return $tpl->render('site/cookie-information');
}
public static function calendar( $month = '', $year = '', $ajax = false )
public static function calendar($month = '', $year = '', $ajax = false)
{
global $settings, $lang_id;
if ( !$settings['calendar'] )
if (!$settings['calendar'])
return false;
if ( !$month ) $month = date( 'n' );
if ( !$year ) $year = date( 'Y' );
if (!$month) $month = date('n');
if (!$year) $year = date('Y');
$tpl = new \Tpl;
$tpl -> month = $month;
$tpl -> year = $year;
$tpl -> months = \S::months();
$tpl -> ajax = $ajax;
$tpl -> articles = \front\factory\Articles::articles_by_date( $month, $year, $lang_id );
return $tpl -> render( 'site/calendar' );
$tpl->month = $month;
$tpl->year = $year;
$tpl->months = \S::months();
$tpl->ajax = $ajax;
$tpl->articles = \front\factory\Articles::articles_by_date($month, $year, $lang_id);
return $tpl->render('site/calendar');
}
public static function visit_counter( $visit_counter )
public static function visit_counter($visit_counter)
{
$tpl = new \Tpl;
$tpl -> visit_counter = $visit_counter;
return $tpl -> render( 'site/visit-counter' );
$tpl->visit_counter = $visit_counter;
return $tpl->render('site/visit-counter');
}
public static function contrast()
{
$tpl = new \Tpl;
return $tpl -> render( 'site/contrast' );
return $tpl->render('site/contrast');
}
}
?>

View File

@@ -13,11 +13,11 @@ RewriteRule ^admin/([^/]*)/([^/]*)/(.*)$ admin/index.php?module=$1&action=$2&$3
{PIXIESET]
{ADDITIONAL_CLASSES}
RewriteRule ^admin/$ admin/index.php [L]
RewriteRule ^wyszukiwarka$ index.php?search=true&lang=pl [L]
RewriteRule ^wersja-tymczasowa$ index.php?devel=true&lang=pl [L]
RewriteRule ^wyszukiwarka(|/)$ index.php?search=true&lang=pl [L]
RewriteRule ^wersja-tymczasowa(|/)$ index.php?devel=true&lang=pl [L]
RewriteRule ^pixieset/(.*)$ index.php?module=articles&action=image&hash=$1 [L]
RewriteRule ^pixieset-wszystkie/(.*)$ index.php?module=articles&action=images_download&hash=$1 [L]
RewriteRule ^audyt-seo/wynik$ index.php?module=auditSEO&action=main_view&%{QUERY_STRING} [L]
RewriteRule ^audyt-seo/wynik(|/)$ index.php?module=auditSEO&action=main_view&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_URI} ^/auditSEO/(.*) [NC]
RewriteRule ^([^/]*)/([^/]*)/(.*)$ index.php?module=$1&action=$2&$3 [L]