commit 5acce9fb6c107d8cd34053bece2b9f044834f2d0
Author: Jacek Pyziak
Date: Wed Oct 30 22:46:16 2024 +0100
first commit
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..d0012bd
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,286 @@
+RewriteEngine On
+RewriteBase /
+Options +FollowSymlinks
+Options -Indexes
+
+RewriteCond %{HTTP_HOST} !^www\.
+RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]
+RewriteCond %{SERVER_PORT} !=443
+RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]
+## Remove trailing slash
+RewriteCond %{REQUEST_FILENAME} !-d [NC]
+RewriteCond %{REQUEST_URI} !^/admin/(.*) [NC]
+RewriteRule ^(.*)/$ https://%{HTTP_HOST}/$1 [L,R=301]
+
+ErrorDocument 404 /404.html
+
+RewriteCond %{REQUEST_URI} !^(.*)/libraries/(.*) [NC]
+RewriteCond %{REQUEST_URI} !^(.*)/css/(.*) [NC]
+RewriteRule ^admin/([^/]*)/([^/]*)/(.*)$ admin/index.php?module=$1&action=$2&$3 [L]
+
+
+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 ^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]
+
+RewriteCond %{REQUEST_URI} ^/auditSEO/(.*) [NC]
+RewriteRule ^([^/]*)/([^/]*)/(.*)$ index.php?module=$1&action=$2&$3 [L]
+
+RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php
+RewriteRule ^ /%1 [R=301,L]
+
+AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
+
+
+ExpiresActive on
+ExpiresDefault "access plus 1 year"
+ExpiresByType text/css "access plus 1 year"
+ExpiresByType application/json "access plus 0 seconds"
+ExpiresByType application/xml "access plus 0 seconds"
+ExpiresByType text/xml "access plus 0 seconds"
+ExpiresByType image/x-icon "access plus 1 week"
+ExpiresByType text/x-component "access plus 1 year"
+ExpiresByType text/html "access plus 0 seconds"
+ExpiresByType application/javascript "access plus 1 year"
+ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
+ExpiresByType text/cache-manifest "access plus 0 seconds"
+ExpiresByType audio/ogg "access plus 1 year"
+ExpiresByType image/gif "access plus 1 year"
+ExpiresByType image/jpeg "access plus 1 year"
+ExpiresByType image/webp "access plus 1 year"
+ExpiresByType image/png "access plus 1 year"
+ExpiresByType video/mp4 "access plus 1 year"
+ExpiresByType video/ogg "access plus 1 year"
+ExpiresByType video/webm "access plus 1 year"
+ExpiresByType application/atom+xml "access plus 1 hour"
+ExpiresByType application/rss+xml "access plus 1 hour"
+ExpiresByType application/font-woff "access plus 1 year"
+ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
+ExpiresByType application/x-font-ttf "access plus 1 year"
+ExpiresByType font/opentype "access plus 1 year"
+ExpiresByType image/svg+xml "access plus 1 year"
+
+
+ Order Deny,Allow
+ Deny from all
+
+
+ Order Deny,Allow
+ Deny from all
+
+
+ Order Deny,Allow
+ Deny from all
+
+RewriteRule ^pl/$ index.php?a=change_language&id=pl [L]
+
+RewriteRule ^$ index.php?a=page&id=10&lang=pl&%{QUERY_STRING} [L]
+
+RewriteCond %{REQUEST_URI} ^/home$
+RewriteRule ^(.*)$ https://www.project-pro.pl/ [R=301,L]
+RewriteCond %{REQUEST_URI} ^/home/s/1$
+RewriteRule ^(.*)$ https://www.project-pro.pl/ [R=301,L]
+RewriteCond %{REQUEST_URI} "^/$"
+RewriteRule ^$ index.php?a=page&id=10&lang=pl [L]
+
+RewriteRule ^home(|/)$ index.php?a=page&id=10&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^home/s/1(|/)$ home [R=301,L]
+RewriteRule ^home/s/([0-9]+)(|/)$ index.php?a=page&id=10&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^strony-www(|/)$ index.php?a=page&id=3&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^strony-www/s/1(|/)$ strony-www [R=301,L]
+RewriteRule ^strony-www/s/([0-9]+)(|/)$ index.php?a=page&id=3&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^marketing-internetowy(|/)$ index.php?a=page&id=4&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^marketing-internetowy/s/1(|/)$ marketing-internetowy [R=301,L]
+RewriteRule ^marketing-internetowy/s/([0-9]+)(|/)$ index.php?a=page&id=4&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^tworzenie-stron-www(|/)$ index.php?a=page&id=22&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^tworzenie-stron-www/s/1(|/)$ tworzenie-stron-www [R=301,L]
+RewriteRule ^tworzenie-stron-www/s/([0-9]+)(|/)$ index.php?a=page&id=22&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^oferta-dedykowana(|/)$ index.php?a=page&id=5&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^oferta-dedykowana/s/1(|/)$ oferta-dedykowana [R=301,L]
+RewriteRule ^oferta-dedykowana/s/([0-9]+)(|/)$ index.php?a=page&id=5&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^projektowanie-sklepow-internetowych(|/)$ index.php?a=page&id=23&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^projektowanie-sklepow-internetowych/s/1(|/)$ projektowanie-sklepow-internetowych [R=301,L]
+RewriteRule ^projektowanie-sklepow-internetowych/s/([0-9]+)(|/)$ index.php?a=page&id=23&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje(|/)$ index.php?a=page&id=6&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^realizacje/s/1(|/)$ realizacje [R=301,L]
+RewriteRule ^realizacje/s/([0-9]+)(|/)$ index.php?a=page&id=6&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^systemy-zarzadzania-trescia-cms(|/)$ index.php?a=page&id=24&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^systemy-zarzadzania-trescia-cms/s/1(|/)$ systemy-zarzadzania-trescia-cms [R=301,L]
+RewriteRule ^systemy-zarzadzania-trescia-cms/s/([0-9]+)(|/)$ index.php?a=page&id=24&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^blog(|/)$ index.php?a=page&id=7&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^blog/s/1(|/)$ blog [R=301,L]
+RewriteRule ^blog/s/([0-9]+)(|/)$ index.php?a=page&id=7&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^obsluga-istniejacych-stron(|/)$ index.php?a=page&id=25&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^obsluga-istniejacych-stron/s/1(|/)$ obsluga-istniejacych-stron [R=301,L]
+RewriteRule ^obsluga-istniejacych-stron/s/([0-9]+)(|/)$ index.php?a=page&id=25&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^o-nas(|/)$ index.php?a=page&id=2&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^o-nas/s/1(|/)$ o-nas [R=301,L]
+RewriteRule ^o-nas/s/([0-9]+)(|/)$ index.php?a=page&id=2&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-stron-internetowych(|/)$ index.php?a=page&id=26&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-stron-internetowych/s/1(|/)$ pozycjonowanie-stron-internetowych [R=301,L]
+RewriteRule ^pozycjonowanie-stron-internetowych/s/([0-9]+)(|/)$ index.php?a=page&id=26&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-lokalne(|/)$ index.php?a=page&id=27&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-lokalne/s/1(|/)$ pozycjonowanie-lokalne [R=301,L]
+RewriteRule ^pozycjonowanie-lokalne/s/([0-9]+)(|/)$ index.php?a=page&id=27&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^kontakt(|/)$ index.php?a=page&id=8&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^kontakt/s/1(|/)$ kontakt [R=301,L]
+RewriteRule ^kontakt/s/([0-9]+)(|/)$ index.php?a=page&id=8&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-long-tail(|/)$ index.php?a=page&id=28&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-long-tail/s/1(|/)$ pozycjonowanie-long-tail [R=301,L]
+RewriteRule ^pozycjonowanie-long-tail/s/([0-9]+)(|/)$ index.php?a=page&id=28&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-sklepow-internetowych(|/)$ index.php?a=page&id=29&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-sklepow-internetowych/s/1(|/)$ pozycjonowanie-sklepow-internetowych [R=301,L]
+RewriteRule ^pozycjonowanie-sklepow-internetowych/s/([0-9]+)(|/)$ index.php?a=page&id=29&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^social-media(|/)$ index.php?a=page&id=30&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^social-media/s/1(|/)$ social-media [R=301,L]
+RewriteRule ^social-media/s/([0-9]+)(|/)$ index.php?a=page&id=30&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^oprogramowanie-dla-firm(|/)$ index.php?a=page&id=31&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^oprogramowanie-dla-firm/s/1(|/)$ oprogramowanie-dla-firm [R=301,L]
+RewriteRule ^oprogramowanie-dla-firm/s/([0-9]+)(|/)$ index.php?a=page&id=31&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^identyfikacja-wizualna(|/)$ index.php?a=page&id=32&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^identyfikacja-wizualna/s/1(|/)$ identyfikacja-wizualna [R=301,L]
+RewriteRule ^identyfikacja-wizualna/s/([0-9]+)(|/)$ index.php?a=page&id=32&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-debica(|/)$ index.php?a=page&id=33&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-debica/s/1(|/)$ pozycjonowanie-debica [R=301,L]
+RewriteRule ^pozycjonowanie-debica/s/([0-9]+)(|/)$ index.php?a=page&id=33&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-krakow(|/)$ index.php?a=page&id=34&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-krakow/s/1(|/)$ pozycjonowanie-krakow [R=301,L]
+RewriteRule ^pozycjonowanie-krakow/s/([0-9]+)(|/)$ index.php?a=page&id=34&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-jaslo(|/)$ index.php?a=page&id=47&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-jaslo/s/1(|/)$ pozycjonowanie-jaslo [R=301,L]
+RewriteRule ^pozycjonowanie-jaslo/s/([0-9]+)(|/)$ index.php?a=page&id=47&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-kielce(|/)$ index.php?a=page&id=35&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-kielce/s/1(|/)$ pozycjonowanie-kielce [R=301,L]
+RewriteRule ^pozycjonowanie-kielce/s/([0-9]+)(|/)$ index.php?a=page&id=35&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-krosno(|/)$ index.php?a=page&id=36&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-krosno/s/1(|/)$ pozycjonowanie-krosno [R=301,L]
+RewriteRule ^pozycjonowanie-krosno/s/([0-9]+)(|/)$ index.php?a=page&id=36&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-mielec(|/)$ index.php?a=page&id=37&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-mielec/s/1(|/)$ pozycjonowanie-mielec [R=301,L]
+RewriteRule ^pozycjonowanie-mielec/s/([0-9]+)(|/)$ index.php?a=page&id=37&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-nowy-sacz(|/)$ index.php?a=page&id=38&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-nowy-sacz/s/1(|/)$ pozycjonowanie-nowy-sacz [R=301,L]
+RewriteRule ^pozycjonowanie-nowy-sacz/s/([0-9]+)(|/)$ index.php?a=page&id=38&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-przemysl(|/)$ index.php?a=page&id=39&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-przemysl/s/1(|/)$ pozycjonowanie-przemysl [R=301,L]
+RewriteRule ^pozycjonowanie-przemysl/s/([0-9]+)(|/)$ index.php?a=page&id=39&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-rzeszow(|/)$ index.php?a=page&id=40&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-rzeszow/s/1(|/)$ pozycjonowanie-rzeszow [R=301,L]
+RewriteRule ^pozycjonowanie-rzeszow/s/([0-9]+)(|/)$ index.php?a=page&id=40&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-stalowa-wola(|/)$ index.php?a=page&id=41&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-stalowa-wola/s/1(|/)$ pozycjonowanie-stalowa-wola [R=301,L]
+RewriteRule ^pozycjonowanie-stalowa-wola/s/([0-9]+)(|/)$ index.php?a=page&id=41&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^pozycjonowanie-tarnow(|/)$ index.php?a=page&id=42&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^pozycjonowanie-tarnow/s/1(|/)$ pozycjonowanie-tarnow [R=301,L]
+RewriteRule ^pozycjonowanie-tarnow/s/([0-9]+)(|/)$ index.php?a=page&id=42&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^kampanie-google-ads-rzeszow(|/)$ index.php?a=page&id=44&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^kampanie-google-ads-rzeszow/s/1(|/)$ kampanie-google-ads-rzeszow [R=301,L]
+RewriteRule ^kampanie-google-ads-rzeszow/s/([0-9]+)(|/)$ index.php?a=page&id=44&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^polityka-prywatnosci(|/)$ index.php?a=page&id=45&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^polityka-prywatnosci/s/1(|/)$ polityka-prywatnosci [R=301,L]
+RewriteRule ^polityka-prywatnosci/s/([0-9]+)(|/)$ index.php?a=page&id=45&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^test-page(|/)$ index.php?a=page&id=46&lang=pl&%{QUERY_STRING} [L]
+RewriteRule ^test-page/s/1(|/)$ test-page [R=301,L]
+RewriteRule ^test-page/s/([0-9]+)(|/)$ index.php?a=page&id=46&lang=pl&bs=$1&%{QUERY_STRING} [L]
+
+RewriteRule ^cechy-dobrej-strony-internetowej(|/)$ index.php?article=10&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^czym-jest-certyfikat-ssl-i-dlaczego-warto-go-miec(|/)$ index.php?article=12&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^zakladka-zakupy-w-wyszukiwarce-google(|/)$ index.php?article=8&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^speed-update-pagespeed-czynnikiem-rankingowym-w-mobilnej-wyszukiwarce-google(|/)$ index.php?article=4&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^zalety-posiadania-strony-firmowej-na-facebooku(|/)$ index.php?article=11&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^responsywnosc-strony-internetowej-czym-jest-i-dlaczego-jest-tak-wazna-przy-prowadzeniu-biznesu(|/)$ index.php?article=13&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^co-to-jest-pozycjonowanie-lokalne(|/)$ index.php?article=57&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^jak-sprawdzic-do-kogo-nalezy-domena-poradnik(|/)$ index.php?article=80&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^najnowsze-trendy-w-email-marketingu-na-co-zwrocic-uwage-w-2023-roku(|/)$ index.php?article=81&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^prowadzenie-bloga-firmowego-jako-element-strategii-marketingowej(|/)$ index.php?article=83&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^seo-vs-sem-na-czym-polega-roznica-i-ktore-z-nich-wybrac(|/)$ index.php?article=82&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^dropshipping-na-czym-polega-wady-zalety(|/)$ index.php?article=84&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^grafika-wektorowa-czym-jest-i-gdzie-znajduje-zastosowanie(|/)$ index.php?article=85&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^cross-selling-sposob-na-wieksza-sprzedaz(|/)$ index.php?article=86&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^blad-404-co-oznacza-i-jak-go-naprawic(|/)$ index.php?article=87&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-patekapartaments(|/)$ index.php?article=88&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-gbvidok(|/)$ index.php?article=89&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-kamperypodkarpacie(|/)$ index.php?article=90&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-kingstorage(|/)$ index.php?article=91&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-devidok(|/)$ index.php?article=92&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-pianfol(|/)$ index.php?article=93&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-roximplast(|/)$ index.php?article=94&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-emifloor(|/)$ index.php?article=95&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-csb(|/)$ index.php?article=97&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-redline(|/)$ index.php?article=98&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-ibra-makeup(|/)$ index.php?article=99&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-pomysloweprezenty(|/)$ index.php?article=100&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-marianek(|/)$ index.php?article=101&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-wyczarujprezent(|/)$ index.php?article=96&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-lulandia(|/)$ index.php?article=102&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^realizacje-wingedit(|/)$ index.php?article=103&lang=pl&%{QUERY_STRING} [L]
+
+RewriteRule ^oferty-pracy(|/)$ index.php?module=globelusAdverts&action=adverts_list&cp=1&%{QUERY_STRING} [L]
+RewriteRule ^newsletter/signin$ index.php?module=newsletter&action=signin [L]
+RewriteRule ^newsletter/confirm/hash=(.*)$ index.php?module=newsletter&action=confirm&hash=$1 [L]
+RewriteRule ^newsletter/unsubscribe/hash=(.*)$ index.php?module=newsletter&action=unsubscribe&hash=$1 [L]
diff --git a/.vscode/ftp-kr.json b/.vscode/ftp-kr.json
new file mode 100644
index 0000000..dcd5fdb
--- /dev/null
+++ b/.vscode/ftp-kr.json
@@ -0,0 +1,17 @@
+{
+ "host": "193.177.164.18",
+ "username": "www@project-pro.pl",
+ "password": "JUqGcS5P2s4KvUJQqFhC",
+ "remotePath": "/public_html/",
+ "protocol": "ftp",
+ "port": 0,
+ "fileNameEncoding": "utf8",
+ "autoUpload": true,
+ "autoDelete": false,
+ "autoDownload": false,
+ "ignoreRemoteModification": true,
+ "ignore": [
+ ".git",
+ "/.vscode"
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json
new file mode 100644
index 0000000..653ffda
--- /dev/null
+++ b/.vscode/ftp-kr.sync.cache.json
@@ -0,0 +1,1320 @@
+{
+ "ftp://host700513.hostido.net.pl@www@project-pro.pl": {
+ "public_html": {
+ "404.html": {
+ "type": "-",
+ "size": 1016,
+ "lmtime": 0,
+ "modified": false
+ },
+ "admin": {},
+ "ajax.php": {
+ "type": "-",
+ "size": 5909,
+ "lmtime": 0,
+ "modified": true
+ },
+ "autoload": {
+ "admin": {
+ "class.Site.php": {
+ "type": "-",
+ "size": 2052,
+ "lmtime": 1687338158787,
+ "modified": false
+ },
+ "controls": {
+ "class.ArticlesArchive.php": {
+ "type": "-",
+ "size": 1208,
+ "lmtime": 1687338158892,
+ "modified": false
+ },
+ "class.Articles.php": {
+ "type": "-",
+ "size": 5246,
+ "lmtime": 1687338158991,
+ "modified": false
+ },
+ "class.Authors.php": {
+ "type": "-",
+ "size": 2084,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Backups.php": {
+ "type": "-",
+ "size": 1973,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Banners.php": {
+ "type": "-",
+ "size": 2102,
+ "lmtime": 1687338159094,
+ "modified": false
+ },
+ "class.Emails.php": {
+ "type": "-",
+ "size": 693,
+ "lmtime": 1687338159199,
+ "modified": false
+ },
+ "class.Filemanager.php": {
+ "type": "-",
+ "size": 313,
+ "lmtime": 1687338159304,
+ "modified": false
+ },
+ "class.Languages.php": {
+ "type": "-",
+ "size": 4056,
+ "lmtime": 1687338159417,
+ "modified": false
+ },
+ "class.Layouts.php": {
+ "type": "-",
+ "size": 1954,
+ "lmtime": 1687338159516,
+ "modified": false
+ },
+ "class.Newsletter.php": {
+ "type": "-",
+ "size": 5290,
+ "lmtime": 1687338159621,
+ "modified": false
+ },
+ "class.Pages.php": {
+ "type": "-",
+ "size": 5700,
+ "lmtime": 1687338159724,
+ "modified": false
+ },
+ "class.Scontainers.php": {
+ "type": "-",
+ "size": 2516,
+ "lmtime": 1687338159826,
+ "modified": false
+ },
+ "class.SeoAdditional.php": {
+ "type": "-",
+ "size": 1860,
+ "lmtime": 1687338159928,
+ "modified": false
+ },
+ "class.Settings.php": {
+ "type": "-",
+ "size": 2784,
+ "lmtime": 1687338160032,
+ "modified": false
+ },
+ "class.Update.php": {
+ "type": "-",
+ "size": 719,
+ "lmtime": 1687338160135,
+ "modified": false
+ },
+ "class.Users.php": {
+ "type": "-",
+ "size": 1713,
+ "lmtime": 1687338160240,
+ "modified": false
+ }
+ },
+ "factory": {
+ "class.ArticlesArchive.php": {
+ "type": "-",
+ "size": 993,
+ "lmtime": 1687338160344,
+ "modified": false
+ },
+ "class.Articles.php": {
+ "type": "-",
+ "size": 28674,
+ "lmtime": 1687338160451,
+ "modified": false
+ },
+ "class.Authors.php": {
+ "type": "-",
+ "size": 3118,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Backups.php": {
+ "type": "-",
+ "size": 2180,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Banners.php": {
+ "type": "-",
+ "size": 3921,
+ "lmtime": 1687338160552,
+ "modified": false
+ },
+ "class.Emails.php": {
+ "type": "-",
+ "size": 222,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Languages.php": {
+ "type": "-",
+ "size": 6161,
+ "lmtime": 1687338160657,
+ "modified": false
+ },
+ "class.Layouts.php": {
+ "type": "-",
+ "size": 3789,
+ "lmtime": 1687338160765,
+ "modified": false
+ },
+ "class.Newsletter.php": {
+ "type": "-",
+ "size": 3005,
+ "lmtime": 1687338160870,
+ "modified": false
+ },
+ "class.Pages.php": {
+ "type": "-",
+ "size": 16450,
+ "lmtime": 1687338160972,
+ "modified": false
+ },
+ "class.Scontainers.php": {
+ "type": "-",
+ "size": 3642,
+ "lmtime": 1687338161073,
+ "modified": false
+ },
+ "class.SeoAdditional.php": {
+ "type": "-",
+ "size": 1426,
+ "lmtime": 1687338161179,
+ "modified": false
+ },
+ "class.Settings.php": {
+ "type": "-",
+ "size": 4786,
+ "lmtime": 1687338161591,
+ "modified": false
+ },
+ "class.Update.php": {
+ "type": "-",
+ "size": 2818,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Users.php": {
+ "type": "-",
+ "size": 5594,
+ "lmtime": 1687338161719,
+ "modified": false
+ }
+ },
+ "view": {
+ "class.ArticlesArchive.php": {
+ "type": "-",
+ "size": 192,
+ "lmtime": 1687338161843,
+ "modified": false
+ },
+ "class.Articles.php": {
+ "type": "-",
+ "size": 878,
+ "lmtime": 1687338161959,
+ "modified": false
+ },
+ "class.Backups.php": {
+ "type": "-",
+ "size": 213,
+ "lmtime": 1687338162160,
+ "modified": false
+ },
+ "class.Banners.php": {
+ "type": "-",
+ "size": 387,
+ "lmtime": 1687338162262,
+ "modified": false
+ },
+ "class.Emails.php": {
+ "type": "-",
+ "size": 330,
+ "lmtime": 1687338162367,
+ "modified": false
+ },
+ "class.FileManager.php": {
+ "type": "-",
+ "size": 171,
+ "lmtime": 1687338162490,
+ "modified": false
+ },
+ "class.Languages.php": {
+ "type": "-",
+ "size": 784,
+ "lmtime": 1687338162592,
+ "modified": false
+ },
+ "class.Layouts.php": {
+ "type": "-",
+ "size": 666,
+ "lmtime": 1687338162704,
+ "modified": false
+ },
+ "class.Newsletter.php": {
+ "type": "-",
+ "size": 1338,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.PagePanel.php": {
+ "type": "-",
+ "size": 650,
+ "lmtime": 1687338162804,
+ "modified": false
+ },
+ "class.Page.php": {
+ "type": "-",
+ "size": 302,
+ "lmtime": 1687338162925,
+ "modified": false
+ },
+ "class.Pages.php": {
+ "type": "-",
+ "size": 1709,
+ "lmtime": 1687338163036,
+ "modified": false
+ },
+ "class.Scontainers.php": {
+ "type": "-",
+ "size": 415,
+ "lmtime": 1687338163163,
+ "modified": false
+ },
+ "class.SeoAdditional.php": {
+ "type": "-",
+ "size": 354,
+ "lmtime": 1687338163273,
+ "modified": false
+ },
+ "class.Settings.php": {
+ "type": "-",
+ "size": 203,
+ "lmtime": 1687338163377,
+ "modified": false
+ },
+ "class.Update.php": {
+ "type": "-",
+ "size": 247,
+ "lmtime": 1687338163480,
+ "modified": false
+ },
+ "class.Users.php": {
+ "type": "-",
+ "size": 485,
+ "lmtime": 1687338163640,
+ "modified": false
+ }
+ }
+ },
+ "class.Article.php": {
+ "type": "-",
+ "size": 8827,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Cache.php": {
+ "type": "-",
+ "size": 961,
+ "lmtime": 1687338158014,
+ "modified": false
+ },
+ "class.geoplugin.php": {
+ "type": "-",
+ "size": 4493,
+ "lmtime": 1687338158136,
+ "modified": false
+ },
+ "class.Html.php": {
+ "type": "-",
+ "size": 2008,
+ "lmtime": 1687338158242,
+ "modified": false
+ },
+ "class.Image.php": {
+ "type": "-",
+ "size": 8758,
+ "lmtime": 1687338158353,
+ "modified": false
+ },
+ "class.Mobile_Detect.php": {
+ "type": "-",
+ "size": 78914,
+ "lmtime": 1687338158500,
+ "modified": false
+ },
+ "class.Page.php": {
+ "type": "-",
+ "size": 117,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Scontainer.php": {
+ "type": "-",
+ "size": 938,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.S.php": {
+ "type": "-",
+ "size": 50471,
+ "lmtime": 1687338158683,
+ "modified": false
+ },
+ "class.Tpl.php": {
+ "type": "-",
+ "size": 1712,
+ "lmtime": 0,
+ "modified": false
+ },
+ "front": {
+ "controls": {
+ "class.Articles.php": {
+ "type": "-",
+ "size": 2571,
+ "lmtime": 1687338163740,
+ "modified": false
+ },
+ "class.AuditSEO.php": {
+ "type": "-",
+ "size": 1401,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Newsletter.php": {
+ "type": "-",
+ "size": 831,
+ "lmtime": 1687338163850,
+ "modified": false
+ },
+ "class.Site.php": {
+ "type": "-",
+ "size": 3636,
+ "lmtime": 1687338163952,
+ "modified": false
+ }
+ },
+ "factory": {
+ "class.Articles.php": {
+ "type": "-",
+ "size": 18150,
+ "lmtime": 1687338164054,
+ "modified": false
+ },
+ "class.AuditSEO.php": {
+ "type": "-",
+ "size": 29335,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Authors.php": {
+ "type": "-",
+ "size": 632,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Banners.php": {
+ "type": "-",
+ "size": 2471,
+ "lmtime": 1687338164160,
+ "modified": false
+ },
+ "class.Languages.php": {
+ "type": "-",
+ "size": 1975,
+ "lmtime": 1687338164261,
+ "modified": false
+ },
+ "class.Layouts.php": {
+ "type": "-",
+ "size": 1487,
+ "lmtime": 1687338164363,
+ "modified": false
+ },
+ "class.Menu.php": {
+ "type": "-",
+ "size": 1861,
+ "lmtime": 1687338164468,
+ "modified": false
+ },
+ "class.Newsletter.php": {
+ "type": "-",
+ "size": 4317,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Pages.php": {
+ "type": "-",
+ "size": 2355,
+ "lmtime": 1687338164726,
+ "modified": true
+ },
+ "class.Scontainers.php": {
+ "type": "-",
+ "size": 720,
+ "lmtime": 1687338164794,
+ "modified": false
+ },
+ "class.Search.php": {
+ "type": "-",
+ "size": 4074,
+ "lmtime": 1687338164904,
+ "modified": false
+ },
+ "class.SeoAdditional.php": {
+ "type": "-",
+ "size": 192,
+ "lmtime": 1687338165018,
+ "modified": false
+ },
+ "class.Settings.php": {
+ "type": "-",
+ "size": 598,
+ "lmtime": 1687338165121,
+ "modified": false
+ }
+ },
+ "view": {
+ "class.Articles.php": {
+ "type": "-",
+ "size": 4215,
+ "lmtime": 1687338165226,
+ "modified": false
+ },
+ "class.Banners.php": {
+ "type": "-",
+ "size": 1192,
+ "lmtime": 1687338165348,
+ "modified": false
+ },
+ "class.Languages.php": {
+ "type": "-",
+ "size": 325,
+ "lmtime": 0,
+ "modified": false
+ },
+ "class.Menu.php": {
+ "type": "-",
+ "size": 1041,
+ "lmtime": 1687338165573,
+ "modified": false
+ },
+ "class.Newsletter.php": {
+ "type": "-",
+ "size": 173,
+ "lmtime": 1687338166212,
+ "modified": false
+ },
+ "class.Scontainers.php": {
+ "type": "-",
+ "size": 258,
+ "lmtime": 1687338166339,
+ "modified": false
+ },
+ "class.Search.php": {
+ "type": "-",
+ "size": 338,
+ "lmtime": 1687338166447,
+ "modified": false
+ },
+ "class.Site.php": {
+ "type": "-",
+ "size": 16975,
+ "lmtime": 1687338166555,
+ "modified": false
+ }
+ }
+ }
+ },
+ "cache": {},
+ "config.php": {
+ "type": "-",
+ "size": 180,
+ "lmtime": 0,
+ "modified": false
+ },
+ "cron.php": {
+ "type": "-",
+ "size": 1337,
+ "lmtime": 0,
+ "modified": false
+ },
+ "devel.html": {
+ "type": "-",
+ "size": 2825,
+ "lmtime": 0,
+ "modified": false
+ },
+ "download.php": {
+ "type": "-",
+ "size": 1568,
+ "lmtime": 0,
+ "modified": false
+ },
+ ".htaccess": {
+ "type": "-",
+ "size": 16080,
+ "lmtime": 1708518657346,
+ "modified": false
+ },
+ "images": {},
+ "index.php": {
+ "type": "-",
+ "size": 6846,
+ "lmtime": 0,
+ "modified": false
+ },
+ "layout": {
+ "style-scss": {
+ "_container.scss": {
+ "type": "-",
+ "size": 1527,
+ "lmtime": 0,
+ "modified": false
+ },
+ "_mixins.scss": {
+ "type": "-",
+ "size": 3539,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-kontakt": {
+ "type": "-",
+ "size": 0,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-kontakt.scss": {
+ "type": "-",
+ "size": 3785,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-debica": {
+ "type": "-",
+ "size": 0,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-debica.scss": {
+ "type": "-",
+ "size": 1321,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-jaslo.scss": {
+ "type": "-",
+ "size": 893,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-kielce.scss": {
+ "type": "-",
+ "size": 2004,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-krakow.scss": {
+ "type": "-",
+ "size": 1439,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-krosno.scss": {
+ "type": "-",
+ "size": 1004,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-mielec.scss": {
+ "type": "-",
+ "size": 888,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-nowy-sacz.scss": {
+ "type": "-",
+ "size": 1087,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-przemysl.scss": {
+ "type": "-",
+ "size": 1235,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-rzeszow.scss": {
+ "type": "-",
+ "size": 1310,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-stalow-wola.scss": {
+ "type": "-",
+ "size": 1096,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-tarnow.scss": {
+ "type": "-",
+ "size": 1078,
+ "lmtime": 0,
+ "modified": false
+ },
+ "_reset.css": {
+ "type": "-",
+ "size": 915,
+ "lmtime": 0,
+ "modified": false
+ },
+ "_reset.scss": {
+ "type": "-",
+ "size": 1017,
+ "lmtime": 0,
+ "modified": false
+ },
+ "style.scss": {
+ "type": "-",
+ "size": 116047,
+ "lmtime": 1687339216623,
+ "modified": false
+ },
+ "test.scss": {
+ "type": "-",
+ "size": 1063,
+ "lmtime": 0,
+ "modified": false
+ },
+ "_variables.css": {
+ "type": "-",
+ "size": 1179,
+ "lmtime": 0,
+ "modified": false
+ },
+ "_variables.scss": {
+ "type": "-",
+ "size": 1297,
+ "lmtime": 0,
+ "modified": false
+ }
+ },
+ "style-css": {
+ "page-kontakt.css": {
+ "type": "-",
+ "size": 3915,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-kontakt.css.map": {
+ "type": "-",
+ "size": 1632,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-debica.css": {
+ "type": "-",
+ "size": 1897,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-debica.css.map": {
+ "type": "-",
+ "size": 749,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-jaslo.css": {
+ "type": "-",
+ "size": 1784,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-jaslo.css.map": {
+ "type": "-",
+ "size": 689,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-kielce.css": {
+ "type": "-",
+ "size": 2487,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-kielce.css.map": {
+ "type": "-",
+ "size": 891,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-krakow.css": {
+ "type": "-",
+ "size": 2049,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-krakow.css.map": {
+ "type": "-",
+ "size": 784,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-krosno.css": {
+ "type": "-",
+ "size": 1681,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-krosno.css.map": {
+ "type": "-",
+ "size": 660,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-mielec.css": {
+ "type": "-",
+ "size": 1590,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-mielec.css.map": {
+ "type": "-",
+ "size": 615,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-nowy-sacz.css": {
+ "type": "-",
+ "size": 1766,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-nowy-sacz.css.map": {
+ "type": "-",
+ "size": 677,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-przemysl.css": {
+ "type": "-",
+ "size": 1914,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-przemysl.css.map": {
+ "type": "-",
+ "size": 706,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-rzeszow.css": {
+ "type": "-",
+ "size": 1916,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-rzeszow.css.map": {
+ "type": "-",
+ "size": 729,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-stalowa-wola.css": {
+ "type": "-",
+ "size": 1775,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-stalowa-wola.css.map": {
+ "type": "-",
+ "size": 677,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-tarnow.css": {
+ "type": "-",
+ "size": 1757,
+ "lmtime": 0,
+ "modified": false
+ },
+ "page-pozycjonowanie-tarnow.css.map": {
+ "type": "-",
+ "size": 677,
+ "lmtime": 0,
+ "modified": false
+ },
+ "style.css": {
+ "type": "-",
+ "size": 100957,
+ "lmtime": 1687339217611,
+ "modified": false
+ },
+ "style.css.map": {
+ "type": "-",
+ "size": 36476,
+ "lmtime": 1687339217612,
+ "modified": false
+ },
+ "test.css": {
+ "type": "-",
+ "size": 923,
+ "lmtime": 0,
+ "modified": false
+ },
+ "test.css.map": {
+ "type": "-",
+ "size": 467,
+ "lmtime": 0,
+ "modified": false
+ }
+ },
+ "js": {
+ "test.js": {
+ "type": "-",
+ "size": 7454,
+ "lmtime": 1688071765423,
+ "modified": false
+ }
+ }
+ },
+ "libraries": {},
+ "plugins": {},
+ "README.md": {
+ "type": "-",
+ "size": 54,
+ "lmtime": 0,
+ "modified": false
+ },
+ "restore.php": {
+ "type": "-",
+ "size": 8919,
+ "lmtime": 0,
+ "modified": true
+ },
+ "robots.txt": {
+ "type": "-",
+ "size": 92,
+ "lmtime": 0,
+ "modified": false
+ },
+ "sitemap.xml": {
+ "type": "-",
+ "size": 10632,
+ "lmtime": 0,
+ "modified": true
+ },
+ "temp": {},
+ "templates": {
+ "articles": {
+ "article-entry.php": {
+ "type": "-",
+ "size": 2095,
+ "lmtime": 1687337713498,
+ "modified": false
+ },
+ "article-files.php": {
+ "type": "-",
+ "size": 556,
+ "lmtime": 1687337713621,
+ "modified": false
+ },
+ "article-full.php": {
+ "type": "-",
+ "size": 11001,
+ "lmtime": 1687337713722,
+ "modified": false
+ },
+ "article-gallery.php": {
+ "type": "-",
+ "size": 12294,
+ "lmtime": 1687337713830,
+ "modified": false
+ },
+ "article-miniature.php": {
+ "type": "-",
+ "size": 1599,
+ "lmtime": 1687337713939,
+ "modified": false
+ },
+ "article.php": {
+ "type": "-",
+ "size": 10137,
+ "lmtime": 0,
+ "modified": false
+ },
+ "articles-entries.php": {
+ "type": "-",
+ "size": 446,
+ "lmtime": 0,
+ "modified": false
+ },
+ "articles-list.php": {
+ "type": "-",
+ "size": 956,
+ "lmtime": 1687337714040,
+ "modified": false
+ },
+ "articles-miniatures.php": {
+ "type": "-",
+ "size": 192,
+ "lmtime": 1687337714151,
+ "modified": false
+ },
+ "map.php": {
+ "type": "-",
+ "size": 1297,
+ "lmtime": 1687337714262,
+ "modified": false
+ },
+ "news-list.php": {
+ "type": "-",
+ "size": 707,
+ "lmtime": 0,
+ "modified": false
+ },
+ "news.php": {
+ "type": "-",
+ "size": 4059,
+ "lmtime": 1687337714373,
+ "modified": false
+ },
+ "password-view.php": {
+ "type": "-",
+ "size": 1365,
+ "lmtime": 1687337714481,
+ "modified": false
+ },
+ "slider.php": {
+ "type": "-",
+ "size": 1636,
+ "lmtime": 1687337714581,
+ "modified": false
+ },
+ "tags-cloud.php": {
+ "type": "-",
+ "size": 1355,
+ "lmtime": 0,
+ "modified": false
+ }
+ },
+ "audit-seo": {
+ "main-view.php": {
+ "type": "-",
+ "size": 8374,
+ "lmtime": 1687337714697,
+ "modified": false
+ }
+ },
+ "banner": {
+ "banners.php": {
+ "type": "-",
+ "size": 634,
+ "lmtime": 0,
+ "modified": false
+ },
+ "main-banner.php": {
+ "type": "-",
+ "size": 900,
+ "lmtime": 1687337714823,
+ "modified": false
+ }
+ },
+ "inline-edit.php": {
+ "type": "-",
+ "size": 5607,
+ "lmtime": 1687337713394,
+ "modified": false
+ },
+ "menu": {
+ "main-menu.php": {
+ "type": "-",
+ "size": 1365,
+ "lmtime": 1687337714995,
+ "modified": false
+ },
+ "menu.php": {
+ "type": "-",
+ "size": 143,
+ "lmtime": 1687337715103,
+ "modified": false
+ },
+ "pages.php": {
+ "type": "-",
+ "size": 2346,
+ "lmtime": 1687337715226,
+ "modified": false
+ },
+ "submenu.php": {
+ "type": "-",
+ "size": 1790,
+ "lmtime": 1687337715339,
+ "modified": false
+ }
+ },
+ "newsletter": {
+ "newsletter.php": {
+ "type": "-",
+ "size": 5314,
+ "lmtime": 0,
+ "modified": false
+ },
+ "preview.php": {
+ "type": "-",
+ "size": 1894,
+ "lmtime": 1687337715470,
+ "modified": false
+ }
+ },
+ "pages": {
+ "page-edit.php": {
+ "type": "-",
+ "size": 18169,
+ "lmtime": 1687337715578,
+ "modified": false
+ }
+ },
+ "scontainers": {
+ "scontainer.php": {
+ "type": "-",
+ "size": 787,
+ "lmtime": 0,
+ "modified": false
+ }
+ },
+ "search": {
+ "search-form.php": {
+ "type": "-",
+ "size": 882,
+ "lmtime": 0,
+ "modified": false
+ },
+ "search-results.php": {
+ "type": "-",
+ "size": 971,
+ "lmtime": 1687337715678,
+ "modified": false
+ }
+ },
+ "site": {
+ "alert.php": {
+ "type": "-",
+ "size": 198,
+ "lmtime": 0,
+ "modified": false
+ },
+ "calendar.php": {
+ "type": "-",
+ "size": 6051,
+ "lmtime": 1687337715817,
+ "modified": false
+ },
+ "contact.php": {
+ "type": "-",
+ "size": 9419,
+ "lmtime": 1687337716211,
+ "modified": false
+ },
+ "contrast.php": {
+ "type": "-",
+ "size": 464,
+ "lmtime": 1687337716323,
+ "modified": false
+ },
+ "cookie-information.php": {
+ "type": "-",
+ "size": 1175,
+ "lmtime": 0,
+ "modified": false
+ },
+ "copyright.php": {
+ "type": "-",
+ "size": 213,
+ "lmtime": 1687337716429,
+ "modified": false
+ },
+ "facebook.php": {
+ "type": "-",
+ "size": 1571,
+ "lmtime": 1687337716554,
+ "modified": false
+ },
+ "languages.php": {
+ "type": "-",
+ "size": 757,
+ "lmtime": 0,
+ "modified": false
+ },
+ "pager.php": {
+ "type": "-",
+ "size": 1309,
+ "lmtime": 1687337716657,
+ "modified": false
+ },
+ "title.php": {
+ "type": "-",
+ "size": 53,
+ "lmtime": 1687337716757,
+ "modified": false
+ },
+ "visit-counter.php": {
+ "type": "-",
+ "size": 102,
+ "lmtime": 1687337716860,
+ "modified": false
+ }
+ },
+ "widgets": {
+ "widget-phone.css": {
+ "type": "-",
+ "size": 3917,
+ "lmtime": 1687337716961,
+ "modified": false
+ },
+ "widget-phone.php": {
+ "type": "-",
+ "size": 4140,
+ "lmtime": 1687337717075,
+ "modified": false
+ }
+ }
+ },
+ "templates_user": {
+ "articles": {
+ "article-entry.php": {
+ "type": "-",
+ "size": 5081,
+ "lmtime": 0,
+ "modified": false
+ },
+ "article.php": {
+ "type": "-",
+ "size": 10529,
+ "lmtime": 1687338986357,
+ "modified": false
+ },
+ "news-list.php": {
+ "type": "-",
+ "size": 713,
+ "lmtime": 0,
+ "modified": false
+ },
+ "news.php": {
+ "type": "-",
+ "size": 2600,
+ "lmtime": 0,
+ "modified": false
+ }
+ },
+ "components": {
+ "CookieBot": {
+ "cookie_part_first.php": {
+ "type": "-",
+ "size": 301,
+ "lmtime": 0,
+ "modified": false
+ },
+ "cookie_part_second.php": {
+ "type": "-",
+ "size": 0,
+ "lmtime": 0,
+ "modified": false
+ }
+ },
+ "CoZyskasz.php": {
+ "type": "-",
+ "size": 182,
+ "lmtime": 0,
+ "modified": false
+ },
+ "Footer.php": {
+ "type": "-",
+ "size": 3802,
+ "lmtime": 1687337703933,
+ "modified": false
+ },
+ "Frame.php": {
+ "type": "-",
+ "size": 2230,
+ "lmtime": 0,
+ "modified": false
+ },
+ "header-animation.php": {
+ "type": "-",
+ "size": 9324,
+ "lmtime": 0,
+ "modified": false
+ },
+ "KontaktForm.php": {
+ "type": "-",
+ "size": 7356,
+ "lmtime": 1687337704043,
+ "modified": false
+ },
+ "NajnowszeRealizacje.php": {
+ "type": "-",
+ "size": 2997,
+ "lmtime": 0,
+ "modified": false
+ },
+ "NavPanel.php": {
+ "type": "-",
+ "size": 4731,
+ "lmtime": 0,
+ "modified": false
+ },
+ "Newsletter.php": {
+ "type": "-",
+ "size": 5650,
+ "lmtime": 0,
+ "modified": false
+ },
+ "PartneryLista.php": {
+ "type": "-",
+ "size": 0,
+ "lmtime": 0,
+ "modified": false
+ },
+ "ZaufaliNam copy.php": {
+ "type": "-",
+ "size": 5405,
+ "lmtime": 0,
+ "modified": false
+ },
+ "ZaufaliNam.php": {
+ "type": "-",
+ "size": 2376,
+ "lmtime": 0,
+ "modified": false
+ },
+ "ZaufaliNam-wersja z opiniami.php": {
+ "type": "-",
+ "size": 5405,
+ "lmtime": 0,
+ "modified": false
+ }
+ },
+ "site": {
+ "pager.php": {
+ "type": "-",
+ "size": 1652,
+ "lmtime": 0,
+ "modified": false
+ }
+ }
+ },
+ "upload": {}
+ }
+ },
+ "$version": 1
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..baa2f73
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,14 @@
+{
+ "liveSassCompile.settings.formats": [
+ {
+ "format": "compressed",
+ "extensionName": ".css",
+ "savePath": "~/../style-css/",
+ "savePathSegmentKeys": null,
+ "savePathReplaceSegmentsWith": null
+ }
+ ],
+ "liveSassCompile.settings.generateMap": true,
+ "liveSassCompile.settings.autoprefix": "defaults",
+ "liveSassCompile.settings.watchOnLaunch": true,
+}
\ No newline at end of file
diff --git a/.vscode/sftp.json b/.vscode/sftp.json
new file mode 100644
index 0000000..3edb0a8
--- /dev/null
+++ b/.vscode/sftp.json
@@ -0,0 +1,12 @@
+{
+ "name": "193.177.164.18",
+ "host": "193.177.164.18",
+ "protocol": "ftp",
+ "port": 21,
+ "username": "www@project-pro.pl",
+ "password": "JUqGcS5P2s4KvUJQqFhC",
+ "remotePath": "/public_html/",
+ "uploadOnSave": false,
+ "useTempFile": false,
+ "openSsh": false
+}
diff --git a/404.html b/404.html
new file mode 100644
index 0000000..7e78b8d
--- /dev/null
+++ b/404.html
@@ -0,0 +1,50 @@
+
+
+
+
+ Błąd 404
+
+
+
+
+
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..cb30050
Binary files /dev/null and b/README.md differ
diff --git a/admin/ajax.php b/admin/ajax.php
new file mode 100644
index 0000000..ba49ca1
--- /dev/null
+++ b/admin/ajax.php
@@ -0,0 +1,38 @@
+
+error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT );
+function __autoload_my_classes( $classname )
+{
+ $q = explode( '\\' , $classname );
+ $c = array_pop( $q );
+ $f = '../autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
+ if ( $c == 'Savant3' )
+ {
+ require_once( '../autoload/Savant3.php' );
+ return true;
+ }
+ if ( file_exists( $f ) )
+ require_once( $f );
+}
+spl_autoload_register( '__autoload_my_classes' );
+
+require_once '../config.php';
+require_once '../libraries/medoo/medoo.php';
+require_once '../libraries/grid/config.php';
+date_default_timezone_set('Europe/Warsaw');
+
+session_start();
+
+$mdb = new medoo( [
+ 'database_type' => 'mysql',
+ 'database_name' => $database['name'],
+ 'server' => $database['host'],
+ 'username' => $database['user'],
+ 'password' => $database['password'],
+ 'charset' => 'utf8'
+ ] );
+
+require_once 'ajax/pages.php';
+require_once 'ajax/articles.php';
+require_once 'ajax/users.php';
+require_once 'ajax/newsletter.php';
+?>
\ No newline at end of file
diff --git a/admin/ajax/articles.php b/admin/ajax/articles.php
new file mode 100644
index 0000000..998191e
--- /dev/null
+++ b/admin/ajax/articles.php
@@ -0,0 +1,54 @@
+ 'error', 'msg' => 'Podczas usuwania zdjecia wystąpił błąd. Proszę spróbować ponownie.' ];
+
+ if ( \admin\factory\Articles::delete_img( \S::get( 'image_id' ) ) )
+ $response = [ 'status' => 'ok' ];
+
+ echo json_encode( $response );
+ exit;
+}
+
+if ( $a == 'article_file_delete' )
+{
+ $response = [ 'status' => 'error', 'msg' => 'Podczas usuwania załącznika wystąpił błąd. Proszę spróbować ponownie.' ];
+
+ if ( \admin\factory\Articles::delete_file( \S::get( 'file_id' ) ) )
+ $response = [ 'status' => 'ok' ];
+
+ echo json_encode( $response );
+ exit;
+}
+
+if ( $a == 'article_image_alt_change' )
+{
+ $response = [ 'status' => 'error', 'msg' => 'Podczas zmiany atrybutu alt zdjęcia wystąpił błąd. Proszę spróbować ponownie.' ];
+
+ if ( \admin\factory\Articles::image_alt_change( \S::get( 'image_id' ), \S::get( 'image_alt' ) ) )
+ $response = [ 'status' => 'ok' ];
+
+ echo json_encode( $response );
+ exit;
+}
+
+if ( $a == 'article_file_name_change' )
+{
+ $response = [ 'status' => 'error', 'msg' => 'Podczas zmiany nazwy załącznika wystąpił błąd. Proszę spróbować ponownie.' ];
+
+ if ( \admin\factory\Articles::file_name_change( \S::get( 'file_id' ), \S::get( 'file_name' ) ) )
+ $response = [ 'status' => 'ok' ];
+
+ echo json_encode( $response );
+ exit;
+}
+
+if ( $a == 'google_url_preview_article' )
+{
+ if ( \S::get( 'article_id' ) )
+ echo $_SERVER['SERVER_NAME'] . '/a-' . \S::get( 'article_id' ) . '-' . \S::seo( \S::get( 'title' ) );
+ else
+ echo $_SERVER['SERVER_NAME'] . '/a-' . ( \S::max_db_value( 'pp_articles', 'id' ) + 1 ) . '-' . \S::seo( \S::get( 'title' ) );
+}
diff --git a/admin/ajax/newsletter.php b/admin/ajax/newsletter.php
new file mode 100644
index 0000000..c25c097
--- /dev/null
+++ b/admin/ajax/newsletter.php
@@ -0,0 +1,16 @@
+ 'error', 'msg' => 'Podczas zapisywania kolejności wyświetlania artykułów wystąpił błąd. Proszę spróbować ponownie.'];
+
+ if (\admin\factory\Pages::save_articles_order(\S::get('page_id'), \S::get('articles')))
+ $response = ['status' => 'ok'];
+
+ echo json_encode($response);
+ exit;
+}
+
+if ($a == 'save_pages_order') {
+ $response = ['status' => 'error', 'msg' => 'Podczas zapisywania kolejności stron wystąpił błąd. Proszę spróbować ponownie.'];
+
+ if (\admin\factory\Pages::save_pages_order(\S::get('menu_id'), \S::get('pages')))
+ $response = ['status' => 'ok'];
+
+ echo json_encode($response);
+ exit;
+}
+
+if ($a == 'generate_seo_link') {
+ $response = ['status' => 'error', 'msg' => 'Podczas generowania pola "seo link" wystąpił błąd. Proszę spróbować ponownie.'];
+
+ if ($seo_link = \admin\factory\Pages::generate_seo_link(\S::get('title'), \S::get('page_id'), \S::get('article_id'), \S::get('lang'), \S::get('pid')))
+ $response = ['status' => 'ok', 'seo_link' => $seo_link];
+
+ echo json_encode($response);
+ exit;
+}
+
+if ($a == 'cookie_menus') {
+ $array = unserialize($_COOKIE['cookie_menus']);
+
+ if ($array[\S::get('menu_id')] == 0)
+ $array[\S::get('menu_id')] = 1;
+ else
+ $array[\S::get('menu_id')] = 0;
+
+ $array = serialize($array);
+
+ setcookie('cookie_menus', $array, time() + 3600 * 24 * 365);
+}
+
+if ($a == 'cookie_pages') {
+ $array = unserialize($_COOKIE['cookie_pages']);
+
+ if ($array[\S::get('page_id')] == 0)
+ $array[\S::get('page_id')] = 1;
+ else
+ $array[\S::get('page_id')] = 0;
+
+ $array = serialize($array);
+
+ setcookie('cookie_pages', $array, time() + 3600 * 24 * 365);
+}
+
+if ( $a == 'google_url_preview' )
+{
+ $settings = \front\factory\Settings::settings_details();
+ $structure = $settings['links_structure'];
+
+ if ( $structure )
+ {
+ if ( \S::get( 'page_id' ) )
+ {
+ $seo_link = \admin\factory\Pages::google_url_preview(\S::get('page_id'), \S::get('title'), \S::get('lang_id'), \S::get('pid'), 0, \S::get('seo_link'));
+ echo $seo_link;
+ }
+ else
+ {
+ $seo_link = \admin\factory\Pages::google_url_preview(0, \S::get('title'), \S::get('lang_id'), \S::get('pid'), \S::max_db_value('pp_pages', 'id') + 1, \S::get('seo_link'));
+ echo $seo_link;
+ }
+ }
+ else
+ {
+ if ( \S::get( 'seo_link' ) )
+ echo \S::get( 'seo_link' );
+ else
+ {
+ if ( \S::get( 'page_id' ) )
+ echo $prefix . 's-' . \S::get('page_id') . '-' . \S::seo(\S::get('title'));
+ else
+ echo $prefix . 's-' . ( \S::max_db_value('pp_pages', 'id') + 1 ) . '-' . \S::seo(\S::get('title'));
+ }
+ }
+}
diff --git a/admin/ajax/users.php b/admin/ajax/users.php
new file mode 100644
index 0000000..7ab9339
--- /dev/null
+++ b/admin/ajax/users.php
@@ -0,0 +1,9 @@
+li>a>span:nth-child(2){padding:0}ol.sortable,ol.sortable ol{margin:0 0 0 25px;padding:0;list-style-type:none}ol.sortable{margin:0}ol.sortable,ol.sortable *,ol.sortable :after,ol.sortable :before{box-sizing:content-box}.sortable li{margin:0;padding:0}.sortable li div.content{color:#454545;cursor:move;height:45px;line-height:45px;margin:0;padding:0 10px;border-bottom:1px solid #e1e1e1}.sortable li div.content.text-danger{color:#e9573f!important}.sortable li.sort-branch div{color:#383838}.sort-leaf .disclose{content:"- ";text-indent:-3000px;background-image:url(/libraries/jquery-nested-sortable/skin-vista/icons.gif);background-position:-16px -64px;background-repeat:no-repeat;display:inline-block;height:16px;vertical-align:top;width:16px;margin:16px 5px 0 1px}li.sort-collapsed.sort-hover div{border-color:#999}.disclose{cursor:pointer;width:20px;display:none;text-align:center}.sortable li.sort-collapsed>ol{display:none}.sortable li.sort-branch>div>.disclose{display:block;float:left;margin-right:15px;position:relative;z-index:10}.sortable li.sort-collapsed>div>.disclose>span:before{display:inline-block;font-family:FontAwesome;font-size:10px;content:"\f054";height:25px;width:25px;line-height:25px;border-radius:13px;background:rgba(134,145,178,.1);color:#8691b2;border:1px solid #8691b2;transition:.3s all ease}.sortable li.sort-collapsed>div>.disclose:hover>span:before,.sortable li.sort-expanded>div>.disclose:hover>span:before{background:#3bafda;color:#fff}.sortable li.sort-expanded>div>.disclose>span:before{display:inline-block;font-family:FontAwesome;font-size:10px;content:"\f078";height:25px;width:25px;line-height:25px;border-radius:13px;background:#eee;color:#3bafda;border:1px solid #3bafda}.placeholder{outline:1px dashed #4183c4}.sort-error{background:#fbe3e4;border-color:transparent}.menu_sortable .btn-group{margin-top:7px;display:none}.menu_sortable div:hover .btn-group{display:block}.menu_sortable div:hover{background:#f6f7f9}.resp-vtabs::after{content:"";display:block;clear:both}.resp-tab-content{padding:25px 15px}@media only screen and (max-width:576px){.resp-vtabs .resp-tab-content{padding:25px 5px}}.resp-tab-content .resp-tab-content{padding:0;border:0}@media (max-width:768px){.resp-tab-content .resp-tab-content{border:1px solid #c1c1c1}}.resp-tab-active,.resp-tabs-list li{padding:8px 20px!important}.resp-tab-content .resp-tabs-list{border-bottom:0;margin-bottom:10px;background:rgba(134,145,178,.1)}.resp-tab-content .resp-tabs-list li{border-left:0!important;border-right:0!important;float:right}.resp-tab-content .resp-tabs-list::after{clear:both;content:"";display:block}.resp-tab-content .resp-tab-active{position:relative;top:-1px}.resp-tab-content .form-group{margin:0 0 15px 0}.input-group span.btn-info{border-color:rgba(0,0,0,.05)}#overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1300;background:rgba(0,0,0,.2);display:none;cursor:pointer}#g-row-limit{width:auto;display:inline-block;height:30px;line-height:30px;padding:4px 12px}#files-uploader,#images-uploader{clear:both}#files-uploader,#files-uploader *,#images-uploader,#images-uploader *{box-sizing:content-box!important}#images-list{margin:0;padding:0 5px}#images-list li{background:#fff;text-align:center;display:block;height:165px;margin:5px 5px 10px 5px;vertical-align:middle;float:left;width:calc(25% - 10px);position:relative}#images-list li.sortable-chosen{-webkit-box-shadow:-1px 1px 6px rgba(0,0,0,.75);-moz-box-shadow:-1px 1px 6px rgba(0,0,0,.75);box-shadow:-1px 1px 6px rgba(0,0,0,.75)}#images-list li .article-image{height:100%;width:100%;object-fit:cover}#images-list li .image-alt{padding:5px;height:30px;font-size:13px}#images-list li .article_image_delete{border:0;padding:13px;position:absolute;top:0;right:0}#images-list li .article_image_delete i{font-size:18px}#images-list li .image-alt{position:absolute;bottom:10px;border:0;background:rgba(0,0,0,.2);text-align:center;color:#fff}#images-list li .image-alt::placeholder{color:#fff}#images-list li.pending .article-image-edit,#images-list li:hover .article-image-edit{display:block}.article-image-edit{background:rgba(255,255,255,.8);position:absolute;height:100%;width:150px;cursor:pointer;line-height:168px;display:none}.article-image-edit i{font-size:28px;color:#c00}.article-image-edit img{height:50px;position:relative;top:12px}#files-list{list-style-type:none;margin:0;padding:0}#files-list li{float:left;margin:5px 7px}#files-list li .article_file_delete{border-color:rgba(0,0,0,.05)}#elfinder *{box-sizing:content-box!important}#elfinder{background:#ebebeb}.elfinder-button{background:#fff!important}.elfinder .elfinder-navbar,.elfinder-contextmenu .elfinder-contextmenu-item span,.elfinder-cwd,.std42-dialog .ui-dialog-content{font-size:12px}.elfinder-contextmenu-item{background:#fff;color:#000}.elfinder-cwd-view-icons .elfinder-cwd-filename{-webkit-border-radius:0;border-radius:0}.elfinder-button-menu .ui-state-hover,.elfinder-cwd table td.ui-state-hover,.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover{background:#2c373d}.elfinder-cwd-filename input[type=text]{border:0!important;padding:0!important}#elfinder{height:750px!important;position:relative}.elfinder-cwd table tr:nth-child(2n+1){background:#d3d3d3}.elfinder-cwd table tr{border-top:1px solid #ccc}.elfinder-cwd table tr td{padding:5px 12px!important}.elfinder-workzone{clear:both}#elfinder .ui-dialog{border:1px solid #ccc;position:absolute!important}.navbar-branding .navbar-brand{float:left}.navbar-branding .navbar-version{opacity:.5;font-size:12px;height:60px;line-height:60px;padding:0 15px;color:#666;float:left}.navbar .label{position:relative;top:15px;float:left;height:28px}body.sb-top .navbar-branding{width:250px}.flags{margin:-4px 0 0 20px!important;background:0 0;cursor:move}.flags:hover{border:0!important;background:0 0!important}.flags img{height:10px;margin-right:5px;opacity:.4}.CodeMirror{height:500px!important}.nav>li>a{font-size:12px}#newsletter-preview{border:1px solid #ccc;padding:20px}div.jqi .jqititle{margin-bottom:0}#google-preview{padding:10px}.google-title{color:#1a0dab;font-family:arial,sans-serif;cursor:pointer;font-size:18px;line-height:21.6px;width:600px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.google-url{color:#006621;font-family:arial,sans-serif;font-size:14px;line-height:16px;width:600px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.google-description{color:#545454;font-family:arial,sans-serif;font-size:13px;line-height:18.2px;width:600px;display:block}.sidebar-left-content{background:#114975}.sidebar-menu li.disable_menu{pointer-events:none;opacity:.3}body.sb-top #sidebar_left .sidebar-menu>li>a{color:#fff}body.sb-top.sb-top-sm #sidebar_left .sidebar-menu>li>a>span:nth-child(1){font-size:13px}body.sb-top #sidebar_left .sidebar-menu li>a>span.caret{color:#fff}body.sb-top #sidebar_left .sidebar-menu>li.active>a,body.sb-top #sidebar_left .sidebar-menu>li:hover>a,body.sb-top #sidebar_left .sidebar-menu>li>a.menu-open,body.sb-top #sidebar_left .sidebar-menu>li>a:focus,body.sb-top #sidebar_left .sidebar-menu>li>a:hover{background:#fff;color:#114975}body.sb-top #sidebar_left .sidebar-menu liactive>a>span.caret,body.sb-top #sidebar_left .sidebar-menu>li:hover>a>span.caret,body.sb-top #sidebar_left .sidebar-menu>li>a.menu-open>span.caret,body.sb-top #sidebar_left .sidebar-menu>li>a:focus>span.caret,body.sb-top #sidebar_left .sidebar-menu>li>a:hover>span.caret{color:#114975}.sidebar-menu>li>ul{background:#fff;-webkit-box-shadow:-1px 1px 6px rgba(0,0,0,.2);-moz-box-shadow:-1px 1px 6px rgba(0,0,0,.2);box-shadow:-1px 1px 6px rgba(0,0,0,.2)}.sidebar-menu>li>ul>li>a{color:#114975;border-bottom:1px solid #f3f3f3}body.sb-top #sidebar_left .sidebar-menu>li>ul>li.active>a:after,body.sb-top #sidebar_left .sidebar-menu>li>ul>li:focus>a:after,body.sb-top #sidebar_left .sidebar-menu>li>ul>li:hover>a:after,body.sb-top #sidebar_left .sidebar-menu>li>ul>li>a.menu-open:after{width:5px;left:0}.sidebar-menu>li>ul>li>a:focus,.sidebar-menu>li>ul>li>a:hover{color:#114975}.sidebar-menu>li>ul>li:focus>a:after,.sidebar-menu>li>ul>li:hover>a:after{background:#70ca63}body.sb-top #sidebar_left .sidebar-menu>li>ul{padding-bottom:0}.progress-box{position:absolute;top:0;width:100%;height:100%;z-index:200;background:#fff;padding:0;margin-left:-15px}.progress{margin:15px;height:35px;transform:translateY(-100%);position:relative;top:30%;background-color:#333}.version{position:relative;top:5%}.version h3 p{display:inline-block}.version h3{text-align:center}.form-group.text-right div{padding-right:15px}.remember{font-size:13px!important}#remember{display:inline-block!important;width:15px;height:15px;top:2px;position:relative}.popo{display:inline-block;border:1px solid;border-color:red;border-radius:50%;height:20px;width:20px;text-align:center}.popover-btn{cursor:pointer;position:relative;display:block;color:red;height:20px;width:20px;text-indent:-4px}.mfp-auto-cursor .mfp-content{max-width:1000px}.mfp-auto-cursor .mfp-content .col-lg-9,.mfp-auto-cursor .mfp-content .row{width:100%;float:none;max-width:1000px}.mfp-auto-cursor .mfp-content .g-container{max-width:1000px}.mfp-close,.mfp-close:active{right:-7px;top:-27px;background:#fff!important}.affix{top:0;z-index:100}.affix+.panel-heading{padding-top:70px}.g-container hr{margin:5px 0}.resp-vtabs>.resp-tabs-list li{background:rgba(134,145,178,.1)!important}.resp-vtabs li.resp-tab-active{background:#8691b2!important;color:#fff;border-left:0!important;border:1px solid #8691b2!important}.resp-vtabs>.resp-tabs-container{border:0!important;border-left:1px solid #e5e5e5!important}@media (min-width:1199px){.g-container .panel-body form{max-width:1400px}}@media (max-width:900px){body.sb-top #toggle_sidemenu_t{width:60px}}.site-content{margin-left:0}@media (min-width:1200px){.site-content{margin-left:250px;width:calc(100% - 250px)}}@media (min-width:992px) and (max-width:1199px){.site-content.with-menu{width:calc(100% - 250px);margin-left:250px}}@media (min-width:768px) and (max-width:991px){.site-content.with-menu{width:calc(100% - 250px);margin-left:250px}}@media (min-width:576px) and (max-width:767px){.site-content.with-menu{width:calc(100% - 250px);margin-left:250px}}@media (max-width:575px){.site-content.with-menu{margin-left:0;width:100%}.site-content{margin-left:0;width:100%}}.menu-left{position:fixed;left:0;top:0;height:100%;background-color:#2a3042;z-index:9999;width:250px;padding:0 15px;overflow:scroll;scrollbar-width:none;-ms-overflow-style:none;overflow-y:scroll;overflow-x:hidden;scrollbar-width:none;-ms-overflow-style:none;overflow-y:scroll;overflow-x:hidden;display:none}@media (min-width:1200px){.menu-left{display:block}}@media (max-width:575px){.menu-left{width:100vw}}.menu-left.visible{display:block}.menu-left::-webkit-scrollbar{display:none;width:0;height:0}.menu-left a:hover{text-decoration:none}.logo{width:100%;color:#fff;background-color:#2a3042;text-align:center;padding:20px 0;font-size:24px;font-weight:400;position:-webkit-sticky;position:sticky;top:0;z-index:1020}.menu-left .logo .logo-cmspro{width:100%;color:#fff;text-align:center;padding:20px 0;font-size:24px;font-weight:400}.menu-left .logo .version-cmspro{font-size:11px;color:#8691b2}.menu-left .logo .update-cmspro{color:#2a3042;font-size:14px;font-weight:400;line-height:27px;padding:7px 15px;background:#fff;display:inline-block;border-radius:30px;transition:.3s all ease;margin-top:10px}.menu-left .logo .update-cmspro:hover{text-decoration:none;background:#8691b2;color:#fff}.menu-left .menu-content .title{text-transform:uppercase;color:#8691b2;font-size:12px;font-weight:700;margin-bottom:10px}.menu-left .menu-content ul li a{color:#8691b2;font-size:13px;font-weight:400;line-height:27px;padding:4px 0;display:block}.menu-left .menu-content ul li a:hover{color:#fff;text-decoration:none}.menu-left .menu-content ul li a:focus{text-decoration:none}.menu-left .menu-content ul{list-style-type:none;padding-inline-start:0}.menu-left .menu-content .preview{width:100%;background:#2a3042;text-align:center;position:-webkit-sticky;position:sticky;bottom:0;z-index:1020}.menu-left .menu-content .preview a{text-transform:uppercase;padding:20px 0;color:#8691b2;font-size:12px;font-weight:700;margin-bottom:10px;display:inline-block;margin-bottom:0}.menu-left .menu-content .preview a:hover{color:#fff;width:100%;height:100%}.menu-left .menu-content ul li a img{margin-right:10px;width:20px;text-align:center}.menu-left .menu-content ul li a:hover img{filter:brightness(200%)}.menu-left .menu-content .preview a img{margin-top:-4px;margin-right:5px;width:20px;text-align:center}.menu-left .menu-content .preview a:hover img{filter:brightness(200%)}.mobile-menu-btn{position:fixed;right:10px;bottom:10px;z-index:9999;height:50px;width:50px;color:#fff;background:#2a3042;line-height:50px;text-align:center;font-size:25px;cursor:pointer;border-radius:50%;display:none}@media (max-width:575px){.mobile-menu-btn.active{color:#2a3042;background:#fff}}@media (max-width:1199px){.mobile-menu-btn{display:block}}@media (max-width:767px){.pull-right-above-sm .btn{margin-top:10px;margin-bottom:10px;margin-left:0}}@media (min-width:768px){.pull-right-above-sm{text-align:right;float:right}}@media (max-width:767px){.pull-right-above-sm #g-columns-list{rigth:auto;left:14px}}@media (max-width:767px){.text-centred-xs{text-align:center!important}}.table-responsive input{min-width:150px}.table-responsive select{min-width:130px}@media (max-width:768px){.resp-tabs-container h2.resp-accordion .fa{margin-right:10px}}@media (max-width:1199px){body.sb-top .navbar-branding{display:block;width:100px}body.sb-top .navbar-branding.with-menu{display:none}}@media (min-width:1200px){body.sb-top .navbar-branding{display:none}}@media (max-width:400px){body.sb-top .navbar-branding{display:none}}.pagination{margin-bottom:0}.pagination li.disabled{opacity:.5;pointer-events:none}.site-content #content_wrapper{margin-left:0}.menu_sortable .content.ui-sortable-handle{position:relative;display:-webkit-box;max-height:55px;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:1}#article-list .content.ui-sortable-handle{position:relative;display:-webkit-box;max-height:55px;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:1;-webkit-box-orient:vertical}.g-container{position:relative;overflow:hidden;width:100%}@media (max-width:768px){.resp-vtabs>.resp-tabs-container{padding:0}}@media (max-width:576px){.panel-body{padding:15px 5px}}@media (max-width:768px){#g-results{margin-top:30px}}.panel-info.panel-border{border-color:#8691b2}.sortable li.sort-expanded>div>.disclose>span:before{color:#8691b2;border:1px solid #8691b2;background:rgba(134,145,178,.1);transition:.3s all ease}.sortable li.sort-collapsed>div>.disclose:hover>span:before,.sortable li.sort-expanded>div>.disclose:hover>span:before{background:#8691b2;color:#fff}.btn-danger,.btn-info,.btn-success,.btn-system{color:#fff;padding:.47rem .75rem;font-size:13px;line-height:1.5;font-weight:300;border-radius:.25rem;transition:.15s all ease}.btn-danger#g-columns-list-close,.btn-dark#g-select-columns{padding:9px 12px}.btn .fa{width:14px;height:14px}.btn-dark{border-radius:.25rem}.btn-success{color:#fff;background-color:#1cbb8c}.btn-success:active,.btn-success:focus,.btn-success:hover{background-color:#179a73}.btn-system{background-color:#fcb92c}.btn-system:active,.btn-system:focus,.btn-system:hover{background-color:#fbac06}.btn-danger{background-color:#ff3d60}.btn-danger:active,.btn-danger:focus,.btn-danger:hover{background-color:#ff1741}.btn-info{background-color:#5664d2}.btn-info:active,.btn-info:focus,.btn-info:hover{background-color:#3848ca}.panel-info>.panel-heading>.panel-title{font-size:15px;font-weight:700;text-transform:uppercase;color:#2a3042}#main:before{background:#f3f4f7}a{color:#818eb8}a:focus,a:hover{color:#2a3042;text-decoration:none}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{background-color:#818eb8;border-color:#818eb8}#g-columns-list ul li{text-align:left}.navbar .nav>li.dropdown .open .dropdown-menu:after,.navbar .nav>li.dropdown.open .dropdown-menu:after{border-bottom-color:#2a3042}.navbar .nav>li.dropdown .open .dropdown-menu,.navbar .nav>li.dropdown.open .dropdown-menu{border-top-color:#2a3042}.panel.panel-border>.panel-heading{background-color:#fff}.panel.panel-border>.panel-heading .btn{height:30px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f6f7f9}div.switch.switch-primary input:checked+label{background-color:#8691b2}.cm-s-material{background-color:#2a3042!important}.icheckbox_minimal-blue.ui-sortable-handle.hover{background:#fff;background:url(/libraries/grid/plugins/icheck/skins/minimal/blue.png) no-repeat;background-position:0 0!important}.table-hover>tbody>tr>td,.table-hover>tbody>tr>th{transition:all .3s ease}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:rgba(134,145,178,.12)!important}.dropdown-context{border-top:3px solid #2a3042!important}.dropdown-context-up:after,.dropdown-context:after{border-bottom:6px solid #2a3042!important}.input-group-addon{color:#2a3042}.g-tip .fa:before{color:#2a3042}.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{border:none;border-bottom:1px solid #eee}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th{border:none}.input-group-addon{background:rgba(134,145,178,.1)}.pagination>li>a{padding:0;width:30px;height:30px;display:flex;justify-content:center;align-items:center;border-radius:50%;margin-right:5px}.pagination>li:first-child>a{border-bottom-left-radius:50%;border-top-left-radius:50%}.pagination>li:last-child>a{border-bottom-right-radius:50%;border-top-right-radius:50%}.form-control{border-radius:.25rem}.input-group-addon:first-child{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.resp-tab-active{border:1px solid #8691b2!important;border-top:2px solid #8691b2!important}.resp-tabs-container h2.resp-accordion{background:rgba(134,145,178,.1)!important}.resp-tabs-container h2.resp-accordion.resp-tab-active{background:#8691b2!important;color:#fff}h2.resp-tab-active span.resp-arrow{border-bottom:12px solid #fff}.resp-tabs-container{border:rgba(134,145,178,.1)}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:rgba(134,145,178,.1)}.alert{border-radius:.25rem}.panel{border-radius:.25rem}.panel-body{border-radius:.25rem}.tooltipster-base{background-color:#2a3042!important}.tooltipster-punk{border-color:#8691b2!important}.form-control:focus{border-color:#8691b2}@media (max-width:576px){#content{padding:15px 0 40px 0}}
+/*# sourceMappingURL=custom.css.map */
\ No newline at end of file
diff --git a/admin/css/custom.css.map b/admin/css/custom.css.map
new file mode 100644
index 0000000..050d7a8
--- /dev/null
+++ b/admin/css/custom.css.map
@@ -0,0 +1 @@
+{"version":3,"sources":["custom.scss","custom.less"],"names":[],"mappings":"iBAC4B,wCAC1B,UAAW,MAG4B,qCACvC,QAAS,EAGT,YACU,eACV,OAAQ,EAAA,EAAA,EAAA,KACR,QAAS,EACT,gBAAiB,KAGjB,YACA,OAAQ,EAGR,YACU,cAEE,mBADA,oBAEZ,WAAY,YAGJ,aACR,OAAQ,EACR,QAAS,EAGK,yBACd,MAAO,QACP,OAAQ,KACR,OAAQ,KACR,YAAa,KACb,OAAQ,EACR,QAAS,EAAA,KACT,cAAe,IAAA,MAAA,QAGO,qCACtB,MAAO,kBAGgB,6BACvB,MAAO,QAGE,qBACT,QAAS,KACT,YAAa,QACb,iBAAkB,4DAClB,oBAAqB,MAAA,MACrB,kBAAmB,UACnB,QAAS,aACT,OAAQ,KACR,eAAgB,IAChB,MAAO,KACP,OAAQ,KAAA,IAAA,EAAA,IAGmB,iCAC3B,aAAc,KAGhB,UACE,OAAQ,QACR,MAAO,KACP,QAAS,KACT,WAAY,OAGgB,+BAC5B,QAAS,KAGsB,uCAC/B,QAAS,MACT,MAAO,KACP,aAAc,KACd,SAAU,SACV,QAAS,GAG0C,sDACnD,QAAS,aACT,YAAa,YACb,UAAW,KACX,QAAS,QACT,OAAQ,KACR,MAAO,KACP,YAAa,KACb,cAAe,KACf,WAAY,qBACZ,MAAO,QACP,OAAQ,IAAA,MAAA,QACR,WAAY,IAAA,IAAA,KAG6C,4DACD,2DACxD,WAAY,QACZ,MAAO,KAG2C,qDAClD,QAAS,aACT,YAAa,YACb,UAAW,KACX,QAAS,QACT,OAAQ,KACR,MAAO,KACP,YAAa,KACb,cAAe,KACf,WAAY,KACZ,MAAO,QACP,OAAQ,IAAA,MAAA,QAGV,aACE,QAAS,IAAA,OAAA,QAGX,YACE,WAAY,QACZ,aAAc,YAGD,0BACb,WAAY,IACZ,QAAS,KAGc,oCACvB,QAAS,MAGQ,yBACjB,WAAY,QAGD,mBACX,QAAS,GACT,QAAS,MACT,MAAO,KAGT,kBACE,QAAS,KAAA,KAGL,yCACQ,8BACV,QAAS,KAAA,KAIK,oCAChB,QAAS,EACT,OAAQ,EAGJ,yBACc,oCAChB,OAAQ,IAAA,MAAA,SAKZ,iBADgB,mBAEd,QAAS,IAAA,eAGO,kCAChB,cAAe,EACf,cAAe,KAEf,WAAY,qBAGoB,qCAChC,YAAa,YACb,aAAc,YACd,MAAO,MAG0B,yCACjC,MAAO,KACP,QAAS,GACT,QAAS,MAGO,mCAChB,SAAU,SACV,IAAK,KAGW,8BAChB,OAAQ,EAAA,EAAA,KAAA,EAGO,2BACf,aAAc,gBAGhB,SACE,SAAU,MACV,IAAK,EACL,KAAM,EACN,MAAO,KACP,OAAQ,KACR,QAAS,KACT,WAAY,eACZ,QAAS,KACT,OAAQ,QAGV,aACE,MAAO,KACP,QAAS,aACT,OAAQ,KACR,YAAa,KACb,QAAS,IAAA,KAIX,gBADA,iBAEE,MAAO,KAKT,gBACgB,kBAHhB,iBACiB,mBAGf,WAAY,sBAGd,aACE,OAAQ,EACR,QAAS,EAAA,IAGE,gBACX,WAAY,KACZ,WAAY,OACZ,QAAS,MACT,OAAQ,MACR,OAAQ,IAAA,IAAA,KAAA,IACR,eAAgB,OAChB,MAAO,KACP,MAAO,iBACP,SAAU,SAGG,gCACb,mBAAqB,KAAI,IAAI,IAAI,gBACjC,gBAAkB,KAAI,IAAI,IAAI,gBAC9B,WAAa,KAAI,IAAI,IAAI,gBAGX,+BACd,OAAQ,KACR,MAAO,KACP,WAAY,MAGE,2BACd,QAAS,IACT,OAAQ,KACR,UAAW,KAGG,sCACd,OAAQ,EACR,QAAS,KACT,SAAU,SACV,IAAK,EACL,MAAO,EAG6B,wCACpC,UAAW,KAGG,2BACd,SAAU,SACV,OAAQ,KACR,OAAQ,EACR,WAAY,eACZ,WAAY,OACZ,MAAO,KAGmB,wCAC1B,MAAO,KAIe,4CADF,0CAEpB,QAAS,MAGX,oBACE,WAAY,qBACZ,SAAU,SACV,OAAQ,KACR,MAAO,MACP,OAAQ,QACR,YAAa,MACb,QAAS,KAGS,sBAClB,UAAW,KACX,MAAO,KAGW,wBAClB,OAAQ,KACR,SAAU,SACV,IAAK,KAGP,YACE,gBAAiB,KACjB,OAAQ,EACR,QAAS,EAGC,eACV,MAAO,KACP,OAAQ,IAAA,IAGK,oCACb,aAAc,gBAGN,YACR,WAAY,sBAGd,UACE,WAAY,QAGd,iBACE,WAAY,eAIJ,2BAEuC,sDAHjD,cAEc,iCAEZ,UAAW,KAGb,2BACE,WAAY,KACZ,MAAO,KAGgB,gDACvB,sBAAuB,EACvB,cAAe,EAOK,sCADA,sCAHE,kFAKtB,WAAY,QAGe,wCAC3B,OAAQ,YACR,QAAS,YAGX,UACE,OAAQ,gBACR,SAAU,SAG2B,uCACrC,WAAY,QAGM,uBAClB,WAAY,IAAA,MAAA,KAGS,0BACrB,QAAS,IAAA,eAGX,mBACE,MAAO,KAGC,qBACR,OAAQ,IAAA,MAAA,KACR,SAAU,mBAGK,+BACf,MAAO,KAGQ,iCACf,QAAS,GACT,UAAW,KACX,OAAQ,KACR,YAAa,KACb,QAAS,EAAA,KACT,MAAO,KACP,MAAO,KAGD,eACN,SAAU,SACV,IAAK,KACL,MAAO,KACP,OAAQ,KAGE,6BACV,MAAO,MAGT,OACE,OAAQ,KAAA,EAAA,EAAA,eACR,WAAY,IACZ,OAAQ,KAGH,aACL,OAAQ,YACR,WAAY,cAGP,WACL,OAAQ,KACR,aAAc,IACd,QAAS,GAGX,YACE,OAAQ,gBAGE,UACV,UAAW,KAGb,oBACE,OAAQ,IAAA,MAAA,KACR,QAAS,KAGH,kBACN,cAAe,EAGjB,gBACE,QAAS,KAGX,cACE,MAAO,QACP,YAAa,KCAK,CDAL,WACb,OAAQ,QACR,UAAW,KACX,YAAa,OACb,MAAO,MACP,QAAS,MACT,SAAU,OACV,cAAe,SACf,YAAa,OAGf,YACE,MAAO,QACP,YAAa,KCAK,CDAL,WACb,UAAW,KACX,YAAa,KACb,MAAO,MACP,QAAS,MACT,SAAU,OACV,cAAe,SACf,YAAa,OAGf,oBACE,MAAO,QACP,YAAa,KCAK,CDAL,WACb,UAAW,KACX,YAAa,OACb,MAAO,MACP,QAAS,MAGX,sBACE,WAAY,QAGE,8BACd,eAAgB,KAChB,QAAS,GAGoC,6CAC7C,MAAO,KAGoE,yEAC3E,UAAW,KAGwC,wDACnD,MAAO,KAG6C,oDACD,mDACL,uDAEC,mDADA,mDAE/C,WAAY,KACZ,MAAO,QAGkD,8DACE,8DACI,kEAEJ,8DADA,8DAE3D,MAAO,QAGY,oBACnB,WAAY,KACZ,mBAAqB,KAAI,IAAI,IAAI,eACjC,gBAAkB,KAAI,IAAI,IAAI,eAC9B,WAAa,KAAI,IAAI,IAAI,eAGI,yBAC7B,MAAO,QACP,cAAe,IAAA,MAAA,QAIiD,gEAED,+DADA,+DAFI,mEAInE,MAAO,IACP,KAAM,EAIyB,+BADA,+BAE/B,MAAO,QAI8B,qCADA,qCAErC,WAAY,QAGiC,8CAC7C,eAAgB,EAGlB,cACE,SAAU,SACV,IAAK,EACL,MAAO,KACP,OAAQ,KACR,QAAS,IACT,WAAY,KACZ,QAAS,EACT,YAAa,MAGf,UACE,OAAQ,KACR,OAAQ,KACR,UAAW,kBACX,SAAU,SACV,IAAK,IACL,iBAAkB,KAGpB,SACE,SAAU,SACV,IAAK,GAGK,cACV,QAAS,aAGF,YACP,WAAY,OAGS,2BACrB,cAAe,KAGjB,UACE,UAAW,eAGb,UACE,QAAS,uBACT,MAAO,KACP,OAAQ,KACR,IAAK,IACL,SAAU,SAGZ,MACE,QAAS,aACT,OAAQ,IAAA,MACR,aAAc,IACd,cAAe,IACf,OAAQ,KACR,MAAO,KACP,WAAY,OAGd,aACE,OAAQ,QACR,SAAU,SACV,QAAS,MACT,MAAO,IACP,OAAQ,KACR,MAAO,KACP,YAAa,KAGE,8BACf,UAAW,OAGiB,wCACA,mCAC5B,MAAO,KACP,MAAO,KACP,UAAW,OAGiB,2CAC5B,UAAW,OAGb,WACW,kBACT,MAAO,KACP,IAAK,MACL,WAAY,eAGd,OACE,IAAK,EACL,QAAS,IAIF,sBACP,YAAa,KAGF,gBACX,OAAQ,IAAA,EAGoB,+BAC5B,WAAY,+BAGA,+BACZ,WAAY,kBACZ,MAAO,KACP,YAAa,YACb,OAAQ,IAAA,MAAA,kBAGI,iCACZ,OAAQ,YACR,YAAa,IAAA,MAAA,kBAGT,0BACqB,8BACvB,UAAW,QAIT,yBACQ,+BACV,MAAO,MAMX,cACE,YAAa,EAGT,0BACJ,cACE,YAAa,MACb,MAAO,oBAIL,gDACS,wBACX,MAAO,mBACP,YAAa,OAIX,+CACS,wBACX,MAAO,mBACP,YAAa,OAIX,+CACS,wBACX,MAAO,mBACP,YAAa,OAIX,yBACS,wBACX,YAAa,EACb,MAAO,KAGT,cACE,YAAa,EACb,MAAO,MAIX,WACE,SAAU,MACV,KAAM,EACN,IAAK,EAEL,OAAQ,KACR,iBAAkB,QAClB,QAAS,KACT,MAAO,MACP,QAAS,EAAA,KACT,SAAU,OACV,gBAAiB,KACjB,mBAAoB,KACpB,WAAY,OACZ,WAAY,OACZ,gBAAiB,KAEjB,mBAAoB,KAEpB,WAAY,OACZ,WAAY,OACZ,QAAS,KAGL,0BACJ,WACE,QAAS,OAIP,yBACJ,WACE,MAAO,OAID,mBACR,QAAS,MAGC,8BACV,QAAS,KAET,MAAO,EACP,OAAQ,EAGG,mBACX,gBAAiB,KAGnB,MACE,MAAO,KACP,MAAO,KACP,iBAAkB,QAClB,WAAY,OACZ,QAAS,KAAA,EACT,UAAW,KACX,YAAa,IACb,SAAU,eACV,SAAU,OACV,IAAK,EACL,QAAS,KAGM,8BACf,MAAO,KACP,MAAO,KAEP,WAAY,OACZ,QAAS,KAAA,EACT,UAAW,KACX,YAAa,IAGE,iCACf,UAAW,KACX,MAAO,QAGQ,gCACf,MAAO,QACP,UAAW,KACX,YAAa,IACb,YAAa,KACb,QAAS,IAAA,KACT,WAAY,KACZ,QAAS,aACT,cAAe,KACf,WAAY,IAAA,IAAA,KACZ,WAAY,KAGkB,sCAC9B,gBAAiB,KACjB,WAAY,QACZ,MAAO,KAGgB,gCACvB,eAAgB,UAChB,MAAO,QACP,UAAW,KACX,YAAa,IACb,cAAe,KAGc,iCAC7B,MAAO,QACP,UAAW,KACX,YAAa,IACb,YAAa,KACb,QAAS,IAAA,EACT,QAAS,MAGsB,uCAC/B,MAAO,KACP,gBAAiB,KAGc,uCAC/B,gBAAiB,KAGM,4BACvB,gBAAiB,KACjB,qBAAsB,EAGC,kCACvB,MAAO,KACP,WAAY,QACZ,WAAY,OACZ,SAAU,eACV,SAAU,OACV,OAAQ,EACR,QAAS,KAGuB,oCAChC,eAAgB,UAChB,QAAS,KAAA,EACT,MAAO,QACP,UAAW,KACX,YAAa,IACb,cAAe,KACf,QAAS,aACT,cAAe,EAGmB,0CAClC,MAAO,KACP,MAAO,KACP,OAAQ,KAGuB,qCAC/B,aAAc,KACd,MAAO,KACP,WAAY,OAGyB,2CACrC,OAAQ,iBAG0B,wCAClC,WAAY,KACZ,aAAc,IACd,MAAO,KACP,WAAY,OAG4B,8CACxC,OAAQ,iBAGV,iBACE,SAAU,MACV,MAAO,KACP,OAAQ,KACR,QAAS,KACT,OAAQ,KACR,MAAO,KACP,MAAO,KACP,WAAY,QACZ,YAAa,KACb,WAAY,OACZ,UAAW,KACX,OAAQ,QACR,cAAe,IACf,QAAS,KAGL,yBACY,wBACd,MAAO,QACP,WAAY,MAMV,0BACJ,iBACE,QAAS,OAIP,yBACiB,0BACnB,WAAY,KACZ,cAAe,KACf,YAAa,GAIX,yBACJ,qBACE,WAAY,MACZ,MAAO,OAIL,yBACiB,qCACnB,MAAO,KACP,KAAM,MAIJ,yBACJ,iBACE,WAAY,kBAIE,wBAChB,UAAW,MAGK,yBAChB,UAAW,MAGP,yBACmC,2CACrC,aAAc,MAIZ,0BACQ,6BACV,QAAS,MACT,MAAO,MAGmB,uCAC1B,QAAS,MAIP,0BACQ,6BACV,QAAS,MAIP,yBACQ,6BACV,QAAS,MAIb,YACE,cAAe,EAGH,wBACZ,QAAS,GACT,eAAgB,KAGJ,+BACZ,YAAa,EAGQ,2CACrB,SAAU,SACV,QAAS,YACT,WAAY,KACZ,SAAU,OACV,cAAe,SACf,mBAAoB,EAGA,0CACpB,SAAU,SACV,QAAS,YACT,WAAY,KACZ,SAAU,OACV,cAAe,SACf,mBAAoB,EACpB,mBAAoB,SAGtB,aACE,SAAU,SACV,SAAU,OACV,MAAO,KAGH,yBACU,iCACZ,QAAS,GAIP,yBACJ,YACE,QAAS,KAAA,KAIP,yBACJ,WACE,WAAY,MAKL,yBACT,aAAc,QAGoC,qDAClD,MAAO,QACP,OAAQ,IAAA,MAAA,QACR,WAAY,qBACZ,WAAY,IAAA,IAAA,KAG6C,4DACD,2DACxD,WAAY,QACZ,MAAO,KAKT,YACA,UAHA,aACA,YAGE,MAAO,KACP,QAAS,OAAA,OACT,UAAW,KACX,YAAa,IACb,YAAa,IACb,cAAe,OAEf,WAAY,KAAA,IAAA,KAGH,iCACF,2BACP,QAAS,IAAA,KAGN,SACH,MAAO,KACP,OAAQ,KAGV,UACE,cAAe,OAGjB,aACE,MAAO,KACP,iBAAkB,QAKP,oBADA,mBADA,mBAGX,iBAAkB,QAGpB,YACE,iBAAkB,QAKR,mBADA,kBADA,kBAGV,iBAAkB,QAGpB,YACE,iBAAkB,QAKR,mBADA,kBADA,kBAGV,iBAAkB,QAGpB,UACE,iBAAkB,QAKV,iBADA,gBADA,gBAGR,iBAAkB,QAGW,wCAC7B,UAAW,KACX,YAAa,IACb,eAAgB,UAChB,MAAO,QAGH,aACJ,WAAY,QAGd,EACE,MAAO,QAIP,QADA,QAEA,MAAO,QACP,gBAAiB,KAGK,sBAIE,4BAFA,4BADF,yBAIK,+BAFA,+BAG3B,iBAAkB,QAClB,aAAc,QAGG,sBACjB,WAAY,KAIkC,oDADD,mDAE7C,oBAAqB,QAIU,8CADD,6CAE9B,iBAAkB,QAGE,mCACpB,iBAAkB,KAElB,wCACE,OAAQ,KAIiC,0CACA,0CAC3C,iBAAkB,QAGsB,8CACxC,iBAAkB,QAGpB,eACE,iBAAkB,kBAGsB,iDACxC,WAAY,KACZ,WAAY,2DACV,UACF,oBAAqB,EAAA,YAGK,yBACA,yBAC1B,WAAY,IAAA,IAAA,KAGoB,+BACA,+BAChC,iBAAkB,gCAGpB,kBACE,WAAY,IAAA,MAAA,kBAIO,2BADH,wBAEhB,cAAe,IAAA,MAAA,kBAGjB,mBACE,MAAO,QAGE,kBACT,MAAO,QAIiC,qCADA,qCAExC,OAAQ,KACR,cAAe,IAAA,MAAA,KAKyB,qCAFA,qCAGA,qCAFA,qCAGxC,OAAQ,KAGV,mBACE,WAAY,qBAMK,iBACjB,QAAS,EACT,MAAO,KACP,OAAQ,KACR,QAAS,KACT,gBAAiB,OACjB,YAAa,OACb,cAAe,IACf,aAAc,IAGe,6BAC7B,0BAA2B,IAC3B,uBAAwB,IAGI,4BAC5B,2BAA4B,IAC5B,wBAAyB,IAG3B,cACE,cAAe,OAGE,+BACjB,uBAAwB,OACxB,0BAA2B,OAG7B,iBACE,OAAQ,IAAA,MAAA,kBAER,WAAY,IAAA,MAAA,kBAGS,uCACrB,WAAY,+BAGwB,uDACpC,WAAY,kBACZ,MAAO,KAGc,mCACrB,cAAe,KAAA,MAAA,KAGjB,qBACE,OAAQ,qBAGI,wBACA,wBACK,iCACjB,iBAAkB,qBAGpB,OACE,cAAe,OAGjB,OACE,cAAe,OAGjB,YACE,cAAe,OAGjB,kBACE,iBAAkB,kBAGpB,kBACE,aAAc,kBAGF,oBACZ,aAAc,QAGV,yBACJ,SACE,QAAS,KAAA,EAAA,KAAA"}
\ No newline at end of file
diff --git a/admin/css/custom.scss b/admin/css/custom.scss
new file mode 100644
index 0000000..e60738f
--- /dev/null
+++ b/admin/css/custom.scss
@@ -0,0 +1,1382 @@
+//out: custom.css, compress: true, sourceMap: true
+body.external-page #content .admin-form {
+ max-width: 450px;
+}
+
+.sidebar-menu > li > a > span:nth-child(2) {
+ padding: 0;
+}
+
+ol.sortable,
+ol.sortable ol {
+ margin: 0 0 0 25px;
+ padding: 0;
+ list-style-type: none;
+}
+
+ol.sortable {
+ margin: 0;
+}
+
+ol.sortable,
+ol.sortable *,
+ol.sortable *:before,
+ol.sortable *:after {
+ box-sizing: content-box;
+}
+
+.sortable li {
+ margin: 0;
+ padding: 0;
+}
+
+.sortable li div.content {
+ color: #454545;
+ cursor: move;
+ height: 45px;
+ line-height: 45px;
+ margin: 0;
+ padding: 0 10px;
+ border-bottom: 1px solid #e1e1e1;
+}
+
+.sortable li div.content.text-danger {
+ color: #e9573f !important;
+}
+
+.sortable li.sort-branch div {
+ color: #383838;
+}
+
+.sort-leaf .disclose {
+ content: "- ";
+ text-indent: -3000px;
+ background-image: url("/libraries/jquery-nested-sortable/skin-vista/icons.gif");
+ background-position: -16px -64px;
+ background-repeat: no-repeat;
+ display: inline-block;
+ height: 16px;
+ vertical-align: top;
+ width: 16px;
+ margin: 16px 5px 0 1px;
+}
+
+li.sort-collapsed.sort-hover div {
+ border-color: #999999;
+}
+
+.disclose {
+ cursor: pointer;
+ width: 20px;
+ display: none;
+ text-align: center;
+}
+
+.sortable li.sort-collapsed > ol {
+ display: none;
+}
+
+.sortable li.sort-branch > div > .disclose {
+ display: block;
+ float: left;
+ margin-right: 15px;
+ position: relative;
+ z-index: 10;
+}
+
+.sortable li.sort-collapsed > div > .disclose > span:before {
+ display: inline-block;
+ font-family: FontAwesome;
+ font-size: 10px;
+ content: "\f054";
+ height: 25px;
+ width: 25px;
+ line-height: 25px;
+ border-radius: 13px;
+ background: rgba(134, 145, 178, 0.1);
+ color: #8691b2;
+ border: 1px solid #8691b2;
+ transition: 0.3s all ease;
+}
+
+.sortable li.sort-collapsed > div > .disclose:hover > span:before,
+.sortable li.sort-expanded > div > .disclose:hover > span:before {
+ background: #3bafda;
+ color: #fff;
+}
+
+.sortable li.sort-expanded > div > .disclose > span:before {
+ display: inline-block;
+ font-family: FontAwesome;
+ font-size: 10px;
+ content: "\f078";
+ height: 25px;
+ width: 25px;
+ line-height: 25px;
+ border-radius: 13px;
+ background: #eeeeee;
+ color: #3bafda;
+ border: 1px solid #3bafda;
+}
+
+.placeholder {
+ outline: 1px dashed #4183c4;
+}
+
+.sort-error {
+ background: #fbe3e4;
+ border-color: transparent;
+}
+
+.menu_sortable .btn-group {
+ margin-top: 7px;
+ display: none;
+}
+
+.menu_sortable div:hover .btn-group {
+ display: block;
+}
+
+.menu_sortable div:hover {
+ background: #f6f7f9;
+}
+
+.resp-vtabs::after {
+ content: "";
+ display: block;
+ clear: both;
+}
+
+.resp-tab-content {
+ padding: 25px 15px;
+}
+
+@media only screen and (max-width: 576px) {
+ .resp-vtabs .resp-tab-content {
+ padding: 25px 5px;
+ }
+}
+
+.resp-tab-content .resp-tab-content {
+ padding: 0;
+ border: 0;
+}
+
+@media (max-width: 768px) {
+ .resp-tab-content .resp-tab-content {
+ border: 1px solid #c1c1c1;
+ }
+}
+
+.resp-tabs-list li,
+.resp-tab-active {
+ padding: 8px 20px !important;
+}
+
+.resp-tab-content .resp-tabs-list {
+ border-bottom: 0;
+ margin-bottom: 10px;
+ /*background: #f1f1f1;*/
+ background: rgba(134, 145, 178, 0.1);
+}
+
+.resp-tab-content .resp-tabs-list li {
+ border-left: 0 !important;
+ border-right: 0 !important;
+ float: right;
+}
+
+.resp-tab-content .resp-tabs-list::after {
+ clear: both;
+ content: "";
+ display: block;
+}
+
+.resp-tab-content .resp-tab-active {
+ position: relative;
+ top: -1px;
+}
+
+.resp-tab-content .form-group {
+ margin: 0 0 15px 0;
+}
+
+.input-group span.btn-info {
+ border-color: rgba(0, 0, 0, 0.05);
+}
+
+#overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 1300;
+ background: rgba(0, 0, 0, 0.2);
+ display: none;
+ cursor: pointer;
+}
+
+#g-row-limit {
+ width: auto;
+ display: inline-block;
+ height: 30px;
+ line-height: 30px;
+ padding: 4px 12px;
+}
+
+#images-uploader,
+#files-uploader {
+ clear: both;
+}
+
+#images-uploader,
+#images-uploader *,
+#files-uploader,
+#files-uploader * {
+ box-sizing: content-box !important;
+}
+
+#images-list {
+ margin: 0;
+ padding: 0 5px;
+}
+
+#images-list li {
+ background: #fff;
+ text-align: center;
+ display: block;
+ height: 165px;
+ margin: 5px 5px 10px 5px;
+ vertical-align: middle;
+ float: left;
+ width: calc(25% - 10px);
+ position: relative;
+}
+
+#images-list li.sortable-chosen {
+ -webkit-box-shadow: -1px 1px 6px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: -1px 1px 6px rgba(0, 0, 0, 0.75);
+ box-shadow: -1px 1px 6px rgba(0, 0, 0, 0.75);
+}
+
+#images-list li .article-image {
+ height: 100%;
+ width: 100%;
+ object-fit: cover;
+}
+
+#images-list li .image-alt {
+ padding: 5px;
+ height: 30px;
+ font-size: 13px;
+}
+
+#images-list li .article_image_delete {
+ border: 0;
+ padding: 13px;
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+
+#images-list li .article_image_delete i {
+ font-size: 18px;
+}
+
+#images-list li .image-alt {
+ position: absolute;
+ bottom: 10px;
+ border: 0;
+ background: rgba(0, 0, 0, 0.2);
+ text-align: center;
+ color: #fff;
+}
+
+#images-list li .image-alt::placeholder {
+ color: #fff;
+}
+
+#images-list li:hover .article-image-edit,
+#images-list li.pending .article-image-edit {
+ display: block;
+}
+
+.article-image-edit {
+ background: rgba(255, 255, 255, 0.8);
+ position: absolute;
+ height: 100%;
+ width: 150px;
+ cursor: pointer;
+ line-height: 168px;
+ display: none;
+}
+
+.article-image-edit i {
+ font-size: 28px;
+ color: #cc0000;
+}
+
+.article-image-edit img {
+ height: 50px;
+ position: relative;
+ top: 12px;
+}
+
+#files-list {
+ list-style-type: none;
+ margin: 0;
+ padding: 0;
+}
+
+#files-list li {
+ float: left;
+ margin: 5px 7px;
+}
+
+#files-list li .article_file_delete {
+ border-color: rgba(0, 0, 0, 0.05);
+}
+
+#elfinder * {
+ box-sizing: content-box !important;
+}
+
+#elfinder {
+ background: #ebebeb;
+}
+
+.elfinder-button {
+ background: #fff !important;
+}
+
+.elfinder-cwd,
+.elfinder .elfinder-navbar,
+.std42-dialog .ui-dialog-content,
+.elfinder-contextmenu .elfinder-contextmenu-item span {
+ font-size: 12px;
+}
+
+.elfinder-contextmenu-item {
+ background: #fff;
+ color: #000;
+}
+
+.elfinder-cwd-view-icons .elfinder-cwd-filename {
+ -webkit-border-radius: 0px;
+ border-radius: 0px;
+}
+
+.elfinder-cwd-view-icons
+ .elfinder-cwd-file
+ .elfinder-cwd-filename.ui-state-hover,
+.elfinder-cwd table td.ui-state-hover,
+.elfinder-button-menu .ui-state-hover {
+ background: #2c373d;
+}
+
+.elfinder-cwd-filename input[type="text"] {
+ border: 0px !important;
+ padding: 0px !important;
+}
+
+#elfinder {
+ height: 750px !important;
+ position: relative;
+}
+
+.elfinder-cwd table tr:nth-child(2n + 1) {
+ background: #d3d3d3;
+}
+
+.elfinder-cwd table tr {
+ border-top: 1px solid #ccc;
+}
+
+.elfinder-cwd table tr td {
+ padding: 5px 12px !important;
+}
+
+.elfinder-workzone {
+ clear: both;
+}
+
+#elfinder .ui-dialog {
+ border: 1px solid #ccc;
+ position: absolute !important;
+}
+
+.navbar-branding .navbar-brand {
+ float: left;
+}
+
+.navbar-branding .navbar-version {
+ opacity: 0.5;
+ font-size: 12px;
+ height: 60px;
+ line-height: 60px;
+ padding: 0 15px;
+ color: #666;
+ float: left;
+}
+
+.navbar .label {
+ position: relative;
+ top: 15px;
+ float: left;
+ height: 28px;
+}
+
+body.sb-top .navbar-branding {
+ width: 250px;
+}
+
+.flags {
+ margin: -4px 0 0 20px !important;
+ background: none;
+ cursor: move;
+}
+
+.flags:hover {
+ border: 0px !important;
+ background: none !important;
+}
+
+.flags img {
+ height: 10px;
+ margin-right: 5px;
+ opacity: 0.4;
+}
+
+.CodeMirror {
+ height: 500px !important;
+}
+
+.nav > li > a {
+ font-size: 12px;
+}
+
+#newsletter-preview {
+ border: 1px solid #ccc;
+ padding: 20px;
+}
+
+div.jqi .jqititle {
+ margin-bottom: 0;
+}
+
+#google-preview {
+ padding: 10px;
+}
+
+.google-title {
+ color: #1a0dab;
+ font-family: arial, sans-serif;
+ cursor: pointer;
+ font-size: 18px;
+ line-height: 21.6px;
+ width: 600px;
+ display: block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.google-url {
+ color: rgb(0, 102, 33);
+ font-family: arial, sans-serif;
+ font-size: 14px;
+ line-height: 16px;
+ width: 600px;
+ display: block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.google-description {
+ color: rgb(84, 84, 84);
+ font-family: arial, sans-serif;
+ font-size: 13px;
+ line-height: 18.2px;
+ width: 600px;
+ display: block;
+}
+
+.sidebar-left-content {
+ background: #114975;
+}
+
+.sidebar-menu li.disable_menu {
+ pointer-events: none;
+ opacity: 0.3;
+}
+
+body.sb-top #sidebar_left .sidebar-menu > li > a {
+ color: #fff;
+}
+
+body.sb-top.sb-top-sm #sidebar_left .sidebar-menu > li > a > span:nth-child(1) {
+ font-size: 13px;
+}
+
+body.sb-top #sidebar_left .sidebar-menu li > a > span.caret {
+ color: #fff;
+}
+
+body.sb-top #sidebar_left .sidebar-menu > li.active > a,
+body.sb-top #sidebar_left .sidebar-menu > li:hover > a,
+body.sb-top #sidebar_left .sidebar-menu > li > a.menu-open,
+body.sb-top #sidebar_left .sidebar-menu > li > a:hover,
+body.sb-top #sidebar_left .sidebar-menu > li > a:focus {
+ background: #fff;
+ color: #114975;
+}
+
+body.sb-top #sidebar_left .sidebar-menu liactive > a > span.caret,
+body.sb-top #sidebar_left .sidebar-menu > li:hover > a > span.caret,
+body.sb-top #sidebar_left .sidebar-menu > li > a.menu-open > span.caret,
+body.sb-top #sidebar_left .sidebar-menu > li > a:hover > span.caret,
+body.sb-top #sidebar_left .sidebar-menu > li > a:focus > span.caret {
+ color: #114975;
+}
+
+.sidebar-menu > li > ul {
+ background: #fff;
+ -webkit-box-shadow: -1px 1px 6px rgba(0, 0, 0, 0.2);
+ -moz-box-shadow: -1px 1px 6px rgba(0, 0, 0, 0.2);
+ box-shadow: -1px 1px 6px rgba(0, 0, 0, 0.2);
+}
+
+.sidebar-menu > li > ul > li > a {
+ color: #114975;
+ border-bottom: 1px solid #f3f3f3;
+}
+
+body.sb-top #sidebar_left .sidebar-menu > li > ul > li > a.menu-open:after,
+body.sb-top #sidebar_left .sidebar-menu > li > ul > li.active > a:after,
+body.sb-top #sidebar_left .sidebar-menu > li > ul > li:hover > a:after,
+body.sb-top #sidebar_left .sidebar-menu > li > ul > li:focus > a:after {
+ width: 5px;
+ left: 0;
+}
+
+.sidebar-menu > li > ul > li > a:hover,
+.sidebar-menu > li > ul > li > a:focus {
+ color: #114975;
+}
+
+.sidebar-menu > li > ul > li:hover > a:after,
+.sidebar-menu > li > ul > li:focus > a:after {
+ background: #70ca63;
+}
+
+body.sb-top #sidebar_left .sidebar-menu > li > ul {
+ padding-bottom: 0;
+}
+
+.progress-box {
+ position: absolute;
+ top: 0px;
+ width: 100%;
+ height: 100%;
+ z-index: 200;
+ background: #fff;
+ padding: 0px;
+ margin-left: -15px;
+}
+
+.progress {
+ margin: 15px;
+ height: 35px;
+ transform: translateY(-100%);
+ position: relative;
+ top: 30%;
+ background-color: #333;
+}
+
+.version {
+ position: relative;
+ top: 5%;
+}
+
+.version h3 p {
+ display: inline-block;
+}
+
+.version h3 {
+ text-align: center;
+}
+
+.form-group.text-right div {
+ padding-right: 15px;
+}
+
+.remember {
+ font-size: 13px !important;
+}
+
+#remember {
+ display: inline-block !important;
+ width: 15px;
+ height: 15px;
+ top: 2px;
+ position: relative;
+}
+
+.popo {
+ display: inline-block;
+ border: 1px solid;
+ border-color: red;
+ border-radius: 50%;
+ height: 20px;
+ width: 20px;
+ text-align: center;
+}
+
+.popover-btn {
+ cursor: pointer;
+ position: relative;
+ display: block;
+ color: red;
+ height: 20px;
+ width: 20px;
+ text-indent: -4px;
+}
+
+.mfp-auto-cursor .mfp-content {
+ max-width: 1000px;
+}
+
+.mfp-auto-cursor .mfp-content .col-lg-9,
+.mfp-auto-cursor .mfp-content .row {
+ width: 100%;
+ float: none;
+ max-width: 1000px;
+}
+
+.mfp-auto-cursor .mfp-content .g-container {
+ max-width: 1000px;
+}
+
+.mfp-close,
+.mfp-close:active {
+ right: -7px;
+ top: -27px;
+ background: #fff !important;
+}
+
+.affix {
+ top: 0;
+ z-index: 100;
+ /* left:0px;*/
+}
+
+.affix + .panel-heading {
+ padding-top: 70px;
+}
+
+.g-container hr {
+ margin: 5px 0;
+}
+
+.resp-vtabs > .resp-tabs-list li {
+ background: rgba(134, 145, 178, 0.1) !important;
+}
+
+.resp-vtabs li.resp-tab-active {
+ background: #8691b2 !important;
+ color: #fff;
+ border-left: 0 !important;
+ border: 1px solid #8691b2 !important;
+}
+
+.resp-vtabs > .resp-tabs-container {
+ border: 0 !important;
+ border-left: 1px solid #e5e5e5 !important;
+}
+
+@media (min-width: 1199px) {
+ .g-container .panel-body form {
+ max-width: 1400px;
+ }
+}
+
+@media (max-width: 900px) {
+ body.sb-top #toggle_sidemenu_t {
+ width: 60px;
+ }
+}
+
+/**/
+
+.site-content {
+ margin-left: 0px;
+}
+
+@media (min-width: 1200px) {
+ .site-content {
+ margin-left: 250px;
+ width: calc(100% - 250px);
+ }
+}
+
+@media (min-width: 992px) and (max-width: 1199px) {
+ .site-content.with-menu {
+ width: calc(100% - 250px);
+ margin-left: 250px;
+ }
+}
+
+@media (min-width: 768px) and (max-width: 991px) {
+ .site-content.with-menu {
+ width: calc(100% - 250px);
+ margin-left: 250px;
+ }
+}
+
+@media (min-width: 576px) and (max-width: 767px) {
+ .site-content.with-menu {
+ width: calc(100% - 250px);
+ margin-left: 250px;
+ }
+}
+
+@media (max-width: 575px) {
+ .site-content.with-menu {
+ margin-left: 0;
+ width: 100%;
+ }
+
+ .site-content {
+ margin-left: 0;
+ width: 100%;
+ }
+}
+
+.menu-left {
+ position: fixed;
+ left: 0;
+ top: 0;
+
+ height: 100%;
+ background-color: #2a3042;
+ z-index: 9999;
+ width: 250px;
+ padding: 0 15px;
+ overflow: scroll;
+ scrollbar-width: none;
+ -ms-overflow-style: none;
+ overflow-y: scroll;
+ overflow-x: hidden;
+ scrollbar-width: none;
+ /* Firefox */
+ -ms-overflow-style: none;
+ /* IE 10+ */
+ overflow-y: scroll;
+ overflow-x: hidden;
+ display: none;
+}
+
+@media (min-width: 1200px) {
+ .menu-left {
+ display: block;
+ }
+}
+
+@media (max-width: 575px) {
+ .menu-left {
+ width: 100vw;
+ }
+}
+
+.menu-left.visible {
+ display: block;
+}
+
+.menu-left::-webkit-scrollbar {
+ display: none;
+ /* Chrome Safari */
+ width: 0;
+ height: 0;
+}
+
+.menu-left a:hover {
+ text-decoration: none;
+}
+
+.logo {
+ width: 100%;
+ color: #fff;
+ background-color: #2a3042;
+ text-align: center;
+ padding: 20px 0;
+ font-size: 24px;
+ font-weight: 400;
+ position: -webkit-sticky;
+ position: sticky;
+ top: 0;
+ z-index: 1020;
+}
+
+.menu-left .logo .logo-cmspro {
+ width: 100%;
+ color: #fff;
+
+ text-align: center;
+ padding: 20px 0;
+ font-size: 24px;
+ font-weight: 400;
+}
+
+.menu-left .logo .version-cmspro {
+ font-size: 11px;
+ color: #8691b2;
+}
+
+.menu-left .logo .update-cmspro {
+ color: #2a3042;
+ font-size: 14px;
+ font-weight: 400;
+ line-height: 27px;
+ padding: 7px 15px;
+ background: #fff;
+ display: inline-block;
+ border-radius: 30px;
+ transition: 0.3s all ease;
+ margin-top: 10px;
+}
+
+.menu-left .logo .update-cmspro:hover {
+ text-decoration: none;
+ background: #8691b2;
+ color: #fff;
+}
+
+.menu-left .menu-content .title {
+ text-transform: uppercase;
+ color: #8691b2;
+ font-size: 12px;
+ font-weight: 700;
+ margin-bottom: 10px;
+}
+
+.menu-left .menu-content ul li a {
+ color: #8691b2;
+ font-size: 13px;
+ font-weight: 400;
+ line-height: 27px;
+ padding: 4px 0;
+ display: block;
+}
+
+.menu-left .menu-content ul li a:hover {
+ color: #fff;
+ text-decoration: none;
+}
+
+.menu-left .menu-content ul li a:focus {
+ text-decoration: none;
+}
+
+.menu-left .menu-content ul {
+ list-style-type: none;
+ padding-inline-start: 0;
+}
+
+.menu-left .menu-content .preview {
+ width: 100%;
+ background: #2a3042;
+ text-align: center;
+ position: -webkit-sticky;
+ position: sticky;
+ bottom: 0;
+ z-index: 1020;
+}
+
+.menu-left .menu-content .preview a {
+ text-transform: uppercase;
+ padding: 20px 0;
+ color: #8691b2;
+ font-size: 12px;
+ font-weight: 700;
+ margin-bottom: 10px;
+ display: inline-block;
+ margin-bottom: 0;
+}
+
+.menu-left .menu-content .preview a:hover {
+ color: #fff;
+ width: 100%;
+ height: 100%;
+}
+
+.menu-left .menu-content ul li a img {
+ margin-right: 10px;
+ width: 20px;
+ text-align: center;
+}
+
+.menu-left .menu-content ul li a:hover img {
+ filter: brightness(200%);
+}
+
+.menu-left .menu-content .preview a img {
+ margin-top: -4px;
+ margin-right: 5px;
+ width: 20px;
+ text-align: center;
+}
+
+.menu-left .menu-content .preview a:hover img {
+ filter: brightness(200%);
+}
+
+.mobile-menu-btn {
+ position: fixed;
+ right: 10px;
+ bottom: 10px;
+ z-index: 9999;
+ height: 50px;
+ width: 50px;
+ color: #fff;
+ background: #2a3042;
+ line-height: 50px;
+ text-align: center;
+ font-size: 25px;
+ cursor: pointer;
+ border-radius: 50%;
+ display: none;
+}
+
+@media (max-width: 575px) {
+ .mobile-menu-btn.active {
+ color: #2a3042;
+ background: #fff;
+ /* background: #8691b2;
+ color: #fff;*/
+ }
+}
+
+@media (max-width: 1199px) {
+ .mobile-menu-btn {
+ display: block;
+ }
+}
+
+@media (max-width: 767px) {
+ .pull-right-above-sm .btn {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ margin-left: 0;
+ }
+}
+
+@media (min-width: 768px) {
+ .pull-right-above-sm {
+ text-align: right;
+ float: right;
+ }
+}
+
+@media (max-width: 767px) {
+ .pull-right-above-sm #g-columns-list {
+ rigth: auto;
+ left: 14px;
+ }
+}
+
+@media (max-width: 767px) {
+ .text-centred-xs {
+ text-align: center !important;
+ }
+}
+
+.table-responsive input {
+ min-width: 150px;
+}
+
+.table-responsive select {
+ min-width: 130px;
+}
+
+@media (max-width: 768px) {
+ .resp-tabs-container h2.resp-accordion .fa {
+ margin-right: 10px;
+ }
+}
+
+@media (max-width: 1199px) {
+ body.sb-top .navbar-branding {
+ display: block;
+ width: 100px;
+ }
+
+ body.sb-top .navbar-branding.with-menu {
+ display: none;
+ }
+}
+
+@media (min-width: 1200px) {
+ body.sb-top .navbar-branding {
+ display: none;
+ }
+}
+
+@media (max-width: 400px) {
+ body.sb-top .navbar-branding {
+ display: none;
+ }
+}
+
+.pagination {
+ margin-bottom: 0;
+}
+
+.pagination li.disabled {
+ opacity: 0.5;
+ pointer-events: none;
+}
+
+.site-content #content_wrapper {
+ margin-left: 0;
+}
+
+.menu_sortable .content.ui-sortable-handle {
+ position: relative;
+ display: -webkit-box;
+ max-height: 55px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ -webkit-line-clamp: 1;
+}
+
+#article-list .content.ui-sortable-handle {
+ position: relative;
+ display: -webkit-box;
+ max-height: 55px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ -webkit-line-clamp: 1;
+ -webkit-box-orient: vertical;
+}
+
+.g-container {
+ position: relative;
+ overflow: hidden;
+ width: 100%;
+}
+
+@media (max-width: 768px) {
+ .resp-vtabs > .resp-tabs-container {
+ padding: 0;
+ }
+}
+
+@media (max-width: 576px) {
+ .panel-body {
+ padding: 15px 5px;
+ }
+}
+
+@media (max-width: 768px) {
+ #g-results {
+ margin-top: 30px;
+ }
+}
+
+/*wygląd*/
+.panel-info.panel-border {
+ border-color: #8691b2;
+}
+
+.sortable li.sort-expanded > div > .disclose > span:before {
+ color: #8691b2;
+ border: 1px solid #8691b2;
+ background: rgba(134, 145, 178, 0.1);
+ transition: 0.3s all ease;
+}
+
+.sortable li.sort-collapsed > div > .disclose:hover > span:before,
+.sortable li.sort-expanded > div > .disclose:hover > span:before {
+ background: #8691b2;
+ color: #fff;
+}
+
+.btn-success,
+.btn-system,
+.btn-danger,
+.btn-info {
+ color: #fff;
+ padding: 0.47rem 0.75rem;
+ font-size: 13px;
+ line-height: 1.5;
+ font-weight: 300;
+ border-radius: 0.25rem;
+
+ transition: 0.15s all ease;
+}
+
+.btn-danger#g-columns-list-close,
+.btn-dark#g-select-columns {
+ padding: 9px 12px;
+}
+
+.btn .fa {
+ width: 14px;
+ height: 14px;
+}
+
+.btn-dark {
+ border-radius: 0.25rem;
+}
+
+.btn-success {
+ color: #fff;
+ background-color: #1cbb8c;
+}
+
+.btn-success:hover,
+.btn-success:focus,
+.btn-success:active {
+ background-color: #179a73;
+}
+
+.btn-system {
+ background-color: #fcb92c;
+}
+
+.btn-system:hover,
+.btn-system:focus,
+.btn-system:active {
+ background-color: #fbac06;
+}
+
+.btn-danger {
+ background-color: #ff3d60;
+}
+
+.btn-danger:hover,
+.btn-danger:focus,
+.btn-danger:active {
+ background-color: #ff1741;
+}
+
+.btn-info {
+ background-color: #5664d2;
+}
+
+.btn-info:hover,
+.btn-info:focus,
+.btn-info:active {
+ background-color: #3848ca;
+}
+
+.panel-info > .panel-heading > .panel-title {
+ font-size: 15px;
+ font-weight: 700;
+ text-transform: uppercase;
+ color: #2a3042;
+}
+
+#main:before {
+ background: #f3f4f7;
+}
+
+a {
+ color: #818eb8;
+}
+
+a:hover,
+a:focus {
+ color: #2a3042;
+ text-decoration: none;
+}
+
+.pagination > .active > a,
+.pagination > .active > span,
+.pagination > .active > a:hover,
+.pagination > .active > span:hover,
+.pagination > .active > a:focus,
+.pagination > .active > span:focus {
+ background-color: #818eb8;
+ border-color: #818eb8;
+}
+
+#g-columns-list ul li {
+ text-align: left;
+}
+
+.navbar .nav > li.dropdown.open .dropdown-menu:after,
+.navbar .nav > li.dropdown .open .dropdown-menu:after {
+ border-bottom-color: #2a3042;
+}
+
+.navbar .nav > li.dropdown.open .dropdown-menu,
+.navbar .nav > li.dropdown .open .dropdown-menu {
+ border-top-color: #2a3042;
+}
+
+.panel.panel-border > .panel-heading {
+ background-color: #fff;
+
+ .btn {
+ height: 30px;
+ }
+}
+
+.table-striped > tbody > tr:nth-child(odd) > td,
+.table-striped > tbody > tr:nth-child(odd) > th {
+ background-color: #f6f7f9;
+}
+
+div.switch.switch-primary input:checked + label {
+ background-color: #8691b2;
+}
+
+.cm-s-material {
+ background-color: #2a3042 !important;
+}
+
+.icheckbox_minimal-blue.ui-sortable-handle.hover {
+ background: #fff;
+ background: url(/libraries/grid/plugins/icheck/skins/minimal/blue.png)
+ no-repeat;
+ background-position: 0 0 !important;
+}
+
+.table-hover > tbody > tr > td,
+.table-hover > tbody > tr > th {
+ transition: all 0.3s ease;
+}
+
+.table-hover > tbody > tr:hover > td,
+.table-hover > tbody > tr:hover > th {
+ background-color: rgba(134, 145, 178, 0.12) !important;
+}
+
+.dropdown-context {
+ border-top: 3px solid #2a3042 !important;
+}
+
+.dropdown-context:after,
+.dropdown-context-up:after {
+ border-bottom: 6px solid #2a3042 !important;
+}
+
+.input-group-addon {
+ color: #2a3042;
+}
+
+.g-tip .fa:before {
+ color: #2a3042;
+}
+
+.table-responsive > .table > thead > tr > th,
+.table-responsive > .table > thead > tr > td {
+ border: none;
+ border-bottom: 1px solid #eeeeee;
+}
+
+.table-responsive > .table > tbody > tr > th,
+.table-responsive > .table > tfoot > tr > th,
+.table-responsive > .table > tbody > tr > td,
+.table-responsive > .table > tfoot > tr > td {
+ border: none;
+}
+
+.input-group-addon {
+ background: rgba(134, 145, 178, 0.1);
+}
+
+.pagination {
+}
+
+.pagination > li > a {
+ padding: 0;
+ width: 30px;
+ height: 30px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ margin-right: 5px;
+}
+
+.pagination > li:first-child > a {
+ border-bottom-left-radius: 50%;
+ border-top-left-radius: 50%;
+}
+
+.pagination > li:last-child > a {
+ border-bottom-right-radius: 50%;
+ border-top-right-radius: 50%;
+}
+
+.form-control {
+ border-radius: 0.25rem;
+}
+
+.input-group-addon:first-child {
+ border-top-left-radius: 0.25rem;
+ border-bottom-left-radius: 0.25rem;
+}
+
+.resp-tab-active {
+ border: 1px solid #8691b2 !important;
+
+ border-top: 2px solid #8691b2 !important;
+}
+
+.resp-tabs-container h2.resp-accordion {
+ background: rgba(134, 145, 178, 0.1) !important;
+}
+
+.resp-tabs-container h2.resp-accordion.resp-tab-active {
+ background: #8691b2 !important;
+ color: #fff;
+}
+
+h2.resp-tab-active span.resp-arrow {
+ border-bottom: 12px solid #fff;
+}
+
+.resp-tabs-container {
+ border: rgba(134, 145, 178, 0.1);
+}
+
+.form-control[disabled],
+.form-control[readonly],
+fieldset[disabled] .form-control {
+ background-color: rgba(134, 145, 178, 0.1);
+}
+
+.alert {
+ border-radius: 0.25rem;
+}
+
+.panel {
+ border-radius: 0.25rem;
+}
+
+.panel-body {
+ border-radius: 0.25rem;
+}
+
+.tooltipster-base {
+ background-color: #2a3042 !important;
+}
+
+.tooltipster-punk {
+ border-color: #8691b2 !important;
+}
+
+.form-control:focus {
+ border-color: #8691b2;
+}
+
+@media (max-width: 576px) {
+ #content {
+ padding: 15px 0px 40px 0px;
+ }
+}
diff --git a/admin/css/icons/backup-line.svg b/admin/css/icons/backup-line.svg
new file mode 100644
index 0000000..9f9d54f
--- /dev/null
+++ b/admin/css/icons/backup-line.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/bx-at.svg b/admin/css/icons/bx-at.svg
new file mode 100644
index 0000000..f0235d4
--- /dev/null
+++ b/admin/css/icons/bx-at.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/bx-news.svg b/admin/css/icons/bx-news.svg
new file mode 100644
index 0000000..efb5b8d
--- /dev/null
+++ b/admin/css/icons/bx-news.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/container-solid.svg b/admin/css/icons/container-solid.svg
new file mode 100644
index 0000000..c852656
--- /dev/null
+++ b/admin/css/icons/container-solid.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/double-right-outlined.svg b/admin/css/icons/double-right-outlined.svg
new file mode 100644
index 0000000..ebd756b
--- /dev/null
+++ b/admin/css/icons/double-right-outlined.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/email.svg b/admin/css/icons/email.svg
new file mode 100644
index 0000000..453130a
--- /dev/null
+++ b/admin/css/icons/email.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/image.svg b/admin/css/icons/image.svg
new file mode 100644
index 0000000..2e6fd6d
--- /dev/null
+++ b/admin/css/icons/image.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/language.svg b/admin/css/icons/language.svg
new file mode 100644
index 0000000..8a1144a
--- /dev/null
+++ b/admin/css/icons/language.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/letter-aa.svg b/admin/css/icons/letter-aa.svg
new file mode 100644
index 0000000..1d73f6f
--- /dev/null
+++ b/admin/css/icons/letter-aa.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/list-settings-line.svg b/admin/css/icons/list-settings-line.svg
new file mode 100644
index 0000000..d4045e2
--- /dev/null
+++ b/admin/css/icons/list-settings-line.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/menu-alt.svg b/admin/css/icons/menu-alt.svg
new file mode 100644
index 0000000..37d6eb4
--- /dev/null
+++ b/admin/css/icons/menu-alt.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/news-24-regular.svg b/admin/css/icons/news-24-regular.svg
new file mode 100644
index 0000000..97bba87
--- /dev/null
+++ b/admin/css/icons/news-24-regular.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/people-fill.svg b/admin/css/icons/people-fill.svg
new file mode 100644
index 0000000..b4eb028
--- /dev/null
+++ b/admin/css/icons/people-fill.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/photo-video.svg b/admin/css/icons/photo-video.svg
new file mode 100644
index 0000000..793f5f3
--- /dev/null
+++ b/admin/css/icons/photo-video.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/send.svg b/admin/css/icons/send.svg
new file mode 100644
index 0000000..d6215b7
--- /dev/null
+++ b/admin/css/icons/send.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/settings-20-filled.svg b/admin/css/icons/settings-20-filled.svg
new file mode 100644
index 0000000..0272019
--- /dev/null
+++ b/admin/css/icons/settings-20-filled.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/template-2.svg b/admin/css/icons/template-2.svg
new file mode 100644
index 0000000..00eb0a7
--- /dev/null
+++ b/admin/css/icons/template-2.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/icons/template.svg b/admin/css/icons/template.svg
new file mode 100644
index 0000000..15e2704
--- /dev/null
+++ b/admin/css/icons/template.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/css/lang-de.jpg b/admin/css/lang-de.jpg
new file mode 100644
index 0000000..e821f55
Binary files /dev/null and b/admin/css/lang-de.jpg differ
diff --git a/admin/css/lang-en.jpg b/admin/css/lang-en.jpg
new file mode 100644
index 0000000..9929fd8
Binary files /dev/null and b/admin/css/lang-en.jpg differ
diff --git a/admin/css/lang-fr.jpg b/admin/css/lang-fr.jpg
new file mode 100644
index 0000000..fd0c92d
Binary files /dev/null and b/admin/css/lang-fr.jpg differ
diff --git a/admin/css/lang-it.jpg b/admin/css/lang-it.jpg
new file mode 100644
index 0000000..960870e
Binary files /dev/null and b/admin/css/lang-it.jpg differ
diff --git a/admin/css/lang-pl.jpg b/admin/css/lang-pl.jpg
new file mode 100644
index 0000000..85c5140
Binary files /dev/null and b/admin/css/lang-pl.jpg differ
diff --git a/admin/css/lang-ru.jpg b/admin/css/lang-ru.jpg
new file mode 100644
index 0000000..40d8a66
Binary files /dev/null and b/admin/css/lang-ru.jpg differ
diff --git a/admin/css/lang-uk.jpg b/admin/css/lang-uk.jpg
new file mode 100644
index 0000000..51dc892
Binary files /dev/null and b/admin/css/lang-uk.jpg differ
diff --git a/admin/css/user-icon.png b/admin/css/user-icon.png
new file mode 100644
index 0000000..a8af7c7
Binary files /dev/null and b/admin/css/user-icon.png differ
diff --git a/admin/index.php b/admin/index.php
new file mode 100644
index 0000000..20138fd
--- /dev/null
+++ b/admin/index.php
@@ -0,0 +1,86 @@
+
+if ( file_exists( 'ip.conf' ) )
+{
+ $ips = file_get_contents( 'ip.conf' );
+ $ips = preg_split( "/\\r\\n|\\r|\\n/", $ips );
+ $ips = array_filter( $ips );
+ if ( is_array( $ips ) and !empty( $ips ) )
+ {
+ if ( !in_array( $_SERVER['REMOTE_ADDR'], $ips ) )
+ die( 'Brak dostępu.' );
+ }
+}
+
+error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
+function __autoload_my_classes( $classname )
+{
+ $q = explode( '\\' , $classname );
+ $c = array_pop( $q );
+ $f = '../autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
+ if ( file_exists( $f ) )
+ require_once( $f );
+}
+spl_autoload_register( '__autoload_my_classes' );
+
+require_once '../config.php';
+require_once '../libraries/medoo/medoo.php';
+require_once '../libraries/grid/config.php';
+date_default_timezone_set( 'Europe/Warsaw' );
+
+$settings = \front\factory\Settings::settings_details();
+
+if ( file_exists( 'config.php' ) )
+ include 'config.php';
+
+session_start();
+
+if ( !isset( $_SESSION['check'] ) )
+{
+ session_regenerate_id();
+ $_SESSION['check'] = true;
+ $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
+}
+
+if ( $_SESSION['ip'] !== $_SERVER['REMOTE_ADDR'] )
+{
+ session_destroy();
+ header( 'Location: /admin/' );
+ exit;
+}
+
+$mdb = new medoo( [
+ 'database_type' => 'mysql',
+ 'database_name' => $database['name'],
+ 'server' => $database['host'],
+ 'username' => $database['user'],
+ 'password' => $database['password'],
+ 'charset' => 'utf8'
+ ] );
+
+$user = \S::get_session( 'user' , true );
+
+\admin\Site::special_actions();
+
+$domain = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );
+$cookie_name = str_replace( '.', '-', $domain );
+
+if ( isset( $_COOKIE[$cookie_name] ) && !isset( $_SESSION['user'] ) )
+{
+ $obj = json_decode( $_COOKIE[$cookie_name] );
+ $login = $obj -> {'login'};
+ $password = $obj -> {'hash'};
+
+ if ( $mdb -> get( 'pp_users', '*',
+ [ 'AND' =>
+ [ 'login' => $login, 'status' => 1, 'password' => $password,
+ 'OR' => [ 'active_to[>=]' => date( 'Y-m-d' ), 'active_to' => null ]
+ ]
+ ] ) )
+ {
+ \S::set_session( 'user', \admin\factory\Users::details( $login ) );
+ header( 'Location: /admin/articles/view_list/' );
+ exit;
+ }
+}
+echo \admin\view\Page::show();
+?>
\ No newline at end of file
diff --git a/admin/ip.conf b/admin/ip.conf
new file mode 100644
index 0000000..e69de29
diff --git a/admin/style-css/ckeditor.css b/admin/style-css/ckeditor.css
new file mode 100644
index 0000000..98121a9
--- /dev/null
+++ b/admin/style-css/ckeditor.css
@@ -0,0 +1 @@
+blockquote{padding-left:25px;border-left:5px solid #ccc}/*# sourceMappingURL=ckeditor.css.map */
\ No newline at end of file
diff --git a/admin/style-css/ckeditor.css.map b/admin/style-css/ckeditor.css.map
new file mode 100644
index 0000000..0f1bf89
--- /dev/null
+++ b/admin/style-css/ckeditor.css.map
@@ -0,0 +1 @@
+{"version":3,"sources":["../css/ckeditor.scss"],"names":[],"mappings":"AACA,WACE,iBAAA,CACA,0BAAA","file":"ckeditor.css"}
\ No newline at end of file
diff --git a/admin/style-css/custom.css b/admin/style-css/custom.css
new file mode 100644
index 0000000..290b672
--- /dev/null
+++ b/admin/style-css/custom.css
@@ -0,0 +1 @@
+body.external-page #content .admin-form{max-width:450px}.sidebar-menu>li>a>span:nth-child(2){padding:0}ol.sortable,ol.sortable ol{margin:0 0 0 25px;padding:0;list-style-type:none}ol.sortable{margin:0}ol.sortable,ol.sortable *,ol.sortable *:before,ol.sortable *:after{box-sizing:content-box}.sortable li{margin:0;padding:0}.sortable li div.content{color:#454545;cursor:move;height:45px;line-height:45px;margin:0;padding:0 10px;border-bottom:1px solid #e1e1e1}.sortable li div.content.text-danger{color:#e9573f !important}.sortable li.sort-branch div{color:#383838}.sort-leaf .disclose{content:"- ";text-indent:-3000px;background-image:url("/libraries/jquery-nested-sortable/skin-vista/icons.gif");background-position:-16px -64px;background-repeat:no-repeat;display:inline-block;height:16px;vertical-align:top;width:16px;margin:16px 5px 0 1px}li.sort-collapsed.sort-hover div{border-color:#999}.disclose{cursor:pointer;width:20px;display:none;text-align:center}.sortable li.sort-collapsed>ol{display:none}.sortable li.sort-branch>div>.disclose{display:block;float:left;margin-right:15px;position:relative;z-index:10}.sortable li.sort-collapsed>div>.disclose>span:before{display:inline-block;font-family:FontAwesome;font-size:10px;content:"";height:25px;width:25px;line-height:25px;border-radius:13px;background:rgba(134,145,178,.1);color:#8691b2;border:1px solid #8691b2;transition:.3s all ease}.sortable li.sort-collapsed>div>.disclose:hover>span:before,.sortable li.sort-expanded>div>.disclose:hover>span:before{background:#3bafda;color:#fff}.sortable li.sort-expanded>div>.disclose>span:before{display:inline-block;font-family:FontAwesome;font-size:10px;content:"";height:25px;width:25px;line-height:25px;border-radius:13px;background:#eee;color:#3bafda;border:1px solid #3bafda}.placeholder{outline:1px dashed #4183c4}.sort-error{background:#fbe3e4;border-color:rgba(0,0,0,0)}.menu_sortable .btn-group{margin-top:7px;display:none}.menu_sortable div:hover .btn-group{display:block}.menu_sortable div:hover{background:#f6f7f9}.resp-vtabs::after{content:"";display:block;clear:both}.resp-tab-content{padding:25px 15px}@media only screen and (max-width: 576px){.resp-vtabs .resp-tab-content{padding:25px 5px}}.resp-tab-content .resp-tab-content{padding:0;border:0}@media(max-width: 768px){.resp-tab-content .resp-tab-content{border:1px solid #c1c1c1}}.resp-tabs-list li,.resp-tab-active{padding:8px 20px !important}.resp-tab-content .resp-tabs-list{border-bottom:0;margin-bottom:10px;background:rgba(134,145,178,.1)}.resp-tab-content .resp-tabs-list li{border-left:0 !important;border-right:0 !important;float:right}.resp-tab-content .resp-tabs-list::after{clear:both;content:"";display:block}.resp-tab-content .resp-tab-active{position:relative;top:-1px}.resp-tab-content .form-group{margin:0 0 15px 0}.input-group span.btn-info{border-color:rgba(0,0,0,.05)}#overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1300;background:rgba(0,0,0,.2);display:none;cursor:pointer}#g-row-limit{width:auto;display:inline-block;height:30px;line-height:30px;padding:4px 12px}#images-uploader,#files-uploader{clear:both}#images-uploader,#images-uploader *,#files-uploader,#files-uploader *{box-sizing:content-box !important}#images-list{margin:0;padding:0 5px}#images-list li{background:#fff;text-align:center;display:block;height:165px;margin:5px 5px 10px 5px;vertical-align:middle;float:left;width:calc(25% - 10px);position:relative}#images-list li.sortable-chosen{box-shadow:-1px 1px 6px rgba(0,0,0,.75)}#images-list li .article-image{height:100%;width:100%;-o-object-fit:cover;object-fit:cover}#images-list li .image-alt{padding:5px;height:30px;font-size:13px}#images-list li .article_image_delete{border:0;padding:13px;position:absolute;top:0;right:0}#images-list li .article_image_delete i{font-size:18px}#images-list li .image-alt{position:absolute;bottom:10px;border:0;background:rgba(0,0,0,.2);text-align:center;color:#fff}#images-list li .image-alt::-moz-placeholder{color:#fff}#images-list li .image-alt:-ms-input-placeholder{color:#fff}#images-list li .image-alt::placeholder{color:#fff}#images-list li:hover .article-image-edit,#images-list li.pending .article-image-edit{display:block}.article-image-edit{background:rgba(255,255,255,.8);position:absolute;height:100%;width:150px;cursor:pointer;line-height:168px;display:none}.article-image-edit i{font-size:28px;color:#c00}.article-image-edit img{height:50px;position:relative;top:12px}#files-list{list-style-type:none;margin:0;padding:0}#files-list li{float:left;margin:5px 7px}#files-list li .article_file_delete{border-color:rgba(0,0,0,.05)}#elfinder *{box-sizing:content-box !important}#elfinder{background:#ebebeb}.elfinder-button{background:#fff !important}.elfinder-cwd,.elfinder .elfinder-navbar,.std42-dialog .ui-dialog-content,.elfinder-contextmenu .elfinder-contextmenu-item span{font-size:12px}.elfinder-contextmenu-item{background:#fff;color:#000}.elfinder-cwd-view-icons .elfinder-cwd-filename{border-radius:0px}.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover,.elfinder-cwd table td.ui-state-hover,.elfinder-button-menu .ui-state-hover{background:#2c373d}.elfinder-cwd-filename input[type=text]{border:0px !important;padding:0px !important}#elfinder{height:750px !important;position:relative}.elfinder-cwd table tr:nth-child(2n+1){background:#d3d3d3}.elfinder-cwd table tr{border-top:1px solid #ccc}.elfinder-cwd table tr td{padding:5px 12px !important}.elfinder-workzone{clear:both}#elfinder .ui-dialog{border:1px solid #ccc;position:absolute !important}.navbar-branding .navbar-brand{float:left}.navbar-branding .navbar-version{opacity:.5;font-size:12px;height:60px;line-height:60px;padding:0 15px;color:#666;float:left}.navbar .label{position:relative;top:15px;float:left;height:28px}body.sb-top .navbar-branding{width:250px}.flags{margin:-4px 0 0 20px !important;background:none;cursor:move}.flags:hover{border:0px !important;background:none !important}.flags img{height:10px;margin-right:5px;opacity:.4}.CodeMirror{height:500px !important}.nav>li>a{font-size:12px}#newsletter-preview{border:1px solid #ccc;padding:20px}div.jqi .jqititle{margin-bottom:0}#google-preview{padding:10px}.google-title{color:#1a0dab;font-family:arial,sans-serif;cursor:pointer;font-size:18px;line-height:21.6px;width:600px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.google-url{color:#006621;font-family:arial,sans-serif;font-size:14px;line-height:16px;width:600px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.google-description{color:#545454;font-family:arial,sans-serif;font-size:13px;line-height:18.2px;width:600px;display:block}.sidebar-left-content{background:#114975}.sidebar-menu li.disable_menu{pointer-events:none;opacity:.3}body.sb-top #sidebar_left .sidebar-menu>li>a{color:#fff}body.sb-top.sb-top-sm #sidebar_left .sidebar-menu>li>a>span:nth-child(1){font-size:13px}body.sb-top #sidebar_left .sidebar-menu li>a>span.caret{color:#fff}body.sb-top #sidebar_left .sidebar-menu>li.active>a,body.sb-top #sidebar_left .sidebar-menu>li:hover>a,body.sb-top #sidebar_left .sidebar-menu>li>a.menu-open,body.sb-top #sidebar_left .sidebar-menu>li>a:hover,body.sb-top #sidebar_left .sidebar-menu>li>a:focus{background:#fff;color:#114975}body.sb-top #sidebar_left .sidebar-menu liactive>a>span.caret,body.sb-top #sidebar_left .sidebar-menu>li:hover>a>span.caret,body.sb-top #sidebar_left .sidebar-menu>li>a.menu-open>span.caret,body.sb-top #sidebar_left .sidebar-menu>li>a:hover>span.caret,body.sb-top #sidebar_left .sidebar-menu>li>a:focus>span.caret{color:#114975}.sidebar-menu>li>ul{background:#fff;box-shadow:-1px 1px 6px rgba(0,0,0,.2)}.sidebar-menu>li>ul>li>a{color:#114975;border-bottom:1px solid #f3f3f3}body.sb-top #sidebar_left .sidebar-menu>li>ul>li>a.menu-open:after,body.sb-top #sidebar_left .sidebar-menu>li>ul>li.active>a:after,body.sb-top #sidebar_left .sidebar-menu>li>ul>li:hover>a:after,body.sb-top #sidebar_left .sidebar-menu>li>ul>li:focus>a:after{width:5px;left:0}.sidebar-menu>li>ul>li>a:hover,.sidebar-menu>li>ul>li>a:focus{color:#114975}.sidebar-menu>li>ul>li:hover>a:after,.sidebar-menu>li>ul>li:focus>a:after{background:#70ca63}body.sb-top #sidebar_left .sidebar-menu>li>ul{padding-bottom:0}.progress-box{position:absolute;top:0px;width:100%;height:100%;z-index:200;background:#fff;padding:0px;margin-left:-15px}.progress{margin:15px;height:35px;transform:translateY(-100%);position:relative;top:30%;background-color:#333}.version{position:relative;top:5%}.version h3 p{display:inline-block}.version h3{text-align:center}.form-group.text-right div{padding-right:15px}.remember{font-size:13px !important}#remember{display:inline-block !important;width:15px;height:15px;top:2px;position:relative}.popo{display:inline-block;border:1px solid;border-color:red;border-radius:50%;height:20px;width:20px;text-align:center}.popover-btn{cursor:pointer;position:relative;display:block;color:red;height:20px;width:20px;text-indent:-4px}.mfp-auto-cursor .mfp-content{max-width:1000px}.mfp-auto-cursor .mfp-content .col-lg-9,.mfp-auto-cursor .mfp-content .row{width:100%;float:none;max-width:1000px}.mfp-auto-cursor .mfp-content .g-container{max-width:1000px}.mfp-close,.mfp-close:active{right:-7px;top:-27px;background:#fff !important}.affix{top:0;z-index:100}.affix+.panel-heading{padding-top:70px}.g-container hr{margin:5px 0}.resp-vtabs>.resp-tabs-list li{background:rgba(134,145,178,.1) !important}.resp-vtabs li.resp-tab-active{background:#8691b2 !important;color:#fff;border-left:0 !important;border:1px solid #8691b2 !important}.resp-vtabs>.resp-tabs-container{border:0 !important;border-left:1px solid #e5e5e5 !important}@media(min-width: 1199px){.g-container .panel-body form{max-width:1400px}}@media(max-width: 900px){body.sb-top #toggle_sidemenu_t{width:60px}}.site-content{margin-left:0px}@media(min-width: 1200px){.site-content{margin-left:250px;width:calc(100% - 250px)}}@media(min-width: 992px)and (max-width: 1199px){.site-content.with-menu{width:calc(100% - 250px);margin-left:250px}}@media(min-width: 768px)and (max-width: 991px){.site-content.with-menu{width:calc(100% - 250px);margin-left:250px}}@media(min-width: 576px)and (max-width: 767px){.site-content.with-menu{width:calc(100% - 250px);margin-left:250px}}@media(max-width: 575px){.site-content.with-menu{margin-left:0;width:100%}.site-content{margin-left:0;width:100%}}.menu-left{position:fixed;left:0;top:0;height:100%;background-color:#2a3042;z-index:9999;width:250px;padding:0 15px;overflow:scroll;scrollbar-width:none;-ms-overflow-style:none;overflow-y:scroll;overflow-x:hidden;scrollbar-width:none;-ms-overflow-style:none;overflow-y:scroll;overflow-x:hidden;display:none}@media(min-width: 1200px){.menu-left{display:block}}@media(max-width: 575px){.menu-left{width:100vw}}.menu-left.visible{display:block}.menu-left::-webkit-scrollbar{display:none;width:0;height:0}.menu-left a:hover{text-decoration:none}.logo{width:100%;color:#fff;background-color:#2a3042;text-align:center;padding:20px 0;font-size:24px;font-weight:400;position:-webkit-sticky;position:sticky;top:0;z-index:1020}.menu-left .logo .logo-cmspro{width:100%;color:#fff;text-align:center;padding:20px 0;font-size:24px;font-weight:400}.menu-left .logo .version-cmspro{font-size:11px;color:#8691b2}.menu-left .logo .update-cmspro{color:#2a3042;font-size:14px;font-weight:400;line-height:27px;padding:7px 15px;background:#fff;display:inline-block;border-radius:30px;transition:.3s all ease;margin-top:10px}.menu-left .logo .update-cmspro:hover{text-decoration:none;background:#8691b2;color:#fff}.menu-left .menu-content .title{text-transform:uppercase;color:#8691b2;font-size:12px;font-weight:700;margin-bottom:10px}.menu-left .menu-content ul li a{color:#8691b2;font-size:13px;font-weight:400;line-height:27px;padding:4px 0;display:block}.menu-left .menu-content ul li a:hover{color:#fff;text-decoration:none}.menu-left .menu-content ul li a:focus{text-decoration:none}.menu-left .menu-content ul{list-style-type:none;-webkit-padding-start:0;padding-inline-start:0}.menu-left .menu-content .preview{width:100%;background:#2a3042;text-align:center;position:-webkit-sticky;position:sticky;bottom:0;z-index:1020}.menu-left .menu-content .preview a{text-transform:uppercase;padding:20px 0;color:#8691b2;font-size:12px;font-weight:700;margin-bottom:10px;display:inline-block;margin-bottom:0}.menu-left .menu-content .preview a:hover{color:#fff;width:100%;height:100%}.menu-left .menu-content ul li a img{margin-right:10px;width:20px;text-align:center}.menu-left .menu-content ul li a:hover img{filter:brightness(200%)}.menu-left .menu-content .preview a img{margin-top:-4px;margin-right:5px;width:20px;text-align:center}.menu-left .menu-content .preview a:hover img{filter:brightness(200%)}.mobile-menu-btn{position:fixed;right:10px;bottom:10px;z-index:9999;height:50px;width:50px;color:#fff;background:#2a3042;line-height:50px;text-align:center;font-size:25px;cursor:pointer;border-radius:50%;display:none}@media(max-width: 575px){.mobile-menu-btn.active{color:#2a3042;background:#fff}}@media(max-width: 1199px){.mobile-menu-btn{display:block}}@media(max-width: 767px){.pull-right-above-sm .btn{margin-top:10px;margin-bottom:10px;margin-left:0}}@media(min-width: 768px){.pull-right-above-sm{text-align:right;float:right}}@media(max-width: 767px){.pull-right-above-sm #g-columns-list{rigth:auto;left:14px}}@media(max-width: 767px){.text-centred-xs{text-align:center !important}}.table-responsive input{min-width:150px}.table-responsive select{min-width:130px}@media(max-width: 768px){.resp-tabs-container h2.resp-accordion .fa{margin-right:10px}}@media(max-width: 1199px){body.sb-top .navbar-branding{display:block;width:100px}body.sb-top .navbar-branding.with-menu{display:none}}@media(min-width: 1200px){body.sb-top .navbar-branding{display:none}}@media(max-width: 400px){body.sb-top .navbar-branding{display:none}}.pagination{margin-bottom:0}.pagination li.disabled{opacity:.5;pointer-events:none}.site-content #content_wrapper{margin-left:0}.menu_sortable .content.ui-sortable-handle{position:relative;display:-webkit-box;max-height:55px;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:1}#article-list .content.ui-sortable-handle{position:relative;display:-webkit-box;max-height:55px;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:1;-webkit-box-orient:vertical}.g-container{position:relative;overflow:hidden;width:100%}@media(max-width: 768px){.resp-vtabs>.resp-tabs-container{padding:0}}@media(max-width: 576px){.panel-body{padding:15px 5px}}@media(max-width: 768px){#g-results{margin-top:30px}}.panel-info.panel-border{border-color:#8691b2}.sortable li.sort-expanded>div>.disclose>span:before{color:#8691b2;border:1px solid #8691b2;background:rgba(134,145,178,.1);transition:.3s all ease}.sortable li.sort-collapsed>div>.disclose:hover>span:before,.sortable li.sort-expanded>div>.disclose:hover>span:before{background:#8691b2;color:#fff}.btn-success,.btn-system,.btn-danger,.btn-info{color:#fff;padding:.47rem .75rem;font-size:13px;line-height:1.5;font-weight:300;border-radius:.25rem;transition:.15s all ease}.btn-danger#g-columns-list-close,.btn-dark#g-select-columns{padding:9px 12px}.btn .fa{width:14px;height:14px}.btn-dark{border-radius:.25rem}.btn-success{color:#fff;background-color:#1cbb8c}.btn-success:hover,.btn-success:focus,.btn-success:active{background-color:#179a73}.btn-system{background-color:#fcb92c}.btn-system:hover,.btn-system:focus,.btn-system:active{background-color:#fbac06}.btn-danger{background-color:#ff3d60}.btn-danger:hover,.btn-danger:focus,.btn-danger:active{background-color:#ff1741}.btn-info{background-color:#5664d2}.btn-info:hover,.btn-info:focus,.btn-info:active{background-color:#3848ca}.panel-info>.panel-heading>.panel-title{font-size:15px;font-weight:700;text-transform:uppercase;color:#2a3042}#main:before{background:#f3f4f7}a{color:#818eb8}a:hover,a:focus{color:#2a3042;text-decoration:none}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{background-color:#818eb8;border-color:#818eb8}#g-columns-list ul li{text-align:left}.navbar .nav>li.dropdown.open .dropdown-menu:after,.navbar .nav>li.dropdown .open .dropdown-menu:after{border-bottom-color:#2a3042}.navbar .nav>li.dropdown.open .dropdown-menu,.navbar .nav>li.dropdown .open .dropdown-menu{border-top-color:#2a3042}.panel.panel-border>.panel-heading{background-color:#fff}.panel.panel-border>.panel-heading .btn{height:30px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f6f7f9}div.switch.switch-primary input:checked+label{background-color:#8691b2}.cm-s-material{background-color:#2a3042 !important}.icheckbox_minimal-blue.ui-sortable-handle.hover{background:#fff;background:url(/libraries/grid/plugins/icheck/skins/minimal/blue.png) no-repeat;background-position:0 0 !important}.table-hover>tbody>tr>td,.table-hover>tbody>tr>th{transition:all .3s ease}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:rgba(134,145,178,.12) !important}.dropdown-context{border-top:3px solid #2a3042 !important}.dropdown-context:after,.dropdown-context-up:after{border-bottom:6px solid #2a3042 !important}.input-group-addon{color:#2a3042}.g-tip .fa:before{color:#2a3042}.table-responsive>.table>thead>tr>th,.table-responsive>.table>thead>tr>td{border:none;border-bottom:1px solid #eee}.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{border:none}.input-group-addon{background:rgba(134,145,178,.1)}.pagination>li>a{padding:0;width:30px;height:30px;display:flex;justify-content:center;align-items:center;border-radius:50%;margin-right:5px}.pagination>li:first-child>a{border-bottom-left-radius:50%;border-top-left-radius:50%}.pagination>li:last-child>a{border-bottom-right-radius:50%;border-top-right-radius:50%}.form-control{border-radius:.25rem}.input-group-addon:first-child{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.resp-tab-active{border:1px solid #8691b2 !important;border-top:2px solid #8691b2 !important}.resp-tabs-container h2.resp-accordion{background:rgba(134,145,178,.1) !important}.resp-tabs-container h2.resp-accordion.resp-tab-active{background:#8691b2 !important;color:#fff}h2.resp-tab-active span.resp-arrow{border-bottom:12px solid #fff}.resp-tabs-container{border:rgba(134,145,178,.1)}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:rgba(134,145,178,.1)}.alert{border-radius:.25rem}.panel{border-radius:.25rem}.panel-body{border-radius:.25rem}.tooltipster-base{background-color:#2a3042 !important}.tooltipster-punk{border-color:#8691b2 !important}.form-control:focus{border-color:#8691b2}@media(max-width: 576px){#content{padding:15px 0px 40px 0px}}/*# sourceMappingURL=custom.css.map */
\ No newline at end of file
diff --git a/admin/style-css/custom.css.map b/admin/style-css/custom.css.map
new file mode 100644
index 0000000..db43011
--- /dev/null
+++ b/admin/style-css/custom.css.map
@@ -0,0 +1 @@
+{"version":3,"sources":["custom.css","../css/custom.scss"],"names":[],"mappings":"AAAA,wCCCA,eACE,CAAA,qCAGF,SACE,CAAA,2BAGF,iBAEE,CAAA,SACA,CAAA,oBACA,CAAA,YAGF,QACE,CAAA,mEAGF,sBAIE,CAAA,aAGF,QACE,CAAA,SACA,CAAA,yBAGF,aACE,CAAA,WACA,CAAA,WACA,CAAA,gBACA,CAAA,QACA,CAAA,cACA,CAAA,+BACA,CAAA,qCAGF,wBACE,CAAA,6BAGF,aACE,CAAA,qBAGF,YACE,CAAA,mBACA,CAAA,8EACA,CAAA,+BACA,CAAA,2BACA,CAAA,oBACA,CAAA,WACA,CAAA,kBACA,CAAA,UACA,CAAA,qBACA,CAAA,iCAGF,iBACE,CAAA,UAGF,cACE,CAAA,UACA,CAAA,YACA,CAAA,iBACA,CAAA,+BAGF,YACE,CAAA,uCAGF,aACE,CAAA,UACA,CAAA,iBACA,CAAA,iBACA,CAAA,UACA,CAAA,sDAGF,oBACE,CAAA,uBACA,CAAA,cACA,CAAA,WACA,CAAA,WACA,CAAA,UACA,CAAA,gBACA,CAAA,kBACA,CAAA,+BACA,CAAA,aACA,CAAA,wBACA,CAAA,uBACA,CAAA,uHAGF,kBAEE,CAAA,UACA,CAAA,qDAGF,oBACE,CAAA,uBACA,CAAA,cACA,CAAA,WACA,CAAA,WACA,CAAA,UACA,CAAA,gBACA,CAAA,kBACA,CAAA,eACA,CAAA,aACA,CAAA,wBACA,CAAA,aAGF,0BACE,CAAA,YAGF,kBACE,CAAA,0BACA,CAAA,0BAGF,cACE,CAAA,YACA,CAAA,oCAGF,aACE,CAAA,yBAGF,kBACE,CAAA,mBAGF,UACE,CAAA,aACA,CAAA,UACA,CAAA,kBAGF,iBACE,CAAA,0CAGF,8BACE,gBACE,CAAA,CAAA,oCAIJ,SACE,CAAA,QACA,CAAA,yBAGF,oCACE,wBACE,CAAA,CAAA,oCAIJ,2BAEE,CAAA,kCAGF,eACE,CAAA,kBACA,CAAA,+BAEA,CAAA,qCAGF,wBACE,CAAA,yBACA,CAAA,WACA,CAAA,yCAGF,UACE,CAAA,UACA,CAAA,aACA,CAAA,mCAGF,iBACE,CAAA,QACA,CAAA,8BAGF,iBACE,CAAA,2BAGF,4BACE,CAAA,SAGF,cACE,CAAA,KACA,CAAA,MACA,CAAA,UACA,CAAA,WACA,CAAA,YACA,CAAA,yBACA,CAAA,YACA,CAAA,cACA,CAAA,aAGF,UACE,CAAA,oBACA,CAAA,WACA,CAAA,gBACA,CAAA,gBACA,CAAA,iCAGF,UAEE,CAAA,sEAGF,iCAIE,CAAA,aAGF,QACE,CAAA,aACA,CAAA,gBAGF,eACE,CAAA,iBACA,CAAA,aACA,CAAA,YACA,CAAA,uBACA,CAAA,qBACA,CAAA,UACA,CAAA,sBACA,CAAA,iBACA,CAAA,gCAKA,uCACA,CAAA,+BAGF,WACE,CAAA,UACA,CAAA,mBACA,CADA,gBACA,CAAA,2BAGF,WACE,CAAA,WACA,CAAA,cACA,CAAA,sCAGF,QACE,CAAA,YACA,CAAA,iBACA,CAAA,KACA,CAAA,OACA,CAAA,wCAGF,cACE,CAAA,2BAGF,iBACE,CAAA,WACA,CAAA,QACA,CAAA,yBACA,CAAA,iBACA,CAAA,UACA,CAAA,6CAGF,UACE,CAJA,iDAGF,UACE,CAJA,wCAGF,UACE,CAAA,sFAGF,aAEE,CAAA,oBAGF,+BACE,CAAA,iBACA,CAAA,WACA,CAAA,WACA,CAAA,cACA,CAAA,iBACA,CAAA,YACA,CAAA,sBAGF,cACE,CAAA,UACA,CAAA,wBAGF,WACE,CAAA,iBACA,CAAA,QACA,CAAA,YAGF,oBACE,CAAA,QACA,CAAA,SACA,CAAA,eAGF,UACE,CAAA,cACA,CAAA,oCAGF,4BACE,CAAA,YAGF,iCACE,CAAA,UAGF,kBACE,CAAA,iBAGF,0BACE,CAAA,gIAGF,cAIE,CAAA,2BAGF,eACE,CAAA,UACA,CAAA,gDAIA,iBACA,CAAA,8JAGF,kBAKE,CAAA,wCAGF,qBACE,CAAA,sBACA,CAAA,UAGF,uBACE,CAAA,iBACA,CAAA,uCAGF,kBACE,CAAA,uBAGF,yBACE,CAAA,0BAGF,2BACE,CAAA,mBAGF,UACE,CAAA,qBAGF,qBACE,CAAA,4BACA,CAAA,+BAGF,UACE,CAAA,iCAGF,UACE,CAAA,cACA,CAAA,WACA,CAAA,gBACA,CAAA,cACA,CAAA,UACA,CAAA,UACA,CAAA,eAGF,iBACE,CAAA,QACA,CAAA,UACA,CAAA,WACA,CAAA,6BAGF,WACE,CAAA,OAGF,+BACE,CAAA,eACA,CAAA,WACA,CAAA,aAGF,qBACE,CAAA,0BACA,CAAA,WAGF,WACE,CAAA,gBACA,CAAA,UACA,CAAA,YAGF,uBACE,CAAA,UAGF,cACE,CAAA,oBAGF,qBACE,CAAA,YACA,CAAA,kBAGF,eACE,CAAA,gBAGF,YACE,CAAA,cAGF,aACE,CAAA,4BACA,CAAA,cACA,CAAA,cACA,CAAA,kBACA,CAAA,WACA,CAAA,aACA,CAAA,eACA,CAAA,sBACA,CAAA,kBACA,CAAA,YAGF,aACE,CAAA,4BACA,CAAA,cACA,CAAA,gBACA,CAAA,WACA,CAAA,aACA,CAAA,eACA,CAAA,sBACA,CAAA,kBACA,CAAA,oBAGF,aACE,CAAA,4BACA,CAAA,cACA,CAAA,kBACA,CAAA,WACA,CAAA,aACA,CAAA,sBAGF,kBACE,CAAA,8BAGF,mBACE,CAAA,UACA,CAAA,6CAGF,UACE,CAAA,yEAGF,cACE,CAAA,wDAGF,UACE,CAAA,oQAGF,eAKE,CAAA,aACA,CAAA,0TAGF,aAKE,CAAA,oBAGF,eACE,CAEA,sCACA,CAAA,yBAGF,aACE,CAAA,+BACA,CAAA,iQAGF,SAIE,CAAA,MACA,CAAA,8DAGF,aAEE,CAAA,0EAGF,kBAEE,CAAA,8CAGF,gBACE,CAAA,cAGF,iBACE,CAAA,OACA,CAAA,UACA,CAAA,WACA,CAAA,WACA,CAAA,eACA,CAAA,WACA,CAAA,iBACA,CAAA,UAGF,WACE,CAAA,WACA,CAAA,2BACA,CAAA,iBACA,CAAA,OACA,CAAA,qBACA,CAAA,SAGF,iBACE,CAAA,MACA,CAAA,cAGF,oBACE,CAAA,YAGF,iBACE,CAAA,2BAGF,kBACE,CAAA,UAGF,yBACE,CAAA,UAGF,+BACE,CAAA,UACA,CAAA,WACA,CAAA,OACA,CAAA,iBACA,CAAA,MAGF,oBACE,CAAA,gBACA,CAAA,gBACA,CAAA,iBACA,CAAA,WACA,CAAA,UACA,CAAA,iBACA,CAAA,aAGF,cACE,CAAA,iBACA,CAAA,aACA,CAAA,SACA,CAAA,WACA,CAAA,UACA,CAAA,gBACA,CAAA,8BAGF,gBACE,CAAA,2EAGF,UAEE,CAAA,UACA,CAAA,gBACA,CAAA,2CAGF,gBACE,CAAA,6BAGF,UAEE,CAAA,SACA,CAAA,0BACA,CAAA,OAGF,KACE,CAAA,WACA,CAAA,sBAIF,gBACE,CAAA,gBAGF,YACE,CAAA,+BAGF,0CACE,CAAA,+BAGF,6BACE,CAAA,UACA,CAAA,wBACA,CAAA,mCACA,CAAA,iCAGF,mBACE,CAAA,wCACA,CAAA,0BAGF,8BACE,gBACE,CAAA,CAAA,yBAIJ,+BACE,UACE,CAAA,CAAA,cAMJ,eACE,CAAA,0BAGF,cACE,iBACE,CAAA,wBACA,CAAA,CAAA,gDAIJ,wBACE,wBACE,CAAA,iBACA,CAAA,CAAA,+CAIJ,wBACE,wBACE,CAAA,iBACA,CAAA,CAAA,+CAIJ,wBACE,wBACE,CAAA,iBACA,CAAA,CAAA,yBAIJ,wBACE,aACE,CAAA,UACA,CAAA,cAGF,aACE,CAAA,UACA,CAAA,CAAA,WAIJ,cACE,CAAA,MACA,CAAA,KACA,CAAA,WAEA,CAAA,wBACA,CAAA,YACA,CAAA,WACA,CAAA,cACA,CAAA,eACA,CAAA,oBACA,CAAA,uBACA,CAAA,iBACA,CAAA,iBACA,CAAA,oBACA,CAAA,uBAEA,CAAA,iBAEA,CAAA,iBACA,CAAA,YACA,CAAA,0BAGF,WACE,aACE,CAAA,CAAA,yBAIJ,WACE,WACE,CAAA,CAAA,mBAIJ,aACE,CAAA,8BAGF,YACE,CAAA,OAEA,CAAA,QACA,CAAA,mBAGF,oBACE,CAAA,MAGF,UACE,CAAA,UACA,CAAA,wBACA,CAAA,iBACA,CAAA,cACA,CAAA,cACA,CAAA,eACA,CAAA,uBACA,CAAA,eACA,CAAA,KACA,CAAA,YACA,CAAA,8BAGF,UACE,CAAA,UACA,CAAA,iBAEA,CAAA,cACA,CAAA,cACA,CAAA,eACA,CAAA,iCAGF,cACE,CAAA,aACA,CAAA,gCAGF,aACE,CAAA,cACA,CAAA,eACA,CAAA,gBACA,CAAA,gBACA,CAAA,eACA,CAAA,oBACA,CAAA,kBACA,CAAA,uBACA,CAAA,eACA,CAAA,sCAGF,oBACE,CAAA,kBACA,CAAA,UACA,CAAA,gCAGF,wBACE,CAAA,aACA,CAAA,cACA,CAAA,eACA,CAAA,kBACA,CAAA,iCAGF,aACE,CAAA,cACA,CAAA,eACA,CAAA,gBACA,CAAA,aACA,CAAA,aACA,CAAA,uCAGF,UACE,CAAA,oBACA,CAAA,uCAGF,oBACE,CAAA,4BAGF,oBACE,CAAA,uBACA,CADA,sBACA,CAAA,kCAGF,UACE,CAAA,kBACA,CAAA,iBACA,CAAA,uBACA,CAAA,eACA,CAAA,QACA,CAAA,YACA,CAAA,oCAGF,wBACE,CAAA,cACA,CAAA,aACA,CAAA,cACA,CAAA,eACA,CAAA,kBACA,CAAA,oBACA,CAAA,eACA,CAAA,0CAGF,UACE,CAAA,UACA,CAAA,WACA,CAAA,qCAGF,iBACE,CAAA,UACA,CAAA,iBACA,CAAA,2CAGF,uBACE,CAAA,wCAGF,eACE,CAAA,gBACA,CAAA,UACA,CAAA,iBACA,CAAA,8CAGF,uBACE,CAAA,iBAGF,cACE,CAAA,UACA,CAAA,WACA,CAAA,YACA,CAAA,WACA,CAAA,UACA,CAAA,UACA,CAAA,kBACA,CAAA,gBACA,CAAA,iBACA,CAAA,cACA,CAAA,cACA,CAAA,iBACA,CAAA,YACA,CAAA,yBAGF,wBACE,aACE,CAAA,eACA,CAAA,CAAA,0BAMJ,iBACE,aACE,CAAA,CAAA,yBAIJ,0BACE,eACE,CAAA,kBACA,CAAA,aACA,CAAA,CAAA,yBAIJ,qBACE,gBACE,CAAA,WACA,CAAA,CAAA,yBAIJ,qCACE,UACE,CAAA,SACA,CAAA,CAAA,yBAIJ,iBACE,4BACE,CAAA,CAAA,wBAIJ,eACE,CAAA,yBAGF,eACE,CAAA,yBAGF,2CACE,iBACE,CAAA,CAAA,0BAIJ,6BACE,aACE,CAAA,WACA,CAAA,uCAGF,YACE,CAAA,CAAA,0BAIJ,6BACE,YACE,CAAA,CAAA,yBAIJ,6BACE,YACE,CAAA,CAAA,YAIJ,eACE,CAAA,wBAGF,UACE,CAAA,mBACA,CAAA,+BAGF,aACE,CAAA,2CAGF,iBACE,CAAA,mBACA,CAAA,eACA,CAAA,eACA,CAAA,sBACA,CAAA,oBACA,CAAA,0CAGF,iBACE,CAAA,mBACA,CAAA,eACA,CAAA,eACA,CAAA,sBACA,CAAA,oBACA,CAAA,2BACA,CAAA,aAGF,iBACE,CAAA,eACA,CAAA,UACA,CAAA,yBAGF,iCACE,SACE,CAAA,CAAA,yBAIJ,YACE,gBACE,CAAA,CAAA,yBAIJ,WACE,eACE,CAAA,CAAA,yBAKJ,oBACE,CAAA,qDAGF,aACE,CAAA,wBACA,CAAA,+BACA,CAAA,uBACA,CAAA,uHAGF,kBAEE,CAAA,UACA,CAAA,+CAGF,UAIE,CAAA,qBACA,CAAA,cACA,CAAA,eACA,CAAA,eACA,CAAA,oBACA,CAAA,wBAEA,CAAA,4DAGF,gBAEE,CAAA,SAGF,UACE,CAAA,WACA,CAAA,UAGF,oBACE,CAAA,aAGF,UACE,CAAA,wBACA,CAAA,0DAGF,wBAGE,CAAA,YAGF,wBACE,CAAA,uDAGF,wBAGE,CAAA,YAGF,wBACE,CAAA,uDAGF,wBAGE,CAAA,UAGF,wBACE,CAAA,iDAGF,wBAGE,CAAA,wCAGF,cACE,CAAA,eACA,CAAA,wBACA,CAAA,aACA,CAAA,aAGF,kBACE,CAAA,EAGF,aACE,CAAA,gBAGF,aAEE,CAAA,oBACA,CAAA,qKAGF,wBAME,CAAA,oBACA,CAAA,sBAGF,eACE,CAAA,uGAGF,2BAEE,CAAA,2FAGF,wBAEE,CAAA,mCAGF,qBACE,CAAA,wCAEA,WACE,CAAA,oFAIJ,wBAEE,CAAA,8CAGF,wBACE,CAAA,eAGF,mCACE,CAAA,iDAGF,eACE,CAAA,+EACA,CAAA,kCAEA,CAAA,kDAGF,uBAEE,CAAA,8DAGF,iDAEE,CAAA,kBAGF,uCACE,CAAA,mDAGF,0CAEE,CAAA,mBAGF,aACE,CAAA,kBAGF,aACE,CAAA,0EAGF,WAEE,CAAA,4BACA,CAAA,oJAGF,WAIE,CAAA,mBAGF,+BACE,CAAA,iBAMF,SACE,CAAA,UACA,CAAA,WACA,CAAA,YACA,CAAA,sBACA,CAAA,kBACA,CAAA,iBACA,CAAA,gBACA,CAAA,6BAGF,6BACE,CAAA,0BACA,CAAA,4BAGF,8BACE,CAAA,2BACA,CAAA,cAGF,oBACE,CAAA,+BAGF,6BACE,CAAA,gCACA,CAAA,iBAGF,mCACE,CAAA,uCAEA,CAAA,uCAGF,0CACE,CAAA,uDAGF,6BACE,CAAA,UACA,CAAA,mCAGF,6BACE,CAAA,qBAGF,2BACE,CAAA,iFAGF,qCAGE,CAAA,OAGF,oBACE,CAAA,OAGF,oBACE,CAAA,YAGF,oBACE,CAAA,kBAGF,mCACE,CAAA,kBAGF,+BACE,CAAA,oBAGF,oBACE,CAAA,yBAGF,SACE,yBACE,CAAA","file":"custom.css"}
\ No newline at end of file
diff --git a/admin/templates/articles/article-edit.php b/admin/templates/articles/article-edit.php
new file mode 100644
index 0000000..6666668
--- /dev/null
+++ b/admin/templates/articles/article-edit.php
@@ -0,0 +1,1123 @@
+
+
+
+
+global $db, $settings;
+
+ob_start();
+?>
+
+
+ Treść
+ Ustawienia
+ if ( $settings['tags'] ):?>
+ Tagi
+ endif;?>
+ SEO
+ Wyświetlanie
+ Galeria
+ Załączniki
+ if ( is_array( $this -> additional_params_lon ) and count( $this -> additional_params_lon ) or is_array( $this -> additional_params_loff ) and count( $this -> additional_params_loff ) ):?>
+
+ Dodatkowe parametry
+
+ endif;?>
+
+ Inne
+
+
+
+
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+ if ( $lg['id'] == \front\factory\Languages::default_language() ) echo ' ';?>= $lg['name'];?>
+ endif;?>
+ endforeach; endif;?>
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+
+ $languages = array();
+
+ $languages[''] = '---- wersja językowa ----';
+ if ( is_array( $this -> languages ) ) foreach ( $this -> languages as $lg_tmp )
+ {
+ if ( $lg_tmp['id'] != $lg['id'] )
+ $languages[ $lg_tmp['id'] ] = $lg_tmp['name'];
+ }
+ ?>
+ if ( $lg['status'] ):?>
+
+ = \Html::select(
+ array(
+ 'label' => 'Wyświetlaj treść z wersji',
+ 'name' => 'copy_from',
+ 'values' => $languages,
+ 'value' => $this -> article['languages'][ $lg['id'] ]['copy_from'],
+ )
+ );?>
+ = \Html::input(
+ array(
+ 'label' => 'Tytuł',
+ 'name' => 'title',
+ 'id' => 'title_' . $lg['id'],
+ 'value' => $this -> article['languages'][ $lg['id'] ]['title'],
+ 'inline' => true,
+ 'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
+ )
+ );?>
+ = \Html::input_icon( [
+ 'label' => 'Zdjęcie tytułowe',
+ 'name' => 'main_image',
+ 'id' => 'main_image_' . $lg['id'],
+ 'value' => $this -> article['languages'][ $lg['id'] ]['main_image'],
+ 'icon_content' => 'przeglądaj',
+ 'inline' => true,
+ 'icon_js' => "window.open ( '/libraries/filemanager-9.14.1/dialog.php?type=1&popup=1&field_id=main_image_" . $lg['id'] . "&akey=c3cb2537d25c0efc9e573d059d79c3b8', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
+ ] );
+ ?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Wstęp',
+ 'name' => 'entry',
+ 'id' => 'entry_' . $lg['id'],
+ 'value' => $this -> article['languages'][ $lg['id'] ]['entry'],
+ 'inline' => true
+ )
+ );?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Treść',
+ 'name' => 'text',
+ 'id' => 'text_' . $lg['id'],
+ 'value' => $this -> article['languages'][ $lg['id'] ]['text'],
+ 'inline' => true
+ )
+ );?>
+ = \Html::textarea( [
+ 'label' => 'Spis treści',
+ 'name' => 'table_of_contents',
+ 'id' => 'table_of_contents_' . $lg['id'],
+ 'value' => $this -> article['languages'][ $lg['id'] ]['table_of_contents'],
+ 'inline' => true
+ ] );?>
+
+
+ endif;?>
+ endforeach; endif;?>
+
+
+
+
+
+ if ( is_array( $this -> authors ) ): foreach ( $this -> authors as $author ): $authors[ $author['id'] ] = $author['author']; endforeach; endif;?>
+ = \Html::select( [
+ 'label' => 'Autor',
+ 'name' => "id_author",
+ 'id' => 'id_author',
+ 'values' => array_merge( [ '0' => '--- wybierz autora ---' ], $authors ),
+ 'value' => $this -> article['id_author']
+ ] );?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Opublikowany',
+ 'name' => 'status',
+ 'checked' => $this -> article['status'] == 1 or !$this -> article['id'] ? true : false
+ )
+ );?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Artykuł priorytetowy',
+ 'name' => 'priority',
+ 'checked' => $this -> article['priority'] == 1 ? true : false
+ )
+ );?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Pokaż tytuł',
+ 'name' => 'show_title',
+ 'checked' => $this -> article['show_title'] == 1 ? true : false
+ )
+ );?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Pokaż datę dodania',
+ 'name' => 'show_date_add',
+ 'checked' => $this -> article['show_date_add'] == 1 ? true : false
+ )
+ );?>
+ = \Html::input( [
+ 'label' => 'Data dodania',
+ 'class' => 'date-time',
+ 'name' => 'date_add',
+ 'id' => 'date_add',
+ 'value' => $this -> article['date_add']
+ ] );?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Pokaż datę modyfikacji',
+ 'name' => 'show_date_modify',
+ 'checked' => $this -> article['show_date_modify'] == 1 ? true : false
+ )
+ );?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Powtórz wprowadzenie',
+ 'name' => 'repeat_entry',
+ 'checked' => $this -> article['repeat_entry'] == 1 ? true : false
+ )
+ );?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Linki do portali społecznościowych',
+ 'name' => 'social_icons',
+ 'checked' => $this -> article['social_icons'] == 1 ? true : false
+ )
+ ); ?>
+ = \Html::input(
+ array(
+ 'label' => 'Zabezpiecz hasłem',
+ 'name' => 'password',
+ 'id' => 'password',
+ 'value' => $this -> article['password']
+ )
+ );?>
+ = \Html::select( [
+ 'label' => 'Moduł Pixieset',
+ 'name' => "pixieset",
+ 'id' => 'pixieset',
+ 'values' => [ 0 => 'wyłączony', 1 => 'pobieranie', 2 => 'pobieranie i wybieranie' ],
+ 'value' => $this -> article['pixieset']
+ ] );?>
+ if ( $settings['calendar'] ):?>
+ = \Html::input_icon(
+ array(
+ 'label' => 'Data wydarzenia',
+ 'class' => 'date-range',
+ 'name' => 'event_date',
+ 'id' => 'event_date',
+ 'value' => ( $this -> article['date_start' ] and $this -> article['date_end'] ) ? $this -> article['date_start'] . ' - ' . $this -> article['date_end'] : '',
+ 'icon_class' => 'date-range-icon',
+ 'icon_content' => ' '
+ )
+ );?>
+ endif;?>
+
+ if ( $settings['tags'] ):?>
+
+ endif;?>
+
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+ if ( $lg['id'] == \front\factory\Languages::default_language() ) echo ' ';?>= $lg['name'];?>
+ endif;?>
+ endforeach; endif;?>
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+
+ = \Html::input_icon(
+ array(
+ 'label' => 'Link SEO',
+ 'name' => 'seo_link',
+ 'id' => 'seo_link_' . $lg['id'],
+ 'value' => $this -> article['languages' ][ $lg['id'] ]['seo_link'],
+ 'icon_content' => 'generuj',
+ 'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#title_' . $lg['id'] . '" ).val(), ' . (int)$this -> article['id'] . ' );',
+ 'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
+ )
+ );?>
+ = \Html::input(
+ array(
+ 'label' => 'Meta title',
+ 'name' => 'meta_title',
+ 'id' => 'meta_title_' . $lg['id'],
+ 'value' => $this -> article['languages'][ $lg['id'] ]['meta_title'],
+ 'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
+ )
+ );?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Meta description',
+ 'name' => 'meta_description',
+ 'id' => 'meta_description_' . $lg['id'],
+ 'value' => $this -> article['languages'][ $lg['id'] ]['meta_description'],
+ 'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
+ )
+ );?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Meta keywords',
+ 'name' => 'meta_keywords',
+ 'id' => 'meta_keywords_' . $lg['id'],
+ 'value' => $this -> article['languages'][ $lg['id'] ]['meta_keywords']
+ )
+ );?>
+
+ = \Html::select(
+ array(
+ 'label' => 'Blokuj indeksację',
+ 'name' => "noindex",
+ 'id' => 'noindex_' . $lg['id'],
+ 'values' => array(
+ 0 => 'nie', 1 => 'tak'
+ ),
+ 'value' => $this -> article['languages'][ $lg['id'] ]['noindex'] == 1 ? 1 : 0
+ )
+ );?>
+ = \Html::select(
+ array(
+ 'label' => 'Blokuj bezpośredni dostęp',
+ 'name' => "block_direct_access",
+ 'id' => 'block_direct_access_' . $lg['id'],
+ 'values' => array(
+ 0 => 'nie', 1 => 'tak'
+ ),
+ 'value' => $this -> article['languages'][ $lg['id'] ]['block_direct_access'] == 1 ? 1 : 0
+ )
+ );?>
+
+ endif;?>
+ endforeach; endif;?>
+
+
+
+
+
+
+ $layouts[''] = '---- szablon domyślny ----';
+ if ( is_array( $this -> layouts ) ): foreach ( $this -> layouts as $layout ):
+ $layouts[ $layout['id'] ] = $layout['name'];
+ endforeach; endif;
+ ?>
+ = \Html::select(
+ array(
+ 'label' => 'Szablon',
+ 'name' => 'layout_id',
+ 'id' => 'layout_id',
+ 'values' => $layouts,
+ 'value' => $this -> article['layout_id']
+ )
+ );?>
+
+
+
+
+
You browser doesn't have Flash installed.
+
+
+
+
+ $files_count = 0;
+ if ( is_array( $this -> article['files'] ) ): foreach ( $this -> article['files'] as $file ):
+
+ if ( $file['name'] )
+ $name = $file['name'];
+ else
+ {
+ $name = explode( '/', $file['src'] );
+ $name = $name[ count( $name ) - 1 ];
+ }
+ ?>
+
+
+
+
+ $files_count++;
+ endforeach; endif;
+ ?>
+
+
You browser doesn't have Flash installed.
+
+ if ( is_array( $this -> additional_params_lon ) and count( $this -> additional_params_lon ) or is_array( $this -> additional_params_loff ) and count( $this -> additional_params_loff ) ):?>
+
+
+ if ( is_array( $this -> article['params'] ) ) foreach ( $this -> article['params'] as $param )
+ $params[ $param['param_id'] . '_' . $param['language_id'] ] = $param['value'];
+ ?>
+ if ( is_array( $this -> additional_params_loff ) and count( $this -> additional_params_loff ) ):?>
+ foreach ( $this -> additional_params_loff as $param ):?>
+ if ( $param['type'] == 'input-date' ):?>
+ = \Html::input(
+ array(
+ 'label' => $param['display_name'],
+ 'class' => 'date',
+ 'name' => 'ap_' . $param['name'],
+ 'id' => 'ap_' . $param['name'],
+ 'value' => $params[ $param['id'] . '_' ]
+ )
+ );?>
+ endif;?>
+ if ( $param['type'] == 'switch' ):?>
+ = \Html::input_switch(
+ array(
+ 'label' => $param['display_name'],
+ 'name' => 'ap_' . $param['name'],
+ 'id' => 'ap_' . $param['name'],
+ 'checked' => $params[ $param['id'] . '_' ] == 'on' ? true : false
+ )
+ );?>
+ endif;?>
+ if ( $param['type'] == 'input-text' ):?>
+ = \Html::input(
+ array(
+ 'label' => $param['display_name'],
+ 'name' => 'ap_' . $param['name'],
+ 'id' => 'ap_' . $param['name'],
+ 'value' => $params[ $param['id'] . '_' ]
+ )
+ );?>
+ endif;?>
+ if ( $param['type'] == 'ckeditor' ):?>
+ = \Html::textarea(
+ array(
+ 'label' => $param['display_name'],
+ 'name' => 'ap_' . $param['name'],
+ 'id' => 'ap_' . $param['name'],
+ 'value' => $params[ $param['id'] . '_' ],
+ 'inline' => true
+ )
+ );?>
+
+ endif;?>
+ endforeach;?>
+ endif;?>
+ if ( is_array( $this -> additional_params_lon ) and count( $this -> additional_params_lon ) ):?>
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+ if ( $lg['id'] == \front\factory\Languages::default_language() ) echo ' ';?>= $lg['name'];?>
+ endif;?>
+ endforeach; endif;?>
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+
+ foreach ( $this -> additional_params_lon as $param ):?>
+ if ( $param['type'] == 'input-text' ):?>
+ = \Html::input(
+ array(
+ 'label' => $param['display_name'],
+ 'name' => 'ap_' . $param['name'] . '_' . $lg['id'],
+ 'id' => 'ap_' . $param['name'] . '_' . $lg['id'],
+ 'value' => $params[ $param['id'] . '_' . $lg['id'] ]
+ )
+ );?>
+ endif;?>
+ if ( $param['type'] == 'ckeditor' ):?>
+ = \Html::textarea(
+ array(
+ 'label' => $param['display_name'],
+ 'name' => 'ap_' . $param['name'] . '_' . $lg['id'],
+ 'id' => 'ap_' . $param['name'] . '_' . $lg['id'],
+ 'value' => $params[ $param['id'] . '_' . $lg['id'] ],
+ 'inline' => true
+ )
+ );?>
+
+ endif;?>
+ endforeach;?>
+
+ endif;?>
+ endforeach; endif;?>
+
+
+ endif;?>
+
+ endif;?>
+
+
Zdjęcia wybrane przez użytkownika (wymagany włączony moduł Pixieset )
+ if ( is_array( $this -> article['images'] ) ):?>
+
+ foreach ( $this -> article['images'] as $image ):?>
+ if ( $image['favorite'] ):?>
+ = basename( $image['src'] );?>
+ endif;?>
+ endforeach;?>
+
+ endif;?>
+
+
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'article-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja artykułu';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> article['id']
+ ]
+ ];
+$grid -> actions = [
+ 'save' => [ 'url' => '/admin/articles/article_save/', 'back_url' => '/admin/articles/view_list/' ],
+ 'cancel' => [ 'url' => '/admin/articles/view_list/' ]
+ ];
+$grid -> external_code = $out;
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+
+echo $grid -> draw();
+?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/admin/templates/articles/articles-archive-list.php b/admin/templates/articles/articles-archive-list.php
new file mode 100644
index 0000000..2cd5df4
--- /dev/null
+++ b/admin/templates/articles/articles-archive-list.php
@@ -0,0 +1,67 @@
+ gdb_opt = $gdb;
+$grid -> sql = 'SELECT *'
+ . 'FROM ( '
+ . 'SELECT '
+ . 'id, date_add, date_modify, status, '
+ . '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
+ . 'FROM '
+ . 'pp_articles AS pa WHERE status = -1 '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] '
+ . 'ORDER BY '
+ . '[order_p1] [order_p2]';
+$grid -> sql_count = 'SELECT '
+ . 'COUNT(0) FROM ( '
+ . 'SELECT '
+ . 'id, date_add, date_modify, status, '
+ . '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
+ . 'FROM '
+ . 'pp_articles AS pa WHERE status = -1 '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] ';
+$grid -> debug = true;
+$grid -> order = [ 'column' => 'date_add', 'type' => 'DESC' ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Tytuł',
+ 'db' => 'id',
+ 'replace' => [ 'sql' => "SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = [id] AND title != '' ORDER BY o ASC LIMIT 1" ]
+ ],
+ [
+ 'name' => 'Data dodania',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
+ 'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_add]" ) );'
+ ],
+ [
+ 'name' => 'Data modyfikacji',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
+ 'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_modify]" ) );'
+ ],
+ [
+ 'name' => 'Akcja',
+ 'th' => [ 'class' => 'g-center' ],
+ 'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ],
+ 'content' => 'przywróć '
+ ],
+ [
+ 'name' => 'Akcja',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/articles_archive/article_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center' ],
+ 'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ]
+ ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/articles/articles-browse-list.php b/admin/templates/articles/articles-browse-list.php
new file mode 100644
index 0000000..706a7ed
--- /dev/null
+++ b/admin/templates/articles/articles-browse-list.php
@@ -0,0 +1,121 @@
+ gdb_opt = $gdb;
+$grid -> sql = 'SELECT *'
+ . 'FROM ( '
+ . 'SELECT '
+ . 'id, date_add, date_modify, status, '
+ . '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title, '
+ . '( SELECT login FROM pp_users AS pu WHERE pu.id = pa.modify_by ) AS user '
+ . 'FROM '
+ . 'pp_articles AS pa WHERE status != -1 '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] '
+ . 'ORDER BY '
+ . '[order_p1] [order_p2]';
+$grid -> sql_count = 'SELECT '
+ . 'COUNT(0) FROM ( '
+ . 'SELECT '
+ . 'id, date_add, date_modify, status, '
+ . '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title, '
+ . '( SELECT login FROM pp_users AS pu WHERE pu.id = pa.modify_by ) AS user '
+ . 'FROM '
+ . 'pp_articles AS pa WHERE status != -1 '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] ';
+$grid -> debug = true;
+$grid -> order = [ 'column' => 'date_add', 'type' => 'DESC' ];
+$grid -> search = [
+ [ 'name' => 'Tytuł', 'db' => 'title', 'type' => 'text' ],
+ [ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
+ [ 'name' => 'Data dodania', 'db' => 'date_add', 'type' => 'date_range' ],
+ [ 'name' => 'Data modyfikacji', 'db' => 'date_modify', 'type' => 'date_range' ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Tytuł',
+ 'db' => 'title',
+ 'sort' => true,
+ 'php' => 'echo "[title]"; echo "" . \admin\factory\Articles::article_pages( [id] ) . " ";'
+ ],
+ [
+ 'name' => 'Aktywny',
+ 'db' => 'status',
+ 'replace' => [ 'array' => [ 0 => 'nie ', 1 => 'tak' ] ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Data dodania',
+ 'db' => 'date_add',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
+ 'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_add]" ) );'
+ ],
+ [
+ 'name' => 'Data modyfikacji',
+ 'db' => 'date_modify',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
+ 'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_modify]" ) );'
+ ],
+ [
+ 'name' => 'Modyfikowany przez',
+ 'db' => 'user',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
+ ],
+ [
+ 'name' => 'Akcja',
+ 'db' => 'id',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
+ 'php' => 'echo "wybierz ";'
+ ]
+ ];
+echo $grid -> draw();
+?>
+
+
\ No newline at end of file
diff --git a/admin/templates/articles/articles-list.php b/admin/templates/articles/articles-list.php
new file mode 100644
index 0000000..0419a15
--- /dev/null
+++ b/admin/templates/articles/articles-list.php
@@ -0,0 +1,144 @@
+ gdb_opt = $gdb;
+$grid -> sql = 'SELECT *'
+ . 'FROM ( '
+ . 'SELECT '
+ . 'id, date_add, date_modify, status, '
+ . '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title, '
+ . '( SELECT login FROM pp_users AS pu WHERE pu.id = pa.modify_by ) AS user '
+ . 'FROM '
+ . 'pp_articles AS pa WHERE status != -1 '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] '
+ . 'ORDER BY '
+ . '[order_p1] [order_p2]';
+$grid -> sql_count = 'SELECT '
+ . 'COUNT(0) FROM ( '
+ . 'SELECT '
+ . 'id, date_add, date_modify, status, '
+ . '( SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = pa.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title, '
+ . '( SELECT login FROM pp_users AS pu WHERE pu.id = pa.modify_by ) AS user '
+ . 'FROM '
+ . 'pp_articles AS pa WHERE status != -1 '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] ';
+$grid -> debug = true;
+if ( !\S::get_session( 'gpp_articlesorder' ) )
+ $grid -> order = [ 'column' => 'date_add', 'type' => 'DESC' ];
+$grid -> search = [
+ [ 'name' => 'Tytuł', 'db' => 'title', 'type' => 'text' ],
+ [ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
+ [ 'name' => 'Data dodania', 'db' => 'date_add', 'type' => 'date_range' ],
+ [ 'name' => 'Data modyfikacji', 'db' => 'date_modify', 'type' => 'date_range' ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Tytuł',
+ 'db' => 'title',
+ 'sort' => true,
+ 'php' => 'echo "[title] "; echo "" . \admin\factory\Articles::article_pages( [id] ) . " ";'
+ ],
+ [
+ 'name' => 'Aktywny',
+ 'db' => 'status',
+ 'replace' => [ 'array' => [ 0 => 'nie ', 1 => 'tak' ] ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Data dodania',
+ 'db' => 'date_add',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
+ 'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_add]" ) );',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Data modyfikacji',
+ 'db' => 'date_modify',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
+ 'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_modify]" ) );',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Modyfikowany przez',
+ 'db' => 'user',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 220px;' ],
+ ], [
+ 'name' => 'Akcja',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
+ 'php' => 'echo "duplikuj ";'
+ ], [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/articles/article_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/articles/article_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj artykuł',
+ 'url' => '/admin/articles/article_edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/articles/subpages-list.php b/admin/templates/articles/subpages-list.php
new file mode 100644
index 0000000..a5e41c8
--- /dev/null
+++ b/admin/templates/articles/subpages-list.php
@@ -0,0 +1,16 @@
+ if ( is_array( $this -> pages ) ):?>
+
+ foreach ( $this -> pages as $page ):?>
+
+ >
+
+ article_pages ) and in_array( $page['id'], $this -> article_pages ) ):?>checked="checked" endif;?> />= $page['title'];?>
+
+
+ if ( is_array( $page['subpages'] ) )
+ echo \admin\view\Articles::subpages_list( $page['subpages'], $this -> article_pages, $page['id'], $this -> step + 1 );
+ ?>
+
+ endforeach;?>
+
+ endif;?>
\ No newline at end of file
diff --git a/admin/templates/authors/author-edit.php b/admin/templates/authors/author-edit.php
new file mode 100644
index 0000000..5485e72
--- /dev/null
+++ b/admin/templates/authors/author-edit.php
@@ -0,0 +1,112 @@
+
+
+
+\S::set_session( 'admin', true );
+global $db;
+ob_start();
+?>
+
+
+ Ustawienia
+ Zawartość
+
+
+
+ = \Html::input( [
+ 'label' => 'Autor',
+ 'name' => 'author',
+ 'id' => 'author',
+ 'value' => $this -> author['author'],
+ 'class' => 'require'
+ ] );?>
+ = \Html::input_icon( [
+ 'label' => 'Zdjęcie',
+ 'name' => 'image',
+ 'id' => 'image',
+ 'value' => $this -> author['image'],
+ 'icon_content' => 'przeglądaj',
+ 'icon_js' => "window.open ( '/libraries/filemanager-9.14.1/dialog.php?type=1&popup=1&field_id=image&akey=c3cb2537d25c0efc9e573d059d79c3b8', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
+ ] );?>
+
+
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+ = $lg['name'];?>
+ endif;?>
+ endforeach;
+ endif;?>
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+
+ = \Html::textarea( [
+ 'label' => 'Opis',
+ 'name' => 'description',
+ 'id' => 'description_' . $lg['id'],
+ 'value' => $this -> author['languages'][$lg['id']]['description']
+ ] );?>
+
+
+ endif;?>
+ endforeach; endif;?>
+
+
+
+
+
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'author-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja autora';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> author['id']
+ ]
+];
+$grid -> external_code = $out;
+$grid -> actions = [
+ 'save' => [ 'url' => '/admin/authors/save/', 'back_url' => '/admin/authors/view_list/' ],
+ 'cancel' => [ 'url' => '/admin/authors/view_list/' ]
+];
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+echo $grid -> draw();
+?>
+
+
\ No newline at end of file
diff --git a/admin/templates/authors/view-list.php b/admin/templates/authors/view-list.php
new file mode 100644
index 0000000..7a18417
--- /dev/null
+++ b/admin/templates/authors/view-list.php
@@ -0,0 +1,41 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'author', 'type' => 'ASC' ];
+$grid -> search = [
+ [ 'author' => 'Autor', 'db' => 'name', 'type' => 'text' ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ], [
+ 'name' => 'Autor',
+ 'db' => 'author',
+ 'sort' => true,
+ 'php' => 'echo "[author] ";'
+ ], [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/authors/edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ], [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/authors/delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj autora',
+ 'url' => '/admin/authors/edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/backups/backup-list.php b/admin/templates/backups/backup-list.php
new file mode 100644
index 0000000..d4f6252
--- /dev/null
+++ b/admin/templates/backups/backup-list.php
@@ -0,0 +1,65 @@
+ gdb_opt = $gdb;
+$grid -> src = $this -> backups;
+$grid -> debug = true;
+$grid -> order = [ 'column' => 'name', 'type' => 'DESC' ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Nazwa',
+ 'db' => 'name',
+ 'sort' => true,
+ 'php' => 'echo "[name] ";'
+ ],
+ [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/backups/backup_delete/name=[name]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Utwórz kopie zapasową',
+ 'url' => '#',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'confirm btn btn-success btn-sm mr5"'
+ ],
+ [
+ 'label' => 'Pobierz plik restore.php',
+ 'url' => '/admin/backups/download_restore_file/',
+ 'icon' => 'fa-download',
+ 'class' => 'btn btn-system btn-sm mr5"'
+ ]
+ ];
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/banners/banner-edit.php b/admin/templates/banners/banner-edit.php
new file mode 100644
index 0000000..1e179cb
--- /dev/null
+++ b/admin/templates/banners/banner-edit.php
@@ -0,0 +1,180 @@
+
+
+
+\S::set_session( 'admin', true );
+global $db;
+
+ob_start();
+?>
+
+
+
+ Ustawienia
+ Zawartość
+
+
+
+ = \Html::input(
+ array(
+ 'label' => 'Nazwa',
+ 'name' => 'name',
+ 'id' => 'name',
+ 'value' => $this -> banner['name'],
+ 'class' => 'require'
+ ) );
+ ?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Aktywny',
+ 'name' => 'status',
+ 'checked' => $this -> banner['status'] == 1 or ! $this -> banner['id'] ? true : false
+ )
+ );
+ ?>
+ = Html::input(
+ array(
+ 'label' => 'Data rozpoczęcia',
+ 'name' => 'date_start',
+ 'id' => 'date_start',
+ 'value' => $this -> banner['date_start'],
+ 'class' => 'date'
+ )
+ );
+ ?>
+ = \Html::input(
+ array(
+ 'label' => 'Data zakończenia',
+ 'name' => 'date_end',
+ 'id' => 'date_end',
+ 'value' => $this -> banner['date_end'],
+ 'class' => 'date'
+ ) );
+ ?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Slajder / Strona główna',
+ 'name' => 'home_page',
+ 'checked' => $this -> banner['home_page'] == 1 ? true : false
+ )
+ );
+ ?>
+
+
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+ = $lg['name'];?>
+ endif;?>
+ endforeach;
+ endif;?>
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+
+ = \Html::input_icon(
+ array(
+ 'label' => 'Obraz',
+ 'name' => 'src',
+ 'id' => 'src_' . $lg['id'],
+ 'value' => $this -> banner['languages'][ $lg['id'] ]['src'],
+ 'icon_content' => 'przeglądaj',
+ 'icon_js' => "window.open ( '/libraries/filemanager-9.14.1/dialog.php?type=1&popup=1&field_id=src_" . $lg['id'] . "&akey=c3cb2537d25c0efc9e573d059d79c3b8', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
+ )
+ );
+ ?>
+ = \Html::input(
+ array(
+ 'label' => 'Url',
+ 'name' => 'url',
+ 'id' => 'url_' . $lg['id'],
+ 'value' => $this -> banner['languages'][ $lg['id'] ]['url']
+ )
+ );
+ ?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Kod html',
+ 'name' => 'html',
+ 'id' => 'html_' . $lg['id'],
+ 'value' => $this -> banner['languages'][$lg['id']]['html']
+ )
+ );
+ ?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Treść',
+ 'name' => 'text',
+ 'id' => 'text_' . $lg['id'],
+ 'value' => $this -> banner['languages'][$lg['id']]['text']
+ )
+ );
+ ?>
+
+
+ endif;?>
+ endforeach; endif;?>
+
+
+
+
+
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'banner-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja baneru';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> banner['id']
+ ]
+];
+$grid -> external_code = $out;
+$grid -> actions = [
+ 'save' => [ 'url' => '/admin/banners/banner_save/', 'back_url' => '/admin/banners/view_list/' ],
+ 'cancel' => [ 'url' => '/admin/banners/view_list/' ]
+];
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+echo $grid -> draw();
+?>
+
+
\ No newline at end of file
diff --git a/admin/templates/banners/banners-list.php b/admin/templates/banners/banners-list.php
new file mode 100644
index 0000000..dcd7eea
--- /dev/null
+++ b/admin/templates/banners/banners-list.php
@@ -0,0 +1,78 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
+$grid -> search = [
+ [ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
+ [ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Nazwa',
+ 'db' => 'name',
+ 'sort' => true,
+ 'php' => 'echo "[name] ";'
+ ],
+ [
+ 'name' => 'Aktywny',
+ 'db' => 'status',
+ 'replace' => [ 'array' => [ 0 => 'nie ', 1 => 'tak' ] ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Strona główna',
+ 'db' => 'home_page',
+ 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak ' ] ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Slajder',
+ 'db' => 'home_page',
+ 'replace' => [ 'array' => [ 1 => 'nie', 0 => 'tak ' ] ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Data rozpoczęcia',
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'php' => 'if ( "[date_start]" ) echo date( "Y-m-d", strtotime( "[date_start]" ) ); else echo "-";'
+ ],
+ [
+ 'name' => 'Data zakończenia',
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'php' => 'if ( "[date_end]" ) echo date( "Y-m-d", strtotime( "[date_end]" ) ); else echo "-";'
+ ],
+ [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/banners/banner_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/banners/banner_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj baner',
+ 'url' => '/admin/banners/banner_edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/emails/email-details.php b/admin/templates/emails/email-details.php
new file mode 100644
index 0000000..b405705
--- /dev/null
+++ b/admin/templates/emails/email-details.php
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit();
+$grid -> id = 'email-details';
+$grid -> gdb_opt = $gdb;
+$grid -> title = 'Szczegóły Wiadomości';
+$grid -> external_code = $out;
+$grid -> actions = [
+ 'save' => [ '' => '/admin/emails/view_list/', 'back_url' => '/admin/emails/view_list/'],
+ 'cancel' => [ 'url' => '/admin/emails/view_list/' ]
+ ];
+$grid -> form = false;
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/emails/email_details.php b/admin/templates/emails/email_details.php
new file mode 100644
index 0000000..d86f785
--- /dev/null
+++ b/admin/templates/emails/email_details.php
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit();
+$grid -> id = 'email-detali';
+$grid -> gdb_opt = $gdb;
+$grid -> title = 'Szczegóły Wiadomości';
+$grid -> external_code = $out;
+$grid -> actions = [
+ 'save' => [ '' => '/admin/emails/view_list/', 'back_url' => '/admin/emails/view_list/'],
+ 'cancel' => [ 'url' => '/admin/emails/view_list/' ]
+ ];
+$grid -> form = false;
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/emails/emails-list.php b/admin/templates/emails/emails-list.php
new file mode 100644
index 0000000..b9a5bc6
--- /dev/null
+++ b/admin/templates/emails/emails-list.php
@@ -0,0 +1,41 @@
+ gdb_opt = $gdb;
+
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Data',
+ 'db' => 'add_date',
+ 'td' => [ ],
+ 'th' => ['style' => 'width: 220px;' ],
+ 'php' => 'echo date( "Y-m-d H:i", strtotime( "[add_date]" ) );',
+ 'sort' => true
+
+ ],
+ [
+ 'name' => 'Email',
+ 'db' => 'email',
+ 'content' => '[email] ',
+ 'sort' => true ,
+ ],
+ [
+ 'name' => 'Temat',
+ 'db' => 'title',
+ ],
+ [
+ 'name' => 'Szczegóły',
+ 'content' => 'Szczegóły ',
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/filemanager/filemanager.php b/admin/templates/filemanager/filemanager.php
new file mode 100644
index 0000000..ba4e016
--- /dev/null
+++ b/admin/templates/filemanager/filemanager.php
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/templates/html/button.php b/admin/templates/html/button.php
new file mode 100644
index 0000000..4bf0f01
--- /dev/null
+++ b/admin/templates/html/button.php
@@ -0,0 +1,25 @@
+
+$out = ' params['class'] . '" ';
+
+ if ( $this -> params['style'] )
+ $out .= 'style="' . $this -> params['style'] . '" ';
+
+ if ( $this -> params['js'] )
+ $out .= 'onclick="' . htmlspecialchars( $this -> params['js'] ) . '" ';
+
+ if ( $this -> params['url'] )
+ $out .= 'href="' . htmlspecialchars( $this -> params['url'] ) . '" ';
+
+ if ( $this -> params['id'] )
+ $out .= 'id="' . $this -> params['id'] . '" ';
+
+ if ( $this -> params['title'] )
+ $out .= 'title="' . htmlspecialchars( $this -> params['title'] ) . '" ';
+$out .= '>';
+ if ( $this -> params['icon'] )
+ $out .= ' ';
+ $out .= $this -> params['text'];
+$out .= ' ';
+
+echo $out;
\ No newline at end of file
diff --git a/admin/templates/html/form-text.php b/admin/templates/html/form-text.php
new file mode 100644
index 0000000..b950f79
--- /dev/null
+++ b/admin/templates/html/form-text.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/admin/templates/html/input-icon.php b/admin/templates/html/input-icon.php
new file mode 100644
index 0000000..3d642c4
--- /dev/null
+++ b/admin/templates/html/input-icon.php
@@ -0,0 +1,70 @@
+
+if ( $this -> params['label'] )
+{
+ $out .= '';
+}
+
+echo $out;
\ No newline at end of file
diff --git a/admin/templates/html/input-switch.php b/admin/templates/html/input-switch.php
new file mode 100644
index 0000000..79e4d01
--- /dev/null
+++ b/admin/templates/html/input-switch.php
@@ -0,0 +1,36 @@
+
+if ( $this -> params['label'] )
+{
+ $out .= '';
+}
+
+echo $out;
\ No newline at end of file
diff --git a/admin/templates/html/input.php b/admin/templates/html/input.php
new file mode 100644
index 0000000..8d92787
--- /dev/null
+++ b/admin/templates/html/input.php
@@ -0,0 +1,63 @@
+
+if ( $this -> params['label'] )
+{
+ $out .= '';
+}
+
+echo $out;
\ No newline at end of file
diff --git a/admin/templates/html/panel.php b/admin/templates/html/panel.php
new file mode 100644
index 0000000..3fe09ce
--- /dev/null
+++ b/admin/templates/html/panel.php
@@ -0,0 +1,8 @@
+
+
+ = $this -> params['title'];?>
+
+
+ = $this -> params['content'];?>
+
+
\ No newline at end of file
diff --git a/admin/templates/html/select.php b/admin/templates/html/select.php
new file mode 100644
index 0000000..c2fb33d
--- /dev/null
+++ b/admin/templates/html/select.php
@@ -0,0 +1,62 @@
+
+if ( $this -> params['label'] )
+{
+ $out .= '';
+}
+
+echo $out;
\ No newline at end of file
diff --git a/admin/templates/html/textarea.php b/admin/templates/html/textarea.php
new file mode 100644
index 0000000..13ccc1f
--- /dev/null
+++ b/admin/templates/html/textarea.php
@@ -0,0 +1,52 @@
+
+if ( $this -> params['label'] )
+{
+ $out .= '';
+}
+
+echo $out;
\ No newline at end of file
diff --git a/admin/templates/languages/language-edit.php b/admin/templates/languages/language-edit.php
new file mode 100644
index 0000000..3e17176
--- /dev/null
+++ b/admin/templates/languages/language-edit.php
@@ -0,0 +1,98 @@
+
+global $db;
+
+ob_start();
+ echo \Html::input(
+ array(
+ 'type' => 'hidden',
+ 'name' => 'o',
+ 'value' => $this -> language['o']
+ )
+ );
+ echo \Html::input(
+ array(
+ 'label' => 'Język',
+ 'type' => 'text',
+ 'class' => 'require',
+ 'name' => 'name',
+ 'value' => $this -> language['name']
+ )
+ );
+ if ( $this -> language['id'] )
+ {
+ echo \Html::input(
+ array(
+ 'type' => 'hidden',
+ 'name' => 'id',
+ 'value' => $this -> language['id']
+ )
+ );
+ }
+ else
+ {
+ echo \Html::input(
+ array(
+ 'label' => 'ID (2 znaki)',
+ 'class' => 'require',
+ 'type' => 'text',
+ 'name' => 'id'
+ )
+ );
+ }
+ echo \Html::input_switch(
+ array(
+ 'label' => 'Aktywny',
+ 'name' => 'status',
+ 'checked' => $this -> language['status'] == 1 ? true : false
+ )
+ );
+ echo \Html::input_switch(
+ array(
+ 'label' => 'Domyślny',
+ 'name' => 'start',
+ 'checked' => $this -> language['start'] == 1 ? true : false
+ )
+ );
+ echo ' ';
+ echo \Html::input(
+ array(
+ 'label' => 'Domena',
+ 'type' => 'text',
+ 'name' => 'domain',
+ 'value' => $this -> language['domain']
+ )
+ );
+ echo \Html::input_switch(
+ array(
+ 'label' => 'Domena domyślna',
+ 'name' => 'main_domain',
+ 'checked' => $this -> language['main_domain'] == 1 ? true : false
+ )
+ );
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'language-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja języka';
+$grid -> external_code = $out;
+$grid -> actions = [
+ 'save' => [ 'url' => '/admin/languages/language_save/', 'back_url' => '/admin/languages/view_list/' ],
+ 'cancel' => [ 'url' => '/admin/languages/view_list/' ]
+ ];
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/languages/languages-list.php b/admin/templates/languages/languages-list.php
new file mode 100644
index 0000000..7e121e1
--- /dev/null
+++ b/admin/templates/languages/languages-list.php
@@ -0,0 +1,72 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
+$grid -> search = [
+ [ 'name' => 'Język', 'db' => 'name', 'type' => 'text' ],
+ [ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
+ [ 'name' => 'Domyślny', 'db' => 'start', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Domyślny',
+ 'db' => 'start',
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'php' => 'if ( [start] ) echo "tak "; else echo "nie";'
+ ],
+ [
+ 'name' => 'Aktywny',
+ 'db' => 'status',
+ 'replace' => [ 'array' => [ 0 => 'nie ', 1 => 'tak' ] ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Język',
+ 'db' => 'name',
+ 'php' => 'echo "[name] ";',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Domena',
+ 'db' => 'domain',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Domena domyślna',
+ 'db' => 'main_domain',
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'php' => 'if ( [main_domain] ) echo "tak "; else echo "nie";'
+ ],
+ [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/languages/language_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/languages/language_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj język',
+ 'url' => '/admin/languages/language_edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/languages/translation-edit.php b/admin/templates/languages/translation-edit.php
new file mode 100644
index 0000000..64895ed
--- /dev/null
+++ b/admin/templates/languages/translation-edit.php
@@ -0,0 +1,60 @@
+
+global $db;
+
+ob_start();
+?>
+
+echo \Html::input(
+ array(
+ 'type' => 'text',
+ 'label' => 'Tekst',
+ 'name' => 'text',
+ 'class' => 'require',
+ 'value' => $this -> translation['text']
+ )
+);
+
+if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $language ):
+ echo \Html::input(
+ array(
+ 'type' => 'text',
+ 'label' => $language['name'],
+ 'name' => $language['id'],
+ 'value' => $this -> translation[$language['id']]
+ ) );
+ endforeach;
+endif;
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'translation-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja tłumaczenia';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> translation['id']
+ ]
+];
+$grid -> external_code = $out;
+$grid -> actions = [
+ 'save' => [ 'url' => '/admin/languages/translation_save/', 'back_url' => '/admin/languages/translation_list/' ],
+ 'cancel' => [ 'url' => '/admin/languages/translation_list/' ]
+];
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/languages/translations-list.php b/admin/templates/languages/translations-list.php
new file mode 100644
index 0000000..a7e2d6d
--- /dev/null
+++ b/admin/templates/languages/translations-list.php
@@ -0,0 +1,44 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'text', 'type' => 'ASC' ];
+$grid -> search = [
+ [ 'name' => 'Tekst', 'db' => 'text', 'type' => 'text' ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Tekst',
+ 'db' => 'text',
+ 'php' => 'echo "[text] ";',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/languages/translation_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/languages/translation_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj tłumaczenie',
+ 'url' => '/admin/languages/translation_edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/layouts/layout-edit.php b/admin/templates/layouts/layout-edit.php
new file mode 100644
index 0000000..b6b6d1e
--- /dev/null
+++ b/admin/templates/layouts/layout-edit.php
@@ -0,0 +1,262 @@
+
+
+
+
+
+
+
+
+
+
+
+global $db;
+
+ob_start();
+?>
+
+
+ Ustawienia
+ HTML
+ CSS
+ JS
+ HTML - mobile
+ CSS - mobile
+ JS - mobile
+
+
+
+ = \Html::input(
+ array(
+ 'label' => 'Nazwa',
+ 'name' => 'name',
+ 'id' => 'name',
+ 'value' => $this -> layout['name']
+ )
+ );?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Szablon domyślny',
+ 'name' => 'status',
+ 'checked' => $this -> layout['status'] == 1 ? true : false
+ )
+ );?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'layout-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja szablonu';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> layout['id']
+ ]
+ ];
+$grid -> actions = [
+ 'save' => [ 'url' => '/admin/layouts/layout_save/', 'back_url' => '/admin/layouts/view_list/' ],
+ 'cancel' => [ 'url' => '/admin/layouts/view_list/' ]
+ ];
+$grid -> external_code = $out;
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+
+echo $grid -> draw();
+?>
\ No newline at end of file
diff --git a/admin/templates/layouts/layouts-list.php b/admin/templates/layouts/layouts-list.php
new file mode 100644
index 0000000..2a2b379
--- /dev/null
+++ b/admin/templates/layouts/layouts-list.php
@@ -0,0 +1,47 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
+$grid -> search = [
+ [ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
+ [ 'name' => 'Szablon domyślny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Nazwa',
+ 'db' => 'name',
+ 'php' => 'echo "
[name] ";',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Szablon domyślny',
+ 'db' => 'status',
+ 'replace' => [ 'array' => [ 0 => 'nie', 1 => '
tak ' ] ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
+ ],
+ [
+ 'name' => 'Akcja',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/layouts/layout_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center' ],
+ 'td' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ]
+ ],
+ [
+ 'name' => 'Akcja',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/layouts/layout_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center' ],
+ 'td' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ]
+ ]
+ ];
+$grid -> buttons = [
+ [ 'label' => 'Dodaj szablon', 'url' => '/admin/layouts/layout_edit/', 'icon' => 'fa-plus-circle', 'class' => 'btn-success' ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/layouts/subpages-list.php b/admin/templates/layouts/subpages-list.php
new file mode 100644
index 0000000..b2645fe
--- /dev/null
+++ b/admin/templates/layouts/subpages-list.php
@@ -0,0 +1,16 @@
+ if ( is_array( $this -> pages ) ):?>
+
+ foreach ( $this -> pages as $page ):?>
+
+ >
+
+ layout_pages ) and in_array( $page['id'], $this -> layout_pages ) ):?>checked="checked" endif;?> />= $page['title'];?>
+
+
+ if ( is_array( $page['subpages'] ) )
+ echo \admin\view\Layouts::subpages_list( $page['subpages'], $this -> layout_pages, $page['id'], $this -> step + 1 );
+ ?>
+
+ endforeach;?>
+
+ endif;?>
\ No newline at end of file
diff --git a/admin/templates/newsletter/email-template-edit.php b/admin/templates/newsletter/email-template-edit.php
new file mode 100644
index 0000000..522adde
--- /dev/null
+++ b/admin/templates/newsletter/email-template-edit.php
@@ -0,0 +1,63 @@
+
+
+
+global $db;
+ob_start();
+?>
+ = \Html::input(
+ array(
+ 'label' => 'Nazwa',
+ 'name' => 'name',
+ 'id' => 'name',
+ 'value' => $this -> email_template['name'],
+ 'inline' => true,
+ 'readonly' => $this -> email_template['is_admin'] ? true : false
+ )
+ );?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Treść',
+ 'name' => 'text',
+ 'id' => 'text',
+ 'value' => $this ->email_template['text'],
+ 'inline' => true
+ )
+ );?>
+
+
+$out = ob_get_clean();
+$grid = new \gridEdit;
+$grid -> id = 'email-templates-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja szablonu newslettera';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> email_template['id']
+ ]
+ ];
+$grid -> external_code = $out;
+$grid -> actions = [
+ 'save' => [
+ 'url' => '/admin/newsletter/template_save/',
+ 'back_url' => $this -> email_template['is_admin'] ? '/admin/newsletter/email_templates_admin/' : '/admin/newsletter/email_templates_user/'
+ ],
+ 'cancel' => [
+ 'url' => $this -> email_template['is_admin'] ? '/admin/newsletter/email_templates_admin/' : '/admin/newsletter/email_templates_user/'
+ ]
+ ];
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/newsletter/email-templates-admin.php b/admin/templates/newsletter/email-templates-admin.php
new file mode 100644
index 0000000..be182b7
--- /dev/null
+++ b/admin/templates/newsletter/email-templates-admin.php
@@ -0,0 +1,28 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
+$grid -> where = [ 'is_admin' => 1 ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Nazwa',
+ 'db' => 'name',
+ 'php' => 'echo "
[name] ";',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/newsletter/email_template_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/newsletter/email-templates-user.php b/admin/templates/newsletter/email-templates-user.php
new file mode 100644
index 0000000..6275e03
--- /dev/null
+++ b/admin/templates/newsletter/email-templates-user.php
@@ -0,0 +1,42 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
+$grid -> where = [ 'is_admin' => 0 ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Nazwa',
+ 'db' => 'name',
+ 'php' => 'echo "
[name] ";',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/newsletter/email_template_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/newsletter/email_template_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj szablon',
+ 'url' => '/admin/newsletter/email_template_edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/newsletter/emails-list.php b/admin/templates/newsletter/emails-list.php
new file mode 100644
index 0000000..9f9ab33
--- /dev/null
+++ b/admin/templates/newsletter/emails-list.php
@@ -0,0 +1,38 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'email', 'type' => 'ASC' ];
+$grid -> search = [
+ [ 'name' => 'Email', 'db' => 'email', 'type' => 'text' ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Email',
+ 'db' => 'email',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Potwierdzony',
+ 'db' => 'status',
+ 'sort' => true,
+ 'replace' => [ 'array' => [ 0 => '
nie ', 1 => 'tak' ] ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Importuj emaile',
+ 'url' => '/admin/newsletter/import/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+$grid -> actions = [ 'delete' => true ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/newsletter/import.php b/admin/templates/newsletter/import.php
new file mode 100644
index 0000000..fa3c8a2
--- /dev/null
+++ b/admin/templates/newsletter/import.php
@@ -0,0 +1,41 @@
+
+global $db;
+ob_start();
+?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Maile (oddzielone nowym wierszem)',
+ 'name' => 'emails',
+ 'id' => 'emails'
+ )
+ );?>
+
+
+$out = ob_get_clean();
+$grid = new \gridEdit;
+$grid -> id = 'emails';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Import adresów mailowych';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> element['id']
+ ]
+ ];
+$grid -> external_code = $out;
+$grid -> actions = [
+ 'save' => [
+ 'url' => '/admin/newsletter/emails_import/',
+ 'back_url' => '/admin/newsletter/emails_list/'
+ ],
+ 'cancel' => [
+ 'url' => '/admin/newsletter/emails_list/'
+ ]
+ ];
+$grid -> persist_edit = false;
+$grid -> id_param = 'id';
+
+echo $grid -> draw();
+?>
\ No newline at end of file
diff --git a/admin/templates/newsletter/prepare.php b/admin/templates/newsletter/prepare.php
new file mode 100644
index 0000000..9fd7ae9
--- /dev/null
+++ b/admin/templates/newsletter/prepare.php
@@ -0,0 +1,140 @@
+
+global $db;
+ob_start();
+?>
+
+
+
+ lub / i
+
+
+ $templates[''] = '---- szablon ----';
+ if ( is_array( $this -> templates ) ): foreach ( $this -> templates as $template ):
+ $templates[ $template['id'] ] = $template['name'];
+ endforeach; endif;
+ ?>
+ = \Html::select(
+ array(
+ 'label' => 'Szablon',
+ 'name' => 'template',
+ 'id' => 'template',
+ 'values' => $templates,
+ 'value' => $this -> templates['id']
+
+ ));?>
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'newsletter-prepare';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Wysyłka newslettera - przygotowanie';
+$grid -> default_buttons = false;
+$grid -> external_code = $out;
+$grid -> buttons = [
+ [
+ 'label' => 'Wyślij newsletter',
+ 'class' => 'btn-success',
+ 'icon' => 'fa-send',
+ 'js' => 'send_newsletter();'
+ ]
+ ];
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/newsletter/preview.php b/admin/templates/newsletter/preview.php
new file mode 100644
index 0000000..3852d02
--- /dev/null
+++ b/admin/templates/newsletter/preview.php
@@ -0,0 +1,33 @@
+= $this -> settings['newsletter_header'] ? $this -> settings['newsletter_header'] : '
--- brak zdefiniowanego nagłówka ---
';?>
+ if ( is_array( $this -> template ) ):?>
+ = $this -> template['text']?>
+ endif;?>
+ if ( is_array( $this -> articles ) ):?>
+ foreach ( $this -> articles as $article ):?>
+ $article['language']['seo_link'] ? $url = $article['language']['seo_link'] : $url = 'a-' . $article['id'] . '-' . \S::seo( $article['language']['title'] );?>
+
+
+ $article['language']['seo_link'] ? $url = $article['language']['seo_link'] : $url = 'a-' . $article['id'] . '-' . \S::seo( $article['language']['title'] );
+ ?>
+
+ = $article['language']['title'];?>
+
+
+
+ if ( $article['language']['entry'] )
+ echo $article['language']['entry'];
+ else
+ echo $article['language']['text'];
+ ?>
+
+
+
+ endforeach;?>
+ else:?>
+ if ( $this -> dates ):?>
+
+ --- brak artykułów w danym okresie ---
+
+ endif;?>
+ endif;?>
+= $this -> settings['newsletter_footer_2'] ? $this -> settings['newsletter_footer_2'] : '
--- brak zdefiniowanej stopki cz. 2 ---
';?>
\ No newline at end of file
diff --git a/admin/templates/newsletter/settings.php b/admin/templates/newsletter/settings.php
new file mode 100644
index 0000000..65e1d0c
--- /dev/null
+++ b/admin/templates/newsletter/settings.php
@@ -0,0 +1,60 @@
+
+
+
+
+global $db;
+
+ob_start();
+
+ echo \Html::textarea(
+ array(
+ 'label' => 'Nagłówek',
+ 'name' => 'newsletter_header',
+ 'id' => 'newsletter_header',
+ 'value' => $this -> settings['newsletter_header'],
+ 'inline' => true
+ )
+ );
+ echo \Html::textarea(
+ array(
+ 'label' => 'Stopka cz 1. (dołączana zawsze)',
+ 'name' => 'newsletter_footer_1',
+ 'id' => 'newsletter_footer_1',
+ 'value' => $this -> settings['newsletter_footer_1'],
+ 'inline' => true
+ )
+ );
+ echo \Html::textarea(
+ array(
+ 'label' => 'Stopka cz 2. (dołączana tylko w przypadku newslettera)',
+ 'name' => 'newsletter_footer_2',
+ 'id' => 'newsletter_footer_2',
+ 'value' => $this -> settings['newsletter_footer_2'],
+ 'inline' => true
+ )
+ );
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'settings-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja ustawień';
+$grid -> actions = [
+ 'save' => [ 'url' => '/admin/newsletter/settings_save/', 'back_url' => '/admin/newsletter/settings/' ],
+ ];
+$grid -> external_code = $out;
+echo $grid -> draw();
+?>
+
+
\ No newline at end of file
diff --git a/admin/templates/pages/menu-edit.php b/admin/templates/pages/menu-edit.php
new file mode 100644
index 0000000..dc74f28
--- /dev/null
+++ b/admin/templates/pages/menu-edit.php
@@ -0,0 +1,42 @@
+ gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Zapisz menu';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> menu['id']
+ ],
+ [
+ 'name' => 'Nazwa',
+ 'db' => 'name',
+ 'type' => 'text',
+ 'value' => $this -> menu['name'],
+ 'params' => [ 'class' => 'require' ]
+ ],
+ [
+ 'name' => 'Aktywne',
+ 'db' => 'status',
+ 'type' => 'input_switch',
+ 'checked' => $this -> menu['status'] ? true : false,
+ 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ]
+ ]
+ ];
+$grid -> actions = [
+ 'save' => [ 'url' => '/admin/pages/menu_save/', 'back_url' => '/admin/pages/view_list/' ],
+ 'cancel' => [ 'url' => '/admin/pages/view_list/' ]
+ ];
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/pages/page-articles.php b/admin/templates/pages/page-articles.php
new file mode 100644
index 0000000..33d6ba2
--- /dev/null
+++ b/admin/templates/pages/page-articles.php
@@ -0,0 +1,89 @@
+
+global $gdb;
+
+ob_start();
+?>
+
+
+ if ( is_array( $this -> articles ) ) foreach ( $this -> articles as $article )
+ {
+ ?>
+
+ = $article['title'];?>
+
+
+ }
+ ?>
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> default_buttons = false;
+$grid -> external_code = $out;
+$grid -> title = 'Lista artykułów';
+$grid -> buttons = [
+ [
+ 'label' => 'Wstecz',
+ 'url' => '/admin/pages/view_list/',
+ 'icon' => 'fa-reply',
+ 'class' => 'btn-dark'
+ ]
+ ];
+echo $grid -> draw();
+?>
+
+
\ No newline at end of file
diff --git a/admin/templates/pages/page-edit.php b/admin/templates/pages/page-edit.php
new file mode 100644
index 0000000..a8e2f0b
--- /dev/null
+++ b/admin/templates/pages/page-edit.php
@@ -0,0 +1,514 @@
+
+
+global $db;
+
+ob_start();
+?>
+
+
+ Treść
+ Ustawienia
+ SEO
+
+
+
+
+
+ if (is_array($this->languages)): foreach ($this->languages as $lg): ?>
+ if ($lg['status']): ?>
+ if ($lg['id'] == \front\factory\Languages::default_language()) echo ' '; ?>= $lg['name']; ?>
+ endif; ?>
+ endforeach;
+endif; ?>
+
+
+ if (is_array($this->languages)): foreach ($this->languages as $lg): ?>
+ if ($lg['status']): ?>
+
+ =
+ \Html::input(
+ array(
+ 'label' => 'Nazwa strony',
+ 'name' => 'title',
+ 'id' => 'title_' . $lg['id'],
+ 'value' => $this->page['languages'][$lg['id']]['title'],
+ 'js_key' => 'google_preview( "' . $lg['id'] . '", "' . \S::get('pid') . '" ); return false;'
+ )
+ );
+ ?>
+
+ endif; ?>
+ endforeach;
+endif; ?>
+
+
+
+
+
+
+ if (is_array($this->menus)): foreach ($this->menus as $menu):
+ $menus[$menu['id']] = $menu['name'];
+ endforeach;
+ endif;
+ ?>
+ =
+ \Html::select(
+ array(
+ 'label' => 'Menu',
+ 'name' => 'menu_id',
+ 'values' => $menus,
+ 'value' => $this->page['id'] ? $this->page['menu_id'] : $this->menu_id
+ )
+ );
+ ?>
+ =
+ \Html::select(
+ array(
+ 'label' => 'Typ strony',
+ 'name' => 'page_type',
+ 'id' => 'page_type',
+ 'values' => \admin\factory\Pages::$_page_types,
+ 'value' => $this->page['page_type']
+ )
+ );
+ ?>
+
+
+
+ if (is_array($this->languages)): foreach ($this->languages as $lg): ?>
+ if ($lg['status']): ?>
+ if ($lg['id'] == \front\factory\Languages::default_language()) echo ' '; ?>= $lg['name']; ?>
+ endif; ?>
+ endforeach;
+ endif; ?>
+
+
+ if (is_array($this->languages)): foreach ($this->languages as $lg): ?>
+ if ($lg['status']): ?>
+
+ =
+ \Html::input_icon(
+ array(
+ 'label' => 'Link',
+ 'name' => 'link',
+ 'id' => 'link_' . $lg['id'],
+ 'value' => $this->page['languages'][$lg['id']]['link'],
+ 'icon_class' => 'fa fa-link',
+ 'icon_js' => 'pages_url_browser( "' . $lg['id'] . '");'
+ )
+ );
+ ?>
+
+ endif; ?>
+ endforeach;
+ endif; ?>
+
+
+
+
+ =
+ \Html::select(
+ array(
+ 'label' => 'Sortowanie artykułów',
+ 'name' => 'sort_type',
+ 'id' => 'sort_type',
+ 'values' => \admin\factory\Pages::$_sort_types,
+ 'value' => $this->page['sort_type']
+ )
+ );
+ ?>
+
+ $layouts[''] = '---- szablon ----';
+ if (is_array($this->layouts)): foreach ($this->layouts as $layout):
+ $layouts[$layout['id']] = $layout['name'];
+ endforeach;
+ endif;
+ ?>
+ =
+ \Html::select(
+ array(
+ 'label' => 'Szablon',
+ 'name' => 'layout_id',
+ 'id' => 'layout_id',
+ 'values' => $layouts,
+ 'value' => $this->page['layout_id']
+ )
+ );
+ ?>
+ =
+ \Html::input(
+ array(
+ 'label' => 'Liczba artykułów na stronę',
+ 'name' => 'articles_limit',
+ 'id' => 'articles_limit',
+ 'value' => $this->page['articles_limit'] ? $this->page['articles_limit'] : 2
+ )
+ );
+ ?>
+=
+\Html::input_switch(
+ array(
+ 'label' => 'Pokaż tytuł',
+ 'name' => 'show_title',
+ 'checked' => $this->page['show_title'] == 1 or ! $this->page['id'] ? true : false
+ )
+);
+?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Aktywna',
+ 'name' => 'status',
+ 'checked' => $this->page['status'] == 1 or ! $this->page['id'] ? true : false
+ )
+ );
+ ?>
+ = Html::input_switch( [
+ 'label' => 'Strona startowa',
+ 'name' => 'start',
+ 'checked' => $this->page['start'] == 1 ? true : false
+ ]
+ );
+ ?>
+ = Html::input_switch( [
+ 'label' => 'Cache (24h)',
+ 'name' => 'cache',
+ 'checked' => $this -> page['cache'] == 1 ? true : false
+ ]
+ );
+ ?>
+
+
+
+
+ if (is_array($this->languages)): foreach ($this->languages as $lg): ?>
+ if ($lg['status']): ?>
+ if ($lg['id'] == \front\factory\Languages::default_language()) echo ' '; ?>= $lg['name']; ?>
+ endif; ?>
+ endforeach;
+ endif; ?>
+
+
+ if (is_array($this->languages)): foreach ($this->languages as $lg): ?>
+ if ($lg['status']): ?>
+
+ =
+ \Html::input_icon(
+ array(
+ 'label' => 'Link SEO',
+ 'name' => 'seo_link',
+ 'id' => 'seo_link_' . $lg['id'],
+ 'value' => $this->page['languages'][$lg['id']]['seo_link'],
+ 'icon_content' => 'generuj',
+ 'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#title_' . $lg['id'] . '" ).val(), ' . (int) $this->page['id'] . ', ' . \S::get('pid') . ' );',
+ 'js_key' => 'google_preview( "' . $lg['id'] . '", "' . \S::get('pid') . '" ); return false;'
+ )
+ );
+ ?>
+ =
+ \Html::input(
+ array(
+ 'label' => 'Tytuł strony (h1)',
+ 'name' => 'site_title',
+ 'id' => 'site_title_' . $lg['id'],
+ 'value' => $this->page['languages'][$lg['id']]['site_title']
+ )
+ );
+ ?>
+ =
+ \Html::input(
+ array(
+ 'label' => 'Meta title',
+ 'name' => 'meta_title',
+ 'id' => 'meta_title_' . $lg['id'],
+ 'value' => $this->page['languages'][$lg['id']]['meta_title'],
+ 'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
+ )
+ );
+ ?>
+ =
+ \Html::textarea(
+ array(
+ 'label' => 'Meta description',
+ 'name' => 'meta_description',
+ 'id' => 'meta_description_' . $lg['id'],
+ 'value' => $this->page['languages'][$lg['id']]['meta_description'],
+ 'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
+ )
+ );
+ ?>
+ =
+ \Html::textarea(
+ array(
+ 'label' => 'Meta keywords',
+ 'name' => 'meta_keywords',
+ 'id' => 'meta_keywords_' . $lg['id'],
+ 'value' => $this->page['languages'][$lg['id']]['meta_keywords']
+ )
+ );
+ ?>
+
+ =
+ \Html::select(
+ array(
+ 'label' => 'Blokuj indeksację',
+ 'name' => "noindex",
+ 'id' => 'noindex_' . $lg['id'],
+ 'values' => array(
+ 0 => 'nie', 1 => 'tak'
+ ),
+ 'value' => $this->page['languages'][$lg['id']]['noindex'] == 1 ? 1 : 0
+ )
+ );
+ ?>
+ = \Html::select(
+ array(
+ 'label' => 'Blokuj bezpośredni dostęp',
+ 'name' => "block_direct_access",
+ 'id' => 'block_direct_access_' . $lg['id'],
+ 'values' => array(
+ 0 => 'nie', 1 => 'tak'
+ ),
+ 'value' => $this -> page['languages'][ $lg['id'] ]['block_direct_access'] == 1 ? 1 : 0
+ )
+ );?>
+ = \Html::input(
+ array(
+ 'label' => 'Rel canonical',
+ 'name' => 'canonical',
+ 'id' => 'canonical_' . $lg['id'],
+ 'value' => $this->page['languages'][$lg['id']]['canonical']
+ ) );?>
+
+ endif; ?>
+ endforeach;
+endif; ?>
+
+
+
+
+
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid->id = 'page-edit';
+$grid->gdb_opt = $gdb;
+$grid->include_plugins = true;
+$grid->title = 'Edycja strony';
+$grid->fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this->page['id']
+ ],
+ [
+ 'db' => 'parent_id',
+ 'type' => 'hidden',
+ 'value' => $this->page['id'] ? $this->page['parent_id'] : $this->parent_id
+ ]
+];
+$grid->actions = [
+ 'save' => ['url' => '/admin/pages/page_save/', 'back_url' => '/admin/pages/view_list/'],
+ 'cancel' => ['url' => '/admin/pages/view_list/']
+];
+$grid->external_code = $out;
+$grid->persist_edit = true;
+$grid->id_param = 'id';
+
+echo $grid->draw();
+?>
\ No newline at end of file
diff --git a/admin/templates/pages/pages-browse-list.php b/admin/templates/pages/pages-browse-list.php
new file mode 100644
index 0000000..d6b325a
--- /dev/null
+++ b/admin/templates/pages/pages-browse-list.php
@@ -0,0 +1,156 @@
+
+global $gdb;
+ob_start();
+ if ( is_array( $this -> menus ) ) foreach ( $this -> menus as $menu )
+ {
+ ?>
+
+
+ }
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'pages-list';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Lista stron';
+$grid -> default_buttons = false;
+$grid -> external_code = $out;
+
+echo $grid -> draw();
+?>
+
+
+
\ No newline at end of file
diff --git a/admin/templates/pages/pages-list.php b/admin/templates/pages/pages-list.php
new file mode 100644
index 0000000..475c01e
--- /dev/null
+++ b/admin/templates/pages/pages-list.php
@@ -0,0 +1,204 @@
+
+global $gdb;
+
+ob_start();
+ if ( is_array( $this -> menus ) ) foreach ( $this -> menus as $menu )
+ {
+ ?>
+
+
+ }
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'pages-list';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Lista stron';
+$grid -> default_buttons = false;
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj menu',
+ 'url' => '/admin/pages/menu_edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+$grid -> external_code = $out;
+
+echo $grid -> draw();
+?>
+
+
\ No newline at end of file
diff --git a/admin/templates/pages/subpages-browse-list.php b/admin/templates/pages/subpages-browse-list.php
new file mode 100644
index 0000000..b67f18b
--- /dev/null
+++ b/admin/templates/pages/subpages-browse-list.php
@@ -0,0 +1,72 @@
+ if (is_array($this->pages)): ?>
+
+ $settings = \front\factory\Settings::settings_details();
+ ?>
+
+ foreach ($this->pages as $page): ?>
+
+
+
+
+ if (!$page['status'])
+ echo '
';
+
+ if ($page['start'])
+ echo '
';
+
+ echo mb_substr( $page['title'], 0, 50, 'UTF-8' );
+ if ( strlen( $page['title'] ) > 50 )
+ echo '...';
+
+ if (is_array($page['languages'])):
+ echo '
';
+ foreach ($page['languages'] as $lg)
+ echo '
';
+ echo '
';
+ endif;
+
+ $default_language = \front\factory\Languages::default_language();
+ if (is_array($page['languages'])):
+ foreach ($page['languages'] as $lg):
+ echo '
';
+ endforeach;
+ endif;
+ ?>
+
+
+ if (is_array($page['subpages']))
+ echo \admin\view\Pages::subpages_browse_list($page['subpages'], $page['id'], $this->step + 1);
+ ?>
+
+ endforeach; ?>
+
+ endif; ?>
\ No newline at end of file
diff --git a/admin/templates/pages/subpages-list.php b/admin/templates/pages/subpages-list.php
new file mode 100644
index 0000000..69f6ed2
--- /dev/null
+++ b/admin/templates/pages/subpages-list.php
@@ -0,0 +1,54 @@
+ if ( is_array( $this -> pages ) ):?>
+
+ foreach ( $this -> pages as $page ):?>
+
+
+
+ if ( !$page['status'] ) echo '
';?>
+ if ( $page['start'] ) echo '
';?>
+ = mb_substr( $page['title'], 0, 75, 'UTF-8' );?> if ( mb_strlen( $page['title'], 'utf-8' ) > 75 ) echo '...';?>
+
+ if ( is_array( $page['languages'] ) ):
+ echo '
';
+ foreach ( $page['languages'] as $lg )
+ echo '
';
+ echo '
';
+ endif;
+ ?>
+ if ( $this -> step < 3 ):?>
+
+ else:?>
+
+ endif;?>
+
+
+ if ( is_array( $page['subpages'] ) )
+ echo \admin\view\Pages::subpages_list( $page['subpages'], $page['id'], $this -> step + 1 );
+ ?>
+
+ endforeach;?>
+
+ endif;?>
\ No newline at end of file
diff --git a/admin/templates/scontainers/ckeditor-list.php b/admin/templates/scontainers/ckeditor-list.php
new file mode 100644
index 0000000..f57063e
--- /dev/null
+++ b/admin/templates/scontainers/ckeditor-list.php
@@ -0,0 +1,101 @@
+ gdb_opt = $gdb;
+$grid -> sql = 'SELECT *'
+ . 'FROM ( '
+ . 'SELECT '
+ . 'id, status, '
+ . '( SELECT title FROM pp_scontainers_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND container_id = ps.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
+ . 'FROM '
+ . 'pp_scontainers AS ps '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] '
+ . 'ORDER BY '
+ . '[order_p1] [order_p2]';
+$grid -> sql_count = 'SELECT '
+ . 'COUNT(0) FROM ( '
+ . 'SELECT '
+ . 'id, status, '
+ . '( SELECT title FROM pp_scontainers_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND container_id = ps.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
+ . 'FROM '
+ . 'pp_scontainers AS ps '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] ';
+$grid -> debug = true;
+$grid -> order = [ 'column' => 'title', 'type' => 'ASC' ];
+$grid -> search = [
+ [ 'name' => 'Tytuł', 'db' => 'title', 'type' => 'text' ],
+ [ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Tytuł',
+ 'db' => 'title',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Kod',
+ 'php' => 'echo "[KONTENER:[id]]";'
+ ],
+ [
+ 'name' => 'Aktywny',
+ 'db' => 'status',
+ 'replace' => [ 'array' => [ 0 => '
nie ', 1 => 'tak' ] ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Akcja',
+ 'db' => 'id',
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
+ 'php' => 'echo "
wybierz ";'
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj kontener',
+ 'url' => '/admin/scontainers/container_edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+echo $grid -> draw();
+?>
+
+
\ No newline at end of file
diff --git a/admin/templates/scontainers/container-edit.php b/admin/templates/scontainers/container-edit.php
new file mode 100644
index 0000000..8262630
--- /dev/null
+++ b/admin/templates/scontainers/container-edit.php
@@ -0,0 +1,166 @@
+
+
+
+
+
+
+
+
+
+
+
+global $db;
+
+ob_start();
+?>
+
+
+
+
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+ = $lg['name'];?>
+ endif;?>
+ endforeach; endif;?>
+
+
+ if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
+ if ( $lg['status'] ):?>
+
+ = \Html::input(
+ array(
+ 'label' => 'Tytuł',
+ 'name' => 'title',
+ 'id' => 'title_' . $lg['id'],
+ 'value' => $this -> container['languages'][ $lg['id'] ]['title'],
+ 'inline' => true
+ )
+ );?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Treść',
+ 'name' => 'text',
+ 'id' => 'text_' . $lg['id'],
+ 'value' => $this -> container['languages'][ $lg['id'] ]['text'],
+ 'inline' => true
+ )
+ );?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Kod HTML',
+ 'name' => 'html',
+ 'id' => 'html_' . $lg['id'],
+ 'value' => $this -> container['languages'][ $lg['id'] ]['html'],
+ 'inline' => true
+ )
+ );?>
+
+
+ endif;?>
+ endforeach; endif;?>
+
+
+
+
+
+ = \Html::input_switch(
+ array(
+ 'label' => 'Aktywny',
+ 'name' => 'status',
+ 'checked' => $this -> container['status'] == 1 or !$this -> container['id'] ? true : false
+ )
+ );
+ ?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Pokaż tytuł',
+ 'name' => 'show_title',
+ 'checked' => $this -> container['show_title'] == 1 ? true : false
+ )
+ );
+ ?>
+ = \Html::input_icon(
+ array(
+ 'label' => 'Tło kontenera',
+ 'name' => 'src',
+ 'id' => 'src',
+ 'value' => $this->container['src'],
+ 'icon_content' => 'przeglądaj',
+ 'icon_js' => "window.open ( 'http://" . $_SERVER['SERVER_NAME'] . "/libraries/filemanager-9.14.0/dialog.php?type=1&popup=1&field_id=src&akey=c3cb2537d25c0efc9e573d059d79c3b8', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
+ )
+ );
+ ?>
+
+
+
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'container-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja kontenera statycznego';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> container['id']
+ ]
+ ];
+$grid -> actions = [
+ 'save' => [ 'url' => '/admin/scontainers/container_save/', 'back_url' => '/admin/scontainers/view_list/' ],
+ 'cancel' => [ 'url' => '/admin/scontainers/view_list/' ]
+ ];
+$grid -> external_code = $out;
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+
+echo $grid -> draw();
+?>
+
+
\ No newline at end of file
diff --git a/admin/templates/scontainers/containers-list.php b/admin/templates/scontainers/containers-list.php
new file mode 100644
index 0000000..ef03137
--- /dev/null
+++ b/admin/templates/scontainers/containers-list.php
@@ -0,0 +1,79 @@
+ gdb_opt = $gdb;
+$grid -> sql = 'SELECT *'
+ . 'FROM ( '
+ . 'SELECT '
+ . 'id, status, '
+ . '( SELECT title FROM pp_scontainers_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND container_id = ps.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
+ . 'FROM '
+ . 'pp_scontainers AS ps '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] '
+ . 'ORDER BY '
+ . '[order_p1] [order_p2]';
+$grid -> sql_count = 'SELECT '
+ . 'COUNT(0) FROM ( '
+ . 'SELECT '
+ . 'id, status, '
+ . '( SELECT title FROM pp_scontainers_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND container_id = ps.id AND title != \'\' ORDER BY o ASC LIMIT 1 ) AS title '
+ . 'FROM '
+ . 'pp_scontainers AS ps '
+ . ') AS q1 '
+ . 'WHERE '
+ . '1=1 [where] ';
+$grid -> debug = true;
+$grid -> order = [ 'column' => 'title', 'type' => 'ASC' ];
+$grid -> search = [
+ [ 'name' => 'Tytuł', 'db' => 'title', 'type' => 'text' ],
+ [ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Tytuł',
+ 'db' => 'title',
+ 'php' => 'echo "
[title] ";',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Kod',
+ 'php' => 'echo "[KONTENER:[id]]";'
+ ],
+ [
+ 'name' => 'Aktywny',
+ 'db' => 'status',
+ 'replace' => [ 'array' => [ 0 => '
nie ', 1 => 'tak' ] ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/scontainers/container_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/scontainers/container_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj kontener',
+ 'url' => '/admin/scontainers/container_edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/seo-additional/element-edit.php b/admin/templates/seo-additional/element-edit.php
new file mode 100644
index 0000000..c7c5b35
--- /dev/null
+++ b/admin/templates/seo-additional/element-edit.php
@@ -0,0 +1,95 @@
+
+
+
+global $db;
+ob_start();
+?>
+ = \Html::input(
+ array(
+ 'label' => 'Url',
+ 'class' => 'required',
+ 'name' => 'url',
+ 'id' => 'url',
+ 'value' => $this -> element['url']
+ )
+ );?>
+ = \Html::input_switch(
+ array(
+ 'label' => 'Aktywny',
+ 'name' => 'status',
+ 'checked' => $this -> element['status'] == 1 or !$this -> element['id'] ? true : false
+ )
+ );?>
+ = \Html::input(
+ array(
+ 'label' => 'Meta title',
+ 'class' => 'title',
+ 'name' => 'title',
+ 'id' => 'title',
+ 'value' => $this -> element['title']
+ )
+ );?>
+ = \Html::input(
+ array(
+ 'label' => 'Meta keywords',
+ 'class' => 'keywords',
+ 'name' => 'keywords',
+ 'id' => 'keywords',
+ 'value' => $this -> element['keywords']
+ )
+ );?>
+ = \Html::input(
+ array(
+ 'label' => 'Meta description',
+ 'class' => 'description',
+ 'name' => 'description',
+ 'id' => 'description',
+ 'value' => $this -> element['description']
+ )
+ );?>
+ = \Html::textarea(
+ array(
+ 'label' => 'Dodatkowa treść',
+ 'name' => 'text',
+ 'id' => 'text',
+ 'value' => $this ->element['text']
+ )
+ );?>
+
+
+$out = ob_get_clean();
+$grid = new \gridEdit;
+$grid -> id = 'seo-element-edit';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Edycja elementu SEO';
+$grid -> fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this -> element['id']
+ ]
+ ];
+$grid -> external_code = $out;
+$grid -> actions = [
+ 'save' => [
+ 'url' => '/admin/seo_additional/element_save/',
+ 'back_url' => '/admin/seo_additional/main_view/'
+ ],
+ 'cancel' => [
+ 'url' => '/admin/seo_additional/main_view/'
+ ]
+ ];
+$grid -> persist_edit = true;
+$grid -> id_param = 'id';
+
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/seo-additional/main-view.php b/admin/templates/seo-additional/main-view.php
new file mode 100644
index 0000000..b05544c
--- /dev/null
+++ b/admin/templates/seo-additional/main-view.php
@@ -0,0 +1,58 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'url', 'type' => 'ASC' ];
+$grid -> search = [
+ [ 'name' => 'Url', 'db' => 'url', 'type' => 'text' ],
+ [ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Url',
+ 'db' => 'url',
+ 'php' => 'echo "
[url] ";',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Title',
+ 'db' => 'title',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Aktywny',
+ 'db' => 'status',
+ 'replace' => [ 'array' => [ 0 => '
nie ', 1 => 'tak' ] ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/seo_additional/element_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/seo_additional/element_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [
+ 'label' => 'Dodaj element',
+ 'url' => '/admin/seo_additional/element_edit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success'
+ ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/admin/templates/settings/settings.php b/admin/templates/settings/settings.php
new file mode 100644
index 0000000..0101cc9
--- /dev/null
+++ b/admin/templates/settings/settings.php
@@ -0,0 +1,428 @@
+
+
+
+
+global $db;
+
+ob_start();
+?>
+
+
+ Dane kontaktowe
+ Poczta
+ Dodatkowe ustawienia
+ Kody (m.in. statystyk)
+ System
+ Aktualizacje
+
+
+
+ =
+ \Html::input(
+ array(
+ 'label' => 'Nazwa firmy',
+ 'name' => 'firm_name',
+ 'id' => 'firm_name',
+ 'value' => $this -> settings['firm_name']
+ )
+ );
+ ?>
+ =
+ \Html::textarea(
+ array(
+ 'label' => 'Dodatkowe informacje',
+ 'name' => 'additional_info',
+ 'id' => 'additional_info',
+ 'value' => $this -> settings['additional_info']
+ )
+ );
+ ?>
+ =
+ \Html::input_switch(
+ array(
+ 'label' => 'Mapa',
+ 'name' => 'google_maps',
+ 'checked' => $this -> settings['google_maps'] == 1 ? true : false
+ )
+ );
+ ?>
+ =
+ \Html::textarea(
+ array(
+ 'label' => 'Mapa - adres',
+ 'name' => 'firm_adress',
+ 'id' => 'firm_adress',
+ 'value' => $this -> settings['firm_adress']
+ )
+ );
+ ?>
+ =
+ \Html::input_switch(
+ array(
+ 'label' => 'Widget "Telefon"',
+ 'name' => 'widget_phone',
+ 'checked' => $this -> settings['widget_phone'] == 1 ? true : false
+ )
+ );
+ ?>
+
+
+ =
+ \Html::input_switch(
+ array(
+ 'label' => 'Formularz kontaktowy',
+ 'name' => 'contact_form',
+ 'checked' => $this -> settings['contact_form'] == 1 ? true : false
+ )
+ );
+ ?>
+ =
+ \Html::input(
+ array(
+ 'label' => 'Email kontaktowy',
+ 'name' => 'contact_email',
+ 'id' => 'contact_email',
+ 'value' => $this -> settings['contact_email']
+ )
+ );
+ ?>
+ =
+ \Html::input(
+ array(
+ 'label' => 'Email - host',
+ 'name' => 'email_host',
+ 'id' => 'email_host',
+ 'value' => $this -> settings['email_host']
+ )
+ );
+ ?>
+ =
+ \Html::input(
+ array(
+ 'label' => 'Email - port',
+ 'name' => 'email_port',
+ 'id' => 'email_port',
+ 'value' => $this -> settings['email_port']
+ )
+ );
+ ?>
+ =
+ \Html::input(
+ array(
+ 'label' => 'Email - login',
+ 'name' => 'email_login',
+ 'id' => 'email_login',
+ 'value' => $this -> settings['email_login']
+ )
+ );
+ ?>
+ =
+ \Html::input(
+ array(
+ 'label' => 'Email - hasło',
+ 'name' => 'email_password',
+ 'id' => 'email_password',
+ 'value' => $this -> settings['email_password'],
+ 'type' => 'text'
+ )
+ );
+ ?>
+ = \Html::input_switch( [
+ 'label' => 'Captcha w formularzu kontaktowym',
+ 'name' => 'contact_form_captcha',
+ 'checked' => $this -> settings['contact_form_captcha'] == 1 ? true : false
+ ] );
+ ?>
+
+
+
+
+
+
+ = \Html::input( [
+ 'label' => 'Maksmalna wielkość zdjęcia (px)',
+ 'name' => 'image_px',
+ 'id' => 'image_px',
+ 'value' => $this -> settings['image_px']
+ ] );
+ ?>
+
+
+ =
+ \Html::input(
+ array(
+ 'label' => 'Klucz Google Search Console',
+ 'name' => 'google_search_console',
+ 'id' => 'google_search_console',
+ 'value' => $this -> settings['google_search_console']
+ )
+ );
+ ?>
+ =
+ \Html::input(
+ array(
+ 'label' => 'Facebook link',
+ 'name' => 'facebook_link',
+ 'id' => 'facebook_link',
+ 'value' => $this -> settings['facebook_link']
+ )
+ );
+ ?>
+ =
+ \Html::textarea(
+ array(
+ 'label' => 'Kod statystyk',
+ 'name' => 'statistic_code',
+ 'id' => 'statistic_code',
+ 'value' => $this -> settings['statistic_code'],
+ 'rows' => 10
+ )
+ );
+ ?>
+ =
+ \Html::textarea(
+ array(
+ 'label' => 'Własne reguły htacess',
+ 'name' => 'htaccess',
+ 'id' => 'htaccess',
+ 'value' => $this -> settings['htaccess'],
+ 'rows' => 10
+ )
+ );
+ ?>
+ =
+ \Html::textarea(
+ array(
+ 'label' => 'Własne reguły robots.txt',
+ 'name' => 'robots',
+ 'id' => 'robots',
+ 'value' => $this -> settings['robots'],
+ 'rows' => 10
+ )
+ );
+ ?>
+
+
+
+
+
+
+
+
+
+ = \Html::select( [
+ 'label' => "Struktura linków",
+ 'name' => "links_structure",
+ 'values' => [ 0 => 'skrócona', 1 => 'rozwinięta' ],
+ 'value' => $this -> settings['links_structure'] ? 1 : 0
+ ] );?>
+
+
+ = \Html::select( [
+ 'label' => "Wersja strony",
+ 'name' => "link_version",
+ 'values' => [ 0 => 'bez www', 1 => 'z www' ],
+ 'value' => $this -> settings['link_version'] ? 1 : 0
+ ] );?>
+
+
+ = \Html::select( [
+ 'label' => "Wersja adresów url",
+ 'name' => "url_version",
+ 'values' => [ 0 => 'bez / na końcu adresu url', 1 => 'z / na końcu adresu url' ],
+ 'value' => $this -> settings['url_version'] ? 1 : 0
+ ] );?>
+
+
+ = \Html::select( [
+ 'label' => "Newsletter",
+ 'name' => "newsletter_cron",
+ 'values' => [ 0 => 'wysyłka za pomocą cron i strony', 1 => 'wysyłka za pomocą cron' ],
+ 'value' => $this -> settings['newsletter_cron'] ? 1 : 0
+ ] );?>
+
+
+
+
+ = Html::input(
+ array(
+ 'label' => 'Numer licencji',
+ 'name' => 'update_key',
+ 'id' => 'update_key',
+ 'value' => $this -> settings['update_key']
+ )
+ );
+ ?>
+
+
+
+ $out = ob_get_clean();
+
+ $grid = new \gridEdit;
+ $grid -> id = 'settings-edit';
+ $grid -> gdb_opt = $gdb;
+ $grid -> include_plugins = true;
+ $grid -> title = 'Edycja ustawień';
+ $grid -> actions = [
+ 'save' => [
+ 'url' => '/admin/settings/settings_save/',
+ 'back_url' => '/admin/settings/view/'
+ ]
+ ];
+ $grid -> external_code = $out;
+ echo $grid -> draw();
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/admin/templates/site/main-layout.php b/admin/templates/site/main-layout.php
new file mode 100644
index 0000000..9f8eb37
--- /dev/null
+++ b/admin/templates/site/main-layout.php
@@ -0,0 +1,330 @@
+ global $user, $config, $settings;?>
+
+
+
+
cmsPro
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ if ( $alert = \S::get_session( 'alert' ) ):
+ \S::alert( false );
+ ?>
+
+
+
+ ×
+
+ = $alert;?>
+
+
+
+ endif;
+ ?>
+ = $this -> content;?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/templates/site/unlogged-layout.php b/admin/templates/site/unlogged-layout.php
new file mode 100644
index 0000000..f79ab1b
--- /dev/null
+++ b/admin/templates/site/unlogged-layout.php
@@ -0,0 +1,93 @@
+ global $user, $config, $settings;?>
+
+
+
+
cmsPro
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/admin/templates/update/main-view.php b/admin/templates/update/main-view.php
new file mode 100644
index 0000000..577fb15
--- /dev/null
+++ b/admin/templates/update/main-view.php
@@ -0,0 +1,165 @@
+ global $db; ob_start();?>
+= \Html::form_text( [
+ 'label' => 'Twoja wersja systemu',
+ 'id' => 'ver',
+ 'text' => $this -> ver
+ ] );?>
+= \Html::form_text( [
+ 'label' => 'Aktualna wersja systemu',
+ 'text' => $this -> new_ver,
+ 'id' => 'new_ver'
+ ] );?>
+
+ $ver_new = $this -> new_ver;
+ $ver = $this -> ver;
+ $valuemax = ( $ver_new - $ver ) * 1000;
+?>
+
+
+ if ( $this -> ver < $this -> new_ver ):?>
+
+ endif;?>
+ if ( $this -> ver < $this -> new_ver ):?>
+
+ endif;?>
+
+ if ( $this -> ver < $this -> new_ver ):?>
+
* Przed aktualizacją systemu zalecane jest wykonanie pełnej kopii zapasowej.
+
+ endif;?>
+
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'update-view';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Aktualizacja systemu';
+$grid -> default_buttons = false;
+$grid -> external_code = $out;
+echo $grid -> draw();
+?>
+
+ob_start();
+echo $versions = file_get_contents( 'http://www.cmspro.project-dc.pl/updates/changelog.php' );
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid -> id = 'changelog';
+$grid -> gdb_opt = $gdb;
+$grid -> include_plugins = true;
+$grid -> title = 'Changelog';
+$grid -> default_buttons = false;
+$grid -> external_code = $out;
+echo $grid -> draw();
+?>
+
\ No newline at end of file
diff --git a/admin/templates/users/user-edit.php b/admin/templates/users/user-edit.php
new file mode 100644
index 0000000..3592001
--- /dev/null
+++ b/admin/templates/users/user-edit.php
@@ -0,0 +1,325 @@
+privileges;
+?>
+
+
+$this->user['id'] ? $password_param = 'optional' : $password_param = 'require';
+$out = ob_get_clean();
+
+$grid = new \gridEdit;
+$grid->gdb_opt = $gdb;
+$grid->include_plugins = true;
+$grid->title = 'Zapisz użytkownika';
+$grid->fields = [
+ [
+ 'db' => 'id',
+ 'type' => 'hidden',
+ 'value' => $this->user['id']
+ ],
+ [
+ 'db' => 'admin',
+ 'type' => 'hidden',
+ 'value' => '1'
+ ],
+ [
+ 'name' => 'Login',
+ 'db' => 'login',
+ 'type' => 'text',
+ 'value' => $this->user['login'],
+ 'params' => ['class' => 'require', 'function' => 'check_login']
+ ],
+ [
+ 'name' => 'Aktywny',
+ 'db' => 'status',
+ 'type' => 'input_switch',
+ 'checked' => $this->user['status'] ? true : false
+ ],
+ [
+ 'name' => 'Aktywny do',
+ 'db' => 'active_to',
+ 'type' => 'text',
+ 'id' => 'active_to',
+ 'value' => $this->user['active_to'] == '0000-00-00' ? '' : $this->user['active_to']
+ ],
+ [
+ 'name' => 'Hasło',
+ 'db' => 'password',
+ 'type' => 'password',
+ 'params' => ['class' => $password_param, 'min' => 5]
+ ],
+ [
+ 'name' => 'Hasło - powtórz',
+ 'db' => 'password_re',
+ 'type' => 'password',
+ 'params' => ['class' => $password_param, 'min' => 5, 'equal' => 'password', 'error_txt' => 'Podane hasła są różne']
+ ]
+];
+$grid->actions = [
+ 'save' => ['url' => '/admin/users/user_save/', 'back_url' => '/admin/users/view_list/'],
+ 'cancel' => ['url' => '/admin/users/view_list/']
+];
+$grid->external_code = $out;
+$grid->persist_edit = true;
+echo $grid->draw();
+?>
+
+
\ No newline at end of file
diff --git a/admin/templates/users/users-list.php b/admin/templates/users/users-list.php
new file mode 100644
index 0000000..f1623fd
--- /dev/null
+++ b/admin/templates/users/users-list.php
@@ -0,0 +1,47 @@
+ gdb_opt = $gdb;
+$grid -> order = [ 'column' => 'login', 'type' => 'ASC' ];
+$grid -> where = [ 'id[!]' => 1 ];
+$grid -> search = [
+ [ 'name' => 'Login', 'db' => 'login', 'type' => 'text' ],
+ [ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
+ ];
+$grid -> columns_view = [
+ [
+ 'name' => 'Lp.',
+ 'th' => [ 'class' => 'g-lp' ],
+ 'td' => [ 'class' => 'g-center' ],
+ 'autoincrement' => true
+ ],
+ [
+ 'name' => 'Aktywny',
+ 'db' => 'status',
+ 'replace' => [ 'array' => [ 0 => '
nie ', 1 => 'tak' ] ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Login',
+ 'db' => 'login',
+ 'sort' => true
+ ],
+ [
+ 'name' => 'Edytuj',
+ 'action' => [ 'type' => 'edit', 'url' => '/admin/users/user_edit/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ],
+ [
+ 'name' => 'Usuń',
+ 'action' => [ 'type' => 'delete', 'url' => '/admin/users/user_delete/id=[id]' ],
+ 'th' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ],
+ 'td' => [ 'class' => 'g-center' ]
+ ]
+ ];
+$grid -> buttons = [
+ [ 'label' => 'Dodaj użytkownika', 'url' => '/admin/users/user_edit/', 'icon' => 'fa-plus-circle', 'class' => 'btn-success' ]
+ ];
+echo $grid -> draw();
\ No newline at end of file
diff --git a/ajax.php b/ajax.php
new file mode 100644
index 0000000..78caebb
--- /dev/null
+++ b/ajax.php
@@ -0,0 +1,207 @@
+ 'mysql',
+ 'database_name' => $database['name'],
+ 'server' => $database['host'],
+ 'username' => $database['user'],
+ 'password' => $database['password'],
+ 'charset' => 'utf8'
+ ] );
+
+if ( !$lang_id = \S::get_session( 'current-lang' ) )
+{
+ $lang_id = \front\factory\Languages::default_language();
+ \S::set_session( 'current-lang', $lang_id );
+}
+
+if ( !$lang = \S::get_session( 'lang' ) )
+{
+ $lang = \front\factory\Languages::lang_translations();
+ \S::set_session( 'lang', $lang );
+}
+
+\front\controls\Site::check_url_params();
+
+if ( !$settings = \S::get_session( 'settings' ) )
+{
+ $settings = \front\factory\Settings::settings_details();
+ \S::set_session( 'settings', $settings );
+}
+
+if ( \S::get( 'a' ) == 'calendar' )
+{
+ echo \front\view\Site::calendar( \S::get( 'month' ), \S::get( 'year' ), true );
+ exit;
+}
+
+if ( \S::get( 'a' ) == 'widget-phone-now' )
+{
+ $response = [ 'status' => 'error' ];
+
+ if ( \S::get( 'phone' ) )
+ {
+ if ( \S::send_email(
+ $settings['contact_email'],
+ 'Prośba o oddzwonienie',
+ '
Nr telefonu: ' . \S::get( 'phone' ) . '
',
+ $settings['contact_email']
+ ) )
+ $response = [ 'status' => 'ok' ];
+ }
+ echo json_encode( $response );
+ exit;
+}
+
+if ( \S::get( 'a' ) == 'contact_form' )
+{
+ $response = [ 'status' => 'error' ];
+
+ if ( \S::get( 'email' ) )
+ {
+ if ( \S::send_email(
+ $settings['contact_email'],
+ \S::get( 'subject' ),
+ '
Nr telefonu: ' . \S::get( 'phone' ) . '
'
+ . '
Email: ' . \S::get( 'email' ) . '
'
+ . '
' . \S::get( 'text' ) . '
',
+ \S::get( 'email' )
+ ) )
+ {
+ $mdb -> insert( 'pp_contact_emails', [
+ 'email' => \S::get( 'email' ),
+ 'phone' => \S::get('phone' ),
+ 'title' => \S::get( 'subject' ),
+ 'mail' => \S::get( 'text' ),
+ 'add_date' => date("Y-m-d, H:i")
+ ]);
+
+ $response = [ 'status' => 'ok' ];
+ }
+ }
+ echo json_encode( $response );
+ exit;
+}
+if ( \S::get( 'a' ) == 'cookie_close' )
+{
+ setcookie( "cookie_information", "true", mktime( 0, 0, 0, 12, 31, 2115 ) );
+ exit;
+}
+
+if ( \S::get( 'a' ) == 'banner_close' )
+{
+ \S::set_session( 'banner_close', true );
+ exit;
+}
+
+if ( \S::get( 'a' ) == 'contrast' )
+{
+ \S::set_session( 'contrast', !\S::get_session( 'contrast' ) );
+ exit;
+}
+
+if ( \S::get( 'a' ) == 'article_unlock' )
+{
+ \front\controls\Articles::article_unlock(
+ \S::get( 'password' ),
+ \S::get( 'article_id' )
+ );
+ exit;
+}
+
+if ( \S::get( 'a' ) == 'pixieset_gallery_download' ) {
+ $url = \front\controls\Articles::images_download( \S::get( 'hash' ) );
+ echo json_encode( [ 'url' => $url ] );
+ exit;
+}
+
+if ( \S::get( 'a' ) == 'pixieset_image_favorite' ) {
+ $status = \front\controls\Articles::pixieset_image_favorite( \S::get( 'image_id' ), \S::get( 'hash' ) );
+ echo json_encode( [ 'status' => $status ] );
+ exit;
+}
+
+if ( \S::get( 'a' ) == 'pixieset_save_favorite_images' ) {
+ $result = \front\controls\Articles::pixieset_save_favorite_images( \S::get( 'hash' ) );
+ echo json_encode( [ 'status' => $result ] );
+ exit;
+}
+
+if ( \S::get( 'a' ) == 'inline-edit-save' )
+{
+ if ( strpos( \S::get( 'element_id' ), 'scontainer' ) !== false )
+ {
+ $scontainer_id = str_replace( [ 'scontainer-', '-content' ], [ '', '' ], \S::get( 'element_id' ) );
+ \Scontainer::updateByFrontEditor( $scontainer_id, \S::get( 'element_value' ), \S::get( 'lang_id' ) );
+ \S::delete_cache();
+ exit;
+ }
+ else
+ {
+ if ( \S::get( 'alltemplates' ) )
+ $layouts = $mdb -> select( 'pp_layouts', 'id' );
+ else
+ $layouts[] = \S::get( 'layout_id' );
+
+ foreach ( $layouts as $layout_id )
+ {
+ $layout = \front\factory\Layouts::layout_details( $layout_id );
+ $html = $layout['html'];
+
+ if ( strpos( $html, '[META_INDEX]' ) !== false )
+ {
+ $meta_index = true;
+ $html = str_replace( '[META_INDEX]', '', $html );
+ }
+
+ if ( strpos( $html, '[CSS]' ) !== false )
+ {
+ $css = true;
+ $html = str_replace( '[CSS]', '', $html );
+ }
+
+ if ( strpos( $html, '[JAVA_SCRIPT]' ) !== false )
+ {
+ $java_script = true;
+ $html = str_replace( '[JAVA_SCRIPT]', '', $html );
+ }
+
+ $html = preg_replace( '/^[ \t]*[\r\n]+/m', '', $html );
+
+ \S::suSetHtmlById( $html, \S::get( 'element_id' ), \S::get( 'element_value' ) );
+
+ if ( $meta_index )
+ $html = str_replace( '', ' [META_INDEX]' . PHP_EOL . '', $html );
+
+ if ( $css )
+ $html = str_replace( '', ' [CSS]' . PHP_EOL . '', $html );
+
+ if ( $java_script )
+ $html = str_replace( '', ' [JAVA_SCRIPT]' . PHP_EOL . '', $html );
+
+ $html = str_replace( [ '%5B', '%5D', '%20', '%24' ], [ '[', ']', ' ', '$' ], $html );
+
+ $mdb -> update( 'pp_layouts', [ 'html' => $html ], [ 'id' => $layout_id ] );
+ }
+ }
+
+ \S::delete_cache();
+}
+?>
diff --git a/autoload/admin/class.Site.php b/autoload/admin/class.Site.php
new file mode 100644
index 0000000..db3c613
--- /dev/null
+++ b/autoload/admin/class.Site.php
@@ -0,0 +1,71 @@
+ $login , hash => $password ];
+ $value = json_encode( $value );
+
+ setcookie( $cookie_name, $value, time() +(86400 * 14), "/", $domain );
+ }
+ \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.' );
+ }
+ header( 'Location: /admin/articles/view_list/' );
+ exit;
+ break;
+
+ case 'user-logout':
+
+ setcookie( $cookie_name, "", time() -(86400), "/", $domain );
+ 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 );
+
+ $action = \S::get( 'action' );
+
+ 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.' );
+ return false;
+ }
+ }
+}
diff --git a/autoload/admin/controls/class.Articles.php b/autoload/admin/controls/class.Articles.php
new file mode 100644
index 0000000..96c2581
--- /dev/null
+++ b/autoload/admin/controls/class.Articles.php
@@ -0,0 +1,147 @@
+ 'error', 'msg' => 'Nie masz uprawnień' ] );
+ exit;
+ }
+
+ if ( \admin\factory\Articles::gallery_order_save( \S::get( 'article_id' ), \S::get( 'order' ) ) )
+ echo json_encode( [ 'status' => 'ok', 'msg' => 'Artykuł został zapisany.' ] );
+
+ exit;
+ }
+
+ static public function article_url_browser()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \Tpl::view( 'articles/articles-browse-list', [
+ 'modal' => true
+ ] );
+ }
+
+ public static function browse_list()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Articles::browse_list();
+ }
+
+ public static function article_delete()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ if ( \admin\factory\Articles::articles_set_archive( \S::get( 'id' ) ) )
+ \S::alert( 'Artykuł został przeniesiony do archiwum.' );
+
+ header( 'Location: /admin/articles/view_list/' );
+ exit;
+ }
+
+ public static function article_save()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'article_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania artykułu wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( is_array( $values ) ) foreach ( $values as $key => $val )
+ {
+ if ( strpos( $key, 'ap_' ) !== false )
+ $params[$key] = $val;
+ }
+ $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_table_of_contents'], $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['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
+ ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Artykuł został zapisany.', 'id' => $id ];
+
+ \admin\factory\Articles::insert_missing_hash();
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ public static function article_edit()
+ {
+ global $user;
+
+ 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()
+ ] );
+ }
+
+ public static function view_list()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
+ return \S::alert( 'Brak uprawnień.' );
+
+ return \admin\view\Articles::articles_list();
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/controls/class.ArticlesArchive.php b/autoload/admin/controls/class.ArticlesArchive.php
new file mode 100644
index 0000000..def5ffa
--- /dev/null
+++ b/autoload/admin/controls/class.ArticlesArchive.php
@@ -0,0 +1,44 @@
+ 'error', 'msg' => 'Podczas usuwania autora wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( \admin\factory\Authors::delete_author( \S::get( 'id' ) ) )
+ \S::alert( 'Autor został usunięty.' );
+
+ header( 'Location: /admin/authors/view_list/' );
+ exit;
+ }
+
+ // zapis autora
+ static public function save()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania autora wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( $author_id = \admin\factory\Authors::save_author( $values['id'], $values['author'], $values['image'], $values['description'] ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Autor został zapisany.', 'id' => $author_id ];
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ // edycja autora
+ static public function edit()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \Tpl::view( 'authors/author-edit', [
+ 'author' => \admin\factory\Authors::get_single_author( \S::get( 'id' ) ),
+ 'languages' => \admin\factory\Languages::languages_list()
+ ] );
+ }
+
+ //autorzy artykułów
+ static public function view_list()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \Tpl::view( 'authors/view-list' );
+ }
+}
\ No newline at end of file
diff --git a/autoload/admin/controls/class.Backups.php b/autoload/admin/controls/class.Backups.php
new file mode 100644
index 0000000..9d7b184
--- /dev/null
+++ b/autoload/admin/controls/class.Backups.php
@@ -0,0 +1,66 @@
+ 'error', 'msg' => 'Podczas zapisywania baneru wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( $banner_id = \admin\factory\Banners::banner_save( $values['id'], $values['name'], $values['status'], $values['date_start'], $values['date_end'],
+ $values['home_page'], $values['src'], $values['url'], $values['html'], $values['text'] ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Baner został zapisany.', 'id' => $banner_id ];
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ public static function banner_edit()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'baners_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Banners::banner_edit(
+ \admin\factory\Banners::banner_details(
+ \S::get( 'id' )
+ ),
+ \admin\factory\Languages::languages_list()
+ );
+ }
+
+ public static function view_list()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'baners_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Banners::banners_list();
+ }
+
+}
+?>
diff --git a/autoload/admin/controls/class.Emails.php b/autoload/admin/controls/class.Emails.php
new file mode 100644
index 0000000..1e32d3b
--- /dev/null
+++ b/autoload/admin/controls/class.Emails.php
@@ -0,0 +1,28 @@
+
diff --git a/autoload/admin/controls/class.Languages.php b/autoload/admin/controls/class.Languages.php
new file mode 100644
index 0000000..4624f42
--- /dev/null
+++ b/autoload/admin/controls/class.Languages.php
@@ -0,0 +1,126 @@
+
+namespace admin\controls;
+
+class Languages
+{
+ public static function language_delete()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ if ( \admin\factory\Languages::language_delete( \S::get( 'id' ) ) )
+ \S::alert( 'Język został usunięty.' );
+ header( 'Location: /admin/languages/view_list/' );
+ exit;
+ }
+
+ public static function language_save()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania języka wystąpił błąd. Proszę spróbować ponownie.' ];
+
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( \admin\factory\Languages::language_save(
+ $values['id'], $values['name'], $values['status'], $values['start'], $values['o'], $values['domain'], $values['main_domain']
+ ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Język został zapisany.', 'id' => $id ];
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ public static function language_edit()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Languages::language_edit(
+ \admin\factory\Languages::language_details(
+ \S::get( 'id' )
+ ), \admin\factory\Languages::max_order()
+ );
+ }
+
+ public static function view_list()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Languages::languages_list();
+ }
+
+ public static function translation_delete()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ if ( \admin\factory\Languages::translation_delete( \S::get( 'id' ) ) )
+ \S::alert( 'Tłumaczenie zostało usunięte.' );
+ header( 'Location: /admin/languages/translation_list/' );
+ exit;
+ }
+
+ public static function translation_save()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania tłumaczenia wystąpił błąd. Proszę spróbować ponownie.' ];
+
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ $languages_list = \admin\factory\Languages::languages_list();
+ if ( is_array( $languages_list ) and !empty( $languages_list ) ) foreach ( $languages_list as $language )
+ {
+ \S::delete_session( 'lang-' . $language['id'] );
+ $languages[ $language['id'] ] = $values[ $language['id'] ];
+ }
+
+ if ( $id = \admin\factory\Languages::translation_save( $values['id'], $values['text'], $languages ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Tłumaczenie zostało zapisane.', 'id' => $id ];
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ public static function translation_edit()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'language_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Languages::translation_edit(
+ \admin\factory\Languages::translation_details( \S::get( 'id' ) ),
+ \admin\factory\Languages::languages_list()
+ );
+ }
+
+ public static function translation_list()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'language_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Languages::translations_list();
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/controls/class.Layouts.php b/autoload/admin/controls/class.Layouts.php
new file mode 100644
index 0000000..0f62eab
--- /dev/null
+++ b/autoload/admin/controls/class.Layouts.php
@@ -0,0 +1,59 @@
+ 'error', 'msg' => 'Podczas zapisywania szablonu wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( $id = \admin\factory\Layouts::layout_save( $values['id'], $values['name'], $values['status'], $values['pages'], $values['html'], $values['css'], $values['js'], $values['m_html'], $values['m_css'], $values['m_js'] ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Szablon został zapisany.', 'id' => $id ];
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ public static function layout_edit()
+ {
+ global $user;
+ if( !\admin\factory\Users::check_privileges( 'template_administration', $user['id']))
+ return \S::alert('Nie masz uprawnień');
+
+ return \admin\view\Layouts::layout_edit(
+ \admin\factory\Layouts::layout_details(
+ \S::get( 'id' )
+ ),
+ \admin\factory\Layouts::menus_list()
+ );
+ }
+
+ public static function view_list()
+ {
+ global $user;
+ if( !\admin\factory\Users::check_privileges( 'template_administration', $user['id']))
+ return \S::alert('Nie masz uprawnień');
+
+ return \admin\view\Layouts::layouts_list();
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/controls/class.Newsletter.php b/autoload/admin/controls/class.Newsletter.php
new file mode 100644
index 0000000..6dc8dc8
--- /dev/null
+++ b/autoload/admin/controls/class.Newsletter.php
@@ -0,0 +1,167 @@
+ 'ok', 'msg' => 'Emaile zostały zaimportowane.' ] );
+ exit;
+ }
+
+ public static function import()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \Tpl::view( 'newsletter/import' );
+ }
+
+ public static function emails_list()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
+ return \S::alert('Nie masz uprawnień');
+
+ return \admin\view\Newsletter::emails_list();
+ }
+
+ public static function send()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ if ( \admin\factory\Newsletter::send( \S::get( 'dates' ), \S::get( 'template' ), \S::get( 'only_once' ) ) )
+ \S::alert( 'Newsletter został dodany do kolejki wysyłania.' );
+
+ header( 'Location: /admin/newsletter/prepare/' );
+ exit;
+ }
+
+ public static function prepare()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
+ return \S::alert('Nie masz uprawnień');
+
+ return \admin\view\Newsletter::prepare(
+ \admin\factory\Newsletter::templates_list()
+ );
+ }
+
+ public static function settings_save()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ \admin\factory\Settings::settings_update( 'newsletter_footer_1', $values['newsletter_footer_1'] );
+ \admin\factory\Settings::settings_update( 'newsletter_footer_2', $values['newsletter_footer_2'] );
+ \admin\factory\Settings::settings_update( 'newsletter_header', $values['newsletter_header'] );
+
+ \S::alert( 'Ustawienia zostały zapisane.' );
+
+ echo json_encode( [ 'status' => 'ok', 'msg' => 'Ustawienia zostały zapisane.' ] );
+ exit;
+ }
+
+ public static function settings()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id']))
+ return \S::alert('Nie masz uprawnień');
+
+ return \admin\view\Newsletter::settings(
+ \admin\factory\Settings::settings_details()
+ );
+ }
+
+ public static function email_templates_user()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
+ return \S::alert('Nie masz uprawnień');
+
+ return \admin\view\Newsletter::email_templates_user();
+ }
+
+ public static function email_templates_admin()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
+ return \S::alert('Nie masz uprawnień');
+
+ return \admin\view\Newsletter::email_templates_admin();
+ }
+
+ public static function email_template_delete()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ $is_admin = \admin\factory\Newsletter::is_admin_template( \S::get( 'id' ) );
+
+ if ( !$is_admin and \admin\factory\Newsletter::newsletter_template_delete( \S::get( 'id' ) ) )
+ \S::alert( 'Szablon newslettera został usunięty.' );
+
+ if ( $is_admin )
+ header( 'Location: /admin/newsletter/email_templates_admin/' );
+ else
+ header( 'Location: /admin/newsletter/email_templates_user/' );
+ exit;
+ }
+
+ public static function email_template_edit()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id']))
+ return \S::alert('Nie masz uprawnień');
+
+ return \admin\view\Newsletter::email_template_edit(
+ \admin\factory\Newsletter::email_template_detalis(
+ \S::get( 'id' )
+ )
+ );
+ }
+
+ public static function template_save()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'newsletter_administration', $user['id']))
+ return \S::alert('Nie masz uprawnień');
+
+ $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( $id = \admin\factory\Newsletter::template_save( $values['id'], $values['name'], $values['text'] ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Zmiany zostały zapisane.', 'id' => $id ];
+
+ echo json_encode( $response );
+ exit;
+ }
+}
diff --git a/autoload/admin/controls/class.Pages.php b/autoload/admin/controls/class.Pages.php
new file mode 100644
index 0000000..423fa1b
--- /dev/null
+++ b/autoload/admin/controls/class.Pages.php
@@ -0,0 +1,155 @@
+ \admin\factory\Pages::menus_list(),
+ 'modal' => true
+ ] );
+ }
+
+ static public function browse_list()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'page_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Pages::browse_list(
+ \admin\factory\Pages::menus_list()
+ );
+ }
+
+ public static function menu_delete()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'page_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ if ( \admin\factory\Pages::menu_delete( \S::get( 'id' ) ) )
+ \S::set_message( 'Menu zostało usunięte.' );
+ else
+ \S::alert( 'Podczas usuwania menu wystąpił błąd. Aby usunąć menu nie może ono posiadać przypiętych stron.' );
+ header( 'Location: /admin/pages/view_list/' );
+ exit;
+ }
+
+ public static function page_delete()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'page_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ if ( \admin\factory\Pages::page_delete( \S::get( 'id' ) ) )
+ \S::set_message( 'Strona została usunięta.' );
+ else
+ \S::alert( 'Podczas usuwania strony wystąpił błąd. Aby usunąć stronę nie może ona posiadać przypiętych podstron.' );
+
+ header( 'Location: /admin/pages/view_list/' );
+ exit;
+ }
+
+ public static function page_articles()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'page_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Pages::page_articles( \S::get( 'id' ),
+ \admin\factory\Pages::page_articles( \S::get( 'id' ) ) );
+ }
+
+ public static function page_save()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'page_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+ $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania strony wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( $id = \admin\factory\Pages::page_save(
+ $values['id'], $values['title'], $values['seo_link'], $values['meta_title'], $values['meta_description'], $values['meta_keywords'], $values['menu_id'],
+ $values['parent_id'], $values['page_type'], $values['sort_type'], $values['layout_id'], $values['articles_limit'], $values['show_title'],
+ $values['status'], $values['link'], $values['noindex'], $values['start'], $values['site_title'], $values['block_direct_access'], $values['cache'], $values['canonical']
+ ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Strona została zapisana.', 'id' => $id ];
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ public static function page_edit()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'page_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Pages::page_edit(
+ \admin\factory\Pages::page_details(
+ \S::get( 'id' )
+ ), \S::get( 'pid' ), \S::get( 'menu_id' ),
+ \admin\factory\Pages::menu_lists(),
+ \admin\factory\Layouts::layouts_list(),
+ \admin\factory\Languages::languages_list(),
+ \admin\factory\Settings::settings_details()
+ );
+ }
+
+ public static function menu_save()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'page_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania menu wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( \admin\factory\Pages::menu_save( $values['id'], $values['name'],
+ $values['status'] ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Menu zostało zapisane.' ];
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ public static function menu_edit()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'page_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Pages::menu_edit(
+ \admin\factory\Pages::menu_details( \S::get( 'id' ) )
+ );
+ }
+
+ public static function view_list()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'page_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Pages::pages_list(
+ \admin\factory\Pages::menus_list()
+ );
+ }
+
+}
+?>
diff --git a/autoload/admin/controls/class.Scontainers.php b/autoload/admin/controls/class.Scontainers.php
new file mode 100644
index 0000000..e9dd71f
--- /dev/null
+++ b/autoload/admin/controls/class.Scontainers.php
@@ -0,0 +1,75 @@
+ 'error', 'msg' => 'Podczas zapisywania kontenera wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( $id = \admin\factory\Scontainers::container_save( $values['id'], $values['title'], $values['text'], $values['status'], $values['show_title'],
+ $values['src'], $values['html']
+ ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Kontener został zapisany.', 'id' => $id ];
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ public static function container_edit()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'scontainers_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Scontainers::container_edit(
+ \admin\factory\Scontainers::container_details(
+ \S::get( 'id' )
+ ), \admin\factory\Languages::languages_list()
+ );
+ }
+
+ public static function view_list()
+ {
+ global $user;
+ if ( !\admin\factory\Users::check_privileges( 'scontainers_administration',
+ $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\Scontainers::containers_list();
+ }
+
+}
\ No newline at end of file
diff --git a/autoload/admin/controls/class.SeoAdditional.php b/autoload/admin/controls/class.SeoAdditional.php
new file mode 100644
index 0000000..f1246d5
--- /dev/null
+++ b/autoload/admin/controls/class.SeoAdditional.php
@@ -0,0 +1,59 @@
+ 'error', 'msg' => 'Podczas zapisywania elementu wystąpił błąd. Proszę spróbować ponownie.' ];
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ if ( $id = \admin\factory\SeoAdditional::element_save( $values['id'], $values['url'], $values['status'], $values['title'], $values['keywords'], $values['description'], $values['text'] ) )
+ $response = [ 'status' => 'ok', 'msg' => 'Zmiany zostały zapisane.', 'id' => $id ];
+
+ echo json_encode( $response );
+ exit;
+ }
+
+ public static function element_edit()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'seo_administration', $user['id']))
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\SeoAdditional::element_edit(
+ \admin\factory\SeoAdditional::element_details(
+ \S::get( 'id' )
+ )
+ );
+ }
+
+ public static function main_view()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'seo_administration', $user['id'] ) )
+ return \S::alert( 'Nie masz uprawnień' );
+
+ return \admin\view\SeoAdditional::main_view();
+ }
+}
diff --git a/autoload/admin/controls/class.Settings.php b/autoload/admin/controls/class.Settings.php
new file mode 100644
index 0000000..ba01075
--- /dev/null
+++ b/autoload/admin/controls/class.Settings.php
@@ -0,0 +1,77 @@
+
+namespace admin\controls;
+
+class Settings
+{
+ public static function settings_save()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'settings_administration', $user['id'] ) )
+ return \S::alert('Nie masz uprawnień');
+
+ $settings = \admin\factory\Settings::settings_details();
+ $values = \S::json_to_array( \S::get( 'values' ) );
+
+ \admin\factory\Settings::settings_save(
+ $values['firm_name'],
+ $values['firm_adress'],
+ $values['additional_info'],
+ $values['contact_form'] == 'on' ? 1 : 0,
+ $values['contact_email'],
+ $values['email_host'],
+ $values['email_port'],
+ $values['email_login'],
+ $values['email_password'],
+ $values['google_maps'],
+ $values['facebook_link'],
+ $values['statistic_code'],
+ $values['htaccess'],
+ $values['robots'],
+ $settings['newsletter_header'],
+ $settings['newsletter_footer_1'],
+ $settings['newsletter_footer_2'],
+ $values['google_map_key'],
+ $values['google_search_console'],
+ $values['update'],
+ $values['devel'],
+ $values['news_limit'],
+ $values['visit_counter'],
+ $values['calendar'],
+ $values['tags'],
+ $values['ssl'],
+ $values['mysql_debug'],
+ $values['htaccess_cache'],
+ $settings['visits'],
+ $values['links_structure'],
+ $values['link_version'],
+ $values['widget_phone'],
+ $values['update_key']
+ );
+
+ \admin\factory\Settings::settings_update( 'image_px', $values['image_px'] );
+ \admin\factory\Settings::settings_update( 'newsletter_cron', $values['newsletter_cron'] );
+ \admin\factory\Settings::settings_update( 'lazy_loading', $values['lazy_loading'] == 'on' ? 1 : 0 );
+ \admin\factory\Settings::settings_update( 'generate_webp', $values['generate_webp'] == 'on' ? 1 : 0 );
+ \admin\factory\Settings::settings_update( 'contact_form_captcha', $values['contact_form_captcha'] == 'on' ? 1 : 0 );
+ \admin\factory\Settings::settings_update( 'url_version', $values['url_version'] );
+
+ \S::alert( 'Ustawienia zostały zapisane.' );
+
+ echo json_encode( [ 'status' => 'ok', 'msg' => 'Ustawienia zostały zapisane.' ] );
+ exit;
+ }
+
+ public static function view()
+ {
+ global $user;
+
+ if ( !\admin\factory\Users::check_privileges( 'settings_administration', $user['id']))
+ return \S::alert('Nie masz uprawnień');
+
+ return \admin\view\Settings::view(
+ \admin\factory\Settings::settings_details()
+ );
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/controls/class.Update.php b/autoload/admin/controls/class.Update.php
new file mode 100644
index 0000000..13fbfbf
--- /dev/null
+++ b/autoload/admin/controls/class.Update.php
@@ -0,0 +1,29 @@
+
diff --git a/autoload/admin/factory/class.Articles.php b/autoload/admin/factory/class.Articles.php
new file mode 100644
index 0000000..a10b710
--- /dev/null
+++ b/autoload/admin/factory/class.Articles.php
@@ -0,0 +1,695 @@
+ insert( 'pp_articles', [
+ 'show_title' => $article['show_title'],
+ 'show_date_add' => $article['show_date_add'],
+ 'show_date_modify' => $article['show_date_modify'],
+ 'date_add' => date( 'Y-m-d H:i:s' ),
+ 'date_modify' => date( 'Y-m-d H:i:s' ),
+ 'modify_by' => $user['id'],
+ 'layout_id' => $article['layout_id'],
+ 'status' => $article['status'],
+ 'repeat_entry' => $article['repeat_entry'],
+ 'social_icons' => $article['social_icons'],
+ 'date_start' => $article['date_start'],
+ 'date_end' => $article['event_date'],
+ 'priority' => $article['priority'],
+ 'password' => $article['password'],
+ 'pixieset' => $article['pixieset']
+ ] );
+
+ $article_tmp_id = $mdb -> id();
+
+ if ( $article_tmp_id )
+ {
+ foreach ( $article['languages'] as $key => $val )
+ {
+ $mdb -> insert( 'pp_articles_langs', [
+ 'article_id' => $article_tmp_id,
+ 'lang_id' => $key,
+ 'title' => 'Kopia: ' . $val['title'],
+ 'entry' => $val['entry'],
+ 'text' => $val['text'],
+ 'meta_title' => null,
+ 'meta_description' => null,
+ 'meta_keywords' => null,
+ 'seo_link' => null,
+ 'copy_from' => $val['copy_from'],
+ 'block_direct_access' => $val['block_direct_access']
+ ] );
+ }
+
+ foreach ( $article['params'] as $param )
+ {
+ $mdb -> insert( 'pp_articles_additional_values', [
+ 'param_id' => $param['param_id'],
+ 'value' => $param['value'],
+ 'article_id' => $article_tmp_id,
+ 'language_id' => $param['language_id']
+ ] );
+ }
+
+ foreach ( $article['pages'] as $page )
+ {
+ $order = self::max_order() + 1;
+ $mdb -> insert( 'pp_articles_pages', [
+ 'article_id' => $article_tmp_id,
+ 'page_id' => $page,
+ 'o' => (int)$order
+ ] );
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static function insert_missing_hash() {
+ global $mdb;
+
+ if ( $mdb -> count( 'pp_articles', [ 'hash' => null ] ) ) {
+ $rows = $mdb -> select( 'pp_articles', [ 'id', 'date_add' ], [ 'hash' => null ] );
+ if ( is_array( $rows ) ) foreach ( $rows as $row ) {
+ $mdb -> update( 'pp_articles', [ 'hash' => md5( $row['id'] . $row['date_add'] ) ], [ 'id' => $row['id'] ] );
+ }
+ }
+ return true;
+ }
+
+ public static function gallery_order_save( $article_id, $order )
+ {
+ global $mdb;
+
+ $order = explode( ';', $order );
+ if ( is_array( $order ) and !empty( $order ) ) foreach ( $order as $image_id )
+ {
+ $mdb -> update( 'pp_articles_images', [
+ 'o' => $i++
+ ], [
+ 'AND' => [
+ 'article_id' => $article_id,
+ 'id' => $image_id
+ ]
+ ] );
+ }
+ }
+
+ public static function additional_params( $language = 0 )
+ {
+ global $mdb;
+ return $mdb -> select( 'pp_articles_additional_params', '*', [ 'AND' => [ 'status' => 1, 'language' => $language ] ] );
+ }
+
+ public static function image_alt_change( $image_id, $image_alt )
+ {
+ global $mdb;
+ $result = $mdb -> update( 'pp_articles_images', [
+ 'alt' => $image_alt
+ ], [
+ 'id' => $image_id
+ ] );
+ \S::delete_cache();
+ return $result;
+ }
+
+ public static function articles_by_date_add( $date_start, $date_end )
+ {
+ global $mdb;
+
+ $results = $mdb -> query( 'SELECT '
+ . 'id '
+ . 'FROM '
+ . 'pp_articles '
+ . 'WHERE '
+ . 'status = 1 '
+ . 'AND '
+ . 'date_add BETWEEN \'' . $date_start . '\' AND \'' . $date_end . '\' '
+ . 'ORDER BY '
+ . 'date_add DESC' ) -> fetchAll();
+ if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
+ $articles[] = \front\factory\Articles::article_details( $row['id'], 'pl' );
+
+ return $articles;
+ }
+
+ public static function article_url( $article_id )
+ {
+ global $mdb;
+
+ $results = $mdb -> query( "SELECT seo_link FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = " . (int)$article_id . " AND seo_link != '' ORDER BY o ASC LIMIT 1" ) -> fetchAll();
+ if ( !$results[0]['seo_link'] )
+ {
+ $title = self::article_title( $article_id );
+ return 'a-' . $article_id . '-' . \S::seo( $title );
+ }
+ else
+ return $results[0]['seo_link'];
+ }
+
+ public static function article_pages( $article_id )
+ {
+ global $mdb;
+
+ $results = $mdb -> query( "SELECT page_id FROM pp_articles_pages WHERE article_id = " . (int)$article_id ) -> fetchAll();
+ if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
+ {
+ if ( $out == '' )
+ $out .= ' - ';
+
+ $out .= \admin\factory\Pages::page_title( $row['page_id'] );
+
+ if ( end( $results ) != $row )
+ $out .= ' / ';
+ }
+
+ return $out;
+ }
+
+ public static function article_title( $article_id )
+ {
+ global $mdb;
+ $results = $mdb -> query( "SELECT title FROM pp_articles_langs AS pal, pp_langs AS pl WHERE lang_id = pl.id AND article_id = " . (int)$article_id . " AND title != '' ORDER BY o ASC LIMIT 1" ) -> fetchAll();
+ return $results[0]['title'];
+ }
+
+ public static function articles_set_archive( $article_id )
+ {
+ global $mdb;
+ $result = $mdb -> update( 'pp_articles', [ 'status' => -1 ], [ 'id' => (int)$article_id ] );
+ \S::htacces();
+ \S::delete_cache();
+ return $result;
+ }
+
+ public static function file_name_change( $file_id, $file_name )
+ {
+ global $mdb;
+ $mdb -> update( 'pp_articles_files', [ 'name' => $file_name ], [ 'id' => (int)$file_id ] );
+ return true;
+ }
+
+ public static function delete_file( $file_id )
+ {
+ global $mdb;
+ $mdb -> update( 'pp_articles_files', [ 'to_delete' => 1 ], [ 'id' => (int)$file_id ] );
+ return true;
+ }
+ public static function delete_img( $image_id )
+ {
+ global $mdb;
+ $mdb -> update( 'pp_articles_images', [ 'to_delete' => 1 ], [ 'id' => (int)$image_id ] );
+ return true;
+ }
+
+ public static function article_details( $article_id )
+ {
+ global $mdb;
+
+ if ( $article = $mdb -> get( 'pp_articles', '*', [ 'id' => (int)$article_id ] ) )
+ {
+ $results = $mdb -> select( 'pp_articles_langs', '*', [ 'article_id' => (int)$article_id ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ $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['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 ] );
+ }
+
+ return $article;
+ }
+
+ public static function max_order()
+ {
+ global $mdb;
+ return $mdb -> max( 'pp_articles_pages', 'o' );
+ }
+
+ public static function article_save(
+ $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, $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 )
+ {
+
+ global $mdb, $user;
+
+ $event_date = explode( ' - ', $event_date );
+
+ if ( !$article_id )
+ {
+ $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' ),
+ 'modify_by' => $user['id'],
+ 'layout_id' => $layout_id ? (int)$layout_id : null,
+ 'status' => $status == 'on' ? 1 : 0,
+ 'repeat_entry' => $repeat_entry == 'on' ? 1 : 0,
+ 'social_icons' => $social_icons == 'on' ? 1 : 0,
+ 'date_start' => $event_date[0] ? $event_date[0] : null,
+ 'date_end' => $event_date[1] ? $event_date[1] : null,
+ 'priority' => $priority == 'on' ? 1 : 0,
+ 'password' => $password ? $password : null,
+ 'pixieset' => $pixieset,
+ 'id_author' => $id_author ? $id_author : null
+ ] );
+
+ $id = $mdb -> id();
+
+ if ( $id )
+ {
+ $i = 0;
+
+ /* tłumaczenia */
+ $results = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_articles_langs', [
+ 'article_id' => (int)$id,
+ 'lang_id' => $row['id'],
+ 'title' => $title[ $i ] != '' ? $title[ $i ] : null,
+ 'main_image' => $main_image[$i] != '' ? $main_image[$i] : null,
+ 'entry' => $entry[ $i ] != '' ? $entry[ $i ] : null,
+ 'text' => $text[ $i ] != '' ? $text[ $i ] : null,
+ 'table_of_contents' => $table_of_contents[$i] != '' ? $table_of_contents[$i] : null,
+ 'meta_title' => $meta_title[ $i ] != '' ? $meta_title[ $i ] : null,
+ 'meta_description' => $meta_description[ $i ] != '' ? $meta_description[ $i ] : null,
+ 'meta_keywords' => $meta_keywords[ $i ] != '' ? $meta_keywords[ $i ] : null,
+ 'seo_link' => \S::seo( $seo_link[ $i ] ) != '' ? \S::seo( $seo_link[ $i ] ) : null,
+ 'noindex' => $noindex[ $i ],
+ 'copy_from' => $copy_from[ $i ] != '' ? $copy_from[ $i ] : null,
+ 'block_direct_access' => $block_direct_access[ $i ]
+ ] );
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_articles_langs', [
+ 'article_id' => (int)$id,
+ 'lang_id' => $row['id'],
+ 'title' => $title != '' ? $title : null,
+ 'main_image' => $main_image != '' ? $main_image : null,
+ 'entry' => $entry != '' ? $entry : null,
+ 'text' => $text != '' ? $text : null,
+ 'table_of_contents' => $table_of_contents != '' ? $table_of_contents : null,
+ 'meta_title' => $meta_title != '' ? $meta_title : null,
+ 'meta_description' => $meta_description != '' ? $meta_description : null,
+ 'meta_keywords' => $meta_keywords != '' ? $meta_keywords : null,
+ 'seo_link' => \S::seo( $seo_link ) != '' ? \S::seo( $seo_link ) : null,
+ 'noindex' => $noindex,
+ 'copy_from' => $copy_from != '' ? $copy_from : null,
+ 'block_direct_access' => $block_direct_access
+ ] );
+ }
+
+ /* parametry bez wersji językowych */
+ $results = $mdb -> select( 'pp_articles_additional_params', '*', [ 'AND' => [ 'status' => 1, 'language' => 0 ] ] );
+ if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_articles_additional_values', [
+ 'param_id' => $row['id'],
+ 'value' => $params[ 'ap_' . $row['name'] ],
+ 'article_id' => (int)$id,
+ 'language_id' => null
+ ] );
+ }
+
+ /* strony */
+ if ( is_array( $pages ) ) foreach ( $pages as $page )
+ {
+ $order = self::max_order() + 1;
+
+ $mdb -> insert( 'pp_articles_pages', [
+ 'article_id' => (int)$id,
+ 'page_id' => (int)$page,
+ 'o' => (int)$order
+ ] );
+ }
+ else if ( $pages )
+ {
+ $order = self::max_order() + 1;
+
+ $mdb -> insert( 'pp_articles_pages', [
+ 'article_id' => (int)$id,
+ 'page_id' => (int)$pages,
+ 'o' => (int)$order
+ ] );
+ }
+
+ /* pliki */
+ $results = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => null ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ $dir = '/upload/article_files/article_' . $id;
+
+ $new_file_name = str_replace( '/upload/article_files/tmp', $dir, $row['src'] );
+
+ if ( file_exists( '..' . $row['src'] ) )
+ {
+ if ( !is_dir( '../' . $dir ) and $created !== true )
+ {
+ if ( mkdir( '../' . $dir, 0755, true ) )
+ $created = true;
+ }
+ rename( '..' . $row['src'], '..' . $new_file_name );
+ }
+
+ $mdb -> update( 'pp_articles_files', [ 'src' => $new_file_name, 'article_id' => $id ], [ 'id' => $row['id'] ] );
+ }
+
+ $created = false;
+
+ /* zdjęcia */
+ $results = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => null ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ $dir = '/upload/article_images/article_' . $id;
+
+ $new_file_name = str_replace( '/upload/article_images/tmp', $dir, $row['src'] );
+
+ if ( file_exists( '../' . $new_file_name ) )
+ {
+ $ext = strrpos( $new_file_name, '.' );
+ $fileName_a = substr( $new_file_name, 0, $ext );
+ $fileName_b = substr( $new_file_name, $ext );
+
+ $count = 1;
+
+ while ( file_exists( '../' . $fileName_a . '_' . $count . $fileName_b ) )
+ $count++;
+
+ $new_file_name = $fileName_a . '_' . $count . $fileName_b;
+ }
+
+ if ( file_exists( '..' . $row['src'] ) )
+ {
+ if ( !is_dir( '../' . $dir ) and $created !== true )
+ {
+ if ( mkdir( '../' . $dir, 0755, true ) )
+ $created = true;
+ }
+ rename( '..' . $row['src'], '..' . $new_file_name );
+ }
+
+ $mdb -> update( 'pp_articles_images', [ 'src' => $new_file_name, 'article_id' => (int)$id ], [ 'id' => $row['id'] ] );
+ }
+
+ /* tagi */
+ $tags = explode( ',', $tags );
+ if ( is_array( $tags ) ) foreach ( $tags as $tag )
+ {
+ if ( trim( $tag ) != '' )
+ {
+ $tag_id = $mdb -> get( 'pp_tags', 'id', [ 'name' => $tag ] );
+ if ( !$tag_id )
+ {
+ $mdb -> insert( 'pp_tags', [ 'name' => $tag ] );
+ $tag_id = $mdb -> id();
+ }
+
+ $mdb -> insert( 'pp_articles_tags', [ 'article_id' => (int)$id, 'tag_id' => (int)$tag_id ] );
+ }
+ }
+
+ \S::htacces();
+ \S::delete_cache();
+
+ return $id;
+ }
+ }
+ else
+ {
+ $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,
+ 'show_date_modify' => $show_date_modify == 'on' ? 1 : 0,
+ '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,
+ 'repeat_entry' => $repeat_entry == 'on' ? 1 : 0,
+ 'social_icons' => $social_icons == 'on' ? 1 : 0,
+ 'date_start' => $event_date[0] ? $event_date[0] : null,
+ 'date_end' => $event_date[1] ? $event_date[1] : null,
+ 'priority' => $priority == 'on' ? 1 : 0,
+ 'password' => $password ? $password : null,
+ 'pixieset' => $pixieset,
+ 'id_author' => $id_author ? $id_author : null
+ ], [
+ 'id' => (int)$article_id
+ ] );
+
+ if ( $date_add )
+ $mdb -> update( 'pp_articles', [ 'date_add' => $date_add ], [ 'id' => (int)$article_id ] );
+
+ $i = 0;
+
+ /* tłumaczenia */
+ $mdb -> delete( 'pp_articles_langs', [ 'article_id' => (int)$article_id ] );
+
+ $results = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_articles_langs', [
+ 'article_id' => (int)$article_id,
+ 'lang_id' => $row['id'],
+ 'title' => $title[ $i ] != '' ? $title[ $i ] : null,
+ 'main_image' => $main_image[$i] != '' ? $main_image[$i] : null,
+ 'entry' => $entry[ $i ] != '' ? $entry[ $i ] : null,
+ 'text' => $text[ $i ] != '' ? $text[ $i ] : null,
+ 'table_of_contents' => $table_of_contents[$i] != '' ? $table_of_contents[$i] : null,
+ 'meta_title' => $meta_title[ $i ] != '' ? $meta_title[ $i ] : null,
+ 'meta_description' => $meta_description[ $i ] != '' ? $meta_description[ $i ] : null,
+ 'meta_keywords' => $meta_keywords[ $i ] != '' ? $meta_keywords[ $i ] : null,
+ 'seo_link' => \S::seo( $seo_link[ $i ] ) != '' ? \S::seo( $seo_link[ $i ] ) : null,
+ 'noindex' => $noindex[ $i ],
+ 'copy_from' => $copy_from[ $i ] != '' ? $copy_from[ $i ] : null,
+ 'block_direct_access' => $block_direct_access[ $i ]
+ ] );
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_articles_langs', [
+ 'article_id' => (int)$article_id,
+ 'lang_id' => $row['id'],
+ 'title' => $title != '' ? $title : null,
+ 'main_image' => $main_image != '' ? $main_image : null,
+ 'entry' => $entry != '' ? $entry : null,
+ 'text' => $text != '' ? $text : null,
+ 'table_of_contents' => $table_of_contents != '' ? $table_of_contents : null,
+ 'meta_title' => $meta_title != '' ? $meta_title : null,
+ 'meta_description' => $meta_description != '' ? $meta_description : null,
+ 'meta_keywords' => $meta_keywords != '' ? $meta_keywords : null,
+ 'seo_link' => \S::seo( $seo_link ) != '' ? \S::seo( $seo_link ) : null,
+ 'noindex' => $noindex,
+ 'copy_from' => $copy_from != '' ? $copy_from : null,
+ 'block_direct_access' => $block_direct_access
+ ] );
+ }
+
+ /* dodatkowe parametry */
+ $mdb -> delete( 'pp_articles_additional_values', [ 'article_id' => (int)$article_id ] );
+
+ /* parametry bez wersji językowych */
+ $results = $mdb -> select( 'pp_articles_additional_params', '*', [ 'AND' => [ 'status' => 1, 'language' => 0 ] ] );
+ if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_articles_additional_values', [
+ 'param_id' => $row['id'],
+ 'value' => $params[ 'ap_' . $row['name'] ],
+ 'article_id' => (int)$article_id,
+ 'language_id' => null
+ ] );
+ }
+
+ /* parametry z wersjami językowymi */
+ $results = $mdb -> select( 'pp_articles_additional_params', '*', [ 'AND' => [ 'status' => 1, 'language' => 1 ] ] );
+ if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
+ {
+ $results2 = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results2 ) ) foreach ( $results2 as $row2 )
+ {
+ $mdb -> insert( 'pp_articles_additional_values', [
+ 'param_id' => $row['id'],
+ 'value' => $params[ 'ap_' . $row['name'] . '_' . $row2['id'] ],
+ 'article_id' => (int)$article_id,
+ 'language_id' => $row2['id']
+ ] );
+ }
+ }
+
+ /* strony */
+ $not_in = [ 0 ];
+
+ if ( is_array( $pages ) ) foreach ( $pages as $page )
+ $not_in[] = $page;
+ else if ( $pages )
+ $not_in[] = $pages;
+
+ $mdb -> delete( 'pp_articles_pages', [ 'AND' => [ 'article_id' => (int)$article_id, 'page_id[!]' => $not_in ] ] );
+
+ $pages_tmp = $mdb -> select( 'pp_articles_pages', 'page_id', [ 'article_id' => (int)$article_id ] );
+
+ if ( !is_array( $pages ) )
+ $pages = [ $pages ];
+
+ $pages = array_diff( $pages, $pages_tmp );
+
+ if ( is_array( $pages ) ) foreach ( $pages as $page )
+ {
+ $order = self::max_order() + 1;
+
+ $mdb -> insert( 'pp_articles_pages', [
+ 'article_id' => (int)$article_id,
+ 'page_id' => (int)$page,
+ 'o' => (int)$order
+ ] );
+ }
+
+ /* pliki */
+ $results = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => null ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ $dir = '/upload/article_files/article_' . $article_id;
+
+ $new_file_name = str_replace( '/upload/article_files/tmp', $dir, $row['src'] );
+
+ if ( file_exists( '..' . $row['src'] ) )
+ {
+ if ( !is_dir( '../' . $dir ) and $created !== true )
+ {
+ if ( mkdir( '../' . $dir, 0755, true ) )
+ $created = true;
+ }
+ rename( '..' . $row['src'], '..' . $new_file_name );
+ }
+
+ $mdb -> update( 'pp_articles_files', [ 'src' => $new_file_name, 'article_id' => (int)$article_id ], [ 'id' => $row['id'] ] );
+ }
+
+ $created = false;
+
+ /* zdjęcia */
+ $results = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => null ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ $dir = '/upload/article_images/article_' . $article_id;
+
+ $new_file_name = str_replace( '/upload/article_images/tmp', $dir, $row['src'] );
+
+ if ( file_exists( '../' . $new_file_name ) )
+ {
+ $ext = strrpos( $new_file_name, '.' );
+ $fileName_a = substr( $new_file_name, 0, $ext );
+ $fileName_b = substr( $new_file_name, $ext );
+
+ $count = 1;
+
+ while ( file_exists( '../' . $fileName_a . '_' . $count . $fileName_b ) )
+ $count++;
+
+ $new_file_name = $fileName_a . '_' . $count . $fileName_b;
+ }
+
+ if ( file_exists( '..' . $row['src'] ) )
+ {
+ if ( !is_dir( '../' . $dir ) and $created !== true )
+ {
+ if ( mkdir( '../' . $dir, 0755, true ) )
+ $created = true;
+ }
+ rename( '..' . $row['src'], '..' . $new_file_name );
+ }
+
+ $mdb -> update( 'pp_articles_images', [ 'src' => $new_file_name, 'article_id' => (int)$article_id ], [ 'id' => $row['id'] ] );
+ }
+
+ $results = $mdb -> select( 'pp_articles_images', '*', [ 'AND' => [ 'article_id' => (int)$article_id, 'to_delete' => 1 ] ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ if ( file_exists( '../' . $row['src'] ) )
+ unlink( '../' . $row['src'] );
+ }
+
+ $mdb -> delete( 'pp_articles_images', [ 'AND' => [ 'article_id' => (int)$article_id, 'to_delete' => 1 ] ] );
+
+ $results = $mdb -> select( 'pp_articles_files', '*', [ 'AND' => [ 'article_id' => (int)$article_id, 'to_delete' => 1 ] ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ if ( file_exists( '../' . $row['src'] ) )
+ unlink( '../' . $row['src'] );
+ }
+
+ $mdb -> delete( 'pp_articles_files', [ 'AND' => [ 'article_id' => (int)$article_id, 'to_delete' => 1 ] ] );
+
+ /* tagi */
+ $mdb -> delete( 'pp_articles_tags', [ 'article_id' => (int)$article_id ] );
+
+ $tags = explode( ',', $tags );
+ if ( is_array( $tags ) ) foreach ( $tags as $tag )
+ {
+ if ( trim( $tag ) != '' )
+ {
+ $tag_id = $mdb -> get( 'pp_tags', 'id', [ 'name' => $tag ] );
+ if ( !$tag_id )
+ {
+ $mdb -> insert( 'pp_tags', [ 'name' => $tag ] );
+ $tag_id = $mdb -> id();
+ }
+
+ $mdb -> insert( 'pp_articles_tags', [ 'article_id' => (int)$article_id, 'tag_id' => (int)$tag_id ] );
+ }
+ }
+
+ \S::htacces();
+ \S::delete_cache();
+ return $article_id;
+ }
+ }
+
+ public static function delete_nonassigned_files()
+ {
+ global $mdb;
+
+ $results = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => null ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ if ( file_exists( '../' . $row['src'] ) )
+ unlink( '../' . $row['src'] );
+ }
+
+ $mdb -> delete( 'pp_articles_files', [ 'article_id' => null ] );
+ }
+
+ public static function delete_nonassigned_images()
+ {
+ global $mdb;
+
+ $results = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => null ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ if ( file_exists( '../' . $row['src'] ) )
+ unlink( '../' . $row['src'] );
+ }
+
+ $mdb -> delete( 'pp_articles_images', [ 'article_id' => null ] );
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/factory/class.ArticlesArchive.php b/autoload/admin/factory/class.ArticlesArchive.php
new file mode 100644
index 0000000..c43dbf2
--- /dev/null
+++ b/autoload/admin/factory/class.ArticlesArchive.php
@@ -0,0 +1,29 @@
+ update( 'pp_articles', [ 'status' => 0 ], [ 'id' => (int)$article_id ] );
+
+ }
+
+ public static function article_delete( $article_id )
+ {
+ global $mdb;
+ $mdb -> delete( 'pp_articles_pages', [ 'article_id' => (int)$article_id ] );
+ $mdb -> delete( 'pp_articles_langs', [ 'article_id' => (int)$article_id ] );
+ $mdb -> delete( 'pp_articles_images', [ 'article_id' => (int)$article_id ] );
+ $mdb -> delete( 'pp_articles_files', [ 'article_id' => (int)$article_id ] );
+ $mdb -> delete( 'pp_articles_tags', [ 'article_id' => (int)$article_id ] );
+ $mdb -> delete( 'pp_articles', [ 'id' => (int)$article_id ] );
+
+ \S::delete_dir( '../upload/article_images/article_' . (int)$article_id . '/' );
+ \S::delete_dir( '../upload/article_files/article_' . (int)$article_id . '/' );
+
+ return true;
+
+ }
+}
diff --git a/autoload/admin/factory/class.Authors.php b/autoload/admin/factory/class.Authors.php
new file mode 100644
index 0000000..5c05c7a
--- /dev/null
+++ b/autoload/admin/factory/class.Authors.php
@@ -0,0 +1,117 @@
+
+namespace admin\factory;
+class Authors
+{
+ // prosta lista autorów
+ static public function get_simple_list()
+ {
+ global $mdb;
+ return $mdb -> select( 'pp_authors', '*', [ 'ORDER' => [ 'author' => 'ASC' ] ] );
+ }
+
+ // usunięcie autora
+ static public function delete_author( $id_author )
+ {
+ global $mdb;
+
+ $result = $mdb -> delete( 'pp_authors', [ 'id' => (int)$id_author ] );
+ \S::delete_cache();
+
+ return $result;
+ }
+
+ // zapis autora
+ static public function save_author( $id_author, $author, $image, $description )
+ {
+ global $mdb;
+
+ if ( !$id_author )
+ {
+ $mdb -> insert( 'pp_authors', [
+ 'author' => $author,
+ 'image' => $image
+ ] );
+
+ $id = $mdb -> id();
+
+ if ( $id )
+ {
+ $i = 0;
+
+ $results = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_authors_langs', [
+ 'id_author' => (int)$id,
+ 'id_lang' => $row['id'],
+ 'description' => $description[ $i ]
+ ] );
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_authors_langs', [
+ 'id_author' => (int)$id,
+ 'id_lang' => $row['id'],
+ 'description' => $description
+ ] );
+ }
+
+ \S::delete_cache();
+
+ return $id;
+ }
+ }
+ else
+ {
+ $mdb -> update( 'pp_authors', [
+ 'author' => $author,
+ 'image' => $image
+ ], [
+ 'id' => (int)$id_author
+ ] );
+
+ $mdb -> delete( 'pp_authors_langs', [ 'id_author' => (int)$id_author ] );
+
+ $i = 0;
+
+ $results = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_authors_langs', [
+ 'id_author' => (int)$id_author,
+ 'id_lang' => $row['id'],
+ 'description' => $description[ $i ]
+ ] );
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_authors_langs', [
+ 'id_author' => (int)$id_author,
+ 'id_lang' => $row['id'],
+ 'description' => $description
+ ] );
+ }
+
+ \S::delete_cache();
+
+ return $id_author;
+ }
+ return false;
+ }
+
+ // szczególy autora
+ static public function get_single_author( $id_author )
+ {
+ global $mdb;
+
+ $author = $mdb -> get( 'pp_authors', '*', [ 'id' => (int)$id_author ] );
+
+ $results = $mdb -> select( 'pp_authors_langs', '*', [ 'id_author' => (int)$id_author ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ $author['languages'][$row['id_lang']] = $row;
+
+ return $author;
+ }
+}
\ No newline at end of file
diff --git a/autoload/admin/factory/class.Backups.php b/autoload/admin/factory/class.Backups.php
new file mode 100644
index 0000000..ccf6154
--- /dev/null
+++ b/autoload/admin/factory/class.Backups.php
@@ -0,0 +1,77 @@
+ save( '../backups/' . $backupfile . '.sql' );
+
+ $zipTo = '../backups/' . $backupfile . '.zip';
+ $zip = new \ZipArchive();
+ $zip -> open( $zipTo, \ZipArchive::CREATE );
+ $folder = '../';
+ $iter = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator( $folder, \RecursiveDirectoryIterator::SKIP_DOTS ),
+ \RecursiveIteratorIterator::SELF_FIRST,
+ \RecursiveIteratorIterator::CATCH_GET_CHILD
+ );
+
+ foreach ( $iter as $file )
+ {
+ if ( !strstr( $file, '../backups' ) and !strstr( $file, ' ../temp' ) and !strstr( $file, '../updates' ) )
+ {
+ if ( is_dir( $file ) )
+ {
+ $zip -> addEmptyDir( str_replace( $folder, '', $file . '/' ) );
+ }
+ else if ( is_file( $file ) )
+ {
+ $zip -> addFromString( str_replace( $folder, '', $file ),
+ file_get_contents( $file ) );
+ }
+ }
+ }
+ $zip -> close();
+ return true;
+ }
+
+ public static function backup_delete( $file )
+ {
+ if ( file_exists( '../backups/' . $file ) )
+ unlink( '../backups/' . $file );
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/autoload/admin/factory/class.Banners.php b/autoload/admin/factory/class.Banners.php
new file mode 100644
index 0000000..ebab27b
--- /dev/null
+++ b/autoload/admin/factory/class.Banners.php
@@ -0,0 +1,129 @@
+ delete( 'pp_banners', [ 'id' => (int) $banner_id ] );
+ \S::delete_cache();
+
+ return $result;
+ }
+
+ public static function banner_save( $banner_id, $name, $status, $date_start, $date_end, $home_page, $src, $url, $html, $text )
+ {
+ global $mdb;
+
+ if ( !$banner_id )
+ {
+ $mdb -> insert( 'pp_banners', [
+ 'name' => $name,
+ 'status' => $status == 'on' ? 1 : 0,
+ 'date_start' => $date_start != '' ? $date_start : null,
+ 'date_end' => $date_end != '' ? $date_end : null,
+ 'home_page' => $home_page == 'on' ? 1 : 0
+ ] );
+
+ $id = $mdb -> id();
+
+ if ( $id )
+ {
+ $i = 0;
+
+ $results = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_banners_langs', [
+ 'id_banner' => (int)$id,
+ 'id_lang' => $row['id'],
+ 'src' => $src[ $i ],
+ 'url' => $url[ $i ],
+ 'html' => $html[ $i ],
+ 'text' => $text[ $i ]
+ ] );
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_banners_langs', [
+ 'id_banner' => (int)$id,
+ 'id_lang' => $row['id'],
+ 'src' => $src,
+ 'url' => $url,
+ 'html' => $html,
+ 'text' => $text
+ ] );
+ }
+
+ \S::delete_cache();
+
+ return $id;
+ }
+ }
+ else
+ {
+ $mdb -> update( 'pp_banners',
+ [
+ 'name' => $name,
+ 'status' => $status == 'on' ? 1 : 0,
+ 'date_start' => $date_start != '' ? $date_start : null,
+ 'date_end' => $date_end != '' ? $date_end : null,
+ 'home_page' => $home_page == 'on' ? 1 : 0
+ ], [
+ 'id' => (int) $banner_id
+ ] );
+
+ $mdb -> delete( 'pp_banners_langs', [ 'id_banner' => (int)$banner_id ] );
+
+ $i = 0;
+
+ $results = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_banners_langs', [
+ 'id_banner' => (int)$banner_id,
+ 'id_lang' => $row['id'],
+ 'src' => $src[ $i ],
+ 'url' => $url[ $i ],
+ 'html' => $html[ $i ],
+ 'text' => $text[ $i ]
+ ] );
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_banners_langs', [
+ 'id_banner' => (int)$banner_id,
+ 'id_lang' => $row['id'],
+ 'src' => $src,
+ 'url' => $url,
+ 'html' => $html,
+ 'text' => $text
+ ] );
+ }
+
+ \S::delete_cache();
+ return $banner_id;
+ }
+ return false;
+ }
+
+ public static function banner_details( $id_banner )
+ {
+ global $mdb;
+
+ $banner = $mdb -> get( 'pp_banners', '*', [ 'id' => (int)$id_banner ] );
+
+ $results = $mdb -> select( 'pp_banners_langs', '*', [ 'id_banner' => (int)$id_banner ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ $banner['languages'][$row['id_lang']] = $row;
+
+ return $banner;
+ }
+
+}
+?>
diff --git a/autoload/admin/factory/class.Emails.php b/autoload/admin/factory/class.Emails.php
new file mode 100644
index 0000000..cf77301
--- /dev/null
+++ b/autoload/admin/factory/class.Emails.php
@@ -0,0 +1,11 @@
+ get( 'pp_contact_emails', '*', [ 'id' => (int)$email_id ] );
+ }
+}
diff --git a/autoload/admin/factory/class.Languages.php b/autoload/admin/factory/class.Languages.php
new file mode 100644
index 0000000..403fcbd
--- /dev/null
+++ b/autoload/admin/factory/class.Languages.php
@@ -0,0 +1,181 @@
+
+namespace admin\factory;
+
+class Languages
+{
+ public static function available_domains()
+ {
+ global $mdb;
+ return $mdb -> query( 'SELECT domain FROM pp_langs WHERE status = 1 AND domain IS NOT NULL GROUP BY domain' ) -> fetchAll( \PDO::FETCH_ASSOC );
+ }
+
+ public static function default_domain()
+ {
+ global $mdb;
+ $results = $mdb -> query( 'SELECT domain FROM pp_langs WHERE status = 1 AND domain IS NOT NULL AND main_domain = 1' ) -> fetchAll();
+ return $default_domain = $results[0][0];
+ }
+
+ public static function translation_delete( $translation_id )
+ {
+ global $mdb;
+ return $mdb -> delete( 'pp_langs_translations', [ 'id' => $translation_id ] );
+ }
+
+ public static function translation_save( $translation_id, $text, $languages )
+ {
+ global $mdb;
+
+ if ( $translation_id )
+ {
+ $mdb -> update( 'pp_langs_translations', [ 'text' => $text ], [ 'id' => $translation_id ] );
+ if ( is_array( $languages ) and !empty( $languages ) ): foreach ( $languages as $key => $val ):
+ $mdb -> update( 'pp_langs_translations', [ $key => $val ], [ 'id' => $translation_id ] );
+ endforeach; endif;
+ \S::htacces();
+ \S::delete_cache();
+ return $translation_id;
+ }
+ else
+ {
+ $mdb -> insert( 'pp_langs_translations', [ 'text' => $text ] );
+ if ( $translation_id = $mdb -> id() )
+ {
+ if ( is_array( $languages ) and !empty( $languages ) ): foreach ( $languages as $key => $val ):
+ $mdb -> update( 'pp_langs_translations', [ $key => $val ], [ 'id' => $translation_id ] );
+ endforeach; endif;
+ }
+ \S::htacces();
+ \S::delete_cache();
+ return $translation_id;
+ }
+ }
+
+ public static function translation_details( $translation_id )
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_langs_translations', '*', [ 'id' => $translation_id ] );
+ }
+
+ public static function language_delete( $language_id )
+ {
+ global $mdb;
+
+ if ( $mdb -> count( 'pp_langs' ) > 1 )
+ {
+ if ( $mdb -> query( 'ALTER TABLE pp_langs_translations DROP ' . $language_id )
+ and
+ $mdb -> delete( 'pp_langs', [ 'id' => $language_id ] )
+ )
+ return true;
+ }
+ return false;
+ }
+
+ public static function max_order()
+ {
+ global $mdb;
+ return $mdb -> max( 'pp_langs', 'o' );
+ }
+
+ public static function language_save( $language_id, $name, $status, $start, $o, $domain, $main_domain )
+ {
+ global $mdb;
+
+ if ( $start == 'on' and $status == 'on' and !\S::get_domain( $domain ) )
+ $mdb -> update( 'pp_langs', [
+ 'start' => 0
+ ], [
+ 'id[!]' => $language_id
+ ] );
+
+ if ( $start == 'on' and $status == 'on' and \S::get_domain( $domain ) )
+ $mdb -> update( 'pp_langs', [
+ 'start' => 0
+ ], [
+ 'AND' => [ 'id[!]' => $language_id, 'domain' => \S::get_domain( $domain ) ]
+ ] );
+
+ if ( $main_domain == 'on' and $domain and $status == 'on' )
+ $mdb -> update( 'pp_langs', [
+ 'main_domain' => 0
+ ], [
+ ' id[!]' => $language_id
+ ] );
+
+ if ( $mdb -> count( 'pp_langs', [ 'id' => $language_id ] ) )
+ {
+ $mdb -> update( 'pp_langs', [
+ 'status' => $status == 'on' ? 1 : 0,
+ 'start' => $start == 'on' ? 1 : 0,
+ 'name' => $name,
+ 'o' => $o,
+ 'domain' => \S::get_domain( $domain ) ? \S::get_domain( $domain ) : null,
+ 'main_domain' => $main_domain == 'on' and \S::get_domain( $domain ) ? 1 : 0,
+ ], [
+ 'id' => $language_id
+ ] );
+ }
+ else
+ {
+ if ( $mdb -> query( 'ALTER TABLE pp_langs_translations ADD ' . strtolower( $language_id ) . ' TEXT NULL DEFAULT NULL' ) )
+ {
+ $mdb -> insert( 'pp_langs', [
+ 'id' => strtolower( $language_id ),
+ 'name' => $name,
+ 'status' => $status == 'on' ? 1 : 0,
+ 'start' => $start == 'on' ? 1 : 0,
+ 'o' => $o,
+ 'domain' => \S::get_domain( $domain ) ? \S::get_domain( $domain ) : null,
+ 'main_domain' => $main_domain == 'on' && \S::get_domain( $domain ) ? 1 : 0,
+ ] );
+ }
+ }
+
+ if ( !$mdb -> count( 'pp_langs', [ 'AND' => [ 'status' => 1, 'domain[!]' => null ] ] ) )
+ {
+ if ( !$mdb -> count( 'pp_langs', [ 'AND' => [ 'status' => 1, 'start' => 1, 'domain' => null ] ] ) )
+ {
+ if ( $id_tmp = $mdb -> get( 'pp_langs', 'id', [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] ) )
+ $mdb -> update( 'pp_langs', [ 'start' => 1 ], [ 'id' => $id_tmp ] );
+ }
+ }
+
+ $domains = $mdb -> select( 'pp_langs', 'domain', [ 'domain[!]' => null, 'GROUP' => 'domain'] );
+ if ( is_array( $domains ) and !empty( $domains ) )
+ {
+ $mdb -> update( 'pp_langs', [ 'start' => 0 ], [ 'domain' => null ] );
+ foreach ( $domains as $domain )
+ {
+ if ( !$mdb -> count( 'pp_langs', [ 'AND' => [ 'status' => 1, 'start' => 1, 'domain' => $domain ] ] ) )
+ {
+ if ( $id_tmp = $mdb -> get( 'pp_langs', 'id', [ 'AND' => [ 'status' => 1, 'domain' => $domain ], 'ORDER' => [ 'o' => 'ASC' ] ] ) )
+ $mdb -> update( 'pp_langs', [ 'start' => 1 ], [ 'id' => $id_tmp ] );
+ }
+ }
+ }
+
+ if ( !$mdb -> count( 'pp_langs', [ 'AND' => [ 'status' => 1, 'main_domain' => 1 ] ] ) )
+ {
+ if ( $id_tmp = $mdb -> get( 'pp_langs', 'id', [ 'AND' => [ 'status' => 1, 'domain[!]' => null ], 'ORDER' => [ 'o' => 'ASC' ] ] ) )
+ $mdb -> update( 'pp_langs', [ 'main_domain' => 1 ], [ 'id' => $id_tmp ] );
+ }
+
+ \S::htacces();
+ \S::delete_cache();
+ return $language_id;
+ }
+
+ public static function language_details( $language_id )
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_langs', '*', [ 'id' => $language_id ] );
+ }
+
+ public static function languages_list()
+ {
+ global $mdb;
+ return $mdb -> select( 'pp_langs', '*', [ 'ORDER' => [ 'o' => 'ASC' ] ] );
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/factory/class.Layouts.php b/autoload/admin/factory/class.Layouts.php
new file mode 100644
index 0000000..626fcdc
--- /dev/null
+++ b/autoload/admin/factory/class.Layouts.php
@@ -0,0 +1,141 @@
+ count( 'pp_layouts' ) > 1 )
+ return $mdb -> delete( 'pp_layouts', [ 'id' => (int)$layout_id ] );
+ return false;
+ }
+
+ public static function layout_details( $layout_id )
+ {
+ global $mdb;
+ $layout = $mdb -> get( 'pp_layouts', '*', [ 'id' => (int)$layout_id ] );
+
+ $layout['pages'] = $mdb -> select( 'pp_layouts_pages', 'page_id', [ 'layout_id' => (int)$layout_id ] );
+
+ return $layout;
+
+ }
+
+ public static function layout_save( $layout_id, $name, $status, $pages, $html, $css, $js, $m_html, $m_css, $m_js )
+ {
+ global $mdb;
+ if ( !$layout_id )
+ {
+ if ( $status == 'on' )
+ $mdb -> update( 'pp_layouts', [ 'status' => 0 ] );
+
+ $mdb -> insert( 'pp_layouts', [
+ 'name' => $name,
+ 'html' => $html,
+ 'css' => $css,
+ 'js' => $js,
+ 'm_html' => $m_html,
+ 'm_css' => $m_css,
+ 'm_js' => $m_js,
+ 'status' => $status == 'on' ? 1 : 0
+ ] );
+
+ $id = $mdb -> id();
+
+ if ( $id )
+ {
+ if ( is_array( $pages ) ) foreach ( $pages as $page )
+ {
+ $mdb -> delete( 'pp_layouts_pages', [ 'page_id' => (int)$page ] );
+
+ $mdb -> insert( 'pp_layouts_pages', [
+ 'layout_id' => (int)$id,
+ 'page_id' => (int)$page
+ ] );
+ }
+ else if ( $pages )
+ {
+ $mdb -> delete( 'pp_layouts_pages', [ 'page_id' => (int)$pages ] );
+
+ $mdb -> insert( 'pp_layouts_pages', [
+ 'layout_id' => (int)$id,
+ 'page_id' => (int)$pages
+ ] );
+ }
+
+ \S::delete_cache();
+
+ return $id;
+ }
+ }
+ else
+ {
+ if ( $status == 'on' )
+ $mdb -> update( 'pp_layouts', [ 'status' => 0 ] );
+
+ $mdb -> update( 'pp_layouts', [
+ 'name' => $name,
+ 'html' => $html,
+ 'css' => $css,
+ 'js' => $js,
+ 'm_html' => $m_html,
+ 'm_css' => $m_css,
+ 'm_js' => $m_js,
+ 'status' => $status == 'on' ? 1 : 0
+ ], [
+ 'id' => $layout_id
+ ] );
+
+ $mdb -> delete( 'pp_layouts_pages', [ 'layout_id' => (int)$layout_id ] );
+
+ if ( is_array( $pages ) ) foreach ( $pages as $page )
+ {
+ $mdb -> delete( 'pp_layouts_pages', [ 'page_id' => (int)$page ] );
+
+ $mdb -> insert( 'pp_layouts_pages', [
+ 'layout_id' => (int)$layout_id,
+ 'page_id' => (int)$page
+ ] );
+ }
+ else if ( $pages )
+ {
+ $mdb -> delete( 'pp_layouts_pages', [ 'page_id' => (int)$pages ] );
+
+ $mdb -> insert( 'pp_layouts_pages', [
+ 'layout_id' => (int)$layout_id,
+ 'page_id' => (int)$pages
+ ] );
+ }
+
+ \S::delete_cache();
+
+ return $layout_id;
+ }
+ return false;
+
+ }
+
+ public static function menus_list()
+ {
+ global $mdb;
+ $results = $mdb -> select( 'pp_menus', 'id', [ 'ORDER' => [ 'name' => 'ASC' ] ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ $menu = \admin\factory\Pages::menu_details( $row );
+ $menu['pages'] = \admin\factory\Pages::menu_pages( $row );
+
+ $menus[] = $menu;
+ }
+ return $menus;
+
+ }
+
+ public static function layouts_list()
+ {
+ global $mdb;
+ return $mdb -> select( 'pp_layouts', '*', [ 'ORDER' => [ 'name' => 'ASC' ] ] );
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/factory/class.Newsletter.php b/autoload/admin/factory/class.Newsletter.php
new file mode 100644
index 0000000..0706148
--- /dev/null
+++ b/autoload/admin/factory/class.Newsletter.php
@@ -0,0 +1,105 @@
+ count( 'pp_newsletter', [ 'email' => trim( $email ) ] ) )
+ $mdb -> insert( 'pp_newsletter', [
+ 'email' => trim( $email ),
+ 'hash' => md5( $email . time() ),
+ 'status' => 1
+ ] );
+ }
+ return true;
+ }
+
+ public static function is_admin_template( $template_id )
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_newsletter_templates', 'is_admin', [ 'id' => (int)$template_id ] );
+ }
+
+ public static function newsletter_template_delete( $template_id )
+ {
+ global $mdb;
+ return $mdb -> delete( 'pp_newsletter_templates', [ 'id' => (int)$template_id ] );
+ }
+
+ public static function send( $dates, $template, $only_once )
+ {
+ global $mdb;
+
+ $results = $mdb -> select( 'pp_newsletter', 'email', [ 'status' => 1 ] );
+ if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
+ {
+ if ( $template and $only_once )
+ {
+ if ( !$mdb -> count( 'pp_newsletter_send', [ 'AND' => [ 'id_template' => $template, 'email' => $row ] ] ) )
+ $mdb -> insert( 'pp_newsletter_send', [
+ 'email' => $row,
+ 'dates' => $dates,
+ 'id_template' => $template ? $template : null,
+ 'only_once' => ( $only_once == 'on' and $template ) ? 1 : 0
+ ] );
+ }
+ else
+ $mdb -> insert( 'pp_newsletter_send', [
+ 'email' => $row,
+ 'dates' => $dates,
+ 'id_template' => $template ? $template : null,
+ 'only_once' => ( $only_once == 'on' and $template ) ? 1 : 0
+ ] );
+ }
+ return true;
+ }
+
+ public static function email_template_detalis ($id_template)
+ {
+ global $mdb;
+
+ $result = $mdb -> get ('pp_newsletter_templates', '*', [ 'id' => (int)$id_template ] );
+ return $result;
+ }
+
+ public static function template_save($id, $name, $text)
+ {
+ global $mdb;
+ if ( !$id )
+ {
+ if ( $mdb -> insert( 'pp_newsletter_templates', [
+ 'name' => $name,
+ 'text' => $text
+ ] ) )
+ {
+ \S::delete_cache();
+ return $mdb -> id();
+ }
+ }
+ else
+ {
+ $mdb -> update( 'pp_newsletter_templates', [
+ 'name' => $name,
+ 'text' => $text
+
+ ], [
+ 'id' => (int)$id
+ ] );
+
+ \S::delete_cache();
+ return $id;
+ }
+ }
+
+ public static function templates_list()
+ {
+ global $mdb;
+ return $mdb -> select( 'pp_newsletter_templates', '*', [ 'is_admin' => 0, 'ORDER' => [ 'name' => 'ASC' ] ] );
+ }
+}
diff --git a/autoload/admin/factory/class.Pages.php b/autoload/admin/factory/class.Pages.php
new file mode 100644
index 0000000..3f5c7b8
--- /dev/null
+++ b/autoload/admin/factory/class.Pages.php
@@ -0,0 +1,509 @@
+
+
+namespace admin\factory;
+
+class Pages
+{
+
+ public static $_page_types = [ 0 => 'pełne artykuły', 1 => 'wprowadzenia', 2 => 'miniaturki', 3 => 'link', 4 => 'kontakt' ];
+ public static $_sort_types = [
+ 0 => 'data dodania - najstarsze na początku',
+ 1 => 'data dodania - najnowsze na początku',
+ 2 => 'data modyfikacji - rosnąco',
+ 3 => 'data mofyfikacji - malejąco',
+ 4 => 'ręczne',
+ 5 => 'alfabetycznie - A - Z',
+ 6 => 'alfabetycznie - Z - A'
+ ];
+
+ public static function save_articles_order( $page_id, $articles )
+ {
+ global $mdb;
+ if ( is_array( $articles ) )
+ {
+ $mdb -> update( 'pp_articles_pages', [ 'o' => 0 ],
+ [ 'page_id' => (int) $page_id ] );
+
+ for ( $i = 0; $i < count( $articles ); $i++ )
+ {
+ if ( $articles[$i]['item_id'] )
+ {
+ $x++;
+ $mdb -> update( 'pp_articles_pages', [ 'o' => $x ],
+ [ 'AND' => [ 'page_id' => (int) $page_id, 'article_id' => $articles[$i]['item_id'] ] ] );
+ }
+ }
+ }
+ return true;
+ }
+
+ public static function page_articles( $page_id )
+ {
+ global $mdb;
+ $results = $mdb -> query( 'SELECT '
+ . 'article_id, o, status '
+ . 'FROM '
+ . 'pp_articles_pages AS ap '
+ . 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
+ . 'WHERE '
+ . 'page_id = ' . (int) $page_id . ' AND status != -1 '
+ . 'ORDER BY '
+ . 'o ASC' ) -> fetchAll();
+ if ( is_array( $results ) )
+ foreach ( $results as $row )
+ {
+ $row['title'] = \admin\factory\Articles::article_title( $row['article_id'] );
+ $articles[] = $row;
+ }
+ return $articles;
+ }
+
+ public static function menus_list()
+ {
+ global $mdb;
+ return $mdb -> select( 'pp_menus', '*', [ 'ORDER' => [ 'name' => 'ASC' ] ] );
+ }
+
+ public static function save_pages_order( $menu_id, $pages )
+ {
+ global $mdb;
+ if ( is_array( $pages ) )
+ {
+ $mdb -> update( 'pp_pages', [ 'o' => 0 ], [ 'menu_id' => (int) $menu_id ] );
+
+ for ( $i = 0; $i < count( $pages ); $i++ )
+ {
+ if ( $pages[$i]['item_id'] )
+ {
+ $pages[$i]['parent_id'] ? $parent_id = $pages[$i]['parent_id'] : $parent_id = 0;
+
+ if ( $pages[$i]['item_id'] && $pages[$i]['depth'] > 1 )
+ {
+ if ( $pages[$i]['depth'] == 2 )
+ $parent_id = null;
+
+ $x++;
+
+ $mdb -> update( 'pp_pages', [ 'o' => $x, 'parent_id' => $parent_id ],
+ [ 'id' => (int) $pages[$i]['item_id'] ] );
+ }
+ }
+ }
+ }
+
+ \S::delete_cache();
+
+ return true;
+ }
+
+ public static function page_delete( $page_id )
+ {
+ global $mdb;
+ if ( $mdb -> count( 'pp_pages', [ 'parent_id' => (int) $page_id ] ) )
+ return false;
+
+ if ( $mdb -> delete( 'pp_pages', [ 'id' => (int) $page_id ] ) )
+ {
+ \S::delete_cache();
+ \S::htacces();
+ return true;
+ }
+ return false;
+ }
+
+ public static function max_order()
+ {
+ global $mdb;
+ return $mdb -> max( 'pp_pages', 'o' );
+ }
+
+ public static function page_save(
+ $page_id, $title, $seo_link, $meta_title, $meta_description, $meta_keywords, $menu_id, $parent_id, $page_type, $sort_type, $layout_id, $articles_limit, $show_title, $status, $link, $noindex, $start,
+ $site_title, $block_direct_access, $cache, $canonical
+ )
+ {
+ global $mdb;
+
+ if ( !$parent_id )
+ $parent_id = null;
+
+ if ( !$page_id )
+ {
+ $order = self::max_order() + 1;
+
+ $mdb -> insert( 'pp_pages', [
+ 'menu_id' => (int) $menu_id,
+ 'page_type' => $page_type,
+ 'sort_type' => $sort_type,
+ 'articles_limit' => $articles_limit,
+ 'show_title' => $show_title == 'on' ? 1 : 0,
+ 'status' => $status == 'on' ? 1 : 0,
+ 'o' => (int) $order,
+ 'parent_id' => $parent_id,
+ 'start' => $start == 'on' ? 1 : 0,
+ 'cache' => $cache == 'on' ? 1 : 0
+ ] );
+
+ $id = $mdb -> id();
+
+ if ( $id )
+ {
+ if ( $start )
+ $mdb -> update( 'pp_pages', [ 'start' => 0 ], [ 'id[!]' => (int)$id ] );
+
+ if ( $layout_id )
+ $mdb -> insert( 'pp_layouts_pages', [ 'page_id' => (int) $id, 'layout_id' => (int)$layout_id ] );
+
+ $i = 0;
+
+ $results = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_pages_langs', [
+ 'page_id' => (int) $id,
+ 'lang_id' => $row['id'],
+ 'title' => $title[$i] != '' ? $title[$i] : null,
+ 'meta_description' => $meta_description[$i] != '' ? $meta_description[$i] : null,
+ 'meta_keywords' => $meta_keywords[$i] != '' ? $meta_keywords[$i] : null,
+ 'meta_title' => $meta_title[$i] != '' ? $meta_title[$i] : null,
+ 'seo_link' => \S::seo( $seo_link[$i] ) != '' ? \S::seo( $seo_link[$i] ) : null,
+ 'noindex' => $noindex[$i],
+ 'site_title' => $site_title[$i] != '' ? $site_title[$i] : null,
+ 'link' => $link[$i] != '' ? $link[$i] : null,
+ 'block_direct_access' => $block_direct_access[$i],
+ 'canonical' => $canonical[$i] != '' ? $canonical[$i] : null
+ ] );
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 )
+ {
+ foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_pages_langs', [
+ 'page_id' => (int) $id,
+ 'lang_id' => $row['id'],
+ 'title' => $title != '' ? $title : null,
+ 'meta_description' => $meta_description != '' ? $meta_description : null,
+ 'meta_keywords' => $meta_keywords != '' ? $meta_keywords : null,
+ 'meta_title' => $meta_title != '' ? $meta_title : null,
+ 'seo_link' => \S::seo( $seo_link ) != '' ? \S::seo( $seo_link ) : null,
+ 'noindex' => $noindex,
+ 'site_title' => $site_title != '' ? $site_title : null,
+ 'link' => $link != '' ? $link : null,
+ 'block_direct_access' => $block_direct_access,
+ 'canonical' => $canonical != '' ? $canonical : null
+ ] );
+ }
+ }
+
+ \S::htacces();
+ \S::delete_cache();
+
+ return $id;
+ }
+ }
+ else
+ {
+ $mdb -> update( 'pp_pages',
+ [
+ 'menu_id' => (int) $menu_id,
+ 'page_type' => $page_type,
+ 'sort_type' => $sort_type,
+ 'articles_limit' => $articles_limit,
+ 'show_title' => $show_title == 'on' ? 1 : 0,
+ 'status' => $status == 'on' ? 1 : 0,
+ 'parent_id' => $parent_id,
+ 'start' => $start == 'on' ? 1 : 0,
+ 'cache' => $cache == 'on' ? 1 : 0
+ ], [
+ 'id' => (int) $page_id
+ ] );
+
+ if ( $layout_id )
+ {
+ $mdb -> delete( 'pp_layouts_pages', [ 'page_id' => (int) $page_id ] );
+ $mdb -> insert( 'pp_layouts_pages',
+ [ 'layout_id' => (int) $layout_id, 'page_id' => (int) $page_id ] );
+ }
+
+ if ( $start )
+ $mdb -> update( 'pp_pages', [ 'start' => 0 ],
+ [ 'id[!]' => (int) $page_id ] );
+
+ $i = 0;
+
+ $mdb -> delete( 'pp_pages_langs', [ 'page_id' => (int) $page_id ] );
+
+ $results = $mdb -> select( 'pp_langs', [ 'id' ],
+ [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 )
+ foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_pages_langs',
+ [
+ 'page_id' => (int) $page_id,
+ 'lang_id' => $row['id'],
+ 'title' => $title[$i] != '' ? $title[$i] : null,
+ 'meta_description' => $meta_description[$i] != '' ? $meta_description[$i] : null,
+ 'meta_keywords' => $meta_keywords[$i] != '' ? $meta_keywords[$i] : null,
+ 'meta_title' => $meta_title[$i] != '' ? $meta_title[$i] : null,
+ 'seo_link' => \S::seo( $seo_link[$i] ) != '' ? \S::seo( $seo_link[$i] ) : null,
+ 'noindex' => $noindex[$i],
+ 'site_title' => $site_title[$i] != '' ? $site_title[$i] : null,
+ 'link' => $link[$i] != '' ? $link[$i] : null,
+ 'block_direct_access' => $block_direct_access[$i],
+ 'canonical' => $canonical[$i] != '' ? $canonical[$i] : null
+ ] );
+
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 )
+ foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_pages_langs',
+ [
+ 'page_id' => (int) $page_id,
+ 'lang_id' => $row['id'],
+ 'title' => $title != '' ? $title : null,
+ 'meta_description' => $meta_description != '' ? $meta_description : null,
+ 'meta_keywords' => $meta_keywords != '' ? $meta_keywords : null,
+ 'meta_title' => $meta_title != '' ? $meta_title : null,
+ 'seo_link' => \S::seo( $seo_link ) != '' ? \S::seo( $seo_link ) : null,
+ 'noindex' => $noindex,
+ 'site_title' => $site_title != '' ? $site_title : null,
+ 'link' => $link != '' ? $link : null,
+ 'block_direct_access' => $block_direct_access,
+ 'canonical' => $canonical != '' ? $canonical : null
+ ] );
+ }
+
+ self::update_supages_menu_id( $page_id, $menu_id );
+
+ \S::htacces();
+ \S::delete_cache();
+
+ return $page_id;
+ }
+ return false;
+ }
+
+ public static function update_supages_menu_id( $parent_id, $menu_id )
+ {
+ global $mdb;
+
+ $mdb -> update( 'pp_pages', [ 'menu_id' => (int) $menu_id ],
+ [ 'parent_id' => $parent_id ] );
+
+ $results = $mdb -> select( 'pp_pages', [ 'id' ], [ 'parent_id' => $parent_id ] );
+ if ( is_array( $results ) )
+ foreach ( $results as $row )
+ self::update_supages_menu_id( $row['id'], $menu_id );
+ }
+
+ public static function generate_seo_link( $title, $page_id, $article_id,
+ $lang, $pid )
+ {
+ global $mdb;
+
+ $seo_link = \S::seo( $title );
+
+
+ while ( !$seo_link_check )
+ {
+ if ( $mdb -> count( 'pp_pages_langs',
+ [ 'AND' => [ 'seo_link' => $seo_link, 'page_id[!]' => (int) $page_id ] ] ) )
+ $seo_link = $seo_link . '-' . ( ++$i );
+ else
+ $seo_link_check = true;
+ }
+
+ $seo_link_check = false;
+
+ while ( !$seo_link_check )
+ {
+ if ( $mdb -> count( 'pp_articles_langs',
+ [ 'AND' => [ 'seo_link' => $seo_link, 'article_id[!]' => (int) $article_id ] ] ) )
+ $seo_link = $seo_link . '-' . ( ++$i );
+ else
+ $seo_link_check = true;
+ }
+ return $seo_link;
+ }
+
+ public static function google_url_preview( $page_id, $title, $lang, $pid, $id, $seo_link, $language_link = '' )
+ {
+ global $mdb;
+
+ $prefix = $language_link;
+ $status = true;
+ $id_page = $page_id;
+
+ do
+ {
+ if ( $page_id )
+ {
+ $parent = \admin\factory\Pages::page_details( $page_id );
+ $parent_id = $parent['parent_id'];
+ }
+ else
+ $parent_id = $pid;
+
+ if ( $parent_id )
+ {
+ $results = $mdb -> query( "SELECT title, seo_link, page_id FROM pp_pages_langs AS ppl, pp_langs AS pl WHERE lang_id = pl.id AND page_id = " . (int) $parent_id . " AND ppl.lang_id = '" . $lang . "' " ) -> fetchAll();
+ if ( $results[0]['seo_link'] )
+ $seo = $results[0]['seo_link'] . '/' . $seo;
+ else
+ $seo = 's-' . $results[0]['page_id'] . '-' . \S::seo( $results[0]['title'] ) . '/' . $seo;
+ $page_id = $results[0]['page_id'];
+ }
+ else
+ $status = false;
+ }
+ while ( $status );
+
+ if ( $id )
+ {
+ if ( !$seo_link )
+ $seo = $seo . 's-' . $id . '-' . \S::seo( $title );
+ else
+ $seo = $seo . $seo_link;
+ }
+ else
+ {
+ if ( !$seo_link )
+ $seo = $seo . 's-' . $id_page . '-' . \S::seo( $title );
+ else
+ $seo = $seo . $seo_link;
+ }
+
+ if ( $prefix )
+ $seo = $prefix . $seo;
+
+ return $seo;
+ }
+
+ public static function menu_delete( $menu_id )
+ {
+ global $mdb;
+
+ if ( $mdb -> count( 'pp_pages', [ 'menu_id' => (int) $menu_id ] ) )
+ return false;
+
+ return $mdb -> delete( 'pp_menus', [ 'id' => (int) $menu_id ] );
+ }
+
+ public static function menu_details( $menu_id )
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_menus', '*', [ 'id' => (int) $menu_id ] );
+ }
+
+ public static function menu_save( $menu_id, $name, $status )
+ {
+ global $mdb;
+
+ $status == 'on' ? $status = 1 : $status = 0;
+
+ if ( !$menu_id )
+ {
+ return $mdb -> insert( 'pp_menus',
+ [
+ 'name' => $name,
+ 'status' => $status
+ ] );
+ }
+ else
+ {
+ $mdb -> update( 'pp_menus',
+ [
+ 'name' => $name,
+ 'status' => $status
+ ], [
+ 'id' => (int) $menu_id
+ ] );
+
+ return true;
+ }
+ return false;
+ }
+
+ public static function menu_lists()
+ {
+ global $mdb;
+ return $mdb -> select( 'pp_menus', '*', [ 'ORDER' => [ 'id' => 'ASC' ] ] );
+ }
+
+ public static function page_details( $page_id )
+ {
+ global $mdb;
+
+ $page = $mdb -> get( 'pp_pages', '*', [ 'id' => (int) $page_id ] );
+
+ $results = $mdb -> select( 'pp_pages_langs', '*',
+ [ 'page_id' => (int) $page_id ] );
+ if ( is_array( $results ) )
+ foreach ( $results as $row )
+ $page['languages'][$row['lang_id']] = $row;
+
+ $page['layout_id'] = $mdb -> get( 'pp_layouts_pages', 'layout_id',
+ [ 'page_id' => (int) $page_id ] );
+
+ return $page;
+ }
+
+ public static function page_url( $page_id )
+ {
+ global $mdb;
+
+ $results = $mdb -> query( "SELECT seo_link, title lang_id FROM pp_pages_langs AS ppl, pp_langs AS pl WHERE lang_id = pl.id AND page_id = " . (int) $page_id . " AND seo_link != '' ORDER BY o ASC LIMIT 1" ) -> fetchAll();
+
+ if ( !$results[0]['seo_link'] )
+ {
+ $title = self::page_title( $article_id );
+ return 's-' . $page_id . '-' . \S::seo( $title );
+ }
+ else
+ return $results[0]['seo_link'];
+ }
+
+ public static function page_title( $page_id )
+ {
+ global $mdb;
+
+ $result = $mdb -> select( 'pp_pages_langs',
+ [ '[><]pp_langs' => [ 'lang_id' => 'id' ] ], 'title',
+ [ 'AND' => [ 'page_id' => (int) $page_id, 'title[!]' => '' ], 'ORDER' => [ 'o' => 'ASC' ], 'LIMIT' => 1 ] );
+ return $result[0];
+ }
+
+ public static function page_languages( $page_id )
+ {
+ global $mdb;
+ return $mdb -> select( 'pp_pages_langs', '*',
+ [ 'AND' => [ 'page_id' => (int) $page_id, 'title[!]' => null ] ] );
+ }
+
+ public static function menu_pages( $menu_id, $parent_id = null )
+ {
+ global $mdb;
+
+ $results = $mdb -> select( 'pp_pages',
+ [ 'id', 'menu_id', 'status', 'parent_id', 'start' ],
+ [ 'AND' => [ 'menu_id' => $menu_id, 'parent_id' => $parent_id ], 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) )
+ foreach ( $results as $row )
+ {
+ $row['title'] = self::page_title( $row['id'] );
+ $row['languages'] = self::page_languages( $row['id'] );
+ $row['subpages'] = self::menu_pages( $menu_id, $row['id'] );
+
+ $pages[] = $row;
+ }
+
+ return $pages;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/autoload/admin/factory/class.Scontainers.php b/autoload/admin/factory/class.Scontainers.php
new file mode 100644
index 0000000..9d355a7
--- /dev/null
+++ b/autoload/admin/factory/class.Scontainers.php
@@ -0,0 +1,121 @@
+ delete( 'pp_scontainers', [ 'id' => (int) $container_id ] );
+ }
+
+ public static function container_save( $container_id, $title, $text, $status, $show_title, $src, $html )
+ {
+ global $mdb;
+
+ if ( !$container_id )
+ {
+ $mdb -> insert( 'pp_scontainers',
+ [
+ 'status' => $status == 'on' ? 1 : 0,
+ 'show_title' => $show_title == 'on' ? 1 : 0,
+ 'src' => $src
+ ] );
+
+ $id = $mdb -> id();
+
+ if ( $id )
+ {
+ $i = 0;
+
+ $results = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_scontainers_langs',
+ [
+ 'container_id' => (int) $id,
+ 'lang_id' => $row['id'],
+ 'title' => $title[$i],
+ 'text' => $text[$i],
+ 'html' => $html[$i]
+ ] );
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_scontainers_langs', [
+ 'container_id' => (int) $id,
+ 'lang_id' => $row['id'],
+ 'title' => $title,
+ 'text' => $text,
+ 'html' => $html
+ ] );
+ }
+
+ \S::delete_cache();
+
+ return $id;
+ }
+ }
+ else
+ {
+ $mdb -> update( 'pp_scontainers',
+ [
+ 'status' => $status == 'on' ? 1 : 0,
+ 'show_title' => $show_title == 'on' ? 1 : 0,
+ 'src' => $src
+ ],
+ [
+ 'id' => (int) $container_id
+ ] );
+
+ $mdb -> delete( 'pp_scontainers_langs',
+ [ 'container_id' => (int) $container_id ] );
+
+ $i = 0;
+
+ $results = $mdb -> select( 'pp_langs', [ 'id' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) and count( $results ) > 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_scontainers_langs',
+ [
+ 'container_id' => (int) $container_id,
+ 'lang_id' => $row['id'],
+ 'title' => $title[$i],
+ 'text' => $text[$i],
+ 'html' => $html[$i]
+ ] );
+ $i++;
+ }
+ else if ( is_array( $results ) and count( $results ) == 1 ) foreach ( $results as $row )
+ {
+ $mdb -> insert( 'pp_scontainers_langs',
+ [
+ 'container_id' => (int) $container_id,
+ 'lang_id' => $row['id'],
+ 'title' => $title,
+ 'text' => $text,
+ 'html' => $html
+ ] );
+ }
+
+ \S::delete_cache();
+
+ return $container_id;
+ }
+ }
+
+ public static function container_details( $container_id )
+ {
+ global $mdb;
+
+ $container = $mdb -> get( 'pp_scontainers', '*', [ 'id' => (int) $container_id ] );
+
+ $results = $mdb -> select( 'pp_scontainers_langs', '*', [ 'container_id' => (int) $container_id ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ $container['languages'][$row['lang_id']] = $row;
+
+ return $container;
+ }
+}
\ No newline at end of file
diff --git a/autoload/admin/factory/class.SeoAdditional.php b/autoload/admin/factory/class.SeoAdditional.php
new file mode 100644
index 0000000..db3ef58
--- /dev/null
+++ b/autoload/admin/factory/class.SeoAdditional.php
@@ -0,0 +1,55 @@
+ delete( 'pp_seo_additional', [ 'id' => (int)$element_id ] );
+ }
+
+ public static function element_save( $id, $url, $status, $title, $keywords, $description, $text )
+ {
+ global $mdb;
+
+ if ( !$id )
+ {
+ if ( $mdb -> insert( 'pp_seo_additional', [
+ 'url' => $url,
+ 'status' => $status == 'on' ? 1 : 0,
+ 'title' => $title,
+ 'keywords' => $keywords,
+ 'description' => $description,
+ 'text' => $text
+ ] ) )
+ {
+ \S::delete_cache();
+ return $mdb -> id();
+ }
+ }
+ else
+ {
+ $mdb -> update( 'pp_seo_additional', [
+ 'url' => $url,
+ 'status' => $status == 'on' ? 1 : 0,
+ 'title' => $title,
+ 'keywords' => $keywords,
+ 'description' => $description,
+ 'text' => $text
+
+ ], [
+ 'id' => (int)$id
+ ] );
+
+ \S::delete_cache();
+ return $id;
+ }
+ }
+
+ public static function element_details( $element_id )
+ {
+ global $mdb;
+ $result = $mdb -> get ( 'pp_seo_additional', '*', [ 'id' => (int)$element_id ] );
+ return $result;
+ }
+}
diff --git a/autoload/admin/factory/class.Settings.php b/autoload/admin/factory/class.Settings.php
new file mode 100644
index 0000000..15f608a
--- /dev/null
+++ b/autoload/admin/factory/class.Settings.php
@@ -0,0 +1,147 @@
+
+namespace admin\factory;
+class Settings
+{
+ public static function settings_update( $param, $value )
+ {
+ global $mdb;
+
+ if ( $mdb -> count( 'pp_settings', [ 'param' => $param ] ) )
+ return $mdb -> update( 'pp_settings', [ 'value' => $value ], [ 'param' => $param ] );
+ else
+ return $mdb -> insert( 'pp_settings', [ 'param' => $param, 'value' => $value ] );
+ }
+
+ public static function settings_save(
+ $firm_name, $firm_adress, $additional_info, $contact_form, $contact_email, $email_host, $email_port, $email_login, $email_password, $google_maps,
+ $facebook_link, $statistic_code, $htaccess, $robots, $newsletter_header, $newsletter_footer_1, $newsletter_footer_2, $google_map_key, $google_search_console, $update, $devel,
+ $news_limit, $visit_counter, $calendar, $tags, $ssl, $mysql_debug, $htaccess_cache, $visits, $links_structure, $link_version, $widget_phone, $update_key )
+ {
+ global $mdb;
+
+ $mdb -> query( 'TRUNCATE pp_settings' );
+
+ $mdb -> insert( 'pp_settings', [
+ [
+ 'param' => 'firm_name',
+ 'value' => $firm_name,
+ ], [
+ 'param' => 'firm_adress',
+ 'value' => $firm_adress
+ ], [
+ 'param' => 'additional_info',
+ 'value' => $additional_info
+ ], [
+ 'param' => 'contact_form',
+ 'value' => $contact_form
+ ], [
+ 'param' => 'contact_email',
+ 'value' => $contact_email
+ ], [
+ 'param' => 'email_host',
+ 'value' => $email_host
+ ], [
+ 'param' => 'email_port',
+ 'value' => $email_port
+ ], [
+ 'param' => 'email_login',
+ 'value' => $email_login
+ ], [
+ 'param' => 'email_password',
+ 'value' => $email_password
+ ], [
+ 'param' => 'google_maps',
+ 'value' => $google_maps == 'on' ? 1 : 0
+ ], [
+ "param" => 'facebook_link',
+ 'value' => $facebook_link
+ ], [
+ 'param' => 'statistic_code',
+ 'value' => $statistic_code
+ ], [
+ 'param' => 'htaccess',
+ 'value' => $htaccess
+ ], [
+ 'param' => 'robots',
+ 'value' => $robots
+ ], [
+ 'param' => 'newsletter_header',
+ 'value' => $newsletter_header
+ ], [
+ 'param' => 'newsletter_footer_1',
+ 'value' => $newsletter_footer_1
+ ], [
+ 'param' => 'newsletter_footer_2',
+ 'value' => $newsletter_footer_2
+ ], [
+ 'param' => 'google_map_key',
+ 'value' => $google_map_key
+ ], [
+ 'param' => 'google_search_console',
+ 'value' => $google_search_console
+ ], [
+ 'param' => 'update',
+ 'value' => $update == 'on' ? 1 : 0
+ ], [
+ 'param' => 'devel',
+ 'value' => $devel == 'on' ? 1 : 0
+ ], [
+ 'param' => 'news_limit',
+ 'value' => $news_limit
+ ], [
+ 'param' => 'visit_counter',
+ 'value' => $visit_counter == 'on' ? 1 : 0
+ ], [
+ 'param' => 'calendar',
+ 'value' => $calendar == 'on' ? 1 : 0
+ ], [
+ 'param' => 'tags',
+ 'value' => $tags == 'on' ? 1 : 0
+ ], [
+ 'param' => 'ssl',
+ 'value' => $ssl == 'on' ? 1 : 0
+ ], [
+ 'param' => 'mysql_debug',
+ 'value' => $mysql_debug == 'on' ? 1 : 0
+ ], [
+ 'param' => 'htaccess_cache',
+ 'value' => $htaccess_cache == 'on' ? 1 : 0
+ ], [
+ 'param' => 'visits',
+ 'value' => $visits
+ ], [
+ 'param' => 'links_structure',
+ 'value' => $links_structure
+ ], [
+ 'param' => 'link_version',
+ 'value' => $link_version
+ ], [
+ 'param' => 'widget_phone',
+ 'value' => $widget_phone == 'on' ? 1 : 0
+ ], [
+ 'param' => 'update_key',
+ 'value' => $update_key
+ ]
+ ]
+ );
+
+ \S::set_message( 'Ustawienia zostały zapisane' );
+ \S::delete_cache();
+ \S::htacces();
+
+ return true;
+ }
+
+ public static function settings_details()
+ {
+ global $mdb;
+
+ $results = $mdb -> select( 'pp_settings', '*', [ 'ORDER' => [ 'id' => 'ASC' ] ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ $settings[$row['param']] = $row['value'];
+
+ return $settings;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/factory/class.Update.php b/autoload/admin/factory/class.Update.php
new file mode 100644
index 0000000..277d55d
--- /dev/null
+++ b/autoload/admin/factory/class.Update.php
@@ -0,0 +1,88 @@
+ (float)\S::get_version() )
+ {
+ if ( strlen( $ver ) == 5 )
+ $dir = substr( $ver, 0, strlen( $ver ) - 2 ) . 0;
+ else
+ $dir = substr( $ver, 0, strlen( $ver ) - 1 ) . 0;
+
+ $file = file_get_contents( 'http://www.cmspro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '.zip' );
+
+ $dlHandler = fopen( 'update.zip' , 'w' );
+ if ( !fwrite( $dlHandler, $file ) )
+ return false;
+ fclose( $dlHandler );
+
+ if ( !file_exists( 'update.zip' ) )
+ return false;
+ else
+ {
+ /* aktualizacja bazy danych */
+ $sql = file_get_contents( 'http://www.cmspro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_sql.txt' );
+ $sql = explode( PHP_EOL, $sql );
+ if ( is_array( $sql ) and !empty( $sql ) ) foreach ( $sql as $query )
+ {
+ if ( $sql )
+ $result = $mdb -> query( $query );
+ }
+
+ /* usuwanie zbędnych plików */
+ $lines = file_get_contents( 'http://www.cmspro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_files.txt' );
+ $lines = explode( PHP_EOL, $lines );
+ if ( is_array( $lines ) ) foreach ( $lines as $line )
+ {
+ if ( strpos( $line, 'F: ' ) !== false )
+ {
+ $file = substr( $line, 3, strlen( $line ) );
+ if ( file_exists( $file ) )
+ unlink( $file );
+ }
+
+ if ( strpos( $line, 'D: ' ) !== false )
+ {
+ $dir = substr( $line, 3, strlen( $line ) );
+ if ( is_dir( $dir ) )
+ \S::delete_dir( $dir );
+ }
+ }
+
+ /* wgrywanie nowych plików */
+ $file_name = 'update.zip';
+
+ $path = pathinfo( realpath( $file_name ), PATHINFO_DIRNAME );
+ $path = substr( $path, 0, strlen( $path ) - 5 );
+ $zip = new \ZipArchive;
+ $res = $zip -> open( $file_name );
+ if ( $res === TRUE )
+ {
+ $zip -> extractTo( $path );
+ $zip -> close();
+ unlink( $file_name );
+ }
+
+ $updateThis = fopen( '../libraries/version.ini', 'w' );
+ fwrite( $updateThis, $ver );
+ fclose( $updateThis );
+
+ return true;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/autoload/admin/factory/class.Users.php b/autoload/admin/factory/class.Users.php
new file mode 100644
index 0000000..a7c68eb
--- /dev/null
+++ b/autoload/admin/factory/class.Users.php
@@ -0,0 +1,185 @@
+ delete( 'pp_users', [ 'id' => (int)$user_id ] );
+
+ }
+
+ public static function user_details( $user_id )
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_users', '*', [ 'id' => (int)$user_id ] );
+ }
+
+ public static function user_privileges( $user_id )
+ {
+ global $mdb;
+ 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 )
+ {
+ global $mdb, $lang;
+
+ $mdb -> delete( 'pp_users_privileges', [ 'id_user' => (int) $user_id ] );
+
+ if ( !$user_id )
+ {
+ 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 ( $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 ( is_array( $privileges ) )
+ {
+ foreach ( $privileges as $pri )
+ {
+ $mdb -> insert( 'pp_users_privileges',
+ [
+ 'name' => $pri,
+ 'id_user' => $id_user
+ ] );
+ }
+ }
+ else
+ {
+ $mdb -> insert( 'pp_users_privileges',
+ [
+ 'name' => $privileges,
+ 'id_user' => $id_user
+ ] );
+ }
+
+ 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 $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
+ ] );
+
+ $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
+ ] );
+
+ if ( is_array( $privileges ) )
+ {
+ foreach ( $privileges as $pri )
+ {
+ $mdb -> insert( 'pp_users_privileges', [
+ 'name' => $pri,
+ 'id_user' => $user_id
+ ] );
+ }
+ }
+ else
+ {
+ $mdb -> insert( 'pp_users_privileges', [
+ 'name' => $privileges,
+ 'id_user' => $user_id
+ ] );
+ }
+ return $response = [ 'status' => 'ok', 'msg' => 'Uzytkownik został zapisany.' ];
+ }
+ \S::delete_cache();
+ }
+
+ 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.' ];
+
+ return $response = [ 'status' => 'ok' ];
+ }
+
+ public static function logon( $login, $password )
+ {
+ global $mdb;
+
+ 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, '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 ] );
+ 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', [ 'status' => 0 ], [ 'login' => $login ] );
+ return -1;
+ }
+ }
+ return 0;
+ }
+
+ public static function details( $login )
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_users', '*', [ 'login' => $login ] );
+ }
+
+ public static function check_privileges( $name, $user_id )
+ {
+ global $mdb;
+
+ 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;
+ }
+ }
+}
+?>
diff --git a/autoload/admin/view/class.Articles.php b/autoload/admin/view/class.Articles.php
new file mode 100644
index 0000000..127ad9f
--- /dev/null
+++ b/autoload/admin/view/class.Articles.php
@@ -0,0 +1,37 @@
+ render( 'articles/articles-browse-list' );
+ }
+
+ public static function subpages_list( $pages, $article_pages, $parent_id = 0, $step = 1 )
+ {
+ $tpl = new \Tpl();
+ $tpl -> pages = $pages;
+ $tpl -> parent_id = $parent_id;
+ $tpl -> step = $step;
+ $tpl -> article_pages = $article_pages;
+ return $tpl -> render( 'articles/subpages-list' );
+ }
+
+ public static function articles_list()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'articles/articles-list' );
+ }
+
+ public static function article_edit( $values )
+ {
+ $tpl = new \Tpl;
+ if ( is_array( $values ) ) foreach ( $values as $key => $val )
+ $tpl -> $key = $val;
+ return $tpl -> render( 'articles/article-edit' );
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/view/class.ArticlesArchive.php b/autoload/admin/view/class.ArticlesArchive.php
new file mode 100644
index 0000000..766aa2b
--- /dev/null
+++ b/autoload/admin/view/class.ArticlesArchive.php
@@ -0,0 +1,11 @@
+ render( 'articles/articles-archive-list' );
+ }
+}
diff --git a/autoload/admin/view/class.Backups.php b/autoload/admin/view/class.Backups.php
new file mode 100644
index 0000000..7f602a0
--- /dev/null
+++ b/autoload/admin/view/class.Backups.php
@@ -0,0 +1,12 @@
+ backups = $backups;
+ return $tpl -> render ('backups/backup-list');
+ }
+}
diff --git a/autoload/admin/view/class.Banners.php b/autoload/admin/view/class.Banners.php
new file mode 100644
index 0000000..ff1ee58
--- /dev/null
+++ b/autoload/admin/view/class.Banners.php
@@ -0,0 +1,20 @@
+ render( 'banners/banners-list' );
+ }
+
+ public static function banner_edit( $banner, $languages )
+ {
+ $tpl = new \Tpl;
+ $tpl -> banner = $banner;
+ $tpl -> languages = $languages;
+ return $tpl -> render( 'banners/banner-edit' );
+ }
+}
+?>
diff --git a/autoload/admin/view/class.Emails.php b/autoload/admin/view/class.Emails.php
new file mode 100644
index 0000000..b91cf56
--- /dev/null
+++ b/autoload/admin/view/class.Emails.php
@@ -0,0 +1,17 @@
+ render( 'emails/emails-list' );
+ }
+ public static function email_details( $email )
+ {
+ $tpl = new \Tpl;
+ $tpl -> email = $email;
+ return $tpl -> render( 'emails/email-details' );
+ }
+}
diff --git a/autoload/admin/view/class.FileManager.php b/autoload/admin/view/class.FileManager.php
new file mode 100644
index 0000000..15a45de
--- /dev/null
+++ b/autoload/admin/view/class.FileManager.php
@@ -0,0 +1,12 @@
+ render( 'filemanager/filemanager' );
+ }
+}
+?>
diff --git a/autoload/admin/view/class.Languages.php b/autoload/admin/view/class.Languages.php
new file mode 100644
index 0000000..96a2bd5
--- /dev/null
+++ b/autoload/admin/view/class.Languages.php
@@ -0,0 +1,32 @@
+
+
+namespace admin\view;
+
+class Languages
+{
+ public static function translation_edit( $translation, $languages )
+ {
+ $tpl = new \Tpl;
+ $tpl -> languages = $languages;
+ $tpl -> translation = $translation;
+ return $tpl -> render( 'languages/translation-edit' );
+ }
+ public static function language_edit( $language, $order )
+ {
+ $tpl = new \Tpl;
+ $tpl -> language = $language;
+ $tpl -> order = $order;
+ return $tpl -> render( 'languages/language-edit' );
+ }
+ public static function translations_list()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'languages/translations-list' );
+ }
+ public static function languages_list()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'languages/languages-list' );
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/view/class.Layouts.php b/autoload/admin/view/class.Layouts.php
new file mode 100644
index 0000000..cd47888
--- /dev/null
+++ b/autoload/admin/view/class.Layouts.php
@@ -0,0 +1,29 @@
+ pages = $pages;
+ $tpl -> step = $step;
+ $tpl -> layout_pages = $layout_pages;
+ return $tpl -> render( 'layouts/subpages-list' );
+ }
+
+ public static function layout_edit( $layout, $menus )
+ {
+ $tpl = new \Tpl;
+ $tpl -> layout = $layout;
+ $tpl -> menus = $menus;
+ return $tpl -> render( 'layouts/layout-edit' );
+ }
+
+ public static function layouts_list()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'layouts/layouts-list' );
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/view/class.Newsletter.php b/autoload/admin/view/class.Newsletter.php
new file mode 100644
index 0000000..f40fb74
--- /dev/null
+++ b/autoload/admin/view/class.Newsletter.php
@@ -0,0 +1,55 @@
+ render( 'newsletter/emails-list' );
+ }
+
+ public static function preview( $articles, $settings, $template, $dates = '' )
+ {
+ $tpl = new \Tpl;
+ $tpl -> articles = $articles;
+ $tpl -> settings = $settings;
+ $tpl -> template = $template;
+ $tpl -> dates = $dates;
+ return $tpl -> render( 'newsletter/preview' );
+ }
+
+ public static function prepare( $templates )
+ {
+ $tpl = new \Tpl;
+ $tpl -> templates = $templates;
+ return $tpl -> render( 'newsletter/prepare' );
+ }
+
+ public static function settings( $settings )
+ {
+ $tpl = new \Tpl;
+ $tpl -> settings = $settings;
+ return $tpl -> render( 'newsletter/settings' );
+ }
+
+ public static function email_templates_user()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'newsletter/email-templates-user' );
+ }
+
+ public static function email_templates_admin()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'newsletter/email-templates-admin' );
+ }
+
+ public static function email_template_edit($template)
+ {
+ $tpl = new \Tpl;
+ $tpl -> email_template = $template;
+ return $tpl -> render( 'newsletter/email-template-edit' );
+ }
+}
+
\ No newline at end of file
diff --git a/autoload/admin/view/class.Page.php b/autoload/admin/view/class.Page.php
new file mode 100644
index 0000000..23bcbce
--- /dev/null
+++ b/autoload/admin/view/class.Page.php
@@ -0,0 +1,18 @@
+ content = \admin\Site::route();
+ return $tpl -> render( 'site/main-layout' );
+ }
+}
+?>
diff --git a/autoload/admin/view/class.PagePanel.php b/autoload/admin/view/class.PagePanel.php
new file mode 100644
index 0000000..2fc13ab
--- /dev/null
+++ b/autoload/admin/view/class.PagePanel.php
@@ -0,0 +1,21 @@
+ _add = $add;
+ $tpl -> _save = $save;
+ $tpl -> _cancel = $cancel;
+ $tpl -> _id_form = $form;
+ $tpl -> _title = $title;
+ $tpl -> _back = $back;
+ $tpl -> _update = $update;
+ $tpl -> _save_ajax = $save_ajax;
+ $tpl -> _delete_ajax = $delete_ajax;
+ return $tpl -> render( 'other/page-panel' );
+ }
+}
+?>
diff --git a/autoload/admin/view/class.Pages.php b/autoload/admin/view/class.Pages.php
new file mode 100644
index 0000000..f6c521e
--- /dev/null
+++ b/autoload/admin/view/class.Pages.php
@@ -0,0 +1,68 @@
+
+namespace admin\view;
+
+class Pages
+{
+ public static function subpages_browse_list( $pages, $parent_id = null, $step = 1 )
+ {
+ $tpl = new \Tpl();
+ $tpl -> pages = $pages;
+ $tpl -> parent_id = $parent_id;
+ $tpl -> step = $step;
+ return $tpl -> render( 'pages/subpages-browse-list' );
+ }
+
+ static public function browse_list( $menus, $modal = false )
+ {
+ return \Tpl::view( 'pages/pages-browse-list', [
+ 'menus' => $menus,
+ 'modal' => $modal
+ ] );
+ }
+
+ public static function page_articles( $page_id, $articles )
+ {
+ $tpl = new \Tpl;
+ $tpl -> page_id = $page_id;
+ $tpl -> articles = $articles;
+ return $tpl -> render( 'pages/page-articles' );
+ }
+
+ public static function page_edit( $page, $parent_id, $menu_id, $menus, $layouts, $languages, $settings )
+ {
+ $tpl = new \Tpl;
+ $tpl -> menu_id = $menu_id;
+ $tpl -> parent_id = $parent_id;
+ $tpl -> menus = $menus;
+ $tpl -> page = $page;
+ $tpl -> layouts = $layouts;
+ $tpl -> languages = $languages;
+ $tpl -> settings = $settings;
+ return $tpl -> render( 'pages/page-edit' );
+
+ }
+
+ public static function menu_edit( $menu )
+ {
+ $tpl = new \Tpl;
+ $tpl -> menu = $menu;
+ return $tpl -> render( 'pages/menu-edit' );
+ }
+
+ public static function pages_list( $menus )
+ {
+ $tpl = new \Tpl;
+ $tpl -> menus = $menus;
+ return $tpl -> render( 'pages/pages-list' );
+ }
+
+ public static function subpages_list( $pages, $parent_id = null, $step = 1 )
+ {
+ $tpl = new \Tpl();
+ $tpl -> pages = $pages;
+ $tpl -> parent_id = $parent_id;
+ $tpl -> step = $step;
+ return $tpl -> render( 'pages/subpages-list' );
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/view/class.Scontainers.php b/autoload/admin/view/class.Scontainers.php
new file mode 100644
index 0000000..8496c54
--- /dev/null
+++ b/autoload/admin/view/class.Scontainers.php
@@ -0,0 +1,20 @@
+ container = $container;
+ $tpl -> languages = $languages;
+ return $tpl -> render( 'scontainers/container-edit' );
+ }
+
+ public static function containers_list()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'scontainers/containers-list' );
+ }
+}
diff --git a/autoload/admin/view/class.SeoAdditional.php b/autoload/admin/view/class.SeoAdditional.php
new file mode 100644
index 0000000..4d15e03
--- /dev/null
+++ b/autoload/admin/view/class.SeoAdditional.php
@@ -0,0 +1,17 @@
+ element = $element;
+ return $tpl -> render( 'seo-additional/element-edit' );
+ }
+
+ public static function main_view()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'seo-additional/main-view' );
+ }
+}
diff --git a/autoload/admin/view/class.Settings.php b/autoload/admin/view/class.Settings.php
new file mode 100644
index 0000000..8ee7e4b
--- /dev/null
+++ b/autoload/admin/view/class.Settings.php
@@ -0,0 +1,13 @@
+
+namespace admin\view;
+
+class Settings
+{
+ public static function view( $settings )
+ {
+ $tpl = new \Tpl;
+ $tpl -> settings = $settings;
+ return $tpl -> render( 'settings/settings' );
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/admin/view/class.Update.php b/autoload/admin/view/class.Update.php
new file mode 100644
index 0000000..a2e0f7f
--- /dev/null
+++ b/autoload/admin/view/class.Update.php
@@ -0,0 +1,13 @@
+ ver = \S::get_version();
+ $tpl -> new_ver = \S::get_new_version();
+ return $tpl -> render( 'update/main-view' );
+ }
+}
diff --git a/autoload/admin/view/class.Users.php b/autoload/admin/view/class.Users.php
new file mode 100644
index 0000000..fa16e51
--- /dev/null
+++ b/autoload/admin/view/class.Users.php
@@ -0,0 +1,26 @@
+ render( 'site/unlogged-layout' );
+ }
+
+ public static function users_list()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'users/users-list' );
+ }
+
+ public static function user_edit( $user, $privileges )
+ {
+ $tpl = new \Tpl;
+ $tpl -> user = $user;
+ $tpl -> privileges = $privileges;
+ return $tpl -> render( 'users/user-edit' );
+ }
+}
+?>
diff --git a/autoload/class.Article.php b/autoload/class.Article.php
new file mode 100644
index 0000000..76eca61
--- /dev/null
+++ b/autoload/class.Article.php
@@ -0,0 +1,196 @@
+ get( 'pp_articles', '*', [ 'id' => (int)$article_id ] );
+ if ( \S::is_array_fix( $result ) ) foreach ( $result as $key => $val )
+ $this -> $key = $val;
+
+ $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'] )
+ {
+ $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 )
+ $this -> language = $row2;
+ }
+ else
+ $this -> language = $row;
+
+ preg_match_all( \front\view\Site::container_pattern, $this -> 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 );
+ $this -> language['entry'] = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $this -> language['entry'] );
+ }
+
+ preg_match_all( \front\view\Site::container_pattern, $this -> 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 );
+ $this -> language['text'] = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $this -> language['text'] );
+ }
+ }
+
+ $this -> images = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC' ] ] );
+ $this -> files = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id ] );
+ $this -> pages = $mdb -> select( 'pp_articles_pages', 'page_id', [ 'article_id' => (int)$article_id ] );
+ $this -> 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'];
+ else
+ $params[ $row['name'] ][$row['language_id']] = $row['value'];
+ }
+ $this -> params = $params;
+ }
+
+ public function updateView()
+ {
+ global $mdb;
+ $mdb -> update( 'pp_articles', [ 'views[+]' => 1 ], [ 'id' => $this -> id ] );
+ }
+
+ static public function newsList( $articles )
+ {
+ return \Tpl::view( 'articles/news-list', [
+ 'articles' => $articles
+ ] );
+ }
+
+ // pobierz najczęściej wyświtlane artykuły
+ static public function getTopNews( $page_id, $limit = 6, $lang_id )
+ {
+ global $mdb;
+
+ if ( !$articles_id = \Cache::fetch( "getTopNews:$page_id:$limit:$lang_id" ) )
+ {
+ $articles_id = $mdb -> query( 'SELECT * FROM ( '
+ . 'SELECT '
+ . 'a.id, date_add, views, '
+ . '( 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.views DESC '
+ . 'LIMIT '
+ . '0, ' . (int)$limit ) -> fetchAll( \PDO::FETCH_ASSOC );
+ \Cache::store( "getTopNews:$page_id:$limit:$lang_id", $articles_id );
+ }
+
+ if ( \S::is_array_fix( $articles_id ) ) foreach ( $articles_id as $article_tmp )
+ {
+ if ( !$article = \Cache::fetch( 'article:' . $article_tmp['id'] . ':' . $lang_id ) )
+ {
+ $article = new \Article( $article_tmp['id'], $lang_id );
+ \Cache::store( 'article:' . $article_tmp['id'] . ':' . $lang_id, $article );
+ }
+ $articles[] = $article;
+ }
+
+ return $articles;
+ }
+
+ static public function getNews( $page_id, $limit = 6, $lang_id )
+ {
+ global $mdb;
+
+ if ( !$articles_id = \Cache::fetch( "getNews:$page_id:$limit:$lang_id" ) )
+ {
+ $articles_id = $mdb -> query( 'SELECT * FROM ( '
+ . 'SELECT '
+ . 'a.id, date_add, '
+ . '( 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.date_add DESC '
+ . 'LIMIT '
+ . '0, ' . (int)$limit ) -> fetchAll( \PDO::FETCH_ASSOC );
+ \Cache::store( "getNews:$page_id:$limit:$lang_id", $articles_id );
+ }
+
+ if ( \S::is_array_fix( $articles_id ) ) foreach ( $articles_id as $article_tmp )
+ {
+ if ( !$article = \Cache::fetch( 'article:' . $article_tmp['id'] . ':' . $lang_id ) )
+ {
+ $article = new \Article( $article_tmp['id'], $lang_id );
+ \Cache::store( 'article:' . $article_tmp['id'] . ':' . $lang_id, $article );
+ }
+ $articles[] = $article;
+ }
+
+ return $articles;
+ }
+
+ public function __get( $variable )
+ {
+ if ( array_key_exists( $variable, $this -> data ) )
+ return $this -> $variable;
+ }
+
+ public function __set( $variable, $value )
+ {
+ $this -> $variable = $value;
+ }
+
+ public function offsetExists( $offset )
+ {
+ return isset( $this -> $offset );
+ }
+
+ public function offsetGet( $offset )
+ {
+ return $this -> $offset;
+ }
+
+ public function offsetSet( $offset, $value )
+ {
+ $this -> $offset = $value;
+ }
+
+ public function offsetUnset( $offset )
+ {
+ unset( $this -> $offset );
+ }
+}
\ No newline at end of file
diff --git a/autoload/class.Cache.php b/autoload/class.Cache.php
new file mode 100644
index 0000000..d268fcb
--- /dev/null
+++ b/autoload/class.Cache.php
@@ -0,0 +1,46 @@
+ $data[0] )
+ {
+ if ( file_exists( $filename ) )
+ unlink( $filename );
+ return false;
+ }
+
+ return $data[1];
+ }
+}
+?>
\ No newline at end of file
diff --git a/autoload/class.Html.php b/autoload/class.Html.php
new file mode 100644
index 0000000..d2500c9
--- /dev/null
+++ b/autoload/class.Html.php
@@ -0,0 +1,91 @@
+ params = $params;
+ return $tpl -> render( 'html/form-text' );
+ }
+
+ public static function input_switch( array $params = array() )
+ {
+ $tpl = new \Tpl;
+ $tpl -> params = $params;
+ return $tpl -> render( 'html/input-switch' );
+ }
+
+ public static function select( array $params = array() )
+ {
+ $tpl = new \Tpl;
+ $tpl -> params = $params;
+ return $tpl -> render( 'html/select' );
+ }
+
+ public static function textarea( array $params = array() )
+ {
+ $defaults = array(
+ 'rows' => 4,
+ );
+
+ $params = array_merge( $defaults, $params );
+
+ $tpl = new \Tpl;
+ $tpl -> params = $params;
+ return $tpl -> render( 'html/textarea' );
+ }
+
+ public static function input_icon( array $params = array() )
+ {
+ $defaults = array(
+ 'type' => 'text',
+ );
+
+ $params = array_merge( $defaults, $params );
+
+ $tpl = new \Tpl;
+ $tpl -> params = $params;
+ return $tpl -> render( 'html/input-icon' );
+ }
+
+ public static function input( array $params = array() )
+ {
+ $defaults = array(
+ 'type' => 'text',
+ );
+
+ $params = array_merge( $defaults, $params );
+
+ $tpl = new \Tpl;
+ $tpl -> params = $params;
+ return $tpl -> render( 'html/input' );
+ }
+
+ public static function button( array $params = array() )
+ {
+ $defaults = array(
+ 'class' => 'btn-sm btn-info',
+ );
+
+ $params = array_merge( $defaults, $params );
+
+ $tpl = new \Tpl;
+ $tpl -> params = $params;
+ return $tpl -> render( 'html/button' );
+ }
+
+ public static function panel( array $params = array() )
+ {
+ $defaults = array(
+ 'title' => 'panel-title',
+ 'class' => 'panel-primary',
+ 'content' => 'panel-content'
+ );
+
+ $params = array_merge( $defaults, $params );
+
+ $tpl = new \Tpl;
+ $tpl -> params = $params;
+ return $tpl -> render( 'html/panel' );
+ }
+}
diff --git a/autoload/class.Image.php b/autoload/class.Image.php
new file mode 100644
index 0000000..0322890
--- /dev/null
+++ b/autoload/class.Image.php
@@ -0,0 +1,312 @@
+ img_src = $file;
+ $this->setImageFile($file);
+ } else {
+ echo 'a'; exit;
+ $this->setImageString($file);
+ }
+ }
+ }
+
+ /**
+ * Set image resource from file
+ *
+ * @param string $file Path to image file
+ * @return ImageManipulator for a fluent interface
+ * @throws InvalidArgumentException
+ */
+ public function setImageFile($file)
+ {
+ if (!(is_readable($file) && is_file($file))) {
+ throw new InvalidArgumentException("Image file $file is not readable");
+ }
+
+ if (is_resource($this->image)) {
+ imagedestroy($this->image);
+ }
+
+ list ($this->width, $this->height, $type) = getimagesize($file);
+
+ switch ($type) {
+ case IMAGETYPE_GIF :
+ $this->image = imagecreatefromgif($file);
+ break;
+ case IMAGETYPE_JPEG :
+ $this->image = imagecreatefromjpeg($file);
+ break;
+ case IMAGETYPE_PNG :
+ $this->image = imagecreatefrompng($file);
+ break;
+ default :
+ throw new InvalidArgumentException("Image type $type not supported");
+ }
+
+ return $this;
+ }
+
+ /**
+ * Set image resource from string data
+ *
+ * @param string $data
+ * @return ImageManipulator for a fluent interface
+ * @throws RuntimeException
+ */
+ public function setImageString($data)
+ {
+ if (is_resource($this->image)) {
+ imagedestroy($this->image);
+ }
+
+ if (!$this->image = imagecreatefromstring($data)) {
+ throw new RuntimeException('Cannot create image from data string');
+ }
+ $this->width = imagesx($this->image);
+ $this->height = imagesy($this->image);
+ return $this;
+ }
+
+ /**
+ * Resamples the current image
+ *
+ * @param int $width New width
+ * @param int $height New height
+ * @param bool $constrainProportions Constrain current image proportions when resizing
+ * @return ImageManipulator for a fluent interface
+ * @throws RuntimeException
+ */
+ public function resample( $width, $height, $constrainProportions = true )
+ {
+ if (!is_resource($this->image)) {
+ throw new RuntimeException('No image set');
+ }
+ if ($constrainProportions) {
+ if ($this->height >= $this->width) {
+ $width = round($height / $this->height * $this->width);
+ } else {
+ $height = round($width / $this->width * $this->height);
+ }
+ }
+
+ $temp = imagecreatetruecolor($width, $height);
+
+ imagecopyresampled($temp, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);
+
+ if ( function_exists('exif_read_data') )
+ {
+ $exif = exif_read_data( $this -> img_src );
+ if ( $exif && isset($exif['Orientation']) )
+ {
+ $orientation = $exif['Orientation'];
+ if ( $orientation != 1 )
+ {
+ $deg = 0;
+ switch ($orientation)
+ {
+ case 3:
+ $deg = 180;
+ break;
+ case 6:
+ $deg = 270;
+ break;
+ case 8:
+ $deg = 90;
+ break;
+ }
+
+ if ( $deg )
+ $temp = imagerotate( $temp, $deg, 0 );
+ }
+ }
+ }
+ return $this->_replace($temp);
+ }
+
+ /**
+ * Enlarge canvas
+ *
+ * @param int $width Canvas width
+ * @param int $height Canvas height
+ * @param array $rgb RGB colour values
+ * @param int $xpos X-Position of image in new canvas, null for centre
+ * @param int $ypos Y-Position of image in new canvas, null for centre
+ * @return ImageManipulator for a fluent interface
+ * @throws RuntimeException
+ */
+ public function enlargeCanvas($width, $height, array $rgb = array(), $xpos = null, $ypos = null)
+ {
+ if (!is_resource($this->image)) {
+ throw new RuntimeException('No image set');
+ }
+
+ $width = max($width, $this->width);
+ $height = max($height, $this->height);
+
+ $temp = imagecreatetruecolor($width, $height);
+ if (count($rgb) == 3) {
+ $bg = imagecolorallocate($temp, $rgb[0], $rgb[1], $rgb[2]);
+ imagefill($temp, 0, 0, $bg);
+ }
+
+ if (null === $xpos) {
+ $xpos = round(($width - $this->width) / 2);
+ }
+ if (null === $ypos) {
+ $ypos = round(($height - $this->height) / 2);
+ }
+
+ imagecopy($temp, $this->image, (int) $xpos, (int) $ypos, 0, 0, $this->width, $this->height);
+ return $this->_replace($temp);
+ }
+
+ /**
+ * Crop image
+ *
+ * @param int|array $x1 Top left x-coordinate of crop box or array of coordinates
+ * @param int $y1 Top left y-coordinate of crop box
+ * @param int $x2 Bottom right x-coordinate of crop box
+ * @param int $y2 Bottom right y-coordinate of crop box
+ * @return ImageManipulator for a fluent interface
+ * @throws RuntimeException
+ */
+ public function crop($x1, $y1 = 0, $x2 = 0, $y2 = 0)
+ {
+ if (!is_resource($this->image)) {
+ throw new RuntimeException('No image set');
+ }
+ if (is_array($x1) && 4 == count($x1)) {
+ list($x1, $y1, $x2, $y2) = $x1;
+ }
+
+ $x1 = max($x1, 0);
+ $y1 = max($y1, 0);
+
+ $x2 = min($x2, $this->width);
+ $y2 = min($y2, $this->height);
+
+ $width = $x2 - $x1;
+ $height = $y2 - $y1;
+
+ $temp = imagecreatetruecolor($width, $height);
+ imagecopy($temp, $this->image, 0, 0, $x1, $y1, $width, $height);
+
+ return $this->_replace($temp);
+ }
+
+ /**
+ * Replace current image resource with a new one
+ *
+ * @param resource $res New image resource
+ * @return ImageManipulator for a fluent interface
+ * @throws UnexpectedValueException
+ */
+ protected function _replace($res)
+ {
+ if (!is_resource($res)) {
+ throw new UnexpectedValueException('Invalid resource');
+ }
+ if (is_resource($this->image)) {
+ imagedestroy($this->image);
+ }
+ $this->image = $res;
+ $this->width = imagesx($res);
+ $this->height = imagesy($res);
+ return $this;
+ }
+
+ /**
+ * Save current image to file
+ *
+ * @param string $fileName
+ * @return void
+ * @throws RuntimeException
+ */
+ public function save($fileName, $type = IMAGETYPE_JPEG)
+ {
+ $dir = dirname($fileName);
+ if (!is_dir($dir)) {
+ if (!mkdir($dir, 0755, true)) {
+ throw new RuntimeException('Error creating directory ' . $dir);
+ }
+ }
+
+ try {
+ switch ($type) {
+ case IMAGETYPE_GIF :
+ if (!imagegif($this->image, $fileName)) {
+ throw new RuntimeException;
+ }
+ break;
+ case IMAGETYPE_PNG :
+ if (!imagepng($this->image, $fileName)) {
+ throw new RuntimeException;
+ }
+ break;
+ case IMAGETYPE_JPEG :
+ default :
+ if (!imagejpeg($this->image, $fileName, 95)) {
+ throw new RuntimeException;
+ }
+ }
+ } catch (Exception $ex) {
+ throw new RuntimeException('Error saving image file to ' . $fileName);
+ }
+ }
+
+ /**
+ * Returns the GD image resource
+ *
+ * @return resource
+ */
+ public function getResource()
+ {
+ return $this->image;
+ }
+
+ /**
+ * Get current image resource width
+ *
+ * @return int
+ */
+ public function getWidth()
+ {
+ return $this->width;
+ }
+
+ /**
+ * Get current image height
+ *
+ * @return int
+ */
+ public function getHeight()
+ {
+ return $this->height;
+ }
+}
\ No newline at end of file
diff --git a/autoload/class.Mobile_Detect.php b/autoload/class.Mobile_Detect.php
new file mode 100644
index 0000000..50d57f0
--- /dev/null
+++ b/autoload/class.Mobile_Detect.php
@@ -0,0 +1,1431 @@
+
+ * Nick Ilyin
+ *
+ * Original author: Victor Stanciu
+ *
+ * @license Code and contributions have 'MIT License'
+ * More details: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
+ *
+ * @link Homepage: http://mobiledetect.net
+ * GitHub Repo: https://github.com/serbanghita/Mobile-Detect
+ * Google Code: http://code.google.com/p/php-mobile-detect/
+ * README: https://github.com/serbanghita/Mobile-Detect/blob/master/README.md
+ * HOWTO: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples
+ *
+ * @version 2.8.16
+ */
+
+class Mobile_Detect
+{
+ /**
+ * Mobile detection type.
+ *
+ * @deprecated since version 2.6.9
+ */
+ const DETECTION_TYPE_MOBILE = 'mobile';
+
+ /**
+ * Extended detection type.
+ *
+ * @deprecated since version 2.6.9
+ */
+ const DETECTION_TYPE_EXTENDED = 'extended';
+
+ /**
+ * A frequently used regular expression to extract version #s.
+ *
+ * @deprecated since version 2.6.9
+ */
+ const VER = '([\w._\+]+)';
+
+ /**
+ * Top-level device.
+ */
+ const MOBILE_GRADE_A = 'A';
+
+ /**
+ * Mid-level device.
+ */
+ const MOBILE_GRADE_B = 'B';
+
+ /**
+ * Low-level device.
+ */
+ const MOBILE_GRADE_C = 'C';
+
+ /**
+ * Stores the version number of the current release.
+ */
+ const VERSION = '2.8.16';
+
+ /**
+ * A type for the version() method indicating a string return value.
+ */
+ const VERSION_TYPE_STRING = 'text';
+
+ /**
+ * A type for the version() method indicating a float return value.
+ */
+ const VERSION_TYPE_FLOAT = 'float';
+
+ /**
+ * A cache for resolved matches
+ * @var array
+ */
+ protected $cache = array();
+
+ /**
+ * The User-Agent HTTP header is stored in here.
+ * @var string
+ */
+ protected $userAgent = null;
+
+ /**
+ * HTTP headers in the PHP-flavor. So HTTP_USER_AGENT and SERVER_SOFTWARE.
+ * @var array
+ */
+ protected $httpHeaders = array();
+
+ /**
+ * CloudFront headers. E.g. CloudFront-Is-Desktop-Viewer, CloudFront-Is-Mobile-Viewer & CloudFront-Is-Tablet-Viewer.
+ * @var array
+ */
+ protected $cloudfrontHeaders = array();
+
+ /**
+ * The matching Regex.
+ * This is good for debug.
+ * @var string
+ */
+ protected $matchingRegex = null;
+
+ /**
+ * The matches extracted from the regex expression.
+ * This is good for debug.
+ * @var string
+ */
+ protected $matchesArray = null;
+
+ /**
+ * The detection type, using self::DETECTION_TYPE_MOBILE or self::DETECTION_TYPE_EXTENDED.
+ *
+ * @deprecated since version 2.6.9
+ *
+ * @var string
+ */
+ protected $detectionType = self::DETECTION_TYPE_MOBILE;
+
+ /**
+ * HTTP headers that trigger the 'isMobile' detection
+ * to be true.
+ *
+ * @var array
+ */
+ protected static $mobileHeaders = array(
+
+ 'HTTP_ACCEPT' => array('matches' => array(
+ // Opera Mini; @reference: http://dev.opera.com/articles/view/opera-binary-markup-language/
+ 'application/x-obml2d',
+ // BlackBerry devices.
+ 'application/vnd.rim.html',
+ 'text/vnd.wap.wml',
+ 'application/vnd.wap.xhtml+xml'
+ )),
+ 'HTTP_X_WAP_PROFILE' => null,
+ 'HTTP_X_WAP_CLIENTID' => null,
+ 'HTTP_WAP_CONNECTION' => null,
+ 'HTTP_PROFILE' => null,
+ // Reported by Opera on Nokia devices (eg. C3).
+ 'HTTP_X_OPERAMINI_PHONE_UA' => null,
+ 'HTTP_X_NOKIA_GATEWAY_ID' => null,
+ 'HTTP_X_ORANGE_ID' => null,
+ 'HTTP_X_VODAFONE_3GPDPCONTEXT' => null,
+ 'HTTP_X_HUAWEI_USERID' => null,
+ // Reported by Windows Smartphones.
+ 'HTTP_UA_OS' => null,
+ // Reported by Verizon, Vodafone proxy system.
+ 'HTTP_X_MOBILE_GATEWAY' => null,
+ // Seen this on HTC Sensation. SensationXE_Beats_Z715e.
+ 'HTTP_X_ATT_DEVICEID' => null,
+ // Seen this on a HTC.
+ 'HTTP_UA_CPU' => array('matches' => array('ARM')),
+ );
+
+ /**
+ * List of mobile devices (phones).
+ *
+ * @var array
+ */
+ protected static $phoneDevices = array(
+ 'iPhone' => '\biPhone\b|\biPod\b', // |\biTunes
+ 'BlackBerry' => 'BlackBerry|\bBB10\b|rim[0-9]+',
+ 'HTC' => 'HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\bEVO\b|T-Mobile G1|Z520m',
+ 'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 6',
+ // @todo: Is 'Dell Streak' a tablet or a phone? ;)
+ 'Dell' => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b',
+ 'Motorola' => 'Motorola|DROIDX|DROID BIONIC|\bDroid\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\bMoto E\b',
+ 'Samsung' => 'Samsung|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205',
+ 'LG' => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802)',
+ 'Sony' => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533',
+ 'Asus' => 'Asus.*Galaxy|PadFone.*Mobile',
+ // http://www.micromaxinfo.com/mobiles/smartphones
+ // Added because the codes might conflict with Acer Tablets.
+ 'Micromax' => 'Micromax.*\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\b',
+ // @todo Complete the regex.
+ 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ;
+ 'Vertu' => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;)
+ // http://www.pantech.co.kr/en/prod/prodList.do?gbrand=VEGA (PANTECH)
+ // Most of the VEGA devices are legacy. PANTECH seem to be newer devices based on Android.
+ 'Pantech' => 'PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790',
+ // http://www.fly-phone.com/devices/smartphones/ ; Included only smartphones.
+ 'Fly' => 'IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250',
+ // http://fr.wikomobile.com
+ 'Wiko' => 'KITE 4G|HIGHWAY|GETAWAY|STAIRWAY|DARKSIDE|DARKFULL|DARKNIGHT|DARKMOON|SLIDE|WAX 4G|RAINBOW|BLOOM|SUNSET|GOA|LENNY|BARRY|IGGY|OZZY|CINK FIVE|CINK PEAX|CINK PEAX 2|CINK SLIM|CINK SLIM 2|CINK +|CINK KING|CINK PEAX|CINK SLIM|SUBLIM',
+ 'iMobile' => 'i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)',
+ // Added simvalley mobile just for fun. They have some interesting devices.
+ // http://www.simvalley.fr/telephonie---gps-_22_telephonie-mobile_telephones_.html
+ 'SimValley' => '\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\b',
+ // Wolfgang - a brand that is sold by Aldi supermarkets.
+ // http://www.wolfgangmobile.com/
+ 'Wolfgang' => 'AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q',
+ 'Alcatel' => 'Alcatel',
+ 'Nintendo' => 'Nintendo 3DS',
+ // http://en.wikipedia.org/wiki/Amoi
+ 'Amoi' => 'Amoi',
+ // http://en.wikipedia.org/wiki/INQ
+ 'INQ' => 'INQ',
+ // @Tapatalk is a mobile app; http://support.tapatalk.com/threads/smf-2-0-2-os-and-browser-detection-plugin-and-tapatalk.15565/#post-79039
+ 'GenericPhone' => 'Tapatalk|PDA;|SAGEM|\bmmp\b|pocket|\bpsp\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\bwap\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser',
+ );
+
+ /**
+ * List of tablet devices.
+ *
+ * @var array
+ */
+ protected static $tabletDevices = array(
+ 'iPad' => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic.
+ 'NexusTablet' => 'Android.*Nexus[\s]+(7|9|10)|^.*Android.*Nexus(?:(?!Mobile).)*$',
+ 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T360', // SCH-P709|SCH-P729|SM-T2558|GT-I9205 - Samsung Mega - treat them like a regular phone.
+ // http://docs.aws.amazon.com/silk/latest/developerguide/user-agent.html
+ 'Kindle' => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI)\b',
+ // Only the Surface tablets with Windows RT are considered mobile.
+ // http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx
+ 'SurfaceTablet' => 'Windows NT [0-9.]+; ARM;.*(Tablet|ARMBJS)',
+ // http://shopping1.hp.com/is-bin/INTERSHOP.enfinity/WFS/WW-USSMBPublicStore-Site/en_US/-/USD/ViewStandardCatalog-Browse?CatalogCategoryID=JfIQ7EN5lqMAAAEyDcJUDwMT
+ 'HPTablet' => 'HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10',
+ // Watch out for PadFone, see #132.
+ // http://www.asus.com/de/Tablets_Mobile/Memo_Pad_Products/
+ 'AsusTablet' => '^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\bK00F\b|\bK00C\b|\bK00E\b|\bK00L\b|TX201LA|ME176C|ME102A|\bM80TA\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K017 |ME572C|ME103K|ME170C|ME171C|\bME70C\b|ME581C|ME581CL|ME8510C|ME181C',
+ 'BlackBerryTablet' => 'PlayBook|RIM Tablet',
+ 'HTCtablet' => 'HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410',
+ 'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617',
+ 'NookTablet' => 'Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2',
+ // http://www.acer.ro/ac/ro/RO/content/drivers
+ // http://www.packardbell.co.uk/pb/en/GB/content/download (Packard Bell is part of Acer)
+ // http://us.acer.com/ac/en/US/content/group/tablets
+ // http://www.acer.de/ac/de/DE/content/models/tablets/
+ // Can conflict with Micromax and Motorola phones codes.
+ 'AcerTablet' => 'Android.*; \b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\b|W3-810|\bA3-A10\b|\bA3-A11\b',
+ // http://eu.computers.toshiba-europe.com/innovation/family/Tablets/1098744/banner_id/tablet_footerlink/
+ // http://us.toshiba.com/tablets/tablet-finder
+ // http://www.toshiba.co.jp/regza/tablet/
+ 'ToshibaTablet' => 'Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO',
+ // http://www.nttdocomo.co.jp/english/service/developer/smart_phone/technical_info/spec/index.html
+ // http://www.lg.com/us/tablets
+ 'LGTablet' => '\bL-06C|LG-V909|LG-V900|LG-V700|LG-V510|LG-V500|LG-V410|LG-V400|LG-VK810\b',
+ 'FujitsuTablet' => 'Android.*\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\b',
+ // Prestigio Tablets http://www.prestigio.com/support
+ 'PrestigioTablet' => 'PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD',
+ // http://support.lenovo.com/en_GB/downloads/default.page?#
+ 'LenovoTablet' => 'Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)',
+ // http://www.dell.com/support/home/us/en/04/Products/tab_mob/tablets
+ 'DellTablet' => 'Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7',
+ // http://www.yarvik.com/en/matrix/tablets/
+ 'YarvikTablet' => 'Android.*\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\b',
+ 'MedionTablet' => 'Android.*\bOYO\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB',
+ 'ArnovaTablet' => 'AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT|AN9G2',
+ // http://www.intenso.de/kategorie_en.php?kategorie=33
+ // @todo: http://www.nbhkdz.com/read/b8e64202f92a2df129126bff.html - investigate
+ 'IntensoTablet' => 'INM8002KP|INM1010FP|INM805ND|Intenso Tab|TAB1004',
+ // IRU.ru Tablets http://www.iru.ru/catalog/soho/planetable/
+ 'IRUTablet' => 'M702pro',
+ 'MegafonTablet' => 'MegaFon V9|\bZTE V9\b|Android.*\bMT7A\b',
+ // http://www.e-boda.ro/tablete-pc.html
+ 'EbodaTablet' => 'E-Boda (Supreme|Impresspeed|Izzycomm|Essential)',
+ // http://www.allview.ro/produse/droseries/lista-tablete-pc/
+ 'AllViewTablet' => 'Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)',
+ // http://wiki.archosfans.com/index.php?title=Main_Page
+ 'ArchosTablet' => '\b(101G9|80G9|A101IT)\b|Qilive 97R|Archos5|\bARCHOS (70|79|80|90|97|101|FAMILYPAD|)(b|)(G10| Cobalt| TITANIUM(HD|)| Xenon| Neon|XSK| 2| XS 2| PLATINUM| CARBON|GAMEPAD)\b',
+ // http://www.ainol.com/plugin.php?identifier=ainol&module=product
+ 'AinolTablet' => 'NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark',
+ // @todo: inspect http://esupport.sony.com/US/p/select-system.pl?DIRECTOR=DRIVER
+ // Readers http://www.atsuhiro-me.net/ebook/sony-reader/sony-reader-web-browser
+ // http://www.sony.jp/support/tablet/
+ 'SonyTablet' => 'Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551|SGP621|SGP612',
+ // http://www.support.philips.com/support/catalog/worldproducts.jsp?userLanguage=en&userCountry=cn&categoryid=3G_LTE_TABLET_SU_CN_CARE&title=3G%20tablets%20/%20LTE%20range&_dyncharset=UTF-8
+ 'PhilipsTablet' => '\b(PI2010|PI3000|PI3100|PI3105|PI3110|PI3205|PI3210|PI3900|PI4010|PI7000|PI7100)\b',
+ // db + http://www.cube-tablet.com/buy-products.html
+ 'CubeTablet' => 'Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT',
+ // http://www.cobyusa.com/?p=pcat&pcat_id=3001
+ 'CobyTablet' => 'MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010',
+ // http://www.match.net.cn/products.asp
+ 'MIDTablet' => 'M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733',
+ // http://www.msi.com/support
+ // @todo Research the Windows Tablets.
+ 'MSITablet' => 'MSI \b(Primo 73K|Primo 73L|Primo 81L|Primo 77|Primo 93|Primo 75|Primo 76|Primo 73|Primo 81|Primo 91|Primo 90|Enjoy 71|Enjoy 7|Enjoy 10)\b',
+ // @todo http://www.kyoceramobile.com/support/drivers/
+ // 'KyoceraTablet' => null,
+ // @todo http://intexuae.com/index.php/category/mobile-devices/tablets-products/
+ // 'IntextTablet' => null,
+ // http://pdadb.net/index.php?m=pdalist&list=SMiT (NoName Chinese Tablets)
+ // http://www.imp3.net/14/show.php?itemid=20454
+ 'SMiTTablet' => 'Android.*(\bMID\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)',
+ // http://www.rock-chips.com/index.php?do=prod&pid=2
+ 'RockChipTablet' => 'Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A',
+ // http://www.fly-phone.com/devices/tablets/ ; http://www.fly-phone.com/service/
+ 'FlyTablet' => 'IQ310|Fly Vision',
+ // http://www.bqreaders.com/gb/tablets-prices-sale.html
+ 'bqTablet' => '(bq)?.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris E10)|Maxwell.*Lite|Maxwell.*Plus',
+ // http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290
+ // http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets)
+ 'HuaweiTablet' => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim',
+ // Nec or Medias Tab
+ 'NecTablet' => '\bN-06D|\bN-08D',
+ // Pantech Tablets: http://www.pantechusa.com/phones/
+ 'PantechTablet' => 'Pantech.*P4100',
+ // Broncho Tablets: http://www.broncho.cn/ (hard to find)
+ 'BronchoTablet' => 'Broncho.*(N701|N708|N802|a710)',
+ // http://versusuk.com/support.html
+ 'VersusTablet' => 'TOUCHPAD.*[78910]|\bTOUCHTAB\b',
+ // http://www.zync.in/index.php/our-products/tablet-phablets
+ 'ZyncTablet' => 'z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900',
+ // http://www.positivoinformatica.com.br/www/pessoal/tablet-ypy/
+ 'PositivoTablet' => 'TB07STA|TB10STA|TB07FTA|TB10FTA',
+ // https://www.nabitablet.com/
+ 'NabiTablet' => 'Android.*\bNabi',
+ 'KoboTablet' => 'Kobo Touch|\bK080\b|\bVox\b Build|\bArc\b Build',
+ // French Danew Tablets http://www.danew.com/produits-tablette.php
+ 'DanewTablet' => 'DSlide.*\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\b',
+ // Texet Tablets and Readers http://www.texet.ru/tablet/
+ 'TexetTablet' => 'NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE',
+ // Avoid detecting 'PLAYSTATION 3' as mobile.
+ 'PlaystationTablet' => 'Playstation.*(Portable|Vita)',
+ // http://www.trekstor.de/surftabs.html
+ 'TrekstorTablet' => 'ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A|SurfTab',
+ // http://www.pyleaudio.com/Products.aspx?%2fproducts%2fPersonal-Electronics%2fTablets
+ 'PyleAudioTablet' => '\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\b',
+ // http://www.advandigital.com/index.php?link=content-product&jns=JP001
+ // because of the short codenames we have to include whitespaces to reduce the possible conflicts.
+ 'AdvanTablet' => 'Android.* \b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\b ',
+ // http://www.danytech.com/category/tablet-pc
+ 'DanyTechTablet' => 'Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1',
+ // http://www.galapad.net/product.html
+ 'GalapadTablet' => 'Android.*\bG1\b',
+ // http://www.micromaxinfo.com/tablet/funbook
+ 'MicromaxTablet' => 'Funbook|Micromax.*\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\b',
+ // http://www.karbonnmobiles.com/products_tablet.php
+ 'KarbonnTablet' => 'Android.*\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\b',
+ // http://www.myallfine.com/Products.asp
+ 'AllFineTablet' => 'Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide',
+ // http://www.proscanvideo.com/products-search.asp?itemClass=TABLET&itemnmbr=
+ 'PROSCANTablet' => '\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\b',
+ // http://www.yonesnav.com/products/products.php
+ 'YONESTablet' => 'BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026',
+ // http://www.cjshowroom.com/eproducts.aspx?classcode=004001001
+ // China manufacturer makes tablets for different small brands (eg. http://www.zeepad.net/index.html)
+ 'ChangJiaTablet' => 'TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503',
+ // http://www.gloryunion.cn/products.asp
+ // http://www.allwinnertech.com/en/apply/mobile.html
+ // http://www.ptcl.com.pk/pd_content.php?pd_id=284 (EVOTAB)
+ // @todo: Softwiner tablets?
+ // aka. Cute or Cool tablets. Not sure yet, must research to avoid collisions.
+ 'GUTablet' => 'TX-A1301|TX-M9002|Q702|kf026', // A12R|D75A|D77|D79|R83|A95|A106C|R15|A75|A76|D71|D72|R71|R73|R77|D82|R85|D92|A97|D92|R91|A10F|A77F|W71F|A78F|W78F|W81F|A97F|W91F|W97F|R16G|C72|C73E|K72|K73|R96G
+ // http://www.pointofview-online.com/showroom.php?shop_mode=product_listing&category_id=118
+ 'PointOfViewTablet' => 'TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10',
+ // http://www.overmax.pl/pl/katalog-produktow,p8/tablety,c14/
+ // @todo: add more tests.
+ 'OvermaxTablet' => 'OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)',
+ // http://hclmetablet.com/India/index.php
+ 'HCLTablet' => 'HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync',
+ // http://www.edigital.hu/Tablet_es_e-book_olvaso/Tablet-c18385.html
+ 'DPSTablet' => 'DPS Dream 9|DPS Dual 7',
+ // http://www.visture.com/index.asp
+ 'VistureTablet' => 'V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10',
+ // http://www.mijncresta.nl/tablet
+ 'CrestaTablet' => 'CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989',
+ // MediaTek - http://www.mediatek.com/_en/01_products/02_proSys.php?cata_sn=1&cata1_sn=1&cata2_sn=309
+ 'MediatekTablet' => '\bMT8125|MT8389|MT8135|MT8377\b',
+ // Concorde tab
+ 'ConcordeTablet' => 'Concorde([ ]+)?Tab|ConCorde ReadMan',
+ // GoClever Tablets - http://www.goclever.com/uk/products,c1/tablet,c5/
+ 'GoCleverTablet' => 'GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042',
+ // Modecom Tablets - http://www.modecom.eu/tablets/portal/
+ 'ModecomTablet' => 'FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003',
+ // Vonino Tablets - http://www.vonino.eu/tablets
+ 'VoninoTablet' => '\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\bQ8\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\b',
+ // ECS Tablets - http://www.ecs.com.tw/ECSWebSite/Product/Product_Tablet_List.aspx?CategoryID=14&MenuID=107&childid=M_107&LanID=0
+ 'ECSTablet' => 'V07OT2|TM105A|S10OT1|TR10CS1',
+ // Storex Tablets - http://storex.fr/espace_client/support.html
+ // @note: no need to add all the tablet codes since they are guided by the first regex.
+ 'StorexTablet' => 'eZee[_\']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab',
+ // Generic Vodafone tablets.
+ 'VodafoneTablet' => 'SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7',
+ // French tablets - Essentiel B http://www.boulanger.fr/tablette_tactile_e-book/tablette_tactile_essentiel_b/cl_68908.htm?multiChoiceToDelete=brand&mc_brand=essentielb
+ // Aka: http://www.essentielb.fr/
+ 'EssentielBTablet' => 'Smart[ \']?TAB[ ]+?[0-9]+|Family[ \']?TAB2',
+ // Ross & Moor - http://ross-moor.ru/
+ 'RossMoorTablet' => 'RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711',
+ // i-mobile http://product.i-mobilephone.com/Mobile_Device
+ 'iMobileTablet' => 'i-mobile i-note',
+ // http://www.tolino.de/de/vergleichen/
+ 'TolinoTablet' => 'tolino tab [0-9.]+|tolino shine',
+ // AudioSonic - a Kmart brand
+ // http://www.kmart.com.au/webapp/wcs/stores/servlet/Search?langId=-1&storeId=10701&catalogId=10001&categoryId=193001&pageSize=72¤tPage=1&searchCategory=193001%2b4294965664&sortBy=p_MaxPrice%7c1
+ 'AudioSonicTablet' => '\bC-22Q|T7-QC|T-17B|T-17P\b',
+ // AMPE Tablets - http://www.ampe.com.my/product-category/tablets/
+ // @todo: add them gradually to avoid conflicts.
+ 'AMPETablet' => 'Android.* A78 ',
+ // Skk Mobile - http://skkmobile.com.ph/product_tablets.php
+ 'SkkTablet' => 'Android.* (SKYPAD|PHOENIX|CYCLOPS)',
+ // Tecno Mobile (only tablet) - http://www.tecno-mobile.com/index.php/product?filterby=smart&list_order=all&page=1
+ 'TecnoTablet' => 'TECNO P9',
+ // JXD (consoles & tablets) - http://jxd.hk/products.asp?selectclassid=009008&clsid=3
+ 'JXDTablet' => 'Android.*\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\b',
+ // i-Joy tablets - http://www.i-joy.es/en/cat/products/tablets/
+ 'iJoyTablet' => 'Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)',
+ // http://www.intracon.eu/tablet
+ 'FX2Tablet' => 'FX2 PAD7|FX2 PAD10',
+ // http://www.xoro.de/produkte/
+ // @note: Might be the same brand with 'Simply tablets'
+ 'XoroTablet' => 'KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151',
+ // http://www1.viewsonic.com/products/computing/tablets/
+ 'ViewsonicTablet' => 'ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a',
+ // http://www.odys.de/web/internet-tablet_en.html
+ 'OdysTablet' => 'LOOX|XENO10|ODYS[ -](Space|EVO|Xpress|NOON)|\bXELIO\b|Xelio10Pro|XELIO7PHONETAB|XELIO10EXTREME|XELIOPT2|NEO_QUAD10',
+ // http://www.captiva-power.de/products.html#tablets-en
+ 'CaptivaTablet' => 'CAPTIVA PAD',
+ // IconBIT - http://www.iconbit.com/products/tablets/
+ 'IconbitTablet' => 'NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S',
+ // http://www.teclast.com/topic.php?channelID=70&topicID=140&pid=63
+ 'TeclastTablet' => 'T98 4G|\bP80\b|\bX90HD\b|X98 Air|X98 Air 3G|\bX89\b|P80 3G|\bX80h\b|P98 Air|\bX89HD\b|P98 3G|\bP90HD\b|P89 3G|X98 3G|\bP70h\b|P79HD 3G|G18d 3G|\bP79HD\b|\bP89s\b|\bA88\b|\bP10HD\b|\bP19HD\b|G18 3G|\bP78HD\b|\bA78\b|\bP75\b|G17s 3G|G17h 3G|\bP85t\b|\bP90\b|\bP11\b|\bP98t\b|\bP98HD\b|\bG18d\b|\bP85s\b|\bP11HD\b|\bP88s\b|\bA80HD\b|\bA80se\b|\bA10h\b|\bP89\b|\bP78s\b|\bG18\b|\bP85\b|\bA70h\b|\bA70\b|\bG17\b|\bP18\b|\bA80s\b|\bA11s\b|\bP88HD\b|\bA80h\b|\bP76s\b|\bP76h\b|\bP98\b|\bA10HD\b|\bP78\b|\bP88\b|\bA11\b|\bA10t\b|\bP76a\b|\bP76t\b|\bP76e\b|\bP85HD\b|\bP85a\b|\bP86\b|\bP75HD\b|\bP76v\b|\bA12\b|\bP75a\b|\bA15\b|\bP76Ti\b|\bP81HD\b|\bA10\b|\bT760VE\b|\bT720HD\b|\bP76\b|\bP73\b|\bP71\b|\bP72\b|\bT720SE\b|\bC520Ti\b|\bT760\b|\bT720VE\b|T720-3GE|T720-WiFi',
+ // Onda - http://www.onda-tablet.com/buy-android-onda.html?dir=desc&limit=all&order=price
+ 'OndaTablet' => '\b(V975i|Vi30|VX530|V701|Vi60|V701s|Vi50|V801s|V719|Vx610w|VX610W|V819i|Vi10|VX580W|Vi10|V711s|V813|V811|V820w|V820|Vi20|V711|VI30W|V712|V891w|V972|V819w|V820w|Vi60|V820w|V711|V813s|V801|V819|V975s|V801|V819|V819|V818|V811|V712|V975m|V101w|V961w|V812|V818|V971|V971s|V919|V989|V116w|V102w|V973|Vi40)\b[\s]+',
+ 'JaytechTablet' => 'TPC-PA762',
+ 'BlaupunktTablet' => 'Endeavour 800NG|Endeavour 1010',
+ // http://www.digma.ru/support/download/
+ // @todo: Ebooks also (if requested)
+ 'DigmaTablet' => '\b(iDx10|iDx9|iDx8|iDx7|iDxD7|iDxD8|iDsQ8|iDsQ7|iDsQ8|iDsD10|iDnD7|3TS804H|iDsQ11|iDj7|iDs10)\b',
+ // http://www.evolioshop.com/ro/tablete-pc.html
+ // http://www.evolio.ro/support/downloads_static.html?cat=2
+ // @todo: Research some more
+ 'EvolioTablet' => 'ARIA_Mini_wifi|Aria[ _]Mini|Evolio X10|Evolio X7|Evolio X8|\bEvotab\b|\bNeura\b',
+ // @todo http://www.lavamobiles.com/tablets-data-cards
+ 'LavaTablet' => 'QPAD E704|\bIvoryS\b|E-TAB IVORY|\bE-TAB\b',
+ // https://www.celkonmobiles.com/?_a=categoryphones&sid=2
+ 'CelkonTablet' => 'CT695|CT888|CT[\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\bCT-1\b',
+ // http://www.wolderelectronics.com/productos/manuales-y-guias-rapidas/categoria-2-miTab
+ 'WolderTablet' => 'miTab \b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\b',
+ // http://www.mi.com/en
+ 'MiTablet' => '\bMI PAD\b|\bHM NOTE 1W\b',
+ // http://www.nbru.cn/index.html
+ 'NibiruTablet' => 'Nibiru M1|Nibiru Jupiter One',
+ // http://navroad.com/products/produkty/tablety/
+ 'NexoTablet' => 'NEXO NOVA|NEXO 10|NEXO AVIO|NEXO FREE|NEXO GO|NEXO EVO|NEXO 3G|NEXO SMART|NEXO KIDDO|NEXO MOBI',
+ // http://leader-online.com/new_site/product-category/tablets/
+ // http://www.leader-online.net.au/List/Tablet
+ 'LeaderTablet' => 'TBLT10Q|TBLT10I|TBL-10WDKB|TBL-10WDKBO2013|TBL-W230V2|TBL-W450|TBL-W500|SV572|TBLT7I|TBA-AC7-8G|TBLT79|TBL-8W16|TBL-10W32|TBL-10WKB|TBL-W100',
+ // http://www.datawind.com/ubislate/
+ 'UbislateTablet' => 'UbiSlate[\s]?7C',
+ // http://www.pocketbook-int.com/ru/support
+ 'PocketBookTablet' => 'Pocketbook',
+ // http://www.tesco.com/direct/hudl/
+ 'Hudl' => 'Hudl HT7S3',
+ // http://www.telstra.com.au/home-phone/thub-2/
+ 'TelstraTablet' => 'T-Hub2',
+ 'GenericTablet' => 'Android.*\b97D\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b|rk30sdk|\bEVOTAB\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\bM6pro\b|CT1020W|arc 10HD|\bJolla\b|\bTP750\b'
+ );
+
+ /**
+ * List of mobile Operating Systems.
+ *
+ * @var array
+ */
+ protected static $operatingSystems = array(
+ 'AndroidOS' => 'Android',
+ 'BlackBerryOS' => 'blackberry|\bBB10\b|rim tablet os',
+ 'PalmOS' => 'PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino',
+ 'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b',
+ // @reference: http://en.wikipedia.org/wiki/Windows_Mobile
+ 'WindowsMobileOS' => 'Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;',
+ // @reference: http://en.wikipedia.org/wiki/Windows_Phone
+ // http://wifeng.cn/?r=blog&a=view&id=106
+ // http://nicksnettravels.builttoroam.com/post/2011/01/10/Bogus-Windows-Phone-7-User-Agent-String.aspx
+ // http://msdn.microsoft.com/library/ms537503.aspx
+ 'WindowsPhoneOS' => 'Windows Phone 8.1|Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7|Windows NT 6.[23]; ARM;',
+ 'iOS' => '\biPhone.*Mobile|\biPod|\biPad',
+ // http://en.wikipedia.org/wiki/MeeGo
+ // @todo: research MeeGo in UAs
+ 'MeeGoOS' => 'MeeGo',
+ // http://en.wikipedia.org/wiki/Maemo
+ // @todo: research Maemo in UAs
+ 'MaemoOS' => 'Maemo',
+ 'JavaOS' => 'J2ME/|\bMIDP\b|\bCLDC\b', // '|Java/' produces bug #135
+ 'webOS' => 'webOS|hpwOS',
+ 'badaOS' => '\bBada\b',
+ 'BREWOS' => 'BREW',
+ );
+
+ /**
+ * List of mobile User Agents.
+ *
+ * @var array
+ */
+ protected static $browsers = array(
+ // @reference: https://developers.google.com/chrome/mobile/docs/user-agent
+ 'Chrome' => '\bCrMo\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?',
+ 'Dolfin' => '\bDolfin\b',
+ 'Opera' => 'Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR/[0-9.]+|Coast/[0-9.]+',
+ 'Skyfire' => 'Skyfire',
+ 'IE' => 'IEMobile|MSIEMobile', // |Trident/[.0-9]+
+ 'Firefox' => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile',
+ 'Bolt' => 'bolt',
+ 'TeaShark' => 'teashark',
+ 'Blazer' => 'Blazer',
+ // @reference: http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html#//apple_ref/doc/uid/TP40006517-SW3
+ 'Safari' => 'Version.*Mobile.*Safari|Safari.*Mobile|MobileSafari',
+ // http://en.wikipedia.org/wiki/Midori_(web_browser)
+ //'Midori' => 'midori',
+ 'Tizen' => 'Tizen',
+ 'UCBrowser' => 'UC.*Browser|UCWEB',
+ 'baiduboxapp' => 'baiduboxapp',
+ 'baidubrowser' => 'baidubrowser',
+ // https://github.com/serbanghita/Mobile-Detect/issues/7
+ 'DiigoBrowser' => 'DiigoBrowser',
+ // http://www.puffinbrowser.com/index.php
+ 'Puffin' => 'Puffin',
+ // http://mercury-browser.com/index.html
+ 'Mercury' => '\bMercury\b',
+ // http://en.wikipedia.org/wiki/Obigo_Browser
+ 'ObigoBrowser' => 'Obigo',
+ // http://en.wikipedia.org/wiki/NetFront
+ 'NetFront' => 'NF-Browser',
+ // @reference: http://en.wikipedia.org/wiki/Minimo
+ // http://en.wikipedia.org/wiki/Vision_Mobile_Browser
+ 'GenericBrowser' => 'NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger',
+ );
+
+ /**
+ * Utilities.
+ *
+ * @var array
+ */
+ protected static $utilities = array(
+ // Experimental. When a mobile device wants to switch to 'Desktop Mode'.
+ // http://scottcate.com/technology/windows-phone-8-ie10-desktop-or-mobile/
+ // https://github.com/serbanghita/Mobile-Detect/issues/57#issuecomment-15024011
+ // https://developers.facebook.com/docs/sharing/best-practices
+ 'Bot' => 'Googlebot|facebookexternalhit|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom',
+ 'MobileBot' => 'Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker/M1A1-R2D2',
+ 'DesktopMode' => 'WPDesktop',
+ 'TV' => 'SonyDTV|HbbTV', // experimental
+ 'WebKit' => '(webkit)[ /]([\w.]+)',
+ // @todo: Include JXD consoles.
+ 'Console' => '\b(Nintendo|Nintendo WiiU|Nintendo 3DS|PLAYSTATION|Xbox)\b',
+ 'Watch' => 'SM-V700',
+ );
+
+ /**
+ * All possible HTTP headers that represent the
+ * User-Agent string.
+ *
+ * @var array
+ */
+ protected static $uaHttpHeaders = array(
+ // The default User-Agent string.
+ 'HTTP_USER_AGENT',
+ // Header can occur on devices using Opera Mini.
+ 'HTTP_X_OPERAMINI_PHONE_UA',
+ // Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/
+ 'HTTP_X_DEVICE_USER_AGENT',
+ 'HTTP_X_ORIGINAL_USER_AGENT',
+ 'HTTP_X_SKYFIRE_PHONE',
+ 'HTTP_X_BOLT_PHONE_UA',
+ 'HTTP_DEVICE_STOCK_UA',
+ 'HTTP_X_UCBROWSER_DEVICE_UA'
+ );
+
+ /**
+ * The individual segments that could exist in a User-Agent string. VER refers to the regular
+ * expression defined in the constant self::VER.
+ *
+ * @var array
+ */
+ protected static $properties = array(
+
+ // Build
+ 'Mobile' => 'Mobile/[VER]',
+ 'Build' => 'Build/[VER]',
+ 'Version' => 'Version/[VER]',
+ 'VendorID' => 'VendorID/[VER]',
+
+ // Devices
+ 'iPad' => 'iPad.*CPU[a-z ]+[VER]',
+ 'iPhone' => 'iPhone.*CPU[a-z ]+[VER]',
+ 'iPod' => 'iPod.*CPU[a-z ]+[VER]',
+ //'BlackBerry' => array('BlackBerry[VER]', 'BlackBerry [VER];'),
+ 'Kindle' => 'Kindle/[VER]',
+
+ // Browser
+ 'Chrome' => array('Chrome/[VER]', 'CriOS/[VER]', 'CrMo/[VER]'),
+ 'Coast' => array('Coast/[VER]'),
+ 'Dolfin' => 'Dolfin/[VER]',
+ // @reference: https://developer.mozilla.org/en-US/docs/User_Agent_Strings_Reference
+ 'Firefox' => 'Firefox/[VER]',
+ 'Fennec' => 'Fennec/[VER]',
+ // http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx
+ // https://msdn.microsoft.com/en-us/library/ie/hh869301(v=vs.85).aspx
+ 'IE' => array('IEMobile/[VER];', 'IEMobile [VER]', 'MSIE [VER];', 'Trident/[0-9.]+;.*rv:[VER]'),
+ // http://en.wikipedia.org/wiki/NetFront
+ 'NetFront' => 'NetFront/[VER]',
+ 'NokiaBrowser' => 'NokiaBrowser/[VER]',
+ 'Opera' => array( ' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]' ),
+ 'Opera Mini' => 'Opera Mini/[VER]',
+ 'Opera Mobi' => 'Version/[VER]',
+ 'UC Browser' => 'UC Browser[VER]',
+ 'MQQBrowser' => 'MQQBrowser/[VER]',
+ 'MicroMessenger' => 'MicroMessenger/[VER]',
+ 'baiduboxapp' => 'baiduboxapp/[VER]',
+ 'baidubrowser' => 'baidubrowser/[VER]',
+ 'Iron' => 'Iron/[VER]',
+ // @note: Safari 7534.48.3 is actually Version 5.1.
+ // @note: On BlackBerry the Version is overwriten by the OS.
+ 'Safari' => array( 'Version/[VER]', 'Safari/[VER]' ),
+ 'Skyfire' => 'Skyfire/[VER]',
+ 'Tizen' => 'Tizen/[VER]',
+ 'Webkit' => 'webkit[ /][VER]',
+
+ // Engine
+ 'Gecko' => 'Gecko/[VER]',
+ 'Trident' => 'Trident/[VER]',
+ 'Presto' => 'Presto/[VER]',
+
+ // OS
+ 'iOS' => ' \bi?OS\b [VER][ ;]{1}',
+ 'Android' => 'Android [VER]',
+ 'BlackBerry' => array('BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'),
+ 'BREW' => 'BREW [VER]',
+ 'Java' => 'Java/[VER]',
+ // @reference: http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/08/29/introducing-the-ie9-on-windows-phone-mango-user-agent-string.aspx
+ // @reference: http://en.wikipedia.org/wiki/Windows_NT#Releases
+ 'Windows Phone OS' => array( 'Windows Phone OS [VER]', 'Windows Phone [VER]'),
+ 'Windows Phone' => 'Windows Phone [VER]',
+ 'Windows CE' => 'Windows CE/[VER]',
+ // http://social.msdn.microsoft.com/Forums/en-US/windowsdeveloperpreviewgeneral/thread/6be392da-4d2f-41b4-8354-8dcee20c85cd
+ 'Windows NT' => 'Windows NT [VER]',
+ 'Symbian' => array('SymbianOS/[VER]', 'Symbian/[VER]'),
+ 'webOS' => array('webOS/[VER]', 'hpwOS/[VER];'),
+ );
+
+ /**
+ * Construct an instance of this class.
+ *
+ * @param array $headers Specify the headers as injection. Should be PHP _SERVER flavored.
+ * If left empty, will use the global _SERVER['HTTP_*'] vars instead.
+ * @param string $userAgent Inject the User-Agent header. If null, will use HTTP_USER_AGENT
+ * from the $headers array instead.
+ */
+ public function __construct(
+ array $headers = null,
+ $userAgent = null
+ ) {
+ $this->setHttpHeaders($headers);
+ $this->setUserAgent($userAgent);
+ }
+
+ /**
+ * Get the current script version.
+ * This is useful for the demo.php file,
+ * so people can check on what version they are testing
+ * for mobile devices.
+ *
+ * @return string The version number in semantic version format.
+ */
+ public static function getScriptVersion()
+ {
+ return self::VERSION;
+ }
+
+ /**
+ * Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers.
+ *
+ * @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract
+ * the headers. The default null is left for backwards compatibilty.
+ */
+ public function setHttpHeaders($httpHeaders = null)
+ {
+ // use global _SERVER if $httpHeaders aren't defined
+ if (!is_array($httpHeaders) || !count($httpHeaders)) {
+ $httpHeaders = $_SERVER;
+ }
+
+ // clear existing headers
+ $this->httpHeaders = array();
+
+ // Only save HTTP headers. In PHP land, that means only _SERVER vars that
+ // start with HTTP_.
+ foreach ($httpHeaders as $key => $value) {
+ if (substr($key, 0, 5) === 'HTTP_') {
+ $this->httpHeaders[$key] = $value;
+ }
+ }
+
+ // In case we're dealing with CloudFront, we need to know.
+ $this->setCfHeaders($httpHeaders);
+ }
+
+ /**
+ * Retrieves the HTTP headers.
+ *
+ * @return array
+ */
+ public function getHttpHeaders()
+ {
+ return $this->httpHeaders;
+ }
+
+ /**
+ * Retrieves a particular header. If it doesn't exist, no exception/error is caused.
+ * Simply null is returned.
+ *
+ * @param string $header The name of the header to retrieve. Can be HTTP compliant such as
+ * "User-Agent" or "X-Device-User-Agent" or can be php-esque with the
+ * all-caps, HTTP_ prefixed, underscore seperated awesomeness.
+ *
+ * @return string|null The value of the header.
+ */
+ public function getHttpHeader($header)
+ {
+ // are we using PHP-flavored headers?
+ if (strpos($header, '_') === false) {
+ $header = str_replace('-', '_', $header);
+ $header = strtoupper($header);
+ }
+
+ // test the alternate, too
+ $altHeader = 'HTTP_' . $header;
+
+ //Test both the regular and the HTTP_ prefix
+ if (isset($this->httpHeaders[$header])) {
+ return $this->httpHeaders[$header];
+ } elseif (isset($this->httpHeaders[$altHeader])) {
+ return $this->httpHeaders[$altHeader];
+ }
+
+ return null;
+ }
+
+ public function getMobileHeaders()
+ {
+ return self::$mobileHeaders;
+ }
+
+ /**
+ * Get all possible HTTP headers that
+ * can contain the User-Agent string.
+ *
+ * @return array List of HTTP headers.
+ */
+ public function getUaHttpHeaders()
+ {
+ return self::$uaHttpHeaders;
+ }
+
+
+ /**
+ * Set CloudFront headers
+ * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html#header-caching-web-device
+ *
+ * @param array $cfHeaders List of HTTP headers
+ *
+ * @return boolean If there were CloudFront headers to be set
+ */
+ public function setCfHeaders($cfHeaders = null) {
+ // use global _SERVER if $cfHeaders aren't defined
+ if (!is_array($cfHeaders) || !count($cfHeaders)) {
+ $cfHeaders = $_SERVER;
+ }
+
+ // clear existing headers
+ $this->cloudfrontHeaders = array();
+
+ // Only save CLOUDFRONT headers. In PHP land, that means only _SERVER vars that
+ // start with cloudfront-.
+ $response = false;
+ foreach ($cfHeaders as $key => $value) {
+ if (substr(strtolower($key), 0, 16) === 'http_cloudfront_') {
+ $this->cloudfrontHeaders[strtoupper($key)] = $value;
+ $response = true;
+ }
+ }
+
+ return $response;
+ }
+
+ /**
+ * Retrieves the cloudfront headers.
+ *
+ * @return array
+ */
+ public function getCfHeaders()
+ {
+ return $this->cloudfrontHeaders;
+ }
+
+ /**
+ * Set the User-Agent to be used.
+ *
+ * @param string $userAgent The user agent string to set.
+ *
+ * @return string|null
+ */
+ public function setUserAgent($userAgent = null)
+ {
+ // Invalidate cache due to #375
+ $this->cache = array();
+
+ if (false === empty($userAgent)) {
+ return $this->userAgent = $userAgent;
+ } else {
+ $this->userAgent = null;
+ foreach ($this->getUaHttpHeaders() as $altHeader) {
+ if (false === empty($this->httpHeaders[$altHeader])) { // @todo: should use getHttpHeader(), but it would be slow. (Serban)
+ $this->userAgent .= $this->httpHeaders[$altHeader] . " ";
+ }
+ }
+
+ if (!empty($this->userAgent)) {
+ return $this->userAgent = trim($this->userAgent);
+ }
+ }
+
+ if (count($this->getCfHeaders()) > 0) {
+ return $this->userAgent = 'Amazon CloudFront';
+ }
+ return $this->userAgent = null;
+ }
+
+ /**
+ * Retrieve the User-Agent.
+ *
+ * @return string|null The user agent if it's set.
+ */
+ public function getUserAgent()
+ {
+ return $this->userAgent;
+ }
+
+ /**
+ * Set the detection type. Must be one of self::DETECTION_TYPE_MOBILE or
+ * self::DETECTION_TYPE_EXTENDED. Otherwise, nothing is set.
+ *
+ * @deprecated since version 2.6.9
+ *
+ * @param string $type The type. Must be a self::DETECTION_TYPE_* constant. The default
+ * parameter is null which will default to self::DETECTION_TYPE_MOBILE.
+ */
+ public function setDetectionType($type = null)
+ {
+ if ($type === null) {
+ $type = self::DETECTION_TYPE_MOBILE;
+ }
+
+ if ($type !== self::DETECTION_TYPE_MOBILE && $type !== self::DETECTION_TYPE_EXTENDED) {
+ return;
+ }
+
+ $this->detectionType = $type;
+ }
+
+ public function getMatchingRegex()
+ {
+ return $this->matchingRegex;
+ }
+
+ public function getMatchesArray()
+ {
+ return $this->matchesArray;
+ }
+
+ /**
+ * Retrieve the list of known phone devices.
+ *
+ * @return array List of phone devices.
+ */
+ public static function getPhoneDevices()
+ {
+ return self::$phoneDevices;
+ }
+
+ /**
+ * Retrieve the list of known tablet devices.
+ *
+ * @return array List of tablet devices.
+ */
+ public static function getTabletDevices()
+ {
+ return self::$tabletDevices;
+ }
+
+ /**
+ * Alias for getBrowsers() method.
+ *
+ * @return array List of user agents.
+ */
+ public static function getUserAgents()
+ {
+ return self::getBrowsers();
+ }
+
+ /**
+ * Retrieve the list of known browsers. Specifically, the user agents.
+ *
+ * @return array List of browsers / user agents.
+ */
+ public static function getBrowsers()
+ {
+ return self::$browsers;
+ }
+
+ /**
+ * Retrieve the list of known utilities.
+ *
+ * @return array List of utilities.
+ */
+ public static function getUtilities()
+ {
+ return self::$utilities;
+ }
+
+ /**
+ * Method gets the mobile detection rules. This method is used for the magic methods $detect->is*().
+ *
+ * @deprecated since version 2.6.9
+ *
+ * @return array All the rules (but not extended).
+ */
+ public static function getMobileDetectionRules()
+ {
+ static $rules;
+
+ if (!$rules) {
+ $rules = array_merge(
+ self::$phoneDevices,
+ self::$tabletDevices,
+ self::$operatingSystems,
+ self::$browsers
+ );
+ }
+
+ return $rules;
+
+ }
+
+ /**
+ * Method gets the mobile detection rules + utilities.
+ * The reason this is separate is because utilities rules
+ * don't necessary imply mobile. This method is used inside
+ * the new $detect->is('stuff') method.
+ *
+ * @deprecated since version 2.6.9
+ *
+ * @return array All the rules + extended.
+ */
+ public function getMobileDetectionRulesExtended()
+ {
+ static $rules;
+
+ if (!$rules) {
+ // Merge all rules together.
+ $rules = array_merge(
+ self::$phoneDevices,
+ self::$tabletDevices,
+ self::$operatingSystems,
+ self::$browsers,
+ self::$utilities
+ );
+ }
+
+ return $rules;
+ }
+
+ /**
+ * Retrieve the current set of rules.
+ *
+ * @deprecated since version 2.6.9
+ *
+ * @return array
+ */
+ public function getRules()
+ {
+ if ($this->detectionType == self::DETECTION_TYPE_EXTENDED) {
+ return self::getMobileDetectionRulesExtended();
+ } else {
+ return self::getMobileDetectionRules();
+ }
+ }
+
+ /**
+ * Retrieve the list of mobile operating systems.
+ *
+ * @return array The list of mobile operating systems.
+ */
+ public static function getOperatingSystems()
+ {
+ return self::$operatingSystems;
+ }
+
+ /**
+ * Check the HTTP headers for signs of mobile.
+ * This is the fastest mobile check possible; it's used
+ * inside isMobile() method.
+ *
+ * @return bool
+ */
+ public function checkHttpHeadersForMobile()
+ {
+
+ foreach ($this->getMobileHeaders() as $mobileHeader => $matchType) {
+ if (isset($this->httpHeaders[$mobileHeader])) {
+ if (is_array($matchType['matches'])) {
+ foreach ($matchType['matches'] as $_match) {
+ if (strpos($this->httpHeaders[$mobileHeader], $_match) !== false) {
+ return true;
+ }
+ }
+
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ return false;
+
+ }
+
+ /**
+ * Magic overloading method.
+ *
+ * @method boolean is[...]()
+ * @param string $name
+ * @param array $arguments
+ * @return mixed
+ * @throws BadMethodCallException when the method doesn't exist and doesn't start with 'is'
+ */
+ public function __call($name, $arguments)
+ {
+ // make sure the name starts with 'is', otherwise
+ if (substr($name, 0, 2) !== 'is') {
+ throw new BadMethodCallException("No such method exists: $name");
+ }
+
+ $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
+
+ $key = substr($name, 2);
+
+ return $this->matchUAAgainstKey($key);
+ }
+
+ /**
+ * Find a detection rule that matches the current User-agent.
+ *
+ * @param null $userAgent deprecated
+ * @return boolean
+ */
+ protected function matchDetectionRulesAgainstUA($userAgent = null)
+ {
+ // Begin general search.
+ foreach ($this->getRules() as $_regex) {
+ if (empty($_regex)) {
+ continue;
+ }
+
+ if ($this->match($_regex, $userAgent)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Search for a certain key in the rules array.
+ * If the key is found the try to match the corresponding
+ * regex against the User-Agent.
+ *
+ * @param string $key
+ *
+ * @return boolean
+ */
+ protected function matchUAAgainstKey($key)
+ {
+ // Make the keys lowercase so we can match: isIphone(), isiPhone(), isiphone(), etc.
+ $key = strtolower($key);
+ if (false === isset($this->cache[$key])) {
+
+ // change the keys to lower case
+ $_rules = array_change_key_case($this->getRules());
+
+ if (false === empty($_rules[$key])) {
+ $this->cache[$key] = $this->match($_rules[$key]);
+ }
+
+ if (false === isset($this->cache[$key])) {
+ $this->cache[$key] = false;
+ }
+ }
+
+ return $this->cache[$key];
+ }
+
+ /**
+ * Check if the device is mobile.
+ * Returns true if any type of mobile device detected, including special ones
+ * @param null $userAgent deprecated
+ * @param null $httpHeaders deprecated
+ * @return bool
+ */
+ public function isMobile($userAgent = null, $httpHeaders = null)
+ {
+
+ if ($httpHeaders) {
+ $this->setHttpHeaders($httpHeaders);
+ }
+
+ if ($userAgent) {
+ $this->setUserAgent($userAgent);
+ }
+
+ // Check specifically for cloudfront headers if the useragent === 'Amazon CloudFront'
+ if ($this->getUserAgent() === 'Amazon CloudFront') {
+ $cfHeaders = $this->getCfHeaders();
+ if(array_key_exists('HTTP_CLOUDFRONT_IS_MOBILE_VIEWER', $cfHeaders) && $cfHeaders['HTTP_CLOUDFRONT_IS_MOBILE_VIEWER'] === 'true') {
+ return true;
+ }
+ }
+
+ $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
+
+ if ($this->checkHttpHeadersForMobile()) {
+ return true;
+ } else {
+ return $this->matchDetectionRulesAgainstUA();
+ }
+
+ }
+
+ /**
+ * Check if the device is a tablet.
+ * Return true if any type of tablet device is detected.
+ *
+ * @param string $userAgent deprecated
+ * @param array $httpHeaders deprecated
+ * @return bool
+ */
+ public function isTablet($userAgent = null, $httpHeaders = null)
+ {
+ // Check specifically for cloudfront headers if the useragent === 'Amazon CloudFront'
+ if ($this->getUserAgent() === 'Amazon CloudFront') {
+ $cfHeaders = $this->getCfHeaders();
+ if(array_key_exists('HTTP_CLOUDFRONT_IS_TABLET_VIEWER', $cfHeaders) && $cfHeaders['HTTP_CLOUDFRONT_IS_TABLET_VIEWER'] === 'true') {
+ return true;
+ }
+ }
+
+ $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
+
+ foreach (self::$tabletDevices as $_regex) {
+ if ($this->match($_regex, $userAgent)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * This method checks for a certain property in the
+ * userAgent.
+ * @todo: The httpHeaders part is not yet used.
+ *
+ * @param string $key
+ * @param string $userAgent deprecated
+ * @param string $httpHeaders deprecated
+ * @return bool|int|null
+ */
+ public function is($key, $userAgent = null, $httpHeaders = null)
+ {
+ // Set the UA and HTTP headers only if needed (eg. batch mode).
+ if ($httpHeaders) {
+ $this->setHttpHeaders($httpHeaders);
+ }
+
+ if ($userAgent) {
+ $this->setUserAgent($userAgent);
+ }
+
+ $this->setDetectionType(self::DETECTION_TYPE_EXTENDED);
+
+ return $this->matchUAAgainstKey($key);
+ }
+
+ /**
+ * Some detection rules are relative (not standard),
+ * because of the diversity of devices, vendors and
+ * their conventions in representing the User-Agent or
+ * the HTTP headers.
+ *
+ * This method will be used to check custom regexes against
+ * the User-Agent string.
+ *
+ * @param $regex
+ * @param string $userAgent
+ * @return bool
+ *
+ * @todo: search in the HTTP headers too.
+ */
+ public function match($regex, $userAgent = null)
+ {
+ $match = (bool) preg_match(sprintf('#%s#is', $regex), (false === empty($userAgent) ? $userAgent : $this->userAgent), $matches);
+ // If positive match is found, store the results for debug.
+ if ($match) {
+ $this->matchingRegex = $regex;
+ $this->matchesArray = $matches;
+ }
+
+ return $match;
+ }
+
+ /**
+ * Get the properties array.
+ *
+ * @return array
+ */
+ public static function getProperties()
+ {
+ return self::$properties;
+ }
+
+ /**
+ * Prepare the version number.
+ *
+ * @todo Remove the error supression from str_replace() call.
+ *
+ * @param string $ver The string version, like "2.6.21.2152";
+ *
+ * @return float
+ */
+ public function prepareVersionNo($ver)
+ {
+ $ver = str_replace(array('_', ' ', '/'), '.', $ver);
+ $arrVer = explode('.', $ver, 2);
+
+ if (isset($arrVer[1])) {
+ $arrVer[1] = @str_replace('.', '', $arrVer[1]); // @todo: treat strings versions.
+ }
+
+ return (float) implode('.', $arrVer);
+ }
+
+ /**
+ * Check the version of the given property in the User-Agent.
+ * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31)
+ *
+ * @param string $propertyName The name of the property. See self::getProperties() array
+ * keys for all possible properties.
+ * @param string $type Either self::VERSION_TYPE_STRING to get a string value or
+ * self::VERSION_TYPE_FLOAT indicating a float value. This parameter
+ * is optional and defaults to self::VERSION_TYPE_STRING. Passing an
+ * invalid parameter will default to the this type as well.
+ *
+ * @return string|float The version of the property we are trying to extract.
+ */
+ public function version($propertyName, $type = self::VERSION_TYPE_STRING)
+ {
+ if (empty($propertyName)) {
+ return false;
+ }
+
+ // set the $type to the default if we don't recognize the type
+ if ($type !== self::VERSION_TYPE_STRING && $type !== self::VERSION_TYPE_FLOAT) {
+ $type = self::VERSION_TYPE_STRING;
+ }
+
+ $properties = self::getProperties();
+
+ // Check if the property exists in the properties array.
+ if (true === isset($properties[$propertyName])) {
+
+ // Prepare the pattern to be matched.
+ // Make sure we always deal with an array (string is converted).
+ $properties[$propertyName] = (array) $properties[$propertyName];
+
+ foreach ($properties[$propertyName] as $propertyMatchString) {
+
+ $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString);
+
+ // Identify and extract the version.
+ preg_match(sprintf('#%s#is', $propertyPattern), $this->userAgent, $match);
+
+ if (false === empty($match[1])) {
+ $version = ($type == self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1]);
+
+ return $version;
+ }
+
+ }
+
+ }
+
+ return false;
+ }
+
+ /**
+ * Retrieve the mobile grading, using self::MOBILE_GRADE_* constants.
+ *
+ * @return string One of the self::MOBILE_GRADE_* constants.
+ */
+ public function mobileGrade()
+ {
+ $isMobile = $this->isMobile();
+
+ if (
+ // Apple iOS 4-7.0 – Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3 / 5.1 / 6.1), iPad 3 (5.1 / 6.0), iPad Mini (6.1), iPad Retina (7.0), iPhone 3GS (4.3), iPhone 4 (4.3 / 5.1), iPhone 4S (5.1 / 6.0), iPhone 5 (6.0), and iPhone 5S (7.0)
+ $this->is('iOS') && $this->version('iPad', self::VERSION_TYPE_FLOAT) >= 4.3 ||
+ $this->is('iOS') && $this->version('iPhone', self::VERSION_TYPE_FLOAT) >= 4.3 ||
+ $this->is('iOS') && $this->version('iPod', self::VERSION_TYPE_FLOAT) >= 4.3 ||
+
+ // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5)
+ // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM
+ // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices
+ // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7
+ ( $this->version('Android', self::VERSION_TYPE_FLOAT)>2.1 && $this->is('Webkit') ) ||
+
+ // Windows Phone 7.5-8 - Tested on the HTC Surround (7.5), HTC Trophy (7.5), LG-E900 (7.5), Nokia 800 (7.8), HTC Mazaa (7.8), Nokia Lumia 520 (8), Nokia Lumia 920 (8), HTC 8x (8)
+ $this->version('Windows Phone OS', self::VERSION_TYPE_FLOAT) >= 7.5 ||
+
+ // Tested on the Torch 9800 (6) and Style 9670 (6), BlackBerry® Torch 9810 (7), BlackBerry Z10 (10)
+ $this->is('BlackBerry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) >= 6.0 ||
+ // Blackberry Playbook (1.0-2.0) - Tested on PlayBook
+ $this->match('Playbook.*Tablet') ||
+
+ // Palm WebOS (1.4-3.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0), HP TouchPad (3.0)
+ ( $this->version('webOS', self::VERSION_TYPE_FLOAT) >= 1.4 && $this->match('Palm|Pre|Pixi') ) ||
+ // Palm WebOS 3.0 - Tested on HP TouchPad
+ $this->match('hp.*TouchPad') ||
+
+ // Firefox Mobile 18 - Tested on Android 2.3 and 4.1 devices
+ ( $this->is('Firefox') && $this->version('Firefox', self::VERSION_TYPE_FLOAT) >= 18 ) ||
+
+ // Chrome for Android - Tested on Android 4.0, 4.1 device
+ ( $this->is('Chrome') && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT) >= 4.0 ) ||
+
+ // Skyfire 4.1 - Tested on Android 2.3 device
+ ( $this->is('Skyfire') && $this->version('Skyfire', self::VERSION_TYPE_FLOAT) >= 4.1 && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT) >= 2.3 ) ||
+
+ // Opera Mobile 11.5-12: Tested on Android 2.3
+ ( $this->is('Opera') && $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT) >= 11.5 && $this->is('AndroidOS') ) ||
+
+ // Meego 1.2 - Tested on Nokia 950 and N9
+ $this->is('MeeGoOS') ||
+
+ // Tizen (pre-release) - Tested on early hardware
+ $this->is('Tizen') ||
+
+ // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser
+ // @todo: more tests here!
+ $this->is('Dolfin') && $this->version('Bada', self::VERSION_TYPE_FLOAT) >= 2.0 ||
+
+ // UC Browser - Tested on Android 2.3 device
+ ( ($this->is('UC Browser') || $this->is('Dolfin')) && $this->version('Android', self::VERSION_TYPE_FLOAT) >= 2.3 ) ||
+
+ // Kindle 3 and Fire - Tested on the built-in WebKit browser for each
+ ( $this->match('Kindle Fire') ||
+ $this->is('Kindle') && $this->version('Kindle', self::VERSION_TYPE_FLOAT) >= 3.0 ) ||
+
+ // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet
+ $this->is('AndroidOS') && $this->is('NookTablet') ||
+
+ // Chrome Desktop 16-24 - Tested on OS X 10.7 and Windows 7
+ $this->version('Chrome', self::VERSION_TYPE_FLOAT) >= 16 && !$isMobile ||
+
+ // Safari Desktop 5-6 - Tested on OS X 10.7 and Windows 7
+ $this->version('Safari', self::VERSION_TYPE_FLOAT) >= 5.0 && !$isMobile ||
+
+ // Firefox Desktop 10-18 - Tested on OS X 10.7 and Windows 7
+ $this->version('Firefox', self::VERSION_TYPE_FLOAT) >= 10.0 && !$isMobile ||
+
+ // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7
+ $this->version('IE', self::VERSION_TYPE_FLOAT) >= 7.0 && !$isMobile ||
+
+ // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7
+ $this->version('Opera', self::VERSION_TYPE_FLOAT) >= 10 && !$isMobile
+ ){
+ return self::MOBILE_GRADE_A;
+ }
+
+ if (
+ $this->is('iOS') && $this->version('iPad', self::VERSION_TYPE_FLOAT)<4.3 ||
+ $this->is('iOS') && $this->version('iPhone', self::VERSION_TYPE_FLOAT)<4.3 ||
+ $this->is('iOS') && $this->version('iPod', self::VERSION_TYPE_FLOAT)<4.3 ||
+
+ // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770
+ $this->is('Blackberry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) >= 5 && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)<6 ||
+
+ //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3
+ ($this->version('Opera Mini', self::VERSION_TYPE_FLOAT) >= 5.0 && $this->version('Opera Mini', self::VERSION_TYPE_FLOAT) <= 7.0 &&
+ ($this->version('Android', self::VERSION_TYPE_FLOAT) >= 2.3 || $this->is('iOS')) ) ||
+
+ // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1)
+ $this->match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') ||
+
+ // @todo: report this (tested on Nokia N71)
+ $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT) >= 11 && $this->is('SymbianOS')
+ ){
+ return self::MOBILE_GRADE_B;
+ }
+
+ if (
+ // Blackberry 4.x - Tested on the Curve 8330
+ $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) <= 5.0 ||
+ // Windows Mobile - Tested on the HTC Leo (WinMo 5.2)
+ $this->match('MSIEMobile|Windows CE.*Mobile') || $this->version('Windows Mobile', self::VERSION_TYPE_FLOAT) <= 5.2 ||
+
+ // Tested on original iPhone (3.1), iPhone 3 (3.2)
+ $this->is('iOS') && $this->version('iPad', self::VERSION_TYPE_FLOAT) <= 3.2 ||
+ $this->is('iOS') && $this->version('iPhone', self::VERSION_TYPE_FLOAT) <= 3.2 ||
+ $this->is('iOS') && $this->version('iPod', self::VERSION_TYPE_FLOAT) <= 3.2 ||
+
+ // Internet Explorer 7 and older - Tested on Windows XP
+ $this->version('IE', self::VERSION_TYPE_FLOAT) <= 7.0 && !$isMobile
+ ){
+ return self::MOBILE_GRADE_C;
+ }
+
+ // All older smartphone platforms and featurephones - Any device that doesn't support media queries
+ // will receive the basic, C grade experience.
+ return self::MOBILE_GRADE_C;
+ }
+}
diff --git a/autoload/class.Page.php b/autoload/class.Page.php
new file mode 100644
index 0000000..37731bc
--- /dev/null
+++ b/autoload/class.Page.php
@@ -0,0 +1,9 @@
+readImage($file);
+
+ if ($file_type === 'png')
+ {
+ $image->setImageFormat('webp');
+ $image->setImageCompressionQuality($compression_quality);
+ $image->setOption('webp:lossless', 'true');
+ }
+
+ $image->writeImage($output_file);
+ return $output_file;
+ }
+
+ return false;
+ }
+
+ static public function is_array_fix($value)
+ {
+ if (is_array($value) and count($value))
+ return true;
+ return false;
+ }
+
+ public static function suAppendHtmlById(&$s, $sId, $sHtml, &$oDoc = null)
+ {
+ return \S::suSetHtmlElementById($oDoc, $s, $sId, $sHtml, true, false);
+ }
+
+ public static function suInsertHtmlById(&$s, $sId, $sHtml, &$oDoc = null)
+ {
+ return \S::suSetHtmlElementById($oDoc, $s, $sId, $sHtml, false, true);
+ }
+
+ public static function suAddHtmlBeforeById(&$s, $sId, $sHtml, &$oDoc = null)
+ {
+ return \S::suSetHtmlElementById($oDoc, $s, $sId, $sHtml, false, true, true);
+ }
+
+ public static function suAddHtmlAfterById(&$s, $sId, $sHtml, &$oDoc = null)
+ {
+ return \S::suSetHtmlElementById($oDoc, $s, $sId, $sHtml, true, false, true);
+ }
+
+ public static function suSetHtmlById(&$s, $sId, $sHtml, &$oDoc = null)
+ {
+ return \S::suSetHtmlElementById($oDoc, $s, $sId, $sHtml, true, true);
+ }
+
+ public static function suReplaceHtmlElementById(&$s, $sId, $sHtml, &$oDoc = null)
+ {
+ return \S::suSetHtmlElementById($oDoc, $s, $sId, $sHtml, false, false);
+ }
+
+ public static function suRemoveHtmlElementById(&$s, $sId, &$oDoc = null)
+ {
+ return \S::suSetHtmlElementById($oDoc, $s, $sId, null, false, false);
+ }
+
+ public static function suSetHtmlElementById(&$oDoc, &$s, $sId, $sHtml, $bAppend = false, $bInsert = false, $bAddToOuter = false)
+ {
+ if (\S::suIsValidString($s) && \S::suIsValidString($sId))
+ {
+ $bCreate = true;
+ if (is_object($oDoc))
+ {
+ if (!($oDoc instanceof DOMDocument))
+ {
+ return false;
+ }
+ $bCreate = false;
+ }
+
+ if ($bCreate)
+ {
+ $oDoc = new DOMDocument();
+ }
+
+ libxml_use_internal_errors(true);
+ $oDoc->loadHTML($s, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
+ libxml_use_internal_errors(false);
+ $oNode = $oDoc->getElementById($sId);
+
+ if (is_object($oNode))
+ {
+ $bReplaceOuter = (!$bAppend && !$bInsert);
+
+ $sId = uniqid('SHEBI-');
+ $aId = array("", "");
+
+ if ($bReplaceOuter)
+ {
+ if (\S::suIsValidString($sHtml))
+ {
+ $oNode->parentNode->replaceChild($oDoc->createComment($sId), $oNode);
+ $s = $oDoc->saveHtml();
+ $s = str_replace($aId, $sHtml, $oDoc->saveHtml());
+ }
+ else
+ {
+ $oNode->parentNode->removeChild($oNode);
+ $s = $oDoc->saveHtml();
+ }
+ return true;
+ }
+
+ $bReplaceInner = ($bAppend && $bInsert);
+ $sThis = null;
+
+ if (!$bReplaceInner)
+ {
+ $sThis = $oDoc->saveHTML($oNode);
+ $sThis = ($bInsert ? $sHtml : '') . ($bAddToOuter ? $sThis : (substr($sThis, strpos($sThis, '>') + 1, - (strlen($oNode->nodeName) + 3)))) . ($bAppend ? $sHtml : '');
+ }
+
+ if (!$bReplaceInner && $bAddToOuter)
+ {
+ $oNode->parentNode->replaceChild($oDoc->createComment($sId), $oNode);
+ $sId = &$aId;
+ }
+ else
+ {
+ $oNode->nodeValue = $sId;
+ }
+
+ $s = str_replace($sId, $bReplaceInner ? $sHtml : $sThis, $oDoc->saveHtml());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static function suIsValidString(&$s, &$iLen = null, $minLen = null, $maxLen = null)
+ {
+ if (!is_string($s) || !isset($s{
+ 0}))
+ {
+ return false;
+ }
+
+ if ($iLen !== null)
+ {
+ $iLen = strlen($s);
+ }
+
+ return (($minLen === null ? true : ($minLen > 0 && isset($s{
+ $minLen - 1}))) &&
+ $maxLen === null ? true : ($maxLen >= $minLen && !isset($s{
+ $maxLen})));
+ }
+
+ public static function log_db_error($db_tmp, $debug)
+ {
+ global $settings;
+
+ if ($settings['mysql_debug'])
+ {
+ $out .= date('Y-m-d H:i:s') . PHP_EOL;
+ $out .= $db_tmp->error()[2] . PHP_EOL;
+ $out .= $db_tmp->last() . PHP_EOL;
+ $out .= $debug[0]['file'] . ' | ' . $debug[0]['line'] . PHP_EOL;
+ $out .= '--------------------------------------------------------------------------------------------' . PHP_EOL;
+
+ if (!is_dir('logs'))
+ mkdir('logs', 0755, true);
+
+ $content = file_get_contents('logs/' . date('Y-m-d') . '.txt');
+ $content = $out . $content;
+ file_put_contents('logs/' . date('Y-m-d') . '.txt', $content);
+ die('Blad bazy danych.');
+ }
+ }
+
+ public static function lang($text)
+ {
+ global $lang;
+ return $lang[$text] ? $lang[$text] : 'LANG-' . $text;
+ }
+
+ public static function cache_read($path)
+ {
+ $f = fopen($path, 'r');
+ $buffer = '';
+ while (!feof($f))
+ {
+ $buffer .= fread($f, 2048);
+ }
+ fclose($f);
+ return $buffer;
+ }
+
+ public static function cache_write($cache_url, $cache_file, $html)
+ {
+ $dir = md5($cache_url);
+ $dir = 'cache/' . $dir[0] . '/' . $dir[1] . '/';
+
+ if (!is_dir($dir))
+ mkdir($dir, 0755, true);
+
+ $f = fopen($cache_file, 'w');
+ fwrite($f, $html, strlen($html));
+ fclose($f);
+ return true;
+ }
+
+ public static function cache_file_url($cache_url)
+ {
+ $cache = md5($cache_url);
+ return 'cache/' . $cache{
+ 1} . '/' . $cache{
+ 2} . '/' . $cache;
+ }
+
+ public static function date_diff($data1, $data2, $rodz = '60')
+ {
+ $data1 = date('Y-m-d H:i:s', strtotime($data1));
+ $data2 = date('Y-m-d H:i:s', strtotime($data2));
+
+ $d1_t = explode(' ', $data1);
+ $d1_tt = explode('-', $d1_t[0]);
+ $rok1 = $d1_tt[0];
+ $mc1 = $d1_tt[1];
+ $d1 = $d1_tt[2];
+ $d1_tt = explode(':', $d1_t[1]);
+ $g1 = $d1_tt[0];
+ $m1 = $d1_tt[1];
+ $s1 = $d1_tt[2];
+
+ $d2_t = explode(' ', $data2);
+ $d2_tt = explode('-', $d2_t[0]);
+ $rok2 = $d2_tt[0];
+ $mc2 = $d2_tt[1];
+ $d2 = $d2_tt[2];
+ $d2_tt = explode(':', $d2_t[1]);
+ $g2 = $d2_tt[0];
+ $m2 = $d2_tt[1];
+ $s2 = $d2_tt[2];
+
+ $lt = mktime($g2, $m2, $s2, $mc2, $d2, $rok2);
+ $st = mktime($g1, $m1, $s1, $mc1, $d1, $rok1);
+
+ return round(($lt - $st) / $rodz);
+ }
+
+ public static function is_token_valid($token)
+ {
+ if (!empty($_SESSION['tokens'][$token]))
+ {
+ unset($_SESSION['tokens'][$token]);
+ return true;
+ }
+ return false;
+ }
+
+ public static function get_token()
+ {
+ $token = sha1(mt_rand());
+ if (!isset($_SESSION['tokens']))
+ $_SESSION['tokens'] = [$token => 1];
+ else
+ $_SESSION['tokens'][$token] = 1;
+ return $token;
+ }
+
+ public static function get_domain($url)
+ {
+ $parseUrl = parse_url(trim($url));
+ return trim($parseUrl[host] ? str_replace('www.', '', $parseUrl[host]) : str_replace('www.', '', array_shift(explode('/', $parseUrl[path], 2))));
+ }
+
+ public static function get_domain_url($url)
+ {
+ global $settings;
+
+ $settings['link_version'] ? $www = 'www.' : $www = '';
+ $settings['ssl'] == true ? $domain_prefix = 'https' : $domain_prefix = 'http';
+ return $domain_prefix . '://' . $www . \S::get_domain($url);
+ }
+
+ public static function max_db_value($table, $column)
+ {
+ global $mdb;
+ $results = $mdb->query('SELECT MAX(' . $column . ') FROM ' . $table)->fetchAll();
+ return $results[0][0];
+ }
+
+ public static function shuffle_assoc($list)
+ {
+ if (!is_array($list))
+ return $list;
+
+ $keys = array_keys($list);
+ shuffle($keys);
+ $random = array();
+ foreach ($keys as $key)
+ $random[$key] = $list[$key];
+ return $random;
+ }
+
+ public static function escape($value)
+ {
+ $return = '';
+ for ($i = 0; $i < strlen($value); ++$i)
+ {
+ $char = $value[$i];
+ $ord = ord($char);
+ if ($char !== "'" && $char !== "\"" && $char !== '\\' && $ord >= 32 && $ord <= 126)
+ $return .= $char;
+ else
+ $return .= '\\x' . dechex($ord);
+ }
+ return $return;
+ }
+
+ public static function is_bot()
+ {
+ $bots = ["Slurp", "Scooter", "URL_Spider_SQL", "Googlebot", "Firefly", "WebBug", "WebFindBot", "crawler", "appie", "msnbot", "InfoSeek", "FAST", "Spade", "NationalDirectory"];
+ $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
+ foreach ($bots as $bot)
+ if (stripos($agent, $bot) !== false)
+ return true;
+ return false;
+ }
+
+ public static function months()
+ {
+ return array(1 => 'Styczeń', 2 => 'Luty', 3 => 'Marzec', 4 => 'Kwiecień', 5 => 'Maj', 6 => 'Czerwiec', 7 => 'Lipiec', 8 => 'Sierpień', 9 => 'Wrzesień', 10 => 'Październik', 11 => 'Listopad', 12 => 'Grudzień');
+ }
+
+ public static function months_short()
+ {
+ return [1 => 'sty', 2 => 'lut', 3 => 'mar', 4 => 'kwi', 5 => 'maj', 6 => 'cze', 7 => 'lip', 8 => 'sie', 9 => 'wrz', 10 => 'paź', 11 => 'lis', 12 => 'gru'];
+ }
+
+ public static function chmod_r($path, $chmod = 0755)
+ {
+ $dir = new DirectoryIterator($path);
+ foreach ($dir as $item)
+ {
+ chmod($item->getPathname(), $chmod);
+ if ($item->isDir() && !$item->isDot())
+ self::chmod_r($item->getPathname());
+ }
+ }
+
+ public static function rrmdir($dir)
+ {
+ if (is_dir($dir))
+ {
+ $files = scandir($dir);
+ foreach ($files as $file)
+ if ($file != "." && $file != "..")
+ \S::rrmdir("$dir/$file");
+ rmdir($dir);
+ }
+ else if (file_exists($dir))
+ unlink($dir);
+ }
+
+ public static function rcopy($src, $dst)
+ {
+ if (is_dir($src))
+ {
+ mkdir($dst, 0755);
+ $files = scandir($src);
+ foreach ($files as $file)
+ if ($file != "." && $file != "..")
+ \S::rcopy("$src/$file", "$dst/$file");
+ }
+ else if (file_exists($src))
+ copy($src, $dst);
+
+ \S::rrmdir($src);
+ }
+
+ public static function is_mobile()
+ {
+ $detect = new \Mobile_Detect;
+ return $detect->isMobile();
+ }
+
+ public static function get_new_version()
+ {
+ global $settings;
+
+ if ($version = \S::get_session('new-version'))
+ return $version;
+
+ $versions = file_get_contents('http://www.cmspro.project-dc.pl/updates/versions.php?key=' . $settings['update_key']);
+ $versions = explode(PHP_EOL, $versions);
+ $version = str_replace(',', '.', max($versions));
+
+ \S::set_session('new-version', $version);
+
+ return $version;
+ }
+
+ public static function get_version()
+ {
+ return str_replace(',', '.', @file_get_contents('../libraries/version.ini'));
+ }
+
+ public static function pre($data, $type = '')
+ {
+ $data = str_replace('Array
+ (', '', $data);
+ $data = str_replace(')', '', $data);
+
+ echo '' . print_r($data, true) . ' ';
+ }
+
+ public static function json_to_array($json)
+ {
+ $values_tmp = json_decode($json, true);
+
+ if (is_array($values_tmp))
+ foreach ($values_tmp as $val)
+ {
+ if (isset($values[$val['name']]))
+ {
+ if (is_array($values[$val['name']]))
+ $values[$val['name']][] = $val['value'];
+ else
+ $values[$val['name']] = array($values[$val['name']], $val['value']);
+ }
+ else
+ $values[$val['name']] = $val['value'];
+ }
+ return $values;
+ }
+
+ public static function set_session($var, $val)
+ {
+ $_SESSION[$var] = $val;
+ }
+
+ public static function get_session($var)
+ {
+ return $_SESSION[$var];
+ }
+
+ public static function delete_session($var)
+ {
+ unset($_SESSION[$var]);
+ }
+
+ public static function get($var, $strip_tags = false)
+ {
+ if (isset($_POST[$var]))
+ {
+ if (is_string($_POST[$var]))
+ {
+ if ($strip_tags)
+ return trim(strip_tags($_POST[$var]));
+ else
+ return trim($_POST[$var]);
+ }
+ else
+ return $_POST[$var];
+ }
+ else
+ {
+ if (isset($_GET[$var]))
+ {
+ if (is_string($_GET[$var]))
+ {
+ if ($strip_tags)
+ return trim(strip_tags($_GET[$var]));
+ else
+ return trim($_GET[$var]);
+ }
+ else
+ return $_GET[$var];
+ }
+ }
+ }
+
+ public static function set_message($text)
+ {
+ self::set_session('message', $text);
+ }
+
+ public static function alert($text, $class = 'alert-success')
+ {
+ self::set_session('alert', $text);
+ self::set_session('alert-class', $class);
+ }
+
+ static public function get_language_domain($lang_id)
+ {
+ global $mdb;
+
+ $settings = \front\factory\Settings::settings_details();
+ $default_domain = \admin\factory\Languages::default_domain();
+ $settings['link_version'] ? $www = 'www.' : $www = '';
+
+ $domain = $mdb->get('pp_langs', 'domain', ['id' => $lang_id]);
+ if (!$domain)
+ {
+ if ($default_domain)
+ return $www . $default_domain;
+ else
+ return $www . preg_replace('#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME']);
+ }
+ else
+ {
+ return $www . $domain;
+ }
+ }
+
+ public static function htacces($dir = '../')
+ {
+ global $mdb;
+
+ $settings = \front\factory\Settings::settings_details();
+ $default_domain = \admin\factory\Languages::default_domain();
+ $available_domains = \admin\factory\Languages::available_domains();
+
+ $settings['link_version'] ? $www = 'www.' : $www = '';
+
+ $settings['ssl'] == true ? $domain_prefix = 'https' : $domain_prefix = 'http';
+
+ $default_domain ? $url = $default_domain : $url = preg_replace('#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME']);
+
+ $robots = 'User-agent: *' . PHP_EOL;
+ $robots .= 'Allow: /' . PHP_EOL;
+
+ unlink('../sitemap.xml');
+ if (is_array($available_domains) and !empty($available_domains))
+ {
+ foreach ($available_domains as $domain)
+ {
+ $site_map[$domain['domain']] = '' . PHP_EOL;
+ $site_map[$domain['domain']] .= '' . PHP_EOL;
+ $site_map[$domain['domain']] .= '' . PHP_EOL;
+ $site_map[$domain['domain']] .= '' . $domain_prefix . '://' . $www . $domain['domain'] . ' ' . PHP_EOL;
+ $site_map[$domain['domain']] .= '' . date('Y-m-d') . ' ' . PHP_EOL;
+ $site_map[$domain['domain']] .= 'daily ' . PHP_EOL;
+ $site_map[$domain['domain']] .= '1 ' . PHP_EOL;
+ $site_map[$domain['domain']] .= ' ' . PHP_EOL;
+ }
+ }
+ else
+ {
+ $site_map[$url] = '' . PHP_EOL;
+ $site_map[$url] .= '' . PHP_EOL;
+ $site_map[$url] .= '' . PHP_EOL;
+ $site_map[$url] .= '' . $domain_prefix . '://' . $www . $url . ' ' . PHP_EOL;
+ $site_map[$url] .= '' . date('Y-m-d') . ' ' . PHP_EOL;
+ $site_map[$url] .= 'daily ' . PHP_EOL;
+ $site_map[$url] .= '1 ' . PHP_EOL;
+ $site_map[$url] .= ' ' . PHP_EOL;
+ }
+
+ $htaccess_data = file_get_contents($dir . 'libraries/htaccess.conf');
+
+ /* cache */
+ if ($settings['htaccess_cache'])
+ {
+ $htaccess_data = str_replace(
+ '{HTACCESS_CACHE}',
+ '' . PHP_EOL
+ . 'AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript' . PHP_EOL
+ . ' ' . PHP_EOL
+ . '' . PHP_EOL
+ . 'ExpiresActive on' . PHP_EOL
+ . 'ExpiresDefault "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType text/css "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType application/json "access plus 0 seconds"' . PHP_EOL
+ . 'ExpiresByType application/xml "access plus 0 seconds"' . PHP_EOL
+ . 'ExpiresByType text/xml "access plus 0 seconds"' . PHP_EOL
+ . 'ExpiresByType image/x-icon "access plus 1 week"' . PHP_EOL
+ . 'ExpiresByType text/x-component "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType text/html "access plus 0 seconds"' . PHP_EOL
+ . 'ExpiresByType application/javascript "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"' . PHP_EOL
+ . 'ExpiresByType text/cache-manifest "access plus 0 seconds"' . PHP_EOL
+ . 'ExpiresByType audio/ogg "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType image/gif "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType image/jpeg "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType image/webp "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType image/png "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType video/mp4 "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType video/ogg "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType video/webm "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType application/atom+xml "access plus 1 hour"' . PHP_EOL
+ . 'ExpiresByType application/rss+xml "access plus 1 hour"' . PHP_EOL
+ . 'ExpiresByType application/font-woff "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType application/vnd.ms-fontobject "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType application/x-font-ttf "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType font/opentype "access plus 1 year"' . PHP_EOL
+ . 'ExpiresByType image/svg+xml "access plus 1 year"' . PHP_EOL
+ . ' ',
+ $htaccess_data
+ );
+ }
+ else
+ {
+ $htaccess_data = str_replace(
+ '{HTACCESS_CACHE}',
+ '' . PHP_EOL
+ . 'Header set Cache-Control "no-cache, no-store, must-revalidate"' . PHP_EOL
+ . 'Header set Pragma "no-cache"' . PHP_EOL
+ . 'Header set Expires 0' . PHP_EOL
+ . ' ',
+ $htaccess_data
+ );
+ }
+
+ /* języki w domenie głównej */
+ $results = $mdb->select('pp_langs', ['id'], ['AND' => ['status' => 1, 'domain' => null], 'ORDER' => ['o' => 'ASC']]);
+ if (is_array($results)) foreach ($results as $row)
+ {
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^' . $row['id'] . '/$ index.php?a=change_language&id=' . $row['id'] . ' [L]';
+ }
+
+ $htaccess_data .= PHP_EOL;
+
+ $results = $mdb->select('pp_langs', ['id', 'start', 'domain', 'main_domain'], ['status' => 1, 'ORDER' => ['o' => 'ASC']]);
+ if (is_array($results)) foreach ($results as $row)
+ {
+ $row['domain'] ? $url_tmp = $row['domain'] : $url_tmp = $url;
+
+ !$row['start'] ? $language_link = $row['id'] . '/' : $language_link = '';
+
+ $results2 = $mdb->select(
+ 'pp_pages_langs',
+ ['[><]pp_pages' => ['page_id' => 'id']],
+ ['seo_link', 'title', 'page_id', 'noindex', 'start', 'page_type'],
+ ['AND' => ['status' => 1, 'lang_id' => $row['id'], 'block_direct_access' => 0], 'ORDER' => ['start' => 'DESC', 'o' => 'ASC']]
+ );
+ if (is_array($results2)) foreach ($results2 as $row2)
+ {
+ if ($row2['title'])
+ {
+ /* sitemap.xml */
+ if ($row2['page_type'] != 3 and !$row2['noindex'])
+ {
+ $site_map[$url_tmp] .= '' . PHP_EOL;
+
+ if ($row2['seo_link'])
+ {
+ if ($settings['links_structure'])
+ $seo = \admin\factory\Pages::google_url_preview($row2['page_id'], $row2['title'], $row[id], 0, 0, $row2['seo_link'], $language_link);
+ else
+ $seo = $language_link . \S::seo($row2['seo_link']);
+
+ $site_map[$url_tmp] .= '' . $domain_prefix . '://' . $www . $url_tmp . '/' . $seo . ' ' . PHP_EOL;
+ }
+ else
+ {
+ if ($settings['links_structure'])
+ $seo = \admin\factory\Pages::google_url_preview($row2['page_id'], $row2['title'], $row['id'], 0, 0, $row2['seo_link'], $language_link);
+ else
+ $seo = $language_link . 's-' . $row2['page_id'] . '-' . \S::seo($row2['title']);
+
+ $site_map[$url_tmp] .= '' . $domain_prefix . '://' . $www . $url_tmp . '/' . $seo . ' ' . PHP_EOL;
+ }
+
+ $site_map[$url_tmp] .= '' . date('Y-m-d') . ' ' . PHP_EOL;
+ $site_map[$url_tmp] .= 'daily ' . PHP_EOL;
+
+ $row['start'] ? $priority = 1 : $priority = 0.8;
+
+ $site_map[$url_tmp] .= '' . $priority . ' ' . PHP_EOL;
+ $site_map[$url_tmp] .= ' ' . PHP_EOL;
+ }
+
+ /* robotx.txt */
+ if ($row2['noindex'] and $row2['page_type'] != 3)
+ {
+ $robots .= 'User-agent: GoogleBot' . PHP_EOL;
+
+ if ($row2['seo_link'])
+ {
+ if ($settings['links_structure'])
+ $seo = \admin\factory\Pages::google_url_preview($row2['page_id'], $row2['title'], $row[id], 0, 0, $row2['seo_link'], $language_link);
+ else
+ $seo = $language_link . \S::seo($row2['seo_link']);
+
+ $robots .= 'Disallow: /' . $seo . '$' . PHP_EOL;
+ $robots .= 'Disallow: /' . $seo . '/s/*' . PHP_EOL;
+ }
+ else
+ {
+ if ($settings['links_structure'])
+ $seo = \admin\factory\Pages::google_url_preview($row2['page_id'], $row2['title'], $row['id'], 0, 0, $row2['seo_link'], $language_link);
+ else
+ $seo = $language_link . 's-' . $row2['page_id'] . '-' . \S::seo($row2['title']);
+
+ $robots .= 'Disallow: /' . $seo . '$' . PHP_EOL;
+ $robots .= 'Disallow: /' . $seo . '/s/*$' . PHP_EOL;
+ }
+ }
+
+ /* htaccess */
+ if ($row2['page_type'] != 3)
+ {
+ 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'])
+ {
+ $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$';
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^(.*)$ ' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . ' [R=301,L]';
+ }
+ else
+ {
+ $htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/s-' . $row2['page_id'] . '-' . \S::seo($row2['title']) . '$';
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^(.*)$ ' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . ' [R=301,L]';
+
+ $htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} ^/s-' . $row2['page_id'] . '-' . \S::seo($row2['title']) . '-s-1$';
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^(.*)$ ' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . ' [R=301,L]';
+ }
+
+ $htaccess_data .= PHP_EOL . 'RewriteCond %{REQUEST_URI} "^/$"';
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . ' [L]';
+
+ $htaccess_data .= PHP_EOL;
+ }
+
+ if ($row2['seo_link'])
+ {
+ if ($settings['links_structure'])
+ $seo = \admin\factory\Pages::google_url_preview($row2['page_id'], $row2['title'], $row[id], 0, 0, $row2['seo_link'], $language_link);
+ else
+ $seo = $language_link . \S::seo($row2['seo_link']);
+
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '(|/)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '/s/1(|/)$ ' . $seo . ' [R=301,L]';
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '/s/([0-9]+)(|/)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&bs=$1&%{QUERY_STRING} [L]';
+ }
+ else
+ {
+ if ($settings['links_structure'])
+ $seo = \admin\factory\Pages::google_url_preview($row2['page_id'], $row2['title'], $row['id'], 0, 0, $row2['seo_link'], $language_link);
+ else
+ $seo = $language_link . 's-' . $row2['page_id'] . '-' . \S::seo($row2['title']);
+
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '(|/)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '/s/1(|/)$ ' . $seo . ' [R=301,L]';
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^' . $seo . '/s/([0-9]+)(|/)$ index.php?a=page&id=' . $row2['page_id'] . '&lang=' . $row['id'] . '&bs=$1&%{QUERY_STRING} [L]';
+ }
+ $htaccess_data .= PHP_EOL;
+ }
+ }
+ }
+
+ $results2 = $mdb->select(
+ 'pp_articles_langs',
+ ['[><]pp_articles' => ['article_id' => 'id']],
+ ['seo_link', 'title', 'article_id', 'noindex', 'copy_from', 'block_direct_access'],
+ ['AND' => ['status' => 1, 'lang_id' => $row['id']]]
+ );
+ if (is_array($results2)) foreach ($results2 as $row2)
+ {
+ $domain = \S::get_language_domain($row['id']);
+
+ if ($row2['copy_from'] != null)
+ {
+ $results_tmp = $mdb->get(
+ 'pp_articles_langs',
+ [
+ 'seo_link',
+ 'title'
+ ],
+ [
+ 'AND' => [
+ 'article_id' => $row2['article_id'],
+ 'lang_id' => $row2['copy_from']
+ ]
+ ]
+ );
+ $row2['seo_link'] = $results_tmp['seo_link'];
+ $row2['title'] = $results_tmp['title'];
+ }
+
+ /* sitemap */
+ if (!$row2['block_direct_access'] and $row2['title'])
+ {
+ $site_map[$url_tmp] .= '' . PHP_EOL;
+ if ($row2['seo_link'])
+ $site_map[$url_tmp] .= '' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . \S::seo($row2['seo_link']) . ' ' . PHP_EOL;
+ else
+ $site_map[$url_tmp] .= '' . $domain_prefix . '://' . $www . $url_tmp . '/' . $language_link . 'a-' . $row2['article_id'] . '-' . self::seo($row2['title']) . ' ' . PHP_EOL;
+ $site_map[$url_tmp] .= '' . date('Y-m-d') . ' ' . PHP_EOL;
+ $site_map[$url_tmp] .= 'daily ' . PHP_EOL;
+ $site_map[$url_tmp] .= '0.6 ' . PHP_EOL;
+ $site_map[$url_tmp] .= ' ' . PHP_EOL;
+ }
+
+ /* robots.txt */
+ if ($row2['noindex'])
+ {
+ $robots .= 'User-agent: GoogleBot' . PHP_EOL;
+ if ($row2['seo_link'])
+ $robots .= 'Disallow: /' . $row2['seo_link'] . '$' . PHP_EOL;
+ else
+ $robots .= 'Disallow: /a-' . $row2['article_id'] . '-' . self::seo($row2['title']) . '$' . PHP_EOL;
+ }
+
+ if (!$row2['block_direct_access'])
+ {
+ if ($row2['seo_link'])
+ {
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . \S::seo($row2['seo_link']) . '(|/)$ index.php?article=' . $row2['article_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
+ }
+ else if ($row2['title'] != null)
+ {
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^' . $language_link . 'a-' . $row2['article_id'] . '-' . \S::seo($row2['title']) . '(|/)$ index.php?article=' . $row2['article_id'] . '&lang=' . $row['id'] . '&%{QUERY_STRING} [L]';
+ }
+ $htaccess_data .= PHP_EOL;
+ }
+ }
+ }
+
+ $results = $mdb->query('SELECT '
+ . 'name, tag_id '
+ . 'FROM '
+ . 'pp_tags AS pt '
+ . 'INNER JOIN '
+ . 'pp_articles_tags AS pat ON pat.tag_id = pt.id '
+ . 'GROUP BY '
+ . 'tag_id')->fetchAll();
+ if (is_array($results) and !empty($results)) foreach ($results as $row)
+ {
+ $htaccess_data .= PHP_EOL . 'RewriteCond %{QUERY_STRING} !=""';
+ $htaccess_data .= PHP_EOL . 'RewriteRule tag/' . \S::seo( $row['name'] ) . '(|/) %{REQUEST_URI}? [R=301,L]';
+ $htaccess_data .= PHP_EOL . 'RewriteRule ^tag/' . \S::seo( $row['name'] ) . '(|/)$ index.php?tag=' . $row['tag_id'] . ' [L]';
+ }
+
+ $results = $mdb->get('pp_settings', 'value', ['param' => 'htaccess']);
+ if ($results)
+ $htaccess_data .= PHP_EOL . $results;
+
+ if (file_exists('../libraries/htaccess.ini'))
+ $htaccess_data .= PHP_EOL . file_get_contents('../libraries/htaccess.ini');
+
+ $results = $mdb->get('pp_settings', 'value', ['param' => 'robots']);
+ if ($results)
+ $robots .= PHP_EOL . $results;
+
+ if (is_array($available_domains) and !empty($available_domains))
+ {
+ foreach ($available_domains as $domain)
+ $site_map[$domain['domain']] .= ' ';
+ }
+ else
+ $site_map[$url] .= ' ';
+
+ 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 );
+ }
+ }
+ 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 );
+ }
+ }
+
+ $additional_classes = file_get_contents('../libraries/additional-classes.ini');
+ $additional_classes = explode(PHP_EOL, $additional_classes);
+ $additional_classes = array_filter($additional_classes);
+ if (is_array($additional_classes) and !empty($additional_classes))
+ {
+ foreach ($additional_classes as $class)
+ {
+ $classes .= 'RewriteCond %{REQUEST_URI} ^/' . trim($class) . '/(.*) [NC]' . PHP_EOL;
+ $classes .= 'RewriteRule ^([^/]*)/([^/]*)(|/([^/]*))$ index.php?module=$1&action=$2&$4 [L]' . PHP_EOL;
+ }
+ }
+ $htaccess_data = str_replace('{ADDITIONAL_CLASSES}', $classes, $htaccess_data);
+
+ /* pozostałe linki */
+ $htaccess_data .= PHP_EOL;
+ $htaccess_data .= 'RewriteRule ^newsletter/signin$ index.php?module=newsletter&action=signin [L]' . PHP_EOL;
+ $htaccess_data .= 'RewriteRule ^newsletter/confirm/hash=(.*)$ index.php?module=newsletter&action=confirm&hash=$1 [L]' . PHP_EOL;
+ $htaccess_data .= 'RewriteRule ^newsletter/unsubscribe/hash=(.*)$ index.php?module=newsletter&action=unsubscribe&hash=$1 [L]' . PHP_EOL;
+
+ /* pixieset */
+ $results = $mdb->select('pp_articles', 'id', ['pixieset' => 1]);
+ if (is_array($results) and count($results))
+ {
+ $pixieset = 'RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?' . $url_tmp . ' [NC]' . PHP_EOL;
+ $pixieset .= 'RewriteCond %{REQUEST_URI} ^(';
+ foreach ($results as $row)
+ {
+ $pixieset .= '/upload/article_images/article_' . $row . '/';
+ if ($row != end($results))
+ $pixieset .= '|';
+ }
+ $pixieset .= ') [NC]' . PHP_EOL . 'RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]' . PHP_EOL;
+
+ $htaccess_data = str_replace('{PIXIESET]', $pixieset, $htaccess_data);
+ }
+ else
+ {
+ $htaccess_data = str_replace('{PIXIESET]', '', $htaccess_data);
+ }
+
+ $fp = fopen($dir . '.htaccess', 'w');
+ fwrite($fp, $htaccess_data);
+ fclose($fp);
+
+ $class = '\admin\factory\Sitemap';
+ $action = 'sitemap';
+
+ if (class_exists($class) and method_exists(new $class, $action))
+ $site_map = call_user_func_array(array($class, $action), array($site_map, $available_domains, $domain_prefix, $www, $url));
+
+ if (is_array($available_domains) and !empty($available_domains))
+ {
+ foreach ($available_domains as $domain)
+ {
+ $fp = fopen($dir . 'sitemap_' . \S::seo($domain['domain']) . '.xml', 'w');
+ fwrite($fp, $site_map[$domain['domain']]);
+ fclose($fp);
+ }
+ }
+ else
+ {
+ $fp = fopen($dir . 'sitemap.xml', 'w');
+ fwrite($fp, $site_map[$url]);
+ fclose($fp);
+ }
+
+ $fp = fopen($dir . 'robots.txt', 'w');
+ fwrite($fp, $robots);
+ fclose($fp);
+ }
+
+ public static function seo( $val, $delete_rhombs = false )
+ {
+ $array_rep1 = array('*', '_', ' ', '+', '"', "'", '?', '-', ',', '!', '~', '<', '>', '@', '#', '$', '%', '^', '&', '*' . '(', ')' . '-', '=', '\\', '|', '[', ']', ':', '(', ')');
+ $array_rep2 = array('-', '-', '-', '-', '', '', '', '-', '-', '', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '', '-', '-', '-', '-', '-', '-', '-', '-');
+ $val = self::noPl($val);
+ $val = str_replace($array_rep1, $array_rep2, $val);
+ if ($delete_rhombs)
+ $val = str_replace('/', '', $val);
+
+ $val = strtolower($val);
+ $val = preg_replace('/(-){2,}/', '-', $val);
+ $val = ltrim($val, '-');
+ $val = rtrim($val, '-');
+ return $val;
+ }
+
+ public static function noPL($string)
+ {
+ $chars = array( // Decompositions for Latin-1 Supplement chr(195).chr(128)=> 'A', chr(195).chr(129) => 'A',
+ chr(195) . chr(130) => 'A', chr(195) . chr(131) => 'A',
+ chr(195) . chr(132) => 'A', chr(195) . chr(133) => 'A',
+ chr(195) . chr(135) => 'C', chr(195) . chr(136) => 'E',
+ chr(195) . chr(137) => 'E', chr(195) . chr(138) => 'E',
+ chr(195) . chr(139) => 'E', chr(195) . chr(140) => 'I',
+ chr(195) . chr(141) => 'I', chr(195) . chr(142) => 'I',
+ chr(195) . chr(143) => 'I', chr(195) . chr(145) => 'N',
+ chr(195) . chr(146) => 'O', chr(195) . chr(147) => 'O',
+ chr(195) . chr(148) => 'O', chr(195) . chr(149) => 'O',
+ chr(195) . chr(150) => 'O', chr(195) . chr(153) => 'U',
+ chr(195) . chr(154) => 'U', chr(195) . chr(155) => 'U',
+ chr(195) . chr(156) => 'U', chr(195) . chr(157) => 'Y',
+ chr(195) . chr(159) => 's', chr(195) . chr(160) => 'a',
+ chr(195) . chr(161) => 'a', chr(195) . chr(162) => 'a',
+ chr(195) . chr(163) => 'a', chr(195) . chr(164) => 'a',
+ chr(195) . chr(165) => 'a', chr(195) . chr(167) => 'c',
+ chr(195) . chr(168) => 'e', chr(195) . chr(169) => 'e',
+ chr(195) . chr(170) => 'e', chr(195) . chr(171) => 'e',
+ chr(195) . chr(172) => 'i', chr(195) . chr(173) => 'i',
+ chr(195) . chr(174) => 'i', chr(195) . chr(175) => 'i',
+ chr(195) . chr(177) => 'n', chr(195) . chr(178) => 'o',
+ chr(195) . chr(179) => 'o', chr(195) . chr(180) => 'o',
+ chr(195) . chr(181) => 'o', chr(195) . chr(182) => 'o',
+ chr(195) . chr(182) => 'o', chr(195) . chr(185) => 'u',
+ chr(195) . chr(186) => 'u', chr(195) . chr(187) => 'u',
+ chr(195) . chr(188) => 'u', chr(195) . chr(189) => 'y',
+ chr(195) . chr(191) => 'y',
+ // Decompositions for Latin Extended-A
+ chr(196) . chr(128) => 'A', chr(196) . chr(129) => 'a',
+ chr(196) . chr(130) => 'A', chr(196) . chr(131) => 'a',
+ chr(196) . chr(132) => 'A', chr(196) . chr(133) => 'a',
+ chr(196) . chr(134) => 'C', chr(196) . chr(135) => 'c',
+ chr(196) . chr(136) => 'C', chr(196) . chr(137) => 'c',
+ chr(196) . chr(138) => 'C', chr(196) . chr(139) => 'c',
+ chr(196) . chr(140) => 'C', chr(196) . chr(141) => 'c',
+ chr(196) . chr(142) => 'D', chr(196) . chr(143) => 'd',
+ chr(196) . chr(144) => 'D', chr(196) . chr(145) => 'd',
+ chr(196) . chr(146) => 'E', chr(196) . chr(147) => 'e',
+ chr(196) . chr(148) => 'E', chr(196) . chr(149) => 'e',
+ chr(196) . chr(150) => 'E', chr(196) . chr(151) => 'e',
+ chr(196) . chr(152) => 'E', chr(196) . chr(153) => 'e',
+ chr(196) . chr(154) => 'E', chr(196) . chr(155) => 'e',
+ chr(196) . chr(156) => 'G', chr(196) . chr(157) => 'g',
+ chr(196) . chr(158) => 'G', chr(196) . chr(159) => 'g',
+ chr(196) . chr(160) => 'G', chr(196) . chr(161) => 'g',
+ chr(196) . chr(162) => 'G', chr(196) . chr(163) => 'g',
+ chr(196) . chr(164) => 'H', chr(196) . chr(165) => 'h',
+ chr(196) . chr(166) => 'H', chr(196) . chr(167) => 'h',
+ chr(196) . chr(168) => 'I', chr(196) . chr(169) => 'i',
+ chr(196) . chr(170) => 'I', chr(196) . chr(171) => 'i',
+ chr(196) . chr(172) => 'I', chr(196) . chr(173) => 'i',
+ chr(196) . chr(174) => 'I', chr(196) . chr(175) => 'i',
+ chr(196) . chr(176) => 'I', chr(196) . chr(177) => 'i',
+ chr(196) . chr(178) => 'IJ', chr(196) . chr(179) => 'ij',
+ chr(196) . chr(180) => 'J', chr(196) . chr(181) => 'j',
+ chr(196) . chr(182) => 'K', chr(196) . chr(183) => 'k',
+ chr(196) . chr(184) => 'k', chr(196) . chr(185) => 'L',
+ chr(196) . chr(186) => 'l', chr(196) . chr(187) => 'L',
+ chr(196) . chr(188) => 'l', chr(196) . chr(189) => 'L',
+ chr(196) . chr(190) => 'l', chr(196) . chr(191) => 'L',
+ chr(197) . chr(128) => 'l', chr(197) . chr(129) => 'L',
+ chr(197) . chr(130) => 'l', chr(197) . chr(131) => 'N',
+ chr(197) . chr(132) => 'n', chr(197) . chr(133) => 'N',
+ chr(197) . chr(134) => 'n', chr(197) . chr(135) => 'N',
+ chr(197) . chr(136) => 'n', chr(197) . chr(137) => 'N',
+ chr(197) . chr(138) => 'n', chr(197) . chr(139) => 'N',
+ chr(197) . chr(140) => 'O', chr(197) . chr(141) => 'o',
+ chr(197) . chr(142) => 'O', chr(197) . chr(143) => 'o',
+ chr(197) . chr(144) => 'O', chr(197) . chr(145) => 'o',
+ chr(197) . chr(146) => 'OE', chr(197) . chr(147) => 'oe',
+ chr(197) . chr(148) => 'R', chr(197) . chr(149) => 'r',
+ chr(197) . chr(150) => 'R', chr(197) . chr(151) => 'r',
+ chr(197) . chr(152) => 'R', chr(197) . chr(153) => 'r',
+ chr(197) . chr(154) => 'S', chr(197) . chr(155) => 's',
+ chr(197) . chr(156) => 'S', chr(197) . chr(157) => 's',
+ chr(197) . chr(158) => 'S', chr(197) . chr(159) => 's',
+ chr(197) . chr(160) => 'S', chr(197) . chr(161) => 's',
+ chr(197) . chr(162) => 'T', chr(197) . chr(163) => 't',
+ chr(197) . chr(164) => 'T', chr(197) . chr(165) => 't',
+ chr(197) . chr(166) => 'T', chr(197) . chr(167) => 't',
+ chr(197) . chr(168) => 'U', chr(197) . chr(169) => 'u',
+ chr(197) . chr(170) => 'U', chr(197) . chr(171) => 'u',
+ chr(197) . chr(172) => 'U', chr(197) . chr(173) => 'u',
+ chr(197) . chr(174) => 'U', chr(197) . chr(175) => 'u',
+ chr(197) . chr(176) => 'U', chr(197) . chr(177) => 'u',
+ chr(197) . chr(178) => 'U', chr(197) . chr(179) => 'u',
+ chr(197) . chr(180) => 'W', chr(197) . chr(181) => 'w',
+ chr(197) . chr(182) => 'Y', chr(197) . chr(183) => 'y',
+ chr(197) . chr(184) => 'Y', chr(197) . chr(185) => 'Z',
+ chr(197) . chr(186) => 'z', chr(197) . chr(187) => 'Z',
+ chr(197) . chr(188) => 'z', chr(197) . chr(189) => 'Z',
+ chr(197) . chr(190) => 'z', chr(197) . chr(191) => 's'
+ );
+
+ $string = strtr($string, $chars);
+
+ $table = array(
+ "А" => "a", "Б" => "b", "В" => "v", "Г" => "g", "Д" => "d",
+ "Е" => "e", "Ё" => "yo", "Ж" => "zh", "З" => "z", "И" => "i",
+ "Й" => "j", "К" => "k", "Л" => "l", "М" => "m", "Н" => "n",
+ "О" => "o", "П" => "p", "Р" => "r", "С" => "s", "Т" => "t",
+ "У" => "u", "Ф" => "f", "Х" => "kh", "Ц" => "ts", "Ч" => "ch",
+ "Ш" => "sh", "Щ" => "sch", "Ъ" => "", "Ы" => "y", "Ь" => "",
+ "Э" => "e", "Ю" => "yu", "Я" => "ya", "а" => "a", "б" => "b",
+ "в" => "v", "г" => "g", "д" => "d", "е" => "e", "ё" => "yo",
+ "ж" => "zh", "з" => "z", "и" => "i", "й" => "j", "к" => "k",
+ "л" => "l", "м" => "m", "н" => "n", "о" => "o", "п" => "p",
+ "р" => "r", "с" => "s", "т" => "t", "у" => "u", "ф" => "f",
+ "х" => "kh", "ц" => "ts", "ч" => "ch", "ш" => "sh", "щ" => "sch",
+ "ъ" => "", "ы" => "y", "ь" => "", "э" => "e", "ю" => "yu",
+ "я" => "ya", " " => "-", "." => "", "," => "",
+ ":" => "", ";" => "", "—" => "", "–" => "-"
+ );
+
+ $string = strtr($string, $table);
+
+ return $string;
+ }
+
+ public static function delete_cache()
+ {
+ \S::delete_dir('../cache/');
+ \S::delete_dir('../temp/');
+ \S::delete_dir('temp/');
+ }
+
+ public static function delete_dir($dir)
+ {
+ if (is_file($dir))
+ return @unlink($dir);
+
+ else if (is_dir($dir))
+ {
+ $scan = glob(rtrim($dir, '/') . '/*');
+
+ if (is_array($scan))
+ foreach ($scan as $index => $path)
+ self::delete_dir($path);
+
+ if (is_dir($dir) && self::is_empty_dir($dir) and $dir != '../temp/')
+ return @rmdir($dir);
+ }
+ }
+
+ public static function is_empty_dir($dir)
+ {
+ return (($files = @scandir($dir)) && count($files) <= 2);
+ }
+ public static function email_check($email)
+ {
+ return filter_var($email, FILTER_VALIDATE_EMAIL);
+ }
+ 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)
+ {
+ $mail = new PHPMailer();
+ $mail->IsSMTP();
+ $mail->SMTPAuth = true;
+ $mail->Host = $settings['email_host'];
+ $mail->Port = $settings['email_port'];
+ $mail->Username = $settings['email_login'];
+ $mail->Password = $settings['email_password'];
+ $mail->CharSet = "UTF-8";
+ $mail->SMTPOptions = array(
+ 'ssl' => array(
+ 'verify_peer' => false,
+ 'verify_peer_name' => false,
+ 'allow_self_signed' => true
+ )
+ );
+
+ if (self::email_check($replay))
+ {
+ $mail->AddReplyTo($replay, $replay);
+ $mail->SetFrom($settings['contact_email'], $settings['contact_email']);
+ }
+ else
+ {
+ $mail->AddReplyTo($settings['contact_email'], $settings['firm_name']);
+ $mail->SetFrom($settings['contact_email'], $settings['firm_name']);
+ }
+
+ $mail->AddAddress($email, '');
+ $mail->Subject = $subject;
+ $mail->Body = $text;
+ if (is_array($file))
+ {
+ foreach ($file as $file_tmp)
+ {
+ if (file_exists($file_tmp))
+ $mail->AddAttachment($file_tmp);
+ }
+ }
+ else
+ {
+ if (file_exists($file))
+ $mail->AddAttachment($file);
+ }
+ $mail->IsHTML(true);
+ return $mail->Send();
+ }
+ return false;
+ }
+}
diff --git a/autoload/class.Scontainer.php b/autoload/class.Scontainer.php
new file mode 100644
index 0000000..b867571
--- /dev/null
+++ b/autoload/class.Scontainer.php
@@ -0,0 +1,45 @@
+ update( 'pp_scontainers_langs', [
+ 'text' => $content
+ ], [
+ 'AND' => [ 'container_id' => $scontainer_id, 'lang_id' => $lang_id ]
+ ] );
+ }
+
+ public function __get( $variable )
+ {
+ if ( array_key_exists( $variable, $this -> data ) )
+ return $this -> $variable;
+ }
+
+ public function __set( $variable, $value )
+ {
+ $this -> $variable = $value;
+ }
+
+ public function offsetExists( $offset )
+ {
+ return isset( $this -> $offset );
+ }
+
+ public function offsetGet( $offset )
+ {
+ return $this -> $offset;
+ }
+
+ public function offsetSet( $offset, $value )
+ {
+ $this -> $offset = $value;
+ }
+
+ public function offsetUnset( $offset )
+ {
+ unset( $this -> $offset );
+ }
+}
\ No newline at end of file
diff --git a/autoload/class.Tpl.php b/autoload/class.Tpl.php
new file mode 100644
index 0000000..1227612
--- /dev/null
+++ b/autoload/class.Tpl.php
@@ -0,0 +1,73 @@
+ dir = $dir;
+ }
+
+ public static function view( $file, $values = '' )
+ {
+ $tpl = new \Tpl;
+ if ( is_array( $values ) ) foreach ( $values as $key => $val )
+ $tpl -> $key = $val;
+ return $tpl -> render( $file );
+ }
+
+ public function secureHTML( $val )
+ {
+ $out = stripslashes( $val );
+ $out = str_replace( "'", "'", $out );
+ $out = str_replace( '"', """, $out );
+ $out = str_replace( "<", "<", $out );
+ $out = str_replace( ">", ">", $out );
+ return $out;
+ }
+
+ public function render( $file )
+ {
+ if ( file_exists( 'templates_user/' . $file . '.php' ) )
+ {
+ ob_start();
+ include 'templates_user/' . $file . '.php';
+ $out = ob_get_contents();
+ ob_end_clean();
+
+ return $out;
+ }
+ else if ( file_exists( 'templates/' . $file . '.php' ) )
+ {
+ ob_start();
+ include 'templates/' . $file . '.php';
+ $out = ob_get_contents();
+ ob_end_clean();
+
+ return $out;
+ }
+ else if ( file_exists( $file . '.php' ) )
+ {
+ ob_start();
+ include $file . '.php';
+ $out = ob_get_contents();
+ ob_end_clean();
+
+ return $out;
+ }
+ else
+ return 'Nie znaleziono pliku widoku:
' . $this -> dir . $file . '.php ';
+ }
+
+ public function __set( $name, $value )
+ {
+ $this -> vars[ $name ] = $value;
+ }
+
+ public function __get( $name )
+ {
+ return $this -> vars[ $name ];
+ }
+}
diff --git a/autoload/class.geoplugin.php b/autoload/class.geoplugin.php
new file mode 100644
index 0000000..05391bd
--- /dev/null
+++ b/autoload/class.geoplugin.php
@@ -0,0 +1,154 @@
+host );
+ $host = str_replace( '{CURRENCY}', $this->currency, $host );
+
+ $data = array();
+
+ $response = $this->fetch($host);
+
+ $data = unserialize($response);
+
+ //set the geoPlugin vars
+ $this->ip = $ip;
+ $this->city = $data['geoplugin_city'];
+ $this->region = $data['geoplugin_region'];
+ $this->areaCode = $data['geoplugin_areaCode'];
+ $this->dmaCode = $data['geoplugin_dmaCode'];
+ $this->countryCode = $data['geoplugin_countryCode'];
+ $this->countryName = $data['geoplugin_countryName'];
+ $this->continentCode = $data['geoplugin_continentCode'];
+ $this->latitude = $data['geoplugin_latitude'];
+ $this->longitude = $data['geoplugin_longitude'];
+ $this->currencyCode = $data['geoplugin_currencyCode'];
+ $this->currencySymbol = $data['geoplugin_currencySymbol'];
+ $this->currencyConverter = $data['geoplugin_currencyConverter'];
+
+ }
+
+ function fetch($host) {
+
+ if ( function_exists('curl_init') ) {
+
+ //use cURL to fetch data
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $host);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_USERAGENT, 'geoPlugin PHP Class v1.0');
+ $response = curl_exec($ch);
+ curl_close ($ch);
+
+ } else if ( ini_get('allow_url_fopen') ) {
+
+ //fall back to fopen()
+ $response = file_get_contents($host, 'r');
+
+ } else {
+
+ trigger_error ('geoPlugin class Error: Cannot retrieve data. Either compile PHP with cURL support or enable allow_url_fopen in php.ini ', E_USER_ERROR);
+ return;
+
+ }
+
+ return $response;
+ }
+
+ function convert($amount, $float=2, $symbol=true) {
+
+ //easily convert amounts to geolocated currency.
+ if ( !is_numeric($this->currencyConverter) || $this->currencyConverter == 0 ) {
+ trigger_error('geoPlugin class Notice: currencyConverter has no value.', E_USER_NOTICE);
+ return $amount;
+ }
+ if ( !is_numeric($amount) ) {
+ trigger_error ('geoPlugin class Warning: The amount passed to geoPlugin::convert is not numeric.', E_USER_WARNING);
+ return $amount;
+ }
+ if ( $symbol === true ) {
+ return $this->currencySymbol . round( ($amount * $this->currencyConverter), $float );
+ } else {
+ return round( ($amount * $this->currencyConverter), $float );
+ }
+ }
+
+ function nearby($radius=10, $limit=null) {
+
+ if ( !is_numeric($this->latitude) || !is_numeric($this->longitude) ) {
+ trigger_error ('geoPlugin class Warning: Incorrect latitude or longitude values.', E_USER_NOTICE);
+ return array( array() );
+ }
+
+ $host = "http://www.geoplugin.net/extras/nearby.gp?lat=" . $this->latitude . "&long=" . $this->longitude . "&radius={$radius}";
+
+ if ( is_numeric($limit) )
+ $host .= "&limit={$limit}";
+
+ return unserialize( $this->fetch($host) );
+
+ }
+
+
+}
+
+?>
diff --git a/autoload/front/controls/class.Articles.php b/autoload/front/controls/class.Articles.php
new file mode 100644
index 0000000..c8b0c3c
--- /dev/null
+++ b/autoload/front/controls/class.Articles.php
@@ -0,0 +1,76 @@
+ 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 );
+ }
+}
diff --git a/autoload/front/controls/class.AuditSEO.php b/autoload/front/controls/class.AuditSEO.php
new file mode 100644
index 0000000..3893091
--- /dev/null
+++ b/autoload/front/controls/class.AuditSEO.php
@@ -0,0 +1,63 @@
+ '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;
+ }
+}
\ No newline at end of file
diff --git a/autoload/front/controls/class.Site.php b/autoload/front/controls/class.Site.php
new file mode 100644
index 0000000..f971187
--- /dev/null
+++ b/autoload/front/controls/class.Site.php
@@ -0,0 +1,122 @@
+ 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';
+ }
+}
+?>
diff --git a/autoload/front/factory/class.Articles.php b/autoload/front/factory/class.Articles.php
new file mode 100644
index 0000000..4d0abbc
--- /dev/null
+++ b/autoload/front/factory/class.Articles.php
@@ -0,0 +1,443 @@
+]*)>(.*?)<\/\1>/', $content, $matches, PREG_SET_ORDER);
+
+ $firstLevel = true;
+
+ foreach ($matches as $match) {
+ $level = intval(substr($match[1], 1));
+
+ while ($level < count($currentLevel)) {
+ $result .= '';
+ array_pop($currentLevel);
+ }
+
+ if ($level > count($currentLevel)) {
+ while ($level > count($currentLevel)) {
+ if (count($currentLevel) > 0 || $firstLevel) {
+ $result .= '
';
+ $firstLevel = false;
+ }
+ array_push($currentLevel, 0);
+ }
+ $result .= '';
+ } else {
+ $result .= ' ';
+ }
+
+ $currentLevel[count($currentLevel) - 1]++;
+
+ preg_match('/\sid="([^"]*)"/', $match[2], $idMatches);
+ $id = isset($idMatches[1]) ? $idMatches[1] : '';
+
+ $result .= sprintf(
+ '%s ',
+ urlencode(strtolower($id)),
+ $match[3]
+ );
+ }
+
+ while (!empty($currentLevel)) {
+ $result .= ' ';
+ array_pop($currentLevel);
+ }
+
+ if (substr($result, 0, 8) === '
') {
+ return substr($result, 4, -5);
+ } else {
+ return $result;
+ }
+ }
+
+ // 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( '%s ', $level, $attrs, $content, $level );
+ return $html;
+ }
+
+ static public function generateHeadersIds( $text )
+ {
+ $pattern = '/(.*?)<\/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/' );
+
+ $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 = 'Witaj, ';
+ $text .= 'Użytkownik zatwierdził listę wybranych przez siebie zdjęć. ';
+ $text .= 'Poniżej znajdziesz nazwy wybranych zdjęć.
';
+ $text .= '';
+ if ( is_array( $article['images'] ) ) foreach ( $article['images'] as $image )
+ if ( $image['favorite'] )
+ $text .= '' . basename( $image['src'] ) . ' ';
+ $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 )
+ {
+ global $mdb;
+
+ $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 ] ] );
+
+ \S::delete_dir( 'temp/' );
+ return !$status;
+ }
+ }
+
+ public static function article_password( $article_id )
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_articles', 'password', [ 'id' => $article_id ] );
+ }
+
+ public static function articles_by_tags( $tag_id, $lang_id )
+ {
+ global $mdb;
+
+ 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 );
+
+ \Cache::store( "articles_by_tags:$tag_id:$lang_id", $articles );
+ }
+
+ return $articles;
+ }
+
+ public static function tag_details( $tag_id )
+ {
+ global $mdb;
+
+ if ( !$tag = \Cache::fetch( "tag_details:$tag_id" ) )
+ {
+ $tag = $mdb -> get( 'pp_tags', '*', [ 'id' => (int)$tag_id ] );
+
+ \Cache::store( "tag_details:$tag_id", $tag );
+ }
+ return $tag;
+ }
+
+ public static function tags()
+ {
+ global $mdb;
+
+ 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();
+
+ \Cache::store( 'tags', $tags );
+ }
+ return $tags;
+ }
+
+ public static function articles_by_date( $month, $year, $lang_id )
+ {
+ global $mdb;
+
+ 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 );
+
+ \Cache::store( "articles_by_date:$month:$year:$lang_id", $articles );
+ }
+
+ return $articles;
+ }
+
+ public static function news( $page_id, $limit = 6, $lang_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 );
+
+ return $articles;
+ }
+
+ public static function get_image( $article, $skip_entry = false )
+ {
+ 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 )
+ {
+ $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 )
+ {
+ $src = $img -> getAttribute( 'src' );
+ if ( file_exists( substr( $src, 1, strlen( $src ) ) ) )
+ return $src;
+ }
+
+ if ( $article['images'] )
+ return $article['images'][0]['src'];
+
+ return false;
+ }
+
+ public static function article_noindex( $article_id )
+ {
+ global $mdb, $lang;
+
+ 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] ] ] );
+
+ \Cache::store( "article_noindex:$article_id:" . $lang[0], $noindex );
+ }
+ return $noindex;
+ }
+
+ 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'] );
+
+ if ( $bs < 1 )
+ $bs = 1;
+ else if ( $bs > $ls )
+ $bs = $ls;
+
+ $from = $page['articles_limit'] * ( $bs - 1 );
+
+ 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['ls'] = $ls;
+
+ return $results;
+ }
+
+ public static function article_details( $article_id, $lang_id )
+ {
+ global $mdb;
+
+ if ( !$article = \Cache::fetch( "article_details:$lang_id:$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 )
+ {
+ 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 )
+ $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 )
+ {
+ $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 )
+ {
+ $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 )
+ {
+ if ( !$row['language_id'] )
+ $params[ $row['name'] ] = $row['value'];
+ else
+ $params[ $row['name'] ][$row['language_id']] = $row['value'];
+ }
+ $article['params'] = $params;
+
+ \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 )
+ {
+ global $mdb;
+
+ 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;
+ }
+
+ 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 )
+ $output[] = $row['id'];
+
+ \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 )
+ {
+ global $mdb;
+
+ 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();
+ $output = $results[0][0];
+ \Cache::store( "page_articles_count:$page_id:$lang_id", $output );
+ }
+ return $output;
+ }
+}
\ No newline at end of file
diff --git a/autoload/front/factory/class.AuditSEO.php b/autoload/front/factory/class.AuditSEO.php
new file mode 100644
index 0000000..7faa805
--- /dev/null
+++ b/autoload/front/factory/class.AuditSEO.php
@@ -0,0 +1,765 @@
+';
+ public static $bad_img = ' ';
+
+ public static function robots_allowed( $robots_txt, $useragent )
+ {
+ $agents = array( preg_quote( '*' ) );
+ if ( $useragent) $agents[] = preg_quote( $useragent );
+ $agents = implode( '|', $agents );
+
+ $robotstxt = @file( $robots_txt );
+ if ( empty( $robotstxt ) )
+ return true;
+
+ $rules = array();
+ $ruleApplies = false;
+ foreach ( $robotstxt as $line )
+ {
+ if ( !$line = trim( $line ) )
+ continue;
+
+ if ( preg_match('/^\s*User-agent: (.*)/i', $line, $match ) )
+ $ruleApplies = preg_match( "/($agents)/i", $match[1] );
+
+ if ( $ruleApplies && preg_match( '/^\s*Disallow:(.*)/i', $line, $regs ) )
+ {
+ if ( !$regs[1] )
+ return true;
+
+ $rules[] = preg_quote( trim( $regs[1] ), '/' );
+ }
+ }
+
+ foreach ( $rules as $rule )
+ {
+ if ( preg_match( "/^$rule/", $parsed['path'] ) )
+ return false;
+ }
+
+ return true;
+ }
+
+ public static function is_url_internal( $domain, $url )
+ {
+ $domain_host = parse_url( $domain, PHP_URL_HOST );
+ $url_host = parse_url( $url, PHP_URL_HOST );
+
+ if ( $domain_host == $url_host or empty( $url_host ) )
+ {
+ if ( $url != '/' and $url != '#' and strpos( $url, 'mailto:' ) === false and $url != '' and strpos( $url, 'tel:' ) === false )
+ return true;
+ }
+
+ return false;
+ }
+
+ public static function is_url_external( $domain, $url )
+ {
+ $domain_host = str_replace( 'www.', '', parse_url( $domain, PHP_URL_HOST ) );
+ $url_host = str_replace( 'www.', '', parse_url( $url, PHP_URL_HOST ) );
+
+ if ( $domain_host != $url_host and !empty( $url_host ) and !empty( $domain_host ) )
+ {
+ if ( $url != '/' and $url != '#' and strpos( $url, 'mailto:' ) === false and $url != '' and strpos( $url, 'tel:' ) === false )
+ return true;
+ }
+
+ return false;
+ }
+
+ public static function semstorm( $url )
+ {
+ if ( !$url )
+ return false;
+
+ $data = [ 'domains' => [ $url ] ];
+ $data_string = json_encode( $data );
+
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, 'http://api.semstorm.com/api-v3/explorer/explorer-keywords/position-distribution.json?services_token=ay_oMCvqro2DuTbG5EMayLUTYitOJC_Lf40gq2Rj_zE' );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_POST, true );
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+ 'Content-Type: application/json',
+ 'Content-Length: ' . strlen( $data_string ) )
+ );
+ $response = curl_exec( $ch );
+ curl_close ( $ch );
+
+ echo $response;
+ exit;
+ }
+
+ public static function data08( $url )
+ {
+ global $mdb;
+
+ $data08['top3']['txt'] = 0;
+ $data08['top10']['txt'] = 0;
+ $data08['top50']['txt'] = 0;
+ $results = $mdb -> get( 'as_sites', [ 'semstorm' ], [ 'url' => $url ] );
+
+ if ( !$results['semstorm'] )
+ {
+ if ( strpos( $url, 'www.' ) === 0 )
+ $url = str_replace( 'www.', '', $url );
+
+ $data = [ 'domains' => [ $url ] ];
+ $data_string = json_encode( $data );
+
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, 'http://api.semstorm.com/api-v3/explorer/explorer-keywords/position-distribution.json?services_token=ay_oMCvqro2DuTbG5EMayLUTYitOJC_Lf40gq2Rj_zE' );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_POST, true );
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string );
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+ 'Content-Type: application/json',
+ 'Content-Length: ' . strlen( $data_string ) )
+ );
+ $response = curl_exec( $ch );
+ curl_close ( $ch );
+ $mdb -> update( 'as_sites', [ 'semstorm' => $response ], [ 'url' => $url ] );
+
+ $results['semstorm'] = $response;
+ }
+
+ $data_tmp = json_decode( $results['semstorm'], true );
+
+ foreach ( $data_tmp['results'][$url] as $key => $val )
+ {
+ if ( $key <= 3 )
+ $data08['top3']['txt'] += $val;
+
+ if ( $key > 3 and $key <= 10 )
+ $data08['top10']['txt'] += $val;
+
+ if ( $key > 10 )
+ $data08['top50']['txt'] += $val;
+ }
+
+ return $data08;
+ }
+
+ public static function data07( $url )
+ {
+ global $mdb;
+
+ $results = $mdb -> get( 'as_sites', [ 'html', 'effective_url' ], [ 'url' => $url ] );
+
+ $data07['audit_links_inside']['count'] = 0;
+ $data07['audit_links_outside']['count'] = 0;
+
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $results['html'] );
+ $links = @$dom -> getElementsByTagName( 'a' );
+
+ for ( $i = 0; $i < $links -> length; $i++ )
+ {
+ $link = $links -> item( $i );
+ $url_tmp = $link -> getAttribute( 'href' );
+
+ if ( self::is_url_internal( $results['effective_url'], $url_tmp ) )
+ {
+ $data07['audit_links_inside']['count']++;
+ $links_internal[] = $url_tmp;
+ }
+
+ if ( self::is_url_external( $results['effective_url'], $url_tmp ) )
+ {
+ $data07['audit_links_outside']['count']++;
+ $links_external[] = $url_tmp;
+ }
+ }
+ $data07['audit_links_inside']['txt'] = implode( ' ', $links_internal );
+ $data07['audit_links_outside']['txt'] = implode( ' ', $links_external );
+
+ return $data07;
+ }
+
+ public static function data06( $url )
+ {
+ global $mdb;
+
+ $results = $mdb -> get( 'as_sites', [ 'effective_url', 'html', 'flash', 'iframe', 'file_robots_txt', 'file_sitemap_xml', 'inline_css', 'doctype', 'html_language', 'w3c' ], [ 'url' => $url ] );
+
+ $data06['flash']['txt'] = $results['flash'] ? 'tak' : 'nie';
+ $data06['iframe']['txt'] = $results['iframe'] ? 'tak' : 'nie';
+ $data06['file_robots_txt']['txt'] = $results['file_robots_txt'] ? 'tak' : 'nie';
+ $data06['file_sitemap_xml']['txt'] = $results['file_sitemap_xml'] ? 'tak' : 'nie';
+ $data06['imgs_without_alt']['txt'] = implode( ' ', self::imgs_without_alt( $results['html'] ) );
+ $data06['inline_css']['txt'] = $results['inline_css'] ? 'tak' : 'nie';
+ $data06['doctype']['txt'] = $results['doctype'];
+ $data06['html_language']['txt'] = $results['html_language'];
+
+ if ( !$results['w3c'] )
+ {
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, 'https://validator.w3.org/nu/?doc=' . urlencode( $results['effective_url'] ) . '%2F&out=json' );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, true );
+ curl_setopt( $ch, CURLOPT_CAINFO, 'cacert.pem' );
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.103 Safari/537.36' );
+ $response = curl_exec( $ch );
+ curl_close ( $ch );
+
+ $mdb -> update( 'as_sites', [ 'w3c' => $response ], [ 'url' => $url ] );
+
+ $w3c = json_decode( $response, true );
+ }
+ else
+ {
+ $w3c = json_decode( $results['w3c'], true );
+ }
+
+ $data06['w3c_validator']['txt'] = 0;
+
+ foreach ( $w3c['messages'] as $message ) {
+ if ( $message['type'] == 'error' )
+ $data06['w3c_validator']['txt']++;
+ }
+
+ return $data06;
+ }
+
+ public static function data05( $url )
+ {
+ global $mdb;
+
+ $results = $mdb -> get( 'as_sites', [
+ 'effective_url',
+ 'page_speed_insight_mobile'
+ ], [
+ 'url' => $url
+ ] );
+
+ if ( !$results['page_speed_insight_mobile'] )
+ {
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=' . $results['effective_url'] . '&category=performance&strategy=mobile' );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, true );
+ curl_setopt( $ch, CURLOPT_CAINFO, 'cacert.pem' );
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.103 Safari/537.36' );
+ $response = curl_exec( $ch );
+ curl_close ( $ch );
+
+ $mdb -> update( 'as_sites', [ 'page_speed_insight_mobile' => $response ], [ 'url' => $url ] );
+
+ $page_speed_insight_mobile = json_decode( $response, true );
+ }
+ else
+ {
+ $page_speed_insight_mobile = json_decode( $results['page_speed_insight_mobile'], true );
+ }
+
+ $data05['psid']['txt'] = ( $page_speed_insight_mobile['lighthouseResult']['categories']['performance']['score'] * 100 ) . '/100';
+ $data05['psid']['score'] = $page_speed_insight_mobile['lighthouseResult']['categories']['performance']['score'] * 100;
+
+ return $data05;
+ }
+
+ public static function data04( $url )
+ {
+ global $mdb;
+
+ $results = $mdb -> get( 'as_sites', [
+ 'effective_url',
+ 'page_speed_insight_desktop'
+ ], [
+ 'url' => $url
+ ] );
+
+ if ( !$results['page_speed_insight_desktop'] )
+ {
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=' . $results['effective_url'] . '&category=performance&strategy=desktop' );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, true );
+ curl_setopt( $ch, CURLOPT_CAINFO, 'cacert.pem' );
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.103 Safari/537.36' );
+ $response = curl_exec( $ch );
+ curl_close ( $ch );
+
+ $mdb -> update( 'as_sites', [ 'page_speed_insight_desktop' => $response ], [ 'url' => $url ] );
+
+ $page_speed_insight_desktop = json_decode( $response, true );
+ }
+ else
+ {
+ $page_speed_insight_desktop = json_decode( $results['page_speed_insight_desktop'], true );
+ }
+
+ $data04['psid']['txt'] = ( $page_speed_insight_desktop['lighthouseResult']['categories']['performance']['score'] * 100 ) . '/100';
+ $data04['psid']['score'] = $page_speed_insight_desktop['lighthouseResult']['categories']['performance']['score'] * 100;
+ $data04['site_size']['txt'] = round( $page_speed_insight_desktop['lighthouseResult']['audits']['total-byte-weight']['numericValue'] / 1024 ) . ' KB';
+ $data04['site_http']['txt'] = $page_speed_insight_desktop['lighthouseResult']['audits']['network-requests']['numericValue'];
+
+ return $data04;
+ }
+
+ public static function data03( $url )
+ {
+ global $mdb;
+
+ $results = $mdb -> get( 'as_sites', [ 'meta_title', 'meta_description', 'meta_keywords', 'code_length', 'text_length', 'words_count',
+ 'h1_count', 'h2_count', 'h3_count', 'h4_count', 'h5_count', 'h6_count'
+ ], [
+ 'url' => $url
+ ] );
+
+ $data03['meta_title']['txt'] = $results['meta_title'];
+ $data03['meta_title']['signs'] = strlen( $results['meta_title'] );
+ $data03['meta_description']['txt'] = $results['meta_description'];
+ $data03['meta_description']['signs'] = strlen( $results['meta_description'] );
+ $data03['meta_keywords']['txt'] = $results['meta_keywords'] != '' ? $results['meta_keywords'] : 'brak';
+ $data03['code_to_text_ratio']['txt'] = round( ( $results['text_length'] / ( $results['text_length'] + $results['code_length'] ) * 100 ), 0 );
+ $data03['words_count']['txt'] = $results['words_count'];
+ $data03['headers']['h1_count']['txt'] = $results['h1_count'];
+ $data03['headers']['h2_count']['txt'] = $results['h2_count'];
+ $data03['headers']['h3_count']['txt'] = $results['h3_count'];
+ $data03['headers']['h4_count']['txt'] = $results['h4_count'];
+ $data03['headers']['h5_count']['txt'] = $results['h5_count'];
+ $data03['headers']['h6_count']['txt'] = $results['h6_count'];
+
+ return $data03;
+ }
+
+ public static function data02( $url )
+ {
+ global $mdb;
+
+ $results = $mdb -> get( 'as_sites', [ 'meta_robots', 'robots_txt', 'redirect_www', 'https' ], [ 'url' => $url ] );
+
+ $data02['meta_robots']['txt'] = strpos( $results['meta_robots'], 'index' ) !== false ? 'tak' : 'nie';
+ $data02['meta_robots']['img'] = strpos( $results['meta_robots'], 'index' ) !== false ? self::$good_img : self::$bad_img;
+
+ $robots_txt = self::robots_allowed( $data02['robots_txt'], 'GoogleBot' );
+ $data02['robots_txt']['txt'] = $robots_txt ? 'tak' : 'nie';
+ $data02['robots_txt']['img'] = $robots_txt ? self::$good_img : self::$bad_img;
+
+ $data02['redirect_www']['txt'] = $results['redirect_www'] ? 'tak' : 'nie';
+ $data02['redirect_www']['img'] = $results['redirect_www'] ? self::$good_img : self::$bad_img;
+
+ $data02['https']['txt'] = $results['https'] ? 'tak' : 'nie';
+ $data02['https']['img'] = $results['https'] ? self::$good_img : self::$bad_img;
+
+ return $data02;
+ }
+
+ public static function data01( $url )
+ {
+ global $mdb;
+
+ $data01 = $mdb -> get( 'as_sites', [
+ 'effective_url',
+ 'ip',
+ 'location',
+ 'favicon',
+ 'cms'
+ ], [
+ 'url' => $url
+ ] );
+
+ $url_tmp = parse_url( $data01['effective_url'] );
+
+ $location = json_decode( $data01['location'] );
+ $data01['domain']['txt'] = $url_tmp['host'];
+ $data01['location'] = $location -> country;
+ $data01['favicon'] = $data01['favicon'] != null ? 'tak' : 'nie';
+ $data01['cms'] = $data01['cms'] != null ? $data01['cms'] : 'nieznany';
+
+ return $data01;
+ }
+
+ public static function imgs_without_alt( $html )
+ {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $images = $dom -> getElementsByTagName( 'img' );
+ $cms = '';
+
+ for ( $i = 0; $i < $images -> length; $i++ )
+ {
+ $img = $images -> item( $i );
+ if ( $img -> getAttribute( 'alt' ) == '' )
+ $imgs_output[] = $img -> getAttribute( 'src' );
+ }
+ return $imgs_output;
+ }
+
+ public static function cms( $html )
+ {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $metas = $dom -> getElementsByTagName( 'meta' );
+ $cms = '';
+
+ for ( $i = 0; $i < $metas -> length; $i++ )
+ {
+ $meta = $metas -> item( $i );
+ if ( $meta -> getAttribute( 'name' ) == 'generator' )
+ $cms = $meta -> getAttribute( 'content' );
+ }
+ return $cms;
+ }
+
+ public static function meta_title( $html )
+ {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $metas = $dom -> getElementsByTagName( 'title' );
+ $meta_title = '';
+
+ $meta = $metas -> item( 0 );
+ $meta_title = $meta -> textContent;
+
+ return $meta_title;
+ }
+
+ public static function meta_description( $html )
+ {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $metas = $dom -> getElementsByTagName( 'meta' );
+ $meta_description = '';
+
+ for ( $i = 0; $i < $metas -> length; $i++ )
+ {
+ $meta = $metas -> item( $i );
+ if ( $meta -> getAttribute( 'name' ) == 'description' )
+ $meta_description = $meta -> getAttribute( 'content' );
+ }
+ return $meta_description;
+ }
+
+ public static function meta_keywords( $html )
+ {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $metas = $dom -> getElementsByTagName( 'meta' );
+ $meta_keywords = '';
+
+ for ( $i = 0; $i < $metas -> length; $i++ )
+ {
+ $meta = $metas -> item( $i );
+ if ( $meta -> getAttribute( 'name' ) == 'keywords' )
+ $meta_keywords = $meta -> getAttribute( 'content' );
+ }
+ return $meta_keywords;
+ }
+
+ public static function meta_robots( $html )
+ {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $metas = $dom -> getElementsByTagName( 'meta' );
+ $meta_robots = '';
+
+ for ( $i = 0; $i < $metas -> length; $i++ )
+ {
+ $meta = $metas -> item( $i );
+ if ( $meta -> getAttribute( 'name' ) == 'robots' || $meta -> getAttribute( 'name' ) == 'googlebot' )
+ $meta_robots = $meta -> getAttribute( 'content' );
+ }
+ return $meta_robots;
+ }
+
+ public static function header_count( $html, $header = 'h1' )
+ {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $headers = $dom -> getElementsByTagName( $header );
+ return $headers -> length;
+ }
+
+ public static function favicon( $html )
+ {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $links = $dom -> getElementsByTagName( 'link' );
+ $favicon = '';
+
+ for ( $i = 0; $i < $links -> length; $i++ )
+ {
+ $link = $links -> item( $i );
+ if ( $link -> getAttribute( 'rel' ) == 'icon' || $link -> getAttribute( 'rel' ) == "Shortcut Icon" || $link -> getAttribute( 'rel' ) == "shortcut icon" )
+ $favicon = $link -> getAttribute( 'href' );
+ }
+ return $favicon;
+ }
+
+ public static function flash_check( $html )
+ {
+ if ( strpos( $html, 'Get Adobe Flash player' ) !== false )
+ return true;
+ return false;
+ }
+
+ public static function iframe_check( $html )
+ {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $iframes = $dom -> getElementsByTagName( 'iframe' );
+ if ( $iframes -> length )
+ return true;
+ return false;
+ }
+
+ public static function doctype( $html ) {
+ if ( strpos( $html, 'HTML 4.01 Frameset//EN' ) !== false )
+ return 'HTML 4.01 Frameset';
+ elseif ( strpos( $html, 'HTML 4.01 Transitional//EN' ) !== false )
+ return 'HTML 4.01 Transitional';
+ elseif ( strpos( $html, 'HTML 4.01//EN' ) !== false )
+ return 'HTML 4.01 Strict';
+ else
+ return 'HTML 5';
+ }
+
+ public static function html_language( $html ) {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $htmls = $dom -> getElementsByTagName( 'html' );
+
+ for ( $i = 0; $i < $htmls -> length; $i++ ) {
+ $html = $htmls -> item( $i );
+ return $html -> getAttribute( 'lang' );
+ }
+ return false;
+ }
+
+ public static function inline_css( $html ) {
+ $dom = new \DOMDocument();
+ @$dom -> loadHTML( $html );
+ $spans = $dom -> getElementsByTagName( 'span' );
+ for ( $i = 0; $i < $spans -> length; $i++ ) {
+ $span = $spans -> item( $i );
+ if ( $span -> getAttribute( 'style' ) != '' )
+ return true;
+ }
+
+ $ps = $dom -> getElementsByTagName( 'p' );
+ for ( $i = 0; $i < $ps -> length; $i++ ) {
+ $p = $ps -> item( $i );
+ if ( $p -> getAttribute( 'style' ) != '' )
+ return true;
+ }
+
+ $divs = $dom -> getElementsByTagName( 'div' );
+ for ( $i = 0; $i < $divs -> length; $i++ ) {
+ $div = $divs -> item( $i );
+ if ( $div -> getAttribute( 'style' ) != '' )
+ return true;
+ }
+
+ return false;
+ }
+
+ public static function audit( $url )
+ {
+ global $mdb;
+
+ if ( !$url )
+ return false;
+
+ if ( strpos( $url, 'http://' ) === false and strpos( $url, 'https://' ) === false )
+ $url = 'http://' . $url;
+
+ $url_tmp = parse_url( $url );
+ $url = strip_tags( $url_tmp['host'] ) . $url_tmp['path'];
+ if ( substr( $url, -1, 1 ) == '/')
+ $url = substr( $url, 0, -1 );
+
+ if ( $mdb -> count( 'as_sites', [ 'url' => $url ] ) )
+ return $url;
+ else
+ {
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, $url );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, true );
+ curl_setopt( $ch, CURLOPT_CAINFO, 'cacert.pem' );
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.103 Safari/537.36' );
+ $response = curl_exec( $ch );
+
+ $effective_url = curl_getinfo( $ch, CURLINFO_EFFECTIVE_URL );
+ $ip = curl_getinfo( $ch, CURLINFO_PRIMARY_IP );
+ $location = file_get_contents( "http://ipinfo.io/{$ip}/json" );
+ $favicon = self::favicon( $response );
+ $cms = self::cms( $response );
+ $meta_robots = self::meta_robots( $response );
+ $meta_title = self::meta_title( $response );
+ $meta_description = self::meta_description( $response );
+ $meta_keywords = self::meta_keywords( $response );
+ $h1_count = self::header_count( $response, 'h1' );
+ $h2_count = self::header_count( $response, 'h2' );
+ $h3_count = self::header_count( $response, 'h3' );
+ $h4_count = self::header_count( $response, 'h4' );
+ $h5_count = self::header_count( $response, 'h5' );
+ $h6_count = self::header_count( $response, 'h6' );
+ $flash = self::flash_check( $response );
+ $iframe = self::iframe_check( $response );
+ $inline_css = self::inline_css( $response );
+ $doctype = self::doctype( $response );
+ $html_language = self::html_language( $response );
+
+ $html_length = strlen( $response );
+ $text_length = strlen( strip_tags( $response ) );
+ $code_length = $html_length - $text_length;
+
+ $words_count = str_word_count( strip_tags( $response ) );
+
+ curl_close ( $ch );
+
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, $effective_url . '/robots.txt' );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, true );
+ curl_setopt( $ch, CURLOPT_CAINFO, 'cacert.pem' );
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.103 Safari/537.36' );
+ $robots_txt = curl_exec( $ch );
+
+ if ( curl_getinfo( $ch, CURLINFO_HTTP_CODE ) == 200 )
+ $file_robots_txt = 1;
+ else
+ $file_robots_txt = 0;
+
+ curl_close ( $ch );
+
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, $effective_url . '/sitemap.xml' );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, true );
+ curl_setopt( $ch, CURLOPT_CAINFO, 'cacert.pem' );
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.103 Safari/537.36' );
+ $sitemap_xml = curl_exec( $ch );
+
+ if ( curl_getinfo( $ch, CURLINFO_HTTP_CODE ) == 200 )
+ $file_sitemap_xml = 1;
+ else
+ $file_sitemap_xml = 0;
+
+ curl_close ( $ch );
+
+ $url_parse = parse_url( $effective_url );
+ $redirect_www = false;
+
+ if ( strpos( $effective_url, $url_parse['scheme'] . '://www.' ) !== false )
+ {
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, str_replace( $url_parse['scheme'] . '://www.', $url_parse['scheme'] . '://', $effective_url ) );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, true );
+ curl_setopt( $ch, CURLOPT_CAINFO, 'cacert.pem' );
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.103 Safari/537.36' );
+ curl_exec( $ch );
+ $effective_url_tmp = curl_getinfo( $ch, CURLINFO_EFFECTIVE_URL );
+ curl_close ( $ch );
+
+ if ( $effective_url_tmp == $effective_url )
+ $redirect_www = true;
+ }
+ else
+ {
+ $ch = curl_init();
+ curl_setopt( $ch, CURLOPT_URL, str_replace( $url_parse['scheme'] . '://', $url_parse['scheme'] . '://www.', $effective_url ) );
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+ curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 60 );
+ curl_setopt( $ch, CURLOPT_HEADER, true );
+ curl_setopt( $ch, CURLOPT_CAINFO, 'cacert.pem' );
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
+ curl_setopt( $ch, CURLOPT_HEADER, false );
+ curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.103 Safari/537.36' );
+ curl_exec( $ch );
+ $effective_url_tmp = curl_getinfo( $ch, CURLINFO_EFFECTIVE_URL );
+ curl_close ( $ch );
+
+ if ( $effective_url_tmp == $effective_url )
+ $redirect_www = true;
+ }
+
+ $mdb -> insert( 'as_sites', [
+ 'url' => $url,
+ 'html' => $response,
+ 'effective_url' => $effective_url,
+ 'ip' => $ip,
+ 'location' => $location,
+ 'favicon' => $favicon,
+ 'cms' => $cms,
+ 'meta_robots' => $meta_robots,
+ 'robots_txt' => $robots_txt,
+ 'redirect_www' => $redirect_www ? 1 : 0,
+ 'https' => $url_parse['scheme'] == 'https' ? 1 : 0,
+ 'meta_title' => $meta_title,
+ 'meta_description' => $meta_description,
+ 'meta_keywords' => $meta_keywords,
+ 'code_length' => $code_length,
+ 'text_length' => $text_length,
+ 'words_count' => $words_count,
+ 'h1_count' => $h1_count,
+ 'h2_count' => $h2_count,
+ 'h3_count' => $h3_count,
+ 'h4_count' => $h4_count,
+ 'h5_count' => $h5_count,
+ 'h6_count' => $h6_count,
+ 'flash' => $flash ? 1 : 0,
+ 'iframe' => $iframe ? 1 : 0,
+ 'file_robots_txt' => $file_robots_txt,
+ 'file_sitemap_xml' => $file_sitemap_xml,
+ 'inline_css' => $inline_css,
+ 'doctype' => $doctype,
+ 'html_language' => $html_language
+ ] );
+
+ return $url;
+ }
+ }
+}
\ No newline at end of file
diff --git a/autoload/front/factory/class.Authors.php b/autoload/front/factory/class.Authors.php
new file mode 100644
index 0000000..a021624
--- /dev/null
+++ b/autoload/front/factory/class.Authors.php
@@ -0,0 +1,22 @@
+
+namespace front\factory;
+class Authors
+{
+ // szczególy autora
+ static public function get_single_author( $id_author )
+ {
+ global $mdb;
+
+ if ( !$author = \Cache::fetch( "get_single_author:$id_author" ) )
+ {
+ $author = $mdb -> get( 'pp_authors', '*', [ 'id' => (int)$id_author ] );
+
+ $results = $mdb -> select( 'pp_authors_langs', '*', [ 'id_author' => (int)$id_author ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ $author['languages'][$row['id_lang']] = $row;
+
+ \Cache::store( "get_single_author:$id_author", $author );
+ }
+ return $author;
+ }
+}
\ No newline at end of file
diff --git a/autoload/front/factory/class.Banners.php b/autoload/front/factory/class.Banners.php
new file mode 100644
index 0000000..568a0f2
--- /dev/null
+++ b/autoload/front/factory/class.Banners.php
@@ -0,0 +1,63 @@
+ query( 'SELECT '
+ . 'id, name '
+ . 'FROM '
+ . 'pp_banners '
+ . 'WHERE '
+ . 'status = 1 '
+ . 'AND '
+ . '( date_start <= \'' . date( 'Y-m-d' ) . '\' OR date_start IS NULL ) '
+ . 'AND '
+ . '( date_end >= \'' . date( 'Y-m-d' ) . '\' OR date_end IS NULL ) '
+ . 'AND '
+ . 'home_page = 0' ) -> fetchAll();
+ if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
+ {
+ $row['languages'] = $mdb -> get( 'pp_banners_langs', '*', [ 'AND' => [ 'id_banner' => (int)$row['id'], 'id_lang' => $lang[0] ] ] );
+ $banners[] = $row;
+ }
+ \Cache::store( 'banners', $banners );
+ }
+ return $banners;
+ }
+
+ public static function main_banner()
+ {
+ global $mdb, $lang;
+
+ if ( !$banner = \Cache::fetch( "main_banner:" . $lang[0] ) )
+ {
+ $banner = $mdb -> query( 'SELECT '
+ . '* '
+ . 'FROM '
+ . 'pp_banners '
+ . 'WHERE '
+ . 'status = 1 '
+ . 'AND '
+ . '( date_start <= \'' . date( 'Y-m-d' ) . '\' OR date_start IS NULL ) '
+ . 'AND '
+ . '( date_end >= \'' . date( 'Y-m-d' ) . '\' OR date_end IS NULL ) '
+ . 'AND '
+ . 'home_page = 1 '
+ . 'ORDER BY '
+ . 'date_end ASC '
+ . 'LIMIT 1' ) -> fetchAll();
+ $banner = $banner[0];
+ if ( $banner )
+ $banner['languages'] = $mdb -> get( 'pp_banners_langs', '*', [ 'AND' => [ 'id_banner' => (int)$banner['id'], 'id_lang' => $lang[0] ] ] );
+
+ \Cache::store( "main_banner:" . $lang[0], $banner );
+ }
+ return $banner;
+ }
+}
\ No newline at end of file
diff --git a/autoload/front/factory/class.Languages.php b/autoload/front/factory/class.Languages.php
new file mode 100644
index 0000000..5ed6351
--- /dev/null
+++ b/autoload/front/factory/class.Languages.php
@@ -0,0 +1,58 @@
+ query( 'SELECT domain FROM pp_langs WHERE status = 1 AND domain IS NOT NULL AND main_domain = 1' ) -> fetchAll();
+ return $default_domain = $results[0][0];
+ }
+
+ public static function default_language( $domain = '' )
+ {
+ global $mdb;
+ if ( !$default_language = \Cache::fetch( "default_language:$domain" ) )
+ {
+ if ( $domain )
+ $results = $mdb -> query( 'SELECT id FROM pp_langs WHERE status = 1 AND domain = \'' . $domain . '\' ORDER BY start DESC, o ASC LIMIT 1' ) -> fetchAll();
+ if ( !$domain or !\front\factory\Languages::default_domain() )
+ $results = $mdb -> query( 'SELECT id FROM pp_langs WHERE status = 1 AND domain IS NULL ORDER BY start DESC, o ASC LIMIT 1' ) -> fetchAll();
+ $default_language = $results[0][0];
+
+ \Cache::store( "default_language:$domain", $default_language );
+ }
+ return $default_language;
+ }
+
+ public static function active_languages()
+ {
+ global $mdb;
+
+ if ( !$active_languages = \Cache::fetch( 'active_languages' ) )
+ {
+ $active_languages = $mdb -> select( 'pp_langs', [ 'id', 'name', 'domain' ], [ 'status' => 1, 'ORDER' => [ 'o' => 'ASC' ] ] );
+ \Cache::store( 'active_languages', $active_languages );
+ }
+ return $active_languages;
+ }
+
+ public static function lang_translations( $language = 'pl' )
+ {
+ global $mdb;
+
+ if ( !$translations = \Cache::fetch( "lang_translations:$language" ) )
+ {
+ $translations[ '0' ] = $language;
+
+ $results = $mdb -> select( 'pp_langs_translations', [ 'text', $language ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ $translations[ $row['text'] ] = $row[ $language ];
+
+ \Cache::store( "lang_translations:$language", $translations );
+ }
+
+ return $translations;
+ }
+}
diff --git a/autoload/front/factory/class.Layouts.php b/autoload/front/factory/class.Layouts.php
new file mode 100644
index 0000000..54fa2be
--- /dev/null
+++ b/autoload/front/factory/class.Layouts.php
@@ -0,0 +1,53 @@
+ get( 'pp_layouts', '*', [ 'id' => (int)$layout_id ] );
+
+ if ( !$layout )
+ $layout = $mdb -> get( 'pp_layouts', '*', [ 'status' => 1 ] );
+
+ \Cache::store( "layout_details:$layout_id", $layout );
+ }
+ return $layout;
+ }
+
+ public static function article_layout( $article_id )
+ {
+ global $mdb, $cache;
+
+ if ( !$layout = \Cache::fetch( "article_layout:$article_id" ) )
+ {
+ $layout = $mdb -> get( 'pp_layouts', [ '[><]pp_articles' => [ 'id' => 'layout_id' ] ], '*', [ 'pp_articles.id' => (int)$article_id ] );
+
+ if ( !$layout )
+ $layout = $mdb -> get( 'pp_layouts', '*', [ 'status' => 1 ] );
+
+ \Cache::store( "article_layout:$article_id", $layout );
+ }
+ return $layout;
+ }
+
+ public static function active_layout( $page_id )
+ {
+ global $mdb, $cache;
+
+ if ( !$layout = \Cache::fetch( "active_layouts:$page_id" ) )
+ {
+ $layout = $mdb -> get( 'pp_layouts', [ '[><]pp_layouts_pages' => [ 'id' => 'layout_id' ] ], '*', [ 'page_id' => (int)$page_id ] );
+
+ if ( !$layout )
+ $layout = $mdb -> get( 'pp_layouts', '*', [ 'status' => 1 ] );
+
+ \Cache::store( "active_layouts:$page_id", $layout );
+ }
+ return $layout;
+ }
+}
diff --git a/autoload/front/factory/class.Menu.php b/autoload/front/factory/class.Menu.php
new file mode 100644
index 0000000..76e09a1
--- /dev/null
+++ b/autoload/front/factory/class.Menu.php
@@ -0,0 +1,64 @@
+ 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'], $lang_id );
+
+ $pages[] = $page;
+ }
+
+ \Cache::store( "subpages:$page_id", $pages );
+ }
+ return $pages;
+ }
+
+ public static function menu_details( $menu_id )
+ {
+ global $mdb, $lang_id;
+
+ if ( !$menu = \Cache::fetch( "menu_details:$menu_id:$lang_id" ) )
+ {
+ $menu = $mdb -> get( 'pp_menus', '*', [ 'id' => (int)$menu_id ] );
+ $menu['pages'] = self::menu_pages( $menu_id );
+
+ \Cache::store( "menu_details:$menu_id:$lang_id", $menu );
+ }
+ return $menu;
+ }
+
+ public static function menu_pages( $menu_id, $parent_id = null )
+ {
+ global $mdb, $lang_id;
+
+ if ( !$pages = \Cache::fetch( "menu_pages:$menu_id:$parent_id:$lang_id" ) )
+ {
+ $results = $mdb -> select( 'pp_pages', [ 'id' ], [ 'AND' => [ 'status' => 1, 'menu_id' => (int)$menu_id, 'parent_id' => $parent_id ], 'ORDER' => [ 'o' => 'ASC' ] ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ {
+ $page = \front\factory\Pages::page_details( $row['id'] );
+ $page['pages'] = self::menu_pages( $menu_id, $row['id'] );
+
+ $pages[] = $page;
+ }
+
+ \Cache::store( "menu_pages:$menu_id:$parent_id:$lang_id", $pages );
+ }
+ return $pages;
+ }
+}
diff --git a/autoload/front/factory/class.Newsletter.php b/autoload/front/factory/class.Newsletter.php
new file mode 100644
index 0000000..6fa4cfc
--- /dev/null
+++ b/autoload/front/factory/class.Newsletter.php
@@ -0,0 +1,118 @@
+ update( 'pp_newsletter', [ 'status' => 0 ], [ 'hash' => $hash ] );
+ }
+
+ public static function newsletter_confirm( $hash )
+ {
+ global $mdb;
+ if ( !$id = $mdb -> get( 'pp_newsletter', 'id', [ 'AND' => [ 'hash' => $hash, 'status' => 0 ] ] ) )
+ return false;
+ else
+ $mdb -> update( 'pp_newsletter', [ 'status' => 1 ], [ 'id' => $id ] );
+ return true;
+ }
+
+ public static function newsletter_send( $limit = 5 )
+ {
+ global $mdb, $settings, $lang;
+
+ $results = $mdb -> query( 'SELECT * FROM pp_newsletter_send WHERE mailed = 0 ORDER BY id ASC LIMIT ' . $limit ) -> fetchAll();
+ if ( is_array( $results ) and !empty( $results ) )
+ {
+ foreach ( $results as $row )
+ {
+ $dates = explode( ' - ', $row['dates'] );
+
+ $text = \admin\view\Newsletter::preview(
+ \admin\factory\Articles::articles_by_date_add( $dates[0], $dates[1] ),
+ \admin\factory\Settings::settings_details(),
+ \admin\factory\Newsletter::email_template_detalis($row['id_template'])
+ );
+
+ if ( $settings['ssl'] ) $base = 'https'; else $base = 'http';
+
+ $link = $base . "://" . $_SERVER['SERVER_NAME'] . '/newsletter/unsubscribe/hash=' . \front\factory\Newsletter::get_hash( $row['email'] );
+ $text = str_replace( '[WYPISZ_SIE]', $link, $text );
+
+ $regex = "-( ]+src\s*=\s*['\"])(((?!'|\"|http(|s)://).)*)(['\"][^>]*>)-i";
+ $text = preg_replace( $regex, "$1" . $base . "://" . $_SERVER['SERVER_NAME'] . "$2$4", $text );
+
+ $regex = "-(]+href\s*=\s*['\"])(((?!'|\"|http(|s)://).)*)(['\"][^>]*>)-i";
+ $text = preg_replace( $regex, "$1" . $base . "://" . $_SERVER['SERVER_NAME'] . "$2$4", $text );
+
+ \S::send_email( $row['email'], 'Newsletter ze strony: ' . $_SERVER['SERVER_NAME'], $text );
+
+ if ( $row['only_once'] )
+ $mdb -> update( 'pp_newsletter_send', [ 'mailed' => 1 ], [ 'id' => $row['id'] ] );
+ else
+ $mdb -> delete( 'pp_newsletter_send', [ 'id' => $row['id'] ] );
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public static function get_hash( $email )
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_newsletter', 'hash', [ 'email' => $email ] );
+ }
+
+ public static function newsletter_signin( $email )
+ {
+ global $mdb, $lang, $settings;
+
+ if ( !\S::email_check( $email ) )
+ return false;
+
+ if ( !$mdb -> get( 'pp_newsletter', 'id', [ 'email' => $email ] ) )
+ {
+ $hash = md5( time() . $email );
+
+ $text = $settings['newsletter_header'];
+ $text .= \front\factory\Newsletter::get_template( '#potwierdzenie-zapisu-do-newslettera' );
+ $text .= $settings['newsletter_footer_1'];
+
+ $settings['ssl'] ? $base = 'https' : $base = 'http';
+
+ $regex = "-( ]+src\s*=\s*['\"])(((?!'|\"|http://).)*)(['\"][^>]*>)-i";
+ $text = preg_replace( $regex, "$1" . $base . "://" . $_SERVER['SERVER_NAME'] . "$2$4", $text );
+
+ $regex = "-( ]+href\s*=\s*['\"])(((?!'|\"|http://).)*)(['\"][^>]*>)-i";
+ $text = preg_replace( $regex, "$1" . $base . "://" . $_SERVER['SERVER_NAME'] . "$2$4", $text );
+
+ $link = '/newsletter/confirm/hash=' . $hash;
+
+ $text = str_replace( '[LINK]', $link, $text );
+
+ $send = \S::send_email( $email, $lang['potwierdz-zapisanie-sie-do-newslettera'], $text );
+
+ $mdb -> insert( 'pp_newsletter', [ 'email' => $email, 'hash' => $hash, 'status' => 0 ] );
+
+ return true;
+ }
+ return false;
+ }
+
+ public static function get_template( $template_name )
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_newsletter_templates', 'text', [ 'name' => $template_name ] );
+ }
+
+ public static function newsletter_signout( $email )
+ {
+ global $mdb;
+
+ if ( $mdb -> get( 'pp_newsletter', 'id', [ 'email' => $email ] ) )
+ return $mdb -> delete( 'pp_newsletter', [ 'email' => $email ] );
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/autoload/front/factory/class.Pages.php b/autoload/front/factory/class.Pages.php
new file mode 100644
index 0000000..637fbcc
--- /dev/null
+++ b/autoload/front/factory/class.Pages.php
@@ -0,0 +1,81 @@
+ get( 'pp_pages', 'sort_type', [ 'id' => $page_id ] );
+
+ \Cache::store( "page_sort:$page_id", $sort );
+ }
+ return $sort;
+ }
+
+ public static function lang_url( $page_id, $lang_id_t, $domain = '', $default_domain = '' )
+ {
+ $page = self::page_details( $page_id, $lang_id_t );
+
+ $page['language']['seo_link'] ? $url = '/' . $page['language']['seo_link'] : $url = '/s-' . $page['id'] . '-' . \S::seo( $page['language']['title'] );
+
+ if ( $lang_id_t == \S::get_session( 'current-lang' ) and !$default_domain and $lang_id_t == \front\factory\Languages::default_language( $domain ) )
+ return $url;
+
+ if ( $domain and $lang_id_t != \S::get_session( 'current-lang' ) )
+ return 'http://' . $domain . $url;
+
+ if ( !$domain && $default_domain )
+ {
+ if ( $lang_id_t != \front\factory\Languages::default_language( $default_domain ) and $url != '#' )
+ $url = '/' . $lang_id_t . $url;
+
+ return 'http://' . $default_domain . $url;
+ }
+
+ if ( $lang_id_t != \front\factory\Languages::default_language( $domain ) and $url != '#' )
+ $url = '/' . $lang_id_t . $url;
+
+ return $url;
+ }
+
+ public static function page_details( $id = '', $lang_tmp = '' )
+ {
+ global $mdb, $lang_id;
+
+ $page_lang = $lang_id;
+
+ if ( !$id )
+ $id = self::main_page_id();
+
+ if ( $lang_tmp )
+ $page_lang = $lang_tmp;
+
+ if ( !$page = \Cache::fetch( "page_details:$page_lang:$id" ) )
+ {
+ $page = $mdb -> get( 'pp_pages', '*', [ 'id' => (int)$id ] );
+ $page['language'] = $mdb -> get( 'pp_pages_langs', '*', [ 'AND' => [ 'page_id' => (int)$id, 'lang_id' => $page_lang ] ] );
+
+ \Cache::store( "page_details:$page_lang:$id", $page );
+ }
+
+ return $page;
+ }
+
+ public static function main_page_id()
+ {
+ global $mdb;
+
+ if ( !$id = \Cache::fetch( 'main_page_id' ) )
+ {
+ $id = $mdb -> get( 'pp_pages', 'id', [ 'AND' => [ 'status' => 1, 'start' => 1 ] ] );
+ if ( !$id )
+ $id = $mdb -> get( 'pp_pages', 'id', [ 'status' => 1, 'ORDER' => [ 'menu_id' => 'ASC', 'o' => 'ASC' ], 'LIMIT' => 1 ] );
+ \Cache::store( 'main_page_id', $id );
+ }
+ return $id;
+ }
+}
diff --git a/autoload/front/factory/class.Scontainers.php b/autoload/front/factory/class.Scontainers.php
new file mode 100644
index 0000000..8a6be0a
--- /dev/null
+++ b/autoload/front/factory/class.Scontainers.php
@@ -0,0 +1,23 @@
+ get( 'pp_scontainers', '*', [ 'id' => (int)$scontainer_id ] );
+
+ $results = $mdb -> select( 'pp_scontainers_langs', '*', [ 'AND' => [ 'container_id' => (int)$scontainer_id, 'lang_id' => $lang[0] ] ] );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ $scontainer['languages'] = $row;
+
+ \Cache::store( "scontainer_details:$scontainer_id:" . $lang[0], $scontainer );
+ }
+
+ return $scontainer;
+ }
+}
diff --git a/autoload/front/factory/class.Search.php b/autoload/front/factory/class.Search.php
new file mode 100644
index 0000000..78d56fb
--- /dev/null
+++ b/autoload/front/factory/class.Search.php
@@ -0,0 +1,74 @@
+ query( 'SELECT * 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, '
+ . '( CASE '
+ . 'WHEN copy_from IS NULL THEN entry '
+ . 'WHEN copy_from IS NOT NULL THEN ( '
+ . 'SELECT '
+ . 'entry '
+ . 'FROM '
+ . 'pp_articles_langs '
+ . 'WHERE '
+ . 'lang_id = al.copy_from AND article_id = a.id '
+ . ') '
+ . 'END ) AS entry, '
+ . '( CASE '
+ . 'WHEN copy_from IS NULL THEN text '
+ . 'WHEN copy_from IS NOT NULL THEN ( '
+ . 'SELECT '
+ . 'text '
+ . 'FROM '
+ . 'pp_articles_langs '
+ . 'WHERE '
+ . 'lang_id = al.copy_from AND article_id = a.id '
+ . ') '
+ . 'END ) AS text '
+ . 'FROM '
+ . 'pp_articles AS a '
+ . 'INNER JOIN pp_articles_langs AS al ON a.id = al.article_id '
+ . 'WHERE '
+ . 'status = 1 AND lang_id = \'' . $lang_id . '\' '
+ . ') AS q1 '
+ . 'WHERE '
+ . 'q1.title IS NOT NULL '
+ . 'AND '
+ . '( '
+ . 'LOWER( title ) LIKE \'%' . \S::escape( strtolower( $search_txt ) ) . '%\' '
+ . 'OR '
+ . 'LOWER( entry ) LIKE \'%' . \S::escape( strtolower( $search_txt ) ) . '%\' '
+ . 'OR '
+ . 'LOWER( text ) LIKE \'%' . \S::escape( strtolower( $search_txt ) ) . '%\' '
+ . ')' ) -> fetchAll();
+ if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
+ $articles[] = \front\factory\Articles::article_details( $row['id'], $lang_id );
+
+ \Cache::store( "search_results:$search_txt:$lang_id", $articles );
+ }
+ return $articles;
+ }
+}
diff --git a/autoload/front/factory/class.SeoAdditional.php b/autoload/front/factory/class.SeoAdditional.php
new file mode 100644
index 0000000..196d7a9
--- /dev/null
+++ b/autoload/front/factory/class.SeoAdditional.php
@@ -0,0 +1,10 @@
+ select( 'pp_seo_additional', '*', [ 'status' => 1 ] );
+ }
+}
diff --git a/autoload/front/factory/class.Settings.php b/autoload/front/factory/class.Settings.php
new file mode 100644
index 0000000..9d37999
--- /dev/null
+++ b/autoload/front/factory/class.Settings.php
@@ -0,0 +1,27 @@
+ select( 'pp_settings', '*' );
+ if ( is_array( $results ) ) foreach ( $results as $row )
+ $settings[ $row['param'] ] = $row['value'];
+
+ \Cache::store( 'settings_details', $settings );
+ }
+
+ return $settings;
+ }
+
+ public static function visit_counter()
+ {
+ global $mdb;
+ return $mdb -> get( 'pp_settings', 'value', [ 'param' => 'visits'] );
+ }
+}
diff --git a/autoload/front/view/class.Articles.php b/autoload/front/view/class.Articles.php
new file mode 100644
index 0000000..108bbac
--- /dev/null
+++ b/autoload/front/view/class.Articles.php
@@ -0,0 +1,144 @@
+ $val )
+ $tpl -> $key = $val;
+ return $tpl -> render( 'articles/password-view' );
+ }
+
+ public static function map( $settings, $map_counter )
+ {
+ $tpl = new \Tpl;
+ $tpl -> settings = $settings;
+ $tpl -> map_counter = $map_counter;
+ return $tpl -> render( 'articles/map' );
+ }
+
+ public static function tags_cloud()
+ {
+ global $settings;
+
+ if ( !$settings['tags'] )
+ return false;
+
+ $tpl = new \Tpl;
+ $tpl -> tags = \front\factory\Articles::tags();
+ return $tpl -> render( 'articles/tags-cloud' );
+ }
+
+ public static function news( $page_id, $articles )
+ {
+ $tpl = new \Tpl;
+ $tpl -> page_id = $page_id;
+ $tpl -> articles = $articles;
+ return $tpl -> render( 'articles/news' );
+ }
+
+ public static function articles_list( $articles )
+ {
+ $tpl = new \Tpl;
+ $tpl -> articles = $articles;
+ return $tpl -> render( 'articles/articles-list' );
+ }
+
+ public static function article( $values )
+ {
+ $tpl = new \Tpl;
+ if ( is_array( $values ) ) foreach ( $values as $key => $val )
+ $tpl -> $key = $val;
+ return $tpl -> render( 'articles/article' );
+ }
+
+ public static function article_full( $article_id, $lang_id )
+ {
+ $tpl = new \Tpl;
+ $tpl -> article = \front\factory\Articles::article_details( $article_id, $lang_id );
+ return $tpl -> render( 'articles/article-full' );
+ }
+
+ public static function miniature_articles_list( $page, $lang_id, $bs = 1 )
+ {
+ $results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
+
+ if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
+ $articles[] = \front\factory\Articles::article_details( $article, $lang_id );
+
+ $tpl = new \Tpl;
+ $tpl -> page_id = $page['id'];
+ $tpl -> articles = $articles;
+ $out .= $tpl -> render( 'articles/articles-miniatures' );
+
+ if ( $results['ls'] > 1 )
+ {
+ $tpl = new \Tpl;
+ $tpl -> ls = $results['ls'];
+ $tpl -> bs = $bs ? $bs : 1;
+ $tpl -> page = $page;
+ $out .= $tpl -> render( 'site/pager' );
+ }
+
+ return $out;
+ }
+
+ public static function entry_articles_list( $page, $lang_id, $bs = 1 )
+ {
+ global $page;
+
+ $results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
+
+ if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
+ $articles[] = \front\factory\Articles::article_details( $article, $lang_id );
+
+ $tpl = new \Tpl;
+ $tpl -> page_id = $page['id'];
+ $tpl -> articles = $articles;
+ $out .= $tpl -> render( 'articles/articles-entries' );
+
+ if ( $results['ls'] > 1 )
+ {
+ $tpl = new \Tpl;
+ $tpl -> ls = $results['ls'];
+ $tpl -> bs = $bs ? $bs : 1;
+ $tpl -> page = $page;
+ $out .= $tpl -> render( 'site/pager' );
+ }
+
+ return $out;
+ }
+
+ public static function full_articles_list( $page, $lang_id, $bs = 1 )
+ {
+ $results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
+
+ if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
+ {
+ $article_details = \front\factory\Articles::article_details( $article, $lang_id );
+
+ if ( $article_details['password'] and !\S::get_session( 'article-' . $article . '-' . $article_details['password'] ) )
+ $out .= \front\view\Articles::password_view( [ 'article' => $article ] );
+ else
+ {
+ $out .= \Tpl::view( 'articles/article-full', [
+ 'article' => $article_details,
+ 'table_of_contents' => \front\factory\Articles::generateTableOfContents( $article_details['language']['text'] )
+ ] );
+ }
+ }
+
+ if ( $results['ls'] > 1 )
+ {
+ $tpl = new \Tpl;
+ $tpl -> ls = $results['ls'];
+ $tpl -> bs = $bs ? $bs : 1;
+ $tpl -> page = $page;
+ $out .= $tpl -> render( 'site/pager' );
+ }
+
+ return $out;
+ }
+}
\ No newline at end of file
diff --git a/autoload/front/view/class.Banners.php b/autoload/front/view/class.Banners.php
new file mode 100644
index 0000000..3df8b38
--- /dev/null
+++ b/autoload/front/view/class.Banners.php
@@ -0,0 +1,35 @@
+ banners = $banners;
+ return $tpl -> render( 'banner/banners' );
+ }
+
+ public static function main_banner( $banner )
+ {
+ if ( file_exists( 'templates/banner/draw.php' ) and !file_exists( 'templates/banner/main-banner.php' ) )
+ copy( 'templates/banner/draw.php', 'templates/banner/main-banner.php' );
+
+ if ( file_exists( 'templates/banner/draw.php' ) and file_exists( 'templates/banner/main-banner.php' ) )
+ unlink( 'templates/banner/draw.php' );
+
+ if ( file_exists( 'templates_user/banner/draw.php' ) and !file_exists( 'templates_user/banner/main-banner.php' ) )
+ copy( 'templates_user/banner/draw.php', 'templates_user/banner/main-banner.php' );
+
+ if ( file_exists( 'templates_user/banner/draw.php' ) and file_exists( 'templates_user/banner/main-banner.php' ) )
+ unlink( 'templates_user/banner/draw.php' );
+
+
+ if ( !\S::get_session( 'banner_close' ) && is_array( $banner ) )
+ {
+ $tpl = new \Tpl;
+ $tpl -> banner = $banner;
+ return $tpl -> render( 'banner/main-banner' );
+ }
+ }
+}
diff --git a/autoload/front/view/class.Languages.php b/autoload/front/view/class.Languages.php
new file mode 100644
index 0000000..d262db5
--- /dev/null
+++ b/autoload/front/view/class.Languages.php
@@ -0,0 +1,13 @@
+ languages = \front\factory\Languages::active_languages();
+ $tpl -> default_domain = \front\factory\Languages::default_domain();
+ return $tpl -> render( 'site/languages' );
+ }
+}
diff --git a/autoload/front/view/class.Menu.php b/autoload/front/view/class.Menu.php
new file mode 100644
index 0000000..40348d6
--- /dev/null
+++ b/autoload/front/view/class.Menu.php
@@ -0,0 +1,42 @@
+ pages = $pages;
+ $tpl -> level = $level;
+ $tpl -> current_page = $current_page;
+ return $tpl -> render( 'menu/pages' );
+ }
+
+ public static function main_menu( $menu, $current_page )
+ {
+
+ $tpl = new \Tpl;
+ $tpl -> menu = $menu;
+ $tpl -> current_page = $current_page;
+ return $tpl -> render( 'menu/main-menu' );
+ }
+
+ public static function menu( $menu, $current_page )
+ {
+
+ $tpl = new \Tpl;
+ $tpl -> menu = $menu;
+ $tpl -> current_page = $current_page;
+ return $tpl -> render( 'menu/menu' );
+ }
+
+ public static function submenu( $pages, $current_page, $page_id, $level = 0 )
+ {
+ $tpl = new \Tpl;
+ $tpl -> page_id = $page_id;
+ $tpl -> pages = $pages;
+ $tpl -> current_page = $current_page;
+ $tpl -> level = $level;
+ return $tpl -> render( 'menu/submenu' );
+ }
+}
diff --git a/autoload/front/view/class.Newsletter.php b/autoload/front/view/class.Newsletter.php
new file mode 100644
index 0000000..e303a2e
--- /dev/null
+++ b/autoload/front/view/class.Newsletter.php
@@ -0,0 +1,11 @@
+ render( 'newsletter/newsletter' );
+ }
+}
diff --git a/autoload/front/view/class.Scontainers.php b/autoload/front/view/class.Scontainers.php
new file mode 100644
index 0000000..67703e2
--- /dev/null
+++ b/autoload/front/view/class.Scontainers.php
@@ -0,0 +1,12 @@
+ scontainer = \front\factory\Scontainers::scontainer_details( $id );
+ return $tpl -> render( 'scontainers/scontainer' );
+ }
+}
diff --git a/autoload/front/view/class.Search.php b/autoload/front/view/class.Search.php
new file mode 100644
index 0000000..7179f0d
--- /dev/null
+++ b/autoload/front/view/class.Search.php
@@ -0,0 +1,18 @@
+ articles = $articles;
+ return $tpl -> render( 'search/search-results' );
+ }
+
+ public static function search_form()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'search/search-form' );
+ }
+}
diff --git a/autoload/front/view/class.Site.php b/autoload/front/view/class.Site.php
new file mode 100644
index 0000000..c85b5fe
--- /dev/null
+++ b/autoload/front/view/class.Site.php
@@ -0,0 +1,396 @@
+', ' ', $html );
+
+ if ( \S::get_session( 'contrast' ) )
+ $html = str_replace( '', ' ', $html );
+
+ if ( $settings['facebook_link'] )
+ $html = str_replace( '
+
+ [PHP] include 'templates_user/components/NavPanel.php'; [/PHP]
+
+
+
+
+
+
+ [KONTENER:2]
+
+
+ [KONTENER:3]
+ [KONTENER:4]
+ [KONTENER:5]
+
+
+
+
+
+
+
+ [PHP] include 'templates_user/components/ZaufaliNam.php'; [/PHP]
+ [PHP] include 'templates_user/components/NajnowszeRealizacje.php'; [/PHP]
+
+
+
+
+
+ [AKTUALNOSCI:7:3]
+
+
+ [PHP] include 'templates_user/components/Newsletter.php'; [/PHP]
+
+
+
+ [PHP] include 'templates_user/components/Footer.php'; [/PHP]
+ [PHP] include 'templates_user/components/CookieBot/cookie_part_second.php'; [/PHP]
+', \front\view\Site::facebook( $settings['facebook_link'] ) . '', $html );
+
+ if ( strpos( $html, '[BANER_STRONA_GLOWNA]' ) === false )
+ $html = str_replace( '', '[BANER_STRONA_GLOWNA]' . '', $html );
+
+ if ( strpos( $html, '[WIDGET_TELEFON]' ) === false )
+ $html = str_replace( '', '[WIDGET_TELEFON]' . '', $html );
+
+ 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'] );
+ }
+
+ $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 );
+ else
+ $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 );
+ else
+ $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 )
+ {
+ $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 )
+ {
+ $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 )
+ {
+ $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 )
+ {
+ $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 );
+
+ preg_match_all( self::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[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
+
+ $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 );
+ }
+
+ // 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 )
+ {
+ $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 );
+ }
+
+ // 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 )
+ {
+ $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 );
+ }
+
+ 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 );
+ }
+
+ if ( \S::get( 'article' ) )
+ {
+ $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' ) )
+ {
+ $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' ) )
+ {
+ $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'] )
+ $title = $page['language']['meta_title'];
+ else
+ $title = $page['language']['title'] . ' ● ' . $settings['firm_name'];
+
+ $meta_keywords = $page['language']['meta_keywords'];
+ $meta_description = $page['language']['meta_description'];
+ }
+
+ $seo_additional = \front\factory\SeoAdditional::seo_active();
+ 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 ) )
+ {
+ if ( $seo['title'] )
+ $title = $seo['title'];
+
+ if ( $seo['keywords'] )
+ $meta_keywords = $seo['keywords'];
+
+ if ( $meta_description )
+ $meta_description = $seo['description'];
+
+ if ( $seo['text'] )
+ $html = str_replace( '[DODATKOWA_TRESC]', '
' . $seo['text'] . '
', $html );
+ else
+ $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 );
+
+ 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 );
+ }
+
+ /* atrybut noindex */
+ if ( \S::get( 'article' ) )
+ {
+ \front\factory\Articles::article_noindex( \S::get( 'article' ) ) === '1' ? $noindex = 'noindex' : $noindex = 'index, follow';
+ $html = str_replace( '[META_INDEX]', ' ', $html );
+ }
+ else
+ {
+ $page['language']['noindex'] === '1' ? $noindex = 'noindex' : $noindex = 'index, follow';
+ $html = str_replace( '[META_INDEX]', ' ', $html );
+ }
+
+ if ( $page['language']['canonical'] )
+ $html = str_replace( '', ' ', $html );
+
+ while ( strpos( $html, '[PHP]' ) !== false )
+ {
+ $text = explode( '[PHP]', $html );
+ $before = $text[0];
+ for ( $i = 1; $i < count( $text ); $i++ )
+ {
+ $temp = explode( '[/PHP]' , $text[$i] );
+ $code = $temp[0];
+
+ ob_start();
+ eval( str_replace( ''', '"', $code ) );
+ $out .= ob_get_contents();
+ ob_end_clean();
+
+ $out .= $temp[1];
+ }
+ $html = $before . $out;
+ }
+
+ preg_match_all( self::maps_pattern, $html, $maps_list );
+ if ( is_array( $maps_list[1] ) and !empty( $maps_list[1] ) )
+ {
+ $html = strrev( implode( strrev( '' ), explode( strrev( '' ), 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 );
+ }
+ }
+
+ $html = str_replace( '[ALERT]', \front\view\Site::alert(), $html );
+
+ return $html;
+ }
+
+ public static function widget_phone()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'widgets/widget-phone' );
+ }
+
+ public static function facebook( $facebook_link )
+ {
+ $tpl = new \Tpl;
+ $tpl -> facebook_link = $facebook_link;
+ return $tpl -> render( 'site/facebook' );
+ }
+
+ public static function title( $title, $show_title, $site_title )
+ {
+ if ( !$show_title )
+ return false;
+
+ if ( $site_title )
+ $title = $site_title;
+
+ $tpl = new \Tpl;
+ $tpl -> title = $title;
+ return $tpl -> render( 'site/title' );
+ }
+
+ static public function alert()
+ {
+ if ( $alert = \S::get_session( 'alert' ) )
+ {
+ \S::delete_session( 'alert' );
+ \S::delete_session( 'alert-class' );
+
+ return \Tpl::view( 'site/alert', [
+ 'alert' => $alert,
+ 'alert_class' => \S::get_session( 'alert-class' )
+ ] );
+ }
+ }
+
+ public static function copyright()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'site/copyright' );
+ }
+
+ public static function contact()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'site/contact' );
+ }
+
+ public static function cookie_information()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'site/cookie-information' );
+ }
+
+ public static function calendar( $month = '', $year = '', $ajax = false )
+ {
+ global $settings, $lang_id;
+
+ if ( !$settings['calendar'] )
+ return false;
+
+ 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' );
+ }
+
+ public static function visit_counter( $visit_counter )
+ {
+ $tpl = new \Tpl;
+ $tpl -> visit_counter = $visit_counter;
+ return $tpl -> render( 'site/visit-counter' );
+ }
+
+ public static function contrast()
+ {
+ $tpl = new \Tpl;
+ return $tpl -> render( 'site/contrast' );
+ }
+}
+?>
diff --git a/config.php b/config.php
new file mode 100644
index 0000000..ed7409f
--- /dev/null
+++ b/config.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/cron.php b/cron.php
new file mode 100644
index 0000000..dcbbcac
--- /dev/null
+++ b/cron.php
@@ -0,0 +1,47 @@
+ 'mysql',
+ 'database_name' => $database['name'],
+ 'server' => $database['host'],
+ 'username' => $database['user'],
+ 'password' => $database['password'],
+ 'charset' => 'utf8'
+ ] );
+
+$settings = \front\factory\Settings::settings_details();
+
+/* wysyłka newslettera */
+if ( \front\factory\Newsletter::newsletter_send() )
+ exit( '
Wysylanie newslettera.
' );
\ No newline at end of file
diff --git a/devel.html b/devel.html
new file mode 100644
index 0000000..f0fe32a
--- /dev/null
+++ b/devel.html
@@ -0,0 +1,88 @@
+
+
+