You are here

function fckeditor_requirements in FCKeditor - WYSIWYG HTML editor 6.2

Implementation of hook_requirements().

This hook will issue warnings if:

  • The FCKeditor source files are not found
  • The FCKeditor source files are out of date
  • Quick upload and/or the built-in file browser are used and $cookie_domain is not set

File

./fckeditor.install, line 204

Code

function fckeditor_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $requirements['fckeditor'] = array(
      'title' => t('FCKeditor'),
      'value' => t('Unknown'),
    );
    $requirements['fckeditor']['severity'] = REQUIREMENT_OK;
    if (!_fckeditor_requirements_isinstalled()) {
      $sourcepath = fckeditor_path(TRUE);
      $requirements['fckeditor']['description'] = t('FCKeditor was not found at %sourcepath', array(
        '%sourcepath' => $sourcepath,
      ));
      $requirements['fckeditor']['severity'] = REQUIREMENT_ERROR;
    }
    elseif (($installed_version = _fckeditor_requirements_getinstalledversion()) === NULL) {
      $requirements['fckeditor']['description'] = t('FCKeditor version could not be determined');
      $requirements['fckeditor']['severity'] = REQUIREMENT_INFO;
    }
    else {
      $profile_name = _fckeditor_requirements_builtin_filebrowser_enabled();
      if ($profile_name !== FALSE) {
        if (!_fckeditor_requirements_cookiedomainset()) {
          $requirements['fckeditor']['severity'] = REQUIREMENT_ERROR;
          $requirements['fckeditor']['description'] = t('You are using a feature that requires $cookie_domain to be set, but it is not set in your settings.php (either built-in filebrowser or quick uploads are enabled in the !profile profile).', array(
            '!profile' => l($profile_name, 'admin/settings/fckeditor/edit/' . urlencode($profile_name)),
          ));
        }
        elseif ($error = _fckeditor_requirements_filemanager_config_check($profile_name)) {
          $requirements['fckeditor']['severity'] = REQUIREMENT_ERROR;
          $requirements['fckeditor']['description'] = $error;
        }
      }
    }

    // FCKeditor before 2.6.4.1 has a security problem
    // check if the version only contains dots and digits
    if (!empty($installed_version) && preg_match('#^[\\d\\.]+$#', $installed_version)) {
      if (version_compare($installed_version, '2.6.4.1', '<')) {
        $requirements['fckeditor']['severity'] = REQUIREMENT_WARNING;
        $requirements['fckeditor']['description'] = t('The installed version of FCKeditor is known to have a security problem. You can download an updated version at !fcklink.', array(
          '!fcklink' => l('FCKeditor.net', 'http://www.fckeditor.net'),
        ));
      }
    }
    if (!empty($installed_version)) {
      $requirements['fckeditor']['value'] = $installed_version;
    }
  }
  return $requirements;
}