Changeset 1593
- Timestamp:
- 2010년 01월 09일 15시 13분 18초 (2 years ago)
- Location:
- trunk/metabbs
- Files:
-
- 1 added
- 3 edited
-
app/models/board.php (modified) (1 diff)
-
app/models/post.php (modified) (4 diffs)
-
core/core.php (modified) (2 diffs)
-
core/relation.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/metabbs/app/models/board.php
r1428 r1593 21 21 $this->comment_table = get_table_name('comment'); 22 22 $this->category_table = get_table_name('category'); 23 $this->category_rel = new OneToManyRelation($this, 'category'); 23 24 } 24 25 function get_id() { -
trunk/metabbs/app/models/post.php
r1592 r1593 21 21 $this->category_table = get_table_name('category'); 22 22 $this->comment_table = get_table_name('comment'); 23 $this->trackback_table = get_table_name('trackback');24 23 $this->attachment_table = get_table_name('attachment'); 25 24 $this->tag_table = get_table_name('tag'); 26 25 $this->tag_post_table = get_table_name('tag_post'); 26 27 $this->trackback_rel = new OneToManyRelation($this, 'trackback'); 27 28 } 28 29 function find($id) { … … 121 122 $this->db->execute("UPDATE $this->table SET comment_count=$this->comment_count WHERE id=$this->id"); 122 123 } 124 125 126 // 트랙백 관련 127 function get_trackbacks() { 128 return $this->trackback_rel->all(); 129 } 130 function add_trackback($trackback) { 131 $this->trackback_rel->add($trackback); 132 } 133 function get_trackback_count() { 134 return $this->trackback_rel->count(); 135 } 136 137 123 138 function update_attachment_count() { 124 139 $this->attachment_count = $this->get_attachment_count(); 125 140 $this->db->execute("UPDATE $this->table SET attachment_count=$this->attachment_count WHERE id=$this->id"); 126 }127 function get_trackbacks() {128 return $this->db->fetchall("SELECT * FROM $this->trackback_table WHERE post_id=$this->id", 'Trackback');129 }130 function add_trackback($trackback) {131 $trackback->post_id = $this->id;132 $trackback->create();133 }134 function get_trackback_count() {135 return $this->db->fetchone("SELECT COUNT(*) FROM $this->trackback_table WHERE post_id=$this->id");136 141 } 137 142 function get_attachments() { … … 210 215 $this->db->execute("DELETE FROM $this->table WHERE moved_to=$this->id"); 211 216 $this->db->execute("DELETE FROM $this->comment_table WHERE post_id=$this->id"); 212 $this-> db->execute("DELETE FROM $this->trackback_table WHERE post_id=$this->id");217 $this->trackback_rel->clear(); 213 218 foreach($this->get_tags() as $tag) 214 219 $this->delete_tag_by_name($tag->name); … … 245 250 $this->db->execute("DELETE FROM $this->table WHERE id=$_id"); 246 251 $this->db->execute("UPDATE $this->comment_table SET post_id=$this->id WHERE post_id=$_id"); 247 $this-> db->execute("UPDATE $this->trackback_table SET post_id=$this->id WHERE post_id=$_id");252 $this->trackback_rel->update(array('post_id' => $this->id)); 248 253 $this->db->execute("UPDATE $this->attachment_table SET post_id=$this->id WHERE post_id=$_id"); 249 254 $this->metadata->reload(); -
trunk/metabbs/core/core.php
r1568 r1593 4 4 requireCore('config'); 5 5 $config = new Config(METABBS_DIR . '/metabbs.conf.php'); 6 $reserved_containers = array_map( create_function('$s','return trim($s);'), explode(',',$config->get('reserved_containers')));6 $reserved_containers = array_map('trim', explode(',',$config->get('reserved_containers'))); 7 7 8 8 $backend = $config->get('backend', 'mysql'); … … 11 11 } 12 12 requireCore('query'); 13 requireCore('relation'); 13 14 $__cache = new ObjectCache; 14 15 requireModel('metadata');
Note: See TracChangeset
for help on using the changeset viewer.
