Пример #1
0
 echo ' <button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-ok"></i> Choisir</button>';
 echo '</div>';
 echo '</form>';
 mysql_close();
 // *** Lecture Fichier Region.ini ***
 $filename2 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "Regions/" . $FichierINIRegions;
 if (file_exists($filename2)) {
     $filename = $filename2;
 } else {
 }
 $tableauIni = parse_ini_file($filename, true);
 if ($tableauIni == FALSE) {
     echo '<p class="alert alert-danger">Proleme de lecture du fichier .ini <strong>$filename</strong></p>';
 }
 // *** Lecture Fichier OpenSimDefaults ***
 $filename2 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim;
 if (file_exists($filename2)) {
     $filename = $filename2;
 } else {
 }
 // **** Recuperation du port http du serveur ******
 if (!($fp = fopen($filename, "r"))) {
     echo "<p class='alert alert-danger'>Echec de l'ouverture du fichier .ini <strong>{$filename}</strong></p>";
 }
 $tabfich = file($filename);
 for ($i = 1; $i < count($tabfich); $i++) {
     // echo "<p>".$tabfich[$i]."</p>";
     $porthttp = strstr($tabfich[$i], "http_listener_port");
     if ($porthttp) {
         $posEgal = strpos($porthttp, '=');
         $longueur = strlen($porthttp);
             fputs($fp, "SizeY\t\t\t\t= " . $tableauIni[$key]['SizeY'] . "\r\n");
         }
         fclose($fp);
         unlink($filename);
         rename(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "Regions/RegionTemp.ini", $filename);
         echo "<p class='alert alert-success alert-anim'>";
         echo "<i class='glyphicon glyphicon-ok'></i>";
         echo " Region <strong>" . $_POST['NewName'] . "</strong> " . $osmw_delete_user_ok . "</p>";
     }
 }
 // ******************************************************
 //  Affichage page principale
 // ******************************************************
 // ******************************************************
 // *** Lecture Fichier Regions.ini ***
 $filename2 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "Regions/Regions.ini";
 if (file_exists($filename2)) {
     $filename = $filename2;
 } else {
     echo "<p class='alert alert-success alert-anim'>";
     echo "<i class='glyphicon glyphicon-ok'></i>";
     echo " <strong>" . $filename2 . "</strong> " . $osmw_erreur_file_exist . "</p>";
 }
 $tableauIni = parse_ini_file($filename, true);
 if ($tableauIni == FALSE) {
     echo "<p class='alert alert-success alert-anim'>";
     echo "<i class='glyphicon glyphicon-ok'></i>";
     echo " {$osmw_erreur_file_ini_exist} <strong>" . $filename . "</strong> ...</p>";
 }
 $i = 0;
 // Autorisation d'ajout de region
Пример #3
0
 function list_file($cur)
 {
     global $PHP_SELF, $order, $asc, $order0;
     if ($dir = opendir($cur)) {
         /* tableaux */
         $tab_dir = array();
         $tab_file = array();
         /* extraction */
         while ($file = readdir($dir)) {
             if (is_dir($cur . "/" . $file)) {
                 if (!in_array($file, array(".", ".."))) {
                     $tab_dir[] = addScheme($file, $cur, 'dir');
                 }
             } else {
                 $tab_file[] = addScheme($file, $cur, 'file');
             }
         }
         /* tri */
         // usort($tab_dir,"cmp_".$order);
         // usort($tab_file,"cmp_".$order);
         /* affichage */
         //*********************************************************************************************************
         echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
         echo "<tr style=\"font-size:8pt;font-family:arial;\">\n    <th>" . ($order == 'name' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Nom</th><td>&nbsp;</td>\n    <th>" . ($order == 'size' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Taille</th><td>&nbsp;</td>\n\t<th>" . ($order == 'date' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Derniere modification</th><td>&nbsp;</td>\n\t</tr>";
         //*********************************************************************************************************
         foreach ($tab_file as $elem) {
             if ($_SESSION['privilege'] == 1) {
                 $cheminWeb = "#";
             } else {
                 $cheminWeb = "pages/force-download.php?file=" . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $elem['name'];
             }
             if (assocExt($elem['ext']) != 'inconnu') {
                 echo "<tr><td>";
                 echo '<FORM METHOD=POST ACTION=""><INPUT TYPE="submit" VALUE="Telecharger" NAME="cmd" ' . $btnN3 . '><INPUT TYPE="submit" VALUE="Supprimer" NAME="cmd" ' . $btnN3 . '><INPUT TYPE="hidden" VALUE="' . $_SESSION['opensim_select'] . '" NAME="name_sim"><INPUT TYPE="hidden" VALUE="' . $elem['name'] . '" NAME="name_file">&nbsp;&nbsp;&nbsp;' . $elem['name'] . '&nbsp;&nbsp;&nbsp;</FORM>';
                 echo "</td><td>&nbsp;</td>\n\t\t  <td align=\"right\">" . formatSize($elem['size']) . "</td><td>&nbsp;</td>\n\t\t  <td>" . date("d/m/Y H:i:s", $elem['date']) . "</td><td>&nbsp;</td></tr>";
             }
         }
         echo "</table>";
         closedir($dir);
         //*********************************************************************************************************
     }
 }
     if ($nom != '' && $email != '' && $objet != '' && $message != '') {
         $headers = 'From: ' . $nom . ' <' . $email . '>' . "\r\n";
         // Envoyer une copie au visiteur ?
         if ($_POST['sendcopy'] == true) {
             $cible = INI_Conf(0, "destinataire") . ', ' . $email;
         } else {
             $cible = INI_Conf(0, "destinataire");
         }
         // Remplacement de caracteres speciaux
         $message = html_entity_decode($message);
         $message = str_replace('&#039;', "'", $message);
         $message = str_replace('&#8217;', "'", $message);
         $message = str_replace('<br>', '', $message);
         $message = str_replace('<br />', '', $message);
         // Envoi du mail
         $message = $message . ' > Serveur Concerne: ' . $hostnameSSH . ' > Simulateur Selectionne: ' . $_SESSION['opensim_select'] . ' ' . INI_Conf_Moteur($_SESSION['opensim_select'], "version");
         if (mail($cible, $objet, $message, $headers)) {
             echo '<div class="alert alert-success alert-anim">' . $message_envoye . '</div>';
         } else {
             echo '<div class="alert alert-danger alert-anim">' . $message_non_envoye . '</div>';
         }
     } else {
         echo '<div class="alert alert-danger alert-anim">' . $message_formulaire_invalide . '</div>';
         echo '<a class="btn btn-primary" href="index.php?a=9"><i class="glyphicon glyphicon-envelope"></i> Retour au formulaire</a>';
         $err_formulaire = true;
     }
 }
 if (!$err_formulaire || !isset($_POST['envoi'])) {
     // afficher le formulaire
     echo "\n" . '<form class="form-group" id="contact" method="post" action="' . $form_action . '">' . "\n";
     echo '  <h4>' . $osmw_label_conatct_coord . '</h4>' . "\n";
Пример #5
0
 // Liste des fichiers
 /* repertoire initial à lister */
 if (!$dir) {
     $dir = INI_Conf_Moteur($_SESSION['opensim_select'], "address");
 }
 list_file(rawurldecode($dir));
 echo '</tr>';
 echo '</table>';
 echo '<h2>Archivage des fichiers</h2>';
 echo '<h3>Transfert vers un serveur ftp externe, archivage des fichiers</h3>';
 if ($_POST['cmd'] == 'Transferer') {
     echo '<p>Archivage du Simulateur <strong class="label label-info">' . $_POST['name_sim'] . '</strong></p>';
     echo '<p>Nombre de fichier archive(s) <span class="badge">' . count($matrice) . '</span></p>';
 }
 echo '<p>Destinations des Sauvegardes ';
 echo '<strong class="label label-info">' . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . '</strong>';
 echo '</p>';
 echo '<h3>Liste des fichiers transferables disponnibles</h3>';
 echo gen_matrice(rawurldecode($dir));
 echo '<div class="form-group">';
 echo '<label for="ftpserver"></label>Serveur FTP';
 echo '<input class="form-control" type="text" name="ftpserver" value="">';
 echo '</div>';
 echo '<div class="form-group">';
 echo '<label for="ftplogin"></label>Login';
 echo '<input class="form-control" type="text" name="ftplogin" value="">';
 echo '</div>';
 echo '<div class="form-group">';
 echo '<label for="ftppass"></label>Password';
 echo '<input class="form-control" type="password" name="ftppass" value="">';
 echo '</div>';
Пример #6
0
    }
    if ($_POST['affichage'] == "shutdown_commands.txt") {
        $fichier = $filename9;
    }
    // Enregistre le fichier
    if (isset($_POST['button'])) {
        unlink($fichier);
        $ouverture = fopen("{$fichier}", "a+");
        fwrite($ouverture, "{$_POST['modif']}");
        fclose($ouverture);
        echo '<div class="alert alert-success alert-anim" role="alert">';
        echo 'Modification du fichier <strong>' . $_POST['affichage'] . '</strong> effectue avec succes ...</div>';
    }
    if (isset($_POST['affichage'])) {
        echo '<div class="alert alert-warning" role="alert">';
        echo '<p>Modification du fichier <strong>' . $_POST['affichage'] . '</strong> sur le Simulateur <strong>' . $_SESSION['opensim_select'] . ' ' . INI_Conf_Moteur($_SESSION['opensim_select'], "version") . '</strong>';
        echo '</div>';
        echo '<form class="form-group" method="post" action="">';
        echo '<input type="hidden" name="affichage" value="' . $_POST['affichage'] . '">';
        echo '<input type="hidden" name="button" value="Modifier" ' . $btnN3 . '>';
        echo '<textarea class="form-control preformat" name="modif" rows="10">';
        echo file_get_contents($fichier);
        echo '</textarea>';
        echo '<p></p>';
        echo '<button class="btn btn-success" type="submit" name="button" ' . $btnN3 . '>';
        echo '<i class="glyphicon glyphicon-ok"></i> Modifier le Fichier</button>';
        echo '</form>';
    }
} else {
    header('Location: index.php');
}
     if ($_SESSION['privilege'] == 1) {
         $btnN1 = "";
         $btnN2 = "";
         $btnN3 = "";
     }
 }
 //SECURITE MOTEUR
 /* ************************************ */
 echo '<h1>' . $osmw_index_4 . '</h1>';
 echo '<div class="clearfix"></div>';
 //******************************************************
 //* Selon ACTION bouton => Envoi Commande via Remote Admin
 //******************************************************
 if (isset($_POST['cmd'])) {
     $RemotePort = RecupRAdminParam_Opensim(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim, " port = ");
     $access_password2 = RecupRAdminParam_Opensim(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim, " access_password = "******" " . $_POST['last'];
             $parameters = array('command' => 'save iar ' . $fullname . ' / ' . $_POST['pass'] . ' BackupIAR_' . $_POST['first'] . '_' . $_POST['last'] . '_' . date(d_m_Y_h) . '.iar');
             $myRemoteAdmin->SendCommand('admin_console_command', $parameters);
             echo "<div class='alert alert-success alert-anim'>";
             echo "<i class='glyphicon glyphicon-ok'></i>";
             echo " " . $osmw_label_msg_inventaire1 . " <strong>" . $fullname . "</strong>, " . $osmw_label_msg_inventaire2 . " ...</div>";
         } else {
             echo "<div class='alert alert-danger alert-anim'>";
             echo "<i class='glyphicon glyphicon-remove'></i>";
             echo " <strong>Login</strong> or <strong>Password</strong> error ...</div>";
         }
     }
Пример #8
0
		  </td>';
    echo '</tr>';
    echo '</table>';
    echo '</form>';
    /* ************************************ */
    /* Lecture Log Si Formulaire OK */
    if (!empty($_POST['first']) && !empty($_POST['last']) && !empty($_POST['pass'])) {
        $aff = "";
        $logfile = "";
        $versionlog = "";
        $fichierLog32 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . 'OpenSim.log';
        if (file_exists($fichierLog32)) {
            $logfile = $fichierLog32;
            $versionlog = "32";
        }
        $fichierLog64 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . 'OpenSim.32BitLaunch.log';
        if (file_exists($fichierLog64)) {
            $logfile = $fichierLog32;
            $versionlog = "64";
        }
        $fcontents = file($logfile);
        $i = sizeof($fcontents) - 10;
        while ($fcontents[$i] != "") {
            // if (strstr($fcontents[$i], '[INVENTORY ARCHIVER]')
            // or strstr($fcontents[$i], '[ARCHIVER]')
            // or strstr($fcontents[$i], '[RADMIN]'))
            $aff .= "<p>" . $fcontents[$i] . "</p>";
            $i++;
        }
        if (!empty($aff)) {
            echo '<h4>Fichier Log ' . $logfile . '</h4>';
Пример #9
0
// PARAMETRAGE DES COMMANDES DISPONIBLE POUR OSMANAGERWEB
//******************************************************
// commande de base
$pre_cmd = "cd " . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . ";./ScreenSend " . $_SESSION['opensim_select'] . " ";
$cmd_OS_force_update = $pre_cmd . "force update";
$cmd_OS_stop = $pre_cmd . "shutdown";
$cmd_OS_restart = $pre_cmd . "restart";
$cmd_OS_save_iar = $pre_cmd . "save iar ";
$cmd_OS_region_root = $pre_cmd . "change region root";
$cmd_SYS_start = "cd " . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . ";./RunOpensim.sh";
$cmd_SYS_etat_OS = "ps -e |grep mono";
$cmd_SYS_etat_OS2 = "screen -list";
$cmd_SYS_Version_mono = "mono -V";
$cmd_SYS_Delete_log32 = "cd " . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . ";chmod 777 OpenSim.log;rm OpenSim.log";
$cmd_SYS_Delete_log64 = "cd " . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . ";chmod 777 OpenSim.32BitLaunch.log;rm OpenSim.32BitLaunch.log";
$cmd_SYS_Delete_file = "cd " . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . ";chmod 777 ";
$cmd_SYS_Delete_Xlog = "cd " . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . ";chmod 777 XEngine.log;rm XEngine.log";
//******************************************************
$MENU_LATTERALE = '<center><div id="menu"><ul>
		<li><a href="./" title="Page d\'accueil"><span>Accueil</span></a></li>
		<li><a href="?a=1" title="Gestion des sims (Messages, Start, Stop)"><span>Sims</span></a></li>
		<li><a href="?a=2" title="Gestion des sauvegardes (OAR, XML2)"><span>Backup</span></a></li>
		<li><a href="?a=3" title="Gestion du Terrain (RAW, JPG)"><span>Terrain</span></a></li>
		<li><a href="?a=7" title="Gestion et Visualisation du Log"><span>Log</span></a></li>
		<li><a href="?a=10" title="Gestion des fichiers de sauvegardes (OAR, IAR, RAW, ...)"><span>Fichiers</span></a></li>
		<li><a href="?a=9" title="Vous avez un probleme, envoyer un mail au gestionnaire du serveur"><span>Contact</span></a></li>
		<li><a href="?a=11" title="Affichage des sims presentes sur le moteur"><span>Carte</span></a></li>
		<li><a href="?a=14" title="Qui a participe au projet OSMW"><span>A Propos</span></a></li>
		<li><a href="?a=13" title="Une question, ici peut etre la reponse !"><span>Aide</span></a></li>
	</ul></div></center>';
$PIED_DE_PAGE = '<hr><center>' . INI_Conf($_SESSION['opensim_select'], "VersionOSMW") . '</center>';
 }
 $tableauIni = parse_ini_file($filename, true);
 if ($tableauIni == FALSE) {
     echo '<p>Error: Reading ini file ' . $filename . '</p>';
 }
 // *** Lecture Fichier Regions.ini ***
 $filename2 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "Regions/" . $FichierINIRegions;
 if (file_exists($filename2)) {
     $filename = $filename2;
 }
 $tableauIni = parse_ini_file($filename, true);
 if ($tableauIni == FALSE) {
     echo '<p>Error: Reading ini file ' . $filename . '</p>';
 }
 // *** Recuperation du port Http du Simulateur
 $srvOS = RecupPortHTTP_Opensim(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim, "http_listener_port");
 echo '<p>Nombre total de regions <span class="badge">' . count($tableauIni) . '</span></p>';
 echo '<table class="table table-hover">';
 echo '<tr>';
 echo '<th>Name</th>';
 echo '<th>Image</th>';
 //   echo '<th>Uuid</th>';
 echo '<th>Location</th>';
 echo '<th>Public IP/Host</th>';
 echo '<th>Private IP/Host</th>';
 echo '<th>Port</th>';
 echo '<th>Format BMP</th>';
 echo '<th>Format RAW</th>';
 echo '</tr>';
 while (list($key, $val) = each($tableauIni)) {
     $uuid = str_replace("-", "", $tableauIni[$key]['RegionUUID']);
Пример #11
0
<?php

include 'config/variables.php';
include 'config/XMLRPC.php';
if (session_is_registered("authentification")) {
    // v&eacute;rification sur la session authentification
    echo '<HR>';
    $ligne1 = '<B>Gestion des Sims connectes.</B>';
    $ligne2 = '*** <u>Moteur OpenSim selectionne: </u>' . INI_Conf_Moteur($_SESSION['opensim_select'], "name") . ' - ' . INI_Conf_Moteur($_SESSION['opensim_select'], "version") . ' ***';
    echo '<div class="block" id="clean-gray"><button><CENTER>' . $ligne1 . '<br>' . $ligne2 . '</CENTER></button></div>';
    echo '<hr>';
    //******************************************************
    $btnN1 = "disabled";
    $btnN2 = "disabled";
    $btnN3 = "disabled";
    if ($_SESSION['privilege'] == 4) {
        $btnN1 = "";
        $btnN2 = "";
        $btnN3 = "";
    }
    //  Niv 4
    if ($_SESSION['privilege'] == 3) {
        $btnN1 = "";
        $btnN2 = "";
        $btnN3 = "";
    }
    //  Niv 3
    if ($_SESSION['privilege'] == 2) {
        $btnN1 = "";
        $btnN2 = "";
    }
 /* ************************************ */
 echo '<h1>' . $osmw_index_5 . '</h1>';
 echo '<div class="clearfix"></div>';
 //******************************************************
 //  Affichage page principale
 //******************************************************
 // *** Test des Fichiers suivants ***
 $filename1 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "OpenSim.ini";
 $filename2 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim;
 $filename3 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "config-include/FlotsamCache.ini";
 $filename4 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "config-include/GridCommon.ini";
 $filename5 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "OpenSim.log";
 $filename6 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "OpenSim.32BitLaunch.log";
 $filename7 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "startuplogo.txt";
 $filename8 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "startup_commands.txt";
 $filename9 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "shutdown_commands.txt";
 //******************************************************
 $dispo = "";
 if (file_exists($filename1)) {
     $dispo = $dispo . '<p><input class="btn btn-default btn-block" type="submit" name="affichage" value="OpenSim.ini"></p>';
 } else {
     if (!$_POST['affichage']) {
         echo '<div class="alert alert-danger alert-anim" role="alert"> <strong>OpenSim.ini</strong> ' . $osmw_erreur_file_exist . '</div>';
     }
 }
 if (file_exists($filename2)) {
     $dispo = $dispo . '<p><input class="btn btn-default btn-block" type="submit" name="affichage" value="' . $FichierINIOpensim . '"></p>';
 } else {
     if (!$_POST['affichage']) {
         // echo "Fichier OpenSimDefaults.ini innexistant ...";
         echo '<div class="alert alert-danger alert-anim" role="alert"> <strong>".$FichierINIOpensim."</strong> ' . $osmw_erreur_file_exist . '</div>';
Пример #13
0
            ?>
 alert-anim">
                <?php 
            echo $message;
            ?>
            </div>
        <?php 
        }
        ?>
        <?php 
        unset($_SESSION['flash']);
        ?>
    <?php 
    }
    ?>
    
    <?php 
    // <!-- liste des fichiers -->
    /* Repertoire initial a lister */
    $dir = "";
    $dir = INI_Conf_Moteur($_SESSION['opensim_select'], "address");
    if ($dir) {
        list_file(rawurldecode($dir));
    } else {
        echo '<div class="alert alert-danger alert-anim" role="alert">';
        echo 'Le <strong>chemin</strong> est incorrecte ...';
        echo '</div>';
    }
} else {
    header('Location: index.php');
}
Пример #14
0
 if ($tableauIni == FALSE) {
     echo 'prb lecture ini ' . $data["address"] . $FichierINIOpensim . '<br>';
 } else {
     echo 'Fichier PRESENT OpenSimDefaults.ini OK<br>';
 }
 echo "********************************<br>";
 // *** Fichier PRESENT Fichier RunOpensim.sh ***
 $tableauIniOS = parse_ini_file(INI_Conf_Moteur($key, "address") . "RunOpensim.sh", true);
 if ($tableauIni == FALSE) {
     echo 'prb lecture RunOpensim.sh ' . $data["address"] . "RunOpensim.sh" . '<br>';
 } else {
     echo 'Fichier PRESENT RunOpensim.sh OK<br>';
 }
 echo "********************************<br>";
 // *** Fichier PRESENT Fichier ScreenSend ***
 $tableauIniOS = parse_ini_file(INI_Conf_Moteur($key, "address") . "ScreenSend", true);
 if ($tableauIni == FALSE) {
     echo 'prb lecture ScreenSend ' . $data["address"] . "ScreenSend" . '<br>';
 } else {
     echo 'Fichier PRESENT ScreenSend OK<br>';
 }
 echo "********************************<br>";
 // Test de connection par serveur *********************************
 if (!function_exists("ssh2_connect")) {
     die("function ssh2_connect doesn't exist");
 }
 // log in at server1.example.com on port 22
 if (!($con = ssh2_connect($hostnameSSH, 22))) {
     echo "fail: unable to establish connection\n";
 } else {
     // try to authenticate with username root, password secretpassword
Пример #15
0
     echo "Fichier existant " . ($fichierLog = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . 'OpenSim.log');
     echo '<strong> OpenSim.log</strong>';
     echo '</div>';
 } else {
     if ($_POST['cmd']) {
         echo '<div class="alert alert-danger alert-anim" role="alert">';
         echo "Le fichier <strong>OpenSim.log</strong> n'existe pas";
         echo '</div>';
     }
 }
 $fichierLog64 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . 'OpenSim.32BitLaunch.log';
 if (file_exists($fichierLog64)) {
     $logfile = $fichierLog32;
     $versionlog = "64";
     echo '<div class="alert alert-success alert-anim" role="alert">';
     echo "Fichier existant " . ($fichierLog = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . 'OpenSim.32BitLaunch.log');
     echo '<strong> OpenSim.32BitLaunch.log</strong>';
     echo '</div>';
 } else {
     if ($_POST['cmd']) {
         echo '<div class="alert alert-danger alert-anim" role="alert">';
         echo "Le fichier <strong>OpenSim.32BitLaunch.log</strong> n'existe pas";
         echo '</div>';
     } else {
         $logfile = "";
     }
 }
 $taille_fichier = filesize($fichierLog);
 if ($taille_fichier >= 1073741824) {
     $taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";
 } else {
function list_file($cur)
{
    global $PHP_SELF, $order, $asc, $order0;
    if ($dir = opendir($cur)) {
        /* tableaux */
        $tab_dir = array();
        $tab_file = array();
        /* extraction */
        while ($file = readdir($dir)) {
            if (is_dir($cur . "/" . $file)) {
                if (!in_array($file, array(".", ".."))) {
                    $tab_dir[] = addScheme($file, $cur, 'dir');
                }
            } else {
                $tab_file[] = addScheme($file, $cur, 'file');
            }
        }
        /* affichage */
        echo "<table class='table table-hover'>";
        echo "<tr>";
        echo "<th>" . ($order == 'name' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Nom</th>";
        echo "<th>" . ($order == 'size' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Taille</th>";
        echo "<th>" . ($order == 'date' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Date</th>";
        echo "<th>" . ($order == 'time' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Time</th>";
        echo "<th>" . ($order == 'ext' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Type</th>";
        echo "<th>" . ($order == 'name' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Download</th>";
        echo "<th>" . ($order == 'name' ? $asc == 'a' ? '/\\ ' : '\\/ ' : '') . "Delete</th>";
        echo "</tr>";
        foreach ($tab_file as $elem) {
            if (assocExt($elem['ext']) != 'inconnu') {
                echo '<tr>';
                echo '<td>';
                echo '<h5><i class="glyphicon glyphicon-saved text-success"></i>';
                echo ' <input type="hidden" value="' . $_SESSION['opensim_select'] . '" name="name_sim">';
                echo '<input type="hidden" value="' . $elem['name'] . '" name="name_file">' . $elem['name'] . '';
                echo '</h5></td>';
                echo '<td><h5>' . formatSize($elem['size']) . '</h5></td>';
                echo '<td><h5><span class="badge">' . date("d-m-Y", $elem['date']) . '</span></h5></td>';
                echo '<td><h5><span class="badge">' . date("H:i:s a", $elem['date']) . '</span></h5></td>';
                echo '<td><h5>' . assocExt($elem['ext']) . '</h5></td>';
                echo '<td>';
                $moteursOK = Securite_Simulateur();
                /* ************************************ */
                //SECURITE MOTEUR
                $btnN1 = "disabled";
                $btnN2 = "disabled";
                $btnN3 = "disabled";
                if ($_SESSION['privilege'] == 4) {
                    $btnN1 = "";
                    $btnN2 = "";
                    $btnN3 = "";
                }
                // Niv 4
                if ($_SESSION['privilege'] == 3) {
                    $btnN1 = "";
                    $btnN2 = "";
                    $btnN3 = "";
                }
                // Niv 3
                if ($_SESSION['privilege'] == 2) {
                    $btnN1 = "";
                    $btnN2 = "";
                }
                // Niv 2
                if ($moteursOK == "OK") {
                    if ($_SESSION['privilege'] == 1) {
                        $btnN1 = "";
                        $btnN2 = "";
                        $btnN3 = "";
                    }
                }
                //SECURITE MOTEUR
                /* ************************************ */
                if ($_SESSION['privilege'] >= 3) {
                    $action = "inc/download.php?file=" . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $elem['name'];
                    // $btnN3 = "";
                    echo '<form method="post" action="' . $action . '">';
                    echo '<input type="hidden" value="' . $_SESSION['opensim_select'] . '" name="name_sim">';
                    echo '<input type="hidden" value="' . $elem['name'] . '" name="name_file">';
                    echo '<button class="btn btn-success" type="submit" value="download" name="cmd" >';
                    echo '<i class="glyphicon glyphicon-download-alt"></i> Download</button>';
                    echo '</form>';
                    echo '<td>';
                    echo '<form method="post" action="">';
                    echo '<input type="hidden" value="' . $_SESSION['opensim_select'] . '" name="name_sim">';
                    echo '<input type="hidden" value="' . $elem['name'] . '" name="name_file">';
                    echo ' <button class="btn btn-danger" type="submit" value="delete" name="cmd" >';
                    echo '<i class="glyphicon glyphicon-trash"></i> Delete</button>';
                    echo '</td>';
                    echo '</form>';
                } else {
                    if ($moteursOK == "OK") {
                        echo '<form method="post" action="">';
                        echo '<input type="hidden" value="' . $_SESSION['opensim_select'] . '" name="name_sim">';
                        echo '<input type="hidden" value="' . $elem['name'] . '" name="name_file">';
                        echo '<button class="btn btn-success" type="submit" value="download" name="cmd" ' . $btnN2 . '>';
                        echo '<i class="glyphicon glyphicon-download-alt"></i> Download</button>';
                        echo '<td>';
                        echo ' <button class="btn btn-danger" type="submit" value="delete" name="cmd" ' . $btnN2 . '>';
                        echo '<i class="glyphicon glyphicon-trash"></i> Delete</button>';
                        echo '</td>';
                        echo '</form>';
                    } else {
                        echo '<form method="post" action="">';
                        echo '<button class="btn btn-success" type="submit" name="cmd" disabled>';
                        echo '<i class="glyphicon glyphicon-download-alt"></i> Download</button>';
                        echo '<td>';
                        echo ' <button class="btn btn-danger" type="submit" name="cmd" disabled>';
                        echo '<i class="glyphicon glyphicon-trash"></i> Delete</button>';
                        echo '</td>';
                        echo '</form>';
                    }
                }
                echo '</td>';
                echo '</tr>';
            }
        }
        echo '</table>';
        closedir($dir);
    }
}
Пример #17
0
<?php

if (isset($_SESSION['authentification']) && $_SESSION['privilege'] >= 3) {
    echo '<p class="pull-right"><span class="label label-danger">Espace Securise Niveau ' . $_SESSION['privilege'] . '</span></p>';
    echo '<h1>Gestion des Utilisateurs</h1>';
    echo '<div class="clearfix"></div>';
    echo '<p>Simulateur selectionne ';
    echo '<strong class="label label-info">' . $_SESSION['opensim_select'] . ' ' . INI_Conf_Moteur($_SESSION['opensim_select'], "version") . '</strong>';
    echo '</p>';
    // ******************************************************
    $btnN1 = "disabled";
    $btnN2 = "disabled";
    $btnN3 = "disabled";
    if ($_SESSION['privilege'] == 4) {
        $btnN1 = "";
        $btnN2 = "";
        $btnN3 = "";
    }
    // Niv 4
    if ($_SESSION['privilege'] == 3) {
        $btnN1 = "";
        $btnN2 = "";
        $btnN3 = "";
    }
    // Niv 3
    if ($_SESSION['privilege'] == 2) {
        $btnN1 = "";
        $btnN2 = "";
    }
    // Niv 2
    if ($_SESSION['privilege'] == 1) {
     // echo '# '.$_POST['cmd'].' #<br />';
     if (isset($_POST['versionLog'])) {
         $cheminWIN = "";
         $OS = trim(php_uname("s"));
         if ($OS = "Windows NT") {
             $cheminWIN = str_replace('/', '\\', INI_Conf_Moteur($_SESSION['opensim_select'], "address"));
         }
         unlink($cheminWIN . "OpenSim.log");
     }
 }
 //******************************************************
 //  Affichage page principale
 //******************************************************
 echo Select_Simulateur($_SESSION['opensim_select']);
 $fichierLog = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . 'OpenSim.log';
 if (file_exists(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . 'OpenSim.log')) {
     echo '<div class="alert alert-success alert-anim" role="alert">';
     echo "File exist: <strong>" . $fichierLog . '</strong>';
     echo '</div>';
 } else {
     if ($_POST['cmd']) {
         echo '<div class="alert alert-danger alert-anim" role="alert">';
         echo "File not exist: <strong>" . $fichierLog . '</strong>';
         echo '</div>';
     }
 }
 $taille_fichier = filesize($fichierLog);
 if ($taille_fichier >= 1073741824) {
     $taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";
 } else {
     if ($taille_fichier >= 1048576) {