| 1 |
<?php |
<?php |
| 2 |
/************************************* |
/************************************* |
| 3 |
* Demexp module for a Drupal demexp client |
* Demexp module for a Drupal demexp client |
| 4 |
* $Id: demexp.module,v 1.28 2006/10/14 11:15:55 augustin Exp $ |
* $Id: demexp.module,v 1.29 2006/10/14 12:02:13 augustin Exp $ |
| 5 |
* Copyright Augustin Masquilier, 2006. |
* Copyright Augustin Masquilier, 2006. |
| 6 |
* This module is released under the terms of the GPL. |
* This module is released under the terms of the GPL. |
| 7 |
*************************************/ |
*************************************/ |
| 945 |
$values['title'] = t('Question !id', array('!id' => $question['q_id'])); |
$values['title'] = t('Question !id', array('!id' => $question['q_id'])); |
| 946 |
$values['body'] = theme('demexp_question_body', $question); |
$values['body'] = theme('demexp_question_body', $question); |
| 947 |
$values['name'] = 'demexp'; |
$values['name'] = 'demexp'; |
| 948 |
|
$values['path'] = 'question/'. $question['q_id']; |
| 949 |
$values['format'] = 3; |
$values['format'] = 3; |
| 950 |
// drupal_execute will return 'node/$nid' |
// drupal_execute will return 'node/$nid' |
| 951 |
$nid = substr(drupal_execute('demexp_question_node_form', $values, $node), 5); |
$nid = substr(drupal_execute('demexp_question_node_form', $values, $node), 5); |
| 973 |
$forum_tid = db_result(db_query('SELECT tid FROM {term_data} WHERE vid = 1 AND name = "%s"', $values['name'])); |
$forum_tid = db_result(db_query('SELECT tid FROM {term_data} WHERE vid = 1 AND name = "%s"', $values['name'])); |
| 974 |
db_query('UPDATE {demexp_questions} SET forum_tid = %d WHERE ds_question_id = %d', $forum_tid, $question['q_id']); |
db_query('UPDATE {demexp_questions} SET forum_tid = %d WHERE ds_question_id = %d', $forum_tid, $question['q_id']); |
| 975 |
|
|
| 976 |
|
// Creating a path alias for the forum. |
| 977 |
|
$path = 'forum/'. $forum_tid; |
| 978 |
|
$alias = 'question/'. $question['q_id'] .'/forum'; |
| 979 |
|
db_query("INSERT INTO {url_alias} (src, dst) VALUES ('%s', '%s')", $path, $alias); |
| 980 |
|
|
| 981 |
} |
} |
| 982 |
else { |
else { |
| 983 |
// update node |
// update node |