Foren-Mitglied
(6)
PHP-Fusion: v7.02.05
Beiträge: 43
Registriert am: 20.04.2013
Geschlecht:
Alter: 42
Stimmung:
|
Hallo, mein Name Weli.
Ich möchte fragen, was ist der Zweck dieses Codes comments_include.php
also kann ich Kommentare zusammen info von der Post submit download?
Parser Hinweis: Code ist zu groß für GeSHi! Benutze dafür die Code Tags.: <?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: comments_include.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| Name: Extended Comments
| Version: 1.01
| Filename: comments_include.php
| Author: Fangree Productions
| Developers: Fangree_Craig
| Site: http://www.fangree.co.uk
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
include LOCALE.LOCALESET."comments.php";
function showcomments($ctype, $cdb, $ccol, $cid, $clink) {
global $settings, $locale, $userdata, $aidlink;
// Check if locale file is available matching the current site locale setting.
if (file_exists(INFUSIONS."extended_comments/locale/".$settings['locale'].".php")) {
// Load the locale file matching the current site locale setting.
include INFUSIONS."extended_comments/locale/".$settings['locale'].".php";
} else {
// Load the infusion's default locale file.
include INFUSIONS."extended_comments/locale/English.php";
}
include INFUSIONS."extended_comments/infusion_db.php";
$comments_settings = dbarray(dbquery("SELECT * FROM ".DB_EXTCOMMENTS_TABLE));
$link = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
$link = preg_replace("^(&|\?)c_action=(edit|delete)&comment_id=\d*^", "", $link);
if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "delete") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) {
if ((iADMIN && checkrights("C")) || (iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='".$_GET['comment_id']."' AND comment_name='".$userdata['user_id']."'"))) {
$result = dbquery("DELETE FROM ".DB_COMMENTS." WHERE comment_id='".$_GET['comment_id']."'".(iADMIN ? "" : " AND comment_name='".$userdata['user_id']."'"));
}
redirect($clink);
}
if ($settings['comments_enabled'] == "1") {
if ((iMEMBER || $settings['guestposts'] == "1") && isset($_POST['post_comment'])) {
if (iMEMBER) {
$comment_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$comment_name = trim(stripinput($_POST['comment_name']));
$comment_name = preg_replace("(^[+0-9\s]*)", "", $comment_name); if (isnum($comment_name)) { $comment_name = ""; }
include_once INCLUDES."securimage/securimage.php";
$securimage = new Securimage();
if (!isset($_POST['com_captcha_code']) || $securimage->check($_POST['com_captcha_code']) == false) { redirect($link); }
}
$comment_message = trim(stripinput(censorwords($_POST['comment_message'])));
if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) {
$comment_updated = false;
if ((iADMIN && checkrights("C")) || (iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='".$_GET['comment_id']."' AND comment_item_id='".$cid."' AND comment_type='".$ctype."' AND comment_name='".$userdata['user_id']."' AND comment_hidden='0'"))) {
if ($comment_message) {
$result = dbquery("UPDATE ".DB_COMMENTS." SET comment_message='$comment_message' WHERE comment_id='".$_GET['comment_id']."'".(iADMIN ? "" : " AND comment_name='".$userdata['user_id']."'"));
$comment_updated = true;
}
}
if ($comment_updated) {
$c_start = (ceil(dbcount("(comment_id)", DB_COMMENTS, "comment_id<='".$_GET['comment_id']."' AND comment_item_id='".$cid."' AND comment_type='".$ctype."'") / 10) - 1) * 10;
}
redirect($clink."&c_start=".(isset($c_start) && isnum($c_start) ? $c_start : ""));
} else {
if (!dbcount("(".$ccol.")", $cdb, $ccol."='".$cid."'")) { redirect(BASEDIR."index.php"); }
if ($comment_name && $comment_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("comment_datestamp", DB_COMMENTS, "comment_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_COMMENTS." (comment_item_id, comment_type, comment_name, comment_message, comment_datestamp, comment_ip, comment_hidden) VALUES ('$cid', '$ctype', '$comment_name', '$comment_message', '".time()."', '".USER_IP."', '0')");
}
}
$c_start = (ceil(dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='".$cid."' AND comment_type='".$ctype."'") / 10) - 1) * 10;
redirect($clink."&c_start=".$c_start);
}
}
opentable($locale['c102']);
if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) {
$eresult = dbquery(
"SELECT tcm.comment_id, tcm.comment_name, tcm.comment_message, tcu.user_name FROM ".DB_COMMENTS." tcm
LEFT JOIN ".DB_USERS." tcu ON tcm.comment_name=tcu.user_id
WHERE comment_id='".$_GET['comment_id']."' AND comment_item_id='".$cid."' AND comment_type='".$ctype."' AND comment_hidden='0'"
);
if (dbrows($eresult)) {
$edata = dbarray($eresult);
if ((iADMIN && checkrights("C")) || (iMEMBER && $edata['comment_name'] == $userdata['user_id'] && isset($edata['user_name']))) {
$clink .= "&c_action=edit&comment_id=".$edata['comment_id'];
$comment_message = $edata['comment_message'];
}
} else {
$comment_message = "";
}
} else {
$comment_message = "";
}
if (iMEMBER || $settings['guestposts'] == "1") {
require_once INCLUDES."bbcode_include.php";
echo "<a id='edit_comment' name='edit_comment'></a>\n";
echo "<form name='inputform' method='post' action='".$clink."'>\n";
if (iGUEST) {
echo "<div align='center' class='tbl'>\n".$locale['c104']."<br />\n";
echo "<input type='text' name='comment_name' maxlength='30' class='textbox' style='width:360px' />\n";
echo "</div>\n";
}
$delay_spam = stripslashes($comments_settings['delay_spam']);
if (iMEMBER && ((time()-$userdata['user_joined'])<$delay_spam)) {
echo"<br /><div class='admin-message' style='text-align: center;margin:auto'><strong>".$locale['co_spam001']."</strong></div><br />";
}else{
echo "<div align='center' class='tbl'>\n";
echo "<textarea name='comment_message' cols='70' rows='6' class='textbox' style='width:360px'>".$comment_message."</textarea><br />\n";
echo display_bbcodes("360px", "comment_message");
if (iGUEST) {
echo $locale['global_158']."<br />\n";
echo "<img id='com_captcha' src='".INCLUDES."securimage/securimage_show.php' alt='' /><br />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' class='tbl-border' style='margin-bottom:1px' /></a>\n";
echo "<a href='#' onclick=\"document.getElementById('com_captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' class='tbl-border' /></a><br />\n";
echo $locale['global_159']."<br />\n<input type='text' name='com_captcha_code' class='textbox' style='width:100px' />\n";
}
echo "<br />\n<input type='submit' name='post_comment' value='".($comment_message ? $locale['c103'] : $locale['c102'])."' class='button' />\n";
echo "</div>\n</form>\n";
}
} else {
echo $locale['c105']."\n";
}
closetable();
opentable($locale['c100']);
// Comments Styles
require_once INFUSIONS."extended_comments/includes/comments_styles_include.php";
echo "<a id='comments' name='comments'></a>";
$c_rows = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='$cid' AND comment_type='$ctype' AND comment_hidden='0'");
if (!isset($_GET['c_start']) || !isnum($_GET['c_start'])){ $_GET['c_start'] = 0; }
if (!isset($_GET['c_start']) && $c_rows > 10) {$_GET['c_start'] = (ceil($c_rows / 1) - 10) * 1;}
$result = dbquery(
"SELECT tcm.comment_id, tcm.comment_name, tcm.comment_message, tcm.comment_datestamp, tcm.comment_ip, tcu.user_id, tcu.user_name, tcu.user_status, tcu.user_avatar, tcu.user_lastvisit, tcu.user_joined
FROM ".DB_COMMENTS." tcm
LEFT JOIN ".DB_USERS." tcu ON tcm.comment_name=tcu.user_id
WHERE comment_item_id='$cid' AND comment_type='$ctype' AND comment_hidden='0'
ORDER BY comment_datestamp DESC LIMIT ".$_GET['c_start'].",10"
);
if (dbrows($result)) {
$i = $_GET['c_start']+10;
if ($c_rows > 1) {
echo "<div style='text-align:center;margin-bottom:5px;'>".makecommentnav($_GET['c_start'], 10, $c_rows, 3, $clink."&")."</div>\n";
}
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border' style='vertical-align:top;'>\n";
while ($data = dbarray($result)) {
if (($comments_settings['colour1']) || ($comments_settings['colour1_font'])) {
echo "<tr><td colspan='2' class='tbl2-colour1 border-radius'>";
}else{
echo "<tr><td colspan='2' class='tbl2 border-radius'>";
}
if ((iADMIN && checkrights("C")) || (iMEMBER && $data['comment_name'] == $userdata['user_id'] && isset($data['user_name']))) {
if ($comments_settings['icons'] == '1'){
echo "<div style='float:right' class='comment_actions'><!--comment_actions-->\n<a href='".FUSION_REQUEST."&c_action=edit&comment_id=".$data['comment_id']."#edit_comment'><img src='".INFUSIONS."extended_comments/images/edit_comment.png' style='vertical-align: middle; border:0px;' alt='".$locale['c108']."' title='".$locale['c108']."' /></a> |\n";
echo "<a href='".FUSION_REQUEST."&c_action=delete&comment_id=".$data['comment_id']."'><img src='".INFUSIONS."extended_comments/images/delete_comment.png' style='vertical-align: middle; border:0px;' alt='".$locale['c109']."' title='".$locale['c109']."' /></a>\n</div>\n";
}else{
if (($comments_settings['colour1']) || ($comments_settings['colour1_font'])) {
echo "<div style='float:right' class='com-name'>\n<a class='com-name' href='".FUSION_REQUEST."&c_action=edit&comment_id=".$data['comment_id']."#edit_comment'>".$locale['c108']."</a> |\n";
echo "<a class='com-name' href='".FUSION_REQUEST."&c_action=delete&comment_id=".$data['comment_id']."'>".$locale['c109']."</a>\n</div>\n";
}else{
echo "<div style='float:right' class='comment_actions'><!--comment_actions-->\n<a href='".FUSION_REQUEST."&c_action=edit&comment_id=".$data['comment_id']."#edit_comment'>".$locale['c108']."</a> |\n";
echo "<a href='".FUSION_REQUEST."&c_action=delete&comment_id=".$data['comment_id']."'>".$locale['c109']."</a>\n</div>\n";
}
}
}
if ($data['user_name']) {
if(iMEMBER && $data['user_id'] != $userdata['user_id'] && $comments_settings['comment_reply'] == '1') {
echo' <a title="@:'.($data['comment_message']?$data['user_name']:$data['comment_message']).'" href="javascript:insertText(\'comment_message\',\'[quote][b]'.($data['user_name']?$data['user_name'].'[/b]'.''.'='.$data['comment_message']:$data['comment_message']).'[/quote] \', \'inputform\');" class="side small"><img src=\''.INFUSIONS.'extended_comments/images/commentat.gif\' style=\'vertical-align:middle;\' alt=\''.$locale['com015c'].'\' title=\''.$locale['com015c'].'\' border=\'0\' /></a> | ';
}
if (($comments_settings['colour1']) || ($comments_settings['colour1_font'])) {
echo "<a class='com-name' href='".BASEDIR."profile.php?lookup=".$data['comment_name']."'>".$data['user_name']."</a>\n";
}else{
echo "<span class='comment-name'><a href='".BASEDIR."profile.php?lookup=".$data['comment_name']."'>".$data['user_name']."</a></span>\n";
}
if ($comments_settings['status'] == '1'){
echo" | ";
if ($data['user_lastvisit']<(time()-60)) {
echo " <img src='".IMAGES."offline.gif' alt='".$data['user_name']." ".$locale['c003']."' title='".$data['user_name']." ".$locale['c003']."' style='vertical-align:middle; border:0px;'/> <span class='small'>|</span> \n";
} else {
echo " <img src='".IMAGES."online.gif' alt='".$data['user_name']." ".$locale['c002']."' title='".$data['user_name']." ".$locale['c002']."' style='vertical-align:middle; border:0px;' /> <span class='small'>|</span> \n";
}
}
} else {
if (($comments_settings['colour1']) || ($comments_settings['colour1_font'])) {
echo "<span class='com-name'>".$data['comment_name']."</span> |\n";
}else{
echo "<span class='comment-name'>".$data['comment_name']."</span> |\n";
}
}
if (($comments_settings['colour1']) || ($comments_settings['colour1_font'])) {
echo "<a class='com-name' href='".FUSION_REQUEST."#c".$data['comment_id']."' id='c".$data['comment_id']."' name='c".$data['comment_id']."'>#".$i."</a> | ".$locale['c001']." ".$locale['global_071'].showdate("longdate", $data['comment_datestamp'])."\n";
}else{
echo "<span class='small'><a href='".FUSION_REQUEST."#c".$data['comment_id']."' id='c".$data['comment_id']."' name='c".$data['comment_id']."'>#".$i."</a> | ".$locale['c001']." ".$locale['global_071'].showdate("longdate", $data['comment_datestamp'])."</span>\n";
}
echo "</td></tr>";
if (($comments_settings['avatar_c'] == '1') || ($comments_settings['country'] == '1') || ($comments_settings['joined'] == '1') || ($comments_settings['display_ip'] == '1')) {
if (($comments_settings['colour2']) || ($comments_settings['colour2_font'])) {
echo "<tr>\n<td valign='top' class='tbl2-colour2 border-radiustlbl'>\n";
}else{
echo "<tr>\n<td valign='top' class='tbl2 border-radiustlbl'>\n";
}
if ($comments_settings['avatar_c'] == '1') {
if ($data['user_avatar'] && file_exists(IMAGES."avatars/".$data['user_avatar'])) {
$user_avatar = "<img class='avatar' src='".IMAGES."avatars/".$data['user_avatar']."' alt='".$data['user_name']."'/><br /><br />";
echo profile_link($data['comment_name'], $user_avatar, $data['user_status']);
} else {
$user_avatar = "<img class='avatar' src='".IMAGES."avatars/noavatar50.png' width='200' height='200' alt='".$data['user_name']."'/><br /><br />";
echo profile_link($data['comment_name'], $user_avatar, $data['user_status']);
}
}
if ($comments_settings['country'] == '1') {
$result_country = dbquery("SHOW COLUMNS FROM ".DB_USERS. " LIKE 'user_country'");
if (dbrows($result_country) > 0) {
$ucountry = dbarray(dbquery("SELECT user_country FROM ".DB_USERS." WHERE user_id='".$data['user_id']."'"));
echo "<td align='right' class='tbl1'>".parsesmileys(parseubb($tidata['user_title_text']))."</td>\n";
if (isset($ucountry['user_country'])) {
$c = dbarray(dbquery("SELECT * FROM ".DB_PREFIX."nations WHERE nat_id='".$ucountry['user_country']."'"));
echo "<span class='small'><strong>".$locale['c004']."</strong> <img style='vertical-align:middle;border:none' src='".BASEDIR."".($ucountry['user_country'] != 0 ? $c['nat_pic'] : "".BASEDIR."/images/flags/f-00.gif")."' alt='".$c['nat_name']."' title='".$c['nat_name']."'/></span><br />\n";
}
}
$result_location = dbquery("SHOW COLUMNS FROM ".DB_USERS. " LIKE 'user_location'");
if (dbrows($result_location) > 0) {
$ulocation = dbarray(dbquery("SELECT user_location FROM ".DB_USERS." WHERE user_id='".$data['user_id']."'"));
if ($ulocation['user_location'] !=="") {
echo "<center><span class='small'><strong>".$locale['c005']."</strong> ".$ulocation['user_location']."<br /><center>\n";
}
}
}
if ($comments_settings['joined'] == '1' ) {
if ($data['user_joined']) {
echo "<center><span class='small'><strong>".$locale['c006']."</strong> ".showdate("%d.%m.%y", $data['user_joined'])."</center>\n";
echo"</span><br />\n";
}
}
if ($comments_settings['display_ip'] == '1' && iADMIN && checkrights("C")) {
echo"<span class='small'><strong>".$locale['c007']."</strong> ".$data['comment_ip']."</span>";
}
echo "</td>";
}
if (($comments_settings['avatar_c'] ==1) || ($comments_settings['country'] ==1) || ($comments_settings['joined'] ==1) || ($comments_settings['display_ip'] ==1)) {
if (($comments_settings['colour3']) || ($comments_settings['colour3_font'])) {
echo "<td valign='top' class='tbl1-colour3 border-radiustrbr comment_message'>";
}else{
echo "<td valign='top' class='tbl1 border-radiustrbr comment_message'>";
}
}else{
if (($comments_settings['colour3']) || ($comments_settings['colour3_font'])) {
echo "<td valign='top' class='tbl1-colour3 border-radius'>";
}else{
echo "<td valign='top' class='tbl1 border-radius comment_message'>";
}
}
echo"<!--comment_message-->".nl2br(parseubb(parsesmileys($data['comment_message'])))."";
$result_sig = dbquery("SHOW COLUMNS FROM ".DB_USERS. " LIKE 'user_sig'");
if (dbrows($result_sig) > 0) {
$usig = dbarray(dbquery("SELECT user_sig FROM ".DB_USERS." WHERE user_id='".$data['user_id']."'"));
if (isset($usig['user_sig']) && $usig['user_sig'] && $comments_settings['sig'] ==1) {
echo "\n<br /><br /><hr><div class='forum_sig'><center><fieldset class='comments-fieldset'><legend class='comments-legend'>".$locale['c009']."</legend>".nl2br(parseubb(parsesmileys($usig['user_sig']), "b|i|u||center|small|url|mail|img|color"))."</center></fieldset></div>\n";
}
}
echo"</div>\n";
echo "</td>\n</tr>\n";
if ($comments_settings['addthis'] ==1) {
include INFUSIONS."extended_comments/locale/English.php";
if (($comments_settings['avatar_c'] == '1') || ($comments_settings['country'] ==1) || ($comments_settings['joined'] ==1) || ($comments_settings['display_ip'] ==1)) {
if (($comments_settings['colour1']) || ($comments_settings['colour1_font'])) {
echo "<td valign='top' class='tbl2-colour1 border-radiustlbl'><span class='small'>".$locale['com015']."</span>";
}else{
echo "<td valign='top' class='tbl1 border-radiustlbl'><span class='small'>".$locale['com015']."</span>";
}
}
if (($comments_settings['avatar_c'] == 1) || ($comments_settings['country'] ==1) || ($comments_settings['joined'] ==1) || ($comments_settings['display_ip'] ==1)) {
if (($comments_settings['colour1']) || ($comments_settings['colour1_font'])) {
echo"</td><td valign='top' class='tbl2-colour1 border-radiustrbr'>";
}else{
echo"</td><td valign='top' class='tbl1 border-radiustrbr'>";
}
}else{
if (($comments_settings['colour1']) || ($comments_settings['colour1_font'])) {
echo"</td><td valign='top' class='tbl2-colour1 border-radius'>";
}else{
echo"</td><td valign='top' class='tbl1 border-radius'>";
}
}
echo "<div align='left'>\n";
include INFUSIONS."extended_comments/includes/addthis_comments_include.php";
echo "</div>\n";
echo"</td></tr>";
}
$i++;
}
echo"</table>";
if (iADMIN && checkrights("C")) {
echo "<div align='right' class='tbl2'><a href='".ADMIN."comments.php".$aidlink."&ctype=$ctype&cid=$cid'>".$locale['c106']."</a></div>\n";
}
if ($c_rows > 10) {
echo "<div style='text-align:center;margin-top:5px;'>".makecommentnav($_GET['c_start'], 10, $c_rows, 3, $clink."&")."</div>\n";
}
} else {
echo $locale['c101']."\n";
}
closetable();
}
}
function makecommentnav($start, $count, $total, $range = 0, $link) {
global $locale;
$pg_cnt = ceil($total / $count);
if ($pg_cnt <= 1) { return ""; }
$idx_back = $start - $count;
$idx_next = $start + $count;
$cur_page = ceil(($start + 1) / $count);
$res = $locale['global_092']." ".$cur_page.$locale['global_093'].$pg_cnt.": ";
if ($idx_back >= 0) {
if ($cur_page > ($range + 1)) {
$res .= "<a href='".$link."c_start=0'>1</a>";
if ($cur_page != ($range + 2)) {
$res .= "...";
}
}
}
$idx_fst = max($cur_page - $range, 1);
$idx_lst = min($cur_page + $range, $pg_cnt);
if ($range == 0) {
$idx_fst = 1;
$idx_lst = $pg_cnt;
}
for ($i = $idx_fst; $i <= $idx_lst; $i++) {
$offset_page = ($i - 1) * $count;
if ($i == $cur_page) {
$res .= "<span><strong>".$i."</strong></span>";
} else {
$res .= "<a href='".$link."c_start=".$offset_page."'>".$i."</a>";
}
}
if ($idx_next < $total) {
if ($cur_page < ($pg_cnt - $range)) {
if ($cur_page != ($pg_cnt - $range - 1)) {
$res .= "...";
}
$res .= "<a href='".$link."c_start=".($pg_cnt - 1) * $count."'>".$pg_cnt."</a>\n";
}
}
return "<div class='pagenav'>\n".$res."</div>\n";
}
?>
|