Caching of XML/email templates finished:
authorRoland Häder <roland@mxchange.org>
Tue, 9 Oct 2012 19:43:43 +0000 (19:43 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 9 Oct 2012 19:43:43 +0000 (19:43 +0000)
- Added very basic (but working) support for caching XML and email templates
- Added new XML templates for listing user sub ids
- Added filter to "hook" another member action for listing member's sub ids
- Some other minor improvements
- TODOs.txt updated

21 files changed:
.gitattributes
DOCS/TODOs.txt
inc/ajax/ajax_admin.php
inc/ajax/ajax_installer.php
inc/cache/_compiled/email/.htaccess [new file with mode: 0644]
inc/cache/_compiled/emails/.htaccess [deleted file]
inc/cache/_compiled/xml/.htaccess [new file with mode: 0644]
inc/extensions/ext-user.php
inc/filter/user_filter.php
inc/filters.php
inc/functions.php
inc/language/user_de.php
inc/modules/admin/what-list_
inc/modules/admin/what-list_nickname.php
inc/modules/admin/what-list_user.php
inc/modules/admin/what-list_user_subid.php [new file with mode: 0644]
inc/template-functions.php
inc/xml-functions.php
templates/xml/admin/admin_list_nickname_history.xml
templates/xml/admin/admin_list_user_subid.xml [new file with mode: 0644]
templates/xml/admin_list_data_template.xml

index 2d9eb52fc5fd0fa5f0f0a26b47b2eb4c2830edd7..94f1970bd28e9c849a972b8d6a47f77c8c8b7331 100644 (file)
@@ -96,8 +96,9 @@ inc/autopurge/purge-tsks.php svneol=native#text/plain
 inc/autopurge/purge-unconfirmed.php svneol=native#text/plain
 inc/cache/.htaccess svneol=native#text/plain
 inc/cache/_compiled/.htaccess svneol=native#text/plain
 inc/autopurge/purge-unconfirmed.php svneol=native#text/plain
 inc/cache/.htaccess svneol=native#text/plain
 inc/cache/_compiled/.htaccess svneol=native#text/plain
-inc/cache/_compiled/emails/.htaccess svneol=native#text/plain
+inc/cache/_compiled/email/.htaccess svneol=native#text/plain
 inc/cache/_compiled/html/.htaccess svneol=native#text/plain
 inc/cache/_compiled/html/.htaccess svneol=native#text/plain
+inc/cache/_compiled/xml/.htaccess svneol=native#text/plain
 inc/callback-functions.php svneol=native#text/plain
 inc/classes/.htaccess svneol=native#text/plain
 inc/classes/cachesystem.class.php svneol=native#text/plain
 inc/callback-functions.php svneol=native#text/plain
 inc/classes/.htaccess svneol=native#text/plain
 inc/classes/cachesystem.class.php svneol=native#text/plain
@@ -602,6 +603,7 @@ inc/modules/admin/what-list_task.php svneol=native#text/plain
 inc/modules/admin/what-list_transfer.php svneol=native#text/plain
 inc/modules/admin/what-list_unconfirmed.php svneol=native#text/plain
 inc/modules/admin/what-list_user.php svneol=native#text/plain
 inc/modules/admin/what-list_transfer.php svneol=native#text/plain
 inc/modules/admin/what-list_unconfirmed.php svneol=native#text/plain
 inc/modules/admin/what-list_user.php svneol=native#text/plain
+inc/modules/admin/what-list_user_subid.php svneol=native#text/plain
 inc/modules/admin/what-list_wernis.php svneol=native#text/plain
 inc/modules/admin/what-list_yoomedia_tm.php svneol=native#text/plain
 inc/modules/admin/what-lock_sponsor.php svneol=native#text/plain
 inc/modules/admin/what-list_wernis.php svneol=native#text/plain
 inc/modules/admin/what-list_yoomedia_tm.php svneol=native#text/plain
 inc/modules/admin/what-lock_sponsor.php svneol=native#text/plain
index 1b1007647e51f272097082bb8835084740005b4a..a93a44a6a74991f22d7baf2f140b98a321193f86 100644 (file)
 ./inc/modules/admin/what-list_refs.php:101:                                                    // @TODO Try to rewrite some to EL
 ./inc/modules/admin/what-list_unconfirmed.php:107:     // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
 ./inc/modules/admin/what-list_unconfirmed.php:84:      // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
 ./inc/modules/admin/what-list_refs.php:101:                                                    // @TODO Try to rewrite some to EL
 ./inc/modules/admin/what-list_unconfirmed.php:107:     // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
 ./inc/modules/admin/what-list_unconfirmed.php:84:      // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
-./inc/modules/admin/what-list_user.php:290:            // @TODO Rewrite this into a filter
-./inc/modules/admin/what-list_user.php:355:                    // @TODO Rewrite this into a filter
+./inc/modules/admin/what-list_user.php:289:            // @TODO Rewrite this into a filter
+./inc/modules/admin/what-list_user.php:354:                    // @TODO Rewrite this into a filter
 ./inc/modules/admin/what-logs.php:64:                  // @TODO Fix content-type here
 ./inc/modules/admin/what-logs.php:70:                  // @TODO Fix content-type here
 ./inc/modules/admin/what-mem_add.php:124:                              // @TODO This can be somehow rewritten to a function
 ./inc/modules/admin/what-logs.php:64:                  // @TODO Fix content-type here
 ./inc/modules/admin/what-logs.php:70:                  // @TODO Fix content-type here
 ./inc/modules/admin/what-mem_add.php:124:                              // @TODO This can be somehow rewritten to a function
 ./inc/mysql-manager.php:44:// @TODO Can we cache this?
 ./inc/purge/purge-inact.php:55:        // @TODO Rewrite these if() blocks to a filter
 ./inc/revision-functions.php:168:// @TODO This function does also set and get in 'cache_array'
 ./inc/mysql-manager.php:44:// @TODO Can we cache this?
 ./inc/purge/purge-inact.php:55:        // @TODO Rewrite these if() blocks to a filter
 ./inc/revision-functions.php:168:// @TODO This function does also set and get in 'cache_array'
-./inc/template-functions.php:1108:                     // @TODO Deprecate this thing
-./inc/template-functions.php:1119:                     // @TODO Deprecate this thing
-./inc/template-functions.php:1226:     // @TODO This can be easily moved out after the merge from EL branch to this is complete
-./inc/template-functions.php:1275:             // @TODO Add a little more infos here
-./inc/template-functions.php:1643:// @TODO Lame description for this function
-./inc/template-functions.php:1665:                     // @TODO Move this in a filter
+./inc/template-functions.php:1126:                     // @TODO Deprecate this thing
+./inc/template-functions.php:1137:                     // @TODO Deprecate this thing
+./inc/template-functions.php:1244:     // @TODO This can be easily moved out after the merge from EL branch to this is complete
+./inc/template-functions.php:1293:             // @TODO Add a little more infos here
+./inc/template-functions.php:1667:// @TODO Lame description for this function
+./inc/template-functions.php:1689:                     // @TODO Move this in a filter
 ./inc/template-functions.php:197:       * @TODO On some pages this is buggy
 ./inc/template-functions.php:197:       * @TODO On some pages this is buggy
+./inc/template-functions.php:2292:     // @TODO Is this needed for e.g. $GLOBALS['template_content'] ? $this->setRawTemplateData($compactedContent);
 ./inc/template-functions.php:285:      // @TODO Remove these sanity checks if all is fine
 ./inc/template-functions.php:285:      // @TODO Remove these sanity checks if all is fine
-./inc/template-functions.php:599:// @TODO $simple/$constants are deprecated
-./inc/template-functions.php:697:                      // @TODO $userid is deprecated and should be removed from loadEmailTemplate() and replaced with $content[userid] in all templates
+./inc/template-functions.php:617:// @TODO $simple/$constants are deprecated
+./inc/template-functions.php:715:                      // @TODO $userid is deprecated and should be removed from loadEmailTemplate() and replaced with $content[userid] in all templates
 ./inc/wrapper-functions.php:3010:      // @TODO Find a way to not use direct module comparison
 ./inc/wrapper-functions.php:494:// @TODO Do some more sanity check here
 ./inc/wrapper-functions.php:3010:      // @TODO Find a way to not use direct module comparison
 ./inc/wrapper-functions.php:494:// @TODO Do some more sanity check here
-./inc/xml-functions.php:209:   // @TODO Handle characters
+./inc/xml-functions.php:221:   // @TODO Handle characters
 ./mailid.php:102:              // @TODO Rewrite this to a filter
 ./mailid.php:145:                                      // @TODO Rewrite this to a filter
 ./mailid_top.php:112:          // @TODO Rewrite this to a filter/function
 ./mailid.php:102:              // @TODO Rewrite this to a filter
 ./mailid.php:145:                                      // @TODO Rewrite this to a filter
 ./mailid_top.php:112:          // @TODO Rewrite this to a filter/function
index dc5733e835ae7e764e9215e4cf071475e083284f..ae95def44ce8c87eefb1bc6fda56883287ae55d5 100644 (file)
@@ -99,7 +99,7 @@ function doAjaxAdminRequestContent () {
                setAjaxReplyContent(loadTemplate('admin_area_' . trim(postRequestElement('tab')), true));
 
                // Has the template been loaded?
                setAjaxReplyContent(loadTemplate('admin_area_' . trim(postRequestElement('tab')), true));
 
                // Has the template been loaded?
-               if (isset($GLOBALS['tpl_content']['admin_page_' . trim(postRequestElement('tab'))])) {
+               if (isset($GLOBALS['template_content']['html']['admin_page_' . trim(postRequestElement('tab'))])) {
                        // All okay if we reach this point
                        setHttpStatus('200 OK');
                } else {
                        // All okay if we reach this point
                        setHttpStatus('200 OK');
                } else {
index 1f6f9fc2a2fcb115a5bc542ad332329ad062296e..f9c50322d0119c20a4853349607cd17a7843d056 100644 (file)
@@ -150,7 +150,7 @@ function doAjaxInstallerRequestContent () {
                setAjaxReplyContent(loadTemplate('install_page_' . trim(postRequestElement('tab')), true));
 
                // Has the template been loaded?
                setAjaxReplyContent(loadTemplate('install_page_' . trim(postRequestElement('tab')), true));
 
                // Has the template been loaded?
-               if (isset($GLOBALS['tpl_content']['install_page_' . trim(postRequestElement('tab'))])) {
+               if (isset($GLOBALS['template_content']['html']['install_page_' . trim(postRequestElement('tab'))])) {
                        // All okay if we reach this point
                        setHttpStatus('200 OK');
                } else {
                        // All okay if we reach this point
                        setHttpStatus('200 OK');
                } else {
diff --git a/inc/cache/_compiled/email/.htaccess b/inc/cache/_compiled/email/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/cache/_compiled/emails/.htaccess b/inc/cache/_compiled/emails/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/inc/cache/_compiled/xml/.htaccess b/inc/cache/_compiled/xml/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
index ed6a26f2d0e28ea7d28635fd33182bfd6e0877b8..fc973a3dcf51be19765c3824e7927224080bf605 100644 (file)
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.5.4');
+setThisExtensionVersion('0.5.5');
 
 // Version history array (add more with , '0.0.1' and so on)
 
 // Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4'));
+setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5'));
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
@@ -198,6 +198,7 @@ INDEX (`stats_type`)",
                unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS', true, isExtensionDryRun());
                unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'GENERIC_UPDATE_USER_REFERRAL', true, isExtensionDryRun());
                unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'UPDATE_USER_SUBID', true, isExtensionDryRun());
                unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS', true, isExtensionDryRun());
                unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'GENERIC_UPDATE_USER_REFERRAL', true, isExtensionDryRun());
                unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'UPDATE_USER_SUBID', true, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'member_admin_actions', 'ADD_USER_SUBID_MEMBER_ACTION', true, isExtensionDryRun());
                break;
 
        case 'activate': // Do stuff when admin activates this extension
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -637,6 +638,14 @@ INDEX (`subid`)",
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Weitere Filter f&uuml;r Referral-Counter und Sub-Id hinzugef&uuml;gt.");
                                break;
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Weitere Filter f&uuml;r Referral-Counter und Sub-Id hinzugef&uuml;gt.");
                                break;
+
+                       case '0.5.5': // SQL queries for v0.5.5
+                               // Register filter
+                               registerFilter(__FILE__, __LINE__, 'member_admin_actions', 'ADD_USER_SUBID_MEMBER_ACTION', false, true, isExtensionDryRun());
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Weiteren Filter f&uuml;r Mitglieder-Aktionen im Adminbereich hinzugef&uuml;gt.");
+                               break;
                } // END - switch
                break;
 
                } // END - switch
                break;
 
index de3ce0efc26ef7ba329ef07d3df8acd4584b8f43..27980937c239c59933fd785675b2045a815ff148 100644 (file)
@@ -227,5 +227,16 @@ function FILTER_UPDATE_USER_SUBID ($filterData) {
        return $filterData;
 }
 
        return $filterData;
 }
 
+// Filter for adding member action
+function FILTER_ADD_USER_SUBID_MEMBER_ACTION ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+       // Add entry
+       array_push($filterData, 'list_user_subid');
+
+       // Return data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
 // [EOF]
 ?>
 // [EOF]
 ?>
index fca3cf439ab5f9eae1a5ade4ce46b89aa2d39784..634d0f1c00a306d515f5a03686b77aadcdf17b99 100644 (file)
@@ -993,10 +993,12 @@ function FILTER_FLUSH_TEMPLATE_CACHE () {
        // Is there cached eval() data?
        if ((isset($GLOBALS['template_eval'])) && (count($GLOBALS['template_eval']) > 0)) {
                // Now flush all
        // Is there cached eval() data?
        if ((isset($GLOBALS['template_eval'])) && (count($GLOBALS['template_eval']) > 0)) {
                // Now flush all
-               foreach ($GLOBALS['template_eval'] as $template => $eval) {
-                       // Flush the cache (if not yet found)
-                       flushTemplateCache($template, $eval);
-               } // END - if
+               foreach ($GLOBALS['template_eval'] as $prefix => $templateArray) {
+                       foreach ($templateArray as $template => $eval) {
+                               // Flush the cache (if not yet found)
+                               flushTemplateCache($prefix, $template, $eval);
+                       } // END - foreach
+               } // END - foreach
        } // END - if
 }
 
        } // END - if
 }
 
index 5fb35afd9f707113a8e54ec8c0466baff0661b9b..c37b570c973521bd1b26183a87f88e4754da0972 100644 (file)
@@ -64,7 +64,7 @@ function addFatalMessage ($F, $L, $message, $extra = '') {
        array_push($GLOBALS['fatal_messages'], $message);
 
        // Log fatal messages away
        array_push($GLOBALS['fatal_messages'], $message);
 
        // Log fatal messages away
-       logDebugMessage($F, $L, 'Fatal error message: ' . $message);
+       logDebugMessage($F, $L, 'Fatal error message: ' . compileCode($message));
 }
 
 // Getter for total fatal message count
 }
 
 // Getter for total fatal message count
index 732ccf6fdbd6ff7a13c9482478bea4107cf6ce77..ef6feb05ffa77edad2115ffbde79251c060d9b69 100644 (file)
@@ -155,6 +155,10 @@ addMessages(array(
        'MEMBER_EDIT_USER_SUBIDS_SUBJECT' => "&Auml;nderung Ihrer Sub-Id",
        'MEMBER_DELETE_USER_SUBIDS_SUBJECT' => "Ihre Sub-Id ist gel&ouml;scht",
 
        'MEMBER_EDIT_USER_SUBIDS_SUBJECT' => "&Auml;nderung Ihrer Sub-Id",
        'MEMBER_DELETE_USER_SUBIDS_SUBJECT' => "Ihre Sub-Id ist gel&ouml;scht",
 
+       // Admin - sub ids - action link
+       'ADMIN_USER_ACTION_LINK_LIST_USER_SUBID_TITLE' => "Sub-Ids des Mitgliedes auflisten und Statistik einsehen",
+       'ADMIN_USER_ACTION_LINK_LIST_USER_SUBID' => "Sub-Ids auflisten",
+
        // Generic - subids
        'SUBID_VALUE' => "Sub-Id:",
        'SUBID_ADDED' => "Hinzugef&uuml;gt:",
        // Generic - subids
        'SUBID_VALUE' => "Sub-Id:",
        'SUBID_ADDED' => "Hinzugef&uuml;gt:",
index e190b12960d5f34fb3b3ed47f2467f43d1d4a76f..4885a6a28582a6d1e53290b4b1e10998127548aa 100644 (file)
@@ -6,9 +6,9 @@
  * -------------------------------------------------------------------- *
  * File              : what-list_!!!s.php                               *
  * -------------------------------------------------------------------- *
  * -------------------------------------------------------------------- *
  * File              : what-list_!!!s.php                               *
  * -------------------------------------------------------------------- *
- * Short description : List all URLs in !!! and sync from mail pool     *
+ * Short description : List all URLs in !!!                             *
  * -------------------------------------------------------------------- *
  * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Alle URLs in !!! auflisten und syncen            *
+ * Kurzbeschreibung  : Alle URLs in !!! auflisten                       *
  * -------------------------------------------------------------------- *
  * $Revision::                                                        $ *
  * $Date::                                                            $ *
  * -------------------------------------------------------------------- *
  * $Revision::                                                        $ *
  * $Date::                                                            $ *
@@ -100,7 +100,7 @@ if ($show === false) {
        return false;
 } // END - if
 
        return false;
 } // END - if
 
-// List all URLs
+// List all !!!
 showEntriesByXmlCallback('admin_list_!!!s');
 
 // [EOF]
 showEntriesByXmlCallback('admin_list_!!!s');
 
 // [EOF]
index a52ef8323d26627fee8322b9abedeecfad83e983..8d4cada317c575dfe222f37bf10ea585bd28ca5d 100644 (file)
@@ -46,7 +46,9 @@ addYouAreHereLink('admin', __FILE__);
 // Check if 'userid' is set
 if (isGetRequestElementSet('userid')) {
        // List all entries per user
 // Check if 'userid' is set
 if (isGetRequestElementSet('userid')) {
        // List all entries per user
-       showEntriesByXmlCallback('admin_list_nickname_history');
+       showEntriesByXmlCallback('admin_list_nickname_history', array(
+               'userid' => bigintval(getRequestElement('userid'))
+       ));
 } else {
        // Output selection form with all confirmed user accounts listed
        addMemberSelectionBox();
 } else {
        // Output selection form with all confirmed user accounts listed
        addMemberSelectionBox();
index 28f967faa12f9290a9d3ac92998171d534d415d7..d721f6f0f03ce092ab0799c09a3400d253398630 100644 (file)
@@ -137,7 +137,6 @@ LIMIT 1",
                $content['joined']            = generateDateTime($content['joined'], '2');
                $content['last_update']       = generateDateTime($content['last_update'], '2');
                $content['last_profile_sent'] = generateDateTime($content['last_profile_sent'], '2');
                $content['joined']            = generateDateTime($content['joined'], '2');
                $content['last_update']       = generateDateTime($content['last_update'], '2');
                $content['last_profile_sent'] = generateDateTime($content['last_profile_sent'], '2');
-               $content['total_points']      = getTotalPoints($content['userid']);
                $content['locked_points']     = countSumTotalData($content['userid'], 'user_points', 'locked_points') + countSumTotalData($content['userid'], 'user_points', 'locked_order_points');
 
                // Prepare array for filter
                $content['locked_points']     = countSumTotalData($content['userid'], 'user_points', 'locked_points') + countSumTotalData($content['userid'], 'user_points', 'locked_order_points');
 
                // Prepare array for filter
diff --git a/inc/modules/admin/what-list_user_subid.php b/inc/modules/admin/what-list_user_subid.php
new file mode 100644 (file)
index 0000000..b2bede3
--- /dev/null
@@ -0,0 +1,88 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 10/09/2012 *
+ * ===================                          Last change: 10/09/2012 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-list_user_subid.php                         *
+ * -------------------------------------------------------------------- *
+ * Short description : List all URLs in user_subid                      *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Alle URLs in user_subid auflisten                *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+       die();
+} // END - if
+
+// Add description as navigation point
+addYouAreHereLink('admin', __FILE__);
+
+// By default show the list...
+$show = true;
+
+// Check for 'id' element
+if ((countRequestPost() > 0) && (!ifPostContainsSelections('id'))) {
+       // Not found so output message
+       displayMessage('{--ADMIN_USER_SUBID_NO_SELECTIONS--}');
+
+       // Abort here
+       return;
+} // END - if
+
+// Edit or delete button hit?
+if (isFormSent('delete')) {
+       // Show entries for deletion
+       showEntriesByXmlCallback('admin_delete_show_user_subid');
+
+       // Do not show the list of URLs after this template
+       $show = false;
+} elseif (isFormSent('do_delete')) {
+       // Remove entries from database
+       showEntriesByXmlCallback('admin_delete_do_user_subid');
+}
+
+// Show entries?
+if ($show === false) {
+       // No, a form has already been show
+       return false;
+} // END - if
+
+// Is a user id sent?
+if (isGetRequestElementSet('userid')) {
+       // List all sub ids
+       showEntriesByXmlCallback('admin_list_user_subid', array(
+               'userid' => bigintval(getRequestElement('userid'))
+       ));
+} else {
+       // Output selection form with all confirmed user accounts listed
+       addMemberSelectionBox();
+}
+
+// [EOF]
+?>
index e2b65de7493b5ff4ce6d1d2a7793549796265bed..9c7192ab1a5d40132d25ab1f45c122e2a11e93cf 100644 (file)
@@ -298,16 +298,16 @@ function loadTemplate ($template, $return = false, $content = array(), $compileC
        $GLOBALS['current_template'] = $template;
 
        // Is there cache?
        $GLOBALS['current_template'] = $template;
 
        // Is there cache?
-       if ((!isDebuggingTemplateCache()) && (isTemplateCached($template))) {
+       if ((!isDebuggingTemplateCache()) && (isTemplateCached('html', $template))) {
                // Evaluate the cache
                // Evaluate the cache
-               eval(readTemplateCache($template));
-       } elseif (!isset($GLOBALS['template_eval'][$template])) {
+               eval(readTemplateCache('html', $template));
+       } elseif (!isset($GLOBALS['template_eval']['html'][$template])) {
                // Make all template names lowercase
                $template = strtolower($template);
 
                // Base directory
                $basePath = sprintf("%stemplates/%s/html/", getPath(), getLanguage());
                // Make all template names lowercase
                $template = strtolower($template);
 
                // Base directory
                $basePath = sprintf("%stemplates/%s/html/", getPath(), getLanguage());
-               $extraPath = detectExtraTemplatePath($template);
+               $extraPath = detectExtraTemplatePath('html', $template);
 
                // Generate FQFN
                $FQFN = $basePath . $extraPath . $template . '.tpl';
 
                // Generate FQFN
                $FQFN = $basePath . $extraPath . $template . '.tpl';
@@ -325,31 +325,31 @@ function loadTemplate ($template, $return = false, $content = array(), $compileC
                        incrementConfigEntry('num_templates');
 
                        // The local file does exists so we load it. :)
                        incrementConfigEntry('num_templates');
 
                        // The local file does exists so we load it. :)
-                       $GLOBALS['tpl_content'][$template] = readFromFile($FQFN);
+                       $GLOBALS['template_content']['html'][$template] = readFromFile($FQFN);
 
                        // Is there to compile the code?
 
                        // Is there to compile the code?
-                       if ((isInString('$', $GLOBALS['tpl_content'][$template])) || (isInString('{--', $GLOBALS['tpl_content'][$template])) || (isInString('{?', $GLOBALS['tpl_content'][$template])) || (isInString('{%', $GLOBALS['tpl_content'][$template]))) {
+                       if ((isInString('$', $GLOBALS['template_content']['html'][$template])) || (isInString('{--', $GLOBALS['template_content']['html'][$template])) || (isInString('{?', $GLOBALS['template_content']['html'][$template])) || (isInString('{%', $GLOBALS['template_content']['html'][$template]))) {
                                // Normal HTML output?
                                if ((isHtmlOutputMode()) && (substr($template, 0, 3) != 'js_')) {
                                        // Add surrounding HTML comments to help finding bugs faster
                                // Normal HTML output?
                                if ((isHtmlOutputMode()) && (substr($template, 0, 3) != 'js_')) {
                                        // Add surrounding HTML comments to help finding bugs faster
-                                       $code = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['tpl_content'][$template] . '<!-- Template ' . $template . ' - End //-->';
+                                       $code = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['template_content']['html'][$template] . '<!-- Template ' . $template . ' - End //-->';
 
                                        // Prepare eval() command
 
                                        // Prepare eval() command
-                                       $GLOBALS['template_eval'][$template] = '$ret = "' . getColorSwitchCode($template) . compileCode(escapeQuotes($code), false, true, true, $compileCode) . '";';
+                                       $GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileCode(escapeQuotes($code), false, true, true, $compileCode) . '";';
                                } elseif (substr($template, 0, 3) == 'js_') {
                                        // JavaScripts don't like entities, dollar signs and timings
                                } elseif (substr($template, 0, 3) == 'js_') {
                                        // JavaScripts don't like entities, dollar signs and timings
-                                       $GLOBALS['template_eval'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['tpl_content'][$template]), false, true, true, $compileCode) . '");';
+                                       $GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), false, true, true, $compileCode) . '");';
                                } else {
                                        // Prepare eval() command, other output doesn't like entities, maybe
                                } else {
                                        // Prepare eval() command, other output doesn't like entities, maybe
-                                       $GLOBALS['template_eval'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['tpl_content'][$template]), false, true, true, $compileCode) . '");';
+                                       $GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['template_content']['html'][$template]), false, true, true, $compileCode) . '");';
                                }
                        } elseif (isHtmlOutputMode()) {
                                // Add surrounding HTML comments to help finding bugs faster
                                }
                        } elseif (isHtmlOutputMode()) {
                                // Add surrounding HTML comments to help finding bugs faster
-                               $ret = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['tpl_content'][$template] . '<!-- Template ' . $template . ' - End //-->';
-                               $GLOBALS['template_eval'][$template] = '$ret = "' . getColorSwitchCode($template) . compileRawCode(escapeQuotes($ret), false, true, true, $compileCode) . '";';
+                               $ret = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['template_content']['html'][$template] . '<!-- Template ' . $template . ' - End //-->';
+                               $GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileRawCode(escapeQuotes($ret), false, true, true, $compileCode) . '";';
                        } else {
                                // JavaScript again
                        } else {
                                // JavaScript again
-                               $GLOBALS['template_eval'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['tpl_content'][$template]), false, true, true, $compileCode) . '");';
+                               $GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), false, true, true, $compileCode) . '");';
                        } // END - if
                } elseif ((isAdmin()) || ((isInstalling()) && (!isInstalled()))) {
                        // Only admins shall see this warning or when installation mode is active
                        } // END - if
                } elseif ((isAdmin()) || ((isInstalling()) && (!isInstalled()))) {
                        // Only admins shall see this warning or when installation mode is active
@@ -365,16 +365,16 @@ function loadTemplate ($template, $return = false, $content = array(), $compileC
 </div>';
                } else {
                        // No file!
 </div>';
                } else {
                        // No file!
-                       $GLOBALS['template_eval'][$template] = '404';
+                       $GLOBALS['template_eval']['html'][$template] = '404';
                }
        }
 
        // Code set?
                }
        }
 
        // Code set?
-       if ((isset($GLOBALS['template_eval'][$template])) && ($GLOBALS['template_eval'][$template] != '404')) {
+       if ((isset($GLOBALS['template_eval']['html'][$template])) && ($GLOBALS['template_eval']['html'][$template] != '404')) {
                // Eval the code
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template=' . $template . ' - BEFORE EVAL');
                // Eval the code
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template=' . $template . ' - BEFORE EVAL');
-               ///* DEBUG: */ print('<pre>'.htmlentities($GLOBALS['template_eval'][$template]).'</pre>');
-               eval($GLOBALS['template_eval'][$template]);
+               ///* DEBUG: */ print('<pre>'.htmlentities($GLOBALS['template_eval']['html'][$template]).'</pre>');
+               eval($GLOBALS['template_eval']['html'][$template]);
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template=' . $template . ' - AFTER EVAL');
        } // END - if
 
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template=' . $template . ' - AFTER EVAL');
        } // END - if
 
@@ -395,12 +395,12 @@ function loadTemplate ($template, $return = false, $content = array(), $compileC
 }
 
 // Detects the extra template path from given template name
 }
 
 // Detects the extra template path from given template name
-function detectExtraTemplatePath ($template) {
+function detectExtraTemplatePath ($prefix, $template) {
        // Default is empty
        $extraPath = '';
 
        // Is there cache?
        // Default is empty
        $extraPath = '';
 
        // Is there cache?
-       if (!isset($GLOBALS['extra_path'][$template])) {
+       if (!isset($GLOBALS['extra_path'][$prefix][$template])) {
                // Check for admin/guest/member/etc. templates
                if (substr($template, 0, 6) == 'admin_') {
                        // Admin template found
                // Check for admin/guest/member/etc. templates
                if (substr($template, 0, 6) == 'admin_') {
                        // Admin template found
@@ -441,11 +441,11 @@ function detectExtraTemplatePath ($template) {
                }
 
                // Store it in cache
                }
 
                // Store it in cache
-               $GLOBALS['extra_path'][$template] = $extraPath;
+               $GLOBALS['extra_path'][$prefix][$template] = $extraPath;
        } // END - if
 
        // Return result
        } // END - if
 
        // Return result
-       return $GLOBALS['extra_path'][$template];
+       return $GLOBALS['extra_path'][$prefix][$template];
 }
 
 // Loads an email template and compiles it
 }
 
 // Loads an email template and compiles it
@@ -471,33 +471,37 @@ function loadEmailTemplate ($template, $content = array(), $userid = NULL, $load
                }
        } // END - if
 
                }
        } // END - if
 
-       // Base directory
-       $basePath = sprintf("%stemplates/%s/emails/", getPath(), getLanguage());
+       // Is there cache?
+       if ((!isDebuggingTemplateCache()) && (isTemplateCached('email', $template))) {
+               // Evaluate the cache
+               eval(readTemplateCache('email', $template));
+       } elseif (!isset($GLOBALS['template_eval']['email'][$template])) {
+               // Base directory
+               $basePath = sprintf("%stemplates/%s/emails/", getPath(), getLanguage());
 
 
-       // Detect extra path
-       $extraPath = detectExtraTemplatePath($template);
+               // Detect extra path
+               $extraPath = detectExtraTemplatePath('email', $template);
 
 
-       // Generate full FQFN
-       $FQFN = $basePath . $extraPath . $template . '.tpl';
+               // Generate full FQFN
+               $FQFN = $basePath . $extraPath . $template . '.tpl';
 
 
-       // Does the special template exists?
-       if (!isFileReadable($FQFN)) {
-               // Reset to default template
-               $FQFN = $basePath . $template . '.tpl';
-       } // END - if
+               // Does the special template exists?
+               if (!isFileReadable($FQFN)) {
+                       // Reset to default template
+                       $FQFN = $basePath . $template . '.tpl';
+               } // END - if
 
 
-       // Now does the final template exists?
-       $newContent = '';
-       if (isFileReadable($FQFN)) {
-               // The local file does exists so we load it. :)
-               $GLOBALS['tpl_content'][$template] = readFromFile($FQFN);
-
-               // Run code
-               $GLOBALS['tpl_content'][$template] = '$newContent = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['tpl_content'][$template])) . '");';
-               eval($GLOBALS['tpl_content'][$template]);
-       } elseif (!empty($template)) {
-               // Template file not found
-               $newContent = '<div class="para">
+               // Now does the final template exists?
+               $newContent = '';
+               if (isFileReadable($FQFN)) {
+                       // The local file does exists so we load it. :)
+                       $GLOBALS['template_content']['email'][$template] = readFromFile($FQFN);
+
+                       // Run code
+                       $GLOBALS['template_eval']['email'][$template] = '$newContent = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['template_content']['email'][$template])) . '");';
+               } elseif (!empty($template)) {
+                       // Template file not found
+                       $newContent = '<div class="para">
        {--TEMPLATE_404--}: ' . $template . '
 </div>
 <div class="para">
        {--TEMPLATE_404--}: ' . $template . '
 </div>
 <div class="para">
@@ -505,25 +509,39 @@ function loadEmailTemplate ($template, $content = array(), $userid = NULL, $load
        <pre>' . print_r($content, true) . '</pre>
 </div>';
 
        <pre>' . print_r($content, true) . '</pre>
 </div>';
 
-               // Debug mode not active? Then remove the HTML tags
-               if (!isDebugModeEnabled()) {
-                       // Remove HTML tags
-                       $newContent = secureString($newContent);
-               } // END - if
-       } else {
-               // No template name supplied!
-               $newContent = '{--NO_TEMPLATE_SUPPLIED--}';
+                       // Don't cache this, as there is no template to cache
+                       $GLOBALS['template_eval']['email'][$template] = '404';
+
+                       // Debug mode not active? Then remove the HTML tags
+                       if (!isDebugModeEnabled()) {
+                               // Remove HTML tags
+                               $newContent = secureString($newContent);
+                       } // END - if
+               } else {
+                       // No template name supplied!
+                       $newContent = '{--NO_TEMPLATE_SUPPLIED--}';
+                       $GLOBALS['template_eval']['email'][$template] = '404';
+               }
        }
 
        }
 
+       // Is there something to eval?
+       if ((isset($GLOBALS['template_eval']['email'][$template])) && ($GLOBALS['template_eval']['email'][$template] != '404')) {
+               // Eval the code
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template=' . $template . ' - BEFORE EVAL');
+               ///* DEBUG: */ print('<pre>'.htmlentities($GLOBALS['template_eval']['email'][$template]).'</pre>');
+               eval($GLOBALS['template_eval']['email'][$template]);
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template=' . $template . ' - AFTER EVAL');
+       } // END - if
+
        // Are there some content?
        if (empty($newContent)) {
                // Compiling failed
        // Are there some content?
        if (empty($newContent)) {
                // Compiling failed
-               $newContent = "Compiler error for template " . $template . " !\nUncompiled content:\n" . $GLOBALS['tpl_content'][$template];
+               $newContent = "Compiler error for template " . $template . " !\nUncompiled content:\n" . $GLOBALS['template_content']['email'][$template];
 
                // Add last error if the required function exists
                if (function_exists('error_get_last')) {
                        // Add last error and some lines for better overview
 
                // Add last error if the required function exists
                if (function_exists('error_get_last')) {
                        // Add last error and some lines for better overview
-                       $newContent .= "\n--------------------------------------\nDebug:\n".print_r(error_get_last(), true)."--------------------------------------\nPlease don't alter these informations!\nThanx.";
+                       $newContent .= "\n--------------------------------------\nDebug:\n" . print_r(error_get_last(), true) . "--------------------------------------\nPlease don't alter these informations!\nThanx.";
                } // END - if
        } // END - if
 
                } // END - if
        } // END - if
 
@@ -1568,26 +1586,32 @@ function determinePageTitle () {
 }
 
 // Checks whethere there is a cache file there. This function is cached.
 }
 
 // Checks whethere there is a cache file there. This function is cached.
-function isTemplateCached ($template) {
+function isTemplateCached ($prefix, $template) {
        // Is there cached this result?
        // Is there cached this result?
-       if (!isset($GLOBALS['template_cache'][$template])) {
+       if (!isset($GLOBALS['template_cache'][$prefix][$template])) {
                // Generate FQFN
                // Generate FQFN
-               $FQFN = generateCacheFqfn($template);
+               $FQFN = generateCacheFqfn($prefix, $template);
 
                // Is it there?
 
                // Is it there?
-               $GLOBALS['template_cache'][$template] = isFileReadable($FQFN);
+               $GLOBALS['template_cache'][$prefix][$template] = isFileReadable($FQFN);
        } // END - if
 
        // Return it
        } // END - if
 
        // Return it
-       return $GLOBALS['template_cache'][$template];
+       return $GLOBALS['template_cache'][$prefix][$template];
 }
 
 // Flushes non-flushed template cache to disk
 }
 
 // Flushes non-flushed template cache to disk
-function flushTemplateCache ($template, $eval) {
+function flushTemplateCache ($prefix, $template, $eval) {
        // Is this cache flushed?
        // Is this cache flushed?
-       if ((isDebuggingTemplateCache() === false) && (isTemplateCached($template) === false) && ($eval != '404')) {
+       if ((isDebuggingTemplateCache() === false) && (isTemplateCached($prefix, $template) === false) && ($eval != '404')) {
                // Generate FQFN
                // Generate FQFN
-               $FQFN = generateCacheFqfn($template);
+               $FQFN = generateCacheFqfn($prefix, $template);
+
+               // Is this a XML template?
+               if ($prefix == 'xml') {
+                       // Compact only XML templates as emails needs new-line characters and HTML may contain required "comments"
+                       $eval = compactContent($eval);
+               } // END - if
 
                // And flush it
                writeToFile($FQFN, $eval, true);
 
                // And flush it
                writeToFile($FQFN, $eval, true);
@@ -1595,24 +1619,24 @@ function flushTemplateCache ($template, $eval) {
 }
 
 // Reads a template cache
 }
 
 // Reads a template cache
-function readTemplateCache ($template) {
+function readTemplateCache ($prefix, $template) {
        // Check it again
        // Check it again
-       if ((isDebuggingTemplateCache()) || (!isTemplateCached($template))) {
+       if ((isDebuggingTemplateCache()) || (!isTemplateCached($prefix, $template))) {
                // This should not happen
                reportBug('Wether debugging of template cache is enabled or template ' . $template . ' is not cached while expected.');
        } // END - if
 
        // Is it cached?
                // This should not happen
                reportBug('Wether debugging of template cache is enabled or template ' . $template . ' is not cached while expected.');
        } // END - if
 
        // Is it cached?
-       if (!isset($GLOBALS['template_eval'][$template])) {
+       if (!isset($GLOBALS['template_eval'][$prefix][$template])) {
                // Generate FQFN
                // Generate FQFN
-               $FQFN = generateCacheFqfn($template);
+               $FQFN = generateCacheFqfn($prefix, $template);
 
                // And read from it
 
                // And read from it
-               $GLOBALS['template_eval'][$template] = readFromFile($FQFN);
+               $GLOBALS['template_eval'][$prefix][$template] = readFromFile($FQFN);
        } // END - if
 
        // And return it
        } // END - if
 
        // And return it
-       return $GLOBALS['template_eval'][$template];
+       return $GLOBALS['template_eval'][$prefix][$template];
 }
 
 // Escapes quotes (default is only double-quotes)
 }
 
 // Escapes quotes (default is only double-quotes)
@@ -1872,20 +1896,20 @@ function generateMetaDescriptionCode () {
 }
 
 // Generates an FQFN for template cache from the given template name
 }
 
 // Generates an FQFN for template cache from the given template name
-function generateCacheFqfn ($template, $mode = 'html') {
+function generateCacheFqfn ($prefix, $template) {
        // Is this cached?
        // Is this cached?
-       if (!isset($GLOBALS['template_cache_fqfn'][$template])) {
+       if (!isset($GLOBALS['template_cache_fqfn'][$prefix][$template])) {
                // Generate the FQFN
                // Generate the FQFN
-               $GLOBALS['template_cache_fqfn'][$template] = sprintf(
+               $GLOBALS['template_cache_fqfn'][$prefix][$template] = sprintf(
                        "%s_compiled/%s/%s.tpl.cache",
                        getCachePath(),
                        "%s_compiled/%s/%s.tpl.cache",
                        getCachePath(),
-                       $mode,
+                       $prefix,
                        $template
                );
        } // END - if
 
        // Return it
                        $template
                );
        } // END - if
 
        // Return it
-       return $GLOBALS['template_cache_fqfn'][$template];
+       return $GLOBALS['template_cache_fqfn'][$prefix][$template];
 }
 
 // "Fixes" null or empty string to count of dashes
 }
 
 // "Fixes" null or empty string to count of dashes
@@ -2242,5 +2266,34 @@ function anonymizeSensitiveData ($data) {
        return $data;
 }
 
        return $data;
 }
 
+/**
+ * Removes all commentd, tabs and new-line characters to compact the content
+ *
+ * @param      $uncompactedContent             The uncompacted content
+ * @return     $compactedContent               The compacted content
+ */
+function compactContent ($uncompactedContent) {
+       // First, remove all tab/new-line/revert characters
+       $compactedContent = str_replace(chr(9), '', str_replace(chr(10), '', str_replace(chr(13), '', $uncompactedContent)));
+
+       // Then regex all comments like <!-- //--> away
+       preg_match_all('/<!--[\w\W]*?(\/\/){0,1}-->/', $compactedContent, $matches);
+
+       // Do we have entries?
+       if (isset($matches[0][0])) {
+               // Remove all
+               foreach ($matches[0] as $match) {
+                       // Remove the match
+                       $compactedContent = str_replace($match, '', $compactedContent);
+               } // END - foreach
+       } // END - if
+
+       // Set the content again
+       // @TODO Is this needed for e.g. $GLOBALS['template_content'] ? $this->setRawTemplateData($compactedContent);
+
+       // Return compacted content
+       return $compactedContent;
+}
+
 // [EOF]
 ?>
 // [EOF]
 ?>
index c3cfa51b0be8109eeb207bdbfd813cd1462c698b..d0963f4b22f203ee895d4e64a026edd4ebf95b90 100644 (file)
@@ -41,11 +41,11 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Calls back a function based on given XML template data
 } // END - if
 
 // Calls back a function based on given XML template data
-function showEntriesByXmlCallback ($template) {
+function showEntriesByXmlCallback ($template, $content = array(), $compileCode = true) {
        // Generate FQFN for with special path
        $FQFN = sprintf("%stemplates/xml/%s%s.xml",
                getPath(),
        // Generate FQFN for with special path
        $FQFN = sprintf("%stemplates/xml/%s%s.xml",
                getPath(),
-               detectExtraTemplatePath($template),
+               detectExtraTemplatePath('xml', $template),
                $template
        );
 
                $template
        );
 
@@ -60,8 +60,20 @@ function showEntriesByXmlCallback ($template) {
 
        // Is it again readable?
        if (isFileReadable($FQFN)) {
 
        // Is it again readable?
        if (isFileReadable($FQFN)) {
-               // Read it
-               $templateContent = readFromFile($FQFN);
+               // Is there cache?
+               if ((!isDebuggingTemplateCache()) && (isTemplateCached('xml', $template))) {
+                       // Evaluate the cache
+                       eval(readTemplateCache('xml', $template));
+               } else {
+                       // Read it
+                       $templateContent = readFromFile($FQFN);
+
+                       // Prepare it for finaly eval() command
+                       $GLOBALS['template_eval']['xml'][$template] = '$templateContent = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($templateContent), false, true, true, $compileCode) . '");';
+
+                       // Eval the code, this does insert any array elements from $content
+                       eval($GLOBALS['template_eval']['xml'][$template]);
+               }
 
                // Init main arrays
                $GLOBALS['__XML_CALLBACKS'] = array(
 
                // Init main arrays
                $GLOBALS['__XML_CALLBACKS'] = array(
@@ -87,7 +99,7 @@ function showEntriesByXmlCallback ($template) {
 
 // Adds special elements by calling back another template-depending function
 function addXmlSpecialElements ($template) {
 
 // Adds special elements by calling back another template-depending function
 function addXmlSpecialElements ($template) {
-       // Generate the FQCN (Full-Qualified CallbackName)
+       // Generate the FQCN (Full-Qualified Callback Name)
        $FQCN = 'addXmlSpecial' . capitalizeUnderscoreString($template);
 
        // Is it there?
        $FQCN = 'addXmlSpecial' . capitalizeUnderscoreString($template);
 
        // Is it there?
index 7d74b2cf86da3a2f552283dedd9f72e1a6774bb4..01f74798af61831498e92952af5f4b97b4136cae 100644 (file)
@@ -88,7 +88,7 @@ MA  02110-1301  USA
                        - condition = look-up condition
                        - look-for  = What to look for
                        //-->
                        - condition = look-up condition
                        - look-for  = What to look for
                        //-->
-                       <where-select-from-list-entry type="string" table="" value="history_userid" condition="EQUALS" look-for="$userid" />
+                       <where-select-from-list-entry type="string" table="" value="history_userid" condition="EQUALS" look-for="$content[userid]" />
                </where-select-from-list>
                <!--
                Columns to perform the ORDER BY statement (GROUP BY is not yet supported)
                </where-select-from-list>
                <!--
                Columns to perform the ORDER BY statement (GROUP BY is not yet supported)
diff --git a/templates/xml/admin/admin_list_user_subid.xml b/templates/xml/admin/admin_list_user_subid.xml
new file mode 100644 (file)
index 0000000..691c25e
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+This template provides meta data for listing user sub ids
+
+@author                Roland Haeder <webmaster@mxchange.org>
+@version       0.2.1-FINAL
+@copyright     (c) 2003 - 2009 by Roland Haeder
+@copyright     (c) 2009 - 2012 by Mailer Developer Team
+@license       GNU GPL 2.0 or any newer version
+@link          http://mxchange.org
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+MA  02110-1301  USA
+//-->
+<admin-list-data>
+       <!--
+       Call-back function, the extracted data from this XML will then be re-read
+       from that function. The most common function this XML uses is
+       doGenericListEntries() so mostly you can leave this alone unless you have JOINs.
+       //-->
+       <callback-function type="string" value="doGenericListEntries" />
+       <!--
+       Now we need information which template should be loaded and which functions
+       shall be called back. So lets start with the main list template. This mostly
+       requires no call-back function.
+       //-->
+       <list-template type="string" value="admin_list_user_subid" />
+       <!--
+       The template for all rows, mostly this name has a '_row' suffix and again,
+       no call-back function is usually required.
+       //-->
+       <list-row-template type="string" value="admin_list_user_subid_row" />
+       <!--
+       Message id to display if no entry could be found
+       //-->
+       <no-entry-found-message type="string" value="ADMIN_FORCED_ADS_404" />
+       <!--
+       The table(s) we shall grab the data from, all as list.
+       //-->
+       <data-tables>
+               <!--
+               A single table entry, with alias and without the configurable
+               _MYSQL_PREFIX. You can specify the table's name or alias later on.
+               //-->
+               <data-table type="string" alias="" value="user_subids" />
+               <!--
+               Columns to perform the SELECT statement on, with alias and name plus which table.
+               //-->
+               <select-data-from-list>
+                       <!--
+                       A single entry with table name (can be left empty), value (must
+                       always be set), alias (again can be left empty) and SQL function
+                       (can also be left empty) which shall be applied on the column.
+                       //-->
+                       <select-data-from-list-entry type="string" table="" value="id" alias="" function="" />
+                       <select-data-from-list-entry type="string" table="" value="userid" alias="" function="" />
+                       <select-data-from-list-entry type="string" table="" value="subid" alias="" function="" />
+                       <select-data-from-list-entry type="string" table="" value="subid_added" alias="subid_added" function="UNIX_TIMESTAMP" />
+               </select-data-from-list>
+               <!--
+               And the column list to perform the WHERE statement on.
+               //-->
+               <where-select-from-list>
+                       <!--
+                       Query on for selected user's sub ids
+                       //-->
+                       <where-select-from-list-entry type="string" table="" value="userid" condition="EQUALS" look-for="$content[userid]" />
+               </where-select-from-list>
+               <!--
+               Columns to perform the ORDER BY statement (GROUP BY is not yet supported)
+               //-->
+               <order-by-list>
+                       <!--
+                       A single entry to perform the ORDER BY statement on, see above WHERE entry for details.
+                       //-->
+                       <order-by-list-entry type="string" table="" order="subid" value="ASC" />
+               </order-by-list>
+       </data-tables>
+       <!--
+       List all column names from the 'select-data-from-list' node here, but now
+       with call-back informations. The list must only contain those entries where
+       a call-back function shall be called for.
+       //-->
+       <column-callback-list>
+               <!--
+               Another column, now we need a second parameter here because
+               generateDateTime() expects two parameters (first is always the data
+               from column).
+               //-->
+               <column-callback-list-entry>
+                       <!--
+                       The actual data, again.
+                       //-->
+                       <column-callback-data type="string" value="subid_added" callback="generateDateTime" />
+                       <!--
+                       More parameters, remember that the first parameter is always given
+                       and that it is the data from column.
+                       //-->
+                       <callback-extra-parameter-list>
+                               <!--
+                               A single parameter, 'type' can be one of 'float', 'int',
+                               'bool', 'string'. 'array' is not yet supported.
+                               //-->
+                               <callback-extra-parameter-list-entry type="int" column="subid_added" value="2" />
+                       </callback-extra-parameter-list>
+               </column-callback-list-entry>
+       </column-callback-list>
+</admin-list-data>
index 4a5311dffc393f69b06ab6fcb960559288412fe5..e0e63fb882a0e5c734bce8cd77a7540351d5925f 100644 (file)
@@ -117,7 +117,7 @@ MA 02110-1301 USA
                        - condition = look-up condition
                        - look-for  = What to look for
                        //-->
                        - condition = look-up condition
                        - look-for  = What to look for
                        //-->
-                       <where-select-from-list-entry type="string" table="dt" value="userid" condition="EQUALS" look-for="$userid" />
+                       <where-select-from-list-entry type="string" table="dt" value="userid" condition="EQUALS" look-for="$content[userid]" />
                        <!--
                        The second column to perform the WHERE statement on. NOT-EQUALS is an alias for '!='.
                        //-->
                        <!--
                        The second column to perform the WHERE statement on. NOT-EQUALS is an alias for '!='.
                        //-->