SetLinksFormat( 'Back', ' | ', 'Next' ); $pagination->SetItemsPerPage(15); $pagination->SetLinksToDisplay(5); if (isset($_GET['page']) && is_numeric($_GET['page'])) { $pagination->SetCurrentPage($_GET['page']); } else { $pagination->SetCurrentPage(1); } $breadcrumb['Page ' . $pagination->currentPage] = "/viewVideo.wik?page=" . $pagination->currentPage; // B*+* 0000201 20070716 3:52P $sort = ' ORDER by officialvideos.id '; $order = ' DESC '; if (isset($_GET['sort'])) { if(stripslashes(trim($_GET['sort'])) == 'title' || stripslashes(trim($_GET['sort'])) == 'artist') $order = ' ASC '; $sort = ' ORDER BY REPLACE(' . stripslashes($_GET['sort']) . ', \'"\', \'\') ' . $order; } else $sort = $sort . $order; $pagination->setItemCount($database->oneField($database->prepareSql("SELECT DISTINCT COUNT(*) FROM officialvideos"))); $sqlId = $database->prepareSql("SELECT DISTINCT officialvideos.artist, officialvideos.filename, officialvideos.title, officialvideos.id, officialvideos.caption, officialvideos.banner, officialvideos.bgcolor, itemratings.views, itemratings.comments, itemratings.rating, itemratings.votes FROM officialvideos JOIN itemratings ON officialvideos.id=itemratings.itemId WHERE itemratings.itemType='officialVideo' " . $sort . " " . $pagination->GetSqlLimit()); // E*+* 0000201 20070716 3:52P $videos = $database->multipleRows($sqlId); if (!$videos) { $errorDisplay = new displayManager('error2'); $errorDisplay->addPlaceHolder('ERROR', "There are no videos on this page."); $itemTypeDisplay->addPlaceHolder('CONTENT', $errorDisplay->outputHtml(true)); } else { $gridDisplay = new displayManager('videosGridHeader'); $gridRowDisplay = new displayManager('videosGridRow'); $gridHtml = null; foreach($videos as $temp => $video) { $digit = rand(1, 10000); if (strip_tags($video['banner']) != '' && $video['banner'] != 0) { $gridHtml .= <<\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t HTML; } //if (strip_tags($video['caption']) != '') { // $gridHtml .= "\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t" . stripslashes($video['caption']) . "\n\t\t\t\t\t\t\t\t"; //} $gridRowDisplay->addPlaceHolder('ARTIST_NAME', trim(stripslashes($video['artist']))); $gridRowDisplay->addPlaceHolder('TITLE', stripslashes($video['title'])); $gridRowDisplay->addPlaceHolder('CAPTION', stripslashes($video['caption'])); $gridRowDisplay->addPlaceHolder('VIDEO_THUMB', stripslashes($video['filename']).'.jpg'); $gridRowDisplay->addPlaceHolder('VIDEOID', $video['id']); $gridRowDisplay->addPlaceHolder('CURRENT_RATING', rating2px($video['rating'])); $gridRowDisplay->addPlaceHolder('VIEWS', number_format($video['views'])); $gridRowDisplay->addPlaceHolder('COMMENTS', number_format($video['comments'])); $gridRowDisplay->addPlaceHolder('CURRENT_URL', urlencode("/showComments.wik?itemType=officialVideo&itemId=" . $video['id'])); $gridHtml .= $gridRowDisplay->outputHtml(true); $gridRowDisplay->reset(); } $gridDisplay->addPlaceHolder('CONTENT', $gridHtml); $itemTypeDisplay->addPlaceHolder('CONTENT', $gridDisplay->outputHtml(true) . "\t\t\t\t\t\t\t\t" . $pagination->GetPageLinks()); } } else { $values = array('id' => $_GET['videoId']); $sqlId = $database->prepareSql("SELECT DISTINCT officialvideos.artist, officialvideos.title, officialvideos.added, officialvideos.id, officialvideos.filename, officialvideos.caption, officialvideos.`desc`, itemratings.views, itemratings.comments, itemratings.rating, itemratings.votes FROM officialvideos JOIN itemratings ON officialvideos.id=itemratings.itemId WHERE itemratings.itemType='officialVideo' AND officialvideos.id=':id'", $values); $video = $database->oneRow($sqlId); if (!$video) { showError("Invalid item."); } else { if (loggedIn()) { $addCommentDisplay = new displayManager('addComment'); $addCommentDisplay->addPlaceHolder('COLS', '36'); $addCommentDisplay->addPlaceHolder('ITEMTYPE', 'officialVideo'); $addCommentDisplay->addPlaceHolder('ITEMID', $_GET['videoId']); } else { $addCommentDisplay = new displayManager('addCommentNotLoggedIn'); } registerView($_GET['videoId'], 'officialVideo', null, &$database); $addCommentDisplay->addPlaceHolder('CURRENT_URL', urlencode($_SERVER['REQUEST_URI'])); //$sqlId = $database->prepareSql("SELECT DISTINCT itemcomments.id, itemcomments.userId, itemcomments.timestamp, itemcomments.comment, authentication.displayName, authentication.profileName FROM itemcomments JOIN authentication ON itemcomments.userId=authentication.userId WHERE itemcomments.itemType='officialVideo' AND itemcomments.itemId={$video['id']} ORDER BY itemcomments.id ASC LIMIT 10"); $sqlId = $database->prepareSql("SELECT DISTINCT itemcomments.id, itemcomments.userId, itemcomments.timestamp, itemcomments.comment, authentication.displayName, authentication.profileName FROM itemcomments JOIN authentication ON itemcomments.userId=authentication.userId WHERE itemcomments.itemType='officialVideo' AND itemcomments.itemId={$video['id']} ORDER BY itemcomments.id ASC"); $comments = $database->multipleRows($sqlId); if (!$comments) { $errorDisplay = new displayManager('error'); $errorDisplay->addPlaceHolder('ERROR', "There are no comments on this video."); $commentHtml = $errorDisplay->outputHtml(true); } else { $commentDisplay = new displayManager('comment'); $commentHtml = null; foreach($comments as $temp => $comment) { $commentDisplay->addPlaceHolder('COMMENT_ID', $comment['id']); $commentDisplay->addPlaceHolder('PROFILENAME', stripslashes($comment['profileName'])); $commentDisplay->addPlaceHolder('DISPLAYNAME', stripslashes($comment['displayName'])); $commentDisplay->addPlaceHolder('SIGNATURE', getSignature($comment['userId'], &$database)); $commentDisplay->addPlaceHolder('COMMENT', htmlentities(stripslashes($comment['comment']))); $commentDisplay->addPlaceHolder('DATE', date('F j, y g:ia', $comment['timestamp'])); $commentDisplay->addPlaceHolder('AVATAR', getAvatar($comment['userId'], 64)); $commentHtml .= $commentDisplay->outputHtml(true); $commentDisplay->reset(); } if ($video['comments'] > 10) { //$commentHtml .= "

Showing only the ten most recent comments. Show all comments.

"; } } /********** BEG FLASH **********/ // $flashVars = "{$settings['url']}{$video['filename']}"; // *_* 20070719 2:48P // $flashScript = ''; $flashScript = ''; /********** END FLASH **********/ $videoDisplay = new displayManager('videoVideo'); // B*_* 20070719 2:48P $flashVars = "{$settings['url']}TVPlayer/video_xml.wik?officalVideoId={$_GET['videoId']}"; $miniflashVars = "{$settings['url']}TVPlayer/video_xml.wik?officialMinivideoId={$_GET['videoId']}"; $videoDisplay->addPlaceHolder('FLASHVARS', $flashVars); $videoDisplay->addPlaceHolder('MINIFLASHVARS', $miniflashVars); $videoDisplay->addPlaceHolder('FLASHURL', $settings['url']); // E*_* 20070719 2:48P $breadcrumb[stripslashes($video['title'])] = $_SERVER['REQUEST_URI']; $videoDisplay->addPlaceHolder('VIDEOTITLE', stripslashes($video['title'])); $videoDisplay->addPlaceHolder('CAPTION', stripslashes($video['caption'])); $videoDisplay->addPlaceHolder('DESCRIPTION', nl2br(stripslashes($video['desc']))); $videoDisplay->addPlaceHolder('ARTIST_NAME', stripslashes($video['artist'])); $videoDisplay->addPlaceHolder('VIDEOID', stripslashes($video['id'])); $videoDisplay->addPlaceHolder('VOTES', stripslashes($video['votes'])); $videoDisplay->addPlaceHolder('VIDEO_SCRIPT', $flashScript); $videoDisplay->addPlaceHolder('CURRENT_RATING', rating2px($video['rating'])); $videoDisplay->addPlaceHolder('VIEWS', number_format($video['views'])); $videoDisplay->addPlaceHolder('COMMENTCOUNT', number_format($video['comments'])); $videoDisplay->addPlaceHolder('COMMENTS', $commentHtml); $videoDisplay->addPlaceHolder('DATE', date('F j, y g:00a', $video['added'])); $videoDisplay->addPlaceHolder('ADD_COMMENT', $addCommentDisplay->outputHtml(true)); $videoDisplay->addPlaceHolder('IMAGE', $video['filename']); $itemTypeDisplay->addPlaceHolder('CONTENT', $videoDisplay->outputHtml(true)); } } /******** LOGIN PANEL *+* 0000181 20070531 4:41 ********/ require_once("./loginBox.inc.wik"); /******** LOGIN STATUS *+* 0000191 20070709 1:58P ********/ require_once("./loginStatus.inc.wik"); $content = $itemTypeDisplay->outputHtml(true); $display->addPlaceHolder('CONTENT', $content); outputTemplate(&$display); ?>