Skip to content

Commit

Permalink
MDL-20700 coding style cleanup - cvs keywords removed, closign php ta…
Browse files Browse the repository at this point in the history
…g removed, trailing whitespace cleanup
  • Loading branch information
skodak committed Nov 1, 2009
1 parent 6c3ef41 commit 1d42298
Show file tree
Hide file tree
Showing 39 changed files with 117 additions and 153 deletions.
14 changes: 7 additions & 7 deletions message/discussion.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
scrolling="yes" marginwidth="10" marginheight="10" frameborder="0" />
<frame src="refresh.php?id=<?php p($user->id)?>&amp;name=<?php echo urlencode(fullname($user)) ?>" name="refresh"
scrolling="no" marginwidth="0" marginheight="0" frameborder="0" />

<frame src="send.php?id=<?php p($user->id)?>" name="send"
scrolling="no" marginwidth="2" marginheight="2" frameborder="0" />
</frameset>
Expand Down Expand Up @@ -233,7 +233,7 @@
$options = new object();
$options->para = false;
$options->newlines = true;

$params = array('uid1'=>$USER->id ,'userid1'=>$userid, 'start1'=>$start, 'uid2'=>$USER->id ,'userid2'=>$userid, 'start2'=>$start);
if ($newonly) {
$lastsql1 = " AND timecreated > :last1";
Expand All @@ -249,7 +249,7 @@
if ($messages = $DB->get_records_select('message_read', "(useridto = :uid1 AND useridfrom = :userid1 AND timeread > :start1 $lastsql1) OR (useridto = :userid2 AND useridfrom = :uid2 AND timeread > :start2 $lastsql2)", $params)) {
foreach ($messages as $message) {
$time = userdate($message->timecreated, get_string('strftimedatetimeshort'));

if ($message->useridfrom == $USER->id) {
$fullname = $mefullname;
} else {
Expand Down Expand Up @@ -277,7 +277,7 @@
if ($messages = $DB->get_records_select('message', "useridto = :userid1 AND useridfrom = :uid1 $lastsql1", $params)) {
foreach ($messages as $message) {
$time = userdate($message->timecreated, get_string('strftimedatetimeshort'));

if ($message->fullmessageformat == FORMAT_HTML){
$printmessage = format_text($message->fullmessagehtml, $message->fullmessageformat, $options, 0);
} else{
Expand All @@ -296,11 +296,11 @@
}
}
/*Get still to be read message, use message/lib.php funtion*/
$messages = message_get_popup_messages($USER->id, $userid);
$messages = message_get_popup_messages($USER->id, $userid);
if ($messages) {
foreach ($messages as $message) {
$time = userdate($message->timecreated, get_string('strftimedatetimeshort'));

if ($message->fullmessageformat == FORMAT_HTML){
$printmessage = format_text($message->fullmessagehtml, $message->fullmessageformat, $options, 0);
} else{
Expand All @@ -316,7 +316,7 @@
$sortkey = $message->timecreated."$i";
}
$allmessages[$sortkey] = $printmessage;

if ($message->timecreated < $start) {
$start = $message->timecreated; // move start back so that we see all current history
}
Expand Down
9 changes: 4 additions & 5 deletions message/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
if ($course->id != SITEID) {
require_login($course);

} else {
} else {
if (!isloggedin()) {
if (empty($SESSION->wantsurl)) {
$SESSION->wantsurl = $CFG->httpswwwroot.'/message/edit.php';
Expand Down Expand Up @@ -132,7 +132,7 @@
redirect("$CFG->wwwroot/message/edit.php?id=$user->id&course=$course->id");
}

/// Load preferences
/// Load preferences
$preferences = new object();

/// Get providers preferences
Expand All @@ -153,7 +153,7 @@

/// For every processors put its options on the form (need to get function from processor's lib.php)
$processors = $DB->get_records('message_processors');
foreach ( $processors as $processorid => $processor){
foreach ( $processors as $processorid => $processor){
$processorfile = $CFG->dirroot. '/message/output/'.$processor->name.'/message_output_'.$processor->name.'.php';
if ( is_readable($processorfile) ) {
include_once( $processorfile );
Expand All @@ -172,7 +172,7 @@
$strparticipants = get_string('participants');
$userfullname = fullname($user, true);

if (has_capability('moodle/course:viewparticipants', $coursecontext) ||
if (has_capability('moodle/course:viewparticipants', $coursecontext) ||
has_capability('moodle/site:viewparticipants', $systemcontext)) {
$PAGE->navbar->add($strparticipants, new moodle_url($CFG->wwwroot.'/message/index.php', array('id'=>$course->id)));
}
Expand Down Expand Up @@ -267,4 +267,3 @@

echo $OUTPUT->footer();

?>
3 changes: 1 addition & 2 deletions message/history.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package message
*/

require('../config.php');
require('lib.php');

Expand Down Expand Up @@ -131,4 +131,3 @@

echo $OUTPUT->footer();

?>
11 changes: 5 additions & 6 deletions message/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,21 @@
$PAGE->set_generaltype('popup');
$PAGE->set_title(get_string('messages', 'message').' - '.format_string($SITE->fullname));
echo $OUTPUT->header();
echo '<table cellspacing="2" cellpadding="2" border="0" width="95%" class="boxaligncenter">';
echo '<table cellspacing="2" cellpadding="2" border="0" width="95%" class="boxaligncenter">';
echo '<tr>';

/// Print out the tabs
echo '<td>';
$tabrow = array();
$tabrow[] = new tabobject('contacts', $CFG->wwwroot.'/message/index.php?tab=contacts',
$tabrow[] = new tabobject('contacts', $CFG->wwwroot.'/message/index.php?tab=contacts',
get_string('contacts', 'message'));
$tabrow[] = new tabobject('search', $CFG->wwwroot.'/message/index.php?tab=search',
$tabrow[] = new tabobject('search', $CFG->wwwroot.'/message/index.php?tab=search',
get_string('search', 'message'));
$tabrow[] = new tabobject('settings', $CFG->wwwroot.'/message/index.php?tab=settings',
$tabrow[] = new tabobject('settings', $CFG->wwwroot.'/message/index.php?tab=settings',
get_string('settings', 'message'));
$tabrows = array($tabrow);

print_tabs($tabrows, $tab);
print_tabs($tabrows, $tab);

echo '</td>';

Expand All @@ -135,4 +135,3 @@
echo '</td> </tr> </table>';
echo $OUTPUT->footer();

?>
28 changes: 14 additions & 14 deletions message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ function message_print_contacts() {
$strangers = array();


// get all in our contactlist who are not blocked in our contact list
// get all in our contactlist who are not blocked in our contact list
// and count messages we have waiting from each of them
$contactsql = "SELECT u.id, u.firstname, u.lastname, u.picture,
$contactsql = "SELECT u.id, u.firstname, u.lastname, u.picture,
u.imagealt, u.lastaccess, count(m.id) as messagecount
FROM {message_contacts} mc
JOIN {user} u ON u.id = mc.contactid
LEFT OUTER JOIN {message} m ON m.useridfrom = mc.contactid AND m.useridto = ?
WHERE mc.userid = ? AND mc.blocked = 0
WHERE mc.userid = ? AND mc.blocked = 0
GROUP BY u.id, u.firstname, u.lastname, u.picture,
u.imagealt, u.lastaccess
ORDER BY u.firstname ASC";
Expand All @@ -88,12 +88,12 @@ function message_print_contacts() {

// get messages from anyone who isn't in our contact list and count the number
// of messages we have from each of them
$strangersql = "SELECT u.id, u.firstname, u.lastname, u.picture,
$strangersql = "SELECT u.id, u.firstname, u.lastname, u.picture,
u.imagealt, u.lastaccess, count(m.id) as messagecount
FROM {message} m
JOIN {user} u ON u.id = m.useridfrom
LEFT OUTER JOIN {message_contacts} mc ON mc.contactid = m.useridfrom AND mc.userid = m.useridto
WHERE mc.id IS NULL AND m.useridto = ?
WHERE mc.id IS NULL AND m.useridto = ?
GROUP BY u.id, u.firstname, u.lastname, u.picture,
u.imagealt, u.lastaccess
ORDER BY u.firstname ASC";
Expand Down Expand Up @@ -532,7 +532,7 @@ function message_print_user ($user=false, $iscontact=false, $isblocked=false) {
$userpic = moodle_user_picture::make($USER, SITEID);
$userpic->size = 20;
$userpic->link = true;

if ($user === false) {
echo $OUTPUT->user_picture($userpic);
} else {
Expand Down Expand Up @@ -584,7 +584,7 @@ function message_contact_link($userid, $linktype='add', $return=false, $script="

$command = $linktype.'contact';
$string = $str->{$command};
$alttext = $text ? '' : $string;
$alttext = $text ? '' : $string;
$text = $text ? '&nbsp;'.$string : '';

switch ($linktype) {
Expand Down Expand Up @@ -712,7 +712,7 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
return $DB->get_records_sql("SELECT $fields
FROM {user} u
LEFT JOIN {message_contacts} mc
ON mc.contactid = u.id AND mc.userid = ?
ON mc.contactid = u.id AND mc.userid = ?
WHERE $select
AND ($fullname $LIKE ?)
$except
Expand All @@ -728,7 +728,7 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
FROM {user} u
JOIN {role_assignments} ra ON ra.userid = u.id
LEFT JOIN {message_contacts} mc
ON mc.contactid = u.id AND mc.userid = ?
ON mc.contactid = u.id AND mc.userid = ?
WHERE $select
AND ra.contextid $contextlists
AND ($fullname $LIKE ?)
Expand Down Expand Up @@ -1011,7 +1011,7 @@ function message_format_message(&$message, &$user, $format='', $keywords='', $cl
*/
function message_post_message($userfrom, $userto, $message, $format, $messagetype) {
global $CFG, $SITE, $USER, $DB;

$eventdata = new object();
$eventdata->component = 'message';
$eventdata->name = 'instantmessage';
Expand Down Expand Up @@ -1045,7 +1045,7 @@ function message_get_participants() {
}

/**
* Print a row of contactlist displaying user picture, messages waiting and
* Print a row of contactlist displaying user picture, messages waiting and
* block links etc
* @param $contact contact object containing all fields required for $OUTPUT->user_picture()
* @param $incontactlist is the user a contact of ours?
Expand Down Expand Up @@ -1078,7 +1078,7 @@ function message_print_contactlist_user($contact, $incontactlist = true){
echo $OUTPUT->user_picture($userpic);
echo '</td>';
echo '<td class="contact">';

$popupoptions = array(
'height' => 500,
'width' => 500,
Expand Down Expand Up @@ -1126,7 +1126,7 @@ function message_move_userfrom_unread2read($userid) {

function message_get_popup_messages($destuserid, $fromuserid=NULL){
global $DB;

$processor = $DB->get_record('message_processors', array('name' => 'popup'));

$messagesproc = $DB->get_records('message_working', array('processorid'=>$processor->id), 'id ASC');
Expand All @@ -1144,7 +1144,7 @@ function message_get_popup_messages($destuserid, $fromuserid=NULL){
$message->timeread = time();
$messageid = $message->id;
unset($message->id);

//delete what we've processed and check if can move message
$DB->delete_records('message_working', array('id' => $msgp->id));
if ( $DB->count_records('message_working', array('unreadmessageid'=>$messageid)) == 0){
Expand Down
3 changes: 1 addition & 2 deletions message/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@
echo $OUTPUT->header();
echo "<div id='messages'></div>";
echo $OUTPUT->footer();

?>

5 changes: 2 additions & 3 deletions message/output/email/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
* Upgrade code for email message processor
*
* @author Luis Rodrigues
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package
* @package
*/

function xmldb_message_email_upgrade($oldversion) {
Expand All @@ -52,4 +51,4 @@ function xmldb_message_email_upgrade($oldversion) {
return $result;
}

?>

5 changes: 2 additions & 3 deletions message/output/email/lib.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

///////////////////////////////////////////////////////////////////////////
// //
Expand Down Expand Up @@ -27,9 +27,8 @@
* Email message processor - lib file
*
* @author Luis Rodrigues
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package
* @package
*/

/**
Expand Down
15 changes: 7 additions & 8 deletions message/output/email/message_output_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
* Email message processor - send a given message by email
*
* @author Luis Rodrigues
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package
* @package
*/
require_once($CFG->dirroot.'/message/output/lib.php');

Expand Down Expand Up @@ -57,7 +56,7 @@ function send_message($message) {
$message->fullmessagehtml)
){
/// Move the entry to the other table
$message->timeread = time();
$message->timeread = time();
$messageid = $message->id;
unset($message->id);

Expand All @@ -78,11 +77,11 @@ function send_message($message) {
return true;
}

/**
/**
* Creates necessary fields in the messaging config form.
* @param object $mform preferences form class
*/
function config_form($preferences){
function config_form($preferences){
global $USER;
$string = get_string('email').': <input size="30" name="email_email" value="'.$preferences->email_email.'" />';
if (empty($preferences->email_email)) {
Expand All @@ -94,15 +93,15 @@ function config_form($preferences){
/**
* Parses the form submited data and saves it into preferences array.
* @param object $mform preferences form class
* @param array $preferences preferences array
* @param array $preferences preferences array
*/
function process_form($form, &$preferences){
$preferences['message_processor_email_email'] = $form->email_email;
}

/**
* Loads the config data from database to put on the form (initial load)
* @param array $preferences preferences array
* Loads the config data from database to put on the form (initial load)
* @param array $preferences preferences array
* @param int $userid the user id
*/
function load_data(&$preferences, $userid){
Expand Down
3 changes: 1 addition & 2 deletions message/output/email/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* Email processor version information
*
* @author Luis Rodrigues
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package
*/
Expand All @@ -36,4 +35,4 @@
$plugin->version = 2008072401;
$plugin->requires = 2008072401;

?>

5 changes: 2 additions & 3 deletions message/output/jabber/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
* Upgrade code for jabber message processor
*
* @author Luis Rodrigues
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package
* @package
*/

function xmldb_message_jabber_upgrade($oldversion) {
Expand All @@ -52,4 +51,4 @@ function xmldb_message_jabber_upgrade($oldversion) {
return $result;
}

?>

3 changes: 1 addition & 2 deletions message/output/jabber/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
* Jabber message processor - lib file
*
* @author Luis Rodrigues
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package
* @package
*/

/**
Expand Down
Loading

0 comments on commit 1d42298

Please sign in to comment.