Initialized repository
[simplecm.git] / plugins / admin / option / updater.php
blobf49b567a023f1903a2cfc597ea614a45a4d2e5ce
1 <?php
3 if($_SESSION["admin"] == "admin"){
4 $loggedin = yes;
5 #if($_SESSION["username"] !== "admin"){ echo "Under Construction"; exit;}
7 if(!$loggedin){exit;}
8 //$ver = "0.2.0";
9 $xmlfile = file_get_contents('http://' . $updserver . '/update_routines.php?ver='.$ver);
10 file_put_contents("file.xml", $xmlfile);
11 $doc = new DOMDocument();
12 $doc->load("file.xml");
14 $files = $doc->getElementsByTagName( "file" );
15 foreach( $files as $file )
17 $names = $file->getElementsByTagName( "name" );
18 $name = $names->item(0)->nodeValue;
20 $workingpaths = $file->getElementsByTagName( "workingpath" );
21 $workingpath = $workingpaths->item(0)->nodeValue;
23 $usedbys = $file->getElementsByTagName( "usedby" );
24 $usedby = $usedbys->item(0)->nodeValue;
25 $filepath = $syspath . $workingpath . $name;
26 $file = file_get_contents('http://' . $updserver . '/' . $ver . '/updates/' . $name);
27 file_put_contents($fspath . $filepath, $file);
28 echo "$name - $workingpath - $usedby<br>";
31 <br><br>
32 File Listed Above were successfully updated