1
Installation, Update & Configuration / Re: Eine Benachrichtigung bei Kommentaren
« on: August 26, 2005, 02:54:09 PM »
vielleicht kann mir hier noch jemand auf Deutsch helfen...
ich habe mir diesen mod auch eingebaut, soweit sogut... es klappt auch.
nun hätten meine user (und auch ich) gerne die möglichkeit diese kommentaremails bei bedarf abzuschalten.
habe zwar möglichkeiten hier gefunden, aber die haben nicht funktioniert (brachten php fehler)
mein derzeitiger ausschnitt der detail.php (grob rauskopiert und etwas mehr...)
fall jemand was weiß wäre ich überglücklich... ich bin nicht sonderlich der php held
gruß toasti
ich habe mir diesen mod auch eingebaut, soweit sogut... es klappt auch.
nun hätten meine user (und auch ich) gerne die möglichkeit diese kommentaremails bei bedarf abzuschalten.
habe zwar möglichkeiten hier gefunden, aber die haben nicht funktioniert (brachten php fehler)
mein derzeitiger ausschnitt der detail.php (grob rauskopiert und etwas mehr...)
Code: [Select]
//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
$error = 0;
if ($action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {
$id = intval($HTTP_POST_VARS[URL_ID]);
$sql = "SELECT cat_id, image_allow_comments
FROM ".IMAGES_TABLE."
WHERE image_id = $id";
$row = $site_db->query_firstrow($sql);
if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
$msg = $lang['comments_deactivated'];
}
else {
$user_name = un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
$comment_headline = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
$comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));
// Flood Check
$sql = "SELECT comment_ip, comment_date
FROM ".COMMENTS_TABLE."
WHERE image_id = $id
ORDER BY comment_date DESC
LIMIT 1";
$spam_row = $site_db->query_firstrow($sql);
$spamtime = $spam_row['comment_date'] + 180;
if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN) {
$msg .= (($msg != "") ? "<br />" : "").$lang['spamming'];
$error = 1;
}
$user_name_field = get_user_table_field("", "user_name");
if (!empty($user_name_field)) {
if ($site_db->not_empty("SELECT $user_name_field FROM ".USERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("", "user_id")." <> '".$user_info['user_id']."'")) {
$msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
$error = 1;
}
}
if ($user_name == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['name_required'];
$error = 1;
}
if ($comment_headline == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['headline_required'];
$error = 1;
}
if ($comment_text == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['comment_required'];
$error = 1;
}
if (!$error) {
$sql = "INSERT INTO ".COMMENTS_TABLE."
(image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
VALUES
($id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
$site_db->query($sql);
$commentid = $site_db->get_insert_id();
update_comment_count($id, $user_info['user_id']);
$sql = "SELECT image_name FROM ".IMAGES_TABLE." WHERE image_id = $id";
$image_name = $site_db->query($sql);
$sql = "SELECT user_id FROM ".IMAGES_TABLE." WHERE image_id = $id";
$user_id = $site_db->query($sql);
$recipient_name = $image_row['user_name'];
$recipient_email = $image_row['user_email'];
$image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id."";
// Start Emailer für comments
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_to($recipient_email);
$site_email->set_from($config['site_email'], $config['site_name']);
$site_email->set_subject("Du hast einen neuen Kommentar");
$site_email->register_vars(array(
"user_name" => stripslashes($user_name),
"recipient_name" => stripslashes($image_row['user_name']),
"image_name" => $image_row['image_name'],
"site_name" => $config['site_name'],
"image_url" => $image_url,
"comment_text" =>$comment_text,
"comment_headline"=>$comment_headline,
));
$site_email->set_body("comment_email", $config['language_dir']);
$site_email->send_email();
}
}
unset($row);
unset($spam_row);
}
fall jemand was weiß wäre ich überglücklich... ich bin nicht sonderlich der php held

gruß toasti