Вроде все правильно сделал но вот ошибка
Файл engine/lineage/include/query.php
<?php
/********************************************************************/
/* */
/* Lineage2 DLE Module, Copyright © 2007-2009, hellEVIL TEAM */
/* http://www.hellevil.net */
/* */
/********************************************************************/
if(!defined('DATALIFEENGINE')) {
die("Hacking attempt!");
}
$query_List = array();
/*
* Класс обработки запросов
*/
class l2jQuery {
private $mainQuery = "main"; // константа, основная сборка
private $queryList = array(); // база запросов
private $query = ""; // запрос
private $paramList = array(); // список запросов
/*
* Конструктор
* Подключает файлы запросов
*/
function l2jQuery() {
if ($handle = opendir(ENGINE_DIR.'/lineage/include/l2jquery')) {
while (false !== ($file = readdir($handle))) {
if (ereg("[a-z0-9\_\-]*[\.][x].[p][h][p]", $file))
include_once ENGINE_DIR."/lineage/include/l2jquery/{$file}";
}
if (! (isset($query_List) && count($query_List) > 0))
die ("Can not load query lists");
$this->queryList = $query_List;
} else {
$this->queryList = array();
}
//include_once ENGINE_DIR.'/lineage/include/l2jquery/main.php';
}
/*
* Получение списка версий
*/
function getVersions() {
$result = array();
foreach ( $this->queryList AS $key => $value ) {
$result[$key] = $value["name"];
}
return $result;
}
/*
* Добавление параметра
*/
function setParam($key, $value) {
$this->paramList[$key] = $value;
}
/*
* Получение запроса
*/
function getQuery($version="", $function="", $params="") {
$this->query = "";
if (empty($this->queryList[$version]["query"][$function])) {
$this->query = $this->queryList[$this->mainQuery]["query"][$function];
} else {
$this->query = $this->queryList[$version]["query"][$function];
}
if (is_array($params) && count($params) > 0) {
$this->paramList = array_merge($this->paramList, $params);
}
if (is_array($this->query)) {
foreach ($this->query AS $key => $value) {
$this->query[$key] = $this->queryParser($version, $value);
}
} else {
$this->query = $this->queryParser($version, $this->query);
}
$this->paramList = array();
return $this->query;
}
/*
* Парсер запросов
*/
private function queryParser($version="", $query="") {
//$query = QueryIFSET($query, $params);
// Перевод строки = пробел
$query = str_replace("\n", " ", $query);
// Замена параметров
foreach ($this->paramList AS $key => $value) {
$query = str_replace('{'.$key.'}', $value, $query);
}
// Обработка полей
preg_match_all("/\{field=(.*?)\}/i", $query, $matches);
for($i = 0; $i < count($matches[0]); $i++) {
$pattern = $matches[0][$i];
$table = $matches[1][$i];
$fieldArray = array();
if (isset($this->queryList[$version]["fields"][$table])) {
$fieldArray = $this->queryList[$version]["fields"][$table];
} else {
$fieldArray = $this->queryList[$this->mainQuery]["fields"][$table];
}
foreach ($fieldArray AS $key => $value) {
$fieldArray[$key] = "`{$table}`.{$value} AS `{$key}`";
}
$query = str_replace($pattern, implode(", ", $fieldArray), $query);
}
// Удаление всех не обработанных тегов
preg_match_all("/\{(.*?)\}/i", $query, $matches);
for($i = 0; $i < count($matches[0]); $i++) {
$pattern = $matches[0][$i];
$query = str_replace($pattern, "", $query);
//echo $pattern." ";
}
// Возвращение результата
return $query;
}
/*
* Тип предмета
*/
function getItemType($version, $id) {
if (isset($this->queryList[$version]["itemType"])) {
if (isset($this->queryList[$version]["itemType"][$id])) {
return $this->queryList[$version]["itemType"][$id];
}
} elseif (isset($this->queryList[$this->mainQuery]["itemType"])) {
if (isset($this->queryList[$this->mainQuery]["itemType"][$id])) {
return $this->queryList[$this->mainQuery]["itemType"][$id];
}
}
return "hidden";
}
}
?>