/** * insert the data * * @since 2.4.0 * * @param array $optionArray options of the installation */ public function insertData($optionArray = null) { $language = Language::getInstance(); $language->init(); /* articles */ Db::forTablePrefix('articles')->create()->set(['title' => 'Welcome', 'alias' => 'welcome', 'author' => $optionArray['adminUser'], 'text' => file_get_contents('database/html/articles/welcome.phtml'), 'category' => 1, 'comments' => 1, 'rank' => 1])->save(); /* categories */ Db::forTablePrefix('categories')->create()->set(['title' => 'Home', 'alias' => 'home', 'author' => $optionArray['adminUser'], 'rank' => 1])->save(); /* extras */ $extrasArray = ['categories' => ['category' => null, 'headline' => 1, 'status' => 1], 'articles' => ['category' => null, 'headline' => 1, 'status' => 1], 'comments' => ['category' => null, 'headline' => 1, 'status' => 1], 'languages' => ['category' => null, 'headline' => 1, 'status' => 0], 'templates' => ['category' => null, 'headline' => 1, 'status' => 0], 'teaser' => ['category' => 1, 'headline' => 0, 'status' => 0]]; $extrasRank = 0; /* process extras array */ foreach ($extrasArray as $key => $value) { Db::forTablePrefix('extras')->create()->set(['title' => ucfirst($key), 'alias' => $key, 'author' => $optionArray['adminUser'], 'text' => file_get_contents('database/html/extras/' . $key . '.phtml'), 'category' => $value['category'], 'headline' => $value['headline'], 'status' => $value['status'], 'rank' => ++$extrasRank])->save(); } /* comments */ Db::forTablePrefix('comments')->create()->set(['author' => $optionArray['adminUser'], 'email' => $optionArray['adminEmail'], 'text' => file_get_contents('database/html/comments/hello.phtml'), 'article' => 1, 'rank' => 1])->save(); /* groups */ Db::forTablePrefix('groups')->create()->set(['name' => 'Administrators', 'alias' => 'administrators', 'description' => 'Unlimited access', 'categories' => '1, 2, 3', 'articles' => '1, 2, 3', 'extras' => '1, 2, 3', 'comments' => '1, 2, 3', 'groups' => '1, 2, 3', 'users' => '1, 2, 3', 'modules' => '1, 2, 3', 'settings' => 1, 'filter' => 0])->save(); Db::forTablePrefix('groups')->create()->set(['name' => 'Members', 'alias' => 'members', 'description' => 'Default members group'])->save(); /* modules */ if (is_dir('modules/CallHome')) { $callHome = new Modules\CallHome\CallHome(); $callHome->install(); } if (is_dir('modules/Validator')) { $validator = new Modules\Validator\Validator(); $validator->install(); } /* settings */ $settingArray = ['language' => 'detect', 'template' => 'default', 'title' => $language->get('name', '_package'), 'author' => $optionArray['adminName'], 'copyright' => null, 'description' => $language->get('description', '_package'), 'keywords' => null, 'robots' => null, 'email' => $optionArray['adminEmail'], 'subject' => $language->get('name', '_package'), 'notification' => 0, 'charset' => 'utf-8', 'divider' => ' - ', 'time' => 'H:i', 'date' => 'd.m.Y', 'homepage' => 0, 'limit' => 10, 'order' => 'asc', 'pagination' => 1, 'registration' => 1, 'verification' => 0, 'recovery' => 1, 'moderation' => 0, 'captcha' => 0, 'version' => $language->get('version', '_package')]; /* process settings array */ foreach ($settingArray as $name => $value) { Db::forTablePrefix('settings')->create()->set(['name' => $name, 'value' => $value])->save(); } /* users */ $passwordHash = new Hash(Config::getInstance()); $passwordHash->init($optionArray['adminPassword']); Db::forTablePrefix('users')->create()->set(['name' => $optionArray['adminName'], 'user' => $optionArray['adminUser'], 'password' => $passwordHash->getHash(), 'email' => $optionArray['adminEmail'], 'description' => 'God admin', 'groups' => '1'])->save(); }
//on the cloud change this with false ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); error_reporting(E_ALL); } //--------------- 2. INCLUDES ------------------------------------------------------- file_exists(APP_PATH . '/application/util_func.php') ? include_once APP_PATH . "/application/util_func.php" : ""; file_exists(APP_PATH . '/library/Core.php') ? include_once APP_PATH . "/library/Core.php" : ""; if (file_exists(APP_PATH . '/library/recaptchalib.php')) { require_once APP_PATH . '/library/recaptchalib.php'; } //------------ 3 INI CLASSES ------------------------------------------------------- Core::initialize(); Sessions::init(); CSRF::init(); Hash::init(); //----------------------4 ERROR REPORTING --------------------------------------------- if ($local == false) { //set_error_handler('Errors::my_error_handler_prod'); set_error_handler('Errors::my_error_handler', E_ALL); if (isset($_SESSION['system_error_message'])) { error_log($_SESSION['system_error_message'] . "\n", 3, "/home/remb4372/public_html/traian4/new-pdo/error.log"); } } else { set_error_handler('Errors::my_error_handler', E_ALL); if (isset($_SESSION['system_error_message'])) { error_log($_SESSION['system_error_message'] . "\n", 3, "C:\\Users\\victor92\\OneDrive\\htdocs\\traian4\\new-pdo\\error.log"); } } // ------------ 5 CONFIG KEYS, ENCRYPTION FROM INI FILE ---------------------------- $sec = Config_ini::getConfig("sec");