public function __construct()
 {
     $top = new Top('', 'aboutPage');
     echo $top->getOutput();
     echo Content::c()->about->desc;
     $bottom = new Bottom('');
     echo $bottom->getOutput();
 }
 public function __construct()
 {
     session_start();
     // Connect to the database
     $this->db = Database::getInstance();
     // Get the website user
     $this->userId = SessionManager::getInstance()->getUserId();
     if (empty($this->userId)) {
         Debug::l('No user logged in');
         header('Location: ' . Content::getInstance()->getRootUrl());
         exit;
     }
     $userDetailsQ = $this->db->prepare('SELECT p.email, f.id as facebook_id, f.access_token as facebook_access_token, l.id as linkedin_id, l.access_token as linkedin_access_token, t.id as twitter_id, t.access_token as twitter_access_token FROM person p LEFT JOIN facebook f ON p.id = f.person_id LEFT JOIN linkedin l ON p.id = l.person_id LEFT JOIN twitter t ON p.id = t.person_id WHERE p.id = :id');
     $userDetailsQ->execute(array(':id' => $this->userId));
     $this->userDetails = $userDetailsQ->fetch(PDO::FETCH_ASSOC);
     $top = new Top('', 'settingsPage');
     echo $top->getOutput();
     echo '<h1>' . Content::c()->settings->title . '</h1>' . '<h2>' . Content::c()->settings->profiles . '</h2>' . $this->showConnectedProfiles() . '<h2>' . Content::c()->settings->email . '</h2>' . '<form id="formEmail" class="clearfix">' . '<input type="email" name="email" id="email" value="' . $this->userDetails['email'] . '" placeholder="' . Content::c()->view->email_request->placeholder . '" />' . '<input id="submitEmail" class="button" type="submit" value="' . Content::c()->settings->submit . '" />' . '</form>' . '';
     $script = '<script>' . 'var introduceme = (function (module) {' . 'module.content = module.content || {};' . 'module.content.success = "' . Content::c()->settings->success . '";' . 'module.content.saved = "' . Content::c()->settings->saved . '";' . 'return module;' . '}(introduceme || {}));' . '</script>';
     $bottom = new Bottom($script);
     echo $bottom->getOutput();
 }
 public function __construct()
 {
     session_start();
     $this->db = Database::getInstance();
     if (empty($_SESSION['mergeOtherAccount']) || empty($_SESSION['mergeNetwork'])) {
         Debug::l('Error merging account: missing session vars');
         header('Location: ' . APP_URL . '/' . Content::l() . '/');
         exit;
     }
     $this->mergeNetwork = $_SESSION['mergeNetwork'];
     $mergeOtherAccount = $_SESSION['mergeOtherAccount'];
     // Get the website user
     $userId = SessionManager::getInstance()->getUserId();
     if (!isset($userId)) {
         // No user logged in
         Debug::l('No user logged in');
         header('Location: ' . APP_URL . '/' . Content::l() . '/');
         exit;
     }
     // Load user data
     $userDetailsQ = $this->db->prepare('SELECT f.id as facebook_id, f.access_token as facebook_access_token, l.id as linkedin_id, l.access_token as linkedin_access_token, t.id as twitter_id, t.access_token as twitter_access_token FROM person p LEFT JOIN facebook f ON p.id = f.person_id LEFT JOIN linkedin l ON p.id = l.person_id LEFT JOIN twitter t ON p.id = t.person_id WHERE p.id = :id');
     $userDetailsQ->execute(array(':id' => $userId));
     $userDetails = $userDetailsQ->fetch(PDO::FETCH_ASSOC);
     $profiles = $this->loadProfiles($userDetails, true);
     // Load data for other account
     $userDetailsQ->execute(array(':id' => $mergeOtherAccount));
     $otherAccount = $userDetailsQ->fetch(PDO::FETCH_ASSOC);
     array_merge($profiles, $this->loadProfiles($otherAccount, false));
     $top = new Top('', 'mergeAccountsPage');
     echo $top->getOutput();
     echo '<h1>' . str_replace('SOCIAL_NETWORK_NAME', $this->mergeNetwork, Content::c()->merge_accounts->notice) . '</h1>' . '<p class="question">' . (count($profiles) == 2 ? Content::c()->merge_accounts->question_two_profiles : Content::c()->merge_accounts->question_more_profiles) . '</p>';
     foreach ($profiles as $profile) {
         echo $profile;
     }
     echo '<form action="/' . Content::l() . '/logout/" method="post" class="no">' . '<input type="submit" class="button" value="' . Content::c()->merge_accounts->n . '" />' . '</form>' . '<form action="/' . Content::l() . '/ajax/merge-accounts/" method="post" class="yes">' . '<input type="submit" class="button" value="' . Content::c()->merge_accounts->y . '" />' . '</form>' . '<p class="note">' . Content::c()->merge_accounts->note . '</p>';
     $bottom = new Bottom('');
     echo $bottom->getOutput();
 }
 public function __construct()
 {
     session_start();
     // Connect to the database
     $this->db = Database::getInstance();
     // Get the website user
     $this->userId = SessionManager::getInstance()->getUserId();
     if (!empty($this->userId)) {
         $userDetailsQ = $this->db->prepare('SELECT f.id as facebook_id, f.access_token as facebook_access_token, l.id as linkedin_id, l.access_token as linkedin_access_token, t.id as twitter_id, t.access_token as twitter_access_token FROM person p LEFT JOIN facebook f ON p.id = f.person_id LEFT JOIN linkedin l ON p.id = l.person_id LEFT JOIN twitter t ON p.id = t.person_id WHERE p.id = :id');
         $userDetailsQ->execute(array(':id' => $this->userId));
         $this->userDetails = $userDetailsQ->fetch(PDO::FETCH_ASSOC);
     }
     $this->facebookLoginUrl = SessionManager::getInstance()->getFacebook()->getLoginUrl(array('redirect_uri' => APP_URL . '/' . Content::l() . '/login/facebookcallback/', 'scope' => 'publish_stream, offline_access'));
     $top = new Top('', 'homePage');
     echo $top->getOutput();
     echo '<div id="preloaderFriends" style="display: none;">' . Content::c()->home->loading . '</div>' . '<div id="info">' . '<p>' . Content::c()->home->desc . '</p>' . '</div>' . '<div id="formLogin" class="clearfix">' . '<p>' . Content::c()->introduce->login . '</p>' . '<a href="' . $this->facebookLoginUrl . '" id="loginFacebook" class="ir' . (!empty($this->userDetails['facebook_access_token']) ? ' loggedIn' : '') . '">Facebook</a>' . '<a href="/' . Content::l() . '/login/linkedin/" id="loginLinkedIn" class="ir' . (!empty($this->userDetails['linkedin_access_token']) ? ' loggedIn' : '') . '">LinkedIn</a>' . '<a href="/' . Content::l() . '/login/twitter/" id="loginTwitter" class="ir' . (!empty($this->userDetails['twitter_access_token']) ? ' loggedIn' : '') . '">Twitter</a>' . '<p id="loginFirst">' . Content::c()->introduce->login_here_first . '</p>' . '</div>' . '<form id="formIntroduce" class="clearfix" novalidate="novalidate" autocomplete="off">' . '<div class="friendSelector introduceeInput1">' . '<label for="introducee1">' . Content::c()->introduce->introduce . '</label>' . '<input type="text" id="introducee1" placeholder="' . Content::c()->introduce->enter_name . '" />' . '<ul class="filteredFriends"></ul>' . '</div>' . '<div class="friendSelector introduceeInput2">' . '<label for="introducee2">' . Content::c()->introduce->with . '</label>' . '<input type="text" id="introducee2" placeholder="' . Content::c()->introduce->enter_name . '" />' . '<ul class="filteredFriends"></ul>' . '</div>' . '<label for="message">' . Content::c()->introduce->why . '</label>' . '<textarea id="message" placeholder="' . Content::c()->introduce->message . '"></textarea>' . '<input id="submitIntroduce" class="button" type="submit" value="' . Content::c()->introduce->submit . '" />' . '<a href="/' . Content::l() . '/about/" class="help">' . Content::c()->introduce->help . '</a>' . '</form>';
     if (!empty($this->userId)) {
         echo $this->previousIntroductions();
     }
     $script = '<script>' . 'var introduceme = (function (module) {' . 'module.content = module.content || {};' . 'module.content.loginFirst = "' . Content::c()->introduce->login_first . '";' . 'module.personId = ' . (!empty($this->userId) ? '"' . $this->userId . '"' : 'null') . ';' . 'module.facebookId = ' . (!empty($this->userDetails['facebook_access_token']) ? '"' . $this->userDetails['facebook_id'] . '"' : 'null') . ';' . 'module.linkedInId = ' . (!empty($this->userDetails['linkedin_access_token']) ? '"' . $this->userDetails['linkedin_id'] . '"' : 'null') . ';' . 'module.twitterId = ' . (!empty($this->userDetails['twitter_access_token']) ? '"' . $this->userDetails['twitter_id'] . '"' : 'null') . ';' . 'return module;' . '}(introduceme || {}));' . '</script>';
     $bottom = new Bottom($script);
     echo $bottom->getOutput();
 }
 private function output($value)
 {
     $top = new Top('', 'sendIntroductionPage');
     echo $top->getOutput();
     echo '<div class="sendIntroduction">' . $value . '</div>';
     $bottom = new Bottom('');
     echo $bottom->getOutput();
 }
 public function top()
 {
     $top = new Top('', 'viewIntroductionPage');
     return $top->getOutput();
 }