Esempio n. 1
0
        $this->username = $this->client->currentUser()->show()["login"];
    }
    private function primaryemail()
    {
        $emails = $this->client->currentUser()->Emails()->all();
        $primaryemail = null;
        for ($i = 0; $i < count($emails); $i++) {
            if ($emails[$i]["primary"] == 1) {
                $primaryemail = $emails[$i]["email"];
            }
        }
        $this->email = $primaryemail;
    }
    public function start()
    {
        $this->client = new \Github\Client();
        $this->client->authenticate($_GET["access_token"], null, \Github\Client::AUTH_HTTP_TOKEN);
        $this->ghusername();
        $this->githubinvite();
        $this->primaryemail();
        $this->slackinvite();
        return array();
    }
}
if (!isset($_GET["access_token"])) {
    die("Access token error");
}
$main = new main($_GET["access_token"]);
$main->start();
header("Location: https://teenscode.github.io/signup?gh=success&sl=success");
echo "Redirecting to https://teenscode.github.io/signup?gh=success&sl=success";
Esempio n. 2
0
//e non si imposta il primo paramentro da shell si assume di avere impostato il webhook e di utilizzare quello
include 'settings_t.php';
include 'getUpdates.php';
//istanzia oggetto Telegram
$bot_id = TELEGRAM_BOT;
$bot = new Telegram($bot_id);
//valuta se l'interfaccia è di tipo CLI per vedere il parametro e settare o rimuovere il webhook e poi esce (se lanciato da riga di comando)
if (php_sapi_name() == 'cli') {
    if ($argv[1] == 'sethook') {
        //setta il webhook
        $bot->setWebhook(BOT_WEBHOOK);
    } else {
        if ($argv[1] == 'removehook') {
            //rimuove il webhook
            $bot->removeWebhook();
            echo "webhook removed";
        } else {
            if ($argv[1] == 'getupdates') {
                //esegue il getupdates manuale
                getUpdates($bot);
            }
        }
    }
    exit;
}
//legge
$bot->init();
$update = $bot->getData();
$update_manager = new main();
$update_manager->start($bot, $update);