first commit

This commit is contained in:
2023-05-08 09:03:09 +02:00
commit 94149e1c6a
286 changed files with 19144 additions and 0 deletions

93
.htaccess Normal file
View File

@@ -0,0 +1,93 @@
RewriteEngine On
RewriteBase /
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} ^rockowa.com
RewriteRule ^(.*)$ http://www.rockowa.com/$1 [R=permanent,L]
ErrorDocument 404 http://www.rockowa.com/
RewriteCond %{REQUEST_URI} ^/home
RewriteRule ^(.*)$ http://www.rockowa.com/ [R=permanent,L]
RewriteCond %{REQUEST_URI} ^/s,1,home
RewriteRule ^(.*)$ http://www.rockowa.com/ [R=permanent,L]
RewriteRule ^$ index.php?rw=change_site&id=1 [L]
RewriteRule ^admin/strona_glowna$ admin/index.php [L]
RewriteRule ^szablon,([^-]+)$ index.php?template=$1 [L]
RewriteRule ^lang,([^-]+)$ index.php?rw=change_language&id=$1 [L]
RewriteRule ^s,([0-9]+),([^,]+)$ index.php?rw=change_site&id=$1 [L]
RewriteRule ^s,([0-9]+),([0-9]+),([^,]+)$ index.php?rw=change_site&id=$1&bs=$2 [L]
RewriteRule ^a,([0-9]+),([^,]+)$ index.php?art=$1 [L]
RewriteRule ^rejestracja$ index.php?rw=change_site&type=registration [L]
RewriteRule ^odzyskaj_haslo$ index.php?rw=change_site&type=password_recovery [L]
RewriteRule ^wyszukiwarka$ index.php?rw=change_site&type=search [L]
RewriteRule ^([0-9]+),wyszukiwarka$ index.php?rw=change_site&type=search&bs=$1 [L]
RewriteRule ^mapa_strony$ index.php?rw=change_site&type=sitemap [L]
RewriteRule ^pobierz,([0-9]+)$ index.php?download=$1 [L]
<files htaccess.conf>
Order deny,allow
deny from all
</files>
<files database.conf>
Order deny,allow
deny from all
</files>
RewriteRule ^home$ index.php?rw=change_site&id=1 [L]
RewriteRule ^sale$ index.php?rw=change_site&id=14 [L]
RewriteRule ^aktualnosci$ index.php?rw=change_site&id=2 [L]
RewriteRule ^cennik$ index.php?rw=change_site&id=3 [L]
RewriteRule ^logo$ index.php?rw=change_site&id=11 [L]
RewriteRule ^kalendarz$ index.php?rw=change_site&id=5 [L]
RewriteRule ^o-szkole$ index.php?rw=change_site&id=6 [L]
RewriteRule ^kontakt$ index.php?rw=change_site&id=9 [L]
RewriteRule ^kadra$ index.php?rw=change_site&id=12 [L]
RewriteRule ^galeria$ index.php?rw=change_site&id=13 [L]
RewriteRule ^gitara$ index.php?art=$167 [L]
RewriteRule ^o-szkole$ index.php?art=$18 [L]
RewriteRule ^gitarowy-zawrot-glowy$ index.php?art=$110 [L]
RewriteRule ^mira-kubasinksa-koncert$ index.php?art=$111 [L]
RewriteRule ^damian-zajac$ index.php?art=$112 [L]
RewriteRule ^dariusz-majewski$ index.php?art=$113 [L]
RewriteRule ^miroslaw-wysokinski$ index.php?art=$114 [L]
RewriteRule ^marcin-grzesik$ index.php?art=$193 [L]
RewriteRule ^oscar-kuzniar$ index.php?art=$115 [L]
RewriteRule ^przemyslaw-obirek$ index.php?art=$116 [L]
RewriteRule ^tomasz-pielaszkiewicz$ index.php?art=$117 [L]
RewriteRule ^sladamia-bieszczadzkich-aniolow$ index.php?art=$119 [L]
RewriteRule ^bezplatne-warsztaty-gitarowe$ index.php?art=$120 [L]
RewriteRule ^dawid-klimkowski$ index.php?art=$121 [L]
RewriteRule ^wigilia-2012$ index.php?art=$122 [L]
RewriteRule ^rockowe-ferie-w-rsm-2013$ index.php?art=$123 [L]
RewriteRule ^wetlina-2013$ index.php?art=$125 [L]
RewriteRule ^letni-oboz-muzyczny-2013$ index.php?art=$126 [L]
RewriteRule ^michal-kornaga$ index.php?art=$127 [L]
RewriteRule ^artur-sikora$ index.php?art=$131 [L]
RewriteRule ^rockowe-ferie-w-rsm-2014$ index.php?art=$138 [L]
RewriteRule ^oboz-muzyczny-2014$ index.php?art=$139 [L]
RewriteRule ^zdjecia-osrodka$ index.php?art=$140 [L]
RewriteRule ^dni-otwarte-w-rockowej-szkole-muzycznej$ index.php?art=$146 [L]
RewriteRule ^pawel-kus$ index.php?art=$148 [L]
RewriteRule ^bartosz-mierzejewski$ index.php?art=$149 [L]
RewriteRule ^oboz-muzyczny-2015$ index.php?art=$150 [L]
RewriteRule ^wojciech-woloszynski$ index.php?art=$159 [L]
RewriteRule ^pianino$ index.php?art=$169 [L]
RewriteRule ^letni-oboz-muzyczny-2017$ index.php?art=$177 [L]
RewriteRule ^wokal$ index.php?art=$168 [L]
RewriteRule ^natalia-wojcik$ index.php?art=$192 [L]
RewriteRule ^perkusja$ index.php?art=$170 [L]
RewriteRule ^skrzypce$ index.php?art=$171 [L]
RewriteRule ^gitara-basowa$ index.php?art=$172 [L]
RewriteRule ^katarzyna-burkot$ index.php?art=$173 [L]
RewriteRule ^obozy-muzyczne$ index.php?art=$175 [L]
RewriteRule ^oboz-muzyczny-2018$ index.php?art=$185 [L]
RewriteRule ^ukulele$ index.php?art=$187 [L]
RewriteRule ^ferie-2019$ index.php?art=$188 [L]
RewriteRule ^oboz-muzyczny-2019$ index.php?art=$190 [L]
RewriteRule ^krzysztof-zieminski$ index.php?art=$191 [L]
RewriteRule ^krzysztof-lewicki$ index.php?art=$195 [L]
RewriteRule ^jakub-jedrzejczyk$ index.php?art=$197 [L]

17
.vscode/ftp-kr.json vendored Normal file
View File

@@ -0,0 +1,17 @@
{
"host": "ftp.rockowa.com",
"username": "rockowaco",
"password": "fn2En7gtLK",
"remotePath": "/domains/rockowa.com/public_html/",
"protocol": "ftp",
"port": 0,
"fileNameEncoding": "utf8",
"autoUpload": true,
"autoDelete": false,
"autoDownload": false,
"ignoreRemoteModification": true,
"ignore": [
".git",
"/.vscode"
]
}

12
.vscode/sftp.json vendored Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "ftp.rockowa.com",
"host": "ftp.rockowa.com",
"protocol": "ftp",
"port": 21,
"username": "rockowaco",
"password": "fn2En7gtLK",
"remotePath": "/domains/rockowa.com/public_html/",
"uploadOnSave": false,
"useTempFile": false,
"openSsh": false
}

801
admin/css/style.css Normal file
View File

@@ -0,0 +1,801 @@
* {
margin:0;
padding:0;
}
body {
font-family: Verdana;
font-size:11px;
color:#3D3D3D;
background-color: #F2F2F2;
background-image: url("../../images/system/blueprint.png");
}
hr {
margin:5px auto;
}
a {
text-decoration:none;
cursor:pointer;
color: inherit;
}
a.download {
color:#1B273F;
margin:0px 10px;
text-decoration:underline;
}
/* ikony dataBrowsera */
span.icon {
width:20px;
height:20px;
margin:auto;
cursor:pointer;
display:block;
}
span.delete {
background:url("../../images/system/sico_trash.png") no-repeat;
}
span.edit {
background:url("../../images/system/sico_edit.png") no-repeat;
}
span.show {
background:url("../../images/system/sico_show.png") no-repeat;
}
div.delete {
background:url("../../images/system/sico_delete.png") no-repeat;
width:16px;
height:16px;
margin:auto;
cursor:pointer;
display:block;
float:left;
}
/* strzałki */
table#pagin {
width: 500px;
}
table#pagin a.arrow {
display:block;
height:20px;
width:20px;
}
table#pagin a.left_act_max {
background-image:url("../../images/system/sico_leftm.jpg");
}
table#pagin a.left_ina_max {
background-image:url("../../images/system/sico_leftmin.jpg");
}
table#pagin a.left_act {
background-image:url("../../images/system/sico_left.jpg");
}
table#pagin a.left_ina {
background-image:url("../../images/system/sico_leftin.jpg");
}
table#pagin a.right_act_max {
background-image:url("../../images/system/sico_rightm.jpg");
}
table#pagin a.right_ina_max {
background-image:url("../../images/system/sico_rightmin.jpg");
}
table#pagin a.right_act {
background-image:url("../../images/system/sico_right.jpg");
}
table#pagin a.right_ina {
background-image:url("../../images/system/sico_rightin.jpg");
}
div.icon {
cursor:pointer;
width:20px;
height:20px;
margin:auto;
}
div.up_main {
background:url("../../images/system/sico_up_grey.png") no-repeat;
}
div.down_main {
background:url("../../images/system/sico_down_grey.png") no-repeat;
}
div.up_sub {
background:url("../../images/system/sico_up_red.png") no-repeat;
}
div.down_sub {
background:url("../../images/system/sico_down_red.png") no-repeat;
}
/* panel administratora */
.page_header {
width: 100%;
height: 50px;
color: #ABABA8;
line-height: 50px;
background: url( '../../images/system/carbon.png' );
border-bottom: 2px solid black;
}
.page_header_content {
width: 1100px;
margin: auto;
height: 50px;
}
div#logo {
height: 50px;
line-height: 50px;
margin: 0 30px;
cursor: pointer;
text-transform: uppercase;
color: #FFF;
text-shadow: 1px 1px 3px #000;
filter: dropshadow(color=#000, offx=1, offy=1);
width: 500px;
text-align: left;
float: left;
}
#user_menu {
border-left: 1px solid rgba(255, 255, 255, 0.2);
border-right: 1px solid rgba(0, 0, 0, 0.6);
cursor: pointer;
width: 150px;
float: right;
font-family: verdana;
font-size: 12px;
height: 100%;
text-align: center;
}
#user_menu a {
color: #FFF;
}
#user_menu a:hover {
text-decoration: underline;
}
#user_menu_after {
border-left: 1px solid rgba(255, 255, 255, 0.2);
cursor: pointer;
padding: 0 24px 0 12px;
float: right;
font-family: verdana;
font-size: 10px;
width: 100px;
height: 100%;
line-height: 36px;
}
#user_menu_after a.logout {
background: url("../../images/system/toolbar-button.png") no-repeat scroll center top transparent;
display: block;
float: left;
height: 36px;
margin-left: 4px;
position: relative;
width: 36px;
margin-top: 8px;
}
#user_menu_after a.logout span {
background-image: url("../../images/system/logout.png");
background-position: center center;
background-repeat: no-repeat;
cursor: pointer;
display: block;
height: 36px;
margin: auto;
outline: 0 none;
text-decoration: none;
text-indent: -99999px;
width: 36px;
}
#user_menu img {
position: relative;
top: 10px;
margin-right: 10px;
}
/* główna część strony */
.page_main {
margin: 20px auto;
width: 96%;
}
.page_main_left {
float: left;
width: 200px;
min-height: 300px;
background: #FFF;
border: 1px solid #BFBFBF;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.page_main_left ul {
list-style: none outside none;
margin: 0;
}
.page_main_left li {
background: #FDFDFD;
border-bottom: 1px solid #CACACA;
border-top: 1px solid #FFFFFF;
}
.page_main_left li a {
background: url("../../images/system/menu-bulb-off.png") no-repeat scroll right center transparent;
color: #444444;
cursor: pointer;
display: block;
outline: 0 none;
padding: 15px 32px 15px 48px;
position: relative;
text-decoration: none;
}
.page_main_left li a.active {
background-image: url("../../images/system/menu-bulb-on.png");
}
.page_main_left li span {
background: none repeat scroll 0 0 transparent !important;
height: 32px;
left: 8px;
margin: -16px 0 0;
padding: 0;
position: absolute;
top: 50%;
width: 32px;
}
.page_main_left ul li ul li a {
background: none repeat scroll 0 0 transparent !important;
padding: 6px 0 6px 48px;
}
.page_main_left ul li ul {
background: #E9E9E9;
border: 0 none;
border-radius: 0 0 0 0;
}
.page_main_left ul li ul li {
background: none repeat scroll 0 center transparent;
border: 0 none;
box-shadow: none;
font-size: 11px;
border-bottom: 1px solid #CACACA;
}
.page_main_left ul li ul li:last-child {
border-bottom: 0px;
}
.page_main_left ul li ul li:first-child {
border-top: 1px solid #CACACA;
}
.page_main_left ul li ul li:hover {
background: #E4EFC0;
}
.page_main_right {
margin-left: 200px;
margin-top: 20px;
padding-bottom: 20px;
}
div.logout {
float:right;
line-height: 80px;
margin-right:100px;
}
div.logout a.first {
color: #FFF;
display: block;
float: left;
padding-right: 5px;
}
div.logout a.second {
background: url("../../images/system/sico_logout.png") no-repeat scroll 0 0 transparent;
display: block;
float: left;
height: 16px;
margin: 33px 0 0 0;
width: 16px;
}
.login_form {
width: 250px;
padding: 20px;
background: #FFF;
margin: 50px auto;
-webkit-box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.4);
box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.4);
}
.login_form .title {
padding: 10px 20px 20px;
border-bottom: 1px dashed #888;
font-weight: bold;
margin-bottom: 20px;
}
.login_form .label {
padding: 5px 10px;
margin: 5px auto;
}
.plik_bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba( 255, 255, 255, 0.8 );
display: none;
cursor: pointer;
}
.button {
width: 100%;
font-size: 12px;
line-height: 1;
color: white;
margin: 10px auto;
cursor: pointer;
line-height: 1;
padding: 10px;
display: inline-block;
outline: 0;
border: 1px solid #000;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
-webkit-appearance: none;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35),0 1px 1px rgba(0, 0, 0, 0.15);
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.35),0 1px 1px rgba(0,0,0,0.15);
-o-box-shadow: inset 0 1px 0 rgba(255,255,255,0.35),0 1px 1px rgba(0,0,0,0.15);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35),0 1px 1px rgba(0, 0, 0, 0.15);
background: #356aa0; /* Old browsers */
background: -moz-linear-gradient(top, #356aa0 0%, #356aa0 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#356aa0), color-stop(100%,#356aa0)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #356aa0 0%,#356aa0 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #356aa0 0%,#356aa0 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #356aa0 0%,#356aa0 100%); /* IE10+ */
background: linear-gradient(to bottom, #356aa0 0%,#356aa0 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#356aa0', endColorstr='#356aa0',GradientType=0 ); /* IE6-9 */
}
/* inne */
div.btn, a.btn, .btn {
border:1px solid #b7b5cf;
margin:5px auto;
padding:4px 5px;
text-align:center;
display:block;
width:100px;
cursor:pointer;
color: grey;
background: #ffffff; /* old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #e1e1e1 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e1e1e1)); /* webkit */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e1e1e1',GradientType=0 ); /* ie */
-webkit-box-shadow: 0px 0px 4px #b7b5cf;
-moz-box-shadow: 0px 0px 4px #b7b5cf;
box-shadow: 0px 0px 4px #b7b5cf;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
input[type="button"].btn {
padding: 4px;
margin: 5px 5px 5px 0;
display: inline-block;
font-size: 11px;
color: grey;
}
div.btn:hover, a.btn:hover, input[type="button"].btn:hover {
color: #000;
}
.delete_img_link {
color: #cc0000;
}
/* edycja artykułu */
table.t_category {
width:100%;
text-align:left;
}
table img.subcategory {
margin-right: 4px;
position: relative;
top: -1px;
vertical-align: middle;
}
/* ustawienia systemowe */
div.tabHeaders {
display:block;
width: 100%;
height:55px;
border-left: 1px solid #999;
border-bottom: 1px solid #999;
margin-top:10px;
text-transform:capitalize;
font-weight:bold;
color:#404D6C;
}
div.tabHeaders img {
float:left;
margin-left:10px;
margin-top:-16px;
}
div.tabInactive {
border-bottom:1px solid #999999;
border-right:1px solid #999999;
border-top:1px solid #999999;
cursor:pointer;
float:left;
height:34px;
padding-top:20px;
text-align:center;
width:240px;
background-color: #eee;
}
div.tabActive {
background:#FFF;
border-bottom:1px solid #EEEEEE;
border-right:1px solid #999999;
border-top:1px solid #999999;
float:left;
height:34px;
padding-top:20px;
text-align:center;
width:240px;
}
div.tabPages {
clear:left;
border-left: 1px solid #999;
border-right: 1px solid #999;
border-bottom: 1px solid #999;
padding:8px 20px;
line-height:21px;
}
/* pasek narzędzi */
.action_panel {
display: block!important;
position: relative;
border: 1px solid #000;
border-bottom: 0px;
background: url( '../../images/system/carbon.png' );
-moz-border-radius: 3px 3px 0 0;
border-radius: 3px 3px 0 0;
width: 95%;
margin:auto;
color: #FFF;
font-size: 13px;
}
.action_panel .title {
padding: 10px;
}
.icons {
width: 95%;
margin:auto;
text-align:left;
border: 1px solid #BFBFBF;
border-bottom: 0px;
background-image: url('../../images/system/panel-header.png');
}
.icons .icon {
display: inline-block;
margin-right: -3px;
padding: 0 10px;
text-decoration: none;
color: #444;
border-right: 1px solid #BFBFBF;
width: 150px;
height: 30px;
line-height: 30px;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f3f3f3 50%, #ededed 100%, #ffffff 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(50%,#f3f3f3), color-stop(100%,#ededed), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 50%,#ededed 100%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 50%,#ededed 100%,#ffffff 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 50%,#ededed 100%,#ffffff 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#f3f3f3 50%,#ededed 100%,#ffffff 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
}
.icons .icon:hover {
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #ededed 0%, #f3f3f3 50%, #ffffff 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(0%,#ededed), color-stop(50%,#f3f3f3), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#ededed 0%,#f3f3f3 50%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#ededed 0%,#f3f3f3 50%,#ffffff 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#ededed 0%,#f3f3f3 50%,#ffffff 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#ededed 0%,#f3f3f3 50%,#ffffff 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
}
.icons .icon img {
margin-right: 5px;
position: relative;
top: 5px;
}
div.action_panel div.apply {
background:url("../../images/system/sico_apply.png") no-repeat center top;
}
div.action_panel div.cancel {
background:url("../../images/system/sico_cancel.png") no-repeat center top;
}
div.action_panel div.new {
background:url("../../images/system/sico_add.png") no-repeat left center;
}
div.action_panel div.back {
background:url("../../images/system/sico_back.png") no-repeat center top;
}
/* stronicowanie */
table#pagin {
border-collapse: collapse;
margin: 10px auto;
}
table#pagin td {
padding:2px 5px;
}
table#pagin a {
color:#465371;
font-size:15px;
}
table#pagin a.current {
font-weight:bold;
font-size:18px;
}
/* INNE */
.edit_line {
margin: 10px 0;
clear: both;
min-height: 30px;
}
.edit_line label {
float: left;
padding-top: 5px;
text-align: right;
width: 160px;
color: #333333;
display: block;
margin-bottom: 5px;
font-size: 11px;
font-weight: normal;
line-height: 18px;
}
.edit_line .input {
margin-left: 180px;
min-height: 30px;
line-height: 26px;
}
input[type="text"], input[type="password"], textarea, select {
border: 1px solid #CCCCCC;
-webkit-border-radius: 3px;
border-radius: 3px;
color: #555555;
display: inline-block;
font-size: 11px;
height: 16px;
line-height: 16px;
padding: 4px 10px;
-moz-transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
-webkit-transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
-ms-transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
-o-transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
-webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.075);
}
.edit_line input[type="text"], .edit_line input[type="password"], .edit_line textarea, .edit_line select {
width: 280px;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus, input[type="radio"]:focus {
border-color: rgba(82, 168, 236, 0.8);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(82, 168, 236, 0.6);
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(82, 168, 236, 0.6);
outline: 0 none;
}
input[type="radio"], input[type="checkbox"] {
position: relative;
top: 3px;
margin-right: 5px;
margin-left: 5px;
}
select, input[type="file"] {
height: 25px;
line-height: 25px;
}
option {
padding: 3px 5px;
}
textarea {
height: 80px;
}
.edit_line select {
width: 302px;
}
fieldset {
width: 95%;
background: #FFF;
border: 1px solid #BFBFBF;
margin: 0 auto 40px;
font-size: 11px;
-webkit-border-radius: 0px 0px 3px 3px;
border-radius: 0px 0px 3px 3px;
}
legend {
color: #2a2a2a;
font-size: 12px;
letter-spacing: 1px;
padding: 0 20px;
font-style: italic;
}
fieldset p {
margin:5px;
}
table {
border-collapse: collapse;
margin: auto;
letter-spacing: 0px;
width: 100%;
}
table td.header, table th.header {
font-size: 11px;
font-weight: bold;
padding: 8px 15px;
vertical-align: middle;
background: #FFF;
text-align: left;
}
table td.header img, table th.header img {
height: 10px;
margin-right: 4px;
position: relative;
top: -1px;
vertical-align: middle;
width: 7px;
}
table td.header2, table th.header2 {
border: 1px solid #B8BAC6;
color: #000000;
font-size: 11px;
font-weight: bold;
padding: 10px 15px;
text-transform: uppercase;
vertical-align: middle;
background: #ffffff; /* old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); /* webkit */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=0 ); /* ie */
}
table td.row, table th.row {
padding: 10px 15px;
background: #FFF;
}
table input.edit {
width:50px;
text-align:right;
}
.alert {
border:1px solid #B8BAC6;
height:50px;
line-height:50px;
color:#464423;
background:#FCFAE0;
text-align:left;
text-transform: uppercase;
width: 95%;
margin: 20px auto;
}
.table_browse .alert {
border: 0px;
margin: 0px;
width: 100%;
}
div.alert div {
width:1000px;
margin:auto;
}
div.alert img {
display: block;
float: left;
margin: 10px 20px 0 0;
}
table.table_browse:not(.edit) tbody tr:hover td {
background: #E2E2E2 !important;
cursor: pointer;
}
table.table_browse:not(.edit) tbody tr:nth-of-type(odd) td {
border-top: 1px solid #DDDDDD;
border-bottom: 1px solid #DDDDDD;
background: #f6f6f6;
}
.center {
text-align: center;
}
.toggle_filtr {
margin: 20px 0 10px 30px;
cursor: pointer;
color: #cc0000;
}
#filtr {
display: none;
}
#article_edit_left {
width: 65%;
float: left;
}
#article_edit_right {
float: right;
margin-top: 50px;
width: 35%;
}
#image-list, #files-list {
list-style:none;
margin:0;
padding:0;
}
#image-list li {
background: #fff;
text-align:center;
display: block;
float: left;
width: 80px;
height: 80px;
margin: 15px;
vertical-align: middle;
}
#image-list li img {
width: 258px;
vertical-align: middle;
max-width: 80px;
max-height: 80px;
border: 1px solid #D3D3D3;
padding: 3px;
background: #FFF;
cursor: pointer;
}
.img_bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba( 0, 0, 0, 0.6 );
display: none;
cursor: pointer;
}
.img_big {
position: fixed;
top: 50%;
left: 50%;
border: 5px solid #555555;
display: none;
background: #FFF;
}
.img_big img {
max-height: 600px;
max-width: 600px;
}
.clearfix {
clear: both;
}
.plupload_header_content {
display: none !important;
}
.delete_img {
width: 24px;
height: 24px;
position: relative;
right: -58px;
top: 30px;
border: 1px solid #000;
background: url( '../../images/system/sico_cancel.png' ) no-repeat center #FFF;
cursor: pointer;
display: none;
}
.manage_file {
width: 24px;
height: 24px;
position: relative;
background: url( '../../images/system/sico_edit.png' ) no-repeat center #FFF;
cursor: pointer;
float: left;
margin-right: 10px;
margin-left: 10px;
}
#files-list .file {
height: 24px;
line-height: 24px;
}
.plik_edycja {
position: fixed;
top: 50%;
left: 50%;
border: 10px solid #45484d;
display: none;
background: #FFF;
width: 360px;
height: 150px;
margin-left: -195px;
margin-top: -75px;
padding: 20px;
}

69
admin/index.php Normal file
View File

@@ -0,0 +1,69 @@
<?
error_reporting(0);
ob_start();
function __autoload_my_classes( $classname )
{
$q = explode( '\\' , $classname );
$c = array_pop( $q );
$f = '../autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
if ( $c == 'Savant3' )
{
require_once( '../autoload/Savant3.php' );
return true;
}
if ( file_exists( $f ) )
require_once( $f );
}
spl_autoload_register( '__autoload_my_classes' );
define( 'OPD_DIR' , '../autoload/' );
require( OPD_DIR . 'opd.class.php' );
if ( file_exists( '../files/config.php' ) )
include '../files/config.php';
else
include '../config.php';
date_default_timezone_set('Europe/Warsaw');
session_start();
$db = opdClass::create(
array(
'dsn' => 'mysql:host=' . $database['host'] . ';dbname=' . $database['name'],
'user' => $database['user'] ,
'password' => $database['password'] ,
'cache' => 'Temp/' ,
'debugConsole' => false
)
);
$db -> query('SET NAMES utf8');
$sys = new \System;
$cache = new \FileCache;
if ( \System::formGet( 'del' ) == 'true' )
{
\System::deleteCacheAdmin();
\System::deleteCache();
session_destroy();
echo '<script>document.location.href="./";</script>';
}
$lang = $sys -> getSessionVar('lang' , true );
if ( !$lang )
{
$lang = \language\FLanguage::loadLang();
$sys -> setSessionVar( 'lang' , $lang , true );
}
\admin\controls\Page::checkUrlParams();
$user = $sys -> getSessionVar( 'user' , true );
if ( file_exists( '../resources/xajax/xajax_core/xajax.inc.php' ) )
include( '../resources/xajax/xajax_core/xajax.inc.php' );
include( '../functions/xajax.php' );
echo \admin\view\Page::show();
?>

View File

@@ -0,0 +1,61 @@
<?
global $lang;
?>
<fieldset>
<script>
$(document).ready(function() {
$("#tabs").tabs();
});
</script>
<div id="tabs">
<ul>
<?
if ( is_array( $this -> _language ) ) foreach ( $this -> _language as $language )
{
?>
<li><a href="#lang_<?=$language['id'];?>"><span><?=$language['name'];?></span></a></li>
<?
}
?>
</ul>
<?
if ( is_array( $this -> _language ) ) foreach ( $this -> _language as $language )
{
?>
<div id="lang_<?=$language['id'];?>">
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_TYTUL' ) );?>:</label>
<div class="input">
<?=$this -> secureHTML( $language['title'] );?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_META_OPIS' ) );?>:</label>
<div class="input">
<?=$language['meta_description'];?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_META_SLOWA_KLUCZOWE' ) );?>:</label>
<div class="input">
<?=$language['meta_keywords'];?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_TRESC' ) );?>:</label>
<div class="input">
<?=$language['text'];?>
</div>
</div>
</div>
<?
}
?>
</div>
</fieldset>

View File

@@ -0,0 +1,481 @@
<?
global $lang;
?>
<fieldset>
<script>
$(document).ready(function()
{
$("#tabs").tabs();
$( '.img_bg' ).click( function(){
$( this ).hide();
$( '.img_big' ).hide();
})
$( '#image-list li' ).hover(
function(){
$( this ).children( 'div' ).css( { 'display' : 'block', 'margin-top' : '-26px' });
},
function(){
$( this ).children( 'div' ).hide();
}
)
});
function showImage( id )
{
var src = document.getElementById( 'img' + id ).src;
$( '.img_bg' ).show();
$( '.img_big' ).html( '<img src="' + src + '">' ).show();
var height = parseInt( $( '.img_big img' ).css( 'height' ) );
var width = parseInt( $( '.img_big img' ).css( 'width' ) );
$( '.img_big' ).css( { 'height' : height, 'width' : width, 'margin-top' : '-' + height / 2 + 'px', 'margin-left': '-' + width / 2 + 'px' } );
}
function saveArticle()
{
$.prompt('<?=$lang -> getTrans( 'T_TRWA_ZAPISYWANIE' );?>');
var id = $("#idk").val();
var enabled = $( ".enabled:checked" ).val();
var comments = $( ".comments:checked" ).val();
var print = $( ".print:checked" ).val();
var show_title = $( ".show_title:checked" ).val();
var show_date = $( ".show_date:checked" ).val();
var show_author = $( '.show_author:checked' ).val();
var keep_archive = $( '.keep_archive:checked' ).val();
var layout = $( '#layout' ).val();
var pages = '';
$('input:checkbox:checked').each(
function() {
if ( pages != '' )
pages = pages + ':';
pages = pages + $(this).val();
}
);
xajax_saveArticle( id , enabled , comments , print , show_title , show_date , pages , show_author , keep_archive, layout );
}
function saveArticleTranslation( new_article )
{
var id = $("#idk").val();
var title = new Object();
var meta_o = new Object();
var meta_d = new Object();
var text = new Object();
var seo_link = new Object();
var keep_archive = $( '.keep_archive:checked' ).val();
var version = $( '#version' ).val();
<?
if ( is_array( $this -> _language ) ) foreach ( $this -> _language as $language )
{
echo 'title["' . $language['id'] . '"] = $("#title_' . $language['id'] . '").val();' . chr( 13 ) . chr( 10 );
echo 'meta_o["' . $language['id'] . '"] = $("#meta_description_' . $language['id'] . '").val();' . chr( 13 ) . chr( 10 );
echo 'meta_d["' . $language['id'] . '"] = $("#meta_keywords_' . $language['id'] . '").val();' . chr( 13 ) . chr( 10 );
echo 'text["' . $language['id'] . '"] = $("#text_' . $language['id'] . '").val();' . chr( 13 ) . chr( 10 );
echo 'seo_link["' . $language['id'] . '"] = $("#seo_link_' . $language['id'] . '").val();' . chr( 13 ) . chr( 10 );
}
?>
var count = 0;
for ( var klucz in title) count++;
var i = 0;
for ( var klucz in title)
{
i++;
message = false;
if ( i == count )
message = true;
xajax_saveArticleTranslation( klucz , id , title[klucz] , meta_o[klucz] , meta_d[klucz] , text[klucz] , message , keep_archive , version, seo_link[klucz], new_article );
}
}
</script>
<form method='POST' action='index.php' id='<?=$this -> _id_form;?>' enctype="multipart/form-data" name="article_edit">
<?
if ( $this -> _rw == 'add' )
{
?>
<input type='hidden' name='rw' value='add_new'>
<input type='hidden' name='<?=base64_encode("time");?>' value='<?=base64_encode(date("Y-m-d H:i:s"));?>'>
<input type='hidden' id="idk" name='id' value=''>
<?
}
if ( $this -> _rw == 'edit' )
{
?>
<input type='hidden' name='rw' value='save'>
<input type='hidden' id="idk" name='id' value='<?=$this -> _id;?>'>
<input type="hidden" id="version" name="version" value="<?=$this -> _version;?>">
<?
}
?>
<div id="article_edit_left">
<div id="tabs">
<ul>
<?
if ( is_array( $this -> _language ) ) foreach ( $this -> _language as $language )
{
?>
<li><a href="#lang_<?=$language['id'];?>"><span><?=$language['name'];?></span></a></li>
<?
}
?>
</ul>
<?
if ( is_array( $this -> _language ) ) foreach ( $this -> _language as $language )
{
?>
<script type="text/javascript">
$(document).ready(function(){
$( 'textarea#text_<?=$language['id'];?>' ).ckeditor( {
toolbar : 'MyToolbar',
height:'250',
extraPlugins : 'gallery'
});
});
</script>
<div id="lang_<?=$language['id'];?>">
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_TYTUL' ) );?>:</label>
<div class="input">
<input type='text' id="title_<?=$language['id'];?>" name='title_<?=$language['id'];?>' value='<?=$this -> secureHTML( $language['title'] );?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_LINK_SEO' ) );?>:</label>
<div class="input">
<input type='text' id="seo_link_<?=$language['id'];?>" name='seo_link_<?=$language['id'];?>' value='<?=$this -> secureHTML( $language['seo_link'] );?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_META_OPIS' ) );?>:</label>
<div class="input">
<textarea id="meta_description_<?=$language['id'];?>" name='meta_description_<?=$language['id'];?>' cols='60' rows='5'><?=$language['meta_description'];?></textarea>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_META_SLOWA_KLUCZOWE' ) );?>:</label>
<div class="input">
<textarea id="meta_keywords_<?=$language['id'];?>" name='meta_keywords_<?=$language['id'];?>' cols='60' rows='5'><?=$language['meta_keywords'];?></textarea>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_TRESC' ) );?>:</label>
<div class="input">
<textarea name='text_<?=$language['id'];?>' id='text_<?=$language['id'];?>' class='text' rows='10' cols='10'><?=$this -> eprint( $language['text'] );?></textarea>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_GALERIA' ) );?>:</label>
<div class="input">
<ul id="image-list">
<?
$img_count = 0;
if ( is_array( $this -> _images ) ) foreach ( $this -> _images as $img )
{
echo '<li id="li_' . $img['id'] . '">';
echo '<div class="delete_img" onClick="xajax_deleteArticleImg(' . $img['id'] . ');"></div>';
echo '<img src="../' . $img['src'] . '" id="img' . $img_count . '" onclick="showImage( ' . $img_count . ' )">';
echo '</li>';
$img_count++;
}
?>
</ul>
<div class="clearfix" style="margin-bottom: 20px;"></div>
<?
if ( $this -> _id )
{
?>
<div id="flash_uploader" style="width: 100%; height: 330px;">You browser doesn't have Flash installed.</div>
<?
}
?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_PLIKI' ) );?>:</label>
<div class="input">
<ul id="files-list">
<?
$file_count = 0;
if ( is_array( $this -> _files ) ) foreach ( $this -> _files as $file )
{
echo '<li id="file_li_' . $file['id'] . '">';
echo '<div class="file" id="file_id_' . $file['id'] . '">';
echo '<div class="manage_file" onClick="manageFile( ' . $file['id'] . ' );"></div>';
if ( $file['name'] != '' )
echo $file['name'];
else
echo $file['file'];
echo '</div>';
echo '</li>';
$file_count++;
}
?>
</ul>
<div class="clearfix" style="margin-bottom: 20px;"></div>
<?
if ( $this -> _id )
{
?>
<div id="flash_uploader_files" style="width: 100%; height: 330px;">You browser doesn't have Flash installed.</div>
<?
}
?>
</div>
</div>
</div>
<?
}
?>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_STRONY' ) );?>:</label>
<div class="input">
<table class='t_category'>
<?
$i=0;
if ( is_array( $this -> _pages ) ) foreach ( $this -> _pages as $page )
{
if ( $i%4 == 0 )
{
?><tr><?
}
?>
<td style='width: 25%;'>
<input type='checkbox' name='pages[]' value='<?=$page['id'];?>' style='width:15px;'
<?
if ( $this -> _rw == 'edit' && $page['check'] == 1 )
{
?>checked='checked'<?
}
?>
><?=$page['title'];?>
</td>
<?
if ( $i%4 == 3 )
{
?></tr><?
}
$i++;
}
?>
</table>
</div>
</div>
</div>
<div id="article_edit_right">
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_OPUBLIKOWANY' ) );?>:</label>
<div class="input">
<input type="radio" name="enabled" class="enabled" id="enabled_0" value="0" <? if ( !isset( $this -> _enabled ) || $this -> _enabled == 0 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_NIE' );?>
<input type="radio" name='enabled' class="enabled" id="enabled_1" value='1' <? if ( isset( $this -> _enabled ) && $this -> _enabled == 1 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_TAK' );?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_DRUKUJ' ) );?>:</label>
<div class="input">
<input type="radio" name="print" class="print" id="print_0" value="0" <? if ( !isset( $this -> _print ) || $this -> _print == 0 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_NIE' );?>
<input type="radio" name="print" class="print" id="print_1" value="1" <? if ( isset( $this -> _print ) && $this -> _print == 1 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_TAK' );?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_POKAZ_TYTUL' ) );?>:</label>
<div class="input">
<input type="radio" name="show_title" class="show_title" id="show_title_0" value="0" <? if ( !isset( $this -> _show_title ) || $this -> _show_title == 0 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_NIE' );?>
<input type="radio" name="show_title" class="show_title" id="show_title_1" value="1" <? if ( isset( $this -> _show_title ) && $this -> _show_title == 1 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_TAK' );?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_POKAZ_DATE' ) );?>:</label>
<div class="input">
<input type="radio" name="show_date" class="show_date" id="show_date_0" value="0" <? if ( !isset( $this -> _show_date ) || $this -> _show_date == 0 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_NIE' );?>
<input type="radio" name="show_date" class="show_date" id="show_date_1" value="1" <? if ( isset( $this -> _show_date ) && $this -> _show_date == 1 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_TAK' );?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_POKAZ_AUTORA' ) );?>:</label>
<div class="input">
<input type="radio" name="show_author" class="show_author" id="show_author_0" value="0" <? if ( !isset( $this -> _show_author ) || $this -> _show_author == 0 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_NIE' );?>
<input type="radio" name="show_author" class="show_author" id="show_author_1" value="1" <? if ( isset( $this -> _show_author ) && $this -> _show_author == 1 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_TAK' );?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_WERSJONOWANIE' ) );?>:</label>
<div class="input">
<input type="radio" name="keep_archive" class="keep_archive" id="keep_archive_0" value="0" <? if ( !isset( $this -> _keep_archive ) || $this -> _keep_archive == 0 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_NIE' );?>
<input type="radio" name="keep_archive" class="keep_archive" id="keep_archive_1" value="1" <? if ( isset( $this -> _keep_archive ) && $this -> _keep_archive == 1 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_TAK' );?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_SZABLON' ) );?>:</label>
<div class="input">
<select name="layout" id="layout">
<option value="">---- szablon domyślny ----</option>
<?
if ( is_array( $this -> _layouts ) ) foreach ( $this -> _layouts as $layout )
{
echo '<option value="' . $layout['id'] . '" ';
if ( $this -> _layout == $layout['id'] )
echo 'selected="selected"';
echo '>' . $layout['name'] . '</option>';
}
?>
</select>
</div>
</div>
</div>
<div class="clearfix"></div>
</form>
</fieldset>
<div class="img_bg"></div>
<div class="img_big"></div>
<div class="plik_bg"></div>
<div class="plik_edycja">
<div class="edit_line">
<label style="width: 60px;">Nazwa:</label>
<div class="input" style="margin-left: 70px;">
<input type="text" id="name">
</div>
</div>
<div class="edit_line">
<labell style="width: 60px;"></label>
<div class="input" style="margin-left: 70px;">
<input type="button" class="btn" value="Zapisz" onClick="xajax_saveArticleFileInfo( jQuery( '#file_edit_id' ).val(), jQuery( '#name' ).val() )">
<input type="button" class="btn" value="Anuluj" onClick="jQuery( '.plik_bg, .plik_edycja' ).hide();">
</div>
</div>
<div class="edit_line">
<labell style="width: 60px;"></label>
<div class="input" style="padding: 0; margin-left: 70px;">
<a class="delete_img_link" onClick="xajax_deleteArticleFile( jQuery( '#file_edit_id' ).val() )">usuń</a>
</div>
</div>
<input type="hidden" id="file_edit_id">
</div>
<link rel="stylesheet" href="../resources/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css" type="text/css" media="screen" />
<script type="text/javascript" src="../resources/plupload/plupload.js"></script>
<script type="text/javascript" src="../resources/plupload/plupload.flash.js"></script>
<script type="text/javascript" src="../resources/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script type="text/javascript" src="../resources/plupload/i18n/pl.js"></script>
<script type="text/javascript">
var img_count = <?=$img_count;?>;
var file_count = <?=$file_count;?>;
<?
if ( $this -> _id )
{
?>
$(function() {
jQuery( '.plik_bg' ).click( function(){
jQuery( this ).hide();
jQuery( '.plik_edycja' ).hide();
})
$("#flash_uploader").pluploadQueue({
runtimes : 'flash',
init : {
Refresh: function(up) {
$(".plupload_buttons").css("display", "inline");
$(".plupload_upload_status").css("display", "inline");
$(".plupload_start").addClass("plupload_disabled");
$(".plupload_start").removeClass("plupload_disabled");
},
FileUploaded: function(up, file, response) {
data = jQuery.parseJSON(response.response);
jQuery('#image-list').append('<li id="li_' + data.id_img + '" onmouseover="$( this ).children( \'div\' ).css( { \'display\' : \'block\', \'margin-top\' : \'-26px\' });" onmouseout="$( this ).children( \'div\' ).hide();">'
+ '<div onclick="xajax_deleteArticleImg(' + data.id_img + ');" class="delete_img"></div>'
+ '<img onclick="showImage( ' + img_count + ' )" src="' + data.data_link + '" id="img' + img_count + '"></li>');
img_count++;
}
},
url : '../resources/upload.php?article_id=<?=$this -> _id;?>&hash=22292f4756dfed68e8397e356c28b32a',
chunk_size : '1mb',
unique_names : true,
filters : [
{title : "Obrazki", extensions : "jpg,gif,png,bmp,jpeg"}
],
resize : {width : 1920, height : 1080, quality : 100},
flash_swf_url : '../resources/plupload/plupload.flash.swf'
});
$("#flash_uploader_files").pluploadQueue({
runtimes : 'flash',
init : {
Refresh: function(up) {
$(".plupload_buttons").css("display", "inline");
$(".plupload_upload_status").css("display", "inline");
$(".plupload_start").addClass("plupload_disabled");
$(".plupload_start").removeClass("plupload_disabled");
},
FileUploaded: function(up, file, response) {
data = jQuery.parseJSON(response.response);
jQuery('#files-list').append('<div class="file" id="file_li_' + data.id_file + '"><div class="manage_file" onClick="manageFile( ' + data.id_file + ' );"></div>' + data.data_link + '</div>' );
file_count++;
}
},
url : '../resources/upload_files.php?article_id=<?=$this -> _id;?>&hash=22292f4756dfed68e8397e356c28b32a',
chunk_size : '1mb',
unique_names : false,
filters : [
{title : "Wszystkie pliki", extensions : "*"}
],
flash_swf_url : '../resources/plupload/plupload.flash.swf'
});
});
<?
}
?>
function manageFile( id )
{
jQuery( '.plik_edycja, .plik_bg' ).show();
jQuery( '#file_edit_id' ).val( id );
jQuery( '#name' ).val( '' );
xajax_articleFileInfo( id );
}
</script>

View File

@@ -0,0 +1,81 @@
<? global $lang; ?>
<fieldset>
<table class='table_browse'>
<thead>
<tr>
<td class='header' style='width:15px; text-align:center;'><?=$lang -> getTrans( 'T_LP' );?></td>
<td class='header'><?=$lang -> getTrans( 'T_TYTUL' );?></td>
<td class='header' style='text-align:center;'><?=$lang -> getTrans( 'T_WERSJA' );?></td>
<td class='header' style="text-align: center;"><?=$lang -> getTrans( 'T_DATA_MODYFIKACJI' );?></td>
<td class='header' style='width:15px;'></td>
<td class='header' style='width:15px;'></td>
</tr>
</thead>
<tbody>
<?
$i = ( $this -> _bs - 1 ) * $this -> _limit + 1;
if ( is_array( $this -> _articles ) ) foreach ( $this -> _articles as $article ) {
?>
<tr>
<td class='row' style='text-align:center;'><?=$i;?>.</td>
<td class='row'><?=$article['title'];?></td>
<td class='row' style='text-align:center;'><?=$article['version'];?></td>
<td class="row" style="text-align: center;"><?=$article['date_modify'];?></td>
<td class='row'>
<a href='./?rw=show&amp;id=<?=$article['id'];?>'>
<span class='icon show'></span>
</a>
</td>
<td class='row'>
<a onClick="confirmArticleRestor( '<?=$article['id'];?>')"><?=$lang -> getTrans( 'T_PRZYWROC' );?></a>
</td>
</tr>
<?
$i++;
}
?>
</tbody>
</table>
<? include 'site-paging.php' ;?>
</fieldset>
<form method="POST" action="./" id="article_restore">
<input type="hidden" name="rw" value="restore">
<input type='hidden' name='<?=base64_encode("time");?>' value='<?=base64_encode(date("Y-m-d H:i:s"));?>'>
<input type="hidden" name="id" id="article_id" value="">
</form>
<script type='text/javascript'>
function mycallbackform(v,m,f){
if( v == true )
$( '#article_restore' ).submit();
}
function confirmArticleRestor( id ) {
$( '#article_id' ).val( id );
$.prompt( '<?=$lang -> getTrans( 'T_POTWIERDZ_PRZYWROCENIE' );?>',{ callback: mycallbackform, buttons: { <?=$lang -> getTrans( 'T_TAK' );?>: true, <?=$lang -> getTrans( 'T_NIE' );?>: false }, focus: 1 })
}
$(document).ready(function(){
var cssObj = {
'display' : 'block',
'height' : '30px',
'line-height' : '30px',
'color' : '#000000',
'font-size' : '10px',
'padding-left' : '5px',
'text-transform' : 'uppercase'
}
$("li.context_menu").children("a").css( cssObj );
var cssObj2 = {
'float' : 'left',
'margin' : '5px 5px 0 0',
'color' : '#000000',
'font-size' : '10px',
'padding-left' : '5px',
'text-transform' : 'uppercase'
}
$("li.context_menu").children("a").children("span.edit").css( cssObj2 );
$("li.context_menu").children("a").children("span.delete").css( cssObj2 );
$("li.context_menu").children("a").children("span.show").css( cssObj2 );
$("li.context_menu").children("a").children("div.down_main").css( cssObj2 );
$("li.context_menu").children("a").children("div.up_main").css( cssObj2 );
});
</script>

136
admin/templates/banner.php Normal file
View File

@@ -0,0 +1,136 @@
<? global $lang; ?>
<fieldset>
<table class='table_browse' style='margin:0;'>
<tr>
<th class='header' style='width:15px;'><?=ucfirst( $lang -> getTrans( 'T_LP' ) );?></th>
<th class='header' style="width: 150px;"><?=ucfirst( $lang -> getTrans( 'T_TYTUL' ) );?></th>
<th class='header'><?=ucfirst( $lang -> getTrans( 'T_LINK' ) );?></th>
<th class='header'><?=ucfirst( $lang -> getTrans( 'T_AKTYWNY' ) );?></th>
<th class='header' style='width:15px;'></th>
<th class='header' style='width:15px;'></th>
<th class='header' style='width:15px;'></th>
<th class='header' style='width:15px;'></th>
</tr>
<?
$i = 0;
if ( is_array ( $this -> _banners ) ) foreach ( $this -> _banners as $baner )
{
?>
<div class="contextMenu" id="menu<?=$i;?>" style="display:none;">
<ul>
<li id="open" class="context_menu">
<a href='index.php?rw=edit&amp;id=<?=$baner['id'];?>' style="display: block; height: 30px; line-height: 30px;">
<span class='icon edit' style='display: block; float: left; margin: 5px 5px 0 0;'></span>
<?=$lang -> getTrans( 'T_EDYTUJ' )?>
</a>
</li>
<li id="delete" class="context_menu">
<a <?=$baner['action'];?> style="display: block; height: 30px; line-height: 30px;">
<span class='icon delete' style='display: block; float: left; margin: 5px 5px 0 0;'></span>
<?=$lang -> getTrans( 'T_USUN' );?>
</a>
</li>
<?
if ( $baner['down'] )
{
?>
<li id="show" class="context_menu">
<a href="index.php?rw=down&amp;id=<?=$baner['id'];?>" style="display: block; height: 30px; line-height: 30px;">
<div class='icon down_main' style='display: block; float: left; margin: 5px 5px 0 0;'></div>
<?=$lang -> getTrans( 'T_W_DOL' );?>
</a>
</li>
<?
}
if ( $baner['up'] )
{
?>
<li id="show" class="context_menu">
<a href="index.php?rw=up&amp;id=<?=$baner['id'];?>" style="display: block; height: 30px; line-height: 30px;">
<div class='icon up_main' style='display: block; float: left; margin: 5px 5px 0 0;'></div>
<?=$lang -> getTrans( 'T_W_GORE' );?>
</a>
</li>
<?
}
?>
</ul>
</div>
<script type='text/javascript'>
$(document).ready(function(){
$('.menu<?=$i;?>').contextMenu('menu<?=$i;?>', {
itemStyle: {
backgroundColor: '#E5E5E5',
width: '120px',
},
itemHoverStyle: {
backgroundColor: '#FFFFFF',
border: '1px solid #FFFFF',
}
});
});
</script>
<tr class="menu<?=$i;?>">
<td class='row'><?=$baner['lp'];?>.</td>
<td class='row'><?=$baner['title'];?></td>
<td class='row'><? echo mb_substr( $baner['link'] , 0 , 50 ); if ( strlen( $baner['link'] ) > 50 ) echo '...';?></td>
<td class='row'><?=$baner['enabled'];?></td>
<td class='row'>
<?
if ( $baner['down'] )
{
?><div class='icon down_main' onClick='document.location.href="index.php?rw=down&amp;id=<?=$baner['id'];?>";'></div><?
}
?>
</td>
<td class='row' style='text-align:center;'>
<?
if ( $baner['up'] )
{
?><div class='icon up_main' onClick='document.location.href="index.php?rw=up&amp;id=<?=$baner['id'];?>";'></div><?
}
?>
</td>
<td class='row' style='text-align:center;'>
<a href='index.php?rw=edit&amp;id=<?=$baner['id'];?>'><span class='icon edit' style='display:block;'></span></a>
</td>
<td class='row'><a <?=$baner['action'];?>><span class='icon delete' style='display:block;'></span></a></td>
</tr>
<?
$i++;
}
else
{
?><tr><td colspan='8'><div class='alert' style='text-align:center;'><?=$lang -> getTrans( 'T_BRAK_WYNIKOW' );?></div></td></tr><?
}
?>
</table>
<? include 'site-paging.php'; ?>
</fieldset>
<script type='text/javascript'>
$(document).ready(function(){
var cssObj = {
'display' : 'block',
'height' : '30px',
'line-height' : '30px',
'color' : '#000000',
'font-size' : '10px',
'padding-left' : '5px',
'text-transform' : 'uppercase'
}
$("li.context_menu").children("a").css( cssObj );
var cssObj2 = {
'float' : 'left',
'margin' : '5px 5px 0 0',
'color' : '#000000',
'font-size' : '10px',
'padding-left' : '5px',
'text-transform' : 'uppercase'
}
$("li.context_menu").children("a").children("span.edit").css( cssObj2 );
$("li.context_menu").children("a").children("span.delete").css( cssObj2 );
$("li.context_menu").children("a").children("span.show").css( cssObj2 );
$("li.context_menu").children("a").children("div.down_main").css( cssObj2 );
$("li.context_menu").children("a").children("div.up_main").css( cssObj2 );
});
</script>

View File

@@ -0,0 +1,63 @@
<fieldset>
<div class="change_title">wersja 1.6</div>
<ul>
<li>dodana możwliwość umieszczania reklam na stronie, aby użyć w szablonie należy użyć znacznika <b>[REKLAMA]</b></li>
</ul>
<div class="change_title">wersja 1.5</div>
<ul>
<li>ręczne sortowanie artykułów na stronach</li>
<li>poprawki graficzne</li>
<li>kilka poprawek funkcjonalności</li>
</ul>
<div class="change_title">wersja 1.4.5</div>
<ul>
<li>przywracanie wcześniejszych wersji artykułów</li>
</ul>
<div class="change_title">wersja 1.4.0</div>
<ul>
<li>zmiana layout</li>
<li>kilka poprawek funkcjonalności</li>
</ul>
<div class="change_title">wersja 1.3.2</div>
<ul>
<li>przycisk dodawania galerii w edytorze artykułu</li>
</ul>
<div class="change_title">wersja 1.3.1</div>
<ul>
<li>wyświetlanie w panelu administratora starszych wersji artykułów</li>
</ul>
<div class="change_title">wersja 1.3</div>
<ul>
<li>dodano nowe typy strony: <b>rejestracja, mapa strony, wyszukiwarka</b></li>
<li><b>mapa strony</b> - wyświetlanie mapy strony</li>
</ul>
<div class="change_title">wersja 1.2</div>
<ul>
<li><b>wyszukiwarka</b> - dodano wyszukiwarkę, aby umieścić na stronie w szablonie strony należy umieścić znacznik "[WYSZUKIWARKA]"</li>
</ul>
<div class="change_title">wersja 1.1</div>
<ul>
<li><b>artykuły</b> - dodanie autora artykułu</li>
<li><b>zarządzanie użytkownikami</b> - dodatkowe pola opisujące użytkowników i administratorów</li>
<li><b>rejestracja użytkowników</b> - aby umożliwość rejestrację należy włączyć opcje w ustawieniach i w szablonie umieścić znacznik "[PANEL_UZYTKOWNIKA]"</li>
<li><b>archiwum aktualności</b> - po usunięciu aktualności dostępna one w "Archiwum" -> "Aktualności" skąd można je przywrócić bądź definitywnie usunąć.</li>
</ul>
<div class="change_title">wersja 1.0</div>
<ul>
<li>Wersja podstawowa.</li>
</ul>
</fieldset>
<style type="text/css">
ul {
margin-left: 20px;
margin-bottom: 20px;
}
.change_title {
padding: 10px;
font-size: 12px;
font-weight: bold;
}
fieldset {
padding: 20px;
}
</style>

View File

@@ -0,0 +1,94 @@
<? global $lang; ?>
<script type="text/javascript">
$( document ).ready( function()
{
$( '.toggle_filtr' ).click( function()
{
if ( $( '#filtr' ).css( 'display' ) == 'none' )
{
$( '#filtr' ).show();
$( '.toggle_filtr' ).html( 'ukryj filtr' );
}
else
{
$( '#filtr' ).hide();
$( '.toggle_filtr' ).html( 'pokaż filtr' );
}
})
})
</script>
<p class="toggle_filtr">pokaż filtr</p>
<div id="filtr">
<form method='POST' id='db_filtr_yes' action='index.php'>
<input type='hidden' name='set_db_filtr' value='yes'>
<?
if ( is_array ( $this -> _filtr_combo ) ) foreach ( $this -> _filtr_combo as $combo )
{
?>
<div class="edit_line">
<label><?=ucfirst( $combo['name'] );?>:</label>
<div class="input">
<select name="<?=$combo['seo_name'];?>">
<option value=''>&nbsp;</option>
<?
if ( is_array ( $combo['value'] ) ) foreach ( $combo['value'] as $key => $val )
{
?>
<option value='<?=$key;?>'
<?
if ( isset( $combo['val'] ) && $key == $combo['val'] )
{
?>selected='selected'<?
}
?>
><?=$val;?></option>
<?
}
?>
</select>
</div>
</div>
<?
}
if ( is_array( $this -> _filtr_text ) ) foreach ( $this -> _filtr_text as $text )
{
?>
<div class="edit_line">
<label><?=ucfirst( $text['name'] );?>:</label>
<div class="input">
<input type='text' name="<?=$text['seo_name'];?>" value="<? if ( isset( $text['value'] ) ) echo $text['value'];?>">
</div>
</div>
<?
}
if ( is_array( $this -> _filtr_ttext ) ) foreach ( $this -> _filtr_ttext as $text )
{
?>
<div class="edit_line">
<label><?=ucfirst( $text['name'] );?>:</label>
<div class="input">
<input type='text' name="<?=$text['seo_name'];?>" value="<? if ( isset( $text['value'] ) ) echo $text['value'];?>">
<?
if ( is_array( $text['select'] ) ) foreach ( $text['select'] as $key => $val )
{
?><input type='hidden' name="<?=$text['seo_name'];?>_trans[]" value="<?=htmlspecialchars( $key );?>[]<?=htmlspecialchars( $val );?>"><?
}
?>
</div>
</div>
<?
}
?>
<div class="edit_line" style="text-align: left; padding-left: 180px;">
<div class="btn" onClick='$("#db_filtr_yes").submit();' style="display: inline-block;"><?=$lang -> getTrans( 'T_ZASTOSUJ' );?></div>
<div class='btn' onClick='$("#fdb_filtr_no").submit();' style="display: inline-block;"><?=$lang -> getTrans( 'T_ANULUJ' );?></div>
</div>
</form>
<form method='POST' id='fdb_filtr_no'>
<input type='hidden' name='set_db_filtr' value='no'>
</form>
</div>

View File

@@ -0,0 +1,86 @@
<? global $lang; ?>
<script type='text/javascript'>
function changePage(e)
{
var charCode;
if(e && e.which)
{
charCode = e.which;
}
else if(window.event)
{
e = window.event;
charCode = e.keyCode;
}
if(charCode == 13)
{
var bs = $("#page_bs").val();
bs = parseInt(bs);
if ( isNaN(bs) )
bs = 1;
document.location.href='index.php?bs='+bs;
}
}
function changeNumerRows()
{
var num = $("#rows").val();
num = parseInt(num);
if ( isNaN(num) )
num = 1;
document.location.href='index.php?r='+num;
}
</script>
<table id='pagin'>
<tr>
<td style='text-align:left; padding: 10px 5px;'>
<?=$lang -> getTrans( 'T_REKORDY' );?>: <?=$this -> _start;?> - <?=$this -> _end;?> <?=$lang -> getTrans( 'T_Z' );?> <?=$this -> _total;?>
</td>
<td>
<?=$lang -> getTrans( 'T_LICZBA_REKORDOW' );?>:
</td>
<td>
<select name='rows' onChange='changeNumerRows();' id='rows'>
<option value='5' <? if ( $this -> _limit == 5 ) echo "selected='selected'";?>>5</option>
<option value='10' <? if ( $this -> _limit == 10 ) echo "selected='selected'";?>>10</option>
<option value='25' <? if ( $this -> _limit == 25 ) echo "selected='selected'";?>>25</option>
<option value='50' <? if ( $this -> _limit == 50 ) echo "selected='selected'";?>>50</option>
<option value='100' <? if ( $this -> _limit == 100 ) echo "selected='selected'";?>>100</option>
</select>
</td>
<?
if ( $this -> _bs > 1 )
{
?>
<td><a href='<?=$this -> _link;?>?bs=1' class='arrow left_act_max'></a></td>
<td><a href='<?=$this -> _link;?>?bs=<?=($this -> _bs - 1);?>' class='arrow left_act'></a></td>
<?
}
else
{
?>
<td><a class='arrow left_ina_max'></a></td>
<td><a class='arrow left_ina'></a></td>
<?
}
?>
<td>
<input type='text' class="noform" value='<?=$this -> _bs;?>' style='width:20px; padding:3px; text-align:center;' id='page_bs' onKeyPress='changePage(event)'>
</td>
<?
if ( $this -> _bs < $this -> _ls )
{
?>
<td><a href='<?=$this -> _link;?>?bs=<?=($this -> _bs + 1);?>' class='arrow right_act'></a></td>
<td><a href='<?=$this -> _link;?>?bs=<?=$this -> _ls;?>' class='arrow right_act_max'></a></td>
<?
}
else
{
?>
<td><a class='arrow right_ina'></a></td>
<td><a class='arrow right_ina_max'></a></td>
<?
}
?>
</table>

View File

@@ -0,0 +1,155 @@
<? global $lang;?>
<fieldset>
<?
if ( isset( $this -> _filtr ) )
include 'templates/data-browse-filtr.php';
?>
<table class='table_browse' style='min-width:500px;'>
<thead>
<tr>
<?
$i = 0;
if ( is_array( $this -> _table_headers ) ) foreach ( $this -> _table_headers as $key => $val )
{
if ( $i == 1 && $this -> _checkbox )
echo '<th class="header" style="width: 20px;"></th>';
?>
<th class='header'<? if (!$val['value'] || $val['value'] == 'Lp.') echo "style='width:15px;'";?>
<?
if ( isset( $val['sort'] ) )
{
?>
style='cursor:pointer;'
onClick="document.location.href='index.php?s=<?=$val['sort'];?>';">
<?
if ( $val['way'] == 'ASC')
{
?><img src='../images/system/sico_sort_asc.png'><?
}
else if ( $val['way'] == 'DESC' )
{
?><img src='../images/system/sico_sort_desc.png'><?
}
echo ucfirst( $val['value'] );
}
else
{
?>><?=ucfirst( $val['value'] );?><?
}
?>
</th>
<?
$i++;
}
?>
</tr>
</thead>
<?
if ( $this -> _row_count )
{
?>
<tbody>
<?
$i = 0;
foreach ( $this -> _table_values as $key => $val )
{
?>
<div class="contextMenu" id="menu<?=$i;?>" style='display:none;'>
<ul>
<?
if ( isset( $val[ $lang -> getTrans( 'T_EDYTUJ' ) ] ) )
{
?><li id="open" class="context_menu"><?=$val[ $lang -> getTrans( 'T_EDYTUJ' ) ]['value'];?></li><?
}
if ( isset( $val [ $lang -> getTrans( 'T_POKAZ' ) ] ) )
{
?><li id="show" class="context_menu"><?=$val[ $lang -> getTrans( 'T_POKAZ' ) ]['value'];?></li><?
}
if ( isset( $val[ $lang -> getTrans( 'T_USUN' ) ] ) )
{
?><li id="delete" class="context_menu"><?=$val[ $lang -> getTrans( 'T_USUN' ) ]['value'];?></li><?
}
?>
</ul>
</div>
<script type='text/javascript'>
$(document).ready(function(){
$('.menu<?=$i;?>').contextMenu('menu<?=$i;?>', {
itemStyle: {
backgroundColor: '#E5E5E5',
},
itemHoverStyle: {
backgroundColor: '#FFFFFF',
border: '1px solid #FFFFF',
}
});
});
</script>
<tr class="menu<?=$i;?>">
<?
$j = 0;
foreach ( $val as $value )
{
?>
<td class='row' style='<?=$this -> eprint( $value['style'] );?>'>
<?
if ( $value['value'] )
echo stripslashes( $value['value'] );
else
echo '-';
?>
</td>
<?
$j++;
}
?>
</tr>
<?
$i++;
}
?>
</tbody>
<?
}
else
{
?>
<tr>
<td colspan='<?=count( $this -> _table_headers );?>' style='text-align:center;'>
<div class='alert' style='text-align:center;'><?=$lang -> getTrans( 'T_BRAK_WYNIKOW' );?></div>
</td>
</tr>
<?
}
?>
</table>
<? include 'templates/data-browse-paging.php'; ?>
</fieldset>
<script type='text/javascript'>
$(document).ready(function(){
$("li").children("a").children("span.edit").parent('a').append( '<?=$lang -> getTrans( 'T_EDYTUJ' );?>' );
$("li").children("a").children("span.delete").parent('a').append( '<?=$lang -> getTrans( 'T_USUN' );?>' );
$("li").children("a").children("span.show").parent('a').append( '<?=$lang -> getTrans( 'T_POKAZ' );?>' );
var cssObj = {
'display' : 'block',
'height' : '30px',
'line-height' : '30px',
'color' : '#000000',
'font-size' : '10px',
'padding-left' : '5px',
'text-transform' : 'uppercase'
}
$("li.context_menu").children("a").css( cssObj );
var cssObj2 = {
'float' : 'left',
'margin' : '5px 5px 0 0',
'color' : '#000000',
'font-size' : '10px',
'padding-left' : '5px',
'text-transform' : 'uppercase'
}
$("li.context_menu").children("a").children("span.edit").css( cssObj2 );
$("li.context_menu").children("a").children("span.delete").css( cssObj2 );
$("li.context_menu").children("a").children("span.show").css( cssObj2 );
});
</script>

View File

@@ -0,0 +1,164 @@
<? global $lang; ?>
<fieldset>
<form method='POST' action='<?=$this -> _form_adress;?>' id='<?=$this -> _form_id;?>' enctype='multipart/form-data'>
<?
if ( is_array ( $this -> _hidden_tab ) ) foreach ( $this -> _hidden_tab as $hidden )
{
?><input type='hidden' name='<?=$hidden['name'];?>' value='<?=$this -> secureHTML( $hidden['value'] );?>'><?
}
if ( $this -> _form_key && $this -> _form_val )
{
?><input type='hidden' name='rw' value='db_edit_save'><?
}
else
{
?>
<input type='hidden' name='rw' value='db_edit_add_new'>
<input type='hidden' name='<?=base64_encode( 'time' );?>' value='<?=base64_encode( date( 'Y-m-d H:i:s' ) );?>'>
<?
}
if ( is_array ( $this -> _hidden_param_tab ) ) foreach ( $this -> _hidden_param_tab as $hidden )
{
?><input type='hidden' name='<?=$hidden['name'];?>' value='<?=$this -> secureHTML( $hidden['value'] );?>'><?
}
?>
<?
if ( is_array( $this -> _table_edit_tab ) ) foreach ( $this -> _table_edit_tab as $tab )
{
?>
<div class="edit_line" id='div_<?=$tab['tr_id'];?>'>
<label><?=ucfirst( $tab['name'] );?>:</label>
<div class="input">
<?
if ( $tab['type'] == 'label' )
{
?>
<input type='hidden' id='<?=$tab['input_id'];?>' name='<?=$tab['input_id'];?>' value='<?=$this -> secureHTML( $tab['input_value'] );?>' <?=$tab['input_action'];?>><?=$tab['input_value'];?>
<?
}
if ( $tab['type'] == 'text' )
{
?>
<input type='text' id='<?=$tab['input_id'];?>' name='<?=$tab['input_id'];?>' value='<?=$this -> secureHTML( $tab['input_value'] );?>' <?=$tab['input_action'];?>>
<?
}
if ( $tab['type'] == 'textarea' )
{
?>
<textarea name='<?=$tab['input_id'];?>' id='<?=$tab['input_id'];?>' cols='70' rows='5'><?=stripslashes($tab['input_value']);?></textarea>
<?
}
if ( $tab['type'] == 'radio' )
{
foreach ( $tab['input_value'] as $key => $val )
{
?>
<input type='radio' name='<?=$tab['input_name'];?>' id="<?=$tab['input_nam'] . '_' . $val;?>" value='<?=$key;?>'
<?
if ( $tab['var'] == $key )
echo 'checked';
?>
><?=$val;?>
<?
}
}
if ( $tab['type'] == 'file' )
{
?>
<input type='file' id='<?=$tab['input_id'];?>' name='<?=$tab['input_id'];?>'>
<?
if ( $tab['input_value'] )
{
?>
<script>
$(document).ready(function(){
$('#imageshow').tooltip({
showURL: false,
opacity: 1,
bodyHandler: function() {
return $('<img/>').attr('src','../<?=$tab['input_value'];?>');
}
});
});
</script>
<div style='display:inline; margin-left:40px; margin-top:3px;' id='imageshow'><?=$lang -> getTrans( 'T_ZDJECIE' );?></div>
<?
}
}
if ( $tab['type'] == 'combo' )
{
?>
<select name='<?=$tab['input_name'];?>' <?=$tab['input_action'];?> id='<?=$tab['input_id'];?>'>
<?
foreach ( $tab['input_value'] as $key => $val )
{
?>
<option value='<?=$key;?>'
<?
if ( isset( $tab['var'] ) && $tab['var'] == $key )
{
?>selected<?
}
?>><?=$val;?>
</option><?
}
?>
</select>
<?
}
?>
</div
</div>
<?
}
if ( isset( $this -> _password ) )
{
?>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_HASLO' ) );?>:</label>
<div class="input">
<input type='password' style='width:200px;' name='<?=$this -> _pass_name1;?>' id='<?=$this -> _pass_name1;?>' <?=$this -> _pass_action;?>>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_HASLO_POWTORZ' ) );?>:</label>
<div class="input">
<input type='password' style='width:200px;' name='<?=$this -> _pass_name2;?>' id='<?=$this -> _pass_name2;?>' <?=$this -> _pass_action2;?>>
</div>
</div>
<?
}
?>
<?
if ( isset( $this -> _file_upload ) )
{
if ( is_array( $this -> _upload_tab ) ) foreach ( $this -> _upload_tab as $uplaod )
{
?><input type='hidden' name='<?=$uplaod['name'];?>' value='<?=$uplaod['value'];?>'><?
}
}
if ( isset( $this -> _cancel_button ) )
{
?>
<a href='<?=$this -> _cancel_adress;?>
<?
if ( $this -> _cancel_key && $this -> _cancel_val )
{
?>?<?=$this -> _cancel_key;?>=<?=$this -> _cancel_val;?><?
}
?>
' class='btn'><?=$this -> _cancel_name;?></a>
<?
}
?>
</form>
</fieldset>

View File

@@ -0,0 +1,110 @@
<? global $lang; ?>
<fieldset>
<form method='POST' action='index.php?page_type=layout' id='formularz' enctype='multipart/form-data'>
<input type='hidden' name='rw' value='<?=$this -> _rw;?>'>
<?
if ( $this -> _rw == 'save_new' )
{
?><input type='hidden' name='<?=base64_encode("time");?>' value='<?=base64_encode(date("Y-m-d H:i:s"));?>'><?
}
else if ( $this -> _rw == 'save' )
{
?><input type='hidden' id="idk" name='id' value='<?=$this -> _id;?>'><?
}
?>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_NAZWA' ) );?>:</label>
<div class="input">
<input style='width:200px;' type='text' id='name' name='name' value='<? if ( isset( $this -> _name ) ) echo $this -> secureHTML( $this -> _name );?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_AKTYWNY' ) );?>:</label>
<div class="input">
<input type="radio" name="enabled" class="enabled" id="enabled_0" value='0' <? if ( !isset( $this -> _enabled ) || $this -> _enabled == 0 ) echo 'checked="checked" '; ?>>
<?=$lang -> getTrans( 'T_NIE' );?>
<input type="radio" name="enabled" class="enabled" id="enabled_1" value='1' <? if ( isset( $this -> _enabled ) && $this -> _enabled == 1 ) echo 'checked="checked" '; ?>>
<?=$lang -> getTrans( 'T_TAK' );?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_STRONY' ) );?>:</label>
<div class="input">
<table class='t_category'>
<?
$i=0;
if ( is_array( $this -> _pages ) ) foreach ( $this -> _pages as $page )
{
if ( $i%3 == 0 )
{
?><tr><?
}
?>
<td style='width:33%;'>
<input type='checkbox' name='pages[]' value='<?=$page -> get_id();?>' style='width:15px;'
<?
if ( $this -> _rw == 'save' && is_array( $this -> _pages_act ) && in_array( $page -> get_id() , $this -> _pages_act ) )
{
?>checked='checked'<?
}
?>
><?=$page -> get_title();?>
</td>
<?
if ( $i%3 == 2 )
{
?></tr><?
}
$i++;
}
?>
</table>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_HTML' ) );?>:</label>
<div class="input">
<textarea name='html' class="text" id="html" cols="100" rows='50' style="width: 780px; height: 250px;"><? if ( isset( $this -> _html ) ) echo $this -> secureHTML( $this -> _html );?></textarea>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_CSS' ) );?>:</label>
<div class="input">
<textarea name='css' class="text" id="css" cols="100" rows='50' style="width: 780px; height: 250px;"><? if ( isset( $this -> _css ) ) echo $this -> secureHTML( $this -> _css );?></textarea>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_JAVASCRIPT' ) );?>:</label>
<div class="input">
<textarea name='js' class="text" id="js" cols="100" rows='50' style="width: 780px; height: 250px;"><? if ( isset( $this -> _js ) ) echo $this -> secureHTML( $this -> _js );?></textarea>
</div>
</div>
</form>
</fieldset>
<script type="text/javascript">
function saveLayout()
{
var id = $("#idk").val();
var name = $("#name").val();
var enabled = $(".enabled:checked").val();
var html = $("#html").val();
var css = $("#css").val();
var js = $("#js").val();
var pages = '';
$('input:checkbox:checked').each(
function() {
if ( pages != '' )
pages = pages + ':';
pages = pages + $(this).val();
}
);
$.prompt('<?=$lang -> getTrans( 'T_TRWA_ZAPISYWANIE' );?>');
xajax_saveLayout( id , name , enabled , html , css , js , pages );
}
</script>

View File

@@ -0,0 +1,68 @@
<? global $lang; ?>
<div class='action_panel'>
<div class='title'><?=ucfirst( $lang -> getTrans( 'T_STRONA' ) );?>: <?=$this -> _title;?></div>
</div>
<div class='icons'>
<div class='icon' onClick='saveOrder()'>
<img src='../images/system/sico_save_ajax.png'>
<?=$lang -> getTrans( 'T_ZAPISZ' );?>
</div>
<div class='icon' onClick='document.location.href="./?rw=back";'>
<img src='../images/system/sico_cancel.png'>
<?=$lang -> getTrans( 'T_ANULUJ' );?>
</div>
</div>
<? global $lang;?>
<fieldset>
<ul id="articles">
<?
if ( is_array( $this -> _articles ) ) foreach ( $this -> _articles as $art )
{
?>
<li id="<?=$art['id'];?>"><?=$art['title'];?></li>
<?
}
?>
</ul>
</fieldset>
<script type="text/javascript">
function saveOrder() {
var order = $('ul#articles').sortable("toArray");
$.prompt('<?=ucfirst( $lang -> getTrans( 'T_TRWA_ZAPISYWANIE' ) );?>...');
xajax_saveArticlesOrder( <?=$this -> _id;?> , order );
}
$(function() {
$('ul#articles').sortable({
axis: "y",
cursor: "move"
});
});
</script>
<style type="text/css">
ul#articles {
margin: 20px 35px;
}
ul#articles li {
border: 1px solid #DADADA;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(47%,#f6f6f6), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* IE10+ */
background: linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
padding: 7px 12px;
margin-bottom: 4px;
margin-top: 4px;
list-style-type: circle;
color: #596a72;
font-size: 11px;
}
ul#articles li:hover {
background-color: white;
cursor: move;
}
</style>

View File

@@ -0,0 +1,41 @@
<? global $lang; ?>
<fieldset>
<?
if ( is_array( $this -> _articles ) )
{
?>
<table class='table_browse'>
<thead>
<tr>
<td class='header' style='width:15px; text-align:center;'><?=$lang -> getTrans( 'T_LP' );?></td>
<td class='header'><?=$lang -> getTrans( 'T_TYTUL' );?></td>
<td class='header' style="text-align: center;"><?=$lang -> getTrans( 'T_DATA_MODYFIKACJI' );?></td>
<td class='header' style='width:15px;'></td>
</tr>
</thead>
<tbody>
<?
foreach ( $this -> _articles as $article )
{
?>
<tr>
<td class='row' style='text-align:center;'><?=++$i;?>.</td>
<td class='row'><?=$article -> get_title();?></td>
<td class="row" style="text-align: center;"><?=$article -> get_date_modify();?></td>
<td class='row'>
<a href="./?page_type=page_articles&rw=edit&id=<?=$article -> get_id();?>">
<span class='icon edit'></span>
</a>
</td>
</tr>
<?
}
?>
</tbody>
</table>
<?
}
else
echo '<div id="alert" class="alert" style="margin: 0px; width: 100%; border: 0px; text-align: center;">' . $lang -> getTrans( 'T_BRAK_PRZYPISANYCH_ARTYKULOW' ) . '</div>';
?>
</fieldset>

View File

@@ -0,0 +1,148 @@
<? global $lang; ?>
<fieldset>
<table class='table_browse'>
<thead>
<tr>
<td class='header' style='width: 15px;'><?=$lang -> getTrans( 'T_LP' );?></td>
<td class='header'><?=ucfirst( $lang -> getTrans( 'T_NAZWA' ) );?></td>
<td class='header'><?=ucfirst( $lang -> getTrans( 'T_AKTYWNA' ) );?></td>
<td class='header'><?=ucfirst( $lang -> getTrans( 'T_TYP_STRONY' ) );?></td>
<td class='header'><?=ucfirst( $lang -> getTrans( 'T_KOLEJNOSC_WYSWIETLANIA' ) );?></td>
<td class='header'><?=ucfirst( $lang -> getTrans( 'T_LISTA_ARTYKULOW' ) );?></td>
<td class='header' style='width: 15px;'></td>
<td class='header' style='width: 15px;'></td>
<td class='header' style='width: 15px;'></td>
<td class='header' style='width: 15px;'></td>
</tr>
</thead>
<tbody>
<?
$i = 0;
if ( is_array( $this -> _pages ) ) foreach ( $this -> _pages as $page )
{
?>
<div class="contextMenu" id="menu<?=$i;?>" style="display:none;">
<ul>
<li id="open" class="context_menu">
<a href='index.php?rw=edit&amp;id=<?=$page['id'];?>' style="display: block; height: 30px; line-height: 30px;">
<span class='icon edit' style='display: block; float: left; margin: 5px 5px 0 0;'></span>
<?=$lang -> getTrans( 'T_EDYTUJ' )?>
</a>
</li>
<li id="delete" class="context_menu">
<a <?=$page['action'];?> style="display: block; height: 30px; line-height: 30px;">
<span class='icon delete' style='display: block; float: left; margin: 5px 5px 0 0;'></span>
<?=$lang -> getTrans( 'T_USUN' );?>
</a>
</li>
<?
if ( $page['page_down'] )
{
?>
<li id="show" class="context_menu">
<a href="index.php?rw=down&amp;id=<?=$page['page_down'];?>" style="display: block; height: 30px; line-height: 30px;">
<div class='icon down_main' style='display: block; float: left; margin: 5px 5px 0 0;'></div>
<?=$lang -> getTrans( 'T_W_DOL' );?>
</a>
</li>
<?
}
if ( $page['page_up'] )
{
?>
<li id="show" class="context_menu">
<a href="index.php?rw=up&amp;id=<?=$page['page_up'];?>" style="display: block; height: 30px; line-height: 30px;">
<div class='icon up_main' style='display: block; float: left; margin: 5px 5px 0 0;'></div>
<?=$lang -> getTrans( 'T_W_GORE' );?>
</a>
</li>
<?
}
?>
</ul>
</div>
<script type='text/javascript'>
$(document).ready(function(){
$('.menu<?=$i;?>').contextMenu('menu<?=$i;?>', {
itemStyle: {
backgroundColor: '#E5E5E5',
width: '120px',
},
itemHoverStyle: {
backgroundColor: '#FFFFFF',
border: '1px solid #FFFFF',
}
});
});
</script>
<tr class='menu<?=$i;?>'>
<td class='row'><?=$page['lp'];?>.</td>
<td class='row'><?=$page['title'];?></td>
<td class='row'><?=$page['enabled'];?></td>
<td class='row'><?=$page['page_type'];?></td>
<td class='row'><?=$page['sort_type'];?></td>
<td class='row'>
<a href="./?rw=article_list&id=<?=$page['id'];?>" style="color: #3D73C2;">pokaż</a>
</td>
<td class='row'>
<?
if ( $page['page_down'] )
{
?><div class='icon down_main' onClick='document.location.href="index.php?rw=down&amp;id=<?=$page['page_down'];?>";'></div><?
}
?>
</td>
<td class='row'>
<?
if ( $page['page_up'] )
{
?><div class='icon up_main' onClick='document.location.href="index.php?rw=up&amp;id=<?=$page['page_up'];?>";'></div><?
}
?>
</td>
<td class='row'>
<a href='index.php?rw=edit&amp;id=<?=$page['id'];?>'>
<span class='icon edit' style='display:block;'></span>
</a>
</td>
<td class='row'>
<a <?=$page['action'];?>>
<span class='icon delete' style='display:block;'></span>
</a>
</td>
</tr>
<?
$i++;
}
?>
</tbody>
</table>
<? include 'site-paging.php' ;?>
</fieldset>
<script type='text/javascript'>
$(document).ready(function(){
var cssObj = {
'display' : 'block',
'height' : '30px',
'line-height' : '30px',
'color' : '#000000',
'font-size' : '10px',
'padding-left' : '5px',
'text-transform' : 'uppercase'
}
$("li.context_menu").children("a").css( cssObj );
var cssObj2 = {
'float' : 'left',
'margin' : '5px 5px 0 0',
'color' : '#000000',
'font-size' : '10px',
'padding-left' : '5px',
'text-transform' : 'uppercase'
}
$("li.context_menu").children("a").children("span.edit").css( cssObj2 );
$("li.context_menu").children("a").children("span.delete").css( cssObj2 );
$("li.context_menu").children("a").children("span.show").css( cssObj2 );
$("li.context_menu").children("a").children("div.down_main").css( cssObj2 );
$("li.context_menu").children("a").children("div.up_main").css( cssObj2 );
});
</script>

View File

@@ -0,0 +1,218 @@
<?
/* 2011-09-26 - dodanie typu strony LINK */
global $lang;
?>
<fieldset>
<script>
$(document).ready(function() {
<?
if ( $this -> _rw == 'add' )
{
?>
$("#id_page_type").val( '2' );
<?
}
?>
$("#tabs").tabs();
var type = $("#id_page_type").val();
if ( type == 5 || type == 6 || type == 7 || type == 8 || type == 9 || type == 10 || type == 11 )
{
$("#tr_article_number").css('display','none');
$("#tr_id_sort_type").css('display','none');
if ( type == 8 ) {
$("#tr_show_title").css('display','none');
$("#tr_link").css('display','table-row');
}
}
});
function changePageType()
{
var type = $("#id_page_type").val();
if ( type == 5 || type == 6 || type == 7 || type == 8 || type == 9 || type == 10 || type == 11 )
{
$("#tr_article_number").css('display','none');
$("#tr_id_sort_type").css('display','none');
if ( type == 8 ) {
$("#tr_show_title").css('display','none');
$("#tr_link").css('display','table-row');
} else {
$("#tr_link").css('display','none');
}
}
else
{
$("#tr_article_number").css('display','table-row');
$("#tr_id_sort_type").css('display','table-row');
$("#tr_show_title").css('display','table-row');
$("#tr_link").css('display','none');
}
}
</script>
<form method='POST' id='formularz' action='index.php'>
<?
if ( $this -> _rw == 'add' )
{
?>
<input type='hidden' name='rw' value='add_new'>
<input type='hidden' name='<?=base64_encode("time");?>' value='<?=base64_encode(date("Y-m-d H:i:s"));?>'>
<?
}
if ( $this -> _rw == 'edit' )
{
?>
<input type='hidden' name='rw' value='save'>
<input type='hidden' name='id' value='<?=$this -> _id;?>'>
<?
}
?>
<input type='hidden' name='o' value='<?=$this -> _order;?>'>
<div id="tabs">
<ul>
<?
if ( is_array( $this -> _language ) ) foreach ( $this -> _language as $lg )
{
?>
<li>
<a href="#lang_<?=$lg['id'];?>">
<span><?=$lg['name'];?></span>
</a>
</li>
<?
}
?>
</ul>
<?
if ( is_array( $this -> _language ) ) foreach ( $this -> _language as $lg )
{
?>
<div id="lang_<?=$lg['id'];?>">
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_TYTUL' ) );?>:</label>
<div class="input">
<input type='text' name='title_<?=$lg['id'];?>' value='<? if ( isset( $lg['title'] ) ) echo $this -> secureHTML( $lg['title'] );?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_LINK_SEO' ) );?>:</label>
<div class="input">
<input type='text' name='seo_link_<?=$lg['id'];?>' value='<? if ( isset( $lg['seo_link'] ) ) echo $this -> secureHTML( $lg['seo_link'] );?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_META_OPIS' ) );?>:</label>
<div class="input">
<textarea name='meta_description_<?=$lg['id'];?>' cols='60' rows='5'><? if ( isset( $lg['meta_description'] ) ) echo $this -> secureHTML( $lg['meta_description'] );?></textarea>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_META_SLOWA_KLUCZOWE' ) );?>:</label>
<div class="input">
<textarea name='meta_keywords_<?=$lg['id'];?>' cols='60' rows='5'><? if ( isset( $lg['meta_keywords'] ) ) echo $this -> secureHTML( $lg['meta_keywords'] );?></textarea>
</div>
</div>
</div>
<?
}
?>
</div>
<div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_MENU' ) );?>:</label>
<div class="input">
<select name='menu'>
<?
if ( is_array( $this -> _menu ) ) foreach ( $this -> _menu as $menu )
{
?>
<option value='<?=$menu['id'];?>' <? if ( $this -> _menu_id == $menu['id'] || ( $this -> _rw == 'add' && $this -> _menu_id == $menu['id'] ) ) echo "selected='selected'";?>>
<?=$menu['name'];?>
</option>
<?
}
?>
</select>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_TYP_STRONY' ) );?>:</label>
<div class="input">
<select name='page_type_id' id='id_page_type' onChange='changePageType()'>
<?
if ( is_array ( $this -> _pages ) ) foreach ( $this -> _pages as $page )
{
?>
<option value='<?=$page['id'];?>' <? if ( isset( $this -> _page_type_id ) && $this -> _page_type_id == $page['id'] ) echo "selected='selected'"; ?>>
<?=$page['name'];?>
</option>
<?
}
?>
</select>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_KOLEJNOSC_WYSWIETLANIA' ) );?>:</label>
<div class="input">
<select name='sort_type'>
<?
if ( is_array( $this -> _sort ) ) foreach ( $this -> _sort as $sort )
{
?>
<option value='<?=$sort['id'];?>' <? if ( isset( $this -> _sort_type ) && $this -> _sort_type == $sort['id'] ) echo "selected='selected'";?>>
<?=$sort['name'];?>
</option>
<?
}
?>
</select>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_POKAZ_TYTUL' ) );?>:</label>
<div class="input">
<input type="radio" name='show_title' id="show_title_0" value="0" <? if ( !isset( $this -> _show_title ) || $this -> _show_title == 0 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_NIE' );?>
<input type="radio" name="show_title" value="1" <? if ( isset( $this -> _show_title ) && $this -> _show_title == 1 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_TAK' );?>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_LICZBA_ARTYKULOW' ) );?>:</label>
<div class="input">
<input type='text' name='article_number' value='<? if ( isset( $this -> _article_number ) ) echo $this -> _article_number; else echo '1';?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_AKTYWNA' ) );?>:</label>
<div class="input">
<input type="radio" name="enabled" id="enabled_0" value="0" <? if ( !isset( $this -> _enabled ) || $this -> _enabled == 0 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_NIE' );?>
<input type="radio" name="enabled" id="enabled_1" value='1' <? if ( isset( $this -> _enabled ) && $this -> _enabled == 1 ) echo "checked='checked'";?>>
<?=$lang -> getTrans( 'T_TAK' );?>
</div>
</div>
<div class="edit_line" id="tr_link" style="display: none;">
<label><?=ucfirst( $lang -> getTrans( 'T_LINK' ) );?>:</label>
<div class="input">
<input type="text" name="link" value="<? if ( isset( $this -> _link ) ) echo $this -> _link;?>">
</div>
</div>
</div>
</form>
</fieldset>

View File

@@ -0,0 +1,71 @@
<? global $lang; ?>
<div class='action_panel'>
<div class='title'><?=ucfirst( $this -> _title );?></div>
</div>
<div class='icons'>
<?
if ( $this -> _back )
{
?>
<div class='icon' onClick='document.location.href="index.php?act=back";'>
<img src='../images/system/sico_back.png'>
<?=$lang -> getTrans( 'T_WSTECZ' );?>
</div>
<?
}
if ( $this -> _save )
{
?>
<div class='icon' onClick='$("#<?=$this -> _id_form;?>").submit();'>
<img src='../images/system/sico_save.png'>
<?=$lang -> getTrans( 'T_ZASTOSUJ' );?>
</div>
<?
}
if ( $this -> _save_ajax )
{
?>
<div class='icon' onClick='<?=$this -> _save_ajax;?>'>
<img src='../images/system/sico_save_ajax.png'>
<?=$lang -> getTrans( 'T_ZAPISZ' );?>
</div>
<?
}
if ( $this -> _cancel )
{
?>
<div class='icon' onClick='document.location.href="index.php?rw=back";'>
<img src='../images/system/sico_cancel.png'>
<?=$lang -> getTrans( 'T_ANULUJ' );?>
</div>
<?
}
if ( $this -> _add )
{
?>
<div class='icon' onClick='document.location.href="index.php?rw=add";'>
<img src='../images/system/sico_add.png'>
<?=$lang -> getTrans( 'T_DODAJ' );?>
</div>
<?
}
if ( $this -> _update )
{
?>
<div class='icon' onClick='document.location.href="index.php?rw=update";'>
<img src='../images/system/sico_update.png'>
<?=$lang -> getTrans( 'T_AKTUALIZUJ' );?>
</div>
<?
}
if ( $this -> _delete_ajax )
{
?>
<div class='icon' onClick="<?=$this -> _delete_ajax;?>">
<img src='../images/system/sico_cancel.png'>
<?=$lang -> getTrans( 'T_USUN_ZAZNACZONE' );?>
</div>
<?
}
?>
</div>

172
admin/templates/page.php Normal file
View File

@@ -0,0 +1,172 @@
<?
global $lang , $user;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Panel Administratora</title>
<meta name="keywords" content="">
<meta name="description" content="">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="../resources/jq_tooltip/tooltip.css">
<link rel="Stylesheet" type="text/css" href="../resources/jquery/jquery-ui-1.8.2.custom.css">
<link rel="Stylesheet" type="text/css" href="../resources/jq_impromptu/jquery-impromptu.css">
<script type="text/javascript" src="../resources/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../resources/jquery/jquery-ui-1.8.2.custom.min.js"></script>
<script type="text/javascript" src="../resources/contextmenu.js"></script>
<script type="text/javascript" src="../resources/jq_tooltip/tooltip.js"></script>
<script type="text/javascript" src="../resources/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="../resources/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript" src="../resources/jq_impromptu/jquery-impromptu.3.1.min.js"></script>
<script type="text/javascript" src="../resources/jquery/jquery.ui.datepicker-pl.js"></script>
<?
global $xajax;
$xajax -> printJavascript( '../resources/xajax/' );
?>
</head>
<body>
<div class='page_header'>
<div class="page_header_content">
<div id="logo" onClick='document.location.href="./";'><?=$this -> _site_title;?></div>
<?
if ( $user && $user -> get_login() )
{
?>
<div id="user_menu_after">
<form method='POST' id='f_logon' action='./'>
<input type='hidden' name='rw' value='user_logout'>
</form>
<a href="#" class="logout" onClick='$("#f_logon").submit();'>
<span></span>
</a>
</div>
<div id="user_menu">
<img src="../images/system/user.png">
<a href="./?page_type=settings" id="login"><?=$user -> get_login();?></a>
</div>
<?
}
?>
</div>
</div>
<div class="page_main">
<?
if ( $user && $user -> get_admin() )
{
?>
<div class="page_main_left">
<ul class="menu_left">
<li>
<a href="./?page_type=page_articles" <? if ( $this -> _p == 'page_articles' || $this -> _p == 'article_archive' || $this -> _p == 'page_article_sort' || $this -> _p == 'page_articles' || $this -> _p == 'menu_definition' || $this -> _p == 'page_definition' ) echo 'class="active"';?>>
<span>
<img src="../../images/system/pages.png">
</span>
<?=$lang -> getTrans( 'T_CMS' );?>
</a>
<ul>
<li><a href="./?page_type=menu_definition" <? if ( $this -> _p == 'menu_definition' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_DEFINICJE_MENU' );?></a></li>
<li><a href="./?page_type=page_definition" <? if ( $this -> _p == 'page_definition' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_STRONY' );?></a></li>
<li><a href="./?page_type=page_articles" <? if ( $this -> _p == 'page_articles' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ARTYKULY' );?></a></li>
<li><a href="./?page_type=page_article_sort" <? if ( $this -> _p == 'page_article_sort' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_SORTOWANIE_ARTYKULOW' );?></a></li>
<li><a href="./?page_type=article_archive" <? if ( $this -> _p == 'article_archive' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ARCHIWUM' );?></a></li>
<li><a href="http://<?=$this -> _site_title;?>" target="_blank"><?=$lang -> getTrans( 'T_PODGLAD' );?></a></li>
</ul>
</li>
<li>
<a href="./?page_type=settings" <? if ( $this -> _p == 'settings' || $this -> _p == 'layout' || $this -> _p == 'translation' || $this -> _p == 'lang' || $this -> _p == 'admins' || $this -> _p == 'users' ) echo 'class="active"';?>>
<span>
<img src="../../images/system/settings.png">
</span>
<?=$lang -> getTrans( 'T_KONFIGURACJA' );?>
</a>
<ul>
<li><a href="./?page_type=users" <? if ( $this -> _p == 'users' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_UZYTKOWNICY' );?></a></li>
<li><a href="./?page_type=admins" <? if ( $this -> _p == 'admins' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ADMINISTRATORZY' );?></a></li>
<?
if ( $user -> _login == 'vampirius' )
{
?>
<li><a href="./?page_type=lang" <? if ( $this -> _p == 'lang' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_JEZYKI' );?></a></li>
<li><a href="./?page_type=translation" <? if ( $this -> _p == 'translation' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_TLUMACZENIA' );?></a></li>
<?
}
?>
<li><a href="./?page_type=settings" <? if ( $this -> _p == 'settings' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_USTAWIENIA' );?></a></li>
<li><a href="./?page_type=layout" <? if ( $this -> _p == 'layout' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_SZABLONY' );?></a></li>
</ul>
</li>
<li>
<a href="./?page_type=page_articles" <? if ( $this -> _p == 'guest_book' || $this -> _p == 'banned_login' || $this -> _p == 'banned_email' || $this -> _p == 'adverts' || $this -> _p == 'banner' ) echo 'class="active"';?>>
<span>
<img src="../../images/system/other.png">
</span>
<?=$lang -> getTrans( 'T_POZOSTALE' );?>
</a>
<ul>
<li><a href="./?page_type=guest_book" <? if ( $this -> _p == 'guest_book' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_KSIEGA_GOSCI' );?></a></li>
<li><a href="./?page_type=banner" <? if ( $this -> _p == 'banner' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_BANERY' );?></a></li>
<li><a href="./?page_type=adverts" <? if ( $this -> _p == 'adverts' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_REKLAMA' );?></a></li>
<li><a href="./?page_type=banned_email" <? if ( $this -> _p == 'banned_email' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ZAKAZANE_MAILE' );?></a></li>
<li><a href="./?page_type=banned_login" <? if ( $this -> _p == 'banned_login' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ZAKAZANE_LOGINY' );?></a></li>
</ul>
</li>
</ul>
</div>
<?
}
?>
<div class="page_main_right">
<?
if ( isset( $this -> _alert ) )
{
?>
<script type='text/javascript'>
function closeAlert()
{
$("#alert").hide('blind', { direction: 'vertical' }, 1000);
}
$(document).ready(function(){
setTimeout("closeAlert()",5000)
});
</script>
<div id="alert" class="alert">
<div>
<img src="../images/system/sico_alert.png">
<?=$this -> _alert;?>
</div>
</div>
<?
}
/*
* formularz logowania
*/
if ( !isset( $user ) || !is_object( $user ) || !$user -> get_admin() )
{
?>
<form method='POST' id='f_logon' action='./'>
<input type='hidden' name='rw' value='user_logon'>
<div class="login_form">
<div class="title"><?=ucfirst( $lang -> getTrans( 'T_LOGOWANIE' ) );?>:</div>
<div class="label"><?=$lang -> getTrans( 'T_LOGIN' );?>::</div>
<div class="input">
<input type="text" name="user_login" class="input_login" style="width: 228px; height: 20px;" onKeyPress='checkKey(event,"f_logon")'>
</div>
<div class="label"><?=$lang -> getTrans( 'T_HASLO' );?>:</div>
<div class="input">
<input type="password" class="input_login" name="user_password" style="width: 228px; height: 20px;">
</div>
<input type="button" class="button" onClick="$( '#f_logon' ).submit();" value="<?=$lang -> getTrans( 'T_ZALOGUJ' );?>">
</div>
</form>
<?
}
else if ( $user -> get_admin() )
echo $this -> _content;
?>
</div>
</div>
<div id="dialog_place"></div>
</body>
</html>

View File

@@ -0,0 +1,85 @@
<? global $lang; ?>
<script type='text/javascript'>
function changePage(e)
{
var charCode;
if(e && e.which)
{
charCode = e.which;
}
else if(window.event)
{
e = window.event;
charCode = e.keyCode;
}
if(charCode == 13)
{
var bs = $("#page_bs").val();
bs = parseInt(bs);
if ( isNaN(bs) )
bs = 1;
document.location.href='index.php?bs='+bs;
}
}
function changeNumerRows()
{
var num = $("#rows").val();
num = parseInt(num);
if ( isNaN(num) )
num = 1;
document.location.href='index.php?r='+num;
}
</script>
<table id='pagin'>
<tr>
<td style='width: 225px; text-align:left; padding: 10px 5px;'>
<?=$lang -> getTrans( 'T_REKORDY' );?>: <?=$this ->_start;?> - <?=$this -> _end;?> <?=$lang -> getTrans( 'T_Z' );?> <?=$this -> _total;?>
</td>
<td>
<?=$lang -> getTrans( 'T_LICZBA_REKORDOW' );?>:
</td>
<td>
<select name='rows' onChange='changeNumerRows();' id='rows'>
<option value='5' <? if ( $this -> _limit == 5 ) echo "selected='selected'";?>>5</option>
<option value='10' <? if ( $this -> _limit == 10 ) echo "selected='selected'";?>>10</option>
<option value='25' <? if ( $this -> _limit == 25 ) echo "selected='selected'";?>>25</option>
<option value='50' <? if ( $this -> _limit == 50 ) echo "selected='selected'";?>>50</option>
<option value='100' <? if ( $this -> _limit == 100 ) echo "selected='selected'";?>>100</option>
</select>
</td>
<?
if ( $this -> _bs > 1 )
{
?>
<td><a href='<?=$this -> _link;?>?bs=1' class='arrow left_act_max'></a></td>
<td><a href='<?=$this -> _link;?>?bs=<?=($this -> _bs - 1);?>' class='arrow left_act'></a></td>
<?
}
else
{
?>
<td><a class='arrow left_ina_max'></a></td>
<td><a class='arrow left_ina'></a></td>
<?
}
?>
<td>
<input type='text' class="noform" value='<?=$this -> _bs;?>' style='width:20px; padding:3px; text-align:center;' id='page_bs' onKeyPress='changePage(event)'>
</td>
<?
if ( $this -> _bs < $this -> _ls )
{
?>
<td><a href='<?=$this -> _link;?>?bs=<?=($this -> _bs + 1);?>' class='arrow right_act'></a></td>
<td><a href='<?=$this -> _link;?>?bs=<?=$this -> _ls;?>' class='arrow right_act_max'></a></td>
<?
}
else
{
?>
<td><a class='arrow right_ina'></a></td>
<td><a class='arrow right_ina_max'></a></td>
<?
}
?>
</table>

View File

@@ -0,0 +1,177 @@
<? global $lang; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#tabs").tabs();
});
</script>
<fieldset>
<form method='POST' action='index.php?page=shop_settings' id='formularz'>
<input type='hidden' name='rw' value='save_shop_settings'>
<div id="tabs">
<ul>
<li>
<a href="#contact_settings"><span><?=$lang -> getTrans( 'T_DANE_ADRESOWE' );?></span></a>
</li>
<li>
<a href="#post"><span><?=$lang -> getTrans( 'T_POCZTA' );?></span></a>
</li>
<li>
<a href="#other"><span><?=$lang -> getTrans( 'T_POZOSTALE' );?></span></a>
</li>
</ul>
<div id="contact_settings">
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_NAZWA_FIRMY' ) );?>:</label>
<div class="input">
<input type='text' name='firm_name' value='<?=$this -> _firm_name;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_ULICA' ) );?>:</label>
<div class="input">
<input type='text' name='street' value='<?=$this -> _street;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_KOD_POCZTOWY' ) );?>:</label>
<div class="input">
<input type='text' name='postal_code' value='<?=$this -> _postal_code;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_MIASTO' ) );?>:</label>
<div class="input">
<input type='text' name='city' value='<?=$this -> _city;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_NIP' ) );?>:</label>
<div class="input">
<input type='text' name='nip' value='<?=$this -> _nip;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_NUMER_RACHUNKU' ) );?>:</label>
<div class="input">
<input type='text' name='account' value='<?=$this -> _account;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_EMAIL' ) );?>:</label>
<div class="input">
<input type='text' name='email' value='<?=$this -> _email;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_TELEFON' ) );?>:</label>
<div class="input">
<input type='text' name='phone' value='<?=$this -> _phone;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_FAX' ) );?>:</label>
<div class="input">
<input type='text' name='fax' value='<?=$this -> _fax;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_OSOBA_DO_KONTAKTU' ) );?>:</label>
<div class="input">
<input type='text' name='person' value='<?=$this -> _person;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_FORMULARZ_KONTAKTOWY' ) );?>:</label>
<div class="input">
<select name='contact_form'>
<option value='1' <? if ( $this -> _contact_form == 1 ) echo "selected='selected'";?>>
<?=$lang -> getTrans( 'T_WLACZONY' );?>
</option>
<option value='0' <? if ( $this -> _contact_form == 0 ) echo "selected='selected'";?>>
<?=$lang -> getTrans( 'T_WYLACZONY' );?>
</option>
</select>
</div>
</div>
</div>
<div id="post">
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_EMAIL_ADMINISTRATORA' ) );?>:</label>
<div class="input">
<input type='text' name='admin_email' value='<?=$this -> _admin_email;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_EMAIL_HOST' ) );?>:</label>
<div class="input">
<input type='text' name='email_host' value='<?=$this -> _email_host;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_EMAIL_PORT' ) );?>:</label>
<div class="input">
<input type='text' name='email_port' value='<?=$this -> _email_port;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_EMAIL_LOGIN' ) );?>:</label>
<div class="input">
<input type='text' name='email_login' value='<?=$this -> _email_login;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_EMAIL_HASLO' ) );?>:</label>
<div class="input">
<input type='password' name='email_password' value='<?=$this -> _email_password;?>'>
</div>
</div>
</div>
<div id="other">
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_KLUCZ_GOOGLE_MAP' ) );?>:</label>
<div class="input">
<input type='text' name='google_map_key' value='<?=$this -> _google_map_key;?>'>
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_LICZBA_ODWIEDZIN' ) );?>:</label>
<div class="input">
<input type="text" name="visit_count" value="<?=$this -> _visit_count;?>">
</div>
</div>
<div class="edit_line">
<label><?=ucfirst( $lang -> getTrans( 'T_REJESTRACJA' ) );?>:</label>
<div class="input">
<select name="register">
<option value="0" <? if ( $this -> _register == 0 ) echo 'selected="selected"'; ?>><?=$lang -> getTrans( 'T_REJESTRACJA_ZAMKNIETA' );?></option>
<option value="1" <? if ( $this -> _register == 1 ) echo 'selected="selected"'; ?>><?=$lang -> getTrans( 'T_AKTYWACJA_PRZEZ_ADMINISTRATORA' );?></option>
<option value="2" <? if ( $this -> _register == 2 ) echo 'selected="selected"'; ?>><?=$lang -> getTrans( 'T_AKTYWACJA_PRZEZ_EMAIL' );?></option>
</select>
</div>
</div>
</div>
</div>
</form>
</fieldset>

1346
autoload/Savant3.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
<?php
namespace admin\controls;
class AdminManager
{
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'add' )
return \admin\view\AdminManager::edit();
if ( $rw == 'edit' )
return \admin\view\AdminManager::edit( \System::formGetInt( 'id' ) );
if ( $rw == 'del' )
\admin\factory\AdminManager::delete( \System::formGetInt( 'id' ) );
return \admin\view\AdminManager::show();
}
}
?>

View File

@@ -0,0 +1,21 @@
<?php
namespace admin\controls;
class Adverts {
public function getContent()
{
global $sys;
$rw = $sys -> formGet( 'rw' );
if ( $rw == 'edit' )
return \admin\view\Adverts::edit( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\Adverts::edit();
if ( $rw == 'del' )
\admin\factory\Adverts::delete( \System::formGetInt( 'id' ) );
return \admin\view\Adverts::show();
}
}
?>

View File

@@ -0,0 +1,22 @@
<?php
namespace admin\controls;
class ArticleArchiveManager {
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'show' )
return false;
else
{
if ( $rw == 'restore' )
\admin\factory\ArticleArchiveManager::restore( \System::formGetInt( 'id' ) );
if ( $rw == 'del' )
\admin\factory\ArticleArchiveManager::delete( \System::formGetInt( 'id' ) );
return \admin\view\ArticleArchiveManager::show();
}
}
}
?>

View File

@@ -0,0 +1,43 @@
<?php
namespace admin\controls;
class ArticleManager
{
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( \System::formGet( 'act' ) )
{
\System::setSessionVar( 'act' , \System::formGet( 'act' ) );
\System::setSessionVar( 'art_id' , \System::formGet( 'id' ) );
}
$act = \System::getSessionVar( 'act' );
if ( $act == 'show_versions' )
{
if ( $rw == 'show' )
return \admin\view\ArticleManager::drawArticle( \System::formGetInt( 'id' ) );
if ( $rw == 'restore' )
\admin\factory\ArticleManager::restoreArticleVersion( \System::formGetInt( 'id' ) );
return \admin\view\ArticleManager::showVersions( \System::getSessionVar( 'art_id' ) );
}
else
{
\admin\factory\ArticleManager::deleteNonAssignImages();
if ( $rw == 'edit' )
return \admin\view\ArticleManager::edit( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\ArticleManager::Add();
if ( $rw == 'del' )
\admin\factory\ArticleManager::setAsArchive( \System::formGetInt( 'id' ) );
if ( $rw == 'save' )
\admin\factory\ArticleManager::save();
if ( $rw == 'add_new' )
\admin\factory\ArticleManager::saveNew();
return \admin\view\ArticleManager::show();
}
}
}
?>

View File

@@ -0,0 +1,15 @@
<?php
namespace admin\controls;
class ArticleSort {
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'page' )
return \admin\view\ArticleSort::drawPageArticles( \System::formGetInt( 'id' ) );
return \admin\view\ArticleSort::showPages();
}
}
?>

View File

@@ -0,0 +1,23 @@
<?
namespace admin\controls;
class BannerManager
{
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'edit' )
return \admin\view\BannerManager::edit( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\BannerManager::edit();
if ( $rw == 'down' )
\admin\factory\BannerManager::down( \System::formGetInt( 'id' ) );
if ( $rw == 'up' )
\admin\factory\BannerManager::up( \System::formGetInt( 'id' ) );
if ( $rw == 'del' )
\admin\factory\BannerManager::delete( \System::formGetInt( 'id' ) );
return \admin\view\BannerManager::show();
}
}
?>

View File

@@ -0,0 +1,32 @@
<?
namespace admin\controls;
class EmailRestriction
{
public function getContent()
{
global $sys;
$rw = $sys -> formGet( 'rw' );
if ( $rw == 'edit' )
{
$id = $sys -> formGet( 'id' );
return \admin\view\EmailRestriction::edit( $id );
}
else if ( $rw == 'add' )
{
return \admin\view\EmailRestriction::add();
}
else
{
if ( $rw == 'del' )
{
$id = $sys -> formGetInt( 'id' );
\admin\factory\EmailRestriction::delete( $id );
}
return \admin\view\EmailRestriction::show();
}
}
}
?>

View File

@@ -0,0 +1,19 @@
<?
namespace admin\controls;
class GuestBookManager
{
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'edit' )
return \admin\view\GuestBookManager::edit( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\GuestBookManager::edit();
if ( $rw == 'del' )
\admin\factory\GuestBookManager::delete( \System::formGetInt( 'id' ) );
return \admin\view\GuestBookManager::show();
}
}
?>

View File

@@ -0,0 +1,24 @@
<?
namespace admin\controls;
class LanguageManager
{
public function getContent()
{
global $user;
if ( isset( $user ) && is_object( $user ) && $user -> get_login() == 'vampirius' )
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'edit' )
return \admin\view\LanguageManager::edit( \System::formGet( 'id' ) );
else
return \admin\view\LanguageManager::show();
}
else
header( 'Location: ./?page_type=change_log' );
}
}
?>

View File

@@ -0,0 +1,54 @@
<?php
namespace admin\controls;
class LayoutManager {
public function getContent()
{
global $sys;
$rw = $sys -> formGet( 'rw' );
if ( $rw == 'edit' )
{
$id = $sys -> formGetInt( 'id' );
return \admin\view\LayoutManager::edit( $id );
}
else if ( $rw == 'add' )
{
return \admin\view\LayoutManager::add();
}
else
{
if ( $rw == 'save_new' )
{
$name = $sys -> formGet( 'name' );
$enabled = $sys -> formGet( 'enabled' );
$html = $sys -> formGet( 'html' );
$css = $sys -> formGet( 'css' );
$js = $sys -> formGet( 'js' );
$time = $sys -> formGetHash( 'time' );
$pages = \System::formGet( 'pages' );
\admin\factory\LayoutManager::saveNew( $name , $enabled , $html , $css , $js , $time , $pages );
}
else if ( $rw == 'save' )
{
$id = $sys -> formGetInt( 'id' );
$name = $sys -> formGet( 'name' );
$enabled = $sys -> formGet( 'enabled' );
$html = $sys -> formGet( 'html' );
$css = $sys -> formGet( 'css' );
$js = $sys -> formGet( 'js' );
$pages = \System::formGet( 'pages' );
\admin\factory\LayoutManager::save( $id , $name , $enabled , $html , $css , $js , false , $pages );
}
else if ( $rw == 'del' )
{
$id = $sys -> formGetInt( 'id' );
\admin\factory\LayoutManager::delete( $id );
}
return \admin\view\LayoutManager::show();
}
}
}
?>

View File

@@ -0,0 +1,32 @@
<?
namespace admin\controls;
class LoginRestriction
{
public function getContent()
{
global $sys;
$rw = $sys -> formGet( 'rw' );
if ( $rw == 'edit' )
{
$id = $sys -> formGet( 'id' );
return \admin\view\LoginRestriction::edit( $id );
}
else if ( $rw == 'add' )
{
return \admin\view\LoginRestriction::add();
}
else
{
if ( $rw == 'del' )
{
$id = $sys -> formGetInt( 'id' );
\admin\factory\LoginRestriction::delete( $id );
}
return \admin\view\LoginRestriction::show();
}
}
}
?>

View File

@@ -0,0 +1,19 @@
<?php
namespace admin\controls;
class MenuManager {
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'edit' )
return \admin\view\MenuManager::edit( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\MenuManager::edit();
if ( $rw == 'del' )
\admin\factory\MenuManager::delete( \System::formGetInt( 'id' ) );
return \admin\view\MenuManager::show();
}
}
?>

View File

@@ -0,0 +1,129 @@
<?php
namespace admin\controls;
class Page {
public function checkUrlParams()
{
global $user;
$rw = \System::formGet( 'rw' );
switch ( $rw )
{
case 'user_logon':
$user = \user\FUser::Login( \System::formGet( 'user_login' ) , strtolower( \System::formGet( 'user_password' ) ) );
\System::setSessionVar( 'user' , $user , true );
break;
case 'user_logout':
\System::deleteSessionVar( 'user' , true );
break;
case 'db_edit_save':
$db_edit_table = \System::getSessionVar( 'db_edit_table' );
$db_edit_key = \System::getSessionVar( 'db_edit_key' );
$db_edit_val = \System::getSessionVar( 'db_edit_val' );
$db_edit_pols = \System::getSessionVar( 'db_edit_pols' );
$db_edit_pass = \System::getSessionVar( 'db_edit_pass' );
$db_edit_pols_t = \System::getSessionVar( 'db_edit_pols_type' );
\DataBase::SaveData( $db_edit_table , $db_edit_key , $db_edit_val , $db_edit_pols , $db_edit_pass , $db_edit_pols_t );
break;
case 'db_edit_add_new':
$db_edit_table = \System::getSessionVar( 'db_edit_table' );
$db_edit_pols = \System::getSessionVar( 'db_edit_pols' );
$db_edit_pass = \System::getSessionVar( 'db_edit_pass' );
$db_edit_pols_hidden = \System::getSessionVar( 'db_edit_pols_hidden' );
$db_edit_pols_t = \System::getSessionVar( 'db_edit_pols_type' );
$time = \System::formGetHash( 'time' );
\DataBase::AddData( $db_edit_table , $db_edit_pols , $db_edit_pols_hidden , $db_edit_pols_t , $time , $db_edit_pass );
break;
}
}
public function getContent()
{
global $user;
if ( !$user || !$user -> get_admin() )
return false;
if ( \System::formGet( 'page_type' ) )
\System::setSessionVar( 'page_type' , \System::formGet( 'page_type' ) );
$page_type = \System::getSessionVar( 'page_type' );
switch ( $page_type )
{
case 'adverts':
return \admin\controls\Adverts::getContent();
break;
case 'page_article_sort':
return \admin\controls\ArticleSort::getContent();
break;
case 'users':
return \admin\controls\UsersManager::getContent();
break;
case 'change_log':
return \site\VSite::drawChangeLog();
break;
case 'article_archive':
return \admin\controls\ArticleArchiveManager::getContent();
break;
case 'menu_definition':
return \admin\controls\MenuManager::getContent();
break;
case 'page_definition':
return \admin\controls\PageManager::getContent();
break;
case 'page_articles':
default;
return \admin\controls\ArticleManager::getContent();
break;
case 'admins':
return \admin\controls\AdminManager::getContent();
break;
case 'lang':
return \admin\controls\LanguageManager::getContent();
break;
case 'translation':
return \admin\controls\TranslationManager::getContent();
break;
case 'settings':
return \admin\controls\SettingManager::getContent();
break;
case 'guest_book':
return \admin\controls\GuestBookManager::getContent();
break;
case 'banner':
return \admin\controls\BannerManager::getContent();
break;
case 'layout':
return \admin\controls\LayoutManager::getContent();
break;
case 'banned_email':
return \admin\controls\EmailRestriction::getContent();
break;
case 'banned_login':
return \admin\controls\LoginRestriction::getContent();
break;
}
}
}
?>

View File

@@ -0,0 +1,50 @@
<?php
namespace admin\controls;
class PageManager {
public function getContent()
{
if ( \System::formGet( 'act' ) )
{
\System::setSessionVar( 'act' , \System::formGet( 'act' ) );
\System::setSessionVar( 'menu_id' , \System::formGet( 'id' ) );
}
$act = \System::getSessionVar( 'act' );
$rw = \System::formGet( 'rw' );
if ( $act == 'menu_page' )
{
if ( $rw == 'edit' )
return \admin\view\PageManager::edit( \System::formGet( 'id' ) );
if ( $rw == 'add' )
return \admin\view\PageManager::add();
if ( $rw == 'article_list' )
return \admin\view\PageManager::showAssignedArticles( \System::formGetInt( 'id' ) );
$menu_id = \System::getSessionVar( 'menu_id' );
if ( $rw == 'del' )
\admin\factory\PageManager::delete( \System::formGetInt( 'id' ) );
if ( $rw == 'down' )
\admin\factory\PageManager::moveDown( \System::formGetInt( 'id' ) , $menu_id );
if ( $rw == 'up' )
\admin\factory\PageManager::moveUp( \System::formGetInt( 'id' ) , $menu_id );
if ( $rw == 'save' )
\admin\factory\PageManager::save();
if ( $rw == 'add_new')
\admin\factory\PageManager::saveNew();
return \admin\view\PageManager::show( $menu_id );
}
else
return \admin\view\PageManager::showMenuList();
}
}
?>

View File

@@ -0,0 +1,17 @@
<?
namespace admin\controls;
class SettingManager
{
public function getContent()
{
global $sys;
$rw = $sys -> formGet( 'rw' );
if ( $rw == 'save_shop_settings' )
\admin\factory\SettingManager::save();
return \admin\view\SettingManager::show();
}
}
?>

View File

@@ -0,0 +1,26 @@
<?
namespace admin\controls;
class TranslationManager
{
public function getContent()
{
global $user;
if ( isset( $user ) && is_object( $user ) && $user -> get_login() == 'vampirius' )
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'edit' )
return \admin\view\TranslationManager::edit( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\TranslationManager::edit();
if ( $rw == 'del' )
\admin\factory\TranslationManager::delete( \System::formGetInt( 'id' ) );
return \admin\view\TranslationManager::show();
}
else
header( 'Location: ./?page_type=change_log' );
}
}
?>

View File

@@ -0,0 +1,19 @@
<?php
namespace admin\controls;
class UsersManager {
public function getContent()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'add' )
return \admin\view\UsersManager::edit();
if ( $rw == 'edit' )
return \admin\view\UsersManager::edit( \System::formGetInt( 'id' ) );
if ( $rw == 'del' )
\admin\factory\UsersManager::delete( \System::formGetInt( 'id' ) );
return \admin\view\UsersManager::show();
}
}
?>

View File

@@ -0,0 +1,18 @@
<?
namespace admin\factory;
class AdminManager
{
public function delete( $id )
{
global $db , $lang , $sys;
$query = $db -> prepare( 'DELETE FROM pcms_user WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$sys -> setAlert( $lang -> getTrans( 'T_USUNIETO_ADMINISTRATORA' ) );
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
namespace admin\factory;
class Adverts {
public function getAcitveAdvert()
{
global $db, $config, $cache;
$key = 'getAcitveAdvert';
if ( !$advert = $cache -> fetch( $key ) )
{
$query = $db -> query( 'SELECT * FROM pcms_adverts WHERE ( date_start <= "' . date( 'Y-m-d' ) . '" OR date_start = "0000-00-00" ) AND ( date_end >= "' . date( 'Y-m-d' ) . '" OR date_end = "0000-00-00" ) AND enabled = 1 LIMIT 1' );
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$advert = $row;
$query -> closeCursor();
$cache -> store( $key, $advert, $config['cache_expire'] );
}
return $advert;
}
public function delete( $id )
{
global $db, $lang;
$query = $db -> prepare( 'SELECT img FROM pcms_adverts WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( file_exists( '../' . $row['img'] ) )
unlink( '../' . $row['img'] );
}
$query -> closeCursor();
$query = $db -> prepare( 'DELETE FROM pcms_adverts WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_USUNIETO_REKLAME' ) );
\System::deleteCacheAdmin();
\System::deleteCache();
}
}
?>

View File

@@ -0,0 +1,63 @@
<?php
namespace admin\factory;
class ArticleArchiveManager {
public function delete( $id )
{
global $db , $lang;
$query = $db -> prepare( 'DELETE FROM pcms_article WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$query = $db -> prepare( 'DELETE FROM pcms_article_page WHERE article_id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$query = $db -> prepare( 'DELETE FROM pcms_article_translation WHERE article_id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$query = $db -> prepare( 'SELECT * FROM pcms_article_images WHERE id_article = :id_article' );
$query -> bindValue( ':id_article' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( file_exists( "../" . $row['src'] ) )
unlink( "../" . $row['src'] );
}
$query -> closeCursor();
$query = $db -> prepare( 'DELETE FROM pcms_article_images WHERE id_article = :id_article' );
$query -> bindValue( ':id_article' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_USUNIETO_ARTYKUL' ) );
\System::rewriteHtacces();
\System::deleteCache();
\System::deleteCacheAdmin();
}
public function restore( $id )
{
global $db , $lang;
$query = $db -> prepare( 'UPDATE pcms_article SET archive = :archive WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> bindValue( ':archive' , 0 , \PDO::PARAM_STR );
$query -> execute();
$query -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_PRZYWROCONO_ARTYKUL' ) );
\System::rewriteHtacces();
\System::deleteCache();
\System::deleteCacheAdmin();
}
}
?>

View File

@@ -0,0 +1,498 @@
<?php
namespace admin\factory;
class ArticleManager {
public function getArticleFiles( $id )
{
global $db;
$query = $db -> prepare( 'SELECT * FROM pcms_article_files WHERE id_article = :id_article' );
$query -> bindValue( ':id_article', $id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$files[] = $row;
$query -> closeCursor();
return $files;
}
public function getArticleImages( $id )
{
global $db;
$query = $db -> prepare( 'SELECT * FROM pcms_article_images WHERE id_article = :id_article' );
$query -> bindValue( ':id_article', $id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$images[] = $row;
$query -> closeCursor();
return $images;
}
public function deleteNonAssignImages()
{
global $db;
$query = $db -> query( 'SELECT * FROM pcms_article_images WHERE id_article = 0' );
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( file_exists( "../" . $row['src'] ) )
unlink( "../" . $row['src'] );
}
$query -> closeCursor();
$query = $db -> query( 'DELETE FROM pcms_article_images WHERE id_article = 0' );
$query -> closeCursor();
return false;
}
public function getArticleVersionByVersionId( $version_id )
{
global $db;
$query = $db -> prepare( 'SELECT version FROM pcms_article_translation WHERE id = :id' );
$query -> bindValue( ':id' , $version_id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row['version'];
$query -> closeCursor();
}
public function getArticleIdByVersionId( $version_id )
{
global $db;
$query = $db -> prepare( 'SELECT article_id FROM pcms_article_translation WHERE id = :id' );
$query -> bindValue( ':id' , $version_id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row['article_id'];
$query -> closeCursor();
}
public function getMaxArticleVersion( $id )
{
global $db;
$query = $db -> prepare( 'SELECT MAX( version ) FROM pcms_article_translation WHERE article_id = :article_id' );
$query -> bindValue( ':article_id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row[0];
$query -> closeCursor();
return 0;
}
public function restoreArticleVersion( $version_id )
{
global $db , $lang;
if ( \System::formGetHash( 'time' ) != \System::getSessionVar( 'article_restore' ) )
{
$article_id = \admin\factory\ArticleManager::getArticleIdByVersionId( $version_id );
$version = \admin\factory\ArticleManager::getArticleVersionByVersionId( $version_id );
$query = $db -> prepare( 'SELECT * FROM pcms_article_translation WHERE article_id = :article_id AND version = :version' );
$query -> bindValue( ':article_id' , $article_id , \PDO::PARAM_INT );
$query -> bindValue( ':version' , $version , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( !$max_ver )
$max_ver = self::getMaxArticleVersion( $row['article_id'] ) + 1;
$query2 = $db -> prepare( 'INSERT INTO pcms_article_translation ( text, meta_description, meta_keywords, title, article_id, lang_id, version ) VALUES ( :text, :meta_description, :meta_keywords, :title, :article_id, :lang_id, :version )' );
$query2 -> bindValue( ':text' , $row['text'] , \PDO::PARAM_STR );
$query2 -> bindValue( ':meta_description' , $row['meta_description'] , \PDO::PARAM_STR );
$query2 -> bindValue( ':meta_keywords' , $row['meta_keywords'] , \PDO::PARAM_STR );
$query2 -> bindValue( ':title' , $row['title'] , \PDO::PARAM_STR );
$query2 -> bindValue( ':article_id' , $row['article_id'] , \PDO::PARAM_INT );
$query2 -> bindValue( ':lang_id' , $row['lang_id'] , \PDO::PARAM_STR );
$query2 -> bindValue( ':version' , $max_ver , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
}
$query -> closeCursor();
\System::setSessionVar( 'article_restore' , \System::formGetHash( 'time' ) );
\System::setAlert( $lang -> getTrans( 'T_ARTYKUL_ZOSTAL_PRZYWROCONY' ) );
}
}
public function getVersions( $id , $from , $lpk )
{
global $db;
$query = $db -> prepare( 'SELECT id , title , version , date_modify FROM pcms_article_translation WHERE article_id = :article_id GROUP BY version ORDER BY version DESC LIMIT ' . $from . ',' . $lpk );
$query -> bindValue( ':article_id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$articles[] = $row;
$query -> closeCursor();
return $articles;
}
public function getCountVersions( $id ) {
global $db;
$query = $db -> prepare( 'SELECT COUNT( DISTINCT( version ) ) FROM pcms_article_translation WHERE article_id = :article_id' );
$query -> bindValue( ':article_id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$row[0];
$query -> closeCursor();
return 0;
}
public function getArticleParam( $id )
{
global $db;
$query = $db -> prepare( 'SELECT * FROM pcms_article WHERE id = :id' );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row;
$query -> closeCursor();
return false;
}
public function getPagesAssign( $id = '' )
{
global $db;
$query = $db -> query( 'SELECT id FROM pcms_page WHERE id_page_type != 5 AND id_page_type != 6 AND id_page_type != 7 AND id_page_type != 8 AND id_page_type != 9 AND id_page_type != 10 AND id_page_type != 11 ORDER BY o ASC' );
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$pg['id'] = $row['id'];
$pg['title'] = \System::getPageTitle( $row['id'] );
$query2 = $db -> prepare( 'SELECT page_id FROM pcms_article_page WHERE article_id = :article_id AND page_id = :page_id' );
$query2 -> bindValue( ':article_id', (int)$id, \PDO::PARAM_INT );
$query2 -> bindValue( ':page_id', $row['id'], \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() )
$pg['check'] = 1;
else
$pg['check'] = 0;
$query2 -> closeCursor();
$pages[] = $pg;
}
$query -> closeCursor();
return $pages;
}
public function getArticleParamLanguage( $id = '' , $version = '' )
{
global $db;
$query = $db -> query( 'SELECT id, name FROM pcms_lang WHERE enabled = 1' );
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( $version )
{
$query2 = $db -> prepare( 'SELECT * FROM pcms_article_translation WHERE article_id = :article_id AND lang_id = :lang_id AND version = :version ORDER BY version DESC LIMIT 1' );
$query2 -> bindValue( ':article_id', $id, \PDO::PARAM_INT );
$query2 -> bindValue( ':lang_id', $row['id'], \PDO::PARAM_STR );
$query2 -> bindValue( ':version', $version, \PDO::PARAM_INT );
$query2 -> execute();
}
else
{
$query2 = $db -> prepare( 'SELECT * FROM pcms_article_translation WHERE article_id = :article_id AND lang_id = :lang_id ORDER BY version DESC LIMIT 1' );
$query2 -> bindValue( ':article_id', $id, \PDO::PARAM_INT );
$query2 -> bindValue( ':lang_id', $row['id'], \PDO::PARAM_STR );
$query2 -> execute();
}
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
{
$lg['title'] = $row2['title'];
$lg['meta_description'] = $row2['meta_description'];
$lg['meta_keywords'] = $row2['meta_keywords'];
$lg['text'] = $row2['text'];
$lg['seo_link'] = $row2['seo_link'];
}
else
{
$lg['title'] = '';
$lg['meta_description'] = '';
$lg['meta_keywords'] = '';
$lg['text'] = '';
$lg['seo_link'] = '';
}
$lg['id'] = $row['id'];
$lg['name'] = $row['name'];
$language[] = $lg;
}
return $language;
}
public function getMaxArticleOrder()
{
global $db;
$query = $db -> query( 'SELECT MAX(o) FROM pcms_article_page' );
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row[0];
$query -> closeCursor();
return 0;
}
public function save()
{
global $lang, $db;
$date = \System::getDate();
$pages = \System::formGet( 'pages' );
$pages = \System::formGet( 'pages' );
$print = \System::formGetInt( 'print' );
$show_date = \System::formGetInt( 'show_date' );
$show_title = \System::formGetInt( 'show_title' );
$article_id = \System::formGetInt( 'id' );
$enabled = \System::formGetInt( 'enabled' );
$show_author = \System::formGetInt( 'show_author' );
$keep_archive = \System::formGetInt( 'keep_archive' );
$layout = \System::formGetInt( 'layout' );
$sql = 'UPDATE
pcms_article
SET
show_title = :show_title,
enabled = :enabled,
print = :print,
show_date = :show_date,
date_modify = :date_modify,
show_author = :show_author,
keep_archive = :keep_archive,
id_layout = :id_layout
WHERE
id = :id';
$query = $db -> prepare( $sql );
$query -> bindValue( ':show_title' , $show_title , \PDO::PARAM_STR );
$query -> bindValue( ':enabled' , $enabled , \PDO::PARAM_STR );
$query -> bindValue( ':print' , $print , \PDO::PARAM_STR );
$query -> bindValue( ':show_date' , $show_date , \PDO::PARAM_STR );
$query -> bindValue( ':date_modify' , $date , \PDO::PARAM_STR );
$query -> bindValue( ':show_author' , $show_author , \PDO::PARAM_STR );
$query -> bindValue( ':keep_archive' , $keep_archive , \PDO::PARAM_STR );
$query -> bindValue( ':id' , $article_id , \PDO::PARAM_INT );
$query -> bindValue( ':id_layout' , $layout , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$not_in = '';
if ( is_array( $pages ) ) foreach ( $pages as $pag )
{
if ( $not_in )
$not_in .= ',';
$not_in .= $pag;
}
if ( $not_in )
{
$query = $db -> prepare( 'DELETE FROM pcms_article_page WHERE article_id = :article_id AND page_id NOT IN (' . $not_in . ')' );
$query -> bindValue( ':article_id' , $article_id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
}
$query = $db -> prepare( 'SELECT page_id FROM pcms_article_page WHERE article_id = :article_id' );
$query -> bindValue( ':article_id' , $article_id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$tab_tmp[] = $row['page_id'];
$query -> closeCursor();
if ( is_array( $pages ) )
{
$o = self::getMaxArticleOrder() + 1;
$query = $db -> prepare( 'INSERT INTO pcms_article_page ( page_id, article_id, o ) VALUES ( :page_id, :article_id, :o )' );
foreach ( $pages as $pag )
{
if ( !is_array( $tab_tmp ) || !in_array( $pag , $tab_tmp ) )
{
$query -> bindValue( ':page_id' , $pag , \PDO::PARAM_INT );
$query -> bindValue( ':article_id' , $article_id , \PDO::PARAM_INT );
$query -> bindValue( ':o' , $o , \PDO::PARAM_INT );
$query -> execute();
$o++;
}
}
$query -> closeCursor();
}
if ( $article_id )
{
$version = self::getMaxArticleVersion( $article_id ) + 1;
$query = $db -> prepare( 'SELECT id FROM pcms_lang WHERE enabled = :enabled' );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$title = stripslashes( \System::saveString( \System::formGet( 'title_' . $row['id'] ) ) );
$meta_description = stripslashes( \System::saveString( \System::formGet( 'meta_description_' . $row['id'] ) ) );
$meta_keywords = stripslashes( \System::saveString( \System::formGet( 'meta_keywords_' . $row['id'] ) ) );
$text = stripslashes( \System::formGet( 'text_' . $row['id'] ) );
$seo_link = \System::formGet( 'seo_link_' . $row['id'] );
$query2 = $db -> prepare( 'SELECT id, version FROM pcms_article_translation WHERE article_id = :article_id AND lang_id = :lang_id ORDER BY version DESC LIMIT 1' );
$query2 -> bindValue( ':article_id' , $article_id , \PDO::PARAM_INT );
$query2 -> bindValue( ':lang_id' , $row['id'] , \PDO::PARAM_STR );
$query2 -> execute();
if ( $query2 -> rowCount() && !$keep_archive )
{
while ( $row2 = $query2 -> fetch() )
{
$query3 = $db -> prepare( 'UPDATE pcms_article_translation SET text = :text, meta_description = :meta_description, meta_keywords = :meta_keywords, title = :title, seo_link = :seo_link WHERE article_id = :article_id AND lang_id = :lang_id AND version = :version' );
$query3 -> bindValue( ':text' , $text , \PDO::PARAM_STR );
$query3 -> bindValue( ':meta_description' , $meta_description , \PDO::PARAM_STR );
$query3 -> bindValue( ':meta_keywords' , $meta_keywords , \PDO::PARAM_STR );
$query3 -> bindValue( ':title' , $title , \PDO::PARAM_STR );
$query3 -> bindValue( ':article_id' , $article_id , \PDO::PARAM_INT );
$query3 -> bindValue( ':lang_id' , $row['id'] , \PDO::PARAM_STR );
$query3 -> bindValue( ':version' , $row2['version'] , \PDO::PARAM_INT );
$query3 -> bindValue( ':seo_link' , $seo_link , \PDO::PARAM_STR );
$query3 -> execute();
$query3 -> closeCursor();
}
}
else
{
$query3 = $db -> prepare( 'INSERT INTO pcms_article_translation ( text, meta_description, meta_keywords, title, article_id, lang_id, version, seo_link ) VALUES ( :text, :meta_description, :meta_keywords, :title, :article_id, :lang_id, :version, :seo_link )' );
$query3 -> bindValue( ':text' , $text , \PDO::PARAM_STR );
$query3 -> bindValue( ':meta_description' , $meta_description , \PDO::PARAM_STR );
$query3 -> bindValue( ':meta_keywords' , $meta_keywords , \PDO::PARAM_STR );
$query3 -> bindValue( ':title' , $title , \PDO::PARAM_STR );
$query3 -> bindValue( ':article_id' , $article_id , \PDO::PARAM_INT );
$query3 -> bindValue( ':lang_id' , $row['id'] , \PDO::PARAM_STR );
$query3 -> bindValue( ':version' , $version , \PDO::PARAM_INT );
$query3 -> bindValue( ':seo_link' , $seo_link , \PDO::PARAM_STR );
$query3 -> execute();
$query3 -> closeCursor();
}
}
\System::setAlert( $lang -> getTrans( 'T_ZAPISANO_ARTYKUL' ) );
}
\System::rewriteHtacces();
\System::deleteCache();
\System::deleteCacheAdmin();
}
public function saveNew()
{
global $lang , $user , $db;
$date = \System::getDate();
$pages = \System::formGet( 'pages' );
$pages = \System::formGet( 'pages' );
$enabled = \System::formGetInt( 'enabled' );
$print = \System::formGetInt( 'print' );
$show_date = \System::formGetInt( 'show_date' );
$show_title = \System::formGetInt( 'show_title' );
$time = \System::formGetHash( 'time' );
$show_author = \System::formGetInt( 'show_author' );
$keep_archive = \System::formGetInt( 'keep_archive' );
$layout = \System::formGetInt( 'layout' );
if ( $time != \System::getSessionVar( 'db_edit_add' ) )
{
$sql = 'INSERT INTO
pcms_article
( show_title , enabled , print , show_date , date_add , date_modify , show_author , author , keep_archive, id_layout )
VALUES
( :show_title , :enabled , :print , :show_date , :date_add , :date_modify , :show_author , :author , :keep_archive, :id_layout )';
$query = $db -> prepare( $sql );
$query -> bindValue( ':show_title' , $show_title , \PDO::PARAM_STR );
$query -> bindValue( ':enabled' , $enabled , \PDO::PARAM_STR );
$query -> bindValue( ':print' , $print , \PDO::PARAM_STR );
$query -> bindValue( ':show_date' , $show_date , \PDO::PARAM_STR );
$query -> bindValue( ':date_add' , $date , \PDO::PARAM_STR );
$query -> bindValue( ':date_modify' , $date , \PDO::PARAM_STR );
$query -> bindValue( ':show_author' , $show_author , \PDO::PARAM_STR );
$query -> bindValue( ':author' , $user -> get_id() , \PDO::PARAM_STR );
$query -> bindValue( ':keep_archive' , $keep_archive , \PDO::PARAM_STR );
$query -> bindValue( ':id_layout' , $layout , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$article_id = $db -> lastInsertId();
if ( $article_id )
{
if ( is_array( $pages ) )
{
$o = self::getMaxArticleOrder() + 1;
$query = $db -> prepare( 'INSERT INTO pcms_article_page ( page_id, article_id, o ) VALUES ( :page_id, :article_id, :o )' );
foreach ( $pages as $page )
{
$query -> bindValue( ':page_id' , $page , \PDO::PARAM_INT );
$query -> bindValue( ':article_id' , $article_id , \PDO::PARAM_INT );
$query -> bindValue( ':o' , $o , \PDO::PARAM_INT );
$query -> execute();
$o++;
}
$query -> closeCursor();
}
$query = $db -> prepare( 'SELECT id FROM pcms_lang WHERE enabled = :enabled' );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$title = \System::saveString( \System::formGet( 'title_' . $row['id'] ) );
$meta_description = \System::saveString( \System::formGet( 'meta_description_' . $row['id'] ) );
$meta_keywords = \System::saveString( \System::formGet( 'meta_keywords_' . $row['id'] ) );
$text = stripslashes( \System::formGet( 'text_' . $row['id'] ) );
$seo_link = \System::formGet( 'seo_link_' . $row['id'] );
$sql = 'INSERT INTO
pcms_article_translation
( article_id, lang_id, text, meta_description, meta_keywords, title, version, seo_link )
VALUES
( :article_id, :lang_id, :text, :meta_description, :meta_keywords, :title, :version, :seo_link )';
$query2 = $db -> prepare( $sql );
$query2 -> bindValue( ':article_id' , $article_id , \PDO::PARAM_INT );
$query2 -> bindValue( ':lang_id' , $row['id'] , \PDO::PARAM_STR );
$query2 -> bindValue( ':text' , $text , \PDO::PARAM_STR );
$query2 -> bindValue( ':meta_description' , $meta_description , \PDO::PARAM_STR );
$query2 -> bindValue( ':meta_keywords' , $meta_keywords , \PDO::PARAM_STR );
$query2 -> bindValue( ':title' , $title , \PDO::PARAM_STR );
$query2 -> bindValue( ':version' , 0 , \PDO::PARAM_INT );
$query2 -> bindValue( ':seo_link' , $seo_link , \PDO::PARAM_STR );
$query2 -> execute();
$query2 -> closeCursor();
}
\System::setSessionVar( 'db_edit_add' , $time );
\System::setAlert( $lang -> getTrans( 'T_DODANO_ARTYKUL' ) );
}
\System::rewriteHtacces();
\System::deleteCache();
\System::deleteCacheAdmin();
}
}
public function setAsArchive( $id )
{
global $db , $lang;
$query = $db -> prepare( 'UPDATE pcms_article SET archive = :archive WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> bindValue( ':archive' , 1 , \PDO::PARAM_STR );
$query -> execute();
$query -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_PRZENIESIONO_ARTYKUL_DO_ARCHIWUM' ) );
\System::rewriteHtacces();
\System::deleteCache();
\System::deleteCacheAdmin();
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
namespace admin\factory;
class ArticleSort {
public function getPageArticleSort( $id )
{
global $db;
$articles = array();
$query = $db -> prepare( 'SELECT * FROM pcms_article_page WHERE page_id = :page_id ORDER BY o ASC' );
$query -> bindValue( ':page_id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$row['title'] = \System::getArticleTitle( $row['article_id'] );
$articles[] = $row;
}
$query -> closeCursor();
return $articles;
}
}
?>

View File

@@ -0,0 +1,161 @@
<?
namespace admin\factory;
class BannerManager
{
public function getBanners( $from , $lpk )
{
global $lang , $db , $sys;
$lp = 1;
$tab = $sys -> getComboYesNo();
$banners = '';
$query = $db -> prepare( 'SELECT title , link , enabled , id , o FROM pcms_banner ORDER BY o ASC LIMIT ' . $from . ',' . $lpk );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$ban['title'] = $row['title'];
$ban['link'] = $row['link'];
$ban['lp'] = $lp;
$ban['enabled'] = $tab[$row['enabled']];
$ban['id'] = $row['id'];
$query2 = $db -> prepare( 'SELECT id FROM pcms_banner WHERE o > :o ORDER BY o ASC LIMIT 1' );
$query2 -> bindValue( ':o' , $row['o'] , \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
$ban['down'] = true;
else
$ban['down'] = false;
$query2 -> closeCursor();
$query2 = $db -> prepare( 'SELECT id FROM pcms_banner WHERE o < :o ORDER BY o ASC LIMIT 1' );
$query2 -> bindValue( ':o' , $row['o'] , \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
$ban['up'] = true;
else
$ban['up'] = false;
$query2 -> closeCursor();
$akcja = "function mycallbackform(v,m,f){
if( v == true )
document.location.href='index.php?rw=del&amp;id=" . $row['id'] . "';
}";
$akcja .= "$.prompt('" . $lang -> getTrans( 'T_POTWIERDZ_USUNIECIE' ) . "',{ callback: mycallbackform, buttons: { " . $lang -> getTrans( 'T_TAK' ) . ": true, " . $lang -> getTrans( 'T_NIE' ) . ": false }, focus: 1 })";
$akcja = 'onClick="'.$akcja.'"';
$ban['action'] = $akcja;
$banners[] = $ban;
$lp++;
}
$query -> closeCursor();
return $banners;
}
public function getMaxOrder()
{
global $db;
$query = $db -> prepare( 'SELECT MAX(o) FROM pcms_banner' );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row[0]+1;
}
public function down( $id )
{
global $db , $lang , $sys;
$query = $db -> prepare( 'SELECT o FROM pcms_banner WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$o1 = $row['o'];
$query -> closeCursor();
$query = $db -> prepare( 'SELECT id , o FROM pcms_banner WHERE o > :order ORDER BY o ASC LIMIT 1' );
$query -> bindValue( ':order' , $o1 , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$query2 = $db -> prepare( 'UPDATE pcms_banner SET o = :order WHERE id = :id' );
$query2 -> bindValue( ':order' , $row['o'] , \PDO::PARAM_INT );
$query2 -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
$query2 = $db -> prepare( 'UPDATE pcms_banner SET o = :order WHERE id = :id' );
$query2 -> bindValue( ':order' , $o1 , \PDO::PARAM_INT );
$query2 -> bindValue( ':id' , $row['id'] , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
}
$query -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_PRZESUNIETO_BANER' ) );
\System::deleteCacheAdmin();
\System::deleteCache();
}
public function up( $id )
{
global $db , $lang , $sys;
$query = $db -> prepare( 'SELECT o FROM pcms_banner WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$o1 = $row['o'];
$query -> closeCursor();
$query = $db -> prepare( 'SELECT id , o FROM pcms_banner WHERE o < :order ORDER BY o DESC LIMIT 1' );
$query -> bindValue( ':order' , $o1 , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$query2 = $db -> prepare( 'UPDATE pcms_banner SET o = :order WHERE id = :id' );
$query2 -> bindValue( ':order' , $row['o'] , \PDO::PARAM_INT );
$query2 -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
$query2 = $db -> prepare( 'UPDATE pcms_banner SET o = :order WHERE id = :id' );
$query2 -> bindValue( ':order' , $o1 , \PDO::PARAM_INT );
$query2 -> bindValue( ':id' , $row['id'] , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
}
$query -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_PRZESUNIETO_BANER' ) );
\System::deleteCacheAdmin();
\System::deleteCache();
}
public function delete( $id )
{
global $lang , $db , $sys;
$query = $db -> prepare( 'SELECT image FROM pcms_banner WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( file_exists( "../" . $row['image'] ) && $row['image'] )
unlink("../" . $row['image']);
$query2 = $db -> prepare( 'DELETE FROM pcms_banner WHERE id = :id' );
$query2 -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
}
$query -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_USUNIETO_BANER' ) );
\System::deleteCacheAdmin();
\System::deleteCache();
}
}
?>

View File

@@ -0,0 +1,18 @@
<?
namespace admin\factory;
class EmailRestriction
{
public function delete( $id )
{
global $lang , $sys , $db;
$query = $db -> prepare( 'DELETE FROM pcms_banned_email WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$sys -> setAlert( $lang -> getTrans( 'T_USUNIETO_RESTRYKCJE' ) );
}
}
?>

View File

@@ -0,0 +1,18 @@
<?
namespace admin\factory;
class GuestBookManager
{
public function delete( $id )
{
global $lang , $db , $sys;
$query = $db -> prepare( 'DELETE FROM pcms_guest_book WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$sys -> setAlert( $lang -> getTrans( 'T_USUNIETO_WPIS_Z_KSIEGO_GOSCI' ) );
}
}
?>

View File

@@ -0,0 +1,175 @@
<?php
namespace admin\factory;
class LayoutManager {
public function getSelectedPages( $id )
{
global $sys , $db , $config , $cache;
$key = 'getSelectedPages:' . $id;
if ( !$pages = $cache -> fetch( $key ) )
{
$query = $db -> prepare( 'SELECT page_id FROM pcms_layout_pages WHERE layout_id = :layout_id' );
$query -> bindValue( ':layout_id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$pages[] = $row['page_id'];
$query -> closeCursor();
$cache -> store( $key , $pages , $config['cache_expire'] );
}
return $pages;
}
public function getPages()
{
global $sys , $db , $config , $cache;
$key = 'getPages';
if ( !$pages = $cache -> fetch( $key ) )
{
$query = $db -> prepare( 'SELECT id FROM pcms_page WHERE enabled = :enabled' );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$site = \site\FSite::loadSite( $row['id'] );
$pages[] = $site;
}
$query -> closeCursor();
$cache -> store( $key , $pages , $config['cache_expire'] );
}
return $pages;
}
public function saveNew( $name , $enabled , $html , $css , $js , $time , $pages )
{
global $lang , $sys , $db;
if ( $time != $sys -> getSessionVar( 'db_edit_add' ) )
{
if ( $enabled == 1 )
{
$query = $db -> prepare( 'UPDATE pcms_layout SET enabled = :enabled' );
$query -> bindValue( ':enabled' , 0 , \PDO::PARAM_STR );
$query -> execute();
$query -> closeCursor();
}
$query = $db -> prepare( 'INSERT INTO pcms_layout ( name , enabled , html , css , javascript ) VALUES ( :name , :enabled , :html , :css , :javascript )' );
$query -> bindValue( ':name' , $name , \PDO::PARAM_STR );
$query -> bindValue( ':enabled' , $enabled , \PDO::PARAM_STR );
$query -> bindValue( ':html' , $html , \PDO::PARAM_STR );
$query -> bindValue( ':css' , $css , \PDO::PARAM_STR );
$query -> bindValue( ':javascript' , $js , \PDO::PARAM_STR );
$query -> execute();
$query -> closeCursor();
$id = $db -> lastInsertId();
if ( is_array( $pages ) ) foreach ( $pages as $page )
{
$query = $db -> prepare( 'INSERT INTO pcms_layout_pages ( layout_id , page_id ) VALUES ( :layout_id , :page_id )' );
$query -> bindValue( ':layout_id' , $id , \PDO::PARAM_INT );
$query -> bindValue( ':page_id' , $page , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
}
\System::setSessionVar( 'db_edit_add' , $time );
\System::deleteCacheAdmin();
\System::setAlert( $lang -> getTrans( 'T_SZABLON_ZOSTAL_DODANY' ) );
}
}
/* ---------- */
public function save( $id , $name , $enabled , $html , $css , $js , $ajax = false , $pages )
{
global $lang , $sys , $db;
if ( $enabled == 1 )
{
$query = $db -> prepare( 'UPDATE pcms_layout SET enabled = :enabled' );
$query -> bindValue( ':enabled' , 0 , \PDO::PARAM_STR );
$query -> execute();
$query -> closeCursor();
}
$query = $db -> prepare( 'UPDATE pcms_layout SET name = :name , enabled = :enabled , html = :html , css = :css , javascript = :javascript WHERE id = :id' );
$query -> bindValue( ':name' , $name , \PDO::PARAM_STR );
$query -> bindValue( ':enabled' , $enabled , \PDO::PARAM_STR );
$query -> bindValue( ':html' , $html , \PDO::PARAM_STR );
$query -> bindValue( ':css' , $css , \PDO::PARAM_STR );
$query -> bindValue( ':javascript' , $js , \PDO::PARAM_STR );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$query = $db -> prepare( 'DELETE FROM pcms_layout_pages WHERE layout_id = :layout_id' );
$query -> bindValue( ':layout_id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
if ( is_array( $pages ) ) foreach ( $pages as $page )
{
$query = $db -> prepare( 'INSERT INTO pcms_layout_pages ( layout_id , page_id ) VALUES ( :layout_id , :page_id )' );
$query -> bindValue( ':layout_id' , $id , \PDO::PARAM_INT );
$query -> bindValue( ':page_id' , $page , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
}
$sys -> deleteCache();
if ( !$ajax )
$sys -> setAlert( $lang -> getTrans( 'T_SZABLON_ZOSTAL_ZAPISANY' ) );
}
/* --------- */
public function delete( $id )
{
global $lang , $db , $sys;
$query = $db -> prepare( 'SELECT count(id) FROM pcms_layout' );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( $row[0] <= 1 )
{
$sys -> setAlert( $lang -> getTrans( 'T_NIE_MOZNA_USUNAC_SZABLONU' ) );
return false;
}
}
$query -> closeCursor();
$query = $db -> prepare( 'DELETE FROM pcms_layout WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$query = $db -> prepare( 'DELETE FROM pcms_layout_pages WHERE layout_id = :layout_id' );
$query -> bindValue( ':layout_id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$query = $db -> prepare( 'SELECT count(id) FROM pcms_layout WHERE enabled = :enabled' );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( $row[0] == 0 )
{
$query2 = $db -> prepare( 'UPDATE pcms_layout SET enabled = :enabled LIMIT 1' );
$query2 -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query2 -> execute();
$query2 -> closeCursor();
}
}
$query -> closeCursor();
$sys -> deleteCache();
$sys -> setAlert( $lang -> getTrans( 'T_SZABLON_ZOSTAL_USUNIETY' ) );
}
}
?>

View File

@@ -0,0 +1,18 @@
<?
namespace admin\factory;
class LoginRestriction
{
public function delete( $id )
{
global $lang , $sys , $db;
$query = $db -> prepare( 'DELETE FROM pcms_banned_login WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$sys -> setAlert( $lang -> getTrans( 'T_USUNIETO_RESTRYKCJE' ) );
}
}
?>

View File

@@ -0,0 +1,34 @@
<?php
namespace admin\factory;
class MenuManager
{
public function delete( $id )
{
global $sys , $lang , $db;
$flag = true;
$query = $db -> prepare( 'SELECT count(id) FROM pcms_page WHERE id_menu=:id_menu' );
$query -> bindValue( ':id_menu' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( $row[0] > 0 )
$flag = false;
}
$query -> closeCursor();
if ( $flag )
{
$query = $db -> prepare( 'DELETE FROM pcms_menu WHERE id=:id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$sys -> setAlert( $lang -> getTrans( 'T_USUNIETO_MENU' ) );
}
else
$sys -> setAlert( $lang -> getTrans( 'T_NIE_MOZNA_USUNAC_MENU_ZAWIERA_STRONY' ) );
}
}
?>

View File

@@ -0,0 +1,397 @@
<?
namespace admin\factory;
class PageManager
{
public function getAssignedArticles( $id )
{
global $db;
$query = $db -> prepare( 'SELECT article_id FROM pcms_article_page WHERE page_id = :page_id ORDER BY o DESC' );
$query -> bindValue( ':page_id', $id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$articles[] = \article\FArticle::loadArticle( $row['article_id'] );
$query -> closeCursor();
return $articles;
}
public function getPageParam( $id )
{
global $db;
$query = $db -> prepare( 'SELECT link , enabled , article_number , show_title , id_sort_type , id_page_type , id_menu , o FROM pcms_page WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
return $row;
}
public function getPageParamLanguage( $id )
{
global $db;
$query = $db -> prepare( 'SELECT id , name FROM pcms_lang WHERE enabled = :enabled' );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$query2 = $db -> prepare( 'SELECT title , meta_description , meta_keywords, seo_link FROM pcms_page_translation WHERE page_id = :page_id AND lang_id = :lang_id' );
$query2 -> bindValue( ':page_id' , $id , \PDO::PARAM_INT );
$query2 -> bindValue( ':lang_id' , $row['id'] , \PDO::PARAM_STR );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
{
$lg['title'] = $row2['title'];
$lg['meta_description'] = $row2['meta_description'];
$lg['meta_keywords'] = $row2['meta_keywords'];
$lg['seo_link'] = $row2['seo_link'];
}
else
{
$lg['title'] = '';
$lg['meta_description'] = '';
$lg['meta_keywords'] = '';
$lg['seo_link'] = '';
}
$query2 -> closeCursor();
$lg['id'] = $row['id'];
$lg['name'] = $row['name'];
$language[] = $lg;
}
$query -> closeCursor();
return $language;
}
public function getPages( $menu_id , $from , $lpk )
{
global $sys , $db , $lang;
$lp = 1;
$yes_no = \System::getComboYesNo();
$pages = '';
$query = $db -> prepare( 'SELECT id , id_menu , enabled , o , id_page_type , article_number , id_sort_type , show_title FROM pcms_page WHERE id_menu=:id_menu ORDER BY o ASC LIMIT ' . $from . ',' . $lpk );
$query -> bindValue( ':id_menu' , $menu_id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$page['lp'] = $lp;
$page['id'] = $row['id'];
$page['article_number'] = $row['article_number'];
$page['show_title'] = $yes_no[$row['show_title']];
$page['enabled'] = $yes_no[$row['enabled']];
$page['title'] = \System::getPageTitle( $row['id'] );
$query2 = $db -> prepare( 'SELECT name FROM pcms_page_type WHERE id=:page_type' );
$query2 -> bindValue( ':page_type' , $row['id_page_type'] , \PDO::PARAM_STR );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
$page['page_type'] = $lang -> getTrans( $row2['name'] );
$query2 -> closeCursor();
$query2 = $db -> prepare( 'SELECT name FROM pcms_page_sort_type WHERE id=:sort_type' );
$query2 -> bindValue( ':sort_type' , $row['id_sort_type'] , \PDO::PARAM_STR );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
$page['sort_type'] = $lang -> getTrans( $row2['name'] );
$query2 -> closeCursor();
$query2 = $db -> prepare( 'SELECT id FROM pcms_page WHERE o>:order AND id_menu=:id_menu ORDER BY o ASC LIMIT 1' );
$query2 -> bindValue( 'id_menu' , $menu_id , \PDO::PARAM_INT );
$query2 -> bindValue( ':order' , $row['o'] , \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() )
$page['page_down'] = $row['id'];
else
$page['page_down'] = '';
$query2 -> closeCursor();
$query2 = $db -> prepare( 'SELECT id FROM pcms_page WHERE o<:order AND id_menu=:id_menu ORDER BY o ASC LIMIT 1' );
$query2 -> bindValue( 'id_menu' , $menu_id , \PDO::PARAM_INT );
$query2 -> bindValue( ':order' , $row['o'] , \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() )
$page['page_up'] = $row['id'];
else
$page['page_up'] = '';
$query2 -> closeCursor();
$akcja = "function mycallbackform(v,m,f){
if( v == true )
document.location.href='index.php?rw=del&amp;id=" . $row['id'] . "';
}";
$akcja .= "$.prompt('" . $lang -> getTrans( 'T_POTWIERDZ_USUNIECIE' ) . "',{ callback: mycallbackform, buttons: { " . $lang -> getTrans( 'T_TAK' ) . ": true, " . $lang -> getTrans( 'T_NIE' ) . ": false }, focus: 1 })";
$akcja = 'onClick="'.$akcja.'"';;
$page['action'] = $akcja;
$pages[] = $page;
$lp++;
}
return $pages;
}
public function selectMaxOrder()
{
global $db;
$query = $db -> prepare( 'SELECT MAX(o) FROM pcms_page' );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$order = $row[0]+1;
$query -> closeCursor();
return $order;
}
public function save()
{
global $lang, $db;
$enabled = \System::formGet( 'enabled' );
$link = \System::formGet( 'link' );
$show_title = \System::formGet( 'show_title' );
$sort_type = \System::formGet( 'sort_type' );
$page_type_id = \System::formGet( 'page_type_id' );
$menu = \System::formGet( 'menu' );
$page_id = \System::formGetInt( 'id' );
$article_number = \System::formGetInt( 'article_number' );
$query = $db -> prepare( 'UPDATE pcms_page SET link = :link , id_menu = :id_menu , id_page_type = :id_page_type , id_sort_type = :id_sort_type , article_number = :article_number , show_title = :show_title , enabled = :enabled WHERE id = :id ' );
$query -> bindValue( ':link' , $link , \PDO::PARAM_STR );
$query -> bindValue( ':id_menu' , $menu , \PDO::PARAM_INT );
$query -> bindValue( ':id_page_type' , $page_type_id , \PDO::PARAM_INT );
$query -> bindValue( ':id_sort_type' , $sort_type , \PDO::PARAM_INT );
$query -> bindValue( ':article_number' , $article_number , \PDO::PARAM_INT );
$query -> bindValue( ':show_title' , $show_title , \PDO::PARAM_STR );
$query -> bindValue( ':enabled' , $enabled , \PDO::PARAM_STR );
$query -> bindValue( ':id' , $page_id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
if ( $page_id )
{
$query = $db -> prepare( 'SELECT id FROM pcms_lang WHERE enabled = :enabled' );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$title = \System::formGet( 'title_' . $row['id'] );
$meta_description = \System::formGet( 'meta_description_' . $row['id'] );
$meta_keywords = \System::formGet( 'meta_keywords_' . $row['id'] );
$seo_link = \System::formGet( 'seo_link_' . $row['id'] );
if ( $title )
{
$query2 = $db -> prepare( 'SELECT id FROM pcms_page_translation WHERE page_id=:page_id AND lang_id = :lang_id' );
$query2 -> bindValue( ':page_id' , $page_id , \PDO::PARAM_INT );
$query2 -> bindValue( ':lang_id' , $row['id'] , \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() )
{
$query3 = $db -> prepare( 'UPDATE pcms_page_translation SET seo_link = :seo_link, title = :title, meta_description = :meta_description, meta_keywords = :meta_keywords WHERE page_id = :page_id AND lang_id = :lang_id' );
$query3 -> bindValue( ':page_id' , $page_id , \PDO::PARAM_INT );
$query3 -> bindValue( ':lang_id' , $row['id'] , \PDO::PARAM_INT );
$query3 -> bindValue( ':title' , $title , \PDO::PARAM_STR );
$query3 -> bindValue( ':meta_description' , $meta_description , \PDO::PARAM_STR );
$query3 -> bindValue( ':meta_keywords' , $meta_keywords , \PDO::PARAM_STR );
$query3 -> bindValue( ':seo_link' , $seo_link , \PDO::PARAM_STR );
$query3 -> execute();
$query3 -> closeCursor();
}
else
{
$query3 = $db -> prepare( 'INSERT INTO pcms_page_translation ( page_id, lang_id, title, meta_description, meta_keywords, seo_link ) VALUES ( :page_id, :lang_id, :title, :meta_description, :meta_keywords, :seo_link )' );
$query3 -> bindValue( ':page_id' , $page_id , \PDO::PARAM_INT );
$query3 -> bindValue( ':lang_id' , $row['id'] , \PDO::PARAM_INT );
$query3 -> bindValue( ':title' , $title , \PDO::PARAM_STR );
$query3 -> bindValue( ':meta_description' , $meta_description , \PDO::PARAM_STR );
$query3 -> bindValue( ':meta_keywords' , $meta_keywords , \PDO::PARAM_STR );
$query3 -> bindValue( ':seo_link' , $seo_link , \PDO::PARAM_STR );
$query3 -> execute();
$query3 -> closeCursor();
}
$query2 -> closeCursor();
}
}
$query -> closeCursor();
\System::rewriteHtacces();
\System::setAlert( $lang -> getTrans( 'T_ZAPISANO_STRONE' ) );
\System::deleteCacheAdmin();
\System::deleteCache();
}
}
public function saveNew()
{
global $lang , $db;
$enabled = \System::formGet( 'enabled' );
$link = \System::formGet( 'link' );
$show_title = \System::formGet( 'show_title' );
$sort_type = \System::formGet( 'sort_type' );
$page_type_id = \System::formGet( 'page_type_id' );
$menu = \System::formGet( 'menu' );
$o = \System::formGetInt( 'o' );
$article_number = \System::formGetInt( 'article_number' );
$time = \System::formGetHash( 'time' );
if ( $time != \System::getSessionVar( 'db_edit_add' ) )
{
$query = $db -> prepare( 'INSERT INTO pcms_page ( link , id_menu , id_page_type , id_sort_type , article_number , show_title , enabled , o) VALUES ( :link , :id_menu , :id_page_type , :id_sort_type , :article_number , :show_title , :enabled , :o)' );
$query -> bindValue( ':link' , $link , \PDO::PARAM_STR );
$query -> bindValue( ':id_menu' , $menu , \PDO::PARAM_INT );
$query -> bindValue( ':id_page_type' , $page_type_id , \PDO::PARAM_INT );
$query -> bindValue( ':id_sort_type' , $sort_type , \PDO::PARAM_INT );
$query -> bindValue( ':article_number' , $article_number , \PDO::PARAM_INT );
$query -> bindValue( ':show_title' , $show_title , \PDO::PARAM_STR );
$query -> bindValue( ':enabled' , $enabled , \PDO::PARAM_STR );
$query -> bindValue( ':o' , $o , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$page_id = $db -> lastInsertId();
if ( $page_id )
{
$query = $db -> prepare( 'SELECT id FROM pcms_lang WHERE enabled = :enabled' );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$title = \System::formGet( 'title_' . $row['id'] );
$meta_description = \System::formGet( 'meta_description_' . $row['id'] );
$meta_keywords = \System::formGet( 'meta_keywords_' . $row['id'] );
$seo_link = \System::formGet( 'seo_link_' . $row['id'] );
if ( $title )
{
$query2 = $db -> prepare( 'INSERT INTO pcms_page_translation ( page_id, lang_id, title, meta_description, meta_keywords, seo_link ) VALUES ( :page_id, :lang_id, :title, :meta_description, :meta_keywords, :seo_link )' );
$query2 -> bindValue( ':page_id' , $page_id , \PDO::PARAM_INT );
$query2 -> bindValue( ':lang_id' , $row['id'] , \PDO::PARAM_INT );
$query2 -> bindValue( ':title' , $title , \PDO::PARAM_STR );
$query2 -> bindValue( ':meta_description' , $meta_description , \PDO::PARAM_STR );
$query2 -> bindValue( ':meta_keywords' , $meta_keywords , \PDO::PARAM_STR );
$query2 -> bindValue( ':seo_link' , $seo_link , \PDO::PARAM_STR );
$query2 -> execute();
$query2 -> closeCursor();
}
}
$query -> closeCursor();
\System::setSessionVar( 'db_edit_add' , $time );
\System::rewriteHtacces();
\System::setAlert( $lang -> getTrans( 'T_DODANO_STRONE' ) );
}
\System::deleteCacheAdmin();
\System::deleteCache();
}
}
/* ---------- */
public function delete( $id )
{
global $db , $lang, $sys;
$query = $db -> prepare( 'DELETE FROM pcms_page WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
$query = $db -> prepare( 'DELETE FROM pcms_page_translation WHERE page_id = :page_id' );
$query -> bindValue( ':page_id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_USNIETO_STRONE' ) );
\System::rewriteHtacces();
\System::deleteCacheAdmin();
\System::deleteCache();
}
/* ----------- */
public function moveDown( $id , $menu_id )
{
global $lang , $db , $sys;
$query = $db -> prepare( 'SELECT o FROM pcms_page WHERE id = :id ');
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$o1 = $row['o'];
$query -> closeCursor();
$query = $db -> prepare( 'SELECT id, o FROM pcms_page WHERE o > :o1 AND id_menu = :id_menu ORDER BY o ASC LIMIT 1' );
$query -> bindValue( ':o1' , $o1 , \PDO::PARAM_INT );
$query -> bindValue( ':id_menu' , $menu_id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$query2 = $db -> prepare( 'UPDATE pcms_page SET o = :o2 WHERE id = :id' );
$query2 -> bindValue( ':o2' , $row['o'] , \PDO::PARAM_INT );
$query2 -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
$query2 = $db -> prepare( 'UPDATE pcms_page SET o = :o1 WHERE id = :id2' );
$query2 -> bindValue( ':o1' , $o1 , \PDO::PARAM_INT );
$query2 -> bindValue( ':id2' , $row['id'] , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_PRZESUNIETO_STRONE' ) );
}
$query -> closeCursor();
\System::deleteCacheAdmin();
\System::deleteCache();
}
/* --------- */
public function moveUp( $id , $menu_id )
{
global $sys , $db , $lang;
$query = $db -> prepare( 'SELECT o FROM pcms_page WHERE id = :id ');
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$o1 = $row['o'];
$query -> closeCursor();
$query = $db -> prepare( 'SELECT id, o FROM pcms_page WHERE o < :o1 AND id_menu = :id_menu ORDER BY o DESC LIMIT 1');
$query -> bindValue( ':o1' , $o1 , \PDO::PARAM_INT );
$query -> bindValue( ':id_menu' , $menu_id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$query2 = $db -> prepare( 'UPDATE pcms_page SET o = :o2 WHERE id = :id' );
$query2 -> bindValue( ':o2' , $row['o'] , \PDO::PARAM_INT );
$query2 -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
$query2 = $db -> prepare( 'UPDATE pcms_page SET o = :o1 WHERE id = :id2' );
$query2 -> bindValue( ':o1' , $o1 , \PDO::PARAM_INT );
$query2 -> bindValue( ':id2', $row['id'] , \PDO::PARAM_INT );
$query2 -> execute();
$query2 -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_PRZESUNIETO_STRONE' ) );
}
$query -> closeCursor();
\System::deleteCacheAdmin();
\System::deleteCache();
}
}
?>

View File

@@ -0,0 +1,86 @@
<?
namespace admin\factory;
class SettingManager
{
public function save()
{
global $db , $lang;
$firm_name = \System::saveString( \System::formGet( 'firm_name' ) );
\admin\factory\SettingManager::saveParam( 'firm_name' , $firm_name );
$street = \System::saveString( \System::formGet( 'street' ) );
\admin\factory\SettingManager::saveParam( 'street' , $street );
$postal_code = \System::saveString( \System::formGet( 'postal_code' ) );
\admin\factory\SettingManager::saveParam( 'postal_code' , $postal_code );
$city = \System::saveString( \System::formGet( 'city' ) );
\admin\factory\SettingManager::saveParam( 'city' , $city );
$nip = \System::saveString( \System::formGet( 'nip' ) );
\admin\factory\SettingManager::saveParam( 'nip' , $nip );
$email = \System::saveString( \System::formGet( 'email' ) );
\admin\factory\SettingManager::saveParam( 'email' , $email );
$phone = \System::saveString( \System::formGet( 'phone' ) );
\admin\factory\SettingManager::saveParam( 'phone' , $phone );
$fax = \System::saveString( \System::formGet( 'fax' ) );
\admin\factory\SettingManager::saveParam( 'fax' , $fax );
$account = \System::saveString( \System::formGet( 'account' ) );
\admin\factory\SettingManager::saveParam( 'account' , $account );
$person = \System::saveString( \System::formGet( 'person' ) );
\admin\factory\SettingManager::saveParam( 'person' , $person );
$admin_email = \System::saveString( \System::formGet( 'admin_email' ) );
\admin\factory\SettingManager::saveParam( 'admin_email' , $admin_email );
$email_host = \System::saveString( \System::formGet( 'email_host' ) );
\admin\factory\SettingManager::saveParam( 'email_host' , $email_host );
$email_port = \System::saveString( \System::formGet( 'email_port' ) );
\admin\factory\SettingManager::saveParam( 'email_port' , $email_port );
$email_login = \System::saveString( \System::formGet( 'email_login' ) );
\admin\factory\SettingManager::saveParam( 'email_login' , $email_login );
$email_password = \System::saveString( \System::formGet( 'email_password' ) );
\admin\factory\SettingManager::saveParam( 'email_password' , $email_password );
$google_map_key = \System::saveString( \System::formGet( 'google_map_key' ) );
\admin\factory\SettingManager::saveParam( 'google_map_key' , $google_map_key );
$user_register = \System::saveString( \System::formGet( 'user_register' ) );
\admin\factory\SettingManager::saveParam( 'user_register' , $user_register );
$contact_form = \System::saveString( \System::formGet( 'contact_form' ) );
\admin\factory\SettingManager::saveParam( 'contact_form' , $contact_form );
$visit_count = \System::saveString( \System::formGet( 'visit_count' ) );
\admin\factory\SettingManager::saveParam( 'visit_count' , $visit_count );
$register = \System::formGetInt( 'register' );
\admin\factory\SettingManager::saveParam( 'register' , $register );
\System::deleteCacheAdmin();
\System::deleteCache();
\System::setAlert( $lang -> getTrans( 'T_USTAWIENIA_ZAPISANE' ) );
}
public function saveParam( $param , $value )
{
global $db;
$query = $db -> prepare( 'UPDATE pcms_settings SET value = :value WHERE param = :param' );
$query -> bindValue( ':value' , $value , \PDO::PARAM_STR );
$query -> bindValue( ':param' , $param , \PDO::PARAM_STR );
$query -> execute();
$query -> closeCursor();
}
}
?>

View File

@@ -0,0 +1,17 @@
<?
namespace admin\factory;
class TranslationManager
{
public function delete( $id )
{
global $lang , $sys , $db;
$query = $db -> prepare( 'DELETE FROM pcms_lang_text WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$sys -> setAlert( $lang -> getTrans( 'T_USUNIETO_TLUMACZENIE' ) );
}
}
?>

View File

@@ -0,0 +1,18 @@
<?php
namespace admin\factory;
class UsersManager {
public function delete( $id )
{
global $db , $lang;
$query = $db -> prepare( 'DELETE FROM pcms_user WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
$query -> closeCursor();
\System::setAlert( $lang -> getTrans( 'T_UZYTKOWNIK_USUNIETY' ) );
}
}
?>

View File

@@ -0,0 +1,47 @@
<?php
namespace admin\view;
class AdminManager
{
public function show()
{
global $lang;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_ADMINISTRATORZY' ) );
$dbrowse = new \DataBrowse( 'pcms_user' , 'admin="1" AND login!="Vampirius"' );
$dbrowse -> addPosition( 'login' , $lang -> getTrans( 'T_LOGIN' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'name' , $lang -> getTrans( 'T_IMIE' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'surname' , $lang -> getTrans( 'T_NAZWISKO' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , \System::getComboYesNo() , '' , true );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , \System::deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'id ASC' );
$dbrowse -> addLp();
$dbrowse -> addFiltr( 'login' , $lang -> getTrans( 'T_LOGIN' ) );
$dbrowse -> addFiltr( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , \System::getComboYesNo() );
$out .= $dbrowse -> draw();
return $out;
}
public function edit( $id )
{
global $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_ADMINISTRATORZY' ) );
$dbedit = new \DataEdit( 'pcms_user' , 'id' , $id );
$dbedit -> addPosition( 'login' , $lang -> getTrans( 'T_LOGIN' ) , 'text' );
$dbedit -> addPosition( 'name' , $lang -> getTrans( 'T_IMIE' ) , 'text' );
$dbedit -> addPosition( 'surname' , $lang -> getTrans( 'T_NAZWISKO' ) , 'text' );
$dbedit -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , 'radio' , '' , \System::getComboYesNo() );
$dbedit -> addPositionHidden( 'admin' , '1' );
$dbedit -> addPositionPassword();
$out .= $dbedit -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,47 @@
<?php
namespace admin\view;
class Adverts {
public function edit( $id = '' )
{
global $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_REKLAMA' ) );
$dbedit = new \DataEdit( 'pcms_adverts' , 'id' , $id );
$dbedit -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) , 'text' );
$dbedit -> addPosition( 'date_start' , $lang -> getTrans( 'T_DATA_POCZATKOWA' ) , 'text' , 'onFocus="if ( $( this ).val() == \'\' ) $(this).val( \'' . date( 'Y-m-d' ) . '\');"' );
$dbedit -> addPosition( 'date_end' , $lang -> getTrans( 'T_DATA_KONCOWA' ) , 'text' , 'onFocus="if ( $( this ).val() == \'\' ) $(this).val( \'' . date( 'Y-m-d' ) . '\');"' );
$dbedit -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , 'radio' , '' , \System::getComboYesNo() );
$dbedit -> addPosition( 'img' , $lang -> getTrans( 'T_ZDJECIE' ) , 'file' );
$dbedit -> setUploadFolder( 'image' , 'upload/adverts/' );
$out .= $dbedit -> draw();
return $out;
}
public function show()
{
global $lang;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_REKLAMA' ) );
$dbrowse = new \DataBrowse( 'pcms_adverts' );
$dbrowse -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) );
$dbrowse -> addPosition( 'date_start' , $lang -> getTrans( 'T_DATA_POCZATKOWA' ) );
$dbrowse -> addPosition( 'date_end' , $lang -> getTrans( 'T_DATA_KONCOWA' ) );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , \System::deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'name ASC' );
$dbrowse -> addLp();
$dbrowse -> addFiltr( 'name' , $lang -> getTrans( 'T_NAZWA' ) , $tab );
$dbrowse -> addFiltr( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , \System::getComboYesNo() );
$out .= $dbrowse -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,50 @@
<?php
namespace admin\view;
class ArticleArchiveManager {
public function show()
{
global $lang;
$delete_articles = "var articles = '';
$('input:checkbox:checked').each(
function() {
if ( articles != '' )
articles = articles + ':';
articles = articles + $(this).val();
}
);
$.prompt('" . $lang -> getTrans( 'T_TRWA_USUWANIE' ) . "');
xajax_deleteArticles( articles );";
$out = \admin\view\PagePanel::show( false , false , false , $lang -> getTrans( 'T_ARCHIWUM'), 'formularz', false, false, false, $delete_articles );
$tab_comment[0] = $lang -> getTrans( 'T_NIE' );
$tab_comment[1] = $lang -> getTrans( 'T_TAK' );
$tab_comment[2] = $lang -> getTrans( 'T_DLA_ZAREJESTROWANYCH' );
$tab = \System::getArticlesTitle();
$dbrowse = new \DataBrowse( 'pcms_article' , 'archive = "1"' );
$dbrowse -> addPosition( 'id' , $lang -> getTrans( 'T_TYTUL' ) , '' , $tab , '' );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPosition( 'show_title' , $lang -> getTrans( 'T_POKAZ_TYTUL' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPosition( 'print' , $lang -> getTrans( 'T_DRUKUJ' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPosition( 'date_modify' , $lang -> getTrans( 'T_DATA_MODYFIKACJI' ) );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_PRZYWROC' ) , '' , './?rw=restore' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , \System::deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'date_add DESC' );
$dbrowse -> addLp();
$dbrowse -> addCheckbox();
$dbrowse -> addFiltr( 'id{trans}' , $lang -> getTrans( 'T_TYTUL' ) , $tab );
$dbrowse -> addFiltr( 'print' , $lang -> getTrans( 'T_DRUKUJ' ) , \System::getComboYesNo() );
$dbrowse -> addFiltr( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , \System::getComboYesNo() );
$dbrowse -> addFiltr( 'show_title' , $lang -> getTrans( 'T_POKAZ_TYTUL' ) , \System::getComboYesNo() );
$out .= $dbrowse -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,181 @@
<?php
namespace admin\view;
class ArticleManager
{
public function drawArticle( $version_id )
{
global $lang;
$article_id = \admin\factory\ArticleManager::getArticleIdByVersionId( $version_id );
$version = \admin\factory\ArticleManager::getArticleVersionByVersionId( $version_id );
$out = \admin\view\PagePanel::show( false , false , true );
$language = \admin\factory\ArticleManager::getArticleParamLanguage( $article_id , $version );
$tpl = new \Savant3();
$tpl -> _language = $language;
$out .= $tpl -> fetch( 'templates/article-draw.php' );
return $out;
}
public function add()
{
global $lang;
$_SESSION['KCFINDER']['disabled'] = false;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_ARTYKULY' ) , 'formularz' , false, false, 'saveArticle()' );
$pages = \admin\factory\ArticleManager::getPagesAssign();
$language = \admin\factory\ArticleManager::getArticleParamLanguage();
$tpl = new \Savant3();
$tpl -> _language = $language;
$tpl -> _rw = 'add';
$tpl -> _pages = $pages;
$tpl -> _id_form = 'formularz';
$tpl -> _layouts = \System::getLayouts();
$out .= $tpl -> fetch( 'templates/article-edit.php' );
return $out;
}
public function edit( $id )
{
global $lang;
$_SESSION['KCFINDER']['disabled'] = false;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_ARTYKULY' ) , 'formularz' , false, false, 'saveArticle()' );
$row = \admin\factory\ArticleManager::getArticleParam( $id );
$pages = \admin\factory\ArticleManager::getPagesAssign( $id );
$language = \admin\factory\ArticleManager::getArticleParamLanguage( $id );
$tpl = new \Savant3();
$tpl -> _id = $id;
$tpl -> _edit = true;
$tpl -> _enabled = $row['enabled'];
$tpl -> _print = $row['print'];
$tpl -> _show_title = $row['show_title'];
$tpl -> _show_date = $row['show_date'];
$tpl -> _show_author = $row['show_author'];
$tpl -> _keep_archive = $row['keep_archive'];
$tpl -> _layout = $row['id_layout'];
$tpl -> _language = $language;
$tpl -> _rw = 'edit';
$tpl -> _pages = $pages;
$tpl -> _id_form = 'formularz';
$tpl -> _layouts = \System::getLayouts();
$tpl -> _version = \admin\factory\ArticleManager::getMaxArticleVersion( $id ) + 1;
$tpl -> _images = \admin\factory\ArticleManager::getArticleImages( $id );
$tpl -> _files = \admin\factory\ArticleManager::getArticleFiles( $id );
$out .= $tpl -> fetch( 'templates/article-edit.php');
return $out;
}
public function showVersions( $id )
{
global $lang , $bs;
$out = \admin\view\PagePanel::show( false , false , false , ucfirst( $lang -> getTrans( 'T_ARTYKUL' ) ) . ': ' . \article\FArticle::getArticleTitle( $id ) , '' , true );
$lpk = 25;
if ( \System::formGetInt( 'r' ) )
\System::setSessionVar( 'pcms_page_limit' , \System::formGetInt( 'r' ) );
$limit = \System::getSessionVar( 'pcms_page_limit' );
$limit = \System::checkBrowseLimit( $limit );
$link = 'index.php';
$count_page = \admin\factory\ArticleManager::getCountVersions( $id );
$tpl = new \Savant3;
$ls = ceil( $count_page / $lpk );
if ( $bs < 1 )
$bs = 1;
else if ( $bs > $ls )
$bs = $ls;
$a = \System::getPagingVar( "a" , $bs , $ls );
$b = \System::getPagingVar( "b" , $bs , $ls );
$tpl -> _a = $bs - $b;
$tpl -> _b = $bs + $a;
$tpl -> _ls = $ls;
$tpl -> _link = $link;
$tpl -> _bs = $bs;
$from = $lpk * ( $bs - 1 );
if ( $from < 0 )
$from = 0;
$lp = $from + 1;
$articles = \admin\factory\ArticleManager::getVersions( $id , $from , $lpk );
$tpl -> _articles = $articles;
$tpl -> _bs = $bs;
$tpl -> _limit = $lpk;
$tpl -> _total = $count_page;
$tpl -> _start = $lpk * ( $bs - 1 ) + 1 < 0 ? 0 : $lpk * ( $bs - 1 ) + 1;
if ( $count_page == 0 )
$tpl -> _start = 0;
$tpl -> _end = $lpk * $bs > $count_page ? $count_page : $lpk * $bs;
$out .= $tpl -> fetch( 'templates/article-versions.php' );
return $out;
}
public function show()
{
global $lang;
$delete_articles = "var articles = '';
$('input:checkbox:checked').each(
function() {
if ( articles != '' )
articles = articles + ':';
articles = articles + $(this).val();
}
);
$.prompt('" . $lang -> getTrans( 'T_TRWA_PRZENOSZENIE_DO_ARCHIWUM' ) . "');
xajax_moveArticlesToArchive( articles );";
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_ARTYKULY'), 'formularz', false, false, false, $delete_articles );
$tab_comment[0] = $lang -> getTrans( 'T_NIE' );
$tab_comment[1] = $lang -> getTrans( 'T_TAK' );
$tab_comment[2] = $lang -> getTrans( 'T_DLA_ZAREJESTROWANYCH' );
$tab = \System::getArticlesTitle();
$dbrowse = new \DataBrowse( 'pcms_article' , 'archive = "0"' );
$dbrowse -> addPosition( 'id' , $lang -> getTrans( 'T_TYTUL' ) , '' , $tab , '' );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPosition( 'show_title' , $lang -> getTrans( 'T_POKAZ_TYTUL' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPosition( 'print' , $lang -> getTrans( 'T_DRUKUJ' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPosition( 'date_modify', $lang -> getTrans( 'T_DATA_MODYFIKACJI' ) );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_POKAZ' ) , '' , 'index.php?act=show_versions' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , \System::deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'date_add DESC' );
$dbrowse -> addLp();
$dbrowse -> addCheckbox();
$dbrowse -> addFiltr( 'id{trans}' , $lang -> getTrans( 'T_TYTUL' ) , $tab );
$dbrowse -> addFiltr( 'print' , $lang -> getTrans( 'T_DRUKUJ' ) , \System::getComboYesNo() );
$dbrowse -> addFiltr( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , \System::getComboYesNo() );
$dbrowse -> addFiltr( 'show_title' , $lang -> getTrans( 'T_POKAZ_TYTUL' ) , \System::getComboYesNo() );
$out .= $dbrowse -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,36 @@
<?php
namespace admin\view;
class ArticleSort {
public function drawPageArticles( $id )
{
global $lang;
$tpl = new \Savant3();
$tpl -> _id = $id;
$tpl -> _title = \System::getPageTitle( $id );
$tpl -> _articles = \admin\factory\ArticleSort::getPageArticleSort( $id );
return $tpl -> fetch( 'templates/page-article-sort.php');
}
public function showPages()
{
global $sys , $lang;
$out = \admin\view\PagePanel::show( false , false , false , $lang -> getTrans( 'T_SORTOWANIE_ARTYKULOW' ) );
$tab = \System::getPagesTitle();
$dbrowse = new \DataBrowse( 'pcms_page' );
$dbrowse -> addPosition( 'id' , $lang -> getTrans( 'T_STRONA' ) , '' , $tab , '' , true );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_POKAZ' ) , '' , './?rw=page' );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'id ASC' );
$dbrowse -> addLp();
$out .= $dbrowse -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,95 @@
<?
namespace admin\view;
class BannerManager
{
public function show()
{
global $sys , $db , $lang , $bs;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_BANERY' ) );
$lpk = 25;
if ( $sys -> formGetInt('r') )
$sys -> setSessionVar( 'pcms_banner_limit' , $sys -> formGetInt('r') );
$limit = $sys -> getSessionVar( 'pcms_banner_limit' );
$limit = $sys -> checkBrowseLimit( $limit );
$link = 'index.php';
$banners_count = \System::getCountBanners();
$tpl = new \Savant3;
$ls = ceil( $banners_count / $lpk );
if ( $bs < 1 )
$bs = 1;
else if ( $bs > $ls )
$bs = $ls;
$a = $sys -> getPagingVar( 'a' , $bs , $ls );
$b = $sys -> getPagingVar( 'b' , $bs , $ls );
$tpl -> _a = $bs - $b;
$tpl -> _b = $bs + $a;
$tpl -> _ls = $ls;
$tpl -> _link = $link;
$tpl -> _bs = $bs;
$from = $lpk * ( $bs - 1 );
if ( $from < 0 )
$from = 0;
$lp = $from+1;
$banners = \admin\factory\BannerManager::getBanners( $from , $lpk );
$tpl -> _banners = $banners;
$tpl -> _bs = $bs;
$tpl -> _limit = $lpk;
$tpl -> _total = count( $banners );
$tpl -> _start = $lpk * ( $bs - 1 ) + 1 > 0 ? $lpk * ( $bs - 1 ) + 1 : 0;
$tpl -> _end = $lpk * $bs > $banners_count ? $banners_count : $lpk * $bs;
$out .= $tpl -> fetch( 'templates/banner.php' );
return $out;
}
public function edit( $id = '' )
{
global $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_BANERY' ) );
$dbedit = new \DataEdit( 'pcms_banner' , 'id' , $id );
$dbedit -> addPosition( 'title' , $lang -> getTrans( 'T_TYTUL' ) , 'text' );
$dbedit -> addPosition( 'link' , $lang -> getTrans( 'T_LINK' ) , 'text' );
$dbedit -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , 'radio' , '' , \System::getComboYesNo() );
$dbedit -> addPosition( 'image' , $lang -> getTrans( 'T_ZDJECIE' ) , 'file' );
$dbedit -> setUploadFolder( 'image' , 'upload/banner/' );
$out .= $dbedit -> draw();
return $out;
}
public function add()
{
global $sys , $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_BANERY' ) );
$order = \admin\factory\BannerManager::getMaxOrder();
$dbedit = new \DataEdit( 'pcms_banner' , 'id' );
$dbedit -> addPosition( 'title' , $lang -> getTrans( 'T_TYTUL' ) , 'text' );
$dbedit -> addPosition( 'link' , $lang -> getTrans( 'T_LINK' ) , 'text' );
$dbedit -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , 'radio' , '' , $sys -> getComboYesNo() );
$dbedit -> addPosition( 'image' , $lang -> getTrans( 'T_ZDJECIE' ) , 'file' );
$dbedit -> setUploadFolder( 'image' , 'upload/banner/' );
$dbedit -> addPositionHidden( 'o' , $order );
$out .= $dbedit -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,56 @@
<?
namespace admin\view;
class EmailRestriction
{
public function edit( $id )
{
global $lang , $sys;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_ZAKAZANE_MAILE' ) );
$dbedit = new \DataEdit( 'pcms_banned_email' , 'id' , $id );
$dbedit -> addPosition( 'email' , $lang -> getTrans( 'T_EMAIL' ) , 'text' );
$out .= $dbedit -> draw();
return $out;
}
/* ---------- */
public function add()
{
global $lang , $sys;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_ZAKAZANE_MAILE' ) );
$dbedit = new \DataEdit( 'pcms_banned_email' , 'id' );
$dbedit -> addPosition( 'email' , $lang -> getTrans( 'T_EMAIL' ) , 'text' );
$out .= $dbedit -> draw();
return $out;
}
/* ---------- */
public function show()
{
global $lang , $sys;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_ZAKAZANE_MAILE' ) );
$dbrowse = new \DataBrowse('pcms_banned_email');
$dbrowse -> addPosition( 'email' , $lang -> getTrans( 'T_EMAIL' ) , '' , '' , 'text-align:left;' , true );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , $sys -> deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'email ASC' );
$dbrowse -> addLp();
$dbrowse -> addFiltr( 'email' , $lang -> getTrans( 'T_EMAIL' ) );
$out .= $dbrowse -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,43 @@
<?
namespace admin\view;
class GuestBookManager
{
public function show()
{
global $lang;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_KSIEGA_GOSCI' ) );
$dbrowse = new \DataBrowse( 'pcms_guest_book' );
$dbrowse -> addPosition( 'signature' , $lang -> getTrans( 'T_PODPIS' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'text' , $lang -> getTrans( 'T_TEKST' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'date' , $lang -> getTrans( 'T_DATA' ) , '' , '' , '' , true );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , \System::deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'date DESC' );
$dbrowse -> addLp();
$dbrowse -> addFiltr( 'signature' , $lang -> getTrans( 'T_PODPIS' ) , 'text' );
$dbrowse -> addFiltr( 'text' , $lang -> getTrans( 'T_TEKST' ) , 'text' );
$out .= $dbrowse -> draw();
return $out;
}
public function edit( $id = '' )
{
global $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_KSIEGA_GOSCI' ) );
$dbedit = new \DataEdit( 'pcms_guest_book' , 'id' , $id );
$dbedit -> addPosition( 'signature' , $lang -> getTrans( 'T_PODPIS' ) , 'text' );
$dbedit -> addPosition( 'text' , $lang -> getTrans( 'T_TEKST' ) , 'textarea' );
$dbedit -> addPosition( 'date' , $lang -> getTrans( 'T_DATA' ) , 'text' );
$out .= $dbedit -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,41 @@
<?
namespace admin\view;
class LanguageManager
{
public function show()
{
global $sys , $lang;
$out = \admin\view\PagePanel::show( false , false , false , $lang -> getTrans( 'T_JEZYKI' ) );
$dbrowse = new \DataBrowse( 'pcms_lang' );
$dbrowse -> addPosition( 'id' , $lang -> getTrans( 'T_ID' ) , '' , '' , 'text-align:center;' , true );
$dbrowse -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) , '' , '' , 'text-align:center;' , true );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , $sys -> getComboYesNo() , 'text-align:center;' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'id ASC' );
$dbrowse -> addLp();
$out .= $dbrowse -> draw();
return $out;
}
/* --------- */
public function edit( $id )
{
global $sys , $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_JEZYKI' ) );
$dbedit = new \DataEdit( 'pcms_lang' , 'id' , $id );
$dbedit -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) , 'label' );
$dbedit -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , 'radio' , '' , $sys -> getComboYesNo() );
$out .= $dbedit -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,76 @@
<?php
namespace admin\view;
class LayoutManager {
public function show()
{
global $lang , $sys;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_SZABLONY' ) );
$dbrowse = new \DataBrowse( 'pcms_layout' );
$dbrowse -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , $sys -> getComboYesNo() , 'text-align:center;' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , $sys -> deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'name ASC' );
$dbrowse -> addLp();
$out .= $dbrowse -> draw();
return $out;
}
/* -------- */
public function add()
{
global $lang , $sys;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_SZABLONY' ) );
$pages = \admin\factory\LayoutManager::getPages();
$tpl = new \Savant3;
$tpl -> _rw = 'save_new';
$tpl -> _pages = $pages;
$out .= $tpl -> fetch( 'templates/layout-edit.php' );
return $out;
}
/* --------- */
public function edit( $id )
{
global $lang , $sys , $db;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_SZABLONY' ) , 'formularz' , false , false , 'saveLayout()' );
$pages = \admin\factory\LayoutManager::getPages();
$pages_act = \admin\factory\LayoutManager::getSelectedPages( $id );
$tpl = new \Savant3;
$tpl -> _rw = 'save';
$tpl -> _id = $id;
$tpl -> _pages = $pages;
$tpl -> _pages_act = $pages_act;
$query = $db -> prepare( 'SELECT name , html , css , javascript , enabled FROM pcms_layout WHERE id = :id' );
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$tpl -> _name = $row['name'];
$tpl -> _html = $row['html'];
$tpl -> _css = $row['css'];
$tpl -> _js = $row['javascript'];
$tpl -> _enabled = $row['enabled'];
}
$query -> closeCursor();
$out .= $tpl -> fetch( 'templates/layout-edit.php' );
return $out;
}
}
?>

View File

@@ -0,0 +1,56 @@
<?
namespace admin\view;
class LoginRestriction
{
public function edit( $id )
{
global $lang , $sys;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_ZAKAZANE_LOGINY' ) );
$dbedit = new \DataEdit( 'pcms_banned_login' , 'id' , $id );
$dbedit -> addPosition( 'login' , $lang -> getTrans( 'T_LOGIN' ) , 'text' );
$out .= $dbedit -> draw();
return $out;
}
/* ---------- */
public function add()
{
global $lang , $sys;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_ZAKAZANE_LOGINY' ) );
$dbedit = new \DataEdit( 'pcms_banned_login' , 'id' );
$dbedit -> addPosition( 'login' , $lang -> getTrans( 'T_LOGIN' ) , 'text' );
$out .= $dbedit -> draw();
return $out;
}
/* ---------- */
public function show()
{
global $lang , $sys;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_ZAKAZANE_LOGINY' ) );
$dbrowse = new \DataBrowse('pcms_banned_login');
$dbrowse -> addPosition( 'login' , $lang -> getTrans( 'T_LOGIN' ) , '' , '' , 'text-align:left;' , true );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , $sys -> deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'login ASC' );
$dbrowse -> addLp();
$dbrowse -> addFiltr( 'login' , $lang -> getTrans( 'T_LOGIN' ) );
$out .= $dbrowse -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,40 @@
<?php
namespace admin\view;
class MenuManager
{
public function show()
{
global $lang;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_LISTA_MENU' ) );
$dbrowse = new \DataBrowse( 'pcms_menu' );
$dbrowse -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ), '' , \System::getComboYesNo() );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ), '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , \System::deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'id ASC' );
$dbrowse -> addLp();
$out .= $dbrowse -> draw();
return $out;
}
public function edit( $id = '' )
{
global $sys , $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_MENU' ) );
$dbedit = new \DataEdit( 'pcms_menu' , 'id' , $id , 'index.php' );
$dbedit -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) , 'text' );
$dbedit -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ), 'radio' , '' , $sys -> getComboYesNo() );
$out .= $dbedit -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,24 @@
<?php
namespace admin\view;
class Page {
function show()
{
global $config;
$tpl = new \Savant3;
$tpl -> _langs = \System::getLangs();
$tpl -> _current_lang = \System::getSessionVar( 'current_lang' );
$tpl -> _content = \admin\controls\Page::getContent();
$tpl -> _p = \System::getSessionVar( 'page_type' );
$tpl -> _site_title = 'www.' . $config['page'];
if ( \System::getSessionVar( 'alert' ) )
{
$tpl -> _alert = \System::getSessionVar( 'alert' );
\System::setAlert( '' );
}
return $tpl -> fetch( 'templates/page.php' );
}
}
?>

View File

@@ -0,0 +1,152 @@
<?
/* 2011-09-26 - dodanie typu strony LINK */
namespace admin\view;
class PageManager
{
public function showAssignedArticles( $id )
{
global $lang;
$out = \admin\view\PagePanel::show( false , false , true , $lang -> getTrans( 'T_PRZYPISANE_ARTYKULY' ) );
$tpl = new \Savant3();
$tpl -> _articles = \admin\factory\PageManager::getAssignedArticles( $id );
$out .= $tpl -> fetch( 'templates/page-articles-list.php' );
return $out;
}
public function edit( $id )
{
global $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_STRONY' ) );
$menu = \System::getMenuList();
$page_types = \System::getPageTypes();
$sort_types = \System::getSortTypes();
$row = \admin\factory\PageManager::getPageParam( $id );
$language = \admin\factory\PageManager::getPageParamLanguage( $id );
$tpl = new \Savant3;
$tpl -> _id = $id;
$tpl -> _link = $row['link'];
$tpl -> _enabled = $row['enabled'];
$tpl -> _article_number = $row['article_number'];
$tpl -> _show_title = $row['show_title'];
$tpl -> _sort_type = $row['id_sort_type'];
$tpl -> _page_type_id = $row['id_page_type'];
$tpl -> _menu = $row['id_menu'];
$tpl -> _language = $language;
$tpl -> _menu = $menu;
$tpl -> _pages = $page_types;
$tpl -> _sort = $sort_types;
$tpl -> _rw = 'edit';
$tpl -> _order = $row['o'];
$tpl -> _menu_id = \System::getSessionVar( 'menu_id' );
$out .= $tpl -> fetch( 'templates/page-edit.php' );
return $out;
}
public function showMenuList()
{
global $lang;
$out = \admin\view\PagePanel::show( false , false , false , $lang -> getTrans( 'T_STRONY' ) );
$dbrowse = new \DataBrowse( 'pcms_menu' );
$dbrowse -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_POKAZ' ) , '' , 'index.php?act=menu_page' );
$dbrowse -> addLP();
$dbrowse -> addSort( 'id ASC' );
$dbrowse -> setParam( 'id' );
$out .= $dbrowse -> draw();
return $out;
}
public function show( $menu_id )
{
global $sys , $lang , $bs;
$lpk = 25;
if ( $sys -> formGetInt('r') )
$sys -> setSessionVar( 'pcms_page_limit' , $sys -> formGetInt( 'r' ) );
$limit = $sys -> getSessionVar( 'pcms_page_limit' );
$limit = $sys -> checkBrowseLimit( $limit );
$link = 'index.php';
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_STRONY' ) , '' , true );
$count_page = \System::getCountPages( $menu_id );
$tpl = new \Savant3;
$ls = ceil( $count_page / $lpk );
if ( $bs < 1 )
$bs = 1;
else if ( $bs > $ls )
$bs = $ls;
$a = $sys -> getPagingVar( "a" , $bs , $ls );
$b = $sys -> getPagingVar( "b" , $bs , $ls );
$tpl -> _a = $bs - $b;
$tpl -> _b = $bs + $a;
$tpl -> _ls = $ls;
$tpl -> _link = $link;
$tpl -> _bs = $bs;
$from = $lpk * ( $bs - 1 );
if ( $from < 0 )
$from = 0;
$lp = $from + 1;
$pages = \admin\factory\PageManager::getPages( $menu_id , $from , $lpk );
$tpl -> _pages = $pages;
$tpl -> _bs = $bs;
$tpl -> _limit = $lpk;
$tpl -> _total = $count_page;
$tpl -> _start = $lpk * ( $bs - 1 ) + 1 < 0 ? 0 : $lpk * ( $bs - 1 ) + 1;
if ( $count_page == 0 )
$tpl -> _start = 0;
$tpl -> _end = $lpk * $bs > $count_page ? $count_page : $lpk * $bs;
$out .= $tpl -> fetch( 'templates/page-definition.php' );
return $out;
}
public function add()
{
global $db , $sys , $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_STRONY' ) );
$menu = \System::getMenuList();
$page_types = \System::getPageTypes();
$sort_types = \System::getSortTypes();
$language = \System::getLangs();
$order = \admin\factory\PageManager::selectMaxOrder();
$tpl = new \Savant3;
$tpl -> _language = $language;
$tpl -> _menu = $menu;
$tpl -> _pages = $page_types;
$tpl -> _sort = $sort_types;
$tpl -> _rw = 'add';
$tpl -> _order = $order;
$tpl -> _menu_id = \System::getSessionVar( 'menu_id' );
$out .= $tpl -> fetch( 'templates/page-edit.php' );
return $out;
}
}
?>

View File

@@ -0,0 +1,21 @@
<?php
namespace admin\view;
class PagePanel {
public function show( $add = false , $save = false , $cancel = false , $title = '' , $form = 'formularz' , $back = false , $update = false , $save_ajax = false, $delete_ajax = false )
{
$tpl = new \Savant3();
$tpl -> _add = $add;
$tpl -> _save = $save;
$tpl -> _cancel = $cancel;
$tpl -> _id_form = $form;
$tpl -> _title = $title;
$tpl -> _back = $back;
$tpl -> _update = $update;
$tpl -> _save_ajax = $save_ajax;
$tpl -> _delete_ajax = $delete_ajax;
return $tpl -> fetch( 'templates/page-panel.php' );
}
}
?>

View File

@@ -0,0 +1,38 @@
<?
namespace admin\view;
class SettingManager
{
public function show()
{
global $lang , $db;
$out = \admin\view\PagePanel::show( false , true , false , $lang -> getTrans( 'T_USTAWIENIA' ) );
$tpl = new \Savant3;
$tpl -> _firm_name = \System::getSystemSettings( 'firm_name' );
$tpl -> _street = \System::getSystemSettings( 'street' );
$tpl -> _postal_code = \System::getSystemSettings( 'postal_code' );
$tpl -> _city = \System::getSystemSettings( 'city' );
$tpl -> _nip = \System::getSystemSettings( 'nip' );
$tpl -> _email = \System::getSystemSettings( 'email' );
$tpl -> _phone = \System::getSystemSettings( 'phone' );
$tpl -> _account = \System::getSystemSettings( 'account' );
$tpl -> _person = \System::getSystemSettings( 'person' );
$tpl -> _fax = \System::getSystemSettings( 'fax' );
$tpl -> _contact_form = \System::getSystemSettings( 'contact_form' );
$tpl -> _user_register = \System::getSystemSettings( 'user_register' );
$tpl -> _admin_email = \System::getSystemSettings( 'admin_email' );
$tpl -> _email_host = \System::getSystemSettings( 'email_host' );
$tpl -> _email_port = \System::getSystemSettings( 'email_port' );
$tpl -> _email_login = \System::getSystemSettings( 'email_login' );
$tpl -> _email_password = \System::getSystemSettings( 'email_password' );
$tpl -> _google_map_key = \System::getSystemSettings( 'google_map_key' );
$tpl -> _visit_count = \System::getSystemSettings( 'visit_count' );
$tpl -> _register = \System::getSystemSettings( 'register' );
$out .= $tpl -> fetch( 'templates/settings.php' );
return $out;
}
}
?>

View File

@@ -0,0 +1,49 @@
<?
namespace admin\view;
class TranslationManager
{
public function show()
{
global $lang , $sys;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_TLUMACZENIA' ) );
$dbrowse = new \DataBrowse( 'pcms_lang_text' );
$dbrowse -> addPosition( 'text' , $lang -> getTrans( 'T_TEKST' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'pl' , $lang -> getTrans( 'T_POLSKI' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'en' , $lang -> getTrans( 'T_ANGIELSKI' ) , '' , '' , '' , true );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , $sys -> deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'text ASC' );
$dbrowse -> addLp();
$dbrowse -> setLimit( 25 );
$dbrowse -> addFiltr( 'text' , $lang -> getTrans( 'T_TEKST' ) , 'text' );
$dbrowse -> addFiltr( 'pl' , $lang -> getTrans( 'T_POLSKI' ) , 'text' );
$out .= $dbrowse -> draw();
return $out;
}
public function edit( $id = '' )
{
global $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_TLUMACZENIA' ) );
$dbedit = new \DataEdit( 'pcms_lang_text' , 'id' , $id );
if ( $id )
$dbedit -> addPosition( 'text' , $lang -> getTrans( 'T_TEKST' ) , 'label' );
else
$dbedit -> addPosition( 'text' , $lang -> getTrans( 'T_TEKST' ) , 'text' );
$dbedit -> addPosition( 'pl' , $lang -> getTrans( 'T_POLSKI' ) , 'textarea' );
$dbedit -> addPosition( 'en' , $lang -> getTrans( 'T_ANGIELSKI' ) , 'textarea' );
$dbedit -> addPosition( 'ru' , $lang -> getTrans( 'T_ROSYJSKI' ) , 'textarea' );
$dbedit -> addPosition( 'de' , $lang -> getTrans( 'T_NIEMIECKI' ) , 'textarea' );
$dbedit -> addPosition( 'uk' , $lang -> getTrans( 'T_UKRAINSKI' ) , 'textarea' );
$out .= $dbedit -> draw();
return $out;
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace admin\view;
class UsersManager
{
public function show()
{
global $sys , $lang;
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_UZYTKOWNICY' ) );
$dbrowse = new \DataBrowse( 'pcms_user' , 'admin="0"' );
$dbrowse -> addPosition( 'login' , $lang -> getTrans( 'T_LOGIN' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'name' , $lang -> getTrans( 'T_IMIE' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'surname' , $lang -> getTrans( 'T_NAZWISKO' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , $sys -> deleteAction() );
$dbrowse -> setParam( 'id' );
$dbrowse -> addSort( 'id ASC' );
$dbrowse -> addLp();
$dbrowse -> addFiltr( 'login' , $lang -> getTrans( 'T_LOGIN' ) );
$dbrowse -> addFiltr( 'name' , $lang -> getTrans( 'T_IMIE' ) );
$dbrowse -> addFiltr( 'surname' , $lang -> getTrans( 'T_NAZWISKO' ) );
$dbrowse -> addFiltr( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , \System::getComboYesNo() );
$out .= $dbrowse -> draw();
return $out;
}
public function edit( $id = '' )
{
global $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_UZYTKOWNICY' ) );
$dbedit = new \DataEdit( 'pcms_user' , 'id' , $id );
$dbedit -> addPosition( 'login' , $lang -> getTrans( 'T_LOGIN' ) , 'text' );
$dbedit -> addPosition( 'name' , $lang -> getTrans( 'T_IMIE' ) , 'text' );
$dbedit -> addPosition( 'surname' , $lang -> getTrans( 'T_NAZWISKO' ) , 'text' );
$dbedit -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , 'radio' , '' , \System::getComboYesNo() );
$dbedit -> addPositionHidden( 'admin' , '0' );
$dbedit -> addPositionPassword();
$out .= $dbedit -> draw();
return $out;
}
}
?>

View File

@@ -0,0 +1,599 @@
<?php
/*
* 2011-09-27
* Obsługa include_php do dodawania kodu php w treści artykułu
*/
/*
* 2011-09-30
* Dodanie slidera w artykule poprzez {slider}ścieżka{/slider}
*/
namespace article;
class Article
{
private $_id;
private $_date_add;
private $_date_modify;
private $_print_enabled;
private $_show_date;
private $_show_title;
private $_title;
private $_text;
private $_meta_description;
private $_meta_keywords;
private $_display;
private $_show_author;
private $_author;
private $_keep_archive;
private $_seo_link;
private $_id_layout;
private $_images;
private $_files;
public function get_files() {
return $this->_files;
}
public function set_files($_files) {
$this->_files = $_files;
}
public function get_images() {
return $this->_images;
}
public function set_images($_images) {
$this->_images = $_images;
}
public function get_id_layout() {
return $this->_id_layout;
}
public function set_id_layout($_id_layout) {
$this->_id_layout = $_id_layout;
}
public function get_seo_link() {
return $this->_seo_link;
}
public function set_seo_link($_seo_link) {
$this->_seo_link = $_seo_link;
}
public function get_keep_archive() {
return $this->_keep_archive;
}
public function set_keep_archive($_keep_archive) {
$this->_keep_archive = $_keep_archive;
}
public function get_show_author()
{
return $this->_show_author;
}
public function set_show_author($_show_author)
{
$this->_show_author = $_show_author;
}
public function get_author()
{
return $this->_author;
}
public function set_author($_author)
{
$this->_author = $_author;
}
public function get_id()
{
return $this->_id;
}
public function set_id($_id)
{
$this->_id = $_id;
}
public function get_date_add()
{
return $this->_date_add;
}
public function set_date_add($_date_add)
{
$this->_date_add = $_date_add;
}
public function get_date_modify()
{
return $this->_date_modify;
}
public function set_date_modify($_date_modify)
{
$this->_date_modify = $_date_modify;
}
public function get_print_enabled()
{
return $this->_print_enabled;
}
public function set_print_enabled($_print_enabled)
{
$this->_print_enabled = $_print_enabled;
}
public function get_show_date()
{
return $this->_show_date;
}
public function set_show_date($_show_date)
{
$this->_show_date = $_show_date;
}
public function get_show_title()
{
return $this->_show_title;
}
public function set_show_title($_show_title)
{
$this->_show_title = $_show_title;
}
public function get_title()
{
return $this->_title;
}
public function set_title($_title)
{
$this->_title = $_title;
}
public function get_text()
{
return $this->_text;
}
public function set_text($_text)
{
$this->_text = $_text;
}
public function get_meta_description()
{
return $this->_meta_description;
}
public function set_meta_description($_meta_description)
{
$this->_meta_description = $_meta_description;
}
public function get_meta_keywords()
{
return $this->_meta_keywords;
}
public function set_meta_keywords($_meta_keywords)
{
$this->_meta_keywords = $_meta_keywords;
}
public function get_display()
{
return $this->_display;
}
public function set_display($_display)
{
$this->_display = $_display;
}
public function getImg()
{
$src = '';
$regex_img = "|<[\s\v]*img[\s\v]([^>]*[^>]*)>|Ui";
preg_match_all($regex_img, $this -> _text,$matches_img);
$count_img = count($matches_img[0]);
if ( $count_img )
{
if ( @$matches_img[1][0] )
{
$inline_params = $matches_img[1][0];
$asrc = array();
preg_match( "#src=\"(.*?)\"#s", $inline_params, $asrc );
if ( isset($asrc[1]) )
$src = trim($asrc[1]);
else
$src = "";
$syn = substr($src,0,1);
if ( $syn === "/" or $syn === "\\" )
$src = substr($src,1,99999);
$syn = substr($src,0,3);
if ( $syn == "../" )
$src = substr($src,3,99999);
$syn = substr($src,0,7);
if ( $syn == "example" )
$src = substr($src,8,99999);
}
}
else
{
$image = false;
if ( strpos($this -> _text,"{galeria}") !== false )
{
$text = explode("{galeria}",$this -> _text);
for ( $i=1; $i<count($text); $i++ )
{
$temp = explode("{/galeria}",$text[$i]);
$path = $temp[0];
if ( $path != "" && is_dir( $path ) )
{
@$fh = opendir($path);
while ( false !== ( $filename = @readdir($fh) ) && !$image )
{
if ( $filename == "." || $filename == ".." ) continue;
if ( file_exists($path.$filename) )
{
$src = $path.$filename;
$image = true;
}
}
}
}
}
}
return $src;
}
public function getModifyText( $entry = false ) {
if ( $entry )
$this -> removeImages();
if ( !$entry ) {
$this -> drawGallery();
$this -> drawShadowBox();
}
$this -> includePHP( $entry );
$this -> drawSlider( $entry );
$this -> getMap();
return $this -> _text;
}
public function getMap()
{
$out = '';
if ( strpos($this->_text,"{mapa}") !== false )
{
$text = explode("{mapa}",$this->_text);
$before = $text[0];
for ( $i=1; $i<count($text); $i++ )
{
$temp = explode("{/mapa}",$text[$i]);
$settings_temp = $temp[0];
$settings = explode("|",$settings_temp);
for ( $j=0; $j<count($settings); $j++ )
{
$params = explode(":",$settings[$j]);
if ( trim($params[0]) == "adres" )
$adress = $params[1];
else if ( trim($params[0]) == "szerokosc" )
$width = $params[1];
else if ( trim($params[0]) == "wysokosc" )
$height = $params[1];
else if ( trim($params[0]) == "x_coord" )
$x_coord = \System::saveString($params[1]);
else if ( trim($params[0]) == "y_coord" )
$y_coord = \System::saveString($params[1]);
else if ( trim($params[0]) == "zoom" )
$zoom = (int)$params[1];
}
$id = rand(0,10000000000000);
if ( !isset( $zoom ) || !$zoom )
$zoom = 13;
if ( $adress != "" && $adress != " " )
{
if ( $width == "" )
$width = 400;
if ( $height == "" )
$height = 250;
$tpl = new \Savant3;
$tpl -> _google_map_key = \System::getSystemSettings( 'google_map_key' );
$tpl -> _adress = trim( strip_tags( $adress ) );
$tpl -> _zoom = (int)$zoom;
$tpl -> _width = (int)$width;
$tpl -> _height = (int)$height;
$tpl -> _id = $id;
$out .= $tpl -> fetch( 'templates/article-map.php' );
}
else if ( $x_coord && $y_coord )
{
$tpl = new \Savant3;
$tpl -> _google_map_key = \System::getSystemSettings( 'google_map_key' );
$tpl -> _x_coord = $x_coord;
$tpl -> _y_coord = $y_coord;
$tpl -> _zoom = (int)$zoom;
$tpl -> _width = (int)$width;
$tpl -> _height = (int)$height;
$tpl -> _id = $id;
$out .= $tpl -> fetch( 'templates/article-map.php' );
}
$out .= $temp[1];
}
$this -> _text = $before . $out;
}
}
public function drawSlider( $entry ) {
$out = '';
if ( strpos( $this -> _text , '{slider}' ) !== false ) {
$text = explode( '{slider}' , $this -> _text );
$before = $text[0];
for ( $i = 1; $i < count( $text ); $i++ ) {
$temp = explode( '{/slider}' , $text[$i] );
$path = $temp[0];
if ( $path && !$entry && is_dir( $path ) ) {
$fh = @opendir($path);
while ( false !== ( $filename = @readdir($fh) ) ) {
if ( $filename == "." || $filename == ".." ) continue;
if ( file_exists($path.$filename) ) {
$nazwa = pathinfo( $path . $filename );
$pliki[$nazwa['basename']] = $nazwa['extension'];
}
}
if ( is_array( $pliki ) ) ksort($pliki);
if ( is_array( $pliki ) ) foreach ( $pliki as $key => $val ) {
$img['src'] = $path . $key;
$images[] = $img;
}
$out .= \article\VArticle::drawSlider( $this -> _id , $images );
}
$out .= $temp[1];
}
$this -> _text = $before . $out;
}
}
public function includePHP( $entry ) {
$out = '';
if ( strpos( $this -> _text , '{include_php}' ) !== false ) {
$text = explode( '{include_php}' , $this -> _text );
$before = $text[0];
for ( $i = 1; $i < count( $text ); $i++ ) {
$temp = explode( '{/include_php}' , $text[$i] );
$path = $temp[0];
if ( $path && !$entry ) {
if ( file_exists( $path ) ) {
ob_start();
include( $path );
$out .= ob_get_contents();
ob_end_clean();
}
}
$out .= $temp[1];
}
$this -> _text = $before . $out;
}
}
public function drawGallery() {
$out = '';
if ( strpos( $this -> _text , '{galeria}' ) !== false ) {
$text = explode( '{galeria}' , $this -> _text );
$before = $text[0];
for ( $i = 1; $i < count( $text ); $i++ ) {
if ( trim( strip_tags( $text[$i] ) ) != '' ) {
$images = '';
$temp = explode( '{/galeria}' , $text[$i] );
$path = strip_tags( $temp[0] );
if ( isset( $path ) && is_dir( $path ) && $path != '' ) {
$fh = @opendir($path);
while ( false !== ( $filename = @readdir($fh) ) ) {
if ( $filename == "." || $filename == ".." ) continue;
if ( file_exists($path.$filename) ) {
$nazwa = pathinfo( $path . $filename );
$pliki[$nazwa['basename']] = $nazwa['extension'];
}
}
}
if ( isset( $pliki ) && is_array( $pliki ) )
ksort($pliki);
if ( isset( $pliki ) && is_array( $pliki ) ) foreach ( $pliki as $key => $val ) {
$img['src'] = $path . $key;
$images[] = $img;
}
$out .= \article\VArticle::drawGallery( $this -> _id , $images );
if ( isset( $temp[1] ) )
$out .= $temp[1];
}
}
$this -> _text = $before . $out;
}
}
public function removeImages()
{
$out = '';
$regex_img = "|<[\s\v]*img[\s\v]([^>]*[^>]*)>|Ui";
preg_match_all( $regex_img, $this -> _text, $matches_img);
$count_img = count( $matches_img[0] );
if ( $count_img )
{
for ( $i = 0; $i < $count_img; $i++ )
{
if ( @$matches_img[1][$i] )
{
$this -> _text = str_replace( $matches_img[0][$i] , '' , $this -> _text );
}
}
}
if ( strpos( $this -> _text , '{galeria}' ) !== false )
{
$text = explode( '{galeria}' , $this -> _text );
$before = $text[0];
for ( $i = 1; $i < count( $text ); $i++ )
{
$temp = explode( '{/galeria}' , $text[$i] );
$out .= $temp[1];
}
$this -> _text = $before . $out;
}
}
public function drawShadowBox()
{
$regex_img = "|<[\s\v]*img[\s\v]([^>]*[^>]*)>|Ui";
preg_match_all( $regex_img, $this -> _text, $matches_img);
$count_img = count( $matches_img[0] );
if ( $count_img )
{
for ( $i=0; $i < $count_img; $i++ )
{
if (@$matches_img[1][$i])
{
$inline_params = $matches_img[1][$i];
$aclass = array();
preg_match( "#class=\"(.*?)\"#s", $inline_params, $aclass );
if ( isset($aclass[1]) )
$individ_class = trim($aclass[1]);
else
$individ_class="";
$awidth = array();
preg_match( "#width:(.*?);#s", $inline_params, $awidth );
if ( isset($awidth[1]) )
$individ_width = trim($awidth[1]);
else
$individ_width="";
$aheight = array();
preg_match( "#height:(.*?);#s", $inline_params, $aheight );
if ( isset($aheight[1]) )
$individ_height = trim($aheight[1]);
else
$individ_height="";
$aborder = array();
preg_match( "#border:(.*?);#s", $inline_params, $aborder );
if ( isset($aborder[0]) )
$individ_border = trim($aborder[0]);
else
$individ_border ="";
$amagin = array();
preg_match( "#margin:(.*?);#s", $inline_params, $amagin );
if ( isset($amagin[0]) )
$individ_margin = trim($amagin[0]);
else
$individ_margin ="";
$amaginl = array();
preg_match( "#margin-left:(.*?);#s", $inline_params, $amaginl );
if ( isset($amaginl[0]) )
$individ_marginl = trim($amaginl[0]);
else
$individ_marginl ="";
$amaginr = array();
preg_match( "#margin-right:(.*?);#s", $inline_params, $amaginr );
if ( isset($amaginr[0]) )
$individ_marginr = trim($amaginr[0]);
else
$individ_marginr ="";
$amagint = array();
preg_match( "#margin-top:(.*?);#s", $inline_params, $amagint );
if ( isset($amagint[0]) )
$individ_margint = trim($amagint[0]);
else
$individ_margint ="";
$amaginb = array();
preg_match( "#margin-bottom:(.*?);#s", $inline_params, $amaginb );
if ( isset($amaginb[0]) )
$individ_marginb = trim($amaginb[0]);
else
$individ_marginb ="";
$afloat = array();
preg_match( "#float:(.*?);#s", $inline_params, $afloat );
if ( isset($afloat[0]) )
$individ_afloat = trim($afloat[0]);
else
$individ_afloat ="";
$asrc = array();
preg_match( "#src=\"(.*?)\"#s", $inline_params, $asrc );
if ( isset($asrc[1]) )
$src = trim($asrc[1]);
else
$src = "";
$syn = substr($src,0,1);
if ( $syn === "/" or $syn === "\\" )
$src = substr($src,1,99999);
$syn = substr($src,0,3);
if ( $syn == "../" )
$src = substr($src,3,99999);
$syn = substr($src,0,7);
if ( $syn == "example" )
$src = substr($src,8,99999);
if ( file_exists($src) )
{
$check = GetImageSize($src);
$width = $check[0];
$height = $check[1];
if ( ( $width > 400 || $height > 300 ) && ( $width != (int)$individ_width || $height != (int)$individ_height ) && $individ_class != 'noshadow' )
{
$out = "<a href='" . $src . "' class='fancybox-buttons' rel='" . $this -> _id . "'>";
$out .= "<img class='" . $individ_class . "' src='" . $src . "'
style='
width:" . $individ_width . ";
height:" . $individ_height . ";
" . $individ_border . "
" . $individ_margin . "
" . $individ_marginr . "
" . $individ_marginl . "
" . $individ_margint . "
" . $individ_marginb . "
" . $individ_afloat . "'>";
$out .= "</a>";
$this -> _text = str_replace( $matches_img[0][$i], $out , $this -> _text );
}
}
}
}
}
}
public function drawPrint()
{
$out = $this -> _title.", ".date( "d/m/Y H:i" , strtotime( $this -> _date_modify ) );
$out .= $this -> getModifyText( false );
return $out;
}
}
?>

View File

@@ -0,0 +1,288 @@
<?php
namespace article;
class FArticle {
public function getArticleLayoutId( $id )
{
global $db, $config, $cache;
$key = 'getArticleLayoutId:' . $id;
if ( !$layout = $cache -> fetch( $key ) )
{
$query = $db -> prepare( 'SELECT id_layout FROM pcms_article WHERE id = :id' );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$layout = $row[0];
$query -> closeCursor();
$cache -> store( $key, $layout, $config['cache_expire_long'] );
}
if ( !$layout )
{
$query = $db -> prepare( 'SELECT id FROM pcms_layout WHERE enabled = :enabled' );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$layout = $row[0];
$query -> closeCursor();
$cache -> store( $key, $layout, $config['cache_expire_long'] );
}
return $layout;
}
public function searchArtileByTextCount( $text )
{
global $db;
$text = \System::saveString( $text , true );
$query = $db -> query( 'SELECT COUNT(DISTINCT(article_id)) FROM pcms_article_translation WHERE ( LOWER( title ) LIKE "%' . \System::saveString( $text ) . '%" OR LOWER( text ) LIKE "%' . \System::saveString( $text ) . '%" ) AND article_id IN ( SELECT id FROM pcms_article WHERE enabled = "1" AND archive = "0" ) GROUP BY article_id' );
return $query -> rowCount();
}
public function searchArtileByText( $text , $from , $limit )
{
global $db;
$query = $db -> query( 'SELECT article_id FROM pcms_article_translation WHERE ( LOWER( title ) LIKE "%' . \System::saveString( $text ) . '%" OR LOWER( text ) LIKE "%' . \System::saveString( $text ) . '%" ) AND article_id IN ( SELECT id FROM pcms_article WHERE enabled = "1" AND archive = "0" ) GROUP BY article_id ORDER BY version DESC LIMIT ' . $from . ',' . $limit );
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$art = \article\FArticle::loadArticle( $row['article_id'] );
$articles[] = $art;
}
return $articles;
}
public function getDescription( $id )
{
global $db , $config , $cache , $sys;
$current_lang = $sys -> getSessionVar( 'current_lang' );
$sKey = 'getDescription:' . $id . ':' . $current_lang;
if ( !$sDescription = $cache -> fetch( $sKey ) )
{
$query = $db -> prepare( 'SELECT meta_description FROM pcms_article_translation WHERE article_id = :article_id AND lang_id = :lang_id' );
$query -> bindValue( ':article_id' , $id , \PDO::PARAM_INT );
$query -> bindValue( ':lang_id' , $current_lang , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$sDescription = $row['meta_description'];
$query -> closeCursor();
$cache -> store( $sKey , $sDescription , $config['cache_expire_long'] );
}
return $sDescription;
}
public function getArticleTitle( $id )
{
global $db , $config , $cache , $sys;
$current_lang = $sys -> getSessionVar( 'current_lang' );
$sKey = 'getArticleTitle:' . $id . ':' . $current_lang;
if ( !$sTitle = $cache -> fetch( $sKey ) )
{
$query = $db -> prepare( 'SELECT title FROM pcms_article_translation WHERE article_id = :article_id AND lang_id = :lang_id' );
$query -> bindValue( ':article_id' , $id , \PDO::PARAM_INT );
$query -> bindValue( ':lang_id' , $current_lang , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$sTitle = $row['title'];
$query -> closeCursor();
$cache -> store( $sKey , $sTitle , $config['cache_expire_long'] );
}
return $sTitle;
}
public function getKeywords( $id )
{
global $db , $config , $cache , $sys;
$current_lang = $sys -> getSessionVar( 'current_lang' );
$sKey = 'getKeywords:' . $id . ':' . $current_lang;
if ( !$sKeywords = $cache -> fetch( $sKey ) )
{
$query = $db -> prepare( 'SELECT meta_keywords FROM pcms_article_translation WHERE article_id = :article_id AND lang_id = :lang_id' );
$query -> bindValue( ':article_id' , $id , \PDO::PARAM_INT );
$query -> bindValue( ':lang_id' , $current_lang , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$sKeywords = $row['meta_keywords'];
$query -> closeCursor();
$cache -> store( $sKey , $sKeywords , $config['cache_expire_long'] );
}
return $sKeywords;
}
public function loadArticleVersion( $version_id )
{
global $db;
$query = $db -> prepare( 'SELECT article_id FROM pcms_article_translation WHERE id = :id' );
$query -> bindValue( ':id', $version_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$article_id = $row[0];
$query -> closeCursor();
$article = new \article\Article;
$query = $db -> prepare( 'SELECT * FROM pcms_article WHERE id = :id' );
$query -> bindValue( ':id', $article_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$article -> set_id( $article_id );
$article -> set_date_add( $row['date_add'] );
$article -> set_date_modify( $row['date_modify'] );
$article -> set_print_enabled( $row['print'] );
$article -> set_show_date( $row['show_date'] );
$article -> set_show_title( $row['show_title'] );
$article -> set_show_author( $row['show_author'] );
$article -> set_author( $row['author'] );
$article -> set_keep_archive( $row['keep_archive'] );
$data = array(
'table' => 'pcms_article_translation',
'fields' => '',
'condition' => '',
'order' => '',
'limit' => 1
);
$query2 = $db -> prepare( 'SELECT title, text, meta_description, meta_keywords FROM pcms_article_translation WHERE id = :id AND lang_id = "pl" ORDER BY version DESC LIMIT 1' );
$query2 -> bindValue( ':id', $version_id, \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
{
$article -> set_title( $row2['title'] );
$article -> set_text( $row2['text'] );
$article -> set_meta_description( $row2['meta_description'] );
$article -> set_meta_keywords( $row2['meta_keywords'] );
}
$query2 -> closeCursor();
}
$query -> closeCursor();
return $article;
}
public function loadArticle( $id )
{
global $db;
$current_lang = \System::getSessionVar( 'current_lang' );
$article = new \article\Article;
$query = $db -> prepare( 'SELECT * FROM pcms_article WHERE id = :id' );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$article -> set_id( $id );
$article -> set_date_add( $row['date_add'] );
$article -> set_date_modify( $row['date_modify'] );
$article -> set_print_enabled( $row['print'] );
$article -> set_show_date( $row['show_date'] );
$article -> set_show_title( $row['show_title'] );
$article -> set_show_author( $row['show_author'] );
$article -> set_author( $row['author'] );
$article -> set_keep_archive( $row['keep_archive'] );
$article -> set_id_layout( $row['id_layout'] );
$query2 = $db -> prepare( 'SELECT * FROM pcms_article_translation WHERE article_id = :article_id AND lang_id = :lang_id' );
$query2 -> bindValue( ':article_id', $id, \PDO::PARAM_INT );
$query2 -> bindValue( ':lang_id', $current_lang, \PDO::PARAM_STR );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
{
$article -> set_title( $row2['title'] );
$article -> set_text( $row2['text'] );
$article -> set_meta_description( $row2['meta_description'] );
$article -> set_meta_keywords( $row2['meta_keywords'] );
$article -> set_seo_link( $row2['seo_link'] );
}
$query2 -> closeCursor();
$query2 = $db -> prepare( 'SELECT * FROM pcms_article_images WHERE id_article = :id_article' );
$query2 -> bindValue( ':id_article', $id, \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
$images[] = $row2;
$query2 -> closeCursor();
$article -> set_images( $images );
$query2 = $db -> prepare( 'SELECT * FROM pcms_article_files WHERE id_article = :id_article' );
$query2 -> bindValue( ':id_article', $id, \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
$files[] = $row2;
$query2 -> closeCursor();
$article -> set_files( $files );
}
return $article;
}
public function getArticles( $from )
{
global $site , $db;
if ( $site -> get_sort_type() == 1 )
$order_by = "date_add DESC ";
else if ( $site -> get_sort_type() == 2 )
$order_by = "date_modify DESC";
else if ( $site -> get_sort_type() == 3 )
$order_by = 'o ASC';
$sql = 'SELECT
article_id
FROM
pcms_article_page as pap, pcms_article as pa
WHERE
page_id = :page_id AND article_id = pa.id AND pa.enabled = "1" AND archive = "0"
GROUP BY
article_id
ORDER BY
' . $order_by . '
LIMIT
' . $from . ',' . $site -> get_article_number();
$query = $db -> prepare( $sql );
$query -> bindValue( ':page_id' , $site -> get_id() , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$art = \article\FArticle::loadArticle( $row['article_id'] );
$articles[] = $art;
}
return $articles;
}
public function getCountArticles()
{
global $site, $db, $cache, $config;
$key = 'getCountArticles:' . $site -> get_id();
if ( !$articles = $cache -> fetch( $key ) )
{
$query = $db -> prepare( 'SELECT COUNT( 0 ) FROM pcms_article_page as pap , pcms_article as pa WHERE page_id = :page_id AND article_id = pa.id AND pa.enabled = "1" AND archive = "0"' );
$query -> bindValue( ':page_id', $site -> get_id(), \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$articles = $row[0];
$query -> closeCursor();
$cache -> store( $key, $articles, $config['cxl'] );
}
return $articles;
}
}
?>

View File

@@ -0,0 +1,46 @@
<?php
/*
* 2011-09-30
* Funkcja drawSlider() - rysująca slider zdjęć w artykule
*/
namespace article;
class VArticle
{
public function drawSlider( $article_id , $images ) {
$tpl = new \Savant3;
$tpl -> _article_id = $article_id;
$tpl -> _images = $images;
return $tpl -> fetch( 'templates/article-slider.php' );
}
public function draw( $id )
{
$article = \article\FArticle::loadArticle( $id );
$tpl = new \Savant3;
$tpl -> _article = $article;
$tpl -> _id = $article -> get_id();
$tpl -> _print = $article -> get_print_enabled();
$tpl -> _show_title = $article -> get_show_title();
$tpl -> _title = $article -> get_title();
$tpl -> _show_date = $article -> get_show_date();
$tpl -> _date_add = $article -> get_date_add();
$tpl -> _date_modify = $article -> get_date_modify();
$tpl -> _text = $article -> getModifyText();
$tpl -> _show_author = $article -> get_show_author();
$tpl -> _author = $article -> get_author();
$tpl -> _seo_link = $article -> get_seo_link();
$tpl -> _images = $article -> get_images();
$tpl -> _files = $article -> get_files();
return $tpl -> fetch( 'templates/article-draw.php' );
}
public function drawGallery( $id , $images ) {
$tpl = new \Savant3;
$tpl -> _id = $id;
$tpl -> _images = $images;
return $tpl -> fetch( 'templates/article-gallery.php' );
}
}
?>

294
autoload/class.DataBase.php Normal file
View File

@@ -0,0 +1,294 @@
<?php
class DataBase
{
public function SaveData( $db_edit_table , $db_edit_key , $db_edit_val , $db_edit_pols , $db_edit_pass , $db_edit_pols_t )
{
global $sys , $lang , $db;
$sql = '';
if ( is_array( $db_edit_pols ) ) foreach ( $db_edit_pols as $val )
{
if ( $sql && $val != 'image' )
$sql .= ',';
if ( $val != 'image' )
$sql .= $val . "='" . addslashes( $sys -> saveString( $sys -> formGet( $val ) ) ) . "'";
}
if ( $db_edit_pass )
{
$name = $db_edit_pass['nazwa1'];
$pass1 = $sys -> saveString( $sys -> formGet( $name ) );
$pass2 = $sys -> saveString( $sys -> formGet( $name . '_repeat' ) );
if ( $pass1 != $pass2 )
$sys -> setAlert( $lang -> getTrans( 'T_HASLA_ROZNE' ) );
else
{
if ( strlen($pass1) >= 5 )
{
if ( $sql )
$sql .= ',';
$sql .= $name . "='" . md5($pass1) . "'";
}
else
{
if ( strlen( $pass1 ) < 5 )
$sys -> setAlert( $lang -> getTrans( 'T_HASLA_ZA_KROTKIE' ) );
}
}
}
if ( $db_edit_table && $db_edit_key && $db_edit_val && $db_edit_pols )
{
$db_edit_table = $sys -> saveString( $db_edit_table );
$db_edit_key = $sys -> saveString( $db_edit_key );
$db_edit_val = $sys -> saveString( $db_edit_val );
$query = $db -> query( "UPDATE " . $db_edit_table . " SET " . $sql . " WHERE " . $db_edit_key . "='" . $db_edit_val . "'" );
for ( $i = 0; $i < count( $db_edit_pols_t ); $i++ )
{
if ( $db_edit_pols_t[$i] == 'file' && is_array( $_FILES[$db_edit_pols[$i]] ) )
{
$file = $_FILES[$db_edit_pols[$i]];
if ( $file['name'] )
$name = explode( '.' , $file['name'] );
if ( isset( $name ) && is_array( $name ) )
$patch = '../' . $sys -> formGet( 'image_folder' ) . $sys -> seo( $name[0]) . '.' . $name[1];
if ( $file['type'] == 'image/pjpeg' || $file['type'] == 'image/jpg' || $file['type'] == 'image/jpeg' || $file['type'] == 'image/gif' || $file['type'] == 'image/png' )
{
if ( $file['size'] < 500000 )
{
$x = getimagesize( $file['tmp_name'] );
if ( is_array( $x ) or $x[0] < 2)
{
$query = $db -> prepare( "SELECT " . $db_edit_pols[$i] . " FROM " . $db_edit_table . " WHERE " . $db_edit_key . "='" . $db_edit_val . "'" );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$plik = '../' . $row[0];
if ( file_exists( $plik ) && $row[0] )
unlink( $plik );
}
$query -> closeCursor();
if ( file_exists( $patch ) )
unlink( $patch );
rename( $file['tmp_name'] , $patch );
chmod( $patch , 0755 );
$patch = str_replace( '../' , '' , $patch );
$query = $db -> query( "UPDATE " . $db_edit_table . " SET " . $db_edit_pols[$i] ."='" . $patch . "' WHERE " . $db_edit_key . "='" . $db_edit_val . "'" );
}
}
}
}
}
$sys -> setAlert( $lang -> getTrans( 'T_ZAKTUALIZOWANO_ELEMENT' ) );
}
$saveFlag = true;
$sys -> deleteCacheAdmin();
$sys -> deleteCache();
}
public function addData( $db_edit_table , $db_edit_pols , $db_edit_pols_hidden , $db_edit_pols_t , $time , $db_edit_pass = '' )
{
global $lang , $db;
$flag = true;
$idk = '';
$key = '';
$val = '';
$value = '';
if ( $time == \System::getSessionVar( 'dbedit_add_time' ) ) return false;
if ( is_array( $db_edit_pols ) ) foreach ( $db_edit_pols as $val )
{
if ( !$idk )
$idk = $val;
if ( $key )
$key .= ',';
if ( $value )
$value .= ',';
$key .= $val;
$value .= "'" . \System::saveString( \System::formGet( $val ) ) . "'";
}
if ( is_array( $db_edit_pols_hidden ) ) foreach ( $db_edit_pols_hidden as $val )
{
if ( $key )
$key .= ',';
if ( $value )
$value .= ',';
$key .= $val;
$value .= "'" . \System::saveString( \System::formGet( $val ) ) . "'";
}
if ( $db_edit_pass )
{
$name = $db_edit_pass['nazwa1'];
$pass1 = \System::saveString( \System::formGet( $name ) );
$pass2 = \System::saveString( \System::formGet( $name . '_repeat' ) );
if ( $pass1 != $pass2 )
{
\System::setAlert( $lang -> getTrans( 'T_HASLA_ROZNE' ) );
$flag = false;
}
else
{
if ( strlen($pass1) >= 5 )
{
if ( $key )
$key .= ',';
$key .= $name;
if ( $value )
$value .= ',';
$value .= "'" . md5( $pass1 ) . "'";
}
else
{
if ( $pass1 )
{
$flag = false;
\System::setAlert( $lang -> getTrans( 'T_HASLA_ZA_KROTKIE' ) );
}
}
}
}
if ( $db_edit_table && $db_edit_pols && $flag )
{
$check = true;
$db_edit_table = \System::saveString( $db_edit_table );
try
{
$query = $db -> prepare( "INSERT INTO " . $db_edit_table . " (" . $key . ") VALUES (" . $value . ")");
$query -> execute();
}
catch(PDOException $e)
{
$check = false;
}
$id = $db -> lastInsertId();
$query -> closeCursor();
for ( $i = 0; $i < count( $db_edit_pols_t ); $i++ )
{
if ( $db_edit_pols_t[$i] == 'file' && is_array($_FILES[$db_edit_pols[$i]]) )
{
$file = $_FILES[$db_edit_pols[$i]];
$name = explode( '.' , $file['name'] );
$patch = '../' . \System::formGet( 'image_folder' ) . md5( mktime() ) . '.' . strtolower( $name[count( $name ) - 1] );
if ( $file['type'] == 'image/pjpeg' || $file['type'] == 'image/jpg' || $file['type'] == 'image/jpeg' || $file['type'] == 'image/gif' || $file['type'] == 'image/png' )
{
if ( $file['size'] < 500000 )
{
if ( !is_dir( '../' . \System::formGet( 'image_folder' ) ) ) mkdir( '../' . \System::formGet( 'image_folder' ), 0775, true);
$x = getimagesize( $file['tmp_name'] );
if ( is_array( $x ) or $x[0] < 2)
{
if ( file_exists( $patch ) )
unlink( $patch );
@rename( $file['tmp_name'] , $patch );
chmod( $patch , 0755 );
$patch = str_replace( '../' , '' , $patch );
$query = $db -> prepare( "UPDATE " . $db_edit_table . " SET " . $db_edit_pols[$i] . "='" . $patch . "' WHERE id='" . $id . "'" );
$query -> execute();
$query -> closeCursor();
}
}
}
}
}
if ( $check )
\System::setAlert( $lang -> getTrans( 'T_DODANO_NOWY_ELEMENT' ) );
else
\System::setAlert( $lang -> getTrans( 'T_NIEPRAWIDLOWE_DANE' ) );
$addFlag = true;
}
else
\System::setAlert( $lang -> getTrans( 'T_NIEPRAWIDLOWE_DANE' ) );
\System::setSessionVar( 'dbedit_add_time' , $time );
\System::deleteCacheAdmin();
\System::deleteCache();
}
public function updateSWL()
{
$db_t = \opdClass::create(
array(
'dsn' => 'mysql:host=22275.m.tld.pl;dbname=baza75_preselpro',
'user' => 'admin75_preselpro',
'password' => 'Legia1916',
'cache' => 'Temp/' ,
'debugConsole' => false
)
);
$db_t -> query('SET NAMES utf8');
$data = base64_decode( file_get_contents( 'files/links.php' ) );
$data = @unserialize( $data );
$delete = false;
$query = $db_t -> prepare( 'SELECT
pad.id
FROM
pro_articles_downloads AS pad, pro_articles AS pa, pro_articles_groups AS pag
WHERE
pa.group_id = pag.id AND pad.article_id = pa.id
AND
( ( swl_only_nonindexed = 1 AND indexed = 1 ) OR deleted = 1 )
AND
swl_link_count > 0' );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$query2 = $db_t -> prepare( 'SELECT * FROM pro_articles_downloads_swl WHERE article_download_id = :article_download_id' );
$query2 -> bindValue( ':article_download_id', $row['id'], \PDO::PARAM_INT );
$query2 -> execute();
if ( $query2 -> rowCount() ) while ( $row2 = $query2 -> fetch() )
{
if ( is_array( $data ) ) foreach ( $data as $key => $val )
{
if ( $key == $row2['link'] )
{
$query3 = $db_t -> prepare( 'DELETE FROM pro_articles_downloads_swl WHERE article_download_id = :article_download_id AND link = :link' );
$query3 -> bindValue( ':article_download_id', $row['id'], \PDO::PARAM_INT );
$query3 -> bindValue( ':link', $row2['link'], \PDO::PARAM_STR );
$query3 -> execute();
$query3 -> closeCursor();
$query3 = $db_t -> prepare( 'UPDATE pro_articles_downloads SET swl_link_count = swl_link_count - 1 WHERE id = :id' );
$query3 -> bindValue( ':id', $row['id'], \PDO::PARAM_INT );
$query3 -> execute();
$query3 -> closeCursor(); print_r( $query3 -> errorInfo() );
unset( $data[ $row2['link']] );
$delete = true;
}
}
}
$query2 -> closeCursor();
}
$query -> closeCursor();
if ( $delete )
{
$data = base64_encode( serialize( $data ) );
$h = fopen( 'files/links.php' , 'w' );
if ( fwrite( $h , $data ) === false )
throw new \Exception( 'Could not write to cache' );
fclose( $h );
}
return false;
}
}
?>

View File

@@ -0,0 +1,494 @@
<?php
class DataBrowse {
private $_table;
private $_filtr;
private $_field_id;
private $_field_name;
private $_field_link;
private $_field_style;
private $_quantity;
private $_select;
private $_field_simple_id;
private $_param;
private $_field_action;
private $_field_tran;
private $_row_number;
private $_count;
private $_page_number;
private $_sort;
private $_filtr_id;
private $_filtr_name;
private $_filtr_field_tran;
private $_filtr_quantity;
private $_db_filtr;
private $_db_filtr_value;
private $_is_lp;
private $_lp;
private $_group_by;
private $_filtr_type;
private $_debug;
private $_limit = 25;
private $_filed_sort;
private $_sort_name;
private $_sort_way;
private $_paging_adress = 'index.php';
private $_checkbox = false;
function DataBrowse( $table , $filtr = '' , $debug = false )
{
$this -> _table = $table;
$this -> _filtr = $filtr;
$this -> _quantity = 0;
$this -> _filtr_quantity = 0;
$this -> _debug = $debug;
}
public function addCheckbox()
{
$this -> _checkbox = true;
}
function addGroupBy( $value )
{
$this -> _group_by = $value;
}
function addLp()
{
$this -> _is_lp = true;
$this -> _lp = true;
}
function setLimit( $val )
{
$this -> _limit = $val;
}
function addFiltr( $id , $nazwa , $tab = '' , $sql = '' )
{
global $db;
if ( $nazwa )
{
$this -> _filtr_id[ $this -> _filtr_quantity ] = $id;
$this -> _filtr_name[ $this -> _filtr_quantity ] = $nazwa;
if ( $sql )
{
$query = $db -> prepare( $sql );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$tab[ $row[0] ] = $row[1];
$query -> closeCursor();
}
if ( is_array($tab) )
$this -> _filtr_field_tran[$this -> _filtr_quantity] = $tab;
else
{
if ( !$tab )
$tab = 'text';
$this -> _filtr_type[ $this -> _filtr_quantity ] = $tab;
}
$this -> _filtr_quantity++;
}
}
function addPosition( $id , $nazwa , $link = '' , $tab = '' , $style = '' , $sort = false )
{
global $db;
if ( $nazwa )
{
$this -> _field_id[ $this -> _quantity ] = $id;
$this -> _field_name[ $this -> _quantity ] = $nazwa;
$this -> _field_link[ $id ] = $link;
$this -> _field_style[ $id ] = $style;
$this -> _filed_sort[ $this -> _quantity ] = $sort;
if ( is_array( $tab ) )
$this -> _field_tran[$id] = $tab;
else
{
if ( $tab )
{
$query = $db -> prepare($tab);
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$tabs[$res[0]] = $res[1];
$query -> closeCursor();
$tabs[0] = '';
$this -> _field_tran[$id] = $tabs;
}
}
$this -> _quantity ++;
}
}
function addPositionSimple( $id , $nazwa , $link = '' , $akcja = '' , $style = '' )
{
$this -> _field_simple_id[$this -> _quantity] = $id;
$this -> _field_name[$this -> _quantity] = $nazwa;
$this -> _field_link[$id] = $link;
$this -> _field_action[$id] = $akcja;
$this -> _field_style[$id] = $style;
$this -> _quantity++;
}
function setParam( $param )
{
$this -> _param = $param;
}
function addSort( $sort )
{
$this -> _sort = $sort;
}
function draw()
{
global $sys , $db , $bs , $lang;
$out = '';
$filtr_ttext = '';
$filtr_combo = '';
$table_values = '';
$filtr_text = '';
if ( $sys -> formGet( 'bs' ) ) {
$sys -> setSessionVar( $this -> _table . '_bs' , $sys -> formGet('bs' ) );
}
$bs = $sys -> getSessionVar( $this -> _table . '_bs' );
$page_type = $sys -> getSessionVar( 'page_type' );
$sort = $sys->formGet( 's' );
if ( $sort )
{
if ( $sys -> getSessionVar( $this -> _table . '_sort' . $sort ) == 'DESC' )
{
$this -> _sort = $sort . ' ASC';
$this -> _sort_name = $sort;
$this -> _sort_way = 'ASC';
$sys->setSessionVar( $this -> _table . '_sort' . $sort , 'ASC' );
}
else
{
$this -> _sort = $sort . ' DESC';
$this -> _sort_name = $sort;
$this -> _sort_way = 'DESC';
$sys->setSessionVar( $this -> _table . '_sort' . $sort , 'DESC' );
}
}
if ( $sys->formGetInt( 'r' ) )
$sys->setSessionVar( $this -> _table . '_limit' , $sys->formGetInt( 'r' ) );
$limit = $sys->getSessionVar( $this -> _table . '_limit' );
if ( !$limit )
$limit = $this -> _limit;
switch ( $limit )
{
case 5:
$this -> _limit = 5;
break;
case 10:
$this -> _limit = 10;
break;
case 25:
$this -> _limit = 25;
break;
case 50:
$this -> _limit = 50;
break;
case 100:
$this -> _limit = 100;
break;
default:
$this -> _limit = 25;
break;
}
if ( $sys -> formGet( 'set_db_filtr' ) == 'yes' )
{
if ( is_array( $_POST ) ) foreach ( $_POST as $key => $val )
{
if ( $key != 'set_db_filtr' && $val != '' && $key != 'rows' )
{
$this -> _db_filtr_value[$key] = $val;
$pos_title = array_search( $this -> _db_filtr_value[ $key ] , $this -> _db_filtr_value );
$position = array_search( $pos_title , $this -> _filtr_id );
if ( $this -> _db_filtr && strpos( $key , '{trans}_trans' ) === false )
$this -> _db_filtr .= ' AND ';
if ( isset( $this -> _filtr_type[ $position ] ) && $this -> _filtr_type[ $position ] == 'text' )
$this -> _db_filtr .= " $key LIKE '%$val%' ";
else
{
if ( strpos( $key , '{trans}_trans' ) === false )
{
if ( strpos( $key , '{trans}' ) && is_array( $sys -> formGet( $key . '_trans' ) ) )
{
$count = 0;
foreach ( $sys -> formGet( $key . '_trans' ) as $value_tmp )
{
$value_tmp = explode( '[]' , $value_tmp );
if ( strpos( strtolower( $value_tmp[1] ) , strtolower( $val ) ) !== false )
{
if ( $this -> _db_filtr )
$this -> _db_filtr .= ' OR ';
$this -> _db_filtr .= str_replace( '{trans}' , '' , $key ) . " = '" . $value_tmp[0] . "'";
}
else
$count++;
}
if ( count( $sys -> formGet( $key . '_trans' ) ) == $count )
$this -> _db_filtr .= str_replace( '{trans}' , '' , $key ) . " = ''";
}
else
$this -> _db_filtr .= " $key = '$val'";
}
}
}
}
$sys -> setSessionVar( 'db_filtr_' . $page_type , $this -> _db_filtr );
$sys -> setSessionVar( 'db_filtr_value_' . $page_type , $this -> _db_filtr_value );
}
if ( $sys -> formGet( 'set_db_filtr' ) == 'no' )
{
$sys -> deleteSessionVar( 'db_filtr_' . $page_type );
$sys -> deleteSessionVar( 'db_filtr_value_' . $page_type );
}
$this -> _db_filtr = $sys->getSessionVar( 'db_filtr_' . $page_type );
$this -> _db_filtr_value = $sys->getSessionVar( 'db_filtr_value_' . $page_type );
$tpl = new \Savant3;
if ( is_array( $this -> _filtr_id ) )
{
$tpl -> _filtr = true;
for ( $x = 0; $x < $this -> _filtr_quantity; $x++ )
{
if ( isset( $this -> _filtr_field_tran[$x] ) )
{
if ( strpos( $this -> _filtr_id[$x] , '{trans}' ) !== false )
{
$filtr_tt['name'] = $lang -> getTrans( $this -> _filtr_name[ $x ] );
$filtr_tt['seo_name'] = $this -> _filtr_id[ $x ];
if ( isset( $this -> _db_filtr_value[ $this -> _filtr_id[ $x ] ] ))
$filtr_tt['value'] = $this -> _db_filtr_value[ $this -> _filtr_id[ $x ] ];
else
$filtr_tt['value'] = '';
if ( is_array($this -> _filtr_field_tran[$x]) ) foreach ( $this -> _filtr_field_tran[$x] as $key => $val )
$filtr_tt['select'][$key] = $val;
$filtr_ttext[] = $filtr_tt;
}
else
{
$filtr_c = '';
$filtr_c['name'] = $lang -> getTrans( $this -> _filtr_name[$x] );
$filtr_c['seo_name'] = $this -> _filtr_id[$x];
if ( is_array( $this -> _filtr_field_tran[$x] ) ) foreach ( $this -> _filtr_field_tran[$x] as $key => $val )
$filtr_c['value'][$key] = $val;
if ( isset( $this -> _db_filtr_value[$this -> _filtr_id[$x]] ) )
$filtr_c['val'] = $this -> _db_filtr_value[$this -> _filtr_id[$x]];
$filtr_combo[] = $filtr_c;
}
}
if ( isset( $this -> _filtr_type[$x] ) && $this -> _filtr_type[$x] == 'text' )
{
$filtr_t['name'] = $lang -> getTrans($this -> _filtr_name[$x]);
$filtr_t['seo_name'] = $this -> _filtr_id[$x];
if ( isset( $this -> _db_filtr_value[$this -> _filtr_id[$x]] ) )
$filtr_t['value'] = $this -> _db_filtr_value[$this -> _filtr_id[$x]];
else
$filtr_t['value'] = '';
$filtr_text[] = $filtr_t;
}
if ( isset( $this -> _filtr_type[$x] ) && $this -> _filtr_type[$x] == 'text-trans' )
{
$filtr_tt['name'] = $lang -> getTrans( $this -> _filtr_name[ $x ] );
$filtr_tt['seo_name'] = $this -> _filtr_id[ $x ];
$filtr_tt['value'] = $this -> _db_filtr_value[ $this -> _filtr_id[ $x ] ];
if ( is_array($this -> _filtr_field_tran[$x]) ) foreach ( $this -> _filtr_field_tran[$x] as $key => $val )
$filtr_tt['select'][$key] = $val;
$filtr_ttext[] = $filtr_tt;
}
}
$tpl -> _filtr_ttext = $filtr_ttext;
$tpl -> _filtr_combo = $filtr_combo;
$tpl -> _filtr_text = $filtr_text;
}
if ( is_array($this -> _field_id) ) foreach ( $this -> _field_id as $p )
{
if ( !$this -> _select )
{
$this -> _select = $p;
if ( !$this -> _param )
$this -> _param = $p;
}
else
$this -> _select .= ", $p";
}
if ( is_array( $this -> _field_id ) && !in_array( $this -> _param,$this -> _field_id ) )
$this -> _select .= ", " . $this -> _param;
$sql_t = "SELECT count(1) FROM " . $this -> _table;
$sql = "SELECT " . $this -> _select . " FROM " . $this -> _table;
if ( $this -> _filtr )
{
$sql .= " WHERE " . $this -> _filtr;
$sql_t .= " WHERE " . $this -> _filtr;
}
if ( $this -> _filtr && $this -> _db_filtr )
{
$sql .= " AND " . $this -> _db_filtr;
$sql_t .= " AND " . $this -> _db_filtr;
}
else if ( !$this -> _filtr && $this -> _db_filtr )
{
$sql .= " WHERE " . $this -> _db_filtr;
$sql_t .= " WHERE " . $this -> _db_filtr;
}
if ( $this -> _group_by )
{
$sql .= ' GROUP BY ' . $this -> _group_by;
$sql_t .= ' GROUP BY ' . $this -> _group_by;
}
if ( $this -> _sort )
{
$sql .= " ORDER BY " . $this -> _sort;
$sql_t .= " ORDER BY " . $this -> _sort;
}
$query = $db -> prepare ($sql_t) ;
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$count_rows = $row[0];
$ls = ceil( $count_rows / $this -> _limit );
if ( (int)$bs > $ls )
$bs = $ls;
if ( (int)$bs < 1 )
$bs = 1;
$a = $sys -> getPagingVar( 'a' , $bs , $ls );
$b = $sys -> getPagingVar( 'b' , $bs , $ls );
$tpl -> _a = $bs - $b;
$tpl -> _b = $bs + $a;
$tpl -> _ls = $ls;
$tpl -> _link = $this -> _paging_adress;
$tpl -> _bs = $bs;
if ( $this -> _limit )
$sql .= " LIMIT " . ( $bs - 1 ) * $this -> _limit . "," . $this -> _limit;
$query = $db -> prepare( $sql );
$query -> execute();
if ( $this -> _debug )
print_r ($query -> errorInfo() );
$tpl -> _row_count = $query -> rowCount();
for ( $i = 0; $i < $this -> _quantity; $i++ )
{
if ( $this -> _is_lp )
{
$header[0]['value'] = $lang -> getTrans( 'T_LP' );
$this -> _is_lp = false;
}
$row['value'] = $this -> _field_name[$i];
if ( isset( $this -> _filed_sort[$i] ) )
{
$row['sort'] = $this -> _field_id[$i];
if ( $this -> _sort_name == $this -> _field_id[$i] )
$row['way'] = $this -> _sort_way;
else
$row['way'] = '';
}
else
$row['sort'] = false;
$header[] = $row;
}
$tpl -> _table_headers = $header;
$i = $this -> _row_number * ( $bs - 1 ) + 1;
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if ( $this -> _lp )
{
$values['lp']['style'] = 'text-align:center;';
$values['lp']['value'] = ( $bs - 1 ) * $this -> _limit + $i . '.';
}
if ( $this -> _checkbox )
{
$values['checkbox']['value'] = '<input type="checkbox" name="checkbox" value="' . $row[ $this -> _param ] . '">';
}
if ( is_array($this -> _field_id) ) foreach ( $this -> _field_id as $key )
{
if ( isset( $this -> _field_tran[$key] ) && is_array($this -> _field_tran[$key]) )
{
if ( isset( $this -> _field_tran[$key][$row[$key]] ) ) {
if ( strlen( $this -> _field_tran[$key][$row[$key]] ) > 50 )
$values[$key]['value'] = mb_substr( $this -> _field_tran[$key][$row[$key]] , 0 , 50 , 'UTF-8' ) . '...';
else
$values[$key]['value'] = $this -> _field_tran[$key][$row[$key]];
}
}
else
{
if ( strlen( $row[$key] ) > 50 )
$values[$key]['value'] = mb_substr( $row[$key] , 0 , 50 , 'UTF-8' ) . '...';
else
$values[$key]['value'] = $row[$key];
}
$values[$key]['style'] = $this -> _field_style[$key];
}
if ( is_array( $this -> _field_simple_id ) ) foreach ( $this -> _field_simple_id as $key )
{
$val_temp = '';
if ( $this -> _field_link[$key] )
$val_temp .= '<a href="' . $this -> _field_link[$key] . '&id=' . $row[$this -> _param] . '">';
if ( $this -> _field_action[$key] )
$val_temp .= '<a ' . str_replace('[param]',$row[$this -> _param],$this -> _field_action[$key]) . '>';
if ( $key == $lang -> getTrans( 'T_USUN' ) )
$val_temp .= "<span class='icon delete'></span>";
else if ( $key == $lang -> getTrans( 'T_EDYTUJ' ) )
$val_temp .= "<span class='icon edit'></span>";
else if ( $key == $lang -> getTrans( 'T_POKAZ' ) )
$val_temp .= "<span class='icon show'></span>";
else
$val_temp .= $key;
if ( $this -> _field_link[$key] || $this -> _field_action[$key] )
$val_temp .= '</a>';
$values[$key]['style'] = $this -> _field_style[$key];
$values[$key]['value'] = $val_temp;
}
$table_values[] = $values;
$i++;
}
$tpl -> _table_values = $table_values;
$tpl -> _limit = $this -> _limit;
$tpl -> _start = $count_rows == 0 ? 0 : $this -> _limit * ( $bs - 1 ) + 1;
$tpl -> _end = $this -> _limit * $bs > $count_rows ? $count_rows : $this -> _limit * $bs;
$tpl -> _total = $count_rows;
$tpl -> _checkbox = $this -> _checkbox;
$out .= $tpl -> fetch( 'templates/data-browse.php' );
return $out;
}
}
?>

351
autoload/class.DataEdit.php Normal file
View File

@@ -0,0 +1,351 @@
<?php
class DataEdit
{
private $_table;
private $_key;
private $_val;
private $_field_id;
private $_field_name;
private $_field_type;
private $_field_action;
private $_quantity;
private $_select;
private $_password;
private $_pass;
private $_form_id;
private $_quantity_hidden;
private $_field_value_hidden;
private $_field_key_hidden;
private $_upload_quantity;
private $_field_upload;
private $_cancel_button;
private $_param;
private $_field_tab;
function DataEdit( $table , $key = '' , $val = '' , $adres = 'index.php' )
{
$this -> _table = $table;
$this -> _adres = $adres;
$this -> _quantity = 0;
$this -> _quantity_hidden = 0;
if ( $key && $val )
{
$this -> _key = $key;
$this -> _val = $val;
}
}
function addPositionHidden( $key , $val )
{
$this -> _field_value_hidden[ $this -> _quantity_hidden ] = $val;
$this -> _field_key_hidden[ $this -> _quantity_hidden ] = $key;
$this -> _quantity_hidden ++;
}
function addCancelButton( $nazwa , $key = '' , $val = '' )
{
$this -> _cancel_button['nazwa'] = $nazwa;
$this -> _cancel_button['key'] = $key;
$this -> _cancel_button['val'] = $val;
}
function setFormId( $id )
{
$this -> _form_id = $id;
}
function addPosition( $id , $nazwa , $typ , $action = '' , $tab = '' , $empty = false )
{
global $db;
$this -> _field_id[$this -> _quantity] = $id;
$this -> _field_name[$this -> _quantity] = $nazwa;
$this -> _field_type[$this -> _quantity] = $typ;
$this -> _field_action[$this -> _quantity] = $action;
if ( is_array( $tab ) )
$this -> _field_tab[$this -> _quantity] = $tab;
else
{
if ( $tab )
{
$query = $db -> prepare($tab);
$query -> execute();
if ( $empty )
$tabs[''] = '';
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$tabs[$res[0]] = $res[1];
$this -> _field_tab[$this -> _quantity] = $tabs;
}
}
$this -> _quantity ++;
}
function addHiddenParam( $id )
{
$this -> _param = $id;
}
function setSubmitButton( $button )
{
$this -> _button_submit = $button;
}
function addPositionPassword( $nazwa = '' , $action1 = '' , $action2 = '' )
{
$this -> _password = true;
if ( isset( $nazwa ) )
{
$nazwa1 = 'password';
$nazwa2 = 'password_repeat';
}
else
$nazwa2 = $nazwa . '_repeat';
$this -> _pass['nazwa1'] = $nazwa1;
$this -> _pass['nazwa2'] = $nazwa2;
$this -> _pass['action1'] = $action1;
$this -> _pass['action2'] = $action2;
}
function setUploadFolder( $id , $folder )
{
$this -> _upload_quantity ++;
$this -> _field_upload[$this -> _upload_quantity]['id'] = $id;
$this -> _field_upload[$this -> _upload_quantity]['folder'] = $folder;
}
function draw()
{
global $sys , $db , $lang;
$hidden_tab = '';
$hidden_param_tab = '';
$out = '';
$sys -> setSessionVar( 'db_edit_table' , $this -> _table );
$sys -> setSessionVar( 'db_edit_key' , $this -> _key );
$sys -> setSessionVar( 'db_edit_val' , $this -> _val );
$sys -> setSessionVar( 'db_edit_pols' , $this -> _field_id );
$sys -> setSessionVar( 'db_edit_pass' , $this -> _pass );
$sys -> setSessionVar( 'db_edit_pols_hidden', $this -> _field_key_hidden );
$sys -> setSessionVar( 'db_edit_pols_type' , $this -> _field_type );
if ( !$this -> _form_id )
$this -> _form_id = 'formularz';
$flaga = false;
if ( is_array( $this -> _field_id ) ) foreach ( $this -> _field_id as $p )
{
if ( !$this -> _select )
$this -> _select = $p;
else
$this -> _select .= ', ' . $p;
}
if ( $this -> _param )
$this -> _select .= ", " . $this -> _param;
if ( $this -> _key )
$flaga = true;
if ( $flaga )
{
$query = $db -> prepare( 'SELECT ' . $this -> _select . ' FROM ' . $this -> _table . ' WHERE ' . $this -> _key . '="' . $this -> _val . '"' );
$query->execute();
}
$tpl = new \Savant3;
$tpl -> _form_adress = $this -> _adres;
$tpl -> _form_id = $this -> _form_id;
if ( is_array( $this -> _field_key_hidden ) )
{
for ( $j = 0; $j < $this -> _quantity_hidden; $j++ )
{
$hidden['name'] = $this -> _field_key_hidden[$j];
$hidden['value'] = $this -> _field_value_hidden[$j];
$hidden_tab[] = $hidden;
}
}
$tpl -> _hidden_tab = $hidden_tab;
$tpl -> _form_key = $this -> _key;
$tpl -> _form_val = $this -> _val;
if ( $flaga )
{
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
{
if ( $this -> _param )
{
$hidden_param['name'] = $this -> _param;
$hidden_param['value'] = $res[$this -> _param];
$hidden_param_tab[] = $hidden_param;
}
}
}
$tpl -> _hidden_param_tab = $hidden_param_tab;
for ( $i = 0; $i < $this -> _quantity; $i++ )
{
$table_edit['tr_id'] = $this -> _field_id[$i];
$table_edit['name'] = $this -> _field_name[$i];
if ( $this -> _field_type[$i] == "label" )
{
$table_edit['type'] = 'label';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
$table_edit['input_action'] = $this -> _field_action[$i];
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$table_edit['input_value'] = $res[$i];
}
else
$table_edit['input_value'] = '';
if ( isset( $this -> _filed_tab[$i] ) && is_array( $this -> _field_tab[$i] ) ) foreach ( $this -> _field_tab[$i] as $key => $val )
{
if ( $flaga )
{
if ( $key == $res[$i] )
$table_edit['text'] = $val;
}
}
else
$table_edit['text'] = $res[$i];
}
else if ( $this -> _field_type[$i] == 'text' )
{
$table_edit['type'] = 'text';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
$table_edit['input_action'] = $this -> _field_action[$i];
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$table_edit['input_value'] = $res[$i];
}
else
$table_edit['input_value'] = '';
}
else if ( $this -> _field_type[$i] == 'radio' )
{
$table_edit['type'] = 'radio';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
$table_edit['input_action'] = $this -> _field_action[$i];
$value = '';
if ( is_array( $this -> _field_tab[$i] ) ) foreach ( $this -> _field_tab[$i] as $key => $val )
{
$value[$key] = $lang -> getTrans( $val );
$table_edit['input_value'] = $value;
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
{
if ( $key == $res[$i] )
$table_edit['var'] = $res[$i];
}
}
}
else
$table_edit['input_value'] = '';
}
else if ( $this -> _field_type[$i] == 'textarea' )
{
$table_edit['type'] = 'textarea';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$table_edit['input_value'] = $res[$i];
}
else
$table_edit['input_value'] = '';
}
else if ( $this -> _field_type[$i] == 'file' )
{
$table_edit['type'] = 'file';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = 'image';
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
$table_edit['input_value'] = $res[$i];
}
else
$table_edit['input_value'] = '';
}
else if ( $this -> _field_type[$i] == 'combo' )
{
$table_edit['type'] = 'combo';
$table_edit['input_id'] = $this -> _field_id[$i];
$table_edit['input_name'] = $this -> _field_id[$i];
$table_edit['input_action'] = $this -> _field_action[$i];
$value = '';
if ( is_array( $this -> _field_tab[$i] ) ) foreach ( $this -> _field_tab[$i] as $key => $val )
{
$value[$key] = $lang -> getTrans( $val );
$table_edit['input_value'] = $value;
if ( $flaga )
{
$query -> execute();
if ( $query -> rowCount() ) while ( $res = $query -> fetch() )
{
if ( $key == $res[$i] )
$table_edit['var'] = $res[$i];
}
}
}
else
$table_edit['input_value'] = '';
}
$table_edit_tab[] = $table_edit;
}
if ( $this -> _password )
{
$tpl -> _password = $this -> _password;
$tpl -> _pass_name1 = $this -> _pass['nazwa1'];
$tpl -> _pass_action = $this -> _pass['action1'];
$tpl -> _pass_name2 = $this -> _pass['nazwa2'];
$tpl -> _pass_action2 = $this -> _pass['action2'];
}
if ( is_array( $this -> _field_upload ) )
{
$tpl -> _file_upload = true;
for ( $j=1; $j<=$this -> _upload_quantity; $j++ )
{
$upload['name'] = $this -> _field_upload[$j]['id'] . '_folder';
$upload['value'] = $this -> _field_upload[$j]['folder'];
$upload_tab[] = $upload;
}
$tpl -> _upload_tab = $upload_tab;
}
if ( $this -> _cancel_button )
{
$tpl -> _cancel_button = true;
$tpl -> _cancel_adress = $this -> _adres;
$tpl -> _cancel_name = $this -> _cancel_button['nazwa'];
$tpl -> _cancel_key = $this -> _cancel_button['key'];
$tpl -> _cancel_val = $this -> _cancel_button['val'];
}
$tpl -> _table_edit_tab = $table_edit_tab;
$out .= $tpl -> fetch( 'templates/data-edit.php' );
return $out;
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
class FileCache
{
function store( $key , $data , $ttl )
{
$h = fopen( $this -> getFileName( $key ) , 'w' );
if ( !$h )
throw new Exception( 'Could not write to cache' );
$data = base64_encode( serialize( array( time() + $ttl , $data ) ) );
if ( fwrite( $h , $data ) === false )
throw new Exception('Could not write to cache');
fclose($h);
}
private function getFileName( $key )
{
$md5 = md5( $key );
$dir = 'temp/' . $md5[0] . '/';
if ( !is_dir( $dir ) )
mkdir( $dir , 0770 , true );
return $dir . 's_cache' . $md5;
}
function fetch( $key )
{
$filename = $this -> getFileName( $key );
if ( !file_exists( $filename ) || !is_readable( $filename ) )
return false;
$data = base64_decode( file_get_contents( $filename ) );
$data = @unserialize( $data );
if ( !$data )
{
unlink($filename);
return false;
}
if ( time() > $data[0] )
{
if ( file_exists( $filename ) )
unlink( $filename );
return false;
}
return $data[1];
}
}
?>

View File

@@ -0,0 +1,44 @@
<?php
class SeoMixer
{
public $input;
public $output;
public $limit = 1;
private $braces = array("{", "}");
private $delimiter = "|";
function __construct($input)
{
$this->input = $input;
}
function mixAll()
{
$this->output = $this->input;
while (strpos($this->output, $this->braces['1']) !== false)
{
$closed = strpos($this->output, $this->braces['1']);
$substr = substr($this->output, 0, $closed + 1);
$from = strrpos($substr, $this->braces['0']);
$substr = substr($substr, $from);
$_substr = $this->mixText($substr);
$this->output = str_replace($substr, $_substr, $this->output);
$substr = "";
$_substr = "";
}
return;
}
function mixText($text)
{
$text = str_ireplace($this->braces, "", $text);
$elements = explode($this->delimiter, $text);
return $elements[array_rand($elements)];
}
function mix()
{
$this->mixAll();
return $this->output;
}
}
?>

1027
autoload/class.System.php Normal file

File diff suppressed because it is too large Load Diff

327
autoload/class.mySQL.php Normal file
View File

@@ -0,0 +1,327 @@
<?php
class mysql {
var $con;
var $debug_time;
var $debug;
var $count = false;
function __construct( $db = array() )
{
$default = array(
'host' => 'localhost',
'user' => 'root',
'pass' => '',
'db' => 'test'
);
$db = array_merge( $default , $db );
$this -> con = mysql_connect( $db['host'] , $db['user'] , $db['pass'] , true ) or die ( 'Error connecting to MySQL' );
mysql_select_db( $db['db'] , $this -> con ) or die( 'Database ' . $db['db'] . ' does not exist!' );
}
function insert( $table = null , $array_of_values = array() , $debug = false )
{
if ( $table === null || empty( $array_of_values ) || !is_array( $array_of_values ) )
return false;
$fields = array();
$values = array();
foreach ( $array_of_values as $id => $value )
{
$fields[] = $id;
if ( is_array( $value ) && !empty( $value[0] ) )
$values[] = $value[0];
else
$values[] = "'" . $value . "'";
}
$s = "INSERT INTO $table (".implode(',',$fields).') VALUES ('.implode(',',$values).')';
if ( mysql_query( $s , $this -> con ) )
return mysql_insert_id( $this -> con );
else if ( $debug )
die( mysql_error() );
return false;
}
function query( $sql , $cache = false , $debug = false , $field = false )
{
if ( $cache === true )
$cache = 60 * 60;
if ( $this -> debug_time )
$t_start = $this -> getmicrotime();
if ( !$sql )
return false;
$key = md5( $sql );
if ( !$cache || !$value = $this -> fetch ( $key ) )
{
$result = mysql_query( $sql , $this -> con );
if ( $debug && !$result )
die ( mysql_error() );
else if ( $result )
{
if ( mysql_num_rows( $result ) )
{
while ( $row = mysql_fetch_assoc( $result ) )
{
if ( $field )
$value[] = $row[$field];
else
$value[] = $row;
}
if ( $cache )
$this -> store( $key , $value , $cache );
$out = $value;
}
else
$out = false;
}
else
$out = false;
} else
$out = $value;
if ( $this -> debug_time )
{
$t_diff = round( microtime(true) - $t_start , 6 );
$debug_txt = '<p style=\'font-size:11px; padding: 10px; margin: 0px; font-family: verdana;';
if ( $this -> count )
$debug_txt .= 'background:#e6e6e6;';
$this -> count = !$this -> count;
$debug_txt .= '\'>';
if ( $cache )
$debug_txt .= '<b>CACHE</b>';
else
$debug_txt .= '<b>MYSQL</b>';
$debug_txt .= ': ' . $sql . ' w czasie <b>' . $t_diff . '</b>s</p>';
$this -> debug .= '<script type="text/javascript">
debug = window.open( "" ,"Debuger" ,"toolbar = no,height = 500px , width = 1000px" );
debug.document.writeln("' . str_replace( '"' , '&#039;' , $debug_txt ) . '");
</script>';
}
return $out;
}
function delete( $table = null , $conditions = 'FALSE' )
{
if ( $table === null )
return false;
return $this -> execute( "DELETE FROM $table WHERE $conditions" ) or die( mysql_error() );
}
function update( $options , $debug = false )
{
$sql = "UPDATE {$options['table']} SET {$options['fields']} WHERE {$options['condition']}";
return $this -> execute( $sql , $debug );
}
function execute( $sql = '' , $debug = false )
{
if ( $this -> debug_time )
$t_start = $this -> getmicrotime();
if ( $res = mysql_query( $sql , $this -> con ) )
$out = $res;
else
{
if ( $debug )
die ( mysql_error() );
$out = false;
}
if ( $this -> debug_time )
{
$t_diff = round( microtime(true) - $t_start , 6 );
$debug_txt = '<p style=\'font-size:11px; padding: 10px; margin: 0px; font-family: verdana;';
if ( $this -> count )
$debug_txt .= 'background:#e6e6e6;';
$this -> count = !$this -> count;
$debug_txt .= '\'>';
$debug_txt .= '<b>MYSQL</b>';
$debug_txt .= ': ' . $sql . ' w czasie <b>' . $t_diff . '</b>s</p>';
$this -> debug .= '<script type="text/javascript">
debug = window.open( "" ,"Debuger" ,"toolbar = no,height = 500px , width = 1000px" );
debug.document.writeln("' . str_replace( '"' , '&#039;' , $debug_txt ) . '");
</script>';
}
return $out;
}
function select( $options , $cache = false , $debug = false , $to_array = false )
{
$default = array (
'table' => '',
'fields' => '*',
'condition' => '',
'order' => '',
'limit' => ''
);
$options = array_merge( $default , $options );
$sql = "SELECT {$options['fields']} FROM {$options['table']}";
if ( $options['condition'] !== '' )
$sql .= " WHERE {$options['condition']}";
if ( $options['order'] !== '' )
$sql .= " ORDER BY {$options['order']}";
if ( $options['limit'] !== '' )
$sql .= " LIMIT {$options['limit']}";
if ( $to_array )
$field = $options['fields'];
else
$field = false;
return $this -> query( $sql , $cache , $debug , $field );
}
function select_array( $options , $cache = false , $debug = false )
{
$result = $this -> select( $options , $cache , $debug , true );
return $result;
}
function row( $options , $cache = false , $debug = false )
{
$default = array (
'table' => '',
'fields' => '*',
'condition' => '1',
'order' => '1',
'limit' => '1',
);
$options = array_merge( $default , $options );
$sql = "SELECT {$options['fields']} FROM {$options['table']} WHERE {$options['condition']} ORDER BY {$options['order']} LIMIT {$options['limit']}";
$result = $this -> query( $sql , $cache , $debug );
if ( empty( $result[0] ) )
return false;
return $result[0];
}
function get( $options , $cache = false , $debug = false )
{
$default = array (
'table' => '',
'fields' => '*',
'condition' => '1',
'order' => '1',
'limit' => '1'
);
$options = array_merge( $default , $options );
$result = $this -> row( $options ,
$cache ,
$debug
);
if ( $result[$options['fields']] === '' )
return false;
return $result[$options['fields']];
}
public function sec( $string ) {
if ( get_magic_quotes_gpc() )
$string = stripslashes( $string );
if ( phpversion() >= '4.3.0' )
$string = mysql_real_escape_string( $string );
else
$string = mysql_escape_string( $string );
return $string;
}
private function store( $key , $data , $ttl )
{
$h = fopen( $this -> getFileName( $key ) , 'w' );
if ( !$h )
throw new Exception( 'Could not write to cache' );
$data = base64_encode( serialize( array( time() + $ttl , $data ) ) );
if ( fwrite( $h , $data ) === false )
throw new Exception('Could not write to cache');
fclose($h);
}
private function getFileName( $key )
{
$md5 = md5( $key );
$dir = 'temp/' . $md5[0] . '/' . $md5[1] . '/';
if ( !is_dir( $dir ) )
mkdir( $dir , 0770 , true );
return $dir . 's_cache' . $md5;
}
private function fetch( $key )
{
$filename = $this -> getFileName( $key );
if ( !file_exists( $filename ) || !is_readable( $filename ) )
return false;
$data = base64_decode( file_get_contents( $filename ) );
$data = @unserialize( $data );
if ( !$data )
{
unlink( $filename );
return false;
}
if ( time() > $data[0] )
{
unlink($filename);
return false;
}
return $data[1];
}
public function pre( $data )
{
echo '<pre>' . print_r( $data , true ) . '</pre>';
}
public function dump( $data )
{
if ( !$data )
return false;
echo "<style>table.dump { font-family:Arial; font-size:8pt; } table.dump td , table.dump th { padding: 5px 10px; }</style>";
echo "<table class=\"dump\" border=\"1\" cellpadding=\"1\" cellspacing=\"0\">\n";
echo "<tr>";
echo "<th>Lp.</th>";
foreach( $data[0] as $key => $val )
{
echo "<th><b>";
echo $key;
echo "</b></th>";
}
echo "</tr>\n";
$row_cnt = 0;
foreach( $data as $row )
{
$row_cnt++;
echo "<tr align='center'>";
echo "<td>".$row_cnt."</td>";
foreach ( $row as $val )
{
echo "<td>";
echo $val;
echo "</td>";
}
echo"</tr>\n";
}
echo "</table>\n";
}
private function getmicrotime()
{
list( $usec , $sec ) = explode( " " , microtime() );
return ( (float)$usec + (float)$sec );
}
public function debug() {
$this -> debug_time = !$this -> debug_time;
}
}
?>

View File

@@ -0,0 +1,114 @@
<?php
namespace front\controls;
class Page {
public function checkUrlParams()
{
global $db , $lang;
$rw = \System::formGet( 'rw' );
switch ( $rw )
{
case 'change_language':
$id = \System::formGet( 'id' );
$lang = \language\FLanguage::loadLang( $id );
\System::setSessionVar( 'lang' , $lang );
break;
case 'change_site':
if ( \System::formGet( 'type' ) )
$site = \site\FSite::loadSiteStatic( \System::formGet( 'type' ) );
else
$site = \site\FSite::loadSite( \System::formGetInt( 'id' ) );
\System::setSessionVar( 'site' , $site );
break;
}
if ( \System::formGetInt( 'download') )
{
$query = $db -> prepare( 'SELECT file FROM pcms_article_files WHERE id = :id' );
$query -> bindValue( ':id', \System::formGetInt( 'download' ), \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
if (file_exists( $row['file'] ) )
{
header( 'Content-Description: File Transfer');
header( 'Content-Type: application/octet-stream');
header( 'Content-Disposition: attachment; filename=' . basename( $row['file'] ) );
header( 'Content-Transfer-Encoding: binary');
header( 'Expires: 0');
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0');
header( 'Pragma: public');
header( 'Content-Length: ' . filesize( $row['file'] ) );
ob_clean();
flush();
readfile( $row['file'] );
exit;
}
}
$query -> closeCursor();
}
if ( \System::formGet( 'account_activation' ) && \System::formGetInt( 'value' ) )
{
$query = $db -> prepare( 'SELECT id FROM pcms_user WHERE hash = :hash AND id = :id AND enabled = :enabled' );
$query -> bindValue( ':hash' , \System::saveString( \System::formGet( 'account_activation' ) ) , \PDO::PARAM_STR );
$query -> bindValue( ':id' , \System::formGetInt( 'value' ) , \PDO::PARAM_INT );
$query -> bindValue( ':enabled' , 0 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() )
{
$query2 = $db -> prepare( 'UPDATE pcms_user SET enabled = :enabled WHERE hash = :hash AND id = :id' );
$query2 -> bindValue( ':hash' , \System::saveString( \System::formGet( 'account_activation' ) ) , \PDO::PARAM_STR );
$query2 -> bindValue( ':id' , \System::formGetInt( 'value' ) , \PDO::PARAM_INT );
$query2 -> bindValue( ':enabled', 1 , \PDO::PARAM_STR );
$query2 -> execute();
\System::setAlert( $lang -> getTrans( 'T_KONTO_AKTYWOWANE' ) );
}
else
\System::setAlert( $lang -> getTrans( 'T_LINK_NIEPRAWIDLOWY' ) );
$query -> closeCursor();
}
if ( \System::formGet( 'recover_password' ) && \System::formGetInt( 'value' ) )
{
$query = $db -> prepare( 'SELECT id , email , login FROM pcms_user WHERE recover = :recover AND id = :id AND enabled = :enabled' );
$query -> bindValue( ':recover' , \System::saveString( \System::formGet( 'recover_password' ) ) , \PDO::PARAM_STR );
$query -> bindValue( ':id' , \System::formGetInt( 'value' ) , \PDO::PARAM_INT );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$password = \System::gen_hash( 3 );
$query2 = $db -> prepare( 'UPDATE pcms_user SET password = :password , recover = :recover_n WHERE recover = :recover AND id = :id' );
$query2 -> bindValue( ':recover' , \System::saveString( \System::formGet( 'recover_password' ) ) , \PDO::PARAM_STR );
$query2 -> bindValue( ':id' , \System::formGetInt( 'value' ) , \PDO::PARAM_INT );
$query2 -> bindValue( ':password' , md5( $password ) , \PDO::PARAM_STR );
$query2 -> bindValue( ':recover_n' , null , \PDO::PARAM_STR );
$query2 -> execute();
$tresc = str_replace( '{LOGIN}' , $row['login'] , $lang -> getTrans( 'T_NOWE_HASLO_UZYTKOWNIK_TRESC' ) );
$tresc = str_replace( '{SERWER}' , \System::getSystemSettings( 'firm_name' ) , $tresc );
$tresc = str_replace( '{HASLO}' , $password , $tresc );
\System::sendEmail(
$row['email'] ,
str_replace( '{SERWER}' , \System::getSystemSettings( 'firm_name' ) , $lang -> getTrans( 'T_NOWE_HASLO_TEMAT' ) ),
$tresc
);
\System::setAlert( $lang -> getTrans( 'T_NOWE_HASLO_UZYTKOWNIK_EMAIL' ) );
}
else
\System::setAlert( $lang -> getTrans( 'T_LINK_NIEPRAWIDLOWY' ) );
$query -> closeCursor();
}
}
}
?>

View File

@@ -0,0 +1,122 @@
<?php
namespace front\factory;
class Page {
public function getActiveLayout()
{
global $db , $site;
$layout = '';
$query = $db -> prepare( 'SELECT html , css , javascript FROM pcms_layout_pages , pcms_layout WHERE page_id = :page_id AND pcms_layout.id = layout_id ORDER BY layout_id DESC LIMIT 1' );
$query -> bindValue( ':page_id' , $site -> get_id() , \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$layout = $row;
$query -> closeCursor();
if ( !$layout )
{
$query = $db -> prepare( 'SELECT html , css , javascript FROM pcms_layout WHERE enabled = :enabled' );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
$layout = $row;
$query -> closeCursor();
}
return $layout;
}
public function convertPage( $layout )
{
global $site , $xajax, $config;
if ( \System::formGetInt( 'art' ) )
$layout = \System::getLayout( \article\FArticle::getArticleLayoutId( \System::formGetInt( 'art' ) ) );
$menu_pattern = '/MENU:[0-9]*/';
$html = stripslashes( $layout['html'] );
if ( $config['dev'] && file_exists( 'dev.html' ) )
$html = file_get_contents( 'dev.html' );
if ( $site -> get_show_title() )
$title = $site -> get_title();
else
$title = '';
$html = str_replace( '[TYTUL_STRONY]' , $title , $html );
$html = str_replace( '[JEZYKI]' , \language\VLanguage::show() , $html );
$html = str_replace( '[ALERT]' , \System::getAlert() , $html );
$html = str_replace( '[STRONA_GLOWNA]' , \System::getMainPage() , $html );
$html = str_replace( '[CSS]' , stripslashes( $layout['css'] ) , $html );
$html = str_replace( '[LICZNIK]' , \site\VSite::drawVisitCounter() , $html );
$html = str_replace( '[COPYRIGHT]' , \site\VSite::drawCopyright() , $html );
$html = str_replace( '[BANERY]' , \site\VSite::drawBanners() , $html );
$html = str_replace( '[KONTAKT_MINI]' , \site\VSite::drawContactMini() , $html );
$html = str_replace( '[ZEGAR]' , \site\VSite::drawClock() , $html );
$html = str_replace( '[IMIENINY]' , \site\VSite::drawNameDay() , $html );
$html = str_replace( '[PANEL_UZYTKOWNIKA]' , \user\VUser::drawUserPanel() , $html );
$html = str_replace( '[PAGE_ID]' , $site -> get_id() , $html );
$html = str_replace( '[WYSZUKIWARKA]' , \site\VSite::drawSearchForm() , $html );
$html = str_replace( '[REKLAMA]' , \site\VSite::drawAdverts() , $html );
$html = str_replace( '[SWL]' , \site\VSite::drawSWL() , $html );
$html = str_replace( '[JAVA_SCRIPT]' , stripslashes( $layout['javascript'] ) , $html );
$html = str_replace( '[AJAX]' , $xajax -> getJavascript( '../resources/xajax/' ) , $html );
if ( \System::getAlert() )
\System::setAlert('');
preg_match_all( $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] . ']' , \menu\VMenu::show( $menu_tmp[1] ) , $html );
}
$keywords = \System::getSessionVar( 'keywords' );
$description = \System::getSessionVar( 'description' );
if ( \System::formGetInt( 'art' ) )
{
$id = \System::formGetInt( 'art' );
$keywords = \article\FArticle::getKeywords( $id );
$description = \article\FArticle::getDescription( $id );
$site_title = \System::getRandomKeyWord( $keywords );
if ( $site_title )
$site_title .= ' - ';
$site_title .= \article\FArticle::getArticleTitle( $id ) . ' - RSM';
$html = str_replace( '[ZAWARTOSC]' , \article\VArticle::draw( $id ) , $html );
}
else
{
$keywords = $site -> get_keywords();
$description = $site -> get_description();
$site_title = \System::getRandomKeyWord( $keywords );
if ( $site_title )
$site_title .= ' - ';
$site_title .= $site -> get_title() . ' - RSM';
if ( $site -> get_id() == 1 )
$site_title = 'RSM Rzeszów Rockowa Szkoła Muzyczna, nauka gry na gitarze i nie tylko…';
$html = str_replace( '[ZAWARTOSC]' , \site\FSite::getContent() , $html );
}
$html = str_replace( '[TYTUL]' , $site_title , $html );
$html = str_replace( '[SLOWA_KLUCZOWE]' , $keywords , $html );
$html = str_replace( '[OPIS_STRONY]' , $description , $html );
return $html;
}
}
?>

View File

@@ -0,0 +1,13 @@
<?php
namespace front\view;
class Page {
public function show()
{
$layout = \front\factory\Page::getActiveLayout();
return \front\factory\Page::convertPage( $layout );
}
}
?>

View File

@@ -0,0 +1,65 @@
<?php
namespace guestbook;
class FGuestBook {
const iLimit = 10;
public function addEntry( $signature , $text )
{
global $db , $sys;
$query = $db -> prepare( 'INSERT INTO pcms_guest_book ( signature , text , date) VALUES ( :signature , :text , :date )' );
$query -> bindValue( ':signature' , $signature , \PDO::PARAM_STR );
$query -> bindValue( ':text' , $text , \PDO::PARAM_STR );
$query -> bindValue( ':date' , $sys -> getDate() , \PDO::PARAM_STR );
$query -> execute();
$query -> closeCursor();
}
public function getLimit()
{
return self::iLimit;
}
public function getEntries( $from , $to )
{
global $db , $cache , $config;
$sKey = "FGuestBook:getEntries:$from:$to";
if ( !$aEntries = $cache -> fetch ( $sKey ) )
{
$query = $db -> prepare( 'SELECT signature, text, date FROM pcms_guest_book ORDER BY date DESC LIMIT ' . $from . ',' . $to );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$entry['signature'] = $row['signature'];
$entry['text'] = nl2br($row['text']);
$entry['date'] = date("d/m/Y H:i",strtotime($row['date']));
$aEntries[] = $entry;
}
$cache -> store( $sKey , $aEntries , $config['cache_expire_short'] );
}
return $aEntries;
}
public function getCountEntries()
{
global $db , $cache , $config;
$sKey = 'FGuestBook:getCountEntries';
if ( !$iCount_gb = $cache -> fetch( $sKey ) )
{
$query = $db->prepare( 'SELECT COUNT(1) FROM pcms_guest_book' );
$query->execute();
if ( $query->rowCount() ) while ( $row = $query->fetch() )
$iCount_gb = $row[0];
$query->closeCursor();
$cache -> store( $sKey , $iCount_gb , $config['cache_expire_short'] );
}
return $iCount_gb;
}
}
?>

View File

@@ -0,0 +1,13 @@
<?php
namespace guestbook;
class VGuestBook {
public function drawGuestBook( $aEntries )
{
$tpl = new \Savant3;
$tpl -> _entries = $aEntries;
return $tpl -> fetch( 'templates/site-guest-book.php' );
}
}
?>

View File

@@ -0,0 +1,58 @@
<?php
namespace language;
class FLanguage {
public function loadLang( $language_tmp = 'pl' , $admin = false )
{
global $cache , $db , $sys , $config;
$language_tmp = \language\Flanguage::checkLangCorrection( $language_tmp );
$key = 'loadLang:' . $language_tmp;
if ( !$translation = $cache -> fetch( $key ) )
{
$query = $db -> prepare( 'SELECT text , ' . $language_tmp . ' FROM pcms_lang_text' );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$translation[ $row['text'] ] = $row[ $language_tmp ];
}
$query -> closeCursor();
$cache -> store( $key , $translation , $config['cache_expire_long' ] );
}
$sys -> setSessionVar( 'current_lang' , $language_tmp , $admin );
$language = new \language\Language( $language_tmp );
$language -> set_translation( $translation );
return $language;
}
private function checkLangCorrection( $lang_check )
{
switch ( $lang_check )
{
case 'pl':
return 'pl';
break;
case 'en':
return 'en';
break;
case 'ru':
return 'ru';
break;
case 'de':
return 'de';
break;
case 'uk':
return 'uk';
break;
default:
return 'pl';
break;
}
}
}
?>

View File

@@ -0,0 +1,42 @@
<?php
namespace language;
class Language {
private $_translation;
private $_language;
public function construct( $lang )
{
$this -> _language = $lang;
}
public function get_language()
{
return $this->_language;
}
public function set_language($_language)
{
$this->_language = $_language;
}
public function get_translation()
{
return $this->_translation;
}
public function set_translation($_translation)
{
$this->_translation = $_translation;
}
public function getTrans( $val )
{
if ( isset( $this -> _translation[ $val ] ) )
return $this -> _translation[ $val ];
else
return $val;
}
}
?>

View File

@@ -0,0 +1,18 @@
<?php
namespace language;
class VLanguage {
public function show()
{
$langs = \System::getLangs();
$current_lang = \System::getSessionVar( 'current_lang' );
$tpl = new \Savant3;
$tpl -> assign( '_langs' , $langs );
$tpl -> assign( '_current_lang' , $current_lang );
return $tpl -> fetch( 'templates/site-languages.php' );
}
}
?>

View File

@@ -0,0 +1,33 @@
<?php
namespace menu;
class FMenu {
public function loadMenu( $id )
{
global $db , $cache , $config , $sys;
$current_lang = $sys -> getSessionVar( 'current_lang' );
$key = 'loadMenu:' . $id . ':' . $current_lang;
if ( !$sites = $cache -> fetch( $key ) )
{
$query = $db -> prepare( 'SELECT id FROM pcms_page WHERE id_menu = :id_menu AND enabled = :enabled ORDER BY o' );
$query -> bindValue( ':id_menu' , $id , \PDO::PARAM_INT );
$query -> bindValue( ':enabled' , 1 , \PDO::PARAM_STR );
$query -> execute();
if ( $query -> rowCount() ) while( $row = $query -> fetch() )
{
$sites[] = \site\FSite::loadSite( $row['id'] );
}
$query -> closeCursor();
$cache -> store( $key , $sites , $config['cache_expire'] );
}
$menu = new \menu\Menu;
$menu -> set_id( $id );
$menu -> set_sites( $sites );
return $menu;
}
}
?>

View File

@@ -0,0 +1,29 @@
<?php
namespace menu;
class Menu {
private $_sites;
private $_id;
public function get_sites()
{
return $this->_sites;
}
public function set_sites($_sites)
{
$this->_sites = $_sites;
}
public function get_id()
{
return $this->_id;
}
public function set_id($_id)
{
$this->_id = $_id;
}
}
?>

View File

@@ -0,0 +1,16 @@
<?php
namespace menu;
class VMenu {
public function show( $id )
{
$menu = \menu\FMenu::loadMenu( $id );
$tpl = new \Savant3;
$tpl -> _menu = $menu;
return $tpl -> fetch( 'templates/site-menu.php' );
}
}
?>

497
autoload/opd.class.php Normal file
View File

@@ -0,0 +1,497 @@
<?php
// -------------------------------------------------------------------- //
// Open Power Board //
// Open Power Driver //
// Copyright (c) 2005 OpenPB team, http://www.openpb.net/ //
// -------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU Lesser General Public License as //
// published by the Free Software Foundation; either version 2.1 of the //
// License, or (at your option) any later version. //
// -------------------------------------------------------------------- //
//
// $Id: opd.class.php 53 2006-05-04 07:57:03Z zyxist $
if(!defined('OPD_DIR'))
{
define('OPD_DIR', './');
}
define('OPD_VERSION', '0.4');
define('OPD_CACHE_PREPARE', true);
require(OPD_DIR.'opd.statement.php');
function opdErrorHandler(PDOException $exc)
{
echo '<br/><b>Open Power Driver internal error #'.$exc->getCode().': </b> '.$exc->getMessage().'<br/>
Query used: <i>'.opdClass::$lastQuery.'</i><br/>';
}
class opdClass
{
static public $lastQuery;
public $dsn;
public $debugConsole;
// Debug etc.
private $queryMonitor;
private $consoleCode;
private $i;
private $counterExecuted = 0;
private $counterRequested = 0;
private $counterTime = 0;
private $counterTimeExecuted = 0;
private $transactions = 0;
private $transactionsCommit = 0;
private $transactionsRollback = 0;
// PDO
private $pdo;
// Connection
private $user;
private $password;
private $driverOpts;
private $connected;
// Cache
private $cacheDir;
private $cache;
private $cacheId;
private $cacheIds = array();
public function __construct($dsn, $user, $password, $driverOpts = array())
{
$this -> dsn = $dsn;
$this -> user = $user;
$this -> password = $password;
$this -> driverOpts = $driverOpts;
$this -> queryCount = 0;
$this -> i = 0;
} // end __construct();
private function makeConnection()
{
if(is_null($this -> connected))
{
$this -> connected = true;
$this -> pdo = new PDO($this -> dsn, $this -> user, $this -> password, $this -> driverOpts);
$this -> pdo -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
} // end makeConnection();
public function __destruct()
{
if($this -> debugConsole)
{
if($this -> transactionsCommit + $this -> transactionsRollback != $this -> transactions)
{
// If any transaction closed automatically
$this -> transactionsCommit = $this -> transactions - $this -> transactionsRollback;
}
$config = array(
'Open Power Driver version' => OPD_VERSION,
'DSN' => $this -> dsn,
'Database connection' => ($this -> connected ? 'Yes' : 'No'),
'Requested queries' => $this -> counterRequested,
'Executed queries' => $this -> counterExecuted,
'Total database time' => $this -> counterTime.' s',
'Executed queries time' => $this -> counterTimeExecuted.' s',
'Transactions opened' => $this -> transactions,
'Commited transactions' => $this -> transactionsCommit,
'Rolled back transactions' => $this -> transactionsRollback
);
eval($this->consoleCode);
if(isset($debugCode))
{
echo '<script language="JavaScript">
opd_console = window.open("","OPD debug console","width=680,height=350,resizable,scrollbars=yes");
'.$debugCode.'</script>';
}
}
} // end __destruct();
static public function create($config)
{
if(is_string($config))
{
$config = parse_ini_file($config);
}
if(!is_array($config))
{
throw new Exception('Invalid Open Power Driver configuration: no configuration array.');
}
$opd = new opdClass($config['dsn'], $config['user'], $config['password']);
if(isset($config['cache']))
{
$opd -> setCacheDirectory($config['cache']);
}
if(isset($config['debugConsole']))
{
$opd -> debugConsole = $config['debugConsole'];
}
return $opd;
} // end create();
public function beginTransaction()
{
$this -> transactions++;
$this -> makeConnection();
return $this -> pdo -> beginTransaction();
} // end beginTransaction();
public function commit()
{
$this -> transactionsCommit++;
$this -> makeConnection();
return $this -> pdo -> commit();
} // end commit();
public function errorCode()
{
$this -> makeConnection();
return $this -> pdo -> errorCode();
} // end errorCode();
public function errorInfo()
{
$this -> makeConnection();
return $this -> pdo -> errorInfo();
} // end errorInfo();
public function exec($statement, $id = NULL)
{
if(!is_null($id))
{
$stmt = $this -> prepare($statement);
$stmt -> bindValue(':id', $id, PDO::PARAM_INT);
return $stmt -> execute();
}
$this -> makeConnection();
$this -> beginDebugDefinition($statement);
$this -> startTimer(false, false);
$result = $this -> pdo -> exec($statement);
$this -> endTimer();
opdClass::$lastQuery = $statement;
$this -> endDebugDefinition($result);
return $result;
} // end exec();
public function getAttribute($attribute)
{
$this -> makeConnection();
return $this -> pdo -> getAttribute($attribute);
} // end getAttribute();
public function getAvailableDrivers()
{
$this -> makeConnection();
return $this -> pdo -> getAvailableDrivers();
} // end getAvailableDrivers();
public function lastInsertId($sequence = NULL)
{
$this -> makeConnection();
if($sequence == NULL)
{
return $this -> pdo -> lastInsertId();
}
return $this -> pdo -> lastInsertId($sequence);
} // end lastInsertId();
public function prepare($statement, $options = array())
{
if($this -> cache == false)
{
if(count($options) == 0)
{
$options = array(PDO::ATTR_CURSOR, PDO::CURSOR_FWDONLY);
}
$this -> makeConnection();
$result = $this -> pdo -> prepare($statement, $options);
opdClass::$lastQuery = $statement;
return new opdStatement($this, $result, $statement);
}
else
{
$cacheTests = array();
$needsQuery = 0;
$result = NULL;
$time = time();
if(count($this -> cacheIds) > 0)
{
foreach($this -> cacheIds as $idx => $id)
{
if($id == false)
{
// This instance must not be cached
$cacheTests[] = array(
'id' => false,
'test' => false
);
$needsQuery = 1;
}
else
{
// This instance should be cached
if(!is_null($this -> cachePeroids[$idx]))
{
$test = (@filemtime($this->cacheDir.'%%'.$id.'.php') + $this -> cachePeroids[$idx] > $time);
}
else
{
$test = file_exists($this->cacheDir.'%%'.$id.'.php');
}
$cacheTests[] = array(
'id' => $id,
'test' => $test
);
if(!$test)
{
$needsQuery = 1;
}
}
}
}
if($needsQuery)
{
if(count($options) == 0)
{
$options = array(PDO::ATTR_CURSOR, PDO::CURSOR_FWDONLY);
}
$this -> makeConnection();
$result = $this -> pdo -> prepare($statement, $options);
opdClass::$lastQuery = $statement;
}
$this -> cacheIds = array();
$this -> cachePeroids = array();
$this -> cache = false;
return new opdPreparedCacheStatement($this, $cacheTests, $result, $statement);
}
} // end prepare();
public function query($statement, $fetchMode = PDO::FETCH_ASSOC)
{
$this -> beginDebugDefinition($statement);
if($this -> cache)
{
$this -> cache = false;
if(!is_null($this -> cachePeroid))
{
if(@filemtime($this->cacheDir.'%%'.$this->cacheId.'.php') + $this -> cachePeroid > time())
{
$this -> cachePeroid = NULL;
return new opdCachedStatement($this, true, $this->cacheId);
}
$this -> cachePeroid = NULL;
}
else
{
if(file_exists($this->cacheDir.'%%'.$this->cacheId.'.php'))
{
return new opdCachedStatement($this, true, $this->cacheId);
}
}
$this -> makeConnection();
$this -> startTimer(true, false);
$result = $this -> pdo -> query($statement);
$this -> endTimer();
opdClass::$lastQuery = $statement;
$result -> setFetchMode($fetchMode);
return new opdCachedStatement($this, false, $result, $this->cacheId);
}
else
{
$this -> cache = false;
$this -> makeConnection();
$this -> startTimer(false, false);
$result = $this -> pdo -> query($statement);
$this -> endTimer();
opdClass::$lastQuery = $statement;
$result -> setFetchMode($fetchMode);
return new opdStatement($this, $result);
}
} // end query();
public function quote($string, $parameterType = PDO::PARAM_STR)
{
$this -> makeConnection();
return $this -> pdo -> quote($string, $parameterType);
} // end quote();
public function rollBack()
{
$this -> transactionsRollback++;
$this -> makeConnection();
return $this -> pdo -> rollBack();
} // end rollBack();
public function setAttribute($name, $value)
{
$this -> makeConnection();
return $this -> pdo -> setAttribute($name, $value);
} // end setAttribute();
// --------------------
// OPD-specific methods
// --------------------
public function get($query)
{
$stmt = $this -> query($query, PDO::FETCH_NUM);
if($row = $stmt -> fetch())
{
$stmt -> closeCursor();
return $row[0];
}
$stmt -> closeCursor();
return NULL;
} // end get();
public function getId($query, $id)
{
$stmt = $this -> prepare($query);
$stmt -> bindValue(':id', $id, PDO::PARAM_INT);
$stmt -> execute();
if($row = $stmt -> fetch(PDO::FETCH_NUM))
{
$stmt -> closeCursor();
return $row[0];
}
$stmt -> closeCursor();
return NULL;
} // end getId();
public function setCacheDirectory($dir)
{
$this -> cacheDir = $dir;
} // end setCacheDirectory();
public function getCacheDirectory()
{
return $this -> cacheDir;
} // end getCacheDirectory();
public function setCache($id, $prepare = false)
{
$this -> cache = true;
$this -> cacheId = $id;
$this -> cachePeroid = NULL;
if($prepare == true)
{
$this -> cacheIds[] = $id;
$this -> cachePeroids[] = NULL;
}
} // end setCache();
public function setCacheExpire($peroid, $id, $prepare = false)
{
$this -> cache = true;
$this -> cacheId = $id;
$this -> cachePeroid = $peroid;
if($prepare == true)
{
$this -> cacheIds[] = $id;
$this -> cachePeroids[] = $peroid;
}
} // end setCacheExpire();
public function clearCache($name)
{
if(file_exists($this -> cacheDir.'%%'.$name.'.php'))
{
unlink($this -> cacheDir.'%%'.$name.'.php');
return true;
}
return false;
} // end clearCache();
public function clearCacheGroup($name)
{
$list = glob($this -> cacheDir.'%%'.$name.'.php', GLOB_BRACE);
if(is_array($list))
{
foreach($list as $file)
{
unlink($file);
}
return true;
}
return false;
} // end clearCacheGroup();
public function getCounter()
{
return $this -> counterExecuted;
} // end getCounter();
// --------------------
// Debug console methods
// --------------------
public function beginDebugDefinition($query)
{
if($this -> debugConsole)
{
if(is_null($this -> consoleCode))
{
$this -> consoleCode = file_get_contents(OPD_DIR.'opd.debug.php');
}
$this -> queryMonitor[$this->i] = array(
'query' => $query,
'result' => '',
'cache' => 0,
'cached' => 0,
'execution' => 0
);
}
} // end beginDebugDefinition();
public function startTimer($cacheEnabled, $cached)
{
$this -> counterRequested++;
if(!$cached)
{
$this -> counterExecuted++;
}
$this -> queryMonitor[$this->i]['cache'] = $cacheEnabled == true ? 'Yes' : 'No';
$this -> queryMonitor[$this->i]['cached'] = $cached;
if($this -> debugConsole)
{
$this -> time = microtime(true);
}
} // end startTimer();
public function endTimer()
{
if($this -> debugConsole)
{
$this -> queryMonitor[$this->i]['execution'] = round(microtime(true) - $this -> time, 6);
$this -> counterTime += $this -> queryMonitor[$this->i]['execution'];
if(!$this -> queryMonitor[$this->i]['cached'])
{
$this -> counterTimeExecuted += $this -> queryMonitor[$this->i]['execution'];
}
}
} // end endTimer();
public function endDebugDefinition($result)
{
if($this -> debugConsole)
{
$this -> queryMonitor[$this -> i]['result'] = $result;
$this -> i++;
}
} // end endDebugDefinition();
}
?>

118
autoload/opd.debug.php Normal file
View File

@@ -0,0 +1,118 @@
$debugCode = 'opd_console.document.write(\'<html>\');
opd_console.document.write(\'<head>\');
opd_console.document.write(\'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\');
opd_console.document.write(\'<title>OPD Debug Console</title>\');
opd_console.document.write(\'<style>\');
opd_console.document.write(\'body{\');
opd_console.document.write(\' background: #ffffff;\');
opd_console.document.write(\' font-family: Verdana, Arial, Tahoma, Helvetica;\');
opd_console.document.write(\' font-size: 11px;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#info{\');
opd_console.document.write(\' width: 100%;\');
opd_console.document.write(\' padding: 0;\');
opd_console.document.write(\' margin: 0;\');
opd_console.document.write(\' border-spacing: 0;\');
opd_console.document.write(\' border: 1px #333333 solid;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#info td.field{\');
opd_console.document.write(\' margin: 0;\');
opd_console.document.write(\' width: 30%;\');
opd_console.document.write(\' color: #474747;\');
opd_console.document.write(\' border-width: 1px 0 1px 0;\');
opd_console.document.write(\' border-style: solid;\');
opd_console.document.write(\' border-color: #ffffff #ffffff #b2b2b2 #ffffff;\');
opd_console.document.write(\' background-color: #dadada;\');
opd_console.document.write(\' font-size: 11px;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#info td.value{\');
opd_console.document.write(\' margin: 0;\');
opd_console.document.write(\' width: 70%;\');
opd_console.document.write(\' border-width: 1px;\');
opd_console.document.write(\' border-color: #ffffff #e4e4e4 #e4e4e4 #ffffff;\');
opd_console.document.write(\' border-style: solid;\');
opd_console.document.write(\' background-color: #efefef;\');
opd_console.document.write(\' font-size: 11px;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#queries{\');
opd_console.document.write(\' width: 100%;\');
opd_console.document.write(\' padding: 0;\');
opd_console.document.write(\' margin: 0;\');
opd_console.document.write(\' margin-top: 4px;\');
opd_console.document.write(\' border-spacing: 0;\');
opd_console.document.write(\' border: 1px #333333 solid;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#queries thead td{\');
opd_console.document.write(\' text-align: left;\');
opd_console.document.write(\' padding: 3px 3px 3px 12px;\');
opd_console.document.write(\' font-size: 12px;\');
opd_console.document.write(\' color: #474747;\');
opd_console.document.write(\' border-width: 1px 0 1px 0;\');
opd_console.document.write(\' border-style: solid;\');
opd_console.document.write(\' border-color: #ffffff #ffffff #b2b2b2 #ffffff;\');
opd_console.document.write(\' background-color: #dadada;\');
opd_console.document.write(\' font-weight: bold;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#queries tbody td{\');
opd_console.document.write(\' background-color: #f5f5f5;\');
opd_console.document.write(\' border-width: 0 1px 1px 0;\');
opd_console.document.write(\' border-style: solid;\');
opd_console.document.write(\' border-bottom-color: #d2d2d2;\');
opd_console.document.write(\' border-right-color: #d2d2d2;\');
opd_console.document.write(\' font-size: 10px;\');
opd_console.document.write(\' margin-top: 3px;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'table#queries tbody tr.cached td{\');
opd_console.document.write(\' background: #ededff;\');
opd_console.document.write(\'}\');
opd_console.document.write(\'</style>\');
opd_console.document.write(\'</head>\');
opd_console.document.write(\'<body>\');
opd_console.document.write(\'<h1>OPD Debug Console</h1>\');
opd_console.document.write(\'<table id="info">\');
';
foreach($config as $name => $value)
{
$debugCode .= 'opd_console.document.write(\'<tr>\');
opd_console.document.write(\'<td class="field">'.$name.'</td>\');
opd_console.document.write(\'<td class="value">'.$value.'</td>\');
opd_console.document.write(\'</tr>\');';
}
$debugCode .= '
opd_console.document.write(\'</table>\');
opd_console.document.write(\'<table id="queries">\');
opd_console.document.write(\'<thead>\');
opd_console.document.write(\'<tr>\');
opd_console.document.write(\' <td>Query</td>\');
opd_console.document.write(\' <td>Cache</td>\');
opd_console.document.write(\' <td>Result</td>\');
opd_console.document.write(\' <td>Execution time</td>\');
opd_console.document.write(\'</tr>\');
opd_console.document.write(\'</thead>\');
opd_console.document.write(\'<tbody>\');
';
foreach($this -> queryMonitor as $data)
{
if($data['cached'] == true)
{
$debugCode .= 'opd_console.document.write(\'<tr class="cached">\');';
}
else
{
$debugCode .= 'opd_console.document.write(\'<tr>\');';
}
$debugCode .= 'opd_console.document.write(\' <td>'.addslashes($data['query']).'</td>\');
opd_console.document.write(\' <td>'.$data['cache'].'</td>\');
opd_console.document.write(\' <td>'.$data['result'].'</td>\');
opd_console.document.write(\' <td>'.$data['execution'].' s</td>\');
opd_console.document.write(\'</tr>\');';
}
$debugCode .= '
opd_console.document.write(\'</tbody>\');
opd_console.document.write(\'</table>\');
opd_console.document.write(\'\');
opd_console.document.write(\'</body>\');
opd_console.document.write(\'</html>\');';

629
autoload/opd.statement.php Normal file
View File

@@ -0,0 +1,629 @@
<?php
// -------------------------------------------------------------------- //
// Open Power Board //
// Open Power Driver //
// Copyright (c) 2005 OpenPB team, http://www.openpb.net/ //
// -------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU Lesser General Public License as //
// published by the Free Software Foundation; either version 2.1 of the //
// License, or (at your option) any later version. //
// -------------------------------------------------------------------- //
//
// $Id: opd.statement.php 49 2006-04-22 06:46:19Z zyxist $
interface iopdStatement
{
public function bindColumn($column, &$param, $type = NULL);
public function bindParam($parameter, &$variable, $dataType = NULL, $length = NULL, $driverOptions = NULL);
public function bindValue($parameter, $value, $dataType = NULL);
public function closeCursor();
public function columnCount();
public function errorCode();
public function errorInfo();
public function execute($inputParameters = array());
public function fetch($fetchStyle = PDO::FETCH_BOTH, $orientation = PDO::FETCH_ORI_NEXT, $offset = NULL);
public function fetchAll($fetchStyle = PDO::FETCH_BOTH, $columnIndex = 0);
public function fetchColumn($columnNumber = 0);
public function getAttribute($attribute);
public function getColumnMeta($column);
public function nextRowset();
public function rowCount();
public function setAttribute($attribute, $value);
public function setFetchMode($mode, $className = NULL);
}
class opdStatement implements iopdStatement, Iterator
{
private $stmt;
private $opd;
private $items;
private $query;
private $buffer;
private $i;
public function __construct(opdClass $opd, PDOStatement $stmt, $query = NULL)
{
$this -> stmt = $stmt;
$this -> opd = $opd;
$this -> query = $query;
} // end __construct();
public function bindColumn($column, &$param, $type = NULL)
{
if($type == NULL)
{
return $this -> stmt -> bindColumn($column, $param);
}
return $this -> stmt -> bindColumn($column, $param, $type);
} // end bindColumn();
public function bindParam($parameter, &$variable, $dataType = NULL, $length = NULL, $driverOptions = NULL)
{
if($dataType == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable);
}
elseif($length == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable, $dataType);
}
elseif($driverOptions == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable, $dataType, $length);
}
return $this -> stmt -> bindParam($parameter, $variable, $dataType, $length, $driverOptions);
} // end bindParam();
public function bindValue($parameter, $value, $dataType = NULL)
{
if($dataType == NULL)
{
return $this -> stmt -> bindValue($parameter, $value);
}
return $this -> stmt -> bindValue($parameter, $value, $dataType);
} // end bindValue();
public function closeCursor()
{
$this -> opd -> endDebugDefinition($this -> items);
return $this -> stmt -> closeCursor();
} // end closeCursor();
public function columnCount()
{
return $this -> stmt -> columnCount();
} // end columnCount();
public function errorCode()
{
return $this -> stmt -> errorCode();
} // end errorCode();
public function errorInfo()
{
return $this -> stmt -> errorInfo();
} // end errorInfo();
public function execute($inputParameters = NULL)
{
if($inputParameters == NULL)
{
$this -> opd -> beginDebugDefinition($this -> query);
$this -> opd -> startTimer(false, false);
$result = $this -> stmt -> execute();
$this -> opd -> endTimer();
}
else
{
$this -> opd -> beginDebugDefinition($this -> query);
$this -> opd -> startTimer(false, false);
$result = $this -> stmt -> execute($inputParameters);
$this -> opd -> endTimer();
}
$this -> items = 0;
$letter = strtolower($this->query[0]);
if($letter == 'i' || $letter == 'u' || $letter == 'd' || $letter == 'r')
{
$this -> items = $this -> stmt -> rowCount();
$this -> opd -> endDebugDefinition($this -> items);
}
return $result;
} // end execute();
public function fetch($fetchStyle = PDO::FETCH_BOTH, $orientation = PDO::FETCH_ORI_NEXT, $offset = NULL)
{
if($offset == NULL)
{
if($data = $this -> stmt -> fetch($fetchStyle, $orientation))
{
$this -> items++;
return $data;
}
}
if($data = $this -> stmt -> fetch($fetchStyle, $orientation, $offset))
{
$this -> items++;
return $data;
}
} // end fetch();
public function fetchAll($fetchStyle = PDO::FETCH_BOTH, $columnIndex = 0)
{
if($fetchStyle == PDO::FETCH_COLUMN)
{
$data = $this -> stmt -> fetchAll($fetchStyle, $columnIndex);
}
else
{
$data = $this -> stmt -> fetchAll($fetchStyle);
}
$this -> items = count($data);
return $data;
} // end fetchAll();
public function fetchColumn($columnNumber = 0)
{
$this -> items++;
return $this -> stmt -> fetchColumn($columnNumber);
} // end fetchColumn();
public function getAttribute($attribute)
{
return $this -> stmt -> getAttribute($attribute);
} // end getAttribute();
public function getColumnMeta($column)
{
return $this -> stmt -> getColumnMeta($column);
} // end getColumnMeta();
public function nextRowset()
{
$this -> items++;
return $this -> stmt -> nextRowset();
} // end nextRowset();
public function rowCount()
{
return $this -> stmt -> rowCount();
} // end rowCount();
public function setAttribute($attribute, $value)
{
return $this -> stmt -> setAttribute($attribute, $value);
} // end setAttribute();
public function setFetchMode($mode, $className = NULL, $args = array())
{
if($mode == PDO::FETCH_CLASS)
{
return $this -> stmt -> setFetchMode($mode, $className, $args);
}
return $this -> stmt -> setFetchMode($mode);
} // end setFetchMode();
public function rowNumber()
{
return $this -> items;
} // end rowNumber();
/*
* ITERATOR INTERFACE IMPLEMENTATION
*/
public function current()
{
return $this -> buffer;
} // end current();
public function key()
{
return $this -> i;
} // end key();
public function valid()
{
if($this -> buffer = $this -> stmt -> fetch())
{
return true;
}
$this -> items = $this -> i - 1;
$this -> stmt -> closeCursor();
return false;
} // end valid();
public function next()
{
$this -> i++;
} // end next();
public function rewind()
{
$this -> buffer = array();
$this -> i = 0;
} // end rewind();
}
class opdCachedStatement implements iopdStatement, Iterator
{
protected $stmt;
protected $opd;
protected $cache;
protected $cacheId;
protected $cacheDir;
protected $data;
protected $i;
public function __construct(opdClass $opd, $cacheStatus, $param2 = NULL, $param3 = NULL)
{
$this -> opd = $opd;
$this -> cache = $cacheStatus;
$this -> cacheDir = $this -> opd -> getCacheDirectory();
if($this -> cache)
{
$this -> cacheId = $param2;
if($this -> cacheId != NULL)
{
$this -> opd -> startTimer(true, true);
$this -> data = unserialize(file_get_contents($this->cacheDir.'%%'.$this->cacheId.'.php'));
$this -> opd -> endTimer();
}
}
else
{
$this -> cacheId = $param3;
$this -> stmt = $param2;
}
// set the cursor at the starting position
$this -> i = 0;
} // end __construct();
public function bindColumn($column, &$param, $type = NULL)
{
return false;
} // end bindColumn();
public function bindParam($parameter, &$variable, $dataType = NULL, $length = NULL, $driverOptions = NULL)
{
return false;
} // end bindParam();
public function bindValue($parameter, $value, $dataType = NULL)
{
return false;
} // end bindValue();
public function closeCursor()
{
$this -> opd -> endDebugDefinition(count($this -> data));
if(!$this -> cache)
{
file_put_contents($this->cacheDir.'%%'.$this->cacheId.'.php', serialize($this->data));
return $this -> stmt -> closeCursor();
}
return 1;
} // end closeCursor();
public function columnCount()
{
return $this -> stmt -> columnCount();
} // end columnCount();
public function errorCode()
{
return $this -> stmt -> errorCode();
} // end errorCode();
public function errorInfo()
{
return $this -> stmt -> errorInfo();
} // end errorInfo();
public function execute($inputParameters = NULL)
{
return false;
} // end execute();
public function fetch($fetchStyle = PDO::FETCH_ASSOC, $orientation = PDO::FETCH_ORI_NEXT, $offset = NULL)
{
if(!$this -> cache)
{
if($offset == NULL)
{
if($data = $this -> stmt -> fetch($fetchStyle, $orientation))
{
$this -> data[$this->i] = $data;
$this -> i++;
return $data;
}
}
else
{
if($data = $this -> stmt -> fetch($fetchStyle, $orientation, $offset))
{
$this -> data[$this->i] = $data;
$this -> i++;
return $data;
}
}
}
else
{
if(isset($this->data[$this->i]))
{
return $this->data[$this->i++];
}
}
} // end fetch();
public function fetchAll($fetchStyle = PDO::FETCH_BOTH, $columnIndex = 0)
{
if(!$this -> cache)
{
if($fetchStyle == PDO::FETCH_COLUMN)
{
return $this -> data = $this -> stmt -> fetchAll($fetchStyle, $columnIndex);
}
else
{
return $this -> data = $this -> stmt -> fetchAll($fetchStyle);
}
}
else
{
return $this -> data;
}
} // end fetchAll();
public function fetchColumn($columnNumber = 1)
{
if(!$this -> cache)
{
return $this -> data[$this->i++] = $this -> stmt -> fetchColumn($columnNumber);
}
else
{
return $this -> data[$this->i++];
}
} // end fetchColumn();
public function getAttribute($attribute)
{
return $this -> stmt -> getAttribute($attribute);
} // end getAttribute();
public function getColumnMeta($column)
{
return $this -> stmt -> getColumnMeta($column);
} // end getColumnMeta();
public function nextRowset()
{
return $this -> stmt -> nextRowset();
} // end nextRowset();
public function rowCount()
{
return $this -> stmt -> rowCount();
} // end rowCount();
public function setAttribute($attribute, $value)
{
return $this -> stmt -> setAttribute($attribute, $value);
} // end setAttribute();
public function setFetchMode($mode, $className = NULL)
{
if($this -> cache)
{
return 1;
}
if($mode == PDO::FETCH_CLASS)
{
return $this -> stmt -> setFetchMode($mode, $className);
}
return $this -> stmt -> setFetchMode($mode);
} // end setFetchMode();
public function setCache($id)
{
$this -> cacheId = $id;
} // end setCache();
/*
* ITERATOR INTERFACE IMPLEMENTATION
*/
public function current()
{
return $this -> data[$this->i-1];
} // end current();
public function key()
{
return $this -> i - 1;
} // end key();
public function valid()
{
if($this -> fetch())
{
return true;
}
$this -> closeCursor();
return false;
} // end valid();
public function next()
{
} // end next();
public function rewind()
{
} // end rewind();
}
class opdPreparedCacheStatement extends opdCachedStatement
{
private $j;
private $cacheIds;
public function __construct(opdClass $opd, Array $itemList, $stmt, $query)
{
$this -> query = $query;
$this -> opd = $opd;
$this -> cacheDir = $this -> opd -> getCacheDirectory();
$this -> cacheIds = $itemList;
$this -> stmt = $stmt;
// set the cursor at the starting position
$this -> i = 0;
$this -> j = 0;
$this -> cache = $this -> cacheIds[$this->j]['test'];
} // end __construct();
public function execute($inputParameters = NULL)
{
if(!isset($this -> cacheIds[$this->j]['test']))
{
return false;
}
$this -> opd -> beginDebugDefinition($this -> query);
$this -> i = 0;
if($this -> cacheIds[$this->j]['test'] == true)
{
$this -> cache = true;
$this -> cacheId = $this -> cacheIds[$this->j]['id'];
$this -> opd -> startTimer(true, true);
$this -> data = unserialize(file_get_contents($this->cacheDir.'%%'.$this->cacheId.'.php'));
$this -> opd -> endTimer();
}
else
{
$this -> cache = false;
$this -> cacheId = $this -> cacheIds[$this->j]['id'];
$this -> data = array();
if($inputParameters == NULL)
{
$this -> opd -> startTimer(true, false);
$result = $this -> stmt -> execute();
$this -> opd -> endTimer();
}
else
{
$this -> opd -> startTimer(true, false);
$result = $this -> stmt -> execute($inputParameters);
$this -> opd -> endTimer();
}
return $result;
}
} // end execute();
public function bindColumn($column, &$param, $type = NULL)
{
if(!$this -> cache)
{
if($type == NULL)
{
return $this -> stmt -> bindColumn($column, $param);
}
return $this -> stmt -> bindColumn($column, $param, $type);
}
return true;
} // end bindColumn();
public function bindParam($parameter, &$variable, $dataType = NULL, $length = NULL, $driverOptions = NULL)
{
if(!$this -> cache)
{
if($dataType == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable);
}
elseif($length == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable, $dataType);
}
elseif($driverOptions == NULL)
{
return $this -> stmt -> bindParam($parameter, $variable, $dataType, $length);
}
return $this -> stmt -> bindParam($parameter, $variable, $dataType, $length, $driverOptions);
}
return true;
} // end bindParam();
public function bindValue($parameter, $value, $dataType = NULL)
{
if(!$this -> cache)
{
if($dataType == NULL)
{
return $this -> stmt -> bindValue($parameter, $value);
}
return $this -> stmt -> bindValue($parameter, $value, $dataType);
}
return true;
} // end bindValue();
public function closeCursor()
{
if($this -> cacheId == false)
{
$this -> opd -> endDebugDefinition($this -> i);
return $this -> stmt -> closeCursor();
}
$result = parent::closeCursor();
$this -> j++;
if(isset($this -> cacheIds[$this->j]))
{
$this -> cache = $this -> cacheIds[$this->j]['test'];
}
return $result;
} // end closeCursor();
public function fetch($fetchStyle = PDO::FETCH_ASSOC, $orientation = PDO::FETCH_ORI_NEXT, $offset = NULL)
{
if($this -> cacheId == false)
{
return $this -> stmt -> fetch($fetchStyle, $orientation, $offset);
}
return parent::fetch($fetchStyle, $orientation, $offset);
} // end fetch();
public function fetchAll($fetchStyle = PDO::FETCH_BOTH, $columnIndex = 0)
{
if($fetchStyle == PDO::FETCH_COLUMN)
{
if($this -> cacheId == false)
{
return $this -> stmt -> fetch($fetchStyle, $columnIndex);
}
return parent::fetchAll($fetchStyle, $columnIndex);
}
else
{
if($this -> cacheId == false)
{
return $this -> stmt -> fetch($fetchStyle);
}
return parent::fetchAll($fetchStyle);
}
} // end fetchAll();
public function fetchColumn($columnNumber = 1)
{
if($this -> cacheId == false)
{
return $this -> stmt -> fetch($columnNumber);
}
return parent::fetchColumn($columnNumber);
} // end fetchColumn();
}
?>

125
autoload/savant3/Error.php Normal file
View File

@@ -0,0 +1,125 @@
<?php
/**
*
* Provides a simple error class for Savant.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Error.php,v 1.5 2005/05/27 14:03:50 pmjones Exp $
*
*/
/**
*
* Provides a simple error class for Savant.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Error {
/**
*
* The error code, typically a Savant 'ERR_*' string.
*
* @access public
*
* @var string
*
*/
public $code = null;
/**
*
* An array of error-specific information.
*
* @access public
*
* @var array
*
*/
public $info = array();
/**
*
* The error severity level.
*
* @access public
*
* @var int
*
*/
public $level = E_USER_ERROR;
/**
*
* A debug backtrace for the error, if any.
*
* @access public
*
* @var array
*
*/
public $trace = null;
/**
*
* Constructor.
*
* @access public
*
* @param array $conf An associative array where the key is a
* Savant3_Error property and the value is the value for that
* property.
*
*/
public function __construct($conf = array())
{
// set public properties
foreach ($conf as $key => $val) {
$this->$key = $val;
}
// add a backtrace
if ($conf['trace'] === true) {
$this->trace = debug_backtrace();
}
}
/**
*
* Magic method for output dump.
*
* @access public
*
* @return void
*/
public function __toString()
{
ob_start();
echo get_class($this) . ': ';
print_r(get_object_vars($this));
return ob_get_clean();
}
}
?>

View File

@@ -0,0 +1,29 @@
<?php
/**
*
* Throws PHP5 exceptions for Savant.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Exception.php,v 1.1 2005/05/27 14:04:36 pmjones Exp $
*
*/
/**
*
* A simple Savant3_Exception class.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Exception extends Exception {
}
?>

Some files were not shown because too many files have changed in this diff Show More