Proszę ;)
Zabezpieczone + użyte ValidateForm() w celu zachowania estetyki.
Modyfikacja robiona pod wersję 6.01.11
1) Otwórz plik includes/comments_include.php i ok. linii #28 znajdź:
if (iMEMBER) {
Zamień to na:
if (iMEMBER) {
$null = false;
2) Ok. linii #49 znajdź:
if (!$flood) $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."')");
}
redirect($clink);
Zamień to na:
if (iMEMBER) {
$rating = dbquery("SELECT rating_vote,rating_datestamp FROM ".DB_PREFIX."ratings WHERE rating_item_id='$cid' AND rating_type='$ctype' AND rating_user='".$userdata['user_id']."'");
$d_rating = dbarray($rating);
if (dbrows($rating)==0 || $d_rating['rating_vote']==0){
if ($_POST['c_rating']!=0){
if (isNum($_POST['c_rating']) && $_POST['c_rating'] > 0 && $_POST['c_rating'] < 6) {
$result = dbquery("INSERT INTO ".DB_PREFIX."ratings (rating_item_id, rating_type, rating_user, rating_vote, rating_datestamp, rating_ip) VALUES ('$cid', '$ctype', '".$userdata['user_id']."', '".$_POST['c_rating']."', '".time()."', '".USER_IP."')");
}
if (!$flood) $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."')");
} else {
$null = true;
$comment_message_form = $comment_message;
}
} else {
if (!$flood) $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."')");
}
} else {
if (!$flood) $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."')");
}
}
if (!$null) redirect($clink);
3) Ok. linii #90 znajdź:
if (iMEMBER || $settings['guestposts'] == "1") {
Zamień to na:
if (iMEMBER || $settings['guestposts'] == "1") {
$check = "";
if (iMEMBER) {
$rating = dbquery("SELECT rating_vote,rating_datestamp FROM ".DB_PREFIX."ratings WHERE rating_item_id='$cid' AND rating_type='$ctype' AND rating_user='".$userdata['user_id']."'");
$d_rating = dbarray($rating);
if (dbrows($rating)==0 || $d_rating['rating_vote']==0){
$check = " onSubmit='return ValidateForm(this)'";
}
}
echo "<form name='inputform' method='post' action='$clink'$check>
4) Ok. linii #102 znajdź
<td align='center'><textarea name='comment_message' rows='6' class='textbox' style='width:400px'></textarea><br>
Zamień to na:
<td align='center'><textarea name='comment_message' rows='6' class='textbox' style='width:400px'>$comment_message_form</textarea><br>
5) Ok. linii #117 znajdź:
<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>
Zamień to na:
<td align='center'><input type='checkbox' name='disable_smileys' value='1'>".$locale['c107']."<br><br>";
if (dbrows($rating)==0 || $d_rating['rating_vote']==0){
$c_ratings = array(5 => $locale['r120'], 4 => $locale['r121'], 3 => $locale['r122'], 2 => $locale['r123'], 1 => $locale['r124']);
echo $locale['r106'].": <select name='c_rating' class='textbox'>
<option value='0'>".$locale['r107']."</option>\n";
foreach($c_ratings as $rating=>$rating_info) {
echo "<option value='".$rating."'>$rating_info</option>\n";
}
echo "</select><br><br>";
}
echo "<input type='submit' name='post_comment' value='".$locale['c102']."' class='button'></td>
6) Ok. linii #121 znajdź:
</form>\n";
Zamień to na:
</form>
<script language='JavaScript'>
function ValidateForm(frm) {
if (frm.c_rating.value==0) {
alert('Proszę wybrać ocene!');
return false;
}
}
</script>\n";
Działa w 100% B)
W załączniku paczuszka już zmodyfikowanego comments_include.php
FightingElf dodał/a następującą plik:
|