| 1 |
<?php // $Id: Exp $ |
<?php // $Id: implement_node_drupal46.php,v 1.1 2005/10/09 15:59:51 djnz Exp $ |
| 2 |
/* |
/* |
| 3 |
* Implementation of wgHTML as a node for Drupal |
* Implementation of wgHTML as a node for Drupal |
| 4 |
* Tested with Drupal 4.6.3 |
* Tested with Drupal 4.6.3 |
| 74 |
|
|
| 75 |
// create a new node |
// create a new node |
| 76 |
$node = $this->make_node(); |
$node = $this->make_node(); |
| 77 |
$this->pageId = node_save($node); |
node_save($node); |
| 78 |
|
$this->pageId = $node->nid; |
| 79 |
|
|
| 80 |
// TODO why doesn't this work? db_query('LOCK TABLES {wghtml_versions} WRITE'); |
// TODO why doesn't this work? db_query('LOCK TABLES {wghtml_versions} WRITE'); |
| 81 |
// TODO should check here that it has still not been created and return if it has |
// TODO should check here that it has still not been created and return if it has |
| 84 |
db_query('INSERT INTO {wghtml_pages} ( |
db_query('INSERT INTO {wghtml_pages} ( |
| 85 |
pageId, identity ) |
pageId, identity ) |
| 86 |
VALUES (%d, \'%s\')', |
VALUES (%d, \'%s\')', |
| 87 |
$this->pageId, $this->identity, 1); |
$this->pageId, $this->identity); |
| 88 |
|
|
| 89 |
} else { |
} else { |
| 90 |
|
|
| 101 |
|
|
| 102 |
// save version |
// save version |
| 103 |
db_query("INSERT INTO {wghtml_versions} ( |
db_query("INSERT INTO {wghtml_versions} ( |
| 104 |
pageId, version, node, perm_area, raw, title, head, body, bodyattrib, linkto, signature, cachetime) |
pageId, version, perm_area, raw, title, head, body, bodyattrib, linkto, signature, cachetime) |
| 105 |
VALUES ('%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)", |
VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)", |
| 106 |
$this->pageId, $this->version, 0, $this->perm_area, $this->raw, $this->title, $this->head, $this->body, $this->bodyattrib, $this->linkto, $this->signature, time()); |
$this->pageId, $this->version, $this->perm_area, $this->raw, $this->title, $this->head, $this->body, $this->bodyattrib, $this->linkto, $this->signature, time()); |
| 107 |
db_query('UNLOCK TABLES'); |
db_query('UNLOCK TABLES'); |
| 108 |
|
|
| 109 |
// We do NOT need to update the search index as cron will do this automagically |
// We do NOT need to update the search index as cron will do this automagically |
| 130 |
$node->type = 'wghtml'; |
$node->type = 'wghtml'; |
| 131 |
$node->title = $this->title; |
$node->title = $this->title; |
| 132 |
// $node->teaser = TODO |
// $node->teaser = TODO |
| 133 |
$node->body = strip_tags($this->body); |
$node->body = $this->body; |
| 134 |
$node->created = $this->signature; |
$node->created = $this->signature; |
| 135 |
$node->changed = $this->signature; |
$node->changed = $this->signature; |
| 136 |
$node->revisions = ''; |
$node->revisions = ''; |
| 137 |
$node->comment = 2; |
$node->comment = 2; |
| 138 |
$node->format = 1; |
$node->format = $this->config[$this->config['implementation']]['format']; |
| 139 |
// 'teaser', 'revisions', 'status', 'promote', 'moderate', 'sticky', 'format'); |
// 'teaser', 'revisions', 'status', 'promote', 'moderate', 'sticky', 'format'); |
| 140 |
return $node; |
return $node; |
| 141 |
} |
} |