File manager - Edit - /home/autoph/public_html/ltms-upload/plugins/dropzone/min/src.zip
Back
PK �{�ZQI�EZ Z helpers.phpnu �[��� <?php use Pecee\SimpleRouter\SimpleRouter as Router; use Pecee\Http\Url; use Pecee\Http\Response; use Pecee\Http\Request; /** * Get url for a route by using either name/alias, class or method name. * * The name parameter supports the following values: * - Route name * - Controller/resource name (with or without method) * - Controller class name * * When searching for controller/resource by name, you can use this syntax "route.name@method". * You can also use the same syntax when searching for a specific controller-class "MyController@home". * If no arguments is specified, it will return the url for the current loaded route. * * @param string|null $name * @param string|array|null $parameters * @param array|null $getParams * @return \Pecee\Http\Url * @throws \InvalidArgumentException */ function url(?string $name = null, $parameters = null, ?array $getParams = null): Url { return Router::getUrl($name, $parameters, $getParams); } /** * @return \Pecee\Http\Response */ function response(): Response { return Router::response(); } /** * @return \Pecee\Http\Request */ function request(): Request { return Router::request(); } /** * Get input class * @param string|null $index Parameter index name * @param string|null $defaultValue Default return value * @param array ...$methods Default methods * @return \Pecee\Http\Input\InputHandler|array|string|null */ function input($index = null, $defaultValue = null, ...$methods) { if ($index !== null) { return request()->getInputHandler()->value($index, $defaultValue, ...$methods); } return request()->getInputHandler(); } /** * @param string $url * @param int|null $code */ function redirect(string $url, ?int $code = null): void { if ($code !== null) { response()->httpCode($code); } response()->redirect($url); } /** * Get current csrf-token * @return string|null */ function csrf_token(): ?string { $baseVerifier = Router::router()->getCsrfVerifier(); if ($baseVerifier !== null) { return $baseVerifier->getTokenProvider()->getToken(); } return null; } //Custom Helpers /** * Flatten the array * @return array|null */ function array_flatten(array $array) { $return = array(); array_walk_recursive($array, function ($a) use (&$return) { $return[] = $a; }); return $return; } function escape($string) { return htmlspecialchars($string, ENT_QUOTES, 'UTF-8'); // return htmlspecialchars($string, ENT_QUOTES | ENT_HTML5, 'UTF-8'); // return htmlentities($string, ENT_QUOTES | ENT_HTML5, 'UTF-8'); } function config($config) { // return (object) include(__DIR__ . '/../config/' . $config . '.php'); return (object) include(__DIR__ . '/config/' . $config . '.php'); } function sanitize($array) { if (!is_array($array)) { $array = preg_replace('/\h+/', ' ', escape(trim($array))); if (empty($array) && !strlen($array)) { $array = NULL; } } else { foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = sanitize($value); } else { $array[$key] = preg_replace('/\h+/', ' ', escape(trim($value))); if (empty($value) && !strlen($value)) { $array[$key] = NULL; } } } } return $array; } PK �{�Z���� � Utilities/Token.phpnu �[��� <?php namespace App\Utilities; use Ramsey\Uuid\Uuid; // use App\Core\View; class Token { public static function generate() { return Uuid::uuid4(); } } PK �{�Z�gd� � Utilities/Slug.phpnu �[��� <?php namespace App\Utilities; class Slug { public static function create($data){ $data = strtolower(trim($data)); $slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $data); return $slug; } }PK �{�Z�"��� � Utilities/Auth.phpnu �[��� <?php namespace App\Utilities; use App\Utilities\Session; class Auth { private static $instance; function __construct() { if (!empty(Session::get('user'))) { // $user = new \App\Models\User; // $response = $user->getUser(array(Session::get('uid'))); // foreach ($response as $key => $value) { foreach ($_SESSION['user'] as $key => $value) { $this->{$key} = $value; } } } public static function user() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } public static function check() { if (!empty(Session::get('user'))) { return true; } return false; } // public static function getPerm() // { // $roleId = Auth::user()->roleId; // $permissions_arr = array(); // if (!empty($roleId)) { // $permissions_json = \App\Models\Role::rolePermissions($roleId); // if (!empty($permissions_json)) { // $permissions_arr = json_decode($permissions_json, true); // } // } // if (!empty(Auth::user()->admin)) { // $permissions_arr = array_merge($permissions_arr, array('admin' => true)); // } // if (!empty(Auth::user()->vendor)) { // $permissions_arr = array_merge($permissions_arr, array('vendor' => true)); // } // return $permissions_arr; // } // public static function hasPermission($perm) // { // $permissions_arr = self::getPerm(); // if (!empty($permissions_arr['admin'])) { // return true; // } // if (is_array($perm)) { // foreach ($perm as $perm_row) { // if (empty($permissions_arr[$perm_row])) { // return false; // } // } // return true; // } else { // if (!empty($permissions_arr[$perm])) { // return true; // } // } // return false; // } // public static function hasAnyPermission($perm) // { // $permissions_arr = self::getPerm(); // if (!empty($permissions_arr['admin'])) { // return true; // } // if (is_array($perm)) { // foreach ($perm as $perm_row) { // if (!empty($permissions_arr[$perm_row])) { // return true; // } // } // return false; // } else { // if (!empty($permissions_arr[$perm])) { // return true; // } // } // return false; // } } PK �{�Z�H'� � Utilities/MobileFormatter.phpnu �[��� <?php namespace App\Utilities; class MobileFormatter { public static function format($data) { if (strlen($data) < 5) { return ""; } $final_data = ""; //if area code equal to 639xx it will change to 09xxxxxxxxx if (substr($data, 0, 2) === "09") { $final_data = "9" . substr($data, 2, strlen($data)); } else if (substr($data, 0, 3) === "639") { $final_data = "9" . substr($data, 3, strlen($data)); } else if (substr($data, 0, 1) === "9" && strlen($data) == 10) { $final_data = "9" . substr($data, 1, strlen($data)); } else { $final_data = $data; } //if number start with 09xxx, check the length, if length is not 11 return blank, if not 09xxx return it if (substr($final_data, 0, 1) === "9") { if (strlen($final_data) == 10) { return $final_data; } } return ''; } } PK �{�Zt�8> Utilities/Hash.phpnu �[��� <?php namespace App\Utilities; class Hash { public static function verify($password, $hash_password) { return password_verify($password, $hash_password); } public static function hash($password) { return password_hash($password, PASSWORD_DEFAULT); } } ?>PK �{�Z, Q:V V Utilities/Uuid.phpnu �[��� <?php namespace App\Utilities; use Ramsey\Uuid\Uuid as rUuid; // use App\Core\View; class Uuid { public static function long() { return rUuid::uuid4(); // $sql = "SELECT UUID()"; // $db_handle = new \App\Core\Database; // $result = $db_handle->selectBaseQuery($sql); // return $result; } public static function short() { return rUuid::uuid4(); // $sql = "SELECT UUID_SHORT()"; // $db_handle = new \App\Core\Database; // $result = $db_handle->selectBaseQuery($sql); // return $result; } } PK �{�Z.Zg�6 6 Utilities/Utility.phpnu �[��� <?php namespace App\Utilities; class Utility { public static function removeNotAlphaNumeric($data) { $str = preg_replace("/[^a-zA-Z0-9]+/", "", $data); return $str; } public static function toSqlDate($date) { return !empty($date) ? date('Y-m-d H:i:s', strtotime($date)) : NULL; } public static function toDateTimePicker($date) { return !empty($date) ? date('m/d/Y h:i A', strtotime($date)) : NULL; } public static function nullEmptyArray($array) { foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = self::nullEmptyArray($value); } if (empty($value) && !is_numeric($value)) { $array[$key] = NULL; } } return $array; } public static function base64_url_encode($input) { return strtr(base64_encode($input), '+/=', '-_-'); } public static function upperCaseNestedArray($value) { if (is_array($value)) { return array_map(array(new Utility(), 'upperCaseNestedArray'), $value); } return trim(mb_strtoupper($value)); } public static function maskString($str, $first = 3, $last = 2, $maskChar = '*') { if (!$str) { return ""; } $len = strlen($str); $toShow = $first + $last; return substr($str, 0, $len <= $toShow ? 0 : $first) . str_repeat($maskChar, $len - ($len <= $toShow ? 0 : $toShow)) . substr($str, $len - $last, $len <= $toShow ? 0 : $last); } public static function maskEmail($email, $maskChar = "*") { if (!$email) { return ""; } $mail_parts = explode("@", $email); $domain_parts = explode('.', $mail_parts[1]); $mail_parts[0] = self::maskString($mail_parts[0], 2, 1, $maskChar); // show first 2 letters and last 1 letter $mail_parts[1] = implode('.', $domain_parts); return implode("@", $mail_parts); } public static function includeFiles($directory) { if (is_dir($directory)) { $scan = scandir($directory); unset($scan[0], $scan[1]); //unset . and .. foreach ($scan as $file) { if (is_dir($directory . "/" . $file)) { self::includeFiles($directory . "/" . $file); } else { if (strpos($file, '.php') !== false) { include_once($directory . "/" . $file); } } } } } } PK �{�Z����L L Utilities/Session.phpnu �[��� <?php namespace App\Utilities; class Session { /** * Create session * * @param $name * @param $value * @return mixed */ public static function set($data) { if(!is_array($data)) { return $_SESSION[$data] = $data; } foreach($data as $row => $value) { $_SESSION[$row] = $value; } return; } /** * Get session * * @param $name * @return mixed */ public static function get($name) { if (isset($_SESSION[$name])) { return $_SESSION[$name]; } } /** * Check session * * @param $name * @return bool */ public static function exists($name) { return isset($_SESSION[$name]); } /** * Delete session * * @param $name */ public static function delete($name) { unset($_SESSION[$name]); } public static function destroy() { if (session_status() == PHP_SESSION_ACTIVE) { session_destroy(); } } } ?>PK �{�Z|Z��r r Utilities/Cookie.phpnu �[��� <?php namespace App\Utilities; /** * Cookie: * * @author Igor Veselov <dev@xfor.top> */ class Cookie { /** * Delete: * @access public * @param string $key * @return void */ public static function delete($key) { self::put($key, '', time() - 1); } /** * Exists: * @access public * @param string $key * @return boolean */ public static function exists($key): bool { return isset($_COOKIE[$key]); } /** * Get: Returns the value of a specific key of the COOKIE super-global * @access public * @param string $key * @return string */ public static function get($key): string { if(self::exists($key)){ return $_COOKIE[$key]; }else{ return ''; } } /** * Put: * @access public * @param string $key * @param string $value * @param integer $expiry * @return boolean */ public static function put($key, $value, $expiry): bool { return setcookie($key, $value, time() + $expiry, '/'); } }PK �{�Z�*l � � # Handlers/CustomExceptionHandler.phpnu �[��� <?php namespace App\Handlers; use Pecee\Http\Request; use Pecee\SimpleRouter\Exceptions\NotFoundHttpException; use Pecee\SimpleRouter\Handlers\IExceptionHandler; class CustomExceptionHandler implements IExceptionHandler { /** * @param Request $request * @param \Exception $error * @throws \Exception */ public function handleError(Request $request, \Exception $error): void { /* You can use the exception handler to format errors depending on the request and type. */ if ($request->getUrl()->contains('/api')) { response()->json([ 'error' => $error->getMessage(), 'code' => $error->getCode(), ]); } /* The router will throw the NotFoundHttpException on 404 */ if ($error instanceof NotFoundHttpException) { /* * Render your own custom 404-view, rewrite the request to another route, * or simply return the $request object to ignore the error and continue on rendering the route. * * The code below will make the router render our page.notfound route. */ // $request->setRewriteCallback('DefaultController@notFound'); $request->setRewriteCallback(function () { echo "404 Error not found."; }); return; } throw $error; } } PK �{�Z��� � Core/Database1.phpnu �[��� <?php namespace App\Core; class Database { private static $host = DB_HOST; private static $user = DB_USER; private static $password = DB_PASS; private static $database = DB_NAME; private static $conn; private static $instance; function __construct() { self::$conn = self::connectDB(); //Server Config self::$conn->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"); } public static function connect() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } public static function connectDB() { $conn = mysqli_connect(self::$host, self::$user, self::$password, self::$database); return $conn; } public static function runQuery($query, $param_type, $param_value_array) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } self::bindQueryParams($sql, $param_type, $param_value_array); $sql->execute(); $result = $sql->get_result(); $resultset = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; } } return $resultset; } public static function bindQueryParams($sql, $param_type, $param_value_array) { $param_value_reference[] = &$param_type; for ($i = 0; $i < count($param_value_array); $i++) { $param_value_reference[] = &$param_value_array[$i]; } call_user_func_array(array( $sql, 'bind_param' ), $param_value_reference); } public static function insert($query, $param_type, $param_value_array) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } self::bindQueryParams($sql, $param_type, $param_value_array); $sql->execute(); $insertId = $sql->insert_id; return $insertId; } public static function update($query, $param_type, $param_value_array) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } self::bindQueryParams($sql, $param_type, $param_value_array); $sql->execute(); return $sql->affected_rows; } public static function select($query, $param_type, $param_value_array) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } self::bindQueryParams($sql, $param_type, $param_value_array); $sql->execute(); $result = $sql->get_result(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; foreach ($resultset as $resultsetRow) { foreach ($resultsetRow as $resultsetRowRow) { return $resultsetRowRow; } } } } else { return ''; } } public static function runBaseQuery($query) { $result = self::$conn->query($query); if (self::$conn->error) { return self::$conn->error; } $resultset = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; } } return $resultset; } public static function selectBaseQuery($query) { $result = self::$conn->query($query); if (self::$conn->error) { return self::$conn->error; } if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; foreach ($resultset as $resultsetRow) { foreach ($resultsetRow as $resultsetRowRow) { return $resultsetRowRow; } } } } else { return ''; } } public static function insertBaseQuery($query) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } $sql->execute(); $insertId = $sql->insert_id; return $insertId; } public static function updateBaseQuery($query) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } $sql->execute(); return $sql->affected_rows; } } PK �{�Z��]�� � Core/Model.phpnu �[��� <?php namespace App\Core; class Model{ // public $db_handle; // function __construct() { // $this->db_handle = new \App\Core\Database; // } } ?>PK �{�Z2+~}h h Core/View.phpnu �[��� <?php namespace App\Core; class View{ public static function render($view, $args = []) { extract($args, EXTR_SKIP); $file = APP_ROOT.'/resources/views/' . $view . '.php'; if (is_readable($file)) { require_once $file; } else { throw new \Exception("$file not found"); } } } ?>PK �{�ZK�AͲ � Core/Database05-06-24.phpnu �[��� <?php namespace App\Core; class Database { private static $host = DB_HOST; private static $user = DB_USER; private static $password = DB_PASS; private static $database = DB_NAME; private static $conn; private static $instance; function __construct() { self::$conn = self::connectDB(); //Server Config self::$conn->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"); } public static function connect() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } public static function connectDB() { $conn = mysqli_connect(self::$host, self::$user, self::$password, self::$database); return $conn; } public static function bindQueryParams($sql, $param_type, $param_value_array) { $param_value_reference[] = &$param_type; for ($i = 0; $i < count($param_value_array); $i++) { $param_value_reference[] = &$param_value_array[$i]; } call_user_func_array(array( $sql, 'bind_param' ), $param_value_reference); } public static function runQuery($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); $result = $sql->get_result(); $resultset = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; } } return $resultset; } catch (\Exception $e) { return $e->getMessage(); } } public static function selectQuery($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); $result = $sql->get_result(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { return $row; } } return []; } catch (\Exception $e) { return $e->getMessage(); } } public static function insert($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); return $sql->insert_id; } catch (\Exception $e) { return $e->getMessage(); } } public static function update($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); return $sql->affected_rows; } catch (\Exception $e) { return $e->getMessage(); } } public static function select($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); $result = $sql->get_result(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; foreach ($resultset as $resultsetRow) { foreach ($resultsetRow as $resultsetRowRow) { return $resultsetRowRow; } } } } return ''; } catch (\Exception $e) { return $e->getMessage(); } } public static function runBaseQuery($query) { $result = self::$conn->query($query); if (self::$conn->error) { return self::$conn->error; } $resultset = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; } } return $resultset; } public static function selectBaseQuery($query) { $result = self::$conn->query($query); if (self::$conn->error) { return self::$conn->error; } if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; foreach ($resultset as $resultsetRow) { foreach ($resultsetRow as $resultsetRowRow) { return $resultsetRowRow; } } } } else { return ''; } } public static function insertBaseQuery($query) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } $sql->execute(); $insertId = $sql->insert_id; return $insertId; } public static function updateBaseQuery($query) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } $sql->execute(); return $sql->affected_rows; } //modify public static function return_result($query) { $result = self::connectDB()->query($query); $output = array(); while ($row = $result->fetch_assoc()) { array_push($output, $row); } return $output; } public static function select2($query) { $result = self::connectDB()->query($query); if ($result === false) { return false; } $row = $this->index_arr_values($result->fetch_assoc()); if (empty($row)) { return ""; } return $row[0]; } public function index_arr_values($value) { if (empty($value)) { return array(); } return array_values($value); } } PK �{�Z3��� � Core/Database.phpnu �[��� <?php namespace App\Core; class Database { private static $host = DB_HOST; private static $user = DB_USER; private static $password = DB_PASS; private static $database = DB_NAME; private static $conn; private static $instance; function __construct() { self::$conn = self::connectDB(); //Server Config self::$conn->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"); } public static function connect() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } public static function connectDB() { $conn = mysqli_connect(self::$host, self::$user, self::$password, self::$database); return $conn; } public static function bindQueryParams($sql, $param_type, $param_value_array) { $param_value_reference[] = &$param_type; for ($i = 0; $i < count($param_value_array); $i++) { $param_value_reference[] = &$param_value_array[$i]; } call_user_func_array(array( $sql, 'bind_param' ), $param_value_reference); } public static function runQuery($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); $result = $sql->get_result(); $resultset = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; } } return $resultset; } catch (\Exception $e) { return $e->getMessage(); } } public static function selectQuery($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); $result = $sql->get_result(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { return $row; } } return []; } catch (\Exception $e) { return $e->getMessage(); } } public static function insert($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); return $sql->insert_id; } catch (\Exception $e) { return $e->getMessage(); } } public static function update($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); return $sql->affected_rows; } catch (\Exception $e) { return $e->getMessage(); } } public static function select($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); $result = $sql->get_result(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; foreach ($resultset as $resultsetRow) { foreach ($resultsetRow as $resultsetRowRow) { return $resultsetRowRow; } } } } return ''; } catch (\Exception $e) { return $e->getMessage(); } } public static function runBaseQuery($query) { $result = self::$conn->query($query); if (self::$conn->error) { return self::$conn->error; } $resultset = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; } } return $resultset; } public static function selectBaseQuery($query) { $result = self::$conn->query($query); if (self::$conn->error) { return self::$conn->error; } if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; foreach ($resultset as $resultsetRow) { foreach ($resultsetRow as $resultsetRowRow) { return $resultsetRowRow; } } } } else { return ''; } } public static function insertBaseQuery($query) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } $sql->execute(); $insertId = $sql->insert_id; return $insertId; } public static function updateBaseQuery($query) { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } $sql->execute(); return $sql->affected_rows; } public static function checkQuery($query) { return $query; // $sql = self::$conn->prepare($query); // if (self::$conn->error) { // return self::$conn->error; // } // $sql->execute(); // return $sql->affected_rows; } //modify public static function return_result($query) { $result = self::connectDB()->query($query); $output = array(); while ($row = $result->fetch_assoc()) { array_push($output, $row); } return $output; } public static function select2($query) { $result = self::connectDB()->query($query); if ($result === false) { return false; } $row = $this->index_arr_values($result->fetch_assoc()); if (empty($row)) { return ""; } return $row[0]; } public function index_arr_values($value) { if (empty($value)) { return array(); } return array_values($value); } } PK �{�Zn�n� � Core/Mail.phpnu �[��� <?php namespace App\Core; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; class Mail extends PHPMailer{ public static function sendEmail($args){ $mail_sent = 0; //validation if(empty($args['to_email']) || empty($args['subject']) || (empty($args['html_body']) && empty($args['email_body']))){ return "Email, Subject and Message are required."; } $to_email = $args['to_email']; $to_name = empty($args['to_name']) ? '' : $args['to_name'] ; $subject = $args['subject']; $html_body = empty($args['html_body']) ? '' : $args['html_body'] ; $email_body = empty($args['email_body']) ? '' : $args['email_body'] ; try{ $mail = new PHPMailer; $mail->SMTPDebug = SMTP::DEBUG_OFF; $mail->isSMTP(); //Send using SMTP $mail->Host = MAIL_HOST; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = MAIL_USERNAME; //SMTP username $mail->Password = MAIL_PASSWORD; //SMTP password $mail->SMTPSecure = MAIL_ENCRYPTION; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged $mail->Port = MAIL_PORT; $mail->setFrom(MAIL_FROM_ADDRESS, MAIL_FROM_NAME); $mail->addAddress($to_email,$to_name); // $mail->addReplyTo('info@example.com', 'Information'); // $mail->addCC('cc@example.com'); // $mail->addBCC('bcc@example.com'); //Attachments // $mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name $mail->Subject = $subject; if(!empty($html_body)) { $mail->isHTML(true); $mail->AltBody = $email_body; $mail->Body = $html_body; } else{ $mail->Body = $email_body; } // added Gmail hack $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); if($mail->send()) $mail_sent = 1; } catch (Exception $e) { return "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } return $mail_sent; } } ?>PK �{�Zp���5 5 Core/Controller.phpnu �[��� <?php namespace App\Core; class Controller{ } ?>PK �{�Z� � Core/Database2.phpnu �[��� <?php namespace App\Core; class Database { private static $host; private static $user; private static $password; private static $database; private static $conn; private static $instance; function __construct() { self::$host = env('DB_HOST'); self::$user = env('DB_USERNAME'); self::$password = env('DB_PASSWORD'); self::$database = env('DB_DATABASE'); self::$conn = self::connectDB(); //Server Config self::$conn->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"); // ini_set('memory_limit', '-1'); } public static function connect() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } public static function connectDB() { $conn = mysqli_connect(self::$host, self::$user, self::$password, self::$database); return $conn; } public static function bindQueryParams($sql, $param_type, $param_value_array) { $param_value_reference[] = &$param_type; for ($i = 0; $i < count($param_value_array); $i++) { $param_value_reference[] = &$param_value_array[$i]; } call_user_func_array(array( $sql, 'bind_param' ), $param_value_reference); } public static function runQuery($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); $result = $sql->get_result(); $resultset = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; } } return $resultset; } catch (\Exception $e) { return $e->getMessage(); } } public static function selectQuery($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); $result = $sql->get_result(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { return $row; } } return []; } catch (\Exception $e) { return $e->getMessage(); } } public static function insert($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); return $sql->insert_id; } catch (\Exception $e) { return $e->getMessage(); } } public static function update($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); return $sql->affected_rows; } catch (\Exception $e) { return $e->getMessage(); } } public static function select($query, $param_type = "", $param_value_array = []) { try { $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } if (!empty($param_value_array)) { self::bindQueryParams($sql, $param_type, $param_value_array); } $sql->execute(); $result = $sql->get_result(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; foreach ($resultset as $resultsetRow) { foreach ($resultsetRow as $resultsetRowRow) { return $resultsetRowRow; } } } } return ''; } catch (\Exception $e) { return $e->getMessage(); } } public static function runBaseQuery($query) { /** * deprecated do not use */ $result = self::$conn->query($query); if (self::$conn->error) { return self::$conn->error; } $resultset = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; } } return $resultset; } public static function selectBaseQuery($query) { /** * deprecated do not use */ $result = self::$conn->query($query); if (self::$conn->error) { return self::$conn->error; } if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $resultset[] = $row; foreach ($resultset as $resultsetRow) { foreach ($resultsetRow as $resultsetRowRow) { return $resultsetRowRow; } } } } else { return ''; } } public static function insertBaseQuery($query) { /** * deprecated do not use */ $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } $sql->execute(); if ($sql->errno) { return $sql->error; } $insertId = $sql->insert_id; return $insertId; } public static function updateBaseQuery($query) { /** * deprecated do not use */ $sql = self::$conn->prepare($query); if (self::$conn->error) { return self::$conn->error; } $sql->execute(); if ($sql->errno) { return $sql->error; } return $sql->affected_rows; } } PK �{�Z7�< < Core/Sms.phpnu �[��� <?php namespace App\Core; class Sms { public function SmsactiveProvider() { $query = "SELECT * FROM sms_provider WHERE 1 AND status = ?"; $queryType = "i"; $queryValue = array( 1 ); $activeProvider= Database::connect()->runQuery($query, $queryType, $queryValue); $smsProvider=[]; if(count($activeProvider)==1) { foreach($activeProvider as $provider) { $smsProvider = $provider; } unset($provider); } return $smsProvider; } // public static function sendSMS($args) // { // if (empty($args['mobile']) && empty($args['message'])) { // return "Mobile and Message are required."; // } // //clean message // // $args['message'] = strtr($args['message'], array("\n" => "\\n", "\r" => "\\r")); // $args['message'] = preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities($args['message'])); // $args['message'] = strtr($args['message'], array("\n" => "\\n")); // $args['message'] = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $args['message']); // //convert enye to normal text to fix problewm from sms provider // $replace_parameter = array( // '[no]' => $args['mobile'], // '[msg]' => $args['message'], // '[key]' => SMS_KEY, // '[pwd]' => SMS_PASSWORD, // ); // $final_template = strtr(SMS_BODY, $replace_parameter); // // if ($args['mobile'] == '+639771424322') { // // print_r($final_template); // // exit; // // } // $ch = curl_init(); // curl_setopt($ch, CURLOPT_URL, SMS_URI); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // curl_setopt($ch, CURLOPT_POST, 1); // // curl_setopt($ch, CURLOPT_POSTFIELDS, json_decode($final_template, true)); // curl_setopt($ch, CURLOPT_POSTFIELDS, $final_template); // if (count(SMS_HEADER) > 0) { // curl_setopt($ch, CURLOPT_HTTPHEADER, SMS_HEADER); // } // $result = curl_exec($ch); // // return $result; // $response = json_decode($result, true); // // return $response; // return $response['status'] == 201 ? 0 : $result; // } public static function sendSMS($args) { $sms = new Sms(); $smsProvider = $sms->SmsactiveProvider(); if (empty($args['mobile']) && empty($args['message'])) { return "Mobile and Message are required."; } //clean message // $args['message'] = strtr($args['message'], array("\n" => "\\n", "\r" => "\\r")); $args['message'] = preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities($args['message'])); $args['message'] = strtr($args['message'], array("\n" => "\\n")); $args['message'] = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $args['message']); if($smsProvider['code'] =='philsms') { $replace_parameter = array( '[no]' => $args['mobile'], '[msg]' => $args['message'], '[key]' => SMS_KEY, '[pwd]' => SMS_PASSWORD, ); $final_template = strtr(SMS_BODY, $replace_parameter); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, SMS_URI); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); // curl_setopt($ch, CURLOPT_POSTFIELDS, json_decode($final_template, true)); curl_setopt($ch, CURLOPT_POSTFIELDS, $final_template); if (count(SMS_HEADER) > 0) { curl_setopt($ch, CURLOPT_HTTPHEADER, SMS_HEADER); } // $result = curl_exec($ch); // return $result; } //convert enye to normal text to fix problewm from sms provider if($smsProvider['code'] =='itexmo') { $ch = curl_init(); $itexmo_arr = array( 'Email' => 'aendaya@autohubgroup.com', 'Password' => 'JRE@jre0911', 'ApiCode' => 'PR-AUTOH172111_IE74I', 'SenderId'=> 'AUTOHUB GRP', 'Recipients' => [$args['mobile']], 'Message' =>$args['message']//$message ); curl_setopt($ch, CURLOPT_URL,$smsProvider['uri']); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($itexmo_arr)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); } $result = curl_exec($ch); curl_close ($ch); $response = json_decode($result, true); return $response['status'] == 201 ? 0 : $result; } } PK �{�Z�fQ� � config.phpnu �[��� <?php //Site define('SITE_NAME', 'AutoHub Connect'); define('SITE_LOGO', '/public/storage/app/image/AGC.png'); define('SITE_FAVICON', '/public/storage/app/image/AGC.png'); define('SITE_URL', 'http://' . $_SERVER['HTTP_HOST']); define('SITE_EMAIL', 'contact@autopartshub.com'); define('SITE_PHONE', '+63 2 8860-8888'); define('SITE_LOCATION', 'Blk 15 Rizal Drive, Crescent Park West, Taguig.'); //Api define('API_URL', SITE_URL . '/api'); //App define('APP_ROOT', dirname(dirname(__FILE__))); define('APP_DEV', 'AutoHub Devs'); define('APP_VERSION', '1.0.0'); define('APP_ASSETS_URL', '/'); define('APP_DISK', 'public/storage/'); //Images define('BRAND_DEFAULT_LOGO', '/assets/img/logo/brands/default_logo.png'); define('USER_DEFAULT_LOGO', '/storage/users/default.png'); //Url define('URL_ROOT', ''); define('URL_SUBFOLDER', ''); //DB Params define('DB_HOST', '127.0.0.1'); define('DB_USER', 'autoph_db'); define('DB_PASS', '@4u70hu36r0up007#'); define('DB_NAME', 'autoph_db'); //Mailer define('MAIL_MAILER', 'smtp'); define('MAIL_HOST', 'smtp.mailtrap.io'); define('MAIL_PORT', '587'); define('MAIL_USERNAME', 'c7d299fcce9c40'); define('MAIL_PASSWORD', 'ff0f928a82987e'); define('MAIL_ENCRYPTION', 'TLS'); define('MAIL_FROM_ADDRESS', SITE_EMAIL); define('MAIL_FROM_NAME', SITE_NAME); //SMS define('SMS_DRIVER', 'PhilSMS'); define('SMS_URI', 'https://api.philsms.com/outbound/v1'); define('SMS_BODY', '{"apiKey": "[key]","apiPass": "[pwd]","mask": "AUTOHUB GRP","content": "[msg]","msisdn": " [no]"}'); define('SMS_KEY', 'aenda-5XRDT'); define('SMS_PASSWORD', '3[#kQ.Rx~E'); define('SMS_HEADER', ["Content-Type: application/json"]); define('SMS_SUCCESS', '0'); // Application debug mode define('debug', true); PK �{�Zs�*u ! Controllers/CompanyController.phpnu �[��� <?php namespace App\Controllers; use App\Core\Controller; use App\Core\Sms; use App\Utilities\Session; use App\Utilities\Uuid; use App\Utilities\Utility; class CompanyController extends Controller { private $company; function __construct() { $this->company = new \App\Models\Company; } public function userCompanies() { $ids = implode(",", Session::get('company_permissions')); $response = $this->company->getUserAccessCompany($ids); response()->json($response); } } PK �{�Z�7�k(� (� Controllers/LtoController.phpnu �[��� <?php namespace App\Controllers; use App\Core\Controller; use App\Core\Sms; use App\Utilities\Session; use App\Utilities\Uuid; use App\Utilities\Utility; class LtoController extends Controller { private $lto; function __construct() { $this->lto = new \App\Models\Lto; } public function ltoIndex() { response()->redirect(url('lto.orcr.plate')); } public function OrcrPlateIndex() { // if (!(isset($global_action_permissions['7']['33']) && // in_array("1", $global_action_permissions['7']['33']))) { // header('location:signin.php'); // } // print_r(Session::get('action_permissions')); if (!in_array("1", Session::get('action_permissions')['10'])) { response()->redirect("/index.php"); } $page_title = "OR/CR & Plate Update"; include('resources/views/lto/orcr_plate_update/list.php'); } public function orcrPlateList() { $array_data['search_keyword'] = Utility::removeNotAlphaNumeric(input('search')); // $array_data['search_keyword_name'] = input('search'); $array_data['search_type'] = input('search_type'); $array_data['search_type'] = json_decode($array_data['search_type'], true)[0]; $array_data['offset'] = input('offset'); $array_data['limit'] = input('limit'); $array_data['sort'] = input('sort'); $array_data['user_id'] = Session::get('user')['id']; switch ($array_data['sort']) { case "date": $array_data['sort'] = " ORDER BY vops.date_added " . input('order'); break; case "date_received": $array_data['sort'] = " ORDER BY vops.date_received " . input('order'); break; case "type": $array_data['sort'] = " ORDER BY vops.type " . input('order'); break; case "status": $array_data['sort'] = " ORDER BY vops.sms_response " . input('order') . " ,vops.sms_date " . input('order') . ""; break; default: $array_data['sort'] = " ORDER BY vops.date_added DESC"; } // start search using keywords switch ($array_data['search_type']) { case "Customer": $array_data['search'] = " AND CONCAT(c.first_name,' ',c.last_name,' ',c.corporation_name) LIKE ? "; $array_data['search_keyword'] = "%" . input('search') . "%"; break; case "Conduction Sticker": $array_data['search'] = " AND v.conduction_sticker = ? "; break; case "Plate Number": $array_data['search'] = " AND v.plate_number = ? "; break; case "MV File": $array_data['search'] = " AND v.mv_file = ? "; break; case "Engine Number": $array_data['search'] = " AND v.engine_number = ? "; break; case "Chassis Number": $array_data['search'] = " AND v.chassis_number = ? "; break; } if (empty($array_data['search_keyword'])) { $array_data['search_keyword'] = "1"; $array_data['search'] = " AND ? "; } //end search using keywords // start date filter if (empty(input('start_date_add'))) { $array_data['date_added'] = ""; } else { $array_data['date_added'] = " AND DATE_FORMAT(vops.date_added,'%Y-%m-%d') BETWEEN '" . input('start_date_add') . "' AND '" . input('end_date_add') . "' "; } if (empty(input('start_date_receive'))) { $array_data['date_received'] = ""; } else { $array_data['date_received'] = " AND DATE_FORMAT(vops.date_received,'%Y-%m-%d') BETWEEN '" . input('start_date_receive') . "' AND '" . input('end_date_receive') . "' "; } //sms status filter switch (input('sms_status')) { case "Sent": $array_data['sms_status'] = " AND (vops.sms_date IS NOT NULL AND vops.sms_response IS NOT NULL)"; break; case "Pending": $array_data['sms_status'] = " AND (vops.sms_date IS NULL AND vops.sms_response IS NULL)"; break; case "Error": $array_data['sms_status'] = " AND (vops.sms_date IS NULL AND vops.sms_response IS NOT NULL)"; break; default: $array_data['sms_status'] = ""; } $array_data['company_access'] = input('company_id') ? input('company_id') : implode(",", Session::get('company_permissions')); $array_data['dealer_access'] = input('dealer_id'); $result = $this->lto->getOrcrPlateList($array_data); $response['rows'] = array(); $response['total'] = $this->lto->getOrcrPlateListCount($array_data); foreach ($result as $row) { if ($row['sms_date'] && $row['sms_response'] != NULL) { $status = '<span class="right text-sm badge font-weight-normal badge-success">SMS Sent</span>'; } else if (!$row['sms_date'] && $row['sms_response'] != NULL) { // $status = '<span class="right text-sm badge font-weight-normal badge-danger">Error: ' . $row['sms_response'] . '</span>'; $smsResponse = json_decode($row['sms_response'], true); if(!$smsResponse['Error'] && $smsResponse['Failed'] == 0 && $smsResponse['Accepted']==1 ) { $status = '<span class="right text-sm badge font-weight-normal badge-success">SMS Sent</span>'; } else { $status = '<span class="right text-sm badge font-weight-normal badge-danger">Error: ' . $row['sms_response'] . '</span> '; } } else if (!$row['sms_date'] && $row['sms_response'] == NULL) { $status = '<span class="right text-sm badge font-weight-normal badge-warning">Pending</span>'; } if ($row['vops_type'] == "orcr_plate") { $type = "ORCR & Plate"; } else if ($row['vops_type'] == "orcr") { $type = "ORCR"; } else if ($row['vops_type'] == "plate") { $type = "Plate"; } if ($row['pickup_date']) { $pickupdate = date('F d, Y', strtotime($row['pickup_date'])); } else { $pickupdate = '<span data-action-pickup class=" right text-sm badge font-weight-normal badge-primary">Pick up</span>'; } $response['rows'] = array_merge( $response['rows'], array(array( 'vops_id' => $row['vops_id'], 'date' => date('F d, Y', strtotime($row['date_added'])), 'customer' => $row['type'] == "1" ? $row['first_name'] . ' ' . $row['last_name'] : $row['corporation_name'], // 'released_date' => '', 'vehicle' => $row['model_variant'], 'conduction_sticker' => $row['conduction_sticker'], 'plate' => $row['plate_number'], 'mv_file' => $row['mv_file'], 'engine_number' => $row['engine_number'], 'chassis_number' => $row['chassis_number'], 'type' => $type, 'date_received' => date('F d, Y', strtotime($row['date_received'])), 'status' => $status, 'pickup_date' => $pickupdate, 'notes' => $row['notes'], 'company_dealer' => $row['company_code'] . ' - ' . $row['dealer_code'], )) ); } response()->json($response); } public function resendAll() { $not_sent = 0; $sent = 0; $sms_model = new \App\Models\Sms; $sms_module_id = 1; //orcr_plate if ($sms_model->getSmsModuleStatus($sms_module_id)) { $response = $this->lto->getAllError(); foreach ($response as $row) { $lto_dealer_contact = $this->lto->getLtoDealerContacts($row['dealer_id']); if (count($lto_dealer_contact) <= 0) { $not_sent++; continue; } if (empty($lto_dealer_contact[0]['contact_person']) || empty($lto_dealer_contact[0]['contact_phone'])) { $not_sent++; continue; } $vehicle = new \App\Models\Vehicle; $vehicle_data = $vehicle->getVehicleDataByCS($row['conduction_sticker']); //get message template if ($row['type'] == "orcr_plate") { $sms_data['message'] = $sms_model->getSmsTemplate(3); } else if ($row['type'] == "orcr") { $sms_data['message'] = $sms_model->getSmsTemplate(1); } else if ($row['type'] == "plate") { $sms_data['message'] = $sms_model->getSmsTemplate(2); } $replace_parameter = array( '[plate]' => $vehicle_data[0]['plate_number'], '[cs]' => $vehicle_data[0]['conduction_sticker'], '[brand]' => $vehicle_data[0]['brand'], '[model]' => $vehicle_data[0]['model'], '[variant]' => $vehicle_data[0]['model_variant'], '[company]' => $vehicle_data[0]['company'], '[dealer]' => $vehicle_data[0]['dealer'], '[contact_person]' => $lto_dealer_contact[0]['contact_person'], '[contact_email]' => $lto_dealer_contact[0]['contact_email'], '[contact_phone]' => $lto_dealer_contact[0]['contact_phone'], ); $sms_data['message'] = strtr($sms_data['message'], $replace_parameter); $sms_data['mobile'] = $vehicle_data[0]['mobile_phone_1']; $array_data['record_id'] = $row["id"]; //send sms to customer $excluded_year_below = 2021; if (date('Y', strtotime($row['date_received'])) <= $excluded_year_below) { $array_data['sms_date'] = date("Y-m-d h:i:s"); $array_data['sms_response'] = $excluded_year_below; $not_sent++; } else { $sms_response = Sms::sendSms($sms_data); $array_data['sms_date'] = $sms_response == SMS_SUCCESS ? date("Y-m-d h:i:s") : NULL; $array_data['sms_response'] = $sms_response; if ($sms_response == SMS_SUCCESS) { $sent++; } else { $not_sent++; } } $this->lto->updateOrcrPlateSms($array_data); } } else { response()->json(array("status" => 0, "message" => "SMS API Disabled")); } response()->json(array("sent" => $sent, "not_sent" => $not_sent, "status" => 1, "message" => "Sent")); } public function orcrPlateCreate() { // echo (input('chk_send_sms')); // exit; // print_r(input()); $is_orcr = input('chk_orcr'); $is_plate = input('chk_plate'); $is_add_anyway = input('add_anyway'); $cs = strtoupper(input('txt_cs')); $plate = strtoupper(input('txt_plate')); $or = strtoupper(input('txt_or')); $cr = strtoupper(input('txt_cr')); $mv = strtoupper(input('txt_mv')); $date_received = strtoupper(input('txt_received_date')); $engine_no = strtoupper(input('txt_en')); $chassis_no = strtoupper(input('txt_cn')); $notes = strtoupper(input('txt_notes')); $vehicle = new \App\Models\Vehicle; //check if cs is exist $vehicle_data = $vehicle->getVehicleDataByCS($cs); if (count($vehicle_data) <= 0) { $response['message'] = "Conduction sticker is not exist."; $response['status'] = 0; response()->json($response); } //VALIDATE LTO CONTACT PERSON $lto_dealer_contact = $this->lto->getLtoDealerContacts($vehicle_data[0]['dealer_id']); if (count($lto_dealer_contact) <= 0) { $response['message'] = "No LTO dealer contact information. contact system admin."; $response['status'] = 0; response()->json($response); } if (empty($lto_dealer_contact[0]['contact_person']) || empty($lto_dealer_contact[0]['contact_phone'])) { $response['message'] = "Incomplete LTO dealer contact information. contact system admin."; $response['status'] = 0; response()->json($response); } $array_data['vehicle_id'] = $vehicle_data[0]['id']; $array_data['user_id'] = Session::get('user')['id']; $array_data['plate'] = Utility::removeNotAlphaNumeric($plate); $array_data['or'] = Utility::removeNotAlphaNumeric($or); $array_data['cr'] = Utility::removeNotAlphaNumeric($cr); $array_data['mv'] = Utility::removeNotAlphaNumeric($mv); $array_data['engine_no'] = Utility::removeNotAlphaNumeric($engine_no); $array_data['chassis_no'] = Utility::removeNotAlphaNumeric($chassis_no); $array_data['notes'] = $notes; $array_data['date_received'] = date("Y-m-d", strtotime($date_received)); $array_data['status'] = "1"; if ($is_orcr && $is_plate) { $array_data['type'] = "orcr_plate"; } else if ($is_orcr) { $array_data['type'] = "orcr"; } else if ($is_plate) { $array_data['type'] = "plate"; } //check if data recently added if (!input('record_id')) { if ($is_add_anyway == '0') { $existing_data = $this->lto->checkorcrPlateExisting($array_data); if (count($existing_data) > 0) { $response['status'] = 2; response()->json($response); } } } //update vehicle or cr plate if ($plate) { //check plate exist in other vehicle $vehicle->updateVehiclePlate($array_data); } if ($or) { $vehicle->updateVehicleOr($array_data); } if ($cr) { $vehicle->updateVehicleCr($array_data); } if ($mv) { $vehicle->updateVehicleMv($array_data); } if ($engine_no) { $vehicle->updateVehicleEngineNo($array_data); } if ($chassis_no) { $vehicle->updateVehicleChassisNo($array_data); } if (!input('record_id') || input('chk_send_sms')) { $sms_model = new \App\Models\Sms; //get message template if ($array_data['type'] == "orcr_plate") { $sms_data['message'] = $sms_model->getSmsTemplate(3); } else if ($array_data['type'] == "orcr") { $sms_data['message'] = $sms_model->getSmsTemplate(1); } else if ($array_data['type'] == "plate") { $sms_data['message'] = $sms_model->getSmsTemplate(2); } $replace_parameter = array( '[plate]' => $vehicle_data[0]['plate_number'], '[cs]' => $vehicle_data[0]['conduction_sticker'], '[brand]' => $vehicle_data[0]['brand'], '[model]' => $vehicle_data[0]['model'], '[variant]' => $vehicle_data[0]['model_variant'], '[company]' => $vehicle_data[0]['company'], '[dealer]' => $vehicle_data[0]['dealer'], '[contact_person]' => $lto_dealer_contact[0]['contact_person'], '[contact_email]' => $lto_dealer_contact[0]['contact_email'], '[contact_phone]' => $lto_dealer_contact[0]['contact_phone'], ); $sms_data['message'] = strtr($sms_data['message'], $replace_parameter); $sms_data['mobile'] = $vehicle_data[0]['mobile_phone_1']; // if ($sms_data['mobile'] == '+639399064816') { // $sms_data['mobile'] = "+639176331398"; //debug // } //check if sms module is enabled $sms_module_id = 1; //orcr_plate if ($sms_model->getSmsModuleStatus($sms_module_id)) { //send sms to customer $excluded_year_below = 2021; if (!input('record_id') && date('Y', strtotime($date_received)) <= $excluded_year_below) { $array_data['sms_date'] = date("Y-m-d h:i:s"); $array_data['sms_response'] = $excluded_year_below; } else { $sms_response = Sms::sendSms($sms_data); if (empty($sms_response)) { $sms_response = SMS_SUCCESS; } $array_data['sms_date'] = $sms_response == SMS_SUCCESS ? date("Y-m-d h:i:s") : NULL; $array_data['sms_response'] = $sms_response; } } else { $array_data['sms_date'] = NULL; $array_data['sms_response'] = NULL; } } //update data to database if (input('record_id')) { $array_data['record_id'] = input('record_id'); if (input('chk_send_sms')) { $this->lto->updateOrcrPlateSms($array_data); } $this->lto->updateOrcrPlate($array_data); } else { $this->lto->createOrcrPlateWithSMS($array_data); } //insert data to database $response['message'] = "Data successfully created."; $response['status'] = 1; response()->json($response); } public function orcrPlatePickup() { // echo (input('chk_send_sms')); // exit; // print_r(input()); $this->lto->updateOrcrPlatePickup(array(input('id'))); $response['message'] = "Data successfully saved."; $response['status'] = 1; response()->json($response); } function orcrImportFields() { $import = new \App\Models\Import; $result = $import->getImportFields(2); $response = array(); foreach ($result as $row) { $response[$row['id']] = $row; } response()->json($response); } public function orcrImport() { $disk_dir = APP_DISK . input('dir'); if (!file_exists($disk_dir)) { mkdir($disk_dir, 0777, true); } $log_dir = APP_DISK . input('log_dir'); if (!file_exists($log_dir)) { mkdir($log_dir, 0777, true); } $import = new \App\Models\Import; $import_fields = json_decode(input('import_fields'), true); foreach ($import_fields as $key => $value) { $import->updateImportFields(array( 'key' => $key, 'value' => $value, )); } // $destinationFilname = sprintf('%s.%s', uniqid(), $image->getExtension()); // $image->move(sprintf('/uploads/%s', $destinationFilename)); $object = input()->file('file', $defaultValue = null); if ($object->getSize() <= 0) { $response['message'] = "File is empty"; $response['status'] = 0; response()->json($response); } else { //check extension $valid_ext = array('xls', 'csv', 'xlsx'); if (!in_array($object->getExtension(), $valid_ext)) { $response['message'] = "Invalid file extension"; $response['status'] = 0; response()->json($response); } //gen filename $destinationFilename = sprintf('%s.%s', Uuid::long(), $object->getExtension()); //move file $full_dir = $disk_dir . '/' . $destinationFilename; $object->move($full_dir); // start import process $GLOBALS['total_data_count'] = 0; $GLOBALS['not_inserted_data_count'] = 0; $GLOBALS['inserted_data_count'] = 0; $GLOBALS['not_inserted_list_v2'] = array(); $GLOBALS['data_count_list_v2'] = array(); $file_type = \PhpOffice\PhpSpreadsheet\IOFactory::identify($full_dir); $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($file_type); try { $spreadsheet = $reader->load($full_dir); //remove excel after store to phpspreadsheet unlink($full_dir); $data = $spreadsheet->getActiveSheet()->toArray(); $highestRow = $spreadsheet->getActiveSheet()->getHighestRow(); $highestColumn = $spreadsheet->getActiveSheet()->getHighestColumn(); $ColumnNumber = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($highestColumn); $data = array_map(array(new Utility(), 'upperCaseNestedArray'), $data); $header_column_found = false; foreach ($data as $row) { if (!empty(array_filter($row))) { // echo 'Not empty row'; } else { continue; } $row = array_filter($row); if (!$header_column_found) { // get matched field from database and excel globals $issue_summary_index = $import->getSummaryIndex('SUMMARY', $ColumnNumber, $row); $GLOBALS['conduction_sticker'] = $import->getFieldName($row, $ColumnNumber, array($import_fields[11])); $GLOBALS['plate_number'] = $import->getFieldName($row, $ColumnNumber, array($import_fields[12])); $GLOBALS['mv_file'] = $import->getFieldName($row, $ColumnNumber, array($import_fields[13])); $GLOBALS['date'] = $import->getFieldName($row, $ColumnNumber, array($import_fields[14])); $GLOBALS['notes'] = $import->getFieldName($row, $ColumnNumber, array($import_fields[15])); $GLOBALS['engine_number'] = $import->getFieldName($row, $ColumnNumber, array($import_fields[16])); $GLOBALS['chassis_number'] = $import->getFieldName($row, $ColumnNumber, array($import_fields[17])); // check required fields if ( !empty($GLOBALS['conduction_sticker']) && !empty($GLOBALS['plate_number']) && !empty($GLOBALS['mv_file']) && !empty($GLOBALS['date']) && !empty($GLOBALS['notes']) && !empty($GLOBALS['engine_number']) && !empty($GLOBALS['chassis_number']) ) { $header_column_found = true; $GLOBALS['row_headers'] = $row; continue; } } else { $GLOBALS['total_data_count']++; $data_conduction_sticker = $import->checkExist($row, $GLOBALS['conduction_sticker'], $GLOBALS['row_headers']); $data_plate_number = $import->checkExist($row, $GLOBALS['plate_number'], $GLOBALS['row_headers']); $data_plate_number = Utility::removeNotAlphaNumeric($data_plate_number); $data_mv_file = $import->checkExist($row, $GLOBALS['mv_file'], $GLOBALS['row_headers']); $data_mv_file = Utility::removeNotAlphaNumeric($data_mv_file); $data_date = $import->checkExist($row, $GLOBALS['date'], $GLOBALS['row_headers']); $data_date = date('Y-m-d', strtotime($data_date)); $data_notes = $import->checkExist($row, $GLOBALS['notes'], $GLOBALS['row_headers']); $data_engine_number = $import->checkExist($row, $GLOBALS['engine_number'], $GLOBALS['row_headers']); $data_engine_number = Utility::removeNotAlphaNumeric($data_engine_number); $data_chassis_number = $import->checkExist($row, $GLOBALS['chassis_number'], $GLOBALS['row_headers']); $data_chassis_number = Utility::removeNotAlphaNumeric($data_chassis_number); //Validations if (empty($data_conduction_sticker)) { $GLOBALS['not_inserted_list_v2'][] = array_merge(array("NO CONDUCTION STICKER"), $row); $GLOBALS['not_inserted_data_count']++; continue; } if ($data_date == "1970-01-01") { $GLOBALS['not_inserted_list_v2'][] = array_merge(array("NO DATE"), $row); $GLOBALS['not_inserted_data_count']++; continue; } if (strtotime($data_date) > strtotime(date('Y-m-d'))) { $GLOBALS['not_inserted_list_v2'][] = array_merge(array("INVALID DATE"), $row); $GLOBALS['not_inserted_data_count']++; continue; } if ($data_date == "1970-01-01") { $GLOBALS['not_inserted_list_v2'][] = array_merge(array("NO DATE"), $row); $GLOBALS['not_inserted_data_count']++; continue; } $vehicle = new \App\Models\Vehicle; $vehicle_data = $vehicle->getVehicleDataByCS($data_conduction_sticker); if (count($vehicle_data) <= 0) { $GLOBALS['not_inserted_list_v2'][] = array_merge(array("VEHICLE DATA NOT EXIST IN SYSTEM"), $row); $GLOBALS['not_inserted_data_count']++; continue; } $lto_dealer_contact = $this->lto->getLtoDealerContacts($vehicle_data[0]['dealer_id']); if (count($lto_dealer_contact) <= 0) { $GLOBALS['not_inserted_list_v2'][] = array_merge(array("NO LTO DEALER CONTACT INFO"), $row); $GLOBALS['not_inserted_data_count']++; continue; } if (empty($lto_dealer_contact[0]['contact_person']) || empty($lto_dealer_contact[0]['contact_phone'])) { $GLOBALS['not_inserted_list_v2'][] = array_merge(array("INCOMPLETE LTO DEALER CONTACT INFO"), $row); $GLOBALS['not_inserted_data_count']++; continue; } $array_data['vehicle_id'] = $vehicle_data[0]['id']; $array_data['user_id'] = Session::get('user')['id']; $array_data['plate'] = $data_plate_number; $array_data['mv'] = $data_mv_file; $array_data['date_received'] = $data_date; $array_data['notes'] = $data_notes; $array_data['engine_no'] = $data_engine_number; $array_data['chassis_no'] = $data_chassis_number; $array_data['status'] = "1"; //identify the type if ($data_mv_file && $data_plate_number) { $array_data['type'] = "orcr_plate"; $vehicle->updateVehiclePlate($array_data); $vehicle->updateVehicleMv($array_data); } else if ($data_mv_file) { $array_data['type'] = "orcr"; $vehicle->updateVehicleMv($array_data); } else if ($data_plate_number) { $array_data['type'] = "plate"; $vehicle->updateVehiclePlate($array_data); } else { $GLOBALS['not_inserted_list_v2'][] = array_merge(array("NO MV FILE OR PLATE"), $row); $GLOBALS['not_inserted_data_count']++; continue; } $existing_data = $this->lto->checkorcrPlateExisting($array_data); if (count($existing_data) > 0) { $GLOBALS['not_inserted_list_v2'][] = array_merge(array("ALREADY UPLOADED IN SYSTEM"), $row); $GLOBALS['not_inserted_data_count']++; continue; } if ($data_engine_number) { $vehicle->updateVehicleEngineNo($array_data); } if ($data_chassis_number) { $vehicle->updateVehicleChassisNo($array_data); } $array_data['record_id'] = $this->lto->createOrcrPlate($array_data); //for 2021 records fill the sms $excluded_year_below = 2021; if (date('Y', strtotime($data_date)) <= $excluded_year_below) { $array_data['sms_date'] = date("Y-m-d h:i:s"); $array_data['sms_response'] = $excluded_year_below; $this->lto->updateOrcrPlateSms($array_data); } $GLOBALS['not_inserted_list_v2'][] = array_merge(array("SUCCESS IMPORT"), $row); $GLOBALS['inserted_data_count']++; } } if (!$header_column_found) { $return_arr["status"] = 2; $return_arr["message"] = " Header not found."; response()->json($return_arr); } else { $return_arr["status"] = 1; $return_arr["gen_file"] = $destinationFilename; $return_arr["orig_file"] = $object->getFilename(); $return_arr["total"] = $GLOBALS['total_data_count']; $return_arr["inserted"] = $GLOBALS['inserted_data_count']; $return_arr["not_inserted"] = $GLOBALS['not_inserted_data_count']; $return_arr["message"] = " File Uploaded."; ///START GEN LOG $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); $GLOBALS['data_count_list_v2'][] = array("Total Data", (string) ($GLOBALS['total_data_count'])); $GLOBALS['data_count_list_v2'][] = array("Inserted Data", (string) ($GLOBALS['inserted_data_count'])); $GLOBALS['data_count_list_v2'][] = array("Not Inserted Data", (string) ($GLOBALS['not_inserted_data_count'])); $GLOBALS['data_count_list_v2'][] = array("Import By", (string) Session::get('user')['first_name'] . ' ' . Session::get('user')['last_name']); $GLOBALS['data_count_list_v2'][] = array("Import Date", (string) date('F d, Y')); $data_count_list_v2_count = count($GLOBALS['data_count_list_v2']); $spreadsheet ->getActiveSheet() ->getStyle('B' . ($data_count_list_v2_count + 1) . ':' . (string) $highestColumn . ($data_count_list_v2_count + 1)) ->getFill() ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) ->getStartColor() ->setARGB('FFFF00'); $spreadsheet ->getActiveSheet() ->getStyle('A' . ($data_count_list_v2_count + 1) . '') ->getFill() ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) ->getStartColor() ->setARGB('FF0000'); $spreadsheet->getActiveSheet()->getStyle('A' . ($data_count_list_v2_count + 1)) ->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_WHITE); $sheet = $spreadsheet->getActiveSheet(); for ($i = 'A'; $i != $highestColumn; $i++) { $sheet->getColumnDimension($i)->setAutoSize(true); } foreach ($GLOBALS['not_inserted_list_v2'] as $key => $subArr) { unset($subArr[intval($issue_summary_index) + 1]); $GLOBALS['not_inserted_list_v2'][$key] = $subArr; } unset($GLOBALS['row_headers'][intval($issue_summary_index)]); usort($GLOBALS['not_inserted_list_v2'], function ($a, $b) { return $a[0] <=> $b[0]; }); $GLOBALS['not_inserted_list_v2'] = array_merge(array(array_map("strtoupper", array_merge(array('SUMMARY'), $GLOBALS['row_headers']))), $GLOBALS['not_inserted_list_v2']); if ($data_count_list_v2_count > 0) { $GLOBALS['not_inserted_list_v2'] = array_merge($GLOBALS['data_count_list_v2'], $GLOBALS['not_inserted_list_v2']); } $sheet->fromArray($GLOBALS['not_inserted_list_v2'], NULL, 'A1'); $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); $writer->save($log_dir . '/' . $destinationFilename); //END GEN LOG // echo json_encode($return_arr); response()->json($return_arr); } } catch (\Exception $e) { $response['message'] = "Error has occured " . $e; $response['status'] = 0; response()->json($response); } } } public function orcrImportSummaryDownload() { $log_dir = APP_DISK . "import/orcr_plate/logs/"; $file = $log_dir . input('file'); $fp = fopen($file, 'rb'); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=" . escape(input('name')) . ""); header("Content-Length: " . filesize($file)); fpassthru($fp); } public function orcrPlateSmsUpdateCron() { // curl -H "App-Dev-Id: 626ca81708a1f" https://localhost/cron/lto/orcr_plate/sms --insecure // curl -H "App-Dev-Id: 626ca81708a1f" https://connect.autohub.ph/cron/lto/orcr_plate/sms $headers = apache_request_headers(); if (!isset($headers['App-Dev-Id'])) { echo "Access Denied"; exit; } if ($headers['App-Dev-Id'] != "626ca81708a1f") { echo "Invalid Key"; exit; } $array_data['company_access'] = ""; $array_data['search'] = ""; $array_data['date_added'] = ""; $array_data['date_received'] = ""; $array_data['company_access'] = ""; $array_data['dealer_access'] = ""; $array_data['sort'] = ""; $array_data['sms_status'] = " AND (vops.sms_date IS NULL AND vops.sms_response IS NULL)"; $response = $this->lto->getNoSmsOrcrPlateList($array_data); $sms_model = new \App\Models\Sms; //get templates $template['orcr_plate'] = $sms_model->getSmsTemplate(3); $template['plate'] = $sms_model->getSmsTemplate(2); $template['orcr'] = $sms_model->getSmsTemplate(1); foreach ($response as $row) { if ($row['vops_type'] == "orcr_plate") { $sms_data['message'] = $template['orcr_plate']; } else if ($row['vops_type'] == "orcr") { $sms_data['message'] = $template['orcr']; } else if ($row['vops_type'] == "plate") { $sms_data['message'] = $template['plate']; } $array_data['record_id'] = $row['vops_id']; $replace_parameter = array( '[plate]' => $row['plate_number'], '[cs]' => $row['conduction_sticker'], '[brand]' => $row['brand'], '[model]' => $row['model'], '[variant]' => $row['model_variant'], '[company]' => $row['company'], '[dealer]' => $row['dealer'], '[contact_person]' => $row['contact_person'], '[contact_email]' => $row['contact_email'], '[contact_phone]' => $row['contact_phone'], ); $sms_data['message'] = strtr($sms_data['message'], $replace_parameter); $sms_data['mobile'] = $row['mobile_phone_1']; // $sms_data['mobile'] = "+639389592854"; //debug //check if sms module is enabled $sms_module_id = 1; //orcr_plate if ($sms_model->getSmsModuleStatus($sms_module_id)) { if (empty($row['contact_person']) || empty($row['contact_phone'])) { $array_data['sms_date'] = NULL; $array_data['sms_response'] = "No LTO Dealer contact"; } else { //send sms to customer $sms_response = Sms::sendSms($sms_data); $array_data['sms_date'] = $sms_response == SMS_SUCCESS ? date("Y-m-d h:i:s") : NULL; $array_data['sms_response'] = $sms_response; } } else { $array_data['sms_date'] = NULL; $array_data['sms_response'] = NULL; } $this->lto->updateOrcrPlateSms($array_data); } } public function orcrStatusByCSMobile() { if (!input('mobile') && !input('cs') && !input('email')) { $response['message'] = "Insufficient parameters."; $response['status'] = 0; response()->json($response); } $array_data['mobile'] = \App\Utilities\MobileFormatter::format(Utility::removeNotAlphaNumeric(input('mobile'))); $array_data['cs'] = Utility::removeNotAlphaNumeric(input('cs')); $array_data['email'] = input('email'); // if (!empty($array_data['mobile']) && empty($array_data['cs'])) { // $array_data['search'] = " AND cc.mobile_phone_1 LIKE ? AND ?"; // $array_data['search_keyword'][0] = "%" . $array_data['mobile'] . "%"; // $array_data['search_keyword'][1] = "1"; // } else if (empty($array_data['mobile']) && !empty($array_data['cs'])) { // $array_data['search'] = " AND v.conduction_sticker = ? AND ? "; // $array_data['search_keyword'][0] = $array_data['cs']; // $array_data['search_keyword'][1] = "1"; // } else { // $array_data['search'] = " AND ( // cc.mobile_phone_1 LIKE ? // OR v.conduction_sticker = ? // ) // "; // $array_data['search_keyword'][0] = "%" . $array_data['mobile'] . "%"; // $array_data['search_keyword'][1] = $array_data['cs']; // } if (!empty($array_data['mobile']) && !empty($array_data['cs'])) { $array_data['search'] = " AND (REPLACE(cc.mobile_phone_1, '+63', '' ) = ? OR v.conduction_sticker = ?) "; $array_data['search_keyword'][0] = $array_data['mobile']; $array_data['search_keyword'][1] = $array_data['cs']; } else if (!empty($array_data['mobile'])) { $array_data['search'] = " AND REPLACE(cc.mobile_phone_1, '+63', '' ) = ? AND ?"; $array_data['search_keyword'][0] = $array_data['mobile']; $array_data['search_keyword'][1] = "1"; } else if (!empty($array_data['cs'])) { $array_data['search'] = " AND v.conduction_sticker = ? AND ? "; $array_data['search_keyword'][0] = $array_data['cs']; $array_data['search_keyword'][1] = "1"; } else if (!empty($array_data['email'])) { $array_data['search'] = " AND cc.email_1 = ? AND ? "; $array_data['search_keyword'][0] = $array_data['email']; $array_data['search_keyword'][1] = "1"; } $result = $this->lto->getOrcrPlateStatusList($array_data); $response['data'] = array(); foreach ($result as $row) { if ($row['sms_date'] && $row['sms_response'] != NULL) { $status = 'SMS Sent'; //'<span class="right text-sm badge font-weight-normal badge-success">SMS Sent</span>'; } else if (!$row['sms_date'] && $row['sms_response'] != NULL) { $status = 'Error'; //'<span class="right text-sm badge font-weight-normal badge-danger">Error: ' . $row['sms_response'] . '</span>'; } else if (!$row['sms_date'] && $row['sms_response'] == NULL) { $status = 'Pending'; //'<span class="right text-sm badge font-weight-normal badge-warning">Pending</span>'; } if ($row['vops_type'] == "orcr_plate") { $type = "ORCR & Plate"; } else if ($row['vops_type'] == "orcr") { $type = "ORCR"; } else if ($row['vops_type'] == "plate") { $type = "Plate"; } $response['data'] = array_merge( $response['data'], array(array( 'id' => $row['vehicle_id'], 'date_add' => date('F d, Y', strtotime($row['date_added'])), 'customer' => $row['type'] == "1" ? $row['first_name'] . ' ' . $row['last_name'] : $row['corporation_name'], 'firstname' => $row['type'] == "1" ? $row['first_name'] : '', 'lastname' => $row['type'] == "1" ? $row['last_name'] : '', 'mobile' => $row['mobile_phone_1'], 'brand' => $row['brand'], 'model' => $row['model'], // 'released_date' => '', 'vehicle' => $row['model_variant'], 'conduction_sticker' => $row['conduction_sticker'], 'plate' => $row['plate_number'], 'mv_file' => $row['mv_file'], 'engine_number' => $row['engine_number'], 'chassis_number' => $row['chassis_number'], 'type' => $type, 'date_received' => date('F d, Y', strtotime($row['date_received'])), 'date_pickup' => $row['pickup_date'] ? date('F d, Y', strtotime($row['pickup_date'])) : '', 'sms_status' => $status, 'plate_status' => $row['pickup_date'] ? 'Picked-up' : ($this->lto->getPlateStatus(array($row['vehicle_id'])) ? 'Available' : 'Not Available'), 'orcr_status' => $row['pickup_date'] ? 'Picked-up' : ($this->lto->getORCRStatus(array($row['vehicle_id'])) ? 'Available' : 'Not Available'), 'notes' => $row['notes'], 'company_dealer' => $row['company_code'] . ' - ' . $row['dealer_code'], 'sales_person' => $row['sales_person'], 'sc_id' => $row['asa_sales_person'], )) ); } $response['message'] = count($response['data']) ? 'Success' : 'No data fetched.'; $response['status'] = count($response['data']) ? 1 : 0; response()->json($response); } } PK �{�Zp�# # Controllers/TestController.phpnu �[��� <?php namespace App\Controllers; class TestController { public function profile() { echo "FUNC"; } public function homeAction($id) { echo $id; exit; print_r($_REQUEST); echo "<br>"; print_r(get_defined_vars()); } } PK �{�Z�;� Controllers/UserController.phpnu �[��� <?php namespace App\Controllers; class UserController { public function profile() { echo "FUNC"; } public function homeAction() { print_r($_REQUEST); echo "<br>"; print_r(get_defined_vars()); } } PK �{�ZC�N?� � "