Beispiel #1
0
function films_film_play_draw($film, $options)
{
    event_log_log('new_' . $film['film_type'] . '_watch');
    film_view_count($film['id']);
    echo '<div class="film_play" id="film_play">' . "\n";
    rounded_corners_top();
    $related_films = films_fetch(array('released' => true, 'film_type' => $film['film_type'], 'exclude' => array($film['id']), 'limit' => 3, 'order' => 'random'));
    films_list($related_films, array('list_type' => 'film_list_compact', 'headline' => 'Fler ' . $film['film_type']));
    echo '<h1 class="film_header">' . $film['title'] . '</h1>' . "\n";
    echo '<div class="film_statistics">' . "\n";
    echo '<div class="film_view_count">' . "\n";
    echo cute_number($film['view_count'] + 1) . ' visningar' . "\n";
    echo '</div>' . "\n";
    // film_view_count
    echo rank_draw($film['rank_average'], array('size' => 'medium'));
    //	echo '<div class="film_rank_count">' . "\n";
    //	echo cute_number($film['rank_count']) . ' röster' . "\n";
    //	echo '</div>' . "\n";
    if (5 == $_SESSION['login']['userlevel']) {
        echo '<a class="film_edit" href="/film/admin/' . $film['handle'] . '.html">[Redigera]</a>' . "\n";
    }
    echo '</div>' . "\n";
    // film_statistics
    echo '<div class="film_player">' . "\n";
    if ($film['trailer_id'] > 0) {
        echo '<!-- Play Networks - Embeddable Flash Player -->' . "\n";
        echo '<div id="playnw" class="playnw">' . "\n";
        echo '<script src="http://se.player.playnetworks.net/player.php?mid=' . $film['trailer_id'] . '&channel_user_id=4601100020-1&width=460&height=345"></script><br>' . "\n";
        echo '</div>' . "\n";
        echo '<!-- Play Networks - Embeddable Flash Player -->' . "\n";
    } elseif ($film['use_special_code'] == 1) {
        echo stripslashes($film['html']);
    } elseif ($film['extension'] == 'swf') {
        //todo! Här skall anpassas till distribute-systemet. distribute_server_get skall anropas för att f? en adress
        // adress skall byggas med server . type . handle . '.' . extension
        echo '<object type="application/x-shockwave-flash" data="http://amuse.hamsterpaj.net/distribute/film/' . $film['handle'] . '.swf" >
					<param name="movie" value="http://amuse.hamsterpaj.net/distribute/film/' . $film['handle'] . '.swf" /></object>';
    } elseif ($film['extension'] == 'flv') {
        //todo! Här skall anpassas till distribute-systemet. distribute_server_get skall anropas för att f? en adress
        // adress skall byggas med server . type . handle . '.' . extension
        echo '<p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">Installera Flash Player</a> för att kunna se den här filmen.</p>
				<script type="text/javascript">
				var s1 = new SWFObject("/film/flvplayer.swf","single","460","345","7");
				s1.addParam("allowfullscreen","true");
				s1.addVariable("file","http://amuse.hamsterpaj.net/distribute/film/' . $film['handle'] . '.flv");
				s1.addVariable("image","' . IMAGE_URL . '/film/' . $film['handle'] . '.png");
				s1.addVariable("width","460");
				s1.addVariable("height","345");
				s1.write("player1");
				</script>';
    } elseif ($film['film_type'] == 'bilder') {
        //todo! Här skall anpassas till distribute-systemet. distribute_server_get skall anropas för att f? en adress
        // adress skall byggas med server . type . handle . '.' . extension
        echo '<img src="http://images.hamsterpaj.net/fun_images/' . $film['handle'] . '.jpg" class="fun_images_big" />' . "\n";
    }
    echo '</div>' . "\n";
    // film_player
    echo '<br style="clear: both;" />' . "\n";
    echo '<div class="film_description">' . "\n";
    if (strlen($film['description']) > 0) {
        echo '<p>' . $film['description'] . '</p>' . "\n";
    }
    if ($film['trailer_id'] > 0) {
        echo '<p>Filmtrailers visas i samarbete med Play Networks</p>' . "\n";
    }
    echo '</div>' . "\n";
    // end film_description
    echo '<div class="film_comments">' . "\n";
    echo '<input type="hidden" id="film_id" value="' . $film['id'] . '" />' . "\n";
    echo '<h2 class="rank_input_header">Din poäng</h2>' . "\n";
    echo '<h2 class="comment_input_header">Din kommentar</h2>' . "\n";
    echo '<br style="clear: both;" />' . "\n";
    $query = 'SELECT rank FROM user_ranks WHERE user_id = "' . $_SESSION['login']['id'] . '" AND item_id = "' . $film['id'] . '" AND item_type = "film"';
    $result = mysql_query($query);
    if (mysql_num_rows($result) == 1) {
        $data = mysql_fetch_assoc($result);
    }
    unset($rank_options);
    $rank_options['previous'] = $data['rank'];
    rank_input_draw($film['id'], 'film', $rank_options);
    comments_input_draw($film['id'], 'film');
    echo '<br style="clear: both;" />' . "\n";
    echo '</div>' . "\n";
    // film_comments
    rounded_corners_bottom();
    $options['comments'] = isset($options['comments']) ? $options['comments'] : 'yes';
    if ($options['comments'] == 'yes') {
        rounded_corners_top();
        echo comments_list($film['id'], 'film');
        rounded_corners_bottom();
    }
    echo '</div>' . "\n";
    // film_play
}
Beispiel #2
0
function games_game_draw($game, $options = null)
{
    echo '<input type="hidden" id="game_handle" value="' . $game['handle'] . '"/>' . "\n";
    echo '<div class="game_play">' . "\n";
    echo '<h1>' . $game['title'] . '</h1>' . "\n";
    echo '<div id="game_header">' . "\n";
    rounded_corners_top();
    echo '<div id="game_header_main">' . "\n";
    echo '<p>' . $game['description'] . '</p>' . "\n";
    echo '<div id="game_buttons" >' . "\n";
    echo '<button id="game_fullscreen" onclick="javascript: open_fullscreen_window(\'http://amuse.hamsterpaj.net/distribute/game/' . $game['handle'] . '.swf\');">';
    echo 'Spela i fullskärm';
    echo '</button>' . "\n";
    /* 	if(5 == $_SESSION['login']['userlevel']) */
    /* 	{ */
    echo '<button id="game_challenge_button" >Utmana en kompis</button>' . "\n";
    /* 	} */
    if (login_checklogin()) {
        $query = 'SELECT * FROM user_favorites AS uf, games AS g WHERE uf.type = "game" AND uf.item_id = g.id AND g.handle = "' . $game['handle'] . '" AND uf.user_id = "' . $_SESSION['login']['id'] . '"';
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        $is_favorite = mysql_fetch_assoc($result) ? true : false;
    }
    echo '<div id="game_vote_div" class="vote">' . "\n";
    echo '</div>' . "\n";
    //end vote
    echo '</div>' . "\n";
    //end game_buttons
    echo '</div>' . "\n";
    //end game_header_main
    echo '<div id="game_header_info">' . "\n";
    games_game_popularity_draw($game);
    //a div with class game_popularity
    games_list_tags(tag_get_by_handle(array_keys($game['tags'])));
    if (3 <= $_SESSION['login']['userlevel']) {
        echo '<a href="/spel/redigera/' . $game['handle'] . '.php" >Redigera spelet</a>' . "\n";
    }
    echo '</div>' . "\n";
    //end game_header_info
    echo '<br style="clear: both;" />' . "\n";
    rounded_corners_bottom();
    echo '</div>' . "\n";
    //end game_header
    //Challenge a friend
    echo '<input type="hidden" id="game_handle" value="' . $game['handle'] . '"/>';
    echo '<input type="hidden" id="game_title" value="' . $game['title'] . '"/>';
    echo '<div id="game_challenge">' . "\n";
    rounded_corners_top();
    echo '<a name="challenge"></a>' . "\n";
    //alternativ A - hamsterpaj
    //todo! kolla att användaren är inloggad annars visa snabbregistrering
    if (login_checklogin()) {
        echo '<div class="challenge_alternative_a">' . "\n";
        echo '<h3>Skicka utmaning här på Hamsterpaj</h3>' . "\n";
        echo '<div class="challenge_recievers">' . "\n";
        for ($i = 1; $i < 4; $i++) {
            echo '<h5>Kompis #' . $i . '</h5>' . "\n";
            echo '<input type="text" name="game_challenge_username_' . $i . '" id="game_challenge_username_' . $i . '"/>' . "\n";
        }
        echo '</div>' . "\n";
        echo '<div class="challenge_message">' . "\n";
        echo '<h5>Hälsning (skriv gärna hur långt du kom i spelet)</h5>' . "\n";
        echo '<textarea name="game_challenge_hp_message" id="game_challenge_hp_message" ></textarea>' . "\n";
        echo '<button id="game_challenge_hp_submit">Skicka!</button>' . "\n";
        echo '</div>' . "\n";
        //end challenge_message;
        echo '<br />' . "\n";
        echo '</div>' . "\n";
        //end challenge_alternative
    } else {
        echo '<div class="challenge_alternative_a_not_member">' . "\n";
        echo '<h3>Skicka utmaning här på Hamsterpaj</h3>' . "\n";
        echo '<div class="register_info">' . "\n";
        echo '<p>Man kan bara skicka meddelanden på hamsterpaj om man är medlem men det blir du på två sekunder tryck bara på knappen.</p>' . "\n";
        echo '<button onclick="javascript: tiny_reg_form_show();" >Bli medlem!</button>' . "\n";
        echo '</div>' . "\n";
        //end register_info
        echo '</div>' . "\n";
        //end challenge_alternative_a_not_member
    }
    echo '<hr />' . "\n";
    //alternativ B - e-post
    echo '<div class="challenge_alternative_b">' . "\n";
    echo '<h3>Skicka utmaning med e-post</h3>' . "\n";
    echo '<div class="challenge_recievers">' . "\n";
    for ($i = 1; $i < 4; $i++) {
        echo '<h5>e-post till kompis #' . $i . '</h5>' . "\n";
        echo '<input type="text" name="game_challenge_email_' . $i . '" id="game_challenge_email_' . $i . '"/>' . "\n";
    }
    echo '</div>' . "\n";
    echo '<div class="challenge_message">' . "\n";
    echo '<h5>Hälsning (skriv gärna hur långt du kom i spelet)</h5>' . "\n";
    echo '<textarea name="game_challenge_mail_message" id="game_challenge_mail_message" ></textarea>' . "\n";
    if (!isset($_SESSION['tip_security_code'])) {
        $_SESSION['tip_security_code'] = rand(10000, 9999999);
    }
    echo '<div class="input_a">' . "\n";
    echo '<div class="security_code">' . "\n";
    echo '<img src="/security_code.tip.png.php" id="regfrm_security_code_img" />' . "\n";
    echo '</div>' . "\n";
    //end security_code
    echo '<div class="input_b">' . "\n";
    echo '<div class="security_input">' . "\n";
    echo '<h5>Skriv av numret här ovanför</h5>' . "\n";
    echo '<input type="text" name="security_code" id="security_code" />' . "\n";
    echo '</div>' . "\n";
    //end security_input
    echo '<div class="challenge_sender_name"><h5>Ditt namn</h5><input type="text" name="challenge_sender_name" id="challenge_sender_name" /></div>' . "\n";
    echo '<button id="game_challenge_mail_submit">Skicka!</button>' . "\n";
    echo '</div>' . "\n";
    //end input_b
    echo '</div>' . "\n";
    //end input_a
    echo '<p>' . "\n";
    echo 'Vi vill inte få problem med datorprogram som skickar mail via Hamsterpaj, så därför' . "\n";
    echo 'måster du du skriva av siffrorna i bilden, datorprogram är nämnligen inte så bra på att läsa bilder.' . "\n";
    echo '</p>' . "\n";
    echo '</div>' . "\n";
    //end challenge_message;
    echo '<br />' . "\n";
    echo '</div>' . "\n";
    //end challenge_alternative
    echo '<hr />' . "\n";
    //alternativ C - kopiera länk
    echo '<div class="challenge_alternative_c">' . "\n";
    echo '<h3>Skicka en länk</h3>' . "\n";
    echo '<p>Kopiera länken och skicka till din kompis</p>' . "\n";
    echo '<div class="challenge_link">http://www.hamsterpaj.net/spel/' . $game['handle'] . '.html</div>' . "\n";
    echo '</div>' . "\n";
    //end challenge_alternative
    rounded_corners_bottom();
    echo '</div>' . "\n";
    //end game_challenge
    echo '<div id="game_challenge_result"></div>' . "\n";
    //The game!
    echo '<div id="game" class="game">' . "\n";
    //todo! Här skall anpassas till distribute-systemet. distribute_server_get skall anropas för att f? en adress
    // adress skall byggas med server . type . handle . '.' . extension
    echo '<object type="application/x-shockwave-flash" data="http://amuse.hamsterpaj.net/distribute/game/' . $game['handle'] . '.swf" >
                <param name="movie" value="http://amuse.hamsterpaj.net/distribute/game/' . $game['handle'] . '.swf" /></object>';
    echo '</div>' . "\n";
    //end game
    if (strlen($game['controls'][0]['combination']) > 0) {
        rounded_corners_top();
        echo '<div class="game_instructions">' . "\n";
        echo '<h3>Så här spelar du</h3>' . "\n";
        games_game_controls_draw($game);
        echo '</div>' . "\n";
        //end game_instructions
        rounded_corners_bottom();
    }
    if (in_array('highscore', array_keys($game['tags']))) {
        rounded_corners_top();
        echo '<h3>Topplista</h3>' . "\n";
        $query = 'SELECT gh.score, gh.user AS user_id, l.username FROM game_highscores AS gh, login AS l WHERE gh.game = "' . $game['highscore_gname'] . '" AND l.id = gh.user ORDER BY gh.score DESC LIMIT 5';
        $result = mysql_query($query);
        if (mysql_num_rows($result) > 0) {
            while ($data = mysql_fetch_assoc($result)) {
                $topten[] = $data;
            }
            echo '<table style="float: left; width: 300px;">' . "\n";
            $rank = 1;
            foreach ($topten as $entry) {
                $style = $entry['user_id'] == $_SESSION['login']['id'] ? ' style="font-weight: bold;"' : '';
                echo '<tr' . $style . '>' . "\n";
                echo '<td>' . $rank . '</td>' . "\n";
                echo '<td><a href="/traffa/profile.php?id=' . $entry['user_id'] . '">' . $entry['username'] . '</a></td>' . "\n";
                echo '<td>' . $entry['score'] . 'p</td>' . "\n";
                echo '</tr>' . "\n";
                $rank++;
            }
            echo '</table>' . "\n";
            if (login_checklogin()) {
                $query = 'SELECT score FROM game_highscores WHERE user = "******" AND game = "' . $game['highscore_gname'] . '"';
                $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
                if (mysql_num_rows($result) == 1) {
                    $data = mysql_fetch_assoc($result);
                    $user_score = $data['score'];
                    /* Find out the users position */
                    $query = 'SELECT COUNT(*) AS position FROM game_highscores WHERE score > "' . $user_score . '" AND game = "' . $game['highscore_gname'] . '"';
                    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
                    $data = mysql_fetch_assoc($result);
                    $user_position = $data['position'] + 1;
                    $i = 1;
                    /* Fetch the two users with higher score */
                    $query = 'SELECT gh.score, gh.user AS user_id, l.username FROM game_highscores AS gh, login AS l WHERE gh.game = "' . $game['highscore_gname'] . '" AND l.id = gh.user AND gh.score > "' . $user_score . '" ORDER BY gh.score ASC LIMIT 2';
                    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
                    while ($data = mysql_fetch_assoc($result)) {
                        $data['position'] = $user_position - (mysql_num_rows($result) - $i);
                        $score_table[] = $data;
                        $i = 0;
                    }
                    $score_table = array_reverse($score_table);
                    $score_table[] = array('user_id' => $_SESSION['login']['id'], 'username' => $_SESSION['login']['username'], 'position' => $user_position, 'score' => $user_score);
                    $i = 1;
                    /* Fetch the two users with lower score */
                    $query = 'SELECT gh.score, gh.user AS user_id, l.username FROM game_highscores AS gh, login AS l WHERE gh.game = "' . $game['highscore_gname'] . '" AND gh.user != "' . $_SESSION['login']['id'] . '" AND l.id = gh.user AND gh.score <= "' . $user_score . '" ORDER BY gh.score DESC LIMIT 2';
                    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
                    while ($data = mysql_fetch_assoc($result)) {
                        $data['position'] = $user_position + $i;
                        $score_table[] = $data;
                        $i++;
                    }
                    /* Phew, only the output left */
                    echo '<table style="width: 300px;">' . "\n";
                    foreach ($score_table as $entry) {
                        $style = $entry['user_id'] == $_SESSION['login']['id'] ? ' style="font-weight: bold;"' : '';
                        echo '<tr' . $style . '>' . "\n";
                        echo '<td>' . $entry['position'] . '</td>' . "\n";
                        echo '<td><a href="/traffa/profile.php?id=' . $entry['user_id'] . '">' . $entry['username'] . '</a></td>' . "\n";
                        echo '<td>' . $entry['score'] . 'p</td>' . "\n";
                        echo '</tr>' . "\n";
                    }
                    echo '</table>' . "\n";
                }
            }
        }
        rounded_corners_bottom();
    }
    rounded_corners_top();
    //    rounded_corners_top(array('color' => 'white'));
    /*	echo '<div class="game_comments">' . "\n";
        echo '<h3>Snacka om spelet</h3>' . "\n";
    	if(login_checklogin())
    	{
    		echo '<textarea id="game_comment_textarea"></textarea>' . "\n";
    		echo '<button id="comment_submit_button">Skicka</button>' . "\n";
    	}
    	else
    	{
    		echo '<p>Man kan bara skriva kommentarer om man är medlem. Men det blir du jättelätt, tryck bara på knappen och välj användarnamn och lösenord, inget mer!</p>';
    		echo '<button onclick="javascript: tiny_reg_form_show();" >Bli medlem!</button>' . "\n";
    	}
    
    	$comments_fetch['type'] = 'game_comments';
    	$comments_fetch['handle'] = $game['handle'];
    	$discussions = discussions_fetch($comments_fetch);
    	if(count($discussions) > 0)
    	{
    		$discussion = $discussions[0];
    	}
    	else
    	{
    		$create['handle'] = $game['handle'];
    		$create['title'] = $game['title'];
    		$create['author'] = 2348;
    		$create['discussion_type'] = 'game_comments';
    		$discussion	= discussion_create($create);
    		$post_create['content'] = 'Skriv här vad du tycker om spelet!';
    		$post_create['discussion_id'] = $discussion['id'];
    		$post_create['author'] = 2348;
    		$post_id = posts_create($post_create);
    	}
    	$posts = posts_fetch(array('discussion_id' => $discussion['id'], 'limit' => '10', 'order' => array(array('field' => 'p.id', 'direction' => 'desc'))));
    	echo '<div id="game_comments_list">' . "\n";
    	echo games_comments_list($posts);
    	echo '</div>' . "\n";
    	echo '</div>' . "\n";
    //	rounded_corners_bottom(array('color' => 'white'));
    */
    echo '<h2 class="rank_input_header">Din poäng</h2>' . "\n";
    echo '<h2 class="comment_input_header">Din kommentar</h2>' . "\n";
    echo '<br style="clear: both;" />' . "\n";
    echo '<div class="game_comments">' . "\n";
    $query = 'SELECT rank FROM user_ranks WHERE user_id = "' . $_SESSION['login']['id'] . '" AND item_id = "' . $game['id'] . '" AND item_type = "game"';
    $result = mysql_query($query);
    if (mysql_num_rows($result) == 1) {
        $data = mysql_fetch_assoc($result);
    }
    unset($rank_options);
    $rank_options['previous'] = $data['rank'];
    rank_input_draw($game['id'], 'game', $rank_options);
    comments_input_draw($game['id'], 'game');
    echo '<br style="clear: both;" />' . "\n";
    echo '</div>' . "\n";
    // game_comments
    rounded_corners_bottom();
    rounded_corners_top();
    echo comments_list($game['id'], 'game');
    rounded_corners_bottom();
    echo '</div>' . "\n";
    //end game_play
    echo '<h1>Andra spel</h1>' . "\n";
}
Beispiel #3
0
function entertain_item_draw($item, $options)
{
    global $entertain_types;
    entertain_item_viewed($item['id'], $item['entertain_type'], $item['view_count']);
    $output .= '<span class="' . $item['entertain_type'] . '">' . "\n";
    $output .= '<div class="entertain_item">' . "\n";
    // Item title
    $output .= '<h1 class="entertain_header">' . $item['title'] . '</h1>' . "\n";
    /* The entertainment items are displayed in different ways for different types.
    		Games have full width while movie clips, flash films and images are displayed
    		in 3/4 width, whith a few thumbnails on the side.
    	*/
    switch ($item['entertain_type']) {
        case 'software':
        case 'clip':
        case 'flash':
        case 'image':
            $fetch_result = entertain_fetch(array('released' => true, 'entertain_type' => $item['entertain_type'], 'exclude' => array($item['id']), 'limit' => 3, 'order' => 'random'));
            $related_items = $fetch_result['items'];
            $output .= entertain_list($related_items, array('list_style' => 'thumbnails', 'headline' => 'Fler ' . $entertain_types[$item['entertain_type']]['label_plural']));
            break;
        case 'game':
            break;
    }
    // Item rank, counter and release date
    $output .= '<div class="entertain_statistics">' . "\n";
    $output .= '<div class="entertain_rank">' . "\n";
    $output .= rank_draw($item['rank_average'], array('size' => 'medium'));
    $output .= '</div>' . "\n";
    // end entertain_rank
    $output .= '<div class="entertain_view_count">' . "\n";
    $output .= cute_number($item['view_count'] + 1) . ' visningar sedan ' . "\n";
    $output .= date('Y-m-d', $item['release']);
    //fix_time($item['release']);
    $output .= '</div>' . "\n";
    // end entertain_date
    $output .= '</div>' . "\n";
    // end entertain_statistics
    $output .= '<div class="entertain_player" id="entertain_player">' . "\n";
    /* Now we shall display the entertainment item itself. This is done in different ways
    		for different types and also different depending on special properties like
    		use_special_code or trailer_id.
    	*/
    if ($_SESSION['login']['id'] == 87926) {
        preint_r($item);
    }
    //First, we consider a bunch of special cases, that is film trailers, items with their own special html, images and software links
    if ($item['trailer_id'] > 0) {
        $output .= '<!-- Play Networks - Embeddable Flash Player -->' . "\n";
        $output .= '<div id="playnw" class="playnw">' . "\n";
        $output .= '<script src="http://se.player.playnetworks.net/player.php?mid=' . $item['trailer_id'] . '&channel_user_id=4601100020-1&width=474&height=355"></script><br>' . "\n";
        $output .= '</div>' . "\n";
        $output .= '<!-- Play Networks - Embeddable Flash Player -->' . "\n";
    } elseif ($item['use_special_code'] == 1) {
        $output .= stripslashes($item['html']);
    } elseif (strlen($item['link']) > 2 && $item['entertain_type'] == 'image') {
        $server = distribute_server_get(array('item_handle' => $item['handle'], 'type' => $item['entertain_type']));
        $address = 'http://' . $server['address'] . '/distribute/' . $item['entertain_type'] . '/' . $item['handle'] . '.' . $item['extension'];
        $output .= '<a href="' . $item['link'] . '"><img src="' . $address . '" class="entertain_' . $item['entertain_type'] . '" /></a>' . "\n";
    } elseif ($item['entertain_type'] == 'software') {
        $output .= '<button onclick="window.location=\'' . $item['link'] . '\';" class="button_150">Ladda ner</button><br />' . "\n";
        $output .= '<p>Alla filer är givetvis gratis att ladda ner och innehåller inga virus!</p>' . "\n";
    } else {
        $server = distribute_server_get(array('item_handle' => $item['handle'], 'type' => $item['entertain_type']));
        $address = 'http://' . $server['address'] . '/distribute/' . $item['entertain_type'] . '/' . $item['handle'] . '.' . $item['extension'];
        switch ($item['extension']) {
            case 'swf':
                $wrapper = '';
                $output .= '<object type="application/x-shockwave-flash" data="' . $wrapper . $address . '" >
							<param name="movie" value="' . $wrapper . $address . '" /></object>';
                $item['entertain_type'] == 'clip' || $item['entertain_type'] == 'flash' ? event_log_log('jc_ad_after') : '';
                break;
            case 'flv':
                $player_url = '/entertain/flvplayer.swf';
                // On end of J-store campaign, set width to 456 and height to 355 on both places
                $output .= '<div id="player1"><a href="http://www.macromedia.com/go/getflashplayer">Installera Flash Player</a> för att kunna se den här grejen.</div>
						<script type="text/javascript">
						var s1 = new SWFObject("' . $player_url . '","single","466","336","7");
						s1.addParam("allowfullscreen","true");
						s1.addVariable("file","' . $address . '");
						s1.addVariable("image","' . IMAGE_URL . '/entertain/' . $item['handle'] . '.png");
						s1.addVariable("width","466");
						s1.addVariable("height","336");
						s1.write("player1");
						</script>';
                break;
            case 'jpg':
            case 'png':
            case 'gif':
                $server = distribute_server_get(array('item_handle' => $item['handle'], 'type' => $item['entertain_type']));
                $address = 'http://' . $server['address'] . '/distribute/' . $item['entertain_type'] . '/' . $item['handle'] . '.' . $item['extension'];
                $output .= '<img src="' . $address . '" class="entertain_' . $item['entertain_type'] . '" />' . "\n";
        }
    }
    $output .= '<div class="entertain_item_buttons">' . "\n";
    if ($item['entertain_type'] == 'image') {
        $query = 'SELECT id, handle FROM entertain_items WHERE id < "' . $item['id'] . '"';
        $query .= ' AND `release` < ' . time();
        $query .= ' AND entertain_type = "' . $item['entertain_type'] . '"';
        $query .= ' ORDER BY id DESC';
        $query .= ' LIMIT 1';
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        if ($data = mysql_fetch_assoc($result)) {
            $output .= '<a href="/' . $entertain_types[$item['entertain_type']]['url_handle'] . '/' . $data['handle'] . '.html">';
            $output .= '<button id="entertain_previous" class="button_90">';
            $output .= 'Föregående';
            $output .= '</button></a>' . "\n";
        }
        $query = 'SELECT id, handle FROM entertain_items WHERE id > "' . $item['id'] . '"';
        $query .= ' AND `release` < ' . time();
        $query .= ' AND entertain_type = "' . $item['entertain_type'] . '"';
        $query .= ' ORDER BY id ASC';
        $query .= ' LIMIT 1';
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        if ($data = mysql_fetch_assoc($result)) {
            $output .= '<a href="/' . $entertain_types[$item['entertain_type']]['url_handle'] . '/' . $data['handle'] . '.html">';
            $output .= '<button id="entertain_next" class="button_90">';
            $output .= 'Nästa';
            $output .= '</button></a>' . "\n";
        }
    }
    if ($item['extension'] == 'swf') {
        $output .= '<button id="entertain_fullscreen" onclick="javascript: open_fullscreen_window(\'' . $address . '\');">';
        $output .= 'Spela i fullskärm';
        $output .= '</button>' . "\n";
    }
    $output .= '</div>' . "\n";
    // end entertain_item_buttons
    $output .= '</div>' . "\n";
    // end entertain_player
    // Description and game controls
    $output .= '<div class="entertain_description">' . "\n";
    if (strlen($item['description']) > 0) {
        $output .= $item['description'] . "\n";
    }
    if ($item['trailer_id'] > 0) {
        $output .= '<p>Filmtrailers visas i samarbete med Play Networks</p>' . "\n";
    }
    $output .= '</div>' . "\n";
    // end entertain_description
    if (!is_array($item['controls'])) {
        $item['controls'] = unserialize(utf8_decode($item['controls']));
        $utf8_mupp = true;
    }
    if (is_array($item['controls']) && count($item['controls']) > 0) {
        $output .= '<h2>Kontroller</h2>' . "\n";
        $output .= '<table class="entertain_controls">' . "\n";
        $num_of_rows = ceil(count($item['controls']) / 2);
        for ($i = 0; $i < $num_of_rows; $i++) {
            $output .= '<tr>' . "\n";
            if (!$utf8_mupp) {
                $output .= '<td class="combination">' . $item['controls'][$i]['combination'] . '</td>' . "\n";
                $output .= '<td class="description">' . $item['controls'][$i]['description'] . '</td>' . "\n";
            } else {
                $output .= '<td class="combination">' . utf8_encode($item['controls'][$i]['combination']) . '</td>' . "\n";
                $output .= '<td class="description">' . utf8_encode($item['controls'][$i]['description']) . '</td>' . "\n";
            }
            $output .= '</tr>' . "\n";
        }
        $output .= '</table>' . "\n";
    }
    if (is_privilegied('entertain_update')) {
        $output .= '<a class="entertain_edit" href="/' . $entertain_types[$item['entertain_type']]['url_handle'] . '/admin/' . $item['handle'] . '.html">[Redigera]</a>' . "\n";
    }
    if (is_privilegied('entertain_add')) {
        $output .= 'Personen som laddat upp det här objektet är: <a href="/traffa/profile.php?id=' . $item['uploader'] . '">' . $item['uploader'] . '</a>';
    }
    //todo! connect with javascript
    // Comments - Users can rank and leave a comment. These are handled by separate libraries but are connected
    // by javascript so that users submit rank and comment together.
    $output .= '<div class="entertain_comments">' . "\n";
    $output .= '<input type="hidden" id="entertain_item_id" value="' . $item['id'] . '" />' . "\n";
    $output .= '<h2 class="rank_input_header">Din poäng</h2>' . "\n";
    $output .= '<h2 class="comment_input_header">Din kommentar</h2>' . "\n";
    $output .= '<br style="clear: both;" />' . "\n";
    if (login_checklogin()) {
        $query = 'SELECT rank FROM user_ranks WHERE user_id = "' . $_SESSION['login']['id'] . '" AND item_id = "' . $item['id'] . '" AND item_type = "entertain"';
        $result = mysql_query($query);
        if (mysql_num_rows($result) == 1) {
            $data = mysql_fetch_assoc($result);
        }
    }
    unset($rank_options);
    $rank_options['previous'] = $data['rank'];
    $output .= rank_input_draw($item['id'], 'entertain', $rank_options);
    $output .= comments_input_draw($item['id'], 'entertain');
    $output .= '<br style="clear: both;" />' . "\n";
    $output .= '</div>' . "\n";
    // end entertain_comments
    $options['comments'] = isset($options['comments']) ? $options['comments'] : 'yes';
    if ($options['comments'] == 'yes') {
        $output .= comments_list($item['id'], 'entertain');
    }
    $output .= '</div>' . "\n";
    // end entertainment_item
    $output .= '</span>' . "\n";
    // end $entertain_type
    return $output;
}
Beispiel #4
0
function render_full_article($article)
{
    if (empty($article)) {
        $out .= rounded_corners_top(array('color' => 'red'));
        $out .= '<h1>Den här artikeln kunde tyvärr inte hittas</h1>' . "\n";
        $out .= '<a href="?action=list"><< Gå till listan över artiklar</a>' . "\n";
        $out .= rounded_corners_bottom(array('color' => 'red'));
    } else {
        $out .= render_article($article);
        if ($article['photo_category_id'] > 0) {
            $options['category'] = $article['photo_category_id'];
            $photos = photos_fetch($options);
            $out .= '<h2>Tillhörande bilder</h2>' . "\n";
            $out .= photos_list($photos);
        }
        if ($article['showauthor'] == 1) {
            $out .= render_author($article['author']);
        }
        if (isset($article['forum_category_id']) && $article['forum_category_id'] != 0) {
            $all_categories_list = discussion_forum_categories_fetch(array('id' => $article['forum_category_id']));
            $category = array_pop($all_categories_list);
            $forum_security = forum_security(array('action' => 'view_category', 'category' => $category));
            if ($forum_security == true) {
                $path_to_category = discussion_forum_path_to_category(array('id' => $category['id']));
                $locator_options['categories'] = $path_to_category;
                unset($options);
                $options['max_levels'] = 0;
                $options['parent'] = $category['id'];
                $categories = discussion_forum_categories_fetch($options);
                $out .= discussion_forum_categories_list($categories);
                $out .= '<h2>Trådar</h2>' . "\n";
                $post_options['forum_id'] = $category['id'];
                $post_options['threads_only'] = true;
                $post_options['order_by_sticky'] = true;
                $post_options['page_offset'] = $request['page_offset'];
                $post_options['url_lookup'] = true;
                $threads = discussion_forum_post_fetch($post_options);
                //$threads['url'] = $path_to_trailing_category = array_pop($path_to_category) . '/' . $thread['handle'] . '/sida_1.php';
                $out .= discussion_forum_thread_list($threads);
                $path_to_trailing_category = array_pop($path_to_category);
                $out .= '<a href="' . $path_to_trailing_category['url'] . '">Skapa en egen tråd länkad till artikeln</a>' . '<br style="clear: both;" />';
                forum_update_category_session(array('category' => $category, 'threads' => $threads));
            }
        }
        if ($article['commentable'] == 1) {
            $out .= rounded_corners_top(array('color' => 'blue_deluxe'));
            if ($article['rankable'] == 1) {
                $out .= rank_input_draw($article['id'], 'articles');
            }
            $out .= comments_input_draw($article['id'], 'articles');
            $out .= '<div style="clear: both;"></div>' . "\n";
            $out .= rounded_corners_bottom();
            $out .= comments_list($article['id'], 'articles');
        }
    }
    if (is_privilegied('articles_admin')) {
        $out .= '<a href="/artiklar/index.php?action=admin&article=edit&id=' . $article['id'] . '">Ändra i artikeln</a>' . "\n";
    }
    return $out;
}