public function __construct()
 {
     parent::__construct();
     $sTable = $this->registry->module == 'user' ? 'Members' : 'Affiliates';
     $sSessPrefix = $this->registry->module == 'user' ? 'member' : 'affiliate';
     if ((new UserCoreModel())->login($this->session->get($sSessPrefix . '_email'), $this->httpRequest->post('password'), $sTable) === 'password_does_not_exist') {
         \PFBC\Form::setError('form_delete_account', t('Oops! This password you entered is incorrect.'));
     } else {
         $sUsername = $this->session->get($sSessPrefix . '_username');
         $sMembershipType = $this->registry->module == 'affiliate' ? t('Affiliate') : t('Member');
         $this->view->membership = t('Type of Membership: %0%.', $sMembershipType);
         $this->view->message = nl2br($this->httpRequest->post('message'));
         $this->view->why_delete = t('Due to the deletion of the account: %0%', $this->httpRequest->post('why_delete'));
         $this->view->footer_title = t('Information of the user who has deleted their account');
         $this->view->email = t('Email: %0%', $this->session->get($sSessPrefix . '_email'));
         $this->view->username = t('Username: %0%', $sUsername);
         $this->view->first_name = t('First Name: %0%', $this->session->get($sSessPrefix . '_first_name'));
         $this->view->sex = t('Sex: %0%', $this->session->get($sSessPrefix . '_sex'));
         $this->view->ip = t('User IP: %0%', $this->session->get($sSessPrefix . '_ip'));
         $this->view->browser_info = t('Browser info: %0%', $this->session->get($sSessPrefix . '_http_user_agent'));
         $sMessageHtml = $this->view->parseMail(PH7_PATH_SYS . 'global/' . PH7_VIEWS . PH7_TPL_NAME . '/mail/sys/core/delete_account.tpl', DbConfig::getSetting('adminEmail'));
         $sMembershipName = $this->registry->module == 'user' ? t('Member') : t('Affiliate');
         $aInfo = ['subject' => t('Unregister %0% - User: %1%', $sMembershipName, $sUsername)];
         (new Mail())->send($aInfo, $sMessageHtml);
         $oUserModel = $this->registry->module == 'user' ? new UserCore() : new AffiliateCore();
         $oUserModel->delete($this->session->get($sSessPrefix . '_id'), $sUsername);
         unset($oUserModel);
         $this->session->destroy();
         Header::redirect(Uri::get('user', 'main', 'soon'), t('You delete account is successfully!'));
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->iMin = DbConfig::getSetting('minAgeRegistration');
     $this->iMax = DbConfig::getSetting('maxAgeRegistration');
     $this->message = t('You must be %0% to %1% years to register on the site.', $this->iMin, $this->iMax);
 }
 /**
  * Send an email with Swift library engine.
  *
  * @param array $aInfo
  * @param string $sContents
  * @param boolean $bHtmlFormat Default TRUE
  * @return integer Number of recipients who were accepted for delivery.
  */
 public function send(array $aInfo, $sContents, $bHtmlFormat = true)
 {
     // Default values
     $sFromMail = empty($aInfo['from']) ? DbConfig::getSetting('returnEmail') : $aInfo['from'];
     // Email noreply (generally noreply@yoursite.com)
     $sFromName = empty($aInfo['form_name']) ? DbConfig::getSetting('emailName') : $aInfo['form_name'];
     $sToMail = empty($aInfo['to']) ? DbConfig::getSetting('adminEmail') : $aInfo['to'];
     $sToName = empty($aInfo['to_name']) ? $sToMail : $aInfo['to_name'];
     $sSubject = $aInfo['subject'];
     // Setup the mailer
     $oTransport = \Swift_MailTransport::newInstance();
     $oMailer = \Swift_Mailer::newInstance($oTransport);
     $oMessage = \Swift_Message::newInstance()->setSubject(escape($sSubject, true))->setFrom(array(escape($sFromMail, true) => escape($sFromName, true)))->setTo(array(escape($sToMail, true) => escape($sToName, true)));
     $bHtmlFormat ? $oMessage->addPart($sContents, 'text/html') : $oMessage->setBody($sContents);
     $iResult = $oMailer->send($oMessage);
     unset($oTransport, $oMailer, $oMessage);
     /*
      * Check if Swift is able to send message, otherwise we use the traditional native PHP mail() function
      * as on some hosts config, Swift Mail doesn't work.
      */
     if (!$iResult) {
         $aData = ['from' => $sFromMail, 'to' => $sToMail, 'subject' => $sSubject, 'body' => $sContents];
         $iResult = (int) $this->phpMail($aData);
     }
     return $iResult;
 }
 public function createAccount()
 {
     if ($this->oRest->getRequestMethod() != 'POST') {
         $this->oRest->response('', 406);
     } else {
         $aReqs = $this->oRest->getRequest();
         // Set the User Setting variables
         $iMinUsr = DbConfig::getSetting('minUsernameLength');
         $iMaxUsr = DbConfig::getSetting('maxUsernameLength');
         $iMinPwd = DbConfig::getSetting('minPasswordLength');
         $iMaxPwd = DbConfig::getSetting('maxPasswordLength');
         $iMinAge = DbConfig::getSetting('minAgeRegistration');
         $iMaxAge = DbConfig::getSetting('maxAgeRegistration');
         if (empty($aReqs['email']) || empty($aReqs['username']) || empty($aReqs['password']) || empty($aReqs['first_name']) || empty($aReqs['last_name']) || empty($aReqs['sex']) || empty($aReqs['match_sex']) || empty($aReqs['birth_date']) || empty($aReqs['country']) || empty($aReqs['city']) || empty($aReqs['state']) || empty($aReqs['zip_code']) || empty($aReqs['description'])) {
             $this->oRest->response($this->set(array('status' => 'failed', 'msg' => t('One or several profile fields are empty.'))), 400);
         } elseif (!$this->oValidate->email($aReqs['email'])) {
             $this->oRest->response($this->set(array('status' => 'form_error', 'msg' => t('The Email is not valid.'))), 400);
         } elseif (!$this->oValidate->username($aReqs['username'], $iMinUsr, $iMaxUsr)) {
             $this->oRest->response($this->set(array('status' => 'form_error', 'msg' => t('The Username must contain from %0% to %1% characters, the Username is not available or it is already used by other member.', $iMinUsr, $iMaxUsr))), 400);
         } elseif (!$this->oValidate->password($aReqs['password'], $iMinPwd, $iMaxPwd)) {
             $this->oRest->response($this->set(array('status' => 'form_error', 'msg' => t('The Password must contain from %0% to %1% characters.', $iMinPwd, $iMaxPwd))), 400);
         } elseif (!$this->oValidate->birthDate($aReqs['birth_date'], $iMinAge, $iMaxAge)) {
             $this->oRest->response($this->set(array('status' => 'form_error', 'msg' => t('You must be %0% to %1% years to register on the site.', $iMinAge, $iMinAge))), 400);
         } else {
             $aData = ['email' => $aReqs['email'], 'username' => $aReqs['username'], 'password' => $aReqs['password'], 'first_name' => $aReqs['first_name'], 'last_name' => $aReqs['last_name'], 'sex' => $aReqs['sex'], 'match_sex' => is_array($aReqs['match_sex']) ?: array($aReqs['match_sex']), 'birth_date' => $this->dateTime->get($aReqs['birth_date'])->date('Y-m-d'), 'country' => $aReqs['country'], 'city' => $aReqs['city'], 'state' => $aReqs['state'], 'zip_code' => $aReqs['zip_code'], 'description' => $aReqs['description'], 'ip' => Framework\Ip\Ip::get()];
             // Add 'profile_id' key into the array
             $aData['profile_id'] = $this->oUserModel->add($aData);
             // Displays the new user info and his ID
             $this->oRest->response($this->set($aData));
         }
     }
 }
 public static function display()
 {
     if (isset($_POST['submit_msg'])) {
         if (\PFBC\Form::isValid($_POST['submit_msg'])) {
             new MsgFormProcess();
         }
         Framework\Url\Header::redirect();
     }
     $oForumsId = (new ForumModel())->getForum();
     $aForumsName = array();
     foreach ($oForumsId as $oId) {
         $aForumsName[$oId->forumId] = $oId->name;
     }
     $sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern'];
     $oForm = new \PFBC\Form('form_msg', '100%');
     $oForm->configure(array('action' => ''));
     $oForm->addElement(new \PFBC\Element\Hidden('submit_msg', 'form_msg'));
     $oForm->addElement(new \PFBC\Element\Token('msg'));
     $oForm->addElement(new \PFBC\Element\Select(t('Forum:'), 'forum', $aForumsName, array('value' => (new Http())->get('forum_id'))));
     $oForm->addElement(new \PFBC\Element\Textbox(t('Subject:'), 'title', array('id' => 'str_title', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern))));
     $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_title"></span>'));
     $oForm->addElement(new \PFBC\Element\CKEditor(t('Message:'), 'message', array('required' => 1, 'validation' => new \PFBC\Validation\Str(4))));
     if (DbConfig::getSetting('isCaptchaForum')) {
         $oForm->addElement(new \PFBC\Element\CCaptcha(t('Captcha:'), 'captcha', array('id' => 'ccaptcha', 'onkeyup' => 'CValid(this.value, this.id)', 'description' => t('Enter the code above:'))));
         $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error ccaptcha"></span>'));
     }
     $oForm->addElement(new \PFBC\Element\Button());
     $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>'));
     $oForm->render();
 }
 public function __construct()
 {
     parent::__construct();
     $this->iMin = DbConfig::getSetting('minPasswordLength');
     $this->iMax = DbConfig::getSetting('maxPasswordLength');
     $this->message = t('Error: Your password has to contain from %0% to %1% characters.', $this->iMin, $this->iMax);
 }
 /**
  * Send an email to the site administrator saying the reason why a user wanted to delete his account from the site.
  *
  * @return void
  */
 protected function sendWarnEmail()
 {
     $sUsername = $this->session->get($this->sSessPrefix . '_username');
     $sMembershipType = $this->registry->module == 'affiliate' ? t('Affiliate') : t('Member');
     $this->view->membership = t('Type of Membership: %0%.', $sMembershipType);
     $this->view->message = nl2br($this->httpRequest->post('message'));
     $this->view->why_delete = t('Reason why the user wanted to leave: %0%', $this->httpRequest->post('why_delete'));
     $this->view->footer_title = t('User Information');
     $this->view->email = t('Email: %0%', $this->session->get($this->sSessPrefix . '_email'));
     $this->view->username = t('Username: %0%', $sUsername);
     $this->view->first_name = t('First Name: %0%', $this->session->get($this->sSessPrefix . '_first_name'));
     $this->view->sex = t('Sex: %0%', $this->session->get($this->sSessPrefix . '_sex'));
     $this->view->ip = t('User IP: %0%', $this->session->get($this->sSessPrefix . '_ip'));
     $this->view->browser_info = t('Browser info: %0%', $this->session->get($this->sSessPrefix . '_http_user_agent'));
     $sMessageHtml = $this->view->parseMail(PH7_PATH_SYS . 'global/' . PH7_VIEWS . PH7_TPL_NAME . '/mail/sys/core/delete_account.tpl', DbConfig::getSetting('adminEmail'));
     $sMembershipName = $this->registry->module == 'user' ? t('Member') : t('Affiliate');
     /**
      * Set the details for sending the email, then send it.
      */
     $aInfo = ['subject' => t('Unregister %0% - User: %1%', $sMembershipName, $sUsername)];
     (new Mail())->send($aInfo, $sMessageHtml);
     $oUserModel = $this->registry->module == 'user' ? new UserCore() : new AffiliateCore();
     $oUserModel->delete($this->session->get($this->sSessPrefix . '_id'), $sUsername);
     unset($oUserModel);
 }
 public function __construct()
 {
     parent::__construct();
     /**
      * This can cause minor errors (eg if a user sent a file that is not a video).
      * So we hide the errors if we are not in development mode.
      */
     if (!isDebug()) {
         error_reporting(0);
     }
     // Resizing and saving the video album thumbnail
     $oPicture = new Image($_FILES['album']['tmp_name']);
     if (!$oPicture->validate()) {
         \PFBC\Form::setError('form_video_album', Form::wrongImgFileTypeMsg());
     } else {
         $iApproved = DbConfig::getSetting('videoManualApproval') == 0 ? '1' : '0';
         $sFileName = Various::genRnd($oPicture->getFileName(), 1) . '-thumb.' . $oPicture->getExt();
         (new VideoModel())->addAlbum($this->session->get('member_id'), $this->httpRequest->post('name'), $this->httpRequest->post('description'), $sFileName, $this->dateTime->get()->dateTime('Y-m-d H:i:s'), $iApproved);
         $iLastAlbumId = (int) Db::getInstance()->lastInsertId();
         $oPicture->square(200);
         /* Set watermark text on thumbnail */
         $sWatermarkText = DbConfig::getSetting('watermarkTextImage');
         $iSizeWatermarkText = DbConfig::getSetting('sizeWatermarkTextImage');
         $oPicture->watermarkText($sWatermarkText, $iSizeWatermarkText);
         $sPath = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'video/file/' . $this->session->get('member_username') . PH7_DS . $iLastAlbumId . PH7_DS;
         $this->file->createDir($sPath);
         $oPicture->save($sPath . $sFileName);
         /* Clean VideoModel Cache */
         (new Framework\Cache\Cache())->start(VideoModel::CACHE_GROUP, null, null)->clear();
         HeaderUrl::redirect(Uri::get('video', 'main', 'addvideo', $iLastAlbumId));
     }
 }
 public function __construct()
 {
     parent::__construct();
     $oAffModel = new AffiliateModel();
     $oSecurityModel = new SecurityModel();
     $sEmail = $this->httpRequest->post('mail');
     $sPassword = $this->httpRequest->post('password');
     /** Check if the connection is not locked **/
     $bIsLoginAttempt = (bool) DbConfig::getSetting('isAffiliateLoginAttempt');
     $iMaxAttempts = (int) DbConfig::getSetting('maxAffiliateLoginAttempts');
     $iTimeDelay = (int) DbConfig::getSetting('loginAffiliateAttemptTime');
     if ($bIsLoginAttempt && !$oSecurityModel->checkLoginAttempt($iMaxAttempts, $iTimeDelay, $sEmail, $this->view, 'Affiliates')) {
         \PFBC\Form::setError('form_login_aff', Form::loginAttemptsExceededMsg($iTimeDelay));
         return;
         // Stop execution of the method.
     }
     // Check Login
     $sLogin = $oAffModel->login($sEmail, $sPassword, 'Affiliates');
     if ($sLogin === 'email_does_not_exist' || $sLogin === 'password_does_not_exist') {
         sleep(1);
         // Security against brute-force attack to avoid drowning the server and the database
         if ($sLogin === 'email_does_not_exist') {
             $this->session->set('captcha_enabled', 1);
             // Enable Captcha
             \PFBC\Form::setError('form_login_aff', t('Oops! "%0%" is not associated with any %site_name% account.', escape(substr($sEmail, 0, PH7_MAX_EMAIL_LENGTH))));
             $oSecurityModel->addLoginLog($sEmail, 'Guest', 'No Password', 'Failed! Incorrect Username', 'Affiliates');
         } elseif ($sLogin === 'password_does_not_exist') {
             $oSecurityModel->addLoginLog($sEmail, 'Guest', $sPassword, 'Failed! Incorrect Password', 'Affiliates');
             if ($bIsLoginAttempt) {
                 $oSecurityModel->addLoginAttempt('Affiliates');
             }
             $this->session->set('captcha_enabled', 1);
             // Enable Captcha
             $sWrongPwdTxt = t('Oops! This password you entered is incorrect.') . '<br />';
             $sWrongPwdTxt .= t('Please try again (make sure your caps lock is off).') . '<br />';
             $sWrongPwdTxt .= t('Forgot your password? <a href="%0%">Request a new one</a>.', Uri::get('lost-password', 'main', 'forgot', 'affiliate'));
             \PFBC\Form::setError('form_login_aff', $sWrongPwdTxt);
         }
     } else {
         $oSecurityModel->clearLoginAttempts('Affiliates');
         $this->session->remove('captcha_enabled');
         $iId = $oAffModel->getId($sEmail, null, 'Affiliates');
         $oAffData = $oAffModel->readProfile($iId, 'Affiliates');
         if (true !== ($mStatus = (new AffiliateCore())->checkAccountStatus($oAffData))) {
             \PFBC\Form::setError('form_login_aff', $mStatus);
         } else {
             // Is disconnected if the user is logged on as "user" or "administrator".
             if (UserCore::auth() || AdminCore::auth()) {
                 $this->session->destroy();
             }
             // Regenerate the session ID to prevent the session fixation
             $this->session->regenerateId();
             $aSessionData = ['affiliate_id' => $oAffData->profileId, 'affiliate_email' => $oAffData->email, 'affiliate_username' => $oAffData->username, 'affiliate_first_name' => $oAffData->firstName, 'affiliate_sex' => $oAffData->sex, 'affiliate_ip' => Ip::get(), 'affiliate_http_user_agent' => $this->browser->getUserAgent(), 'affiliate_token' => Various::genRnd($oAffData->email)];
             $this->session->set($aSessionData);
             $oSecurityModel->addLoginLog($oAffData->email, $oAffData->username, '*****', 'Logged in!', 'Affiliates');
             $oAffModel->setLastActivity($oAffData->profileId, 'Affiliates');
             Header::redirect(Uri::get('affiliate', 'account', 'index'), t('You are successfully logged!'));
         }
     }
 }
Beispiel #10
0
 public function step1()
 {
     $iAffId = (int) (new Cookie())->get(AffiliateCore::COOKIE_NAME);
     $sRef = $this->session->exists('joinRef') ? $this->session->get('joinRef') : t('No reference');
     // Statistics
     $this->session->remove('joinRef');
     $aData = ['email' => $this->httpRequest->post('mail'), 'username' => $this->httpRequest->post('username'), 'first_name' => $this->httpRequest->post('first_name'), 'reference' => $sRef, 'ip' => Ip::get(), 'hash_validation' => Various::genRnd(), 'current_date' => (new CDateTime())->get()->dateTime('Y-m-d H:i:s'), 'is_active' => $this->iActiveType, 'group_id' => (int) DbConfig::getSetting('defaultMembershipGroupId'), 'affiliated_id' => $iAffId];
     $aData += ['password' => Security::hashPwd($this->httpRequest->post('password'))];
     $iTimeDelay = (int) DbConfig::getSetting('timeDelayUserRegistration');
     if (!$this->oUserModel->checkWaitJoin($aData['ip'], $iTimeDelay, $aData['current_date'])) {
         \PFBC\Form::setError('form_join_user', Form::waitRegistrationMsg($iTimeDelay));
     } elseif (!$this->oUserModel->join($aData)) {
         \PFBC\Form::setError('form_join_user', t('An error occurred during registration!<br />
         Please try again with other information in the form fields or come back later.'));
     } else {
         // Successful registration in the database for step 1!
         /** Update the Affiliate Commission **/
         if ($this->iActiveType == 0) {
             // Only if the user's account is already activated.
             AffiliateCore::updateJoinCom($iAffId, $this->config, $this->registry);
         }
         // Send email
         $this->oRegistration->sendMail($aData);
         $this->session->set('mail_step1', $this->httpRequest->post('mail'));
         HeaderUrl::redirect(Uri::get('user', 'signup', 'step2'));
     }
 }
 public static function display()
 {
     if (isset($_POST['submit_compose_mail'])) {
         if (\PFBC\Form::isValid($_POST['submit_compose_mail'])) {
             new MailFormProcess();
         }
         Framework\Url\Header::redirect();
     }
     $oHttpRequest = new Http();
     // For Reply Function
     $oForm = new \PFBC\Form('form_compose_mail', '100%');
     $oForm->configure(array('action' => ''));
     $oForm->addElement(new \PFBC\Element\Hidden('submit_compose_mail', 'form_compose_mail'));
     $oForm->addElement(new \PFBC\Element\Token('compose_mail'));
     $oForm->addElement(new \PFBC\Element\Textbox(t('Recipient:'), 'recipient', array('id' => 'recipient', 'value' => $oHttpRequest->get('recipient'), 'required' => 1)));
     $oForm->addElement(new \PFBC\Element\Textbox(t('Subject:'), 'title', array('id' => 'str_title', 'onblur' => 'CValid(this.value,this.id,2,60)', 'value' => $oHttpRequest->get('title') != '' ? t('RE: ') . str_replace('-', ' ', $oHttpRequest->get('title')) : '', 'validation' => new \PFBC\Validation\Str(2, 60), 'required' => 1)));
     $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_title"></span>'));
     $oForm->addElement(new \PFBC\Element\CKEditor(t('Your message:'), 'message', array('id' => 'str_msg', 'onblur' => 'CValid(this.value,this.id,2,2500)', 'value' => $oHttpRequest->get('message'), 'validation' => new \PFBC\Validation\Str(2, 2500), 'required' => 1)));
     $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_msg"></span>'));
     unset($oHttpRequest);
     if (!AdminCore::auth() && DbConfig::getSetting('isCaptchaMail')) {
         $oForm->addElement(new \PFBC\Element\CCaptcha(t('Captcha:'), 'captcha', array('id' => 'ccaptcha', 'onkeyup' => 'CValid(this.value, this.id)', 'description' => t('Enter the code above:'))));
         $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error ccaptcha"></span>'));
     }
     $oForm->addElement(new \PFBC\Element\Button());
     $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script><script src="' . PH7_URL_STATIC . PH7_JS . 'autocompleteUsername.js"></script>'));
     $oForm->render();
 }
 public function __construct()
 {
     parent::__construct();
     $oCommentModel = new CommentModel();
     $sComment = $this->httpRequest->post('comment');
     $sCurrentTime = $this->dateTime->get()->dateTime('Y-m-d H:i:s');
     $iTimeDelay = (int) DbConfig::getSetting('timeDelaySendComment');
     $sTable = $this->httpRequest->get('table');
     $iRecipientId = $this->httpRequest->get('recipient', 'int');
     $iSenderId = (int) $this->session->get('member_id');
     if (!$oCommentModel->idExists($iRecipientId, $sTable)) {
         \PFBC\Form::setError('form_comment', t('The comment recipient does not exists.'));
     } elseif (!$oCommentModel->checkWaitSend($iSenderId, $iTimeDelay, $sCurrentTime, $sTable)) {
         \PFBC\Form::setError('form_comment', Form::waitWriteMsg($iTimeDelay));
     } elseif ($oCommentModel->isDuplicateContent($iSenderId, $sComment, $sTable)) {
         \PFBC\Form::setError('form_comment', Form::duplicateContentMsg());
     } else {
         if (!$oCommentModel->add($sComment, $iRecipientId, $iSenderId, 1, $sCurrentTime, $sTable)) {
             \PFBC\Form::setError('form_comment', t('Oops! Error when adding comment.'));
         } else {
             /* Clean All Data of CommentModel Cache */
             (new Framework\Cache\Cache())->start(CommentCoreModel::CACHE_GROUP, null, null)->clear();
             HeaderUrl::redirect(Uri::get('comment', 'comment', 'read', $sTable . ',' . $iRecipientId), t('The comment has been sent successfully!'));
         }
     }
     unset($oCommentModel);
 }
 public function __construct()
 {
     parent::__construct();
     // Enable caching for all pages of this module
     $this->view->setCaching(true);
     // Global variables for all template pages of the module
     $this->view->admin_email = DbConfig::getSetting('adminEmail');
 }
 public function render()
 {
     // Adding the password pattern
     $this->attributes['pattern'] = '.{' . DbConfig::getSetting('minPasswordLength') . ',' . DbConfig::getSetting('maxPasswordLength') . '}';
     // Adding the password type attribute
     $this->attributes['type'] = 'password';
     parent::render();
 }
 public function __construct()
 {
     parent::__construct();
     /***** Initialization of Google Map *****/
     $this->setEnableWindowZoom(true);
     $this->setMapType(DbConfig::getSetting('mapType'));
     $this->setLang(PH7_LANG_NAME);
 }
Beispiel #16
0
 /**
  * Constructor of class.
  *
  * @param string $sTable Default 'Members'
  */
 public function __construct($sTable = 'Members')
 {
     parent::__construct();
     $this->sTable = $sTable;
     $this->iMin = DbConfig::getSetting('minUsernameLength');
     $this->iMax = DbConfig::getSetting('maxUsernameLength');
     $this->message = t('Error: Your username has to contain from %0% to %1% characters, your username is not available or your username already used by other member.', $this->iMin, $this->iMax);
 }
 public function jQueryDocumentReady()
 {
     parent::jQueryDocumentReady();
     $iCurrentYear = date('Y');
     $iMin = $iCurrentYear - DbConfig::getSetting('maxAgeRegistration');
     $iMax = $iCurrentYear - DbConfig::getSetting('minAgeRegistration');
     echo 'jQuery("#', $this->attributes['id'], '").datepicker({dateFormat:\'mm/dd/yy\',defaultDate:-9862,changeMonth:true,changeYear:true,yearRange:\'' . $iMin . ':' . $iMax . '\'});';
 }
 public function __construct()
 {
     parent::__construct();
     $sIp = Ip::get();
     $oAdminModel = new AdminModel();
     $oSecurityModel = new SecurityModel();
     $sEmail = $this->httpRequest->post('mail');
     $sUsername = $this->httpRequest->post('username');
     $sPassword = $this->httpRequest->post('password');
     /*** Security IP Login ***/
     $sIpLogin = DbConfig::getSetting('ipLogin');
     /*** Check if the connection is not locked ***/
     $bIsLoginAttempt = (bool) DbConfig::getSetting('isAdminLoginAttempt');
     $iMaxAttempts = (int) DbConfig::getSetting('maxAdminLoginAttempts');
     $iTimeDelay = (int) DbConfig::getSetting('loginAdminAttemptTime');
     if ($bIsLoginAttempt && !$oSecurityModel->checkLoginAttempt($iMaxAttempts, $iTimeDelay, $sEmail, $this->view, 'Admins')) {
         \PFBC\Form::setError('form_admin_login', Form::loginAttemptsExceededMsg($iTimeDelay));
         return;
         // Stop execution of the method.
     }
     /*** Check Login ***/
     $bIsLogged = $oAdminModel->adminLogin($sEmail, $sUsername, $sPassword);
     $bIsIpBanned = !empty($sIpLogin) && $sIpLogin !== $sIp;
     if (!$bIsLogged || $bIsIpBanned) {
         sleep(2);
         // Security against brute-force attack to avoid drowning the server and the database
         if (!$bIsLogged) {
             $oSecurityModel->addLoginLog($sEmail, $sUsername, $sPassword, 'Failed! Incorrect Email, Username or Password', 'Admins');
             if ($bIsLoginAttempt) {
                 $oSecurityModel->addLoginAttempt('Admins');
             }
             $this->session->set('captcha_admin_enabled', 1);
             // Enable Captcha
             \PFBC\Form::setError('form_admin_login', t('"Email", "Username" or "Password" is Incorrect'));
         } elseif ($bIsIpBanned) {
             $this->session->set('captcha_admin_enabled', 1);
             // Enable Captcha
             \PFBC\Form::setError('form_admin_login', t('Incorrect Login!'));
             $oSecurityModel->addLoginLog($sEmail, $sUsername, $sPassword, 'Failed! Bad Ip adress', 'Admins');
         }
     } else {
         $oSecurityModel->clearLoginAttempts('Admins');
         $this->session->remove('captcha_admin_enabled');
         // Is disconnected if the user is logged on as "user" or "affiliate".
         if (UserCore::auth() || AffiliateCore::auth()) {
             $this->session->destroy();
         }
         $iId = $oAdminModel->getId($sEmail, null, 'Admins');
         $oAdminData = $oAdminModel->readProfile($iId, 'Admins');
         // Regenerate the session ID to prevent the session fixation
         $this->session->regenerateId();
         $aSessionData = array('admin_id' => $oAdminData->profileId, 'admin_email' => $oAdminData->email, 'admin_username' => $oAdminData->username, 'admin_first_name' => $oAdminData->firstName, 'admin_ip' => $sIp, 'admin_http_user_agent' => $this->browser->getUserAgent(), 'admin_token' => Various::genRnd($oAdminData->email));
         $this->session->set($aSessionData);
         $oSecurityModel->addLoginLog($sEmail, $sUsername, '*****', 'Logged in!', 'Admins');
         $oAdminModel->setLastActivity($oAdminData->profileId, 'Admins');
         HeaderUrl::redirect(Uri::get(PH7_ADMIN_MOD, 'main', 'index'), t('You signup is successfully!'));
     }
 }
 public function index()
 {
     $this->view->page_title = t('Free Video Room, Live Speed Dating ChatRoulette');
     $this->view->meta_description = t('Free Live Speed Dating with the Chatroulette of %site_name%, Meet new people near you and make new friends, sex friends and free flirting, Free online dating site for singles without registration with Video Chat Rooms!');
     $this->view->meta_keywords = t('chat, chatroulette, sex friend, single, speed dating, meet singles, dating, free dating, chat room, chat webcam');
     $this->view->h1_title = t('Welcome to <span class="pH1">Speed Dating ChatRoulette</span> of <span class="pH0">%site_name%</span>!');
     $this->view->chatroulette = Url::clean((new SysVar())->parse(DbConfig::getSetting('chatrouletteApi')));
     $this->output();
 }
 public function index()
 {
     $this->view->page_title = t('Free Chat Room Dating');
     $this->view->meta_description = t('Find Your Match at The Best Free Online Dating Site with Free Chat Rooms, Single Chat Meet People');
     $this->view->meta_keywords = t('chat, speed dating, meet singles, dating, free dating, chat room, chat webcam');
     $this->view->h1_title = t('Welcome to <span class="pH3">Free Chat Room</span> on <span class="pH0">%site_name%</span>!');
     $this->view->chat_room = Url::clean((new SysVar())->parse(DbConfig::getSetting('chatApi')));
     $this->output();
 }
 /**
  * Generate the select field for age search.
  *
  * @return The field age with the default selected minimum and maximum registration age.
  */
 public function __construct($aProperties = null)
 {
     parent::__construct('', '', array(), $aProperties);
     $this->iMinAge = DbConfig::getSetting('minAgeRegistration');
     $this->iMaxAge = DbConfig::getSetting('maxAgeRegistration');
     $sSelect1 = static::getOptions(static::MIN_AGE);
     $sSelect2 = static::getOptions(static::MAX_AGE);
     $this->sHtmlOutput = '<div class="pfbc-label"><label><strong>*</strong>' . t('Age') . '</label></div><select name="age1">' . $sSelect1 . '</select> - <select name="age2">' . $sSelect2 . '</select> &nbsp; ' . t('years');
 }
 public function __construct()
 {
     parent::__construct();
     $oUserModel = new UserCoreModel();
     $oSecurityModel = new SecurityModel();
     $sEmail = $this->httpRequest->post('mail');
     $sPassword = $this->httpRequest->post('password');
     /** Check if the connection is not locked **/
     $bIsLoginAttempt = (bool) DbConfig::getSetting('isUserLoginAttempt');
     $iMaxAttempts = (int) DbConfig::getSetting('maxUserLoginAttempts');
     $iTimeDelay = (int) DbConfig::getSetting('loginUserAttemptTime');
     if ($bIsLoginAttempt && !$oSecurityModel->checkLoginAttempt($iMaxAttempts, $iTimeDelay, $sEmail, $this->view)) {
         \PFBC\Form::setError('form_login_user', Form::loginAttemptsExceededMsg($iTimeDelay));
         return;
         // Stop execution of the method.
     }
     // Check Login
     $sLogin = $oUserModel->login($sEmail, $sPassword);
     if ($sLogin === 'email_does_not_exist' || $sLogin === 'password_does_not_exist') {
         sleep(1);
         // Security against brute-force attack to avoid drowning the server and the database
         if ($sLogin === 'email_does_not_exist') {
             $this->session->set('captcha_enabled', 1);
             // Enable Captcha
             \PFBC\Form::setError('form_login_user', t('Oops! "%0%" is not associated with any %site_name% account.', escape(substr($sEmail, 0, PH7_MAX_EMAIL_LENGTH))));
             $oSecurityModel->addLoginLog($sEmail, 'Guest', 'No Password', 'Failed! Incorrect Username');
         } elseif ($sLogin === 'password_does_not_exist') {
             $oSecurityModel->addLoginLog($sEmail, 'Guest', $sPassword, 'Failed! Incorrect Password');
             if ($bIsLoginAttempt) {
                 $oSecurityModel->addLoginAttempt();
             }
             $this->session->set('captcha_enabled', 1);
             // Enable Captcha
             $sWrongPwdTxt = t('Oops! This password you entered is incorrect.') . '<br />';
             $sWrongPwdTxt .= t('Please try again (make sure your caps lock is off).') . '<br />';
             $sWrongPwdTxt .= t('Forgot your password? <a href="%0%">Request a new one</a>.', Uri::get('lost-password', 'main', 'forgot', 'user'));
             \PFBC\Form::setError('form_login_user', $sWrongPwdTxt);
         }
     } else {
         $oSecurityModel->clearLoginAttempts();
         $this->session->remove('captcha_enabled');
         $iId = $oUserModel->getId($sEmail);
         $oUserData = $oUserModel->readProfile($iId);
         if ($this->httpRequest->postExists('remember')) {
             // We hash again the password
             (new Framework\Cookie\Cookie())->set(array('member_remember' => Security::hashCookie($oUserData->password), 'member_id' => $oUserData->profileId));
         }
         $oUser = new UserCore();
         if (true !== ($mStatus = $oUser->checkAccountStatus($oUserData))) {
             \PFBC\Form::setError('form_login_user', $mStatus);
         } else {
             $oUser->setAuth($oUserData, $oUserModel, $this->session);
             Header::redirect(Uri::get('user', 'account', 'index'), t('You are successfully logged!'));
         }
     }
 }
Beispiel #23
0
 /**
  * @param object $oProfile
  * @param object \PH7\UserCoreModel $oUserModel
  * @return void
  */
 public function add($oProfile, UserCoreModel $oUserModel)
 {
     $sBirthDate = isset($oProfile->birth_month, $oProfile->birth_day, $oProfile->birth_year) ? $oProfile->birth_month . '/' . $oProfile->birth_day . '/' . $oProfile->birth_year : date('m/d/Y', strtotime('-30 year'));
     $sSex = $oProfile->gender != 'male' && $oProfile->gender != 'female' && $oProfile->gender != 'couple' ? 'female' : $oProfile->gender;
     // Default 'female'
     $sMatchSex = $sSex == 'male' ? 'female' : ($sSex == 'female' ? 'male' : 'couple');
     $this->_sUsername = (new UserCore())->findUsername($oProfile->name, $oProfile->first_name, $oProfile->last_name);
     $this->_aUserInfo = ['email' => $oProfile->emails->account, 'username' => $this->_sUsername, 'password' => Various::genRndWord(8, 30), 'first_name' => !empty($oProfile->first_name) ? $oProfile->first_name : '', 'last_name' => !empty($oProfile->last_name) ? $oProfile->last_name : '', 'sex' => $sSex, 'match_sex' => array($sMatchSex), 'birth_date' => (new CDateTime())->get($sBirthDate)->date('Y-m-d'), 'country' => Geo::getCountryCode(), 'city' => Geo::getCity(), 'state' => Geo::getState(), 'zip_code' => Geo::getZipCode(), 'description' => '', 'website' => '', 'social_network_site' => '', 'ip' => Ip::get(), 'prefix_salt' => Various::genRnd(), 'suffix_salt' => Various::genRnd(), 'hash_validation' => Various::genRnd(), 'is_active' => DbConfig::getSetting('userActivationType')];
     $this->_iProfileId = $oUserModel->add($this->_aUserInfo);
 }
 public function __construct()
 {
     parent::__construct();
     /***** Securing the server for DDoS attack only! Not for the attacks DoS *****/
     if (!isDebug() && M\DbConfig::getSetting('DDoS')) {
         $oDDoS = new Stop();
         if ($oDDoS->cookie() || $oDDoS->session()) {
             sleep(PH7_DDOS_DELAY_SLEEP);
         }
         unset($oDDoS);
     }
     /*
     if ($this->browser->isMobile())
     {
         \PH7\Framework\Url\HeaderUrl::redirect('mobile');
     }
     */
     /***** Assign the values for Registry Class *****/
     // URL
     $this->registry->site_url = PH7_URL_ROOT;
     $this->registry->url_relative = PH7_RELATIVE;
     $this->registry->page_ext = PH7_PAGE_EXT;
     // Site Name
     $this->registry->site_name = M\DbConfig::getSetting('siteName');
     /***** Internationalization *****/
     // Default path language
     $this->lang->load('global', PH7_PATH_APP_LANG);
     /***** PH7Tpl Template Engine initialization *****/
     /*** Assign the global variables ***/
     /*** Objects ***/
     $this->view->config = $this->config;
     $this->view->design = $this->design;
     /***** Info *****/
     $oInfo = M\DbConfig::getMetaMain(PH7_LANG_NAME);
     $aMetaVars = ['site_name' => $this->registry->site_name, 'page_title' => $oInfo->pageTitle, 'slogan' => $oInfo->slogan, 'meta_description' => $oInfo->metaDescription, 'meta_keywords' => $oInfo->metaKeywords, 'meta_author' => $oInfo->metaAuthor, 'meta_robots' => $oInfo->metaRobots, 'meta_copyright' => $oInfo->metaCopyright, 'meta_rating' => $oInfo->metaRating, 'meta_distribution' => $oInfo->metaDistribution, 'meta_category' => $oInfo->metaCategory, 'header' => 0];
     $this->view->assigns($aMetaVars);
     unset($oInfo);
     /**
      * This test is not necessary because if there is no session,
      * the get() method of the \PH7\Framework\Session\Session object an empty value and revisit this avoids having undefined variables in some modules (such as the "connect" module).
      */
     //if (\PH7\UserCore::auth()) {
     $this->view->count_unread_mail = \PH7\MailCoreModel::countUnreadMsg($this->session->get('member_id'));
     $this->view->count_pen_friend_request = \PH7\FriendCoreModel::getPenFd($this->session->get('member_id'));
     //}
     /***** Display *****/
     $this->view->setTemplateDir($this->registry->path_module_views . PH7_TPL_MOD_NAME);
     /***** End Template Engine PH7Tpl *****/
     // For permission the modules
     if (is_file($this->registry->path_module_config . 'Permission.php')) {
         require $this->registry->path_module_config . 'Permission.php';
         new \PH7\Permission();
     }
 }
 public function index()
 {
     $this->view->page_title = t('Admin Panel');
     $this->view->h1_title = t('Dashboard');
     $this->view->h2_title = t('Hello <em>%0%</em>, welcome to your site!', $this->session->get('admin_first_name'));
     $this->view->h3_title = t('How are you today?');
     $this->view->is_news_feed = (bool) DbConfig::getSetting('isSoftwareNewsFeed');
     $this->checkUpdates();
     $this->addStats();
     $this->output();
 }
 /**
  * Get the "@<username>" in the contents.
  *
  * @static
  * @access protected
  * @param string $sContents
  * @return array The usernames in an array that were found in the content.
  */
 protected static function getAtUsernames($sContents)
 {
     if (preg_match_all('#' . static::AT . '(' . PH7_USERNAME_PATTERN . '{' . DbConfig::getSetting('minUsernameLength') . ',' . DbConfig::getSetting('maxUsernameLength') . '})#u', $sContents, $aMatches, PREG_PATTERN_ORDER)) {
         $aMatches[1] = array_unique($aMatches[1]);
         // Delete duplicate usernames.
         foreach ($aMatches[1] as $sUsername) {
             if ((new \PH7\ExistsCoreModel())->username($sUsername)) {
                 (yield $sUsername);
                 // PHP 5.5
             }
         }
     }
 }
 public function __construct()
 {
     parent::__construct();
     $oValidate = new Validate();
     $oAdminModel = new AdminModel();
     // Prohibit other administrators to edit the Root Administrator (ID 1)
     $iProfileId = $this->httpRequest->getExists('profile_id') && $this->httpRequest->get('profile_id', 'int') !== 1 ? $this->httpRequest->get('profile_id', 'int') : $this->session->get('admin_id');
     $oAdmin = $oAdminModel->readProfile($iProfileId, 'Admins');
     if (!$this->str->equals($this->httpRequest->post('username'), $oAdmin->username)) {
         $iMinUsernameLength = DbConfig::getSetting('minUsernameLength');
         $iMaxUsernameLength = DbConfig::getSetting('maxUsernameLength');
         if (!$oValidate->username($this->httpRequest->post('username'), $iMinUsernameLength, $iMaxUsernameLength)) {
             \PFBC\Form::setError('form_admin_edit_account', t('Your username has to contain from %0% to %1% characters, your username is not available or your username already used by other admin.', $iMinUsernameLength, $iMaxUsernameLength));
             $this->bIsErr = true;
         } else {
             $oAdminModel->updateProfile('username', $this->httpRequest->post('username'), $iProfileId, 'Admins');
             $this->session->set('admin_username', $this->httpRequest->post('username'));
             (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'username' . $iProfileId . 'Admins', null)->clear();
         }
     }
     if (!$this->str->equals($this->httpRequest->post('mail'), $oAdmin->email)) {
         if ((new ExistsCoreModel())->email($this->httpRequest->post('mail'))) {
             \PFBC\Form::setError('form_admin_edit_account', t('Invalid email address or this email is already used by another admin.'));
             $this->bIsErr = true;
         } else {
             $oAdminModel->updateProfile('email', $this->httpRequest->post('mail'), $iProfileId, 'Admins');
             $this->session->set('admin_email', $this->httpRequest->post('mail'));
         }
     }
     if (!$this->str->equals($this->httpRequest->post('first_name'), $oAdmin->firstName)) {
         $oAdminModel->updateProfile('firstName', $this->httpRequest->post('first_name'), $iProfileId, 'Admins');
         $this->session->set('admin_first_name', $this->httpRequest->post('first_name'));
         (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'firstName' . $iProfileId . 'Admins', null)->clear();
     }
     if (!$this->str->equals($this->httpRequest->post('last_name'), $oAdmin->lastName)) {
         $oAdminModel->updateProfile('lastName', $this->httpRequest->post('last_name'), $iProfileId, 'Admins');
     }
     if (!$this->str->equals($this->httpRequest->post('sex'), $oAdmin->sex)) {
         $oAdminModel->updateProfile('sex', $this->httpRequest->post('sex'), $iProfileId, 'Admins');
         (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'sex' . $iProfileId . 'Admins', null)->clear();
     }
     if (!$this->str->equals($this->httpRequest->post('time_zone'), $oAdmin->timeZone)) {
         $oAdminModel->updateProfile('timeZone', $this->httpRequest->post('time_zone'), $iProfileId, 'Admins');
     }
     $oAdminModel->setLastEdit($iProfileId, 'Admins');
     unset($oValidate, $oAdminModel, $oAdmin);
     (new Admin())->clearReadProfileCache($iProfileId, 'Admins');
     if (!$this->bIsErr) {
         \PFBC\Form::setSuccess('form_admin_edit_account', t('Your profile has been saved successfully!'));
     }
 }
Beispiel #28
0
 /**
  * Generates HTML contents Video.
  *
  * @param object $oData
  * @param string $sMedia Type of the media ('preview' or 'movie'). Default value is 'movie'.
  * @param integer $iWidth Default 600
  * @param integer $iHeight Default 400
  * @return void
  */
 public static function generate($oData, $sMedia = 'movie', $iWidth = 600, $iHeight = 400)
 {
     $sDurationTag = '<div class="video_duration">' . Various::secToTime($oData->duration) . '</div>';
     if ((new VideoCore())->isApi($oData->file)) {
         $oVideo = (new Api())->getMeta($oData->file, $sMedia, $iWidth, $iHeight);
         if ($sMedia == 'preview') {
             echo $sDurationTag, '<a href="', $oData->file, '" title="', $oData->title, '" data-popup="frame-video"><img src="', $oVideo, '" alt="', $oData->title, '" title="', $oData->title, '" /></a>';
         } else {
             echo $oVideo;
         }
     } else {
         $sDir = 'video/file/' . $oData->username . PH7_SH . $oData->albumId . PH7_SH;
         $sVidPath1 = $sDir . $oData->file . '.webm';
         $sVidPath2 = $sDir . $oData->file . '.mp4';
         // If the video is not found on the server, we show a video that shows an appropriate message.
         if (!(is_file(PH7_PATH_PUBLIC_DATA_SYS_MOD . $sVidPath1) && is_file(PH7_PATH_PUBLIC_DATA_SYS_MOD . $sVidPath2))) {
             $sVidPath1 = PH7_URL_DATA_SYS_MOD . 'video/not_found.webm';
             $sVidPath2 = PH7_URL_DATA_SYS_MOD . 'video/not_found.mp4';
         }
         if (is_file(PH7_PATH_PUBLIC_DATA_SYS_MOD . $sDir . $oData->thumb)) {
             $oFile = new File();
             $sThumbName = $oFile->getFileWithoutExt($oData->thumb);
             $sThumbExt = $oFile->getFileExt($oData->thumb);
             unset($oFile);
             $aThumb = ['', '-1', '-2', '-3', '-4'];
             shuffle($aThumb);
             $sThumbUrl = PH7_URL_DATA_SYS_MOD . $sDir . $sThumbName . $aThumb[0] . PH7_DOT . $sThumbExt;
         } else {
             $sThumbUrl = PH7_URL_TPL . PH7_TPL_NAME . PH7_SH . PH7_IMG . 'icon/none.jpg';
         }
         $sParam = $sMedia == 'movie' && DbConfig::getSetting('autoplayVideo') ? 'autoplay="autoplay"' : '';
         $sVideoTag = '
         <video poster="' . $sThumbUrl . '" width="' . $iWidth . '" height="' . $iHeight . '" controls="controls" ' . $sParam . '>
             <source src="' . PH7_URL_DATA_SYS_MOD . $sVidPath1 . '" type="video/webm" />
             <source src="' . PH7_URL_DATA_SYS_MOD . $sVidPath2 . '" type="video/mp4" />
             ' . t('Your browser is obsolete. Please use a browser that supports HTML5.') . '
         </video>
         <div class="center">
             <button class="bold" onclick="Video.playPause()">' . t('Play/Pause') . '</button>
             <button onclick="Video.bigSize()">' . t('Big') . '</button>
             <button onclick="Video.normalSize()">' . t('Normal') . '</button>
             <button onclick="Video.smallSize()">' . t('Small') . '</button>
         </div>';
         if ($sMedia == 'preview') {
             echo $sDurationTag, '<a href="#watch', $oData->videoId, '" title="', $oData->title, '" data-popup="video"><img src="', $sThumbUrl, '" alt="', $oData->title, '" title="', $oData->title, '" /></a>
             <div class="hidden"><div id="watch', $oData->videoId, '">', $sVideoTag, '</div></div>';
         } else {
             echo $sVideoTag;
         }
     }
 }
 /**
  * Displaying the main homepage of the website.
  */
 public function index()
 {
     // We must not put the title as this is the homepage, so this is the default title is used.
     // For Profiles Carousel
     $this->view->userDesignModel = new UserDesignCoreModel();
     $this->view->userDesign = new UserDesignCore();
     // Only visitors
     if (!UserCore::auth()) {
         // Set CSS and JS files
         $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'splash.css,tooltip.css,js/jquery/carousel.css');
         $this->design->addJs(PH7_DOT, PH7_STATIC . PH7_JS . 'jquery/carouFredSel.js,' . PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_JS . 'splash.js');
         // Assigns the promo text to the view
         $this->view->promo_text = DbConfig::getMetaMain(PH7_LANG_NAME)->promoText;
         // Assign the background video option
         $this->view->is_bg_video = DbConfig::getSetting('bgSplashVideo');
         // To check if the site is called by a mobile native app
         $bMobApp = $this->view->is_mobapp = MobApp::is();
         /**
          * When you are in the development mode, you can force the guest page by set a "force" GET request with the "splash" or "classic" parameter.
          * Example: "/?force=splash" or "/?force=classic"
          */
         if (isDebug() && $this->httpRequest->getExists('force')) {
             switch ($this->httpRequest->get('force')) {
                 case 'classic':
                     $sPage = 'index.guest';
                     break;
                 case 'splash':
                     $sPage = 'index.guest_splash';
                     break;
                 default:
                     exit('You can only choose between "classic" or "splash"');
             }
         } elseif ($bMobApp) {
             $sPage = 'index.guest_splash';
         } else {
             $bIsSplashPage = (bool) DbConfig::getSetting('splashPage');
             $sPage = $bIsSplashPage ? 'index.guest_splash' : 'index.guest';
         }
         $this->manualTplInclude($sPage . '.inc.tpl');
     } elseif (UserCore::auth()) {
         // Set CSS and JS files
         $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'zoomer.css');
         $this->design->addJs(PH7_STATIC . PH7_JS, 'zoomer.js,Wall.js');
         // Assigns the user's first name to the view for the Welcome Message
         $this->view->first_name = $this->session->get('member_first_name');
         $this->manualTplInclude('index.user.inc.tpl');
     }
     $this->output();
 }
 public function index()
 {
     // Add Validate-Site JS file if needed
     if (ValidateSiteCore::needInject($this->session)) {
         $this->design->addJs(PH7_LAYOUT . PH7_SYS . PH7_MOD . 'validate-site' . PH7_SH . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_JS, 'validationbox.js');
     }
     $this->view->page_title = t('Admin Panel');
     $this->view->h1_title = t('Dashboard');
     $this->view->h2_title = t('Hello <em>%0%</em>, welcome to your site!', $this->session->get('admin_first_name'));
     $this->view->h3_title = t('How are you today?');
     $this->view->is_news_feed = (bool) DbConfig::getSetting('isSoftwareNewsFeed');
     $this->checkUpdates();
     $this->addStats();
     $this->output();
 }