forked from poppyred/1.6.x
/
exec.articaget.php
executable file
·79 lines (60 loc) · 2.99 KB
/
exec.articaget.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
<?php
if(isset($_GET["verbose"])){$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);}
include_once('ressources/class.templates.inc');
include_once('ressources/class.ldap.inc');
include_once('ressources/class.mysql.inc');
include_once('ressources/class.freeweb.inc');
include_once('ressources/class.backup.inc');
if(!isset($_GET["params"])){die("<ERROR>Protocol Error</ERROR>");}
$array=unserialize(base64_decode($_GET["params"]));
if(!is_array($array)){die("<ERROR>Protocol Error</ERROR>");}
$RemoteArticaServer=$array["RemoteArticaServer"];
$RemoteArticaPort=$array["RemoteArticaPort"];
$RemoteArticaUser=$array["RemoteArticaUser"];
$RemoteArticaPassword=$array["RemoteArticaPassword"];
$RemoteArticaSite=$array["RemoteArticaSite"];
if($RemoteArticaSite==null){die("<ERROR>Protocol Error: missing FreeWeb website</ERROR>");}
if(!authProto($RemoteArticaUser,$RemoteArticaPassword,$RemoteArticaSite)){die("<ERROR>Authentication failed</ERROR>");}
if(isset($_GET["remove"])){remove_container($array);die();}
SendBackup($array);
function authProto($RemoteArticaUser,$RemoteArticaPassword){
if($RemoteArticaUser==null){return false;}
include("ressources/settings.inc");
$md5Manager=md5(trim($_GLOBAL["ldap_password"]));
if(trim(strtolower($_GLOBAL["ldap_admin"]))==trim(strtolower($RemoteArticaUser))){
if($md5Manager<>$RemoteArticaPassword){return false;}
return true;
}
$free=new freeweb($RemoteArticaSite);
if($free->uid==null){return false;}
if($free->uid<>$RemoteArticaUser){return false;}
$u=new user($RemoteArticaUser);
$userPassword=$u->password;
if($RemoteArticaPassword<>md5(trim($userPassword))){return false;}
return true;
}
function remove_container($array){
$RemoteArticaServer=$array["RemoteArticaServer"];
$RemoteArticaPort=$array["RemoteArticaServer"];
$RemoteArticaUser=$array["RemoteArticaUser"];
$RemoteArticaPassword=$array["RemoteArticaPassword"];
$RemoteArticaSite=$array["RemoteArticaSite"];
$targetpackage=dirname(__FILE__)."/ressources/logs/web/$RemoteArticaSite.tar.gz";
if(is_file($targetpackage)){@unlink($targetpackage);}
}
function SendBackup($array){
$RemoteArticaServer=$array["RemoteArticaServer"];
$RemoteArticaPort=$array["RemoteArticaServer"];
$RemoteArticaUser=$array["RemoteArticaUser"];
$RemoteArticaPassword=$array["RemoteArticaPassword"];
$RemoteArticaSite=$array["RemoteArticaSite"];
if($RemoteArticaSite==null){die("<ERROR>Protocol Error: missing FreeWeb website line:". __LINE__."</ERROR>");}
$sock=new sockets();
$targetpackage=dirname(__FILE__)."/ressources/logs/web/$RemoteArticaSite.tar.gz";
$datas=base64_decode($sock->getFrameWork("freeweb.php?articaget=$RemoteArticaSite"));
if(!is_file($targetpackage)){
echo "<LOGS>SITE:`$RemoteArticaSite`\n------------------\n$targetpackage no sich file</LOGS>\n\n<RESULTS>FAILED</RESULTS>";
die();
}
echo $datas."<LOGS>$datas</LOGS>\n\n<RESULTS>SUCCESS</RESULTS>";
}