You are here

function elfinder_check_badpaths in elFinder file manager 8.2

Same name and namespace in other branches
  1. 6.2 elfinder.module \elfinder_check_badpaths()
  2. 6 elfinder.module \elfinder_check_badpaths()
  3. 7 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 14

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_exception('elfinder', $e, $message, array());
    drupal_set_message($message, 'error');
    $ret['result'] = FALSE;
    $ret['message'] = $message;
  }
  return $ret;
}