"; //print "
";
//include 'problems/auntieSubs.php';
//include 'womens-mag/pmdSubs.php';
include 'shared/subs.php';
connect();

  $now=date("Y-m-d");
print "
			  
			    http://www.hitthespoof.org
			    $now
			    daily
			    0.9
			  ";
$sql="
		(SELECT problems.title, IF(count(replies.id)=0,problems.dateTime, MAX(replies.dateTime)) AS dt
			FROM problems LEFT JOIN replies ON problems.id=replies.pid 
			WHERE test=0
			GROUP BY problems.id
			ORDER BY dt DESC
			LIMIT 1)
			";
$problems=mysql_query($sql);

	$problem = mysql_fetch_assoc($problems);
	$date=makeSitemapDate($problem['dt']);
	// Main Page
	print "
			  
			    http://www.hitthespoof.org/problems/
			    $date
			    daily
			    0.9
			  
			  
			    http://www.hitthespoof.org/problems/cloud/
			    $date
			    daily
			    0.2
			  
			  
			    http://www.hitthespoof.org/problems/tags/
			    $date
			    daily
			    0.2
			  
			  
			    http://www.hitthespoof.org/problems/diary/
			    $date
			    daily
			    0.2
			  
			  
			    http://www.hitthespoof.org/problems/pictures/
			    $date
			    daily
			    0.2
			  ";
			  
	// Individual problem pages
  $sql="SELECT problems.id, title, problems.dateTime
					FROM problems LEFT JOIN replies ON problems.id=replies.pid
					WHERE test=0
					GROUP BY problems.id
					HAVING count(replies.id) = 0
				UNION
				SELECT problems.id, title, replies.datetime
					FROM problems LEFT JOIN replies ON problems.id=replies.pid
					WHERE test=0
					GROUP BY problems.id
					HAVING count(replies.id) > 0";
	$problems=mysql_query($sql);

	while ($problem = mysql_fetch_assoc($problems)) {
		$linkedTitle=linkify($problem['title']);
		$date=makeSitemapDate($problem['dateTime']);
	 		print "
			  
			    http://www.hitthespoof.org/problems/{$problem['id']}/$linkedTitle.html
			    $date
			    weekly
			    0.85
			  "; 
	}
	
	// Aunties
	 $sql="SELECT aunties.id, MAX(dateTime) as dateTime
					FROM aunties INNER JOIN replies ON aunties.id=replies.aid
					GROUP BY aunties.id
				";
	$problems=mysql_query($sql);
	while ($problem = mysql_fetch_assoc($problems)) {
		$date=makeSitemapDate($problem['dateTime']);
	 		print "
			  
			    http://www.hitthespoof.org/problems/aunties/{$problem['id']}/
			    $date
			    daily
			    0.3
			  
			   "; 
	}


// Tags

	$tagDetails=getTagList();
	foreach ($tagDetails as $tag => $count) {
		
		$sql="
		(SELECT problems.title, IF(count(replies.id)=0,problems.dateTime, MAX(replies.dateTime)) AS dt
			FROM problems LEFT JOIN replies ON problems.id=replies.pid 
			WHERE CONCAT(',',problems.tags,',') REGEXP ',$tag,' AND test=0
			GROUP BY problems.id
			ORDER BY dt DESC
			LIMIT 1)
			";

							if(mysql_query($sql)) {
	//print "Success with $sql
"; } else { print "No success: " . mysql_error() ."
"; } $problems=mysql_query($sql); while ($problem = mysql_fetch_assoc($problems)) { $tag=str_replace(" ","-",$tag); $date=makeSitemapDate($problem['dt']); print " http://www.hitthespoof.org/problems/tags/$tag/ $date weekly 0.4 "; //break; } } print " http://www.hitthespoof.org/womens-mag/ $now daily 0.9 "; // Articles $sql=" SELECT * FROM articles WHERE draft=0 ORDER BY dateTime DESC "; $articles=mysql_query($sql); while ($article = mysql_fetch_assoc($articles)) { $linkedTitle=linkifyWhole($article['title'],$article['id']); $date=makeSitemapDate($article['dateTime']); print " $linkedTitle $date monthly 0.6 "; } $letterTypes=array(0=>"Readers Letters", 1=> "Money Making Tips", 2=> "Ghost sightings"); $sections=array(0=>"letters", 1=> "tips", 2=> "ghosts"); foreach($letterTypes as $key => $description) { $sql=" SELECT * FROM letters WHERE draft=0 AND section=$key ORDER BY dateTime DESC"; $result=mysql_query($sql); while ($letter = mysql_fetch_assoc($result)) { $recentDate=makeSitemapDate($letter['dateTime']); break; } $pages=ceil(mysql_num_rows($result)/10); for ($counter = 1; $counter <= $pages; $counter += 1) { $start=($counter-1)*10; if($start==0){ $start=""; } else { $start="$start/"; } print " http://www.hitthespoof.org/womens-mag/{$sections[$key]}/$start $recentDate weekly 0.6 "; } } $sections=getSections(); foreach($sections as $key => $description) { if($key=="tips" || $key=="letters" || $key=="lonely-hearts") { continue; } $sql=" SELECT * FROM articles WHERE draft=0 AND section='$key' ORDER BY dateTime DESC"; $result=mysql_query($sql); if(mysql_num_rows($result)>0) { while ($article = mysql_fetch_assoc($result)) { $recentDate=makeSitemapDate($article['dateTime']); break; } print " http://www.hitthespoof.org/womens-mag/$key/ $recentDate weekly 0.3 "; } } $sql=" SELECT * FROM lonelyHearts WHERE draft=0 ORDER BY dateTime DESC"; $result=mysql_query($sql); while ($letter = mysql_fetch_assoc($result)) { $recentDate=makeSitemapDate($letter['dateTime']); break; } print " http://www.hitthespoof.org/womens-mag/lonely-hearts/ $recentDate weekly 0.6 "; print "";