Ejemplo n.º 1
0
#!/usr/bin/php
<?php 
require __DIR__ . '/github_api_funcs.php';
$user = '******';
$info = get_data_from_url(__DIR__ . '/data/' . $user . '_info.json', 'https://api.github.com/users/' . $user);
save_php_data(__DIR__ . '/data/' . $user . '_info.php', $info);
$repos = [];
foreach (range(1, ceil($info['public_repos'] / 100)) as $i) {
    $_repos = get_data_from_url(__DIR__ . '/data/' . $user . '_repos_' . $i . '.json', 'https://api.github.com/users/' . $user . '/repos?per_page=100&page=' . $i);
    foreach ((array) $_repos as $a) {
        foreach ($a as $k => $v) {
            if (in_array($k, ['owner']) || strpos($k, '_url') !== false) {
                unset($a[$k]);
            }
        }
        $repos[] = $a;
    }
}
save_php_data(__DIR__ . '/data/' . $user . '_repos.php', $repos);
Ejemplo n.º 2
0
     $Error->upload($_FILES['file'], 'file');
 }
 if ($Error->ok()) {
     $v = new Version();
     $v->app_id = $app->id;
     $v->version_number = $_POST['version_number'];
     $v->human_version = $_POST['human_version'];
     $v->release_notes = $_POST['release_notes'];
     $v->url = $_POST['url'];
     $v->dt = dater();
     $v->downloads = 0;
     $v->updates = 0;
     $tmpfile = "";
     if ($v->url) {
         $tmpfile = tempnam(sys_get_temp_dir(), 'sparkle_stdin');
         $data = get_data_from_url($v->url);
         if (!$data) {
             die("The file at <a href='{$v->url}'>{$v->url}</a> does not exist or is empty!");
         }
         file_put_contents($tmpfile, $data);
     } else {
         $tmpfile = $_FILES['file']['tmp_name'];
     }
     $v->filesize = filesize($tmpfile);
     $v->signature = sign_file($tmpfile, $app->sparkle_pkey);
     if (!$v->url) {
         $object = strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $app->name)) . "_" . $v->version_number . "." . substr($_FILES['file']['name'], -3);
         if ($app->s3bucket && $app->s3path) {
             $v->url = slash($app->s3path) . $object;
             $info = parse_url($app->s3path);
             $object = slash($info['path']) . $object;
Ejemplo n.º 3
0
#!/usr/bin/php
<?php 
require __DIR__ . '/github_api_funcs.php';
$user = '******';
include __DIR__ . '/data/' . $user . '_repos.php';
foreach ($data as $k => $a) {
    if (!$a['fork']) {
        continue;
    }
    echo PHP_EOL . '(' . ($k + 1) . '/' . count($data) . ') == ' . $a['full_name'] . ' ==' . PHP_EOL . PHP_EOL;
    $dir = __DIR__ . '/data/' . $user . '/';
    !file_exists($dir) && mkdir($dir, 1);
    $info = get_data_from_url($dir . $a['name'] . '.json', 'https://api.github.com/repos/' . $user . '/' . $a['name'], $sleep = 2);
    save_php_data($dir . $a['name'] . '.php', $info);
}
Ejemplo n.º 4
0
#!/usr/bin/php 
<?php 
function get_data_from_url($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
$content = get_data_from_url($argv[1]);
$images = array();
$target = preg_replace('#^https?://#', '', $argv[1]);
$target = explode('/', $target)[0];
mkdir($target);
preg_match_all('/<img(.*?)src="(.*?)"/', $content, $images);
foreach ($images[2] as $url) {
    $image = get_data_from_url($url);
    $name = explode('/', $url);
    $name = $name[count($name) - 1];
    file_put_contents("./" . $target . "/" . $name, $image);
}