Plugin Directory

Changeset 1712683


Ignore:
Timestamp:
08/12/2017 11:21:06 PM (9 years ago)
Author:
paulq
Message:

custom user agent support

Location:
chatwee/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • chatwee/trunk/chatwee-admin.php

    r1599121 r1712683  
    11<?php
    2    
     2
    33    if (!defined('ABSPATH')) exit;
    44
     
    1919    }
    2020
    21    
     21
    2222    function save_display_properties_settings() {
    2323        $chatwee_settings = get_option("chatwee_settings");
     
    2727        update_option("chatwee_settings", $chatwee_settings);
    2828    }
    29 
    30 
    3129
    3230    function save_general_settings() {
     
    3634        $chatwee_settings["chatwee_script"] = $_POST["chatwee_script"];
    3735        $chatwee_settings["disable_offline_users"] = isSet($_POST["disable_offline_users"]) ? true : false;
    38        
     36
    3937        update_option("chatwee_settings", $chatwee_settings);
    4038    }
     
    6967
    7068        $logs = get_logs();
    71        
     69
    7270        $file = dirname( __FILE__ ) . "/chatwee_config.json";
    7371        $current = @file_get_contents($file);
    7472        $current = json_encode($settings) . json_encode($logs);
    7573        file_put_contents($file, $current);
    76    
     74
    7775        header('Content-Type: application/octet-stream');
    7876        header('Content-Disposition: attachment; filename=' . basename($file));
     
    209207                                            <input type="submit" name="chatwee_display_properties_submit" class="button-primary" value="Save changes" />
    210208                                        </td>
    211                                     </tr>           
     209                                    </tr>
    212210                                </table>
    213211                            </form>
     
    339337                </div>
    340338
    341                
     339
    342340
    343341                <div class="chatwee-content-box chatwee-side-box">
     
    396394        wp_register_script('chatwee_admin_script_user_list_item', plugin_dir_url(__FILE__) . 'js/toolkit/UserListItem.js', false, 'CFFVER');
    397395        wp_enqueue_script('chatwee_admin_script_user_list_item');
    398        
     396
    399397        wp_register_script('chatwee_admin_script_page_picker', plugin_dir_url(__FILE__) . 'js/toolkit/PagePicker.js', false, 'CFFVER');
    400398        wp_enqueue_script('chatwee_admin_script_page_picker');
     
    433431    function search_page() {
    434432        global $wpdb;
    435        
    436         $pages_query = $wpdb->get_results( 
     433
     434        $pages_query = $wpdb->get_results(
    437435            $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_title LIKE '%%" . $_POST['search_name'] . "%%' AND post_status = 'publish' AND (post_type = 'post' OR post_type = 'page') LIMIT 10")
    438436        );
    439        
     437
    440438        $pages_found = $pages_query;
    441439
     
    544542            }
    545543        }
    546    
     544
    547545        echo json_encode($result);
    548546        exit;
  • chatwee/trunk/chatwee.php

    r1712502 r1712683  
    55    Plugin URI: https://chatwee.com/
    66    Description: WordPress Chat by Chatwee is fully customizable social chat & comment platform for websites and blogs. With Chatwee you can engage your online community and provide real-time communication.
    7     Version: 2.0.2
     7    Version: 2.0.3
    88    Author: Chatwee Ltd
    99    Author URI: https://chatwee.com/
     
    9696    }
    9797
    98 
    99 
    10098    function if_user_is_moderator($user_id) {
    10199        global $wpdb;
     
    152150        ChatweeV2_Configuration::setChatId($chatwee_settings["chat_id"]);
    153151        ChatweeV2_Configuration::setClientKey($chatwee_settings["client_key"]);
     152        ChatweeV2_Configuration::setCustomUserAgent("Chatwee Wordpress Plugin 2.0.3");
    154153
    155154        if($chatwee_settings["disable_offline_users"] === true && $chatwee_settings["enable_sso"] === true && is_user_logged_in() === false && ChatweeV2_Session::isSessionSet() === true) {
  • chatwee/trunk/lib/ChatweeV2_SDK/Chatwee/HttpClient.php

    r1564521 r1712683  
    44{
    55    const API_URL = "http://chatwee-api.com/v2/";
     6
     7    const USER_AGENT_HEADER = "ChatweeV2 PHP SDK 1.02 RAW";
    68
    79    private $response;
     
    2830        $curl = curl_init();
    2931
     32        $customUserAgent = ChatweeV2_Configuration::getCustomUserAgent();
     33        $userAgent = $customUserAgent ? $customUserAgent : self::USER_AGENT_HEADER;
     34
    3035        curl_setopt($curl, CURLOPT_TIMEOUT, 60);
    3136        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
     
    3641            'Accept: application/xml',
    3742            'Content-Type: application/xml',
    38             'User-Agent: ChatweeV2 PHP SDK 1.01'
     43            'User-Agent: ' . $userAgent
    3944        ));
    4045
     
    5863        $result = "";
    5964        foreach($parameters as $key => $value) {
    60             $result .= ($key . "=" . ($value ? urlencode(htmlentities($value)) : $value) . '&');
     65            $result .= ($key . "=" . ($value ? urlencode($value) : $value) . '&');
    6166        }
    6267
  • chatwee/trunk/lib/ChatweeV2_SDK/Chatwee/Session.php

    r1564521 r1712683  
    33class ChatweeV2_Session
    44{
     5    const SESSION_DURATION = 86400;
     6
    57    private static function getCookieKey() {
    68        if(ChatweeV2_Configuration::isConfigurationSet() === false) {
     
    2325        $cookieDomain = "." . implode(".", $hostChunks);
    2426
    25         setcookie(self::getCookieKey(), $sessionId, time() + 2592000, "/", $cookieDomain);
     27        setcookie(self::getCookieKey(), $sessionId, time() + self::SESSION_DURATION, "/", $cookieDomain);
    2628    }
    2729
  • chatwee/trunk/lib/ChatweeV2_SDK/Chatwee/SsoManager.php

    r1587657 r1712683  
    2626
    2727        $sessionId = ChatweeV2_SsoUser::login(Array(
    28             "userId" => $parameters["userId"]
     28            "userId" => $parameters["userId"],
     29            "userIp" => ChatweeV2_Utils::getUserIp()
    2930        ));
    3031
  • chatwee/trunk/readme.txt

    r1712004 r1712683  
    135135*   Plugin GUI improved
    136136
    137 = 2.0.2 =
    138 
    139 *   SSO session validation
    140 
    141137== Frequently Asked Questions ==
    142138
Note: See TracChangeset for help on using the changeset viewer.