get_city_name($temp['city_id'], $this->sets['lang']);
if($temp['content'])
foreach ($temp['content'] as $k=>$day){
if($d!=$td){
$day_title=(($data['temp_weekdays']!='y')?'':$this->week_days[$this->sets['lang']][(($d+$w)%7)]);
$route[]=array(
'day_num'=>($d+1),
'day_title'=>$day_title,
'city'=>$city_title,
'content'=>array()
);
}
else{
$route[sizeof($route)-1]['city'].=' - '.$city_title;
}
$sort=array();
$td=$d;
if(isset($day['sightseeing']) && sizeof($day['sightseeing'])>0){
foreach ($day['sightseeing'] as $g=>$m){
if(isset($m['id']) && $m['id']>0){
$sql='select tbs_'.$this->sets['lang'].',
tbs_itinerary_'.$this->sets['lang'].' as tbs_itinerary
from tms_service_sightseeing_advanced
left join tms_service_sightseeing on sightseeing=tbs_id
where id='.$m['id'];
$ttemp=$db->sql2rec($sql);
$title=''.$ttemp['tbs_'.$this->sets['lang']].'
'.$ttemp['tbs_itinerary'];
}
else $title=$m['short_title'];
$sort[]=array(
'title'=>$title,
'sort'=>(!isset($m['sort']))?0:$m['sort']
);
}
}
if(isset($day['transfer']) && sizeof($day['transfer'])>0){
foreach ($day['transfer'] as $g=>$m){
if(isset($m['id']) && $m['id']>0){
$sql='select tbtr_'.$this->sets['lang'].',
tbtr_itinerary_'.$this->sets['lang'].' as tbtr_itinerary
from tms_service_transfers_advanced
left join tms_service_transfers on transfer=tbtr_id
where id='.$m['id'];
$ttemp=$db->sql2rec($sql);
$title=''.$ttemp['tbtr_'.$this->sets['lang']].'
'.$ttemp['tbtr_itinerary'];
}
else $title=$m['short_title'];
$sort[]=array(
'title'=>$title,
'sort'=>(!isset($m['sort']))?0:$m['sort']
);
}
}
if(isset($day['theatre']) && sizeof($day['theatre'])>0){
foreach ($day['theatre'] as $g=>$m){
if(isset($m['id']) && $m['id']>0){
$sql='select tbt_'.$this->sets['lang'].',
tbt_itinerary_'.$this->sets['lang'].' as tbt_itinerary
from tms_service_theatres_advanced
left join tms_service_theatres on theatres=tbt_id
where id='.$m['id'];
$ttemp=$db->sql2rec($sql);
$title=''.$ttemp['tbtr_'.$this->sets['lang']].'
'.$ttemp['tbtr_itinerary'];
}
else $title=$m['short_title'];
$sort[]=array(
'title'=>$title,
'sort'=>(!isset($m['sort']))?0:$m['sort']
);
}
}
if(isset($day['package']) && sizeof($day['package'])>0){
foreach ($day['package'] as $g=>$m){
$id=0;
if(isset($m['id']) && $m['id']>0)$id=$m['id'];
elseif(isset($m['link']) && $m['link']>0)$id=$m['link'];
if($id>0){
$sql='select tbp_'.$this->sets['lang'].',
tbp_itinerary_'.$this->sets['lang'].' as tbp_itinerary
from tms_service_package
where tbp_id='.$id;
$ttemp=$db->sql2rec($sql);
$title=''.$ttemp['tbp_'.$this->sets['lang']].'
'.$ttemp['tbp_itinerary'];
}
else $title=$m['short_title'];
$sort[]=array(
'title'=>$title,
'sort'=>(!isset($m['sort']))?0:$m['sort']
);
}
}
if(isset($day['comment']) && sizeof($day['comment'])>0){
foreach ($day['comment'] as $g=>$m){
$id=0;
if(isset($m['id']) && $m['id']>0)$id=$m['id'];
if($id>0){
$sql='select tbc_'.$this->sets['lang'].',
tbc_itinerary_'.$this->sets['lang'].' as tbc_itinerary
from tms_service_comment
where tbc_id='.$id;
$ttemp=$db->sql2rec($sql);
$title=''.$ttemp['tbc_'.$this->sets['lang']].'
'.$ttemp['tbc_itinerary'];
}
else $title=$m['short_title'];
$sort[]=array(
'title'=>$title,
'sort'=>(!isset($m['sort']))?0:$m['sort']
);
}
}
usort($sort, 'sortrec');
$tdd=sizeof($route)-1;
foreach($sort as $el)
$route[$tdd]['content'][]=$el;
if($k<$temp['city_days']-1) $d++;
}
$ddd=0;
if(isset($temp['intercity']) && sizeof($temp['intercity'])>0){
foreach ($temp['intercity'] as $k=>$v){
if(isset($v['id']) && $v['id']>0){
$sql='select tbis_'.$this->sets['lang'].',
tbis_itinerary_'.$this->sets['lang'].' as tbis_itinerary
from tms_service_intercity_advanced
left join tms_service_intercity on intercity=tbis_id
where id='.$v['id'];
$temp=$db->sql2rec($sql);
$title=''.$temp['tbis_'.$this->sets['lang']].'
'.$temp['tbis_itinerary'];
}
else $title=$v['short_title'];
$route[$tdd]['content'][]=array(
'title'=>$title,
'sort'=>sizeof($route[$tdd]['content'])
);
if($v['days']>$ddd)$ddd=$v['days'];
}
}
else $ddd=1;
$d+=$ddd;
}
$this->assign('template_full', $route);
}
function subscribe_newletter(){
global $db, $translate;
global $vars;
$subject='Join to newsletter';
$message="
Join to newsletter
Email: {$vars['email']}
Language: {$this->sets['lang']}
";
$this->send_mail($this->sets['email'], $subject, $message);
$sql=sprintf("insert into letters set l_date='%s', l_subject='%s', l_message='%s'",
gmdate('Y-m-d'),
$db->quote_field($subject),
$db->quote($message));
$db->query($sql);
die("document.forms['search_form'].newsletter.value='';alert('{$translate[$this->sets['lang']]['confirmation_email_subscribe']}'); ");
}
function newsdesk(){
global $db;
global $vars;
if($this->sets['item']!='')
$temp=explode('_', $this->sets['item']);
else $temp=array(0=>'page', 1=>1);
if($temp && $temp[0]=='news'){
$r=$db->sql2array('
select news_title, news_full,
news_description, news_keywords,
date_format(news_date, "%d.%m.%Y") as news_date
from news
where news_show="y" and
news_lang="'.$this->sets['lang'].'" and
news_id='.$temp[1]
);
if($r && sizeof($r)>0){
$this->assign('item', $r[0]);
$this->smarty_vars['item']['description']=$r[0]['news_description'];
$this->smarty_vars['item']['keywords']=$r[0]['news_keywords'];
$this->smarty_vars['item']['page_title']=$r[0]['news_title'];
$this->smarty_vars['item']['title']=$r[0]['news_title'];
$this->smarty_vars['item']['date']=$r[0]['news_date'];
$this->smarty_vars['item']['text']=$r[0]['news_full'];
$this->template='news_view.tpl';
}
else{
$this->sets['item']='';
return $this->newsdesk();
}
}
else{
$vars['p_id']=$temp[1];
$count=$this->sets['news_per_page']; $start=($vars['p_id']-1)*$count;
$news_res=$db->sql2array("select count(news_id) as kolvo from news where news_lang='{$this->sets['lang']}'");
$this->pages_counter($vars['p_id'], $news_res[0]['kolvo'], $count);
$r=$db->sql2array('select news_id, news_title, news_short, date_format(news_date, "%d.%m.%Y") as news_data from news where news_show="y" and news_lang="'.$this->sets['lang'].'" order by news_date desc limit '.$start.', '.$count);
$this->assign('news_list', $r);
$this->template='news_list.tpl';
}
}
/*
function pages_counter($current_page, $total, $per_page){
$pages_display=10;
$pages=floor($total/$per_page);
$pages+=($total%$per_page==0)?0:1;
$page_list=array();
$start=1; $finish=$pages;
// if($pages<=$pages_display){$start=1; $finish=$pages;}
// else{
// if($current_page<=floor($pages_display/2)){$start=1; $finish=$pages_display;}
// elseif($pages-$current_page<=floor($pages_display/2)){$start=$pages-$pages_display+1; $finish=$pages;}
// else {$start=$current_page-floor($pages_display/2); $finish=$start+$pages_display-1;}
// }
for($i=$start;$i<=$finish;$i++) $page_list[]=$i;
if($current_page>1)$previous=$current_page-1; else $previous=-1;
if($current_page<$pages)$next=$current_page+1; else $next=-1;
if(sizeof($page_list)<2)$page_list=false;
$this->assign('cur_page', $current_page);
$this->assign('pages', $page_list);
$this->assign('next', $next);
$this->assign('previous', $previous);
}
*/
function guestbook_lang(){
global $db;
global $vars;
switch($vars['action']){
case 'save':
$sql=$db->sql2var("select a_code as code from antibot where a_key='{$vars['key']}'");
if($GLOBALS['code']==strtolower($vars['code'])){
$vars['text']=nl2br($vars['text']);
$sql=sprintf("insert into messages set m_date='%s', m_text='%s', m_key='', m_name='%s', m_tour=%d, m_lang='%s', m_period='%s'",
gmdate("Y-m-d"), $db->quote_field($vars['text']), $db->quote_field($vars['name']),
$vars['tour_id'], $this->sets['lang'], $db->quote_field($vars['period']));
$db->query($sql);
if($vars['tour_id']==0){
$db->query(sprintf("insert into tour_other(to_m_id, to_tour) values(%d, '%s')",
$db->insert_id(),
$db->quote_field($vars['other']))
);
}
$date=gmdate('Y-m-d');
$db->sql2var("delete from antibot where a_key='{$vars['key']}' or a_date<'$date'");
}
$vars['action']='list';
return $this->guestbook_lang();
break;
case 'search_region':
$mes_res=$db->sql2value("select count(m_id) as kolvo from messages, link_region_message where l_m_id=m_id and l_region_id={$vars['region']} and m_lang='{$this->sets['lang']}'and m_flag='y'");
$sql='
(select m_id, m_text, m_name, m_date, date_format(m_date, "%d.%m.%Y") as m_from, m_period, m_flag, m_lang,
page_title as m_tour
from messages, pages_'.$this->sets['lang'].', tours, link_region_message
where l_m_id=m_id and l_region_id='.$vars['region'].' and m_tour=tour_id and page_link=tour_link and m_lang="'.$this->sets['lang'].'" and m_flag="y"'.$str_t.')
union
(select m_id, m_text, m_name, m_date, date_format(m_date, "%d.%m.%Y") as m_from, m_period, m_flag, m_lang,
to_tour as m_tour
from messages, tour_other, link_region_message
where l_m_id=m_id and l_region_id='.$vars['region'].' and m_id=to_m_id and m_lang="'.$this->sets['lang'].'" and m_flag="y"'.$str_o.')
order by m_date desc
limit ';
$this->assign('val_reg', $vars['region']);
break;
case 'search_ref':
$mes_res=$db->sql2value("select count(m_id) as kolvo from messages, tours where tour_ref='{$vars['ref']}' amd m_tour=tour_is and m_lang='{$this->sets['lang']}'and m_flag='y'");
$sql='
select m_id, m_text, m_name, m_date, date_format(m_date, "%d.%m.%Y") as m_from, m_period, m_flag, m_lang,
page_title as m_tour
from messages, pages_'.$this->sets['lang'].', tours where tour_ref="'.$vars['ref'].'" and m_tour=tour_id and page_link=tour_link and m_lang="'.$this->sets['lang'].'" and m_flag="y"
order by m_date desc
limit ';
$this->assign('val_ref', $vars['ref']);
break;
case 'search_tour':
$arr=explode(' ', $vars['tour']);
$str_t=''; $str_o='';
if($arr && sizeof($arr)>0)
foreach ($arr as $i){
$el=trim($i, "\x00..\x20");
if($el!='' && strlen($el)>2){
$str_t.=" or page_title_{$this->sets['lang']} like '%$el%'";
$str_o.=" or to_tour like '%$el%'";
}
}
if($str_t==''){
$vars['action']='list';
return $this->guestbook_lang();
}
else{
$str_t=' and ('.substr($str_t, 4).')';
$str_o=' and ('.substr($str_o, 4).')';
}
$mes_res=$db->sql2value("select count(m_id) from messages, tours, pages_'.$this->sets['lang'].' where page_link=tour_link and tour_id=m_tour and m_lang='{$this->sets['lang']}' and m_flag='y'$str_t");
$mes_res+=$db->sql2value("select count(m_id) from messages, tour_other where to_m_id=m_id and m_lang='{$this->sets['lang']}' and m_flag='y'$str_o");
$sql='
(select m_id, m_text, m_name, m_date, date_format(m_date, "%d.%m.%Y") as m_from, m_period, m_flag, m_lang,
page_title as m_tour
from messages, pages_'.$this->sets['lang'].', tours where m_tour=tour_id and page_link=tour_link and m_lang="'.$this->sets['lang'].'" and m_flag="y"'.$str_t.')
union
(select m_id, m_text, m_name, m_date, date_format(m_date, "%d.%m.%Y") as m_from, m_period, m_flag, m_lang,
to_tour as m_tour
from messages, tour_other where m_id=to_m_id and m_lang="'.$this->sets['lang'].'" and m_flag="y"'.$str_o.')
order by m_date desc
limit ';
$this->assign('val_tour', $vars['tour']);
break;
default:
$lang=$this->sets['lang'];
if($lang=='us' || $lang=='en' || $lang=='in')
$lang=' in ("en", "us", "in") ';
else $lang='="'.$lang.'" ';
$mes_res=$db->sql2value('
select count(m_id) from messages
where m_lang'.$lang.' and m_flag="y"
');
//
if($this->sets['lang']=='us' || $this->sets['lang']=='en' || $this->sets['lang']=='in'){
$sql='
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d") as m_dd,
date_format(m_date, "%c") as m_mm,
date_format(m_date, "%Y") as m_yy,
m_period, m_flag, m_lang,
page_title as m_tour
from messages
left join tours on m_tour=tour_id
left join pages_en on tour_link=page_link
where m_tour>0 and m_lang="en" and m_flag="y")
union
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d") as m_dd,
date_format(m_date, "%c") as m_mm,
date_format(m_date, "%Y") as m_yy,
m_period, m_flag, m_lang,
page_title as m_tour
from messages
left join tours on m_tour=tour_id
left join pages_us on tour_link=page_link
where m_tour>0 and m_lang="us" and m_flag="y")
union
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d") as m_dd,
date_format(m_date, "%c") as m_mm,
date_format(m_date, "%Y") as m_yy,
m_period, m_flag, m_lang,
page_title as m_tour
from messages
left join tours on m_tour=tour_id
left join pages_in on tour_link=page_link
where m_tour>0 and m_lang="in" and m_flag="y")
union
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d") as m_dd,
date_format(m_date, "%c") as m_mm,
date_format(m_date, "%Y") as m_yy,
m_period, m_flag, m_lang,
to_tour as m_tour
from messages
left join tour_other on m_id=to_m_id
where m_tour=0 and m_lang'.$lang.' and m_flag="y")
order by m_date desc
limit ';
/*
*/
}
else{
$sql='
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d") as m_dd,
date_format(m_date, "%c") as m_mm,
date_format(m_date, "%Y") as m_yy,
m_period, m_flag, m_lang,
page_title as m_tour
from messages
left join tours on m_tour=tour_id
left join pages_'.$this->sets['lang'].' on tour_link=page_link
where m_tour>0 and m_lang'.$lang.' and m_flag="y")
union
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d") as m_dd,
date_format(m_date, "%c") as m_mm,
date_format(m_date, "%Y") as m_yy,
m_period, m_flag, m_lang,
to_tour as m_tour
from messages
left join tour_other on m_id=to_m_id
where m_tour=0 and m_lang'.$lang.' and m_flag="y")
order by m_date desc
limit ';
}
$vars['action']='list';
}
$this->assign('val_action', $vars['action']);
//form search
$sql1='select distinct tour_ref from tours
where tour_id in (select distinct l_tour_id from link_tour_block)
order by tour_ref';
$this->assign('refli', $db->sql2array($sql1));
$this->assign('regli', $db->sql2array('select region_id, region_title_'.$this->sets['lang'].' as region_title from region order by region_title'));
//form add
$sql1='select tour_id, page_title as tour_title
from tours left join pages_'.$this->sets['lang'].' on tour_link=page_link
where tour_id in (select distinct l_tour_id from link_tour_block)
order by tour_title';
// and
$this->assign('tgb', $db->sql2array($sql1));
$pid=($vars['pid']==0)?1:$vars['pid'];
if($pid>$mes_res)$pid=1;
$count=10; $start=($pid-1)*$count;
$this->pages_counter($pid, $mes_res, $count);
$sql.=$start.', '.$count;
$res=$db->sql2array($sql);
if($res)
foreach($res as $k=>$v){
$res[$k]['m_from']=$v['m_dd'].' '.$this->months[$this->sets['lang']][$v['m_mm']-1].' '.$v['m_yy'];
unset($res[$k]['m_dd']);
unset($res[$k]['m_mm']);
unset($res[$k]['m_yy']);
}
$this->assign('meslist', $res);
$key=$this->get_pass();
$code=$this->get_pass();
$db->query(sprintf("insert into antibot(a_key, a_code, a_date) values('%s', '%s', '%s')", $db->quote($key), $db->quote($code), $db->quote(gmdate("Y-m-d"))));
$this->assign('key', $key);
$this->template='guestbook.tpl';
}
function guestbook(){
global $db;
global $vars;
return $this->guestbook_lang();
switch($vars['action']){
case 'save':
$sql=$db->sql2var("select a_code as code from antibot where a_key='{$vars['key']}'");
if($GLOBALS['code']==strtolower($vars['code'])){
$vars['text']=nl2br($vars['text']);
$sql=sprintf("insert into messages set m_date='%s', m_text='%s', m_key='', m_name='%s', m_tour=%d, m_lang='%s', m_period='%s'",
gmdate("Y-m-d"), $db->quote_field($vars['text']), $db->quote_field($vars['name']),
$vars['tour_id'], $this->sets['lang'], $db->quote_field($vars['period']));
$db->query($sql);
if($vars['tour_id']==0){
$db->query(sprintf("insert into tour_other(to_m_id, to_tour) values(%d, '%s')",
$db->insert_id(),
$db->quote_field($vars['other']))
);
}
$date=gmdate('Y-m-d');
$db->sql2var("delete from antibot where a_key='{$vars['key']}' or a_date<'$date'");
}
$vars['action']='list';
return $this->guestbook();
break;
case 'search_region':
$mes_res=$db->sql2value("select count(m_id) as kolvo from messages, link_region_message where l_m_id=m_id and l_region_id={$vars['region']} and m_flag='y'");
$sql='
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d.%m.%Y") as m_from,
m_period, m_flag, m_lang,
page_title as m_tour
from messages, pages_'.$this->sets['lang'].', tours, link_region_message where l_m_id=m_id and l_region_id='.$vars['region'].' and m_tour=tour_id and page_link=tour_link and m_flag="y"'.$str_t.')
union
(select m_id, m_text, m_name, m_date, date_format(m_date, "%d.%m.%Y") as m_from, m_period, m_flag, m_lang,
to_tour as m_tour
from messages, tour_other, link_region_message where l_m_id=m_id and l_region_id='.$vars['region'].' and m_id=to_m_id and m_flag="y"'.$str_o.')
order by m_date desc
limit ';
$this->assign('val_reg', $vars['region']);
break;
case 'search_ref':
$mes_res=$db->sql2value("select count(m_id) as kolvo from messages, tours where tour_ref='{$vars['ref']}' amd m_tour=tour_is and m_flag='y'");
$sql='
select m_id, m_text, m_name, m_date,
date_format(m_date, "%d.%m.%Y") as m_from,
m_period, m_flag, m_lang,
page_title as m_tour
from messages, pages_'.$this->sets['lang'].', tours where tour_ref="'.$vars['ref'].'" and m_tour=tour_id and page_link=tour_link and m_flag="y"
order by m_date desc
limit ';
$this->assign('val_ref', $vars['ref']);
break;
case 'search_tour':
$arr=explode(' ', $vars['tour']);
$str_t=''; $str_o='';
if($arr && sizeof($arr)>0)
foreach ($arr as $i){
$el=trim($i, "\x00..\x20");
if($el!='' && strlen($el)>2){
$str_t.=" or page_title_{$this->sets['lang']} like '%$el%'";
$str_o.=" or to_tour like '%$el%'";
}
}
if($str_t==''){
$vars['action']='list';
return $this->guestbook();
}
else{
$str_t=' and ('.substr($str_t, 4).')';
$str_o=' and ('.substr($str_o, 4).')';
}
$mes_res=$db->sql2value("select count(m_id) from messages, tours, pages_'.$this->sets['lang'].' where page_link=tour_link and tour_id=m_tour and m_flag='y'$str_t");
$mes_res+=$db->sql2value("select count(m_id) from messages, tour_other where to_m_id=m_id and m_flag='y'$str_o");
$sql='
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d.%m.%Y") as m_from,
m_period, m_flag, m_lang,
page_title as m_tour
from messages, pages_'.$this->sets['lang'].', tours where m_tour=tour_id and page_link=tour_link and m_flag="y"'.$str_t.')
union
(select m_id, m_text, m_name, m_date, date_format(m_date, "%d.%m.%Y") as m_from, m_period, m_flag, m_lang,
to_tour as m_tour
from messages, tour_other where m_id=to_m_id and m_flag="y"'.$str_o.')
order by m_date desc
limit ';
$this->assign('val_tour', $vars['tour']);
break;
default:
$mes_res=$db->sql2value('
select count(m_id) from messages
where m_flag="y"
');
//
$sql='
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d.%m.%Y") as m_from,
m_period, m_flag, m_lang,
page_title as m_tour
from messages
left join tours on m_tour=tour_id
left join pages_'.$this->sets['lang'].' on tour_link=page_link
where m_flag="y")
union
(select m_id, m_text, m_name, m_date,
date_format(m_date, "%d.%m.%Y") as m_from,
m_period, m_flag, m_lang,
to_tour as m_tour
from messages
left join tour_other on m_id=to_m_id
where m_flag="y")
order by m_date desc
limit ';
$vars['action']='list';
}
$this->assign('val_action', $vars['action']);
//form search
$sql1='select distinct tour_ref from tours
where tour_id in (select distinct l_tour_id from link_tour_block)
order by tour_ref';
$this->assign('refli', $db->sql2array($sql1));
$this->assign('regli', $db->sql2array('select region_id, region_title_'.$this->sets['lang'].' as region_title from region order by region_title'));
//form add
$sql1='select tour_id, page_menu as tour_title
from tours left join pages_'.$this->sets['lang'].' on tour_link=page_link
where tour_id in (select distinct l_tour_id from link_tour_block)
order by tour_title';
// and
$this->assign('tgb', $db->sql2array($sql1));
$pid=($vars['pid']==0)?1:$vars['pid'];
if($pid>$mes_res)$pid=1;
$count=10; $start=($pid-1)*$count;
$this->pages_counter($pid, $mes_res, $count);
$sql.=$start.', '.$count;
$this->assign('meslist', $db->sql2array($sql));
$key=$this->get_pass();
$code=$this->get_pass();
$db->query(sprintf("insert into antibot(a_key, a_code, a_date) values('%s', '%s', '%s')", $db->quote($key), $db->quote($code), $db->quote(gmdate("Y-m-d"))));
$this->assign('key', $key);
$this->template='guestbook.tpl';
}
function do_search(){
global $db;
if(isset($this->sets['item']) && $this->sets['item']!=''){
$result=array();
$arr=explode(' ', $this->sets['item']);
$str_p=''; $str_t=''; $str_r='';
foreach ($arr as $i){
$el=trim($i, "\x00..\x20");
if($el!=''){
if($str_p==''){
$str_p="page_text like '%$el%'";
$str_t="page_title like '%$el%'";
$str_r="page_add like '%$el%'";
}
else {
$str_p.=" and page_text like '%$el%'";
$str_t.=" and page_title like '%$el%'";
$str_r.=" and page_add like '%$el%'";
}
}
}
$sql='select distinct
page_title,
page_dir
from pages_'.$this->sets['lang'].'
left join pages_gorussia on page_id=page_link
where page_priority<>0 and (('.$str_t.') or ('.$str_p.') or ('.$str_r.'))
order by page_priority asc';
$res=$db->sql2array($sql);
if($res && sizeof($res)>0)
foreach ($res as $i)
$result[]=array('title'=>$i['page_title'], 'link'=>'http://'.$_SERVER['SERVER_NAME'].'/'.$this->sets['lang'].'/'.$i['page_dir'].'.html');
$this->assign('search_result', $result);
}
else $this->assign('search_result', false);
$this->template='search.tpl';
}
function customer_frame(){
global $vars;
$customer_path=str_replace('customer/', '', $vars['path']);
$this->assign('customer_path', $customer_path);
$this->template='customer.tpl';
}
function customer(){
global $vars;
$vars['path']=$vars['path'].'.html';
$customer_path=str_replace('customer.html', 'customer/', $vars['path']);
if(empty($customer_path)) $customer_path='/'.$this->sets['lang'].'/customer/';
$customer_path='https://'.str_replace('www.', 'customer.', $_SERVER['HTTP_HOST']).'/'.$customer_path;
require_once 'class.cabinet.php';
$cabinet=new CustomerCabinet();
if(isset($vars['do']) && $vars['do']=='html'){
$html=$cabinet->process_block($customer_path);
die($html);
}
else{
$html=$cabinet->process_page($customer_path);
}
require_once 'class.cabinet.php';
$cabinet=new CustomerCabinet();
if(isset($vars['do']) && $vars['do']=='html'){
$html=$cabinet->process_block($customer_path);
die($html);
}
else{
$html=$cabinet->process_page($customer_path);
}
$this->assign('customer_html', $html);
$this->template='customer_noframe.tpl';
}
function customer_old(){
global $vars;
require_once('class.customer.php');
$user=new CustomerAccount();
$user->smarty_vars=&$this->smarty_vars;
$user->template=&$this->template;
$user->errors=&$this->errors;
$user->sets=&$this->sets;
$method=$this->sets['item'];
if(method_exists($user, $method))
$user->$method();
else $user->undefined();
}
function reisen_schnell_finden(){
return $this->quick_trip_finder();
}
function quick_trip_finder(){
global $db;
global $vars;
$landmarks=array();
$temp=$db->sql2array('
select high_id, high_title_'.$this->sets['lang'].' as high_title, l_block_id
from link_block_landmark
left join tour_highlight on high_id=l_high_id
where high_show="y"
order by high_title
'); //l_sort, high_sort
if($temp)
foreach($temp as $t){
$landmarks[$t['l_block_id']][]=$t;
}
$param=array(
'block'=>$vars['block'],
'inspiration'=>$vars['inspiration'],
'price'=>array(0,5000)
);
$this->assign('block_tours', $this->tour_block($param));
$this->assign('inspiration', $vars['inspiration']);
$this->assign('landmarks', $landmarks);
$this->template='quick_trip_finder.tpl';
}
function quick_trip_founded(){
global $db;
global $vars;
if(isset($vars['block']) && !empty($vars['block']))
$temp=@explode(',',$vars['block']);
else $temp=false;
$param=array(
'block'=>$temp,
'days'=>@explode(';',$vars['duration']),
'price'=>@explode(';',$vars['price']),
'landmark'=>$vars['landmark'],
'inspiration'=>$vars['inspiration']
);
$this->assign('tours_array',$this->tour_block($param));
$html=$this->fetch('tour_list.tpl');
echo $this->php2js(array(
'error'=>0,
'errorText'=>'',
'html'=>$html
));
exit(0);
}
function tour_promoaction($tour_id){
global $db;
// Promo action
$promo=array();
$sql='select *
from tour_promotion
where promo_show="y" and
promo_lang="'.$this->sets['lang'].'" and
promo_tours like "%'.$tour_id.'%"
order by promo_id asc';
$res_promo=$db->sql2array($sql);
if($res_promo)
foreach($res_promo as $r){
$rr=@explode(', ', $r['promo_tours']);
if(in_array($tour_id, $rr))
$promo[]=$r['promo_text'];
}
$this->assign('promo', $promo);
}
function tour_promotion(){
global $db;
global $vars;
$sql='select tour_id, tour_img, tour_dif_id,
tour_days, tour_price1'.$this->curfield.' as price, tour_super,
page_dir,
page_title as tour_title,
tour_desc_'.$this->sets['lang'].' as tour_desc,
season_'.$this->sets['lang'].' as season_title, season_img
from tours left join pages_'.$this->sets['lang'].' on tour_link=page_link
left join pages_gorussia on page_id=page_link
left join link_tour_block on tour_id=link_tour_block.l_tour_id
left join link_tour_activity on tour_id=link_tour_activity.l_tour_id
left join season on tour_season_id=season_id
where page_show="y" and
tour_promotion="y"
order by page_sort_id asc';
$this->tourPrepare($db->sql2array($sql, 'tour_id'));
$this->template='tour_promotion.tpl';
}
function tour_search(){
global $db;
global $vars;
switch($this->sets['item']){
case 'activity':
if(isset($this->sets['folders'][3]) && is_numeric($this->sets['folders'][3])){
$sql='select tour_id, tour_img, tour_dif_id,
tour_days, tour_price1'.$this->curfield.' as price, tour_super,
page_dir,
page_title as tour_title,
tour_desc_'.$this->sets['lang'].' as tour_desc,
season_'.$this->sets['lang'].' as season_title, season_img
from tours inner join link_tour_block on tour_id=link_tour_block.l_tour_id
left join pages_'.$this->sets['lang'].' on tour_link=page_link
left join pages_gorussia on page_id=page_link
left join link_tour_activity on tour_id=link_tour_activity.l_tour_id
left join season on tour_season_id=season_id
where page_show_'.$this->sets['lang'].'="y" and
l_block_id is not NULL and
l_act_id='.$this->sets['folders'][3].'
order by page_sort_id asc';
$this->tourPrepare($db->sql2array($sql, 'tour_id'));
}
else return header('Location: /');
break;
case 'region':
if(isset($this->sets['folders'][3]) && is_numeric($this->sets['folders'][3])){
$sql='select tour_id, tour_img, tour_dif_id,
tour_days, tour_price1'.$this->curfield.' as price, tour_super,
page_dir,
page_title as tour_title,
tour_desc_'.$this->sets['lang'].' as tour_desc,
season_'.$this->sets['lang'].' as season_title, season_img
from tours inner join link_tour_block on tour_id=link_tour_block.l_tour_id
left join pages_'.$this->sets['lang'].' on tour_link=page_link
left join pages_gorussia on page_id=page_link
left join link_tour_region on tour_id=link_tour_region.l_tour_id
left join season on tour_season_id=season_id
where page_show_'.$this->sets['lang'].'="y" and
l_block_id is not NULL and
l_region_id='.$this->sets['folders'][3].'
order by page_sort_id asc';
$this->tourPrepare($db->sql2array($sql, 'tour_id'));
}
else return header('Location: /');
break;
}
$this->template='tour_search.tpl';
}
function renew_password(){
global $vars, $db;
$translate=array(
'en'=>array(
'data_saved'=>'Data saved',
'data_not_saved'=>'Error. Try again',
'customer_not_found'=>'Customer not found!'
),
'es'=>array(
'data_saved'=>'Datos guardados.',
'data_not_saved'=>'Error. Inténtalo de nuevo',
'customer_not_found'=>'Cliente no encontrado.'
),
'us'=>array(
'data_saved'=>'Data saved',
'data_not_saved'=>'Error. Try again',
'customer_not_found'=>'Customer not found!'
),
'fr'=>array(
'data_saved'=>'Sauver',
'data_not_saved'=>'Erreur ! Réessayez',
'customer_not_found'=>'Client pas trouvé !'
),
'de'=>array(
'data_saved'=>'Daten gespeichert',
'data_not_saved'=>'Fehler! Versuchen Sie es erneut',
'customer_not_found'=>'Kunde nicht gefunden!'
),
);
setDBConnection('tms');
$vars['new_password']=trim($vars['new_password']);
if(isset($vars['cus_id']) && is_numeric($vars['cus_id']) && !empty($vars['new_password'])){
// set password
$sql=sprintf("
update tms_client set
cus_pass='%s',
cus_hash=md5('%s')
where cus_id=%d
",
$vars['new_password'],
$vars['new_password'],
$vars['cus_id']);
$res=$db->query($sql);
if(!$res){
$this->errors[]=$translate[$this->sets['lang']]['data_not_saved'].$sql;
}
else{
$this->errors[]=$translate[$this->sets['lang']]['data_saved'];
}
return $this->header('/'.$this->sets['lang'].'/customer/login.html');
die();
}
$client=$db->sql2rec('
select cus_id, cus_email, cus_fname, cus_lname
from tms_client
where md5(concat("GR", cus_email))="'.trim($this->sets['item']).'"
');
if(!$client){
$this->errors[]=$translate[$this->sets['lang']]['customer_not_found'];
return $this->header('/'.$this->sets['lang'].'/customer/login.html');
}
$this->assign('client', $client);
$this->template='customer/renew_password.tpl';
setDBConnection($this->site);
}
}
?>