30) { header('HTTP/1.1 503 Too busy, try again later'); die('Server too busy. Please try again later.'); } $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT']; define('CE_CHOICE', 100000); define('GUIDE_CHOICE', 1000); define('CONTENT_EDITOR_NAME', "/cmt2/editor.php"); $member_hair_col_arr[0] = "цвет волос"; $member_hair_col_arr[1] = "блондин(ка)"; $member_hair_col_arr[2] = "брюнет(ка)"; $member_hair_col_arr[3] = "шатен(ка)"; $member_hair_col_arr[4] = "русые"; $member_hair_col_arr[5] = "рыжие"; $member_hair_col_arr[6] = "седые"; $member_hair_col_arr[7] = "зеленые"; $member_hair_col_arr[8] = "черные"; $member_hair_col_arr[9] = "мелированные"; $member_hair_col_arr[10] = "лысый(ая)"; $member_eyes_col_arr[0] = "цвет глаз"; $member_eyes_col_arr[1] = "зеленые"; $member_eyes_col_arr[2] = "синие"; $member_eyes_col_arr[3] = "голубые"; $member_eyes_col_arr[4] = "серые"; $member_eyes_col_arr[5] = "карие"; $member_eyes_col_arr[6] = "черные"; $member_eyes_col_arr[7] = "желтые"; $member_eyes_col_arr[8] = "красные"; $member_eyes_col_arr[9] = "мутные"; $member_eyes_col_arr[10] = "пустые"; $member_children_dat[0] = "дети"; $member_children_dat[1] = "нет"; $member_children_dat[2] = "есть"; $member_children_dat[3] = "1"; $member_children_dat[4] = "2"; $member_children_dat[5] = "3"; $member_children_dat[6] = "4+"; $member_Education_dat[0] = "образование"; $member_Education_dat[1] = "начальное"; $member_Education_dat[2] = "незак. среднее"; $member_Education_dat[3] = "среднее"; $member_Education_dat[4] = "незак. высшее"; $member_Education_dat[5] = "высшее"; $member_Education_dat[6] = "2+ высших"; if (is_file($_SERVER['DOCUMENT_ROOT'] . "/../gvmp.ini")) { /* * * Local settings exist so load them. */ include $_SERVER['DOCUMENT_ROOT'] . "/../gvmp.ini"; } else { die("NOCONFIG"); } /* require_once "memcached-client.php"; $mc = new memcached(array( 'servers' => array('127.0.0.1:11211'), 'debug' => false, 'compress_threshold' => 10240, 'persistant' => true)); */ function MakePassPhrase($PasswordLength = 5, $ForceLang = false) { global $SLANG; list($usec, $sec) = explode(' ', microtime()); mt_srand((float) $sec + ((float) $usec * 100000)); $passphrase = ''; if ($ForceLang) { $ttLANG = $ForceLang; } else { $ttLANG = $SLANG; } if ($ttLANG == 'Ru') { $Alphabet = '23456789цукенгхфывапрлджячсмитю'; } else { $Alphabet = '23456789qwertyupasdfghkjzxcvbnm'; } $Alphabet = '23456789qwertyupasdfghkjzxcvbnm'; for ($i = 0; $i < $PasswordLength; $i++) { $passphrase .= $Alphabet[mt_rand(0, strlen($Alphabet) - 1)]; } return $passphrase; } function MakeVeriCode() { global $DB, $SLANG; $hid = DBInsert( $DB, 'DC2_passverification', array( 'passphrase' => QuoteAndSlashes(MakePassPhrase()) ) ); DBExec($DB, 'delete from DC2_passverification where regdate < date_sub( now(), interval 1 hour )'); return md5($hid); } // MakeVeriCode() function CheckVeriCode($node, $VeriCode) { global $DB; $Data = GetObject($DB, "select * from DC2_passverification where md5(id)=" . QuoteAndSlashes($node)); if ($VeriCode == '' || !$Data || !$Data['passphrase'] || ($VeriCode) != ($Data['passphrase'])) { return false; } else { return true; } } // CheckVeriCode($node, $VeriCode) ; function ImageVeriCode($hid, $ttfPath) { global $DB; $Data = GetObject($DB, "select * from DC2_passverification where md5(id)=" . QuoteAndSlashes($hid)); $string = $Data['passphrase']; $im = @imagecreatetruecolor(100, 32) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 0xE0, 0xE0, 0xE0); //D6DBDF $text_color[] = imagecolorallocate($im, 255, 0, 0); $text_color[] = imagecolorallocate($im, 0, 0xA0, 0); $text_color[] = imagecolorallocate($im, 0, 0, 255); $text_color[] = imagecolorallocate($im, 255, 0, 255); $text_color[] = imagecolorallocate($im, 0, 0xE0, 0xE0); $text_color[] = imagecolorallocate($im, 0xD0, 0xD0, 0); imagefilledrectangle($im, 0, 0, 99, 31, $background_color); // Set the enviroment variable for GD putenv('GDFONTPATH=' . realpath($ttfPath)); list($usec, $sec) = explode(' ', microtime()); mt_srand((float) $sec + ((float) $usec * 100000)); $cc = mt_rand(0, 5); for ($i = 0; $i < strlen($Data['passphrase']); $i++) { // size angle imagettftext($im, 14 + mt_rand(0, 5), 45 - mt_rand(0, 90), // X Y color 10 + 16 * $i /* +mt_rand(0,5) */, 25 /* 30-mt_rand(2,7) */, $text_color[($cc + $i) % 5], $_SERVER['DOCUMENT_ROOT'] . "/../verdana.ttf", iconv('cp1251', 'UTF-8', $Data['passphrase'][$i])); } header("Content-type: image/png"); imagepng($im); imagedestroy($im); } // ImageVeriCode function CountComments($ORIGINATOR_ID, $ORIGINATOR_TYPE = 'FORUM') { global $DB; $ORIGINATOR_ID = intval($ORIGINATOR_ID); $SQL = "select count(*) as cnt from AIV_COMMENTS where COMMENTS_ORIGINATOR_ID = '$ORIGINATOR_ID' and COMMENTS_ORIGINATOR_TYPE=" . QuoteAndSlashes($ORIGINATOR_TYPE); $result = GetObject($DB, $SQL); return $result["cnt"]; } function ErrorMessage($msg) { echo "$msg"; } function RuHyphen($text) { $RusA = "[абвгдеёжзийклмнопрстуфхцчшщъыьэюя]"; $RusV = "[аеёиоуыэюя]"; $RusN = "[бвгджзклмнпрстфхцчшщ]"; $RusX = "[йъь]"; $text = preg_replace("/($RusX)($RusA$RusA)/", "\\1­\\2", $text); $text = preg_replace("/($RusV)($RusV$RusA)/", "\\1­\\2", $text); $text = preg_replace("/($RusV$RusN)($RusN$RusV)/", "\\1­\\2", $text); $text = preg_replace("/($RusN$RusV)($RusN$RusV)/", "\\1­\\2", $text); $text = preg_replace("/($RusV$RusN)($RusN$RusN$RusV)/", "\\1­\\2", $text); $text = preg_replace("/($RusV$RusN$RusN)($RusN$RusN$RusV)/", "\\1­\\2", $text); return $text; } function StripTAGS($THEARTICLE) { return strip_tags($THEARTICLE); } function __Sanitize(&$a) { if (is_array($a)) { foreach ($a as $k => $v) { __Sanitize($a[$k]); } } else { $a = str_replace('<' . '?', '<?', $a); $a = str_replace('?' . '>', '?>', $a); $a = str_replace('<' . '%', '<%', $a); $a = str_replace('%' . '>', '%>', $a); $a = trim($a); } } function Sanitize(&$a) { if (!isCE()) { /* sanitize input for non admins */ __Sanitize($a); } } function HTMLCleaner($Data, $StripOther = true, $StripHeader = true, $StripStyles = true, $StripClass = true, $StripSpan = true, $StripEmptySpace = true, $StripFontTags = false ) { $NLSeparator = "___HTMLCleaner___NEW___LINE_" . date('YmgHis') . "__"; $buff = preg_replace("/[ ]{0,}[\n\r]{1,}[ ]{0,}/", "$NLSeparator", $Data); if ($StripHeader) { $buff = preg_replace("/]*>/i", "", $buff); $buff = str_ireplace("", "", $buff); $buff = str_ireplace("", "", $buff); $buff = str_ireplace("", "", $buff); $buff = preg_replace("/]*>/i", "", $buff); $buff = preg_replace("/]*>/i", "", $buff); $buff = preg_replace("/.*<\/head>/i", "", $buff); } if ($StripOther) { $buff = str_ireplace("", "", $buff); $buff = str_ireplace("", "", $buff); $buff = preg_replace("/]*>/i", "", $buff); $buff = preg_replace("/<\/o:smarttagtype[^>]*>/i", "", $buff); $buff = str_ireplace("", "", $buff); $buff = str_ireplace("", "", $buff); $buff = preg_replace("/<\?xml[^>]*>/i", "", $buff); $buff = preg_replace("/]*>/i", "", $buff); $buff = preg_replace("/<\/st1:[^>]*/i", "", $buff); $buff = preg_replace("/<\!--\[if \!supportLists\]-->/i", "", $buff); $buff = preg_replace("/<\!--\[endif\]-->/i", "", $buff); $buff = preg_replace("/]*\/>/i", "", $buff); $buff = preg_replace("/]*\/>/i", "", $buff); $buff = preg_replace("/]*>/i", "", $buff); $buff = preg_replace("/<\/skype[^>]*>/i", "", $buff); // // $buff = eregi_replace("", "", $buff); // $buff = eregi_replace("", "", $buff); // $buff = eregi_replace("", "", $buff); // $buff = eregi_replace("", "", $buff); // $buff = eregi_replace("", "", $buff); } if ($StripSpan) { $buff = preg_replace("/]*>/i", "", $buff); $buff = preg_replace("/<\/span[^>]*>/i", "", $buff); $buff = preg_replace("/]*>/i", "", $buff); $buff = preg_replace("/<\/div[^>]*>/i", "
", $buff); } if ($StripFontTags) { $buff = preg_replace("/]*>/i", "", $buff); $buff = preg_replace("/<\/font[^>]*>/i", "", $buff); } if ($StripStyles) { $buff = preg_replace("/]*>[^<]*<\/style>/i", "", $buff); $buff = preg_replace("/[ \n\r\t]*style='[^']*'/i", "", $buff); $buff = preg_replace("/[ \n\r\t]*style=\"[^\"]*\"/i", "", $buff); // $buff = preg_replace("/[ \n\r\t]*style=[^ ]*/i", "", $buff); $buff = preg_replace("/]*>/i", "", $buff); $buff = preg_replace("/<\/font[^>]*>/i", "", $buff); $buff = preg_replace("/]*>/i", "

", $buff); $buff = preg_replace("/<\!--.*?-->/i", "", $buff); $buff = preg_replace("/]*)>/i", "", $buff); } if ($StripClass) { $buff = preg_replace("/[ \n\r\t]+class=[^ >]*/i", "", $buff); $buff = preg_replace("/[ \n\r\t]+class=\"[^\"]*\"/i", "", $buff); $buff = preg_replace("/[ \n\r\t]+class='[^']*'/i", "", $buff); } if (strpos($buff, "

") !== false) { //

tags present, so let's try to do intelligent format $buff = str_ireplace($NLSeparator, "\n", $buff); if ($StripEmptySpace) { // echo _hs($buff); $buff = preg_replace("/

[\n]*<\/p>/i", "", $buff); } // $buff = str_ireplace ("

", "\n

", $buff); $buff = str_ireplace("

", "

\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("
    ", "
      \n", $buff); $buff = str_ireplace("
        ", "
          \n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("", "\n", $buff); $buff = str_ireplace("
          ", "
          \n", $buff); $buff = str_ireplace("", "\n", $buff); } else { // no

          tags, so insert newlines $buff = str_ireplace($NLSeparator, "\n", $buff); } $buff = preg_replace("/

          [\n]*

          /i", "

          ", $buff); $buff = preg_replace("/<\/p>[\n]*<\/p>/i", "

          ", $buff); $buff = preg_replace("/\n\n/", "\n", $buff); if ($StripEmptySpace) { $buff = preg_replace("/\ \;/i", " ", $buff); $buff = preg_replace("/[ ]+/", " ", $buff); $buff = preg_replace("/

          [ \n]*<\/p>/", "", $buff); $buff = preg_replace("/[ \n]*<\/b>/", "", $buff); $buff = preg_replace("/[ \n]*<\/i>/", "", $buff); $buff = preg_replace("/[ \n]*<\/u>/", "", $buff); $buff = preg_replace("/<\/b>[ \n]*/", "", $buff); $buff = preg_replace("/<\/i>[ \n]*/", "", $buff); $buff = preg_replace("/<\/strong>[ \n]*/", "", $buff); } // Anti HACK cleanups ;) if (!isCE()) { $buff = str_ireplace("<" . "?", "\n", $buff); $buff = str_ireplace("<" . "%", "\n", $buff); } return $buff; } // HTMLCleaner($Data, $StripOther=true, $StripHeader=true, $StripStyles=true, $StripClass=true, $StripSpan=true) function Transliterate($s) { $trans = array( "ье" => "ie", "ё" => "io", "Ё" => "IO", "й" => "j", "Й" => "J", "ц" => "tz", "Ц" => "TZ", "у" => "u", "У" => "U", "к" => "k", "К" => "K", "е" => "e", "Е" => "E", "н" => "n", "Н" => "N", "г" => "g", "Г" => "G", "ш" => "sh", "Ш" => "SH", "щ" => "shch", "Щ" => "SHCH", "з" => "z", "З" => "Z", "х" => "h", "Х" => "H", "ъ" => "", "Ъ" => "", "ф" => "f", "Ф" => "F", "ы" => "y", "Ы" => "Y", "в" => "v", "В" => "V", "а" => "a", "А" => "A", "п" => "p", "П" => "P", "р" => "r", "Р" => "R", "о" => "o", "О" => "O", "л" => "l", "Л" => "L", "д" => "d", "Д" => "D", "ж" => "zh", "Ж" => "ZH", "э" => "e", "Э" => "E", "я" => "ia", "Я" => "IA", "ч" => "ch", "Ч" => "CH", "с" => "s", "С" => "S", "м" => "m", "М" => "M", "и" => "i", "И" => "I", "т" => "t", "Т" => "T", "ь" => "", "Ь" => "", "б" => "b", "Б" => "B", "ю" => "iu", "Ю" => "IU" ); return strtr($s, $trans); } /** * returns _GET or _POST arg value specified by $argname * @param string $argname arg name * @param mixed $defaultVal default value * @param bool $toInt convert to int * @return mixed */ function GetArg($argname, $defaultVal = '', $toInt = false) { $arg = isset($_GET[$argname]) ? $_GET[$argname] : (isset($_POST[$argname]) ? $_POST[$argname] : $defaultVal); return $toInt ? intval($arg) : $arg; } /** * Rewritten by Nathan Codding - Feb 6, 2001. * - Goes through the given string, and replaces xxxx://yyyy with an HTML tag linking * to that URL * - Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML tag linking * to http://www.xxxx.yyyy[/zzzz] * - Goes through the given string, and replaces xxxx@yyyy with an HTML mailto: tag linking * to that email address * - Only matches these 2 patterns either after a space, or at the beginning of a line * * Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe * have it require something like xxxx@yyyy.zzzz or such. We'll see. */ function TranslateLinks($Text) { // pad it with a space so we can match things at the start of the 1st line. $ret = " " . $Text; // matches an "xxxx://yyyy" URL at the start of a line, or after a space. // xxxx can only be alpha characters. // yyyy is anything up to the first space, newline, or comma. $ret = preg_replace("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)#i", "\\1\\2://\\3", $ret); // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing // Must contain at least 2 dots. xxxx contains either alphanum, or "-" // yyyy contains either alphanum, "-", or "." // zzzz is optional.. will contain everything up to the first space, newline, or comma. // This is slightly restrictive - it's not going to match stuff like "forums.foo.com" // This is to keep it from getting annoying and matching stuff that's not meant to be a link. $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1www.\\2.\\3\\4", $ret); // matches an email@domain type address at the start of a line, or after a space. // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". $ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1\\2@\\3", $ret); // Remove our padding.. $ret = substr($ret, 1); return($ret); } function TextWrapper($Text, $ConvertLinks = true) { if ($ConvertLinks) { $Text = TranslateLinks($Text); } return nl2br($Text); // return $Text = nl2br( $Text ); // return wordwrap($Text, MAX_MESSAGE_TEXT_WIDTH, "
          ", 0); } // $auth_debug_mode=1; function dbg($reason) { global $auth_debug_mode; if ($auth_debug_mode) { echo "Reason:($reason)
          \n"; } } function SetPageNoCache() { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 return; } function FetchDate($dt, $DFormat = "%d-%m-%Y") { global $SLANG; $t = strtotime($dt); setlocale(LC_ALL, GetSiteConfig('DEFAULT_LOCALE_NAME', 'ru_RU.utf8')); date_default_timezone_set(GetSiteConfig('ServerDateFormatLocale', 'Europe/Moscow')); mb_internal_encoding("UTF-8"); $tdate = iconv('utf-8','windows-1251',strftime($DFormat, $t)); // some hack for russian dates ;) $search = array( 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь' ); $replace = array( 'Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря' ); $tdate = str_replace($search, $replace, $tdate); return $tdate; } function FixupURL($URL) { $URL = strip_tags($URL); $BadSyms = array('"', '<', '>', '\'', "'"); $URL = str_replace($BadSyms, '', $URL); if (strtolower(substr($URL, 0, 7)) == "http://") { } else if (strtolower(substr($URL, 0, 6)) == "ftp://") { } else { $URL = "http://" . $URL; } return $URL; } $dbg_timepoints = array(); $dbg_lasttimepoint = 0; function dbg_checktimepoint($msg = "") { global $dbg_lasttimepoint, $dbg_timepoints; $dbg_timepoints[$dbg_lasttimepoint++] = getmicrotime() . (($msg == "") ? "" : " " . $msg); } function dbg_printtimepoints() { global $dbg_mail, $dbg_lasttimepoint, $dbg_timepoints; if (isset($dbg_mail)) { dbg_checktimepoint("end..."); echo "

          ";
                  for ($i = 0; $i < $dbg_lasttimepoint; $i++) {
                      if (isset($dbg_timepoints[$i]))
                          echo "[$i] " . $dbg_timepoints[$i] . "\n";
                  }
                  echo "
          "; } } /* * * Returns the string name of the browser... */ function GetBrowserName() { global $HTTP_USER_AGENT; // Get the name the browser calls itself $Browser_Name = strtok($HTTP_USER_AGENT, "/"); // MSIE lies about its name if (ereg("MSIE", $HTTP_USER_AGENT)) { $Browser_Name = "MSIE"; } // Opera isn't completely honest, either ... // Modificaton by Chris Mospaw if (ereg("Opera", $HTTP_USER_AGENT)) { $Browser_Name = "Opera"; } return $Browser_Name; } // GetBrowserName function GetCountryName($ccode, $version = 2) { global $SLANG, $DB; if ($version == 2) { $ccode = intval($ccode); switch ($SLANG) { case "Ru": $SQL = "SELECT IF(r_name<>'',r_name,e_name) AS CName FROM Country2 WHERE cid=$ccode"; break; case "Fr": $SQL = "SELECT IF(f_name<>'',f_name,e_name) AS CName FROM Country2 WHERE cid=$ccode"; break; case "En": default: $SQL = "SELECT e_name AS CName FROM Country2 WHERE cid=$ccode"; break; } // echo $SQL . "
          "; $Data = GetObject($DB, $SQL); return $Data['CName']; } else { $SQL = "select cname, e_name, f_name, r_name from Country where ccode='" . addslashes($ccode) . "'"; $Data = GetObject($DB, $SQL); switch ($SLANG) { case "Ru": return ($Data['r_name'] != "") ? $Data['r_name'] : (($Data['e_name'] != "") ? $Data['e_name'] : $Data['cname']); case "Fr": return ($Data['f_name'] != "") ? $Data['f_name'] : (($Data['e_name'] != "") ? $Data['e_name'] : $Data['cname']); case "En": default: return ($Data['e_name'] != "") ? $Data['e_name'] : $Data['cname']; } } } // GetCountryName /* * * Treelogy Related functions */ function CallBackAction($ActionName, $ActionArg) { global $SITE_ADMIN_EMAIL; return "OK"; $to = $SITE_ADMIN_EMAIL; $buff = ""; $fp = fopen("http://" . $_SERVER[SERVER_NAME] . "/io/xmlget.php?A=$ActionName&ID=$ActionArg", "r"); $First = true; while (!feof($fp)) { $buff .= ($s = fgets($fp, 1024)); if ($First && ($s != "")) { $TransmitResult = ( strtoupper(trim($s)) == "OK" ); $First = false; } } fclose($fp); $buff = trim($buff); if (!$TransmitResult) { mailreply($to, "Callback action FAIL", "$ActionName:$ActionArg
          \ntransfer - FAIL:
          \n" . _hs($buff)); } else { mailreply($to, "Callback action OK", "$ActionName:$ActionArg
          \ntransfer - OK:
          \n" . _hs($buff)); } return $buff; } function Logger($module, $msg = "") { $fp = fopen("/tmp/registrationwrapper.log", "a+"); fputs($fp, date("Y-m-d H:i:s") . " " . $module . " " . $_SERVER["REMOTE_ADDR"] . " " . ($_SERVER["HTTP_X_FORWARDED_FOR"] != "" ? $_SERVER["HTTP_X_FORWARDED_FOR"] : "direct") . " " . $_GET["A"] . " " . intval($_GET["ID"]) . " " . $msg . "\n" ); fclose($fp); } /* * ******************************** * * VIAC * ******************************** */ // Account history records... function AddAHRecord($UserID, $AccountDelta, $OperationDescription, $bc = 'balance') { global $DB; $Data['ah_userID'] = intval($UserID); $Data['ah_timestamp'] = "now()"; $Data['ah_bc'] = QuoteAndSlashes($bc == 'credit' ? 'credit' : 'balance' ); $Data['ah_delta'] = QuoteAndSlashes($AccountDelta); $Data['ah_comment'] = QuoteAndSlashes($OperationDescription); DBInsert($DB, $TableName = "AccountHistory", $Data); } // AddAHRecord($UserID, $AccountDelta, $OperationDescription, $bc='balance') function DefineSiteLang() { global $SLANG_TEMPLATE_SUFFIX, $SLANG, $HTTP_SESSION_VARS, $DEFAULT_LANG_SET, $COOKIE_DOMAIN; if (!isset($_GET["SLANG"])) $_GET["SLANG"] = "*"; switch ($_GET["SLANG"]) { case "Ru": case "Fr": case "En": setcookie("SLANG", $_GET["SLANG"], time() + (60 * 60 * 24 * 31 * 12), "/", $COOKIE_DOMAIN); $SLANG = $_GET["SLANG"]; break; default: $SLANG = isset($_COOKIE["SLANG"]) ? $_COOKIE["SLANG"] : DEFAULT_SITE_LANG; break; } switch ($SLANG) { case "Ru": case "Fr": case "En": break; default: $SLANG = DEFAULT_SITE_LANG; setcookie("SLANG", $SLANG, time() + (60 * 60 * 24 * 31 * 12), "/", $COOKIE_DOMAIN); break; } $SLANG_TEMPLATE_SUFFIX = "_" . $SLANG; } // DefineSiteLang() function SetPageCharsetAndLang(&$DEFAULT_CHARSET, &$DEFAULT_LANGUAGE) { global $HTTP_SESSION_VARS, $SLANG; switch ($SLANG) { case "Ru": $DEFAULT_CHARSET = "windows-1251"; $DEFAULT_LANGUAGE = "ru"; break; case "Fr": $DEFAULT_CHARSET = "windows-1250"; $DEFAULT_LANGUAGE = "fr"; break; case "En": $DEFAULT_CHARSET = "windows-1250"; $DEFAULT_LANGUAGE = "en"; break; break; default: $SLANG = DEFAULT_SITE_LANG; $DEFAULT_CHARSET = DEFAULT_SITE_CHARSET; $DEFAULT_LANGUAGE = DEFAULT_SITE_LANG_HTML; break; } header('Content-Type: text/html; charset=' . $DEFAULT_CHARSET); } function RemoveArgFromURL($URL, $Arg) { while ($Pos = strpos($URL, "$Arg=")) { if ($Pos) { if ($URL[$Pos - 1] == "&") { $Pos--; } $nMax = strlen($URL); $nEndPos = strpos($URL, "&", $Pos + 1); if ($nEndPos === false) { $URL = substr($URL, 0, $Pos); } else { $URL = str_replace(substr($URL, $Pos, $nEndPos - $Pos), '', $URL); } } } return $URL; } if (!function_exists('http_build_query')) { function http_build_query($formdata, $numeric_prefix = null, $key = null) { $res = array(); // echo '

          '; print_r($formdata); foreach ((array) $formdata as $k => $v) { $tmp_key = urlencode(is_int($k) ? $numeric_prefix . $k : $k); if ($key) $tmp_key = $key . '[' . $tmp_key . ']'; if (is_array($v) || is_object($v)) { $res[] = http_build_query($v, null /* or $numeric_prefix if you want to add numeric_prefix to all indexes in array */, $tmp_key); } else { $res[] = $tmp_key . "=" . urlencode($v); } /* If you want, you can write this as one string: $res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) ); */ } $separator = ini_get('arg_separator.output'); return implode($separator = '&', $res); } } function LangLink($OptArgs = false) { global $_SERVER, $THE_SITE_ROOT; if (!DYNACONT_MULTILANG) { return ""; } $Self = RemoveArgFromURL($_SERVER["REQUEST_URI"], "SLANG"); if (strpos($Self, "?") === false) { $ParmName = "?SLANG="; } else { $ParmName = "&SLANG="; } if ( $OptArgs ) { if( is_array($OptArgs) ){ $OA = ''; foreach($OptArgs as $k=>$v){ $OA .= '&'.$k.'='.$v; } $OptArgs = $OA; }else{ $OptArgs = '&' . $OptArgs; } } $DATA = ''; if(GetSiteConfig('FrInterface', 0)){ $DATA .= <<Français EOD; } $DATA .= <<Русский язык English EOD; return $DATA; } // LangLink() function _hs($s) { $opts = ENT_COMPAT ; if( defined('ENT_HTML401') ){ $opts = $opts | ENT_HTML401; } return htmlspecialchars($s, $opts, 'cp1251'); } /////////////////////////////// SITE LANG: Init It! //////////////////////////////////////// // session_name ($SITE_SESSION_NAME); // session_start(); DefineSiteLang(); $DEFAULT_CHARSET = 'windows-1251'; $DEFAULT_LANGUAGE = 'Ru'; SetPageCharsetAndLang($DEFAULT_CHARSET, $DEFAULT_LANGUAGE); if ( isset($_COOKIE['komykakID']) && $_COOKIE['komykakID'] != '' && strlen($_COOKIE['komykakID']) == 32) { setcookie('komykakID', $_COOKIE['komykakID'], time() + 60 * 60 * 24 * 30, '/'); $komykakID = $_COOKIE['komykakID']; } else { $komykakID = $_COOKIE['komykakID'] = md5(time() . rand() . $_SERVER['REMOTE_ADDR']); setcookie('komykakID', $komykakID, time() + 60 * 60 * 24 * 30, '/'); } //////////////////////////////// DB: Init It! //////////////////////////////////////// require_once "DBForms.php3"; $DB = DBInit(); if (!$DB) { die("Enable to connect to the MAIN DATABASE"); } require_once $_SERVER['DOCUMENT_ROOT'] . '/sys/modules/config/DCC.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/sys/modules/FAQ/FAQclass.php'; // Lang constants if ($SLANG == "Ru") { define('CD_TXT_DISCLAIMER_TITLE', "ПРАВОВАЯ ОГОВОРКА"); define('CD_TXT_DISCLAIMER', "Настоящий документ создан при поддержке ###SITE_DEVELOPER_COMPANY_NAME###. За содержание данного документа полностью отвечает его создатель. Содержание ни в коей мере не отражает официальную позицию ###SITE_DEVELOPER_COMPANY_NAME###."); } else { define('CD_TXT_DISCLAIMER_TITLE', "DISCLAIMER"); define('CD_TXT_DISCLAIMER', "This publication has been produced with the assistance of the ###SITE_DEVELOPER_COMPANY_NAME###. The contents of this publication is the sole responsibility of the author of this document and can in no way be taken to reflect the views of the ###SITE_DEVELOPER_COMPANY_NAME###"); } if ($SLANG == "Ru") { define('NEWS_TXT_TITLE', "Архив новостей"); define('NEWS_TXT_TITLE_ARCH', "Архив"); } else if ($SLANG == "Fr") { define('NEWS_TXT_TITLE', "Nouvelle"); define('NEWS_TXT_TITLE_ARCH', "Archives"); } else { define('NEWS_TXT_TITLE', "News archive"); define('NEWS_TXT_TITLE_ARCH', "Archive"); } if ($SLANG == "Ru") { $monname[1] = "Январь"; $monname[2] = "Февраль"; $monname[3] = "Март"; $monname[4] = "Апрель"; $monname[5] = "Май"; $monname[6] = "Июнь"; $monname[7] = "Июль"; $monname[8] = "Август"; $monname[9] = "Сентябрь"; $monname[10] = "Октябрь"; $monname[11] = "Ноябрь"; $monname[12] = "Декабрь"; } else { $monname[1] = "January"; $monname[2] = "Febrary"; $monname[3] = "March"; $monname[4] = "April"; $monname[5] = "May"; $monname[6] = "June"; $monname[7] = "July"; $monname[8] = "August"; $monname[9] = "September"; $monname[10] = "October"; $monname[11] = "November"; $monname[12] = "December"; } ?>