/** * Standard modular render function for profile tabs edit hooks. * * @param MEMBER The ID of the member who is being viewed * @param MEMBER The ID of the member who is doing the viewing * @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later * @return ?array A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set) */ function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false) { $title = do_lang_tempcode('DELETE_MEMBER'); $order = 200; // Actualiser $delete_account = post_param_integer('delete', 0); if ($delete_account == 1) { if (is_guest($member_id_of)) { warn_exit(do_lang_tempcode('INTERNAL_ERROR')); } ocf_delete_member($member_id_of); inform_exit(do_lang_tempcode('SUCCESS')); } if ($leave_to_ajax_if_possible) { return NULL; } // UI fields $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of); $text = do_lang_tempcode('_DELETE_MEMBER' . ($member_id_of == get_member() ? '_SUICIDAL' : ''), escape_html($username)); $fields = new ocp_tempcode(); require_code('form_templates'); $fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete', false)); $javascript = ''; return array($title, $fields, $text, $javascript, $order); }
function tearDown() { ocf_delete_member($this->user_id); parent::tearDown(); }
/** * Standard modular directory removal function for OcCLE FS hooks. * * @param array The current meta-directory path * @param string The root node of the current meta-directory * @param string The directory name * @param array A reference to the OcCLE filesystem object * @return boolean Success? */ function remove_directory($meta_dir, $meta_root_node, $dir_name, &$occle_fs) { if (get_forum_type() != 'ocf') { return false; } if (count($meta_dir) < 1) { //We're at the top level, and removing a member require_code('ocf_members_action'); require_code('ocf_members_action2'); ocf_delete_member($GLOBALS['FORUM_DRIVER']->get_member_from_username($dir_name)); } else { return false; } //Directories aren't allowed to be removed anywhere else return true; }
/** * The actualiser for LDAP synchronisation. * * @return tempcode The UI */ function actual() { $title = get_page_title('LDAP_SYNC'); $all_ldap_groups = ocf_get_all_ldap_groups(); foreach ($all_ldap_groups as $group) { if (post_param_integer('add_group_' . str_replace(' ', '_space_', $group), 0) == 1) { ocf_make_group($group, 0, 0, 0, ''); } } $all_ocp_groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(); foreach ($all_ocp_groups as $id => $group) { if (post_param_integer('delete_group_' . strval($id), 0) == 1) { ocf_delete_group($id); } } $all_ldap_members = $GLOBALS['FORUM_DB']->query_select('f_members', array('id'), array('m_password_compat_scheme' => 'ldap')); require_code('ocf_groups_action'); require_code('ocf_groups_action2'); foreach ($all_ldap_members as $row) { $id = $row['id']; if (post_param_integer('delete_member_' . strval($id), 0) == 1) { ocf_delete_member($id); } } breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('LDAP_SYNC')))); breadcrumb_set_self(do_lang_tempcode('DONE')); $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF'); return redirect_screen($title, $url, do_lang_tempcode('SUCCESS')); }
/** * The actualiser for deletion members according to delurk criteria. * * @return tempcode The UI */ function __delurk() { $title = get_page_title('DELETE_LURKERS'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/deletelurkers'; require_lang('ocf_lurkers'); foreach ($_POST as $key => $val) { if (substr($key, 0, 7) == 'lurker_') { $member_id = intval(substr($key, 7)); ocf_delete_member($member_id); } } breadcrumb_set_parents(array(array('_SEARCH:admin_ocf_join:menu', do_lang_tempcode('MEMBERS')), array('_SEARCH:admin_ocf_join:delurk', do_lang_tempcode('DELETE_LURKERS')))); return inform_screen($title, do_lang_tempcode('SUCCESS')); }
/** * The actualiser for merging members. * * @return tempcode The UI */ function actual() { $title = get_page_title('MERGE_MEMBERS'); $to_username = post_param('to'); $to_id = $GLOBALS['FORUM_DRIVER']->get_member_from_username($to_username); if (is_null($to_id) || is_guest($to_id)) { warn_exit(do_lang_tempcode('_USER_NO_EXIST', $to_username)); } $from_username = post_param('from'); $from_id = $GLOBALS['FORUM_DRIVER']->get_member_from_username($from_username); if (is_guest($from_id)) { warn_exit(do_lang_tempcode('INTERNAL_ERROR')); } if (is_null($from_id) || is_guest($from_id)) { warn_exit(do_lang_tempcode('_USER_NO_EXIST', $from_username)); } if ($to_id == $from_id) { warn_exit(do_lang_tempcode('MERGE_SAME')); } $meta = $GLOBALS['SITE_DB']->query('SELECT m_table,m_name FROM ' . get_table_prefix() . 'db_meta WHERE ' . db_string_equal_to('m_type', 'USER') . ' OR ' . db_string_equal_to('m_type', '?USER') . ' OR ' . db_string_equal_to('m_type', '*USER')); foreach ($meta as $m) { $GLOBALS['SITE_DB']->query_update($m['m_table'], array($m['m_name'] => $to_id), array($m['m_name'] => $from_id), '', NULL, NULL, false, true); } $GLOBALS['FORUM_DB']->query_update('f_posts', array('p_poster_name_if_guest' => $to_username), array('p_poster' => $from_id)); $new_post_count = $GLOBALS['FORUM_DRIVER']->get_member_row_field($from_id, 'm_cache_num_posts') + $GLOBALS['FORUM_DRIVER']->get_member_row_field($to_id, 'm_cache_num_posts'); $GLOBALS['FORUM_DB']->query_update('f_members', array('m_cache_num_posts' => $new_post_count), array('id' => $to_id), '', 1); require_code('ocf_members_action'); require_code('ocf_members_action2'); $fields = ocf_get_custom_fields_member($from_id); foreach ($fields as $key => $val) { if ($val != '') { ocf_set_custom_field($to_id, $key, $val); } } ocf_delete_member($from_id); // Cache emptying ... ocf_require_all_forum_stuff(); require_code('ocf_posts_action'); require_code('ocf_posts_action2'); require_code('ocf_topics_action2'); require_code('ocf_forums_action2'); // Members ocf_force_update_member_post_count($to_id); $num_warnings = $GLOBALS['FORUM_DB']->query_value('f_warnings', 'COUNT(*)', array('w_member_id' => $to_id)); $GLOBALS['FORUM_DB']->query_update('f_members', array('m_cache_warnings' => $num_warnings), array('id' => $to_id), '', 1); // Topics and posts require_code('ocf_topics_action'); $topics = $GLOBALS['FORUM_DB']->query_select('f_topics', array('id', 't_forum_id'), array('t_cache_first_member_id' => $from_id)); foreach ($topics as $topic) { ocf_force_update_topic_cacheing($topic['id'], NULL, true, true); } $topics = $GLOBALS['FORUM_DB']->query_select('f_topics', array('id', 't_forum_id'), array('t_cache_last_member_id' => $from_id)); foreach ($topics as $topic) { ocf_force_update_topic_cacheing($topic['id'], NULL, true, true); } // Forums require_code('ocf_posts_action2'); $forums = $GLOBALS['FORUM_DB']->query_select('f_forums', array('id'), array('f_cache_last_member_id' => $from_id)); foreach ($forums as $forum) { ocf_force_update_forum_cacheing($forum['id']); } // --- log_it('MERGE_MEMBERS', $from_username, $to_username); breadcrumb_set_parents(array(array('_SEARCH:admin_ocf_join:menu', do_lang_tempcode('MEMBERS')), array('_SELF:_SELF:misc', do_lang_tempcode('MERGE_MEMBERS')))); breadcrumb_set_self(do_lang_tempcode('DONE')); $username = $GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($to_id); return inform_screen($title, do_lang_tempcode('MERGED_MEMBERS', $username)); }