Example #1
0
                        if (!installer::unpack_var()) {
                            $content = oops("Unable to create files inside the <code>var</code> directory");
                        } else {
                            if (!installer::unpack_sql($config)) {
                                $content = oops("Failed to create tables in your database:" . mysql_error());
                            } else {
                                if (!installer::create_database_config($config)) {
                                    $content = oops("Couldn't create var/database.php");
                                } else {
                                    try {
                                        list($user, $password) = installer::create_admin($config);
                                        installer::create_admin_session($config);
                                        $content = render("success.html.php", array("user" => $user, "password" => $password));
                                        installer::create_private_key($config);
                                    } catch (Exception $e) {
                                        $content = oops($e->getMessage());
                                    }
                                }
                            }
                        }
                    }
                }
            }
            break;
    }
}
include "views/install.html.php";
function render($view, $args = array())
{
    ob_start();
    extract($args);
Example #2
0
    oops("Unable to connect to the database.\n" . mysql_error() . "\n");
} else {
    if (!installer::select_db($config)) {
        oops("Database {$config['dbname']} doesn't exist and can't be created.  " . "Please create the database by hand.");
    } else {
        if (!installer::db_empty($config)) {
            oops("Database {$config['dbname']} already has tables in it. " . "Please specify an empty database.\n");
        } else {
            if (!installer::unpack_var()) {
                oops("Unable to create files inside the 'var' directory");
            } else {
                if (!installer::unpack_sql()) {
                    oops("Failed to create database tables\n" . mysql_error());
                } else {
                    if (!installer::create_database_config($config)) {
                        oops("Couldn't create var/database.php");
                    } else {
                        system("chmod -R 777 " . VARPATH);
                        list($user, $password) = installer::create_admin($config);
                        print "Your Gallery has been successfully installed!\n";
                        print "We've created an account for you to use:\n";
                        print "  username: {$user}\n";
                        print "  password: {$password}\n";
                        print "\n";
                        exit(0);
                    }
                }
            }
        }
    }
}
Example #3
0
                } else {
                    if (!installer::create_database_config($config)) {
                        oops("Couldn't create var/database.php");
                    } else {
                        system("chmod -R 777 " . VARPATH);
                        try {
                            list($user, $password) = installer::create_admin($config);
                            print "Your Gallery has been successfully installed!\n";
                            print "We've created an account for you to use:\n";
                            print "  username: {$user}\n";
                            print "  password: {$password}\n";
                            print "\n";
                            installer::create_private_key($config);
                            exit(0);
                        } catch (Exception $e) {
                            oops($e->getMessage());
                        }
                    }
                }
            }
        }
    }
}
function oops($message)
{
    print "Oops! Something went wrong during the installation:\n\n";
    print "==> " . $message;
    print "\n";
    print "For help you can try:\n";
    print "  * The Gallery 3 FAQ   - http://codex.gallery2.org/Gallery3:FAQ\n";
    print "  * The Gallery Forums - http://gallery.menalto.com/forum\n";
Example #4
0
        @mysql_query($insert, $db);
        // http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html
        // 1062 for duplicate entry.
        $e = mysql_errno();
        if ($e && $e != 1062) {
            oops("ooops the database has died.");
        } else {
            $msg = $msg . "<p>YES, YOU ARE A STAR!<br>" . "CONGRATULATIONS :)<br><br><br></p>";
            $msg = $msg . "<img src=\"star.png\">";
        }
    }
}
$select = "SELECT repository FROM stars ORDER BY RAND() LIMIT 1";
$records = mysql_query($select, $db);
if (mysql_errno()) {
    oops("oops the database has died...");
} else {
    $row = mysql_fetch_array($records);
    $url = $row['repository'];
    $msg = $msg . "<br><br>Now.. why don't you take a few minutes and visit <br><br>" . "<a href=\"{$url}\">{$url}</a>";
}
@mysql_close($db);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
         <title>
         <?php 
echo $title;
?>