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


PHP system::saveErrorToSession方法代码示例

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


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

示例1: subscribeAction

 public function subscribeAction()
 {
     $email = system::POST('email', isEmail);
     if (empty($email)) {
         $answer = array('error' => 1, 'msg' => lang::get('SUBSCRIPTION_EMPTY_EMAIL'));
     } else {
         if (empty($_POST['subscribes'])) {
             $answer = array('error' => 2, 'msg' => lang::get('SUBSCRIPTION_EMPTY_LIST'));
         } else {
             $sid = mailingProcess::addEmail($email, $_POST['subscribes'], true);
             if ($sid) {
                 $answer = array('error' => 0, 'msg' => lang::get('SUBSCRIPTION_MSG'));
             } else {
                 $answer = array('error' => 3, 'msg' => lang::get('SUBSCRIPTION_ERROR'));
             }
         }
     }
     if (!system::isAjax()) {
         if (!empty($answer['error'])) {
             system::saveErrorToSession('subscription', $answer);
             if (!empty($_POST['back_url'])) {
                 system::redirect($_POST['back_url'], true);
             }
         } else {
             system::redirect('/subscription/ok');
         }
     } else {
         system::json($answer);
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:30,代码来源:controller.php

示例2: send_messageAction


//.........这里部分代码省略.........
             $obj->in_search = 1;
             $obj->in_index = 1;
             $obj->is_home_page = 0;
             if ($obj->name != '') {
                 $obj->h1 = $obj->name;
                 $obj->title = $obj->name;
             }
             $obj->pseudo_url = rand(1000, 9999);
             $obj->template_id = ($sect = ormPages::get($form_obj->section)) ? $sect->template_id : 1;
             $obj->form_id = $form_obj->id;
             $obj->setRightForAll(2);
             $obj_id = $obj->save();
             if ($obj_id) {
                 $obj->pseudo_url = $obj_id;
                 $obj->save();
                 $obj = new ormPage($obj_id);
             } else {
                 $issetErrors = true;
                 $f = $obj->getErrorFields();
                 $answer = array('field' => $f['focus'], 'msg' => $obj->getErrorListText(' '));
             }
         }
         if (!$issetErrors) {
             // Отправка нужных писем
             page::assign('site_name', domains::curDomain()->getSiteName());
             page::assign('site_url', domains::curDomain()->getName());
             page::assign('base_email', domains::curDomain()->getEmail());
             while (list($key, $val) = each($_POST)) {
                 page::assign($key, system::checkVar($val, isText));
             }
             if (isset($obj)) {
                 $fields = $obj->getClass()->loadFields();
                 foreach ($fields as $field) {
                     if (in_array($field['f_type'], array(70, 75, 80, 85))) {
                         $fsname = $field['f_sname'];
                         $fvalue = $obj->{$fsname};
                         if ($fvalue != '') {
                             page::assign($fsname, $fvalue);
                         }
                     }
                 }
             }
             // Если указан список адресатов, отправляем письма
             if ($form_obj->mailing_list != '') {
                 $mail = new phpmailer();
                 $mail->From = $this->parse($form_obj->admin_sender_address);
                 $mail->FromName = $this->parse($form_obj->admin_sender_name);
                 /*
                                   if (!empty($this->files))
                 for($i = 0; $i < count($this->files); $i++)
                    $mail->AddAttachment($this->files[$i][0], $this->files[$i][1]);
                 */
                 $mail->AddAddress($form_obj->mailing_list);
                 $mail->WordWrap = 50;
                 $mail->IsHTML(true);
                 $mail->Subject = $this->parse($form_obj->admin_subject);
                 $mail->Body = $this->parse($form_obj->admin_template);
                 $mail->Send();
             }
             // Если нужно, отправляем уведомление пользователю
             if ($form_obj->send_notice && !$issetErrors) {
                 $mail = new phpmailer();
                 $mail->From = $this->parse($form_obj->notice_sender_address);
                 $mail->FromName = $this->parse($form_obj->notice_sender_name);
                 $mail->AddAddress(system::POST('email'));
                 $mail->WordWrap = 50;
                 $mail->IsHTML(true);
                 $mail->Subject = $this->parse($form_obj->notice_subject);
                 $mail->Body = $this->parse($form_obj->notice_template);
                 $mail->Send();
             }
             // Показываем результат
             if (system::isAjax()) {
                 if ($form_obj->msg != '') {
                     $text = $form_obj->msg;
                 } else {
                     $text = lang::get('FEEDBACK_MSG_1');
                 }
                 system::json(array('field' => 0, 'msg' => strip_tags($text)));
             } else {
                 system::redirect('/feedback/ok/' . $form_obj->id);
             }
         } else {
             // Произошли ошибки
             if (system::isAjax()) {
                 system::json($answer);
             } else {
                 system::savePostToSession();
                 system::saveErrorToSession('feedback', $answer);
                 if (empty($_POST['back_url'])) {
                     $_POST['back_url'] = '/structure/map';
                 }
                 system::redirect($_POST['back_url'], true);
             }
         }
         system::stop();
     } else {
         system::stop();
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:101,代码来源:controller.php

示例3: change_password_procAction

 public function change_password_procAction()
 {
     if (user::isGuest()) {
         system::redirect('/users/add');
     }
     $cur_password = system::POST('current_password', isPassword);
     $new_passw = system::POST('password', isPassword);
     $new_passw2 = system::POST('password2', isPassword);
     if ($cur_password == user::get('password')) {
         if ($new_passw && $new_passw == $new_passw2) {
             if ($user = user::getObject()) {
                 $user->password = system::POST('password');
                 if ($user->save()) {
                     if (system::isAjax()) {
                         system::json(array('ok' => 1));
                     } else {
                         system::redirect('/users/change_password/ok');
                     }
                 }
             }
         }
     } else {
         $answer = array('msg' => lang::get('USERS_CHANGE_PSW_MSG'), 'field' => 'current_password');
         if (!system::isAjax()) {
             system::saveErrorToSession('change_password', $answer);
             system::redirect('/users/change_password');
         } else {
             system::json($answer);
         }
     }
     system::redirect('/users/change_password');
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:32,代码来源:controller.php


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