diff --git a/.gitignore b/.gitignore index 720e497f68d1..d8004933a739 100755 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ composer.phar composer.lock .DS_Store Thumbs.db +app.yaml +database.sql \ No newline at end of file diff --git a/README.md b/README.md index b112372212e3..c1a903fa99cf 100755 --- a/README.md +++ b/README.md @@ -1,19 +1,18 @@ # Invoice Ninja ## Simple, Intuitive Invoicing -### Live demo: [http://sketch-out.com/ninja/public/](http://sketch-out.com/ninja/public/) +### Live demo: [http://invoice-ninja.appspot.com](http://invoice-ninja.appspot.com/) ### Introduction Most online invoicing sites are expensive. They shouldn't be. The aim of this project is to provide a free, open-source alternative. Additionally, the hope is this codebase will serve as a sample site for Laravel as well as other JavaScript technologies. ### Features -* Core application built using Laravel 4 +* Core application built using Laravel 4.1 * Invoice PDF generation directly in the browser * Integrates with many payment providers +* Recurring invoices ### Remaining Work -* Recurring invoices -* Internationalization * Home dashboard * Reports diff --git a/app/config/app.php b/app/config/app.php index 962dd37a46f2..2998ab85cccd 100755 --- a/app/config/app.php +++ b/app/config/app.php @@ -113,6 +113,7 @@ return array( 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Illuminate\Workbench\WorkbenchServiceProvider', + 'Illuminate\Remote\RemoteServiceProvider', 'Basset\BassetServiceProvider', 'Bootstrapper\BootstrapperServiceProvider', 'Zizaco\Confide\ConfideServiceProvider', @@ -134,7 +135,7 @@ return array( | */ - 'manifest' => storage_path().'/meta', + 'manifest' => storage_path() . '/meta', /* |-------------------------------------------------------------------------- @@ -156,7 +157,7 @@ return array( 'Cache' => 'Illuminate\Support\Facades\Cache', 'ClassLoader' => 'Illuminate\Support\ClassLoader', 'Config' => 'Illuminate\Support\Facades\Config', - 'Controller' => 'Illuminate\Routing\Controllers\Controller', + 'Controller' => 'Illuminate\Routing\Controller', 'Cookie' => 'Illuminate\Support\Facades\Cookie', 'Crypt' => 'Illuminate\Support\Facades\Crypt', 'DB' => 'Illuminate\Support\Facades\DB', @@ -185,6 +186,7 @@ return array( 'URL' => 'Illuminate\Support\Facades\URL', 'Validator' => 'Illuminate\Support\Facades\Validator', 'View' => 'Illuminate\Support\Facades\View', + 'SSH' => 'Illuminate\Support\Facades\SSH', 'Basset' => 'Basset\Facade', 'Alert' => 'Bootstrapper\Alert', 'Badge' => 'Bootstrapper\Badge', diff --git a/app/config/database.php b/app/config/database.php index da0f8104185b..927adb590042 100755 --- a/app/config/database.php +++ b/app/config/database.php @@ -62,7 +62,7 @@ return array( 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), - + 'pgsql' => array( 'driver' => 'pgsql', 'host' => 'localhost', @@ -111,7 +111,7 @@ return array( 'redis' => array( - 'cluster' => true, + 'cluster' => false, 'default' => array( 'host' => '127.0.0.1', diff --git a/app/config/gae-development/database.php b/app/config/gae-development/database.php new file mode 100644 index 000000000000..d64dbb1eed23 --- /dev/null +++ b/app/config/gae-development/database.php @@ -0,0 +1,18 @@ + array( + + 'mysql' => array( + 'driver' => 'mysql', + 'host' => getenv('DEVELOPMENT_DB_HOST'), + 'database' => getenv('DEVELOPMENT_DB_NAME'), + 'username' => getenv('DEVELOPMENT_DB_USERNAME'), + 'password' => getenv('DEVELOPMENT_DB_PASSWORD'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + ), + ), +); diff --git a/app/config/gae-production/app.php b/app/config/gae-production/app.php new file mode 100755 index 000000000000..bb7ab27c4c0b --- /dev/null +++ b/app/config/gae-production/app.php @@ -0,0 +1,9 @@ + true, + + 'manifest' => 'gs://invoice-ninja/meta', + +); \ No newline at end of file diff --git a/app/config/gae-production/cache.php b/app/config/gae-production/cache.php new file mode 100644 index 000000000000..9476804df76c --- /dev/null +++ b/app/config/gae-production/cache.php @@ -0,0 +1,7 @@ + 'memcached', + +); \ No newline at end of file diff --git a/app/config/gae-production/database.php b/app/config/gae-production/database.php new file mode 100644 index 000000000000..ef8d2d58cc30 --- /dev/null +++ b/app/config/gae-production/database.php @@ -0,0 +1,19 @@ + array( + + 'mysql' => array( + 'driver' => 'mysql', + 'unix_socket' => getenv('PRODUCTION_CLOUD_SQL_INSTANCE'), + 'host' => '', + 'database' => getenv('PRODUCTION_DB_NAME'), + 'username' => getenv('PRODUCTION_DB_USERNAME'), + 'password' => getenv('PRODUCTION_DB_PASSWORD'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + ), + ), +); diff --git a/app/config/gae-production/session.php b/app/config/gae-production/session.php new file mode 100644 index 000000000000..9476804df76c --- /dev/null +++ b/app/config/gae-production/session.php @@ -0,0 +1,7 @@ + 'memcached', + +); \ No newline at end of file diff --git a/app/config/queue.php b/app/config/queue.php index 220998cbaccc..da1512ca7d5e 100755 --- a/app/config/queue.php +++ b/app/config/queue.php @@ -57,4 +57,22 @@ return array( ), + + /* + |-------------------------------------------------------------------------- + | Failed Queue Jobs + |-------------------------------------------------------------------------- + | + | These options configure the behavior of failed queue job logging so you + | can control which database and table are used to store the jobs that + | have failed. You may change them to any database / table you wish. + | + */ + + 'failed' => array( + + 'database' => 'mysql', 'table' => 'failed_jobs', + + ), + ); diff --git a/app/config/remote.php b/app/config/remote.php new file mode 100755 index 000000000000..ea960e03a5c0 --- /dev/null +++ b/app/config/remote.php @@ -0,0 +1,59 @@ + 'production', + + /* + |-------------------------------------------------------------------------- + | Remote Server Connections + |-------------------------------------------------------------------------- + | + | These are the servers that will be accessible via the SSH task runner + | facilities of Laravel. This feature radically simplifies executing + | tasks on your servers, such as deploying out these applications. + | + */ + + 'connections' => array( + + 'production' => array( + 'host' => '', + 'username' => '', + 'password' => '', + 'key' => '', + 'keyphrase' => '', + 'root' => '/var/www', + ), + + ), + + /* + |-------------------------------------------------------------------------- + | Remote Server Groups + |-------------------------------------------------------------------------- + | + | Here you may list connections under a single group name, which allows + | you to easily access all of the servers at once using a short name + | that is extremely easy to remember, such as "web" or "database". + | + */ + + 'groups' => array( + + 'web' => array('production') + + ), + +); \ No newline at end of file diff --git a/app/config/session.php b/app/config/session.php index 549d3ff36762..64b3795f3d66 100755 --- a/app/config/session.php +++ b/app/config/session.php @@ -31,6 +31,8 @@ return array( 'lifetime' => 120, + 'expire_on_close' => false, + /* |-------------------------------------------------------------------------- | Session File Location @@ -122,4 +124,18 @@ return array( 'domain' => null, + + /* + |-------------------------------------------------------------------------- + | HTTPS Only Cookies + |-------------------------------------------------------------------------- + | + | By setting this option to true, session cookies will only be sent back + | to the server if the browser has a HTTPS connection. This will keep + | the cookie from being sent to you if it can not be done securely. + | + */ + + 'secure' => false, + ); diff --git a/app/config/view.php b/app/config/view.php index eba10a4cf6c6..08e56af1d6d6 100755 --- a/app/config/view.php +++ b/app/config/view.php @@ -26,6 +26,6 @@ return array( | */ - 'pagination' => 'pagination::slider', + 'pagination' => 'pagination::bootstrap3', ); diff --git a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php index 1753654cf81d..c90c97614342 100755 --- a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php +++ b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php @@ -498,7 +498,7 @@ class ConfideSetupUsersTable extends Migration { $t->decimal('adjustment', 13, 4); $t->decimal('balance', 13, 4); - $t->foreign('account_id')->references('id')->on('accounts'); + $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade'); $t->foreign('currency_id')->references('id')->on('currencies'); }); diff --git a/app/lang/en/reminders.php b/app/lang/en/reminders.php index 4a9f17661449..ad2262124d4d 100755 --- a/app/lang/en/reminders.php +++ b/app/lang/en/reminders.php @@ -13,10 +13,12 @@ return array( | */ - "password" => "Passwords must be six characters and match the confirmation.", + "password" => "Passwords must be at least six characters and match the confirmation.", - "user" => "We can't find a user with that e-mail address.", + "user" => "We can't find a user with that e-mail address.", - "token" => "This password reset token is invalid.", + "token" => "This password reset token is invalid.", + + "sent" => "Password reminder sent!", ); \ No newline at end of file diff --git a/app/routes.php b/app/routes.php index df240df35178..a36de9e5b8cb 100755 --- a/app/routes.php +++ b/app/routes.php @@ -16,11 +16,9 @@ //dd(new DateTime()); //Event::fire('user.signup'); //dd(App::environment()); +//dd(gethostname()); -include_once(app_path().'/libraries/utils.php'); // TODO_FIX -include_once(app_path().'/handlers/UserEventHandler.php'); // TODO_FIX - // TODO_FIX replace with cron Route::get('/send_emails', function() { Artisan::call('ninja:send-invoices'); diff --git a/app/start/global.php b/app/start/global.php index 75807ed7a5a7..cac776dc2736 100755 --- a/app/start/global.php +++ b/app/start/global.php @@ -33,9 +33,12 @@ ClassLoader::addDirectories(array( | */ -$logFile = 'log-'.php_sapi_name().'.txt'; +//$logFile = 'log-'.php_sapi_name().'.txt'; +//Log::useDailyFiles(storage_path().'/logs/'.$logFile); -Log::useDailyFiles(storage_path().'/logs/'.$logFile); +use Monolog\Logger; +$monolog = Log::getMonolog(); +$monolog->pushHandler(new Monolog\Handler\SyslogHandler('intranet', 'user', Logger::DEBUG, false, LOG_PID)); /* |-------------------------------------------------------------------------- diff --git a/artisan b/artisan index 1c169f6dd629..36bb2d983d22 100755 --- a/artisan +++ b/artisan @@ -29,8 +29,6 @@ require __DIR__.'/bootstrap/autoload.php'; $app = require_once __DIR__.'/bootstrap/start.php'; -$app->boot(); - /* |-------------------------------------------------------------------------- | Load The Artisan Console Application @@ -43,6 +41,8 @@ $app->boot(); | */ +$app->setRequestForConsoleEnvironment(); + $artisan = Illuminate\Console\Application::start($app); /* diff --git a/bootstrap/paths.php b/bootstrap/paths.php index 5a1f640ba446..60da59aea24e 100755 --- a/bootstrap/paths.php +++ b/bootstrap/paths.php @@ -52,6 +52,6 @@ return array( | */ - 'storage' => __DIR__.'/../app/storage', + 'storage' => (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false) ? "gs://invoice-ninja/storage" : __DIR__.'/../app/storage', ); diff --git a/bootstrap/start.php b/bootstrap/start.php index ab1be6cea3c4..11b1b42f8ee0 100755 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -1,5 +1,39 @@ instance('path.storage','gs://invoice-ninja'); +$app->instance('path.manifest', 'gs://invoice-ninja/meta'); + +if(strlen(ini_get('google_app_engine.allow_include_gs_buckets'))) { + $primary_bucket_name = explode(', ', ini_get('google_app_engine.allow_include_gs_buckets'))[0]; + dd($primary_bucket_name); + $app->instance('path.storage','gs://'.$primary_bucket_name); + $app->instance('path.manifest', storage_path().'/meta'); +} +*/ + + + +if (!function_exists('gethostname')) { + function gethostname() { + return php_uname('n'); + } +} + + /* |-------------------------------------------------------------------------- | Create The Application @@ -13,7 +47,7 @@ $app = new Illuminate\Foundation\Application; -$app->redirectIfTrailingSlash(); +//$app->redirectIfTrailingSlash(); /* |-------------------------------------------------------------------------- @@ -28,8 +62,9 @@ $app->redirectIfTrailingSlash(); $env = $app->detectEnvironment(array( - 'development' => array('precise64', 'ubuntu-server-12042-x64-vbox4210'), - 'staging' => array('host107.hostmonster.com') + 'development' => ['precise64', 'ubuntu-server-12042-x64-vbox4210'], + 'gae-development' => ['HILLEL-PC','hillel-PC'], + 'gae-production' => ['GNU/Linux'] )); /* diff --git a/composer.json b/composer.json index 5e4af2b83dd8..7d35581f1ad8 100755 --- a/composer.json +++ b/composer.json @@ -4,10 +4,10 @@ "keywords": ["framework", "laravel"], "license": "MIT", "require": { - "laravel/framework": "4.0.*", + "laravel/framework": "4.1.*", "jasonlewis/basset": "dev-master", "patricktalmadge/bootstrapper": "dev-develop", - "zizaco/confide": "2.0.x", + "zizaco/confide": "3.1.x", "anahkiasen/former": "dev-master", "barryvdh/laravel-debugbar": "dev-master", "chumper/datatable": "dev-master", diff --git a/php.ini b/php.ini new file mode 100755 index 000000000000..7e1da275afe4 --- /dev/null +++ b/php.ini @@ -0,0 +1,4 @@ +; enable function that are disabled by default in the App Engine PHP runtime +google_app_engine.enable_functions = "php_sapi_name, php_uname, getmypid" +google_app_engine.allow_include_gs_buckets = "invoice-ninja" +allow_url_include=1 \ No newline at end of file diff --git a/public/index.php b/public/index.php index 295c10ec7b63..ebf1d17b8363 100755 --- a/public/index.php +++ b/public/index.php @@ -42,21 +42,8 @@ $app = require_once __DIR__.'/../bootstrap/start.php'; | Once we have the application, we can simply call the run method, | which will execute the request and send the response back to | the client's browser allowing them to enjoy the creative -| and wonderful applications we have created for them. +| and wonderful application we have whipped up for them. | */ -$app->run(); - -/* -|-------------------------------------------------------------------------- -| Shutdown The Application -|-------------------------------------------------------------------------- -| -| Once the app has finished running, we will fire off the shutdown events -| so that any final work may be done by the application before we shut -| down the process. This is the last thing to happen to the request. -| -*/ - -$app->shutdown(); \ No newline at end of file +$app->run(); \ No newline at end of file