Beispiel #1
0
function render_entries($entries, $options)
{
    $content .= '<ul class="group_entries">' . "\n";
    foreach ($entries as $entry) {
        $options['user_id'] = $entry['user_id'];
        $content .= message_top($options);
        $content .= '<div style="border-bottom: 1px solid #ababab;">' . "\n";
        $content .= '<span class="timestamp">' . fix_time($entry['timestamp']) . '</span>' . "\n";
        $content .= '<h2 style="display: inline;">' . $entry['header'] . '</h2> - <a href="/traffa/profile.php?id=' . $entry['user_id'] . '">' . $entry['username'] . '</a> ' . "\n";
        $content .= $entry['gender'];
        $content .= date_get_age($entry['birthday']);
        $content .= '<p>' . "\n";
        $content .= nl2br(html_entity_decode($entry['content'])) . "\n";
        $content .= '</p>' . "\n";
        $content .= '</div>' . "\n";
        // ----START----
        $content .= $_GET['action'] != 'show' ? '<a href="/hamsterpaj/hamsterblogg.php?action=show&id=' . $entry['id'] . '">Kommentera &raquo;</a>' : '<a href="/hamsterpaj/hamsterblogg.php">&laquo; Tillbaka</a>';
        // ----END------
        $content .= message_bottom();
        if ($options['enable_comments'] == true) {
            $content .= rounded_corners_top();
            $content .= '<label>Kommentera:</label>' . "\n";
            $content .= comments_input_draw($entry['id'], 'hamsterblog');
            $content .= rounded_corners_bottom();
            $content .= '<div style="clear: both;"></div>' . "\n";
            $content .= comments_list($entry['id'], 'hamsterblog');
        }
    }
    $content .= '</ul>' . "\n";
    return $content;
}
Beispiel #2
0
 function comments_list()
 {
     if (!$_POST) {
         exit("ERROR: you must send \$ POST array. Read the docs");
     }
     //p($_POST);
     $comments = array();
     if ($_POST['to_table'] == false) {
         $_POST['to_table'] = $_POST['for'];
     }
     if ($_POST['to_table_id'] == false) {
         $_POST['to_table_id'] = $_POST['id'];
     }
     if ($_POST['to_table_id'] == false) {
         $_POST['to_table_id'] = $_POST['content_id'];
     }
     $comments['to_table'] = CI::model('core')->securityDecryptString($_POST['to_table']);
     $comments['to_table_id'] = CI::model('core')->securityDecryptString($_POST['to_table_id']);
     $comments['display'] = CI::model('core')->securityDecryptString($_POST['display']);
     $comments['to_table'] = CI::model('core')->guessDbTable($comments['to_table']);
     //print_r ( $comments );
     if ($comments['display'] == false) {
         $comments['display'] = 'default';
     }
     comments_list($content_id = $comments['to_table_id'], $display = $comments['display'], $for = $comments['to_table'], $display_params = array());
     /*	$comments = CI::model('comments')->commentsGet ( $comments );
     
     		$this->template ['comments'] = $comments;
     
     		$this->load->vars ( $this->template );
     		$layout = $this->load->file ( APPPATH . 'controllers/api/views/' . __FUNCTION__ . '.php', true );
     
     
     
     		$layout = CI::model('content')->applyGlobalTemplateReplaceables ( $layout );
     
     		CI::library('output')->set_output ( $layout );*/
     //var_dump ($content_filename_pre, $files );
 }
Beispiel #3
0
function photos_display($photos, $wait_for_image_to_load)
{
    foreach ($photos as $photo) {
        $output .= '<div class="photo_full">' . "\n";
        $output .= '<div class="passepartout">' . "\n";
        $output .= '<p>' . $photo['date'] . ': <a href="/traffa/photos.php?ajax&user_id=' . $photo['user'] . '&image_id=' . $photo['id'] . '#photo" title="Länk till bilden">' . $photo['description'] . '</a><a href="/hamsterpaj/abuse.php?report_type=photo&reference_id=' . $photo['id'] . '" class="abuse_button"><img src="http://images.hamsterpaj.net/abuse.png" /></a>';
        if ($_SESSION['login']['id'] == 774586) {
            $output .= ' <img src="http://images.hamsterpaj.net/abuse.png" alt="Din mamma ;)" onclick=" /><br style="clear:both;" />';
        }
        $output .= '</p>' . "\n";
        $output .= '<span class="loading" id="loading"></span>' . "\n";
        $output .= '<img id="tha_image" src="' . IMAGE_URL . 'photos/full/' . floor($photo['id'] / 5000) . '/' . $photo['id'] . '.jpg" />';
        $output .= '</div>' . "\n";
        $output .= '</div>' . "\n";
        $comment_list_options = array();
        $comment_list_options['photo_owner'] = $photo['user'];
        if ($_SESSION['login']['id'] == $photo['user']) {
            //$comment_list_options['show_admin_controls'] = true;
            $categories = photos_get_categories(array('user' => $photo['user']));
            $output .= rounded_corners_top(array('color' => 'blue_deluxe'));
            $output .= '<form class="photo_edit" method="post">' . "\n";
            $output .= '<input type="hidden" name="action" value="update" />' . "\n";
            $output .= '<input type="hidden" name="photo_id" value="' . $photo['id'] . '" />' . "\n";
            $output .= '<input type="text" name="description" value="' . addslashes($photo['description']) . '" class="textbox" />' . "\n";
            $output .= '<select name="category" class="photo_category_selector">' . "\n";
            foreach ($categories as $category) {
                $selected = $photo['category'] == $category['id'] ? ' selected="selected"' : '';
                $output .= '<option value="' . $category['name'] . '"' . $selected . '>' . $category['name'] . '</option>' . "\n";
            }
            $output .= '<option value="new_category">Ny kategori</option>' . "\n";
            $output .= '</select>' . "\n";
            $output .= '<input type="submit" value="Uppdatera" class="button_80" />' . "\n";
            $output .= '</form>' . "\n";
            $output .= '<form class="photo_delete" method="post" action="/traffa/photos.php">' . "\n";
            $output .= '<input type="hidden" name="action" value="delete" />' . "\n";
            $output .= '<input type="hidden" name="photo_id" value="' . $photo['id'] . '" />' . "\n";
            $output .= '<input type="submit" value="Radera" class="photo_delete" />' . "\n";
            $output .= '</form>' . "\n";
            $output .= rounded_corners_bottom();
            // KOMMENTERING FÖR ÄGAREN
            $output .= rounded_corners_top(array('color' => 'blue_deluxe'));
            $output .= 'Du kan inte längre kommentera i det här fotoalbumet. Det beror på att vi håller på att byta ut det mot fotobloggen.';
            $output .= rounded_corners_bottom();
            // BILDTÄVLINGEN
            //$output .= rounded_corners_top(array('color' => 'blue_deluxe'), true);
            //$output .= '<span style="">Rita av en Sysop i paint! kolla in tävlingen <a href="/tavling.php">HÄR</a></span><span style="float: right; margin-top: -14px;">Bild-id: '.$photo['id'].'</span>';
            //$output .= rounded_corners_bottom(array('color' => 'blue_deluxe'), true);
            // END
            /*
            $query = 'UPDATE user_photos SET unread_comments = 0 WHERE id = "' . $photo['id'] . '" LIMIT 1';
            mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
            */
            cache_update_photo_comments();
        } else {
            if (is_privilegied('remove_photo')) {
                $output .= '<form class="photo_delete" method="post" action="/traffa/photos.php">' . "\n";
                $output .= '<input type="hidden" name="action" value="delete" />' . "\n";
                $output .= '<input type="hidden" name="photo_id" value="' . $photo['id'] . '" />' . "\n";
                $output .= '<input type="submit" value="Ta bort bild" class="photos_remove" />' . "\n";
                $output .= '</form>' . "\n";
                /*
                $output .= '';
                $output .= '<button class="button_90">Ta bort bild</button>' . "\n";
                */
            }
            $output .= rounded_corners_top(array('color' => 'blue_deluxe'));
            $output .= 'Du kan inte längre kommentera i det här fotoalbumet. Det beror på att vi håller på att byta ut det mot fotobloggen.';
            $output .= rounded_corners_bottom();
        }
        $output .= comments_list($photo['id'], 'photos', $comment_list_options);
    }
    return $output;
}
Beispiel #4
0
    $labels[0] = 'Oigenkännlig';
    $labels[1] = 'Inte alls lik';
    $labels[2] = 'Igenkännbar';
    $labels[3] = 'Ganska lik';
    $labels[4] = 'Identisk';
    for ($i = 0; $i < 5; $i++) {
        echo '<button value="' . $i . '" class="button_100" style="margin-right: 20px;" onclick="window.location = \'/hamburgare/test.php?burger_vote=' . $i . '&burger=' . $_SESSION['burger']['current_burger'] . '\';">' . $labels[$i] . '</button>' . "\n";
    }
    echo '<div id="burger_compare">' . "\n";
    echo '<img src="' . IMAGE_URL . 'hamburgers/' . $_SESSION['burger']['current_burger'] . '_ad.jpg" />' . "\n";
    echo '<img src="' . IMAGE_URL . 'hamburgers/' . $_SESSION['burger']['current_burger'] . '_real.jpg" />' . "\n";
    echo '</div>' . "\n";
    echo '<h2>Kommentera burgaren</h2>' . "\n";
    echo comments_input_draw($_SESSION['burger']['current_burger'], 'burger');
    rounded_corners_top();
    echo comments_list($_SESSION['burger']['current_burger'], 'burger');
    rounded_corners_bottom();
} else {
    echo '<p>Går det att känna igen hamburgarna från kedjornas reklambilder? Gissa dig igenom och sätt betyg på 14 hamburgare i vårt hamburger-test!</p>' . "\n";
    if (isset($_GET['burger']) && isset($_GET['burger_vote']) && in_array($_GET['burger_vote'], array(0, 1, 2, 3, 4))) {
        $query = 'UPDATE burgers SET votes = votes + 1, score = score + ' . $_GET['burger_vote'] . ', average_score = score/votes WHERE id = "' . $_GET['burger'] . '"';
        mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    }
    $query = 'SELECT id FROM burgers WHERE id NOT IN("' . implode('", "', $_SESSION['burger']['seen_burgers']) . '") ORDER BY RAND() LIMIT 1';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    if (mysql_num_rows($result) == 1) {
        $data = mysql_fetch_assoc($result);
        $_SESSION['burger']['current_burger'] = $data['id'];
        $_SESSION['burger']['seen_burgers'][] = $data['id'];
        echo '<h2>Vilken hamburgare är detta?</h2>' . "\n";
        echo '<img src="' . IMAGE_URL . 'hamburgers/' . $data['id'] . '_real.jpg" id="burger_guess_image" />' . "\n";
Beispiel #5
0
function photo_display_full($parameters)
{
    event_log_log('photo_display');
    $next_by_day = photo_get_photos(array('limit' => 1, 'photo_taken' => $parameters['image']['photo_taken'], 'order_direction' => 'ASC', 'internal_id_min' => $parameters['image']['internal_id']));
    $next_by_album = photo_get_photos(array('limit' => 1, 'album' => $parameters['image']['album'], 'order_direction' => 'ASC', 'internal_id_min' => $parameters['image']['internal_id']));
    $previous_by_day = photo_get_photos(array('limit' => 1, 'photo_taken' => $parameters['image']['photo_taken'], 'order_direction' => 'DESC', 'internal_id_max' => $parameters['image']['internal_id']));
    $previous_by_album = photo_get_photos(array('limit' => 1, 'album' => $parameters['image']['album'], 'order_direction' => 'DESC', 'internal_id_max' => $parameters['image']['internal_id']));
    echo '<div class="photo_full">' . "\n";
    echo '<div class="head">' . "\n";
    echo '<span class="date">' . $parameters['image']['photo_taken'] . '</span>' . "\n";
    if (strlen($parameters['image']['description']) > 0) {
        echo '<p class="photo_description">' . "\n";
        echo $parameters['image']['description'] . "\n";
        echo '</p>' . "\n";
    }
    echo '</div>' . "\n";
    // Photo with passepartout
    echo '<div class="photo_passepartout_outer">' . "\n";
    echo '<div class="photo_passepartout_inner">' . "\n";
    echo '<img src="' . PHOTO_FULL_IMAGE_URL . floor($parameters['image']['internal_id'] / 5000) . '/' . $parameters['image']['external_id'] . '.jpg" />' . "\n";
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    echo '<div class="foot">' . "\n";
    echo '<div class="next">' . "\n";
    if ($next_by_day[0]['internal_id'] > 0) {
        echo '<a href="/fotoalbum/bild.php?photo=' . $next_by_day[0]['external_id'] . '"><button class="button_110">Samma dag &raquo;</button></a>' . "\n";
    }
    if ($next_by_album[0]['internal_id'] > 0) {
        echo '<a href="/fotoalbum/bild.php?photo=' . $next_by_album[0]['external_id'] . '"><button class="button_110">Samma album &raquo;</button></a>' . "\n";
    }
    echo '</div>' . "\n";
    echo '<div class="previous">' . "\n";
    if ($previous_by_day[0]['internal_id'] > 0) {
        echo '<a href="/fotoalbum/bild.php?photo=' . $previous_by_day[0]['external_id'] . '"><button class="button_110">&laquo; Samma dag</button></a>' . "\n";
    }
    if ($previous_by_album[0]['internal_id'] > 0) {
        echo '<a href="/fotoalbum/bild.php?photo=' . $previous_by_album[0]['external_id'] . '"><button class="button_110">&laquo; Samma album</button></a>' . "\n";
    }
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    $query = 'UPDATE photos SET unread_comments = 0 WHERE internal_id = "' . $parameters['image']['internal_id'] . '" LIMIT 1';
    mysql_query($query);
    echo '<h2>Kommentarer</h2>' . "\n";
    echo '<h5>Här kan du lämna din kommentar</h5>' . "\n";
    echo comments_input_draw($parameters['image']['internal_id'], 'photo');
    rounded_corners_top();
    echo comments_list($parameters['image']['internal_id'], 'photo');
    rounded_corners_bottom();
    // Count views
    if (!in_array($parameters['image']['internal_id'], $_SESSION['photos']['viewed_photos'])) {
        $_SESSION['photos']['viewed_photos'][] = $parameters['image']['internal_id'];
        $query = 'UPDATE photos SET view_count = view_count + 1 WHERE internal_id = "' . $parameters['image']['internal_id'] . '" LIMIT 1';
        mysql_query($query);
    }
}
Beispiel #6
0
function tests_calculate_score($options)
{
    $options['source'] = isset($options['source']) ? $options['source'] : $_POST;
    if (!isset($options['handle'])) {
        tests_index(array('error_message' => 'Inget handle skickat till tests_calculate_score()!'));
        return;
    }
    $answers = array();
    $answers_to_fetch = array();
    foreach ($_POST as $post_variable_key => $post_variable) {
        if (preg_match('/^tests_save_answer_([0-9]+)_([0-9r]+)$/', $post_variable_key, $matches)) {
            // $matches[1] = question id
            $answers[$matches[1]][] = $post_variable;
            //$answers[question_id][x] = answer
            $unique_questions_answered[$matches[1]] = $matches[1];
        }
    }
    $answers_points = array();
    $answers_to_fetch_sql = '';
    foreach ($answers_to_fetch as $answer) {
        $answers_to_fetch_sql .= ' OR q.question_id = ' . $answer;
    }
    if (count($answers) > 0) {
        $query = 'SELECT id, custom_css, custom_score_phrases';
        $query .= ' FROM tests';
        $query .= ' WHERE handle = "' . $options['handle'] . '"';
        $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        if (mysql_num_rows($result) != 1) {
            tests_index(array('error_message' => 'Testet du postade till finns inte eller fanns två gånger!'));
            return;
        }
        $data = mysql_fetch_assoc($result);
        $test_custom_css = $data['custom_css'];
        $test_custom_score_phrases = $data['custom_score_phrases'];
        $test_id = $data['id'];
        $query = 'SELECT q.answers, q.answer_type, q.question_id';
        $query .= ' FROM tests_questions AS q, tests AS t';
        $query .= ' WHERE t.handle = "' . $options['handle'] . '" AND t.id = q.test_id';
        $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        $total_score = 0;
        $max_score = 0;
        $answers_to_save_sql = array();
        while ($data = mysql_fetch_assoc($result)) {
            $question_answers = unserialize(stripslashes($data['answers']));
            $this_question_max_score = 0;
            foreach ($question_answers as $question_answer_key => $question_answer) {
                /* question_answer[0] = answer, question_answer[1] = points/score (<--That's what we're going to use!). */
                if (in_array($question_answer_key, $answers[$data['question_id']])) {
                    if (login_checklogin()) {
                        // %TESTID% is replaced with the tests ID below...
                        // (user_id, test_id, question_id, answer_id)
                        $answers_to_save_sql[] = '(' . $_SESSION['login']['id'] . ', %TESTID%, ' . $data['question_id'] . ', ' . $question_answer_key . ')';
                    }
                    $total_score = $total_score + $question_answer[1];
                }
                if ($data['answer_type'] == 'single_answer') {
                    if ($this_question_max_score < $question_answer[1]) {
                        $this_question_max_score = $question_answer[1];
                    }
                } elseif ($data['answer_type'] == 'multiple_answers' && $question_answer[1] > 0) {
                    $this_question_max_score = $this_question_max_score + $question_answer[1];
                }
            }
            $max_score = $max_score + $this_question_max_score;
        }
        if ($max_score > 0 && $total_score > 0) {
            $score_percents_right = round($total_score / $max_score * 100);
            if ($max_score == $total_score) {
                $score_text_index = 'all';
            } else {
                $score_text_index = round($total_score / $max_score * 4) + 1;
                // 1-5
            }
            $score_color_index = round($total_score / $max_score * 4) + 1;
            // 1-5
        } else {
            $percents_right = 0;
            $score_color_index = 1;
            $score_text_index = 'zero';
            /*if($total_score < 0)
            		{
            			$score_text_index = 'below_zero';
            		}*/
        }
        $score_texts = array();
        //$score_texts['below_zero'] = 'Men du, det här gick inte så bra alls! Minuspoäng! %TOTAL_SCORE% av %MAX_SCORE%.';
        $score_texts['zero'] = 'Men du... Du fick noll poäng, dags att öva?';
        $score_texts['all'] = 'Gratulerar! Du fick alla rätt! (%MAX_SCORE% var max).';
        $score_texts[1] = 'Nä, det här var du inte så bra på. Du fick bara %TOTAL_SCORE% av %MAX_SCORE% poäng.';
        $score_texts[2] = 'Det gick väl sådär, du fick %TOTAL_SCORE% poäng av %MAX_SCORE% möjliga.';
        $score_texts[3] = 'Bättre kan du! Av %MAX_SCORE% fick du %TOTAL_SCORE%, alltså ungefär hälften.';
        $score_texts[4] = 'Du fick hyfast bra poäng, men ändå inte jättebra. Om du övar lite så kanske dina %TOTAL_SCORE% poäng blir maxpoäng (%MAX_SCORE%p).';
        $score_texts[5] = 'Gratulerar! Du fick %TOTAL_SCORE% poäng, vilket är nästan alla rätt. På det här testet kunde man som mest få %MAX_SCORE%.';
        if (!empty($custom_score_phrases)) {
            $score_texts = unserialize(stripslashes($custom_score_phrases));
        }
        $score_text = str_replace(array('%TOTAL_SCORE%', '%MAX_SCORE%'), array($total_score, $max_score), $score_texts[$score_text_index]);
        global $ui_options;
        $ui_options['stylesheets'][] = 'tests.css';
        $ui_options['stylesheets'][] = 'comments.css';
        $ui_options['javascripts'][] = 'comments.js';
        if ($custom_css == 'yes') {
            $ui_options['stylesheets'][] = $options['handle'];
        }
        ui_top($ui_options);
        //echo '<h1>Resultat av test</h1>';
        echo '<h2>' . $score_text . '</h2>';
        echo '<div class="score_meter"><div class="color_' . $score_color_index . '" style="width: ' . $score_percents_right * 3 . 'px">&nbsp;</div></div>';
        echo '<div class="score_meter_right">Din poäng: ' . $total_score . ' (' . $score_percents_right . '% av max)<br />Maxpoäng: ' . $max_score . '</div>';
        echo '<br style="clear: both" />';
        if (login_checklogin()) {
            if (count($answers_to_save_sql) > 0) {
                $query = 'SELECT id FROM tests WHERE handle = "' . $options['handle'] . '" LIMIT 1';
                $result = mysql_query($query) or report_sql_error($query);
                $data = mysql_fetch_assoc($result);
                $test_id = $data['id'];
                $query = 'INSERT INTO tests_user_score (user_id, test_id, score, timestamp) VALUES';
                $query .= ' (' . $_SESSION['login']['id'] . ', ' . $test_id . ', ' . $total_score . ', ' . time() . ')';
                $result = @mysql_query($query);
                // ...
                if ($result) {
                    $query = 'INSERT INTO tests_user_answers (user_id, test_id, question_id, answer_id) VALUES';
                    $query .= ' ' . str_replace('%TESTID%', $test_id, implode(', ', $answers_to_save_sql));
                } else {
                    echo 'Poängen sparades inte eftersom att du redan gjort testet en gång.';
                }
            } else {
                echo 'Du måste svara på någon av frågorna!';
            }
        } else {
            echo 'Om du loggar in så kan vi spara dina poäng också!';
        }
        echo '</p><br /><br />' . "\n";
        echo '<h2>Folk som gjort testet</h2>';
        echo rounded_corners_top();
        echo tests_get_last_test_completers(array('test_id' => $test_id, 'limit' => 4));
        echo '<br style="clear: both" />';
        echo rounded_corners_bottom();
        echo rounded_corners_top();
        echo 'Kommentera testet: ' . comments_input_draw($test_id, 'tests');
        echo comments_list($test_id, 'tests');
        echo rounded_corners_bottom();
        echo '<p>';
        echo '<a href="/tests/">Tillbaka till testernas förstasida.</a>';
        echo '</p>';
    } else {
        global $ui_options;
        ui_top($ui_options);
        jscript_go_back();
    }
}
    <p>The image you have requested doesn't exists.</p>
  </div>
  <div align="right" style="padding: 10px" class="clear gall_nav"> <a href="#" class="gallery_prev">Previous</a>&nbsp;|&nbsp;<a href="#" class="gallery_next">Next</a> &nbsp;&nbsp;</div>
  <? $media = CI::model('core')->mediaGet('table_content', url_param('id'), $media_type = 'picture', $order = "ASC", $queue_id = false, $no_cache = false, $id = false);
	 
	$media = $media['pictures'];
	?>
  <? if(!empty($media)): ?>
  <? $i=0 ; foreach($media as $item):
	// var_dump($item);

	?>
  <div class="gallery_item img_id_<? print $item['id']; ?>" id="gimage_<? print  $i ?>"> <a href="#gimage_<? if($media[$i+1] != false): ?><? print  $i+1; ?><? else: ?>0<? endif; ?>"> <span class="imgpreload"><? print CI::model('core')->mediaGetThumbnailForMediaId($item['id'], $size_width = 500, $size_height = false); ?></span> </a>
    <div class="gallery_item_comments">
      <? $update_element = md5(serialize($item));
  $this->template ['comments_update_element'] = $update_element;
	$this->load->vars ( $this->template );
  ?>
      <? comment_post_form($item['id'],'dashboard/index_item_comments.php', 'media')  ?>
      <div id="<? print $update_element ?>">
        <? comments_list($item['id'], 'dashboard/index_item_comments_list.php', 'media')  ?>
      </div>
    </div>
  </div>
  <? $i++; endforeach; ?>
  <? endif; ?>
</div>
<? /*
            END GALLERY
 */ ?>
</a></span>
    <?php 
        $i++;
    }
    ?>
  </div>
  <br />
  <?php 
}
?>
 <br />
 <h2 class="coment-title">Post your comment</h2>

    <? comment_post_form($the_post['id']); ?>
    <div class="c"> </div>
  <? comments_list($the_post['id'], 'default'); ?>

  <br /><br />
</div>
<div class="inner_video_side">

    <div class="bluebox">
        <div class="blueboxcontent">
            <div class="video_list_item" style="margin: 10px auto;">
                <a class="mw_blue_link" href="#">The worst ! ever ! American idol ! FUNNY</a>
                <a style="background-image: url(&quot;http://pecata/dev.microweber.com/public_html/skide/userfiles/media/pictures/150_150/no.gif&quot;);" class="img" href=""> </a>
                <a href="javascript:mw.content.Vote('','', '');" class="user_activity_likes left"><strong>0</strong><span></span></a>
                <a href="" class="user_activity_comments right"><strong id="post-likes-339">1</strong><span></span></a>
            </div>
            <div class="video_list_item" style="margin: 10px auto;">
                <a class="mw_blue_link" href="#">The worst ! ever ! American idol ! FUNNY</a>
Beispiel #9
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;
}
Beispiel #10
0
        $entry .= rounded_corners_top();
        $entry .= '<h2 style="margin-top: 0;">Foton från samma datum</h2>' . "\n";
        $entry .= photos_list_mini($photos);
        $entry .= '<div style="clear: both;"></div>' . "\n";
        $entry .= rounded_corners_bottom();
    }
    $entry .= '<p>' . nl2br($data['text']) . '</p>' . "\n";
    if ($user_id == $_SESSION['login']['id'] || is_privilegied('remove_diary_post')) {
        $entry .= '<a href="?user_id=' . $user_id . '&action=remove&id=' . $data['id'] . '">Ta bort dagboksinlägget</a>' . "\n";
    }
    // Comments
    $entry .= rounded_corners_top(array('color' => 'blue_deluxe'));
    $entry .= comments_input_draw($data['id'], 'blog');
    $entry .= '<div style="clear: both;"></div>' . "\n";
    $entry .= rounded_corners_bottom(array('color' => 'blue_deluxe'));
    $entry .= comments_list($data['id'], 'blog');
}
$short_months = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'Maj', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sept', 10 => 'Okt', 11 => 'Nov', 12 => 'Dec');
$query = 'SELECT id, date, title FROM blog WHERE user = "******" AND is_removed = 0 ORDER BY id DESC';
$result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
while ($data = mysql_fetch_assoc($result)) {
    $entries[$data['date']] = $data;
    $month = $short_months[date('n', strtotime($data['date']))] . date(' -y', strtotime($data['date']));
    if (!in_array($month, $months)) {
        $months[date('Y-m', strtotime($data['date']))] = $month;
    }
}
$output .= rounded_corners_top(array('color' => 'blue_deluxe'));
$output .= '<select id="diary_date_selector">' . "\n";
$i = 0;
foreach ($months as $ymd => $month) {
Beispiel #11
0




<div><span class="st_sharethis" st_url="<? print post_link($post_data["id"]); ?>" st_title="<? print addslashes($post_data["content_title"]); ?>" displayText="Share this"></span>

 <a href="#" class="user_activity_comments"><strong><? print comments_count($post_data['id'], false); ?></strong><span></span><strong>Comments</strong></a> <a  class="user_activity_likes right"  href="<? print voting_link($post_data['id'], '#post-likes-'.$post_data['id']); ?>"><strong id="post-likes-<? print ($post_data['id']); ?>"><? print votes_count($post_data['id'], false ); ?></strong> Like</a> </div>
  </div>
  <? $update_element = md5(serialize($post_data));
  $this->template ['comments_update_element'] = $update_element;
	$this->load->vars ( $this->template );
  ?>
  <? comment_post_form($post_data['id'],'dashboard/index_item_comments.php')  ?>
  <div id="<? print $update_element ?>">
    <? comments_list($post_data['id'], 'dashboard/index_item_comments_list.php')  ?>
  </div>
  
  
  

 <? else : ?>
 
 
 
 
 
  <? if($dashboard_user == user_id()) : ?>
  <a href="#" onclick="$('.video_type').slideDown()" class="mw_btn_s right" ><span>Add new video</span></a>
  <h2>My videos</h2>
  <? else: ?>
Beispiel #12
0
$ui_options['menu_path'] = array('chat', 'statistik');
$ui_options['title'] = 'Undersökningar på Hamsterpaj';
$ui_options['stylesheets'][] = 'comments.css';
$ui_options['javascripts'][] = 'comments.js';
$request = poll_get_action($_SERVER['REQUEST_URI']);
switch ($request['action']) {
    case 'view_poll':
        $output .= poll_render($request['poll']);
        $output .= '<h2>Visa undersökningen i forumet</h2>' . "\n";
        $output .= '<p>Använd detta ID-nummer om du vill infoga undersökningen i vårt forum: <strong>' . $request['poll']['id'] . '</strong></p>' . "\n";
        $output .= '<h2>Lägg till på din blogg eller websida</h2>' . "\n";
        $output .= '<p>Du kan lägga till denna omröstning på din blogg eller hemsida. Kopiera bara koden nedanför och klistra in den där du vill ha undersökningen. <strong>Denna kod fungerar inte i vårt forum!</strong></p>' . "\n";
        $output .= '<input type="text" class="poll_embed_code" value=\'&lt;script type="text/javascript" language="javascript" src="http://www.hamsterpaj.net/poll/embed.php?poll=' . $request['poll']['id'] . '"&gt;&lt;/script&gt;\' />' . "\n";
        $output .= '<h2>Kommentera omröstningen</h2>' . "\n";
        $output .= comments_input_draw($request['poll']['id'], 'poll');
        $output .= comments_list($request['poll']['id'], 'poll');
        break;
    case 'index':
        $output .= '<h1>Här kan man göra sina enga undersökningar</h1>' . "\n";
        if (login_checklogin()) {
            $output .= '<h2>Gör en ny undersökning</h2>';
            $output .= poll_form();
            $polls = poll_fetch(array('author' => $_SESSION['login']['id'], 'limit' => 100));
            if (count($polls) > 0) {
                $output .= '<h1>Dina undersökningar</h1>' . "\n";
                $output .= '<ul class="poll_list">' . "\n";
                foreach ($polls as $poll) {
                    $output .= '<li>' . date('Y-m-d', $poll['timestamp']) . ' <a href="/poll/' . $poll['handle'] . '.html">' . $poll['question'] . '</a></li>' . "\n";
                }
                $output .= '</ul>' . "\n";
            }
Beispiel #13
0
        if ($content_check === 1) {
            comments_new($_POST['item_id'], $_POST['item_type'], $_SESSION['login']['id'], $_POST['comment']);
        } else {
            $output .= 'Vår server tyckte att ditt meddelande bröt mot våra regler, så det sparades inte. Kommentar: ' . $content_check . "\n";
        }
    }
    if (isset($_POST['return_list'])) {
        $output .= comments_list($_POST['item_id'], $_POST['item_type']);
        echo $output;
    }
} elseif ($_GET['action'] == 'comments_list_all') {
    echo '<style type="text/css">@import url(\'/stylesheets/ui.css.php?\');</style>' . "\n";
    echo '<div id="content">' . "\n";
    echo comments_list($_GET['item_id'], $_GET['item_type'], array('list_style' => 'compact', 'limit' => 'no_limit'));
    echo '</div>';
} elseif ($_GET['action'] == 'comment_remove') {
    if (is_numeric($_GET['id'])) {
        comments_remove($_GET['id']);
    } else {
        echo 'You h4xx0r...';
    }
} elseif ($_GET['action'] == 'comment_answer') {
    if (is_numeric($_GET['id'])) {
        comment_answer($_GET['id'], $_GET['reply']);
        $output .= comments_list($_GET['item_id'], 'photos');
        echo $output;
    } else {
        jscript_alert('hejdå');
        echo 'You h4xx0r...';
    }
}
Beispiel #14
0
echo '<h1>Jämför alla burgare</h1>' . "\n";
echo '<p>' . "\n";
echo 'Här visas alla burgare vi jämförde. Vi tog även ett gruppfoto som kan laddas ned som <a href="http://images.hamsterpaj.net/hamburgers/gruppfoto.jpg" target="_blank">högupplöst bakgrundsbild</a>.<br />' . "\n";
echo 'Alla foton har tagits av Dan Lindgren för Hamsterpajs räkning, och vi är tacksamma om du nämner detta när du wärschar bilderna.' . "\n";
echo '</p>' . "\n";
$query = 'SELECT * FROM burgers ORDER BY vendor, name';
$result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
while ($data = mysql_fetch_assoc($result)) {
    $labels[0] = 'Oigenkännlig';
    $labels[1] = 'Inte alls lik';
    $labels[2] = 'Igenkännbar';
    $labels[3] = 'Ganska lik';
    $labels[4] = 'Identisk';
    echo '<h2>' . $data['name'] . ' från ' . $data['vendor'] . '</h2>' . "\n";
    echo '<p>' . round($data['correct_ratio'] * 100) . '% rätta gissningar, snittbetyg: ' . $labels[round($data['average_score'])] . '</p>' . "\n";
    echo '<div id="burger_compare">' . "\n";
    echo '<img src="' . IMAGE_URL . 'hamburgers/' . $data['id'] . '_ad.jpg" />' . "\n";
    echo '<img src="' . IMAGE_URL . 'hamburgers/' . $data['id'] . '_real.jpg" />' . "\n";
    echo '</div>' . "\n";
    echo '<h4>Kommentarer till ' . $data['name'] . '</h4>' . "\n";
    rounded_corners_top();
    echo comments_list($data['id'], 'burger');
    rounded_corners_bottom();
    echo '<hr style="margin-top: 20px; margin-bottom: 20px;" />';
}
event_log_log('burgers_overview');
ui_bottom();
?>


  <div class="hr">&nbsp;</div>
  <div class="bluebox">
    <div class="bluebox_content">
      <?
 
  $params= array();
$params['display']= 'post_item_video_sidebar.php';
 
$params['items_per_page'] = 3;
$params['category'] = $active_categories[0];
$params['curent_page'] = rand(1,5);
 get_posts($params);

   
  ?>
      <a href="<? print category_link($active_categories[0]); ?>" class="more">See more videos</a> </div>
  </div>
</div>
<div class="c">&nbsp;</div>
<br />
  <? include(TEMPLATE_DIR.'banner_wide.php')	; ?>  <br />  
<br />
<div class="c">&nbsp;</div>
<h2>Comments</h2>
<? comments_list($post['id'])  ?>
<br />
<div class="c">&nbsp;</div>
<br />
<h2 class="coment-title">Post your comment</h2>
<? comment_post_form($post['id'])  ?>
Beispiel #16
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 #17
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 #18
0
    
    
    
    
    
    
    
    <div>  <a href="#" class="user_activity_comments"><strong><? print comments_count($log_check['rel_table_id'], false); ?></strong><span></span><strong>Comments</strong></a> <a  class="user_activity_likes right"  href="<? print voting_link($log_check['to_table_id'], '#post-likes-'.$log_check['to_table_id'], $log_check['to_table']); ?>"><strong id="post-likes-<? print ($log_check['to_table_id']); ?>"><? print votes_count($log_check['to_table_id'], false,$log_check['to_table'] ); ?></strong> Like</a> </div>
  </div>
  <? $update_element = md5(serialize($log_check));
  $this->template ['comments_update_element'] = $update_element;
	$this->load->vars ( $this->template );
  ?>
  <? comment_post_form($log_check['rel_table_id'],'dashboard/index_item_comments.php', $log_check['rel_table'])  ?>
  <div id="<? print $update_element ?>">
    <? comments_list($log_check['rel_table_id'], 'dashboard/index_item_comments_list.php', $log_check['rel_table'])  ?>
  </div>
  <!--<div class="comment_area">
    <div class="comment_area_content">
      <form method="post" action="#">
        <a href="#" class="user_photo" style="background-image: url(<?php 
print TEMPLATE_URL;
?>
/static/img/demo/userbox.jpg)"></a>
        <textarea>Write a comment...</textarea>
        <a href="#" class="submit">Submit</a>
      </form>
    </div>
  </div>
  <br />
  <span class="user_like"></span><a href="#" class="mw_blue_link">You</a>, <a href="#" class="mw_blue_link">Krasimira Avramova</a> and <a href="#" class="mw_blue_link">Dimitar Bozhanov</a> like this. <br />
Beispiel #19
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 #20
0
                $output .= rounded_corners_top();
                $output .= entertain_list($items, $list_options);
                $output .= rounded_corners_bottom();
                //En utvalt item med två kommentarer
                $output .= rounded_corners_top();
                $fetch['entertain_type'] = $request['entertain_type'];
                $fetch['order'] = 'random';
                $fetch['limit'] = '1';
                $fetch_result = entertain_fetch($fetch);
                $items = $fetch_result['items'];
                $item = array_pop($items);
                $output .= '<div class="entertain_item_with_comments">' . "\n";
                $output .= entertain_thumbnail_draw($item);
                $comments_options['limit'] = 2;
                $comments_options['style'] = 'no_margin';
                $output .= comments_list($item['id'], 'entertain', $comments_options);
                $output .= '<br style="clear: both;" />' . "\n";
                $output .= '</div>' . "\n";
                $output .= rounded_corners_bottom();
                // Visa en slumpvald item
                $fetch['entertain_type'] = $request['entertain_type'];
                $fetch['order'] = 'random';
                $fetch['limit'] = '1';
                $fetch_result = entertain_fetch($fetch);
                $items = $fetch_result['items'];
                $item = array_pop($items);
                $draw_options['comments'] = 'no';
                $output .= entertain_item_draw($item, $draw_options);
        }
}
$output .= '</div>' . "\n";
Beispiel #21
0
function run()
{
    global $user;
    global $layout;
    global $DB;
    global $website;
    $out = '';
    $item = new comment();
    switch ($_REQUEST['act']) {
        case 'json':
        case 1:
            // json data retrieval & operations
            switch ($_REQUEST['oper']) {
                case 'del':
                    // remove rows
                    $ids = $_REQUEST['ids'];
                    foreach ($ids as $id) {
                        $item->load($id);
                        $item->delete();
                    }
                    echo json_encode(true);
                    break;
                default:
                    // list or search
                    $page = intval($_REQUEST['page']);
                    $max = intval($_REQUEST['rows']);
                    $offset = ($page - 1) * $max;
                    $orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
                    $where = ' website = ' . $website->id;
                    if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
                        if (isset($_REQUEST['quicksearch'])) {
                            $where .= $item->quicksearch($_REQUEST['quicksearch']);
                        } else {
                            if (isset($_REQUEST['filters'])) {
                                $where .= navitable::jqgridsearch($_REQUEST['filters']);
                            } else {
                                // single search
                                $where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
                            }
                        }
                    }
                    $DB->queryLimit('id,item,user,email,date_created,status,message', 'nv_comments', $where, $orderby, $offset, $max);
                    $dataset = $DB->result();
                    $total = $DB->foundRows();
                    //echo $DB->get_last_error();
                    $out = array();
                    $permissions = array(-1 => '<img src="img/icons/silk/new.png" align="absmiddle" /> ' . t(257, 'To review'), 0 => '<img src="img/icons/silk/world.png" align="absmiddle" /> ' . t(64, 'Published'), 1 => '<img src="img/icons/silk/world_dawn.png" align="absmiddle" /> ' . t(251, 'Private'), 2 => '<img src="img/icons/silk/world_night.png" align="absmiddle" /> ' . t(181, 'Hidden'), 3 => '<img src="img/icons/silk/error.png" align="absmiddle" /> ' . t(466, 'Spam'));
                    for ($i = 0; $i < count($dataset); $i++) {
                        if (empty($dataset[$i])) {
                            continue;
                        }
                        // retrieve webuser name
                        $webuser = $DB->query_single('username', 'nv_webusers', ' id = ' . $dataset[$i]['user']);
                        // retrieve item title
                        $item = new item();
                        $item->load($dataset[$i]['item']);
                        $title = $item->dictionary[$website->languages_list[0]]['title'];
                        $message = core_string_clean($dataset[$i]['message']);
                        $message = core_string_cut($message, 60, '&hellip;');
                        $out[$i] = array(0 => $dataset[$i]['id'], 1 => $title, 2 => core_ts2date($dataset[$i]['date_created'], true), 3 => empty($dataset[$i]['user']) ? $dataset[$i]['email'] : $webuser, 4 => strip_tags($message), 5 => $permissions[$dataset[$i]['status']]);
                    }
                    navitable::jqgridJson($out, $page, $offset, $max, $total);
                    break;
            }
            session_write_close();
            exit;
            break;
        case 2:
            // edit/new form
        // edit/new form
        case 'edit':
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
            }
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    property::save_properties_from_post('comment', $item->id);
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
                if (!empty($item->id)) {
                    users_log::action($_REQUEST['fid'], $item->id, 'save', $item->name, json_encode($_REQUEST));
                }
            } else {
                if (!empty($item->id)) {
                    users_log::action($_REQUEST['fid'], $item->id, 'load', $item->name);
                }
            }
            $out = comments_form($item);
            break;
        case 4:
            // remove
        // remove
        case 'remove':
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
                if ($item->delete() > 0) {
                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
                    $out = comments_list();
                    if (!empty($item->id)) {
                        users_log::action($_REQUEST['fid'], $item->id, 'remove', $item->name, json_encode($_REQUEST));
                    }
                } else {
                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
                    $out = comments_form($item);
                }
            }
            break;
        case 'remove_spam':
            $count = comment::remove_spam();
            $layout->navigate_notification(t(524, 'Items removed successfully') . ': <strong>' . $count . '</strong>', false);
            $out = comments_list();
            users_log::action($_REQUEST['fid'], $website->id, 'remove_spam', "", json_encode($_REQUEST));
            break;
        case 'json_find_webuser':
            // json find webuser by name (for "user" autocomplete)
            $DB->query('SELECT id, username as text
						  FROM nv_webusers
						 WHERE username LIKE ' . protect('%' . $_REQUEST['username'] . '%') . '
				      ORDER BY username ASC
					     LIMIT 30', 'array');
            $rows = $DB->result();
            $total = $DB->foundRows();
            echo json_encode(array('items' => $rows, 'totalCount' => $total));
            core_terminate();
            break;
        case 'json_find_comment':
            // json find comment by text search (for "in reply to" autocomplete)
            $DB->query('SELECT c.id, c.date_created, c.name, u.username, c.message
						  FROM nv_comments c
						  LEFT JOIN nv_webusers u ON c.user = u.id
						 WHERE
						    c.website = ' . $website->id . ' AND
						    c.item = ' . $_REQUEST['node_id'] . ' AND
						    c.date_created <= ' . $_REQUEST['maxdate'] . ' AND
						    c.id <> ' . $_REQUEST['exclude'] . ' AND						     
						    (   c.name LIKE ' . protect('%' . $_REQUEST['search'] . '%') . ' OR
						        c.message LIKE ' . protect('%' . $_REQUEST['search'] . '%') . ' OR
						        u.username LIKE ' . protect('%' . $_REQUEST['search'] . '%') . '
                            )                          
				      ORDER BY c.date_created DESC
					     LIMIT 30', 'array');
            $rows = $DB->result();
            $total = $DB->foundRows();
            for ($r = 0; $r < count($rows); $r++) {
                $rows[$r]['text'] = '<span title="' . core_string_cut($rows[$r]['message'], 100) . '"><i class="fa fa-user"></i> ' . $rows[$r]['name'] . $rows[$r]['username'] . ' <i class="fa fa-clock-o"></i> ' . core_ts2date($rows[$r]['date_created'], true) . '</span>';
            }
            echo json_encode(array('items' => $rows, 'totalCount' => $total));
            core_terminate();
            break;
        case 91:
            // json search title request (for "item" autocomplete)
            $DB->query('SELECT DISTINCT node_id as id, text as label, text as value
						  FROM nv_webdictionary
						 WHERE node_type = "item"
						   AND subtype = "title"
						   AND website = ' . $website->id . ' 
						   AND text LIKE ' . protect('%' . $_REQUEST['title'] . '%') . '
				      ORDER BY text ASC
					     LIMIT 30', 'array');
            // AND lang = '.protect($_REQUEST['lang']).'
            echo json_encode($DB->result());
            session_write_close();
            exit;
            break;
        case 0:
            // list / search result
        // list / search result
        default:
            $out = comments_list();
            break;
    }
    return $out;
}