// Extract host name from script
$host = extractHostnameFromUrl($script);
- // Construct request
+ // Construct request body
$body = http_build_query($postData, '', '&');
// Generate POST request header
$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');
}
} // END - foreach
+ //* DEBUG: */ print('<strong>Request:</strong><pre>'.print_r($request, true).'</pre>');
//* DEBUG: */ print('<strong>Response:</strong><pre>'.print_r($response, true).'</pre>');
// Proxy agent found or something went wrong?
$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')).'<br />');
+ //* 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')).'<br />');
+ //* 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) . ')<br />');
+ //* 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.'<br />');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'part1=' . $part1 . '/part2=' . $part2);
$mod = dechex($idx);
if ($part1 > $part2) {
$mod = dechex(sqrt(($part1 - $part2) * getConfig('_PRIME') / pi()));
$mod = dechex(sqrt(($part2 - $part1) * getConfig('_PRIME') / pi()));
}
$mod = substr($mod, 0, 2);
- //* DEBUG: */ outputHtml('part1='.$part1.'/part2='.$part2.'/mod=' . $mod . '('.strlen($mod).')<br />');
+ //* 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 . '*<br />');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mod(' . ($idx * 2) . ')=' . $mod . '*');
$start += 2;
$newHash .= $mod;
} // END - for
- //* DEBUG: */ outputHtml($passHash . '<br />' . $newHash . ' (' . strlen($newHash) . ')<br />');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $passHash . ',' . $newHash . ' (' . strlen($newHash) . ')');
$ret = generateHash($newHash, getConfig('master_salt'));
- //* DEBUG: */ outputHtml('ret=' . $ret . '<br />');
} // END - if
// Return result
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . $ret . '');
return $ret;
}
// 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');
}
// Generates a 'selection box' from given array
-function generateSelectionBoxFromArray ($options, $name, $optionValue, $optionContent) {
+function generateSelectionBoxFromArray ($options, $name, $optionValue, $optionContent='') {
// Start the output
$OUT = '<select name="' . $name . '" size="1" class="admin_select">
<option value="X" disabled="disabled">{--PLEASE_SELECT--}</option>';
// Walk through all options
foreach ($options as $option) {
// Add the <option> entry
- $OUT .= '<option value="' . $option[$optionValue] . '">' . $option[$optionContent] . '</option>';
+ if (empty($optionContent)) {
+ // ... from template
+ $OUT .= loadTemplate('select_' . $name . '_option', true, $option);
+ } else {
+ // Direct HTML code
+ $OUT .= '<option value="' . $option[$optionValue] . '">' . $option[$optionContent] . '</option>';
+ }
} // END - foreach
// Finish selection box