| 1 |
<?php |
<?php |
| 2 |
// $Id: authorship.module,v 1.4.2.3 2007/07/12 21:58:26 karpuz Exp $ |
// $Id: authorship.module,v 1.4.2.4 2007/07/12 22:05:55 karpuz Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 87 |
|
|
| 88 |
if(isset($form['#id']) && $form['#id'] == 'comment-form' ) { |
if(isset($form['#id']) && $form['#id'] == 'comment-form' ) { |
| 89 |
if (variable_get('authorship_comment', 0)) { |
if (variable_get('authorship_comment', 0)) { |
| 90 |
$row = db_fetch_object(db_query("SELECT authorship FROM {node_authorship} WHERE nid = '%s'", $form['cid']['#value'])); |
$row = db_fetch_object(db_query("SELECT authorship FROM {node_authorship} WHERE cid = %d", $form['cid']['#value'])); |
| 91 |
$authorship = $row->authorship; |
$authorship = $row->authorship; |
| 92 |
|
|
| 93 |
if ($user->uid == 1 || user_access('admin authorship') || user_access('user use authorship')) { |
if ($user->uid == 1 || user_access('admin authorship') || user_access('user use authorship')) { |
| 146 |
break; |
break; |
| 147 |
case 'insert': |
case 'insert': |
| 148 |
case 'update': |
case 'update': |
| 149 |
db_query("DELETE FROM {node_authorship} WHERE nid = %d", $node->nid); |
db_query("DELETE FROM {node_authorship} WHERE nid = %d AND cid = 0 LIMIT 1", $node->nid); |
| 150 |
if($node->authorship != "" || $node->profile_real_name != "") db_query("INSERT INTO {node_authorship} (nid, authorship, profile_real_name) VALUES (%d, '%s', %d)", |
if($node->authorship != "" || $node->profile_real_name != "") db_query("INSERT INTO {node_authorship} (nid, authorship, profile_real_name) VALUES (%d, '%s', %d)", |
| 151 |
$node->nid, $node->authorship, $node->profile_real_name); |
$node->nid, $node->authorship, $node->profile_real_name); |
| 152 |
break; |
break; |
| 153 |
case 'delete': |
case 'delete': |
| 154 |
db_query("DELETE FROM {node_authorship} WHERE nid = %d", $node->nid); |
db_query("DELETE FROM {node_authorship} WHERE nid = %d AND cid = 0 LIMIT 1", $node->nid); |
| 155 |
break; |
break; |
| 156 |
case 'view': |
case 'view': |
| 157 |
if ($page || $teaser) { |
if ($page || $teaser) { |
| 185 |
$comment['nid'], $comment['cid'], $comment['authorship'], $comment['profile_real_name']); |
$comment['nid'], $comment['cid'], $comment['authorship'], $comment['profile_real_name']); |
| 186 |
break; |
break; |
| 187 |
case 'delete': |
case 'delete': |
| 188 |
db_query("DELETE FROM {node_authorship} WHERE cid = %d", $comment->cid); |
db_query("DELETE FROM {node_authorship} WHERE cid = %d LIMIT 1", $comment->cid); |
| 189 |
break; |
break; |
| 190 |
case 'view': |
case 'view': |
| 191 |
// no 'load' option for $op in hook_comment, therefore we get the authorship info from the DB here |
// no 'load' option for $op in hook_comment, therefore we get the authorship info from the DB here |