Changeset 1883 for trunk/admin/history.php
- Timestamp:
- Mar 9, 2007, 5:28:49 PM (17 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.