/** * displayYouTubeVideoPage * * @param array $video * * @return void */ function displayYouTubeVideoPage($video) { // Save video id for ajax call $_SESSION['source_id'] = $video['source_id']; $this->displayHeader(); // Video not found in db if (!is_array($video)) { echo ' <div class="info-alert"> <h2>' . T_('Missing or Invalid Video.') . '</h2> <p>' . T_('This video cannot be found. Are you sure you typed in URL correctly?') . '</p> </div>'; $this->displayFooter(); return; } elseif ($video['source_id'] == '0') { $this->displayVideoNotFound($video, 'YouTube'); return; } $youTubeService = new Zend_Gdata_YouTube(); $status = null; // Get video entry try { $videoEntry = $youTubeService->getVideoEntry($video['source_id']); } catch (Exception $e) { $response = $e->getRawResponseBody(); $private = stripos($response, 'Private video'); $notFound = stripos($response, 'Video not found'); // Video not found at YouTube if ($notFound !== false) { $this->displayVideoNotFound($video, 'YouTube'); return; } elseif ($private !== false) { echo ' <div class="error-alert"> <p>' . T_('Sorry, this video is private.') . '</p> <p>' . $e->getMessage() . '</p> </div>'; $this->displayFooter(); return; } else { echo ' <div class="error-alert"> <p>' . T_('Could not get video information.') . '</p> <p>' . $e->getMessage() . '</p> </div>'; $this->displayFooter(); return; } } // Video is public/unlisted if ($status == null) { $status = $this->getUploadStatus($video['source_id']); } $url = 'video.php?u=' . $video['created_id'] . '&id=' . $video['id']; // Is youtube processing finished? if ($status !== 'Finished') { echo ' <div class="ok-alert"> <p><b>' . T_('Your video was uploaded to YouTube successfully.') . '</b></p> <p>' . T_('However it may take a few moments before you video is viewable. Please check back later.') . '</p> <p id="js_msg"></p><br/> <p>' . T_('Current status: ') . '<span id="current_status">' . $status . '</span></p> <p id="refresh"><a href="' . $url . '">' . T_('Refresh') . '</a></p> </div>'; $this->displayFooter(); return; } // Ajax is done at this point, we don't need the id anymore unset($_SESSION['source_id']); $videoUrl = 'http://www.youtube.com/e/' . $video['source_id'] . '?version=3&enablejsapi=1&rel=0&wmode=transparent'; $this->displayVideoStartCode(); echo ' <div id="sections_menu"> <ul> <li><a href="video.php">' . T_('Latest Videos') . '</a></li> <li><a href="video.php?u=' . $video['created_id'] . '">' . getUserDisplayName($video['created_id'], 2) . '</a></li> </ul> </div>'; // Can you edit/delete this video? if ($video['created_id'] == $this->fcmsUser->id || $this->fcmsUser->access == 1) { echo ' <div id="video_edit"> <form action="' . $url . '" method="post"> <div id="delete"> <input type="hidden" id="id" name="id" value="' . $video['id'] . '"/> <input type="hidden" id="source_id" name="source_id" value="' . $video['source_id'] . '"/> <input class="btn" type="submit" id="remove_video" name="remove_video" value="' . T_('Remove Video') . '"/> <label for="delete_youtube">' . T_('Delete from YouTube?') . '</label> <input type="checkbox" id="delete_youtube" name="delete_youtube"/> </div> </form> </div>'; } echo ' <div id="video_desc"> <img src="' . getCurrentAvatar($video['created_id']) . '"/> <h2>' . cleanOutput($video['title']) . '</h2> <p>' . cleanOutput($video['description']) . '</p> </div> <div id="video_content"> <iframe class="youtube-player" type="text/html" width="' . $video['width'] . '" height="' . $video['height'] . '" src="http://www.youtube.com/embed/' . $video['source_id'] . '" allowfullscreen frameborder="0"> </iframe> </div>'; echo '<p>' . T_('Views') . ': ' . $videoEntry->getVideoViewCount() . '</p>'; $params = array('id' => $video['id']); displayComments($url, 'video', $params); $this->displayFooter(); }
function displayQuestion($q_no, $q_id, $theme, $scenario, $leadin, $q_type, $correct, $settings, $q_media, $q_media_width, $q_media_height, $options, $comments, $correct_buf, $display_method, $score_method, $labelcolor, $themecolor, $std, $reviewer_data, $type, $string, $language) { $configObject = Config::get_instance(); $cfg_root_path = $configObject->get('cfg_root_path'); if ($theme != '') { echo "<tr><td colspan=\"2\"><h1 style=\"color:{$themecolor}\">{$theme}</h1></td></tr>\n"; } echo "<tr>\n"; if ($q_type != 'extmatch' and $q_type != 'matrix') { if ($q_type == 'info') { echo "<td colspan=\"2\" style=\"padding-left:10px; padding-right:10px\">{$leadin}\n"; } else { if ($scenario != '') { echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$scenario}<br />\n"; echo $leadin; if ($q_media != '' and $q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'area') { echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } if ($q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'blank') { echo "<p>\n<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" style=\"margin-left:30px\">\n"; } } else { echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$leadin}\n"; if ($q_media != '' and $q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'area') { echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } if ($q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'blank') { echo "<p>\n<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" style=\"margin-left:30px\">\n"; } } } switch ($q_type) { case 'area': ?> <br /> <?php if ($configObject->get('cfg_interactive_qs') == 'html5') { //<!-- ======================== HTML5 part include find ================= --> echo "<canvas id='canvas" . $q_no . "' width='" . ($q_media_width + 2) . "' height='" . ($q_media_height + 1) . "'></canvas>\n"; echo "<div style='width:100%;text-align: left;' id='canvasbox'></div>\n"; echo "<script>\n"; echo "setUpQuestion(" . $q_no . ", 'q" . $q_no . "','" . $language . "', '" . $q_media . "', '" . $correct . "', '','','#FFC0C0','area','script');\n"; echo "</script>\n"; //<!-- ==================================================== --> } else { echo "<script>\n"; echo "write_string('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"" . ($q_media_width + 2) . "\" height=\"" . ($q_media_height + 1) . "\" id=\"externalinterfaceq" . $q_no . "_1\" align=\"top\">');\n"; echo "write_string('<param name=\"movie\" value=\"" . $configObject->get('cfg_root_path') . "/question/edit/area.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<param name=\"play\" value=\"true\" />');\n"; echo "write_string('<param name=\"loop\" value=\"true\" />');\n"; echo "write_string('<param name=\"wmode\" value=\"opaque\" />');\n"; echo "write_string('<param name=\"scale\" value=\"showall\" />');\n"; echo "write_string('<param name=\"menu\" value=\"true\" />');\n"; echo "write_string('<param name=\"devicefont\" value=\"false\" />');\n"; echo "write_string('<param name=\"salign\" value=\"top\" />');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"sameDomain\" />');\n"; echo "write_string('<!--[if !IE]>-->');\n"; echo "write_string('<object type=\"application/x-shockwave-flash\" data=\"" . $configObject->get('cfg_root_path') . "/question/edit/area.swf\" id=\"externalinterfaceq" . $q_no . "_2\" width=\"" . ($q_media_width + 2) . "\" height=\"" . ($q_media_height + 1) . "\">');\n"; echo "write_string('<param name=\"movie\" value=\"" . $configObject->get('cfg_root_path') . "/question/edit/area.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<param name=\"play\" value=\"true\" />');\n"; echo "write_string('<param name=\"loop\" value=\"true\" />');\n"; echo "write_string('<param name=\"wmode\" value=\"opaque\" />');\n"; echo "write_string('<param name=\"scale\" value=\"showall\" />');\n"; echo "write_string('<param name=\"menu\" value=\"true\" />');\n"; echo "write_string('<param name=\"devicefont\" value=\"false\" />');\n"; echo "write_string('<param name=\"salign\" value=\"top\" />');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"sameDomain\" />');\n"; echo "write_string('<!--<![endif]-->');\n"; echo "write_string('<a href=\"https://www.adobe.com/go/getflash\"> <img src=\"https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Get Adobe Flash player\" /></a>');\n"; echo "write_string('<!--[if !IE]>-->');\n"; echo "write_string('</object>');\n"; echo "write_string('<!--<![endif]-->');\n"; echo "write_string('</object>');\n"; echo "sendTextToAS3('{$language}', 'q{$q_no}', 1, '../media/" . $q_media . "', '" . $correct . "', '');\n"; echo "</script>\n<br />"; } ?> <input type="hidden" name="q<?php echo $q_no; ?> " id="q<?php echo $q_no; ?> " /> <?php break; case 'blank': $options[0] = preg_replace("| mark=\"([0-9]{1,3})\"|", "", $options[0]); $options[0] = preg_replace("| size=\"([0-9]{1,3})\"|", "", $options[0]); $blank_details = array(); $blank_details = explode('[blank', $options[0]); $array_size = count($blank_details); $blank_count = 0; while ($blank_count < $array_size) { if (strpos($blank_details[$blank_count], '[/blank]') === false) { echo $blank_details[$blank_count]; } else { $end_start_tag = strpos($blank_details[$blank_count], ']'); $start_end_tag = strpos($blank_details[$blank_count], '[/blank]'); $blank_options = substr($blank_details[$blank_count], $end_start_tag + 1, $start_end_tag - 1); $remainder = substr($blank_details[$blank_count], $start_end_tag + 8); if ($display_method == 'dropdown') { echo '<select>'; $options_array = array(); $options_array = explode(',', $blank_options); $i = 0; foreach ($options_array as $individual_blank_option) { $individual_blank_option = trim($individual_blank_option); if ($i == 0) { echo '<option value="" selected="selected">' . $individual_blank_option . '</option>'; } else { echo '<option value="">' . $individual_blank_option . '</option>'; } $i++; } echo '</select>'; } else { // Correct answer. $correct_options = explode(',', $blank_options); echo '<input type="text" size="10" value="' . $correct_options[0] . '" />'; } echo $remainder; } $blank_count++; } break; case 'calculation': break; case 'dichotomous': $tmp_std_array = explode(',', $std); $std_part = 0; if ($score_method == 'YN_Positive') { $true_label = 'Yes'; $false_label = 'No'; } else { $true_label = 'True'; $false_label = 'False'; } $i = 0; foreach ($options as $individual_option) { $i++; if ($correct_buf[$i - 1] == 't') { echo "<tr><td style=\"font-weight:bold\">{$true_label}</td><td>{$individual_option}</td></tr>\n"; } else { echo "<tr><td style=\"font-weight:bold\">{$false_label}</td><td>{$individual_option}</td></tr>\n"; } } break; case 'labelling': $tmp_std_array = explode(',', $std); $std_part = 0; $tmp_std_array = explode(',', $std); $std_part = 0; $max_col1 = 0; $max_col2 = 0; $tmp_first_split = explode(';', $correct); $tmp_second_split = explode('|', $tmp_first_split[11]); foreach ($tmp_second_split as $ind_label) { $label_parts = explode('$', $ind_label); if (isset($label_parts[4]) and trim($label_parts[4]) != '') { if ($label_parts[0] < 10) { $max_col1 = $label_parts[0]; } else { $max_col2 = $label_parts[0]; } } } $max_col2 -= 10; $max_label = max($max_col1, $max_col2); $tmp_height = $q_media_height; if ($tmp_height < $max_label * 55) { $tmp_height = $max_label * 55; } $correct = str_replace('"', '"', $correct); $correct = str_replace("'", ''', $correct); ?> <div align="center"> <?php require_once '../classes/configobject.class.php'; $configObject = Config::get_instance(); if ($configObject->get('cfg_interactive_qs') == 'html5') { //<!-- ======================== HTML5 part rep disc ================= --> echo "<canvas id='canvas" . $q_no . "' width='" . ($q_media_width + 220) . "' height='" . $tmp_height . "'></canvas>\n"; echo "<br /><div style='width:100%;text-align: left;' id='canvasbox'></div>\n"; echo "<script>\n"; echo "setUpQuestion(" . $q_no . ", 'flash" . $q_no . "', '" . $language . "', '" . $q_media . "', '" . trim($correct) . "', '', '','#FFC0C0','labelling','analysis');\n"; echo "</script>\n"; //<!-- ==================================================== --> } else { echo "<script>\n"; echo "function swfLoaded" . $q_no . "(message) {\n"; echo "var num = message.substring(5,message.length);\n"; echo "setUpFlash(num, message, '" . $language . "', '" . $q_media . "', '" . trim($correct) . "', '','#FFC0C0');}\n"; echo "write_string('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" id=\"flash" . $q_no . "\" width=\"" . ($q_media_width + 250) . "\" height=\"" . $tmp_height . "\" align=\"middle\">');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"always\" />');\n"; echo "write_string('<param name=\"movie\" value=\"" . $configObject->get('cfg_root_path') . "/reports/label_analysis.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<embed src=\"" . $configObject->get('cfg_root_path') . "/reports/label_analysis.swf\" quality=\"high\" bgcolor=\"#ffffff\" width=\"" . ($q_media_width + 250) . "\" height=\"" . $tmp_height . "\" swliveconnect=\"true\" id=\"flash" . $q_no . "\" name=\"flash" . $q_no . "\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" />');\n"; echo "write_string('</object>');\n"; echo "</script>\n"; } ?> </div> <br /> <?php break; case 'hotspot': $tmp_width = $q_media_width + 301; if ($tmp_width < 375) { $tmp_width = 375; } $tmp_height = $q_media_height + 30; ?> <div> <?php if ($configObject->get('cfg_interactive_qs') == 'html5') { //"<!-- ======================== HTML5 part include finf ================= --> echo "<canvas id='canvas" . $q_no . "' width='" . $tmp_width . "' height='" . $tmp_height . "'></canvas>\n"; echo "<br /><div style='width:100%;text-align: left;' id='canvasbox'></div>\n"; echo "<script>\n"; echo "setUpQuestion(" . $q_no . ", 'flash" . $q_no . "', '" . $language . "', '" . $q_media . "', '" . str_replace(' ', ' ', $correct) . "', '', '0,0,0000000000000','#FFC0C0','hotspot','script');\n"; echo "</script>\n"; //<!-- ==================================================== --> } else { echo "<script>\n"; echo "function swfLoaded" . $q_no . "(message) {\n"; echo "var num = message.substring(5,message.length);\n"; echo "setUpFlash(num, message, '" . $language . "', '" . $q_media . "', '" . str_replace(' ', ' ', $correct) . "', '', '1,1,0000000000000','#FFC0C0');}\n"; echo "write_string('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" id=\"flash" . $q_no . "\" width=\"" . $tmp_width . "\" height=\"" . $tmp_height . "\" align=\"middle\">');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"always\" />');\n"; echo "write_string('<param name=\"movie\" value=\"" . $configObject->get('cfg_root_path') . "/paper/hotspot_answer.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<embed src=\"" . $configObject->get('cfg_root_path') . "/paper/hotspot_answer.swf\" quality=\"high\" bgcolor=\"white\" width=\"" . $tmp_width . "\" height=\"" . $tmp_height . "\" swliveconnect=\"true\" id=\"flash" . $q_no . "\" name=\"flash" . $q_no . "\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" />');\n"; echo "write_string('</object>');\n"; echo "</script>\n"; } ?> </div> <?php break; case 'mcq': $i = 0; foreach ($options as $individual_option) { $i++; if ($correct == $i) { echo "<tr><td><input type=\"radio\" checked=\"checked\" /></td><td>{$individual_option}</td></tr>\n"; } else { echo "<tr><td><input type=\"radio\" /></td><td>{$individual_option}</td></tr>\n"; } } break; case 'true_false': if ($correct == 't') { echo "<tr><td><input type=\"radio\" checked=\"checked\" /></td><td>True</td></tr>\n"; echo "<tr><td><input type=\"radio\" /></td><td>False</td></tr>\n"; } else { echo "<tr><td><input type=\"radio\" /></td><td>True</td></tr>\n"; echo "<tr><td><input type=\"radio\" checked=\"checked\" /></td><td>False</td></tr>\n"; } break; case 'mrq': $tmp_std_array = explode(',', $std); $i = 0; $correct_stems = 0; foreach ($options as $individual_option) { $i++; if ($correct_buf[$i - 1] == 'y') { echo "<tr><td><input type=\"checkbox\" checked=\"checked\" /></td><td>{$individual_option}</td></tr>\n"; } else { echo "<tr><td><input type=\"checkbox\" /></td><td>{$individual_option}</td></tr>\n"; } } break; case 'rank': $tmp_std_array = explode(',', $std); $std_part = 0; $rank_no = 0; foreach ($correct_buf as $individual_correct) { if ($individual_correct > $rank_no and $individual_correct < 9990) { $rank_no = $individual_correct; } } $i = 0; foreach ($options as $individual_option) { $i++; echo "<tr><td><select><option value=\"\"></option>"; for ($a = 1; $a <= $rank_no; $a++) { if ($correct_buf[$i - 1] == $a) { echo '<option value="" selected="selected">' . displayRank($a, $string) . '</option>'; } else { echo '<option value="">' . displayRank($a, $string) . '</option>'; } } echo "</select></td><td>{$individual_option}</td></tr>\n"; } break; case 'textbox': $settings = json_decode($settings, true); if (isset($settings['terms'])) { $correct_answers = explode(';', $settings['terms']); foreach ($correct_answers as $single_answer) { $answer_count[$single_answer] = 0; } } break; } if ($q_type != 'info' and $q_type != 'blank' and $q_type != 'labelling' and $q_type != 'hotspot') { echo "</table></p>\n"; } } elseif ($q_type == 'matrix') { $matching_scenarios = explode('|', $scenario); $correct_answers = explode('|', $correct); echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$leadin}\n"; echo '<ol type="i">'; $i = 0; echo '<table cellpadding="2" cellspacing="0" border="1" class="matrix">'; echo "<tr>\n<td colspan=\"2\"> </td>"; foreach ($options as $single_option) { echo '<td>' . $single_option . '</td>'; } echo "<tr>\n"; $row_no = 0; foreach ($matching_scenarios as $single_scenario) { if (trim($single_scenario) != '') { echo "<tr>\n"; echo '<td align="right">' . chr(65 + $row_no) . '.</td><td>' . $single_scenario . '</td>'; $answer_no = 1; $col_no = 1; foreach ($options as $single_option) { if ($correct_answers[$row_no] == $col_no) { echo '<td><div align="center"><input type="radio" name="q' . $q_no . '_' . $row_no . '" value="' . $answer_no . '" checked /></div></td>'; } else { echo '<td><div align="center"><input type="radio" name="q' . $q_no . '_' . $row_no . '" value="' . $answer_no . '" /></div></td>'; } $answer_no++; $col_no++; } echo "</tr>\n"; $row_no++; } } echo '</table>'; echo "</ol>\n</td></tr>\n"; } elseif ($q_type == 'extmatch') { $matching_scenarios = explode('|', $scenario); $matching_media = explode('|', $q_media); $tmp_media_width_array = explode('|', $q_media_width); $tmp_media_height_array = explode('|', $q_media_height); $tmp_answers_array = explode('|', $correct_buf[0]); $tmp_std_array = explode(',', $std); $std_part = 0; array_unshift($matching_scenarios, ''); $max_scenarios = max(count($matching_scenarios), count($matching_media)); $scenario_no = 0; for ($part_id = 1; $part_id < $max_scenarios; $part_id++) { if (isset($matching_scenarios[$part_id]) and trim(strip_tags($matching_scenarios[$part_id], '<img>')) != '' or isset($matching_media[$part_id]) and $matching_media[$part_id] != '') { $scenario_no++; } } echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$leadin}\n<ol type=\"A\">"; if ($matching_media[0] != '') { echo "<div align=\"center\">" . display_media($matching_media[0], $tmp_media_width_array[0], $tmp_media_height_array[0], '') . "</div>\n"; } for ($i = 1; $i <= $scenario_no; $i++) { echo "<li>\n"; if (isset($matching_media[$i]) and $matching_media[$i] != '') { echo "<div>" . display_media($matching_media[$i], $tmp_media_width_array[$i], $tmp_media_height_array[$i], '') . "</div>\n"; } if ($matching_scenarios[$i]) { echo $matching_scenarios[$i] . '<br />'; } $option_no = 1; $specific_answers = array(); $specific_answers = explode('$', $tmp_answers_array[$i - 1]); if (count($specific_answers) > 1) { echo '<select multiple="multiple" size="10">'; } else { echo '<select>'; } foreach ($options as $individual_option) { $answer_match = false; for ($x = 0; $x < count($specific_answers); $x++) { if ($option_no == $specific_answers[$x]) { $answer_match = true; } } if ($answer_match == true) { echo "<option value=\"\" selected=\"selected\">{$individual_option}</option>\n"; } else { echo "<option value=\"\">{$individual_option}</option>\n"; } $option_no++; } echo "</select><br /> </li>\n"; } echo "</ol>\n"; } echo "</td></tr>\n"; // Display comments here. if ($q_type != 'info') { echo displayComments($q_id, $comments, $q_type, $q_no, $reviewer_data, $type, $string, $language); } echo "<tr><td colspan=\"2\"> </td></tr>\n"; }
/** * Recursive function to output the html we need * @param $comments * @param $post */ function displayComments($comments, $post) { foreach ($comments as $comment) { echo '<div class="well">'; echo '<div>'; echo $comment->text . '-' . $comment->user->name . '</div>'; echo '<div>'; if (Auth::check()) { if (Auth::user()->admin) { echo "<form action='/comment/" . $comment->id . "/delete' method='POST'>"; echo csrf_field(); echo method_field('DELETE'); echo "<button type='submit' id='delete-comment-" . $comment->id . "' class='btn btn-danger btn-xs'>"; echo "<i class='fa fa-btn fa-trash'></i> Delete Comment"; echo "</button>"; echo "</form>"; echo "<br>"; } echo '<button id="/comment/' . $post->id . '/' . $comment->id . '" class="btn btn-primary btn-xs"><i class="fa fa-reply"></i> Reply</button> '; echo '<button id="/commend/' . $comment->id . '" class="btn btn-success btn-xs"><i class="fa fa-thumbs-up"></i> Commend (' . $comment->voteCount . ')</button> '; if (Auth::user()->admin) { echo "<a href=" . route('confirmBan', ['userId' => $comment->user->id]) . " class='btn btn-danger btn-xs'><i class='fa fa-ban'></i> Ban User</a> "; } } if ($comment->replies) { displayComments($comment->replies, $post); } echo '</div>'; echo '</div>'; } }
echo $this->FormOpen("processcomment", "", "post", "", "", FALSE, "#comments"); ?> <input type="submit" name="submit" value="<?php echo T_("New Comment"); ?> " /> <?php echo $this->FormClose(); } ?> </div><!--closing commentheader (show)--> <?php // display comments themselves if ($comments) { displayComments($this, $comments, $tag); } } else { echo '<!--starting comments header (hide)-->' . "\n"; echo '<div id="commentheader">' . "\n"; $commentCount = $this->CountComments($this->GetPageTag()); $showcomments_text = ''; // Determine comment ordering preference $comment_ordering = NULL; if (isset($user['default_comment_display'])) { $comment_ordering = $user['default_comment_display']; } elseif (NULL !== $this->GetConfigValue('default_comment_display')) { $comment_ordering = $this->GetConfigValue('default_comment_display'); } // Convert from DB enum to PHP enum switch ($comment_ordering) {
} $first_row = $page * 10; $last_row = $first_row + 10; $all_comments = mysqli_query($connect, "SELECT * FROM Comments"); $comments_counter = mysqli_num_rows($all_comments); $comments = mysqli_query($connect, "SELECT * FROM Comments WHERE CommentID>={$first_row} && CommentID<={$last_row} && Comment<>'' "); $comments_in_page = mysqli_num_rows($comments); $max_pages = floor($comments_counter / 10); if ($comments_counter == 0) { //if there are no comments echo "<p class='comments'> <b>- There are currently no comments -</b> </p>"; } else { if ($comments_counter < 10) { displayComments($comments, $comments_in_page); } else { displayComments($comments, $comments_in_page); if ($page == 0) { echo "<a href='comments.php?page=1' class='paging_button_first'>Next</a>"; } else { if ($page == $max_pages) { $previous_page = $max_pages - 1; echo "<a href='comments.php?page={$previous_page}' class='paging_button'>Previous</a>"; } else { $next_page = $page + 1; $previous_page = $page - 1; echo "<a href='comments.php?page={$previous_page}' class='paging_button'>Previous</a>"; echo "<a href='comments.php?page={$next_page}' class='paging_button'>Next</a>"; } } } }
function displayComments($video, $parent, $i) { $comments = $video->getComments($parent); if (empty($comments)) { ?> <p>Aucun commentaire à propos de cette video</p> <?php } foreach ($comments as $comment) { $comment->comment = Utils::makeLinks(Utils::secure($comment->comment)); $margin = $i * 8; ?> <div style="width: <?php echo 100 - $margin; ?> %; margin-left:<?php echo $margin; ?> %" class="comment" id="c-<?php echo $comment->id; ?> "> <div class="comment-head"> <div class="user"> <img src="<?php echo UserChannel::find($comment->poster_id)->getAvatar(); ?> " alt="[Avatar]"> <a href="<?php echo WEBROOT . 'channel/' . UserChannel::find($comment->poster_id)->name; ?> "><?php echo UserChannel::getNameById($comment->poster_id); ?> </a> </div> <div class="date"> <p><?php echo Utils::relative_time($comment->timestamp); echo $comment->last_updated_timestamp ? ' (Edité ' . Utils::relative_time($comment->last_updated_timestamp) . ')' : ''; ?> </p> </div> </div> <div class="comment-text"> <p style="word-wrap:break-word"><?php echo $comment->comment; ?> </p> </div> <div class="comment-notation"> <ul> <li class="plus" id="plus-<?php echo $comment->id; ?> " onclick="likeComment('<?php echo $comment->id; ?> ')">+<?php echo $comment->likes; ?> </li> <li class="moins" id="moins-<?php echo $comment->id; ?> " onclick="dislikeComment('<?php echo $comment->id; ?> ')">-<?php echo $comment->dislikes; ?> </li> <li onclick="reportComment('<?php echo $comment->id; ?> ', this)" style="cursor:pointer">Signaler</li> <li onclick="document.location.href='#comments';document.getElementById('response').innerHTML='<b>Répondre à <?php echo UserChannel::getNameById($comment->poster_id); ?> :</b>';document.getElementById('textarea-comment').focus();document.getElementById('parent-comment').value='<?php echo $comment->id; ?> ';" style="cursor:pointer">Répondre</li> <?php if (Session::isActive() && (Session::get()->isModerator() || Session::get()->isAdmin() || $comment->getAuthor()->belongToUser(Session::get()->id))) { ?> <li onclick="editComment('<?php echo $comment->id; ?> ', this)" style="cursor:pointer">Editer</li> <?php } ?> <?php if (Session::isActive() && (Session::get()->isModerator() || Session::get()->isAdmin() || $video->getAuthor()->belongToUser(Session::get()->id) || $comment->getAuthor()->belongToUser(Session::get()->id))) { ?> <li onclick="deleteComment('<?php echo $comment->id; ?> ', this)" style="cursor:pointer">Supprimer</li> <?php } ?> </ul> </div> </div> <?php if (Comment::count(array('conditions' => array('parent = ?', $comment->id))) >= 1) { displayComments($video, $comment->id, $i + 1); } } }
$page_num = 1; $page_num = $_GET['page']; //get variable for page number $page_num--; //so the $index can be calculated easier while keeping [1,n] page numbers $limit = 3; //number of items per page $index = $page_num * $limit; } else { //only do the limit $limit = 3; } if (isset($_GET['id'])) { $news_id = $_GET['id']; displayNews(getNews($news_id)); displayComments(getNewsComments($news_id)); return; } else { if (defined('INDEX_MODULE')) { $news = getNews(null, $limit, $index); displayNews($news, true); OpenContent(); ?> <div style="float:right;"> <a href="?load=news">Read All</a> </div> <?php } else { $news = getNews(null, $limit, $index); OpenContent();
<div id="left"> <img src="butterfly.jpg"> </div> <div id="right"> <p>A spring favorite! This fun soap is a great addition to a child's bath time - they'll love washing with the cute butterfly, and everyone will enjoy the soothing scent of lavendar and vanilla that accompanies these suds. <p><b>Price: $4.99</b> <p><form action="cart.php?action=butterfly" method="POST"> Quantity: <input type="number" min="0" name="num" id="value"><div id="display"><input type="submit" value="Add to cart"></div> </form> </div> <div id="commentdiv"> <center><h4>Comments</h4></center> <?php $where = 'butterfly'; displayComments($where); ?> </div> <!--form should only appear if the user is logged in - no anonymous comments allowed--> <div id="commentform"> <?php if (isset($_SESSION['username'])) { echo '<p><i>We love feedback! Feel free to leave a comment:</i> <form action="comment.php" method="POST"> <p>Name: ' . $_SESSION['name']; echo '<p>Comment: <br><textarea rows="8" cols="30" maxlength="255" name="comment" id="comment"></textarea> <input type="hidden" name="wherefrom" id="wherefrom" value="butterfly"> <br><input type="submit" value="Submit"> </form>';
/** * displayYouTubeVideoPage * * @param array $video * * @return void */ function displayYouTubeVideoPage($video) { $this->displayHeader(); // Video not found in db if (!is_array($video)) { echo ' <div class="info-alert"> <h2>' . T_('Missing or Invalid Video.') . '</h2> <p>' . T_('This video cannot be found. Are you sure you typed in URL correctly?') . '</p> </div>'; $this->displayFooter(); return; } elseif ($video['source_id'] == '0') { $this->displayVideoNotFound($video, 'YouTube'); return; } // Save video id for ajax call $_SESSION['source_id'] = $video['source_id']; $url = 'video.php?u=' . $video['created_id'] . '&id=' . $video['id']; $views = T_('Unknown'); // Get authed google client $googleClient = getAuthedGoogleClient($this->fcmsUser->id); // If this user has a google account setup, we should get a google client in return // so go ahead and do googly/youtuby stuff if ($googleClient !== false) { // Get video entry try { $youtube = new Google_Service_YouTube($googleClient); $videoEntry = $youtube->videos->listVideos('id,snippet,status,contentDetails,processingDetails,statistics', array('id' => $video['source_id'])); } catch (Exception $e) { $this->fcmsError->add(array('type' => 'operation', 'message' => 'Could not search YouTube.', 'error' => $e, 'file' => __FILE__, 'line' => __LINE__)); $this->fcmsError->displayError(); $this->displayFooter(); return; } // Make sure we found the video first if (!isset($videoEntry['items'][0])) { $this->displayVideoNotFound($video, 'YouTube'); $this->displayFooter(); return; } $status = $videoEntry['items'][0]['status']['uploadStatus']; $views = $videoEntry['items'][0]['statistics']['viewCount']; // Let's handle all the upload statuses if ($status === 'deleted') { $this->displayVideoNotFound($video, 'YouTube'); $this->displayFooter(); return; } else { if ($status === 'failed') { // TODO echo '<h1>FAILED</h1>'; $this->displayFooter(); return; } else { if ($status === 'rejected') { $reason = $videoEntry['items'][0]['status']['rejectionReason']; echo ' <div class="info-alert"> <p><b>' . T_('This video was Rejected by YouTube') . '</b></p> <p>' . T_('Rejection reason:') . ' ' . $reason . '</p> <p>' . T_('Would you like to delete this video?') . '</p> <form action="' . $url . '" method="post"> <input type="hidden" id="id" name="id" value="' . $video['id'] . '"/> <input type="hidden" id="source_id" name="source_id" value="' . $video['source_id'] . '"/> <input class="sub1" type="submit" id="delete_video" name="delete_video" value="' . T_('Yes') . '"/> ' . T_('or') . ' <a href="video.php">' . T_('No') . '</a> </form> </div>'; $this->displayFooter(); return; } else { if ($status === 'uploaded') { $percentComplete = 0; $steps = array('fileDetailsAvailability', 'processingIssuesAvailability', 'tagSuggestionsAvailability', 'editorSuggestionsAvailability', 'thumbnailsAvailability'); foreach ($steps as $step) { if ($videoEntry['items'][0]['processingDetails'][$step] === 'available') { $percentComplete += 20; } } $message = $percentComplete; echo ' <div class="ok-alert"> <p><b>' . T_('This video was uploaded to YouTube successfully.') . '</b></p> <p>' . T_('However it may take a few moments before you video is viewable. Please check back later.') . '</p> <p> ' . T_('Percentage complete:') . ' <span id="current_complete">' . $percentComplete . '%</span> </p> <p id="js_msg"></p> <p id="refresh"><a href="' . $url . '">' . T_('Refresh') . '</a></p> </div>'; $this->displayFooter(); return; } } } } } $videoUrl = 'http://www.youtube.com/e/' . $video['source_id'] . '?version=3&enablejsapi=1&rel=0&wmode=transparent'; $this->displayVideoStartCode(); echo ' <div id="sections_menu"> <ul> <li><a href="video.php">' . T_('Latest Videos') . '</a></li> <li><a href="video.php?u=' . $video['created_id'] . '">' . getUserDisplayName($video['created_id'], 2) . '</a></li> </ul> </div>'; // Can you edit/delete this video? if ($video['created_id'] == $this->fcmsUser->id || $this->fcmsUser->access == 1) { echo ' <div id="video_edit"> <form action="' . $url . '" method="post"> <div id="delete"> <input type="hidden" id="id" name="id" value="' . $video['id'] . '"/> <input type="hidden" id="source_id" name="source_id" value="' . $video['source_id'] . '"/> <input class="btn" type="submit" id="remove_video" name="remove_video" value="' . T_('Remove Video') . '"/> <label for="delete_youtube">' . T_('Delete from YouTube?') . '</label> <input type="checkbox" id="delete_youtube" name="delete_youtube"/> </div> </form> </div>'; } echo ' <div id="video_desc"> <img src="' . getCurrentAvatar($video['created_id']) . '"/> <h2>' . cleanOutput($video['title']) . '</h2> <p>' . cleanOutput($video['description']) . '</p> </div> <div id="video_content"> <iframe class="youtube-player" type="text/html" width="854" height="480" src="http://www.youtube.com/embed/' . $video['source_id'] . '" allowfullscreen frameborder="0"> </iframe> </div>'; echo '<p>' . T_('Views') . ': ' . cleanOutput($views) . '</p>'; $params = array('id' => $video['id']); displayComments($url, 'video', $params); $this->displayFooter(); }
echo "<br />"; echo "<div class='priority'>"; displayPuzzPriority($uid, $pid); echo "</div>"; echo "<br />"; echo "<div class='markasunseen'>"; displayMarkAsUnseen($uid, $pid); echo "</div>"; echo "<br />"; echo "<div class='killpuzzle'>"; displayKillPuzzle($uid, $pid); echo "</div>"; // Display & add comments echo "<div class='comments'>"; echo "<table>"; displayComments($uid, $pid, $lastVisit); addCommentForm($uid, $pid); emailSubButton($uid, $pid); echo "</table>"; echo "</div>"; // End HTML foot(); //------------------------------------------------------ function displayPuzzleInfo($uid, $pid, $puzzleInfo) { $title = nl2br2($puzzleInfo['title']); if ($title == NULL) { $title = '(untitled)'; } $summary = nl2br2($puzzleInfo['summary']); if ($summary == NULL) {
function showPic() { global $db, $prefix, $iConfig, $moduleName, $user; $picturesPath = $iConfig['pictures_path']; $popCount = intval($iConfig['pop_count']); //$inlineJS = ''; AddJSToHead('includes/jquery/jquery.js', 'file'); AddJSToHead('modules/' . $moduleName . '/includes/jquery/jquery.MetaData.js', 'file'); AddJSToHead('modules/' . $moduleName . '/includes/jquery/jquery.rating.js', 'file'); AddCSSToHead('modules/' . $moduleName . '/includes/jquery/jquery.rating.css', 'file'); //AddJSToHead( $inlineJS,'inline' ); galleryHeader(); echo '<div id="show-picture-wrapper">' . PHP_EOL; $pictureId = $_GET['pictureid']; $picture = $db->sql_fetchrow($db->sql_query('SELECT * FROM ' . $prefix . '_igallery_pictures WHERE picture_id=' . $pictureId . ' LIMIT 0,1')); $filename = $picture['picture_file']; $albumId = $picture['album_id']; $pictureTitle = $picture['picture_title']; $pictureType = $picture['picture_type']; $description = $picture['picture_desc']; $counter = $picture['picture_counter']; $dateAdded = $picture['picture_date']; $userId = $picture['picture_userid']; $album = $db->sql_fetchrow($db->sql_query('SELECT album_title, album_folder FROM ' . $prefix . '_igallery_albums WHERE album_id=\'' . $albumId . '\' LIMIT 0,1')); $albumTitle = $album['album_title']; $folderName = $album['album_folder']; showTopLinks($albumId, $pictureId); echo '<br /><br />' . PHP_EOL; picTopMenu($pictureId, $albumId); echo '<div id="show-pic">' . PHP_EOL; echo ' ' . showNewEmblem($dateAdded) . showPopEmblem($counter, $popCount) . '<br />' . PHP_EOL; echo ' <img class="show-pic" src="modules.php?name=' . $moduleName . '&op=getImg&pictureid=' . $pictureId . '" alt="' . $filename . '" title="' . $pictureTitle . '" />' . PHP_EOL; echo '</div>' . PHP_EOL; echo '<div class="content-box"><b>' . $pictureTitle . '</b>: ' . $description . '</div>' . PHP_EOL; showDetails($pictureId); echo '<br />' . PHP_EOL; echo '<div id="comment-button"><button>' . _IG_POSTCOMMENT . '</button></div>' . PHP_EOL; commentForm($pictureId); echo '<script type="text/javascript">//<![CDATA[' . PHP_EOL; echo ' $("button").click(function () {' . PHP_EOL; echo ' $("#post-comment").show("slow");' . PHP_EOL; echo ' });' . PHP_EOL; echo '//]]></script>' . PHP_EOL; displayComments($pictureId); echo '</div>' . PHP_EOL; galleryFooter(); }
if ($msgError) { echo "<p class=\"error\">{$msgError}.</p>"; } else { echo "<p class=\"error\">" . T_("Error when adding the comment") . ".</p>"; } } } $pageUrl = "tags.php?tag=" . $tagName; $bookmarks = getSingleBookmark($bookmarkID); //Display the bookmark $displayUser = true; $displayDivs = true; include 'templates/publicb.tpl.php'; //Display the comments if any $comments = getComments($bookmarkID); $displayCommentsStr = displayComments($comments); echo "<div class=\"commentContent\">"; if ($displayCommentsStr) { echo "<b>" . T_("Comments") . "</b>{$displayCommentsStr}"; } else { echo "<b>" . T_("No comments for this bookmark") . ".</b>"; } echo "<br>"; //If a member, can add or reply to a news $access = checkAccess('n', 't'); if ($access) { ?> <br> <div class="submitComment"> <b><?php echo T_("Submit a comment");