$id = $_POST['faq_parent']; } if (isset($_POST['faq_edit_submit'])) { if ($_POST['faq_question'] != "" || $_POST['data'] != "") { $faq_question = $aj->formtpa($_POST['faq_question'], "on"); $data = $aj->formtpa($_POST['data'], "on"); $sql->db_Update("faqs", "faq_parent='" . $_POST['faq_parent'] . "', faq_question ='{$faq_question}', faq_answer='{$data}', faq_comment='" . $_POST['faq_comment'] . "' WHERE faq_id='" . $idx . "' "); $message = FAQ_ADLAN_29; unset($faq_question, $data); } else { $message = FAQ_ADLAN_30; } } if (isset($_POST['commentsubmit'])) { $pid = isset($_POST['pid']) ? $_POST['pid'] : 0; $cobj->enter_comment($_POST['author_name'], $_POST['comment'], "faq", $idx, $pid, $_POST['subject']); } // Actions +++++++++++++++++++++++++++++ $faq = new faq(); $faqpref = e107::getPlugConfig('faqs')->getPref(); if ($action == "" || $action == "main") { if (vartrue($faqpref['classic_look'])) { $ftmp = $faq->show_existing_parents($action, $sub_action, $id, $from, $amount); $caption = FAQLAN_41; } else { $srch = vartrue($_GET['srch']); $ftmp = $faq->view_all($srch); $caption = FAQLAN_FAQ; } $pageTitle = ''; // define("e_PAGETITLE", $ftmp['caption']);
break; case 'user': if (!$sql->db_Select('user', 'user_name', '`user_id` =' . $id)) { e107::redirect(); exit; } break; } $pid = intval(varset($_POST['pid'], 0)); // ID of the specific comment being edited (nested comments - replies) $editpid = intval(varset($_POST['editpid'], 0)); // ID of the specific comment being edited (in-line comments) $clean_authorname = $_POST['author_name']; $clean_comment = $_POST['comment']; $clean_subject = $_POST['subject']; $cobj->enter_comment($clean_authorname, $clean_comment, $table, $id, $pid, $clean_subject); if ($table == "news") { e107::getCache()->clear("news"); } else { e107::getCache()->clear("comment.php?{$table}.{$id}"); } if ($editpid) { $redirectFlag = $id; /* $redir = preg_replace("#\.edit.*#si", "", e_QUERY); header('Location: '.e_SELF.'?{$redir}'); exit; */ } } if (isset($_POST['replysubmit'])) { // Reply to nested comment being posted if ($table == "news" && !$sql->select("news", "news_allow_comments", "news_id='{$nid}' ")) {
require_once FOOTERF; exit; // Add other 'cases' here } // End switch ($action) if (isset($_POST['commentsubmit'])) { if (!$sql->db_Select("download", "download_comment", "download_id = '{$id}' ")) { header("location:" . e_BASE . "index.php"); exit; } else { $dlrow = $sql->db_Fetch(); if ($dlrow['download_comment'] && (ANON === TRUE || USER === TRUE)) { $clean_authorname = $_POST['author_name']; $clean_comment = $_POST['comment']; $clean_subject = $_POST['subject']; $cobj->enter_comment($clean_authorname, $clean_comment, "download", $id, $pid, $clean_subject); // $e107cache->clear("comment.download.{$sub_action}"); $sub_action not used here $e107cache->clear("comment.download"); } } } //==================================================== // LIST //==================================================== if ($action == "list") { $total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '" . e_CLASS_REGEXP . "'"); require_once HEADERF; /* SHOW SUBCATS ... */ if ($sql->db_Select("download_category", "download_category_id", "download_category_parent='{$id}' ")) { /* there are subcats - display them ... */ $qry = "\n\t\t SELECT dc.*, dc2.download_category_name AS parent_name, dc2.download_category_icon as parent_icon, SUM(d.download_filesize) AS d_size,\n\t\t COUNT(d.download_id) AS d_count,\n\t\t MAX(d.download_datestamp) as d_last,\n\t\t SUM(d.download_requested) as d_requests\n\t\t FROM #download_category AS dc\n\t\t LEFT JOIN #download AS d ON dc.download_category_id = d.download_category AND d.download_active > 0 AND d.download_visible IN (" . USERCLASS_LIST . ")\n\t\t LEFT JOIN #download_category as dc2 ON dc2.download_category_id='{$id}'\n\t\t WHERE dc.download_category_class IN (" . USERCLASS_LIST . ") AND dc.download_category_parent='{$id}'\n\t\t GROUP by dc.download_category_id ORDER by dc.download_category_order\n\t\t";
$loop_uid = $id; $ret = e107::getEvent()->trigger("showuser", $id); $ret2 = e107::getEvent()->trigger('user_profile_display', $id); if (!empty($ret) || !empty($ret2)) { $text = "<div style='text-align:center'>" . $ret . "</div>"; $ns->tablerender(LAN_USER_48, $text); require_once FOOTERF; exit; } if (vartrue($pref['profile_comments'])) { require_once e_HANDLER . "comment_class.php"; $comment_edit_query = 'comment.user.' . $id; } if (isset($_POST['commentsubmit']) && $pref['profile_comments']) { $cobj = new comment(); $cobj->enter_comment($_POST['author_name'], $_POST['comment'], 'profile', $id, $pid, $_POST['subject']); } if ($text = renderuser($id)) { $ns->tablerender(LAN_USER_50, $text); } else { $text = "<div style='text-align:center'>" . LAN_USER_51 . "</div>"; $ns->tablerender(LAN_USER_48, $text); } unset($text); require_once FOOTERF; exit; } $users_total = $sql->db_Count("user", "(*)", "WHERE user_ban = 0"); if (!$sql->db_Select("user", "*", "user_ban = 0 ORDER BY user_id {$order} LIMIT {$from},{$records}")) { echo "<div style='text-align:center'><b>" . LAN_USER_53 . "</b></div>"; } else {
$text .= "<br />" . EASYSHOP_SHOP_38; } else { $text .= "<br />" . EASYSHOP_SHOP_39 . ": " . General::getCommentTotal(easyshop, $item_id); } } // Render the value of $text in a table. $title = EASYSHOP_SHOP_00; $ns->tablerender($title, $text); if ($enable_comments == 1) { // Show comments and input comments form when setting is enabled // Show comments input section $comment_to = $item_id; $comment_sub = "Re: " . $tp->toFORM($item_name, false); $cobj->compose_comment("easyshop", "comment", $comment_to, $width, $comment_sub, $showrate = false); if (isset($_POST['commentsubmit'])) { $cobj->enter_comment($_POST['author_name'], $_POST['comment'], "easyshop", $comment_to, $pid, $_POST['subject']); $target = 'easyshop.php?prod.' . $item_id; header("Location: " . $target); } } } //-----------------------------------------------------------------------------+ //----------------------- Show All Categories ---------------------------------+ //-----------------------------------------------------------------------------+ if ($action == "allcat" || $action == "catpage" || $action == "blanks") { $add_where = ''; if ($action == "blanks") { $add_where = " AND category_main_id= '' "; } $categories_count = $sql->db_Count(DB_TABLE_SHOP_ITEM_CATEGORIES, "(*)", "WHERE category_active_status = 2 " . $add_where . " AND (category_class IN (" . USERCLASS_LIST . "))"); if ($categories_count > 0) {
$from = array_shift($qs); } else { $from = "0"; } } include_lan(e_PLUGIN . "links_page/languages/" . e_LANGUAGE . ".php"); $lc->setPageTitle(); //submit comment if (isset($_POST['commentsubmit'])) { if (!$sql->db_Select("links_page", "link_id", "link_id = '" . intval($qs[1]) . "' ")) { header("location:" . e_BASE . "index.php"); exit; } else { $row = $sql->db_Fetch(); if ($row[0] && (ANON === TRUE || USER === TRUE)) { $cobj->enter_comment($_POST['author_name'], $_POST['comment'], "links_page", $qs[1], $pid, $_POST['subject']); $e107cache->clear("comment.links_page.{$qs[1]}"); } } } //update refer if (isset($qs[0]) && $qs[0] == "view" && isset($qs[1]) && is_numeric($qs[1])) { if ($sql->db_Select("links_page", "*", "link_id='" . intval($qs[1]) . "' AND link_class REGEXP '" . e_CLASS_REGEXP . "' ")) { $row = $sql->db_Fetch(); $sql->db_Update("links_page", "link_refer=link_refer+1 WHERE link_id='" . intval($qs[1]) . "' "); //header("location:".$row['link_url']); exit; js_location($row['link_url']); } } require_once HEADERF; if (is_readable(THEME . "links_template.php")) {
/** * Add comments to a plugins * <p>This method returns the HTML for a comment form. In addition, it will post comments to the e107v7 * comments database and get any existing comments for the current item.</p> * @param string a unique ID for this plugin, maximum of 10 character * @param int id of the item comments are allowed for * @return string HTML for existing comments for an item and the comments form to allow new comments to be posted */ function ebGetComment($pluginid, $id) { global $pref, $e107cache, $tp; // Include the comment class. Normally, this file is included at a global level, so we need to make the variable // it decalares global so it is available inside the comment class require_once e_HANDLER . "comment_class.php"; require e_FILE . "shortcode/batch/comment_shortcodes.php"; $GLOBALS["comment_shortcodes"] = $comment_shortcodes; $pid = 0; // What is this w.r.t. comment table? Parent ID? // Define a comment object $cobj = new comment(); // See if we need to post a comment to the database if (isset($_POST['commentsubmit'])) { $cobj->enter_comment($_POST['author_name'], $_POST['comment'], $pluginid, $id, $pid, $_POST['subject']); if ($pref['cachestatus']) { $e107cache->clear("comment.{$pluginid}.{$sub_action}"); } } // Specific e107 0.617 processing to render existing comments if (!isV07()) { $query = $pref['nested_comments'] ? "comment_item_id='{$id}' AND comment_type='{$pluginid}' AND comment_pid='0' ORDER BY comment_datestamp" : "comment_item_id='{$id}' AND comment_type='{$pluginid}' ORDER BY comment_datestamp"; unset($text); $mysql = new db(); if ($comment_total = $mysql->db_Select("comments", "*", $query)) { $width = 0; while ($row = $mysql->db_Fetch()) { // ** Need to sort out how to do nested comments here if ($pref['nested_comments']) { $text .= $cobj->render_comment($row, $pluginid, "comment", $id, $width, $subject, true); } else { $text .= $cobj->render_comment($row, $pluginid, "comment", $id, $width, $subject, true); } } if (ADMIN && getperms("B")) { $text .= "<div style='text-align:right'><a href='" . e_ADMIN . "modcomment.php?{$pluginid}.{$id}'>" . LAN_314 . "</a></div>"; } } } // Get comment form - e107 sends this to the output buffer so we must grab it and assign to our return string ob_start(); if (isV07()) { // e107 0.7 $cobj->compose_comment($pluginid, "comment", $id, $width, $subject, false); } else { // e107 0.617 if (strlen($text) > 0) { $ns = new e107table(); $ns->tablerender(LAN_5, $text); } $cobj->form_comment("comment", $pluginid, $id, $subject, $content_type); } $text = ob_get_contents(); ob_end_clean(); return $text; }
function pageComment($page_comment_flag) { if ($page_comment_flag) { require_once e_HANDLER . "comment_class.php"; $cobj = new comment(); if (isset($_POST['commentsubmit'])) { $cobj->enter_comment($_POST['author_name'], $_POST['comment'], "page", $this->pageID, $pid, $_POST['subject']); $e107cache = e107::getCache(); $e107cache->clear("comment.page." . $this->pageID); $e107cache->clear($this->cacheString); } return $cobj->compose_comment("page", "comment", $this->pageID, 0, $this->title, false, true); } }
//post comment if (isset($_POST['commentsubmit'])) { if (!is_object($sql)) { $sql = new db(); } if (!$sql->db_Select($plugintable, "content_comment", "content_id='" . intval($qs[1]) . "' ")) { //header("location:".e_BASE."index.php"); exit; e107::redirect(); } else { $row = $sql->db_Fetch(); if (ANON === TRUE || USER === TRUE) { //enter_comment($author_name, $comment, $table, $id, $pid, $subject) $author = $_POST['author_name'] ? $_POST['author_name'] : USERNAME; $pid = "0"; $rated = isset($_POST['rateindex']) ? $_POST['rateindex'] : ""; $cobj->enter_comment($author, $_POST['comment'], $plugintable, $qs[1], $pid, $_POST['subject'], $rated); if ($qs[0] == "content" && is_numeric($qs[1])) { if (!isset($qs[2])) { $cacheid = 1; } else { $cacheid = $qs[2]; } $e107cache->clear("comment.{$plugintable}.{$qs['1']}.{$cacheid}"); $e107cache->clear("{$plugintable}.content.{$qs['1']}.{$cacheid}"); } if ($qs[0] == "cat" && is_numeric($qs[1])) { $e107cache->clear("comment.{$plugintable}.{$qs['1']}"); } $main = $aa->getMainParent(is_numeric($qs[1]) ? $qs[1] : $qs[2]); $e107cache->clear("{$plugintable}.recent.{$main}"); $e107cache->clear("{$plugintable}.cat.list.{$main}");