#!/usr/bin/php
&1");
$ShellExecResult=shell_exec("cat /tmp/register.html");
if ($ShellExecResult == "Register Successfull." ){
$ShellExecResult=shell_exec("echo $registerCode>/proto/SxM_webui/fpkmgr/registered");
print "Congratulations, You have Registered FeaturePack Manager Successfully.";
print "
Back to Main Menu";
}
else
{
print " The Registration code is not correct, please enter the Registration code again.";
$ACTION="REGISTER-DISPLAY";
}
}
if ($ACTION == "REGISTER-DISPLAY") {
$ShellExecResult=shell_exec("wget http://highlevelbits.free.fr/download-MBWEW/MybookRegister.html -O /tmp/register.html 2>&1");
$ShellExecResult=shell_exec("cat /tmp/register.html");
print $ShellExecResult;
}
if ($ACTION == "FP_UNINSTALL_FEATURE")
{
$folder=$_REQUEST["Feature"];
$ShellExecResult=shell_exec("sh /proto/SxM_webui/fpkmgr/fpks/".$folder."/_uninstall");
print " $folder Feature uninstallation complete.";
print "
Back to Main Menu";
}
if ($ACTION == "FP_List") {
$rgc="";
if (file_exists("/proto/SxM_webui/fpkmgr/registered"))
{
$rgc=`cat /proto/SxM_webui/fpkmgr/registered`;
$rgc=substr($rgc,0, -1);
}
printHeader();
print "
List of installed Feature Packs :
";
print "
";
$tmp=shell_exec("wget http://highlevelbits.free.fr/download-MBWEW/FP_list -O /proto/SxM_webui/fpkmgr/FP_list >/dev/nul 2>&1");
$handle=opendir("/proto/SxM_webui/fpkmgr/fpks");
while ($folder = readdir($handle)) {
if ($folder != "." && $folder != ".." && substr($folder, 0, 1) != "_" ) {
if ( is_dir( "/proto/SxM_webui/fpkmgr/fpks/".$folder )) {
print "";
}#isdir
}
}
print "
";
print "
List of Available FeaturePacks :
";
print "";
$ListAvailable =`cat "/proto/SxM_webui/fpkmgr/FP_list"`;
$nl="\n";
$AvailableArray = "";
$AvailableArray = explode($nl, $ListAvailable);
sort ($AvailableArray);
print "";
print "
";
}
if ($ACTION=="" || $ACTION=="ExecScript")
{
$ACTIONScriptParams=$_REQUEST["Params"];
$myFile = "/proto/SxM_webui/fpkmgr/fpks/".$ScriptFolder."/".$ScriptName.".vars";
$fh = fopen($myFile, 'w');
foreach ( $_REQUEST as $key => $value ) {
$key=str_replace ( "-","",$key );
$value=str_replace ( "\n","",$value );
$value=str_replace ( "(","",$value );
$value=str_replace ( ")","",$value );
$stringData="export GUI_".$key."=".$value."\n";
fwrite($fh, $stringData);
}
fclose($fh);
# $ShellExecResult=shell_exec("sh /proto/SxM_webui/fpkmgr/fpks/".$ScriptFolder."/".$ScriptName.".sh ".$ACTIONScriptParams." 2>&1");
$ShellExecResult=`sh "/proto/SxM_webui/fpkmgr/fpks/$ScriptFolder/$ScriptName.sh" "$ACTIONScriptParams" 2>&1`;
printHeader();
print "| ";
print " ";
$handle=opendir("/proto/SxM_webui/fpkmgr/fpks");
while ($folder = readdir($handle)) {
if ($folder != "." && $folder != ".." && substr($folder, 0, 1) != "_" ) {
if ( is_dir( "/proto/SxM_webui/fpkmgr/fpks/".$folder )) {
print "";
$cmd="cd /proto/SxM_webui/fpkmgr/fpks/".$folder.";find -name '*.sh' 2>&1" ;
$FindScripts = shell_exec($cmd);
$nl="\n";
$Scriptsunsorted = explode($nl,$FindScripts);
sort ($Scriptsunsorted);
print " ";
print " | ";
print "";
}
if ($ACTION == "ExecScript")
{
$nl="\n";
$ResultArray = explode("\n",$ShellExecResult);
print " ";
foreach ($ResultArray as $ResultLine)
{
print "| ".$ResultLine." | ";
}
print " ";
}
print " |
";
print "