0 )
{
$id = $gData->FindGoodsPSU(addslashes($psu_code));
if ( $id == 0 )
{
header("Location: ./");
exit;
}
}
// Request Goods
$goods = $gData->GetGoods($id);
if ( ($goods['id']*1 == 0) || ($goods['active'] == 0))
{
header("Location: ./");
exit;
}
// Get base shop options
$gOptions = $gData->GetShopValues();
if ($_SESSION['payment']['multiplex'] > 0)
{
$gOptions['main_base_curr'] = $_SESSION['payment']['curr_name'];
$gOptions['main_prec'] = $_SESSION['payment']['curr_prec'];
}
// Content exists?
if ( !file_exists('./files/apendix'.$id.'.htm') )
{
echo '';
exit;
}
// Save shop statistic
save_shop_stat('descr', $id);
// Init templates
$gTpl = new FastTemplate('./'.TEMPLATES.'/_descr');
$gTpl->DefineTemplate(array('main' => 'main.htm',
'redirect' => 'redirect.htm'));
// Parse nil info keynames
$info_key = $gData->GetInfoAllKeyName('in_preview');
$info_key_rows = $gData->GetNumRows($info_key);
for ( $n = 1; $n <= $info_key_rows; $n++ )
{
$hash = $gData->FetchRow($info_key);
$gTpl->Assign($hash[0], '');
}
// Parse info tree
if ( $gOptions['main_descr_info'] == 'True' )
{
$info = $gData->GetInfoGoods($id, 'in_preview');
$info_rows = $gData->GetNumRows($info);
if ( $info_rows > 0 )
{
$tpl_sub = new FastTemplate('./'.TEMPLATES.'/_descr/info');
$tpl_sub->DefineTemplate(array('main' => 'main.htm',
'unit' => 'unit.htm',
'icon' => 'icon.htm',
'elem_file' => 'elem_file.htm',
'elem_folder' => 'elem_folder.htm'
));
$allow = array();
for ( $n = 1; $n <= $info_rows; $n++ )
{
$hash = $gData->FetchRow($info);
if ( (strlen($hash[5]) > 0) || ($allow[$hash[0]] == 1) )
{
$allow[$hash[6]] = 1;
if ( $hash[4] == 1)
{
$tpl_sub->Assign(array('NAME' => htmlspecialchars($hash[1]),
'LEVEL' => $hash[2]
));
$tpl_sub->Parse('ELEMENT', 'elem_folder');
}
else
{
$icon_exists = is_file('./files/info_value'.$hash[7].'.jpg');
$value = htmlspecialchars($hash[5]);
if ( strpos($hash[5], 'ftp://') !== false || strpos($hash[5], 'http://') !== false )
{
if ( strlen($value) > 30 ) $value = substr($value, 0, 30).'...';
$value = ''.$value.'';
}
$tpl_sub->Assign(array('NAME' => htmlspecialchars($hash[1]),
'VALUE' => $value,
'LEVEL' => $hash[2],
'URL' => './files/info_value'.$hash[7].'.jpg'
));
if ( $icon_exists ) $tpl_sub->Parse('VALUE', ',icon');
$tpl_sub->Parse('ELEMENT', 'elem_file');
}
$tpl_sub->Parse('UNIT', ',unit');
if ( strlen($hash[3]) > 0 ) $gTpl->Assign($hash[3], $tpl_sub->Fetch('VALUE'));
}
}
if ( count($allow) > 0 )
{
$tpl_sub->Parse('MAIN', 'main');
$info = $tpl_sub->Fetch('MAIN');
}
else
{
$info='';
}
}
else
{
$info='';
}
}
else
{
$info='';
}
// Make additional description
$content = iconv('UTF-8', SHOP_CHARSET, implode("", (@file('./files/apendix'.$id.'.htm'))));
$content = eregi_replace("src=\"([^\"<>[:space:]]+)\"([<>[:space:]])", 'src="files/\\1"\\2', $content);
$content = eregi_replace('ShowBigFoto\(\'', 'ShowBigFoto(\'files/', $content);
$content = str_replace('{INFO}', $info, $content);
$gTpl->Assign('CONTENT', $content);
// Parsing page properties
$gTpl->Assign(array('TITLE' => htmlspecialchars($goods['name']),
'DESCRIPTION' => htmlspecialchars($goods['descr']),
'REDIRECT' => '',
'ID' => $id
));
if ( !isset($_SESSION['client']) ) $gTpl->Parse('REDIRECT', 'redirect');
// Echo shop variables
echo_shop_variables('in_techpage');
// Parse main page
$gTpl->Parse('MAIN', 'main');
$gEndPoint = run_time($gStartPoint);
$gTpl->FastPrint('MAIN');
// Echo page compilate time
echo_page_time($gEndPoint);
}
?>