Changeset 1711 in ExiteCMS for trunk/administration/search.php
- Timestamp:
- 08/28/08 17:37:47 (4 years ago)
- File:
-
- 1 edited
-
trunk/administration/search.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/administration/search.php
r1626 r1711 98 98 $variables['usergroups'] = getusergroups(false); 99 99 } 100 100 101 // toggle the search status 101 102 if ($action == "setstatus") { … … 108 109 } 109 110 111 // swap the order of two records 112 if ($action == "swap") { 113 // check the parameters passed 114 $order1 = (isset($_GET['order1']) && isNum($_GET['order1'])) ? $_GET['order1'] : 0; 115 $order2 = (isset($_GET['order2']) && isNum($_GET['order2'])) ? $_GET['order2'] : 0; 116 if ($order1 != 0 && $order2 != 0 && $order1 != $order2) { 117 $result1 = dbquery("SELECT search_id FROM ".$db_prefix."search WHERE search_order = '".$order1."'"); 118 $result2 = dbquery("SELECT search_id FROM ".$db_prefix."search WHERE search_order = '".$order2."'"); 119 if ($result1 && $result2) { 120 // everything checks out, swap 'm! 121 $data = dbarray($result1); 122 $result = dbquery("UPDATE ".$db_prefix."search SET search_order = ".$order2." WHERE search_id = ".$data['search_id']); 123 $data = dbarray($result2); 124 $result = dbquery("UPDATE ".$db_prefix."search SET search_order = ".$order1." WHERE search_id = ".$data['search_id']); 125 } 126 } 127 // return to the overview screen 128 $action = ""; 129 } 130 110 131 // no action specified: show the search overview 111 132 if ($action == "") { 112 133 // generate the searches overview 113 $searches = array(); 114 $searchindex = array(); 115 $result = dbquery("SELECT s.*, m.mod_folder FROM ".$db_prefix."search s LEFT JOIN ".$db_prefix."modules m ON s.search_mod_id = m.mod_id"); 134 $variables['searches'] = array(); 135 $result = dbquery("SELECT s.*, m.mod_folder FROM ".$db_prefix."search s LEFT JOIN ".$db_prefix."modules m ON s.search_mod_id = m.mod_id ORDER BY search_order"); 116 136 while ($data = dbarray($result)) { 117 137 // get the title for this search … … 132 152 $data['groupname'] = getgroupname($data['search_visibility']); 133 153 // store the search record 134 $searches[$data['search_id']] = $data; 135 $searchindex[] = $data['search_title']."_>_".$data['search_id']; 136 } 137 //make sure the modules are properly sorted 138 sort($searchindex); 139 $variables['search'] = array(); 140 foreach($searchindex as $index) { 141 $variables['searches'][] = $searches[substr(strstr($index,"_>_"),3)]; 154 $variables['searches'][] = $data; 142 155 } 143 156 // reload the locale for this module 144 157 locale_load("admin.search"); 158 } 159 160 // add the previous and next id's 161 foreach($variables['searches'] as $key => $value) { 162 $variables['searches'][$key]['order_down'] = isset($variables['searches'][$key+1]) ? $variables['searches'][$key+1]['search_order'] : 0; 163 $variables['searches'][$key]['order_up'] = isset($variables['searches'][$key-1]) ? $variables['searches'][$key-1]['search_order'] : 0; 145 164 } 146 165
Note: See TracChangeset
for help on using the changeset viewer.
