Файл: sources/site.php
Строк: 90
<?php
if (!defined('VAPHP'))
{
die("Этот файл недоступен.");
}
class site extends base
{
function site()
{
global $FORM, $TMPL, $LNG, $DB, $CONF;
if (isset($FORM['id']) and !empty($FORM['id']))
{
$id = intval($FORM['id']);
list($idsite, $idsubcat, $banner_url, $URL, $name, $description, $add_admin) = $DB->fetch("SELECT id, idsubcat, banner_url, URL, name, description, add_admin FROM {$CONF['sql_prefix']}_sites WHERE id='{$id}' and visib = '1'", __FILE__, __LINE__);
list($idcat, $subcatname) = $DB->fetch("SELECT idcat, name FROM {$CONF['sql_prefix']}_subcat WHERE id = '$idsubcat'", __FILE__, __LINE__);
list($catname) = $DB->fetch("SELECT name FROM {$CONF['sql_prefix']}_cat WHERE id = '$idcat'", __FILE__, __LINE__);
if (empty($idsite))
{
$TMPL['header'] = $LNG['g_error'];
$base = new base;
$base->error($LNG['g_page_empty']);
}
$TMPL['header'] = "{$name}";
$TMPL['meta_description']=substr($description, 0, 160);
$TMPL['meta_description'] = substr($TMPL['meta_description'],0,strrpos($TMPL['meta_description']," "));
$TMPL['meta_keywords']="";
$DB->query("UPDATE {$CONF['sql_prefix']}_sites SET num_views=num_views+1 WHERE id = '$id'", __FILE__, __LINE__);
list ($num_views) = $DB->fetch("SELECT num_views FROM {$CONF['sql_prefix']}_sites WHERE id='{$id}' and visib = '1'", __FILE__, __LINE__);
$TMPL['navmenu'] = "<span class="PathMenu"><a href="{$CONF['site_url']}">{$LNG['main_menu_index']}</a> <img src="{$CONF['skins_image']}/bullet.gif"> <a href="{$CONF['site_url']}/cat/{$idcat}">$catname</a> <img src="{$CONF['skins_image']}/bullet.gif"> <a href="{$CONF['site_url']}/subcat/{$idsubcat}">$subcatname</a></span>";
$description =$this->fnrepl($description);
if ($add_admin){$html_cod = $description; $href_button = "{$CONF['site_url']}/site/{$id}";}
else {
if($CONF['type_link']) {$html_cod="<a href="{$URL}" target=blank><b>{$name}</b></a><br>{$description}";}
else {$html_cod="<a href="{$CONF['site_url']}/redirect/{$id}" target=blank><b>{$name}</b></a><br>{$description}";}
if($CONF['type_link']){$href_button = $URL;}
else {$href_button = "{$CONF['site_url']}/redirect/{$id}";}
}
$TMPL['list_sites'] .= <<<EndHTML
<tr><td colspan="2"><hr width=100% size="1" class="SeparatorHr"></td></tr>
<tr>
<td><a href="{$href_button}" target=blank><img src="{$banner_url}" width="{$CONF['max_banner_width']}" height="{$CONF['max_banner_height']}" border="0" title="{$name}"></a></td>
<td width=100%>
<table width=100%>
<tr><td colspan="2">$html_cod</td></tr>
<tr>
<td>{$LNG['g_views']}: {$num_views}</td>
</tr>
</table>
</td>
</tr>
<tr><td colspan="2"><hr width=100% size="1" class="SeparatorHr"></td></tr>
EndHTML;
$TMPL['content'] = $this->do_skin('list_sites');
}
else
{
$TMPL['header'] = $LNG['g_error'];
$base = new base;
$base->error($LNG['g_page_empty']);
}
}
}
?>