コード例 #1
0
ファイル: admin_occle.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('occlechat');
     delete_value('last_occle_command');
     delete_config_option('occle_chat_announce');
     delete_config_option('bottom_show_occle_button');
 }
コード例 #2
0
ファイル: downloads.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('download_categories');
     $GLOBALS['SITE_DB']->drop_if_exists('download_downloads');
     $GLOBALS['SITE_DB']->drop_if_exists('download_logging');
     $GLOBALS['SITE_DB']->drop_if_exists('download_licences');
     delete_config_option('maximum_download');
     delete_config_option('is_on_downloads');
     delete_config_option('show_dload_trees');
     delete_config_option('points_ADD_DOWNLOAD');
     delete_config_option('downloads_show_stats_count_total');
     delete_config_option('downloads_show_stats_count_archive');
     delete_config_option('downloads_show_stats_count_downloads');
     delete_config_option('downloads_show_stats_count_bandwidth');
     delete_config_option('immediate_downloads');
     delete_config_option('download_gallery_root');
     $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'downloads'));
     $GLOBALS['SITE_DB']->query_delete('trackbacks', array('trackback_for_type' => 'downloads'));
     delete_value('download_bandwidth');
     delete_value('archive_size');
     delete_value('num_archive_downloads');
     delete_value('num_downloads_downloaded');
     deldir_contents(get_custom_file_base() . '/uploads/downloads', true);
     delete_menu_item_simple('_SEARCH:downloads:type=misc');
 }
コード例 #3
0
ファイル: watch_chatroom.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('watch_chatroom', array('h', 'u'), array(true)), '', '');
     } else {
         require_code('chat');
         if (array_key_exists('u', $options) || array_key_exists('unwatch', $options)) {
             delete_value('occle_watched_chatroom');
             $_chatroom = do_lang('SUCCESS');
         } elseif (array_key_exists(0, $parameters)) {
             if (is_numeric($parameters[0])) {
                 $chatroom = $parameters[0];
             } else {
                 $chatroom = get_chatroom_id($parameters[0]);
             }
             if (is_null($chatroom)) {
                 return array('', '', '', do_lang('MISSING_RESOURCE'));
             }
             set_value('occle_watched_chatroom', $chatroom);
             $_chatroom = get_chatroom_name($chatroom);
         } else {
             $_chatroom = get_chatroom_name(intval(get_value('occle_watched_chatroom')), true);
             if (is_null($_chatroom)) {
                 return array('', '', '', do_lang('MISSING_RESOURCE'));
             }
         }
         return array('', '', $_chatroom, '');
     }
 }
コード例 #4
0
ファイル: newsletter.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletters');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter_archive');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter_subscribe');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter_drip_send');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter_periodic');
     delete_config_option('newsletter_text');
     delete_config_option('newsletter_title');
     delete_config_option('interest_levels');
     delete_value('newsletter_whatsnew');
     delete_value('newsletter_send_time');
     delete_specific_permission('change_newsletter_subscriptions');
     delete_menu_item_simple('_SEARCH:newsletter:type=misc');
 }
コード例 #5
0
ファイル: admin_backup.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     delete_value('last_backup');
     delete_value('backup_max_size');
     delete_value('backup_schedule_time');
     delete_value('backup_recurrance_days');
     delete_value('backup_max_size');
     delete_value('backup_b_type');
     delete_config_option('backup_time');
     delete_config_option('backup_time');
     delete_config_option('backup_server_hostname');
     delete_config_option('backup_server_port');
     delete_config_option('backup_server_user');
     delete_config_option('backup_server_password');
     delete_config_option('backup_server_path');
     delete_config_option('backup_overwrite');
     //deldir_contents(get_custom_file_base().'/exports/backups',true);
 }
コード例 #6
0
ファイル: backups.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     if (!addon_installed('backup')) {
         return;
     }
     $backup_schedule_time = intval(get_value('backup_schedule_time'));
     if ($backup_schedule_time != 0) {
         $backup_recurrance_days = intval(get_value('backup_recurrance_days'));
         $time = time();
         $last_time = intval(get_value('last_backup'));
         if ($time >= $backup_schedule_time) {
             decache('main_staff_checklist');
             require_lang('backups');
             require_code('backup');
             $max_size = get_value('backup_max_size');
             $b_type = get_value('backup_b_type');
             global $MB2_FILE, $MB2_B_TYPE, $MB2_MAX_SIZE;
             $end = get_option('backup_overwrite') != '1' || $b_type == 'incremental' ? uniqid('', true) : 'scheduled';
             if ($b_type == 'full') {
                 $file = 'restore_' . $end;
             } elseif ($b_type == 'incremental') {
                 $file = 'dif_' . $end;
             } elseif ($b_type == 'sql') {
                 $file = 'database_' . $end;
             }
             $MB2_FILE = $file;
             $MB2_B_TYPE = $b_type;
             $MB2_MAX_SIZE = $max_size;
             register_shutdown_function('make_backup_2');
             if ($backup_recurrance_days == 0) {
                 delete_value('backup_schedule_time');
             } else {
                 set_value('backup_schedule_time', strval($backup_schedule_time + $backup_recurrance_days * 60 * 60 * 24));
             }
         }
     }
 }
コード例 #7
0
ファイル: admin_import.php プロジェクト: erico-deh/ocPortal
 /**
  * The actualiser to do an import.
  *
  * @return tempcode		The UI
  */
 function do_import()
 {
     $refresh_url = get_self_url(true, false, array('type' => 'import'), true);
     $refresh_time = either_param_integer('refresh_time', 15);
     // Shouldn't default, but reported on some systems to do so
     if (function_exists('set_time_limit')) {
         @set_time_limit($refresh_time);
     }
     header('Content-type: text/html; charset=' . get_charset());
     @ini_set('log_errors', '0');
     global $I_REFRESH_URL;
     $I_REFRESH_URL = $refresh_url;
     require_code('database_action');
     $title = get_page_title('IMPORT');
     $importer = get_param('importer');
     require_code('hooks/modules/admin_import/' . filter_naughty_harsh($importer));
     $object = object_factory('Hook_' . filter_naughty_harsh($importer));
     // Get data
     $old_base_dir = either_param('old_base_dir');
     if (method_exists($object, 'verify_base_path') && !$object->verify_base_path($old_base_dir)) {
         warn_exit(do_lang_tempcode('BAD_IMPORT_PATH', escape_html($old_base_dir)));
     }
     if (method_exists($object, 'probe_db_access')) {
         list($db_name, $db_user, $db_password, $db_table_prefix) = $object->probe_db_access(either_param('old_base_dir'));
     } else {
         $db_name = either_param('db_name');
         $db_user = either_param('db_user');
         $db_password = either_param('db_password');
         $db_table_prefix = either_param('db_table_prefix');
     }
     if ($db_name == get_db_site() && $importer == 'ocp_merge' && $db_table_prefix == $GLOBALS['SITE_DB']->get_table_prefix()) {
         warn_exit(do_lang_tempcode('IMPORT_SELF_NO'));
     }
     $import_source = is_null($db_name) ? NULL : new database_driver($db_name, get_db_site_host(), $db_user, $db_password, $db_table_prefix);
     // Some preliminary tests
     $happy = get_param_integer('happy', 0);
     if (method_exists($object, 'pre_import_tests') && $happy == 0) {
         $ui = $object->pre_import_tests($import_source, $db_table_prefix, $old_base_dir);
         if (!is_null($ui)) {
             return $ui;
         }
     }
     // Save data
     $GLOBALS['SITE_DB']->query_delete('import_session', array('imp_session' => get_session_id()), '', 1);
     $GLOBALS['SITE_DB']->query_insert('import_session', array('imp_hook' => '', 'imp_old_base_dir' => $old_base_dir, 'imp_db_name' => is_null($db_name) ? '' : $db_name, 'imp_db_user' => is_null($db_user) ? '' : $db_user, 'imp_db_table_prefix' => is_null($db_table_prefix) ? '' : $db_table_prefix, 'imp_refresh_time' => $refresh_time, 'imp_session' => get_session_id()));
     $info = $object->info();
     $_import_list = $info['import'];
     $out = new ocp_tempcode();
     $parts_done = collapse_2d_complexity('imp_id', 'imp_session', $GLOBALS['SITE_DB']->query_select('import_parts_done', array('imp_id', 'imp_session'), array('imp_session' => get_session_id())));
     $import_last = '-1';
     if (get_forum_type() != 'ocf') {
         require_code('forum/ocf');
         $GLOBALS['OCF_DRIVER'] = new forum_driver_ocf();
         $GLOBALS['OCF_DRIVER']->connection = $GLOBALS['SITE_DB'];
         $GLOBALS['OCF_DRIVER']->MEMBER_ROWS_CACHED = array();
     }
     $_import_list[] = 'ocf_switch';
     $all_skipped = true;
     $lang_array = array();
     $hooks = find_all_hooks('modules', 'admin_import_types');
     foreach (array_keys($hooks) as $hook) {
         require_code('hooks/modules/admin_import_types/' . filter_naughty_harsh($hook));
         $_hook = object_factory('Hook_admin_import_types_' . filter_naughty_harsh($hook));
         $lang_array += $_hook->run();
     }
     foreach ($_import_list as $import) {
         $import_this = either_param_integer('import_' . $import, 0);
         if ($import_this == 1) {
             $dependency = NULL;
             if (array_key_exists('dependencies', $info) && array_key_exists($import, $info['dependencies'])) {
                 foreach ($info['dependencies'][$import] as $_dependency) {
                     if (!array_key_exists($_dependency, $parts_done) && isset($lang_array[$_dependency])) {
                         $dependency = $_dependency;
                     }
                 }
             }
             if (is_null($dependency)) {
                 if ($import == 'ocf_switch') {
                     $out->attach($this->ocf_switch());
                 } else {
                     $function_name = 'import_' . $import;
                     ocf_over_local();
                     $func_output = call_user_func_array(array($object, $function_name), array($import_source, $db_table_prefix, $old_base_dir));
                     if (!is_null($func_output)) {
                         $out->attach($func_output);
                     }
                     ocf_over_msn();
                 }
                 $parts_done[$import] = get_session_id();
                 $import_last = $import;
                 $all_skipped = false;
                 $GLOBALS['SITE_DB']->query_delete('import_parts_done', array('imp_id' => $import, 'imp_session' => get_session_id()), '', 1);
                 $GLOBALS['SITE_DB']->query_insert('import_parts_done', array('imp_id' => $import, 'imp_session' => get_session_id()));
             } else {
                 $out->attach(do_template('IMPORT_MESSAGE', array('_GUID' => 'b2a853f5fb93beada51a3eb8fbd1575f', 'MESSAGE' => do_lang_tempcode('IMPORT_OF_SKIPPED', escape_html($import), escape_html($dependency)))));
             }
         }
     }
     if (!$all_skipped) {
         $lang_code = 'SUCCESS';
         if (count($GLOBALS['ATTACHED_MESSAGES_RAW']) != 0) {
             $lang_code = 'SOME_ERRORS_OCCURRED';
         }
         $out->attach(do_template('IMPORT_MESSAGE', array('_GUID' => '4c4860d021814ffd1df6e21e712c7b44', 'MESSAGE' => do_lang_tempcode($lang_code))));
     }
     log_it('IMPORT');
     // Quick and simple decacheing. No need to be smart about this.
     delete_value('ocf_member_count');
     delete_value('ocf_topic_count');
     delete_value('ocf_post_count');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('IMPORT')), array('_SELF:_SELF:session', do_lang_tempcode('IMPORT_SESSION')), array('_SELF:_SELF:hook:importer=' . $importer . ':session=' . get_param('session'), do_lang_tempcode('IMPORT'))));
     breadcrumb_set_self(do_lang_tempcode('START'));
     $back_url = build_url(array('page' => '_SELF', 'type' => 'hook', 'importer' => get_param('importer'), 'just' => $import_last), '_SELF');
     $_GET['just'] = $import_last;
     return $this->choose_actions($out);
 }
コード例 #8
0
ファイル: ocf_install.php プロジェクト: erico-deh/ocPortal
/**
 * Uninstall OCF (1).
 */
function uninstall_ocf_everytime()
{
    delete_specific_permission('enquire_on_new_ips');
    // Used to exist
    delete_specific_permission('allow_deletive_moderation');
    // Used to exist
    global $OCF_TRUE_PERMISSIONS, $OCF_FALSE_PERMISSIONS;
    foreach ($OCF_TRUE_PERMISSIONS as $permission) {
        delete_specific_permission($permission);
    }
    foreach ($OCF_FALSE_PERMISSIONS as $permission) {
        delete_specific_permission($permission);
    }
    $GLOBALS['FORUM_DB']->query_delete('group_category_access', array('module_the_name' => 'forums'));
    delete_config_option('signup_fullname');
    delete_config_option('allow_email_from_staff_disable');
    delete_config_option('forum_posts_per_page');
    delete_config_option('forum_topics_per_page');
    delete_config_option('prevent_shouting');
    delete_config_option('restricted_usernames');
    delete_config_option('require_new_member_validation');
    delete_config_option('reported_posts_forum');
    delete_config_option('one_per_email_address');
    delete_config_option('hot_topic_definition');
    delete_config_option('httpauth_is_enabled');
    delete_config_option('send_staff_message_post_validation');
    delete_config_option('post_history_days');
    delete_config_option('is_on_invites');
    delete_config_option('invites_per_day');
    delete_config_option('is_on_coppa');
    delete_config_option('privacy_fax');
    delete_config_option('privacy_postal_address');
    delete_config_option('minimum_password_length');
    delete_config_option('maximum_password_length');
    delete_config_option('minimum_username_length');
    delete_config_option('maximum_username_length');
    delete_config_option('prohibit_password_whitespace');
    delete_config_option('prohibit_password_dictionary');
    delete_config_option('prohibit_username_whitespace');
    delete_config_option('random_avatars');
    delete_config_option('club_forum_parent_forum');
    delete_config_option('club_forum_parent_category');
    delete_config_option('delete_trashed_pts');
    delete_config_option('allow_member_integration');
    delete_config_option('probation_usergroup');
    delete_config_option('threaded_comments');
    //delete_config_option('threaded_topics_default');
    delete_config_option('show_first_join_page');
    delete_config_option('skip_email_confirm_join');
    delete_config_option('no_dob_ask');
    delete_config_option('allow_international');
    delete_config_option('is_on_post_titles');
    delete_config_option('is_on_anonymous_posts');
    delete_config_option('is_on_timezone_detection');
    delete_config_option('is_on_topic_descriptions');
    delete_config_option('is_on_topic_emoticons');
    delete_config_option('default_preview_guests');
    delete_config_option('forced_preview_option');
    delete_config_option('overt_whisper_suggestion');
    delete_config_option('is_on_invisibility');
    delete_config_option('allow_alpha_search');
    delete_config_option('allow_email_disable');
    delete_config_option('max_member_title_length');
    delete_config_option('encryption_key');
    delete_config_option('decryption_key');
    delete_config_option('intro_forum_id');
    delete_value('ocf_newest_member_id');
    delete_value('ocf_newest_member_username');
    delete_value('ocf_member_count');
    delete_value('ocf_topic_count');
    delete_value('ocf_post_count');
    deldir_contents(get_custom_file_base() . '/uploads/ocf_avatars', true);
    deldir_contents(get_custom_file_base() . '/uploads/ocf_photos', true);
    deldir_contents(get_custom_file_base() . '/uploads/ocf_photos_thumbs', true);
    deldir_contents(get_custom_file_base() . '/uploads/avatars', true);
    deldir_contents(get_custom_file_base() . '/uploads/photos', true);
    deldir_contents(get_custom_file_base() . '/uploads/photos_thumbs', true);
    delete_attachments('ocf_post');
    delete_attachments('ocf_signature');
}
コード例 #9
0
}
// Check if a project was deleted
if (isset($_POST['delete_project'])) {
    $value = (int) $_POST['projects'];
    // There is an alert message
    $alert = true;
    // Verify value is an integer
    if (is_int($value)) {
        // If the project ID is 0 (ie. Unassigned Risks)
        if ($value == 0) {
            $alert_message = "You cannot delete the Unassigned Risks project or we will have no place to put unassigned risks.  Sorry.";
        } else {
            if (project_has_risks($value)) {
                $alert_message = "You cannot delete a project that has risks assigned to it.  Drag the risks back to the Unassigned Risks tab, save it, and try again.";
            } else {
                delete_value("projects", $value);
                // Audit log
                $risk_id = 1000;
                $message = "An existing project was removed by the \"" . $_SESSION['user'] . "\" user.";
                write_log($risk_id, $_SESSION['uid'], $message);
                $alert_message = "An existing project was deleted successfully.";
            }
        }
    } else {
        $alert_message = "The project ID was not a valid v\nalue.  Please try again.";
    }
}
?>

<!doctype html>
<html>
コード例 #10
0
            $message = "A new user was added by the \"" . $_SESSION['user'] . "\" user.";
            write_log($risk_id, $_SESSION['uid'], $message);
            $alert_message = "The new user was added successfully.";
        } else {
            $alert_message = "The username already exists.  Please try again with a different username.";
        }
    } else {
        $alert_message = "The password and repeat password entered were different.  Please try again.";
    }
}
// Check if a user was deleted
if (isset($_POST['delete_user'])) {
    $value = (int) $_POST['user'];
    // Verify value is an integer
    if (is_int($value)) {
        delete_value("user", $value);
        // Audit log
        $risk_id = 1000;
        $message = "An existing user was deleted by the \"" . $_SESSION['user'] . "\" user.";
        write_log($risk_id, $_SESSION['uid'], $message);
        // There is an alert message
        $alert = true;
        $alert_message = "The existing user was deleted successfully.";
    }
}
// Check if a password reset was requeted
if (isset($_POST['password_reset'])) {
    $value = (int) $_POST['user'];
    // Verify value is an integer
    if (is_int($value)) {
        password_reset_by_userid($value);
コード例 #11
0
             break 1;
             //re-switch with new record_id
         }
         break 2;
         //display error
     //display error
     case UPDATE_VALUE:
         prop_fields();
         $_STATE->msgGreet = $_STATE->msgGreet_prefix . "Edit property";
         if (isset($_POST["btnReset"])) {
             value_info();
             break 2;
             //start over
         }
         if (isset($_POST["btnDelete"])) {
             delete_value();
             $_STATE = $_STATE->loopback(LIST_VALUES);
             break 1;
             //re-switch
         }
         if (update_value_audit()) {
             $_STATE = $_STATE->loopback(SELECTED_VALUE);
             break 1;
             //re-switch
         }
         break 2;
         //display error
     //display error
     default:
         throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid state=" . $_STATE->status);
 }
コード例 #12
0
    // Insert a new close reason up to 50 chars
    add_name("close_reason", $name, 50);
    // Audit log
    $risk_id = 1000;
    $message = "A new close reason was added by the \"" . $_SESSION['user'] . "\" user.";
    write_log($risk_id, $_SESSION['uid'], $message);
    // There is an alert message
    $alert = true;
    $alert_message = "A new close reason was added successfully.";
}
// Check if a close reason was deleted
if (isset($_POST['delete_close_reason'])) {
    $value = (int) $_POST['close_reason'];
    // Verify value is an integer
    if (is_int($value)) {
        delete_value("close_reason", $value);
        // Audit log
        $risk_id = 1000;
        $message = "An existing close reason was removed by the \"" . $_SESSION['user'] . "\" user.";
        write_log($risk_id, $_SESSION['uid'], $message);
        // There is an alert message
        $alert = true;
        $alert_message = "An existing close reason was removed successfully.";
    }
}
?>

<!doctype html>
<html>
  
  <head>