function block_type($ip) { global $block_cache; // if checked before, return it from cache.. if (isset($block_cache[$ip])) { return $block_cache[$ip]; } if (!ip_check_block($ip)) { $block_cache[$ip] = "none"; return "none"; } else { if (ip_check_block_strict($ip)) { $block_cache[$ip] = "single"; return "single"; } else { $block_cache[$ip] = "range"; return "range"; } } }
foreach ($addr_arr as $addr) { $addr = trim($addr); @mail($addr, $subject, $body, $add_header); debug("Send Mail to {$addr} for '" . $my_comment['name'] . "'"); } } // Handle the users that want to be notified via email.. notify_new('comment', array($db->entry, $my_comment, $Cfg['moderate_comments'])); } $Pivot_Vars['piv_name'] = strip_tags($Pivot_Vars['piv_name']); $Pivot_Vars['piv_email'] = strip_tags($Pivot_Vars['piv_email']); $Pivot_Vars['piv_url'] = strip_tags($Pivot_Vars['piv_url']); $Current_weblog = $Pivot_Vars['piv_weblog']; // switch to weblog's language LoadWeblogLanguage($Weblogs[$Current_weblog]['language']); if (ip_check_block($Pivot_Vars['REMOTE_ADDR'])) { debug("Blocked user from {$ip} tried to comment"); piv_error("You are Blocked", "Your IP-address has been blocked, so you are not" . " allowed to leave comments on this site. We know IP-adresses can easily be faked," . " but it helps. Have a nice day<br /><br />Go <a href='javascript:history.go(-1)'>" . "back</a> to the last page, and do something else.", 0); } // set cookies (or delete) only if explicitely told so.. if ($Pivot_Vars['piv_rememberinfo'] == "yes") { // If magic_quotes_gpc is set, we need to strip slashes.. if (get_magic_quotes_gpc()) { setcookie("piv_name", stripslashes($Pivot_Vars['piv_name']), time() + 2592000, $Paths['cookie_url']); setcookie("piv_email", stripslashes($Pivot_Vars['piv_email']), time() + 2592000, $Paths['cookie_url']); setcookie("piv_url", stripslashes($Pivot_Vars['piv_url']), time() + 2592000, $Paths['cookie_url']); } else { setcookie("piv_name", $Pivot_Vars['piv_name'], time() + 2592000, $Paths['cookie_url']); setcookie("piv_email", $Pivot_Vars['piv_email'], time() + 2592000, $Paths['cookie_url']); setcookie("piv_url", $Pivot_Vars['piv_url'], time() + 2592000, $Paths['cookie_url']); }
/** * Process CMS tags into HTML for comments. */ function cms_tag_trackbacks($tag_attr, $tag_default) { global $db, $row, $block, $Current_weblog, $Weblogs, $Paths; if (strlen($Weblogs[$Current_weblog]['trackback_format']) > 1) { $format = $Weblogs[$Current_weblog]['trackback_format']; } else { $format = "%anchor%<p><strong>%title%</strong><br />%excerpt%<br /><small>Sent on %date%, via %url%</small></p>"; } // If %editlink% is not present, insert it right after %date%.. if (strpos($format, "%editlink%") == 0) { $format = str_replace("%date%", "%date% %editlink%", $format); } $content_code = get_attr_value('content_code', $tag_attr); $entrydate = $Weblogs[$Current_weblog]['fulldate_format']; if ($content_code == "") { $content_code = $row["code"]; } $output = '<a id="track"></a>'; $last_trackback = ""; if (isset($db->entry['trackbacks']) && count($db->entry['trackbacks']) > 0) { foreach ($db->entry['trackbacks'] as $count => $temp_row) { /** * this is a record we have to output in some form.. */ $temp_row['url'] = strip_tags($temp_row['url']); if (!ip_check_block($temp_row["ip"])) { /** * Make 'edit' and 'delete' links.. */ $editlink = get_edittrackbacklink($db->entry['code'], $count); /** * make link achnor */ $anchor = "<a id=\"" . safe_string($temp_row["name"], TRUE) . "-" . format_date($temp_row["date"], "%ye%%month%%day%%hour24%%minute%") . "\"></a>"; /** * substite all of the parameters into the comment, and add it to the output. */ $this_tag = $format; $this_tag = str_replace("%count%", $count + 1, $this_tag); $this_tag = str_replace("%even-odd%", $count % 2 ? 'even' : 'odd', $this_tag); $this_tag = str_replace("%ip%", $temp_row["ip"], $this_tag); $this_tag = str_replace("%date%", format_date($temp_row["date"], $entrydate), $this_tag); $this_tag = str_replace("%excerpt%", comment_format($temp_row["excerpt"]), $this_tag); $this_tag = str_replace("%title%", $temp_row["title"], $this_tag); $url = '<a href="' . $temp_row["url"] . '">' . stripslashes($temp_row["name"]) . '</a>'; $this_tag = str_replace("%url%", $url, $this_tag); $this_tag = str_replace("%anchor%", $anchor, $this_tag); $this_tag = str_replace("%editlink%", $editlink, $this_tag); $output .= $this_tag; } } } // make an array of strings with the notices to print $text = array($Weblogs[$Current_weblog]['trackbacks_text_0'], $Weblogs[$Current_weblog]['trackbacks_text_1'], $Weblogs[$Current_weblog]['trackbacks_text_2']); // $track_ind = sprintf("<p><b>%s:</b></p>", $text[min(2,count($db->entry['trackbacks']))]); // $track_ind = str_replace("%num%", lang('numbers', count($db->entry['trackbacks'])), $track_ind); // $track_ind = str_replace("%n%", count($db->entry['trackbacks']), $track_ind); $output = $output; return $output; }
function snippet_last_comments() { global $Cfg, $db, $Weblogs, $Current_weblog, $Paths; if (isset($Weblogs[$Current_weblog]['lastcomm_format']) && strlen($Weblogs[$Current_weblog]['lastcomm_format']) > 2) { $last_comments_format = $Weblogs[$Current_weblog]['lastcomm_format']; } else { $last_comments_format = "<a href='%url%' title='%date%' %popup%><b>%name%</b></a> (%title%): %comm%<br />"; } if (isset($Weblogs[$Current_weblog]['lastcomm_length']) && $Weblogs[$Current_weblog]['lastcomm_length'] > 0) { $last_comments_length = $Weblogs[$Current_weblog]['lastcomm_length']; } else { $last_comments_length = 100; } if (isset($Weblogs[$Current_weblog]['lastcomm_trim']) && $Weblogs[$Current_weblog]['lastcomm_trim'] > 0) { $last_comments_trim = $Weblogs[$Current_weblog]['lastcomm_trim']; } else { $last_comments_trim = 16; } if (isset($Weblogs[$Current_weblog]['lastcomm_amount']) && $Weblogs[$Current_weblog]['lastcomm_amount'] > 0) { $last_comments_count = $Weblogs[$Current_weblog]['lastcomm_amount']; } else { $last_comments_count = 10; } if (file_exists($Paths['pivot_path'] . "db/ser_lastcomm.php")) { $file = array_reverse(load_serialize($Paths['pivot_path'] . "db/ser_lastcomm.php", true, true)); } else { $file = array(); } $cats = find_cats_in_weblog($Current_weblog); $output = ""; $count = 0; if (count($file) > 0) { foreach ($file as $comment) { // if it's in a category that published n the frontpage, and the user is not blocked, we display it. if (count(array_intersect($comment['category'], $cats)) > 0 && !ip_check_block(trim($comment['ip'])) && $db->entry_exists($comment['code'])) { $id = safe_string($comment["name"], TRUE) . "-" . format_date($comment["date"], "%ye%%month%%day%%hour24%%minute%"); $url = make_filelink($comment['code'], "", $id); $comment['name'] = trimtext(stripslashes($comment['name']), $last_comments_trim); $comment['title'] = trimtext(stripslashes($comment['title']), $last_comments_trim); // Commenting out mywordwrap since it currently breaks textile commands (and maybe more). // $comment['comment'] = mywordwrap($comment['comment'], 18, " ", 1); $comment['comment'] = comment_format($comment["comment"]); // Remove the [name:1] part in the 'last comments.. $comment['comment'] = preg_replace("/\\[(.*):([0-9]+)\\]/iU", '', $comment['comment']); $comment['comment'] = trimtext(stripslashes($comment['comment']), $last_comments_length); // $comment['comment'] = unentify($comment['comment']); if ($Weblogs[$Current_weblog]['comment_pop'] == 1) { $popup = sprintf("onclick=\"window.open('%s', 'popuplink', 'width=%s,height=%s,directories=no,location=no,scrollbars=yes,menubar=no,status=yes,toolbar=no,resizable=yes'); return false\"", $url, $Weblogs[$Current_weblog]['comment_width'], $Weblogs[$Current_weblog]['comment_height']); } else { $popup = ""; } $thisline = $last_comments_format; $thisline = str_replace("%name%", $comment['name'], $thisline); $thisline = str_replace("%date%", $comment['date'], $thisline); $thisline = str_replace("%title%", $comment['title'], $thisline); $thisline = str_replace("%url%", $url, $thisline); $thisline = str_replace("%popup%", $popup, $thisline); $thisline = str_replace("%comm%", $comment['comment'], $thisline); $thisline = format_date($comment["date"], $thisline); $output .= "\n" . $thisline; $count++; if ($count >= $last_comments_count) { return $output; } } } } return $output; }