Source for file gbook.core.php
Documentation is available at gbook.core.php
* Обработчик гостевой книги
* @author PHPShop Software
$this->objBase= $GLOBALS['SysValue']['base']['table_name7'];
$this->objPath= "/gbook/gbook_";
$this->action= array("post"=> "send_gb","nav"=> "index","nav"=> "ID","get"=> "add_forma");
* Экшен по умолчанию, вывод отзывов
$this->title= "Отзывы - ". $this->PHPShopSystem->getValue("name");
$this->dataArray= parent::getListInfoItem(array('*'),array('enabled'=> "='1'"),array('order'=> 'id DESC'));
if(!isset ($this->dataArray)) return $this->setError404();
foreach($this->dataArray as $row) {
if(!empty($row['mail'])) $d_mail= "<a href=\"mailto:$row[mail]\"><b>$row[name]</b></a>";
else $d_mail= "<b>$row[name]</b>";
$this->set('gbookName',$row['name']);
$this->set('gbookTema',$row['title']);
$this->set('gbookMail',$d_mail);
$this->set('gbookOtsiv',$row['question']);
$this->set('gbookOtvet',$row['answer']);
$this->set('gbookId',$row['id']);
* Экшен выборки подробной информации при наличии переменной навигации ID
$row= parent::getFullInfoItem(array('*'),array('id'=> '='. $this->PHPShopNav->getId()));
if(!empty($row['mail'])) $d_mail= "<a href=\"mailto:$row[mail]\"><b>$row[name]</b></a>";
else $d_mail= "<b>$row[name]</b>";
$this->set('gbookName',$row['name']);
$this->set('gbookTema',$row['title']);
$this->set('gbookMail',$d_mail);
$this->set('gbookOtsiv',$row['question']);
$this->set('gbookOtvet',$row['answer']);
$this->set('gbookId',$row['id']);
$this->title= $row['title']. " - ". $this->PHPShopSystem->getValue("name");
return '<div align="center" style="padding:20"><a href="/gbook/?add_forma=true">
<img src="images/shop/icon_9.gif" alt="" width="50" height="46" border="0"><br><u>Оставить отзыв</u></a></div>';
* Экшен записи отзыва при получении $_POST[send_gb]
if(!empty($_SESSION['text']) and $_POST['key']== $_SESSION['text']) {
header("Location: ../gbook/?write=ok");
$this->set('Error',"Ошибка ключа, повторите попытку ввода ключа");
// Подключаем библиотеку отправки почты
if(isset ($_POST['send_gb'])) {
if(!preg_match("/@/",$_POST['mail_new']))//проверка почты
$ip= $_SERVER['REMOTE_ADDR'];
$this->PHPShopOrm->insert(array('date'=> $date,'name'=> $name_new,'mail'=> $mail_new,'title'=> $title_new,'question'=> $question_new),
$zag= $this->PHPShopSystem->getValue('name'). " - Уведомление о добалении отзыва / ". $date;
С сайта ". $this->PHPShopSystem->getValue('name'). " пришло уведомление о добалении отзыва
Тема сообщения: ". $title_new. "
Сообщение: ". $question_new. "
http://". $_SERVER['SERVER_NAME'];
$PHPShopMail = new PHPShopMail($this->PHPShopSystem->getValue('admin_mail'),$mail_new,$zag,$message);
|