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


PHP is_site_admin函数代码示例

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


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

示例1: init

 function init()
 {
     load_theme_textdomain('p2', get_template_directory() . '/languages');
     add_filter('the_content', 'make_clickable');
     if (isset($_REQUEST['p2ajax'])) {
         require_once P2_INC_PATH . '/ajax.php';
         P2Ajax::dispatch();
         die;
     }
     if (function_exists('is_site_admin') && !is_site_admin()) {
         return;
     }
     $is_media_upload = isset($_REQUEST['p2-upload']);
     // don't redirect to https version when uploading files, since the domain may be different
     // and we don't have SSL certificates for blog domain, only for admin
     if ($is_media_upload && isset($GLOBALS['pagenow']) && 'media-upload.php' == $GLOBALS['pagenow']) {
         force_ssl_admin(is_ssl());
         add_filter('get_user_option_use_ssl', returner(false));
     }
     if ($is_media_upload) {
         add_filter('flash_uploader', returner(false));
         add_filter('auth_redirect_scheme', returner('logged_in'));
         add_filter('admin_url', array('P2', 'url_filter'));
         add_filter('includes_url', array('P2', 'url_filter'));
         add_filter('script_loader_src', array('P2', 'url_filter'));
         add_filter('wp_get_attachment_url', lambda('$url', 'str_replace(get_bloginfo("url")."/", site_url("/"), $url);'), 11);
         add_filter('media_upload_form_url', lambda('$url', 'add_query_arg( array( "p2-upload" => "true" ), $url );'));
     }
 }
开发者ID:alx,项目名称:pressmark,代码行数:29,代码来源:p2.php

示例2: fortunate_install

function fortunate_install()
{
    register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
    if (FORTUNATE_SERVER == 'hostname.com' && is_site_admin()) {
        notice('Fortunate plugin requires configuration. See README');
    }
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:7,代码来源:fortunate.php

示例3: bp_activity_template

 function bp_activity_template($type, $user_id, $per_page, $max, $timeframe)
 {
     global $bp;
     $this->pag_page = isset($_REQUEST['acpage']) ? intval($_REQUEST['acpage']) : 1;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     $this->filter_content = false;
     $this->activity_type = $type;
     if ($type == 'sitewide') {
         $this->activities = bp_activity_get_sitewide_activity($max, $this->pag_num, $this->pag_page);
     }
     if ($type == 'personal') {
         $this->activities = bp_activity_get_user_activity($user_id, $timeframe, $this->page_num, $this->pag_page);
     }
     if ($type == 'friends' && (bp_is_home() || is_site_admin() || $bp->loggedin_user->id == $user_id)) {
         $this->activities = bp_activity_get_friends_activity($user_id, $timeframe, $this->pag_num, $this->pag_page);
     }
     if (!$max) {
         $this->total_activity_count = (int) $this->activities['total'];
     } else {
         $this->total_activity_count = (int) $max;
     }
     $this->activities = $this->activities['activities'];
     if ($max) {
         if ($max >= count($this->activities)) {
             $this->activity_count = count($this->activities);
         } else {
             $this->activity_count = (int) $max;
         }
     } else {
         $this->activity_count = count($this->activities);
     }
     $this->full_name = $bp->displayed_user->fullname;
     $this->pag_links = paginate_links(array('base' => add_query_arg('acpage', '%#%'), 'format' => '', 'total' => ceil((int) $this->total_activity_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => '«', 'next_text' => '»', 'mid_size' => 1));
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:34,代码来源:bp-activity-templatetags.php

示例4: rendertime_page_end

function rendertime_page_end(&$a, &$o)
{
    $duration = microtime(true) - $a->performance["start"];
    if (is_site_admin() and $_GET["mode"] != "minimal" and !$a->is_mobile and !$a->is_tablet) {
        $o = $o . '<div class="renderinfo">' . sprintf(t("Performance: Database: %s, Network: %s, Rendering: %s, Parser: %s, I/O: %s, Other: %s, Total: %s"), round($a->performance["database"], 3), round($a->performance["network"], 3), round($a->performance["rendering"], 3), round($a->performance["parser"], 3), round($a->performance["file"], 3), round($duration - $a->performance["database"] - $a->performance["network"] - $a->performance["rendering"] - $a->performance["parser"] - $a->performance["file"], 3), round($duration, 3)) . "</div>";
    }
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:7,代码来源:rendertime.php

示例5: get

 function get()
 {
     $o .= '<h3>Probe Diagnostic</h3>';
     $o .= '<form action="probe" method="get">';
     $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] . '" />';
     $o .= '<input type="submit" name="submit" value="Submit" /></form>';
     $o .= '<br /><br />';
     if (x($_GET, 'addr')) {
         $channel = \App::get_channel();
         $addr = trim($_GET['addr']);
         $do_import = intval($_GET['import']) && is_site_admin() ? true : false;
         $j = \Zotlabs\Zot\Finger::run($addr, $channel, false);
         //			$res = zot_finger($addr,$channel,false);
         $o .= '<pre>';
         if (!$j['success']) {
             $o .= sprintf(t('Fetching URL returns error: %1$s'), $res['error'] . "\r\n\r\n");
             $o .= "<strong>https connection failed. Trying again with auto failover to http.</strong>\r\n\r\n";
             $j = \Zotlabs\Zot\Finger::run($addr, $channel, true);
             if (!$j['success']) {
                 $o .= sprintf(t('Fetching URL returns error: %1$s'), $res['error'] . "\r\n\r\n");
             }
         }
         if ($do_import && $j) {
             $x = import_xchan($j);
         }
         if ($j && $j['permissions'] && $j['permissions']['iv']) {
             $j['permissions'] = json_decode(crypto_unencapsulate($j['permissions'], $channel['channel_prvkey']), true);
         }
         $o .= str_replace("\n", '<br />', print_r($j, true));
         $o .= '</pre>';
     }
     return $o;
 }
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:33,代码来源:Probe.php

示例6: invite_content

function invite_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $tpl = get_markup_template('invite.tpl');
    $invonly = false;
    if (get_config('system', 'invitation_only')) {
        $invonly = true;
        $x = get_pconfig(local_user(), 'system', 'invites_remaining');
        if (!$x && !is_site_admin()) {
            notice(t('You have no more invitations available') . EOL);
            return '';
        }
    }
    $dirloc = get_config('system', 'directory_submit_url');
    if (strlen($dirloc)) {
        if ($a->config['register_policy'] == REGISTER_CLOSED) {
            $linktxt = sprintf(t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.'), dirname($dirloc) . '/siteinfo');
        } elseif ($a->config['register_policy'] != REGISTER_CLOSED) {
            $linktxt = sprintf(t('To accept this invitation, please visit and register at %s or any other public Friendica website.'), $a->get_baseurl()) . "\r\n" . "\r\n" . sprintf(t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.'), dirname($dirloc) . '/siteinfo');
        }
    } else {
        $o = t('Our apologies. This system is not currently configured to connect with other public sites or invite members.');
        return $o;
    }
    $o = replace_macros($tpl, array('$invite' => t('Send invitations'), '$addr_text' => t('Enter email addresses, one per line:'), '$msg_text' => t('Your message:'), '$default_message' => t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n" . $linktxt . "\r\n" . "\r\n" . ($invonly ? t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') . t('Once you have registered, please connect with me via my profile page at:') . "\r\n" . "\r\n" . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . "\r\n" . "\r\n" . t('For more information about the Friendica project and why we feel it is important, please visit http://friendica.com') . "\r\n" . "\r\n", '$submit' => t('Submit')));
    return $o;
}
开发者ID:robhell,项目名称:friendica,代码行数:30,代码来源:invite.php

示例7: get

 /**
  * @return string
  */
 function get()
 {
     logger('admin_content', LOGGER_DEBUG);
     if (!is_site_admin()) {
         return login(false);
     }
     /*
      * Page content
      */
     $o = '';
     if (argc() > 1) {
         $o = $this->sm->call('get');
         if ($o === false) {
             notice(t('Item not found.'));
         }
     } else {
         $o = $this->admin_page_summary();
     }
     if (is_ajax()) {
         echo $o;
         killme();
         return '';
     } else {
         return $o;
     }
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:29,代码来源:Admin.php

示例8: regmod_content

function regmod_content(&$a)
{
    global $lang;
    $_SESSION['return_url'] = $a->cmd;
    if (!local_user()) {
        info(t('Please login.') . EOL);
        $o .= '<br /><br />' . login($a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
        return $o;
    }
    if (!is_site_admin() || x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    if ($a->argc != 3) {
        killme();
    }
    $cmd = $a->argv[1];
    $hash = $a->argv[2];
    if ($cmd === 'deny') {
        user_deny($hash);
        goaway($a->get_baseurl() . "/admin/users/");
        killme();
    }
    if ($cmd === 'allow') {
        user_allow($hash);
        goaway($a->get_baseurl() . "/admin/users/");
        killme();
    }
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:29,代码来源:regmod.php

示例9: regmod_content

function regmod_content(&$a)
{
    global $lang;
    $_SESSION['return_url'] = $a->cmd;
    if (!local_user()) {
        info(t('Please login.') . EOL);
        $o .= '<br /><br />' . login($a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
        return $o;
    }
    if (!is_site_admin()) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    if ($a->argc != 3) {
        killme();
    }
    $cmd = $a->argv[1];
    $hash = $a->argv[2];
    if ($cmd === 'deny') {
        if (!user_deny($hash)) {
            killme();
        }
    }
    if ($cmd === 'allow') {
        if (!user_allow($hash)) {
            killme();
        }
    }
}
开发者ID:nextgensh,项目名称:friendica,代码行数:29,代码来源:regmod.php

示例10: admin_content

/**
 * @param App &$a
 * @return string
 */
function admin_content(&$a)
{
    logger('admin_content', LOGGER_DEBUG);
    if (!is_site_admin()) {
        return login(false);
    }
    /*
     * Page content
     */
    $o = '';
    // urls
    if (argc() > 1) {
        switch (argv(1)) {
            case 'site':
                $o = admin_page_site($a);
                break;
            case 'users':
                $o = admin_page_users($a);
                break;
            case 'channels':
                $o = admin_page_channels($a);
                break;
            case 'plugins':
                $o = admin_page_plugins($a);
                break;
            case 'themes':
                $o = admin_page_themes($a);
                break;
                //			case 'hubloc':
                //				$o = admin_page_hubloc($a);
                //				break;
            //			case 'hubloc':
            //				$o = admin_page_hubloc($a);
            //				break;
            case 'logs':
                $o = admin_page_logs($a);
                break;
            case 'dbsync':
                $o = admin_page_dbsync($a);
                break;
            case 'profs':
                $o = admin_page_profs($a);
                break;
            case 'queue':
                $o = admin_page_queue($a);
                break;
            default:
                notice(t('Item not found.'));
        }
    } else {
        $o = admin_page_summary($a);
    }
    if (is_ajax()) {
        echo $o;
        killme();
        return '';
    } else {
        return $o;
    }
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:64,代码来源:admin.php

示例11: tehnik_filter_buddypress_activities

function tehnik_filter_buddypress_activities($a, $activities)
{
    //if admin we want to know
    if (is_site_admin()) {
        return $activities;
    }
    foreach ($activities->activities as $key => $activity) {
        //new_member is the type name (component is 'profile')
        if ($activity->type == 'bbp_topic_create' || $activity->type == 'bbp_reply_create') {
            $post_id = $activity->secondary_item_id;
            if ($activity->type == 'bbp_reply_create') {
                $post_id = bbp_get_topic_forum_id($post_id);
            }
            if (!tehnik_bpp_can_user_view_post_id($post_id)) {
                unset($activities->activities[$key]);
                $activities->activity_count = $activities->activity_count - 1;
                $activities->total_activity_count = $activities->total_activity_count - 1;
                $activities->pag_num = $activities->pag_num - 1;
            }
        }
    }
    /* Renumber the array keys to account for missing items */
    $activities_new = array_values($activities->activities);
    $activities->activities = $activities_new;
    return $activities;
}
开发者ID:dnaleor,项目名称:Tehnik-bbPress-Permissions,代码行数:26,代码来源:tehnik_bpp_buddypress.php

示例12: regmod_content

function regmod_content(&$a)
{
    global $lang;
    $_SESSION['return_url'] = App::$cmd;
    if (!local_channel()) {
        info(t('Please login.') . EOL);
        $o .= '<br /><br />' . login(App::$config['system']['register_policy'] == REGISTER_CLOSED ? 0 : 1);
        return $o;
    }
    if (!is_site_admin()) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    if (argc() != 3) {
        killme();
    }
    $cmd = argv(1);
    $hash = argv(2);
    if ($cmd === 'deny') {
        if (!account_deny($hash)) {
            killme();
        }
    }
    if ($cmd === 'allow') {
        if (!account_allow($hash)) {
            killme();
        }
    }
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:29,代码来源:regmod.php

示例13: change_channel

/**
 * @brief Change to another channel with current logged-in account.
 *
 * @param int $change_channel The channel_id of the channel you want to change to
 *
 * @return bool|array false or channel record of the new channel
 */
function change_channel($change_channel)
{
    $ret = false;
    if ($change_channel) {
        $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_account_id = %d and not ( channel_pageflags & %d)>0 limit 1", intval($change_channel), intval(get_account_id()), intval(PAGE_REMOVED));
        // It's not there.  Is this an administrator, and is this the sys channel?
        if (is_developer()) {
            if (!$r) {
                if (is_site_admin()) {
                    $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and ( channel_pageflags & %d) and not (channel_pageflags & %d )>0 limit 1", intval($change_channel), intval(PAGE_SYSTEM), intval(PAGE_REMOVED));
                }
            }
        }
        if ($r) {
            $hash = $r[0]['channel_hash'];
            $_SESSION['uid'] = intval($r[0]['channel_id']);
            get_app()->set_channel($r[0]);
            $_SESSION['theme'] = $r[0]['channel_theme'];
            $_SESSION['mobile_theme'] = get_pconfig(local_channel(), 'system', 'mobile_theme');
            date_default_timezone_set($r[0]['channel_timezone']);
            $ret = $r[0];
        }
        $x = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($hash));
        if ($x) {
            $_SESSION['my_url'] = $x[0]['xchan_url'];
            $_SESSION['my_address'] = $r[0]['channel_address'] . '@' . substr(get_app()->get_baseurl(), strpos(get_app()->get_baseurl(), '://') + 3);
            get_app()->set_observer($x[0]);
            get_app()->set_perms(get_all_perms(local_channel(), $hash));
        }
        if (!is_dir('store/' . $r[0]['channel_address'])) {
            @os_mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS, true);
        }
    }
    return $ret;
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:42,代码来源:security.php

示例14: rendertime_page_end

function rendertime_page_end(&$a, &$o)
{
    $duration = microtime(true) - $a->performance["start"];
    if (is_site_admin() and $_GET["mode"] != "minimal" and !$a->is_mobile and !$a->is_tablet) {
        $o = $o . '<div class="renderinfo">' . sprintf(t("Performance: Database: %s, Network: %s, Rendering: %s, Parser: %s, I/O: %s, Other: %s, Total: %s"), round($a->performance["database"], 3), round($a->performance["network"], 3), round($a->performance["rendering"], 3), round($a->performance["parser"], 3), round($a->performance["file"], 3), round($duration - $a->performance["database"] - $a->performance["network"] - $a->performance["rendering"] - $a->performance["parser"] - $a->performance["file"], 3), round($duration, 3)) . "</div>";
        if (get_config("rendertime", "callstack")) {
            $o .= "<pre>";
            $o .= "\nDatabase:\n";
            foreach ($a->callstack["database"] as $func => $time) {
                $time = round($time, 3);
                if ($time > 0) {
                    $o .= $func . ": " . $time . "\n";
                }
            }
            $o .= "\nNetwork:\n";
            foreach ($a->callstack["network"] as $func => $time) {
                $time = round($time, 3);
                if ($time > 0) {
                    $o .= $func . ": " . $time . "\n";
                }
            }
            $o .= "</pre>";
        }
    }
}
开发者ID:shtrom,项目名称:friendica-addons,代码行数:25,代码来源:rendertime.php

示例15: regmod_content

function regmod_content(&$a)
{
    global $lang;
    $_SESSION['return_url'] = $a->cmd;
    if (!local_user()) {
        info(t('Please login.') . EOL);
        $o .= '<br /><br />' . login($a->config['system']['register_policy'] == REGISTER_CLOSED ? 0 : 1);
        return $o;
    }
    if (!is_site_admin() || x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    if (argc() != 3) {
        killme();
    }
    $cmd = argv(1);
    $hash = argv(2);
    if ($cmd === 'deny') {
        if (!user_deny($hash)) {
            killme();
        }
    }
    if ($cmd === 'allow') {
        if (!user_allow($hash)) {
            killme();
        }
    }
}
开发者ID:Mauru,项目名称:red,代码行数:29,代码来源:regmod.php


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