当前位置: 首页>>代码示例>>PHP>>正文


PHP cmsCore::error404方法代码示例

本文整理汇总了PHP中cmsCore::error404方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::error404方法的具体用法?PHP cmsCore::error404怎么用?PHP cmsCore::error404使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmsCore的用法示例。


在下文中一共展示了cmsCore::error404方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     $comment_id = $this->request->get('comment_id');
     $score = $this->request->get('score');
     // Проверяем валидность
     $is_valid = is_numeric($comment_id) && in_array($score, array(-1, 1));
     $template = cmsTemplate::getInstance();
     if (!$is_valid) {
         $template->renderJSON(array('error' => true));
     }
     $user = cmsUser::getInstance();
     $is_can_rate = cmsUser::isAllowed('comments', 'rate');
     if (!$is_can_rate) {
         $template->renderJSON(array('error' => true));
     }
     $is_voted = $this->model->isUserVoted($comment_id, $user->id);
     if ($is_voted) {
         $template->renderJSON(array('error' => true));
     }
     $comment = $this->model->getComment($comment_id);
     if ($comment['user_id'] == $user->id) {
         $template->renderJSON(array('error' => true));
     }
     $success = $this->model->rateComment($comment_id, $user->id, $score);
     $template->renderJSON(array('error' => !$success));
 }
开发者ID:asphix,项目名称:icms2,代码行数:29,代码来源:rate.php

示例2: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     if (!$this->cms_user->is_logged) {
         return $this->cms_template->renderJSON(array('error' => true));
     }
     if (cmsUser::isPermittedLimitHigher('comments', 'karma', $this->cms_user->karma)) {
         return $this->cms_template->renderJSON(array('error' => true));
     }
     $target_controller = $this->request->get('tc', '');
     $target_subject = $this->request->get('ts', '');
     $target_id = $this->request->get('ti', 0);
     $is_track = $this->request->get('is_track', 0);
     if (!$target_controller || !$target_subject || !$target_id) {
         return $this->cms_template->renderJSON(array('error' => true));
     }
     $is_valid = $this->validate_sysname($target_controller) === true && $this->validate_sysname($target_subject) === true && is_numeric($target_id) && is_numeric($is_track);
     if (!$is_valid) {
         return $this->cms_template->renderJSON(array('error' => true));
     }
     $success = $this->model->filterEqual('target_controller', $target_controller)->filterEqual('target_subject', $target_subject)->filterEqual('target_id', $target_id)->toggleTracking($is_track, $this->cms_user->id, $target_controller, $target_subject, $target_id);
     return $this->cms_template->renderJSON(array('error' => !$success));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:25,代码来源:track.php

示例3: run

 public function run($id)
 {
     if (!$id) {
         cmsCore::error404();
     }
     $form = $this->getForm('preset', array('edit'));
     $is_submitted = $this->request->has('submit');
     $preset = $original_preset = $this->model->getPreset($id);
     if ($preset['is_internal']) {
         $form->removeFieldset('basic');
     }
     if ($is_submitted) {
         $preset = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $preset);
         if (!$errors) {
             $this->model->updatePreset($id, $preset);
             $this->createDefaultImages(array_merge($original_preset, $preset));
             $this->redirectToAction('presets');
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('backend/preset', array('do' => 'edit', 'preset' => $preset, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:pin-git,项目名称:icms2,代码行数:25,代码来源:presets_edit.php

示例4: run

 public function run($profile)
 {
     $user = cmsUser::getInstance();
     // проверяем наличие доступа
     if ($profile['id'] != $user->id && !$user->is_admin) {
         cmsCore::error404();
     }
     $template = cmsTemplate::getInstance();
     if (!$template->hasProfileThemesOptions()) {
         cmsCore::error404();
     }
     $form = $template->getProfileOptionsForm();
     // Форма отправлена?
     $is_submitted = $this->request->has('submit');
     $theme = $profile['theme'];
     if ($is_submitted) {
         // Парсим форму и получаем поля записи
         $theme = array_merge($theme, $form->parse($this->request, $is_submitted, $theme));
         // Проверям правильность заполнения
         $errors = $form->validate($this, $theme);
         if (!$errors) {
             // Обновляем профиль и редиректим на его просмотр
             $this->model->updateUserTheme($profile['id'], $theme);
             $this->redirectTo('users', $profile['id']);
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return $template->render('profile_edit_theme', array('id' => $profile['id'], 'profile' => $profile, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:31,代码来源:profile_edit_theme.php

示例5: run

 public function run($ctype_id)
 {
     if (!$ctype_id) {
         cmsCore::error404();
     }
     $content_model = cmsCore::getModel('content');
     $ctype = $content_model->getContentType($ctype_id);
     if (!$ctype) {
         cmsCore::error404();
     }
     $form = $this->getForm('ctypes_dataset', array('add', $ctype['id']));
     $is_submitted = $this->request->has('submit');
     $fields = $content_model->getContentFields($ctype['name']);
     $dataset = array('sorting' => array(array('by' => 'date_pub', 'to' => 'desc')));
     if ($is_submitted) {
         $dataset = $form->parse($this->request, $is_submitted);
         $dataset['filters'] = $this->request->get('filters');
         $dataset['sorting'] = $this->request->get('sorting');
         $errors = $form->validate($this, $dataset);
         if (!$errors) {
             $dataset_id = $content_model->addContentDataset($dataset, $ctype);
             if ($dataset_id) {
                 cmsUser::addSessionMessage(sprintf(LANG_CP_DATASET_CREATED, $dataset['title']), 'success');
             }
             $this->redirectToAction('ctypes', array('datasets', $ctype['id']));
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('ctypes_dataset', array('do' => 'add', 'ctype' => $ctype, 'dataset' => $dataset, 'fields' => $fields, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:pin-git,项目名称:icms2,代码行数:32,代码来源:ctypes_datasets_add.php

示例6: run

 public function run($table = null, $item_id = null)
 {
     header('X-Frame-Options: DENY');
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     if (!$item_id || !$table || !is_numeric($item_id) || $this->validate_regexp('/^([a-z0-9\\_{}]*)$/', urldecode($table)) !== true) {
         $this->cms_template->renderJSON(array('error' => LANG_ERROR));
     }
     $data = $this->request->get('data', array());
     if (!$data) {
         $this->cms_template->renderJSON(array('error' => LANG_ERROR));
     }
     $i = $this->model->getItemByField($table, 'id', $item_id);
     if (!$i) {
         $this->cms_template->renderJSON(array('error' => LANG_ERROR));
     }
     foreach ($data as $field => $value) {
         if (!array_key_exists($field, $i)) {
             unset($data[$field]);
         } else {
             $_data[$field] = htmlspecialchars($value);
         }
     }
     if (empty($data)) {
         $this->cms_template->renderJSON(array('error' => LANG_ERROR));
     }
     $this->model->update($table, $item_id, $data);
     $this->cms_template->renderJSON(array('error' => false, 'values' => $_data));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:30,代码来源:inline_save.php

示例7: run

 public function run($profile)
 {
     // проверяем наличие доступа
     if ($profile['id'] != $this->cms_user->id) {
         cmsCore::error404();
     }
     // Форма отправлена?
     $is_submitted = $this->request->has('submit');
     if (!$is_submitted && !$profile['invites_count']) {
         cmsCore::error404();
     }
     $form = new cmsForm();
     $fieldset_id = $form->addFieldset();
     if ($profile['invites_count'] > 1) {
         $form->addField($fieldset_id, new fieldText('emails', array('title' => LANG_USERS_INVITES_EMAILS, 'hint' => LANG_USERS_INVITES_EMAILS_HINT, 'rules' => array(array('required')))));
     }
     if ($profile['invites_count'] == 1) {
         $form->addField($fieldset_id, new fieldString('emails', array('title' => LANG_USERS_INVITES_EMAIL, 'rules' => array(array('required'), array('email')))));
     }
     $input = array();
     if ($is_submitted) {
         // Парсим форму и получаем поля записи
         $input = $form->parse($this->request, $is_submitted);
         // Проверям правильность заполнения
         $errors = $form->validate($this, $input);
         if (!$errors) {
             $results = $this->sendInvites($profile, $input['emails']);
             return $this->cms_template->render('profile_invites_results', array('id' => $profile['id'], 'profile' => $profile, 'results' => $results));
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return $this->cms_template->render('profile_invites', array('id' => $profile['id'], 'profile' => $profile, 'form' => $form, 'input' => $input, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:35,代码来源:profile_invites.php

示例8: run

 public function run($ctype_name)
 {
     $values = $this->request->get('value');
     if (!$values || !$ctype_name) {
         cmsCore::error404();
     }
     $content_model = cmsCore::getModel('content');
     $ctype = $content_model->getContentTypeByName($ctype_name);
     if (!$ctype) {
         cmsCore::error404();
     }
     $rules = cmsPermissions::getRulesList('content');
     list($ctype, $rules, $values) = cmsEventsManager::hook('content_perms', array($ctype, $rules, $values));
     list($ctype, $rules, $values) = cmsEventsManager::hook("content_{$ctype['name']}_perms", array($ctype, $rules, $values));
     $users_model = cmsCore::getModel('users');
     $groups = $users_model->getGroups(false);
     // перебираем правила
     foreach ($rules as $rule) {
         // если для этого правила вообще ничего нет,
         // то присваиваем null
         if (empty($values[$rule['id']])) {
             $values[$rule['id']] = null;
             continue;
         }
         // перебираем группы, заменяем на нуллы
         // значения отсутствующих правил
         foreach ($groups as $group) {
             if (empty($values[$rule['id']][$group['id']])) {
                 $values[$rule['id']][$group['id']] = null;
             }
         }
     }
     cmsPermissions::savePermissions($ctype_name, $values);
     $this->redirectBack();
 }
开发者ID:asphix,项目名称:icms2,代码行数:35,代码来源:ctypes_perms_save.php

示例9: f_pages

function f_pages(&$text)
{
    if (mb_strpos($text, 'pagebreak') === false) {
        return true;
    }
    $seolink = urldecode(cmsCore::request('seolink', 'str', ''));
    $seolink = preg_replace('/[^a-zа-я-яёіїєґА-ЯЁІЇЄҐ0-9_\\/\\-]/ui', '', $seolink);
    if (!$seolink) {
        return true;
    }
    $regex = '/{(pagebreak)\\s*(.*?)}/iu';
    $pages = preg_split($regex, $text);
    $n = count($pages);
    if ($n <= 1) {
        return true;
    } else {
        $page = cmsCore::request('page', 'int', 1);
        $text = $pages[$page - 1];
        if (!$text) {
            cmsCore::error404();
        }
        cmsCore::loadModel('content');
        $text .= cmsPage::getPagebar($n, $page, 1, cms_model_content::getArticleURL(null, $seolink, '%page%'));
        return true;
    }
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:26,代码来源:filter.php

示例10: run

 public function run($template_name)
 {
     $template = new cmsTemplate($template_name);
     if (!$template->hasOptions()) {
         cmsCore::error404();
     }
     $form = $template->getOptionsForm();
     $options = $template->getOptions();
     if ($this->request->has('submit')) {
         // Парсим форму и получаем поля записи
         $options = $form->parse($this->request, true, $options);
         // Проверям правильность заполнения
         $errors = $form->validate($this, $options);
         if (!$errors) {
             if ($template->saveOptions($options)) {
                 cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
             } else {
                 cmsUser::addSessionMessage(LANG_CP_SETTINGS_TPL_NOT_WRITABLE, 'error');
             }
             $this->redirectToAction('settings');
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return $this->cms_template->render('settings_theme', array('template_name' => $template_name, 'options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:27,代码来源:settings_theme.php

示例11: run

 public function run($profile_id)
 {
     if (!cmsUser::isLogged()) {
         cmsCore::error404();
     }
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     $user = cmsUser::getInstance();
     $direction = $this->request->get('direction');
     $comment = $this->request->get('comment');
     //
     // Проверяем валидность
     //
     $is_valid = $user->is_logged && cmsUser::isAllowed('users', 'vote_karma') && is_numeric($profile_id) && $user->id != $profile_id && in_array($direction, array('up', 'down')) && (!$this->options['is_karma_comments'] || $comment);
     if (!$is_valid) {
         $result = array('error' => true, 'message' => LANG_ERROR);
         cmsTemplate::getInstance()->renderJSON($result);
     }
     $profile = $this->model->getUser($profile_id);
     if (!$profile || !$this->model->isUserCanVoteKarma($user->id, $profile_id, $this->options['karma_time'])) {
         $result = array('error' => true, 'message' => LANG_ERROR);
         cmsTemplate::getInstance()->renderJSON($result);
     }
     //
     // Сохраняем оценку
     //
     $vote = array('user_id' => $user->id, 'profile_id' => $profile_id, 'points' => $direction == 'up' ? 1 : -1, 'comment' => $comment);
     $vote_id = $this->model->addKarmaVote($vote);
     $value = $profile['karma'] + $vote['points'];
     $result = array('error' => $vote_id ? false : true, 'value' => html_signed_num($value), 'css_class' => html_signed_class($value));
     cmsTemplate::getInstance()->renderJSON($result);
 }
开发者ID:asphix,项目名称:icms2,代码行数:33,代码来源:karma_vote.php

示例12: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     if (!cmsUser::isAllowed('comments', 'edit')) {
         cmsCore::error404();
     }
     $comment_id = $this->request->get('id');
     // Проверяем валидность
     $is_valid = is_numeric($comment_id);
     if (!$is_valid) {
         $result = array('error' => true, 'message' => LANG_ERROR);
         cmsTemplate::getInstance()->renderJSON($result);
     }
     $user = cmsUser::getInstance();
     $comment = $this->model->getComment($comment_id);
     if (!cmsUser::isAllowed('comments', 'edit', 'all')) {
         if (cmsUser::isAllowed('comments', 'edit', 'own') && $comment['user']['id'] != $user->id) {
             $result = array('error' => true, 'message' => LANG_ERROR);
             cmsTemplate::getInstance()->renderJSON($result);
         }
     }
     // Формируем и возвращаем результат
     $result = array('error' => $comment ? false : true, 'id' => $comment_id, 'html' => $comment ? string_strip_br($comment['content']) : false);
     cmsTemplate::getInstance()->renderJSON($result);
 }
开发者ID:asphix,项目名称:icms2,代码行数:27,代码来源:get.php

示例13: run

 public function run($pass_token)
 {
     if (!$pass_token) {
         cmsCore::error404();
     }
     $users_model = cmsCore::getModel('users');
     $profile = $users_model->getUserByPassToken($pass_token);
     if (!$profile) {
         cmsCore::error404();
     }
     $form = $this->getForm('reset');
     $is_submitted = $this->request->has('submit');
     if ($is_submitted) {
         $profile = array_merge($profile, $form->parse($this->request, $is_submitted));
         $errors = $form->validate($this, $profile);
         if (!$errors) {
             $result = $users_model->updateUser($profile['id'], $profile);
             if ($result['success']) {
                 cmsUser::addSessionMessage(LANG_PASS_CHANGED, 'success');
                 $users_model->clearUserPassToken($profile['id']);
                 $this->redirectTo('users', $profile['id']);
             } else {
                 $errors = $result['errors'];
             }
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('reset', array('profile' => $profile, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:31,代码来源:reset.php

示例14: run

 public function run($ctype_name = false)
 {
     $query = $this->request->get('q', false);
     $type = $this->request->get('type', 'words');
     $date = $this->request->get('date', 'all');
     $page = $this->request->get('page', 1);
     if (!in_array($type, array('words', 'exact'), true)) {
         cmsCore::error404();
     }
     if (!in_array($date, array('all', 'w', 'm', 'y'), true)) {
         cmsCore::error404();
     }
     if (!is_numeric($page)) {
         cmsCore::error404();
     }
     if ($this->request->has('q')) {
         if (!$query) {
             $this->redirectToAction('');
         }
         $results = $this->search($query, $type, $date, $ctype_name, $page);
         if ($results && !$ctype_name) {
             $ctype_name = $results[0]['name'];
             $page_url = href_to($this->name);
         } else {
             $page_url = href_to($this->name, 'index', $ctype_name);
         }
     }
     return cmsTemplate::getInstance()->render('index', array('query' => $query, 'type' => $type, 'date' => $date, 'ctype_name' => $ctype_name, 'page' => $page, 'perpage' => $this->options['perpage'], 'results' => isset($results) ? $results : false, 'page_url' => isset($page_url) ? $page_url : false));
 }
开发者ID:pin-git,项目名称:icms2,代码行数:29,代码来源:index.php

示例15: run

 public function run()
 {
     $new_values = $this->request->get('value', array());
     $group_id = $this->request->get('group_id', 0);
     if (!$new_values || !$group_id) {
         cmsCore::error404();
     }
     $controllers = cmsPermissions::getControllersWithRules();
     $owners = array();
     foreach ($controllers as $controller_name) {
         $controller = cmsCore::getController($controller_name);
         $subjects = $controller->getPermissionsSubjects();
         $rules = cmsPermissions::getRulesList($controller_name);
         $values = array();
         foreach ($subjects as $subject) {
             $values[$subject['name']] = cmsPermissions::getPermissions($subject['name']);
         }
         $owners[$controller_name] = array('subjects' => $subjects, 'rules' => $rules, 'values' => $values);
     }
     foreach ($owners as $controller_name => $controller) {
         foreach ($controller['subjects'] as $subject) {
             $formatted_values = array();
             foreach ($controller['rules'] as $rule) {
                 $value = isset($new_values[$rule['id']][$subject['name']]) ? $new_values[$rule['id']][$subject['name']] : null;
                 $formatted_values[$rule['id']][$group_id] = $value;
             }
             cmsPermissions::savePermissions($subject['name'], $formatted_values);
         }
     }
     cmsUser::addSessionMessage(LANG_CP_PERMISSIONS_SUCCESS, 'success');
     $this->redirectBack();
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:32,代码来源:users_group_perms_save.php


注:本文中的cmsCore::error404方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。