|
|
@@ -8,6 +8,9 @@
|
|
|
$dirToTraverse = -1;
|
|
|
$regex_search = "";
|
|
|
$replace_str = "";
|
|
|
+$thisFile = __DIR__ . "/" . $argv[0];
|
|
|
+
|
|
|
+// ======================================================================
|
|
|
|
|
|
function GET_DIR_CONTENTS($dir, &$results = array()) {
|
|
|
$files = scandir($dir);
|
|
|
@@ -47,7 +50,19 @@ function ECHO_USAGE(){
|
|
|
|
|
|
}
|
|
|
|
|
|
-// =================================================================
|
|
|
+// @BRIEF Replace $search with $replace in $str. This performs a simple replace using PHP's str_replace().
|
|
|
+function REPLACE($str, $search, $replace){
|
|
|
+
|
|
|
+ return str_replace($search, $replace, $str);
|
|
|
+}
|
|
|
+
|
|
|
+// @BRIEF Replace $search with $replace in $str. This expects a regular expression for $search and uses PHP's preg_replace().
|
|
|
+function REPLACE2($str, $search, $replace){
|
|
|
+
|
|
|
+ return preg_replace($search, $replace, $str);
|
|
|
+}
|
|
|
+
|
|
|
+// ======================================================================
|
|
|
|
|
|
if (isset($argv[1])){
|
|
|
|
|
|
@@ -100,6 +115,12 @@ else{
|
|
|
$contents = array();
|
|
|
GET_DIR_CONTENTS($dirToTraverse, $contents);
|
|
|
|
|
|
+while( ($found = array_search($thisFile, $contents)) !== false ){
|
|
|
+
|
|
|
+ echo " > Removing this script from file listing.\n";
|
|
|
+ unset($contents[$found]);
|
|
|
+}
|
|
|
+
|
|
|
// var_dump($contents);
|
|
|
|
|
|
echo " > FILE AND DIRECTORY LIST:\n ================================\n";
|
|
|
@@ -109,3 +130,18 @@ foreach ($contents as $c){
|
|
|
}
|
|
|
|
|
|
echo " ================================\n";
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|