Пример #1
0
    }
    if ($i == 10) {
        $i = 0;
    }
}
?>
								</select>
								<label for="postApp"><?php 
echo lang('FB_APP');
?>
</label>
								<select name='postApp' id="postApp" class="form-control">
									<option value=""></option>
									<?php 
if ($fb->AppsList()) {
    $selected = Input::Get('postApp') ? Input::Get('postApp') : $fbaccount->UserFbAccountDefaultApp();
    foreach ($fb->AppsList() as $app) {
        $select = $selected == $app->appid ? "selected" : "";
        if ($fb->getAccessToken($app->appid)) {
            echo "<option value='" . $app->appid . "' " . $select . ">" . $app->app_name . "</option>";
        }
    }
}
?>
								</select>
				 	</div>

				<div class="tab-pane" id="tab-fbAccounts">
					<h4 class="tab-title"><i class="fa fa-facebook"></i> <?php 
echo lang('FB_ACCOUNTS');
?>
Пример #2
0
if (!$fbaccount->UserDefaultFbAccount()) {
    Session::Flash("home", "warning", lang('NO_FB_ACCOUNT_AVAILABLE'), true);
}
$fbaccountDetails = $fbaccount->get($fbaccount->UserDefaultFbAccount());
if (Input::get('groupscategory')) {
    Session::put("groupscategory", (int) Input::get('groupscategory'));
}
if (Input::get('addCategory')) {
    if ($res = $fbaccount->addGroupCategory(Input::get('newCategoryName'))) {
        Session::Flash("home", "danger", $res, true);
    } else {
        Session::Flash("home", "success", lang('CATEGORY_ADDED_SUCCESSFULLY'), true);
    }
}
// Get default app
if (!$fbaccount->UserFbAccountDefaultApp()) {
    Session::Flash("home", "warning", lang('NO_APP_SELECTED'), true);
}
if (Input::get('removeGroup')) {
    try {
        $fbaccount->removeGroupFromCategory(Input::get('removeGroup'));
        Session::Flash("home", "success", lang('GROUP_RMOVED_SUCCESS'), true);
    } catch (Exeption $ex) {
        Session::Flash("home", "danger", $ex->getMessage(), true);
    }
    Redirect::to('index.php');
}
if (Input::get('deleteCategory')) {
    try {
        $fbaccount->deleteCategory(Input::get('deleteCategory'));
        Session::Flash("home", "success", lang('CATEGORY_DELETED_SUCCESS'), true);
Пример #3
0
    if ($fbAppDetails = $fb->AppDetailsFromAt(Input::Get("fb_accesstoken"))) {
        if ($fb->GetAccessToken($fbAppDetails->id, $userData->id)) {
            $fb->UpdateAccessToken($user->data()->id, $fbAppDetails->id, $userData->id, Input::Get("fb_accesstoken"));
        } else {
            $fb->SaveAccessToken($user->data()->id, $fbAppDetails->id, $userData->id, Input::Get("fb_accesstoken"));
        }
    } else {
        echo lang("UNABLE_TO_GET_FB_APP_DETAILS");
        exit;
    }
    // Save new facebook account
    $fbaccount->setUserId($user->data()->id);
    $fbaccount->setFbId($userData->id);
    $fbaccount->setLastname($userData->first_name);
    $fbaccount->setFirstname($userData->last_name);
    $fbaccount->setGroups($fbgroups);
    if (!$fbaccount->UserFbAccountDefaultApp()) {
        $fbaccount->setDefaultApp($fbAppDetails->id);
    }
    // Check if this facebook account is already exists;
    if ($fbaccount->exists($userData->id)) {
        $fbaccount->Update();
    } else {
        $fbaccount->Save();
    }
    // Set the current account as the default fb account if there is no default account
    if (!$fbaccount->UserDefaultFbAccount()) {
        $user->UpdateOptions(array('default_Fb_Account' => $userData->id));
    }
    echo "true";
}