[svn r20962] logic changes - improvements in social network and message tool - (partial FS#3909)

skala
Isaac Flores 16 years ago
parent 6b4bd7b0e3
commit 2127f8988f
  1. 6
      main/messages/index.php
  2. 4
      main/messages/message.class.php
  3. 8
      main/messages/new_message.php
  4. 6
      main/messages/notify.php
  5. 4
      main/messages/outbox.php
  6. 6
      main/messages/view_message.php
  7. 22
      main/social/index.php
  8. 26
      main/social/select_options.php

@ -1,4 +1,4 @@
<?php // $Id: index.php 18330 2009-02-07 17:57:59Z iflorespaz $
<?php // $Id: index.php 20962 2009-05-25 03:15:53Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
@ -23,8 +23,8 @@
==============================================================================
*/
$language_file= 'messages';
include_once('../inc/global.inc.php');
include (api_get_path(LIBRARY_PATH).'message.lib.php');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
api_block_anonymous_users();
if (api_get_setting('allow_message_tool')!='true'){

@ -21,8 +21,8 @@
==============================================================================
*/
include_once(api_get_path(LIBRARY_PATH).'/main_api.lib.php');
include_once(api_get_path(LIBRARY_PATH).'/online.inc.php');
require_once api_get_path(LIBRARY_PATH).'/main_api.lib.php';
require_once api_get_path(LIBRARY_PATH).'/online.inc.php';
class MessageManager {
function MessageManager() {

@ -1,4 +1,4 @@
<?php // $Id: new_message.php 20722 2009-05-16 13:22:42Z iflorespaz $
<?php // $Id: new_message.php 20962 2009-05-25 03:15:53Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
@ -38,7 +38,7 @@
// name of the language file that needs to be included
$language_file= 'messages';
$cidReset=true;
include_once('../inc/global.inc.php');
require_once '../inc/global.inc.php';
api_block_anonymous_users();
@ -48,8 +48,8 @@ if (api_get_setting('allow_message_tool')!='true'){
require_once'../messages/message.class.php';
require_once(api_get_path(LIBRARY_PATH).'/text.lib.php');
require_once(api_get_path(LIBRARY_PATH).'/formvalidator/FormValidator.class.php');
require_once api_get_path(LIBRARY_PATH).'/text.lib.php';
require_once api_get_path(LIBRARY_PATH).'/formvalidator/FormValidator.class.php';
$request=api_is_xml_http_request();
$nameTools = api_xml_http_response_encode(get_lang('Messages'));
/*

@ -1,4 +1,4 @@
<?php // $Id: notify.php 17903 2009-01-21 19:50:57Z juliomontoya $
<?php // $Id: notify.php 20962 2009-05-25 03:15:53Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
@ -22,8 +22,8 @@
Mail: info@dokeos.com
==============================================================================
*/
include_once('../inc/global.inc.php');
require_once(api_get_path(LIBRARY_PATH).'message.lib.php');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
header("Cache-Control: no-cache, must-revalidate");
echo get_new_messages();
?>

@ -31,9 +31,9 @@
// name of the language file that needs to be included
$language_file = array('registration','messages','userInfo','admin');
$cidReset=true;
include_once ('../inc/global.inc.php');
require_once '../inc/global.inc.php';
require_once '../messages/message.class.php';
require_once (api_get_path(LIBRARY_PATH).'message.lib.php');
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
api_block_anonymous_users();
if (isset($_GET['messages_page_nr'])) {
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {

@ -1,4 +1,4 @@
<?php // $Id: view_message.php 20587 2009-05-13 12:26:56Z ivantcholakov $
<?php // $Id: view_message.php 20962 2009-05-25 03:15:53Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
@ -31,12 +31,12 @@
// name of the language file that needs to be included
$language_file= 'messages';
$cidReset= true;
include_once('../inc/global.inc.php');
require_once '../inc/global.inc.php';
api_block_anonymous_users();
if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed();
}
require_once(api_get_path(LIBRARY_PATH).'message.lib.php');
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
if (isset($_GET['id_send']) || isset($_GET['id'])) {
if (isset($_GET['rs'])) {

@ -46,7 +46,7 @@ function register_friend(element_input) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_response").html("'.get_lang('Loading', '').'"); },
$("#id_response").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../social/register_friend.php",
data: "friend_id="+user_friend_id,
@ -64,7 +64,7 @@ function denied_friend (element_input) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_response").html("'.get_lang('Loading', '').'"); },
$("#id_response").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../social/register_friend.php",
data: "denied_friend_id="+friend_user_id,
@ -153,7 +153,7 @@ function search_image_social(element_html) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#div_content_table").html("'.get_lang('Searching', '').'"); },
$("#div_content_table").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../social/show_search_image.inc.php",
data: "search_name_q="+name_search,
@ -240,7 +240,7 @@ function get_action_url_and_show_messages (name_rs,name_id) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_response").html("'.get_lang('Loading', '').'"); },
$("div#div_content_messages").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/view_message.php",
data: "rs="+name_rs+"&id="+name_id,
@ -255,7 +255,7 @@ function close_div_show (my_div) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_response").html("'.get_lang('Loading', '').'"); },
$("div#div_content_table_data").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../messages/inbox.php",
data:"",
@ -271,7 +271,7 @@ function reply_to_messages (my_action,name_rs,name_id) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_response").html("'.get_lang('Loading', '').'"); },
$("div#div_content_messages").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/new_message.php",
data:"re_id="+name_rs+"&id="+name_id,
@ -288,7 +288,7 @@ function compose_and_show_message (my_action,name_rs) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_response").html("'.get_lang('Loading', '').'"); },
$("div#div_content_messages").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/new_message.php",
data:"rs="+name_rs,
@ -343,7 +343,7 @@ function delete_one_message (num_id) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
/*$("#id_div_search").html("Searching...");*/ },
$("#div_content_table_data").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/inbox.php",
data: "action="+"deleteone"+"&id="+num_id,
@ -358,7 +358,7 @@ function show_sent_message (id_sent) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
/*$("#id_div_search").html("Searching...");*/ },
$("#div_content_table_data_sent").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/view_message.php",
data: "rs="+"1"+"&id_send="+id_sent,
@ -373,7 +373,7 @@ function close_and_open_outbox() {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_response").html("'.get_lang('Loading', '').'"); },
$("div#div_content_table_data_sent").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../messages/outbox.php",
data:"",
@ -388,7 +388,7 @@ function delete_one_message_outbox (num_id) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
/*$("#id_div_search").html("Searching...");*/ },
$("#div_content_table_data_sent").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/outbox.php",
data: "action="+"deleteone"+"&id="+num_id,

@ -6,19 +6,23 @@ $track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLI
$tbl_my_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_my_user_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND);
$search=Security::remove_XSS($_POST['search']);
$date_inter=date('Y-m-d H:i:s',time()-120);
$current_date=date('Y-m-d H:i:s',time());
$html_form='<select id="id_search_name" name="id_search_name" size="8"" style="width:350px;">';
$user_id = api_get_user_id();
$sql = 'SELECT u.user_id as id,concat(u.firstname," ",u.lastname," ","( ",u.email," )") as name ' .
'FROM '.$tbl_my_user_friend.' uf ' .
'INNER JOIN '.$tbl_my_user.' AS u ON uf.friend_user_id = u.user_id ' .
'WHERE relation_type<>6 AND friend_user_id<>'.(int)$user_id.' AND uf.user_id='.(int)$user_id.
' AND concat(u.firstName,u.lastName) like CONCAT("%","'.$search.'","%") ';
if (api_get_setting('allow_social_tool')=='true') {
//$sql.=' INNER JOIN '.$tbl_my_user_friend.' uf ON uf.friend_user_id=u.user_id ';
}
$res=api_sql_query($sql,__FILE__,__LINE__);
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$sql = 'SELECT u.user_id as id,concat(u.firstname," ",u.lastname," ","( ",u.email," )") as name
FROM '.$tbl_my_user_friend.' uf ' .
'INNER JOIN '.$tbl_my_user.' AS u ON uf.friend_user_id = u.user_id ' .
'WHERE relation_type<>6 AND friend_user_id<>'.(int)$user_id.' AND uf.user_id<>'.(int)$user_id.
' AND concat(u.firstName,u.lastName) like CONCAT("%","'.$search.'","%") ';
} elseif (api_get_setting('allow_social_tool')=='false' && api_get_setting('allow_message_tool')=='true') {
$valid=api_get_setting('time_limit_whosonline');
$sql='SELECT DISTINCT u.user_id as id,concat(u.firstname," ",u.lastname," ","( ",u.email," )") as name
FROM '.$tbl_my_user.' u INNER JOIN '.$track_online_table.' t ON u.user_id=t.login_user_id
WHERE DATE_ADD(login_date,INTERVAL "'.$valid.'" MINUTE) >= "'.$current_date.'" AND concat(u.firstName,u.lastName) like CONCAT("%","'.$search.'","%") ';
}
$res=Database::query($sql,__FILE__,__LINE__);
while ($row=Database::fetch_array($res,'ASSOC')) {
$html_form.='<option value="'.$row['id'].'">'.api_xml_http_response_encode($row['name']).'</option>';
}

Loading…
Cancel
Save