Changeset 156

Show
Ignore:
Timestamp:
12/14/07 20:41:42 (1 year ago)
Author:
dramirez
Message:

MESSAGES: Added version 0.2.3 for 0.8 series

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • messages/releases/0.2.3-0.8/lib/messages_config.php

    r154 r156  
    88 * @copyright Corporación Somos Más - 2007 
    99 */ 
     10  
    1011 /** 
    11   * Configure if the sidebar link display if available for no member communities 
     12  * Configure if the sidebar link display would be available for no member communities 
    1213  * Type: boolean 
    1314  */ 
    14  define("MESSAGES_SIDEBAR_NO_MEMBER_LINK",false); 
     15 define("MESSAGES_SIDEBAR_NO_MEMBER_LINK",true); 
     16 
     17 /** 
     18  * Configure if you want to enable to send messages to communities 
     19  * Type: boolean 
     20  */ 
     21 define("MESSAGES_COMMUNITY_MESSAGES",true);   
    1522?> 
  • messages/releases/0.2.3-0.8/lib/messages_init.php

    r154 r156  
    11<?php 
    2  
    32/* 
    43 * This script initialize the enviroment for the private messages plug-in. 
     
    1110global $USER, $messages; 
    1211if ($profile_name = optional_param('profile_name')) { 
    13        if ($profile_id = user_info_username('ident', $profile_name)) { 
    14                $page_owner = $profile_id; 
    15        
     12  if ($profile_id = user_info_username('ident', $profile_name)) { 
     13    $page_owner = $profile_id; 
     14 
    1615} 
    1716 
    1817if (empty ($profile_id)) { 
    19        $profile_id = optional_param("profile_id", optional_param("profileid", $_SESSION['userid'], PARAM_INT), PARAM_INT); 
     18  $profile_id = optional_param("profile_id", optional_param("profileid", $_SESSION['userid'], PARAM_INT), PARAM_INT); 
    2019} 
    2120 
    2221if (!logged_on) { 
    23         $messages[] = __gettext("You must be logged in to send a message to another user!."); 
    24         $messages[] = __gettext("If you are not registered in this site yet, please fill the following form."); 
    25         $_SESSION['messages'] = $messages; 
    26         header("Location: " . url . "register"); 
    27         exit; 
     22  header("Location: " . url); 
     23  exit; 
    2824} 
    2925if ($profile_id != $USER->ident || !logged_on) { 
    30         $messages[] = __gettext("You may view only your own messages"); 
    31         $redirect_url = url . user_info('username', $USER->ident) . "/messages/"; 
    32         $_SESSION['messages'] = $messages; 
    33         header("Location: " . $redirect_url); 
    34         exit; 
    35 
    36  
    37 $message = optional_param('message'); 
    38 if (isset ($message)) { 
    39         $msg = get_record('messages', 'ident', $message); 
    40         $sent = optional_param('sent'); 
    41          
    42         $authorid = ($sent == 0) ? $msg->to_id : $msg->from_id; 
    43         error_log($authorid); 
    44         error_log($USER->ident); 
    45          
    46         if ($authorid != $USER->ident || !logged_on) { 
    47                 $messages[] = __gettext("You may view only your own messages"); 
    48                 $redirect_url = url . user_info('username', $USER->ident) . "/messages/"; 
    49                 $_SESSION['messages'] = $messages; 
    50                 header("Location: " . $redirect_url); 
    51                 exit; 
    52         } 
     26  $messages[] = __gettext("You may view only your own messages"); 
     27  $redirect_url = url . user_info('username', $USER->ident) . "/messages/"; 
     28  $_SESSION['messages'] = $messages; 
     29  header("Location: " . $redirect_url); 
     30  exit; 
    5331} 
    5432?> 
  • messages/releases/0.2.3-0.8/lib/messages_message_detailedview.php

    r154 r156  
    3030    $author->ident= -1; 
    3131  } 
    32   $author->icon= '<a href="' . url . $author->username . '/">' .user_icon_html($author->ident,60)."</a>"; 
     32  $author->icon= '<a href="' . url . $author->username . '/">' .user_icon_html($author->ident)."</a>"; 
    3333 
    3434  $date= strftime("%d %b %Y, %H:%M", $msg->posted); 
     
    4646  $links .= '&nbsp;<a href="' . $CFG->wwwroot . 'mod/messages/messages_actions.php?action=delete&amp;sent=' . $sent . '&amp;msg_id=' . $msg->ident . '" onclick="return confirm(\'' . $returnConfirm . '\')">' . $Delete . '</a> |'; 
    4747 
    48   // Obtaining the previous and next messages for put the links here for easy navigation 
    49   $msgs_ids = $_SESSION['messages_ids'.$sent]; 
    50  
    51   for($ii=0; $ii < count($msgs_ids); $ii++){ 
    52         if($msgs_ids[$ii] == $msg->ident){ 
    53                 $previous = ($ii>0)? $msgs_ids[$ii-1] : -1; 
    54       $next = (($ii + 1) < count($msgs_ids))? $msgs_ids[$ii+1] : -1; 
    55         } 
    56   }   
    57  
    58   if($previous!=-1){ 
    59     $msg_nav= '<a href="' . url . $_SESSION['username'] . '/messages/view/' . $previous . "/$sent\">" . __gettext("Previous") . "</a>"; 
    60   } 
    61   $msg_nav.="&nbsp;|&nbsp;"; 
    62   if($next!=-1){ 
    63     $msg_nav.= '<a href="' . url . $_SESSION['username'] . '/messages/view/' . $next . "/$sent\">" . __gettext("Next") . "</a>"; 
    64   } 
    65    
    6648  // Updated the message to the read status 
    6749  if ($msg->status == "unread" && $msg->to_id == $profile_id) { 
     
    7860    'from_icon' => $author->icon, 
    7961    'body' => $body, 
    80     'links' => $links, 
    81     'msg_nav' => $msg_nav 
     62    'links' => $links 
    8263  )); 
    8364} 
  • messages/releases/0.2.3-0.8/lib/messages_new.php

    r154 r156  
    2828      $friend = get_record("users", "ident", $friend->friend); 
    2929      if ($friend) { 
    30         $to_param[$friend->ident] = $friend->name; 
    31         if ($friend->user_type == "community") { 
    32           $to_param[$friend->ident] .= " " . __gettext("(Community)"); 
     30        if ($friend->user_type == "community" && MESSAGES_COMMUNITY_MESSAGES) { 
     31          $to_param[$friend->ident] = $friend->name." " . __gettext("(Community)"); 
     32        } 
     33        else if($friend->user_type != "community"){ 
     34          $to_param[$friend->ident] = $friend->name; 
    3335        } 
    3436      } 
     
    6668$subject = __gettext("Subject:"); 
    6769$message = __gettext("Message:"); 
    68 $submitButton = ($action == "reply") ? __gettext("Reply") : __gettext("Send")
     70$submitButton = ($action == "reply") ? "Reply" : "Send"
    6971 
    7072$run_result =<<< END 
  • messages/releases/0.2.3-0.8/lib/messages_sidebar_link.php

    r154 r156  
    11<?php 
    2  
    3  
    42/* 
    53 * This script shows the 'Send Message' link in the sidebar 
    64 * 
    7  * @uses $CFG 
     5 * @uses $CFG,$USER 
    86 * 
    97 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     
    2018if (isloggedin() && $page_owner != $_SESSION['userid'] && $page_owner != -1) { 
    2119  $messages_link = '<ul><li><a href="' . $CFG->wwwroot . "mod/messages/compose.php?action=compose&to=$page_owner" . '">' . __gettext("Send Message") . '</a></li></ul>'; 
    22   if (!MESSAGES_SIDEBAR_NO_MEMBER_LINK  
     20  if (!MESSAGES_SIDEBAR_NO_MEMBER_LINK 
    2321       && user_type($page_owner) == "community"  
    2422       && count_records_sql($community_membership_query, array ($USER->ident,$page_owner)) == 0) { 
    2523    $messages_link = ''; 
     24  } 
     25  else if(!MESSAGES_COMMUNITY_MESSAGES && user_type($page_owner) == "community" ){ 
     26        $messages_link = ''; 
    2627  } 
    2728  $run_result .= $messages_link; 
  • messages/releases/0.2.3-0.8/lib/messages_view.php

    r154 r156  
    5151} 
    5252 
     53//$posts = get_records_select('messages', "$where_sent AND from_id != -1 ", null, 'posted DESC', '*', $msg_offset, $msgs_per_page); 
     54//$numberofposts = count_records_select('messages', "$where_sent AND from_id != -1 "); 
    5355 
    54 $posts = get_records_select('messages', "$where_sent", null, 'posted DESC,ident ASC', '*', $msg_offset, $msgs_per_page); 
    55 $msgs_ids = get_records_sql("SELECT ident FROM {$CFG->prefix}messages WHERE $where_sent ORDER BY posted DESC, ident ASC");  
    56 if(!empty($msgs_ids)){ 
    57         $_SESSION['messages_ids'.$sent] = array_keys($msgs_ids); 
    58 
     56$posts = get_records_select('messages', "$where_sent", null, 'posted DESC', '*', $msg_offset, $msgs_per_page); 
    5957$numberofposts = count_records_select('messages', "$where_sent"); 
    6058 
     
    7270  $next = __gettext("Next"); 
    7371 
     72  if ($numberofposts - ($msg_offset + $msgs_per_page) > 0) { 
     73    $display_msg_offset = $msg_offset + $msgs_per_page; 
     74    $pagging .=<<< END 
     75 
     76                <a href="{$CFG->wwwroot}{$msg_name}/messages/{$filterlink}msg_offset/{$display_msg_offset}">$next &gt;&gt;</a> 
     77 
     78END; 
     79  } 
    7480  if ($msg_offset > 0) { 
    7581    $display_msg_offset = $msg_offset - $msgs_per_page; 
     
    7985    $pagging .=<<< END 
    8086 
    81                <a href="{$CFG->wwwroot}{$msg_name}/messages/{$filterlink}msg_offset/{$display_msg_offset}"><small>&lt;&lt;</small> $back</a> 
     87                <a href="{$CFG->wwwroot}{$msg_name}/messages/{$filterlink}msg_offset/{$display_msg_offset}">&lt;&lt; $back</a> 
    8288 
    8389END; 
    8490  } 
    8591 
    86   if ($numberofposts - ($msg_offset + $msgs_per_page) > 0) { 
    87     $display_msg_offset = $msg_offset + $msgs_per_page; 
    88     $pagging .=<<< END 
    89  
    90                 &nbsp;&nbsp;<a href="{$CFG->wwwroot}{$msg_name}/messages/{$filterlink}msg_offset/{$display_msg_offset}">$next <small>&gt;&gt;</small></a> 
    91  
    92 END; 
    93   } 
    9492} 
    9593