$file = fopen(FILE_SHADOW, 'w'); fputs($file, $text); fclose($file); // keys.php $key1 = Crypt::get_hash(Text::random_text(11)); $key2 = Crypt::get_hash(Text::random_text(11)); $key3 = Crypt::get_hash(Text::random_text(11)); $text = '<?php $_KEYS[0] = "nibbl' . $key1 . '"; $_KEYS[1] = "eblog' . $key2 . '"; $_KEYS[2] = "rulez' . $key3 . '"; ?>'; $file = fopen(FILE_KEYS, 'w'); fputs($file, $text); fclose($file); // welcome post $content = '<p>' . $_LANG['WELCOME_POST_LINE1'] . '</p>'; $content .= '<p>' . $_LANG['WELCOME_POST_LINE2'] . '</p>'; $content .= '<p>' . $_LANG['WELCOME_POST_LINE3'] . '</p>'; $_DB_POST = new DB_POSTS(FILE_XML_POSTS); $_DB_POST->add(array('id_user' => 0, 'id_cat' => 0, 'type' => 'simple', 'description' => $_LANG['WELCOME_POST_TITLE'], 'title' => $_LANG['WELCOME_POST_TITLE'], 'content' => $content, 'allow_comments' => '1', 'sticky' => '0', 'slug' => 'welcome-post')); // Plugins $plugins = array('pages', 'categories', 'latest_posts'); foreach ($plugins as $plugin) { include_once PATH_PLUGINS . $plugin . '/plugin.bit'; $class = 'PLUGIN_' . strtoupper($plugin); $obj = new $class(); if (@(!(include PATH_PLUGINS . $plugin . '/languages/' . $_GET['language'] . '.bit'))) { include PATH_PLUGINS . $plugin . '/languages/en_US.bit'; } $merge = array_merge($_LANG, $_PLUGIN_CONFIG['LANG']); $obj->set_lang($merge); $obj->set_attributes(array('name' => $_PLUGIN_CONFIG['LANG']['NAME'], 'description' => $_PLUGIN_CONFIG['LANG']['DESCRIPTION'], 'author' => $_PLUGIN_CONFIG['DATA']['author'], 'version' => $_PLUGIN_CONFIG['DATA']['version'], 'url' => $_PLUGIN_CONFIG['DATA']['url'], 'display' => isset($_PLUGIN_CONFIG['DATA']['display']) ? false : true)); include PATH_PLUGINS . $plugin . '/languages/en_US.bit'; $obj->set_slug_name($_PLUGIN_CONFIG['LANG']['NAME']);
$filenamepost = Text::replace('posts.xml', 'post.xml', FILE_XML_POSTS); if (file_exists($filenamepost)) { $obj = new NBXML($filenamepost, 0, TRUE, '', FALSE); add_if_not($obj, 'friendly', ''); if ($obj->asXml(FILE_XML_POSTS)) { echo Html::p(array('class' => 'pass', 'content' => 'DB updated: ' . FILE_XML_POSTS)); @unlink($filenamepost); } else { echo Html::p(array('class' => 'pass', 'content' => 'FAIL - DB updated: ' . FILE_XML_POSTS)); } } // ===================================================== // Posts // ===================================================== $posts_files = Filesystem::ls(PATH_POSTS, '*', 'xml', false, false, false); $_DB_POST = new DB_POSTS(FILE_XML_POSTS); foreach ($posts_files as $file_old) { $explode = explode('.', $file_old); $post = new NBXML(PATH_POSTS . $file_old, 0, TRUE, '', FALSE); // Generate the slug url $id_post = (int) $explode[1]; $slug = Text::clean_url((string) $post->getChild('title'), '-', $translit_enable); $_DB_POST->slug($id_post, $slug); $_DB_POST->savetofile(); if (count($explode) == 11) { $unixstamp = (int) $post->getChild('pub_date'); array_unshift($explode, $unixstamp); // Implode the filename $filename = implode('.', $explode); // Delete the old post unlink(PATH_POSTS . $file_old);