2 define( 'YOURLS_INSTALLING', true );
\r
3 define( 'YOURLS_ADMIN', true );
\r
4 require_once( dirname(dirname(__FILE__)).'/includes/load-yourls.php' );
\r
5 require_once( dirname(dirname(__FILE__)).'/includes/functions-install.php' );
\r
11 // Check pre-requisites
\r
12 if ( !yourls_check_database_version() )
\r
13 $error[] = 'MySQL version is too old. Ask your server admin for an upgrade.';
\r
15 if ( !yourls_check_php_version() )
\r
16 $error[] = 'PHP version is too old. Ask your server admin for an upgrade.';
\r
18 // Check additional stuff
\r
19 if ( !yourls_check_curl() )
\r
20 $warning[] = 'PHP extension <tt>cURL</tt> is not installed. This server won\'t be able to use the remote API';
\r
22 // Is YOURLS already installed ?
\r
23 if ( yourls_is_installed() )
\r
24 $error[] = 'YOURLS already installed.';
\r
26 // Start install if possible and needed
\r
27 if ( isset($_REQUEST['install']) && count( $error ) == 0 ) {
\r
28 // Create/update .htaccess file
\r
29 if ( yourls_create_htaccess() ) {
\r
30 $success[] = 'File <tt>.htaccess</tt> successfully created/updated.';
\r
32 $warning[] = 'Could not write file <tt>.htaccess</tt> in YOURLS root directory. You will have to do it manually. See <a href="http://yourls.org/htaccess">how</a>.';
\r
35 // Create SQL tables
\r
36 $install = yourls_create_sql_tables();
\r
37 if ( isset( $install['error'] ) )
\r
38 $error = array_merge( $error, $install['error'] );
\r
39 if ( isset( $install['success'] ) )
\r
40 $success = array_merge( $success, $install['success'] );
\r
45 yourls_html_head( 'install' );
\r
48 <form method="post" action="?"><?php // reset any QUERY parameters ?>
\r
50 <img src="<?php echo YOURLS_SITE; ?>/images/yourls-logo.png" alt="YOURLS" title="YOURLS" />
\r
53 // Print errors, warnings and success messages
\r
54 foreach ( array ('error', 'warning', 'success') as $info ) {
\r
55 if ( count( $$info ) > 0 ) {
\r
56 echo "<ul class='$info'>";
\r
57 foreach( $$info as $msg ) {
\r
58 echo '<li>'.$msg."</li>\n";
\r
64 // Display install button or link to admin area if applicable
\r
65 if( !yourls_is_installed() && !isset($_REQUEST['install']) ) {
\r
66 echo '<p> </p><p style="text-align: center;"><input type="submit" name="install" value="Install YOURLS" class="button" /></p>';
\r
68 if( count($error) == 0 )
\r
69 echo '<p> </p><p style="text-align: center;">» <a href="'.yourls_admin_url().'" title="YOURS Administration Page">YOURS Administration Page</a></p>';
\r
74 <?php yourls_html_footer(); ?>
\r