From 86cd70ff024c1e32d9f19dc215628eda18bb510b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 28 Aug 2011 02:56:19 +0000 Subject: [PATCH] will become deprecated in loadEmaiLTemplate() --- DOCS/TODOs.txt | 59 +++++++++++++++++++++----------------- inc/functions.php | 51 +++++++++++++++++++------------- inc/template-functions.php | 1 + 3 files changed, 64 insertions(+), 47 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index e5126e5795..4eeb522f47 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -16,23 +16,27 @@ ./inc/extensions/ext-network.php:20: * @TODO Ad-Magnet: Banner-View, Textlink-Klick/-View. Page-Peel * ./inc/extensions/ext-network.php:21: * @TODO ADCocktail: All request parameters, BIDausKAS, WIDausKAS??? * ./inc/extensions/ext-network.php:22: * @TODO ADCocktail: Zero array element is return code! * -./inc/extensions/ext-network.php:23: * @TODO Affiliblatt: All except banner, do they really have UTF-8? * -./inc/extensions/ext-network.php:24: * @TODO AllAds4You: Traffic from abroad, High-Forced banner * -./inc/extensions/ext-network.php:25: * @TODO FuCoExSponsor: No High-Forced banner, HTML is BASE64 encoded * -./inc/extensions/ext-network.php:26: * @TODO FuCoExSponsor: Textlink-View is JavaScript! * -./inc/extensions/ext-network.php:27: * @TODO Fusion-Ads: Has click/banner URL in API response * -./inc/extensions/ext-network.php:28: * @TODO GeldSponsor.de Requires ID card copy/business reg. * -./inc/extensions/ext-network.php:29: * @TODO GolloX: Which charset? * -./inc/extensions/ext-network.php:30: * @TODO paid4ad: Which URLs for click and banner? * -./inc/extensions/ext-network.php:31: * @TODO VIPads: HTML text is send encoded with BASE64 * -./inc/extensions/ext-network.php:32: * @TODO Der Werbepartner.cc: Banner click/view is JavaScript! * -./inc/extensions/ext-network.php:33: * @TODO Der Werbepartner.cc: Forced textlink not correct * -./inc/extensions/ext-network.php:34: * @TODO Der Werbepartner.cc: Layer not correct * -./inc/extensions/ext-network.php:35: * @TODO Der Werbepartner.cc: Sky banner is JavaScript! * -./inc/extensions/ext-network.php:36: * @TODO Der Werbepartner.cc: Surfbar click not correct * -./inc/extensions/ext-network.php:37: * @TODO Der Werbepartner.cc: Textlink not not correct * -./inc/extensions/ext-network.php:38: * @TODO Yoo!Media: What is LayerAd compared to Layer click? * -./inc/extensions/ext-network.php:94: // @TODO network_type_handle is an internal name and needs documentation +./inc/extensions/ext-network.php:23: * @TODO adgain.de: HTML mails are encoded with BASE64 * +./inc/extensions/ext-network.php:24: * @TODO adgain.de: Textlink-View is a JavaScript URL * +./inc/extensions/ext-network.php:25: * @TODO ADkracher: HTML mails are encoded with BASE64 * +./inc/extensions/ext-network.php:26: * @TODO ADkracher: Textlink-View is a JavaScript URL * +./inc/extensions/ext-network.php:27: * @TODO Affiliblatt: All except banner, do they really have UTF-8? * +./inc/extensions/ext-network.php:28: * @TODO AllAds4You: Traffic from abroad, High-Forced banner * +./inc/extensions/ext-network.php:29: * @TODO FuCoExSponsor: No High-Forced banner, HTML is BASE64 encoded * +./inc/extensions/ext-network.php:30: * @TODO FuCoExSponsor: Textlink-View is JavaScript! * +./inc/extensions/ext-network.php:31: * @TODO Fusion-Ads: Has click/banner URL in API response * +./inc/extensions/ext-network.php:32: * @TODO GeldSponsor.de Requires ID card copy/business reg. * +./inc/extensions/ext-network.php:33: * @TODO GolloX: Which charset? * +./inc/extensions/ext-network.php:34: * @TODO paid4ad: Which URLs for click and banner? * +./inc/extensions/ext-network.php:35: * @TODO VIPads: HTML text is send encoded with BASE64 * +./inc/extensions/ext-network.php:36: * @TODO Der Werbepartner.cc: Banner click/view is JavaScript! * +./inc/extensions/ext-network.php:37: * @TODO Der Werbepartner.cc: Forced textlink not correct * +./inc/extensions/ext-network.php:38: * @TODO Der Werbepartner.cc: Layer not correct * +./inc/extensions/ext-network.php:39: * @TODO Der Werbepartner.cc: Sky banner is JavaScript! * +./inc/extensions/ext-network.php:40: * @TODO Der Werbepartner.cc: Surfbar click not correct * +./inc/extensions/ext-network.php:41: * @TODO Der Werbepartner.cc: Textlink not not correct * +./inc/extensions/ext-network.php:42: * @TODO Yoo!Media: What is LayerAd compared to Layer click? * +./inc/extensions/ext-network.php:98: // @TODO network_type_handle is an internal name and needs documentation ./inc/extensions/ext-newsletter.php:218: // @TODO Move these into configuration ./inc/extensions/ext-order.php:358: // @TODO This should be moved out to inc/daily/ ./inc/extensions/ext-rallye.php:341: // @TODO Move this code into a hook @@ -49,9 +53,9 @@ ./inc/functions.php:1273: // @TODO Are these convertions still required? ./inc/functions.php:1293:// @TODO Rewrite this function to use readFromFile() and writeToFile() ./inc/functions.php:156:// @TODO Rewrite this to an extension 'smtp' -./inc/functions.php:1903: // @TODO Find a way to cache this -./inc/functions.php:2004: // @TODO This is still very static, rewrite it somehow -./inc/functions.php:2199: // @TODO Rename column data_type to e.g. mail_status +./inc/functions.php:1914: // @TODO Find a way to cache this +./inc/functions.php:2015: // @TODO This is still very static, rewrite it somehow +./inc/functions.php:2210: // @TODO Rename column data_type to e.g. mail_status ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter ./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestElement('omode'), 0); ./inc/language/de.php:1075: // @TODO Rewrite these two constants @@ -172,15 +176,15 @@ ./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:169:// @TODO This function does also set and get in 'cache_array' -./inc/template-functions.php:1079: // @TODO Deprecate this thing -./inc/template-functions.php:1090: // @TODO Deprecate this thing -./inc/template-functions.php:1180: // @TODO This can be easily moved out after the merge from EL branch to this is complete -./inc/template-functions.php:1213: // @TODO Add a little more infos here -./inc/template-functions.php:1542:// @TODO Lame description for this function -./inc/template-functions.php:1564: // @TODO Move this in a filter +./inc/template-functions.php:1080: // @TODO Deprecate this thing +./inc/template-functions.php:1091: // @TODO Deprecate this thing +./inc/template-functions.php:1181: // @TODO This can be easily moved out after the merge from EL branch to this is complete +./inc/template-functions.php:1214: // @TODO Add a little more infos here +./inc/template-functions.php:1543:// @TODO Lame description for this function +./inc/template-functions.php:1565: // @TODO Move this in a filter ./inc/template-functions.php:193: * @TODO On some pages this is buggy ./inc/template-functions.php:282: // @TODO Remove this sanity-check if all is fine -./inc/template-functions.php:607:// @TODO $simple/$constants are deprecated +./inc/template-functions.php:608:// @TODO $simple/$constants are deprecated ./inc/wrapper-functions.php:512:// @TODO Do some more sanity check here ./inc/xml-functions.php:189: // @TODO Handle characters ./mailid.php:139: // @TODO Rewrite this to a filter @@ -254,6 +258,7 @@ ./inc/reset/reset_profile.php:2:// @DEPRECATED ./inc/reset/reset_surfbar.php:2:// @DEPRECATED ./inc/reset/reset_yoomedia.php:2:// @DEPRECATED +./inc/template-functions.php:464: // @DEPRECATED Loading the user data by given userid is deprecated because it is not related to template loading ./network-check.php:2:// @DEPRECATED ./templates/de/emails/add-points.tpl:1:@DEPRECATED ./templates/de/emails/admin/admin_coupon.tpl:1:@DEPRECATED diff --git a/inc/functions.php b/inc/functions.php index f3320812ec..f35ee954c6 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1793,19 +1793,32 @@ function isExtraTitleSet () { return ((isset($GLOBALS['extra_title'])) && (!empty($GLOBALS['extra_title']))); } -// Reads a directory recursively by default and searches for files not matching -// an exclusion pattern. You can now keep the exclusion pattern empty for reading -// a whole directory. +/** + * Reads a directory recursively by default and searches for files not matching + * an exclusion pattern. You can now keep the exclusion pattern empty for reading + * a whole directory. + * + * @param $baseDir Relative base directory to PATH to scan from + * @param $prefix Prefix for all positive matches (which files should be found) + * @param $fileIncludeDirs Wether to include directories in the final output array + * @param $addBaseDir Wether to add $baseDir to all array entries + * @param $excludeArray Excluded files and directories, these must be full files names, e.g. 'what-' will exclude all files named 'what-' but won't exclude 'what-foo.php' + * @param $extension File extension for all positive matches + * @param $excludePattern Regular expression to exclude more files (preg_match()) + * @param $recursive Wether to scan recursively + * @param $suffix Suffix for positive matches ($extension will be appended, too) + * @return $foundMatches All found positive matches for above criteria + */ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $addBaseDir = true, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = true, $suffix = '') { - // Add default entries we should exclude - $excludeArray[] = '.'; - $excludeArray[] = '..'; - $excludeArray[] = '.svn'; - $excludeArray[] = '.htaccess'; + // Add default entries we should always exclude + $excludeArray[] = '.'; // Current directory + $excludeArray[] = '..'; // Parent directory + $excludeArray[] = '.svn'; // Directories created by Subversion + $excludeArray[] = '.htaccess'; // Directory protection files (mostly) //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'baseDir=' . $baseDir . ',prefix=' . $prefix . ' - Entered!'); - // Init includes - $files = array(); + // Init found includes + $foundMatches = array(); // Open directory $dirPointer = opendir(getPath() . $baseDir) or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot read directory ' . basename($baseDir) . '.'); @@ -1828,10 +1841,8 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad // Check if the base filenname matches an exclusion pattern and if the pattern is not empty if ((!empty($excludePattern)) && (preg_match($excludePattern, $baseFile, $match))) { - // These Lines are only for debugging!! - //* DEBUG: */ debugOutput('baseDir:' . $baseDir); - //* DEBUG: */ debugOutput('baseFile:' . $baseFile); - //* DEBUG: */ debugOutput('FQFN:' . $FQFN); + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'baseDir=' . $baseDir . ',baseFile=' . $baseFile . ',FQFN=' . $FQFN); // Exclude this one continue; @@ -1840,7 +1851,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad // Skip also files with non-matching prefix genericly if (($recursive === true) && (isDirectory($FQFN))) { // Is a redirectory so read it as well - $files = merge_array($files, getArrayFromDirectory($baseDir . $baseFile . '/', $prefix, $fileIncludeDirs, $addBaseDir, $excludeArray, $extension, $excludePattern, $recursive)); + $foundMatches = merge_array($foundMatches, getArrayFromDirectory($baseDir . $baseFile . '/', $prefix, $fileIncludeDirs, $addBaseDir, $excludeArray, $extension, $excludePattern, $recursive)); // And skip further processing continue; @@ -1872,10 +1883,10 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad // Add file with or without base path if ($addBaseDir === true) { // With base path - $files[] = $fileName; + $foundMatches[] = $fileName; } else { // No base path - $files[] = $baseFile; + $foundMatches[] = $baseFile; } } else { // We found .php file but should not search for them, why? @@ -1883,7 +1894,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad } } elseif ($fileExtension == $extension) { // Other, generic file found - $files[] = $fileName; + $foundMatches[] = $fileName; } } // END - while @@ -1891,11 +1902,11 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad closedir($dirPointer); // Sort array - sort($files); + sort($foundMatches); // Return array with include files //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Left!'); - return $files; + return $foundMatches; } // Checks wether $prefix is found in $fileName diff --git a/inc/template-functions.php b/inc/template-functions.php index c301e9fd40..06fd3db008 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -461,6 +461,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = NULL, $load } // END - if // Load user's data + // @DEPRECATED Loading the user data by given userid is deprecated because it is not related to template loading //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UID=' . $userid . ',template=' . $template . ',content[]=' . gettype($content)); if ((isValidUserId($userid)) && (is_array($content))) { // If nickname extension is installed, fetch nickname as well -- 2.39.5