3 define( 'YOURLS_INSTALLING', 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_mod_rewrite() )
\r
13 $error[] = 'Apache module <tt>mod_rewrite</tt> not found. Check this with your server admin.';
\r
15 if ( !yourls_check_database_version() )
\r
16 $error[] = 'MySQL version is too old. Ask your server admin for an upgrade.';
\r
18 if ( !yourls_check_php_version() )
\r
19 $error[] = 'PHP version is too old. Ask your server admin for an upgrade.';
\r
21 // Check additional stuff
\r
22 if ( !yourls_check_curl() )
\r
23 $warning[] = 'PHP extension <tt>cURL</tt> is not installed. This server won\'t be able to use the remote API';
\r
25 if ( !yourls_check_bcmath() )
\r
26 $warning[] = 'PHP extension <tt>BC Math</tt> is not installed. Config setting <tt>YOURLS_URL_CONVERT</tt> forced to <tt>36</tt>';
\r
28 // Is YOURLS already installed ?
\r
29 if ( yourls_is_installed() )
\r
30 $error[] = 'YOURLS already installed.';
\r
32 // Start install if possible and needed
\r
33 if ( isset($_REQUEST['install']) && count( $error ) == 0 ) {
\r
34 // Create/update .htaccess file
\r
35 if ( yourls_create_htaccess() ) {
\r
36 $success[] = 'File <tt>.htaccess</tt> successfully created/updated.';
\r
38 $error[] = '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
41 // Create SQL tables
\r
42 $install = yourls_create_sql_tables();
\r
43 if ( isset( $install['error'] ) )
\r
44 $error = array_merge( $error, $install['error'] );
\r
45 if ( isset( $install['success'] ) )
\r
46 $success = array_merge( $success, $install['success'] );
\r
51 yourls_html_head( 'install' );
\r
54 <form method="post" action="?"><?php // reset any QUERY parameters ?>
\r
56 <img src="<?php echo YOURLS_SITE; ?>/images/yourls-logo.png" alt="YOURLS" title="YOURLS" />
\r
59 // Print errors, warnings and success messages
\r
60 foreach ( array ('error', 'warning', 'success') as $info ) {
\r
61 if ( count( $$info ) > 0 ) {
\r
62 echo "<ul class='$info'>";
\r
63 foreach( $$info as $msg ) {
\r
64 echo '<li>'.$msg."</li>\n";
\r
70 // Display install button or link to admin area if applicable
\r
71 if( !yourls_is_installed() && !isset($_REQUEST['install']) ) {
\r
72 echo '<p> </p><p style="text-align: center;"><input type="submit" name="install" value="Install YOURLS" class="button" /></p>';
\r
74 if( count($error) == 0 )
\r
75 echo '<p> </p><p style="text-align: center;">» <a href="'.YOURLS_SITE.'/admin/" title="YOURS Administration Page">YOURS Administration Page</a></p>';
\r
80 <?php yourls_html_footer(); ?>
\r