@@ -38,7 +38,7 @@ public static function show_list_type_friends()
38
38
{
39
39
$ table = Database::get_main_table (TABLE_MAIN_USER_FRIEND_RELATION_TYPE );
40
40
$ sql = 'SELECT id, title FROM ' .$ table .'
41
- WHERE id<>6
41
+ WHERE id<>6
42
42
ORDER BY id ASC ' ;
43
43
$ result = Database::query ($ sql );
44
44
$ friend_relation_list = [];
@@ -68,10 +68,10 @@ public static function get_relation_between_contacts($user_id, $user_friend)
68
68
{
69
69
$ table = Database::get_main_table (TABLE_MAIN_USER_FRIEND_RELATION_TYPE );
70
70
$ userRelUserTable = Database::get_main_table (TABLE_MAIN_USER_REL_USER );
71
- $ sql = 'SELECT rt.id as id
71
+ $ sql = 'SELECT rt.id as id
72
72
FROM ' .$ table .' rt
73
73
WHERE rt.id = (
74
- SELECT uf.relation_type
74
+ SELECT uf.relation_type
75
75
FROM ' .$ userRelUserTable .' uf
76
76
WHERE
77
77
user_id= ' .((int ) $ user_id ).' AND
@@ -274,18 +274,18 @@ public static function send_invitation_friend(
274
274
} else {
275
275
// invitation already exist
276
276
$ sql = 'SELECT COUNT(*) AS count, id FROM ' .$ tbl_message .'
277
- WHERE
278
- user_sender_id= ' .$ user_id .' AND
279
- user_receiver_id= ' .$ friend_id .' AND
277
+ WHERE
278
+ user_sender_id= ' .$ user_id .' AND
279
+ user_receiver_id= ' .$ friend_id .' AND
280
280
msg_status = 7 ' ;
281
281
$ res_if_exist = Database::query ($ sql );
282
282
$ row_if_exist = Database::fetch_array ($ res_if_exist , 'ASSOC ' );
283
283
if ($ row_if_exist ['count ' ] == 1 ) {
284
284
$ sql = 'UPDATE ' .$ tbl_message .' SET
285
285
msg_status = 5, content = " ' .$ clean_message_content .'"
286
- WHERE
287
- user_sender_id= ' .$ user_id .' AND
288
- user_receiver_id= ' .$ friend_id .' AND
286
+ WHERE
287
+ user_sender_id= ' .$ user_id .' AND
288
+ user_receiver_id= ' .$ friend_id .' AND
289
289
msg_status = 7 ' ;
290
290
Database::query ($ sql );
291
291
@@ -379,12 +379,12 @@ public static function getCountWallPostedMessages($userId)
379
379
}
380
380
381
381
$ table = Database::get_main_table (TABLE_MESSAGE );
382
- $ sql = 'SELECT COUNT(*)
382
+ $ sql = 'SELECT COUNT(*)
383
383
FROM ' .$ table .'
384
384
WHERE
385
385
user_sender_id= ' .$ userId .' AND
386
- (msg_status = ' .MESSAGE_STATUS_WALL .' OR
387
- msg_status = ' .MESSAGE_STATUS_WALL_POST .') AND
386
+ (msg_status = ' .MESSAGE_STATUS_WALL .' OR
387
+ msg_status = ' .MESSAGE_STATUS_WALL_POST .') AND
388
388
parent_id = 0 ' ;
389
389
$ res = Database::query ($ sql );
390
390
$ row = Database::fetch_row ($ res );
@@ -851,9 +851,7 @@ public static function show_social_avatar_block($show = '', $group_id = 0, $user
851
851
);
852
852
}
853
853
854
- $ skillBlock = $ template ->get_template ('social/avatar_block.tpl ' );
855
-
856
- return $ template ->fetch ($ skillBlock );
854
+ return $ template ->fetch ($ template ->get_template ('social/avatar_block.tpl ' ));
857
855
}
858
856
859
857
/**
@@ -1630,7 +1628,7 @@ public static function getWallMessages(
1630
1628
1631
1629
// Get my own posts
1632
1630
$ userReceiverCondition = ' (
1633
- user_receiver_id = ' .$ userId .' AND
1631
+ user_receiver_id = ' .$ userId .' AND
1634
1632
msg_status IN ( ' .MESSAGE_STATUS_WALL_POST .', ' .MESSAGE_STATUS_WALL .') AND
1635
1633
parent_id = ' .$ parentId .'
1636
1634
) ' ;
@@ -1677,7 +1675,7 @@ public static function getWallMessages(
1677
1675
if ($ getCount ) {
1678
1676
$ select = ' SELECT count(iid) count_items ' ;
1679
1677
} else {
1680
- $ select = " SELECT
1678
+ $ select = " SELECT
1681
1679
iid as id,
1682
1680
poster_id as user_sender_id,
1683
1681
'' as user_receiver_id,
@@ -1688,16 +1686,16 @@ public static function getWallMessages(
1688
1686
'' as group_id,
1689
1687
forum_id,
1690
1688
thread_id,
1691
- c_id
1689
+ c_id
1692
1690
" ;
1693
1691
}
1694
1692
1695
1693
$ threadList = array_map ('intval ' , $ threadList );
1696
1694
$ threadList = implode ("',' " , $ threadList );
1697
1695
$ condition = " thread_id IN (' $ threadList') " ;
1698
1696
$ sql [5 ] = "$ select
1699
- FROM c_forum_post
1700
- WHERE $ condition
1697
+ FROM c_forum_post
1698
+ WHERE $ condition
1701
1699
" ;
1702
1700
}
1703
1701
@@ -1861,16 +1859,16 @@ public static function processPostComment($message, $users = [])
1861
1859
$ comment .= '<div class="col-md-2 col-xs-2 social-post-answers"> ' ;
1862
1860
$ comment .= '<div class="user-image pull-right"> ' ;
1863
1861
$ comment .= '<a href=" ' .$ url .'">
1864
- <img src=" ' .$ users [$ userIdLoop ]['avatar ' ].'"
1865
- alt=" ' .$ users [$ userIdLoop ]['complete_name ' ].'"
1862
+ <img src=" ' .$ users [$ userIdLoop ]['avatar ' ].'"
1863
+ alt=" ' .$ users [$ userIdLoop ]['complete_name ' ].'"
1866
1864
class="avatar-thumb">
1867
1865
</a> ' ;
1868
1866
$ comment .= '</div> ' ;
1869
1867
$ comment .= '</div> ' ;
1870
1868
$ comment .= '<div class="col-md-7 col-xs-7 social-post-answers"> ' ;
1871
1869
$ comment .= '<div class="user-data"> ' ;
1872
1870
$ comment .= $ iconStatus ;
1873
- $ comment .= '<div class="username"><a href=" ' .$ url .'"> ' .$ nameComplete .'</a>
1871
+ $ comment .= '<div class="username"><a href=" ' .$ url .'"> ' .$ nameComplete .'</a>
1874
1872
<span> ' .Security::remove_XSS ($ message ['content ' ]).'</span>
1875
1873
</div> ' ;
1876
1874
$ comment .= '<div> ' .$ date .'</div> ' ;
@@ -2098,7 +2096,7 @@ public static function setSocialUserBlock(
2098
2096
$ groupId = 0 ,
2099
2097
$ show_full_profile = true
2100
2098
) {
2101
- if (api_get_setting ('allow_social_tool ' ) != 'true ' ) {
2099
+ if (api_get_setting ('allow_social_tool ' ) !== 'true ' ) {
2102
2100
return '' ;
2103
2101
}
2104
2102
@@ -2656,8 +2654,8 @@ public static function getExtraFieldBlock($user_id, $isArray = false)
2656
2654
$ value_options = [];
2657
2655
// get option display text from user_field_options table
2658
2656
foreach ($ id_options as $ id_option ) {
2659
- $ sql = "SELECT display_text
2660
- FROM $ t_ufo
2657
+ $ sql = "SELECT display_text
2658
+ FROM $ t_ufo
2661
2659
WHERE id = ' $ id_option' " ;
2662
2660
$ res_options = Database::query ($ sql );
2663
2661
$ row_options = Database::fetch_row ($ res_options );
@@ -2863,82 +2861,82 @@ public static function getScrollJs($countPost, &$htmlHeadXtra)
2863
2861
loadingHtml: "<div class=\"well_border\"> ' .get_lang ('Loading ' ).' </div>",
2864
2862
nextSelector: "a.nextPage:last",
2865
2863
contentSelector: "",
2866
- callback: timeAgo
2864
+ callback: timeAgo
2867
2865
});
2868
2866
});
2869
2867
</script> ' ;
2870
2868
}
2871
2869
2872
2870
$ htmlHeadXtra [] = '<script>
2873
- function deleteMessage(id)
2874
- {
2871
+ function deleteMessage(id)
2872
+ {
2875
2873
$.ajax({
2876
2874
url: " ' .$ socialAjaxUrl .'?a=delete_message" + "&id=" + id,
2877
2875
success: function (result) {
2878
2876
if (result) {
2879
2877
$("#message_" + id).parent().parent().parent().parent().html(result);
2880
2878
}
2881
2879
}
2882
- });
2880
+ });
2883
2881
}
2884
-
2885
- function deleteComment(id)
2886
- {
2882
+
2883
+ function deleteComment(id)
2884
+ {
2887
2885
$.ajax({
2888
2886
url: " ' .$ socialAjaxUrl .'?a=delete_message" + "&id=" + id,
2889
2887
success: function (result) {
2890
2888
if (result) {
2891
2889
$("#message_" + id).parent().parent().parent().html(result);
2892
2890
}
2893
2891
}
2894
- });
2895
- }
2896
-
2897
- function submitComment(messageId)
2892
+ });
2893
+ }
2894
+
2895
+ function submitComment(messageId)
2898
2896
{
2899
- var data = $("#form_comment_"+messageId).serializeArray();
2897
+ var data = $("#form_comment_"+messageId).serializeArray();
2900
2898
$.ajax({
2901
2899
type : "POST",
2902
2900
url: " ' .$ socialAjaxUrl .'?a=send_comment" + "&id=" + messageId,
2903
2901
data: data,
2904
- success: function (result) {
2902
+ success: function (result) {
2905
2903
if (result) {
2906
2904
$("#post_" + messageId + " textarea").val("");
2907
2905
$("#post_" + messageId + " .sub-mediapost").prepend(result);
2908
2906
$("#post_" + messageId + " .sub-mediapost").append(
2909
2907
$( \'<div id=result_ \' + messageId + \'> ' .addslashes (get_lang ('Saved ' )).'</div> \')
2910
- );
2911
-
2908
+ );
2909
+
2912
2910
$("#result_" + messageId + "").fadeIn("fast", function() {
2913
2911
$("#result_" + messageId + "").delay(1000).fadeOut("fast", function() {
2914
2912
$(this).remove();
2915
- });
2913
+ });
2916
2914
});
2917
2915
}
2918
2916
}
2919
- });
2920
- }
2921
-
2917
+ });
2918
+ }
2919
+
2922
2920
$(function() {
2923
2921
timeAgo();
2924
-
2922
+
2925
2923
/*$(".delete_message").on("click", function() {
2926
2924
var id = $(this).attr("id");
2927
- id = id.split("_")[1];
2925
+ id = id.split("_")[1];
2928
2926
$.ajax({
2929
2927
url: " ' .$ socialAjaxUrl .'?a=delete_message" + "&id=" + id,
2930
2928
success: function (result) {
2931
2929
if (result) {
2932
2930
$("#message_" + id).parent().parent().parent().parent().html(result);
2933
2931
}
2934
2932
}
2935
- });
2936
- });
2937
-
2938
-
2933
+ });
2934
+ });
2935
+
2936
+
2939
2937
$(".delete_comment").on("click", function() {
2940
2938
var id = $(this).attr("id");
2941
- id = id.split("_")[1];
2939
+ id = id.split("_")[1];
2942
2940
$.ajax({
2943
2941
url: " ' .$ socialAjaxUrl .'?a=delete_message" + "&id=" + id,
2944
2942
success: function (result) {
@@ -2947,10 +2945,10 @@ function submitComment(messageId)
2947
2945
}
2948
2946
}
2949
2947
});
2950
- });
2948
+ });
2951
2949
*/
2952
2950
});
2953
-
2951
+
2954
2952
function timeAgo() {
2955
2953
$(".timeago").timeago();
2956
2954
}
0 commit comments