diff --git a/main/announcements/announcements.php b/main/announcements/announcements.php index 141bd6385a..ddf9d3e705 100755 --- a/main/announcements/announcements.php +++ b/main/announcements/announcements.php @@ -238,6 +238,7 @@ if (!empty($_SESSION['toolgroup'])){ // include the stylesheet, which is normally done in the header //$display_specific_announcement = true; $announcement_id = intval($_GET['id']); +$message = null; if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') { //we are not in the learning path @@ -305,7 +306,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed } //delete attachment file - if ($_GET['action'] == 'delete') { + if (isset($_GET['action']) && $_GET['action'] == 'delete') { $id = $_GET['id_attach']; AnnouncementManager::delete_announcement_attachment_file($id); } @@ -369,7 +370,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed Move announcement up/down */ - if ($ctok == $_GET['sec_token']) { + if (isset($_GET['sec_token']) && $ctok == $_GET['sec_token']) { if (!empty($_GET['down'])) { $thisAnnouncementId = intval($_GET['down']); $sortDirection = "DESC"; @@ -808,7 +809,7 @@ $announcement_number = Database::num_rows($result); $show_actions = false; if ((api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) and (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath')) { echo '
'; - if (in_array($_GET['action'], array('add', 'modify','view'))) { + if (isset($_GET['action']) && in_array($_GET['action'], array('add', 'modify','view'))) { echo "".Display::return_icon('back.png',get_lang('Back'),'','32').""; } else { echo "".Display::return_icon('new_announce.png',get_lang('AddAnnouncement'),'','32').""; @@ -1070,8 +1071,8 @@ if ($display_form) { /* DISPLAY ANNOUNCEMENT LIST */ - -if ($display_announcement_list && !$surveyid) { +//if ($display_announcement_list && !$surveyid) { +if ($display_announcement_list) { // by default we use the id of the current user. The course administrator can see the announcement of other users by using the user / group filter //$user_id=$_user['user_id']; if (isset($_SESSION['user'])) { diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index 4f3719c8a1..34b5fee500 100755 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -912,11 +912,11 @@ class MessageManager $rows = null; $rows = self::get_messages_by_group_by_message($group_id, $value['id']); if (!empty($rows)) { - $count = self::calculate_children($rows, $value['id']); + $count = count(self::calculate_children($rows, $value['id'])); } else { $count = 0; } - $value['count'] = count($count); + $value['count'] = $count; $new_topics[$id] = $value; } //$new_topics = sort_column($new_topics,'count'); @@ -1108,12 +1108,13 @@ class MessageManager * @return array new list adding the item children */ public static function calculate_children($rows, $first_seed) { + $rows_with_children = array(); foreach($rows as $row) { $rows_with_children[$row["id"]]=$row; $rows_with_children[$row["parent_id"]]["children"][]=$row["id"]; } - $rows=$rows_with_children; - $sorted_rows=array(0=>array()); + $rows = $rows_with_children; + $sorted_rows = array(0=>array()); self::message_recursive_sort($rows, $sorted_rows, $first_seed); unset($sorted_rows[0]); return $sorted_rows; @@ -1128,7 +1129,7 @@ class MessageManager * @return void */ public static function message_recursive_sort($rows, &$messages, $seed=0, $indent=0) { - if ($seed > 0) { + if ($seed > 0 && isset($rows[$seed]["id"])) { $messages[$rows[$seed]["id"]]=$rows[$seed]; $messages[$rows[$seed]["id"]]["indent_cnt"]=$indent; $indent++; diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index ae4f903ac2..bc2bdf7911 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -91,7 +91,7 @@ class SocialManager extends UserManager { * @author Julio Montoya Cleaning code, function renamed, $load_extra_info option added * @author isaac flores paz */ - public static function get_friends($user_id, $id_group=null, $search_name=null, $load_extra_info = true) { + public static function get_friends($user_id, $id_group = null, $search_name = null, $load_extra_info = true) { $list_ids_friends=array(); $tbl_my_friend = Database :: get_main_table(TABLE_MAIN_USER_REL_USER); $tbl_my_user = Database :: get_main_table(TABLE_MAIN_USER); @@ -99,10 +99,9 @@ class SocialManager extends UserManager { if (isset($id_group) && $id_group>0) { $sql.=' AND relation_type='.$id_group; } - if (isset($search_name) && is_string($search_name)===true) { + if (isset($search_name)) { $search_name = trim($search_name); $search_name = str_replace(' ', '', $search_name); - //$sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%"));'; $sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE firstName LIKE "%'.Database::escape_string($search_name).'%" OR lastName LIKE "%'.Database::escape_string($search_name).'%" OR '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%") ) '; } @@ -145,7 +144,8 @@ class SocialManager extends UserManager { /** * get web path of user invitate - * @author isaac flores paz + * @author isaac flores paz + * @author Julio Montoya setting variable array * @param int user id * @return array */ @@ -153,6 +153,7 @@ class SocialManager extends UserManager { $list_paths=array(); $list_path_friend=array(); $list_ids = self::get_list_invitation_of_friends_by_user_id((int)$user_id); + $list_path_image_friend = array(); foreach ($list_ids as $values_ids) { $list_path_image_friend[] = UserManager::get_user_picture_path_by_id($values_ids['user_sender_id'],'web',false,true); } @@ -453,7 +454,7 @@ class SocialManager extends UserManager { } $current_course_settings = CourseManager :: get_access_settings($my_course['k']); // display the what's new icons - if ((CONFVAL_showExtractInfo == SCRIPTVAL_InCourseList || CONFVAL_showExtractInfo == SCRIPTVAL_Both) && $nbDigestEntries > 0) { + if ($nbDigestEntries > 0) { reset($digest); $result .= '
    '; while (list ($key2) = each($digest[$thisCourseSysCode])) { @@ -672,7 +673,7 @@ class SocialManager extends UserManager { //check if I already sent an invitation message $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id()); - if (isset($invitation_sent_list) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0 ) { + if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0 ) { echo '
  • '.Display::return_icon('invitation.png',get_lang('YouAlreadySentAnInvitation')).'  '.get_lang('YouAlreadySentAnInvitation').'
  • '; } else { if (!$show_full_profile) { diff --git a/main/newscorm/lp_build.php b/main/newscorm/lp_build.php index 5ded762aa8..46bb7e4cab 100755 --- a/main/newscorm/lp_build.php +++ b/main/newscorm/lp_build.php @@ -167,7 +167,7 @@ echo ''; // Display::display_normal_message(get_lang('LPCreatedAddChapterStep'), false); $gradebook = Security::remove_XSS($_GET['gradebook']); //$learnpathadded = Display::return_icon('gallery/creative.gif', '', array('align' => 'right')); - $learnpathadded .= '

    '.get_lang('LearnPathAddedTitle').'

    '; + $learnpathadded = '

    '.get_lang('LearnPathAddedTitle').'

    '; $learnpathadded .= ''.Display::return_icon('new_learnigpath_object.png', get_lang('NewStep'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewStep').': '.get_lang('NewStepComment').'
    '; $learnpathadded .= ''.Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewChapter').': '.get_lang('NewChapterComment').'
    '; $learnpathadded .= ''.Display::return_icon('build_learnpath.png', get_lang('Build'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('Build').": ".get_lang('BuildComment').'
    '; diff --git a/main/social/friends.php b/main/social/friends.php index 51e253afe2..aeb6d50025 100755 --- a/main/social/friends.php +++ b/main/social/friends.php @@ -100,8 +100,8 @@ $language_variable = api_xml_http_response_encode(get_lang('Contacts')); $user_id = api_get_user_id(); $list_path_friends = array(); -$user_id = api_get_user_id(); -$name_search= Security::remove_XSS($_POST['search_name_q']); +$user_id = api_get_user_id(); +$name_search = isset($_POST['search_name_q']) ? $_POST['search_name_q']: null; $number_friends = 0; if (isset($name_search) && $name_search!='undefined') { diff --git a/main/social/groups.php b/main/social/groups.php index 640e46e0c3..6ab70d7834 100755 --- a/main/social/groups.php +++ b/main/social/groups.php @@ -4,7 +4,7 @@ * @package chamilo.social * @author Julio Montoya */ -$cidReset=true; +$cidReset = true; $language_file = array('userInfo'); require_once '../inc/global.inc.php'; diff --git a/main/social/message_for_group_form.inc.php b/main/social/message_for_group_form.inc.php index d01fc34df7..232f6b4075 100755 --- a/main/social/message_for_group_form.inc.php +++ b/main/social/message_for_group_form.inc.php @@ -79,12 +79,12 @@ $page_topic = !empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1 if (api_get_setting('allow_message_tool')=='true') { //normal message $user_info=api_get_user_info($userfriend_id); - echo api_xml_http_response_encode(get_lang('To')).":  ".api_xml_http_response_encode($to_group); + //echo api_xml_http_response_encode(get_lang('To')).":  ".api_xml_http_response_encode($to_group); if ($allowed_action == 'add_message_group') { - echo '

    * '.api_xml_http_response_encode(get_lang('Subject')).' :
    '; - echo '
    '; + echo '* '.api_xml_http_response_encode(get_lang('Subject')).' :
    '; + echo '


    '; } - echo '

    '.api_xml_http_response_encode(get_lang('Message')).' :
    '; + echo api_xml_http_response_encode(get_lang('Message')).' :
    '; $oFCKeditor = new FCKeditor('content') ; $oFCKeditor->ToolbarSet = 'messages'; @@ -93,14 +93,15 @@ $page_topic = !empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1 $oFCKeditor->Value = $message; $return = $oFCKeditor->CreateHtml(); echo $return; - ?> + ?> +

    *

    :

    -
    *
    +