Source for file core.class.php
Documentation is available at core.class.php
* Родительский класс ядра
* Примеры использования размещены в папке phpshop/core/
* @author PHPShop Software
* @var bool режим отладки
* @var string результат работы парсера
* @var array массив обработки POST, GET запросов
* @var string ссылка в навигации от корня
* @var string шаблон вывода
* @var string массив навигации (каталог/фото)
* @var string таблица массива навигации
* @var bool включить парсер php функций в *.html файлах
* @global array $PHPShopSystem
* @global array $PHPShopNav
* @global array $PHPShopModules
$this->PHPShopOrm = &new PHPShopOrm($this->objBase);
$this->PHPShopOrm->debug= $this->debug;
$this->SysValue= &$GLOBALS['SysValue'];
$this->LoadItems= &$GLOBALS['LoadItems'];
$this->PHPShopSystem= &$PHPShopSystem;
$this->num_row= $this->PHPShopSystem->getParam('num_row');
$this->PHPShopNav= &$PHPShopNav;
$this->page= $this->PHPShopNav->getId();
if(strlen($this->page)== 0) $this->page= 1;
$this->set('pageReg',"PHPShop CMS Free");
$this->set('pageDomen',"No");
$this->set('pageProduct',$this->SysValue['license']['product_name']);
* Возврат содержимого файла
* @global array $SysValue настройки
* @param string $path имя файла без расширения
$urlfile= fopen ("$dir$file","r");
$text= fread($urlfile,1000000);
$text= Parser($text,$this->parser);
$patern= "/<H1>(.*)<\/H1>/i";
$patern= "/<desc>(.*)<\/desc>/i";
$description = $matches[1];
$patern= "/<key>(.*)<\/key>/i";
return array('title'=> $title,'description'=> $description,'keywords'=> $keywords);
$PHPShopOrm->debug= $this->debug;
$PHPShopOrm->comment= "Навигация";
$v= $PHPShopOrm->select(array('name','id','parent_to'),array('id'=> '='. $id),false,array('limit'=> 1));
$array[]= array('id'=> $v['id'],'name'=> $v['name'],'parent_to'=> $v['parent_to']);
$array[]= array('id'=> $id,'name'=> $v['name'],'parent_to'=> $v['parent_to']);
* Навигация хлебных крошек
* @param int $id текущий ИД позиции
* @param string $name имя раздела
$spliter= ParseTemplateReturn($this->getValue('templates.breadcrumbs_splitter'));
$home= ParseTemplateReturn($this->getValue('templates.breadcrumbs_home'));
// Убираем последнее значение если каталог
if($this->PHPShopNav->getNav() == "CID" )
foreach($arrayPath as $v) {
$dis.= $spliter. '<A href="/'. $this->PHPShopNav->getPath(). '/CID_'. $v['id']. '.html">'. $v['name']. '</a>';
$dis= $home. $dis. $spliter. '<b>'. $name. '</b>';
$this->set('breadCrumbs',$dis);
// Навигация для javascript в shop.tpl
$this->set('pageNameId',$id);
* Генерация даты изменения документа
if($this->getValue("my.last_modified") == "true") {
@Header("Cache-Control: no-cache, must-revalidate");
@Header("Pragma: no-cache");
$updateDate= gmdate("D, d M Y H:i:s",(date("U")- 21600));
@Header("Last-Modified: ". $updateDate. " GMT");
* Генерация заголовков документа
else $this->set('pageTitl',$this->PHPShopSystem->getValue("title"));
else $this->set('pageDesc',$this->title);
else $this->set('pageKeyw',$this->title);
$core_file= "./pages/". $this->PHPShopNav->getPath(). ".php";
// Поддержка старого API для /pages/*.php
include_once($core_file);
* @param array $select имена колонок БД для выборки
* @param array $where параметры условий запроса
* @param array $order параметры сортировки данных при выдаче
// Обработка номера страницы
$num_ot= $this->num_row* ($this->page- 1);
$option= array('limit'=> $num_ot. ','. $num_do);
$this->set('productFound',$this->getValue('lang.found_of_products'));
$this->set('productNumOnPage',$this->getValue('lang.row_on_page'));
$this->set('productPage',$this->getValue('lang.page_now'));
return $this->PHPShopOrm->select($select,$where,$order,$option);
// Выборка по параметрам WHERE
foreach($this->where as $pole=> $value) {
if($nWhere< count($this->where)) $SQL.= $this->PHPShopOrm->Option['where'];
$result= $this->PHPShopOrm->query("select COUNT('id') as count from ". $this->objBase. $SQL);
$this->num_page= $row['count'];
$num= $this->num_page/ $this->num_row;
if($i!= $this->page) $navigat.= "<a href=\"". $this->objPath. $i. ".html\">$i</a> / ";
else $navigat.= "<b> $i</b> / ";
$this->set('productPageNav',$this->getValue('lang.page_now'). ":
<a href=\"". $this->objPath. ($p_do). ".html\">«« </a> /
$navigat <a href=\"". $this->objPath. $p_to. ".html\"> »»</a>");
* Выдача подробного описания
* @param array $select имена колонок БД для выборки
* @param array $where параметры условий запроса
* @param array $order параметры сортировки данных при выдаче
return $this->PHPShopOrm->select($select,$where,$order,array('limit'=> '1'));
* Добавление данных в вывод парсера
* @param string $template шаблон для парсинга
$template_file= $this->getValue('dir.templates'). chr(47). $_SESSION['skin']. chr(47). $template;
}else $this->setError("addToTemplate",$template_file);
* @param string $content содержание
* @param bool $list [1] - добавление в список данных, [0] - добавление в общую переменную вывода
function add($content,$list= false) {
else $this->Disp.= $content;
* Парсинг шаблона и добавление в общую переменную вывода
* @param string $template имя шаблона
$this->Disp= ParseTemplateReturn($template);
* @param string $name имя функции
* @param string $action сообщение
echo '<p style="BORDER: #000000 1px dashed;padding-top:10px;padding-bottom:10px;background-color:#FFFFFF;color:000000;font-size:12px">
<img hspace="10" style="padding-left:10px" align="left" src="../phpshop/admpanel/img/i_domainmanager_med[1].gif"
width="32" height="32" alt="PHPShopCore Debug On"/ ><strong>Ошибка обработчика события:</strong> '. $name. '()
<br><em>'. $action. '</em></p>';
$this->set('DispShop',$this->Disp);
* Создание системной переменной для парсинга
* @param string $name имя
* @param mixed $value значение
* @param bool $flag [1] - добавить, [0] - переписать
function set($name,$value,$flag= false) {
if($flag) $this->SysValue['other'][$name].= $value;
else $this->SysValue['other'][$name]= $value;
* Выдача системной переменной
* @param string $param раздел.имя переменной
return $this->SysValue[$param[0]][$param[1]];
* Назначение экшена обработки перемнных POST и GET
foreach($this->action as $k=> $v) {
if(!empty($_POST[$v]) and $this->isAction($v))
if(!empty($_GET[$v]) and $this->isAction($v))
if($this->PHPShopNav->getNav() == $v and $this->isAction($v))
else $this->setError("index","метод не существует");
}else $this->setError("action","экшены объявлена неверно");
* @param string $method_name имя метода
$this->title= "Ошибка 404 - ". $this->PHPShopSystem->getValue("name");
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
|