dir . '/Sources')) $sourcedir = $boarddir . '/Sources'; $db_character_set = 'utf8'; ?> without cgi.fix_pathinfo. if (!empty($modSettings['queryless_urls']) && (!$context['server']['is_cgi'] || @ini_get('cgi.fix_pathinfo') == 1) && $context['server']['is_apache']) { // Let's do something special for session ids! if (defined('SID') && SID != '') $buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . ';)((?:board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html?' . SID . '\$2\"'", $buffer); else $buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2\"'", $buffer); } // Return the changed buffer. return $buffer; } ?>an't access nslookup/host, PHP 4.1.x might just crash. if (@version_compare(PHP_VERSION, '4.2.0') == -1) $host = false; // Try the Linux host command, perhaps? if (!isset($host) && (strpos(strtolower(PHP_OS), 'win') === false || strpos(strtolower(PHP_OS), 'darwin') !== false) && rand(0, 1) == 1) { if (!isset($modSettings['host_to_dis'])) $test = @shell_exec('host -W 1 ' . @escapeshellarg($ip)); else $test = @shell_exec('host ' . @escapeshellarg($ip)); // Did host say it didn't find anything? if (strpos($test, 'not found') !== false) $host = ''; // Invalid server option? elseif (strpos($test, 'invalid option') && !isset($modSettings['host_to_dis'])) updateSettings(array('host_to_dis' => 1)); // Maybe it found something, after all? elseif (preg_match('~\s([^\s]+?)\.\s~', $test, $match) == 1) $host = $match[1]; } // This is nslookup; usually only Windows, but possibly some Unix? if (!isset($host) && strpos(strtolower(PHP_OS), 'win') !== false && strpos(strtolower(PHP_OS), 'darwin') === false && rand(0, 1) == 1) { $test = @shell_exec('nslookup -timeout=1 ' . @escapeshellarg($ip)); if (strpos($test, 'Non-existent domain') !== false) $host = ''; elseif (preg_match('~Name:\s+([^\s]+)~', $test, $match) == 1) $host = $match[1]; } // This is the last try :/. if (!isset($host) || $host === false) $host = @gethostbyaddr($ip); // It took a long time, so let's cache it! if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $t)) > 0.5) cache_put_data('hostlookup-' . $ip, $host, 600); return $host; } // Chops a string into words and prepares them to be inserted into (or searched from) the database. function text2words($text, $max_chars = 20, $encrypt = false) { global $func, $context; // Step 1: Remove entities/things we don't consider words: $words = preg_replace('~([\x0B\0' . ($context['utf8'] ? ($context['server']['complex_preg_chars'] ? '\x{A0}' : pack('C*', 0xC2, 0xA0)) : '\xA0') . '\t\r\s\n(){}\\[\\]<>!@$%^*.,:+=`\~\?/\\\\]|&(amp|lt|gt|quot);)+~' . ($context['utf8'] ? 'u' : ''), ' ', strtr($text, array('
' => ' '))); // Step 2: Entities we left to letters, where applicable, lowercase. $words = un_htmlspecialchars($func['strtolower']($words)); // Step 3: Ready to split apart and index! $words = explode(' ', $words); if ($encrypt) { $possible_chars = array_flip(array_merge(range(46, 57), range(65, 90), range(97, 122))); $returned_ints = array(); foreach ($words as $word) { if (($word = trim($word, '-_\'')) !== '') { $encrypted = substr(crypt($word, 'uk'), 2, $max_chars); $total = 0; for ($i = 0; $i < $max_chars; $i++) $total += $possible_chars[ord($encrypted{$i})] * pow(63, $i); $returned_ints[] = $max_chars == 4 ? min($total, 16777215) : $total; } } return array_unique($returned_ints); } else { // Trim characters before and after and add slashes for database insertion. $returned_words = array(); foreach ($words as $word) if (($word = trim($word, '-_\'')) !== '') $returned_words[] = addslashes($max_chars === null ? $word : substr($word, 0, $max_chars)); // Filter out all words that occur more than once. return array_unique($returned_words); } } // Creates an image/text button function create_button($name, $alt, $label = '', $custom = '') { global $settings, $txt, $context; if (!$settings['use_image_buttons']) return $txt[$alt]; elseif (!empty($settings['use_buttons'])) return '' . $txt[$alt] . '' . ($label != '' ? '' . $txt[$label] . '' : ''); else return '' . $txt[$alt] . ''; } ?>ver(); if (!$memcached) { // '0' means ignore me for the rest of this page view. $memcached = '0'; return null; } if (!fwrite($memcached, 'get ' . $key . "\r\n")) { $memcached = fclose($memcached); return null; } $response = fgets($memcached); if (substr($response, 0, 3) != 'END' && substr($response, 0, 5) != 'VALUE') { // Bad response, junk time. $memcached = fclose($memcached); return null; } if (substr($response, 0, 5) == 'VALUE' && preg_match('~(\d+)$~', trim($response), $match) != 0) $value = substr(fread($memcached, $match[1] + 2), 0, -2); fread($memcached, 5); } // Again, eAccelerator. elseif (function_exists('eaccelerator_get')) $value = eaccelerator_get($key); // The older, but ever-stable, Turck MMCache... elseif (function_exists('mmcache_get')) $value = mmcache_get($key); // This is the free APC from PECL. elseif (function_exists('apc_fetch')) $value = apc_fetch($key . 'smf'); // Zend's pricey stuff. elseif (function_exists('output_cache_get')) $value = output_cache_get($key, $ttl); if (isset($db_show_debug) && $db_show_debug === true) { $cache_hits[$cache_count]['t'] = array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st)); $cache_hits[$cache_count]['s'] = isset($value) ? strlen($value) : 0; } if (empty($value)) return null; // If it's broke, it's broke... so give up on it. else return @unserialize($value); } function get_memcached_server($level = 3) { global $modSettings, $memcached, $db_persist; $servers = explode(',', $modSettings['cache_memcached']); $server = explode(':', trim($servers[array_rand($servers)])); // Don't try more times than we have servers! $level = min(count($servers), $level); // Don't wait too long: yes, we want the server, but we might be able to run the query faster! if (empty($db_persist)) $memcached = @fsockopen($server[0], empty($server[1]) ? 11211 : $server[1], $err, $err, 0.15); else $memcached = @pfsockopen($server[0], empty($server[1]) ? 11211 : $server[1], $err, $err, 0.15); if (!$memcached && $level > 0) get_memcached_server($level - 1); elseif ($memcached) { @socket_set_timeout($memcached, 1); @set_file_buffer($memcached, 0); } } ?>'\'' . $newPassword_sha1 . '\'')); } else updateMemberData($memID, array('passwd' => '\'' . $newPassword_sha1 . '\'')); if (isset($modSettings['integrate_reset_pass']) && function_exists($modSettings['integrate_reset_pass'])) call_user_func($modSettings['integrate_reset_pass'], $old_user, $user, $newPassword); // Send them the email informing them of the change - then we're done! sendmail($email, $txt['change_password'], "$txt[hello_member] $user!\n\n" . "$txt[change_password_1] $context[forum_name] $txt[change_password_2]\n\n" . "$txt[719]$user, $txt[492] $newPassword\n\n" . "$txt[701]\n" . "$scripturl?action=profile\n\n" . $txt[130]); } // This function simply checks whether a password meets the current forum rules. function validatePassword($password, $username, $restrict_in = array()) { global $modSettings, $func; // Perform basic requirements first. if (strlen($password) < (empty($modSettings['password_strength']) ? 4 : 8)) return 'short'; // Is this enough? if (empty($modSettings['password_strength'])) return null; // Otherwise, perform the medium strength test - checking if password appears in the restricted string. if (preg_match('~\b' . preg_quote($password, '~') . '\b~', implode(' ', $restrict_in)) != 0) return 'restricted_words'; elseif ($func['strpos']($password, $username) !== false) return 'restricted_words'; // !!! If pspell is available, use it on the word, and return restricted_words if it doesn't give "bad spelling"? // If just medium, we're done. if ($modSettings['password_strength'] == 1) return null; // Otherwise, hard test next, check for numbers and letters, uppercase too. $good = preg_match('~(\D\d|\d\D)~', $password) != 0; $good &= $func['strtolower']($password) != $password; return $good ? null : 'chars'; } ?> Connection Problems

Connection Problems

Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later.