<?php

session_start();
include_once "config.php";
include_once "class.fblinkedtwit.php";
$fblinkedtwit = new FbLinkedTwit();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
  <head>
    <title>Facebook, Twitter & Linkedin Status Update Application</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript">
        var baseUrl =   "<?php 
echo $config['base_url'];
?>
";
    </script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
    <script type="text/javascript" src="javascript.js"></script>
  </head>
  <body>
      <h2>Facebook, Twitter & Linkedin Status Update</h2>
      <div style="float: left; margin-right: 10px">
      <table border="0" cellspacing="3" cellpadding="3">
          <tr style="background-color: #e6e1e1">
              <td>
                  <div id="login">
                    <fb:login-button v="2" size="large" length="long" onlogin="******"></fb:login-button>
                  </div>
                  <div id="logout" style="display: none">
<?php

session_start();
include_once "config.php";
include_once "class.fblinkedtwit.php";
$fblinkedtwit = new FbLinkedTwit();
$status = isset($_REQUEST['status']) ? $_REQUEST['status'] : '';
if (!empty($status)) {
    $status = substr($status, 0, 144);
    //facebook status update
    $fblinkedtwit->facebookStatusUpdate($status);
    //twitter status update
    if (isset($_SESSION['twit_oauth_access_token']) && isset($_SESSION['twit_oauth_access_token_secret'])) {
        $fblinkedtwit->twitterStatusUpdate($status, $_SESSION['twit_oauth_access_token'], $_SESSION['twit_oauth_access_token_secret']);
    }
    //linkedin status update
    if (isset($_SESSION['requestToken']) && isset($_SESSION['oauth_verifier']) && isset($_SESSION['oauth_access_token'])) {
        $fblinkedtwit->linkedinStatusUpdate($status, $_SESSION['requestToken'], $_SESSION['oauth_verifier'], $_SESSION['oauth_access_token']);
    }
}