function check_user_hash($name, $hash) { $name_md5 = strtolower(md5(strtolower($name))); if (is_user($name)) { $user = load_serialize('db/users/' . $name_md5 . '.php'); return md5($user['pass']) == $hash; } else { return FALSE; } }
function generate_last_trackbacks($temptrack) { global $entry, $Cfg; // if it exists, load it $lasttrack = load_serialize("db/ser_lasttrack.php", true, true); $lasttrack[] = array('title' => $temptrack['title'], 'excerpt' => trimtext($temptrack['excerpt'], 250), 'name' => $temptrack['name'], 'url' => $temptrack['url'], 'date' => $temptrack['date'], 'code' => $entry['code'], 'category' => $entry['category'], 'ip' => $temptrack['ip']); if (count($lasttrack) > $Cfg['lastcomm_amount_max']) { array_shift($lasttrack); } save_serialize("db/ser_lasttrack.php", $lasttrack); }
/** * Creates the file that holds the queue for comment moderation. * * @param array $tempcomm */ function generate_moderation_queue($tempcomm) { global $my_weblog, $db; // if it exists, load it if (file_exists("db/ser_modqueue.php")) { $lastcomm = load_serialize("db/ser_modqueue.php", true, true); } else { $lastcomm = array(); } $lastcomm[] = array('name' => $tempcomm['name'], 'email' => $tempcomm['email'], 'url' => $tempcomm['url'], 'date' => $tempcomm['date'], 'comment' => $tempcomm['comment'], 'code' => $db->entry['code'], 'title' => trimtext($db->entry['title'], 50), 'category' => $db->entry['category'], 'ip' => $tempcomm['ip']); save_serialize("db/ser_modqueue.php", $lastcomm); }
function log_search() { global $Paths; $search_str = trim($_POST['search'] . " " . $_GET['q']); // is there anything to save? if ('' != $search_str) { // set path $log_path = $Paths['pivot_path'] . 'db/'; // is there an old to load? if (file_exists($log_path . 'log_search.php')) { // file exists - load if writable if (is_writable($log_path . 'log_search.php')) { $log_search_array = load_serialize($log_path . 'log_search.php'); $log_exists = TRUE; } } // just in case if (!is_array($log_search_array)) { $log_search_array = array(); } // add to the log $log_search_array[$search_str]++; if (isset($log_exists) && TRUE == $log_exists) { // easy route - now serialize and save save_serialize($log_path . 'log_search.php', $log_search_array); } else { // else attempt to make it - suppress errors @makedir($log_path, 0700); @touch($log_path . 'log_search.php'); @chmod($log_path . 'log_search.php', 0777); // final check if (is_writable($log_path . 'log_search.php')) { save_serialize($log_path . 'log_search.php', $log_search_array); } } } }
/** * Get the TagCosmos. Preferably use the cached version, otherwise just make it * on the fly. (and then we store the cached version) * * If $max is given, it will return at most that many tags, ordered by size. * If $weblogname is given, only tags for that weblog will be returned. * * Returns an array with the following elements: * 'minvalue' => minimum value of a tag * 'maxvalue' => maximum value of a tag * 'amount' => number of tags * 'tags' => array of the tags. The indices are the tags, the values the number of occurences * * @param integer $max * @param string $weblogname * @return array * */ function getTagCosmos($max = 0, $weblogname = '') { global $Paths, $Cfg, $Weblogs; if ($weblogname == '' || $Cfg['weblog_count'] == 1) { $weblogname = '_all_'; } // If the cached version is fresh enough, we restore that if (file_exists($Paths['pivot_path'] . "db/ser_tags.php") && filectime($Paths['pivot_path'] . "db/ser_tags.php") > time() - 60 * $Cfg['tag_cache_timeout']) { // Just load it.. $data = load_serialize("db/ser_tags.php"); $tagcosmos = $data[$weblogname]; } else { // We have to read it.. $tagcosmos = array(); if ($Cfg['weblog_count'] > 1) { $temp_db = new db(FALSE); } foreach ($Weblogs as $weblog => $weblogdata) { $tagcosmos[$weblog] = array(); } $tagdir = dir($Paths['pivot_path'] . "db/tagdata/"); // Read all tags, build the tag index and save it or later. while (false !== ($entry = $tagdir->read())) { if (getextension($entry) == "tag") { list($tagname) = explode(".", $entry); $tagfile = implode("", file($Paths['pivot_path'] . "db/tagdata/" . $entry)); $tagfile = explode(",", $tagfile); // If magic_quotes_gpc is set, we need to strip slashes.. if (get_magic_quotes_gpc()) { $tagname = stripslashes($tagname); } if ($tagname != "") { $tagcosmos['_all_']['tags'][$tagname] = count($tagfile); if ($Cfg['weblog_count'] > 1) { foreach ($tagfile as $entrycode) { $temp_entry = $temp_db->read_entry($entrycode); $cat_weblogs = find_weblogs_with_cat($temp_entry['category']); foreach ($cat_weblogs as $cat_weblog) { $tagcosmos[$cat_weblog]['tags'][$tagname]++; } } } } } } $tagdir->close(); save_serialize($Paths['pivot_path'] . "db/ser_tags.php", $tagcosmos); $tagcosmos = $tagcosmos[$weblogname]; } $tagcosmos['amount'] = count($tagcosmos['tags']); // if $max is given, we need to filter out the smaller tags, until the required size is reached. if ($max != 0 && $max < count($tagcosmos['tags'])) { arsort($tagcosmos['tags']); $tagcosmos['tags'] = array_slice($tagcosmos['tags'], 0, $max); } ksort($tagcosmos['tags']); $tagcosmos['minvalue'] = 1000; $tagcosmos['maxvalue'] = 0; // We determine what the min and max-value in the cosmos is. foreach ($tagcosmos['tags'] as $key => $value) { $tagcosmos['maxvalue'] = max($tagcosmos['maxvalue'], $value); $tagcosmos['minvalue'] = min($tagcosmos['minvalue'], $value); } return $tagcosmos; }
function spam() { global $Paths, $Pivot_Vars; $entry_url = '<a target="_blank" href="index.php?menu=entries&func=modify&id=%s">%s</a>'; $com_url = '<a target="_blank" href="index.php?menu=entries&func=editcomments&id=%s&edit=%s">%s</a>'; $tb_url = '<a target="_blank" href="index.php?menu=entries&func=edittrackbacks&id=%s&edit=%s">%s</a>'; if ($_REQUEST["what"] == "Trackbacks" || $_REQUEST["what"] == "Both") { $trackbacks = true; } else { $trackbacks = false; } if ($_REQUEST["what"] == "Comments" || $_REQUEST["what"] == "Both") { $comments = true; } else { $comments = false; } $tot_com_spam = 0; $tot_tb_spam = 0; if ($_REQUEST["submit"] == "Remove Spam") { if ($comments) { $last_comms = load_serialize("./db/ser_lastcomm.php", true, true); } if ($trackbacks) { $last_tracks = load_serialize("./db/ser_lasttrack.php", true, true); } } $spam_db = new db(); $entries = $spam_db->getlist($spam_db->get_entries_count()); foreach ($entries as $entry) { $entry_id = $entry['code']; $data = $spam_db->read_entry($entry_id); foreach ($data as $key => $value) { if ($key == "trackbacks" && count($data["trackbacks"]) > 0 && $trackbacks) { foreach ($data["trackbacks"] as $tbid => $tb) { $text = implode(" ", $tb); if (strpos(strtolower($text), strtolower($_REQUEST["spamword"])) !== false) { $output .= sprintf("<tr class='%s'><td valign='top'>%s</td><td valign='top'>%s</td>\r\n \t\t\t<td valign='top'>%s</td>", ($tot_tb_spam + $tot_com_spam) % 2 ? "tabular_line_even" : "tabular_line_odd", sprintf($entry_url, $entry_id, $entry_id), sprintf($tb_url, $entry_id, $tbid, "Trackback " . $tbid), $text); $tot_tb_spam++; unset($data["trackbacks"][$tbid]); //remove the trackback from last_trackbacks if it's in there.. if ($_REQUEST["submit"] == "Remove Spam" && count($last_tracks) > 0) { foreach ($last_tracks as $lt_key => $last_track) { if ($last_track['code'] == $data['code'] && $last_track['name'] == $tb['name'] && $last_track['date'] == $tb['date']) { unset($last_tracks[$lt_key]); } } } } } } if ($key == "comments" && count($data["comments"]) > 0 && $comments) { foreach ($data["comments"] as $comid => $com) { $text = implode(" ", $com); if (strpos(strtolower($text), strtolower($_REQUEST["spamword"])) !== false) { $output .= sprintf("<tr class='%s'><td valign='top'>%s</td><td valign='top'>%s</td>\r\n \t\t\t<td valign='top'>%s</td>", ($tot_tb_spam + $tot_com_spam) % 2 ? "tabular_line_even" : "tabular_line_odd", sprintf($entry_url, $entry_id, $entry_id), sprintf($com_url, $entry_id, $comid, "Comment " . $comid), wordwrap($text, 90, " <br />", true)); $tot_com_spam++; unset($data["comments"][$comid]); //remove the comment from last_comments if it's in there.. if ($_REQUEST["submit"] == "Remove Spam" && count($last_comms) > 0) { foreach ($last_comms as $lc_key => $last_comm) { if ($last_comm['code'] == $data['code'] && $last_comm['name'] == $com['name'] && $last_comm['date'] == $com['date']) { unset($last_comms[$lc_key]); } } } } } } } if ($_REQUEST["submit"] == "Remove Spam") { $spam_db->set_entry($data); $spam_db->save_entry(); } } if ($_REQUEST["submit"] == "Remove Spam") { echo "<br />"; if ($trackbacks) { save_serialize("./db/ser_lasttrack.php", $last_tracks); echo "<p>Removed {$tot_tb_spam} Spam Trackbacks</p>\n"; } if ($comments) { save_serialize("./db/ser_lastcomm.php", $last_comms); echo "<p>Removed {$tot_com_spam} Spam Comments</p>\n"; } $link = sprintf("index.php?session=%s&menu=admin&func=admin&do=spamwasher", $Pivot_Vars['session']); echo "<br /><p><b>Done!</b></p>"; echo '<p>To remove the spam from the generated pages as well, you should: <a href="index.php?menu=admin&func=admin&do=build_index">Rebuild the Index</a> and then <a href="index.php?menu=admin&func=admin&do=regen">Rebuild All Files</a></em>.<br /> Or go back to the <a href="' . $link . '">Spam Washer page</a> to remove more spam before rebuilding.</p>'; } elseif ($_REQUEST["submit"] == "List Spam") { echo "<br />"; if ($trackbacks) { echo "<p>Found {$tot_tb_spam} Spam Trackbacks</p>\n"; } if ($comments) { echo "<p>Found {$tot_com_spam} Spam Comments</p>\n"; } if ($tot_com_spam > 0 || $tot_tb_spam > 0) { echo '<br /> <h3>Complete Spam Listing for "' . $_REQUEST["spamword"] . '"</h3> <table class="tabular_border" cellspacing="0" cellpadding="2"> <tr class="tabular_header"><th>Entry</th><th>Type</th><th>Text</th></tr>' . $output . "</table>\n"; } } }
/** * Searches the index and returns the matching entries in an array. * * Used in the entries screen/overview search. * * @param string $str Text/words to search for * @return array */ function search_entries($str) { global $index_file, $matches, $db, $search_all; $search_all = true; $str = transliterate_accents(trim($str)); $words = explode(" ", $str); foreach ($words as $key => $val) { if (trim($val) == "") { unset($words[$key]); } else { $words[$key] = trim($val); } } if (count($words) > 0) { foreach ($words as $word) { if (file_exists("db/search/" . $word[0] . ".php")) { $index_file[$word[0]] = load_serialize("db/search/" . $word[0] . ".php"); } } } foreach ($words as $word) { $res = getword($word); if ($res) { $found_words[] = $word; } } // mix 'n match.. If the result set for 'AND' is empty, just lump // them together, so we have an 'OR'.. if (count($matches) == 1) { $result = $matches[0]; } else { if (count($matches) == 2) { list($word1, $word2) = $matches; $result = array_intersect($word1, $word2); if (count($result) == 0) { $result = array_merge($word1, $word2); } } else { if (count($matches) == 3) { list($word1, $word2, $word3) = $matches; $result = array_intersect($word1, $word2, $word3); if (count($result) == 0) { $result = array_merge($word1, $word2, $word3); } } else { if (count($matches) > 3) { list($word1, $word2, $word3, $word4) = $matches; $result = array_intersect($word1, $word2, $word3, $word4); if (count($result) == 0) { $result = array_merge($word1, $word2, $word3, $word4); } } } } } if (isset($found_words) && count($found_words) > 0) { $db = new db(); foreach ($result as $hit) { $entry = $db->read_entry($hit); if ($entry['title'] == "") { $entry['title'] = substr(strip_tags($entry['introduction']), 0, 50); } unset($entry['comments']); unset($entry['introduction']); unset($entry['body']); $output[] = $entry; } return $output; } else { return array(); } }
<?php // --------------------------------------------------------------------------- // // PIVOT - LICENSE: // // This file is part of Pivot. Pivot and all its parts are licensed under // the GPL version 2. see: http://www.pivotlog.net/help/help_about_gpl.php // for more information. // // --------------------------------------------------------------------------- include_once "pv_core.php"; if (file_exists("db/ser_lastcomm.php")) { $file = array_reverse(load_serialize("db/ser_lastcomm.php", true, true)); } else { $file = array(); } $override_weblog = find_current_weblog_request(); if (empty($override_weblog)) { $override_weblog = find_current_weblog_referer(); } set_current_weblog($override_weblog); $db = new db(FALSE); header("Content-type: application/xml"); start_comment_feed(); $count = 0; foreach ($file as $item) { add_comment_feeditem($item); $count++; if ($count > 19) { break;
function make_default() { global $Weblogs, $Current_weblog, $db, $entry; $db = new db(); $arc_list = ""; if (file_exists($pivot_dir . "db/ser-archive_overview_cat.php") && file_exists($pivot_dir . "db/ser-archive_overview_cat.php")) { $arc_array_cat = load_serialize($pivot_dir . "db/ser-archive_overview_cat.php", TRUE); $arc_array_mon = load_serialize($pivot_dir . "db/ser-archive_overview_mon.php", TRUE); // if over three three days old. if (mktime() - filemtime($pivot_dir . "db/ser-archive_overview_cat.php") > 259200) { unlink($pivot_dir . "db/ser-archive_overview_cat.php"); unlink($pivot_dir . "db/ser-archive_overview_mon.php"); } } else { $list_entries = $db->getlist_range("1970-01-01-00-00", "2020-12-31-23-59", "", "", FALSE); // iterate through all of the entries, building the arrays for both the // per-month and per-category lists.. foreach ($list_entries as $list_entry) { $date = format_date($list_entry['date'], $Weblogs[$Current_weblog]['fulldate_format']); $link = make_filelink($list_entry['code']); list($ye, $mo) = explode("-", $list_entry['date']); if (isset($list_entry['category'])) { foreach ($list_entry['category'] as $cat) { $arc_array_cat[$cat][$ye] = 1; } } $arc_array_mon[$ye][$mo] = 1; } save_serialize($pivot_dir . "db/ser-archive_overview_cat.php", $arc_array_cat, FALSE); save_serialize($pivot_dir . "db/ser-archive_overview_mon.php", $arc_array_mon, FALSE); } $current_cats = find_cats_in_weblog($Current_weblog); // build the per-month list foreach ($arc_array_mon as $ye => $months) { $arc_list .= "<p><b>{$ye}:</b><br />\n"; ksort($months); $temp_arr = array(); foreach ($months as $mo => $dummy) { $temp_arr[] = sprintf("<a href=\"%s/%s/\">%s</a>\n", $ye, $mo, lang('months', -1 + $mo)); } $arc_list .= implode(", ", $temp_arr) . "<br /></p>\n"; } // build the per-category list ksort($arc_array_cat); if (count($arc_array_cat) > 1) { foreach ($arc_array_cat as $cat => $year) { if (in_array($cat, $current_cats)) { $arc_list .= "<p><b>{$cat}:</b>\n"; ksort($year); $temp_arr = array(); foreach ($year as $ye => $dummy) { $temp_arr[] = sprintf("<a href=\"%s/%s/\">%s</a>\n", $cat, $ye, $ye); } $arc_list .= implode(", ", $temp_arr) . "</p>\n"; } } } // the search template for the current weblog if (isset($Weblogs[$Current_weblog]['extra_template']) && $Weblogs[$Current_weblog]['extra_template'] != "") { $template_html = load_template($Weblogs[$Current_weblog]['extra_template']); } else { $template_html = load_template($Weblogs[$Current_weblog]['archive_template']); } $template_html = replace_subweblogs_templates($template_html, $arc_list); $filename = $Weblogs[$Current_weblog]['archive_path'] . make_archive_name(); if (!$template_html) { ErrorOut("Could not load template file: <i>{$template}</i> [does not exist]"); } else { $output = $template_html; $output = parse_step4($output); } echo $output; flush(); }
/** * Displays the screen to edit and delete trackbacks. * * @param string $msg * @see submit_trackback() */ function edit_trackbacks($msg = "") { global $Cfg, $Pivot_Vars, $Users; PageHeader(lang('userbar', 'trackbacks'), 1); PageAnkeiler(lang('userbar', 'trackbacks') . ' » ' . lang('userbar', 'trackbacks_title')); $id = $Pivot_Vars['id']; $db = new db(); // read entry if it's not in memory yet. $db->read_entry($id, true); printf("<p><strong>%s</strong>: %s<br />", lang('entries', 'title'), $db->entry['title']); printf("<strong>%s</strong>: %s<br />", lang('entries', 'author'), $db->entry['user']); printf("<strong>%s</strong>: %s</p><br />", lang('entries', 'date'), $db->entry['date']); if ($Pivot_Vars['user'] == $db->entry['user']) { // allowed to edit own trackbacks MinLevel(2); } else { // allowed to edit trackbacks on other people's entries MinLevel(3); } if (!$db->entry['trackbacks'] || count($db->entry['trackbacks']) < 1) { // print if there are no trackbacks echo "<p><B>" . lang('notice', 'trackback_none') . "</b><br /><br /></p>"; } else { // print the trackbacks.. // perhaps delete a trackback. if (isset($Pivot_Vars['del'])) { $del_track = $db->entry['trackbacks'][$Pivot_Vars['del']]; //remove the trackback from last_trackbacks if it's in there.. if (file_exists("db/ser_lasttrack.php")) { $last_tracks = load_serialize("db/ser_lasttrack.php", true, true); } else { $last_tracks = array(); } if ($last_tracks !== false && count($last_tracks) > 0) { foreach ($last_tracks as $key => $last_track) { if ($last_track['code'] == $db->entry['code'] && $last_track['name'] == $del_track['name'] && $last_track['date'] == $del_track['date']) { unset($last_tracks[$key]); save_serialize("db/ser_lasttrack.php", $last_tracks); } } } // *argh* evil hack to directly delete trackbacks.. I should write a // proper wrapper unset($db->entry['trackbacks'][$Pivot_Vars['del']]); unset($db->db_lowlevel->entry['trackbacks'][$Pivot_Vars['del']]); $db->save_entry(); $msg = lang('notice', 'trackback_deleted'); } // perhaps add an ip-block for single ip. if (isset($Pivot_Vars['blocksingle'])) { $msg = "Added block for IP " . $Pivot_Vars['blocksingle']; add_block($Pivot_Vars['blocksingle']); } // perhaps add an ip-block for single ip. if (isset($Pivot_Vars['blockrange'])) { $iprange = make_mask($Pivot_Vars['blockrange']); $msg = "Added block for IP-range " . $iprange; add_block($iprange); } // perhaps remove an ip-block for single ip. if (isset($Pivot_Vars['unblocksingle'])) { $msg = "Removed block for IP " . $Pivot_Vars['unblocksingle']; rem_block($Pivot_Vars['unblocksingle']); } // perhaps remove an ip-block for single ip. if (isset($Pivot_Vars['unblockrange'])) { $iprange = make_mask($Pivot_Vars['unblockrange']); $msg = "Removed block for IP-range " . $iprange; rem_block($iprange); } // print a message, if there is one. if ($msg != "") { echo "<p><B>{$msg}</b><br /><br /></p>"; } // show the edit form, to edit a trackback.. if (isset($Pivot_Vars['edit'])) { StartForm('submittrackback', 0); StartTable(); $mytrack = $db->entry['trackbacks'][$Pivot_Vars['edit']]; $settings = array(); $settings[] = array('heading', lang('weblog_config', 'shortentry_template'), '', 8, '', 2, ''); $settings[] = array('id', '', '', 7, $id, '', ''); $settings[] = array('count', '', '', 7, $Pivot_Vars['edit'], '', ''); $settings[] = array('name', lang('weblog_text', 'blog_name'), '', 0, unentify($mytrack['name']), 60, ''); $settings[] = array('title', lang('weblog_text', 'title'), '', 0, unentify($mytrack['title']), 60, ''); $settings[] = array('excerpt', lang('weblog_text', 'excerpt'), '', 5, unentify($mytrack['excerpt']), '60', 'rows=5'); $settings[] = array('url', lang('weblog_text', 'url'), '', 0, $mytrack['url'], 60, ''); $settings[] = array('ip', lang('weblog_text', 'ip'), '', 0, $mytrack['ip'], 30, ''); $settings[] = array('date', lang('weblog_text', 'date'), '', 0, $mytrack['date'], 30, ''); DisplaySettings($settings, 'blog_settings'); EndForm(lang('weblog_config', 'save_trackback'), 1); } // print out all the trackbacks.. foreach ($db->entry['trackbacks'] as $key => $trackback) { $myblock = block_type($trackback['ip']); if ($myblock == "single" || $myblock == "range") { $strike = "style='text-decoration: line-through;'"; } else { $strike = ""; } // strip stuff from lamers' trackbacks.. $trackback['url'] = strip_tags($trackback['url']); printf("<table border=0 cellpadding=2 cellspacing=2 width='95%%' style='border-bottom:" . " 2px solid #999;'><tr><td width='40%%' valign='top'>" . lang('weblog_text', 'title') . ": <b %s>%s</b><br />", $strike, stripslashes($trackback['title'])); printf(lang('weblog_text', 'blog_name') . ": %s<br />", $trackback['name']); printf(lang('weblog_text', 'url') . ": %s<br />", $trackback['url']); printf(lang('weblog_text', 'ip') . ": %s<br />", $trackback['ip']); printf(lang('weblog_text', 'date') . ": %s<br />", $trackback['date']); printf("<td valign='top'><span %s>%s</span></td>", $strike, nl2br(htmlspecialchars($trackback['excerpt']))); // only show the option to edit and delete links if the user is an advanced user. if ($Users[$Pivot_Vars['user']]['userlevel'] >= 2) { $link = sprintf("index.php?session=%s&menu=entries&func=edittrackbacks&", $Pivot_Vars['session']); $editlink = sprintf("%sid=%s&edit=%s", $link, $db->entry['code'], $key); $dellink = sprintf("%sid=%s&del=%s", $link, $db->entry['code'], $key); $reportpopup = sprintf("openReportTrackback('%s', '%s','%s','%s');", $Pivot_Vars['session'], $db->entry['code'], $key, $dellink); printf("</tr><tr class='tabular_line_odd'><td><a href='%s'>%s</a> /", $editlink, lang('entries', 'edit_trackback')); printf(" <a href='%s'>%s</a> / ", $dellink, lang('entries', 'delete_trackback')); // only ping. // printf(" <a href='#' onclick=\"%s\">%s</a> ", $reportpopup, lang('entries', 'report_trackback') ); // ping and delete printf(" <a href='#' onclick=\"%s\">%s</a> ", $reportpopup, lang('entries', 'report_trackback')); } else { printf("<td> </td>"); } // only show the option to add or remove ip-blocks if the user is an administrator. if ($Users[$Pivot_Vars['user']]['userlevel'] >= 3) { if ($myblock == "none") { $blocktext1 = str_replace("%s", $trackback['ip'], lang('entries', 'block_single')); $blocklink1 = sprintf("%sid=%s&blocksingle=%s", $link, $db->entry['code'], $trackback['ip']); $blocktext2 = str_replace("%s", make_mask($trackback['ip']), lang('entries', 'block_range')); $blocklink2 = sprintf("%sid=%s&blockrange=%s", $link, $db->entry['code'], $trackback['ip']); printf("<td><a href='%s'>%s</a> / ", $blocklink1, $blocktext1); printf("<a href='%s'>%s</a></td>", $blocklink2, $blocktext2); } else { if ($myblock == "single") { $blocktext1 = str_replace("%s", $trackback['ip'], lang('entries', 'unblock_single')); $blocklink1 = sprintf("%sid=%s&unblocksingle=%s", $link, $db->entry['code'], $trackback['ip']); printf("<td><a href='%s'>%s</a></td>", $blocklink1, $blocktext1); } else { $blocktext1 = str_replace("%s", make_mask($trackback['ip']), lang('entries', 'unblock_range')); $blocklink1 = sprintf("%sid=%s&unblockrange=%s", $link, $db->entry['code'], $trackback['ip']); printf("<td><a href='%s'>%s</a></td>", $blocklink1, $blocktext1); } } } else { printf("<td> </td>"); } printf("</td></tr></table><br />"); } // end of printing trackbacks } // Table for editing the entry / trackbacks (this will be replaced after 1.30, // When we put the form-builder in place. echo '<table width="95%" border="0" cellpadding="5" cellspacing="0">'; $link = sprintf("index.php?session=%s&menu=entries&func=modify&id=%s", $Pivot_Vars['session'], $db->entry['code']); printf('<!-- edit entry --><tr><td width="32" valign="top">'); print_icon('overview', 'new_entry', "<a href=\"" . $link . "\">"); printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'edit_entry'), lang('entries', 'edit_entry_desc')); $link = sprintf("index.php?session=%s&menu=entries&func=editcomments&id=%s", $Pivot_Vars['session'], $db->entry['code']); printf('<!-- edit comments --><tr><td width="32" valign="top">'); print_icon('entry', 'edit_comments', "<a href=\"" . $link . "\">"); printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'edit_comments'), lang('entries', 'edit_comments_desc')); $link = sprintf("index.php?session=%s&menu=entries&doaction=1&action=delete&check[%s]=1", $Pivot_Vars['session'], $db->entry['code']); printf('<!-- delete entry --><tr><td width="32" valign="top">'); print_icon('entry', 'del_entry', "<a href=\"" . $link . "\">"); printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'delete_entry'), lang('entries', 'delete_entry_desc')); echo "</table>"; // End of table for editing the entry / trackbacks PageFooter(); echo "<br /><br /><br /><br />"; }
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; }
/** * Store the edited comment user and display all users again */ function save_change_comm_user() { global $Pivot_Vars, $Users, $Cfg; // check against unauthorised direct access. check_csrf(); $userfile = $Paths['pivot_path'] . "db/users/" . $Pivot_Vars['file'] . ".php"; if ($Pivot_Vars['delete_commuser'] == 1 && $Users[$Pivot_Vars['user']]['userlevel'] >= 3) { if ($Pivot_Vars['confirmed'] == 1) { unlink($userfile); see_comm_users(); } else { $vars = array('file', $Pivot_Vars['file'], 'delete_commuser', 1); ConfirmPage(lang('ufield_main', 'del_title'), $vars, sprintf(lang('config', 'delete_commuser_confirm'), $Pivot_Vars['username'])); } } else { $user = load_serialize($userfile); $user['verified'] = $Pivot_Vars['verified']; $user['disabled'] = $Pivot_Vars['disabled']; save_serialize($userfile, $user); see_comm_users(); } }
function read_entry_filename($filename, $updateindex = TRUE, $force = FALSE) { global $global_pref; if ($entry = load_serialize($filename, TRUE, $force)) { $this->entry = $entry; $this->update_index(FALSE); return TRUE; } else { //echo "Entry c"; return FALSE; } }
/** * Returns all Registered Visitors as an array. * * @return $array */ function get_registered_visitors() { global $Paths; $comment_users = array(); if ($dh = opendir($Paths['pivot_path'] . "db/users/")) { while (($file = readdir($dh)) !== false) { if (getextension($file) == "php") { $name_md5 = basename($file, ".php"); $comment_users[$name_md5] = load_serialize($Paths['pivot_path'] . 'db/users/' . $file); } } } closedir($dh); return $comment_users; }