Beispiel #1
0
 public function __construct()
 {
     // Instantiate a Content object to detect the locale and do a 302 redirect if necessary
     $content = Content::getInstance();
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     switch ($page) {
         case 'disconnect':
             require_once 'php/ajax/AjaxDisconnect.php';
             new AjaxDisconnect();
             break;
         case 'introduce':
             require_once 'php/ajax/AjaxIntroduce.php';
             new AjaxIntroduce();
             break;
         case 'load-friends':
             require_once 'php/ajax/AjaxLoadFriends.php';
             new AjaxLoadFriends();
             break;
         case 'merge-accounts':
             require_once 'php/ajax/AjaxMergeAccounts.php';
             new AjaxMergeAccounts();
             break;
         case 'save-email':
             require_once 'php/ajax/AjaxSaveEmail.php';
             new AjaxSaveEmail();
             break;
         case 'send-message':
             require_once 'php/ajax/AjaxSendMessage.php';
             new AjaxSendMessage();
             break;
     }
 }
 public function sendEmail()
 {
     $email = str_replace('INTRODUCEE_NAME', $this->introducee->getName(), str_replace('OTHER_NAME', $this->other->getName(), str_replace('INTRODUCER_NAME', $this->userName, str_replace('LINK', $this->introductionUrl . '', Content::getInstance()->getEmail('email-introduction')))));
     $subject = str_replace('INTRODUCEE_NAME', $this->introducee->getName(), str_replace('INTRODUCER_NAME', $this->userName, Content::c()->introduce->email));
     // Send the email with AWS SES
     $ses = new SimpleEmailService(SES_KEY, SES_SECRET);
     $ses->enableVerifyHost(false);
     $ses->enableVerifyPeer(false);
     $m = new SimpleEmailServiceMessage();
     $m->addTo($this->introducee->getEmail());
     $m->setFrom(SES_FROM);
     $m->setSubject($subject);
     $m->setMessageFromString($subject . ' ' . $this->introductionUrl, $email);
     $result = $ses->sendEmail($m);
     if (!$result) {
         return false;
     }
     // Save the email result to the database
     $sth = $this->db->prepare('INSERT INTO aws_ses (recipient_id, ses_message_id, ses_request_id, introduction_id) VALUES (:recipient_id, :ses_message_id, :ses_request_id, :introduction_id)');
     $sth->execute(array(':recipient_id' => $this->introducee->getId(), ':ses_message_id' => $result['MessageId'], ':ses_request_id' => $result['RequestId'], ':introduction_id' => $this->introductionId));
     return true;
 }
 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();
 }
Beispiel #4
0
 public function __construct()
 {
     //error_log(print_r($_REQUEST,1));
     // Instantiate a Content object to detect the locale and do a 302 redirect if necessary
     $content = Content::getInstance();
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     switch ($page) {
         /* Login pages */
         case 'facebookcallback':
             require_once 'php/login/LoginFacebookCallback.php';
             new LoginFacebookCallback();
             break;
         case 'linkedin':
             require_once 'php/login/LoginLinkedIn.php';
             new LoginLinkedIn();
             break;
         case 'linkedincallback':
             require_once 'php/login/LoginLinkedInCallback.php';
             new LoginLinkedInCallback();
             break;
         case 'twitter':
             require_once 'php/login/LoginTwitter.php';
             new LoginTwitter();
             break;
         case 'twittercallback':
             require_once 'php/login/LoginTwitterCallback.php';
             new LoginTwitterCallback();
             break;
             /* Normal pages */
         /* Normal pages */
         case 'about':
             require_once 'php/pages/PageAbout.php';
             new PageAbout();
             break;
         case 'index':
             require_once 'php/pages/PageIndex.php';
             new PageIndex();
             break;
         case 'logout':
             require_once 'php/pages/PageLogout.php';
             new PageLogout();
             break;
         case 'merge-accounts':
             require_once 'php/pages/PageMergeAccounts.php';
             new PageMergeAccounts();
             break;
         case 'send-introduction':
             require_once 'php/pages/PageSendIntroduction.php';
             new PageSendIntroduction();
             break;
         case 'settings':
             require_once 'php/pages/PageSettings.php';
             new PageSettings();
             break;
         case 'view-introduction':
             require_once 'php/pages/PageViewIntroduction.php';
             new PageViewIntroduction();
             break;
         default:
             header('HTTP/1.0 404 Not Found');
     }
 }
Beispiel #5
0
 public static function getInstance($table = '_user_profile')
 {
     return parent::getInstance($table);
 }