Exemplo n.º 1
0
 /**
  * Standard aed_module edit actualiser.
  *
  * @param  ID_TEXT		The entry being edited
  * @return ?tempcode		Confirm message (NULL: continue)
  */
 function edit_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');
         }
     }
     $old_name = ocf_get_group_name($group_id);
     $_group_leader = post_param('group_leader');
     if ($_group_leader != '') {
         $group_leader = $GLOBALS['FORUM_DRIVER']->get_member_from_username($_group_leader);
         if (is_null($group_leader)) {
             warn_exit(do_lang_tempcode('_USER_NO_EXIST', $_group_leader));
         }
     } else {
         $group_leader = NULL;
     }
     $name = post_param('name');
     ocf_edit_group($group_id, $name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $group_leader, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, post_param_integer('open_membership', 0), 1);
     $forum_where = array('f_name' => $old_name, 'f_category_id' => intval(get_option('club_forum_parent_category')), 'f_parent_forum' => intval(get_option('club_forum_parent_forum')));
     $forum_id = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'id', $forum_where);
     if (!is_null($forum_id)) {
         $this->_set_permissions(intval($id), $forum_id);
     }
     // Rename forum
     if ($name != $old_name) {
         $GLOBALS['FORUM_DB']->query_update('f_forums', array('f_name' => $name), $forum_where, 'ORDER BY id DESC', 1);
     }
     return NULL;
 }
Exemplo n.º 2
0
 /**
  * Standard aed_module edit actualiser.
  *
  * @param  ID_TEXT		The entry being edited
  * @return ?tempcode		Confirm message (NULL: continue)
  */
 function edit_actualisation($id)
 {
     require_code('themes2');
     list($group_leader, $promotion_target, $promotion_threshold) = $this->read_in_data();
     if (!is_null($group_leader) && post_param_integer('confirm', 0) == 0 && !in_array(intval($id), $GLOBALS['FORUM_DRIVER']->get_members_groups($group_leader))) {
         require_code('templates_confirm_screen');
         return form_confirm_screen(get_page_title('EDIT_GROUP'), paragraph(do_lang_tempcode('MAKE_MEMBER_GROUP_LEADER', post_param('group_leader'))), '__ed', '_ed', array('confirm' => 1));
     }
     $was_club = $GLOBALS['FORUM_DB']->query_value('f_groups', 'g_is_private_club', array('id' => intval($id))) == 1;
     $rank_img = get_theme_img_code('ocf_rank_images', true, 'file', 'theme_img_code', $GLOBALS['FORUM_DB']);
     ocf_edit_group(intval($id), post_param('name'), post_param_integer('is_default', 0), post_param_integer('is_super_admin', 0), post_param_integer('is_super_moderator', 0), post_param('title'), $rank_img, $promotion_target, $promotion_threshold, $group_leader, post_param_integer('flood_control_submit_secs'), post_param_integer('flood_control_access_secs'), post_param_integer('max_daily_upload_mb'), post_param_integer('max_attachments_per_post'), post_param_integer('max_avatar_width', 100), post_param_integer('max_avatar_height', 100), post_param_integer('max_post_length_comcode'), post_param_integer('max_sig_length_comcode', 10000), post_param_integer('gift_points_base', 0), post_param_integer('gift_points_per_day', 0), post_param_integer('enquire_on_new_ips', 0), post_param_integer('is_presented_at_install', 0), post_param_integer('hidden', 0), post_param_integer('order'), post_param_integer('rank_image_pri_only', 0), post_param_integer('open_membership', 0), post_param_integer('is_private_club', 0));
     if (addon_installed('ecommerce')) {
         require_lang('ecommerce');
         $this->extra_donext_whatever = array(array('ecommerce', array('admin_ecommerce', array('type' => 'ad', 'group_id' => $id), '_SELF'), do_lang_tempcode('ADD_USERGROUP_SUBSCRIPTION')));
         $this->extra_donext_whatever_title = do_lang_tempcode('MODULE_TRANS_NAME_subscriptions');
     }
     if (!is_null($group_leader) && !in_array(intval($id), $GLOBALS['FORUM_DRIVER']->get_members_groups($group_leader))) {
         ocf_add_member_to_group($group_leader, intval($id));
     }
     $absorb = post_param_integer('absorb', -1);
     if ($absorb != -1) {
         ocf_group_absorb_privileges_of(intval($id), $absorb);
     }
     if (post_param_integer('is_private_club', 0) == 1 && !$was_club) {
         $GLOBALS['SITE_DB']->query_delete('gsp', array('group_id' => intval($id)));
         $GLOBALS['SITE_DB']->query_delete('group_zone_access', array('group_id' => intval($id)));
         $GLOBALS['SITE_DB']->query_delete('group_category_access', array('group_id' => intval($id)));
         $GLOBALS['SITE_DB']->query_delete('group_page_access', array('group_id' => intval($id)));
     }
     return NULL;
 }