From d5845ab74c0996d22629282f53dc5a6d9ec34c81 Mon Sep 17 00:00:00 2001 From: cookie Date: Thu, 9 Aug 2007 16:33:38 +0000 Subject: aktuelle änderungen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.cccv.de/engel-system@230 29ba0400-6e00-0410-a75a-ca02368028f8 --- www-ssl/inc/funktion_cron.php | 114 ++++++++++++++++++++--------------- www-ssl/inc/funktion_schichtplan.php | 8 +-- 2 files changed, 69 insertions(+), 53 deletions(-) (limited to 'www-ssl/inc') diff --git a/www-ssl/inc/funktion_cron.php b/www-ssl/inc/funktion_cron.php index 4ff383dc..7f47e346 100755 --- a/www-ssl/inc/funktion_cron.php +++ b/www-ssl/inc/funktion_cron.php @@ -5,14 +5,20 @@ function UID2DECT($UID) global $con; $SQL = "SELECT DECT FROM `User` WHERE UID='$UID'"; $Erg = mysql_query($SQL, $con); - return mysql_result($Erg, 0); + 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); - return mysql_result($Erg, 0); + if( mysql_num_rows( $Erg) == 1) + return mysql_result($Erg, 0); + else + return ""; } function TID2Engeltype($TID) @@ -20,7 +26,10 @@ function TID2Engeltype($TID) global $con; $SQL = "SELECT Name FROM `EngelType` WHERE TID='$TID'"; $Erg = mysql_query($SQL, $con); - return mysql_result($Erg, 0); + if( mysql_num_rows( $Erg) == 1) + return mysql_result($Erg, 0); + else + return ""; } @@ -44,56 +53,63 @@ function DialNumberIAX( $DECTnumber, $Time, $RID, $TID) $TimeH = "0".$TimeH; if( $IAXenable) - { - $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) + { $Message="die-nee shisht beh-kinned , in where-neegin me-nooten . . . your shift beginns in a few minutes"; + if (isset($SetHttpIAX)) { - $o.= "$k=".urlencode(utf8_encode($v))."&"; - } - $post_data=substr($o,0,-1); + $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"; - $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); + $o=""; + foreach ($post_data as $k=>$v) + { + $o.= "$k=".urlencode(utf8_encode($v))."&"; + } + $post_data=substr($o,0,-1); - - /* - // IAX file Schareiebn - $CallFile = "/tmp/call_". date("Ymd_His"). "_$DECTnumber"; - - if($DebugDECT) echo "IAX create file for dialing Number $DECTnumber\n"; - $file = fopen( $CallFile, 'w' ); - if( $file != FALSE) + $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 { - fputs( $file, "Channel: IAX2/$IAXserver/Engelserver@$IAXcontent\n"); - fputs( $file, "Callerid: $IAXcontent\n"); - fputs( $file, "Context: $IAXcontent\n"); - fputs( $file, "Extension: s\n"); - fputs( $file, "MaxRetries: 3\n"); - fputs( $file, "RetryTime: 10\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 /var/spool/asterisk/outgoing"); - }*/ + // IAX file Schareiebn + $CallFile = "/tmp/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 /var/spool/asterisk/outgoing"); + } + else + echo "error: $CallFile not created"; + } } else if($DebugDECT) echo "IAX is disable\n"; diff --git a/www-ssl/inc/funktion_schichtplan.php b/www-ssl/inc/funktion_schichtplan.php index c9780fba..39785c42 100755 --- a/www-ssl/inc/funktion_schichtplan.php +++ b/www-ssl/inc/funktion_schichtplan.php @@ -8,7 +8,7 @@ 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; + global $EngelType, $EngelTypeID, $TID2Name, $con, $DEBUG, $gmdateOffset; $Spalten = ""; @@ -130,7 +130,7 @@ function ausgabe_Feld_Inhalt( $SID, $Man ) //////////////////////////// //in vergangenheit $SQLtime = "SELECT `DateE` FROM `Shifts` WHERE (`SID`='$SID' AND `DateE` >= '". - gmdate("Y-m-d H:i:s", time()+ 3600). "')"; + gmdate("Y-m-d H:i:s", time()+ $gmdateOffset). "')"; $Ergtime = mysql_query($SQLtime, $con); if( mysql_num_rows( $Ergtime) > 0) { @@ -312,7 +312,7 @@ function CreateRoomShifts( $raum ) #######################################################*/ function showEmptyShifts( ) { - global $con, $DEBUG, $RoomID; + global $con, $DEBUG, $RoomID, $gmdateOffset; echo "\n"; echo "\n"; @@ -323,7 +323,7 @@ function showEmptyShifts( ) echo "\n"; $sql = "SELECT `SID`, `DateS`, `Man`, `RID` FROM `Shifts` ". - "WHERE (`Shifts`.`DateS`>='". gmdate("Y-m-d H:i:s", time()+3600). "') ". + "WHERE (`Shifts`.`DateS`>='". gmdate("Y-m-d H:i:s", time()+$gmdateOffset). "') ". "ORDER BY `DateS`, `RID`;"; $Erg = mysql_query($sql, $con); -- cgit v1.2.3-54-g00ecf