2 /************************************************************************
3 * MXChange v0.2.1 Start: 01/27/2004 *
4 * ================ Last change: 07/13/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_cats.php *
8 * -------------------------------------------------------------------- *
9 * Short description : List selected categories from users *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Ausgewaehlte Kategorien eines Mitgliedes *
13 * -------------------------------------------------------------------- *
15 * -------------------------------------------------------------------- *
16 * Copyright (c) 2003 - 2008 by Roland Haeder *
17 * For more information visit: http://www.mxchange.org *
19 * This program is free software; you can redistribute it and/or modify *
20 * it under the terms of the GNU General Public License as published by *
21 * the Free Software Foundation; either version 2 of the License, or *
22 * (at your option) any later version. *
24 * This program is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU General Public License for more details. *
29 * You should have received a copy of the GNU General Public License *
30 * along with this program; if not, write to the Free Software *
31 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
33 ************************************************************************/
35 // Some security stuff...
36 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
41 // Add description as navigation point
42 ADD_DESCR("admin", basename(__FILE__));
44 if (!empty($_GET['u_id'])) {
45 // Check if the user already exists
46 $result = SQL_QUERY_ESC("SELECT surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
47 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
48 if (SQL_NUMROWS($result) == 1) {
49 // Loads surname, family's name and the email address
50 list($sname, $fname, $email) = SQL_FETCHROW($result);
51 SQL_FREERESULT($result);
54 define('__CATS_BASE' , "<A href=\"".URL."/modules.php?module=admin&u_id=");
55 define('__UID' , bigintval($_GET['u_id']));
56 define('__MEMBER_LINKS', MEMBER_ACTION_LINKS(__UID));
57 define('__EMAIL' , "<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$sname." ".$fname."</A>");
59 // Ok, list categories of this user
60 $result_cats = SQL_QUERY("SELECT id, cat FROM "._MYSQL_PREFIX."_cats ORDER BY sort", __FILE__, __LINE__);
62 if (SQL_NUMROWS($result_cats) > 0) {
64 $cnt = "1"; $SW = 2; $OUT = "";
65 while (list($cid, $cat) = SQL_FETCHROW($result_cats)) {
66 // Check user's selection
67 $result_user = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_cats WHERE userid=%s AND cat_id=%s LIMIT 1",
68 array(bigintval($_GET['u_id']), bigintval($cid)), __FILE__, __LINE__);
71 $SELECTED = "<FONT color=\"red\">".NO."</FONT>";
72 if (SQL_NUMROWS($result_user) == 1) $SELECTED = "<FONT color=\"green\">".YES."</FONT>";
74 // Prepare array for the row template
82 // Load row template and switch colors + count up
83 $OUT .= LOAD_TEMPLATE("admin_list_cats_row", true, $content);
84 $SW = 3 - $SW; $cnt++;
88 SQL_FREERESULT($result);
89 define('__CATS_ROWS', $OUT);
92 LOAD_TEMPLATE("admin_list_cats");
94 // No categories selected! :-(
95 LOAD_TEMPLATE("admin_list_cats_404");
99 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_404_1.__UID.ADMIN_MEMBER_404_2);
102 // Output selection form with all confirmed user accounts listed
103 ADD_MEMBER_SELECTION_BOX();