function get_comments($file_id) { include 'database.php'; $result = mysqli_query($connect, "SELECT * FROM `comments` WHERE `file_id`='{$file_id}' AND `is_child`=FALSE ORDER BY `date` DESC"); $row_cnt = mysqli_num_rows($result); echo '<h1>Comments (' . $row_cnt . ')</h1>'; echo '<div class="comment">'; new_comment(); echo '</div>'; foreach ($result as $item) { $date = new dateTime($item['date']); $date = date_format($date, 'M j, Y | H:i:s'); $auth = $item['author']; $par_code = $item['com_code']; $chi_result = mysqli_query($connect, "SELECT * FROM `comments` WHERE `par_code`='{$par_code}' AND `is_child`=TRUE"); $chi_cnt = mysqli_num_rows($chi_result); echo '<div class="comment" name="' . $item['com_code'] . '">' . '<span class="author">' . $auth . '</span><br />' . $item['comment'] . '<br />' . '<span class="date">Posted: ' . $date . '</span><br />'; if ($chi_cnt == 0) { echo '<span class="replies">No replies</span>' . '<span class="replies"> Reply</span>'; } else { echo '<span class="replies">[+] ' . $chi_cnt . ' replies</span>' . '<span class="replies" Reply</span>'; add_comment($item['author'], $item['com_code']); echo '<div name="children" id="children">'; foreach ($chi_result as $com) { $chi_date = new dateTime($com['date']); $chi_date = date_format($chi_date, 'M j, Y | H:i:s'); echo '<div class="child" name="' . $com['com_code'] . '">' . '<span class="author">' . $com['author'] . '</span><br />' . $com['comment'] . '<br />' . '<span class="date">Posted: ' . $chi_date . '</span><br />' . '</div>'; } echo '</div>'; } echo '</div>'; } mysqli_close($connect); }
public function getCommentEditingHtml() { $conn = db_connect(); if ($conn == false) { return; } $user = $_SESSION['loggedUser']; for ($i = 0; $i < count($this->comments); $i++) { if ($this->comments[$i]->getAuthor()->getId() == $user->getId()) { if (is_a($_SESSION['loggedUser'], 'Administrator')) { $this->comments[$i]->setPoints($conn, $this->points); } pridaj_hodnotenie($this->comments, $i); return; } } $comment_id = new_comment($conn, $this->id, $user->getId()); $this->comments[] = Comment::getFromDatabaseByID($conn, $comment_id); if (is_a($_SESSION['loggedUser'], 'Administrator')) { $this->comments[count($this->comments) - 1]->setPoints($conn, $this->points); } pridaj_hodnotenie($this->comments, count($this->comments) - 1); }
$timer->mark('start_work_check'); if ($work->Exists()) { // Do what the users wants $i = $work->Fetch(1); $i = unserialize($i->messagetext); // print_r($i); // Figure out what the work items is and Do It! switch ($i['Action']) { case WL_NEW_PROD: new_product($i['Details']); break; case WL_DEL_PROD: delete_product($i['Details']); break; case WL_NEW_COMMENT: new_comment($i['Details']); break; case WL_DEL_COMMENT: delete_comment($i['Details']); break; case WL_CODE_GIVEN: // FILL IN break; case WL_CODE_VENDOR_REDEEMED: // FILL IN break; } } $timer->mark('end_work_check'); } catch (Exception $e) { echo "\n**** Error somewhere in worklist queue check (worker.php:74) ***";
$sql="SELECT * FROM COMMENTS WHERE pid='$pids[$i]'"; $result = $conn_db->query($sql); $num_com=0; if ($result->num_rows > 0) { // output data of each row while($rowc = $result->fetch_assoc()) { $authorc[$num_com] = $rowc["author"]; $messagesc[$num_com] = $rowc["message"]; $num_com++; } $rowc=[]; } for ($j=0;$j<$num_com;$j++){ $commenter=$authorc[$j]; $comment=$messagesc[$j]; new_comment($commenter,'Re:',$comment,'2',$idt); } $authorc=[]; $messagesc=[]; } echo "press <a href=custom.php>this</a> to complete"; echo "<script type='text/javascript'>location.href = 'index_hashtags.php';</script>"; ?>
$smarty->assign('related_goods', $linked_goods); // 关联商品 $smarty->assign('goods_article_list', get_linked_articles($goods_id)); // 关联文章 $smarty->assign('fittings', get_goods_fittings(array($goods_id))); // 配件 $smarty->assign('rank_prices', get_user_rank_prices($goods_id, $shop_price)); // 会员等级价格 $smarty->assign('pictures', get_goods_gallery($goods_id)); // 商品相册 $smarty->assign('bought_goods', get_also_bought($goods_id)); // 购买了该商品的用户还购买了哪些商品 $smarty->assign('goods_rank', get_goods_rank($goods_id)); // 商品的销售排名 $smarty->assign('comment_percent', comment_percent($goods_id)); $smarty->assign('new_comment', new_comment($goods_id)); $smarty->assign('related_cat', get_related_cat($goods['cat_id'])); //by mike start //组合套餐名 $comboTabIndex = array(' ', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十'); $smarty->assign('comboTab', $comboTabIndex); //组合套餐组 $fittings_list = get_goods_fittings(array($goods_id)); if (is_array($fittings_list)) { foreach ($fittings_list as $vo) { $fittings_index[$vo['group_id']] = 1; //关联数组 } } ksort($fittings_index); //重新排序
unset($_SESSION["unroll_comment"]); } } // Nettoyage de restes de formulaires éventuels if (isset($_SESSION["text_new_comment_rest"])) { unset($_SESSION["text_new_comment_rest"]); } if (isset($_SESSION["text_anonymous_rest"])) { unset($_SESSION["text_anonymous_rest"]); } header('Location:index.php?action=display_post'); break; // Nouveau commentaire // Nouveau commentaire case "comment_post": new_comment(); $balise = ""; if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { $pos = strpos($_SERVER['QUERY_STRING'], "#"); if ($pos !== false) { $balise = substr($_SERVER['QUERY_STRING'], $pos + 1); } } if (!empty($balise)) { header('Location:index.php?action=display_post#' . $balise); // Maintien de la hauteur dans la page } else { header('Location:index.php?action=display_post'); } break; case "delete_account":