'','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; } ?>
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($_['install'])){
$constantStream = file_get_contents(__DIR__.'/constant-sample.php');
if(!isset($_['host'])) $_['host'] = '';
if(!isset($_['login'])) $_['login'] = '';
if(!isset($_['password'])) $_['password'] = '';
if(!isset($_['database'])) $_['database'] = '';
$cryptKey = base64_encode(time().$_['login'].mt_rand(0,1000));
$constantStream = str_replace(
array("{{BASE_SGBD}}","{{BASE_HOST}}","{{BASE_NAME}}","{{BASE_LOGIN}}","{{BASE_PASSWORD}}","{{ROOT_URL}}","{{CRYPT_KEY}}"),
array($_['entity'],$_['host'],$_['name'],$_['login'],$_['password'],$_['root'],$cryptKey),$constantStream
);
file_put_contents(__DIR__.'/constant.php',$constantStream);
require_once(__DIR__.'/constant.php');
require_once(__ROOT__.'class'.SLASH.'Entity.class.php');
//install entities
Entity::install(__ROOT__.'class');
global $conf,$myUser;
$conf = new Configuration();
$conf->getAll();
//create firm
$firm = new Firm();
$firm->label = 'Établissement';
$firm->description = 'Établissement par défaut';
$firm->save();
//create admin rank
$rank = new Rank();
$rank->label = 'Administrateur';
$rank->description = 'Dispose de tous les accès';
$rank->save();
//create default user
$admin = new User();
$admin->login = 'admin';
$admin->password = User::password_encrypt('admin');
$admin->firstname = 'Administrateur';
$admin->name = 'SYS1';
$admin->superadmin = 1;
$admin->rank = $rank->id;
$admin->state = User::ACTIVE;
$admin->save();
$_SESSION['currentUser'] = serialize($admin);
$myUser = $admin;
$userfirmrank = new UserFirmRank();
$userfirmrank->user = $admin->login;
$userfirmrank->firm = $firm->id;
$userfirmrank->save();
$sections = array();
Plugin::callHook('section',array(&$sections));
foreach($sections as $section=>$description){
$right = new Right();
$right->rank = $rank->id;
$right->section = $section;
$right->read = true;
$right->edit = true;
$right->delete = true;
$right->configure = true;
$right->save();
}
$enablePlugins = array('fr.sys1.factory','fr.sys1.dashboard','fr.sys1.notification','fr.sys1.navigation');
if(!empty($custom['action'])) require_once($custom['pluginPath'].$custom['action']);
//Activation des plugins par défaut
foreach ($enablePlugins as $plugin) {
Plugin::state($plugin,true);
}
$states = Plugin::states();
//Activation des plugins pour les établissements
foreach(Firm::loadAll() as $firm){
foreach ($enablePlugins as $plugin) {
$firms = $states[$plugin];
$key = array_search($firm->id, $firms);
$firms[] = $firm->id;
$states[$plugin] = array_values($firms);
Plugin::states($states);
}
}
?>
admin:admin
, pensez à changer le mot de passe rapidemment. '.$e->getTraceAsString().''; ?>