You are here

function fckeditor_update_6110 in FCKeditor - WYSIWYG HTML editor 6.2

Same name and namespace in other branches
  1. 6 fckeditor.install \fckeditor_update_6110()

Update from 6.x-1.0 to 6.x-1.1

File

./fckeditor.install, line 438

Code

function fckeditor_update_6110() {
  $ret = array();
  $result = db_query("SELECT * FROM {fckeditor_settings}");
  $global_profile_found = FALSE;
  while ($data = db_fetch_object($result)) {
    if ($data->name == "FCKeditor Global Profile") {
      $global_profile_found = TRUE;
    }
    if ($data->settings) {
      $settings = unserialize($data->settings);
    }
    if (isset($settings['excl_mode'], $settings['excl_list']) && !empty($settings['excl_list'])) {
      switch ($settings['excl_mode']) {
        case 0:

          // normal exclusion based on the id
          $settings['excl_fields'] = $settings['excl_list'];
          $settings['excl_mode'] = 0;
          break;
        case 1:

          //normal inclusion based on the id
          $settings['excl_fields'] = $settings['excl_list'];
          $settings['excl_mode'] = 1;
          break;
        case 2:

          //path exclusion
          $settings['excl_paths'] = $settings['excl_list'];
          $settings['excl_mode'] = 0;
          break;
        case 3:

          //path inclusion
          $settings['excl_paths'] = $settings['excl_list'];
          $settings['excl_mode'] = 1;
          break;
      }
      unset($settings['excl_list']);
    }
    if (isset($settings['simple_incl_mode'], $settings['simple_incl_list']) && !empty($settings['simple_incl_list'])) {
      switch ($settings['simple_incl_mode']) {
        case 1:

          //normal inclusion based on the id
          $settings['simple_incl_fields'] = $settings['simple_incl_list'];
          break;
        case 3:

          //path inclusion
          $settings['simple_incl_paths'] = $settings['simple_incl_list'];
          break;
      }
      unset($settings['simple_incl_mode']);
      unset($settings['simple_incl_list']);
    }
    db_query("UPDATE {fckeditor_settings} SET settings='%s' WHERE name='%s'", serialize($settings), $data->name);
  }
  if (!$global_profile_found) {
    db_query("INSERT INTO {fckeditor_settings} (name, settings) VALUES ('%s', '%s')", "FCKeditor Global Profile", serialize(array()));
  }
  return $ret;
}