diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-07-13 23:56:46 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-07-13 23:56:46 +0000 |
commit | d9b62e9964ccfdb8f2802a64bcf4b25df79e56fa (patch) | |
tree | c82d69cf8fc714f7da46de026dac37ac16d081c1 | |
parent | 50902c641e33a850e26492db68d6dc1a3b3944af (diff) | |
download | forums-d9b62e9964ccfdb8f2802a64bcf4b25df79e56fa.tar forums-d9b62e9964ccfdb8f2802a64bcf4b25df79e56fa.tar.gz forums-d9b62e9964ccfdb8f2802a64bcf4b25df79e56fa.tar.bz2 forums-d9b62e9964ccfdb8f2802a64bcf4b25df79e56fa.tar.xz forums-d9b62e9964ccfdb8f2802a64bcf4b25df79e56fa.zip |
A demo of some Group CP functionality
git-svn-id: file:///svn/phpbb/trunk@658 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/groupcp.php | 249 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 1 | ||||
-rw-r--r-- | phpBB/index.php | 8 |
3 files changed, 253 insertions, 5 deletions
diff --git a/phpBB/groupcp.php b/phpBB/groupcp.php index 76530beb88..b408374980 100644 --- a/phpBB/groupcp.php +++ b/phpBB/groupcp.php @@ -26,17 +26,264 @@ $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); +$pagetype = "groupcp"; +$page_title = $lang['Group_Control_Panel']; + // // Start session management // -$userdata = session_pagestart($user_ip, PAGE_PROFILE, $session_length); +$userdata = session_pagestart($user_ip, PAGE_GROUPCP, $session_length); init_userprefs($userdata); // // End session management // +if(!isset($HTTP_GET_VARS['start'])) +{ + $start = 0; +} + + +// +// Page header +// include($phpbb_root_path . 'includes/page_header.'.$phpEx); +// +// What shall we do? hhmmmm +// +if( isset($HTTP_GET_VARS[POST_GROUPS_URL]) ) +{ + + $group_id = $HTTP_GET_VARS[POST_GROUPS_URL]; + + $sql = "SELECT * + FROM " . GROUPS_TABLE . " + WHERE group_id = $group_id"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Error getting group information", "", __LINE__, __FILE__, $sql); + } + if( !$db->sql_numrows($result) ) + { + message_die(GENERAL_MESSAGE, "That user group does not exist"); + } + $group_info = $db->sql_fetchrow($result); + + $template->set_filenames(array( + "info" => "groupcp_info_body.tpl", + "list" => "groupcp_list_body.tpl", + "jumpbox" => "jumpbox.tpl") + ); + + $jumpbox = make_jumpbox(); + $template->assign_vars(array( + "JUMPBOX_LIST" => $jumpbox, + "SELECT_NAME" => POST_FORUM_URL) + ); + $template->assign_var_from_handle("JUMPBOX", "jumpbox"); + + $template->assign_vars(array( + "L_GROUP_NAME" => "Group Name", + "L_GROUP_DESC" => "Group Description", + + "GROUP_NAME" => $group_info['group_name'], + "GROUP_DESC" => $group_info['group_description'], + "GROUP_MEMBERSHIP_DETAILS" => "") + ); + + + $sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm, u.user_avatar + FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug + WHERE ug.group_id = $group_id + AND u.user_id = ug.user_id + ORDER BY u.user_regdate"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Error getting user list for group", "", __LINE__, __FILE__, $sql); + } + + // + // Parse group info output + // + $template->pparse("info"); + + + // + // Generate memberlist if there any! + // + if( ( $users_list = $db->sql_numrows($result) ) > 0 ) + { + $group_members = $db->sql_fetchrowset($result); + + $template->assign_vars(array( + "L_SELECT_SORT_METHOD" => $lang['Select_sort_method'], + "L_EMAIL" => $lang['Email'], + "L_WEBSITE" => $lang['Website'], + "L_FROM" => $lang['From'], + "L_ORDER" => $lang['Order'], + "L_SORT" => $lang['Sort'], + "L_SUBMIT" => $lang['Sort'], + "L_AIM" => $lang['AIM'], + "L_YIM" => $lang['YIM'], + "L_MSNM" => $lang['MSNM'], + "L_ICQ" => $lang['ICQ'], + + "S_MODE_SELECT" => $select_sort_mode, + "S_ORDER_SELECT" => $select_sort_order, + "S_MODE_ACTION" => append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id")) + ); + + for($i = 0; $i < $users_list; $i++) + { + $username = stripslashes($group_members[$i]['username']); + $user_id = $group_members[$i]['user_id']; + + $from = stripslashes($group_members[$i]['user_from']); + + $joined = create_date($board_config['default_dateformat'], $group_members[$i]['user_regdate'], $board_config['default_timezone']); + + $posts = ($group_members[$i]['user_posts']) ? $group_members[$i]['user_posts'] : 0; + + if($group_members[$i]['user_avatar'] != "") + { + $poster_avatar = (strstr("http", $group_members[$i]['user_avatar']) && $board_config['allow_avatar_remote']) ? "<img src=\"" . $group_members[$i]['user_avatar'] . "\">" : "<img src=\"" . $board_config['avatar_path'] . "/" . $group_members[$i]['user_avatar'] . "\">"; + } + else + { + $poster_avatar = ""; + } + + if( !empty($group_members[$i]['user_viewemail']) ) + { + $altered_email = str_replace("@", " at ", $group_members[$i]['user_email']); + $email_img = "<a href=\"mailto:$altered_email\"><img src=\"" . $images['email'] . "\" border=\"0\" alt=\"" . $lang['Send_an_email'] . "\"></a>"; + } + else + { + $email_img = " "; + } + + $pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=" . $group_members[$i]['user_id']) . "\"><img src=\"" . $images['privmsg'] . "\" border=\"0\" alt=\"" . $lang['Send_private_message'] . "\"></a>"; + + if($group_members[$i]['user_website'] != "") + { + if(!eregi("^http\:\/\/", $group_members[$i]['user_website'])) + { + $website_url = "http://" . stripslashes($group_members[$i]['user_website']); + } + else + { + $website_url = stripslashes($group_members[$i]['user_website']); + } + $www_img = "<a href=\"$website_url\" target=\"_userwww\"><img src=\"" . $images['www'] . "\" border=\"0\"/></a>"; + } + else + { + $www_img = " "; + } + + if($group_members[$i]['user_icq']) + { + $icq_status_img = "<a href=\"http://wwp.icq.com/" . $group_members[$i]['user_icq'] . "#pager\"><img src=\"http://online.mirabilis.com/scripts/online.dll?icq=" . $group_members[$i]['user_icq'] . "&img=5\" alt=\"$l_icqstatus\" border=\"0\"></a>"; + + $icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $group_members[$i]['user_icq'] . "\"><img src=\"" . $images['icq'] . "\" alt=\"$l_icq\" border=\"0\"></a>"; + } + else + { + $icq_status_img = " "; + $icq_add_img = " "; + } + + $aim_img = ($group_members[$i]['user_aim']) ? "<a href=\"aim:goim?screenname=" . $group_members[$i]['user_aim'] . "&message=Hello+Are+you+there?\"><img src=\"" . $images['aim'] . "\" border=\"0\"></a>" : " "; + + $msn_img = ($group_members[$i]['user_msnm']) ? "<a href=\"profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id\"><img src=\"" . $images['msnm'] . "\" border=\"0\"></a>" : " "; + + $yim_img = ($group_members[$i]['user_yim']) ? "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=" . $group_members[$i]['user_yim'] . "&.src=pg\"><img src=\"" . $images['yim'] . "\" border=\"0\"></a>" : " "; + + $search_img = "<a href=\"" . append_sid("search.$phpEx?a=" . urlencode($group_members[$i]['username']) . "&f=all&b=0&d=DESC&c=100&dosearch=1") . "\"><img src=\"" . $images['search_icon'] . "\" border=\"0\"></a>"; + + if(!($i % 2)) + { + $row_color = "#" . $theme['td_color1']; + } + else + { + $row_color = "#" . $theme['td_color2']; + } + + if($user_id == $group_info['group_moderator']) + { + $template->assign_vars(array( + "U_MOD_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $user_id), + + "MOD_ROW_COLOR" => $row_color, + "MOD_USERNAME" => $username, + "MOD_FROM" => $from, + "MOD_JOINED" => $joined, + "MOD_POSTS" => $posts, + "MOD_EMAIL_IMG" => $email_img, + "MOD_PM_IMG" => $pm_img, + "MOD_WWW_IMG" => $www_img, + "MOD_ICQ_STATUS_IMG" => $icq_status_img, + "MOD_ICQ_ADD_IMG" => $icq_add_img, + "MOD_AIM_IMG" => $aim_img, + "MOD_YIM_IMG" => $yim_img, + "MOD_MSN_IMG" => $msn_img, + "MOD_SEARCH_IMG" => $search) + ); + } + else + { + $template->assign_block_vars("memberrow", array( + "U_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $user_id), + + "ROW_COLOR" => $row_color, + "USERNAME" => $username, + "FROM" => $from, + "JOINED" => $joined, + "POSTS" => $posts, + "EMAIL_IMG" => $email_img, + "PM_IMG" => $pm_img, + "WWW_IMG" => $www_img, + "ICQ_STATUS_IMG" => $icq_status_img, + "ICQ_ADD_IMG" => $icq_add_img, + "AIM_IMG" => $aim_img, + "YIM_IMG" => $yim_img, + "MSN_IMG" => $msn_img, + "SEARCH_IMG" => $search) + ); + } + } + + $pagination = generate_pagination("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id", $users_list, $board_config['topics_per_page'], $start)." "; + + $template->assign_vars(array( + "PAGINATION" => $pagination, + "ON_PAGE" => ( floor( $start / $board_config['topics_per_page'] ) + 1 ), + "TOTAL_PAGES" => ceil( $users_list / $board_config['topics_per_page'] ), + + "L_OF" => $lang['of'], + "L_PAGE" => $lang['Page'], + "L_GOTO_PAGE" => $lang['Goto_page']) + ); + + $template->pparse("list"); + + } + else + { + // + // No group members + // + } + +} + + +// +// Page footer +// include($phpbb_root_path . 'includes/page_tail.'.$phpEx); ?>
\ No newline at end of file diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index cc93c5f4b6..983d27ad27 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -91,6 +91,7 @@ define(PAGE_VIEWMEMBERS, -7); define(PAGE_FAQ, -8); define(PAGE_POSTING, -9); define(PAGE_PRIVMSGS, -10); +define(PAGE_GROUPCP, -11); // Auth settings define(AUTH_ALL, 0); diff --git a/phpBB/index.php b/phpBB/index.php index 4b12d213f7..7664f79576 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -135,7 +135,7 @@ if($total_categories = $db->sql_numrows($q_categories)) // // Obtain list of moderators of each forum // - $sql = "SELECT f.forum_id, u.username, u.user_id +/* $sql = "SELECT f.forum_id, u.username, u.user_id FROM " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa WHERE aa.forum_id = f.forum_id AND aa.auth_mod = " . TRUE . " @@ -154,9 +154,9 @@ if($total_categories = $db->sql_numrows($q_categories)) $forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['user_id']; $forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 1; - } + }*/ + -/* $sql = "SELECT f.forum_id, g.group_name, g.group_id, g.group_single_user, ug.user_id FROM " . FORUMS_TABLE . " f, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa WHERE aa.forum_id = f.forum_id @@ -183,7 +183,7 @@ if($total_categories = $db->sql_numrows($q_categories)) { $forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_id']; } - }*/ + } // // Find which forums are visible for this user |