AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.216.192
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lrsys/public_html/lrsys_apps/leo/application/plugins/module_imobles/helpers/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/public_html/lrsys_apps/leo/application/plugins/module_imobles/helpers/api/APIUtils.php
<?php
class APIUtils {

    public function getInputFilter(){
        try {
            $jsonStr = file_get_contents("php://input");

            $filter = json_decode($jsonStr, true);

            $jsonStr = ""; //LIMPA
        } catch (Exception $e) {
            $filter = array();
        }
        return $filter;
    }

    public function apiError($httpCode, $message){
        $output = array(
            "error" => array(
                "status" => true,
                "code" => $httpCode,
                "msg" => $message
            ),
            "total_count" => 0,
            "page_token" => 0,
            "list_size" => 0,
            "results" => []);
        return $output;        
    }

    public function crmAutoLogin($filter){
        if(!isset($filter["autologin"])) {
            throw new Exception("AutoLogin é obrigatório");
        }

        $client = ORM::for_table('crm_accounts')
            ->where('autologin', $filter["autologin"])
            ->find_one();

        if(!$client) {
            throw new Exception("AutoLogin inválido");
        }

        // TODO: RETIRA A CONDICIONAL ABAIXO E SEMPRE GERAR UM NOVO TOKEN NO PRIMEIRO ACESSO
        if(empty($client->token)){
            $newToken = Ib_Str::random_string(20).md5(time());
            $client->token = $newToken;
            $client->save();
        }
        
        return $client;

    }

    public function crmAccount($filter){
        if(!isset($filter["client_token"])) {
            throw new Exception("ClientToken é obrigatório");
        }

        $client = ORM::for_table('crm_accounts')
            ->where('token', $filter["client_token"])
            ->find_one();
            
        if(!$client){
            throw new Exception("ClientToken inválido");
        }
            
        return $client;
    }

    public function clientDetails($client){
        $arr_deal = array();
        $deal = ORM::for_table('module_imobles_deals')
            ->table_alias('d')
            ->select('d.*')
            ->select('sdr.fullname','preseller_name')
            ->select('sdr.img','preseller_picture')
            ->select('sdr.username','preseller_email')
            ->select('sdr.phonenumber','preseller_phone')
            ->select('sel.fullname','seller_name')
            ->select('sel.img','seller_picture')
            ->select('sel.username','seller_email')
            ->select('sel.phonenumber','seller_phone')
            ->join('sys_users', 'd.sdr_id=sdr.id','sdr')
            ->join('sys_users', 'd.seller_id=sel.id','sel')
            ->where('d.crm_account_id', $client->id)
            ->where_null('d.deleted_at')
            ->order_by_desc('d.id')
            ->find_array();
        if(!empty($deal)){
            $deal = $deal[0];
            $arr_deal = array(
                "created_at" => $deal["created_at"],
                "pre_seller" => array("name" => $deal["preseller_name"],"email" =>$deal["preseller_email"],"phone" =>$deal["preseller_phone"], "picture" => $deal["preseller_picture"]),
                "seller" => array("name" => $deal["seller_name"],"email" =>$deal["seller_email"], "phone" =>$deal["seller_phone"],"picture" => $deal["seller_picture"]),
                "deal" => $deal
            );
        } 

        $dataResult = [
            'client' => [
                'token' => $client->token,
                'first_name' => empty($client->fname)?$client->account:$client->fname,
                'last_name' => $client->lname,
                'phone' => $client->phone,
                'email' => $client->email,
                'sex' => $client->sex,
                'date_of_birth' => $client->date_of_birth,
                'picture' => $client->img
            ],
            'deal' => $arr_deal
        ];
        return $dataResult;
    }

    public function userLogin($filter){
        if(!empty($filter["token"])){
            $user = ORM::for_table('sys_users')
                ->where('autologin', $filter["token"])
                ->find_one();
            
            if(!$user) {
                throw new Exception("Token inválido");
            }
        } else if(!empty($filter["username"]) && !empty($filter["senha"])) {
            $user = ORM::for_table('sys_users')
                ->where('username', $filter["username"])
                ->find_one();
            if(!$user || Password::_verify($filter['senha'], $user['password']) != true) {
                $user = null;
                throw new Exception("Login e Senha inválidos");
            } else {
                $user->last_login = date('Y-m-d H:i:s');
                $user->autologin = Ib_Str::random_string(20) . $user->id;
                $user->save();
            }
        } else {
            throw new Exception("Token ou Login e Senha obrigatórios");
        }
        
        return $user;
    }

}

Anon7 - 2022
AnonSec Team