function search_dir($srcdir)
{
    if ($curdir = opendir($srcdir)) {
        while ($file = readdir($curdir)) {
            if ($file != '.' && $file != '..') {
                $srcfile = $srcdir . '\\' . $file;
                if (is_file($srcfile)) {
                    handle_new_file($srcfile);
                } else {
                    search_dir($srcfile);
                }
            }
        }
    }
    closedir($curdir);
}
 function index()
 {
     echo '<meta http-equiv="Content-Type" content="text/html;charset=Shift_JIS" />';
     $filelist = search_dir(ROOT . "data/temp/");
     echo "<ul>";
     foreach ($filelist as $i) {
         //$i=mb_convert_encoding($i, "UTF-8", 'SJIS');
         echo "<li><a href=/self/data/temp/{$i} target=_blank>{$i}</a>&nbsp;(" . filesize(ROOT . "data/temp/{$i}") / 1000 . "k)";
         if (preg_match('/JP3/i', $i)) {
             echo '<b><font color=red>(3)</font></b>';
         } elseif (preg_match('/SanJi/i', $i)) {
             echo '<b><font color=red>(3 You Jiang Jie)</font></b>';
         } elseif (preg_match('/JP2/i', $i)) {
             echo '<b><font color=red>(2)</font></b>';
         } elseif (preg_match('/JPYi/i', $i)) {
             echo '<b><font color=red>(1)</font></b>';
         } else {
             echo '<b><font color=red>(You Jiang Jie)</font></b>';
         }
         echo "</li>";
     }
     echo "</ul>";
     exit;
 }
Esempio n. 3
0
 function search_dir($get)
 {
     global $count_hits, $count_files, $my_server, $my_root, $s_dirs, $s_files, $s_skip, $message_1, $message_2, $limit_extracts, $byte_size, $file_info, $end_time;
     while (list($a, $b) = each($get)) {
         // $get handelbarer machen
         ${$a} = $b;
     }
     if (@$action == "SEARCH") {
         // Volltextsuche
         foreach ($s_dirs as $dir) {
             // Alle Verzeichnisse in $s_dirs durchsuchen
             $handle = @opendir($my_root . $dir);
             while ($file = @readdir($handle)) {
                 if (in_array($file, $s_skip)) {
                     // Alles in $skip auslassen
                     continue;
                 } elseif ($count_hits >= 10000) {
                     break;
                     // Maximale Trefferzahl erreicht
                 } elseif (is_dir($my_root . $dir . "/" . $file)) {
                     // Unterverzeichnisse durchsuchen
                     $s_dirs = array("{$dir}/{$file}");
                     search_dir($get);
                     // search_dir() rekursiv auf alle Unterverzeichnisse aufrufen
                 } elseif (preg_match("/(" . str_replace(",", "|", $s_files) . ")\$/i", $file)) {
                     // Alle Dateien gemaess Endungen $s_files
                     $count_files++;
                     $fd = fopen($my_root . $dir . "/" . $file, "r");
                     $text = fread($fd, $byte_size);
                     // Default: ~50 KB
                     $text = strip_tags($text, "<title></title>");
                     // Alle html-/php-tags los werden
                     $do = strstr($text, $keyword);
                     $gk = "";
                     if ($do) {
                         $count_hits++;
                         // Treffer zaehlen
                         $link_title = str_replace(".txt", "", $file);
                         // ...ansonsten $no_title
                         $perpage = 1000;
                         // Ausgabe der Ergebnisses pro Seite
                         if ((@$page == 1 or !isset($page)) and $count_hits <= @$perpage or @$page > 1 and $count_hits > @$page * $perpage - $perpage and $count_hits <= @$page * $perpage) {
                             /* Orginal CODE
                                echo "<a href=\"doxviewer.php?dox=$link_title\" target=\"_blank\" class=\"result\">$count_hits.  $link_title</a><br>"; // Ausgabe des Links
                                echo "<br>";
                                */
                             echo "<tr>";
                             echo "<td>";
                             //adding a 0 to
                             if ($count_hits < 10) {
                                 echo '0' . $count_hits;
                             } else {
                                 echo $count_hits;
                             }
                             echo ". ";
                             echo "<a href=\"index.php?dox={$link_title}\" target=\"_blank\" alt=\"{$link_title}\">{$link_title}</a>";
                             // Ausgabe des Links
                             //Icon Output
                             if (file_exists('img/verification/' . $file)) {
                                 $datestamp = file_get_contents('img/verification/' . $file);
                                 echo ' <img src="img/green-checkbox.png" alt="verification on ' . $datestamp . '" title="verification on ' . $datestamp . '" />';
                             }
                             if (file_exists('img/ssn/' . $file)) {
                                 $datestamp = file_get_contents('img/ssn/' . $file);
                                 echo ' <img src="img/ssn.png" alt="SSN added ' . $datestamp . '" title="SSN added ' . $datestamp . '" />';
                             }
                             if (file_exists('img/rip/' . $file)) {
                                 $datestamp = file_get_contents('img/rip/' . $file);
                                 echo ' <img src="img/rip.png" alt="RIP on ' . $datestamp . '" title="RIP on ' . $datestamp . '" />';
                             }
                             echo '</td>';
                             //the rest of the listing
                             //the date of the file
                             echo '<td>';
                             echo date("m/d/Y", filemtime("dox/{$file}"));
                             echo '</td>';
                             //the time of the file
                             echo '<td>';
                             echo date("H:i:s", filemtime("dox/{$file}"));
                             echo '</td>';
                             //the filesize in KB of the file
                             echo '<td>';
                             $filesize = filesize("dox/{$file}");
                             $file_kb = round($filesize / 1024, 2);
                             echo $file_kb . ' KB';
                             echo '</td>';
                             echo '</tr>';
                             flush();
                         }
                     }
                     fclose($fd);
                 }
             }
             @closedir($handle);
         }
         $end_time = get_microtime();
     }
     echo "</tbody></table>";
 }
 function upload()
 {
     if ($this->is_post() && !empty($_FILES["userfile"])) {
         $uploaddir = ROOT . "../uploadfile/";
         //Copy the file to some permanent location
         $savefile = $_FILES["userfile"]["name"];
         if (copy($_FILES["userfile"]["tmp_name"], $uploaddir . $savefile)) {
             $this->sv("result", 1);
             $this->sv("download", $savefile);
         } else {
             $this->sv("result", 2);
         }
     }
     $filelist = search_dir(ROOT . "../uploadfile/");
     foreach ($filelist as &$i) {
         $i = mb_convert_encoding($i, "UTF-8", 'SJIS');
     }
     $this->sv('list', $filelist);
 }
/**
 * Documentation Search
 * @param  string $dir 	Documentation sections directory
 * @return array 		Array with files, that contain search request value
 */
function search_dir($dir)
{
    global $request, $seen;
    $dirs = array();
    $pages = array();
    $regex = "/" . preg_quote($request, '/') . "/";
    $seen[] = realpath($dir);
    if (is_readable($dir) && ($d = dir($dir))) {
        while (false != ($f = $d->read())) {
            $path = $d->path . '/' . $f;
            if (is_file($path) && is_readable($path)) {
                $realpath = realpath($path);
                if (in_array($realpath, $seen)) {
                    continue;
                } else {
                    $seen[] = $realpath;
                }
                $file = join(' ', file($path));
                if (preg_match($regex, $file)) {
                    if ('json' != substr($path, strrpos($path, '.') + 1)) {
                        $path_array = explode('/', $path);
                        $sect_name = substr($path_array[3], 0, strpos($path_array[3], '.'));
                        if ($sect_name == '__description') {
                            $sect_hash = '';
                        } else {
                            $sect_hash = '#' . $sect_name;
                        }
                        array_push($pages, array('lang' => $path_array[2], 'section' => $path_array[1], 'hash' => $sect_hash));
                    }
                }
            } else {
                if (is_dir($path) && '.' != $f && '..' != $f) {
                    array_push($dirs, $path);
                }
            }
        }
        $d->close();
    }
    foreach ($dirs as $subdir) {
        $realdir = realpath($subdir);
        if (!in_array($realdir, $seen)) {
            $seen[] = $realdir;
            $pages = array_merge($pages, search_dir($subdir));
        }
    }
    return $pages;
}
Esempio n. 6
0
function search_dir($dir, $key, $subdir = "")
{
    $files = array();
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file == "." || $file == "..") {
                continue;
            }
            if (is_dir($dir . $file)) {
                if ($subdir) {
                    $files = array_merge($files, search_dir($dir . $file, $key, $subdir . "/" . $file . "/"));
                } else {
                    $files = array_merge($files, search_dir($dir . $file, $key, $file . "/"));
                }
            } elseif (preg_match('/' . $key . '/', $file)) {
                if ($subdir) {
                    $files[] = $subdir . $file;
                } else {
                    $files[] = $file;
                }
            }
        }
        closedir($dh);
    }
    return $files;
}
 function flist()
 {
     $this->cpa("admin", $this->config["site"]["simplepass"]);
     $files = search_dir("../needtobedelete/");
     echo "<div id=pic></div><br><table border=1>";
     foreach ($files as $i) {
         $filestat = stat("../needtobedelete/{$i}");
         echo "<tr><td>", $filestat['mtime'], "</td><td><a href=# onclick='document.getElementById(\"pic\").innerHTML=\"<img src=/out/dn/{$i}/", md5_make($i), "/?force=1>\";'>preview</td><td>", $i, " (", intval($filestat["size"] / 1024), "K)</td><td><a href=\"/out/dn/{$i}/", md5_make($i), "/\">download</a></td><td><a href=\"/out/dn/{$i}/", md5_make($i), "/?force=1\">direct</a></td><td>", "<a href=\"/out/del/{$i}/\">del</a></td></tr>";
     }
     echo "</table>";
     exit;
 }
Esempio n. 8
0
$_REQUEST = array_merge($_REQUEST, $HTTP_GET_VARS, $HTTP_POST_VARS);
$DOS_HOST = stristr(php_uname(), "Windows");
#-- error_reporting(E_ALL);
error_reporting(0);
set_magic_quotes_runtime(0);
#-- no running nanoweb -> php (only?)
$page = @$_REQUEST["page"];
if (empty($page)) {
    if (strstr(@$HTTP_SERVER_VARS["SERVER_SOFTWARE"], "nanoweb") === false) {
        $page = "PHP/PHP";
    } else {
        $page = "NW/nanoweb";
    }
}
@(list($which, $config_page) = explode("/", $page, 2));
$T = array("NW" => array("CONFIG_DIR" => search_dir(array("/etc/nanoweb", "/usr/etc/nanoweb", "/usr/local/etc/nanoweb", "C:/nanoweb", "C:/Program Files/nanoweb")), "CONFIG_FILE" => "nanoweb.conf", "DEFAULT_SECTION" => "global", "DOCDIR" => $uu = "/doc/nanoweb/html", "DOC" => "{$uu}/index.html", "DOCREF" => "{$uu}/core.html#"), "PHP" => array("CONFIG_DIR" => search_dir(array(dirname(get_cfg_var("cfg_file_path")), "/etc/php4/cli", "/etc/php4/cgi", "/etc/php4/nanoweb", "/etc/php4/apache", "/etc/php/cgi", "/etc/php4", "/etc/php", "/usr/local/etc/php4", "C:/PHP", "C:/PHP4", "C:/Program Files/PHP")), "CONFIG_FILE" => "php.ini", "DEFAULT_SECTION" => "PHP", "DOC" => "http://www.php.net/manual/en/", "DOCREF" => "http://www.php.net/manual/en/configuration.php#ini."));
$DEFAULT_SECTION = $T[$which]["DEFAULT_SECTION"];
# lang-specific output
$D_BOOLEAN["boolean"] = array("No", "Yes");
$D_BOOLEAN["boolvalue"] = array("False", "True");
$D_BOOLEAN["boolpower"] = array("Off", "On");
$D_BOOLEAN["boolstate"] = array("Disabled", "Enabled");
#
#  following arrays hold the structure of the configuration pages
#
$configuration_pages["NW"] = array("nanoweb" => array("html_empty" => ""), "-General" => array("ServerName" => "string", "ServerAlias" => "multiple", "ServerAdmin" => "string", "DocumentRoot", "DirectoryIndex", "DefaultContentType", "SingleProcessMode" => "boolean", "ServerMode" => "standalone|inetd|", "User" => "string", "Group" => "string"), "-Technical" => array("ListenInterface" => "string", "ListenPort" => "string", "ListenQueue" => "string", "KeepAlive" => "string", "RequestTimeout" => "string", "ChildLifeTime" => "string", "MaxServers" => "string", "TempDir" => "string", "StaticBufferSize" => "string"), "-Access Control" => array("ACPolicy" => "|allow|deny", "ACAllowIP" => "multiple", "ACAllowHost" => "multiple", "ACDenyIP" => "multiple", "ACDenyHost" => "multiple", "ACBlockError" => "string", "ACBlockMessage" => "string"), "-.nwaccess" => array("AccessFile" => "string", "AccessPolicy" => "override|merge|block", "AccessOverride" => "multiple", "AccessMerge" => "multiple", "AccessBlock" => "multiple"), "-Mime Types" => array("MimeTypes" => "string", "AddType" => "multiple", "DisableMimeMagic" => "boolvalue"), "-Logging" => array("Log" => "string", "LogDir" => "string", "ServerLog" => "multiple", "HostnameLookups" => "boolstate", "HostnameLookupsBy" => "server|logger|", "PidFile" => "string", "LogHitsToConsole" => "boolean", "LogHitsToServerLog" => "boolean"), "-CGI Setup" => array("ParseExt" => "multiple", "AllowPathInfo" => "boolean", "PathInfoTryExt" => "multiple", "CGIScriptsDir" => "multiple", "CGIScriptNoExec" => "|error|raw", "CGIFilterPathInfo" => "boolean", "FCGIFilterPathInfo" => "boolean"), "-Security" => array("AllowSymlinkTo" => "multiple", "IgnoreDotFiles" => "boolean"), "-Miscellaneous" => array("ConfigDir" => "string", "Alias" => "multiple", "UserDir" => "string", "ErrorDocument" => "multiple", "AddHeader" => "multiple", "AddServerVar" => "multiple", "ServerSignature" => "full|os|php|prod|min|off|fake", "ServerFakeSignature" => "string"), "-Themes" => array("ServerTheme" => "string", "LoadTheme" => "multiple"), "Modules" => array("LoadModule" => "multiple", "ModulesDir" => "string"), "-FileBrowser" => array("FileBrowser" => "boolstate", "FBSortOrder" => "name|size|date|name desc|size desc|date desc", "FBWelcomeFile" => "string", "FBDescFile" => "string", "FBIconDirectory" => "string", "FBIconByType" => "multiple", "FBIconDefault" => "string"), "-Gzip Encoding" => array("GzipEnable" => "boolean", "GzipLevel" => "string", "GzipMaxRatio" => "string"), "-Authentication" => array("html_hr1" => "<hr><br>", "AuthSimpleUserPass" => "multiple", "html_hr2" => "<br><hr><br>", "AuthNwauthFilename" => "string", "html_hr3" => "<br><hr><br>", "AuthHtpasswdFilename" => "string", "html_hr4" => "<br><hr><br>", "AuthMysqlHost" => "string", "AuthMysqlUser" => "string", "AuthMysqlPass" => "string", "AuthMysqlDB" => "string", "AuthMysqlTable" => "string", "AuthMysqlLoginColumn" => "string", "AuthMysqlPassColumn" => "string", "AuthMysqlPassType" => "plain|crypt|md5|mysql", "html_hr5" => "<br><hr><br>", "AuthPgsqlHost" => "string", "AuthPgsqlUser" => "string", "AuthPgsqlPass" => "string", "AuthPgsqlDB" => "string", "AuthPgsqlTable" => "string", "AuthPgsqlLoginColumn" => "string", "AuthPgsqlPassColumn" => "string", "AuthPgsqlPassType" => "plain|md5|", "html_hr6" => "<br><hr><br>", "AuthLDAPServer" => "string", "AuthLDAPBindDN" => "string", "AuthLDAPMatchfilter" => "string", "html_last_hr" => "<br><hr><br>"), "-Mispell" => array("MispellAction" => "|advice|redirect"), "-MultiViews" => array("LanguagePriority" => "string", "OtherPriority" => "multiple", "ReflectRewriting" => "boolean"), "-Status" => array("StatusAllowHost" => "multiple"), "-StdoutLog" => array("LogHitsToConsole" => "boolean", "LogHitsToServerLog" => "boolean"), "-MySQL Logging" => array("MySQLLogHost" => "string", "MySQLLogDatabase" => "string", "MySQLLogUser" => "string", "MySQLLogPassword" => "string"), "-Proxy" => array("ProxyAllowIP" => "multiple", "ProxyAccessLog" => "string", "ProxyCacheDir" => "string", "ProxyCacheMaxAge" => "string", "ProxyDenySite" => "string", "ProxyDenyPopup" => "string", "ProxyDenyPup" => "string"), "-LoadLimit" => array("LoadLimit" => "string", "LoadLimitError" => "string", "LoadLimitErrorMessage" => "string", "LoadLimitAction" => "|error|redir", "LoadLimitRedirect" => "string"), "-Brainfuck" => array("BSPAllowSource" => "boolean"), "-DoS Evasive" => array("DosEvasiveTimer" => "string", "DosEvasiveMaxReqs" => "string", "DosEvasiveError" => "string"), "Virtual Hosts" => array("html_empty" => ""));
$configuration_pages["PHP"] = array("PHP" => array("engine" => "magic", "expose_php" => "magic", "short_open_tag" => "auto", "asp_tags" => "auto", "default_mimetype" => "string", "default_charset" => "string"), "-Files/Paths" => array("include_path" => "string", "auto_prepend_file" => "string", "auto_append_file" => "string", "allow_url_fopen", "doc_root" => "string", "user_dir" => "string", "extension_dir" => "string"), "-Variables" => array("register_globals" => "auto", "variables_order" => "string", "register_argc_argv" => "auto", "precision" => "string", "magic_quotes_gpc" => "magic", "magic_quotes_runtime" => "magic", "magic_quotes_sybase" => "magic"), "-Output" => array("output_buffering" => "Off|On|1024|2048|4096|8192|16384|32768", "output_handler" => "string", "zlib.output_compression" => "boolpower", "implicit_flush" => "auto"), "-Safe Mode" => array("safe_mode" => "auto", "safe_mode_gid" => "auto", "safe_mode_include_dir" => "string", "safe_mode_exec_dir" => "string", "safe_mode_allowed_env_vars" => "string", "safe_mode_protected_env_vars" => "string", "disable_functions" => "string", "enable_dl" => "auto"), "-Errors/Log" => array("error_reporting" => "string", "display_errors" => "auto", "display_startup_errors" => "auto", "html_errors" => "auto", "log_errors" => "auto", "track_errors" => "auto", "error_log" => "string", "warn_plus_overloading" => "auto", "allow_call_time_pass_reference" => "auto"), "-CGI" => array("cgi.force_redirect" => "boolean", "cgi.fix_pathinfo" => "boolean", "cgi.rfc2616_headers" => "boolean"), "-Misc" => array("memory_limit" => "string", "max_execution_time" => "string", "post_max_size" => "string", "file_uploads", "upload_max_filesize", "from", "y2k_compliance"), "Extensions" => array("extension" => "multiple", "extension_dir" => "string"));
####    ####   ###########   ####         ############
####    ####   ###########   ####         #############
####    ####   ####          ####         ####     ####
####    ####   ####          ####         ####     ####