diff options
Diffstat (limited to 'includes')
32 files changed, 1990 insertions, 2158 deletions
diff --git a/includes/UserCVS.php b/includes/UserCVS.php index ad7e1d66..7798ee66 100755..100644 --- a/includes/UserCVS.php +++ b/includes/UserCVS.php @@ -1,103 +1,79 @@ <?php - - -if( !isset($_SESSION['UID'])) - $_SESSION['UID'] = -1; - -// CVS import Data -$SQL_CVS = "SELECT * FROM `UserCVS` WHERE UID=".$_SESSION['UID']; -$Erg_CVS = mysql_query($SQL_CVS, $con); -$_SESSION['CVS'] = mysql_fetch_array($Erg_CVS); - - -// Group import Data, if nesseary -if( isset( $_SESSION['CVS'][ "GroupID" ])) -{ - $SQL_GRP = "SELECT * FROM `UserCVS` WHERE UID=".$_SESSION['CVS'][ "GroupID" ]; - $Erg_GRP = mysql_query($SQL_GRP, $con); - $_SESSION['CVS_Group'] = mysql_fetch_array($Erg_GRP); - - foreach( $_SESSION['CVS'] as $k => $v) - { - if($v=="G") // Right == Group - $_SESSION['CVS'][$k] = $_SESSION['CVS_Group'][$k]; - } -} - -//pagename ermitteln -$Page["Name"] = substr( $_SERVER['PHP_SELF'], strlen($ENGEL_ROOT) ); - -//recht f?r diese seite auslesen -if( isset( $_SESSION['CVS'][ $Page["Name"] ])) - $Page["CVS"] = $_SESSION['CVS'][ $Page["Name"] ]; -else -{ - echo "SYSTEM ERROR: now right for ". $Page["Name"]. "exist"; - die; -} - -if( $DEBUG ) -{ -// foreach( $_SESSION as $k => $v) -// echo "$k = $v<br>\n"; - echo "<pre>\$_SESSION:\n"; - print_r($_SESSION); - echo "</pre>"; - - if( strlen($Page["CVS"]) == 0 ) - echo "<h1><u> CVS ERROR, on page '". $Page["Name"]. "'</u></h1>"; - else - echo "CVS: ". $Page["Name"]. " => '". $Page["CVS"]. "'<br>"; - -} - -function funktion_isLinkAllowed( $PageName) -{ - global $_SESSION; - - // separate page parameter - $ParameterPos = strpos( $PageName, ".php?"); - if( $ParameterPos === FALSE) - { - $pName = $PageName; - } - else - { - $pName = substr( $PageName, 0, $ParameterPos + 4); - } - - // check rights - if( (isset( $_SESSION['CVS'][ $pName ]) === TRUE) && - ($_SESSION['CVS'][ $pName ] == "Y") ) - { - return TRUE; - } - - return FALSE; -} - -function funktion_isLinkAllowed_addLink_OrLinkText( $PageName, $LinkText) -{ - global $url, $ENGEL_ROOT; - - if( funktion_isLinkAllowed( $PageName) === TRUE) - { - return "<a href=\"". $url. $ENGEL_ROOT. $PageName. "\">". $LinkText. "</a>"; - } - - return $LinkText; -} - -function funktion_isLinkAllowed_addLink_OrEmpty( $PageName, $LinkText) -{ - global $url, $ENGEL_ROOT; - - if( funktion_isLinkAllowed( $PageName) === TRUE) - { - return "<a href=\"". $url. $ENGEL_ROOT. $PageName. "\">". $LinkText. "</a>"; - } - - return ""; -} - + if(!isset($_SESSION['UID'])) + $_SESSION['UID'] = -1; + + // CVS import Data + $SQL_CVS = "SELECT * FROM `UserCVS` WHERE UID=" . $_SESSION['UID']; + $Erg_CVS = mysql_query($SQL_CVS, $con); + $_SESSION['CVS'] = mysql_fetch_array($Erg_CVS); + + // Group import Data, if nesseary + if(isset($_SESSION['CVS']["GroupID"])) { + $SQL_GRP = "SELECT * FROM `UserCVS` WHERE UID=" . $_SESSION['CVS'][ "GroupID" ]; + $Erg_GRP = mysql_query($SQL_GRP, $con); + $_SESSION['CVS_Group'] = mysql_fetch_array($Erg_GRP); + + foreach($_SESSION['CVS'] as $k => $v) { + if($v == "G") + $_SESSION['CVS'][$k] = $_SESSION['CVS_Group'][$k]; + } + } + + // pagename ermitteln + $Page["Name"] = basename($_SERVER['PHP_SELF']); + + //recht fuer diese seite auslesen + if(isset($_SESSION['CVS'][$Page["Name"]])) + $Page["CVS"] = $_SESSION['CVS'][$Page["Name"]]; + else { + echo "SYSTEM ERROR: now right for " . $Page["Name"] . " exists."; + die; + } + + if($debug) { + echo "<pre>\$_SESSION:\n"; + print_r($_SESSION); + echo "</pre>"; + + if( strlen($Page["CVS"]) == 0 ) + echo "<h1><u> CVS ERROR, on page '". $Page["Name"]. "'</u></h1>"; + else + echo "CVS: ". $Page["Name"]. " => '". $Page["CVS"]. "'<br />"; + } + + function funktion_isLinkAllowed($PageName) { + global $_SESSION; + + // separate page parameter + $ParameterPos = strpos($PageName, ".php?"); + + if($ParameterPos === false) + $pName = $PageName; + else + $pName = substr($PageName, 0, $ParameterPos + 4); + + // check rights + if((isset( $_SESSION['CVS'][ $pName ]) === true) && $_SESSION['CVS'][ $pName ] == "Y") + return true; + + return false; + } + + function funktion_isLinkAllowed_addLink_OrLinkText( $PageName, $LinkText) { + global $url, $ENGEL_ROOT; + + if(funktion_isLinkAllowed( $PageName) === true) + return "<a href=\"" . $url. $ENGEL_ROOT . $PageName . "\">" . $LinkText . "</a>"; + + return $LinkText; + } + + function funktion_isLinkAllowed_addLink_OrEmpty( $PageName, $LinkText) { + global $url, $ENGEL_ROOT; + + if(funktion_isLinkAllowed( $PageName) === true) + return "<a href=\"" . $url . $ENGEL_ROOT . $PageName . "\">" . $LinkText . "</a>"; + + return ""; + } ?> diff --git a/includes/config_MessegeServer.php b/includes/config_MessegeServer.php index 3454ae0c..ce7c7c3a 100644 --- a/includes/config_MessegeServer.php +++ b/includes/config_MessegeServer.php @@ -1,8 +1,7 @@ -<? -// Set the ip and port we will listen on -define( SERVER_ADDRESS, "127.0.0.1" ); -define( SERVER_PORT, 9000 ); - -define( DEBUG, TRUE); +<?php + // Set the ip and port we will listen on + define(SERVER_ADDRESS, "127.0.0.1"); + define(SERVER_PORT, 9000); + define(DEBUG, true); ?> diff --git a/includes/config_modem.php b/includes/config_modem.php index 0625936d..2de37cb7 100644 --- a/includes/config_modem.php +++ b/includes/config_modem.php @@ -1,11 +1,10 @@ -<?PHP +<?php + // ist ein modem angeschlossen + $ModemEnable = false; -//ist ein modem angeschlossen -$ModemEnable = false; + // COM port + $ModemDev = "/dev/ttyS0"; -// COM port -$ModemDev="/dev/ttyS0"; - -// vorwahl, bei tnovis telefonanlage für das programmieren von weckrufen -$WackupNumber="**3"; + // vorwahl, bei tnovis telefonanlage fuer das programmieren von weckrufen + $WakeupNumber = "**3"; ?> diff --git a/includes/crypt.php b/includes/crypt.php index 9707e719..d511e4f4 100755..100644 --- a/includes/crypt.php +++ b/includes/crypt.php @@ -1,18 +1,12 @@ <?php - - -function PassCrypt($passwort) { -include "config.php"; - -switch ($crypt_system) { - case "crypt": - return "{crypt}".crypt($passwort, "77"); - case "md5": - return md5($passwort); + function PassCrypt($passwort) { + include "config.php"; + + switch ($crypt_system) { + case "crypt": + return "{crypt}" . crypt($passwort, "77"); + case "md5": + return md5($passwort); + } } - -} - - - ?> diff --git a/includes/error_handler.php b/includes/error_handler.php index 10f27d58..5a58076b 100755..100644 --- a/includes/error_handler.php +++ b/includes/error_handler.php @@ -1,88 +1,86 @@ <?php - - require_once("funktion_jabber.php"); + require_once "funktion_jabber.php"; // global array for collected error_messages $error_messages = array(); // general error handler collecting all messages in an array - function Error_Handler($error_number, $error_string, $error_file, $error_line, $error_context) - { + function Error_Handler($error_number, $error_string, $error_file, $error_line, $error_context) { global $error_messages, $con; - //SQL error genauer analysiert + // SQL error genauer analysiert $Temp = ""; - foreach ($error_context as $k => $v ) - if( (strpos( "0$k", "sql") > 0) || (strpos( "0$k", "SQL") > 0)) - $Temp .= "Error Context: $k = $v\n"; - - if( (strpos( "0$error_string", "MySQL") > 0) ) - $Temp .= "Error MySQL: ". mysql_error($con). "\n"; - - //übergeben des arrays - array_push( $error_messages, "Error Number: $error_number\n". - "Error String: $error_string\n". - "Error File: $error_file\n". - "Error Line: $error_line\n". - (strlen($Temp)? "$Temp": "") - ); + foreach ($error_context as $k => $v) + if((strpos( "0$k", "sql") > 0) || (strpos( "0$k", "SQL") > 0)) + $Temp .= "Error Context: $k = $v\n"; + + if((strpos( "0$error_string", "MySQL") > 0)) + $Temp .= "Error MySQL: ". mysql_error($con). "\n"; + + // Uebergeben des arrays + array_push($error_messages, "Error Number: " . $error_number . "\n". + "Error String: " . $error_string . "\n". + "Error File: " . $error_file . "\n". + "Error Line: " . $error_line . "\n". + (strlen($Temp)? "$Temp": "")); } // register error handler set_error_handler("Error_Handler"); - ini_set( "error_reporting", E_ALL); - if( $DEBUG) - { - ini_set( "display_errors", "On"); - ini_set( "display_startup_errors", "On"); - ini_set( "html_errors", "On"); + error_reporting(E_ALL); + + if($debug) { + ini_set("display_errors", "On"); + ini_set("display_startup_errors", "On"); + ini_set("html_errors", "On"); } // send errors - function send_errors() - { + function send_errors() { global $error_messages; - if (!$error_messages) return; - + if(!$error_messages) + return; + $message = ""; foreach($error_messages as $value) $message .= $value."\n"; + $message .= "\n"; - - if( isset( $_POST)) - { - foreach ($_POST as $k => $v ) + + if(isset($_POST)) { + foreach ($_POST as $k => $v) $message .= "_POST: $k = ". ( $k!="password"? $v : "???..."). "\n"; + $message .= "\n"; } - - if( isset( $_GET)) - { - foreach ($_GET as $k => $v ) - $message .= "_GET: $k = $v\n"; + + if(isset($_GET)) { + foreach ($_GET as $k => $v) + $message .= "_GET: $k = $v\n"; + $message .= "\n"; } - + $message .= "\n\n"; if( isset( $_SESSION)) { - foreach ($_SESSION as $k => $v ) + foreach ($_SESSION as $k => $v ) $message .= "_SESSION: $k = $v\n"; $message .= "\n"; } if( isset( $_SESSION['CVS'])) { - foreach ($_SESSION['CVS'] as $k => $v ) + foreach ($_SESSION['CVS'] as $k => $v ) if( strlen($k)>3 ) $message .= "_SESSION['CVS']: $k = $v\n"; $message .= "\n"; } - - foreach ($_SERVER as $k => $v ) + + foreach ($_SERVER as $k => $v ) if( strpos( "0$k", "SERVER_")==0) $message .= "_SERVER: $k = $v\n"; diff --git a/includes/footer.php b/includes/footer.php index f65e8a7e..8f736c4d 100755..100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -1,57 +1,39 @@ -<?PHP - -?> - - - <!-- anfang des footers //--> - - - - - <br> - <p align="center"> - <?PHP If (IsSet($_SESSION['oldurl'])) - echo "<a href=\"". $_SESSION["oldurl"]. "\">".Get_Text("back")."</a> "; - ?> - <a href="#top"><?PHP echo Get_Text("top"); ?></a> - </p> - </td> - </tr> + <br /> + <p align="center"> + <?php if(IsSet($_SESSION['oldurl'])) + echo "<a href=\"" . $_SESSION["oldurl"] . "\">" . Get_Text("back") . "</a> "; + ?> + <a href="#top"><?php echo Get_Text("top"); ?></a> + </p> + </td> + </tr> </table> - </td> - - - +</td> <!-- anfang des menue parts //--> -<?PHP -if( $_SESSION['Menu'] =="R") include("menu.php"); +<?php +if($_SESSION['Menu'] == "R") + include("menu.php"); ?> - </td> - - <!-- ende des menue parts //--> - - - </tr> - <tr> - <td colspan="2"> - <h5 align="center"> © copyleft - <a href="mailto:erzengel@lists.ccc.de">Kontakt</a> - <?PHP - include( "funktion_counter.php"); - include( "funktion_flag.php"); - ?></h5> - </td> - </tr> + </tr> + <tr> + <td colspan="2"> + <h5 align="center"> © copyleft - <a href="mailto:erzengel@lists.ccc.de">Kontakt</a> + <?php + include("funktion_counter.php"); + include("funktion_flag.php"); + ?></h5> + </td> + </tr> </table> <!-- </div> --> <?php mysql_close($con); ?> -</div> - +<!-- </div> --> -</BODY> -</HTML> +</body> +</html> diff --git a/includes/funktion_SendMessenges.php b/includes/funktion_SendMessenges.php index d71e4804..b6de67cc 100644 --- a/includes/funktion_SendMessenges.php +++ b/includes/funktion_SendMessenges.php @@ -1,18 +1,14 @@ -<?php
-
-
-function SendData($Data)
-{
- include("config_MessegeServer.php");
- // Create a UDP socket
- $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
- //send packed
- socket_sendto($sock, $Data, 9999, 0x4, SERVER_ADDRESS, SERVER_PORT);
-}
-
-function SendMessageJabber($Adresse, $Nachricht)
-{
- SendData( "#message $Adresse $Nachricht");
-}
-
-?>
+<?php + function SendData($Data) { + include "config_MessegeServer.php"; + // Create a UDP socket + $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + + //send packed + socket_sendto($sock, $Data, 9999, 0x4, SERVER_ADDRESS, SERVER_PORT); + } + + function SendMessageJabber($Adresse, $Nachricht) { + SendData( "#message $Adresse $Nachricht"); + } +?> diff --git a/includes/funktion_activeUser.php b/includes/funktion_activeUser.php index d19895a8..e214a1f9 100755..100644 --- a/includes/funktion_activeUser.php +++ b/includes/funktion_activeUser.php @@ -1,59 +1,57 @@ -<?PHP - -// Functionen gibt es nicht auf ellen rechern -if( !function_exists("bcdiv")) -{ - function bcdiv( $param1, $param2) - { - return floor( $param1 / $param2); - } -} - -if( !function_exists("bcmod")) -{ - function bcmod( $param1, $param2) - { - return $param1 - ( $param2 * bcdiv( $param1, $param2)); - } -} - - -echo "<h4 class=\"menu\">Engel online</h4>"; - -$SQL = "SELECT UID, Nick, lastLogIn ". - "FROM User ". - "WHERE (`lastLogIn` > '". gmdate("YmdHis", time()-(60*60)). "' AND NOT (UID=". $_SESSION['UID']. ")) ". - "ORDER BY lastLogIn DESC;"; - -$Erg = mysql_query( $SQL, $con); - - -$Tist = (gmdate("d", time()) * 60 * 60 * 24) + // Tag - (gmdate("H", time()) * 60 * 60) + // Stunde - (gmdate("i", time()) * 60) + // Minute - (gmdate("s", time()) ); // Sekunde - -for( $i=0; $i<mysql_num_rows($Erg); $i++) -{ - echo "\t\t\t<li>"; - if( $_SESSION['UID']>0 ) - echo DisplayAvatar( mysql_result( $Erg, $i, "UID")); - // Schow Admin Page - echo funktion_isLinkAllowed_addLink_OrLinkText( - "admin/userChangeNormal.php?enterUID=". mysql_result( $Erg, $i, "UID"). "&Type=Normal", - mysql_result( $Erg, $i, "Nick")); - - $Tlog = (substr( mysql_result( $Erg, $i, "lastLogIn"), 8, 2) * 60 * 60 * 24) + // Tag - (substr( mysql_result( $Erg, $i, "lastLogIn"), 11, 2) * 60 * 60) + // Stunde - (substr( mysql_result( $Erg, $i, "lastLogIn"), 14, 2) * 60) + // Minute - (substr( mysql_result( $Erg, $i, "lastLogIn"), 17, 2) ); // Sekunde - - $Tlog = $Tist-$Tlog; - echo " ". bcdiv( $Tlog, 60). ":"; - if( strlen(bcmod( $Tlog, 60))==1) - echo "0"; - echo bcmod( $Tlog, 60); - echo "</li>\n"; -} - +<?php + // Funktionen gibt es nicht auf allen Rechnern + if(!function_exists("bcdiv")) { + function bcdiv( $param1, $param2) { + return floor( $param1 / $param2); + } + } + + if(!function_exists("bcmod")) { + function bcmod( $param1, $param2) { + return $param1 - ( $param2 * bcdiv( $param1, $param2)); + } + } + + echo "<h4 class=\"menu\">Engel online</h4>"; + + $SQL = "SELECT UID, Nick, lastLogIn " . + "FROM User " . + "WHERE (`lastLogIn` > '" . gmdate("YmdHis", time() - (60 * 60)) . "' AND NOT (UID=" . $_SESSION['UID'] . ")) " . + "ORDER BY lastLogIn DESC;"; + + $Erg = mysql_query($SQL, $con); + + $Tist = (gmdate("d", time()) * 60 * 60 * 24) + // Tag + (gmdate("H", time()) * 60 * 60) + // Stunde + (gmdate("i", time()) * 60) + // Minute + (gmdate("s", time()) ); // Sekunde + + echo "<ul>"; + + for($i = 0; $i < mysql_num_rows($Erg); $i++) { + echo "<li>"; + + if($_SESSION['UID'] > 0) + echo DisplayAvatar( mysql_result( $Erg, $i, "UID")); + + // Show Admin Page + echo funktion_isLinkAllowed_addLink_OrLinkText("admin/userChangeNormal.php?enterUID=" . mysql_result($Erg, $i, "UID") . "&Type=Normal", mysql_result($Erg, $i, "Nick")); + + $Tlog = (substr(mysql_result($Erg, $i, "lastLogIn"), 8, 2) * 60 * 60 * 24) + // Tag + (substr(mysql_result($Erg, $i, "lastLogIn"), 11, 2) * 60 * 60) + // Stunde + (substr(mysql_result($Erg, $i, "lastLogIn"), 14, 2) * 60) + // Minute + (substr(mysql_result($Erg, $i, "lastLogIn"), 17, 2) ); // Sekunde + + $Tlog = $Tist - $Tlog; + + echo " " . bcdiv($Tlog, 60) . ":"; + + if(strlen(bcmod($Tlog, 60)) == 1) + echo "0"; + + echo bcmod($Tlog, 60); + echo "</li>\n"; + } + + echo "</ul>"; ?> diff --git a/includes/funktion_counter.php b/includes/funktion_counter.php index 70b104d4..39d65a1f 100644 --- a/includes/funktion_counter.php +++ b/includes/funktion_counter.php @@ -1,24 +1,14 @@ -<?PHP - -$SQL = "SELECT `Anz` FROM `Counter` WHERE `URL`=\"". $Page["Name"]. "\""; -$Erg = mysql_query($SQL, $con); - -echo mysql_error($con); - -if(mysql_num_rows($Erg)==0) -{ -// echo "Counter: 1"; - $SQL = "INSERT INTO `Counter` ( `URL` , `Anz` ) ". - "VALUES ('". $Page["Name"]. "', '1');"; - $Erg = mysql_query($SQL, $con); -} -elseif(mysql_num_rows($Erg)==1) -{ -// echo "Counter: ". (mysql_result($Erg, 0, 0)+1); - $SQL = "UPDATE `Counter` SET `Anz` = '". (mysql_result($Erg, 0, 0) +1). "' ". - "WHERE `URL` = '". $Page["Name"]. "' LIMIT 1 ;"; - $Erg = mysql_query($SQL, $con); -} - - +<?php + $SQL = "SELECT `Anz` FROM `Counter` WHERE `URL`=\"" . $Page["Name"] . "\""; + $Erg = mysql_query($SQL, $con); + + echo mysql_error($con); + + if(mysql_num_rows($Erg) == 0) { + $SQL = "INSERT INTO `Counter` ( `URL` , `Anz` ) VALUES ('" . $Page["Name"] . "', '1');"; + $Erg = mysql_query($SQL, $con); + } elseif(mysql_num_rows($Erg) == 1) { + $SQL = "UPDATE `Counter` SET `Anz` = '" . (mysql_result($Erg, 0, 0) +1) . "' WHERE `URL` = '" . $Page["Name"] . "' LIMIT 1 ;"; + $Erg = mysql_query($SQL, $con); + } ?> diff --git a/includes/funktion_cron.php b/includes/funktion_cron.php index 17ac5a76..3a0e984b 100755..100644 --- a/includes/funktion_cron.php +++ b/includes/funktion_cron.php @@ -1,144 +1,131 @@ -<?PHP - -function UID2DECT($UID) -{ - global $con; - $SQL = "SELECT DECT FROM `User` WHERE UID='$UID'"; - $Erg = mysql_query($SQL, $con); - if( mysql_num_rows( $Erg) == 1) - return mysql_result($Erg, 0); - else - return ""; -} -function RID2Room($RID) -{ - global $con; - $SQL = "SELECT Name FROM `Room` WHERE RID='$RID'"; - $Erg = mysql_query($SQL, $con); - if( mysql_num_rows( $Erg) == 1) - return mysql_result($Erg, 0); - else - return ""; -} - -function TID2Engeltype($TID) -{ - global $con; - $SQL = "SELECT Name FROM `EngelType` WHERE TID='$TID'"; - $Erg = mysql_query($SQL, $con); - if( mysql_num_rows( $Erg) == 1) - return mysql_result($Erg, 0); - else - return ""; -} - - -function DialNumberIAX( $DECTnumber, $Time, $RID, $TID) -{ - global $IAXenable, $IAXcontent, $IAXserver, $AnrufDelay, $DebugDECT, $Tempdir, $AsteriskOutputDir; - - //Parameter verarbeiten - $TimeH = substr( $Time, 11, 2); - $TimeM = substr( $Time, 14, 2); - $TimeM = substr( $Time, 14, 2) + $AnrufDelay; - if( $TimeM < 0 ) - { - $TimeM += 60; - $TimeH -= 1; - } - if( $TimeH < 0 ) - $TimeH += 24; - - if( strlen( $TimeH) == 1) - $TimeH = "0".$TimeH; - - if( $IAXenable) - { $Message="die-nee shisht beh-kinned , in where-neegin me-nooten . . . your shift beginns in a few minutes"; - if (isset($SetHttpIAX)) - { - $post_data = array(); - $post_data['code'] = "89o8eu9cg4"; - $post_data['callerid'] = "1023"; - $post_data['nr'] = "$DECTnumber"; - //$post_data['message'] = "Deine schicht beginnt in ein paar minuten . . . your shift beginns in a few minutes "; - $post_data['message'] = "die-nee shisht beh-kinned , in where-neegin me-nooten . . . your shift beginns in a few minutes "; - $url = "https://23c3.eventphone.de/~bef/call.php"; - - $o=""; - foreach ($post_data as $k=>$v) - { - $o.= "$k=".urlencode(utf8_encode($v))."&"; - } - $post_data=substr($o,0,-1); - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); - $result = curl_exec($ch); - echo curl_error($ch); - curl_close($ch); - } - else - { - // IAX file Schareiebn - $CallFile = $Tempdir. "/call_". date("Ymd_His"). "_$DECTnumber"; - - if($DebugDECT) echo "IAX create file for dialing Number $DECTnumber\n"; - $file = fopen( $CallFile, 'w' ); - if( $file != FALSE) - { - fputs( $file, "Channel: SIP/$DECTnumber@$IAXserver\n"); //Ziel nummer - fputs( $file, "Callerid: Engelserver\n"); - // fputs( $file, "Callerid: $IAXcontent\n"); - // fputs( $file, "Context: $DECTnumber@$IAXserver\n"); - fputs( $file, "Extension: s\n"); - fputs( $file, "MaxRetries: 1\n"); - fputs( $file, "RetryTime: 10\n"); - fputs( $file, "SetVar: msg=$Message\n"); -// fputs( $file, "SetVar: TimeH=$TimeH\n"); -// fputs( $file, "SetVar: TimeM=$TimeM\n"); -// fputs( $file, "SetVar: DECTnumber=$DECTnumber\n"); -// fputs( $file, "SetVar: Room=". RID2Room( $RID). "\n"); -// fputs( $file, "SetVar: Engeltype=". TID2Engeltype( $TID). "\n"); - fclose($file); - system( "chmod 777 ". $CallFile); - system( "mv ". $CallFile. " ". $AsteriskOutputDir); - - } - else - echo "error: $CallFile not created"; - } - } - else - if($DebugDECT) echo "IAX is disable\n"; -} - -function DialNumberModem( $DECTnumber, $Time) -{ - global $AnrufDelay; - - //Parameter verarbeiten - $TimeH = substr( $Time, 11, 2); - $TimeM = substr( $Time, 14, 2); - $TimeM = substr( $Time, 14, 2) + $AnrufDelay; - if( $TimeM < 0 ) - { - $TimeM += 60; - $TimeH -= 1; - } - if( $TimeH < 0 ) - $TimeH += 24; - - if( strlen( $TimeH) == 1) - $TimeH = "0".$TimeH; - - SetWackeup( $DECTnumber, $TimeH, $TimeM); -} - -return 0; +<?php + function UID2DECT($UID) { + global $con; + $SQL = "SELECT DECT FROM `User` WHERE UID='$UID'"; + $Erg = mysql_query($SQL, $con); -?> + if(mysql_num_rows( $Erg) == 1) + return mysql_result($Erg, 0); + else + return ""; + } + + function RID2Room($RID) { + global $con; + $SQL = "SELECT Name FROM `Room` WHERE RID='$RID'"; + $Erg = mysql_query($SQL, $con); + + if(mysql_num_rows( $Erg) == 1) + return mysql_result($Erg, 0); + else + return ""; + } + + function TID2Engeltype($TID) { + global $con; + $SQL = "SELECT Name FROM `EngelType` WHERE TID='$TID'"; + $Erg = mysql_query($SQL, $con); + + if(mysql_num_rows( $Erg) == 1) + return mysql_result($Erg, 0); + else + return ""; + } + + + function DialNumberIAX( $DECTnumber, $Time, $RID, $TID) { + global $IAXenable, $IAXcontent, $IAXserver, $AnrufDelay, $DebugDECT, $Tempdir, $AsteriskOutputDir; + + // Parameter verarbeiten + $TimeH = substr( $Time, 11, 2); + $TimeM = substr( $Time, 14, 2); + $TimeM = substr( $Time, 14, 2) + $AnrufDelay; + + if($TimeM < 0) { + $TimeM += 60; + $TimeH -= 1; + } + + if($TimeH < 0) + $TimeH += 24; + + if(strlen( $TimeH) == 1) + $TimeH = "0" . $TimeH; + + if($IAXenable) { + $Message = "die-nee shisht beh-kinned, in where-neegin me-nooten . . . your shift beginns in a few minutes"; + if(isset($SetHttpIAX)) { + $post_data = array(); + $post_data['code'] = "89o8eu9cg4"; + $post_data['callerid'] = "1023"; + $post_data['nr'] = "$DECTnumber"; + //$post_data['message'] = "Deine schicht beginnt in ein paar minuten . . . your shift beginns in a few minutes "; + $post_data['message'] = "die-nee shisht beh-kinned , in where-neegin me-nooten . . . your shift beginns in a few minutes "; + $url = "https://23c3.eventphone.de/~bef/call.php"; + + $o = ""; + foreach ($post_data as $k => $v) { + $o.= "$k=" . urlencode(utf8_encode($v)) . "&"; + } + + $post_data = substr($o, 0, -1); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + $result = curl_exec($ch); + echo curl_error($ch); + curl_close($ch); + } else { + // IAX file Schareiebn + $CallFile = $Tempdir. "/call_". date("Ymd_His"). "_$DECTnumber"; + + if($DebugDECT) + echo "IAX create file for dialing Number $DECTnumber\n"; + + $file = fopen( $CallFile, 'w'); + + if($file != false) { + fputs($file, "Channel: SIP/$DECTnumber@$IAXserver\n"); + fputs($file, "Callerid: Engelserver\n"); + fputs($file, "Extension: s\n"); + fputs($file, "MaxRetries: 1\n"); + fputs($file, "RetryTime: 10\n"); + fputs($file, "SetVar: msg=$Message\n"); + fclose($file); + system("chmod 777 " . $CallFile); + system("mv " . $CallFile . " " . $AsteriskOutputDir); + } else + echo "error: $CallFile not created"; + } + } else + if($DebugDECT) + echo "IAX is disable\n"; + } + + function DialNumberModem($DECTnumber, $Time) { + global $AnrufDelay; + + // Parameter verarbeiten + $TimeH = substr($Time, 11, 2); + $TimeM = substr($Time, 14, 2); + $TimeM = substr($Time, 14, 2) + $AnrufDelay; + + if($TimeM < 0) { + $TimeM += 60; + $TimeH -= 1; + } + + if($TimeH < 0) + $TimeH += 24; + + if(strlen( $TimeH) == 1) + $TimeH = "0" . $TimeH; + + SetWackeup($DECTnumber, $TimeH, $TimeM); + } +?> diff --git a/includes/funktion_db.php b/includes/funktion_db.php index cbfb198f..160a9c59 100644 --- a/includes/funktion_db.php +++ b/includes/funktion_db.php @@ -1,149 +1,145 @@ -<?PHP - -if( !function_exists("db_query")) -{ - function Ausgabe_Daten($SQL) - { - global $con; - $Erg = mysql_query($SQL, $con); - - echo mysql_error($con); - - $Zeilen = mysql_num_rows($Erg); - $Anzahl_Felder = mysql_num_fields($Erg); - - $Diff = "<table border=1>"; - $Diff .= "<tr>"; - for ($m = 0 ; $m < $Anzahl_Felder ; $m++) - $Diff .= "<th>". mysql_field_name($Erg, $m). "</th>"; - $Diff .= "</tr>"; - - for ($n = 0 ; $n < $Zeilen ; $n++) - { - $Diff .= "<tr>"; - for ($m = 0 ; $m < $Anzahl_Felder ; $m++) - $Diff .= "<td>".mysql_result($Erg, $n, $m). "</td>"; - $Diff .= "</tr>"; - } - $Diff .= "</table>"; - return $Diff; - } - - function db_querry_getDatenAssocArray($SQL) - { - global $con; - - $Erg = mysql_query($SQL, $con); - echo mysql_error($con); - - $Daten = array(); - for( $i=0; $i<mysql_num_rows($Erg); $i++) - $Daten[$i] = mysql_fetch_assoc($Erg); - - return $Daten; - } - - function db_querry_diffDaten($Daten1, $Daten2) - { - $Gefunden=False; - - $Diff = "\n<table border=1>\n"; - $Diff .= "<tr>\n\t<th>Feldname</th>\n\t<th>old Value</th>\n\t<th>new Value</th>\n"; - $Diff .= "</tr>\n"; - foreach($Daten1 as $DataKey => $Data1) - { - if( isset( $Daten2[$DataKey])) - { - $Data2 = $Daten2[$DataKey]; - foreach($Data1 as $key => $value) - if( $value != $Data2[$key]) - { - $Gefunden=TRUE; - $Diff .= "<tr>\n\t<td>$key</td>\n\t<td>$value</td>\n\t<td>".$Data2[$key]."</rd>\n</tr>"; - } - } - else - foreach($Data1 as $key => $value) - { - $Gefunden=TRUE; - $Diff .= "<tr>\n\t<td>$key</td>\n\t<td>$value</td>\n\t<td></rd>\n</tr>"; - } - } - $Diff .= "</table>\n"; - - if( $Gefunden) - return $Diff; - else - return "\nno changes Fount\n"; - } - - function db_query( $SQL, $comment) - { - global $con, $Page; - $Diff = ""; - - //commed anlyse udn daten sicherung - if( strpos( "#$SQL", "UPDATE") > 0) - { - //Tabellen name ermitteln - $Table_Start = strpos( $SQL, "`"); - $Table_End = strpos( $SQL, "`", $Table_Start+1); - $Table = substr( $SQL, $Table_Start, ($Table_End-$Table_Start+1)); - - //SecureTest - if( $Table_Start == 0 || $Table_End == 0) die("<h1>funktion_db ERROR SQL: '$SQL' nicht OK</h1>"); - - //WHERE ermitteln - $Where_Start = strpos( $SQL, "WHERE"); - $Where = substr( $SQL, $Where_Start); - if( $Where_Start == 0) $Where = ";"; - - if( strlen( $Where) < 2) - { - $Diff = "can't show, too mutch data (no filter was set)"; - $querry_erg = mysql_query($SQL, $con); - } - else - { - $Daten1 = db_querry_getDatenAssocArray( "SELECT * FROM $Table $Where"); - $querry_erg = mysql_query($SQL, $con); - $Daten2 = db_querry_getDatenAssocArray( "SELECT * FROM $Table $Where"); - $Diff = db_querry_diffDaten($Daten1, $Daten2); - } - } - elseif( strpos( "#$SQL", "DELETE") > 0) - { - $TableWhere = substr( $SQL, 6); - $Diff .= Ausgabe_Daten( "SELECT * $TableWhere"); - - //execute command - $querry_erg = mysql_query($SQL, $con); - } - elseif( strpos( "#$SQL", "INSERT") > 0) - { - //execute command - $querry_erg = mysql_query($SQL, $con); - } - else - { - //execute command - $querry_erg = mysql_query($SQL, $con); - } - - $SQLCommand = "SQL:<br>". htmlentities( $SQL, ENT_QUOTES); - if( strlen($Diff) > 0) - $SQLCommand .= "<br><br>Diff:<br>$Diff"; - - $Commend = htmlentities( ($Page["Name"]. ": ". $comment), ENT_QUOTES); - //LOG commands in DB - $SQL_SEC = "INSERT INTO `ChangeLog` ( `UID` , `SQLCommad` , `Commend` ) ". - " VALUES ( '". $_SESSION['UID']. "', ". - "'". mysql_escape_string( $SQLCommand). "', ". - "'". mysql_escape_string( $Commend). "' );"; - $erg = mysql_query($SQL_SEC, $con); - echo mysql_error($con); - return $querry_erg; - }//function db_query( +<?php + if( !function_exists("db_query")) { + function Ausgabe_Daten($SQL) { + global $con; + $Erg = mysql_query($SQL, $con); + + echo mysql_error($con); + + $Zeilen = mysql_num_rows($Erg); + $Anzahl_Felder = mysql_num_fields($Erg); + + $Diff = "<table border=1>"; + $Diff .= "<tr>"; + + for ($m = 0 ; $m < $Anzahl_Felder ; $m++) + $Diff .= "<th>". mysql_field_name($Erg, $m). "</th>"; + + $Diff .= "</tr>"; + + for ($n = 0 ; $n < $Zeilen ; $n++) { + $Diff .= "<tr>"; + + for ($m = 0 ; $m < $Anzahl_Felder ; $m++) + $Diff .= "<td>".mysql_result($Erg, $n, $m). "</td>"; + + $Diff .= "</tr>"; + } + + $Diff .= "</table>"; + return $Diff; + } + + function db_querry_getDatenAssocArray($SQL) { + global $con; + + $Erg = mysql_query($SQL, $con); + echo mysql_error($con); + + $Daten = array(); + + for( $i=0; $i<mysql_num_rows($Erg); $i++) + $Daten[$i] = mysql_fetch_assoc($Erg); + + return $Daten; + } + + function db_querry_diffDaten($Daten1, $Daten2) { + $Gefunden = false; + + $Diff = "\n<table border=1>\n"; + $Diff .= "<tr>\n\t<th>Feldname</th>\n\t<th>old Value</th>\n\t<th>new Value</th>\n"; + $Diff .= "</tr>\n"; + + foreach($Daten1 as $DataKey => $Data1) { + if(isset( $Daten2[$DataKey])) { + $Data2 = $Daten2[$DataKey]; + + foreach($Data1 as $key => $value) + if( $value != $Data2[$key]) { + $Gefunden = true; + $Diff .= "<tr>\n\t<td>$key</td>\n\t<td>$value</td>\n\t<td>" . $Data2[$key] . "</rd>\n</tr>"; + } + } else + foreach($Data1 as $key => $value) { + $Gefunden = true; + $Diff .= "<tr>\n\t<td>$key</td>\n\t<td>$value</td>\n\t<td></rd>\n</tr>"; + } + } + + $Diff .= "</table>\n"; + + if($Gefunden) + return $Diff; + else + return "\nno changes Fount\n"; + } + + function db_query( $SQL, $comment) { + global $con, $Page; + $Diff = ""; + + // commed anlyse udn daten sicherung + if(strpos("#$SQL", "UPDATE") > 0) { + // Tabellen name ermitteln + $Table_Start = strpos( $SQL, "`"); + $Table_End = strpos( $SQL, "`", $Table_Start+1); + $Table = substr( $SQL, $Table_Start, ($Table_End-$Table_Start+1)); + + //SecureTest + if( $Table_Start == 0 || $Table_End == 0) die("<h1>funktion_db ERROR SQL: '$SQL' nicht OK</h1>"); + + //WHERE ermitteln + $Where_Start = strpos( $SQL, "WHERE"); + $Where = substr( $SQL, $Where_Start); + if( $Where_Start == 0) $Where = ";"; + + if( strlen( $Where) < 2) + { + $Diff = "can't show, too mutch data (no filter was set)"; + $querry_erg = mysql_query($SQL, $con); + } + else + { + $Daten1 = db_querry_getDatenAssocArray( "SELECT * FROM $Table $Where"); + $querry_erg = mysql_query($SQL, $con); + $Daten2 = db_querry_getDatenAssocArray( "SELECT * FROM $Table $Where"); + $Diff = db_querry_diffDaten($Daten1, $Daten2); + } + } + elseif( strpos( "#$SQL", "DELETE") > 0) + { + $TableWhere = substr( $SQL, 6); + $Diff .= Ausgabe_Daten( "SELECT * $TableWhere"); + + //execute command + $querry_erg = mysql_query($SQL, $con); + } + elseif( strpos( "#$SQL", "INSERT") > 0) + { + //execute command + $querry_erg = mysql_query($SQL, $con); + } + else + { + //execute command + $querry_erg = mysql_query($SQL, $con); + } + + $SQLCommand = "SQL:<br />". htmlentities( $SQL, ENT_QUOTES); + if( strlen($Diff) > 0) + $SQLCommand .= "<br /><br />Diff:<br />$Diff"; + + $Commend = htmlentities( ($Page["Name"]. ": ". $comment), ENT_QUOTES); + //LOG commands in DB + $SQL_SEC = "INSERT INTO `ChangeLog` ( `UID` , `SQLCommad` , `Commend` ) ". + " VALUES ( '". $_SESSION['UID']. "', ". + "'". mysql_escape_string( $SQLCommand). "', ". + "'". mysql_escape_string( $Commend). "' );"; + $erg = mysql_query($SQL_SEC, $con); + echo mysql_error($con); + return $querry_erg; + }//function db_query( } ?> diff --git a/includes/funktion_db_list.php b/includes/funktion_db_list.php index 9393e97e..1131ffd3 100755..100644 --- a/includes/funktion_db_list.php +++ b/includes/funktion_db_list.php @@ -1,67 +1,65 @@ -<?PHP +<?php + function funktion_db_list($Table_Name) { + global $con; -function funktion_db_list($Table_Name) -{ - global $con; - - $SQL = "SELECT * FROM `".$Table_Name."`"; - $Erg = mysql_query($SQL, $con); + $SQL = "SELECT * FROM `".$Table_Name."`"; + $Erg = mysql_query($SQL, $con); - // anzahl zeilen - $Zeilen = mysql_num_rows($Erg); + // anzahl zeilen + $Zeilen = mysql_num_rows($Erg); - $Anzahl_Felder = mysql_num_fields($Erg); + $Anzahl_Felder = mysql_num_fields($Erg); - echo "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">"; - echo "<caption>DB: $Table_Name</caption>"; + echo "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">"; + echo "<caption>DB: $Table_Name</caption>"; - echo "<tr class=\"contenttopic\">"; - for ($m = 0 ; $m < $Anzahl_Felder ; $m++) - { - echo "<th>". mysql_field_name($Erg, $m). "</th>"; - } - echo "</tr>"; + echo "<tr class=\"contenttopic\">"; + for ($m = 0 ; $m < $Anzahl_Felder ; $m++) + { + echo "<th>". mysql_field_name($Erg, $m). "</th>"; + } + echo "</tr>"; - for ($n = 0 ; $n < $Zeilen ; $n++) - { - echo "<tr class=\"content\">"; - for ($m = 0 ; $m < $Anzahl_Felder ; $m++) - { - echo "<td>".mysql_result($Erg, $n, $m). "</td>"; - } - echo "</tr>"; - } - echo "</table>"; + for ($n = 0 ; $n < $Zeilen ; $n++) + { + echo "<tr class=\"content\">"; + for ($m = 0 ; $m < $Anzahl_Felder ; $m++) + { + echo "<td>".mysql_result($Erg, $n, $m). "</td>"; + } + echo "</tr>"; + } + echo "</table>"; } function funktion_db_element_list_2row( $TopicName, $SQL) { - global $con; + global $con; - echo "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n"; - echo "<caption>$TopicName</caption>"; -# echo "\t<tr class=\"contenttopic\"> <td><h1>$TopicName</h1></td> </tr>\n"; + echo "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n"; + echo "<caption>$TopicName</caption>"; +# echo "\t<tr class=\"contenttopic\"> <td><h1>$TopicName</h1></td> </tr>\n"; - $Erg = mysql_query($SQL, $con); - echo mysql_error($con); - - echo "<tr class=\"contenttopic\">"; - for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++) - { - echo "<th>". mysql_field_name($Erg, $m). "</th>"; - } - echo "</tr>"; + $Erg = mysql_query($SQL, $con); + echo mysql_error($con); + + echo "<tr class=\"contenttopic\">"; + for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++) + { + echo "<th>". mysql_field_name($Erg, $m). "</th>"; + } + echo "</tr>"; - for ($n = 0 ; $n < mysql_num_rows($Erg) ; $n++) - { - echo "<tr class=\"content\">"; - for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++) - { - echo "<td>".mysql_result($Erg, $n, $m). "</td>"; - } - echo "</tr>"; - } - echo "</table>\n"; + for ($n = 0 ; $n < mysql_num_rows($Erg) ; $n++) + { + echo "<tr class=\"content\">"; + for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++) + { + echo "<td>".mysql_result($Erg, $n, $m). "</td>"; + } + echo "</tr>"; + } + echo "</table>\n"; } ?> diff --git a/includes/funktion_faq.php b/includes/funktion_faq.php index 641ea38d..e9f09e7c 100755..100644 --- a/includes/funktion_faq.php +++ b/includes/funktion_faq.php @@ -1,12 +1,10 @@ -<?PHP +<?php + function noAnswer() { + global $con; -function noAnswer() { - global $con; - - $SQL = "SELECT UID FROM Questions WHERE `AID`='0'"; - $Res=mysql_query($SQL, $con); - - return mysql_num_rows($Res); -} + $SQL = "SELECT UID FROM Questions WHERE `AID`='0'"; + $Res = mysql_query($SQL, $con); + return mysql_num_rows($Res); + } ?> diff --git a/includes/funktion_flag.php b/includes/funktion_flag.php index 56d8a993..b6a02242 100644 --- a/includes/funktion_flag.php +++ b/includes/funktion_flag.php @@ -1,12 +1,9 @@ -<?PHP -echo "<br>"; - -if( strpos( $_SERVER["REQUEST_URI"], "?") >0) - $URL = $_SERVER["REQUEST_URI"]. "&SetLanguage="; -else - $URL = $_SERVER["REQUEST_URI"]. "?SetLanguage="; - -echo "<a href=\"". $URL. "DE\"><img src=\"". $url. $ENGEL_ROOT. "pic/flag/de.gif\" alt=\"DE\"></a> "; -echo "<a href=\"". $URL. "EN\"><img src=\"". $url. $ENGEL_ROOT. "pic/flag/en.gif\" alt=\"EN\"></a> "; +<?php + if(strpos($_SERVER["REQUEST_URI"], "?") > 0) + $URL = $_SERVER["REQUEST_URI"] . "&SetLanguage="; + else + $URL = $_SERVER["REQUEST_URI"] . "?SetLanguage="; + echo "<a href=\"" . $URL . "DE\"><img src=\"" . $url . $ENGEL_ROOT . "pic/flag/de.gif\" alt=\"DE\" /></a> "; + echo "<a href=\"" . $URL . "EN\"><img src=\"" . $url . $ENGEL_ROOT . "pic/flag/en.gif\" alt=\"EN\" /></a> "; ?> diff --git a/includes/funktion_jabber.php b/includes/funktion_jabber.php index 9c699d70..9c699d70 100755..100644 --- a/includes/funktion_jabber.php +++ b/includes/funktion_jabber.php diff --git a/includes/funktion_lang.php b/includes/funktion_lang.php index d5d3e144..e04dd8eb 100755..100644 --- a/includes/funktion_lang.php +++ b/includes/funktion_lang.php @@ -1,35 +1,28 @@ -<?PHP +<?php + function Get_Text ($TextID, $NoError = false) { + global $con, $error_messages, $debug; + if( !isset($_SESSION['Sprache'])) + $_SESSION['Sprache'] = "EN"; + if( $_SESSION['Sprache']=="") + $_SESSION['Sprache']="EN"; + if( isset($_GET["SetLanguage"])) + $_SESSION['Sprache']= $_GET["SetLanguage"]; -function Get_Text ($TextID, $NoError=FALSE) -{ - GLOBAL $con, $error_messages, $DEBUG; - - if( !isset($_SESSION['Sprache'])) - $_SESSION['Sprache'] = "EN"; - if( $_SESSION['Sprache']=="") - $_SESSION['Sprache']="EN"; - if( isset($_GET["SetLanguage"])) - $_SESSION['Sprache']= $_GET["SetLanguage"]; + $SQL = "SELECT * FROM `Sprache` WHERE TextID=\"$TextID\" AND Sprache ='".$_SESSION['Sprache']."'"; + @$Erg = mysql_query($SQL, $con); - $SQL = "SELECT * FROM `Sprache` WHERE TextID=\"$TextID\" AND Sprache ='".$_SESSION['Sprache']."'"; - @$Erg = mysql_query($SQL, $con); - - if( mysql_num_rows( $Erg) == 1) - return (@mysql_result($Erg, 0, "Text")); - elseif( $NoError && !$DEBUG) - return ""; - else - { - array_push($error_messages, "Get_Text, '$TextID' found ". mysql_num_rows( $Erg). "x in Sprache Database Table for Language (".$_SESSION['Sprache'].")\n"); - return "Error Data, '$TextID' found ". mysql_num_rows( $Erg). "x"; - } - -} - -function Print_Text ($TextID, $NoError=FALSE) -{ - echo Get_Text ($TextID, $NoError); -} + if( mysql_num_rows( $Erg) == 1) + return (@mysql_result($Erg, 0, "Text")); + elseif( $NoError && !$debug) + return ""; + else { + array_push($error_messages, "Get_Text, '$TextID' found ". mysql_num_rows( $Erg). "x in Sprache Database Table for Language (".$_SESSION['Sprache'].")\n"); + return "Error Data, '$TextID' found ". mysql_num_rows( $Erg). "x"; + } + } + function Print_Text($TextID, $NoError = false) { + echo Get_Text($TextID, $NoError); + } ?> diff --git a/includes/funktion_menu.php b/includes/funktion_menu.php index 87196ede..c751c764 100755..100644 --- a/includes/funktion_menu.php +++ b/includes/funktion_menu.php @@ -1,44 +1,41 @@ -<?PHP +<?php + function ShowMenu( $MenuName) { + global $MenueTableStart, $MenueTableEnd, $_SESSION, $debug, $url, $ENGEL_ROOT; + $Gefunden = false; -function ShowMenu( $MenuName) -{ - global $MenueTableStart, $MenueTableEnd, $_SESSION, $DEBUG, $url, $ENGEL_ROOT; - $Gefunden=FALSE; + // Ueberschift + $Text = "<h4 class=\"menu\">". Get_Text("$MenuName/"). "</h4><ul>"; - //Überschift - $Text = "<h4 class=\"menu\">". Get_Text("$MenuName/"). "</h4>"; - - //einträge - foreach( $_SESSION['CVS'] as $Key => $Entry ) - if( strpos( $Key, ".php") > 0) - if( (strpos( "00$Key", "0$MenuName") > 0) || - ((strlen($MenuName)==0) && (strpos( "0$Key", "/") == 0) ) ) - { - $TempName = Get_Text($Key, TRUE); - if(( TRUE||$DEBUG) && (strlen($TempName)==0) ) - $TempName = "not found: \"$Key\""; - - if( $Entry == "Y") - { - //zum absichtlkichen ausblenden von einträgen - if( strlen($TempName)>1) - { - //sonderfälle: - if( $Key=="admin/faq.php") - $TempName .= " (". noAnswer(). ")"; - //ausgabe - $Text .= "\t\t\t<li><a href=\"". $url. $ENGEL_ROOT. $Key. "\">$TempName</a></li>\n"; - $Gefunden = TRUE; - } - } - elseif( $DEBUG ) - { - $Gefunden = TRUE; - $Text .= "\t\t\t<li>$TempName ($Key)</li>\n"; - } - } - if( $Gefunden) - echo $MenueTableStart.$Text.$MenueTableEnd; + // Eintraege + foreach($_SESSION['CVS'] as $Key => $Entry) + if( strpos( $Key, ".php") > 0) + if( (strpos( "00$Key", "0$MenuName") > 0) || + ((strlen($MenuName)==0) && (strpos( "0$Key", "/") == 0) ) ) { + $TempName = Get_Text($Key, true); + + if(( true||$debug) && (strlen($TempName)==0) ) + $TempName = "not found: \"$Key\""; + + if( $Entry == "Y") { + //zum absichtlkichen ausblenden von einträgen + if( strlen($TempName)>1) { + //sonderfälle: + + if( $Key=="admin/faq.php") + $TempName .= " (". noAnswer(). ")"; + //ausgabe + $Text .= "\t\t\t<li><a href=\"". $url. $ENGEL_ROOT. $Key. "\">$TempName</a></li>\n"; + $Gefunden = true; + } + } + elseif( $debug ) + { + $Gefunden = true; + $Text .= "\t\t\t<li>$TempName ($Key)</li>\n"; + } + } + if( $Gefunden) + echo $MenueTableStart.$Text.$MenueTableEnd; }//function ShowMenue ?> diff --git a/includes/funktion_modem.php b/includes/funktion_modem.php index 3a74e0f8..8e93ebf4 100755..100644 --- a/includes/funktion_modem.php +++ b/includes/funktion_modem.php @@ -1,35 +1,34 @@ -<?PHP -include "config_modem.php"; +<?php + include "config_modem.php"; -function DialNumber( $Number ) -{ - global $Dev, $ModemEnable; + function DialNumber($Number) { + global $Dev, $ModemEnable; + + if($ModemEnable) { + echo "Dial number: '<u>$Number</u>' was called<br />\n"; - if( $ModemEnable) - { - echo "Dial number: '<u>$Number</u>' was called<br>\n"; - $fp = fopen( $ModemDev, "w"); - sleep(1); - fwrite( $fp, "+++"); - sleep(1); - fwrite( $fp, "ATZ\n"); - sleep(1); - fwrite( $fp, "ATX1\n"); - sleep(1); - fwrite( $fp, "ATD $Number \n"); - sleep(8); - fclose($fp); - sleep(1); - } - else - echo "Modem is Disable, number: '<u>$Number</u>' was not called<br>\n"; + $fp = fopen( $ModemDev, "w"); + sleep(1); + fwrite( $fp, "+++"); + sleep(1); + fwrite( $fp, "ATZ\n"); + sleep(1); + fwrite( $fp, "ATX1\n"); + sleep(1); + fwrite( $fp, "ATD $Number \n"); + sleep(8); + fclose($fp); + sleep(1); + } + else + echo "Modem is Disable, number: '<u>$Number</u>' was not called<br />\n"; } function SetWackeup( $Number, $TimeH, $TimeM) { - global $WackupNumber; - DialNumber( "$WackupNumber$TimeH$TimeM$Number"); + global $WakeupNumber; + DialNumber( "$WakeupNumber$TimeH$TimeM$Number"); } ?> diff --git a/includes/funktion_schichtplan.php b/includes/funktion_schichtplan.php index 0b5b9910..afa79144 100755..100644 --- a/includes/funktion_schichtplan.php +++ b/includes/funktion_schichtplan.php @@ -2,181 +2,181 @@ /*####################################################### -# gibt die engelschischten aus # +# gibt die engelschischten aus # #######################################################*/ function ausgabe_Feld_Inhalt( $SID, $Man ) { // gibt, nach übergabe der der SchichtID (SID) und der RaumBeschreibung, // die eingetragenden und und offenden Schichteintäge zurück - global $EngelType, $EngelTypeID, $TID2Name, $con, $DEBUG, $gmdateOffset; + global $EngelType, $EngelTypeID, $TID2Name, $con, $debug, $gmdateOffset; - $Spalten = ""; + $Spalten = ""; - if( !isset($_GET["Icon"])) - $_GET["Icon"]=1; + if( !isset($_GET["Icon"])) + $_GET["Icon"]=1; - /////////////////////////////////////////////////////////////////// - // Schow Admin Page - /////////////////////////////////////////////////////////////////// - $Spalten.=funktion_isLinkAllowed_addLink_OrEmpty( - "admin/schichtplan.php?action=change&SID=$SID", - "edit<br>\n\t\t"); + /////////////////////////////////////////////////////////////////// + // Schow Admin Page + /////////////////////////////////////////////////////////////////// + $Spalten.=funktion_isLinkAllowed_addLink_OrEmpty( + "admin/schichtplan.php?action=change&SID=$SID", + "edit<br />\n\t\t"); - /////////////////////////////////////////////////////////////////// - // Ausgabe des Schischtnamens - /////////////////////////////////////////////////////////////////// - $SQL = "SELECT `URL` FROM `Shifts` WHERE (`SID` = '$SID');"; - $Erg = mysql_query($SQL, $con); - if( mysql_result($Erg, 0, 0) != "") - $Spalten.="<a href=\"". mysql_result($Erg, 0, 0). "\" target=\"_black\"><u>$Man:</u></a><br>"; - else - $Spalten.="<u>".$Man.":</u><br>"; + /////////////////////////////////////////////////////////////////// + // Ausgabe des Schischtnamens + /////////////////////////////////////////////////////////////////// + $SQL = "SELECT `URL` FROM `Shifts` WHERE (`SID` = '$SID');"; + $Erg = mysql_query($SQL, $con); + if( mysql_result($Erg, 0, 0) != "") + $Spalten.="<a href=\"". mysql_result($Erg, 0, 0). "\" target=\"_black\"><u>$Man:</u></a><br />"; + else + $Spalten.="<u>".$Man.":</u><br />"; - /////////////////////////////////////////////////////////////////// - // SQL abfrage für die benötigten schichten - /////////////////////////////////////////////////////////////////// - $SQL = "SELECT * FROM `ShiftEntry` WHERE (`SID` = '$SID') ORDER BY `TID`, `UID` DESC ;"; - $Erg = mysql_query($SQL, $con); - - $Anzahl = mysql_num_rows($Erg); - $Feld=0; - $Temp_TID_old=-1; - for( $i = 0; $i < $Anzahl; $i++ ) - { - if( isset($Temp[$Feld]["TID"])) - $Temp_TID_old = $Temp[$Feld]["TID"]; - if( isset($Temp[$Feld]["UID"])) - $Temp_UID_old = $Temp[$Feld]["UID"]; - - $Temp_TID = mysql_result($Erg, $i, "TID"); - - // wenn sich der Type ändert wird zumnästen feld geweckselt - if( $Temp_TID_old != $Temp_TID ) - $Feld++; - - $Temp[$Feld]["TID"] = $Temp_TID; - $Temp[$Feld]["UID"] = mysql_result($Erg, $i, "UID"); - - // sonderfall ersten durchlauf - if( $i == 0 ) - { - $Temp_TID_old = $Temp[$Feld]["TID"]; - $Temp_UID_old = $Temp[$Feld]["UID"]; - } - - // ist es eine zu vergeben schicht? - if( $Temp[$Feld]["UID"] == 0 ) - { - if( isset($Temp[$Feld]["free"])) - $Temp[$Feld]["free"]++; - else - $Temp[$Feld]["free"]=1; - } - else - $Temp[$Feld]["Engel"][] = $Temp[$Feld]["UID"]; - } // FOR - + /////////////////////////////////////////////////////////////////// + // SQL abfrage für die benötigten schichten + /////////////////////////////////////////////////////////////////// + $SQL = "SELECT * FROM `ShiftEntry` WHERE (`SID` = '$SID') ORDER BY `TID`, `UID` DESC ;"; + $Erg = mysql_query($SQL, $con); + + $Anzahl = mysql_num_rows($Erg); + $Feld=0; + $Temp_TID_old=-1; + for( $i = 0; $i < $Anzahl; $i++ ) + { + if( isset($Temp[$Feld]["TID"])) + $Temp_TID_old = $Temp[$Feld]["TID"]; + if( isset($Temp[$Feld]["UID"])) + $Temp_UID_old = $Temp[$Feld]["UID"]; + + $Temp_TID = mysql_result($Erg, $i, "TID"); + + // wenn sich der Type ändert wird zumnästen feld geweckselt + if( $Temp_TID_old != $Temp_TID ) + $Feld++; + + $Temp[$Feld]["TID"] = $Temp_TID; + $Temp[$Feld]["UID"] = mysql_result($Erg, $i, "UID"); + + // sonderfall ersten durchlauf + if( $i == 0 ) + { + $Temp_TID_old = $Temp[$Feld]["TID"]; + $Temp_UID_old = $Temp[$Feld]["UID"]; + } + + // ist es eine zu vergeben schicht? + if( $Temp[$Feld]["UID"] == 0 ) + { + if( isset($Temp[$Feld]["free"])) + $Temp[$Feld]["free"]++; + else + $Temp[$Feld]["free"]=1; + } + else + $Temp[$Feld]["Engel"][] = $Temp[$Feld]["UID"]; + } // FOR + - /////////////////////////////////////////////////////////////////// - // Aus gabe der Schicht - /////////////////////////////////////////////////////////////////// - if( isset($Temp)) - if( count($Temp) ) - foreach( $Temp as $TempEntry => $TempValue ) - { - if( !isset($TempValue["free"])) - $TempValue["free"] = 0; - - // ausgabe EngelType - $Spalten.= $EngelTypeID[ $TempValue["TID"] ]. " "; - - // ausgabe Eingetragener Engel - if( isset($TempValue["Engel"])) - if( count($TempValue["Engel"]) > 0 ) - { - if( count($TempValue["Engel"]) == 1 ) - $Spalten.= Get_Text("inc_schicht_ist"). ":<br>\n\t\t"; - else - $Spalten.= Get_Text("inc_schicht_sind"). ":<br>\n\t\t"; - - foreach( $TempValue["Engel"] as $TempEngelEntry=> $TempEngelID ) - { - if( funktion_isLinkAllowed( "admin/user.php") === TRUE) - { - // add color, wenn Engel "Gekommen" - $TempText= - ((UIDgekommen( $TempEngelID ) == "1") - ? "<span style=\"color: blue;\">" - : "<span style=\"color: red;\">"). - UID2Nick( $TempEngelID). "</span>"; - } - else - { - $TempText = UID2Nick( $TempEngelID ); - } - - // add link to user - $TempText= funktion_isLinkAllowed_addLink_OrLinkText( - "admin/userChangeNormal.php?enterUID=$TempEngelID&Type=Normal", - $TempText); - - $Spalten.= " ". $TempText. - ( ($_GET["Icon"]==1) ? DisplayAvatar( $TempEngelID): ""). - "<br>\n\t\t"; + /////////////////////////////////////////////////////////////////// + // Aus gabe der Schicht + /////////////////////////////////////////////////////////////////// + if( isset($Temp)) + if( count($Temp) ) + foreach( $Temp as $TempEntry => $TempValue ) + { + if( !isset($TempValue["free"])) + $TempValue["free"] = 0; + + // ausgabe EngelType + $Spalten.= $EngelTypeID[ $TempValue["TID"] ]. " "; + + // ausgabe Eingetragener Engel + if( isset($TempValue["Engel"])) + if( count($TempValue["Engel"]) > 0 ) + { + if( count($TempValue["Engel"]) == 1 ) + $Spalten.= Get_Text("inc_schicht_ist"). ":<br />\n\t\t"; + else + $Spalten.= Get_Text("inc_schicht_sind"). ":<br />\n\t\t"; + + foreach( $TempValue["Engel"] as $TempEngelEntry=> $TempEngelID ) + { + if( funktion_isLinkAllowed( "admin/user.php") === TRUE) + { + // add color, wenn Engel "Gekommen" + $TempText= + ((UIDgekommen( $TempEngelID ) == "1") + ? "<span style=\"color: blue;\">" + : "<span style=\"color: red;\">"). + UID2Nick( $TempEngelID). "</span>"; + } + else + { + $TempText = UID2Nick( $TempEngelID ); + } + + // add link to user + $TempText= funktion_isLinkAllowed_addLink_OrLinkText( + "admin/userChangeNormal.php?enterUID=$TempEngelID&Type=Normal", + $TempText); + + $Spalten.= " ". $TempText. + ( ($_GET["Icon"]==1) ? DisplayAvatar( $TempEngelID): ""). + "<br />\n\t\t"; - } - $Spalten = substr( $Spalten, 0, strlen($Spalten)-7 ); - } - - // ausgabe benötigter Engel - //////////////////////////// - //in vergangenheit - $SQLtime = "SELECT `DateE` FROM `Shifts` WHERE (`SID`='$SID' AND `DateE` >= '". - gmdate("Y-m-d H:i:s", time()+ $gmdateOffset). "')"; - $Ergtime = mysql_query($SQLtime, $con); - if( mysql_num_rows( $Ergtime) > 0) - { - //wenn keien rechte definiert sind - if( !isset($_SESSION['CVS'][ $TID2Name[$TempValue["TID"]] ])) - $_SESSION['CVS'][ $TID2Name[$TempValue["TID"]] ] = "Y"; + } + $Spalten = substr( $Spalten, 0, strlen($Spalten)-7 ); + } + + // ausgabe benötigter Engel + //////////////////////////// + //in vergangenheit + $SQLtime = "SELECT `DateE` FROM `Shifts` WHERE (`SID`='$SID' AND `DateE` >= '". + gmdate("Y-m-d H:i:s", time()+ $gmdateOffset). "')"; + $Ergtime = mysql_query($SQLtime, $con); + if( mysql_num_rows( $Ergtime) > 0) + { + //wenn keien rechte definiert sind + if( !isset($_SESSION['CVS'][ $TID2Name[$TempValue["TID"]] ])) + $_SESSION['CVS'][ $TID2Name[$TempValue["TID"]] ] = "Y"; - if( $_SESSION['CVS'][ $TID2Name[$TempValue["TID"]] ] == "Y") - if( $TempValue["free"] > 0 ) - { - $Spalten.= "<br>\n\t\t <a href=\"./schichtplan_add.php?SID=$SID&TID=". - $TempValue["TID"]."\">"; - $Spalten.= $TempValue["free"]; - if( $TempValue["free"] != 1 ) - $Spalten.= Get_Text("inc_schicht_weitere"). - " ".Get_Text("inc_schicht_Engel"). - Get_Text("inc_schicht_wird"); - else - $Spalten.= Get_Text("inc_schicht_weiterer"). - " ".Get_Text("inc_schicht_Engel"). - Get_Text("inc_schicht_werden"); - $Spalten.= Get_Text("inc_schicht_noch_gesucht"); - $Spalten.= "</a>"; - } - } - else - { - if( isset($TempValue["free"])) - if( $TempValue["free"] > 0 ) - $Spalten.= "<br>\n\t\t <h3><a>Fehlen noch: ". - $TempValue["free"]. "</a></h3>"; - } - $Spalten.= "<br>\n\t\t"; - - } // FOREACH - return $Spalten; + if( $_SESSION['CVS'][ $TID2Name[$TempValue["TID"]] ] == "Y") + if( $TempValue["free"] > 0 ) + { + $Spalten.= "<br />\n\t\t <a href=\"./schichtplan_add.php?SID=$SID&TID=". + $TempValue["TID"]."\">"; + $Spalten.= $TempValue["free"]; + if( $TempValue["free"] != 1 ) + $Spalten.= Get_Text("inc_schicht_weitere"). + " ".Get_Text("inc_schicht_Engel"). + Get_Text("inc_schicht_wird"); + else + $Spalten.= Get_Text("inc_schicht_weiterer"). + " ".Get_Text("inc_schicht_Engel"). + Get_Text("inc_schicht_werden"); + $Spalten.= Get_Text("inc_schicht_noch_gesucht"); + $Spalten.= "</a>"; + } + } + else + { + if( isset($TempValue["free"])) + if( $TempValue["free"] > 0 ) + $Spalten.= "<br />\n\t\t <h3><a>Fehlen noch: ". + $TempValue["free"]. "</a></h3>"; + } + $Spalten.= "<br />\n\t\t"; + + } // FOREACH + return $Spalten; } // function Ausgabe_Feld_Inhalt /*####################################################### -# gibt die engelschischten Druckergerecht aus # +# gibt die engelschischten Druckergerecht aus # #######################################################*/ function Ausgabe_Feld_Inhalt_Druck($RID, $Man ) { @@ -190,200 +190,200 @@ function Ausgabe_Feld_Inhalt_Druck($RID, $Man ) /*####################################################### -# Ausgabe der Raum Spalten # +# Ausgabe der Raum Spalten # #######################################################*/ function CreateRoomShifts( $raum ) { - global $Spalten, $ausdatum, $con, $DEBUG, $GlobalZeileProStunde, $error_messages; - - ///////////////////////////////////////////////////////////// - // beginnt die erste schicht vor dem heutigen tag und geht darüber hinaus - ///////////////////////////////////////////////////////////// - $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 23:59:59') AND ". - "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; - $ErgSonder = mysql_query($SQLSonder, $con); - if( (mysql_num_rows( $ErgSonder) > 1) ) - { - if( funktion_isLinkAllowed( "admin/schichtplan.php") === TRUE ) - { - echo "<h1>". Get_Text("pub_schichtplan_colision"). "</h1> "; - for( $i=0; $i<mysql_num_rows( $ErgSonder); $i++) - { - echo "<a href=\"./../admin/schichtplan.php?action=change&SID=". - mysql_result($ErgSonder, $i, "SID"). "\">". - mysql_result($ErgSonder, $i, "DateS"). - " '". mysql_result($ErgSonder, $i, "Man")."' (RID $raum) (00-24)". - "</a><br>\n\t\t"; - } - } - } - elseif( (mysql_num_rows( $ErgSonder) == 1) ) - { - $Spalten[0].= "\t\t<td valign=\"top\" rowspan=\"". (24 * $GlobalZeileProStunde). "\">\n". - "\t\t\t<h3>↑↑↑</h3>". - Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"), - mysql_result($ErgSonder, 0, "Man") ). - "\t\t\t<h3>↓↓↓</h3>". - "\n\t\t</td>\n"; - return; - } - - $ZeitZeiger = 0; + global $Spalten, $ausdatum, $con, $debug, $GlobalZeileProStunde, $error_messages; + + ///////////////////////////////////////////////////////////// + // beginnt die erste schicht vor dem heutigen tag und geht darüber hinaus + ///////////////////////////////////////////////////////////// + $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` ". + "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 23:59:59') AND ". + "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; + $ErgSonder = mysql_query($SQLSonder, $con); + if( (mysql_num_rows( $ErgSonder) > 1) ) + { + if( funktion_isLinkAllowed( "admin/schichtplan.php") === TRUE ) + { + echo "<h1>". Get_Text("pub_schichtplan_colision"). "</h1> "; + for( $i=0; $i<mysql_num_rows( $ErgSonder); $i++) + { + echo "<a href=\"./../admin/schichtplan.php?action=change&SID=". + mysql_result($ErgSonder, $i, "SID"). "\">". + mysql_result($ErgSonder, $i, "DateS"). + " '". mysql_result($ErgSonder, $i, "Man")."' (RID $raum) (00-24)". + "</a><br />\n\t\t"; + } + } + } + elseif( (mysql_num_rows( $ErgSonder) == 1) ) + { + $Spalten[0].= "\t\t<td valign=\"top\" rowspan=\"". (24 * $GlobalZeileProStunde). "\">\n". + "\t\t\t<h3>↑↑↑</h3>". + Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"), + mysql_result($ErgSonder, 0, "Man") ). + "\t\t\t<h3>↓↓↓</h3>". + "\n\t\t</td>\n"; + return; + } + + $ZeitZeiger = 0; - ///////////////////////////////////////////////////////////// - // beginnt die erste schicht vor dem heutigen tag? - ///////////////////////////////////////////////////////////// - $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 00:00:00') AND ". - "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; - $ErgSonder = mysql_query($SQLSonder, $con); - if( (mysql_num_rows( $ErgSonder) > 1) ) - { - if( funktion_isLinkAllowed( "admin/schichtplan.php") === TRUE ) - { - echo "<h1>". Get_Text("pub_schichtplan_colision"). "</h1> "; - for( $i=0; $i<mysql_num_rows( $ErgSonder); $i++) - { - echo "<a href=\"./../admin/schichtplan.php?action=change&SID=". - mysql_result($ErgSonder, $i, "SID"). "\">". - mysql_result($ErgSonder, $i, "DateS"). - " '". mysql_result($ErgSonder, $i, "Man")."' (RID $raum) (00-xx)". - "</a><br>\n\t\t"; - } - } - } - elseif( (mysql_num_rows( $ErgSonder) == 1) ) - { - $ZeitZeiger = substr( mysql_result($ErgSonder, 0, "DateE"), 11, 2 )+ - (substr( mysql_result($ErgSonder, 0, "DateE"), 14, 2 ) / 60); - $Spalten[0].= "\t\t<td valign=\"top\" rowspan=\"". ($ZeitZeiger * $GlobalZeileProStunde). "\">\n". - "\t\t\t<h3>↑↑↑</h3>". - Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"), - mysql_result($ErgSonder, 0, "Man") ). - "\n\t\t</td>\n"; - } - - ///////////////////////////////////////////////////////////// - // gibt die schichten für den tag aus - ///////////////////////////////////////////////////////////// - $SQL = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') and ". - "(`DateS` >= '$ausdatum $ZeitZeiger:00:00') and ". - "(`DateS` like '$ausdatum%')) ORDER BY `DateS`;"; - $Erg = mysql_query($SQL, $con); - for( $i = 0; $i < mysql_num_rows($Erg); ++$i ) - { - $ZeitPos = substr( mysql_result($Erg, $i, "DateS"), 11, 2 )+ - (substr( mysql_result($Erg, $i, "DateS"), 14, 2 ) / 60); - $len = mysql_result($Erg, $i, "Len"); + ///////////////////////////////////////////////////////////// + // beginnt die erste schicht vor dem heutigen tag? + ///////////////////////////////////////////////////////////// + $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` ". + "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 00:00:00') AND ". + "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; + $ErgSonder = mysql_query($SQLSonder, $con); + if( (mysql_num_rows( $ErgSonder) > 1) ) + { + if( funktion_isLinkAllowed( "admin/schichtplan.php") === TRUE ) + { + echo "<h1>". Get_Text("pub_schichtplan_colision"). "</h1> "; + for( $i=0; $i<mysql_num_rows( $ErgSonder); $i++) + { + echo "<a href=\"./../admin/schichtplan.php?action=change&SID=". + mysql_result($ErgSonder, $i, "SID"). "\">". + mysql_result($ErgSonder, $i, "DateS"). + " '". mysql_result($ErgSonder, $i, "Man")."' (RID $raum) (00-xx)". + "</a><br />\n\t\t"; + } + } + } + elseif( (mysql_num_rows( $ErgSonder) == 1) ) + { + $ZeitZeiger = substr( mysql_result($ErgSonder, 0, "DateE"), 11, 2 )+ + (substr( mysql_result($ErgSonder, 0, "DateE"), 14, 2 ) / 60); + $Spalten[0].= "\t\t<td valign=\"top\" rowspan=\"". ($ZeitZeiger * $GlobalZeileProStunde). "\">\n". + "\t\t\t<h3>↑↑↑</h3>". + Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"), + mysql_result($ErgSonder, 0, "Man") ). + "\n\t\t</td>\n"; + } + + ///////////////////////////////////////////////////////////// + // gibt die schichten für den tag aus + ///////////////////////////////////////////////////////////// + $SQL = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". + "WHERE ((`RID` = '$raum') and ". + "(`DateS` >= '$ausdatum $ZeitZeiger:00:00') and ". + "(`DateS` like '$ausdatum%')) ORDER BY `DateS`;"; + $Erg = mysql_query($SQL, $con); + for( $i = 0; $i < mysql_num_rows($Erg); ++$i ) + { + $ZeitPos = substr( mysql_result($Erg, $i, "DateS"), 11, 2 )+ + (substr( mysql_result($Erg, $i, "DateS"), 14, 2 ) / 60); + $len = mysql_result($Erg, $i, "Len"); - if( $len <= 0) - array_push( $error_messages, "Error in shift denition SID=". mysql_result($Erg, $i, "SID"). " Len=$len"); - - if( $ZeitZeiger < $ZeitPos ) - { - $Spalten[$ZeitZeiger * $GlobalZeileProStunde].= - "\t\t<td valign=\"top\" rowspan=\"". ( ($ZeitPos - $ZeitZeiger ) * $GlobalZeileProStunde ). "\"> </td>\n"; + if( $len <= 0) + array_push( $error_messages, "Error in shift denition SID=". mysql_result($Erg, $i, "SID"). " Len=$len"); + + if( $ZeitZeiger < $ZeitPos ) + { + $Spalten[$ZeitZeiger * $GlobalZeileProStunde].= + "\t\t<td valign=\"top\" rowspan=\"". ( ($ZeitPos - $ZeitZeiger ) * $GlobalZeileProStunde ). "\"> </td>\n"; - $ZeitZeiger += $ZeitPos - $ZeitZeiger; - } - if($ZeitZeiger == $ZeitPos ) - { - //sonderfall wenn die schicht über dei 24 stunden hinaus geht - // (eintrag abkürzen, pfeiel ausgeben) - $Spalten[$ZeitZeiger * $GlobalZeileProStunde].= - "\t\t<td valign=\"top\" rowspan=\"". - ( ( ($len+$ZeitZeiger)? $len : 24-$len+$ZeitZeiger) * $GlobalZeileProStunde). - "\">\n". - "\t\t\t". - Ausgabe_Feld_Inhalt( mysql_result($Erg, $i, "SID"), - mysql_result($Erg, $i, "Man") ). - (( ($ZeitZeiger+$len) > 24)? "\t\t\t<h3>↓↓↓</h3>" : ""). - "\n\t\t</td>\n"; - $ZeitZeiger += $len; - } - else - { - echo "<h1>". Get_Text("pub_schichtplan_colision"). "</h1> "; - echo "<a href=\"./../admin/schichtplan.php?action=change&SID=". - mysql_result($Erg, $i, "SID"). "\">". - mysql_result($Erg, $i, "DateS"). - " '". mysql_result($Erg, $i, "Man"). "' ". - " (". mysql_result($Erg, $i, "SID"). " R$raum) (xx-xx)</a><br><br>"; - } - } - if( $ZeitZeiger < 24 ) - $Spalten[($ZeitZeiger * $GlobalZeileProStunde)].= - "\t\t<td valign=\"top\" rowspan=\"". - ((24 - $ZeitZeiger) * $GlobalZeileProStunde ). - "\"> </td>\n"; + $ZeitZeiger += $ZeitPos - $ZeitZeiger; + } + if($ZeitZeiger == $ZeitPos ) + { + //sonderfall wenn die schicht über dei 24 stunden hinaus geht + // (eintrag abkürzen, pfeiel ausgeben) + $Spalten[$ZeitZeiger * $GlobalZeileProStunde].= + "\t\t<td valign=\"top\" rowspan=\"". + ( ( ($len+$ZeitZeiger)? $len : 24-$len+$ZeitZeiger) * $GlobalZeileProStunde). + "\">\n". + "\t\t\t". + Ausgabe_Feld_Inhalt( mysql_result($Erg, $i, "SID"), + mysql_result($Erg, $i, "Man") ). + (( ($ZeitZeiger+$len) > 24)? "\t\t\t<h3>↓↓↓</h3>" : ""). + "\n\t\t</td>\n"; + $ZeitZeiger += $len; + } + else + { + echo "<h1>". Get_Text("pub_schichtplan_colision"). "</h1> "; + echo "<a href=\"./../admin/schichtplan.php?action=change&SID=". + mysql_result($Erg, $i, "SID"). "\">". + mysql_result($Erg, $i, "DateS"). + " '". mysql_result($Erg, $i, "Man"). "' ". + " (". mysql_result($Erg, $i, "SID"). " R$raum) (xx-xx)</a><br /><br />"; + } + } + if( $ZeitZeiger < 24 ) + $Spalten[($ZeitZeiger * $GlobalZeileProStunde)].= + "\t\t<td valign=\"top\" rowspan=\"". + ((24 - $ZeitZeiger) * $GlobalZeileProStunde ). + "\"> </td>\n"; } // function CreateRoomShifts /*####################################################### -# Ausgabe der freien schichten # +# Ausgabe der freien schichten # #######################################################*/ function showEmptyShifts( ) { - global $con, $DEBUG, $RoomID, $gmdateOffset; + global $con, $debug, $RoomID, $gmdateOffset; - echo "<table border=\"1\">\n"; - echo "<tr>\n"; - echo "\t<th>". Get_Text("inc_schicht_date"). "</th>\n"; - echo "\t<th>". Get_Text("inc_schicht_time"). "</th>\n"; - echo "\t<th>". Get_Text("inc_schicht_room"). "</th>\n"; - echo "\t<th>". Get_Text("inc_schicht_commend"). "</th>\n"; - echo "</tr>\n"; - - $sql = "SELECT `SID`, `DateS`, `Man`, `RID` FROM `Shifts` ". - "WHERE (`Shifts`.`DateS`>='". gmdate("Y-m-d H:i:s", time()+$gmdateOffset). "') ". - "ORDER BY `DateS`, `RID`;"; - $Erg = mysql_query($sql, $con); + echo "<table border=\"1\">\n"; + echo "<tr>\n"; + echo "\t<th>". Get_Text("inc_schicht_date"). "</th>\n"; + echo "\t<th>". Get_Text("inc_schicht_time"). "</th>\n"; + echo "\t<th>". Get_Text("inc_schicht_room"). "</th>\n"; + echo "\t<th>". Get_Text("inc_schicht_commend"). "</th>\n"; + echo "</tr>\n"; + + $sql = "SELECT `SID`, `DateS`, `Man`, `RID` FROM `Shifts` ". + "WHERE (`Shifts`.`DateS`>='". gmdate("Y-m-d H:i:s", time()+$gmdateOffset). "') ". + "ORDER BY `DateS`, `RID`;"; + $Erg = mysql_query($sql, $con); - $angezeigt = 0; - for ($i=0; ($i<mysql_num_rows($Erg)) && ($angezeigt< 15); $i++) - if( isset($RoomID[mysql_result( $Erg, $i, "RID")])) - if( $RoomID[mysql_result( $Erg, $i, "RID")]!="" ) - { - $Sql2 = "SELECT `UID` FROM `ShiftEntry` ". - "WHERE `SID`=". mysql_result( $Erg, $i, "SID"). " AND ". - "`UID`='0';"; - $Erg2 = mysql_query($Sql2, $con); - - if( mysql_num_rows($Erg2)>0) - { - $angezeigt++; - echo "<tr>\n"; - echo "\t<td>". substr(mysql_result( $Erg, $i, "DateS"), 0, 10). "</td>\n"; - echo "\t<td>". substr(mysql_result( $Erg, $i, "DateS"), 11). "</td>\n"; - echo "\t<td>". $RoomID[mysql_result( $Erg, $i, "RID")]. "</td>\n"; - echo "\t<td>". - ausgabe_Feld_Inhalt( mysql_result( $Erg, $i, "SID"), mysql_result( $Erg, $i, "Man")). - "</td>\n"; - echo "</tr>\n"; - } - } - - echo "</table>\n"; - + $angezeigt = 0; + for ($i=0; ($i<mysql_num_rows($Erg)) && ($angezeigt< 15); $i++) + if( isset($RoomID[mysql_result( $Erg, $i, "RID")])) + if( $RoomID[mysql_result( $Erg, $i, "RID")]!="" ) + { + $Sql2 = "SELECT `UID` FROM `ShiftEntry` ". + "WHERE `SID`=". mysql_result( $Erg, $i, "SID"). " AND ". + "`UID`='0';"; + $Erg2 = mysql_query($Sql2, $con); + + if( mysql_num_rows($Erg2)>0) + { + $angezeigt++; + echo "<tr>\n"; + echo "\t<td>". substr(mysql_result( $Erg, $i, "DateS"), 0, 10). "</td>\n"; + echo "\t<td>". substr(mysql_result( $Erg, $i, "DateS"), 11). "</td>\n"; + echo "\t<td>". $RoomID[mysql_result( $Erg, $i, "RID")]. "</td>\n"; + echo "\t<td>". + ausgabe_Feld_Inhalt( mysql_result( $Erg, $i, "SID"), mysql_result( $Erg, $i, "Man")). + "</td>\n"; + echo "</tr>\n"; + } + } + + echo "</table>\n"; + } //function showEmptyShifts - + /*####################################################### -# Gibt die anzahl der Schichten im Raum zurück # +# Gibt die anzahl der Schichten im Raum zurück # #######################################################*/ function SummRoomShifts( $raum ) { - global $ausdatum, $con, $DEBUG, $GlobalZeileProStunde; - - $SQLSonder = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') AND (`DateE` >= '$ausdatum 00:00:00') AND ". - "(`DateS` <= '$ausdatum 23:59:59') ) ORDER BY `DateS`;"; + global $ausdatum, $con, $debug, $GlobalZeileProStunde; + + $SQLSonder = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". + "WHERE ((`RID` = '$raum') AND (`DateE` >= '$ausdatum 00:00:00') AND ". + "(`DateS` <= '$ausdatum 23:59:59') ) ORDER BY `DateS`;"; - $ErgSonder = mysql_query($SQLSonder, $con); - - return mysql_num_rows($ErgSonder); + $ErgSonder = mysql_query($SQLSonder, $con); + + return mysql_num_rows($ErgSonder); } ?> diff --git a/includes/funktion_schichtplan_Tage.php b/includes/funktion_schichtplan_Tage.php index 5ac92e7e..2c21a992 100755..100644 --- a/includes/funktion_schichtplan_Tage.php +++ b/includes/funktion_schichtplan_Tage.php @@ -1,87 +1,101 @@ -<?PHP +<?php + if(!function_exists("DatumUm1TagErhoehen")) { + function DatumUm1TagErhoehen( $Datum) { + $Jahr = substr($Datum, 0, 4); + $Monat = substr($Datum, 5, 2); + $Tag = substr($Datum, 8, 2); -if( !function_exists("DatumUm1TagErhoehen")) -{ - function DatumUm1TagErhoehen( $Datum) - { - $Jahr = substr( $Datum, 0, 4); - $Monat = substr( $Datum, 5, 2); - $Tag = substr( $Datum, 8, 2); + $Tag++; - $Tag++; - - switch( $Monat) - { - case 1: $Mmax=31; break; - case 2: $Mmax=28; break; - case 3: $Mmax=31; break; - case 4: $Mmax=30; break; - case 5: $Mmax=31; break; - case 6: $Mmax=30; break; - case 7: $Mmax=31; break; - case 8: $Mmax=31; break; - case 9: $Mmax=30; break; - case 10: $Mmax=31; break; - case 11: $Mmax=30; break; - case 12: $Mmax=31; break; - } + switch( $Monat) { + case 1: + $Mmax = 31; + break; + case 2: + $Mmax = 28; + break; + case 3: + $Mmax = 31; + break; + case 4: + $Mmax = 30; + break; + case 5: + $Mmax = 31; + break; + case 6: + $Mmax = 30; + break; + case 7: + $Mmax = 31; + break; + case 8: + $Mmax = 31; + break; + case 9: + $Mmax = 30; + break; + case 10: + $Mmax = 31; + break; + case 11: + $Mmax = 30; + break; + case 12: + $Mmax = 31; + break; + } - if( $Tag > $Mmax) - { - $Tag = 1; - $Monat++; - } + if($Tag > $Mmax) { + $Tag = 1; + $Monat++; + } - if( $Monat > 12 ) - { - $Monat = 1; - $Jahr++; - } + if($Monat > 12) { + $Monat = 1; + $Jahr++; + } - $Tag = strlen( $Tag ) == 1 ? "0".$Tag : $Tag; - $Monat = strlen( $Monat ) == 1 ? "0".$Monat : $Monat; + $Tag = strlen( $Tag ) == 1 ? "0".$Tag : $Tag; + $Monat = strlen( $Monat ) == 1 ? "0".$Monat : $Monat; - return ("$Jahr-$Monat-$Tag"); - } //function DatumUm1Tagerhoehen( -} + return ("$Jahr-$Monat-$Tag"); + } + } -//suchen den ersten eintrags -$SQL = "SELECT `DateS` FROM `Shifts` ORDER BY `DateS` LIMIT 1"; -$Erg = mysql_query($SQL, $con); + // suchen den ersten eintrags + $SQL = "SELECT `DateS` FROM `Shifts` ORDER BY `DateS` LIMIT 1"; + $Erg = mysql_query($SQL, $con); -$Pos=0; + $Pos = 0; -if( mysql_num_rows($Erg)>0) -{ - do - { - //Startdatum einlesen und link ausgeben - $DateS = substr(mysql_result($Erg, 0 , 0), 0,10); - $VeranstaltungsTage[$Pos++] = $DateS; - - //auslesen den endes und eventuelle weitere tage ausgeben - $SQL2 = "SELECT MAX(`DateE`) FROM `Shifts` ". - "WHERE ( (`DateS` like '$DateS%') AND NOT (`DateE` like '%00:00:00'))"; - $Erg2 = mysql_query($SQL2, $con); - $DateE = substr(mysql_result($Erg2, 0 , 0), 0,10); + if(mysql_num_rows($Erg) > 0) { + do { + // Startdatum einlesen und link ausgeben + $DateS = substr(mysql_result($Erg, 0 , 0), 0,10); + $VeranstaltungsTage[$Pos++] = $DateS; + + // auslesen den endes und eventuelle weitere tage ausgeben + $SQL2 = "SELECT MAX(`DateE`) FROM `Shifts` WHERE ( (`DateS` like '$DateS%') AND NOT (`DateE` like '%00:00:00'))"; + $Erg2 = mysql_query($SQL2, $con); + $DateE = substr(mysql_result($Erg2, 0 , 0), 0,10); - if( strlen($DateE) == 0) - $DateE = $DateS; - else - while( $DateS != $DateE) - { - $DateS = DatumUm1TagErhoehen( $DateS); - $VeranstaltungsTage[$Pos++] = $DateS; - } + if(strlen($DateE) == 0) + $DateE = $DateS; + else + while( $DateS != $DateE) { + $DateS = DatumUm1TagErhoehen( $DateS); + $VeranstaltungsTage[$Pos++] = $DateS; + } - //suchen den nästen eintrag - $SQL = "SELECT `DateS` FROM `Shifts` ". - "WHERE (`DateS` > '$DateE 23:59:59' ) ". - "ORDER BY `DateS` ". - "LIMIT 1"; - $Erg = mysql_query($SQL, $con); + // suchen den naesten eintrag + $SQL = "SELECT `DateS` FROM `Shifts` ". + "WHERE (`DateS` > '$DateE 23:59:59' ) ". + "ORDER BY `DateS` ". + "LIMIT 1"; + $Erg = mysql_query($SQL, $con); } while( mysql_fetch_row($Erg) > 0); -} -$VeranstaltungsTageMax = $Pos-1; + } + $VeranstaltungsTageMax = $Pos - 1; ?> diff --git a/includes/funktion_schichtplan_aray.php b/includes/funktion_schichtplan_aray.php index 2f7f4b36..f9b04bd6 100755..100644 --- a/includes/funktion_schichtplan_aray.php +++ b/includes/funktion_schichtplan_aray.php @@ -5,34 +5,34 @@ #######################################################*/ // erstellt ein Array der Reume - $sql = "SELECT `RID`, `Name` FROM `Room` ". - "WHERE `Show`='Y'". - "ORDER BY `Number`, `Name`;"; - - $Erg = mysql_query($sql, $con); - $rowcount = mysql_num_rows($Erg); + $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"); - } + 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"); + } // erstellt ein Aray der Engeltypen - $sql = "SELECT `TID`, `Name` FROM `EngelType` ORDER BY `Name`"; - $Erg = mysql_query($sql, $con); - $rowcount = mysql_num_rows($Erg); - for ($i=0; $i<$rowcount; $i++) - { - $EngelType[$i]["TID"] = mysql_result($Erg, $i, "TID"); - $EngelType[$i]["Name"] = mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); + $sql = "SELECT `TID`, `Name` FROM `EngelType` ORDER BY `Name`"; + $Erg = mysql_query($sql, $con); + $rowcount = mysql_num_rows($Erg); + for ($i=0; $i<$rowcount; $i++) + { + $EngelType[$i]["TID"] = mysql_result($Erg, $i, "TID"); + $EngelType[$i]["Name"] = mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); - $EngelTypeID[ mysql_result($Erg, $i, "TID") ] = - mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); - $TID2Name[ mysql_result($Erg, $i, "TID") ] = mysql_result($Erg, $i, "Name"); - } + $EngelTypeID[ mysql_result($Erg, $i, "TID") ] = + mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); + $TID2Name[ mysql_result($Erg, $i, "TID") ] = mysql_result($Erg, $i, "Name"); + } include ("funktion_schichtplan_Tage.php"); ?> diff --git a/includes/funktion_schichtplan_beamer.php b/includes/funktion_schichtplan_beamer.php index ab935e0d..177b6cb3 100755..100644 --- a/includes/funktion_schichtplan_beamer.php +++ b/includes/funktion_schichtplan_beamer.php @@ -5,176 +5,176 @@ #######################################################*/ // erstellt ein Array der Reume - $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"); - } + $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"); + } // erstellt ein Aray der Engeltypen - $sql = "SELECT `TID`, `Name` FROM `EngelType` ORDER BY `Name`"; - $Erg = mysql_query($sql, $con); - $rowcount = mysql_num_rows($Erg); - for ($i=0; $i<$rowcount; $i++) - { - $EngelType[$i]["TID"] = mysql_result($Erg, $i, "TID"); - $EngelType[$i]["Name"] = mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); + $sql = "SELECT `TID`, `Name` FROM `EngelType` ORDER BY `Name`"; + $Erg = mysql_query($sql, $con); + $rowcount = mysql_num_rows($Erg); + for ($i=0; $i<$rowcount; $i++) + { + $EngelType[$i]["TID"] = mysql_result($Erg, $i, "TID"); + $EngelType[$i]["Name"] = mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); - $EngelTypeID[ mysql_result($Erg, $i, "TID") ] = - mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); - } + $EngelTypeID[ mysql_result($Erg, $i, "TID") ] = + mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); + } /*####################################################### -# gibt die engelschischten aus # +# gibt die engelschischten aus # #######################################################*/ function ausgabe_Feld_Inhalt( $SID, $Man ) { // gibt, nach übergabe der der SchichtID (SID) und der RaumBeschreibung, // die eingetragenden und und offenden Schichteintäge zurück - global $EngelType, $EngelTypeID, $con; - //form Config - global $DEBUG; - - $Out = ""; - - $Out.= "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" frame=\"void\">\n"; - - $Out.= "\t\t\t<colgroup span=\"2\" align=\"left\" valign=\"center\">\n". - "\t\t\t\t<col width=\"45%\">\n". - "\t\t\t\t<col width=\"*\">\n". - "\t\t\t\t</colgroup>\n"; - - /////////////////////////////////////////////////////////////////// - // SQL abfrage für die benötigten schichten - /////////////////////////////////////////////////////////////////// - $SQL = "SELECT * FROM `ShiftEntry` WHERE (`SID` = '$SID') ORDER BY `TID`, `UID` DESC ;"; - $Erg = mysql_query($SQL, $con); - - $Anzahl = mysql_num_rows($Erg); - $Feld=-1; - for( $i = 0; $i < $Anzahl; $i++ ) - { - - $Temp_TID = mysql_result($Erg, $i, "TID"); - - // wenn sich der Type ändert wird zumnästen feld geweckselt - if( ($i==0) || ($Temp_TID_old != $Temp_TID) ) - { - $Feld++; - $Temp[$Feld]["free"]=0; - $Temp[$Feld]["Engel"]=array(); - } - - $Temp[$Feld]["TID"] = $Temp_TID; - $Temp[$Feld]["UID"] = mysql_result($Erg, $i, "UID"); - - // ist es eine zu vergeben schicht? - if( $Temp[$Feld]["UID"] == 0 ) - $Temp[$Feld]["free"]++; - else - $Temp[$Feld]["Engel"][] = $Temp[$Feld]["UID"]; - - $Temp_TID_old = $Temp[$Feld]["TID"]; - } // FOR - - - /////////////////////////////////////////////////////////////////// - // Aus gabe der Schicht - /////////////////////////////////////////////////////////////////// - if( isset($Temp) && count($Temp) ) - foreach( $Temp as $TempEntry => $TempValue ) - { - $Out.= "\t\t\t<tr>\n"; - - // ausgabe EngelType - $Out.= "\t\t\t\t<td>". $EngelTypeID[ $TempValue["TID"] ]; - - // ausgabe Eingetragener Engel - if( count($TempValue["Engel"]) > 0 ) - { - if( count($TempValue["Engel"]) == 1 ) - $Out.= " ". trim(Get_Text("inc_schicht_ist")). ":"; - else - $Out.= " ". trim(Get_Text("inc_schicht_sind")). ":"; - $Out.= "</td>\n"; - $Out.= "\t\t\t\t<td>"; - - foreach( $TempValue["Engel"] as $TempEngelEntry=> $TempEngelID ) - $Out.= UID2Nick( $TempEngelID ). ", "; -// $Out.= UID2Nick( $TempEngelID ). DisplayAvatar( $TempEngelID ). ", "; - $Out = substr( $Out, 0, strlen($Out)-2 ); - } - else - { - $Out.= ":</td>\n"; - $Out.= "\t\t\t\t<td>\n"; - } - - - // ausgabe benötigter Engel - //////////////////////////// - if( $_SESSION['CVS']["nonpublic/schichtplan_add.php"] == "Y") + global $EngelType, $EngelTypeID, $con; + //form Config + global $debug; + + $Out = ""; + + $Out.= "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" frame=\"void\">\n"; + + $Out.= "\t\t\t<colgroup span=\"2\" align=\"left\" valign=\"center\">\n". + "\t\t\t\t<col width=\"45%\">\n". + "\t\t\t\t<col width=\"*\">\n". + "\t\t\t\t</colgroup>\n"; + + /////////////////////////////////////////////////////////////////// + // SQL abfrage für die benötigten schichten + /////////////////////////////////////////////////////////////////// + $SQL = "SELECT * FROM `ShiftEntry` WHERE (`SID` = '$SID') ORDER BY `TID`, `UID` DESC ;"; + $Erg = mysql_query($SQL, $con); + + $Anzahl = mysql_num_rows($Erg); + $Feld=-1; + for( $i = 0; $i < $Anzahl; $i++ ) + { + + $Temp_TID = mysql_result($Erg, $i, "TID"); + + // wenn sich der Type ändert wird zumnästen feld geweckselt + if( ($i==0) || ($Temp_TID_old != $Temp_TID) ) + { + $Feld++; + $Temp[$Feld]["free"]=0; + $Temp[$Feld]["Engel"]=array(); + } + + $Temp[$Feld]["TID"] = $Temp_TID; + $Temp[$Feld]["UID"] = mysql_result($Erg, $i, "UID"); + + // ist es eine zu vergeben schicht? + if( $Temp[$Feld]["UID"] == 0 ) + $Temp[$Feld]["free"]++; + else + $Temp[$Feld]["Engel"][] = $Temp[$Feld]["UID"]; + + $Temp_TID_old = $Temp[$Feld]["TID"]; + } // FOR + + + /////////////////////////////////////////////////////////////////// + // Aus gabe der Schicht + /////////////////////////////////////////////////////////////////// + if( isset($Temp) && count($Temp) ) + foreach( $Temp as $TempEntry => $TempValue ) + { + $Out.= "\t\t\t<tr>\n"; + + // ausgabe EngelType + $Out.= "\t\t\t\t<td>". $EngelTypeID[ $TempValue["TID"] ]; + + // ausgabe Eingetragener Engel + if( count($TempValue["Engel"]) > 0 ) + { + if( count($TempValue["Engel"]) == 1 ) + $Out.= " ". trim(Get_Text("inc_schicht_ist")). ":"; + else + $Out.= " ". trim(Get_Text("inc_schicht_sind")). ":"; + $Out.= "</td>\n"; + $Out.= "\t\t\t\t<td>"; + + foreach( $TempValue["Engel"] as $TempEngelEntry=> $TempEngelID ) + $Out.= UID2Nick( $TempEngelID ). ", "; +// $Out.= UID2Nick( $TempEngelID ). DisplayAvatar( $TempEngelID ). ", "; + $Out = substr( $Out, 0, strlen($Out)-2 ); + } + else + { + $Out.= ":</td>\n"; + $Out.= "\t\t\t\t<td>\n"; + } + + + // ausgabe benötigter Engel + //////////////////////////// + if( $_SESSION['CVS']["nonpublic/schichtplan_add.php"] == "Y") { - if ( $TempValue["free"] > 0) - { - if( count($TempValue["Engel"]) > 0) - $Out.= ", "; - $Out.= $TempValue["free"]. "x free "; - } - } - $Out.= "</td>\n"; - $Out.= "\t\t\t</tr>\n"; - - } // FOREACH - - $Out.= "\t\t\t</table>\n\t"; - - return $Out; + if ( $TempValue["free"] > 0) + { + if( count($TempValue["Engel"]) > 0) + $Out.= ", "; + $Out.= $TempValue["free"]. "x free "; + } + } + $Out.= "</td>\n"; + $Out.= "\t\t\t</tr>\n"; + + } // FOREACH + + $Out.= "\t\t\t</table>\n\t"; + + return $Out; } // function Ausgabe_Feld_Inhalt /*####################################################### -# gibt die engelschischten für einen Ruam aus # +# gibt die engelschischten für einen Ruam aus # #######################################################*/ function ausgabe_Zeile( $RID, $Time, &$AnzahlEintraege ) { - global $con; - - $SQL = "SELECT `SID`, `Len`, `Man` FROM `Shifts` ". - "WHERE ( (`RID` = '$RID') AND ". - "((`DateE` like '". gmdate("Y-m-d H", $Time+3600). "%') OR ". - " (`DateS` like '". gmdate("Y-m-d H", $Time). "%')) ) ORDER BY `DateS`;"; - - $ErgRoom = mysql_query($SQL, $con); - $Out= "\t<td>"; - if( mysql_num_rows( $ErgRoom)>0 ) - for( $i=1; $i<=mysql_num_rows( $ErgRoom); $i++ ) - { - $AnzahlEintraege++; - $Out.= ausgabe_Feld_Inhalt( mysql_result( $ErgRoom, $i-1, "SID"), - mysql_result( $ErgRoom, $i-1, "Man")); - if( (mysql_num_rows( $ErgRoom) > 1) && !($i==mysql_num_rows( $ErgRoom)) ) - $Out.= "<br>"; -// $Out.= "<hr width=\"95%\" align=\"center\">\n\t\t\t\t"; - - } - else - $Out.= " "; - - $Out.= "</td>\n"; - - return $Out; + global $con; + + $SQL = "SELECT `SID`, `Len`, `Man` FROM `Shifts` ". + "WHERE ( (`RID` = '$RID') AND ". + "((`DateE` like '". gmdate("Y-m-d H", $Time+3600). "%') OR ". + " (`DateS` like '". gmdate("Y-m-d H", $Time). "%')) ) ORDER BY `DateS`;"; + + $ErgRoom = mysql_query($SQL, $con); + $Out= "\t<td>"; + if( mysql_num_rows( $ErgRoom)>0 ) + for( $i=1; $i<=mysql_num_rows( $ErgRoom); $i++ ) + { + $AnzahlEintraege++; + $Out.= ausgabe_Feld_Inhalt( mysql_result( $ErgRoom, $i-1, "SID"), + mysql_result( $ErgRoom, $i-1, "Man")); + if( (mysql_num_rows( $ErgRoom) > 1) && !($i==mysql_num_rows( $ErgRoom)) ) + $Out.= "<br />"; +// $Out.= "<hr width=\"95%\" align=\"center\">\n\t\t\t\t"; + + } + else + $Out.= " "; + + $Out.= "</td>\n"; + + return $Out; } ?> diff --git a/includes/funktion_user.php b/includes/funktion_user.php index 0cdf8144..c015cb5a 100755..100644 --- a/includes/funktion_user.php +++ b/includes/funktion_user.php @@ -1,132 +1,111 @@ <?php + function UID2Nick($UID) { + global $con; + + if($UID > 0) + $SQL = "SELECT Nick FROM `User` WHERE UID='$UID'"; + else + $SQL = "SELECT Name FROM `UserGroups` WHERE UID='$UID'"; + + $Erg = mysql_query($SQL, $con); + + if(mysql_num_rows($Erg)) { + if($UID > 0) + return mysql_result($Erg, 0); + else + return "Group-".mysql_result($Erg, 0); + } else { + if($UID == -1) + return "logout User"; + else + return "UserID $UID not found"; + } + } -function UID2Nick($UID) -{ - global $con; + function TID2Type($TID) { + global $con; + + $SQL = "SELECT Name FROM `EngelType` WHERE TID='$TID'"; + $Erg = mysql_query($SQL, $con); - if( $UID>0) { - $SQL = "SELECT Nick FROM `User` WHERE UID='$UID'"; - } else { - $SQL = "SELECT Name FROM `UserGroups` WHERE UID='$UID'"; + if(mysql_num_rows($Erg)) + return mysql_result($Erg, 0); + else + return ""; } - $Erg = mysql_query($SQL, $con); - - //echo $UID."#"; - if( mysql_num_rows($Erg)) { - if( $UID>0 ) { - return mysql_result($Erg, 0); - } else { - return "Group-".mysql_result($Erg, 0); - } - } else { - if( $UID == -1) - return "logout User"; - else - return "UserID $UID not found"; + + function ReplaceSmilies($neueckig) { + global $url, $ENGEL_ROOT; + + $neueckig = str_replace(";o))", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_redface.gif\">", $neueckig); + $neueckig = str_replace(":-))", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_redface.gif\">", $neueckig); + $neueckig = str_replace(";o)", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_wind.gif\">", $neueckig); + $neueckig = str_replace(":)", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_smile.gif\">", $neueckig); + $neueckig = str_replace(":-)", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_smile.gif\">", $neueckig); + $neueckig = str_replace(":(", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_sad.gif\">", $neueckig); + $neueckig = str_replace(":-(", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_sad.gif\">", $neueckig); + $neueckig = str_replace(":o(", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_sad.gif\">", $neueckig); + $neueckig = str_replace(":o)", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_lol.gif\">", $neueckig); + $neueckig = str_replace(";o(", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_cry.gif\">", $neueckig); + $neueckig = str_replace(";(", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_cry.gif\">", $neueckig); + $neueckig = str_replace(";-(", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_cry.gif\">", $neueckig); + $neueckig = str_replace("8)", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_rolleyes.gif\">", $neueckig); + $neueckig = str_replace("8o)", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_rolleyes.gif\">", $neueckig); + $neueckig = str_replace(":P", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_evil.gif\">", $neueckig); + $neueckig = str_replace(":-P", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_evil.gif\">", $neueckig); + $neueckig = str_replace(":oP", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_evil.gif\">", $neueckig); + $neueckig = str_replace(";P", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_mad.gif\">", $neueckig); + $neueckig = str_replace(";oP", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_mad.gif\">", $neueckig); + $neueckig = str_replace("?)", "<img src=\"" . $url . $ENGEL_ROOT . "pic/smiles/icon_question.gif\">", $neueckig); + + return $neueckig; } -} + function GetPicturShow($UID) { + global $con; -function TID2Type($TID) -{ - global $con; - - $SQL = "SELECT Name FROM `EngelType` WHERE TID='$TID'"; - $Erg = mysql_query($SQL, $con); - - if( mysql_num_rows($Erg)) - return mysql_result($Erg, 0); - else - return ""; -} - - -function ReplaceSmilies($eckig) -{ - global $url, $ENGEL_ROOT; - - $neueckig = $eckig; - $neueckig = str_replace(";o))", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_redface.gif\">",$neueckig); - $neueckig = str_replace(":-))", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_redface.gif\">",$neueckig); - $neueckig = str_replace(";o)", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_wind.gif\">",$neueckig); - $neueckig = str_replace(":)", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_smile.gif\">",$neueckig); - $neueckig = str_replace(":-)", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_smile.gif\">",$neueckig); - $neueckig = str_replace(":(", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_sad.gif\">",$neueckig); - $neueckig = str_replace(":-(", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_sad.gif\">",$neueckig); - $neueckig = str_replace(":o(", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_sad.gif\">",$neueckig); - $neueckig = str_replace(":o)", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_lol.gif\">",$neueckig); - $neueckig = str_replace(";o(", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_cry.gif\">",$neueckig); - $neueckig = str_replace(";(", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_cry.gif\">",$neueckig); - $neueckig = str_replace(";-(", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_cry.gif\">",$neueckig); - $neueckig = str_replace("8)", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_rolleyes.gif\">",$neueckig); - $neueckig = str_replace("8o)", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_rolleyes.gif\">",$neueckig); - $neueckig = str_replace(":P", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_evil.gif\">",$neueckig); - $neueckig = str_replace(":-P", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_evil.gif\">",$neueckig); - $neueckig = str_replace(":oP", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_evil.gif\">",$neueckig); - $neueckig = str_replace(";P", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_mad.gif\">",$neueckig); - $neueckig = str_replace(";oP", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_mad.gif\">",$neueckig); - $neueckig = str_replace("?)", "<img src=\"". $url. $ENGEL_ROOT. "pic/smiles/icon_question.gif\">",$neueckig); - return $neueckig; -} - - -function GetPicturShow($UID) -{ - global $con; - - $SQL= "SELECT `show` FROM `UserPicture` WHERE `UID`='$UID'"; - $res = mysql_query( $SQL, $con); - if( mysql_num_rows($res) == 1) - return mysql_result( $res, 0, 0); - else - return ""; -} - - -/* Parameter: - <UserID> - [<Höhe des Bildes (wenn die höhe kleiner 1 ist wird die höhe nicht begrenzt)>] */ -function displayPictur($UID, $height="30") -{ - global $url, $ENGEL_ROOT; - if( $height > 0) - return( "<img src=\"". $url. $ENGEL_ROOT. "ShowUserPicture.php?UID=$UID\" height=\"$height\" alt=\"picture of USER$UID\" class=\"photo\">"); - else - return( "<img src=\"". $url. $ENGEL_ROOT. "ShowUserPicture.php?UID=$UID\" alt=\"picture of USER$UID\">"); -} - - -/* Parameter: - <UserID> - [<Höhe des Bildes (wenn die höhe kleiner 1 ist wird die höhe nicht begrenzt)>] */ -function displayavatar( $UID, $height="30") -{ - global $con, $url, $ENGEL_ROOT; - - if( GetPicturShow($UID) == 'Y') - return " ". displayPictur( $UID, $height); + $SQL = "SELECT `show` FROM `UserPicture` WHERE `UID`='$UID'"; + $res = mysql_query( $SQL, $con); + + if(mysql_num_rows($res) == 1) + return mysql_result($res, 0, 0); + else + return ""; + } + + function displayPictur($UID, $height = "30") { + global $url, $ENGEL_ROOT; + + if($height > 0) + return( "<img src=\"". $url. $ENGEL_ROOT. "ShowUserPicture.php?UID=$UID\" height=\"$height\" alt=\"picture of USER$UID\" class=\"photo\">"); + else + return( "<img src=\"". $url. $ENGEL_ROOT. "ShowUserPicture.php?UID=$UID\" alt=\"picture of USER$UID\">"); + } + + function displayavatar($UID, $height="30") { + global $con, $url, $ENGEL_ROOT; + + if( GetPicturShow($UID) == 'Y') + return " ". displayPictur( $UID, $height); - // show avator - $asql = "select * from User where UID = $UID"; - $aerg = mysql_query ($asql, $con); - if( mysql_num_rows($aerg) ) - if( mysql_result($aerg, 0, "Avatar") > 0) - return (" <img src=\"". $url. $ENGEL_ROOT. "pic/avatar/avatar". mysql_result($aerg, 0, "Avatar"). ".gif\">"); - -} - -function UIDgekommen($UID) -{ - global $con; - - $SQL = "SELECT `Gekommen` FROM `User` WHERE UID='$UID'"; - $Erg = mysql_query($SQL, $con); + // show avator + $asql = "select * from User where UID = $UID"; + $aerg = mysql_query ($asql, $con); - //echo $UID."#"; - if( mysql_num_rows($Erg)) - return mysql_result($Erg, 0); - else - return "0"; -} + if(mysql_num_rows($aerg)) + if(mysql_result($aerg, 0, "Avatar") > 0) + return (" <img src=\"". $url. $ENGEL_ROOT. "pic/avatar/avatar". mysql_result($aerg, 0, "Avatar"). ".gif\">"); + } + + function UIDgekommen($UID) { + global $con; + + $SQL = "SELECT `Gekommen` FROM `User` WHERE UID='$UID'"; + $Erg = mysql_query($SQL, $con); + if(mysql_num_rows($Erg)) + return mysql_result($Erg, 0); + else + return "0"; + } ?> diff --git a/includes/funktion_xml.php b/includes/funktion_xml.php index 8e911a4f..60eb26fa 100755..100644 --- a/includes/funktion_xml.php +++ b/includes/funktion_xml.php @@ -1,13 +1,10 @@ -<?PHP - - -class element -{ - var $name = ''; - var $attributes = array(); - var $data = ''; - var $depth = 0; - var $sub = array(); +<?php +class element { + var $name = ''; + var $attributes = array(); + var $data = ''; + var $depth = 0; + var $sub = array(); } $XMLDEBUG = 0; @@ -16,147 +13,142 @@ $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 convertValues( $Data) { + global $XMLDEBUG; + if($XMLDEBUG) { + $Data = htmlspecialchars($Data); + $Data = mysql_escape_string($Data); + $Data = htmlentities($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 .= convertValues($Data); - $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); + $Data = utf8_decode($Data); + return $Data; } -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 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; + 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]++; + $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); + if( $depth==0) + $XMLmain= $Data; + else + startXMLmain( $Data, $XMLmain, 1); - $depth++; + $depth++; } function end_element_handler($parser, $name) { - global $depth, $XMLpos; - $XMLpos[$depth]=0; - $depth--; + global $depth, $XMLpos; + $XMLpos[$depth]=0; + $depth--; } function character_data_handler($parser, $data) { - global $XMLmain; - if( strlen(trim($data)) ) - dataXMLmain( $data, $XMLmain, 1); + 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; + 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; - } - } - - echo "<h1>Fehler: getXMLsubPease( $Sourse, $Name ) not found</h1>"; -// die; + foreach($Sourse->sub as $key => $value) { + if ($value->name == $Name) { + return $value; + } + } + + echo "<h1>Fehler: getXMLsubPease( $Sourse, $Name ) not found</h1>"; +// die; } /*#######################################################################################*/ function getXMLsubData( $Sourse, $Name ) { - $XML = getXMLsubPease( $Sourse, $Name); - return $XML->data; + $XML = getXMLsubPease( $Sourse, $Name); + return $XML->data; } ?> diff --git a/includes/funktion_xml_room.php b/includes/funktion_xml_room.php index a8f626d1..cb91af6f 100755..100644 --- a/includes/funktion_xml_room.php +++ b/includes/funktion_xml_room.php @@ -1,69 +1,61 @@ -<?PHP
-
-
-/*##############################################################################################
- R o o m
- ##############################################################################################*/
-echo "\n\n<br>\n<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>";
-} /*function saveRoomData*/
-
-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 "\t<tr>\n";
- echo "\t<td><input name=\"NameXML\" type=\"text\" value=\"$NameXML\" readonly></td>\n";
- echo "\t<td><input type=\"submit\" name=\"RoomUpdate\" value=\"update\"></td>\n";
- $DS_KO++;
- echo "\t</tr>\n";
- echo "</form>\n";
- echo "<br>";
- }
- }
- }
-}
-echo "<tr><td colspan=\"6\">status: $DS_KO nicht vorhanden.</td></tr>\n";
-echo "</table>\n";
-
-?>
+<?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 "\t<tr>\n"; + echo "\t<td><input name=\"NameXML\" type=\"text\" value=\"$NameXML\" readonly></td>\n"; + echo "\t<td><input type=\"submit\" name=\"RoomUpdate\" value=\"update\"></td>\n"; + $DS_KO++; + echo "\t</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/funktion_xml_schudle.php b/includes/funktion_xml_schudle.php index 4ef0a42f..41efce04 100755..100644 --- a/includes/funktion_xml_schudle.php +++ b/includes/funktion_xml_schudle.php @@ -1,178 +1,178 @@ -<?PHP +<?php /*############################################################################################## - s c h e d u l e + s c h e d u l e ##############################################################################################*/ echo "\n\n<h1>Schedule:</h1>\n"; function SaveSchedule() { - global $RoomID, $RoomName; - global $con; + 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"; + 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); + //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); + // 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\t"; - } + // 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\t"; + } - 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"; - } - } - } + 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>"; + } + 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(); + SaveSchedule(); //INIT Status counter $DS_OK = 0; @@ -182,127 +182,127 @@ $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"; + "<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"; + "<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 "\t<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 = ""; + if( $Event->name == "VEVENT") + { + echo "<form action=\"dbUpdateFromXLS.php\">\n"; + echo "\t<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 "\t<td><input name=\"PSIDXML\" type=\"text\" value=\"$PSIDXML\" size=\"2\" eadonly></td>\n"; - echo "\t<td><input name=\"DateXML\" type=\"text\" value=\"$DateXML\" size=\"17\" readonly>\n\t\t". - "<input name=\"DateDB\" type=\"text\" value=\"$TimeDB\" size=\"17\" readonly></td>\n"; - echo "\t<td><input name=\"RIDXML\" type=\"text\" value=\"$RIDXML\" size=\"15\" readonly>\n\t\t". - "<input name=\"RIDDB\" type=\"text\" value=\"$RIDDB\" size=\"15\" readonly></td>\n"; - echo "\t<td><input name=\"LenXML\" type=\"text\" value=\"$LenXML\" size=\"1\"readonly>\n\t\t". - "<input name=\"LenDB\" type=\"text\" value=\"$LenDB\" size=\"1\"readonly></td>\n"; - echo "\t<td><input name=\"ManXML\" type=\"text\" value=\"$ManXML\" size=\"40\"readonly>\n\t\t". - "<input name=\"ManDB\" type=\"text\" value=\"$ManDB\" size=\"40\"readonly></td>\n"; - echo "\t<td><input name=\"URLXML\" type=\"hidden\" value=\"$URLXML\"></td>\n"; - echo "\t<td><input name=\"URLDB\" type=\"hidden\" value=\"$URLDB\"></td>\n"; - if( !( $PSIDXML==$PSIDDB && - $DateXML==$TimeDB && - $RIDXML==$RIDDB && - $LenXML==$LenDB && - $ManXML==$ManDB && - $URLXML==$URLDB) ) - { - echo "\t<td><input type=\"submit\" name=\"ScheduleUpdate\" value=\"update\"></td>\n"; - $DS_KO++; - } - else - { - echo "\t<td>". funktion_isLinkAllowed_addLink_OrLinkText("admin/schichtplan.php?action=change&SID=".$SIDDB, "edit"). "</td>\n"; - $DS_OK++; - } - echo "\t</tr>\n"; - echo "</form>\n"; - $Where.= " OR `PSID`='$PSIDXML'"; - } + echo "\t<td><input name=\"PSIDXML\" type=\"text\" value=\"$PSIDXML\" size=\"2\" eadonly></td>\n"; + echo "\t<td><input name=\"DateXML\" type=\"text\" value=\"$DateXML\" size=\"17\" readonly>\n\t\t". + "<input name=\"DateDB\" type=\"text\" value=\"$TimeDB\" size=\"17\" readonly></td>\n"; + echo "\t<td><input name=\"RIDXML\" type=\"text\" value=\"$RIDXML\" size=\"15\" readonly>\n\t\t". + "<input name=\"RIDDB\" type=\"text\" value=\"$RIDDB\" size=\"15\" readonly></td>\n"; + echo "\t<td><input name=\"LenXML\" type=\"text\" value=\"$LenXML\" size=\"1\"readonly>\n\t\t". + "<input name=\"LenDB\" type=\"text\" value=\"$LenDB\" size=\"1\"readonly></td>\n"; + echo "\t<td><input name=\"ManXML\" type=\"text\" value=\"$ManXML\" size=\"40\"readonly>\n\t\t". + "<input name=\"ManDB\" type=\"text\" value=\"$ManDB\" size=\"40\"readonly></td>\n"; + echo "\t<td><input name=\"URLXML\" type=\"hidden\" value=\"$URLXML\"></td>\n"; + echo "\t<td><input name=\"URLDB\" type=\"hidden\" value=\"$URLDB\"></td>\n"; + if( !( $PSIDXML==$PSIDDB && + $DateXML==$TimeDB && + $RIDXML==$RIDDB && + $LenXML==$LenDB && + $ManXML==$ManDB && + $URLXML==$URLDB) ) + { + echo "\t<td><input type=\"submit\" name=\"ScheduleUpdate\" value=\"update\"></td>\n"; + $DS_KO++; + } + else + { + echo "\t<td>". funktion_isLinkAllowed_addLink_OrLinkText("admin/schichtplan.php?action=change&SID=".$SIDDB, "edit"). "</td>\n"; + $DS_OK++; + } + echo "\t</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`='';"; + $SQL2 = "SELECT * FROM `Shifts` WHERE NOT `PSID`='';"; else - $SQL2 = "SELECT * FROM `Shifts` WHERE NOT (".substr( $Where, 4). ") AND NOT PSID = '';"; - + $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 "\t<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 "\t<td><input name=\"SIDXML\" type=\"text\" value=\"$SID\" size=\"2\" eadonly></td>\n"; - echo "\t<td><input name=\"DateXML\" type=\"text\" value=\"\" size=\"17\" readonly>\n\t\t". - "<input name=\"DateDB\" type=\"text\" value=\"$Time\" size=\"17\" readonly></td>\n"; - echo "\t<td><input name=\"RIDXML\" type=\"text\" value=\"\" size=\"15\" readonly>\n\t\t". - "<input name=\"RIDDB\" type=\"text\" value=\"$RID\" size=\"15\" readonly></td>\n"; - echo "\t<td><input name=\"LenXML\" type=\"text\" value=\"\" size=\"1\"readonly>\n\t\t". - "<input name=\"LenDB\" type=\"text\" value=\"$Len\" size=\"1\"readonly></td>\n"; - echo "\t<td><input name=\"ManXML\" type=\"text\" value=\"\" size=\"40\"readonly>\n\t\t". - "<input name=\"ManDB\" type=\"text\" value=\"$Man\" size=\"40\"readonly></td>\n"; - echo "\t<td>". funktion_isLinkAllowed_addLink_OrLinkText( "admin/schichtplan.php?action=change&SID=".$SID, "edit"). - "</td>\n"; - echo "\t<tr>\n"; - } + for( $i=0; $i<mysql_num_rows( $Erg2); $i++) + { + echo "\t<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 "\t<td><input name=\"SIDXML\" type=\"text\" value=\"$SID\" size=\"2\" eadonly></td>\n"; + echo "\t<td><input name=\"DateXML\" type=\"text\" value=\"\" size=\"17\" readonly>\n\t\t". + "<input name=\"DateDB\" type=\"text\" value=\"$Time\" size=\"17\" readonly></td>\n"; + echo "\t<td><input name=\"RIDXML\" type=\"text\" value=\"\" size=\"15\" readonly>\n\t\t". + "<input name=\"RIDDB\" type=\"text\" value=\"$RID\" size=\"15\" readonly></td>\n"; + echo "\t<td><input name=\"LenXML\" type=\"text\" value=\"\" size=\"1\"readonly>\n\t\t". + "<input name=\"LenDB\" type=\"text\" value=\"$Len\" size=\"1\"readonly></td>\n"; + echo "\t<td><input name=\"ManXML\" type=\"text\" value=\"\" size=\"40\"readonly>\n\t\t". + "<input name=\"ManDB\" type=\"text\" value=\"$Man\" size=\"40\"readonly></td>\n"; + echo "\t<td>". funktion_isLinkAllowed_addLink_OrLinkText( "admin/schichtplan.php?action=change&SID=".$SID, "edit"). + "</td>\n"; + echo "\t<tr>\n"; + } echo "</table>"; diff --git a/includes/funktionen.php b/includes/funktionen.php index d841e6ec..fb63b708 100755..100644 --- a/includes/funktionen.php +++ b/includes/funktionen.php @@ -1,26 +1,23 @@ <?php + /* Schichtverplanung im Adminbereich */ + function Dsubstr($DateString, $re) { + if ($re == 1) + return substr($DateString, 0, 2); + elseif ($re == 2) + return substr($DateString, 3, 2); + else + return substr($DateString, 6, 4); + } -/* Schichtverplanung im Adminbereich */ -function Dsubstr($DateString,$re) { - if ($re==1) - return substr($DateString, 0, 2); - elseif ($re==2) - return substr($DateString, 3, 2); - else - return substr($DateString, 6, 4); -} - -/* Schichtverplanung im Engelbereich */ - -function engeldate($edate,$m) { - if ($m==t) - return substr($edate, 8, 2); - elseif ($m==m) - return substr($edate, 5, 2); - elseif ($m==u) - return substr($edate, 11, 5); - else - return substr($edate, 0, 4); -} - + /* Schichtverplanung im Engelbereich */ + function engeldate($edate, $m) { + if ($m == t) + return substr($edate, 8, 2); + elseif ($m == m) + return substr($edate, 5, 2); + elseif ($m == u) + return substr($edate, 11, 5); + else + return substr($edate, 0, 4); + } ?> diff --git a/includes/header.php b/includes/header.php index e5d97a0c..3b6a4c23 100755..100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,61 +1,57 @@ -<?PHP -include ("header_start.php"); +<?php +include "header_start.php"; echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; ?> -<HTML> -<HEAD> -<?PHP - -echo "<TITLE>--- $title ---</TITLE>\n"; -?> -<meta name="keywords" content="Engel, Himmelsverwaltung"> -<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> -<meta http-equiv="Content-Style-Type" content="text/css"> -<meta http-equiv="expires" content="0"> -<meta name="robots" content="index"> -<meta name="revisit-after" content="1 days"> -<meta http-equiv="content-language" content="de"> -<script type="text/javascript" src="<?PHP echo $url. $ENGEL_ROOT; ?>/css/grossbild.js"></script> -<link rel=stylesheet type="text/css" href="<?PHP echo $url. $ENGEL_ROOT; ?>css/style<?PHP - if (!IsSet($_SESSION['color'])) - echo "6"; - else - echo $_SESSION['color']; - ?>.css"> -<?PHP -if (isset($reload)) -{ - if ($reload=="") - { - $reload=3330; - } - echo "\n<meta http-equiv=\"refresh\" content=\"".$reload. - "; URL=./?reload=".$reload."\">\n"; +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + +<title><?php echo $title; ?></title> + +<meta name="keywords" content="Engel, Himmelsverwaltung" /> +<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> +<meta http-equiv="Content-Style-Type" content="text/css" /> +<meta http-equiv="expires" content="0" /> +<meta name="robots" content="index" /> +<meta name="revisit-after" content="1 days" /> +<meta http-equiv="content-language" content="de" /> +<script type="text/javascript" src="<?php echo $url . $ENGEL_ROOT; ?>/css/grossbild.js"></script> +<link rel="stylesheet" type="text/css" href="<?php echo $url . $ENGEL_ROOT; ?>css/style<?php + + if(!isset($_SESSION['color'])) + echo "6"; + else + echo $_SESSION['color']; + ?>.css" /> + +<?php +if(isset($reload)) { + if ($reload == "") + $reload = 3330; + + echo "\n<meta http-equiv=\"refresh\" content=\"" . $reload . "; URL=./?reload=" . $reload . "\">\n"; } -if (isset($Page["AutoReload"])) -{ - echo "\n<meta http-equiv=\"refresh\" content=\"". $Page["AutoReload"]. - "; URL=". $url. $ENGEL_ROOT. $Page["Name"]."\">\n"; -} +if(isset($Page["AutoReload"])) + echo "\n<meta http-equiv=\"refresh\" content=\"". $Page["AutoReload"]. + "; URL=". $url. $ENGEL_ROOT. $Page["Name"]."\">\n"; -echo "</HEAD>\n"; +echo "</head>\n"; ///////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////// B O D Y ///////////////////////////////////////////////////////////////////////////////////////////// -echo "<BODY>\n"; +echo "<body>\n"; -echo "<div name=\"topic\" align=\"center\">\n\n"; +echo "<div align=\"center\">\n\n"; if( isset($_SESSION['color']) && ($_SESSION['color']==6) ) { - echo "\t<a name=\"#top\"><img src=\"". $url. $ENGEL_ROOT. "pic/himmel_w.png\" alt=\"Unser Himmel\"></a>\n"; + echo "<a name=\"top\"><img src=\"". $url. $ENGEL_ROOT. "pic/himmel_w.png\" alt=\"Unser Himmel\" /></a>\n"; } else { - echo "\t<a name=\"#top\"><img src=\"". $url. $ENGEL_ROOT. "pic/himmel.png\" alt=\"Unser Himmel\"></a>\n"; + echo "<a name=\"top\"><img src=\"". $url. $ENGEL_ROOT. "pic/himmel.png\" alt=\"Unser Himmel\" /></a>\n"; } echo "</div>\n\n"; @@ -65,73 +61,65 @@ if( isset($_SESSION['CVS']["nonpublic/messages.php"])) { if( $_SESSION['CVS']["nonpublic/messages.php"] == "Y") { - $SQL = "SELECT `Datum` FROM `Messages` WHERE `RUID`=". $_SESSION["UID"]. " AND `isRead`='N'"; - $erg = mysql_query($SQL, $con); - if( mysql_num_rows( $erg ) > 0 ) - echo "<br><a href=\"". $url. $ENGEL_ROOT. - "nonpublic/messages.php\">". Get_Text("pub_messages_new1"). - " ". mysql_num_rows( $erg ). " ". - Get_Text("pub_messages_new2"). "</a><br><br>"; + $SQL = "SELECT `Datum` FROM `Messages` WHERE `RUID`=". $_SESSION["UID"]. " AND `isRead`='N'"; + $erg = mysql_query($SQL, $con); + if( mysql_num_rows( $erg ) > 0 ) + echo "<br /><a href=\"". $url. $ENGEL_ROOT. + "nonpublic/messages.php\">". Get_Text("pub_messages_new1"). + " ". mysql_num_rows( $erg ). " ". + Get_Text("pub_messages_new2"). "</a><br /><br />"; } } ?> <table width="95%" align="center" border="0" cellpadding="7" cellspacing="0"> - <tr> -<?PHP + <tr> +<?php //ausgaeb Menu -if( !isset($_SESSION['Menu'])) $_SESSION['Menu'] = "L"; -if( $_SESSION['Menu'] =="L") include("menu.php"); +if( !isset($_SESSION['Menu'])) $_SESSION['Menu'] = "L"; +if( $_SESSION['Menu'] =="L") include("menu.php"); ?> - <td valign="top" align="center"> + <td valign="top" align="center"> <table border="0" width="100%" align="center" class="border" cellpadding="5" cellspacing="1"> - <tr class="contenttopic"> - <td> -<?PHP - echo "\t<a name=\"#$header\" class=\"contenttopic\">"; - if( strlen( $header) == 0 ) - echo "\n\t<b>". Get_Text($Page["Name"]). "</b></a>\n"; - else - echo "\n\t<b>$header</b></a>\n"; + <tr class="contenttopic"> + <td> +<?php + echo "<a name=\"" . $header . "\" class=\"contenttopic\">"; + if( strlen( $header) == 0 ) + echo "\n<b>". Get_Text($Page["Name"]). "</b></a>\n"; + else + echo "\n<b>$header</b></a>\n"; ?> - </td> - </tr> - <tr class="content"> - <td> -<br> + </td> + </tr> + <tr class="content"> + <td> +<br /> <?php -echo "\n\n\n"; - -if (IsSet($_SESSION['UID'])) { - if( isset($_SESSION['oldurl'])) - $BACKUP_SESSION_OLDURL = $_SESSION['oldurl']; - if( isset($_SESSION['newurl'])) - $_SESSION['oldurl'] = $_SESSION['newurl']; - $_SESSION['newurl'] = $_SERVER["REQUEST_URI"]; -} - - -function SetHeaderGo2Back () -{ - global $BACKUP_SESSION_OLDURL; - $_SESSION['oldurl'] = $BACKUP_SESSION_OLDURL; +if(isset($_SESSION['UID'])) { + if(isset($_SESSION['oldurl'])) + $BACKUP_SESSION_OLDURL = $_SESSION['oldurl']; + if(isset($_SESSION['newurl'])) + $_SESSION['oldurl'] = $_SESSION['newurl']; + $_SESSION['newurl'] = $_SERVER["REQUEST_URI"]; } - -if ( $Page["CVS"] != "Y" ) -{ - echo "Du besitzt kein Rechte für diesen Bereich.<br>\n"; - If (IsSet($_SESSION['oldurl'])) - echo "<a href=\"". $_SESSION["oldurl"]. "\">".Get_Text("back")."</a> geht's zurück...\n"; - else - echo "<a href=\"". $url. $ENGEL_ROOT. "\">".Get_Text("back")."</a> geht's zurück...\n"; - exit (); +function SetHeaderGo2Back() { + global $BACKUP_SESSION_OLDURL; + $_SESSION['oldurl'] = $BACKUP_SESSION_OLDURL; } -?> +if($Page["CVS"] != "Y") { + echo "Du besitzt kein Rechte für diesen Bereich.<br />\n"; -<!-- ende des header parts //--> - + if(isset($_SESSION['oldurl'])) + echo "<a href=\"" . $_SESSION["oldurl"] . "\">" . Get_Text("back") . "</a> geht's zurück...\n"; + else + echo "<a href=\"" . $url . $ENGEL_ROOT . "\">" . Get_Text("back") . "</a> geht's zurück...\n"; + exit (); +} +?> +<!-- ende des header parts //--> diff --git a/includes/header_start.php b/includes/header_start.php index 997fa94e..97b98fc3 100755..100644 --- a/includes/header_start.php +++ b/includes/header_start.php @@ -1,50 +1,40 @@ -<?PHP -ini_set( "session.gc_maxlifetime", "65535"); - -include ("config.php"); -include ("error_handler.php"); -include ("config_db.php"); -include ("funktion_lang.php"); -include ("funktion_faq.php"); //für noAnswer() im menu -include ("funktion_menu.php"); -include ("funktion_user.php"); - - -if( isset($SystemDisableMessage) && ( strlen($SystemDisableMessage)>0) ) -{ - echo "<HTML>\n". - "<BODY>\n". $SystemDisableMessage. "\n<BODY>\n". - "</HTML>"; - die(); -} - -if( !isset($_SESSION)) -{ - session_start(); -} -include ("secure.php"); - -if( !isset($_SESSION['IP'])) -{ - $_SESSION['IP'] = $_SERVER['REMOTE_ADDR']; -} - -if (IsSet($_SESSION['UID']) and ($_SESSION['IP'] <> $_SERVER['REMOTE_ADDR'])) -{ - session_destroy (); - header("Location: $url". $ENGEL_ROOT ); -} - -include ("UserCVS.php"); - - -//UPdate LASTlogin -if( isset($_SESSION['UID'])) -{ - $SQLlastLogIn = "UPDATE `User` SET ". - "`lastLogIn` = '". gmdate("Y-m-j H:i:s", time()). "'". - " WHERE `UID` = '". $_SESSION['UID']. "' LIMIT 1;"; - mysql_query ($SQLlastLogIn, $con); -} - +<?php + ini_set("session.gc_maxlifetime", "65535"); + + include "config.php"; + include "error_handler.php"; + include "config_db.php"; + include "funktion_lang.php"; + include "funktion_faq.php"; // fuer noAnswer() im menu + include "funktion_menu.php"; + include "funktion_user.php"; + + if(isset($SystemDisableMessage) && (strlen($SystemDisableMessage) > 0)) { + echo "<html><head><title>" . $SystemDisableMessage . "</title></head>"; + echo "<body>" . $SystemDisableMessage . "</body></html>\n"; + die(); + } + + if(!isset($_SESSION)) + session_start(); + + include "secure.php"; + + if(!isset($_SESSION['IP'])) + $_SESSION['IP'] = $_SERVER['REMOTE_ADDR']; + + if(isset($_SESSION['UID']) && ($_SESSION['IP'] <> $_SERVER['REMOTE_ADDR'])) { + session_destroy (); + header("Location: " . $url . $ENGEL_ROOT); + } + + include "UserCVS.php"; + + // update LASTlogin + if(isset($_SESSION['UID'])) { + $SQLlastLogIn = "UPDATE `User` SET " . + "`lastLogIn` = '" . gmdate("Y-m-j H:i:s", time()) . "'" . + " WHERE `UID` = '" . $_SESSION['UID'] . "' LIMIT 1;"; + mysql_query ($SQLlastLogIn, $con); + } ?> diff --git a/includes/login_eingabefeld.php b/includes/login_eingabefeld.php index bed1a2fd..e68639cf 100755..100644 --- a/includes/login_eingabefeld.php +++ b/includes/login_eingabefeld.php @@ -1,18 +1,17 @@ -<?PHP -include ("config.php"); - -echo "<form action=\"". $url. $ENGEL_ROOT. "nonpublic/index.php\" method=\"post\">"; -echo "<table>\n". - "\t<tr>". - "\t\t<td align=\"right\">". Get_Text("index_lang_nick"). "</td>". - "\t\t<td><input type=\"text\" name=\"user\" size=\"23\"></td>". - "\t</tr>". - "\t<tr>". - "\t\t<td align=\"right\">". Get_Text("index_lang_pass"). "</td>". - "\t\t<td><input type=\"password\" name=\"password\" size=\"23\"></td>". - "\t</tr>". - "</table>". - "<br><input type=\"submit\" value=\"". Get_Text("index_lang_send"). "\">"; -echo "</form>"; - +<?php + include "config.php"; +?> +<form action="<?php echo $url . $ENGEL_ROOT; ?>nonpublic/index.php" method="post"> +<table> + <tr> + <td align="right"><?php echo Get_Text("index_lang_nick"); ?></td> + <td><input type="text" name="user" size="23" /></td> + </tr> + <tr> + <td align="right"><?php echo Get_Text("index_lang_pass"); ?></td> + <td><input type="password" name="password" size="23"></td> + </tr> + </table> + <br /><input type="submit" value="<?php echo Get_Text("index_lang_send"); ?>"> +</form> diff --git a/includes/menu.php b/includes/menu.php index 6133b856..799e6c75 100755..100644 --- a/includes/menu.php +++ b/includes/menu.php @@ -1,30 +1,30 @@ <!-- anfang des menue parts //--> - <td width="160" valign="top"> -<?PHP + <td width="160" valign="top"> +<?php $MenueTableStart=" <table align=\"center\" class=\"border\" cellpadding=\"3\" cellspacing=\"1\"> - <tr> - <td width=\"160\" class=\"menu\"> + <tr> + <td width=\"160\" class=\"menu\"> "; -$MenueTableEnd=" - <br> - </td> - </tr> -</table><br> +$MenueTableEnd="</ul> + <br /> + </td> + </tr> +</table><br /> "; ShowMenu(""); ShowMenu("nonpublic"); ShowMenu("admin"); -if( !isset($submenus)) - $submenus = 0; +if(!isset($submenus)) + $submenus = 0; -if ($submenus >= 1 ) { - $inc_name=$_SERVER['PHP_SELF']; - $filenamepos=strrpos($inc_name, '/'); - $filenamepos+=1; +if ($submenus >= 1) { + $inc_name = $_SERVER['PHP_SELF']; + $filenamepos = strrpos($inc_name, '/'); + $filenamepos += 1; $filename = substr ($inc_name, $filenamepos ); $filepost = substr ($filename, 0, -4); $filepre = substr ($filename, -4 ); @@ -33,15 +33,15 @@ if ($submenus >= 1 ) { for ($index_nummer=1; $index_nummer <= $submenus; $index_nummer++) { ?> <table align="center" class="border" cellpadding="3" cellspacing="1"> - <tr> - <td width="160" class="menu"> - <?php include ("./".$filepost.".".$index_nummer.$filepre); ?> - </td> - </tr> + <tr> + <td width="160" class="menu"> + <?php include ("./".$filepost.".".$index_nummer.$filepre); ?> + </td> + </tr> </table> -<br> -<?PHP +<br /> +<?php } } @@ -49,15 +49,15 @@ if( isset($_SESSION['UID'])) { ?> <table align="center" class="border" cellpadding="3" cellspacing="1"> - <tr> - <td width="160" class="menu"> - <?php include("funktion_activeUser.php"); ?> - </td> - </tr> + <tr> + <td width="160" class="menu"> + <?php include("funktion_activeUser.php"); ?> + </td> + </tr> </table> -<?PHP +<?php } ?> - </td> + </td> <!-- ende des menue parts //--> diff --git a/includes/secure.php b/includes/secure.php index d6b5c512..1d1a9e46 100755..100644 --- a/includes/secure.php +++ b/includes/secure.php @@ -1,41 +1,25 @@ <?php -//soll dein funktion entahlten die alle übergebenen parameter überprüft -//'`'" + if($debug) + echo "secure.php START<br />\n"; -if( $DEBUG) - echo "secure.php START<br>\n"; + foreach ($_GET as $k => $v) { + $v = htmlentities($v, ENT_QUOTES); + preg_replace('/([\'"`\'])/', '', $v); + $_GET[$k] = $v; -foreach ($_GET as $k => $v) -{ -// $v = htmlspecialchars($v, ENT_QUOTES); -// $v = mysql_escape_string($v); - $v = htmlentities($v, ENT_QUOTES); - if (preg_match('/([\'"`\'])/', $v, $match)) - { - print "sorry get has illegal char '$match[1]'"; - exit; - } - $_GET[$k] = $v; - - if( $DEBUG) - echo "GET $k=\"$v\"<br>"; -} + if($debug) + echo "GET $k=\"$v\"<br />"; + } + + foreach ($_POST as $k => $v) { + $v = htmlentities($v, ENT_QUOTES); + preg_replace('/([\'"`\'])/', '', $v); + $_POST[$k] = $v; -foreach ($_POST as $k => $v) -{ -// $v = htmlspecialchars($v, ENT_QUOTES); -// $v = mysql_escape_string($v); - $v = htmlentities($v, ENT_QUOTES); - if (preg_match('/([\'"`\'])/', $v, $match)) { - print "sorry post has illegal char '$match[1]'"; - exit; - } - $_POST[$k] = $v; - - if( $DEBUG) - echo "POST $k=\"$v\"<br>"; -} -if( $DEBUG) - echo "secure.php END<br>\n"; + if($debug) + echo "POST $k=\"$v\"<br />"; + } + if($debug) + echo "secure.php END<br />\n"; ?> |