本文整理匯總了PHP中Common::getPostString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Common::getPostString方法的具體用法?PHP Common::getPostString怎麽用?PHP Common::getPostString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Common
的用法示例。
在下文中一共展示了Common::getPostString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
public function execute()
{
$back = '';
$write = false;
if (true === isset($_GET['delete'])) {
$write = true;
if (false === GWF_PageLinks::deleteLink($_GET['delete'])) {
$back .= $this->module->error('err_deleting_failed');
}
}
if (true === isset($_POST['add'])) {
$url = Common::getPostString('url');
$href = Common::getPostString('href');
if ('' !== $url && '' !== $href) {
if ($url[0] === '/') {
$url = substr($url, 1);
}
if (true === GWF_PB_Rewrites::matchURL(Common::substrUntil(GWF_PB_Rewrites::replaceRewriteURL($url), '/'))) {
$back .= $this->module->error('err_url_exists');
} else {
$write = true;
GWF_PageLinks::insertLink($url, $href);
}
} else {
$back .= $this->module->error('err_parame');
}
}
if (true === $write && false === $this->module->writeHTA()) {
$back .= $this->module->error('err_htaccess_writing');
}
return $back . $this->templateLinks();
}
示例2: isFlooding
public function isFlooding()
{
$uid = GWF_Session::getUserID();
$uname = GWF_Shoutbox::generateUsername();
$euname = GDO::escape($uname);
$table = GDO::table('GWF_Shoutbox');
$max = $uid === 0 ? $this->module->cfgMaxPerDayGuest() : $this->module->cfgMaxPerDayUser();
// $cut = GWF_Time::getDate(GWF_Time::LEN_SECOND, time()-$this->module->cfgTimeout());
// $cnt = $table->countRows("shout_uname='$euname' AND shout_date>'$cut'");
# Check captcha
if ($this->module->cfgCaptcha()) {
require_once GWF_CORE_PATH . 'inc/3p/Class_Captcha.php';
if (!PhpCaptcha::Validate(Common::getPostString('captcha'), true)) {
return GWF_HTML::err('ERR_WRONG_CAPTCHA');
}
}
# Check date
$timeout = $this->module->cfgTimeout();
$last_date = $table->selectVar('MAX(shout_date)', "shout_uid={$uid} AND shout_uname='{$euname}'");
$last_time = $last_date === NULL ? 0 : GWF_Time::getTimestamp($last_date);
$next_time = $last_time + $timeout;
if ($last_time + $timeout > time()) {
return $this->module->error('err_flood_time', array(GWF_Time::humanDuration($next_time - time())));
}
# Check amount
$today = GWF_Time::getDate(GWF_Date::LEN_SECOND, time() - $timeout);
$count = $table->countRows("shout_uid={$uid} AND shout_date>='{$today}'");
if ($count >= $max) {
return $this->module->error('err_flood_limit', array($max));
}
# All fine
return false;
}
示例3: execute
public function execute()
{
# Plaintext if called directly
if ($_GET['mo'] . '_' . $_GET['me'] === __CLASS__) {
$_GET['ajax'] = 1;
}
# The navigation called should have pid == 0
$name = Common::getPostString('navigation', 'PageMenu');
# Select all subnavigations from $name
$id = GWF_Navigations::getIdByName($name);
if (false === ($selects = GDO::table('GWF_Navigations')->selectAll('navis_id', 'navis_pid=' . $id))) {
//$this->module->error();
$selects = array();
}
$navis = array();
foreach ($selects as $n) {
if (false === ($navi = $this->getNavigation($n['navis_id']))) {
# Should not happen
$this->module->error(sprintf('Navigation: could not add navigation with id %s', $n['navis_id']));
$navi = array();
}
$navis[] = $navi;
}
$tVars = array('navis' => $navis);
return $this->templateShow($this->_tpl, $tVars);
}
示例4: validate_password2
public function validate_password2($chall, $arg)
{
if (Common::getPostString('password1') !== $arg) {
return $chall->lang('err_retype');
}
return false;
}
示例5: getForm
public function getForm()
{
$langid = Common::getPostString('langid', GWF_Language::getEnglish()->getID());
require_once GWF_CORE_PATH . 'module/Category/GWF_CategorySelect.php';
//key => array(TYPE, default, text, classname)
// GWF_Language::setShowSupported(true);
$data = array('langid' => array(GWF_Form::SELECT, GWF_LangSelect::single(GWF_Language::SUPPORTED, 'langid', $langid), $this->module->lang('th_langid')), 'catid' => array(GWF_Form::SELECT, GWF_CategorySelect::single('catid', Common::getPostString('catid', '1'), 0), $this->module->lang('th_category')), 'title' => array(GWF_Form::STRING, '', $this->module->lang('th_title')), 'message' => array(GWF_Form::MESSAGE, '', $this->module->lang('th_message')), 'div1' => array(GWF_Form::DIVIDER), 'div2' => array(GWF_Form::DIVIDER), 'preview' => array(GWF_Form::SUBMIT, $this->module->lang('btn_preview'), ''), 'add' => array(GWF_Form::SUBMIT, $this->module->lang('btn_add'), ''));
return new GWF_Form($this, $data);
}
示例6: execute
public function execute()
{
if (false === ($order = GWF_Order::getByToken(Common::getPostString('gwf_token')))) {
return $this->module->error('err_order');
}
if (!$order->isCreated()) {
return $this->module->error('err_order');
}
$gdo = $order->getOrderData();
$user = $order->getOrderUser();
# GWF_User::getStaticOrGuest();
/* The servername and serverport tells PayPal where the buyer
should be directed back to after authorizing payment.
In this case, its the local webserver that is running this script
Using the servername and serverport, the return URL is the first
portion of the URL that buyers will return to after authorizing payment
*/
/* The returnURL is the location where buyers return when a
payment has been succesfully authorized.
The cancelURL is the location buyers are sent to when they hit the
cancel button during authorization of payment during the PayPal flow
*/
$successURL = urlencode($this->get2ndStepURL($order, $gdo));
$cancelURL = urlencode(Common::getAbsoluteURL($gdo->getOrderCancelURL($user), false));
$shipping = $gdo->needsShipping($user) ? '0' : '1';
/* Construct the parameter string that describes the PayPal payment
the varialbes were set in the web form, and the resulting string
is stored in $nvpstr
*/
$paymentAmount = $order->getOrderPriceTotal(2);
$paymentType = "Sale";
$currencyCodeType = $order->getOrderCurrency();
$nvpstr = "&Amt={$paymentAmount}" . "&PAYMENTACTION={$paymentType}" . "&ReturnUrl={$successURL}" . "&CANCELURL={$cancelURL}" . "&CURRENCYCODE={$currencyCodeType}" . "&no_shipping={$shipping}" . "&LOCALECODE=" . strtoupper(GWF_Language::getCurrentISO());
// var_dump($nvpstr);
/* Make the call to PayPal to set the Express Checkout token
If the API call succeded, then redirect the buyer to PayPal
to begin to authorize payment. If an error occured, show the
resulting errors
*/
$resArray = Paypal_Util::hash_call('SetExpressCheckout', $nvpstr);
// var_dump($resArray);
$ack = strtoupper($resArray["ACK"]);
if ($ack == "SUCCESS") {
// Redirect to paypal.com here
$token = urldecode($resArray["TOKEN"]);
if (false === $order->saveVar('order_xtoken', $token)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$payPalURL = PAYPAL_URL . $token;
header("Location: " . $payPalURL);
echo 'The browser should redirect you to: ' . $payPalURL . PHP_EOL;
die;
} else {
return Paypal_Util::paypalError($resArray);
}
}
示例7: getForm
public function getForm(WC_Site $site, $is_admin)
{
$data = array();
$data['site_name'] = array(GWF_Form::STRING, $site->getVar('site_name'), $this->module->lang('th_site_name'));
if ($is_admin) {
$data['site_classname'] = array(GWF_Form::STRING, $site->getVar('site_classname'), $this->module->lang('th_site_classname'));
$data['site_basescore'] = array(GWF_Form::INT, $site->getVar('site_basescore'), $this->module->lang('th_site_basescore'));
$data['site_usercount'] = array(GWF_Form::INT, $site->getVar('site_usercount'), $this->module->lang('th_site_usercount'));
$data['site_challcount'] = array(GWF_Form::INT, $site->getVar('site_challcount'), $this->module->lang('th_site_challcount'));
$data['site_powarg'] = array(GWF_Form::INT, $site->getVar('site_powarg'), $this->module->lang('th_site_powarg'));
$data['site_spc'] = array(GWF_Form::INT, $site->getVar('site_spc'), $this->module->lang('th_site_spc'));
$data['site_color'] = array(GWF_Form::STRING, $site->getVar('site_color'), $this->module->lang('th_site_color'));
}
$data['site_status'] = array(GWF_Form::SELECT, $this->getStatusSelect($site), $this->module->lang('th_site_status'));
$data['no_urlencode'] = array(GWF_Form::CHECKBOX, $site->isOptionEnabled(WC_Site::NO_URLENCODE), $this->module->lang('th_no_urlencode'));
$data['auto_update'] = array(GWF_Form::CHECKBOX, $site->hasAutoUpdate(), $this->module->lang('th_autoupdate'));
$data['onsite_rank'] = array(GWF_Form::CHECKBOX, $site->hasOnSiteRank(), $this->module->lang('th_site_has_osr'));
$data['default_hide'] = array(GWF_Form::CHECKBOX, $site->isDefaultHidden(), $this->module->lang('th_default_hide'));
if ($is_admin) {
$data['linear'] = array(GWF_Form::CHECKBOX, $site->isLinear(), $this->module->lang('th_linear'));
}
$data['div0'] = array(GWF_Form::DIVIDER);
if ($is_admin) {
$data['divi0'] = array(GWF_Form::HEADLINE, $this->module->lang('pi_site_tags', array($site->displayTags(true))));
$data['site_tags'] = array(GWF_Form::STRING, $site->getVar('site_tags'), $this->module->lang('th_site_tags'));
}
$data['site_country'] = array(GWF_Form::SELECT, GWF_CountrySelect::single('site_country', Common::getPostString('site_country', $site->getCountryID())), $this->module->lang('th_site_country2'));
if ($is_admin) {
$data['site_language'] = array(GWF_Form::SELECT, GWF_LangSelect::single(0, 'site_language', $site->getLangID()), $this->module->lang('th_site_language2'));
}
if ($is_admin) {
$data['site_joindate'] = array(GWF_Form::STRING, $site->getVar('site_joindate'), $this->module->lang('th_site_joindate'), '', GWF_Date::LEN_SECOND);
}
$data['site_launchdate'] = array(GWF_Form::DATE, $site->getVar('site_launchdate'), $this->module->lang('th_site_launchdate'), '', GWF_Date::LEN_DAY);
if ($is_admin) {
$data['site_authkey'] = array(GWF_Form::STRING, $site->getVar('site_authkey'), $this->module->lang('th_site_authkey'));
}
$data['site_xauthkey'] = array(GWF_Form::STRING, $site->getVar('site_xauthkey'), $this->module->lang('th_site_xauthkey'));
$data['site_irc'] = array(GWF_Form::STRING, $site->getVar('site_irc'), $this->module->lang('th_site_irc'));
$data['div2'] = array(GWF_Form::DIVIDER);
$data['div3'] = array(GWF_Form::HEADLINE, $this->module->lang('pi_site_urls'));
$data['site_url'] = array(GWF_Form::STRING, $site->getVar('site_url'), $this->module->lang('th_site_url'));
$data['site_url_mail'] = array(GWF_Form::STRING, $site->getVar('site_url_mail'), $this->module->lang('th_site_url_mail'));
$data['site_url_score'] = array(GWF_Form::STRING, $site->getVar('site_url_score'), $this->module->lang('th_site_url_score'));
$data['site_url_profile'] = array(GWF_Form::STRING, $site->getVar('site_url_profile'), $this->module->lang('th_site_url_profile'));
$data['div4'] = array(GWF_Form::DIVIDER);
$data['div5'] = array(GWF_Form::HEADLINE, $this->l('pi_warboxes'));
$data['no_v1'] = array(GWF_Form::CHECKBOX, $site->isNoV1(), $this->l('th_no_v1'), $this->l('tt_no_v1'));
// $data['warenbl'] = array(GWF_Form::CHECKBOX, $site->isWarBox(), $this->l('th_warbox'));
// $data['warhost'] = array(GWF_Form::STRING, $site->getWarHost(), $this->l('th_warhost'));
// $data['warport'] = array(GWF_Form::INT, $site->getWarPort(), $this->l('th_warport'));
// $data['warscrd'] = array(GWF_Form::INT, $site->getWarReduceScore(), $this->l('th_war_score_reduce'));
// $data['site_description'] = array(GWF_Form::MESSAGE, $site->getVar('site_description'), $this->module->lang('th_site_description'));
$data['edit'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_edit_site'));
return new GWF_Form($this, $data);
}
示例8: getForm
public function getForm()
{
$user = GWF_Session::getUser();
$user_email = $user->getVar('user_email');
# SECURITY
$data = array('username' => array(GWF_Form::SSTRING, $user->getVar('user_name'), $this->module->lang('th_username')), 'email' => array(GWF_Form::STRING, $user_email, $this->module->lang('th_email')));
### Email set but not approved.
if ($user_email !== '' && !$user->hasValidMail()) {
$data['approvemail'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_approvemail'), $this->module->lang('th_approvemail'));
}
// DEMOGRAPHICS
$data['div1'] = array(GWF_Form::HEADLINE, $this->module->lang('th_demo', array(GWF_Time::humanDuration($this->module->cfgChangeTime()), 1)));
$data['countryid'] = array(GWF_Form::SELECT, $user->getCountrySelect('countryid'), $this->module->lang('th_countryid'));
$data['langid'] = array(GWF_Form::SELECT, GWF_LangSelect::single(0, 'langid', Common::getPostString('langid', $user->getVar('user_langid'))), $this->module->lang('th_langid'));
$data['langid2'] = array(GWF_Form::SELECT, GWF_LangSelect::single(0, 'langid2', Common::getPostString('langid2', $user->getVar('user_langid2'))), $this->module->lang('th_langid2'));
$data['birthdate'] = array(GWF_Form::DATE, $user->getVar('user_birthdate'), $this->module->lang('th_birthdate'), '', GWF_Date::LEN_DAY);
if ($this->module->cfgShowGender()) {
$data['gender'] = array(GWF_Form::SELECT, $user->getGenderSelect(), $this->module->lang('th_gender'));
}
// OPTIONS
$data['div2'] = array(GWF_Form::HEADLINE, $this->module->lang('th_flags'));
$data['email_fmt'] = array(GWF_Form::SELECT, $this->selectEMailFormat($user), $this->module->lang('th_email_fmt'));
if ($this->module->cfgShowCheckboxes()) {
$data['online'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::HIDE_ONLINE), $this->module->lang('th_online'));
$data['record_ips'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::RECORD_IPS), $this->module->lang('th_record_ips', array($this->module->getMethodURL('Access'))), $this->module->lang('tt_record_ips'));
$data['alert_uas'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::ALERT_UAS), $this->module->lang('th_alert_uas'), $this->module->lang('tt_alert_uas'));
$data['alert_ips'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::ALERT_IPS), $this->module->lang('th_alert_ips'), $this->module->lang('tt_alert_ips'));
$data['alert_isps'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::ALERT_ISPS), $this->module->lang('th_alert_isps'), $this->module->lang('tt_alert_isps'));
$data['show_bday'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::SHOW_BIRTHDAY), $this->module->lang('th_show_bday'));
$data['show_obday'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::SHOW_OTHER_BIRTHDAYS), $this->module->lang('th_show_obday'));
$data['show_email'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::SHOW_EMAIL), $this->module->lang('th_show_email'));
$data['allow_email'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::ALLOW_EMAIL), $this->module->lang('th_allow_email'));
}
if ($this->module->cfgShowAdult()) {
if (GWF_Time::getAge($user->getVar('user_birthdate')) >= $this->module->cfgAdultAge()) {
$data['adult'] = array(GWF_Form::CHECKBOX, $user->isOptionEnabled(GWF_User::WANTS_ADULT), $this->module->lang('th_adult'));
}
}
if ($this->module->cfgUseAvatar()) {
// Avatar
if ($user->isOptionEnabled(GWF_User::HAS_AVATAR)) {
$data['avatar'] = array(GWF_Form::HEADLINE, $user->displayAvatar(), $this->module->lang('th_avatar'));
$data['drop_avatar'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_drop_avatar'), '');
} else {
$data['avatar'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_avatar'));
}
}
$data['divpw'] = array(GWF_Form::HEADLINE, $this->module->lang('th_change_pw', array('recovery')));
// BTN
$buttons = array('change' => $this->module->lang('btn_submit'), 'delete' => $this->module->lang('btn_delete'));
// $data['change'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_submit'), '');
$data['buttons'] = array(GWF_Form::SUBMITS, $buttons);
return new GWF_Form($this, $data);
}
示例9: onSolve
private function onSolve($answer)
{
if (false === ($flag = WC_Warflag::getByWarboxAndID($this->box, Common::getPostString('wfid')))) {
return $this->module->error('err_warflag');
}
if (false === ($solver = $this->module->getMethod('Warsolve'))) {
return GWF_HTML::err('ERR_METHOD_MISSING', array('Warsolve', 'WeChall'));
}
$solver instanceof WeChall_Warsolve;
return $solver->onAnswer($flag, $answer);
}
示例10: onEdit
private function onEdit(WC_Challenge $chall)
{
$form = $this->getForm($chall);
if (false !== ($error = $form->validate($this->module))) {
return $error;
}
$msgs = '';
$wc = WC_Site::getWeChall();
# Solution
$is_case_i = isset($_POST['case_i']);
if ('' !== ($solution = Common::getPostString('solution', ''))) {
if (false === $chall->saveVar('chall_solution', $chall->hashSolution($solution, $is_case_i))) {
$msgs .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
}
# CASE_I
$case_i = WC_Challenge::CHALL_CASE_I;
if ($chall->isOptionEnabled($case_i) !== $is_case_i) {
if (false === $chall->saveOption($case_i, $is_case_i)) {
$msgs .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
}
# Save score
$new_score = $form->getVar('score');
$old_score = $chall->getVar('chall_score');
if ($new_score !== $old_score) {
if (!WC_Challenge::isValidScore($new_score)) {
$msgs .= $this->module->error('err_chall_score', array($new_score, WC_Challenge::MIN_SCORE, WC_Challenge::MAX_SCORE));
}
if (false === $chall->saveVar('chall_score', $new_score)) {
$msgs .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $wc->saveVar('site_maxscore', WC_Challenge::getMaxScore())) {
$msgs .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$wc->recalcSite();
}
# URL+Title (dangerous)
if (false === $chall->saveVars(array('chall_url' => $form->getVar('url'), 'chall_title' => $form->getVar('title')))) {
$msgs .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
# Creator:
if (false === $chall->updateCreators($form->getVar('creators'))) {
$msgs .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
# Tags:
if (false === $chall->saveVar('chall_tags', trim($form->getVar('tags'), ' ,'))) {
$msgs .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
Module_WeChall::instance()->cacheChallTags();
# Done
return $msgs . $this->module->message('msg_chall_edited');
}
示例11: checkSolution
public static function checkSolution(WC_Challenge $chall, $random, $letters_only = false, $lowercase = false, $length = 12)
{
if (false === ($answer = Common::getPostString('answer', false))) {
return;
}
$solution = self::generateSolution($random, $letters_only, $lowercase, $length);
if ($lowercase) {
$answer = strtolower($answer);
}
$chall->setVar('chall_solution', WC_Challenge::hashSolution($solution, $lowercase));
$chall->onSolve(GWF_Session::getUser(), $answer);
}
示例12: select
public static function select(Module_PageBuilder $module, $sel = true)
{
$sel = $sel === true ? Common::getPostString('type', '0') : $sel;
$data = array(array('0', $module->lang('sel_type')));
if ($module->isAuthor(GWF_User::getStaticOrGuest())) {
$data[] = array(GWF_Page::SMARTY, $module->lang('type_smarty'));
$data[] = array(GWF_Page::HTML, $module->lang('type_html'));
} else {
$sel = GWF_Page::BBCODE;
}
$data[] = array(GWF_Page::BBCODE, $module->lang('type_bbcode'));
return GWF_Select::display('type', $data, $sel);
}
示例13: execute
public function execute()
{
$this->module->includeClass('WC_Warbox');
$this->module->includeClass('WC_Warflag');
$this->module->includeClass('WC_Warflags');
$this->module->includeClass('sites/warbox/WCSite_WARBOX');
if (isset($_POST['wc_boxes_quickjump'])) {
$_GET['boxid'] = Common::getPostString('wc_boxes_quickjump');
}
if (false === ($this->box = WC_Warbox::getByID(Common::getGetString('boxid')))) {
return $this->module->error('err_warbox');
}
return $this->templatePlayers();
}
示例14: validate_title
public static function validate_title(Module_Helpdesk $m, $arg)
{
if ($arg === '0') {
return $m->lang('err_title');
}
if ($arg === 'other') {
return self::validate_other($m, Common::getPostString('other', ''));
}
$titles = self::getTitles();
if (!isset($titles[$arg])) {
return $m->lang('err_title');
}
return false;
}
示例15: getParentSelect
private function getParentSelect(GWF_Category $cat)
{
$id = $cat->getID();
$group = $cat->getEscaped('cat_group');
$data = array(array('0', $this->module->lang('sel_parent')));
$table = GDO::table('GWF_Category');
if (false !== ($result = $table->select('cat_tree_id, cat_tree_key', "cat_group='{$group}' AND cat_tree_id != {$id}"))) {
while (false !== ($row = $table->fetch($result, GDO::ARRAY_N))) {
$data[] = $row;
}
$table->free($result);
}
return GWF_Select::display('parent', $data, Common::getPostString('parent', $cat->getParentID()));
}