[PITC] - Screenshots - Addon Script

By TMFKSOFT on Jan 05, 2013

PITC Has teamed with Printscreen.it to produce a simple Screenshot uploading service for PITC!

Load this script AFTER loading my previous screenshot script then use /ss and /paste to paste the url in the channel!

Enjoy!

Requires PITC v1.0+

Download PITC Now! http://pitc.x10.mx/

What is PITC?
PITC is a Unique IRC Client entirely written in PHP and adapted to be able to host PHP IRC Bots with its easy to use API!

<?php

if (function_exists("do_screenshot")) {
    $api->addCommand("ssa","ssu_do");
    $api->log(" = PrintScreen.it Addon Loaded =",0);
    // Adds Clipboard! :D
    $api->addCommand("paste","clip_paste");
    $clipboard = "";
}
else {
    $api->log(" = Screenshot script by Thomas Edwards has not been loaded! =");
}
function clip_set($data) {
    global $clipboard;
    $clipboard = $data;
    return true;
}
function clip_get() {
    global $clipboard;
    return $clipboard;
}
function clip_paste($args) {
    global $api;
    $api->msg($args['active'],clip_get());
}
function ssu_do($fname) {
    global $api,$_DEBUG;
    $img = "screenshots/".$fname;
    $base = base64_encode(file_get_contents($img));

    $data_in = base64_encode(json_encode(array("user"=>"tom_username","pass"=>"tom_pass","image"=>$base)));

    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, "http://pitc.printscreen.it/api.php");
    curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POST, "1");
    curl_setopt($ch,CURLOPT_POSTFIELDS, "data={$data_in}");
    $raw = curl_exec($ch);
    curl_close($ch);

    $data = json_decode(base64_decode($raw));

    $_DEBUG['ss_dat'] = $data;
    $_DEBUG['ss_raw'] = $raw;

    $message = $data->msg;
    if ($data->ret == "0") {
        $api->pecho(" = SSA: Error uploading image. =");
    }
    else {
        $api->pecho(" = SSA: Uploaded image, Url: ".$data->msg." =");
        clip_set($data->msg);
        $api->pecho(" = Added to ClipBoard! Use /paste to paste to the current channel. =");
    }
}

?>

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.