mestamp = %d, last_comment_name = '', last_comment_uid = %d WHERE nid = %d", $node->created, $node->uid, $nid); } } /** * Invoke a hook_comment() operation in all modules. * * @param &$comment * A comment object. * @param $op * A string containing the name of the comment operation. * @return * The returned value of the invoked hooks. */ function comment_invoke_comment(&$comment, $op) { $return = array(); foreach (module_implements('comment') as $name) { $function = $name .'_comment'; $result = $function($comment, $op); if (isset($result) && is_array($result)) { $return = array_merge($return, $result); } else if (isset($result)) { $return[] = $result; } } return $return; } /** * Generate vancode. * * Consists of a leading character indicating length, followed by N digits * with a numerical value in base 36. Vancodes can be sorted as strings * without messing up numerical order. * * It goes: * 00, 01, 02, ..., 0y, 0z, * 110, 111, ... , 1zy, 1zz, * 2100, 2101, ..., 2zzy, 2zzz, * 31000, 31001, ... */ function int2vancode($i = 0) { $num = base_convert((int)$i, 10, 36); $length = strlen($num); return chr($length + ord('0') - 1) . $num; } /** * Decode vancode back to an integer. */ function vancode2int($c = '00') { return base_convert(substr($c, 1), 36, 10); } /** * Implementation of hook_hook_info(). */ function comment_hook_info() { return array( 'comment' => array( 'comment' => array( 'insert' => array( 'runs when' => t('After saving a new comment'), ), 'update' => array( 'runs when' => t('After saving an updated comment'), ), 'delete' => array( 'runs when' => t('After deleting a comment') ), 'view' => array( 'runs when' => t('When a comment is being viewed by an authenticated user') ), ), ), ); } /** * Implementation of hook_action_info(). */ function comment_action_info() { return array( 'comment_unpublish_action' => array( 'description' => t('Unpublish comment'), 'type' => 'comment', 'configurable' => FALSE, 'hooks' => array( 'comment' => array('insert', 'update'), ) ), 'comment_unpublish_by_keyword_action' => array( 'description' => t('Unpublish comment containing keyword(s)'), 'type' => 'comment', 'configurable' => TRUE, 'hooks' => array( 'comment' => array('insert', 'update'), ) ) ); } /** * Drupal action to unpublish a comment. * * @param $context * Keyed array. Must contain the id of the comment if $comment is not passed. * @param $comment * An optional comment object. */ function comment_unpublish_action($comment, $context = array()) { if (isset($comment->cid)) { $cid = $comment->cid; $subject = $comment->subject; } else { $cid = $context['cid']; $subject = db_result(db_query("SELECT subject FROM {comments} WHERE cid = %d", $cid)); } db_query('UPDATE {comments} SET status = %d WHERE cid = %d', COMMENT_NOT_PUBLISHED, $cid); watchdog('action', 'Unpublished comment %subject.', array('%subject' => $subject)); } /** * Form builder; Prepare a form for blacklisted keywords. * * @ingroup forms */ function comment_unpublish_by_keyword_action_form($context) { $form['keywords'] = array( '#title' => t('Keywords'), '#type' => 'textarea', '#description' => t('The comment will be unpublished if it contains any of the character sequences above. Use a comma-separated list of character sequences. Example: funny, bungee jumping, "Company, Inc.". Character sequences are case-sensitive.'), '#default_value' => isset($context['keywords']) ? drupal_implode_tags($context['keywords']) : '', ); return $form; } /** * Process comment_unpublish_by_keyword_action_form form submissions. */ function comment_unpublish_by_keyword_action_submit($form, $form_state) { return array('keywords' => drupal_explode_tags($form_state['values']['keywords'])); } /** * Implementation of a configurable Drupal action. * Unpublish a comment if it contains a certain string. * * @param $context * An array providing more information about the context of the call to this action. * Unused here since this action currently only supports the insert and update ops of * the comment hook, both of which provide a complete $comment object. * @param $comment * A comment object. */ function comment_unpublish_by_keyword_action($comment, $context) { foreach ($context['keywords'] as $keyword) { if (strstr($comment->comment, $keyword) || strstr($comment->subject, $keyword)) { db_query('UPDATE {comments} SET status = %d WHERE cid = %d', COMMENT_NOT_PUBLISHED, $comment->cid); watchdog('action', 'Unpublished comment %subject.', array('%subject' => $comment->subject)); break; } } } Site off-line | EGMEDICINE

Site off-line

warning: Cannot modify header information - headers already sent by (output started at /home/.pate/fouadoffftp/egmedicine/www/modules/comment/comment.module:1) in /home/.pate/fouadoffftp/egmedicine/www/includes/common.inc on line 141.
EGMEDICINE is currently under maintenance. We should be back shortly. Thank you for your patience.