本文整理汇总了PHP中_root::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP _root::getRequest方法的具体用法?PHP _root::getRequest怎么用?PHP _root::getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_root
的用法示例。
在下文中一共展示了_root::getRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processInscription
private function processInscription()
{
if (!_root::getRequest()->isPost()) {
return null;
}
$tAccount = model_example::getInstance()->getListAccount();
$sLogin = _root::getParam('login');
$sPassword = _root::getParam('password');
if ($sPassword != _root::getParam('password2')) {
return 'Les deux mots de passe doivent etre identiques';
} elseif (_root::getParam('login') == '') {
return 'Vous devez remplir le nom d utilisateur';
} elseif ($sPassword == '') {
return 'Vous devez remplir le mot de passe';
} elseif (strlen($sPassword) > $this->maxPasswordLength) {
return 'Mot de passe trop long';
} elseif (isset($tAccount[$sLogin])) {
return 'Utilisateur déjà existant';
}
$oExample = new row_example();
$oExample->loginField = $sLogin;
$oExample->passField = model_example::getInstance()->hashPassword($sPassword);
$oExample->save();
return 'Votre compte a bien été créé';
}
示例2: save
private function save()
{
if (!_root::getRequest()->isPost()) {
return false;
}
$oPluginXsrf = new plugin_xsrf();
if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
//on verifie que le token est valide
return array('token' => $oPluginXsrf->getMessage());
}
$oArticleModel = new model_article();
$iId = _root::getParam('id', null);
if ($iId == null) {
$oArticle = new row_article();
} else {
$oArticle = $oArticleModel->findById(_root::getParam('id', null));
}
foreach ($oArticleModel->getListColumn() as $sColumn) {
if (_root::getParam($sColumn, null) == null) {
continue;
}
if (in_array($sColumn, $oArticleModel->getIdTab())) {
continue;
}
$oArticle->{$sColumn} = _root::getParam($sColumn, null);
}
if ($oArticle->save()) {
//une fois enregistre on redirige (vers la page de liste)
_root::redirect('prive::list');
} else {
return $oArticle->getListError();
}
}
示例3: _index
public function _index()
{
$msg = '';
$detail = '';
if (_root::getRequest()->isPost()) {
$sModule = _root::getParam('module');
$sActions = _root::getParam('actions');
$tAction = explode("\n", $sActions);
if (module_builder::getTools()->projetmkdir('module/' . $sModule) == true) {
$detail = 'Création repertoire module/' . $sModule;
} else {
$detail = 'Warning: repertoire déjà existant module/' . $sModule;
}
if (module_builder::getTools()->projetmkdir('module/' . $sModule . '/view') == true) {
$detail .= '<br />Création repertoire module/' . $sModule . '/view';
} else {
$detail .= '<br />Warning: repertoire déjà existant module/' . $sModule . '/view';
}
$this->genModuleMain($sModule, $tAction);
$msg = 'Module ' . $sModule . ' (actions: ' . implode(',', $tAction) . ') genere avec succes';
$detail .= '<br />Création fichier module/' . $sModule . '/main.php';
foreach ($tAction as $sAction) {
$detail .= '<br />Création fichier module/' . $sModule . '/view/' . $sAction . '.php';
}
$detail .= '<br />Accessible via';
foreach ($tAction as $sAction) {
$detail .= '<br />- <a href="data/genere/' . _root::getParam('id') . '/public/index.php?:nav=' . $sModule . '::' . $sAction . '">index.php?:nav=' . $sModule . '::' . $sAction . '</a>';
}
}
$oTpl = new _Tpl('moduleModule::index');
$oTpl->msg = $msg;
$oTpl->detail = $detail;
return $oTpl;
}
示例4: _login
public function _login()
{
$oView = new _view('auth::login');
$this->oLayout->add('main', $oView);
if (_root::getRequest()->isPost()) {
$sLogin = _root::getParam('login');
$sPass = sha1(_root::getParam('password'));
$oModelAccount = new model_account();
$tAccount = $oModelAccount->getListAccount();
if (_root::getAuth()->checkLoginPass($tAccount, $sLogin, $sPass)) {
$oAccount = _root::getAuth()->getAccount();
$tPermission = model_permission::getInstance()->findByGroup($oAccount->groupe);
//on purge les permissions en session
_root::getACL()->purge();
//boucle sur les permissions
if ($tPermission) {
foreach ($tPermission as $oPermission) {
if ($oPermission->allowdeny == 'ALLOW') {
_root::getACL()->allow($oPermission->action, $oPermission->element);
} else {
_root::getACL()->deny($oPermission->action, $oPermission->element);
}
}
}
_root::redirect('prive::list');
}
}
}
示例5: __construct
/**
* constructeur
* @access public
* @param object $oObject objet en edition
*/
public function __construct()
{
$this->isPost = false;
if (_root::getRequest()->isPost()) {
$this->isPost = true;
}
}
示例6: __construct
/**
* constructeur
* @access public
* @param object $oObject objet en edition
*/
public function __construct($oObject = null)
{
$this->oObject = $oObject;
$this->isPost = false;
if (_root::getRequest()->isPost()) {
$this->isPost = true;
}
}
示例7: process
private function process()
{
if (_root::getRequest()->isPost() == false or _root::getParam('formu') != 'generate') {
return null;
}
$oPluginValid = new plugin_valid(_root::getRequest()->getParams());
$oPluginValid->isNotEmpty('modulename', 'Le champ doit être rempli');
$oPluginValid->isNotEmpty('classmodel', 'Le champ doit être rempli');
$oPluginValid->isNotEmpty('redirect', 'Le champ doit être rempli');
if (!$oPluginValid->isValid()) {
return $oPluginValid->getListError();
}
$sModuleName = _root::getParam('modulename');
$sClassModuleName = 'module_' . $sModuleName;
$sRedirectModuleAction = _root::getParam('redirect');
$sModelName = _root::getParam('classmodel');
$sViewName = $sModuleName . '::login';
$this->projectMkdir('module/' . $sModuleName);
/*SOURCE*/
$oSourceMain = $this->getObjectSource('example/main.php');
/*SOURCE*/
$oSourceMain->setPattern('#MODULE#', $sModuleName);
/*SOURCE*/
$oSourceMain->setPattern('#privatemodule_action#', $sRedirectModuleAction);
/*SOURCE*/
$oSourceMain->setPattern('#model_example#', $sModelName);
/*SOURCE*/
$oSourceMain->setPattern('#auth_login#', $sViewName);
/*SOURCE*/
$oSourceMain->save();
$this->projectMkdir('module/' . $sModuleName . '/view');
/*SOURCE*/
$oSourceViewLogin = $this->getObjectSource('example/view/login.php');
/*SOURCE*/
$oSourceViewLogin->setPattern('#MODULE#', $sModuleName);
/*SOURCE*/
$oSourceViewLogin->save();
$sModuleName = _root::getParam('modulename');
$this->msg = 'Création du module ' . $sModuleName;
$this->detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModuleName));
$this->detail .= '<br/>' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleName . '/main.php'));
$this->detail .= '<br/>' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModuleName));
$this->detail .= '<br/>' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleName . '/view/login.php'));
$this->detail .= '<br/>';
$this->detail .= '<br/>' . trR('editezVotreFichier', array('#link#' => '<a target="_blank" href="' . _root::getLink('code::index', array('project' => _root::getParam('id'), 'file' => 'conf/site.ini.php')) . '">conf/site.ini.php</a>'));
$this->detail .= '<br/>
<div style="padding:8px;border:2px dotted gray">
[auth]<br/>
enabled=1<br/>
' . tr('et') . '<br/>
module=' . $sModuleName . '::login
</div>
';
}
示例8: enable
public function enable()
{
_root::startSession();
$sModuleToLoad = _root::getRequest()->getModule();
if (preg_match('/::/', _root::getConfigVar('auth.module'))) {
$tModuleAction = preg_split('/::/', _root::getConfigVar('auth.module'));
$sAuthModule = $tModuleAction[0];
} else {
$sAuthModule = _root::getConfigVar('auth.module');
}
if (!_root::getAuth()->isConnected() and $sModuleToLoad != $sAuthModule) {
_root::redirect(_root::getConfigVar('auth.module'));
}
}
示例9: _index
public function _index()
{
if (_root::getParam('config') == '') {
return $this->xmlindexselect();
}
module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
$msg = '';
$detail = '';
$tTables = array();
$tTableColumn = array();
$sConfig = _root::getParam('config');
$tTables = module_builder::getTools()->getListTablesFromConfig($sConfig);
$tTableColumn = array();
foreach ($tTables as $sTable) {
$tTableColumn[$sTable] = module_builder::getTools()->getListColumnFromConfigAndTable($sConfig, $sTable);
}
$tFileIndex = array();
if (_root::getParam('sTable') != '') {
$oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . _root::getParam('sTable') . '/index');
if (!$oDir->exist()) {
$oDir->save();
}
$tFile = array();
foreach ($oDir->getListDir() as $oFile) {
if (preg_match('/.index/', $oFile->getName())) {
$tFileIndex[] = $oFile->getName();
}
}
}
if (_root::getParam('regenerateIndexXml') != '') {
$this->regenerateIndexXml($sConfig, _root::getParam('sTable'), _root::getParam('regenerateIndexXml'));
}
if (_root::getRequest()->isPost()) {
$sTable = _root::getParam('sTable');
$tField = _root::getParam('tField');
module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index');
module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index/' . implode('.', $tField) . '.index');
$this->regenerateIndexXml($sConfig, $sTable, implode('.', $tField) . '.index');
$msg = trR('indexGenereAvecSucces', array('#listField#' => implode('.', $tField), '#maTable#' => $sTable));
$detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'data/json/base/' . $sTable . '/index'));
$detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'index data/json/base/' . $sTable . '/index/' . implode('.', $tField)));
}
$oTpl = $this->getView('index');
$oTpl->msg = $msg;
$oTpl->detail = $detail;
$oTpl->tTables = $tTables;
$oTpl->tTableColumn = $tTableColumn;
$oTpl->tFileIndex = $tFileIndex;
return $oTpl;
}
示例10: enable
public function enable()
{
_root::startSession();
$sModuleToLoad = _root::getRequest()->getModule();
if (preg_match('/::/', _root::getConfigVar('auth.module'))) {
$tModuleAction = preg_split('/::/', _root::getConfigVar('auth.module'));
$sAuthModule = $tModuleAction[0];
} else {
$sAuthModule = _root::getConfigVar('auth.module');
}
$tExcludeModule = explode(',', _root::getConfigVar('auth.module.disabled.list') . ',');
$tExcludeModule[] = $sAuthModule;
if (!_root::getAuth()->isConnected() and in_array($sModuleToLoad, $tExcludeModule) == false) {
_root::redirect(_root::getConfigVar('auth.module'));
}
}
示例11: processSave
public function processSave()
{
if (!_root::getRequest()->isPost() or _root::getParam('formmodule') != self::$sModuleName) {
//si ce n'est pas une requete POST on ne soumet pas
return null;
}
$oPluginXsrf = new plugin_xsrf();
if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
//on verifie que le token est valide
return array('token' => $oPluginXsrf->getMessage());
}
$iId = module_comments::getParam('id', null);
if ($iId == null) {
$oComments = new row_comments();
} else {
$oComments = model_comments::getInstance()->findById(module_comments::getParam('id', null));
}
$tId = model_comments::getInstance()->getIdTab();
$tColumn = model_comments::getInstance()->getListColumn();
foreach ($tColumn as $sColumn) {
$oPluginUpload = new plugin_upload($sColumn);
if ($oPluginUpload->isValid()) {
$sNewFileName = _root::getConfigVar('path.upload') . $sColumn . '_' . date('Ymdhis');
$oPluginUpload->saveAs($sNewFileName);
$oComments->{$sColumn} = $oPluginUpload->getPath();
continue;
} else {
if (_root::getParam($sColumn, null) === null) {
continue;
} else {
if (in_array($sColumn, $tId)) {
continue;
}
}
}
$oComments->{$sColumn} = _root::getParam($sColumn, null);
}
$oComments->post_id = $this->post_id;
if ($oComments->save()) {
//une fois enregistre on redirige (vers la page liste)
$this->redirect('list');
} else {
return $oComments->getListError();
}
}
示例12: process
private function process()
{
if (_root::getRequest()->isPost() == false) {
return null;
}
$this->msg = tr('coucheModeleGenereAvecSucces');
$this->detail = trR('CreationDuFichierVAR', array('#FICHIER#' => 'model/model_' . $sTable));
$this->projectMkdir('module/' . $sModuleMenuName);
/*SOURCE*/
$oSourceModel = $this->getObjectSource('example.php');
/*SOURCE*/
$oSourceModel->setPattern('#maTable#', $maTable);
$sSnippet = $oSourceModel->getSnippet('monSnippet', array('#maVar#' => $maValeur));
/*SOURCE*/
$oSourceModel->setPattern('#sSnippet#', $sSnippet);
/*SOURCE*/
$oSourceModel->save();
}
示例13: process
private function process()
{
if (_root::getRequest()->isPost() == false) {
return null;
}
$tError = null;
$msg = null;
$detail = null;
$sModule = _root::getParam('modulename');
$tMethod = _root::getParam('tMethod');
$tLabel = _root::getParam('tLabel');
$ok = 1;
//check formulaire
foreach ($tMethod as $i => $sMethod) {
if ($tLabel[$i] == '') {
$tError[$i] = tr('remplissezLeLibelle');
$ok = 0;
}
}
if ($ok) {
if (module_builder::getTools()->projetmkdir('module/' . $sModule) == true) {
$detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule));
if (module_builder::getTools()->projetmkdir('module/' . $sModule . '/view') == true) {
$detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule . '/view'));
$this->genModuleMenuMain($sModule, $tMethod, $tLabel);
$msg = trR('moduleGenereAvecSucces', array('#MODULE#' => $sModule));
$detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/main.php'));
$detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/index.php'));
$sCode = '<?php ' . "\n";
$sCode .= '//assignez le menu a l\'emplacement menu' . "\n";
$sCode .= '$this->oLayout->addModule(\'menu\',\'' . $sModule . '::index\');' . "\n";
$detail .= '<br/><br/>' . tr('pourLutiliserAjoutez') . '<br />
' . highlight_string($sCode, 1);
} else {
$detail .= '<br />' . trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule . '/view'));
}
} else {
$detail = trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule . '/view'));
}
}
$this->tError = $tError;
$this->detail = $detail;
$this->msg = $msg;
}
示例14: __construct
public function __construct($sMicrotime)
{
$this->iStartMicrotime = self::microtime($sMicrotime);
$iEndTime = self::microtime();
self::$tTime[] = array('End', $iEndTime);
$iDiff = $iEndTime - $this->iStartMicrotime;
$this->add('Time', sprintf('%0.3f', $iDiff) . 's');
$this->addComplexTimes('times', self::$tTime);
$this->addComplex('$_GET', print_r($_GET, 1));
if (isset($_POST)) {
$this->addComplex('$_POST', print_r($_POST, 1));
}
if (isset($_SESSION)) {
$this->addComplex('$_SESSION', print_r($_SESSION, 1));
}
if (isset($_SERVER)) {
$this->addComplex('$_SERVER', print_r($_SERVER, 1));
}
$oRequest = _root::getRequest();
$this->add('Module', $oRequest->getModule());
$this->add('Action', $oRequest->getAction());
$oFileLog = new _file(_root::getConfigVar('path.log', 'data/log/') . date('Y-m-d') . '_log.csv');
if ($oFileLog->exist()) {
$oFileLog->load();
$sContentLog = $oFileLog->getContent();
$this->addFileLog('File log', $sContentLog);
}
$sVarIniConfig = _root::getConfigVar('model.ini.var', 'db');
$tClassSgbd = _root::getConfigVar($sVarIniConfig);
$this->addComplexIni('Connexions', array($sVarIniConfig => $tClassSgbd));
$tConfigSection = array('path', 'cache', 'language', 'auth', 'acl', 'navigation', 'urlrewriting', 'security', 'log', 'check', 'path', 'model');
$tConfig = array();
foreach ($tConfigSection as $sSection) {
$tConfig[$sSection] = _root::getConfigVar($sSection);
}
$this->addComplexIni('Config', $tConfig);
if (self::$tSpy) {
$this->addComplexSpy('Spy variables', self::$tSpy);
}
$this->addAcl();
}
示例15: checkLoginPass
private function checkLoginPass()
{
//si le formulaire n'est pas envoye on s'arrete la
if (!_root::getRequest()->isPost()) {
return null;
}
$sLogin = _root::getParam('login');
$sPassword = _root::getParam('password');
if (strlen($sPassword > $this->maxPasswordLength)) {
return 'Mot de passe trop long';
}
//on stoque les mots de passe hashe dans la classe model_example
$sHashPassword = model_example::getInstance()->hashPassword($sPassword);
$tAccount = model_example::getInstance()->getListAccount();
//on va verifier que l'on trouve dans le tableau retourne par notre model
//l'entree $tAccount[ login ][ mot de passe hashe ]
if (!_root::getAuth()->checkLoginPass($tAccount, $sLogin, $sHashPassword)) {
return 'Mauvais login/mot de passe';
}
_root::redirect('privatemodule_action');
}