コード例 #1
0
 public function __construct()
 {
     parent::__construct();
     // PH7\UserCoreModel::login() method of the UserCoreModel Class works only for "user" and "affiliate" module.
     $oPasswordModel = $this->registry->module == PH7_ADMIN_MOD ? new AdminModel() : new UserCoreModel();
     $sEmail = $this->registry->module == PH7_ADMIN_MOD ? $this->session->get('admin_email') : ($this->registry->module == 'user' ? $this->session->get('member_email') : $this->session->get('affiliate_email'));
     $sTable = $this->registry->module == PH7_ADMIN_MOD ? 'Admins' : ($this->registry->module == 'user' ? 'Members' : 'Affiliates');
     $sMod = $this->registry->module == PH7_ADMIN_MOD ? PH7_ADMIN_MOD : ($this->registry->module == 'user' ? 'user' : 'affiliate');
     $sAction = $this->registry->module == 'affiliate' ? 'home' : 'main';
     // Login
     if ($this->registry->module == PH7_ADMIN_MOD) {
         $mLogin = $oPasswordModel->adminLogin($sEmail, $this->session->get('admin_username'), $this->httpRequest->post('old_password'));
     } else {
         $mLogin = $oPasswordModel->login($sEmail, $this->httpRequest->post('old_password'), $sTable);
     }
     // Check
     if ($this->httpRequest->post('new_password') !== $this->httpRequest->post('new_password2')) {
         \PFBC\Form::setError('form_change_password', t('The passwords do not match.'));
     } elseif ($this->httpRequest->post('old_password') === $this->httpRequest->post('new_password')) {
         \PFBC\Form::setError('form_change_password', t('The old and new passwords are identical. So why do you change your password?'));
     } elseif ($mLogin !== true) {
         \PFBC\Form::setError('form_change_password', t('The old password is not correct.'));
     } else {
         // Update
         $oPasswordModel->changePassword($sEmail, $this->httpRequest->post('new_password'), Various::genRnd(), Various::genRnd(), $sTable);
         \PFBC\Form::setSuccess('form_change_password', t('Your password has been correctly updated.'));
     }
 }
コード例 #2
0
 public function __construct()
 {
     parent::__construct();
     $oUser = new UserCore();
     $oUserModel = new UserCoreModel();
     $oExistsModel = new ExistsCoreModel();
     $oValidate = new Validate();
     $aUserData = json_decode($this->file->getFile('http://api.randomuser.me/?results=' . $this->httpRequest->post('num')), true);
     foreach ($aUserData['results'] as $aUser) {
         $aUser = $aUser['user'];
         $sEmail = trim($aUser['email']);
         $sUsername = trim($aUser['username']);
         if ($oValidate->email($sEmail) && !$oExistsModel->email($sEmail) && $oValidate->username($sUsername)) {
             $aData['username'] = $sUsername;
             $aData['email'] = $sEmail;
             $aData['first_name'] = $aUser['name']['first'];
             $aData['last_name'] = $aUser['name']['last'];
             $aData['password'] = $aUser['password'];
             $aData['sex'] = $aUser['gender'];
             $aData['match_sex'] = array($oUser->getMatchSex($aData['sex']));
             $aData['country'] = 'US';
             $aData['city'] = $aUser['location']['city'];
             $aData['state'] = $aUser['location']['state'];
             $aData['zip_code'] = $aUser['location']['zip'];
             $aData['birth_date'] = $this->dateTime->get($aUser['dob'])->date('Y-m-d');
             $aData['avatar'] = $aUser['picture']['large'];
             $aData['ip'] = Ip::get();
             $aData['profile_id'] = $oUserModel->add(escape($aData, true));
             $this->_addAvatar($aData, $oUser);
         }
     }
     unset($oUser, $oUserModel, $oExistsModel, $oValidate, $aUser, $aData, $aUserData);
     \PFBC\Form::setSuccess('form_add_fake_profiles', t('Users has been successfully added.'));
 }
コード例 #3
0
 public function __construct($sTable)
 {
     parent::__construct();
     $oUserModel = new UserCoreModel();
     $sMail = $this->httpRequest->post('mail');
     if (!($iProfileId = $oUserModel->getId($sMail, null, $sTable))) {
         sleep(1);
         // Security against brute-force attack to avoid drowning the server and the database
         \PFBC\Form::setError('form_forgot_password', t('Oops, this "%0%" is not associated with any %site_name% account. Please, make sure that you entered the e-mail address used in creating your account.', escape(substr($sMail, 0, PH7_MAX_EMAIL_LENGTH))));
     } else {
         $oUserModel->setNewHashValidation($iProfileId, Various::genRnd(), $sTable);
         (new UserCore())->clearReadProfileCache($iProfileId, $sTable);
         // Clean the profile data (for the new hash)
         $oData = $oUserModel->readProfile($iProfileId, $sTable);
         /** We place the text outside of Uri::get() otherwise special characters will be deleted and the parameters passed in the url will be unusable thereafter. **/
         $sResetUrl = Uri::get('lost-password', 'main', 'reset', $this->httpRequest->get('mod')) . PH7_SH . $oData->email . PH7_SH . $oData->hashValidation;
         $this->view->content = t('Hello %0%!<br />Somebody (from the IP address %1%) has requested a new password for their account.', $oData->username, Ip::get()) . '<br />' . t('If you requested for this, click on the link below, otherwise ignore this email and your password will remain unchanged.') . '<br /><a href="' . $sResetUrl . '">' . $sResetUrl . '</a>';
         $sMessageHtml = $this->view->parseMail(PH7_PATH_SYS . 'global/' . PH7_VIEWS . PH7_TPL_NAME . '/mail/sys/mod/lost-password/confirm-lost-password.tpl', $oData->email);
         $aInfo = ['to' => $oData->email, 'subject' => t('Request for new password - %site_name%')];
         unset($oData);
         if (!(new Mail())->send($aInfo, $sMessageHtml)) {
             \PFBC\Form::setError('form_forgot_password', Form::errorSendingEmail());
         } else {
             \PFBC\Form::setSuccess('form_forgot_password', t('Successfully requested a new password, email sent!'));
         }
     }
     unset($oUserModel);
 }
コード例 #4
0
 public function __construct()
 {
     $bSend = (new Contact())->sendMessage();
     if (!$bSend) {
         \PFBC\Form::setError('form_contact', Form::errorSendingEmail());
     } else {
         \PFBC\Form::setSuccess('form_contact', t('Your message has been sent successfully!'));
     }
 }
コード例 #5
0
 public function __construct()
 {
     parent::__construct();
     $sTable = AdsCore::getTable();
     (new AdsCoreModel())->update($this->httpRequest->post('id_ads'), $this->httpRequest->post('title'), $this->httpRequest->post('code', Http::NO_CLEAN), $sTable);
     /* Clean Model\Design for STATIC data */
     (new Framework\Cache\Cache())->start(Framework\Mvc\Model\Design::CACHE_STATIC_GROUP, null, null)->clear();
     \PFBC\Form::setSuccess('form_update_ads', t('The Advertisements was saved successfully!'));
 }
コード例 #6
0
 public function __construct()
 {
     $aData = (new Newsletter())->sendMessages();
     if (!$aData['status']) {
         \PFBC\Form::setError('form_msg', Form::errorSendingEmail());
     } else {
         \PFBC\Form::setSuccess('form_msg', nt('%n% newsletters were sent successfully!', '%n% newsletter has been sent successfully', $aData['nb_mail_sent']));
     }
 }
コード例 #7
0
 public function __construct()
 {
     parent::__construct();
     if (!$this->str->equals($this->httpRequest->post('code', Http::NO_CLEAN), (new Design())->customCode('js'))) {
         (new AdminModel())->updateCustomCode($this->httpRequest->post('code', Http::NO_CLEAN), 'js');
         /* Clean Model\Design for STATIC / customCodejs data */
         (new Framework\Cache\Cache())->start(Design::CACHE_STATIC_GROUP, 'customCodejs', null)->clear();
     }
     \PFBC\Form::setSuccess('form_script', t('Your JS code was saved successfully!'));
 }
コード例 #8
0
 public function __construct()
 {
     parent::__construct();
     if (!$this->str->equals($this->httpRequest->post('code', Http::NO_CLEAN), (new Design())->analyticsApi(false, false))) {
         (new Framework\Mvc\Model\Analytics())->updateApi($this->httpRequest->post('code', Http::NO_CLEAN));
         /* Clean Model\Design for STATIC / analyticsApi data */
         (new Framework\Cache\Cache())->start(Design::CACHE_STATIC_GROUP, 'analyticsApi', null)->clear();
     }
     \PFBC\Form::setSuccess('form_analytics', t('The code Analytics Api was saved successfully!'));
 }
コード例 #9
0
 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!'));
     }
 }
コード例 #10
0
 public function __construct()
 {
     parent::__construct();
     $oUserModel = new UserModel();
     $iProfileId = AdminCore::auth() && !User::auth() && $this->httpRequest->getExists('profile_id') ? $this->httpRequest->get('profile_id', 'int') : $this->session->get('member_id');
     $oUser = $oUserModel->readProfile($iProfileId);
     // For Admins only!
     if (AdminCore::auth() && !User::auth() && $this->httpRequest->getExists('profile_id')) {
         if (!$this->str->equals($this->httpRequest->post('group_id'), $oUser->groupId)) {
             $oUserModel->updateMembership($this->httpRequest->post('group_id'), $iProfileId);
         }
     }
     if (!$this->str->equals($this->httpRequest->post('first_name'), $oUser->firstName)) {
         $oUserModel->updateProfile('firstName', $this->httpRequest->post('first_name'), $iProfileId);
         $this->session->set('member_first_name', $this->httpRequest->post('first_name'));
         (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'firstName' . $iProfileId . 'Members', null)->clear();
     }
     if (!$this->str->equals($this->httpRequest->post('last_name'), $oUser->lastName)) {
         $oUserModel->updateProfile('lastName', $this->httpRequest->post('last_name'), $iProfileId);
     }
     if (!$this->str->equals($this->httpRequest->post('sex'), $oUser->sex)) {
         $oUserModel->updateProfile('sex', $this->httpRequest->post('sex'), $iProfileId);
         $this->session->set('member_sex', $this->httpRequest->post('sex'));
         (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'sex' . $iProfileId . 'Members', null)->clear();
     }
     // WARNING: Be careful, you should use the \PH7\Framework\Mvc\Request\Http::ONLY_XSS_CLEAN constant, otherwise the Request\Http::post() method removes the special tags
     // and damages the SET function SQL for entry into the database.
     if (!$this->str->equals($this->httpRequest->post('match_sex', Http::ONLY_XSS_CLEAN), $oUser->matchSex)) {
         $oUserModel->updateProfile('matchSex', Form::setVal($this->httpRequest->post('match_sex', Http::ONLY_XSS_CLEAN)), $iProfileId);
     }
     if (!$this->str->equals($this->dateTime->get($this->httpRequest->post('birth_date'))->date('Y-m-d'), $oUser->birthDate)) {
         $oUserModel->updateProfile('birthDate', $this->dateTime->get($this->httpRequest->post('birth_date'))->date('Y-m-d'), $iProfileId);
     }
     // Update dynamic fields.
     $oFields = $oUserModel->getInfoFields($iProfileId);
     foreach ($oFields as $sColumn => $sValue) {
         $sHRParam = $sColumn == 'description' ? Http::ONLY_XSS_CLEAN : null;
         if (!$this->str->equals($this->httpRequest->post($sColumn, $sHRParam), $sValue)) {
             $oUserModel->updateProfile($sColumn, $this->httpRequest->post($sColumn, $sHRParam), $iProfileId, 'MembersInfo');
         }
     }
     unset($oFields);
     $oUserModel->setLastEdit($iProfileId);
     /*** Clear caches ***/
     $oUserCache = new User();
     $oUserCache->clearReadProfileCache($iProfileId);
     $oUserCache->clearInfoFieldCache($iProfileId);
     // Destroy objects
     unset($oUserModel, $oUser, $oUserCache);
     \PFBC\Form::setSuccess('form_user_edit_account', t('Your profile has been saved successfully!'));
 }
コード例 #11
0
 public function __construct()
 {
     parent::__construct();
     $oAffModel = new AffiliateModel();
     $iProfileId = AdminCore::auth() && !Affiliate::auth() && $this->httpRequest->getExists('profile_id') ? $this->httpRequest->get('profile_id', 'int') : $this->session->get('affiliate_id');
     $oAff = $oAffModel->readProfile($iProfileId, 'Affiliates');
     if (!$this->str->equals($this->httpRequest->post('bank_account'), $oAff->bankAccount)) {
         $oAffModel->updateProfile('bankAccount', $this->httpRequest->post('bank_account'), $iProfileId, 'Affiliates');
     }
     unset($oAffModel, $oAff);
     /* Clean Affiliate UserCoreModel / readProfile Cache */
     (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'readProfile' . $iProfileId . 'Affiliates', null)->clear();
     \PFBC\Form::setSuccess('form_bank_account', t('Your bank information has been saved successfully!'));
 }
コード例 #12
0
 public function __construct()
 {
     parent::__construct();
     $oModuleModel = new ModuleModel();
     // First, disable all mods
     $this->disableMods($oModuleModel);
     // Then, enable the mods selected to be enabled
     foreach ($this->httpRequest->post('module_id') as $iModId) {
         $oModuleModel->update($iModId, '1');
     }
     unset($oModuleModel);
     /* Clear the cache */
     (new Framework\Cache\Cache())->start(ModuleModel::CACHE_GROUP, null, null)->clear();
     \PFBC\Form::setSuccess('form_module', t('Module Status have been saved!'));
 }
コード例 #13
0
 public function __construct()
 {
     parent::__construct();
     $sUrl = $this->httpRequest->postExists('url') ? $this->httpRequest->post('url') : $this->httpRequest->currentUrl();
     $mNeedle = strstr($sUrl, '?', true);
     $aData = ['reporter_id' => $this->session->get('member_id'), 'spammer_id' => $this->httpRequest->post('spammer'), 'url' => $mNeedle ? $mNeedle : $sUrl, 'type' => $this->httpRequest->post('type'), 'desc' => $this->httpRequest->post('desc'), 'date' => $this->dateTime->get()->dateTime('Y-m-d H:i:s')];
     $mReport = (new Report())->add($aData)->get();
     unset($aData);
     if ($mReport === 'already_reported') {
         \PFBC\Form::setError('form_report', t('You have already reported abuse about this profile.'));
     } elseif (!$mReport) {
         \PFBC\Form::setError('form_report', t('Unable to report abuse.'));
     } else {
         \PFBC\Form::setSuccess('form_report', t('You have successfully reported abuse about this profile.'));
     }
 }
コード例 #14
0
 public function __construct()
 {
     parent::__construct();
     $sWhereLang = $this->httpRequest->get('meta_lang');
     $oMeta = DbConfig::getMetaMain($sWhereLang);
     if (!$this->str->equals($this->httpRequest->post('lang_id'), $oMeta->langId)) {
         DbConfig::setMetaMain('langId', $this->httpRequest->post('lang_id'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('page_title'), $oMeta->pageTitle)) {
         DbConfig::setMetaMain('pageTitle', $this->httpRequest->post('page_title'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('slogan'), $oMeta->slogan)) {
         DbConfig::setMetaMain('slogan', $this->httpRequest->post('slogan'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('promo_text'), $oMeta->promoText)) {
         DbConfig::setMetaMain('promoText', $this->httpRequest->post('promo_text', Http::ONLY_XSS_CLEAN), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('meta_description'), $oMeta->metaDescription)) {
         DbConfig::setMetaMain('metaDescription', $this->httpRequest->post('meta_description'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('meta_keywords'), $oMeta->metaKeywords)) {
         DbConfig::setMetaMain('metaKeywords', $this->httpRequest->post('meta_keywords'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('meta_robots'), $oMeta->metaRobots)) {
         DbConfig::setMetaMain('metaRobots', $this->httpRequest->post('meta_robots'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('meta_author'), $oMeta->metaAuthor)) {
         DbConfig::setMetaMain('metaAuthor', $this->httpRequest->post('meta_author'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('meta_copyright'), $oMeta->metaCopyright)) {
         DbConfig::setMetaMain('metaCopyright', $this->httpRequest->post('meta_copyright'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('meta_rating'), $oMeta->metaRating)) {
         DbConfig::setMetaMain('metaRating', $this->httpRequest->post('meta_rating'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('meta_distribution'), $oMeta->metaDistribution)) {
         DbConfig::setMetaMain('metaDistribution', $this->httpRequest->post('meta_distribution'), $sWhereLang);
     }
     if (!$this->str->equals($this->httpRequest->post('meta_category'), $oMeta->metaCategory)) {
         DbConfig::setMetaMain('metaCategory', $this->httpRequest->post('meta_category'), $sWhereLang);
     }
     /* Clean DbConfig Cache */
     (new Framework\Cache\Cache())->start(DbConfig::CACHE_GROUP, null, null)->clear();
     \PFBC\Form::setSuccess('form_meta', t('The Meta Tags was saved successfully!'));
 }
コード例 #15
0
 /**
  * @param integer $iProfileId
  * @param \PH7\UserCoreModel $oUserModel
  * @return void
  */
 public function __construct($iProfileId, UserCoreModel $oUserModel)
 {
     parent::__construct();
     $oGetNotofication = $oUserModel->getNotification($iProfileId);
     if (!$this->str->equals($this->httpRequest->post('enable_newsletters'), $oGetNotofication->enableNewsletters)) {
         $oUserModel->setNotification('enableNewsletters', $this->httpRequest->post('enable_newsletters'), $iProfileId);
     }
     if (!$this->str->equals($this->httpRequest->post('new_msg'), $oGetNotofication->newMsg)) {
         $oUserModel->setNotification('newMsg', $this->httpRequest->post('new_msg'), $iProfileId);
     }
     if (!$this->str->equals($this->httpRequest->post('friend_request'), $oGetNotofication->friendRequest)) {
         $oUserModel->setNotification('friendRequest', $this->httpRequest->post('friend_request'), $iProfileId);
     }
     unset($oUserModel);
     /* Clean UserCoreModel Cache */
     (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'notification' . $iProfileId, null)->clear()->start(UserCoreModel::CACHE_GROUP, 'isNotification' . $iProfileId, null)->clear();
     \PFBC\Form::setSuccess('form_notification', t('Your notifications settings have been saved successfully!'));
 }
コード例 #16
0
 /**
  * @param integer $iProfileId
  * @param \PH7\UserCoreModel $oUserModel
  * @return void
  */
 public function __construct($iProfileId, UserCoreModel $oUserModel)
 {
     parent::__construct();
     $oGetPrivacy = $oUserModel->getPrivacySetting($iProfileId);
     if (!$this->str->equals($this->httpRequest->post('privacy_profile'), $oGetPrivacy->privacyProfile)) {
         $oUserModel->updatePrivacySetting('privacyProfile', $this->httpRequest->post('privacy_profile'), $iProfileId);
     }
     if (!$this->str->equals($this->httpRequest->post('search_profile'), $oGetPrivacy->searchProfile)) {
         $oUserModel->updatePrivacySetting('searchProfile', $this->httpRequest->post('search_profile'), $iProfileId);
     }
     if (!$this->str->equals($this->httpRequest->post('user_save_views'), $oGetPrivacy->userSaveViews)) {
         $oUserModel->updatePrivacySetting('userSaveViews', $this->httpRequest->post('user_save_views'), $iProfileId);
     }
     if (!$this->str->equals($this->httpRequest->post('user_status'), $oUserModel->getUserStatus($iProfileId))) {
         $oUserModel->setUserStatus($iProfileId, $this->httpRequest->post('user_status'));
     }
     /* Clean UserCoreModel Cache */
     (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'privacySetting' . $iProfileId, null)->clear()->start(UserCoreModel::CACHE_GROUP, 'userStatus' . $iProfileId, null)->clear();
     \PFBC\Form::setSuccess('form_privacy_account', t('Your privacy settings have been saved successfully!'));
 }
コード例 #17
0
 public function __construct()
 {
     parent::__construct();
     $iApproved = AdminCore::auth() || DbConfig::getSetting('avatarManualApproval') == 0 ? '1' : '0';
     if (AdminCore::auth() && !User::auth() && $this->httpRequest->getExists(array('profile_id', 'username'))) {
         $iProfileId = $this->httpRequest->get('profile_id');
         $sUsername = $this->httpRequest->get('username');
     } else {
         $iProfileId = $this->session->get('member_id');
         $sUsername = $this->session->get('member_username');
     }
     $bAvatar = (new UserCore())->setAvatar($iProfileId, $sUsername, $_FILES['avatar']['tmp_name'], $iApproved);
     if (!$bAvatar) {
         \PFBC\Form::setError('form_avatar', Form::wrongImgFileTypeMsg());
     } else {
         $sModerationText = t('Your avatar has been received! But it will be visible once approved by our moderators. Please do not send a new avatar because this is useless!');
         $sText = t('Your avatar has been updated successfully!');
         $sMsg = $iApproved == '0' ? $sModerationText : $sText;
         \PFBC\Form::setSuccess('form_avatar', $sMsg);
     }
 }
コード例 #18
0
 public function __construct()
 {
     parent::__construct();
     $iApproved = AdminCore::auth() || DbConfig::getSetting('profileBackgroundManualApproval') == 0 ? '1' : '0';
     if (AdminCore::auth() && !User::auth() && $this->httpRequest->getExists(array('profile_id', 'username'))) {
         $iProfileId = $this->httpRequest->get('profile_id');
         $sUsername = $this->httpRequest->get('username');
     } else {
         $iProfileId = $this->session->get('member_id');
         $sUsername = $this->session->get('member_username');
     }
     $bWallpaper = (new UserCore())->setBackground($iProfileId, $sUsername, $_FILES['wallpaper']['tmp_name'], $iApproved);
     if (!$bWallpaper) {
         \PFBC\Form::setError('form_design', Form::wrongImgFileTypeMsg());
     } else {
         $sModerationText = t('Your Wallpaper has been received! But it will not be visible until it is approved by our moderators. Please do not send a new not.');
         $sText = t('Your Wallpaper has been updated successfully!');
         $sMsg = DbConfig::getSetting('profileBackgroundManualApproval') ? $sModerationText : $sText;
         \PFBC\Form::setSuccess('form_design', $sMsg);
     }
 }
コード例 #19
0
 public function __construct()
 {
     parent::__construct();
     $oSubscriptionModel = new SubscriptionModel();
     $sEmail = $this->httpRequest->post('email');
     $sName = $this->httpRequest->post('name');
     $bIsSubscriber = (new ExistsCoreModel())->email($sEmail, 'Subscribers');
     switch ($this->httpRequest->post('direction')) {
         case 'subscrire':
             if (!$bIsSubscriber) {
                 $aData = ['name' => $sName, 'email' => $sEmail, 'current_date' => (new CDateTime())->get()->dateTime('Y-m-d H:i:s'), 'ip' => Ip::get(), 'hash_validation' => Various::genRnd(), 'active' => '0', 'affiliated_id' => (int) (new Cookie())->get(AffiliateCore::COOKIE_NAME)];
                 $sActivateLink = Uri::get('newsletter', 'home', 'activate') . PH7_SH . $aData['email'] . PH7_SH . $aData['hash_validation'];
                 $this->view->content = t('Hi %0%!', $aData['name']) . '<br />' . t("Welcome to %site_name%'s Subscription!") . '<br />' . t('Activation link: %0%.', '<a href="' . $sActivateLink . '">' . $sActivateLink . '</a>');
                 $this->view->footer = t('You are receiving this mail because we received an application for registration with the email "%0%" has been provided in the form of %site_name% (%site_url%).', $aData['email']) . '<br />' . t('If you think someone has used your email address without your knowledge to create an account on %site_name%, please contact us using our contact form available on our website.');
                 $sMessageHtml = $this->view->parseMail(PH7_PATH_SYS . 'global/' . PH7_VIEWS . PH7_TPL_NAME . '/mail/sys/mod/newsletter/registration.tpl', $sEmail);
                 $aInfo = ['subject' => t('Confirm you email address!'), 'to' => $sEmail];
                 if ((new Mail())->send($aInfo, $sMessageHtml)) {
                     \PFBC\Form::setSuccess('form_subscription', t('Please activate your subscription by clicking the activation link you received by email. If you can not find the email, please look in your SPAM FOLDER and mark as not spam.'));
                     $oSubscriptionModel->add($aData);
                 } else {
                     \PFBC\Form::setError('form_subscription', Form::errorSendingEmail());
                 }
             } else {
                 \PFBC\Form::setError('form_subscription', t('Oops! You are already subscribed to our newsletter.'));
             }
             break;
         case 'unsubscribe':
             if ($bIsSubscriber) {
                 $oSubscriptionModel->unsubscribe($sEmail);
                 \PFBC\Form::setSuccess('form_subscription', t('Your subscription was successfully canceled.'));
             } else {
                 \PFBC\Form::setError('form_subscription', t('We have not found any subscriber with the email address.'));
             }
             break;
         default:
             Framework\Http\Http::setHeadersByCode(400);
             exit('Bad Request Error!');
     }
     unset($oSubscriptionModel);
 }
コード例 #20
0
 public function __construct()
 {
     parent::__construct();
     $oAffModel = new AffiliateModel();
     $iProfileId = AdminCore::auth() && !Affiliate::auth() && $this->httpRequest->getExists('profile_id') ? $this->httpRequest->get('profile_id', 'int') : $this->session->get('affiliate_id');
     $oAff = $oAffModel->readProfile($iProfileId, 'Affiliates');
     if (!$this->str->equals($this->httpRequest->post('first_name'), $oAff->firstName)) {
         $oAffModel->updateProfile('firstName', $this->httpRequest->post('first_name'), $iProfileId, 'Affiliates');
         $this->session->set('affiliate_first_name', $this->httpRequest->post('first_name'));
         (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'firstName' . $iProfileId . 'Affiliates', null)->clear();
     }
     if (!$this->str->equals($this->httpRequest->post('last_name'), $oAff->lastName)) {
         $oAffModel->updateProfile('lastName', $this->httpRequest->post('last_name'), $iProfileId, 'Affiliates');
     }
     if (!$this->str->equals($this->httpRequest->post('sex'), $oAff->sex)) {
         $oAffModel->updateProfile('sex', $this->httpRequest->post('sex'), $iProfileId, 'Affiliates');
         $this->session->set('affiliate_sex', $this->httpRequest->post('sex'));
         (new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, 'sex' . $iProfileId . 'Affiliates', null)->clear();
     }
     if (!$this->str->equals($this->dateTime->get($this->httpRequest->post('birth_date'))->date('Y-m-d'), $oAff->birthDate)) {
         $oAffModel->updateProfile('birthDate', $this->dateTime->get($this->httpRequest->post('birth_date'))->date('Y-m-d'), $iProfileId, 'Affiliates');
     }
     // Update dynamic fields.
     $oFields = $oAffModel->getInfoFields($iProfileId, 'AffiliatesInfo');
     foreach ($oFields as $sColumn => $sValue) {
         $sHRParam = $sColumn == 'description' ? Http::ONLY_XSS_CLEAN : null;
         if (!$this->str->equals($this->httpRequest->post($sColumn, $sHRParam), $sValue)) {
             $oAffModel->updateProfile($sColumn, $this->httpRequest->post($sColumn, $sHRParam), $iProfileId, 'AffiliatesInfo');
         }
     }
     unset($oFields);
     $oAffModel->setLastEdit($iProfileId, 'Affiliates');
     $oAffCache = new Affiliate();
     $oAffCache->clearReadProfileCache($iProfileId, 'Affiliates');
     $oAffCache->clearInfoFieldCache($iProfileId, 'AffiliatesInfo');
     unset($oAffModel, $oAff, $oAffCache);
     \PFBC\Form::setSuccess('form_aff_edit_account', t('Your profile has been saved successfully!'));
 }
コード例 #21
0
 public function step1()
 {
     $sBirthDate = $this->dateTime->get($this->httpRequest->post('birth_date'))->date('Y-m-d');
     $iAffId = (int) (new Cookie())->get(AffiliateCore::COOKIE_NAME);
     $aData = ['email' => $this->httpRequest->post('mail'), 'username' => $this->httpRequest->post('username'), 'password' => $this->httpRequest->post('password'), 'first_name' => $this->httpRequest->post('first_name'), 'last_name' => $this->httpRequest->post('last_name'), 'sex' => $this->httpRequest->post('sex'), 'birth_date' => $sBirthDate, 'country' => $this->httpRequest->post('country'), 'city' => $this->httpRequest->post('city'), 'state' => $this->httpRequest->post('state'), 'zip_code' => $this->httpRequest->post('zip_code'), 'ip' => Ip::get(), 'hash_validation' => Various::genRnd(), 'current_date' => (new CDateTime())->get()->dateTime('Y-m-d H:i:s'), 'is_active' => $this->iActiveType, 'affiliated_id' => $iAffId];
     $oAffModel = new AffiliateModel();
     $iTimeDelay = (int) DbConfig::getSetting('timeDelayUserRegistration');
     if (!$oAffModel->checkWaitJoin($aData['ip'], $iTimeDelay, $aData['current_date'], 'Affiliates')) {
         \PFBC\Form::setError('form_join_aff', Form::waitRegistrationMsg($iTimeDelay));
     } elseif (!$oAffModel->join($aData)) {
         \PFBC\Form::setError('form_join_aff', 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!
         /** 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 an email and sets the welcome message.
         \PFBC\Form::setSuccess('form_join_aff', t('Your affiliate account has been created! %0%', (new Registration())->sendMail($aData)->getMsg()));
     }
     unset($oAffModel);
 }
 public function __construct($sTable)
 {
     parent::__construct();
     $sMail = $this->httpRequest->post('mail');
     if (!(new ExistsCoreModel())->email($sMail, $sTable)) {
         \PFBC\Form::setError('form_resend_activation', t('Oops, this "%0%" is not associated with any %site_name% account. Please, make sure that you entered the e-mail address used in creating your account.', escape(substr($sMail, 0, PH7_MAX_EMAIL_LENGTH))));
     } else {
         if (!($mHash = (new UserCoreModel())->getHashValidation($sMail))) {
             \PFBC\Form::setError('form_resend_activation', t('Oops! Your account is already activated.'));
         } else {
             $sMod = $sTable == 'Affiliates' ? 'affiliate' : 'user';
             $sActivateLink = Uri::get($sMod, 'account', 'activate') . PH7_SH . $mHash->email . PH7_SH . $mHash->hashValidation;
             $this->view->content = t('Welcome to %site_name%, %0%!', $mHash->firstName) . '<br />' . t('Hello %0% - We are proud to welcome you as a member of %site_name%!', $mHash->firstName) . '<br />' . t('Your hash validation is <em>"%0%"</em>.', '<a href="' . $sActivateLink . '">' . $sActivateLink . '</a>') . '<br />' . t('Please save the following information for future refenrence:') . '<br /><em>' . t('Email: ') . $mHash->email . '.<br />' . t('Username: '******'.<br />' . t('Password: ***** (This field is hidden to protect against theft of your account).') . '.</em>';
             $this->view->footer = t('You are receiving this mail because we received an application for registration with the email "%0%" has been provided in the form of %site_name% (%site_url%).', $mHash->email) . '<br />' . t('If you think someone has used your email address without your knowledge to create an account on %site_name%, please contact us using our contact form available on our website.');
             $sMessageHtml = $this->view->parseMail(PH7_PATH_SYS . 'global/' . PH7_VIEWS . PH7_TPL_NAME . '/mail/sys/core/resend_activation.tpl', $mHash->email);
             $aInfo = ['to' => $mHash->email, 'subject' => t('Your new password - %site_name%')];
             if (!(new Mail())->send($aInfo, $sMessageHtml)) {
                 \PFBC\Form::setError('form_resend_activation', Form::errorSendingEmail());
             } else {
                 \PFBC\Form::setSuccess('form_resend_activation', t('Your hash validation has been emailed to you.'));
             }
         }
     }
 }
コード例 #23
0
 public function __construct()
 {
     parent::__construct();
     $aTo = explode(',', $this->httpRequest->post('to'));
     if (count($aTo) > 10) {
         \PFBC\Form::setError('form_invite', t('To prevent spam, you cannot put more than 10 email addresses at a time.'));
     } else {
         foreach ($aTo as $sMail) {
             if (!(new Validate())->email($sMail)) {
                 \PFBC\Form::setError('form_invite', t('One or more email addresses are invalid!'));
             } else {
                 $this->view->content = t('Hello!<br />You have received a privilege on the invitation from your friend on the new platform to meet new generation - %site_name%') . '<br />' . '<strong><a href="' . Uri::get('user', 'signup', 'step1', '?ref=invitation') . '">' . t('Get exclusive privilege to join your friend is waiting for you!') . '</a></strong><br />' . t('Message left by your friend:') . '<br />"<em>' . $this->httpRequest->post('message') . '</em>"';
                 $this->view->footer = t('You are receiving this message because "%0%" you know has entered your email address in the form of invitation of friends to our site. This is not spam!', $this->httpRequest->post('first_name'));
                 $sMessageHtml = $this->view->parseMail(PH7_PATH_SYS . 'global/' . PH7_VIEWS . PH7_TPL_NAME . '/mail/sys/mod/invite/invitation.tpl', $sMail);
                 $aInfo = ['to' => $sMail, 'subject' => t('Privilege on the invitation from your friend for the new generation community platform - %site_name%')];
                 if (!(new Mail())->send($aInfo, $sMessageHtml)) {
                     \PFBC\Form::setError('form_invite', Form::errorSendingEmail());
                 } else {
                     \PFBC\Form::setSuccess('form_invite', t('Cool! We have sent that.'));
                 }
             }
         }
     }
 }
コード例 #24
0
 public function __construct()
 {
     parent::__construct();
     /********** General Settings **********/
     if (!$this->str->equals($this->httpRequest->post('site_name'), DbConfig::getSetting('siteName'))) {
         DbConfig::setSetting($this->httpRequest->post('site_name'), 'siteName');
     }
     if (!$this->str->equals($this->httpRequest->post('default_template'), DbConfig::getSetting('defaultTemplate'))) {
         DbConfig::setSetting($this->httpRequest->post('default_template'), 'defaultTemplate');
     }
     if (!$this->str->equals($this->httpRequest->post('default_language'), DbConfig::getSetting('defaultLanguage'))) {
         DbConfig::setSetting($this->httpRequest->post('default_language'), 'defaultLanguage');
     }
     if (!$this->str->equals($this->httpRequest->post('map_type'), DbConfig::getSetting('mapType'))) {
         DbConfig::setSetting($this->httpRequest->post('map_type'), 'mapType');
     }
     if (!$this->str->equals($this->httpRequest->post('splash_page'), DbConfig::getSetting('splashPage'))) {
         DbConfig::setSetting($this->httpRequest->post('splash_page'), 'splashPage');
     }
     if (!$this->str->equals($this->httpRequest->post('bg_splash_vid'), DbConfig::getSetting('bgSplashVideo'))) {
         DbConfig::setSetting($this->httpRequest->post('bg_splash_vid'), 'bgSplashVideo');
     }
     if (!$this->str->equals($this->httpRequest->post('full_ajax_site'), DbConfig::getSetting('fullAjaxSite'))) {
         DbConfig::setSetting($this->httpRequest->post('full_ajax_site'), 'fullAjaxSite');
     }
     if (!$this->str->equals($this->httpRequest->post('site_status'), DbConfig::getSetting('siteStatus'))) {
         DbConfig::setSiteMode($this->httpRequest->post('site_status'));
     }
     if (!$this->str->equals($this->httpRequest->post('disclaimer'), DbConfig::getSetting('disclaimer'))) {
         DbConfig::setSetting($this->httpRequest->post('disclaimer'), 'disclaimer');
     }
     if (!$this->str->equals($this->httpRequest->post('cookie_consent_bar'), DbConfig::getSetting('cookieConsentBar'))) {
         DbConfig::setSetting($this->httpRequest->post('cookie_consent_bar'), 'cookieConsentBar');
     }
     if (!$this->str->equals($this->httpRequest->post('is_software_news_feed'), DbConfig::getSetting('isSoftwareNewsFeed'))) {
         DbConfig::setSetting($this->httpRequest->post('is_software_news_feed'), 'isSoftwareNewsFeed');
     }
     /********** Logo Settings **********/
     if (!empty($_FILES['logo']['tmp_name'])) {
         $oLogo = new Framework\Image\Image($_FILES['logo']['tmp_name']);
         if (!$oLogo->validate()) {
             \PFBC\Form::setError('form_setting', Form::wrongImgFileTypeMsg());
             $this->bIsErr = true;
         } else {
             /*
              * The method deleteFile first test if the file exists, if so it delete the file.
              */
             $sPathName = PH7_PATH_TPL . PH7_TPL_NAME . PH7_DS . PH7_IMG . 'logo.png';
             $this->file->deleteFile($sPathName);
             // It erases the old logo.
             $oLogo->dynamicResize(250, 60);
             $oLogo->save($sPathName);
             // Clear CSS cache, because the logo is storaged with data URI in the CSS cache file
             $this->file->deleteDir(PH7_PATH_CACHE . Framework\Layout\Gzip::CACHE_DIR);
             // Clear the Web browser cache
             (new Framework\Navigation\Browser())->noCache();
         }
     }
     /********** Email **********/
     if (!$this->str->equals($this->httpRequest->post('email_name'), DbConfig::getSetting('emailName'))) {
         DbConfig::setSetting($this->httpRequest->post('email_name'), 'emailName');
     }
     if (!$this->str->equals($this->httpRequest->post('admin_email'), DbConfig::getSetting('adminEmail'))) {
         DbConfig::setSetting($this->httpRequest->post('admin_email'), 'adminEmail');
     }
     if (!$this->str->equals($this->httpRequest->post('feedback_email'), DbConfig::getSetting('feedbackEmail'))) {
         DbConfig::setSetting($this->httpRequest->post('feedback_email'), 'feedbackEmail');
     }
     if (!$this->str->equals($this->httpRequest->post('return_email'), DbConfig::getSetting('returnEmail'))) {
         DbConfig::setSetting($this->httpRequest->post('return_email'), 'returnEmail');
     }
     /********** Registration **********/
     if (!$this->str->equals($this->httpRequest->post('user_activation_type'), DbConfig::getSetting('userActivationType'))) {
         DbConfig::setSetting($this->httpRequest->post('user_activation_type'), 'userActivationType');
     }
     if (!$this->str->equals($this->httpRequest->post('aff_activation_type'), DbConfig::getSetting('affActivationType'))) {
         DbConfig::setSetting($this->httpRequest->post('aff_activation_type'), 'affActivationType');
     }
     if (!$this->str->equals($this->httpRequest->post('min_username_length'), DbConfig::getSetting('minUsernameLength'))) {
         $iMaxUsernameLength = DbConfig::getSetting('maxUsernameLength') - 1;
         if ($this->httpRequest->post('min_username_length') > $iMaxUsernameLength) {
             \PFBC\Form::setError('form_setting', t('The minimum length of the username cannot exceed %0% characters.', $iMaxUsernameLength));
             $this->bIsErr = true;
         } else {
             DbConfig::setSetting($this->httpRequest->post('min_username_length'), 'minUsernameLength');
         }
     }
     if (!$this->str->equals($this->httpRequest->post('max_username_length'), DbConfig::getSetting('maxUsernameLength'))) {
         if ($this->httpRequest->post('max_username_length') > PH7_MAX_USERNAME_LENGTH) {
             \PFBC\Form::setError('form_setting', t('The maximum length of the username cannot exceed %0% characters.', PH7_MAX_USERNAME_LENGTH));
             $this->bIsErr = true;
         } else {
             DbConfig::setSetting($this->httpRequest->post('max_username_length'), 'maxUsernameLength');
         }
     }
     if (!$this->str->equals($this->httpRequest->post('min_age_registration'), DbConfig::getSetting('minAgeRegistration'))) {
         if ($this->httpRequest->post('min_age_registration') >= DbConfig::getSetting('maxAgeRegistration')) {
             \PFBC\Form::setError('form_setting', t('You cannot specify a minimum age higher than the maximum age.'));
             $this->bIsErr = true;
         } else {
             DbConfig::setSetting($this->httpRequest->post('min_age_registration'), 'minAgeRegistration');
         }
     }
     if (!$this->str->equals($this->httpRequest->post('max_age_registration'), DbConfig::getSetting('maxAgeRegistration'))) {
         DbConfig::setSetting($this->httpRequest->post('max_age_registration'), 'maxAgeRegistration');
     }
     if (!$this->str->equals($this->httpRequest->post('default_membership_group_id'), DbConfig::getSetting('defaultMembershipGroupId'))) {
         DbConfig::setSetting($this->httpRequest->post('default_membership_group_id'), 'defaultMembershipGroupId');
     }
     /********** Picture and Video **********/
     // Image
     if (!$this->str->equals($this->httpRequest->post('watermark_text_image'), DbConfig::getSetting('watermarkTextImage'))) {
         DbConfig::setSetting($this->httpRequest->post('watermark_text_image'), 'watermarkTextImage');
     }
     if (!$this->str->equals($this->httpRequest->post('size_watermark_text_image'), DbConfig::getSetting('sizeWatermarkTextImage')) && ($this->httpRequest->post('size_watermark_text_image') >= 0 && $this->httpRequest->post('size_watermark_text_image') <= 5)) {
         DbConfig::setSetting($this->httpRequest->post('size_watermark_text_image'), 'sizeWatermarkTextImage');
     }
     // Video
     if (!$this->str->equals($this->httpRequest->post('default_video'), DbConfig::getSetting('defaultVideo'))) {
         DbConfig::setSetting($this->httpRequest->post('default_video'), 'defaultVideo');
     }
     if (!$this->str->equals($this->httpRequest->post('autoplay_video'), DbConfig::getSetting('autoplayVideo'))) {
         DbConfig::setSetting($this->httpRequest->post('autoplay_video'), 'autoplayVideo');
     }
     /********** Moderation **********/
     if (!$this->str->equals($this->httpRequest->post('avatar_manual_approval'), DbConfig::getSetting('avatarManualApproval'))) {
         DbConfig::setSetting($this->httpRequest->post('avatar_manual_approval'), 'avatarManualApproval');
     }
     if (!$this->str->equals($this->httpRequest->post('profile_background_manual_approval'), DbConfig::getSetting('profileBackgroundManualApproval'))) {
         DbConfig::setSetting($this->httpRequest->post('profile_background_manual_approval'), 'profileBackgroundManualApproval');
     }
     if (!$this->str->equals($this->httpRequest->post('note_manual_approval'), DbConfig::getSetting('noteManualApproval'))) {
         DbConfig::setSetting($this->httpRequest->post('note_manual_approval'), 'noteManualApproval');
     }
     if (!$this->str->equals($this->httpRequest->post('picture_manual_approval'), DbConfig::getSetting('pictureManualApproval'))) {
         DbConfig::setSetting($this->httpRequest->post('picture_manual_approval'), 'pictureManualApproval');
     }
     if (!$this->str->equals($this->httpRequest->post('video_manual_approval'), DbConfig::getSetting('videoManualApproval'))) {
         DbConfig::setSetting($this->httpRequest->post('video_manual_approval'), 'videoManualApproval');
     }
     if (!$this->str->equals($this->httpRequest->post('webcam_picture_manual_approval'), DbConfig::getSetting('webcamPictureManualApproval'))) {
         DbConfig::setSetting($this->httpRequest->post('webcam_picture_manual_approval'), 'webcamPictureManualApproval');
     }
     /********** Security **********/
     if (!$this->str->equals($this->httpRequest->post('min_password_length'), DbConfig::getSetting('minPasswordLength'))) {
         DbConfig::setSetting($this->httpRequest->post('min_password_length'), 'minPasswordLength');
     }
     if (!$this->str->equals($this->httpRequest->post('max_password_length'), DbConfig::getSetting('maxPasswordLength'))) {
         DbConfig::setSetting($this->httpRequest->post('max_password_length'), 'maxPasswordLength');
     }
     if (!$this->str->equals($this->httpRequest->post('is_user_login_attempt'), DbConfig::getSetting('isUserLoginAttempt'))) {
         DbConfig::setSetting($this->httpRequest->post('is_user_login_attempt'), 'isUserLoginAttempt');
     }
     if (!$this->str->equals($this->httpRequest->post('is_affiliate_login_attempt'), DbConfig::getSetting('isAffiliateLoginAttempt'))) {
         DbConfig::setSetting($this->httpRequest->post('is_affiliate_login_attempt'), 'isAffiliateLoginAttempt');
     }
     if (!$this->str->equals($this->httpRequest->post('is_admin_login_attempt'), DbConfig::getSetting('isAdminLoginAttempt'))) {
         DbConfig::setSetting($this->httpRequest->post('is_admin_login_attempt'), 'isAdminLoginAttempt');
     }
     if (!$this->str->equals($this->httpRequest->post('max_user_login_attempts'), DbConfig::getSetting('maxUserLoginAttempts'))) {
         DbConfig::setSetting($this->httpRequest->post('max_user_login_attempts'), 'maxUserLoginAttempts');
     }
     if (!$this->str->equals($this->httpRequest->post('max_affiliate_login_attempts'), DbConfig::getSetting('maxAffiliateLoginAttempts'))) {
         DbConfig::setSetting($this->httpRequest->post('max_affiliate_login_attempts'), 'maxAffiliateLoginAttempts');
     }
     if (!$this->str->equals($this->httpRequest->post('max_admin_login_attempts'), DbConfig::getSetting('maxAdminLoginAttempts'))) {
         DbConfig::setSetting($this->httpRequest->post('max_admin_login_attempts'), 'maxAdminLoginAttempts');
     }
     if (!$this->str->equals($this->httpRequest->post('login_user_attempt_time'), DbConfig::getSetting('loginUserAttemptTime'))) {
         DbConfig::setSetting($this->httpRequest->post('login_user_attempt_time'), 'loginUserAttemptTime');
     }
     if (!$this->str->equals($this->httpRequest->post('login_affiliate_attempt_time'), DbConfig::getSetting('loginAffiliateAttemptTime'))) {
         DbConfig::setSetting($this->httpRequest->post('login_affiliate_attempt_time'), 'loginAffiliateAttemptTime');
     }
     if (!$this->str->equals($this->httpRequest->post('login_admin_attempt_time'), DbConfig::getSetting('loginAdminAttemptTime'))) {
         DbConfig::setSetting($this->httpRequest->post('login_admin_attempt_time'), 'loginAdminAttemptTime');
     }
     if (!$this->str->equals($this->httpRequest->post('send_report_mail'), DbConfig::getSetting('sendReportMail'))) {
         DbConfig::setSetting($this->httpRequest->post('send_report_mail'), 'sendReportMail');
     }
     if (!$this->str->equals($this->httpRequest->post('ip_login'), DbConfig::getSetting('ipLogin'))) {
         DbConfig::setSetting($this->httpRequest->post('ip_login'), 'ipLogin');
     }
     if (!$this->str->equals($this->httpRequest->post('ban_word_replace'), DbConfig::getSetting('banWordReplace'))) {
         DbConfig::setSetting($this->httpRequest->post('ban_word_replace'), 'banWordReplace');
     }
     if (!$this->str->equals($this->httpRequest->post('security_token'), DbConfig::getSetting('securityToken'))) {
         DbConfig::setSetting($this->httpRequest->post('security_token'), 'securityToken');
     }
     $iSecTokenLifetime = (int) $this->httpRequest->post('security_token_lifetime');
     if (!$this->str->equals($iSecTokenLifetime, DbConfig::getSetting('securityTokenLifetime'))) {
         if ($iSecTokenLifetime < 10) {
             \PFBC\Form::setError('form_setting', t('The token lifetime cannot be below 10 seconds.'));
             $this->bIsErr = true;
         } else {
             DbConfig::setSetting($iSecTokenLifetime, 'securityTokenLifetime');
         }
     }
     if (!$this->str->equals($this->httpRequest->post('stop_DDoS'), DbConfig::getSetting('DDoS'))) {
         DbConfig::setSetting($this->httpRequest->post('stop_DDoS'), 'DDoS');
     }
     /********** Spam **********/
     // Time Delay
     if (!$this->str->equals($this->httpRequest->post('time_delay_user_registration'), DbConfig::getSetting('timeDelayUserRegistration'))) {
         DbConfig::setSetting($this->httpRequest->post('time_delay_user_registration'), 'timeDelayUserRegistration');
     }
     if (!$this->str->equals($this->httpRequest->post('time_delay_aff_registration'), DbConfig::getSetting('timeDelayAffRegistration'))) {
         DbConfig::setSetting($this->httpRequest->post('time_delay_aff_registration'), 'timeDelayAffRegistration');
     }
     if (!$this->str->equals($this->httpRequest->post('time_delay_send_note'), DbConfig::getSetting('timeDelaySendNote'))) {
         DbConfig::setSetting($this->httpRequest->post('time_delay_send_note'), 'timeDelaySendNote');
     }
     if (!$this->str->equals($this->httpRequest->post('time_delay_send_mail'), DbConfig::getSetting('timeDelaySendMail'))) {
         DbConfig::setSetting($this->httpRequest->post('time_delay_send_mail'), 'timeDelaySendMail');
     }
     if (!$this->str->equals($this->httpRequest->post('time_delay_send_comment'), DbConfig::getSetting('timeDelaySendComment'))) {
         DbConfig::setSetting($this->httpRequest->post('time_delay_send_comment'), 'timeDelaySendComment');
     }
     if (!$this->str->equals($this->httpRequest->post('time_delay_send_forum_topic'), DbConfig::getSetting('timeDelaySendForumTopic'))) {
         DbConfig::setSetting($this->httpRequest->post('time_delay_send_forum_topic'), 'timeDelaySendForumTopic');
     }
     if (!$this->str->equals($this->httpRequest->post('time_delay_send_forum_msg'), DbConfig::getSetting('timeDelaySendForumMsg'))) {
         DbConfig::setSetting($this->httpRequest->post('time_delay_send_forum_msg'), 'timeDelaySendForumMsg');
     }
     // Captcha
     if (!$this->str->equals($this->httpRequest->post('is_captcha_user_signup'), DbConfig::getSetting('isCaptchaUserSignup'))) {
         DbConfig::setSetting($this->httpRequest->post('is_captcha_user_signup'), 'isCaptchaUserSignup');
     }
     if (!$this->str->equals($this->httpRequest->post('is_captcha_affiliate_signup'), DbConfig::getSetting('isCaptchaAffiliateSignup'))) {
         DbConfig::setSetting($this->httpRequest->post('is_captcha_affiliate_signup'), 'isCaptchaAffiliateSignup');
     }
     if (!$this->str->equals($this->httpRequest->post('is_captcha_mail'), DbConfig::getSetting('isCaptchaMail'))) {
         DbConfig::setSetting($this->httpRequest->post('is_captcha_mail'), 'isCaptchaMail');
     }
     if (!$this->str->equals($this->httpRequest->post('is_captcha_comment'), DbConfig::getSetting('isCaptchaComment'))) {
         DbConfig::setSetting($this->httpRequest->post('is_captcha_comment'), 'isCaptchaComment');
     }
     if (!$this->str->equals($this->httpRequest->post('is_captcha_forum'), DbConfig::getSetting('isCaptchaForum'))) {
         DbConfig::setSetting($this->httpRequest->post('is_captcha_forum'), 'isCaptchaForum');
     }
     if (!$this->str->equals($this->httpRequest->post('is_captcha_note'), DbConfig::getSetting('isCaptchaNote'))) {
         DbConfig::setSetting($this->httpRequest->post('is_captcha_note'), 'isCaptchaNote');
     }
     if (!$this->str->equals($this->httpRequest->post('clean_msg'), DbConfig::getSetting('cleanMsg'))) {
         DbConfig::setSetting($this->httpRequest->post('clean_msg'), 'cleanMsg');
     }
     if (!$this->str->equals($this->httpRequest->post('clean_comment'), DbConfig::getSetting('cleanComment'))) {
         DbConfig::setSetting($this->httpRequest->post('clean_comment'), 'cleanComment');
     }
     /********** Api **********/
     if (!$this->str->equals($this->httpRequest->post('ip_api'), DbConfig::getSetting('ipApi'))) {
         DbConfig::setSetting($this->httpRequest->post('ip_api'), 'ipApi');
     }
     if (!$this->str->equals($this->httpRequest->post('chat_api'), DbConfig::getSetting('chatApi'))) {
         DbConfig::setSetting($this->httpRequest->post('chat_api'), 'chatApi');
     }
     if (!$this->str->equals($this->httpRequest->post('chatroulette_api'), DbConfig::getSetting('chatrouletteApi'))) {
         DbConfig::setSetting($this->httpRequest->post('chatroulette_api'), 'chatrouletteApi');
     }
     /********** Automation **********/
     if (!$this->str->equals($this->httpRequest->post('cron_security_hash'), DbConfig::getSetting('cronSecurityHash'))) {
         DbConfig::setSetting($this->httpRequest->post('cron_security_hash'), 'cronSecurityHash');
     }
     if (!$this->str->equals($this->httpRequest->post('user_timeout'), DbConfig::getSetting('userTimeout'))) {
         DbConfig::setSetting($this->httpRequest->post('user_timeout'), 'userTimeout');
     }
     /* Clean DbConfig Cache */
     (new Framework\Cache\Cache())->start(DbConfig::CACHE_GROUP, null, null)->clear();
     if (!$this->bIsErr) {
         \PFBC\Form::setSuccess('form_setting', t('The configuration was saved successfully!'));
     }
 }