- Timestamp:
- Mar 9, 2007, 5:28:49 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/history.php
r1881 r1883 228 228 229 229 $query = ' 230 SELECT COUNT(*)231 FROM '.HISTORY_TABLE.'232 WHERE '.$where_separator.'233 ;';234 235 // echo '<pre>'.$query.'</pre>';236 237 list($page['nb_lines']) = mysql_fetch_row(pwg_query($query));238 239 $query = '240 230 SELECT 241 231 date, … … 250 240 FROM '.HISTORY_TABLE.' 251 241 WHERE '.$where_separator.' 252 LIMIT '.$page['start'].', '.$conf['nb_logs_page'].'253 242 ;'; 254 243 244 // LIMIT '.$page['start'].', '.$conf['nb_logs_page'].' 245 255 246 $result = pwg_query($query); 256 $history_lines = $user_ids = $category_ids = $image_ids = array(); 247 248 $page['nb_lines'] = mysql_num_rows($result); 249 250 $history_lines = array(); 251 $user_ids = array(); 252 $category_ids = array(); 253 $image_ids = array(); 254 $tag_ids = array(); 255 257 256 while ($row = mysql_fetch_assoc($result)) 258 257 { … … 315 314 { 316 315 $query = ' 317 SELECT id, IF(name IS NULL, file, name) AS label 316 SELECT 317 id, 318 IF(name IS NULL, file, name) AS label, 319 filesize, 320 high_filesize 318 321 FROM '.IMAGES_TABLE.' 319 322 WHERE id IN ('.implode(',', array_keys($image_ids)).') 320 323 ;'; 321 $label_of_image = simple_hash_from_query($query, 'id', 'label'); 324 // $label_of_image = simple_hash_from_query($query, 'id', 'label'); 325 $label_of_image = array(); 326 $filesize_of_image = array(); 327 $high_filesize_of_image = array(); 328 329 $result = pwg_query($query); 330 while ($row = mysql_fetch_array($result)) 331 { 332 $label_of_image[ $row['id'] ] = $row['label']; 333 334 if (isset($row['filesize'])) 335 { 336 $filesize_of_image[ $row['id'] ] = $row['filesize']; 337 } 338 339 if (isset($row['high_filesize'])) 340 { 341 $high_filesize_of_image[ $row['id'] ] = $row['high_filesize']; 342 } 343 } 344 345 // echo '<pre>'; print_r($high_filesize_of_image); echo '</pre>'; 322 346 } 323 347 324 348 $i = 0; 349 $first_line = $page['start'] + 1; 350 $last_line = $page['start'] + $conf['nb_logs_page']; 351 352 $total_filesize = 0; 325 353 326 354 foreach ($history_lines as $line) 327 355 { 356 if (isset($line['image_type'])) 357 { 358 if ($line['image_type'] == 'high') 359 { 360 if (isset($high_filesize_of_image[$line['image_id']])) 361 { 362 $total_filesize+= $high_filesize_of_image[$line['image_id']]; 363 } 364 } 365 else 366 { 367 if (isset($filesize_of_image[$line['image_id']])) 368 { 369 $total_filesize+= $filesize_of_image[$line['image_id']]; 370 } 371 } 372 } 373 374 $i++; 375 376 if ($i < $first_line or $i > $last_line) 377 { 378 continue; 379 } 380 328 381 $template->assign_block_vars( 329 382 'detail', … … 338 391 'IMAGE' => isset($line['image_id']) 339 392 ? ( isset($label_of_image[$line['image_id']]) 340 ? $label_of_image[$line['image_id']] 341 : 'deleted '.$line['image_id']) 342 : $line['image_id'], 393 ? sprintf( 394 '(%u) %s', 395 $line['image_id'], 396 $label_of_image[$line['image_id']] 397 ) 398 : sprintf( 399 '(%u) deleted ', 400 $line['image_id'] 401 ) 402 ) 403 : '', 343 404 'TYPE' => $line['image_type'], 344 405 'SECTION' => $line['section'], … … 349 410 : '', 350 411 'TAGS' => $line['tag_ids'], 351 'T_CLASS' => ($i ++% 2) ? 'row1' : 'row2',412 'T_CLASS' => ($i % 2) ? 'row1' : 'row2', 352 413 ) 353 414 ); 354 415 } 416 417 $template->assign_block_vars( 418 'summary', 419 array( 420 'FILESIZE' => $total_filesize.' KB', 421 ) 422 ); 355 423 } 356 424 -
trunk/admin/include/functions_metadata.php
r1717 r1883 106 106 $datas = array(); 107 107 $tags_of = array(); 108 $has_high_images = array(); 109 110 $image_ids = array(); 111 foreach ($files as $id => $file) 112 { 113 array_push($image_ids, $id); 114 } 115 116 $query = ' 117 SELECT id 118 FROM '.IMAGES_TABLE.' 119 WHERE has_high = \'true\' 120 AND id IN ( 121 '.wordwrap(implode(', ', $image_ids), 80, "\n").' 122 ) 123 ;'; 124 125 $result = pwg_query($query); 126 while ($row = mysql_fetch_array($result)) 127 { 128 array_push($has_high_images, $row['id']); 129 } 108 130 109 131 foreach ($files as $id => $file) … … 117 139 $data['width'] = $image_size[0]; 118 140 $data['height'] = $image_size[1]; 141 } 142 143 if (in_array($id, $has_high_images)) 144 { 145 $high_file = dirname($file).'/pwg_high/'.basename($file); 146 147 $data['high_filesize'] = floor(filesize($high_file)/1024); 119 148 } 120 149 … … 162 191 'width', 163 192 'height', 193 'high_filesize', 164 194 'date_metadata_update' 165 195 ); -
trunk/admin/picture_modify.php
r1861 r1883 263 263 ); 264 264 265 if ($row['has_high'] == 'true') 266 { 267 $template->assign_block_vars( 268 'high', 269 array( 270 'FILESIZE' => isset($row['high_filesize']) 271 ? $row['high_filesize'].' KB' 272 : l10n('unknown'), 273 ) 274 ); 275 } 276 265 277 // creation date 266 278 unset($day, $month, $year); -
trunk/admin/site_reader_local.php
r1717 r1883 158 158 global $conf; 159 159 160 $update_fields = array('filesize', 'width', 'height' );160 $update_fields = array('filesize', 'width', 'height', 'high_filesize'); 161 161 162 162 if ($conf['use_exif']) … … 182 182 183 183 // returns a hash of attributes (metadata+filesize+width,...) for file 184 function get_element_metadata($file )184 function get_element_metadata($file, $has_high = false) 185 185 { 186 186 global $conf; … … 200 200 } 201 201 202 if ($has_high) 203 { 204 $high_file = dirname($file).'/pwg_high/'.basename($file); 205 206 $data['high_filesize'] = floor(filesize($high_file)/1024); 207 } 208 202 209 if ($conf['use_exif']) 203 210 { -
trunk/admin/site_reader_remote.php
r1204 r1883 48 48 ); 49 49 $this->metadata_attributes = array( 50 'filesize', 'width', 'height' 50 'filesize', 'width', 'height', 'high_filesize' 51 51 ); 52 52 … … 89 89 } 90 90 91 $this->metadata_attributes = array_merge( 92 $this->metadata_attributes, 93 explode(',', getAttribute($info_xml_element, 'metadata')) 94 ); 95 91 $additional_metadata = getAttribute($info_xml_element, 'metadata'); 92 93 if ($additional_metadata != '') 94 { 95 $this->metadata_attributes = array_merge( 96 $this->metadata_attributes, 97 explode(',', $additional_metadata) 98 ); 99 } 100 96 101 $this->build_structure($xml_content, '', 0); 97 102 … … 180 185 181 186 // returns a hash of attributes (metadata+width,...) for file 182 function get_element_metadata($file )187 function get_element_metadata($file, $has_high = false) 183 188 { 184 189 return $this->get_element_attributes( -
trunk/admin/site_update.php
r1458 r1883 776 776 $datas = array(); 777 777 $tags_of = array(); 778 779 $has_high_images = array(); 780 781 $image_ids = array(); 782 foreach ($files as $id => $file) 783 { 784 array_push($image_ids, $id); 785 } 786 787 if (count($image_ids) > 0) 788 { 789 $query = ' 790 SELECT id 791 FROM '.IMAGES_TABLE.' 792 WHERE has_high = \'true\' 793 AND id IN ( 794 '.wordwrap(implode(', ', $image_ids), 80, "\n").' 795 ) 796 ;'; 797 798 $result = pwg_query($query); 799 while ($row = mysql_fetch_array($result)) 800 { 801 array_push($has_high_images, $row['id']); 802 } 803 } 804 778 805 foreach ( $files as $id=>$file ) 779 806 { 780 $data = $site_reader->get_element_metadata($file); 807 $data = $site_reader->get_element_metadata( 808 $file, 809 in_array($id, $has_high_images) 810 ); 811 781 812 if ( is_array($data) ) 782 813 { … … 814 845 if (count($datas) > 0) 815 846 { 847 // echo '<pre>', print_r($datas); echo '</pre>'; 848 816 849 mass_updates( 817 850 IMAGES_TABLE, -
trunk/include/functions_xml.inc.php
r1058 r1883 53 53 { 54 54 // echo htmlentities($element).'<br /><br />'; 55 $regex = '/^<\w+[^>]* '.$attribute.'\s*=\s*"('.VAL_REG.')"/i';55 $regex = '/^<\w+[^>]*\b'.$attribute.'\s*=\s*"('.VAL_REG.')"/i'; 56 56 if ( preg_match( $regex, $element, $out ) ) 57 57 { -
trunk/install/phpwebgallery_structure.sql
r1866 r1883 39 39 `global_rank` varchar(255) default NULL, 40 40 `image_order` varchar(128) default NULL, 41 `permalink` VARCHAR(64) default NULL,42 PRIMARY KEY (`id`), 43 KEY `categories_i2` (`id_uppercat`),44 UNIQUE KEY `categories_i3` (`permalink`)41 `permalink` varchar(64) default NULL, 42 PRIMARY KEY (`id`), 43 UNIQUE KEY `categories_i3` (`permalink`), 44 KEY `categories_i2` (`id_uppercat`) 45 45 ) TYPE=MyISAM; 46 46 … … 197 197 `path` varchar(255) NOT NULL default '', 198 198 `storage_category_id` smallint(5) unsigned default NULL, 199 `high_filesize` mediumint(9) unsigned default NULL, 199 200 PRIMARY KEY (`id`), 200 201 KEY `images_i2` (`date_available`), … … 211 212 DROP TABLE IF EXISTS `phpwebgallery_old_permalinks`; 212 213 CREATE TABLE `phpwebgallery_old_permalinks` ( 213 `cat_id` smallint(5) unsigned NOT NULL ,214 `permalink` VARCHAR(64) NOT NULL,215 `date_deleted` datetime NOT NULL ,214 `cat_id` smallint(5) unsigned NOT NULL default '0', 215 `permalink` varchar(64) NOT NULL default '', 216 `date_deleted` datetime NOT NULL default '0000-00-00 00:00:00', 216 217 `last_hit` datetime default NULL, 217 218 `hit` int(10) unsigned NOT NULL default '0', 218 PRIMARY KEY (`permalink`)219 PRIMARY KEY (`permalink`) 219 220 ) TYPE=MyISAM; 220 221 -
trunk/template/yoga/admin/history.tpl
r1881 r1883 66 66 </form> 67 67 68 <h3>{L_DATE_TITLE}</h3> 68 <!-- BEGIN summary --> 69 <fieldset> 70 <legend>{lang:Summary}</legend> 71 72 <ul> 73 <li>{summary.FILESIZE}</li> 74 </ul> 75 </fieldset> 76 <!-- END summary --> 69 77 70 78 <!-- BEGIN navigation --> -
trunk/template/yoga/admin/picture_modify.tpl
r1780 r1883 37 37 <td>{FILESIZE}</td> 38 38 </tr> 39 40 <!-- BEGIN high --> 41 <tr> 42 <td><strong>{lang:High filesize}</strong></td> 43 <td>{high.FILESIZE}</td> 44 </tr> 45 <!-- END high --> 39 46 40 47 <tr> -
trunk/tools/create_listing_file.php
r1867 r1883 715 715 { 716 716 $element['has_high'] = 'true'; 717 718 $high_file = $file_dir.'/'.$conf['high'].'/'.$file_base; 719 $element['high_filesize'] = floor(filesize($high_file) / 1024); 717 720 } 718 721
Note: See TracChangeset
for help on using the changeset viewer.