If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / Can I modify Developers Toolkit to search files in other directories outside just ZC?

Can I modify Developers Toolkit to search files in other directories outside just ZC?

Started by enzo_ita on 5 May 2014, 5:53 PM · Views: 1,251

Results 1 to 10 of 10
5 May 2014, 5:53 PM
#1
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Can I modify Developers Toolkit to search files in other directories outside just ZC?

Hi,
I may sound crazy but I am using the developers tool kit to look up for specific strings like for instance $xxxvvv but it returns 0 results.
The php file were $xxxvvv is located is in a dir that is not part of the orginal zen cart dir set, I can open it and see the $xxxvvv written in the code.
Another question is: If I want to look up something in a file that has tpl as extension is it possible?
thanks
ciao from Italy.
enzo

5 May 2014, 7:01 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Can I modify Developers Toolkit to search files in other directories outside just ZC?

You might try just looking up part of the string, like 'xxvv'. I don't believe the DTK will search in files with a .tpl extension.

5 May 2014, 7:40 PM
#3
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Re: Can I modify Developers Toolkit to search files in other directories outside just ZC?

Thank Steve but I have already tried all the possible combinations, but no way. I came to the conclusion that maybe the particular dir is somehow protected in order to avoid reverse engineering on the code.
What do you think about?
ciao form Italy
enzo

5 May 2014, 7:47 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,140
Plugin Contributions:
56

Re: Can I modify Developers Toolkit to search files in other directories outside just ZC?

I've not looked at adding file extensions to the search, but I've got an imbedded WordPress blog on my site and wanted to use the DTK to search in the WordPress files too. I made the following change to /YOUR_ADMIN/developers_tool_kit.php to accomplish that:

/// 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'];
      $zv_filestype_group = $_POST['zv_filestype'];
//echo 'settings: ' . '$zv_files_group: ' . $zv_files_group . '$zv_filestype_group: ' . $zv_filestype_group . '<br>';
//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();

// get includes
          $sub_dir_files = array();
          getDirList(DIR_FS_CATALOG . DIR_WS_INCLUDES, $zv_filestype_group);
          $sub_dir_files_catalog = $sub_dir_files;

// get email
          $sub_dir_files = array();
          getDirList(DIR_FS_EMAIL_TEMPLATES, $zv_filestype_group);
          $sub_dir_files_email = $sub_dir_files;

// get admin
          $sub_dir_files = array();
          getDirList(DIR_FS_ADMIN, $zv_filestype_group);
          $sub_dir_files_admin= $sub_dir_files;

          $check_dir = array_merge($sub_dir_files_catalog, $sub_dir_files_email, $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, $zv_filestype_group);
          $sub_dir_files_catalog = $sub_dir_files;

// get email
          $sub_dir_files = array();
          getDirList(DIR_FS_EMAIL_TEMPLATES, $zv_filestype_group);
          $sub_dir_files_email = $sub_dir_files;

// get wordpress
          $sub_dir_files = array();
          getDirList(DIR_FS_CATALOG . 'wordpress/', $zv_filestype_group);
          $sub_dir_files_wp = $sub_dir_files;

          $check_dir = array_merge($sub_dir_files_catalog, $sub_dir_files_email, $sub_dir_files_wp);
          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 = '';
5 May 2014, 8:09 PM
#5
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Re: Can I modify Developers Toolkit to search files in other directories outside just ZC?

Thanks lat9
I have added the code in this way_

// get mydir
$sub_dir_files = array();
getDirList(DIR_FS_CATALOG . 'mydir/', $zv_filestype_group);
$sub_dir_files_mydir = $sub_dir_files;

but it does not work.

I think that the problem stays in this part:

$sub_dir_files_mydir = $sub_dir_files;

but I do not know what to put in place of mydir.

Thanks again for your help.
ciao from Italy
enzo

6 May 2014, 11:34 AM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,140
Plugin Contributions:
56

Re: Can I modify Developers Toolkit to search files in other directories outside just ZC?

enzo-ita:

Thanks lat9
I have added the code in this way_

// get mydir
$sub_dir_files = array();
getDirList(DIR_FS_CATALOG . 'mydir/', $zv_filestype_group);
$sub_dir_files_mydir = $sub_dir_files;

but it does not work.

I think that the problem stays in this part:

$sub_dir_files_mydir = $sub_dir_files;

but I do not know what to put in place of mydir.

Thanks again for your help.
ciao from Italy
enzo
That's because (duh!) I didn't highlight all of the changed lines. I've highlighted below in **bold **the one I missed above. Sorry about that.

/// 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'];
      $zv_filestype_group = $_POST['zv_filestype'];
//echo 'settings: ' . '$zv_files_group: ' . $zv_files_group . '$zv_filestype_group: ' . $zv_filestype_group . '<br>';
//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();

// get includes
          $sub_dir_files = array();
          getDirList(DIR_FS_CATALOG . DIR_WS_INCLUDES, $zv_filestype_group);
          $sub_dir_files_catalog = $sub_dir_files;

// get email
          $sub_dir_files = array();
          getDirList(DIR_FS_EMAIL_TEMPLATES, $zv_filestype_group);
          $sub_dir_files_email = $sub_dir_files;

// get admin
          $sub_dir_files = array();
          getDirList(DIR_FS_ADMIN, $zv_filestype_group);
          $sub_dir_files_admin= $sub_dir_files;

          $check_dir = array_merge($sub_dir_files_catalog, $sub_dir_files_email, $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, $zv_filestype_group);
          $sub_dir_files_catalog = $sub_dir_files;

// get email
          $sub_dir_files = array();
          getDirList(DIR_FS_EMAIL_TEMPLATES, $zv_filestype_group);
          $sub_dir_files_email = $sub_dir_files;

// get wordpress
          $sub_dir_files = array();
          getDirList(DIR_FS_CATALOG . 'wordpress/', $zv_filestype_group);
          $sub_dir_files_wp = $sub_dir_files;

         [B] $check_dir = array_merge($sub_dir_files_catalog, $sub_dir_files_email, $sub_dir_files_wp);[/B]
          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 = '';
6 May 2014, 10:11 PM
#7
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Re: Can I modify Developers Toolkit to search files in other directories outside just ZC?

Hi,
I notced that part of the mod was not higligted and what I did is:

// get mydir
$sub_dir_files = array();
getDirList(DIR_FS_CATALOG . 'mydir/', $zv_filestype_group);
$sub_dir_files_mydir = $sub_dir_files;
$check_dir = array_merge($sub_dir_files_catalog, $sub_dir_files_email, $sub_dir_files_mydir);

but is does not work.
ciao

7 May 2014, 2:59 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,140
Plugin Contributions:
56

Re: Can I modify Developers Toolkit to search files in other directories outside just ZC?

Where in your Zen Cart directory is mydir? With the sample construct, it should be at the same level as the includes and YOUR_ADMIN directories.

7 May 2014, 4:59 PM
#9
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Re: Can I modify Developers Toolkit to search files in other directories outside just ZC?

Yes it is under public_html exactly like the includes.
Thanks
ciao
enzo

7 May 2014, 7:52 PM
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,140
Plugin Contributions:
56

Re: Can I modify Developers Toolkit to search files in other directories outside just ZC?

Possibly .htaccess restrictions blocking the access?