Example #1
0
    /**
     * display message box sent showing it into outbox
     * @return void
     */
    public static function show_message_box_sent()
    {
        $table_message = Database::get_main_table(TABLE_MESSAGE);
        $tbl_message_attach = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT);
        $message_id = '';
        if (is_numeric($_GET['id_send'])) {
            $query = "SELECT * FROM {$table_message}\n                      WHERE\n                            user_sender_id=" . api_get_user_id() . " AND\n                            id=" . intval($_GET['id_send']) . " AND\n                            msg_status = 4;";
            $result = Database::query($query);
            $message_id = intval($_GET['id_send']);
        }
        $path = 'outbox.php';
        // get file attachments by message id
        $files_attachments = self::get_links_message_attachment_files($message_id, 'outbox');
        $row = Database::fetch_array($result);
        $user_con = self::users_connected_by_id();
        $band = 0;
        $reply = '';
        for ($i = 0; $i < count($user_con); $i++) {
            if ($row[1] == $user_con[$i]) {
                $band = 1;
            }
        }
        echo '<div class=actions>';
        echo '<a onclick="close_and_open_outbox()" href="javascript:void(0)">' . Display::return_icon('folder_up.gif', api_xml_http_response_encode(get_lang('BackToOutbox'))) . api_xml_http_response_encode(get_lang('BackToOutbox')) . '</a>';
        echo '<a onclick="delete_one_message_outbox(' . $row[0] . ')" href="javascript:void(0)"  >' . Display::return_icon('delete.png', api_xml_http_response_encode(get_lang('DeleteMessage'))) . api_xml_http_response_encode(get_lang('DeleteMessage')) . '</a>';
        echo '</div><br />';
        echo '
		<table class="message_view_table" >
		    <TR>
		      <TD width=10>&nbsp; </TD>
		      <TD vAlign=top width="100%">
		      	<TABLE>
		            <TR>
		              <TD width="100%">
		                    <TR> <h1>' . str_replace("\\", "", api_xml_http_response_encode($row[5])) . '</h1></TR>
		              </TD>
		              <TR>
		              	<TD>' . api_xml_http_response_encode(get_lang('From') . '&nbsp;<b>' . GetFullUserName($row[1]) . '</b> ' . api_strtolower(get_lang('To')) . '&nbsp;  <b>' . GetFullUserName($row[2])) . '</b> </TD>
		              </TR>
		              <TR>
		              <TD >' . api_xml_http_response_encode(get_lang('Date') . '&nbsp; ' . $row[4]) . '</TD>
		              </TR>
		            </TR>
		        </TABLE>
		        <br />
		        <TABLE height="209px" width="100%" bgColor=#ffffff>
		          <TBODY>
		            <TR>
		              <TD vAlign=top>' . str_replace("\\", "", api_xml_http_response_encode($row[6])) . '</TD>
		            </TR>
		          </TBODY>
		        </TABLE>
		        <div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>
		        <DIV class=HT style="PADDING-BOTTOM: 5px"> </DIV></TD>
		      <TD width=10>&nbsp;</TD>
		    </TR>
		</TABLE>';
    }
Example #2
0
 /**
  * Gets information about messages sent
  * @param  integer
  * @param  integer
  * @param  string
  * @return array
  */
 public static function get_message_data_sent($from, $number_of_items, $column, $direction)
 {
     $from = intval($from);
     $number_of_items = intval($number_of_items);
     if (!isset($direction)) {
         $column = 3;
         $direction = 'DESC';
     } else {
         $column = intval($column);
         if (!in_array($direction, array('ASC', 'DESC'))) {
             $direction = 'ASC';
         }
     }
     $table_message = Database::get_main_table(TABLE_MESSAGE);
     $request = api_is_xml_http_request();
     $sql = "SELECT\n                    id as col0, user_sender_id as col1, title as col2, send_date as col3, user_receiver_id as col4, msg_status as col5\n                FROM {$table_message}\n                WHERE\n                    user_sender_id=" . api_get_user_id() . " AND\n                    msg_status=" . MESSAGE_STATUS_OUTBOX . "\n                ORDER BY col{$column} {$direction}\n                LIMIT {$from}, {$number_of_items}";
     $sql_result = Database::query($sql);
     $i = 0;
     $message_list = array();
     while ($result = Database::fetch_row($sql_result)) {
         if ($request === true) {
             $message[0] = '<input type="checkbox" value=' . $result[0] . ' name="out[]">';
         } else {
             $message[0] = $result[0];
         }
         $class = 'class = "read"';
         $result[2] = Security::remove_XSS($result[2]);
         if ($request === true) {
             $message[1] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . GetFullUserName($result[4]) . '</a>';
             $message[2] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . str_replace("\\", "", $result[2]) . '</a>';
             $message[3] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG);
             //date stays the same
             $message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox(' . $result[0] . ')" href="javascript:void(0)"  >' . Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
         } else {
             $link = '';
             if (isset($_GET['f']) && $_GET['f'] == 'social') {
                 $link = '&f=social';
             }
             $message[1] = '<a ' . $class . ' onclick="show_sent_message (' . $result[0] . ')" href="../messages/view_message.php?id_send=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . GetFullUserName($result[4]);
             //$message[2] = '<a '.$class.' onclick="show_sent_message ('.$result[0].')" href="../messages/view_message.php?id_send='.$result[0].$link.'">'.$result[2].'</a>';
             $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG);
             //date stays the same
             $message[3] = '<a href="outbox.php?action=deleteone&id=' . $result[0] . '&' . $link . '"  onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" >' . Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
         }
         foreach ($message as $key => $value) {
             $message[$key] = $value;
         }
         $message_list[] = $message;
         $i++;
     }
     return $message_list;
 }
Example #3
0
    /**
     * Displays the information of an individual user
     * @param int $user_id
     */
    public static function display_individual_user($user_id)
    {
        global $interbreadcrumb;
        $safe_user_id = intval($user_id);

        $user_table = Database::get_main_table(TABLE_MAIN_USER);
        $sql = "SELECT * FROM $user_table WHERE user_id = ".$safe_user_id;
        $result = Database::query($sql);
        $html = null;
        if (Database::num_rows($result) == 1) {
            $user_object = Database::fetch_object($result);
            $alt = GetFullUserName($user_id).($_SESSION['_uid'] == $user_id ? '&nbsp;('.get_lang('Me').')' : '');
            $status = get_status_from_code($user_object->status);
            $interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList'));

            $html .= '<div class ="thumbnail">';
            if (strlen(trim($user_object->picture_uri)) > 0) {
                $sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system');
                $sysdir = $sysdir_array['dir'];
                $webdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'web');
                $webdir = $webdir_array['dir'];
                $fullurl = $webdir.$user_object->picture_uri;
                $system_image_path = $sysdir.$user_object->picture_uri;
                list($width, $height, $type, $attr) = @getimagesize($system_image_path);
                $height += 30;
                $width += 30;
                // get the path,width and height from original picture
                $big_image = $webdir.'big_'.$user_object->picture_uri;
                $big_image_size = api_getimagesize($big_image);
                $big_image_width = $big_image_size['width'];
                $big_image_height = $big_image_size['height'];
                $url_big_image = $big_image.'?rnd='.time();
                //echo '<a href="javascript:void()" onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');" >';
                $html .= '<img src="'.$fullurl.'" alt="'.$alt.'" />';
            } else {
                $html .= Display::return_icon('unknown.jpg', get_lang('Unknown'));
            }
            if (!empty($status)) {
                $html .= '<div class="caption">'.$status.'</div>';
            }
            $html .= '</div>';

            if (api_get_setting('show_email_addresses') == 'true') {
                $html .= Display::encrypted_mailto_link($user_object->email, $user_object->email).'<br />';
            }

            if ($user_object->competences) {
                $html .= Display::page_subheader(get_lang('MyCompetences'));
                $html .= '<p>'.$user_object->competences.'</p>';
            }
            if ($user_object->diplomas) {
                $html .= Display::page_subheader(get_lang('MyDiplomas'));
                $html .= '<p>'.$user_object->diplomas.'</p>';
            }
            if ($user_object->teach) {
                $html .= Display::page_subheader(get_lang('MyTeach'));
                $html .= '<p>'.$user_object->teach.'</p>';
            }
            SocialManager::display_productions($user_object->user_id);
            if ($user_object->openarea) {
                $html .= Display::page_subheader(get_lang('MyPersonalOpenArea'));
                $html .= '<p>'.$user_object->openarea.'</p>';
            }
        } else {
            $html .= '<div class="actions-title">';
            $html .= get_lang('UsersOnLineList');
            $html .= '</div>';
        }

        return $html;
    }
Example #4
0
function show_compose_to_user ($receiver_id) {
	global $charset;
	$html = get_lang('To').':&nbsp;<strong>'.GetFullUserName($receiver_id).'</strong>';
	$default['title'] = api_xml_http_response_encode(get_lang('EnterTitle'));
	$default['users'] = array($receiver_id);
	$html .= manage_form($default);
    return $html;
}
Example #5
0
/**
 * Gets a list of chat calls made by others to the current user (info kept in main.user table)
 * @param   none - taken from global space
 * @return  string  An HTML-formatted message
 */
function chatcall() {
	global $_user, $_cid;

	if (!$_user['user_id']) {
		return (false);
	}
	$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
	$sql="SELECT chatcall_user_id, chatcall_date FROM $track_user_table
	      WHERE ( user_id = '".$_user['user_id']."' )";
	$result=Database::query($sql);
	$row=Database::fetch_array($result);

	$login_date=$row['chatcall_date'];
	$hour = substr($login_date,11,2);
	$minute = substr($login_date,14,2);
	$secund = substr($login_date,17,2);
	$month = substr($login_date,5,2);
	$day = substr($login_date,8,2);
	$year = substr($login_date,0,4);
	$calltime = mktime($hour,$minute,$secund,$month,$day,$year);

	$time = api_get_utc_datetime($time);
	$minute_passed=5;  //within this limit, the chat call request is valid
	$limittime = mktime(date("H"),date("i")-$minute_passed,date("s"),date("m"),date("d"),date("Y"));

	if (($row['chatcall_user_id']) and ($calltime>$limittime)) {
		$webpath=api_get_path(WEB_CODE_PATH);
		$message=get_lang('YouWereCalled').' : '.GetFullUserName($row['chatcall_user_id'],'').'<br>'.get_lang('DoYouAccept')
							."<p>"
				."<a href=\"".$webpath."chat/chat.php?cidReq=".$_cid."&origin=whoisonlinejoin\">"
				. get_lang("Yes")
				."</a>"
				."&nbsp;&nbsp;|&nbsp;&nbsp;"
				."<a href=\"".api_get_path(WEB_PATH)."webchatdeny.php\">"
				. get_lang("No")
				."</a>"
				."</p>";

		return($message);
	} else {
		return false;
	}
}