/* now generate the title and meta tags */
/*if (eregi('auction_details.php', $base_url)) */
if (stristr($base_url, 'auction_details.php'))
{
$output['title'] = $db->add_special_chars($item_details['name']) . ' (' . MSG_AUCTION_ID . ': ' . $item_details['auction_id'] . ', ' .
GMSG_END_TIME . ': ' . show_date($item_details['end_time']) . ') - ' . $setts['sitename'];
$output['meta_tags'] = '<meta name="description" content="' . MSG_MTT_FIND . ' ' . $db->add_special_chars($item_details['name']) . ' ' .
MSG_MTT_IN_THE . ' ' . $db->add_special_chars($db->implode_array($subcats_array, ' - ')) . ' ' . MSG_MTT_CATEGORY_ON . ' ' . $setts['sitename'] . '"> '.
'<meta name="keywords" content="' . $db->add_special_chars($item_details['name']) . ', ' . $db->add_special_chars($db->implode_array($subcats_array, ', ')) . ', ' .
$setts['sitename'] . '"> ';
}
else if (eregi('wanted_details.php', $base_url))
{
$output['title'] = $db->add_special_chars($item_details['name']) . ' (' . MSG_WANTED_AD_ID . ': ' . $item_details['wanted_ad_id'] . ', ' .
GMSG_END_TIME . ': ' . show_date($item_details['end_time']) . ') - ' . $setts['sitename'];
$output['meta_tags'] = '<meta name="description" content="' . MSG_MTT_FIND . ' ' . $db->add_special_chars($item_details['name']) . ' ' .
MSG_MTT_IN_THE . ' ' . $db->add_special_chars($db->implode_array($subcats_array, ' - ')) . ' ' . MSG_MTT_CATEGORY_ON . ' ' . $setts['sitename'] . '"> '.
'<meta name="keywords" content="' . $db->add_special_chars($item_details['name']) . ', ' . $db->add_special_chars($db->implode_array($subcats_array, ', ')) . ', ' .
$setts['sitename'] . '"> ';
}
else if (eregi('categories.php', $base_url))
{
$output['title'] = ((is_array($subcats_array)) ? $db->add_special_chars($db->implode_array($subcats_array, ' - ')) . ' - ' : '') . $setts['sitename'];
$main_category_id = $db->main_category($parent_id);
$category_details = $db->get_sql_row("SELECT meta_description, meta_keywords FROM " . DB_PREFIX . "categories WHERE
category_id='" . $main_category_id . "'");
if (!empty($category_details['meta_description']) && !empty($category_details['meta_keywords']))
{
$output['meta_tags'] = '<meta name="description" content="' . $db->add_special_chars($category_details['meta_description']) . '"> '.
'<meta name="keywords" content="' . $db->add_special_chars($category_details['meta_keywords']) . '"> ';
}
else
{
$output['meta_tags'] = $db->add_special_chars($setts['metatags']);
}
}
else if (eregi('reverse_auctions.php', $base_url))
{
$output['title'] = ((is_array($subcats_array)) ? $db->add_special_chars($db->implode_array($subcats_array, ' - ')) . ' - ' : '') . GMSG_REVERSE_AUCTIONS . ' - ' . $setts['sitename'];
$main_category_id = $db->main_category($parent_id);
$category_details = $db->get_sql_row("SELECT meta_description, meta_keywords FROM " . DB_PREFIX . "reverse_categories WHERE
category_id='" . $main_category_id . "'");
if (!empty($category_details['meta_description']) && !empty($category_details['meta_keywords']))
{
$output['meta_tags'] = '<meta name="description" content="' . $db->add_special_chars($category_details['meta_description']) . '"> '.
'<meta name="keywords" content="' . $db->add_special_chars($category_details['meta_keywords']) . '"> ';
}
else
{
$output['meta_tags'] = $db->add_special_chars($setts['metatags']);
}
}
else
{
if (eregi('shop.php', $base_url))
{
$user_details = $db->get_sql_row("SELECT shop_name, shop_metatags FROM " . DB_PREFIX . "users WHERE
user_id='" . intval($shop_id) . "'");
$output['title'] = $user_details['shop_name'] . ' - ' . $setts['sitename'];
if (!empty($user_details['shop_metatags']))
{
$output['meta_tags'] = '<meta name="keywords" content="' . $db->add_special_chars($user_details['shop_metatags']) . '"> ';
}
}
else
{
$output['title'] = $setts['sitename'];
}
if (empty($output['meta_tags']))
{
$output['meta_tags'] = $db->add_special_chars($setts['metatags']);
}
}
return $output;
}
function remove_cache_img()
{
global $fileExtension;
$cache_directory = $fileExtension . 'cache/';
$time_limit = 60*60*24; ## one day
$cache_dir = opendir($cache_directory);
while ($file = readdir($cache_dir))
{
if($file != '..' && $file !='.' && $file !='' && $file !='index.htm')
{
$filestats = array();
$filestats = stat($cache_directory . $file);
if (($filestats[10] + $time_limit) < CURRENT_TIME)
{
@unlink($cache_directory . $file);
}
}
}
closedir($cache_dir);
clearstatcache();
}
function user_pics ($user_id, $reputation_only = false, $reverse = false)
{
global $db, $setts, $fileExtension;
(string) $display_output = null;
$user_details = $db->get_sql_row("SELECT enable_aboutme_page, shop_active, seller_verified, enable_profile_page FROM " . DB_PREFIX . "users WHERE user_id='" . $user_id . "'");
$positive_reputation = $db->count_rows('reputation', "WHERE user_id='" . $user_id . "' AND
reputation_rate IN (4,5) AND submitted=1 " . (($reverse) ? 'AND reverse_id>0' : ''));
$negative_reputation = $db->count_rows('reputation', "WHERE user_id='" . $user_id . "' AND
reputation_rate IN (1,2) AND submitted=1 " . (($reverse) ? 'AND reverse_id>0' : ''));
$reputation_rating = $positive_reputation - $negative_reputation;
$link_url = ($reverse) ? 'reverse_profile.php' : 'user_reputation.php';
$reputation_rating_link = '<span class="contentfont"><a href="' . $fileExtension . $link_url . '?user_id=' . $user_id . '">' . $reputation_rating . '</a></span>';
if ($reputation_rating < 1)
{
$display_output = ' (' . $reputation_rating_link . ') ';
}
else if ($reputation_rating >= 1 && $reputation_rating < 10)
{
$display_output = ' (' . $reputation_rating_link . ') <img align=absmiddle src="' . $fileExtension . 'themes/' . $setts['default_theme'] . '/img/system/yellow_star.gif" border="0">';
}
else if ($reputation_rating >= 10 && $reputation_rating < 50)
{
$display_output = ' (' . $reputation_rating_link . ') <img align=absmiddle src="' . $fileExtension . 'themes/' . $setts['default_theme'] . '/img/system/green_star.gif" border="0">';
}
else if ($reputation_rating >= 50 && $reputation_rating < 100)
{
$display_output = ' (' . $reputation_rating_link . ') <img align=absmiddle src="' . $fileExtension . 'themes/' . $setts['default_theme'] . '/img/system/blue_star.gif" border="0">';
}
else if ($reputation_rating >= 100 && $reputation_rating < 200)
{
$display_output = ' (' . $reputation_rating_link . ') <img align=absmiddle src="' . $fileExtension . 'themes/' . $setts['default_theme'] . '/img/system/red_star.gif" border="0">';
}
else if ($reputation_rating >= 200)
{
$display_output = ' (' . $reputation_rating_link . ') <img align=absmiddle src="' . $fileExtension . 'themes/' . $setts['default_theme'] . '/img/system/gold_star.gif" border="0">';
}
if (!$reputation_only && !$reverse)
{
if ($user_details['seller_verified'])
{
$display_output .= ' <img align=absmiddle src="' . $fileExtension . 'themes/' . $setts['default_theme'] . '/img/system/verified.gif" border="0" alt="' . GMSG_VERIFIED_SELLER . '">';
}
if ($user_details['enable_aboutme_page'])
{
$display_output .= ' <a href="' . $fileExtension . 'about_me.php?user_id=' . $user_id . '"><img src="' . $fileExtension . 'themes/' . $setts['default_theme'] . '/img/system/about_me.gif" border="0" align="absmiddle"></a>';
}
if ($user_details['shop_active'])
{
$display_output .= ' <a href="' . $fileExtension . 'shop.php?user_id=' . $user_id . '"><img src="' . $fileExtension . 'themes/' . $setts['default_theme'] . '/img/system/25store.gif" border="0" align=absmiddle></a>';
}
if ($user_details['enable_profile_page'] && $setts['enable_profile_page'])
{
$display_output .= ' <a href="' . $fileExtension . 'profile.php?user_id=' . $user_id . '"><img src="' . $fileExtension . 'themes/' . $setts['default_theme'] . '/img/system/profile.gif" border="0" align=absmiddle alt="' . MSG_VIEW_MEMBER_PROFILE . '"></a>';
}
}
return $display_output;
}