From 0dbe793c872c414512f2181bd3863488c7476d64 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 24 Dec 2009 13:55:21 -0500 Subject: [PATCH] Minor - Deleting unuseles functions and files see #190 --- main/inc/ajax/social.ajax.php | 108 +++++++++++++++++- main/inc/lib/message.lib.php | 41 ++++--- main/inc/lib/social.lib.php | 6 +- main/messages/inbox.php | 1 - main/messages/index.html | 6 - main/messages/index.php | 44 +------ main/messages/view_message.php | 4 +- main/social/contacts.inc.php | 73 ------------ main/social/data_personal.inc.php | 151 ------------------------- main/social/group_contact.inc.php | 97 ---------------- main/social/personal_data.php | 148 ------------------------ main/social/profile.php | 4 +- main/social/qualify_contact.inc.php | 64 ----------- main/social/select_friend_response.php | 121 -------------------- 14 files changed, 135 insertions(+), 733 deletions(-) delete mode 100755 main/messages/index.html delete mode 100755 main/social/contacts.inc.php delete mode 100755 main/social/data_personal.inc.php delete mode 100755 main/social/group_contact.inc.php delete mode 100755 main/social/personal_data.php delete mode 100755 main/social/qualify_contact.inc.php delete mode 100755 main/social/select_friend_response.php diff --git a/main/inc/ajax/social.ajax.php b/main/inc/ajax/social.ajax.php index 9e4cd228bc..cf8f9414d6 100644 --- a/main/inc/ajax/social.ajax.php +++ b/main/inc/ajax/social.ajax.php @@ -92,7 +92,7 @@ switch ($action) { break; case 'show_my_friends': - if (api_is_anonymous()){ + if (api_is_anonymous()) { echo ''; break; } @@ -137,7 +137,111 @@ switch ($action) { $friend_html.='
'; } echo $friend_html; - break; + break; + case 'delete_friend': + + if (api_is_anonymous()){ + echo ''; + break; + } + + $my_current_friend = Security::remove_XSS($_POST['friend_id']); + $my_denied_current_friend= Security::remove_XSS($_POST['denied_friend_id']); + $my_delete_friend = Security::remove_XSS($_POST['delete_friend_id']); + $friend_id_qualify = Security::remove_XSS($_POST['user_id_friend_q']); + $type_friend_qualify = Security::remove_XSS($_POST['type_friend_q']); //filtered? + $is_my_friend = Security::remove_XSS($_POST['is_my_friend']); //filtered? + + if (isset($_POST['delete_friend_id'])) { + SocialManager::removed_friend($my_delete_friend); + } + /* + if(isset($_POST['user_id_friend_q']) && isset($_POST['type_friend_q'])) { + SocialManager::qualify_friend($friend_id_qualify,$type_friend_qualify); + echo api_xml_http_response_encode(get_lang('AttachContactsToGroupSuccesfuly')); + }*/ + break; + + case 'toogle_course': + + require_once api_get_path(LIBRARY_PATH).'blog.lib.php'; + require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; + require_once api_get_path(LIBRARY_PATH).'course.lib.php'; + + $user_id = intval($_SESSION['social_user_id']); + if ($_POST['action']) {$action = $_POST['action'];} + + switch($action) { + + case 'load_course' : + $course_db = $_POST['course_code']; + // @todo goto the course link + //echo ''.get_lang('GotoCourse').''; + $course_id=CourseManager::get_course_id_by_database_name($course_db); + + if (api_is_user_of_course($course_id,api_get_user_id())) { + + $table_forums = Database :: get_course_table(TABLE_FORUM,$course_db); + $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD,$course_db); + $table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db); + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db); + $table_users = Database :: get_main_table(TABLE_MAIN_USER); + + //------Forum messages + + $forum_result = get_all_post_from_user($user_id, $course_db); + $all_result_data = 0; + if ($forum_result !='') { + api_display_tool_title(get_lang('Forum')); + echo '
'; + echo api_xml_http_response_encode($forum_result); + echo '
'; + echo '
'; + $all_result_data++; + } + + //------Blog posts + $result = get_blog_post_from_user($course_db, $user_id); + if (!empty($result)) { + api_display_tool_title(api_xml_http_response_encode(get_lang('Blog'))); + echo '
'; + echo api_xml_http_response_encode($result); + echo '
'; + echo '
'; + $all_result_data++; + } + + //------Blog comments + $result = get_blog_comment_from_user($course_db, $user_id); + if (!empty($result)) { + echo '
'; + api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments'))); + echo api_xml_http_response_encode($result); + echo '
'; + echo '
'; + $all_result_data++; + } + if ($all_result_data == 0) { + echo api_xml_http_response_encode(get_lang('NoDataAvailable')); + } + + } else { + echo '

'; + api_display_tool_title(api_xml_http_response_encode(get_lang('Details'))); + echo '
'; + echo api_xml_http_response_encode(get_lang('UserNonRegisteredAtTheCourse')); + echo '

'; + echo '
'; + echo '

'; + } + break; + case 'unload_course' : + //echo 'load2'; + break; + default: + break; + } + break; default: echo ''; } diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index fab02588bc..83bf7666d0 100755 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -684,11 +684,11 @@ class MessageManager   - - + - '; + + '; if (api_get_setting('allow_social_tool') == 'true') { $user_image = ''; /* @todo add user image @@ -697,33 +697,33 @@ class MessageManager $user_image = ''; */ if ($source == 'outbox') { - $message_content .=''; + $message_content .=''; } else { - $message_content .=''; + $message_content .=''; } } else { if ($source == 'outbox') { - $message_content .=''; + $message_content .=''; } else { - $message_content .=''; + $message_content .=''; } } - $message_content .=' - - - - -
+

'.str_replace("\\","",$row[5]).'

-
'.get_lang('From').' '.$user_image.''.GetFullUserName($row[1]).' '.api_strtolower(get_lang('To')).' '.GetFullUserName($row[2]).' '.get_lang('From').' '.$user_image.''.GetFullUserName($row[1]).' '.api_strtolower(get_lang('To')).' '.GetFullUserName($row[2]).' '.get_lang('From').' '.$user_image.''.GetFullUserName($row[1]).' '.api_strtolower(get_lang('To')).' '.get_lang('Me').' '.get_lang('From').' '.$user_image.''.GetFullUserName($row[1]).' '.api_strtolower(get_lang('To')).' '.get_lang('Me').' '.get_lang('From').' '.GetFullUserName($row[1]).' '.api_strtolower(get_lang('To')).' '.GetFullUserName($row[2]).' '.get_lang('From').' '.GetFullUserName($row[1]).' '.api_strtolower(get_lang('To')).' '.GetFullUserName($row[2]).' '.get_lang('From').' '.GetFullUserName($row[1]).' '.api_strtolower(get_lang('To')).' '.get_lang('Me').' '.get_lang('From').' '.GetFullUserName($row[1]).' '.api_strtolower(get_lang('To')).' '.get_lang('Me').'
'.get_lang('Date').'  '.$row[4].'
+ $message_content .=' + + '.get_lang('Date').'  '.$row[4].' + + +
- +
-
'.str_replace("\\","",$row[6]).'
+
'.(!empty($files_attachments)?implode(' | ',$files_attachments):'').'
'; $social_link = ''; @@ -735,16 +735,13 @@ class MessageManager } else { $message_content .= ''.Display::return_icon('back.png',get_lang('ReturnToInbox')).get_lang('ReturnToInbox').'  '; $message_content .= ''.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).get_lang('ReplyToMessage').'  '; - } - + } $message_content .= ''.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('DeleteMessage').' '; - - - $message_content .='
+ $message_content .=' - '; + '; return $message_content; } diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index 2790ce1b73..f7ed15844f 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -529,13 +529,13 @@ class SocialManager extends UserManager { //display course entry $result .= '
'; - //$result .= ''; - $result .= '

'; + //$result .= ''; + $result .= '

'; $result .= $s_htlm_status_icon; //show a hyperlink to the course, unless the course is closed and user is not course admin if ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) { - $result .= ' '.$course_title.'

'; + $result .= ' '.$course_title.'

'; /* if(api_get_setting('use_session_mode')=='true' && !$nosession) { if(empty($my_course['id_session'])) { diff --git a/main/messages/inbox.php b/main/messages/inbox.php index 14f07bfde0..2333db8d2b 100755 --- a/main/messages/inbox.php +++ b/main/messages/inbox.php @@ -4,7 +4,6 @@ * @package dokeos.messages */ - // name of the language file that needs to be included $language_file = array('registration','messages','userInfo'); $cidReset=true; diff --git a/main/messages/index.html b/main/messages/index.html deleted file mode 100755 index aa7b9c934b..0000000000 --- a/main/messages/index.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/main/messages/index.php b/main/messages/index.php index fcbb504a88..97f23833db 100755 --- a/main/messages/index.php +++ b/main/messages/index.php @@ -1,45 +1,9 @@ ".get_lang('Inbox')."(".$number_of_new_messages.")"; - echo " - "; - echo "".get_lang('ComposeMessage')."";*/ - $number_of_new_messages = -1; - if($number_of_new_messages > 0) - { - ?> -
- - - - - - - - -
'.get_lang('YouHaveNewMessage').''; ?>
-
- '; - //echo ' '; +if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') { + header('Location:inbox.php?f=social'); +} elseif ( api_get_setting('allow_message_tool')=='true') { + header('Location:inbox.php'); } ?> \ No newline at end of file diff --git a/main/messages/view_message.php b/main/messages/view_message.php index 5f14db1e1f..c898e06464 100755 --- a/main/messages/view_message.php +++ b/main/messages/view_message.php @@ -4,7 +4,6 @@ * @package dokeos.messages */ - $language_file = array('registration','messages','userInfo'); $cidReset= true; require_once '../inc/global.inc.php'; @@ -77,8 +76,7 @@ echo '
'; } else { $id_message = $_GET['id']; $source = 'inbox'; - } - + } $message = MessageManager::show_message_box($id_message,$source); if (!empty($message)) { echo $message; diff --git a/main/social/contacts.inc.php b/main/social/contacts.inc.php deleted file mode 100755 index 838d7398fb..0000000000 --- a/main/social/contacts.inc.php +++ /dev/null @@ -1,73 +0,0 @@ - - */ - -$language_file = array('registration','messages','userInfo','admin'); -require '../inc/global.inc.php'; -require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php'; -require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; -require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; -require_once api_get_path(LIBRARY_PATH).'image.lib.php'; -require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; -require_once '../inc/lib/social.lib.php'; -$this_section = SECTION_MYPROFILE; -$_SESSION['this_section']=$this_section; -//$list_path_friends=array(); -$request=api_is_xml_http_request(); -$language_variable=api_xml_http_response_encode(get_lang('Contacts')); -//api_display_tool_title($language_variable); - -$user_id=api_get_user_id(); -$image_path = UserManager::get_user_picture_path_by_id ($user_id,'web',false,true); -?> -
- - - - - - - - - - - -
\ No newline at end of file diff --git a/main/social/data_personal.inc.php b/main/social/data_personal.inc.php deleted file mode 100755 index 7ac9dc8273..0000000000 --- a/main/social/data_personal.inc.php +++ /dev/null @@ -1,151 +0,0 @@ - - */ - -$language_file = array('registration','messages','userInfo','admin','forum','blog'); -require_once '../inc/global.inc.php'; -require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; -require_once api_get_path(LIBRARY_PATH).'social.lib.php'; -require_once api_get_path(LIBRARY_PATH).'course.lib.php'; - -// @todo here we must show the user information as read only -//User picture size is calculated from SYSTEM path -$user_info= UserManager::get_user_info_by_id(api_get_user_id()); -$img_array= UserManager::get_user_picture_path_by_id(api_get_user_id(),'web',true,true); - -if (isset($_POST['load_ajax'])) { - require_once api_get_path(LIBRARY_PATH).'blog.lib.php'; - require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; - $user_id = intval($_SESSION['social_user_id']); - if ($_POST['action']) {$action = $_POST['action'];} - switch($action) { - case 'load_course' : - $course_db = $_POST['course_code']; - // @todo goto the course link - //echo ''.get_lang('GotoCourse').''; - $course_id=CourseManager::get_course_id_by_database_name($course_db); - - if (api_is_user_of_course($course_id,api_get_user_id())) { - - $table_forums = Database :: get_course_table(TABLE_FORUM,$course_db); - $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD,$course_db); - $table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db); - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db); - $table_users = Database :: get_main_table(TABLE_MAIN_USER); - - //------Forum messages - - $forum_result = get_all_post_from_user($user_id, $course_db); - $all_result_data = 0; - if ($forum_result !='') { - api_display_tool_title(get_lang('Forum')); - echo ''; - echo '
'; - $all_result_data++; - } - - //------Blog posts - $result = get_blog_post_from_user($course_db, $user_id); - if (!empty($result)) { - api_display_tool_title(api_xml_http_response_encode(get_lang('Blog'))); - echo ''; - echo '
'; - $all_result_data++; - } - - //------Blog comments - $result = get_blog_comment_from_user($course_db, $user_id); - if (!empty($result)) { - echo ''; - echo '
'; - $all_result_data++; - } - if ($all_result_data == 0) { - echo api_xml_http_response_encode(get_lang('NoDataAvailable')); - } - - } else { - echo '

'; - api_display_tool_title(api_xml_http_response_encode(get_lang('Details'))); - echo ''; - echo '

'; - } - break; - case 'unload_course' : - //echo 'load2'; - break; - default: - - } -} else { - // normal behavior -$request=api_is_xml_http_request(); -$language_variable=api_xml_http_response_encode(get_lang('PersonalData')); -//api_display_tool_title($language_variable); - - echo ''; - echo '
'; - echo ''; - echo '
'; - echo '
'; - echo ''; - echo '
'; - /*if (api_get_setting('allow_message_tool')=='true') { - require_once api_get_path(LIBRARY_PATH).'message.lib.php'; - $number_of_new_messages = MessageManager::get_new_messages(); - $number_of_outbox_message=MessageManager::get_number_of_messages_sent(); - $cant_out_box=' ('.$number_of_outbox_message.')'; - $cant_msg = ' ('.$number_of_new_messages.')'; - $number_of_new_messages_of_friend=SocialManager::get_message_number_invitation_by_user_id(api_get_user_id()); - //echo ''; - echo '
-

'.get_lang('Messages').'

-

- '.get_lang('Inbox').$cant_msg.'
- '.get_lang('Outbox').$cant_out_box.'
-

'; - echo ''.get_lang('Close').''; - if ($number_of_new_messages_of_friend>0) { - echo '
'; - } - echo '
'; - }*/ - echo '
'; -} -?> \ No newline at end of file diff --git a/main/social/group_contact.inc.php b/main/social/group_contact.inc.php deleted file mode 100755 index b16602b9b7..0000000000 --- a/main/social/group_contact.inc.php +++ /dev/null @@ -1,97 +0,0 @@ - - */ - - -$language_file = array('registration','messages','userInfo','admin'); -require '../inc/global.inc.php'; -require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php'; -require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; -require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; -require_once api_get_path(LIBRARY_PATH).'image.lib.php'; -require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; -require_once '../inc/lib/social.lib.php'; -$this_section = SECTION_MYPROFILE; -$_SESSION['this_section']=$this_section; -$list_path_friends=array(); -$list_groups=array(); -$request=api_is_xml_http_request(); -$language_variable=api_xml_http_response_encode(get_lang('ContactsGroups')); -//api_display_tool_title($language_variable); -$user_id=api_get_user_id(); -$list_groups=SocialManager::show_list_type_friends(); - - - -for ($p=0;$p - - - - - - - - -
- - - 'btn_'.$list_groups[$p]['id'])); ?> - -
-
- - for ($k=0;$k<$loop_friends;$k++) { - if ($j==$number_of_images) { - $number_of_images=$number_of_images*2; - } - while ($j<$number_of_images) { - if ($list_friends_file[$j]<>"") { - $user_info=api_get_user_info($list_friends_id[$j]); - $user_name=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); - if($list_friends_file[$j]==='unknown.jpg') { - $big=''; - } else { - $big='big_'; - } - $friends_profile = SocialManager::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92); - $friend_html.=''; - } - $j++; - } - } - echo $friend_html; - } - else { - echo api_xml_http_response_encode(get_lang('YouDontHaveContactsInThisGroup')); - } - ?> -
-
- \ No newline at end of file diff --git a/main/social/personal_data.php b/main/social/personal_data.php deleted file mode 100755 index f8859fcc34..0000000000 --- a/main/social/personal_data.php +++ /dev/null @@ -1,148 +0,0 @@ -'.get_lang('GotoCourse').''; - $course_id=CourseManager::get_course_id_by_database_name($course_db); - - if (api_is_user_of_course($course_id,api_get_user_id())) { - - $table_forums = Database :: get_course_table(TABLE_FORUM,$course_db); - $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD,$course_db); - $table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db); - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db); - $table_users = Database :: get_main_table(TABLE_MAIN_USER); - - //------Forum messages - - $forum_result = get_all_post_from_user($user_id, $course_db); - $all_result_data = 0; - if ($forum_result !='') { - api_display_tool_title(get_lang('Forum')); - echo ''; - echo '
'; - $all_result_data++; - } - - //------Blog posts - $result = get_blog_post_from_user($course_db, $user_id); - if (!empty($result)) { - echo '

'; - api_display_tool_title(api_xml_http_response_encode(get_lang('BlogPosts'))); - echo ''; - echo '
'; - $all_result_data++; - } - - //------Blog comments - $result = get_blog_comment_from_user($course_db, $user_id); - if (!empty($result)) { - api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments'))); - echo ''; - echo '
'; - $all_result_data++; - } - if ($all_result_data == 0) { - echo api_xml_http_response_encode(get_lang('NoDataAvailable')); - } - - } else { - echo '

'; - api_display_tool_title(api_xml_http_response_encode(get_lang('Details'))); - echo ''; - echo '

'; - } - break; - case 'unload_course' : - //echo 'load2'; - break; - default: - - } -} else { - // normal behavior -$request=api_is_xml_http_request(); -$language_variable=api_xml_http_response_encode(get_lang('PersonalData')); -//api_display_tool_title($language_variable); - - echo ''; - echo '
'; - echo ''; - echo '
'; - echo '
'; - echo ''; - echo '
'; - /*if (api_get_setting('allow_message_tool')=='true') { - require_once api_get_path(LIBRARY_PATH).'message.lib.php'; - $number_of_new_messages = MessageManager::get_new_messages(); - $number_of_outbox_message=MessageManager::get_number_of_messages_sent(); - $cant_out_box=' ('.$number_of_outbox_message.')'; - $cant_msg = ' ('.$number_of_new_messages.')'; - $number_of_new_messages_of_friend=SocialManager::get_message_number_invitation_by_user_id(api_get_user_id()); - //echo ''; - echo '
-

'.get_lang('Messages').'

-

- '.get_lang('Inbox').$cant_msg.'
- '.get_lang('Outbox').$cant_out_box.'
-

'; - echo ''.get_lang('Close').''; - if ($number_of_new_messages_of_friend>0) { - echo '
'; - } - echo '
'; - }*/ - echo '
'; -} -?> \ No newline at end of file diff --git a/main/social/profile.php b/main/social/profile.php index 489c477623..74b97fd25c 100755 --- a/main/social/profile.php +++ b/main/social/profile.php @@ -67,7 +67,7 @@ $htmlHeadXtra[] = '