<?php


/**
 * Klasse Uninstall
 * Zeigt installierte Apps und bietet die Möglichkeit diese zu deinstallieren
 */

class Uninstall {

	/*
	 * Funktion display erzeugt den Inhalt von der HTML-Seite
	 */
	function display($args) {
		// args
		$m = $_GET['m'];
		if (isset($_POST['app'])){
			exec("/usr/local/sbin/userapp_uninstall.sh ".$_POST['app']);
		}
		include('./includes/header.php');

		// build page content
		$ret .= "<br>
				<table class='contenttoc' id='table'>
				<tr>
				<th colspan='2'>".UNINSTALL_TABLE_HEADER_DIS."</th>
				</tr>
				";
				if ($dh = opendir("/home/admin/apps/")) {
                    while (($file = readdir($dh)) !== false) {
                        //$ret.="found file: $file";
                        if($file != "." && $file != "..")
                            $ret.="
                            <tr>
								<td>".$file."</td>
								<td><form class='extensions_form' action='' method='POST'>
									<input type=hidden name='app' value=" . $file . ">
									<input type='image' src='./includes/images/delete.png' onclick=\"return confirm('".UNINSTALL_DELETE_MESS1_DIS." ".$file."?');\">
									</form>
								</td>
							</tr>";
                    }
                    closedir($dh);
                }
                $ret .= "<br></table>";


		//Rückgabe: Inhalt der HTML-Seite
		return $ret;
	}


}
?>
