# Create Google Sitemap for 4images
# Created by Mai Minh (minh@maingo.com http://www.vna2z.com)
# Modified by Oliver van der Werf (info@flash-webdesign.de http://www.flash-webdesign.de)
# Date: 28/11/2006 | 02.01.2007
# You can send ping to Google with this request: http://www.google.com/webmasters/sitemaps/ping?sitemap=URL_TO_YOUR_SITEMAP
#---------------------------------
//define('ROOT_PATH', 'modules/DB_4images/4images');
//require(ROOT_PATH."config.php");
//include(ROOT_PATH.'global.php');
//header("Content-Type: text/html; charset=utf-8");
header('Content-Type: text/xml; charset=UTF-8');
if (!$pnconfig[dbtype]) {
// require("../../../config.php");
// include(ROOT_PATH."admin/DB_compatibility.php");
//chdir("/home/multi/www/");
include 'includes/pnAPI.php';
pnInit();
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
//chdir("/home/multi/www/modules/$ModName/4images/");
}
$db_servertype = $pnconfig[dbtype];
$db_servertype = "mysqli";
$db_host = $pnconfig[dbhost];
$db_name = $pnconfig[dbname];
$db_user = $pnconfig[dbuname];
$db_password = $pnconfig[dbpass];
$table_prefix = $pnconfig[prefix]."_4images_";
//SQL
$dbhost= $pnconfig[dbhost];
$dbuser= $pnconfig[dbuname];
$dbpass= $pnconfig[dbpass];
$dbname=$pnconfig[dbname];
$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
$mysqli -> set_charset("utf8");
// Check connection
if ($mysqli -> connect_errno) {
echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
exit();
}
//DANBOSS
if (pnUserGetLang()=="fra") {
$config['language_dir']="french";
} else if (pnUserGetLang()=="eng"){
$config['language_dir']="english";
}
/*
$link=mysqli_connect("$db_host","$db_user","$db_password");
mysqli_select_db("$db_name") or die ("Cannot connect database!");
*/
# 4images top page (with trailing slash)
$gallery_url = 'https://megagalerie.net/DB_4images+index-function-';
# Priotity
//select between 0.0 and 1.0
//0.0 identifies the lowest priority page(s) on your website
//1.0 identifies the highest priority page(s) on your website
$prio_img = 0.5;
$prio_cat = 0.8;
$prio_profile = 0.1;
# Frequency
//"always", "hourly", "daily", "weekly", "monthly", "yearly" or "never"
$freq_img = 'daily';
$freq_cat = 'daily';
$freq_profile = 'monthly';
$limit ="";
//$limit =" LIMIT 10";
# Use Short URLs
$shortURL = 1; // 0 or 1
# Print XML header
xml_head();
# Print URLs
//echo 'SELECT cat_id, cat_name FROM ' . $table_prefix . 'categories';
$sql='SELECT cat_id, cat_name FROM ' . $table_prefix . 'categories'.$limit;
$categories= $mysqli -> query($sql);
while ($category = $categories -> fetch_assoc()) {
//while ($category = mysqli_fetch_array($categories))
//{
$catid = $category['cat_id'];
//$catname = strtr($category['cat_name'], " eeeaeauoiiaaABCDEFGHIJKLMNOPQRSTUVWXYZ","-eeeaeauoiiaaabcdefghijklmnopqrstuvwxyz");
//$catname = fixname(multilang($catname));
$multi=explode("[english]",$category['cat_name']);
$catname = $multi[0];
//echo $catid." - ".$catname."
";
if ($shortURL == 1) {
//$cat_url = $gallery_url.'cat-'.$catname.'-'.$catid.'.htm';
//$cat_url = $gallery_url.'cat_id-'.$catname.'-'.$catid.'.htm';
$cat_url = $gallery_url.'categories-cat_id-'.$catid.'.phtml';
}else {
$cat_url = $gallery_url.'categories.php?cat_id='.$catid;
}
print_xml($cat_url,$prio_cat,$lastmod,$freq_cat);
}
/*
$images = mysqli_query('SELECT image_id,image_name,image_active,image_date FROM ' . $table_prefix . 'images');
while ($image = mysqli_fetch_array($images))
{
*/
$sql='SELECT image_id,image_name,image_active,image_date FROM ' . $table_prefix . 'images'.$limit;
$images= $mysqli -> query($sql);
while ($image = $images -> fetch_assoc()) {
if ($image['image_active'] == 1) {
$imgid = $image['image_id'];
//$imgname = strtr($image['image_name'], ", eeeaeauoiiaaABCDEFGHIJKLMNOPQRSTUVWXYZ","--eeeaeauoiiaaabcdefghijklmnopqrstuvwxyz");
//$imgname = fixname ($imgname);
$imgname = $image['image_name'];
$date = $image['image_date'];
$lastmod = date("Y-m-d",$date)."T".date("H:i:s",$date)."+00:00";
if ($shortURL == 1) {
//$img_url = $gallery_url.'img-'.$imgname.'-'.$imgid.'.htm';
$img_url = $gallery_url.'details-image_id-'.$imgid.'.phtml';
$cat_url = $gallery_url.'categories-cat_id-'.$catid.'.phtml';
}else{
$img_url = $gallery_url.'details.php?image_id='.$imgid;
}
print_xml($img_url,$prio_img,$lastmod,$freq_img);
}
}
$profiles = mysqli_query('SELECT user_id, user_lastaction FROM ' . $table_prefix . 'users WHERE user_id >= "1"');
while ($profile = mysqli_fetch_array($profiles))
{
$profileid = $profile['user_id'];
$date = $profile['user_lastaction'];
if ($date == 0) {
$date_ = time();
$date = date("Y-m-d",$date_)."T".date("H:i:s",$date_)."+00:00";
} else {
$date = date("Y-m-d",$date)."T".date("H:i:s",$date)."+00:00";
}
$profile_url = $gallery_url.'member.php?action=showprofile&user_id='.$profileid;
print_xml($profile_url,$prio_profile,$date,$freq_profile);
}
# Print XML footer
xml_foot();
function xml_head() {
$freq = 'daily';
$priority = '1.0';
$mod = date("Y-m-d")."T".date("H:i:s")."+00:00";
echo "\n"
."";
}
#-----------------------------------------------
# xml_foot
#-----------------------------------------------
function xml_foot() {
echo "
";
}
#-----------------------------------------------
# print_xml
#-----------------------------------------------
function print_xml($url,$priority,$lastmod,$changefreq) {
$temp = "\n "
."$url";
if ($lastmod != '') {
//$temp .=" $lastmod";
}
//$temp .= " $changefreq";
//$temp .= " $priority";
$temp .= "";
echo $temp;
}
function fixname($text)
{
return strtolower(strtr(
$text,
array(
"e" => "e",
"e" => "e",
"e" => "e",
"a" => "a",
"e" => "e",
"a" => "a",
"u" => "a",
"o" => "o",
"i" => "i",
"a" => "a",
//russian UTF8 encoded alphabet (lower and upper cases)
"А" => "a",
"а" => "a",
"Б" => "b",
"б" => "b",
"В" => "v",
"в" => "v",
"Г" => "g",
"г" => "g",
"Д" => "d",
"д" => "d",
"Е" => "e",
"е" => "e",
"Ё" => "yo",
"ё" => "yo",
"Ж" => "zh",
"ж" => "zh",
"З" => "z",
"з" => "z",
"И" => "i",
"и" => "i",
"Й" => "j",
"й" => "j",
"К" => "k",
"к" => "k",
"Л" => "l",
"л" => "l",
"М" => "m",
"м" => "m",
"Н" => "n",
"н" => "n",
"О" => "o",
"о" => "o",
"П" => "p",
"п" => "p",
"Р" => "r",
"р" => "r",
"С" => "s",
"с" => "s",
"Т" => "t",
"т" => "t",
"У" => "u",
"у" => "u",
"Ф" => "f",
"ф" => "f",
"Х" => "h",
"х" => "h",
"Ц" => "c",
"ц" => "c",
"Ч" => "ch",
"ч" => "ch",
"Ш" => "sh",
"ш" => "sh",
"Щ" => "sch",
"щ" => "sch",
"Ъ" => "",
"ъ" => "",
"Ы" => "i",
"ы" => "i",
"Ь" => "'",
"ь" => "'",
"Э" => "e",
"э" => "e",
"Ю" => "yu",
"ю" => "yu",
"Я" => "ya",
"я" => "ya",
//russian 1251 encoded alphabet (lower and upper cases)
"а" => "a",
"А" => "a",
"б" => "b",
"Б" => "b",
"в" => "v",
"В" => "v",
"г" => "g",
"Г" => "g",
"д" => "d",
"Д" => "d",
"е" => "e",
"Е" => "e",
"ё" => "yo",
"Ё" => "yo",
"ж" => "zh",
"Ж" => "zh",
"з" => "z",
"З" => "z",
"и" => "i",
"И" => "i",
"й" => "j",
"Й" => "j",
"к" => "k",
"К" => "k",
"л" => "l",
"Л" => "l",
"м" => "m",
"М" => "m",
"н" => "n",
"Н" => "n",
"о" => "o",
"О" => "o",
"п" => "p",
"П" => "p",
"р" => "r",
"Р" => "r",
"с" => "s",
"С" => "s",
"т" => "t",
"Т" => "t",
"у" => "u",
"У" => "u",
"ф" => "f",
"Ф" => "f",
"х" => "h",
"Х" => "h",
"ц" => "c",
"Ц" => "c",
"ч" => "ch",
"Ч" => "ch",
"ш" => "sh",
"Ш" => "sh",
"щ" => "sch",
"Щ" => "sch",
"ъ" => "",
"Ъ" => "",
"ы" => "i",
"Ы" => "i",
"ь" => "'",
"Ь" => "'",
"э" => "e",
"Э" => "e",
"ю" => "yu",
"Ю" => "yu",
"я" => "ya",
"Я" => "ya",
"/" => "",
"&" => "-",
"№" => "",
"," => "-",
"°" => "",
"\"" => "",
"?" => "",
"і" => "i", //ukranian i
"І" => "i", //ukranian i
"ї" => "i", //ukranian ї
"є" => "e", //ukranian є
"«" => "",
"»" => "",
"*" => "",
"?" => "",
"!" => "",
")" => "",
"(" => "",
"=" => "",
"." => "",
"#" => "",
"%" => "",
"–" => ""
)));
}
?>