<?php
/**
* @Author Tarchini Maurizio
* @Version 1.0
* @AuthorEmail hide@address.com or hide@address.com
* @AuthorSite http://www.mtxweb.ch
* @DocumentDate 23-4-2008
* @DocumentLicense PUBLIC -FREE
* @LicenseDetail GNU General Public License
* @LicenseSite http://www.gnu.org/licenses/gpl.txt
* @PHPCompatibility 4.2 or later
*/
include_once './lib/function_page.php';
include_once './lib/function_db.php';
if (IsAdmin())
{
PageIn();
echo '<h1>Gestore moduli</h1>
<br>
';
BoxIn(850);
echo '<h2>Moduli installati</h2>
<br>
';
$sql = "SELECT * FROM moduli ORDER BY admin DESC";
$res = GetRes($sql);
echo '<table border="0" cellpadding="10">
';
$nomeins = array();
while($row = mysql_fetch_array($res))
{
if($row['notes'] == "")
{
echo '<tr>
<td><b>' . $row['nome'] . '</b></td>
<td><a href="./mod/MEMMOD_' . $row['nome'] . '/uninstall.php"><img src="./images/annulla.png" border="0" alt="disinstalla"></a></td>
<td></td>
</tr>
';
$nomeins[] = $row['nome'];
}
else
{
echo '<tr>
<td><b>' . $row['nome'] . '</b></td>
<td><img src="./images/annulla_n.png" border="0" alt="disinstalla"></td>
<td>' . $row['notes'] . '</td>
</tr>
';
$nomeins[] = $row['nome'];
}
}
echo '</table>
';
BoxOut();
BoxIn(850);
echo '<h2>Moduli pronti per essere installati</h2>
<br>
';
function listaDir ($loc)
{
$dir = opendir("$loc");
$inc = 0;
while (false !== ($file = readdir($dir)))
{
if(substr($file, 0, 6) == "MEMMOD")
{
$directory[$inc] = $file;
$inc = $inc + 1;
}
}
return $directory;
}
$dir = listaDir("./mod/");
$num = count($dir);
echo '<table border="0" cellpadding="10">
<tr>
<td></td>
<td></td>
</tr>
';
for($i = 0; $i < $num; $i++)
{
$nameAr = explode("_", $dir[$i]);
$name = $nameAr[1];
if (!in_array($name,$nomeins))
{
echo "<tr>
<td><b>$name</b></td>
<td><a href=\"./mod/$dir[$i]/install.php\"><img src=\"./images/install.png\" border=\"0\" alt=\"installa\"></a></td>
</tr>
";
}
$nomeins[] = $name;
}
echo '</table>
';
BoxOut();
BoxIn(850);
echo '<h2>Moduli moduli scaricabili dal repository di MtxEventManager</h2>
<br>
';
$modules = file("http://www.mtxweb.ch/MtxEventManager/repository/modules.txt");
$max = count($modules);
echo '<table border="0" cellpadding="10">
<tr>
<td></td>
<td></td>
</tr>
';
for ($i = 0; $i < $max; $i++)
{
if (in_array(trim($modules[$i]), $nomeins))
{
echo '<tr>
<td><b>' . $modules[$i] . '</b></td>
<td>Installato o pronto per l\'installazione</td>
</tr>
';
}
else
{
echo '<tr>
<td><a href="http://www.mtxweb.ch/MtxEventManager/download.php">' . $modules[$i] . '</a></td>
<td>Disponibile sul repository di MtxEventManager</td>
</tr>
';
}
}
echo '</table>
';
BoxOut();
PageOut();
}
else
{
echo '<h1>Non autorizzato</h1>
';
}
?>