本文整理汇总了PHP中PH7\Framework\Url\Header类的典型用法代码示例。如果您正苦于以下问题:PHP Header类的具体用法?PHP Header怎么用?PHP Header使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Header类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public static function display()
{
if (isset($_POST['submit_module'])) {
if (\PFBC\Form::isValid($_POST['submit_module'])) {
new DisableModuleFormProcess();
}
Framework\Url\Header::redirect();
}
$oModuleData = (new ModuleModel())->get();
$aModuleNames = [];
$aSelectedMods = [];
foreach ($oModuleData as $oId) {
if ((int) $oId->enabled === 1) {
$aSelectedMods[] = $oId->moduleId;
}
$aModuleNames[$oId->moduleId] = ucwords(str_replace(['-', '_'], ' ', $oId->folderName));
}
$oForm = new \PFBC\Form('form_module');
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_module', 'form_module'));
$oForm->addElement(new \PFBC\Element\Token('module'));
$oForm->addElement(new \PFBC\Element\Checkbox('', 'module_id', $aModuleNames, array('value' => $aSelectedMods)));
$oForm->addElement(new \PFBC\Element\Button(t('Save')));
$oForm->render();
}
示例2: display
public static function display()
{
if (isset($_POST['submit_msg'])) {
if (\PFBC\Form::isValid($_POST['submit_msg'])) {
new MsgFormProcess();
}
Framework\Url\Header::redirect();
}
$oForumsId = (new ForumModel())->getForum();
$aForumsName = array();
foreach ($oForumsId as $oId) {
$aForumsName[$oId->forumId] = $oId->name;
}
$sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern'];
$oForm = new \PFBC\Form('form_msg', '100%');
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_msg', 'form_msg'));
$oForm->addElement(new \PFBC\Element\Token('msg'));
$oForm->addElement(new \PFBC\Element\Select(t('Forum:'), 'forum', $aForumsName, array('value' => (new Http())->get('forum_id'))));
$oForm->addElement(new \PFBC\Element\Textbox(t('Subject:'), 'title', array('id' => 'str_title', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern))));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_title"></span>'));
$oForm->addElement(new \PFBC\Element\CKEditor(t('Message:'), 'message', array('required' => 1, 'validation' => new \PFBC\Validation\Str(4))));
if (DbConfig::getSetting('isCaptchaForum')) {
$oForm->addElement(new \PFBC\Element\CCaptcha(t('Captcha:'), 'captcha', array('id' => 'ccaptcha', 'onkeyup' => 'CValid(this.value, this.id)', 'description' => t('Enter the code above:'))));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error ccaptcha"></span>'));
}
$oForm->addElement(new \PFBC\Element\Button());
$oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>'));
$oForm->render();
}
示例3: display
public static function display()
{
if (isset($_POST['submit_edit_note'])) {
if (\PFBC\Form::isValid($_POST['submit_edit_note'])) {
new EditNoteFormProcess();
}
Framework\Url\Header::redirect();
}
// Generate edit form post of the note
$oNoteModel = new NoteModel();
$iNoteId = (new Http())->get('id', 'int');
$iProfileId = (new Session())->get('member_id');
$sPostId = $oNoteModel->getPostId($iNoteId);
$oPost = $oNoteModel->readPost($sPostId, $iProfileId);
if (!empty($oPost) && (new Str())->equals($iNoteId, $oPost->noteId)) {
$oCategoriesData = $oNoteModel->getCategory(null, 0, 300);
$aCategoriesName = array();
foreach ($oCategoriesData as $oId) {
$aCategoriesName[$oId->categoryId] = $oId->name;
}
$aSelectedCategories = array();
$oCategoryId = $oNoteModel->getCategory($iNoteId, 0, 300);
unset($oNoteModel);
foreach ($oCategoryId as $iId) {
$aSelectedCategories[] = $iId->categoryId;
}
$oForm = new \PFBC\Form('form_note', 650);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_edit_note', 'form_note'));
$oForm->addElement(new \PFBC\Element\Token('edit_note'));
$oForm->addElement(new \PFBC\Element\Textbox(t('Title of article:'), 'title', array('value' => $oPost->title, 'validation' => new \PFBC\Validation\Str(2, 100), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Article ID:'), 'post_id', array('value' => $oPost->postId, 'description' => Uri::get('note', 'main', 'read', (new Session())->get('member_username')) . '/<strong><span class="your-address">' . $oPost->postId . '</span><span class="post_id"></span></strong>', 'title' => t('Article ID will be the name of the url.'), 'data-profile_id' => $iProfileId, 'id' => 'post_id', 'validation' => new \PFBC\Validation\Str(2, 60), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<div class="label_flow">'));
$oForm->addElement(new \PFBC\Element\Checkbox(t('Categories:'), 'category_id', $aCategoriesName, array('description' => t('Select a category that best fits your article. You can select up to three different categories'), 'value' => $aSelectedCategories, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HTMLExternal('</div>'));
$oForm->addElement(new \PFBC\Element\CKEditor(t('Contents:'), 'content', array('value' => $oPost->content, 'description' => t('Content of the article'), 'validation' => new \PFBC\Validation\Str(30), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('The language of your post:'), 'lang_id', array('value' => $oPost->langId, 'description' => t('EX: "en", "fr", "es", "js"'), 'validation' => new \PFBC\Validation\Str(2, 2), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Slogan:'), 'slogan', array('value' => $oPost->slogan, 'validation' => new \PFBC\Validation\Str(2, 200))));
$oForm->addElement(new \PFBC\Element\File(t('Thumbnail:'), 'thumb', array('accept' => 'image/*')));
if (!empty($oPost->thumb)) {
$oForm->addElement(new \PFBC\Element\HTMLExternal('<p><br /><img src="' . PH7_URL_DATA_SYS_MOD . 'note/' . PH7_IMG . $oPost->username . PH7_SH . $oPost->thumb . '" alt="' . t('Thumbnail') . '" title="' . t('The current thumbnail of your post.') . '" class="avatar" /></p>'));
}
if (!empty($oPost->thumb)) {
$oForm->addElement(new \PFBC\Element\HTMLExternal('<a href="' . Uri::get('note', 'main', 'removethumb', $oPost->noteId . (new Token())->url(), false) . '">' . t('Remove this thumbnail?') . '</a>'));
}
$oForm->addElement(new \PFBC\Element\Textbox(t('Tags:'), 'tags', array('value' => $oPost->tags, 'description' => t('Separate keywords by commas and without spaces between the commas.'), 'validation' => new \PFBC\Validation\Str(2, 200))));
$oForm->addElement(new \PFBC\Element\Textbox(t('Title (meta tag):'), 'page_title', array('value' => $oPost->pageTitle, 'validation' => new \PFBC\Validation\Str(2, 100), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Description (meta tag):'), 'meta_description', array('validation' => new \PFBC\Validation\Str(2, 200), 'value' => $oPost->metaDescription)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Keywords (meta tag):'), 'meta_keywords', array('description' => t('Separate keywords by commas and without spaces between the commas.'), 'validation' => new \PFBC\Validation\Str(2, 200), 'value' => $oPost->metaKeywords)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Robots (meta tag):'), 'meta_robots', array('validation' => new \PFBC\Validation\Str(2, 50), 'value' => $oPost->metaRobots)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Author (meta tag):'), 'meta_author', array('validation' => new \PFBC\Validation\Str(2, 50), 'value' => $oPost->metaAuthor)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Copyright (meta tag):'), 'meta_copyright', array('validation' => new \PFBC\Validation\Str(2, 50), 'value' => $oPost->metaCopyright)));
$oForm->addElement(new \PFBC\Element\Radio(t('Enable Comment:'), 'enable_comment', array('1' => t('Enable'), '0' => t('Disable')), array('value' => $oPost->enableComment, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_TPL_SYS_MOD . 'note/' . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_JS . 'common.js"></script>'));
$oForm->render();
} else {
echo '<p class="center bold">' . t('Post Not Found!') . '</p>';
}
}
示例4: display
public static function display()
{
if (isset($_POST['submit_add_aff'])) {
if (\PFBC\Form::isValid($_POST['submit_add_aff'])) {
new AddAffiliateFormProcess();
}
Framework\Url\Header::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();
}
示例5: step2
public static function step2()
{
$oSession = new Session();
if (!$oSession->exists('mail_step1')) {
Framework\Url\Header::redirect(Uri::get('user', 'signup', 'step1'));
} elseif ($oSession->exists('mail_step2')) {
Header::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\Header::redirect();
}
$oForm = new \PFBC\Form('form_join_user2');
$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();
}
示例6: __construct
public function __construct()
{
parent::__construct();
$iCategoryId = $this->httpRequest->get('category_id', 'int');
(new ForumModel())->updateCategory($iCategoryId, $this->httpRequest->post('title'));
Header::redirect(Uri::get('forum', 'forum', 'index'), t('The Category has been updated successfully!'));
}
示例7: 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\Header::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)));
$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();
}
示例8: deleteMembership
public function deleteMembership()
{
$this->oPayModel->deleteMembership($this->httpRequest->post('id'));
/* Clean UserCoreModel Cache */
(new Framework\Cache\Cache())->start(UserCoreModel::CACHE_GROUP, null, null)->clear();
Header::redirect(Uri::get('payment', 'admin', 'membershiplist'), t('The Membership has been removed!'));
}
示例9: display
public static function display()
{
if (isset($_POST['submit_game'])) {
if (\PFBC\Form::isValid($_POST['submit_game'])) {
new AdminFormProcess();
}
Framework\Url\Header::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');
$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();
}
示例10: display
public static function display()
{
if (isset($_POST['submit_edit'])) {
if (\PFBC\Form::isValid($_POST['submit_edit'])) {
new AdminEditFormProcess();
}
Framework\Url\Header::redirect();
}
$oHttpRequest = new Http();
$oGameModel = new GameModel();
$iGameId = $oHttpRequest->get('id', 'int');
$oGame = $oGameModel->get(strstr($oHttpRequest->get('title'), '-', true), $iGameId, 0, 1);
$oCategoriesData = $oGameModel->getCategory(null, 0, 500);
$aCategoriesName = array();
foreach ($oCategoriesData as $oId) {
$aCategoriesName[$oId->categoryId] = $oId->name;
}
unset($oHttpRequest, $oGameModel);
$sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern'];
if (!empty($oGame) && (new Str())->equals($iGameId, $oGame->gameId)) {
$oForm = new \PFBC\Form('form_edit');
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_edit', 'form_edit'));
$oForm->addElement(new \PFBC\Element\Token('edit'));
$oForm->addElement(new \PFBC\Element\Select(t('Category Name:'), 'category_id', $aCategoriesName, array('value' => $oGame->categoryId, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Name of the Game:'), 'name', array('value' => $oGame->name, 'pattern' => $sTitlePattern, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Title of the Game:'), 'title', array('value' => $oGame->title, 'validation' => new \PFBC\Validation\Str(2, 120), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Description:'), 'description', array('value' => $oGame->description, 'validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Keywords:'), 'keywords', array('value' => $oGame->keywords, 'validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->render();
} else {
echo '<p class="center bold">' . t('Game Not Found!') . '</p>';
}
}
示例11: __construct
/**
* @param string $sConfigVar Specify the variable in the INI file where module options. Default module.setting
* @param string $sIniFile The path of INI config file.
* @return void
*/
public function __construct($sConfigVar, $sIniFile)
{
parent::__construct();
$aOldData = parse_ini_file($sIniFile, true);
$sData = file_get_contents($sIniFile);
foreach ($this->httpRequest->post('config') as $sKey => $sVal) {
$sData = str_replace($sKey . ' = ' . $aOldData[$sConfigVar][$sKey], $sKey . ' = ' . $sVal, $sData);
/**
* ----- Replacement with quotes -----
* For non-alphanumeric characters and especially for special characters.
* For example, it is very important to put quotes between the dollar sign "$", otherwise you'll get errors in the parsing of INI files.
*/
$sData = str_replace($sKey . ' = "' . $aOldData[$sConfigVar][$sKey] . '"', $sKey . ' = "' . $sVal . '"', $sData);
}
// Check and correct the file permission if necessary.
$this->file->chmod($sIniFile, 0644);
$sRedirectUrl = $this->httpRequest->previousPage();
if ($this->file->save($sIniFile, $sData)) {
Header::redirect($sRedirectUrl, 'The file content was saved successfully!');
} else {
Header::redirect($sRedirectUrl, t('The file content could not be saved!'), 'error');
}
// Check and correct the file permission if necessary.
$this->file->chmod($sIniFile, 0644);
}
示例12: __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();
Header::redirect(Uri::get('game', 'main', 'game', $aData['title'] . ',' . Db::getInstance()->lastInsertId()), t('The game was added successfully!'));
}
}
示例13: display
public static function display()
{
if (isset($_POST['submit_bank_account'])) {
if (\PFBC\Form::isValid($_POST['submit_bank_account'])) {
new BankFormProcess();
}
Framework\Url\Header::redirect();
}
$oHR = new Http();
$iProfileId = AdminCore::auth() && !Affiliate::auth() && $oHR->getExists('profile_id') ? $oHR->get('profile_id', 'int') : (new Session())->get('affiliate_id');
$oAff = (new AffiliateModel())->readProfile($iProfileId, 'Affiliates');
$oForm = new \PFBC\Form('form_bank_account', 500);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_bank_account', 'form_bank_account'));
$oForm->addElement(new \PFBC\Element\Token('bank_account'));
if (AdminCore::auth() && !Affiliate::auth() && $oHR->getExists('profile_id')) {
$oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="center"><a class="s_button" href="' . Uri::get('affiliate', 'admin', 'browse') . '">' . t('Return to back affiliates browse') . '</a></p>'));
}
unset($oHR);
$oForm->addElement(new \PFBC\Element\HTMLExternal('<h2 class="underline">' . t('Bank Information:') . '</h2>'));
$sHtmlPayPalIcon = '<a href="http://paypal.com" target="_blank"><img src="' . PH7_URL_STATIC . PH7_IMG . 'icon/paypal_small.gif" alt="PayPal" title="PayPal"></a><br />';
$oForm->addElement(new \PFBC\Element\Email($sHtmlPayPalIcon . t('Your Bank Account:'), 'bank_account', array('id' => 'email_paypal', 'onblur' => 'CValid(this.value,this.id)', 'description' => t('Your Bank Account (PayPal Email Address).'), 'title' => t('Your Bank Account.'), 'value' => $oAff->bankAccount, 'validation' => new \PFBC\Validation\BankAccount(), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\HtmlExternal('<span class="input_error email_paypal"></span>'));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>'));
$oForm->render();
}
示例14: __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();
Header::redirect(Uri::get('comment', 'comment', 'read', $sTable . ',' . $iRecipientId), t('The comment has been sent successfully!'));
}
}
unset($oCommentModel);
}
示例15: display
public static function display()
{
if (isset($_POST['submit_module'])) {
if (\PFBC\Form::isValid($_POST['submit_module'])) {
new DisableModuleFormProcess();
}
Framework\Url\Header::redirect();
}
$oModuleData = (new ModuleModel())->get();
$aModuleNames = [];
$aSelectedMods = [];
foreach ($oModuleData as $oData) {
if ((int) $oData->enabled === 1) {
$aSelectedMods[] = $oData->moduleId;
}
$sPremiumText = '';
if ((int) $oData->premiumMod === 1) {
$sPremiumText = ' (<a class="italic darkred" href="' . Core::SOFTWARE_LICENSE_KEY_URL . '">' . t('Premium Module') . '</a>)';
}
$aModuleNames[$oData->moduleId] = ucwords(str_replace(['-', '_'], ' ', $oData->folderName)) . $sPremiumText;
}
unset($oModuleData);
$oForm = new \PFBC\Form('form_module');
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_module', 'form_module'));
$oForm->addElement(new \PFBC\Element\Token('module'));
$oForm->addElement(new \PFBC\Element\Checkbox('', 'module_id', $aModuleNames, array('value' => $aSelectedMods)));
$oForm->addElement(new \PFBC\Element\Button(t('Save')));
$oForm->render();
}