Changeset 3099:82ce3d85c6be for inc
- Timestamp:
- 09/26/15 09:59:43 (10 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.media.php
r2768 r3099 368 368 return strcasecmp($a->basename,$b->basename); 369 369 } 370 371 370 } 372 371 … … 520 519 521 520 /** 521 Search into media db (only). 522 523 @param query <b>string</b> Search query 524 @return boolean true or false if nothing found 525 */ 526 public function searchMedia($query) 527 { 528 if ($query == '') { 529 return false; 530 } 531 532 $strReq = 533 'SELECT media_file, media_id, media_path, media_title, media_meta, media_dt, '. 534 'media_creadt, media_upddt, media_private, user_id '. 535 'FROM '.$this->table.' '. 536 "WHERE media_path = '".$this->path."' ". 537 "AND (media_title LIKE '%".$this->con->escape($query)."%' ". 538 " OR media_file LIKE '%".$this->con->escape($query)."%' ". 539 " OR media_meta LIKE '<Description>%".$this->con->escape($query)."%</Description>')"; 540 541 if (!$this->core->auth->check('media_admin',$this->core->blog->id)) 542 { 543 $strReq .= 'AND (media_private <> 1 '; 544 545 if ($this->core->auth->userID()) { 546 $strReq .= "OR user_id = '".$this->con->escape($this->core->auth->userID())."'"; 547 } 548 $strReq .= ') '; 549 } 550 551 $rs = $this->con->select($strReq); 552 553 $this->dir = array('dirs' => array(),'files' => array()); 554 $f_res = array(); 555 while ($rs->fetch()) 556 { 557 $fr = $this->fileRecord($rs); 558 if ($fr) { 559 $f_res[] = $fr; 560 } 561 } 562 $this->dir['files'] = $f_res; 563 564 try { 565 usort($this->dir['files'],array($this,'sortFileHandler')); 566 } catch (Exception $e) {} 567 568 return (count($f_res) > 0 ? true : false); 569 } 570 571 /** 522 572 Returns media items attached to a blog post. Result is an array containing 523 573 fileItems objects.
Note: See TracChangeset
for help on using the changeset viewer.