/'; $replacement = '$0'; $text=preg_replace($pattern, $replacement, $text); $pattern = '//'; $replacement = '$0'; $text=preg_replace($pattern, $replacement, $text); return $text; } ?> �������� ������� �.������������

� 2012, �������� "�������", �������, �.������������
���������� � ��������� ����� - �������� "�������"

������� [x]

�������!

'.$check['title'].'

'.$check['short'].'

'; } } ?>

��� ��������

'.add_zoom($simp_area['text']).'

���� �������:

'; $news=sql('Select * from news where tofirstpage=1 and time>'.time().' order by time asc limit 3',1); if(mysql_num_rows($news)<2) $news=sql('Select * from news where time>'.time().' order by time asc limit 3',1);; while($new=mysql_fetch_array($news)) { echo '
'.($new['about']!=''?' '.$new['title'].'':' '.date("d",$new['time']).' '.$md[date("n",$new['time'])].' '.$new['title'].'').'

'.$new['short'].'

'; } echo '

��� �������

'; $photos=sql('Select * from firstgallery order by rand() limit 12',1); while($photo=mysql_fetch_array($photos)) { echo '
'; } echo '
'; } function print_second_page() { global $path; echo '
'; if($path[1]=='news') print_news_block($path[2]); elseif($path[1]=='gallery') print_gallery_block($path[2]); else { $simp_area=sqlr('Select * from simpl_areas where name="'.$path[1].'"',1); if ($simp_area) { echo '

'.$simp_area['title'].'

'.$simp_area['beforetext'].' '.add_zoom($simp_area['text']).' '.$simp_area['aftertext'].''; if($path[1]=='zakaz') print_form(); } else { echo '

������ 404

�������� �� �������. �������� �� ������� �������� �����.'; } } echo '
'; } function print_news_block($nn) { global $md; if(!is_numeric($nn)) { $n=10; if(isset($_GET['page'])&&$_GET['page']>0) $start=$_GET['page']*$n-$n; else $start=0; $news=sql('Select * from news order by time desc limit '.$start.','.$n.'',1); echo '

�������


'; if(mysql_num_rows($news)>0) { while($new=mysql_fetch_array($news)) { if(file_exists('images/news/'.$new['id'].'.jpg')) $img='images/news/'.$new['id'].'_200x137.jpg'; else { $img=sqlr('Select * from news_photo where IDT='.$new['id'].' order by tomain desc limit 1',1); if($img) $img='images/news/'.$new['id'].'/'.str_replace('.','_200x137.',$img['fname']); } $all=sqlr('Select count(id) as num from news_photo where IDT='.$new['id'],1); echo '
'.($new['about']!=''?' '.$new['title'].'':' '.date("d",$new['time']).' '.$md[date("n",$new['time'])].'
'.$new['title'].'').''.($img?($new['about']!=''?' ':''):'').'

'.$new['short'].'

'; } $all=sqlr('Select count(id) as n from news limit 1',1); $m=intval($all['n']%$n==0?$all['n']/$n:$all['n']/$n+1); if($m>1) { echo '


��������:'; for($i=1;$i<=$m;$i++) echo ' '.$i.'  '; } } else echo '������ �� �������'; } else { $new=sqlr('Select * from news where id='.$nn.' limit 1',1); if($new) { if(file_exists('images/news/'.$new['id'].'.jpg')) $img='images/news/'.$new['id'].'_200x137.jpg'; else { $ph=sqlr('Select * from news_photo where IDT='.$new['id'].' order by id desc limit 1',1); if($ph) $img='images/news/'.$new['id'].'/'.str_replace('.','_200x137.',$ph['fname']); } echo ($img!=''?'':'').'

'.$new['title'].'

'.add_zoom($new['about']).'

'; $allphoto=sql("Select * from news_photo where idt=".$new['id']." ",1); $n=mysql_num_rows($allphoto); $i=0; while($fname=mysql_fetch_array($allphoto)) { $i++; echo '
���� '.$i.' �� '.$n.' '.($fname['alt']!=''?'

'.$fname['alt']:'').'
'; } echo '


→ � ������ ��������
'; } else echo '�� �������!'; } } function print_gallery_block($nn) { $check=sql("Select * from gallery ",1); if(mysql_num_rows($check)==1) { $one=mysql_fetch_array($check); $nn=$one['id']; } if(!is_numeric($nn)) { $n=10; if(isset($_GET['page'])&&$_GET['page']>0) $start=$_GET['page']*$n-$n; else $start=0; $news=sql('Select * from gallery order by id desc limit '.$start.','.$n.'',1); echo '

�����������


'; if(mysql_num_rows($news)>0) { while($new=mysql_fetch_array($news)) { if(file_exists('images/gallery/'.$new['id'].'.jpg')) $img='images/gallery/'.$new['id'].'_200x137.jpg'; else { $img=sqlr('Select * from gallery_photo where IDT='.$new['id'].' order by tomain desc limit 1',1); if($img) $img='images/gallery/'.$new['id'].'/'.str_replace('.','_200x137.',$img['fname']); } $all=sqlr('Select count(id) as num from gallery_photo where IDT='.$new['id'],1); echo '
'.$new['title'].'

'.$all['num'].' ����

'.add_zoom($new['short']).'

'; } $all=sqlr("Select count(id) as n from gallery ",1); $m=intval($all['n']%$n==0?$all['n']/$n:$all['n']/$n+1); if($m>1) { echo '


��������: '; for($i=1;$i<=$m;$i++) echo ' '.$i.'  '; } } else echo '������ �� �������'; } else { $new=sqlr("Select * from gallery where id=".$nn,1); if($new) { if(file_exists('images/gallery/'.$new['id'].'.jpg')) $img='images/gallery/'.$new['id'].'_200x137.jpg'; else { $ph=sqlr('Select * from gallery_photo where IDT='.$new['id'].' order by id desc limit 1',1); if($ph) $img='images/gallery/'.$new['id'].'/'.str_replace('.','_200x137.',$ph['fname']); } echo '

'.$new['title'].'

'.add_zoom($new['about']).'




→ � ������ �����������
'; } else echo '�� �������!'; } } function print_form($id) { global $adminMailInfo; if(isset($_POST['add'])) { $_POST['name']=strip_tags(str_replace('"','',$_POST['name'])); $_POST['date']=strip_tags(str_replace('"','',$_POST['date'])); $_POST['hour']=strip_tags(str_replace('"','',$_POST['hour'])); $_POST['min']=strip_tags(str_replace('"','',$_POST['min'])); $_POST['phone']=strip_tags(str_replace('"','',$_POST['phone'])); $_POST['place']=strip_tags(str_replace('"','',$_POST['place'])); $_POST['text']=strip_tags(str_replace('"','',$_POST['text'])); if(isset($_SESSION['captcha_keystring']) && $_SESSION['captcha_keystring'] === $_POST['scode']) { if($_POST['name']!='') { if($_POST['text']!='') { if($_POST['phone']!=''&&strpos($_POST['phone'],'x')===false) { $text='����: '.$_POST['date'].' '.$_POST['hour'].':'.$_POST['min']."\n\n".'���: '.$_POST['name']."\n\n".'���.: '.$_POST['phone']."\n\n".'����: '.$_POST['place']."\n\n".'������: '.$_POST['text']; sendmail_global($adminMailInfo,'����� ������� � ����� Restoran-Karavan.ru',$text); $tweet_text=iconv('CP1251','UTF8',(strlen($text)<=140?substr($text,0,140):substr($text,0,137).'...')); $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET); $content = $connection->get('account/verify_credentials'); $status=$connection->post('statuses/update', array('status' => $tweet_text)); $noerror='

��������� ������� ����������.

'; $_POST['date']=''; $_POST['hour']=''; $_POST['min']=''; $_POST['name']=''; $_POST['phone']=''; $_POST['place']=''; $_POST['text']=''; } else $error='���� ������� ������� ��� �����'; } else $error='��������� ����� ��� ������'; } else $error='�� ������ ���'; } else $error='�������� ���'; } echo '
'.($error!=''?'
��������: '.$error.'!
':'').' '.($noerror!=''?'
'.$noerror.'
':'').'

��������� ����:

���� ���:
�������:
���� �� �� ����� ��������� �������, �� �� ������ ����������� �����!
����/�����: :
����� �������:
����� ��� ������, ����� �� �����������?:
������� ���:

������ ��� �� ������, ��� �� �� �����


'; } function sendmail_global($mail,$subject,$body) { global $adminMailFrom,$adminNameFrom; if($adminMailFrom!='') { ini_set("SMTP", "localhost"); ini_set("sendmail_from", $adminMailFrom); $subject = '=?windows-1251?B?'.base64_encode($subject).'?='; $headers="Content-Type: text/plain; charset=\"koi8-r\"\r\n"; $headers.="From: ".$adminNameFrom." <".$adminMailFrom."> \r\n"; $headers.="Subject: ".$subject."\r\n"; $headers.= "X-Mailer: PHP/" . phpversion(); $body=convert_cyr_string($body, "w", "k"); mail($mail, $subject, $body, $headers); } } ?>