/[drupal]/contributions/modules/authorship/authorship.module
ViewVC logotype

Diff of /contributions/modules/authorship/authorship.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4.2.4, Thu Jul 12 22:05:55 2007 UTC revision 1.4.2.5, Thu Jul 12 22:09:08 2007 UTC
# Line 1  Line 1 
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
# Line 87  function authorship_form_alter($form_id, Line 87  function authorship_form_alter($form_id,
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')) {
# Line 146  function authorship_nodeapi(&$node, $op, Line 146  function authorship_nodeapi(&$node, $op,
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) {
# Line 185  function authorship_comment(&$comment, $ Line 185  function authorship_comment(&$comment, $
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

Legend:
Removed from v.1.4.2.4  
changed lines
  Added in v.1.4.2.5

  ViewVC Help
Powered by ViewVC 1.1.2