예제 #1
0
파일: index.php 프로젝트: remy/twivatar
function grab_and_store($user, $db)
{
    include 'twitter_auth.php';
    if (!@$twitter_auth) {
        $twitter_auth = '';
    }
    $user_profile = json_decode(grab_url('http://' . $twitter_auth . 'twitter.com/users/' . $user . '.json'));
    if (!$user_profile) {
        return "http://static.twitter.com/images/default_profile_bigger.png";
    } else {
        $image_url = $user_profile->profile_image_url;
        if ($db) {
            $sql = sprintf('replace into twitter_avatar (user, url) values ("%s", "%s")', mysql_real_escape_string($user), $image_url);
            mysql_query($sql, $db);
        }
        return $image_url;
    }
}
예제 #2
0
 $pos = strpos($geouid, $findme);
 if ($pos === false) {
     $geouid = 'http://' . $geouid;
 }
 proverka_geo_uid($geouid);
 if (sizeof($geo_old) && $mode != 'edit') {
     $errors .= $user->lang['Error_duplicate'];
 } else {
     if (check_http($geouid)) {
         // Ccылка на geocaching.su ?
         $findme = 'geocaching.su';
         $pos = strpos($geouid, $findme);
         if ($pos === false) {
             $errors .= $user->lang['Error_geosu'];
         } else {
             grab_url($geouid);
             foreach ($lines as $line_num => $line) {
                 $line = iconv('windows-1251', 'UTF-8', $line);
                 if (preg_match_all('/<a href="note.php?/isU', $line, $res)) {
                     break;
                 }
                 $view_data .= $line;
                 //$errors .= "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
                 // Регион
                 if (!$geo_region) {
                     get_region($line);
                     //$geo_region = $region;
                     if ($region) {
                         $errors .= '<font size="3">' . $region . '</font><hr>';
                     }
                     $region = '';