HEX
Server: Apache
System: Linux vps8051.dx3webs.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: paiskincare (10000)
PHP: 5.6.40-52+ubuntu20.04.1+deb.sury.org+1
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/paiskincare.com/httpdocs2/sitemaps_old.php
<?php

/**
  * MSU Sitemaps - Magic SEO URL URL for ZenCart
  * http://www.magic-seo-url.com/zencart/
  *
  * 2009, (c) Inveo s.r.o.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
**/

/**
  * Turning Off debugging
  */

error_reporting(E_ALL & ~E_NOTICE);

/**
  * Getting obsolute path
  */

define('UN_FULLAPP_PATH', dirname(__FILE__) . "/");

/**
  * Loading constant and settings
  */

// Set the local configuration parameters - mainly for developers
if (file_exists(UN_FULLAPP_PATH.'includes/local/configure.php')) include(UN_FULLAPP_PATH.'includes/local/configure.php');

// include server parameters
require('includes/configure.php');

require(DIR_WS_INCLUDES . 'filenames.php');
require(DIR_WS_INCLUDES . 'database_tables.php');

/**
  * Loading configuration
  */

if(file_exists(UN_FULLAPP_PATH.DIR_WS_INCLUDES.'msu_tweak.ini')) {
	$msuConfig = parse_ini_file(UN_FULLAPP_PATH.DIR_WS_INCLUDES.'msu_tweak.ini', true);
	define('RCATEGORY_DEPTH', $msuConfig['MSU']['category_depth']);
	define('RURI_DELIMETER', $msuConfig['MSU']['uri_delimiter']);
	define('RURI_EXTENSION', $msuConfig['MSU']['uri_extension']);
	define('RURI_MODE', $msuConfig['MSU']['uri_mode']);
	//unset($msuConfig);
}

/**
  * Verifying configuration
  */

if(empty($msuConfig['MSU']['category_depth'])) {
	define('CATEGORY_DEPTH', 3);
} elseif(RCATEGORY_DEPTH > 5 || 1 > RCATEGORY_DEPTH) {
	define('CATEGORY_DEPTH', 3);
} else {
	define('CATEGORY_DEPTH', (int) RCATEGORY_DEPTH);
}

if(!isset($msuConfig['MSU']['uri_delimiter'])) {
	define('URI_DELIMETER', '-');
} else {
	define('URI_DELIMETER', (string) RURI_DELIMETER);
}

if(!isset($msuConfig['MSU']['uri_extension'])) {
	define('URI_EXTENSION', '.html');
} else {
	define('URI_EXTENSION', (string) RURI_EXTENSION);
}

if(!empty($msuConfig['MSU']['uri_mode']) && (RURI_MODE == 'normal' || RURI_MODE == 'short')) {
	define('URI_MODE', (string) RURI_MODE);
} else {
	define('URI_MODE', 'normal');
}

/**
  * Initializing database
  */

define('IS_ADMIN_FLAG', true);
require(UN_FULLAPP_PATH.'includes/classes/class.base.php');
require(UN_FULLAPP_PATH.'includes/classes/db/' .DB_TYPE . '/query_factory.php');
$db = new queryFactory();
if(!$db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false)) die('Unable to connect to database server!');;

/**
  * Setting sitemaps base URL
  */

$GLOBALS['smUrl'] = HTTP_SERVER.DIR_WS_CATALOG;

/**
  * Defining constants
  */

define('SM_SITEMAPINDEX_FILE', basename(__FILE__));
define('SM_DIR_SITEMAPS', 'sitemaps');
define('SM_IN_SITEMAPS', true);
define('UN_ZENCART_MAINFILE', 'index.php');

/**
  * Handling multilang and single lang
  */

$result = $db->Execute("SELECT COUNT(*) AS numrows FROM ".TABLE_LANGUAGES);
if($result->fields['numrows'] > 1) {
	$GLOBALS['smMultilang'] = true;
	$result = $db->Execute("SELECT languages_id, code FROM ".TABLE_LANGUAGES);
	$GLOBALS['smInstalledLang'] = array();
	while(!$result->EOF) {
		$GLOBALS['smInstalledLang'][$result->fields['languages_id']] = $result->fields['code'];
		$result->MoveNext();
	}
} else {
	$result2 = $db->Execute("SELECT l.languages_id, l.code FROM ".TABLE_LANGUAGES." l, ".TABLE_CONFIGURATION." c WHERE l.code = c.configuration_value AND c.configuration_key = 'DEFAULT_LANGUAGE'");
	$GLOBALS['smMultilang'] = false;
	$GLOBALS['smInstalledLang'] = array($result2->fields['languages_id'] => $result2->fields['code']);
}

if(!empty($_GET['showMap'])) {
	@set_time_limit(0);
	$cache = new cache(UN_FULLAPP_PATH.'cache/fancy-data/', 'zc2');
	$sitemap = strtolower(trim($_GET['showMap']));
	if(strpos($sitemap, 'http://') === false && strpos($sitemap, '..') === false && file_exists(UN_FULLAPP_PATH.SM_DIR_SITEMAPS.'/'.$sitemap.'.php')) {
		$sm = new siteMap($GLOBALS['smUrl']);
		$sm->openSiteMap();
		require(UN_FULLAPP_PATH.SM_DIR_SITEMAPS.'/'.$sitemap.'.php');
		$sm->closeSiteMap();
		unset($sm);
	} else {
		header("HTTP/1.1 404 Document Not Found");
		exit();
	}
} else {
	$si = new siteMapIndex($GLOBALS['smUrl']);
	$si->openSiteMapIndex();
	
	$dir = dir(SM_DIR_SITEMAPS);
	while($file = $dir->read()) {
		if (preg_match("/(.+)\.php$/", $file, $matches)) {
			$si->addSiteMap(SM_SITEMAPINDEX_FILE.'?showMap='.ucfirst($matches[1]));
		}
	}
	$dir->close();
	
	$si->closeSiteMapIndex();
	unset($si);
}

class cache {

	var $cacheDir = '';

	var $filePrefix = '';

	function cache($cacheDir, $filePrefix) {
		$this->cacheDir = $cacheDir;
		$this->filePrefix = $filePrefix;
	}
	
	function read($fileName, $id, $langId = '') {
		if(empty($langId)) {
			$lang = '';
		} else {
			$lang = $langId.'-';
		}
		$niceData = @file_get_contents($this->cacheDir.$this->filePrefix.'-'.$fileName.'-'.$lang.$id);
		if(!$niceData) return false;
		$niceData = str_replace('#', URI_DELIMETER, $niceData);
		$niceDataAr = explode('|', $niceData);
		return $niceDataAr;
	}

}

class siteMap {

	var $timeZone = '';
	
	var $gmtTime = false;
	
	var $baseUrl = '';

	function siteMap($url) {
		$this->timeZone = substr(date('O'), 0, 3);
		header('Content-Type: application/xml; charset=utf-8');
		echo '<?xml version="1.0" encoding="UTF-8"?>';
		$this->baseUrl = $url;
	}
	
	function openSiteMap() {
		echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
	}
	
	function addUrlToSiteMap($loc, $changeFreq = '', $priority = '', $lastMod = '') {
		echo '<url>'."\n";
		echo '<loc>'.$this->baseUrl.$loc.'</loc>';
		if(!empty($lastMod)) {
			if(!$this->gmtTime) {
				echo '<lastmod>'.date('Y-m-d\TH:i:s', $lastMod).$this->timeZone.':00</lastmod>'."\n";
			} else {
				echo '<lastmod>'.gmdate('Y-m-d\TH:i:s', $lastMod).'+00:00</lastmod>'."\n";
			}
		}
		if(!empty($changeFreq)) {
			echo '<changefreq>'.$changeFreq.'</changefreq>'."\n";
		}
		if(!empty($priority)) {
			echo '<priority>'.$priority.'</priority>'."\n";
		}
		echo '</url>'."\n";
	}
	
	function closeSiteMap() {
		echo '</urlset>'."\n";
	}

}

class siteMapIndex {

	var $baseUrl = '';

	function siteMapIndex($url) {
		header('Content-Type: application/xml; charset=utf-8');
		echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
		$this->baseUrl = $url;
	}
	
	function openSiteMapIndex() {
		echo '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
	}
	
	function addSiteMap($loc) {
		echo '<sitemap><loc>'.$this->baseUrl.$loc.'</loc></sitemap>'."\n";
	}
	
	function closeSiteMapIndex() {
		echo '</sitemapindex>'."\n";
	}

}

?>