diff --git a/e107_admin/fileinspector.php b/e107_admin/fileinspector.php index a30024945..184646d98 100644 --- a/e107_admin/fileinspector.php +++ b/e107_admin/fileinspector.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/fileinspector.php,v $ -| $Revision: 1.5 $ -| $Date: 2006-12-19 13:49:29 $ +| $Revision: 1.6 $ +| $Date: 2006-12-19 18:00:20 $ | $Author: sweetas $ +----------------------------------------------------------------------------+ */ @@ -37,6 +37,20 @@ foreach ($maindirs as $maindirs_key => $maindirs_value) { require_once('core_image.php'); +$handle = opendir(e_PLUGIN); +while (false !== ($readdir = readdir($handle))) { + if ($readdir != '.' && $readdir != '..' && $readdir != '/' && $readdir != 'CVS' && $readdir != 'Thumbs.db' && (strpos('._', $readdir) === FALSE)) { + if (is_dir(e_PLUGIN.$readdir)) { + if (is_readable(e_PLUGIN.$readdir.'/e_inspect.php')) { + include_once(e_PLUGIN.$readdir.'/e_inspect.php'); + } + } + } +} +closedir($handle); + +ksort($core_image[$coredir['plugins']]); + if (e_QUERY) { $fi -> snapshot_interface(); } else if (isset($_POST['scan'])) { @@ -287,7 +301,7 @@ class file_inspector { } else { //if (strpos($dir.'/'.$key, 'htmlarea') === false) { if ($_POST['integrity']) { - if ($dir.'/'.$key != $this -> root_dir.'/'.$coredir['admin'].'/core_image.php' && $dir.'/'.$key != $this -> root_dir.'/e107_config.php') { + if ($dir.'/'.$key != $this -> root_dir.'/'.$coredir['admin'].'/core_image.php' && $key != 'e_inspect.php' && $dir.'/'.$key != $this -> root_dir.'/e107_config.php') { if ($this -> checksum($path) != $value) { $this -> count['fail']['num']++; $this -> count['fail']['size'] += $this -> files[$dir_id][$fid]['size']; @@ -615,8 +629,12 @@ class file_inspector { $ns -> tablerender(FR_LAN_1.'...', $text); } - function create_image($dir) { - global $core_image, $deprecated_image, $coredir; + function create_image($dir, $plugin) { + global $core_image, $deprecated_image, $coredir, $plugin_image, $plugin_deprecated_image, $PLUGINS_DIRECTORY; + + if ($plugin && $plugin !='off') { + $dir = $dir.'/'.$PLUGINS_DIRECTORY.$plugin; + } foreach ($coredir as $trim_key => $trim_dirs) { $search[$trim_key] = "'".$trim_dirs."'"; @@ -624,37 +642,56 @@ class file_inspector { } $data = " scan($dir) : $core_image[$coredir['plugins']][$plugin]; + $image_array = var_export($scan_current, true); + $data .= "\$core_image[\$coredir['plugins']]['".$plugin."'] = ".$image_array.";\n\n"; + } else { + $scan_current = ($_POST['snaptype'] == 'current') ? $this -> scan($dir) : $core_image; + $image_array = var_export($scan_current, true); + $image_array = str_replace($search, $replace, $image_array); + $data .= "\$core_image = ".$image_array.";\n\n"; + } - $scan_current = ($_POST['snaptype'] == 'current') ? $this -> scan($dir) : $core_image; - $image_array = var_export($scan_current, true); - $image_array = str_replace($search, $replace, $image_array); - $data .= "\$core_image = ".$image_array.";\n\n"; - - $scan_deprecated = ($_POST['snaptype'] == 'deprecated') ? $this -> scan($dir, $core_image) : $deprecated_image; - $image_array = var_export($scan_deprecated, true); - $image_array = str_replace($search, $replace, $image_array); - $data .= "\$deprecated_image = ".$image_array.";\n\n"; + if ($plugin && $plugin !='off') { + $scan_deprecated = ($_POST['snaptype'] == 'deprecated') ? $this -> scan($dir, $core_image) : $deprecated_image[$coredir['plugins']]['".$plugin."']; + $image_array = var_export($scan_deprecated, true); + $data .= "\$deprecated_image[\$coredir['plugins']]['".$plugin."'] = ".$image_array.";\n\n"; + } else { + $scan_deprecated = ($_POST['snaptype'] == 'deprecated') ? $this -> scan($dir, $core_image) : $deprecated_image; + $image_array = var_export($scan_deprecated, true); + $image_array = str_replace($search, $replace, $image_array); + $data .= "\$deprecated_image = ".$image_array.";\n\n"; + } $data .= "?>"; - $fp = fopen(e_ADMIN.'core_image.php', 'w'); + if ($plugin && $plugin !='off') { + $fp = fopen(e_PLUGIN.$plugin .'/e_inspect.php', 'w'); + } else { + $fp = fopen(e_ADMIN.'core_image.php', 'w'); + } fwrite($fp, $data); } @@ -662,7 +699,7 @@ class file_inspector { global $ns, $rs; $text = ""; if (isset($_POST['create_snapshot'])) { - $this -> create_image($_POST['snapshot_path']); + $this -> create_image($_POST['snapshot_path'], $_POST['plugin']); $text = "
@@ -672,7 +709,7 @@ class file_inspector { $text .= " @@ -697,10 +734,35 @@ class file_inspector { + + + + + +
- The snapshot (".e_ADMIN."core_image.php) was successfully created. + The snapshot was successfully created.
root_dir)."' />
+ Create snapshot for plugin: + + +
- Create snapshot of current or deprecated core files: + Create snapshot of current or deprecated files: Current   @@ -708,6 +770,7 @@ class file_inspector {
".$rs -> form_button('submit', 'create_snapshot', 'Create Snapshot')."