-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadmin_startpage.php
303 lines (132 loc) · 7.04 KB
/
admin_startpage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| http://e107.org
|
| PView Gallery by R.F. Carter
+---------------------------------------------------------------+
*/
require_once("../../class2.php");
require_once(e_PLUGIN."pviewgallery/pview.class.php");
$PView = new PView;
global $tp;
// Include plugin language file, check first for site's preferred language
if (file_exists(e_PLUGIN . "pviewgallery/languages/" . e_LANGUAGE . ".php")){
include_once(e_PLUGIN."pviewgallery/languages/".e_LANGUAGE.".php");
}
else
{
include_once(e_PLUGIN . "pviewgallery/languages/German.php");
}
// Check current user is an admin, redirect to main site if not
if (!getperms("P")) {
header("location:".e_HTTP."index.php");
exit;
}
// Include page header stuff for admin pages
require_once(e_ADMIN."auth.php");
// predefine static arrays
// selectbox text
$pageArray = array("classic" => LAN_ADMIN_171,"advanced" => LAN_ADMIN_172);
// options text (1: latest, 2: random, 3: not used in this moment)
$optionArray = array("1"=>LAN_ADMIN_190,"2"=>LAN_ADMIN_191);
// Save values
if ($_POST['pv_admin'] == "admin_startpage") {
$sqlOK = $PView -> pviewUpdateDb("pview_config","start_page",$_POST['pv_start_page'],$pageArray);
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_short",$_POST['pv_stat_short'][0]."|".$_POST['pv_stat_short'][1]."|".$_POST['pv_stat_short'][2],"text");
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_album",$_POST['pv_stat_album'][0]."|".$_POST['pv_stat_album'][1]."|".$_POST['pv_stat_album'][2],"text");
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_cat",$_POST['pv_stat_cat'][0]."|".$_POST['pv_stat_cat'][1]."|".$_POST['pv_stat_cat'][2],"text");
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_comm",$_POST['pv_stat_comm'][0]."|".$_POST['pv_stat_comm'][1]."|".$_POST['pv_stat_comm'][2],"text");
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_img",$_POST['pv_stat_img'][0]."|".$_POST['pv_stat_img'][1]."|".$_POST['pv_stat_img'][2],"text");
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_imgRating",$_POST['pv_stat_imgRating'][0]."|".$_POST['pv_stat_imgRating'][1]."|".$_POST['pv_stat_imgRating'][2],"text");
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_imgViews",$_POST['pv_stat_imgViews'][0]."|".$_POST['pv_stat_imgViews'][1]."|".$_POST['pv_stat_imgViews'][2],"text");
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_Uploader",$_POST['pv_stat_Uploader'][0]."|".$_POST['pv_stat_Uploader'][1]."|".$_POST['pv_stat_Uploader'][2],"text");
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_userComm",$_POST['pv_stat_userComm'][0]."|".$_POST['pv_stat_userComm'][1]."|".$_POST['pv_stat_userComm'][2],"text");
$sqlOK = $sqlOK & $PView -> pviewUpdateDb("pview_config","stat_userGals",$_POST['pv_stat_userGals'][0]."|".$_POST['pv_stat_userGals'][1]."|".$_POST['pv_stat_userGals'][2],"text");
$ns->tablerender(LAN_ADMIN_55, $PView -> getAdminMsg($sqlOK));
}
// prepare list order
$listArray = $PView->getFrontpageArray();
// prepare admin panel view
if ($PView -> getPView_config('start_page') == "advanced") {
$divStyle = "block";
} else {
$divStyle = "none";
}
// Config Table
$out_HTML.= "<script type='text/javascript' src='pview.js'></script>";
$out_HTML.= "<form action='".e_SELF."' method='post'>";
$out_HTML.= "<input type='hidden' name='pv_admin' value='admin_startpage'>";
$out_HTML.= "<table cellspacing='0' width='95%' class='fborder' style= margin-top:10px'>";
$out_HTML.= "<tr><td class='forumheader3'>".LAN_ADMIN_170."</td><td class='forumheader3'><select class='tbox' id='pv_start_page' name='pv_start_page' onchange='javascript:pv_frontpageswitcher()'>";
foreach ($pageArray as $key => $dataset) {
if ($key == $PView -> getPView_config('start_page')) {
$out_HTML.= "<option value='".$key."' selected>".$dataset."</option>";
} else {
$out_HTML.= "<option value='".$key."' >".$dataset."</option>";
}
}
$out_HTML.= "</select></td></tr>";
$out_HTML.= "</table><br />";
// frontpage values
$out_HTML.= "<div id='pview_start_advanced' style='display:".$divStyle."'>";
$out_HTML.= "<table cellspacing='0' width='95%' class='fborder' style= margin-top:10px'>";
$out_HTML.= "<tr><td class='fcaption'>".LAN_ADMIN_186."</td><td class='fcaption'>".LAN_ADMIN_187."</td><td class='fcaption'>".LAN_ADMIN_188."</td><td class='fcaption'>".LAN_ADMIN_189."</td></tr>";
foreach ($listArray as $key => $dataset) {
$elementArray = explode("|",$dataset);
$out_Option = "";
if ($elementArray[2]) {
// prepare options:
$out_Option = "<select class='tbox' id='pv_".$key."[2]' name='pv_".$key."[2]'>";
foreach ($optionArray as $optionKey=>$optionValue) {
if ($elementArray[2] == $optionKey) {
$selText = " selected";
} else {
$selText = "";
}
$out_Option.= "<option value='".$optionKey."'".$selText.">".$optionValue."</option>";
}
$out_Option.= "</select>";
}
if ($key == "stat_short") {
// activation/deactivation via checkbox
if ($elementArray[1]) {
$shortStatSelect = "checked='checked' ";
}
$out_HTML.= "<tr><td class='forumheader3'>".getModuleDescription($key)."</td><td class='forumheader3'>".$out_Option."</td><td class='forumheader3'><input class='tbox' id='pv_".$key."[1]' name='pv_".$key."[1]' type='checkbox' value='1'".$shortStatSelect." /></td><td class='forumheader3'>".$PView->getOrderSelector($key."[0]",10,$elementArray[0])."</td></tr>";
} else {
$out_HTML.= "<tr><td class='forumheader3'>".getModuleDescription($key)."</td><td class='forumheader3'>".$out_Option."</td><td class='forumheader3'><input class='tbox' id='pv_".$key."[1]' name='pv_".$key."[1]' type='text' size='2' maxlength='2' value='".$elementArray[1]."' /></td><td class='forumheader3'>".$PView->getOrderSelector($key."[0]",10,$elementArray[0])."</td></tr>";
}
}
$out_HTML.= "</table>";
$out_HTML.= "</div>";
$out_HTML.= "<div style='padding:10px; text-align:center;'><input class='button' id='pv_submitbtn' name='pv_submitbtn' type='submit' value='".LAN_ADMIN_23."'> ";
$out_HTML.= "</form>";
$ns->tablerender(LAN_ADMIN_169, $out_HTML);
function getModuleDescription($listIndex){
switch ($listIndex) {
case "stat_short":
return LAN_ADMIN_176;
case "stat_album":
return LAN_ADMIN_177;
case "stat_cat":
return LAN_ADMIN_178;
case "stat_comm":
return LAN_ADMIN_179;
case "stat_img":
return LAN_ADMIN_180;
case "stat_imgRating":
return LAN_ADMIN_181;
case "stat_imgViews":
return LAN_ADMIN_182;
case "stat_Uploader":
return LAN_ADMIN_183;
case "stat_userComm":
return LAN_ADMIN_184;
case "stat_userGals":
return LAN_ADMIN_185;
}
}
require_once(e_ADMIN."footer.php");