2015-03-16 22:45:25 +01:00
<! DOCTYPE html >
< html lang = " en " >
< head >
< title > Invoice Ninja | Setup </ title >
< meta charset = " utf-8 " >
< meta name = " csrf-token " content = " <?= csrf_token() ?> " >
2015-04-10 09:18:07 +02:00
< script src = " { { asset('js/built.js') }}?no_cache= { { NINJA_VERSION }} " type = " text/javascript " ></ script >
< link href = " { { asset('css/built.public.css') }}?no_cache= { { NINJA_VERSION }} " rel = " stylesheet " type = " text/css " />
2015-06-20 19:40:50 +02:00
< link href = " { { asset('css/built.css') }}?no_cache= { { NINJA_VERSION }} " rel = " stylesheet " type = " text/css " />
2015-05-08 10:21:29 +02:00
< style type = " text/css " >
body {
2015-06-20 19:40:50 +02:00
background - color : #FEFEFE;
2015-05-08 10:21:29 +02:00
}
</ style >
2015-03-16 22:45:25 +01:00
</ head >
< body >
< div class = " container " >
& nbsp ;
< div class = " row " >
< div class = " col-md-8 col-md-offset-2 " >
< div class = " jumbotron " >
< h2 > Invoice Ninja Setup </ h2 >
@ if ( version_compare ( phpversion (), '5.4.0' , '<' ))
< div class = " alert alert-warning " > Warning : The application requires PHP >= 5.4 . 0 </ div >
@ endif
@ if ( ! extension_loaded ( 'fileinfo' ))
< div class = " alert alert-warning " > Warning : The < a href = " http://php.net/manual/en/book.fileinfo.php " target = " _blank " > fileinfo </ a > extension needs to be installed and enabled .</ div >
@ endif
2015-05-08 10:21:29 +02:00
@ if ( !@ fopen ( base_path () . " /.env " , 'a' ))
2015-03-25 20:56:31 +01:00
< div class = " alert alert-warning " > Warning : Permission denied to write config file
< pre > sudo chown yourname : www - data / path / to / ninja </ pre >
</ div >
@ endif
2015-07-07 22:08:16 +02:00
If you need help you can either post to our < a href = " https://www.invoiceninja.com/forums/forum/support/ " target = " _blank " > support forum </ a >
2015-03-16 22:45:25 +01:00
or email us at < a href = " mailto:contact@invoiceninja.com " target = " _blank " > contact @ invoiceninja . com </ a >.
< p >
< pre >-- Commands to create a MySQL database and user
CREATE SCHEMA `ninja` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
CREATE USER 'ninja' @ 'localhost' IDENTIFIED BY 'ninja' ;
GRANT ALL PRIVILEGES ON `ninja` .* TO 'ninja' @ 'localhost' ;
FLUSH PRIVILEGES ; </ pre >
</ p >
</ div >
2015-03-17 02:30:56 +01:00
{ !! Former :: open () -> rules ([
2015-03-16 22:45:25 +01:00
'app[url]' => 'required' ,
'database[type][host]' => 'required' ,
'database[type][database]' => 'required' ,
'database[type][username]' => 'required' ,
'database[type][password]' => 'required' ,
'first_name' => 'required' ,
'last_name' => 'required' ,
'email' => 'required|email' ,
'password' => 'required' ,
'terms_checkbox' => 'required'
2015-03-17 02:30:56 +01:00
]) !! }
2015-03-16 22:45:25 +01:00
< div class = " panel panel-default " >
< div class = " panel-heading " >
< h3 class = " panel-title " > Application Settings </ h3 >
</ div >
< div class = " panel-body " >
2015-06-20 19:40:50 +02:00
{ !! Former :: text ( 'app[url]' ) -> label ( 'URL' ) -> value ( isset ( $_ENV [ 'APP_URL' ]) ? $_ENV [ 'APP_URL' ] : Request :: root ()) !! }
2015-03-16 22:45:25 +01:00
</ div >
</ div >
< div class = " panel panel-default " >
< div class = " panel-heading " >
< h3 class = " panel-title " > Database Connection </ h3 >
</ div >
< div class = " panel-body " >
2015-06-20 19:40:50 +02:00
{ !! Former :: select ( 'database[default]' ) -> label ( 'Driver' ) -> options ([ 'mysql' => 'MySQL' , 'pgsql' => 'PostgreSQL' , 'sqlite' => 'SQLite' ])
-> value ( isset ( $_ENV [ 'DB_TYPE' ]) ? $_ENV [ 'DB_TYPE' ] : 'mysql' ) !! }
{ !! Former :: text ( 'database[type][host]' ) -> label ( 'Host' ) -> value ( 'localhost' )
-> value ( isset ( $_ENV [ 'DB_HOST' ]) ? $_ENV [ 'DB_HOST' ] : '' ) !! }
{ !! Former :: text ( 'database[type][database]' ) -> label ( 'Database' ) -> value ( 'ninja' )
-> value ( isset ( $_ENV [ 'DB_DATABASE' ]) ? $_ENV [ 'DB_DATABASE' ] : '' ) !! }
{ !! Former :: text ( 'database[type][username]' ) -> label ( 'Username' ) -> value ( 'ninja' )
-> value ( isset ( $_ENV [ 'DB_USERNAME' ]) ? $_ENV [ 'DB_USERNAME' ] : '' ) !! }
{ !! Former :: password ( 'database[type][password]' ) -> label ( 'Password' ) -> value ( 'ninja' )
-> value ( isset ( $_ENV [ 'DB_PASSWORD' ]) ? $_ENV [ 'DB_PASSWORD' ] : '' ) !! }
{ !! Former :: actions ( Button :: primary ( 'Test connection' ) -> small () -> withAttributes ([ 'onclick' => 'testDatabase()' ]), ' <span id="dbTestResult"/>' ) !! }
2015-03-16 22:45:25 +01:00
</ div >
</ div >
< div class = " panel panel-default " >
< div class = " panel-heading " >
< h3 class = " panel-title " > Email Settings </ h3 >
</ div >
< div class = " panel-body " >
2015-07-07 22:08:16 +02:00
{ !! Former :: select ( 'mail[driver]' ) -> label ( 'Driver' ) -> options ([ 'smtp' => 'SMTP' , 'mail' => 'Mail' , 'sendmail' => 'Sendmail' ])
-> value ( isset ( $_ENV [ 'MAIL_DRIVER' ]) ? $_ENV [ 'MAIL_DRIVER' ] : 'smtp' ) !! }
{ !! Former :: text ( 'mail[host]' ) -> label ( 'Host' )
-> value ( isset ( $_ENV [ 'MAIL_HOST' ]) ? $_ENV [ 'MAIL_HOST' ] : '' ) !! }
{ !! Former :: text ( 'mail[port]' ) -> label ( 'Port' )
-> value ( isset ( $_ENV [ 'MAIL_PORT' ]) ? $_ENV [ 'MAIL_PORT' ] : '587' ) !! }
{ !! Former :: select ( 'mail[encryption]' ) -> label ( 'Encryption' ) -> options ([ 'tls' => 'TLS' , 'ssl' => 'SSL' ])
-> value ( isset ( $_ENV [ 'MAIL_ENCRYPTION' ]) ? $_ENV [ 'MAIL_ENCRYPTION' ] : 'tls' ) !! }
{ !! Former :: text ( 'mail[from][name]' ) -> label ( 'From Name' )
-> value ( isset ( $_ENV [ 'MAIL_FROM_NAME' ]) ? $_ENV [ 'MAIL_FROM_NAME' ] : '' ) !! }
{ !! Former :: text ( 'mail[username]' ) -> label ( 'Email' )
-> value ( isset ( $_ENV [ 'MAIL_USERNAME' ]) ? $_ENV [ 'MAIL_USERNAME' ] : '' ) !! }
{ !! Former :: password ( 'mail[password]' ) -> label ( 'Password' )
-> value ( isset ( $_ENV [ 'MAIL_PASSWORD' ]) ? $_ENV [ 'MAIL_PASSWORD' ] : '' ) !! }
2015-06-20 19:40:50 +02:00
{ !! Former :: actions ( Button :: primary ( 'Send test email' ) -> small () -> withAttributes ([ 'onclick' => 'testMail()' ]), ' <span id="mailTestResult"/>' ) !! }
2015-03-16 22:45:25 +01:00
</ div >
</ div >
< div class = " panel panel-default " >
< div class = " panel-heading " >
< h3 class = " panel-title " > User Details </ h3 >
</ div >
< div class = " panel-body " >
2015-03-17 02:30:56 +01:00
{ !! Former :: text ( 'first_name' ) !! }
{ !! Former :: text ( 'last_name' ) !! }
{ !! Former :: text ( 'email' ) !! }
{ !! Former :: password ( 'password' ) !! }
2015-03-16 22:45:25 +01:00
</ div >
</ div >
2015-07-07 22:08:16 +02:00
2015-03-17 02:30:56 +01:00
{ !! Former :: checkbox ( 'terms_checkbox' ) -> label ( ' ' ) -> text ( trans ( 'texts.agree_to_terms' , [ 'terms' => '<a href="' . NINJA_APP_URL . '/terms" target="_blank">' . trans ( 'texts.terms_of_service' ) . '</a>' ])) !! }
2015-06-20 19:40:50 +02:00
{ !! Former :: actions ( Button :: primary ( 'Submit' ) -> large () -> submit () ) !! }
2015-03-17 02:30:56 +01:00
{ !! Former :: close () !! }
2015-03-16 22:45:25 +01:00
</ div >
< script type = " text/javascript " >
2015-03-17 04:47:32 +01:00
/*
* TODO :
2015-03-26 01:04:55 +01:00
* - Add JS Validation to DB and Mail
2015-03-17 04:47:32 +01:00
* - Add Function to clear valid vars fields if they change a setting
* - Add Nicer Error Message
*
*/
var db_valid = false
var mail_valid = false
2015-03-16 22:45:25 +01:00
function testDatabase ()
{
var data = $ ( " form " ) . serialize () + " &test=db " ;
2015-03-17 04:47:32 +01:00
// Show Progress Text
$ ( '#dbTestResult' ) . html ( 'Working...' ) . css ( 'color' , 'black' );
// Send / Test Information
2015-03-16 22:45:25 +01:00
$ . post ( " /setup " , data , function ( data ) {
2015-03-17 04:47:32 +01:00
var color = 'red' ;
if ( data == 'Success' ){
color = 'green' ;
db_valid = true ;
}
$ ( '#dbTestResult' ) . html ( data ) . css ( 'color' , color );
2015-03-16 22:45:25 +01:00
});
2015-03-17 04:47:32 +01:00
return db_valid ;
2015-03-16 22:45:25 +01:00
}
function testMail ()
{
var data = $ ( " form " ) . serialize () + " &test=mail " ;
2015-03-17 04:47:32 +01:00
// Show Progress Text
$ ( '#mailTestResult' ) . html ( 'Working...' ) . css ( 'color' , 'black' );
// Send / Test Information
2015-03-16 22:45:25 +01:00
$ . post ( " /setup " , data , function ( data ) {
2015-03-17 04:47:32 +01:00
var color = 'red' ;
if ( data == 'Sent' ){
color = 'green' ;
mail_valid = true ;
}
$ ( '#mailTestResult' ) . html ( data ) . css ( 'color' , color );
});
return mail_valid ;
}
2015-03-17 05:51:45 +01:00
// Validate Settings
2015-03-26 01:04:55 +01:00
/* $ ( 'form button[type="submit"]' ) . click ( function ( e )
2015-03-17 04:47:32 +01:00
{
2015-03-17 05:51:45 +01:00
// Check DB Settings
2015-03-17 06:35:41 +01:00
if ( ! db_valid && ! testDatabase () ) {
2015-03-17 05:51:45 +01:00
alert ( 'Please check your Database Settings.' );
return false ;
2015-03-17 04:47:32 +01:00
}
2015-03-17 05:51:45 +01:00
// If Mail Settings are incorrect, prompt for continue
2015-03-17 06:35:41 +01:00
if ( ! mail_valid && ! testMail () ) {
2015-03-17 05:51:45 +01:00
var check = confirm ( " The mail settings are incomplete. \n Are you sure you want to continue? " );
if ( ! check ) {
return false ;
}
}
return true ;
2015-03-26 01:04:55 +01:00
}); */
2015-03-16 22:45:25 +01:00
2015-03-17 04:47:32 +01:00
// Prevent the Enter Button from working
2015-03-16 22:45:25 +01:00
$ ( " form " ) . bind ( " keypress " , function ( e ) {
if ( e . keyCode == 13 ) {
return false ;
}
});
</ script >
</ body >
</ html >