FoxInFox Posted July 7, 2018 Report Posted July 7, 2018 Imi apare aceasta eroare in google webmaster https://prnt.sc/k3qfz1 sitemap.php <?php /** * Plugin Name: Regular Sitemap * Plugin URI: http://get.phpvibe.com/ * Description: Generates a regular sitemap for PHPVibe 5 * Version: 1.2 * Author: PHPVibe Crew * Author URI: http://www.phpvibe.com * License: Commercial */ /* Number of results per page */ $xnr = 1000; /* Number of results per page */ header('Content-Type: application/xml; charset=UTF-8'); echo '<?xml version="1.0" encoding="UTF-8"?>'; include_once('load.php'); $now = date('c', time()); $midnight = $now; if(_get('page')) { echo "We have a page"; } else { if(_get('type')) { $type = _get('type'); $urlar = array(); switch($type) { case "videos": $results = $db->get_results("Select title,id,date from ".DB_PREFIX."videos order by id desc ".this_offset($xnr)); if($results){ $i = 1; foreach ($results as $r) { $urlar[$i]['loc'] = video_url($r->id,$r->title); $urlar[$i]['date'] = $r->date; $i++; } } break; case "images": $results = $db->get_results("Select title,id,date from ".DB_PREFIX."images order by id desc ".this_offset($xnr)); if($results){ $i = 1; foreach ($results as $r) { $urlar[$i]['loc'] = image_url($r->id,$r->title); $urlar[$i]['date'] = $r->date; $i++; } } break; case "users": $results = $db->get_results("Select name,id from ".DB_PREFIX."users order by id desc limit 0,19999"); if($results){ foreach ($results as $r) { $urlar[]['loc'] = profile_url($r->id,$r->name); } } break; case "categories": $results = $db->get_results("Select cat_name as name,cat_id as id from ".DB_PREFIX."channels order by cat_id desc limit 0,19999"); if($results){ foreach ($results as $r) { $urlar[]['loc'] = channel_url($r->id,$r->name); } } break; case "tags": $tg = array(); $results = $db->get_results("Select tags from ".DB_PREFIX."videos order by id desc limit 0,19999"); foreach ($results as $r) { $tags = array_unique(explode(",",$r->tags)); $tg = array_merge($tg,$tags); } $tg = array_map('trim', $tg); $tg = array_filter($tg, 'strlen'); foreach ($tg as $r) { $r = strip_tags($r); $qterm = nice_url($r); if(strlen($qterm) > 3) { $urlar[]['loc'] = site_url().show.'/'.$qterm.'/'; } } break; case "static": $results = $db->get_results("Select title as name,pid as id from ".DB_PREFIX."posts order by pid desc limit 0,19999"); if($results){ foreach ($results as $r) { $urlar[]['loc'] = article_url($r->id,$r->name); } } $results = $db->get_results("Select title as name,pid as id from ".DB_PREFIX."pages order by pid desc limit 0,19999"); if($results){ foreach ($results as $r) { $urlar[]['loc'] = page_url($r->id,$r->name); } } break; } array_filter(array_unique($urlar)); //var_dump($urlar); echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; foreach ($urlar as $l) { echo '<url> <loc> '.$l["loc"].' </loc>'; if(isset($l['date'])) { $datetime = new DateTime($l['date']); $timed = $datetime->format('Y-m-d\TH:i:sP'); echo '<lastmod>'.$timed.' etc</lastmod>'; } else { echo '<lastmod>'.$midnight.'</lastmod>'; } echo '<changefreq>weekly</changefreq> </url>'; } echo '</urlset>'; } else { /* Build sitemap index */ echo '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $sarr = array("users","categories","tags","static"); foreach ($sarr as $s) { echo '<sitemap> <loc> '.site_url().'sitemap.php?type='.$s.' </loc> <lastmod>'.$midnight.'</lastmod> </sitemap>'; } //Calculate video pages $nrv = $db->get_var("Select count(*) from ".DB_PREFIX."videos"); $maxV = ceil($nrv/$xnr); for ($x = 1; $x <= $maxV; $x++) { echo '<sitemap> <loc> '.site_url().'sitemap.php?type=videos&p='.$x.' </loc> <lastmod>'.$midnight.'</lastmod> </sitemap>'; } //Calculate video pages $nri = $db->get_var("Select count(*) from ".DB_PREFIX."images"); $maxI = ceil($nri/$xnr); for ($x = 1; $x <= $maxI; $x++) { echo '<sitemap> <loc> '.site_url().'sitemap.php?type=images&p='.$x.' </loc> <lastmod>'.$midnight.'</lastmod> </sitemap>'; } //End sitemapindex echo "\r\n</sitemapindex>"; } } ?> Quote
Sim Master Posted July 8, 2018 Report Posted July 8, 2018 (edited) Inlocuieste liniile astea: $timed = $datetime->format('Y-m-d\TH:i:sP'); echo '<lastmod>'.$timed.' etc</lastmod>'; cu astea: $timed = $datetime->format('c'); echo '<lastmod>'.$timed.'</lastmod>'; Edited July 8, 2018 by Sim Master 1 Quote