+ break;
+
+ case getCode('URL_TLOCK'):
+ $result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestElement('id'))), __FILE__, __LINE__);
+
+ // Load timestamp from last order
+ list($timestamp) = SQL_FETCHROW($result);
+ $timestamp = generateDateTime($timestamp, 1);
+
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Calculate hours...
+ $STD = round(getConfig('url_tlock') / 60 / 60);
+
+ // Minutes...
+ $MIN = round((getConfig('url_tlock') - $STD * 60 * 60) / 60);
+
+ // And seconds
+ $SEC = getConfig('url_tlock') - $STD * 60 * 60 - $MIN * 60;
+
+ // Finally contruct the message
+ // @TODO Rewrite this old lost code to a template
+ $message = "{--MEMBER_URL_TIME_LOCK--}<br />{--CONFIG_URL_TLOCK--} ".$STD."
+ {--_HOURS--}, ".$MIN." {--_MINUTES--} {--_AND--} ".$SEC." {--_SECONDS--}<br />
+ {--MEMBER_LAST_TLOCK--}: ".$timestamp;
+ break;
+
+ default:
+ // Missing/invalid code
+ $message = sprintf(getMessage('UNKNOWN_MAILID_CODE'), $code);
+
+ // Log it
+ logDebugMessage(__FUNCTION__, __LINE__, $message);
+ break;
+ } // END - switch
+
+ // Return the message
+ return $message;
+}
+
+// Compile characters which are allowed in URLs
+function compileUriCode ($code, $simple = true) {
+ // Compile constants
+ if ($simple === false) $code = str_replace('{--', '".', str_replace('--}', '."', $code));
+
+ // Compile QUOT and other non-HTML codes
+ $code = str_replace('{DOT}', '.',
+ str_replace('{SLASH}', '/',
+ str_replace('{QUOT}', "'",
+ str_replace('{DOLLAR}', '$',
+ str_replace('{OPEN_ANCHOR}', '(',
+ str_replace('{CLOSE_ANCHOR}', ')',
+ str_replace('{OPEN_SQR}', '[',
+ str_replace('{CLOSE_SQR}', ']',
+ str_replace('{PER}', '%',
+ $code
+ )))))))));
+
+ // Return compiled code
+ return $code;
+}
+
+// Function taken from user comments on www.php.net / function eregi()
+function isUrlValidSimple ($url) {
+ // Prepare URL
+ $url = secureString(str_replace("\\", '', compileRawCode(urldecode($url))));
+
+ // Allows http and https
+ $http = "(http|https)+(:\/\/)";
+ // Test domain
+ $domain1 = "([[:alnum:]]([-[:alnum:]])*\.)?([[:alnum:]][-[:alnum:]\.]*[[:alnum:]])(\.[[:alpha:]]{2,5})?";
+ // Test double-domains (e.g. .de.vu)
+ $domain2 = "([-[:alnum:]])?(\.[[:alnum:]][-[:alnum:]\.]*[[:alnum:]])(\.[[:alpha:]]{2,5})(\.[[:alpha:]]{2,5})?";
+ // Test IP number
+ $ip = "([[:digit:]]{1,3})\.([[:digit:]]{1,3})\.([[:digit:]]{1,3})\.([[:digit:]]{1,3})";
+ // ... directory
+ $dir = "((/)+([-_\.[:alnum:]])+)*";
+ // ... page
+ $page = "/([-_[:alnum:]][-\._[:alnum:]]*\.[[:alnum:]]{2,5})?";
+ // ... and the string after and including question character
+ $getstring1 = "([\?/]([[:alnum:]][-\._%[:alnum:]]*(=)?([-\@\._:%[:alnum:]])+)(&([[:alnum:]]([-_%[:alnum:]])*(=)?([-\@\[\._:%[:alnum:]])+(\])*))*)?";
+ // Pattern for URLs like http://url/dir/doc.html?var=value
+ $pattern['d1dpg1'] = $http . $domain1 . $dir . $page . $getstring1;
+ $pattern['d2dpg1'] = $http . $domain2 . $dir . $page . $getstring1;
+ $pattern['ipdpg1'] = $http . $ip . $dir . $page . $getstring1;
+ // Pattern for URLs like http://url/dir/?var=value
+ $pattern['d1dg1'] = $http . $domain1 . $dir.'/' . $getstring1;
+ $pattern['d2dg1'] = $http . $domain2 . $dir.'/' . $getstring1;
+ $pattern['ipdg1'] = $http . $ip . $dir.'/' . $getstring1;
+ // Pattern for URLs like http://url/dir/page.ext
+ $pattern['d1dp'] = $http . $domain1 . $dir . $page;
+ $pattern['d1dp'] = $http . $domain2 . $dir . $page;
+ $pattern['ipdp'] = $http . $ip . $dir . $page;
+ // Pattern for URLs like http://url/dir
+ $pattern['d1d'] = $http . $domain1 . $dir;
+ $pattern['d2d'] = $http . $domain2 . $dir;
+ $pattern['ipd'] = $http . $ip . $dir;
+ // Pattern for URLs like http://url/?var=value
+ $pattern['d1g1'] = $http . $domain1 . '/' . $getstring1;
+ $pattern['d2g1'] = $http . $domain2 . '/' . $getstring1;
+ $pattern['ipg1'] = $http . $ip . '/' . $getstring1;
+ // Pattern for URLs like http://url?var=value
+ $pattern['d1g12'] = $http . $domain1 . $getstring1;
+ $pattern['d2g12'] = $http . $domain2 . $getstring1;
+ $pattern['ipg12'] = $http . $ip . $getstring1;
+ // Test all patterns
+ $reg = false;
+ foreach ($pattern as $key => $pat) {
+ // Debug regex?
+ if (isDebugRegExpressionEnabled()) {
+ // @TODO Are these convertions still required?
+ $pat = str_replace('.', "\.", $pat);
+ $pat = str_replace('@', "\@", $pat);
+ //* DEBUG: */ outputHtml($key."= " . $pat . '<br />');