\n";} require(TP_DOCUMENT_ROOT.'includes/languages/'.$_SESSION['language'].'/lang_global.php'); require TP_DOCUMENT_ROOT.'includes/functions_gallery.php'; require TP_DOCUMENT_ROOT.'forum/functions_post.php'; require TP_DOCUMENT_ROOT.'includes/functions_showImage.php'; require TP_DOCUMENT_ROOT.'includes/functions_header.php'; require TP_DOCUMENT_ROOT.'includes/functions_collection.php'; require(TP_DOCUMENT_ROOT.'includes/languages/'.$_SESSION['language'].'/lang_showimage.php'); require(TP_DOCUMENT_ROOT.'includes/languages/'.$_SESSION['language'].'/lang_func.php'); require(TP_DOCUMENT_ROOT.'includes/languages/'.$_SESSION['language'].'/lang_gallery.php'); require(TP_DOCUMENT_ROOT.'includes/languages/'.$_SESSION['language'].'/lang_shop_search.php'); if (SHOW_TRACE){echo "After require: " . (microtime(true) - $startTime) . "
\n";} define('ACTIVE_GLOBAL_TAB',0); //GET-Parameter übernehmen $imageid = isset($_GET['imageid']) ? (int) $_GET['imageid'] : 0; $title = isset($_GET['title']) ? rawurldecode($_GET['title']) : ""; $bubbleid = isset($_GET['bubbleid']) ? (int) $_GET['bubbleid'] : 0; $reiter_selection = isset($_GET['reiter']) ? (int) $_GET['reiter'] : 0; $actualPage = isset($_GET['page']) ? (int) $_GET['page'] : 1; $imageData = $cacheLayer->getMainImageData($imageid, $_SESSION['language']); if (empty($imageData)) { require(TP_DOCUMENT_ROOT.'includes/templates/tpl_404.php'); } $imageData = array_merge($imageData, $cacheLayer->getMainImageDataUser($imageid, $_SESSION['userid'])); //Tags $imageData['tags'] = $cacheLayer->getMainImageTags($imageid, $imageData); $imageData['subcategories'] = $cacheLayer->getMainImageSubCategories($imageid, $_SESSION['language']); if (SHOW_TRACE){echo "
After cached data: " . (microtime(true) - $startTime) . "
\n";} //Navigation abfragen via Cookie(wg. SEO) $cookieid = ''; if (isset($_COOKIE['toonpool_navi'])) { if (preg_match('/(navid=\d+)/',trim(rawurldecode($_COOKIE['toonpool_navi'])),$erg)) { $cookieid = $erg[1].','; } $content = explode(',',trim(rawurldecode($_COOKIE['toonpool_navi']))); $navi = count($content) == 2 ? $content[1] : $content[0]; if ($navi == '') { $navi = "search=Newest"; } else { // cid aus cookie extrahieren für counter-Aktualisierung! if (preg_match('/^(-?\d+)_(.*)/',$navi,$erg)) { $testnavi = $erg[2]; } else { $testnavi = $navi; } $navi_pieces = explode('&',$testnavi); if (false !== $navi_pieces) { foreach ($navi_pieces as $v) { $qv = explode('=',$v); if (false != $qv && count($qv) == 2) { if (in_array($qv[0],array('cid'))) { ${$qv[0]} = $qv[1]; } } } } } } else { $navi = "search=Newest"; } $script = ''; if ($_SESSION['imageid'] != $imageid) {//Reload sperre, simple Version updateImageCounters(); } $_SESSION['imageid'] = $imageid; //Click-Counter User-Tagebuch if ($_SESSION['userid'] > 0) { $db->query("INSERT INTO user_viewed (userid,imageid,counter,date) VALUES (".(int)$_SESSION['userid'].",$imageid,1,".time().") ON DUPLICATE KEY UPDATE counter=counter+1,date=".time()); } //Ein paar Daten vorbereiten: //Bilder-Links $imgsrc = "/user/".$imageData['userid']."/files/".$imageData['imageuid']."5.jpg"; $avatar = "/user/".$imageData['userid']."/avatar/avatarK.jpg"; //Hier die Kommentare $comments = array(); $comments_per_page = 10; $comments_offset = 0; list($comments, $comments_gesamt) = $cacheLayer->getImageComments($imageid, 0, 10); $comments_anzahl = count($comments); if( isset($_SESSION['userid'] )) { foreach($comments as &$comment) { $sql = "SELECT count FROM comments_rating WHERE userid = ".$_SESSION['userid']." AND typeid = ".COMMENT_LIKE_TYPE_SHOWIMAGE." AND commentid = ".$comment['commentid']; $db->query($sql); $liked = $db->result(); $comment['liked'] = (bool)$liked; } } // hier die übersetzungen $translations = array(); $search = array("\r\n","\r","\n"); $replace = array("
","","
"); $sql = "SELECT a.userid,a.translationid,a.translation,b.name,d.name AS noname,d.ip,to.text AS long_desc,l.languageid FROM translations a LEFT JOIN user b ON a.userid = b.userid LEFT JOIN nouser d ON a.nouserid = d.nouserid INNER JOIN languages l ON a.languageid = l.languageid INNER JOIN translation_objects `to` ON (to.objectid,to.languageid) = (l.objectid,".$_SESSION['language'].") WHERE a.imageid = $imageid ORDER BY a.date DESC"; $tmpData = $dbRead->fetchAll($sql); foreach ($tmpData as $tmp) { $translations[] = array( 'translationid' => $tmp['translationid'], 'translation' => $tmp['translation'], 'long_desc' => $tmp['long_desc'], 'userid' => $tmp['userid'], 'name' => $tmp['userid'] > 0 ? $tmp['name'] : $tmp['noname'], 'edit' => ($_SESSION['userid'] == $tmp['userid'] || checkRights(TP_RIGHTS_TRANSLATIONS_EDIT)) ? 1 : 0, ); $script .= "trans.translations[".$tmp['translationid']."] = {'translation':'".str_replace($search,$replace,addslashes($tmp['translation']))."','long_desc':'".$tmp['long_desc']."','languageid':".$tmp['languageid'].",'userid':'".$tmp['userid']."','name':'".($tmp['userid']>0?$tmp['name']:$tmp['noname'])."','edit':".(($_SESSION['userid'] == $tmp['userid'] || checkRights(TP_RIGHTS_TRANSLATIONS_EDIT))?1:0)."};"; } $anzahl_translations = count($translations); $xxxFilter = $imageData['xxxflag'] == 0 ? 0 : null; $moreofthisuser = showUserFiles($imageData['userid'],$imageid,$xxxFilter,3); $tpl_showImage_sfs = TP_DOCUMENT_ROOT.'includes/templates/tpl_showImage_sfs_anonym.php'; /*if (isset($_COOKIE['toonpool_guest'])) { $daten = explode(",",rawurldecode($_COOKIE['toonpool_guest'])); $script .= "var nouser_name = '".$daten[0]."';"; $script .= "var nouser_email = '".$daten[1]."';"; }*/ $countAddToCollection = 0; $optAddToCollection = ''; $linksAddToCollection = ''; $countAddToPortfolio = 0; $optAddToPortfolio = ''; $linksAddToPortfolio = ''; if (userLoggedIn()) { $tpl_showImage_sfs = TP_DOCUMENT_ROOT.'includes/templates/tpl_showImage_sfs_user.php'; //$script .= 'nouser = false;'; // für eingeloggte Benutzer: "Add to Collection" und "Show Collection" $db->query("SELECT c.collectionid AS cid,c.title FROM collection_rights cr, collections c WHERE c.collectionid = cr.collectionid AND cr.userid = ".(int)$_SESSION['userid']." AND cr.right_gallery = 1 AND cr.accepted = 1 AND c.portfolio = 0 AND NOT EXISTS(SELECT 1 FROM collection_images ci WHERE ci.collectionid = c.collectionid AND ci.imageid = ".$imageid.") ORDER BY c.title ASC"); while ($db->next_record()) { $optAddToCollection .= ''; $linksAddToCollection .= ''.print_maxchars($db->f('title'),32).'
'; $countAddToCollection++; } if ($imageData['userid'] == $_SESSION['userid']) { $db->query("SELECT c.collectionid AS cid,c.title FROM collections c WHERE c.ownerid = ".(int)$_SESSION['userid']." AND c.portfolio = 1 AND NOT EXISTS(SELECT 1 FROM collection_images ci WHERE ci.collectionid = c.collectionid AND ci.imageid = ".$imageid.") ORDER BY c.title ASC"); while ($db->next_record()) { $optAddToPortfolio .= ''; $linksAddToPortfolio .= ''.print_maxchars($db->f('title'),32).'
'; $countAddToPortfolio++; } } } $countShowCollections = 0; $optShowCollections = ''; $linksShowCollections = ''; $sql = "SELECT DISTINCT c.collectionid AS cid,c.title FROM collection_images ci INNER JOIN collections c ON c.collectionid = ci.collectionid LEFT JOIN collection_rights cr ON cr.collectionid = c.collectionid WHERE ci.imageid = ".$imageid." AND ci.accepted = 1 AND ((cr.userid = ".(int)$_SESSION['userid']." AND cr.accepted = 1 AND c.public_gallery = 0) OR (c.public_gallery = 1)) AND c.portfolio = 0 ORDER BY c.title ASC"; $tmpData = $dbRead->fetchAll($sql); foreach ($tmpData as $tmp) { $optShowCollections .= ''; $linksShowCollections .= ''.print_maxchars($tmp['title'],64).'
'; $countShowCollections++; } $countShowPortfolios = 0; $optShowPortfolios = ''; $linksShowPortfolios = ''; $db->query("SELECT c.collectionid AS cid,c.title FROM collection_images ci, collections c WHERE c.collectionid = ci.collectionid AND ci.imageid = ".$imageid." AND ci.accepted = 1 AND c.portfolio = 1 ORDER BY title ASC"); while ($db->next_record()) { $optShowPortfolios .= ''; $linksShowPortfolios .= ''.print_maxchars($db->f('title'),64).'
'; $countShowPortfolios++; } $script .= 'var serverTime = '.time().';'; // Bubble-Informationen zusammenstellen $next_bubble = 0; // Vorbelegung, kein nächstes Bubble $prev_bubble = 0; // Vorbelegung, kein voriges Bubble if ($bubbleid > 0) { $sql = 'SELECT bubbleid FROM bubbles WHERE imageid='.$imageid.' AND bubbleid='.$bubbleid; $db->query($sql); if ($db->next_record()) { $bubbleid = $db->f('bubbleid'); $sql = 'SELECT b.userid,u.useruid,u.name,to.text AS language,b.translation,b.title,b.date,f.font,b.fontsize FROM bubbles b,bubble_fonts f,user u,languages l INNER JOIN translation_objects `to` ON (to.objectid,to.languageid) = (l.objectid,'.$_SESSION['language'].') WHERE b.languageid=l.languageid AND u.userid=b.userid AND b.fontid=f.fontid AND b.bubbleid='.$bubbleid; $db->query($sql); $db->next_record(); $bubbleData = $db->row(); $bubbleText = array(); $sql = 'SELECT `left`,top,width,height,text,f.font,fontsize,align,color,bgcolor,transparent FROM bubble_text t LEFT JOIN bubble_fonts f ON t.fontid=f.fontid WHERE bubbleid='.$bubbleid; $db->query($sql); while ($db->next_record()) { $bubbleText[] = $db->row(); } $sql = 'SELECT bubbleid FROM bubbles WHERE imageid = '.$imageid.' AND bubbleid > '.$bubbleid. ' ORDER by bubbleid ASC LIMIT 1'; $db->query($sql); if ($db->next_record()) { $prev_bubble = $db->f('bubbleid'); } $sql = 'SELECT bubbleid FROM bubbles WHERE imageid = '.$imageid.' AND bubbleid < '.$bubbleid. ' ORDER by bubbleid DESC LIMIT 1'; $db->query($sql); if ($db->next_record()) { $next_bubble = $db->f('bubbleid'); } } else { $bubbleid = 0; } } else if ($imageData['bcount'] > 0) { $sql = 'SELECT bubbleid FROM bubbles WHERE imageid='.$imageid.' ORDER BY bubbleid DESC LIMIT 1'; $db->query($sql); if ($db->next_record()) { $next_bubble = $db->f('bubbleid'); } } // für den Wiedereinstieg nach BubbleIt.php?action=new&imageid=# oder BubbleIt.php?action=edit&bubbleid=# if ($imageData['bubbleflag'] > 0) { $_SESSION['si_imageid'] = $imageid; $_SESSION['si_title'] = $imageData['title']; } // TODO sts 16.12.2011 prüfen ob dieses query noch gebraucht wird da ersetzt durch neue class_shopImport.php $shopItemLinks = array(); $shopItemLink = ''; $shopPostcard = 'false'; $db->query("SELECT DISTINCT sp.productid, to1.text FROM shop_products sp INNER JOIN translation_objects to1 ON (sp.objectid, ".$_SESSION['language'].") = (to1.objectid, to1.languageid) INNER JOIN shop_products_attributes spa USING (productid) INNER JOIN shop_items_attributes sia USING (attributeid) WHERE sia.imageid = ".$imageid); while ($db->next_record()) { $shopItemLinks[$db->f('productid')] = array('link' => shop::printShopItemLink($title,$imageid, $db->f('productid')), 'name' => $db->f('text')); $shopItemLink = shop::printShopItemLink($title,$imageid); } // einfügen der produkt links aus dem neuen shop //$shopImport = new shopImport($_SESSION['language']); $newShopLink = '';//$shopImport->getShopLink($imageData['userid']); //$viewShopProductLinksCount = $shopImport->getAllShopProductsCountByUserId($imageData['userid']); $viewShopProductLinksCount = 0; //$shopItemLinks = $shopImport->getProductsForShowImage($imageid, $imageData['userid'], 3); $shopUserName = $imageData['name']; $pluralType = array( '1' => MP_PRODUCTTYPE_1, '3' => MP_PRODUCTTYPE_3, '4' => MP_PRODUCTTYPE_4); $db->query("SELECT 1 FROM shop_items_attributes sia WHERE sia.imageid = $imageid AND attributeid = 3"); if ($db->next_record()) { $shopPostcard = 'true'; } // eDownload $isDownloadAllowed = false; $eDownloadImageY = 0; $eDownloadImageX = 0; if(!$imageData['unsaleable']) { $db->query("SELECT agb_accepted FROM user_commercial WHERE userid = ".$imageData['userid']); if ($db->next_record()) { if( $db->f('agb_accepted') == 1 ) { $db->query("SELECT downloadAllowed, COALESCE(900X, 0) AS 900X, COALESCE(900Y, 0) AS 900Y FROM uploads_attributes i WHERE imageId = ".$imageid); if ($db->next_record()) { $isDownloadAllowed = ($db->f('downloadAllowed') == 1); $eDownloadImageY = $db->f('900Y'); $eDownloadImageX = $db->f('900X'); if($db->f('900Y') == '0' && $db->f('900X') == '0') { $path = TP_DOCUMENT_ROOT . 'user/' . $imageData['userid'] . '/files/' . $imageData['imageuid'] . '9.jpg'; if(file_exists($path)) { $info = getimagesize($path); $sql = "UPDATE uploads_attributes SET 900X = ".$info[1].", 900Y = ".$info[0]." WHERE imageId = ".$imageid.";"; $db->query($sql); $eDownloadImageY = $info[0]; $eDownloadImageX = $info[1]; } } } } } } $userLanguageTitle = ''; /* if($isDownloadAllowed) { $sql = "SELECT c.long_Desc FROM user_profile u LEFT JOIN countries_de c ON (c.countryid = u.country) WHERE u.userid = 79"; $db->query($sql); if ($db->next_record()) { $userLanguageTitle = $db->f('long_Desc'); if(isset($userLanguageTitle) && strlen($userLanguageTitle) > 0) { $userLanguageTitle = '('.$userLanguageTitle.')'; } } } */ $toonAgentLink = ''; $db->query("SELECT imageid FROM uploads_profi_de WHERE imageid = $imageid"); if ($db->next_record()) { $toonAgentLink = '/toonagent/showimage?imageid='.$imageid; } //BATTLES $battles = toonBattle::getActiveBattles($db, -1, $imageid, 'INNER'); //Multiple File $sql = "SELECT COUNT(pimageid) FROM uploads_pages WHERE imageid = $imageid"; $db->query($sql); $multiple = array('pages' => $db->result() + 1, 'perPage' => 1); if ($actualPage > 1) { $imgsrc = '/user/' . $imageData['userid'] . '/pages/' . $imageData['imageuid'] . '_page' . $actualPage . '.jpg'; } //SEO seoBase::setHtmlLinkTag(seoBase::LINK_TYPE_CANONICAL, changeLanguage::getSiteUrl($imageData['languageid']).$_SERVER["REQUEST_URI"]); seoBase::setHtmlMetaTag(seoBase::META_TYPE_ROBOTS, 'index, follow'); require TP_DOCUMENT_ROOT.'includes/templates/tpl_showImage.php'; function toHex ($n) { $s = ''; for ($l=0; $l<6; $l++) { $s = substr('0123456789ABCDEF',$n % 16,1).$s; $n = ($n - $n % 16) / 16; } return '#'.$s; } function printBubbles ($posX,$posY) { global $bubbleText,$bubbleData; $index = 1; foreach ($bubbleText as $b) { echo '
'.nl2br($b['text']).'
'; $index++; } } function updateImageCounters() { global $db,$imageid,$cid; //Click-Counter Image //$db->query("UPDATE uploads SET clicks = clicks + 1 WHERE imageid = $imageid"); //$db->query("UPDATE user SET tm_viewed = tm_viewed + 1 WHERE userid = ".$imageData['userid']); if (isset($cid)) { $db->query("UPDATE collections SET views = views + 1 WHERE collectionid = ".$cid); $db->query("UPDATE collection_images SET views = views + 1 WHERE imageid = ".$imageid." AND collectionid = ".$cid." AND accepted = 1"); } // image_counters... $time = time(); $db->query("INSERT INTO image_counters SET type='va', `range`='', imageid=".$imageid.", counter=1 ON DUPLICATE KEY UPDATE counter=counter+1"); /*$db->query("INSERT INTO image_counters SET type='vy', `range`='".date('Y',$time)."', imageid=".$imageid.", counter=1 ON DUPLICATE KEY UPDATE counter=counter+1"); $db->query("INSERT INTO image_counters SET type='vm', `range`='".date('Y-m',$time)."', imageid=".$imageid.", counter=1 ON DUPLICATE KEY UPDATE counter=counter+1"); $db->query("INSERT INTO image_counters SET type='vw', `range`='".date('Y-W',$time)."', imageid=".$imageid.", counter=1 ON DUPLICATE KEY UPDATE counter=counter+1"); $db->query("INSERT INTO image_counters SET type='vd', `range`='".date('Y-z',$time)."', imageid=".$imageid.", counter=1 ON DUPLICATE KEY UPDATE counter=counter+1");*/ } ?>