function getData() { $capth = htmlspecialchars($_GET['cap']); $username = $_GET['reg']; $password = $_GET['dd']; $mobile = $_GET['m']; $url = "https://academics.vit.ac.in/parent/parent_login_submit.asp"; $cookie = dirname(__FILE__) . "/cookie/" . $_GET['hash'] . ".txt"; $veri = $capth; $postdata = "wdregno=" . $username . "&wdpswd=" . $password . "&wdmobno=" . $mobile . "&vrfcd=" . $veri; $ch = curl_init(); setproxy($ch); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt($ch, CURLOPT_TIMEOUT, 260); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_REFERER, 'https://academics.vit.ac.in/parent/parent_login.asp'); curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt($ch, CURLOPT_POST, 1); $result = curl_exec($ch); $ch = curl_init(); setproxy($ch); curl_setopt($ch, CURLOPT_URL, 'https://academics.vit.ac.in/parent/timetable.asp?sem=FS'); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_REFERER, 'https://academics.vit.ac.in/parent/home.asp'); $result = curl_exec($ch); //// Uncomment To View Timetable [Debugging] // echo $result; $id = $_GET['reg']; $dd = $_GET['dd']; $stamp = md5(time()); //// The parser is called here if (parser($result, $id)) { //// Login was successful! Add this user to registered user table or something.. /* mysql_query("INSERT INTO users( name, regno, pass, birthday, auth ) VALUES( '$name', '$id', '$pass', '$dd', '$stamp' )"); echo "Registration Successful :D"; */ } else { die("Whoops! Something went wrong. Please recheck your ID, birthday and captcha."); } }
$ausgaben[news_rspalte] = ""; $sql = "SELECT * FROM " . BEITRAG_KOPF . " WHERE " . $news_where_statement_aktuell; $result = $db->query($sql); while ($news = $db->fetch_array($result, 1)) { $ausgaben[news_ueberschrift] = "<a href=\"" . $pathvars[virtual] . "/news," . $news[beitragid] . ",1.html\">" . $news[beitrag] . "</a><br />"; $sql = "SELECT " . $environment[news_uebersicht_pre_inh] . " FROM " . BEITRAG_INHALT . " where beitragid = '" . $news[beitragid] . "'"; $inh_result = $db->query($sql); $row = $db->fetch_row($inh_result, 1); $ausgaben[news_teiltext] = tagremove($row[0]); $ausgaben[news_teiltext] = substr($ausgaben[news_teiltext], 0, $environment[news_uebersicht_pre_len]) . " <a href=\"" . $pathvars[virtual] . "/news," . $news[beitragid] . ",1.html\">... mehr?</a><br />"; if ($spalte == "news_lspalte") { $spalte = "news_rspalte"; } else { $spalte = "news_lspalte"; } $ausgaben[$spalte] .= parser("news.preview", "") . "<br />"; } $mapping[main] = "news"; if ($ausgaben[news_lspalte] == "") { $ausgaben[news_lspalte] = "Aktuell keine Einträge"; } if ($ausgaben[news_rspalte] == "") { $ausgaben[news_rspalte] = "Aktuell keine weiteren Einträge"; } } } elseif ($environment[subkatid] == "archiv") { $sql = "SELECT * FROM " . BEITRAG_KOPF . " WHERE " . $news_where_statement_archiv; $result = $db->query($sql); while ($news = $db->fetch_array($result, 1)) { if ($news[ausgabe] != $newsausgabe) { if ($newsausgabe != "") {
// error_message(mysql_error()); //} //$query_data = mysql_fetch_array($result); //$captcha = $query_data['bool']; //$captchadate = $query_data['accessdate']; // //$todayCU = intval(date("U")) + (!date('I')) * 60 * 60; //$accessCU = intval(strtotime($captchadate)); //$diffC = $todayCU - $accessCU; //$deltaC = 2 * 60 * 60; // //if ($captcha == 1 && $diffC < $deltaC) { // // $PauseC = gmdate('H:i:s', abs($deltaC - $diffC)); // echo"Работа сервиса приостановлена на $PauseC из-за блокировки Yandex"; // exit; //} elseif ($captcha == 1 && $diffC >= $deltaC) { // // $query = "UPDATE $captcha_tablename SET bool = '0'"; // $result = mysql_query($query); // // if (!$result) { // error_message(mysql_error()); // } //} //------------------------------------------------------------------------------- $value = "кафе"; $str_query = $value; $url_str = "http://" . $url . "/yandsearch?text=" . $str_query; print_r(parser($url, $url_str)); //$ObjDb->db_close();
continue; } $b = explode("=", $arg); if (isset($options[$b[0]])) { $options[$b[0]] = $b[1]; } else { $buf .= "unknown key {$b['0']}"; echo $buf; exit; } } if (!file_exists($options['i']) && !file_exists($options['l'])) { echo $buf; exit; } $a = parser($options['i'], $options['l']); $table = htmlPrinter($a); $odir = $options['o'] . $options['r'] . "/"; @mkdir($odir); if (is_dir($odir)) { file_put_contents($odir . 'index.html', $table); } else { file_put_contents('index.html', $table); } /** * This function will first parse the instances.tab file and * get the data metrics for each endpoint. The returned array will then * be merged by prefix name with the LSR and one multidimensional array will * be returned */ function parser($instances, $lsr)
} // globale bereiche if (count($dataloop[$bereich . "_edit"]) > 0 && priv_check($url, "admin;edit")) { $hidedata[$bereich . "_edit"]["num"] = count($dataloop[$bereich . "_edit"]); } if (count($dataloop[$bereich . "_release_wait"]) > 0 && !priv_check($url, "admin;publish") && priv_check($url, "admin;edit")) { $hidedata[$bereich . "_release_wait"]["num"] = count($dataloop[$bereich . "_release"]); } if (count($dataloop[$bereich . "_release_queue"]) > 0 && priv_check($url, "admin;publish")) { $hidedata[$bereich . "_release_queue"]["num"] = count($dataloop[$bereich . "_release_queue"]); } // suche in freigebenen artikeln immer einblenden $search = $url; $id = $url; $kate = $url; $ausgaben[$bereich . "_search"] = parser("administration-recent", ''); // berechtigung checken if (!priv_check($url, "admin;edit")) { continue; } $hidedata[$bereich . "_section"] = array("heading" => "#(" . $bereich . "_heading)", "new" => "#(" . $bereich . "_new)"); } // normalen content ausschliesslich spezielle bereiche durchgehen // * * * $bereich = "content"; $buffer = find_marked_content("/", $cfg, "inhalt", array(-2, -1), array(), FALSE, array("/blog")); $dataloop[$bereich . "_edit"] = $buffer[-1]; $dataloop[$bereich . "_release_queue"] = $buffer[-2]; $dataloop[$bereich . "_release_wait"] = $buffer[-2]; $toggle_fields = array("edit" => array("all", "edit;publish"), "release_queue" => array("all", "publish"), "release_wait" => array("own", "edit"), "release_recent" => array("own", "edit;publish")); foreach ($toggle_fields as $tog_key => $tog_value) {
# $submenuresult = $db -> query($sql); #} while ($level3array = $db->fetch_array($level3result, $nop)) { if ($cfg["menu"]["level3"]["enable"] == -1) { if ($level3array["level"] == "") { $right = -1; } else { if ($rechte[$level3array["level"]] == -1) { $right = -1; } else { $right = 0; } } if ($right == -1) { if ($level3array["entry"] != "") { $ausgaben["punkte"] .= "<img src=\"../../images/" . $environment["design"] . "/menu.png\" width=\"2\" height=\"12\" align=\"absbottom\"> <a class=\"" . $cfg["menu"]["level3"]["style"] . "\" href=\"" . $pathvars["fqdn"] . $pathvars["virtual"] . "/" . $level1array["entry"] . "/" . $level2array["entry"] . "/" . $level3array["entry"] . ".html\">" . $level3array["label"] . "</a><br>"; } else { #$ausgaben["punkte"] .= "<img src=\"../../images/".$environment["design"]."/menu.png\" width=\"2\" height=\"12\" align=\"absbottom\"> <a class=\"".$cfg["menu"]["level3"]["style"]."\" target=\"_blank\" href=\"".$level3array["exturl"]."\">".$level3array["label"]."</a><br>"; $ausgaben["punkte"] .= "<img src=\"../../images/" . $environment["design"] . "/menu.png\" width=\"2\" height=\"12\" align=\"absbottom\"> <a class=\"" . $cfg["menu"]["level3"]["style"] . "\" href=\"" . $level3array["exturl"] . "\">" . $level3array["label"] . "</a><br>"; } } } } } } if ($cfg["menu"]["level1"]["enable"] == -1 && $parser == -1) { $ausgaben[$cfg["menu"]["name"]] .= parser($cfg["menu"]["name"], "", $parse_find, $parse_put); } } #if ( $debugging["html_enable"] ) $debugging["ausgabe"] .= "[ ++ $script_name ++ ]".$debugging["char"]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function tagreplace($replace) { global $db, $debugging, $cfg, $pathvars, $environment, $ausgaben, $defaults, $specialvars, $dataloop, $hidedata, $mapping; // cariage return + linefeed fix if ($specialvars["newbrmode"] != True) { $sear = array("\r\n[TA", "\r\n[RO", "\r\n[CO", "/H1]\r\n", "/H2]\r\n", "/H3]\r\n", "/H4]\r\n", "/H5]\r\n", "/H6]\r\n[", "/HR]\r\n", "AB]\r\n", "OW]\r\n", "OL]\r\n", "IV]\r\n"); $repl = array("[TA", "[RO", "[CO", "/H1]", "/H2]", "/H3]", "/H4]", "/H5]", "/H6]", "/HR]", "AB]", "OW]", "OL]", "IV]"); $replace = str_replace($sear, $repl, $replace); } $preg = "|\\[\\/[!A-Z0-9]{1,6}\\]|"; $selection_counter = 0; $img_counter = 0; $imgb_counter = 0; while (preg_match($preg, $replace, $match)) { $closetag = $match[0]; if (strstr($replace, $closetag)) { // wo beginnt der closetag $closetagbeg = strpos($replace, $closetag); // wie sieht der opentag aus $opentag = str_replace(array("/", "]"), array("", ""), $closetag); // wie lang ist der opentag $opentaglen = strlen($opentag); // nur hier kann der opentag sein $haystack = substr($replace, 0, $closetagbeg); // fehlenden open tag abfangen if (strpos($haystack, $opentag . "]") === false && strpos($haystack, $opentag . "=") === false) { if ($defaults["tag"]["error"] == "") { $error = " <font color=\"#FF0000\">" . $opentag . "]?</font> "; } else { $error = $defaults["tag"]["error"] . $opentag . "]" . $defaults["tag"]["/error"]; } $replace = $haystack . $error . substr($replace, $closetagbeg + $opentaglen + 2); continue; } // wie lautet der tagwert $tagwertbeg = strlen($haystack) - (strpos(strrev($haystack), strrev($opentag)) + strlen($opentag)) + $opentaglen + 1; $tagoriginal = substr($replace, $tagwertbeg, $closetagbeg - $tagwertbeg); $tagwert = $tagoriginal; // parameter? $sign = substr($replace, $tagwertbeg - 1, 1); // opentag komplettieren $opentag = $opentag . $sign; // kompletten tag mit tagwert ersetzen switch ($closetag) { // // Block Elemente // H1-6 | P | PRE | DIV | LIST | HR | TAB, ROW, COL | CENTER // case "[/H1]": if ($specialvars["newbrmode"] == True) { $tagwert = nlreplace($tagwert); } if ($defaults["tag"]["h1"] == "") { $defaults["tag"]["h1"] = "<h1>"; $defaults["tag"]["/h1"] = "</h1>"; } $replace = str_replace($opentag . $tagoriginal . $closetag, $defaults["tag"]["h1"] . $tagwert . $defaults["tag"]["/h1"], $replace); break; case "[/H2]": if ($specialvars["newbrmode"] == True) { $tagwert = nlreplace($tagwert); } if ($defaults["tag"]["h2"] == "") { $defaults["tag"]["h2"] = "<h2>"; $defaults["tag"]["/h2"] = "</h2>"; } $replace = str_replace($opentag . $tagoriginal . $closetag, $defaults["tag"]["h2"] . $tagwert . $defaults["tag"]["/h2"], $replace); break; case "[/H3]": if ($specialvars["newbrmode"] == True) { $tagwert = nlreplace($tagwert); } if ($defaults["tag"]["h3"] == "") { $defaults["tag"]["h3"] = "<h3>"; $defaults["tag"]["/h3"] = "</h3>"; } $replace = str_replace($opentag . $tagoriginal . $closetag, $defaults["tag"]["h3"] . $tagwert . $defaults["tag"]["/h3"], $replace); break; case "[/H4]": if ($specialvars["newbrmode"] == True) { $tagwert = nlreplace($tagwert); } if ($defaults["tag"]["h4"] == "") { $defaults["tag"]["h4"] = "<h4>"; $defaults["tag"]["/h4"] = "</h4>"; } $replace = str_replace($opentag . $tagoriginal . $closetag, $defaults["tag"]["h4"] . $tagwert . $defaults["tag"]["/h4"], $replace); break; case "[/H5]": if ($specialvars["newbrmode"] == True) { $tagwert = nlreplace($tagwert); } if ($defaults["tag"]["h5"] == "") { $defaults["tag"]["h5"] = "<h5>"; $defaults["tag"]["/h5"] = "</h5>"; } $replace = str_replace($opentag . $tagoriginal . $closetag, $defaults["tag"]["h5"] . $tagwert . $defaults["tag"]["/h5"], $replace); break; case "[/H6]": if ($specialvars["newbrmode"] == True) { $tagwert = nlreplace($tagwert); } if ($defaults["tag"]["h6"] == "") { $defaults["tag"]["h6"] = "<h6>"; $defaults["tag"]["/h6"] = "</h6>"; } $replace = str_replace($opentag . $tagoriginal . $closetag, $defaults["tag"]["h6"] . $tagwert . $defaults["tag"]["/h6"], $replace); break; case "[/P]": if ($specialvars["newbrmode"] == True) { $tagwert = nlreplace($tagwert); } if ($sign == "]") { $ausgabewert = "<p>" . $tagwert . "</p>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } else { $tagwerte = explode("]", $tagwert, 2); $pwerte = explode(";", $tagwerte[0]); $extrawerte = explode(":", $pwerte[0]); if ($extrawerte[1] != "") { $pwerte[0] = $extrawerte[1]; } if ($extrawerte[0] == "id") { $art = "id"; } else { $art = "class"; } $attrib = ""; if ($pwerte[0] != "") { $attrib = " " . $art . "=\"" . $pwerte[0] . "\""; } $replace = str_replace($opentag . $tagoriginal . $closetag, "<p" . $attrib . ">" . $tagwerte[1] . "</p>", $replace); } break; case "[/PRE]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<pre>" . $tagwert . "</pre>", $replace); break; case "[/DIV]": if ($specialvars["newbrmode"] == True && strpos($specialvars["newbrblock"], "DIV") === false) { $tagwert = nlreplace($tagwert); } if ($sign == "]") { $ausgabewert = "<div>" . $tagwert . "</div>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } else { $tagwerte = explode("]", $tagwert, 2); $divwerte = explode(";", $tagwerte[0]); $extrawerte = explode(":", $divwerte[0]); if ($extrawerte[1] != "") { $divwerte[0] = $extrawerte[1]; } if ($extrawerte[0] == "id") { $art = "id"; } else { $art = "class"; } $attrib = ""; if ($divwerte[0] != "") { $attrib = " " . $art . "=\"" . $divwerte[0] . "\""; } $replace = str_replace($opentag . $tagoriginal . $closetag, "<div" . $attrib . ">" . $tagwerte[1] . "</div>", $replace); } break; case "[/LIST]": if ($sign == "]") { $tagwerte = explode("[*]", $tagwert); $ausgabewert = "<ul>"; while (list($key, $punkt) = each($tagwerte)) { if ($specialvars["newbrmode"] == True) { $punkt = nlreplace($punkt); } $ausgabewert .= "<li><span>" . $punkt . "</span></li>"; } $ausgabewert .= "</ul>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } else { $tagrestbeg = strpos($tagwert, "]"); $listart = substr($tagwert, 0, $tagrestbeg); $tagrest = substr($tagwert, $tagrestbeg + 1); $tagwerte = explode("[*]", $tagrest); if ($listart == 1) { $ausgabewert = "<ol>"; while (list($key, $punkt) = each($tagwerte)) { if ($specialvars["newbrmode"] == True) { $punkt = nlreplace($punkt); } $ausgabewert .= "<li><span>" . $punkt . "</span></li>"; } $ausgabewert .= "</ol>"; } elseif ($listart == "DEF") { $ausgabewert = "<dl>"; while (list($key, $punkt) = each($tagwerte)) { if ($specialvars["newbrmode"] == True) { $punkt = nlreplace($punkt); } if ($key % 2 != 0) { $ausgabewert .= "<dd>" . $punkt . "</dd>"; } else { $ausgabewert .= "<dt>" . $punkt . "</dt>"; } } $ausgabewert .= "</dl>"; } else { if (strlen($listart) > 1) { $ausgabewert = "<ul type=\"" . $listart . "\">"; } else { $ausgabewert = "<ol type=\"" . $listart . "\">"; } while (list($key, $punkt) = each($tagwerte)) { if ($specialvars["newbrmode"] == True) { $punkt = nlreplace($punkt); } $ausgabewert .= "<li><span>" . $punkt . "</span></li>"; } if (strlen($listart) > 1) { $ausgabewert .= "</ul>"; } else { $ausgabewert .= "</ol>"; } } $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } break; case "[/HR]": if ($defaults["tag"]["hr"] == "") { $defaults["tag"]["hr"] = "<hr />"; $defaults["tag"]["/hr"] = ""; } $replace = str_replace($opentag . $tagoriginal . $closetag, $defaults["tag"]["hr"] . $tagwert . $defaults["tag"]["/hr"], $replace); break; case "[/TAB]": if ($specialvars["newbrmode"] == True) { $tagwert = str_replace("\r\n", "", $tagwert); } if ($sign == "]") { $replace = str_replace($opentag . $tagoriginal . $closetag, "<table cellspacing=\"0\" cellpadding=\"1\">" . $tagwert . "</table>", $replace); } else { $tagwerte = explode("]", $tagwert, 2); $tabwerte = explode(";", $tagwerte[0]); if ($tabwerte[0] == "l") { $align = " align=\"left\""; } elseif ($tabwerte[0] == "m") { $align = " align=\"center\""; } elseif ($tabwerte[0] == "r") { $align = " align=\"right\""; } else { $align = ""; } if ($tabwerte[1] != "") { $width = " width=\"" . $tabwerte[1] . "\""; } if ($tabwerte[2] != "") { $border = " border=\"" . $tabwerte[2] . "\""; } if ($tabwerte[3] != "") { $cellspacing = " cellspacing=\"" . $tabwerte[3] . "\""; } else { $cellspacing = " cellspacing=\"0\""; } if ($tabwerte[4] != "") { $cellpadding = " cellpadding=\"" . $tabwerte[4] . "\""; } else { $cellpadding = " cellpadding=\"1\""; } $replace = str_replace($opentag . $tagoriginal . $closetag, "<table" . $cellspacing . $cellpadding . $width . $align . $border . ">" . $tagwerte[1] . "</table>", $replace); $replace = tagreplace($replace); } break; case "[/TABCSV]": if ($sign != "]") { $tagwerte = explode("]", $tagwert, 2); $tabwerte = explode(";", $tagwerte[0]); // csv-datei if ($specialvars["subdir"] != "") { $pfad = str_replace($specialvars["subdir"] . "/", "", $tabwerte[0]); } else { $pfad = $tabwerte[0]; } $file_path = explode("/", $pfad); $extension = $cfg["file"]["filetyp"][$file_path[2]]; $directory = $cfg["file"]["fileopt"][$extension]["path"]; $file_name = $extension . "_" . $file_path[3] . "." . $file_path[2]; if (file_exists($directory . $file_name)) { $table = ""; $handle = fopen($directory . $file_name, "r"); // enthaelt die erste zeile spaltenueberschriften if ($tabwerte[3] != "") { $cell_tag1 = "<th scope=\"col\">"; $cell_tag2 = "</th>\n"; $row_tag1 = "<thead>\n<tr>"; $row_tag2 = "</tr>\n</thead>"; } else { $cell_tag1 = "<td>"; $cell_tag2 = "</td>\n"; $row_tag1 = "<tr>"; $row_tag2 = "</tr>\n"; } $thead = ""; while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) { $row = ""; foreach ($data as $value) { $row .= $cell_tag1 . $value . $cell_tag2; } if ($row != "") { $table .= $row_tag1 . $row . $row_tag2; } if (strstr($cell_tag1, "<th")) { $thead = $table; $table = ""; $cell_tag1 = "<td>"; $cell_tag2 = "</td>\n"; $row_tag1 = "<tr>"; $row_tag2 = "</tr>\n"; } } // summary if ($tagwerte[1] != "") { $summary = " summary=\"" . $tagwerte[1] . "\""; } else { $summary = ""; } // breite if ($tabwerte[1] != "") { $width = " width=\"" . $tabwerte[1] . "%\""; } else { $width = ""; } // border if ($tabwerte[2] != "") { $border = " border=\"" . $tabwerte[2] . "\""; } else { $border = ""; } if ($table != "") { $table = "<table" . $border . $width . $summary . ">\n" . $thead . "<tbody>\n" . $table . "</tbody>\n</table>\n"; } } else { $table = ""; } $replace = str_replace($opentag . $tagoriginal . $closetag, $table, $replace); } else { $replace = str_replace($opentag . $tagoriginal . $closetag, "", $replace); } break; case "[/ROW]": if ($specialvars["newbrmode"] == True) { $tagwert = str_replace("\r\n", "", $tagwert); } $replace = str_replace($opentag . $tagoriginal . $closetag, "<tr>" . $tagwert . "</tr>", $replace); break; case "[/TH]": if ($specialvars["newbrmode"] == True) { $tagwert = nlreplace($tagwert); } $replace = str_replace($opentag . $tagoriginal . $closetag, "<th valign=\"top\">" . $tagwert . "</th>", $replace); break; case "[/COL]": if ($specialvars["newbrmode"] == True) { $tagwert = nlreplace($tagwert); } if ($sign == "]") { $replace = str_replace($opentag . $tagoriginal . $closetag, "<td valign=\"top\">" . $tagwert . "</td>", $replace); } else { $tagwerte = explode("]", $tagwert, 2); $colwerte = explode(";", $tagwerte[0]); if ($colwerte[0] == "l") { $align = " align=\"left\""; } elseif ($colwerte[0] == "m") { $align = " align=\"center\""; } elseif ($colwerte[0] == "r") { $align = " align=\"right\""; } else { $align = ""; } if ($colwerte[1] != "") { $width = " width=\"" . $colwerte[1] . "\""; } if ($colwerte[2] == "o") { $valign = " valign=\"top\""; } elseif ($colwerte[2] == "m") { $valign = " valign=\"middle\""; } elseif ($colwerte[2] == "u") { $valign = " valign=\"bottom\""; } elseif ($colwerte[2] == "g") { $valign = " valign=\"baseline\""; } else { $valign = " valign=\"top\""; } $replace = str_replace($opentag . $tagoriginal . $closetag, "<td" . $align . $width . $valign . ">" . $tagwerte[1] . "</td>", $replace); } break; case "[/CENTER]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<center>" . $tagwert . "</center>", $replace); break; // // Inline Elemente // BR | IMG | LINK | -span- // // // Inline Elemente // BR | IMG | LINK | -span- // case "[/BR]": if ($sign == "]") { $replace = str_replace($opentag . $tagoriginal . $closetag, "<br />", $replace); } else { $tagwerte = explode("]", $tagwert, 2); $brwerte = explode(";", $tagwerte[0]); if ($brwerte[0] == "a") { $clear = "clear=\"all\""; $style_clear = "style=\"clear:both;\""; } elseif ($brwerte[0] == "l") { $clear = "clear=\"left\""; $style_clear = "style=\"clear:left;\""; } elseif ($brwerte[0] == "r") { $clear = "clear=\"right\""; $style_clear = "style=\"clear:right;\""; } else { $clear = ""; $style_clear = ""; } if ($specialvars["w3c"] == "strict") { $replace = str_replace($opentag . $tagoriginal . $closetag, "<br " . $style_clear . "/>", $replace); } else { $replace = str_replace($opentag . $tagoriginal . $closetag, "<br " . $clear . "/>", $replace); } } break; case "[/IMG]": $img_counter++; $imgsize = ""; $imgurl = ""; if ($sign == "]") { if (!strstr($tagwert, "/")) { $imgfile = $pathvars["fileroot"] . "images/" . $environment["design"] . "/" . $tagwert; if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; $imgurl = $pathvars["images"] . $tagwert; } } else { $imgurl = $tagwert; if (!strstr($tagwert, "http")) { if (strpos($tagwert, $cfg["file"]["base"]["pic"]["root"]) === false) { $opt = explode("/", $tagwert); $imgfile = $cfg["file"]["base"]["maindir"] . $cfg["file"]["base"]["pic"]["root"] . $cfg["file"]["base"]["pic"][$opt[4]] . "img_" . $opt[3] . "." . $opt[2]; } elseif (strstr($tagwert, $cfg["file"]["base"]["webdir"])) { $imgfile = str_replace($cfg["file"]["base"]["webdir"], "", $tagwert); $imgfile = $cfg["file"]["base"]["maindir"] . $imgfile; } else { $imgfile = $pathvars["fileroot"] . $tagwert; } if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; } else { $imgsize = ""; } } } $ausgabewert = "<img src=\"" . $imgurl . "\" title=\"" . $tagwert . "\" alt=\"" . $tagwert . "\"" . $imgsize . " />"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } else { if ($defaults["tag"]["img_w3c"] == "") { $defaults["tag"]["img_w3c"] = "<img src=\"##imgurl##\" title=\"##beschriftung##\" alt=\"##beschriftung##\"##imgsize## style=\"##style_align####style_border####style_hspace####style_vspace##\"##attrib## />"; } if ($defaults["tag"]["img"] == "") { $defaults["tag"]["img"] = "<img src=\"##imgurl##\"##attrib####vspace####hspace## title=\"##beschriftung##\" alt=\"##beschriftung##\"##align####border####imgsize## />"; } if ($defaults["tag"]["img_link"] == "") { $defaults["tag"]["img_link"] = "<a href=\"##imglnk##\" title=\"##beschriftung##\">"; } if ($defaults["tag"]["img_link_lb"] == "") { $defaults["tag"]["img_link_lb"] = "<a href=\"##imglnk##\" title=\"##beschriftung##\" ##lightbox## >"; } if ($defaults["tag"]["/img_link"] == "") { $defaults["tag"]["/img_link"] = "</a>"; } $repl = array("imgurl", "beschriftung", "funder", "fdesc", "imgsize", "attrib", "vspace", "hspace", "align", "border", "style_align", "style_border", "style_hspace", "style_vspace", "imglnk", "lightbox"); $tagwerte = explode("]", $tagwert, 2); $imgwerte = explode(";", $tagwerte[0]); $extrawerte = explode(":", $imgwerte[1]); if ($extrawerte[1] != "") { $imgwerte[1] = $extrawerte[1]; } if ($extrawerte[0] == "id") { $art = " id"; } else { $art = " class"; } $align = ""; $attrib = ""; $style_align = ""; if ($imgwerte[1] == "r") { $align = " align=\"right\""; $style_align = "float:right;"; } elseif ($imgwerte[1] == "l") { $align = " align=\"left\""; $style_align = "float:left;"; } elseif ($imgwerte[1] != "") { $attrib = " " . $art . "=\"" . $imgwerte[1] . "\""; } if ($imgwerte[2] == "0") { $border = " border=\"0\""; $style_border = "border-width:0;"; } elseif ($imgwerte[2] > 0) { $border = " border=\"" . $imgwerte[2] . "\""; $style_border = "border-width:" . $imgwerte[2] . "px;"; } else { $border = ""; $style_border = ""; } if ($imgwerte[3] == "l") { $lightbox = "rel=\"lightbox[" . $img_counter . "]\""; } if ($imgwerte[4] == "") { $vspace = ""; $style_vspace = ""; } else { $vspace = " vspace=\"" . $imgwerte[4] . "\""; $style_vspace = "margin-top:" . $imgwerte[4] . "px;margin-bottom:" . $imgwerte[4] . "px;"; } if ($imgwerte[6] == "") { $hspace = ""; $style_hspace = ""; } else { $hspace = " hspace=\"" . $imgwerte[6] . "\""; if ($imgwerte[1] == "r") { $style_hspace = "margin-left:" . $imgwerte[6] . "px;margin-right:0px;"; } elseif ($imgwerte[1] == "l") { $style_hspace = "margin-left:0px;margin-right:" . $imgwerte[6] . "px;"; } else { $style_hspace = "margin-left:" . $imgwerte[6] . "px;margin-right:" . $imgwerte[6] . "px;"; } } if ($tagwerte[1] == "") { $beschriftung = $imgwerte[0]; } else { $beschriftung = $tagwerte[1]; } // weitere informationen aus datenbank holen if (preg_match("/^\\//", $tagwerte[0])) { $img_path = explode("/", str_replace($cfg["file"]["base"]["maindir"], "", $tagwerte[0])); if (is_numeric($img_path[3])) { $fid = $img_path[3]; //subdir quickfix } elseif (is_numeric($img_path[4])) { $fid = $img_path[4]; } else { $fid = substr($tagwerte[0], 0, strpos($tagwerte[0], ";")); $fid = strrchr($fid, "_"); $fid = substr($fid, 1, strpos($fid, ".") - 1); } $sql = "SELECT *\n FROM site_file\n WHERE fid=" . $fid; $result = $db->query($sql); $data = $db->fetch_array($result, 1); $funder = $data["funder"]; $fdesc = $data["fdesc"]; } else { $funder = $beschriftung; $fdesc = $beschriftung; } $linka = ""; $linkb = ""; if (!strstr($imgwerte[0], "/")) { $imgfile = $pathvars["fileroot"] . "images/" . $environment["design"] . "/" . $imgwerte[0]; if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; $imgurl = $pathvars["images"] . $imgwerte[0]; } else { $imgsize = ""; } } else { $imgurl = $imgwerte[0]; if (!strstr($imgwerte[0], "http")) { if (strpos($imgwerte[0], $cfg["file"]["base"]["pic"]["root"]) === false) { $opt = explode("/", str_replace($pathvars["subdir"], "", $imgwerte[0])); $imgfile = $cfg["file"]["base"]["maindir"] . $cfg["file"]["base"]["pic"]["root"] . $cfg["file"]["base"]["pic"][$opt[4]] . "img_" . $opt[3] . "." . $opt[2]; } elseif (strstr($imgwerte[0], $cfg["file"]["base"]["webdir"])) { $imgfile = str_replace($cfg["file"]["base"]["webdir"], "", $imgwerte[0]); $imgfile = $cfg["file"]["base"]["maindir"] . $imgfile; } else { $imgfile = $pathvars["fileroot"] . $imgwerte[0]; } if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; } if ($imgwerte[3] != "") { $bilderstrecke = "," . $imgwerte[7]; } else { $bilderstrecke = ""; } if ($imgwerte[3] != "") { if (strpos($imgurl, $cfg["file"]["base"]["pic"]["root"]) === false) { $opt = explode("/", str_replace($pathvars["subdir"], "", $imgurl)); $imgid = $opt[3]; } else { $opt = split("[_.]", $imgurl); $imgid = $opt[1]; } $path = dirname($pathvars["requested"]); if (substr($path, -1) != '/') { $path = $path . "/"; } $imglnk = $path . basename($pathvars["requested"], ".html") . "/view," . $imgwerte[3] . "," . $imgid . $bilderstrecke . ".html"; if ($imgwerte[3] == "l") { $imglnk = preg_replace("/\\/(tn|s|m|b)\\//", "/o/", $imgurl); $linka = $defaults["tag"]["img_link_lb"]; } else { $linka = $defaults["tag"]["img_link"]; } $linkb = $defaults["tag"]["/img_link"]; } } else { $imgsize = ""; } } if ($specialvars["w3c"] == "strict") { $ausgabewert = $linka . $defaults["tag"]["img_w3c"] . $linkb; } else { $ausgabewert = $linka . $defaults["tag"]["img"] . $linkb; } foreach ($repl as $value) { $ausgabewert = str_replace("##" . $value . "##", ${$value}, $ausgabewert); ${$value} = ""; } $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } break; case "[/LINK]": if ($sign == "]") { $ausgabewert = "<a href=\"" . $tagwert . "\" title=\"" . $tagwert . "\">" . $tagwert . "</a>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } else { $tagwerte = explode("]", $tagwert, 2); $linkwerte = explode(";", $tagwerte[0]); $href = $linkwerte[0]; if ($tagwerte[1] == "") { $beschriftung = $href; } else { $beschriftung = $tagwerte[1]; } // ziel if ($linkwerte[1] != "") { $target = " target=\"" . $linkwerte[1] . "\""; } else { $target = ""; } // title-tag if ($linkwerte[2] != "") { $title = $linkwerte[2]; } else { if ($linkwerte[1] == "_blank") { $title = "Link in neuem Fenster: " . str_replace("http://", "", $href); } elseif (!strstr($beschriftung, "<")) { $title = $beschriftung; } else { $title = ""; } } // css-klasse, je nachdem, welche art link vorliegt $class = ""; if (preg_match("/^http/", $href)) { $class = "link_extern"; } elseif (preg_match("/^" . str_replace("/", "\\/", $cfg["file"]["base"]["webdir"]) . ".*\\.([a-zA-Z]+)/", $href, $match)) { if ($cfg["file"]["filetyp"][$match[1]] != "") { $class = "link_" . $cfg["file"]["filetyp"][$match[1]]; } } // klasse manuell hinzufuegen if ($linkwerte[3] != "") { $class .= " " . $linkwerte[3]; } // id if ($linkwerte[4] != "") { $id = " id=\"" . $linkwerte[4] . "\""; } else { $id = ""; } $ausgabewert = $pic . "<a href=\"" . $href . "\"" . $id . $target . " title=\"" . $title . "\" class=\"" . $class . "\">" . $beschriftung . "</a>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } break; // // Inline Elemente - Logische Auszeichnungen // AKR | EM | STRONG | CODE | CITE | -q- // // // Inline Elemente - Logische Auszeichnungen // AKR | EM | STRONG | CODE | CITE | -q- // case "[/ACR]": if ($sign == "]") { $ausgabewert = "<acronym>" . $tagwert . "</acronym>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } else { $tagwerte = explode("]", $tagwert, 2); $acrwerte = explode(";", $tagwerte[0]); $attrib = ""; if ($acrwerte[0] != "") { $attrib = " title=\"" . $acrwerte[0] . "\""; } $replace = str_replace($opentag . $tagoriginal . $closetag, "<acronym" . $attrib . ">" . $tagwerte[1] . "</acronym>", $replace); } break; case "[/EM]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<em>" . $tagwert . "</em>", $replace); break; case "[/STRONG]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<strong>" . $tagwert . "</strong>", $replace); break; case "[/CODE]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<code>" . $tagwert . "</code>", $replace); break; case "[/CITE]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<blockquote>" . $tagwert . "</blockquote>", $replace); break; // // Inline Elemente - Physische Auszeichnungen // B | I | TT | U | S, ST | BIG | SMALL | SUB | SUP // // // Inline Elemente - Physische Auszeichnungen // B | I | TT | U | S, ST | BIG | SMALL | SUB | SUP // case "[/B]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<b>" . $tagwert . "</b>", $replace); break; case "[/I]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<i>" . $tagwert . "</i>", $replace); break; case "[/TT]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<tt>" . $tagwert . "</tt>", $replace); break; case "[/U]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<u>" . $tagwert . "</u>", $replace); break; case "[/S]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<s>" . $tagwert . "</s>", $replace); break; case "[/ST]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<strike>" . $tagwert . "</strike>", $replace); break; case "[/BIG]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<big>" . $tagwert . "</big>", $replace); break; case "[/SMALL]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<small>" . $tagwert . "</small>", $replace); break; case "[/SUB]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<sub>" . $tagwert . "</sub>", $replace); break; case "[/SUP]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<sup>" . $tagwert . "</sup>", $replace); break; // // eWeBuKi Spezial // E | ! | ANK | EMAIL | HS |HL | IMGB | IN | M0 | M1 | M2 | QUOTE | SP | UP | PREV | NEXT // // // eWeBuKi Spezial // E | ! | ANK | EMAIL | HS |HL | IMGB | IN | M0 | M1 | M2 | QUOTE | SP | UP | PREV | NEXT // case "[/E]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<pre>" . $tagwert . "</pre>", $replace); break; case "[/!]": $replace = str_replace($opentag . $tagoriginal . $closetag, "<!--" . $tagwert . "-->", $replace); break; case "[/ANK]": if ($sign == "]") { $ausgabewert = "<a name=\"" . $tagwert . "\"></a>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } else { $tagwerte = explode("]", $tagwert, 2); $ausgabewert = "<a name=\"" . $tagwerte[0] . "\">" . $tagwerte[1] . "</a>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } break; case "[/EMAIL]": if ($sign == "]") { $ausgabewert = "<a href=\"mailto:" . $tagwert . "\">" . $tagwert . "</a>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } else { $tagwerte = explode("]", $tagwert, 2); if ($tagwerte[1] == "") { $beschriftung = $tagwerte[0]; } else { $beschriftung = $tagwerte[1]; } $ausgabewert = "<a href=\"mailto:" . $tagwerte[0] . "\">" . $beschriftung . "</a>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); } break; case "[/HS]": $replace = str_replace($opentag . $tagoriginal . $closetag, $tagwert, $replace); break; case "[/HL]": if ($defaults["tag"]["hl"] == "") { $defaults["tag"]["hl"] = "<hr />"; $defaults["tag"]["/hl"] = ""; } $replace = str_replace($opentag . $tagoriginal . $closetag, $defaults["tag"]["hl"] . $tagwert . $defaults["tag"]["/hl"], $replace); break; case "[/IMGB]": $imgb_counter++; if ($defaults["tag"]["img_link"] == "") { $defaults["tag"]["img_link"] = "<a href=\"##imglnk##\">"; } if ($defaults["tag"]["img_link_lb"] == "") { $defaults["tag"]["img_link_lb"] = "<a href=\"##imglnk##\" title=\"##beschriftung##\" ##lightbox## >"; } if ($defaults["tag"]["/img_link"] == "") { $defaults["tag"]["/img_link"] = "</a>"; } $repl = array("imgurl", "imglnk", "beschriftung", "funder", "fdesc", "lightbox"); $tagwerte = explode("]", $tagwert, 2); $imgwerte = explode(";", $tagwerte[0]); $extrawerte = explode(":", $imgwerte[1]); if ($extrawerte[1] != "") { $imgwerte[1] = $extrawerte[1]; } $ausgaben["align"] = ""; $lspace = ""; $rspace = ""; $ausgaben["imgstyle"] = ""; $ausgaben["float"] = ""; // "id" or "class" wird im template gesetzt (!#ausgaben_imgstyle) if ($imgwerte[1] == "r") { $ausgaben["align"] = "right"; $ausgaben["float"] = "float:right;"; if ($imgwerte[6] == "") { $lspace = "10"; } else { $lspace = $imgwerte[6]; } $rspace = "0"; } elseif ($imgwerte[1] == "l") { $ausgaben["align"] = "left"; $ausgaben["float"] = "float:left;"; $lspace = "0"; if ($imgwerte[6] == "") { $rspace = "10"; } else { $rspace = $imgwerte[6]; } } elseif ($imgwerte[1] != "") { $ausgaben["imgstyle"] = $imgwerte[1]; } if ($imgwerte[2] == "0") { $ausgaben["border"] = "border-width:0;"; } elseif ($imgwerte[2] > 0) { $ausgaben["border"] = "border-width:" . $imgwerte[2] . ";"; } else { $ausgaben["border"] = ""; } if ($imgwerte[3] == "l") { $lightbox = "rel=\"lightbox[b" . $imgb_counter . "]\""; } if ($imgwerte[4] == "") { $tspace = "0"; } else { $tspace = $imgwerte[4]; } if ($imgwerte[5] == "") { $bspace = "0"; } else { $bspace = $imgwerte[5]; } if ($tagwerte[1] == "") { $beschriftung = $imgwerte[0]; } else { $beschriftung = $tagwerte[1]; } // weitere informationen aus datenbank holen if (preg_match("/^\\//", $tagwerte[0])) { $img_path = explode("/", str_replace($cfg["file"]["base"]["maindir"], "", $tagwerte[0])); if (is_numeric($img_path[3])) { $fid = $img_path[3]; } else { $fid = substr($tagwerte[0], 0, strpos($tagwerte[0], ";")); $fid = strrchr($fid, "_"); $fid = substr($fid, 1, strpos($fid, ".") - 1); } $sql = "SELECT *\n FROM site_file\n WHERE fid=" . $fid; $result = $db->query($sql); $data = $db->fetch_array($result, 1); $funder = $data["funder"]; $fdesc = $data["fdesc"]; } else { $funder = $beschriftung; $fdesc = $beschriftung; } $ausgaben["linka"] = ""; $ausgaben["linkb"] = ""; if (strpos($imgwerte[0], "/") === false) { $imgfile = $pathvars["fileroot"] . "images/" . $environment["design"] . "/" . $imgwerte[0]; if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $ausgaben["imgsize"] = " " . $imgsize[3]; $ausgaben["imgurl"] = $pathvars["images"] . $imgwerte[0]; } } else { $imgurl = $imgwerte[0]; if (strpos($imgurl, "http") === false) { if (strpos($imgwerte[0], $cfg["file"]["base"]["pic"]["root"]) === false) { $opt = explode("/", str_replace($pathvars["subdir"], "", $imgurl)); $imgfile = $cfg["file"]["base"]["maindir"] . $cfg["file"]["base"]["pic"]["root"] . $cfg["file"]["base"]["pic"][$opt[4]] . "img_" . $opt[3] . "." . $opt[2]; } elseif (strpos($imgurl, $cfg["file"]["base"]["webdir"]) !== false) { $imgfile = $cfg["file"]["base"]["maindir"] . str_replace($cfg["file"]["base"]["webdir"], "", $imgurl); } else { $imgfile = $pathvars["fileroot"] . $imgwerte[0]; } if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $ausgaben["tabwidth"] = $imgsize[0]; $ausgaben["imgsize"] = " " . $imgsize[3]; } else { $ausgaben["tabwidth"] = ""; $ausgaben["imgsize"] = ""; } if ($imgwerte[7] != "") { $bilderstrecke = "," . $imgwerte[7]; } else { $bilderstrecke = ""; } if ($imgwerte[3] != "") { if (strpos($imgurl, $cfg["file"]["base"]["pic"]["root"]) === false) { $opt = explode("/", str_replace($pathvars["subdir"], "", $imgurl)); $imgid = $opt[3]; } else { $opt = split("[_.]", $imgurl); $imgid = $opt[1]; } if (substr($pathvars["requested"], 0, 1) == '/') { $path = substr($pathvars["requested"], 1); } $path = dirname($pathvars["requested"]); if (substr($path, -1) != '/') { $path = $path . "/"; } $imglnk = $path . basename($pathvars["requested"], ".html") . "/view," . $imgwerte[3] . "," . $imgid . $bilderstrecke . ".html"; if ($imgwerte[3] == "l") { $imglnk = preg_replace("/\\/(tn|s|m)\\//", "/b/", $imgurl); $ausgaben["linka"] = $defaults["tag"]["img_link_lb"]; } else { $ausgaben["linka"] = $defaults["tag"]["img_link"]; } foreach ($repl as $value) { $ausgaben["linka"] = str_replace("##" . $value . "##", ${$value}, $ausgaben["linka"]); } $ausgaben["linkb"] = $defaults["tag"]["/img_link"]; } else { $ausgaben["linka"] = ""; $ausgaben["linkb"] = ""; } } $ausgaben["imgurl"] = $imgurl; } $ausgaben["alt"] = $beschriftung; $ausgaben["beschriftung"] = $beschriftung; $ausgaben["funder"] = $funder; $ausgaben["fdesc"] = $fdesc; $ausgaben["tspace"] = $tspace; $ausgaben["lspace"] = $lspace; $ausgaben["rspace"] = $rspace; $ausgaben["bspace"] = $bspace; $ausgabewert = str_replace(chr(13) . chr(10), "", parser("imgb", "")); $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgabewert, $replace); break; case "[/SEL]": $selection_counter++; $tag_value = explode("]", $tagwert, 2); $tag_param = explode(";", $tag_value[0]); $tag_extra = explode(":", $tag_param[3]); $tag_special = explode(":", $tag_param[0]); if (!preg_match("/[0-9]+/", $tag_param[0])) { $sel = "selection not ready"; $replace = str_replace($opentag . $tagoriginal . $closetag, $sel, $replace); } else { $path = dirname($pathvars["requested"]); if (substr($path, -1) != '/') { $path = $path . "/"; } $link = $path . basename($pathvars["requested"], ".html") . "/view," . $tag_param[1] . ",#," . $tag_param[0] . "," . $tag_param[2] . ".html"; #/view,groesse,bild,selektion,thumbs if ($defaults["tag"]["sel"] == "") { $defaults["tag"]["sel"] = "<div style=\"position:relative\" class=\"selection_teaser\">##no_image####youtube_div##\n<b>##title## ##youtube_link##</b>\n##no_image_end##<div>\n<ul>\n"; } if ($defaults["tag"]["*sel"] == "") { $defaults["tag"]["*sel"] = "<li class=\"thumbs\"##style##>\n<a href=\"##link##\" ##lb##class=\"pic\" title=\"##fdesc##\"><img src=\"##tn##\" alt=\"##funder##\" title=\"##funder##\"/></a>\n</li>\n"; } if ($defaults["tag"]["/sel"] == "") { $defaults["tag"]["/sel"] = "</ul>\n</div>\n<span##display##>g(compilation_info)(##count## g(compilation_pics))</span>\n</div>"; } if (strstr($tag_param[0], ":")) { $sel_pics = ""; foreach ($tag_special as $pics) { if ($pics == "") { continue; } $sel_pics != "" ? $trenner = " ," : ($trenner = ""); $sel_pics .= $trenner . $pics; } if ($sel_pics == "") { $sel_pics = 0; } $sql = "SELECT * FROM site_file WHERE fid in (" . $sel_pics . ")"; $sel_pics1 = explode(":", $tag_param[0]); $i = 0; foreach ($sel_pics1 as $key => $value) { $i++; $tmp_sort[$value] = $i; } $result = $db->query($sql); $files = array(); $sortarray = array(); while ($data = $db->fetch_array($result, 1)) { $sortarray[] = $tmp_sort[$data["fid"]]; $files[] = array("fid" => $data["fid"], "sort" => $counter, "ffart" => $data["ffart"], "ffname" => $data["ffname"], "funder" => $data["funder"], "fdesc" => $data["fdesc"]); } if (count($files) > 0) { array_multisort($sortarray, $files); } } else { $sql = "SELECT *\n FROM site_file\n WHERE fhit LIKE '%#p" . $tag_param[0] . "%'"; $result = $db->query($sql); $files = array(); while ($data = $db->fetch_array($result, 1)) { preg_match("/#p" . $tag_param[0] . "[,]*([0-9]*)#/i", $data["fhit"], $match); $files[$match[1]] = array("fid" => $data["fid"], "sort" => $match[1], "ffart" => $data["ffart"], "ffname" => $data["ffname"], "funder" => $data["funder"], "fdesc" => $data["fdesc"]); } ksort($files); $sort = array(); foreach ($files as $key => $row) { $sort[$key] = $row['sort']; } array_multisort($sort, $files); } $sel = str_replace("##title##", $tag_value[1], $defaults["tag"]["sel"]); // wenn video-parameter vorhanden dann marken ersetzen if ($tag_param[5] != "") { $sel = str_replace("##youtube_div##", "<div class=\"new_box new_space_inside\" style=\"background: #EEF3FB;height:212px;width:250px;display:none\" id=\"" . $tag_param[0] . "_video\">\n [OBJECT=http://www.youtube.com/v/" . $tag_param[5] . "&hl=de_DE&fs=1&;250;192;application/x-shockwave-flash]\n [PARAM=movie]http://www.youtube.com/v/" . $tag_param[5] . "&hl=de_DE&fs=1&[/PARAM]\n [PARAM=wmode]transparent[/PARAM]\n [/OBJECT]\n <span style=\"float:right\"><b><a onclick=\"Element.setStyle('" . $tag_param[0] . "_video', 'display:none');\">Schließen</a></b></span></div>", $sel); $sel = str_replace("##youtube_link##", "<a onclick=\"Element.setStyle('" . $tag_param[0] . "_video', 'display:block;position:absolute;left:-1px;top:-228px');\">Video</a>", $sel); } else { $sel = str_replace("##youtube_div##", "", $sel); $sel = str_replace("##youtube_link##", "", $sel); } $lb_helper = ""; $file_counter = 0; foreach ($files as $row) { $file_counter++; if ($cfg["file"]["base"]["realname"] == True) { $img = $cfg["file"]["base"]["webdir"] . $row["ffart"] . "/" . $row["fid"] . "/" . $tag_param[1] . "/" . $row["ffname"]; $tn = $cfg["file"]["base"]["webdir"] . $row["ffart"] . "/" . $row["fid"] . "/" . "tn/" . $row["ffname"]; } else { $img = $cfg["file"]["base"]["webdir"] . $cfg["file"]["base"]["pic"]["root"] . $cfg["file"]["base"]["pic"][$tag_param[1]] . "img_" . $row["fid"] . "." . $row["ffart"]; $tn = $cfg["file"]["base"]["webdir"] . $cfg["file"]["base"]["pic"]["root"] . $cfg["file"]["base"]["pic"]["tn"] . "tn_" . $row["fid"] . "." . $row["ffart"]; } $style = ""; if (!in_array($row["fid"], $tag_extra) && $tag_param[3] != "a") { if ($tag_param[4] == "l") { $style = " style=\"display:none;\""; } else { continue; } } if ($tag_param[4] == "l") { $changed = $img; $lb = "rel=\"lightbox[group_" . $selection_counter . "]\" "; } else { $changed = str_replace("#", $row["fid"], $link); $lb = ""; } if ($tag_param[3] == "" && $tag_param[4] == "l" && $file_counter == 1) { $tn1 = $img; continue; } $s = array("##link##", "##lb##", "##tn##", "##funder##", "##fdesc##", "##style##"); $r = array($changed, $lb, $tn, $row["funder"], $row["fdesc"], $style); $sel .= str_replace($s, $r, $defaults["tag"]["*sel"]); } if ($tag_param[3] == "" && $tag_param[4] == "l") { $ArrayReplace = array(count($files), " style=\"display:none\""); } else { $ArrayReplace = array(count($files), ""); } $sel .= str_replace(array("##count##", "##display##"), $ArrayReplace, $defaults["tag"]["/sel"]); if ($tag_param[3] == "") { if ($tag_param[4] == "l") { $sel = str_replace("##no_image##", "<a href=\"" . $tn1 . "\" " . $lb . ">", $sel); $sel = str_replace("##no_image_end##", "</a>", $sel); } else { $changed = str_replace("#", $files[0]["fid"], $link); $sel = "<a href=\"" . $changed . "\">" . $tag_value[1] . "</a>"; } } else { $sel = str_replace("##no_image##", "", $sel); $sel = str_replace("##no_image_end##", "", $sel); } $replace = str_replace($opentag . $tagoriginal . $closetag, $sel, $replace); } case "[/IN]": if ($defaults["tag"]["in"] == "") { $defaults["tag"]["in"] = "<em>"; $defaults["tag"]["/in"] = "</em>"; } $replace = str_replace($opentag . $tagoriginal . $closetag, $defaults["tag"]["in"] . $tagwert . $defaults["tag"]["/in"], $replace); case "[/M0]": if ($sign == "]") { $m0 = $ausgaben["M0"]; $replace = str_replace($opentag . $tagoriginal . $closetag, $m0, $replace); } else { $tagwerte = explode("]", $tagwert, 2); $m0werte = explode(";", $tagwerte[0]); if ($m0werte[0] == "l") { $m0 = $ausgaben["L0"]; } else { $m0 = $ausgaben["M0"]; } $replace = str_replace($opentag . $tagoriginal . $closetag, $m0, $replace); } break; case "[/M1]": if ($sign == "]") { if ($tagwert == "") { $label = " .. "; } else { $label = $tagwert; } if ($ausgaben["M1"] != "") { $trenner = $defaults["split"]["m1"]; } else { $trenner = ""; } $m1 = "<a class=\"menu_punkte\" href=\"" . $ausgaben["UP"] . "\">" . $label . "</a>" . $trenner . $ausgaben["M1"]; $replace = str_replace($opentag . $tagoriginal . $closetag, $m1, $replace); } else { $tagwerte = explode("]", $tagwert, 2); $m1werte = explode(";", $tagwerte[0]); if ($tagwerte[1] == "") { $label = " .. "; } else { $label = $tagwerte[1]; } if ($m1werte[0] == "l") { $m1 = ""; if ($m1werte[1] == "b") { $m1 = $defaults["split"]["l1"] . "<a class=\"menu_punkte\" href=\"" . $ausgaben["UP"] . "\">" . $label . "</a><br />"; } $m1 .= $ausgaben["L1"]; } else { $m1 = ""; if ($m1werte[1] == "b") { if ($ausgaben["M1"] != "") { $trenner = $defaults["split"]["m1"]; } else { $trenner = ""; } $m1 = "<a class=\"menu_punkte\" href=\"" . $ausgaben["UP"] . "\">" . $label . "</a>" . $trenner; } $m1 .= $ausgaben["M1"]; } $replace = str_replace($opentag . $tagoriginal . $closetag, $m1, $replace); } break; case "[/M2]": if ($sign == "]") { if ($tagwert == "") { $label = " .. "; } else { $label = $tagwert; } if ($ausgaben["M2"] != "") { $trenner = $defaults["split"]["m2"]; } else { $trenner = ""; } $m2 = "<a class=\"menu_punkte\" href=\"" . $ausgaben["UP"] . "\">" . $label . "</a>" . $trenner . $ausgaben["M2"]; $replace = str_replace($opentag . $tagoriginal . $closetag, $m2, $replace); } else { $tagwerte = explode("]", $tagwert, 2); $m2werte = explode(";", $tagwerte[0]); if ($tagwerte[1] == "") { $label = " .. "; } else { $label = $tagwerte[1]; } if ($m2werte[0] == "l") { $m2 = ""; if ($m2werte[1] == "b") { $m2 = $defaults["split"]["l2"] . "<a class=\"menu_punkte\" href=\"" . $ausgaben["UP"] . "\">" . $label . "</a><br />"; } $m2 .= $ausgaben["L2"]; } else { $m2 = ""; if ($m2werte[1] == "b") { if ($ausgaben["M2"] != "") { $trenner = $defaults["split"]["m2"]; } else { $trenner = ""; } $m2 = "<a class=\"menu_punkte\" href=\"" . $ausgaben["UP"] . "\">" . $label . "</a>" . $trenner; } $m2 .= $ausgaben["M2"]; } $replace = str_replace($opentag . $tagoriginal . $closetag, $m2, $replace); } break; case "[/M3]": $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgaben["M3"], $replace); break; case "[/UP]": if ($tagwert == "") { $label = " .. "; } else { $label = $tagwert; } $up = "<a class=\"menu_punkte\" href=\"" . $ausgaben["UP"] . "\">" . $label . "</a>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $up, $replace); break; case "[/PREV]": $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgaben["prev"], $replace); break; case "[/NEXT]": $replace = str_replace($opentag . $tagoriginal . $closetag, $ausgaben["next"], $replace); break; case "[/QUOTE]": $replace = str_replace($opentag . $tagoriginal . $closetag, """ . $tagwert . """, $replace); break; case "[/SP]": $replace = str_replace($opentag . $tagoriginal . $closetag, " ", $replace); break; case "[/BLOG]": if ($environment["ebene"] == "/wizard" && $environment["kategorie"] == "show") { $kat = tname2path($environment["parameter"][2]); } else { if ($environment["ebene"] == "") { $kat = "/" . $environment["kategorie"]; } else { $kat = $environment["ebene"] . "/" . $environment["kategorie"]; } } $tagwerte = explode("]", $tagwert, 2); $url = $tagwerte[0]; // erstellen der tags die angezeigt werden if (is_array($cfg["bloged"]["blogs"][$url]["tags"])) { foreach ($cfg["bloged"]["blogs"][$url]["tags"] as $key => $value) { $tags[$key] = $value; } } require_once $pathvars["moduleroot"] . "libraries/function_menu_convert.inc.php"; require_once $pathvars["moduleroot"] . "libraries/function_show_blog.inc.php"; if ($environment["parameter"][2] == "" || $environment["ebene"] == "/wizard") { $dataloop["list"] = show_blog($url, $tags, $cfg["auth"]["ghost"]["contented"], $cfg["bloged"]["blogs"][$url]["rows"], $kat); } else { $all = show_blog($url, $tags, $cfg["auth"]["ghost"]["contented"], $cfg["bloged"]["blogs"][$url]["rows"], $kat); unset($hidedata["new"]); $hidedata["all"]["inhalt"] = $all[1]["all"]; } if ($cfg["bloged"]["blogs"][$url]["category"] != "") { $replace = str_replace($opentag . $tagoriginal . $closetag, parser($mapping["main"], ""), $replace); } else { $replace = str_replace($opentag . $tagoriginal . $closetag, "not allowed", $replace); } break; case "[/OBJECT]": $tagwerte = explode("]", $tagwert, 2); $objectwerte = explode(";", $tagwerte[0]); $replace = str_replace($opentag . $tagoriginal . $closetag, "<object type=\"" . $objectwerte[3] . "\" data=\"" . $objectwerte[0] . "\" width=\"" . $objectwerte[1] . "\" height=\"" . $objectwerte[2] . "\">" . $tagwerte[1] . "</object>", $replace); break; case "[/PARAM]": $tagwerte = explode("]", $tagwert, 2); $replace = str_replace($opentag . $tagoriginal . $closetag, "<param name=\"" . $tagwerte[0] . "\" value=\"" . $tagwerte[1] . "\"></param>", $replace); break; case "[/YT]": $tagwerte = explode("]", $tagwert, 2); $ytwerte = explode(";", $tagwerte[0]); $yt = "<object width=\"" . $ytwerte[0] . "\" height=\"" . $ytwerte[1] . "\">\n <param name=\"movie\" value=\"http://www.youtube.com/v/" . $tagwerte[1] . "&hl=de_DE&fs=1&\"></param>\n <param name=\"allowFullScreen\" value=\"true\"></param>\n <param name=\"allowscriptaccess\" value=\"always\"></param>\n <embed src=\"http://www.youtube.com/v/" . $tagwerte[1] . "&hl=de_DE&fs=1&\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"" . $ytwerte[0] . "\" height=\"" . $ytwerte[1] . "\"></embed>\n </object>"; $replace = str_replace($opentag . $tagoriginal . $closetag, $yt, $replace); break; default: $extra_tag = str_replace(array("/", "]", "["), array("", "", ""), $closetag); if ($defaults["extra_tags"][$extra_tag] != "") { if (file_exists($pathvars["moduleroot"] . $defaults["extra_tags"][$extra_tag])) { include $pathvars["moduleroot"] . $defaults["extra_tags"][$extra_tag]; break; } } // unbekannte tags verstecken $replace = str_replace($closetag, "[##" . substr($closetag, 1), $replace); } } } // unbekannte tags wiederherstellen $replace = str_replace("[##/", "[/", $replace); return $replace; }
<?php include "init.php"; mysql_select_db("rpihockey"); $tid = $_GET["tid"]; $page = fopen("http://www.collegehockeynews.com/stats/team-overall.php?td={$tid}", "r"); $contents = stream_get_contents($page); $values = parser($contents); ?> <table><?php foreach ($values as $players) { echo update($players); } ?> </table><?php function update($player) { $names = explode(" ", $player[0][0], 2); $first = $names[0]; $last = $names[1]; if ($player[0][1] == "G" && $player[6] == 0) { return "<tr><td>{$first} {$last} is a goalie</td></tr>"; } $query = "SELECT * FROM players WHERE first='{$first}' AND last='{$last}'"; $result = mysql_query($query) or die("<b>YOU DID SOMETHING WRONG YOU IDIOT</b>.\n<br />Query: {$query}<br />\nError: (" . mysql_errno() . ") " . mysql_error()); $row = mysql_fetch_array($result); if ($row) { if ($player[0][1] == "G") { $query = "UPDATE players SET stype='hg', s1='{$player['1']}', s2='{$player['2']}', s3='{$player['3']}', s4='{$player['4']}', s5={$player['10']}, s6='{$player['7']}' WHERE first='{$first}' AND last='{$last}'"; } else { $query = "UPDATE players SET stype='hp', s1='{$player['1']}', s2='{$player['2']}', s3='{$player['3']}', s4='{$player['4']}', s5='{$player['6']}', s6='{$player['10']}' WHERE first='{$first}' AND last='{$last}'";
function makece($ce_formname, $ce_name, $ce_inhalt, $allowed_tags = array()) { global $debugging, $environment, $db, $cfg, $pathvars, $ausgaben, $specialvars, $defaults; // label fuer neue buttons fuellen $sql = "SELECT label, content\n FROM " . SITETEXT . "\n WHERE tname='-141347382.modify'\n AND lang='" . $environment["language"] . "'"; if ($debugging["html_enable"]) { $debugging["ausgabe"] .= "sql: " . $sql . $debugging["char"]; } $result = $db->query($sql); while ($data = $db->fetch_array($result)) { $label[$data["label"]] = $data["content"]; } $cms_old_mode = False; $tag_marken = explode(":", $environment["parameter"][4]); $ausgaben["njs"] = ""; foreach ($cfg["wizard"]["tags"] as $key => $value) { // feststellen, ob der tag erlaubt ist if (is_array($allowed_tags) && !in_array($key, $allowed_tags)) { continue; } if ($value[1] != "") { $k = " [KEY-" . $value[1] . "]"; } else { $k = ""; } if ($value[2] == False) { $s = "' + selText + '"; } else { $s = ""; } if ($value[3] != "") { $l = $value[3]; } else { $l = "]"; } if ($value[6] == "") { $keyX = $key; } else { $keyX = $value[6]; } if ($value[0] == "" && $cfg["wizard"]["debug"] == True) { $value[0] = "T"; } // position (T=top, B=bottom), access key, no select, links, rechts, disable // ebButtons[ebButtons.length] = new ebButton( // id used to name the toolbar button 'eb_h1' // key label on button ,'H1' // tit button title ,'�berschrift [Alt-1]' // position position (top, bot) ,'T' // access access key ,'1' // noSelect ,'-1' // tagStart open tag ,'[H1]' // tagMid mid tag ,'' // tagEnd close tag ,'[/H1]' // ); $ausgaben["njs"] .= "ebButtons[ebButtons.length] = new ebButton(\n"; $ausgaben["njs"] .= "'eb_" . $key . "'\n ,'" . strtoupper($key) . "'\n ,'" . $label[$key] . $k . "'\n ,'" . $value[0] . "'\n ,'" . $value[1] . "'\n ,'noSelect'\n ,'[" . strtoupper($keyX) . $l . "'\n ,'" . $value[4] . "'\n ,'" . $value[5] . "[/" . strtoupper($keyX) . "]'\n"; $ausgaben["njs"] .= ");\n"; } // script in seite parsen $ausgaben["ce_script"] = parser($cfg["wizard"]["tagjs"], ""); return $tn; }
<?php function parser($filename) { $handle = fopen($filename, 'r'); $main = fseek($handle, 520, SEEK_SET); $content = trim(fread($handle, filesize($filename))); $rawdataarray = explode("\n", $content); $totalunits = 0; $units = "Units | "; $fullname = "Full Name | "; $employeenumber = "Employee Number"; $report = ""; foreach ($rawdataarray as $innerdata) { $innerdataarray = explode(",", $innerdata); $totalunits += $innerdataarray[3]; arsort($innerdataarray); $report .= $innerdataarray[3] . " " . $innerdataarray[1] . $innerdataarray[2] . " " . $innerdataarray[0] . PHP_EOL; } $reporthead = $units . $fullname . $employeenumber . PHP_EOL; fclose($handle); $totalemployees = "Total number of employees: " . (count($rawdataarray) + 1) . PHP_EOL; $unitssold = "Total number of units sold: " . $totalunits . PHP_EOL; $averageunits = "Average number of units sold per employee: " . $totalunits / (count($rawdataarray) + 1) . PHP_EOL; return $totalemployees . $unitssold . $averageunits . $reporthead . $report; } echo parser('report.txt');
// воруем данные у информера Гисметео $xml = simplexml_load_file(rawurlencode($xmlurl)); // загружаем в переменную /* Выбираем нужные данные */ $cloudiness = $xml->REPORT->TOWN->FORECAST[0]->PHENOMENA->attributes()->cloudiness; $precipitation = $xml->REPORT->TOWN->FORECAST[0]->PHENOMENA->attributes()->precipitation; $rpower = $xml->REPORT->TOWN->FORECAST[0]->PHENOMENA->attributes()->rpower; $pressure = $xml->REPORT->TOWN->FORECAST[0]->PRESSURE->attributes()->max; $relwet = $xml->REPORT->TOWN->FORECAST[0]->RELWET->attributes()->max; $heat = $xml->REPORT->TOWN->FORECAST[0]->HEAT->attributes()->max; $wind = $xml->REPORT->TOWN->FORECAST[0]->WIND->attributes()->max; $tempws = parser($url, $start, $finish); // запуск парсера $tempws_s = parser($url, '<font size=4 color=#888888>', ' C</font>/'); // запуск парсера для юга $tempws_n = parser($url, '<font size=4 color=#BBBBBB>', ' C</font>)'); // запуск парсера для севера /* расчитываем время восхода и заказа */ $lat = 54.78278; // latitude: 54.78278 $lng = 32.04528; // longitude: 32.04528 $gmt = 3; // offset: +3 GMT $zen = ini_get("date.sunrise_zenith"); // zenith ~= 90, получаем из php $sunrise = date_sunrise(time(), SUNFUNCS_RET_STRING, $lat, $lng, $zen, $gmt); // расчет времени восхода солнца $sunset = date_sunset(time(), SUNFUNCS_RET_STRING, $lat, $lng, $zen, $gmt); // расчет времени захода солнца /* выводим данные в json */
case "kontakt": if ($environment["ebene"] == "" || strstr($environment["ebene"], "/aemter/")) { $sql = "SELECT " . $cfg["aemter"]["db"]["dst"]["email"] . "\n FROM " . $cfg["aemter"]["db"]["dst"]["entries"] . "\n WHERE " . $cfg["aemter"]["db"]["dst"]["akz"] . "='" . $environment["parameter"][1] . "'"; $result = $db->query($sql); $data = $db->fetch_array($result, 1); $hidedata["heading"]["heading"] = "#(kontakt)"; $environment["ebene"] = "/service"; $environment["kategorie"] = "kontakt"; include $pathvars["moduleroot"] . "addon/kontakt.cfg.php"; $cfg["kontakt"]["basis"] = "kontakt"; if ($cfg["aemter"]["email"] == -1) { $cfg["kontakt"]["email"]["owner"] = $data["ademail"]; } include $pathvars["moduleroot"] . "addon/kontakt-ctrl.inc.php"; $hidedata["kontakt"]["inhalt"] = "on"; $ausgaben["kontakt"] = parser("aemter-kontakt", ""); } break; case "va-aktuell": require_once $pathvars["moduleroot"] . "libraries/function_menu_convert.inc.php"; require $pathvars["moduleroot"] . "libraries/function_show_blog.inc.php"; unset($hidedata["aussenstelle"]); $tags["titel"] = "H1"; $tags["teaser"] = "P=teaser"; $tags["image"] = "IMG="; $tags["termine"] = "_NAME"; $hidedata["sub_menu"]["link"] = "aktuell.html"; if ($environment["parameter"][1] == "archiv") { $dataloop["artikel2"] = show_blog("/aktuell/archiv", $tags, "disabled", "", "/aemter/" . $amtid . "/index"); } elseif ($environment["parameter"][1] == "termine") { $dataloop["termine"] = show_blog("/aktuell/termine", $tags, "disabled", "", "/aemter/" . $amtid . "/index");
function tagreplace($replace) { global $pathvars, $environment, $ausgaben; // neues generelles tagreplace while (ereg("\\[[A-Z1-2]{1,6}(\\]|=)", $replace, $tag)) { $opentag = $tag[0]; if (strstr($replace, $opentag)) { // wo beginnt der tag $tagbeg = strpos($replace, $opentag); // wie sieht der endtag aus if (strstr($opentag, "=")) { $endtag = str_replace("=", "]", $opentag); $endtag = str_replace("[", "[/", $endtag); } else { $endtag = str_replace("[", "[/", $opentag); } // wo endet der tag $tagend = strpos($replace, $endtag); // wie lang ist der tag $taglen = (int) $tagend - $tagbeg; // wie lautet der tagwert $tagwertbeg = $tagbeg + strlen($opentag); $tagwertlen = $taglen - strlen($endtag) + 1; $tagwert = substr($replace, $tagwertbeg, $tagwertlen); // cariage return + linefeed fix $tagwert_nocrlf = str_replace("AB]\r\n", "AB]", $tagwert); $tagwert_nocrlf = str_replace("W]\r\n", "W]", $tagwert_nocrlf); $tagwert_nocrlf = str_replace("L]\r\n", "L]", $tagwert_nocrlf); $tagwert_nocrlf = str_replace("\r\n[", "[", $tagwert_nocrlf); #echo "<pre>"; #echo ">".$tagwert_nocrlf."<"; #echo "</pre>"; // offene tags abfangen #if ( strstr($tagwert, $opentag) || ( strstr($replace, $opentag) && $tagwert == "" ) ) { if (strstr($tagwert, $opentag) || $tagwertlen < 0) { $i++; $merk_es_dir["##{$i}##"] = $opentag; $ausgabewert = "<big><font color=\"#FF0000\">##{$i}## (close tag?) </font></big>"; $replace = str_replace($opentag, $ausgabewert, $replace); } // kompletten tag mit tagwert ersetzen switch ($opentag) { case "[B]": $replace = str_replace($opentag . $tagwert . $endtag, "<b>" . $tagwert . "</b>", $replace); break; case "[I]": $replace = str_replace($opentag . $tagwert . $endtag, "<i>" . $tagwert . "</i>", $replace); break; case "[TT]": $replace = str_replace($opentag . $tagwert . $endtag, "<tt>" . $tagwert . "</tt>", $replace); break; case "[U]": $replace = str_replace($opentag . $tagwert . $endtag, "<u>" . $tagwert . "</u>", $replace); break; case "[S]": $replace = str_replace($opentag . $tagwert . $endtag, "<s>" . $tagwert . "</s>", $replace); break; case "[ST]": $replace = str_replace($opentag . $tagwert . $endtag, "<strike>" . $tagwert . "</strike>", $replace); break; case "[BIG]": $replace = str_replace($opentag . $tagwert . $endtag, "<big>" . $tagwert . "</big>", $replace); break; case "[SMALL]": $replace = str_replace($opentag . $tagwert . $endtag, "<small>" . $tagwert . "</small>", $replace); break; case "[SUP]": $replace = str_replace($opentag . $tagwert . $endtag, "<sup>" . $tagwert . "</sup>", $replace); break; case "[SUB]": $replace = str_replace($opentag . $tagwert . $endtag, "<sub>" . $tagwert . "</sub>", $replace); break; case "[CENTER]": $replace = str_replace($opentag . $tagwert . $endtag, "<center>" . $tagwert . "</center>", $replace); break; case "[QUOTE]": $replace = str_replace($opentag . $tagwert . $endtag, """ . $tagwert . """, $replace); break; case "[CITE]": $replace = str_replace($opentag . $tagwert . $endtag, "<blockquote>" . $tagwert . "</blockquote>", $replace); break; case "[PRE]": $replace = str_replace($opentag . $tagwert . $endtag, "<pre>" . $tagwert . "</pre>", $replace); break; case "[BR]": $replace = str_replace($opentag . $tagwert . $endtag, "<br />", $replace); break; case "[LIST]": $tagwerte = explode("[*]", $tagwert); $ausgabewert = "<ul>"; while (list($key, $punkt) = each($tagwerte)) { $ausgabewert .= "<li>" . $punkt . "</li>"; } $ausgabewert .= "</ul>"; $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[LIST=": $tagrestbeg = strpos($tagwert, "]"); $listart = substr($tagwert, 0, $tagrestbeg); $tagrest = substr($tagwert, $tagrestbeg + 1); $tagwerte = explode("[*]", $tagrest); if ($listart == 1) { $ausgabewert = "<ol>"; while (list($key, $punkt) = each($tagwerte)) { $ausgabewert .= "<li>" . $punkt . "</li>"; } $ausgabewert .= "</ol>"; } elseif ($listart == "DEF") { $ausgabewert = "<dl>"; while (list($key, $punkt) = each($tagwerte)) { if ($key % 2 != 0) { $ausgabewert .= "<dd>" . $punkt . "</dd>"; } else { $ausgabewert .= "<dt>" . $punkt . "</dt>"; } } $ausgabewert .= "</dl>"; } else { if (strlen($listart) > 1) { $ausgabewert = "<ul type=\"" . $listart . "\">"; } else { $ausgabewert = "<ol type=\"" . $listart . "\">"; } while (list($key, $punkt) = each($tagwerte)) { $ausgabewert .= "<li>" . $punkt . "</li>"; } if (strlen($listart) > 1) { $ausgabewert .= "</ul>"; } else { $ausgabewert .= "</ol>"; } } $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[LINK]": $ausgabewert = "<a href=\"" . $tagwert . "\">" . $tagwert . "</a>"; $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[LINK=": $tagwerte = explode("]", $tagwert, 2); $pos = strrpos($tagwerte[0], ";"); if ($pos >= 1) { $target = substr($tagwerte[0], $pos + 1); $href = substr($tagwerte[0], 0, $pos); $target = " target=\"" . $target . "\""; } else { $target = ""; $href = $tagwerte[0]; } if ($tagwerte[1] == "") { $beschriftung = $href; } else { $beschriftung = $tagwerte[1]; } $ausgabewert = "<a href=\"" . $href . "\"" . $target . ">" . $beschriftung . "</a>"; $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[ANK]": $ausgabewert = "<a name=\"" . $tagwert . "\"></a>"; $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[ANK=": $tagwerte = explode("]", $tagwert, 2); $ausgabewert = "<a name=\"" . $tagwerte[0] . "\">" . $tagwerte[1] . "</a>"; $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[EMAIL]": $ausgabewert = "<a href=\"mailto:" . $tagwert . "\">" . $tagwert . "</a>"; $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[EMAIL=": $tagwerte = explode("]", $tagwert, 2); if ($tagwerte[1] == "") { $beschriftung = $tagwerte[0]; } else { $beschriftung = $tagwerte[1]; } $ausgabewert = "<a href=\"mailto:" . $tagwerte[0] . "\">" . $beschriftung . "</a>"; $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[IMG]": if (!strstr($tagwert, "/")) { $imgfile = $pathvars["fileroot"] . "images/" . $environment["design"] . "/" . $tagwert; if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; $imgurl = $pathvars["images"] . $tagwert; } } else { $imgurl = $tagwert; if (!strstr($tagwert, "http")) { if (strstr($tagwert[0], $pathvars["filebase"]["webdir"])) { $imgfile = str_replace($pathvars["filebase"]["webdir"], "", $tagwert); $imgfile = $pathvars["filebase"]["maindir"] . $imgfile; } else { $imgfile = $pathvars["fileroot"] . $tagwert; } if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; } } } $ausgabewert = "<img src=\"" . $imgurl . "\" alt=\"" . $tagwert . "\"" . $imgsize . ">"; $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[IMG=": $tagwerte = explode("]", $tagwert, 2); $imgwerte = explode(";", $tagwerte[0]); if ($imgwerte[1] == "r") { $align = " align=\"right\""; } elseif ($imgwerte[1] == "l") { $align = " align=\"left\""; } else { $align = ""; } if ($imgwerte[2] == "0") { $border = " border=\"0\""; } elseif ($imgwerte[2] > 0) { $border = " border=\"" . $imgwerte[2] . "\""; } else { $border = ""; } if ($tagwerte[1] == "") { $beschriftung = $imgwerte[0]; } else { $beschriftung = $tagwerte[1]; } if (!strstr($imgwerte[0], "/")) { $imgfile = $pathvars["fileroot"] . "images/" . $environment["design"] . "/" . $imgwerte[0]; if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; $imgurl = $pathvars["images"] . $imgwerte[0]; } } else { $imgurl = $imgwerte[0]; if (!strstr($imgwerte[0], "http")) { if (strstr($imgwerte[0], $pathvars["filebase"]["webdir"])) { $imgfile = str_replace($pathvars["filebase"]["webdir"], "", $imgwerte[0]); $imgfile = $pathvars["filebase"]["maindir"] . $imgfile; } else { $imgfile = $pathvars["fileroot"] . $imgwerte[0]; } if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; } } } $ausgabewert = "<img src=\"" . $imgurl . "\" alt=\"" . $beschriftung . "\"" . $align . $border . $imgsize . ">"; $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[IMGB=": $tagwerte = explode("]", $tagwert, 2); $imgwerte = explode(";", $tagwerte[0]); if ($imgwerte[1] == "r") { $ausgaben["align"] = " align=\"right\""; if ($imgwerte[5] == "") { $lspace = "10"; } else { $lspace = $imgwerte[5]; } $rspace = "0"; } elseif ($imgwerte[1] == "l") { $ausgaben["align"] = " align=\"left\""; $lspace = "0"; if ($imgwerte[5] == "") { $rspace = "10"; } else { $rspace = $imgwerte[5]; } } else { $ausgaben["align"] = ""; } if ($imgwerte[2] == "0") { $ausgaben["border"] = " border=\"0\""; } elseif ($imgwerte[2] > 0) { $ausgaben["border"] = " border=\"" . $imgwerte[2] . "\""; } else { $ausgaben["border"] = ""; } if ($imgwerte[3] == "") { $tspace = "0"; } else { $tspace = $imgwerte[3]; } if ($imgwerte[4] == "") { $bspace = "0"; } else { $bspace = $imgwerte[4]; } if ($tagwerte[1] == "") { $beschriftung = $imgwerte[0]; } else { $beschriftung = $tagwerte[1]; } if (!strstr($imgwerte[0], "/")) { $imgfile = $pathvars["fileroot"] . "images/" . $environment["design"] . "/" . $imgwerte[0]; if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; $ausgaben["imgurl"] = $pathvars["images"] . $imgwerte[0]; } } else { $ausgaben["imgurl"] = $imgwerte[0]; if (!strstr($imgwerte[0], "http")) { if (strstr($imgwerte[0], $pathvars["filebase"]["webdir"])) { $imgfile = str_replace($pathvars["filebase"]["webdir"], "", $imgwerte[0]); $imgfile = $pathvars["filebase"]["maindir"] . $imgfile; } else { $imgfile = $pathvars["fileroot"] . $imgwerte[0]; } if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $ausgaben["tabwidth"] = $imgsize[0]; $ausgaben["imgsize"] = " " . $imgsize[3]; } } } #$ausgabewert = "<img src=\"".$imgurl."\" alt=\"".$beschriftung."\"".$align.$border.$imgsize.">"; #$ausgaben["align"] = $align; #$ausgaben["imgurl"] = $imgurl; $ausgaben["alt"] = $beschriftung; $ausgaben["beschriftung"] = $beschriftung; $ausgaben["tspace"] = "<img src=\"" . $pathvars["images"] . "pos.png\" width=\"1\" height=\"" . $tspace . "\">"; $ausgaben["lspace"] = "<img src=\"" . $pathvars["images"] . "pos.png\" width=\"" . $lspace . "\" height=\"1\">"; $ausgaben["rspace"] = "<img src=\"" . $pathvars["images"] . "pos.png\" width=\"" . $rspace . "\" height=\"1\">"; $ausgaben["bspace"] = "<img src=\"" . $pathvars["images"] . "pos.png\" width=\"1\" height=\"" . $bspace . "\">"; $ausgabewert = str_replace(chr(13) . chr(10), "", parser("imgb", "")); $replace = str_replace($opentag . $tagwert . $endtag, $ausgabewert, $replace); break; case "[TAB]": $replace = str_replace($opentag . $tagwert . $endtag, "<table cellspacing=\"0\" cellpadding=\"1\">" . $tagwert_nocrlf . "</table>", $replace); break; case "[TAB=": $tagwerte = explode("]", $tagwert_nocrlf, 2); $tabwerte = explode(";", $tagwerte[0]); if ($tabwerte[0] == "l") { $align = " align=\"left\""; } elseif ($tabwerte[0] == "m") { $align = " align=\"center\""; } elseif ($tabwerte[0] == "r") { $align = " align=\"right\""; } else { $align = ""; } if ($tabwerte[1] != "") { $width = " width=\"" . $tabwerte[1] . "\""; } if ($tabwerte[2] != "") { $border = " border=\"" . $tabwerte[2] . "\""; } if ($tabwerte[3] != "") { $cellspacing = " cellspacing=\"" . $tabwerte[3] . "\""; } else { $cellspacing = " cellspacing=\"0\""; } if ($tabwerte[4] != "") { $cellpadding = " cellpadding=\"" . $tabwerte[4] . "\""; } else { $cellpadding = " cellpadding=\"1\""; } $replace = str_replace($opentag . $tagwert . $endtag, "<table" . $cellspacing . $cellpadding . $width . $align . $border . ">" . $tagwerte[1] . "</table>", $replace); break; case "[ROW]": $replace = str_replace($opentag . $tagwert . $endtag, "<tr>" . $tagwert_nocrlf . "</tr>", $replace); break; case "[COL]": $replace = str_replace($opentag . $tagwert . $endtag, "<td valign=\"top\">" . $tagwert_nocrlf . "</td>", $replace); break; case "[COL=": $tagwerte = explode("]", $tagwert_nocrlf, 2); $colwerte = explode(";", $tagwerte[0]); if ($colwerte[0] == "l") { $align = " align=\"left\""; } elseif ($colwerte[0] == "m") { $align = " align=\"center\""; } elseif ($colwerte[0] == "r") { $align = " align=\"right\""; } else { $align = ""; } if ($colwerte[1] != "") { $width = " width=\"" . $colwerte[1] . "\""; } $replace = str_replace($opentag . $tagwert . $endtag, "<td valign=\"top\"" . $align . $width . ">" . $tagwerte[1] . "</td>", $replace); break; case "[H1]": $replace = str_replace($opentag . $tagwert . $endtag, "<span class=\"id_top_head\">" . $tagwert . "</span>", $replace); break; case "[H2]": $imgfile = $pathvars["fileroot"] . "images/" . $environment["design"] . "/dot1.gif"; if (file_exists($imgfile)) { $imgsize = getimagesize($imgfile); $imgsize = " " . $imgsize[3]; $imgurl = $pathvars["images"] . "dot1.gif"; } $replace = str_replace($opentag . $tagwert . $endtag, "<img src=\"" . $imgurl . "\" alt=\"\"" . $imgsize . "> <span class=\"fkrcontentlead\">" . $tagwert . "</span>", $replace); break; case "[HL]": $imgfile = $pathvars["fileroot"] . "images/" . $environment["design"] . "/dot1.gif"; $replace = str_replace($opentag . $tagwert . $endtag, "<img src=\"" . $pathvars["images"] . "hl.png\" height=\"1\" width=\"628\" vspace=\"2\" alt=\"\">", $replace); break; case "[M1]": $replace = str_replace($opentag . $tagwert . $endtag, $ausgaben["M1"], $replace); break; case "[M2]": $replace = str_replace($opentag . $tagwert . $endtag, $ausgaben["M2"], $replace); break; default: #$ausgabewert = "\"illegal tag: ".strtolower($opentag)."\""; #$replace = str_replace($opentag,$ausgabewert,$replace); $i++; $ausgabewert = "##{$i}##"; $merk_es_dir["##{$i}##"] = $opentag; $replace = str_replace($opentag, $ausgabewert, $replace); } } } // gemerkte illegale tags wieder rein if (is_array($merk_es_dir)) { foreach ($merk_es_dir as $key => $value) { $replace = str_replace($key, $value, $replace); if ($debugging["html_enable"]) { $debugging["ausgabe"] .= "ersetze marke " . $key . " => " . $value . $debugging["char"]; } } } return $replace; }
$ground = $release[0]->supp_info_ground; $comment_block = $release[0]->comments; $details = ''; if (!is_null($eq) || !is_null($rain)) { if (!is_null($eq)) { $details = $eq . " "; } if (!is_null($rain)) { $details = $details . $rain . " "; } } if (!is_null($ground)) { $details = $details . $ground; } $details = parser($release[0]->internal_alert_level, $details, $comment_block, 0); $comments = parser($release[0]->internal_alert_level, $details, $comment_block, 1); $class_col = $comments != '' ? 'col-md-6' : 'col-md-12'; ?> <div class="row"> <div class="<?php echo $class_col; ?> "> <div class="panel panel-default"> <div class="panel-heading">Details </div> <div class="panel-body"><?php echo $details; ?> </div> </div>
// navigation erstellen $ausgaben["form_aktion"] = $cfg["wening"]["basis"] . "/list.html"; $ausgaben["link_new"] = $cfg["wening"]["basis"] . "/add.html"; // hidden values #$ausgaben["form_hidden"] .= ""; // was anzeigen $mapping["main"] = "wening-list"; if (priv_check($cfg["wening"]["basis"], $cfg["wening"]["right"])) { $hidedata["modus_edit"] = array(); } else { $hidedata["modus_view"] = array(); } #$mapping["navi"] = "leer"; // unzugaengliche #(marken) sichtbar machen if (isset($_GET["edit"])) { $ausgaben["inaccessible"] = "inaccessible values:<br />"; $ausgaben["inaccessible"] .= "# (error1) #(error1)<br />"; $ausgaben["inaccessible"] .= "# (edittitel) #(edittitel)<br />"; $ausgaben["inaccessible"] .= "# (deletetitel) #(deletetitel)<br />"; } else { $ausgaben["inaccessible"] = ""; } if ($_GET["ajax"] == "update") { echo parser("wening-list-ajax", ""); die; } // wohin schicken #n/a // +++ // page basics ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<pre> <?php // This file is just for checking that functions / ideas work independently //include("include.php"); //include("imagick_include.php"); //$result = stripDBFetch(dbFetchAll(5,"AwayTeamName")); // print_r($result); $page = fopen("tabular_data.txt", "r"); $contents = stream_get_contents($page); $result = parser($contents); foreach ($result as $img) { echo "<img src=\"http://rpiathletics.com/" . $img . "\" />{$img}<br>"; } function parser($data) { preg_match_all("/image_path=(.*jpg)/i", $data, $data2); foreach ($data2[1] as $line) { $num = preg_match_all("/\\/\\/([A-Za-z]*)_/", $line, $vals); print_r($vals); } return $data2[1]; } ?> /common/controls/image_handler.aspx?image_path=/images/2012/8/30//KyleMcGovern_23.jpg&thumb_prefix=rp_roster
break; default: $ausgaben["filemodify"] = "<a href=\"" . $cfg["basis"] . "/describe,edit.html\">Dateien editieren</a>"; $ausgaben["filedel"] = "<a href=\"" . $cfg["basis"] . "/list,delete.html\">ausgewählte Dateien löschen</a>"; } if ($HTTP_SESSION_VARS["return"]) { $ausgaben["send_image"] = "<a href=" . $HTTP_SESSION_VARS["return"] . "?referer=" . $HTTP_SESSION_VARS["referer"] . ">Zum Beitrag</a>"; } else { $ausgaben["send_image"] = ""; } if ($rechte["redaktion"] == -1) { #$neu = "<a href=\"".$cfg["basis"]."/".$cfg["ebene"]["zwei"]."/modify,add.html\">Neu</a>"; } else { #$neu = ""; } $ausgaben["output"] .= parser("-939795212.list-foot", ""); // was anzeigen #$mapping["main"] = "152366123.list"; $mapping["navi"] = "leer"; #if ( $debugging["html_enable"] ) $debugging["ausgabe"] .= "<font color=\"#FF0000\">ATTENTION: template overwrite -> ".$mapping["main"].".tem.html</font>".$debugging["char"]; // wohin schicken ? $ausgaben["form_aktion"] = $cfg["basis"] . "/list.html"; // upload auswahl #$ausgaben["upload"] .="<br>"; $ausgaben["upload"] .= "<form action=\"" . $cfg["basis"] . "/select.html\" method=\"get\" enctype=\"multipart/form-data\">"; $ausgaben["upload"] .= "<select class=\"dropdown\" name=\"anzahl\">"; $ausgaben["upload"] .= "<option value=\"1\">1 Datei</option>"; $ausgaben["upload"] .= "<option value=\"2\">2 Dateien</option>"; $ausgaben["upload"] .= "<option value=\"3\">3 Dateien</option>"; $ausgaben["upload"] .= "<option value=\"4\">4 Dateien</option>"; $ausgaben["upload"] .= "<option value=\"5\">5 Dateien</option>";
define('HESK_PATH', dirname(dirname(dirname(__FILE__))) . '/'); // Get required files and functions require HESK_PATH . 'hesk_settings.inc.php'; require HESK_PATH . 'inc/common.inc.php'; //============================================================================// // OPTIONAL MODIFICATIONS // //============================================================================// // Set category ID where new tickets will be submitted to $set_category = 1; // Set ticket priority of new tickets with the following options: // -1 = use default category priority // 0 = critical // 1 = high // 2 = medium // 3 = low $set_priority = -1; //============================================================================// // END OPTIONAL MODIFICATIONS // //============================================================================// // Is this feature enabled? if (empty($hesk_settings['email_piping'])) { die($hesklang['epd']); } // Email piping is enabled, get other required includes require HESK_PATH . 'inc/pipe_functions.inc.php'; // Parse the incoming email $results = parser(); // Convert email into a ticket (or new reply) hesk_dbConnect(); hesk_email2ticket($results, 0, $set_category, $set_priority); return NULL;
function menu_generate($refid = 0, $level = 1, $arrEbene = "", $url = "") { global $db, $cfg, $debugging, $environment, $pathvars, $rechte, $dataloop, $hidedata, $ausgaben; if ($cfg["menu"]["level" . $level]["enable"] == "-1") { $mandatory = " AND ((" . $cfg["menu"]["db"]["entries"] . ".mandatory)='-1')"; if ($cfg["menu"]["level" . $level]["full"] == "-1") { $mandatory = ""; } if ($cfg["menu"]["level" . $level]["extend"] == "-1") { $extenddesc = $cfg["menu"]["db"]["entries"] . "_lang.extend,"; } if ($arrEbene == "") { $ebene = $environment["ebene"] . "/" . $environment["kategorie"]; $arrEbene = explode("/", $ebene); $url = $pathvars["virtual"]; } $sql = "SELECT " . $cfg["menu"]["db"]["entries"] . ".mid," . $cfg["menu"]["db"]["entries"] . ".refid," . $cfg["menu"]["db"]["entries"] . ".entry," . $cfg["menu"]["db"]["entries"] . ".picture," . $cfg["menu"]["db"]["entries"] . ".level," . $cfg["menu"]["db"]["entries"] . "_lang.lang," . $cfg["menu"]["db"]["entries"] . "_lang.label," . $extenddesc . " " . $cfg["menu"]["db"]["entries"] . "_lang.exturl" . " FROM " . $cfg["menu"]["db"]["entries"] . " INNER JOIN " . $cfg["menu"]["db"]["entries"] . "_lang" . " ON " . $cfg["menu"]["db"]["entries"] . ".mid = " . $cfg["menu"]["db"]["entries"] . "_lang.mid" . " WHERE (" . "(" . $cfg["menu"]["db"]["entries"] . ".refid=" . $refid . ")" . " AND (" . $cfg["menu"]["db"]["entries"] . ".hide <> '-1' OR " . $cfg["menu"]["db"]["entries"] . ".hide IS NULL)" . " AND (" . $cfg["menu"]["db"]["entries"] . "_lang.lang='" . $environment["language"] . "')" . $mandatory . ")" . " ORDER BY sort, label;"; if ($cfg["menu"]["db"]["debug"]) { $debugging["ausgabe"] .= "level" . $level . "sql: " . $sql . $debugging["char"]; } $result = $db->query($sql); $buffer = ""; $menu2 = ""; while ($data = $db->fetch_array($result, 1)) { // berechtigung abfragen if ($data["level"] != "") { if (!priv_check(make_ebene($data["mid"]), $data["level"])) { continue; } } // link und ziel $aktiv = ""; if ($data["exturl"] == "") { $link = $url . "/" . $data["entry"] . ".html"; $target = ""; // eintrag aktiv? if ($data["entry"] == $arrEbene[1]) { $aktiv = "aktiv"; } else { $aktiv = ""; } } else { $link = $data["exturl"]; $target = $cfg["menu"]["level" . $level]["target"]; } // label,die boese schneide ab funktion $label = $data["label"]; if (strlen($data["label"]) > $cfg["menu"]["level" . $level]["length"]) { $label = substr($data["label"], 0, $cfg["menu"]["level" . $level]["length"] - 3) . "..."; } $titel = $data["label"]; if ($data["extend"] != "") { $titel = $data["extend"]; } // was wird wodurch ersetzt $marken = array("##target##", "##link##", "##title##", "##label##", "##picture##", "##extend##", "##aktiv##"); $ersatz = array($target, $link, $titel, $label, $data["picture"], $data["extend"], $aktiv); // version mit template if ($cfg["menu"]["generate"] == false) { if ($level != 1) { $ausgaben["punkte"] .= str_replace($marken, $ersatz, $cfg["menu"]["level" . $level]["link"]); } else { if ($data["entry"] == $arrEbene[1]) { // open folder $ausgaben["ordner"] = str_replace($marken, $ersatz, $cfg["menu"]["level1"]["icona"]); } else { // closed folder $ausgaben["ordner"] = str_replace($marken, $ersatz, $cfg["menu"]["level1"]["iconb"]); } } } // css-klasse und naechste ebene $class = "Level" . $level; $next_level = ""; if ($data["entry"] == $arrEbene[1]) { // css-klasse erzeugen $class = "Level" . $level . "Active"; // ebenen-array veraendern unset($arrEbene[1]); $arrEbene = array_values($arrEbene); $ausgaben["pagetitle"] = $data["label"]; if ($cfg["menu"]["level" . $level]["extend"] == "-1") { $ausgaben["extenddesc"] = $data["extend"]; } // naechste ebene abarbeiten $next_level = menu_generate($data["mid"], $level + 1, $arrEbene, $url . "/" . $data["entry"]); } $marken[] = "##class##"; $ersatz[] = $class; $marken[] = "##next_level##"; $ersatz[] = $next_level; // version mit template if ($cfg["menu"]["generate"] == false) { if ($level == 1) { $ausgaben["ueberschrift"] = str_replace($marken, $ersatz, $cfg["menu"]["level1"]["link"]); $menu2 .= parser($cfg["menu"]["name"], "", $parse_find, $parse_put); $ausgaben["punkte"] = ""; } } // dataloop und hideloop fuer die entsprechende Ebene wird gebaut $dataloop["level" . $level][] = array("link" => $link, "title" => $data["label"], "item" => $label, "class" => $class); $hidedata["level" . $level][0] = "enable"; // welcher link aufbau if ($cfg["menu"]["level1"]["link2"] == "") { $link_build = "link"; } else { if ($aktiv == "") { $link_build = "link1"; } else { $link_build = "link2"; } } // komplett $buffer .= str_replace($marken, $ersatz, $cfg["menu"]["level" . $level][$link_build]); } if ($cfg["menu"]["generate"] == true) { if ($buffer != "") { $menu2 = $cfg["menu"]["level" . $level]["on"] . $buffer . $cfg["menu"]["level" . $level]["off"]; } } return $menu2; } }
# modified for DStar-DD by Hans-J. Barthen DL5DI (20121020) # for ($i = 1; $i < 5; $i++) { $param = "repeaterBand" . $i; if (isset($configs[$param])) { $t1 = substr($configs[$param], 0, 2); if (substr($configs[$param], 1, 1) == "D") { require_once "dhcpfunctions.php"; //read leases file if (file_exists($dhcpd_leases_file) && is_readable($dhcpd_leases_file)) { $open_file = fopen($dhcpd_leases_file, "r") or die("Unable to open DHCP leases file."); if ($open_file) { //Create a 2-dimensional table for the dhcplease file $dhcptable = array(array()); //Call the dhcplease file parser $dhcptable = parser($open_file, $ddmode_log); ?> <p> <font size=+1><b>DHCP-Leases of DD-Modules</b></font> <table BORDER=0 BGCOLOR=white> <font size=-1> <tr bgcolor=black> <th width=80><a class=tooltip href="#"><font color=white><center><b>Callsign</b></center></font><span><b>Callsign of the DD-mode user</b></span></a></th> <th width=80><a class=tooltip href="#"><font color=white><center><b>IP Address</b></center></font><span><b>Dynamic IP address of the DD-Mode user</b></span></a></th> <th width=130><a class=tooltip href="#"><font color=white><center><b>Start Time (UTC)</b></center></font><span><b>Start time of DHCP lease</b>(UTC)</span></a></th> <th width=130><a class=tooltip href="#"><font color=white><center><b>End Time (UTC)</b></center></font><span><b>End time of DHCP Lease</b>Expire time of DHCP lease (UTC)</span></a></th> <th width=130><a class=tooltip href="#"><font color=white><center><b>MAC</b></center></font><span><b>MAC address of device</b>vendor information</span></a></th> <th width=80><a class=tooltip href="#"><font color=white><center><b>Lease State</b></center></font><span><b>State of DHCP Lease</b></span></a></th> </tr> <?php
#$aktion .= "<a href=\"".$cfg["basis"]."/".$cfg["ebene"]["zwei"]."/".$value[0].$name.",".$data[$cfg["db"]["key"]].".html\"><img src=\"".$imgpath.$name.".png\" border=\"0\" alt=\"".$value[1]."\" title=\"".$value[1]."\" width=\"24\" height=\"18\"></a>"; $aktion .= "<a href=\"" . $cfg["basis"] . "/" . $data["ibereich"] . $kat . "/" . $value[0] . $name . "," . $data[$cfg["db"]["key"]] . ".html\"><img src=\"" . $imgpath . $name . ".png\" border=\"0\" alt=\"" . $value[1] . "\" title=\"" . $value[1] . "\" width=\"24\" height=\"18\"></a>"; #} elseif ( $rechte["cms_admin"] == -1 && $name == "edit" ) { # $aktion .= "<a href=\"".$environment["basis"]."/".$value[0].$name.",".$field[$db_entries_key].".html\"><img src=\"".$imgpath."/".$name."a.gif\" border=\"0\" alt=\"".$value[1]."\" title=\"".$value[1]."\" width=\"24\" height=\"18\"></a>"; } else { $aktion .= "<img src=\"" . $imgpath . "/pos.png\" alt=\"\" width=\"24\" height=\"18\">"; } } $ausgaben["output"] .= parser("1943315524.list-row", ""); } // foot spulen #if ( $rechte[$cfg["right"]["red"]] == -1 ) { # $neu = "<a href=\"".$cfg["basis"]."/".$cfg["ebene"]["zwei"]."/modify,add.html\">Neu</a>"; #} else { # $neu = ""; #} $ausgaben["output"] .= parser("1943315524.list-foot", ""); // was anzeigen #$mapping["main"] = crc32($environment["ebene"]).".".$environment["name"]; #$mapping["main"] = crc32($environment["ebene"]).".list"; $mapping["main"] = "1943315524.list"; $mapping["navi"] = "leer"; if ($debugging["html_enable"]) { $debugging["ausgabe"] .= "<font color=\"#FF0000\">ATTENTION: template overwrite -> " . $mapping["main"] . ".tem.html</font>" . $debugging["char"]; } #[LINK=../protokoll.html]Protokolle[/LINK] $ausgaben["kopf1"] = "Info-Markt"; $ausgaben["kopf2"] = ucfirst($cfg["ebene"]["zwei"]); // wohin schicken ? # noch nirgens ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($gv_url != "") { $gv_bez = "<a href=\"" . $gv_url . "\">" . $gv_bez . "</a>"; } // aktionen erstellen $aktion = ""; foreach ($modify as $name => $value) { #$aktion .= "<a href=\"".$cfg["basis"]."/".$cfg["ebene"]["zwei"]."/".$value[0].$name.",".$data[$cfg["db"]["key"]].".html\"><img src=\"".$imgpath."/".$name.".png\" border=\"0\" alt=\"".$value[1]."\" title=\"".$value[1]."\" width=\"24\" height=\"18\"></a>"; if ($rechte[$value[2]] == -1 || $value[2] == "") { $aktion .= "<a href=\"" . $cfg["basis"] . "/" . $value[0] . $name . "," . $data[$cfg["db"]["key"]] . ".html\"><img src=\"" . $imgpath . "/" . $name . ".png\" border=\"0\" alt=\"" . $value[1] . "\" title=\"" . $value[1] . "\" width=\"24\" height=\"18\"></a>"; #} elseif ( $rechte["cms_admin"] == -1 && $name == "edit" ) { # $aktion .= "<a href=\"".$environment["basis"]."/".$value[0].$name.",".$field[$db_entries_key].".html\"><img src=\"".$imgpath."/".$name."a.png\" border=\"0\" alt=\"".$value[1]."\" title=\"".$value[1]."\" width=\"24\" height=\"18\"></a>"; } else { $aktion .= "<img src=\"" . $imgpath . "/pos.png\" alt=\"\" width=\"24\" height=\"18\">"; } } $ausgaben["output"] .= parser("-900193709.list-row", ""); } } // navigation erstellen if ($rechte[$cfg["right"]["adress"]] == -1) { $ausgaben["new"] = "<a href=\"" . $cfg["basis"] . "/modify,add.html\"><img src=\"" . $pathvars["images"] . "/button-gv-neu.png\" width=\"80\" height=\"18\" border=\"0\"></a>"; #$aktion .= "<a href=\"".$environment["basis"]."/".$value[0].$name.",".$field[$db_entries_key].".html\"><img src=\"".$imgpath."/".$name.".png\" border=\"0\" alt=\"".$value[1]."\" title=\"".$value[1]."\" width=\"24\" height=\"18\"></a>"; } else { $ausgaben["new"] = "<img src=\"" . $pathvars["images"] . "/pos.png\" width=\"80\" height=\"18\" border=\"0\">"; #$aktion .= "<img src=\"".$imgpath."/pos.png\" alt=\"\" width=\"24\" height=\"18\">"; } // was anzeigen $mapping["main"] = crc32($environment["ebene"]) . ".list"; $mapping["navi"] = "leer"; // wohin schicken #$ausgaben["print_url"] = "http://www.bvv.bayern.de";#$environment["ebene"];
$html = curl_exec($ch); echo $html; curl_close(); //See if we've found the course, and parse course name $course_name = parser("{$department} {$course_number} - ", "<"); if ($course_name != "") { $found = true; } else { $cur_sem -= 3; } } //Course Name output echo "DEPT - NUM: {$department} {$course_number}<br />\n"; echo "Course Name: {$course_name}\n"; // echo "<br />Description: $description"; echo "<br /><br /> Description: " . parser("<TD CLASS=\"ntdefault\">", "<"); function parser($start, $end) { global $html; $position = strpos($html, $start); $position += strlen($start); $parsed = false; $text = ""; while (!$parsed) { if ($html[$position] != $end) { $text .= $html[$position]; $position++; } else { $parsed = true; } }
<?php /** * @author Elynton Fellipe Bazzo * @author Andrei Siqueira */ require_once 'InputStream.php'; // Recebemos os parâmetros do usuário e removemos o nome do programa $args = $argv; array_shift($args); // Capturamos o tipo de entrada do programador $type = @$args[1] === '-f' ? InputStream::TYPE_FILE : InputStream::TYPE_TEXT; switch (@$args[0]) { case '-p': parser(); break; case '-l': lexer(); break; default: help(); } // Quando vier um comando inválido, mostramos a ajuda function help() { echo <<<END >>> Analisador de expressões aritméticas Escrito por Elynton F. Bazzo e Andrei Siqueira para a disciplina de compiladores. Uso:
} // hier erfolgt der mail-versand bzw db-eintrag if ($ausgaben["form_error"] == "") { if ($mail_order == -1) { if ($confirm == -1) { $cfg["autoform"]["captcha"]["letter_pot"] ? $put = $cfg["autoform"]["captcha"] : ($put["letter_pot"] = "abcde"); $hazard = crc32(captcha_randomize("43", $put)); $bestaetigungslink = "http://" . $_SERVER["HTTP_HOST"] . $environment["ebene"] . ".html?eintragen=" . $hazard; $message = parser($cfg["autoform"]["location"][$environment["ebene"]]["email"]["confirm_template"], ""); mail($_POST[$cfg["autoform"]["location"][$environment["ebene"]]["email"]["form_email_feld"]], "Confirm", $message); } else { foreach ($_POST as $key => $value) { ${$key} = $value; } $message1 = parser($cfg["autoform"]["location"][$environment["ebene"]]["email"]["template1"], ""); $message2 = parser($cfg["autoform"]["location"][$environment["ebene"]]["email"]["template2"], ""); mail_order($_POST, $cfg["autoform"]["location"][$environment["ebene"]]["email"]); } } if ($db_entry == -1) { $kick = array("PHPSESSID", "form_referer", "send", "last_viewed", "captcha", "captcha_proof"); foreach ($_POST as $name => $value) { if (!in_array($name, $kick) && !strstr($name, ")")) { // posts absichern if (!get_magic_quotes_gpc()) { $value = addslashes($value); } if ($sqla != "") { $sqla .= ", "; } if ($sqlb != "") {
$ausgaben["form_error"] .= "g(error_email)"; } if ($ausgaben["form_error"] != "") { $hidedata["error"] = array(); } if ($ausgaben["form_error"] == "") { $sqla = ""; $sqlb = ""; if (is_array($cfg["register"]["db"][$environment["kategorie"]]["addon"])) { foreach ($cfg["register"]["db"][$environment["kategorie"]]["addon"] as $value) { $sqla .= $value . ","; $sqlb .= "'" . $_POST[$value] . "',"; } } $message1 = parser($cfg["register"]["db"][$environment["kategorie"]]["email_anmelde"], ""); $message2 = parser($cfg["register"]["db"][$environment["kategorie"]]["email_abmelde"], ""); //pruefen ob email schon registriert if ($_POST["ac"] == "eintragen") { $sql = "SELECT * FROM " . $cfg["register"]["db"][$environment["kategorie"]]["entries"] . " WHERE " . $cfg["register"]["db"][$environment["kategorie"]]["e-mail"] . "='" . $_POST[$cfg["register"]["db"][$environment["kategorie"]]["e-mail"]] . "' AND confirm ='-1'"; $result = $db->query($sql); if ($db->num_rows($result) > 0) { header("Location: " . $cfg["register"]["db"][$environment["kategorie"]]["twice"]); exit; } $sql = "INSERT INTO " . $cfg["register"]["db"][$environment["kategorie"]]["entries"] . " (" . $sqla . "email,key,time) VALUES ( " . $sqlb . "'" . $_POST["email"] . "','" . $_POST["captcha_proof"] . "','" . mktime() . "')"; $result = $db->query($sql); mail($_POST[$cfg["register"]["db"][$environment["kategorie"]]["e-mail"]], $cfg["register"]["db"][$environment["kategorie"]]["email_subject1"], str_replace("###bestaetigungslink###", $cfg["register"]["domain"] . $environment["ebene"] . "/" . $environment["kategorie"] . ".html?eintragen=" . $_POST["captcha_proof"], $message1), "FROM: " . $cfg["register"]["from"] . "\r\nContent-Type: text/plain; charset=UTF-8\r\n"); header("Location: " . $cfg["register"]["db"][$environment["kategorie"]]["signin"]); } // pruefen ob man noch eingetragen ist if ($_POST["ac"] == "austragen") {
function test() { $results = parser(); print_r($results); exit; // from address and name echo "from :\n"; echo $results["from"][0]["address"] . "\n"; echo $results["from"][0]["name"] . "\n"; echo "\nto :\n"; foreach ($results["to"] as $to) { echo $to["address"] . "\n"; echo $to["name"] . "\n"; } echo "\nreply-to :\n"; foreach ($results["reply-to"] as $to) { echo $to["address"] . "\n"; echo $to["name"] . "\n"; } echo "\ncc :\n"; foreach ($results["cc"] as $to) { echo $to["address"] . "\n"; echo $to["name"] . "\n"; } echo "\nbcc :\n"; foreach ($results["bcc"] as $to) { echo $to["address"] . "\n"; echo $to["name"] . "\n"; } echo "\nsubject :\n"; echo $results["subject"] . "\n"; echo "\nmessage :\n"; echo $results["message"] . "\n"; echo "\nattachments :\n"; foreach ($results["attachments"] as $attach) { echo $attach["orig_name"] . "\n"; echo $attach["size"] . "\n"; echo $attach["stored_name"] . "\n"; echo $attach["type"] . "\n"; } }
// Authenticate if (($error = $pop3->Login($hesk_settings['pop3_user'], hesk_htmlspecialchars_decode($hesk_settings['pop3_password']))) == "") { echo $hesk_settings['debug_mode'] ? "<pre>User "" . $hesk_settings['pop3_user'] . "" logged in.</pre>\n" : ''; // Get number of messages and total size if (($error = $pop3->Statistics($messages, $size)) == "") { echo $hesk_settings['debug_mode'] ? "<pre>There are {$messages} messages in the mail box with a total of {$size} bytes.</pre>\n" : ''; // If we have any messages, process them if ($messages > 0) { // Connect to the database hesk_dbConnect(); for ($message = 1; $message <= $messages; $message++) { echo $hesk_settings['debug_mode'] ? "<pre>Parsing message {$message} of {$messages}.</pre>\n" : ''; $pop3->GetConnectionName($connection_name); $message_file = 'pop3://' . $connection_name . '/' . $message; // Parse the incoming email $results = parser($message_file); // Convert email into a ticket (or new reply) if ($id = hesk_email2ticket($results, 1, $set_category, $set_priority)) { echo $hesk_settings['debug_mode'] ? "<pre>Ticket {$id} created/updated.</pre>\n" : ''; } else { echo $hesk_settings['debug_mode'] ? "<pre>Ticket NOT inserted - may be duplicate, blocked or an error.</pre>\n" : ''; } // Queue message to be deleted on connection close if (!$hesk_settings['pop3_keep']) { $pop3->DeleteMessage($message); } echo $hesk_settings['debug_mode'] ? "<br /><br />\n\n" : ''; } } // Disconnect from the server - this also deletes queued messages if ($error == "" && ($error = $pop3->Close()) == "") {
unlink($captcha_path_srv . "captcha-" . $_POST["captcha_proof"] . ".png"); } } // evtl. zusaetzliche datensatz anlegen if ($ausgaben["form_error"] == "") { // kunde if ($HTTP_POST_VARS[$cfg["kontakt"]["email"]["form_email_feld"]] == "") { $email_adresse = $cfg["kontakt"]["email"]["robot"]; } else { $email_adresse = str_replace(",", "", $HTTP_POST_VARS[$cfg["kontakt"]["email"]["form_name_feld"]]) . " <" . $HTTP_POST_VARS[$cfg["kontakt"]["email"]["form_email_feld"]] . ">"; } foreach ($HTTP_POST_VARS as $key => $value) { ${$key} = $value; } $message1 = parser($cfg["kontakt"]["email"]["template1"], ""); $message2 = parser($cfg["kontakt"]["email"]["template2"], ""); // happy bouncing #ini_set("sendmail_from",$cfg["kontakt"]["email"]["robot"]); #if ( $debugging["html_enable"] ) $debugging["ausgabe"] .= "sendmail_from = ".ini_get('sendmail_from').$debugging["char // mail an betreiber $subject1 = $cfg["kontakt"]["email"]["subj1"]; if (is_array($cfg["kontakt"]["email"]["repl1"])) { foreach ($cfg["kontakt"]["email"]["repl1"] as $value) { $subject1 = str_replace("!{" . $value . "}", ${$value}, $subject1); } } if ($_POST["betreff"] != "") { $subject1 .= ": " . $_POST["betreff"]; } $header1 = "From: " . $cfg["kontakt"]["email"]["robot"] . "\r\n"; $header1 .= "Reply-To: " . $email_adresse . "\r\n";
function iteration($depth, $url, $url_str, $keyword, $site, $str_query, $delay, $positionDB, $positionDbOld, $urlDB, $firstSeaching) { global $depthNF; // if (ceil($depth / 2) < $depthNF) { // $depthNF = ceil($depth / 2); // } $positionDB = ceil($positionDB / 10); $positionDbOld = ceil($positionDbOld / 10); if ($firstSeaching || $depth < $positionDB || $positionDB == 1 || $urlDB == NULL && $positionDbOld == 1 || $urlDB == NULL && $positionDbOld && $depth < $positionDbOld) { //если сайт еще не искалася | глубина поиска меньше позиции из базы | результат на первой странице // | при прошлом поиске результат был на первой странице | Сайт когда-то был найден и глубина поиска меньше позиции из базы //seacherPosition() не учитывает случая отсутствия на первой странице искомого сайта, если positionDB==1 for ($i = 0; $i < $depth; $i++) { $response = parser($url, $url_str, $site, $str_query); if ($response[0] == 'statistic') { $position = $i * 10 + $response[1]; $data = array($position, $response[2], $response[3], $keyword); return $data; } else { $j = $i + 2; if ($response == 0) { //Если результаты на одной странице и совпадений нет $data = array("Relevant page not found in Google", $site, $keyword); return $data; } $last_key = array_pop(array_keys($response)); if ($last_key < $j) { $data = array("Relevant page not found in Google", $site, $keyword); return $data; } $url_str = str_replace("&", "&", $response[$j]); if ($i == $depth - 1) { $dep = $depth * 10; //$dep=$depth; $data = array("not found in {$dep}", $site, $keyword); return $data; } else { sleep($delay[0] + rand(0, $delay[1])); } } } } elseif ($urlDB == null) { //при прошлом поиске сайт не был найден if ($positionDbOld) { //когда-то был наден $data = seacherPosition($url, $url_str, $str_query, $site, $keyword, $positionDbOld, $delay, $depth, $last_key); } else { //ниразу не был найден $data = seacherPosition($url, $url_str, $str_query, $site, $keyword, $depth, $delay, $depth, $last_key); } if (count($data) == 3 && $data[2] == $keyword) { return $data; } elseif (count($data) == 4 && $data[3] == $keyword) { return $data; } else { //нашли страницу выдачи с необходимой позицией, теперь ищем сайт if ($positionDbOld) { $positionDB = $positionDbOld; } else { $positionDB = $depth; } $response = $data; //если в seacherPosition() насткнулись на конечную страницу раньше чем нашли необходимую $last_key = array_pop(array_keys($response)); if ($last_key < $positionDB) { $data = seacherPositionDown($url, $str_query, $site, $keyword, $response, $depth, $delay); return $data; } //---------------------------------------------------------------------------------------- $url_str = str_replace("&", "&", $response[$positionDB]); $key = array($positionDB, $positionDB); $href = array(); // $href[0] = $response; // $href[1] = $response; $index = 1; for ($i = 0; $i < $depthNF * 2; $i++) { if ($i % 2 == 0) { $d = 1; } else { $d = -1; } if ($d > 0 && $key[0] > $depth || $d < 0 && $key[1] <= 1) { continue; } sleep($delay[0] + rand(0, $delay[1])); $response = parser($url, $url_str, $site, $str_query); if ($response[0] == 'statistic') { if ($index > 0) { $position = ($key[0] - 1) * 10 + $response[1]; } if ($index < 0) { $position = ($key[1] - 1) * 10 + $response[1]; } //Ввели $index. response получается с предыдущего $d. $data = array($position, $response[2], $response[3], $keyword); return $data; } if ($i == 0) { $href[0] = $response; $href[1] = $response; //google выкидывает повторяющиеся результаты (последние страницы) // поэтому возьмем ключи на страницы у него и если last_key < глубины поиска // то задействуем seacherPositionDown() $last_key = array_pop(array_keys($response)); if ($last_key < $positionDB) { $data = seacherPositionDown($url, $str_query, $site, $keyword, $response, $depth); return $data; } } if ($index > 0) { $href[0] = $response; } if ($index < 0) { $href[1] = $response; } if ($response == 0) { //Если результаты на одной странице и совпадений нет $data = array("Relevant page not found in Google", $site, $keyword); return $data; } else { if ($d > 0 && $key[0] < $depth) { $key[0]++; $index = $d; if ($href[0][$key[0]]) { $url_str = str_replace("&", "&", $href[0][$key[0]]); } else { //меняем и пропускаем итерацию если подошли к конечной странице выдачи $key[1]--; $index = -$d; $url_str = str_replace("&", "&", $href[1][$key[1]]); continue; } } elseif ($d > 0 && $key[0] == $depth) { //без этого повторяется ход $key[1]--; $key[0]++; $index = $d; $url_str = str_replace("&", "&", $href[1][$key[1]]); } if ($d < 0 && $key[1] > 1) { $key[1]--; $index = $d; $url_str = str_replace("&", "&", $href[1][$key[1]]); } if ($key[1] <= 1 && $key[0] >= $depth) { $dep = $depth * 10; //$dep=$depth; $data = array("not found in {$dep}", $site, $keyword); return $data; } } } //Если результаты не найдены в $depthNf $data = array("not found in {$depthNf}", $site, $keyword); return $data; } } else { //При прошлом поиске был найден, кроме $positionDB == 1 //-----------------------Поиск страницы по позиции сайта из базы---------------- $data = seacherPosition($url, $url_str, $str_query, $site, $keyword, $positionDB, $delay, $depth, $last_key); //------------------------------------------------------------------------------------ if (count($data) == 3 && $data[2] == $keyword) { return $data; } elseif (count($data) == 4 && $data[3] == $keyword) { return $data; } else { //нашли страницу с необходимой позицией, теперь ищем сайт $response = $data; //если в seacherPosition() насткнулись на конечную страницу раньше чем нашли необходимую $last_key = array_pop(array_keys($response)); if ($last_key < $positionDB) { $data = seacherPositionDown($url, $str_query, $site, $keyword, $response, $depth, $delay); return $data; } //---------------------------------------------------------------------------------------- $url_str = str_replace("&", "&", $response[$positionDB]); $key = array($positionDB, $positionDB); $href = array(); // $href[0] = $response; // $href[1] = $response; $index = 1; for ($i = 0; $i < $depth * 2; $i++) { // print_r($key); if ($i % 2 == 0) { $d = 1; } else { $d = -1; } if ($d > 0 && $key[0] > $depth || $d < 0 && $key[1] <= 1) { continue; } sleep($delay[0] + rand(0, $delay[1])); $response = parser($url, $url_str, $site, $str_query); if ($response[0] == 'statistic') { if ($index > 0) { $position = ($key[0] - 1) * 10 + $response[1]; } if ($index < 0) { $position = ($key[1] - 1) * 10 + $response[1]; } //Ввели $index. response получается с предыдущего $d. $data = array($position, $response[2], $response[3], $keyword); return $data; } if ($i == 0) { $href[0] = $response; $href[1] = $response; //google выкидывает повторяющиеся результаты (последние страницы) // поэтому возьмем ключи на страницы у него и если last_key < глубины поиска // то задействуем seacherPositionDown() $last_key = array_pop(array_keys($response)); if ($last_key < $positionDB) { $data = seacherPositionDown($url, $str_query, $site, $keyword, $response, $depth, $delay); return $data; } } if ($index > 0) { $href[0] = $response; } if ($index < 0) { $href[1] = $response; } if ($response == 0) { //Если результаты на одной странице и совпадений нет $data = array("Relevant page not found in Google", $site, $keyword); return $data; } else { if ($d > 0 && $key[0] < $depth) { $key[0]++; $index = $d; if ($href[0][$key[0]]) { $url_str = str_replace("&", "&", $href[0][$key[0]]); } else { //меняем и пропускаем итерацию если подошли к конечной странице выдачи $key[1]--; $index = -$d; $url_str = str_replace("&", "&", $href[1][$key[1]]); continue; } } elseif ($d > 0 && $key[0] == $depth) { //без этого повторяется ход $key[1]--; $key[0]++; $index = $d; $url_str = str_replace("&", "&", $href[1][$key[1]]); } if ($d < 0 && $key[1] > 1) { $key[1]--; $index = $d; $url_str = str_replace("&", "&", $href[1][$key[1]]); } if ($key[1] <= 1 && $key[0] >= $depth) { $dep = $depth * 10; //$dep=$depth; $data = array("not found in {$dep}", $site, $keyword); return $data; } } } } } }