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


PHP z_fetch_url函数代码示例

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


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

示例1: run

 public static function run($argc, $argv)
 {
     /**
      * Cron Weekly
      * 
      * Actions in the following block are executed once per day only on Sunday (once per week).
      *
      */
     call_hooks('cron_weekly', datetime_convert());
     z_check_cert();
     require_once 'include/hubloc.php';
     prune_hub_reinstalls();
     mark_orphan_hubsxchans();
     // get rid of really old poco records
     q("delete from xlink where xlink_updated < %s - INTERVAL %s and xlink_static = 0 ", db_utcnow(), db_quoteinterval('14 DAY'));
     $dirmode = intval(get_config('system', 'directory_mode'));
     if ($dirmode === DIRECTORY_MODE_SECONDARY || $dirmode === DIRECTORY_MODE_PRIMARY) {
         logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . urlencode(z_root()) . '&realm=' . urlencode(get_directory_realm())), true));
     }
     // Check for dead sites
     Master::Summon(array('Checksites'));
     // update searchable doc indexes
     Master::Summon(array('Importdoc'));
     /**
      * End Cron Weekly
      */
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:27,代码来源:Cron_weekly.php

示例2: pubsites_content

function pubsites_content(&$a)
{
    require_once 'include/dir_fns.php';
    $dirmode = intval(get_config('system', 'directory_mode'));
    if ($dirmode == DIRECTORY_MODE_PRIMARY || $dirmode == DIRECTORY_MODE_STANDALONE) {
        $url = z_root() . '/dirsearch';
    }
    if (!$url) {
        $directory = find_upstream_directory($dirmode);
        $url = $directory['url'] . '/dirsearch';
    }
    $url .= '/sites';
    $o .= '<h1>' . t('Public Sites') . '</h1>';
    $o .= '<div class="descriptive-text">' . t('The listed sites allow public registration into the Red Matrix. All sites in the matrix are interlinked so membership on any of them conveys membership in the matrix as a whole. Some sites may require subscription or provide tiered service plans. The provider links <strong>may</strong> provide additional details.') . '</div>' . EOL;
    $ret = z_fetch_url($url);
    if ($ret['success']) {
        $j = json_decode($ret['body'], true);
        if ($j) {
            $rate_meta = local_channel() ? '<td>' . t('Rate this hub') . '</td>' : '';
            $o .= '<table border="1"><tr><td>' . t('Site URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Location') . '</td><td>' . t('View hub ratings') . '</td>' . $rate_meta . '</tr>';
            if ($j['sites']) {
                foreach ($j['sites'] as $jj) {
                    $host = strtolower(substr($jj['url'], strpos($jj['url'], '://') + 3));
                    $rate_links = local_channel() ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="icon-check"></i> ' . t('Rate') . '</a></td>' : '';
                    $o .= '<tr><td>' . '<a href="' . ($jj['sellpage'] ? $jj['sellpage'] : $jj['url'] . '/register') . '" >' . $jj['url'] . '</a>' . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . $jj['location'] . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="icon-eye-open"></i> ' . t('View ratings') . '</a></td>' . $rate_links . '</tr>';
                }
            }
            $o .= '</table>';
        }
    }
    return $o;
}
开发者ID:redmatrix,项目名称:red,代码行数:32,代码来源:pubsites.php

示例3: oembed_fetch_url

function oembed_fetch_url($embedurl)
{
    $a = get_app();
    $txt = Cache::get($a->videowidth . $embedurl);
    if (strstr($txt, 'youtu')) {
        $txt = str_replace('http:', 'https:', $txt);
    }
    // These media files should now be caught in bbcode.php
    // left here as a fallback in case this is called from another source
    $noexts = array("mp3", "mp4", "ogg", "ogv", "oga", "ogm", "webm");
    $ext = pathinfo(strtolower($embedurl), PATHINFO_EXTENSION);
    if (is_null($txt)) {
        $txt = "";
        if (in_array($ext, $noexts)) {
            require_once 'include/hubloc.php';
            $zrl = is_matrix_url($embedurl);
            if ($zrl) {
                $embedurl = zid($embedurl);
            }
        } else {
            // try oembed autodiscovery
            $redirects = 0;
            $result = z_fetch_url($embedurl, false, $redirects, array('timeout' => 15, 'accept_content' => "text/*", 'novalidate' => true));
            if ($result['success']) {
                $html_text = $result['body'];
            }
            if ($html_text) {
                $dom = @DOMDocument::loadHTML($html_text);
                if ($dom) {
                    $xpath = new DOMXPath($dom);
                    $attr = "oembed";
                    $xattr = oe_build_xpath("class", "oembed");
                    $entries = $xpath->query("//link[@type='application/json+oembed']");
                    foreach ($entries as $e) {
                        $href = $e->getAttributeNode("href")->nodeValue;
                        $x = z_fetch_url($href . '&maxwidth=' . $a->videowidth);
                        $txt = $x['body'];
                        break;
                    }
                }
            }
        }
        if ($txt == false || $txt == "") {
            $x = array('url' => $embedurl, 'videowidth' => $a->videowidth);
            call_hooks('oembed_probe', $x);
            if (array_key_exists('embed', $x)) {
                $txt = $x['embed'];
            }
        }
        $txt = trim($txt);
        if ($txt[0] != "{") {
            $txt = '{"type":"error"}';
        }
        //save in cache
        Cache::set($a->videowidth . $embedurl, $txt);
    }
    $j = json_decode($txt);
    $j->embedurl = $embedurl;
    return $j;
}
开发者ID:Mauru,项目名称:red,代码行数:60,代码来源:oembed.php

示例4: get

 function get()
 {
     require_once 'include/dir_fns.php';
     $dirmode = intval(get_config('system', 'directory_mode'));
     if ($dirmode == DIRECTORY_MODE_PRIMARY || $dirmode == DIRECTORY_MODE_STANDALONE) {
         $url = z_root() . '/dirsearch';
     }
     if (!$url) {
         $directory = find_upstream_directory($dirmode);
         $url = $directory['url'] . '/dirsearch';
     }
     $url .= '/sites';
     $rating_enabled = get_config('system', 'rating_enabled');
     $o .= '<div class="generic-content-wrapper">';
     $o .= '<div class="section-title-wrapper"><h2>' . t('Public Hubs') . '</h2></div>';
     $o .= '<div class="section-content-tools-wrapper"><div class="descriptive-text">' . t('The listed hubs allow public registration for the $Projectname network. All hubs in the network are interlinked so membership on any of them conveys membership in the network as a whole. Some hubs may require subscription or provide tiered service plans. The hub itself <strong>may</strong> provide additional details.') . '</div>' . EOL;
     $ret = z_fetch_url($url);
     if ($ret['success']) {
         $j = json_decode($ret['body'], true);
         if ($j) {
             $o .= '<table class="table table-striped table-hover"><tr><td>' . t('Hub URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Stats') . '</td><td>' . t('Software') . '</td>';
             if ($rating_enabled) {
                 $o .= '<td colspan="2">' . t('Ratings') . '</td>';
             }
             $o .= '</tr>';
             if ($j['sites']) {
                 foreach ($j['sites'] as $jj) {
                     if (!$jj['project']) {
                         continue;
                     }
                     if (strpos($jj['version'], ' ')) {
                         $x = explode(' ', $jj['version']);
                         if ($x[1]) {
                             $jj['version'] = $x[1];
                         }
                     }
                     $m = parse_url($jj['url']);
                     $host = strtolower(substr($jj['url'], strpos($jj['url'], '://') + 3));
                     $rate_links = local_channel() ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="fa fa-check-square-o"></i> ' . t('Rate') . '</a></td>' : '';
                     $location = '';
                     if (!empty($jj['location'])) {
                         $location = '<p title="' . t('Location') . '" style="margin: 5px 5px 0 0; text-align: right"><i class="fa fa-globe"></i> ' . $jj['location'] . '</p>';
                     } else {
                         $location = '<br />&nbsp;';
                     }
                     $urltext = str_replace(array('https://'), '', $jj['url']);
                     $o .= '<tr><td><a href="' . ($jj['sellpage'] ? $jj['sellpage'] : $jj['url'] . '/register') . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . ($jj['version'] ? ' ' . $jj['version'] : '') . '</td>';
                     if ($rating_enabled) {
                         $o .= '<td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links;
                     }
                     $o .= '</tr>';
                 }
             }
             $o .= '</table>';
             $o .= '</div></div>';
         }
     }
     return $o;
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:59,代码来源:Pubsites.php

示例5: init

 function init()
 {
     if (get_config('system', 'block_public') && !local_channel() && !remote_channel()) {
         return;
     }
     if (local_channel()) {
         load_contact_links(local_channel());
     }
     $dirmode = intval(get_config('system', 'directory_mode'));
     $x = find_upstream_directory($dirmode);
     if ($x) {
         $url = $x['url'];
     }
     $poco_rating = get_config('system', 'poco_rating_enable');
     // if unset default to enabled
     if ($poco_rating === false) {
         $poco_rating = true;
     }
     if (!$poco_rating) {
         return;
     }
     if (argc() > 1) {
         $hash = argv(1);
     }
     if (!$hash) {
         notice('Must supply a channel identififier.');
         return;
     }
     $results = false;
     $x = z_fetch_url($url . '/ratingsearch/' . urlencode($hash));
     if ($x['success']) {
         $results = json_decode($x['body'], true);
     }
     if (!$results || !$results['success']) {
         notice('No results.');
         return;
     }
     if (array_key_exists('xchan_hash', $results['target'])) {
         \App::$poi = $results['target'];
     }
     $friends = array();
     $others = array();
     if ($results['ratings']) {
         foreach ($results['ratings'] as $n) {
             if (is_array(\App::$contacts) && array_key_exists($n['xchan_hash'], \App::$contacts)) {
                 $friends[] = $n;
             } else {
                 $others[] = $n;
             }
         }
     }
     \App::$data = array('target' => $results['target'], 'results' => array_merge($friends, $others));
     if (!\App::$data['results']) {
         notice(t('No ratings') . EOL);
     }
     return;
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:57,代码来源:Ratings.php

示例6: embedly_oembed_probe

function embedly_oembed_probe($a, $b)
{
    // try oohembed service
    $ourl = "http://oohembed.com/oohembed/?url=" . $b['url'] . '&maxwidth=' . $b['videowidth'];
    $result = z_fetch_url($ourl);
    if ($result['success']) {
        $b['embed'] = $result['body'];
    }
}
开发者ID:git-marijus,项目名称:hubzilla-addons,代码行数:9,代码来源:embedly.php

示例7: noembed_oembed_probe

function noembed_oembed_probe(&$a, &$b)
{
    // try noembed service
    $ourl = 'https://noembed.com/embed?url=' . urlencode($b['url']);
    $result = z_fetch_url($ourl);
    if ($result['success']) {
        $b['embed'] = $result['body'];
    }
}
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:9,代码来源:noembed.php

示例8: ostatus_subscribe_content

function ostatus_subscribe_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        goaway($_SESSION['return_url']);
        // NOTREACHED
    }
    $o = "<h2>" . t("Subsribing to OStatus contacts") . "</h2>";
    $uid = local_user();
    $a = get_app();
    $counter = intval($_REQUEST['counter']);
    if (get_pconfig($uid, "ostatus", "legacy_friends") == "") {
        if ($_REQUEST["url"] == "") {
            return $o . t("No contact provided.");
        }
        $contact = probe_url($_REQUEST["url"]);
        if (!$contact) {
            return $o . t("Couldn't fetch information for contact.");
        }
        $api = $contact["baseurl"] . "/api/";
        // Fetching friends
        $data = z_fetch_url($api . "statuses/friends.json?screen_name=" . $contact["nick"]);
        if (!$data["success"]) {
            return $o . t("Couldn't fetch friends for contact.");
        }
        set_pconfig($uid, "ostatus", "legacy_friends", $data["body"]);
    }
    $friends = json_decode(get_pconfig($uid, "ostatus", "legacy_friends"));
    $total = sizeof($friends);
    if ($counter >= $total) {
        $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . $a->get_baseurl() . '/settings/connectors">';
        del_pconfig($uid, "ostatus", "legacy_friends");
        del_pconfig($uid, "ostatus", "legacy_contact");
        $o .= t("Done");
        return $o;
    }
    $friend = $friends[$counter++];
    $url = $friend->statusnet_profile_url;
    $o .= "<p>" . $counter . "/" . $total . ": " . $url;
    $data = probe_url($url);
    if ($data["network"] == NETWORK_OSTATUS) {
        $result = new_contact($uid, $url, true);
        if ($result["success"]) {
            $o .= " - " . t("success");
        } else {
            $o .= " - " . t("failed");
        }
    } else {
        $o .= " - " . t("ignored");
    }
    $o .= "</p>";
    $o .= "<p>" . t("Keep this window open until done.") . "</p>";
    $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . $a->get_baseurl() . '/ostatus_subscribe?counter=' . $counter . '">';
    return $o;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:55,代码来源:ostatus_subscribe.php

示例9: fortunate_fetch

function fortunate_fetch(&$a, &$b)
{
    $fort_server = get_config('fortunate', 'server');
    if (!$fort_server) {
        return;
    }
    $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
    $s = z_fetch_url('http://' . $fort_server . '/cookie.php?numlines=4&equal=1&rand=' . mt_rand());
    if ($s['success']) {
        $b .= '<div class="fortunate">' . $s['body'] . '</div>';
    }
}
开发者ID:git-marijus,项目名称:hubzilla-addons,代码行数:12,代码来源:fortunate.php

示例10: oexchange_content

function oexchange_content(&$a)
{
    if (!local_channel()) {
        if (remote_channel()) {
            $observer = $a->get_observer();
            if ($observer && $observer['xchan_url']) {
                $parsed = @parse_url($observer['xchan_url']);
                if (!$parsed) {
                    notice(t('Unable to find your hub.') . EOL);
                    return;
                }
                $url = $parsed['scheme'] . '://' . $parsed['host'] . ($parsed['port'] ? ':' . $parsed['port'] : '');
                $url .= '/oexchange';
                $result = z_post_url($url, $_REQUEST);
                json_return_and_die($result);
            }
        }
        return login(false);
    }
    if (argc() > 1 && argv(1) === 'done') {
        info(t('Post successful.') . EOL);
        return;
    }
    $url = x($_REQUEST, 'url') && strlen($_REQUEST['url']) ? urlencode(notags(trim($_REQUEST['url']))) : '';
    $title = x($_REQUEST, 'title') && strlen($_REQUEST['title']) ? '&title=' . urlencode(notags(trim($_REQUEST['title']))) : '';
    $description = x($_REQUEST, 'description') && strlen($_REQUEST['description']) ? '&description=' . urlencode(notags(trim($_REQUEST['description']))) : '';
    $tags = x($_REQUEST, 'tags') && strlen($_REQUEST['tags']) ? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '';
    $ret = z_fetch_url($a->get_baseurl() . '/urlinfo?f=&url=' . $url . $title . $description . $tags);
    if ($ret['success']) {
        $s = $ret['body'];
    }
    if (!strlen($s)) {
        return;
    }
    $post = array();
    $post['profile_uid'] = local_channel();
    $post['return'] = '/oexchange/done';
    $post['body'] = $s;
    $post['type'] = 'wall';
    $_REQUEST = $post;
    require_once 'mod/item.php';
    item_post($a);
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:43,代码来源:oexchange.php

示例11: get

 function get()
 {
     $auth_success = false;
     $o .= '<h3>Magic-Auth Diagnostic</h3>';
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return $o;
     }
     $o .= '<form action="authtest" method="get">';
     $o .= 'Target URL: <input type="text" style="width: 250px;" name="dest" value="' . $_GET['dest'] . '" />';
     $o .= '<input type="submit" name="submit" value="Submit" /></form>';
     $o .= '<br /><br />';
     if (x($_GET, 'dest')) {
         if (strpos($_GET['dest'], '@')) {
             $_GET['dest'] = $_REQUEST['dest'] = 'https://' . substr($_GET['dest'], strpos($_GET['dest'], '@') + 1) . '/channel/' . substr($_GET['dest'], 0, strpos($_GET['dest'], '@'));
         }
         $_REQUEST['test'] = 1;
         $mod = new Magic();
         $x = $mod->init($a);
         $o .= 'Local Setup returns: ' . print_r($x, true);
         if ($x['url']) {
             $z = z_fetch_url($x['url'] . '&test=1');
             if ($z['success']) {
                 $j = json_decode($z['body'], true);
                 if (!$j) {
                     $o .= 'json_decode failure from remote site. ' . print_r($z['body'], true);
                 }
                 $o .= 'Remote site responded: ' . print_r($j, true);
                 if ($j['success'] && strpos($j['message'], 'Authentication Success')) {
                     $auth_success = true;
                 }
             } else {
                 $o .= 'fetch url failure.' . print_r($z, true);
             }
         }
         if (!$auth_success) {
             $o .= 'Authentication Failed!' . EOL;
         }
     }
     return str_replace("\n", '<br />', $o);
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:41,代码来源:Authtest.php

示例12: sslify_init

function sslify_init(&$a)
{
    $x = z_fetch_url($_REQUEST['url']);
    if ($x['success']) {
        $h = explode("\n", $x['header']);
        foreach ($h as $l) {
            list($k, $v) = array_map("trim", explode(":", trim($l), 2));
            $hdrs[$k] = $v;
        }
        if (array_key_exists('Content-Type', $hdrs)) {
            $type = $hdrs['Content-Type'];
        }
        header('Content-Type: ' . $type);
        echo $x['body'];
        killme();
    }
    killme();
    // for some reason when this fallback is in place - it gets triggered
    // often, (creating mixed content exceptions) even though there is
    // nothing obvious missing on the page when we bypass it.
    goaway($_REQUEST['url']);
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:22,代码来源:sslify.php

示例13: diaspora_load

function diaspora_load()
{
    register_hook('notifier_hub', 'addon/diaspora/diaspora.php', 'diaspora_process_outbound');
    register_hook('notifier_process', 'addon/diaspora/diaspora.php', 'diaspora_notifier_process');
    register_hook('permissions_create', 'addon/diaspora/diaspora.php', 'diaspora_permissions_create');
    register_hook('permissions_update', 'addon/diaspora/diaspora.php', 'diaspora_permissions_update');
    register_hook('module_loaded', 'addon/diaspora/diaspora.php', 'diaspora_load_module');
    register_hook('follow_allow', 'addon/diaspora/diaspora.php', 'diaspora_follow_allow');
    register_hook('feature_settings_post', 'addon/diaspora/diaspora.php', 'diaspora_feature_settings_post');
    register_hook('feature_settings', 'addon/diaspora/diaspora.php', 'diaspora_feature_settings');
    register_hook('post_local', 'addon/diaspora/diaspora.php', 'diaspora_post_local');
    register_hook('well_known', 'addon/diaspora/diaspora.php', 'diaspora_well_known');
    if (!get_config('diaspora', 'relay_handle')) {
        $x = import_author_diaspora(array('address' => 'relay@relay.iliketoast.net'));
        if ($x) {
            set_config('diaspora', 'relay_handle', $x);
            // Now register
            $url = "http://the-federation.info/register/" . App::get_hostname();
            $ret = z_fetch_url($url);
        }
    }
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:22,代码来源:diaspora.php

示例14: import_account

 function import_account($account_id)
 {
     if (!$account_id) {
         logger("import_account: No account ID supplied");
         return;
     }
     $max_identities = account_service_class_fetch($account_id, 'total_identities');
     $max_friends = account_service_class_fetch($account_id, 'total_channels');
     $max_feeds = account_service_class_fetch($account_id, 'total_feeds');
     if ($max_identities !== false) {
         $r = q("select channel_id from channel where channel_account_id = %d", intval($account_id));
         if ($r && count($r) > $max_identities) {
             notice(sprintf(t('Your service plan only allows %d channels.'), $max_identities) . EOL);
             return;
         }
     }
     $data = null;
     $seize = x($_REQUEST, 'make_primary') ? intval($_REQUEST['make_primary']) : 0;
     $import_posts = x($_REQUEST, 'import_posts') ? intval($_REQUEST['import_posts']) : 0;
     $src = $_FILES['filename']['tmp_name'];
     $filename = basename($_FILES['filename']['name']);
     $filesize = intval($_FILES['filename']['size']);
     $filetype = $_FILES['filename']['type'];
     $completed = array_key_exists('import_step', $_SESSION) ? intval($_SESSION['import_step']) : 0;
     if ($completed) {
         logger('saved import step: ' . $_SESSION['import_step']);
     }
     if ($src) {
         // This is OS specific and could also fail if your tmpdir isn't very large
         // mostly used for Diaspora which exports gzipped files.
         if (strpos($filename, '.gz')) {
             @rename($src, $src . '.gz');
             @system('gunzip ' . escapeshellarg($src . '.gz'));
         }
         if ($filesize) {
             $data = @file_get_contents($src);
         }
         unlink($src);
     }
     if (!$src) {
         $old_address = x($_REQUEST, 'old_address') ? $_REQUEST['old_address'] : '';
         if (!$old_address) {
             logger('mod_import: nothing to import.');
             notice(t('Nothing to import.') . EOL);
             return;
         }
         $email = x($_REQUEST, 'email') ? $_REQUEST['email'] : '';
         $password = x($_REQUEST, 'password') ? $_REQUEST['password'] : '';
         $channelname = substr($old_address, 0, strpos($old_address, '@'));
         $servername = substr($old_address, strpos($old_address, '@') + 1);
         $scheme = 'https://';
         $api_path = '/api/red/channel/export/basic?f=&channel=' . $channelname;
         if ($import_posts) {
             $api_path .= '&posts=1';
         }
         $binary = false;
         $redirects = 0;
         $opts = array('http_auth' => $email . ':' . $password);
         $url = $scheme . $servername . $api_path;
         $ret = z_fetch_url($url, $binary, $redirects, $opts);
         if (!$ret['success']) {
             $ret = z_fetch_url('http://' . $servername . $api_path, $binary, $redirects, $opts);
         }
         if ($ret['success']) {
             $data = $ret['body'];
         } else {
             notice(t('Unable to download data from old server') . EOL);
         }
     }
     if (!$data) {
         logger('mod_import: empty file.');
         notice(t('Imported file is empty.') . EOL);
         return;
     }
     $data = json_decode($data, true);
     //	logger('import: data: ' . print_r($data,true));
     //	print_r($data);
     if (array_key_exists('user', $data) && array_key_exists('version', $data)) {
         require_once 'include/Import/import_diaspora.php';
         import_diaspora($data);
         return;
     }
     $moving = false;
     if (array_key_exists('compatibility', $data) && array_key_exists('database', $data['compatibility'])) {
         $v1 = substr($data['compatibility']['database'], -4);
         $v2 = substr(DB_UPDATE_VERSION, -4);
         if ($v2 > $v1) {
             $t = sprintf(t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1);
             notice($t);
         }
         if (array_key_exists('server_role', $data['compatibility']) && $data['compatibility']['server_role'] == 'basic') {
             $moving = true;
         }
     }
     if ($moving) {
         $seize = 1;
     }
     // import channel
     $relocate = array_key_exists('relocate', $data) ? $data['relocate'] : null;
     if (array_key_exists('channel', $data)) {
//.........这里部分代码省略.........
开发者ID:phellmes,项目名称:hubzilla,代码行数:101,代码来源:Import.php

示例15: remote_online_status

function remote_online_status($webbie)
{
    $result = false;
    $r = q("select * from hubloc where hubloc_addr = '%s' limit 1", dbesc($webbie));
    if (!$r) {
        return $result;
    }
    $url = $r[0]['hubloc_url'] . '/online/' . substr($webbie, 0, strpos($webbie, '@'));
    $x = z_fetch_url($url);
    if ($x['success']) {
        $j = json_decode($x['body'], true);
        if ($j) {
            $result = $j['result'] ? $j['result'] : false;
        }
    }
    return $result;
}
开发者ID:23n,项目名称:hubzilla,代码行数:17,代码来源:identity.php


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