本文整理汇总了PHP中throw404函数的典型用法代码示例。如果您正苦于以下问题:PHP throw404函数的具体用法?PHP throw404怎么用?PHP throw404使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了throw404函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
public function actionUpdate($id)
{
$model = $this->loadModel($id);
$model->scenario = 'update';
if (issetModule('rbac')) {
if (Yii::app()->user->role == User::ROLE_MODERATOR && $model->role == User::ROLE_ADMIN) {
throw404();
}
}
$this->performAjaxValidation($model);
if (isset($_POST[$this->modelName])) {
$model->attributes = $_POST[$this->modelName];
if (isset($_POST[$this->modelName]['password']) && $_POST[$this->modelName]['password']) {
if (demo()) {
Yii::app()->user->setFlash('error', tc('Sorry, this action is not allowed on the demo server.'));
unset($model->password, $model->salt);
$this->redirect(array('update', 'id' => $model->id));
} else {
$model->scenario = 'changePass';
}
} else {
unset($model->password, $model->salt);
}
if ($model->validate()) {
if ($model->scenario == 'changePass') {
$model->setPassword();
}
if ($model->save(false)) {
$this->redirect(array('view', 'id' => $model->id));
}
}
}
$this->render('update', array('model' => $model));
}
开发者ID:barricade86,项目名称:raui,代码行数:34,代码来源:MainController.php
示例2: actionSearch
public function actionSearch($type = 'all')
{
if (!param('useShowUserInfo')) {
throw new CHttpException(403, tt('Displays information about the users is disabled by the administrator', 'users'));
}
$usersListPage = Menu::model()->findByPk(Menu::USERS_LIST_ID);
if ($usersListPage) {
if ($usersListPage->active == 0) {
throw404();
}
}
$this->showSearchForm = false;
$existTypes = User::getTypeList('withAll');
$criteria = new CDbCriteria();
$type = in_array($type, array_keys($existTypes)) ? $type : 'all';
//$criteria->compare('active', 1);
if ($type != 'all') {
$criteria->compare('type', $type);
}
//$criteria->compare('isAdmin', 0);
$criteria->with = array('countAdRel');
$sort = new CSort();
$sort->sortVar = 'sort';
$sort->defaultOrder = 'date_created DESC';
$sort->multiSort = true;
$sort->attributes = array('username' => array('label' => tc('by username'), 'default' => 'desc'), 'date_created' => array('label' => tc('by date of registration'), 'default' => 'desc'));
$dataProvider = new CActiveDataProvider(User::model()->active(), array('criteria' => $criteria, 'sort' => $sort, 'pagination' => array('pageSize' => 12)));
$this->render('search', array('dataProvider' => $dataProvider, 'type' => $type));
}
开发者ID:alexjkitty,项目名称:estate,代码行数:29,代码来源:MainController.php
示例3: actionRead
public function actionRead()
{
$id = Yii::app()->request->getParam('id');
$apId = (int) Yii::app()->request->getParam('apId');
if (!$id) {
throw404();
}
$user = User::model()->findByPk($id);
Yii::app()->user->setState('menu_active', 'messages.read');
$model = new $this->modelName();
// выставляем флаг о прочитанности
$unRealMessages = Messages::model()->unReadUser()->criteriaUser($id, Yii::app()->user->id)->findAll(array('select' => 'id'));
$idArr = array();
foreach ($unRealMessages as $item) {
$idArr[] = (int) $item->id;
}
if (count($idArr) > 0) {
Messages::model()->updateByPk($idArr, array('is_read' => Messages::STATUS_READ_USER, 'date_read' => new CDbExpression('NOW()')));
}
$allMessages = $pages = null;
$return = Messages::getAllMessagesUser($id);
if ($return) {
$allMessages = $return['allMessages'];
$pages = $return['pages'];
}
# если нет сообщений от выбранного пользователя
/*if (!$allMessages)
throw404();*/
$this->render('read', array('allMessages' => $allMessages, 'pages' => $pages, 'senderInfo' => $user, 'model' => $model, 'uid' => $id, 'apId' => $apId));
}
开发者ID:barricade86,项目名称:raui,代码行数:30,代码来源:MainController.php
示例4: beforeSave
public function beforeSave()
{
if (!$this->isNewRecord && $this->owner_id != Yii::app()->user->id) {
throw404();
}
return parent::beforeSave();
}
开发者ID:alexjkitty,项目名称:estate,代码行数:7,代码来源:UserAds.php
示例5: actionView
public function actionView($id = 0, $url = '')
{
if ($url && issetModule('seo')) {
$seo = SeoFriendlyUrl::getForView($url, $this->modelName);
if (!$seo) {
throw404();
}
$this->setSeo($seo);
$id = $seo->model_id;
}
$model = $this->loadModel($id, 1);
if (!$model->active) {
throw404();
}
if ($model->id == 4) {
//User Agreement
$field = 'body_' . Yii::app()->language;
$model->{$field} = str_replace('{site_domain}', IdnaConvert::checkDecode(Yii::app()->getBaseUrl(true)), $model->{$field});
$model->{$field} = str_replace('{site_title}', CHtml::encode(Yii::app()->name), $model->{$field});
}
$this->showSearchForm = $model->widget && $model->widget == 'apartments' ? true : false;
if (Yii::app()->request->isAjaxRequest) {
$this->renderPartial('view', array('model' => $model));
} else {
$this->render('view', array('model' => $model));
}
}
开发者ID:barricade86,项目名称:raui,代码行数:27,代码来源:MainController.php
示例6: beforeAction
protected function beforeAction($action)
{
if (oreInstall::isInstalled()) {
throw404();
}
$this->setLangInstall();
return parent::beforeAction($action);
}
开发者ID:barricade86,项目名称:raui,代码行数:8,代码来源:MainController.php
示例7: actionDeleteOption
public function actionDeleteOption($id)
{
$model = PaidOptions::model()->findByPk($id);
if (!$model) {
throw404();
}
$model->delete();
$this->redirect(array('admin'));
}
开发者ID:barricade86,项目名称:raui,代码行数:9,代码来源:MainController.php
示例8: checkOwnerImage
public function checkOwnerImage($id)
{
$this->modelName = 'Images';
$model = $this->loadModel($id);
if (!$model || !Yii::app()->user->getState('isAdmin') && Yii::app()->user->id != $model->id_owner) {
throw404();
}
return $model;
}
开发者ID:alexjkitty,项目名称:estate,代码行数:9,代码来源:MainController.php
示例9: init
public function init()
{
parent::init();
$vacancyPage = Menu::model()->findByPk(Menu::VACANCY_ID);
if ($vacancyPage) {
if ($vacancyPage->active == 0) {
throw404();
}
}
}
开发者ID:barricade86,项目名称:raui,代码行数:10,代码来源:MainController.php
示例10: init
public function init()
{
parent::init();
$reviewsPage = Menu::model()->findByPk(Menu::REVIEWS_ID);
if ($reviewsPage) {
if ($reviewsPage->active == 0) {
throw404();
}
}
}
开发者ID:alexjkitty,项目名称:estate,代码行数:10,代码来源:MainController.php
示例11: init
public function init()
{
parent::init();
$specialOfferPage = Menu::model()->findByPk(Menu::SPECIALOFFERS_ID);
if ($specialOfferPage) {
if ($specialOfferPage->active == 0) {
throw404();
}
}
}
开发者ID:alexjkitty,项目名称:estate,代码行数:10,代码来源:MainController.php
示例12: actionBuyTariffPlan
public function actionBuyTariffPlan()
{
$this->layout = '//layouts/usercpanel';
$user = HUser::getModel();
$tariffId = Yii::app()->request->getParam('tariffid');
if (!$user || !$tariffId) {
throw404();
}
$currentTariffModel = TariffPlans::model()->findByPk($tariffId);
if (!$currentTariffModel || $currentTariffModel->active != TariffPlans::STATUS_ACTIVE) {
throw404();
}
// check current user tariff plan
$currentTariffPlanInfo = TariffPlans::getTariffInfoByUserId($user->id);
if ($currentTariffPlanInfo['issetTariff'] && $currentTariffPlanInfo['tariffDuration']) {
if (!$currentTariffPlanInfo['activeTariff']) {
Yii::app()->user->setFlash('error', Yii::t("module_tariffPlans", "You can only extend the tariff plan {name}", array("{name}" => $currentTariffPlanInfo['tariffName'])));
$this->redirect(array('choosetariffplans'));
Yii::app()->end();
}
}
// check balance
if ($currentTariffModel->price) {
# платный тариф
if ($currentTariffModel->price > $user->balance) {
Yii::app()->user->setFlash('error', tt('On your balance is not enough money to buy the chosen tariff plan', 'tariffPlans'));
$this->redirect(array('choosetariffplans'));
Yii::app()->end();
}
}
// check object count
if ($currentTariffModel->limit_objects) {
$usersObjects = TariffPlans::getCountUserObjects($user->id);
if ($usersObjects > $currentTariffModel->limit_objects) {
Yii::app()->user->setFlash('error', tt('The number of added ads exceeds the limit of the tariff. Remove its not relevant your ads and try again.', 'tariffPlans'));
$this->redirect(array('choosetariffplans'));
Yii::app()->end();
}
}
// apply action
$interval = 'INTERVAL ' . $currentTariffModel->duration . ' DAY';
$dateEnd = new CDbExpression('NOW() + ' . $interval);
if (TariffPlans::applyToUser($user->id, $tariffId, $dateEnd, $interval)) {
if ($currentTariffModel->price) {
# платный тариф
$user->deductBalance($currentTariffModel->price);
}
Yii::app()->user->setFlash('success', tt('Tariff plan has been successfully applied', 'tariffPlans'));
$this->redirect(array('tariffhistory'));
} else {
Yii::app()->user->setFlash('error', tc('Error. Repeat attempt later'));
$this->redirect(array('choosetariffplans'));
Yii::app()->end();
}
}
开发者ID:barricade86,项目名称:raui,代码行数:55,代码来源:MainController.php
示例13: init
public function init()
{
// если админ - делаем редирект на просмотр в админку
if (Yii::app()->user->getState('isAdmin')) {
$this->redirect($this->createAbsoluteUrl('/bookingtable/backend/main/admin'));
}
if (!param('useUserads')) {
throw404();
}
parent::init();
}
开发者ID:alexjkitty,项目名称:estate,代码行数:11,代码来源:MainController.php
示例14: actionIndex
public function actionIndex()
{
$newsPage = Menu::model()->findByPk(Menu::NEWS_ID);
if ($newsPage) {
if ($newsPage->active == 0) {
throw404();
}
}
$model = new $this->modelName();
$result = $model->getAllWithPagination();
$this->render('index', array('items' => $result['items'], 'pages' => $result['pages']));
}
开发者ID:barricade86,项目名称:raui,代码行数:12,代码来源:MainController.php
示例15: actionView
public function actionView($id = 0, $url = '')
{
if ($url && issetModule('seo')) {
$seo = SeoFriendlyUrl::getForView($url, $this->modelName);
if (!$seo) {
throw404();
}
$this->setSeo($seo);
$id = $seo->model_id;
}
$model = $this->loadModel($id, 1);
$this->render('view', array('model' => $model));
}
开发者ID:barricade86,项目名称:raui,代码行数:13,代码来源:ModuleUserController.php
示例16: run
function run()
{
$path = $_SERVER['REQUEST_URI'];
$method = $_SERVER['REQUEST_METHOD'];
$endpoints = getEndpoints();
if (!array_key_exists($method, $endpoints)) {
throw404();
}
if (!array_key_exists($path, $endpoints[$method])) {
throw404();
}
$endpoint = $endpoints[$method][$path];
header('content-type: ' . $endpoint['contentType']);
echo $endpoint['body'];
}
开发者ID:tomphp,项目名称:hal-client,代码行数:15,代码来源:index.php
示例17: actionView
public function actionView($id = 0, $url = '')
{
$criteria = new CDbCriteria();
$criteria->order = 'sorter';
$criteria->condition = 'active=1';
$articles = Article::model()->cache(param('cachingTime', 1209600), Article::getCacheDependency())->findAll($criteria);
if ($url && issetModule('seo')) {
$seo = SeoFriendlyUrl::getForView($url, $this->modelName);
if (!$seo) {
throw404();
}
$this->setSeo($seo);
$id = $seo->model_id;
}
$this->render('view', array('model' => $this->loadModel($id), 'articles' => $articles));
}
开发者ID:barricade86,项目名称:raui,代码行数:16,代码来源:MainController.php
示例18: actionDeleteImg
public function actionDeleteImg()
{
$newsId = Yii::app()->request->getParam('id');
$imageId = Yii::app()->request->getParam('imId');
if ($newsId && $imageId) {
$newsModel = News::model()->findByPk($newsId);
if ($newsModel->image_id != $imageId) {
throw404();
}
$newsModel->image_id = 0;
$newsModel->update('image_id');
$imageModel = NewsImage::model()->findByPk($imageId);
$imageModel->delete();
$this->redirect(array('/news/backend/main/update', 'id' => $newsId));
}
throw404();
}
开发者ID:barricade86,项目名称:raui,代码行数:17,代码来源:MainController.php
示例19: actionUpdate
public function actionUpdate($id)
{
$model = $this->loadModel($id);
if (!$model) {
throw404();
}
//Yii::app()->user->setState('menu_active', 'clients.update');
Yii::app()->user->setState('menu_active', 'clients');
$this->performAjaxValidation($model);
if (isset($_POST[$this->modelName])) {
$model->attributes = $_POST[$this->modelName];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('update', array('model' => $model));
}
开发者ID:barricade86,项目名称:raui,代码行数:17,代码来源:MainController.php
示例20: actionComplain
public function actionComplain($isFancy = 0)
{
$id = Yii::app()->request->getParam('id', 0);
if (!$id) {
throw404();
}
$model = new $this->modelName();
$modelApartment = Apartment::model()->findByPk($id);
if (!$modelApartment) {
throw404();
}
if (isset($_POST[$this->modelName]) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
$model->attributes = $_POST[$this->modelName];
$model->apartment_id = $id;
$model->session_id = Yii::app()->session->sessionId;
$model->user_id = 0;
$model->user_ip = Yii::app()->controller->currentUserIp;
$model->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong;
if (!Yii::app()->user->isGuest) {
$model->email = Yii::app()->user->email;
$model->name = Yii::app()->user->username;
$model->user_id = Yii::app()->user->id;
}
if ($model->validate()) {
if ($this->checkAlreadyComplain($model->apartment_id, $model->user_id, $model->session_id)) {
if ($model->save(false)) {
$notifier = new Notifier();
$notifier->raiseEvent('onNewComplain', $model);
Yii::app()->user->setFlash('success', tt('Thanks_for_complain', 'apartmentsComplain'));
$model = new $this->modelName();
// clear fields
}
} else {
Yii::app()->user->setFlash('notice', tt('your_already_post_complain', 'apartmentsComplain'));
}
}
}
if ($isFancy) {
Yii::app()->clientscript->scriptMap['jquery.js'] = false;
Yii::app()->clientscript->scriptMap['jquery.min.js'] = false;
Yii::app()->clientscript->scriptMap['jquery-ui.min.js'] = false;
$this->renderPartial('complain_form', array('model' => $model, 'apId' => $id, 'isFancy' => true, 'modelApartment' => $modelApartment), false, true);
} else {
$this->render('complain_form', array('model' => $model, 'apId' => $id, 'modelApartment' => $modelApartment, 'wtf' => 'huilo'));
}
}
开发者ID:barricade86,项目名称:raui,代码行数:46,代码来源:MainController.php
注:本文中的throw404函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论