| 1 |
<?php |
<?php |
| 2 |
// $Id: adminblock.module,v 1.17.2.1 2008/06/12 07:46:30 frjo Exp $ |
// $Id: adminblock.module,v 1.17.2.2 2008/09/09 06:03:08 frjo Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 6 |
* Author: Fredrik Jonsson fredrik at combonet dot se |
* Author: Fredrik Jonsson fredrik at combonet dot se |
| 7 |
* Enables admins to display a block with the comments approval queue, |
* Enables admins to display a block with the comments approval queue, |
| 8 |
* the node moderation queue and the trackback queue. |
* the node moderation queue and the trackback queue. |
| 9 |
* |
* |
| 10 |
* The block will only show for users with |
* The block will only show for users with |
| 11 |
* "administer comments/nodes/trackback" privilages. |
* "administer comments/nodes/trackback" privilages. |
| 12 |
* |
* |
| 13 |
* If there are no comments to approve, no nodes to moderate |
* If there are no comments to approve, no nodes to moderate |
| 14 |
* and no trackbacks to approve the block will not show. |
* and no trackbacks to approve the block will not show. |
| 15 |
*/ |
*/ |
| 16 |
|
|
| 26 |
} |
} |
| 27 |
else if ($op == 'view') { |
else if ($op == 'view') { |
| 28 |
$nlimit = 10; |
$nlimit = 10; |
| 29 |
|
$items = array(); |
| 30 |
|
$items2 = array(); |
| 31 |
|
$items3 = array(); |
| 32 |
|
|
| 33 |
if (user_access('administer comments')) { |
if (user_access('administer comments')) { |
| 34 |
$result = db_query_range('SELECT c.timestamp, c.subject, c.cid, c.nid, n.title |
$result = db_query_range('SELECT c.timestamp, c.subject, c.cid, c.nid, n.title |
| 35 |
FROM {comments} c |
FROM {comments} c |
| 36 |
INNER JOIN {node} n ON c.nid = n.nid |
INNER JOIN {node} n ON c.nid = n.nid |
| 37 |
WHERE c.status = 1 |
WHERE c.status = 1 |
| 38 |
ORDER BY c.timestamp DESC ', 0, $nlimit); |
ORDER BY c.timestamp DESC ', 0, $nlimit); |
| 39 |
$items = array(); |
$comment_delete_path = module_exists('mollom') && _mollom_get_mode('comment_form') ? 'mollom/comment/' : 'comment/delete/'; |
| 40 |
while ($comment = db_fetch_object($result)) { |
while ($comment = db_fetch_object($result)) { |
| 41 |
$items[] = check_plain($comment->subject) .' - '. format_date($comment->timestamp, 'medium') .'<br />['. l(t('node'), 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid, 'attributes' => array('title' => $comment->title))) .'] ['. l(t('edit'), 'comment/edit/'. $comment->cid) .'] ['. l(t('delete'), 'comment/delete/'. $comment->cid) .']'; |
$items[] = check_plain($comment->subject) .' - '. format_date($comment->timestamp, 'medium') .'<br />['. l(t('node'), 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid, 'attributes' => array('title' => $comment->title))) .'] ['. l(t('edit'), 'comment/edit/'. $comment->cid) .'] ['. l(t('delete'), $comment_delete_path . $comment->cid) .']'; |
| 42 |
} |
} |
| 43 |
} |
} |
| 44 |
|
|
| 45 |
if (user_access('administer nodes')) { |
if (user_access('administer nodes')) { |
| 46 |
$result2 = db_query_range('SELECT n.nid, n.title, n.changed, u.name, u.uid |
$result2 = db_query_range('SELECT n.nid, n.title, n.type, n.changed, u.name, u.uid |
| 47 |
FROM {node} n |
FROM {node} n |
| 48 |
INNER JOIN {users} u ON n.uid = u.uid |
INNER JOIN {users} u ON n.uid = u.uid |
| 49 |
WHERE n.status = 0 |
WHERE n.status = 0 |
| 50 |
ORDER BY n.changed DESC', 0, $nlimit); |
ORDER BY n.changed DESC', 0, $nlimit); |
|
$items2 = array(); |
|
| 51 |
while ($node = db_fetch_object($result2)) { |
while ($node = db_fetch_object($result2)) { |
| 52 |
$items2[] = check_plain($node->title) .' - '. format_date($node->changed, 'medium') .'<br />['. l(t('By @user', array('@user' => $node->name)), 'user/'. $node->uid) .'] ['. l(t('edit'), 'node/'. $node->nid .'/edit') .'] ['. l(t('delete'), 'node/'. $node->nid .'/delete') .']'; |
$node_delete_path = module_exists('mollom') && _mollom_get_mode($node->type .'_node_form') ? 'mollom/node/'. $node->nid : 'node/'. $node->nid .'/delete'; |
| 53 |
|
$items2[] = check_plain($node->title) .' - '. format_date($node->changed, 'medium') .'<br />['. l(t('By @user', array('@user' => $node->name)), 'user/'. $node->uid) .'] ['. l(t('edit'), 'node/'. $node->nid .'/edit') .'] ['. l(t('delete'), $node_delete_path) .']'; |
| 54 |
} |
} |
| 55 |
} |
} |
| 56 |
|
|
| 57 |
if (module_exists('trackback') && user_access('administer trackbacks')) { |
if (module_exists('trackback') && user_access('administer trackbacks')) { |
| 58 |
$result3 = db_query_range('SELECT t.created, t.subject, t.nid, t.trid, t.excerpt |
$result3 = db_query_range('SELECT t.created, t.subject, t.trid |
| 59 |
FROM {trackback_received} t |
FROM {trackback_received} t |
| 60 |
INNER JOIN {node} n ON t.nid = n.nid |
WHERE t.status = 0 |
|
WHERE t.status = 0 |
|
| 61 |
ORDER BY t.created DESC ', 0, $nlimit); |
ORDER BY t.created DESC ', 0, $nlimit); |
|
$items3 = array(); |
|
| 62 |
while ($trackback = db_fetch_object($result3)) { |
while ($trackback = db_fetch_object($result3)) { |
| 63 |
$items3[] = check_plain($trackback->subject) .' - '. format_date($trackback->created, 'medium') .'<br />['. l(t('edit'), 'trackback/edit/'. $trackback->trid) .'] ['. l(t('delete'), 'trackback/delete/'. $trackback->trid) .']'; |
$items3[] = check_plain($trackback->subject) .' - '. format_date($trackback->created, 'medium') .'<br />['. l(t('edit'), 'trackback/edit/'. $trackback->trid) .'] ['. l(t('delete'), 'trackback/delete/'. $trackback->trid) .']'; |
| 64 |
} |
} |