1) { $setoffphp=false; $checkbit="  "; $updword='Update'; $updtype='button onclick=justdo(); '; if ($rest == '' && sizeof($incssfiles) > 1 && $preone == 1) { for ($iop=0; $iop<(-1 + sizeof($incssfiles)); $iop++) { if ($incssfiles[$iop] != '') { if ($prerest == '') { $prerest=$incssfiles[$iop] . ';' . $outcssfiles[$iop]; $onerest=$incssfiles[$iop] . ';' . $outcssfiles[$iop]; $preone++; } else { $rest.=""; $preone++; } } } if ($prerest != '') { $rest.=""; } } } if (isset($argc)) { $fn=$argv[0]; $swis=file_get_contents($fn); } else { $fn=dirname(__FILE__) . "/sass_watchdog.php"; $swis=file_get_contents($fn); if (strpos($swis,'" ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' "') !== false) { $swis=str_replace('" ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' "', '"http://' . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "" . explode("#", explode("?", $_SERVER['REQUEST_URI'])[0])[0] . '"', $swis); $curlurl[0]='http://' . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "" . explode("#", explode("?", $_SERVER['REQUEST_URI'])[0])[0]; $upd=true; } if (strpos($swis,'" ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' "') !== false) { if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { $swis=str_replace('" ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' "', '"' . dirname(__FILE__) . substr("\\",0,1) . 'sass_watchdog.php' . '"', $swis); $phppath[0]=dirname(__FILE__) . substr("\\",0,1) . 'sass_watchdog.php'; } else { $swis=str_replace('" ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' "', '"' . dirname(__FILE__) . '/sass_watchdog.php' . '"', $swis); $phppath[0]=dirname(__FILE__) . '/sass_watchdog.php'; } $upd=true; } } // Thanks to https://gist.github.com/lsauer/6476476 // # www.lsauer.com, 2012 lo sauer // # desc: kill a process on Linux, MacOS, Windows without a process-control library // # in the php setup or environment $kill = function($pid){ return stripos(php_uname('s'), 'win')>-1 ? exec("taskkill /F /PID $pid") : exec("kill -9 $pid"); }; //e.g. //echo $kill(19008); //> "Successfully terminated...." //array_map($kill, [19008,23012,1802,930]); //killall: without using array_map and a boolean return value $killall = function($pids){ $os=stripos(php_uname('s'), 'win')>-1; ($_=implode($os?' /PID ':' ',$pids)) or ($_=$pids); return preg_match('/success|close/', $os ? exec("taskkill /F /PID $_") : exec("kill -9 $_")); }; //if( $killall([19008,23012,1802,930]) and $killall(19280)){ // echo "successfully killed all processes" //} // /usr/local/Cellar/sass/1.22.12/bin/sass --watch /Applications/MAMP/htdocs/sass/base.scss /Applications/MAMP/htdocs/sass/build/test.css >> /Applications/MAMP/htdocs/sass/sass_watch.ok 2>> /Applications/MAMP/htdocs/sass/sass_watch.notok & function ourecho($ine) { global $htmlis; $htmlis.=$ine; } function ourrealpath($inid) { if (realpath($inid) != $inid && realpath($inid) != '') { return realpath($inid); } $delim=substr("\\" . "\\",0,1); if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { if (strpos($inid, $delim) === false && strpos($inid, "/") === false) { return dirname(__FILE__) . $delim . $inid; } $bits=explode($delim, $inid); $lbit=$bits[-1 + sizeof($bits)]; if (strpos($lbit, ".") !== false) { if (file_exists(str_replace($delim . $lbit, $delim, $inid))) { if (realpath(str_replace($delim . $lbit, $delim, $inid)) != str_replace($delim . $lbit, $delim, $inid) && realpath(str_replace($delim . $lbit, $delim, $inid)) != '') { return realpath(str_replace($delim . $lbit, "", $inid)) . $delim . $lbit; } } } } else { if (strpos($inid, "/") === false) { return dirname(__FILE__) . "/" . $inid; } $bits=explode("/", $inid); $lbit=$bits[-1 + sizeof($bits)]; if (strpos($lbit, ".") !== false) { if (file_exists(str_replace("/" . $lbit, "/", $inid))) { if (realpath(str_replace("/" . $lbit, "/", $inid)) != str_replace("/" . $lbit, "/", $inid) && realpath(str_replace("/" . $lbit, "/", $inid)) != '') { return realpath(str_replace("/" . $lbit, "", $inid)) . "/" . $lbit; } } } } return $inid; } function undochecks() { // can be done via command line or surfing the net POST global $phppath, $swis, $fn; $stack = array(); if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") === false) { if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { $cpid=-1; //echo " ... about to look for " . "|" . $phppath[0] . ";chec" . "k,"; if (strpos($swis, "|" . $phppath[0] . ";chec" . "k,") !== false) { //echo " ... about to "; $tpid=explode(",",explode("|" . $phppath[0] . ";" . "check" . ",", $swis)[0])[-1 + sizeof(explode(",",explode("|" . $phppath[0] . ";" . "check" . ",", $swis)[0]))]; //echo " ... About to "; array_push($stack, $tpid); $cpid=$tpid; } $pidshere=explode("// ", explode("," . ".", $swis)[0])[-1 + sizeof(explode("// ", explode("," . ".", $swis)[0]))]; //echo $pidshere . " ... about to kill " . $cpid; $pss=explode("|", $pidshere); for ($iop=0; $iop<(-1 + sizeof($pss)); $iop++) { $tpid=explode(",", $pss[$iop])[-1 + sizeof(explode(",", $pss[$iop]))]; if (("" . $tpid) != ("" . $cpid)) { //echo " ... about to Kill " . $tpid; array_push($stack, $tpid); //try { //$kill($tpid); //} catch (Exception $ew) { //} } } $killall($stack); $swis=str_replace($pidshere, ""); $upd=true; if ($upd) { file_put_contents($fn, $swis); $upd=false; } $swis=str_replace( explode("[", explode('" ' . ' ' . ' "', $swis)[0])[-1 + sizeof( explode("[", explode('" ' . ' ' . ' "', $swis)[0]))], "", $swis); $swis=str_replace( explode("[", explode('" ' . ' "', $swis)[0])[-1 + sizeof( explode("[", explode('" ' . ' "', $swis)[0]))], "", $swis); $upd=true; if ($upd) { file_put_contents($fn, $swis); $upd=false; } for ($iop=0; $iop<(-1 + sizeof($pss)); $iop++) { $tpid=explode(",", $pss[$iop])[-1 + sizeof(explode(",", $pss[$iop]))]; $kill($tpid); $killall($stack); } } else { // Linux or Mac ps -ef method exec("kill -9 `ps -ef | grep '/sass' | grep -v 'grep' | sed '/^[ ]*/s///g' | cut -d' ' -f 2`"); $swis=str_replace( explode("// ", explode(',' . ',', $swis)[0])[-1 + sizeof( explode("// ", explode(',' . ',', $swis)[0]))], "", $swis); $swis=str_replace( explode("[", explode('" ' . ' ' . ' "', $swis)[0])[-1 + sizeof( explode("[", explode('" ' . ' ' . ' "', $swis)[0]))], "", $swis); $swis=str_replace( explode("[", explode('" ' . ' "', $swis)[0])[-1 + sizeof( explode("[", explode('" ' . ' "', $swis)[0]))], "", $swis); $upd=true; if ($upd) { file_put_contents($fn, $swis); $upd=false; } } } if (!isset($argc)) { header("Location: ./sass_watchdog.php"); } exit; } function dochecks() { // done via curl if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") === false) { if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { $lfil='nul'; $errlfil='&1'; } else { $lfil='/dev/null'; $errlfil='/dev/null'; } if (isset($_POST['errlogfiles'])) { if (strlen(trim($_POST['errlogfiles'])) != 0) { if (ourrealpath(str_replace('+',' ',urldecode($_POST['errlogfiles']))) == '') { $errlfil=str_replace('+',' ',urldecode($_POST['errlogfiles'])); } else { $errlfil=ourrealpath(str_replace('+',' ',urldecode($_POST['errlogfiles']))); } } } if (isset($_POST['logfiles'])) { if (strlen(trim($_POST['logfiles'])) != 0) { if (ourrealpath(str_replace('+',' ',urldecode($_POST['logfiles']))) == '') { $lfil=str_replace('+',' ',urldecode($_POST['logfiles'])); } else { $lfil=ourrealpath(str_replace('+',' ',urldecode($_POST['logfiles']))); } } } for ($ik=0; $ik $ik) { if (trim($outcssfiles[$ik]) != '') { if (strpos($swis, "|" . $incssfiles[$ik] . ";" . $outcssfiles[$ik] . ",") !== false) { $tpid=explode(",",explode("|" . $incssfiles[$ik] . ";" . $outcssfiles[$ik] . ",", $swis)[0])[-1 + sizeof(explode(",",explode("|" . $incssfiles[$ik] . ";" . $outcssfiles[$ik] . ",", $swis)[0]))]; if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { if (file_exists(str_replace("sass_watchdog.php", "swjunk.jnk", $fn))) { unlink(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); } exec('tasklist /fi "pid eq ' . $tpid . '" > ' . str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); if (file_exists(str_replace("sass_watchdog.php", "swjunk.jnk", $fn))) { $tlout=file_get_contents(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); unlink(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); if (strpos($tlout, ' ' . $tpid . ' ') !== false) { $trunning = true; } } } else { $trunning = posix_kill($tpid,0); } if (!$trunning) { $swis=str_replace("," . $tpid . "|" . $incssfiles[$ik] . ";" . $outcssfiles[$ik], '', $swis); $upd=true; //if ($upd) { file_put_contents($fn, $swis); $upd=false; } startBackgroundProcess($sasexe[0] . ' ' . $sasswitch[0] . ' ' . $incssfiles[$ik] . " " . $outcssfiles[$ik] . ' >> ' . $lfil . ' 2>> ' . $errlfil); } } } } } } } if ($upd) { file_put_contents($fn, $swis); $upd=false; } exit; } //Note for windows users: //You cannot redirect stdout/stderr to nul in the following manner: //startBackgroundProcess('ping yandex.com', null, 'nul', 'nul'); //However, you can do this: //startBackgroundProcess('ping yandex.com >nul 2>&1'); function startBackgroundProcess( $commandin, $stdin = null, $redirectStdout = null, $redirectStderr = null, $cwd = null, $env = null, $other_options = null ) { // thanks to https://stackoverflow.com/questions/45953/php-execute-a-background-process global $incssfiles, $outcssfiles, $logfiles, $errlogfiles,$amrunning,$sasexe, $swis, $fn, $upd, $iswatchdog; $isthere=false; $trunning=false; //if ($iswatchdog) { file_put_contents("zz.1",""); } $command=str_replace(" " . " "," ",str_replace(" " . " " . " "," ",$commandin)); if ($iswatchdog) { $isthere = true; $command=str_replace(";"," ",$commandin); //if ($iswatchdog) { file_put_contents("zz.2",""); } if (strpos($swis, ";ch" . "eck,") !== false) { $tpid=explode(",",explode("|" . str_replace(" ",";",explode("php ", $commandin)[1]) . ",", $swis)[0])[-1 + sizeof(explode(",",explode("|" . str_replace(" ",";",explode("php ", $commandin)[1]) . ",", $swis)[0]))]; //if ($iswatchdog) { file_put_contents("zz.3",$tpid); } if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { if (file_exists(str_replace("sass_watchdog.php", "swjunk.jnk", $fn))) { unlink(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); } exec('tasklist /fi "pid eq ' . $tpid . '" > ' . str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); if (file_exists(str_replace("sass_watchdog.php", "swjunk.jnk", $fn))) { $tlout=file_get_contents(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); unlink(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); if (strpos($tlout, ' ' . $tpid . ' ') !== false) { $trunning = true; } } } else { $trunning = posix_kill($tpid,0); } if ($trunning) { return null; } else { //if ($iswatchdog) { file_put_contents("zz.4",""); } $isthere = true; $swis=str_replace("," . $tpid . "|" . str_replace(" ",";",explode("php ", $commandin)[1]), '', $swis); $upd=true; } } } else { $four=4; $trunning = false; $proc = null; $isthere = true; $cwords=explode(' ', str_replace(" " . " "," ",str_replace(" " . " " . " "," ",$commandin))); if (sizeof($cwords) > 1) { if (substr($cwords[1],0,1) != '-') { $four=3; } } if (sizeof($cwords) >= $four) { if ($four == 4) { $command=$cwords[0] . ' ' . $cwords[1] . ' ' . ourrealpath($cwords[2]) . ' ' . ourrealpath($cwords[3]); } else { $command=$cwords[0] . ' ' . ourrealpath($cwords[1]) . ' ' . ourrealpath($cwords[2]); } for ($ii=$four; $ii ' . str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); if (file_exists(str_replace("sass_watchdog.php", "swjunk.jnk", $fn))) { $tlout=file_get_contents(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); unlink(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); if (strpos($tlout, ' ' . $tpid . ' ') !== false) { $trunning = true; } } } else { $trunning = posix_kill($tpid,0); } if ($trunning) { return null; } else { $swis=str_replace("," . $tpid . "|" . str_replace(" ",";",explode($sasswitch[0], $command)[1]), '', $swis); $upd=true; } } $cwords=explode(' ', $command); if (sizeof($cwords) >= $four) { if (!file_exists($cwords[-2 + $four])) { // not good $isthere=false; } } else { $isthere=false; } } $descriptorspec = array( 1 => is_string($redirectStdout) ? array('file', $redirectStdout, 'w') : array('pipe', 'w'), 2 => is_string($redirectStderr) ? array('file', $redirectStderr, 'w') : array('pipe', 'w'), ); if (is_string($stdin)) { $descriptorspec[0] = array('pipe', 'r'); } //if ($iswatchdog) { file_put_contents("zz.5",""); } if ($isthere) { //if ($iswatchdog) { file_put_contents("zz.6",""); } $proc = proc_open($command, $descriptorspec, $pipes, $cwd, $env, $other_options); } if (!is_resource($proc)) { //throw new \Exception("Failed to start background process by command: $command"); $proc=null; } else { $etat=proc_get_status($proc); if ($etat['running'] == FALSE) { proc_close($proc); $proc=null; return null; } else if ($iswatchdog) { //if ($iswatchdog) { file_put_contents("zz.7",""); } $swis=str_replace("," . ",", "," . $etat['pid'] . "|" . str_replace(" ",";",explode("php ", $commandin)[1]) . "," . ",", $swis); //if ($iswatchdog) { file_put_contents("zz.8",""); } $upd=true; if ($upd) { file_put_contents($fn, $swis); $upd=false; } //if ($iswatchdog) { file_put_contents("zz.9",""); } } else { $swis=str_replace("," . ",", "," . $etat['pid'] . "|" . $cwords[-2 + $four] . ";" . $cwords[-1 + $four] . "," . ",", $swis); $upd=true; $swis=str_replace('["' . ' ' . ' ' . '"]', '["' . $cwords[-2 + $four] . '","' . ' ' . ' ' . '"]', str_replace(',"' . ' ' . ' ' . '"]', ',"' . $cwords[-2 + $four] . '","' . ' ' . ' ' . '"]', $swis)); $swis=str_replace('["' . ' ' . ' ' . ' ' . '"]', '["' . $cwords[-1 + $four] . '","' . ' ' . ' ' . ' ' . '"]', str_replace(',"' . ' ' . ' ' . ' ' . '"]', ',"' . $cwords[-1 + $four] . '","' . ' ' . ' ' . ' ' . '"]', $swis)); } } if (is_string($stdin)) { fwrite($pipes[0], $stdin); fclose($pipes[0]); } if (!is_string($redirectStdout)) { fclose($pipes[1]); } if (!is_string($redirectStderr)) { fclose($pipes[2]); } return $proc; } if (!function_exists("readline")) { // thanks to https://stackoverflow.com/questions/23238378/call-to-undefined-function-readline function readline($prompt = null) { if ($prompt) { echo $prompt; } $fp = fopen("php://stdin","r"); $line = rtrim(fgets($fp, 1024)); return $line; } } if (!isset($argc)) { // surfing the net if (isset($_GET['check'])) { // done via curl dochecks(); //passthru("date"); } else if (isset($_POST['unoop'])) { // done via surfing the net echo ""; exit; } else if (isset($_POST['uncheck'])) { // done via surfing the net undochecks(); //passthru("date"); } else if (isset($_GET['sanitycheck']) && isset($_GET['in1']) && isset($_GET['out1'])) { // done via surfing the net $cmds='/usr/local/Cellar/sass/1.22.12/bin/sass'; if (isset($_GET['sasexe'])) { if (strlen(trim($_GET['sasexe'])) != 0) { if (realpath(str_replace('+',' ',urldecode($_GET['sasexe']))) != '') { $cmds=realpath(str_replace('+',' ',urldecode($_GET['sasexe']))); } else { $cmds=str_replace('+',' ',urldecode($_GET['sasexe'])); } } else { $cmds="sass"; } } $cmdsw=' --watch '; if (isset($_GET['sasswitch'])) { if (strlen(trim($_GET['sasswitch'])) != 0) { $cmdsw=str_replace('+',' ',urldecode($_GET['sasswitch'])); } } if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { $lfil='nul'; $errlfil='&1'; } else { $lfil='/dev/null'; $errlfil='/dev/null'; } if (isset($_GET['errlogfiles'])) { if (strlen(trim($_GET['errlogfiles'])) != 0) { if (ourrealpath(str_replace('+',' ',urldecode($_GET['errlogfiles']))) == '') { $errlfil=str_replace('+',' ',urldecode($_GET['errlogfiles'])); } else { $errlfil=ourrealpath(str_replace('+',' ',urldecode($_GET['errlogfiles']))); } } } if (isset($_GET['logfiles'])) { if (strlen(trim($_GET['logfiles'])) != 0) { if (ourrealpath(str_replace('+',' ',urldecode($_GET['logfiles']))) == '') { $lfil=str_replace('+',' ',urldecode($_GET['logfiles'])); } else { $lfil=ourrealpath(str_replace('+',' ',urldecode($_GET['logfiles']))); } } } //file_put_contents('zq.1',$cmds); //if (strpos($swis, "," . urldecode($_GET['sanitycheck']) . "|" . $phppath[0] . ";check") !== false) { if (trim(str_replace('+',' ',urldecode($_GET['sanitycheck']))) == trim($oop[0])) { //file_put_contents('zq.2',$cmdsw); $one=1; if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") === false) { if (!startBackgroundProcess($cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil)) { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Errors calling ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } else { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Successfully called ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } } else { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Would have tried to call ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } } else { //file_put_contents('zq.3',''); if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") === false) { //file_put_contents('zq.4',$htmlis); if (!startBackgroundProcess($cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil)) { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Errors calling ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } else { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Successfully called ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } } else { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Would have tried to call ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_GET['in' . $one] . ';' . $_GET['out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } } //file_put_contents('zq.5',$htmlis); } if ($upd) { file_put_contents($fn, $swis); } exit; } else if (isset($_POST['in1out1']) && !isset($_POST['check'])) { // done via surfing the net $cmds='/usr/local/Cellar/sass/1.22.12/bin/sass'; if (isset($_POST['sasexe'])) { if (strlen(trim($_POST['sasexe'])) != 0) { if (realpath(str_replace('+',' ',urldecode($_POST['sasexe']))) != '') { $cmds=realpath(str_replace('+',' ',urldecode($_POST['sasexe']))); } else { $cmds=str_replace('+',' ',urldecode($_POST['sasexe'])); } } else { $cmds="sass"; } } $cmdsw=' --watch '; if (isset($_POST['sasswitch'])) { if (strlen(trim($_POST['sasswitch'])) != 0) { $cmdsw=str_replace('+',' ',urldecode($_POST['sasswitch'])); } } if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { $lfil='nul'; $errlfil='&1'; } else { $lfil='/dev/null'; $errlfil='/dev/null'; } if (isset($_POST['errlogfiles'])) { if (strlen(trim($_POST['errlogfiles'])) != 0) { if (ourrealpath(str_replace('+',' ',urldecode($_POST['errlogfiles']))) == '') { $errlfil=str_replace('+',' ',urldecode($_POST['errlogfiles'])); } else { $errlfil=ourrealpath(str_replace('+',' ',urldecode($_POST['errlogfiles']))); } } } if (isset($_POST['logfiles'])) { if (strlen(trim($_POST['logfiles'])) != 0) { if (ourrealpath(str_replace('+',' ',urldecode($_POST['logfiles']))) == '') { $lfil=str_replace('+',' ',urldecode($_POST['logfiles'])); } else { $lfil=ourrealpath(str_replace('+',' ',urldecode($_POST['logfiles']))); } } } $one=$preone; while (isset($_POST['in' . $one . 'out' . $one])) { if (strlen($_POST['in' . $one . 'out' . $one]) > 0) { //if (sizeof($incssfiles) > $one) { if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") === false) { if (!startBackgroundProcess($cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil)) { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Errors calling ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } else { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Successfully called ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } } else { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Would have tried to call ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } } else { if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") === false) { if (!startBackgroundProcess($cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil)) { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Errors calling ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } else { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Successfully called ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } } else { ourecho(str_replace("\n","
",str_replace(">",">",str_replace("<","<","Would have tried to call ... startBackgroundProcess('" . $cmds . ' ' . $cmdsw . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[0] . ' ' . explode(' ',str_replace(';', ' ',str_replace('+',' ',urldecode($_POST['in' . $one . 'out' . $one]))))[1] . ' >> ' . $lfil . ' 2>> ' . $errlfil . "');\n")))); } } //} } $one++; $swis=str_replace(' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', '' . rand(0,9) . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', $swis); $swis=str_replace(' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', '' . rand(0,9) . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', $swis); $swis=str_replace(' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', '' . rand(0,9) . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', $swis); $swis=str_replace(' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', '' . rand(0,9) . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', $swis); $swis=str_replace(' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', '' . rand(0,9) . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', $swis); $swis=str_replace(' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', '' . rand(0,9) . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', $swis); $swis=str_replace(' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', '' . rand(0,9) . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . ' ' . '"]', $swis); $upd=true; } if ($upd) { file_put_contents($fn, $swis); if ($setoffphp) { $iswatchdog=true; if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") === false) { startBackgroundProcess("php " . $phppath[0] . ";check"); } } } if (strpos($htmlis, "uccess") !== false) { if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { echo "
" . $htmlis . "

"; } else { //echo "
" . $htmlis . "
" . str_replace(" sh ","
sh ",str_replace(" php ","
php ",str_replace("\r","
",str_replace("\n","
",(passthru("ps -ef | grep 'sass_watchdog'") . passthru("ps -ef | grep '/sass '")))))) . "

"; if (file_exists(str_replace("sass_watchdog.php", "swjunk.jnk", $fn))) { unlink(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); } exec("ps -ef | grep 'sass' | grep -v 'grep' > " . str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); $pt=file_get_contents(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); if (file_exists(str_replace("sass_watchdog.php", "swjunk.jnk", $fn))) { unlink(str_replace("sass_watchdog.php", "swjunk.jnk", $fn)); } echo "
" . str_replace("\r","
",str_replace("\n","
",$pt)) . "
" . $htmlis . "

"; } exit; } else { echo $htmlis; } } else { // done via surfing the net echo " Sass CSS Preprocesor Supervisor and Watchdog ... RJM Programming ... September,2019 ... Optionally helps out sass --watch [inputSassSCSS] [outputCSS]

Sass 'sass --watch [inputSassSCSS] [outputCSS]' Supervisor and Watchdog

RJM Programming

September, 2019



" . $rest . "




" . $checkbit . "
"; } } else { // done via command line if ($argc > 1) { if (strpos(strtolower($argv[1]), "check") !== false) { $iji=$argc; //$curlurl[0]="http://localhost:8888/sass_watchdog.php"; while ($iji == $argc) { if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { exec('curl "' . $curlurl[0] . '?check=' . rand(0, 198766700) . '" 2>nul'); } else { exec('curl "' . $curlurl[0] . '?check=' . rand(0, 198766700) . '" 2> /dev/null'); } sleep(60); } } else if (strpos(strtolower($argv[1]), "killall") !== false) { undochecks(); } } } // Logging information below // ,, ?>