当前位置: 首页>>代码示例>>PHP>>正文


PHP get_remote函数代码示例

本文整理汇总了PHP中get_remote函数的典型用法代码示例。如果您正苦于以下问题:PHP get_remote函数的具体用法?PHP get_remote怎么用?PHP get_remote使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_remote函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: embed_tag

 public function embed_tag($video, $field = null)
 {
     # We use this for previewing too
     if (isset($field) and $field != "embed") {
         return $video;
     }
     # If they're previewing and the field argument isn't the embed, return the original.
     if (preg_match("/http:\\/\\/(www\\.|[a-z]{2}\\.)?youtube\\.com\\/watch\\?v=([^&]+)/", $video, $matches)) {
         return '<object type="application/x-shockwave-flash" class="object-youtube" data="http://' . $matches[1] . 'youtube.com/v/' . $matches[2] . '" width="468" height="391"><param name="movie" value="http://' . $matches[1] . 'youtube.com/v/' . $matches[2] . '" /><param name="FlashVars" value="playerMode=embedded" /></object>';
     } else {
         if (preg_match("/^http:\\/\\/(www\\.)?vimeo.com\\/([0-9]+)/", $video, $matches)) {
             $site = get_remote("http://vimeo.com/" . $matches[2]);
             preg_match('/<div id="vimeo_player_[0-9]+" class="player" style="width:([0-9]+)px;height:([0-9]+)px;">/', $site, $scale);
             return '<object type="application/x-shockwave-flash" class="object-vimeo" width="' . $scale[1] . '" height="' . $scale[2] . '" data="http://www.vimeo.com/moogaloop.swf?clip_id=' . $matches[2] . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $matches[2] . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" /></object>';
         } else {
             if (preg_match("/http:\\/\\/(www\\.)?metacafe.com\\/watch\\/([0-9]+)\\/([^\\/&\\?]+)/", $video, $matches)) {
                 return '<object type="application/x-shockwave-flash" class="object-metacafe" data="http://www.metacafe.com/fplayer/' . $matches[2] . '/' . $matches[3] . '.swf" width="400" height="345"></object>';
             } else {
                 if (preg_match("/http:\\/\\/(www\\.)?revver.com\\/video\\/([0-9]+)/", $video, $matches)) {
                     return '<script src="http://flash.revver.com/player/1.0/player.js?mediaId:' . $matches[2] . ';width:468;height:391;" type="text/javascript"></script>';
                 } else {
                     if (preg_match("/http:\\/\\/(www\\.)viddler\\.com\\/.+/", $video)) {
                         $viddler_page = get_remote($video);
                         if (preg_match("/<link\\s+rel=\"video_src\"\\s+href=\"http:\\/\\/(www\\.)?viddler.com\\/player\\/([0-9a-fA-F]+)/", $viddler_page, $matches) and preg_match("/<meta\\s+name=\"video_height\"\\s+content=\"([0-9]+)\"/", $viddler_page, $height) and preg_match("/<meta\\s+name=\"video_width\"\\s+content=\"([0-9]+)\"/", $viddler_page, $width)) {
                             return '<object type="application/x-shockwave-flash" data="http://www.viddler.com/player/' . $matches[2] . '/" width="' . $width[1] . '" height="' . $height[1] . '" id="viddler_' . $matches[2] . '" class="object-youtube"><param name="movie" value="http://www.viddler.com/player/' . $matches[2] . '/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>';
                         }
                         return $video;
                     }
                 }
             }
         }
     }
     return $video;
 }
开发者ID:relisher,项目名称:chyrp,代码行数:34,代码来源:video.php

示例2: load

 function load()
 {
     global $config;
     if ($this->exists() == true) {
         $this->import();
     } else {
         if (viscacha_function_exists('xml_parser_create')) {
             $rssnews = get_remote('http://version.viscacha.org/news/rss');
             include 'classes/magpie_rss/rss_fetch.inc.php';
             $rss = new MagpieRSS($rssnews);
             $news = '';
             foreach ($rss->items as $item) {
                 $news .= '<li><a href="' . htmlspecialchars($item['link']) . '" style="font-weight: bold;" target="_blank">' . htmlspecialchars($item['title']) . '</a>';
                 if (isset($item['description'])) {
                     $news .= '<br /><span style="font-size: 0.9em;">' . htmlspecialchars($item['description']) . '</span>';
                 }
                 $news .= '</li>';
             }
             if (!empty($news)) {
                 $news = '<ul>' . $news . '</ul>';
             }
         } else {
             $news = get_remote('http://version.viscacha.org/news');
         }
         $this->data = array('comp' => get_remote('http://version.viscacha.org/compare/?version=' . base64_encode($config['version'])), 'version' => get_remote('http://version.viscacha.org/version'), 'news' => $news);
         $this->export();
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:28,代码来源:version_check.inc.php

示例3: load

 function load()
 {
     global $config;
     if ($this->exists() == true) {
         $this->import();
     } else {
         global $config, $admconfig;
         $this->data = array();
         $myini = new INI();
         $servers = explode(';', $admconfig['package_server']);
         if (is_array($servers)) {
             foreach ($servers as $server) {
                 $content = get_remote($server . '/external.ini');
                 if ($content != REMOTE_CLIENT_ERROR) {
                     $inis = $myini->parse($content);
                     if (!isset($inis['files'])) {
                         break;
                     }
                     foreach ($inis['files'] as $type => $remotefile) {
                         if (!isset($this->data[$type])) {
                             $this->data[$type] = array();
                         }
                         if (empty($remotefile)) {
                             continue;
                         }
                         $path = $server . '/' . $remotefile;
                         $content = get_remote($path);
                         if ($content != REMOTE_CLIENT_ERROR) {
                             $new_data = $myini->parse($content);
                             if (!isset($new_data['categories'])) {
                                 continue;
                             }
                             foreach ($new_data['categories'] as $cid => $cname) {
                                 $this->data[$type]['categories'][$cid] = array('name' => $cname, 'entries' => 0);
                                 $this->data[$type][$cid] = array();
                             }
                             foreach ($new_data as $key => $row) {
                                 if ($key == 'categories') {
                                     continue;
                                 } else {
                                     if (!isset($row['category']) || !isset($this->data[$type]['categories'][$row['category']])) {
                                         continue;
                                     }
                                     if (isset($this->data[$type][$row['internal']]) && version_compare($this->data[$type][$this->data[$type][$row['internal']]][$row['internal']]['version'], $row['version'], ">") || !isset($this->data[$type][$row['internal']])) {
                                         $row['server'] = $server;
                                         $this->data[$type]['categories'][$row['category']]['entries']++;
                                         $this->data[$type][$row['category']][$row['internal']] = $row;
                                         $this->data[$type][$row['internal']] = $row['category'];
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $this->export();
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:59,代码来源:package_browser.inc.php

示例4: main_index

 public function main_index($main)
 {
     $config = Config::current();
     if ($config->disable_aggregation or time() - $config->last_aggregation < $config->aggregate_every * 60) {
         return;
     }
     $aggregates = (array) $config->aggregates;
     if (empty($aggregates)) {
         return;
     }
     foreach ($aggregates as $name => $feed) {
         $xml_contents = preg_replace(array("/<(\\/?)dc:date>/", "/xmlns=/"), array("<\\1date>", "a="), get_remote($feed["url"]));
         $xml = simplexml_load_string($xml_contents, "SimpleXMLElement", LIBXML_NOCDATA);
         if ($xml === false) {
             continue;
         }
         # Flatten namespaces recursively
         $this->flatten($xml);
         $items = array();
         if (isset($xml->entry)) {
             foreach ($xml->entry as $entry) {
                 array_unshift($items, $entry);
             }
         } elseif (isset($xml->item)) {
             foreach ($xml->item as $item) {
                 array_unshift($items, $item);
             }
         } else {
             foreach ($xml->channel->item as $item) {
                 array_unshift($items, $item);
             }
         }
         foreach ($items as $item) {
             $date = oneof(@$item->pubDate, @$item->date, @$item->updated, 0);
             $updated = strtotime($date);
             if ($updated > $feed["last_updated"]) {
                 # Get creation date ('created' in Atom)
                 $created = @$item->created ? strtotime($item->created) : 0;
                 if ($created <= 0) {
                     $created = $updated;
                 }
                 # Construct the post data from the user-defined XPath mapping:
                 $data = array("aggregate" => $name);
                 foreach ($feed["data"] as $attr => $field) {
                     $field = !empty($field) ? $this->parse_field($field, $item) : "";
                     $data[$attr] = is_string($field) ? $field : YAML::dump($field);
                 }
                 if (isset($data["title"]) or isset($data["name"])) {
                     $clean = sanitize(oneof(@$data["title"], @$data["name"]));
                 }
                 Post::add($data, $clean, null, $feed["feather"], $feed["author"], false, "public", datetime($created), datetime($updated));
                 $aggregates[$name]["last_updated"] = $updated;
             }
         }
     }
     $config->set("aggregates", $aggregates);
     $config->set("last_aggregation", time());
 }
开发者ID:eadz,项目名称:chyrp,代码行数:58,代码来源:aggregator.php

示例5: pingback_ping

 public function pingback_ping($args)
 {
     $config = Config::current();
     $linked_from = str_replace('&amp;', '&', $args[0]);
     $linked_to = str_replace('&amp;', '&', $args[1]);
     $cleaned_url = str_replace(array("http://www.", "http://"), "", $config->url);
     if ($linked_to == $linked_from) {
         return new IXR_ERROR(0, __("The from and to URLs cannot be the same."));
     }
     if (!substr_count($linked_to, $cleaned_url)) {
         return new IXR_Error(0, __("There doesn't seem to be a valid link in your request."));
     }
     if (preg_match("/url=([^&#]+)/", $linked_to, $url)) {
         $post = new Post(array("url" => $url[1]));
     } else {
         $post = MainController::current()->post_from_url(null, str_replace(rtrim($config->url, "/"), "/", $linked_to), true);
     }
     if (!$post) {
         return new IXR_Error(33, __("I can't find a post from that URL."));
     }
     # Wait for the "from" server to publish
     sleep(1);
     $from = parse_url($linked_from);
     if (empty($from["host"])) {
         return false;
     }
     if (empty($from["scheme"]) or $from["scheme"] != "http") {
         $linked_from = "http://" . $linked_from;
     }
     # Grab the page that linked here.
     $content = get_remote($linked_from);
     # Get the title of the page.
     preg_match("/<title>([^<]+)<\\/title>/i", $content, $title);
     $title = $title[1];
     if (empty($title)) {
         return new IXR_Error(32, __("There isn't a title on that page."));
     }
     $content = strip_tags($content, "<a>");
     $url = preg_quote($linked_to, "/");
     if (!preg_match("/<a[^>]*{$url}[^>]*>([^>]*)<\\/a>/", $content, $context)) {
         $url = str_replace("&", "&amp;", preg_quote($linked_to, "/"));
         if (!preg_match("/<a[^>]*{$url}[^>]*>([^>]*)<\\/a>/", $content, $context)) {
             $url = str_replace("&", "&#038;", preg_quote($linked_to, "/"));
             if (!preg_match("/<a[^>]*{$url}[^>]*>([^>]*)<\\/a>/", $content, $context)) {
                 return false;
             }
         }
     }
     $context[1] = truncate($context[1], 100, "...", true);
     $excerpt = strip_tags(str_replace($context[0], $context[1], $content));
     $match = preg_quote($context[1], "/");
     $excerpt = preg_replace("/.*?\\s(.{0,100}{$match}.{0,100})\\s.*/s", "\\1", $excerpt);
     $excerpt = "[...] " . trim(normalize($excerpt)) . " [...]";
     Trigger::current()->call("pingback", $post, $linked_to, $linked_from, $title, $excerpt);
     return _f("Pingback from %s to %s registered!", array($linked_from, $linked_to));
 }
开发者ID:relisher,项目名称:chyrp,代码行数:56,代码来源:xmlrpc.php

示例6: load

 function load()
 {
     global $config;
     if ($this->exists() == true) {
         $this->import();
     } else {
         $this->data = array('comp' => get_remote('http://version.viscacha.org/compare/?version=' . base64_encode($config['version'])), 'version' => get_remote('http://version.viscacha.org/version'), 'news' => get_remote('http://version.viscacha.org/news'));
         $this->export();
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:10,代码来源:version_check.inc.php

示例7: checkRemotePic

function checkRemotePic($pic, $id)
{
    global $config, $filesystem;
    $avatar_data = get_remote($pic);
    if ($avatar_data == REMOTE_CLIENT_ERROR || $avatar_data == REMOTE_INVALID_URL) {
        return $avatar_data;
    }
    if (strlen($avatar_data) > $config['avfilesize']) {
        return REMOTE_FILESIZE_ERROR;
    }
    $filename = md5(uniqid($id));
    $origfile = 'temp/' . $filename;
    $filesystem->file_put_contents($origfile, $avatar_data);
    if (filesize($origfile) > $config['avfilesize']) {
        return REMOTE_FILESIZE_ERROR;
    }
    $imageinfo = @getimagesize($origfile);
    if (is_array($imageinfo)) {
        list($width, $height, $type) = $imageinfo;
    } else {
        return REMOTE_IMAGE_ERROR;
    }
    if ($width > $config['avwidth']) {
        return REMOTE_IMAGE_WIDTH_ERROR;
    }
    if ($height > $config['avheight']) {
        return REMOTE_IMAGE_HEIGHT_ERROR;
    }
    $types = explode(',', $config['avfiletypes']);
    $ext = image_type_to_extension($type);
    if (!in_array($ext, $types)) {
        return REMOTE_EXTENSION_ERROR;
    }
    $dir = 'uploads/pics/';
    $pic = $dir . $id . $ext;
    removeOldImages($dir, $id);
    @$filesystem->copy($origfile, $pic);
    return $pic;
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:39,代码来源:function.global.php

示例8: readRssInfo

	function readRssInfo() {
		if (!viscacha_function_exists('xml_parser_create')) {
			return false;
		}

		global $config;
		$rssData = get_remote('http://version.viscacha.org/news/rss/?version='.base64_encode($config['version']));

		$xml = xml_parser_create();
		xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, true);
		xml_set_element_handler($xml, array($this, "startRssElement"), array($this, "endRssElement"));
		xml_set_character_data_handler($xml, array($this, "getRssElementData"));
		$success = xml_parse($xml, $rssData);
		xml_parser_free($xml);

		if (!$success || empty($this->data['news'])) {
			$this->data['news'] = '';
			return false;
		}
		else {
			$this->data['news'] = '<ul>'.$this->data['news'].'</ul>';
			return true;
		}
	}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:24,代码来源:version_check.inc.php

示例9: __init

 public function __init()
 {
     $this->setField(array("attr" => "photo", "type" => "file", "label" => __("Photo", "photo")));
     if (isset($_GET['action']) and $_GET['action'] == "bookmarklet") {
         $this->setField(array("attr" => "from_url", "type" => "text", "label" => __("From URL?", "photo"), "optional" => true, "no_value" => true));
     }
     $this->setField(array("attr" => "caption", "type" => "text_block", "label" => __("Caption", "photo"), "optional" => true, "preview" => true, "bookmarklet" => "page_link"));
     $this->setFilter("caption", array("markup_text", "markup_post_text"));
     $this->respondTo("delete_post", "delete_file");
     $this->respondTo("filter_post", "filter_post");
     $this->respondTo("post_options", "add_option");
     $this->respondTo("admin_write_post", "swfupload");
     $this->respondTo("admin_edit_post", "swfupload");
     if (isset($_GET['url']) and preg_match("/http:\\/\\/(www\\.)?flickr\\.com\\/photos\\/([^\\/]+)\\/([0-9]+)/", $_GET['url'])) {
         $this->bookmarkletSelected();
         $page = get_remote($_GET['url']);
         preg_match("/class=\"photoImgDiv\">\n<img src=\"([^\\?\"]+)/", $page, $image);
         $this->setField(array("attr" => "from_url", "type" => "text", "label" => __("From URL?", "photo"), "optional" => true, "value" => $image[1]));
     }
     if (isset($_GET['url']) and preg_match("/\\.(jpg|jpeg|png|gif|bmp)\$/", $_GET['url'])) {
         $this->bookmarkletSelected();
         $this->setField(array("attr" => "from_url", "type" => "text", "label" => __("From URL?", "photo"), "optional" => true, "value" => $_GET['url']));
     }
 }
开发者ID:relisher,项目名称:chyrp,代码行数:24,代码来源:photo.php

示例10: error

    if (count($delete) == 0) {
        error('admin.php?action=bbcodes&job=' . $type, $lang->phrase('admin_bbc_no_valid_selection'));
    }
    $db->query('DELETE FROM ' . $db->pre . 'textparser WHERE id IN (' . implode(',', $delete) . ')');
    $anz = $db->affected_rows();
    $delobj = $scache->load('bbcode');
    $delobj->delete();
    ok('admin.php?action=bbcodes&job=' . $type, $lang->phrase('admin_bbc_entries_successfully_deleted'));
} elseif ($job == 'custombb_export') {
    $id = $gpc->get('id', int);
    $result = $db->query("\n\tSELECT bbcodetag, bbcodereplacement, bbcodeexample, bbcodeexplanation, twoparams, title, buttonimage\n\tFROM {$db->pre}bbcode\n\tWHERE id = '{$id}'\n\tLIMIT 1\n\t");
    $data = $db->fetch_assoc($result);
    $data['button'] = null;
    if (!empty($data['buttonimage']) && (preg_match('~^' . URL_REGEXP . '$~i', $data['buttonimage']) || file_exists(CBBC_BUTTONDIR . $data['buttonimage']))) {
        if (preg_match('~^' . URL_REGEXP . '$~i', $data['buttonimage'])) {
            $button = get_remote($data['buttonimage']);
        } else {
            $button = file_get_contents(CBBC_BUTTONDIR . $data['buttonimage']);
        }
        if ($button == REMOTE_CLIENT_ERROR || $button == REMOTE_INVALID_URL) {
            $data['buttonimage'] = '';
        } else {
            $ext = get_extension($data['buttonimage']);
            if (!in_array($ext, $imagetype_extension)) {
                $data['buttonimage'] = '';
            } else {
                $data['button'] = base64_encode($button);
            }
        }
    } else {
        $data['buttonimage'] = '';
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:bbcodes.php

示例11: import_tumblr

 /**
  * Function: import_tumblr
  * Tumblr importing.
  */
 public function import_tumblr()
 {
     if (empty($_POST)) {
         redirect("/admin/?action=import");
     }
     if (!Visitor::current()->group->can("add_post")) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to import content."));
     }
     $config = Config::current();
     if (!in_array("text", $config->enabled_feathers) or !in_array("video", $config->enabled_feathers) or !in_array("audio", $config->enabled_feathers) or !in_array("chat", $config->enabled_feathers) or !in_array("photo", $config->enabled_feathers) or !in_array("quote", $config->enabled_feathers) or !in_array("link", $config->enabled_feathers)) {
         error(__("Missing Feather"), __("Importing from Tumblr requires the Text, Video, Audio, Chat, Photo, Quote, and Link feathers to be installed and enabled."));
     }
     if (ini_get("memory_limit") < 20) {
         ini_set("memory_limit", "20M");
     }
     if (!parse_url($_POST['tumblr_url'], PHP_URL_SCHEME)) {
         $_POST['tumblr_url'] = "http://" . $_POST['tumblr_url'];
     }
     set_time_limit(3600);
     $url = rtrim($_POST['tumblr_url'], "/") . "/api/read?num=50";
     $api = preg_replace("/<(\\/?)([a-z]+)\\-([a-z]+)/", "<\\1\\2_\\3", get_remote($url));
     $api = preg_replace("/ ([a-z]+)\\-([a-z]+)=/", " \\1_\\2=", $api);
     $xml = simplexml_load_string($api);
     if (!isset($xml->tumblelog)) {
         Flash::warning(__("The URL you specified does not seem to be a valid Tumblr site."), "/admin/?action=import");
     }
     $already_in = $posts = array();
     foreach ($xml->posts->post as $post) {
         $posts[] = $post;
         $already_in[] = $post->attributes()->id;
     }
     while ($xml->posts->attributes()->total > count($posts)) {
         set_time_limit(3600);
         $api = preg_replace("/<(\\/?)([a-z]+)\\-([a-z]+)/", "<\\1\\2_\\3", get_remote($url . "&start=" . count($posts)));
         $api = preg_replace("/ ([a-z]+)\\-([a-z]+)=/", " \\1_\\2=", $api);
         $xml = simplexml_load_string($api, "SimpleXMLElement", LIBXML_NOCDATA);
         foreach ($xml->posts->post as $post) {
             if (!in_array($post->attributes()->id, $already_in)) {
                 $posts[] = $post;
                 $already_in[] = $post->attributes()->id;
             }
         }
     }
     function reverse($a, $b)
     {
         if (empty($a) or empty($b)) {
             return 0;
         }
         return strtotime($a->attributes()->date) < strtotime($b->attributes()->date) ? -1 : 1;
     }
     set_time_limit(3600);
     usort($posts, "reverse");
     foreach ($posts as $key => $post) {
         set_time_limit(3600);
         if ($post->attributes()->type == "audio") {
             continue;
         }
         # Can't import Audio posts since Tumblr has the files locked in to Amazon.
         $translate_types = array("regular" => "text", "conversation" => "chat");
         $clean = "";
         switch ($post->attributes()->type) {
             case "regular":
                 $title = fallback($post->regular_title);
                 $values = array("title" => $title, "body" => $post->regular_body);
                 $clean = sanitize($title);
                 break;
             case "video":
                 $values = array("embed" => $post->video_player, "caption" => fallback($post->video_caption));
                 break;
             case "conversation":
                 $title = fallback($post->conversation_title);
                 $lines = array();
                 foreach ($post->conversation_line as $line) {
                     $lines[] = $line->attributes()->label . " " . $line;
                 }
                 $values = array("title" => $title, "dialogue" => implode("\n", $lines));
                 $clean = sanitize($title);
                 break;
             case "photo":
                 $values = array("filename" => upload_from_url($post->photo_url[0]), "caption" => fallback($post->photo_caption));
                 break;
             case "quote":
                 $values = array("quote" => $post->quote_text, "source" => preg_replace("/^&mdash; /", "", fallback($post->quote_source)));
                 break;
             case "link":
                 $name = fallback($post->link_text);
                 $values = array("name" => $name, "source" => $post->link_url, "description" => fallback($post->link_description));
                 $clean = sanitize($name);
                 break;
         }
         $values["imported_from"] = "tumblr";
         $new_post = Post::add($values, $clean, Post::check_url($clean), fallback($translate_types[(string) $post->attributes()->type], (string) $post->attributes()->type), null, false, "public", datetime((int) $post->attributes()->unix_timestamp), null, "", false);
         Trigger::current()->call("import_tumble", $post, $new_post);
     }
     Flash::notice(__("Tumblr content successfully imported!"), "/admin/?action=import");
 }
开发者ID:eadz,项目名称:chyrp,代码行数:100,代码来源:Admin.php

示例12: do_aprs

function do_aprs()
{
    // 3/15/11 - populates the APRS tracks table and updates responder position data
    global $ts_threshold;
    // 4/25/11
    global $istest;
    $the_key = trim(get_variable('aprs_fi_key'));
    if (empty($the_key)) {
        do_log($GLOBALS['LOG_ERROR'], 0, 0, "APRS_FI key required for APRS operation");
        return FALSE;
    }
    $dist_chk = $istest ? 2500000.0 : 250000.0;
    $pkt_ids = array();
    // 6/17/08
    $speeds = array();
    // 10/2/08
    $sources = array();
    // 4/25/11
    $query = "SELECT `callsign`, `mobile` FROM `{$GLOBALS['mysql_prefix']}responder`\n\t\tWHERE (\t( `mobile`= 1 )\n\t\tAND  \t(`aprs`= 1 )\n\t\tAND \t(`callsign` <> ''))";
    $result1 = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__);
    //	snap(__LINE__, $query);																	// remove old track records
    while ($row1 = mysql_fetch_assoc($result1)) {
        $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}tracks` WHERE `source`= '{$row1['callsign']}' ORDER BY `packet_date` DESC LIMIT 1";
        // possibly none
        $result2 = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__);
        while ($row2 = mysql_fetch_assoc($result2)) {
            $pkt_ids[trim($row2['packet_id'])] = TRUE;
            // index is packet_id
            $sources[trim($row2['source'])] = TRUE;
            // index is callsign
            $speeds[trim($row2['source'])] = $row2['speed'];
            // index is callsign 10/2/08
        }
    }
    $query = "DELETE FROM `{$GLOBALS['mysql_prefix']}tracks` WHERE `updated`< (NOW() - INTERVAL 7 DAY)";
    $resultd = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    unset($resultd);
    $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}responder` WHERE `mobile`= 1 AND `aprs`= 1 AND `callsign` <> ''";
    // work each call sign, 8/10/09
    $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), __FILE__, __LINE__);
    $positions = array();
    if (mysql_affected_rows() > 0) {
        //
        $call_str = $sep = "";
        while ($row = @mysql_fetch_assoc($result)) {
            $lat = !empty($row['lat']) ? $row['lat'] : get_variable('def_lat');
            $lng = !empty($row['lng']) ? $row['lng'] : get_variable('def_lng');
            $positions[$row['callsign']] = array($lat, $lng);
            $call_str .= $sep . $row['callsign'];
            $sep = ",";
        }
        $the_url = "http://api.aprs.fi/api/get?name={$call_str}&what=loc&apikey={$the_key}&format=json";
        //		dump($the_url);
        $data = get_remote($the_url);
        // returns JSON-decoded values
        $temp = $data->result;
        //		snap(__LINE__, $temp);
        if (strtoupper($temp) == "OK") {
            $now = mysql_format_date(time() - intval(get_variable('delta_mins')) * 60);
            for ($i = 0; $i < $data->found; $i++) {
                // extract fields from each entry
                $entry = (object) $data->entries[$i];
                //				dump($entry);
                $callsign_in = $entry->name;
                $lat = $entry->lat;
                $lng = $entry->lng;
                $updated = $entry->time;
                //				snap(__LINE__, $updated);
                @($course = $entry->course);
                // 4/24/11
                @($mph = $entry->speed);
                @($alt = @$entry->altitude);
                $packet_date = $entry->lasttime;
                $p_d_timestamp = mysql_format_date($packet_date);
                // datetime format
                // 4/25/11
                if (sane($lat, $lng, $updated)) {
                    $query = "UPDATE `{$GLOBALS['mysql_prefix']}responder` SET \n\t\t\t\t\t\t`lat` = '{$lat}', `lng` ='{$lng}', `updated` = '{$p_d_timestamp}' \n\t\t\t\t\t\tWHERE ((`aprs` = 1)\n\t\t\t\t\t\t(AND  `updated` <> '{$p_d_timestamp}')\n\t\t\t\t\t\t(AND  `callsign` = '{$callsign_in}'))";
                    //					snap(__LINE__, $p_d_timestamp);
                    $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
                    $our_hash = $callsign_in . (string) (abs($lat) + abs($lng));
                    // a hash - for dupe prevention
                    $query = "INSERT INTO `{$GLOBALS['mysql_prefix']}tracks` (\n\t\t\t\t\t\tpacket_id, source, latitude, longitude, speed, course, altitude, packet_date, updated) VALUES (\n\t\t\t\t\t\t'{$our_hash}', '{$callsign_in}', '{$lat}', '{$lng}', '{$mph}', '{$course}', '{$alt}', '{$p_d_timestamp}', '{$now}')";
                    $result = mysql_query($query);
                    // ignore duplicate/errors
                    $result_tr = mysql_query($query) or $error = TRUE;
                }
            }
            // end for ($i...)
        }
        // end ( JSON data OK)
    }
    // end (mysql_affected_rows() > 0) - any APRS units?
}
开发者ID:sharedgeo,项目名称:TicketsCAD-SharedGeo-Dev,代码行数:94,代码来源:remotes.inc.php

示例13: upload_from_url

/**
 * Function: upload_from_url
 * Copy a file from a specified URL to their upload directory.
 *
 * Parameters:
 *     $url - The URL to copy.
 *     $extension - An array of valid extensions (case-insensitive).
 *     $path - A sub-folder in the uploads directory (optional).
 *
 * See Also:
 *     <upload>
 */
function upload_from_url($url, $extension = null, $path = "")
{
    $file = tempnam(null, "chyrp");
    file_put_contents($file, get_remote($url));
    $fake_file = array("name" => basename(parse_url($url, PHP_URL_PATH)), "tmp_name" => $file);
    return upload($fake_file, $extension, $path, true);
}
开发者ID:homebru,项目名称:bandb,代码行数:19,代码来源:helpers.php

示例14: getstatinfo

function getstatinfo($params = array())
{
    $version = MPIC_VERSION;
    $onlineip = get_real_ip();
    $funcurl = 'http://meiupic' . '.mei' . 'u' . '.c' . 'n/stats_in.php';
    $PHP_SELF = htmlspecialchars($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);
    $url = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api|archiver|wap)?\\/*\$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))));
    $url = substr($url, 0, -8);
    $hash = md5("{$url}{$version}{$onlineip}");
    $q = "url={$url}&version={$version}&ip={$onlineip}&time=" . time() . "&hash={$hash}";
    foreach ($params as $key => $value) {
        $q .= '&' . $key . '=' . $value;
    }
    $q = rawurlencode(base64_encode($q));
    get_remote($funcurl . "?action=newinstall&q={$q}", 5);
}
开发者ID:jorkin,项目名称:meiupic,代码行数:16,代码来源:install_func.php

示例15: do_glat_test

function do_glat_test()
{
    //7/29/09
    $i = 1;
    $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}responder` WHERE `glat`= 1 AND `callsign` <> ''";
    // work each call/license, 8/10/09
    $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
    while ($row = @mysql_fetch_assoc($result)) {
        // for each responder/account
        //		dump($row);
        //		print $i;
        $user = $row['callsign'];
        $db_lat = $row['lat'];
        $db_lng = $row['lng'];
        $db_updated = $row['updated'];
        $update_error = strtotime('now - 1 hour');
        error_reporting(0);
        $ret_val = array("", "", "", "");
        $the_url = "http://www.google.com/latitude/apps/badge/api?user={$user}&type=json";
        $json = get_remote($the_url);
        foreach ($json as $key => $value) {
            // foreach 1
            $temp = $value;
            foreach ($temp as $key1 => $value1) {
                // foreach 2
                $temp = $value1;
                foreach ($temp as $key2 => $value2) {
                    // foreach 3
                    $temp = $value2;
                    foreach ($temp as $key3 => $value3) {
                        // foreach 4
                        switch (strtolower($key3)) {
                            case "id":
                                $ret_val[0] = $value3;
                                break;
                            case "timestamp":
                                $ret_val[1] = $value3;
                                break;
                            case "coordinates":
                                $ret_val[2] = $value3[0];
                                $ret_val[3] = $value3[1];
                                break;
                        }
                        // end switch()
                    }
                    // end for each()
                }
                // end for each()
            }
            // end for each()
        }
        // end foreach 1
        error_reporting(E_ALL);
        if (empty($ret_val[0]) || empty($ret_val[1]) || !my_is_float($ret_val[2]) || !my_is_float($ret_val[3])) {
            $result_code = $i . " " . "do_glat() unsuccesful<br />";
            print $result_code;
        } else {
            // valid glat data
            $result_code = $i . " " . "do_glat() successful<br />";
            print $result_code;
        }
        // end if/else()
        $i++;
    }
    // end while()
}
开发者ID:sharedgeo,项目名称:TicketsCAD-SharedGeo-Dev,代码行数:66,代码来源:test_get_current.php


注:本文中的get_remote函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。