require "connect.php3";
require_once("user_auth.php");
update_cookie();
$NF_FANART_TABLE = 'nf_fanart';
$NF_FANART_AUTHOR_TABLE = 'nf_fanart_author';
$IMG_PER_ROW = 4;
if (!empty($UI['gal_rows']))
{
$IDX_THUMB_ROWS=$UI['gal_rows'];
}
else
{
$IDX_THUMB_ROWS=4;
}
$IDX_THUMB_COUNT = $IDX_THUMB_ROWS*$IMG_PER_ROW;
$GALLERY_DIR = 'gallery';
$THUMB_DIR = 'thumb';
$THUMB_HEIGHT = 100;
$THUMB_WIDTH = 100;
#pro samostatneho autora ukazeme vsechny obrazky
$SINGLE_AUTHOR_THUMB_NUM = 9999;
#pro souhrnnou stranku to bude jedna radka na autora
$MULTIPLE_AUTHOR_THUMB_NUM = $IMG_PER_ROW;
if ( (!empty($user_id)) && (isset($_REQUEST['fo'])))
{
$_fav="AND author_id IN (SELECT author_id FROM nf_favourite WHERE user_id='$user_id') ";
$_not=" oblíbených";
$_foh="&fo";
}
else
{
$_fav='';
$_foh='';
}
//tohle staci, abychom oznacili viditelne obrazky za shlednute... nebudem je trapit ;)
$_qw = mysql_query("select max(id) as mid, NOW() as nw from nf_fanart where publish=1");
$_row = mysql_fetch_array($_qw);
$last_seen=$UI['fanart_seen'];
$last_dseen=$UI['fanart_dseen'];
/* $_q="select count(approved) as mid, NOW() as nw from nf_fanart where publish=1 AND approved>'$UI[fanart_dseen]' $_fav";
// print_r($_q);
$_qw = mysql_query($_q);
$_row2 = mysql_fetch_array($_qw);
*/
if (empty($_REQUEST['limit']))
$limit=0;
else
$limit=$_REQUEST['limit'];
$limit=intval($limit);
if ($limit<0)
$limit=0;
//$dont_auth=1;
if(isset($user_id)) {
if (!empty($UI['sekce'])) // filtr na sekce
$_fs=" AND NOT($NF_FANART_TABLE.sekce IN $UI[sekce]) ";
else
$_fs="";
if (!isset($_REQUEST['limit'])) // empty($limit) - ale my chceme umoznit skok na nejnovejsi pomoci limit=0
{
$_q="SELECT author_id FROM $NF_FANART_TABLE WHERE datum<=NOW() AND approved>'$last_dseen' AND publish>0 $_fav $_fs GROUP BY $NF_FANART_TABLE.author_id";
@$_pn=intval(MySQL_Num_Rows(MySQL_Query($_q)));
// echo "$_q
\n[$_pn]
\n";
if ($_pn>$IDX_THUMB_COUNT)
$limit=$_pn-$IDX_THUMB_COUNT;
if (!empty($_pn))
{
$_not.=" (celkem nových: $_pn)";
}
}
if (empty($limit)) // od zacatku - pouzij jednodussi verzi
{
$q="UPDATE uzivatel SET fanart_seen=$_row[mid], fanart_dseen=NOW() WHERE id='$user_id'";
$UI['fanart_seen']=$_row['mid'];
$UI['fanart_dseen']=$_row['nw'];
}
else // oznac jen to, co uvidi
{
$_gpar='?limit=0'; // aby se slo dostat cudlikem "Galerie" na nejnovejsi prispevky
$q="SELECT author_id, MAX(id) AS mid, MAX(approved) AS m_datum FROM $NF_FANART_TABLE WHERE datum<=NOW() AND approved>'$last_dseen' AND publish>0 $_fav $_fs GROUP BY $NF_FANART_TABLE.author_id ORDER BY m_datum DESC, mid DESC LIMIT $limit,1";
// echo "$q
\n";
$_r=MySQL_Query($q);
$_v=MySQL_Fetch_Array($_r);
$_row['mid']=$_v['mid'];
if (!empty($_row['mid']))
$q="UPDATE uzivatel SET fanart_seen='$_v[mid]', fanart_dseen='$_v[m_datum]' WHERE id='$user_id'";
}
@MySQL_Query($q);
/* setcookie('g_seen', $_row['mid'], time()+3600*24*365);*/
$g_seen = $_row['mid']; //aby oznaceni zmizelo hned
}
else
{
$last_seen=0;
}
?>
Fanart - Novinky / Oblíbení autoři / Galerie
$_sql = "select *, nf_fanart.sekce as img_sekce, nf_fanart.id as img_id, nf_fanart.name as img_name, uzivatel.name as username from nf_fanart, uzivatel where uzivatel.id=nf_fanart.author_id and nf_fanart.author_id='$user_id' and publish='0' and join_contest = '$contest' ORDER BY datum ASC, nf_fanart.id ASC"; if (($_qw=mysql_query($_sql)) && mysql_num_rows($_qw)>0): ?> endif; ?>Nejnovější příspěvky
";
if ($limit+$IDX_THUMB_COUNT<$_tota['totr'])
{
echo "< Starší \n";
}
if ($limit>0)
{
echo "=$IDX_THUMB_COUNT)?($limit-$IDX_THUMB_COUNT):0)."$_foh\">Novější >\n";
}
echo " \n";
?>
|
|||||
// | ?> |