= 1) { // PHP command line $filespec="COMM.MIL*.xml"; $startfind="
= 2) $filespec=yoururldecode($argv[1]); if ($argc >= 3) $startfind=yoururldecode($argv[2]); if ($argc >= 4) $findthis=yoururldecode($argv[3]); if ($argc >= 5) $endfind=yoururldecode($argv[4]); if ($argc >= 6) $findthisafter=yoururldecode($argv[5]); if ($argc >= 7) $findthisaftertwo=yoururldecode($argv[6]); if ($argc >= 8) $deletedlabelfindstart=yoururldecode($argv[7]); if ($argc >= 9) $deletedlabelfindend=yoururldecode($argv[8]); if ($argc >= 10) $addedlabelfindstart=yoururldecode($argv[9]); if ($argc >= 11) $addedlabelfindend=yoururldecode($argv[10]); if ($argc >= 12) $donotfindthisstart=yoururldecode($argv[11]); if ($argc >= 13) $donotfindthisend=yoururldecode($argv[12]); $iscl=true; $ourargc=$argc; } else { // Non PHP command line ... $filespec="COMM.MIL*.xml"; if (isset($_GET['filespec'])) $filespec=str_replace("+"," ",urldecode($_GET['filespec'])); if (!isset($_GET['startfind']) && strpos($filespec, '`') !== false) { $bigstr=$filespec; $filespec=explode("`", $bigstr)[0]; if (strpos($bigstr, ($filespec . '``')) !== false) { // Curl ordered $startfind=explode("``", $bigstr)[1]; $findthis=explode("``", $bigstr)[2]; $endfind=explode("``", $bigstr)[3]; $findthisafter=explode("``", $bigstr)[4]; $findthisaftertwo=explode("``", $bigstr)[5]; $deletedlabelfindstart=explode("``", $bigstr)[6]; $deletedlabelfindend=explode("``", $bigstr)[7]; $addedlabelfindstart=explode("``", $bigstr)[8]; $addedlabelfindend=explode("``", $bigstr)[9]; $donotfindthisstart=explode("``", $bigstr)[10]; $donotfindthisend=explode("``", $bigstr)[11]; if (isset($_GET['php'])) { $ds='/'; if (strpos(dirname(__FILE__), $ds) === false) $ds=substr("\\",0,1); echo "
Performing
" . str_replace(">",">",str_replace("<","<","php " . dirname(__FILE__) . $ds . 'mil_mapping.php ' . str_replace("%60%60"," ",str_replace("%60%60%60%60"," %60 ",urlencode($_GET['filespec']))))) . "
"; exec("php " . dirname(__FILE__) . $ds . 'mil_mapping.php ' . str_replace("%60%60"," ",str_replace("%60%60%60%60"," %60 ",urlencode($_GET['filespec'])))); exit; } else if (isset($_GET['curl'])) { echo "
Performing
" . str_replace(">",">",str_replace("<","<","curl " . "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . explode("?",$_SERVER['REQUEST_URI'])[0] . '?filespec=' . urlencode($_GET['filespec']))) . "
"; exec("curl " . "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . explode("?",$_SERVER['REQUEST_URI'])[0] . '?filespec=' . urlencode($_GET['filespec'])); exit; } else { $iscurl=true; } } else { // Curl long winded $iscurl=true; $startfind="
1) { $uext=strtoupper("." . $extis[-1 + sizeof($extis)]); $lext=strtolower("." . $extis[-1 + sizeof($extis)]); if ($lext == ".xxx") { $lalt=".xzz"; $ualt=".XZZ"; } else { $lalt=substr($lext,0,2) . "xx"; $ualt=substr($uext,0,2) . "XX"; } } //
= 2 && (isset($_GET['filespec']) || $iscl)) { foreach (glob($filespec) as $filename) { $precont=@file_get_contents($filename); //file_put_contents($filename . ".001", $precont); $thisresult=$precont; $cont=$precont; $first=true; $sections=explode($findthis, $cont); $rsections=explode($findthis, $thisresult); for ($ii=1; $ii if (explode($endfind,explode($sf1, str_replace($donotfindthisstart," ",str_replace($startfind," ",$sections[-1 + $i])))[-1 + sizeof(explode($sf1, str_replace($donotfindthisstart," ",str_replace($startfind," ",$sections[-1 + $i]))))])[0] == ("/" . substr($dnft1,1))) { // after that will be " or other type of tag actually if (strpos(explode($findthisafter, $section[$i])[0], $dnft1) === false && strpos(explode($findthisafter, $section[$i])[0], substr($findthisafter,0,1)) === false && strpos(explode($findthisafter, $section[$i])[0], "") === false) { $bits=explode($findthisafter, $sections[$i]); $rbits=explode($findthisafter, $rsections[$i]); if (sizeof($bits) > 1 && strpos(str_replace($donotfindthisstart," ",$bits[0]),"<") === false) { $newsectionone=str_replace($bits[0] . $findthisafter . $bits[1], $bits[0] . $addedlabelfindstart . $addedlabelfindend . $findthisafter . $bits[1], $sections[$i]); $newsectionr=str_replace($rbits[0] . $findthisafter . $rbits[1], $rbits[0] . "" . ($addedlabelfindstart . $addedlabelfindend) . "" . $findthisafter . $rbits[1], $rsections[$i]); $cont=str_replace($findthis . $sections[$i], $findthis . $newsectionone, $cont); $sections=explode($findthis, $cont); $thisresult=str_replace($findthis . $rsections[$i], $findthis . $newsectionr, $thisresult); //if ($first && strpos($rsections[$i],$rbits[0] . $findthisafter . $rbits[1]) !== false) { echo " findthisafter=" . str_replace("<","<",$findthisafter) . " rbits[0]+=" . str_replace(">",">",str_replace("<","<",$rbits[0] . $findthisafter)) . " nEwSectionr=" . str_replace(">",">",str_replace("<","<",$newsectionr)) . " thisresult=
" . str_replace("</strike>","",str_replace("<strike>","",str_replace("</font>","",str_replace("<font color=green>","",str_replace(">",">",str_replace("<","<",str_replace($rbits[1],"",$thisresult))))))) . "
"; $first=false; } $rsections=explode($findthis, $thisresult); } } // after that will be " or other type of tag actually if (strpos(explode($findthisaftertwo, $section[$i])[0], $dnft1) === false && strpos(explode($findthisaftertwo, $section[$i])[0], substr($findthisaftertwo,0,1)) === false && strpos(explode($findthisaftertwo, $section[$i])[0], "") === false) { $bits=explode($findthisaftertwo, $sections[$i]); $rbits=explode($findthisaftertwo, $rsections[$i]); if (sizeof($bits) > 1 && strpos(str_replace($donotfindthisstart," ",$bits[0]),"<") === false) { $newsectionone=str_replace($bits[0] . $findthisaftertwo . $bits[1], $bits[0] . $addedlabelfindstart . $addedlabelfindend . $findthisaftertwo . $bits[1], $sections[$i]); $newsectionr=str_replace($rbits[0] . $findthisaftertwo . $rbits[1], $rbits[0] . "" . ($addedlabelfindstart . $addedlabelfindend) . "" . $findthisaftertwo . $rbits[1], $rsections[$i]); //if ($first) { echo " newSectionR=" . $newsectionr; $first=false; } $cont=str_replace($findthis . $sections[$i], $findthis . $newsectionone, $cont); $sections=explode($findthis, $cont); $thisresult=str_replace($findthis . $rsections[$i], $findthis . $newsectionr, $thisresult); $rsections=explode($findthis, $thisresult); } } } } } } //file_put_contents($filename . ".002", $cont); $sections=explode($findthis, $cont); $rsections=explode($findthis, $thisresult); for ($ii=0; $ii" . strtoupper($deletedlabelfindstart) . $innards . $deletedlabelfindend . "", $ris); } if ($was != $is) { $cont=str_replace($sections[$ii],$is,$cont); //$sections[$ii]=$ris; $thisresult=str_replace($rsections[$ii],str_replace(strtoupper($deletedlabelfindstart),$deletedlabelfindstart,$ris),$thisresult); //$rsections[$ii]=$ris; } } if ($cont != $precont) { //file_put_contents($filename . ".003", $cont); //$uc=str_replace(">",">",str_replace("<","<",strtoupper($addedlabelfindstart . $addedlabelfindend))); $aresult=str_replace(">",">",str_replace("<","<",$thisresult)); //$aresult=str_replace($uc,"" . $addedlabelfindstart . $addedlabelfindend . "",$aresult); $bresult=str_replace("</strike>","",str_replace("<strike>","",str_replace("</font>","",str_replace("<font color=green>","
",$aresult)))); $results.="
" . $filename . " changed ...
" . $bresult . "


"; if (!file_exists($filename . "_original_backup")) copy($filename, $filename . "_original_backup"); file_put_contents($filename, $cont); $precont=$cont; $sections=[]; $rsections=[]; } } } if ($iscl || $iscurl) exit; ?>

Adder Innerer of XML <title arch="online">Note</title>

Deleter of XML href="hrefvalue"

RJM Programming

September, 2017


XML file specification for input data:
Start delimitation of tags of interest:
Find this within:
End delimitation of tags of interest:
Find this after 1 of 2:
Find this after 2 of 2:
Deleted label regarding global substitutions start delimitation:
Deleted label regarding global substitutions end delimitation:
New label regarding global substitutions start content prefix:
New label regarding global substitutions end content suffix:
Ignore this start delimitation:
Ignore this end delimitation: