All pastes #739372 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-17 02:47 UTC
rendered paste body
<?php 
require('includes/application_top.php');

//Setup the Query

			$query = "select c.categories_id, cd.categories_name, c.parent_id
                      from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
                      where c.categories_id = cd.categories_id
                      and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                      and c.categories_status != '0'
																						and c.parent_id = '" . $_GET['cPath'] . "'
                      order by c.parent_id, c.sort_order, cd.categories_name";  

				$data = mysql_query($query);
				$rows = 0;
    while ($record = mysql_fetch_array($data) ) {
								$rows++; 
        $records[] = $record; 
    } 
				$results = '';
				$results .= '<?xml version="1.0" encoding="utf-8"?>';
				$results .= '<nodes>';
				
				if (empty($records)) {
					$results .= '<node id="' . $row['categories_id'] . '" text="' . htmlentities($row['categories_name'], ENT_QUOTES ) . '" icon="images/mootree.gif#10"></node>';
				} else {
					foreach ($records as $id=>$row) {
					$results .= '<node id="' . $row['categories_id'] . '" text="' . htmlentities($row['categories_name'], ENT_QUOTES ) . '" load="' . $row['categories_id'] . '.xml"></node>';
					}
				}
				$results .= '</nodes>';
			$OUTPUT = $results;
			$file = 'cache/' . $_GET['cPath'] . '.xml';
   $fp = fopen($file,"w"); 
   fputs($fp, $OUTPUT); 
   fclose($fp); 
			//	echo $results;
?>