Plugin Directory

Changeset 1606628


Ignore:
Timestamp:
03/02/2017 03:45:38 PM (9 years ago)
Author:
bontact
Message:

1.2.2

Location:
bontact/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bontact/trunk/bontact.php

    r1575728 r1606628  
    55Description: Engage visitors with a multi-channel communication widget that includes live chat, callback, text messages, and email. Increase their satisfaction and your conversion rates.
    66Author: Bontact
    7 Version: 1.2.1
     7Version: 1.2.2
    88Author URI: http://www.bontact.com
    99License: GPLv2 or later
  • bontact/trunk/classes/class-bont-settings.php

    r1575721 r1606628  
    1616    protected $_option_slug;
    1717   
    18     protected $_api_login_url = 'https://dashboard.bontact.com/api/bontactapi.aspx?func=login&username=%s&password=%s';
     18    protected $_api_login_url = 'https://dashboard-api-prd.azurewebsites.net/api/login?username=%s&pass=%s';
    1919    protected $_api_login_urla = 'https://dashboard.bontact.com/api/bontactapi.aspx?func=signup&username=%s&password=%s&package=free&telephone=%s&usertype=4';
    2020    protected function _do_redirect_option_page( $message_code = null ) {
     
    4545    public function admin_init() {
    4646       
    47                 /* $options = get_option( $this->_option_slug, array() );
    48                 $options['token'] = $data_return->token;
    49                 $options['username'] = '';
    50                 $options['password'] = '';
    51                 update_option( $this->_option_slug, $options ); */
    52                
    53                
     47                           
    5448       
    5549       
     
    7064
    7165                $response = wp_remote_get(urldecode( sprintf( $this->_api_login_url, $_POST['bontact']['username'], $_POST['bontact']['password'] )), array( 'sslverify' => false, 'timeout' => 30 ) );
    72 
     66                 
     67                 
     68                 
    7369                if ( is_wp_error( $response ) || 200 !== (int) $response['response']['code'] ) {
    7470                    $this->_do_redirect_option_page( 4 );
     
    7874                if ( is_null( $data_return ) || '200' !== $data_return->code ) {
    7975                   
    80                     $this->_do_redirect_option_page( 3 );
     76                    //$this->_do_redirect_option_page( 3 );
     77                    $return_url = add_query_arg( 'page', $this->_option_slug, admin_url( 'admin.php' ) );
     78                    if($data_return->status == true)
     79                    {
     80                       
     81                        $options = get_option( $this->_option_slug, array() );
     82                        $options['tokennew'] = $data_return->token;
     83                        $options['token'] = $data_return->rep->code;
     84                        update_option( $this->_option_slug, $options );
     85                        $return_url = add_query_arg( 'test', $this->get_option( 'tokennew' ), $return_url );
     86                       
     87                    }
     88                    else
     89                    {
     90                        $this->_do_redirect_option_page( 3 );
     91                    }
     92                   
     93       
     94        wp_redirect( $return_url );
     95        die();
    8196                }
    8297
    8398                $options = get_option( $this->_option_slug, array() );
    84                 $options['token'] = $data_return->token;
    8599                $options['username'] = $_POST['bontact']['username'];
    86100                $options['password'] = $_POST['bontact']['password'];
     
    108122
    109123                $options = get_option( $this->_option_slug, array() );
    110                 $options['token'] = $data_return->token;
    111124                $options['username'] = $_POST['emaila'];
    112125                $options['password'] = $_POST['passa'];
     
    120133    public function bontact_logout() {
    121134    $options = get_option( $this->_option_slug, array() );
    122                 $options['token'] = $data_return->token;
     135                $options['token'] = '';
    123136                $options['username'] = '';
    124137                $options['password'] = '';
     138                $options['tokennew'] = '';
    125139                update_option( $this->_option_slug, $options );
    126140                echo "You have disconnected your account";
     
    129143        $username = $this->get_option( 'username' );
    130144        $password = $this->get_option( 'password' );
     145        $tokennew = $this->get_option( 'tokennew' );
     146        $token = $this->get_option( 'token' );
    131147       
    132148        ?>
     
    139155            <div class="<?php echo $this->_form_messages[ $_GET['message'] ]['status']; ?>"><p><?php echo $this->_form_messages[ $_GET['message'] ]['msg']; ?></p></div>
    140156           
     157           
    141158            <?php endif; ?>
    142159            <?php if ( ! empty( $_GET['messagea'] ) && ! empty( $this->_form_messagesa[ $_GET['messagea'] ] ) ) : ?>
    143160            <div class="<?php echo $this->_form_messages[ $_GET['messagea'] ]['status']; ?>"><p><?php echo $this->_form_messagesa[ $_GET['messagea'] ]['msg']; ?></p></div>
    144161           
     162           
    145163            <?php endif; ?>
    146             <?php if ( ! empty( $username ) && ! empty( $password ) ) : ?>
    147                 <?php echo "<div id='bont-dasboard'><iframe id='bontiframe' src='https://dashboard.bontact.com/html/login.aspx?parent=wordpress&username=".$username."&pass=".$password."' height=1000 width=100% scrolling='yes'></iframe></div>"; ?>
     164            <?php if ( ! empty( $tokennew ) ) : ?>
     165                <?php echo "<div id='bont-dasboard'><iframe id='bontiframe' src='https://app.bontact.com/chat?token=".$tokennew."' height=1000 width=100% scrolling='yes'></iframe></div>"; ?>
    148166            <?php else : ?>
    149167           
     
    268286        $username = $this->get_option( 'username' );
    269287        $password = $this->get_option( 'password' );
     288        $tokennew = $this->get_option( 'tokennew' );
    270289        add_menu_page( 'Bontact Settings', 'Bontact', 'manage_options', 'bontact-settings', array( &$this, 'bontact_setting_content' ), plugins_url( 'assets/images/logo-bontact-16x16.png', BONTACT_BASE ) );
    271290       
    272     if (  empty( $username ) &&  empty( $password ) )
     291    if (  empty( $tokennew ) )
    273292    {
    274293        add_action('all_admin_notices', array(&$this, 'BontactNotice'));
    275294    }
    276     if (  !empty( $username ) &&  !empty( $password ) )
     295    if (  !empty( $tokennew ) )
    277296    {
    278297        add_submenu_page( 'bontact-settings', 'Disconnect account', 'Disconnect account', 'administrator', 'bontact-logout', array( &$this, 'bontact_logout' ) );
     
    368387    }
    369388   
     389   
     390   
     391   
     392   
    370393}
  • bontact/trunk/readme.txt

    r1575721 r1606628  
    55Requires at least: 3.5
    66Tested up to: 4.7.1
    7 Stable tag: 1.2.1
     7Stable tag: 1.2.2
    88License: GPLv2 or later
    99
     
    109109
    110110== Changelog ==
     111= 1.2.2 =
     112* Brand NEW design.Bug fixes
     113
    111114= 1.2.1 =
    112115* Brand NEW design. Interface changes for easier access to multiple channels. Better and faster performance. Bug fixes
Note: See TracChangeset for help on using the changeset viewer.