Changeset 774 for trunk/picture.php
- Timestamp:
- Apr 26, 2005, 4:24:08 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/picture.php
r745 r774 460 460 $url_metadata.= '&show_metadata=1'; 461 461 } 462 462 463 // author 464 $author = $creation_date = $size = $filesize = $lang['unavailable']; 465 if ( !empty($picture['current']['author']) ) 466 { 467 $search_url = PHPWG_ROOT_PATH.'category.php?cat=search'; 468 $search_url.= '&search=author:'.$picture['current']['author']; 469 470 $author = '<a href="'; 471 $author .= add_session_id($search_url); 472 $author .= '">'.$picture['current']['author'].'</a>'; 473 } 474 475 // creation date 476 if ( !empty($picture['current']['date_creation']) ) 477 { 478 $creation_date = format_date($picture['current']['date_creation']); 479 } 480 481 // date of availability 482 $availability_date = format_date($picture['current']['date_available']); 483 484 // size in pixels 485 if ($picture['current']['is_picture']) 486 { 487 if ($original_width != $picture_size[0] 488 or $original_height != $picture_size[1]) 489 { 490 $size = '[ <a href="'.$picture['current']['src'].'" '; 491 $size .= ' title="'.$lang['true_size'].'">'; 492 $size .= $original_width.'*'.$original_height.'</a> ]'; 493 } 494 else 495 { 496 $size = $original_width.'*'.$original_height; 497 } 498 } 499 500 // filesize 501 if (empty($picture['current']['filesize'])) 502 { 503 if (!$picture['current']['is_picture']) 504 { 505 $filesize = floor(filesize($picture['current']['download'])/1024); 506 } 507 else 508 { 509 $filesize = floor(filesize($picture['current']['src'])/1024); 510 } 511 } 512 else 513 { 514 $filesize = $picture['current']['filesize']; 515 } 516 517 // number of visits 518 $template->assign_block_vars( 519 'info_line', 520 array( 521 'INFO'=>$lang['visited'], 522 'VALUE'=>$picture['current']['hit'].' '.$lang['times'] 523 )); 524 463 525 include(PHPWG_ROOT_PATH.'include/page_header.php'); 464 526 $template->set_filenames(array('picture'=>'picture.tpl')); … … 472 534 'WIDTH_IMG' => $picture_size[0], 473 535 'HEIGHT_IMG' => $picture_size[1], 536 'AUTHOR' => $author, 537 'CREATION_DATE' => $creation_date, 538 'AVAILABILITY_DATE' => $availability_date, 539 'SIZE' => $size, 540 'FILE_SIZE' => $filesize, 474 541 475 542 'LEVEL_SEPARATOR' => $conf['level_separator'], … … 494 561 'L_UP_HINT' => $lang['home_hint'], 495 562 'L_UP_ALT' => $lang['home'], 563 'L_CREATION_DATE' => $lang['creation_date'], 564 'L_AVAILABILITY_DATE' => $lang['registration_date'], 565 'L_SIZE' => $lang['size'], 566 'L_FILE' => $lang['file'], 567 'L_FILE_SIZE' => $lang['size'], 496 568 497 569 'U_HOME' => add_session_id(PHPWG_ROOT_PATH.'category.php'), … … 612 684 } 613 685 614 // author615 if ( !empty($picture['current']['author']) )616 {617 $search_url = PHPWG_ROOT_PATH.'category.php?cat=search';618 $search_url.= '&search=author:'.$picture['current']['author'];619 620 $value = '<a href="';621 $value.= add_session_id($search_url);622 $value.= '">'.$picture['current']['author'].'</a>';623 624 $template->assign_block_vars(625 'info_line',626 array(627 'INFO'=>$lang['author'],628 'VALUE'=>$value629 ));630 }631 // creation date632 if ( !empty($picture['current']['date_creation']) )633 {634 $search_url = PHPWG_ROOT_PATH.'category.php?cat=search';635 $search_url.= '&search=';636 $search_url.= 'date_creation:'.$picture['current']['date_creation'];637 638 $value = '<a href="';639 $value.= add_session_id($search_url);640 $value.= '">'.format_date($picture['current']['date_creation']).'</a>';641 642 $template->assign_block_vars(643 'info_line',644 array(645 'INFO'=>$lang['creation_date'],646 'VALUE'=>$value647 ));648 }649 // date of availability650 $search_url = PHPWG_ROOT_PATH.'category.php?cat=search';651 $search_url.= '&search=';652 $search_url.= 'date_available:'.$picture['current']['date_available'];653 654 $value = '<a href="';655 $value.= add_session_id($search_url);656 $value.= '">'.format_date($picture['current']['date_available']).'</a>';657 658 $template->assign_block_vars(659 'info_line',660 array(661 'INFO'=>$lang['registration_date'],662 'VALUE'=>$value663 ));664 // size in pixels665 if ($picture['current']['is_picture'])666 {667 if ($original_width != $picture_size[0]668 or $original_height != $picture_size[1])669 {670 $content = '[ <a href="'.$picture['current']['src'].'" ';671 $content.= ' title="'.$lang['true_size'].'">';672 $content.= $original_width.'*'.$original_height.'</a> ]';673 }674 else675 {676 $content = $original_width.'*'.$original_height;677 }678 $template->assign_block_vars(679 'info_line',680 array(681 'INFO'=>$lang['size'],682 'VALUE'=>$content683 ));684 }685 // file686 $template->assign_block_vars('info_line', array(687 'INFO'=>$lang['file'],688 'VALUE'=>$picture['current']['file']689 ));690 // filesize691 if (empty($picture['current']['filesize']))692 {693 if (!$picture['current']['is_picture'])694 {695 $filesize = floor(filesize($picture['current']['download'])/1024);696 }697 else698 {699 $filesize = floor(filesize($picture['current']['src'])/1024);700 }701 }702 else703 {704 $filesize = $picture['current']['filesize'];705 }706 707 $template->assign_block_vars('info_line', array(708 'INFO'=>$lang['filesize'],709 'VALUE'=>$filesize.' KB'710 ));711 686 // keywords 712 687 if (!empty($picture['current']['keywords'])) … … 725 700 } 726 701 $template->assign_block_vars( 727 ' info_line',702 'keywords', 728 703 array( 729 704 'INFO'=>$lang['keywords'], … … 731 706 )); 732 707 } 733 // number of visits 734 $template->assign_block_vars( 735 'info_line', 736 array( 737 'INFO'=>$lang['visited'], 738 'VALUE'=>$picture['current']['hit'].' '.$lang['times'] 739 )); 740 // rate results 741 if ($conf['rate']) 742 { 743 $query = ' 744 SELECT COUNT(rate) AS count 745 , ROUND(AVG(rate),2) AS average 746 , ROUND(STD(rate),2) AS STD 747 FROM '.RATE_TABLE.' 748 WHERE element_id = '.$picture['current']['id'].' 749 ;'; 750 $row = mysql_fetch_array(pwg_query($query)); 751 if ($row['count'] == 0) 752 { 753 $value = $lang['no_rate']; 754 } 755 else 756 { 757 $value = $row['average']; 758 $value.= ' ('; 759 $value.= $row['count'].' '.$lang['rates']; 760 $value.= ', '.$lang['standard_deviation'].' : '.$row['STD']; 761 $value.= ')'; 762 } 763 764 $template->assign_block_vars( 765 'info_line', 766 array( 767 'INFO' => $lang['element_rate'], 768 'VALUE' => $value 769 )); 770 } 708 771 709 // related categories 772 710 $cat_output = ''; … … 796 734 } 797 735 $template->assign_block_vars( 798 ' info_line',736 'associated', 799 737 array( 800 738 'INFO' => $lang['categories'], 801 739 'VALUE' => $cat_output 802 740 )); 803 // metadata 741 742 //------------------------------------------------------------------- metadata 804 743 if ($metadata_showable and isset($_GET['show_metadata'])) 805 744 { … … 905 844 } 906 845 907 //------------------------------------------------------------------- rate form 908 if ($conf['rate'] and !$user['is_the_guest']) 909 { 910 $query = ' 911 SELECT rate 846 //------------------------------------------------------------------- rating 847 if ($conf['rate']) 848 { 849 $query = 'SELECT COUNT(rate) AS count 850 , ROUND(AVG(rate),2) AS average 851 , ROUND(STD(rate),2) AS STD 912 852 FROM '.RATE_TABLE.' 913 WHERE user_id = '.$user['id'].' 914 AND element_id = '.$_GET['image_id'].' 853 WHERE element_id = '.$picture['current']['id'].' 915 854 ;'; 855 $row = mysql_fetch_array(pwg_query($query)); 856 if ($row['count'] == 0) 857 { 858 $value = $lang['no_rate']; 859 } 860 else 861 { 862 $value = $row['average']; 863 $value.= ' ('; 864 $value.= $row['count'].' '.$lang['rates']; 865 $value.= ', '.$lang['standard_deviation'].' : '.$row['STD']; 866 $value.= ')'; 867 } 868 869 if (!$user['is_the_guest']) 870 { 871 $query = 'SELECT rate 872 FROM '.RATE_TABLE.' 873 WHERE user_id = '.$user['id'].' 874 AND element_id = '.$_GET['image_id'].';'; 916 875 $result = pwg_query($query); 917 876 if (mysql_num_rows($result) > 0) … … 925 884 { 926 885 $sentence = $lang['never_rated'].'. '.$lang['to_rate']; 927 } 886 } 928 887 $template->assign_block_vars( 929 888 'rate', 930 array('SENTENCE' => $sentence) 931 ); 932 889 array( 890 'INFO' => $lang['element_rate'], 891 'VALUE' => $value, 892 'SENTENCE' => $sentence 893 )); 933 894 934 895 foreach ($rate_items as $num => $mark) … … 954 915 'SEPARATOR' => $separator 955 916 )); 956 } 957 } 917 } 918 } 919 } 920 958 921 //---------------------------------------------------- users's comments display 959 922 if ($page['show_comments'])
Note: See TracChangeset
for help on using the changeset viewer.