Linux ubuntu22 5.15.0-133-generic #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025 x86_64
nginx/1.18.0
: 128.199.27.159 | : 216.73.216.1
Cant Read [ /etc/named.conf ]
8.1.31
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
sifaris /
app /
Traits /
[ HOME SHELL ]
Name
Size
Permission
Action
backup
[ DIR ]
drwxrwxr-x
CommonTrait.php
14.19
KB
-rw-rw-r--
ErrorTrait.php
1.56
KB
-rw-rw-r--
FileUploadTrait.php
4.32
KB
-rw-rw-r--
HelperTrait.php
953
B
-rw-rw-r--
ImageUploadTrait.php
23.37
KB
-rw-rw-r--
RepoTrait.php
692
B
-rw-rw-r--
SecurityTrait.php
827
B
-rw-rw-r--
SeederTrait.php
510
B
-rw-rw-r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : CommonTrait.php
<?php namespace App\Traits; use Illuminate\Pagination\LengthAwarePaginator; use niklasravnsborg\LaravelPdf\Facades\Pdf; use Illuminate\Support\Carbon; use Webpatser\Uuid\Uuid; use Illuminate\Support\Facades\Auth; use Maatwebsite\Excel\Facades\Excel; use App\Modules\Setting\Entities\AccountFiscalYear; trait CommonTrait { /* error response for form requests*/ public function validation_response($errors) { $response = [ 'success' => false, 'message' => $errors, 'code' => 422 ]; return $response; } public function error_response($message) { $response = [ 'success' => false, 'message' => $message, 'code' => 500 ]; return $response; } public function success_response($data, $message = NULL) { $response = [ 'success' => true, 'message' => $message, 'data' => $data, 'code' => 200 ]; return $response; } public function set_stripe_key() { // info('key:' . config('general.stripe_secret_key')); \Stripe\Stripe::setApiKey(config('general.stripe_secret_key')); \Stripe\Stripe::setApiVersion(config('general.stripe_api_version')); } public function get_uuid() { return Uuid::generate()->string; } public function now() { return Carbon::now()->toDateTimeString(); } public function now_date() { return Carbon::now(); } public function diff_now($date, $type) { $now = $this->now_date(); if ($date instanceof Carbon) $to_compare_date = $date; else $to_compare_date = new Carbon($date); switch ($type) { case 'min': return $now->diffInMinutes($to_compare_date); break; default: return -1; break; } } public function pagination($data, $current_page, $path = NULL, $query_string = []) { $paginate = config('general.paginate'); $offSet = ($current_page * $paginate) - $paginate; $itemsForCurrentPage = array_slice($data, $offSet, $paginate); if ($path) { $response = new LengthAwarePaginator($itemsForCurrentPage, count($data), $paginate, NULL, ['path' => $path]); if (!empty($query_string)) { $response->appends($query_string); } } else { $response = new LengthAwarePaginator($itemsForCurrentPage, count($data), $paginate); } return $response; } public function getMonthsList($max) { $date = Carbon::now(); $dates = []; for ($i = 1; $i <= $max; $i++) { $dates[] = ['name' => $date->format('F Y'), 'value' => $date->format('Y-m-01')]; $date->addMonth(1); } return $dates; } public function getCountries() { $response = []; $countries = config('countries'); if (!empty($countries)) { foreach ($countries as $key => $country) { $response[$key]['name'] = ucwords(strtolower($country['name'])); $response[$key]['code'] = $country['code']; } } return $response; } public function formatAddress($account) { $address = ''; if ($account->company_address_line1) { $address .= $account->company_address_line1 . ' ,'; } if ($account->company_city) { $address .= $account->company_city . ' ,'; } if ($account->company_country) { $address .= $account->company_country; } return $address; } public function to2Decimals($value = '') { return number_format((float)$value, 2, '.', ''); } public function makeDirectory($foldername) { if (!file_exists(public_path($foldername)) && !is_dir(public_path($foldername))) { mkdir(public_path($foldername), 0777, true); } } public function unlinkFileIfExists($filename) { if (file_exists(public_path($filename))) { unlink(public_path($filename)); } } public function generatePdf($view, $data, $destination, $orientation = 'portrait', $additional = []) { try { // info(json_encode($data)); $foldername = $destination['foldername']; $filename = $destination['filename']; $this->makeDirectory($foldername); $this->unlinkFileIfExists($filename); $pdf = app()->make('dompdf.wrapper'); // printR(public_path($filename)); $pdf->loadView($view, ['data'=> $data, 'additional' => $additional ,'type'=>'pdf'])->setPaper('a4', $orientation)->save(public_path($filename)); if (file_exists(public_path($filename))) { return $this->success_response(['url' => asset($filename), 'type' => 'pdf'], 'Pdf generated successfully'); } else { return $this->error_response('Error in generating pdf.'); } } catch (\Throwable $t) { return $this->error_response($t->getMessage()); } } public function generateExcel($modal, $destination) { try { if($destination['foldername']){ $foldername = $destination['foldername']; } $filename = $destination['filename']; if($foldername){ $this->makeDirectory($foldername); } $this->unlinkFileIfExists($filename); // $excel = app()->make('excel'); //dd($modal); Excel::store($modal, $filename, 'custom'); if (file_exists(public_path($filename))) { return $this->success_response(['url' => asset($filename), 'type' => 'excel'], 'Excel generated successfully'); } else { return $this->error_response('Error in generating excel.'); } } catch (\Throwable $t) { return $this->error_response($t->getMessage()); } } public function isValidHttpStatusCode($code) { /** * Content from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes **/ $valid_codes = array( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', // WebDAV; RFC 2518 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', // since HTTP/1.1 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', // WebDAV; RFC 4918 208 => 'Already Reported', // WebDAV; RFC 5842 226 => 'IM Used', // RFC 3229 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', // since HTTP/1.1 304 => 'Not Modified', 305 => 'Use Proxy', // since HTTP/1.1 306 => 'Switch Proxy', 307 => 'Temporary Redirect', // since HTTP/1.1 308 => 'Permanent Redirect', // approved as experimental RFC 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', // RFC 2324 419 => 'Authentication Timeout', // not in RFC 2616 420 => 'Enhance Your Calm', // Twitter 420 => 'Method Failure', // Spring Framework 422 => 'Unprocessable Entity', // WebDAV; RFC 4918 423 => 'Locked', // WebDAV; RFC 4918 424 => 'Failed Dependency', // WebDAV; RFC 4918 424 => 'Method Failure', // WebDAV) 425 => 'Unordered Collection', // Internet draft 426 => 'Upgrade Required', // RFC 2817 428 => 'Precondition Required', // RFC 6585 429 => 'Too Many Requests', // RFC 6585 431 => 'Request Header Fields Too Large', // RFC 6585 444 => 'No Response', // Nginx 449 => 'Retry With', // Microsoft 450 => 'Blocked by Windows Parental Controls', // Microsoft 451 => 'Redirect', // Microsoft 451 => 'Unavailable For Legal Reasons', // Internet draft 494 => 'Request Header Too Large', // Nginx 495 => 'Cert Error', // Nginx 496 => 'No Cert', // Nginx 497 => 'HTTP to HTTPS', // Nginx 499 => 'Client Closed Request', // Nginx 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', // RFC 2295 507 => 'Insufficient Storage', // WebDAV; RFC 4918 508 => 'Loop Detected', // WebDAV; RFC 5842 509 => 'Bandwidth Limit Exceeded', // Apache bw/limited extension 510 => 'Not Extended', // RFC 2774 511 => 'Network Authentication Required', // RFC 6585 598 => 'Network read timeout error', // Unknown 599 => 'Network connect timeout error', // Unknown ); return array_key_exists($code, $valid_codes); } //get account id of logged in user - sangam - 2021-03-11 public function getAccountID() { $token_name = $this->getTokenName(); //example: 'tender_account_id:1|hr_account_user_id:2' // info('$token_name: ' . $token_name); if (empty($token_name)) return null; $arr = explode('|', $token_name); if (empty($arr) || sizeof($arr) < 2) return null; $str = $arr[0]; //example: 'tender_account_id:1 return str_replace('hr_account_id:', '', $str); } //get account_user_id of logged in user - sangam - 2021-03-11 public function getAccountUserID() { $token_name = $this->getTokenName(); //example: 'tender_account_id:1|hr_account_user_id:2' if (empty($token_name)) return null; $arr = explode('|', $token_name); if (empty($arr) || sizeof($arr) < 2) return null; $str = $arr[1]; //example: hr_account_user_id:2 return str_replace('hr_account_user_id:', '', $str); } //get roles of logged in user - sangam - 2021-03-11 public function getRoles() { $token_name = $this->getTokenName(); if (empty($token_name)) return null; $arr = explode('|', $token_name); if (empty($arr) || sizeof($arr) < 2) return null; $str = $arr[2]; //example: 'hr_roles:1 return str_replace('hr_roles:', '', $str); } public function getTokenName() { return !empty(Auth::guard('api')->user()->token()) ? Auth::guard('api')->user()->token()->name : 'yojanahr'; } private function getAuthUser() { $this->logged_user = new \StdClass; $this->login_user = Auth::guard('api')->user(); if ($this->login_user != null) { $this->logged_user->id = $this->login_user->id; $this->logged_user->uuid = $this->login_user->uuid; $this->logged_user->email = $this->login_user->email; $this->logged_user->firstname = $this->login_user->firstname; $this->logged_user->lastname = $this->login_user->lastname; $this->logged_user->full_name = $this->login_user->full_name; $this->logged_user->user_type = $this->login_user->user_type; $this->logged_user->role = array($this->getRoles()); $this->logged_user->employee_id = !empty($this->login_user->account_user->employee) ? $this->login_user->account_user->employee->id : null; $this->logged_user->emp_hist_id = !empty($this->login_user->account_user->employee) && $this->login_user->account_user->employee->current_emp_hist ? $this->login_user->account_user->employee->current_emp_hist->id : null; $this->logged_user->is_admin = ($this->logged_user->role == 'admin') ? true : false; $this->logged_user->is_user = ($this->logged_user->role == 'user') ? true : false; $this->accounts_arr = array(); foreach ($this->login_user->accounts as $key => $value) { array_push($this->accounts_arr, $value->id); } $this->logged_user->accounts = $this->accounts_arr; $this->logged_user->account_id = $this->getAccountID(); $this->logged_user->account_user_id = $this->getAccountUserID(); } } public function get_role($user) { $account_id = $this->getAccountUserID(); if (!$account_id) return []; $account_users = $user->account_users()->where('account_id', $account_id)->first(); if (!$account_users) return []; $roles = $account_users->getRoleNames(); return $roles; } public function getCurrentPaymentPeriod() { $query = AccountFiscalYear::where(['is_closed' => 0, 'account_id' => $this->getAccountID()])->orderBy('id', 'DESC')->first(); if (!empty($query)) { return ([ 'start_date_ad' => $query->fiscal_year->start_date_ad, 'end_date_ad' => $query->fiscal_year->end_date_ad, 'start_date_bs' => $query->fiscal_year->start_date_bs, 'end_date_bs' => $query->fiscal_year->end_date_bs, ]); } return ([ 'start_date_ad' => $this->now(), 'end_date_ad' => $this->now(), 'start_date_bs' => $this->now(), 'end_date_bs' => $this->now(), ]); } }
Close