You are here

function elfinder_check_badpaths in elFinder file manager 7

Same name and namespace in other branches
  1. 8.2 elfinder.module \elfinder_check_badpaths()
  2. 6.2 elfinder.module \elfinder_check_badpaths()
  3. 6 elfinder.module \elfinder_check_badpaths()
  4. 7.2 elfinder.module \elfinder_check_badpaths()
2 calls to elfinder_check_badpaths()
elfinder_init in ./elfinder.module
elfinder_requirements in ./elfinder.install
Implements hook_requirements().

File

./elfinder.module, line 65

Code

function elfinder_check_badpaths() {
  $ret = array(
    'result' => TRUE,
    'message' => '',
  );
  $libpath = elfinder_lib_path();
  $badfiles = array(
    'elfinder.html',
    'elfinder.php.html',
    'connectors/php/connector.php',
    'php/connector.php',
    'php/connector.minimal.php',
  );
  $badpaths = array();
  foreach ($badfiles as $badfile) {
    $path = $libpath . '/' . $badfile;
    if (file_exists($path)) {
      $badpaths[] = $path;
    }
  }
  if (count($badpaths) > 0) {
    $message = t('elFinder library directory containing features test files :files. Please remove these files to avoid security hole.', array(
      ':files' => implode(', ', $badpaths),
    ));
    watchdog('elfinder', $message, WATCHDOG_ALERT);
    drupal_set_message($message, 'error');
    $ret['result'] = FALSE;
    $ret['message'] = $message;
  }
  return $ret;
}