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


PHP App::get_hostname方法代码示例

本文整理汇总了PHP中App::get_hostname方法的典型用法代码示例。如果您正苦于以下问题:PHP App::get_hostname方法的具体用法?PHP App::get_hostname怎么用?PHP App::get_hostname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App的用法示例。


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

示例1: p_init

function p_init(&$a)
{
    if (argc() < 2) {
        http_status_exit(401);
    }
    $mid = str_replace('.xml', '', argv(1));
    $r = q("select * from item where mid = '%s' and item_wall = 1 and item_private = 0 limit 1", dbesc($mid));
    if (!$r || !perm_is_allowed($r[0]['uid'], '', 'view_stream')) {
        http_status_exit(404);
    }
    $c = q("select * from channel where channel_id = %d limit 1", intval($r[0]['uid']));
    if (!$c) {
        http_status_exit(404);
    }
    $myaddr = $c[0]['channel_address'] . '@' . App::get_hostname();
    $item = $r[0];
    $title = $item['title'];
    $body = bb2diaspora_itembody($item);
    $created = datetime_convert('UTC', 'UTC', $item['created'], 'Y-m-d H:i:s \\U\\T\\C');
    $tpl = get_markup_template('diaspora_post.tpl', 'addon/diaspora');
    $msg = replace_macros($tpl, array('$body' => xmlify($body), '$guid' => $item['mid'], '$handle' => xmlify($myaddr), '$public' => 'true', '$created' => $created, '$provider' => $item['app'] ? $item['app'] : t('$projectname')));
    header('Content-type: text/xml');
    echo $msg;
    killme();
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:25,代码来源:p.php

示例2: pumpio_registerclient

function pumpio_registerclient($a, $host)
{
    $url = 'https://' . $host . '/api/client/register';
    $params = array();
    $application_name = get_config('pumpio', 'application_name');
    if (!$application_name) {
        $application_name = App::get_hostname();
    }
    $params['type'] = 'client_associate';
    $params['contacts'] = get_config('system', 'admin_email');
    $params['application_type'] = 'native';
    $params['application_name'] = $application_name;
    $params['logo_uri'] = z_root() . '/images/rhash-32.png';
    $params['redirect_uris'] = z_root() . '/pumpio/connect';
    $res = z_post_url($url, $params);
    if ($res['success']) {
        logger('pumpio: registerclient: ' . $res['body'], LOGGER_DATA);
        $values = json_decode($res['body'], true);
        $pumpio = array();
        $pumpio["client_id"] = $values['client_id'];
        $pumpio["client_secret"] = $values['client_secret'];
        //print_r($values);
        return $values;
    }
    return false;
}
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:26,代码来源:pumpio.php

示例3: run

 public static function run($argc, $argv)
 {
     if ($argc != 2) {
         killme();
     }
     \App::$session->start();
     $_SESSION['authenticated'] = 1;
     $_SESSION['uid'] = $argv[1];
     $x = session_id();
     $f = 'store/[data]/cookie_' . $argv[1];
     $c = 'store/[data]/cookien_' . $argv[1];
     $e = file_exists($f);
     $output = '';
     if ($e) {
         $lines = file($f);
         if ($lines) {
             foreach ($lines as $line) {
                 if (strlen($line) > 0 && $line[0] != '#' && substr_count($line, "\t") == 6) {
                     $tokens = explode("\t", $line);
                     $tokens = array_map('trim', $tokens);
                     if ($tokens[4] > time()) {
                         $output .= $line . "\n";
                     }
                 } else {
                     $output .= $line;
                 }
             }
         }
     }
     $t = time() + 24 * 3600;
     file_put_contents($f, $output . 'HttpOnly_' . \App::get_hostname() . "\tFALSE\t/\tTRUE\t{$t}\tPHPSESSID\t" . $x, $e ? FILE_APPEND : 0);
     file_put_contents($c, $x);
     killme();
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:34,代码来源:CurlAuth.php

示例4: init

 function init()
 {
     $uri = urldecode(notags(trim($_GET['uri'])));
     logger('xrd: ' . $uri, LOGGER_DEBUG);
     $resource = $uri;
     if (substr($uri, 0, 4) === 'http') {
         $uri = str_replace('~', '', $uri);
         $name = basename($uri);
     } else {
         $local = str_replace('acct:', '', $uri);
         if (substr($local, 0, 2) == '//') {
             $local = substr($local, 2);
         }
         $name = substr($local, 0, strpos($local, '@'));
     }
     $r = q("SELECT * FROM channel WHERE channel_address = '%s' LIMIT 1", dbesc($name));
     if (!$r) {
         killme();
     }
     $dspr = replace_macros(get_markup_template('xrd_diaspora.tpl'), array('$baseurl' => z_root(), '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.', '', \App::get_hostname()), '$dspr_key' => base64_encode(pemtorsa($r[0]['channel_pubkey']))));
     $salmon_key = salmon_key($r[0]['channel_pubkey']);
     header('Access-Control-Allow-Origin: *');
     header("Content-type: application/xrd+xml");
     $aliases = array('acct:' . channel_reddress($r[0]), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']);
     for ($x = 0; $x < count($aliases); $x++) {
         if ($aliases[$x] === $resource) {
             unset($aliases[$x]);
         }
     }
     $o = replace_macros(get_markup_template('xrd_person.tpl'), array('$nick' => $r[0]['channel_address'], '$accturi' => $resource, '$aliases' => $aliases, '$profile_url' => z_root() . '/channel/' . $r[0]['channel_address'], '$hcard_url' => z_root() . '/hcard/' . $r[0]['channel_address'], '$atom' => z_root() . '/feed/' . $r[0]['channel_address'], '$zot_post' => z_root() . '/post/' . $r[0]['channel_address'], '$poco_url' => z_root() . '/poco/' . $r[0]['channel_address'], '$photo' => z_root() . '/photo/profile/l/' . $r[0]['channel_id'], '$dspr' => $dspr, '$modexp' => 'data:application/magic-public-key,' . $salmon_key, '$subscribe' => z_root() . '/follow?url={uri}', '$bigkey' => salmon_key($r[0]['channel_pubkey'])));
     $arr = array('user' => $r[0], 'xml' => $o);
     call_hooks('personal_xrd', $arr);
     echo $arr['xml'];
     killme();
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:35,代码来源:Xrd.php

示例5: push_notifier_process

function push_notifier_process(&$a, &$b)
{
    logger('push_notifier_process');
    if (!$b['normal_mode']) {
        return;
    }
    if ($b['private'] || $b['packet_type'] !== 'undefined' || $b['mail']) {
        return;
    }
    if (!$b['top_level_post']) {
        return;
    }
    // find push_subscribers following this $owner
    $channel = $b['channel'];
    // allow subscriptions either by http or https, as gnu-social has been known to subscribe
    // to the wrong one.
    $r = q("select * from push_subscriber where topic like '%s'", dbesc('%://' . App::get_hostname() . '/feed/' . $channel['channel_address']));
    if (!$r) {
        return;
    }
    foreach ($r as $rr) {
        $feed = get_feed_for($channel, '', array('begin' => $rr['last_update']));
        $hmac_sig = hash_hmac("sha1", $feed, $rr['secret']);
        $slap = array('sig' => $hmac_sig, 'topic' => $rr['topic'], 'body' => $feed);
        // Check for public post and create atom wrapper and stick in queue
        // also need queue driver for 'push' since we need to set some extra headers
        $hash = random_string();
        queue_insert(array('hash' => $hash, 'account_id' => $channel['channel_account_id'], 'channel_id' => $channel['channel_id'], 'driver' => 'push', 'posturl' => $rr['callback_url'], 'notify' => '', 'msg' => json_encode($slap)));
        $b['queued'][] = $hash;
    }
}
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:31,代码来源:pubsubhubbub.php

示例6: init

 function init()
 {
     $tpl = get_markup_template('opensearch.tpl');
     header("Content-type: application/opensearchdescription+xml");
     $o = replace_macros($tpl, array('$baseurl' => z_root(), '$nodename' => \App::get_hostname()));
     echo $o;
     killme();
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:8,代码来源:Opensearch.php

示例7: hubwall_content

function hubwall_content(&$a)
{
    if (!is_site_admin()) {
        return;
    }
    $title = t('Send email to all hub members.');
    $senders = ['noreply@' . \App::get_hostname() => 'noreply@' . \App::get_hostname(), 'postmaster@' . \App::get_hostname() => 'postmaster@' . \App::get_hostname(), get_config('system', 'admin_email') => get_config('system', 'admin_email')];
    $o = replace_macros(get_markup_template('hubwall_form.tpl', 'addon/hubwall/'), array('$title' => $title, '$text' => htmlspecialchars($_REQUEST['text']), '$subject' => array('subject', t('Message subject'), $_REQUEST['subject'], ''), '$sender' => array('sender', t('Sender Email address'), $_REQUEST['sender'] ? $_REQUEST['sender'] : 'noreply@' . \App::get_hostname(), '', $senders), '$test' => array('test', t('Test mode (only send to hub administrator)'), array_key_exists('test', $_REQUEST) ? intval($_REQUEST['test']) : 0, ''), '$submit' => t('Submit')));
    return $o;
}
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:10,代码来源:hubwall.php

示例8: dfedfix_personal_xrd

function dfedfix_personal_xrd(&$a, &$b)
{
    logger('dfedfix: ' . print_r($b, true));
    $x = $b['xml'];
    $x = str_replace('</Subject>', '</Subject>
<Alias>' . z_root() . '/channel/' . $b['user']['channel_address'] . '</Alias>', $x);
    $x = str_replace('.AQAB" />', '.AQAB "/>
<Link rel="salmon" href="' . z_root() . '/receive/users/' . $b['user']['channel_guid'] . str_replace('.', '', App::get_hostname()) . '"/>', $x);
    $b['xml'] = $x;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:10,代码来源:dfedfix.php

示例9: init

 function init()
 {
     header('Access-Control-Allow-Origin: *');
     header("Content-type: application/xrd+xml");
     logger('hostxrd', LOGGER_DEBUG);
     $tpl = get_markup_template('xrd_host.tpl');
     $x = replace_macros(get_markup_template('xrd_host.tpl'), array('$zhost' => \App::get_hostname(), '$zroot' => z_root()));
     $arr = array('xrd' => $x);
     call_hooks('hostxrd', $arr);
     echo $arr['xrd'];
     killme();
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:12,代码来源:Hostxrd.php

示例10: mailhost_addon_settings

function mailhost_addon_settings(&$a, &$s)
{
    if (!local_channel()) {
        return;
    }
    /* Add our stylesheet to the page so we can make our settings look nice */
    //head_add_css('/addon/mailhost/mailhost.css');
    $mailhost = get_pconfig(local_channel(), 'system', 'email_notify_host');
    if (!$mailhost) {
        $mailhost = App::get_hostname();
    }
    $sc .= replace_macros(get_markup_template('field_input.tpl'), array('$field' => array('mailhost-mailhost', t('Email notification hub'), $mailhost, t('Hostname'))));
    $s .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array('$addon' => array('mailhost', t('Mailhost Settings'), '', t('Submit')), '$content' => $sc));
    return;
}
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:15,代码来源:mailhost.php

示例11: get

 function get()
 {
     if (!is_site_admin()) {
         return;
     }
     $o = '';
     $r = q("select * from channel where channel_removed = 0");
     $sitekey = get_config('system', 'pubkey');
     if ($r) {
         foreach ($r as $rr) {
             $found = false;
             $primary_address = '';
             $x = zot_get_hublocs($rr['channel_hash']);
             if ($x) {
                 foreach ($x as $xx) {
                     if ($xx['hubloc_url'] === z_root() && $xx['hubloc_sitekey'] === $sitekey) {
                         $found = true;
                         break;
                     }
                 }
                 if ($found) {
                     $o .= 'Hubloc exists for ' . $rr['channel_name'] . EOL;
                     continue;
                 }
             }
             $y = q("select xchan_addr from xchan where xchan_hash = '%s' limit 1", dbesc($rr['channel_hash']));
             if ($y) {
                 $primary_address = $y[0]['xchan_addr'];
             }
             $hub_address = $rr['channel']['channel_address'] . '@' . \App::get_hostname();
             $primary = $hub_address === $primary_address ? 1 : 0;
             if (!$y) {
                 $primary = 1;
             }
             $m = q("delete from hubloc where hubloc_hash = '%s' and hubloc_url = '%s' ", dbesc($rr['channel_hash']), dbesc(z_root()));
             // Create a verified hub location pointing to this site.
             $h = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_primary, hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey, hubloc_network )\n\t\t\t\t\tvalues ( '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s' )", dbesc($rr['channel_guid']), dbesc($rr['channel_guid_sig']), dbesc($rr['channel_hash']), dbesc($rr['channel_address'] . '@' . \App::get_hostname()), intval($primary), dbesc(z_root()), dbesc(base64url_encode(rsa_sign(z_root(), $rr['channel_prvkey']))), dbesc(\App::get_hostname()), dbesc(z_root() . '/post'), dbesc($sitekey), dbesc('zot'));
             if ($h) {
                 $o . 'local hubloc created for ' . $rr['channel_name'] . EOL;
             } else {
                 $o .= 'DB update failed for ' . $rr['channel_name'] . EOL;
             }
         }
         return $o;
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:46,代码来源:Fhublocs.php

示例12: init

 function init()
 {
     $gc_probability = 50;
     ini_set('session.gc_probability', $gc_probability);
     ini_set('session.use_only_cookies', 1);
     ini_set('session.cookie_httponly', 1);
     /*
      * Set our session storage functions.
      */
     $handler = new \Zotlabs\Web\SessionHandler();
     self::$handler = $handler;
     $x = session_set_save_handler($handler, false);
     if (!$x) {
         logger('Session save handler initialisation failed.', LOGGER_NORMAL, LOG_ERR);
     }
     // Force cookies to be secure (https only) if this site is SSL enabled.
     // Must be done before session_start().
     $arr = session_get_cookie_params();
     session_set_cookie_params(isset($arr['lifetime']) ? $arr['lifetime'] : 0, isset($arr['path']) ? $arr['path'] : '/', isset($arr['domain']) ? $arr['domain'] : App::get_hostname(), isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? true : false, isset($arr['httponly']) ? $arr['httponly'] : true);
     register_shutdown_function('session_write_close');
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:21,代码来源:Session.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');
    register_hook('create_identity', 'addon/diaspora/diaspora.php', 'diaspora_create_identity');
    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:phellmes,项目名称:hubzilla-addons,代码行数:23,代码来源:diaspora.php

示例14: connect_post

function connect_post(&$a)
{
    if (!array_key_exists('channel', App::$data)) {
        return;
    }
    $edit = local_channel() && local_channel() == App::$data['channel']['channel_id'] ? true : false;
    if ($edit) {
        $has_premium = App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM ? 1 : 0;
        $premium = $_POST['premium'] ? intval($_POST['premium']) : 0;
        $text = escape_tags($_POST['text']);
        if ($has_premium != $premium) {
            $r = q("update channel set channel_pageflags = ( channel_pageflags %s %d ) where channel_id = %d", db_getfunc('^'), intval(PAGE_PREMIUM), intval(local_channel()));
            proc_run('php', 'include/notifier.php', 'refresh_all', App::$data['channel']['channel_id']);
        }
        set_pconfig(App::$data['channel']['channel_id'], 'system', 'selltext', $text);
        // reload the page completely to get fresh data
        goaway(z_root() . '/' . App::$query_string);
    }
    $url = '';
    $observer = App::get_observer();
    if ($observer && $_POST['submit'] === t('Continue')) {
        if ($observer['xchan_follow']) {
            $url = sprintf($observer['xchan_follow'], urlencode(App::$data['channel']['channel_address'] . '@' . App::get_hostname()));
        }
        if (!$url) {
            $r = q("select * from hubloc where hubloc_hash = '%s' order by hubloc_id desc limit 1", dbesc($observer['xchan_hash']));
            if ($r) {
                $url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(App::$data['channel']['channel_address'] . '@' . App::get_hostname());
            }
        }
    }
    if ($url) {
        goaway($url . '&confirm=1');
    } else {
        notice('Unable to connect to your home hub location.');
    }
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:37,代码来源:connect.php

示例15: hubwall_post

function hubwall_post(&$a)
{
    if (!is_site_admin()) {
        return;
    }
    $text = trim($_REQUEST['text']);
    if (!$text) {
        return;
    }
    $sender_name = t('Hub Administrator');
    $sender_email = 'sys@' . App::get_hostname();
    $subject = $_REQUEST['subject'];
    $textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r", "\\n"), array("", "\n"), $text))), ENT_QUOTES, 'UTF-8'));
    $htmlversion = bbcode(stripslashes(str_replace(array("\\r", "\\n"), array("", "<br />\n"), $text)));
    $sql_extra = intval($_REQUEST['test']) ? sprintf(" and account_email = '%s' ", get_config('system', 'admin_email')) : '';
    $recips = q("select account_email from account where account_flags = %d {$sql_extra}", intval(ACCOUNT_OK));
    if (!$recips) {
        notice(t('No recipients found.') . EOL);
        return;
    }
    foreach ($recips as $recip) {
        \Zotlabs\Lib\Enotify::send(array('fromName' => $sender_name, 'fromEmail' => $sender_email, 'replyTo' => $sender_email, 'toEmail' => $recip['account_email'], 'messageSubject' => $subject, 'htmlVersion' => $htmlversion, 'textVersion' => $textversion));
    }
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:24,代码来源:hubwall.php


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