This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ------------------------------------------------------------------------------- */ function formatDateString($stamp) { $monate = array ( 1 => "Januar", 2 => "Februar", 3 => "März", 4 => "April", 5 => "Mai", 6 => "Juni", 7 => "Juli", 8 => "August", 9 => "September", 10 => "Oktober", 11 => "November", 12 => "Dezember" ); //Getting our Month $monat = date("n", $stamp); //Getting the Days set up.... $tage = array ( "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" ); //Getting Day.... $tag = date("w", $stamp); $printme = $tage[$tag] . ", den " . date("d", $stamp) . ". " . $monate[$monat] . " " . date("Y H:i:s", $stamp) . "Uhr\n"; return $printme; } class xml2array { var $stack = array (); var $stack_ref; var $arrOutput = array (); var $resParser; var $strXmlData; function push_pos(& $pos) { $this->stack[count($this->stack)] = & $pos; $this->stack_ref = & $pos; } function pop_pos() { unset ($this->stack[count($this->stack) - 1]); $this->stack_ref = & $this->stack[count($this->stack) - 1]; } function parse($strInputXML) { $this->resParser = xml_parser_create(); xml_set_object($this->resParser, $this); xml_set_element_handler($this->resParser, "tagOpen", "tagClosed"); xml_set_character_data_handler($this->resParser, "tagData"); $this->push_pos($this->arrOutput); $this->strXmlData = xml_parse($this->resParser, $strInputXML); if (!$this->strXmlData) { die(msg(sprintf("XML error: %s at line %d;error\n", xml_error_string(xml_get_error_code($this->resParser)), xml_get_current_line_number($this->resParser)))); } xml_parser_free($this->resParser); return $this->arrOutput; } function tagOpen($parser, $name, $attrs) { if (isset ($this->stack_ref[$name])) { if (!isset ($this->stack_ref[$name][0])) { $tmp = $this->stack_ref[$name]; unset ($this->stack_ref[$name]); $this->stack_ref[$name][0] = $tmp; } $cnt = count($this->stack_ref[$name]); $this->stack_ref[$name][$cnt] = array (); if (isset ($attrs)) $this->stack_ref[$name][$cnt] = $attrs; $this->push_pos($this->stack_ref[$name][$cnt]); } else { $this->stack_ref[$name] = array (); if (isset ($attrs)) $this->stack_ref[$name] = $attrs; $this->push_pos($this->stack_ref[$name]); } } function tagData($parser, $tagData) { if (trim($tagData)) { if (isset ($this->stack_ref['DATA'])) $this->stack_ref['DATA'] .= $tagData; else $this->stack_ref['DATA'] = $tagData; } } function tagClosed($parser, $name) { $this->pop_pos(); } } function getStatus($line) { if ($line["lastapp"] == "VoiceMail") { $status = "Voicebox"; } elseif (empty($line["answer"])) { $status = "Nicht abgehoben"; } elseif ($line["disposition"] == "ANSWERED") { $status = "Angenommen"; } elseif ($line["disposition"] == "BUSY") { $status = "Besetzt"; } elseif ($line["disposition"] == "FAILED") { $status = "Unbekannt"; } return $status; } function parseLog($file) { $fp = fopen($file, "r"); $i = 0; while (($line = fgetcsv($fp, 1000, ",")) !== FALSE) { if (count($line) < 16 || count($line) > 18) echo "Syntaxerror in Datensatz $i!
\n"; list ($log[$i]["accoundcode"], $log[$i]["src"], $log[$i]["dst"], $log[$i]["dcontext"], $log[$i]["clid"], $log[$i]["channel"], $log[$i]["dstchannel"], $log[$i]["lastapp"], $log[$i]["lastdata"], $log[$i]["start"], $log[$i]["answer"], $log[$i]["end"], $log[$i]["duration"], $log[$i]["billsec"], $log[$i]["disposition"], $log[$i]["amaflags"], $log[$i]["uniqueid"], $log[$i]["userfield"]) = $line; $i++; } fclose($fp); return $log; } ?>