예제 #1
0
 public function fbc_friend()
 {
     global $context, $fbuser, $Url, $FacebookId, $fb_hook_object, $friends, $scripturl, $fb_object, $curOffset;
     $context['sub_template'] = 'fbc_friends';
     $context['fb_do'] = 'friends';
     SAFacebookhooks::face_init();
     $facebook = new Facebook(array('appId' => $fb_hook_object->modSettings['fb_app_id'], 'secret' => $fb_hook_object->modSettings['fb_app_secret']));
     $Url = $facebook->getLoginUrl(array('redirect_uri' => $scripturl . '?action=facebook', 'scope' => 'email,publish_actions'));
     $fb_object->fbc_cons_pages('friends', 32);
     if (!$fb_hook_object->modSettings['fb_mode2']) {
         redirectexit();
     }
     $fbuser = $FacebookId;
     if ($fbuser) {
         //Try it!!!!!
         try {
             //These api calls can be slow so were only do it if needed
             if (empty($_SESSION['safbfriends'][$curOffset])) {
                 $_SESSION['safbfriends'][$curOffset] = $facebook->api('/me/friends?offset=' . $curOffset . '&limit=32');
             }
             $friends = $_SESSION['safbfriends'][$curOffset];
         } catch (FacebookApiException $e) {
             //Throw it!!!!!
             fatal_error($e, false);
         }
     }
 }
예제 #2
0
 protected function __construct()
 {
     global $facebook, $pic, $user;
     SAFacebookhooks::face_init();
     $this->facebook = $facebook;
     $this->user = $user['user_id'];
     $this->fb_pic = $pic;
 }
예제 #3
0
 protected function __construct()
 {
     global $FaceBookEmail, $FacebookName, $FaceBookUsername, $FaceBookUsername1, $FacebookId;
     SAFacebookhooks::face_init();
     $this->user_info_fbid = $FacebookId;
     $this->user_info_fbname = $FacebookName;
     $this->user_info_fbemail = $FaceBookEmail;
     $this->user_info_fbuname = $FaceBookUsername;
     $this->user_info_fbuname1 = $FaceBookUsername1;
     $this->subActions = array('main' => 'fb_main', 'connect' => 'fb_connect', 'auto' => 'fb_reg_auto', 'connectlog' => 'fb_log', 'syncc' => 'fb_sync', 'usyncc' => 'fb_usync', 'fbbp' => 'fb_bypass', 'logsync' => 'fb_logsync');
 }
예제 #4
0
function template_facebook_below()
{
    global $modSettings, $txt, $user_info, $scripturl, $board, $context;
    if (!empty($_GET['topic'])) {
        SAFacebookhooks::get_boardsfb('com_enable', $board);
    }
    if (!empty($modSettings['fb_app_enablecom']) && !empty($_GET['topic']) && !empty($_GET['action']) != 'post') {
        if (!empty($context['com_enable']) && $modSettings['fb_admin_commets_post_board'] >= 1) {
            $com_colour = empty($modSettings['comcolour']) ? 'light' : 'dark';
            $com_com = !empty($modSettings['fb_admin_commets_post_board']) ? $modSettings['fb_admin_commets_post_board'] : '0';
            $topiccom = isset($_GET['topic']) ? $_GET['topic'] : '';
            $turl = '' . $scripturl . '?topic=' . $context['current_topic'] . '.0';
            echo '<br />
            <div class="cat_bar">
	            <h3 class="catbg">
	                ' . $txt['fb_comments'] . '
	            </h3>
	        </div>

            <span class="upperframe"><span></span></span>
	            <div class="roundframe centertext">';
            SAFacebookhooks::call_facebook_hook('show_facebook_comments', array($turl, $com_com, '800', $com_colour, true));
            echo '
				</div>
	        <span class="lowerframe"><span></span></span>';
        }
    }
    if (!empty($_COOKIE['pwdone'])) {
        setcookie("pwdone", 0);
        SAFacebookhooks::face_init();
        global $FacebookName;
        $forum_name_body = strip_tags(htmlspecialchars($context['forum_name'], ENT_QUOTES));
        echo ' <script type="text/javascript">

	            function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
                    FB.ui(
                    {
                        method: \'stream.publish\',
                        message: \'\',
                            attachment: {
                                name: name,
                                caption: \'\',
                                description: (description),
                                href: hrefLink
                            },
                    action_links:[
                    {
			            text: hrefTitle,
				        href: hrefLink
			        }
                    ],
                       user_prompt_message: userPrompt
                    },
                    function(response) {

                    });
                }
	        function publishStream(){
                streamPublish("' . $forum_name_body . ' ", "' . $FacebookName . ' ' . $txt['fb_haslogged'] . ' ' . $forum_name_body . ' ' . $txt['fb_haslogged2'] . '", \'' . $forum_name_body . '\', "' . $scripturl . '");
            }


            window.onload = function()
            {
                publishStream();
                facebook_onload(true);
            };
        </script>';
    }
}
예제 #5
0
function template_fbconnect()
{
    global $txt, $scripturl, $fb_object, $FacebookName, $FaceBookUsername, $modSettings, $context;
    SAFacebookhooks::face_init();
    echo '<form action="', $scripturl, '?action=facebookintegrate;area=connect;register" method="post" accept-charset="', $context['character_set'], '" >';
    echo '
				<div class="cat_bar" align="center">
		              <h3 class="catbg">
		                ' . $txt['fb_reg'] . '
	                  </h3>
				   </div>
				<div class="information" align="center"><strong>' . $txt['fb_reg2'] . '</strong><br /><br />
	<strong><div class="error">' . $txt['fb_regallready1'] . '<a href="' . $scripturl . '?action=facebookintegrate;area=logsync"> ' . $txt['fb_regallready2'] . '</a> ' . $txt['fb_regallready3'] . '</div></strong></div>
	               <span class="upperframe"><span></span></span>
	            <div class="roundframe centertext"><div class="cat_bar">
		              <h3 class="catbg">
		                ' . $txt['fb_reg44'] . '
	                  </h3>
				   </div>';
    echo '<dl class="register_form" >
				<dt>
					<strong>' . $txt['fb_regname'] . '</strong>
				</dt>
				<dd>
					<input type="text" name="real_name" value="' . (!empty($FaceBookUsername) ? $FaceBookUsername : $FacebookName) . '" />
				</dd>
			</dl>';
    echo '<dl class="register_form" >
			   <dt>
					<strong>' . $txt['fb_regpass'] . '</strong>
			   </dt>
			   <dd>
					<input type="password" name="passwrd1" value="" />
			   </dd>
		   </dl>';
    echo '<dl class="register_form" >
			   <dt>
					<strong>' . $txt['fb_regpassv'] . '</strong>
			   </dt>
			   <dd>
					<input type="password" name="passwrd2" value="" />
			   </dd>
		   </dl>';
    if (!empty($modSettings['fb_app_enablecp'])) {
        if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) {
            echo '<div class="cat_bar">
		              <h3 class="catbg">
				' . $txt['fb_app_add_info'] . '
		</h3></div>';
            if (!empty($context['profile_fields'])) {
                foreach ($context['profile_fields'] as $key => $field) {
                    echo '<dl class="register_form">
						<dt>
							<strong', !empty($field['is_error']) ? ' style="color: red;"' : '', '>', $field['label'], '</strong>';
                    // Does it have any subtext to show?
                    if (!empty($field['subtext'])) {
                        echo '
							<span class="smalltext">', $field['subtext'], '</span>';
                    }
                    echo '
						</dt>
						<dd>';
                    // Want to put something infront of the box?
                    if (!empty($field['preinput'])) {
                        echo '
							', $field['preinput'];
                    }
                    // What type of data are we showing?
                    if ($field['type'] == 'label') {
                        echo '
							', $field['value'];
                    } elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) {
                        echo '
							<input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '" />';
                    } elseif ($field['type'] == 'check') {
                        echo '
							<input type="hidden" name="', $key, '" value="0" /><input type="checkbox" name="', $key, '" id="', $key, '" ', !empty($field['value']) ? ' checked="checked"' : '', ' value="1" tabindex="', $context['tabindex']++, '" class="input_check" ', $field['input_attr'], ' />';
                    } elseif ($field['type'] == 'select') {
                        echo '
							<select name="', $key, '" id="', $key, '" tabindex="', $context['tabindex']++, '">';
                        if (isset($field['options'])) {
                            // Is this some code to generate the options?
                            if (!is_array($field['options'])) {
                                $field['options'] = eval($field['options']);
                            }
                            // Assuming we now have some!
                            if (is_array($field['options'])) {
                                foreach ($field['options'] as $value => $name) {
                                    echo '
								<option value="', $value, '" ', $value == $field['value'] ? 'selected="selected"' : '', '>', $name, '</option>';
                                }
                            }
                        }
                        echo '
							</select>';
                    }
                    // Something to end with?
                    if (!empty($field['postinput'])) {
                        echo '
							', $field['postinput'];
                    }
                    echo '
						</dd></dl>';
                }
            }
            foreach ($context['custom_fields'] as $field) {
                echo '
			<dl class="register_form">
						<dt>
							<strong>', $field['name'], '</strong>
							<span class="smalltext">', $field['desc'], '</span>
						</dt>
						<dd>
							', $field['input_html'], '
						</dd>
					</dl>
						';
            }
        }
    }
    echo '<br /><input type="submit" name="submit" value="' . $txt['fb_regs'] . '" class="button_submit" />';
    echo '</div>
	          <span class="lowerframe"><span></span></span><input type="hidden" name="accept_agreement" value="1" /></form>';
    template_fbc_copy();
}