// 500000 entrys or filesize > 10,485,760 - some space for the last entry if ($c == MAX_ENTRYS || $strlen >= MAX_SIZE) { output(SITEMAP_FOOTER); $function_close($fp); $c = 0; $i++; $fp = $function_open('sitemap' . $i . $file_extension, 'w'); output(SITEMAP_HEADER); $strlen = strlen(SITEMAP_HEADER); } } } } output(SITEMAP_FOOTER); if ($output_to_file || $autogenerate) { $function_close($fp); } // generates sitemap-index file if ($autogenerate && $i > 1) { $notify_url = HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'sitemap_index' . $file_extension; $fp = $function_open('sitemap_index' . $file_extension, 'w'); $function_write($fp, SITEMAPINDEX_HEADER); for ($ii = 1; $ii <= $i; $ii++) { $function_write($fp, sprintf(SITEMAPINDEX_ENTRY, HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'sitemap' . $ii . $file_extension, iso8601_date(time()))); } $function_write($fp, SITEMAPINDEX_FOOTER); $function_close($fp); } if ($notify_google) { fopen('http://www.google.com/webmasters/sitemaps/ping?sitemap=' . urlencode($notify_url), 'r'); }
if ($string == '') { if ($autogenerate) { @unlink(($output_to_doc_root ? str_replace(DIR_WS_CATALOG, '/', DIR_FS_CATALOG) : DIR_FS_CATALOG) . 'sitemap' . $i . $file_extension); $i--; } else { @unlink(($output_to_doc_root ? str_replace(DIR_WS_CATALOG, '/', DIR_FS_CATALOG) : DIR_FS_CATALOG) . 'sitemap' . $file_extension); $i--; } } // generates sitemap-index file if ($autogenerate && $i > 0) { $notify_url = ($output_to_doc_root ? HTTP_SERVER . '/sitemap_index' : HTTP_SERVER . DIR_WS_CATALOG . 'sitemap_index') . $file_extension; $fp = $function_open(($output_to_doc_root ? str_replace(DIR_WS_CATALOG, '/', DIR_FS_CATALOG) : DIR_FS_CATALOG) . 'sitemap_index' . $file_extension, 'w'); $function_write($fp, SITEMAPINDEX_HEADER); for ($ii = 1; $ii <= $i; $ii++) { $function_write($fp, sprintf(SITEMAPINDEX_ENTRY, ($output_to_doc_root ? HTTP_SERVER . '/sitemap' : HTTP_SERVER . DIR_WS_CATALOG . 'sitemap') . $ii . $file_extension, iso8601_date(time()))); } $function_write($fp, SITEMAPINDEX_FOOTER); $function_close($fp); } if ($i > 0) { echo 'http://www.google.com/webmasters/sitemaps/ping?sitemap=' . urlencode($notify_url) . '<br /><br />'; echo 'http://webmaster.live.com/webmaster/ping.aspx?siteMap=' . urlencode($notify_url) . '<br /><br />'; echo 'http://submissions.ask.com/ping?sitemap=' . urlencode($notify_url) . '<br /><br />'; echo 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=YahooDemo&url=' . urlencode($notify_url) . '<br /><br />'; echo 'Sitemap: ' . $notify_url; // if ($notify_google) { // fopen('http://www.google.com/webmasters/sitemaps/ping?sitemap='.urlencode($notify_url), 'r'); // } } else { echo 'No XML Sitemap saved!';
<?php global $IP; require_once "../extensions/wikihow/NewlyIndexed.class.php"; require_once "../extensions/wikihow/DatabaseHelper.class.php"; require_once 'commandLine.inc'; $timeInSiteIndex = "-2 months"; $dateCutoff = wfTimestamp(TS_MW, strtotime($timeInSiteIndex)); $dbr = wfGetDB(DB_SLAVE); //don't expect this to return a huge number of items $articles = $dbr->select(array(NewlyIndexed::TABLE_NAME, 'page'), array(NewlyIndexed::PAGE_FIELD, 'page_touched'), array(NewlyIndexed::NAB_FIELD => 1, NewlyIndexed::INDEX_FIELD . " >=" . $dateCutoff, "page_id = " . NewlyIndexed::PAGE_FIELD, "page_is_redirect" => 0), __FILE__); $lines = array(); foreach ($articles as $article) { $title = Title::newFromID($article->{NewlyIndexed::PAGE_FIELD}); if (!$title) { continue; } $lines[] = $title->getFullUrl() . ' lastmod=' . iso8601_date($article->page_touched); } foreach ($lines as $line) { print "{$line}\n"; } /*** * function copied from generateUrls.php */ function iso8601_date($time) { $date = substr($time, 0, 4) . "-" . substr($time, 4, 2) . "-" . substr($time, 6, 2) . "T" . substr($time, 8, 2) . ":" . substr($time, 10, 2) . ":" . substr($time, 12, 2) . "Z"; return $date; }
function makeRSS($p, $user) { getFeeds("meine"); $items = getItems(TIMESPAN_QUARTAL, TRUE, TRUE, 15); $rss = new RSSWriter("http://" . ERONA_URL . "myfeeds.php?p={$p}", $user['title'], $user['descr']); $rss->useModule("dc", "http://purl.org/dc/elements/1.1/"); for ($i = 0; $i < count($items) - 1; $i++) { #echo $i; $rss->addItem($items[$i]['iurl'], $items[$i]['ititle'], array("description" => $items[$i]['idescr'], "dc:date" => iso8601_date($items[$i]['idate']))); } $rss->serialize(); }
} } output(SITEMAP_FOOTER); if ($autogenerate) { $function_close($fp); } $main_content .= "<br/><br/>" . $c_cat_total . " <b>Kategorien</b> und " . $c_prod_total . " <b>Produkte</b> exportiert."; // generates sitemap-index file if ($autogenerate && $i > 1) { $sitemap_index_file = 'sitemap_index' . $file_extension; $main_content = $main_content . "<br/><br/>Sitemap-Index-Datei '<b>" . realpath($sitemap_index_file) . "</b>' erstellt."; $notify_url = SITEMAP_CATALOG . $sitemap_index_file; $fp = $function_open('sitemap_index' . $file_extension, 'w'); $function_write($fp, SITEMAPINDEX_HEADER); for ($ii = 1; $ii <= $i; $ii++) { $function_write($fp, sprintf(SITEMAPINDEX_ENTRY, SITEMAP_CATALOG . $sitemap_filename0 . $ii . $file_extension, iso8601_date(time()))); } $function_write($fp, SITEMAPINDEX_FOOTER); $function_close($fp); } if ($notify_google) { fopen(GOOGLE_URL . urlencode($notify_url), 'r'); $google_response = file_get_contents(GOOGLE_URL . urlencode($notify_url)); //Delete wrong Javascript in Google return page!!!!! $google_response = str_replace('document.domain="google.com";', EMPTY_STRING, $google_response); $main_content .= "<br/><br/>Google-Aufruf mit<br/><b>" . GOOGLE_URL . HTML_BR . $notify_url . "</b><br/><br/>" . '<b><font color="red">Google Antwort:</font></b><br/>' . $google_response; } $smarty->assign('CONTENT_BODY', $main_content); $smarty->assign('BUTTON_CONTINUE', HTML_A_START . olc_href_link(FILENAME_START) . '">' . olc_template_image_button('button_continue.gif', 'Weiter') . HTML_A_END); $main_content = $smarty->fetch(CURRENT_TEMPLATE_MODULE . 'google_sitemap' . HTML_EXT, SMARTY_CACHE_ID); echo '