/** * @brief display links of category * @global type $is_editor * @global type $course_id * @global type $urlview * @global type $tool_content * @global type $urlServer * @global type $course_code * @global type $langLinkDelconfirm * @global type $langDelete * @global type $langUp * @global type $langDown * @global type $langEditChange * @global type $is_in_tinymce * @param type $catid */ function showlinksofcategory($catid) { global $is_editor, $course_id, $urlview, $socialview_param, $tool_content, $urlServer, $course_code, $langLinkDelconfirm, $langDelete, $langUp, $langDown, $langEditChange, $is_in_tinymce, $links_num, $langLinkSubmittedBy; $tool_content .= "<tr>"; $result = Database::get()->queryArray("SELECT * FROM `link` WHERE course_id = ?d AND category = ?d ORDER BY `order`", $course_id, $catid); $numberoflinks = count($result); $links_num = 1; foreach ($result as $myrow) { $title = empty($myrow->title) ? $myrow->url : $myrow->title; $aclass = ($is_in_tinymce) ? " class='fileURL' " : ''; $tool_content .= "<td class='nocategory-link'><a href='" . q($myrow->url) . "' $aclass target='_blank'>" . q($title) . " <i class='fa fa-external-link' style='color:#444'></i></a>"; if ($catid == -2 && $myrow->user_id != 0) { $tool_content .= "<small> - $langLinkSubmittedBy ".display_user($myrow->user_id, false, false)."</small>"; } if (!empty($myrow->description)) { $tool_content .= "<br />" . standard_text_escape($myrow->description); } if ($catid == -2) { //social bookmarks can be rated global $uid; $rating = new Rating('thumbs_up', 'link', $myrow->id); $tool_content .= $rating->put($is_editor, $uid, $course_id); } $tool_content .= "</td>"; if ($is_editor && !$is_in_tinymce) { $tool_content .= "<td class='option-btn-cell'>"; $editlink = "$_SERVER[SCRIPT_NAME]?course=$course_code&action=editlink&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param; if (isset($category)) { $editlink .= "&category=" . getIndirectReference($category); } $tool_content .= action_button(array( array('title' => $langEditChange, 'icon' => 'fa-edit', 'url' => $editlink), array('title' => $langUp, 'level' => 'primary', 'icon' => 'fa-arrow-up', 'disabled' => $links_num == 1, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&urlview=$urlview&up=" . getIndirectReference($myrow->id) . $socialview_param, ), array('title' => $langDown, 'level' => 'primary', 'icon' => 'fa-arrow-down', 'disabled' => $links_num >= $numberoflinks, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&urlview=$urlview&down=" . getIndirectReference($myrow->id) . $socialview_param, ), array('title' => $langDelete, 'icon' => 'fa-times', 'class' => 'delete', 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&action=deletelink&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param, 'confirm' => $langLinkDelconfirm) )); $tool_content .= "</td>"; } elseif ($catid == -2 && !$is_in_tinymce) { if (isset($_SESSION['uid'])) { if (is_link_creator($myrow->id)) { $tool_content .= "<td class='option-btn-cell'>"; $editlink = "$_SERVER[SCRIPT_NAME]?course=$course_code&action=editlink&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param; $tool_content .= action_button(array( array('title' => $langEditChange, 'icon' => 'fa-edit', 'url' => $editlink), array('title' => $langDelete, 'icon' => 'fa-times', 'class' => 'delete', 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&action=deletelink&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param, 'confirm' => $langLinkDelconfirm) )); $tool_content .= "</td>"; } else { if (abuse_report_show_flag('link', $myrow->id , $course_id, $is_editor)) { $flag_arr = abuse_report_action_button_flag('link', $myrow->id, $course_id); $tool_content .= "<td class='option-btn-cell'>".action_button(array($flag_arr[0])).$flag_arr[1]."</td>"; //action button option } else { $tool_content .= "<td> </td>"; } } } } $tool_content .= "</tr>"; $links_num++; } }
array('title' => $langModify, 'url' => "editpost.php?course=$course_code&post_id=" . $myrow->id . "&topic=$topic&forum=$forum", 'icon' => 'fa-edit' ), array('title' => $langDelete, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&post_id=$myrow->id&topic=$topic&forum=$forum&delete=on", 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langConfirmDelete) ); if ($topic_locked != 1) { $dyntools[] = array('title' => $langForumPostReply, 'url' => "reply.php?course=$course_code&topic=$topic&forum=$forum&parent_post=$myrow->id", 'icon' => 'fa-reply'); } if (abuse_report_show_flag('forum_post', $myrow->id, $course_id, $is_editor)) { $flag_arr = abuse_report_action_button_flag('forum_post', $myrow->id, $course_id); $dyntools[] = $flag_arr[0]; //action button option $report_modal = $flag_arr[1]; //modal html code } if (!empty($dyntools)) { if (isset($report_modal)) { $tool_content .= "<td valign='center'>" . action_button($dyntools) . $report_modal . "</td>"; unset($report_modal); } else { $tool_content .= "<td valign='center'>" . action_button($dyntools) . "</td>"; } } $tool_content .= "</tr>"; $count++;
/** * Injects all commenting module code in other subsystems * @param courseCode the course code * @param $isEditor * @param $uid the user id * @return string */ public function put($courseCode, $isEditor, $uid, $always_open = false) { global $langComments, $langBlogPostUser, $langSubmit, $themeimg, $langModify, $langDelete, $langCommentsDelConfirm, $langCommentsSaveConfirm, $urlServer, $head_content; //$head_content .= '<link rel="stylesheet" type="text/css" href="'.$urlServer.'modules/comments/style.css">'; $commentsNum = $this->getCommentsNum(); if (!$always_open) { $comments_title = "<button type='button' class='btn btn-primary' data-toggle='modal' data-target='#commentArea-$this->rid'>$langComments (<span id='commentsNum-$this->rid'>$commentsNum</span>)</button>"; $out = "$comments_title <div class='modal fade' id='commentArea-$this->rid' role='dialog'> <div class='modal-dialog modal-lg'> <div class='modal-content' style='padding:1%'> <div class='modal-header'> <button type='button' class='close' data-dismiss='modal'>×</button> <h4 class='modal-title'>$langComments</h4> </div> <div class='modal-body' id='comments-$this->rid'>"; } else { $comments_title = "<h3 id='comments_title'>$langComments (<span id='commentsNum-$this->rid'>$commentsNum</span>)</h3><br>"; $out = "<div class='commenting'> $comments_title <div class='commentArea' id='commentArea-$this->rid'> <div id='comments-$this->rid'>"; } if ($commentsNum != 0) { //retrieve comments $comments = $this->getCommentsDB(); foreach ($comments as $comment) { if (is_null($courseCode)) { //for the case of personal blog posts comments if (isset($_SESSION['uid']) && ($isEditor || ($comment->getAuthor() == $uid))) { //$isEditor corresponds to blog editor $post_actions = '<div class="pull-right">'; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments_perso_blog.php\', \'editLoad\', '.$this->rid.', \''.$this->rtype.'\', \'\', '.$comment->getId().')">'; $post_actions .= icon('fa-edit', $langModify).'</a> '; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments_perso_blog.php\', \'delete\', '.$this->rid.', \''.$this->rtype.'\', \''.$langCommentsDelConfirm.'\', '.$comment->getId().')">'; $post_actions .= icon('fa-times', $langDelete).'</a>'; $post_actions .='</div>'; } else { $post_actions = ''; } } else { if ($comment->permEdit($isEditor, $uid)) { $post_actions = '<div class="pull-right">'; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments.php?course='.$courseCode.'\', \'editLoad\', '.$this->rid.', \''.$this->rtype.'\', \'\', '.$comment->getId().')">'; $post_actions .= icon('fa-edit', $langModify).'</a> '; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments.php?course='.$courseCode.'\', \'delete\', '.$this->rid.', \''.$this->rtype.'\', \''.$langCommentsDelConfirm.'\', '.$comment->getId().')">'; $post_actions .= icon('fa-times', $langDelete).'</a>'; if (abuse_report_show_flag('comment', $comment->getId(), course_code_to_id($courseCode), $isEditor)) { $post_actions .= abuse_report_icon_flag ('comment', $comment->getId(), course_code_to_id($courseCode)); } $post_actions .='</div>'; } else { if (abuse_report_show_flag('comment', $comment->getId(), course_code_to_id($courseCode), $isEditor)) { $post_actions = '<div class="pull-right">'.abuse_report_icon_flag ('comment', $comment->getId(), course_code_to_id($courseCode)).'</div>'; } else { $post_actions = ''; } } } $out .= "<div class='row margin-bottom-thin margin-top-thin comment' id='comment-".$comment->getId()."'> <div class='col-xs-12'> <div class='media'> <a class='media-left' href='#'> ". profile_image($comment->getAuthor(), IMAGESIZE_SMALL) ." </a> <div class='media-body bubble'> <div class='label label-success media-heading'>".nice_format($comment->getTime(), true).'</div>'. "<small>".$langBlogPostUser.display_user($comment->getAuthor(), false, false)."</small>". $post_actions ."<div class='margin-top-thin' id='comment_content-".$comment->getId()."'>". q($comment->getContent()) ."</div> </div> </div> </div> </div>"; } } $out .= "</div>"; if (is_null($courseCode)) { //for the case of personal blog posts comments if (isset($_SESSION['uid'])) { $out .= '<form action="" onsubmit="xmlhttpPost(\''.$urlServer.'modules/comments/comments_perso_blog.php\', \'new\','.$this->rid.', \''.$this->rtype.'\', \''.$langCommentsSaveConfirm.'\'); return false;">'; $out .= '<textarea class="form-control" name="textarea" id="textarea-'.$this->rid.'" rows="5"></textarea><br/>'; $out .= '<input class="btn btn-primary" name="send_button" type="submit" value="'.$langSubmit.'" />'; $out .= '</form>'; } } else { if (Commenting::permCreate($isEditor, $uid, course_code_to_id($courseCode))) { $out .= '<form action="" onsubmit="xmlhttpPost(\''.$urlServer.'modules/comments/comments.php?course='.$courseCode.'\', \'new\','.$this->rid.', \''.$this->rtype.'\', \''.$langCommentsSaveConfirm.'\'); return false;">'; $out .= '<textarea class="form-control" name="textarea" id="textarea-'.$this->rid.'" rows="5"></textarea><br/>'; $out .= '<input class="btn btn-primary" name="send_button" type="submit" value="'.$langSubmit.'" />'; $out .= '</form>'; } } if (!$always_open) { $out .= '<div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div>'; $out .= '</div>'; } $out .= '</div>'; $out .= '</div>'; return $out; }
require_once '../../include/baseTheme.php'; require_once 'modules/abuse_report/abuse_report.php'; require_once 'modules/dropbox/class.msg.php'; $rtype = $_POST['rtype']; $rid = intval($_POST['rid']); $cid = intval($_POST['cid']); $reason = $_POST['abuse_report_reason']; $msg = trim($_POST['abuse_report_msg']); if (empty($rtype) OR empty($rid) OR empty($cid)) { exit; } if (abuse_report_show_flag ($rtype, $rid, $cid, false)) { $response = array(); if(empty($reason)) { $response[0] = 'fail'; $response[1] = '<p class="text-danger">'.$langAbuseReportCatError.'</p><form id="abuse_form_'.$rtype.'_'.$rid.'"> <fieldset> <div class="form-group has-error"> <label for="abuse_form_select'.$rtype.'_'.$rid.'">'.$langAbuseReportCat.'</label> <select class="form-control" name="abuse_report_reason" id="abuse_form_select'.$rtype.'_'.$rid.'"> <option value="rudeness">'.$langRudeness.'</option> <option value="spam">'.$langSpam.'</option> <option value="other">'.$langOther.'</option> </select> </div>