move function from dialog to class, ...

change $_POST['action'] to $_GET['action']
check if an extension exists before printing it out.