Changeset 606 for trunk/admin
- Timestamp:
- Nov 17, 2004, 12:38:34 AM (20 years ago)
- Location:
- trunk/admin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r597 r606 785 785 } 786 786 } 787 788 /** 789 * inserts multiple lines in a table 790 * 791 * @param string table_name 792 * @param array dbields 793 * @param array inserts 794 * @return void 795 */ 796 function mass_inserts($table_name, $dbfields, $inserts) 797 { 798 // inserts all found categories 799 $query = ' 800 INSERT INTO '.$table_name.' 801 ('.implode(',', $dbfields).') 802 VALUES'; 803 foreach ($inserts as $insert_id => $insert) 804 { 805 $query.= ' 806 '; 807 if ($insert_id > 0) 808 { 809 $query.= ','; 810 } 811 $query.= '('; 812 foreach ($dbfields as $field_id => $dbfield) 813 { 814 if ($field_id > 0) 815 { 816 $query.= ','; 817 } 818 819 if (!isset($insert[$dbfield]) or $insert[$dbfield] == '') 820 { 821 $query.= 'NULL'; 822 } 823 else 824 { 825 $query.= "'".$insert[$dbfield]."'"; 826 } 827 } 828 $query.=')'; 829 } 830 $query.= ' 831 ;'; 832 pwg_query($query); 833 } 787 834 ?> -
trunk/admin/infos_images.php
r593 r606 320 320 while ($row = mysql_fetch_array($result)) 321 321 { 322 $thumbnail_url = get_thumbnail_src($row['file'], 323 $row['storage_category_id'], 324 @$row['tn_ext']); 322 $thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']); 325 323 326 324 $template->assign_block_vars( -
trunk/admin/picture_modify.php
r593 r606 200 200 $dir_path = get_cat_display_name($current_category['name'], '->', ''); 201 201 202 $thumbnail_url = get_thumbnail_src($row['file'], 203 $row['storage_category_id'], 204 @$row['tn_ext']); 202 $thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']); 205 203 206 204 $url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id']; -
trunk/admin/remote_site.php
r602 r606 110 110 111 111 return $database_dirs; 112 }113 114 /**115 * inserts multiple lines in a table116 *117 * @param string table_name118 * @param array dbields119 * @param array inserts120 * @return void121 */122 function mass_inserts($table_name, $dbfields, $inserts)123 {124 // inserts all found categories125 $query = '126 INSERT INTO '.$table_name.'127 ('.implode(',', $dbfields).')128 VALUES';129 foreach ($inserts as $insert_id => $insert)130 {131 $query.= '132 ';133 if ($insert_id > 0)134 {135 $query.= ',';136 }137 $query.= '(';138 foreach ($dbfields as $field_id => $dbfield)139 {140 if ($field_id > 0)141 {142 $query.= ',';143 }144 145 if (!isset($insert[$dbfield]) or $insert[$dbfield] == '')146 {147 $query.= 'NULL';148 }149 else150 {151 $query.= "'".$insert[$dbfield]."'";152 }153 }154 $query.=')';155 }156 $query.= '157 ;';158 pwg_query($query);159 112 } 160 113 … … 419 372 'keywords', 420 373 'name', 421 'comment'); 374 'comment', 375 'path'); 422 376 foreach ($optional_atts as $att) 423 377 { … … 435 389 $dbfields = array('file','storage_category_id','date_available','tn_ext', 436 390 'filesize','width','height','date_creation','author', 437 'keywords','name','comment' );391 'keywords','name','comment','path'); 438 392 mass_inserts(IMAGES_TABLE, $dbfields, $inserts); 439 393 $counts{'new_elements'}+= count($inserts); -
trunk/admin/update.php
r602 r606 32 32 include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php'); 33 33 34 define('CURRENT_DATE', "'".date('Y-m-d')."'");34 define('CURRENT_DATE', date('Y-m-d')); 35 35 // +-----------------------------------------------------------------------+ 36 36 // | functions | … … 408 408 { 409 409 $insert = array(); 410 $insert['file'] = "'".$unregistered_element."'";410 $insert['file'] = $unregistered_element; 411 411 $insert['storage_category_id'] = $category_id; 412 412 $insert['date_available'] = CURRENT_DATE; 413 $insert['tn_ext'] = "'".$tn_ext."'"; 413 $insert['tn_ext'] = $tn_ext; 414 $insert['path'] = $dir.$unregistered_element; 414 415 415 416 $counts['new_elements']++; … … 447 448 448 449 $insert = array(); 449 $insert['file'] = "'".$unregistered_element."'"; 450 $insert['file'] = $unregistered_element; 451 $insert['path'] = $dir.$unregistered_element; 450 452 $insert['storage_category_id'] = $category_id; 451 453 $insert['date_available'] = CURRENT_DATE; 452 454 if ( $tn_ext != '' ) 453 455 { 454 $insert['tn_ext'] = "'".$tn_ext."'";456 $insert['tn_ext'] = $tn_ext; 455 457 } 456 458 if ( $representative_ext != '' ) 457 459 { 458 $insert['representative_ext'] = "'".$representative_ext."'";460 $insert['representative_ext'] = $representative_ext; 459 461 } 460 462 … … 476 478 $dbfields = array( 477 479 'file','storage_category_id','date_available','tn_ext' 478 ,'representative_ext' 480 ,'representative_ext','path' 479 481 ); 480 $query = ' 481 INSERT INTO '.IMAGES_TABLE.' 482 ('.implode(',', $dbfields).') 483 VALUES 484 '; 485 foreach ($inserts as $insert_id => $insert) 486 { 487 $query.= ' 488 '; 489 if ($insert_id > 0) 490 { 491 $query.= ','; 492 } 493 $query.= '('; 494 foreach ($dbfields as $field_id => $dbfield) 495 { 496 if ($field_id > 0) 497 { 498 $query.= ','; 499 } 500 501 if (!isset($insert[$dbfield]) or $insert[$dbfield] == '') 502 { 503 $query.= 'NULL'; 504 } 505 else 506 { 507 $query.= $insert[$dbfield]; 508 } 509 } 510 $query.=')'; 511 } 512 $query.= ' 513 ;'; 514 515 pwg_query($query); 482 mass_inserts(IMAGES_TABLE, $dbfields, $inserts); 516 483 517 484 // what are the ids of the pictures in the $category_id ?
Note: See TracChangeset
for help on using the changeset viewer.