Ignore:
Timestamp:
10/12/12 21:56:12 (7 years ago)
Author:
rvelices
Message:
  • remove unsed code; shorten existing code and improve readability ...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r17980 r18628  
    3434  WHERE site_id = '.$id.' 
    3535;'; 
    36   $result = pwg_query($query); 
    37   $category_ids = array(); 
    38   while ($row = pwg_db_fetch_assoc($result)) 
    39   { 
    40     array_push($category_ids, $row['id']); 
    41   } 
     36  $category_ids = array_from_query($query, 'id'); 
    4237  delete_categories($category_ids); 
    4338 
     
    8075'.wordwrap(implode(', ', $ids), 80, "\n").') 
    8176;'; 
    82   $result = pwg_query($query); 
    83   $element_ids = array(); 
    84   while ($row = pwg_db_fetch_assoc($result)) 
    85   { 
    86     array_push($element_ids, $row['id']); 
    87   } 
     77  $element_ids = array_from_query($query, 'id'); 
    8878  delete_elements($element_ids); 
    8979 
     
    396386    foreach ($orphan_tags as $tag) 
    397387    { 
    398       array_push($orphan_tag_ids, $tag['id']); 
     388      $orphan_tag_ids[] = $tag['id']; 
    399389    } 
    400390 
     
    413403function get_orphan_tags() 
    414404{ 
    415   $orphan_tags = array(); 
    416  
    417405  $query = ' 
    418406SELECT 
     
    423411  WHERE tag_id IS NULL 
    424412;'; 
    425   $result = pwg_query($query); 
    426   while ($row = pwg_db_fetch_assoc($result)) 
    427   { 
    428     array_push($orphan_tags, $row); 
    429   } 
    430  
    431   return $orphan_tags; 
     413  return array_from_query($query); 
    432414} 
    433415 
     
    786768 
    787769  // categories : id, site_id, uppercats 
    788   $categories = array(); 
    789  
    790770  $query = ' 
    791771SELECT id, uppercats, site_id 
     
    795775'.wordwrap(implode(', ', $cat_ids), 80, "\n").') 
    796776;'; 
    797   $result = pwg_query($query); 
    798   while ($row = pwg_db_fetch_assoc($result)) 
    799   { 
    800     array_push($categories, $row); 
    801   } 
     777  $categories = array_from_query($query); 
    802778 
    803779  // filling $cat_fulldirs 
     
    16041580  WHERE id IN ('.implode(',', $images).') 
    16051581'; 
    1606    
     1582 
    16071583  if (is_array($categories) and count($categories) > 0) 
    16081584  { 
     
    20842060    case 'rating': 
    20852061    case 'tags': 
    2086     case 'picture_modify': 
    20872062    case 'batch_manager': 
    20882063      return 0; 
     
    21462121    { 
    21472122      $alt_names = trigger_event('get_tag_alt_names', array(), $raw_name); 
    2148  
    2149       // TEMP 2.4 
    2150       if (count($alt_names)==0 and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches)) 
    2151       { 
    2152         foreach ($matches[2] as $alt) 
    2153         { 
    2154           $alt_names[] = $alt; 
    2155         } 
    2156       } 
    21572123 
    21582124      foreach( array_diff( array_unique($alt_names), array($name) ) as $alt) 
Note: See TracChangeset for help on using the changeset viewer.