forked from dtouzeau/artica
/
domains.joomla.php
218 lines (158 loc) · 5.35 KB
/
domains.joomla.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
<?php
include_once('ressources/class.templates.inc');
include_once('ressources/class.ldap.inc');
include_once('ressources/class.users.menus.inc');
include_once('ressources/class.joomla.php');
$access=true;
$users=new usersMenus();
if(!isset($_GET["ou"])){$access=false;}
if(!$users->AllowEditOuSecurity){$access=false;}
if($_SESSION["uid"]<>-100){if($_SESSION["ou"]<>$_GET["ou"]){$access=false;}}
if(!$access){
$tpl=new templates();
echo "alert('".$tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}')."');";
die();
}
if(isset($_GET["joomla-index"])){joomla_index();exit;}
if(isset($_GET["joomla-install"])){joomla_install();exit;}
if(isset($_GET["ldap_connection_user"])){joomla_save();exit;}
js();
function js(){
$tpl=new templates();
$title=$tpl->_ENGINE_parse_body('{APP_JOOMLA}');
$page=CurrentPageName();
$html="
function JoomlaStartPage(){
YahooWinS(700,'$page?joomla-index=yes&ou={$_GET["ou"]}','$title');
}
var x_JoomlaInstall= function (obj) {
var tempvalue=obj.responseText;
if(tempvalue.length>0){alert(tempvalue)};
JoomlaStartPage();
}
function JoomlaInstall(){
var XHR = new XHRConnection();
document.getElementById('logojoom').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';
XHR.appendData('joomla-install','{$_GET["ou"]}');
XHR.appendData('ou','{$_GET["ou"]}');
XHR.sendAndLoad('$page', 'GET',x_JoomlaInstall);
}
function SaveJoomlaForm(){
var XHR = new XHRConnection();
XHR.appendData('ldap_connection_user',document.getElementById('ldap_connection_user').value);
XHR.appendData('joomlaservername',document.getElementById('joomlaservername').value);
XHR.appendData('joomlaadminpassword',document.getElementById('joomlaadminpassword').value);
XHR.appendData('ou','{$_GET["ou"]}');
document.getElementById('joomforms').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';
XHR.sendAndLoad('$page', 'GET',x_JoomlaInstall);
}
JoomlaStartPage();";
echo $html;
}
function joomla_index(){
$sock=new sockets();
$joomlainstalled=trim($sock->getfile("IsJoomlaInstalled:{$_GET["ou"]}"));
if($joomlainstalled<>1){
echo joomla_must_install();exit;
}
$p=joomla_form1($_GET["ou"]);
$sock=new sockets();
$version=$sock->getfile("JoomlaOuVersion:{$_GET["ou"]}");
$sock=new sockets();
$ApacheGroupWarePort=$sock->GET_INFO("ApacheGroupWarePort");
$joomla=new joomla($_GET["ou"]);
if($joomla->params["CONF"]["joomlaservername"]<>null){
$www="<a href='#'
OnClick=\"javascript:s_PopUpFull('http://{$joomla->params["CONF"]["joomlaservername"]}:$ApacheGroupWarePort/administrator',800,600)\"
style='font-size:12px;font-weight:bold'
>
{administrator}:http://{$joomla->params["CONF"]["joomlaservername"]}:$ApacheGroupWarePort/administrator</a>
";
}
$html="
<H1>{APP_JOOMLA}</H1>
<table style='width:100%'>
<tr>
<td>
<div id='logojoom'><img src='img/mw_joomla_logo.png'></div>
</td>
<td width=99% valign='top'>
<div style='font-size:18px;font-weight:bold;padding-left:5px;'>Joomla v$version</div>$www
</td>
</tr>
<tr>
<td colspan=2><div id='joomforms' style='margin-top:5px;width:100%;height:300px;overflow:auto'>$p</div></td>
</tr>
</table>
";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html);
}
function joomla_must_install(){
$p=Paragraphe("64-folder-install.png","{install_your_joomla}","{install_your_joomla_text}","javascript:JoomlaInstall();");
$html="
<H1>{APP_JOOMLA_NOT_INSTALLED}</H1>
<table style='width:100%'>
<tr>
<td>
<div id='logojoom'><img src='img/mw_joomla_logo.png'></div>
</td>
<td>
<div id='joom-content' >$p</div>
</td>
</tr>
</table>
";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html);
}
function joomla_form1($ou){
$ldap=new clladp();
$joomla=new joomla($ou);
if($joomla->params["CONF"]["ldap_connection_user"]==null){
if($_SESSION["uid"]==-100){
$ldap_connection_user=$ldap->ldap_admin;
}else{
$ldap_connection_user=$_SESSION["uid"];
}
}else{
$ldap_connection_user=$joomla->params["CONF"]["ldap_connection_user"];
}
if($joomla->params["CONF"]["joomlaadminpassword"]==null){$joomla->params["CONF"]["joomlaadminpassword"]="secret";}
$html="<table style='width:100%'>
<tr>
<td class=legend>{joomlaservername}:</td>
<td>" . Field_text('joomlaservername',$joomla->params["CONF"]["joomlaservername"],'width:99%')."</td>
<td>" . help_icon('{joomlaservername_help}')."</td>
</tr>
<tr>
<td class=legend>{connection_user}:</td>
<td>" . Field_text('ldap_connection_user',$ldap_connection_user,'width:120px')."</td>
<td>" . help_icon('{connection_user_help}')."</td>
</tr>
<tr>
<td class=legend>{admin_password}:</td>
<td>" . Field_password('joomlaadminpassword',$joomla->params["CONF"]["joomlaadminpassword"])."</td>
<td>" . help_icon('{admin_password_help}')."</td>
</tr>
<tr><td colspan=3><hr></tr>
<tr><td colspan=3 align='right'><input type='button' value='{edit} »' OnClick=\"javascript:SaveJoomlaForm();\"></td></tr>
</table>";
$html=RoundedLightWhite($html);
$tpl=new templates();
return $tpl->_ENGINE_parse_body($html);
}
function joomla_install(){
$ou=$_GET["joomla-install"];
$sock=new sockets();
$datas=$sock->getfile("JoomlaInstall:$ou");
}
function joomla_save(){
$ou=$_GET["ou"];
$joomla=new joomla($ou);
while (list ($num, $ligne) = each ($_GET) ){
$joomla->params["CONF"][$num]=$ligne;
$joomla->SaveParams();
}
}
?>