���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
portal-cutunix
/
app
/
Helpers
/
HelperClass
/
Viewing: GeneralUseV2.php
<?php namespace App\Helpers\HelperClass; use Carbon\Carbon; use MathParser\Interpreting\Evaluator; use MathParser\StdMathParser; use Modules\Central\Models\AnalyzeSetting; use Modules\Central\Models\AnalyzeUserSetting; use Modules\Central\Models\FormulaUnit; use Modules\Central\Models\UnitList; use Modules\Central\Models\UnitListAttach; use Modules\Central\Models\UnitListInput; use Modules\Central\Models\UnitListSetting; use Modules\Central\Models\VariableUnit; use Modules\Central\Models\VariableUnitOption; use function App\Helpers\imageHelperApi; class GeneralUseV2 { public static function get_setting($key = null) { $check = AnalyzeSetting::where('key', $key)->first(); if ($check) { $user_setting = AnalyzeUserSetting::where('user_id', auth('web')->user()->id)->where('setting_id', $check->id)->first(); if ($user_setting) { return (float)$user_setting->value; } else { return (float)$check->value; } } else { return 1; } } public static function set_formula_list($unit_title = null, $property = null, $unit_id = null, $formulas = [], $update = null, $type = null, $uid = null) { $insertsInput = []; $inserts = []; if ($update) { UnitListAttach::where('list_id', $update->id)->delete(); UnitListInput::where('list_id', $update->id)->delete(); $list = $update; } else { $list = UnitList::create([ 'name' => $unit_title, 'uid' => $uid, 'unit_id' => $unit_id, 'user_id' => auth('web')->user()->id, ]); } if ($property && 0 < count($property)) { foreach ($property as $p) { $insertsInput[] = [ 'key' => $p['key'], 'value' => $p['value'], 'list_id' => $list->id, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]; } } if ($list && 0 < count($formulas)) { UnitListInput::insert($insertsInput); foreach ($formulas as $val) { $inserts[] = [ 'label' => $val['label'], 'label_en' => $val['label_en'], 'width' => $val['width'], 'length' => $val['length'], 'var_1' => $val['var_1'], 'var_2' => $val['var_2'], 'count' => $val['count'], 'length_one' => $val['length_one'], 'length_two' => $val['length_two'], 'width_one' => $val['width_one'], 'width_two' => $val['width_two'], 'rotatable' => $val['rotatable'] ?? false, 'material_id' => $val['material_id'], 'list_id' => $list->id, 'user_id' => auth('web')->user()->id, 'unit_id' => $unit_id, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]; } if (count($inserts) > 0) { UnitListAttach::insert($inserts); if (!$update && $type != 'edit_unit') { $setting = AnalyzeSetting::get(); $insertSetting = []; foreach ($setting as $key => $row) { $userInit = $row->user($row->id, $row->key); $insertSetting[] = [ 'key' => $row->key, 'value' => $userInit ? $userInit->value : $row->value, 'list_id' => $list->id, 'setting_id' => $row->id, 'user_id' => auth('web')->user()->id, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]; } if (count($insertSetting) > 0) { UnitListSetting::insert($insertSetting); } } } } } public static function get_property($property = null, $list_id = null) { $result = []; $setting = AnalyzeSetting::get(); foreach ($setting as $row) { $result[$row->key] = (float)$row->value; } $user_check = AnalyzeUserSetting::where('user_id', auth('web')->user()->id)->first(); if ($user_check) { $ids = AnalyzeSetting::pluck('id')->toArray(); if ($list_id) { $user_setting = UnitListSetting::where('list_id', $list_id)->where('user_id', auth('web')->user()->id)->whereIn('setting_id', $ids)->get(); } else { $user_setting = AnalyzeUserSetting::where('user_id', auth('web')->user()->id)->whereIn('setting_id', $ids)->get(); } foreach ($user_setting as $row) { $result[$row->key] = (float)$row->value; } } foreach ($property as $obj) { $result[$obj['key']] = (float)$obj['value']; } return $result; } public static function computing_unit($request, $property = null, $list = null) { $result = []; $list_id = null; if ($list) { $list_id = $list->id; } $formulas = FormulaUnit::where('unit_id', $request->unit_id)->orderBy('sort', 'desc')->get(); $parser = new StdMathParser(); $evaluator = new Evaluator(); $var = self::get_property($property, $list_id); $evaluator->setVariables($var); if (0 < count($formulas)) { foreach ($formulas as $formula) { $material_id = $formula->material_id; if ($formula->material_key) { $key = $formula->material_key; if (isset($request->$key)) { $material_id = (int)$request->$key; } } $var_1 = null; $var_2 = null; $width = $parser->parse($formula->width); $width = $width->accept($evaluator); $length = $parser->parse($formula->length); $length = $length->accept($evaluator); if ($formula->var_1) { $var_1 = $parser->parse($formula->var_1); $var_1 = $var_1->accept($evaluator); $var_1 = round($var_1, 1); } if ($formula->var_2) { $var_2 = $parser->parse($formula->var_2); $var_2 = $var_2->accept($evaluator); $var_2 = round($var_2, 1); } $result[] = [ 'var_2' => $var_2, 'var_1' => $var_1, 'count' => $formula->count, 'label' => $formula->label, 'width' => round($width, 1), 'length' => round($length, 1), 'label_en' => $formula->label_en, 'width_one' => $formula->width_one, 'width_two' => $formula->width_two, 'length_one' => $formula->length_one, 'length_two' => $formula->length_two, 'material_id' => $material_id, ]; } } if ($request->type && ($request->type == 'set' || $request->type == 'edit_unit')) { $uid = Carbon::now()->timestamp . rand(10000, 99999); for ($i = 0; $i < $request->count; $i++) { self::set_formula_list($request->unit_title, $property, $request->unit_id, $result, $list, $request->type, $uid); } } return $result; } public static function CustomList($formData, $material, $list_id = null) { $result = []; if (0 < count($formData['slice'])) { foreach ($formData['slice'] as $row) { array_push($result, [ 'var_2' => null, 'var_1' => null, 'count' => $row['count'], 'width' => $row['width'], 'length' => $row['length'], 'label' => $row['description'], 'label_en' => $row['description'], 'width_one' => $row['width_one'], 'width_two' => $row['width_two'], 'length_one' => $row['length_one'], 'length_two' => $row['length_two'], 'material_id' => $formData['material_id'], 'rotatable' => $row['rotatable'], ]); } } if (0 < count($result)) { if ($list_id) { $unit = UnitList::where(['id' => $list_id, 'user_id' => auth('web')->user()->id])->first(); self::set_formula_list($formData['panel_description'], null, null, $result, $unit); } else { self::set_formula_list($formData['panel_description'], null, null, $result); } } } public static function create_formula($filesystem, $formData, $unit_id) { $insertsFormula = []; //SET-formula foreach ($formData['formula'] as $obj) { $image = null; if ($obj['image']) { $image = imageHelperApi($obj['image'], $filesystem, '', 300, 300, ''); } $insertsFormula[] = [ 'width' => $obj['width'], 'length' => $obj['length'], 'var_1' => isset($obj['var_1']) && $obj['var_1'] ? $obj['var_1'] : null, 'var_2' => isset($obj['var_2']) && $obj['var_2'] ? $obj['var_2'] : null, 'image' => $image, 'count' => $obj['count'], 'label' => $obj['label'], 'sort' => $obj['sort'], 'label_en' => $obj['label_en'], 'material_id' => $obj['material'] == 'var' ? null : $obj['material'], 'material_key' => $obj['material_key'], 'length_one' => $obj['length_one'], 'length_two' => $obj['length_two'], 'width_one' => $obj['width_one'], 'width_two' => $obj['width_two'], 'unit_id' => $unit_id, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]; } if (count($insertsFormula) > 0) { //insert-data FormulaUnit::insert($insertsFormula); } self::setVariable($formData, $unit_id); } public static function setVariable($formData, $unit_id) { foreach ($formData['variable'] as $obj) { $variable = VariableUnit::create([ 'key' => $obj['key'], 'label' => $obj['label'], 'label_en' => $obj['label_en'], 'num_option' => $obj['num_option'], 'type' => $obj['type'], 'default' => $obj['default'], 'unit_id' => $unit_id, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]); if ($obj['type'] == 2 || $obj['type'] == 3) { $variableOptions = []; foreach ($obj['options'] as $op) { $variableOptions[] = [ 'title' => $op['title'], 'value' => $op['value'], 'variable_id' => $variable->id, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]; } if (count($variableOptions) > 0) { //insert-data VariableUnitOption::insert($variableOptions); } } } } public static function permissions() { return [ [ 'title' => 'اطلاعات داشبورد ( یک گزینه انتخاب شود )', 'items' => [ 'admin' => 'سوپر ادمین', 'secretary' => 'مدیر فروش', 'services' => 'خدماتی', 'employee' => 'کارمند', 'MarketingManager' => 'بازاریاب', 'ads' => 'تولید محتوا', 'none' => 'عدم نمایش', ] ], [ 'title' => ' آنالیز یونیت ', 'items' => [ 'analyze.materials' => 'متریال', 'analyze.setting' => 'تنظیمات اپلیکیشن', 'analyze.units' => ' یونیت', 'analyze.units.add' => ' افزودن یونیت', 'analyze.units.edit' => ' ویرایش یونیت', 'analyze.units.delete' => ' حذف یونیت', 'analyze.config' => 'کانفیگ', ] ], [ 'title' => 'مدیریت اپلیکیشن', 'items' => [ 'application.request_services' => 'درخواست ثبت خدماتی', 'application.version' => 'ورژن اپلیکیشن', 'application.report_payment' => 'گزارش پرداخت درگاه', 'application.transaction' => 'تراکنش ها', 'application.machinery' => 'ماشین آلات ', 'application.price' => 'شرح خدمات', 'application.link' => 'لینک ها ', 'application.config' => 'کانفیگ', 'application.order-status' => 'وضعیت سفارش', 'application.service-status' => 'وضعیت اجرا', 'application.slider' => 'مدیریت اسلایدر', 'application.app' => 'مدیریت اپلیکیشن', 'application.factor' => 'مدیریت فاکتورها', 'application.setting' => 'تنظیمات', ] ], [ 'title' => 'مدیریت کاربران ', 'items' => [ 'roles' => 'مدیریت نقش ها', 'roles.add' => 'ایجاد نقش ها', 'roles.edit' => 'ویرایش نقش ها', 'users.admin' => ' ادمین', 'users.all' => ' برنامه', 'users.services' => ' خدماتی', 'users.marketer' => ' بازاریاب', 'users.customer' => ' مشتریان ', 'users.employee' => ' کارمندان ', 'users.login' => 'ورود به حساب کاربر', 'users.add' => 'افزودن کاربر ', 'users.edit' => 'ویرایش کاربر ', ] ], [ 'title' => 'مدیریت سفارشات', 'items' => [ 'orders' => 'لیست سفارشات', 'orders.add' => 'افزودن سفارش', 'orders.edit' => 'ویرایش سفارش', 'orders.detail' => 'مشاهده جزییات', 'orders.info' => 'جزییات (اطلاعات کلی)', 'orders.description' => 'جزییات (توضیحات کلی)', 'orders.slices' => 'جزییات (اطلاعات سفارش)', 'orders.chat' => 'جزییات (گفتگو)', 'orders.payment' => 'جزییات (اطلاعات پرداخت)', 'orders.log' => 'جزییات (گزارش تغییر وضعیت)', 'orders.logEm' => 'جزییات (گزارش تغییر وضعیت کارگاه)', ] ], [ 'title' => 'مدیریت محصولات ', 'items' => [ 'products.category' => 'دسته بندی ', 'products.type' => 'نوع', 'products' => 'لیست محصول', ] ], [ 'title' => 'مدیریت پیامرسان', 'items' => [ 'messages.chat' => 'پیام ها', 'messages.tickets' => 'تیکت', ] ], [ 'title' => 'مدیریت مالی ', 'items' => [ 'financial.definition' => 'تعریف حساب ها ', 'financial.document' => 'سند حسابداری', ] ], [ 'title' => 'مدیریت پردازشات', 'items' => [ 'processing.pending' => 'پردازشات در صف اجرا ', ] ], [ 'title' => 'مدیریت بازاریاب ', 'items' => [ 'marketer' => 'لیست و گزارش بازاریاب ها', ] ], [ 'title' => ' ادمین دسته رنگ ', 'items' => [ 'dasteRang' => 'مدیرت برنامه ها', ] ], ]; } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa