0) { $redCat = $cat; } if ($subcat > 0) { $redSubCat = $subcat; $sql = "SELECT parentCatId FROM categories WHERE catid = " . $subcat; $db->query($sql); $redCat = $db->result(); } $ownerid = isset($_GET['user']) ? (int) $_GET['user'] : 0; $search = isset($_GET['search']) ? rawurldecode($_GET['search']) : ''; $view = isset($_GET['view']) ? $_GET['view'] : ''; $get_participate = isset($_GET['participate']) ? (int) $_GET['participate'] : null; $get_side = isset($_GET['side']) ? (int) $_GET['side'] : 0; $offset = isset($_GET['offset']) && $_GET['offset'] >= 0 ? (int) $_GET['offset'] : 0; $anzPerPage = 24; $linkName = ''; $artist_links = ''; $info_text = null; require TP_DOCUMENT_ROOT.'includes/functions_header.php'; $mode = ($_SESSION['userid'] == $ownerid && isset($_GET['mode'])) ? $_GET['mode'] : ''; require(TP_DOCUMENT_ROOT.'includes/languages/'.$_SESSION['language'].'/lang_gallery.php'); require(TP_DOCUMENT_ROOT.'includes/languages/'.$_SESSION['language'].'/lang_global.php'); if ($get_participate != null) { $get_battle = new toonBattle($db, $get_participate, null); } $sql = ''; $navi = ''; $anzG = 0; $time_now = time(); $cartoons = array(); $pitch = ''; if (!isset($_GET['pitch']) || $_GET['pitch'] != 'easter') { createSearch(); } else { $sql = "SELECT SQL_CALC_FOUND_ROWS up.imageid,up.userid,up.imageuid,up.title,up.last_commented FROM uploads up WHERE up.date >= 1205598600 AND up.imageid IN (SELECT imageid FROM tags_search WHERE tagid IN (SELECT tagid FROM tags WHERE tag = 'easter')) ORDER BY up.imageid DESC LIMIT $offset,$anzPerPage"; $navi = 'search_qi=easter'; $pitch = 'easter'; } if ($sql != '') { list($cartoons, $anzG) = $cacheLayer->getGalleryData($sql, $navi, $offset); } /* user */ $user = array(); $db->query("SELECT user.name,user.userid FROM user WHERE user.status = 1 ORDER BY date DESC LIMIT 5"); while ($db->next_record()) { $user[] = $db->row(); } /* collections */ $collections = array(); if(isset($search_qi) && $search_qi != '') { $sql = "SELECT c.title, c.collectionid AS cid, c.date, u.name, u.userid, c.portfolio FROM user u LEFT JOIN collections c ON (u.userid = c.ownerid) WHERE c.title like '%".$db->real_escape_string($search_qi)."%' OR c.tags like '%".$db->real_escape_string($search_qi)."%' ORDER BY c.last_change DESC, c.date DESC"; $db->query($sql); $collections = $db->getAllRows(); foreach ($collections as &$v) { $v['avatar'] = '/'.colAvatarSrc($v['cid'],false); $db->query("SELECT COUNT(*) FROM collection_rights cr WHERE collectionid = ".$v['cid']." AND accepted = 1"); $v['anz_members'] = $db->result(); $db->query("SELECT COUNT(*) FROM collection_images ci WHERE collectionid = ".$v['cid']." AND accepted = 1"); $v['anz_images'] = $db->result(); } } /* images */ $script = 'var serverTime = '.time().';'; if ($mode != 'edit') { if ($search == 'Most Viewed') { $queryDays = empty($days) ? '' : '&days=' . $days; $link_edit = ''; foreach (array(array('today',GAL_MV_TODAY),array('yesterday',GAL_MV_YESTERDAY),array('week',GAL_MV_WEEK),array('month',GAL_MV_MONTH),array('year',GAL_MV_YEAR),array('all',GAL_MV_ALL)) as $v) { if ($view == $v[0]) { $link_edit .= ' | '.$v[1].''; } else { $link_edit .= ' | '.$v[1].''; } } } else if ($search == 'Most Discussed') { if ($view == '') { $view = 'month'; } $link_edit = ''; foreach (array(array('today',GAL_MD_TODAY),array('week',GAL_MD_WEEK),array('month',GAL_MD_MONTH),array('all',GAL_MD_ALL)) as $v) { if ($view == $v[0]) { $link_edit .= ' | '.$v[1].''; } else { $link_edit .= ' | '.$v[1].''; } } } else if ($search == 'Newest') { if ($view == '') { $view = 'all'; } $link_edit = ''; foreach (array(array('today',GAL_MD_TODAY),array('week',GAL_MD_WEEK),array('month',GAL_MD_MONTH),array('all',GAL_MD_ALL)) as $v) { if ($view == $v[0]) { $link_edit .= ' | '.$v[1].''; } else { $link_edit .= ' | '.$v[1].''; } } } else if ($search == 'Illustrations') { if ($view == '') { $view = 'newest'; } $link_edit = ''; foreach (array(array('newest',GAL_NEWEST),array('views',GAL_MOSTPOP),array('toprated',GAL_TOP_RATED)) as $v) { if ($view == $v[0]) { $link_edit .= ' | '.$v[1].''; } else { $link_edit .= ' | '.$v[1].''; } } } else if ($search == 'Photo') { if ($view == '') { $view = 'newest'; } $link_edit = ''; foreach (array(array('newest',GAL_NEWEST),array('views',GAL_MOSTPOP),array('toprated',GAL_TOP_RATED)) as $v) { if ($view == $v[0]) { $link_edit .= ' | '.$v[1].''; } else { $link_edit .= ' | '.$v[1].''; } } } else if ($search == 'Draw Me') { if ($view == '') { $view = 'newest'; } $link_edit = ''; foreach (array(array('newest',GAL_NEWEST),array('views',GAL_MOSTPOP),array('toprated',GAL_TOP_RATED)) as $v) { if ($view == $v[0]) { $link_edit .= ' | '.$v[1].''; } else { $link_edit .= ' | '.$v[1].''; } } } else { $link_edit = ($ownerid != $_SESSION['userid'] || !$g_user->isLoggedIn()) ? '' : "".GAL_EDITC." ".GAL_ACT_LIST.""; } require TP_DOCUMENT_ROOT.'includes/templates/tpl_gallery.php'; } else { $delete_fav = ($search == 'favorites') ? THB_FAV : THB_TXT; require TP_DOCUMENT_ROOT.'includes/templates/tpl_gallery_edit.php'; } function createNaviLink() { global $db,$days,$search_qi,$search_artist,$lang,$cat,$subcat,$tech,$country,$ownerid,$search,$pitch,$mode,$view,$info_text,$get_participate, $get_side; $link = '/gallery.php'; $data = array(); $type = ''; $d = ''; $d1 = ''; if ('' != $search_qi) { $data[] = 'search_qi='.$search_qi; if ($search_artist) {//Damit die search_qi nicht rewritet wird. $data[] = 'search_artist=1'; } $type = 'tag'; $d = $search_qi; } if ('' != $lang) { $data[] = 'lang='.$lang; $type = ''; } if (null != $get_participate) { $data[] = 'participate='.$get_participate; $data[] = 'side='.$get_side; } if ('' != $cat) { $data[] = 'cat='.$cat; $type = 'category'; $d = isset($_GET['category']) ? $_GET['category'] : ''; $d1 = $cat; if ($d) { $db->query("SELECT to1.text, to1.languageid FROM categories c INNER JOIN translation_objects to1 ON c.desc_objectid = to1.objectid WHERE c.catid = " . $cat); $default_text = null; while ($db->next_record()) { if ($db->f('languageid') == 3) { $default_text = $db->f('text'); } if ($db->f('languageid') == $_SESSION['language']) { $info_text = $db->f('text'); } } if (!$info_text) { $info_text = $default_text; } } } if (0 != $subcat) { $data[] = 'subcat='.$subcat; $type = 'subcategory'; $d = isset($_GET['category']) ? $_GET['category'] : ''; $d1 = $subcat; if ($d) { $db->query("SELECT to1.text, to1.languageid FROM categories c INNER JOIN translation_objects to1 ON c.desc_objectid = to1.objectid WHERE c.catid = " . $subcat); $default_text = null; while ($db->next_record()) { if ($db->f('languageid') == 3) { $default_text = $db->f('text'); } if ($db->f('languageid') == $_SESSION['language']) { $info_text = $db->f('text'); } } if (!$info_text) { $info_text = $default_text; } } } if ('' != $tech) { $data[] = 'tech='.$tech; $type = 'technique'; $d = isset($_GET['technique']) ? $_GET['technique'] : ''; $d1 = $tech; } if ('' != $country) { $data[] = 'country='.$country; $type = 'country'; $d = isset($_GET['country_name']) ? $_GET['country_name'] : ''; $d1 = $country; } if ('' != $ownerid) { $data[] = 'user='.$ownerid; } if ('' != $search) { $data[] = 'search='.$search; $type = $search; } if ('' != $pitch) { $data[] = 'pitch='.$pitch; $type = 'pitch'; } if ('' != $mode) { $data[] = 'mode='.$mode; } if ('' != $view) { $data[] = 'view='.$view; } if (!empty($days)) { $data[] = 'days='.$days; } if (count($data) == 1 && $type != '') { $link = printGalleryLink($type, $d, $d1); } if (count($data) > 1 || $type == '') { $link .= '?'.implode('&',$data); } return $link; } function createSearch() { global $db,$anzPerPage,$search_qi,$lang,$cat,$subcat,$tech,$country,$ownerid,$search,$view,$offset,$sql; global $navi,$mode,$search_artist,$artist_links,$linkName,$days; $navi = ''; $sql_join = ''; $sql_where = 'WHERE '; $sql_order = 'ORDER BY imageid DESC '; $sql_limit = 'LIMIT '.$offset.','.$anzPerPage; $sql_from = 'FROM '; $sql_straight = ''; $sql_distinct = ''; $sql = ''; $tempLinkName = array(); $a = 0; if (($search_artist == 1) && ($search_qi != '')) { $search_like = $db->es(str_replace('*','%',$search_qi)); $artist_links .= '
'; $db->query("SELECT STRAIGHT_JOIN u.userid,u.name,u.date,p.realname,COUNT(up.imageid) AS cartoons,SUM(ic.counter) AS clicks FROM user u LEFT JOIN uploads up ON up.userid = u.userid LEFT JOIN image_counters ic ON ('va', '', up.imageid) = (ic.type, ic.range, ic.imageid) INNER JOIN user_profile p ON u.userid = p.userid WHERE up.type != 2 AND (u.name LIKE '".$search_like."%' OR p.realname LIKE '".$search_like."%') GROUP BY u.userid ORDER BY u.name LIMIT 20"); while ($db->next_record() && ($a++ < 20)) { if ($a < 20) { $artist_links .= '
'.$db->f('name').'\'s avatar
'.$db->f('name').' '.(($db->f('realname') != "") ? '('.$db->f('realname').')' : '').'
'.$db->f('clicks').' '.GAL_VIEWS.' reg. '.date('d/m/Y',$db->f('date')).'
'.GLOB_GALLERY.'('.$db->f('cartoons').') | '.GAL_SEND_MESSAGE.'
'; } else { $artist_links .= ' ...'; } } $artist_links .= '
'; } if ($a == 0) { $artist_links = ''; } if ($search_qi != '') { $sql_straight = 'STRAIGHT_JOIN '; $sql_distinct = 'DISTINCT '; while (strpos($search_qi,' ') !== false) { $search_qi = str_replace(' ',' ',$search_qi); } $incTags = explode(' ',$search_qi); $anzI = count($incTags); $a = 0; // Anzahl AND-Tags for ($i = 0; $i < $anzI; $i++) { if ($incTags[$i][0] != '-') { $a++; } } for ($i = 0; $i < $anzI; $i++) { if ($incTags[$i][0] == '-') { // NOT-Semantik: -Tag soll immer unterdrückt werden $sql .= 'AND NOT EXISTS '; $sql .= '(SELECT * FROM tags_search s,tags t WHERE up.imageid=s.imageid AND s.tagid=t.tagid AND t.tag like \''; $sql .= $db->es(str_replace(array('*','+','-'),array('%','',''),$incTags[$i])); $sql .= '\') '; } else { --$a; $sql_from .= 'tags a'.($a).', tags_search b'.($a).', '; $sql .= 'AND a'.($a).'.tag LIKE \''; $sql .= $db->es(str_replace(array('*','+','-'),array('%','',''),$incTags[$i])); $sql .= '\' AND a'.($a).'.tagid=b'.($a).'.tagid AND b'.($a).'.imageid='.(($a>0)?'b'.($a-1):'up').'.imageid '; } } $navi .= '&search_qi='.$search_qi; $tempLinkName[] = ' \''.htmlspecialchars($search_qi).'\''; } if ($lang > 0) { $sql .= 'AND up.languageid = '.$lang.' '; $navi .= '&lang='.$lang; $linkName = GAL_RESULT; } if ($cat > 0) { $sql .= 'AND up.catid = '.$cat.' '; $navi .= '&cat='.$cat; $d = isset($_GET['category']) ? $_GET['category'] : ''; $tempLinkName[] = GLOB_CATEGORY." '".htmlspecialchars($d)."'"; } if ($subcat > 0) { $sql .= 'AND 1=1 '; $sql_join = 'INNER JOIN uploads_subcategories us ON (up.imageid, '.$subcat.') = (us.imageid, us.subCatId) '; $navi .= '&subcat='.$subcat; $d = isset($_GET['category']) ? $_GET['category'] : ''; $tempLinkName[] = GLOB_CATEGORY." '".htmlspecialchars($d)."'"; } if ($tech > 0) { $sql .= 'AND up.techid = '.$tech.' '; $navi .= '&tech='.$tech; $d = isset($_GET['technique']) ? $_GET['technique'] : ''; $tempLinkName[] = GLOB_TECH." '".htmlspecialchars($d)."'"; } $name = ''; if ($ownerid > 0) { $sql .= 'AND up.userid = '.$ownerid.' '; $sql_order = 'ORDER BY imageid DESC '; $navi .= '&user='.$ownerid; $db->query("SELECT name FROM user WHERE userid = $ownerid"); $name = (string)$db->result(); $link = "".$name.""; if ($search == '') { $temp = sprintf(SORT_GAL, $name); } else { $temp = sprintf(SORT_FAV, $name); } $tempLinkName[] = str_replace($name, $link, $temp); } if (!empty($country)) { $sql_from .= 'countries c, user_profile u, '; $sql .= 'AND u.userid = up.userid AND c.iso3166_alpha2 = \''.$db->es($country).'\' AND u.country = c.countryid '; $navi .= '&country='.$country; $d = isset($_GET['country_name']) ? $_GET['country_name'] : ''; $tempLinkName[] = GLOB_COUNTRY." '".htmlspecialchars($d)."'"; } if ($navi != '') { $navi = substr($navi,1); } if ($search != '') { switch ($search) { case 'Newest': switch ($view) { case 'today': $minDate = time()-86400; break; case 'week': $minDate = time()-86400*7; break; case 'month': $minDate = time()-86400*30; break; default: $minDate = 0; break; } $sql .= 'AND type = 0 '; if ($minDate > 0) { $sql .= 'AND up.date > '.$minDate.' '; } $sql_order = 'ORDER BY imageid DESC '; $navi = 'search=Newest'; $tempLinkName[] = SORT_NEWEST." ".GLOB_CARTOONS; if ($minDate > 0) { $navi .= '&view='.$view; } break; case 'Random': $db->query("SELECT MAX(imageid) FROM uploads"); $myRand = rand(1, $db->result() - 25); $sql .= 'AND type = 0 AND imageid >= ' . $myRand . ' '; $navi = 'search=Random'; $tempLinkName[] = SORT_RAND." ".GLOB_CARTOONS; break; case 'Featured': $sql .= 'AND 1 '; $sql_join = 'INNER JOIN uploads_featured ON uploads_featured.imageid = up.imageid '; $sql_order = 'ORDER BY uploads_featured.created_at DESC '; $navi = 'search=Featured'; $tempLinkName[] = SORT_FEAT." ".GLOB_CARTOONS; break; case 'Selected': $sql .= 'AND type = 0 '; $sql_join = 'INNER JOIN uploads_selected ON uploads_selected.imageid = up.imageid '; $sql_order = 'ORDER BY uploads_selected.date DESC '; $navi = 'search=Selected'; $tempLinkName[] = SORT_SEL." ".GLOB_CARTOONS; break; case 'Most Viewed': $tempLinkName[] = SORT_VIEWS." ".GLOB_CARTOONS; //$dateAgo = empty($days) ? '' : "AND up.date >= " . (time() - $days * 86400) . " "; switch ($view) { /*case 'today': $sql .= 'AND up.type = 0 ' . $dateAgo; $sql_join = "LEFT JOIN image_counters ic ON (ic.type,ic.range,ic.imageid) = ('vd','".date('Y-z',time())."',up.imageid) "; $sql_order = 'ORDER BY IFNULL(ic.counter,0)*1E12+up.imageid DESC '; $navi = 'search=Most%20Viewed&view=today'; break 2; case 'yesterday': $sql .= 'AND up.type = 0 ' . $dateAgo; $sql_join = "LEFT JOIN image_counters ic ON (ic.type,ic.range,ic.imageid) = ('vd','".date('Y-z',time()-86400)."',up.imageid) "; $sql_order = 'ORDER BY IFNULL(ic.counter,0)*1E12+up.imageid DESC '; $navi = 'search=Most%20Viewed&view=yesterday'; break 2; case 'week': $sql .= 'AND up.type = 0 ' . $dateAgo; $sql_join = "LEFT JOIN image_counters ic ON (ic.type,ic.range,ic.imageid) = ('vw','".date('Y-W',time())."',up.imageid) "; $sql_order = 'ORDER BY IFNULL(ic.counter,0)*1E12+up.imageid DESC '; $navi = 'search=Most%20Viewed&view=week'; break 2; case 'month': $sql .= 'AND up.type = 0 ' . $dateAgo; $sql_join = "LEFT JOIN image_counters ic ON (ic.type,ic.range,ic.imageid) = ('vm','".date('Y-m',time())."',up.imageid) "; $sql_order = 'ORDER BY IFNULL(ic.counter,0)*1E12+up.imageid DESC '; $navi = 'search=Most%20Viewed&view=month'; break 2; case 'year': $sql .= 'AND up.type = 0 ' . $dateAgo; $sql_join = "LEFT JOIN image_counters ic ON (ic.type,ic.range,ic.imageid) = ('vy','".date('Y',time())."',up.imageid) "; $sql_order = 'ORDER BY IFNULL(ic.counter,0)*1E12+up.imageid DESC '; $navi = 'search=Most%20Viewed&view=year'; break 2; case 'all': $sql .= 'AND up.type = 0 ' . $dateAgo; $sql_join = "LEFT JOIN image_counters ic ON (ic.type,ic.range,ic.imageid) = ('va','',up.imageid) "; $sql_order = 'ORDER BY IFNULL(ic.counter,0)*1E12+up.imageid DESC '; $navi = 'search=Most%20Viewed&view=all'; break 2;*/ default: $sql .= 'AND up.type = 0 ';// . $dateAgo; $sql_order = 'ORDER BY up.clicks DESC '; $navi = 'search=Most%20Viewed'; break 2; } case 'Top 100': $time_now = time(); $thirty_days = $time_now - 14 * 86400; $sql = "AND type = 0 AND up.date BETWEEN $thirty_days AND $time_now "; $sql_order = 'ORDER BY rater_count DESC '; $navi = 'search=Top%20100'; $tempLinkName[] = SORT_TOPRATE." ".GLOB_CARTOONS; break; case 'favorites': $sql = 'AND favorites.userid = '.$ownerid.' '; $sql_join = 'LEFT JOIN favorites ON favorites.imageid = up.imageid '; $sql_order = 'ORDER BY favorites.date DESC '; $navi = 'search=favorites&user='.$ownerid; break; case 'Illustrations': $tempLinkName[] = SORT_FREE; switch ($view) { case 'views': $sql .= 'AND type = 1 '; $sql_order = 'ORDER BY clicks*1E12+up.imageid DESC '; $navi = 'search=Illustrations&view=views'; break 2; case 'toprated': $sql .= 'AND type = 1 '; $sql_order = 'ORDER BY average DESC '; $navi = 'search=Illustrations&view=toprated'; break 2; case 'newest': default: $sql .= 'AND type = 1 '; $sql_order = 'ORDER BY imageid DESC '; $navi = 'search=Illustrations&view=newest'; break 2; } case 'Photo': $tempLinkName[] = SORT_PHOTO; switch ($view) { case 'views': $sql .= 'AND type = 4 '; $sql_order = 'ORDER BY clicks*1E12+up.imageid DESC '; $navi = 'search=Photo&view=views'; break 2; case 'toprated': $sql .= 'AND type = 4 '; $sql_order = 'ORDER BY average DESC '; $navi = 'search=Photo&view=toprated'; break 2; case 'newest': default: $sql .= 'AND type = 4 '; $sql_order = 'ORDER BY imageid DESC '; $navi = 'search=Photo&view=newest'; break 2; } break; case 'Draw Me': $tempLinkName[] = SORT_MANGA; switch ($view) { case 'views': $sql .= 'AND type = 5 '; $sql_order = 'ORDER BY clicks*1E12+up.imageid DESC '; $navi = 'search=Draw%20Me&view=views'; break 2; case 'toprated': $sql .= 'AND type = 5 '; $sql_order = 'ORDER BY average DESC '; $navi = 'search=Draw%20Me&view=toprated'; break 2; case 'newest': default: $sql .= 'AND type = 5 '; $sql_order = 'ORDER BY imageid DESC '; $navi = 'search=Draw%20Me&view=newest'; break 2; } break; case 'Bubbles': $sql .= 'AND bubbleflag = 1 '; $sql_order = 'ORDER BY imageid DESC '; $navi = 'search=Bubbles'; break; case 'User Bubbles': $sql .= 'AND bubbleflag = 1 AND imageid IN (SELECT imageid FROM bubbles WHERE userid = '.(int)$_SESSION['userid'].') '; $sql_order = 'ORDER BY imageid DESC '; $navi = 'search=User%20Bubbles'; break; case 'Most Discussed': switch ($view) { case 'today': $minDate = time()-86400; break; case 'week': $minDate = time()-86400*7; break; case 'month': default: $minDate = time()-86400*30; break; case 'all': $minDate = 0; break; } $sql .= 'AND type = 0 '; if ($minDate > 0) { $sql .= 'AND c.date > '.$minDate.' '; } $sql_join = 'LEFT JOIN comments c ON c.imageid = up.imageid '; $sql_order = 'GROUP BY up.imageid ORDER BY count(c.imageid)*1E10+up.imageid DESC '; $navi = 'search=Most%20Discussed'; if ($minDate > 0) { $navi .= '&view='.$view; } $tempLinkName[] = SORT_DISCUSSED." ".GLOB_CARTOONS;; break; } } $linkName = GAL_RESULT.': '.implode(', ', $tempLinkName); if (substr($sql,0,3) == 'AND') { $sql = substr($sql,3); } if ($sql != '') { //Damit im Edit-Mode auch wirklich ALLE Bilder auftauchen $type = ' AND up.type != 2 '; if ($mode == 'edit') { $type = ''; $sql_order = 'ORDER BY imageid DESC '; } $sql = 'SELECT ' . $sql_straight . 'SQL_CALC_FOUND_ROWS ' . $sql_distinct . 'up.imageid,up.userid,up.imageuid,up.title,up.last_commented,up.type,up.thumb_x,up.thumb_y,up.keywords,up.commercial,up.type,user.name '.$sql_from.'uploads up INNER JOIN user ON user.userid = up.userid '.$sql_join.$sql_where.$sql.$type.$sql_order.$sql_limit; } //echo $sql; } function handelSeo() { global $db; $offset = isset($_GET['offset']) ? '?offset='.$_GET['offset'] : ''; if (isset($_GET['search_qi'])) { header('HTTP/1.1 301 Moved Permanently'); header('Location: '.printGalleryLink('tag', $_GET['search_qi']).$offset); die(); } if (isset($_GET['cat'])) { $sql = "SELECT text FROM translation_objects `to` INNER JOIN categories c ON (c.catid, c.objectid, 3) = (".(int)$_GET['cat'].", to.objectid, to.languageid)"; $db->query($sql); if ($db->next_record()) { header('HTTP/1.1 301 Moved Permanently'); header('Location: '.printGalleryLink('category', html_entity_decode($db->f('text')), $_GET['cat']).$offset); die(); } } if (isset($_GET['tech'])) { $sql = "SELECT text FROM translation_objects `to` INNER JOIN techniques t ON (t.techid, t.objectid, 3) = (".(int)$_GET['tech'].", to.objectid, to.languageid)"; $db->query($sql); if ($db->next_record()) { header('HTTP/1.1 301 Moved Permanently'); header('Location: '.printGalleryLink('technique', html_entity_decode($db->f('text')), $_GET['tech']).$offset); die(); } } if (isset($_GET['country'])) { $sql = "SELECT text, iso3166_alpha2 FROM translation_objects `to` INNER JOIN countries c ON (c.countryid, c.objectid, 3) = (".(int)$_GET['country'].", to.objectid, to.languageid)"; $db->query($sql); if ($db->next_record()) { header('HTTP/1.1 301 Moved Permanently'); header('Location: '.printGalleryLink('country', $db->f('text'), $db->f('iso3166_alpha2')).$offset); die(); } } } ?>