Continued a bit:
authorRoland Häder <roland@mxchange.org>
Tue, 31 May 2016 07:36:23 +0000 (09:36 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 31 May 2016 07:36:23 +0000 (09:36 +0200)
- better check on mysql/mysqli (later is the newer one, first one is obsolete)
- rewrote code to no use 'recode' anymore as it is not available under Windows
- cleaned up some variables: don't modify parameters (more is needed)
- updated TODOs.txt

DOCS/TODOs.txt
inc/extensions/ext-user.php
inc/extensions/user/mode-update.php
inc/functions.php
inc/mysql-connect.php
inc/xml-functions.php

index 5111aa34659b08b6d73d3b9f142b5e238104f8e3..3b01431478b0ee7791e41e6569f164266cb1e04a 100644 (file)
@@ -1,4 +1,4 @@
-### WARNING: THIS FILE IS AUTO-GENERATED BY ./contrib/todo-builder.sh (uid=/user=quix0r) ###
+### WARNING: THIS FILE IS AUTO-GENERATED BY ./contrib/todo-builder.sh (uid=1051406/user=) ###
 ### DO NOT EDIT THIS FILE. ###
 ./api.php:66:// @TODO Do stuff here
 ./autoreg.php:57:// @TODO Add processing of request here
 ./inc/email-functions.php:204:// @TODO $rawUserId is currently unused
 ./inc/expression-functions.php:168:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
 ./inc/expression-functions.php:41:     // @TODO is escapeQuotes() enough for strings with single/double quotes?
+./inc/extensions-functions.php:2234:                   // @TODO Is this really neccessary?
+./inc/extensions-functions.php:2291:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
+./inc/extensions-functions.php:434:    // @TODO This redirect is still needed to register sql_patches! Please try to avoid it
+./inc/extensions-functions.php:450:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
+./inc/extensions-functions.php:590:            // @TODO Extension is loaded, what next?
 ./inc/extensions/admins/mode-update.php:38:// @TODO Remove double tabs from all lines
 ./inc/extensions/autopurge/mode-update.php:38:// @TODO Remove double tabs from all lines
 ./inc/extensions/beg/mode-update.php:38:// @TODO Remove double tabs from all lines
 ./inc/extensions/ext-yoomedia.php:120:         // @TODO Can this be moved into a database table?
 ./inc/extensions/ext-yoomedia.php:54:// @TODO Only deprecated when 'ext-network' is ready: setExtensionDeprecated('Y');
 ./inc/extensions/forced/mode-setup.php:38:// @TODO Remove double tabs from all lines
-./inc/extensions-functions.php:2234:                   // @TODO Is this really neccessary?
-./inc/extensions-functions.php:2291:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
-./inc/extensions-functions.php:434:    // @TODO This redirect is still needed to register sql_patches! Please try to avoid it
-./inc/extensions-functions.php:450:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
-./inc/extensions-functions.php:590:            // @TODO Extension is loaded, what next?
 ./inc/extensions/grade/mode-setup.php:38:// @TODO Remove double tabs from all lines
 ./inc/extensions/html_mail/mode-update.php:38:// @TODO Remove double tabs from all lines
 ./inc/extensions/network/mode-setup.php:13: * @TODO ADCocktail: All request parameters, BIDausKAS, WIDausKAS???    *
 ./inc/extensions/transfer/mode-setup.php:38:// @TODO Remove double tabs from all lines
 ./inc/extensions/transfer/mode-update.php:38:// @TODO Remove double tabs from all lines
 ./inc/extensions/user/mode-update.php:38:// @TODO Remove double tabs from all lines
-./inc/extensions/user/mode-update.php:554:                             // @TODO Make configurable through web interface
+./inc/extensions/user/mode-update.php:548:                             // @TODO Make configurable through web interface
+./inc/filter-functions.php:115:        // @TODO Remove this forced removal after a year or so
 ./inc/filter/blacklist_filter.php:105: // @TODO Insert log entry
 ./inc/filter/blacklist_filter.php:116: // @TODO Insert log entry
 ./inc/filter/blacklist_filter.php:127: // @TODO Insert log entry
 ./inc/filter/bonus_filter.php:56:              // @TODO This query isn't right, it will only update if the user was for a longer time away!
 ./inc/filter/forced_filter.php:75:             // @TODO This part is unfinished
-./inc/filter-functions.php:115:        // @TODO Remove this forced removal after a year or so
 ./inc/filter/order_filter.php:132:             // @TODO 200 is hard-coded here, swap it out to config + admin_config_order.tpl
-./inc/filters.php:1379:                // @TODO No banner found, output some default banner
 ./inc/filter/user_filter.php:279:// @TODO 0% done
 ./inc/filter/user_filter.php:289:// @TODO 0% done
 ./inc/filter/wernis_filter.php:137:// @TODO 0% done
 ./inc/filter/wernis_filter.php:62:// @TODO 10% done
 ./inc/filter/wernis_filter.php:80:// @TODO 10% done
 ./inc/filter/wernis_filter.php:98:// @TODO 10% done
-./inc/functions.php:1238:                      // @TODO Are these convertions still required?
-./inc/functions.php:1259:// @TODO Rewrite this function to use readFromFile() and writeToFile()
-./inc/functions.php:1563:              // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
-./inc/functions.php:1939:      // @TODO Find a way to cache this
-./inc/functions.php:2043:      // @TODO This is still very static, rewrite it somehow
-./inc/functions.php:2222:      // @TODO Rename column data_type to e.g. mail_status
-./inc/functions.php:2572:// @TODO cacheFiles is not yet supported
+./inc/filters.php:1379:                // @TODO No banner found, output some default banner
+./inc/functions.php:1242:                      // @TODO Are these convertions still required?
+./inc/functions.php:1263:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:1567:              // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
+./inc/functions.php:1943:      // @TODO Find a way to cache this
+./inc/functions.php:2047:      // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2226:      // @TODO Rename column data_type to e.g. mail_status
+./inc/functions.php:2576:// @TODO cacheFiles is not yet supported
+./inc/functions.php:440:// @TODO $allowSpider is unused
 ./inc/gen_sql_patches.php:93:// @TODO Rewrite this to a filter
 ./inc/install-functions.php:102:       // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestElement('omode'), 0);
 ./inc/install-functions.php:497:       // @TODO Comparing with DEFAULT_MAIN_TITLE doesn't work
+./inc/language-functions.php:249:      // @TODO These are all valid languages, again hard-coded
 ./inc/language/de.php:1150:    // @TODO Rewrite these two constants
 ./inc/language/de.php:1166:    // @TODO Rewrite these three constants
 ./inc/language/de.php:46:      // @TODO Please sort these language elements
-./inc/language-functions.php:249:      // @TODO These are all valid languages, again hard-coded
 ./inc/language/install_de.php:155:     // @TODO Move this to e.g. ext-smtp
 ./inc/language/newsletter_de.php:13: * @TODO This language file is completely out-dated, please do no       *
 ./inc/language/order_de.php:71:        // @TODO Find better text
 ./inc/modules/admin/what-list_rallye_prices.php:222:                   // @TODO Rewrite these two constants
 ./inc/modules/admin/what-list_refs.php:101:                                                    // @TODO Try to rewrite some to EL
 ./inc/modules/admin/what-list_unconfirmed.php:115:     // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
-./inc/modules/admin/what-list_user_cats.php:54:                // @TODO No longer needed? define('__CATEGORIES_BASE'   , '<a href="{%url=modules.php?module=admin&amp;userid=');
-./inc/modules/admin/what-list_user_cats.php:74:                                // @TODO Rewrite this to countSum.....() function
 ./inc/modules/admin/what-list_user.php:104:            // @TODO Refacture these old link generation to functions
 ./inc/modules/admin/what-list_user.php:121:            // @TODO Refacture birth_foo to avoid uni* timetstamps as older members cannot be greeded correctly
 ./inc/modules/admin/what-list_user.php:288:            // @TODO Rewrite this into a filter
 ./inc/modules/admin/what-list_user.php:350:                    // @TODO Rewrite this into a filter
+./inc/modules/admin/what-list_user_cats.php:54:                // @TODO No longer needed? define('__CATEGORIES_BASE'   , '<a href="{%url=modules.php?module=admin&amp;userid=');
+./inc/modules/admin/what-list_user_cats.php:74:                                // @TODO Rewrite this to countSum.....() 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/template-functions.php:756:                      // @TODO $userid is deprecated and should be removed from loadEmailTemplate() and replaced with $content[userid] in all templates
 ./inc/wrapper-functions.php:3293:      // @TODO Find a way to not use direct module comparison
 ./inc/wrapper-functions.php:596:// @TODO Do some more sanity check here
-./inc/xml-functions.php:235:   // @TODO Handle characters
+./inc/xml-functions.php:229:   // @TODO Handle characters
 ./mailid.php:118:              // @TODO Rewrite this to a filter/function
 ./mailid.php:155:                                      // @TODO Rewrite this to a filter
 ./mailid.php:76:// @TODO Improve check on $data['type'], empty() is not very much ...
 ./templates/de/html/guest/guest_nickname_login.tpl:21: @TODO Deactivated feature, try to find a solution for this or remove it.
 ./templates/de/html/guest/guest_stats_member.tpl:21:   @TODO We have to fix these counters.
 ./templates/de/html/member/member_list_unconfirmed_nopoints.tpl:20:            <!-- @TODO Nothing to say here? //-->
-./templates/de/html/surfbar/surfbar_frameset.tpl:4:    // @TODO This redirect kills our own frameset
 ./templates/de/html/surfbar/surfbar_frame_textlinks.tpl:5:             <!-- @TODO These are static lines and should be replaced by a filter (see ext-network/ext-sponsor) //-->
+./templates/de/html/surfbar/surfbar_frameset.tpl:4:    // @TODO This redirect kills our own frameset
 ./js/admin-network-query-api.js:67:// @TODO Add support for checkboxes
 ./js/admin-network-query-api.js:68:// @TODO Make progress window working
 ./js/ajax-common.js:245:                               // @TODO Need this be secured?
index 5e5557ac0bda35faaf2151e697fd72835ec50c15..1d74c88cf3bc861373a68b9b65d89976360a06bb 100644 (file)
@@ -59,12 +59,6 @@ switch (getExtensionMode()) {
                break;
 
        case 'activate': // Do stuff when admin activates this extension
-               // Is the required PHP extension 'recode' loaded?
-               if (!isPhpExtensionLoaded('recode')) {
-                       // Required extension not loaded
-                       enableExtensionReportingFailure();
-               } // END - if
-
                // SQL commands to run
                addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what`='subids' LIMIT 1");
                break;
index ee6a940a1ef66cab4a9d0fdf5568079ded4b887a..3b10d9d3bcb09832f3301b8450837f9d6d55fbb0 100644 (file)
@@ -400,12 +400,6 @@ INDEX (`refid`)",
                                break;
 
                        case '0.5.3': // SQL queries for v0.5.3
-                               // Is the PHP extension 'recode' activated
-                               if (!isPhpExtensionLoaded('recode')) {
-                                       // This update requires 'recode'
-                                       enableExtensionReportingFailure();
-                               } // END - if
-
                                // Register filter
                                registerFilter(__FILE__, __LINE__, 'post_refid_validation', 'HANDLE_USER_SUBID', FALSE, TRUE, isExtensionDryRun());
                                registerFilter(__FILE__, __LINE__, 'pre_user_registration', 'SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS', FALSE, TRUE, isExtensionDryRun());
index d5d9226e38b4b6980eefed23818ef2d9daa41882..07affa858ae621d45ada5a4a95e97f5e0b6732bb 100644 (file)
@@ -224,12 +224,7 @@ function translateActivationStatus ($status) {
 // OPPOMENT: convertCommaToDot()
 function translateComma ($dotted, $cut = TRUE, $max = '0') {
        // First, cast all to double, due to PHP changes
-       $dotted = (double) $dotted;
-
-       // Default is 3 you can change this in admin area "Settings -> Misc Options"
-       if (!isConfigEntrySet('max_comma')) {
-               setConfigEntry('max_comma', 3);
-       } // END - if
+       $double = (double) $dotted;
 
        // Use from config is default
        $maxComma = getConfig('max_comma');
@@ -242,7 +237,7 @@ function translateComma ($dotted, $cut = TRUE, $max = '0') {
        // Cut zeros off?
        if (($cut === TRUE) && ($max == '0')) {
                // Test for commata if in cut-mode
-               $com = explode('.', $dotted);
+               $com = explode('.', $double);
                if (count($com) < 2) {
                        // Don't display commatas even if there are none... ;-)
                        $maxComma = '0';
@@ -252,19 +247,19 @@ function translateComma ($dotted, $cut = TRUE, $max = '0') {
        // Debug log
 
        // Translate it now
-       $translated = $dotted;
+       $translated = $double;
        switch (getLanguage()) {
                case 'de': // German language
-                       $translated = number_format($dotted, $maxComma, ',', '.');
+                       $translated = number_format($double, $maxComma, ',', '.');
                        break;
 
                default: // All others
-                       $translated = number_format($dotted, $maxComma, '.', ',');
+                       $translated = number_format($double, $maxComma, '.', ',');
                        break;
        } // END - switch
 
        // Return translated value
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'dotted=' . $dotted . ',translated=' . $translated . ',maxComma=' . $maxComma);
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'double=' . $double . ',translated=' . $translated . ',maxComma=' . $maxComma);
        return $translated;
 }
 
@@ -322,6 +317,9 @@ function translateUserStatus ($status) {
 
 // "Translates" 'visible' and 'locked' to a CSS class
 function translateMenuVisibleLocked ($content, $prefix = '') {
+       // 1st parameter should be an array
+       assert(is_array($content));
+
        // Default is 'menu_unknown'
        $content['visible_css'] = $prefix . 'menu_unknown';
 
@@ -373,7 +371,12 @@ function generateDereferrerUrl ($url) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'url=' . $url . ',hash=' . $hash . '(' . strlen($hash) . ')');
 
                // De-refer this URL
-               $url = '{%url=modules.php?module=loader&amp;url=' . $encodedUrl . '&amp;hash=' . encodeHashForCookie($hash) . '&amp;salt=' . substr($hash, 0, getSaltLength()) . '%}';
+               $url = sprintf(
+                               '{%url=modules.php?module=loader&amp;url=%s&amp;hash=%s&amp;salt=%s%}',
+                               $encodedUrl,
+                               encodeHashForCookie($hash),
+                               substr($hash, 0, getSaltLength())
+               );
        } // END - if
 
        // Return link
@@ -403,7 +406,7 @@ function countSelection ($array) {
        $ret = '0';
 
        // Count all entries
-       foreach ($array as $key => $selected) {
+       foreach ($array as $selected) {
                // Is it checked?
                if (!empty($selected)) {
                        // Yes, then count it
@@ -434,6 +437,7 @@ function makeTime ($hours, $minutes, $seconds, $stamp) {
 }
 
 // Redirects to an URL and if neccessarry extends it with own base URL
+// @TODO $allowSpider is unused
 function redirectToUrl ($url, $allowSpider = TRUE, $compileCode = TRUE) {
        // Is the output mode -2?
        if (isAjaxOutputMode()) {
@@ -521,7 +525,7 @@ function array_pk_sort (&$array, $a_sort, $primary_key = '0', $order = -1, $nums
                                if ($match) {
                                        // We have found two different values, so let's sort whole array
                                        foreach ($temporaryArray as $sort_key => $sort_val) {
-                                               $t                       = $temporaryArray[$sort_key][$key];
+                                               $t = $temporaryArray[$sort_key][$key];
                                                $temporaryArray[$sort_key][$key]  = $temporaryArray[$sort_key][$key2];
                                                $temporaryArray[$sort_key][$key2] = $t;
                                                unset($t);
index 00fd7d94e94f5464a4247199ee37245b2768f2ad..1e596c3a8c56b986b07722250d84c044fece132b 100644 (file)
@@ -129,12 +129,21 @@ if ((!isInstaller()) && (isInstalled())) {
                // Then take it from session
                /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Setting _DB_TYPE from session;database_extension=' . getSession('database_extension'));
                setConfigEntry('_DB_TYPE', getSession('database_extension'));
-       } else {
+       } elseif (isPhpExtensionLoaded('mysql')) {
                // Debug message
                /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Setting _DB_TYPE to default (mysql) ...');
 
                // Set (old) default
                setConfigEntry('_DB_TYPE', 'mysql');
+       } elseif (isPhpExtensionLoaded('mysqli')) {
+               // Debug message
+               /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Setting _DB_TYPE to MySQLi ...');
+
+               // Set (old) default
+               setConfigEntry('_DB_TYPE', 'mysqli');
+       } else {
+               // Opps, cannot detect it?
+               reportBug(__FILE__, __LINE__, 'Cannot detect mysql/mysqli. Please fix your setup.');
        }
 
        // Set link as down
index dc5bb5ba72006d19d86ac66e3c14f6a5ac545434..ee135cfcc51c9baec19856651dfa9641dbe71e5e 100644 (file)
@@ -128,14 +128,8 @@ function addXmlSpecialElements ($template) {
 
 // Parses the XML content
 function parseXmlData ($content) {
-       // Is there recode?
-       if (!isPhpExtensionLoaded('recode')) {
-               // No fallback ATM
-               reportBug(__FUNCTION__, __LINE__, 'PHP extension recode is missing. Please install it.');
-       } // END - if
-
        // Convert HTML entities to UTF-8
-       $content = recode('html..utf8', $content);
+       $decoded = decodeEntities($content);
 
        // Create a new XML parser
        $xmlParser = xml_parser_create();
@@ -151,7 +145,7 @@ function parseXmlData ($content) {
        xml_set_character_data_handler($xmlParser, 'xmlCharacterHandler');
 
        // Now parse the XML tree
-       if (!xml_parse($xmlParser, $content)) {
+       if (!xml_parse($xmlParser, $decoded)) {
                // Error found in XML!
                //* DEBUG: */ die('<pre>'.htmlentities($content).'</pre>');
                reportBug(__FUNCTION__, __LINE__, 'Error found in XML. errorMessage=' . xml_error_string(xml_get_error_code($xmlParser)) . ', line=' . xml_get_current_line_number($xmlParser));