1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Http/routes.php

660 lines
28 KiB
PHP
Raw Normal View History

2015-03-12 01:44:39 +01:00
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
2015-03-12 01:44:39 +01:00
|
*/
2015-12-23 12:49:49 +01:00
//Crypt::decrypt();
//apc_clear_cache();
//dd(DB::getQueryLog());
//dd(Client::getPrivateId(1));
//dd(new DateTime());
//dd(App::environment());
//dd(gethostname());
//Log::error('test');
2015-03-12 01:44:39 +01:00
// Application setup
2015-10-18 09:30:28 +02:00
Route::get('/setup', 'AppController@showSetup');
Route::post('/setup', 'AppController@doSetup');
Route::get('/install', 'AppController@install');
Route::get('/update', 'AppController@update');
2015-03-12 01:44:39 +01:00
// Public pages
Route::get('/', 'HomeController@showIndex');
2015-10-18 09:30:28 +02:00
Route::get('/terms', 'HomeController@showTerms');
Route::get('/log_error', 'HomeController@logError');
Route::get('/invoice_now', 'HomeController@invoiceNow');
Route::get('/keep_alive', 'HomeController@keepAlive');
Route::post('/get_started', 'AccountController@getStarted');
// Client visible pages
2016-01-18 14:54:15 +01:00
Route::get('view/{invitation_key}', 'PublicClientController@view');
Route::get('view', 'HomeController@viewLogo');
Route::get('approve/{invitation_key}', 'QuoteController@approve');
2015-04-15 18:35:41 +02:00
Route::get('payment/{invitation_key}/{payment_type?}', 'PaymentController@show_payment');
Route::post('payment/{invitation_key}', 'PaymentController@do_payment');
Route::get('complete', 'PaymentController@offsite_payment');
2015-10-13 17:44:01 +02:00
Route::get('client/quotes', 'PublicClientController@quoteIndex');
Route::get('client/invoices', 'PublicClientController@invoiceIndex');
Route::get('client/payments', 'PublicClientController@paymentIndex');
Route::get('client/dashboard', 'PublicClientController@dashboard');
Route::get('api/client.quotes', array('as'=>'api.client.quotes', 'uses'=>'PublicClientController@quoteDatatable'));
Route::get('api/client.invoices', array('as'=>'api.client.invoices', 'uses'=>'PublicClientController@invoiceDatatable'));
Route::get('api/client.payments', array('as'=>'api.client.payments', 'uses'=>'PublicClientController@paymentDatatable'));
Route::get('api/client.activity', array('as'=>'api.client.activity', 'uses'=>'PublicClientController@activityDatatable'));
Route::get('license', 'PaymentController@show_license_payment');
Route::post('license', 'PaymentController@do_license_payment');
Route::get('claim_license', 'PaymentController@claim_license');
Route::post('signup/validate', 'AccountController@checkEmail');
Route::post('signup/submit', 'AccountController@submitSignup');
2015-10-18 09:30:28 +02:00
Route::get('/auth/{provider}', 'Auth\AuthController@authLogin');
Route::get('/auth_unlink', 'Auth\AuthController@authUnlink');
2015-10-11 16:41:09 +02:00
2015-10-18 09:30:28 +02:00
Route::post('/hook/email_bounced', 'AppController@emailBounced');
Route::post('/hook/email_opened', 'AppController@emailOpened');
2015-10-08 11:49:26 +02:00
2015-03-29 14:37:42 +02:00
// Laravel auth routes
get('/signup', array('as' => 'signup', 'uses' => 'Auth\AuthController@getRegister'));
post('/signup', array('as' => 'signup', 'uses' => 'Auth\AuthController@postRegister'));
2015-04-28 22:13:52 +02:00
get('/login', array('as' => 'login', 'uses' => 'Auth\AuthController@getLoginWrapper'));
2015-03-31 19:42:37 +02:00
post('/login', array('as' => 'login', 'uses' => 'Auth\AuthController@postLoginWrapper'));
2015-06-16 21:35:35 +02:00
get('/logout', array('as' => 'logout', 'uses' => 'Auth\AuthController@getLogoutWrapper'));
2015-03-30 17:20:53 +02:00
get('/forgot', array('as' => 'forgot', 'uses' => 'Auth\PasswordController@getEmail'));
post('/forgot', array('as' => 'forgot', 'uses' => 'Auth\PasswordController@postEmail'));
2015-05-09 20:25:16 +02:00
get('/password/reset/{token}', array('as' => 'forgot', 'uses' => 'Auth\PasswordController@getReset'));
2015-03-30 17:20:53 +02:00
post('/password/reset', array('as' => 'forgot', 'uses' => 'Auth\PasswordController@postReset'));
2015-04-13 14:49:40 +02:00
get('/user/confirm/{code}', 'UserController@confirm');
2015-03-29 14:37:42 +02:00
2015-05-08 10:21:29 +02:00
if (Utils::isNinja()) {
Route::post('/signup/register', 'AccountController@doRegister');
Route::get('/news_feed/{user_type}/{version}/', 'HomeController@newsFeed');
Route::get('/demo', 'AccountController@demo');
}
2015-04-02 15:06:16 +02:00
Route::group(['middleware' => 'auth'], function() {
Route::get('dashboard', 'DashboardController@index');
Route::get('view_archive/{entity_type}/{visible}', 'AccountController@setTrashVisible');
Route::get('hide_message', 'HomeController@hideMessage');
Route::get('force_inline_pdf', 'UserController@forcePDFJS');
2016-01-18 10:13:39 +01:00
Route::get('api/users', array('as'=>'api.users', 'uses'=>'UserController@getDatatable'));
Route::resource('users', 'UserController');
2015-11-05 23:37:04 +01:00
Route::post('users/bulk', 'UserController@bulk');
Route::get('send_confirmation/{user_id}', 'UserController@sendConfirmation');
Route::get('restore_user/{user_id}', 'UserController@restoreUser');
Route::post('users/change_password', 'UserController@changePassword');
2015-06-15 19:34:53 +02:00
Route::get('/switch_account/{user_id}', 'UserController@switchAccount');
2015-06-16 21:35:35 +02:00
Route::get('/unlink_account/{user_account_id}/{user_id}', 'UserController@unlinkAccount');
2015-08-03 09:15:58 +02:00
Route::get('/manage_companies', 'UserController@manageCompanies');
Route::get('api/tokens', array('as'=>'api.tokens', 'uses'=>'TokenController@getDatatable'));
Route::resource('tokens', 'TokenController');
2015-11-05 23:37:04 +01:00
Route::post('tokens/bulk', 'TokenController@bulk');
Route::get('api/products', array('as'=>'api.products', 'uses'=>'ProductController@getDatatable'));
Route::resource('products', 'ProductController');
2015-11-05 23:37:04 +01:00
Route::post('products/bulk', 'ProductController@bulk');
2015-10-21 13:11:08 +02:00
Route::get('api/tax_rates', array('as'=>'api.tax_rates', 'uses'=>'TaxRateController@getDatatable'));
Route::resource('tax_rates', 'TaxRateController');
2015-11-05 23:37:04 +01:00
Route::post('tax_rates/bulk', 'TaxRateController@bulk');
2015-10-21 13:11:08 +02:00
2015-10-14 16:15:39 +02:00
Route::get('company/{section}/{subSection?}', 'AccountController@redirectLegacy');
Route::get('settings/data_visualizations', 'ReportController@d3');
Route::get('settings/charts_and_reports', 'ReportController@showReports');
Route::post('settings/charts_and_reports', 'ReportController@showReports');
Route::post('settings/cancel_account', 'AccountController@cancelAccount');
Route::get('settings/{section?}', 'AccountController@showSection');
Route::post('settings/{section?}', 'AccountController@doSection');
2016-01-18 10:13:39 +01:00
2016-01-07 20:39:51 +01:00
// Payment term
Route::get('api/payment_terms', array('as'=>'api.payment_terms', 'uses'=>'PaymentTermController@getDatatable'));
Route::resource('payment_terms', 'PaymentTermController');
Route::post('payment_terms/bulk', 'PaymentTermController@bulk');
Route::get('account/getSearchData', array('as' => 'getSearchData', 'uses' => 'AccountController@getSearchData'));
Route::post('user/setTheme', 'UserController@setTheme');
Route::post('remove_logo', 'AccountController@removeLogo');
Route::post('account/go_pro', 'AccountController@enableProPlan');
2016-01-18 10:13:39 +01:00
2015-11-18 15:40:50 +01:00
Route::post('/export', 'ExportController@doExport');
Route::post('/import', 'ImportController@doImport');
2015-11-18 18:16:23 +01:00
Route::post('/import_csv', 'ImportController@doImportCSV');
Route::resource('gateways', 'AccountGatewayController');
Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable'));
2015-11-05 23:37:04 +01:00
Route::post('account_gateways/bulk', 'AccountGatewayController@bulk');
2016-01-20 00:07:31 +01:00
Route::resource('bank_accounts', 'BankAccountController');
Route::get('api/bank_accounts', array('as'=>'api.bank_accounts', 'uses'=>'BankAccountController@getDatatable'));
Route::post('bank_accounts/bulk', 'BankAccountController@bulk');
Route::post('bank_accounts/test', 'BankAccountController@test');
Route::resource('clients', 'ClientController');
Route::get('api/clients', array('as'=>'api.clients', 'uses'=>'ClientController@getDatatable'));
Route::get('api/activities/{client_id?}', array('as'=>'api.activities', 'uses'=>'ActivityController@getDatatable'));
Route::post('clients/bulk', 'ClientController@bulk');
2015-05-27 18:52:10 +02:00
Route::resource('tasks', 'TaskController');
Route::get('api/tasks/{client_id?}', array('as'=>'api.tasks', 'uses'=>'TaskController@getDatatable'));
Route::get('tasks/create/{client_id?}', 'TaskController@create');
Route::post('tasks/bulk', 'TaskController@bulk');
Route::get('api/recurring_invoices/{client_id?}', array('as'=>'api.recurring_invoices', 'uses'=>'InvoiceController@getRecurringDatatable'));
2016-01-18 10:13:39 +01:00
Route::get('invoices/invoice_history/{invoice_id}', 'InvoiceController@invoiceHistory');
Route::get('quotes/quote_history/{invoice_id}', 'InvoiceController@invoiceHistory');
2016-01-18 10:13:39 +01:00
Route::resource('invoices', 'InvoiceController');
Route::get('api/invoices/{client_id?}', array('as'=>'api.invoices', 'uses'=>'InvoiceController@getDatatable'));
Route::get('invoices/create/{client_id?}', 'InvoiceController@create');
Route::get('recurring_invoices/create/{client_id?}', 'InvoiceController@createRecurring');
Route::get('recurring_invoices', 'RecurringInvoiceController@index');
Route::get('invoices/{public_id}/clone', 'InvoiceController@cloneInvoice');
Route::post('invoices/bulk', 'InvoiceController@bulk');
Route::post('recurring_invoices/bulk', 'InvoiceController@bulk');
Route::get('quotes/create/{client_id?}', 'QuoteController@create');
Route::get('quotes/{public_id}/clone', 'InvoiceController@cloneInvoice');
Route::get('quotes/{public_id}/edit', 'InvoiceController@edit');
Route::put('quotes/{public_id}', 'InvoiceController@update');
Route::get('quotes/{public_id}', 'InvoiceController@edit');
Route::post('quotes', 'InvoiceController@store');
Route::get('quotes', 'QuoteController@index');
Route::get('api/quotes/{client_id?}', array('as'=>'api.quotes', 'uses'=>'QuoteController@getDatatable'));
Route::post('quotes/bulk', 'QuoteController@bulk');
Route::resource('payments', 'PaymentController');
Route::get('payments/create/{client_id?}/{invoice_id?}', 'PaymentController@create');
Route::get('api/payments/{client_id?}', array('as'=>'api.payments', 'uses'=>'PaymentController@getDatatable'));
Route::post('payments/bulk', 'PaymentController@bulk');
Route::get('credits/{id}/edit', function() {
return View::make('header');
});
Route::resource('credits', 'CreditController');
Route::get('credits/create/{client_id?}/{invoice_id?}', 'CreditController@create');
Route::get('api/credits/{client_id?}', array('as'=>'api.credits', 'uses'=>'CreditController@getDatatable'));
Route::post('credits/bulk', 'CreditController@bulk');
2015-04-13 14:49:40 +02:00
get('/resend_confirmation', 'AccountController@resendConfirmation');
2015-11-04 14:57:59 +01:00
post('/update_setup', 'AppController@updateSetup');
2016-01-06 15:23:58 +01:00
2016-01-06 15:23:58 +01:00
// vendor
Route::resource('vendors', 'VendorController');
Route::get('api/vendor', array('as'=>'api.vendors', 'uses'=>'VendorController@getDatatable'));
Route::post('vendors/bulk', 'VendorController@bulk');
2016-01-06 20:52:09 +01:00
// Expense
Route::resource('expenses', 'ExpenseController');
2016-01-21 20:15:30 +01:00
Route::get('expenses/create/{vendor_id?}/{client_id?}', 'ExpenseController@create');
Route::get('api/expense', array('as'=>'api.expenses', 'uses'=>'ExpenseController@getDatatable'));
Route::get('api/expenseVendor/{id}', array('as'=>'api.expense', 'uses'=>'ExpenseController@getDatatableVendor'));
2016-01-19 20:35:15 +01:00
Route::post('expenses/bulk', 'ExpenseController@bulk');
});
2015-11-02 19:43:22 +01:00
// Route groups for API
2015-04-02 15:06:16 +02:00
Route::group(['middleware' => 'api', 'prefix' => 'api/v1'], function()
{
Route::resource('ping', 'ClientApiController@ping');
2015-11-02 19:43:22 +01:00
Route::post('login', 'AccountApiController@login');
2015-11-19 12:37:30 +01:00
Route::get('static', 'AccountApiController@getStaticData');
2015-11-08 10:43:32 +01:00
Route::get('accounts', 'AccountApiController@show');
Route::resource('clients', 'ClientApiController');
2015-11-27 13:55:28 +01:00
Route::get('quotes', 'QuoteApiController@index');
Route::resource('quotes', 'QuoteApiController');
2015-11-27 13:55:28 +01:00
Route::get('invoices', 'InvoiceApiController@index');
2015-09-07 11:07:55 +02:00
Route::resource('invoices', 'InvoiceApiController');
2015-11-27 13:55:28 +01:00
Route::get('payments', 'PaymentApiController@index');
Route::resource('payments', 'PaymentApiController');
2015-11-27 13:55:28 +01:00
Route::get('tasks', 'TaskApiController@index');
2015-09-07 11:07:55 +02:00
Route::resource('tasks', 'TaskApiController');
2015-04-28 22:13:52 +02:00
Route::post('hooks', 'IntegrationController@subscribe');
Route::post('email_invoice', 'InvoiceApiController@emailInvoice');
2015-12-22 12:19:21 +01:00
Route::get('user_accounts','AccountApiController@getUserAccounts');
2016-01-19 20:35:15 +01:00
2016-01-06 15:23:58 +01:00
// Vendor
Route::resource('vendors', 'VendorApiController');
2016-01-19 20:35:15 +01:00
//Expense
Route::resource('expenses', 'ExpenseApiController');
});
2015-04-14 20:58:07 +02:00
// Redirects for legacy links
Route::get('/rocksteady', function() {
return Redirect::to(NINJA_WEB_URL, 301);
});
Route::get('/about', function() {
return Redirect::to(NINJA_WEB_URL, 301);
});
Route::get('/contact', function() {
return Redirect::to(NINJA_WEB_URL.'/contact', 301);
});
Route::get('/plans', function() {
return Redirect::to(NINJA_WEB_URL.'/pricing', 301);
});
Route::get('/faq', function() {
return Redirect::to(NINJA_WEB_URL.'/how-it-works', 301);
});
Route::get('/features', function() {
return Redirect::to(NINJA_WEB_URL.'/features', 301);
});
Route::get('/testimonials', function() {
return Redirect::to(NINJA_WEB_URL, 301);
});
Route::get('/compare-online-invoicing{sites?}', function() {
return Redirect::to(NINJA_WEB_URL, 301);
});
2015-06-10 22:55:23 +02:00
Route::get('/forgot_password', function() {
return Redirect::to(NINJA_APP_URL.'/forgot', 301);
});
2015-04-14 20:58:07 +02:00
2015-08-30 14:08:15 +02:00
if (!defined('CONTACT_EMAIL')) {
define('CONTACT_EMAIL', Config::get('mail.from.address'));
define('CONTACT_NAME', Config::get('mail.from.name'));
define('SITE_URL', Config::get('app.url'));
define('ENV_DEVELOPMENT', 'local');
define('ENV_STAGING', 'staging');
define('RECENTLY_VIEWED', 'RECENTLY_VIEWED');
2016-01-06 20:52:09 +01:00
2015-08-30 14:08:15 +02:00
define('ENTITY_CLIENT', 'client');
2015-11-27 13:55:28 +01:00
define('ENTITY_CONTACT', 'contact');
2015-08-30 14:08:15 +02:00
define('ENTITY_INVOICE', 'invoice');
2015-11-27 13:55:28 +01:00
define('ENTITY_INVOICE_ITEMS', 'invoice_items');
2015-12-02 14:26:06 +01:00
define('ENTITY_INVITATION', 'invitation');
2015-08-30 14:08:15 +02:00
define('ENTITY_RECURRING_INVOICE', 'recurring_invoice');
define('ENTITY_PAYMENT', 'payment');
define('ENTITY_CREDIT', 'credit');
define('ENTITY_QUOTE', 'quote');
define('ENTITY_TASK', 'task');
2015-11-05 23:37:04 +01:00
define('ENTITY_ACCOUNT_GATEWAY', 'account_gateway');
2016-01-20 00:07:31 +01:00
define('ENTITY_BANK_ACCOUNT', 'bank_account');
2015-11-05 23:37:04 +01:00
define('ENTITY_USER', 'user');
define('ENTITY_TOKEN', 'token');
define('ENTITY_TAX_RATE', 'tax_rate');
define('ENTITY_PRODUCT', 'product');
define('ENTITY_ACTIVITY', 'activity');
2016-01-06 15:23:58 +01:00
define('ENTITY_VENDOR','vendor');
2016-01-08 19:01:00 +01:00
define('ENTITY_VENDOR_ACTIVITY','vendor_activity');
2016-01-06 15:23:58 +01:00
define('ENTITY_EXPENSE', 'expense');
2016-01-07 20:39:51 +01:00
define('ENTITY_PAYMENT_TERM','payment_term');
2016-01-08 19:01:00 +01:00
define('ENTITY_EXPENSE_ACTIVITY','expense_activity');
2015-08-30 14:08:15 +02:00
define('PERSON_CONTACT', 'contact');
define('PERSON_USER', 'user');
2016-01-06 15:23:58 +01:00
define('PERSON_VENDOR_CONTACT','vendorcontact');
2015-08-30 14:08:15 +02:00
2015-10-14 16:15:39 +02:00
define('BASIC_SETTINGS', 'basic_settings');
define('ADVANCED_SETTINGS', 'advanced_settings');
define('ACCOUNT_COMPANY_DETAILS', 'company_details');
define('ACCOUNT_USER_DETAILS', 'user_details');
define('ACCOUNT_LOCALIZATION', 'localization');
2015-08-30 14:08:15 +02:00
define('ACCOUNT_NOTIFICATIONS', 'notifications');
define('ACCOUNT_IMPORT_EXPORT', 'import_export');
2015-10-14 16:15:39 +02:00
define('ACCOUNT_PAYMENTS', 'online_payments');
2016-01-20 00:07:31 +01:00
define('ACCOUNT_BANKS', 'bank_accounts');
2015-08-30 14:08:15 +02:00
define('ACCOUNT_MAP', 'import_map');
define('ACCOUNT_EXPORT', 'export');
2015-10-21 13:11:08 +02:00
define('ACCOUNT_TAX_RATES', 'tax_rates');
2015-08-30 14:08:15 +02:00
define('ACCOUNT_PRODUCTS', 'products');
define('ACCOUNT_ADVANCED_SETTINGS', 'advanced_settings');
define('ACCOUNT_INVOICE_SETTINGS', 'invoice_settings');
define('ACCOUNT_INVOICE_DESIGN', 'invoice_design');
2016-01-03 20:10:20 +01:00
define('ACCOUNT_CLIENT_PORTAL', 'client_portal');
2015-12-15 21:25:12 +01:00
define('ACCOUNT_EMAIL_SETTINGS', 'email_settings');
2015-10-14 16:15:39 +02:00
define('ACCOUNT_CHARTS_AND_REPORTS', 'charts_and_reports');
2015-08-30 14:08:15 +02:00
define('ACCOUNT_USER_MANAGEMENT', 'user_management');
define('ACCOUNT_DATA_VISUALIZATIONS', 'data_visualizations');
2015-09-17 21:01:06 +02:00
define('ACCOUNT_TEMPLATES_AND_REMINDERS', 'templates_and_reminders');
2015-10-14 16:15:39 +02:00
define('ACCOUNT_API_TOKENS', 'api_tokens');
2015-08-30 14:08:15 +02:00
define('ACCOUNT_CUSTOMIZE_DESIGN', 'customize_design');
2015-11-04 14:57:59 +01:00
define('ACCOUNT_SYSTEM_SETTINGS', 'system_settings');
2016-01-07 20:39:51 +01:00
define('ACCOUNT_PAYMENT_TERMS','payment_terms');
2015-08-30 14:08:15 +02:00
2015-10-28 20:22:07 +01:00
define('ACTION_RESTORE', 'restore');
define('ACTION_ARCHIVE', 'archive');
define('ACTION_DELETE', 'delete');
2015-08-30 14:08:15 +02:00
define('ACTIVITY_TYPE_CREATE_CLIENT', 1);
define('ACTIVITY_TYPE_ARCHIVE_CLIENT', 2);
define('ACTIVITY_TYPE_DELETE_CLIENT', 3);
define('ACTIVITY_TYPE_CREATE_INVOICE', 4);
define('ACTIVITY_TYPE_UPDATE_INVOICE', 5);
define('ACTIVITY_TYPE_EMAIL_INVOICE', 6);
define('ACTIVITY_TYPE_VIEW_INVOICE', 7);
define('ACTIVITY_TYPE_ARCHIVE_INVOICE', 8);
define('ACTIVITY_TYPE_DELETE_INVOICE', 9);
define('ACTIVITY_TYPE_CREATE_PAYMENT', 10);
2015-10-28 20:22:07 +01:00
//define('ACTIVITY_TYPE_UPDATE_PAYMENT', 11);
2015-08-30 14:08:15 +02:00
define('ACTIVITY_TYPE_ARCHIVE_PAYMENT', 12);
define('ACTIVITY_TYPE_DELETE_PAYMENT', 13);
define('ACTIVITY_TYPE_CREATE_CREDIT', 14);
2015-10-28 20:22:07 +01:00
//define('ACTIVITY_TYPE_UPDATE_CREDIT', 15);
2015-08-30 14:08:15 +02:00
define('ACTIVITY_TYPE_ARCHIVE_CREDIT', 16);
define('ACTIVITY_TYPE_DELETE_CREDIT', 17);
define('ACTIVITY_TYPE_CREATE_QUOTE', 18);
define('ACTIVITY_TYPE_UPDATE_QUOTE', 19);
define('ACTIVITY_TYPE_EMAIL_QUOTE', 20);
define('ACTIVITY_TYPE_VIEW_QUOTE', 21);
define('ACTIVITY_TYPE_ARCHIVE_QUOTE', 22);
define('ACTIVITY_TYPE_DELETE_QUOTE', 23);
define('ACTIVITY_TYPE_RESTORE_QUOTE', 24);
define('ACTIVITY_TYPE_RESTORE_INVOICE', 25);
define('ACTIVITY_TYPE_RESTORE_CLIENT', 26);
define('ACTIVITY_TYPE_RESTORE_PAYMENT', 27);
define('ACTIVITY_TYPE_RESTORE_CREDIT', 28);
define('ACTIVITY_TYPE_APPROVE_QUOTE', 29);
2016-01-06 15:23:58 +01:00
// Vendors
define('ACTIVITY_TYPE_CREATE_VENDOR', 30);
define('ACTIVITY_TYPE_ARCHIVE_VENDOR', 31);
define('ACTIVITY_TYPE_DELETE_VENDOR', 32);
define('ACTIVITY_TYPE_RESTORE_VENDOR', 33);
2016-01-06 20:52:09 +01:00
// expenses
define('ACTIVITY_TYPE_CREATE_EXPENSE', 34);
define('ACTIVITY_TYPE_ARCHIVE_EXPENSE', 35);
define('ACTIVITY_TYPE_DELETE_EXPENSE', 36);
define('ACTIVITY_TYPE_RESTORE_EXPENSE', 37);
2015-08-30 14:08:15 +02:00
define('DEFAULT_INVOICE_NUMBER', '0001');
define('RECENTLY_VIEWED_LIMIT', 8);
define('LOGGED_ERROR_LIMIT', 100);
define('RANDOM_KEY_LENGTH', 32);
define('MAX_NUM_USERS', 20);
define('MAX_SUBDOMAIN_LENGTH', 30);
define('MAX_IFRAME_URL_LENGTH', 250);
2015-11-16 19:02:04 +01:00
define('MAX_LOGO_FILE_SIZE', 200); // KB
2015-12-17 09:19:56 +01:00
define('MAX_FAILED_LOGINS', 10);
2015-08-30 14:08:15 +02:00
define('DEFAULT_FONT_SIZE', 9);
2016-01-07 08:08:30 +01:00
define('DEFAULT_HEADER_FONT', 1);// Roboto
define('DEFAULT_BODY_FONT', 1);// Roboto
2015-10-15 21:37:01 +02:00
define('DEFAULT_SEND_RECURRING_HOUR', 8);
2015-08-30 14:08:15 +02:00
2015-11-18 15:40:50 +01:00
define('IMPORT_CSV', 'CSV');
define('IMPORT_FRESHBOOKS', 'FreshBooks');
define('IMPORT_WAVE', 'Wave');
define('IMPORT_RONIN', 'Ronin');
define('IMPORT_HIVEAGE', 'Hiveage');
define('IMPORT_ZOHO', 'Zoho');
define('IMPORT_NUTCACHE', 'Nutcache');
define('IMPORT_INVOICEABLE', 'Invoiceable');
define('IMPORT_HARVEST', 'Harvest');
2015-11-17 14:53:14 +01:00
2015-10-18 09:30:28 +02:00
define('MAX_NUM_CLIENTS', 100);
define('MAX_NUM_CLIENTS_PRO', 20000);
define('MAX_NUM_CLIENTS_LEGACY', 500);
2015-12-03 16:35:41 +01:00
define('MAX_INVOICE_AMOUNT', 1000000000);
2015-10-18 09:30:28 +02:00
define('LEGACY_CUTOFF', 57800);
2015-11-03 20:03:24 +01:00
define('ERROR_DELAY', 3);
2015-10-18 09:30:28 +02:00
2016-01-06 15:23:58 +01:00
define('MAX_NUM_VENDORS', 100);
define('MAX_NUM_VENDORS_PRO', 20000);
define('MAX_NUM_VENDORS_LEGACY', 500);
2015-08-30 14:08:15 +02:00
define('INVOICE_STATUS_DRAFT', 1);
define('INVOICE_STATUS_SENT', 2);
define('INVOICE_STATUS_VIEWED', 3);
define('INVOICE_STATUS_APPROVED', 4);
define('INVOICE_STATUS_PARTIAL', 5);
define('INVOICE_STATUS_PAID', 6);
2015-08-30 14:08:15 +02:00
define('PAYMENT_TYPE_CREDIT', 1);
define('CUSTOM_DESIGN', 11);
define('FREQUENCY_WEEKLY', 1);
define('FREQUENCY_TWO_WEEKS', 2);
define('FREQUENCY_FOUR_WEEKS', 3);
define('FREQUENCY_MONTHLY', 4);
define('FREQUENCY_THREE_MONTHS', 5);
define('FREQUENCY_SIX_MONTHS', 6);
define('FREQUENCY_ANNUALLY', 7);
define('SESSION_TIMEZONE', 'timezone');
define('SESSION_CURRENCY', 'currency');
define('SESSION_DATE_FORMAT', 'dateFormat');
define('SESSION_DATE_PICKER_FORMAT', 'datePickerFormat');
define('SESSION_DATETIME_FORMAT', 'datetimeFormat');
define('SESSION_COUNTER', 'sessionCounter');
define('SESSION_LOCALE', 'sessionLocale');
define('SESSION_USER_ACCOUNTS', 'userAccounts');
define('SESSION_REFERRAL_CODE', 'referralCode');
2015-08-30 14:08:15 +02:00
define('SESSION_LAST_REQUEST_PAGE', 'SESSION_LAST_REQUEST_PAGE');
define('SESSION_LAST_REQUEST_TIME', 'SESSION_LAST_REQUEST_TIME');
define('CURRENCY_DOLLAR', 1);
define('CURRENCY_EURO', 3);
2015-08-30 14:08:15 +02:00
define('DEFAULT_TIMEZONE', 'US/Eastern');
define('DEFAULT_COUNTRY', 840); // United Stated
define('DEFAULT_CURRENCY', CURRENCY_DOLLAR);
2015-08-30 14:08:15 +02:00
define('DEFAULT_LANGUAGE', 1); // English
define('DEFAULT_DATE_FORMAT', 'M j, Y');
define('DEFAULT_DATE_PICKER_FORMAT', 'M d, yyyy');
2015-09-04 09:20:30 +02:00
define('DEFAULT_DATETIME_FORMAT', 'F j, Y g:i a');
2015-09-03 09:32:39 +02:00
define('DEFAULT_DATETIME_MOMENT_FORMAT', 'MMM D, YYYY h:mm:ss a');
2015-08-30 14:08:15 +02:00
define('DEFAULT_LOCALE', 'en');
define('DEFAULT_MAP_ZOOM', 10);
2015-08-30 14:08:15 +02:00
define('RESULT_SUCCESS', 'success');
define('RESULT_FAILURE', 'failure');
define('PAYMENT_LIBRARY_OMNIPAY', 1);
define('PAYMENT_LIBRARY_PHP_PAYMENTS', 2);
define('GATEWAY_AUTHORIZE_NET', 1);
define('GATEWAY_AUTHORIZE_NET_SIM', 2);
2015-11-13 14:40:42 +01:00
define('GATEWAY_EWAY', 4);
define('GATEWAY_MOLLIE', 9);
2015-11-02 10:47:47 +01:00
define('GATEWAY_PAYFAST', 13);
2015-08-30 14:08:15 +02:00
define('GATEWAY_PAYPAL_EXPRESS', 17);
define('GATEWAY_PAYPAL_PRO', 18);
define('GATEWAY_STRIPE', 23);
2016-01-18 10:13:39 +01:00
define('GATEWAY_GOCARDLESS', 6);
2015-08-30 14:08:15 +02:00
define('GATEWAY_TWO_CHECKOUT', 27);
define('GATEWAY_BEANSTREAM', 29);
define('GATEWAY_PSIGATE', 30);
define('GATEWAY_MOOLAH', 31);
define('GATEWAY_BITPAY', 42);
define('GATEWAY_DWOLLA', 43);
2016-01-13 22:46:12 +01:00
define('GATEWAY_CHECKOUT_COM', 47);
2015-08-30 14:08:15 +02:00
define('EVENT_CREATE_CLIENT', 1);
define('EVENT_CREATE_INVOICE', 2);
define('EVENT_CREATE_QUOTE', 3);
define('EVENT_CREATE_PAYMENT', 4);
2016-01-06 15:23:58 +01:00
define('EVENT_CREATE_VENDOR',5);
2015-08-30 14:08:15 +02:00
define('REQUESTED_PRO_PLAN', 'REQUESTED_PRO_PLAN');
define('DEMO_ACCOUNT_ID', 'DEMO_ACCOUNT_ID');
define('PREV_USER_ID', 'PREV_USER_ID');
define('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h');
define('NINJA_GATEWAY_ID', GATEWAY_STRIPE);
define('NINJA_GATEWAY_CONFIG', 'NINJA_GATEWAY_CONFIG');
2015-08-30 14:08:15 +02:00
define('NINJA_WEB_URL', 'https://www.invoiceninja.com');
define('NINJA_APP_URL', 'https://app.invoiceninja.com');
2016-01-17 15:36:22 +01:00
define('NINJA_VERSION', '2.4.9.6');
2015-08-30 14:08:15 +02:00
define('NINJA_DATE', '2000-01-01');
2015-12-17 19:03:32 +01:00
define('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja');
define('SOCIAL_LINK_TWITTER', 'https://twitter.com/invoiceninja');
define('SOCIAL_LINK_GITHUB', 'https://github.com/invoiceninja/invoiceninja/');
2015-08-30 14:08:15 +02:00
define('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com');
2015-10-14 22:56:17 +02:00
define('RELEASES_URL', 'https://trello.com/b/63BbiVVe/invoice-ninja');
define('ZAPIER_URL', 'https://zapier.com/zapbook/invoice-ninja');
2015-08-30 14:08:15 +02:00
define('OUTDATE_BROWSER_URL', 'http://browsehappy.com/');
define('PDFMAKE_DOCS', 'http://pdfmake.org/playground.html');
2015-11-28 21:00:24 +01:00
define('PHANTOMJS_CLOUD', 'http://api.phantomjscloud.com/api/browser/v2/');
2015-10-22 20:48:12 +02:00
define('PHP_DATE_FORMATS', 'http://php.net/manual/en/function.date.php');
2015-11-18 15:40:50 +01:00
define('REFERRAL_PROGRAM_URL', 'https://www.invoiceninja.com/referral-program/');
2015-12-16 12:49:26 +01:00
define('EMAIL_MARKUP_URL', 'https://developers.google.com/gmail/markup');
2015-08-30 14:08:15 +02:00
define('COUNT_FREE_DESIGNS', 4);
define('COUNT_FREE_DESIGNS_SELF_HOST', 5); // include the custom design
define('PRODUCT_ONE_CLICK_INSTALL', 1);
define('PRODUCT_INVOICE_DESIGNS', 2);
define('PRODUCT_WHITE_LABEL', 3);
define('PRODUCT_SELF_HOST', 4);
define('WHITE_LABEL_AFFILIATE_KEY', '92D2J5');
define('INVOICE_DESIGNS_AFFILIATE_KEY', 'T3RS74');
define('SELF_HOST_AFFILIATE_KEY', '8S69AD');
define('PRO_PLAN_PRICE', 50);
define('WHITE_LABEL_PRICE', 20);
define('INVOICE_DESIGNS_PRICE', 10);
define('USER_TYPE_SELF_HOST', 'SELF_HOST');
define('USER_TYPE_CLOUD_HOST', 'CLOUD_HOST');
define('NEW_VERSION_AVAILABLE', 'NEW_VERSION_AVAILABLE');
define('TEST_USERNAME', 'user@example.com');
define('TEST_PASSWORD', 'password');
2015-11-01 23:10:20 +01:00
define('API_SECRET', 'API_SECRET');
2015-08-30 14:08:15 +02:00
define('TOKEN_BILLING_DISABLED', 1);
define('TOKEN_BILLING_OPT_IN', 2);
define('TOKEN_BILLING_OPT_OUT', 3);
define('TOKEN_BILLING_ALWAYS', 4);
define('PAYMENT_TYPE_PAYPAL', 'PAYMENT_TYPE_PAYPAL');
define('PAYMENT_TYPE_CREDIT_CARD', 'PAYMENT_TYPE_CREDIT_CARD');
2016-01-18 10:13:39 +01:00
define('PAYMENT_TYPE_DIRECT_DEBIT', 'PAYMENT_TYPE_DIRECT_DEBIT');
2015-08-30 14:08:15 +02:00
define('PAYMENT_TYPE_BITCOIN', 'PAYMENT_TYPE_BITCOIN');
define('PAYMENT_TYPE_DWOLLA', 'PAYMENT_TYPE_DWOLLA');
define('PAYMENT_TYPE_TOKEN', 'PAYMENT_TYPE_TOKEN');
define('PAYMENT_TYPE_ANY', 'PAYMENT_TYPE_ANY');
2015-09-17 21:01:06 +02:00
define('REMINDER1', 'reminder1');
define('REMINDER2', 'reminder2');
define('REMINDER3', 'reminder3');
define('REMINDER_DIRECTION_AFTER', 1);
define('REMINDER_DIRECTION_BEFORE', 2);
define('REMINDER_FIELD_DUE_DATE', 1);
define('REMINDER_FIELD_INVOICE_DATE', 2);
2015-10-08 11:49:26 +02:00
define('SOCIAL_GOOGLE', 'Google');
define('SOCIAL_FACEBOOK', 'Facebook');
2015-10-11 16:41:09 +02:00
define('SOCIAL_GITHUB', 'GitHub');
2015-10-08 11:49:26 +02:00
define('SOCIAL_LINKEDIN', 'LinkedIn');
2015-11-21 22:10:26 +01:00
define('USER_STATE_ACTIVE', 'active');
define('USER_STATE_PENDING', 'pending');
define('USER_STATE_DISABLED', 'disabled');
define('USER_STATE_ADMIN', 'admin');
2015-11-27 13:55:28 +01:00
define('API_SERIALIZER_ARRAY', 'array');
define('API_SERIALIZER_JSON', 'json');
2015-11-21 22:10:26 +01:00
2015-12-02 14:26:06 +01:00
define('EMAIL_DESIGN_PLAIN', 1);
2015-12-29 18:49:40 +01:00
define('EMAIL_DESIGN_LIGHT', 2);
define('EMAIL_DESIGN_DARK', 3);
2015-12-02 14:26:06 +01:00
2016-01-20 00:07:31 +01:00
define('BANK_LIBRARY_OFX', 1);
2015-08-30 14:08:15 +02:00
$creditCards = [
1 => ['card' => 'images/credit_cards/Test-Visa-Icon.png', 'text' => 'Visa'],
2 => ['card' => 'images/credit_cards/Test-MasterCard-Icon.png', 'text' => 'Master Card'],
4 => ['card' => 'images/credit_cards/Test-AmericanExpress-Icon.png', 'text' => 'American Express'],
8 => ['card' => 'images/credit_cards/Test-Diners-Icon.png', 'text' => 'Diners'],
16 => ['card' => 'images/credit_cards/Test-Discover-Icon.png', 'text' => 'Discover']
];
define('CREDIT_CARDS', serialize($creditCards));
2015-11-19 12:37:30 +01:00
$cachedTables = [
'currencies' => 'App\Models\Currency',
'sizes' => 'App\Models\Size',
'industries' => 'App\Models\Industry',
'timezones' => 'App\Models\Timezone',
'dateFormats' => 'App\Models\DateFormat',
'datetimeFormats' => 'App\Models\DatetimeFormat',
'languages' => 'App\Models\Language',
'paymentTerms' => 'App\Models\PaymentTerm',
'paymentTypes' => 'App\Models\PaymentType',
'countries' => 'App\Models\Country',
'invoiceDesigns' => 'App\Models\InvoiceDesign',
2015-11-19 22:30:30 +01:00
'invoiceStatus' => 'App\Models\InvoiceStatus',
2015-11-21 22:11:23 +01:00
'frequencies' => 'App\Models\Frequency',
'gateways' => 'App\Models\Gateway',
2016-01-07 08:08:30 +01:00
'fonts' => 'App\Models\Font',
2016-01-20 00:07:31 +01:00
'banks' => 'App\Models\Bank',
2015-11-19 12:37:30 +01:00
];
define('CACHED_TABLES', serialize($cachedTables));
2015-08-30 14:08:15 +02:00
function uctrans($text)
{
return ucwords(trans($text));
}
2015-08-30 14:08:15 +02:00
// optional trans: only return the string if it's translated
function otrans($text)
{
$locale = Session::get(SESSION_LOCALE);
if ($locale == 'en') {
return trans($text);
} else {
$string = trans($text);
$english = trans($text, [], 'en');
return $string != $english ? $string : '';
}
}
}
2015-11-28 21:00:24 +01:00
/*
2015-12-27 08:36:22 +01:00
// Log all SQL queries to laravel.log
2015-11-12 21:36:28 +01:00
if (Utils::isNinjaDev()) {
Event::listen('illuminate.query', function($query, $bindings, $time, $name) {
$data = compact('bindings', 'time', 'name');
// Format binding data for sql insertion
foreach ($bindings as $i => $binding) {
if ($binding instanceof \DateTime) {
$bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
} elseif (is_string($binding)) {
$bindings[$i] = "'$binding'";
}
}
2015-11-12 21:36:28 +01:00
// Insert bindings into query
$query = str_replace(array('%', '?'), array('%%', '%s'), $query);
$query = vsprintf($query, $bindings);
2015-11-12 21:36:28 +01:00
Log::info($query, $data);
});
}
2015-11-28 21:00:24 +01:00
*/
2015-07-28 09:00:00 +02:00
/*
if (Auth::check() && Auth::user()->id === 1)
{
Auth::loginUsingId(1);
}
2016-01-18 10:13:39 +01:00
*/
2016-01-20 00:07:31 +01:00