3,30c3
< // RJM Programming
< // August, 2015
< // Chapter changer for xml
<
< function cget($inv) {
< global $curlget;
< $retval="";
< if (isset($_GET[$inv])) {
< $retval=urldecode($_GET[$inv]);
< } else {
< $things=explode($inv . "=", $curlget);
< if (sizeof($things) >= 2) {
< if ($inv == "lookup") {
< $subthings=explode("you_will_neverfind-this", $things[1]);
< $retval=str_replace("|", "\n", $subthings[0]);
< } else {
< $subthings=explode("|", $things[1]);
< $retval=$subthings[0];
< }
< }
< }
< return $retval;
< }
<
< $cidea="curl " . "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'] . "?curlget=";
< $curlget="";
< if (isset($_GET['curlget'])) $curlget=urldecode($_GET['curlget']);
< $letthrough=" ";
---
>
72,76c45,46
<
< $argv0="";
< if (isset($argv[0])) $argv0=$argv[0];
<
<
---
>
>
78d47
< $letthrough= "*" . $_SERVER['SCRIPT_FILENAME'] . "!";
287,358c256
< } else if (!isset($_GET['thisext']) && !isset($_GET['curlget'])) { // ... end of PHP command line specific interactive input code ...
< $letthrough="";
< $cidea .= urlencode("|filespec=" . $filespec);
< $cidea .= urlencode("|ynftt=" . $ynftt);
< $cidea .= urlencode("|prefix1=" . $prefix1);
< $cidea .= urlencode("|prefix2=" . $prefix2);
< $cidea .= urlencode("|prefix3=" . $prefix3);
< $cidea .= urlencode("|prefix4=" . $prefix4);
< $cidea .= urlencode("|prefix5=" . $prefix5);
< $cidea .= urlencode("|prefix6=" . $prefix6);
< $cidea .= urlencode("|lookup=" . str_replace("\n","|",$lookup));
< echo "
" . $_SERVER['DOCUMENT_ROOT'] . "Chapter Renumbering
\n\nYou might be here using curl and we want you to copy/adjust/paste the example usage string below to help ...\n\n" . $cidea . "\n\n
";
< } else if (isset($_GET['filespec']) || isset($_GET['curlget'])) { // phase two run via form results
< $filespec=cget('filespec'); //urldecode($_GET['filespec']);
< $bits=explode(".",$filespec);
< $thisext=$bits[sizeof($bits) - 1];
< $bckext=strrev($thisext);
< if ($bckext == $thisext) $bckext .= "_bck";
<
< $ynftt=cget('ynftt'); //urldecode($_GET['ynftt']);
< $prefix1=cget('prefix1'); //urldecode($_GET['prefix1']);
< $prefix2=cget('prefix2'); //urldecode($_GET['prefix2']);
< $prefix3=cget('prefix3'); //urldecode($_GET['prefix3']);
< $prefix4=cget('prefix4'); //urldecode($_GET['prefix4']);
< $prefix5=cget('prefix5'); //urldecode($_GET['prefix5']);
< $prefix6=cget('prefix6'); //urldecode($_GET['prefix6']);
< if (prefix1 == '.') $prefix1='';
< if (prefix2 == '.') $prefix2='';
< if (prefix3 == '.') $prefix3='';
< if (prefix4 == '.') $prefix4='';
< if (prefix5 == '.') $prefix5='';
< if (prefix6 == '.') $prefix6='';
<
< $lookup=cget('lookup'); //urldecode($_GET['lookup']);
< $ourlookup=$lookup;
< $letthrough .= "
Another go?";
< }
---
> } // ... end of PHP command line specific interactive input code
360c258,259
< if (strlen($letthrough) > 0) {
---
> //echo $ourlookup;
>
401,402c300
< echo "\n" . $num . " files amended. Original files stored in " . str_replace("." . $thisext, "." . $bckext, $filespec) . $letthrough . "\n";
< }
---
> echo "\n" . $num . " files amended. Original files stored in " . str_replace("." . $thisext, "." . $bckext, $filespec) . "\n";