<?php
// $Id: getCategoryList.php,v 1.1 2004/07/11 10:28:47 Farsus Exp $
// -------------------------------------------------------------------------//
//			                 RUNCMS                                         //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// Original Author: i-Tech (Half-Dead)
// Author Website : http://www.i-Technology.NET
// License Type   : LGPL: See /manual/LICENSES/LGPL.txt
// ------------------------------------------------------------------------- //

// Function: mt.getCategoryList

load_function("isAdmin");

$user = $params[1];
$pass = $params[2];
$uid  = login($user, $pass);

$query = $db->query("SELECT topic_id, topic_title FROM " . $db->prefix("topics"));

// Start the response array
$rpc_encoder->start_array();

while (list($id, $title) = $db->fetch_row($query)) {

//$title = xmlsafe($title);

// Each respose has a struct
$rpc_encoder->start_struct();
$rpc_encoder->add_value("integer", $id   , "categoryId");
$rpc_encoder->add_value("string" , $title, "categoryName");
$rpc_encoder->end_struct();
}

// End of response array
$rpc_encoder->end_array();

if (!$query) {
	trigger_error(_phpRPC_DBerreur, E_USER_ERROR);
}

// Return the result
$rpc_encoder->return_call();
?>
