Heacy rewrite/cleanup:
[mailer.git] / inc / xml-functions.php
index 3e11e66a779c5cbca93b067b3d568b5f69523682..0228d8f528cd5afe3af34844c55ae4a368080f39 100644 (file)
@@ -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 . '%}');
@@ -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) {