
Untitled
By: a guest on
Jun 2nd, 2012 | syntax:
None | size: 2.00 KB | hits: 12 | expires: Never
<?php
/*
@author Geert Roumen
@license Creative Commons
Attribution-NonCommercial-ShareAlike
3.0 Unported
@web http://lemio.nl/
@name Untis to xml
description
---
This script is made to enable people to hack (making Android apps)
with the table system called Untis.
The most important part of the export is the courses. The ID says
when the course is; 1 is monday the first hour, 5 friday the first
hour, 40 is Friday to 8th hour.
*/
header("Content-type: text/plain");
echo "<?xml version=\"1.0\"?>\n";
function at_line($line,$text){
$array = split("\r\n",$text);
return $array[$line];
}
function get_text_content($url) {
return strip_tags(file_get_contents($url));
}
if (!$file = file_get_contents("https://beheer.ostrealyceum.nl/Clients/1/htdocs/1/rooster/dagrooster/45/s/s".$_GET["s"].".htm")){
echo "fout bij verbinden";
}
//print_r();
echo "<author>Geert Roumen</author>\n";
echo "<student>\n";
echo "<id>\n";
echo at_line(12, $file);
echo "\n</id>\n";
echo "<name>\n";
echo at_line(14, $file);
echo "\n</name>\n";
echo "<class>\n";
echo strip_tags(at_line(16, $file));
echo "\n</class>\n";
$array = split("<TD colspan=6 rowspan=2 align=\"center\" nowrap=\"1\">",$file);
for ($i=0;$i<40;$i++){
$file = $array[$i];
$file = strip_tags($file);
$file = str_replace("\r\n","",$file);
$file = str_replace(".","",$file);
preg_match_all("/([A-Z\?\.\-]{3}) ([A-Z\.\?]{0,1}[0-9\.\?\-]{3}) ([a-z0-9\.\?\-]{2,4})/m",$file,$courses);
for ($j=0;isset($courses[1][$j]);$j++){
echo "<course id=$i";
if (strpos($array[$i],"FF0000")!==false){
echo " changed";
}
echo ">\n";
echo "<teacher>".$courses[1][$j]."</teacher>\n";
echo "<classroom>".$courses[2][$j]."</classroom>\n";
echo "<subject>".$courses[3][$j]."</subject>\n";
echo "</course>\n";
}
}
echo "</student>";
?>