Location: PHPKode > projects > Ratawiki > ratawiki-0.5/wikisources/mod_discuss.php
<?php
//├▒

function discuss_init() {
	global $actions, $toolbar, $tools;
	array_push($actions, array("discuss", "wiki_discuss_document", "Discutir") );
	array_push($toolbar, array("?discuss","Discutir"));
	array_push($tools,"discuss");
	return 0;
}


/// Este es un topic asociado con el asunto este.
function discuss_document($data) {
	global $config;
	
	$out = "<h1><em>$data[name]</em>: discusi├│n</h1>\n";
	
	mysql_connect("localhost","root","phobos");
	mysql_select_db("ratasoft_smf");
	
	$q1 = "Select * from smf_messages where ".
		"`subject` = \"Cervantino 2007\"";
		# "`subject` = \"Wiki:$data[name]\"";
	
	$r1 = mysql_query($q1);
	$post = mysql_fetch_assoc($r1);
	
	$q2 = "Select * from smf_messages where ".
		"`ID_TOPIC` = $post[ID_TOPIC] order by `ID_MSG` asc";
	$r2 = mysql_query($q2);
	while ( $post = mysql_fetch_assoc($r2) ) {
		$time = strftime("%d-%m-%y %H:%M", $post[posterTime]);
		$body = utf8_encode($post['body']);
		$body = preg_replace("|\[b\](.*)\[/b\]|","<b>\$1</b>",$body);
		$body = preg_replace("|\[i\](.*)\[/i\]|","<i>\$1</i>",$body);
		$body = preg_replace("|\[u\](.*)\[/u\]|","<u>\$1</u>",$body);
		$out .= <<<eot
<h3>$time por $post[posterName]</h3>
<p>$body</p>
eot;
	}
	
	$doc = array(
		'document' => $out,
	);
	wiki_xhtml_wrap($doc);
}

?>
Return current item: Ratawiki