File: /var/www/ilya/data/www/povoleni.com/includes/design.inc
<?php
#------------------------------------------> CMS Termit <-------------------------------------------#
# #
# Author: Ilya Rudomilov #
# #
# E-mail: ilya@rudomilov.ru #
# URL: http://www.rudomilov.ru #
# ICQ: 203015 #
# #
#----------------------------> Grafix Design -- (c) 2005 <-----------------------------#
$global_vars['blocks'] = "";
$global_vars['title'] = array();
function skin_language_selector() {
global $global_vars,$languages;
$selected_language = "";
$other_languages = "";
foreach($languages as $skin_language_short => $skin_language) {
if($skin_language_short==$global_vars['language'])
$selected_language = preg_replace("/{%(\w+)%}/ee", "$\\1",_html("system_language_selector_current.htm",0));
else
$other_languages .= preg_replace("/{%(\w+)%}/ee", "$\\1",_html("system_language_selector_row.htm",0));
}
return array($selected_language,$other_languages);
}
function _html_design($content) {
global $url,$language,$global_vars,$site_name,$site_name_full,$site_description,$site_keywords,$menu_bottom_about,$menu_bottom_feedback,$menu_bottom_copyright;
//$skin_datetime = $skin_date[1];
//$skin_date = $skin_date[0];
$skin_blocks = $global_vars['blocks'];
//$skin_title_once =
$skin_language = skin_language_selector();
$skin_language_selector_current = $skin_language[0];
$skin_language_selector_other = $skin_language[1];
$content = preg_replace("/{%(\w+)%}/ee", "$\\1",_html("system.htm",0));
$search = array("'([\r\n])[\s]+'","'[\t]+'","'[\x20]+'");
$replace= array("\n"," "," ");
$content = preg_replace($search,$replace,$content);
//$content = TypoAll($content);
print $content;
}
function _html($path,$htmlescape) {
global $global_vars;
if(!file_exists("skin/".$path))
{
die("Ошибка открытия файла: 'skin/".$path."'");
}
$fp=fopen("skin/".$path,"r");
$articless=fread($fp,filesize("skin/".$path));
if($htmlescape == 1)
{
$articless=htmlspecialchars($articless);
}
unset($path);
return $articless;
}
function skin_span($span,$page,$totalsize,$url) {
$nPages = floor($totalsize/$span);
if($totalsize%$span>0)
$nPages++;
if ($nPages<=1)
$span_display="";
else
{
$next_numb=$page+1;$pre_numb = $page-1;
$code = "<TR>\r<TD align=\"center\" valign=\"center\">\r<TABLE cellpadding=\"5\" cellspacing=\"5\">\r<TR align=\"center\">\r";
if ($page!=1)
$code.="<TD><b><a href='".$url.$pre_numb.".html'>«</a></b></TD>\r";
else
$code.='';
if ($nPages >12)
{
$startpage=$page-6;
$endspan=$page+6;
if ($startpage<=0)
{
$startpage=1;
$endspan=12;
}
else
$startpage=$page-6;
if ($endspan > $nPages)
{
$endspan=$nPages;
$startpage=$nPages-12;
}
}
else
{
$startpage=1;
$endspan=$nPages;
}
for ($s=$startpage;$s<=$endspan;$s++)
{
if ($s!=$page)
$code.="<TD bgcolor=\"\"><b><a href='".$url.$s.".html'>".$s."</a></b></TD>\r";
else
$code.="<TD bgcolor=\"#8D95A2\" class=\"w\"><b>".$s."</b></TD>\r";
}
if ($nPages >12)
if ($endspan != $nPages){$code.="<TD bgcolor=\"#F2F2F2\"><b>...</b></TD>\r";}
if ($page!=$nPages)
$code.="<TD bgcolor=\"\"><b><a href='".$url.$next_numb.".html'>»</a></b></TD>\r";
$code .="</TR>\r</TABLE>\r</TD>\r</TR>\r";
}
return $code;
}
?>