Add author management functionality and update routing rules
- Updated .htaccess rules to allow trailing slashes for specific routes. - Introduced a new .gitignore file to exclude the cache directory. - Created project configuration file for Serena with language and tool settings. - Implemented Authors class for managing author data, including methods for saving, deleting, and editing authors. - Added factory class for Authors to handle database interactions related to authors. - Developed Article class to manage article data and interactions, including fetching articles and updating views. - Created Page class with a placeholder method for sorting pages. - Added front factory class for fetching author details with caching.
This commit is contained in:
397
.htaccess
397
.htaccess
@@ -3,10 +3,21 @@ RewriteBase /
|
||||
Options +FollowSymlinks
|
||||
Options -Indexes
|
||||
|
||||
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
|
||||
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
|
||||
RewriteCond %{SERVER_PORT} !=443
|
||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]
|
||||
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$
|
||||
RewriteCond %{HTTPS} off
|
||||
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||
|
||||
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$
|
||||
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
||||
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
|
||||
|
||||
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$
|
||||
RewriteCond %{REQUEST_URI} !^/admin(/|$) [NC]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} !/$
|
||||
RewriteRule ^(.+)$ https://%{HTTP_HOST}/$1/ [L,R=301]
|
||||
|
||||
|
||||
ErrorDocument 404 /404.html
|
||||
|
||||
@@ -16,11 +27,11 @@ RewriteRule ^admin/([^/]*)/([^/]*)/(.*)$ admin/index.php?module=$1&action=$2&$3
|
||||
|
||||
|
||||
RewriteRule ^admin/$ admin/index.php [L]
|
||||
RewriteRule ^wyszukiwarka$ index.php?search=true&lang=pl [L]
|
||||
RewriteRule ^wersja-tymczasowa$ index.php?devel=true&lang=pl [L]
|
||||
RewriteRule ^wyszukiwarka(|/)$ index.php?search=true&lang=pl [L]
|
||||
RewriteRule ^wersja-tymczasowa(|/)$ index.php?devel=true&lang=pl [L]
|
||||
RewriteRule ^pixieset/(.*)$ index.php?module=articles&action=image&hash=$1 [L]
|
||||
RewriteRule ^pixieset-wszystkie/(.*)$ index.php?module=articles&action=images_download&hash=$1 [L]
|
||||
RewriteRule ^audyt-seo/wynik$ index.php?module=auditSEO&action=main_view&%{QUERY_STRING} [L]
|
||||
RewriteRule ^audyt-seo/wynik(|/)$ index.php?module=auditSEO&action=main_view&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{REQUEST_URI} ^/auditSEO/(.*) [NC]
|
||||
RewriteRule ^([^/]*)/([^/]*)/(.*)$ index.php?module=$1&action=$2&$3 [L]
|
||||
@@ -32,32 +43,32 @@ AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml appl
|
||||
</IfModule>
|
||||
<IfModule mod_expires.c>
|
||||
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"
|
||||
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"
|
||||
</IfModule>
|
||||
<Files *.conf>
|
||||
Order Deny,Allow
|
||||
@@ -73,302 +84,90 @@ ExpiresByType image/svg+xml "access plus 1 year"
|
||||
</Files>
|
||||
RewriteRule ^pl/$ index.php?a=change_language&id=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid|hash)=[^&]+(&.*)?
|
||||
RewriteRule ^$ index.php?a=page&id=1&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{REQUEST_URI} ^/home$
|
||||
RewriteCond %{REQUEST_URI} ^/home(|/)$
|
||||
RewriteRule ^(.*)$ https://kobcrane-montaze.pl/ [R=301,L]
|
||||
RewriteCond %{REQUEST_URI} ^/home-s-1$
|
||||
RewriteCond %{REQUEST_URI} ^/home/s/1$
|
||||
RewriteRule ^(.*)$ https://kobcrane-montaze.pl/ [R=301,L]
|
||||
RewriteCond %{REQUEST_URI} "^/$"
|
||||
RewriteCond %{REQUEST_URI} "^/$"
|
||||
RewriteRule ^$ index.php?a=page&id=1&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^home$ index.php?a=page&id=1&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^home-s-1$ home [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^home-s-([0-9]+)$ index.php?a=page&id=1&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule home %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^home$ index.php?a=page&id=1&lang=pl [L]
|
||||
RewriteRule ^home-s-([0-9]+)$ index.php?a=page&id=1&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^home(|/)$ index.php?a=page&id=1&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^home/s/1(|/)$ home [R=301,L]
|
||||
RewriteRule ^home/s/([0-9]+)(|/)$ index.php?a=page&id=1&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^produkty$ index.php?a=page&id=8&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^produkty-s-1$ produkty [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^produkty-s-([0-9]+)$ index.php?a=page&id=8&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule produkty %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^produkty$ index.php?a=page&id=8&lang=pl [L]
|
||||
RewriteRule ^produkty-s-([0-9]+)$ index.php?a=page&id=8&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^produkty(|/)$ index.php?a=page&id=8&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^produkty/s/1(|/)$ produkty [R=301,L]
|
||||
RewriteRule ^produkty/s/([0-9]+)(|/)$ index.php?a=page&id=8&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^aktualnoci$ index.php?a=page&id=2&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^aktualnoci-s-1$ aktualnoci [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^aktualnoci-s-([0-9]+)$ index.php?a=page&id=2&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule aktualnoci %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^aktualnoci$ index.php?a=page&id=2&lang=pl [L]
|
||||
RewriteRule ^aktualnoci-s-([0-9]+)$ index.php?a=page&id=2&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^aktualnoci(|/)$ index.php?a=page&id=2&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^aktualnoci/s/1(|/)$ aktualnoci [R=301,L]
|
||||
RewriteRule ^aktualnoci/s/([0-9]+)(|/)$ index.php?a=page&id=2&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-teleskopowe$ index.php?a=page&id=13&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^podnosniki-teleskopowe-s-1$ podnosniki-teleskopowe [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-teleskopowe-s-([0-9]+)$ index.php?a=page&id=13&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule podnosniki-teleskopowe %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^podnosniki-teleskopowe$ index.php?a=page&id=13&lang=pl [L]
|
||||
RewriteRule ^podnosniki-teleskopowe-s-([0-9]+)$ index.php?a=page&id=13&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^o-firmie(|/)$ index.php?a=page&id=3&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^o-firmie/s/1(|/)$ o-firmie [R=301,L]
|
||||
RewriteRule ^o-firmie/s/([0-9]+)(|/)$ index.php?a=page&id=3&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^o-firmie$ index.php?a=page&id=3&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^o-firmie-s-1$ o-firmie [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^o-firmie-s-([0-9]+)$ index.php?a=page&id=3&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule o-firmie %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^o-firmie$ index.php?a=page&id=3&lang=pl [L]
|
||||
RewriteRule ^o-firmie-s-([0-9]+)$ index.php?a=page&id=3&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^nasi-partnerzy(|/)$ index.php?a=page&id=4&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^nasi-partnerzy/s/1(|/)$ nasi-partnerzy [R=301,L]
|
||||
RewriteRule ^nasi-partnerzy/s/([0-9]+)(|/)$ index.php?a=page&id=4&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-przegubowo-teleskopowe$ index.php?a=page&id=14&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^podnosniki-przegubowo-teleskopowe-s-1$ podnosniki-przegubowo-teleskopowe [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-przegubowo-teleskopowe-s-([0-9]+)$ index.php?a=page&id=14&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule podnosniki-przegubowo-teleskopowe %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^podnosniki-przegubowo-teleskopowe$ index.php?a=page&id=14&lang=pl [L]
|
||||
RewriteRule ^podnosniki-przegubowo-teleskopowe-s-([0-9]+)$ index.php?a=page&id=14&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^do-pobrania(|/)$ index.php?a=page&id=5&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^do-pobrania/s/1(|/)$ do-pobrania [R=301,L]
|
||||
RewriteRule ^do-pobrania/s/([0-9]+)(|/)$ index.php?a=page&id=5&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^nasi-partnerzy$ index.php?a=page&id=4&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^nasi-partnerzy-s-1$ nasi-partnerzy [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^nasi-partnerzy-s-([0-9]+)$ index.php?a=page&id=4&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule nasi-partnerzy %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^nasi-partnerzy$ index.php?a=page&id=4&lang=pl [L]
|
||||
RewriteRule ^nasi-partnerzy-s-([0-9]+)$ index.php?a=page&id=4&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^ochrona-danych(|/)$ index.php?a=page&id=6&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^ochrona-danych/s/1(|/)$ ochrona-danych [R=301,L]
|
||||
RewriteRule ^ochrona-danych/s/([0-9]+)(|/)$ index.php?a=page&id=6&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^multipurpose$ index.php?a=page&id=21&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^multipurpose-s-1$ multipurpose [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^multipurpose-s-([0-9]+)$ index.php?a=page&id=21&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule multipurpose %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^multipurpose$ index.php?a=page&id=21&lang=pl [L]
|
||||
RewriteRule ^multipurpose-s-([0-9]+)$ index.php?a=page&id=21&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^kontakt(|/)$ index.php?a=page&id=7&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^kontakt/s/1(|/)$ kontakt [R=301,L]
|
||||
RewriteRule ^kontakt/s/([0-9]+)(|/)$ index.php?a=page&id=7&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^do-pobrania$ index.php?a=page&id=5&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^do-pobrania-s-1$ do-pobrania [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^do-pobrania-s-([0-9]+)$ index.php?a=page&id=5&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule do-pobrania %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^do-pobrania$ index.php?a=page&id=5&lang=pl [L]
|
||||
RewriteRule ^do-pobrania-s-([0-9]+)$ index.php?a=page&id=5&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^serwis-i-naprawa-podestow-ruchomych(|/)$ index.php?a=page&id=9&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^serwis-i-naprawa-podestow-ruchomych/s/1(|/)$ serwis-i-naprawa-podestow-ruchomych [R=301,L]
|
||||
RewriteRule ^serwis-i-naprawa-podestow-ruchomych/s/([0-9]+)(|/)$ index.php?a=page&id=9&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-na-podwoziu-typu-furgon$ index.php?a=page&id=15&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^podnosniki-na-podwoziu-typu-furgon-s-1$ podnosniki-na-podwoziu-typu-furgon [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-na-podwoziu-typu-furgon-s-([0-9]+)$ index.php?a=page&id=15&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule podnosniki-na-podwoziu-typu-furgon %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^podnosniki-na-podwoziu-typu-furgon$ index.php?a=page&id=15&lang=pl [L]
|
||||
RewriteRule ^podnosniki-na-podwoziu-typu-furgon-s-([0-9]+)$ index.php?a=page&id=15&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^czesci(|/)$ index.php?a=page&id=10&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^czesci/s/1(|/)$ czesci [R=301,L]
|
||||
RewriteRule ^czesci/s/([0-9]+)(|/)$ index.php?a=page&id=10&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-gasienicowe$ index.php?a=page&id=16&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^podnosniki-gasienicowe-s-1$ podnosniki-gasienicowe [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-gasienicowe-s-([0-9]+)$ index.php?a=page&id=16&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule podnosniki-gasienicowe %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^podnosniki-gasienicowe$ index.php?a=page&id=16&lang=pl [L]
|
||||
RewriteRule ^podnosniki-gasienicowe-s-([0-9]+)$ index.php?a=page&id=16&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^akcesoria(|/)$ index.php?a=page&id=11&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^akcesoria/s/1(|/)$ akcesoria [R=301,L]
|
||||
RewriteRule ^akcesoria/s/([0-9]+)(|/)$ index.php?a=page&id=11&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-szynowo-drogowe$ index.php?a=page&id=17&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^podnosniki-szynowo-drogowe-s-1$ podnosniki-szynowo-drogowe [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-szynowo-drogowe-s-([0-9]+)$ index.php?a=page&id=17&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule podnosniki-szynowo-drogowe %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^podnosniki-szynowo-drogowe$ index.php?a=page&id=17&lang=pl [L]
|
||||
RewriteRule ^podnosniki-szynowo-drogowe-s-([0-9]+)$ index.php?a=page&id=17&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^nowe-w-magazynie(|/)$ index.php?a=page&id=12&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^nowe-w-magazynie/s/1(|/)$ nowe-w-magazynie [R=301,L]
|
||||
RewriteRule ^nowe-w-magazynie/s/([0-9]+)(|/)$ index.php?a=page&id=12&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^kontakt$ index.php?a=page&id=7&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^kontakt-s-1$ kontakt [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^kontakt-s-([0-9]+)$ index.php?a=page&id=7&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule kontakt %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^kontakt$ index.php?a=page&id=7&lang=pl [L]
|
||||
RewriteRule ^kontakt-s-([0-9]+)$ index.php?a=page&id=7&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^teleskopowe/cte(|/)$ index.php?article=1&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-izolowane-do-750-kv$ index.php?a=page&id=18&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^podnosniki-izolowane-do-750-kv-s-1$ podnosniki-izolowane-do-750-kv [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^podnosniki-izolowane-do-750-kv-s-([0-9]+)$ index.php?a=page&id=18&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule podnosniki-izolowane-do-750-kv %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^podnosniki-izolowane-do-750-kv$ index.php?a=page&id=18&lang=pl [L]
|
||||
RewriteRule ^podnosniki-izolowane-do-750-kv-s-([0-9]+)$ index.php?a=page&id=18&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^a-3-ochrona-danych(|/)$ index.php?article=3&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^pianoplan$ index.php?a=page&id=19&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^pianoplan-s-1$ pianoplan [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^pianoplan-s-([0-9]+)$ index.php?a=page&id=19&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule pianoplan %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^pianoplan$ index.php?a=page&id=19&lang=pl [L]
|
||||
RewriteRule ^pianoplan-s-([0-9]+)$ index.php?a=page&id=19&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^teleskopowe/france-elevateur(|/)$ index.php?article=4&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^serwis-i-naprawa-podestow-ruchomych$ index.php?a=page&id=9&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^serwis-i-naprawa-podestow-ruchomych-s-1$ serwis-i-naprawa-podestow-ruchomych [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^serwis-i-naprawa-podestow-ruchomych-s-([0-9]+)$ index.php?a=page&id=9&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule serwis-i-naprawa-podestow-ruchomych %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^serwis-i-naprawa-podestow-ruchomych$ index.php?a=page&id=9&lang=pl [L]
|
||||
RewriteRule ^serwis-i-naprawa-podestow-ruchomych-s-([0-9]+)$ index.php?a=page&id=9&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^przegubowo-teleskopowe/cte(|/)$ index.php?article=5&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^czesci$ index.php?a=page&id=10&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^czesci-s-1$ czesci [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^czesci-s-([0-9]+)$ index.php?a=page&id=10&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule czesci %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^czesci$ index.php?a=page&id=10&lang=pl [L]
|
||||
RewriteRule ^czesci-s-([0-9]+)$ index.php?a=page&id=10&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^przegubowo-teleskopowe/france-elevateur(|/)$ index.php?article=6&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^akcesoria$ index.php?a=page&id=11&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^akcesoria-s-1$ akcesoria [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^akcesoria-s-([0-9]+)$ index.php?a=page&id=11&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule akcesoria %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^akcesoria$ index.php?a=page&id=11&lang=pl [L]
|
||||
RewriteRule ^akcesoria-s-([0-9]+)$ index.php?a=page&id=11&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^na-podwoziu-typu-furgon/france-elevateur(|/)$ index.php?article=7&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^nowe-w-magazynie$ index.php?a=page&id=12&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteRule ^nowe-w-magazynie-s-1$ nowe-w-magazynie [R=301,L]
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^nowe-w-magazynie-s-([0-9]+)$ index.php?a=page&id=12&lang=pl&bs=$1&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule nowe-w-magazynie %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^nowe-w-magazynie$ index.php?a=page&id=12&lang=pl [L]
|
||||
RewriteRule ^nowe-w-magazynie-s-([0-9]+)$ index.php?a=page&id=12&lang=pl&bs=$1 [L]
|
||||
RewriteRule ^na-podwozu-gasienicowym/cte(|/)$ index.php?article=8&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^teleskopowe/cte$ index.php?article=1&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^teleskopowe/cte %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^teleskopowe/cte$ index.php?article=1&lang=pl [L]
|
||||
RewriteRule ^szynowo-drogowe/france-elevateur(|/)$ index.php?article=9&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^a-3-ochrona-danych$ index.php?article=3&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^a-3-ochrona-danych %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^a-3-ochrona-danych$ index.php?article=3&lang=pl [L]
|
||||
RewriteRule ^izolowane-do-750-kv/france-elevateur(|/)$ index.php?article=10&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^teleskopowe/france-elevateur$ index.php?article=4&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^teleskopowe/france-elevateur %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^teleskopowe/france-elevateur$ index.php?article=4&lang=pl [L]
|
||||
RewriteRule ^multipurpose/producent-cte(|/)$ index.php?article=11&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^przegubowo-teleskopowe/cte$ index.php?article=5&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^przegubowo-teleskopowe/cte %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^przegubowo-teleskopowe/cte$ index.php?article=5&lang=pl [L]
|
||||
RewriteRule ^pianoplan/producent-cte(|/)$ index.php?article=12&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^przegubowo-teleskopowe/france-elevateur$ index.php?article=6&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^przegubowo-teleskopowe/france-elevateur %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^przegubowo-teleskopowe/france-elevateur$ index.php?article=6&lang=pl [L]
|
||||
RewriteRule ^a-14-o-firmie(|/)$ index.php?article=14&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^na-podwoziu-typu-furgon/france-elevateur$ index.php?article=7&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^na-podwoziu-typu-furgon/france-elevateur %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^na-podwoziu-typu-furgon/france-elevateur$ index.php?article=7&lang=pl [L]
|
||||
RewriteRule ^a-15-nasi-partnerzy(|/)$ index.php?article=15&lang=pl&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^na-podwozu-gasienicowym/cte$ index.php?article=8&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^na-podwozu-gasienicowym/cte %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^na-podwozu-gasienicowym/cte$ index.php?article=8&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^szynowo-drogowe/france-elevateur$ index.php?article=9&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^szynowo-drogowe/france-elevateur %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^szynowo-drogowe/france-elevateur$ index.php?article=9&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^izolowane-do-750-kv/france-elevateur$ index.php?article=10&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^izolowane-do-750-kv/france-elevateur %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^izolowane-do-750-kv/france-elevateur$ index.php?article=10&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^multipurpose/producent-cte$ index.php?article=11&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^multipurpose/producent-cte %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^multipurpose/producent-cte$ index.php?article=11&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^pianoplan/producent-cte$ index.php?article=12&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^pianoplan/producent-cte %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^pianoplan/producent-cte$ index.php?article=12&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^a-13-inteligentny-system-stabilizacji-s3-smart-stability-system$ index.php?article=13&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^a-13-inteligentny-system-stabilizacji-s3-smart-stability-system %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^a-13-inteligentny-system-stabilizacji-s3-smart-stability-system$ index.php?article=13&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^a-14-o-firmie$ index.php?article=14&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^a-14-o-firmie %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^a-14-o-firmie$ index.php?article=14&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^a-15-nasi-partnerzy$ index.php?article=15&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^a-15-nasi-partnerzy %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^a-15-nasi-partnerzy$ index.php?article=15&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^a-20-cte-prenentuje-nowy-model-b-lift20j-teleskopowy-podest-ruchomy-z-ramieniem-jib$ index.php?article=20&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^a-20-cte-prenentuje-nowy-model-b-lift20j-teleskopowy-podest-ruchomy-z-ramieniem-jib %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^a-20-cte-prenentuje-nowy-model-b-lift20j-teleskopowy-podest-ruchomy-z-ramieniem-jib$ index.php?article=20&lang=pl [L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)(utm_source|gclid)=[^&]+(&.*)?
|
||||
RewriteRule ^a-21-energetab-2020$ index.php?article=21&lang=pl&%{QUERY_STRING} [L]
|
||||
RewriteCond %{QUERY_STRING} !=""
|
||||
RewriteRule ^a-21-energetab-2020 %{REQUEST_URI}? [R=301,L]
|
||||
RewriteRule ^a-21-energetab-2020$ index.php?article=21&lang=pl [L]
|
||||
|
||||
RewriteRule ^newsletter/signin/$ index.php?module=newsletter&action=signin [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]
|
||||
|
||||
1
.serena/.gitignore
vendored
Normal file
1
.serena/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/cache
|
||||
126
.serena/project.yml
Normal file
126
.serena/project.yml
Normal file
@@ -0,0 +1,126 @@
|
||||
# the name by which the project can be referenced within Serena
|
||||
project_name: "kobcrane-montaze.pl"
|
||||
|
||||
|
||||
# list of languages for which language servers are started; choose from:
|
||||
# al bash clojure cpp csharp
|
||||
# csharp_omnisharp dart elixir elm erlang
|
||||
# fortran fsharp go groovy haskell
|
||||
# java julia kotlin lua markdown
|
||||
# matlab nix pascal perl php
|
||||
# php_phpactor powershell python python_jedi r
|
||||
# rego ruby ruby_solargraph rust scala
|
||||
# swift terraform toml typescript typescript_vts
|
||||
# vue yaml zig
|
||||
# (This list may be outdated. For the current list, see values of Language enum here:
|
||||
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
|
||||
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
|
||||
# Note:
|
||||
# - For C, use cpp
|
||||
# - For JavaScript, use typescript
|
||||
# - For Free Pascal/Lazarus, use pascal
|
||||
# Special requirements:
|
||||
# Some languages require additional setup/installations.
|
||||
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
|
||||
# When using multiple languages, the first language server that supports a given file will be used for that file.
|
||||
# The first language is the default language and the respective language server will be used as a fallback.
|
||||
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
|
||||
languages:
|
||||
- typescript
|
||||
|
||||
# the encoding used by text files in the project
|
||||
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
|
||||
encoding: "utf-8"
|
||||
|
||||
# The language backend to use for this project.
|
||||
# If not set, the global setting from serena_config.yml is used.
|
||||
# Valid values: LSP, JetBrains
|
||||
# Note: the backend is fixed at startup. If a project with a different backend
|
||||
# is activated post-init, an error will be returned.
|
||||
language_backend:
|
||||
|
||||
# whether to use project's .gitignore files to ignore files
|
||||
ignore_all_files_in_gitignore: true
|
||||
|
||||
# list of additional paths to ignore in this project.
|
||||
# Same syntax as gitignore, so you can use * and **.
|
||||
# Note: global ignored_paths from serena_config.yml are also applied additively.
|
||||
ignored_paths: []
|
||||
|
||||
# whether the project is in read-only mode
|
||||
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
|
||||
# Added on 2025-04-18
|
||||
read_only: false
|
||||
|
||||
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
|
||||
# Below is the complete list of tools for convenience.
|
||||
# To make sure you have the latest list of tools, and to view their descriptions,
|
||||
# execute `uv run scripts/print_tool_overview.py`.
|
||||
#
|
||||
# * `activate_project`: Activates a project by name.
|
||||
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
|
||||
# * `create_text_file`: Creates/overwrites a file in the project directory.
|
||||
# * `delete_lines`: Deletes a range of lines within a file.
|
||||
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
|
||||
# * `execute_shell_command`: Executes a shell command.
|
||||
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
|
||||
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
|
||||
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
|
||||
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
|
||||
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
|
||||
# * `initial_instructions`: Gets the initial instructions for the current project.
|
||||
# Should only be used in settings where the system prompt cannot be set,
|
||||
# e.g. in clients you have no control over, like Claude Desktop.
|
||||
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
|
||||
# * `insert_at_line`: Inserts content at a given line in a file.
|
||||
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
|
||||
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
|
||||
# * `list_memories`: Lists memories in Serena's project-specific memory store.
|
||||
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
|
||||
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
|
||||
# * `read_file`: Reads a file within the project directory.
|
||||
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
|
||||
# * `remove_project`: Removes a project from the Serena configuration.
|
||||
# * `replace_lines`: Replaces a range of lines within a file with new content.
|
||||
# * `replace_symbol_body`: Replaces the full definition of a symbol.
|
||||
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
|
||||
# * `search_for_pattern`: Performs a search for a pattern in the project.
|
||||
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
|
||||
# * `switch_modes`: Activates modes by providing a list of their names
|
||||
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
|
||||
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
|
||||
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
|
||||
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
|
||||
excluded_tools: []
|
||||
|
||||
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default)
|
||||
included_optional_tools: []
|
||||
|
||||
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
|
||||
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
|
||||
fixed_tools: []
|
||||
|
||||
# list of mode names to that are always to be included in the set of active modes
|
||||
# The full set of modes to be activated is base_modes + default_modes.
|
||||
# If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply.
|
||||
# Otherwise, this setting overrides the global configuration.
|
||||
# Set this to [] to disable base modes for this project.
|
||||
# Set this to a list of mode names to always include the respective modes for this project.
|
||||
base_modes:
|
||||
|
||||
# list of mode names that are to be activated by default.
|
||||
# The full set of modes to be activated is base_modes + default_modes.
|
||||
# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
|
||||
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
|
||||
# This setting can, in turn, be overridden by CLI parameters (--mode).
|
||||
default_modes:
|
||||
|
||||
# initial prompt for the project. It will always be given to the LLM upon activating the project
|
||||
# (contrary to the memories, which are loaded on demand).
|
||||
initial_prompt: ""
|
||||
|
||||
# time budget (seconds) per tool call for the retrieval of additional symbol information
|
||||
# such as docstrings or parameter information.
|
||||
# This overrides the corresponding setting in the global configuration; see the documentation there.
|
||||
# If null or missing, use the setting from the global configuration.
|
||||
symbol_info_budget:
|
||||
@@ -1,71 +1,216 @@
|
||||
<?php
|
||||
|
||||
namespace admin;
|
||||
|
||||
class Site
|
||||
{
|
||||
// define APP_SECRET_KEY
|
||||
const APP_SECRET_KEY = 'c3cb2537d25c0efc9e573d059d79c3b8';
|
||||
|
||||
public static function special_actions()
|
||||
{
|
||||
$sa = \S::get( 's-action' );
|
||||
$domain = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );
|
||||
$cookie_name = str_replace( '.', '-', $domain );
|
||||
switch ( $sa )
|
||||
$sa = \S::get('s-action');
|
||||
$domain = preg_replace('#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME']);
|
||||
$cookie_name = str_replace('.', '-', $domain);
|
||||
|
||||
switch ($sa)
|
||||
{
|
||||
case 'user-logon':
|
||||
|
||||
$result = \admin\factory\Users::logon( \S::get( 'login' ), \S::get( 'password' ) );
|
||||
|
||||
if ( $result == 1 )
|
||||
{
|
||||
if(\S::get('remember'))
|
||||
{
|
||||
$password = md5( \S::get( 'password' ) );
|
||||
$login = \S::get( 'login' );
|
||||
$value = [ login => $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':
|
||||
$login = \S::get('login');
|
||||
$pass = \S::get('password');
|
||||
|
||||
setcookie( $cookie_name, "", time() -(86400), "/", $domain );
|
||||
session_destroy();
|
||||
header( 'Location: /admin/' );
|
||||
exit;
|
||||
break;
|
||||
$result = \admin\factory\Users::logon($login, $pass);
|
||||
|
||||
if ($result == 1)
|
||||
{
|
||||
$user = \admin\factory\Users::details($login);
|
||||
|
||||
if ($user['twofa_enabled'] == 1)
|
||||
{
|
||||
\S::set_session('twofa_pending', [
|
||||
'uid' => (int)$user['id'],
|
||||
'login' => $login,
|
||||
'remember' => (bool)\S::get('remember'),
|
||||
'started' => time(),
|
||||
]);
|
||||
|
||||
if (!\admin\factory\Users::send_twofa_code((int)$user['id']))
|
||||
{
|
||||
\S::alert('Nie udało się wysłać kodu 2FA. Spróbuj ponownie.');
|
||||
\S::delete_session('twofa_pending');
|
||||
header('Location: /admin/');
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Location: /admin/user/twofa/');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = \admin\factory\Users::details($login);
|
||||
|
||||
self::finalize_admin_login(
|
||||
$user,
|
||||
$domain,
|
||||
$cookie_name,
|
||||
(bool)\S::get('remember')
|
||||
);
|
||||
|
||||
header('Location: /admin/articles/view_list/');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($result == -1)
|
||||
{
|
||||
\S::alert('Z powodu 5 nieudanych prób Twoje konto zostało zablokowane.');
|
||||
}
|
||||
else
|
||||
{
|
||||
\S::alert('Podane hasło jest nieprawidłowe lub użytkownik nie istnieje.');
|
||||
}
|
||||
header('Location: /admin/');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'user-2fa-verify':
|
||||
{
|
||||
$pending = \S::get_session('twofa_pending');
|
||||
if (!$pending || empty($pending['uid']))
|
||||
{
|
||||
\S::alert('Sesja 2FA wygasła. Zaloguj się ponownie.');
|
||||
header('Location: /admin/');
|
||||
exit;
|
||||
}
|
||||
|
||||
$code = trim((string)\S::get('twofa'));
|
||||
if (!preg_match('/^\d{6}$/', $code))
|
||||
{
|
||||
\S::alert('Nieprawidłowy format kodu.');
|
||||
header('Location: /admin/user/twofa/');
|
||||
exit;
|
||||
}
|
||||
|
||||
$ok = \admin\factory\Users::verify_twofa_code((int)$pending['uid'], $code);
|
||||
if (!$ok)
|
||||
{
|
||||
\S::alert('Błędny lub wygasły kod.');
|
||||
header('Location: /admin/user/twofa/');
|
||||
exit;
|
||||
}
|
||||
|
||||
// 2FA OK — finalna sesja
|
||||
$user = \admin\factory\Users::details($pending['login']);
|
||||
\S::set_session('user', $user);
|
||||
\S::delete_session('twofa_pending');
|
||||
|
||||
// Remember me – BEZPIECZNY podpis HMAC:
|
||||
if (!empty($pending['remember']))
|
||||
{
|
||||
$payloadArr = ['login' => $user['login'], 'ts' => time()];
|
||||
$json = json_encode($payloadArr, JSON_UNESCAPED_SLASHES);
|
||||
$sig = hash_hmac('sha256', $json, APP_SECRET_KEY);
|
||||
$payload = base64_encode($json . '.' . $sig);
|
||||
|
||||
setcookie($cookie_name, $payload, [
|
||||
'expires' => time() + (86400 * 14),
|
||||
'path' => '/',
|
||||
'domain' => $domain,
|
||||
'secure' => true,
|
||||
'httponly' => true,
|
||||
'samesite' => 'Lax',
|
||||
]);
|
||||
}
|
||||
|
||||
header('Location: /admin/articles/view_list/');
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'user-2fa-resend':
|
||||
{
|
||||
$pending = \S::get_session('twofa_pending');
|
||||
if (!$pending || empty($pending['uid']))
|
||||
{
|
||||
\S::alert('Sesja 2FA wygasła. Zaloguj się ponownie.');
|
||||
header('Location: /admin/');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!\admin\factory\Users::send_twofa_code((int)$pending['uid'], true))
|
||||
{
|
||||
\S::alert('Kod można wysłać ponownie po krótkiej przerwie.');
|
||||
}
|
||||
else
|
||||
{
|
||||
\S::alert('Nowy kod został wysłany.');
|
||||
}
|
||||
header('Location: /admin/user/twofa/');
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'user-logout':
|
||||
{
|
||||
setcookie($cookie_name, "", time() - 86400, "/", $domain);
|
||||
\S::delete_session('twofa_pending');
|
||||
session_destroy();
|
||||
header('Location: /admin/');
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function route()
|
||||
{
|
||||
{
|
||||
$_SESSION['admin'] = true;
|
||||
|
||||
|
||||
$class = '\admin\controls\\';
|
||||
|
||||
$results = explode( '_', \S::get( 'module' ) );
|
||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
||||
$class .= ucfirst( $row );
|
||||
|
||||
$action = \S::get( 'action' );
|
||||
|
||||
if ( class_exists( $class ) and method_exists( new $class, $action ) )
|
||||
return call_user_func_array( array( $class, $action ), array() );
|
||||
|
||||
$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.' );
|
||||
\S::alert('Nieprawidłowy adres url.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static public function finalize_admin_login(array $user, string $domain, string $cookie_name, bool $remember = false) {
|
||||
\S::set_session('user', $user);
|
||||
\S::delete_session('twofa_pending');
|
||||
|
||||
if ($remember)
|
||||
{
|
||||
$payloadArr = [
|
||||
'login' => $user['login'],
|
||||
'ts' => time()
|
||||
];
|
||||
|
||||
$json = json_encode($payloadArr, JSON_UNESCAPED_SLASHES);
|
||||
$sig = hash_hmac('sha256', $json, self::APP_SECRET_KEY);
|
||||
$payload = base64_encode($json . '.' . $sig);
|
||||
|
||||
setcookie($cookie_name, $payload, [
|
||||
'expires' => time() + (86400 * 14),
|
||||
'path' => '/',
|
||||
'domain' => $domain,
|
||||
'secure' => true,
|
||||
'httponly' => true,
|
||||
'samesite' => 'Lax',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,17 @@
|
||||
namespace admin\controls;
|
||||
class Articles
|
||||
{
|
||||
//autorzy artykułów
|
||||
static public function articles_authors()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \Tpl::view( 'articles/articles-authors' );
|
||||
}
|
||||
|
||||
public static function duplicate_article()
|
||||
{
|
||||
global $user;
|
||||
@@ -16,6 +27,22 @@ class Articles
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function files_order_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
{
|
||||
echo json_encode( [ 'status' => 'error', 'msg' => 'Nie masz uprawnień' ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( \admin\factory\Articles::files_order_save( \S::get( 'article_id' ), \S::get( 'order' ) ) )
|
||||
echo json_encode( [ 'status' => 'ok', 'msg' => 'Artykuł został zapisany.' ] );
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function gallery_order_save()
|
||||
{
|
||||
global $user;
|
||||
@@ -32,6 +59,18 @@ class Articles
|
||||
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;
|
||||
@@ -75,10 +114,10 @@ class Articles
|
||||
$values['params'] = $params;
|
||||
|
||||
if ( $id = \admin\factory\Articles::article_save(
|
||||
$values['id'], $values['title'], $values['entry'], $values['text'], $values['status'], $values['show_title'], $values['show_date_add'], $values['date_add'],
|
||||
$values['show_date_modify'], $values['seo_link'], $values['meta_title'], $values['meta_description'], $values['meta_keywords'], $values['layout_id'],
|
||||
$values['id'], $values['title'], $values['main_image'], $values['entry'], $values['text'], $values['table_of_contents'], $values['status'], $values['show_title'], $values['show_table_of_contents'], $values['show_date_add'], $values['date_add'],
|
||||
$values['show_date_modify'], $values['date_modify'], $values['seo_link'], $values['meta_title'], $values['meta_description'], $values['meta_keywords'], $values['layout_id'],
|
||||
$values['pages'], $values['noindex'], $values['repeat_entry'], $values['copy_from'], $values['social_icons'], $values['event_date'], $values['hidden-tags'], $values['block_direct_access'],
|
||||
$values['priority'], $values['password'], $values['pixieset'], $params
|
||||
$values['priority'], $values['password'], $values['pixieset'], $values['id_author'], $params
|
||||
) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Artykuł został zapisany.', 'id' => $id ];
|
||||
|
||||
@@ -92,22 +131,23 @@ class Articles
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration',
|
||||
$user['id'] ) )
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
\admin\factory\Articles::delete_nonassigned_images();
|
||||
\admin\factory\Articles::delete_nonassigned_files();
|
||||
|
||||
return \admin\view\Articles::article_edit( [
|
||||
'article' => \admin\factory\Articles::article_details( \S::get( 'id' ) ),
|
||||
'menus' => \admin\factory\Pages::menus_list(),
|
||||
'languages' => \admin\factory\Languages::languages_list(),
|
||||
'layouts' => \admin\factory\Layouts::layouts_list(),
|
||||
'additional_params_lon' => \admin\factory\Articles::additional_params( 1 ),
|
||||
'additional_params_loff' => \admin\factory\Articles::additional_params( 0 ),
|
||||
'settings' => \admin\factory\Settings::settings_details()
|
||||
] );
|
||||
'article' => \admin\factory\Articles::article_details( \S::get( 'id' ) ),
|
||||
'menus' => \admin\factory\Pages::menus_list(),
|
||||
'languages' => \admin\factory\Languages::languages_list(),
|
||||
'layouts' => \admin\factory\Layouts::layouts_list(),
|
||||
'additional_params_lon' => \admin\factory\Articles::additional_params( 1 ),
|
||||
'additional_params_loff' => \admin\factory\Articles::additional_params( 0 ),
|
||||
'settings' => \admin\factory\Settings::settings_details(),
|
||||
'authors' => \admin\factory\Authors::get_simple_list(),
|
||||
'user' => $user
|
||||
] );
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
@@ -119,6 +159,5 @@ class Articles
|
||||
|
||||
return \admin\view\Articles::articles_list();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
65
autoload/admin/controls/class.Authors.php
Normal file
65
autoload/admin/controls/class.Authors.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?
|
||||
namespace admin\controls;
|
||||
class Authors
|
||||
{
|
||||
// usunięcie autora
|
||||
static public function delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'article_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = [ 'status' => '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' );
|
||||
}
|
||||
}
|
||||
@@ -4,21 +4,20 @@ namespace admin\controls;
|
||||
|
||||
class Pages
|
||||
{
|
||||
public static function pages_url_browser()
|
||||
static public function pages_url_browser()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'page_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
echo \admin\view\Pages::browse_list(
|
||||
\admin\factory\Pages::menus_list(),
|
||||
\S::get( 'modal' )
|
||||
);
|
||||
exit;
|
||||
|
||||
return \Tpl::view( 'pages/pages-browse-list', [
|
||||
'menus' => \admin\factory\Pages::menus_list(),
|
||||
'modal' => true
|
||||
] );
|
||||
}
|
||||
|
||||
public static function browse_list()
|
||||
static public function browse_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
||||
@@ -2,40 +2,73 @@
|
||||
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'], $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'], $values['newsletter_cron']
|
||||
\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()
|
||||
);
|
||||
|
||||
@@ -1,59 +1,65 @@
|
||||
<?php
|
||||
namespace admin\controls;
|
||||
|
||||
class Users
|
||||
{
|
||||
class Users
|
||||
{
|
||||
public static function user_delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'users_administration', $user['id'] ) )
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
|
||||
if ( \admin\factory\Users::user_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Użytkownik został usunięty.' );
|
||||
|
||||
|
||||
header( 'Location: /admin/users/view_list/' );
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
public static function user_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'users_administration', $user['id'] ) )
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
$response = \admin\factory\Users::user_save(
|
||||
$values['id'], $values['login'], $values['status'], $values['active_to'], $values['password'], $values['password_re'], $values['admin'], $values['privileges']
|
||||
$response = \admin\factory\Users::user_save(
|
||||
$values['id'], $values['login'], $values['status'], $values['active_to'], $values['password'], $values['password_re'], $values['admin'], $values['privileges'], $values['twofa_enabled'], $values['twofa_email']
|
||||
);
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
public static function user_edit()
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'users_administration', $user['id'] ) )
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
return \admin\view\Users::user_edit(
|
||||
\admin\factory\Users::user_details(
|
||||
|
||||
return \admin\view\Users::user_edit(
|
||||
\admin\factory\Users::user_details(
|
||||
\S::get( 'id' ) ),
|
||||
\admin\factory\Users::user_privileges(
|
||||
\admin\factory\Users::user_privileges(
|
||||
\S::get( 'id' ) )
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
if( !\admin\factory\Users::check_privileges( 'users_administration', $user['id']))
|
||||
return \S::alert('Nie masz uprawnień');
|
||||
|
||||
|
||||
return \admin\view\Users::users_list();
|
||||
}
|
||||
|
||||
static public function twofa() {
|
||||
return \Tpl::view( 'site/unlogged', [
|
||||
'content' => \Tpl::view( 'users/user-2fa' )
|
||||
] );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -86,6 +86,24 @@ class Articles
|
||||
return true;
|
||||
}
|
||||
|
||||
static public function files_order_save( $article_id, $order )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$order = explode( ';', $order );
|
||||
if ( is_array( $order ) and !empty( $order ) ) foreach ( $order as $file_id )
|
||||
{
|
||||
$mdb -> update( 'pp_articles_files', [
|
||||
'o' => (int)$i++
|
||||
], [
|
||||
'AND' => [
|
||||
'article_id' => $article_id,
|
||||
'id' => $file_id
|
||||
]
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
public static function gallery_order_save( $article_id, $order )
|
||||
{
|
||||
global $mdb;
|
||||
@@ -222,7 +240,7 @@ class Articles
|
||||
$article['languages'][ $row['lang_id'] ] = $row;
|
||||
|
||||
$article['images'] = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC' ] ] );
|
||||
$article['files'] = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id ] );
|
||||
$article['files'] = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC' ] ] );
|
||||
$article['pages'] = $mdb -> select( 'pp_articles_pages', 'page_id', [ 'article_id' => (int)$article_id ] );
|
||||
$article['tags'] = $mdb -> select( 'pp_tags', [ '[><]pp_articles_tags' => [ 'id' => 'tag_id' ] ], 'name', [ 'article_id' => (int)$article_id ] );
|
||||
$article['params'] = $mdb -> select( 'pp_articles_additional_values', [ 'param_id', 'value', 'language_id' ], [ 'article_id' => (int)$article_id ] );
|
||||
@@ -238,9 +256,9 @@ class Articles
|
||||
}
|
||||
|
||||
public static function article_save(
|
||||
$article_id, $title, $entry, $text, $status, $show_title, $show_date_add, $date_add, $show_date_modify, $seo_link, $meta_title, $meta_description,
|
||||
$article_id, $title, $main_image, $entry, $text, $table_of_contents, $status, $show_title, $show_table_of_contents, $show_date_add, $date_add, $show_date_modify, $date_modify, $seo_link, $meta_title, $meta_description,
|
||||
$meta_keywords, $layout_id, $pages, $noindex, $repeat_entry, $copy_from, $social_icons, $event_date, $tags, $block_direct_access, $priority,
|
||||
$password, $pixieset, $params )
|
||||
$password, $pixieset, $id_author, $params )
|
||||
{
|
||||
|
||||
global $mdb, $user;
|
||||
@@ -251,10 +269,11 @@ class Articles
|
||||
{
|
||||
$mdb -> insert( 'pp_articles', [
|
||||
'show_title' => $show_title == 'on' ? 1 : 0,
|
||||
'show_table_of_contents' => $show_table_of_contents == 'on' ? 1 : 0,
|
||||
'show_date_add' => $show_date_add == 'on' ? 1 : 0,
|
||||
'show_date_modify' => $show_date_modify == 'on' ? 1 : 0,
|
||||
'date_add' => $date_add ? $date_add : date( 'Y-m-d H:i:s' ),
|
||||
'date_modify' => $date_add ? $date_add : date( 'Y-m-d H:i:s' ),
|
||||
'date_add' => date( 'Y-m-d H:i:s' ),
|
||||
'date_modify' => date( 'Y-m-d H:i:s' ),
|
||||
'modify_by' => $user['id'],
|
||||
'layout_id' => $layout_id ? (int)$layout_id : null,
|
||||
'status' => $status == 'on' ? 1 : 0,
|
||||
@@ -264,7 +283,8 @@ class Articles
|
||||
'date_end' => $event_date[1] ? $event_date[1] : null,
|
||||
'priority' => $priority == 'on' ? 1 : 0,
|
||||
'password' => $password ? $password : null,
|
||||
'pixieset' => $pixieset
|
||||
'pixieset' => $pixieset,
|
||||
'id_author' => $id_author ? $id_author : null
|
||||
] );
|
||||
|
||||
$id = $mdb -> id();
|
||||
@@ -281,8 +301,10 @@ class Articles
|
||||
'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,
|
||||
@@ -299,8 +321,10 @@ class Articles
|
||||
'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,
|
||||
@@ -430,9 +454,11 @@ class Articles
|
||||
{
|
||||
$mdb -> update( 'pp_articles', [
|
||||
'show_title' => $show_title == 'on' ? 1 : 0,
|
||||
'show_table_of_contents' => $show_table_of_contents == 'on' ? 1 : 0,
|
||||
'show_date_add' => $show_date_add == 'on' ? 1 : 0,
|
||||
'date_add' => $date_add,
|
||||
'show_date_modify' => $show_date_modify == 'on' ? 1 : 0,
|
||||
'date_modify' => date( 'Y-m-d H:i:s' ),
|
||||
'date_modify' => $date_modify ? $date_modify : date( 'Y-m-d H:i:s' ),
|
||||
'modify_by' => $user['id'],
|
||||
'layout_id' => $layout_id ? (int)$layout_id : null,
|
||||
'status' => $status == 'on' ? 1 : 0,
|
||||
@@ -442,7 +468,8 @@ class Articles
|
||||
'date_end' => $event_date[1] ? $event_date[1] : null,
|
||||
'priority' => $priority == 'on' ? 1 : 0,
|
||||
'password' => $password ? $password : null,
|
||||
'pixieset' => $pixieset
|
||||
'pixieset' => $pixieset,
|
||||
'id_author' => $id_author ? $id_author : null
|
||||
], [
|
||||
'id' => (int)$article_id
|
||||
] );
|
||||
@@ -462,8 +489,10 @@ class Articles
|
||||
'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,
|
||||
@@ -480,8 +509,10 @@ class Articles
|
||||
'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,
|
||||
|
||||
117
autoload/admin/factory/class.Authors.php
Normal file
117
autoload/admin/factory/class.Authors.php
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ class Pages
|
||||
)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
|
||||
if ( !$parent_id )
|
||||
$parent_id = null;
|
||||
|
||||
@@ -131,60 +131,55 @@ class Pages
|
||||
{
|
||||
$order = self::max_order() + 1;
|
||||
|
||||
$mdb -> insert( 'pp_pages',
|
||||
[
|
||||
'menu_id' => (int) $menu_id,
|
||||
'page_type' => $page_type,
|
||||
'sort_type' => $sort_type,
|
||||
$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
|
||||
] );
|
||||
'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 ] );
|
||||
$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 ] );
|
||||
$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++;
|
||||
}
|
||||
$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',
|
||||
[
|
||||
$mdb -> insert( 'pp_pages_langs', [
|
||||
'page_id' => (int) $id,
|
||||
'lang_id' => $row['id'],
|
||||
'title' => $title != '' ? $title : null,
|
||||
@@ -197,11 +192,11 @@ class Pages
|
||||
'link' => $link != '' ? $link : null,
|
||||
'block_direct_access' => $block_direct_access,
|
||||
'canonical' => $canonical != '' ? $canonical : null
|
||||
] );
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
\S::htacces();
|
||||
|
||||
\S::delete_cache();
|
||||
|
||||
return $id;
|
||||
@@ -381,10 +376,10 @@ class Pages
|
||||
else
|
||||
$seo = $seo . $seo_link;
|
||||
}
|
||||
|
||||
|
||||
if ( $prefix )
|
||||
$seo = $prefix . $seo;
|
||||
|
||||
|
||||
return $seo;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,20 +5,20 @@ class Settings
|
||||
public static function settings_update( $param, $value )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$mdb -> delete( 'pp_settings', [ 'param' => $param ] );
|
||||
$mdb -> insert( 'pp_settings', [ 'param' => $param, 'value' => $value ] );
|
||||
|
||||
return true;
|
||||
|
||||
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, $newsletter_cron )
|
||||
$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', [
|
||||
@@ -33,7 +33,7 @@ class Settings
|
||||
'value' => $additional_info
|
||||
], [
|
||||
'param' => 'contact_form',
|
||||
'value' => $contact_form == 'on' ? 1 : 0
|
||||
'value' => $contact_form
|
||||
], [
|
||||
'param' => 'contact_email',
|
||||
'value' => $contact_email
|
||||
@@ -111,7 +111,7 @@ class Settings
|
||||
'value' => $visits
|
||||
], [
|
||||
'param' => 'links_structure',
|
||||
'value' => $links_structure
|
||||
'value' => $links_structure
|
||||
], [
|
||||
'param' => 'link_version',
|
||||
'value' => $link_version
|
||||
@@ -121,9 +121,6 @@ class Settings
|
||||
], [
|
||||
'param' => 'update_key',
|
||||
'value' => $update_key
|
||||
], [
|
||||
'param' => 'newsletter_cron',
|
||||
'value' => $newsletter_cron
|
||||
]
|
||||
]
|
||||
);
|
||||
@@ -138,11 +135,11 @@ class Settings
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ class Update
|
||||
public static function update()
|
||||
{
|
||||
global $mdb, $settings;
|
||||
|
||||
|
||||
\S::delete_session( 'new-version' );
|
||||
|
||||
$versions = file_get_contents( 'http://www.cmspro.project-dc.pl/updates/versions.php?key=' . $settings['update_key'] );
|
||||
|
||||
$versions = file_get_contents( 'http://www.cmspro.project-dc.pl/updates/versions.php?key=' . $settings['update_key'] );
|
||||
$versions = explode( PHP_EOL, $versions );
|
||||
|
||||
|
||||
foreach ( $versions as $ver )
|
||||
{
|
||||
$ver = trim( $ver );
|
||||
@@ -21,68 +21,136 @@ class Update
|
||||
$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' );
|
||||
|
||||
$baseUrl = 'http://www.cmspro.project-dc.pl/updates/' . $dir;
|
||||
|
||||
/* pobranie paczki ZIP */
|
||||
$file = file_get_contents( $baseUrl . '/ver_' . $ver . '.zip' );
|
||||
|
||||
$dlHandler = fopen( 'update.zip' , 'w' );
|
||||
if ( !fwrite( $dlHandler, $file ) )
|
||||
return false;
|
||||
fclose( $dlHandler );
|
||||
|
||||
|
||||
if ( !file_exists( 'update.zip' ) )
|
||||
return false;
|
||||
|
||||
/* pobranie manifestu JSON (nowy system) lub fallback na legacy _sql.txt / _files.txt */
|
||||
$manifest = null;
|
||||
$manifestJson = @file_get_contents( $baseUrl . '/ver_' . $ver . '_manifest.json' );
|
||||
if ( $manifestJson )
|
||||
{
|
||||
if ( substr( $manifestJson, 0, 3 ) === "\xEF\xBB\xBF" )
|
||||
$manifestJson = substr( $manifestJson, 3 );
|
||||
$manifest = @json_decode( $manifestJson, true );
|
||||
}
|
||||
|
||||
if ( is_array( $manifest ) )
|
||||
{
|
||||
/* weryfikacja checksum SHA256 */
|
||||
if ( !empty( $manifest['checksum_zip'] ) )
|
||||
{
|
||||
$expectedHash = str_replace( 'sha256:', '', $manifest['checksum_zip'] );
|
||||
$actualHash = hash_file( 'sha256', 'update.zip' );
|
||||
if ( $expectedHash !== $actualHash )
|
||||
{
|
||||
unlink( 'update.zip' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* aktualizacja bazy danych z manifestu */
|
||||
if ( !empty( $manifest['sql'] ) && is_array( $manifest['sql'] ) )
|
||||
{
|
||||
foreach ( $manifest['sql'] as $query )
|
||||
{
|
||||
$query = trim( $query );
|
||||
if ( $query )
|
||||
$mdb -> query( $query );
|
||||
}
|
||||
}
|
||||
|
||||
/* usuwanie plikow z manifestu */
|
||||
if ( !empty( $manifest['files']['deleted'] ) && is_array( $manifest['files']['deleted'] ) )
|
||||
{
|
||||
foreach ( $manifest['files']['deleted'] as $filePath )
|
||||
{
|
||||
$fullPath = '../' . $filePath;
|
||||
if ( file_exists( $fullPath ) )
|
||||
unlink( $fullPath );
|
||||
}
|
||||
}
|
||||
|
||||
/* usuwanie katalogow z manifestu */
|
||||
if ( !empty( $manifest['directories_deleted'] ) && is_array( $manifest['directories_deleted'] ) )
|
||||
{
|
||||
foreach ( $manifest['directories_deleted'] as $dirPath )
|
||||
{
|
||||
$fullPath = '../' . $dirPath;
|
||||
if ( is_dir( $fullPath ) )
|
||||
\S::delete_dir( $fullPath );
|
||||
}
|
||||
}
|
||||
}
|
||||
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 )
|
||||
/* legacy: aktualizacja bazy danych z _sql.txt */
|
||||
$sql = @file_get_contents( $baseUrl . '/ver_' . $ver . '_sql.txt' );
|
||||
if ( $sql )
|
||||
{
|
||||
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 )
|
||||
$sql = explode( PHP_EOL, $sql );
|
||||
if ( is_array( $sql ) ) foreach ( $sql as $query )
|
||||
{
|
||||
$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 );
|
||||
$query = trim( $query );
|
||||
if ( $query )
|
||||
$mdb -> query( $query );
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 )
|
||||
/* legacy: usuwanie zbednych plikow z _files.txt */
|
||||
$lines = @file_get_contents( $baseUrl . '/ver_' . $ver . '_files.txt' );
|
||||
if ( $lines )
|
||||
{
|
||||
$zip -> extractTo( $path );
|
||||
$zip -> close();
|
||||
unlink( $file_name );
|
||||
}
|
||||
$lines = explode( PHP_EOL, $lines );
|
||||
if ( is_array( $lines ) ) foreach ( $lines as $line )
|
||||
{
|
||||
if ( strpos( $line, 'F: ' ) !== false )
|
||||
{
|
||||
$delFile = substr( $line, 3, strlen( $line ) );
|
||||
if ( file_exists( $delFile ) )
|
||||
unlink( $delFile );
|
||||
}
|
||||
|
||||
$updateThis = fopen( '../libraries/version.ini', 'w' );
|
||||
fwrite( $updateThis, $ver );
|
||||
fclose( $updateThis );
|
||||
|
||||
return true;
|
||||
if ( strpos( $line, 'D: ' ) !== false )
|
||||
{
|
||||
$delDir = substr( $line, 3, strlen( $line ) );
|
||||
if ( is_dir( $delDir ) )
|
||||
\S::delete_dir( $delDir );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* wgrywanie nowych plikow */
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,185 +1,306 @@
|
||||
<?php
|
||||
|
||||
namespace admin\factory;
|
||||
|
||||
class Users
|
||||
class Users
|
||||
{
|
||||
public static function user_delete( $user_id )
|
||||
public static function user_delete($user_id)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
return $mdb -> delete( 'pp_users', [ 'id' => (int)$user_id ] );
|
||||
|
||||
return $mdb->delete('pp_users', ['id' => (int)$user_id]);
|
||||
}
|
||||
|
||||
public static function user_details( $user_id )
|
||||
|
||||
public static function user_details($user_id)
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> get( 'pp_users', '*', [ 'id' => (int)$user_id ] );
|
||||
return $mdb->get('pp_users', '*', ['id' => (int)$user_id]);
|
||||
}
|
||||
|
||||
public static function user_privileges( $user_id )
|
||||
|
||||
public static function user_privileges($user_id)
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> select( 'pp_users_privileges', '*', ['id_user' => (int)$user_id]);
|
||||
return $mdb->select('pp_users_privileges', '*', ['id_user' => (int)$user_id]);
|
||||
}
|
||||
|
||||
public static function user_save( $user_id, $login, $status, $active_to, $password, $password_re, $admin, $privileges )
|
||||
|
||||
public static function user_save($user_id, $login, $status, $active_to, $password, $password_re, $admin, $privileges, $twofa_enabled = 0, $twofa_email = '' )
|
||||
{
|
||||
global $mdb, $lang;
|
||||
|
||||
$mdb -> delete( 'pp_users_privileges', [ 'id_user' => (int) $user_id ] );
|
||||
$mdb->delete('pp_users_privileges', ['id_user' => (int) $user_id]);
|
||||
|
||||
if ( !$user_id )
|
||||
if (!$user_id)
|
||||
{
|
||||
if ( strlen( $password ) < 5 )
|
||||
return $response = [ 'status' => 'error', 'msg' => 'Podane hasło jest zbyt krótkie.' ];
|
||||
if (strlen($password) < 5)
|
||||
return $response = ['status' => 'error', 'msg' => 'Podane hasło jest zbyt krótkie.'];
|
||||
|
||||
if ( $password != $password_re )
|
||||
return $response = [ 'status' => 'error', 'msg' => 'Podane hasła są różne' ];
|
||||
if ($password != $password_re)
|
||||
return $response = ['status' => 'error', 'msg' => 'Podane hasła są różne'];
|
||||
|
||||
if ( $mdb -> insert( 'pp_users',
|
||||
[
|
||||
'login' => $login,
|
||||
'status' => $status == 'on' ? 1 : 0,
|
||||
'active_to' => $active_to == '' ? NULL : $active_to,
|
||||
'admin' => $admin,
|
||||
'password' => md5( $password ),
|
||||
] ) )
|
||||
$id_user = $mdb -> get( 'pp_users', 'id', [ 'ORDER' => [ 'id' => 'DESC' ] ] );
|
||||
if ($mdb->insert(
|
||||
'pp_users',
|
||||
[
|
||||
'login' => $login,
|
||||
'status' => $status == 'on' ? 1 : 0,
|
||||
'active_to' => $active_to == '' ? NULL : $active_to,
|
||||
'admin' => $admin,
|
||||
'password' => md5($password),
|
||||
'twofa_enabled' => $twofa_enabled == 'on' ? 1 : 0,
|
||||
'twofa_email' => $twofa_email
|
||||
]
|
||||
))
|
||||
$id_user = $mdb->get('pp_users', 'id', ['ORDER' => ['id' => 'DESC']]);
|
||||
|
||||
if ( is_array( $privileges ) )
|
||||
if (is_array($privileges))
|
||||
{
|
||||
foreach ( $privileges as $pri )
|
||||
foreach ($privileges as $pri)
|
||||
{
|
||||
$mdb -> insert( 'pp_users_privileges',
|
||||
[
|
||||
'name' => $pri,
|
||||
'id_user' => $id_user
|
||||
] );
|
||||
$mdb->insert(
|
||||
'pp_users_privileges',
|
||||
[
|
||||
'name' => $pri,
|
||||
'id_user' => $id_user
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mdb -> insert( 'pp_users_privileges',
|
||||
[
|
||||
'name' => $privileges,
|
||||
'id_user' => $id_user
|
||||
] );
|
||||
$mdb->insert(
|
||||
'pp_users_privileges',
|
||||
[
|
||||
'name' => $privileges,
|
||||
'id_user' => $id_user
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $response = [ 'status' => 'ok', 'msg' => 'Użytkownik został zapisany.' ];
|
||||
return $response = ['status' => 'ok', 'msg' => 'Użytkownik został zapisany.'];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ( $password and strlen( $password ) < 5 )
|
||||
return $response = [ 'status' => 'error', 'msg' => 'Podane hasło jest zbyt krótkie.' ];
|
||||
if ($password and strlen($password) < 5)
|
||||
return $response = ['status' => 'error', 'msg' => 'Podane hasło jest zbyt krótkie.'];
|
||||
|
||||
if ( $password and $password != $password_re )
|
||||
return $response = [ 'status' => 'error', 'msg' => 'Podane hasła są różne' ];
|
||||
if ($password and $password != $password_re)
|
||||
return $response = ['status' => 'error', 'msg' => 'Podane hasła są różne'];
|
||||
|
||||
if ( $password )
|
||||
$mdb -> update( 'pp_users', [
|
||||
'password' => md5( $password )
|
||||
], [
|
||||
'id' => (int) $user_id
|
||||
] );
|
||||
if ($password)
|
||||
$mdb->update('pp_users', [
|
||||
'password' => md5($password)
|
||||
], [
|
||||
'id' => (int) $user_id
|
||||
]);
|
||||
|
||||
$mdb -> update( 'pp_users', [
|
||||
'login' => $login,
|
||||
'admin' => $admin,
|
||||
'status' => $status == 'on' ? 1 : 0,
|
||||
'active_to' => $active_to == '' ? NULL : $active_to,
|
||||
'error_logged_count' => 0
|
||||
], [
|
||||
'id' => (int) $user_id
|
||||
] );
|
||||
$mdb->update('pp_users', [
|
||||
'login' => $login,
|
||||
'admin' => $admin,
|
||||
'status' => $status == 'on' ? 1 : 0,
|
||||
'active_to' => $active_to == '' ? NULL : $active_to,
|
||||
'error_logged_count' => 0,
|
||||
'twofa_enabled' => $twofa_enabled == 'on' ? 1 : 0,
|
||||
'twofa_email' => $twofa_email
|
||||
], [
|
||||
'id' => (int) $user_id
|
||||
]);
|
||||
|
||||
if ( is_array( $privileges ) )
|
||||
if (is_array($privileges))
|
||||
{
|
||||
foreach ( $privileges as $pri )
|
||||
foreach ($privileges as $pri)
|
||||
{
|
||||
$mdb -> insert( 'pp_users_privileges', [
|
||||
'name' => $pri,
|
||||
'id_user' => $user_id
|
||||
] );
|
||||
$mdb->insert('pp_users_privileges', [
|
||||
'name' => $pri,
|
||||
'id_user' => $user_id
|
||||
]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mdb -> insert( 'pp_users_privileges', [
|
||||
'name' => $privileges,
|
||||
'id_user' => $user_id
|
||||
] );
|
||||
$mdb->insert('pp_users_privileges', [
|
||||
'name' => $privileges,
|
||||
'id_user' => $user_id
|
||||
]);
|
||||
}
|
||||
return $response = [ 'status' => 'ok', 'msg' => 'Uzytkownik został zapisany.' ];
|
||||
return $response = ['status' => 'ok', 'msg' => 'Uzytkownik został zapisany.'];
|
||||
}
|
||||
\S::delete_cache();
|
||||
}
|
||||
|
||||
public static function check_login( $login, $user_id )
|
||||
public static function check_login($login, $user_id)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( $mdb -> get( 'pp_users', 'login', [ 'AND' => [ 'login' => $login, 'id[!]' => (int)$user_id ] ] ) )
|
||||
return $response = [ 'status' => 'error', 'msg' => 'Podany login jest już zajęty.' ];
|
||||
|
||||
return $response = [ 'status' => 'ok' ];
|
||||
|
||||
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 )
|
||||
|
||||
public static function logon($login, $password)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( !$mdb -> get( 'pp_users', '*', [ 'login' => $login ] ) )
|
||||
|
||||
if (!$mdb->get('pp_users', '*', ['login' => $login]))
|
||||
return 0;
|
||||
|
||||
if ( !$mdb -> get( 'pp_users', '*', [ 'AND' => [ 'login' => $login, 'status' => 1, 'error_logged_count[<]' => 5 ] ] ) )
|
||||
return -1;
|
||||
|
||||
if ( $mdb -> get( 'pp_users', '*', [
|
||||
'AND' => [
|
||||
'login' => $login, 'status' => 1, 'password' => md5( $password ),
|
||||
'OR' => [ 'active_to[>=]' => date('Y-m-d'), 'active_to' => null ]
|
||||
]
|
||||
] ) )
|
||||
|
||||
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 ] );
|
||||
$mdb->update('pp_users', ['last_logged' => date('Y-m-d H:i:s'), 'error_logged_count' => 0], ['login' => $login]);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mdb -> update( 'pp_users', [ 'last_error_logged' => date( 'Y-m-d H:i:s' ), 'error_logged_count[+]' => 1 ], [ 'login' => $login ] );
|
||||
if ( $mdb -> get( 'pp_users', 'error_logged_count', [ 'login' => $login ] ) >= 5 )
|
||||
$mdb->update('pp_users', ['last_error_logged' => date('Y-m-d H:i:s'), 'error_logged_count[+]' => 1], ['login' => $login]);
|
||||
if ($mdb->get('pp_users', 'error_logged_count', ['login' => $login]) >= 5)
|
||||
{
|
||||
$mdb -> update( 'pp_users', [ 'status' => 0 ], [ 'login' => $login ] );
|
||||
$mdb->update('pp_users', ['status' => 0], ['login' => $login]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function details( $login )
|
||||
|
||||
public static function details($login)
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> get( 'pp_users', '*', [ 'login' => $login ] );
|
||||
return $mdb->get('pp_users', '*', ['login' => $login]);
|
||||
}
|
||||
|
||||
public static function check_privileges( $name, $user_id )
|
||||
|
||||
public static function check_privileges($name, $user_id)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( $user_id == 1 )
|
||||
|
||||
if ($user_id == 1)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
if ( !$privilages = \Cache::fetch( "check_privileges:$user_id:$name-tmp" ) )
|
||||
{
|
||||
$privilages = $mdb -> count( 'pp_users_privileges', [ 'AND' => ['name' => $name, 'id_user' => (int)$user_id ]]);
|
||||
\Cache::store( "check_privileges:$user_id:$name", $privilages );
|
||||
}
|
||||
return $privilages;
|
||||
}
|
||||
if (!$privilages = \Cache::fetch("check_privileges:$user_id:$name-tmp"))
|
||||
{
|
||||
$privilages = $mdb->count('pp_users_privileges', ['AND' => ['name' => $name, 'id_user' => (int)$user_id]]);
|
||||
\Cache::store("check_privileges:$user_id:$name", $privilages);
|
||||
}
|
||||
return $privilages;
|
||||
}
|
||||
}
|
||||
|
||||
static public function get_by_id(int $userId): ?array
|
||||
{
|
||||
|
||||
global $mdb;
|
||||
return $mdb->get('pp_users', '*', ['id' => $userId]) ?: null;
|
||||
}
|
||||
|
||||
static public function send_twofa_code(int $userId, bool $resend = false): bool
|
||||
{
|
||||
|
||||
$user = self::get_by_id($userId);
|
||||
if (!$user)
|
||||
return false;
|
||||
|
||||
if ((int)$user['twofa_enabled'] !== 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$to = $user['twofa_email'] ?: $user['login'];
|
||||
if (!filter_var($to, FILTER_VALIDATE_EMAIL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($resend && !empty($user['twofa_sent_at']))
|
||||
{
|
||||
$last = strtotime($user['twofa_sent_at']);
|
||||
if ($last && (time() - $last) < 30)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$code = random_int(100000, 999999);
|
||||
$hash = password_hash((string)$code, PASSWORD_DEFAULT);
|
||||
|
||||
self::update_by_id($userId, [
|
||||
'twofa_code_hash' => $hash,
|
||||
'twofa_expires_at' => date('Y-m-d H:i:s', time() + 10 * 60), // 10 minut
|
||||
'twofa_sent_at' => date('Y-m-d H:i:s'),
|
||||
'twofa_failed_attempts' => 0,
|
||||
]);
|
||||
|
||||
$subject = 'Twój kod logowania 2FA';
|
||||
$body = "Twój kod logowania do panelu administratora: {$code}. Kod jest ważny przez 10 minut. Jeśli to nie Ty inicjowałeś logowanie – zignoruj tę wiadomość i poinformuj administratora.";
|
||||
|
||||
$sent = \S::send_email($to, $subject, $body);
|
||||
|
||||
if (!$sent) {
|
||||
$headers = "MIME-Version: 1.0\r\n";
|
||||
$headers .= "Content-type: text/plain; charset=UTF-8\r\n";
|
||||
$headers .= "From: no-reply@" . ($_SERVER['HTTP_HOST'] ?? 'localhost') . "\r\n";
|
||||
$encodedSubject = mb_encode_mimeheader($subject, 'UTF-8');
|
||||
|
||||
$sent = mail($to, $encodedSubject, $body, $headers);
|
||||
}
|
||||
|
||||
return $sent;
|
||||
}
|
||||
|
||||
static public function update_by_id(int $userId, array $data): bool
|
||||
{
|
||||
global $mdb;
|
||||
return (bool)$mdb->update('pp_users', $data, ['id' => $userId]);
|
||||
}
|
||||
|
||||
static public function verify_twofa_code(int $userId, string $code): bool
|
||||
{
|
||||
$user = self::get_by_id( $userId );
|
||||
if (!$user) return false;
|
||||
|
||||
if ((int)$user['twofa_failed_attempts'] >= 5)
|
||||
{
|
||||
return false; // zbyt wiele prób
|
||||
}
|
||||
|
||||
// sprawdź ważność
|
||||
if (empty($user['twofa_expires_at']) || time() > strtotime($user['twofa_expires_at']))
|
||||
{
|
||||
// wyczyść po wygaśnięciu
|
||||
self::update_by_id($userId, [
|
||||
'twofa_code_hash' => null,
|
||||
'twofa_expires_at' => null,
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
|
||||
$ok = (!empty($user['twofa_code_hash']) && password_verify($code, $user['twofa_code_hash']));
|
||||
if ($ok)
|
||||
{
|
||||
// sukces: czyścimy wszystko
|
||||
self::update_by_id($userId, [
|
||||
'twofa_code_hash' => null,
|
||||
'twofa_expires_at' => null,
|
||||
'twofa_sent_at' => null,
|
||||
'twofa_failed_attempts' => 0,
|
||||
'last_logged' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
|
||||
// zła próba — inkrementacja
|
||||
self::update_by_id($userId, [
|
||||
'twofa_failed_attempts' => (int)$user['twofa_failed_attempts'] + 1,
|
||||
'last_error_logged' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -7,9 +7,13 @@ class Page {
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( $_GET['module'] == 'user' && $_GET['action'] == 'twofa' ) {
|
||||
return \admin\controls\Users::twofa();
|
||||
}
|
||||
|
||||
if ( !$user || !$user['admin'] )
|
||||
return \admin\view\Users::login_form();
|
||||
|
||||
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> content = \admin\Site::route();
|
||||
return $tpl -> render( 'site/main-layout' );
|
||||
|
||||
@@ -11,15 +11,15 @@ class Pages
|
||||
$tpl -> step = $step;
|
||||
return $tpl -> render( 'pages/subpages-browse-list' );
|
||||
}
|
||||
|
||||
public static function browse_list( $menus, $modal = false )
|
||||
|
||||
static public function browse_list( $menus, $modal = false )
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> menus = $menus;
|
||||
$tpl -> modal = $modal;
|
||||
return $tpl -> render( 'pages/pages-browse-list' );
|
||||
return \Tpl::view( 'pages/pages-browse-list', [
|
||||
'menus' => $menus,
|
||||
'modal' => $modal
|
||||
] );
|
||||
}
|
||||
|
||||
|
||||
public static function page_articles( $page_id, $articles )
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
@@ -27,7 +27,7 @@ class Pages
|
||||
$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;
|
||||
@@ -39,23 +39,23 @@ class Pages
|
||||
$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' );
|
||||
return $tpl -> render( 'pages/pages-list' );
|
||||
}
|
||||
|
||||
|
||||
public static function subpages_list( $pages, $parent_id = null, $step = 1 )
|
||||
{
|
||||
$tpl = new \Tpl();
|
||||
|
||||
196
autoload/class.Article.php
Normal file
196
autoload/class.Article.php
Normal file
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
class Article implements \ArrayAccess
|
||||
{
|
||||
public function __construct( $article_id, $lang_id )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$result = $mdb -> 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 );
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,11 @@ class ImageManipulator
|
||||
* @var resource
|
||||
*/
|
||||
protected $image;
|
||||
protected $img_src;
|
||||
|
||||
/**
|
||||
* Image manipulator constructor
|
||||
*
|
||||
*
|
||||
* @param string $file OPTIONAL Path to image file or image data as string
|
||||
* @return void
|
||||
*/
|
||||
@@ -26,8 +27,10 @@ class ImageManipulator
|
||||
{
|
||||
if (null !== $file) {
|
||||
if (is_file($file)) {
|
||||
$this -> img_src = $file;
|
||||
$this->setImageFile($file);
|
||||
} else {
|
||||
echo 'a'; exit;
|
||||
$this->setImageString($file);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +38,7 @@ class ImageManipulator
|
||||
|
||||
/**
|
||||
* Set image resource from file
|
||||
*
|
||||
*
|
||||
* @param string $file Path to image file
|
||||
* @return ImageManipulator for a fluent interface
|
||||
* @throws InvalidArgumentException
|
||||
@@ -68,10 +71,10 @@ class ImageManipulator
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set image resource from string data
|
||||
*
|
||||
*
|
||||
* @param string $data
|
||||
* @return ImageManipulator for a fluent interface
|
||||
* @throws RuntimeException
|
||||
@@ -99,7 +102,7 @@ class ImageManipulator
|
||||
* @return ImageManipulator for a fluent interface
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function resample($width, $height, $constrainProportions = true)
|
||||
public function resample( $width, $height, $constrainProportions = true )
|
||||
{
|
||||
if (!is_resource($this->image)) {
|
||||
throw new RuntimeException('No image set');
|
||||
@@ -111,14 +114,44 @@ class ImageManipulator
|
||||
$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
|
||||
@@ -132,30 +165,30 @@ class ImageManipulator
|
||||
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
|
||||
@@ -171,25 +204,25 @@ class ImageManipulator
|
||||
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
|
||||
@@ -207,10 +240,10 @@ class ImageManipulator
|
||||
$this->height = imagesy($res);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save current image to file
|
||||
*
|
||||
*
|
||||
* @param string $fileName
|
||||
* @return void
|
||||
* @throws RuntimeException
|
||||
@@ -223,7 +256,7 @@ class ImageManipulator
|
||||
throw new RuntimeException('Error creating directory ' . $dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
switch ($type) {
|
||||
case IMAGETYPE_GIF :
|
||||
|
||||
9
autoload/class.Page.php
Normal file
9
autoload/class.Page.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
class Page
|
||||
{
|
||||
// pobierz rodzaj sortowania
|
||||
static public function getPageSort( $page_id )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
1417
autoload/class.S.php
1417
autoload/class.S.php
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
namespace front\controls;
|
||||
|
||||
class Site
|
||||
class Site
|
||||
{
|
||||
public static function route()
|
||||
{
|
||||
global $page, $lang_id;
|
||||
|
||||
|
||||
if ( \S::get( 'search' ) )
|
||||
{
|
||||
if ( $_POST['search_txt'] )
|
||||
@@ -15,26 +15,31 @@ class Site
|
||||
header( "Location: " . $_SERVER['REQUEST_URI'] );
|
||||
exit;
|
||||
}
|
||||
return \front\view\Search::search_results(
|
||||
\front\factory\Search::search_results( \S::get_session( 'search_txt' ), $lang_id )
|
||||
return \front\view\Search::search_results(
|
||||
\front\factory\Search::search_results( \S::get_session( 'search_txt' ), $lang_id )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ( \S::get( 'tag' ) )
|
||||
return \front\view\Articles::articles_list(
|
||||
\front\factory\Articles::articles_by_tags( \S::get( 'tag' ), $lang_id )
|
||||
return \front\view\Articles::articles_list(
|
||||
\front\factory\Articles::articles_by_tags( \S::get( 'tag' ), $lang_id )
|
||||
);
|
||||
|
||||
|
||||
if ( \S::get( 'article' ) )
|
||||
{
|
||||
$article = \front\factory\Articles::article_details( \S::get( 'article' ), $lang_id );
|
||||
|
||||
$article = new \Article( \S::get( 'article' ), $lang_id );
|
||||
if ( !\S::get_session( 'article-view-' . $article -> id ) )
|
||||
{
|
||||
$article -> updateView();
|
||||
\S::set_session( 'article-view-' . $article -> id, true );
|
||||
}
|
||||
|
||||
if ( $article['password'] and !\S::get_session( 'article-' . $article['id'] . '-' . $article['password'] ) )
|
||||
return \front\view\Articles::password_view( [ 'article' => $article ] );
|
||||
else
|
||||
return \front\view\Articles::article( [ 'article' => $article ] );
|
||||
}
|
||||
|
||||
|
||||
if ( $page['page_type'] !== null )
|
||||
{
|
||||
switch ( $page['page_type'] )
|
||||
@@ -62,43 +67,43 @@ class Site
|
||||
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.' );
|
||||
@@ -106,10 +111,10 @@ class Site
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( \S::get( 'lang' ) )
|
||||
\S::set_session( 'current-lang', \S::get( 'lang' ) );
|
||||
|
||||
|
||||
if ( file_exists( 'modules/actions.php' ) )
|
||||
include 'modules/actions.php';
|
||||
}
|
||||
|
||||
@@ -1,357 +1,479 @@
|
||||
<?php
|
||||
|
||||
namespace front\factory;
|
||||
|
||||
class Articles
|
||||
{
|
||||
public static function pixieset_save_favorite_images( $hash ) {
|
||||
{
|
||||
static public function generateTableOfContents($content)
|
||||
{
|
||||
$result = '';
|
||||
$prevLevel = 0;
|
||||
$stack = [];
|
||||
|
||||
// Tylko h1–h3
|
||||
preg_match_all('/<(h[1-3])([^>]*)>(.*?)<\/\1>/i', $content, $matches, PREG_SET_ORDER);
|
||||
|
||||
if (empty($matches))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
foreach ($matches as $match)
|
||||
{
|
||||
$level = (int)substr($match[1], 1);
|
||||
$text = trim($match[3]);
|
||||
|
||||
// Pobierz lub wygeneruj ID
|
||||
preg_match('/\sid=["\']?([^"\']+)["\']?/', $match[2], $idMatch);
|
||||
$id = isset($idMatch[1])
|
||||
? $idMatch[1]
|
||||
: strtolower(preg_replace('/[^a-z0-9]+/u', '-', html_entity_decode(strip_tags($text), ENT_QUOTES, 'UTF-8')));
|
||||
|
||||
if ($prevLevel === 0)
|
||||
{
|
||||
$prevLevel = $level;
|
||||
$stack[] = $level;
|
||||
}
|
||||
|
||||
if ($level > $prevLevel)
|
||||
{
|
||||
for ($i = $prevLevel; $i < $level; $i++)
|
||||
{
|
||||
$result .= '<ol>';
|
||||
$stack[] = $i + 1;
|
||||
}
|
||||
}
|
||||
elseif ($level < $prevLevel)
|
||||
{
|
||||
for ($i = $prevLevel; $i > $level; $i--)
|
||||
{
|
||||
$result .= '</li></ol>';
|
||||
array_pop($stack);
|
||||
}
|
||||
$result .= '</li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result .= '</li>';
|
||||
}
|
||||
|
||||
$result .= '<li><a href="#' . htmlspecialchars($id) . '">' . $text . '</a>';
|
||||
$prevLevel = $level;
|
||||
}
|
||||
|
||||
// Zamknij pozostałe listy
|
||||
while (!empty($stack))
|
||||
{
|
||||
$result .= '</li></ol>';
|
||||
array_pop($stack);
|
||||
}
|
||||
|
||||
return '<ol>' . $result . '</ol>';
|
||||
}
|
||||
|
||||
// funkcja wywoływana dla każdego dopasowania do wyrażenia regularnego
|
||||
static public function processHeaders($matches)
|
||||
{
|
||||
$level = $matches[1];
|
||||
$attrs = $matches[2];
|
||||
$content = $matches[3];
|
||||
$id_attr = 'id=';
|
||||
$id_attr_pos = strpos($attrs, $id_attr);
|
||||
if ($id_attr_pos === false)
|
||||
{ // jeśli nie ma atrybutu id
|
||||
$id = \S::seo($content);
|
||||
$attrs .= sprintf(' id="%s"', $id);
|
||||
}
|
||||
|
||||
$html = sprintf('<h%d%s>%s</h%d>', $level, $attrs, $content, $level);
|
||||
return $html;
|
||||
}
|
||||
|
||||
static public function generateHeadersIds($text)
|
||||
{
|
||||
$pattern = '/<h([1-6])(.*?)>(.*?)<\/h\1>/si';
|
||||
|
||||
$text = preg_replace_callback($pattern, array(__CLASS__, 'processHeaders'), $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
public static function pixieset_save_favorite_images($hash)
|
||||
{
|
||||
global $mdb, $settings;
|
||||
|
||||
\S::delete_dir( 'temp/' );
|
||||
|
||||
$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' );
|
||||
|
||||
|
||||
\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 = '<p>Witaj,<br />';
|
||||
$text .= 'Użytkownik zatwierdził listę wybranych przez siebie zdjęć.<br />';
|
||||
$text .= 'Poniżej znajdziesz nazwy wybranych zdjęć.</p>';
|
||||
$text .= '<ul>';
|
||||
if ( is_array( $article['images'] ) ) foreach ( $article['images'] as $image )
|
||||
if ( $image['favorite'] )
|
||||
$text .= '<li>' . basename( $image['src'] ) . '</li>';
|
||||
$text .= '</ul>';
|
||||
|
||||
\S::send_email( $settings['contact_email'], 'Powiadomienie ze strony: ' . $_SERVER['SERVER_NAME'], $text );
|
||||
if (is_array($article['images'])) foreach ($article['images'] as $image)
|
||||
if ($image['favorite'])
|
||||
$text .= '<li>' . basename($image['src']) . '</li>';
|
||||
$text .= '</ul>';
|
||||
|
||||
\S::send_email($settings['contact_email'], 'Powiadomienie ze strony: ' . $_SERVER['SERVER_NAME'], $text);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function pixieset_image_favorite( $image_id, $hash )
|
||||
|
||||
public static function pixieset_image_favorite($image_id, $hash)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$rows = $mdb -> select( 'pp_articles', [ 'id' ], [ 'hash' => $hash ] );
|
||||
if ( is_array( $rows ) ) foreach ( $rows as $row )
|
||||
|
||||
$rows = $mdb->select('pp_articles', ['id'], ['hash' => $hash]);
|
||||
if (is_array($rows)) foreach ($rows as $row)
|
||||
{
|
||||
$status = $mdb -> get( 'pp_articles_images', 'favorite', [ 'AND' => [ 'article_id' => $row['id'], 'id' => $image_id ] ] );
|
||||
$mdb -> update( 'pp_articles_images', [ 'favorite' => !$status ], [ 'AND' => [ 'article_id' => $row['id'], 'id' => $image_id ] ] );
|
||||
|
||||
\S::delete_dir( 'temp/' );
|
||||
$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 )
|
||||
|
||||
public static function article_password($article_id)
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> get( 'pp_articles', 'password', [ 'id' => $article_id ] );
|
||||
return $mdb->get('pp_articles', 'password', ['id' => $article_id]);
|
||||
}
|
||||
|
||||
public static function articles_by_tags( $tag_id, $lang_id )
|
||||
|
||||
public static function articles_by_tags($tag_id, $lang_id)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( !$articles = \Cache::fetch( "articles_by_tags:$tag_id:$lang_id" ) )
|
||||
|
||||
if (!$articles = \Cache::fetch("articles_by_tags:$tag_id:$lang_id"))
|
||||
{
|
||||
$results = $mdb -> query( 'SELECT '
|
||||
. 'pa.id '
|
||||
. 'FROM '
|
||||
. 'pp_articles AS pa '
|
||||
. 'INNER JOIN pp_articles_tags AS pat ON pat.article_id = pa.id '
|
||||
. 'WHERE '
|
||||
. 'status = 1 '
|
||||
. 'AND '
|
||||
. 'tag_id = ' . (int)$tag_id ) -> fetchAll();
|
||||
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
|
||||
$articles[] = \front\factory\Articles::article_details( $row['id'], $lang_id );
|
||||
|
||||
\Cache::store( "articles_by_tags:$tag_id:$lang_id", $articles );
|
||||
$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 )
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
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' ) )
|
||||
|
||||
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;
|
||||
$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 )
|
||||
|
||||
public static function articles_by_date($month, $year, $lang_id)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( !$articles = \Cache::fetch( "articles_by_date:$month:$year:$lang_id" ) )
|
||||
|
||||
if (!$articles = \Cache::fetch("articles_by_date:$month:$year:$lang_id"))
|
||||
{
|
||||
$results = $mdb -> query( 'SELECT '
|
||||
. 'id '
|
||||
. 'FROM '
|
||||
. 'pp_articles '
|
||||
. 'WHERE '
|
||||
. 'status = 1 '
|
||||
. 'AND '
|
||||
. '( '
|
||||
. '( date_start BETWEEN \'' . date( 'Y-m-d', strtotime( '01-' . $month . '-' . $year ) ) . '\' AND \'' . date( 'Y-m-t', strtotime( '01-' . $month . '-' . $year ) ) . '\' ) '
|
||||
. 'OR '
|
||||
. '( date_end BETWEEN \'' . date( 'Y-m-d', strtotime( '01-' . $month . '-' . $year ) ) . '\' AND \'' . date( 'Y-m-t', strtotime( '01-' . $month . '-' . $year ) ) . '\' ) '
|
||||
. 'OR '
|
||||
. '( date_start <= \'' . date( 'Y-m-t', strtotime( '01-' . $month . '-' . $year ) ) . '\' AND date_end >= \'' . date( 'Y-m-t', strtotime( '01-' . $month . '-' . $year ) ) . '\' ) '
|
||||
. ')' ) -> fetchAll();
|
||||
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
|
||||
$articles[] = \front\factory\Articles::article_details( $row['id'], $lang_id );
|
||||
|
||||
\Cache::store( "articles_by_date:$month:$year:$lang_id", $articles );
|
||||
$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 )
|
||||
|
||||
public static function news($page_id, $limit = 6, $lang_id)
|
||||
{
|
||||
if ( !$skip_entry )
|
||||
$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 )
|
||||
$dom->loadHTML(mb_convert_encoding($article['language']['entry'], 'HTML-ENTITIES', "UTF-8"));
|
||||
$images = $dom->getElementsByTagName('img');
|
||||
foreach ($images as $img)
|
||||
{
|
||||
$src = $img -> getAttribute( 'src' );
|
||||
if ( file_exists( substr( $src, 1, strlen( $src ) ) ) )
|
||||
$src = $img->getAttribute('src');
|
||||
if (file_exists(substr($src, 1, strlen($src))))
|
||||
return $src;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$dom = new \DOMDocument();
|
||||
$dom -> loadHTML( mb_convert_encoding( $article['language']['text'], 'HTML-ENTITIES', "UTF-8" ) );
|
||||
$images = $dom -> getElementsByTagName( 'img' );
|
||||
foreach ( $images as $img )
|
||||
$dom->loadHTML(mb_convert_encoding($article['language']['text'], 'HTML-ENTITIES', "UTF-8"));
|
||||
$images = $dom->getElementsByTagName('img');
|
||||
foreach ($images as $img)
|
||||
{
|
||||
$src = $img -> getAttribute( 'src' );
|
||||
if ( file_exists( substr( $src, 1, strlen( $src ) ) ) )
|
||||
$src = $img->getAttribute('src');
|
||||
if (file_exists(substr($src, 1, strlen($src))))
|
||||
return $src;
|
||||
}
|
||||
|
||||
if ( $article['images'] )
|
||||
|
||||
if ($article['images'])
|
||||
return $article['images'][0]['src'];
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function article_noindex( $article_id )
|
||||
|
||||
public static function article_noindex($article_id)
|
||||
{
|
||||
global $mdb, $lang;
|
||||
|
||||
if ( !$noindex = \Cache::fetch( "article_noindex:$article_id:" . $lang[0] ) )
|
||||
|
||||
if (!$noindex = \Cache::fetch("article_noindex:$article_id:" . $lang[0]))
|
||||
{
|
||||
$noindex = $mdb -> get( 'pp_articles_langs', 'noindex', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $lang[0] ] ] );
|
||||
|
||||
\Cache::store( "article_noindex:$article_id:" . $lang[0], $noindex );
|
||||
$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 )
|
||||
|
||||
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 )
|
||||
$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 )
|
||||
else if ($bs > $ls)
|
||||
$bs = $ls;
|
||||
|
||||
$from = $page['articles_limit'] * ( $bs - 1 );
|
||||
$from = $page['articles_limit'] * ($bs - 1);
|
||||
|
||||
if ( $from < 0 )
|
||||
if ($from < 0)
|
||||
$from = 0;
|
||||
|
||||
$results['articles'] = \front\factory\Articles::artciles_id( (int)$page['id'], $lang_id, (int)$page['articles_limit'], $page['sort_type'], $from );
|
||||
|
||||
$results['articles'] = \front\factory\Articles::artciles_id((int)$page['id'], $lang_id, (int)$page['articles_limit'], $page['sort_type'], $from);
|
||||
$results['ls'] = $ls;
|
||||
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
public static function article_details( $article_id, $lang_id )
|
||||
|
||||
public static function article_details($article_id, $lang_id)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( !$article = \Cache::fetch( "article_details:$lang_id:$article_id" ) )
|
||||
{
|
||||
$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 (!$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'] )
|
||||
if ($row['copy_from'])
|
||||
{
|
||||
$results2 = $mdb -> select( 'pp_articles_langs', '*', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $row['copy_from'] ] ] );
|
||||
if ( is_array( $results2 ) ) foreach ( $results2 as $row2 )
|
||||
$results2 = $mdb->select('pp_articles_langs', '*', ['AND' => ['article_id' => (int)$article_id, 'lang_id' => $row['copy_from']]]);
|
||||
if (is_array($results2)) foreach ($results2 as $row2)
|
||||
$article['language'] = $row2;
|
||||
}
|
||||
else
|
||||
$article['language'] = $row;
|
||||
|
||||
preg_match_all( \front\view\Site::container_pattern, $article['language']['entry'], $container_list );
|
||||
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
|
||||
|
||||
preg_match_all(\front\view\Site::container_pattern, $article['language']['entry'], $container_list);
|
||||
if (is_array($container_list[0])) foreach ($container_list[0] as $container_list_tmp)
|
||||
{
|
||||
$container_list_tmp = explode( ':', $container_list_tmp );
|
||||
$article['language']['entry'] = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $article['language']['entry'] );
|
||||
$container_list_tmp = explode(':', $container_list_tmp);
|
||||
$article['language']['entry'] = str_replace('[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer($container_list_tmp[1]), $article['language']['entry']);
|
||||
}
|
||||
|
||||
preg_match_all( \front\view\Site::container_pattern, $article['language']['text'], $container_list );
|
||||
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
|
||||
|
||||
preg_match_all(\front\view\Site::container_pattern, $article['language']['text'], $container_list);
|
||||
if (is_array($container_list[0])) foreach ($container_list[0] as $container_list_tmp)
|
||||
{
|
||||
$container_list_tmp = explode( ':', $container_list_tmp );
|
||||
$article['language']['text'] = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $article['language']['text'] );
|
||||
$container_list_tmp = explode(':', $container_list_tmp);
|
||||
$article['language']['text'] = str_replace('[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer($container_list_tmp[1]), $article['language']['text']);
|
||||
}
|
||||
}
|
||||
|
||||
$article['images'] = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC' ] ] );
|
||||
$article['files'] = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id ] );
|
||||
$article['pages'] = $mdb -> select( 'pp_articles_pages', 'page_id', [ 'article_id' => (int)$article_id ] );
|
||||
$article['tags'] = $mdb -> select( 'pp_tags', [ '[><]pp_articles_tags' => [ 'id' => 'tag_id' ] ], 'name', [ 'article_id' => (int)$article_id ] );
|
||||
$results = $mdb -> select( 'pp_articles_additional_params', [ '[><]pp_articles_additional_values' => [ 'id' => 'param_id' ] ], [ 'name', 'value', 'language_id' ], [ 'article_id' => (int)$article_id ] );
|
||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
||||
$article['images'] = $mdb->select('pp_articles_images', '*', ['article_id' => (int)$article_id, 'ORDER' => ['o' => 'ASC', 'id' => 'ASC'] ] );
|
||||
// załączniki
|
||||
$article['files'] = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC'] ] );
|
||||
$article['pages'] = $mdb->select('pp_articles_pages', 'page_id', ['article_id' => (int)$article_id]);
|
||||
$article['tags'] = $mdb->select('pp_tags', ['[><]pp_articles_tags' => ['id' => 'tag_id']], 'name', ['article_id' => (int)$article_id]);
|
||||
$results = $mdb->select('pp_articles_additional_params', ['[><]pp_articles_additional_values' => ['id' => 'param_id']], ['name', 'value', 'language_id'], ['article_id' => (int)$article_id]);
|
||||
if (is_array($results)) foreach ($results as $row)
|
||||
{
|
||||
if ( !$row['language_id'] )
|
||||
$params[ $row['name'] ] = $row['value'];
|
||||
if (!$row['language_id'])
|
||||
$params[$row['name']] = $row['value'];
|
||||
else
|
||||
$params[ $row['name'] ][$row['language_id']] = $row['value'];
|
||||
$params[$row['name']][$row['language_id']] = $row['value'];
|
||||
}
|
||||
$article['params'] = $params;
|
||||
|
||||
\Cache::store( "article_details:$lang_id:$article_id", $article );
|
||||
|
||||
\Cache::store("article_details:$lang_id:$article_id", $article);
|
||||
}
|
||||
|
||||
|
||||
return $article;
|
||||
}
|
||||
|
||||
public static function artciles_id( $page_id, $lang_id, $articles_limit, $sort_type, $from )
|
||||
|
||||
public static function artciles_id($page_id, $lang_id, $articles_limit, $sort_type, $from)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
switch ( $sort_type )
|
||||
switch ($sort_type)
|
||||
{
|
||||
case 0: $order = 'priority DESC, date_add ASC'; break;
|
||||
case 1: $order = 'priority DESC, date_add DESC'; break;
|
||||
case 2: $order = 'priority DESC, date_modify ASC'; break;
|
||||
case 3: $order = 'priority DESC, date_modify DESC'; break;
|
||||
case 4: $order = 'priority DESC, o ASC'; break;
|
||||
case 5: $order = 'priority DESC, title ASC'; break;
|
||||
case 6: $order = 'priority DESC, title DESC'; break;
|
||||
default: $order = 'priority DESC, id ASC'; break;
|
||||
case 0:
|
||||
$order = 'priority DESC, date_add ASC';
|
||||
break;
|
||||
case 1:
|
||||
$order = 'priority DESC, date_add DESC';
|
||||
break;
|
||||
case 2:
|
||||
$order = 'priority DESC, date_modify ASC';
|
||||
break;
|
||||
case 3:
|
||||
$order = 'priority DESC, date_modify DESC';
|
||||
break;
|
||||
case 4:
|
||||
$order = 'priority DESC, o ASC';
|
||||
break;
|
||||
case 5:
|
||||
$order = 'priority DESC, title ASC';
|
||||
break;
|
||||
case 6:
|
||||
$order = 'priority DESC, title DESC';
|
||||
break;
|
||||
default:
|
||||
$order = 'priority DESC, id ASC';
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !$output = \Cache::fetch( "artciles_id:$page_id:$lang_id:$order:$from:$articles_limit" ) )
|
||||
|
||||
if (!$output = \Cache::fetch("artciles_id:$page_id:$lang_id:$order:$from:$articles_limit"))
|
||||
{
|
||||
$results = $mdb -> query( 'SELECT * FROM ( '
|
||||
. 'SELECT '
|
||||
. 'a.id, date_modify, date_add, o, priority, '
|
||||
. '( CASE '
|
||||
. 'WHEN copy_from IS NULL THEN title '
|
||||
. 'WHEN copy_from IS NOT NULL THEN ( '
|
||||
. 'SELECT '
|
||||
. 'title '
|
||||
. 'FROM '
|
||||
. 'pp_articles_langs '
|
||||
. 'WHERE '
|
||||
. 'lang_id = al.copy_from AND article_id = a.id '
|
||||
. ') '
|
||||
. 'END ) AS title '
|
||||
. 'FROM '
|
||||
. 'pp_articles_pages AS ap '
|
||||
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
||||
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
||||
. 'WHERE '
|
||||
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
|
||||
. ') AS q1 '
|
||||
. 'WHERE '
|
||||
. 'q1.title IS NOT NULL '
|
||||
. 'ORDER BY '
|
||||
. 'q1.' . $order . ' '
|
||||
. 'LIMIT '
|
||||
. (int)$from . ',' . (int)$articles_limit ) -> fetchAll();
|
||||
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
|
||||
$results = $mdb->query('SELECT * FROM ( '
|
||||
. 'SELECT '
|
||||
. 'a.id, date_modify, date_add, o, priority, '
|
||||
. '( CASE '
|
||||
. 'WHEN copy_from IS NULL THEN title '
|
||||
. 'WHEN copy_from IS NOT NULL THEN ( '
|
||||
. 'SELECT '
|
||||
. 'title '
|
||||
. 'FROM '
|
||||
. 'pp_articles_langs '
|
||||
. 'WHERE '
|
||||
. 'lang_id = al.copy_from AND article_id = a.id '
|
||||
. ') '
|
||||
. 'END ) AS title '
|
||||
. 'FROM '
|
||||
. 'pp_articles_pages AS ap '
|
||||
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
||||
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
||||
. 'WHERE '
|
||||
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
|
||||
. ') AS q1 '
|
||||
. 'WHERE '
|
||||
. 'q1.title IS NOT NULL '
|
||||
. 'ORDER BY '
|
||||
. 'q1.' . $order . ' '
|
||||
. 'LIMIT '
|
||||
. (int)$from . ',' . (int)$articles_limit)->fetchAll();
|
||||
if (is_array($results) and !empty($results)) foreach ($results as $row)
|
||||
$output[] = $row['id'];
|
||||
|
||||
\Cache::store( "artciles_id:$page_id:$lang_id:$order:$from:$articles_limit", $output );
|
||||
|
||||
\Cache::store("artciles_id:$page_id:$lang_id:$order:$from:$articles_limit", $output);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function page_articles_count( $page_id, $lang_id )
|
||||
|
||||
public static function page_articles_count($page_id, $lang_id)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( !$output = \Cache::fetch( "page_articles_count:$page_id:$lang_id" ) )
|
||||
|
||||
if (!$output = \Cache::fetch("page_articles_count:$page_id:$lang_id"))
|
||||
{
|
||||
$results = $mdb -> query( 'SELECT COUNT(0) FROM ( '
|
||||
. 'SELECT '
|
||||
. 'a.id, '
|
||||
. '( CASE '
|
||||
. 'WHEN copy_from IS NULL THEN title '
|
||||
. 'WHEN copy_from IS NOT NULL THEN ( '
|
||||
. 'SELECT '
|
||||
. 'title '
|
||||
. 'FROM '
|
||||
. 'pp_articles_langs '
|
||||
. 'WHERE '
|
||||
. 'lang_id = al.copy_from AND article_id = a.id '
|
||||
. ') '
|
||||
. 'END ) AS title '
|
||||
. 'FROM '
|
||||
. 'pp_articles_pages AS ap '
|
||||
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
||||
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
||||
. 'WHERE '
|
||||
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
|
||||
. ') AS q1 '
|
||||
. 'WHERE '
|
||||
. 'q1.title IS NOT NULL' ) -> fetchAll();
|
||||
$output = $results[0][0];
|
||||
\Cache::store( "page_articles_count:$page_id:$lang_id", $output );
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
22
autoload/front/factory/class.Authors.php
Normal file
22
autoload/front/factory/class.Authors.php
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -3,51 +3,51 @@ namespace front\factory;
|
||||
|
||||
class Menu
|
||||
{
|
||||
public static function submenu_details( $page_id )
|
||||
public static function submenu_details( $page_id, $lang_id )
|
||||
{
|
||||
return self::subpages( $page_id );
|
||||
return self::subpages( $page_id, $lang_id );
|
||||
}
|
||||
|
||||
public static function subpages( $page_id )
|
||||
|
||||
static public function subpages( $page_id, $lang_id )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( !$pages = \Cache::fetch( "subpages:$page_id" ) )
|
||||
|
||||
if ( !$pages = \Cache::fetch( "subpages:$page_id:$lang_id" ) )
|
||||
{
|
||||
$results = $mdb -> select( 'pp_pages', [ 'id' ], [ 'AND' => [ 'status' => 1, 'parent_id' => $page_id ], 'ORDER' => [ 'o' => 'ASC' ] ] );
|
||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
||||
{
|
||||
$page = \front\factory\Pages::page_details( $row['id'] );
|
||||
$page['pages'] = self::subpages( $row['id'] );
|
||||
$page['pages'] = self::subpages( $row['id'], $lang_id );
|
||||
|
||||
$pages[] = $page;
|
||||
}
|
||||
|
||||
|
||||
\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 )
|
||||
{
|
||||
@@ -56,7 +56,7 @@ class Menu
|
||||
|
||||
$pages[] = $page;
|
||||
}
|
||||
|
||||
|
||||
\Cache::store( "menu_pages:$menu_id:$parent_id:$lang_id", $pages );
|
||||
}
|
||||
return $pages;
|
||||
|
||||
@@ -6,19 +6,19 @@ class Settings
|
||||
public static function settings_details()
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
|
||||
if ( !$settings = \Cache::fetch( 'settings_details' ) )
|
||||
{
|
||||
$results = $mdb -> 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;
|
||||
|
||||
@@ -10,7 +10,7 @@ class Articles
|
||||
$tpl -> $key = $val;
|
||||
return $tpl -> render( 'articles/password-view' );
|
||||
}
|
||||
|
||||
|
||||
public static function map( $settings, $map_counter )
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
@@ -18,34 +18,39 @@ class Articles
|
||||
$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 )
|
||||
|
||||
public static function news( $page_id, $articles, $template = '' )
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> page_id = $page_id;
|
||||
$tpl -> articles = $articles;
|
||||
return $tpl -> render( 'articles/news' );
|
||||
if ( $template )
|
||||
$tpl = $template;
|
||||
else
|
||||
$tpl = 'articles/news';
|
||||
|
||||
return \Tpl::view( $tpl, [
|
||||
'page_id' => $page_id,
|
||||
'articles' => $articles
|
||||
] );
|
||||
}
|
||||
|
||||
|
||||
public static function articles_list( $articles )
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> articles = $articles;
|
||||
return $tpl -> render( 'articles/articles-list' );
|
||||
}
|
||||
|
||||
|
||||
public static function article( $values )
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
@@ -53,26 +58,26 @@ class Articles
|
||||
$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;
|
||||
@@ -81,24 +86,24 @@ class Articles
|
||||
$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;
|
||||
@@ -107,28 +112,29 @@ class Articles
|
||||
$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
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> article = $article_details;
|
||||
$out .= $tpl -> render( 'articles/article-full' );
|
||||
{
|
||||
$out .= \Tpl::view( 'articles/article-full', [
|
||||
'article' => $article_details,
|
||||
'table_of_contents' => \front\factory\Articles::generateTableOfContents( $article_details['language']['text'] )
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( $results['ls'] > 1 )
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
@@ -137,7 +143,7 @@ class Articles
|
||||
$tpl -> page = $page;
|
||||
$out .= $tpl -> render( 'site/pager' );
|
||||
}
|
||||
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace front\view;
|
||||
|
||||
class Site
|
||||
@@ -8,355 +9,400 @@ class Site
|
||||
const submenu_pattern = '/SUBMENU:[0-9]*/';
|
||||
const container_pattern = '/KONTENER:[0-9]*/';
|
||||
const language_pattern = '/LANG:[a-zA-Z0-9_-]*/';
|
||||
const news_pattern = '/AKTUALNOSCI:([0-9]*)((:([0-9]*))?)/';
|
||||
const news_pattern = '/AKTUALNOSCI:([0-9]+)(?::([0-9]*))?(?::([^:\]]+))?/';
|
||||
const news_list_pattern = '/AKTUALNOSCI_LISTA:([0-9]*)((:([0-9]*))?)/';
|
||||
const top_news_pattern = '/NAJPOULARNIEJSZE_ARTYKULY:([0-9]*)((:([0-9]*))?)/';
|
||||
const article_pattern = '/ARTYKUL:[0-9]*/';
|
||||
const maps_pattern = '/\[MAPA](.*)\[\/MAPA]/';
|
||||
|
||||
|
||||
public static function show()
|
||||
{
|
||||
global $page, $settings, $lang, $lang_id;
|
||||
|
||||
if ( \S::get( 'article' ) )
|
||||
$layout = \front\factory\Layouts::article_layout( \S::get( 'article' ) );
|
||||
|
||||
if ( !$layout )
|
||||
$layout = \front\factory\Layouts::active_layout( $page['id'] );
|
||||
|
||||
if ( \S::get( 'layout_id' ) )
|
||||
$layout = \front\factory\Layouts::layout_details( \S::get( 'layout_id' ) );
|
||||
|
||||
if ( $settings['devel'] == true and file_exists( 'devel.html' ) )
|
||||
$html = file_get_contents( 'devel.html' );
|
||||
global $page, $settings, $lang_id;
|
||||
|
||||
$settings['link_version'] ? $www = 'www.' : $www = '';
|
||||
$settings['ssl'] == true ? $domain_prefix = 'https' : $domain_prefix = 'http';
|
||||
$url = preg_replace('#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME']);
|
||||
|
||||
if (\S::get('article'))
|
||||
$layout = \front\factory\Layouts::article_layout(\S::get('article'));
|
||||
|
||||
if (!$layout)
|
||||
$layout = \front\factory\Layouts::active_layout($page['id']);
|
||||
|
||||
if (\S::get('layout_id'))
|
||||
$layout = \front\factory\Layouts::layout_details(\S::get('layout_id'));
|
||||
|
||||
if ($settings['devel'] == true and file_exists('devel.html'))
|
||||
$html = file_get_contents('devel.html');
|
||||
else
|
||||
{
|
||||
if ( \S::is_mobile() and !empty( $layout['m_html'] ) )
|
||||
if (\S::is_mobile() and !empty($layout['m_html']))
|
||||
$html = $layout['m_html'];
|
||||
else
|
||||
$html = $layout['html'];
|
||||
}
|
||||
|
||||
\S::set_session( 'layout_id', $layout['layout_id'] ? $layout['layout_id'] : $layout['id'] );
|
||||
|
||||
if ( $settings['google_search_console'] )
|
||||
$html = str_replace( '</head>', '<meta name="google-site-verification" content="' . $settings['google_search_console'] . '"></head>', $html );
|
||||
|
||||
if ( \S::get_session( 'contrast' ) )
|
||||
$html = str_replace( '</head>', '<link rel="stylesheet" type="text/css" href="/layout/contrast.css"></head>', $html );
|
||||
|
||||
if ( $settings['facebook_link'] )
|
||||
$html = str_replace( '</body>', \front\view\Site::facebook( $settings['facebook_link'] ) . '</body>', $html );
|
||||
|
||||
if ( strpos( $html, '[BANER_STRONA_GLOWNA]' ) === false )
|
||||
$html = str_replace( '</body>', '[BANER_STRONA_GLOWNA]' . '</body>', $html );
|
||||
|
||||
if ( strpos( $html, '[WIDGET_TELEFON]' ) === false )
|
||||
$html = str_replace( '</body>', '[WIDGET_TELEFON]' . '</body>', $html );
|
||||
|
||||
if ( $settings['ssl'] == true )
|
||||
\S::set_session('layout_id', $layout['layout_id'] ? $layout['layout_id'] : $layout['id']);
|
||||
|
||||
if ($settings['google_search_console'])
|
||||
$html = str_replace('</head>', '<meta name="google-site-verification" content="' . $settings['google_search_console'] . '"></head>', $html);
|
||||
|
||||
if (\S::get_session('contrast'))
|
||||
$html = str_replace('</head>', '<link rel="stylesheet" type="text/css" href="/layout/contrast.css"></head>', $html);
|
||||
|
||||
if ($settings['facebook_link'])
|
||||
$html = str_replace('</body>', \front\view\Site::facebook($settings['facebook_link']) . '</body>', $html);
|
||||
|
||||
if (strpos($html, '[BANER_STRONA_GLOWNA]') === false)
|
||||
$html = str_replace('</body>', '[BANER_STRONA_GLOWNA]' . '</body>', $html);
|
||||
|
||||
if (strpos($html, '[WIDGET_TELEFON]') === false)
|
||||
$html = str_replace('</body>', '[WIDGET_TELEFON]' . '</body>', $html);
|
||||
|
||||
if ($settings['ssl'] == true)
|
||||
{
|
||||
$layout['css'] = str_replace( 'http://', 'https://', $layout['css'] );
|
||||
$layout['js'] = str_replace( 'http://', 'https://', $layout['js'] );
|
||||
$layout['m_css'] = str_replace( 'http://', 'https://', $layout['m_css'] );
|
||||
$layout['m_js'] = str_replace( 'http://', 'https://', $layout['m_js'] );
|
||||
$layout['css'] = str_replace('http://', 'https://', $layout['css']);
|
||||
$layout['js'] = str_replace('http://', 'https://', $layout['js']);
|
||||
$layout['m_css'] = str_replace('http://', 'https://', $layout['m_css']);
|
||||
$layout['m_js'] = str_replace('http://', 'https://', $layout['m_js']);
|
||||
}
|
||||
|
||||
$html = str_replace( '[COPYRIGHT]', \front\view\Site::copyright(), $html );
|
||||
$html = str_replace( '[BANER_STRONA_GLOWNA]', \front\view\Banners::main_banner( \front\factory\Banners::main_banner() ), $html );
|
||||
$html = str_replace( '[BANERY]', \front\view\Banners::banners( \front\factory\Banners::banners() ), $html );
|
||||
$html = str_replace( '[LICZNIK_ODWIEDZIN]', \front\view\Site::visit_counter( \S::get_session( 'visits' ) ), $html );
|
||||
$html = str_replace( '[WYSZUKIWARKA]', \front\view\Search::search_form(), $html );
|
||||
$html = str_replace( '[CHMURA_TAGOW]', \front\view\Articles::tags_cloud(), $html );
|
||||
$html = str_replace( '[KONTRAST]', \front\view\Site::contrast(), $html );
|
||||
$html = str_replace( '[NEWSLETTER]', \front\view\Newsletter::newsletter(), $html );
|
||||
$html = str_replace( '[WIDGET_TELEFON]', $settings['widget_phone'] == 1 ? \front\view\Site::widget_phone() : '', $html );
|
||||
|
||||
if ( \S::is_mobile() and !empty( $layout['m_html'] ) )
|
||||
$html = str_replace( '[CSS]', $layout['m_css'], $html );
|
||||
|
||||
$html = str_replace('[COPYRIGHT]', \front\view\Site::copyright(), $html);
|
||||
$html = str_replace('[BANER_STRONA_GLOWNA]', \front\view\Banners::main_banner(\front\factory\Banners::main_banner()), $html);
|
||||
$html = str_replace('[BANERY]', \front\view\Banners::banners(\front\factory\Banners::banners()), $html);
|
||||
$html = str_replace('[LICZNIK_ODWIEDZIN]', \front\view\Site::visit_counter(\S::get_session('visits')), $html);
|
||||
$html = str_replace('[WYSZUKIWARKA]', \front\view\Search::search_form(), $html);
|
||||
$html = str_replace('[CHMURA_TAGOW]', \front\view\Articles::tags_cloud(), $html);
|
||||
$html = str_replace('[KONTRAST]', \front\view\Site::contrast(), $html);
|
||||
$html = str_replace('[NEWSLETTER]', \front\view\Newsletter::newsletter(), $html);
|
||||
$html = str_replace('[WIDGET_TELEFON]', $settings['widget_phone'] == 1 ? \front\view\Site::widget_phone() : '', $html);
|
||||
|
||||
if (\S::is_mobile() and !empty($layout['m_html']))
|
||||
$html = str_replace('[CSS]', $layout['m_css'], $html);
|
||||
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 );
|
||||
$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 )
|
||||
$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 );
|
||||
$menu_tmp = explode(':', $menu_tmp);
|
||||
$html = str_replace('[MENU:' . $menu_tmp[1] . ']', \front\view\Menu::menu(
|
||||
\front\factory\Menu::menu_details($menu_tmp[1]),
|
||||
$page['id']
|
||||
), $html);
|
||||
}
|
||||
|
||||
preg_match_all( self::main_menu_pattern, $html, $menu );
|
||||
if ( is_array( $menu[0] ) ) foreach( $menu[0] as $menu_tmp )
|
||||
|
||||
preg_match_all(self::main_menu_pattern, $html, $menu);
|
||||
if (is_array($menu[0])) foreach ($menu[0] as $menu_tmp)
|
||||
{
|
||||
$menu_tmp = explode( ':', $menu_tmp );
|
||||
$html = str_replace( '[MENU_GLOWNE:' . $menu_tmp[1] . ']', \front\view\Menu::main_menu(
|
||||
\front\factory\Menu::menu_details( $menu_tmp[1] ), $page['id']
|
||||
), $html );
|
||||
$menu_tmp = explode(':', $menu_tmp);
|
||||
$html = str_replace('[MENU_GLOWNE:' . $menu_tmp[1] . ']', \front\view\Menu::main_menu(
|
||||
\front\factory\Menu::menu_details($menu_tmp[1]),
|
||||
$page['id']
|
||||
), $html);
|
||||
}
|
||||
|
||||
preg_match_all( self::submenu_pattern, $html, $submenu );
|
||||
if ( is_array( $submenu[0] ) ) foreach( $submenu[0] as $submenu_tmp )
|
||||
|
||||
preg_match_all(self::submenu_pattern, $html, $submenu);
|
||||
if (is_array($submenu[0])) foreach ($submenu[0] as $submenu_tmp)
|
||||
{
|
||||
$submenu_tmp = explode( ':', $submenu_tmp );
|
||||
$html = str_replace( '[SUBMENU:' . $submenu_tmp[1] . ']', \front\view\Menu::submenu(
|
||||
\front\factory\Menu::submenu_details( $submenu_tmp[1] ), $page['id'], $submenu_tmp[1]
|
||||
), $html );
|
||||
$submenu_tmp = explode(':', $submenu_tmp);
|
||||
$html = str_replace('[SUBMENU:' . $submenu_tmp[1] . ']', \front\view\Menu::submenu(
|
||||
\front\factory\Menu::submenu_details($submenu_tmp[1], $lang_id),
|
||||
$page['id'],
|
||||
$submenu_tmp[1]
|
||||
), $html);
|
||||
}
|
||||
|
||||
preg_match_all( self::container_pattern, $html, $container_list );
|
||||
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
|
||||
|
||||
preg_match_all(self::container_pattern, $html, $container_list);
|
||||
if (is_array($container_list[0])) foreach ($container_list[0] as $container_list_tmp)
|
||||
{
|
||||
$container_list_tmp = explode( ':', $container_list_tmp );
|
||||
$html = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $html );
|
||||
$container_list_tmp = explode(':', $container_list_tmp);
|
||||
$html = str_replace('[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer($container_list_tmp[1]), $html);
|
||||
}
|
||||
|
||||
$html = str_replace( '[ZAWARTOSC]', \front\controls\Site::route(), $html );
|
||||
|
||||
|
||||
$html = str_replace('[ZAWARTOSC]', \front\controls\Site::route(), $html);
|
||||
|
||||
preg_match_all( self::news_pattern, $html, $news_list );
|
||||
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
|
||||
if ( is_array( $news_list[0] ) )
|
||||
{
|
||||
$news_list_tmp = explode( ':', $news_list_tmp );
|
||||
|
||||
foreach ( $news_list[0] as $index => $news_list_tmp )
|
||||
{
|
||||
$id = $news_list[1][$index];
|
||||
$limit = $news_list[2][$index] ?: $settings['news_limit'];
|
||||
$extra = $news_list[3][$index] ?? '';
|
||||
|
||||
$pattern_parts = ['AKTUALNOSCI', $id];
|
||||
if ($news_list[2][$index] !== '') $pattern_parts[] = $limit;
|
||||
if ($extra !== '') $pattern_parts[] = $extra;
|
||||
$pattern = '[' . implode(':', $pattern_parts) . ']';
|
||||
|
||||
$html = str_replace(
|
||||
$pattern,
|
||||
\front\view\Articles::news( $id, \front\factory\Articles::news( $id, $limit, $lang_id ), $extra ),
|
||||
$html
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// prosta lista aktualności z wybranej podstrony
|
||||
preg_match_all(self::news_list_pattern, $html, $news_list);
|
||||
if (is_array($news_list[0])) foreach ($news_list[0] as $news_list_tmp)
|
||||
{
|
||||
$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 );
|
||||
$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);
|
||||
}
|
||||
|
||||
preg_match_all( self::language_pattern, $html, $language_list );
|
||||
if ( is_array( $language_list[0] ) ) foreach( $language_list[0] as $language_list_tmp )
|
||||
|
||||
// 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)
|
||||
{
|
||||
$language_list_tmp = explode( ':', $language_list_tmp );
|
||||
$html = str_replace( '[LANG:' . $language_list_tmp[1] . ']', \S::lang( $language_list_tmp[1] ), $html );
|
||||
$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);
|
||||
}
|
||||
|
||||
if ( \S::get( 'article' ) )
|
||||
|
||||
preg_match_all(self::language_pattern, $html, $language_list);
|
||||
if (is_array($language_list[0])) foreach ($language_list[0] as $language_list_tmp)
|
||||
{
|
||||
$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'];
|
||||
$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' ) )
|
||||
else if (\S::get('tag'))
|
||||
{
|
||||
$tag = \front\factory\Articles::tag_details( \S::get( 'tag' ) );
|
||||
|
||||
$tag = \front\factory\Articles::tag_details(\S::get('tag'));
|
||||
|
||||
$title = 'Tag: ' . $tag['name'];
|
||||
$meta_keywords = $tag['name'];
|
||||
$meta_description = 'Artykuły oznaczone tagiem: ' . $tag['name'];
|
||||
}
|
||||
else if ( \S::get( 'search' ) )
|
||||
{
|
||||
$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 (\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'] )
|
||||
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 )
|
||||
if (is_array($seo_additional) and count($seo_additional)) foreach ($seo_additional as $seo)
|
||||
{
|
||||
preg_match( '/' . str_replace( '/', '\/', $seo['url'] ) . '/', $_SERVER['REQUEST_URI'], $seo_results );
|
||||
if ( is_array( $seo_results ) and count( $seo_results ) )
|
||||
preg_match('/' . str_replace('/', '\/', $seo['url']) . '/', $_SERVER['REQUEST_URI'], $seo_results);
|
||||
if (is_array($seo_results) and count($seo_results))
|
||||
{
|
||||
if ( $seo['title'] )
|
||||
if ($seo['title'])
|
||||
$title = $seo['title'];
|
||||
|
||||
if ( $seo['keywords'] )
|
||||
|
||||
if ($seo['keywords'])
|
||||
$meta_keywords = $seo['keywords'];
|
||||
|
||||
if ( $meta_description )
|
||||
|
||||
if ($meta_description)
|
||||
$meta_description = $seo['description'];
|
||||
|
||||
if ( $seo['text'] )
|
||||
$html = str_replace( '[DODATKOWA_TRESC]', '<div class="seo-additional-text">' . $seo['text'] . '</div>', $html );
|
||||
|
||||
if ($seo['text'])
|
||||
$html = str_replace('[DODATKOWA_TRESC]', '<div class="seo-additional-text">' . $seo['text'] . '</div>', $html);
|
||||
else
|
||||
$html = str_replace( '[DODATKOWA_TRESC]', '', $html );
|
||||
$html = str_replace('[DODATKOWA_TRESC]', '', $html);
|
||||
}
|
||||
}
|
||||
|
||||
$html = str_replace( '[DODATKOWA_TRESC]', '', $html );
|
||||
$html = str_replace( '[TITLE]', $title, $html );
|
||||
$html = str_replace( '[META_KEYWORDS]', $meta_keywords, $html );
|
||||
$html = str_replace( '[META_DESCRIPTION]', $meta_description, $html );
|
||||
$html = str_replace( '[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 )
|
||||
|
||||
$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 );
|
||||
$article_tmp = explode(':', $article_tmp);
|
||||
$html = str_replace('[ARTYKUL:' . $article_tmp[1] . ']', \front\view\Articles::article_full($article_tmp[1], $lang_id), $html);
|
||||
}
|
||||
|
||||
|
||||
/* atrybut noindex */
|
||||
if ( \S::get( 'article' ) )
|
||||
if (\S::get('article'))
|
||||
{
|
||||
\front\factory\Articles::article_noindex( \S::get( 'article' ) ) === '1' ? $noindex = 'noindex' : $noindex = 'index, follow';
|
||||
$html = str_replace( '[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html );
|
||||
\front\factory\Articles::article_noindex(\S::get('article')) === '1' ? $noindex = 'noindex' : $noindex = 'index, follow';
|
||||
$html = str_replace('[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html);
|
||||
}
|
||||
else
|
||||
{
|
||||
$page['language']['noindex'] === '1' ? $noindex = 'noindex' : $noindex = 'index, follow';
|
||||
$html = str_replace( '[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html );
|
||||
$html = str_replace('[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html);
|
||||
}
|
||||
|
||||
if ( $page['language']['canonical'] )
|
||||
$html = str_replace( '</head>', '<link rel="canonical" href="' . $page['language']['canonical'] . '" /></head>', $html );
|
||||
|
||||
while ( strpos( $html, '[PHP]' ) !== false )
|
||||
|
||||
if ($page['language']['canonical'])
|
||||
$html = str_replace('</head>', '<link rel="canonical" href="' . $page['language']['canonical'] . '" /></head>', $html);
|
||||
|
||||
while (strpos($html, '[PHP]') !== false)
|
||||
{
|
||||
$text = explode( '[PHP]', $html );
|
||||
$text = explode('[PHP]', $html);
|
||||
$before = $text[0];
|
||||
for ( $i = 1; $i < count( $text ); $i++ )
|
||||
for ($i = 1; $i < count($text); $i++)
|
||||
{
|
||||
$temp = explode( '[/PHP]' , $text[$i] );
|
||||
$temp = explode('[/PHP]', $text[$i]);
|
||||
$code = $temp[0];
|
||||
|
||||
|
||||
ob_start();
|
||||
eval( str_replace( ''', '"', $code ) );
|
||||
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] ) )
|
||||
|
||||
preg_match_all(self::maps_pattern, $html, $maps_list);
|
||||
if (is_array($maps_list[1]) and !empty($maps_list[1]))
|
||||
{
|
||||
$html = strrev( implode( strrev( '<link class="footer" rel="stylesheet" type="text/css" href="/libraries/leaflet/leaflet.css"><script class="footer" type="text/javascript" src="/libraries/leaflet/leaflet.js"></script></head>' ), explode( strrev( '</head>' ), strrev( $html ), 2 ) ) );
|
||||
foreach( $maps_list[1] as $map_tmp )
|
||||
$html = strrev(implode(strrev('<link class="footer" rel="stylesheet" type="text/css" href="/libraries/leaflet/leaflet.css"><script class="footer" type="text/javascript" src="/libraries/leaflet/leaflet.js"></script></head>'), explode(strrev('</head>'), strrev($html), 2)));
|
||||
foreach ($maps_list[1] as $map_tmp)
|
||||
{
|
||||
++$map_counter;
|
||||
$map_settings = explode( '|', $map_tmp );
|
||||
$html = str_replace( '[MAPA]' . $map_tmp . '[/MAPA]', \front\view\Articles::map( $map_settings, $map_counter ), $html );
|
||||
$map_settings = explode('|', $map_tmp);
|
||||
$html = str_replace('[MAPA]' . $map_tmp . '[/MAPA]', \front\view\Articles::map($map_settings, $map_counter), $html);
|
||||
}
|
||||
}
|
||||
|
||||
$html = str_replace( '[ALERT]', \front\view\Site::alert(), $html );
|
||||
|
||||
|
||||
$html = str_replace('[ALERT]', \front\view\Site::alert(), $html);
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
public static function widget_phone()
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
return $tpl -> render( 'widgets/widget-phone' );
|
||||
return $tpl->render('widgets/widget-phone');
|
||||
}
|
||||
|
||||
public static function facebook( $facebook_link )
|
||||
|
||||
public static function facebook($facebook_link)
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> facebook_link = $facebook_link;
|
||||
return $tpl -> render( 'site/facebook' );
|
||||
$tpl->facebook_link = $facebook_link;
|
||||
return $tpl->render('site/facebook');
|
||||
}
|
||||
|
||||
public static function title( $title, $show_title, $site_title )
|
||||
|
||||
public static function title($title, $show_title, $site_title)
|
||||
{
|
||||
if ( !$show_title )
|
||||
if (!$show_title)
|
||||
return false;
|
||||
|
||||
if ( $site_title )
|
||||
|
||||
if ($site_title)
|
||||
$title = $site_title;
|
||||
|
||||
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> title = $title;
|
||||
return $tpl -> render( 'site/title' );
|
||||
$tpl->title = $title;
|
||||
return $tpl->render('site/title');
|
||||
}
|
||||
|
||||
public static function alert()
|
||||
|
||||
static public function alert()
|
||||
{
|
||||
if ( $alert = \S::get_session( 'alert' ) )
|
||||
{
|
||||
$alert_class = \S::get_session( 'alert-class' );
|
||||
\S::delete_session( 'alert' );
|
||||
\S::delete_session( 'alert-class' );
|
||||
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> alert = $alert;
|
||||
$tpl -> alert_class = $alert_class;
|
||||
return $tpl -> render( 'site/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' );
|
||||
return $tpl->render('site/copyright');
|
||||
}
|
||||
|
||||
|
||||
public static function contact()
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
return $tpl -> render( 'site/contact' );
|
||||
return $tpl->render('site/contact');
|
||||
}
|
||||
|
||||
|
||||
public static function cookie_information()
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
return $tpl -> render( 'site/cookie-information' );
|
||||
return $tpl->render('site/cookie-information');
|
||||
}
|
||||
|
||||
public static function calendar( $month = '', $year = '', $ajax = false )
|
||||
|
||||
public static function calendar($month = '', $year = '', $ajax = false)
|
||||
{
|
||||
global $settings, $lang_id;
|
||||
|
||||
if ( !$settings['calendar'] )
|
||||
|
||||
if (!$settings['calendar'])
|
||||
return false;
|
||||
|
||||
if ( !$month ) $month = date( 'n' );
|
||||
if ( !$year ) $year = date( 'Y' );
|
||||
|
||||
|
||||
if (!$month) $month = date('n');
|
||||
if (!$year) $year = date('Y');
|
||||
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> month = $month;
|
||||
$tpl -> year = $year;
|
||||
$tpl -> months = \S::months();
|
||||
$tpl -> ajax = $ajax;
|
||||
$tpl -> articles = \front\factory\Articles::articles_by_date( $month, $year, $lang_id );
|
||||
return $tpl -> render( 'site/calendar' );
|
||||
$tpl->month = $month;
|
||||
$tpl->year = $year;
|
||||
$tpl->months = \S::months();
|
||||
$tpl->ajax = $ajax;
|
||||
$tpl->articles = \front\factory\Articles::articles_by_date($month, $year, $lang_id);
|
||||
return $tpl->render('site/calendar');
|
||||
}
|
||||
|
||||
public static function visit_counter( $visit_counter )
|
||||
|
||||
public static function visit_counter($visit_counter)
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
$tpl -> visit_counter = $visit_counter;
|
||||
return $tpl -> render( 'site/visit-counter' );
|
||||
$tpl->visit_counter = $visit_counter;
|
||||
return $tpl->render('site/visit-counter');
|
||||
}
|
||||
|
||||
|
||||
public static function contrast()
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
return $tpl -> render( 'site/contrast' );
|
||||
return $tpl->render('site/contrast');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -13,11 +13,11 @@ RewriteRule ^admin/([^/]*)/([^/]*)/(.*)$ admin/index.php?module=$1&action=$2&$3
|
||||
{PIXIESET]
|
||||
{ADDITIONAL_CLASSES}
|
||||
RewriteRule ^admin/$ admin/index.php [L]
|
||||
RewriteRule ^wyszukiwarka$ index.php?search=true&lang=pl [L]
|
||||
RewriteRule ^wersja-tymczasowa$ index.php?devel=true&lang=pl [L]
|
||||
RewriteRule ^wyszukiwarka(|/)$ index.php?search=true&lang=pl [L]
|
||||
RewriteRule ^wersja-tymczasowa(|/)$ index.php?devel=true&lang=pl [L]
|
||||
RewriteRule ^pixieset/(.*)$ index.php?module=articles&action=image&hash=$1 [L]
|
||||
RewriteRule ^pixieset-wszystkie/(.*)$ index.php?module=articles&action=images_download&hash=$1 [L]
|
||||
RewriteRule ^audyt-seo/wynik$ index.php?module=auditSEO&action=main_view&%{QUERY_STRING} [L]
|
||||
RewriteRule ^audyt-seo/wynik(|/)$ index.php?module=auditSEO&action=main_view&%{QUERY_STRING} [L]
|
||||
|
||||
RewriteCond %{REQUEST_URI} ^/auditSEO/(.*) [NC]
|
||||
RewriteRule ^([^/]*)/([^/]*)/(.*)$ index.php?module=$1&action=$2&$3 [L]
|
||||
|
||||
Reference in New Issue
Block a user