/** * Allows a redirection URL respecting the HTTP status code for search engines friendly. * * @static * @param string $sUrl Default NULL, so it's the current URL. * @param string $sMessage Default NULL, so no message. * @param string $sType Type of message: "success", "info", "warning" or "error". Default: "success". * @param integer $iRedirectCode Default NULL, so the redirect code will be "301". * @return void */ public static function redirect($sUrl = null, $sMessage = null, $sType = 'success', $iRedirectCode = null) { if (!Http::getStatusCodes($iRedirectCode)) { $iRedirectCode = 301; } Http::setHeadersByCode(Http::getStatusCodes($iRedirectCode)); $oHttpRequest = new HttpRequest(); $sUrl = !empty($sUrl) ? $sUrl : $oHttpRequest->currentUrl(); $sUrl = $oHttpRequest->pH7Url($sUrl); unset($oHttpRequest); if (!empty($sMessage)) { (new \PH7\Framework\Layout\Html\Design())->setFlashMsg($sMessage, $sType); } header('Location: ' . $sUrl); exit; }
public static function display() { $oHttpRequest = new Http(); if ($oHttpRequest->postExists('submit_report')) { if (\PFBC\Form::isValid($oHttpRequest->post('submit_report'))) { new ReportFormProcess(); } Framework\Url\Header::redirect(); } $oForm = new \PFBC\Form('form_report', 350); $oForm->configure(array('action' => $oHttpRequest->currentUrl())); $oForm->addElement(new \PFBC\Element\Hidden('submit_report', 'form_report')); $oForm->addElement(new \PFBC\Element\Token('report')); $oForm->addElement(new \PFBC\Element\Hidden('spammer', $oHttpRequest->get('spammer'), array('required' => 1))); $oForm->addElement(new \PFBC\Element\Hidden('url', $oHttpRequest->get('url'), array('validation' => new \PFBC\Validation\Url()))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<h3 class="center">' . t('Do your want to report this?') . '</h4>')); $oForm->addElement(new \PFBC\Element\Select(t('Type the Content'), 'type', array('user' => t('Profile'), 'avatar' => t('Avatar'), 'mail' => t('Message'), 'comment' => t('Comment'), 'picture' => t('Photo'), 'video' => t('Video'), 'forum' => t('Forum'), 'note' => t('Note')), array('value' => $oHttpRequest->get('type'), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textarea(t('Comment:'), 'desc', array('title' => t('Please tell us why you want to report this content (scam, illegal content, adult content, etc.). Help us to eliminate scams, fake profiles, spam ... Thank you'), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button(t('Report this'), 'submit')); $oForm->addElement(new \PFBC\Element\Button(t('Cancel'), 'cancel', array('onclick' => 'parent.$.colorbox.close()'))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'str.js"></script>')); $oForm->render(); }
/** * Checks the URL Token. * * @return boolean */ public function checkUrl() { $oHttpRequest = new Http(); $bRet = $this->currentSess() === true || $oHttpRequest->currentUrl() === PH7_URL_ROOT || $oHttpRequest->get(static::VAR_NAME) === $this->currentSess(); unset($oHttpRequest); return $bRet; }