read()) {
if ($entry != "." && $entry != "..") {
if (is_dir($dirName."/".$entry)) {
if ($entry == 'CVS') {
// skip
} else {
getDirList($dirName."/".$entry);
}
} else {
if (preg_match('/\\' . $file_extension . '$/', $entry) > 0) {
//echo 'I AM HERE 2 ' . $dirName."/".$entry . '
';
// $directory_array[] .= $dirName."/".$entry;
} else {
//echo 'I AM HERE 3 ' . $dirName."/".$entry . '
';
}
}
}
}
$d->close();
unset($d);
}
return $sub_dir_files;
}
function zen_display_files($include_root = false, $filetypesincluded = 1) {
global $check_directory, $found, $configuration_key_lookup;
global $db;
$directory_array = array();
for ($i = 0, $n = sizeof($check_directory); $i < $n; $i++) {
//echo 'I SEE ' . $check_directory[$i] . '
';
$dir_check = $check_directory[$i];
switch($filetypesincluded) {
case(1):
$file_extensions = array('.php');
break;
case(2):
$file_extensions = array('.php', '.css');
break;
case(3):
$file_extensions = array('.css');
break;
case(4):
$file_extensions = array('.html', '.txt');
break;
case(5):
$file_extensions = array('.js');
break;
default:
$file_extensions = array('.php', '.css');
break;
}
if ($dir = @dir($dir_check)) {
while ($file = $dir->read()) {
if (!is_dir($dir_check . $file)) {
foreach($file_extensions as $extension) {
if (preg_match('/\\' . $extension . '$/', $file) > 0) {
$directory_array[] = $dir_check . $file;
}
}
}
}
if (sizeof($directory_array)) {
sort($directory_array);
}
$dir->close();
unset($dir);
}
}
if ($include_root == true) {
$original_array = $directory_array;
$root_array = array();
// if not html/txt
if ($filetypesincluded != 3 && $filetypesincluded != 4 && $filetypesincluded != 5) {
$root_array[] = DIR_FS_CATALOG . 'index.php';
$root_array[] = DIR_FS_CATALOG . 'ipn_main_handler.php';
$root_array[] = DIR_FS_CATALOG . 'page_not_found.php';
}
$root_array[] = DIR_FS_CATALOG . 'nddbc.html';
$new_array = array_merge($root_array, $original_array);
$directory_array = $new_array;
}
// show path and filename
if (strtoupper($configuration_key_lookup) == $configuration_key_lookup) {
while (strstr($configuration_key_lookup, '"')) $configuration_key_lookup = str_replace('"', '', $configuration_key_lookup);
while (strstr($configuration_key_lookup, "'")) $configuration_key_lookup = str_replace("'", '', $configuration_key_lookup);
// if appears to be a constant ask about configuration table
$check_database = true;
$sql = "select * from " . TABLE_CONFIGURATION . " where configuration_key=:zcconfigkey:";
$sql = $db->BindVars($sql, ':zcconfigkey:', strtoupper($configuration_key_lookup), 'string');
$check_configure = $db->Execute($sql);
if ($check_configure->RecordCount() < 1) {
$sql = "select * from " . TABLE_PRODUCT_TYPE_LAYOUT . " where configuration_key=:zcconfigkey:";
$sql = $db->BindVars($sql, ':zcconfigkey:', strtoupper($configuration_key_lookup), 'string');
$check_configure = $db->Execute($sql);
}
if ($check_configure->RecordCount() >= 1) {
$links = '' . TEXT_SEARCH_DATABASE_TABLES . ' ' . '' . $configuration_key_lookup . '
';
} else {
// do nothing
}
} else {
// don't ask about configuration table
}
//die('I SEE ' . $check_configure->RecordCount() . ' vs ' . $check_database);
echo '
' . $links . ' |
' . ' ' . TEXT_INFO_SEARCHING . sizeof($directory_array) . TEXT_INFO_FILES_FOR . $configuration_key_lookup . ' |
' . "\n"; $show_file .= ' |
'; $show_file .= '' . $file . ''; $show_file .= ' |
';
// put file into an array to be scanned
$lines = file($file);
$found_line = 'false';
// loop through the array, show line and line numbers
$cnt_lines = 0;
foreach ($lines as $line_num => $line) {
$cnt_lines++;
if (isset($_POST['case_sensitive']) && $_POST['case_sensitive']) {
$check_case = strstr($line, $configuration_key_lookup);
} else {
// BOM by zen-cart.cn
$check_case = strstr(GBcase($line,"upper"), GBcase($configuration_key_lookup,"upper"));
// EOM by zen-cart.cn
}
if ($check_case) {
$found_line= 'true';
$found = 'true';
$cnt_found++;
$show_file .= " Line #{$line_num} : " ; //prevent db pwd from being displayed, for sake of security $show_file .= (substr_count($line,"'DB_SERVER_PASSWORD'")) ? '***HIDDEN***' : htmlspecialchars($line, ENT_QUOTES, CHARSET); $show_file .= " \n"; } else { if ($cnt_lines >= 5) { // $show_file .= ' .'; $cnt_lines=0; } } } } $show_file .= ' |
' . TEXT_INFO_MATCHES_FOUND . $cnt_found . ' |
' . zen_draw_separator('pixel_black.gif', '100%', '2') . ' |
|