-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadmin_chmod.php
More file actions
227 lines (106 loc) · 5.57 KB
/
admin_chmod.php
File metadata and controls
227 lines (106 loc) · 5.57 KB
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
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| http://e107.org
|
| PView Gallery by R.F. Carter
| ronald.fuchs@hhweb.de
+---------------------------------------------------------------+
*/
require_once("../../class2.php");
require_once(e_PLUGIN."pviewgallery/pview.class.php");
$PView = new PView;
// 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");
// Save values
if ($_POST['pv_admin'] == "admin_chmod") {
if ($_POST['pv_chmodsave'] == "on"){
if ($_POST['pv_chmod'] <> ""){
$sqlOK = $PView -> pviewUpdateDb("pview_config","chmod",$_POST['pv_chmod'],"text");
$ns->tablerender(LAN_ADMIN_55, $PView -> getAdminMsg($sqlOK));
} else {
$ns->tablerender(LAN_ADMIN_55, LAN_ADMIN_127);
}
} else {
$sqlOK = $PView -> pviewUpdateDb("pview_config","chmod","","text");
$ns->tablerender(LAN_ADMIN_55, $PView -> getAdminMsg($sqlOK));
}
// execute chmod
if ($_POST['pv_chmod'] <> ""){
$mask = umask(0777);
if (chmod(e_PLUGIN."pviewgallery",octdec($_POST['pv_chmod']))){
$out_CHMOD.= "<p style='color:green;'>".LAN_ADMIN_128_1."'pviewgallery'".LAN_ADMIN_128_2."</p>";
} else {
$out_CHMOD.= "<p style='color:red;'>".LAN_ADMIN_128_1."'pviewgallery'".LAN_ADMIN_128_3."<br />";
$out_CHMOD.= LAN_ADMIN_130."</p>";
}
if (chmod(e_PLUGIN."pviewgallery/gallery",octdec($_POST['pv_chmod']))){
$out_CHMOD.= "<p style='color:green;'>".LAN_ADMIN_128_1."'gallery'".LAN_ADMIN_128_2."</p>";
} else {
$out_CHMOD.= "<p style='color:red;'>".LAN_ADMIN_128_1."'gallery'".LAN_ADMIN_128_3."<br />";
$out_CHMOD.= LAN_ADMIN_130."</p>";
}
if (chmod(e_PLUGIN."pviewgallery/batch_upload",octdec($_POST['pv_chmod']))){
$out_CHMOD.= "<p style='color:green;'>".LAN_ADMIN_128_1."'batch_upload'".LAN_ADMIN_128_2."</p>";
} else {
$out_CHMOD.= "<p style='color:red;'>".LAN_ADMIN_128_1."'batch_upload'".LAN_ADMIN_128_3."<br />";
$out_CHMOD.= LAN_ADMIN_130."</p>";
}
umask($mask);
$ns->tablerender(LAN_ADMIN_129, $out_CHMOD);
}
}
// Config Table
$out_HTML.= "<form action='".e_SELF."' method='post'>";
$out_HTML.= "<input type='hidden' name='pv_admin' value='admin_chmod'>";
$out_HTML.= "<p>".LAN_ADMIN_131."<br />".LAN_ADMIN_132."</p>";
$out_HTML.= "<p>".LAN_ADMIN_133."<br />".LAN_ADMIN_134."</p>";
$out_HTML.= "<p style='font-weight:bold;'>".LAN_ADMIN_135."</p>";
$out_HTML.= "<p>".LAN_ADMIN_136."</p>";
$out_HTML.= "<table cellspacing='0' width='95%' class='fborder' style= margin-top:10px'>";
$out_HTML.= "<tr><td class='forumheader3' width='30%'>".LAN_ADMIN_137."</td><td class='forumheader3' width='70%'>";
$out_HTML.= "<table border='0px' width='100%'>";
// IMPORTANT!
clearstatcache();
if (is_readable(e_PLUGIN."pviewgallery") && is_writeable(e_PLUGIN."pviewgallery")){
$out_HTML.= "<tr><td>pviewgallery</td><td><span style='color:green;'>".LAN_ADMIN_138."</span></td><td>".substr(decoct(fileperms(e_PLUGIN."pviewgallery")), 2)."</td></tr>";
} else {
$out_HTML.= "<tr><td>pviewgallery</td><td><span style='color:red;'>".LAN_ADMIN_139."</span></td><td>".substr(decoct(fileperms(e_PLUGIN."pviewgallery")), 2)."</td></tr>";
}
if (is_readable(e_PLUGIN."pviewgallery/gallery") && is_writeable(e_PLUGIN."pviewgallery/gallery")){
$out_HTML.= "<tr><td>gallery</td><td><span style='color:green;'>".LAN_ADMIN_138."</span></td><td>".substr(decoct(fileperms(e_PLUGIN."pviewgallery/gallery")), 2)."</td></tr>";
} else{
$out_HTML.= "<tr><td>gallery</td><td><span style='color:red;'>".LAN_ADMIN_139."</span></td><td>".substr(decoct(fileperms(e_PLUGIN."pviewgallery/gallery")), 2)."</td></tr>";
}
if (is_readable(e_PLUGIN."pviewgallery/batch_upload") && is_writeable(e_PLUGIN."pviewgallery/batch_upload")){
$out_HTML.= "<tr><td>batch_upload</td><td><span style='color:green;'>".LAN_ADMIN_138."</span></td><td>".substr(decoct(fileperms(e_PLUGIN."pviewgallery/batch_upload")), 2)."</td></tr>";
} else {
$out_HTML.= "<tr><td>batch_upload</td><td><span style='color:red;'>".LAN_ADMIN_139."</span></td><td>".substr(decoct(fileperms(e_PLUGIN."pviewgallery/batch_upload")), 2)."</td></tr>";
}
$out_HTML.= "</table>";
$out_HTML.= "</td></tr>";
$out_HTML.= "<tr><td class='forumheader3'>".LAN_ADMIN_140."</td><td class='forumheader3'><input class='tbox' id='pv_chmod' name='pv_chmod' type='text' size='3' maxlength='3' value='".$PView -> getPView_config('chmod')."' /></td></tr>";
$out_HTML.= "<tr><td class='forumheader3' width='30%'>".LAN_ADMIN_141."</td><td class='forumheader3' width='70%'><input class='tbox' type='checkbox' id='pv_chmodsave' name='pv_chmodsave' value='on' ";
if ($PView -> getPView_config('chmod')) {
$out_HTML.= "checked='checked' ";
}
$out_HTML.= "/><br />".LAN_ADMIN_142."</td></tr>";
$out_HTML.= "</table>";
$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_126, $out_HTML);
require_once(e_ADMIN."footer.php");