Avoiding warning messages

skala
Julio Montoya 14 years ago
parent a5a1920fca
commit e622a61871
  1. 11
      main/announcements/announcements.php
  2. 11
      main/inc/lib/message.lib.php
  3. 13
      main/inc/lib/social.lib.php
  4. 2
      main/newscorm/lp_build.php
  5. 4
      main/social/friends.php
  6. 2
      main/social/groups.php
  7. 13
      main/social/message_for_group_form.inc.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 '<div class="actions">';
if (in_array($_GET['action'], array('add', 'modify','view'))) {
if (isset($_GET['action']) && in_array($_GET['action'], array('add', 'modify','view'))) {
echo "<a href='".api_get_self()."?".api_get_cidreq()."&origin=".(empty($_GET['origin'])?'':$_GET['origin'])."'>".Display::return_icon('back.png',get_lang('Back'),'','32')."</a>";
} else {
echo "<a href='".api_get_self()."?".api_get_cidreq()."&action=add&origin=".(empty($_GET['origin'])?'':$_GET['origin'])."'>".Display::return_icon('new_announce.png',get_lang('AddAnnouncement'),'','32')."</a>";
@ -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'])) {

@ -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++;

@ -91,7 +91,7 @@ class SocialManager extends UserManager {
* @author Julio Montoya <gugli100@gmail.com> Cleaning code, function renamed, $load_extra_info option added
* @author isaac flores paz <florespaz@bidsoftperu.com>
*/
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 <florespaz@bidsoftperu.com>
* @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 .= '<ul>';
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 '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('YouAlreadySentAnInvitation')).'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
} else {
if (!$show_full_profile) {

@ -167,7 +167,7 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
// 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 .= '<p><strong>'.get_lang('LearnPathAddedTitle').'</strong><br /><br />';
$learnpathadded = '<p><strong>'.get_lang('LearnPathAddedTitle').'</strong><br /><br />';
$learnpathadded .= '<a href="lp_controller.php?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;gradebook='.$gradebook.'&amp;action=add_item&amp;type=step&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="'.get_lang('NewStep').'">'.Display::return_icon('new_learnigpath_object.png', get_lang('NewStep'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewStep').'</a>: '.get_lang('NewStepComment').'<br />';
$learnpathadded .= '<a href="lp_controller.php?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;gradebook='.$gradebook.'&amp;action=add_item&amp;type=chapter&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="'.get_lang('NewChapter').'">'.Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewChapter').'</a>: '.get_lang('NewChapterComment').'<br />';
$learnpathadded .= '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=build&amp;lp_id='.Security::remove_XSS($_GET['lp_id']).'" target="_parent">'.Display::return_icon('build_learnpath.png', get_lang('Build'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('Build')."</a>: ".get_lang('BuildComment').'<br />';

@ -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') {

@ -4,7 +4,7 @@
* @package chamilo.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset=true;
$cidReset = true;
$language_file = array('userInfo');
require_once '../inc/global.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')).":&nbsp;&nbsp;".api_xml_http_response_encode($to_group);
//echo api_xml_http_response_encode(get_lang('To')).":&nbsp;&nbsp;".api_xml_http_response_encode($to_group);
if ($allowed_action == 'add_message_group') {
echo '<br /><br /><span style="color:red">*</span> '.api_xml_http_response_encode(get_lang('Subject')).' :<br />';
echo '<input id="txt_subject_id" name="title" type="text" style="width:450px;" value="'.$subject.'"><br />';
echo '<span style="color:red">*</span> '.api_xml_http_response_encode(get_lang('Subject')).' :<br />';
echo '<input id="txt_subject_id" name="title" type="text" style="width:450px;" value="'.$subject.'"><br /><br /><br />';
}
echo '<br /><br />'.api_xml_http_response_encode(get_lang('Message')).' :<br />';
echo api_xml_http_response_encode(get_lang('Message')).' :<br />';
$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;
?>
?>
<div><span style="color:red"> * </span><?php echo get_lang('FieldRequired') ?></div>
<br /><?php echo api_xml_http_response_encode(get_lang('AttachmentFiles')); ?> :<br />
<span id="filepaths"><div id="filepath_1"><input type="file" name="attach_1" size="20" /></div></span>
<div id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">
<?php echo get_lang('AddOneMoreFile') ?></a>&nbsp;(<?php echo api_xml_http_response_encode(sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize')))) ?>)</div>
<br />
<button class="save" onclick="if(validate_text_empty(this.form.title.value,'<?php echo get_lang('YouShouldWriteASubject')?>')){return false;}" type="submit" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
<div><span style="color:red">*</span><?php echo get_lang('FieldRequired') ?></div>
<?php } ?>
</dl>
</td>

Loading…
Cancel
Save