本文整理汇总了PHP中PH7\Framework\Url\HeaderUrl::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP HeaderUrl::redirect方法的具体用法?PHP HeaderUrl::redirect怎么用?PHP HeaderUrl::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PH7\Framework\Url\HeaderUrl
的用法示例。
在下文中一共展示了HeaderUrl::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* @param string $sConfigVar Specify the variable in the INI file where module options. Default module.setting
* @param string $sConfigPath Specify the path of INI file configuration WITHOUT "config.ini". The default value is the current configuration file module. Default NULL
* @return void
*/
public static function display($sConfigVar = 'module.setting', $sConfigPath = null)
{
$sConfigFile = 'config.ini';
$sIniFile = empty($sConfigPath) ? Registry::getInstance()->path_module_config . $sConfigFile : $sConfigPath . $sConfigFile;
$aData = parse_ini_file($sIniFile, true);
$rData = file_get_contents($sIniFile);
if (isset($_POST['submit_config'])) {
if (\PFBC\Form::isValid($_POST['submit_config'])) {
new ConfigFileCoreFormProcess($sConfigVar, $sIniFile);
}
Framework\Url\HeaderUrl::redirect();
}
$oForm = new \PFBC\Form('form_config', 600);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_config', 'form_config'));
$oForm->addElement(new \PFBC\Element\Token('config'));
foreach ($aData[$sConfigVar] as $sKey => $sVal) {
$sLabel = str_replace(array('.', '_'), ' ', $sKey);
$sLabel = (new Str())->upperFirstWords($sLabel);
if (false !== strpos($sKey, 'enable')) {
$oForm->addElement(new \PFBC\Element\Select($sLabel, 'config[' . $sKey . ']', array(1 => t('Enable'), 0 => t('Disable')), array('value' => $sVal)));
} elseif (false !== strpos($sKey, 'email')) {
$oForm->addElement(new \PFBC\Element\Email($sLabel, 'config[' . $sKey . ']', array('value' => $sVal)));
} elseif (ctype_digit($sVal)) {
$oForm->addElement(new \PFBC\Element\Number($sLabel, 'config[' . $sKey . ']', array('value' => $sVal)));
} else {
$oForm->addElement(new \PFBC\Element\Textbox($sLabel, 'config[' . $sKey . ']', array('value' => $sVal)));
}
}
$oForm->addElement(new \PFBC\Element\Button());
$oForm->render();
}
示例2: display
public static function display()
{
if (isset($_POST['submit_admin_edit_account'])) {
if (\PFBC\Form::isValid($_POST['submit_admin_edit_account'])) {
new EditFormProcess();
}
Framework\Url\HeaderUrl::redirect();
}
$oHR = new Http();
// Prohibit other administrators to edit the Root Administrator (ID 1)
$iProfileId = $oHR->getExists('profile_id') && $oHR->get('profile_id', 'int') !== 1 ? $oHR->get('profile_id', 'int') : (new Session())->get('admin_id');
$oAdmin = (new AdminModel())->readProfile($iProfileId, 'Admins');
$oForm = new \PFBC\Form('form_admin_edit_account', 500);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_admin_edit_account', 'form_admin_edit_account'));
$oForm->addElement(new \PFBC\Element\Token('edit_account'));
if ($oHR->getExists('profile_id') && $oHR->get('profile_id', 'int') !== 1) {
$oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="center"><a class="s_button" href="' . Uri::get(PH7_ADMIN_MOD, 'admin', 'browse') . '">' . t('Return to back admins browse') . '</a></p>'));
}
unset($oHR);
$oForm->addElement(new \PFBC\Element\Textbox(t('Username:'), 'username', array('value' => $oAdmin->username, 'required' => 1, 'validation' => new \PFBC\Validation\Str(6, 40))));
$oForm->addElement(new \PFBC\Element\Email(t('Login Email:'), 'mail', array('value' => $oAdmin->email, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('First Name:'), 'first_name', array('value' => $oAdmin->firstName, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20))));
$oForm->addElement(new \PFBC\Element\Textbox(t('Last Name:'), 'last_name', array('value' => $oAdmin->lastName, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20))));
$oForm->addElement(new \PFBC\Element\Radio(t('Sex:'), 'sex', array('male' => t('Male'), 'female' => t('Female')), array('value' => $oAdmin->sex, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Timezone('Time Zone:', 'time_zone', array('value' => $oAdmin->timeZone, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->render();
}
示例3: display
public static function display()
{
if (isset($_POST['submit_add_aff'])) {
if (\PFBC\Form::isValid($_POST['submit_add_aff'])) {
new AddAffiliateFormProcess();
}
Framework\Url\HeaderUrl::redirect();
}
$oForm = new \PFBC\Form('form_add_aff', 550);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_add_aff', 'form_add_aff'));
$oForm->addElement(new \PFBC\Element\Token('add_aff'));
$oForm->addElement(new \PFBC\Element\Username(t('Username:'), 'username', array('required' => 1, 'validation' => new \PFBC\Validation\Username('Affiliates'))));
$oForm->addElement(new \PFBC\Element\Email(t('Login Email:'), 'mail', array('required' => 1, 'validation' => new \PFBC\Validation\CEmail('guest', 'Affiliates'))));
$oForm->addElement(new \PFBC\Element\Password(t('Password:'), 'password', array('required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('First Name:'), 'first_name', array('required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20))));
$oForm->addElement(new \PFBC\Element\Textbox(t('Last Name:'), 'last_name', array('required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20))));
$oForm->addElement(new \PFBC\Element\Textbox(t('Middle Name:'), 'middle_name', array('validation' => new \PFBC\Validation\Str(2, 20))));
$oForm->addElement(new \PFBC\Element\Radio(t('Sex:'), 'sex', array('female' => t('Female'), 'male' => t('Male'), 'couple' => t('Couple')), array('value' => 'female', 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Date(t('Date of birth:'), 'birth_date', array('placeholder' => t('Month/Day/Year'), 'title' => t('Please specify the birth date using the calendar or with this format: Month/Day/Year.'), 'required' => 1, 'validation' => new \PFBC\Validation\BirthDate())));
$oForm->addElement(new \PFBC\Element\Country(t('Country:'), 'country', array('id' => 'str_country', 'value' => Geo::getCountryCode(), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('City:'), 'city', array('id' => 'str_city', 'validation' => new \PFBC\Validation\Str(2, 150), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('State:'), 'state', array('id' => 'str_state', 'validation' => new \PFBC\Validation\Str(2, 150), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('ZIP/Postal Code:'), 'zip_code', array('id' => 'str_zip_code', 'validation' => new \PFBC\Validation\Str(2, 15), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Phone(t('Phone Number:'), 'phone', array('description' => t('Enter full phone number with area code.'), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\CKEditor(t('Description:'), 'description', array('description' => t("Description of the affiliate's site(s)."), 'validation' => new \PFBC\Validation\Str(10, 2000), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Url(t('Website:'), 'website', array('description' => t('Main website where the affiliate is the owner.'), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Email(t('Bank Account:'), 'bank_account', array('description' => t('Bank Account (PayPal Email Address).'), 'validation' => new \PFBC\Validation\BankAccount(), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'geo/autocompleteCity.js"></script>'));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->render();
}
示例4: step2
public static function step2()
{
$oSession = new Session();
if (!$oSession->exists('mail_step1')) {
Framework\Url\HeaderUrl::redirect(Uri::get('user', 'signup', 'step1'));
} elseif ($oSession->exists('mail_step2')) {
HeaderUrl::redirect(Uri::get('user', 'signup', 'step3'));
}
unset($oSession);
if (isset($_POST['submit_join_user2'])) {
if (\PFBC\Form::isValid($_POST['submit_join_user2'])) {
(new JoinFormProcess())->step2();
}
Framework\Url\HeaderUrl::redirect();
}
$oForm = new \PFBC\Form('form_join_user2', 650);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_join_user2', 'form_join_user2'));
$oForm->addElement(new \PFBC\Element\Token('join2'));
$oForm->addElement(new \PFBC\Element\Radio(t('Gender:'), 'sex', array('female' => t('Female') . ' ♀', 'male' => t('Male') . ' ♂', 'couple' => t('Couple')), array('value' => 'female', 'title' => t('Please specify your gender.'), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Checkbox(t('Interested in:'), 'match_sex', array('male' => t('Male') . ' ♂', 'female' => t('Female') . ' ♀', 'couple' => t('Couple')), array('value' => 'male', 'title' => t('Please specify whom you are looking for'), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Date(t('Your Date of birth:'), 'birth_date', array('placeholder' => t('Month/Day/Year'), 'id' => 'birth_date', 'title' => t('Please specify your birth date using the calendar or with this format: Month/Day/Year.'), 'onblur' => 'CValid(this.value, this.id)', 'validation' => new \PFBC\Validation\BirthDate(), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error birth_date"></span>'));
$oForm->addElement(new \PFBC\Element\Country(t('Your Country:'), 'country', array('id' => 'str_country', 'value' => Geo::getCountryCode(), 'title' => t('Select the country where you live.'), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Your City:'), 'city', array('id' => 'str_city', 'value' => Geo::getCity(), 'onblur' => 'CValid(this.value,this.id,2,150)', 'title' => t('Specify the city where you live.'), 'validation' => new \PFBC\Validation\Str(2, 150), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_city"></span>'));
$oForm->addElement(new \PFBC\Element\Textbox(t('Your State or Province:'), 'state', array('id' => 'str_state', 'value' => Geo::getState(), 'onblur' => 'CValid(this.value,this.id,2,150)', 'title' => t('Specify your state.'), 'validation' => new \PFBC\Validation\Str(2, 150), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_state"></span>'));
$oForm->addElement(new \PFBC\Element\Textbox(t('Your ZIP/Postal Code:'), 'zip_code', array('id' => 'str_zip_code', 'value' => Geo::getZipCode(), 'onblur' => 'CValid(this.value,this.id,2,15)', 'title' => t('Enter your post code (Zip).'), 'validation' => new \PFBC\Validation\Str(2, 15), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_zip_code"></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 . 'geo/autocompleteCity.js"></script>'));
$oForm->render();
}
示例5: __construct
public function __construct()
{
parent::__construct();
$iCategoryId = $this->httpRequest->get('category_id', 'int');
(new ForumModel())->updateCategory($iCategoryId, $this->httpRequest->post('title'));
HeaderUrl::redirect(Uri::get('forum', 'forum', 'index'), t('The Category has been updated successfully!'));
}
示例6: __construct
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);
}
示例7: display
public static function display()
{
if (isset($_POST['submit_game'])) {
if (\PFBC\Form::isValid($_POST['submit_game'])) {
new AdminFormProcess();
}
Framework\Url\HeaderUrl::redirect();
}
$oCategoriesData = (new GameModel())->getCategory(null, 0, 500);
$aCategoriesName = array();
foreach ($oCategoriesData as $oId) {
$aCategoriesName[$oId->categoryId] = $oId->name;
}
unset($oCategoriesData);
$sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern'];
$oForm = new \PFBC\Form('form_game', 650);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_game', 'form_game'));
$oForm->addElement(new \PFBC\Element\Token('game'));
$oForm->addElement(new \PFBC\Element\Select(t('Category Name:'), 'category_id', $aCategoriesName, array('required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Name of the Game:'), 'name', array('pattern' => $sTitlePattern, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Title of the Game:'), 'title', array('validation' => new \PFBC\Validation\Str(2, 120), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Description:'), 'description', array('validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Keywords:'), 'keywords', array('validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\File(t('Thumbnail of the Game:'), 'thumb', array('accept' => 'image/*', 'required' => 1)));
$oForm->addElement(new \PFBC\Element\File(t('File of the Game:'), 'file', array('accept' => 'application/x-shockwave-flash', 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->render();
}
示例8: __construct
public function __construct()
{
parent::__construct();
$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'), 'time_zone' => $this->httpRequest->post('time_zone'), 'ip' => Ip::get()];
(new AdminModel())->add($aData);
HeaderUrl::redirect(Uri::get(PH7_ADMIN_MOD, 'admin', 'browse'), t('The administrator has been successfully added.'));
}
示例9: display
public static function display()
{
$sActUrl = Uri::get('newsletter', 'home', 'subscription');
if (isset($_POST['submit_subscription'])) {
if (\PFBC\Form::isValid($_POST['submit_subscription'])) {
new SubscriptionFormProcess();
}
Framework\Url\HeaderUrl::redirect($sActUrl);
}
$oForm = new \PFBC\Form('form_subscription', 350);
$oForm->configure(array('action' => $sActUrl));
$oForm->addElement(new \PFBC\Element\Hidden('submit_subscription', 'form_subscription'));
$oForm->addElement(new \PFBC\Element\Token('subscription'));
$oForm->addElement(new \PFBC\Element\Textbox(t('Your full name:'), 'name', array('id' => 'str_name', 'onblur' => 'CValid(this.value, this.id,4,80)', 'validation' => new \PFBC\Validation\Str(4, 80), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_name"></span>'));
$oForm->addElement(new \PFBC\Element\Email(t('Your email:'), 'email', array('id' => 'email', 'onblur' => 'CValid(this.value, this.id)', 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error email"></span>'));
$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\Hidden('direction', ''));
$oForm->addElement(new \PFBC\Element\Button(t('Subscribe'), 'submit', array('onclick' => '$("#form_subscription [name=direction]").val("subscrire");')));
$oForm->addElement(new \PFBC\Element\Button(t('Unsubscribe'), 'submit', array('onclick' => '$("#form_subscription [name=direction]").val("unsubscribe");')));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>'));
$oForm->render();
}
示例10: __construct
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();
HeaderUrl::redirect(Uri::get('user', 'main', 'soon'), t('You delete account is successfully!'));
}
}
示例11: display
public static function display()
{
if (isset($_POST['submit_add_user'])) {
if (\PFBC\Form::isValid($_POST['submit_add_user'])) {
new AddUserFormProcess();
}
Framework\Url\HeaderUrl::redirect();
}
$oForm = new \PFBC\Form('form_add_user', 550);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_add_user', 'form_add_user'));
$oForm->addElement(new \PFBC\Element\Token('add_user'));
$oForm->addElement(new \PFBC\Element\Username(t('Username:'), 'username', array('required' => 1, 'validation' => new \PFBC\Validation\Username())));
$oForm->addElement(new \PFBC\Element\Email(t('Login Email:'), 'mail', array('required' => 1, 'validation' => new \PFBC\Validation\CEmail('guest'))));
$oForm->addElement(new \PFBC\Element\Password(t('Password:'), 'password', array('required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('First Name:'), 'first_name', array('required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20))));
$oForm->addElement(new \PFBC\Element\Textbox(t('Last Name:'), 'last_name', array('required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20))));
$oForm->addElement(new \PFBC\Element\Textbox(t('Middle Name:'), 'middle_name', array('validation' => new \PFBC\Validation\Str(2, 20))));
$oForm->addElement(new \PFBC\Element\Radio(t('Sex:'), 'sex', array('female' => t('Female'), 'male' => t('Male'), 'couple' => t('Couple')), array('value' => 'female', 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Checkbox(t('Match Sex:'), 'match_sex', array('male' => t('Male'), 'female' => t('Female'), 'couple' => t('Couple')), array('value' => 'male', 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Date(t('Date of birth:'), 'birth_date', array('placeholder' => t('Month/Day/Year'), 'title' => t('Please specify the birth date using the calendar or with this format: Month/Day/Year.'), 'validation' => new \PFBC\Validation\BirthDate(), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Country(t('Country:'), 'country', array('id' => 'str_country', 'value' => Geo::getCountryCode(), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('City:'), 'city', array('id' => 'str_city', 'validation' => new \PFBC\Validation\Str(2, 150), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('State:'), 'state', array('id' => 'str_state', 'validation' => new \PFBC\Validation\Str(2, 150), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('ZIP/Postal Code:'), 'zip_code', array('id' => 'str_zip_code', 'validation' => new \PFBC\Validation\Str(2, 15), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\CKEditor(t('Description:'), 'description', array('validation' => new \PFBC\Validation\Str(10, 2000), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\File(t('Avatar'), 'avatar', array('accept' => 'image/*')));
$oForm->addElement(new \PFBC\Element\Url(t('Your Website:'), 'website'));
$oForm->addElement(new \PFBC\Element\Url(t('Social Network Site:'), 'social_network_site', array('description' => t('The url of your profile Facebook, Twitter, Google+, etc.'))));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'geo/autocompleteCity.js"></script>'));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->render();
}
示例12: display
public static function display()
{
$oUserModel = new UserCoreModel();
$iProfileId = (int) (new Session())->get('member_id');
if (isset($_POST['submit_privacy_account'])) {
if (\PFBC\Form::isValid($_POST['submit_privacy_account'])) {
new PrivacyFormProcess($iProfileId, $oUserModel);
}
Framework\Url\HeaderUrl::redirect();
}
$oPrivacy = $oUserModel->getPrivacySetting($iProfileId);
$oForm = new \PFBC\Form('form_privacy_account', 500);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_privacy_account', 'form_privacy_account'));
$oForm->addElement(new \PFBC\Element\Token('privacy_account'));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<h3><u>' . t('Profile:') . '</u></h3>'));
$oForm->addElement(new \PFBC\Element\Radio(t('Who can view your profile?'), 'privacy_profile', array('all' => t('Everyone (including people who are not %0% members).', Registry::getInstance()->site_name), 'only_members' => t('Only %0% members who are logged in.', Registry::getInstance()->site_name), 'only_me' => t('Only me.')), array('value' => $oPrivacy->privacyProfile, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<h3><u>' . t('Web search engine:') . '</u></h3>'));
$oForm->addElement(new \PFBC\Element\Radio(t('Do you want to be included in search results?'), 'search_profile', array('yes' => t("Yes, include my profile in search results (%site_name%'s search, Google, Bing, Yahoo, etc.)."), 'no' => t('No, do not include my profile in search results.')), array('value' => $oPrivacy->searchProfile, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<h3><u>' . t('Show profile visitors:') . '</u></h3>'));
$oForm->addElement(new \PFBC\Element\Radio(t('Do you want display members who viewed your profile?'), 'user_save_views', array('yes' => t('Yes, display members who viewed my profile (Selecting this option will allow other members to see that you visited their profile).'), 'no' => t('No, don\'t display members who viewed my profile. (Selecting this option will prevent you from seeing who visited your profile).')), array('value' => $oPrivacy->userSaveViews, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<h3><u>' . t('Presence:') . '</u></h3>'));
$oForm->addElement(new \PFBC\Element\Select(t('Your status'), 'user_status', array('1' => t('Online'), '2' => t('Busy'), '3' => t('Away'), '0' => 'Offline'), array('id' => 'status', 'onchange' => 'init_status()', 'value' => $oUserModel->getUserStatus($iProfileId), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<div class="user_status right" id="status_div"></div>'));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<script>$(function(){ init_status() });</script>'));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->render();
}
示例13: display
public static function display()
{
if (isset($_POST['submit_edit_membership'])) {
if (\PFBC\Form::isValid($_POST['submit_edit_membership'])) {
new EditMembershipFormProcess();
}
Framework\Url\HeaderUrl::redirect();
}
$oMembership = (new PaymentModel())->getMemberships((new Http())->get('group_id', 'int'));
$oForm = new \PFBC\Form('form_edit_membership', 600);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_edit_membership', 'form_edit_membership'));
$oForm->addElement(new \PFBC\Element\Token('membership'));
$oForm->addElement(new \PFBC\Element\Textbox(t('Name:'), 'name', array('value' => $oMembership->name, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 64))));
$oForm->addElement(new \PFBC\Element\Textarea(t('Description:'), 'description', array('value' => $oMembership->description, 'required' => 1, 'validation' => new \PFBC\Validation\Str(5, 255))));
$aDefPerms = (include dirname(__DIR__) . '/config/perms.inc.php');
$aDbPerms = unserialize($oMembership->permissions);
$aPerms = array_merge($aDefPerms, $aDbPerms);
// Update new permissions from perms.inc.php file
foreach ($aPerms as $sKey => $sVal) {
$sLabel = (new Str())->upperFirstWords(str_replace('_', ' ', $sKey));
$oForm->addElement(new \PFBC\Element\Select($sLabel, 'perms[' . $sKey . ']', array(1 => t('Yes'), 0 => t('No')), array('value' => $sVal)));
}
unset($aPerms);
$oForm->addElement(new \PFBC\Element\Number(t('Price:'), 'price', array('description' => t('Currency: %0%. 0 = Free. To change the currency, please <a href="%1%">go to settings</a>.', Config::getInstance()->values['module.setting']['currency'], Uri::get('payment', 'admin', 'config')), 'value' => $oMembership->price, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Number(t('Expiration Days:'), 'expiration_days', array('description' => t('0 = Unlimited'), 'value' => $oMembership->expirationDays, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Radio(t('Active:'), 'enable', array(1 => t('Enabled'), 0 => t('Disabled')), array('value' => $oMembership->enable, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Button(t('Update')));
$oForm->render();
}
示例14: __construct
public function __construct()
{
parent::__construct();
$iForumId = $this->httpRequest->get('forum_id', 'int');
(new ForumModel())->updateForum($iForumId, $this->httpRequest->post('category_id'), $this->httpRequest->post('name'), $this->httpRequest->post('description'), $this->dateTime->get()->dateTime('Y-m-d H:i:s'));
HeaderUrl::redirect(Uri::get('forum', 'forum', 'index'), t('Your message has been updated successfully!'));
}
示例15: __construct
public function __construct()
{
parent::__construct();
// Thumbnail
$oImg = new Image($_FILES['thumb']['tmp_name']);
if (!$oImg->validate()) {
\PFBC\Form::setError('form_game', Form::wrongImgFileTypeMsg());
return;
// Stop execution of the method.
}
$sThumbFile = Various::genRnd($oImg->getFileName(), 30) . $oImg->getExt();
$sThumbDir = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'game/img/thumb/';
$oImg->square(60);
$oImg->save($sThumbDir . $sThumbFile);
unset($oImg);
// Game
$sGameFile = Various::genRnd($_FILES['file']['name'], 30) . PH7_DOT . $this->file->getFileExt($_FILES['file']['name']);
$sGameDir = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'game/file/';
// If the folders is not created (games not installed), yet we will create.
$this->file->createDir(array($sThumbDir, $sGameDir));
if (!@move_uploaded_file($_FILES['file']['tmp_name'], $sGameDir . $sGameFile)) {
\PFBC\Form::setError('form_game', t('Impossible to upload the game. If you are the administrator, please check if the folder of games data has the write permission (CHMOD 755).'));
} else {
$aData = ['category_id' => $this->httpRequest->post('category_id', 'int'), 'name' => $this->httpRequest->post('name'), 'title' => $this->httpRequest->post('title'), 'description' => $this->httpRequest->post('description'), 'keywords' => $this->httpRequest->post('keywords'), 'thumb' => $sThumbFile, 'file' => $sGameFile];
(new GameModel())->add($aData);
/* Clean GameModel Cache */
(new Framework\Cache\Cache())->start(GameModel::CACHE_GROUP, null, null)->clear();
HeaderUrl::redirect(Uri::get('game', 'main', 'game', $aData['title'] . ',' . Db::getInstance()->lastInsertId()), t('The game was added successfully!'));
}
}