Plugin Directory

Changeset 507062


Ignore:
Timestamp:
02/18/2012 07:02:04 PM (14 years ago)
Author:
smartfin
Message:

0.7.2

Location:
ssi-sumilux/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ssi-sumilux/trunk/readme.txt

    r506263 r507062  
    55Requires at least: 1.0
    66Tested up to: 3.3.1
    7 Stable tag: 0.7
     7Stable tag: 0.7.2
    88
    99This plugin is currently in the experimental stage, we plan to launch it for beta testing in early February, please use with caution.
     
    3030== Changelog ==
    3131
     32=0.7.2=
     33Fixed some bugs
     34Cleaning code
     35
    3236=0.7=
    3337Quick app settings from admin
  • ssi-sumilux/trunk/ssi.php

    r506263 r507062  
    44Plugin URI: http://ssi.sumilux.com
    55Description: Plugin for Social Sign-In from   <a href="http://demo.sumilux.com/ssi">Sumilux</a>
    6 Version: 0.7
     6Version: 0.7.2
    77Author: Serhiy Martynenko
    88Author URI: [email protected]
     
    1414define('SSI_TEMPLATES_DIR', SSI_DIR . 'templates/');
    1515define("SSI_PLUGIN_URL",WP_PLUGIN_URL.'/'.basename(dirname(__FILE__)));
    16 define("SSI_VERSION", "0.7");
     16define("SSI_VERSION", "0.7.2");
    1717
    1818
     
    2222    //define('APPKEY', get_option('ssi_debug_app_key'));
    2323        define('APPSECRET', get_option('ssi_debug_app_secret'));
    24         define('APPNAME', get_option('ssi_debug_widget_name'));
    2524        define('WIDGETNAME', get_option('ssi_debug_widget_name'));
    2625} else {
    2726   // define('APPKEY', get_option('ssi_app_key'));
    2827        define('APPSECRET', get_option('ssi_app_secret'));
    29         define('APPNAME', get_option('ssi_widget_name'));
    3028        define('WIDGETNAME', get_option('ssi_widget_name'));
    3129}
     
    5654function my_plugin_init() {
    5755    if (!session_id()){
    58 
    5956        session_start();
    60         }
     57    }
     58
    6159    if (isset($_POST['ssi_token'])) {
    6260        ssi_work_with_token();
    63 
    6461    }
    6562}
     
    7067        $links[] = '<a href="options-general.php?page=ssi-identifier">'.__('Settings').'</a>';
    7168    }
    72 
    7369    return $links;
    7470}
     
    8278//add_action('init', 'session');
    8379add_action('admin_menu', 'my_plugin_menu');
    84 if ((APPSECRET == "") || (APPNAME=="")){
    85 
     80
     81if ((APPSECRET == "") || (WIDGETNAME=="")){
    8682    add_action('admin_notices', 'ssi_admin_warnings');
    8783} else {
     
    9187
    9288
    93 //add_action('wp_footer', 'ssi_ui_comment_form');
    94 
    95 
    9689
    9790function ssi_work_with_token(){
    9891
    99     //session_start();
    10092    $token = $_POST['ssi_token'];
    101 
    102     $ssi = new Services_Sumilux_SSI(APPNAME, APPSECRET);
    103 
     93    $ssi = new Services_Sumilux_SSI(WIDGETNAME, APPSECRET);
    10494
    10595    $ssi->setToken($token);
    106 
    107 
    10896    $jo = $ssi->getUserProfile('current');
    10997
    110 
    11198    global $wpdb;
    112 
    113 
    11499    $WpUser = wp_get_current_user();
     100
    115101    if (empty($jo->primaryEmail)) {
    116102        $profile_email = $jo->user->userID . '@' . parse_url(get_option('siteurl'), PHP_URL_HOST);
     
    130116    }
    131117
    132 
    133     //$result = $wpdb->get_results( "SELECT COUNT(*) as cnt FROM $wpdb->users WHERE user_email = '".  $profile_email."' " );
    134 
    135 
    136118    if ($WpUser->ID) {
    137 
    138 
    139 
    140119        if (!$wpuid) {
    141 
    142 
    143120            SsiUser::setIdentity($WpUser->ID, $profile);
    144 
    145 
    146121            $update_data = array();
    147122            $update_data['ID'] = $WpUser->ID;
    148 
    149123
    150124            if ($profile->name->full_name) {
    151125                $update_data['display_name'] = $profile->name->full_name;
    152126                $name_parts = explode(" ", $profile->name->full_name);
    153 
    154127                $update_data['first_name'] = $name_parts[0];
    155128                $update_data['last_name'] = $name_parts[1];
     
    175148    } elseif (!$WpUser->ID) {
    176149
    177 
    178150        if (!$wpuid) {
    179151            if (!email_exists($profile_email)) {
    180 
    181152                $wpuid = SsiUser::create($profile_email, $jo);
    182153            }
    183154        }
    184 
    185 
    186155        wp_safe_redirect($redirectURL);
    187 
    188 
    189156    }
    190157
    191158    if ($wpuid) {
    192 
    193159        wp_set_auth_cookie($wpuid, true, false);
    194160        wp_set_current_user($wpuid);
    195 
    196161        wp_safe_redirect($redirectURL);
    197162    }
     
    205170
    206171function ssi_admin_warnings() {
    207                echo "
    208             <div id='ssi-warning' class='updated fade'><p>You should set Widget name and App secret of <strong> \"SSI plugin\"</strong> <a href='/wp-admin/options-general.php?page=ssi-identifier'>here</a></p></div>
    209             ";
    210 
    211         return true;
    212 
     172    echo "<div id='ssi-warning' class='updated fade'><p>You should set Widget name and App secret of <strong> \"SSI plugin\"</strong> <a href='/wp-admin/options-general.php?page=ssi-identifier'>here</a></p></div>";
     173    return true;
    213174}
    214175
     
    220181    }
    221182    $plugname = "Ssi plugin for WordPress";
    222 
    223183    $shortname = "ssi";
    224 
    225184    $plugoptions = array(
    226 
    227185        array("name" => "SSI main options",
    228186            "type" => "title"),
    229 
    230187        array("name" => "Widget name",
    231188            "desc" => "Put widget name here",
     
    233190            "std" => "",
    234191            "type" => "text"),
    235 
    236192        array("name" => "App secret",
    237193            "desc" => "Put app secret here",
     
    259215            "id" => $shortname . "_debug_app_secret",
    260216            "std" => "",
    261             "type" => "text"),
    262 
    263         array("name" => "Language",
    264             "desc" => "Choose plugin language",
    265             "id" => $shortname . "_lang",
    266             "std" => "",
    267             "type" => "select"),
    268         /*array("name" => "App name",
    269             "desc" => "Put app name here",
    270             "id" => $shortname . "_app_name",
    271             "std" => "",
    272             "type" => "text"),   */
     217            "type" => "text"), */
    273218    );
    274219
     
    289234}
    290235
    291 /*Modifications to login at comments form*/
    292 /*function ssi_ui_comment_form()
     236function ssi_ui_login_form($type_show)
    293237{
    294238    $WpUser = wp_get_current_user();
    295     // if user is logged already
    296     if ($WpUser->ID) return;
    297     echo ssi_show_template('html_comment_login_form.tpl');
    298 }*/
    299 
    300 function ssi_ui_login_form($type_show)
    301 {
    302     $WpUser = wp_get_current_user();
    303239
    304240    $return_to = get_option('siteurl');
    305     if ($WpUser->ID) {
    306 
    307     }
    308 
    309 
    310     //get user from SSI server
    311   //  session_start();
     241
    312242
    313243    $returnURL = "http://".$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    314 
    315 
    316244    $authURL = getAuthURL($returnURL);
    317245
    318 
    319 
    320     /*if (isset($_POST['token'])) {
    321         ssi_work_with_token();
    322 
    323     }*/
    324 
    325 
    326246    $site_url = site_url() . '/wp-login.php';
    327247
    328248    if (DEBUG){
    329 
    330249        Services_Sumilux_SSI::setEndpoint("http://idmedemo.sumilux.com/smx/rpcService/xmlRpcService");
    331250    }
     
    334253    $html_block = Services_Sumilux_SSI::generateCode(
    335254        WIDGETNAME, // widget name
    336 
    337255        APPSECRET, // app secret
    338256        'medium-icon',
     
    347265        var respond_div = document.getElementById('loginform');
    348266
    349 
    350267        if (!respond_div) {
    351268        respond_div = document.getElementById(\"respond\");
     
    360277    </script>";
    361278    if ($type_show!=""){
    362 
    363279        $javacript_for_login = "";
    364280    }
    365 
    366 
    367 
    368281    // prepare data for template
    369282    $tpl_data = array(
     
    374287    );
    375288
    376 
    377 
    378289    if ($type_show==""){
    379290        include(SSI_TEMPLATES_DIR."login.php");
     
    381292        echo ssi_show_template('html_login_form.tpl', $tpl_data);
    382293    }
    383 
    384 
    385 
    386294}
    387295
     
    406314    $exitURL = "http://" . $exitURL;
    407315    $sig = md5($exitURL . APPSECRET); // signature
    408 
    409     $authURL = ENDPOINT . "/owa?exitURL=" . urlencode($exitURL) . "&sig=$sig&appName=" . APPNAME;
     316    $authURL = ENDPOINT . "/owa?exitURL=" . urlencode($exitURL) . "&sig=$sig&WIDGETNAME=" . WIDGETNAME;
    410317    return $authURL;
    411318}
     
    429336
    430337        foreach ($plugoptions as $value) {
    431 
    432338            update_option($value['id'], $_REQUEST[$value['id']]);
    433 
    434339        }
    435340
     
    451356    }
    452357
    453 
    454358}
    455359
     
    459363
    460364    $returnURL = "http://".$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    461     if (isset($_REQUEST["appName"]) && isset($_REQUEST["appSecret"]) ){
     365    if (isset($_REQUEST["WIDGETNAME"]) && isset($_REQUEST["appSecret"]) ){
    462366       
    463367        $ssi_recieved['ssi_app_secret'] = $_REQUEST["appSecret"];
    464         $ssi_recieved['ssi_widget_name'] = $_REQUEST["appName"];
     368        $ssi_recieved['ssi_widget_name'] = $_REQUEST["WIDGETNAME"];
    465369    }
    466370    include(SSI_TEMPLATES_DIR."options.php");
Note: See TracChangeset for help on using the changeset viewer.