예제 #1
1
    } elseif ($_GET['type'] == "1") {
        rejectImage($_GET['sid']);
        header("Location: mod.php");
    } elseif ($_GET['type'] == "2") {
        reportImage($_GET['sid']);
        header("Location: mod.php");
    } elseif ($_GET['type'] == "-1") {
        if (is_admin(mod_id())) {
            banUser($_GET['sid'], 0);
        }
        header("Location: mod.php");
    } elseif ($_GET['type'] == "-2") {
        if (is_admin(mod_id())) {
            banUser($_GET['sid'], 1);
        }
        header("Location: reports.php");
    } elseif ($_GET['type'] == "-3") {
        if (is_admin(mod_id())) {
            removeReport($_GET['sid']);
        }
        header("Location: reports.php");
    }
}
if ($_GET['type'] == "register") {
    if (!is_mod(mod_id())) {
        addModerator(mod_id());
        header("Location: mod.php");
    } else {
        header("Location: mod.php");
    }
}
예제 #2
0
     saveConfig($option);
     break;
 case "defaultconfig":
     defaultConfig($option);
     break;
 case "revertconfig":
     revertConfig($option);
     break;
 case "newmoderator":
     newModerator($option, $id);
     break;
 case "addmoderator":
     addModerator($option, $id, $cid, 1);
     break;
 case "removemoderator":
     addModerator($option, $id, $cid, 0);
     break;
 case "showprofiles":
     showProfiles($kunena_db, $option, $order);
     break;
 case "profiles":
     showProfiles($kunena_db, $option, $order);
     break;
 case "logout":
     logout($option, $cid);
     break;
 case "deleteuser":
     deleteUser($option, $cid);
     break;
 case "userprofile":
     editUserProfile($option, $cid);
예제 #3
0
// *** DISABLED? *** //
if (!defined("IN_INSTALL")) {
    $db = new mysqli($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']);
    //do not edit
    if ($config['enabled'] == "false" && !is_admin(mod_id(), $db)) {
        die("Storybot is disabled for non-admin use at the moment!");
    }
}
// *** --------- *** //
if (defined("IN_INSTALL")) {
    require_once "../src/snapchat.php";
    //required for Snapchat API
    if (file_exists("lock.true")) {
        $db = new mysqli($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']);
        //do not edit
        addModerator(mod_id(), $db);
        die("<h1>Storybot is successfully installed!</h1>You should delete the /install/ directory for security purposes. You can now visit the root directory and begin to moderate Storybot if you selected moderation=true, or if you didn't, you should now set up a Cron job for bot.php on some interval. Enjoy! If you have any questions, please contact <a href='http://www.reddit.com/u/bicycle'>/u/bicycle</a> on Reddit or visit <a href='http://www.reddit.com/r/storybot'>/r/storybot</a>.");
    }
} else {
    require_once "src/snapchat.php";
    //required for Snapchat API
}
//***************************************************************************************************
//VARIABLES
//***************************************************************************************************
// *** CONNECT TO DATABASE *** //
if ($config['firstsetup'] != true) {
    $db = new mysqli($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']);
    //do not edit
    if ($db->connect_errno > 0) {
        die("Database connection error: " . $db->connect_error);
예제 #4
0
function addModerator_action($mysqli)
{
    $data = addModerator($mysqli);
    require "templates/addModerator.php";
}
$username = "******";
$password = "******";
$dbname = "dev";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$error = false;
$error_message = "";
$data = json_decode(file_get_contents('php://input'), true);
$user = $data["username"];
$moderator = $data["moderator"];
$channelname = $data["channelname"];
$channelowner = $data["channelowner"];
if (isAdmin($conn, $user) || isOwner($conn, $user, $channelname, $channelowner)) {
    addModerator($conn, $moderator, $channelname, $channelowner);
} else {
    $error = true;
    $error_message = "You do not have permission to add a moderator to this channel";
}
$conn->close();
$response = array('error' => $error, 'error_message' => $error_message, 'moderator' => $moderator);
echo json_encode($response);
function addModerator($conn, $moderator, $channelname, $channelowner)
{
    global $error, $error_message;
    if (isUser($conn, $moderator)) {
        $sql = "INSERT INTO channelmods (cm_username, cm_chname, cm_chowner) \n\t\t\t\tVALUES (\"" . $moderator . "\", \"" . $channelname . "\", \"" . $channelowner . "\");";
        if (!$conn->query($sql)) {
            $error = true;
            $error_message = "User is already a moderator";