function _scoper_activate() { // set_current_user may have triggered DB setup already if (empty($GLOBALS['scoper_db_setup_done'])) { require_once dirname(__FILE__) . '/db-setup_rs.php'; $ver = (array) get_option('scoper_version'); $db_ver = isset($ver['db_version']) ? $ver['db_version'] : ''; scoper_db_setup($db_ver); } require_once dirname(__FILE__) . '/admin/admin_lib_rs.php'; ScoperAdminLib::sync_wproles(); scoper_flush_site_rules(); scoper_expire_file_rules(); }
function update_page_options($sitewide = false, $customize_defaults = false) { global $scoper_role_types; global $scoper_default_options; // changes to these options will trigger .htaccess regen if ($sitewide) { add_action('pre_update_site_option_scoper_file_filtering', 'scoper_maybe_flush_site_rules', 10, 2); add_action('add_site_option_scoper_file_filtering', 'scoper_flush_site_rules'); add_action('pre_update_site_option_scoper_file_filtering', 'scoper_maybe_expire_file_rules', 10, 2); add_action('add_site_option_scoper_file_filtering', 'scoper_expire_file_rules'); } else { add_action('update_option_scoper_file_filtering', 'scoper_maybe_expire_file_rules', 10, 2); add_action('update_option_scoper_feed_link_http_auth', 'scoper_maybe_flush_site_rules', 10, 2); } $default_prefix = $customize_defaults ? 'default_' : ''; $reviewed_options = explode(',', $_POST['all_options']); foreach ($reviewed_options as $option_basename) { $value = isset($_POST[$option_basename]) ? $_POST[$option_basename] : ''; if ('use_post_types' == $option_basename || 'use_taxonomies' == $option_basename) { $value = array(); foreach (array_keys($scoper_default_options[$option_basename]) as $key) { $postvar = $option_basename . '-' . $key; $value[$key] = isset($_POST[$postvar]) ? $_POST[$postvar] : ''; } } elseif ('mu_sitewide_groups' == $option_basename) { $current_setting = get_site_option('scoper_mu_sitewide_groups'); if ($current_setting != $value) { //delete_option( 'scoper_version' ); // this forces DB schema update on next access (to create site-wide / blog-specific groups table) $ver = get_option('scoper_version'); require_once dirname(__FILE__) . '/db-setup_rs.php'; scoper_db_setup($ver['db_version']); } $value = intval($value); } if (!is_array($value)) { $value = trim($value); } $value = stripslashes_deep($value); scoper_update_option($default_prefix . $option_basename, $value, $sitewide); } }
function scoper_version_check() { $ver_change = false; $ver = get_option('scoper_version'); if (empty($ver['db_version']) || version_compare(SCOPER_DB_VERSION, $ver['db_version'], '!=')) { $ver_change = true; require_once dirname(__FILE__) . '/db-setup_rs.php'; scoper_db_setup($ver['db_version']); } // These maintenance operations only apply when a previous version of RS was installed if (!empty($ver['version'])) { if (version_compare(SCOPER_VERSION, $ver['version'], '!=')) { $ver_change = true; require_once dirname(__FILE__) . '/admin/update_rs.php'; scoper_version_updated($ver['version']); scoper_check_revision_settings(); } } else { // first-time install (or previous install was totally wiped) require_once dirname(__FILE__) . '/admin/update_rs.php'; scoper_set_default_rs_roledefs(); } if ($ver_change) { $ver = array('version' => SCOPER_VERSION, 'db_version' => SCOPER_DB_VERSION); update_option('scoper_version', $ver); } }