private function setUp() { global $wgRequest; $doc = $wgRequest->getVal( 'doc' ); if ( !$doc ) throw new MWException(); $this->mForm = SignDocumentForm::newFromDB( $doc ); $this->mSigs = SignDocumentSignature::getAllFromDB( $this->mForm->getId() ); $this->mFields = array( # 'entryid' => !is_null($wgRequest->getVal('entryid')), 'timestamp' => !is_null( $wgRequest->getVal( 'timestamp' ) ), 'realname' => !is_null( $wgRequest->getVal( 'realname' ) ), 'address' => !is_null( $wgRequest->getVal( 'address' ) ), 'city' => !is_null( $wgRequest->getVal( 'city' ) ), 'state' => !is_null( $wgRequest->getVal( 'state' ) ), 'country' => !is_null( $wgRequest->getVal( 'country' ) ), 'zip' => !is_null( $wgRequest->getVal( 'zip' ) ), 'phone' => !is_null( $wgRequest->getVal( 'phone' ) ), 'email' => !is_null( $wgRequest->getVal( 'email' ) ), 'age' => !is_null( $wgRequest->getVal( 'age' ) ), 'ip' => !is_null( $wgRequest->getVal( 'ip' ) ), 'agent' => !is_null( $wgRequest->getVal( 'agent' ) ) ); }
/** * Create a new SignDocumentSignature using data obtained from a POST. */ public static function newFromPost() { global $wgRequest; if ( !$wgRequest->wasPosted() ) throw new MWException( 'Page was not posted.' ); self::$canRunCtor = true; $f = new SignDocumentSignature(); self::$canRunCtor = false; $f->mTimestamp = wfTimestampNow(); $f->mRealName = $wgRequest->getVal( 'realname', '' ); $f->mAddress = $wgRequest->getVal( 'address', '' ); $f->mCity = $wgRequest->getVal( 'city', '' ); $f->mState = $wgRequest->getVal( 'state', '' ); $f->mCountry = $wgRequest->getVal( 'country', '' ); $f->mZip = $wgRequest->getVal( 'zip', '' ); $f->mPhone = $wgRequest->getVal( 'phone', '' ); $f->mBday = $wgRequest->getVal( 'bday', 0 ); $f->mEmail = $wgRequest->getVal( 'email', '' ); $f->mIp = wfGetIp(); $f->mAgent = $wgRequest->getHeader( 'User-Agent' ); if ( $wgRequest->getVal( 'anonymous' ) ) $f->mHiddenFields[] = 'realname'; if ( $wgRequest->getVal( 'hideaddress' ) ) $f->mHiddenFields[] = 'address'; if ( $wgRequest->getVal( 'hideextaddress' ) ) $f->mHiddenFields[] = 'extaddress'; if ( $wgRequest->getVal( 'hidephone' ) ) $f->mHiddenFields[] = 'phone'; if ( $wgRequest->getVal( 'hideemail' ) ) $f->mHiddenFields[] = 'email'; if ( $wgRequest->getVal( 'hidebday' ) ) $f->mHiddenFields[] = 'bday'; $f->mForm = SignDocumentForm::newFromDB( $wgRequest->getVal( 'doc' ) ); return $f; }