forked from poppyred/1.6.x
/
home.binding.php
executable file
·266 lines (194 loc) · 7.42 KB
/
home.binding.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<?php
session_start();
include_once('ressources/class.templates.inc');
include_once('ressources/class.ldap.inc');
include_once('ressources/class.users.menus.inc');
include_once('ressources/class.pure-ftpd.inc');
include_once('ressources/class.user.inc');
include_once('ressources/class.ini.inc');
//permissions
$usersprivs=new usersMenus();
if(!$usersprivs->AllowAddUsers){$tpl=new templates();echo $tpl->_ENGINE_parse_body("alert('{ERROR_NO_PRIVS}')");die();}
if(isset($_GET["homebind"])){homebind_page();exit;}
if(isset($_GET["homebind-add"])){homebind_add();exit;}
if(isset($_GET["homebind-list"])){echo homebind_list($_GET["homebind-list"]);exit;}
if(isset($_GET["homebind-mount"])){homebind_mount();exit;}
if(isset($_GET["homebind-umount"])){homebind_umount();exit;}
if(isset($_GET["homebind-dmount"])){homebind_dmount();exit;}
js();
function js(){
$tpl=new templates();
$title=$tpl->_ENGINE_parse_body('{HomeBinding}');
$page=CurrentPageName();
$userid=$_GET["userid"];
$html="
var mem_section='';
function LoadHomeBind(){
YahooWin5(550,'$page?homebind=yes&userid=$userid','$title::$userid');
}
var x_HomeBindAdd= function (obj) {
var response=obj.responseText;
if (response.length>0){alert(response);}
LoadAjax('HomeBindingList','$page?homebind-list=$userid');
}
function HomeBindAdd(){
var XHR = new XHRConnection();
XHR.appendData('homebind-add',document.getElementById('homeDirectoryBinded').value);
XHR.appendData('userid','$userid');
document.getElementById('HomeBindingList').innerHTML='<img src=\"img/wait_verybig.gif\">';
XHR.sendAndLoad('$page', 'GET',x_HomeBindAdd);
}
function homebindMount(num){
var XHR = new XHRConnection();
XHR.appendData('homebind-mount',num);
XHR.appendData('userid','$userid');
document.getElementById('HomeBindingList').innerHTML='<img src=\"img/wait_verybig.gif\">';
XHR.sendAndLoad('$page', 'GET',x_HomeBindAdd);
}
function homebindUMount(num){
var XHR = new XHRConnection();
XHR.appendData('homebind-umount',num);
XHR.appendData('userid','$userid');
document.getElementById('HomeBindingList').innerHTML='<img src=\"img/wait_verybig.gif\">';
XHR.sendAndLoad('$page', 'GET',x_HomeBindAdd);
}
function homebindDMount(num){
var XHR = new XHRConnection();
XHR.appendData('homebind-dmount',num);
XHR.appendData('userid','$userid');
document.getElementById('HomeBindingList').innerHTML='<img src=\"img/wait_verybig.gif\">';
XHR.sendAndLoad('$page', 'GET',x_HomeBindAdd);
}
function CompleteNameCheck(event){
if(checkEnter(event)){CompleteNameEdit();}
}
function CompleteNameFill(){
if(!document.getElementById('givenName1')){
setTimeout('CompleteNameFill()',500);
return false;
}
var givenname=document.getElementById('givenName').value;
var sn=document.getElementById('sn').value;
document.getElementById('givenName1').value=givenname;
document.getElementById('sn1').value=sn;
}
function CompleteNameEdit(){
var givenname=document.getElementById('givenName1').value;
var sn=document.getElementById('sn1').value;
document.getElementById('givenName').value=givenname;
document.getElementById('sn').value=sn;
document.getElementById('displayName').value=givenname+' '+sn;
YahooWin6Hide();
}
function ContactTabs(num){
employeeNumber=document.getElementById('employeeNumber').value;
LoadAjax('contact_section','$page?section='+num+'&employeeNumber='+employeeNumber);
LoadAjax('tabs','$page?section='+num+'&employeeNumber='+employeeNumber+'&showtab=yes');
}
function x_EditContact(){
alert(mem_section);
}
function EditContactCheck(event){
if(checkEnter(event)){EditContact('FFM_CONTACT_PAGE');}
}
function EditContact(Form_name){
employeeNumber=document.getElementById('employeeNumber').value;
mem_section=document.getElementById('tab').value;
ParseForm(Form_name,'$page',true,false,false,'contact_section','$page?section='+mem_section+'&employeeNumber='+employeeNumber,x_EditContact);
}
var x_ContactDelete= function (obj) {
var response=obj.responseText;
if (response.length>0){alert(response);}
YahooWin5Hide();
}
function ContactDelete(dn){
var XHR = new XHRConnection();
XHR.appendData('delete-contact',dn);
document.getElementById('contact_section').innerHTML='<img src=\"img/wait_verybig.gif\">';
XHR.sendAndLoad('$page', 'GET',x_ContactDelete);
}
LoadHomeBind();
";
echo $html;
}
function homebind_page(){
$userid=$_GET["userid"];
$ct=new user($userid);
$HomeDirectory=$ct->homeDirectory;
$homebind_list=homebind_list($userid);
$html="<H1>{HomeBinding}</H1>
<strong style='font-size:13px'>$HomeDirectory</strong>
<table style='width:99%' class=form>
<tr>
<td class=legend>{directory}:</td>
<td>" . Field_text("homeDirectoryBinded",null)."</td>
<td><input type='button' OnClick=\"javascript:Loadjs('SambaBrowse.php?field=homeDirectoryBinded&no-shares=yes');\" value='{browse}...'>
<td><input type='button' OnClick=\"javascript:HomeBindAdd();\" value='{add} »'>
</tr>
</table>
<br>
" . RoundedLightWhite("<div id='HomeBindingList' style='width:100%;height:200px;overflow:auto'>$homebind_list</div>")."
";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html);
}
function homebind_list($userid){
$user=new user($userid);
if(!is_array($user->homeDirectoryBinded)){return null;}
$html="<table style='width:100%'>
<tr>
<th colspan=2>{source}</th>
<th colspan=3>{target}</th>
</tr>";
$sock=new sockets();
while (list ($num, $val) = each ($user->homeDirectoryBinded) ){
if($val==null){return null;}
if(strlen($val)>39){$dir=texttooltip(substr($val,0,36)."...",$val);}else{$dir=$val;}
$tt=$user->homeDirectory."/" . basename($val);
if(strlen($tt)>39){$dir=texttooltip(substr($tt,0,36)."...",$tt);}
$mnt=trim($sock->getfile("ismounted:$val;$tt"));
if($mnt=="FALSE"){
$img=imgtootltip("status_critical.png",'{error_not_mounted},{click_to_mount}',"homebindMount($num)");
}else{
$img=imgtootltip("status_ok.png",'{mounted},{click_to_dismount}',"homebindUMount($num)");
}
$html=$html."
<tr " . CellRollOver().">
<td width=1% valign='middle'>$img</td>
<td width=50% valign='middle'>$dir</td>
<td width=1% valign='middle'><img src='img/fw_bold.gif'></td>
<td width=50% valign='middle'>$tt</strong></td>
<td width=1% valign='middle'>" . imgtootltip("ed_delete.gif","{delete}","homebindDMount($num)")."</td>
</tr>
";
}
$html=$html."</table>";
$tpl=new templates();
return $tpl->_ENGINE_parse_body($html);
}
function homebind_add(){
$user=new user($_GET["userid"]);
$user->add_homeDirectoryBinded($_GET["homebind-add"]);
}
function homebind_mount(){
$index=$_GET["homebind-mount"];
$user=new user($_GET["userid"]);
$target=$user->homeDirectoryBinded[$index];
$sock=new sockets();
$datas=trim($sock->getfile("homeDirectoryBinded:$user->homeDirectory;$target"));
echo $datas;
}
function homebind_umount(){
$index=$_GET["homebind-umount"];
$user=new user($_GET["userid"]);
$target=$user->homeDirectoryBinded[$index];
$sock=new sockets();
$datas=trim($sock->getfile("homeDirectoryUBinded:$user->homeDirectory;$target"));
echo $datas;
}
function homebind_dmount(){
$index=$_GET["homebind-dmount"];
$user=new user($_GET["userid"]);
$user->delete_homeDirectoryBinded($user->homeDirectoryBinded[$index]);
}
?>