Changeset 3126 for trunk/include
- Timestamp:
- Feb 5, 2009, 4:03:30 AM (16 years ago)
- Location:
- trunk/include
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_default.inc.php
r3124 r3126 28 28 */ 29 29 30 $page['rank_of'] = array_flip($page['items']);31 32 30 $pictures = array(); 33 31 … … 40 38 if (count($selection) > 0) 41 39 { 40 $rank_of = array_flip($page['items']); 41 42 42 $query = ' 43 43 SELECT * … … 54 54 55 55 usort($pictures, 'rank_compare'); 56 unset($rank_of); 56 57 } 57 58 -
trunk/include/common.inc.php
r3049 r3126 234 234 // default event handlers 235 235 add_event_handler('render_category_literal_description', 'render_category_literal_description'); 236 add_event_handler('render_category_description', 'render_category_description'); 236 if ( !$conf['allow_html_descriptions'] ) 237 { 238 add_event_handler('render_category_description', 'nl2br'); 239 } 237 240 add_event_handler('render_comment_content', 'htmlspecialchars'); 238 241 add_event_handler('render_comment_content', 'parse_comment_content'); -
trunk/include/functions_html.inc.php
r3049 r3126 24 24 function get_icon($date, $is_child_date = false) 25 25 { 26 global $ page, $user;26 global $cache, $user; 27 27 28 28 if (empty($date)) … … 31 31 } 32 32 33 if (isset($ page['get_icon_cache'][$date]))34 { 35 if (! $ page['get_icon_cache'][$date] )33 if (isset($cache['get_icon'][$date])) 34 { 35 if (! $cache['get_icon'][$date] ) 36 36 return ''; 37 return $ page['get_icon_cache']['_icons_'][$is_child_date];38 } 39 40 if (!isset($ page['get_icon_cache']['sql_recent_date']))37 return $cache['get_icon']['_icons_'][$is_child_date]; 38 } 39 40 if (!isset($cache['get_icon']['sql_recent_date'])) 41 41 { 42 42 // Use MySql date in order to standardize all recent "actions/queries" 43 list($ page['get_icon_cache']['sql_recent_date']) =43 list($cache['get_icon']['sql_recent_date']) = 44 44 mysql_fetch_array(pwg_query('select SUBDATE( 45 45 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)')); 46 46 } 47 47 48 $ page['get_icon_cache'][$date] = false;49 if ( $date > $ page['get_icon_cache']['sql_recent_date'] )50 { 51 if ( !isset($ page['get_icon_cache']['_icons_'] ) )48 $cache['get_icon'][$date] = false; 49 if ( $date > $cache['get_icon']['sql_recent_date'] ) 50 { 51 if ( !isset($cache['get_icon']['_icons_'] ) ) 52 52 { 53 53 $icons = array(false => 'recent', true => 'recent_by_child' ); … … 63 63 $output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;'; 64 64 $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)" />'; 65 $ page['get_icon_cache']['_icons_'][$key] = $output;65 $cache['get_icon']['_icons_'][$key] = $output; 66 66 } 67 67 } 68 $ page['get_icon_cache'][$date] = true;69 } 70 71 if (! $ page['get_icon_cache'][$date] )68 $cache['get_icon'][$date] = true; 69 } 70 71 if (! $cache['get_icon'][$date] ) 72 72 return ''; 73 return $ page['get_icon_cache']['_icons_'][$is_child_date];73 return $cache['get_icon']['_icons_'][$is_child_date]; 74 74 } 75 75 … … 777 777 } 778 778 779 /** returns the category comment for rendering in html.780 * this is an event handler. don't call directly781 */782 function render_category_description($desc)783 {784 global $conf;785 if ( !$conf['allow_html_descriptions'] )786 {787 $desc = nl2br($desc);788 }789 return $desc;790 }791 792 779 /** returns the category comment for rendering in html textual mode (subcatify) 793 780 * this is an event handler. don't call directly -
trunk/include/functions_url.inc.php
r3049 r3126 39 39 $root_url = PHPWG_ROOT_PATH; 40 40 } 41 if ( dirname($root_url)!='.')41 if ( strncmp($root_url, './', 2) != 0 ) 42 42 { 43 43 return $root_url; … … 171 171 global $page; 172 172 173 if (count($removed) > 0) 174 { 175 $params = array(); 176 177 foreach ($page as $page_item_key => $page_item_value) 178 { 179 if (!in_array($page_item_key, $removed)) 180 { 181 $params[$page_item_key] = $page_item_value; 182 } 183 } 184 } 185 else 186 { 187 $params = $page; 173 $params = $page; 174 175 foreach ($removed as $param_key) 176 { 177 unset($params[$param_key]); 188 178 } 189 179 … … 723 713 function embellish_url($url) 724 714 { 725 return str_replace('/./', '/', $url); 715 $url = str_replace('/./', '/', $url); 716 while ( ($dotdot = strpos($url, '/../', 1) ) !== false ) 717 { 718 $before = strrpos($url, '/', -(strlen($url)-$dotdot+1) ); 719 if ($before !== false) 720 { 721 $url = substr_replace($url, '', $before, $dotdot-$before+3); 722 } 723 else 724 break; 725 } 726 return $url; 726 727 } 727 728 -
trunk/include/functions_user.inc.php
r3049 r3126 761 761 function get_default_user_info($convert_str = true) 762 762 { 763 global $ page, $conf;764 765 if (!isset($ page['cache_default_user']))766 { 767 $query = ' select * from'.USER_INFOS_TABLE.768 ' whereuser_id = '.$conf['default_user_id'].';';763 global $cache, $conf; 764 765 if (!isset($cache['default_user'])) 766 { 767 $query = 'SELECT * FROM '.USER_INFOS_TABLE. 768 ' WHERE user_id = '.$conf['default_user_id'].';'; 769 769 770 770 $result = pwg_query($query); 771 $ page['cache_default_user'] = mysql_fetch_assoc($result);772 773 if ($ page['cache_default_user'] !== false)774 { 775 unset($ page['cache_default_user']['user_id']);776 unset($ page['cache_default_user']['status']);777 unset($ page['cache_default_user']['registration_date']);778 } 779 } 780 781 if (is_array($ page['cache_default_user']) and $convert_str)771 $cache['default_user'] = mysql_fetch_assoc($result); 772 773 if ($cache['default_user'] !== false) 774 { 775 unset($cache['default_user']['user_id']); 776 unset($cache['default_user']['status']); 777 unset($cache['default_user']['registration_date']); 778 } 779 } 780 781 if (is_array($cache['default_user']) and $convert_str) 782 782 { 783 783 $default_user = array(); 784 foreach ($ page['cache_default_user'] as $name => $value)784 foreach ($cache['default_user'] as $name => $value) 785 785 { 786 786 // If the field is true or false, the variable is transformed into a … … 799 799 else 800 800 { 801 return $ page['cache_default_user'];801 return $cache['default_user']; 802 802 } 803 803 }
Note: See TracChangeset
for help on using the changeset viewer.