Example #1
0
 /**
  * Standard modular run function for setting features from the setup wizard.
  */
 function set_fields()
 {
     if (get_forum_type() != 'ocf') {
         return;
     }
     $dbs_back = $GLOBALS['NO_DB_SCOPE_CHECK'];
     $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
     require_lang('ocf');
     if (post_param_integer('have_default_rank_set', 0) == 0) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('f_groups', 'id', array('id' => db_get_first_id() + 8));
         if (!is_null($test)) {
             $promotion_target = ocf_get_group_property(db_get_first_id() + 8, 'promotion_target');
             if (!is_null($promotion_target)) {
                 $GLOBALS['SITE_DB']->query_update('f_groups', array('g_promotion_target' => NULL, 'g_promotion_threshold' => NULL, 'g_rank_image' => ''), array('id' => db_get_first_id() + 8), '', 1);
                 for ($i = db_get_first_id() + 4; $i < db_get_first_id() + 8; $i++) {
                     require_code('ocf_groups_action');
                     require_code('ocf_groups_action2');
                     ocf_delete_group($i);
                 }
             }
             $_name = ocf_get_group_property(db_get_first_id() + 8, 'name');
             if (is_integer($_name)) {
                 lang_remap($_name, do_lang('MEMBER'));
             }
         }
     }
     if (post_param_integer('have_default_full_emoticon_set', 0) == 0) {
         $GLOBALS['SITE_DB']->query('DELETE FROM ' . get_table_prefix() . 'f_emoticons WHERE e_code<>\':P\' AND e_code<>\';)\' AND e_code<>\':)\' AND e_code<>\':)\' AND e_code<>\':\\\'(\'');
     }
     if (post_param_integer('have_default_cpf_set', 0) == 0) {
         $fields = array('im_aim', 'im_msn', 'im_yahoo', 'im_skype', 'interests', 'location', 'occupation');
         foreach ($fields as $field) {
             $test = $GLOBALS['SITE_DB']->query_value_null_ok('f_custom_fields f LEFT JOIN ' . get_table_prefix() . 'translate t ON t.id=f.cf_name', 'f.id', array('text_original' => do_lang('DEFAULT_CPF_' . $field . '_NAME')));
             if (!is_null($test)) {
                 require_code('ocf_members_action');
                 require_code('ocf_members_action2');
                 ocf_delete_custom_field($test);
             }
         }
     }
     $GLOBALS['NO_DB_SCOPE_CHECK'] = $dbs_back;
 }
Example #2
0
 /**
  * Standard import function.
  *
  */
 function import_ocf_remove_old_groups()
 {
     $delete_groups = array('Local hero', 'Regular', 'Local', 'Old timer');
     $rows = $GLOBALS['SITE_DB']->query('SELECT g.id, t.text_original FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_groups AS g INNER JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'translate AS t ON g.g_name = t.id');
     if ($rows !== NULL) {
         foreach ($rows as $row) {
             if (!in_array($row['text_original'], $delete_groups)) {
                 continue;
             }
             ocf_delete_group($row['id']);
         }
     }
 }
Example #3
0
 /**
  * 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'));
 }
Example #4
0
 /**
  * Standard aed_module delete actualiser.
  *
  * @param  ID_TEXT		The entry being deleted
  */
 function delete_actualisation($id)
 {
     $group_id = intval($id);
     require_code('ocf_groups');
     $leader = ocf_get_group_property($group_id, 'group_leader');
     $is_super_admin = ocf_get_group_property($group_id, 'is_super_admin');
     if (!has_specific_permission(get_member(), 'control_usergroups') || $is_super_admin == 1) {
         if ($leader != get_member()) {
             access_denied('I_ERROR');
         }
     }
     ocf_delete_group($group_id);
 }
Example #5
0
 /**
  * Standard aed_module delete actualiser.
  *
  * @param  ID_TEXT		The entry being deleted
  */
 function delete_actualisation($id)
 {
     ocf_delete_group(intval($id), post_param_integer('new_usergroup'));
 }