Весь код
<?
function top_menu()
{
global $path;
$args=func_get_args();
$ids=array("1"=>"1","2"=>"2","3"=>"3","4"=>"4","5"=>"5","6"=>"6","7"=>"7");
$im=array("1"=>"1","2"=>"2","3"=>"3","4"=>"4","5"=>"5","6"=>"6","7"=>"7");
$res=mysql_query("SELECT `id`,`name`,`link` FROM `cms` WHERE `level`='0' AND `visible`='1' ORDER BY `order_id` LIMIT 7");
$num=@mysql_num_rows($res);
if($num>0)
{
$body=<<<END
<table cellspacing="0" class="picsmenu">
END;
$i=0;
while(list($cid,$cname,$link)=@mysql_fetch_row($res))
{
$i++;
$cname=stripslashes($cname);
$link=stripslashes($link);
if($link!="") $href=$link;
else $href="content.php?id=$cid";
$file=$path."images/m".$im[$cid].".gif";
list($w,$h)=@getimagesize($file);
$cid=$ids[$cid];
$bi.=<<<END
<td style="width:14%" class="pic" id="mtd$i"><a href="$href" onmouseover="Show('$i');" onmouseout="Hide('$i');"><img id="mi$i" src="$file" width="$w" height="$h" alt="" /></a></td>
END;
$bt.=<<<END
<td style="width:14%"><a href="$href" id="ma$i" onmouseover="Show('$i');" onmouseout="Hide('$i');">$cname</a></td>
END;
}
$body.=<<<END
<tr>
$bi
</tr>
<tr>
$bt
</tr>
</table>
END;
}
return $body;
}
function date_replace($body)
{
$body1='';
$month=array("1"=>"января","2"=>"февраля","3"=>"марта","4"=>"апреля","5"=>"мая","6"=>"июня","7"=>"июля","8"=>"августа","9"=>"сентября","10"=>"октября","11"=>"ноября","12"=>"декабря");
$day=array("0"=>"воскресенье","1"=>"понедельник","2"=>"вторник","3"=>"среда","4"=>"четверг","5"=>"пятница","6"=>"суббота");
$date=date("d")." ".$month[date("n")].", ".$day[date("w")].", ".date("H:i");
$body1=preg_replace("/{date}/i",$date,$body);
$url="http://informer.gismeteo.ru/xml/37001_1.xml";
if(date("Ymd",filemtime("media/weather.xml"))<date("Ymd"))
{
copy("media/weather1.xml","media/weather.xml");
$dom1=domxml_open_file($url);
$dom1->dump_file("media/weather1.xml");
}
$xsl=xslt_create();
xslt_set_encoding($xsl,"windows-1251");
$weather=xslt_process($xsl,"media/weather.xml","weather.xsl");
$body1=preg_replace("/{weather}/i",$weather,$body1);
return $body1;
}
function list_replace($body)
{
$body1='';
$list='';
$res=@mysql_query("SELECT `id`,`name`,`desc`,`link` FROM `items` ORDER BY `order_id`");
$num=@mysql_num_rows($res);
if($num>0)
{
$list=<<<END
<table cellspacing="0" border="0" class="list">
END;
while(list($id,$name,$desc,$link)=@mysql_fetch_row($res))
{
list($photo)=@mysql_fetch_row(mysql_query("SELECT `photo` FROM `iphotos` WHERE `category`='$id' ORDER BY `order_id` DESC LIMIT 1"));
if(is_file($photo)) $file=$photo;
else $file="images/nophoto.gif";
list($w,$h)=@getimagesize($file);
$name=stripslashes($name);
$desc=stripslashes($desc);
if($link!="") $href=$link;
else $href="catalog.php?id=$id";
$list.=<<<END
<tr id="ltr{$id}" onclick="click1('{$id}','$href','')" onmouseout="Highlight_off('{$id}')" onmouseover="Highlight('{$id}')" style="background-color: #FFF;">
<td class="left"><img width="$w" height="$h" alt="$name" src="$file" /></td>
<td class="right"><span style="color:#00acdf">$name.</span> $desc <div><a href="$href">подробнее</a></div></td>
</tr>
END;
}
$list.=<<<END
</table>
END;
}
$body1=preg_replace("/{list}/i",$list,$body);
return $body1;
}
function meta()
{
global $keywords,$description;
return "<META name=\"keywords\" content=\"$keywords\">\r\n<META name=\"description\" content=\"$description\">\r\n";
}
function show_item($id)
{
list($name,$desc)=@mysql_fetch_row(mysql_query("SELECT `name`,`body` FROM `items` WHERE `id`='$id'"));
$body=stripslashes($body);
$name=stripslashes($name);
list($pid,$photo,$bphoto)=@mysql_fetch_row(mysql_query("SELECT `id`,`photo`,`big_photo` FROM `iphotos` WHERE `category`='$id' ORDER BY `order_id` DESC LIMIT 1"));
if(is_file($photo)) $file=$photo;
else $file="images/nophoto.gif";
list($w,$h)=@getimagesize($file);
$q=mysql_query("SELECT `id`,`small_photo`,`photo`,`big_photo` FROM `iphotos` WHERE `category`='$id' ORDER BY `order_id` DESC");
$num=@mysql_num_rows($q);
if($num>0)
{
$script="<script language=\"javascript\">\r\n<!--\r\nrpl_im=new Array();\r\n";
$list_hrefs="<div style=\"display:none; visibility:hidden;\">\r\n";
$list=<<<END
<table cellspacing="4" align="center" style="margin-top:40px;">
<tr>
<td colspan="2" style="color:#00ace0; padding-bottom:10px;">Галерея:</td>
</tr>
END;
$i=0;
while(list($ppid,$small_photo,$pphoto,$big_photo)=@mysql_fetch_row($q))
{
if(!is_file($small_photo)||!is_file($pphoto)||!is_file($big_photo)) continue;
$i++;
if($i%2==1)
$list.="<tr>";
list($ws,$hs)=@getimagesize($small_photo);
list($wp,$hp)=@getimagesize($pphoto);
$script.="rpl_im[$ppid]=new Image();\r\nrpl_im[$ppid].src=\"$pphoto\";\r\n";
$href1="http://marcopolo-anapa.ru/".$big_photo;
$list_hrefs.="<a href=\"$big_photo\" rel=\"lightbox[room{$pid}]\">$big_photo</a>\r\n";
$list.=<<<END
<td><a href="{$_SERVER['PHP_SELF']}" id="sp{$ppid}" onclick="return small_photo('$ppid','$wp','$hp','$href1')";><img src="$small_photo" width="$ws" height="$hs" alt="" /></a></td>
END;
if($i%2==0)
$list.="</tr>";
}
if($i%2!=0)
{
for(;$i%2!=0;$i++) $list.="<td></td>";
$list.="</tr>";
}
$script.="\r\n-->\r\n</script>";
$list_hrefs.="</div>\r\n";
$list.=<<<END
</table>
$script
END;
}
$body=<<<END
<table cellspacing="0" style="width:100%" border="0">
<tr>
<td style="width:220px">
<p class="zag">Номера и цены</p>
<p class="title">$name</p>
<div id="len" align="center"><a href="$bphoto" rel="hrefphoto{$pid}" id="hrefphoto"><div style="width:{$w}px; height:{$h}px;" id="outerdiv"><div style="width:{$w}px; height:{$h}px; z-index:2; position:absolute;text-align:right;" id="innerdiv"><img src="images/len1.gif" /></div><img src="$file" width="$w" height="$h" id="preview" alt="" /></div></a></div>
$list
$list_hrefs
</td>
<td style="width:721px; padding:0px 0px 20px 20px; text-align:justify">
<p>
$desc
</p>
</td>
</tr>
</table>
END;
return $body;
}
function form_replace($body)
{
global $name,$email,$message,$er_name,$er_email,$er_message;
$body1=<<<END
<form name="contactform" id="contactform" method="POST" action="{$_SERVER['PHP_SELF']}">
<input type="hidden" name="act" value="send">
<table cellspacing="0" style="margin-top: 40px;">
<tbody>
<tr>
<td style="padding-bottom: 10px;">Вы можете задать нам вопрос:</td>
</tr>
<tr>
<td style="padding-bottom: 2px;"><input type="text" class="feedback" id="name" value="$name" name="name" onfocus="name_focus()" /></td>
</tr>$er_name
<tr>
<td style="padding-bottom: 2px;"><input type="text" class="feedback" id="email" value="$email" name="email" onfocus="email_focus()" /></td>
</tr>$er_email
<tr>
<td><textarea id="message" name="message" class="feedback" onfocus="message_focus()">$message</textarea></td>
</tr>$er_message
<tr>
<td><input type="submit" class="submit" value="Отправить" /></td>
</tr>
</tbody>
</table>
</form>
END;
$body1=preg_replace("/{form}/i",$body1,$body);
return $body1;
}
function error_prepare($name)
{
$body.=<<<END
<tr>
<td style="padding-bottom:2px"><span class="warn">$name</span></td>
</tr>
END;
return $body;
}
function template_prep()
{
$args=func_get_arg(0);
$template=func_get_arg(1);
$msg=$template;
foreach($args as $k => $v)
{
$k1=strtoupper($k);
if(preg_match("/%$k1%/i",$template))
{
$pat="/%$k1%/i";
$template=preg_replace($pat,$v,$template);
}
}
$template=preg_replace("/%[A-Z]*%/i",'',$template);
return $template;
}
function form_replace_thanks($body,$msg)
{
$body1=preg_replace("/{form}/i",$msg,$body);
return $body1;
}
function list_g()
{
$page=check_input_int_get('page');
if($page==-1) $page=check_input_int_post('page');
if($page==-1) $page=1;
parse_str($_SERVER['QUERY_STRING'],$url_args);
$args=func_get_args();
$res=$args[0];
$body='';
$num=@mysql_num_rows($res);
if($num>0)
{
$body.=<<<END
<table width="100%" border="0" cellpadding="0" cellspacing="0">
END;
$body.=<<<END
<tr>
<td valign="top">
END;
$i=0;
while(list($id,$photo,$big_photo)=@mysql_fetch_row($res))
{
if(!is_file($photo)||!is_file($big_photo)) continue;
$i++;
if($i%6==0) $class='main';
else $class='small';
$file=$photo;
$file=$file;
list($w,$h)=@getimagesize($file);
$body.=<<<END
<div class="$class"><a href="$big_photo" rel="lightbox[gallery]"><img src="$file" width="$w" height="$h" $st /></a></div>
END;
}
$body.=<<<END
</td>
</tr>
END;
$body.=<<<END
</table>
END;
}
@mysql_free_result($res);
return $body;
}
function query($url_args)
{
$str='';
$i=0;
foreach($url_args as $k => $v)
{
$i++;
if($i==1) $str.='?';
if($i>1) $str.='&';
$str.="$k=$v";
}
return $str;
}
function navigation($num,$toshow)
{
$per_page=$toshow;
$page=check_input_int_get('page');
if($page==-1) $page=check_input_int_post('page');
if($page==-1) $page=1;
$pages=ceil($num/$per_page);
if(($page>$pages)||($page<1)) $page=1;
if($per_page==0)
{
}
else
{
$dp=10;
if($num>$per_page)
{
parse_str($_SERVER['QUERY_STRING'],$url_args);
$navigation='<div style="padding-top:20px; text-align:center;">Страницы: ';
$nr=ceil($page/$dp);
$ranges=ceil($pages/$dp);
$start=($nr-1)*$dp+1;
if($start<1) $start=1;
$end=$nr*$dp;
if($end>$pages)
{
$end=$pages;
}
if(($nr==$ranges)&&$nr>1)
{
$start=$pages-$dp+1;
}
if($start>1)
{
$url_args['page']=$start-1;
$query_string=query($url_args);
$navigation.=" <a href=\"{$_SERVER['PHP_SELF']}{$query_string}\" class=\"nav\">...</a> ";
}
else if($start==1)
{
$url_args['page']=1;
$query_string=query($url_args);
}
for($i=$start;$i<=$end;$i++)
{
if ($page!=$i)
{
$url_args['page']=$i;
$query_string=query($url_args);
$navigation.="<a href=\"{$_SERVER['PHP_SELF']}{$query_string}\" class=\"nav\">".$i."</a> ";
}
else
{
$navigation.="<span class=\"navon\">".$i."</span> ";
}
}
if($end<$pages)
{
$url_args['page']=$i;
$query_string=query($url_args);
$navigation.="<a href=\"{$_SERVER['PHP_SELF']}{$query_string}\" class=\"nav\">...</a>";
}
else if($end==$pages)
{
$url_args['page']=$end;
$query_string=query($url_args);
$navigation.="<a href=\"{$_SERVER['PHP_SELF']}{$query_string}\" class=\"nav\"></a>";
}
$navigation.='</div></div>';
}
}
$start=($page-1)*$per_page;
$end=$per_page;
return array($navigation,$start,$end);
}
function bron_replace($body)
{
global $name,$email,$room,$dop,$food,$check_in,$check_out,$er_name,$er_email,$er_check_in,$er_check_out,$er_dop,$er_room,$er_deti1,$er_deti2,$deti1,$deti2,$dop_info;
$file_room=array();
for($i=1;$i<=4;$i++)
{
if($room==$i) $file_room[$i]="images/bullet_on.gif";
else $file_room[$i]="images/bullet_off.gif";
}
$file_dop=array();
for($i=1;$i<=1;$i++)
{
if($dop==$i) $file_dop[$i]="images/bullet_on.gif";
else $file_dop[$i]="images/bullet_off.gif";
}
$file_food=array();
for($i=1;$i<=1;$i++)
{
if($food==$i) $file_food[$i]="images/bullet_on.gif";
else $file_food[$i]="images/bullet_off.gif";
}
if($check_in=='')
{
$check_in="дд.мм.гггг";
}
if($check_out=='')
{
$check_out="дд.мм.гггг";
}
$body1=<<<END
<form name="orderform" id="orderform" method="POST" action="{$_SERVER['PHP_SELF']}">
<input type="hidden" name="act" value="send">
<input type="hidden" name="room" id="room" value="$room">
<input type="hidden" name="dop" id="dop" value="$dop">
<input type="hidden" name="food" id="food" value="$food">
<table cellspacing="4" style="margin-top:20px;">
<tr>
<td style="text-align:right">Ф.И.О. гостя:</td>
<td><input type="text" name="name" value="$name" class="bron" /></td>
</tr>
$er_name
<tr>
<td style="text-align:right">Электронный адрес:</td>
<td><input type="text" name="email" value="$email" class="bron" /></td>
</tr>
$er_email
<tr>
<td colspan="2" style="padding:20px 0px 20px 0px">
<table cellspacing="1" class="bron">
<tr>
<td colspan="8">Тип номера</td>
</tr>
<tr>
<td rowspan="2">2-х <br />местный</td>
<td rowspan="2">2-х <br />местный<br />2-х <br />комнатный</td>
<td rowspan="2">3-х <br />местный</td>
<td rowspan="2">4-х <br />местный</td>
<td>Дополнительное место</td>
<td>Трехразовое питание</td>
<td colspan="2">Количество детей</td>
</tr>
<tr>
<td>да</td>
<td>да</td>
<td>Дети до 3-х лет</td>
<td>Дети до 11 лет</td>
</tr>
<tr>
<td><input type="image" src="{$file_room[1]}" width="20" height="20" alt="" name="room1" id="room1" value="1" onclick="return change_radio_status(this.id,'room','room')" /></td>
<td><input type="image" src="{$file_room[2]}" width="20" height="20" alt="" name="room2" id="room2" value="2" onclick="return change_radio_status(this.id,'room','room')" /></td>
<td><input type="image" src="{$file_room[3]}" width="20" height="20" alt="" name="room3" id="room3" value="3" onclick="return change_radio_status(this.id,'room','room')" /></td>
<td><input type="image" src="{$file_room[4]}" width="20" height="20" alt="" name="room4" id="room4" value="4" onclick="return change_radio_status(this.id,'room','room')" /></td>
<td><input type="image" src="{$file_dop[1]}" width="20" height="20" alt="" name="dop1" id="dop1" value="1" onclick="return change_checkbox_status(this.id,'dop')" /></td>
<td><input type="image" src="{$file_food[1]}" width="20" height="20" alt="" name="food1" id="food1" value="1" onclick="return change_checkbox_status(this.id,'food')" /></td>
<td><input type="text" maxlength="1" name="deti1" id="deti1" class="bron" style="width:20px; font-weight:normal" value="$deti1"></td>
<td><input type="text" maxlength="1" name="deti2" id="deti2" class="bron" style="width:20px; font-weight:normal" value="$deti2"></td>
</tr>
</table>
</td>
</tr>
$er_room
$er_food
$er_deti1
$er_deti2
<tr>
<td style="text-align:right">Дата заезда:</td>
<td><input type="text" id="check_in" name="check_in" value="$check_in" class="bron" onfocus="return check_in_focus();" onblur="return check_in_lost_focus();" /></td>
</tr>
$er_check_in
<tr>
<td style="text-align:right">Дата выезда:</td>
<td><input type="text" id="check_out" name="check_out" value="$check_out" class="bron" onfocus="return check_out_focus();" onblur="return check_out_lost_focus();" /></td>
</tr>
$er_check_out
<tr>
<td style="text-align:right">Дополнительная информация:</td>
<td><textarea class="bron" name="dop_info" id="dop_info">$dop_info</textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Отправить" class="submit1" /> <input type="reset" value="Очистить" class="submit1" onclick="return clear_order();" /></td>
</tr>
</table>
</form>
END;
$body1=preg_replace("/{form}/i",$body1,$body);
return $body1;
}
function error_prepare1($name)
{
$body.=<<<END
<tr>
<td colspan="2" style="padding-bottom:2px; text-align:center"><span class="warn">$name</span></td>
</tr>
END;
return $body;
}
?>
Ругается на это
$xsl=xslt_create();
xslt_set_encoding($xsl,"windows-1251");
$weather=xslt_process($xsl,"media/weather.xml","weather.xsl");
$body1=preg_replace("/{weather}/i",$weather,$body1);
return $body1;