public static function getCommentIDsFromAddon($aid, $offset = 0, $limit = 15, $sort = 0) { $cacheString = serialize(["aid" => $aid, "offset" => $offset, "limit" => $limit, "sort" => $sort]); $database = new DatabaseManager(); CommentManager::verifyTable($database); $query = "SELECT * FROM `addon_comments` WHERE `aid` = '" . $database->sanitize($aid) . "' ORDER BY "; switch ($sort) { case CommentManager::$SORTDATEASC: $query .= "`timestamp` ASC"; break; case CommentManager::$SORTDATEDESC: $query .= "`timestamp` DESC"; break; default: $query .= "`timestamp` ASC"; } $query .= " LIMIT " . $database->sanitize($offset) . ", " . $database->sanitize($limit); $resource = $database->query($query); if (!$resource) { throw new Exception("Database error: " . $database->error()); } $addonComments = []; while ($row = $resource->fetch_object()) { $addonComments[] = CommentManager::getFromID($row->id, $row)->getID(); } $resource->close(); return $addonComments; }
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 1/26/09 */ public function visitBlock(BlockSiteComponent $siteComponent) { $view = new Participation_View($siteComponent); $idMgr = Services::getService('Id'); $azMgr = Services::getService('AuthZ'); // get create actions if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $siteComponent->getQualifierId()) == TRUE) { $this->_actions[] = new Participation_CreateAction($view, $siteComponent); } // get comment actions $commentsManager = CommentManager::instance(); $comments = $commentsManager->getAllComments($siteComponent->getAsset(), DESC); while ($comments->hasNext()) { $comment = $comments->next(); if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.comment'), $siteComponent->getQualifierId()) == TRUE) { $this->_actions[] = new Participation_CommentAction($view, $comment); } } // get history actions $pluginManager = Services::getService('PluginManager'); $plugin = $pluginManager->getPlugin($siteComponent->getAsset()); if ($plugin->supportsVersioning()) { $versions = $plugin->getVersions(); $firstVersion = 0; foreach ($versions as $version) { if ($version->getNumber() != 1) { if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $siteComponent->getQualifierId()) == TRUE) { $this->_actions[] = new Participation_HistoryAction($view, $siteComponent, $version); } } } } }
/** * Answer the comment object * * @return object * @access public * @since 7/11/07 */ function getComment() { $idManager = Services::getService("Id"); $commentId = $idManager->getId(RequestContext::value('comment_id')); $commentManager = CommentManager::instance(); return $commentManager->getComment($commentId); }
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 8/31/07 */ public function visitBlock(BlockSiteComponent $siteComponent) { // check to see if user is authorized to view block $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_comments"), $idManager->getId($siteComponent->getId()))) { return; } $harmoni = Harmoni::instance(); //get all comments for site component $commentsManager = CommentManager::instance(); $comments = $commentsManager->getAllComments($siteComponent->getAsset()); while ($comments->hasNext()) { $comment = $comments->next(); $item = $this->addItem(new RSSItem()); $item->setTitle($comment->getSubject()); $item->setLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId())) . "#comment_" . $comment->getIdString(), true); $item->setPubDate($comment->getModificationDate()); $agentMgr = Services::getService("Agent"); $agent = $comment->getAuthor(); $item->setAuthor($agent->getDisplayName()); $item->setCommentsLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId()))); $pluginMgr = Services::getService("PluginManager"); $plugin = $pluginMgr->getPlugin($comment->getAsset()); $item->setDescription($plugin->executeAndGetMarkup()); // MediaFile eclosures. try { foreach ($plugin->getRelatedMediaFiles() as $file) { $item->addEnclosure($file->getUrl(), $file->getSize()->value(), $file->getMimeType()); } } catch (UnimplementedException $e) { } } }
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 8/31/07 */ public function visitBlock(BlockSiteComponent $siteComponent) { $cm = CommentManager::instance(); if ($cm->getNumComments($siteComponent->getAsset())) { return 1; } else { return 0; } }
public static function loadBasicDummyData() { TestManager::clearDatabase(); $database = new DatabaseManager(); UserManager::verifyTable($database); AddonManager::verifyTable($database); BoardManager::verifyTable($database); TagManager::verifyTable($database); GroupManager::verifyTable($database); DependencyManager::verifyTable($database); CommentManager::verifyTable($database); RatingManager::verifyTable($database); BuildManager::verifyTable($database); StatManager::verifyTable($database); ScreenshotManager::verifyTable($database); if (!$database->query("INSERT INTO `addon_boards` (name, video, description) VALUES ('General Content', 'general_content_bg', 'Bricks, Events, Sounds, Prints, Environments, and much more!')")) { throw new Exception("Database error: " . $database->error()); } if (!$database->query("INSERT INTO `addon_boards` (name, video, description) VALUES ('Minigames', 'minigames_bg', 'Weapons, Vehicles, Gamemodes, and all your gaming needs!')")) { throw new Exception("Database error: " . $database->error()); } if (!$database->query("INSERT INTO `addon_boards` (name, video, description) VALUES ('Client Mods', 'client_mods_bg', 'Mods that run on your client.')")) { throw new Exception("Database error: " . $database->error()); } if (!$database->query("INSERT INTO `addon_boards` (name, video, description) VALUES ('Bargain Bin', 'bargain_bin_bg', 'A home for \\'special\\' content.')")) { throw new Exception("Database error: " . $database->error()); } if (!$database->query("INSERT INTO `users` (username, blid, password, email, salt, verified) VALUES ('testuser', '4833', '1d8436e97ef95a7a6151f47b909167c77cfe1985ee5500efa8d46cfe825abc59', '*****@*****.**', '273eb4', '1')")) { throw new Exception("Database error: " . $database->error()); } //the default json types likely need to be reworked if (!$database->query("INSERT INTO `addon_addons` (board, blid, name, filename, description, approved, versionInfo, authorInfo, reviewInfo) VALUES ('1', '4833', 'crapy adon', 'sciprt_hax.zip', 'bad addone pls delete', '1', '{}', '[]', '[]')")) { throw new Exception("Database error: " . $database->error()); } StatManager::addStatsToAddon(1); if (!$database->query("INSERT INTO `addon_tags` (name, base_color, icon) VALUES ('dum tag', 'ff6600', 'brokenimage')")) { throw new Exception("Database error: " . $database->error()); } if (!$database->query("INSERT INTO `addon_tagmap` (aid, tid) VALUES ('1', '1')")) { throw new Exception("Database error: " . $database->error()); } if (!$database->query("INSERT INTO `group_groups` (leader, name, description, color, icon) VALUES ('4833', 'legion of dumies', 'a group for people who just want to be in a group', '00ff00', 'brokenimage')")) { throw new Exception("Database error: " . $database->error()); } if (!$database->query("INSERT INTO `group_usermap` (gid, blid, administrator) VALUES ('1', '4833', '1')")) { throw new Exception("Database error: " . $database->error()); } if (!$database->query("INSERT INTO `addon_comments` (blid, aid, comment) VALUES ('4833', '1', 'glorious addon comrade')")) { throw new Exception("Database error: " . $database->error()); } if (!$database->query("INSERT INTO `addon_ratings` (blid, aid, rating) VALUES ('4833', '1', '1')")) { throw new Exception("Database error: " . $database->error()); } }
/** * Visit a block and return the resulting GUI component. * * @param object BlockSiteComponent $block * @return object Component * @access public * @since 4/3/06 */ function visitTargetBlock() { $block = $this->_node; $guiContainer = parent::visitBlock($block); if ($guiContainer && $block->showComments()) { $commentManager = CommentManager::instance(); $guiContainer->add(new Heading($commentManager->getHeadingMarkup($block->getAsset()), 3), $block->getWidth(), null, null, TOP); $guiContainer->add(new Block($commentManager->getMarkup($block->getAsset()), STANDARD_BLOCK), $block->getWidth(), null, null, TOP); } return $guiContainer; }
public function __construct($title, $content, $receiver, $id_author, $my_picture, $id, $date, $likes) { $this->title = $title; $this->content = $content; $this->id_receiver = $receiver; $this->id_author = $id_author; $this->picture = $my_picture; $this->id = $id; $this->date = $date; $this->likes = $likes; $this->comments_number = CommentManager::get_comments_number($id); $this->comments = new CommentFactory($id); }
public function __construct($id_article) { $s_comments = CommentManager::get_comments_by_article($id_article); $this->size = count($s_comments); $t_size = $this->size; for ($i = 0; $i < $t_size; $i++) { $current_comment = $s_comments[$i]; $id_article = $current_comment['id_article']; $pseudo = $current_comment['pseudo']; $content = $current_comment['content']; $this->comments[$i] = new Comment($id_article, $pseudo, $content); } }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function execute() { $harmoni = Harmoni::instance(); // Get the plugin asset id $harmoni->request->startNamespace('plugin_manager'); $id = RequestContext::value('plugin_id'); if (RequestContext::value('extended') == 'true') { $showExtended = true; } else { $showExtended = false; } $harmoni->request->endNamespace(); // Get the plugin asset object $repositoryManager = Services::getService("Repository"); $idManager = Services::getService("Id"); // $repository = $repositoryManager->getRepository( // $idManager->getId("edu.middlebury.segue.sites_repository")); // // $asset = $repository->getAsset($idManager->getId($id)); // // // $pluginManager = Services::getService("Plugs"); // // $plugin = $pluginManager->getPlugin($asset); // // // // $plugin->setUpdateAction('comments', 'update_ajax'); $commentManager = CommentManager::instance(); $comment = $commentManager->getComment($idManager->getId($id)); header("Content-type: text/xml"); print "<plugin>\n"; if (!is_object($comment)) { print "\t<markup>\n\t\t<![CDATA["; print $comment; print "]]>\n\t</markup>\n"; } else { $markup = $comment->getBody(); print "\t<markup>\n\t\t<![CDATA["; // CDATA sections cannot contain ']]>' and therefor cannot be nested // get around this by replacing the ']]>' tags in the markup. print preg_replace('/\\]\\]>/', '}}>', $markup); print "]]>\n\t</markup>\n"; } print "</plugin>"; exit; }
<?php /*$_GET['aid'] = $_REQUEST['id']; $comments = include(dirname(__DIR__) . "/../../../private/json/getPageCommentsWithUsers.php"); echo json_encode($comments, JSON_PRETTY_PRINT);*/ require_once dirname(__DIR__) . "/../../../private/class/AddonManager.php"; require_once dirname(__DIR__) . "/../../../private/class/CommentManager.php"; $aid = $_REQUEST['id']; if (!isset($_REQUEST['page'])) { $page = 0; } else { $page = $_REQUEST['page']; } $addonObject = AddonManager::getFromID($aid); $ret = array(); $start = $page * 10; $comments = CommentManager::getCommentIDsFromAddon($addonObject->getId(), $start, 10); foreach ($comments as $comid) { $comment = CommentManager::getFromId($comid); $commento = new stdClass(); $commento->id = $comment->getId(); $commento->author = UserLog::getCurrentUsername($comment->getBLID()); $commento->authorblid = $comment->getBlid(); $text = str_replace("\r\n", "<br>", $comment->getComment()); $text = str_replace("\n", "<br>", $text); $commento->text = $text; $commento->date = date("F j, g:i a", strtotime($comment->getTimeStamp())); $ret[] = $commento; } echo json_encode($ret, JSON_PRETTY_PRINT);
echo "Error has occured while drop table Comment</p>"; } //********************* // CREATE TABLE //********************* echo "<p>Creating table...</p>"; echo "<p>"; // Create User table if (UserManager::CreateTable()) { echo "Created <b>User</b> table<br/>"; } else { echo "Error has occured while create table User<br/>"; } // Create Xclam table if (XclamManager::CreateTable()) { echo "Created <b>Xclam</b> table<br/>"; } else { echo "Error has occured while create table Xclam<br/>"; } // Create Comment table if (CommentManager::CreateTable()) { echo "Created <b>Comment</b> table<br/>"; } else { echo "Error has occured while create table Comment<br/>"; } echo "</p>"; echo "<p>Finish.</p>"; ?> </body> </html>
public function process($parameters) { $articleManager = new ArticleManager(); $userManager = new UserManager(); $commentManager = new CommentManager(); $validation = new Validation(); $user = $userManager->returnUser(); $this->data['admin'] = $user['admin']; //ak je zadane URL pre clanok, uloz clanok do premennej $article if (!empty($parameters[0]) && $parameters[0] != 'page' && $parameters[0] != 'unpublished') { $article = $articleManager->returnArticle($parameters[0]); } //nie je zadane url clanku, tak vypise zoznam clankov if (empty($parameters[0])) { $articles = $articleManager->returnPublicArticles(0); $this->data['articles'] = $validation->statusOfArticles($articles); //zisti pocet clankov, a pripravi pocet stran $countArticles = sizeof($articles); $modulo = $countArticles % 5; if ($modulo == 0) { $this->data['pages'] = $countArticles / 5; } else { $this->data['pages'] = intval($countArticles / 5 + 1); } $this->data['currentPage'] = 1; //aktualna strana $this->view = 'articles'; } //ak je zadane URL pre zobrazenie nepublikovanych clankov if (!empty($parameters[0]) && $parameters[0] == 'unpublished') { $articles = $articleManager->returnUnpublishedArticles(); $this->data['articles'] = $validation->statusOfArticles($articles); $this->view = 'articles'; } //ak je zadane URL pre zobrazenie konkretnej strany if (!empty($parameters[0]) && $parameters[0] == 'page') { //ak je zadane cislo strany if (!empty($parameters[1]) && is_numeric($parameters[1])) { if ($parameters[1] == 1) { $offset = 0; } else { $offset = $parameters[1] * 5 - 5; } //zisti pocet clankov, a pripravi pocet stran $articles = $articleManager->returnPublicArticles(0); //vsetky clanky $countArticles = sizeof($articles); $modulo = $countArticles % 5; if ($modulo == 0) { $this->data['pages'] = $countArticles / 5; } else { $this->data['pages'] = intval($countArticles / 5 + 1); } $this->data['currentPage'] = $parameters[1]; //aktualna strana //vratenie clankov s pozadovanym offsetom $articles = $articleManager->returnPublicArticles($offset); $this->data['articles'] = $validation->statusOfArticles($articles); $this->view = 'articles'; } else { $this->redirect('clanky'); } } //ak je zadane URL pre zmazanie clanku if (!empty($parameters[1]) && $parameters[1] == 'odstranit' && $parameters[0] != 'page') { //overi ci clanok z URL existuje if (!$article) { $this->redirect('chyba'); } //overi ci je prihlaseny admin $this->checkUser(true); $articleManager->deleteArticle($parameters[0]); $this->createMessage('Článok bol odstránený', 'success'); $this->redirect('clanky'); } //ak je zadane URL pre zmazanie komentara if (!empty($parameters[0]) && !empty($parameters[1]) && $parameters[1] == 'odstranit-komentar' && !empty($parameters[2])) { //overi ci clanok z URL existuje if (!$article) { $this->redirect('chyba'); } $this->checkUser(true); //overi ci je prihlaseny admin $commentManager->deleteComment($parameters[2]); $this->createMessage('Komentár bol odstránený', 'success'); } //ak je zadane URL clanku if (!empty($parameters[0]) && $parameters[0] != 'page' && $parameters[0] != 'unpublished') { //ak nebol clanok na zadanej URL najdeny //alebo ak uzivatel nie je admin a clanok nie je publikovany //presmeruj na chybove hlasenie if (!$article || $user['admin'] != '1' && $article['public'] == '0') { $this->redirect('chyba'); } //ak bol odoslany komentar if ($_POST) { //ak bol spravne vyplneny antispam if ($_POST['year'] == date('Y')) { //vyber udajov z $_POST a ich ulozenie do premennej $comment $keys = array('article_id', 'comment', 'author'); $comment = array_intersect_key($_POST, array_flip($keys)); //ulozenie komentara do DB $commentManager->saveComment($comment, $user['name']); $this->createMessage('Váš komentár bol úspešne pridaný', 'success'); $this->redirect('clanky/' . $article['url']); } else { $this->createMessage('Chybne vyplnený antispam', 'warning'); $this->redirect('clanky/' . $article['url']); } } //hlavicka stranky $this->head = array('title' => $article['title'], 'key_words' => $article['key_words'], 'description' => $article['description']); //naplnenie premennych pre sablonu $this->data['article'] = $article; $this->data['user'] = $user['name']; //status clanku (publikovany/nepublikovany) $status = $validation->statusOfArticles(array($article)); $this->data['article']['status'] = $status[0]['status']; //komentare k clanku $this->data['comments'] = $commentManager->returnCommentsById($article['article_id']); //priradenie avataru uzivatela do komentarov $i = 0; foreach ($this->data['comments'] as $commentData) { $userData = $userManager->returnUserInfo($commentData['author']); $this->data['comments'][$i]['avatar'] = $userData['avatar']; $this->data['comments'][$i]['userRank'] = $validation->returnUserRank($userData['admin']); $i += 1; } //zaznamena navstevu clanku $articleManager->newVisit($article['article_id'], $article['visits']); //nastavenie sablony $this->view = 'article'; } }
/** * Answer an element that represents the comments attached to a block. * * @param BlockSiteComponent $siteComponent * @return DOMElement * @access protected */ protected function addComments(BlockSiteComponent $siteComponent) { if ($this->isAuthorizedToExportComments($siteComponent)) { $commentMgr = CommentManager::instance(); $idMgr = Services::getService("Id"); $comments = $commentMgr->getAllComments($idMgr->getId($siteComponent->getId())); while ($comments->hasNext()) { $this->addCommentAttachedMedia($comments->next()); } } }
$user_id = $user->getUserId(); } else { $user_logged_in = false; //redirect to homepage header("Location: http://localhost/tarboz/"); } //echo "here: ".$_SERVER['REQUEST_METHOD']; if ($user_logged_in) { //$delete_comment_id = ''; //var_dump($_GET); //print_r($_POST); if ($_POST) { $delete_comment_id = isset($_POST['deleteCommentId']) && $_POST['deleteCommentId'] != 'undefined' ? $_POST['deleteCommentId'] : ""; print "post comment id: " . $delete_comment_id . "<br/>\n"; if ($delete_comment_id != "") { $commentManager = new CommentManager(); $comment_to_delete = $commentManager->getCommentById($delete_comment_id); //print "deleted comment id: ". $comment_to_delete->getId()."<br/>\n"; //Delete comment $deleted_coment = $commentManager->DeleteComment($comment_to_delete); if (!$deleted_coment) { echo "Deleting comment #" . $delete_comment_id . " failed."; } else { echo "Deleting comment #" . $delete_comment_id . " succeeded."; } } else { echo "Finding a comment to delete failed."; } } else { echo "Posting a deleted comment failed."; }
public function add() { CommentManager::add_comment($this->idArticle, $this->pseudo, $this->content); }
} } else { header('Location: /addons'); die; } if ($addonObject->isRejected()) { include 'rejected.php'; die; } else { if (!$addonObject->getApproved()) { include 'unapproved.php'; die; } } if (isset($_POST['comment'])) { CommentManager::submitComment($addonObject->getId(), UserManager::getCurrent()->getBLID(), $_POST['comment']); } $_PAGETITLE = "Blockland Glass | " . $addonObject->getName(); include realpath(dirname(__DIR__) . "/private/header.php"); include realpath(dirname(__DIR__) . "/private/navigationbar.php"); ?> <script type="text/javascript"> $(document).ready(function() { var avgRating = 0<?php echo @round($addonObject->getRating()); ?> ; for(var i = 0; i < avgRating; i++) { $('#star' + (i+1)).attr("src","/img/icons32/star.png"); }
<?php /** * Created by PhpStorm. * User: Florent * Date: 21/04/2015 * Time: 11:26 */ require_once '../Navbar/navbar.php'; require_once '../Database/pdo.php'; require_once '../Entity/Comment.php'; require_once '../EntityManager/CommentManager.php'; $id = $_GET['id']; $monmanagercomment = new CommentManager($bdd); $monmanagercomment->supression($id); header('Location:../Main/comment.php');
break; case ACTION_POST_COMMENT: $content = isset($_POST["content"]) ? $_POST["content"] : false; $entryId = isset($_POST["entry_id"]) ? $_POST["entry_id"] : false; if ($content && $entryId) { CommentManager::PostComment($loggedUser, $content, EntryType::XCLAM, $entryId); } break; case ACTION_EDIT_COMMENT_FORM: $id = $_GET["id"]; $editingComment = CommentManager::GetCommentById($id); $includedPage = "edit_comment"; break; case ACTION_SUBMIT_EDITED_COMMENT: $id = $_POST["id"]; $content = $_POST["content"]; $entryId = $_POST["entry_id"]; CommentManager::UpdateComment($id, $loggedUser, $content, EntryType::XCLAM, $entryId); break; case ACTION_DELETE_COMMENT: if (isset($_GET["id"])) { CommentManager::DeleteComment($_GET["id"]); } break; default: break; } } else { $message = "Please log in before take this action."; } include "pages/xclams/{$includedPage}.php";
<?php if (!isset($_GET['id'])) { return []; } require_once realpath(dirname(__DIR__) . "/class/CommentManager.php"); $aid = $_GET['id'] + 0; //force it to be a number $commentIDs = CommentManager::getCommentIDsFromAddon($aid); $comments = []; foreach ($commentIDs as $cid) { $comments[] = CommentManager::getFromID($cid); } return $comments; // require_once(realpath(dirname(__DIR__) . "/private/class/DatabaseManager.php")); // $database = new DatabaseManager(); // // //the "and `verified` = 1 can be deleted if we decide to force blid database entries to be unique // $result = $database->query("SELECT * FROM `addon_comments` WHERE `blid` = '" . $database->sanitize($_GET['blid']) . "' AND `verified` = 1"); // // if(!$result) { // echo("Database error: " . $database->error()); // } else { // if($result->num_rows == 0) { // echo("<tr style=\"vertical-align:top\">"); // echo("<td colspan=\"2\" style=\"text-align: center;\">"); // echo("There are no comments here yet."); // echo("</td></tr>"); // } else { // require_once(realpath(dirname(__DIR__) . "/private/class/UserHandler.php")); //
/** * add an elements that represents the comments attached to a block. * * @param BlockSiteComponent $siteComponent * @access protected */ protected function addComments(BlockSiteComponent $siteComponent, DOMElement $item) { if ($this->isAuthorizedToExport($siteComponent)) { $commentMgr = CommentManager::instance(); $idMgr = Services::getService("Id"); $comments = $commentMgr->getAllComments($idMgr->getId($siteComponent->getId())); while ($comments->hasNext()) { $item->appendChild($this->getComment($comments->next())); } } }
<?php $xclams = XclamManager::GetXclams(1); $xclams_count = count($xclams); $comments = array(); for ($i = 0; $i < $xclams_count; $i++) { $comments[$i] = CommentManager::GetComments(EntryType::XCLAM, $xclams[$i]->GetId()); } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Nguyễn Thành Dũng's Website</title> <link rel="stylesheet" type="text/css" href="style/xclams.css"> <link rel="shortcut icon" href="images/icon.png"> </head> <body> <div id="logo"> <a href="index.php"><img alt="Logo" src="images/logo.png"></a> </div> <div id="account"> <?php if ($loggedUser) { echo "<p><b>" . $loggedUser->GetDisplayName() . "</b> | <a href='account.php?action=logout&source=xclams'>Log out</a></p>";
static function DeleteXclam($id) { CommentManager::DeleteComments(EntryType::XCLAM, $id); $sql = "DELETE FROM Xclam WHERE Id={$id}"; return DataManager::ExercuseQuery($sql); }
$created_by = $coms->getCreatedBy(); echo "comment text: " . $text . "<br/>"; } //end of foreach loop } else { echo "This user do not have any comments."; } // end if //reset $commentCount $commentCount = 0; echo "<br/><br/><br/><b>************************</b><br>"; } else { echo "Please log in to view the comments by user."; } //Get comment by entry $commentManager = new CommentManager(); echo "<br/>=======Retrieve commment by entry=====<br/> "; $entry_id = "eng1"; echo "Entry id: " . $entry_id . "<br/>"; $commentsByEntry = $commentManager->getCommentByEntry($entry_id); $commentCount = count($commentsByEntry); if ($commentCount > 0) { foreach ($commentsByEntry as $coms) { $id = $coms->getId(); $text = $coms->getText(); $rating_id = $coms->getRatingId(); $created_by = $coms->getCreatedBy(); echo "comment text: " . $text . "<br/>"; } //end of foreach loop } else {
/** * Answer the Content asset that a comment is attached to * * @param object Id $commentId * @return object Asset * @access public * @static * @since 11/9/07 */ public function getParentComment() { $commentManager = CommentManager::instance(); $commentContainerType = new Type('segue', 'edu.middlebury', 'comment_container', 'A container for Segue Comments'); $parent = $this->_asset->getParents()->next(); if ($commentContainerType->isEqual($parent->getAssetType())) { return null; } else { return $commentManager->getComment($parent); } }
/** * Public function that creates a single instance */ public static function getInstance() { if (!isset(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
$comment_text = isset($_POST['newComment']) && $_POST['newComment'] != 'undefined' ? $_POST['newComment'] : ""; $comment_entity_id = isset($_POST['commentEntityId']) && $_POST['commentEntityId'] != 'undefined' ? $_POST['commentEntityId'] : ""; if ($comment_text != "" && $comment_entity_id != "") { $comment_text = rawurldecode($comment_text); //decode the url //handle badword $bw_handler = new BadwordManager(); $bw_list = $bw_handler->getBadWordList(); //print_r($bw_list); $replacement = $bw_handler->getReplacementList(); //print_r($replacement); $filtered_comment_text = preg_replace($bw_list, $replacement, $comment_text); //echo "new comment filtered comment: ".$filtered_comment_text; $new_comment = new Comment(); $new_comment->setText($filtered_comment_text); $new_comment->setCreatedBy($user->getUserId()); $new_comment->setRatingId(''); $com_entry_id = $comment_entity_id; //$com_entry_id = 'eng2'; $new_comment->setEntryId($com_entry_id); $commentManager = new CommentManager(); $new_comment_id = $commentManager->addComment($new_comment); } } if ($new_comment_id > 0) { echo "Adding a new comment succeeded."; } else { echo "Adding a new comment failed."; } } //end if($_POST)
<span id="treqCreateResponse"></span> </div> </div> <?php } //end if($entry->getEntryAuthenStatusId() == 1) } ?> <!--Display translation request end--> <!--- comments section start ---> <div class="entry_record"> <div class="entry_record_title">Comments</div> <div class="entry_record_value"> <?php $commentManager = new CommentManager(); $commentsByEntry = $commentManager->getCommentByEntry($entryId); $commentCount = count($commentsByEntry); if ($commentCount > 0) { foreach ($commentsByEntry as $coms) { $id = $coms->getId(); $text = $coms->getText(); $rating_id = $coms->getRatingId(); $created_by = $coms->getCreatedBy(); //echo "comment text: ". $text."<br/>"; //get the username who created the comment $userManager = new UserManager(); $created_user = $userManager->getUserByUserId($created_by); $created_user_name = $created_user->getLogin(); //define ids for html tags in the loop $edit_icon_id = "editIcon_" . $id;
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 8/5/08 */ public function visitBlock(BlockSiteComponent $siteComponent) { if (!$this->firstSeen) { $this->firstSeen = true; } else { $this->blocks++; } // Discussions $cm = CommentManager::instance(); $this->posts += $cm->getNumComments($siteComponent->getAsset()); // Media $mediaAssets = $this->getAllMediaAssets($siteComponent->getAsset()); $this->media += $mediaAssets->count(); }
</head> <?php /** * Created by PhpStorm. * User: Florent * Date: 21/02/2015 * Time: 12:54 */ session_start(); require_once '../navbar/navbar.php'; require_once '../class/Comment.php'; require_once '../class/Article.php'; require_once '../manager/CommentManager.php'; require_once '../bdd/pdo.php'; $moncomment = new Comment(); $moncommentmanager = new CommentManager($bdd); $articles = $moncommentmanager->choix(); ?> <body> <div class="container"> <div class="row"> <div class="col-md-6 col-md-offset-3"> <div class="well well-sm"> <form class="form-horizontal" action="../second/comment_cible.php" method="post"> <fieldset> <legend class="text-center body">Commentaires</legend> <!-- Email input--> <div class="form-group"> <label for="produit" class="col-md-3 control-label body">Sujet</label> <div class="col-md-9">