From 1169e1aaf49a7094d0168b4f7bcd5c40bc63c415 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Tue, 14 Oct 2014 13:15:13 -0500 Subject: [PATCH] fixes #939 sitemap error handling and messages sitemap was being created when visiting the sitemap page, makes no sense when there is a refresh button, only refreshes if it doesn't exist now --- admin/inc/template_functions.php | 2 +- admin/lang/en_US.php | 6 ++---- admin/sitemap.php | 12 ++++-------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/admin/inc/template_functions.php b/admin/inc/template_functions.php index 10cf374a3..685f90608 100644 --- a/admin/inc/template_functions.php +++ b/admin/inc/template_functions.php @@ -1373,7 +1373,7 @@ function generate_sitemap() { $status = XMLsave($xml, $file); exec_action('sitemap-aftersave'); - #sitemap successfully created - did not ping + #sitemap successfully created return $status; } else return true; diff --git a/admin/lang/en_US.php b/admin/lang/en_US.php index 51ab90119..9c4925c70 100644 --- a/admin/lang/en_US.php +++ b/admin/lang/en_US.php @@ -200,10 +200,9 @@ /* * For: sitemap.php */ -"SITEMAP_CREATED" => "Sitemap Created! We also successfully pinged 4 search engines of the update", -"SITEMAP_ERRORPING" => "Sitemap Created, however there was an error pinging one or more of the search engines", "SITEMAP_ERROR" => "Your sitemap could not be generated", -"SITEMAP_WAIT" => "Please Wait: Creating website sitemap", +"SITEMAP_REFRESHED" => "Your sitemap has been refreshed", +"SITEMAP_CREATED" => "Your sitemap has been created", /* * For: theme.php @@ -534,7 +533,6 @@ "AUTOSAVE_NOTIFY" => 'Page autosaved at %s', //edit.php "MENU_MANAGER" => 'Menu Manager', //edit.php "GET_PLUGINS_LINK" => 'Download More Plugins', -"SITEMAP_REFRESHED" => "Your sitemap has been refreshed", //edit.php "LOG_FILE_EMPTY" => "This log file is empty", //log.php "SHARE" => "Share", //footer.php "NO_PARENT" => "No Parent", //edit.php diff --git a/admin/sitemap.php b/admin/sitemap.php index 365f87672..8b11be6b0 100644 --- a/admin/sitemap.php +++ b/admin/sitemap.php @@ -14,20 +14,16 @@ login_cookie_check(); exec_action('load-sitemap'); +$sitemapfile = '../'.GSSITEMAPFILE; -$sitemap = generate_sitemap(); -if ($sitemap !== true) { - $error = $sitemap; -} else { - if (isset($_GET['refresh'])) { - $success = i18n_r('SITEMAP_REFRESHED'); - } +if(!file_exists($sitemapfile) || isset($_GET['refresh'])){ + if(generate_sitemap() === true) $success = i18n_r('SITEMAP_REFRESHED'); + else $error = i18n_r('SITEMAP_ERROR'); } $pagetitle = strip_tags(i18n_r('SIDE_VIEW_SITEMAP')); get_template('header'); -$sitemapfile = '../'.GSSITEMAPFILE; ?>