- <?php
- /**
- * Google XML Sitemap Feed Cron Script
- *
- * The Google sitemap service was announced on 2 June 2005 and represents
- * a huge development in terms of crawler technology. This contribution is
- * designed to create the sitemap XML feed per the specification delineated
- * by Google. This cron script will call the code to create the scripts and
- * eliminate the session auto start issues.
- * @package Google-XML-Sitemap-Feed
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @version 1.0
- * @link http://www.oscommerce-freelancers.com/ osCommerce-Freelancers
- * @link http://www.google.com/webmasters/sitemaps/docs/en/about.html About Google Sitemap
- * @copyright Copyright 2005, Bobby Easland
- * @author Bobby Easland
- * @filesource
- */
-
- chdir('../');
- /**
- * Option to compress the files
- */
- define('GOOGLE_SITEMAP_COMPRESS', 'false');
- /**
- * Option for change frequency of products
- */
- define('GOOGLE_SITEMAP_PROD_CHANGE_FREQ', 'weekly');
- /**
- * Option for change frequency of categories
- */
- define('GOOGLE_SITEMAP_CAT_CHANGE_FREQ', 'weekly');
- /**
- * Carried over from application_top.php for compatibility
- */
- define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
-
- require_once('includes/configure.php');
- require_once(DIR_WS_INCLUDES . 'filenames.php');
- require_once(DIR_WS_INCLUDES . 'database_tables.php');
- require_once(DIR_WS_FUNCTIONS . 'database.php');
- tep_db_connect() or die('Unable to connect to database server!');
- $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
- while ($configuration = tep_db_fetch_array($configuration_query)) {
- define($configuration['cfgKey'], $configuration['cfgValue']);
- }
- require_once(DIR_WS_FUNCTIONS . 'general.php');
- require_once(DIR_WS_FUNCTIONS . 'html_output.php');
- include_once(DIR_WS_CLASSES . 'language.php');
- $lng = new language();
- $lng->get_browser_language();
- $languages_id = $lng->language['id'];
-
- if ( file_exists(DIR_WS_CLASSES . 'seo.class.php') ){
- require_once(DIR_WS_CLASSES . 'seo.class.php');
- $seo_urls = new SEO_URL($languages_id);
- }
-
- if ( file_exists(DIR_WS_CLASSES . 'cache.class.php') ){
- include(DIR_WS_CLASSES . 'cache.class.php');
- $cache = new cache($languages_id);
- }
-
- if ( file_exists('includes/seo_cache.php') ){
- include('includes/seo_cache.php');
- $cache->get_cache('GLOBAL');
- }
-
- require_once('googlesitemap/sitemap.class.php');
-
- $google = new GoogleSitemap(DB_SERVER, DB_SERVER_USERNAME, DB_DATABASE, DB_SERVER_PASSWORD);
-
- $submit = true;
- if ($google->GenerateProductSitemap()){
- echo 'Generated Google Product Sitemap Successfully' . "\n\n";
- } else {
- $submit = false;
- echo 'ERROR: Google Product Sitemap Generation FAILED!' . "\n\n";
- }
-
- if ($google->GenerateCategorySitemap()){
- echo 'Generated Google Category Sitemap Successfully' . "\n\n";
- } else {
- $submit = false;
- echo 'ERROR: Google Category Sitemap Generation FAILED!' . "\n\n";
- }
-
- if ($google->GenerateSitemapIndex()){
- echo 'Generated Google Sitemap Index Successfully' . "\n\n";
- } else {
- $submit = false;
- echo 'ERROR: Google Sitemap Index Generation FAILED!' . "\n\n";
- }
-
- if ($submit){
- echo 'All files generated successfully. If you have not already submitted the sitemap index to Google click the link below.' . "\n\n";
- echo $google->GenerateSubmitURL();
- }
- ?>