mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
fileinspector - code-cleanup, no functional changes
Reformatting, syntax, spacing, tabs, etc.
This commit is contained in:
@@ -23,54 +23,62 @@ if (!getperms('Y'))
|
|||||||
e107::redirect('admin');
|
e107::redirect('admin');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$error_handler->debug = FALSE;
|
$error_handler->debug = FALSE;
|
||||||
//require_once(e_HANDLER.'form_handler.php');
|
|
||||||
$DOCS_DIRECTORY = $HELP_DIRECTORY; // Give a sensible, albeit probably invalid, value
|
$DOCS_DIRECTORY = $HELP_DIRECTORY; // Give a sensible, albeit probably invalid, value
|
||||||
|
|
||||||
if(substr($HELP_DIRECTORY,-5,5) == 'help/')
|
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
|
$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) {
|
$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)
|
||||||
|
{
|
||||||
$coredir[$maindirs_key] = substr($maindirs_value, 0, -1);
|
$coredir[$maindirs_key] = substr($maindirs_value, 0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('core_image.php');
|
require_once('core_image.php');
|
||||||
|
|
||||||
//$rs = new form;
|
|
||||||
set_time_limit(18000);
|
set_time_limit(18000);
|
||||||
$e_sub_cat = 'fileinspector';
|
$e_sub_cat = 'fileinspector';
|
||||||
|
|
||||||
|
|
||||||
if(isset($_GET['scan']))
|
if(isset($_GET['scan']))
|
||||||
{
|
{
|
||||||
|
|
||||||
session_write_close();
|
session_write_close();
|
||||||
while (@ob_end_clean());
|
while (@ob_end_clean());
|
||||||
|
|
||||||
|
|
||||||
//header("Content-type: text/html; charset=".CHARSET, true);
|
//header("Content-type: text/html; charset=".CHARSET, true);
|
||||||
//$css_file = file_exists(e_THEME.$pref['admintheme'].'/'.$pref['admincss']) ? e_THEME.$pref['admintheme'].'/'.$pref['admincss'] : e_THEME.$pref['admintheme'].'/'.$pref['admincss'];
|
//$css_file = file_exists(e_THEME.$pref['admintheme'].'/'.$pref['admincss']) ? e_THEME.$pref['admintheme'].'/'.$pref['admincss'] : e_THEME.$pref['admintheme'].'/'.$pref['admincss'];
|
||||||
// $fi = new file_inspector;
|
// $fi = new file_inspector;
|
||||||
|
|
||||||
$fi = e107::getSingleton('file_inspector');
|
$fi = e107::getSingleton('file_inspector');
|
||||||
|
|
||||||
|
|
||||||
echo "<!DOCTYPE html>
|
echo "<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Results</title>
|
<title>Results</title>
|
||||||
<script type='text/javascript' src='https://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js'></script>
|
<script type='text/javascript' src='https://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js'></script>
|
||||||
|
|
||||||
".$fi->headerCss()." ".headerjs()."
|
".$fi->headerCss()." ".headerjs()."
|
||||||
<body style='height:100%;background-color:#2F2F2F'>\n";
|
<body style='height:100%;background-color:#2F2F2F'>\n";
|
||||||
|
|
||||||
// define('e_IFRAME', true);
|
// define('e_IFRAME', true);
|
||||||
// require_once(e_ADMIN."auth.php");
|
// require_once(e_ADMIN."auth.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// echo "<br />loading..";
|
// echo "<br />loading..";
|
||||||
|
|
||||||
// echo "..";
|
// echo "..";
|
||||||
@@ -89,7 +97,8 @@ if(isset($_GET['scan']))
|
|||||||
|
|
||||||
// require_once(e_ADMIN."footer.php");
|
// require_once(e_ADMIN."footer.php");
|
||||||
|
|
||||||
echo "</body></html>";
|
echo "</body>
|
||||||
|
</html>";
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
@@ -99,10 +108,6 @@ else
|
|||||||
// $fi = new file_inspector;
|
// $fi = new file_inspector;
|
||||||
$fi = e107::getSingleton('file_inspector');
|
$fi = e107::getSingleton('file_inspector');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once(e_ADMIN.'auth.php');
|
require_once(e_ADMIN.'auth.php');
|
||||||
|
|
||||||
|
|
||||||
@@ -129,7 +134,6 @@ else
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class file_inspector {
|
class file_inspector {
|
||||||
|
|
||||||
var $root_dir;
|
var $root_dir;
|
||||||
@@ -143,7 +147,6 @@ class file_inspector {
|
|||||||
private $langs = array();
|
private $langs = array();
|
||||||
private $lang_short = array();
|
private $lang_short = array();
|
||||||
|
|
||||||
|
|
||||||
private $excludeFiles = array( '.', '..','/','.svn', 'CVS' ,'Thumbs.db', '.git');
|
private $excludeFiles = array( '.', '..','/','.svn', 'CVS' ,'Thumbs.db', '.git');
|
||||||
|
|
||||||
private $knownSecurityIssues = array('htmlarea', 'e107_docs/docs.php');
|
private $knownSecurityIssues = array('htmlarea', 'e107_docs/docs.php');
|
||||||
@@ -164,7 +167,6 @@ class file_inspector {
|
|||||||
'line' => 0
|
'line' => 0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
function setOptions($post)
|
function setOptions($post)
|
||||||
{
|
{
|
||||||
foreach($this->options as $k=>$v)
|
foreach($this->options as $k=>$v)
|
||||||
@@ -174,13 +176,10 @@ class file_inspector {
|
|||||||
$this->options[$k] = $post[$k];
|
$this->options[$k] = $post[$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
$lng = e107::getLanguage();
|
$lng = e107::getLanguage();
|
||||||
$langs = $lng->installed();
|
$langs = $lng->installed();
|
||||||
|
|
||||||
@@ -190,6 +189,7 @@ class file_inspector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lang_short = array();
|
$lang_short = array();
|
||||||
|
|
||||||
foreach($langs as $k=>$val)
|
foreach($langs as $k=>$val)
|
||||||
{
|
{
|
||||||
if($val == "English") // Core release language, so ignore it.
|
if($val == "English") // Core release language, so ignore it.
|
||||||
@@ -204,9 +204,6 @@ class file_inspector {
|
|||||||
$this->langs = $langs;
|
$this->langs = $langs;
|
||||||
$this->lang_short = $lang_short;
|
$this->lang_short = $lang_short;
|
||||||
|
|
||||||
|
|
||||||
//TODO LAN
|
|
||||||
|
|
||||||
$this->glyph = array(
|
$this->glyph = array(
|
||||||
'folder_close' => array('<i class="fa fa-times-circle-o"></i>'),
|
'folder_close' => array('<i class="fa fa-times-circle-o"></i>'),
|
||||||
'folder_up' => array('<i class="fa fa-folder-open-o"></i>'),
|
'folder_up' => array('<i class="fa fa-folder-open-o"></i>'),
|
||||||
@@ -233,25 +230,20 @@ class file_inspector {
|
|||||||
'file_uncalc' => array('<i class="fa fa-file-o " ></i>', FC_LAN_34 ),
|
'file_uncalc' => array('<i class="fa fa-file-o " ></i>', FC_LAN_34 ),
|
||||||
'file_warning' => array('<i class="fa fa-file text-warning" ></i>', FC_LAN_35 ),
|
'file_warning' => array('<i class="fa fa-file text-warning" ></i>', FC_LAN_35 ),
|
||||||
'file_unknown' => array('<i class="fa fa-file-o text-primary" ></i>', FC_LAN_36 ),
|
'file_unknown' => array('<i class="fa fa-file-o text-primary" ></i>', FC_LAN_36 ),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($this->glyph as $k=>$v)
|
foreach($this->glyph as $k=>$v)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->iconTag[$k] = $this->glyph[$k][0];
|
$this->iconTag[$k] = $this->glyph[$k][0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
global $e107, $core_image;
|
global $e107, $core_image;
|
||||||
|
|
||||||
//$this->totalFiles = count($core_image,COUNT_RECURSIVE);
|
//$this->totalFiles = count($core_image,COUNT_RECURSIVE);
|
||||||
$this->countFiles($core_image);
|
$this->countFiles($core_image);
|
||||||
|
|
||||||
$this->root_dir = $e107 -> file_path;
|
$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);
|
$this->root_dir = substr($this->root_dir, 0, -1);
|
||||||
@@ -267,10 +259,13 @@ class file_inspector {
|
|||||||
$_POST['regex'] = stripslashes($_POST['regex']);
|
$_POST['regex'] = stripslashes($_POST['regex']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['regex']) {
|
if($_POST['regex'])
|
||||||
if ($_POST['core'] == 'fail') {
|
{
|
||||||
|
if($_POST['core'] == 'fail')
|
||||||
|
{
|
||||||
$_POST['core'] = 'all';
|
$_POST['core'] = 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
$_POST['missing'] = 0;
|
$_POST['missing'] = 0;
|
||||||
$_POST['integrity'] = 0;
|
$_POST['integrity'] = 0;
|
||||||
}
|
}
|
||||||
@@ -296,7 +291,6 @@ class file_inspector {
|
|||||||
{
|
{
|
||||||
$this->totalFiles++;
|
$this->totalFiles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,21 +303,19 @@ class file_inspector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getLegend()
|
public function getLegend()
|
||||||
{
|
{
|
||||||
return $this->glyph;
|
return $this->glyph;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function renderHelp()
|
function renderHelp()
|
||||||
{
|
{
|
||||||
|
|
||||||
$text = "<table>";
|
$text = "<table>";
|
||||||
|
|
||||||
foreach($this->iconTag as $k=>$v)
|
foreach($this->iconTag as $k=>$v)
|
||||||
{
|
{
|
||||||
$text .= "<tr><td>".$v."</td><td>".$k."</td></tr>";
|
$text .= "<tr><td>".$v."</td><td>".$k."</td></tr>";
|
||||||
@@ -336,20 +328,15 @@ class file_inspector {
|
|||||||
|
|
||||||
function scan_config()
|
function scan_config()
|
||||||
{
|
{
|
||||||
|
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
$pref = e107::pref('core');
|
$pref = e107::pref('core');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($_GET['mode'] == 'run')
|
if($_GET['mode'] == 'run')
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$tab = array();
|
$tab = array();
|
||||||
|
|
||||||
$head = "<div>
|
$head = "<div>
|
||||||
@@ -383,7 +370,6 @@ class file_inspector {
|
|||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text .= "<tr>
|
$text .= "<tr>
|
||||||
<td style='width: 35%'>
|
<td style='width: 35%'>
|
||||||
".LAN_SHOW." ".FC_LAN_13.":
|
".LAN_SHOW." ".FC_LAN_13.":
|
||||||
@@ -415,9 +401,6 @@ class file_inspector {
|
|||||||
</td>
|
</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text .= "<tr>
|
$text .= "<tr>
|
||||||
<td style='width: 35%'>
|
<td style='width: 35%'>
|
||||||
".FC_LAN_8.":
|
".FC_LAN_8.":
|
||||||
@@ -431,7 +414,6 @@ class file_inspector {
|
|||||||
|
|
||||||
$tab['basic'] = array('caption'=>LAN_OPTIONS, 'text'=>$text);
|
$tab['basic'] = array('caption'=>LAN_OPTIONS, 'text'=>$text);
|
||||||
|
|
||||||
|
|
||||||
if($pref['developer']) {
|
if($pref['developer']) {
|
||||||
|
|
||||||
$text2 = "<table class='table adminlist'>";
|
$text2 = "<table class='table adminlist'>";
|
||||||
@@ -472,13 +454,9 @@ class file_inspector {
|
|||||||
$tab['advanced'] = array('caption'=>FC_LAN_17, 'text'=>$text2);
|
$tab['advanced'] = array('caption'=>FC_LAN_17, 'text'=>$text2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$tabText = e107::getForm()->tabs($tab);
|
$tabText = e107::getForm()->tabs($tab);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$foot = "
|
$foot = "
|
||||||
<div class='buttons-bar center'>
|
<div class='buttons-bar center'>
|
||||||
".$frm->admin_button('scan', LAN_GO, 'other')."
|
".$frm->admin_button('scan', LAN_GO, 'other')."
|
||||||
@@ -494,9 +472,8 @@ class file_inspector {
|
|||||||
|
|
||||||
function scan($dir, $image)
|
function scan($dir, $image)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$handle = opendir($dir.'/');
|
$handle = opendir($dir.'/');
|
||||||
|
|
||||||
while (false !== ($readdir = readdir($handle)))
|
while (false !== ($readdir = readdir($handle)))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -515,16 +492,22 @@ class file_inspector {
|
|||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
|
|
||||||
if (isset($dirs)) {
|
if(isset($dirs))
|
||||||
|
{
|
||||||
ksort($dirs);
|
ksort($dirs);
|
||||||
foreach ($dirs as $dir_path => $dir_list) {
|
|
||||||
|
foreach ($dirs as $dir_path => $dir_list)
|
||||||
|
{
|
||||||
$list[$dir_list] = ($set = $this->scan($dir_path, $image[$dir_list])) ? $set : array();
|
$list[$dir_list] = ($set = $this->scan($dir_path, $image[$dir_list])) ? $set : array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($files)) {
|
if(isset($files))
|
||||||
|
{
|
||||||
ksort($files);
|
ksort($files);
|
||||||
foreach ($files as $file_name => $file_list) {
|
|
||||||
|
foreach ($files as $file_name => $file_list)
|
||||||
|
{
|
||||||
$list[$file_name] = $file_list;
|
$list[$file_name] = $file_list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -580,10 +563,12 @@ class file_inspector {
|
|||||||
|
|
||||||
unset ($childOut);
|
unset ($childOut);
|
||||||
$parent_expand = false;
|
$parent_expand = false;
|
||||||
|
|
||||||
if(substr($dir, -1) == '/')
|
if(substr($dir, -1) == '/')
|
||||||
{
|
{
|
||||||
$dir = substr($dir, 0, -1);
|
$dir = substr($dir, 0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir_id = dechex(crc32($dir));
|
$dir_id = dechex(crc32($dir));
|
||||||
$this->files[$dir_id]['.']['level'] = $level;
|
$this->files[$dir_id]['.']['level'] = $level;
|
||||||
$this->files[$dir_id]['.']['parent'] = $this->parent;
|
$this->files[$dir_id]['.']['parent'] = $this->parent;
|
||||||
@@ -591,29 +576,29 @@ class file_inspector {
|
|||||||
$directory = $level ? basename($dir) : SITENAME;
|
$directory = $level ? basename($dir) : SITENAME;
|
||||||
$level++;
|
$level++;
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->sendProgress(vartrue($this->count['core']['num']),$this->totalFiles,FR_LAN_1);
|
$this->sendProgress(vartrue($this->count['core']['num']),$this->totalFiles,FR_LAN_1);
|
||||||
|
|
||||||
foreach ($list as $key => $value)
|
foreach ($list as $key => $value)
|
||||||
{
|
{
|
||||||
// $dir_icon = 'fileinspector'; // default as unknown
|
// $dir_icon = 'fileinspector'; // default as unknown
|
||||||
$this->parent = $dir_id;
|
$this->parent = $dir_id;
|
||||||
|
|
||||||
|
// Entry is a subdirectory - recurse another level
|
||||||
if(is_array($value))
|
if(is_array($value))
|
||||||
{ // Entry is a subdirectory - recurse another level
|
{
|
||||||
$path = $dir.'/'.$key;
|
$path = $dir.'/'.$key;
|
||||||
$child_open = false;
|
$child_open = false;
|
||||||
$child_end = true;
|
$child_end = true;
|
||||||
$dir_icon = 'folder_check';
|
$dir_icon = 'folder_check';
|
||||||
$sub_text .= $this->inspect($value, $deprecated[$key], $level, $path, $child_end, $child_expand);
|
$sub_text .= $this->inspect($value, $deprecated[$key], $level, $path, $child_end, $child_expand);
|
||||||
$tree_end = false;
|
$tree_end = false;
|
||||||
|
|
||||||
if($child_expand)
|
if($child_expand)
|
||||||
{
|
{
|
||||||
$parent_expand = true;
|
$parent_expand = true;
|
||||||
$last_expand = true;
|
$last_expand = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -623,29 +608,35 @@ class file_inspector {
|
|||||||
$fid = strtolower($key);
|
$fid = strtolower($key);
|
||||||
$this->files[$dir_id][$fid]['file'] = ($_POST['type'] == 'tree') ? $key : $path;
|
$this->files[$dir_id][$fid]['file'] = ($_POST['type'] == 'tree') ? $key : $path;
|
||||||
|
|
||||||
|
// We're checking a file here
|
||||||
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
|
{
|
||||||
|
// Look at core files
|
||||||
if($this->opt('core') != 'none')
|
if($this->opt('core') != 'none')
|
||||||
{ // Look at core files
|
{
|
||||||
$this->count['core']['num']++;
|
$this->count['core']['num']++;
|
||||||
$this->count['core']['size'] += $this->files[$dir_id][$fid]['size'];
|
$this->count['core']['size'] += $this->files[$dir_id][$fid]['size'];
|
||||||
|
|
||||||
|
// TODO Max out of Memory when used
|
||||||
if($_POST['regex']) // Developer prefs activated - search file contents according to regex
|
if($_POST['regex']) // Developer prefs activated - search file contents according to regex
|
||||||
{ // TODO Max out of Memory when used
|
{
|
||||||
$file_content = file($path); // Get contents of file
|
// Get contents of file
|
||||||
|
$file_content = file($path);
|
||||||
|
|
||||||
if(($this->files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE)
|
if(($this->files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE)
|
||||||
{
|
{
|
||||||
|
// Search string found - add file to list
|
||||||
if($this->files[$dir_id][$fid]['lines'] = preg_grep("#".$_POST['regex']."#".$_POST['mod'], $file_content))
|
if($this->files[$dir_id][$fid]['lines'] = preg_grep("#".$_POST['regex']."#".$_POST['mod'], $file_content))
|
||||||
{ // Search string found - add file to list
|
{
|
||||||
$this->files[$dir_id][$fid]['file'] = ($_POST['type'] == 'tree') ? $key : $path;
|
$this->files[$dir_id][$fid]['file'] = ($_POST['type'] == 'tree') ? $key : $path;
|
||||||
$this->files[$dir_id][$fid]['icon'] = 'file_core';
|
$this->files[$dir_id][$fid]['icon'] = 'file_core';
|
||||||
$dir_icon = 'fileinspector';
|
$dir_icon = 'fileinspector';
|
||||||
$parent_expand = TRUE;
|
$parent_expand = TRUE;
|
||||||
$this->results++;
|
$this->results++;
|
||||||
}
|
}
|
||||||
|
// Search string not found - discard from list
|
||||||
else
|
else
|
||||||
{ // Search string not found - discard from list
|
{
|
||||||
unset($this->files[$dir_id][$fid]);
|
unset($this->files[$dir_id][$fid]);
|
||||||
$known[$dir_id][$fid] = true;
|
$known[$dir_id][$fid] = true;
|
||||||
$dir_icon = ($dir_icon == 'fileinspector') ? 'folder_unknown': $dir_icon ;
|
$dir_icon = ($dir_icon == 'fileinspector') ? 'folder_unknown': $dir_icon ;
|
||||||
@@ -654,8 +645,9 @@ class file_inspector {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Actually check file integrity
|
||||||
if($this->opt('integrity'))
|
if($this->opt('integrity'))
|
||||||
{ // Actually check file integrity
|
{
|
||||||
switch ($this_action = $this->check_action($dir,$key))
|
switch ($this_action = $this->check_action($dir,$key))
|
||||||
{
|
{
|
||||||
case 'ignore' :
|
case 'ignore' :
|
||||||
@@ -682,7 +674,6 @@ class file_inspector {
|
|||||||
{
|
{
|
||||||
unset($this->files[$dir_id][$fid]);
|
unset($this->files[$dir_id][$fid]);
|
||||||
$known[$dir_id][$fid] = true;
|
$known[$dir_id][$fid] = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -690,10 +681,10 @@ class file_inspector {
|
|||||||
case 'nocalc' :
|
case 'nocalc' :
|
||||||
$this->count['uncalculable']['num']++;
|
$this->count['uncalculable']['num']++;
|
||||||
$this->count['uncalculable']['size'] += $this->files[$dir_id][$fid]['size'];
|
$this->count['uncalculable']['size'] += $this->files[$dir_id][$fid]['size'];
|
||||||
|
|
||||||
if($this->opt('core') != 'fail')
|
if($this->opt('core') != 'fail')
|
||||||
{
|
{
|
||||||
$this->files[$dir_id][$fid]['icon'] = 'file_uncalc';
|
$this->files[$dir_id][$fid]['icon'] = 'file_uncalc';
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -703,8 +694,9 @@ class file_inspector {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Just identify as core file
|
||||||
else
|
else
|
||||||
{ // Just identify as core file
|
{
|
||||||
$this->files[$dir_id][$fid]['icon'] = 'file_core';
|
$this->files[$dir_id][$fid]['icon'] = 'file_core';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -743,9 +735,6 @@ class file_inspector {
|
|||||||
|
|
||||||
if($this->opt('noncore') || $this->opt('oldcore'))
|
if($this->opt('noncore') || $this->opt('oldcore'))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!$handle = opendir($dir.'/'))
|
if(!$handle = opendir($dir.'/'))
|
||||||
{
|
{
|
||||||
//e107::getMessage()->addInfo("Couldn't Open : ".$dir);
|
//e107::getMessage()->addInfo("Couldn't Open : ".$dir);
|
||||||
@@ -758,7 +747,6 @@ class file_inspector {
|
|||||||
|
|
||||||
if(!in_array($readdir,$this->excludeFiles) && (strpos('._', $readdir) === false))
|
if(!in_array($readdir,$this->excludeFiles) && (strpos('._', $readdir) === false))
|
||||||
{
|
{
|
||||||
|
|
||||||
if(is_dir($dir.'/'.$readdir))
|
if(is_dir($dir.'/'.$readdir))
|
||||||
{
|
{
|
||||||
if(!isset($list[$readdir]) && ($level > 1 || $readdir == 'e107_install'))
|
if(!isset($list[$readdir]) && ($level > 1 || $readdir == 'e107_install'))
|
||||||
@@ -773,17 +761,11 @@ class file_inspector {
|
|||||||
$last_expand = true;
|
$last_expand = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($this->opt('nolang') && !empty($langs) && !empty($lang_short)) // Hide Non-core Languages.
|
if($this->opt('nolang') && !empty($langs) && !empty($lang_short)) // Hide Non-core Languages.
|
||||||
{
|
{
|
||||||
|
|
||||||
// PHP Lang files.
|
// PHP Lang files.
|
||||||
$lreg = "/[\/_](".implode("|",$langs).")/";
|
$lreg = "/[\/_](".implode("|",$langs).")/";
|
||||||
if(preg_match($lreg, $dir.'/'.$readdir))
|
if(preg_match($lreg, $dir.'/'.$readdir))
|
||||||
@@ -885,7 +867,9 @@ class file_inspector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($this->opt('core') == 'none') {
|
}
|
||||||
|
elseif($this->opt('core') == 'none')
|
||||||
|
{
|
||||||
unset($this->files[$dir_id][$aid]);
|
unset($this->files[$dir_id][$aid]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -959,9 +943,10 @@ class file_inspector {
|
|||||||
|
|
||||||
function scan_results()
|
function scan_results()
|
||||||
{
|
{
|
||||||
global $ns, $rs, $core_image, $deprecated_image;
|
global $core_image, $deprecated_image;
|
||||||
$scan_text = $this -> inspect($core_image, $deprecated_image, 0, $this -> root_dir);
|
$ns = e107::getRender();
|
||||||
|
|
||||||
|
$scan_text = $this->inspect($core_image, $deprecated_image, 0, $this->root_dir);
|
||||||
|
|
||||||
$this->sendProgress($this->totalFiles,$this->totalFiles,' ');
|
$this->sendProgress($this->totalFiles,$this->totalFiles,' ');
|
||||||
|
|
||||||
@@ -1165,8 +1150,6 @@ class file_inspector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function renderRow($stext)
|
function renderRow($stext)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1228,16 +1211,12 @@ class file_inspector {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function create_image($dir)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function create_image($dir) {
|
|
||||||
global $core_image, $deprecated_image,$coredir;
|
global $core_image, $deprecated_image,$coredir;
|
||||||
|
|
||||||
foreach ($coredir as $trim_key => $trim_dirs) {
|
foreach ($coredir as $trim_key => $trim_dirs)
|
||||||
|
{
|
||||||
$search[$trim_key] = "'".$trim_dirs."'";
|
$search[$trim_key] = "'".$trim_dirs."'";
|
||||||
$replace[$trim_key] = "\$coredir['".$trim_key."']";
|
$replace[$trim_key] = "\$coredir['".$trim_key."']";
|
||||||
}
|
}
|
||||||
@@ -1394,8 +1373,6 @@ class file_inspector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "<div style='display:block;position:absolute;top:20px;width:100%;'>
|
echo "<div style='display:block;position:absolute;top:20px;width:100%;'>
|
||||||
<div style='width:700px;position:relative;margin-left:auto;margin-right:auto;text-align:center'>";
|
<div style='width:700px;position:relative;margin-left:auto;margin-right:auto;text-align:center'>";
|
||||||
|
|
||||||
@@ -1473,7 +1450,6 @@ class file_inspector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!deftrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'])
|
if(!deftrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'])
|
||||||
{
|
{
|
||||||
$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? 'admin_'.$pref['admincss'] : $pref['admincss'];
|
$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? 'admin_'.$pref['admincss'] : $pref['admincss'];
|
||||||
@@ -1539,9 +1515,6 @@ class file_inspector {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileinspector_adminmenu() //FIXME - has problems when navigation is on the LEFT instead of the right.
|
function fileinspector_adminmenu() //FIXME - has problems when navigation is on the LEFT instead of the right.
|
||||||
@@ -1580,8 +1553,6 @@ function e_help()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once(e_ADMIN.'footer.php');
|
require_once(e_ADMIN.'footer.php');
|
||||||
|
|
||||||
function headerjs()
|
function headerjs()
|
||||||
|
Reference in New Issue
Block a user