ACC SHELL

Path : /srv/www/vhosts/marevva/crossroadsfoundation/parts/
File Upload :
Current File : /srv/www/vhosts/marevva/crossroadsfoundation/parts/articleDetail.php

<?php

	// get article for current url from DB
	$article = $db->getItemWhere( 'article', " WHERE `url`='" . $url_submenu . "' AND " . $removeOutdatedItems_sql );
	
	if ( isset( $article['ID'] ) )
	{
		$page = new stdClass();
		
		// category check
		
		if ( !isset( $articleCategory['ID'] ) || ( $article['categoryID'] != $articleCategory['ID'] ) )
		{
			header("HTTP/1.0 301 Moved Permanently");
			header("Status: Moved Permanently");
							
			header("Location: http://".$_SERVER['HTTP_HOST']."/");
		}
		//
		
		/// next, prev article
		/*$page->prevArticleURL = '';
		$page->prevArticleTitle = '';
		$page->nextArticleURL = '';
		$page->nextArticleTitle = '';
		
		$articles = $db->getAllItemsEx( 'article', " WHERE `categoryID`='" . $articleCategory['ID'] . "' AND" . $removeOutdatedItems_sql . $orderBy_sql . $limit_sql, " `ID`, `title`, `url` " );
		for ( $ai = 0; $ai < count( $articles ); $ai++ )		
		{
			$articlesItem = $articles[ $ai ];
			if ( $articlesItem['ID'] == $article['ID'] )
			{
				if ( $ai > 0 )
				{
					$prevArticle = $articles[ $ai - 1 ];
					$page->prevArticleURL = $prevArticle[ 'url' ];
					$page->prevArticleTitle = shortenText( $prevArticle[ 'title' ], 1000 );
				}
				if ( $ai <= count( $articles ) - 2 )
				{
					$nextArticle = $articles[ $ai + 1 ];
					$page->nextArticleURL = $nextArticle[ 'url' ];
					$page->nextArticleTitle = shortenText( $nextArticle[ 'title' ], 1000 );
				}
				break;
			}
		}*/
		///
		
		// date
		$datetime = date_create( $article['createdDateTimeOrder'] );
		$datetime = date_format( $datetime, "d.m.Y" );
		
		// article fields
		$page->title = htmlspecialchars( $article['title'] );
		$page->text = html_entity_decode( $article['text'], ENT_NOQUOTES, 'UTF-8' );
		
		$page->youtubeVideo = '';
		$videoURL1 = getVideoEmbed( $article['videoURL1'], 360, 240 );
		if ( $videoURL1 != '' )
			$page->youtubeVideo .= '<div class="cleaner10"></div>' . $videoURL1;
			
		$videoURL2 = getVideoEmbed( $article['videoURL2'], 360, 240 );
		if ( $videoURL2 != '' )
			$page->youtubeVideo .= '<div class="cleaner10"></div>' . $videoURL2;
			
		$videoURL3 = getVideoEmbed( $article['videoURL3'], 360, 240 );
		if ( $videoURL3 != '' )
			$page->youtubeVideo .= '<div class="cleaner10"></div>' . $videoURL3;
		
		//$page->date = $datetime;
		
		$page->categoryTitle = $articleCategory['title'];
		$page->categoryURL = '/' . $articleCategory['url'];
		
		$page->imgSrc = '';
		$page->imgSrcFull = '';
		if ( $article['image'] != '' )
		{
			$page->imgSrc = '/data/article/mainImages/medium/' . $article['image'];
			$page->imgSrcFull = '/data/article/mainImages/full/' . $article['image'];
		}
		else
		{
			if ( $article['videoURL1'] != '' )
			{
				$page->imgSrc = getVideoImage( $article['videoURL1'] );
				$page->imgSrcFull = $page->imgSrc;
			}
		}
		
		$images = $db->getAllItems( 'mediaItem2', " WHERE `ownerID`=" . $article['ID'] . " ORDER BY `position` ASC " );
		$imagesCount = count( $images );
		for ( $i = 0; $i < $imagesCount; $i++ )
		{
			$image = $images[ $i ];
			$page->images[ $i ]->imgSrc = '/data/article/images/' . $article['ID'] . '/thumbs/' . $image['fileName'];
			$page->images[ $i ]->imgSrcFull = '/data/article/images/' . $article['ID'] . '/' . $image['fileName'];
		}		
		
		// file
		/*$page->file = '';
		$page->fileURL = '';
		$page->articleID = $article['ID'];
		if ( $article['file'] != '' )
		{
			$page->file = $article['file'];
			$page->fileURL = '/data/article/files/' . $article['ID'] . '/' . $article['file'];
		}*/
		
		// html title
		$titleHTML .= $page->title . ' | ';
	
		// FB like button
		$page->facebookLikeButtonVisible = $settings['facebookLikeButtonVisible'];
		if ( $settings['facebookLikeButtonVisible'] )
		{
			$facebookHTMLheader = '
									<meta property="og:title" content="' . $article['title'] . '" />
									<meta property="og:type" content="article" />
									<meta property="og:url" content="' . 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" />
									<meta property="og:description" content="' . shortenText( fuckOffHTMLspecialChars( strip_tags( $article['text'] ) ), 200 ) . '" />
									';
			if ( $article['image'] != '' )
			{
				$facebookHTMLheader .= '
							<meta property="og:image" content="http://' . $_SERVER['HTTP_HOST'] . '/data/product/mainImages/medium/' . $article['image'] . '" />
							';
			}
			$page->likeURLencoded = urlencode( $pageETS->likeURL );
		}
		
		$contentHTML .= sprintt( $page, 'parts/articleDetail.html' );
		
		// comments
		$page->showComments = false;
		if ( $article['showComments'] == '1' )
		{
			$page->showComments = true;
			
			$rootCommentID = $article['commentID'];
			include( 'parts/comments.php' );
			$contentHTML .= sprintt( $page, 'parts/comments.html' );
		}
	}
	else
	{
		header("HTTP/1.0 301 Moved Permanently");
        header("Status: Moved Permanently");
				
		header("Location: http://".$_SERVER['HTTP_HOST']."/");
	}
	
	

?>

ACC SHELL 2018