Changeset 1892
- Timestamp:
- Mar 11, 2007, 4:53:25 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/history.php
r1891 r1892 72 72 // +-----------------------------------------------------------------------+ 73 73 74 $ errors= array();74 $page['errors'] = array(); 75 75 $search = array(); 76 76 … … 101 101 102 102 $search['fields']['user'] = $_POST['user']; 103 104 if (!empty($_POST['image_id'])) 105 { 106 $search['fields']['image_id'] = intval($_POST['image_id']); 107 } 108 109 if (!empty($_POST['filename'])) 110 { 111 $search['fields']['filename'] = str_replace( 112 '*', 113 '%', 114 mysql_escape_string($_POST['filename']) 115 ); 116 } 117 118 // TODO manage inconsistency of having $_POST['image_id'] and 119 // $_POST['filename'] simultaneously 103 120 104 121 // echo '<pre>'; print_r($search); echo '</pre>'; … … 124 141 else 125 142 { 126 array_push($ errors, $lang['search_one_clause_at_least']);143 array_push($page['errors'], $lang['search_one_clause_at_least']); 127 144 } 128 145 } … … 196 213 } 197 214 215 216 if (isset($page['search']['fields']['filename'])) 217 { 218 $query = ' 219 SELECT 220 id 221 FROM '.IMAGES_TABLE.' 222 WHERE file LIKE \''.$page['search']['fields']['filename'].'\' 223 ;'; 224 $page['search']['image_ids'] = array_from_query($query, 'id'); 225 } 226 198 227 // echo '<pre>'; print_r($page['search']); echo '</pre>'; 199 228 … … 252 281 'user_id = '.$page['search']['fields']['user'] 253 282 ); 283 } 284 285 if (isset($page['search']['fields']['image_id'])) 286 { 287 array_push( 288 $clauses, 289 'image_id = '.$page['search']['fields']['image_id'] 290 ); 291 } 292 293 if (isset($page['search']['fields']['filename'])) 294 { 295 if (count($page['search']['image_ids']) == 0) 296 { 297 // a clause that is always false 298 array_push($clauses, '1 = 2 '); 299 } 300 else 301 { 302 array_push( 303 $clauses, 304 'image_id IN ('.implode(', ', $page['search']['image_ids']).')' 305 ); 306 } 254 307 } 255 308 … … 512 565 } 513 566 514 // $groups_string = preg_replace(515 // '/(\d+)/e',516 // "\$groups['$1']",517 // implode(518 // ', ',519 // $local_user['groups']520 // )521 // );522 523 567 // +-----------------------------------------------------------------------+ 524 568 // | navigation bar | … … 578 622 $form['user'] = null; 579 623 } 624 625 $form['image_id'] = @$page['search']['fields']['image_id']; 626 $form['filename'] = @$page['search']['fields']['filename']; 580 627 } 581 628 else … … 600 647 'START_YEAR' => @$form['start_year'], 601 648 'END_YEAR' => @$form['end_year'], 649 'IMAGE_ID' => @$form['image_id'], 650 'FILENAME' => @$form['filename'], 602 651 ) 603 652 ); -
trunk/template/yoga/admin/history.tpl
r1890 r1892 73 73 </label> 74 74 75 <label> 76 {lang:Image id} 77 <input name="image_id" value="{IMAGE_ID}" type="text" size="5"> 78 </label> 79 80 <label> 81 {lang:File name} 82 <input name="filename" value="{FILENAME}" type="text"> 83 </label> 84 75 85 <input class="submit" type="submit" name="submit" value="{lang:submit}" /> 76 86 </fieldset>
Note: See TracChangeset
for help on using the changeset viewer.