function _exists($path) { needsLoggedIn(); $path = formatPath($path); died(file_exists($path) ? 'true' : 'false'); }
function handleOne($f, $outDir, $force = false) { global $FILES; global $RULES; global $COPY_EXCLUDE; global $g_handledFiles; // $FILES设置一般用于调试 单个文件 if (!$force && isset($FILES)) { $skip = true; foreach ($FILES as $re) { if (matchRule($re, $f)) { $skip = false; break; } } if ($skip) { return false; } } $g_handledFiles[formatPath($f)] = 1; $rule = null; foreach ($RULES as $re => $v) { if (matchRule($re, $f)) { $rule = $v; break; } } if (isset($rule)) { logit("=== rule {$re} on {$f}\n"); if (!is_array($rule)) { $rule = [$rule]; } $outf = null; foreach ($rule as $rule1) { if ($rule1 === "HASH") { logit("=== hash {$f}\n"); handleHash($f, $outDir, $outf); } else { $outf = $outDir . "/" . $f; @mkdir(dirname($outf), 0777, true); putenv("TARGET={$outf}"); // system($rule1); file_put_contents("tmp.sh", $rule1); passthru("sh tmp.sh"); } } return; } global $g_isRebuild, $g_changedFiles; if (!$g_isRebuild) { if (array_search($f, $g_changedFiles) === false) { return false; } } $noCopy = false; foreach ($COPY_EXCLUDE as $re) { if (matchRule($re, $f)) { $noCopy = true; break; } } if ($noCopy) { return false; } logit("=== copy {$f}\n"); handleCopy($f, $outDir); }
} if(!$save_results[0]) { //if not a successful save get error messages $index=1; $output=""; while($save_results[$index]) { $output.=$save_results[$index]; $index++; } $output=implode("\r\n",$save_results). "PHPCRON must be able to open ".formatPath($phpcron_psinfo_file)." in order for PHPCRON Admin to control PHPCRON's execution. You will need to fix, and try again for PHPCRON Admin to work properly.<br><br>\r\n\r\n"; sendOutput($output,true); sleep(5); $output=""; } } deleteFile($phpcron_off); //delete this if it exists since it would be from previous run;
function listDirOne($path, $exts = '') { $list = array(); $path = formatPath($path); $files = glob($path . '*'); foreach ($files as $v) { $fileext = fileext($v); if (!$exts || preg_match("/\.($exts)/i", $v)) { $list[] = $v; } } return $list; }
function deleteFile($file_name) { if (!file_exists($file_name)) { return true; //if file doesn't exist than don't worry about it } clearstatcache(); //clear cache since will be checking same file again $path_errors=isPathBad($file_name, true, true); if ( !$path_errors["directory"]["write"] and !$path_errors["file"]) { if(MS_WINDOWS) { $file_name=formatPath($file_name); exec("del $file_name"); } else { unlink($file_name); } return true; } else { return false; //return false if errors - can't write to path } }
function fullEditBox($file_name, $box_title){ global $admin_subpage; global $PHP_SELF; global $modified_contents; global $mc_rows; global $fe_save_error; global $full_edit_title; global $secure; if($path_errors=isPathbad($file_name, true, true)) { while ( list($file_or_dir, $error_string) = each($path_errors)) { while (list($each_message) = each($error_string)) { $error_messages.=$path_errors[$file_or_dir][$each_message]; } } $error_messages="<h3>Cannot Edit $file_name because of file errors:<br></h3>".$error_messages; //if path errors, echo message and retur if (!is_readable($file_name)){ echoErrorMessages($error_messages); echo $output; return; } } //Empty file into array $file_array=file($file_name); if ($fe_save_error) { //if previously bad save, display modified contents that weren't saved $file_string=$modified_contents; } else { //Implode file_array to put string in text area element $file_string=addslashes(trim(implode("",$file_array))); //Set number of rows if ($file_array) { $total_lines=count($file_array); } $mc_rows=$total_lines+10; } //Build output $output=" <!--*********** Begin Full Edit Box For $file_name************--> <br> <table border=\"1\" cellpadding=\"2\" width=\"600px\" cellspacing=\"0\" align=\"center\"> <tr> <td align=center style=$full_edit_title colspan=7 > <h3> $box_title <br><br> (edit ".chunk_split(formatPath($file_name), 20, " ").") <br> </h3> </td> </tr> <tr> <td style=$full_edit_title> <form action=\"$PHP_SELF\" method=\"post\"> <div align=\"center\"> <textarea name=\"modified_contents\" wrap=\"off\" cols=\"80\" rows=\"$mc_rows\" class=\"fulledit\">".stripslashes($file_string)." </textarea> </div> <HR> <input type=\"submit\" value=\"Save\">"; if (!$secure) { $output.= "<input type=\"submit\" value=\"Save As:\"> <input type=\"text\" class=\"color\" name=\"new_filename\">"; } $output.=" <br> Check to Save Over Existing File: <input type=\"checkbox\" name=\"overwrite\" value=\"true\" class=\"title\"> <input type=\"hidden\" class=\"color\" name=\"current_filename\" value=\"$file_name\"> <input type=\"hidden\" name=\"admin_subpage\" value=\"$admin_subpage\"> <input type=\"hidden\" name=\"mc_rows\" value=\"$mc_rows\"> </form> <form action=\"$PHP_SELF\" method=\"post\"> <input type=\"submit\" value=\"Reload Current File\"> <input type=\"hidden\" name=\"admin_subpage\" value=\"$admin_subpage\"> </form> <HR> Current File: ".formatPath($file_name)." </td> </tr> </table> <br> <!--*********** End Full Edit Box For $file_name*************--> "; if($error_messages) { echoErrorMessages($error_messages); } echo $output; }