Location: PHPKode > projects > JaxBlog > JaxBlog/app/user/user_slideshow/user_slideshow.php
<?php

require_once('../../../config.php');
require_once(FOLDER_RELATIVE_COMMON . 'database.php');

// Check for XML request (XMLHttpRequest).
$request = isset($_GET['request']) ? $_GET['request'] : '';
$pane_id = isset($_GET['pane_id']) ? $_GET['pane_id'] : '';
if ($request == 'xml') {
	
	header('Content-Type: text/xml');
	$xml = "<root>\n";
	
	$folder = databaseGetValue('SELECT folder_path FROM panes WHERE id = ?', array($pane_id));
	if ($folder == null) {
		$folder = databaseGetValue('SELECT files.path FROM files, panes WHERE panes.id = ? AND files.id = panes.file_id', array($pane_id));
	}
	
	// Loop through all files in directory.  
	// If file is an image file, add it to the list.
	$dir = opendir($folder);
		
	while(($file = readdir($dir)) !== false) {
		
		$valid = true;
		if (is_dir($file)) $valid = false;
		
		if (strpos(strtolower($file), ".jpg") > -1) $valid = true;
		if (strpos(strtolower($file), ".png") > -1) $valid = true;
		if (strpos(strtolower($file), ".gif") > -1) $valid = true;
		if (strpos(strtolower($file), ".bmp") > -1) $valid = true;
		
		if ($valid) {
			$xml .= "\t<image>\n";
			$xml .= "\t\t<title>" . $file . "</title>\n";
//			$xml .= "\t\t<path>" . FOLDER_RELATIVE_BASE . FOLDER_UPLOAD . $file . "</path>\n";
			$xml .= "\t\t<path>" . $folder . $file . "</path>\n";
			$xml .= "\t</image>\n";
		}
	}
	
	$xml .= "</root>\n";
	echo $xml;
}

?>
Return current item: JaxBlog