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 /
Services /
[ HOME SHELL ]
Name
Size
Permission
Action
AddressService.php
3.88
KB
-rw-rw-r--
AdminUserService.php
1.94
KB
-rw-rw-r--
AppUserService.php
1.7
KB
-rw-rw-r--
CategoryService.php
6.28
KB
-rw-rw-r--
FiscalService.php
1.13
KB
-rw-rw-r--
OfficeService.php
888
B
-rw-rw-r--
PriorityService.php
2.01
KB
-rw-rw-r--
SifarisFormService.php
994
B
-rw-rw-r--
SifarisRecordService.php
6.4
KB
-rw-rw-r--
StatusService.php
1.93
KB
-rw-rw-r--
YojanaBaseInterface.php
1.59
KB
-rw-rw-r--
YojanaBaseService.php
12.57
KB
-rw-rw-r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : YojanaBaseService.php
<?php namespace App\Services; use Illuminate\Database\Eloquent\Model; use App\Traits\{FileUploadTrait, CommonTrait}; use App\Traits\RepoTrait; use DB; abstract class YojanaBaseService implements YojanaBaseInterface { use FileUploadTrait, CommonTrait; use RepoTrait; protected $uploadPath; protected $model; public function __construct(Model $model) { $this->model = $model; } public function findById($where = []) { $model = $this->model; $item = $model->where($where)->first(); return $item; } public function find($where = [], $with = []) { $model = $this->model; if (!empty($with)) { return $model->with($with)->where($where)->first(); } return $model->where($where)->first(); } public function findAll($where = [], $with = []) { $model = $this->model; if (!empty($with)) $res = $model->with($with)->where($where)->get(); else $res = $model->where($where)->get(); return $res->toArray(); } public function save($data) { $model = $this->model->newInstance(); $model->fill($data); // dd($model); $model->save(); // dd($model); return $model; } public function update($data = [], $where = []) { $model = $this->model; $id = $data['id']; unset($data['id']); if (!empty($where)) $item = self::find($where); else $item = self::findById(['id' => $id]); if (empty($item)) { self::error_404(); } if (!empty($where)) { $item = $model->where($where)->update($data); $result = $model->find($where); } else { $item = $model->find($id)->update($data); $result = $model->find($id); } return $result; } public function delete($where = []) { $model = $this->model; $item = $model->where($where); if (empty($item)) { $this->error_404(); } $res = $model->find($where); $result = $model->where($where)->delete(); return $res; } public function softDelete($where = [], $data = []) { $model = $this->model; $item = $model->where($where); if (empty($item)) { $this->error_404(); } $result = $model->where($where)->update($data); $res = $model->find($where); return $res; } public function upload($data, array $valid_extensions, $max_size = null) { $d['file_content'] = $data['file_content']; $d['file_name'] = $data['file_name']; $directory_path = $data['directory_path']; return $this->uploadFileByTrait($directory_path, $d, $valid_extensions, $max_size); } public function unlinkFile($file_path) { if (file_exists($file_path)) { unlink($file_path); return true; } return false; } // WORK WITH MODEL PASSED IN FUNCTION public function findById_WM($where = [], $model = null) { if (!$model instanceof Model) { $model = app($model); } $item = $model->where($where)->first(); // dd($item); return $item; } public function find_WM($where = [], $with = [], $model = null) { if (!$model instanceof Model) { $model = app($model); } if (!empty($with)) { return $model->with($with)->where($where)->first(); } return $model->where($where)->first(); } public function findAll_WM($where = [], $with = [], $model = null) { if (!$model instanceof Model) { $model = app($model); } if (!empty($with)) $res = $model->with($with)->where($where)->get(); else $res = $model->where($where)->get(); return $res->toArray(); } public function findAllWhereIn_WM(string $field, $where = [], $with = [], $model = null) { if (!$model instanceof Model) { $model = app($model); } if (!empty($with)) { $res = $model->with($with); } return $model->whereIn($field, $where)->get(); } public function save_WM($data, $model, $unique_by = null, $unique_by_array = []) { if (!$model instanceof Model) { $model = app($model); } if (!is_null($unique_by)) { $t = $data[$unique_by]; $item = $model->where([$unique_by => $t])->first(); if ($item) { self::error_exists($t . ' already exists.'); } } //added to prevent inserting duplicate row by searching combination - sujan - 2021-06-14 if (!empty($unique_by_array)) { $item = $this->find($unique_by_array); if ($item) { self::error_exists('Data item already exists.'); } } // printR($data); // info($data); // info($model); // $this->enableQueryLog(); $item = $model->create($data); // $this->logQueryLog(); return $item; } public function update_WM($data = [], $where = [], $model = null, $unique_by = null, $unique_by_array = []) { // dd($where); // dd($model); if (!$model instanceof Model) { $model = app($model); } if (!empty($where)) $item = self::findAll_WM($where, [], $model); else $item = self::findById_WM(['id' => $data['id']], $model); if (empty($item)) { self::error_404(); } if (!empty($unique_by)) { $res = $model->where($unique_by, $data[$unique_by])->where('id', '<>', $data['id'])->first(); if ($res) { self::error_exists($data[$unique_by] . ' already exists.'); } } if (!empty($unique_by_array)) { $item = $model->where($unique_by_array)->where('id', '<>', $data['id'])->first(); if ($item) { self::error_exists('Data item already exists.'); } } if (!empty($where)) $item = $model->where($where)->update($data); else $item = $model->find($data['id'])->update($data); if (!empty($where)) $result = self::findAll_WM($where, [], $model); else $result = self::findById_WM(['id' => $data['id']], $model); return $result; } public function delete_WM($where = [], $model = null, $with = [], $deleted_by = null) { if (!$model instanceof Model) { $model = app($model); } if (empty($where)) { $this->error_404(); } $res = $model->find($where); $candidate = $model->where($where)->first(); if(!$candidate) { return $res; } if (!empty($with)) { //delete data from each relation. it's like cascade delete. foreach ($with as $relation) { $candidate->$relation->delete(); } } if ($deleted_by) { $candidate->deleted_at = now(); $candidate->deleted_by = $deleted_by; $candidate->save(); } else { $candidate->delete(); } return $res; } public function list_WM($model, $where = [], $with = [], $request = [], $arrayFilter = []) { if (!$model instanceof Model) { $model = app($model); } //CHECK REQUEST PARAMTERS $page_size = keyExists($request, 'pageSize') ? $request['pageSize'] : ''; $page = keyExists($request, 'page') ? $request['page'] : ''; $sorted = keyExists($request, 'sorted') ? $request['sorted'] : ''; $filtered = keyExists($request, 'filtered') ? $request['filtered'] : ''; $custom_filtered = keyExists($request, 'customFiltered') ? $request['customFiltered'] : ''; $no_of_pages = ''; if ($page == 0) { $start_page = 0; } else { $start_page = ($page * $page_size); } $query = $model->with($with)->where($where); $nquery = clone ($query); if (!empty($start_page)) { $query->offset($start_page); } if ($page_size) { $query->limit($page_size); } if (!empty($filtered) && !empty($arrayFilter)) { foreach ($arrayFilter as $key => $item) { if (keyExists($filtered, $item['alais']) && !empty($filtered[$item['alais']])) { if ($item['operator'] === 'LIKE') { $query->where($key, 'like', "%" . $filtered[$item['alais']] . "%"); $nquery->where($key, 'like', "%" . $filtered[$item['alais']] . "%"); } else { $query->where($key, $item['operator'], $item['alais']); $nquery->where($key, $item['operator'], $item['alais']); } } } } $data = $query->get(); $i = 0; $all_filtered_data = $nquery->get(); $count = count($all_filtered_data); if (!empty($page_size)) { $no_of_pages = ceil($count / $page_size); } return array('rows' => $data, 'pages' => $no_of_pages, 'count' => $count); } public function softDelete_WM($model, $where = [], $data = []) { if (!$model instanceof Model) { $model = app($model); } $item = $model->where($where); if (empty($item)) { $this->error_404(); } $data['deleted_by'] = auth()->user()->account_user->id; $data['deleted_at'] = now(); $result = $model->where($where)->update($data); $res = $model->find($where); return $res; } public function isDirty($model, $request, $column = [], $where = []) { if (!$model instanceof Model) { $model = app($model); } if (count($where) > 0) $query = $model->where($where)->first(); else $query = $model->find($request['id']); if (empty($query)) { $this->error_404(); } if (!empty($column)) { foreach ($column as $key => $field) { $query[$field] = $request[$field]; } } return $query->isDirty(); } public function getArrayOfSpecificField($model, $column = 'id', $where = []) { if (!$model instanceof Model) { $model = app($model); } $query = $model->where($where)->get(); if (empty($query)) { $this->error_404(); } $id_array = []; if (count($query) > 0) { foreach ($query as $item) { $id_array[] = $item[$column]; } } return $id_array; } public function enableQueryLog() { DB::enableQueryLog(); } public function logQueryLog() { $queries = DB::getQueryLog(); info($queries); } /** * Upload a file. * @param base64 $file_content * * @param string $file_name * * * @param int $id * * * @param Model $model * @return array */ public function uploadFile($file_content, $file_name, $id, $model) { if (!$model instanceof Model) { $model = app($model); } //key will be image or file - used to dynamically fetch valid extenions, max size etc. $key = $this->getFileType($file_name); $d['file_content'] = $file_content; $d['file_name'] = strtolower($file_name); $media = null; if ($key == 'image') $media = $model->getMediaImage(); else if ($key == 'file') $media = $model->getMediaFile(); if (!$media) return $this->error_response('Media not defined for the model'); $directory_path = $id ? $media->path . $id : $media->path; // dd($d); return $this->uploadFileByTrait(\Constant::MEDIA__PUBLIC_PATH . $directory_path, $d, $media->valid_extensions, $media->max_size_bytes); } private function getFileType($file_name) { $ext = pathinfo($file_name, PATHINFO_EXTENSION); $img = ['jpg', 'jpeg', 'bmp', 'gif', 'tif', 'tiff', 'png']; if (in_array($ext, $img)) return "image"; else return "file"; } public function getIdByCode($code, Model $model) { $item = $model->where('code', $code)->first(); return $item->id; } }
Close