Changeset 1522
- Timestamp:
- 09/28/09 10:28:29 (14 years ago)
- Location:
- plugins/dcOpenSearch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dcOpenSearch/_define.php
r1493 r1522 17 17 /* Description*/ "Add an advanced search on your blog (posts, pages, comments, medias and other)", 18 18 /* Author */ "Tomtom (http://blog.zenstyle.fr/)", 19 /* Version */ '1.0. 2-r1479',19 /* Version */ '1.0.3', 20 20 /* Permissions */ 'usage,contentadmin', 21 21 /* Priority */ 20 -
plugins/dcOpenSearch/engines/class.dc.engine.medias.php
r1516 r1522 45 45 'U.user_name, U.user_firstname, U.user_displayname, U.user_url '. 46 46 'FROM '.$this->core->prefix.'media M '. 47 'INNER JOIN '.$this->core->prefix.'user U ON (M.user_id = U.user_id) '. 48 "WHERE (media_title LIKE '%".$q."%' OR ". 49 "media_file LIKE '%".$q."%') AND ". 50 "media_path = '".$this->core->blog->settings->public_path."'"; 47 'INNER JOIN '.$this->core->prefix.'user U ON (M.user_id = U.user_id) WHERE'; 48 49 $words = text::splitWords($q); 50 51 if (!empty($words)) { 52 if ($words) { 53 foreach ($words as $i => $w) { 54 $words[$i] = "(media_title LIKE '%".$this->core->con->escape($w)."%' OR media_file LIKE '%".$this->core->con->escape($w)."%')"; 55 } 56 $strReq .= ' '.implode(' AND ',$words).' '; 57 } 58 } 59 60 $strReq .= " AND media_path = '".$this->core->blog->settings->public_path."'"; 51 61 52 62 if (!$this->core->auth->check('media_admin',$this->core->blog->id)) … … 55 65 56 66 if ($this->core->auth->userID()) { 57 $strReq .= "OR user_id = '".$this->co n->escape($this->core->auth->userID())."'";67 $strReq .= "OR user_id = '".$this->core->con->escape($this->core->auth->userID())."'"; 58 68 } 59 69 $strReq .= ') '; -
plugins/dcOpenSearch/engines/class.dc.engine.pages.php
r1477 r1522 20 20 21 21 protected $core; 22 protected $has_gui = false;22 protected $has_gui = true; 23 23 protected $gui_url = null; 24 24 … … 42 42 43 43 while ($rs->fetch()) { 44 if ($rs->post_excerpt_xhtml === '') { 45 $content = $rs->post_content_xhtml; 46 } 47 elseif ($this->getEngineConfig('display') === 'both') { 48 $content = $rs->post_excerpt_xhtml.$rs->post_content_xhtml; 49 } 50 elseif ($this->getEngineConfig('display') === 'excerpt') { 51 $content = $rs->post_excerpt_xhtml; 52 } 53 else { 54 $content = $rs->post_content_xhtml; 55 } 44 56 $res[] = array( 45 57 'search_id' => $rs->post_id, … … 54 66 'search_dt' => $rs->post_creadt, 55 67 'search_tz' => $rs->post_tz, 56 'search_content' => (empty($rs->post_excerpt_xhtml) ? $rs->post_content_xhtml : $rs->post_excerpt_xhtml),68 'search_content' => $content, 57 69 'search_comment_nb' => $rs->nb_trackback, 58 70 'search_trackback_nb' => $rs->nb_comment, … … 64 76 65 77 return $res; 78 } 79 80 public function gui($url) 81 { 82 $res = ''; 83 84 $value = array( 85 __('Content only') => 'content', 86 __('Excerpt when it exists') => 'excerpt', 87 __('Both') => 'both' 88 ); 89 90 if (isset($_POST['save'])) 91 { 92 try { 93 $this->addEngineConfig('display',$_POST['display']); 94 $this->saveEngineConfig(); 95 http::redirect($url.'&config=1'); 96 } catch (Exception $e) { 97 $core->error->add($e->getMessage()); 98 } 99 } 100 101 if (!empty($_GET['config'])) { 102 $res .= '<p class="message">'.__('Configuration have been successfully saved.').'</p>'; 103 } 104 105 $res .= 106 '<form action="'.html::escapeURL($url).'" method="post">'. 107 '<fieldset><legend>'.__('General').'</legend>'. 108 '<p class="field"><label class="classic">'.form::combo('display',$value,$this->getEngineConfig('display')).' '. 109 __('Content type:').'</label></p>'. 110 '</fieldset>'. 111 $this->core->formNonce(). 112 '<p><input type="submit" name="save" value="'.__('Save').'"/></p>'. 113 '</form>'; 114 115 return $res; 66 116 } 67 117
Note: See TracChangeset
for help on using the changeset viewer.