? .cvsignore ? privatemsg.cs.patch Index: privatemsg-recipients.tpl.php =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg-recipients.tpl.php,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 privatemsg-recipients.tpl.php --- privatemsg-recipients.tpl.php 19 Dec 2008 06:09:50 -0000 1.1.2.2 +++ privatemsg-recipients.tpl.php 6 Nov 2009 12:55:20 -0000 @@ -1,6 +1,8 @@ -
Index: privatemsg-view.tpl.php =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg-view.tpl.php,v retrieving revision 1.1.2.5 diff -u -p -r1.1.2.5 privatemsg-view.tpl.php --- privatemsg-view.tpl.php 17 Jul 2009 00:32:05 -0000 1.1.2.5 +++ privatemsg-view.tpl.php 6 Nov 2009 12:55:20 -0000 @@ -1,7 +1,8 @@ -
Index: privatemsg.api.php =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/Attic/privatemsg.api.php,v retrieving revision 1.1.2.8 diff -u -p -r1.1.2.8 privatemsg.api.php --- privatemsg.api.php 27 Oct 2009 12:55:18 -0000 1.1.2.8 +++ privatemsg.api.php 6 Nov 2009 12:55:21 -0000 @@ -63,8 +63,8 @@ * // Add a field. * $fragments['select'][] = 'pm.subject'; * - * // Join another table - * $fragment['inner_join'][] = 'INNER JOIN {pm_index} pi ON (pi.mid = pm.mid AND pi.uid = %d)'; + * // Join another table. + * $fragment['inner_join'][] = 'JOIN {pm_index} pi ON (pi.mid = pm.mid)'; * $fragment['query_args']['join'][] $uid; * * // And finally add a condition. Index: privatemsg.author-pane.inc =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/Attic/privatemsg.author-pane.inc,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 privatemsg.author-pane.inc --- privatemsg.author-pane.inc 16 Jul 2009 21:42:43 -0000 1.1.2.3 +++ privatemsg.author-pane.inc 6 Nov 2009 12:55:21 -0000 @@ -7,7 +7,7 @@ */ /** - * Implementation of hook_preprocess_author_pane(). + * Implements hook_preprocess_author_pane(). */ function privatemsg_preprocess_author_pane(&$variables) { $image_path = $variables['image_path']; @@ -15,6 +15,6 @@ function privatemsg_preprocess_author_pa if ($url = privatemsg_get_link($variables['account'])) { $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE); $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE)); - $variables['privatemsg_link'] = l(t('Send PM'). '', $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE)); + $variables['privatemsg_link'] = l(t('Send PM') . '', $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE)); } } Index: privatemsg.install =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.install,v retrieving revision 1.5.2.4.2.11.2.15 diff -u -p -r1.5.2.4.2.11.2.15 privatemsg.install --- privatemsg.install 1 Nov 2009 21:57:25 -0000 1.5.2.4.2.11.2.15 +++ privatemsg.install 6 Nov 2009 12:55:21 -0000 @@ -303,7 +303,7 @@ function privatemsg_update_6000() { } } - //Step 2b: Next, copy the user blocking data. + // Step 2b: Next, copy the user blocking data. if (db_table_exists('privatemsg_block_user')) { $data = db_query("SELECT * FROM {privatemsg_block_user}"); while ($result = db_fetch_array($data)) { @@ -311,7 +311,7 @@ function privatemsg_update_6000() { } } - //Step 2c: Next the data from the archive table - notice all these messages have been deleted both by the author and the recipient. + // Step 2c: Next the data from the archive table - notice all these messages have been deleted both by the author and the recipient. if (db_table_exists('privatemsg_archive')) { $data = db_query("SELECT * FROM {privatemsg_archive}"); while ($result = db_fetch_array($data)) { @@ -329,7 +329,7 @@ function privatemsg_update_6000() { } } - //Step 2d: Finally, get the data from the privatemsg table. + // Step 2d: Finally, get the data from the privatemsg table. if (db_table_exists('privatemsg')) { $data = db_query("SELECT * FROM {privatemsg}"); while ($result = db_fetch_array($data)) { @@ -419,15 +419,16 @@ function privatemsg_update_6002() { } /** - * Update function to resolve "forever new" messages - * as described in http://drupal.org/node/490650 + * Update function to resolve "forever new" messages. + * + * As described in http://drupal.org/node/490650 */ function privatemsg_update_6003() { $ret = array(); // Find messages that have aformentioned problem - $sql = "SELECT DISTINCT p1.mid, p1.uid FROM {pm_index} p1 INNER JOIN {pm_index} p2 ON p1.thread_id = p2.thread_id AND p1.mid = p2.mid INNER JOIN {pm_message} pm ON p1.uid = pm.author AND p2.uid = pm.author WHERE p1.is_new != p2.is_new"; + $sql = "SELECT DISTINCT p1.mid, p1.uid FROM {pm_index} p1 INNER JOIN {pm_index} p2 ON p1.thread_id = p2.thread_id AND p1.mid = p2.mid INNER JOIN {pm_message} pm ON p1.uid = pm.author AND p2.uid = pm.author WHERE p1.is_new <> p2.is_new"; $result = db_query($sql); - while($row = db_fetch_object($result)) { + while ($row = db_fetch_object($result)) { privatemsg_message_change_status($row->mid, PRIVATEMSG_READ, $row ); } $ret[] = array('success' => $result !== FALSE, 'query' => check_plain($sql)); Index: privatemsg.module =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.module,v retrieving revision 1.70.2.30.2.91.2.88 diff -u -p -r1.70.2.30.2.91.2.88 privatemsg.module --- privatemsg.module 2 Nov 2009 11:41:27 -0000 1.70.2.30.2.91.2.88 +++ privatemsg.module 6 Nov 2009 12:55:21 -0000 @@ -16,7 +16,7 @@ define('PRIVATEMSG_READ', 0); define('PRIVATEMSG_UNREAD', 1); /** - * Implementation of hook_perm(). + * Implements hook_perm(). */ function privatemsg_perm() { return array( @@ -109,7 +109,7 @@ function _privatemsg_format_participants } /** - * Implementation of hook_menu(). + * Implements hook_menu(). */ function privatemsg_menu() { $items['messages'] = array( @@ -302,7 +302,8 @@ function privatemsg_thread_load($thread_ // if there are no messages, don't allow access to the thread. if (empty($thread['messages'])) { $thread = FALSE; - } else { + } + else { // general data, assume subject is the same for all messages of that thread. $thread['user'] = $account; $message = current($thread['messages']); @@ -322,7 +323,7 @@ function private_message_view_options() } /** - * Implementation of hook_privatemsg_view_template(). + * Implements hook_privatemsg_view_template(). * * Allows modules to define different message view template. * @@ -425,7 +426,7 @@ function private_message_settings_submit } /** - * Implementation of hook_cron(). + * Implements hook_cron(). * * If the flush feature is enabled, a given amount of deleted messages that are * old enough are flushed. @@ -522,7 +523,7 @@ function privatemsg_preprocess_privatems $vars['anchors'] = ''; foreach ($vars['message_anchors'] as $anchor) { - $vars['anchors'].= ''; + $vars['anchors'] .= ''; } } @@ -647,7 +648,7 @@ function privatemsg_unread_count($accoun * privatemsg_thread_load(). * @return * The page content. - * @see privatemsg_thread_load(). + * @see privatemsg_thread_load() */ function privatemsg_view($thread) { drupal_set_title(check_plain($thread['subject'])); @@ -681,7 +682,7 @@ function privatemsg_view($thread) { drupal_set_message(t('This conversation is being viewed with escalated priviledges and may not be the same as shown to normal users.'), 'warning'); } - //allow other modules to hook into the $content array and alter it + // Allow other modules to hook into the $content array and alter it. drupal_alter('privatemsg_view_messages', $content, $thread); return drupal_render($content); } @@ -742,14 +743,15 @@ function privatemsg_new(&$form_state, $r if (isset($form_state['values'])) { if (isset($form_state['values']['recipient'])) { $recipients_string = $form_state['values']['recipient']; - + } $subject = $form_state['values']['subject']; $body = $form_state['values']['body']; } if (!$thread_id && !empty($recipients_string)) { drupal_set_title(t('Write new message to %recipient', array('%recipient' => $recipients_string))); - } elseif (!$thread_id) { + } + elseif (!$thread_id) { drupal_set_title(t('Write new message')); } @@ -922,7 +924,6 @@ function _privatemsg_load_thread_partici * @return * Array, first element is an array of loaded user objects, second an array * with invalid names. - * */ function _privatemsg_parse_userstring($input) { if (is_string($input)) { @@ -998,11 +999,12 @@ function pm_preview($form, &$form_state) * Query definition to load a list of threads. * * @param $fragments - * Query fragments array. + * Query fragments array. * @param $account - * User object for which the messages are being loaded. + * User object for which the messages are being loaded. * @param $argument - * string argument which can be used in the query builder to modify the thread listing. + * String argument which can be used in the query builder to modify the + * thread listing. */ function privatemsg_sql_list(&$fragments, $account, $argument = 'list') { @@ -1023,12 +1025,12 @@ function privatemsg_sql_list(&$fragments if (in_array('participants', $fields)) { // Query for a string with uid's, for example "1,6,7". This needs a subquery on PostgreSQL. if ($GLOBALS['db_type'] == 'pgsql') { - $fragments['select'][] = "array_to_string(array(SELECT DISTINCT textin(int4out(pmia.uid)) + $fragments['select'][] = "array_to_string(array(SELECT DISTINCT textin(int4out(pmia.uid)) FROM {pm_index} pmia WHERE pmia.thread_id = pmi.thread_id), ',') AS participants"; } else { - $fragments['select'][] = '(SELECT GROUP_CONCAT(DISTINCT pmia.uid SEPARATOR ",") + $fragments['select'][] = '(SELECT GROUP_CONCAT(DISTINCT pmia.uid SEPARATOR ",") FROM {pm_index} pmia WHERE pmia.thread_id = pmi.thread_id) AS participants'; } @@ -1359,7 +1361,7 @@ function privatemsg_delete($form_state, function privatemsg_delete_submit($form, &$form_state) { global $user; $account = drupal_clone($user); - + if ($form_state['values']['confirm']) { if (isset($form_state['values']['delete_options']) && $form_state['values']['delete_options']) { privatemsg_message_change_delete($form_state['values']['pmid'], 1); @@ -1381,7 +1383,8 @@ function privatemsg_delete_submit($form, * @param $delete * Either deletes or restores the thread (1 => delete, 0 => restore) * @param $account - * User acccount for which the delete action should be carried out - Set to NULL to delete for all users. + * User acccount for which the delete action should be carried out - Set to + * NULL to delete for all users. * * @ingroup api */ @@ -1391,7 +1394,7 @@ function privatemsg_message_change_delet $delete_value = time(); } - if ($account){ + if ($account) { db_query('UPDATE {pm_index} SET deleted = %d WHERE mid = %d AND uid = %d', $delete_value, $pmid, $account->uid); } else { @@ -1427,10 +1430,10 @@ function privatemsg_message_change_delet * the key is the error type (error, warning, notice) and an array with * messages of that type. * - * It is theoretically possible for success to be TRUE and message to be FALSE. - * For example if one of the privatemsg database tables become corrupted. When testing - * for success of message being sent it is always best to see if ['message'] is not FALSE - * as well as ['success'] is TRUE. + * It is theoretically possible for success to be TRUE and message to be + * FALSE. For example if one of the privatemsg database tables become + * corrupted. When testing for success of message being sent it is always + * best to see if ['message'] is not FALSE as well as ['success'] is TRUE. * * Example: * @code @@ -1488,10 +1491,10 @@ function privatemsg_new_thread($recipien * with the created $message array, the same that is passed to * hook_privatemsg_message_insert(). * - * It is theoretically possible for success to be TRUE and message to be FALSE. - * For example if one of the privatemsg database tables become corrupted. When testing - * for success of message being sent it is always best to see if ['message'] is not FALSE - * as well as ['success'] is TRUE. + * It is theoretically possible for success to be TRUE and message to be + * FALSE. For example if one of the privatemsg database tables become + * corrupted. When testing for success of message being sent it is always + * best to see if ['message'] is not FALSE as well as ['success'] is TRUE. * * Example messages values: * @code @@ -1585,11 +1588,12 @@ function _privatemsg_validate_message(&$ } if (!empty($message['recipients']) && is_array($message['recipients'])) { - foreach(module_invoke_all('privatemsg_block_message', $message['author'], $message['recipients']) as $blocked) { + foreach (module_invoke_all('privatemsg_block_message', $message['author'], $message['recipients']) as $blocked) { unset($message['recipients'][$blocked['uid']]); if ($form) { drupal_set_message($blocked['message'], 'warning'); - } else { + } + else { $messages['warning'][] = $blocked['message']; } } @@ -1991,7 +1995,8 @@ function _privatemsg_action_form() { * @param $status * Either PRIVATEMSG_READ or PRIVATEMSG_UNREAD, sets the new status. * @param $account - * User object for which the threads should be deleted, defaults to the current user. + * User object for which the threads should be deleted, defaults to the + * current user. */ function privatemsg_thread_change_status($threads, $status, $account = NULL) { if (!is_array($threads)) { @@ -2018,7 +2023,8 @@ function privatemsg_thread_change_status * Uses @link theming theme patterns @endlink to theme single headers. * * @param $has_posts - * TRUE when there is at least one row. Decides if the select all checkbox should be displayed. + * TRUE when there is at least one row. Decides if the select all checkbox + * should be displayed. * @param $keys * Array with the keys which are present in the query/should be displayed. * @return @@ -2055,7 +2061,7 @@ function _privatemsg_list_headers($has_p function _privatemsg_list_headers_fallback($keys) { $header = array(); foreach ($keys as $key) { - $theme_function = 'phptemplate_privatemsg_list_header__' .$key; + $theme_function = 'phptemplate_privatemsg_list_header__' . $key; if (function_exists($theme_function)) { $header[$key] = $theme_function(); } @@ -2103,7 +2109,7 @@ function _privatemsg_list_thread($thread function _privatemsg_list_thread_fallback($thread) { $row_data = array(); foreach ($thread as $key => $data) { - $theme_function = 'phptemplate_privatemsg_list_field__' .$key; + $theme_function = 'phptemplate_privatemsg_list_field__' . $key; if (function_exists($theme_function)) { $row_data[$key] = $theme_function($thread); } @@ -2115,7 +2121,8 @@ function _privatemsg_list_thread_fallbac /** * Menu callback for messages/undo/action. * - * This function will test if an undo callback is stored in SESSION and execute it. + * This function will test if an undo callback is stored in SESSION and + * execute it. */ function privatemsg_undo_action() { // Check if a undo callback for that user exists. @@ -2203,7 +2210,7 @@ function privatemsg_operation_execute($o // @todo: Provide a more flexible solution for such an undo action, operation defined string for example. $_SESSION['privatemsg']['undo callback'] = array('function' => $undo_function, 'args' => $undo_args); $undo = url('messages/undo/action', array('query' => drupal_get_destination())); - + drupal_set_message(t('The previous action can be undone.', array('!undo' => $undo))); } } @@ -2214,9 +2221,11 @@ function privatemsg_operation_execute($o * @param $threads * Array with thread id's or a single thread id. * @param $delete - * Indicates if the threads should be deleted or restored. 1 => delete, 0 => restore. + * Indicates if the threads should be deleted or restored. + * 1 => delete, 0 => restore. * @param $account - * User object for which the threads should be deleted, defaults to the current user. + * User object for which the threads should be deleted, + * defaults to the current user. */ function privatemsg_thread_change_delete($threads, $delete, $account = NULL) { if (!is_array($threads)) { @@ -2248,7 +2257,7 @@ function privatemsg_thread_change_delete } /** - * Implementation of hook_privatemsg_thread_operations(). + * Implements hook_privatemsg_thread_operations(). */ function privatemsg_privatemsg_thread_operations() { $operations = array( Index: privatemsg.test =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.test,v retrieving revision 1.2.2.7 diff -u -p -r1.2.2.7 privatemsg.test --- privatemsg.test 2 Nov 2009 11:41:27 -0000 1.2.2.7 +++ privatemsg.test 6 Nov 2009 12:55:22 -0000 @@ -3,12 +3,11 @@ /** * @file * Test file for privatemsg.module - * */ class PrivatemsgTestCase extends DrupalWebTestCase { /** - * Implementation of getInfo(). + * Implements getInfo(). */ function getInfo() { return array @@ -26,7 +25,7 @@ class PrivatemsgTestCase extends DrupalW } /** - * Implementation of setUp(). + * Implements setUp(). */ function setUp() { parent::setUp('privatemsg'); @@ -239,9 +238,8 @@ class PrivatemsgTestCase extends DrupalW 'body' => $this->randomName(100), ); $this->drupalPost('messages/view/1', $admin_edit, t('Send message')); - + // Make sure that the notice is not displayed anymore. - // @tod: Commented out because this does not work as expected. $this->assertNoText(t('This conversation is being viewed with escalated priviledges and may not be the same as shown to normal users.'), t('Notice about read all mode not displayed.')); // Make sure that both the existing message body and the new one are displayed. @@ -271,8 +269,7 @@ class PrivatemsgTestCase extends DrupalW /** * Tests for the flush feature */ - function testPrivatemsgFlush() - { + function testPrivatemsgFlush() { $author = $this->drupalCreateUser(array('write privatemsg', 'read privatemsg')); $recipient = $this->drupalCreateUser(array('write privatemsg', 'read privatemsg')); @@ -385,7 +382,7 @@ class PrivatemsgTestCase extends DrupalW $this->drupalLogin($recipient2); $this->drupalGet('messages/view/' . $return['message']['thread_id']); $this->assertText($body1, 'First message is still displayed'); - $this->assertText($body2,'First message is still displayed'); + $this->assertText($body2, 'First message is still displayed'); // Test delete all checkbox. $this->drupalLogin($admin); @@ -420,23 +417,4 @@ class PrivatemsgTestCase extends DrupalW //we dont really need to do this. i'm adding it just to keep it in front of my eyes so i can memorize it. parent::tearDown(); } - -} - - - - - - - - - - - - - - - - - - +} \ No newline at end of file Index: privatemsg.theme.inc =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/Attic/privatemsg.theme.inc,v retrieving revision 1.1.2.8 diff -u -p -r1.1.2.8 privatemsg.theme.inc --- privatemsg.theme.inc 8 Oct 2009 21:09:25 -0000 1.1.2.8 +++ privatemsg.theme.inc 6 Nov 2009 12:55:22 -0000 @@ -45,10 +45,9 @@ * $form['#data']['thread_id'] = $data // Raw data of that thread * $form['#rows']['thread_id'] = $row // Themed fields of that thread * @endcode - * + * * Note that the information in #data can be used to populate #rows, but it will * not be used by the default theme function theme_privatemsg_list(). - * */ /** @@ -113,7 +112,7 @@ function phptemplate_privatemsg_list_fie $options = array(); if (!empty($thread['is_new']) && $thread['is_new'] < $thread['count']) { $options['fragment'] = 'new'; - $field['data'] .= '
' . l((format_plural($thread['is_new'], '(1 new)', '(@count new)')),'messages/view/' . $thread['thread_id'], $options); + $field['data'] .= '
' . l((format_plural($thread['is_new'], '(1 new)', '(@count new)')), 'messages/view/' . $thread['thread_id'], $options); } $field['class'] = 'privatemsg-list-count'; return $field; Index: pm_block_user/pm_block_user.install =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/pm_block_user/pm_block_user.install,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 pm_block_user.install --- pm_block_user/pm_block_user.install 20 Feb 2009 08:30:27 -0000 1.1.2.2 +++ pm_block_user/pm_block_user.install 6 Nov 2009 12:55:22 -0000 @@ -4,8 +4,9 @@ * @file * Install file for pm_block_user.module */ + /** - * @return unknown + * Implements hook_schema(). */ function pm_block_user_schema() { $schema = array(); Index: pm_block_user/pm_block_user.module =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/pm_block_user/pm_block_user.module,v retrieving revision 1.1.2.12 diff -u -p -r1.1.2.12 pm_block_user.module --- pm_block_user/pm_block_user.module 2 Nov 2009 11:41:27 -0000 1.1.2.12 +++ pm_block_user/pm_block_user.module 6 Nov 2009 12:55:22 -0000 @@ -17,7 +17,7 @@ define('PM_BLOCK_USER_DISALLOW_BLOCKING' define('PM_BLOCK_USER_DISALLOW_SENDING', 1); /** - * Implementation of hook_help(). + * Implements hook_help(). */ function pm_block_user_help($path) { switch ($path) { @@ -27,7 +27,7 @@ function pm_block_user_help($path) { } /** - * Implementation of hook_menu(). + * Implements hook_menu(). */ function pm_block_user_menu() { $items['messages/block/%user'] = array( @@ -50,7 +50,7 @@ function pm_block_user_menu() { ); $items['messages/block/js'] = array( - 'title' => 'Javascript Block Actions Form', + 'title' => 'Javascript block actions form', 'page callback' => 'pm_block_user_js', 'access arguments' => array('administer privatemsg settings'), 'type' => MENU_CALLBACK, @@ -163,7 +163,7 @@ function _pm_block_user_actions_form($de $default_value = (isset($details['action']) ? $details['action'] : PM_BLOCK_USER_DISALLOW_BLOCKING); } else { - // TODO: add whitelist options/default_value here. + // @todo: add whitelist options/default_value here. } $form['action'] = array( '#type' => 'radios', @@ -250,14 +250,13 @@ function pm_block_user_settings_submit($ /** * Takes an array of settings and filters out anything that's un-needed. + * * Leaving only settings to be saved. * * @param $settings * The array of settings to filter. - * * @return * Array of settings, ready to be stored in the database. - * * @see pm_block_user_settings_submit() */ function _pm_block_user_settings_filter($settings) { @@ -307,7 +306,7 @@ function pm_block_user_js() { } /** - * Implementation of hook_theme(). + * Implements hook_theme(). */ function pm_block_user_theme() { return array( @@ -482,7 +481,7 @@ function pm_block_user_form($form_state, } /** - * Implementation of hook_form_submit(). + * Implements hook_form_submit(). */ function pm_block_user_form_submit($form, &$form_state) { if ($form_state['values']['confirm']) { @@ -501,7 +500,7 @@ function pm_block_user_form_submit($form } /** - * Implementation of hook_privatemsg_block_message. + * Implements hook_privatemsg_block_message(). */ function pm_block_user_privatemsg_block_message($author, $recipients) { $blocked = array(); @@ -547,7 +546,7 @@ function pm_block_user_privatemsg_sql_lo } /** - * Implementation of hook_privatemsg_message_view_alter. + * Implements hook_privatemsg_message_view_alter(). */ function pm_block_user_privatemsg_message_view_alter(&$vars) { global $user; Index: pm_email_notify/pm_email_notify.module =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/pm_email_notify/Attic/pm_email_notify.module,v retrieving revision 1.1.2.9 diff -u -p -r1.1.2.9 pm_email_notify.module --- pm_email_notify/pm_email_notify.module 6 Nov 2009 12:36:54 -0000 1.1.2.9 +++ pm_email_notify/pm_email_notify.module 6 Nov 2009 12:55:22 -0000 @@ -7,7 +7,7 @@ */ /** - * Implementation of hook_menu(). + * Implements hook_menu(). */ function pm_email_notify_menu() { $items['admin/settings/messages/notify'] = array( @@ -75,7 +75,8 @@ function _pm_email_notify_is_enabled($ui // Cache the result set in case this method is executed in batched operation which will perform many unnecessary repeated selects for the same user if ( !isset($notifications[$uid]) ) { $mail_notification = db_result(db_query('SELECT email_notify_is_enabled FROM {pm_email_notify} WHERE user_id = %d', $uid)); - if ($mail_notification === FALSE) { //db_result returns FALSE if result was not found. + if ($mail_notification === FALSE) { + // db_result() returns FALSE if result was not found. $mail_notification = variable_get('pm_email_notify_default', TRUE); } $notifications[$uid] = $mail_notification; @@ -84,7 +85,7 @@ function _pm_email_notify_is_enabled($ui } /** - * Implementation of hook_privatemsg_message_insert(). + * Implements hook_privatemsg_message_insert(). */ function pm_email_notify_privatemsg_message_insert($message) { foreach ($message['recipients'] as $recipient) { @@ -99,7 +100,7 @@ function pm_email_notify_privatemsg_mess } /** - * Implementation of hook_mail(). + * Implements hook_mail(). */ function pm_email_notify_mail($key, &$message, $params) { $language = $message['language']; @@ -117,13 +118,12 @@ function pm_email_notify_mail($key, &$me * Return an array of token to value mappings for user e-mail messages. * * @param $message - * The private message array being sent. Must contain at - * least the fields 'author', 'subject', 'thread_id' and 'body'. + * The private message array being sent. Must contain at + * least the fields 'author', 'subject', 'thread_id' and 'body'. * @return - * Array of mappings from token names to values (for use with strtr()). + * Array of mappings from token names to values (for use with strtr()). */ function _pm_email_notify_token($recipient, $message) { - $tokens = array( '!author' => $message['author']->name, '!pm_subject' => drupal_html_to_text(check_plain($message['subject'])), @@ -135,7 +135,6 @@ function _pm_email_notify_token($recipie ); return $tokens; - } /** @@ -146,7 +145,7 @@ function _pm_email_notify_default_body() } /** - * Implement hook_user(). + * Implements hook_user(). * * Display settings form and store its information. */ Index: privatemsg_filter/privatemsg_filter.admin.inc =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg_filter/Attic/privatemsg_filter.admin.inc,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 privatemsg_filter.admin.inc --- privatemsg_filter/privatemsg_filter.admin.inc 14 Oct 2009 14:19:00 -0000 1.1.2.1 +++ privatemsg_filter/privatemsg_filter.admin.inc 6 Nov 2009 12:55:22 -0000 @@ -57,18 +57,20 @@ function privatemsg_tags_admin() { // Display a message if now tags are available. $rows[] = array(array('data' => t('No tags available.'), 'colspan' => count($header))); } - + return theme('table', $header, $rows) . theme('pager'); } /** * A form to edit existing or create new tags. * - * @param $form_state Form state array - * @param $tag_id Tag Id if an edit form should be displayed, NULL for a create + * @param $form_state + * Form state array + * @param $tag_id + * Tag Id if an edit form should be displayed, NULL for a create * new tag form. */ -function privatemsg_tags_form(&$form_state,$tag_id = NULL) { +function privatemsg_tags_form(&$form_state, $tag_id = NULL) { $form = array(); if ($tag_id) { @@ -103,7 +105,7 @@ function privatemsg_tags_form(&$form_sta /** * Form validate function for tags admin page. - * + * * Make sure that a tag name is unique. */ function privatemsg_tags_form_validate($form, &$form_state) { @@ -140,7 +142,8 @@ function privatemsg_tags_form_submit($fo /** * Confirmation form for deleting tags. * - * @param $tag_id Id of the tag that should be deleted. + * @param $tag_id + * Id of the tag that should be deleted. */ function privatemsg_filter_tags_delete(&$form_state, $tag_id) { $form['tag_id'] = array( @@ -167,5 +170,4 @@ function privatemsg_filter_tags_delete_s drupal_set_message(t('Tag has been deleted')); } $form_state['redirect'] = 'admin/settings/messages/tags'; -} -?> \ No newline at end of file +} \ No newline at end of file Index: privatemsg_filter/privatemsg_filter.module =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg_filter/privatemsg_filter.module,v retrieving revision 1.1.2.26 diff -u -p -r1.1.2.26 privatemsg_filter.module --- privatemsg_filter/privatemsg_filter.module 6 Nov 2009 12:44:01 -0000 1.1.2.26 +++ privatemsg_filter/privatemsg_filter.module 6 Nov 2009 12:55:22 -0000 @@ -7,7 +7,7 @@ */ /** - * Implementation of hook_perm(). + * Implements hook_perm(). */ function privatemsg_filter_perm() { return array( @@ -18,7 +18,7 @@ function privatemsg_filter_perm() { } /** - * Implementation of hook_menu(). + * Implements hook_menu(). */ function privatemsg_filter_menu() { $items['admin/settings/messages/filter'] = array( @@ -106,13 +106,13 @@ function privatemsg_filter_menu() { } /** - * Implement hook_menu_alter(). + * Implements hook_menu_alter(). */ function privatemsg_filter_menu_alter(&$items) { // Rename messages to "All messages". $items['messages/list']['title'] = 'All messages'; - if(variable_get('privatemsg_filter_default_list', 0) == 0) { + if (variable_get('privatemsg_filter_default_list', 0) == 0) { // Change default argument of /messages to inbox. and set the task to MENU_LOCAL_TASK. $items['messages']['page arguments'] = array('privatemsg_list', 'inbox'); $items['messages/list']['type'] = MENU_LOCAL_TASK; @@ -141,7 +141,9 @@ function privatemsg_filter_admin() { } /** - * Implementation of hook_form_FORM_ID_alter() to add a filter widget to the message listing pages. + * Implements hook_form_FORM_ID_alter(). + * + * Add a filter widget to the message listing pages. */ function privatemsg_filter_form_private_message_settings_alter(&$form, $form_state) { $form['privatemsg_listing']['privatemsg_filter_default_list'] = array( @@ -167,13 +169,14 @@ function privatemsg_filter_settings_subm /** * Function to create a tag * - * @param $tags A single tag or an array of tags. + * @param $tags + * A single tag or an array of tags. */ function privatemsg_filter_create_tags($tags) { if (!is_array($tags)) { $tags = array($tags); } - + $tag_ids = array(); foreach ($tags as $tag) { @@ -202,8 +205,10 @@ function privatemsg_filter_create_tags($ /** * Tag one or multiple threads with a tag. * - * @param $threads A single thread id or an array of thread ids. - * @param $tag_id Id of the tag. + * @param $threads + * A single thread id or an array of thread ids. + * @param $tag_id + * Id of the tag. */ function privatemsg_filter_add_tags($threads, $tag_id, $account = NULL) { if (!is_array($threads)) { @@ -226,8 +231,10 @@ function privatemsg_filter_add_tags($thr /** * Remove tag from one or multiple threads. * - * @param $threads A single thread id or an array of thread ids. - * @param $tag_id Id of the tag - set to NULL to remove all tags. + * @param $threads + * A single thread id or an array of thread ids. + * @param $tag_id + * Id of the tag - set to NULL to remove all tags. */ function privatemsg_filter_remove_tags($threads, $tag_id = NULL, $account = NULL) { if (!is_array($threads)) { @@ -239,13 +246,13 @@ function privatemsg_filter_remove_tags($ } if (is_null($tag_id)) { - //Delete all tag mapping. + // Delete all tag mapping. foreach ($threads as $thread) { db_query('DELETE FROM {pm_tags_index} WHERE uid = %d AND thread_id = %d', $account->uid, $thread); } } else { - //Delete tag mapping for the specified tag. + // Delete tag mapping for the specified tag. foreach ($threads as $thread) { db_query('DELETE FROM {pm_tags_index} WHERE uid = %d AND thread_id = %d AND tag_id = %d', $account->uid, $thread, $tag_id); } @@ -275,7 +282,7 @@ function privatemsg_filter_get_filter($a $filter['search'] = $_GET['search']; } - if(!empty($filter)) { + if (!empty($filter)) { return $filter; } @@ -286,7 +293,7 @@ function privatemsg_filter_get_filter($a } function privatemsg_filter_get_tags_data($account) { - static $tag_data; + static $tag_data; if (is_array($tag_data)) { return $tag_data; @@ -309,7 +316,7 @@ function privatemsg_filter_dropdown(&$fo $form['filter'] = array( '#type' => 'fieldset', - '#title' => t('Filter Messages'), + '#title' => t('Filter messages'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); @@ -349,7 +356,7 @@ function privatemsg_filter_dropdown(&$fo $form['filter']['save'] = array( '#type' => 'submit', - '#value' => t('Save Filter'), + '#value' => t('Save filter'), '#suffix' => '
', '#weight' => 11, '#submit' => array('privatemsg_filter_dropdown_submit'), @@ -363,7 +370,7 @@ function privatemsg_filter_dropdown(&$fo } function privatemsg_filter_dropdown_set_active(&$form, $filter) { - $form['filter']['#title'] = t('Filter Messages (Active)'); + $form['filter']['#title'] = t('Filter messages (active)'); $form['filter']['#collapsed'] = FALSE; if (isset($filter['author'])) { @@ -397,7 +404,7 @@ function privatemsg_filter_dropdown_subm } switch ($form_state['values']['op']) { - case t('Save Filter'): + case t('Save filter'): $filter = array(); if (!empty($form_state['values']['tags'])) { $filter['tags'] = $form_state['values']['tags']; @@ -421,8 +428,7 @@ function privatemsg_filter_dropdown_subm $form_state['redirect'] = $_GET['q']; } -function privatemsg_filter_create_get_query($filter) -{ +function privatemsg_filter_create_get_query($filter) { $query = array(); if (isset($filter['tags']) && !empty($filter['tags'])) { $ids = array(); @@ -466,11 +472,13 @@ function privatemsg_filter_create_get_qu } /** - * Implementation of hook_form_FORM_ID_alter() to add a filter widget to the message listing pages. + * Implements hook_form_FORM_ID_alter(). + * + * Adds a filter widget to the message listing pages. */ function privatemsg_filter_form_privatemsg_list_alter(&$form, $form_state) { global $user; - + if (privatemsg_user_access('filter private messages') && !empty($form['#data'])) { $form += privatemsg_filter_dropdown($form_state, $form['#account']); } @@ -478,7 +486,7 @@ function privatemsg_filter_form_privatem $tags = privatemsg_filter_get_tags_data($user); if (privatemsg_user_access('filter private messages') && !empty($tags) && !empty($form['#data'])) { $options = array(); - $options[] = t('Apply Tag...'); + $options[] = t('Apply tag...'); foreach ($tags as $tag_id => $tag) { $options[$tag_id] = $tag; } @@ -491,11 +499,11 @@ function privatemsg_filter_form_privatem ); $form['actions']['tag-add-submit'] = array( '#type' => 'submit', - '#value' => t('Apply Tag'), + '#value' => t('Apply tag'), '#submit' => array('privatemsg_filter_add_tag_submit'), '#attributes' => array('class' => 'privatemsg-action-button'), ); - $options[0] = t('Remove Tag...'); + $options[0] = t('Remove tag...'); $form['actions']['tag-remove'] = array( '#type' => 'select', '#options' => $options, @@ -505,7 +513,7 @@ function privatemsg_filter_form_privatem ); $form['actions']['tag-remove-submit'] = array( '#type' => 'submit', - '#value' => t('Remove Tag'), + '#value' => t('Remove tag'), '#submit' => array('privatemsg_filter_remove_tag_submit'), '#attributes' => array('class' => 'privatemsg-action-button'), ); @@ -602,7 +610,7 @@ function privatemsg_filter_privatemsg_vi } /** - * Form to show and allow modification of tagging information for a conversation. + * Form to show and allow modification of tagging information of a conversation. */ function privatemsg_filter_form(&$form_state) { global $user; @@ -614,7 +622,7 @@ function privatemsg_filter_form(&$form_s $count = db_result(db_query($query['count'])); $tags = ''; while ($tag = db_fetch_array($results)) { - $tags .= $tag['tag']. ', '; + $tags .= $tag['tag'] . ', '; } $form['tags'] = array( @@ -660,7 +668,7 @@ function privatemsg_filter_form_submit($ // Step 2 - Get the id for each of the tags. $tag_ids = privatemsg_filter_create_tags($tags); - + // Step 3 - Save all the tagging data. foreach ($tag_ids as $tag_id) { privatemsg_filter_add_tags($form_state['values']['thread_id'], $tag_id); @@ -672,7 +680,8 @@ function privatemsg_filter_form_submit($ /** * Return autocomplete results for tags. * - * Most of this code has been lifted/modified from privatemsg_user_name_autocomplete(). + * Most of this code has been lifted/modified from + * privatemsg_user_name_autocomplete(). */ function privatemsg_filter_tags_autocomplete($string) { @@ -727,7 +736,8 @@ function privatemsg_filter_privatemsg_sq * @param $user * User object for whom we want the tags. Defaults to all users. * @param $thread_id - * The thread_id - Only needed if we want the tags for a specific thread instead of all used tags on any thread. + * The thread_id - Only needed if we want the tags for a specific thread + * instead of all used tags on any thread. */ function privatemsg_filter_sql_tags(&$fragments, $user = NULL, $thread_id = NULL) { $fragments['primary_table'] = '{pm_tags} t'; @@ -760,11 +770,11 @@ function privatemsg_filter_sql_tags(&$fr * Query definition to get autocomplete suggestions for tags * * @param $fragments - * Query fragments array. + * Query fragments array. * @param $search - * String fragment to use for tag suggestions. + * String fragment to use for tag suggestions. * @param $tags - * Array of tags not to be used as suggestions. + * Array of tags not to be used as suggestions. */ function privatemsg_filter_sql_tags_autocomplete(&$fragments, $search, $tags) { global $user; Index: privatemsg_filter/privatemsg_filter.test =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg_filter/Attic/privatemsg_filter.test,v retrieving revision 1.1.2.4 diff -u -p -r1.1.2.4 privatemsg_filter.test --- privatemsg_filter/privatemsg_filter.test 29 Oct 2009 15:33:18 -0000 1.1.2.4 +++ privatemsg_filter/privatemsg_filter.test 6 Nov 2009 12:55:22 -0000 @@ -1,10 +1,17 @@ td[0] == $to_edit['tag']) { - $edit_url = substr($row->td[3]->a[0]['href'], 1); + $edit_url = drupal_substr($row->td[3]->a[0]['href'], 1); } // Extract edit url. if ((string)$row->td[0] == $public['tag']) { - $delete_url = substr($row->td[3]->a[1]['href'], 1); + $delete_url = drupal_substr($row->td[3]->a[1]['href'], 1); } } Index: tests/privatemsgapi.test =================================================================== RCS file: /cvs/drupal/contributions/modules/privatemsg/tests/Attic/privatemsgapi.test,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 privatemsgapi.test --- tests/privatemsgapi.test 22 Oct 2009 17:29:23 -0000 1.1.2.2 +++ tests/privatemsgapi.test 6 Nov 2009 12:55:22 -0000 @@ -8,7 +8,7 @@ class PrivatemsgAPITestCase extends DrupalWebTestCase { /** - * Implementation of getInfo(). + * Implements getInfo(). */ function getInfo() { return array( @@ -25,7 +25,7 @@ class PrivatemsgAPITestCase extends Drup } /** - * Implementation of setUp(). + * Implements setUp(). */ function setUp() { parent::setUp('privatemsg'); @@ -100,5 +100,4 @@ class PrivatemsgAPITestCase extends Drup $this->assertEqual($errormessage, $resultf2['messages']['error'][0], 'API denied to send message from user without permission'); } -} -?> +} \ No newline at end of file