Changeset 407:eb5bd0f66932 for inc/core
- Timestamp:
- 06/23/11 13:00:59 (14 years ago)
- Branch:
- default
- Location:
- inc/core
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.blog.php
r340 r407 727 727 if (isset($params['post_type'])) 728 728 { 729 $strReq .= 'AND post_type '.$this->con->in($params['post_type']); 729 if (is_array($params['post_type']) || $params['post_type'] != '') { 730 $strReq .= 'AND post_type '.$this->con->in($params['post_type']); 731 } 730 732 } 731 733 else -
inc/core/class.dc.core.php
r331 r407 27 27 { 28 28 public $con; ///< <b>connection</b> Database connection object 29 public $prefix; ///< <b>string</b> Database tables prefix29 public $prefix; ///< <b>string</b> Database tables prefix 30 30 public $blog; ///< <b>dcBlog</b> dcBlog object 31 31 public $error; ///< <b>dcError</b> dcError object … … 36 36 public $plugins; ///< <b>dcModules</b> dcModules object 37 37 public $media; ///< <b>dcMedia</b> dcMedia object 38 public $rest; ///< <b>dcRestServer</b> dcRestServer object 38 public $postmedia; ///< <b>dcPostMedia</b> dcPostMedia object 39 public $rest; ///< <b>dcRestServer</b> dcRestServer object 39 40 public $log; ///< <b>dcLog</b> dcLog object 40 41 -
inc/core/class.dc.media.php
r270 r407 23 23 protected $con; ///< <b>connection</b> Database connection 24 24 protected $table; ///< <b>string</b> Media table name 25 protected $table_ref; ///< <b>string</b> Post-media relation table name26 25 protected $type; ///< <b>string</b> Media type filter 26 protected $postmedia; 27 27 protected $file_sort = 'name-asc'; 28 28 … … 57 57 $this->core =& $core; 58 58 $this->con =& $core->con; 59 $this->postmedia = new dcPostMedia($core); 59 60 60 61 if ($this->core->blog == null) { … … 63 64 64 65 $this->table = $this->core->prefix.'media'; 65 $this->table_ref = $this->core->prefix.'post_media';66 66 $root = $this->core->blog->public_path; 67 67 … … 494 494 public function getPostMedia($post_id,$media_id=null) 495 495 { 496 $post_id = (integer) $post_id; 497 498 $strReq = 499 'SELECT media_file, M.media_id, media_path, media_title, media_meta, media_dt, '. 500 'media_creadt, media_upddt, media_private, user_id '. 501 'FROM '.$this->table.' M '. 502 'INNER JOIN '.$this->table_ref.' PM ON (M.media_id = PM.media_id) '. 503 "WHERE media_path = '".$this->path."' ". 504 'AND post_id = '.$post_id.' '; 505 496 $params = array( 497 'post_id' => $post_id, 498 'media_path' => $this->path 499 ); 506 500 if ($media_id) { 507 $strReq .= 'AND M.media_id = '.(integer) $media_id.' '; 508 } 509 510 $rs = $this->con->select($strReq); 501 $params['media_id'] = (integer) $media_id; 502 } 503 $rs = $this->postmedia->getPostMedia($params); 511 504 512 505 $res = array(); … … 523 516 524 517 /** 525 Attaches a media to a post. 526 527 @param post_id <b>integer</b> Post ID 528 @param media_id <b>integer</b> Optionnal media ID 518 @deprecated since version 2.4 519 @see dcPostMedia::addPostMedia 529 520 */ 530 521 public function addPostMedia($post_id,$media_id) 531 522 { 532 $post_id = (integer) $post_id; 533 $media_id = (integer) $media_id; 534 535 $f = $this->getPostMedia($post_id,$media_id); 536 537 if (!empty($f)) { 538 return; 539 } 540 541 $cur = $this->con->openCursor($this->table_ref); 542 $cur->post_id = $post_id; 543 $cur->media_id = $media_id; 544 545 $cur->insert(); 546 $this->core->blog->triggerBlog(); 547 } 548 549 /** 550 Detaches a media from a post. 551 552 @param post_id <b>integer</b> Post ID 553 @param media_id <b>integer</b> Optionnal media ID 523 $this->postmedia->addPostMedia($post_id,$media_id); 524 } 525 526 /** 527 @deprecated since version 2.4 528 @see dcPostMedia::removePostMedia 554 529 */ 555 530 public function removePostMedia($post_id,$media_id) 556 531 { 557 $post_id = (integer) $post_id; 558 $media_id = (integer) $media_id; 559 560 $strReq = 'DELETE FROM '.$this->table_ref.' '. 561 'WHERE post_id = '.$post_id.' '. 562 'AND media_id = '.$media_id.' '; 563 564 $this->con->execute($strReq); 565 $this->core->blog->triggerBlog(); 532 $this->postmedia->removePostMedia($post_id,$media_id,"attachment"); 566 533 } 567 534
Note: See TracChangeset
for help on using the changeset viewer.