3 require_once( dirname(dirname(__FILE__)).'/includes/config.php' );
\r
4 require_once( dirname(dirname(__FILE__)).'/includes/functions-install.php' );
\r
10 // Check pre-requisites
\r
11 if ( !yourls_check_mod_rewrite() )
\r
12 $error[] = 'Apache module <tt>mod_rewrite</tt> not found. Check this with your server admin.';
\r
14 if ( !yourls_check_database_version() )
\r
15 $error[] = 'MySQL version is too old. Ask your server admin for an upgrade.';
\r
17 if ( !yourls_check_php_version() )
\r
18 $error[] = 'PHP version is too old. Ask your server admin for an upgrade.';
\r
20 // Check additional stuff
\r
21 if ( !yourls_check_curl() )
\r
22 $warning[] = 'PHP extension <tt>cURL</tt> is not installed. This server won\'t be able to use the remote API';
\r
24 if ( !yourls_check_bcmath() )
\r
25 $warning[] = 'PHP extension <tt>BC Math</tt> is not installed. Config setting <tt>YOURLS_URL_CONVERT</tt> forced to <tt>36</tt>';
\r
27 // Is YOURLS already installed ?
\r
28 if ( yourls_is_installed() )
\r
29 $error[] = 'YOURLS already installed.';
\r
31 // Start install if possible and needed
\r
32 if ( isset($_REQUEST['install']) && count( $error ) == 0 ) {
\r
33 // Create/update .htaccess file
\r
34 if ( yourls_create_htaccess() ) {
\r
35 $success[] = 'File <tt>.htaccess</tt> successfully created/updated.';
\r
37 $error[] = 'Could not write file <tt>.htaccess</tt> in YOURLS root directory. You will have to do it manually.';
\r
40 // Create SQL tables
\r
41 $install = yourls_create_sql_tables();
\r
42 if ( isset( $install['error'] ) )
\r
43 $error = array_merge( $error, $install['error'] );
\r
44 if ( isset( $install['success'] ) )
\r
45 $success = array_merge( $success, $install['success'] );
\r
50 yourls_html_head( 'install' );
\r
53 <form method="post" action="?"><?php // reset any QUERY parameters ?>
\r
55 <img src="<?php echo YOURLS_SITE; ?>/images/yourls-logo.png" alt="YOURLS" title="YOURLS" />
\r
58 // Print errors, warnings and success messages
\r
59 foreach ( array ('error', 'warning', 'success') as $info ) {
\r
60 if ( count( $$info ) > 0 ) {
\r
61 echo "<ul class='$info'>";
\r
62 foreach( $$info as $msg ) {
\r
63 echo '<li>'.$msg."</li>\n";
\r
69 // Display install button or link to admin area if applicable
\r
70 if( !yourls_is_installed() && !isset($_REQUEST['install']) ) {
\r
71 echo '<p> </p><p style="text-align: center;"><input type="submit" name="install" value="Install YOURLS" class="button" /></p>';
\r
73 if( count($error) == 0 )
\r
74 echo '<p> </p><p style="text-align: center;">» <a href="'.YOURLS_SITE.'/admin/" title="YOURS Administration Page">YOURS Administration Page</a></p>';
\r
79 <?php yourls_html_footer(); ?>
\r