Changeset 2440 for trunk/htdocs/system/classes/post.php
- Timestamp:
- 09/04/08 22:15:50 (4 months ago)
- Files:
-
- 1 modified
-
trunk/htdocs/system/classes/post.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/htdocs/system/classes/post.php
r2232 r2440 471 471 /* Now, let's insert any *new* tag texts or slugs into the tags table */ 472 472 $repeat_questions= Utils::placeholder_string( count($clean_tags) ); 473 $sql_tags_exist=<<<ENDOFSQL 474 SELECT id, tag_text, tag_slug 475 FROM {tags} 476 WHERE tag_text IN ({$repeat_questions}) 477 OR tag_slug IN ({$repeat_questions}) 478 ENDOFSQL; 473 $sql_tags_exist= 'SELECT id, tag_text, tag_slug 474 FROM {tags} 475 WHERE tag_text IN ({$repeat_questions}) 476 OR tag_slug IN ({$repeat_questions})'; 479 477 $params= array_merge( array_keys( $clean_tags ), array_values( $clean_tags ) ); 480 478 $existing_tags= DB::get_results( $sql_tags_exist, $params ); … … 517 515 */ 518 516 foreach ( $clean_tags as $new_tag_text=>$new_tag_slug ) { 519 $sql_tag_new=<<<ENDOFSQL 520 INSERT INTO {tags} (id, tag_text, tag_slug) VALUES (NULL, ?, ?) 521 ENDOFSQL; 517 $sql_tag_new= 'INSERT INTO {tags} (tag_text, tag_slug) VALUES (?, ?)'; 518 522 519 if (FALSE !== ($insert= DB::query( $sql_tag_new, array( $new_tag_text, $new_tag_slug ) ) ) ) 523 520 $tag_ids_to_post[]= DB::last_insert_id(); … … 536 533 $post_id= $this->fields['id']; 537 534 foreach ( $tag_ids_to_post as $index=>$new_tag_id ) { 538 $sql_tag_post_exists=<<<ENDOFSQL 539 SELECT COUNT(*) FROM {tag2post} WHERE tag_id = ? AND post_id = ? 540 ENDOFSQL; 535 $sql_tag_post_exists= 'SELECT COUNT(*) FROM {tag2post} WHERE tag_id = ? AND post_id = ?'; 541 536 if ( 0 == DB::get_value( $sql_tag_post_exists, array( $new_tag_id, $post_id ) ) ) { 542 $sql_tag_post_new=<<<ENDOFSQL 543 INSERT INTO {tag2post} (tag_id, post_id) VALUES (?, ?) 544 ENDOFSQL; 537 $sql_tag_post_new= 'INSERT INTO {tag2post} (tag_id, post_id) VALUES (?, ?)'; 545 538 $result&= DB::query( $sql_tag_post_new, array( $new_tag_id, $post_id ) ); 546 539 } … … 553 546 */ 554 547 $repeat_questions= Utils::placeholder_string( count($tag_ids_to_post) ); 555 $sql_delete=<<<ENDOFSQL 556 DELETE FROM {tag2post} WHERE post_id = ? AND tag_id NOT IN ({$repeat_questions}); 557 ENDOFSQL; 548 $sql_delete= 'DELETE FROM {tag2post} WHERE post_id = ? AND tag_id NOT IN ({$repeat_questions})'; 558 549 $params= array_merge( (array) $post_id, array_values( $tag_ids_to_post ) ); 559 550 $result&= DB::query( $sql_delete, $params );
