merge from 1.7.3.5(r13153:r13167)

git-svn-id: http://xe-core.googlecode.com/svn/trunk@13168 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2013-09-29 23:32:39 +00:00
parent cc47d2b247
commit 2d3f149b5a
2042 changed files with 129266 additions and 126243 deletions

View file

@ -1,7 +1,9 @@
<?php
/**
* File containing the QueryParser class
*/
/**
* Parses an XML Object and returns a string used for generating the PHP cache file <br />
* The XML Object structure must be the one defined in the XmlParser class
@ -10,7 +12,8 @@
* @package classes\xml\xmlquery
* @version 0.1
*/
class QueryParser {
class QueryParser
{
/**
* Property containing the associated QueryTag object
@ -28,7 +31,7 @@ class QueryParser {
*/
function QueryParser($query = NULL, $isSubQuery = FALSE)
{
if ($query)
if($query)
{
$this->queryTag = new QueryTag($query, $isSubQuery);
}
@ -44,46 +47,60 @@ class QueryParser {
* @param bool $table_name
* @return array
*/
function getTableInfo($query_id, $table_name) {
function getTableInfo($query_id, $table_name)
{
$column_type = array();
$module = '';
$id_args = explode('.', $query_id);
if (count($id_args) == 2) {
if(count($id_args) == 2)
{
$target = 'modules';
$module = $id_args[0];
$id = $id_args[1];
} elseif (count($id_args) == 3) {
}
else if(count($id_args) == 3)
{
$target = $id_args[0];
$targetList = array('modules'=>1, 'addons'=>1, 'widgets'=>1);
if (!isset($targetList[$target]))
$targetList = array('modules' => 1, 'addons' => 1, 'widgets' => 1);
if(!isset($targetList[$target]))
{
return;
}
$module = $id_args[1];
$id = $id_args[2];
}
// get column properties from the table
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
if (!file_exists($table_file)) {
if(!file_exists($table_file))
{
$searched_list = FileHandler::readDir(_XE_PATH_ . 'modules');
$searched_count = count($searched_list);
for ($i = 0; $i < $searched_count; $i++) {
for($i = 0; $i < $searched_count; $i++)
{
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $searched_list[$i], $table_name);
if (file_exists($table_file))
if(file_exists($table_file))
{
break;
}
}
}
if (file_exists($table_file)) {
if(file_exists($table_file))
{
$table_xml = FileHandler::readFile($table_file);
$xml_parser = new XmlParser();
$table_obj = $xml_parser->parse($table_xml);
if ($table_obj->table) {
if (isset($table_obj->table->column) && !is_array($table_obj->table->column)) {
if($table_obj->table)
{
if(isset($table_obj->table->column) && !is_array($table_obj->table->column))
{
$table_obj->table->column = array($table_obj->table->column);
}
foreach ($table_obj->table->column as $k => $v) {
foreach($table_obj->table->column as $k => $v)
{
$column_type[$v->attrs->name] = $v->attrs->type;
}
}
@ -97,12 +114,13 @@ class QueryParser {
*
* @return string
*/
function toString() {
return "<?php if(!defined('__ZBXE__')) exit();\n"
. $this->queryTag->toString()
. 'return $query; ?>';
function toString()
{
return "<?php if(!defined('__XE__')) exit();\n"
. $this->queryTag->toString()
. 'return $query; ?>';
}
}
?>
/* End of file QueryParser.class.php */
/* Location: ./classes/xml/xmlquery/QueryParser.class.php */