} // Determine what action to perform. $action = "post"; if (isset($_POST["preview"])) $action = "preview"; if (isset($_POST["rcpt_add"])) $action = "rcpt_add"; if (!is_null($del_rcpt)) $action = "del_rcpt"; // Adding a recipient. if ($action == "rcpt_add" || $action == "preview" || $action == "post") { // Convert adding a recipient by name to adding by user id. if (isset($_POST["to_name"])) { $to_name = trim($_POST["to_name"]); if ($to_name != '') { $to_user_id = phorum_db_user_check_field('username', $to_name); if ($to_user_id) { $_POST["to_id"] = $to_user_id; unset($_POST["to_name"]); } else { $error = $PHORUM["DATA"]["LANG"]["UserNotFound"]; } } } // Add a recipient by id. if (isset($_POST["to_id"]) && is_numeric($_POST["to_id"])) { $user = phorum_user_get($_POST["to_id"], false); if ($user) { $recipients[$user["user_id"]] = $user; }
/** * (generic) function for checking a user-field in the database */ function phorum_user_check_field( $field_name, $field_value) { return phorum_db_user_check_field( $field_name , $field_value ); }
$perm = phorum_user_allow_moderate_group($PHORUM["args"]["group"]); } else{ $perm = $PHORUM["DATA"]["GROUP_MODERATOR"]; } if (!$perm) { phorum_redirect_by_url(phorum_get_url(PHORUM_CONTROLCENTER_URL)); exit(); } // figure out what the user is trying to do, in this case we have a group to list (and maybe some commands) if (isset($PHORUM["args"]["group"])){ // if adding a new user to the group if (isset($_REQUEST["adduser"])){ $userid = phorum_db_user_check_field("username", $_REQUEST["adduser"]); // load the users groups, add the new group, then save again $groups = phorum_user_get_groups($userid); // make sure the user isn't already a member of the group if (!isset($groups[$PHORUM["args"]["group"]])){ $groups[$PHORUM["args"]["group"]] = PHORUM_USER_GROUP_APPROVED; phorum_user_save_groups($userid, $groups); $PHORUM["DATA"]["Message"] = $PHORUM["DATA"]["LANG"]["UserAddedToGroup"]; } } // if changing the existing members of the group if (isset($_REQUEST["status"])){ foreach ($_REQUEST["status"] as $userid => $status){ // load the users groups, make the change, then save again $groups = phorum_user_get_groups($userid);
/** * Return TRUE if the email address already exists in the * user table. * * @param string $p_email * @return boolean */ public static function EmailExists($p_email) { return (phorum_db_user_check_field( "email", $p_email )); } // fn EmailExists