| 13 | | if ( strlen( str_replace( '_', '', $term ) )<3 ) |
| 14 | | return ""; |
| 15 | | |
| 16 | | $db =& wfGetDB( DB_SLAVE ); |
| 17 | | $res = $db->select( 'page', 'page_title', |
| 18 | | array( 'page_namespace' => NS_IMAGE, |
| 19 | | "LCASE(page_title) = '". $db->strencode( $term2 ) ."'" ), |
| 20 | | "wfSajaxSearch", |
| 21 | | array( 'LIMIT' => 1 ) |
| 22 | | ); |
| 23 | | |
| 24 | | $row = $db->fetchObject( $res ); |
| 25 | | if (!$row) { |
| 26 | | return ""; |
| 27 | | } |
| 28 | | |
| 29 | | $ret = $row->page_title; |
| 30 | | |
| 31 | | if (!is_null($ret)) { |
| 32 | | $title = new Title(); |
| 33 | | $nt = Title::newFromText( $term , NS_IMAGE); |
| 34 | | $img = new Image( $nt ); |
| 35 | | return $img->getURL(); |
| 36 | | } else { |
| 37 | | return ""; |
| 38 | | } |
| | 13 | $title = new Title(); |
| | 14 | $nt = Title::newFromText( $term , NS_IMAGE); |
| | 15 | $img = new Image( $nt ); |
| | 16 | return $img->getURL(); |