sudo chown -R www-data:www-data '.__ROOT__.'
ou de régler le dossier en écriture via votre client ftp');
if(!file_exists(__DIR__.'/file')) mkdir(__DIR__.'/file',0755,true);
if(!file_exists(__DIR__.'/file/avatar')) mkdir(__DIR__.'/file/avatar',0755,true);
//if(!extension_loaded('gd') || !function_exists('gd_info')) throw new Exception('L\'extension php GD2 est requise, veuillez installer GD2 (sous linux :
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;
$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 = 'Chuck';
$admin->name = 'Norris';
$admin->superadmin = 1;
$admin->rank = $rank->id;
$admin->state = User::ACTIVE;
$admin->save();
$_SESSION['currentUser'] = serialize($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();
}
//Activation des plugins par défaut
foreach (array('fr.idleman.factory','fr.idleman.dashboard','fr.idleman.notification') as $plugin) {
Plugin::state($plugin,true);
} ?>
Succès! La base est bien installée, l'utilisateur par défaut est admin:admin
, pensez à changer le mot de passe rapidemment.
Revenir à l'index
Oops! getMessage().' - '.$e->getFile().' L'.$e->getLine().'
'.$e->getTraceAsString().'
';
?>