/** * Check if an external app can have access to the API. * * @param \PH7\Framework\Config\Config $oConfig * @param \PH7\Framework\Mvc\Request\Http $oRequest * @return boolean TRUE is the app has access, FALSE otherwise. */ public static function checkAccess(Config $oConfig, Http $oRequest) { if (strcmp($oRequest->post('private_api_key'), $oConfig->values['api']['private_key']) === 0) { return in_array($oRequest->post('url'), $oConfig->values['api']['allow_domains']); } return false; }
public function __construct() { $oHR = new HttpRequest(); $aData = (new ImportUser($_FILES['csv_file'], $oHR->post('delimiter'), $oHR->post('enclosure')))->getResponse(); if (!$aData['status']) { \PFBC\Form::setError('form_import_user', $aData['msg']); } else { Header::redirect(Uri::get(PH7_ADMIN_MOD, 'user', 'browse'), $aData['msg']); } }
private function _init() { $oHttpRequest = new Http(); $sParam = $oHttpRequest->post('param'); $sType = $oHttpRequest->post('type'); unset($oHttpRequest); switch ($sType) { case 'profile_link': $this->_mOutput = $this->_oUser->getProfileLink($sParam); break; // If we receive another invalid value, we display a message with a HTTP header. // If we receive another invalid value, we display a message with a HTTP header. default: Framework\Http\Http::setHeadersByCode(400); exit('Bad Request Error!'); } }
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(); }
$this->_sMsg = t('OK!'); } } /** * Validation of the acceptance of the terms of use. * * @access protected * @return string $sValue * @return void */ protected function terms($sValue) { if ($sValue != 'true') { $this->_sMsg = t('You must read and approve the terms of use!'); } else { $this->_iStatus = 1; } } /** * Destruction of objects to optimize the resources of RAM. */ public function __destruct() { unset($this->_oStr, $this->_oValidate, $this->_oExistsModel, $this->_sMsg, $this->_iStatus); } } $oHttpRequest = new Http(); if ($oHttpRequest->postExists('fieldId')) { (new ValidateCoreAjax())->form($oHttpRequest->post('inputVal'), $oHttpRequest->post('fieldId'), $oHttpRequest->post('param1'), $oHttpRequest->post('param2')); } unset($oHttpRequest);
<?php /** * @author Pierre-Henry Soria <*****@*****.**> * @copyright (c) 2012-2015, Pierre-Henry Soria. All Rights Reserved. * @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. * @package PH7 / App / System / Module / Note / Asset / Ajax */ namespace PH7; defined('PH7') or exit('Restricted access'); use PH7\Framework\Mvc\Request\Http; $oHttpRequest = new Http(); $iStatus = 0; // Error Default Value if ($oHttpRequest->postExists('post_id')) { $iStatus = (new Note())->checkPostId($oHttpRequest->post('post_id'), $oHttpRequest->post('profile_id')) ? 1 : 0; } echo json_encode(array('status' => $iStatus)); unset($oHttpRequest);
* * @author Pierre-Henry Soria <*****@*****.**> * @copyright (c) 2012-2016, Pierre-Henry Soria. All Rights Reserved. * @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. * @package PH7 / App / System / Core / Asset / Ajax * @version 1.0 */ namespace PH7; defined('PH7') or exit('Restricted access'); use PH7\Framework\Layout\Html\Design, PH7\Framework\Session\Session, PH7\Framework\Mvc\Request\Http; // Only for members if (UserCore::auth()) { $oHttpRequest = new Http(); if ($oHttpRequest->postExists('username')) { if ($oUsernameResult = (new UserCoreModel())->getUsernameList($oHttpRequest->post('username'))) { // XML tags echo '<users><ul>'; foreach ($oUsernameResult as $oList) { // Do not include the user profile that is connected since it doesn't make sense. if ($oList->profileId == (new Session())->get('member_id')) { break; } echo '<li> <username>', escape($oList->username, true), '</username> <avatar>', (new Design())->getUserAvatar($oList->username, $oList->sex, 32), '</avatar> </ul>'; } echo '</ul></users>'; } }
<?php /** * @author Pierre-Henry Soria <*****@*****.**> * @copyright (c) 2012-2015, Pierre-Henry Soria. All Rights Reserved. * @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. * @package PH7 / App / System / Module / Blog / Asset / Ajax / Form */ namespace PH7; defined('PH7') or exit('Restricted access'); use PH7\Framework\Mvc\Request\Http; $oHttpRequest = new Http(); $iStatus = 0; // Error Default Value if ($oHttpRequest->postExists('post_id')) { $iStatus = (new Blog())->checkPostId($oHttpRequest->post('post_id')) ? 1 : 0; } echo json_encode(array('status' => $iStatus)); unset($oHttpRequest);
<?php /** * @author Pierre-Henry Soria <*****@*****.**> * @copyright (c) 2012-2016, Pierre-Henry Soria. All Rights Reserved. * @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. * @package PH7 / App / System / Module / User / Asset / Ajax / Form */ namespace PH7; defined('PH7') or exit('Restricted access'); use PH7\Framework\Security\Validate\Validate, PH7\Framework\Mvc\Model\DbConfig, PH7\Framework\Mvc\Request\Http; $oHttpRequest = new Http(); $iStatus = 0; // Error Default Value if ($oHttpRequest->postExists('username')) { $iStatus = (new Validate())->username($oHttpRequest->post('username'), DbConfig::getSetting('minUsernameLength'), DbConfig::getSetting('maxUsernameLength')) ? 1 : 0; } echo json_encode(array('status' => $iStatus)); unset($oHttpRequest);