Esempio n. 1
0
function createGroup($user_id, $name, $description)
{
    global $mysqli, $db_table_prefix;
    $stmt = $mysqli->prepare("INSERT\r\n                INTO " . $db_table_prefix . "groups\r\n                (name, description)\r\n                VALUES (\"" . $name . "\",\"" . $description . "\")\r\n                ");
    $stmt->execute();
    $group_id = $mysqli->insert_id;
    $stmt->close();
    addGroupMember($group_id, $user_id, 2);
    return $group_id;
}
Esempio n. 2
0
 case "getmyadmingroups":
     $userid = optional_param('userid', '', PARAM_ALPHANUMEXT);
     $response = getMyAdminGroups($userid);
     break;
 case "addgroup":
     $groupname = required_param('groupname', PARAM_TEXT);
     $response = addGroup($groupname);
     break;
 case "deletegroup":
     $groupid = required_param('groupid', PARAM_ALPHANUMEXT);
     $response = deleteGroup($groupid);
     break;
 case "addgroupmember":
     $groupid = required_param('groupid', PARAM_ALPHANUMEXT);
     $userid = required_param('userid', PARAM_ALPHANUMEXT);
     $response = addGroupMember($groupid, $userid);
     break;
 case "makegroupadmin":
     $groupid = required_param('groupid', PARAM_ALPHANUMEXT);
     $userid = required_param('userid', PARAM_ALPHANUMEXT);
     $response = makeGroupAdmin($groupid, $userid);
     break;
 case "removegroupadmin":
     $groupid = required_param('groupid', PARAM_ALPHANUMEXT);
     $userid = required_param('userid', PARAM_ALPHANUMEXT);
     $response = removeGroupAdmin($groupid, $userid);
     break;
 case "removegroupmember":
     $groupid = required_param('groupid', PARAM_ALPHANUMEXT);
     $userid = required_param('userid', PARAM_ALPHANUMEXT);
     $response = removeGroupMember($groupid, $userid);
Esempio n. 3
0
     break;
 case 46:
     //删除群组
     $group_id = "124113058216804760";
     var_dump(deleteGroup($group_id));
     break;
 case 47:
     //获取群组中的成员
     $group_id = "122633509780062768";
     var_dump(getGroupUsers($group_id));
     break;
 case 48:
     //群组单个加人-----------
     $group_id = "122633509780062768";
     $username = "******";
     var_dump(addGroupMember($group_id, $username));
     break;
 case 49:
     //群组批量加人
     $group_id = "122633509780062768";
     $usernames['usernames'] = array("lisi", "wangwu");
     var_dump(addGroupMembers($group_id, $usernames));
     break;
 case 50:
     //群组单个减人
     $group_id = "122633509780062768";
     $username = "******";
     var_dump(deleteGroupMember($group_id, $username));
     break;
 case 51:
     //群组批量减人-------
Esempio n. 4
0
             } else {
                 //find out if existing user
                 $u = new User();
                 $u->setEmail($member);
                 $user = $u->getByEmail();
                 if ($user instanceof User) {
                     //user already exists in db
                     addGroupMember($group->groupid, $user->userid);
                     echo "<li>" . $member . " " . $LNG->GROUP_FORM_IS_MEMBER . "</li>";
                 } else {
                     //user doesn't exist so create user and send them an invite code
                     $newU = new User();
                     $names = split('@', $member);
                     $newU->add($member, $names[0], "", "", 'N', $CFG->AUTH_TYPE_EVHUB, "", "", "");
                     $newU->setInvitationCode();
                     addGroupMember($group->groupid, $newU->userid);
                     echo "<li>" . $member . " " . $LNG->GROUP_FORM_NOT_MEMBER . "</li>";
                 }
             }
         }
         echo "</ul>";
     }
     echo '<script type=\'text/javascript\'>';
     echo "window.opener.location.reload(true);";
     echo "window.close();";
     echo '</script>';
     die;
     //echo "<p>Visit the <a href='javascript:closeGroupDialog(".$gu->userid.");'>group page</a>.</p>";
     //include_once($HUB_FLM->getCodeDirPath("ui/footerdialog.php"));
     //die;
 }
Esempio n. 5
0
}
if ($admin and !empty($_POST)) {
    $errors = array();
    $successes = array();
    $form = $_POST["form"];
    if ($form == "addUser") {
        $email = trim($_POST["email"]);
        if (!isValidEmail($email)) {
            $errors[] = lang("ACCOUNT_INVALID_EMAIL");
        }
        if (count($errors) == 0) {
            $user_id = userIdOfEmail($email);
            if (empty($user_id)) {
                $errors[] = lang("GROUP_UNKNOWN_EMAIL");
            } else {
                $added = addGroupMember($groupId, $user_id, 1);
                if ($added) {
                    $successes[] = lang("GROUP_USER_ADDED");
                } else {
                    $errors[] = lang("GROUP_USER_ADD_FAILED");
                }
            }
        }
    } else {
        if ($form == "deleteUser") {
            $user_id = $_POST["userId"];
            $deleted = deleteGroupMember($groupId, $user_id);
            if ($deleted) {
                $successes[] = lang("GROUP_USER_UNSUBSCRIBE");
            } else {
                $errors[] = lang("GROUP_USER_UNSUBSCRIBE_FAILED");