Overview

Packages

  • None
  • PHPShopArray
  • PHPShopClass
    • Helper
  • PHPShopCore
  • PHPShopElements
  • PHPShopGUI
  • PHPShopInc
  • PHPShopObj
  • PHPShopParser
  • PHPShopTest

Classes

  • fase4_rdf
  • PHPShopAdminRule
  • PHPShopArray
  • PHPShopBannerElement
  • PHPShopBase
  • PHPShopBaseXml
  • PHPShopCatalogElement
  • PHPShopCategory
  • PHPShopCategoryArray
  • PHPShopCloudElement
  • PHPShopCore
  • PHPShopCoretest
  • PHPShopCssParser
  • PHPShopDate
  • PHPShopDebug
  • PHPShopDoc
  • PHPShopElements
  • PHPShopFile
  • PHPShopForma
  • PHPShopFrontInterface
  • PHPShopGbook
  • PHPShopGbookElement
  • PHPShopGUI
  • PHPShopIndex
  • PHPShopInterface
  • PHPShopLang
  • PHPShopLinks
  • PHPShopMail
  • PHPShopMailFile
  • PHPShopMap
  • PHPShopModules
  • PHPShopNav
  • PHPShopNews
  • PHPShopNewsElement
  • PHPShopObj
  • PHPShopOpros
  • PHPShopOprosElement
  • PHPShopOrm
  • PHPShopPage
  • PHPShopPageCategory
  • PHPShopPageCategoryArray
  • PHPShopPages
  • PHPShopParser
  • PHPShopPhoto
  • PHPShopPhotoCategory
  • PHPShopPhotoCategoryArray
  • PHPShopPhotoElement
  • PHPShopReadCsv
  • PHPShopReadCsvNative
  • PHPShopReadCsvPro
  • PHPShopRestore
  • PHPShopRssParser
  • PHPShopSearch
  • PHPShopSecurity
  • PHPShopSkinElement
  • PHPShopSkinmarket
  • PHPShopSliderElement
  • PHPShopString
  • PHPShopSystem
  • PHPShopText
  • PHPShopTextElement
  • PHPShopUpdate
  • XMLparser

Functions

  • __
  • allowedFunctions
  • array2iconv
  • CheckCanGzip
  • debug
  • evalstr
  • GzDocOut
  • Open
  • output_handler
  • parseDatabase
  • Parser
  • ParseTemplate
  • ParseTemplateReturn
  • PHPShopAutoLoadClass
  • phpshopparserevalstr
  • preExtractCallBack
  • readDatabase
  • stripslashes_deep
  • SysValueReturn
  • timer
  • tmpGetFile
  • utf8_win1251
  • writeLangFile
  • xml2array
  • Overview
  • Package
  • Class
  1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 
<?php
/**

 * @author PHPShop Software
 * @version 1.0
 * @package PHPShopCore
 */
class PHPShopGbook extends PHPShopCore {

    /**

     */
    function __construct() {

        //
        $this->objBase=$GLOBALS['SysValue']['base']['table_name7'];

        //
        $this->objPath="/gbook/gbook_";

        //
        $this->debug=false;
        $this->empty_index_action = true;

        //
        $this->action=array("post"=>"send_gb","nav"=>array("index","ID"),"get"=>"add_forma");
        parent::__construct();
    }

    /**

     */
    function index() {

        //
        $this->title="".$this->PHPShopSystem->getValue("name");

        //
        $this->dataArray=parent::getListInfoItem(array('*'),array('enabled'=>"='1'"),array('order'=>'id DESC'));

        if(is_array($this->dataArray))
            foreach($this->dataArray as $row) {

                //
                if(!empty($row['mail']))  $d_mail=PHPShopText::a('mailto:'.$row[mail],PHPShopText::b($row['name']),$row['name']);
                else  $d_mail=PHPShopText::b($row['name']);

                //
                $this->set('gbookData',PHPShopDate::dataV($row['date'],false));
                $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->addToTemplate($this->getValue('templates.main_gbook_forma'));
            }

        //
        $this->setPaginator();


        //
        $this->parseTemplate($this->getValue('templates.gbook_page_list'));

        //
        $this->add($this->attachLink());
    }

    /**

     * @return string
     */
    function ID() {

        //
        if(!PHPShopSecurity::true_num($this->PHPShopNav->getId())) return $this->setError404();

        //
        $row=parent::getFullInfoItem(array('*'),array('id'=>'='.$this->PHPShopNav->getId()));

        // 404
        if(!isset($row)) return $this->setError404();

        
        //
        if(!empty($row['mail']))  $d_mail=PHPShopText::a('mailto:'.$row[mail],PHPShopText::b($row['name']),$row['name']);
        else  $d_mail=PHPShopText::b($row['name']);

        //
        $this->set('gbookData',PHPShopDate::dataV($row['date']));
        $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->addToTemplate($this->getValue('templates.main_gbook_forma'));

        //
        $this->title=$row['title']." - ".$this->PHPShopSystem->getValue("name");
        $this->description=strip_tags($row['question']);
        $this->lastmodified=$row['date'];


        //
        $this->parseTemplate($this->getValue('templates.gbook_page_list'));
    }

    /**

     * @return string
     */
    function attachLink() {
        return PHPShopText::div(PHPShopText::a('/gbook/?add_forma=true',''),'center','padding:20');
    }

    /**

     */
    function add_forma() {
        $this->parseTemplate($this->getValue('templates.gbook_forma_question'));
    }

    /**

     */
    function send_gb() {
        
        preg_match_all('/http:?/', $_POST['otsiv_new'], $url, PREG_SET_ORDER);
        
        if(!empty($_SESSION['text']) and strtoupper($_POST['key'])==strtoupper($_SESSION['text']) and strpos($_SERVER["HTTP_REFERER"], $_SERVER['SERVER_NAME']) and count($url)==0) {
            $this->write();
            header("Location: ../gbook/?write=ok");
        }else {
            $this->set('Error',"");
            $this->parseTemplate($this->getValue('templates.gbook_forma_question'));
        }
    }

    /**

     */
    function write() {

        //
        PHPShopObj::loadClass("mail");

        if(isset($_POST['send_gb'])) {
            if(!preg_match("/@/",$_POST['mail_new']))//
            {
                $_POST['mail_new']="";
            }
            if(PHPShopSecurity::true_param($_POST['name_new'],$_POST['otsiv_new'],$_POST['tema_new'])) {
                $name_new=PHPShopSecurity::TotalClean($_POST['name_new'],2);
                $question_new=PHPShopSecurity::TotalClean($_POST['otsiv_new'],2);
                $title_new=PHPShopSecurity::TotalClean($_POST['tema_new'],2);
                $mail_new=addslashes($_POST['mail_new']);
                $date = date("U");

                //
                $this->PHPShopOrm->insert(array('date'=>$date,'name'=>$name_new,'mail'=>$mail_new,'title'=>$title_new,'question'=>$question_new),
                        $prefix='');

                $zag=$this->PHPShopSystem->getValue('name')."".$date;
                $message="

---------------

".$this->PHPShopSystem->getValue('name')."


----------------------

".$name_new."
E-mail:             ".$mail_new."
".$title_new."
".$question_new."
IP:                 ".$_SERVER['REMOTE_ADDR']."
REFERER: " . $_SERVER["HTTP_REFERER"];

                           new PHPShopMail($this->PHPShopSystem->getEmail(), $this->PHPShopSystem->getEmail(), $zag, $message, false, false, array('replyto'=>$mail_new));
           


            }
        }
    }

}
?>
API documentation generated by ApiGen