phpDocumentor PHPShopCore
[ class tree: PHPShopCore ] [ all elements ]

Source for file forma.core.php

Documentation is available at forma.core.php

  1. <?php
  2.  
  3. /**
  4.  * Обработчик формы сообщения с сайта
  5.  * @author PHPShop Software
  6.  * @version 1.1
  7.  * @package PHPShopCore
  8.  */
  9. class PHPShopForma extends PHPShopCore {
  10.  
  11.     /**
  12.      * Конструктор
  13.      */
  14.     function PHPShopForma({
  15.         $this->debug=false;
  16.         
  17.         // список экшенов
  18.         $this->action=array("post"=>"message","nav"=>"index");
  19.         parent::PHPShopCore();
  20.     }
  21.  
  22.  
  23.     /**
  24.      * Экшен по умолчанию, вывод формы связи
  25.      */
  26.     function index({
  27.  
  28.         // Мета
  29.         $this->title="Форма связи - ".$this->PHPShopSystem->getValue("name");
  30.  
  31.         // Определяем переменные
  32.         $this->set('pageTitle','Форма связи');
  33.  
  34.         // Подключаем шаблон
  35.         $this->addToTemplate("page/page_forma_list.tpl");
  36.         $this->parseTemplate($this->getValue('templates.page_page_list'));
  37.  
  38.     }
  39.  
  40.     /**
  41.      * Экшен отправка формы при получении $_POST[message]
  42.      */
  43.     function message({
  44.         if(!empty($_SESSION['text']and $_POST['key']==$_SESSION['text']{
  45.             $this->send();
  46.         }else $this->set('Error',"Ошибка ключа, повторите попытку ввода ключа");
  47.     }
  48.  
  49.  
  50.     /**
  51.      * Генерация сообщения
  52.      */
  53.     function send({
  54.  
  55.         // Подключаем библиотеку отправки почты
  56.         PHPShopObj::loadClass("mail");
  57.  
  58.         // Проверяем заполненность полей
  59.         if(PHPShopSecurity::true_param($_POST['nameP'],$_POST['subject'],$_POST['message'],$_POST['mail'])){
  60.  
  61.             $zag=$this->$_POST['subject']." - ".$this->PHPShopSystem->getValue('name');
  62.             $message="Вам пришло сообщение с сайта ".$this->PHPShopSystem->getValue('name')."
  63.  
  64. Данные о пользователе:
  65. ----------------------
  66. ";
  67.  
  68.             // Информация по сообщению
  69.             foreach($_POST as $key=>$val)
  70. $message.=$val."
  71. ";
  72.  
  73.             $message.="
  74. Дата:               ".date("d-m-y H:s a")."
  75. IP:
  76. ".$_SERVER['REMOTE_ADDR']."
  77. ---------------
  78.  
  79. С уважением,
  80. http://".$_SERVER['SERVER_NAME'];
  81.  
  82.             $PHPShopMail new PHPShopMail($this->PHPShopSystem->getValue('admin_mail'),$_POST['mail'],$zag,$message);
  83.             $this->set('Error',"Сообщение успешно отправлено");
  84.         }
  85.         else $this->set('Error',"Ошибка заполнения обязательных полей");
  86.     }
  87.  
  88. }
  89. ?>

Documentation generated on Mon, 25 Jun 2012 15:09:45 +0400 by phpDocumentor 1.4.3