本文整理汇总了PHP中PH7\Form::errorTokenMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::errorTokenMsg方法的具体用法?PHP Form::errorTokenMsg怎么用?PHP Form::errorTokenMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PH7\Form
的用法示例。
在下文中一共展示了Form::errorTokenMsg方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeThumb
private function removeThumb($iId)
{
if (!(new Framework\Security\CSRF\Token())->checkUrl()) {
exit(Form::errorTokenMsg());
}
(new Blog())->deleteThumb($iId, 'blog', $this->file);
HeaderUrl::redirect(Uri::get('blog', 'admin', 'edit', $iId), t('The thumbnail has been deleted successfully!'));
}
示例2: deleteAll
public function deleteAll()
{
if (!(new Framework\Security\CSRF\Token())->check('subscriber_action')) {
$this->sMsg = Form::errorTokenMsg();
} elseif (count($this->httpRequest->post('action')) > 0) {
foreach ($this->httpRequest->post('action') as $sEmail) {
$this->oSubscriptionModel->unsubscribe($sEmail);
}
$this->sMsg = t('The subscribers(s) has been deleted.');
}
Header::redirect(Uri::get('newsletter', 'admin', 'browse'), $this->sMsg);
}
示例3: deleteAll
public function deleteAll()
{
if (!(new Framework\Security\CSRF\Token())->check('report_action')) {
$this->sMsg = Form::errorTokenMsg();
} elseif (count($this->httpRequest->post('action')) > 0) {
foreach ($this->httpRequest->post('action') as $iId) {
$iId = (int) $iId;
$this->oReportModel->delete($iId);
}
$this->sMsg = t('The report has been deleted.');
}
HeaderUrl::redirect(Uri::get('report', 'admin', 'index'), $this->sMsg);
}
示例4: deleteAll
public function deleteAll()
{
if (!(new Framework\Security\CSRF\Token())->check('admin_action')) {
$this->sMsg = Form::errorTokenMsg();
} elseif (count($this->httpRequest->post('action')) > 0) {
foreach ($this->httpRequest->post('action') as $sAction) {
$aData = explode('_', $sAction);
$iId = (int) $aData[0];
$sUsername = (string) $aData[1];
(new Admin())->delete($iId, $sUsername);
}
$this->sMsg = t('The admin(s) has been deleted.');
}
Header::redirect(Uri::get(PH7_ADMIN_MOD, 'admin', 'browse'), $this->sMsg);
}
示例5: __construct
public function __construct()
{
if (!(new Framework\Security\CSRF\Token())->check('report')) {
exit(jsonMsg(0, Form::errorTokenMsg()));
}
$this->_oHttpRequest = new Http();
$this->_oReportModel = new ReportModel();
switch ($this->_oHttpRequest->post('type')) {
case 'delete':
$this->delete();
break;
default:
Framework\Http\Http::setHeadersByCode(400);
exit('Bad Request Error');
}
}
示例6: __construct
public function __construct()
{
if (!(new Framework\Security\CSRF\Token())->check('comment')) {
exit(jsonMsg(0, Form::errorTokenMsg()));
}
/** Instance objects for the class * */
$this->_oSession = new Session();
$this->_oHttpRequest = new Http();
$this->_oCommentModel = new CommentModel();
switch ($this->_oHttpRequest->post('type')) {
case 'delete':
$this->delete();
break;
default:
Framework\Http\Http::setHeadersByCode(400);
exit('Bad Request Error!');
}
}
示例7: removeThumb
public function removeThumb($iId)
{
if (!(new Framework\Security\CSRF\Token())->checkUrl()) {
exit(Form::errorTokenMsg());
}
$iProfileId = $this->session->get('member_id');
$this->_deleteThumbFile($iId, $iProfileId);
$this->oNoteModel->deleteThumb($iId, $iProfileId);
/* Clean BlogModel Cache */
(new Framework\Cache\Cache())->start(NoteModel::CACHE_GROUP, null, null)->clear();
Header::redirect(Uri::get('note', 'main', 'edit', $iId), t('The thumbnail has been deleted successfully!'));
}
示例8: backup
public function backup()
{
$this->view->designSecurity = new Framework\Layout\Html\Security();
// Security Design Class
$this->sTitle = t('Backup Management');
$this->view->page_title = $this->sTitle;
$this->view->h1_title = $this->sTitle;
$aDumpList = $this->file->getFileList(PH7_PATH_BACKUP_SQL, array('.sql', '.gz'));
// Removing the path
$aDumpList = array_map(function ($sValue) {
return str_replace(PH7_PATH_BACKUP_SQL, '', $sValue);
}, $aDumpList);
$this->view->aDumpList = $aDumpList;
$oSecurityToken = new Framework\Security\CSRF\Token();
if ($this->httpRequest->postExists('backup')) {
if (!$oSecurityToken->check('backup')) {
$this->design->setFlashMsg(Form::errorTokenMsg(), 'error');
} else {
switch ($this->httpRequest->post('backup_type')) {
case 'server':
$sFullPath = PH7_PATH_BACKUP_SQL . 'Database-dump.' . (new Framework\Date\CDateTime())->get()->date() . '.sql';
(new D\Util\Backup($sFullPath))->back()->save();
$this->view->msg_success = t('Data successfully dumped into file "%0%"', $sFullPath);
break;
case 'server_archive':
$sFullPath = PH7_PATH_BACKUP_SQL . 'Database-dump.' . (new Framework\Date\CDateTime())->get()->date() . '.sql.gz';
(new D\Util\Backup($sFullPath))->back()->saveArchive();
$this->view->msg_success = t('Data successfully dumped into file "%0%"', $sFullPath);
break;
case 'client':
(new D\Util\Backup($this->registry->site_name . '_' . (new Framework\Date\CDateTime())->get()->date() . '.sql'))->back()->download();
break;
case 'client_archive':
(new D\Util\Backup($this->registry->site_name . '_' . (new Framework\Date\CDateTime())->get()->date() . '.sql.gz'))->back()->downloadArchive();
break;
case 'show':
$this->view->sql_content = (new D\Util\Backup())->back()->show();
break;
default:
$this->design->setFlashMsg(t('Please select a field.'), 'error');
}
}
}
if ($this->httpRequest->postExists('restore_dump')) {
if (!$oSecurityToken->check('backup')) {
$this->design->setFlashMsg(Form::errorTokenMsg(), 'error');
} else {
$sDumpFile = $this->httpRequest->post('dump_file');
if (!empty($sDumpFile)) {
if ($this->file->getFileExt($sDumpFile) == 'sql') {
$mStatus = (new D\Util\Backup($sDumpFile))->restore();
} elseif ($this->file->getFileExt($sNameFile) == 'gz') {
$mStatus = (new D\Util\Backup(PH7_PATH_BACKUP_SQL . $sDumpFile))->restoreArchive();
} else {
$mStatus = t('Dump file must be a SQL type (extension ".sql" or compressed archive ".gz")');
}
} else {
$mStatus = t('Please select a dump file.');
}
$sMsg = $mStatus === true ? t('Data successfully restored from server!') : $mStatus;
$sMsgType = $mStatus === true ? 'success' : 'error';
$this->design->setFlashMsg($sMsg, $sMsgType);
}
}
if ($this->httpRequest->postExists('remove_dump')) {
if (!$oSecurityToken->check('backup')) {
$this->design->setFlashMsg(Form::errorTokenMsg(), 'error');
} else {
$sDumpFile = $this->httpRequest->post('dump_file');
if (!empty($sDumpFile)) {
$this->file->deleteFile(PH7_PATH_BACKUP_SQL . $sDumpFile);
$this->design->setFlashMsg(t('Dump file successfully deleted!'));
} else {
$this->design->setFlashMsg(t('Please select a dump file.'), 'error');
}
}
}
unset($oSecurityToken);
if ($this->httpRequest->postExists('restore_sql_file')) {
if (!empty($_FILES['sql_file']['tmp_name'])) {
$sNameFile = $_FILES['sql_file']['name'];
$sTmpFile = $_FILES['sql_file']['tmp_name'];
if ($this->file->getFileExt($sNameFile) == 'sql') {
$mStatus = (new D\Util\Backup($sTmpFile))->restore();
} elseif ($this->file->getFileExt($sNameFile) == 'gz') {
$mStatus = (new D\Util\Backup($sTmpFile))->restoreArchive();
} else {
$mStatus = t('Dump file must be a SQL type (extension ".sql" or compressed archive ".gz")');
}
// Remove the temporary file
$this->file->deleteFile($sTmpFile);
} else {
$mStatus = t('Please select a dump SQL file.');
}
$sMsg = $mStatus === true ? t('Data successfully restored from desktop!') : $mStatus;
$sMsgType = $mStatus === true ? 'success' : 'error';
$this->design->setFlashMsg($sMsg, $sMsgType);
}
$this->output();
}
示例9: setDeleteAll
public function setDeleteAll()
{
if (!(new Framework\Security\CSRF\Token())->check('mail_action')) {
$this->sMsg = Form::errorTokenMsg();
} else {
if (count($this->httpRequest->post('action')) > 0) {
foreach ($this->httpRequest->post('action') as $iId) {
$iId = (int) $iId;
if ($this->_bAdminLogged) {
$this->oMailModel->adminDeleteMsg($iId);
} else {
$this->oMailModel->setTo($this->_iProfileId, $iId, 'delete');
}
}
$this->sMsg = t('Your message(s) has been deleted successfully!');
}
}
$sUrl = $this->_bAdminLogged ? Uri::get('mail', 'admin', 'msglist') : $this->httpRequest->previousPage();
HeaderUrl::redirect($sUrl, $this->sMsg);
}