add_module('tools'); $controller->add_module('mysql'); $controller->add_module('catalog'); $controller->add_module('sitemap'); $controller->add_module('ltmap'); $controller->add_module('search'); $controller->add_module('flashadmin'); $controller->add_module('banners'); $controller->add_module('map_lietuva'); $controller->add_module('map_europa_pazintinis'); $controller->add_module('map_europa_testas'); $controller->add_module('standartinis_testas'); $controller->add_module('konkursinis_testas'); $controller->add_module('eilute'); $controller->__init(); $allow_langs = array('lt'); // define constants require_once(CONST_INC_PATH); require_once(FUNC_INC_PATH); // select language list($lang, $charset) = set_language(); //start session include_once("./include/functions.php"); include("include/PHP/category.php"); include("include/PHP/utilities.php"); include("include/PHP/scart.php"); include ("Config/patch.php"); include ("Config/database.php"); $tools = new tools(); //print "{$config["db_host"]},{$config["db_user"]},{$config["db_psw"]},{$config["db"]}"; $cHdb = new mysql($config["db_host"],$config["db_user"],$config["db_psw"],$config["db"]); $cHdb->connect(); $cHdb->select_db(); //print_r(DB_USER); $category = new Category(DB_HOST, DB_NAME, DB_USER, DB_PASS, $db_tables, $lang); $print_version = true; $db = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("db error: can't connect"); mysql_select_db(DB_NAME, $db); mysql_query("SET character_set_client = utf8"); mysql_query("SET character_set_connection = utf8"); mysql_query("SET character_set_results = utf8"); mysql_query("SET collation_connection = utf8_general_ci"); $data = init_data(); foreach (array_keys($_GET) as $key){ $data[$key] = addslashes(trim($_GET[$key])); } if (!valid($data['s_id'])) $data['s_id'] = 0; // get cat data form db $query = "SELECT * FROM $db_tables[supercat] WHERE s_id ='$data[s_id]'"; if (valid($data['s_id'])) get_cat_data($query); //ar catalogo perziura if (valid($data['p_id'])) $data['type'] = 'ct'; if (!valid($data['exp'])) $data['exp'] = $data['s_id']; // remove slashes and escape spec chars //$data = slash_clear($data); // jei nepasirinktas joks puslapis, kraunam titulini puslapi if(!valid($data['s_id']) AND !valid($data['page'])) { $tpl = tpl_start("/title_$lang.tpl.html"); set_promo(); #$flashadmin = new flashadmin($cHdb,$lang); #$tpl->set_var('flash_ct', $flashadmin->__render()); $tools->getTitleText($cHdb, $tpl, $lang, 7); if(!isset($_GET['flash'])) { $tools->get_puzzle_images($cHdb, $tpl, $lang); }else{ $tools->show_puzzle($cHdb, $tpl, $lang); } $banners = new banners($cHdb, $lang, 'admin/'); $banners_list = $banners->__render(1,$config,1); $tpl->set_var('banners1_out',$banners_list); $tpl->set_var('padding_slot','padding:10px;'); //__init_catalog(); $eilute = new eilute($cHdb, $lang, 'admin/', FALSE); $eilute->__render(); $tpl->set_var("lang", htmlspecialchars($lang)); $tpl->set_var("page", htmlspecialchars($data['page'])); ///////////////////////////////////////// include_once('include/news_list.cls.php'); $news = new news_list($lang); // if($_GET['type']=='n'){ if (!empty($_GET['date'])) $cur_date = $_GET['date']; else $cur_date = date('Y.n.d'); $news->date = $cur_date; $news->set_attribute('show_date'); $news->set_attribute('show_archive'); $news_s_id = $data['s_id']; $news_output = $news->process_news_list(); $tpl->set_var('page_title', $data["title_$lang"]); $tpl->set_var('cat_item_output', $news_output); unset($news); $tpl->set_var("karsta", $news_output); /////////////////////////// if($_POST['voite']==1){ include('voite.php'); echo ""; } /* $query_tips=mysql_query("SELECT textas,id FROM tips WHERE aktyvi=1 ORDER BY parodyta ASC") or die (mysql_error()); $assoc_tips=mysql_fetch_assoc($query_tips); mysql_query("UPDATE tips SET parodyta=parodyta+1 WHERE id=".$assoc_tips['id']); $tpl->set_var("tips", $assoc_tips['textas']);*/ $today = date("y-m-d"); $query_tips=mysql_query("SELECT COUNT(*) AS kiekis FROM category WHERE s_id IN (SELECT s_id FROM supercategory WHERE parent=36) AND sdate='$today'") or die (mysql_error()); $assoc_tips=mysql_fetch_assoc($query_tips); $kiekis=$assoc_tips['kiekis']; if($kiekis==0){ $query_tips=mysql_query("SELECT s_id FROM category WHERE s_id IN (SELECT s_id FROM supercategory WHERE parent=36) AND sdate!='$today' ORDER by kiekis ASC LIMIT 1") or die (mysql_error()); $assoc_tips=mysql_fetch_assoc($query_tips); mysql_query("UPDATE category SET kiekis=kiekis+1,sdate='$today' WHERE s_id=".$assoc_tips['s_id']); } $query_tips=mysql_query("SELECT maintext_lt AS textas FROM category WHERE s_id IN (SELECT s_id FROM supercategory WHERE parent=36) AND sdate='$today'") or die (mysql_error()); $assoc_tips=mysql_fetch_assoc($query_tips); $tpl->set_var("tips", $assoc_tips['textas']); $query_apklausos_id=mysql_query("SELECT * FROM apklausa WHERE aktyvi=1 LIMIT 1") or die(mysql_query()); $fetch_assoc_apklausos=mysql_fetch_assoc($query_apklausos_id); $ids=intval($fetch_assoc_apklausos['id']); if($ids==NULL){ $ids=0;} /* $query_apklausos_klausimas=mysql_query("SELECT * FROM apklausa WHERE id=".$ids); $fetch_assoc_apklausos_klausimas=mysql_fetch_assoc($query_apklausos_klausimas); */ $tpl->set_var('klausimas',$fetch_assoc_apklausos['klausimas']); $hidden=''; $hidden.=''; $tpl->set_var('hidden',$hidden); $query_apklausos_balsuotojiai=mysql_query("SELECT id FROM balsavimas WHERE apklausos_id=".$ids." AND balsuotojo_ip='".getenv("REMOTE_ADDR")."'") or die(mysql_error()); $num_rows_apklausos_balsuotojas=mysql_num_rows($query_apklausos_balsuotojiai); if($num_rows_apklausos_balsuotojas==0){ for($i=1;$i<=6;$i++){ $query_atsakymas=mysql_query("SELECT atsakymas".$i." FROM apklausa WHERE id=".$ids) or die(mysql_error()); $assoc_atsakymas=mysql_fetch_assoc($query_atsakymas); if($assoc_atsakymas['atsakymas'.$i]!=''){ if($i==1){ $chk='checked'; } else { $chk=''; }; $atsakymas.='  '.$assoc_atsakymas['atsakymas'.$i].'
'; } } $balsuoti=''; } else { $balsuoti=''; $query_apklausa_balsuotojiai=mysql_query("SELECT COUNT(id) FROM balsavimas WHERE apklausos_id=".$ids); $assoc_apklausa=mysql_fetch_assoc($query_apklausa_balsuotojiai); $total=$assoc_apklausa['COUNT(id)']; for($i=1;$i<=6;$i++){ $query=mysql_query("SELECT COUNT(balas) FROM balsavimas WHERE apklausos_id=".$ids." AND balas=".$i) or die(mysql_error()); $assoc=mysql_fetch_assoc($query) or die(mysql_error()); $query_klausiams=mysql_query("SELECT atsakymas".$i." FROM apklausa WHERE id=".$ids) or die(mysql_error()); $assoc_klausimas=mysql_fetch_assoc($query_klausiams) or die(mysql_error()); if($assoc_klausimas['atsakymas'.$i]!=''){ $imagewidth=($assoc['COUNT(balas)']/$total)*100; $imagewidth = number_format($imagewidth, 0, '.', ''); $atsakymas.=$assoc_klausimas['atsakymas'.$i].'
'.$imagewidth.' '.$assoc['COUNT(balas)'].' ('.$imagewidth.'%)
'; } }$atsakymas.='
Jūs jau pareiškėte savo nuomonę...'; } $tpl->set_var('balsuoti',$balsuoti); $tpl->set_var('atsakymas',$atsakymas); $query_banner=mysql_query("SELECT * FROM banners WHERE aktyvi=1 AND puse=0 ORDER BY eile ASC"); $banneriai='
  '; while($banneri_duomenys=mysql_fetch_array($query_banner)){ $banneriai.='
'.$banneri_duomenys['antraste'].'
'; } $banneriai.='
 
'; $tpl->set_var('banneriai',$banneriai); set_promo(); tpl_end($tpl, ' '); //require_once("skaitliukas.php"); exit; }else{ //get_top_id(); if(in_array($lang, $allow_langs)) { $tpl = tpl_start("/mainpage_$lang.tpl.html"); }else{ header('location:home'); exit(); } $banners = new banners($cHdb, $lang, 'admin/'); $banners_list = $banners->__render(1,$config,1); $tpl->set_var('banners1_out',$banners_list); $tpl->set_var('padding_slot','padding:10px;'); if($_POST['voite']==1){ include('voite.php'); } /* $query_tips=mysql_query("SELECT textas,id FROM tips WHERE aktyvi=1 ORDER BY parodyta ASC") or die (mysql_error()); $assoc_tips=mysql_fetch_assoc($query_tips); mysql_query("UPDATE tips SET parodyta=parodyta+1 WHERE id=".$assoc_tips['id']); $tpl->set_var("tips", $assoc_tips['textas']);*/ $today = date("y-m-d"); $query_tips=mysql_query("SELECT COUNT(*) AS kiekis FROM category WHERE s_id IN (SELECT s_id FROM supercategory WHERE parent=36) AND sdate='$today'") or die (mysql_error()); $assoc_tips=mysql_fetch_assoc($query_tips); $kiekis=$assoc_tips['kiekis']; if($kiekis==0){ $query_tips=mysql_query("SELECT s_id FROM category WHERE s_id IN (SELECT s_id FROM supercategory WHERE parent=36) AND sdate!='$today' ORDER by kiekis ASC LIMIT 1") or die (mysql_error()); $assoc_tips=mysql_fetch_assoc($query_tips); mysql_query("UPDATE category SET kiekis=kiekis+1,sdate='$today' WHERE s_id=".$assoc_tips['s_id']); } $query_tips=mysql_query("SELECT maintext_lt AS textas FROM category WHERE s_id IN (SELECT s_id FROM supercategory WHERE parent=36) AND sdate='$today'") or die (mysql_error()); $assoc_tips=mysql_fetch_assoc($query_tips); $tpl->set_var("tips", $assoc_tips['textas']); $query_apklausos_id=mysql_query("SELECT * FROM apklausa WHERE aktyvi=1 LIMIT 1") or die(mysql_query()); $fetch_assoc_apklausos=mysql_fetch_assoc($query_apklausos_id); $ids=$fetch_assoc_apklausos['id']; if($ids==NULL){ $ids=0;} /* $query_apklausos_klausimas=mysql_query("SELECT * FROM apklausa WHERE id=".$ids); $fetch_assoc_apklausos_klausimas=mysql_fetch_assoc($query_apklausos_klausimas); */ $tpl->set_var('klausimas',$fetch_assoc_apklausos['klausimas']); $hidden=''; $tpl->set_var('hidden',$hidden); $query_apklausos_balsuotojiai=mysql_query("SELECT id FROM balsavimas WHERE apklausos_id=".$ids." AND balsuotojo_ip='".getenv("REMOTE_ADDR")."'") or die(mysql_error()); $num_rows_apklausos_balsuotojas=mysql_num_rows($query_apklausos_balsuotojiai); if($num_rows_apklausos_balsuotojas==0){ for($i=1;$i<=6;$i++){ $query_atsakymas=mysql_query("SELECT atsakymas".$i." FROM apklausa WHERE id=".$ids) or die(mysql_error()); $assoc_atsakymas=mysql_fetch_assoc($query_atsakymas); if($assoc_atsakymas['atsakymas'.$i]!=''){ if($i==1){ $chk='checked'; } else { $chk=''; }; $atsakymas.='  '.$assoc_atsakymas['atsakymas'.$i].'
'; } } $balsuoti=''; } else { $balsuoti=''; $query_apklausa_balsuotojiai=mysql_query("SELECT COUNT(id) FROM balsavimas WHERE apklausos_id=".$ids); $assoc_apklausa=mysql_fetch_assoc($query_apklausa_balsuotojiai); $total=$assoc_apklausa['COUNT(id)']; for($i=1;$i<=6;$i++){ $query=mysql_query("SELECT COUNT(balas) FROM balsavimas WHERE apklausos_id=".$ids." AND balas=".$i) or die(mysql_error()); $assoc=mysql_fetch_assoc($query) or die(mysql_error()); $query_klausiams=mysql_query("SELECT atsakymas".$i." FROM apklausa WHERE id=".$ids) or die(mysql_error()); $assoc_klausimas=mysql_fetch_assoc($query_klausiams) or die(mysql_error()); if($assoc_klausimas['atsakymas'.$i]!=''){ $imagewidth=($assoc['COUNT(balas)']/$total)*100; $imagewidth = number_format($imagewidth, 0, '.', ''); $atsakymas.=$assoc_klausimas['atsakymas'.$i].'
'.$imagewidth.' '.$assoc['COUNT(balas)'].' ('.$imagewidth.'%)
'; } }$atsakymas.='
Ačiū, Jūs jau pareiškėte savo nuomonę...'; } $tpl->set_var('balsuoti',$balsuoti); $tpl->set_var('atsakymas',$atsakymas); $query_banner=mysql_query("SELECT * FROM banners WHERE aktyvi=1 AND puse=0 ORDER BY eile ASC"); $banneriai='
  '; while($banneri_duomenys=mysql_fetch_array($query_banner)){ $banneriai.='
'.$banneri_duomenys['antraste'].'
'; } $banneriai.='
 
'; $tpl->set_var('banneriai',$banneriai); if($data['s_id']==1) { $tpl->process('flashSlot','LietuvosMap'); }elseif($data['s_id']==22) { $tpl->process('flashSlot','EuroposMap_pazintinis'); }elseif($data['s_id']==23) { $tpl->process('flashSlot','EuroposMap_testas'); } if($data['s_id']==1) { $tpl->set_var('bgr_1_style', 'block'); }else{ $tpl->set_var('bgr_1_style', 'none'); } if($data['s_id']==5) { $tpl->set_var('bgr_2_style', 'block'); }else{ $tpl->set_var('bgr_2_style', 'none'); } if(($_GET['page']=='tst')&&(!isset($_GET['sud_lygis']))) { $tpl->set_var('bgr_3_style', 'block'); }else{ $tpl->set_var('bgr_3_style', 'none'); } if(($_GET['page']=='kon')&&(!isset($_GET['klase_id']))) { $tpl->set_var('bgr_4_style', 'block'); }else{ $tpl->set_var('bgr_4_style', 'none'); } #$flashadmin = new flashadmin($cHdb,$lang); #$tpl->set_var('flash_ct', $flashadmin->__render()); $tpl->set_var("print_page_source", urlencode("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])); //print_menu(); //$pages = array('1'=>'Apie mus','2'=>'Klauskite','3'=>'Kontaktai','5'=>'Gamyba','4'=>'Moksliniai tyrimai'); //$tpl->set_var('current_page',$pages[$data['s_id']]); $current_pid = $tools->getMasterId($cHdb, $lang, $data['p_id']); $logo_a = array(1, 2, 3); if(in_array($current_pid, $logo_a)) { $tpl->set_var('logo_didelis','logo_ollo_'.$current_pid.'.png'); }else{ $tpl->set_var('logo_didelis','logo_big.gif'); } switch ($data['page']) { case 'sitemap': $map = new sitemap($cHdb, $lang, TRUE, 7); $map->__render(); $data = $map->get_data(); $tpl->set_var('__data','
'.$data.'
'); break; case 'search': $search = new search($cHdb, $lang); $search->__dispach(); $data = $search->get_data(); $tpl->set_var('__data','
'.$data.'
'); //$tpl->set_file('info', '/sitemap.tpl.html', 1); //$tpl->set_file('search_file', '/search_lt.tpl.html', 1); //set_search_variables(); break; case 'map_lietuva': $map = new map_lietuva($cHdb, $lang,'admin/', FALSE); $map->__render(); $tpl->set_var('sub_menu_title', $map->getTitle()); $tpl->set_var('__data', $map->getImages().$map->get_renderData()); break; case 'map_europa_pazintinis': $tpl->set_var('padding_slot',''); $map = new map_europa_pazintinis($cHdb, $lang, 'admin/', FALSE); $map->__render(); $tpl->set_var('sub_menu_title', '
'.$map->getTitle().'
'); $tpl->set_var('__data', '
'.$map->getImages().'
'.$map->get_renderData()); break; case 'map_europa_testas': $map = new map_europa_testas($cHdb, $lang,'admin/', FALSE); $map->__render(); $tpl->set_var('sub_menu_title', $map->getTitle()); $tpl->set_var('__data', $map->get_renderData()); break; case 'tst': $testas = new standartinis_testas($cHdb, $lang,'admin/', FALSE); if(isset($_GET['klase_id'])) { if(isset($_GET['sud_lygis'])) { $testas->__render(); $tpl->set_var('__data', $testas->get_renderData()); }else{ $tpl->set_var('sub_menu_title', $category->getTitleBySid2(6).' » '.$testas->getKlaseTitle($_GET['klase_id'])); $tpl->set_var('__data', $testas->getLygiaiList()); } }else{ $tpl->set_var('sub_menu_title', $category->getTitleBySid2(6)); $tpl->set_var('__data', $testas->getKlasesList()); } $tpl->set_var('current_title','
'.$category->getTitleBySid2(6).'
'); break; case 'kon': $testas = new konkursinis_testas($cHdb, $lang, 'admin/', FALSE); if(isset($_GET['konkursas_id'])) { if(isset($_GET['klase_id'])) { if((isset($_POST['uzpildyta_forma']))||(isset($_SESSION['uzpildyta_forma']))) { $testas->__render(); $tpl->set_var('__data', $testas->get_renderData()); }else{ $tpl->set_var('sub_menu_title', $category->getTitleBySid2(3).' » '.$testas->getKonkursasTitle($_GET['konkursas_id'])); $tpl->set_var('__data', $testas->printForma()); } }else{ $tpl->set_var('sub_menu_title', $category->getTitleBySid2(3).' » '.$testas->getKonkursasTitle($_GET['konkursas_id'])); //$tpl->set_var('__data', $testas->getLygiaiList()); $tpl->set_var('__data', $testas->getKlasesList()); } }else{ $tpl->set_var('sub_menu_title', $category->getTitleBySid2(3)); //$tpl->set_var('__data', $testas->getKlasesList()); $tpl->set_var('__data', $testas->getKonkursaiList()); } $tpl->set_var('current_title','
'.$category->getTitleBySid2(3).'
'); break; case 'siulo': if($_POST['siulyimas']=='siulyimas'){ mysql_query("INSERT INTO apklausa (klausimas,atsakymas1,atsakymas2,atsakymas3,atsakymas4,atsakymas5,atsakymas6,idejimo_data) VALUES ('".$_POST['textfield1']."','".$_POST['textfield2']."','".$_POST['textfield3']."','".$_POST['textfield4']."','".$_POST['textfield5']."','".$_POST['textfield6']."','".$_POST['textfield7']."',NOW())"); $tpl->set_var('nav_menu_output2', 'Jūsų siūlomas klausimas nusiųstas
'); } $tpl->set_var('sub_menu_title','Siūlyti klausimą:'); $siulymo_table='
  Siūlomas klausimas:  
Atsakymas 1:
Atsakymas 2:
Atsakymas 3:
Atsakymas 4:
Atsakymas 5:
Atsakymas 6:
 
'; $tpl->set_var('catalog_menu_output',''.'Įrašykite siulomą klausimą ir galimus atsakymus. Teisingą iš jų pažymėkite „>” simboliu. Spauskite „Siūlyti” ir Jūsų klausimą gaus svetainės administratorius.'); $tpl->set_var('flashSlot',$siulymo_table); break; case 'balsavimai': //echo "balsavimas"; $tpl->set_var('cat_title','Balsavimo rezultatai'); $tpl->set_var('sub_menu_title', 'Kiti klausimai:'); if($_GET['id']==0){ $query_max_id=mysql_query("SELECT MAX(id) FROM apklausa WHERE rodyti=1"); $fetch_max_id=mysql_fetch_assoc($query_max_id); $id=$fetch_max_id['MAX(id)']; $query_klausiams=mysql_query("SELECT * FROM apklausa WHERE id=".$id); } else { $id=$_GET['id']; $query_klausiams=mysql_query("SELECT * FROM apklausa WHERE id=".$id); } $fetch_klausiams=mysql_fetch_assoc($query_klausiams); $d=substr($fetch_klausiams['idejimo_data'],0,10); $tpl->set_var('nav_menu_output2', ''.$fetch_klausiams['klausimas'].' '.$d.''); $balsas.='

'; $query_apklausa_balsuotojiai=mysql_query("SELECT COUNT(id) FROM balsavimas WHERE apklausos_id=".$id); $assoc_apklausa=mysql_fetch_assoc($query_apklausa_balsuotojiai); $total=$assoc_apklausa['COUNT(id)']; for($i=1;$i<=6;$i++){ $query=mysql_query("SELECT COUNT(balas) FROM balsavimas WHERE apklausos_id=".$id." AND balas=".$i) or die(mysql_error()); $assoc=mysql_fetch_assoc($query) or die(mysql_error()); $query_klausiams=mysql_query("SELECT atsakymas".$i." FROM apklausa WHERE id=".$id) or die(mysql_error()); $assoc_klausimas=mysql_fetch_assoc($query_klausiams) or die(mysql_error()); if($assoc_klausimas['atsakymas'.$i]!=''){ if($total==0){ $imagewidth=($assoc['COUNT(balas)']/1)*100; } else { $imagewidth=($assoc['COUNT(balas)']/$total)*100; } $imagewidth = number_format($imagewidth, 0, '.', ''); $balsas.=''; } } $balsas.='
Atsakymai   % Kiekis
'.$assoc_klausimas['atsakymas'.$i].'   '.$imagewidth.' '.$imagewidth.'% '.$assoc['COUNT(balas)'].'
Viso balsavo: '.$total.'
'; $tpl->set_var('__data', $balsas); $query_visi_klausimai=mysql_query("SELECT id,klausimas,idejimo_data FROM apklausa WHERE id!=".$id." AND rodyti=1"); while($fetch_visi_klausimai=mysql_fetch_array($query_visi_klausimai)){ $d=substr($fetch_visi_klausimai['idejimo_data'],0,10); $kiti_kalusimai.=''.$fetch_visi_klausimai['klausimas'].' ('.$d.')
'; } $tpl->set_var('maininfo', '

'.$kiti_kalusimai); break; case 'print_version': $utilities = new Utilities(DB_HOST, DB_NAME, DB_USER, DB_PASS, $db_tables, $lang); //$file = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //$file = "http://".$_SERVER['HTTP_HOST']."/index.php"; //echo $file; //$print_version = true; $utilities->printVersion(MODULES_TEMPLATE_PATCH, $_GET['source'],false, true); //$utilities->printVersion(MODULES_TEMPLATE_PATCH, 'http://www.tamara.lt/index.php?s_id=3&lang=lt',true, true); //$tpl->set_var('maininfo', $file); exit; break; default: //default page - print categories $tpl->set_file('info', '/info_page.tpl.html', 1); $tpl->set_file('menu', '/menu.tpl.html', 1); // selected page by type switch ($data['type']) { case 'n': // set news variables include_once('include/news_list.cls.php'); $news = new news_list($lang); // if($_GET['type']=='n'){ if (!empty($_GET['date'])) $cur_date = $_GET['date']; else $cur_date = date('Y.n.d'); $news->date = $cur_date; $news->set_attribute('show_date'); $news->set_attribute('show_archive'); $news_s_id = $data['s_id']; $news_output = $news->process_news_list(); $tpl->set_var('page_title', $data["title_$lang"]); $tpl->set_var('cat_item_output', $news_output); unset($news); //} //else{ // $query_grupes=mysql_query("SELECT s_id,title_lt AS grupe FROM supercategory WHERE parent=43 ORDER BY title_lt ASC"); // while($row=mysql_fetch_array($query_grupes)){ // $values[] = array( //'value'=> sprintf($row['grupe']), // 'selected'=>($data['grupe']==$row['s_id'])?'selected':'', // ); // } // $tpl->set_loop('news_list_names_loop', $values); //} break; case 'g': // set galery variables include_once('./include/images_gallery.cls.php'); set_cat_variables(); $gallery = new images_gallery($data['s_id']); $gallery->root_path = ROOT_PATH; $gallery->gallery_img_path = GALERY_IMG_PATH; $gallery->column_num = 4; $gallery->site_www_address = SITE_WEB_ADDRESS; $output = $gallery->process(); $tpl->set_var('gallery_output', $output); break; case 'gf': // set files galery variables include_once('galery_files_list.php'); set_galery_files_variables(); break; case 'f': // set form variables include_once('include/forms.cls.php'); $order_form = new form("forms/form_uzsakymas_$lang.tpl.html"); $order_form->form_mail_file = 'forms/form_uzsakymas_mail.tpl.html'; $form_data = $order_form->process_form(); $tpl->set_var('form_output', $form_data); set_cat_variables(); break; case 'ct': // katalogas $catalog = new catalog($cHdb, $lang, $db_tables['catalog'], $db_tables['catalog_items']); $__data = $catalog->get_data(); $tpl->set_var('__data',$__data); if($data['p_id']!=0) { $__navigation = $catalog->get_navigation('Prekyba /'); $tpl->set_var('__navigation',$__navigation); } break; default: // set category variables set_cat_variables(); break; } $exp = explode('.', $data['exp']); $data['exp'] = $exp[0]; //spausdinam svetaines navigacine juosta ir meniu // getPatch(MODULES_TEMPLATE_PATCH, $s_id, rodyt pirma elementa, rodyt paskutini el., nuo kurio lygio rodyti) if (valid($data['s_id'])) { $nav_string = $category->getPatch(MODULES_TEMPLATE_PATCH, $data['s_id'],0, 1, 1); if(!empty($nav_string)) $tpl->set_var('nav_tree_output', $nav_string); $sub_menu_string = $category->getSiteTree(MODULES_TEMPLATE_PATCH, MODULES_PICTURES_PATCH, $lang, $data['s_id'], 1, 0, 0, "tree.tpl", "nav_menu_bullet.gif"); if($tools->getSimpleMasterId($cHdb,$lang,$data['s_id'])) { $tpl->set_var('current_title',' '.$category->getTitleBySid2($data['s_id'])); }else{ $tpl->set_var('current_title','
'.$category->getTitleBySid2($data['s_id']).'
'); } $masterSID = $tools->getSimpleMasterId($cHdb,$lang,$data['s_id']); if(!empty($sub_menu_string)) { $tpl->set_var("nav_menu_output2", $sub_menu_string); } if($data['exp'] != $data['s_id'] AND $data['type'] != 'n') { $tpl->set_var('sub_menu_title', stripslashes($data["title"])); $tpl->process('sub_out','sub_menu_block'); $tpl->process('main_back_output', 'main_back_block'); }else{ $tpl->set_var('sub_menu_title', $category->getTitleBySid2($data['s_id'])); } } $tpl->process('maininfo', 'info', 1); } global $data; //spausdinam pagrindini sablona $tpl->set_var('charset', htmlspecialchars($charset)); $tpl->set_var('web_address', addslashes($_SERVER['REQUEST_URI'])); if (valid($data['page'])) $tpl->set_var('page', "&page=". $data['page']); $tpl->set_var('lang', $lang); $tpl->set_var('s_id', $data['s_id']); $tpl->set_var('exp', $data['exp']); tpl_end($tpl, ' '); } mysql_close($db); //##################################################################### // FUNCTIONS // // nustatome kintamuosius - vieno puslapio atsakose // function set_cat_variables () { global $db_tables, $tpl, $data, $lang; $tpl->set_file('cat_file', '/kategorija.tpl.html', 1); $tpl->set_var('s_id', $data['s_id']); $tpl->set_var('lang', $lang); //$tpl->set_var('cat_title', slash_clean(get_supercategory($data['s_id']))); $query = "SELECT $db_tables[cat].maintext_$lang AS text, $db_tables[supercat].title_$lang AS title FROM $db_tables[cat], $db_tables[supercat] WHERE $db_tables[cat].s_id='$data[s_id]' AND $db_tables[supercat].s_id='$data[s_id]'"; get_cat_data($query); $tpl->set_var('text_var', stripslashes($data['text'])); //$tpl->set_var('sub_menu_title', stripslashes($data['title'])); // output info $tpl->process('cat_item_output', 'cat_file'); } // // save new mail to mailing list // function update_mailing_list(){ global $data, $db_tables, $lang; //tikrinam ar toks yrasas jau yra foreach (array_keys($_POST) as $key){ $_POST[$key] = addslashes($_POST[$key]); } $_POST['mail'] = trim($_POST['mail']); $query = "SELECT id, mail FROM $db_tables[mail_list] WHERE mail='$_POST[mail]'"; $result = mysql_query($query) or die(mysql_error()); if (@mysql_num_rows($result) > 0) { //kadangi toks jau yra, triname lauk $query = "DELETE FROM $db_tables[mail_list] WHERE mail='$_POST[mail]'"; mysql_query($query) or die(mysql_error()); // isiunciam zinute kad ismetem is registruotu saraso send_notice_mail('unregister', $_POST['mail']); return; } $query = "INSERT INTO $db_tables[mail_list] (name,company,pareigos,tel,faks,adresas,mail,web,komentaras) VALUES ('$_POST[vardas]', '$_POST[imone]', '$_POST[pareigos]', '$_POST[tel]', '$_POST[faks]', '$_POST[adresas]', '$_POST[mail]', '$_POST[web]', '$_POST[klausimas]')"; mysql_query($query) or die(mysql_error()); send_notice_mail('register', $_POST['mail']); return 1; } //laisko siuntimas - maiilngui function send_notice_mail($act,$mail) { global $tpl, $lang, $charset, $mailing_data; if (valid($mail)) { if ($act == 'unregister') { $tpl->set_file('notice_file','/admin/mailing/mail_unregister_form.tpl.html'); $subject = "Registracijos nutraukimo patvirtinimas"; } else { $tpl->set_file('notice_file','/admin/mailing/mail_register_form.tpl.html'); $subject = "Registracijos patvirtinimas"; } $recipient = $mail; $mailheaders = "From: <$mailing_data[from]> \n"; $mailheaders .= "Mime-Version: 1.0\nContent-Type: text/html; charset=$charset\nContent-Transfer-Encoding: 7bit \n"; $mailheaders .= "Reply-To: <$mailing_data[replay_to]>\n\n"; $msg = $tpl->get_var('notice_file'); mail($recipient, $subject, $msg, $mailheaders) or die ("Failed..."); } } // // get category data from db // function get_cat_data($query){ global $db_tables, $data, $lang; $result = mysql_query($query) //or die("db error: can't retrieve data"); or die(mysql_error()); $row = mysql_fetch_array($result); //or die("db error: data not found"); //or die(mysql_error()); if (!empty($row)) { foreach (array_keys($row) as $key){ $data[$key] = $row[$key]; } } return 1; } // // set form variables // function format_date($date){ $date_format = date("Y-m-d",strtotime($date)); $date_format = '['. $date_format. ']'; return $date_format; } // // set form variables // function up_case($str){ $str = strtoupper($str); $upper_str = strtr($str, "?????????", "?????????"); return $upper_str; } function esc_spec_char(&$data){ if (!get_magic_quotes_gpc()) { foreach (array_keys($data) as $key){ $data[$key] = addslashes($data[$key]); $data[$key] = str_replace('$', "\$", $data[$key] ); } } } // // init fields of category // function init_data(){ $data = array( 'page' => '', 's_id' => '', 'cat_id' => '', 'text' => '', 'title' => '', 'exp' => '' ); return $data; } // // nustatome galerijos kintamuosius // function set_sitemap_variables () { global $db_tables, $tpl, $data, $lang, $tmp_out_var; $sitemap = array('lt'=>'Svetain?s strukt?ra','en'=>'Site map','ru'=>'Site map ru','de'=>'Site map de'); //$tpl->set_file('sitemap_file', '/sitemap.tpl.html', 1); $tpl->set_var('lang', $lang); $tpl->set_var($out_var, ''); $tmp_out_var = 'site_map_output'; $page_title = $sitemap[$lang]; $_GET['exp'] = $data['exp'] = '1000'; $spacer_width = -15; $exp = explode('.', $data['exp']); $tpl->set_var('exp', '1000'); $tpl->set_var('s_id', $data['s_id']); $tpl->set_var('lang', $lang); print_site_map('', '', $spacer_width); // output info } // // nustatome galerijos kintamuosius // function print_categories2 ($out_var) { global $db_tables, $tpl, $data, $lang, $tmp_out_var; //$tpl->set_file('sitemap_file', '/sitemap.tpl.html', 1); $tpl->set_var($out_var, ''); $tmp_out_var = $out_var; $tpl->set_var('s_id', $data['s_id']); $tpl->set_var('lang', $lang); $page_title = $sitemap[$lang]; $tpl->set_var('page_title', $page_title); $spacer_width = -15; $exp = $data['exp']; print_site_map($exp, $exp, $spacer_width); $tpl->set_var("supercat_title", get_supercat_title(get_top_id())); // output info } // // nustatome galerijos kintamuosius // function print_categories3 ($out_var, $exp, $s_id) { global $db_tables, $tpl, $data, $lang, $tmp_out_var; //$tpl->set_file('sitemap_file', '/sitemap.tpl.html', 1); $tpl->set_var($out_var, ''); $tmp_out_var = $out_var; $tpl->set_var('s_id', $data['s_id']); $tpl->set_var('lang', $lang); $page_title = $sitemap[$lang]; $tpl->set_var('page_title', $page_title); $spacer_width = -15; //$exp = $data['exp']; print_site_map($exp, $s_id, $spacer_width); $tpl->set_var("supercat_title", get_supercat_title(get_top_id())); // output info } // // get top category id // function get_top_id(){ global $data; $exp = explode('.', $data['exp']); // get cats list return($exp[0]); } // // nustatome popupo kintamuosius // function set_promo () { global $db_tables, $tpl, $data, $lang, $charset; //$tpl->set_file("aa", "/promo.tpl.html", 1); $tpl->set_var('lang', $lang); $query = "SELECT pr_id, file_big_$lang AS file_big FROM $db_tables[promo] WHERE active = '1'"; $result = mysql_query($query); if (!empty($result))$num_rows = mysql_num_rows($result); //echo "num_rows=".$num_rows; if ($num_rows == 0) return; while($row = mysql_fetch_array($result)) { $promo_id[] = $row['pr_id']; $promo_file[] = $row['file_big']; } //get random value from array mt_srand((double) microtime() * 1000000); $random_index = mt_rand(0, (count($promo_id)-1)); $promo_rand_id = $promo_id[$random_index]; //var_dump($promo_file); if ($promo_file[$random_index] == 'none' OR $promo_file[$random_index] == '' ) return; $tpl->set_var('promo_id', $promo_rand_id); $tpl->process('popup_output', 'popup_block'); } ?>