本文整理汇总了PHP中PFBC\Form::setSuccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::setSuccess方法的具体用法?PHP Form::setSuccess怎么用?PHP Form::setSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFBC\Form
的用法示例。
在下文中一共展示了Form::setSuccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
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: __construct
/**
* @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!'));
}