add_hook("display_entry", "pre"); // convert encoding to UTF-8 i18n_array_to_utf8($Pivot_Vars, $dummy_variable); if (isset($Pivot_Vars['uid'])) { $Pivot_Vars['uid'] = str_replace("standard-", "", $Pivot_Vars['uid']); $Pivot_Vars['id'] = $Pivot_Vars['uid']; } $override_weblog = ""; // check if we need to override the template. if (isset($Pivot_Vars['t'])) { // explicitly defined template is most important. $Pivot_Vars['t'] = basename($Pivot_Vars['t']); $override_template = $Pivot_Vars['t']; } else { if (isset($Pivot_Vars['w']) && $Pivot_Vars['w'] != "") { $override_weblog = weblog_from_para($Pivot_Vars['w']); // Checking if weblog exists if (!isset($Weblogs[$override_weblog])) { piv_error("Weblog doesn't exist", "Selected weblog \"" . htmlspecialchars($Pivot_Vars['w']) . "\" doesn't exist."); } } else { $override_weblog = find_current_weblog_referer(); } } // If non-crufty URLs (mod_rewrite) is enabled and someone tries to // access the crufty URL, redirect (if not in preview mode). // This is search engine friendly. list($request_script) = explode("?", $_SERVER['REQUEST_URI']); if (!isset($Pivot_Vars['f_title']) && $Cfg['mod_rewrite'] && basename($request_script) == "entry.php") { if ($override_weblog == "") { reset($Weblogs);
return true; } // Determine what weblogs to ping. If $Pivot_vars['weblogs'] is not set, we // send pings for all weblogs. if (!isset($Pivot_Vars['weblogs'])) { $ping_weblogs = array(); foreach ($Weblogs as $name => $weblog) { $ping_weblogs[] = $name; } } else { $ping_weblogs = explode('|', urldecode($Pivot_Vars['weblogs'])); } echo "<p>Now sending update-pings. This might take a while, so please be patient.<br />"; foreach ($ping_weblogs as $ping_weblog) { echo "<hr size='1' noshade='noshade' />"; $ping_weblog = weblog_from_para($ping_weblog); $title = $Weblogs[$ping_weblog]['name']; $Current_weblog = $ping_weblog; $file = $Weblogs[$ping_weblog]['front_filename']; $logpath = $Weblogs[$ping_weblog]['front_path']; if (siteurl_isset()) { $url = $Weblogs[$ping_weblog]['siteurl']; } else { $url = $Paths['pivot_url'] . $logpath . $file; $url = gethost() . fixpath($url); } $url = str_replace("/index.php", "/", $url); $url = str_replace("/index.html", "/", $url); $servers = explode("\n", $Cfg['ping_urls']); echo "<p>url: {$url}<br /></p>"; flush();
} echo $output; flush(); } // -------- // 'main'.. // -------- //split the input. if (strpos($_GET['p'], "-") == 4) { list($ye, $mo, $da) = explode("-", $_GET['p']); list($da, $name, $weblog) = explode("/", $da); } else { list($ye, $mo, $da, $name, $weblog) = explode("/", $_GET['p']); } if ($weblog != "") { $weblog = weblog_from_para($weblog); $_GET['w'] = $weblog; $Current_weblog = $weblog; } else { reset($Weblogs); $Current_weblog = key($Weblogs); } // check to see if we want to filter on category. if (in_array($ye, explode("|", $Cfg['cats']))) { // if the second 'directory' is a category, we use that to filter whatever comes after.. $filtercat = $ye; // we need to shift the year, month and day; $ye = $mo; $mo = $da; $da = $name; }
/** * Creates the URL to the current or selected entry (by ID) with an * optional query string, and optionally to a specific weblog. * * @param string $code * @param string $query * @param string $weblog * @return string */ function snippet_entrylink($code = '', $query = '', $weblog = '') { global $Cfg, $db; if ($code == '') { $code = $db->entry['code']; } if ($weblog != '') { $weblog = weblog_from_para($weblog); } $link = make_filelink($code, $weblog, ""); if ($query != '') { if (strpos($link, "?") > 0) { $link .= '&' . $query; } else { $link .= '?' . $query; } } return $link; }
/** * piv_error prints an error message, does a debug backtrace print out * and exits. * * On the admin pages it will just display the text on the current page and * add the page footer (if endpage is equal to 1). On weblog pages it will use * the extra page template for the current weblog. * * @param string $name * @param string $message * @param boolean $endpage */ function piv_error($name, $message, $endpage = 0) { global $db, $Current_weblog, $Weblogs, $Pivot_Vars; if (!isset($db)) { $db = new db(); } if (!isset($Current_weblog)) { reset($Weblogs); if (isset($Pivot_Vars['w'])) { $Current_weblog = weblog_from_para($Pivot_Vars['w']); if (!$Current_weblog) { $Current_weblog = key($Weblogs); } } else { $Current_weblog = key($Weblogs); } } debug_printbacktrace(); $text = "<div class='pivot-error'>\n<h2>{$name}</h2>\n\n" . "<p>{$message}</p>\n</div>\n"; if ($endpage == 1 || !defined('LIVEPAGE') && !defined('INWEBLOG')) { echo $text; PageFooter(); exit; } // Use the extra 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']); } // Match and replace the [[weblog]] tags for the error output $template_html = replace_subweblogs_templates($template_html, $text); 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(); exit; }
function print_back() { global $Weblogs; if (isset($_GET['w']) && !empty($_GET['w'])) { $our_weblogs = array($Weblogs[weblog_from_para($_GET['w'])]); } else { $our_weblogs = $Weblogs; } echo "<br />\n"; foreach ($our_weblogs as $weblog) { printf("<p>« " . lang('commentuser', 'back') . " <a href=\"%s%s\">%s</a></p>", $weblog['front_path'], $weblog['front_filename'], $weblog['name']); } }