diff --git a/www-ssl/admin/dect_clear.php b/services/dect_clear.php similarity index 78% rename from www-ssl/admin/dect_clear.php rename to services/dect_clear.php index 2b20d6c5..a01241be 100755 --- a/www-ssl/admin/dect_clear.php +++ b/services/dect_clear.php @@ -1,5 +1,5 @@ ) include ("./inc/db.php"); include ("./inc/config.php"); diff --git a/www-ssl/admin/dect_cron.php b/services/dect_cron.php similarity index 100% rename from www-ssl/admin/dect_cron.php rename to services/dect_cron.php diff --git a/www-ssl/admin/dect_cron_asterisk.php b/services/dect_cron_asterisk.php similarity index 100% rename from www-ssl/admin/dect_cron_asterisk.php rename to services/dect_cron_asterisk.php diff --git a/services/inc b/services/inc new file mode 120000 index 00000000..54c38819 --- /dev/null +++ b/services/inc @@ -0,0 +1 @@ +../www-ssl/inc \ No newline at end of file diff --git a/services/jabberserver.php b/services/jabberserver.php new file mode 100755 index 00000000..9bdd209a --- /dev/null +++ b/services/jabberserver.php @@ -0,0 +1,113 @@ +Connect() && $jabber->SendAuth())) + die("Couldn't connect to Jabber Server."); +} + + +/****************************************************************************************************/ +// INIT socked +/****************************************************************************************************/ +echo "INIT socked\n"; + //http://de3.php.net/manual/de/function.socket-listen.php +// Create a UDP socket +$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP) or die('Could not create socked ('.socket_strerror(socket_last_error()). ')'); +// Bind the socket to an address/port +socket_bind($sock, SERVER_ADDRESS, SERVER_PORT) or die('Could not bind to address ('.socket_strerror(socket_last_error()). ')'); +// Setzt Nonbock Mode +socket_set_nonblock($sock); + + +/****************************************************************************************************/ +// Loop continuos +/****************************************************************************************************/ +$RUNNING = TRUE; +while( $RUNNING ) +{ + if( @socket_recvfrom($sock, $data, 65535, 0, $ip, $port)) + { + //daten empfangen + $data = substr($data,0, strlen($data)-1); //ENTER entfernen + echo "\n". gmdate("Y-m-d H:i:s", time()). "\tresive from $ip:$port ". strlen($data). " byte data ($data)\n"; + PackedAnalyser( $data); + } + + usleep(100000); // 100ms delay keeps the doctor away +} // end while + +//disconnect jabber +if( !DEBUG) + $jabber->Disconnect(); + +// Close the master sockets +socket_close($sock); + +/****************************************************************************************************/ +/****************************************** MAIN END ************************************************/ +/****************************************************************************************************/ + + +/****************************************************************************************************/ +//***** function PackedAnalyser +/****************************************************************************************************/ +function PackedAnalyser( $data ) +{ + GLOBAL $jabber, $RUNNING; + // init array + $matches = array(); + + //#message + if( preg_match( "/^#(message) ([^ ]+) (.+)/i", $data, $matches ) ) + { + if( $matches[2]=="" || $matches[3]=="") + { + // Wrong syntax + echo "\t\t\t\t#messaage parameter fail\n"; + } + else + { + // Whisper + if( !DEBUG) + $jabber->SendMessage($value, "normal", NULL, array("body" => $message, "subject" => "Error in Pentabarf"), NULL); + else + echo "\t\t\t\tmessage to:\"". $matches[2]. "\" Text: \"". $matches[3]. "\"\n"; + } + } + elseif( preg_match( "/^#quit/i", $data, $matches ) ) + { + if( DEBUG) + { + echo "\t\t\t\tSystem Shutdown\n\n"; + $RUNNING = FALSE; + } + } + else + { + echo "\t\t\t\tcommand not found\n\n"; + } +} + +?> diff --git a/www-ssl/inc/config_MessegeServer.php b/www-ssl/inc/config_MessegeServer.php new file mode 100644 index 00000000..3454ae0c --- /dev/null +++ b/www-ssl/inc/config_MessegeServer.php @@ -0,0 +1,8 @@ + diff --git a/www-ssl/inc/funktion_SendMessenges.php b/www-ssl/inc/funktion_SendMessenges.php new file mode 100644 index 00000000..c6676c6c --- /dev/null +++ b/www-ssl/inc/funktion_SendMessenges.php @@ -0,0 +1,18 @@ +