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


PHP cmsUser::addSessionMessage方法代码示例

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


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

示例1: run

 public function run()
 {
     $form = $this->getForm('ctypes_basic', array('add'));
     $form = cmsEventsManager::hook('ctype_basic_form', $form);
     $is_submitted = $this->request->has('submit');
     $ctype = $form->parse($this->request, $is_submitted);
     if ($is_submitted) {
         $errors = $form->validate($this, $ctype);
         if (!$errors) {
             if (cmsCore::isControllerExists($ctype['name'])) {
                 $errors['name'] = LANG_CP_CTYPE_ERROR_NAME;
             }
         }
         if (!$errors) {
             $content_model = cmsCore::getModel('content');
             $ctype = cmsEventsManager::hook('ctype_before_add', $ctype);
             $ctype = cmsEventsManager::hook("ctype_{$ctype['name']}_before_add", $ctype);
             $ctype_id = $content_model->addContentType($ctype);
             $ctype['id'] = $ctype_id;
             cmsEventsManager::hook('ctype_after_add', $ctype);
             cmsEventsManager::hook("ctype_{$ctype['name']}_after_add", $ctype);
             if ($ctype_id) {
                 cmsCore::getController('content')->addWidgetsPages($ctype);
                 cmsUser::addSessionMessage(sprintf(LANG_CP_CTYPE_CREATED, $ctype['title']), 'success');
             }
             $this->redirectToAction('ctypes', array('labels', $ctype_id), array('wizard_mode' => true));
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return $this->cms_template->render('ctypes_basic', array('do' => 'add', 'ctype' => $ctype, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:33,代码来源:ctypes_add.php

示例2: 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

示例3: run

 public function run($tag_id)
 {
     if (!$tag_id) {
         cmsCore::error404();
     }
     $tags_model = cmsCore::getModel('tags');
     $form = $this->getForm('tag');
     $is_submitted = $this->request->has('submit');
     $tag = $tags_model->getTag($tag_id);
     $original_tag = $tag['tag'];
     if ($is_submitted) {
         $tag = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $tag);
         if ($original_tag == $tag['tag']) {
             $this->redirectToAction();
         }
         if (!$errors) {
             $duplicate_id = $tags_model->getTagId($tag['tag']);
             if (!$duplicate_id) {
                 $tags_model->updateTag($tag_id, $tag);
             }
             if ($duplicate_id) {
                 $tags_model->mergeTags($tag_id, $duplicate_id);
                 cmsUser::addSessionMessage(sprintf(LANG_TAGS_MERGED, $original_tag, $tag['tag']), 'success');
             }
             $this->redirectToAction();
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('backend/tag', array('do' => 'edit', 'tag' => $tag, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:33,代码来源:edit.php

示例4: run

 public function run($id = false)
 {
     if (!$id) {
         cmsCore::error404();
     }
     $widgets_model = cmsCore::getModel('widgets');
     cmsCore::loadAllControllersLanguages();
     $page = $widgets_model->getPage($id);
     if (!$page) {
         cmsCore::error404();
     }
     $form = $this->getForm('widgets_page');
     if (!$page['is_custom']) {
         $form->removeField('title', 'title');
     }
     $is_submitted = $this->request->has('submit');
     if ($is_submitted) {
         $page = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $page);
         if (!$errors) {
             $widgets_model->updatePage($id, $page);
             $this->redirectToAction('widgets');
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('widgets_page', array('do' => 'edit', 'page' => $page, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:29,代码来源:widgets_page_edit.php

示例5: run

 public function run($profile)
 {
     // проверяем наличие доступа
     if ($profile['id'] != $this->cms_user->id && !$this->cms_user->is_admin) {
         cmsCore::error404();
     }
     $form = $this->getForm('password');
     $is_submitted = $this->request->has('submit');
     $data = array();
     if ($is_submitted) {
         cmsCore::loadControllerLanguage('auth');
         $data = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $data);
         if (!$errors) {
             $password_hash = md5(md5($data['password']) . $this->cms_user->password_salt);
             if ($password_hash != $this->cms_user->password) {
                 $errors = array('password' => LANG_OLD_PASS_INCORRECT);
             }
         }
         if (!$errors) {
             $profile = array_merge($profile, $data);
             $result = $this->model->updateUser($profile['id'], $profile);
             if ($result['success']) {
                 cmsUser::addSessionMessage(LANG_PASS_CHANGED, 'success');
                 $this->redirectTo('users', $profile['id']);
             } else {
                 $errors = $result['errors'];
             }
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return $this->cms_template->render('profile_edit_password', array('id' => $profile['id'], 'profile' => $profile, 'data' => $data, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:35,代码来源:profile_edit_password.php

示例6: 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

示例7: run

 public function run()
 {
     $user = cmsUser::getInstance();
     $id = $this->request->get('id', 0);
     if (!$id) {
         cmsCore::error404();
     }
     $folder = $this->model->getContentFolder($id);
     if (!$folder) {
         cmsCore::error404();
     }
     if ($folder['user_id'] != $user->id && !$user->is_admin) {
         cmsCore::error404();
     }
     $ctype = $this->model->getContentType($folder['ctype_id']);
     $form = $this->getForm('folder');
     // Форма отправлена?
     $is_submitted = $this->request->has('submit');
     if ($is_submitted) {
         // Парсим форму и получаем поля записи
         $updated_folder = $form->parse($this->request, $is_submitted);
         // Проверям правильность заполнения
         $errors = $form->validate($this, $updated_folder);
         if (!$errors) {
             // Обновляем папку и редиректим на ее просмотр
             $this->model->updateContentFolder($id, $updated_folder);
             $this->redirect(href_to('users', $folder['user_id'], array('content', $ctype['name'], $folder['id'])));
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('folder_form', array('ctype' => $ctype, 'folder' => $folder, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:34,代码来源:folder_edit.php

示例8: run

 public function run($feed_id)
 {
     $feed = $this->model->getFeed($feed_id);
     if (!$feed) {
         cmsCore::error404();
     }
     $form = $this->getForm('feed');
     // выясняем контроллер ленты
     $controller = $feed['ctype_name'];
     if ($this->model->isCtypeFeed($feed['ctype_name'])) {
         $controller = 'content';
     }
     list($form, $feed) = cmsEventsManager::hook('rss_' . $controller . '_controller_form', array($form, $feed));
     list($form, $feed) = cmsEventsManager::hook('rss_edit_form', array($form, $feed));
     list($form, $feed) = cmsEventsManager::hook('rss_' . $feed['ctype_name'] . '_edit_form', array($form, $feed));
     if ($this->request->has('submit')) {
         $feed = array_merge($feed, $form->parse($this->request, true));
         $errors = $form->validate($this, $feed);
         if (!$errors) {
             $this->model->updateFeed($feed_id, $feed);
             cmsEventsManager::hook('rss_' . $controller . '_controller_after_update', $feed);
             $this->redirectToAction();
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('backend/edit', array('feed' => $feed, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:pin-git,项目名称:icms2,代码行数:29,代码来源:edit.php

示例9: run

 public function run()
 {
     $config = cmsConfig::getInstance();
     $path = $config->upload_path . $this->installer_upload_path;
     $path_relative = $config->upload_root . $this->installer_upload_path;
     $installer_path = $path . '/' . 'install.php';
     $sql_dump_path = $path . '/' . 'install.sql';
     $is_imported = $this->importPackageDump($sql_dump_path);
     $is_installed = $this->runPackageInstaller($installer_path);
     // считаем, что пришла ошибка
     if (is_string($is_installed)) {
         cmsUser::addSessionMessage($is_installed, 'error');
         $this->redirectToAction('install');
     }
     $redirect_action = '';
     if ($is_imported && $is_installed === true) {
         $redirect_action = $this->doPackage();
         // если в файле install.php есть функция after_install_package, вызываем ее
         // этот файл, если он есть, уже должен был загружен ранее
         if (function_exists('after_install_package')) {
             call_user_func('after_install_package');
         }
     }
     $is_cleared = files_clear_directory($path);
     return cmsTemplate::getInstance()->render('install_finish', array('is_cleared' => $is_cleared, 'redirect_action' => $redirect_action, 'path_relative' => $path_relative));
 }
开发者ID:pin-git,项目名称:icms2,代码行数:26,代码来源:install_finish.php

示例10: run

 public function run($controller_name)
 {
     if (!$controller_name) {
         cmsCore::error404();
     }
     $controller_info = $this->model->getControllerInfo($controller_name);
     if (!$controller_info || !$controller_info['is_external']) {
         cmsCore::error404();
     }
     if ($controller_info['is_backend']) {
         $backend_context = $this->request->isAjax() ? cmsRequest::CTX_AJAX : cmsRequest::CTX_INTERNAL;
         $backend_request = new cmsRequest($this->request->getData(), $backend_context);
         $backend_controller = $this->loadControllerBackend($controller_info['name'], $backend_request);
         // смотрим специальный экшен
         if ($backend_controller->isActionExists('delete_component')) {
             $backend_controller->redirectToAction('delete_component');
         }
     }
     // нет бэкэенда или экшена, удаляем через метод модели контроллера
     // если в модели контроллера нет метода deleteController
     // будет использоваться из основной модели
     // который просто удалит запись в cms_controllers
     if (cmsCore::isModelExists($controller_info['name'])) {
         cmsCore::getModel($controller_info['name'])->deleteController($controller_info['id']);
     } else {
         $model = new cmsModel();
         $model->deleteController($controller_info['id']);
     }
     cmsUser::addSessionMessage(sprintf(LANG_CP_COMPONENT_IS_DELETED, $controller_info['title']), 'success');
     $this->redirectToAction('controllers');
 }
开发者ID:pin-git,项目名称:icms2,代码行数:31,代码来源:controllers_delete.php

示例11: run

 public function run($do = false)
 {
     $updater = new cmsUpdater();
     $update = $updater->checkUpdate();
     if ($update == cmsUpdater::UPDATE_NOT_AVAILABLE) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_NOT_AVAILABLE);
         $this->redirectToAction('update');
     }
     if ($update == cmsUpdater::UPDATE_CHECK_ERROR || empty($update['version'])) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_CHECK_FAIL, 'error');
         $this->redirectToAction('update');
     }
     if (!function_exists('curl_init')) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_DOWNLOAD_FAIL, 'error');
         $this->redirectToAction('update');
     }
     $url = $update['url'];
     $package_name = basename($url);
     $destination = cmsConfig::get('upload_path') . 'installer/' . $package_name;
     $result = file_save_from_url($url, $destination);
     if ($result === false) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_DOWNLOAD_FAIL, 'error');
         $this->redirectToAction('update');
     }
     $this->redirectToAction('install', false, array('package_name' => $package_name));
 }
开发者ID:asphix,项目名称:icms2,代码行数:26,代码来源:update_install.php

示例12: run

 public function run()
 {
     if (cmsUser::isLogged()) {
         $this->redirectToHome();
     }
     $users_model = cmsCore::getModel('users');
     $form = $this->getForm('restore');
     $data = array();
     $is_submitted = $this->request->has('submit');
     if ($is_submitted) {
         $data = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $data);
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
         if (!$errors) {
             $user = $users_model->getUserByEmail($data['email']);
             if (!$user) {
                 cmsUser::addSessionMessage(LANG_EMAIL_NOT_FOUND, 'error');
             } else {
                 $pass_token = string_random(32, $user['email']);
                 $users_model->updateUserPassToken($user['id'], $pass_token);
                 $messenger = cmsCore::getController('messages');
                 $to = array('email' => $user['email'], 'name' => $user['nickname']);
                 $letter = array('name' => 'reg_restore');
                 $messenger->sendEmail($to, $letter, array('nickname' => $user['nickname'], 'page_url' => href_to_abs('auth', 'reset', $pass_token), 'valid_until' => html_date(date('d.m.Y H:i', time() + 24 * 3600), true)));
                 cmsUser::addSessionMessage(LANG_TOKEN_SENDED, 'success');
             }
         }
     }
     return cmsTemplate::getInstance()->render('restore', array('data' => $data, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:32,代码来源:restore.php

示例13: run

 public function run($group)
 {
     if ($this->model->getMembership($group['id'], $this->cms_user->id)) {
         $this->redirectToAction($group['id']);
     }
     $invite = $this->model->getInvite($group['id'], $this->cms_user->id);
     if ($group['join_policy'] != groups::JOIN_POLICY_FREE && !$invite) {
         cmsCore::error404();
     }
     $result = cmsEventsManager::hook('group_before_join', array('allow' => true, 'group' => $group, 'invite' => $invite));
     if (!$result['allow']) {
         if (isset($result['access_text'])) {
             cmsUser::addSessionMessage($result['access_text'], 'error');
             if (isset($result['redirect_url'])) {
                 $this->redirect($result['redirect_url']);
             } else {
                 $this->redirectToAction($group['id']);
             }
         }
         cmsCore::error404();
     }
     $group = $result['group'];
     $invite = $result['invite'];
     $this->model->addMembership($group['id'], $this->cms_user->id);
     if ($invite) {
         $this->model->deleteInvite($invite['id']);
     }
     cmsCore::getController('activity')->addEntry($this->name, 'join', array('subject_title' => $group['title'], 'subject_id' => $group['id'], 'subject_url' => href_to_rel($this->name, $group['id']), 'group_id' => $group['id']));
     cmsUser::addSessionMessage(LANG_GROUPS_JOIN_MESSAGE, 'success');
     $this->redirectToAction($group['id']);
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:31,代码来源:group_join.php

示例14: run

 public function run()
 {
     $form = $this->getForm('preset', array('add'));
     $preset = array();
     if ($this->request->has('submit')) {
         $preset = $form->parse($this->request, true);
         $errors = $form->validate($this, $preset);
         if (!$errors) {
             if (!$preset['width'] && !$preset['height'] || $preset['is_square'] && (!$preset['width'] || !$preset['height'])) {
                 if (!$preset['width']) {
                     $errors['width'] = ERR_VALIDATE_REQUIRED;
                 }
                 if (!$preset['height']) {
                     $errors['height'] = ERR_VALIDATE_REQUIRED;
                 }
             }
         }
         if (!$errors) {
             $id = $this->model->addPreset($preset);
             // создаем дефолтные миниатюры
             $this->createDefaultImages($preset);
             $this->redirectToAction('presets');
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return $this->cms_template->render('backend/preset', array('do' => 'add', 'preset' => $preset, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:29,代码来源:presets_add.php

示例15: run

 public function run($feed_id)
 {
     if (!$feed_id) {
         cmsCore::error404();
     }
     $rss_model = cmsCore::getModel('rss');
     $feed = $rss_model->getFeed($feed_id);
     $ctype_id = $feed['ctype_id'];
     $content_model = cmsCore::getModel('content');
     $fields = $content_model->getContentFields($feed['ctype_name']);
     $fields = array('' => '') + array_collection_to_list($fields, 'name', 'title');
     $form = $this->getForm('feed', array($fields));
     $is_submitted = $this->request->has('submit');
     if ($is_submitted) {
         $feed = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $feed);
         if (!$errors) {
             $rss_model->updateFeed($feed_id, $feed);
             $ctype = $content_model->getContentType($ctype_id);
             $ctype['options']['is_rss'] = $feed['is_enabled'];
             $content_model->updateContentType($ctype_id, array('options' => $ctype['options']));
             $this->redirectToAction();
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('backend/edit', array('feed' => $feed, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:29,代码来源:edit.php


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