<?php
/**
**
** NitricWare presents Aquarium
**
** Terminal-Like Interface for Usage of NWFunctions
**
** by NitricWare Studios
** www.nitricware.at.tf
**
**/
$XMLFile = simplexml_load_file("./Applications/Aquarium.OYApp/Language/".OYLANGUAGE."/Aquarium.xml");
// Reading Template-File
$template->_template_read("./Applications/Aquarium.OYApp/Design/".OYDESIGN."/Templates/aquarium.tpl");
$template->_template_assign("FORM_ACTION", OYCreateLink("Aquarium", array("command" => "true")));
$header->_template_assign("BROWSER_TITLE", OYLoadLanguageString($XMLFile, "BROWSER_TITLE"));
if (isset($_GET["command"]) and $_GET["command"] AND $_POST["command"]){
$command = explode(" -", $_POST["command"]);
$function = $command[0];
if (count($command)>1){
for($i=1;$i<count($command);$i++){
$commander = trim($command[$i]);
if ($commander == "true"){
$param_arr[] = true;
} elseif ($commander == "false"){
$param_arr[] = false;
} else {
$param_arr[] = $commander;
}
}
} else {
$param_arr = array();
}
if (DEBUG_MODE){
$template->_template_assign("DEBUG", true);
$template->_template_assign("COMMAND", $function);
$template->_template_assign("PARAMETERS", "(".count($param_arr).") - ".print_r($param_arr,true));
}
$template->_template_assign("LAST_CALLED_FUNCTION", $_POST["command"]);
if (function_exists($function)){
$returned_value = call_user_func_array($function,$param_arr);
} else {
AQLog("Call to undefined function $function");
$returned_value = call_user_func_array("AQShowHelp", array(false));
}
if (is_array($returned_value)){
$template->_template_assign("OUTPUT", print_r($returned_value,true));
$template->_template_assign("RETURN_TYPE", "ARRAY");
} else {
if ($returned_value == true){
$template->_template_assign("OUTPUT", "true\n".$returned_value);
} else {
$template->_template_assign("OUTPUT", "false\n".$returned_value);
}
$template->_template_assign("RETURN_TYPE", "STRING");
}
}
?>