Skip to content

Commit

Permalink
Stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
DevNoam committed Nov 2, 2024
1 parent 8e90f87 commit 9815d4e
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 19 deletions.
9 changes: 1 addition & 8 deletions Framework/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ class Database
*/
public function __construct()
{
function loadEnv($path) {
$env = [];
$lines = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$lines = file('../.env', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

foreach ($lines as $line) {
if (strpos(trim($line), '#') === 0) {
Expand All @@ -25,12 +24,6 @@ function loadEnv($path) {
list($key, $value) = explode('=', $line, 2);
$env[trim($key)] = trim($value);
}

return $env;
}

$env = loadEnv(__DIR__ . '/../.env');



$options = [
Expand Down
6 changes: 3 additions & 3 deletions Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
//GET
$router->get('/', 'HomeController@panel', ['user']);
$router->get('/cases', 'HomeController@cases', ['user']);
$router->get('/case', 'inquiryController@initCasePage', ['user']);
$router->get('/case/{id}', 'inquiryController@initCasePage', ['user']);
$router->get('/case', 'InquiryController@initCasePage', ['user']);
$router->get('/case/{id}', 'InquiryController@initCasePage', ['user']);
$router->get('/reports', 'HomeController@reports' , ['user']);
$router->get('/search', 'HomeController@searchCase', ['user']);
$router->get('/printCase/{id}', 'inquiryController@printInquiry', ['user']);
$router->get('/printCase/{id}', 'InquiryController@printInquiry', ['user']);
$router->get('/profile', 'UserController@profile', ['user']);
$router->get('/profile/{id}', 'UserController@profile', ['Admin']);
$router->get('/settings', 'SettingsController@showSettings', ['Admin']); //Admins only /////1
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions index.php → public/index.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/../vendor/autoload.php';

use Framework\Router;
require 'helpers.php';
require_once('../helpers.php');

session_start();
new Framework\Database();

$router = new Router();
$routes = require basePath('Routes.php');
$routes = require_once(basePath('Routes.php'));

$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$router->route($uri);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions warrantytrack.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CREATE TABLE `cases` (
`FixedDescription` text COMMENT 'Tell what was the problem and if the case has been resolved.',
`Createdby` varchar(256) NOT NULL DEFAULT 'General' COMMENT 'Which agent created the case',
`Supplier` varchar(256) DEFAULT 'UNKOWN' COMMENT 'Who is the supplier of the product. Warranty will be covered by the supplier.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Triggers `cases`
Expand Down Expand Up @@ -78,7 +78,7 @@ CREATE TABLE `settings` (
`Phone` varchar(16) DEFAULT NULL,
`Email` text,
`Logo` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `settings`
Expand All @@ -99,15 +99,15 @@ CREATE TABLE `users` (
`password` varchar(255) NOT NULL,
`role` set('Admin','Technician','Supplier','Employee') NOT NULL DEFAULT 'Employee',
`Name` varchar(64) DEFAULT NULL,
`session` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
`session` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `password`, `role`, `Name`, `session`) VALUES
(1, 'Admin', '$2y$10$KaEcfN5lPFHmb4fwjLF80.7VmdzYSH3kh5scv7lPEm/2tI5fz4Ct6', 'Admin', 'Administrator', '');
(1, 'Admin', '$2y$10$KaEcfN5lPFHmb4fwjLF80.7VmdzYSH3kh5scv7lPEm/2tI5fz4Ct6', 'Admin', 'Administrator', 'ld40g38n15jufsbslnjbrrbei1');

--
-- Indexes for dumped tables
Expand Down

0 comments on commit 9815d4e

Please sign in to comment.