Skip to content

Commit 3f20a85

Browse files
committed
Minor - format code, remove commented code
1 parent e04c898 commit 3f20a85

File tree

6 files changed

+58
-124
lines changed

6 files changed

+58
-124
lines changed

main/auth/profile.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,7 @@ function show_image(image,width,height) {
321321
}
322322

323323
$extraField = new ExtraField('user');
324-
$return = $extraField->addElements(
325-
$form,
326-
api_get_user_id()
327-
);
328-
324+
$return = $extraField->addElements($form, api_get_user_id());
329325
$jquery_ready_content = $return['jquery_ready_content'];
330326

331327
// the $jquery_ready_content variable collects all functions that

main/inc/lib/social.lib.php

Lines changed: 52 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static function show_list_type_friends()
3838
{
3939
$table = Database::get_main_table(TABLE_MAIN_USER_FRIEND_RELATION_TYPE);
4040
$sql = 'SELECT id, title FROM '.$table.'
41-
WHERE id<>6
41+
WHERE id<>6
4242
ORDER BY id ASC';
4343
$result = Database::query($sql);
4444
$friend_relation_list = [];
@@ -68,10 +68,10 @@ public static function get_relation_between_contacts($user_id, $user_friend)
6868
{
6969
$table = Database::get_main_table(TABLE_MAIN_USER_FRIEND_RELATION_TYPE);
7070
$userRelUserTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
71-
$sql = 'SELECT rt.id as id
71+
$sql = 'SELECT rt.id as id
7272
FROM '.$table.' rt
7373
WHERE rt.id = (
74-
SELECT uf.relation_type
74+
SELECT uf.relation_type
7575
FROM '.$userRelUserTable.' uf
7676
WHERE
7777
user_id='.((int) $user_id).' AND
@@ -274,18 +274,18 @@ public static function send_invitation_friend(
274274
} else {
275275
// invitation already exist
276276
$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
280280
msg_status = 7';
281281
$res_if_exist = Database::query($sql);
282282
$row_if_exist = Database::fetch_array($res_if_exist, 'ASSOC');
283283
if ($row_if_exist['count'] == 1) {
284284
$sql = 'UPDATE '.$tbl_message.' SET
285285
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
289289
msg_status = 7 ';
290290
Database::query($sql);
291291

@@ -379,12 +379,12 @@ public static function getCountWallPostedMessages($userId)
379379
}
380380

381381
$table = Database::get_main_table(TABLE_MESSAGE);
382-
$sql = 'SELECT COUNT(*)
382+
$sql = 'SELECT COUNT(*)
383383
FROM '.$table.'
384384
WHERE
385385
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
388388
parent_id = 0';
389389
$res = Database::query($sql);
390390
$row = Database::fetch_row($res);
@@ -851,9 +851,7 @@ public static function show_social_avatar_block($show = '', $group_id = 0, $user
851851
);
852852
}
853853

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'));
857855
}
858856

859857
/**
@@ -1630,7 +1628,7 @@ public static function getWallMessages(
16301628

16311629
// Get my own posts
16321630
$userReceiverCondition = ' (
1633-
user_receiver_id = '.$userId.' AND
1631+
user_receiver_id = '.$userId.' AND
16341632
msg_status IN ('.MESSAGE_STATUS_WALL_POST.', '.MESSAGE_STATUS_WALL.') AND
16351633
parent_id = '.$parentId.'
16361634
)';
@@ -1677,7 +1675,7 @@ public static function getWallMessages(
16771675
if ($getCount) {
16781676
$select = ' SELECT count(iid) count_items ';
16791677
} else {
1680-
$select = " SELECT
1678+
$select = " SELECT
16811679
iid as id,
16821680
poster_id as user_sender_id,
16831681
'' as user_receiver_id,
@@ -1688,16 +1686,16 @@ public static function getWallMessages(
16881686
'' as group_id,
16891687
forum_id,
16901688
thread_id,
1691-
c_id
1689+
c_id
16921690
";
16931691
}
16941692

16951693
$threadList = array_map('intval', $threadList);
16961694
$threadList = implode("','", $threadList);
16971695
$condition = " thread_id IN ('$threadList') ";
16981696
$sql[5] = "$select
1699-
FROM c_forum_post
1700-
WHERE $condition
1697+
FROM c_forum_post
1698+
WHERE $condition
17011699
";
17021700
}
17031701

@@ -1861,16 +1859,16 @@ public static function processPostComment($message, $users = [])
18611859
$comment .= '<div class="col-md-2 col-xs-2 social-post-answers">';
18621860
$comment .= '<div class="user-image pull-right">';
18631861
$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'].'"
18661864
class="avatar-thumb">
18671865
</a>';
18681866
$comment .= '</div>';
18691867
$comment .= '</div>';
18701868
$comment .= '<div class="col-md-7 col-xs-7 social-post-answers">';
18711869
$comment .= '<div class="user-data">';
18721870
$comment .= $iconStatus;
1873-
$comment .= '<div class="username"><a href="'.$url.'">'.$nameComplete.'</a>
1871+
$comment .= '<div class="username"><a href="'.$url.'">'.$nameComplete.'</a>
18741872
<span>'.Security::remove_XSS($message['content']).'</span>
18751873
</div>';
18761874
$comment .= '<div>'.$date.'</div>';
@@ -2098,7 +2096,7 @@ public static function setSocialUserBlock(
20982096
$groupId = 0,
20992097
$show_full_profile = true
21002098
) {
2101-
if (api_get_setting('allow_social_tool') != 'true') {
2099+
if (api_get_setting('allow_social_tool') !== 'true') {
21022100
return '';
21032101
}
21042102

@@ -2656,8 +2654,8 @@ public static function getExtraFieldBlock($user_id, $isArray = false)
26562654
$value_options = [];
26572655
// get option display text from user_field_options table
26582656
foreach ($id_options as $id_option) {
2659-
$sql = "SELECT display_text
2660-
FROM $t_ufo
2657+
$sql = "SELECT display_text
2658+
FROM $t_ufo
26612659
WHERE id = '$id_option'";
26622660
$res_options = Database::query($sql);
26632661
$row_options = Database::fetch_row($res_options);
@@ -2863,82 +2861,82 @@ public static function getScrollJs($countPost, &$htmlHeadXtra)
28632861
loadingHtml: "<div class=\"well_border\">'.get_lang('Loading').' </div>",
28642862
nextSelector: "a.nextPage:last",
28652863
contentSelector: "",
2866-
callback: timeAgo
2864+
callback: timeAgo
28672865
});
28682866
});
28692867
</script>';
28702868
}
28712869

28722870
$htmlHeadXtra[] = '<script>
2873-
function deleteMessage(id)
2874-
{
2871+
function deleteMessage(id)
2872+
{
28752873
$.ajax({
28762874
url: "'.$socialAjaxUrl.'?a=delete_message" + "&id=" + id,
28772875
success: function (result) {
28782876
if (result) {
28792877
$("#message_" + id).parent().parent().parent().parent().html(result);
28802878
}
28812879
}
2882-
});
2880+
});
28832881
}
2884-
2885-
function deleteComment(id)
2886-
{
2882+
2883+
function deleteComment(id)
2884+
{
28872885
$.ajax({
28882886
url: "'.$socialAjaxUrl.'?a=delete_message" + "&id=" + id,
28892887
success: function (result) {
28902888
if (result) {
28912889
$("#message_" + id).parent().parent().parent().html(result);
28922890
}
28932891
}
2894-
});
2895-
}
2896-
2897-
function submitComment(messageId)
2892+
});
2893+
}
2894+
2895+
function submitComment(messageId)
28982896
{
2899-
var data = $("#form_comment_"+messageId).serializeArray();
2897+
var data = $("#form_comment_"+messageId).serializeArray();
29002898
$.ajax({
29012899
type : "POST",
29022900
url: "'.$socialAjaxUrl.'?a=send_comment" + "&id=" + messageId,
29032901
data: data,
2904-
success: function (result) {
2902+
success: function (result) {
29052903
if (result) {
29062904
$("#post_" + messageId + " textarea").val("");
29072905
$("#post_" + messageId + " .sub-mediapost").prepend(result);
29082906
$("#post_" + messageId + " .sub-mediapost").append(
29092907
$(\'<div id=result_\' + messageId +\'>'.addslashes(get_lang('Saved')).'</div>\')
2910-
);
2911-
2908+
);
2909+
29122910
$("#result_" + messageId + "").fadeIn("fast", function() {
29132911
$("#result_" + messageId + "").delay(1000).fadeOut("fast", function() {
29142912
$(this).remove();
2915-
});
2913+
});
29162914
});
29172915
}
29182916
}
2919-
});
2920-
}
2921-
2917+
});
2918+
}
2919+
29222920
$(function() {
29232921
timeAgo();
2924-
2922+
29252923
/*$(".delete_message").on("click", function() {
29262924
var id = $(this).attr("id");
2927-
id = id.split("_")[1];
2925+
id = id.split("_")[1];
29282926
$.ajax({
29292927
url: "'.$socialAjaxUrl.'?a=delete_message" + "&id=" + id,
29302928
success: function (result) {
29312929
if (result) {
29322930
$("#message_" + id).parent().parent().parent().parent().html(result);
29332931
}
29342932
}
2935-
});
2936-
});
2937-
2938-
2933+
});
2934+
});
2935+
2936+
29392937
$(".delete_comment").on("click", function() {
29402938
var id = $(this).attr("id");
2941-
id = id.split("_")[1];
2939+
id = id.split("_")[1];
29422940
$.ajax({
29432941
url: "'.$socialAjaxUrl.'?a=delete_message" + "&id=" + id,
29442942
success: function (result) {
@@ -2947,10 +2945,10 @@ function submitComment(messageId)
29472945
}
29482946
}
29492947
});
2950-
});
2948+
});
29512949
*/
29522950
});
2953-
2951+
29542952
function timeAgo() {
29552953
$(".timeago").timeago();
29562954
}

main/inc/lib/usermanager.lib.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7012,9 +7012,7 @@ private static function getEncoderFactory()
70127012
'Chamilo\\UserBundle\\Entity\\User' => new \Chamilo\UserBundle\Security\Encoder($encryption),
70137013
];
70147014

7015-
$encoderFactory = new EncoderFactory($encoders);
7016-
7017-
return $encoderFactory;
7015+
return new EncoderFactory($encoders);
70187016
}
70197017

70207018
/**

0 commit comments

Comments
 (0)