Plugin Directory

Changeset 535016


Ignore:
Timestamp:
04/23/2012 10:07:48 AM (14 years ago)
Author:
siteheart
Message:
 
Location:
hypercomments/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • hypercomments/trunk/hypercomments.php

    r521773 r535016  
    44Plugin URI: http://hypercomments.com/
    55Description: HyperComments - New dimension of comments. Hypercomments technology allows commenting a specific word or a piece of text.
    6 Version: 1.0.5
     6Version: 1.0.6
    77Author:  Alexandr Bazik, Dmitry Goncharov, Inna Goncharova
    88Author URI: http://hypercomments.com/
     
    1111define('HC_URL', 'http://hypercomments.com');
    1212require_once(dirname(__FILE__) . '/export.php');
    13 define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    14 define('HC_PLUGIN_URL', WP_CONTENT_URL . '/plugins/hypercomments');
     13define('HC_CONTENT_URL', get_option('siteurl') . '/wp-content');
     14define('HC_PLUGIN_URL', HC_CONTENT_URL . '/plugins/hypercomments');
    1515define('HC_XML_PATH',$_SERVER['DOCUMENT_ROOT'].'/wp-content/uploads');
    1616$is_append = false;
     
    5454                         $file_root = HC_XML_PATH.'/'.$file_name;
    5555
    56                          $file_path = WP_CONTENT_URL.'/uploads/'.$file_name;
     56                         $file_path = HC_CONTENT_URL.'/uploads/'.$file_name;
    5757                         $write_file = file_put_contents($file_root, $wxr);
    5858                         if($write_file){
     
    7777                update_option('hc_wid', $_GET['wid']);
    7878                update_option('hc_access', $_GET['access']);
     79                update_option('hc_secret_key', $_GET['secret_key']);
     80                update_option('hc_synch', 'on');
    7981                echo $_GET['access'];
    8082                die();
     
    9092                exit();
    9193            break;
     94            case 'notify':
     95                $data = $_POST['data'];
     96                $time = $_POST['time'];
     97                $signature = $_POST['signature'];
     98               
     99                if((time() - $time) <= 60){                 
     100                    if(get_option('hc_secret_key')){                       
     101                         $data_sign = str_replace('\\','',$data);                   
     102                         if($signature == md5(get_option('hc_secret_key').$data_sign.$time)){
     103                             $data_decode = json_decode($data_sign);                                   
     104                             foreach($data_decode as $cmd){
     105                                 
     106                                 switch($cmd->cmd){
     107                                     case 'streamMessage':                                       
     108                                         $post_id_mas = explode('?', $cmd->xid);
     109                                         $pos = strpos($cmd->xid,'=');                                         
     110                                         $post_id = substr($cmd->xid, $pos+1);
     111                                         $data = array(
     112                                            'comment_post_ID' => $post_id,
     113                                            'comment_author' => $cmd->nick,                                         
     114                                            'comment_content' => $cmd->text,                                         
     115                                            'comment_parent' => $cmd->parent_id,                                                                                   
     116                                            'comment_date' => date('Y-m-d H:i:s', time() + (get_option('gmt_offset') * 3600)),
     117                                            'comment_date_gmt' => date('Y-m-d H:i:s'),
     118                                            'comment_approved' => 1,
     119                                        );   
     120                                        if(isset($cmd->user_id)){
     121                                            $data['user_id'] = $cmd->user_id;
     122                                        }else{
     123                                            $data['user_id'] = 0;
     124                                        }
     125                                        if(isset($cmd->ip)){
     126                                            $data['comment_author_IP'] = $cmd->ip;
     127                                        }else{
     128                                            $data['comment_author_IP'] = '';
     129                                        }
     130                                        $comments_id = wp_insert_comment($data);
     131                                        update_comment_meta($comments_id,'hc_comment_id',$cmd->id);                                       
     132                                     break;
     133                                     case 'streamEditMessage':                                     
     134                                         $comments_id = $wpdb->get_var($wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'hc_comment_id' AND meta_value = %s LIMIT 1", $cmd->id));
     135                                         $commentarr = array();
     136                                         $commentarr['comment_ID'] = $comments_id; 
     137                                         $commentarr['comment_content'] = $cmd->text;                                       
     138                                         wp_update_comment( $commentarr );                                       
     139                                     break;
     140                                     case 'streamRemoveMessage':
     141                                         $comments_id = $wpdb->get_var($wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'hc_comment_id' AND meta_value = %s LIMIT 1", $cmd->id));
     142                                         wp_delete_comment ($comments_id);                                       
     143                                     break;
     144                                 }                               
     145                             }
     146                         }
     147                    }                 
     148                }
     149            break;
    92150        }
    93151    }
     
    121179     delete_option('hc_selector');
    122180     delete_option('hc_title_widget');
     181     delete_option('hc_secret_key');
     182     delete_option('hc_synch');
    123183}
    124184/**
     
    161221<script type="text/javascript">
    162222var _hcp = _hcp || {};_hcp.widget_id = <?php echo get_option('hc_wid');?>;_hcp.widget = "Stream";_hcp.platform = "wordpress";
    163 _hcp.language = "<?php echo hc_get_language();?>";_hcp.xid = "<?php echo $url?>";
     223_hcp.language = "<?php echo hc_get_language();?>";_hcp.xid = "<?php echo $url?>";<?php echo hc_get_auth();?>
    164224<?php if(HC_DEV) echo '_hcp.hc_test=1;';?>
    165225(function() {
     
    219279             delete_option('hc_title_widget');
    220280         }
     281         if(isset($_POST['hc_synch'])){
     282            update_option( 'hc_synch',  $_POST['hc_synch'] );
     283         }else{
     284             delete_option('hc_synch');
     285         }
     286         if(isset($_POST['hc_secret_key'])){
     287            update_option( 'hc_secret_key',  $_POST['hc_secret_key'] );
     288         }else{
     289             delete_option('hc_secret_key');
     290         }
    221291         echo '<div class="updated"><p><strong>'.__('Options saved', 'hypercomments').'</strong></p></div>';
    222292     }
     
    276346 */
    277347function hc_the_content_filter( $content ) {
    278     global $post;      
     348    global $post;     
    279349    global $is_append;   
     350    global $user;
    280351    $parse = parse_url($post->guid);
    281352    $url = str_replace('https://','',str_replace('http://','',str_replace('www.','',str_replace($parse['host'], get_option('home'), $post->guid)))); 
     
    294365       if($post->comment_status == 'open'){   
    295366           $is_append = true;
     367         
    296368           $wid = '<div id="hypercomments_widget"></div>
    297369           <script type="text/javascript">
    298370           var _hcp = _hcp || {};_hcp.widget_id = '.get_option('hc_wid').';_hcp.widget = "Stream";_hcp.platform="wordpress";
    299            _hcp.language = "'.hc_get_language().'";_hcp.xid = "'.$url.'";         
     371           _hcp.language = "'.hc_get_language().'";_hcp.xid = "'.$url.'";'.hc_get_auth().'         
    300372           (function() {
    301373            var hcc = document.createElement("script"); hcc.type = "text/javascript"; hcc.async = true;
     
    309381    return $content;
    310382}
    311 
    312 ?>
     383/**
     384 * Get auth token
     385 * @global type $user
     386 * @return string
     387 */
     388function hc_get_auth(){
     389    global $current_user;
     390    get_currentuserinfo();
     391    if(is_user_logged_in() && get_option('hc_synch')){
     392         $user = array(
     393                'nick'   => $current_user->user_nicename,
     394                'avatar' => '',
     395                'id'     => $current_user->ID,
     396                'email'  => $current_user->user_email
     397          );
     398          $secret = get_option('hc_secret_key');
     399          $time   = time();   
     400          $base64 = base64_encode(json_encode($user));   
     401          $sign   = md5($secret . $base64 . $time);
     402          $auth = $base64 . "_" . $time . "_" . $sign;
     403          $hcp = '_hcp.auth="'.$auth.'";';             
     404    }else{
     405          $hcp = '';
     406    }
     407    return $hcp;
     408}
     409?>
  • hypercomments/trunk/locales/hypercomments-ru_RU.po

    r519863 r535016  
    33"Project-Id-Version: HyperComments\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2012-03-15 18:15+0300\n"
    6 "PO-Revision-Date: 2012-03-15 18:16+0300\n"
     5"POT-Creation-Date: 2012-04-18 12:49+0300\n"
     6"PO-Revision-Date: 2012-04-18 12:52+0300\n"
    77"Last-Translator: neman <neman1989@yandex.ru>\n"
    88"Language-Team:  <neman1989@gmail.com>\n"
     
    1818"X-Poedit-SearchPath-0: /var/www/workpressblog/wp-content/plugins/hypercomments\n"
    1919
    20 #: /var/www/workpressblog/wp-content/plugins/hypercomments/hypercomments.php:69
     20#: /var/www/workpressblog/wp-content/plugins/hypercomments/hypercomments.php:68
    2121msgid "Error writing XML"
    2222msgstr "Ошибка записи XML"
    2323
    24 #: /var/www/workpressblog/wp-content/plugins/hypercomments/hypercomments.php:72
     24#: /var/www/workpressblog/wp-content/plugins/hypercomments/hypercomments.php:71
    2525msgid "Failed to generate XML"
    2626msgstr "Ошибка создания XML"
    2727
    28 #: /var/www/workpressblog/wp-content/plugins/hypercomments/hypercomments.php:218
     28#: /var/www/workpressblog/wp-content/plugins/hypercomments/hypercomments.php:284
    2929msgid "Options saved"
    3030msgstr "Настройки сохранены"
    3131
    32 #: /var/www/workpressblog/wp-content/plugins/hypercomments/hypercomments.php:241
     32#: /var/www/workpressblog/wp-content/plugins/hypercomments/hypercomments.php:307
    3333msgid "You must <a href=\"edit-comments.php?page=hypercomments\">configure the plugin</a> to enable HyperComments."
    3434msgstr "Вы должны <a href=\"edit-comments.php?page=hypercomments\">настроить плагин</a> чтобы включить HyperComments."
     
    7272
    7373#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:79
     74#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:91
    7475msgid "on/off"
    7576msgstr "вкл/выкл"
    7677
    77 #: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:90
     78#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:86
     79msgid "Synchronizing users and comments"
     80msgstr "Синхронизировать пользователей и комментарии"
     81
     82#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:103
    7883msgid "Update Options"
    7984msgstr "Обновить настройки"
    8085
    81 #: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:97
    82 #: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:100
     86#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:110
     87#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:113
    8388msgid "Import comments to HyperComments"
    8489msgstr "Импортировать комментарии в HyperComments"
    8590
    86 #: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:107
     91#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:120
    8792msgid "Formation file comments..."
    8893msgstr "Формирование файла комментариев"
    8994
    90 #: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:108
     95#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:121
    9196msgid "Sending a request to import comments..."
    9297msgstr "Отправка запроса на импорт комментариев"
    9398
    94 #: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:225
     99#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:239
    95100msgid "Error when trying to generate XML"
    96101msgstr "Ошибка при попытке сформировать XML"
    97102
    98 #: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:242
     103#: /var/www/workpressblog/wp-content/plugins/hypercomments/manage.php:256
    99104msgid "Comments will be imported at least 15 minutes."
    100105msgstr "Комментарии будут импортированы в течении 15 минут"
  • hypercomments/trunk/manage.php

    r521745 r535016  
    6161 <?php if(get_option('hc_wid') && get_option('hc_access') == 'admin'):?>       
    6262 <div class="hc_box hc_settings" style="display:none">
    63      <form name="form_counter" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
     63     <form name="form_counter" id="form_settings" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
    6464     <table>         
    6565         <tr>
     
    8484         </tr>
    8585         <tr>
     86             <td><?php _e('Synchronizing users and comments', 'hypercomments' ); ?></td>
     87             <td>                               
     88                     <p>
     89                         <label>
     90                         <input type="checkbox" name="hc_synch"  <?php echo (get_option('hc_synch') ? 'checked="checked"' : '');?> />                       
     91                         <?php _e('on/off', 'hypercomments' ); ?>
     92                         </label>
     93                    </p>
     94                               
     95             </td>
     96         </tr>
     97         <tr>
    8698             <td></td>
    8799             <td>
    88100                 <p>
    89                           <input type="hidden" name="hc_form_counter_sub" value="Y">
    90                         <input type="submit" name="Submit" value="<?php _e('Update Options', 'hypercomments' ) ?>" />
     101                        <input type="hidden" name="hc_secret_key" value="" />
     102                        <input type="hidden" name="hc_form_counter_sub" value="Y" />
     103                        <input type="submit" name="Submit" id="sub_settings" value="<?php _e('Update Options', 'hypercomments' ) ?>" />
    91104                  </p>
    92105               
     
    149162                 cluster: "c1",
    150163                 platform: "wordpress",
     164                 notify_url:"<?php echo admin_url('index.php');?>?hc_action=notify",
    151165                 <?php if(hc_enableParams()){echo 'enableParams: true';}?>               
    152166             },
     
    155169                    setCookie("wid", data.wid, "Mon, 01-Jan-2100 00:00:00 GMT", "/");
    156170                    setCookie("hc_es", data.es, "Mon, 01-Jan-2100 00:00:00 GMT", "/");
    157                     saveWid(data)
     171                    saveWid(data);
    158172                  }else{
    159173                      jQueryHC('#code').text(data.description).show(function(){
     
    236250      function sendNotify(obj){ 
    237251            jQueryHC('.e_import_comments p').last().show();
    238              jQueryHC.getJSON('<?php echo HC_URL;?>/api/import?response_type=callback&callback=?',obj,
     252            jQueryHC.getJSON('<?php echo HC_URL;?>/api/import?response_type=callback&callback=?',obj,
    239253             function (data) {
    240254                  if(data.result == 'success'){
     
    253267             });         
    254268      }   
     269     
     270      jQueryHC('#sub_settings').click(function(){
     271             var site_auth = jQueryHC('input[name=hc_synch]').is(':checked');
     272             jQueryHC.getJSON('<?php echo HC_URL;?>/widget/auth?response_type=callback&callback=?',
     273             {site_auth:site_auth,wid:<?php echo (get_option('hc_wid')) ? get_option('hc_wid') : '" "';?>,notify_url:"<?php echo admin_url('index.php');?>?hc_action=notify"},
     274             function (data) {
     275                  if(data.result == 'success'){     
     276                       jQueryHC('input[name=hc_secret_key]').val(data.secret_key);
     277                       jQueryHC('#form_settings').submit();                     
     278                  }else{                     
     279                       jQueryHC('#import_hc strong').text(data.description);
     280                       jQueryHC('#import_hc').show(function(){
     281                           jQueryHC(this).delay(30000).fadeOut();
     282                       });   
     283                     
     284                  }             
     285             });   
     286             return false;
     287      })
    255288 });
    256289     
  • hypercomments/trunk/readme.txt

    r522638 r535016  
    44Donate link: http://hypercomments.com/
    55Tags: hyperComments, comments, threaded, email, notification, spam, avatars, community, profile, widget
    6 Requires at least: 1.0.5
    7 Tested up to: 1.0.5
    8 Stable tag: 1.0.5
     6Requires at least: 1.0.6
     7Tested up to: 1.0.6
     8Stable tag: 1.0.6
    99
    1010The HyperComments technology replaces your WordPress comment system with your comments hosted and powered by HyperComments
     
    9595
    9696== Changelog ==
     97**1.0.6**
     98
     99Added synchronization of users<br />
     100Added synchronization comments<br />
     101
    97102**1.0.5**
    98103
Note: See TracChangeset for help on using the changeset viewer.