diff --git a/e107_admin/fileinspector.php b/e107_admin/fileinspector.php
index c344ebae0..5ff77fe26 100644
--- a/e107_admin/fileinspector.php
+++ b/e107_admin/fileinspector.php
@@ -102,7 +102,7 @@ Standalone file scan - checks for a valid set of E107 files
";
// Strip trailing '/' off each directory name
$maindirs = array('admin' => $ADMIN_DIRECTORY, 'files' => $FILES_DIRECTORY, 'images' => $IMAGES_DIRECTORY, 'themes' => $THEMES_DIRECTORY, 'plugins' => $PLUGINS_DIRECTORY, 'handlers' => $HANDLERS_DIRECTORY, 'languages' => $LANGUAGES_DIRECTORY, 'downloads' => $DOWNLOADS_DIRECTORY, 'docs' => $DOCS_DIRECTORY);
- foreach ($maindirs as $maindirs_key => $maindirs_value)
+ foreach ($maindirs as $maindirs_key => $maindirs_value)
{
$coredir[$maindirs_key] = substr($maindirs_value, 0, -1);
if (!file_exists(e_BASE.$coredir[$maindirs_key]))
@@ -141,7 +141,7 @@ if (substr($HELP_DIRECTORY,-5,5) == 'help/')
$DOCS_DIRECTORY = substr($HELP_DIRECTORY,0,-5); // Whatever $HELP_DIRECTORY is set to, assume docs are in a subdirectory called 'help' off it
}
$maindirs = array('admin' => $ADMIN_DIRECTORY, 'files' => $FILES_DIRECTORY, 'images' => $IMAGES_DIRECTORY, 'themes' => $THEMES_DIRECTORY, 'plugins' => $PLUGINS_DIRECTORY, 'handlers' => $HANDLERS_DIRECTORY, 'languages' => $LANGUAGES_DIRECTORY, 'downloads' => $DOWNLOADS_DIRECTORY, 'docs' => $DOCS_DIRECTORY);
-foreach ($maindirs as $maindirs_key => $maindirs_value)
+foreach ($maindirs as $maindirs_key => $maindirs_value)
{
$coredir[$maindirs_key] = substr($maindirs_value, 0, -1);
}
@@ -187,7 +187,7 @@ class file_inspector {
var $alone = FALSE;
var $dotree = FALSE;
- function file_inspector($standalone = FALSE)
+ function file_inspector($standalone = FALSE)
{
global $PLUGINS_DIRECTORY, $THEMES_DIRECTORY;
$this->dotree = ($_POST['type'] == 'tree');
@@ -218,21 +218,21 @@ class file_inspector {
global $e107;
$this -> root_dir = $e107 -> file_path;
- if (substr($this -> root_dir, -1) == '/')
+ if (substr($this -> root_dir, -1) == '/')
{
$this -> root_dir = substr($this -> root_dir, 0, -1);
}
- if ($_POST['core'] == 'fail')
+ if ($_POST['core'] == 'fail')
{
$_POST['integrity'] = TRUE;
}
- if (MAGIC_QUOTES_GPC && $_POST['regex'])
+ if (MAGIC_QUOTES_GPC && $_POST['regex'])
{
$_POST['regex'] = stripslashes($_POST['regex']);
}
- if ($_POST['regex'])
+ if ($_POST['regex'])
{
- if ($_POST['core'] == 'fail')
+ if ($_POST['core'] == 'fail')
{
$_POST['core'] = 'all';
}
@@ -245,7 +245,7 @@ class file_inspector {
if (substr($this->BASE_THEMES_DIR,-1) == '/') $this->BASE_THEMES_DIR = substr($this->BASE_THEMES_DIR,0,-1);
}
- function scan_config()
+ function scan_config()
{
global $ns, $rs, $pref;
@@ -413,20 +413,23 @@ class file_inspector {
{
global $coredir;
- if ($name == 'e_inspect.php') return 'nocalc'; // Special case for plugin integrity checking
+ if ($name == 'e_inspect.php') { return 'nocalc'; } // Special case for plugin integrity checking
$filename = $dir.'/'.$name;
- $admin_dir = $this -> root_dir.'/'.$coredir['admin'].'/';
- $test_list = array(
- $admin_dir.'core_image.php' => 'uncalc',
- $admin_dir.'filetypes.php' => 'uncalc',
- $admin_dir.'filetypes_.php' => 'ignore',
- $admin_dir.'admin_filetypes.php' => 'nocalc',
- $this -> root_dir.'/e107_config.php' => 'uncalc',
- $this -> root_dir.'/e107.htaccess' => 'ignore',
- $this -> root_dir.'/install.php' => 'ignore'
- );
- if (isset($test_list[$filename])) return $test_list[$filename];
+ $admin_dir = $this->root_dir.'/'.$coredir['admin'].'/';
+
+ $test_list = array();
+
+ // Files that are unable to be checked
+ $test_list[$admin_dir.'core_image.php'] = 'uncalc';
+ $test_list[$this->root_dir.'/e107_config.php'] = 'uncalc';
+
+ // Files that are likely to be renamed by user
+ $test_list[$admin_dir.'filetypes_.php'] = 'ignore';
+ $test_list[$this->root_dir.'/e107.htaccess'] = 'ignore';
+ $test_list[$this->root_dir.'/e107.robots.txt'] = 'ignore';
+
+ if (isset($test_list[$filename])) { return $test_list[$filename]; }
return 'check';
}
@@ -438,14 +441,14 @@ class file_inspector {
// $dir
// &$tree_end
// &$parent_expand
- function inspect($list, $deprecated, $level, $dir, &$tree_end, &$parent_expand)
+ function inspect($list, $deprecated, $level, $dir, &$tree_end, &$parent_expand)
{
global $coredir;
unset ($childOut);
$parent_expand = false;
$sub_text = '';
- if (substr($dir, -1) == '/')
+ if (substr($dir, -1) == '/')
{
$dir = substr($dir, 0, -1);
}
@@ -456,10 +459,10 @@ class file_inspector {
$directory = $level ? basename($dir) : SITENAME;
$level++;
- foreach ($list as $key => $value)
+ foreach ($list as $key => $value)
{
$this -> parent = $dir_id;
- if (is_array($value))
+ if (is_array($value))
{ // Entry is a subdirectory - recurse another level
$path = $dir.'/'.$key;
$child_open = false;
@@ -483,27 +486,27 @@ class file_inspector {
$sub_text .= $this -> inspect($value, $deprecated[$key], $level, $path, $child_end, $child_expand);
}
$tree_end = false;
- if ($child_expand)
+ if ($child_expand)
{
$parent_expand = true;
$last_expand = true;
}
- }
- else
+ }
+ else
{
$path = $dir.'/'.$key;
$fid = strtolower($key);
$this -> files[$dir_id][$fid]['file'] = ($this->dotree) ? $key : $path;
- if (($this -> files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE)
+ if (($this -> files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE)
{ // We're checking a file here
- if ($_POST['core'] != 'none')
+ if ($_POST['core'] != 'none')
{ // Look at core files
$this -> count['core']['num']++;
$this -> count['core']['size'] += $this -> files[$dir_id][$fid]['size'];
- if ($_POST['regex'])
+ if ($_POST['regex'])
{ // Developer prefs activated - search file contents according to regex
$file_content = file($path); // Get contents of file
- if (($this -> files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE)
+ if (($this -> files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE)
{
if ($this -> files[$dir_id][$fid]['lines'] = preg_grep("#".$_POST['regex']."#".$_POST['mod'], $file_content))
{ // Search string found - add file to list
@@ -513,41 +516,41 @@ class file_inspector {
$parent_expand = TRUE;
$this -> results++;
$this -> line_results += count($this -> files[$dir_id][$fid]['lines']);
- }
- else
+ }
+ else
{ // Search string not found - discard from list
unset($this -> files[$dir_id][$fid]);
$known[$dir_id][$fid] = true;
$dir_icon = ($dir_icon == 'fileinspector.png') ? $dir_icon : 'folder.png';
}
}
- }
- else
- {
- if ($_POST['integrity'])
+ }
+ else
+ {
+ if ($_POST['integrity'])
{ // Actually check file integrity
switch ($this_action = $this->check_action($dir,$key))
{
case 'ignore' :
case 'check' :
- if ($this -> checksum($path) != $value)
+ if ($this -> checksum($path) != $value)
{
$this -> count['fail']['num']++;
$this -> count['fail']['size'] += $this -> files[$dir_id][$fid]['size'];
$this -> files[$dir_id][$fid]['icon'] = 'file_fail.png';
$dir_icon = 'folder_fail.png';
$parent_expand = TRUE;
- }
- else
+ }
+ else
{
$this -> count['pass']['num']++;
$this -> count['pass']['size'] += $this -> files[$dir_id][$fid]['size'];
- if ($_POST['core'] != 'fail')
+ if ($_POST['core'] != 'fail')
{
$this -> files[$dir_id][$fid]['icon'] = 'file_check.png';
$dir_icon = ($dir_icon == 'folder_fail.png' || $dir_icon == 'folder_missing.png') ? $dir_icon : 'folder_check.png';
- }
- else
+ }
+ else
{
unset($this -> files[$dir_id][$fid]);
$known[$dir_id][$fid] = true;
@@ -561,28 +564,28 @@ class file_inspector {
if ($_POST['core'] != 'fail')
{
$this -> files[$dir_id][$fid]['icon'] = 'file_uncalc.png';
- }
- else
+ }
+ else
{
unset($this -> files[$dir_id][$fid]);
$known[$dir_id][$fid] = true;
}
break;
}
- }
- else
+ }
+ else
{ // Just identify as core file
$this -> files[$dir_id][$fid]['icon'] = 'file_core.png';
}
}
- }
- else
+ }
+ else
{
unset ($this -> files[$dir_id][$fid]);
$known[$dir_id][$fid] = true;
}
- }
- elseif ($_POST['missing'])
+ }
+ elseif ($_POST['missing'])
{
switch ($this_action = $this->check_action($dir,$key))
{
@@ -600,8 +603,8 @@ class file_inspector {
$known[$dir_id][$fid] = true;
break;
}
- }
- else
+ }
+ else
{
unset ($this -> files[$dir_id][$fid]);
}
@@ -701,12 +704,12 @@ class file_inspector {
return $text;
}
- function scan_results()
+ function scan_results()
{
global $ns, $rs, $core_image, $deprecated_image, $tp, $e107;
$scan_text = $this -> inspect($core_image, $deprecated_image, 0, $this -> root_dir);
-// if ($_POST['type'] == 'tree')
+// if ($_POST['type'] == 'tree')
if ($this->dotree)
{
$text = "
![]() |
root_dir))."')\">
![]() |
![]() |
@@ -817,8 +820,8 @@ class file_inspector {
|
".FR_LAN_23." |
".FR_LAN_23." |