diff --git a/.gitignore b/.gitignore index e90fc1c3c..3152ae533 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,10 @@ /node_modules /vendor /public/bower_components - -# Logs -/application/logs/* -*.log +app/Config/email.php +app/sessions/* +app/logs/* +app/uploads/* npm-debug.log* # Build generated @@ -81,6 +81,7 @@ $RECYCLE.BIN/ git-svn-diff.py *.bash .swp +system/ *.swp *.rej *.orig @@ -88,3 +89,8 @@ git-svn-diff.py *.~ .env auth.json + +*.png +*.jpg +*.jpeg +*copy* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c15f83fac..4e03d2b20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ RUN echo "date.timezone = \"\${PHP_TIMEZONE}\"" > /usr/local/etc/php/conf.d/time WORKDIR /app COPY . /app RUN ln -s /app/*[^public] /var/www && rm -rf /var/www/html && ln -nsf /app/public /var/www/html -RUN chmod -R 750 /app/public/uploads /app/application/logs && chown -R www-data:www-data /app/public /app/application +RUN chmod -R 750 /app/writable/uploads /app/writable/logs && chown -R www-data:www-data /app/writable /app/application FROM ospos AS ospos_test @@ -23,10 +23,8 @@ RUN apt-get install -y libzip-dev wget git RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /bin/wait-for-it.sh && chmod +x /bin/wait-for-it.sh RUN docker-php-ext-install zip RUN composer install -d/app -RUN php /app/vendor/kenjis/ci-phpunit-test/install.php -a /app/application -p /app/vendor/codeigniter/framework -RUN sed -i 's/backupGlobals="true"/backupGlobals="false"/g' /app/application/tests/phpunit.xml -RUN sed -i '13,17d' /app/application/tests/controllers/Welcome_test.php -WORKDIR /app/application/tests +#RUN sed -i 's/backupGlobals="true"/backupGlobals="false"/g' /app/tests/phpunit.xml +WORKDIR /app/tests CMD ["/app/vendor/phpunit/phpunit/phpunit"] diff --git a/application/.htaccess b/app/.htaccess similarity index 100% rename from application/.htaccess rename to app/.htaccess diff --git a/app/Common.php b/app/Common.php new file mode 100644 index 000000000..780ba3f80 --- /dev/null +++ b/app/Common.php @@ -0,0 +1,15 @@ +https_on = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_ENV['FORCE_HTTPS']) && $_ENV['FORCE_HTTPS'] == 'true'); + $this->baseURL = $this->https_on ? 'https' : 'http'; + $this->baseURL .= '://' . ((isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : 'localhost'); + $this->baseURL .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); + } +} diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php new file mode 100644 index 000000000..a6e894f13 --- /dev/null +++ b/app/Config/Autoload.php @@ -0,0 +1,193 @@ + SYSTEMPATH, + * 'App' => APPPATH + * ]; + *``` + * @var array + */ + public $psr4 = [ + APP_NAMESPACE => APPPATH, // For custom app namespace + 'Config' => APPPATH . 'Config', + 'dompdf' => APPPATH . 'ThirdParty/dompdf/src' + ]; + + /** + * ------------------------------------------------------------------- + * Class Map + * ------------------------------------------------------------------- + * The class map provides a map of class names and their exact + * location on the drive. Classes loaded in this manner will have + * slightly faster performance because they will not have to be + * searched for within one or more directories as they would if they + * were being autoloaded through a namespace. + * + * Prototype: + *``` + * $classmap = [ + * 'MyClass' => '/path/to/class/file.php' + * ]; + *``` + * @var array + */ + public $classmap = [ + //Controllers + 'Attributes' => '/App/Controllers/Attributes.php', + 'Cashups' => '/App/Controllers/Cashups.php', + 'Config' => '/App/Controllers/Config.php', + 'Customers' => '/App/Controllers/Customers.php', + 'Employees' => '/App/Controllers/Employees.php', + 'Expenses' => '/App/Controllers/Expenses.php', + 'Expenses_categories' => '/App/Controllers/Expenses_categories.php', + 'Giftcards' => '/App/Controllers/Giftcards.php', + 'Home' => '/App/Controllers/Home.php', + 'Item_kits' => '/App/Controllers/Item_kits.php', + 'Items' => '/App/Controllers/Items.php', + 'Login' => '/App/Controllers/Login.php', + 'Messages' => '/App/Controllers/Messages.php', + 'No_access' => '/App/Controllers/No_access.php', + 'Office' => '/App/Controllers/Office.php', + 'Persons' => '/App/Controllers/Persons.php', + 'Receivings' => '/App/Controllers/Receivings.php', + 'Reports' => '/App/Controllers/Reports.php', + 'Sales' => '/App/Controllers/Sales.php', + 'Secure_Controller' => '/App/Controllers/Secure_Controller.php', + 'Suppliers' => '/App/Controllers/Suppliers.php', + 'Tax_categories' => '/App/Controllers/Tax_categories.php', + 'Tax_codes' => '/App/Controllers/Tax_codes.php', + 'Tax_jurisdictions' => '/App/Controllers/Tax_jurisdictions.php', + 'Taxes' => '/App/Controllers/Taxes.php', + + //Models + 'Appconfig' => '/App/Models/Appconfig.php', + 'Attribute' => '/App/Models/Attribute.php', + 'Cashup' => '/App/Models/Cashup.php', + 'Customer' => '/App/Models/Customer.php', + 'Customer_rewards' => '/App/Models/Customer_rewards.php', + 'Dinner_table' => '/App/Models/Dinner_table.php', + 'Employee' => '/App/Models/Employee.php', + 'Expense' => '/App/Models/Expense.php', + 'Expense_category' => '/App/Models/Expense_category.php', + 'Giftcard' => '/App/Models/Giftcard.php', + 'Inventory' => '/App/Models/Inventory.php', + 'Item_kit' => '/App/Models/Item_kit.php', + 'Item_kit_items' => '/App/Models/Item_kit_items.php', + 'Item_quantity' => '/App/Models/Item_quantity.php', + 'Item_taxes' => '/App/Models/Item_taxes.php', + 'Module' => '/App/Models/Module.php', + 'Person' => '/App/Models/Person.php', + 'Receiving' => '/App/Models/Receiving.php', + 'Rewards' => '/App/Models/Rewards.php', + 'Sale' => '/App/Models/Sale.php', + 'Stock_location' => '/App/Models/Stock_location.php', + 'Supplier' => '/App/Models/Supplier.php', + 'Tax' => '/App/Models/Tax.php', + 'Tax_category' => '/App/Models/Tax_category.php', + 'Tax_code' => '/App/Models/Tax_code.php', + 'Tax_jurisdiction' => '/App/Models/Tax_jurisdiction.php', + + //Reports + 'Report' => '/App/Models/Reports/Report.php', + 'Detailed_receiving' => '/App/Models/Reports/Detailed_receiving.php', + 'Detailed_sales' => '/App/Models/Reports/Detailed_sales.php', + 'Inventory_low' => '/App/Models/Reports/Inventory_low.php', + 'Inventory_summary' => '/App/Models/Reports/Inventory_summary.php', + 'Specific_customer' => '/App/Models/Reports/Specific_customer.php', + 'Specific_discount' => '/App/Models/Reports/Specific_discount.php', + 'Specific_employee' => '/App/Models/Reports/Specific_employee.php', + 'Specific_supplier' => '/App/Models/Reports/Specific_supplier.php', + 'Summary_categories' => '/App/Models/Reports/Summary_categories.php', + 'Summary_customers' => '/App/Models/Reports/Summary_customers.php', + 'Summary_discounts' => '/App/Models/Reports/Summary_discounts.php', + 'Summary_employees' => '/App/Models/Reports/Summary_employees.php', + 'Summary_expenses_categories' => '/App/Models/Reports/Summary_expenses_categories.php', + 'Summary_items' => '/App/Models/Reports/Summary_items.php', + 'Summary_payments' => '/App/Models/Reports/Summary_payments.php', + 'Summary_report' => '/App/Models/Reports/Summary_report.php', + 'Summary_sales' => '/App/Models/Reports/Summary_sales.php', + 'Summary_sales_taxes' => '/App/Models/Reports/Summary_sales_taxes.php', + 'Summary_suppliers' => '/App/Models/Reports/Summary_suppliers.php', + 'Summary_taxes' => '/App/Models/Reports/Summary_taxes.php', + + //Tokens + 'Token' => '/App/Models/Tokens/Token.php', + 'Token_barcode_ean' => '/App/Models/Tokens/Token_barcode_ean.php', + 'Token_barcode_price' => '/App/Models/Tokens/Token_barcode_price.php', + 'Token_barcode_weight' => '/App/Models/Tokens/Token_barcode_weight.php', + 'Token_customer' => '/App/Models/Tokens/Token_customer.php', + 'Token_invoice_count' => '/App/Models/Tokens/Token_invoice_count.php', + 'Token_invoice_sequence' => '/App/Models/Tokens/Token_invoice_sequence.php', + 'Token_quote_sequence' => '/App/Models/Tokens/Token_quote_sequence.php', + 'Token_suspended_invoice_count' => '/App/Models/Tokens/Token_suspended_invoice_count.php', + 'Token_work_order_sequence' => '/App/Models/Tokens/Token_work_order_sequence.php', + 'Token_year_invoice_count' => '/App/Models/Tokens/Token_year_invoice_count.php', + 'Token_year_quote_count' => '/App/Models/Tokens/Token_year_quote_count.php', + + //Libraries + 'Barcode_lib' => '/App/Libraries/Barcode_lib.php', + 'Email_lib' => '/App/Libraries/Email_lib.php', + 'Item_lib' => '/App/Libraries/Item_lib.php', + 'Mailchimp_lib' => '/App/Libraries/Mailchimp_lib.php', + 'MY_Email' => '/App/Libraries/MY_Email.php', + 'MY_Migration' => '/App/Libraries/MY_Migration.php', + 'Receving_lib' => '/App/Libraries/Receiving_lib.php', + 'Sale_lib' => '/App/Libraries/Sale_lib.php', + 'Sms_lib' => '/App/Libraries/Sms_lib.php', + 'Tax_lib' => '/App/Libraries/Tax_lib.php', + 'Token_lib' => '/App/Libraries/Token_lib.php', + + //Miscellaneous + 'Rounding_mode' => '/App/Models/Enums/Rounding_mode.php' + ]; + + /** + * ------------------------------------------------------------------- + * Files + * ------------------------------------------------------------------- + * The files array provides a list of paths to __non-class__ files + * that will be autoloaded. This can be useful for bootstrap operations + * or for loading functions. + * + * Prototype: + * ``` + * $files = [ + * '/path/to/my/file.php', + * ]; + * ``` + * @var array + */ + public $files = []; +} \ No newline at end of file diff --git a/app/Config/Boot/development.php b/app/Config/Boot/development.php new file mode 100644 index 000000000..05a861258 --- /dev/null +++ b/app/Config/Boot/development.php @@ -0,0 +1,32 @@ + + */ + public $file = [ + 'storePath' => WRITEPATH . 'cache/', + 'mode' => 0640, + ]; + + /** + * ------------------------------------------------------------------------- + * Memcached settings + * ------------------------------------------------------------------------- + * Your Memcached servers can be specified below, if you are using + * the Memcached drivers. + * + * @see https://codeigniter.com/user_guide/libraries/caching.html#memcached + * + * @var array + */ + public $memcached = [ + 'host' => '127.0.0.1', + 'port' => 11211, + 'weight' => 1, + 'raw' => false, + ]; + + /** + * ------------------------------------------------------------------------- + * Redis settings + * ------------------------------------------------------------------------- + * Your Redis server can be specified below, if you are using + * the Redis or Predis drivers. + * + * @var array + */ + public $redis = [ + 'host' => '127.0.0.1', + 'password' => null, + 'port' => 6379, + 'timeout' => 0, + 'database' => 0, + ]; + + /** + * -------------------------------------------------------------------------- + * Available Cache Handlers + * -------------------------------------------------------------------------- + * + * This is an array of cache engine alias' and class names. Only engines + * that are listed here are allowed to be used. + * + * @var array + */ + public $validHandlers = [ + 'dummy' => DummyHandler::class, + 'file' => FileHandler::class, + 'memcached' => MemcachedHandler::class, + 'predis' => PredisHandler::class, + 'redis' => RedisHandler::class, + 'wincache' => WincacheHandler::class, + ]; +} diff --git a/app/Config/Constants.php b/app/Config/Constants.php new file mode 100644 index 000000000..16be5e47f --- /dev/null +++ b/app/Config/Constants.php @@ -0,0 +1,154 @@ +` element. + * + * Will default to self if not overridden + * + * @var string|string[]|null + */ + public $baseURI = null; + + /** + * Lists the URLs for workers and embedded frame contents + * + * @var string|string[] + */ + public $childSrc = 'self'; + + /** + * Limits the origins that you can connect to (via XHR, + * WebSockets, and EventSource). + * + * @var string|string[] + */ + public $connectSrc = 'self'; + + /** + * Specifies the origins that can serve web fonts. + * + * @var string|string[] + */ + public $fontSrc = null; + + /** + * Lists valid endpoints for submission from `
` tags. + * + * @var string|string[] + */ + public $formAction = 'self'; + + /** + * Specifies the sources that can embed the current page. + * This directive applies to ``, `