Changeset 1641
- Timestamp:
- Dec 8, 2006, 12:21:54 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_cats.inc.php
r1638 r1641 38 38 SELECT 39 39 id,name, representative_picture_id, comment, nb_images, uppercats, 40 max_date_last, is_child_date_last, count_images, count_categories40 date_last, max_date_last, count_images, count_categories 41 41 FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' 42 42 ON id = cat_id and user_id = '.$user['id'].' … … 51 51 SELECT 52 52 id,name, representative_picture_id, comment, nb_images, 53 max_date_last, is_child_date_last, count_images, count_categories53 date_last, max_date_last, count_images, count_categories 54 54 FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' 55 55 ON id = cat_id and user_id = '.$user['id'].' … … 66 66 while ($row = mysql_fetch_assoc($result)) 67 67 { 68 $row['is_child_date_last'] = get_boolean($row['is_child_date_last']); 68 $row['is_child_date_last'] = isset($row['date_last']) 69 and $row['max_date_last']>$row['date_last']; 69 70 70 71 if (isset($row['representative_picture_id']) -
trunk/include/functions_category.inc.php
r1637 r1641 62 62 // From USER_CACHE_CATEGORIES_TABLE 63 63 $query.= ' 64 max_date_last, is_child_date_last, count_images, count_categories';64 date_last, max_date_last, count_images, count_categories'; 65 65 66 66 // $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE … … 83 83 $result = pwg_query($query); 84 84 $cats = array(); 85 while ($row = mysql_fetch_array($result)) 86 { 87 $row['is_child_date_last'] = get_boolean($row['is_child_date_last']); 85 while ($row = mysql_fetch_assoc($result)) 86 { 88 87 array_push($cats, $row); 89 88 } -
trunk/include/functions_html.inc.php
r1624 r1641 27 27 function get_icon($date, $is_child_date = false) 28 28 { 29 global $page, $user, $ conf, $lang;29 global $page, $user, $lang; 30 30 31 31 if (empty($date)) 32 32 { 33 $date = 'NULL'; 34 } 35 36 if (isset($page['get_icon_cache'][$is_child_date][$date])) 37 { 38 return $page['get_icon_cache'][$is_child_date][$date]; 33 return ''; 34 } 35 36 if (isset($page['get_icon_cache'][$date])) 37 { 38 if (! $page['get_icon_cache'][$date] ) 39 return ''; 40 return $page['get_icon_cache']['_icons_'][$is_child_date]; 39 41 } 40 42 41 43 if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $date, $matches)) 42 { 43 // date can be empty, no icon to display 44 $page['get_icon_cache'][$is_child_date][$date] = ''; 45 return $page['get_icon_cache'][$is_child_date][$date]; 44 {// date can be empty, no icon to display 45 $page['get_icon_cache'][$date] = false; 46 return ''; 46 47 } 47 48 48 49 list($devnull, $year, $month, $day) = $matches; 49 50 $unixtime = mktime( 0, 0, 0, $month, $day, $year ); 50 51 51 if ($unixtime === false // PHP 5.1.0 and above 52 52 or $unixtime === -1) // PHP prior to 5.1.0 53 53 { 54 $page['get_icon_cache'][$ is_child_date][$date] = '';55 return $page['get_icon_cache'][$is_child_date][$date];54 $page['get_icon_cache'][$date] = false; 55 return ''; 56 56 } 57 57 58 58 $diff = time() - $unixtime; 59 59 $day_in_seconds = 24*60*60; 60 $output = ''; 61 $title = $lang['recent_image'].' '; 60 $page['get_icon_cache'][$date] = false; 62 61 if ( $diff < $user['recent_period'] * $day_in_seconds ) 63 62 { 64 $icon_url = get_themeconf('icon_dir').'/'.($is_child_date ? 'recent_by_child.png' : 'recent.png'); 65 $title .= $user['recent_period']; 66 $title .= ' '.$lang['days']; 67 $size = getimagesize( PHPWG_ROOT_PATH.$icon_url ); 68 $icon_url = get_root_url().$icon_url; 69 $output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;'; 70 $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)" />'; 71 } 72 73 $page['get_icon_cache'][$is_child_date][$date] = $output; 74 75 return $page['get_icon_cache'][$is_child_date][$date]; 76 } 63 if ( !isset($page['get_icon_cache']['_icons_'] ) ) 64 { 65 $icons = array(false => 'recent', true => 'recent_by_child' ); 66 $title = $lang['recent_image'].' '.$user['recent_period'] 67 .' '.$lang['days']; 68 foreach ($icons as $key => $icon) 69 { 70 $icon_url = get_themeconf('icon_dir').'/'.$icon.'.png'; 71 $size = getimagesize( PHPWG_ROOT_PATH.$icon_url ); 72 $icon_url = get_root_url().$icon_url; 73 $output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;'; 74 $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)" />'; 75 $page['get_icon_cache']['_icons_'][$key] = $output; 76 } 77 } 78 $page['get_icon_cache'][$date] = true; 79 } 80 if (! $page['get_icon_cache'][$date] ) 81 return ''; 82 return $page['get_icon_cache']['_icons_'][$is_child_date]; 83 } 84 77 85 78 86 function create_navigation_bar( … … 393 401 * HTML code generated uses logical list tags ul and each category is an 394 402 * item li. The paramter given is the category informations as an array, 395 * used keys are : id, name, nb_images, max_date_last, is_child_date_last,403 * used keys are : id, name, nb_images, max_date_last, date_last 396 404 * count_images, count_categories 397 405 * … … 474 482 $menu.= '</span>'; 475 483 } 476 477 $menu.= get_icon($category['max_date_last'], $category['is_child_date_last']); 484 $child_date_last = isset($category['date_last']) 485 and $category['max_date_last']>$category['date_last'] ; 486 $menu.= get_icon($category['max_date_last'], $child_date_last); 478 487 } 479 488 -
trunk/include/functions_user.inc.php
r1640 r1641 273 273 calculate_permissions($userdata['id'], $userdata['status']); 274 274 275 update_user_cache_categorie ($userdata['id'], $userdata['forbidden_categories']);275 update_user_cache_categories($userdata['id'], $userdata['forbidden_categories']); 276 276 277 277 // Set need update are done … … 450 450 /** 451 451 * compute data of categories branches 452 *453 * was internal function of update_user_cache_categorie454 * move to global because function be redeclare when it's internal455 452 */ 456 453 function compute_branch_cat_data(&$cats, &$list_cat_id, &$level, &$ref_level) … … 473 470 { 474 471 $cats[$cat_id]['max_date_last'] = $date; 475 $cats[$cat_id]['is_child_date_last'] = true;476 472 } 477 473 else … … 495 491 496 492 /** 497 * update data of user_cache_categorie 493 * update data of user_cache_categories 498 494 * 499 495 * @param int user_id 500 496 * @return null 501 497 */ 502 function update_user_cache_categorie ($user_id, $user_forbidden_categories)498 function update_user_cache_categories($user_id, $user_forbidden_categories) 503 499 { 504 500 // delete user cache 505 501 $query = ' 506 delete from'.USER_CACHE_CATEGORIES_TABLE.'507 whereuser_id = '.$user_id.'502 DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.' 503 WHERE user_id = '.$user_id.' 508 504 ;'; 509 505 pwg_query($query); 510 506 511 507 $query = ' 512 select 513 id cat_id, date_last, 514 nb_images, global_rank 515 from '.CATEGORIES_TABLE; 508 SELECT id cat_id, date_last max_date_last, nb_images count_images, global_rank 509 FROM '.CATEGORIES_TABLE; 516 510 if ($user_forbidden_categories != '') 517 511 { 518 512 $query.= ' 519 where id not in('.$user_forbidden_categories.')';513 WHERE id NOT IN ('.$user_forbidden_categories.')'; 520 514 } 521 515 $query.= ';'; … … 524 518 525 519 $cats = array(); 526 while ($row = mysql_fetch_array($result)) 527 { 520 while ($row = mysql_fetch_assoc($result)) 521 { 522 $row['user_id'] = $user_id; 523 $row['count_categories'] = 0; 528 524 $cats += array($row['cat_id'] => $row); 529 525 } … … 536 532 foreach ($cats as $id => $category) 537 533 { 538 // Update field539 $cats[$id]['user_id'] = $user_id;540 $cats[$id]['is_child_date_last'] = false;541 $cats[$id]['max_date_last'] = $cats[$id]['date_last'];542 $cats[$id]['count_images'] = $cats[$id]['nb_images'];543 $cats[$id]['count_categories'] = 0;544 545 534 // Compute 546 535 $level = substr_count($category['global_rank'], '.') + 1; … … 559 548 $level = 1; 560 549 compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level); 561 562 foreach ($cats as $id => $category)563 {564 // Convert field565 $cats[$id]['is_child_date_last'] = boolean_to_string($cats[$id]['is_child_date_last']);566 }567 550 568 551 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); … … 572 555 array 573 556 ( 574 'user_id', 'cat_id', 575 'is_child_date_last', 'max_date_last', 576 'count_images', 'count_categories' 557 'user_id', 'cat_id', 558 'max_date_last', 'count_images', 'count_categories' 577 559 ), 578 560 $cats … … 801 783 global $conf, $user; 802 784 803 if ($remember_me )785 if ($remember_me and $conf['authorize_remembering']) 804 786 { 805 787 $key = calculate_auto_login_key($user_id); -
trunk/install/phpwebgallery_structure.sql
r1624 r1641 298 298 `user_id` smallint(5) NOT NULL default '0', 299 299 `cat_id` smallint(5) unsigned NOT NULL default '0', 300 `is_child_date_last` enum('true','false') NOT NULL default 'false',301 300 `max_date_last` datetime default NULL, 302 301 `count_images` mediumint(8) unsigned default 0, -
trunk/template/yoga/menubar.css
r1625 r1641 50 50 #menubar .menuInfoCatByChild { 51 51 font-size: 80%; 52 font- weight: italic;52 font-style: italic; 53 53 } 54 54
Note: See TracChangeset
for help on using the changeset viewer.