Esempio n. 1
0
function groupAddFlags($id, $flags)
{
    $group = groupGetById($id);
    if (is_array($group)) {
        $flags1 = $group["flags"];
        $flags1 = stringAddTokens($flags1, $flags);
        global $database_cfg;
        databaseQuery("update " . $database_cfg["prefix"] . "groups set (flags='" . $flags1 . "'", "Can not add group flags");
    } else {
        return "Group with given id doesn't exists";
    }
}
Esempio n. 2
0
function postCreate($topic_id, $author_id, $message, $flags = array())
{
    global $database_cfg;
    $errors = array();
    if (!userExistsById($author_id)) {
        $errors[] = "User marked as author (" . $author_id . ") not found";
    }
    if (!topicExistsById($topic_id)) {
        $errors[] = "Topic marked as parent not found";
    }
    if (postExists($topic_id, $message)) {
        $errors[] = "This post already exists in this topic";
    }
    if (count($errors) > 0) {
        return $errors;
    }
    $flags_str = "";
    if (is_array($flags)) {
        $flags_str = stringAddTokens($flags_str, $flags);
    }
    databaseQuery("insert into " . $database_cfg["prefix"] . "posts (topic_id, author_id, message, flags, created) values ('" . intval($topic_id) . "', '" . intval($author_id) . "', '" . stringEncode($message) . "', '" . $flags_str . "', '" . stringEncode(date("H:i, d.m.Y")) . "')");
    databaseQuery("update " . $database_cfg["prefix"] . "topics set edited='" . stringEncode(date("H:i, d.m.Y")) . "' where id='" . intval($topic_id) . "'", "Can't update topic");
}
Esempio n. 3
0
function topicAddModerators($topic_id, $users)
{
    global $database_cfg;
    $topic_moders = topicGetModeratorsString($topic_id);
    $topic_moders = stringAddTokens($topic_moders, $users);
    databaseQuery("update " . $database_cfg["prefix"] . "topics set moderators='" . $topic_moders . "' where id='" . intval($topic_id) . "'", "Can't set topic moderators");
}
Esempio n. 4
0
function userAddGroups($user_id, $groups)
{
    global $database_cfg;
    $user = userGetById($user_id);
    if (is_array($groups)) {
        $user["groups"] = stringAddTokens($user["groups"], $groups);
    } else {
        $user["groups"] = stringAddToken($user["groups"], $groups);
    }
    databaseQuery("update " . $database_cfg["prefix"] . "users set groups='" . $user["groups"] . "' where id='" . intval($user_id) . "'");
    //, "Unable to add user to a group");
}