]> git.mxchange.org Git - mailer.git/blobdiff - inc/xml-functions.php
Also use git here.
[mailer.git] / inc / xml-functions.php
index 9506a93e815489250b42c03d77a53444f54caa2d..87f2d4e1b62f1174b350ff18bb8a643dc2962075 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -61,7 +61,7 @@ function doGenericXmlTemplateCallback ($template, $content = array(), $compileCo
        initXml();
 
        // Generate FQFN for with special path
-       $FQFN = sprintf("%stemplates/xml/%s%s.xml",
+       $FQFN = sprintf('%stemplates/xml/%s%s.xml',
                getPath(),
                detectExtraTemplatePath('xml', $template),
                $template
@@ -70,7 +70,7 @@ function doGenericXmlTemplateCallback ($template, $content = array(), $compileCo
        // Is the file readable?
        if (!isFileReadable($FQFN)) {
                // No, use without extra path
-               $FQFN = sprintf("%stemplates/xml/%s.xml",
+               $FQFN = sprintf('%stemplates/xml/%s.xml',
                        getPath(),
                        $template
                );
@@ -109,7 +109,7 @@ function doGenericXmlTemplateCallback ($template, $content = array(), $compileCo
                addXmlSpecialElements($template);
 
                // Call the call-back function
-               doCallXmlCallbackFunction($content);
+               doCallXmlCallbackFunction();
        } else {
                // Template not found
                displayMessage('{%message,XML_TEMPLATE_404=' . $template . '%}');
@@ -134,7 +134,7 @@ function addXmlSpecialElements ($template) {
 // Parses the XML content
 function parseXmlData ($content) {
        // Is there recode?
-       if (!function_exists('recode')) {
+       if (!extension_loaded('recode')) {
                // No fallback ATM
                reportBug(__FUNCTION__, __LINE__, 'PHP extension recode is missing. Please install it.');
        } // END - if
@@ -339,7 +339,7 @@ function getSqlPartFromXmlArray ($columns) {
 // "Getter" for JOIN statement
 function getSqlXmlJoinedTable ($tableJoinType, $tableJoinName, $joinOnLeftTable, $joinOnCondition, $joinOnRightTable) {
        // Are all set?
-       assert((count($tableJoinType) > 0) && (count($tableJoinName) > 0) && (count($joinOnLeftTable) > 0) && (count($joinOnCondition) > 0) && (count($joinOnRightTable) > 0));
+       assert((isFilledArray($tableJoinType)) && (isFilledArray($tableJoinName)) && (isFilledArray($joinOnLeftTable)) && (isFilledArray($joinOnCondition)) && (isFilledArray($joinOnRightTable)));
 
        // Init SQL
        $sql = '';
@@ -374,7 +374,7 @@ function getSqlXmlWhereConditions ($whereColumns, $conditions) {
        $sql = '';
 
        // Are there some conditions?
-       if (count($whereColumns) > 0) {
+       if (isFilledArray($whereColumns)) {
                // Then add these as well
                if (count($whereColumns) == 1) {
                        // One entry found
@@ -388,7 +388,7 @@ function getSqlXmlWhereConditions ($whereColumns, $conditions) {
 
                        // Add the rest
                        $sql .= '`' . $whereColumns[0]['column'] . '`' . $whereColumns[0]['condition'] . chr(39) . $whereColumns[0]['look_for'] . chr(39);
-               } elseif ((count($whereColumns > 1)) && (count($conditions) > 0)) {
+               } elseif ((count($whereColumns > 1)) && (isFilledArray($conditions))) {
                        // More than one "WHERE" + condition found
                        foreach ($whereColumns as $idx => $columnArray) {
                                // Default is WHERE
@@ -397,11 +397,10 @@ function getSqlXmlWhereConditions ($whereColumns, $conditions) {
                                // Is the condition element there?
                                if (isset($conditions[$columnArray['column']])) {
                                        // Assume the condition
-                                       $condition .= ' ' . $conditions[$columnArray['column']] . ' ';
+                                       $condition = ' ' . $conditions[$columnArray['column']] . ' ';
                                } // END - if
 
                                // Add to SQL query
-                               die($sql.'/'.$condition);
                                $sql .= $condition;
 
                                // Table/alias included?
@@ -429,7 +428,7 @@ function getSqlXmlOrderBy ($orderByColumns) {
        $sql = '';
 
        // Are there entries from orderByColumns to add?
-       if (count($orderByColumns) > 0) {
+       if (isFilledArray($orderByColumns)) {
                // Add them as well
                $sql .= ' ORDER BY ';
                foreach ($orderByColumns as $orderByColumn => $array) {