read()) { if ($entry != "." && $entry != "..") { if (is_dir($dirName."/".$entry)) { if ($entry == 'CVS') { // skip } else { getDirList($dirName."/".$entry); } } else { if (substr($entry, strrpos($entry, '.')) == $file_extension) { //echo 'I AM HERE 2 ' . $dirName."/".$entry . '
'; // $directory_array[] .= $dirName."/".$entry; } else { //echo 'I AM HERE 3 ' . $dirName."/".$entry . '
'; } } } } $d->close(); } return $sub_dir_files; } function zen_display_files($include_root = false) { global $check_directory, $found, $configuration_key_lookup; global $db; for ($i = 0, $n = sizeof($check_directory); $i < $n; $i++) { //echo 'I SEE ' . $check_directory[$i] . '
'; $dir_check = $check_directory[$i]; $file_extension = '.php'; if ($dir = @dir($dir_check)) { while ($file = $dir->read()) { if (!is_dir($dir_check . $file)) { if (substr($file, strrpos($file, '.')) == $file_extension) { $directory_array[] = $dir_check . $file; } } } if (sizeof($directory_array)) { sort($directory_array); } $dir->close(); } } if ($include_root == true) { $original_array = $directory_array; $root_array = array(); $root_array[] = DIR_FS_CATALOG . 'index.php'; $root_array[] = DIR_FS_CATALOG . 'ipn_main_handler.php'; $root_array[] = DIR_FS_CATALOG . 'ipn_test.php'; $root_array[] = DIR_FS_CATALOG . 'ipn_test_return.php'; $root_array[] = DIR_FS_CATALOG . 'nddbc.html'; $root_array[] = DIR_FS_CATALOG . 'page_not_found.php'; $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; $check_configure = $db->Execute("select * from " . TABLE_CONFIGURATION . " where configuration_key='" . strtoupper($configuration_key_lookup) . "'"); if ($check_configure->RecordCount() < 1) { $check_configure = $db->Execute("select * from " . TABLE_PRODUCT_TYPE_LAYOUT . " where configuration_key='" . strtoupper($configuration_key_lookup) . "'"); } 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 '' . "\n"; if ($check_database == true && $check_configure->RecordCount() >= 1) { // only ask if found echo ''; } echo '
' . $links . '
' . '     ' . TEXT_INFO_SEARCHING . sizeof($directory_array) . TEXT_INFO_FILES_FOR . $configuration_key_lookup . '
' . "\n\n"; echo ' '; // check all files located $file_cnt = 0; $cnt_found=0; for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++) { // build file content of matching lines $file_cnt++; $file = $directory_array[$i]; //echo 'I SEE ' . $directory_array[$i] . '
'; // clean path name while (strstr($file, '//')) $file = str_replace('//', '/', $file); $show_file = ''; if (file_exists($file)) { $show_file .= "\n" . ''; $show_file .= '
' . "\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 foreach ($lines as $line_num => $line) { $cnt_lines++; if (strstr(strtoupper($line), strtoupper($configuration_key_lookup))) { $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); $show_file .= "
\n"; } else { if ($cnt_lines >= 5) { // $show_file .= ' .'; $cnt_lines=0; } } } } $show_file .= '
' . "\n"; // if there was a match, show lines if ($found_line == 'true') { echo $show_file . '
 
'; } // show file } echo '
' . TEXT_INFO_MATCHES_FOUND . $cnt_found . '
'; } // zen_display_files $products_filter = (isset($_GET['products_filter']) ? $_GET['products_filter'] : $products_filter); $action = (isset($_GET['action']) ? $_GET['action'] : ''); // don't do any 'action' if clicked on the Check for Updates button if (isset($_GET['vcheck']) && $_GET['vcheck']=='yes') $action = ''; $current_category_id = (isset($_GET['current_category_id']) ? $_GET['current_category_id'] : $current_category_id); $found= 'true'; switch($action) { case ('locate_configuration'): if ($configuration_key_lookup == '') { $messageStack->add_session(ERROR_CONFIGURATION_KEY_NOT_ENTERED, 'caution'); zen_redirect(zen_href_link(FILENAME_DEVELOPERS_TOOL_KIT)); } $found = 'false'; $zv_files_group = $_POST['zv_files']; $check_configure = $db->Execute("select * from " . TABLE_CONFIGURATION . " where configuration_key='" . $_POST['configuration_key'] . "'"); if ($check_configure->RecordCount() < 1) { $check_configure = $db->Execute("select * from " . TABLE_PRODUCT_TYPE_LAYOUT . " where configuration_key='" . $_POST['configuration_key'] . "'"); if ($check_configure->RecordCount() < 1) { // build filenames to search switch ($zv_files_group) { case (0): // none $filename_listing = ''; break; case (1): // all english.php files $check_directory = array(); $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/'; $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $template_dir . '/' . $_SESSION['language'] . '/'; $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/' . $template_dir . '/'; $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/extra_definitions/'; $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/extra_definitions/' . $template_dir . '/'; $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/modules/payment/'; $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/modules/shipping/'; $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/modules/order_total/'; $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/modules/product_types/'; $check_directory[] = DIR_FS_ADMIN . DIR_WS_LANGUAGES . $_SESSION['language'] . '/'; $check_directory[] = DIR_FS_ADMIN . DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/newsletters/'; break; case (2): // all catalog /language/*.php $check_directory = array(); $check_directory[] = DIR_FS_CATALOG_LANGUAGES; break; case (3): // all catalog /language/english/*.php $check_directory = array(); $check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/'; break; case (4): // all admin /language/*.php $check_directory = array(); $check_directory[] = DIR_FS_ADMIN . DIR_WS_LANGUAGES; break; case (5): // all admin /language/english/*.php // set directories and files names $check_directory = array(); $check_directory[] = DIR_FS_ADMIN . DIR_WS_LANGUAGES . $_SESSION['language'] . '/'; break; } // eof: switch // Check for new databases and filename in extra_datafiles directory zen_display_files(); } else { $show_products_type_layout = 'true'; $show_configuration_info = 'true'; $found = 'true'; } } else { $show_products_type_layout = 'false'; $show_configuration_info = 'true'; $found = 'true'; } break; case ('locate_function'): if ($configuration_key_lookup == '') { $messageStack->add_session(ERROR_CONFIGURATION_KEY_NOT_ENTERED, 'caution'); zen_redirect(zen_href_link(FILENAME_DEVELOPERS_TOOL_KIT)); } $found = 'false'; $zv_files_group = $_POST['zv_files']; // build filenames to search switch ($zv_files_group) { case (0): // none $filename_listing = ''; break; case (1): // all admin/catalog function files $check_directory = array(); $check_directory[] = DIR_FS_CATALOG . DIR_WS_FUNCTIONS; $check_directory[] = DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'extra_functions/'; $check_directory[] = DIR_FS_ADMIN . DIR_WS_FUNCTIONS; $check_directory[] = DIR_FS_ADMIN . DIR_WS_FUNCTIONS . 'extra_functions/'; break; case (2): // all catalog function files $check_directory = array(); $check_directory[] = DIR_FS_CATALOG . DIR_WS_FUNCTIONS; $check_directory[] = DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'extra_functions/'; break; case (3): // all admin function files $check_directory = array(); $check_directory[] = DIR_FS_ADMIN . DIR_WS_FUNCTIONS; $check_directory[] = DIR_FS_ADMIN . DIR_WS_FUNCTIONS . 'extra_functions/'; break; } // eof: switch // Check for new databases and filename in extra_datafiles directory zen_display_files(); break; case ('locate_class'): if ($configuration_key_lookup == '') { $messageStack->add_session(ERROR_CONFIGURATION_KEY_NOT_ENTERED, 'caution'); zen_redirect(zen_href_link(FILENAME_DEVELOPERS_TOOL_KIT)); } $found = 'false'; $zv_files_group = $_POST['zv_files']; // build filenames to search switch ($zv_files_group) { case (0): // none $filename_listing = ''; break; case (1): // all admin/catalog classes files $check_directory = array(); $check_directory[] = DIR_FS_CATALOG . DIR_WS_CLASSES; $check_directory[] = DIR_FS_ADMIN . DIR_WS_CLASSES; break; case (2): // all catalog classes files $check_directory = array(); $check_directory[] = DIR_FS_CATALOG . DIR_WS_CLASSES; break; case (3): // all admin function files $check_directory = array(); $check_directory[] = DIR_FS_ADMIN . DIR_WS_CLASSES; break; } // eof: switch // Check for new databases and filename in extra_datafiles directory zen_display_files(); break; case ('locate_template'): if ($configuration_key_lookup == '') { $messageStack->add_session(ERROR_CONFIGURATION_KEY_NOT_ENTERED, 'caution'); zen_redirect(zen_href_link(FILENAME_DEVELOPERS_TOOL_KIT)); } $found = 'false'; $zv_files_group = $_POST['zv_files']; // build filenames to search switch ($zv_files_group) { case (0): // none $filename_listing = ''; break; case (1): // all template files $check_directory = array(); $check_directory[] = DIR_FS_CATALOG_TEMPLATES . 'template_default/templates' . '/'; $check_directory[] = DIR_FS_CATALOG_TEMPLATES . 'template_default/sideboxes' . '/'; $check_directory[] = DIR_FS_CATALOG_MODULES; $check_directory[] = DIR_FS_CATALOG_MODULES . 'sideboxes/'; $check_directory[] = DIR_FS_CATALOG_TEMPLATES . $template_dir . '/templates' . '/'; $check_directory[] = DIR_FS_CATALOG_TEMPLATES . $template_dir . '/sideboxes' . '/'; $sub_dir_files = array(); getDirList(DIR_FS_CATALOG_MODULES . 'pages'); $check_dir = array_merge($check_directory, $sub_dir_files); for ($i = 0, $n = sizeof($check_dir); $i < $n; $i++) { $check_directory[] = $check_dir[$i] . '/'; } break; case (2): // all /templates files $check_directory = array(); $check_directory[] = DIR_FS_CATALOG_TEMPLATES . 'template_default/templates' . '/'; $check_directory[] = DIR_FS_CATALOG_TEMPLATES . $template_dir . '/templates' . '/'; break; case (3): // all sideboxes files $check_directory = array(); $check_directory[] = DIR_FS_CATALOG_TEMPLATES . 'template_default/sideboxes' . '/'; $check_directory[] = DIR_FS_CATALOG_MODULES . 'sideboxes/'; $check_directory[] = DIR_FS_CATALOG_TEMPLATES . $template_dir . '/sideboxes' . '/'; break; case (4): // all /pages files $check_directory = array(); //$check_directory[] = DIR_FS_CATALOG_MODULES . 'pages/'; $sub_dir_files = array(); getDirList(DIR_FS_CATALOG_MODULES . 'pages'); $check_dir = array_merge($check_directory, $sub_dir_files); for ($i = 0, $n = sizeof($check_dir); $i < $n; $i++) { $check_directory[] = $check_dir[$i] . '/'; } break; } // eof: switch // Check for new databases and filename in extra_datafiles directory zen_display_files(); break; /// all files case ('locate_all_files'): $zv_check_root = false; if ($configuration_key_lookup == '') { $messageStack->add_session(ERROR_CONFIGURATION_KEY_NOT_ENTERED, 'caution'); zen_redirect(zen_href_link(FILENAME_DEVELOPERS_TOOL_KIT)); } $found = 'false'; $zv_files_group = $_POST['zv_files']; //echo 'Who am I template ' . $template_dir . ' sess lang ' . $_SESSION['language']; switch ($zv_files_group) { case (0): // none $filename_listing = ''; break; case (1): // all $zv_check_root = true; $filename_listing = ''; $check_directory = array(); $sub_dir_files = array(); getDirList(DIR_FS_CATALOG . DIR_WS_INCLUDES); $sub_dir_files_catalog = $sub_dir_files; $sub_dir_files = array(); getDirList(DIR_FS_ADMIN); $sub_dir_files_admin= $sub_dir_files; $check_dir = array_merge($sub_dir_files_catalog, $sub_dir_files_admin); for ($i = 0, $n = sizeof($check_dir); $i < $n; $i++) { $check_directory[] = $check_dir[$i] . '/'; } break; case (2): // all catalog $zv_check_root = true; $filename_listing = ''; $check_directory = array(); $sub_dir_files = array(); getDirList(DIR_FS_CATALOG . DIR_WS_INCLUDES); $sub_dir_files_catalog = $sub_dir_files; $check_dir = array_merge($sub_dir_files_catalog); for ($i = 0, $n = sizeof($check_dir); $i < $n; $i++) { $zv_add_dir= str_replace('//', '/', $check_dir[$i] . '/'); if (strstr($zv_add_dir, DIR_WS_ADMIN) == '') { $check_directory[] = $zv_add_dir; } } break; case (3): // all admin $zv_check_root = false; $filename_listing = ''; $check_directory = array(); $sub_dir_files = array(); getDirList(DIR_FS_ADMIN); $sub_dir_files_admin = $sub_dir_files; $check_dir = array_merge($sub_dir_files_admin); for ($i = 0, $n = sizeof($check_dir); $i < $n; $i++) { $check_directory[] = $check_dir[$i] . '/'; } break; } zen_display_files($zv_check_root); break; } // eof: action // if no matches in either databases or selected language directory give an error if ($found == 'false') { $messageStack->add(ERROR_CONFIGURATION_KEY_NOT_FOUND . ' ' . $configuration_key_lookup, 'caution'); } elseif ($action != '') { echo '
' . zen_draw_separator('pixel_black.gif', '100%', '2') . '
 
' . "\n"; } ?> > <?php echo TITLE; ?>
Execute("select * from " . TABLE_PRODUCT_TYPES . " where type_id='" . $check_configure->fields['product_type_id'] . "'"); } else { $check_configure_group = $db->Execute("select * from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_id='" . $check_configure->fields['configuration_group_id'] . "'"); } ?>
fields['configuration_key']; ?>
fields['configuration_title']; ?>
fields['configuration_description']; ?>
fields['configuration_value']; ?>
fields['configuration_group_id'] == '6') { $id_note = TEXT_INFO_CONFIGURATION_HIDDEN; } else { $id_note = ''; } echo 'ID#' . $check_configure_group->fields['configuration_group_id'] . ' ' . $check_configure_group->fields['configuration_group_title'] . $id_note; ?>
fields['configuration_id'] != 0 and $check_configure->fields['configuration_group_id'] != 6)) { echo '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . ''; } else { $page= ''; if (strstr($check_configure->fields['configuration_key'], 'MODULE_SHIPPING')) $page .= 'shipping'; if (strstr($check_configure->fields['configuration_key'], 'MODULE_PAYMENT')) $page .= 'payment'; if (strstr($check_configure->fields['configuration_key'], 'MODULE_ORDER_TOTAL')) $page .= 'ordertotal'; if ($show_products_type_layout == 'true') { echo '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . ''; } else { if ($page != '') { echo '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . ''; } else { echo TEXT_INFO_NO_EDIT_AVAILABLE . '
'; } } } ?>
' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''; ?>
' . TEXT_SEARCH_ALL_FILES . ' ' . '' . $configuration_key_lookup . '
'; echo $links; ?>

' . zen_image_button('button_update.gif', IMAGE_UPDATE) . ''; ?>

' . TEXT_CONFIGURATION_KEY . '' . '
' . zen_draw_input_field('configuration_key'); ?>
'0', 'text' => TEXT_LOOKUP_NONE), array('id' => '1', 'text' => TEXT_LANGUAGE_LOOKUP_CURRENT_LANGUAGE), array('id' => '2', 'text' => TEXT_LANGUAGE_LOOKUP_CURRENT_CATALOG), array('id' => '3', 'text' => TEXT_LANGUAGE_LOOKUP_CURRENT_CATALOG_TEMPLATE), array('id' => '4', 'text' => TEXT_LANGUAGE_LOOKUP_CURRENT_ADMIN), array('id' => '5', 'text' => TEXT_LANGUAGE_LOOKUP_CURRENT_ADMIN_LANGUAGE) ); // array('id' => '6', 'text' => TEXT_LANGUAGE_LOOKUP_CURRENT_ALL) echo '' . TEXT_LANGUAGE_LOOKUPS . '' . '
' . zen_draw_pull_down_menu('zv_files', $za_lookup, '0'); ?>

' . TEXT_CONFIGURATION_KEY . '' . '
' . zen_draw_input_field('configuration_key'); ?>
'0', 'text' => TEXT_LOOKUP_NONE), array('id' => '1', 'text' => TEXT_FUNCTION_LOOKUP_CURRENT), array('id' => '2', 'text' => TEXT_FUNCTION_LOOKUP_CURRENT_CATALOG), array('id' => '3', 'text' => TEXT_FUNCTION_LOOKUP_CURRENT_ADMIN) ); // array('id' => '6', 'text' => TEXT_LANGUAGE_LOOKUP_CURRENT_ALL) echo '' . TEXT_FUNCTION_LOOKUPS . '' . '
' . zen_draw_pull_down_menu('zv_files', $za_lookup, '0'); ?>

' . TEXT_CONFIGURATION_KEY . '' . '
' . zen_draw_input_field('configuration_key'); ?>
'0', 'text' => TEXT_LOOKUP_NONE), array('id' => '1', 'text' => TEXT_CLASS_LOOKUP_CURRENT), array('id' => '2', 'text' => TEXT_CLASS_LOOKUP_CURRENT_CATALOG), array('id' => '3', 'text' => TEXT_CLASS_LOOKUP_CURRENT_ADMIN) ); // array('id' => '6', 'text' => TEXT_LANGUAGE_LOOKUP_CURRENT_ALL) echo '' . TEXT_CLASS_LOOKUPS . '' . '
' . zen_draw_pull_down_menu('zv_files', $za_lookup, '0'); ?>

' . TEXT_CONFIGURATION_KEY . '' . '
' . zen_draw_input_field('configuration_key'); ?>
'0', 'text' => TEXT_LOOKUP_NONE), array('id' => '1', 'text' => TEXT_TEMPLATE_LOOKUP_CURRENT), array('id' => '2', 'text' => TEXT_TEMPLATE_LOOKUP_CURRENT_TEMPLATES), array('id' => '3', 'text' => TEXT_TEMPLATE_LOOKUP_CURRENT_SIDEBOXES), array('id' => '4', 'text' => TEXT_TEMPLATE_LOOKUP_CURRENT_PAGES) ); // array('id' => '6', 'text' => TEXT_LANGUAGE_LOOKUP_CURRENT_ALL) echo '' . TEXT_TEMPLATE_LOOKUPS . '' . '
' . zen_draw_pull_down_menu('zv_files', $za_lookup, '0'); ?>

' . TEXT_CONFIGURATION_KEY . '' . '
' . zen_draw_input_field('configuration_key'); ?>
'0', 'text' => TEXT_LOOKUP_NONE), array('id' => '1', 'text' => TEXT_ALL_FILES_LOOKUP_CURRENT), array('id' => '2', 'text' => TEXT_ALL_FILES_LOOKUP_CURRENT_CATALOG), array('id' => '3', 'text' => TEXT_ALL_FILES_LOOKUP_CURRENT_ADMIN) ); echo '' . TEXT_ALL_FILES_LOOKUPS . '' . '
' . zen_draw_pull_down_menu('zv_files', $za_lookup, '0'); ?>
' . zen_draw_separator('pixel_black.gif', '100%', '2'); ?>