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/  Your IP : 172.18.0.1   [ Reverse IP ]
Web Server : Apache/2.4.38 (Debian)
System : Linux a1822d00732a 4.15.0-39-generic #42-Ubuntu SMP Tue Oct 23 15:48:01 UTC 2018 x86_64
User : www-data ( 33)
PHP Version : 7.1.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Domains : 0 Domains
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/app/model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/html/app/model/AccountRepository.php
<?php

namespace Promoteus;

use Nette\Database\Table\ActiveRow;
use Nette\Database\Table\Selection;

/**
 * Table "account"
 */
class AccountRepository extends Repository
{
    private $trimWhitespace = array('zip', 'phone', 'email', 'url');
    private $empty2null =
        [
            'altus_id',
            'referent_id',
            'currency_id',
            'name',
            'address',
            'city',
            'zip',
            'country_id',
            'delivery_address',
            'delivery_city',
            'delivery_zip',
            'delivery_country_id',
            'phone',
            'email',
            'url',
            'ico',
            'dic',
            'vat',
            'has_catalog',
            'has_online_catalogs',
            'has_it_products',
            'invoice_due'
        ];

    /**
     * @param $values
     * @return bool|int|ActiveRow
     */
    public function insert($values)
    {
        $this->trimWhitespace($values);
        $this->empty2null($values);

        if (isset($values['online_catalogs_current_supplier'])) {
            $onlineCatalogsCurrentSupplier = $values['online_catalogs_current_supplier'];
            unset($values['online_catalogs_current_supplier']);
        }
        if (isset($values['it_products_current_supplier'])) {
            $itProductsCurrentSupplier = $values['it_products_current_supplier'];
            unset($values['it_products_current_supplier']);
        }
        if (isset($values['account_company_type'])) {
            $accountCompanyType = $values['account_company_type'];
            unset($values['account_company_type']);
        }

        $account = parent::insert($values);
        $accountId = $account->id;

        /** @var CurrentSupplierRepository $currentSupplierRepository */
        $currentSupplierRepository = $this->getService('currentSupplierRepository');

        if (isset($onlineCatalogsCurrentSupplier)) {
            $currentSupplierRepository->saveAccountOnlineCatalogsCurrentSupplier($accountId, $onlineCatalogsCurrentSupplier);
        }
        if (isset($itProductsCurrentSupplier)) {
            $currentSupplierRepository->saveAccountItProductsCurrentSupplier($accountId, $itProductsCurrentSupplier);
        }
        if (isset($accountCompanyType)) {
            /** @var CompanyTypeRepository $companyTypeRepository */
            $companyTypeRepository = $this->getService('companyTypeRepository');
            $companyTypeRepository->saveAccountCompanyTypes($accountId, $accountCompanyType);
            unset($values['account_company_type']);
        }
    }

    /**
     * @param $id
     * @return ActiveRow|void
     * @throws RepositoryException
     */
    public function delete($id)
    {
        parent::delete($id);
    }


    /**
     * @param $id
     * @param $values
     * @param array $change
     * @return mixed|ActiveRow
     * @throws RepositoryException
     */
    public function update($id, $values, array $change = [])
    {
        $this->trimWhitespace($values);
        $this->empty2null($values);

        $account = $this->getById($id);

        if (!$account) Throw new RepositoryException("Account with ID $id not found!");

        /** @var CurrentSupplierRepository $currentSupplierRepository */
        $currentSupplierRepository = $this->getService('currentSupplierRepository');

        if (isset($values['online_catalogs_current_supplier'])) {
            $currentSupplierMap = function ($item) {
                return $item['name_cze'];
            };
            $change['online_catalogs_current_supplier'][0] = implode(array_map($currentSupplierMap, $currentSupplierRepository->getAccountCurrentSupplierData($currentSupplierRepository->getAccountOnlineCatalogsCurrentSuppliers($id))), ', ');
            $currentSupplierRepository->saveAccountOnlineCatalogsCurrentSupplier($id, $values['online_catalogs_current_supplier']);
            $change['online_catalogs_current_supplier'][1] = implode(array_map($currentSupplierMap, $currentSupplierRepository->getAccountCurrentSupplierData($currentSupplierRepository->getAccountOnlineCatalogsCurrentSuppliers($id))), ', ');

            if ($change['online_catalogs_current_supplier'][0] === $change['online_catalogs_current_supplier'][1]) {
                unset($change['online_catalogs_current_supplier']);
            }

            unset($values['online_catalogs_current_supplier']);
        }

        if (isset($values['it_products_current_supplier'])) {
            $currentSupplierMap = function ($item) {
                return $item['name_cze'];
            };
            $change['it_products_current_supplier'][0] = implode(array_map($currentSupplierMap, $currentSupplierRepository->getAccountCurrentSupplierData($currentSupplierRepository->getAccountItProductsCurrentSuppliers($id))), ', ');
            $currentSupplierRepository->saveAccountItProductsCurrentSupplier($id, $values['it_products_current_supplier']);
            $change['it_products_current_supplier'][1] = implode(array_map($currentSupplierMap, $currentSupplierRepository->getAccountCurrentSupplierData($currentSupplierRepository->getAccountItProductsCurrentSuppliers($id))), ', ');

            if ($change['it_products_current_supplier'][0] === $change['it_products_current_supplier'][1]) {
                unset($change['it_products_current_supplier']);
            }

            unset($values['it_products_current_supplier']);
        }

        if (isset($values['account_company_type'])) {
            /** @var CompanyTypeRepository $companyTypeRepository */
            $companyTypeRepository = $this->getService('companyTypeRepository');
            $change['account_company_type'][0] = implode($companyTypeRepository->getAccountCodeCompanyTypes($id), ', ');
            $companyTypeRepository->saveAccountCompanyTypes($id, $values['account_company_type']);
            $change['account_company_type'][1] = implode($companyTypeRepository->getAccountCodeCompanyTypes($id), ', ');

            if ($change['account_company_type'][0] === $change['account_company_type'][1]) {
                unset($change['account_company_type']);
            }

            unset($values['account_company_type']);
        }

        return parent::update($id, $values);
    }

    /**
     * @return Selection
     */
    public function getAllAccounts(): Selection
    {
        return $this->getTable();
    }

    /**
     * @param $data
     * @return bool
     */
    function altusUpdate($data)
    {
        $res = $this->getBy(['altus_id' => $data['altus_id']]);
        if (!$res) {
            return $this->insert($data);
        } else {
            return $res->update($data);
        }
    }

    /**
     * @param $email
     * @param null $id
     * @return bool
     */
    public function isEmailAvailable($email, $id = NULL)
    {
        $stmt = $this->getTable()->where('email', $email)->limit(1);
        if ($id) {
            $stmt->where('id != ?', $id);
        }
        return !(bool)$stmt->fetch();
    }

    /**
     * @param $altusId
     * @param null $id
     * @return bool
     */
    public function isAltusIdAvailable($altusId, $id = NULL)
    {
        // allow NULL Altus ID
        if (empty($altusId)) {
            return TRUE;
        }
        $stmt = $this->getTable()->where('altus_id', $altusId)->limit(1);
        if ($id) {
            $stmt->where('id != ?', $id);
        }
        return !(bool)$stmt->fetch();
    }

    /**
     * @param $values
     */
    private function trimWhitespace(&$values)
    {
        foreach ($this->trimWhitespace as $key) {
            if (isset($values[$key]) && !empty($values[$key])) {
                $values[$key] = str_replace(' ', '', $values[$key]);
            }
        }
    }

    /**
     * @param $values
     */
    private function empty2null(&$values)
    {
        foreach ($this->empty2null as $field) {
            if (isset($values[$field]) && empty($values[$field])) {
                $values[$field] = NULL;
            }
        }
    }

}

Anon7 - 2022
AnonSec Team