ошибка подключения.
'; } } function create_main_menu() { global $HTTP_PATH, $SITE_DIR, $lang_link; $query = "select * from mainsite where (menupos = 'main' || menupos = 'mred' || menupos = 'mra') && lang = '".$this -> lang."' order by nio"; $result = mysql_query($query); $this -> num_mainmenu = $num_results = mysql_num_rows($result); for ($i=0; $i <$num_results; $i++) { $menu = mysql_fetch_array($result); $sub = $this -> create_sub_menu($menu['nio'],'main'); if ($menu['menupos'] != 'mra')$out .= '
  • '.$menu['pagename']."\n$sub
  • "; else $out .= '
  • '.$menu['pagename']."
  • \n"; $sub = ''; } return $out; } function create_sub_menu($nio,$addval) { global $HTTP_PATH, $SITE_DIR, $lang_link; if (!$nio) $flag = 0; else $flag = 1; $style[0] = 'margin-left:-5px;font-weight:bold;list-style-type:none;'; $style[1] = 'margin-left:0px;font-weight:bold;'; if (!$nio) $nio = $this -> mainpagenio; $nio_end = $nio + 1000; $query = "select * from mainsite where (menupos = 'sub' || menupos = 'sred') && lang = '".$this -> lang."' && nio >= $nio && nio < $nio_end order by nio"; $result = mysql_query($query); $num_results = mysql_num_rows($result); if ($num_results > 0) { for ($i=0; $i <$num_results; $i++) { $menu = mysql_fetch_array($result); $nio_3_begin = ((int)($menu['nio'] / 100)) * 100; if (($nio_3_begin <= $this -> nio && ($nio_3_begin + 100) > $this -> nio) && $addval != 'main') $sub = $this -> create_3_menu($nio_3_begin); else $sub = ''; if (!$sub) $class = ""; else $class = " class=\"selected\""; if ($this -> link != $menu['link']) $out .= ''.$menu['pagename']."$sub\n"; else $out .= ''.$menu['pagename']."$sub\n"; } return "\n"; } else return false; } function create_3_menu($nio_begin) { global $HTTP_PATH, $SITE_DIR, $lang_link; //$nio_begin = ((int)($this -> nio / 100)) * 100; $nio_end = $nio_begin + 100; $query = "select * from mainsite where menupos = 'ssub' && (nio > $nio_begin && nio < $nio_end) && lang = '".$this -> lang."' order by nio"; $result = mysql_query($query); $num_results = mysql_num_rows($result); if ($num_results > 0) { for ($i=0; $i <$num_results; $i++) { $menu = mysql_fetch_array($result); if ($this -> nio == $menu['nio']) $out .= '
  • '.$menu['pagename']."
  • \n"; else $out .= '
  • '.$menu['pagename']."
  • \n"; } return "\n"; } else return false; } function create_ssub_menu() { global $HTTP_PATH, $SITE_DIR, $lang_link; $num1000 = (int)($this -> nio / 1000); $parentpage1_nio = $num1000 * 1000; $num100 = (int)(($this -> nio - $parentpage1_nio) / 100); $nio_end = $parentpage1_nio + ($num100 * 100) + 100; $parentpage2_nio = $parentpage1_nio + ($num100 * 100); $parentpage1 = $this -> get_page_content($parentpage1_nio,'nio','pagename'); //$parentpage2 = $this -> get_page_content($parentpage2_nio,'nio','pagename'); $query = "select * from mainsite where ((menupos = 'ssub' && nio > $parentpage2_nio && nio < $nio_end) || (menupos = 'sub' && nio = $parentpage2_nio)) && lang = '".$this -> lang."' order by nio"; $result = mysql_query($query); $num_results = mysql_num_rows($result); if ($num_results > 0) { for ($i=0; $i <$num_results; $i++) { $menu = mysql_fetch_array($result); if ($num_results == ($i + 1)) $class = ''; if ($this -> nio != $menu['nio']) $out .= ''.$menu['pagename']."\n"; else $out .= ''.$menu['pagename']."\n"; } return "$parentpage1 » $out\n"; } else return false; } function create_all_menu() { global $HTTP_PATH, $SITE_DIR, $lang_link; $menu_all = ''; $query = "select * from mainsite where (menupos = 'main' || menupos = 'mred' || menupos = 'mra' || menupos = 'sub' || menupos = 'sred') && lang = '".$this -> lang."' && link != '#' order by nio"; $result = mysql_query($query); $num_results = mysql_num_rows($result); for ($i=0; $i <$num_results; $i++) { $menu = mysql_fetch_array($result); $menu_all .= ''.$menu['pagename']." \n"; } return $menu_all; } //AZONE MailSender ver. 2.0 functions begin---------------------------------------------------------- function mail_sender($to,$subject,$text,$sender_email,$sender_name,$path,$sendfilename,$content_type,$charset) { if ($this -> check_email_format($to) == true && !empty($text) && !empty($subject)) { if (!$charset) $charset = 'utf-8'; if (!$sender_name) $sender_name = 'Azone MailSender'; if (!$content_type) $content_type = 'plain'; $subject = "=?$charset?B?". base64_encode("$subject"). "?="; if (!empty($path)) {//прикрепление файла $type = 'application/msword'; $file_charset = 'utf-8'; if (!$type) { $this -> mes_block('','не удалось определить формат файла'); return false; } else { if ($path) { $fp = fopen($path,"rb"); if (!$fp) { print "Cannot open file"; exit(); } $file = fread($fp, filesize($path)); fclose($fp); } if (!$sendfilename) $filename = basename($path); // определяем имя файла else $filename = $sendfilename; $EOL = "\r\n"; // ограничитель строк, некоторые почтовые сервера требуют \n $boundary = "--".md5(uniqid(time())); // любая строка, которой не будет ниже в потоке данных. $headers .= "MIME-Version: 1.0;$EOL"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"$EOL"; $headers .= "From: =?$charset?B?". base64_encode("$sender_name"). "?= <$sender_email>$EOL"; $headers .= "Reply-To: =?$charset?B?". base64_encode("$sender_name"). "?= <$sender_email>\r\n"; $headers .= "User-Agent: AZONE MailSender by WebTec\r\n"; $multipart = "--$boundary$EOL"; $multipart .= "Content-Type: text/$content_type; charset=$charset$EOL"; $multipart .= "Content-Transfer-Encoding: base64$EOL"; $multipart .= $EOL; // раздел между заголовками и телом html-части $multipart .= chunk_split(base64_encode($text)); $multipart .= "$EOL--$boundary$EOL"; $multipart .= "Content-Type: $type; name=\"$filename\"; charset=$file_charset$EOL"; $multipart .= "Content-Transfer-Encoding: base64$EOL"; $multipart .= "Content-Disposition: attachment; filename=\"$filename\"$EOL"; $multipart .= $EOL; // раздел между заголовками и телом прикрепленного файла $multipart .= chunk_split(base64_encode($file)); $multipart .= "$EOL--$boundary--$EOL"; $mailcontent = $multipart; } } else { $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/$content_type; charset=$charset\r\n"; $headers .= "From: =?$charset?B?". base64_encode("$sender_name"). "?= <$sender_email>\r\n"; $headers .= "Reply-To: =?$charset?B?". base64_encode("$sender_name"). "?= <$sender_email>\r\n"; $headers .= "User-Agent: AZONE MailSender by WebTec\r\n"; $headers .= "Content-Transfer-Encoding: 8bit\r\n"; $mailcontent = $text; } if (mail($to, $subject, $mailcontent, $headers)) return true; else return false; } else { return false; } } //CheckMail ver. 1.3 function check_email_format($email) { if (!eregi('^[a-zA-Z0-9\?\.\+-_]+[a-zA-Z0-9\?\.\+-_]+@[a-zA-Z0-9\?\.\+-_]+\.[a-zA-Z0-9\-\.]+$', $email)) return false; else return true; } //функция получения формата файла и кодировки function check_file_format($filename,$charset) {//$filename - полный путь к файлу на сервере $finfo = finfo_open(FILEINFO_MIME); // return mime type ala mimetype extension $array = explode(' ',finfo_file($finfo, $filename)); if (!$charset) { $type = explode(';',$array[0]); if ($type[0] == 'application/x-not-regular-file') $type_out = 'folder'; else $type_out = $type[0]; } else { $type_out = ereg_replace('charset=', '', $array[1]); } finfo_close($finfo); return $type_out; } //AZONE MailSender functions end------------------------------------------------------------------------------ function exec_query($query) { $result = mysql_query($query); $error = mysql_error(); if (!$error) { return $result; } else { $this -> res_viewer('', $error); exit; return false; } } function num_rows_from_query($query) { $result = mysql_query($query); $error = mysql_error(); if (!$error) { return $num_results = mysql_num_rows($result); } else { //$this -> res_viewer('', $error); //exit; return false; } } function row_from_query($query) { $result = mysql_query($query); $this -> error = mysql_error(); if (!$this -> error && $result > 0) { return mysql_fetch_array($result); } else { return false; } } function pages_list_fn($query,$page,$totallink,$rop) { if (!$page) $page = 1; $this -> total_num_res = $num_results = mysql_num_rows($this->exec_query($query)); if (!$rop) $rop = 20; //rows on page $totalpages = $num_results / $rop; if ($page > ($totalpages + 1)) $page = 1; if ($totalpages > 1) { $this -> pages_list .= "
    Страницы: "; for ($i = 0; $i < $totalpages; $i++) { $j=0; $j = $i + 1; if ($j == $page) $this -> pages_list .= ''.$j.''; else $this -> pages_list .= ''.$j.''; } $this -> pages_list .= "
    "; } else { $page = 1; } $from = ($page - 1) * $rop; $query = "$query LIMIT $from,$rop"; return $this -> exec_query($query); } function get_page($lang, $link, $tmpl_name) { global $TEMPLATE_DIR, $JS_DIR, $HTTP_PATH, $lang_path, $lang_link; $this -> db_connect(); $this -> get_page_info($lang, $link); $this -> page_builder($tmpl_name); } //PageBuilder 1.0---------------------------------- function page_builder($tmpl_name) { global $TEMPLATE_DIR, $JS_DIR, $HTTP_PATH, $SITE_DIR, $lang_link; if (!$tmpl_name) $tmpl_name = 'general_'; $file = file_get_contents($HTTP_PATH.$SITE_DIR.$TEMPLATE_DIR.'header_'.$this -> lang.'.tpl'); $file .= file_get_contents($HTTP_PATH.$SITE_DIR.$TEMPLATE_DIR.$tmpl_name.$this -> lang.'.tpl'); $file .= file_get_contents($HTTP_PATH.$SITE_DIR.$TEMPLATE_DIR.'footer_'.$this -> lang.'.tpl'); $pattern[0] = '[:KEYWORDS:]'; $replace[0] = $this -> keywords; $pattern[1] = '[:DESCRIPTION:]'; $replace[1] = $this -> description; $pattern[2] = '[:TITLE:]'; $replace[2] = $this -> title; $pattern[3] = '[:HTTP_PATH:]'; $replace[3] = $HTTP_PATH; $pattern[4] = '[:JS:]'; $replace[4] = $JS_DIR; $pattern[5] = '[:ALT:]'; $replace[5] = $this -> keywords; $pattern[6] = '[:LANGSEL:]'; $replace[6] = $this -> select_lang(); $pattern[7] = '[:MAINMENU:]'; $replace[7] = $this -> create_main_menu(); $pattern[8] = '[:NEWS:]'; $replace[8] = $this -> news_shot($this -> lang); $pattern[9] = '[:CONTENT:]'; $replace[9] = $this -> content; $pattern[10] = '[:LANG_LINK:]'; $replace[10] = $lang_link[$this -> link]; $pattern[11] = '[:MENU2:]'; $replace[11] = $this -> create_sub_menu(); $pattern[12] = '[:MAINPAGENAME:]'; $replace[12] = $this -> mainpagename; $pattern[13] = '[:MENU_INDEX:]'; $replace[13] = $this -> create_sub_menu('zero'); $pattern[14] = '[:MAINPAGENIO:]'; $replace[14] = $this -> mainpagenio; $pattern[15] = '[:BROWSER_STYLE:]'; $replace[15] = $this -> get_browser_style(); $pattern[16] = '[:FOOTERMENU:]'; $replace[16] = $this -> create_all_menu(); $pattern[17] = '[:SITE_DIR:]'; $replace[17] = $SITE_DIR; $pattern[18] = '[:NEWS_SHROT:]'; $replace[18] = $this -> news_shot(); $file_built = str_replace($pattern,$replace,$file); //$file_built = str_replace('[:ALT:]',$this -> keywords,$file); echo $file_built; } function get_page_content($item,$fieldselect,$fieldout) { $row = $this -> row_from_query("select * from mainsite where $fieldselect = '".$item."' && lang = '".$this -> lang."'"); return $row[$fieldout]; } function get_browser_style() { global $HTTP_PATH, $SITE_DIR; $agent=getenv("HTTP_USER_AGENT"); if(strlen($agent)>2&&!strstr($agent,'MSIE')) return "\n@import url(\"".$HTTP_PATH.$SITE_DIR.'styles_ff.css");'."\n"; else return "\n@import url(\"".$HTTP_PATH.$SITE_DIR.'styles_ie.css");'."\n"; } function select_lang() { global $HTTP_PATH,$lang_link; if ($this -> lang == 'ru') return 'РУС/ENG'; else return 'РУС/ENG'; } function get_page_info($lang, $link) { $query = "select * from mainsite where link = '$link' && lang = '$lang' && menupos != 'mred'"; $result = mysql_query($query); $page = mysql_fetch_array($result); $this -> title = $page['title']; $this -> keywords = $page['keywords']; $this -> description = $page['description']; $this -> pagename = $page['pagename']; $this -> content = $page['content']; $this -> link = $page['link']; $this -> lang = $page['lang']; $this -> nio = $page['nio']; $this -> mainpagenio = (int)($this -> nio / 1000) * 1000; $row = $this -> row_from_query("select * from mainsite where nio = '".$this -> mainpagenio."'"); $this -> mainpagelink = ereg_replace('.php','',$row['link']); $this -> mainpagename = $row['pagename']; } function news_shot() { global $HTTP_PATH, $lang_link; $query = "select * from news where lang = '".$this -> lang."' && arc = 'no' order by date desc"; $result = mysql_query($query); $num_results = mysql_num_rows($result); if ($num_results == 0) { if ($this -> lang == 'ru') $news = 'Новостей нет.'; else $news = 'There are no news.'; } else { $row = mysql_fetch_array($result); $date = explode('-',$row['date']); $mdate = $date[2].'.'.$date[1].'.'.$date[0]; $news .= '

    '.$row['header'].'

    '.$row['content'].'
    Last update '.$mdate.'
    '; } return $news; } } ?> db_connect(); $this -> lang = $lang; $this -> get_page_info($lang, $link); $this -> content = ''; if (!$type) { $and_type = " && newstype != 'pr'"; } else $and_type = " && newstype = '$type'"; $newstype['nc'] = 'MicrowaveTec events'; $newstype['ex'] = 'MicrowaveTec exhibitions '; $newstype['da'] = 'MicrowaveTec degrees and awards '; $newstype['np'] = 'MicrowaveTec new projects'; $newstype['bk'] = 'MicrowaveTec new books'; $newstype['co'] = 'MicrowaveTec conferences'; $query = "select * from news where lang = '$lang'$and_type order by date desc"; $result = mysql_query($query); $num_results = mysql_num_rows($result); if ($num_results == 0) { if ($lang == 'ru') $this -> content .= 'Информация отсутствуют.'; else $this -> content .= 'There is no information.'; } else { //вычисляем количество страниц--------------------------------- $totalpages = $num_results / $rop; if ($totalpages > 1) { $output_pages .= "
    "; for ($i = 0; $i < $totalpages; $i++) { $j=0; $j = $i + 1; if ($j == $page) $output_pages .= ''.$j.''; else $output_pages .= ''.$j.''; } $output_pages .= "
    "; } else { $page = 1; } if (!$page) { $from = 0; $page = 1; } else { $from = ($page - 1) * $rop; } //свершилось, вычислили---------------------------------------- $query = "$query LIMIT $from,$rop"; $result = mysql_query($query); $num_results = mysql_num_rows($result); $this -> content .= "

    ".$newstype[$type]."

    \n"; if ($totalpages > 1) $this -> content .= "$output_pages\n"; $this -> content .= "'; if ($totalpages > 1) $this -> content .= "$output_pages\n"; } $this -> page_builder(); } function get_projects_list($lang, $link, $type) { global $TEMPLATE_DIR, $SITE_DIR, $JS_DIR, $SITE_DIR, $HTTP_PATH, $lang_link, $lang_path; $page = (int)$_GET['page']; $rop = 10; //rows on page if (!$page) $page = 1; $this -> db_connect(); $this -> lang = $lang; $this -> get_page_info($lang, $link); $this -> content = ''; $and_type = "&& newstype = '$type'"; $query = "select * from news where lang = '$lang'$and_type order by arc,date desc,newstype desc"; $result = mysql_query($query); $num_results = mysql_num_rows($result); if ($num_results == 0) { if ($lang == 'ru') $this -> content .= 'Информация отсутствуют.'; else $this -> content .= 'There is no information.'; } else { //вычисляем количество страниц--------------------------------- $totalpages = $num_results / $rop; if ($totalpages > 1) { $output_pages .= "
    "; for ($i = 0; $i < $totalpages; $i++) { $j=0; $j = $i + 1; if ($j == $page) $output_pages .= ''.$j.''; else $output_pages .= ''.$j.''; } $output_pages .= "
    "; } else { $page = 1; } if (!$page) { $from = 0; $page = 1; } else { $from = ($page - 1) * $rop; } //свершилось, вычислили---------------------------------------- $query = "$query LIMIT $from,$rop"; $result = mysql_query($query); $num_results = mysql_num_rows($result); $this -> content .= "

    MicrowaveTec projects

    \n"; if ($totalpages > 1) $this -> content .= "$output_pages\n"; $this -> content .= "'; if ($totalpages > 1) $this -> content .= "$output_pages\n"; } $this -> page_builder(); } function get_news($lang, $link, $id) { global $TEMPLATE_DIR, $SITE_DIR, $JS_DIR, $HTTP_PATH, $SITE_DIR, $lang_path, $lang_link; $this -> db_connect(); $this -> get_page_info($lang, $link); $this -> content = ''; $query = "select * from news where id = '$id'"; $result = mysql_query($query); $num_results = mysql_num_rows($result); if ($num_results == 0) { if ($lang == 'ru') $this -> content .= 'Информация отсутствуют.'; else $this -> content .= 'There is no information.'; } else { $news = mysql_fetch_array($result); $this -> title = $news['header'].' - '.$this -> title; $date = explode('-',$news['date']); $this -> content .= '
    '.$date[2].'.'.$date[1].'.'.$date[0].' г.
    '.$news['header'].'
    '.$news['content'].'

    << Return to News list

    '; } //$this -> link = 'news'.$type.'.php'; $this -> page_builder(); } function get_proj($lang, $link, $id) { global $TEMPLATE_DIR, $SITE_DIR, $JS_DIR, $HTTP_PATH, $lang_path, $lang_link; $this -> db_connect(); $this -> get_page_info($lang, $link); $this -> content = ''; $query = "select * from news where id = '$id'"; $result = mysql_query($query); $num_results = mysql_num_rows($result); if ($num_results == 0) { if ($lang == 'ru') $this -> content .= 'Информация отсутствуют.'; else $this -> content .= 'There is no information.'; } else { $news = mysql_fetch_array($result); $this -> title = $news['header'].' - '.$this -> title; $date = explode('-',$news['date']); $this -> content .= '
    '.$news['header'].'
    '.$news['content'].'

    << Return to Projects list

    '; } //$this -> link = 'news'.$type.'.php'; $this -> page_builder(); } } ?>