Parašė JaWa· 2008 Gru. 17 12:12:29
#1
Sveiki, turiu klausima , o galima sita Tinklapio robotuka kaip nors prie komentaru prijungti , ash bandziau, su tuo paciu kodu kaip ir shaukykloje , taciau neishejo ... Stai cia komentaro skriptas. paryskinau ten kur keiciau kad veiktu komentaruose ... Gal kas galit padet ?
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright ? 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| Comments system developed by CrappoMan
| email: simonpatterson@dsl.pipex.com
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { header("Location:../index.php"); exit; }
include LOCALE.LOCALESET."comments.php";
require_once INCLUDES."button.php";
function showcomments($ctype,$cdb,$ccol,$cid,$clink) {
global $settings,$locale,$userdata,$aidlink,$status;
if ((iMEMBER || $settings['guestposts'] == "1") && isset($_POST['post_comment'])) {
$flood = false;
if (dbrows(dbquery("SELECT $ccol FROM ".DB_PREFIX."$cdb WHERE $ccol='$cid'"))==0) {
fallback(BASEDIR."index.php");
}
if (iMEMBER) {
$comment_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$comment_name = trim(stripinput($_POST['comment_name']));
$comment_name = preg_replace("(^[0-9]*)", "", $comment_name);
if (isNum($comment_name)) $comment_name="";
}
$comment_message = trim(stripinput(censorwords($_POST['comment_message'])));
$comment_smileys = isset($_POST['disable_smileys']) ? "0" : "1";
if ($comment_name != "" && $comment_message != "") {
//pradedam boto koda
$h = date("H", time());
if ($h > 00 && $h <= 05) {
$time = "Laba naktis";
$timemsg = "Ne laikas miegoti dar?";
} elseif ($h > 05 && $h <= 10) {
$time = "Labas rytas";
$timemsg = "Kaip miegojai?";
} elseif ($h > 10 && $h <= 18) {
$time = "Laba diena";
$timemsg = "Kaip einasi?";
} elseif ($h > 18 && $h <= 21) {
$time = "Labas vakaras";
$timemsg = "Kaip sekasi?";
} elseif ($h > 21 && $h <= 23) {
$time = "Laba naktis";
$timemsg = "Ne laikas miegoti dar?";
}
$msg = strtolower($_POST['$comment_message']);
$msg = str_replace(array(":","<",">","@","#","$","%","^","&","*","(",")","_","=","+","/","-", "?", ",", "'", "`", "!", "."), "", $msg);
$msg = str_replace(array("ą", "č", "ę", "ė", "į", "š", "ų", "ū", "ž"), array("a", "c", "e", "e", "i", "s", "u", "u", "z"), $msg);
// atsakymai
// atsakymu pabaiga
// klausimus rasom be zenklu, kurie yra $pakeisti array'uje
$QA = array (
"(.{0,10}(sveik|laba|swx|svx|labas|sv|hello|helo).*[^[a-z,0-9]]*.*bot.*|.*[^[a-z,0-9]]*.*bot.*\040(sveik|laba|swx|svx|sveix).*)" => "<b>$time, $userdata[user_name]. $timemsg</b>",
"(sveik|laba|swx|hi|svx|labas|sv|hello|helo).* (vis|all|ever|;)|:)|:D).*" => "<b>".$atsakymas4[array_rand($atsakymas4)]."</b>",
"(bot|botas).*" => "<b>kas kviete ?</b>",
"(dux|duch|lox|loch|ass|bitch|dick|ble|nx|nach|nah|debilas|mulkis
|vepla|smikis|pislius|subin|pider|snarglius|pirdzius|ozys|makstilaizis|Uostyk Vincą|sik|fuck|fak|jobanas|xui|xuj|suka|kekse|kekshe|pider|gaid|lope|aš|aš|bibi|pidar|nax|lopas|liurbis|sliura|sliuxa|kvailis|kvail|bibis|aš|ašs|aš|daunas|asilas|sluxa|gaidys|gaidis|aš|nax|pisk|cbb|bbd|debi|peder|pydar|rupus miltai|posimts pypkiu|paci|aš).*|bl" => "<b><font style=\"color:red;\">".$userdata['user_name']."</font> ".$atsakymas5[array_rand($atsakymas5)]." </b>",
);
$rezas = false;
foreach ($QA as $q => $a) {
if (ereg($q, $msg)) {
$rezas = true;
$atsakymas = $a;
break;
}
}
//botas baigesi
$result = dbquery("SELECT MAX(comment_datestamp) AS last_comment FROM ".DB_PREFIX."comments WHERE comment_ip='".USER_IP."'");
if (!iSUPERADMIN && dbrows($result) > 0) {
$data = dbarray($result);
if ((time() - $data['last_comment']) < $settings['flood_interval']) {
$flood = true;
$result = dbquery("INSERT INTO ".$db_prefix."flood_control (flood_ip, flood_timestamp) VALUES ('".USER_IP."', '".time()."')");
if (dbcount("(flood_ip)", "flood_control", "flood_ip='".USER_IP."'") > 4) {
if (iMEMBER) $result = dbquery("UPDATE ".$db_prefix."users SET user_status='1' WHERE user_id='".$userdata['user_id']."'");
}
}
}
if (!$flood) {
if (iADMIN or $settings[comment_accept] == 0 or $settings['guestposts'] == "1" and iGUEST and $settings[comment_accept] == 0) {
$result = dbquery("INSERT INTO ".DB_PREFIX."comments (comment_item_id, comment_type, comment_name, comment_message, comment_smileys, comment_datestamp, comment_ip) VALUES ('$cid', '$ctype', '$comment_name', '$comment_message', '$comment_smileys', '".time()."', '".USER_IP."')");
//boto uzklausa
if ($rezas) $result = dbquery("INSERT INTO ".DB_PREFIX."comments (comment_item_id, comment_type, comment_name, comment_message, comment_smileys, comment_datestamp, comment_ip) VALUES ('$cid', '$ctype', '8', '$atsakymas', '$comment_smileys', '".time()."', '".USER_IP."')");
//Start usergold addon
paygold($userdata['user_name'],$userdata['user_id'],$user_gold_comment);
//end usergold addon
redirect("$clink");
} else if (iMEMBER && !iADMIN or $settings['guestposts'] == "1" and iGUEST) {
$submit_comment['comment_item_id'] = stripinput("$cid");
$submit_comment['comment_type'] = stripinput("$ctype");
$submit_comment['comment_name'] = stripinput("$comment_name");
$submit_comment['comment_message'] = stripinput("$comment_message");
$submit_comment['comment_smileys'] = stripinput("$comment_smileys");
$timmee = time();
$submit_comment['comment_datestamp'] = stripinput("$timmee");
$ipp = "".USER_IP."";
$submit_comment['comment_ip'] = stripinput("$ipp");
$result = dbquery("INSERT INTO ".DB_PREFIX."submissions (submit_type, submit_user, submit_datestamp, submit_criteria) VALUES ('c', '".$userdata['user_id']."', '".time()."', '".serialize($submit_comment)."')");
if ($rezas) $result = dbquery("INSERT INTO ".DB_PREFIX."submissions (submit_type, submit_user, submit_datestamp, submit_criteria) VALUES ('c', '8', '".time()."', '".serialize($submit_comment)."')");
redirect("$clink&status=dodano");
}
}
}
}
tablebreak();
if (isset($status)) {
if ($status == "dodano") {
$title = $locale['0000'];
$message = $locale['0001'];
}
opentable($title);
echo "<div align='center'>".$message."</div>\n";
closetable();
tablebreak();
}
opentable($locale['c100']);
$result = dbquery(
"SELECT tcm.*,user_name FROM ".DB_PREFIX."comments tcm
LEFT JOIN ".DB_PREFIX."users tcu ON tcm.comment_name=tcu.user_id
WHERE comment_item_id='$cid' AND comment_type='$ctype'
ORDER BY comment_datestamp ASC"
);
if (dbrows($result) != 0) {
$i = 0;
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n";
while ($data = dbarray($result)) {
echo "<tr>\n<td class='".($i% 2==0?"tbl1":"tbl2")."'><span class='comment-name'>\n";
if ($data['user_name']) {
echo "<a href='".BASEDIR."profile.php?lookup=".$data['comment_name']."'>".$data['user_name']."</a>";
} else {
echo $data['comment_name'];
}
if ($data['comment_smileys'] == "1") {
$comment_message = parsesmileys($data['comment_message']);
} else {
$comment_message = $data['comment_message'];
}
$comment_message = nl2br(parseubb($comment_message));
echo "</span>\n<span class='small'>".$locale['041'].showdate("longdate", $data['comment_datestamp'])."</span><br>\n";
echo $comment_message."</td>\n</tr>\n";
$i++;
}
if (checkrights("C")) echo "<tr>\n<td align='right' class='".($i% 2==0?"tbl1":"tbl2")."'><a href='".ADMIN."comments.php".$aidlink."&ctype=$ctype&cid=$cid'>".$locale['c106']."</a></td>\n</tr>\n";
echo "</table>\n";
} else {
echo $locale['c101']."\n";
}
closetable();
tablebreak();
opentable($locale['c102']);
if (iMEMBER || $settings['guestposts'] == "1") {
echo "<form name='inputform' method='post' action='$clink'>
<table align='center' cellspacing='0' cellpadding='0' class='tbl'>\n";
if (iGUEST) {
echo "<tr>
<td>".$locale['c103']."</td>
</tr>
<tr>
<td><input type='text' name='comment_name' maxlength='30' class='textbox' style='width:100%;'></td>
</tr>\n";
}
echo "<tr>
<td align='center'><textarea name='comment_message' rows='6' class='textbox' style='width:400px'></textarea><br>
".show_buttons(1,"comment_message")."
<br><br>
".displaysmileys("comment_message")."
</tr>
<tr>
<td align='center'><input type='checkbox' name='disable_smileys' value='1'>".$locale['c107']."<br><br>
<input type='submit' name='post_comment' value='".$locale['c102']."' class='button'></td>
</tr>
</table>
</form>\n";
} else {
echo $locale['c105']."\n";
}
closetable();
}
?>