Changeset 1131 for trunk/include/section_init.inc.php
- Timestamp:
- Apr 6, 2006, 4:23:54 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/section_init.inc.php
r1125 r1131 71 71 $page['root_path'] = PHPWG_ROOT_PATH; 72 72 } 73 //phpinfo(); 73 74 74 // deleting first "/" if displayed 75 75 $tokens = explode( … … 148 148 $i = $next_token; 149 149 150 $requested_tag_ids = array(); 151 $requested_tag_url_names = array(); 152 150 153 while (isset($tokens[$i])) 151 154 { 152 preg_match('/^(\d+)(?:-(.*))?/', $tokens[$i], $matches); 153 if (!isset($matches[1])) 154 { 155 if (0 == count($page['tags'])) 156 { 157 die('Fatal: at least one tag required'); 158 } 159 else 160 { 161 break; 162 } 163 } 164 165 array_push( 166 $page['tags'], 167 array( 168 'id' => $matches[1], 169 'url_name' => isset($matches[2]) ? $matches[2] : '', 170 ) 171 ); 172 155 if ( preg_match('/^(created-|posted-|start-(\d)+)/', $tokens[$i]) ) 156 break; 157 158 if ( preg_match('/^(\d+)(?:-(.*))?/', $tokens[$i], $matches) ) 159 { 160 array_push($requested_tag_ids, $matches[1]); 161 } 162 else 163 { 164 array_push($requested_tag_url_names, "'".$tokens[$i]."'"); 165 } 173 166 $i++; 174 167 } 175 176 168 $next_token = $i; 169 170 if ( empty($requested_tag_ids) && empty($requested_tag_url_names) ) 171 { 172 die('Fatal: at least one tag required'); 173 } 174 // tag infos 175 $query = ' 176 SELECT name, url_name, id 177 FROM '.TAGS_TABLE.' 178 WHERE '; 179 if ( !empty($requested_tag_ids) ) 180 { 181 $query.= 'id IN ('.implode(',', $requested_tag_ids ).')'; 182 } 183 if ( !empty($requested_tag_url_names) ) 184 { 185 if ( !empty($requested_tag_ids) ) 186 { 187 $query.= ' OR '; 188 } 189 $query.= 'url_name IN ('.implode(',', $requested_tag_url_names ).')'; 190 } 191 $result = pwg_query($query); 192 $tag_infos = array(); 193 while ($row = mysql_fetch_array($result)) 194 { 195 $tag_infos[ $row['id'] ] = $row; 196 array_push($page['tags'], $row );//we loose given tag order; is it important? 197 } 198 if ( empty($page['tags']) ) 199 { 200 die('Fatal: no existing tag'); 201 } 177 202 } 178 203 else if (0 === strpos($tokens[$next_token], 'fav')) … … 240 265 } 241 266 242 if (preg_match('/^ posted|created/', $tokens[$i] ))267 if (preg_match('/^(posted|created)/', $tokens[$i] )) 243 268 { 244 269 $chronology_tokens = explode('-', $tokens[$i] ); … … 360 385 // reachable to the connected user, we need to check category 361 386 // associations 362 if (!empty($ user['forbidden_categories']) and !empty($items) )387 if (!empty($items) ) 363 388 { 364 389 $query = ' … … 372 397 array_from_query($query, 'image_id') 373 398 ); 374 }375 376 // tag names377 $query = '378 SELECT name, url_name, id379 FROM '.TAGS_TABLE.'380 WHERE id IN ('.implode(',', $page['tag_ids']).')381 ;';382 $result = pwg_query($query);383 $tag_infos = array();384 385 while ($row = mysql_fetch_array($result))386 {387 $tag_infos[ $row['id'] ]['name'] = $row['name'];388 $tag_infos[ $row['id'] ]['url_name'] = $row['url_name'];389 399 } 390 400
Note: See TracChangeset
for help on using the changeset viewer.