$p_w) { $len = strlen($str_word)+strlen($p_w); //$str_word .= " ".strlen($p_w)." ".$cnt_chars; if ($len <= $cnt_chars) { $str_word .= " ".$p_w; } else { $flag_big = true; break; } } } if ($flag_big) { $str_word .= "..."; } return trim($str_word); } function get_r_date($ts=0, $lang='ru') { if ($lang == 'en') { $mon_arr = array(1 => "January ", 2 => "February ", 3 => "March ", 4 => "April ", 5 => "May ", 6 => "June ", 7 => "July ", 8 => "August ", 9 => "September ", 10 => "October ", 11 => "November ", 12 => "December"); } else { $mon_arr = array(1 => "января", 2 => "февраля", 3 => "марта", 4 => "апреля", 5 => "мая", 6 => "июня", 7 => "июля", 8 => "августа", 9 => "сентября", 10 => "октября", 11 => "ноября", 12 => "декабря"); } $s = date("j", $ts)." ".$mon_arr[date("n", $ts)]." ".date("Y", $ts); return $s; } function get_r_date_min($ts=0, $lang='ru') { if ($lang == 'en') { $mon_arr = array(1 => "January ", 2 => "February ", 3 => "March ", 4 => "April ", 5 => "May ", 6 => "June ", 7 => "July ", 8 => "August ", 9 => "September ", 10 => "October ", 11 => "November ", 12 => "December"); } else { $mon_arr = array(1 => "Январь", 2 => "Февраль", 3 => "Март", 4 => "Апрель", 5 => "Май", 6 => "Июнь", 7 => "Июль", 8 => "Август", 9 => "Сентябрь", 10 => "Октябрь", 11 => "Ноябрь", 12 => "Декабрь"); } $s = $mon_arr[date("n", $ts)]." ".date("Y", $ts); return $s; } function get_date_small($ts=0) { if (date("j", $ts) < 10) { $s = "0".date("j", $ts).".".date("m", $ts); } else { $s = date("j", $ts).".".date("m", $ts); } return $s; } function get_r_date_time($ts=0) { $mon_arr = array(1 => "января", 2 => "февраля", 3 => "марта", 4 => "апреля", 5 => "мая", 6 => "июня", 7 => "июля", 8 => "августа", 9 => "сентября", 10 => "октября", 11 => "ноября", 12 => "декабря"); //$mon_arr = array(1 => "Января", 2 => "Февраля", 3 => "Марта", 4 => "Апреля", 5 => "Мая", 6 => "Июня", 7 => "Июля", 8 => "Августа", 9 => "Сентября", 10 => "Октября", 11 => "Ноября", 12 => "Декабря"); //$s = date("j", $ts)." ".$mon_arr[date("n", $ts)]." ".date("Y", $ts)." ".date("H", $ts).":".date("i", $ts); $s = date("j", $ts)." ".$mon_arr[date("n", $ts)].", ".date("H", $ts).":".date("i", $ts); return $s; } function get_r_time($ts=0) { $s = date("H", $ts).":".date("i", $ts); return $s; } function get_time($ts=0) { $s = date("H", $ts).":".date("i", $ts); return $s; } function get_ext_file($file_name) { $pos_dot = strrpos($file_name, "."); $ext = substr($file_name, $pos_dot+1); return $ext; } function get_lang_date_time($ts = 0, $lang = 'ru') { if ($lang == 'en') { $mon_arr = array(1 => "January ", 2 => "February ", 3 => "March ", 4 => "April ", 5 => "May ", 6 => "June ", 7 => "July ", 8 => "August ", 9 => "September ", 10 => "October ", 11 => "November ", 12 => "December"); } else if ($lang == 'kz') { $mon_arr = array(1 => "қаңтар ", 2 => "ақпан ", 3 => "наурыз ", 4 => "сәуір ", 5 => "мамыр ", 6 => "маусым ", 7 => "шілде ", 8 => "тамыз ", 9 => "қыркүйек ", 10 => "қазан ", 11 => "қараша ", 12 => "желтоқсан"); } else { $mon_arr = array(1 => "января", 2 => "февраля", 3 => "марта", 4 => "апреля", 5 => "мая", 6 => "июня", 7 => "июля", 8 => "августа", 9 => "сентября", 10 => "октября", 11 => "ноября", 12 => "декабря"); } $s = date("j", $ts)." ".$mon_arr[date("n", $ts)]." ".date("Y", $ts).", ".date("H", $ts).":".date("i", $ts);; return $s; } function get_name_not_ext($file_name) { $path_parts = pathinfo($file_name); $pos_dot = strrpos($path_parts["basename"], "."); $name = substr($file_name, 0, $pos_dot); return $name; } function my_resize($in_file, $new_name, $ext, $max_size) { $error_code = 1; $size = getimagesize($in_file); $in_width = $size[0]; $in_height = $size[1]; if (!$in_width || !$in_height) { return $error_code; } //echo("
Orig size:".$in_width."x".$in_height.""); if ($in_width > $max_size || $in_height > $max_size) { if ($in_width > $in_height) { $new_width = $max_size; $new_height = ($new_width / $in_width) * $in_height; } else { $new_height = $max_size; $new_width = ($new_height / $in_height) * $in_width; } } else { //echo $in_file.">>>".$new_name; copy($in_file, $new_name); return 0; /* $new_width = $in_width; $new_height = $in_height; */ } switch($ext) { case 'gif': $im1 = imagecreatefromgif($in_file); break; case 'jpg': $im1 = imagecreatefromjpeg($in_file); break; case 'png': $im1 = imagecreatefrompng($in_file); break; } //imagegif($im1,$new_name); //$im1 = @imagecreatefromstring($in_file); $im2 = @imagecreatetruecolor($new_width, $new_height); if (!$im1 || !$im2) { return $error_code; } $res = imagecopyresampled($im2, $im1, '0', '0', '0', '0', $new_width, $new_height, $in_width, $in_height); if (!$res) { return $error_code; } switch($ext) { case 'gif': imagegif($im2,$new_name); break; case 'jpg': imagejpeg($im2,$new_name); break; case 'png': imagepng($im2,$new_name); break; } } function my_resize_width($in_file, $new_name, $ext, $max_size, $corner_radius = false) { $error_code = 1; $size = getimagesize($in_file); $in_width = $size[0]; $in_height = $size[1]; if (!$in_width || !$in_height) { return $error_code; } //echo("
Orig size:".$in_width."x".$in_height.""); if ($in_width > $max_size) { $new_width = $max_size; $new_height = ($new_width / $in_width) * $in_height; } else { //echo $in_file.">>>".$new_name; copy($in_file, $new_name); return 0; /* $new_width = $in_width; $new_height = $in_height; */ } switch($ext) { case 'gif': $im1 = imagecreatefromgif($in_file); break; case 'jpg': $im1 = imagecreatefromjpeg($in_file); break; case 'png': $im1 = imagecreatefrompng($in_file); break; } //imagegif($im1,$new_name); //$im1 = @imagecreatefromstring($in_file); if ($corner_radius) { $endsize = $corner_radius; $startsize = $endsize*3-1; $arcsize = $startsize*2+1; } $im2 = @imagecreatetruecolor($new_width, $new_height); if (!$im1 || !$im2) { return $error_code; } $res = imagecopyresampled($im2, $im1, '0', '0', '0', '0', $new_width, $new_height, $in_width, $in_height); if (!$res) { return $error_code; } switch($ext) { case 'gif': imagegif($im2,$new_name); break; case 'jpg': imagejpeg($im2,$new_name,85); break; case 'png': imagepng($im2,$new_name); break; } } function my_resize_height($in_file, $new_name, $ext, $max_size, $corner_radius = false) { $error_code = 1; $size = getimagesize($in_file); $in_width = $size[0]; $in_height = $size[1]; if (!$in_width || !$in_height) { return $error_code; } //echo("
Orig size:".$in_width."x".$in_height.""); if ($in_height > $max_size) { $new_height = $max_size; $new_width = ($new_height / $in_height) * $in_width; } else { //echo $in_file.">>>".$new_name; copy($in_file, $new_name); return 0; /* $new_width = $in_width; $new_height = $in_height; */ } switch($ext) { case 'gif': $im1 = imagecreatefromgif($in_file); break; case 'jpg': $im1 = imagecreatefromjpeg($in_file); break; case 'png': $im1 = imagecreatefrompng($in_file); break; } //imagegif($im1,$new_name); //$im1 = @imagecreatefromstring($in_file); if ($corner_radius) { $endsize = $corner_radius; $startsize = $endsize*3-1; $arcsize = $startsize*2+1; } $im2 = @imagecreatetruecolor($new_width, $new_height); if (!$im1 || !$im2) { return $error_code; } $res = imagecopyresampled($im2, $im1, '0', '0', '0', '0', $new_width, $new_height, $in_width, $in_height); if (!$res) { return $error_code; } switch($ext) { case 'gif': imagegif($im2,$new_name); break; case 'jpg': imagejpeg($im2,$new_name,85); break; case 'png': imagepng($im2,$new_name); break; } } //Специальный ресайз, стреч по max_size_w и обрезает снизу по max_size_h function my_resize_special($in_file, $new_name, $ext, $max_size_w, $max_size_h) { $error_code = 1; $size = getimagesize($in_file); $in_width = $size[0]; $in_height = $size[1]; if (!$in_width || !$in_height) { return $error_code; } //echo("
Orig size:".$in_width."x".$in_height.""); if ($in_width == $max_size_w && $in_height == $max_size_h) { copy($in_file, $new_name); return 0; } else { $new_width = $max_size_w; $new_height = ($new_width / $in_width) * $in_height; } switch($ext) { case 'gif': $im1 = imagecreatefromgif($in_file); break; case 'jpg': $im1 = imagecreatefromjpeg($in_file); break; case 'png': $im1 = imagecreatefrompng($in_file); break; } $im2 = @imagecreatetruecolor($new_width, $new_height); $im3 = @imagecreatetruecolor($max_size_w, $max_size_h); if (!$im1 || !$im2 || !$im3) { return $error_code; } //Стречем сделаем нужный п ширине $res = imagecopyresampled($im2, $im1, '0', '0', '0', '0', $new_width, $new_height, $in_width, $in_height); if (!$res) { return $error_code; } //Скопируем нужный верхний кусочек картинки отбросив нижнюю часть $res = imagecopy($im3, $im2, 0, 0, 0, 0, $max_size_w, $max_size_h); if (!$res) { return $error_code; } $handle = fopen($new_name, 'w'); fclose($handle); switch($ext) { case 'gif': imagegif($im3,$new_name); break; case 'jpg': imagejpeg($im3,$new_name,85); break; case 'png': imagepng($im3,$new_name); break; } } function check_input_email($email = '') { $mes = ""; if ($email != "") { if (!preg_match ("/(\S+)\@(\S+)\.(\S+)/",$email)) { $mes .= "Неверный синтаксис email."; } elseif (strchr ($email,"'") || strchr ($email,'"') || strchr ($email,"/") || strchr ($email,"&") || strchr ($email,",") || strchr ($email,";") || strchr ($email,"\\")) { $mes .= "Запрещенный символ в строке E-mail."; } } else { $mes .= "E-mail отсутствует."; } return $mes; } function is_parsed($body) { $tree_xml = "".stripslashes($body).""; $xsl_file = str_replace("//", "/", $_SERVER["DOCUMENT_ROOT"]."/_symp/_xslt/_adm/head_adm.xsl"); $xsl = new DOMDocument; $xsl->load($xsl_file); // Load the XML source //set_error_handler('HandleXmlError'); $xml = new DOMDocument; $res = $xml->loadXML($tree_xml); if (!$res) { return false; } restore_error_handler(); // Configure the transformer $proc = new XSLTProcessor; $proc->importStyleSheet($xsl); // attach the xsl rules $valid_html = $proc->transformToXML($xml); if ($valid_html === false) { return false; } else { return true; } } /* function HandleXmlError($errno, $errstr, $errfile, $errline) { if ($errno==E_WARNING && (substr_count($errstr,"DOMDocument::loadXML()")>0)) { return true; } else { return false; } } function is_parsed($body) { $xml = "".stripslashes($body).""; $xslt = "/_symp/_xslt/_adm/head_adm.xsl"; $xslt = str_replace("//", "/", $_SERVER["DOCUMENT_ROOT"] . $xslt); $xslt_filename = basename($xslt); $xslt_basedir = "file://".dirname($xslt)."/"; $xh = xslt_create(); xslt_set_base($xh, $xslt_basedir); // XSL Path $arguments = array("/_xml" => $xml); $valid_html = @xslt_process($xh, "arg:/_xml", $xslt_basedir."/".$xslt_filename, NULL, $arguments); if ($valid_html) { return true; } else { return false; } } */ /* function mailer($to, $subject, $message) { $message = str_replace('№', 'No', $message); $message = str_replace('«', '«', $message); $message = str_replace('»', '»', $message); $message = ' '.convert_cyr_string($message,"w","k").' '; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=KOI8-R\r\n"; $headers .= "From: ".P_HEAD_MAIL." <".P_HEAD_MAIL.">\r\n"; //print $message; return @mail($to, convert_cyr_string($subject,"w","k"), $message, $headers); } */ function mailer($to, $subject, $message) { $message = ' '.$message.' '; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=utf-8\r\n"; $headers .= "From: ".P_HEAD_MAIL." <".P_HEAD_MAIL.">\r\n"; //print wordwrap($message, 76, "\r\n", 0); return @mail($to, $subject, wordwrap($message, 76, "\r\n", 0), $headers); } function mailer_no_wordwrap($to, $subject, $message) { $message = ' '.$message.' '; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=utf-8\r\n"; $headers .= "From: ".P_HEAD_MAIL." <".P_HEAD_MAIL.">\r\n"; //print wordwrap($message, 76, "\r\n", 0); return @mail($to, $subject, $message, $headers); } /* function my_chunk_split($in_str) { $size = 75; $out_str = ""; $start_pos = 0; $stop_pos = 0; while ($start_pos <= strlen($in_str)) { $temp_str = ""; $new_size = $size; $temp_str = substr($in_str, $start_pos, $new_size); $space_pos = strrpos($temp_str, " "); if ($space_num !== false) { $new_size = $space_pos; $temp_str = substr($in_str, $start_pos, $new_size); } $out_str .= $temp_str."\r\n"; $start_pos = $new_size + 1; } return $out_str; } */ function get_x_ip() { if (getenv('HTTP_X_FORWARDED_FOR')) { $str_ip = getenv('HTTP_X_FORWARDED_FOR'); } else if (getenv('HTTP_X_FORWARDED')) { $str_ip = getenv('HTTP_X_FORWARDED'); } else if (getenv('HTTP_FORWARDED_FOR')) { $str_ip = getenv('HTTP_FORWARDED_FOR'); } else if (getenv('HTTP_FORWARDED')) { $str_ip = getenv('HTTP_FORWARDED'); } else { $str_ip = ""; } return $str_ip; } function select_url($text, $class = '') { $lower_text = strtolower($text); $orign_text = $text; if ($class){ $css = ' class="'.$css.'"'; } else { $css = ''; } $sfind[] = 'http://'; $sfind[] = 'ftp://'; $spec = "href="; $efind[] = "\n"; $efind[] = "\t"; $efind[] = "\r"; $efind[] = "<"; //tag $efind[] = " "; $flag_find = 1; $last_p2 = 0; while ($flag_find == 1){ //найдем первый символ $p1 = strlen($lower_text); $pos = 0; foreach($sfind as $value){ $plus_next = 0; do { $back = false; $pos = strpos($lower_text, $value, $last_p2 + $plus_next); if ($pos !== false && $pos <= $p1){ $sback = substr($lower_text, $pos-strlen($spec)-2, strlen($spec)+2); //echo 'sback = "'.$sback.'"
'; $back = strpos($sback, $spec); //echo 'back = '.$back.'
'; if ($back === false){ $p1 = $pos; } } // echo 'back = '.$back.'
'; $plus_next = $pos - $last_p2 + 1; } while($back !== false); } //echo 'p1 = '.$p1.'
'; //найдем последний символ $p2 = strlen($lower_text); $pos = 0; foreach($efind as $value){ $pos = strpos($lower_text, $value, $p1); if ($pos !== false && $pos <= $p2) { $p2 = $pos; } } //echo 'p2 = '.$p2.'
'; if ($p1 == strlen($lower_text)){ $flag_find = 0; } else { $one_flag = 1; if ($p2 == 0 || $p2 === false){ $p2 = strlen($lower_text); } $out_text .= substr($orign_text, $last_p2, $p1-$last_p2); $href = substr($orign_text, $p1, $p2-$p1); // echo 'href - '.$href.'
'; $out_text .= ''.trim($href).''; //$in_text = substr($in_text, $p2); //echo $in_text.'
'; $flag_find = 1; $last_p2 = $p2; } } if ($one_flag) { $out_text .= substr($orign_text, $last_p2); } else { $out_text = $text; } return trim($out_text); } function cyr_to_en($str) { $in_str = strtolower($str); $in_str = str_replace("а", "a", $in_str); $in_str = str_replace("б", "b", $in_str); $in_str = str_replace("в", "v", $in_str); $in_str = str_replace("г", "g", $in_str); $in_str = str_replace("д", "d", $in_str); $in_str = str_replace("е", "e", $in_str); $in_str = str_replace("ё", "io", $in_str); $in_str = str_replace("ж", "j", $in_str); $in_str = str_replace("з", "z", $in_str); $in_str = str_replace("и", "i", $in_str); $in_str = str_replace("й", "ii", $in_str); $in_str = str_replace("к", "k", $in_str); $in_str = str_replace("л", "l", $in_str); $in_str = str_replace("м", "m", $in_str); $in_str = str_replace("н", "n", $in_str); $in_str = str_replace("о", "o", $in_str); $in_str = str_replace("п", "p", $in_str); $in_str = str_replace("р", "r", $in_str); $in_str = str_replace("с", "s", $in_str); $in_str = str_replace("т", "t", $in_str); $in_str = str_replace("у", "u", $in_str); $in_str = str_replace("ф", "f", $in_str); $in_str = str_replace("х", "h", $in_str); $in_str = str_replace("ц", "c", $in_str); $in_str = str_replace("ч", "ch", $in_str); $in_str = str_replace("ш", "sh", $in_str); $in_str = str_replace("щ", "sh", $in_str); $in_str = str_replace("ъ", "", $in_str); $in_str = str_replace("ы", "i", $in_str); $in_str = str_replace("ь", "", $in_str); $in_str = str_replace("э", "e", $in_str); $in_str = str_replace("ю", "ju", $in_str); $in_str = str_replace("я", "ja", $in_str); return $in_str; } function str2mail($str) { return '=?utf-8?B?'.base64_encode($str).'?='; } function replace_links($text) { $text = ereg_replace("[a-zA-Z]+://([.]?[a-zA-Z0-9_/-])*", "\\0", $text); $text = ereg_replace("(^| )(www([.]?[a-zA-Z0-9_/-])*)", "\\1\\2", $text); return $text; } function cyr_count($in_number, $cyr_type1, $cyr_type2, $cyr_type3) { if (intval(substr($in_number,-2,2)) >= 10 && intval(substr($in_number,-2,2)) <= 14) { $cnt_des = 0; } else { $cnt_des = intval(substr($in_number,-1,1)); } switch ($cnt_des) { case 1: $cnt_str = $cyr_type1; break; case 2: case 3: case 4: $cnt_str = $cyr_type2; break; case 5: case 6: case 7: case 8: case 9: case 0: $cnt_str = $cyr_type3; break; default: $cnt_str = ""; } return $cnt_str; } function date_i18n($format, $timestamp, $sel_lang = 'en') { $translation_ru = array( "am" => "дп", "pm" => "пп", "AM" => "ДП", "PM" => "ПП", "Monday" => "Понедельник", "Mon" => "Пн", "Tuesday" => "Вторник", "Tue" => "Вт", "Wednesday" => "Среда", "Wed" => "Ср", "Thursday" => "Четверг", "Thu" => "Чт", "Friday" => "Пятница", "Fri" => "Пт", "Saturday" => "Суббота", "Sat" => "Сб", "Sunday" => "Воскресенье", "Sun" => "Вс", "January" => "Январь", "Jan" => "янв", "February" => "Февраль", "Feb" => "фев", "March" => "Март", "Mar" => "мар", "April" => "Апрель", "Apr" => "апр", "May" => "Май", "May" => "Май", "June" => "Июнь", "Jun" => "июн", "July" => "Июль", "Jul" => "июл", "August" => "Август", "Aug" => "авг", "September" => "Сентябрь", "Sep" => "сен", "October" => "Октябрь", "Oct" => "окт", "November" => "Ноябрь", "Nov" => "ноя", "December" => "Декабрь", "Dec" => "дек", "st" => "ое", "nd" => "ое", "rd" => "е", "th" => "ое", ); $translation_kz = array( "am" => "тд", "pm" => "тк", "AM" => "ТД", "PM" => "ТК", "Monday" => "Дүйсенбі", "Mon" => "Дс", "Tuesday" => "Бейсенбі", "Tue" => "Бс", "Wednesday" => "Сәрсенбі", "Wed" => "Ср", "Thursday" => "Сейсенбі", "Thu" => "Сс", "Friday" => "Жұма", "Fri" => "Жм", "Saturday" => "Сенбі", "Sat" => "Сн", "Sunday" => "Жексенбі", "Sun" => "Жк", "January" => "қаңтар", "Jan" => "қаң", "February" => "ақпан", "Feb" => "ақп", "March" => "наурыз", "Mar" => "нау", "April" => "сәуір", "Apr" => "сәу", "May" => "мамыр", "May" => "мамыр", "June" => "маусым", "Jun" => "мау", "July" => "шілде", "Jul" => "шіл", "August" => "тамыз", "Aug" => "там", "September" => "қыркүйек", "Sep" => "қырк", "October" => "қазан", "Oct" => "қаз", "November" => "қараша", "Nov" => "қар", "December" => "желтоқсан", "Dec" => "желт", "st" => "ші", "nd" => "ші", "rd" => "ші", "th" => "ші", ); switch ($sel_lang) { default: return date($format, $timestamp); break; case 'ru': case 'Ru': case 'RU': case 'rus': case 'Rus': case 'RUS': return strtr(date($format, $timestamp), $translation_ru); break; case 'kz': case 'Kz': case 'Kz': case 'kaz': case 'Kaz': case 'KAZ': return strtr(date($format, $timestamp), $translation_kz); break; } } // date_i18n function date_i18n_2($format, $timestamp, $sel_lang = 'en') { $translation_ru = array( "am" => "дп", "pm" => "пп", "AM" => "ДП", "PM" => "ПП", "Monday" => "Понедельник", "Mon" => "Пн", "Tuesday" => "Вторник", "Tue" => "Вт", "Wednesday" => "Среда", "Wed" => "Ср", "Thursday" => "Четверг", "Thu" => "Чт", "Friday" => "Пятница", "Fri" => "Пт", "Saturday" => "Суббота", "Sat" => "Сб", "Sunday" => "Воскресенье", "Sun" => "Вс", "January" => "Января", "Jan" => "янв", "February" => "Февраля", "Feb" => "фев", "March" => "Марта", "Mar" => "мар", "April" => "Апреля", "Apr" => "апр", "May" => "Май", "May" => "Май", "June" => "Июня", "Jun" => "июн", "July" => "Июля", "Jul" => "июл", "August" => "Августа", "Aug" => "авг", "September" => "Сентября", "Sep" => "сен", "October" => "Октября", "Oct" => "окт", "November" => "Ноября", "Nov" => "ноя", "December" => "Декабря", "Dec" => "дек", "st" => "ое", "nd" => "ое", "rd" => "е", "th" => "ое", ); $translation_kz = array( "am" => "тд", "pm" => "тк", "AM" => "ТД", "PM" => "ТК", "Monday" => "Дүйсенбі", "Mon" => "Дс", "Tuesday" => "Бейсенбі", "Tue" => "Бс", "Wednesday" => "Сәрсенбі", "Wed" => "Ср", "Thursday" => "Сейсенбі", "Thu" => "Сс", "Friday" => "Жұма", "Fri" => "Жм", "Saturday" => "Сенбі", "Sat" => "Сн", "Sunday" => "Жексенбі", "Sun" => "Жк", "January" => "қаңтар", "Jan" => "қаң", "February" => "ақпан", "Feb" => "ақп", "March" => "наурыз", "Mar" => "нау", "April" => "сәуір", "Apr" => "сәу", "May" => "мамыр", "May" => "мамыр", "June" => "маусым", "Jun" => "мау", "July" => "шілде", "Jul" => "шіл", "August" => "тамыз", "Aug" => "там", "September" => "қыркүйек", "Sep" => "қырк", "October" => "қазан", "Oct" => "қаз", "November" => "қараша", "Nov" => "қар", "December" => "желтоқсан", "Dec" => "желт", "st" => "ші", "nd" => "ші", "rd" => "ші", "th" => "ші", ); switch ($sel_lang) { default: return date($format, $timestamp); break; case 'ru': case 'Ru': case 'RU': case 'rus': case 'Rus': case 'RUS': return strtr(date($format, $timestamp), $translation_ru); break; case 'kz': case 'Kz': case 'Kz': case 'kaz': case 'Kaz': case 'KAZ': return strtr(date($format, $timestamp), $translation_kz); break; } } // date_i18n_2 /** * Получает инфоблоки по $const_name и возвращает в массив. Если такой константы нет, возвращает массив с одним пустым полем или с $tmp_str * @param string $const_name Имя константы * @param string $lang Язык блока * @param string $tmp_str Строка, если константы нет. По умолчанию "" * @param int $shuffle Перемешивать ли массив. По умолчанию 1 * @return array Массив со значениями * */ function shuffle_blocks($const_name, $lang="ru", $tmp_str = "", $shuffle = 1) { $array = array(); $infoSQL = "SELECT * FROM info_block WHERE const_name LIKE '{$const_name}' and lang = '{$lang}' and flag_delete = '0'"; $info_qRS = mysql_query($infoSQL); if( mysql_num_rows($info_qRS) ) { while($info_row = mysql_fetch_object($info_qRS)) { $array[] = $info_row; } } else { $array[] = $tmp_str; } if( $shuffle == 1 ) shuffle($array); return $array; } ?> $h) { if ($k < 16) { $base[$k] = ($h ^ $i_l) >> ($k % 2); } else { $base[$k] = ($h ^ $i_r) >> ($k % 4); } } if ($flag == "encrypt") { $arr_password = array(); for ($i = 0; $i < strlen($password); $i+=4) { $b4 = ord($password[$i+3]) << 24; $b3 = ord($password[$i+2]) << 16; $b2 = ord($password[$i+1]) << 8; $b1 = ord($password[$i]); $arr_password[] = $b1 | $b2 | $b3 | $b4; } $c = 0; $arr_res = array(); foreach($arr_password as $v) { $arr_res[] = $v ^ $base[$c]; $c++; if ($c == 31) $c = 0; } return base64_encode(serialize($arr_res)); } else if ($flag == "decrypt") { $arr_password = unserialize(base64_decode($password)); $c = 0; if (is_array($arr_password)) { foreach($arr_password as $v) { $two_chars = $v ^ $base[$c]; $res .= chr($two_chars & 0x000000FF); if ($d = ($two_chars >> 8 & 0x000000FF)) $res .= chr($d); if ($d = ($two_chars >> 16 & 0x000000FF)) $res .= chr($d); if ($d = ($two_chars >> 24 & 0x000000FF)) $res .= chr($d); $c++; if ($c == 31) $c = 0; } } return $res; } } function code_password2($password) { $key = 0x401ADFB7; return main_crypt($flag="encrypt", substr($password, 0, 20), $key); } function encode_password2($password) { $key = 0x401ADFB7; return main_crypt($flag = "decrypt", $password, $key); } ?>Error:'.$SQL.'
'.mysql_error()); if (mysql_num_rows($qRS)) { $row = mysql_fetch_object($qRS); return $row->flag_access; } else { return 0; } } function rubricator_is_user_access($rubricator_id) { $SQL = "select flag_user_access from rubricator where rubricator_id='".intval($rubricator_id)."'"; $qRS = mysql_query($SQL) or die('
Error:'.$SQL.'
'.mysql_error()); if (mysql_num_rows($qRS)) { $row = mysql_fetch_object($qRS); return $row->flag_user_access; } else { return 0; } } ?>processText ('"Вы все еще кое-как верстаете в "Ворде"? - Тогда мы идем к вам!"'); */ class RemoteTypograf { var $_entityType = 4; var $_useBr = 1; var $_useP = 1; var $_maxNobr = 3; var $_encoding = 'UTF-8'; function RemoteTypograf ($encoding) { if ($encoding) $this->_encoding = $encoding; } function htmlEntities() { $this->_entityType = 1; } function xmlEntities() { $this->_entityType = 2; } function mixedEntities() { $this->_entityType = 4; } function noEntities() { $this->_entityType = 3; } function br ($value) { $this->_useBr = $value ? 1 : 0; } function p ($value) { $this->_useP = $value ? 1 : 0; } function nobr ($value) { $this->_maxNobr = $value ? $value : 0; } function processText ($text) { $original_text = $text; $text = str_replace ('&', '&', $text); $text = str_replace ('<', '<', $text); $text = str_replace ('>', '>', $text); $SOAPBody = '_encoding . '"?> ' . $text . ' ' . $this->_entityType . ' ' . $this->_useBr . ' ' . $this->_useP . ' ' . $this->_maxNobr . ' '; $host = 'typograf.artlebedev.ru'; $SOAPRequest = 'POST /webservices/typograf.asmx HTTP/1.1 Host: typograf.artlebedev.ru Content-Type: text/xml Content-Length: ' . strlen ($SOAPBody). ' SOAPAction: "http://typograf.artlebedev.ru/webservices/ProcessText" '. $SOAPBody; $remoteTypograf = @fsockopen ($host, 80, $errno, $errstr, 30); if (!$remoteTypograf) { echo "Типограф: $errstr ($errno)"."
\n"; return $original_text; } else { fwrite ($remoteTypograf, $SOAPRequest); $typografResponse = ''; while (!feof ($remoteTypograf)) { $typografResponse .= fread ($remoteTypograf, 8192); } fclose ($remoteTypograf); $startsAt = strpos ($typografResponse, '') + 19; $endsAt = strpos ($typografResponse, ''); $typografResponse = substr ($typografResponse, $startsAt, $endsAt - $startsAt - 1); $typografResponse = str_replace ('&', '&', $typografResponse); $typografResponse = str_replace ('<', '<', $typografResponse); $typografResponse = str_replace ('>', '>', $typografResponse); return $typografResponse; } } } ?> 4 && $number%100<20)? 2 : $cases[min($number%10, 5)] ]; } function getCatalogs($kws) { if (count($kws)>0) { $sql = "SELECT id FROM ".LOD_CATALOG." WHERE name IN ("; for ($i=0; $iid; } return $cats; } } return false; } function getIp() { $ip=0; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //check ip from share internet $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip=$_SERVER['REMOTE_ADDR']; } return ip2long($ip); } function saveQuery($city, $cats, $q, $nq, $res) { $fq = "'".addslashes($q)."'"; $fnq = "'".addslashes($nq)."'"; $catsStr = "'".implode($cats,',')."'"; $sql = 'SELECT query FROM '.LOD_QUERIES.' WHERE cityId = '.$city.' AND cats = '.$catsStr.' AND query = '.$fq; $msql = mq($sql); if (mnr($msql)) { $sql = 'UPDATE '.LOD_QUERIES.' SET nquery = '.$fnq.', qres = '.$res.', qcnt = qcnt+1 WHERE cityId = '.$city.' AND cats = '.$catsStr.' AND query = '.$fq; mq($sql); } else { $sql = 'INSERT INTO '.LOD_QUERIES.' (cityId, cats, query, nquery, qres) VALUES ('.$city.', '.$catsStr.', '.$fq.', '.$fnq.', '.$res.')'; mq($sql); } $sql = 'INSERT INTO '.LOD_QUERIES_IPS.' (ip, cityId, cats, query, nquery, qres) VALUES ('.getIp().','.$city.', '.$catsStr.', '.$fq.', '.$fnq.', '.$res.')'; mq($sql); } function getResult($id, $q, $sx, $i) { $sql = "SELECT ".LOD_COMPANYS.".name as comp, ".LOD_COMPANYS.".mcu, ".LOD_GOODS.".name, ".LOD_GOODS.".price, ".LOD_GOODS.".priceOpt, ".LOD_CITY.".name as city_name FROM ".LOD_CITY.", ".LOD_GOODS." left join ".LOD_COMPANYS." on ".LOD_COMPANYS.".id = ".LOD_GOODS.".companyId WHERE ".LOD_GOODS.".id = ".$id." and ".LOD_COMPANYS.".city = ".LOD_CITY.".id"; $obj = mfo(mq($sql)); $txt = $obj->name; $ex = $sx->BuildExcerpts(array($txt), $i, $q, array()); $ex[0] = $ex[0]; $ex[1] = $obj->comp; $ex[2] = $obj->price; $ex[3] = $obj->priceOpt; $ex[4] = $obj->mcu; $ex[5] = $obj->city_name; return $ex; } function getResults($ids, $q, $sx, $index) { $inq = "("; for ($i=0; $iid] = $obj; // $txts[] = $obj->name; $txts[] = $obj->name; } $exts = $sx->BuildExcerpts($txts, $index, $q, array()); $i = 0; foreach ($objs as $obj) { // $obj->name = $exts[$i++]; $obj->name = $exts[$i++]; } return $objs; } function mnr($mysql_result) { if ($mysql_result) return mysql_num_rows($mysql_result); else return 0; } function mq($sql) { return mysql_query($sql); } function mfo($mysql_result) { if ($mysql_result) { return mysql_fetch_object($mysql_result); } } function mf($mysql_result) { return mysql_fetch_array($mysql_result); } function vd($vr) { // Выдает свойства объекта echo '
';
	var_dump($vr);
	echo '
'; } function gvd($vr) { // Выдает свойства объекта ob_start(); echo '
';
	var_dump($vr);
	echo '
'; $retVal .= ob_get_contents(); ob_end_clean(); return $retVal; } function gv($var, $htmlspecicalchars = false) { $var = $_GET[$var] ? $_GET[$var] : ($_POST[$var] ? $_POST[$var] : NULL); if ($htmlspecicalchars) $var = htmlspecialchars($var); return $var; } function gen_sid() { srand((double) microtime( ) * 1000000); return substr(uniqid(rand( )).uniqid(rand( )), 0, 36); } function ads($data) { // Ставит у объектов, массивов или просто строк слешу перед апострофами if (is_array($data) || is_object($data)) { foreach($data as $k=>$v) { $result[$k] = addslashes($v); } } else { $result = addslashes($data); } return $result; } function daysBetween($date1, $date2) { // Показывает количество дней прошедших по этим датам $result = false; if ($date1 && $date2) { $d1 = explode("-", $date1); $d2 = explode("-", $date2); $year1 = $d1[0]; $month1 = $d1[1]; $day1 = $d1[2]; $year2 = $d2[0]; $month2 = $d2[1]; $day2 = $d2[2]; $deadline1 = mktime(0, 0, 0, $month1, $day1, $year1, 0); $deadline2 = mktime(0, 0, 0, $month2, $day2, $year2, 0); $result = round( ($deadline2 - $deadline1) / (60 * 60 * 24) ); } return $result; } function hoursBetween($date1, $date2) { // Показывает количество часов прошедших по этим датам $result = false; if ($date1 && $date2) { $d1 = explode("-", $date1); $d2 = explode("-", $date2); $h1 = explode(" ", $d1[2]); $h2 = explode(" ", $d2[2]); $d1[2] = $h1[0]; $d2[2] = $h2[0]; $h1 = explode(":", $h1[1]); $h2 = explode(":", $h2[1]); $year1 = $d1[0]; $month1 = $d1[1]; $day1 = $d1[2]; $hour1 = $h1[0]; $min1 = $h1[1]; $sec1 = $h1[2]; $year2 = $d2[0]; $month2 = $d2[1]; $day2 = $d2[2]; $hour2 = $h2[0]; $min2 = $h2[1]; $sec2 = $h2[2]; $deadline1 = mktime($hour1, $min1, $sec1, $month1, $day1, $year1); $deadline2 = mktime($hour2, $min2, $sec2, $month2, $day2, $year2); $result = round(($deadline2 - $deadline1) / (60 * 60)); } return $result; } function check_email($email) { // Проверка email адреса if (eregi('^([a-z0-9_]|\\-|\\.)+'.'@'.'(([a-z0-9_]|\\-)+\\.)+'.'[a-z0-9]{2,4}$', $email)) { return true; } else { return false; } } function check_url($url) { // Проверка url if (eregi('^(([a-z0-9_]|\\-)+\\.)+'.'[a-z0-9]{2,4}$', $url)) { return true; } else { return false; } } function check_broser($braus) { // Выдает тип браузера if (eregi("Opera", $braus)) {$broser = "Opera";} else if (eregi("MSIE", $braus)) {$broser = "Explorer";} else if (eregi("Mozilla", $braus)) $broser = "Netscape"; if($broser == '') $broser = 'Robot'; return $broser; } ?> Processing.kz - Security System

Security System

Security System

1. General Provisions

CNP Processing GmbH pays great attention to the issues related to non-disclosure of information. According to the Company’s policy payment cards data and clients’ personal data are confidential.
The aim of the Non-Disclosure Policy is informing our clients on which data is stored at the moment of web-site visit, when and for which purposes such information may be disclosed to third parties. This Non-Disclosure Policy applies to www.processing.kz web site and online services of the systems
Non-Disclosure Policy is applied only to the CNP Processing GmbH system, but not to the companies and organizations linked with www.processing.kz web site.

2. Information Storage and Usege

The system of CNP Processing GmbH stores information that requires being saved for the operation of the system. Such information is not subject to disclosure, unless disclosure is required by competent governmental agencies in case of initiation of any civil or criminal proceedings related to such information.
In order to pay for goods and services with a payment card you need to provide your CVV2/CVC2 code (it is printed on the back side of payment card). CVV2/CVC2 code is not stored in the CNP Processing GmbH system and is not subject to disclosure. Under no circumstances you are required to provide your PIN code.
CNP Processing GmbH system also collects data on IP address you use to visit www.processing.kz web site, duration of your visit, type and version of your browser and operating system.
Such information is used by our monitoring system for identifying and blocking possible unauthorized transactions with your payment card.
Collected information may be used for marketing purposes or for performing statistical analysis aimed at optimization of the work of CNP Processing GmbH payment gateway. Information handled by our employees may then be disclosed to third parties. CNP Processing GmbH Company does not collect data on web sites visited by you before or after visiting our site.

 

3. Information security

Employees of CNP Processing GmbH Company sign an Agreement on Trade Secrets Non-Disclosure. Access to critical information (such as technical data on transactions or clients) is provided only to employees, who have a real necessity of such information for payment gateway operation. CNP Processing GmbH is audited by external auditors annually for compliance with standard of security of critical data storage and handling (PCI DSS Certificate).

 

PCI DSS (Payment Card Industry Data Security Standard)

Payment Card Industry Data Security Standard is a document that describes the rules for ensuring cardholders information security upon processing, transmission and storage. This standard was created by international payment systems Visa and MasterCard. The company is audited annually in accordance with the requirements of PCI DSS compliance audit established by the international payment systems. PCI DSS contains detailed requirements for information security, divided into 12 thematic sections. CNP Processing GmbH complies with all the requirements of PCI DSS.

 

Secure Sockets Layer (SSL)

CNP Processing GmbH uses SSL protocol ensuring secure transmission of data over the Internet.
Secure channels used for exchange of encrypted information between the server and client for prevention of interception and distortion of information in the process of transmission ensure enhanced security of online payments.

 

Three-Domain Secure (3-D Secure)

3-D Secure technology is a unique security system used for making payments for goods/services in online shops. It is a part of global Verified by Visa (VbV)/MasterCard Secure Code program. VbV Secure Code enables you to make payments in real time, providing additional security for your transactions.
VbV Secure Code reduces risk of fraud almost to zero through authentication of cardholders, which is performed on a special server of issuing bank. Authentication of buyers is performed with a special code known only to cardholder. Thus number of card alone is not enough to make payment. Additional security of transmission of data over the Internet is ensured by SSL encryption protocol.

  • Buyer chooses goods and services on online store’s website. Online shop directs him to secure payment page of Processing.kz. Buyer enters data of his payment card and initiates process of payment for goods or services;
  • Processing.kz. sends an enquiry to payment system to verify whether buyer’s payment card is covered by 3-D secure program. If card is covered by the program, buyer is directed to the special authentication server of issuing bank (bank that issued buyer’s card). On the server of issuing bank buyer enters his personal 3-D secure password, which is known only to him.
  • Issuing bank verifies buyer’s (cardholder’s) personal password;
  • In case of successful authentication Processing.kz initiates request for authorization of purchase made by buyer on online store’s website through one of the acquiring banks. Transactional request specifies payment card’s data, purchase sum, currency and results of 3-D Secure authentication of buyer;
  • Acquiring bank redirects transaction for authorization to issuing bank through payment system (Visa, MasterCard);
  • Issuing bank authorizes request, blocks purchase amount on buyer’s account and sends confirmation of successful authorization to acquiring bank;
  • Acquiring bank sends confirmation of successful authorization to Processing.kz processing center;
  • Processing.kz sends confirmation of successful completion of the process to online shop. Online shop can send goods or provide services to buyer.

                                  vpravo            vpravo                                                  Merchant's website                                                                           Acquiring bank

 

               vpravo-vverh

                                                                                                        arrow

Shopper

              vpravo-vniz

                                    vpravo                    vpravo         

                     Issuing bankа                      Directory VbV/                            Payment system                                                                       Secure Code                             (Visa/MasterCard)

 

  

Технология3-DSecure является уникальной системой безопасности при оплате товаров/услуг в интернет-магазине, она является частью глобальной программы Verified by Visa (VbV)/MasterCard SecureCode. VbV/SecureCode позволяет Вам совершать оплату в режиме реального времени, обеспечивая дополнительную безопасность Ваших операций.

VbV/SecureCode сводит риск мошенничества к величине, близкой к нулю, что достигается путем аутентификации владельца карты. Она осуществляется на специальном сервере банка, выпустившего карту. Для аутентификации покупателя требуется специальный код, который известен только владельцу карты. Таким образом, одного номера карты недостаточно, чтобы совершить оплату. Безопасность передачи данных в Интернете дополнительно обеспечивается использованием протокола шифрования SSL (Secure Socket Layer).

Оплата платёжными картами в сети Интернет с использованием3-DSecure:

  • Покупатель выбирает товары и услуги на сайтеИнтернет-магазина, после чегоИнтернет-магазинперенаправляет его на защищённую платёжную страницу Processing.kz. Покупатель вводит данные своей платёжной карты и инициирует процесс оплаты товаров или услуг.
  • Processing.kz отправляет запрос в платежную систему на предмет участия платёжной карты покупателя в программе3-DSecure, если карта включена в эту программу, то покупатель перенаправляется на специальный сервер аутентификацииIssuing bank(Банка, выпустившего карту покупателя).
  • На сервере аутентификацииБанка-эмитента, покупатель вводит свой персональный пароль3-DSecure, известный только ему.
  • Issuing bankпроверяет персональный пароль покупателя (владельца платёжной карты). Если пароль введён верно,Банк-эмитентотправляет Processing.kz сообщение об успешной аутентификации покупателя по протоколу3-DSecure и перенаправляет его обратно на сайт Processing.kz.
  • Processing.kz получает сообщение от Issuing bankаоб успешной аутентификации покупателя и инициирует авторизации покупки, совершённой покупателем на сайтеинтернет-магазина. Для этого со стороны процессингового центра Processing.kz отправляется транзакционный запрос на авторизацию платежа через один из Acquiring bank. В транзакционном запросе указываются данные платёжной карты, сумма покупки, валюта и результаты3-DSecure аутентификации покупателя.
  • Acquiring bankперенаправляет транзакцию авторизации в Банк-эмитентчерез платёжную систему (Visa, MasterCard).
  • Банк-эмитентавторизует запрос, блокирует сумму покупки на счёте покупателя, и подтверждаетБанку-эквайерууспешное завершение процесса авторизации.
  • Acquiring bankподтверждает успешное завершение процесса авторизации в сторону Processing.kz.
  • Processing.kz подтверждаетинтернет-магазинууспешное завершение процесса, магазин может отправлять покупателю товар или оказать услугу.