Example #1
0
 /**
  * Install a module
  * @param string $module
  * @return string 
  */
 protected function installModuleAction($module = FALSE)
 {
     if (is_file('modules/' . $module . '/module.php') && !isset(\app::$config['modules'][$module])) {
         try {
             \app::$activeModules[$module] = '1';
             $moduleObj = \app::getModule($module);
             if ($moduleObj->install()) {
                 $configObj = new \core\classes\config('profiles/' . PROFILE . '/config.php', TRUE);
                 $update = array('modules' => array($module => method_exists($moduleObj, '__wakeup') ? '3' : '1'));
                 $configObj->saveConfig($update);
                 return TRUE;
             }
         } catch (\Exception $ex) {
             return FALSE;
         }
     }
 }
Example #2
0
 include 'modules/blog/module.php';
 $blog = new \blog\module('blog');
 $blog->install();
 date_default_timezone_set($config['localization']['timezone']);
 //avoid timezone error on new user
 echo '<div style="display:none">';
 $core->getEntity('user')->insertInto(array('id_user' => '', 'pseudo' => $_POST['identifiant'], 'mail' => $_POST['mail'], 'pass' => $_POST['pass1'], 'registration' => '', 'state' => '1', 'id_role' => '1'));
 $blog->getEntity('tag')->insertInto(array('id_tag' => '1', 'name' => 'Article', 'url' => 'article'));
 $blog->getEntity('tag_post')->insertInto(array('id_tag_post' => '1', 'id_tag' => '1', 'id_post' => '1'));
 $blog->getEntity('category')->insertInto(array('id_category' => '1', 'name' => 'General', 'id_parent' => null, 'url' => 'general', 'description' => ''));
 $blog->getEntity('category_post')->insertInto(array('id_user' => '1', 'id_category' => '1', 'id_post' => '1'));
 $blog->getEntity('post')->insertInto(array('id_post' => '1', 'title' => 'Hello World', 'url' => 'my-first-post', 'content' => '<p>Welcome to Parsimony. This is your first post. </p><p>Click on the edit button in the header toolbar to edit the text, modify or delete it.</p> <p>Start blogging by clicking in the left toolbar on Data button then Posts!</p>', 'excerpt' => '', 'publicationGMT' => gmdate('Y-m-d H:i:s', time()), 'publicationGMT_visibility' => '0', 'publicationGMT_status' => '0', 'author' => '1', 'has_comment' => '1', 'ping_status' => '1', 'is_sticky' => '0'));
 echo '</div>';
 $configObj = new \core\classes\config('profiles/www/config.php', TRUE);
 $update = array('sitename' => $_POST['name']);
 $configObj->saveConfig($update);
 //unlock site
 $index = file('index.php');
 if (trim($index[1]) == 'include(\'installNewLife.php\');exit;') {
     unset($index[1]);
     file_put_contents('index.php', implode('', $index));
 }
 //lock install
 $install = file('installNewLife.php');
 $install[0] = '<?php exit; ';
 file_put_contents('installNewLife.php', implode('', $install));
 setcookie("takeATour", 'yes', time() + 3600, '/');
 ?>
 <h1 style="text-align: center;"><?php 
 echo tr('Congratulations, Parsimony is now ready');
 ?>