Ejemplo n.º 1
0
function is_installed()
{
    if (file_exists('../application/config/config.php') && file_exists('../application/config/database.php')) {
        require '../application/config/database.php';
        if (!test_database_connection($db['default']['hostname'], $db['default']['username'], $db['default']['password'], $db['default']['database'])) {
            if (check_for_database_tables($db['default']['hostname'], $db['default']['username'], $db['default']['password'], $db['default']['database'], $db['default']['dbprefix'])) {
                return TRUE;
            } else {
                return FALSE;
            }
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
Ejemplo n.º 2
0
 if (strpos($database['wordpress']['prefix'], '_') === FALSE) {
     $database['wordpress']['prefix'] .= '_';
 }
 if (strpos($database['openblog']['prefix'], '_') === FALSE) {
     $database['openblog']['prefix'] .= '_';
 }
 // SEO urls
 $blog['enable_seo_urls'] = get_mod_rewrite_status();
 if (empty($database['wordpress']['hostname']) || empty($database['wordpress']['username']) || empty($database['wordpress']['password']) || empty($database['wordpress']['name']) || empty($database['wordpress']['prefix']) || empty($database['openblog']['hostname']) || empty($database['openblog']['username']) || empty($database['openblog']['password']) || empty($database['openblog']['name']) || empty($database['openblog']['prefix'])) {
     echo "All fields are required!<br /><br /><a href=\"javascript:history.go(-1)\">&lsaquo;&lsaquo; Back</a>";
 } else {
     if (empty($blog['url'])) {
         echo "Could not detect the blog root URL!";
     } else {
         $database_error['wordpress'] = test_database_connection($database['wordpress']['hostname'], $database['wordpress']['username'], $database['wordpress']['password'], $database['wordpress']['name']);
         $database_error['openblog'] = test_database_connection($database['openblog']['hostname'], $database['openblog']['username'], $database['openblog']['password'], $database['openblog']['name']);
         if ($database_error['wordpress']) {
             echo "Could not connect to the server or select the database (Wordpress)!<br /><br /><a href=\"javascript:history.go(-1)\">&lsaquo;&lsaquo; Back</a>";
         } else {
             if ($database_error['openblog']) {
                 echo "Could not connect to the server or select the database (Open Blog)!<br /><br /><a href=\"javascript:history.go(-1)\">&lsaquo;&lsaquo; Back</a>";
             } else {
                 mysql_connect($database['wordpress']['hostname'], $database['wordpress']['username'], $database['wordpress']['password']) or die(mysql_error());
                 mysql_select_db($database['wordpress']['name']) or die(mysql_error());
                 $data = get_data($database['wordpress']['prefix']);
                 mysql_close();
                 mysql_connect($database['openblog']['hostname'], $database['openblog']['username'], $database['openblog']['password']) or die(mysql_error());
                 mysql_select_db($database['openblog']['name']) or die(mysql_error());
                 create_new_tables($database['openblog']['prefix']);
                 insert_data($database['wordpress']['prefix'], $database['openblog']['prefix'], $data);
                 // write the main config file
Ejemplo n.º 3
0
 if (empty($blog['links_per_box'])) {
     $blog['links_per_box'] = 5;
 }
 if (empty($blog['months_per_archive'])) {
     $blog['months_per_archive'] = 8;
 }
 if (strpos($database['prefix'], '_') === false) {
     $database['prefix'] .= '_';
 }
 if (substr($blog['url'], -1, 1) != '/') {
     $blog['url'] .= '/';
 }
 if (empty($database['hostname']) || empty($database['username']) || empty($database['password']) || empty($database['name']) || empty($database['prefix']) || empty($blog['url']) || empty($blog['title']) || empty($blog['description']) || empty($blog['meta_keywords']) || empty($blog['posts_per_site']) || empty($blog['links_per_box']) || empty($blog['months_per_archive']) || empty($administrator['username']) || empty($administrator['password']) || empty($administrator['email'])) {
     echo "All fields are required!<br /><br /><a href=\"javascript:history.go(-1)\">&lsaquo;&lsaquo; Back</a>";
 } else {
     $database_error = test_database_connection($database['hostname'], $database['username'], $database['password'], $database['name']);
     if ($database_error) {
         echo "Could not connect to the server or select the dabatase!<br /><br /><a href=\"javascript:history.go(-1)\">&lsaquo;&lsaquo; Back</a>";
     } else {
         mysql_connect($database['hostname'], $database['username'], $database['password']) or die(mysql_error());
         mysql_select_db($database['name']) or die(mysql_error());
         // create tables
         create_tables($database['prefix']);
         insert_blog_data($database['prefix'], $blog['title'], $blog['description'], $blog['meta_keywords'], $blog['allow_registrations'], $blog['posts_per_site'], $blog['links_per_box'], $blog['months_per_archive']);
         if (empty($administrator['display_name'])) {
             insert_admin_data($database['prefix'], $administrator['username'], $administrator['password'], $administrator['email']);
         } else {
             insert_admin_data($database['prefix'], $administrator['username'], $administrator['password'], $administrator['email'], $administrator['display_name']);
         }
         mysql_close();
         // write main config file