X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffunctions.php;h=9eedda3e4329d93a189c476efdcf34d40564bfb9;hb=718b0e4fa583fd61764d9be2657445f50265dcdc;hp=5b30f4f795174e15a0dd36501aa36651104efcd9;hpb=de5910b8e5deb9285a7ac57c26ebd894f4e1afbf;p=mailer.git diff --git a/inc/functions.php b/inc/functions.php index 5b30f4f795..9eedda3e43 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -18,6 +18,7 @@ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * + * Copyright (c) 2009, 2010 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -1793,7 +1794,7 @@ function sendPostRequest ($script, $postData) { // Extract host name from script $host = extractHostnameFromUrl($script); - // Construct request + // Construct request body $body = http_build_query($postData, '', '&'); // Generate POST request header @@ -1801,8 +1802,11 @@ function sendPostRequest ($script, $postData) { $request .= 'Host: ' . $host . getConfig('HTTP_EOL'); $request .= 'Referer: ' . getConfig('URL') . '/admin.php' . getConfig('HTTP_EOL'); $request .= 'User-Agent: ' . getConfig('TITLE') . '/' . getConfig('FULL_VERSION') . getConfig('HTTP_EOL'); + $request .= 'Accept: text/plain;q=0.8' . getConfig('HTTP_EOL'); + $request .= 'Accept-Charset: UTF-8,*' . getConfig('HTTP_EOL'); $request .= 'Cache-Control: no-cache' . getConfig('HTTP_EOL'); $request .= 'Content-Type: application/x-www-form-urlencoded' . getConfig('HTTP_EOL'); + $request .= 'Content-Length: ' . strlen($body) . getConfig('HTTP_EOL'); $request .= 'Connection: close' . getConfig('HTTP_EOL'); $request .= getConfig('HTTP_EOL'); @@ -1863,7 +1867,7 @@ function sendRawRequest ($host, $request) { // Use login data to proxy? (username at least!) if (getConfig('proxy_username') != '') { // Add it as well - $encodedAuth = base64_encode(compileRawCode(getConfig('proxy_username')) . getConfig('ENCRYPT_SEPERATOR') . compileRawCode(getConfig('proxy_password'))); + $encodedAuth = base64_encode(compileRawCode(getConfig('proxy_username')) . ':' . compileRawCode(getConfig('proxy_password'))); $proxyTunnel .= 'Proxy-Authorization: Basic ' . $encodedAuth . getConfig('HTTP_EOL'); } // END - if @@ -1950,6 +1954,7 @@ function sendRawRequest ($host, $request) { } } // END - foreach + //* DEBUG: */ print('Request:
'.print_r($request, true).'
'); //* DEBUG: */ print('Response:
'.print_r($response, true).'
'); // Proxy agent found or something went wrong? @@ -2232,21 +2237,22 @@ function encodeHashForCookie ($passHash) { $ret = $passHash; // Is a secret key and master salt already initialized? - //* DEBUG: */ outputHtml(__FUNCTION__.':'.intval(isExtensionInstalled('sql_patches')).'/'.intval(isConfigEntrySet('_PRIME')).'/'.intval(isConfigEntrySet('secret_key')).'/'.intval(isConfigEntrySet('master_salt')).'
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, intval(isExtensionInstalled('sql_patches')) . '/' . intval(isConfigEntrySet('_PRIME')) . '/' . intval(isConfigEntrySet('secret_key')) . '/' . intval(isConfigEntrySet('master_salt'))); if ((isExtensionInstalled('sql_patches')) && (isConfigEntrySet('_PRIME')) && (isConfigEntrySet('secret_key')) && (isConfigEntrySet('master_salt'))) { // Only calculate when the secret key is generated - //* DEBUG: */ outputHtml(__FUNCTION__.':'.strlen($passHash).'/'.strlen(getConfig('secret_key')).'
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, strlen($passHash) . '/' . strlen(getConfig('secret_key'))); if ((strlen($passHash) != 49) || (strlen(getConfig('secret_key')) != 40)) { // Both keys must have same length so return unencrypted + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, strlen($passHash) . '!=49/' . strlen(getConfig('secret_key')) . '!=40'); return $ret; } // END - if $newHash = ''; $start = 9; - //* DEBUG: */ outputHtml('passHash=' . $passHash . '(' . strlen($passHash) . ')
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'passHash=' . $passHash . '(' . strlen($passHash) . ')'); for ($idx = 0; $idx < 20; $idx++) { $part1 = hexdec(substr($passHash, ($idx * 2) + (strlen($passHash) - strlen(getConfig('secret_key'))), 2)); $part2 = hexdec(substr(getConfig('secret_key'), $start, 2)); - //* DEBUG: */ outputHtml('part1='.$part1.'/part2='.$part2.'
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'part1=' . $part1 . '/part2=' . $part2); $mod = dechex($idx); if ($part1 > $part2) { $mod = dechex(sqrt(($part1 - $part2) * getConfig('_PRIME') / pi())); @@ -2254,19 +2260,19 @@ function encodeHashForCookie ($passHash) { $mod = dechex(sqrt(($part2 - $part1) * getConfig('_PRIME') / pi())); } $mod = substr($mod, 0, 2); - //* DEBUG: */ outputHtml('part1='.$part1.'/part2='.$part2.'/mod=' . $mod . '('.strlen($mod).')
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'part1=' . $part1 . '/part2=' . $part2 . '/mod=' . $mod . '(' . strlen($mod) . ')'); $mod = str_repeat(0, (2 - strlen($mod))) . $mod; - //* DEBUG: */ outputHtml('mod(' . ($idx * 2) . ')=' . $mod . '*
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mod(' . ($idx * 2) . ')=' . $mod . '*'); $start += 2; $newHash .= $mod; } // END - for - //* DEBUG: */ outputHtml($passHash . '
' . $newHash . ' (' . strlen($newHash) . ')
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $passHash . ',' . $newHash . ' (' . strlen($newHash) . ')'); $ret = generateHash($newHash, getConfig('master_salt')); - //* DEBUG: */ outputHtml('ret=' . $ret . '
'); } // END - if // Return result + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . $ret . ''); return $ret; } @@ -2291,11 +2297,8 @@ function app_die ($F, $L, $message) { // Make sure, that the script realy realy diese here and now $GLOBALS['app_died'] = true; - // Set content type if not set - if (!isContentTypeSet()) { - // text/html is the right one - setContentType('text/html'); - } // END - if + // Set content type as text/html + setContentType('text/html'); // Load header loadIncludeOnce('inc/header.php'); @@ -2545,6 +2548,7 @@ function getMessageFromErrorCode ($code) { case getCode('MORE_RECEIVERS2') : $message = getMessage('MEMBER_NO_MORE_RECEIVERS_FOUND'); break; case getCode('MORE_RECEIVERS3') : $message = getMessage('MEMBER_ENTER_MORE_MIN_RECEIVERS'); break; case getCode('INVALID_URL') : $message = getMessage('MEMBER_ENTER_INVALID_URL'); break; + case getCode('NO_MAIL_TYPE') : $message = getMessage('MEMBER_NO_MAIL_TYPE_SELECTED'); break; case getCode('UNKNOWN_ERROR') : $message = getMessage('LOGIN_UNKNOWN_ERROR'); break; case getCode('UNKNOWN_STATUS') : $message = getMessage('LOGIN_UNKNOWN_STATUS'); break; @@ -3684,7 +3688,7 @@ function sendModeMails ($mod, $modes) { } // Generates a 'selection box' from given array -function generateSelectionBoxFromArray ($options, $name, $optionValue, $optionContent) { +function generateSelectionBoxFromArray ($options, $name, $optionValue, $optionContent='') { // Start the output $OUT = '