$value) { $connectionString = str_replace('{{'.$key.'}}',$value,$connectionString); } $connectionString = str_replace('{{ROOT}}',dirname(__FILE__).DIRECTORY_SEPARATOR,$connectionString); try{ $connection = new PDO($connectionString, $_GET['login'], $_GET['password'],$connector::pdo_attributes()); }catch(Exception $e){ $response['error'] = 'Connexion impossible : '.$e->getMessage(); } echo json_encode($response); exit(); } try { /* Page customizable depuis n'importe quel app.json de plugin via la mention : "install": { "css" : "css/install.css", "js" : "js/install.js", "action" : "install.php" }, css : chemin relatif au plugin d'un fichier css custom d'install js : chemin relatif au plugin d'un fichier js custom d'install action : chemin vers un fichier php contenant le code qui doit s'executer en fin d'installation. */ date_default_timezone_set('Europe/Paris'); mb_internal_encoding('UTF-8'); require_once(__DIR__.'/function.php'); spl_autoload_register('app_autoloader'); $_ = array_map('secure_user_vars', array_merge($_POST, $_GET)); require_once('class/Plugin.class.php'); $entityFolder = __DIR__.'/class/'; if(file_exists(__DIR__.DIRECTORY_SEPARATOR.'.git') && !file_exists(__DIR__.DIRECTORY_SEPARATOR.'.git'.DIRECTORY_SEPARATOR.'.htaccess')){ file_put_contents(__DIR__.DIRECTORY_SEPARATOR.'.git'.DIRECTORY_SEPARATOR.'.htaccess', 'deny for all'); } $custom = array('css' => '','js' => '','action' => ''); //Recherche de custom install dans les plugins foreach(glob(__DIR__.DIRECTORY_SEPARATOR.'plugin'.DIRECTORY_SEPARATOR.'*'.DIRECTORY_SEPARATOR.'app.json') as $app){ $manifest = json_decode(file_get_contents($app),true); if(!$manifest || !isset($manifest['install'])) continue; $custom = $manifest['install']; $custom['plugin'] = 'plugin/'.basename(dirname($app)).'/'; $custom['pluginPath'] = __DIR__.DIRECTORY_SEPARATOR.'plugin'.DIRECTORY_SEPARATOR.basename(dirname($app)).DIRECTORY_SEPARATOR; } /* Installation en mode cli, exemple : php install.php "{\"connector\":\"Mysql\",\"host\":\"mysql-host\",\"login\":\"root\",\"password\":\"root\",\"name\":\"hackpoint\",\"root\":\"http:\/\/127.0.0.1\/hackpoint\"}" */ if(php_sapi_name() == 'cli'){ echo 'Headless install...'.PHP_EOL; $parameters = json_decode($argv[1],true); echo 'Parameters: '.PHP_EOL; print_r($parameters); echo 'Installing... '.PHP_EOL; install_core($parameters,$custom); echo 'Installation done. '.PHP_EOL; exit(); } ?>
sudo chown -R www-data:www-data '.__ROOT__.'
sudo apt-get install php5-gd && service apache2 restart
)');
//if(!in_array('sqlite',PDO::getAvailableDrivers())) throw new Exception('Le driver SQLITE est requis, veuillez installer sqlite3 (sous linux : sudo apt-get install php5-sqlite && service apache2 restart
)');
if(isset($_['connector'])){
install_core($_,$custom);
?>
admin:admin
, pensez à changer le mot de passe rapidemment. '.$e->getTraceAsString().''; ?>