$start_datestamp = $gen->convert_date($poll_datestamp, "long"); $end_datestamp = $gen->convert_date($poll_end_datestamp, "long"); $text = "<table style='" . USER_WIDTH . "'>\n\t\t<tr>\n\t\t<td colspan='2' class='mediumtext' style='text-align:center'>\n\t\t<b>" . $tp->toHTML($poll_title, TRUE, 'TITLE') . "</b>\n\t\t<div class='smalltext'>" . POLLAN_35 . " <a href='" . e_BASE . "user.php?id.{$user_id}'>" . $user_name . "</a>.<br /> " . POLLAN_37 . " " . $start_datestamp . " " . POLLAN_38 . " " . $end_datestamp . ".<br />" . POLLAN_26 . ": {$voteTotal}</div>\n\t\t<br />\n\n\t\t</td>\n\t\t</tr>"; $count = 0; $barl = file_exists(THEME . "images/barl.png") ? THEME . "images/barl.png" : e_PLUGIN . "poll/images/barl.png"; $barr = file_exists(THEME . "images/barr.png") ? THEME . "images/barr.png" : e_PLUGIN . "poll/images/barr.png"; $bar = file_exists(THEME . "images/bar.png") ? THEME . "images/bar.png" : e_PLUGIN . "poll/images/bar.png"; foreach ($optionArray as $option) { $text .= "\n\t\t\t<tr>\n\t\t\t<td style='width:40%; text-align: right' class='mediumtext'><b>" . $tp->toHTML($option, TRUE, 'TITLE') . "</b> </td>\n\t\t\t<td class='smalltext'>\n\t\t\t<div style='background-image: url({$barl}); width: 5px; height: 14px; float: left;'>\n\t\t\t</div>\n\t\t\t<div style='background-image: url({$bar}); width: " . (floor($percentage[$count]) != 100 ? floor($percentage[$count]) : 95) . "%; height: 14px; float: left;'>\n\t\t\t</div>\n\t\t\t<div style='background-image: url({$barr}); width: 5px; height: 14px; float: left;'>\n\t\t\t</div>\n\t\t\t" . $percentage[$count] . "% [" . POLLAN_31 . ": " . $voteArray[$count] . "]\n\t\t\t</td>\n\t\t\t</tr>\n"; $count++; } $query = "SELECT c.*, u.* FROM #comments AS c\n\t\tLEFT JOIN #user AS u ON FLOOR(SUBSTR(c.comment_author,1,INSTR(c.comment_author,'.')-1))=u.user_id\n\t\tWHERE comment_item_id=" . intval($poll_id) . " AND comment_type=4 ORDER BY comment_datestamp"; if ($comment_total = $sql->db_Select_gen($query) !== FALSE) { $text .= "<tr><td colspan='2'><br /><br />"; while ($row = $sql->db_Fetch()) { $text .= $cobj->render_comment($row); } $text .= "</td></tr>"; } $text .= "</table>"; $ns->tablerender(POLL_ADLAN01 . " #" . $poll_id, $text); } } $query = "SELECT p.*, u.user_name FROM #polls AS p\nLEFT JOIN #user AS u ON p.poll_admin_id = u.user_id\nWHERE p.poll_type=1\nORDER BY p.poll_datestamp DESC"; if (!$sql->db_Select_gen($query)) { $ns->tablerender(POLLAN_28, "<div style='text-align:center'>" . POLLAN_33 . "</div>"); require_once FOOTERF; exit; } $array = $sql->db_getList(); $oldpollArray = array_slice($array, 1);
/** * 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; }