示例#1
0
function twitter_loadTheme()
{
    global $modSettings, $context, $user_info;
    loadLanguage('Twitter');
    twit_load();
    if (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (isset($_REQUEST['action']) || in_array(isset($_REQUEST['action']), array('twitter')))) {
        $modSettings['allow_guestAccess'] = 1;
    }
    if (isset($_SESSION['twuserid']) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'login' && !empty($modSettings['tw_app_enabledauto'])) {
        $context['member_id'] = twit_USettings($_SESSION['twuserid'], 'id_member', 'twitid');
        if (!empty($context['member_id'])) {
            redirectexit('action=twitter;area=connectlog');
        }
    }
    if (!isset($_REQUEST['xml'])) {
        $layers = $context['template_layers'];
        $context['template_layers'] = array();
        foreach ($layers as $layer) {
            $context['template_layers'][] = $layer;
            if ($layer == 'body') {
                $context['template_layers'][] = 'twitter';
            }
        }
    }
    if (!empty($modSettings['tw_app_enabledanyhere'])) {
        $consumer_key = !empty($modSettings['tw_app_id']) ? $modSettings['tw_app_id'] : '';
        $context['html_headers'] .= '
	    <script src="http://platform.twitter.com/anywhere.js?id=' . $consumer_key . '&v=1" type="text/javascript"></script>';
        if (!empty($modSettings['tw_app_enabledanyheretype'])) {
            $context['html_headers'] .= '
			<script type="text/javascript">
                twttr.anywhere(function (T) {

                    T(".section").linkifyUsers({
                        username: function(node) {
                            return node.alt;
                        }
                    });
                });

                twttr.anywhere(function(twitter) {
                    twitter.linkifyUsers();
                });
            </script>';
        } else {
            $context['html_headers'] .= '
		    <script type="text/javascript">
                twttr.anywhere(function (T) {

                    T(".section").hovercards({
                        username: function(node) {
                            return node.alt;
                        }
                    });
                });

                twttr.anywhere(function(twitter) {
                    twitter.hovercards();
                });
            </script>';
        }
    }
}
示例#2
0
function gplus_loadTheme()
{
    global $modSettings, $user_info, $context;
    loadLanguage('GPlus');
    if (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (isset($_REQUEST['action']) || in_array(isset($_REQUEST['action']), array('gplus')))) {
        $modSettings['allow_guestAccess'] = 1;
    }
    if (isset($_SESSION['gplus']['idm']) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'login' && !empty($modSettings['gp_app_enabledautolog'])) {
        $context['gplus_id'] = twit_USettings($_SESSION['gplus']['idm'], 'id_member', 'gpid');
        if (!empty($context['gplus_id'])) {
            redirectexit('action=gplus;area=connectlog');
        }
    }
    if (!isset($_REQUEST['xml'])) {
        $layers = $context['template_layers'];
        $context['template_layers'] = array();
        foreach ($layers as $layer) {
            $context['template_layers'][] = $layer;
            if ($layer == 'body' || $layer == 'main') {
                $context['template_layers'][] = 'gplus';
            }
        }
    }
}