SQL.php
<?
if ($event == 'data') {
# Get an instance of wiki's DB object $db =& wfGetDB( DB_MASTER );
# Get commands if admin if ($GLOBALS['xwIsAdmin']) { if (xwGetProperty($properties, "xpath:$path/SQL", $sql)) { xwMessage("Attempting to execute SQL \"$sql\""); $result = $db->query($sql); # Render result rows as messages while ($row = mysql_fetch_assoc($result)) { $msg = ; foreach ($row as $k => $v) $msg .= "$k = $v, "; xwMessage($msg,'red'); }
} }
# Get filters from properties if (!xwGetProperty($properties, "$path/max", $max)) $max = ; if (!xwGetProperty($properties, "$path/filter", $filter)) $filter = ;
# Get filtered content from database
- $result = $db->query("SHOW TABLES;");
# Render rows into article
- while ($row = mysql_fetch_assoc($result)) {
- $article .= "\n*";
- foreach ($row as $k => $v) $article .= "$k=$v, ";
- }
}
elseif ($event == 'view') {
# Get reports from properties if (!xwGetProperty($properties, "$path/report", $report)) $report = ;
}
?>