3c3
< // Create table of information about filespec or report about dead links
---
> // Create table of information about filespec
7d6
< $fsev = ' document.getElementById("files").addEventListener("change", handleFileSelect, false); ';
9,55d7
< $mode = "Read bytes";
< $title = "File Information Table";
< $deadlinks = "";
< $snapshot = "";
< $myfe = "myf=";
< $flh = "";
< $omyh1stuff = "";
< $fnameis = "";
< $lnameis = "";
< $pnameis = "";
< $undefined = " ";
< $urlsuffix = "";
< $urllist = "";
< $statuslist = "";
< $linelist = "";
< $collist = "";
<
< if (isset($_GET['myf'])) {
< $huhis = explode("strong>", $_GET['myf']);
< if (sizeof($huhis) >= 3) $undefined = str_replace("", " ", " " . $huhis[1]);
< } else if (isset($_POST['myf'])) {
< if ($_POST['myf'] != "") $undefined = " " . $_POST['myf'] . " ";
< }
<
< if (isset($_GET['deadlinks'])) {
< $urlsuffix = "?deadlinks=" . urlencode(urldecode($_GET['deadlinks']));
< $omyh1stuff = " mh(); "; //" if (omyh1.innerHTML.indexOf(' Please wait ') == -1) { omyh1.innerHTML = omyh1.innerHTML + ' ... Please wait while we analyze your URLs ... '; } ";
< $title = "Dead Links via File of Absolute URLs Report";
< $deadlinks = "y";
< $myfe = "deadlinks=Report%20list%20of%20dead%20links%20of%20file%20of%20URLs&myf=";
< if ($_GET['deadlinks'] == "") {
< $mode = "Report list of dead links of file of Absolute URLs";
< } else {
< $mode = urldecode($_GET['deadlinks']);
< }
< } else if (isset($_POST['deadlinks'])) {
< $urlsuffix = "?deadlinks=" . urlencode(urldecode($_POST['deadlinks']));
< $omyh1stuff = " mh(); "; //" if (omyh1.innerHTML.indexOf(' Please wait ') == -1) { omyh1.innerHTML = omyh1.innerHTML + ' ... Please wait while we analyze your URLs ... '; } ";
< $title = "Dead Links via File of Absolute URLs Report";
< $deadlinks = "y";
< $myfe = "deadlinks=Report%20list%20of%20dead%20links%20of%20file%20of%20URLs&myf=";
< if ($_POST['deadlinks'] == "") {
< $mode = "Report list of dead links of file of Absolute URLs";
< } else {
< $mode = urldecode($_POST['deadlinks']);
< }
< }
59,62d10
< global $fnameis;
< global $lnameis;
< global $pnameis;
< global $flh;
64,85c12,14
< $url = urldecode($url);
< if (strpos($url, "https:") !== false || strpos($url, "HTTPS:") !== false || strpos($url, "http:") !== false || strpos($url, "HTTP:") !== false) {
< if (strpos(substr(trim($url), 8), "/") === false) $url = trim($url) . "/";
< $wordsare = explode("/", $url);
< if ($wordsare[sizeof($wordsare) - 1] != "") {
< if (strpos($wordsare[sizeof($wordsare) - 1], ".") === false && strpos($wordsare[sizeof($wordsare) - 1], "?") === false && strpos($wordsare[sizeof($wordsare) - 1], "&") === false) {
< $url = trim($url) . "/";
< }
< }
< //if (!$fp = curl_init($url)) return false;
< //curl_close($fp);
< //return true;
< $curl = curl_init(); // thanks to http://stackoverflow.com/questions/7852005/how-to-check-if-a-url-exists-with-php-and-make-it-time-out-after-a-number-of-sec
< curl_setopt($curl, CURLOPT_URL, trim($url));
< curl_setopt($curl, CURLOPT_HEADER, true);
< curl_setopt($curl, CURLOPT_TIMEOUT, 10);
< curl_setopt($curl, CURLOPT_NOBODY, true);
< curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
< $data = curl_exec($curl);
< curl_close($curl);
< preg_match("/HTTP\/1\.[1|0]\s(\d{3})/",$data,$matches);
< return ($matches[1] == 200);
---
> if (strpos($url, "https:") !== false || strpos($url, "HTTPS:") !== false) {
> if (!$fp = curl_init($url)) return false;
> return true;
89d17
< $flh = $file_headers[0];
101,281d28
< function echop($ine) {
< global $fnameis;
< global $lnameis;
< global $pnameis;
< echo "
" . $ine . "
";
< }
<
< function prelook($xinfl) {
< global $fnameis;
< global $lnameis;
< global $pnameis;
< global $undefined;
< $outinfl = $xinfl;
< $fnameis = "";
< if (strpos($xinfl, "http(") !== false || strpos($xinfl, "HTTP(") !== false) {
< $zxinfl = explode(")", substr($xinfl, 5));
< $hbit = "(" . $zxinfl[0] . ")";
< $outinfl = str_replace($hbit, "", $outinfl);
< $fnameis = str_replace(" undefined ", $undefined, str_replace("(", " in ", str_replace(")", "", str_replace(":", " on line ", str_replace("@", " at column ", $hbit)))));
< }
< return $outinfl;
< }
<
< function pluck($sdelim, $pstr, $bstr, $edelim, $ourln, $ourcp) {
< global $urllist, $statuslist, $linelist, $collist, $fnameis;
<
< if ($sdelim == "") {
< $preturl = explode($edelim, $bstr);
< $turl = explode("<", $preturl[0]);
< } else {
< $preturl = explode($sdelim, $bstr);
< $turl = explode("<", $preturl[0]);
< }
< $endl = "";
< if (strpos(substr(trim($pstr . $turl[0]), 8), "/") === false) $turl[0] = trim($turl[0]) . "/";
< $urllist .= $pstr . $turl[0] . "
";
< if (url_exists($pstr . $turl[0])) {
< $statuslist .= "exists
";
< } else {
< $statuslist .= "does not exist
";
< }
< $linelist .= $ourln . "
";
< $collist .= $ourcp . "
";
< return $pstr . "(" . $fnameis . ":" . $ourln . "@" . $ourcp . ")" . $turl[0] . $edelim;
< }
<
< function makeintolist($inst) { // via web server filelist via glob
< global $urllist, $statuslist, $linelist, $collist, $fnameis, $urlsuffix;
<
< $urlbit = "";
< $outst = $inst;
< $interimst = $inst;
< $interimst = explode("\n", $inst);
<
< if (sizeof($interimst) > 0) $outst = "";
<
< for ($ik=0; $ik";
< if (strpos($infl, "@!~*^@") !== false) {
< if (strpos($infl, "@!~*^@") < 80) {
< $spl = explode("@!~*^@", $infl);
< $infl = $spl[1];
< $fnameis = $spl[0];
< }
< }
< if ($fnameis != "" || (strpos(("*" . $infl), "*http") === false && strpos(("*" . $infl), "*HTTP") === false)) {
< $urls = explode("\n", makeintolist($infl));
< $fnameis = "";
< if ($urlsuffix != "") $ourfl = "";
< }
< if ($urlsuffix == "") {
< $urls = explode("\n", $infl);
< for ($ij=0; $ij exists" . $fnameis . $lnameis . $pnameis . ".";
< } else {
< $outfl .= "| " . $urls[$ij] . $endl . " does not exist" . $fnameis . $lnameis . $pnameis . ". |
";
< }
< $flh = "";
< }
< }
< $outfl .= "";
< }
< return $outfl;
< }
<
< function on_to($on, $to) {
< global $fnameis;
< global $lnameis;
< global $pnameis;
< if (url_exists(urldecode($on))) {
< if ($to == "") {
< echop(urldecode($on) . " exists" . $fnameis . $lnameis . $pnameis . ".\n");
< } else {
< file_put_contents($to, file_get_contents($to) . urldecode($on) . " exists" . $fnameis . $lnameis . $pnameis . ".\n");
< }
< exit;
< } else {
< if ($to == "") {
< echop(urldecode($on) . " does not exist" . $fnameis . $lnameis . $pnameis . ".\n");
< } else {
< file_put_contents($to, file_get_contents($to) . urldecode($on) . " does not exist" . $fnameis . $lnameis . $pnameis . ".\n");
< }
< exit;
< }
< }
<
< $outrep = "";
< if (isset($_GET['justreportto'])) {
< $outrep = urldecode($_GET['justreportto']);
< if (strpos($outrep, "/") === false && strpos($outrep, "\\") === false) {
< $outrep = dirname(__FILE__) . "/" . $outrep;
< }
< } else if (isset($_POST['justreportto'])) {
< $outrep = urldecode($_POST['justreportto']);
< if (strpos($outrep, "/") === false && strpos($outrep, "\\") === false) {
< $outrep = dirname(__FILE__) . "/" . $outrep;
< }
< }
<
< if (isset($_GET['justreporton'])) {
< on_to(urldecode($_GET['justreporton']), $outrep);
< exit;
< } else if (isset($_POST['justreporton'])) {
< on_to(urldecode($_POST['justreporton']), $outrep);
< exit;
< } else {
<
288c35
< } else if ($deadlinks == "") {
---
> } else {
291,293d37
< } else {
< $fsp = "index";
< $ext = ".html";
314,315d57
< } else if ($deadlinks == "") {
< $dir = '/'; // '/Library/pgAgent/Downloads/CRL/';
317c59
< $dir = 'http://';
---
> $dir = '/Library/pgAgent/Downloads/CRL/';
321c63
< $outhtml = "\n" . $title . "\n";
---
> $outhtml = "\nFile Information Table\n";
325d66
< var omyh1;
328d68
< var bigj=0;
332,342d71
< var bigbuffer="";
< var prevmy_res="";
< var bigf=new Array();
< var urlsuf="' . $urlsuffix . '";
<
< function mh() { omyh1=document.getElementById("myh1"); if (urlsuf != "" && omyh1.innerHTML.indexOf(" Please wait ") == -1) { omyh1.innerHTML = omyh1.innerHTML + " ... Please wait while we analyze your URLs ... "; } }
<
< function dlbclick() {
< //alert(document.getElementById("flist").value);
< document.getElementById("dlb").click();
< }
365,368d93
< omyh1 = document.getElementById("myh1");
<
< ' . $omyh1stuff . '
<
397d121
< omyh1 = document.getElementById("myh1");
416c140
< ' . $fsev . '
---
> document.getElementById("files").addEventListener("change", handleFileSelect, false);
420d143
<
422d144
< if (infilecontents != null) {
424,445c146,148
< var ourlines = infilecontents.split(String.fromCharCode(10));
< ';
< if ($deadlinks != "") {
< $outhtml .= '
< if (1 == 1) {
< document.getElementById("flist").value = document.getElementById("flist").value + justhttp(ourlines);
< document.getElementById("dlb").click();
< } else {
< for (var jj=0; jj location.href = huh[0] + "?myf=" + decodeURIComponent(myfis);
451c154
< location.href = document.URL + "?' . $myfe . '" + decodeURIComponent(myfis);
---
> location.href = document.URL + "?myf=" + decodeURIComponent(myfis);
453,457c156
< fcont = infilecontents;
< ';
< }
< $outhtml .= '
< }
---
> fcont = infilecontents;
460,524d158
< function nocaret(iinf, lno, jpos, inc) {
< var noinc = inc.split("<");
< if (jpos > 0) return noinc[0].replace("http", "http(" + iinf + ":" + lno + "@" + jpos + ")").replace("HTTP", "HTTP(" + iinf + ":" + lno + "@" + jpos + ")");
< return noinc[0].replace("http", "http(" + iinf + ":" + lno + ")").replace("HTTP", "HTTP(" + iinf + ":" + lno + ")");
< }
<
< function justhttps(instr, ininfo) {
< //document.title = ininfo;
< if (bigf[bigj] == null || bigf[bigj] == undefined) {
< bigf[bigj] = document.getElementById("file").value;
< }
< return justhttp(instr.split(String.fromCharCode(eval(0 + 10))), bigf[bigj]); // ininfo);
< }
<
< function justhttp(inarr, ininf) {
< var outst = "", arec = "", ipos = 0, httparr, ijkh, otherarr, endl = "", qpos = 0;
< bigj = bigj + 1;
< //alert(ininf);
< for (var iq=0; iq 1) {
< while (arec.indexOf("http") > 1) {
< qpos = eval(1 + arec.indexOf("http"));
< httparr = arec.split("http");
< for (ijkh=1; ijkh 1) {
< while (arec.indexOf("HTTP") > 1) {
< qpos = eval(1 + arec.indexOf("HTTP"));
< httparr = arec.split("HTTP");
< for (ijkh=1; ijkhTable", str_replace("Report", "Report", $title)) . "";
< $outhtml .= '';
< //$snapshot = $outhtml . "Please wait while we analyze your URLs ...
";
< //echo $snapshot;
< //$snapshot = " " . readandprocess($_POST['flist']) . "
";
< $outhtml .= "Please wait while we analyze your URLs ...
";
< $outhtml .= " " . readandprocess($_POST['flist']) . "
";
< } else {
< $outhtml .= "" . str_replace("Table", "Table", str_replace("Report", "Report", $title)) . "
";
< $outhtml .= '';
< //$snapshot = $outhtml;
< }
< $outhtml .= "