$task = $_POST['task']; } elseif (isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; } if (isset($_POST['group_id'])) { $group_id = $_POST['group_id']; } elseif (isset($_GET['group_id'])) { $group_id = $_GET['group_id']; } else { $group_id = 0; } // CREATE GROUP OBJECT $groups_per_page = 100; $group = new se_group(); // DELETE ALBUM if ($task == "deletegroup") { if ($database->database_num_rows($database->database_query("SELECT group_id FROM se_groups WHERE group_id='{$group_id}'"))) { $group->group_delete($group_id); } } // SET USER GROUP SORT-BY VARIABLES FOR HEADING LINKS $i = "id"; // GROUP_ID $t = "t"; // GROUP_TITLE $o = "o"; // OWNER OF GROUP $m = "m"; // MEMBERS IN GROUP
$task = $_POST['task']; } elseif (isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; } // ENSURE GROUPS ARE ENABLED FOR THIS USER if (~(int) $user->level_info['level_group_allow'] & 2) { header("Location: user_home.php"); exit; } // SET EMPTY VARS $result = 0; $is_error = 0; // INITIALIZE GROUP OBJECT $group = new se_group($user->user_info['user_id'], $group_id); if ($group->group_exists == 0) { exit; } // WANTS TO JOIN GROUP if ($group->user_rank == -1 && $group->groupmember_info['groupmember_approved'] == 0) { $subpage = "join"; if ($group->groupmember_info['groupmember_id'] != 0 && $group->groupmember_info['groupmember_approved'] == 0) { $subpage = "waiting"; } } else { $subpage = "leave"; if ($group->groupmember_info['groupmember_status'] == 0) { $subpage = "confirm"; } }
$group_id = $_POST['group_id']; } elseif (isset($_GET['group_id'])) { $group_id = $_GET['group_id']; } else { $group_id = 0; } // DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION if (!$user->user_exists && !$setting['setting_permission_group'] || $user->user_exists && ~(int) $user->level_info['level_group_allow'] & 1) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 656); $smarty->assign('error_submit', 641); include "footer.php"; } // DISPLAY ERROR PAGE IF NO OWNER $group = new se_group($user->user_info['user_id'], $group_id); if (!$group->group_exists || $group->type != 4) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 2000219); $smarty->assign('error_submit', 641); include "footer.php"; } // GET VIEW AND VARS if (isset($_POST['v'])) { $v = $_POST['v']; } elseif (isset($_GET['v'])) { $v = $_GET['v']; } else { $v = "group"; }
while ($subscribe_info = $database->database_fetch_assoc($group_subscribe_query)) { $subscribe_info['total_photos'] = $database->database_num_rows($database->database_query("SELECT NULL FROM se_groupmedia INNER JOIN se_groupalbums ON se_groupmedia.groupmedia_groupalbum_id=se_groupalbums.groupalbum_id AND se_groupalbums.groupalbum_group_id='{$subscribe_info['group_id']}' WHERE se_groupmedia.groupmedia_date>'{$subscribe_info['groupsubscribe_time']}'")); $subscribe_info['total_posts'] = $database->database_num_rows($database->database_query("SELECT NULL FROM se_groupposts INNER JOIN se_grouptopics ON se_groupposts.grouppost_grouptopic_id=se_grouptopics.grouptopic_id AND se_grouptopics.grouptopic_group_id='{$subscribe_info['group_id']}' WHERE se_groupposts.grouppost_date>'{$subscribe_info['groupsubscribe_time']}'")); $group_subscribes[] = $subscribe_info; } // ASSIGN GROUP SUBSCRIPTION SMARY VARIABLE $smarty->assign('group_subscribes', $group_subscribes); $smarty->assign('total_group_subscribes', $total_group_subscribes); // SET PROFILE MENU VARS if ($total_group_subscribes) { $plugin_vars['menu_userhome'] = array('file' => 'user_home_group.tpl'); } } // SET PROFILE MENU VARS if ($owner->level_info['level_group_allow'] & 2 && $page == "profile") { $group = new se_group($owner->user_info['user_id']); $sort_by = "se_groupmembers.groupmember_rank DESC, se_groups.group_title"; $where = "(se_groupmembers.groupmember_status='1')"; // GET TOTAL GROUPS $total_groups = $group->group_total($where); // GET GROUPS ARRAY $groups = $group->group_list(0, $total_groups, $sort_by, $where); // ASSIGN GROUPS SMARY VARIABLE $smarty->assign('groups', $groups); $smarty->assign('total_groups', $total_groups); // SET PROFILE MENU VARS if ($total_groups) { $plugin_vars['menu_profile_tab'] = ""; $plugin_vars['menu_profile_side'] = array('file' => 'profile_group.tpl', 'title' => 2000007, 'name' => 'group'); } }
$groupmedia_id = $_POST['groupmedia_id']; } elseif (isset($_GET['groupmedia_id'])) { $groupmedia_id = $_GET['groupmedia_id']; } else { $groupmedia_id = 0; } // DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION if (!$user->user_exists && !$setting['setting_permission_group'] || $user->user_exists && ~(int) $user->level_info['level_group_allow'] & 1) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 656); $smarty->assign('error_submit', 641); include "footer.php"; } // DISPLAY ERROR PAGE IF NO OWNER $group = new se_group($user->user_info['user_id'], $group_id); if (!$group->group_exists) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 2000219); $smarty->assign('error_submit', 641); include "footer.php"; } // MAKE SURE MEDIA EXISTS $media_query = $database->database_query("SELECT se_groupmedia.*, se_groupalbums.*, se_users.user_id, se_users.user_username, se_users.user_fname, se_users.user_lname FROM se_groupmedia LEFT JOIN se_groupalbums ON se_groupmedia.groupmedia_groupalbum_id=se_groupalbums.groupalbum_id LEFT JOIN se_users ON se_groupmedia.groupmedia_user_id WHERE se_groupmedia.groupmedia_id='{$groupmedia_id}' AND se_groupalbums.groupalbum_group_id='{$group->group_info['group_id']}' LIMIT 1"); if (!$database->database_num_rows($media_query)) { header("Location: " . $url->url_create('group', NULL, $group->group_info['group_id'])); exit; } $media_info = $database->database_fetch_assoc($media_query); $uploader = new se_user();
$page = "user_group"; include "header.php"; if (isset($_POST['task'])) { $task = $_POST['task']; } elseif (isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; } // ENSURE GROUPS ARE ENABLED FOR THIS USER if (~(int) $user->level_info['level_group_allow'] & 2) { header("Location: user_home.php"); exit; } // SET VARIABLES AND INITIALIZE GROUP OBJECT $group = new se_group($user->user_info['user_id']); $sort_by = "se_groupmembers.groupmember_rank DESC, se_groups.group_title"; $where = "(se_groupmembers.groupmember_status='1')"; // GET TOTAL GROUPS $total_groups = $group->group_total($where); // GET GROUPS ARRAY $group_array = $group->group_list(0, $total_groups, $sort_by, $where, 1); // GET GROUPS INVITED TO $invite_where = "(se_groupmembers.groupmember_status='0' AND se_groupmembers.groupmember_approved='1')"; $total_invites = $group->group_total($invite_where); $invite_array = $group->group_list(0, $total_invites, $sort_by, $invite_where, 1); // ASSIGN VARIABLES AND SHOW VIEW GROUPS PAGE $smarty->assign('groups', $group_array); $smarty->assign('total_groups', $total_groups); $smarty->assign('invites', $invite_array); $smarty->assign('total_invites', $total_invites);
} elseif (isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; } // ENSURE GROUPS ARE ENABLED FOR THIS USER if (~(int) $user->level_info['level_group_allow'] & 1) { //header("Location: user_home.php"); exit; } // DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION if (!$user->user_exists && $setting['setting_permission_group']) { exit; } // INITIALIZE GROUP OBJECT $group = new se_group($user->user_info[user_id], $group_id); if ($group->group_exists == 0) { exit; } // CHECK IF USER IS ALLOWED TO UPLOAD PHOTOS $privacy_max = $group->group_privacy_max($user); if (!($privacy_max & $group->group_info['group_privacy'])) { exit; } if (!($privacy_max & $group->group_info['group_upload'])) { exit; } // GET ALBUM INFO $groupalbum_info = $database->database_fetch_assoc($database->database_query("SELECT * FROM se_groupalbums WHERE groupalbum_group_id='{$group->group_info['group_id']}' LIMIT 1")); // SET RESULT AND ERROR VARS $result = "";
if (!$groupcat['groupcat_dependency']) { $cat_ids[] = $groupcat['groupcat_id']; $depcats = $database->database_query("SELECT groupcat_id FROM se_groupcats WHERE groupcat_id='{$groupcat['groupcat_id']}' OR groupcat_dependency='{$groupcat['groupcat_id']}'"); while ($depcat_info = $database->database_fetch_assoc($depcats)) { $cat_ids[] = $depcat_info['groupcat_id']; } $where .= " AND se_groups.group_groupcat_id IN('" . implode("', '", $cat_ids) . "')"; } else { $where .= " AND se_groups.group_groupcat_id='{$groupcat['groupcat_id']}'"; $groupsubcat = $groupcat; $groupcat = $database->database_fetch_assoc($database->database_query("SELECT groupcat_id, groupcat_title FROM se_groupcats WHERE groupcat_id='{$groupcat['groupcat_dependency']}' LIMIT 1")); } } } // CREATE GROUP OBJECT $group = new se_group(); // GET TOTAL GROUPS $total_groups = $group->group_total($where); // MAKE ENTRY PAGES $groups_per_page = 10; $page_vars = make_page($total_groups, $groups_per_page, $p); // GET GROUP ARRAY $group_array = $group->group_list($page_vars[0], $groups_per_page, $s, $where, TRUE); // GET CATS $field = new se_field("group"); $field->cat_list(0, 0, 0, "", "", "groupfield_id=0"); $cat_array = $field->cats; // SET GLOBAL PAGE TITLE $global_page_title[0] = 2000324; $global_page_description[0] = 2000325; // ASSIGN SMARTY VARIABLES AND DISPLAY GROUPS PAGE
// INITIALIZE VARIABLES $is_error = 0; $group_info['group_title'] = ""; $group_info['group_desc'] = ""; $group_info['group_groupcat_id'] = 0; $group_info['group_groupsubcat_id'] = 0; $group_info['group_approval'] = 0; $group_info['group_invite'] = 1; $group_info['group_search'] = 1; $group_info['group_privacy'] = $level_group_privacy[0]; $group_info['group_comments'] = $level_group_comments[0]; $group_info['group_discussion'] = $level_group_discussion[0]; $group_info['group_upload'] = $level_group_upload[0]; $groupalbum_info['groupalbum_tag'] = $level_group_tag[0]; // INITIALIZE GROUP OBJECT $group = new se_group($user->user_info['user_id'], 0); // CHECK TO MAKE SURE USER HAS LESS THAN MAX NUMBER OF GROUPS ALLOWED $owned_where = "(se_groups.group_user_id='{$user->user_info['user_id']}')"; $total_groups_owned = $group->group_total($owned_where); if ($total_groups_owned >= $user->level_info['level_group_maxnum']) { $is_error = 2000114; $task = "main"; } // ATTEMPT TO ADD GROUP if ($task == "doadd") { $group_info['group_title'] = censor($_POST['group_title']); $group_info['group_desc'] = censor(str_replace("\r\n", "<br>", $_POST['group_desc'])); $group_info['group_approval'] = $_POST['group_approval']; $group_info['group_invite'] = $_POST['group_invite']; $group_info['group_search'] = $_POST['group_search']; $group_info['group_privacy'] = $_POST['group_privacy'];
$p = 1; } if (isset($_POST['s'])) { $s = $_POST['s']; } elseif (isset($_GET['s'])) { $s = $_GET['s']; } else { $s = "u"; } // ENSURE GROUPS ARE ENABLED FOR THIS USER if (~(int) $user->level_info['level_group_allow'] & 2) { header("Location: user_home.php"); exit; } // INITIALIZE GROUP OBJECT $group = new se_group($user->user_info['user_id'], $group_id); if ($group->group_exists == 0) { header("Location: user_group.php"); exit; } if ($group->user_rank == 0 || $group->user_rank == -1) { header("Location: user_group.php"); exit; } // APPROVE MEMBERSHIP REQUEST if ($task == "approve") { $member_query = $database->database_query("SELECT * FROM se_groupmembers WHERE groupmember_id='{$groupmember_id}' AND groupmember_approved=0 AND groupmember_group_id='{$group->group_info['group_id']}'"); if ($database->database_num_rows($member_query)) { $member_info = $database->database_fetch_assoc($member_query); $database->database_query("UPDATE se_groupmembers SET groupmember_status=1, groupmember_approved=1 WHERE groupmember_id='{$groupmember_id}' AND groupmember_group_id='{$group->group_info['group_id']}'"); $database->database_query("UPDATE se_groups SET group_totalmembers=group_totalmembers+1 WHERE group_id='{$group->group_info['group_id']}' LIMIT 1");
$task = "main"; } if (isset($_POST['justadded'])) { $justadded = $_POST['justadded']; } elseif (isset($_GET['justadded'])) { $justadded = $_GET['justadded']; } else { $justadded = ""; } // ENSURE GROUPS ARE ENABLED FOR THIS USER if (~(int) $user->level_info['level_group_allow'] & 2) { header("Location: user_home.php"); exit; } // INITIALIZE GROUP OBJECT $group = new se_group($user->user_info[user_id], $group_id); if (!$group->group_exists || $group->user_rank <= 0) { header("Location: user_group.php"); exit; } // INITIALIZE VARIABLES $is_error = 0; $result = 0; // DELETE GROUP if ($task == "delete_do" && $group->user_rank == 2) { $group->group_delete($group->group_info[group_id]); header("Location: user_group.php"); exit; } // DELETE PHOTO if ($task == "remove" && $group->groupowner_level_info['level_group_photo'] != 0) {
$group_id = $_POST['group_id']; } elseif (isset($_GET['group_id'])) { $group_id = $_GET['group_id']; } else { $group_id = 0; } // DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION if (!$user->user_exists && !$setting['setting_permission_group'] || $user->user_exists && ~(int) $user->level_info['level_group_allow'] & 1) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 656); $smarty->assign('error_submit', 641); include "footer.php"; } // DISPLAY ERROR PAGE IF NO OWNER $group = new se_group($user->user_info['user_id'], $group_id); if (!$group->group_exists) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 2000219); $smarty->assign('error_submit', 641); include "footer.php"; } // GET PRIVACY LEVEL $privacy_max = $group->group_privacy_max($user); if (!($privacy_max & $group->group_info['group_privacy'])) { header("Location: " . $url->url_create('group', NULL, $group->group_info['group_id'])); exit; } // CHECK IF USER IS ALLOWED TO DISCUSS if (!($privacy_max & $group->group_info['group_discussion'])) {
function deleteuser_group($user_id) { global $database; // INITATE GROUP OBJECT $group = new se_group($user_id); // LOOP OVER GROUPS AND DELETE THEM $groups = $database->database_query("SELECT group_id FROM se_groups WHERE group_user_id='{$user_id}'"); while ($group_info = $database->database_fetch_assoc($groups)) { $group->group_delete($group_info['group_id']); } // DELETE USER FROM ALL GROUPS $database->database_query("DELETE FROM se_groupmembers WHERE groupmember_user_id='{$user_id}'"); $database->database_query("DELETE FROM se_groupsubscribes WHERE groupsubscribe_user_id='{$user_id}'"); $database->database_query("UPDATE se_groupmediatags SET groupmediatag_user_id='0' WHERE groupmediatag_user_id='{$user_id}'"); }
function he_wall_group_photo_upload($group_id, $media_desc, $new_action_id) { global $user, $url, $misc, $setting; $group = new se_group($user->user_info['user_id'], $group_id); // CHECK IF USER IS ALLOWED TO UPLOAD PHOTOS $privacy_max = $group->group_privacy_max($user); if (!($privacy_max & $group->group_info['group_privacy']) || !($privacy_max & $group->group_info['group_upload'])) { $result = array('result' => 0, 'error' => SE_Language::get(690706101)); } $album_id = he_wall::get_group_album($group_id); // GET TOTAL SPACE USED $space_used = $group->group_media_space(); if ($group->groupowner_level_info['level_group_album_storage']) { $space_left = $group->groupowner_level_info['level_group_album_storage'] - $space_used; } else { $space_left = $dfs = disk_free_space("/") ? $dfs : pow(2, 32); } $update_album = 0; $file_result = $group->group_media_upload('wall_photo', $album_id, $space_left); if ($file_result['is_error'] == 0) { $media_path = str_replace('./', '', $group->group_dir($group->group_info['group_id']) . $file_result['groupmedia_id'] . "_thumb.jpg"); $media_link = "group_album_file.php?group_id={$group->group_info['group_id']}&groupmedia_id={$file_result['groupmedia_id']}"; if (file_exists($media_path)) { $thumb_width = (int) $setting['setting_he_wall_photo_thumb_width']; $thumb_height = (int) $setting['setting_he_wall_photo_thumb_height']; $media_width = $misc->photo_size($media_path, $thumb_width, $thumb_height, "w"); $media_height = $misc->photo_size($media_path, $thumb_width, $thumb_height, "h"); $result = array('result' => 1, 'media_path' => $media_path, 'media_width' => $media_width, 'media_height' => $media_height); } // UPDATE ALBUM UPDATED DATE he_wall::update_group_album($album_id); he_wall::update_group_album_media($file_result['groupmedia_id'], $media_desc); he_wall::add_group_album_media($new_action_id, $file_result['groupmedia_id']); // UPDATE LAST UPDATE DATE (SAY THAT 10 TIMES FAST) $group->group_lastupdate(); } else { $error_msg = sprintf(SE_Language::_get($file_result['is_error']), $file_result['file_name']); $result = array('result' => 0, 'error' => $error_msg); } return $result; }
$grouppost_id = $_POST['grouppost_id']; } elseif (isset($_GET['grouppost_id'])) { $grouppost_id = $_GET['grouppost_id']; } else { $grouppost_id = 0; } // DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION if (!$user->user_exists && !$setting['setting_permission_group'] || $user->user_exists && ~(int) $user->level_info['level_group_allow'] & 1) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 656); $smarty->assign('error_submit', 641); include "footer.php"; } // DISPLAY ERROR PAGE IF NO OWNER $group = new se_group($user->user_info['user_id'], $group_id); if (!$group->group_exists) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 2000219); $smarty->assign('error_submit', 641); include "footer.php"; } // CHECK THAT TOPIC EXISTS AND GET TOPIC INFO $topic_query = $database->database_query("SELECT * FROM se_grouptopics WHERE grouptopic_id='{$grouptopic_id}' AND grouptopic_group_id='{$group->group_info['group_id']}' LIMIT 1"); if (!$database->database_num_rows($topic_query)) { header("Location: " . $url->url_create("group", NULL, $group->group_info['group_id']) . "&v=discussions"); exit; } $topic_info = $database->database_fetch_assoc($topic_query); // CHECK IF USER IS ADMIN OR OFFICER