diff options
-rw-r--r-- | includes_old/funktion_xml.php | 152 | ||||
-rw-r--r-- | includes_old/funktion_xml_room.php | 61 | ||||
-rw-r--r-- | includes_old/funktion_xml_schudle.php | 309 | ||||
-rw-r--r-- | www-ssl_old/admin/dbUpdateFromXLS.php | 252 |
4 files changed, 0 insertions, 774 deletions
diff --git a/includes_old/funktion_xml.php b/includes_old/funktion_xml.php deleted file mode 100644 index 4ab3bfd5..00000000 --- a/includes_old/funktion_xml.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php -class element { - var $name = ''; - var $attributes = array (); - var $data = ''; - var $depth = 0; - var $sub = array (); -} - -$XMLDEBUG = 0; -$depth = 0; -$XMLmain = new element; -$XMLpos = array ( - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 -); -//$XMLpos = array( 0, 0, 0, 0, 0, 0); - -function convertValues($Data) { - global $XMLDEBUG; - - if ($XMLDEBUG) { - $Data = htmlspecialchars($Data); - $Data = mysql_escape_string($Data); - $Data = htmlentities($Data); - } - - $Data = utf8_decode($Data); - return $Data; -} - -function dataXMLmain($Data, & $Objekt, $Tiefe) { - global $XMLmain, $XMLpos, $depth, $XMLDEBUG; - - if ($XMLDEBUG) - echo "?$Tiefe$depth"; - - if (($depth -1) == $Tiefe) { - $Objekt->sub[$XMLpos[$Tiefe]]->data .= htmlentities(convertValues($Data), ENT_QUOTES); - - if ($XMLDEBUG) - echo "???" . $Objekt->sub[$XMLpos[$Tiefe]]->name . "|$Data|$Tiefe???<br />"; - } else - dataXMLmain($Data, $Objekt->sub[$XMLpos[$Tiefe]], $Tiefe +1); -} - -function startXMLmain($Data, & $Objekt, $Tiefe) { - global $XMLpos, $depth, $XMLDEBUG; - - if ($XMLDEBUG) - if ($Tiefe == 1) { - print_r(array_values($XMLpos)); - echo "--" . $Data->name; - echo " #$Tiefe/$depth#"; - } - - if ($depth == $Tiefe) { - $Objekt->sub[$XMLpos[$Tiefe]] = $Data; - if ($XMLDEBUG) - echo "|" . $XMLpos[$Tiefe] . "|" . $Objekt->sub[$XMLpos[$Tiefe]]->name . " " . $Data->name . " save|" . "#-#<br />"; - } else - startXMLmain($Data, $Objekt->sub[$XMLpos[$Tiefe]], $Tiefe +1); -} - -function start_element_handler($parser, $name, $attribs) { - global $depth, $XMLmain, $XMLpos; - - $Data = new element; - $Data->name = $name; - while (list ($key, $value) = each($attribs)) - $Data->attributes[$key] = convertValues($value); - $Data->depth = $depth; - $XMLpos[$depth]++; - - if ($depth == 0) - $XMLmain = $Data; - else - startXMLmain($Data, $XMLmain, 1); - - $depth++; -} - -function end_element_handler($parser, $name) { - global $depth, $XMLpos; - $XMLpos[$depth] = 0; - $depth--; -} - -function character_data_handler($parser, $data) { - global $XMLmain; - if (strlen(trim($data))) - dataXMLmain($data, $XMLmain, 1); -} - -/*#######################################################################################*/ -function readXMLfile($file) { - global $XMLDEBUG; - - //$xml_parser = xml_parser_create_ns(); - $xml_parser = xml_parser_create("UTF-8"); - xml_set_element_handler($xml_parser, "start_element_handler", "end_element_handler"); - xml_set_character_data_handler($xml_parser, "character_data_handler"); - - if (file_exists($file)) { - if (!($fp = fopen($file, "r"))) { - echo (" <h1>could not open XML file \"$file\"</h1>"); - return -1; - } - } else { - echo (" <h1>XML file \"$file\" not exist</h1>"); - return -1; - } - - if ($XMLDEBUG) - echo "<pre>"; - while ($data = fread($fp, 4096)) { - if (!xml_parse($xml_parser, $data, feof($fp))) { - die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); - } - } - if ($XMLDEBUG) - echo "</pre>"; - xml_parser_free($xml_parser); - return 0; -} - -/*#######################################################################################*/ -function getXMLsubPease($Sourse, $Name) { - foreach ($Sourse->sub as $key => $value) { - if ($value->name == $Name) { - return $value; - } - } - // die; -} - -/*#######################################################################################*/ -function getXMLsubData($Sourse, $Name) { - $XML = getXMLsubPease($Sourse, $Name); - return $XML->data; -} -?> diff --git a/includes_old/funktion_xml_room.php b/includes_old/funktion_xml_room.php deleted file mode 100644 index f31d5661..00000000 --- a/includes_old/funktion_xml_room.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - echo "<h1>Rooms:</h1>\n"; - - function saveRoomData() { - global $con; - - if(isset($_GET["NameXML"])) { - $SQL = "INSERT INTO `Room` ( `Name`, `FromPentabarf` ) ". - "VALUES ('". mysql_escape_string($_GET["NameXML"]). "', 'Y');"; - $Erg = mysql_query($SQL, $con); - - if($Erg) - echo "Aenderung, an Raum ". $_GET["NameXML"]. ", war erfogreich<br />"; - else - echo "Aenderung, an Raum ". $_GET["NameXML"]. ", war <u>nicht</u> erfogreich.(". - - mysql_error($con). ")<br />[$SQL]<br />"; - } else - echo "Fehler in den Parametern!<br />"; - } - - if(isset($_GET["RoomUpdate"])) - saveRoomData(); - - // INIT Status counter - $DS_KO = 0; - - // Ausgabe - echo "<table border=\"0\">\n"; - echo "<tr><th>Name</th><th>state</th></tr>\n"; - - if($EnableSchudle) { - foreach($XMLmain->sub as $EventKey => $Event) { - if( $Event->name == "VEVENT") { - $NameXML = getXMLsubData( $Event, "LOCATION"); - - if( !isset( $RoomName[$NameXML])) { - $RoomName[$NameXML] = ""; - - if(isset($_GET["UpdateALL"])) { - $_GET["NameXML"] = $NameXML; - saveRoomData(); - CreateRoomArrays(); - } else { - echo "<form action=\"dbUpdateFromXLS.php\">\n"; - echo "<tr>\n"; - echo "<td><input name=\"NameXML\" type=\"text\" value=\"$NameXML\" readonly></td>\n"; - echo "<td><input type=\"submit\" name=\"RoomUpdate\" value=\"update\"></td>\n"; - $DS_KO++; - echo "</tr>\n"; - echo "</form>\n"; - echo "<br />"; - } - } - } - } - } - - echo "<tr><td colspan=\"6\">status: $DS_KO nicht vorhanden.</td></tr>\n"; - echo "</table>\n"; -?> diff --git a/includes_old/funktion_xml_schudle.php b/includes_old/funktion_xml_schudle.php deleted file mode 100644 index f73f11ad..00000000 --- a/includes_old/funktion_xml_schudle.php +++ /dev/null @@ -1,309 +0,0 @@ -<?php - -/*############################################################################################## - s c h e d u l e - ##############################################################################################*/ -echo "\n\n<h1>Schedule:</h1>\n"; - - -function SaveSchedule() -{ - global $RoomID, $RoomName; - global $con; - - if( isset($_GET["PSIDXML"]) && - isset($_GET["DateXML"]) && - isset($_GET["RIDXML"]) && - isset($_GET["LenXML"]) && - isset($_GET["ManXML"]) && - isset($_GET["URLXML"]) ) - { - //erzeuge von `DateE` - $TimeStart = substr( $_GET["DateXML"], 11, 2) + (substr($_GET["DateXML"], 14, 2)/60); - $TimeEnd = ($_GET["LenXML"] + $TimeStart) * 60; - $TimeM = $TimeEnd % 60; - $TimeH = ($TimeEnd - $TimeM)/60; - if( $TimeH>=24 ) - { - $TimeH -= 24; - $DateEnd = substr($_GET["DateXML"], 0, 8). - (substr($_GET["DateXML"], 8, 2)+1). " "; - } - else - $DateEnd = substr($_GET["DateXML"], 0, 11); - $DateEnd .= "$TimeH:$TimeM:00"; - - //Namen ermitteln - $_GET["RIDXML"] = $RoomName[$_GET["RIDXML"]]; - - //Update OR insert ? - $SQL1 = "Select `SID` FROM `Shifts` WHERE `PSID`='". $_GET["PSIDXML"]. "';"; - $Erg1 = mysql_query($SQL1, $con); - - if( mysql_num_rows($Erg1)==0) - { - echo "Aenderung, am Schedule '". $_GET["PSIDXML"]. "'"; - $SQL= "INSERT INTO `Shifts` (`PSID`, `DateS`, `DateE`, `Len`, `RID`, `Man`, `URL`) ". - "VALUES ('". $_GET["PSIDXML"]. "', ". - "'". $_GET["DateXML"]. "', ". - "'". $DateEnd. "', ". - "'". $_GET["LenXML"]. "', ". - "'". $_GET["RIDXML"]. "', ". - "'". mysql_escape_string($_GET["ManXML"]). "', ". - "'". $_GET["URLXML"]. "'". - ");"; - } - else - { - echo "Aenderung, am Schedule '". $_GET["PSIDXML"]. "' (SID ". - mysql_result( $Erg1, 0, "SID"). ")"; - $SQL= "UPDATE `Shifts` SET ". - "`DateS` = '". $_GET["DateXML"]. "', ". - "`DateE` = '". $DateEnd. "', ". - "`Len` = '". $_GET["LenXML"]. "', ". - "`RID` = '". $_GET["RIDXML"]. "', ". - "`Man` = '". mysql_escape_string($_GET["ManXML"]). "', ". - "`URL`= '". $_GET["URLXML"]. "' ". - "WHERE `PSID` = '". $_GET["PSIDXML"]. "' LIMIT 1;"; - } - $Erg = mysql_query($SQL, $con); - if( $Erg ) - { - echo ", war erfogreich<br />\n"; - - //SID auslesen - $SQL1 = "Select `SID` FROM `Shifts` WHERE `PSID`='". $_GET["PSIDXML"]. "';"; - $Erg1 = mysql_query($SQL1, $con); - $newSID = mysql_result($Erg1, 0, 0); - - // erstellt ein Array der Reume - $sql2 = "SELECT * FROM `Room` ". - "WHERE `RID`='".$_GET["RIDXML"]. "' ". - "ORDER BY `Number`, `Name`;"; - $Erg2 = mysql_query( $sql2, $con); - for( $j=0; $j<mysql_num_fields( $Erg2); $j++) - { - if( substr( mysql_field_name($Erg2, $j), 0, 12)=="DEFAULT_EID_" ) - { - // extract db values - $EngelNeeded = mysql_result($Erg2, 0, $j); - $EngelTypeID = substr( mysql_field_name($Erg2, $j), 12); - - - // chech exist shifts - $sqlShifts = "SELECT * FROM `ShiftEntry` ". - "WHERE `SID`='". $newSID. "' AND ". - "`TID` = '". $EngelTypeID. "';"; - $ErgShifts = mysql_query( $sqlShifts, $con); - $EngelNeeded_Exist = mysql_num_rows( $ErgShifts); - - // check for not empty shifts - $sqlShiftsNotEmpty = "SELECT * FROM `ShiftEntry` ". - "WHERE `SID`='". $newSID. "' AND ". - "`TID` = '". $EngelTypeID. "' AND ". - "`UID` != 0 ;"; - $ErgShiftsNotEmpty = mysql_query( $sqlShiftsNotEmpty, $con); - $EngelNeeded_NotEmpty = mysql_num_rows( $ErgShiftsNotEmpty); - - // Angel create/delte? - if( $EngelNeeded > $EngelNeeded_Exist) - { - echo "---->Create Shifts for engeltype: ". TID2Type($EngelTypeID). " ". - ($EngelNeeded-$EngelNeeded_Exist). "x<br />\n------>\n"; - for( $i=0; $i < ($EngelNeeded-$EngelNeeded_Exist); $i++ ) - { - $SQL3 = "INSERT INTO `ShiftEntry` (`SID`, `TID`) VALUES (". - "'". $newSID. "', ". - "'". $EngelTypeID. "');"; - $Erg3 = mysql_query($SQL3, $con); - if ($Erg3 == 1) - echo "pass "; - else - echo "fail <u>". mysql_error($con). - "</u>($SQL3)<br />\n"; - } - echo "<br />\n"; - } - else if ($EngelNeeded < $EngelNeeded_Exist) - { - if( $EngelNeeded > $EngelNeeded_NotEmpty) - { - $EngelMin = $EngelNeeded; - } - else - { - $EngelMin = $EngelNeeded_NotEmpty; - echo "---> WARING ". $EngelNeeded_NotEmpty. - " shift is used, can't del ". TID2Type($EngelTypeID). " shifts"; - } - - echo "---->Delete empty Shifts for engeltype: ". TID2Type($EngelTypeID). " ". - ($EngelNeeded_Exist-$EngelMin)."x<br />\n------>\n"; - for( $i=$EngelMin; $i<$EngelNeeded_Exist; $i++ ) - { - $SQL3 = "DELETE FROM `ShiftEntry` ". - "WHERE `SID` = ". $newSID. " AND ". - "`TID` = ". $EngelTypeID. " AND ". - "`UID` = 0 ". - "LIMIT 1;"; - $Erg3 = mysql_query($SQL3, $con); - if ($Erg3 == 1) - echo "pass "; - else - echo "fail <u>". mysql_error($con). - "</u>($SQL3)<br />\n"; - } - echo "<br />\n"; - } - else - { -// echo "---->Nothing to do, for engeltype: ". TID2Type($EngelTypeID). "<br />\n"; - } - } - } - - } - else - echo ", war <u>nicht</u> erfogreich.(". - mysql_error($con). ")<br />[$SQL]<br />\n"; - } - else - echo "Fehler in den Parametern!<br />"; -} /*SaveSchedule*/ - -if( isset($_GET["ScheduleUpdate"])) - SaveSchedule(); - -//INIT Status counter -$DS_OK = 0; -$DS_KO = 0; -$Where = ""; - -//ausgabe -echo "<table border=\"0\">\n"; -echo "<tr><th>PSID</th><th>Date</th>". - "<th>Room</th><th>Len</th><th>Name</th><th>state</th></tr>\n"; -echo "<tr align=\"center\"><td>XML - DB</td><td>XML - DB</td>". - "<td>XML - DB</td><td>XML - DB</td><td>XML - DB</td><td></td></tr>\n"; - -if( $EnableSchudle) -foreach($XMLmain->sub as $EventKey => $Event) -{ - if( $Event->name == "VEVENT") - { - echo "<form action=\"dbUpdateFromXLS.php\">\n"; - echo "<tr>\n"; - - $PSIDXML = getXMLsubData( $Event, "UID"); - $DateXML = - substr( getXMLsubData( $Event, "DTSTART"), 0, 4). "-". - substr( getXMLsubData( $Event, "DTSTART"), 4, 2). "-". - substr( getXMLsubData( $Event, "DTSTART"), 6, 2). " ". - substr( getXMLsubData( $Event, "DTSTART"), 9, 2). ":". - substr( getXMLsubData( $Event, "DTSTART"), 11,2). ":00"; - $LenXML = substr( getXMLsubData( $Event, "DURATION"), 0, 2) + ( substr( getXMLsubData( $Event, "DURATION"), 3, 2)/60); - $RIDXML = getXMLsubData( $Event, "LOCATION"); - $ManXML = getXMLsubData( $Event, "SUMMARY"); - $URLXML = getXMLsubData( $Event, "URL"); - - if( isset($_GET["UpdateALL"])) - { - $_GET["PSIDXML"] = $PSIDXML; - $_GET["DateXML"] = $DateXML; - $_GET["LenXML"] = $LenXML; - $_GET["RIDXML"] = $RIDXML; - $_GET["ManXML"] = $ManXML; - $_GET["URLXML"] = $URLXML; - SaveSchedule(); - } - - $SQL = "SELECT * FROM `Shifts` WHERE `PSID`='$PSIDXML'"; - $Erg = mysql_query($SQL, $con); - if(mysql_num_rows($Erg)>0) - { - $SIDDB = mysql_result($Erg, 0, "SID"); - $PSIDDB = mysql_result($Erg, 0, "PSID"); - $TimeDB = mysql_result($Erg, 0, "DateS"); - $LenDB = mysql_result($Erg, 0, "Len"); - if( isset($RoomID[mysql_result($Erg, 0, "RID")])) - $RIDDB = $RoomID[mysql_result($Erg, 0, "RID")]; - else - $RIDDB = "RID". mysql_result($Erg, 0, "RID"); - - $ManDB = mysql_result($Erg, 0, "Man"); - $URLDB = mysql_result($Erg, 0, "URL"); - } - else - $SIDDB = $PSIDDB = $TimeDB = $LenDB = $RIDDB = $ManDB = $URLDB = ""; - - echo "<td><input name=\"PSIDXML\" type=\"text\" value=\"$PSIDXML\" size=\"2\" eadonly></td>\n"; - echo "<td><input name=\"DateXML\" type=\"text\" value=\"$DateXML\" size=\"17\" readonly>\n". - "<input name=\"DateDB\" type=\"text\" value=\"$TimeDB\" size=\"17\" readonly></td>\n"; - echo "<td><input name=\"RIDXML\" type=\"text\" value=\"$RIDXML\" size=\"15\" readonly>\n". - "<input name=\"RIDDB\" type=\"text\" value=\"$RIDDB\" size=\"15\" readonly></td>\n"; - echo "<td><input name=\"LenXML\" type=\"text\" value=\"$LenXML\" size=\"1\"readonly>\n". - "<input name=\"LenDB\" type=\"text\" value=\"$LenDB\" size=\"1\"readonly></td>\n"; - echo "<td><input name=\"ManXML\" type=\"text\" value=\"$ManXML\" size=\"40\"readonly>\n". - "<input name=\"ManDB\" type=\"text\" value=\"$ManDB\" size=\"40\"readonly></td>\n"; - echo "<td><input name=\"URLXML\" type=\"hidden\" value=\"$URLXML\"></td>\n"; - echo "<td><input name=\"URLDB\" type=\"hidden\" value=\"$URLDB\"></td>\n"; - if( !( $PSIDXML==$PSIDDB && - $DateXML==$TimeDB && - $RIDXML==$RIDDB && - $LenXML==$LenDB && - $ManXML==$ManDB && - $URLXML==$URLDB) ) - { - echo "<td><input type=\"submit\" name=\"ScheduleUpdate\" value=\"update\"></td>\n"; - $DS_KO++; - } - else - { - echo "<td>". funktion_isLinkAllowed_addLink_OrLinkText("admin/schichtplan.php?action=change&SID=".$SIDDB, "edit"). "</td>\n"; - $DS_OK++; - } - echo "</tr>\n"; - echo "</form>\n"; - $Where.= " OR `PSID`='$PSIDXML'"; - } -} -echo "<tr><td colspan=\"6\">status: $DS_KO/$DS_OK nicht Aktuel.</td></tr>\n"; - - -//Anzeige von nicht im XML File vorkommende entraege -if( $Where =="") - $SQL2 = "SELECT * FROM `Shifts` WHERE NOT `PSID`='';"; -else - $SQL2 = "SELECT * FROM `Shifts` WHERE NOT (".substr( $Where, 4). ") AND NOT PSID = '';"; - -$Erg2 = mysql_query($SQL2, $con); -echo mysql_error($con); -if(mysql_num_rows($Erg2)>0 && $EnableSchudleDB ) - for( $i=0; $i<mysql_num_rows( $Erg2); $i++) - { - echo "<tr>\n"; - $SID = mysql_result($Erg2, $i, "SID"); - $Time = mysql_result($Erg2, $i, "DateS"); - $Len = mysql_result($Erg2, $i, "Len"); - if( isset($RoomID[ mysql_result($Erg2, $i, "RID")])) - $RID = $RoomID[ mysql_result($Erg2, $i, "RID")]; - else - $RID = "RID.". mysql_result($Erg2, $i, "RID"); - $Man = mysql_result($Erg2, $i, "Man"); - echo "<td><input name=\"SIDXML\" type=\"text\" value=\"$SID\" size=\"2\" eadonly></td>\n"; - echo "<td><input name=\"DateXML\" type=\"text\" value=\"\" size=\"17\" readonly>\n". - "<input name=\"DateDB\" type=\"text\" value=\"$Time\" size=\"17\" readonly></td>\n"; - echo "<td><input name=\"RIDXML\" type=\"text\" value=\"\" size=\"15\" readonly>\n". - "<input name=\"RIDDB\" type=\"text\" value=\"$RID\" size=\"15\" readonly></td>\n"; - echo "<td><input name=\"LenXML\" type=\"text\" value=\"\" size=\"1\"readonly>\n". - "<input name=\"LenDB\" type=\"text\" value=\"$Len\" size=\"1\"readonly></td>\n"; - echo "<td><input name=\"ManXML\" type=\"text\" value=\"\" size=\"40\"readonly>\n". - "<input name=\"ManDB\" type=\"text\" value=\"$Man\" size=\"40\"readonly></td>\n"; - echo "<td>". funktion_isLinkAllowed_addLink_OrLinkText( "admin/schichtplan.php?action=change&SID=".$SID, "edit"). - "</td>\n"; - echo "<tr>\n"; - } -echo "</table>"; - - -?> diff --git a/www-ssl_old/admin/dbUpdateFromXLS.php b/www-ssl_old/admin/dbUpdateFromXLS.php deleted file mode 100644 index 88879de7..00000000 --- a/www-ssl_old/admin/dbUpdateFromXLS.php +++ /dev/null @@ -1,252 +0,0 @@ -<?php -require_once ('../bootstrap.php'); - -$title = "DB Update from XML"; -$header = "DB Update from XML"; -include ("includes/header.php"); -include ("includes/funktion_xml.php"); - -/////////// -// DEBUG // -/////////// -$ShowDataStrukture = 0; -$EnableRoomFunctions = 1; -$EnableRooms = 1; -$EnableSchudleFunctions = 1; -$EnableSchudle = 1; -$EnableSchudleDB = 1; - -/*############################################################################################## - erstellt Arrays der Reume - ##############################################################################################*/ -function CreateRoomArrays() { - global $Room, $RoomID, $RoomName, $con; - - $sql = "SELECT `RID`, `Name` FROM `Room` " . - "WHERE `Show`='Y'" . - "ORDER BY `Number`, `Name`;"; - $Erg = mysql_query($sql, $con); - $rowcount = mysql_num_rows($Erg); - - for ($i = 0; $i < $rowcount; $i++) { - $Room[$i]["RID"] = mysql_result($Erg, $i, "RID"); - $Room[$i]["Name"] = mysql_result($Erg, $i, "Name"); - $RoomID[mysql_result($Erg, $i, "RID")] = mysql_result($Erg, $i, "Name"); - $RoomName[mysql_result($Erg, $i, "Name")] = mysql_result($Erg, $i, "RID"); - } -} -CreateRoomArrays(); - -/*############################################################################################## - F I L E - ##############################################################################################*/ -echo "\n\n<br />\n<h1>XML File:</h1>\n"; -if (isset ($_POST["PentabarfUser"]) && isset ($_POST["password"]) && isset ($_POST["PentabarfURL"])) { - echo "Update XCAL-File from Pentabarf.."; - if ($PentabarfGetWith == "fsockopen") { - - //backup error messeges and delate - $Backuperror_messages = $error_messages; - $fp = fsockopen("ssl://$PentabarfXMLhost", 443, $errno, $errstr, 30); - // $error_messages = $Backuperror_messages; - - if (!$fp) { - echo "<h2>fail: File 'https://$PentabarfXMLhost/$PentabarfXMLpath" . $_POST["PentabarfURL"] . "' not readable!" . - "[$errstr ($errno)]</h2>"; - } else { - if (($fileOut = fopen("$Tempdir/engelXML", "w")) != FALSE) { - $head = 'GET /' . $PentabarfXMLpath . $_POST["PentabarfURL"] . ' HTTP/1.1' . "\r\n" . - 'Host: ' . $PentabarfXMLhost . "\r\n" . - 'User-Agent: Engelsystem' . "\r\n" . - 'Authorization: Basic ' . - base64_encode($_POST["PentabarfUser"] . ':' . $_POST["password"]) . "\r\n" . - "\r\n"; - fputs($fp, $head); - $Zeilen = -1; - while (!feof($fp)) { - $Temp = fgets($fp, 1024); - - // ende des headers - if ($Temp == "f20\r\n") { - $Zeilen = 0; - $Temp = ""; - } - - //file ende? - if ($Temp == "0\r\n") - break; - - if (($Zeilen > -1) && ($Temp != "ffb\r\n")) { - //steuerzeichen ausfiltern - if (strpos("#$Temp", "\r\n") > 0) - $Temp = substr($Temp, 0, strlen($Temp) - 2); - if (strpos("#$Temp", "1005") > 0) - $Temp = ""; - if (strpos("#$Temp", "783") > 0) - $Temp = ""; - //schreiben in file - fputs($fileOut, $Temp); - $Zeilen++; - } - } - fclose($fileOut); - - echo "<br />Es wurden $Zeilen Zeilen eingelesen<br />"; - } else - echo "<h2>fail: File '$Tempdir/engelXML' not writeable!</h2>"; - fclose($fp); - } - } - elseif ($PentabarfGetWith == "fopen") { - //user uns password in url einbauen - $FileNameIn = "https://" . $_POST["PentabarfUser"] . ':' . $_POST["password"] . "@" . - $PentabarfXMLhost . "/" . $PentabarfXMLpath . $_POST["PentabarfURL"]; - - if (($fileIn = fopen($FileNameIn, "r")) != FALSE) { - if (($fileOut = fopen("$Tempdir/engelXML", "w")) != FALSE) { - $Zeilen = 0; - while (!feof($fileIn)) { - $Zeilen++; - fputs($fileOut, fgets($fileIn)); - } - fclose($fileOut); - echo "<br />Es wurden $Zeilen Zeilen eingelesen<br />"; - } else - echo "<h2>fail: File '$Tempdir/engelXML' not writeable!</h2>"; - fclose($fileIn); - } else - echo "<h2>fail: File 'https://$PentabarfXMLhost/$PentabarfXMLpath" . $_POST["PentabarfURL"] . "' not readable!</h2>"; - } - elseif ($PentabarfGetWith == "wget") { - $Command = "wget --http-user=" . $_POST["PentabarfUser"] . " --http-passwd=" . $_POST["password"] . " " . - "https://$PentabarfXMLhost/$PentabarfXMLpath" . $_POST["PentabarfURL"] . - " --output-file=$Tempdir/engelXMLwgetLog --output-document=$Tempdir/engelXML" . - " --no-check-certificate"; - echo system($Command, $Status); - if ($Status == 0) - echo "OK.<br />"; - else - echo "fail ($Status)($Command).<br />"; - } - elseif ($PentabarfGetWith == "lynx") { - $Command = "lynx -auth=" . $_POST["PentabarfUser"] . ":" . $_POST["password"] . " -dump " . - "https://$PentabarfXMLhost/$PentabarfXMLpath" . $_POST["PentabarfURL"] . " > $Tempdir/engelXML"; - echo system($Command, $Status); - if ($Status == 0) - echo "OK.<br />"; - else - echo "fail ($Status)($Command).<br />"; - } - elseif ($PentabarfGetWith == "fopen") { - //user uns password in url einbauen - $FileNameIn = "https://" . $_POST["PentabarfUser"] . ':' . $_POST["password"] . "@" . - $PentabarfXMLhost . "/" . $PentabarfXMLpath . $_POST["PentabarfURL"]; - - if (($fileIn = fopen($FileNameIn, "r")) != FALSE) { - if (($fileOut = fopen("$Tempdir/engelXML", "w")) != FALSE) { - $Zeilen = 0; - while (!feof($fileIn)) { - $Zeilen++; - fputs($fileOut, fgets($fileIn)); - } - fclose($fileOut); - echo "<br />Es wurden $Zeilen Zeilen eingelesen<br />"; - } else - echo "<h2>fail: File '$Tempdir/engelXML' not writeable!</h2>"; - fclose($fileIn); - } else - echo "<h2>fail: File 'https://$PentabarfXMLhost/$PentabarfXMLpath" . $_POST["PentabarfURL"] . "' not readable!</h2>"; - } - elseif ($PentabarfGetWith == "wget") { - $Command = "wget --http-user=" . $_POST["PentabarfUser"] . " --http-passwd=" . $_POST["password"] . " " . - "https://$PentabarfXMLhost/$PentabarfXMLpath" . $_POST["PentabarfURL"] . - " --output-file=$Tempdir/engelXMLwgetLog --output-document=$Tempdir/engelXML" . - " --no-check-certificate"; - echo system($Command, $Status); - if ($Status == 0) - echo "OK.<br />"; - else - echo "fail ($Status)($Command).<br />"; - } - elseif ($PentabarfGetWith == "lynx") { - $Command = "lynx -auth=" . $_POST["PentabarfUser"] . ":" . $_POST["password"] . " -dump " . - "https://$PentabarfXMLhost/$PentabarfXMLpath" . $_POST["PentabarfURL"] . " > $Tempdir/engelXML"; - echo system($Command, $Status); - if ($Status == 0) - echo "OK.<br />"; - else - echo "fail ($Status)($Command).<br />"; - } else - echo "<h1>The PentabarfGetWith='$PentabarfGetWith' not supported</h1>"; -} else { - echo "<form action=\"dbUpdateFromXLS.php\" method=\"post\">\n"; - echo "<table border=\"0\">\n"; - echo "\t<tr><td>XCAL-File: https://$PentabarfXMLhost/$PentabarfXMLpath</td>" . - "<td><input name=\"PentabarfURL\" type=\"text\" size=\"4\" maxlength=\"5\" " . - "value=\"$PentabarfXMLEventID\"></td></tr>\n"; - echo "\t<tr><td>Username:</td>" . - "<td><input name=\"PentabarfUser\" type=\"text\" size=\"30\" maxlength=\"30\"></td></tr>\n"; - echo "\t<tr><td>Password:</td>" . - "<td><input name=\"password\" type=\"password\" size=\"30\" maxlength=\"30\"></td></tr>\n"; - echo "\t<tr><td></td><td><input type=\"submit\" name=\"FileUpload\" value=\"upload\"></td></tr>\n"; - echo "</table>\n"; - echo "</form>\n"; -} - -//readXMLfile("xml.php.xml"); -if (readXMLfile("$Tempdir/engelXML") == 0) { - $XMLmain = getXMLsubPease($XMLmain, "VCALENDAR"); - - if ($ShowDataStrukture) { - echo "<pre><br />"; - echo $XMLmain->name; - echo "<br />"; - print_r(array_values($XMLmain->sub)); - echo "</pre>"; - } - - /* - echo "<br />"; - $Feld=7; - echo "$Feld#". $XMLmain->sub[$Feld]->name. "<br />"; - echo "$Feld#". $XMLmain->sub[$Feld]->sub; - //print_r(array_values ($XMLmain->sub[$Feld]->sub)); - while(list($key, $value) = each($XMLmain->sub[$Feld]->sub)) - echo "?ID".$value->sub[1]->data. "=". $value->sub[2]->data. "\n"; - echo "</pre>"; - */ - - /*############################################################################################## - V e r s i o n - ##############################################################################################*/ - - echo "<hr>\n"; - $XMLrelease = getXMLsubPease($XMLmain, "X-WR-CALDESC"); - echo "release: " . $XMLrelease->data . "<br />\n"; - //$XMLreleaseDate = getXMLsubPease( $XMLmain, "RELEASE-DATE"); - //echo "release date: ". $XMLreleaseDate->data. "<br />\n"; - echo "<hr>\n"; - - /*############################################################################################## - V e r s i o n - ##############################################################################################*/ - if ($EnableRoomFunctions) - include ("includes/funktion_xml_room.php"); - - if ($EnableSchudleFunctions) - include ("includes/funktion_xml_schudle.php"); - - /*############################################################################################## - U P D A T E A L L - ##############################################################################################*/ - echo "\n\n<br />\n<h1>Update ALL:</h1>\n"; - - echo "<form action=\"dbUpdateFromXLS.php\">\n"; - echo "\t<input type=\"submit\" name=\"UpdateALL\" value=\"now\">\n"; - echo "</form>\n"; - -} //if XMLopenOOK - -include ("includes/footer.php"); -?> - |