Example #1
0
 public function showTitle($context_in)
 {
     $title = $context_in->getBook()->getTitle();
     $this->titleCount++;
     if (1 < $this->titleCount) {
         $context_in->setTitleState(new BookTitleStateExclaim());
     }
     return Str_replace(' ', '*', $title);
 }
Example #2
0
 function setStarsOff()
 {
     $this->setAuthor(Str_replace('*', ' ', $this->getAuthor()));
     $this->setTitle(Str_replace('*', ' ', $this->getTitle()));
 }
Example #3
0
 function mp3_id($file)
 {
     // Lux: we keep all variables internal within this function, that way our global namespace
     // is kept clean, and we can still call this method like a function without instantiating
     // a whole class to do so.
     //global $version, $layer, $crc, $bitrate, $bitindex, $freq, $mode, $copy, $genres;
     // Corrected by Luca (18/06/01): luca@linuxmendoza.org.ar
     $genres = array('Blues', 'Classic Rock', 'Country', 'Dance', 'Disco', 'Funk', 'Grunge', 'Hip-Hop', 'Jazz', 'Metal', 'New Age', 'Oldies', 'Other', 'Pop', 'R&B', 'Rap', 'Reggae', 'Rock', 'Techno', 'Industrial', 'Alternative', 'Ska', 'Death Metal', 'Pranks', 'Soundtrack', 'Euro-Techno', 'Ambient', 'Trip-Hop', 'Vocal', 'Jazz+Funk', 'Fusion', 'Trance', 'Classical', 'Instrumental', 'Acid', 'House', 'Game', 'Sound Clip', 'Gospel', 'Noise', 'AlternRock', 'Bass', 'Soul', 'Punk', 'Space', 'Meditative', 'Instrumental Pop', 'Instrumental Rock', 'Ethnic', 'Gothic', 'Darkwave', 'Techno-Industrial', 'Electronic', 'Pop-Folk', 'Eurodance', 'Dream', 'Southern Rock', 'Comedy', 'Cult', 'Gangsta', 'Top 40', 'Christian Rap', 'Pop/Funk', 'Jungle', 'Native American', 'Cabaret', 'New Wave', 'Psychadelic', 'Rave', 'Showtunes', 'Trailer', 'Lo-Fi', 'Tribal', 'Acid Punk', 'Acid Jazz', 'Polka', 'Retro', 'Musical', 'Rock & Roll', 'Hard Rock', 'Folk', 'Folk-Rock', 'National Folk', 'Swing', 'Fast Fusion', 'Bebob', 'Latin', 'Revival', 'Celtic', 'Bluegrass', 'Avantgarde', 'Gothic Rock', 'Progressive Rock', 'Psychedelic Rock', 'Symphonic Rock', 'Slow Rock', 'Big Band', 'Chorus', 'Easy Listening', 'Acoustic', 'Humour', 'Speech', 'Chanson', 'Opera', 'Chamber Music', 'Sonata', 'Symphony', 'Booty Bass', 'Primus', 'P**n Groove', 'Satire', 'Slow Jam', 'Club', 'Tango', 'Samba', 'Folklore', 'Ballad', 'Power Ballad', 'Rhythmic Soul', 'Freestyle', 'Duet', 'Punk Rock', 'Drum Solo', 'Acapella', 'Euro-House', 'Dance Hall');
     $genreids = array("Blues" => 0, "Classic Rock" => 1, "Country" => 2, "Dance" => 3, "Disco" => 4, "Funk" => 5, "Grunge" => 6, "Hip-Hop" => 7, "Jazz" => 8, "Metal" => 9, "New Age" => 10, "Oldies" => 11, "Other" => 12, "Pop" => 13, "R&B" => 14, "Rap" => 15, "Reggae" => 16, "Rock" => 17, "Techno" => 18, "Industrial" => 19, "Alternative" => 20, "Ska" => 21, "Death Metal" => 22, "Pranks" => 23, "Soundtrack" => 24, "Euro-Techno" => 25, "Ambient" => 26, "Trip-Hop" => 27, "Vocal" => 28, "Jazz+Funk" => 29, "Fusion" => 30, "Trance" => 31, "Classical" => 32, "Instrumental" => 33, "Acid" => 34, "House" => 35, "Game" => 36, "Sound Clip" => 37, "Gospel" => 38, "Noise" => 39, "AlternRock" => 40, "Bass" => 41, "Soul" => 42, "Punk" => 43, "Space" => 44, "Meditative" => 45, "Instrumental Pop" => 46, "Instrumental Rock" => 47, "Ethnic" => 48, "Gothic" => 49, "Darkwave" => 50, "Techno-Industrial" => 51, "Electronic" => 52, "Pop-Folk" => 53, "Eurodance" => 54, "Dream" => 55, "Southern Rock" => 56, "Comedy" => 57, "Cult" => 58, "Gangsta" => 59, "Top 40" => 60, "Christian Rap" => 61, "Pop/Funk" => 62, "Jungle" => 63, "Native American" => 64, "Cabaret" => 65, "New Wave" => 66, "Psychadelic" => 67, "Rave" => 68, "Showtunes" => 69, "Trailer" => 70, "Lo-Fi" => 71, "Tribal" => 72, "Acid Punk" => 73, "Acid Jazz" => 74, "Polka" => 75, "Retro" => 76, "Musical" => 77, "Rock & Roll" => 78, "Hard Rock" => 79, "Folk" => 80, "Folk-Rock" => 81, "National Folk" => 82, "Swing" => 83, "Fast Fusion" => 84, "Bebob" => 85, "Latin" => 86, "Revival" => 87, "Celtic" => 88, "Bluegrass" => 89, "Avantgarde" => 90, "Gothic Rock" => 91, "Progressive Rock" => 92, "Psychedelic Rock" => 93, "Symphonic Rock" => 94, "Slow Rock" => 95, "Big Band" => 96, "Chorus" => 97, "Easy Listening" => 98, "Acoustic" => 99, "Humour" => 100, "Speech" => 101, "Chanson" => 102, "Opera" => 103, "Chamber Music" => 104, "Sonata" => 105, "Symphony" => 106, "Booty Bass" => 107, "Primus" => 108, "P**n Groove" => 109, "Satire" => 110, "Slow Jam" => 111, "Club" => 112, "Tango" => 113, "Samba" => 114, "Folklore" => 115, "Ballad" => 116, "Power Ballad" => 117, "Rhythmic Soul" => 118, "Freestyle" => 119, "Duet" => 120, "Punk Rock" => 121, "Drum Solo" => 122, "Acapella" => 123, "Euro-House" => 124, "Dance Hall" => 125);
     // end
     $version = array("00" => 2.5, "10" => 2, "11" => 1);
     $layer = array("01" => 3, "10" => 2, "11" => 1);
     $crc = array("Yes", "No");
     $bitrate["0001"] = array(32, 32, 32, 32, 8, 8);
     $bitrate["0010"] = array(64, 48, 40, 48, 16, 16);
     $bitrate["0011"] = array(96, 56, 48, 56, 24, 24);
     $bitrate["0100"] = array(128, 64, 56, 64, 32, 32);
     $bitrate["0101"] = array(160, 80, 64, 80, 40, 40);
     $bitrate["0110"] = array(192, 96, 80, 96, 48, 48);
     $bitrate["0111"] = array(224, 112, 96, 112, 56, 56);
     $bitrate["1000"] = array(256, 128, 112, 128, 64, 64);
     $bitrate["1001"] = array(288, 160, 128, 144, 80, 80);
     $bitrate["1010"] = array(320, 192, 160, 160, 96, 96);
     $bitrate["1011"] = array(352, 224, 192, 176, 112, 112);
     $bitrate["1100"] = array(384, 256, 224, 192, 128, 128);
     $bitrate["1101"] = array(416, 320, 256, 224, 144, 144);
     $bitrate["1110"] = array(448, 384, 320, 256, 160, 160);
     $bitindex = array("1111" => "0", "1110" => "1", "1101" => "2", "1011" => "3", "1010" => "4", "1001" => "5", "0011" => "3", "0010" => 4, "0001" => "5");
     $freq["00"] = array("11" => 44100, "10" => 22050, "00" => 11025);
     $freq["01"] = array("11" => 48000, "10" => 24000, "00" => 12000);
     $freq["10"] = array("11" => 32000, "10" => 16000, "00" => 8000);
     $mode = array("00" => "Stereo", "01" => "Joint stereo", "10" => "Dual channel", "11" => "Mono");
     $copy = array("No", "Yes");
     if (!($f = @fopen($file, "r"))) {
         return -1;
         break;
     } else {
         // read first 4 bytes from file and determine if it is wave file if so, header begins five bytes after word 'data'
         $tmp = fread($f, 4);
         if ($tmp == "RIFF") {
             $idtag["ftype"] = "Wave";
             fseek($f, 0);
             $tmp = fread($f, 128);
             $x = StrPos($tmp, "data");
             fseek($f, $x + 8);
             $tmp = fread($f, 4);
         }
         // now convert those four bytes to BIN. maybe it can be faster and easier. dunno how yet. help?
         for ($y = 0; $y < 4; $y++) {
             $x = decbin(ord($tmp[$y]));
             for ($i = 0; $i < 8 - StrLen($x); $i++) {
                 $x .= "0";
             }
             $bajt .= $x;
         }
         // every mp3 framesynch begins with eleven ones, lets look for it. if not found continue looking for some 1024 bytes (you can search multiple for it or you can disable this, it will speed up and not many mp3 are like this. anyways its not standart)
         //     if(substr($bajt,1,11)!="11111111111") {
         //        return -1;
         //        break;
         //     }
         if (substr($bajt, 1, 11) != "11111111111") {
             fseek($f, 4);
             $tmp = fread($f, 2048);
             for ($i = 0; $i < 2048; $i++) {
                 if (ord($tmp[$i]) == 255 && substr(decbin(ord($tmp[$i + 1])), 0, 3) == "111") {
                     $tmp = substr($tmp, $i, 4);
                     $bajt = "";
                     for ($y = 0; $y < 4; $y++) {
                         $x = decbin(ord($tmp[$y]));
                         for ($i = 0; $i < 8 - StrLen($x); $i++) {
                             $x .= "0";
                         }
                         $bajt .= $x;
                     }
                     break;
                 }
             }
         }
         if ($bajt == "") {
             return -1;
             break;
         }
         // now parse all the info from frame header
         $len = filesize($file);
         $idtag["version"] = $version[substr($bajt, 11, 2)];
         $idtag["layer"] = $layer[substr($bajt, 13, 2)];
         $idtag["crc"] = $crc[$bajt[15]];
         $idtag["bitrate"] = $bitrate[substr($bajt, 16, 4)][$bitindex[substr($bajt, 11, 4)]];
         $idtag["frequency"] = $freq[substr($bajt, 20, 2)][substr($bajt, 11, 2)];
         $idtag["padding"] = $copy[$bajt[22]];
         $idtag["mode"] = $mode[substr($bajt, 24, 2)];
         $idtag["copyright"] = $copy[$bajt[28]];
         $idtag["original"] = $copy[$bajt[29]];
         // lets count lenght of the song
         if ($idtag["layer"] == 1) {
             $fsize = (12 * ($idtag["bitrate"] * 1000) / $idtag["frequency"] + $idtag["padding"]) * 4;
         } else {
             $fsize = 144 * ($idtag["bitrate"] * 1000 / $idtag["frequency"] + $idtag["padding"]);
         }
         // Modified by Luca (18/02/01): devel@lluca.com
         $idtag["lenght_sec"] = round($len / Round($fsize) / 38.37);
         // end
         $idtag["lenght"] = date("i:s", round($len / Round($fsize) / 38.37));
         // now lets see at the end of the file for id3 tag. if exists then  parse it. if file doesnt have an id 3 tag if will return -1 in field 'tag' and if title is empty it returns file name.
         if (!$len) {
             $len = filesize($file);
         }
         fseek($f, $len - 128);
         $tag = fread($f, 128);
         if (Substr($tag, 0, 3) == "TAG") {
             $idtag["file"] = $file;
             $idtag["tag"] = -1;
             // Modified by Luca (18/02/01): devel@lluca.com
             $idtag["title"] = Mp3Parser::strip_nulls(Substr($tag, 3, 30));
             $idtag["artist"] = Mp3Parser::strip_nulls(Substr($tag, 33, 30));
             $idtag["album"] = Mp3Parser::strip_nulls(Substr($tag, 63, 30));
             $idtag["year"] = Mp3Parser::strip_nulls(Substr($tag, 93, 4));
             $idtag["comment"] = Mp3Parser::strip_nulls(Substr($tag, 97, 30));
             // If the comment is less than 29 chars, we look for the presence of a track #
             if (strlen($idtag["comment"]) < 29) {
                 if (Ord(Substr($tag, 125, 1)) == chr(0)) {
                     // If char 125 is null then track (maybe) is present
                     $idtag["track"] = Ord(Substr($tag, 126, 1));
                 } else {
                     // If not, we are sure is not present.
                     $idtag["track"] = 0;
                 }
             } else {
                 // If the comment is 29 or 30 chars long, there's no way to put track #
                 $idtag["track"] = 0;
             }
             // end
             $idtag["genreid"] = Ord(Substr($tag, 127, 1));
             $idtag["genre"] = $genres[$idtag["genreid"]];
             $idtag["filesize"] = $len;
         } else {
             $idtag["tag"] = 0;
         }
         // close opened file and return results.
         if (!$idtag["title"]) {
             $idtag["title"] = Str_replace("\\", "/", $file);
             $idtag["title"] = substr($idtag["title"], strrpos($idtag["title"], "/") + 1, 255);
         }
         fclose($f);
         return $idtag;
     }
 }
 public function showTitle($book_in)
 {
     $title = $book_in->getTitle();
     $this->titleCount++;
     return Str_replace(' ', '*', $title);
 }
Example #5
0
 public function fetch($fetch)
 {
     $array = mysql_fetch_array($fetch);
     return $this->query = Str_replace(" ", "&nbsp;", $array);
 }
Example #6
0
 function starTitle()
 {
     $this->btd->title = Str_replace(" ", "*", $this->btd->title);
 }
Example #7
0
<?php 
$link = $_GET["link"];
$html = file_get_contents($link);
$t1 = explode('<meta name="title" content="', $html);
$t2 = explode('-', $t1[1]);
$titulek = $t2[0];
$t1 = explode('<link rel="image_src" href="', $html);
$t2 = explode('"', $t1[1]);
$nahled = $t2[0];
echo "<mediaDisplay>\r\n    <text offsetXPC=55 offsetYPC=6 widthPC=50 heightPC=6 fontSize=20 backgroundColor=-1:-1:-1 foregroundColor=250:250:250>:{$titulek}</text>\t\t\t\r\n    </mediaDisplay>\n";
echo "<channel>\r\n\t<title>Stream.cz</title>\n";
$t1 = explode('<meta name="description" content="', $html);
$t2 = explode('"', $t1[1]);
$popis1 = $t2[0];
$popis = Str_replace("&amp;", "-", $popis1);
$t1 = explode('<div id="videoDescription">', $html);
$t2 = explode('-', $t1[1]);
$datum = $t2[0];
$t1 = explode('&cdnHQ=', $html);
$t2 = explode('&', $t1[1]);
$hq = $t2[0];
$t1 = explode('&cdnLQ=', $html);
$t2 = explode('&', $t1[1]);
$lq = $t2[0];
$t1 = explode('&cdnHD=', $html);
$t2 = explode('&', $t1[1]);
$hd = $t2[0];
if ($hd != "") {
    $lhd = "http://cdn-dispatcher.stream.cz/getSource?id=" . $hd . "&proto=rtmp";
    $html2 = file_get_contents($lhd);
 //echo "<th>CustPW</th></tr>\n";
 /* fetch object array */
 while ($row = $result->fetch_row()) {
     //  printf ("%s (%s)\n", $row[0], $row[1]);
     //echo "<tr><th>{$row[0]}</th>";
     if ($Swap == "N") {
         echo Str_replace("_", " ", $row[1]);
         //echo $row[1]; ///Cust FName
         echo " ";
         echo Str_replace("_", " ", $row[2]);
         //echo $row[2]; //CustLName
     } else {
         echo Str_replace("_", " ", $row[2]);
         //echo $row[2]; ///Cust FName
         echo " ";
         echo Str_replace("_", " ", $row[1]);
         //echo $row[1]; //CustLName
     }
     echo "<br>Email: ";
     //echo "{$row[3]}";
     //echo "<th>{$row[3]}</th>";
     //echo "{$row[4]}";
     echo "{$row[5]}";
     // Cust Email FROM CUSTOMER TABLE!!!
     $E = $row[5];
     //echo "{$row[6]}";
     //echo "<th>{$row[7]}</th>";
     //echo "<th>{$row[8]}</th>";
     //echo "<th>{$row[9]}</th></tr>\n";
     //$P = $row[9];
     /*echo "row5: {$row[5]}";
Example #9
0
    $disk = $queryArr[1];
}
$URL = "http://www.ceskatelevize.cz/ivysilani/" . $lnk;
echo "<?xml version='1.0' ?>\n";
echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
if (($html = openpage($URL)) != FALSE) {
    $ItemsOut .= "<channel>\n<title>ČT iVysílání</title>";
    $videos = explode('<li class="itemBlock clearfix">', $html);
    unset($videos[0]);
    $videos = array_values($videos);
    foreach ($videos as $video) {
        $t1 = explode(' href="', $video);
        $t2 = explode('"', $t1[1]);
        $link = "http://www.ceskatelevize.cz" . $t2[0];
        $t1 = explode('src="', $video);
        $t2 = explode('"', $t1[1]);
        $nahled = $t2[0];
        $t1 = explode('alt="', $video);
        $t2 = explode('"', $t1[1]);
        $titulek = $t2[0];
        if (strpos($titulek, '<') != false) {
            $titulek = "Bezejmenný titul";
        }
        $titulek2 = Str_replace("&mdash;", "-", $titulek);
        $ItemsOut .= "\r\n\t\t\t<item>\r\n\t\t\t\t<title>" . $titulek2 . "</title>\r\n\t\t\t\t<link>http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . "/ct_link.php?link=" . $link . "</link>\r\n\t\t\t\t<media:thumbnail url=\"" . $nahled . "\" />\r\n\t\t\t</item>\n";
    }
    $ItemsOut .= "</channel>\n</rss>";
    echo $ItemsOut;
} else {
    echo "TEST SELHAL !";
}
Example #10
0
 function processTitle($title)
 {
     return Str_replace(' ', '*', $title);
 }
Example #11
0
 function showTitle($title_in)
 {
     return Str_replace(" ", "*", $title_in);
 }
 private function getCURL($url)
 {
     $url = Str_replace(" ", "+", $url);
     //to have no problems with image/png; mode=24bit!
     $url = str_replace(";", "%3B", $url);
     if (func_num_args() == 2) {
         $auth = func_get_arg(1);
     }
     //auth should be an array of ['username', 'realm', 'password', 'auth_type'] - or false - problem would be, that these are stored without hashing them!
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
     //for images
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     //dont store and load cookies from previous sessions
     curl_setopt($ch, CURLOPT_COOKIESESSION, true);
     //allow https connections and handle certificates quite simply ;-)
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeOut);
     //$e = new mb_notice("connector: test1:");
     //get hostname/ip out of url
     //$host = parse_url($url,PHP_URL_HOST);
     $arURL = parse_url($url);
     $host = $arURL["host"];
     $port = $arURL["port"];
     if ($port == '') {
         $port = 80;
     }
     $path = $arURL["path"];
     // fill array (HOSTs not for Proxy)
     $e = new mb_notice("class_connector.php: NOT_PROXY_HOSTS:" . NOT_PROXY_HOSTS);
     $NOT_PROXY_HOSTS_array = explode(",", NOT_PROXY_HOSTS);
     //check if http_proxy is set as env, if yes, unset it for the curl action here, it will be reset somewhere below - normally not needed, cause it will be only available when at execution time of the script http://php.net/manual/en/function.putenv.php
     if (getenv('http_proxy')) {
         $e = new mb_notice("class_connector.php: current http_proxy: " . getenv('http_proxy') . " will be unset by putenv('http_proxy')");
         $tmpHttpProxy = getenv('http_proxy');
         putenv("http_proxy");
         //this should unset the variable???
     } else {
         $e = new mb_notice("class_connector.php: http_proxy is not set as env variable!");
         $tmpHttpProxy = getenv('http_proxy');
     }
     //$tmpHttpProxy = getenv('http_proxy')?getenv('http_proxy') : "";
     //putenv("http_proxy");
     //check if proxy is set and server not in NOT_PROXY_HOSTS
     if (CONNECTION_PROXY != "" and in_array($host, $NOT_PROXY_HOSTS_array) != true) {
         curl_setopt($ch, CURLOPT_PROXY, CONNECTION_PROXY . ":" . CONNECTION_PORT);
         $e = new mb_notice("class_connector.php: Proxy will be used!");
         if (CONNECTION_PASSWORD != "") {
             curl_setopt($ch, CURLOPT_PROXYUSERPWD, CONNECTION_USER . ':' . CONNECTION_PASSWORD);
         }
     } else {
         $e = new mb_notice("class_connector.php: Proxy will not be used!");
     }
     //TODO maybe allow basic authentication for client, but this will store the passwords in plain text
     //TODO: store the  passwords as digest hash. Therefor we have to handle the realm which is defined in the 401 header and return it back to the scripts like mod_loadwms.php to store the digest into the database - problem: curl cannot handle digest connection without clear username and password - we have to send our own headers
     if (isset($auth) && $auth != false) {
         curl_setopt($ch, CURLOPT_USERPWD, $auth['username'] . ':' . $auth['password']);
         if ($auth['auth_type'] == 'digest') {
             curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
         }
         if ($auth['auth_type'] == 'basic') {
             curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
         }
     }
     //if httpType is POST, set CURLOPT_POST and CURLOPT_POSTFIELDS
     //and set a usefull http header
     if (strtoupper($this->httpType) == 'POST') {
         $headers = array("POST " . $path . " HTTP/1.1", "Content-type: " . $this->httpContentType . "; charset=" . CHARSET, "Cache-Control: no-cache", "Pragma: no-cache", "Content-length: " . strlen($this->httpPostData));
         $e = new mb_notice("connector: CURL POST: " . $this->httpPostData);
         $e = new mb_notice("connector: CURL POST length: " . strlen($this->httpPostData));
         if ($this->curlSendCustomHeaders) {
             curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
         }
         if ($this->httpPostFieldsNumber != 1) {
             curl_setopt($ch, CURLOPT_POST, $this->httpPostFieldsNumber);
         } else {
             curl_setopt($ch, CURLOPT_POST, 1);
         }
         curl_setopt($ch, CURLOPT_POSTFIELDS, $this->httpPostData);
     }
     $useragent = CONNECTION_USERAGENT;
     //Build own headers for GET Requests - maybe needful?
     if (strtoupper($this->httpType) == 'GET') {
         $headers = array("GET " . $path . " HTTP/1.1", "User-Agent: " . $_SERVER['HTTP_USER_AGENT'], "Host: " . $host, "Accept: */*", "Proxy-Connection: Keep-Alive");
         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     }
     #curl_setopt($ch, CURLOPT_HEADER, true);
     $e = new mb_notice("class_connector.php: CURL connect to: " . $url);
     //curl_setopt ($ch,CURLOPT_USERAGENT,$useragent);
     curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false);
     curl_setopt($ch, CURLINFO_HEADER_OUT, true);
     curl_setopt($ch, CURLOPT_FORBID_REUSE, false);
     //curl_setopt ($ch,HTTPPROXYTUNNEL, 1);
     //curl_setopt ($ch,CURLOPT_AUTOREFERER, 1);
     //curl_setopt ($ch,CURLOPT_VERBOSE, true);
     //$handle = fopen('/tmp/phpcurl_error.tmp', 'a'); //use this for debugging purposes
     //curl_setopt ($ch,CURLOPT_STDERR, $handle);
     $file = curl_exec($ch);
     //handle http authentication
     $info = curl_getinfo($ch);
     /*$error_log = "";
     		$error_log .= "http code: ".$info['http_code']."\n";
     		$error_log .= "sent header: ".$info['request_header']."\n";
     		$error_log .= "lookup time: ".$info['namelookup_time']."\n";
     		$error_log .= "redirect_time: ".$info['redirect_time']."\n";
     		$error_log .= "redirect_count: ".$info['redirect_count']."\n";*/
     if ($info['http_code'] == '401') {
         curl_close($ch);
         return $info['http_code'];
     }
     if ($info['http_code'] == '502') {
         curl_close($ch);
         $e = new mb_exception("class_connector.php: Problem with connecting Gateway - maybe problem with the configuration of the security proxy (mod_proxy?).");
         return $info['http_code'];
         /*fwrite($handle,"HEADER: \n");
         		fwrite($handle,$error_log);
         		fwrite($handle,"502: ".$file."\n");*/
     }
     curl_close($ch);
     //fclose($handle);
     //reset the env variable http_proxy to the former value
     if ($tmpHttpProxy != '') {
         putenv("http_proxy={$tmpHttpProxy}");
     }
     $e = new mb_notice("class_connector.php: CURL give back: " . $file);
     return $file;
 }
     //Object oriented style
     while ($row = $result->fetch_row()) {
         //  printf ("%s (%s)\n", $row[0], $row[1]);
         //echo "<tr><th>{$row[0]}</th>";
         if ($Swap == "N") {
             $strrepFN = Str_replace("_", " ", $row[1]) . " ";
             //echo $row[1]; ///Cust FName
             //echo " ";
             $strrepLN = Str_replace("_", " ", $row[2]);
             //echo $row[2]; //CustLName
         } else {
             //swap around firstname with lastname:
             $strrepFN = Str_replace("_", " ", $row[2]) . " ";
             //echo $row[2]; ///Cust FName
             //echo " ";
             $strrepLN = Str_replace("_", " ", $row[1]);
             //echo $row[1]; //CustLName
         }
         $Email = $row[5];
         // Cust Email FROM CUSTOMER TABLE!!!
         $E = $row[5];
         $Abbr = $row[13];
         $rowNULL = $row[0];
     }
     // free result set
     $result->close();
 }
 $TAmt = $rowI['TotAmt'];
 //$TAmt = number_format ($TAmt, 2, ".", "");
 $strD1 = strtr($rowI['D1'], array('_' => '&nbsp;'));
 $strQ1 = $rowI['Q1'];
Example #14
0
 public function getMeteoAlarm($area = '')
 {
     global $SITE, $warnScriptName, $noaaEvents, $noaaEventIcons;
     $this->charset = $SITE['charset'];
     #
     # check environment setting
     #		if ( isset ($SITE['warnOffset']) && ($SITE['warnOffset'] > -3601) && ($SITE['warnOffset'] < 7200) ) { $this->timeOffset = $SITE['warnOffset']; }
     if (isset($SITE['timeFormat'])) {
         $this->timeFormat = $SITE['timeFormat'];
     }
     if (isset($SITE['timeOnlyFormat'])) {
         $this->timeOnlyFormat = $SITE['timeOnlyFormat'];
     }
     #
     $this->area = trim($area);
     // user input by call of this function
     $this->langAlarm = 'en_US';
     $this->cachePath = $SITE['cacheDir'];
     #-------------------------------------------------------------------------------
     # check if data (for this location) is in cache
     #-------------------------------------------------------------------------------
     $from = array('.', 'php');
     $string = $warnScriptName . '_' . $this->area . '_' . $this->langAlarm;
     $string = str_replace($from, '', $this->cachePath . $string);
     $this->cache_file = $string . '.txt';
     $returnArray = $this->loadFromCache();
     // load from cache returns data only when its data is valid
     if (!empty($returnArray)) {
         // if data is in cache and valid return data to calling program
         return $returnArray;
     }
     // eo return to calling program
     #-------------------------------------------------------------------------------
     # combine user constants and input (1)location (2)units for temp etc  to required url
     #-------------------------------------------------------------------------------
     $this->urlPart[1] = $this->area;
     $this->fullUrl = '';
     for ($i = 0; $i < count($this->urlPart); $i++) {
         $this->fullUrl .= $this->urlPart[$i];
     }
     # echo $this->fullUrl; exit;
     #----------------------------------------------------------------------------------------------
     if (!$this->makeRequest()) {
         // no good data loaded
         return false;
     }
     #						// we have to check if there are warnings
     $this->rawData = Str_replace('cap:', 'cap_', $this->rawData);
     $xml = new SimpleXMLElement($this->rawData);
     $color = '';
     $strNoWarn = 'here are no active';
     $pos = strpos($this->rawData, $strNoWarn);
     if ($pos != false) {
         // no warnings this time
         $returnArray['general']['msg'] = 'no warnings';
         $returnArray['general']['title'] = (string) $xml->entry->title;
         $this->writeToCache($returnArray);
         $this->rawData = '';
         return $returnArray;
     }
     #						// we have to process every  warning
     $returnArray['general']['id'] = (string) $xml->id;
     $returnArray['general']['title'] = (string) $xml->title;
     $returnArray['general']['link'] = (string) $xml->link['href'];
     $endWarn = count($xml->entry);
     $returnArray['general']['msg'] = (string) $endWarn;
     for ($cntWarn = 0; $cntWarn < $endWarn; $cntWarn++) {
         $data = $xml->entry[$cntWarn];
         #					$returnArray[$cntWarn]['color']	= (string) $data->cap_effective;
         $unixFrom = strtotime((string) $data->cap_effective);
         $returnArray['warn'][$cntWarn]['from'] = date($SITE['timeFormat'], $unixFrom);
         $unixTo = strtotime((string) $data->cap_expires);
         $From = date('Ymd', $unixFrom);
         $To = date('Ymd', $unixTo);
         if ($From != $To) {
             $returnArray['warn'][$cntWarn]['until'] = date($SITE['timeFormat'], $unixTo);
         } else {
             $returnArray['warn'][$cntWarn]['until'] = date($SITE['timeOnlyFormat'], $unixTo);
         }
         $event = (string) $data->cap_event;
         $returnArray['warn'][$cntWarn]['event'] = $event;
         $type = $noaaEvents[$event]['types'];
         $returnArray['warn'][$cntWarn]['types'] = $type;
         $returnArray['warn'][$cntWarn]['severity'] = (string) $data->cap_severity;
         $returnArray['warn'][$cntWarn]['areaDesc'] = (string) $data->cap_areaDesc;
         $returnArray['warn'][$cntWarn]['img'] = $noaaEventIcons[$type];
         $returnArray['warn'][$cntWarn]['summary'] = (string) $data->summary;
         $returnArray['warn'][$cntWarn]['link'] = (string) $data->link['href'];
         $returnArray['warn'][$cntWarn]['urgency'] = (string) $data->cap_urgency;
     }
     // eo for all warnings
     # print_r ($xml); print_r ($returnArray);   exit;
     $this->writeToCache($returnArray);
     $this->rawData = '';
     return $returnArray;
 }