Changeset 2409
- Timestamp:
- Jul 1, 2008, 4:09:21 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/element_set_global.php
r2299 r2409 276 276 // remove tags 277 277 $tags = get_common_tags($page['cat_elements_id'], -1); 278 usort($tags, 'name_compare');279 278 280 279 $template->assign( -
trunk/include/functions_html.inc.php
r2353 r2409 551 551 } 552 552 553 function tag_alpha_compare($a, $b) 554 { 555 return strcmp(strtolower($a['url_name']), strtolower($b['url_name'])); 556 } 557 553 558 /** 554 559 * exits the current script (either exit or redirect) … … 733 738 } 734 739 735 /** returns the argument_ids array with new sequenced keys based on related 740 /** returns the argument_ids array with new sequenced keys based on related 736 741 * names. Sequence is not case sensitive. 737 742 * Warning: By definition, this function breaks original keys -
trunk/include/functions_tag.inc.php
r2308 r2409 60 60 61 61 $query = ' 62 SELECT id, name, url_name62 SELECT * 63 63 FROM '.TAGS_TABLE; 64 64 $result = pwg_query($query); … … 84 84 { 85 85 $query = ' 86 SELECT id, 87 name, 88 url_name 86 SELECT * 89 87 FROM '.TAGS_TABLE.' 90 88 ;'; … … 96 94 } 97 95 98 usort($tags, ' name_compare');96 usort($tags, 'tag_alpha_compare'); 99 97 100 98 return $tags; … … 228 226 } 229 227 $query = ' 230 SELECT id, name, url_name, count(*) counter228 SELECT t.*, count(*) counter 231 229 FROM '.IMAGE_TAG_TABLE.' 232 INNER JOIN '.TAGS_TABLE.' ON tag_id = id230 INNER JOIN '.TAGS_TABLE.' t ON tag_id = id 233 231 WHERE image_id IN ('.implode(',', $items).')'; 234 232 if (!empty($excluded_tag_ids)) … … 257 255 array_push($tags, $row); 258 256 } 259 usort($tags, ' name_compare');257 usort($tags, 'tag_alpha_compare'); 260 258 return $tags; 261 259 } … … 308 306 309 307 $query = ' 310 SELECT id, url_name, name308 SELECT * 311 309 FROM '.TAGS_TABLE.' 312 310 WHERE '. implode( ' -
trunk/include/functions_user.inc.php
r2371 r2409 839 839 function get_default_language() 840 840 { 841 global $conf; 842 if (isset($conf['browser_language']) and $conf['browser_language']) 843 { 844 return get_browser_language(); 845 } 846 else 847 { 848 return get_default_user_value('language', PHPWG_DEFAULT_LANGUAGE); 849 } 850 } 851 852 /* 853 * Returns the browser language value 854 * 855 */ 856 function get_browser_language() 857 { 858 $browser_language = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); 859 foreach (get_languages() as $language_code => $language_name) 860 { 861 if (substr($language_code, 0, 2) == $browser_language) 862 { 863 return $language_code; 864 } 865 } 866 return PHPWG_DEFAULT_LANGUAGE; 841 return get_default_user_value('language', PHPWG_DEFAULT_LANGUAGE); 867 842 } 868 843 … … 924 899 $status = 'normal'; 925 900 } 926 $default_user['language'] = get_default_language();927 901 928 902 $insert = array_merge( … … 975 949 * returns the auto login key or false on error 976 950 * @param int user_id 951 * @param time_t time 977 952 * @param string [out] username 978 953 */ 979 function calculate_auto_login_key($user_id, &$username)954 function calculate_auto_login_key($user_id, $time, &$username) 980 955 { 981 956 global $conf; … … 990 965 $row = mysql_fetch_assoc($result); 991 966 $username = $row['username']; 992 $data = $ row['username'].$row['password'];967 $data = $time.$row['username'].$row['password']; 993 968 $key = base64_encode( 994 969 pack('H*', sha1($data)) … … 1012 987 if ($remember_me and $conf['authorize_remembering']) 1013 988 { 1014 $key = calculate_auto_login_key($user_id, $username); 989 $now = time(); 990 $key = calculate_auto_login_key($user_id, $now, $username); 1015 991 if ($key!==false) 1016 992 { 1017 $cookie = array('id' => (int)$user_id, 'key' => $key);993 $cookie = $user_id.'-'.$now.'-'.$key; 1018 994 setcookie($conf['remember_me_name'], 1019 serialize($cookie),995 $cookie, 1020 996 time()+$conf['remember_me_length'], 1021 997 cookie_path() … … 1050 1026 if ( isset( $_COOKIE[$conf['remember_me_name']] ) ) 1051 1027 { 1052 $cookie = unserialize(stripslashes($_COOKIE[$conf['remember_me_name']])); 1053 if ($cookie!==false and is_numeric(@$cookie['id']) ) 1054 { 1055 $key = calculate_auto_login_key( $cookie['id'], $username ); 1056 if ($key!==false and $key===$cookie['key']) 1057 { 1058 log_user($cookie['id'], true); 1028 $cookie = explode('-', stripslashes($_COOKIE[$conf['remember_me_name']])); 1029 if ( count($cookie)===3 1030 and is_numeric(@$cookie[0]) /*user id*/ 1031 and is_numeric(@$cookie[1]) /*time*/ 1032 and time()-$conf['remember_me_length']<=@$cookie[1] 1033 and time()>=@$cookie[1] /*cookie generated in the past*/ ) 1034 { 1035 $key = calculate_auto_login_key( $cookie[0], $cookie[1], $username ); 1036 if ($key!==false and $key===$cookie[2]) 1037 { 1038 log_user($cookie[0], true); 1059 1039 trigger_action('login_success', $username); 1060 1040 return true; -
trunk/include/menubar.inc.php
r2325 r2409 112 112 $template->append( 113 113 'related_tags', 114 array( 115 'U_TAG' => make_index_url( 116 array( 117 'tags' => array($tag) 118 ) 119 ), 120 121 'NAME' => $tag['name'], 122 123 'CLASS' => 'tagLevel'.$tag['level'], 124 125 'add' => array( 126 127 'URL' => make_index_url( 128 array( 129 'tags' => array_merge( 130 $page['tags'], 131 array($tag) 114 array_merge( $tag, 115 array( 116 'URL' => make_index_url( 117 array( 118 'tags' => array($tag) 119 ) 120 ), 121 122 'U_ADD' => make_index_url( 123 array( 124 'tags' => array_merge( 125 $page['tags'], 126 array($tag) 127 ) 132 128 ) 133 ) 134 ), 135 'COUNTER' => $tag['counter'], 136 ) 129 ), 130 ) 137 131 ) 138 132 ); -
trunk/include/ws_functions.inc.php
r2356 r2409 890 890 else 891 891 { 892 usort($tags, ' name_compare');892 usort($tags, 'tag_alpha_compare'); 893 893 } 894 894 for ($i=0; $i<count($tags); $i++) -
trunk/search.php
r2324 r2409 187 187 if (count($available_tags) > 0) 188 188 { 189 usort( $available_tags, ' name_compare');189 usort( $available_tags, 'tag_alpha_compare'); 190 190 191 191 $template->assign( -
trunk/tags.php
r2362 r2409 85 85 if ($page['display_mode'] == 'letters') { 86 86 // we want tags diplayed in alphabetic order 87 usort($tags, ' name_compare');87 usort($tags, 'tag_alpha_compare'); 88 88 89 89 $current_letter = null; 90 $is_first_tag = true;91 90 $nb_tags = count($tags); 92 $current_column_tags = 0; 91 $current_column = 1; 92 $current_tag_idx = 0; 93 93 94 94 $letter = array( … … 98 98 foreach ($tags as $tag) 99 99 { 100 $tag_letter = strtoupper(substr($tag[' name'], 0, 1));100 $tag_letter = strtoupper(substr($tag['url_name'], 0, 1)); 101 101 102 if ($ is_first_tag) {102 if ($current_tag_idx==0) { 103 103 $current_letter = $tag_letter; 104 104 $letter['TITLE'] = $tag_letter; 105 $is_first_tag = false;106 105 } 107 106 … … 109 108 if ($tag_letter !== $current_letter) 110 109 { 111 if ($current_column_tags > $nb_tags/$conf['tag_letters_column_number']) 110 if ($current_column<$conf['tag_letters_column_number'] 111 and $current_tag_idx > $current_column*$nb_tags/$conf['tag_letters_column_number'] ) 112 112 { 113 113 $letter['CHANGE_COLUMN'] = true; 114 $current_column _tags = 0;114 $current_column++; 115 115 } 116 116 … … 121 121 $letter 122 122 ); 123 123 124 124 $current_letter = $tag_letter; 125 125 $letter = array( … … 130 130 array_push( 131 131 $letter['tags'], 132 array( 133 'URL' => make_index_url( 134 array( 135 'tags' => array($tag), 136 ) 137 ), 138 'NAME' => $tag['name'], 139 'COUNTER' => $tag['counter'], 132 array_merge( 133 $tag, 134 array( 135 'URL' => make_index_url( 136 array( 137 'tags' => array($tag), 138 ) 139 ), 140 ) 140 141 ) 141 142 ); 142 143 $current_ column_tags++;143 144 $current_tag_idx++; 144 145 } 145 146 … … 169 170 170 171 // we want tags diplayed in alphabetic order 171 usort($tags, ' name_compare');172 usort($tags, 'tag_alpha_compare'); 172 173 173 174 // display sorted tags … … 176 177 $template->append( 177 178 'tags', 178 array( 179 'URL' => make_index_url( 180 array( 181 'tags' => array($tag), 182 ) 183 ), 184 185 'NAME' => $tag['name'], 186 'TITLE' => $tag['counter'], 187 'CLASS' => 'tagLevel'.$tag['level'], 179 array_merge( 180 $tag, 181 array( 182 'URL' => make_index_url( 183 array( 184 'tags' => array($tag), 185 ) 186 ), 187 ) 188 188 ) 189 189 ); -
trunk/template/yoga/menubar.css
r2356 r2409 1 1 #menubar { 2 float: left; 3 margin: 0 0 10px 1em; 4 padding: 0; 5 /* Fix against the "double margin of a floated item" IE bug */ 6 /* Damned: that screws up top_navbar in opera 7.54/Linux! */ 7 display: inline; 8 text-align: left; /* follow-up of the "be nice to IE5" rule */ 2 float: left; 3 margin: 0 0 10px 1em; 4 padding: 0; 5 display: inline; 6 text-align: left; /* follow-up of the "be nice to IE5" rule */ 9 7 } 10 8 11 9 #menubar DL, #menubar DT, #menubar DD { 12 10 margin: 0; padding: 0; display: block; 13 11 } 14 12 15 13 #menubar .button { 16 17 18 19 20 21 22 14 margin: 0 2px; 15 width: auto; 16 padding: 0; 17 text-indent: 0; 18 list-style: none; 19 text-align: center; 20 float: right; 23 21 } 24 22 25 23 /* H2 properties copied here */ 26 24 #menubar DT { 27 font-weight: bold; /* default for h2 */ 28 29 30 31 25 font-weight: bold; 26 margin: 0; 27 padding: 5px 5px 5px 5px; 28 font-size: 120%; 29 text-align: center; 32 30 } 33 31 … … 37 35 #menubar P, /* ooh, careful... */ 38 36 #menubar .totalImages { 39 40 37 font-size: 92%; 38 margin: 10px 0 10px 10px; 41 39 } 42 40 #menubar UL { 43 44 45 41 list-style-type: square; 42 list-style-position: inside; 43 padding: 0 0 0 2px; 46 44 } 47 45 #menubar UL UL { 48 49 50 46 font-size: 100%; 47 margin-top: 0; 48 margin-bottom: 0; 51 49 } 52 50 53 51 #menubar LI.selected A { 54 52 font-weight: bold; 55 53 } 56 54 57 55 #menubar LI.selected LI A { 58 56 font-weight: normal; 59 57 } 60 58 … … 65 63 66 64 #menubar HR { 67 68 69 65 display: block; 66 margin: 10px auto; 67 width: 90%; 70 68 } 71 69 #menubar INPUT { 72 70 text-indent: 2px; 73 71 } 74 72 75 73 /* quickconnect form */ 76 74 FORM#quickconnect { 77 78 75 margin: 0; 76 padding: 5px; 79 77 } 80 78 81 79 FORM#quickconnect FIELDSET { 82 83 80 margin: 0; 81 padding: 0 0 0.5em 0; 84 82 } 85 83 86 84 FORM#quickconnect P { 87 88 89 90 85 margin-left: 0; 86 font-size: 100%; 87 float: left; 88 clear: left; 91 89 } 92 90 93 91 FORM#quickconnect P INPUT { 94 92 margin: 0; 95 93 } 96 94 97 95 FORM#quickconnect UL.actions { 98 99 100 101 96 display: inline; 97 float: right; 98 padding: 0; 99 text-align: right; /* Opera 7.5 */ 102 100 } 103 101 FORM#quickconnect FIELDSET>UL.actions { 104 102 width: 40%; /* Opera 7.5 cannot find why width:auto fails :-( */ 105 103 } 106 104 … … 108 106 FORM#quickconnect P, 109 107 FORM#quickconnect LABEL { 110 108 padding: 0 0.5em 0 0.5em; 111 109 } 112 110 113 111 FORM#quickconnect LABEL { 114 115 116 112 margin:0; 113 width: 100%; 114 box-sizing: border-box; /* CSS3 */ 117 115 } 118 116 119 117 FORM#quickconnect INPUT[type=text], 120 118 FORM#quickconnect INPUT[type=password] { 121 119 width: 100%; /* mozilla can handle 100% */ 122 120 } 123 /* same as above for IE with inputfix.htc */124 /* unfortunately IE doesn't handle that correctly */ 125 /*so you should set a width in em in local_layout.css */121 /* same as above for IE with inputfix.htc 122 unfortunately IE doesn't handle that correctly 123 so you should set a width in em in local_layout.css */ 126 124 /*FORM#quickconnect INPUT.text, 127 125 FORM#quickconnect INPUT.password { … … 130 128 131 129 FORM#quicksearch { 132 133 130 margin-top: 4px; 131 margin-bottom: 1px; 134 132 } 135 input#qsearchInput { 136 133 INPUT#qsearchInput { 134 width: 90%; 137 135 } 138 136 #menubar #mbMenu p { margin: 0px; padding: 0px; } 139 137 140 138 #menubar #menuTagCloud { 141 142 139 text-align: center; 140 margin: 5px 0; 143 141 } 144 142 145 143 #menubar #menuTagCloud LI 146 144 { 147 148 145 display: inline; 146 white-space: nowrap; /* No line break in the LI but Opera set nowrap to */ 149 147 } -
trunk/template/yoga/menubar.tpl
r2325 r2409 22 22 23 23 {if isset($U_START_FILTER)} 24 <a href="{$U_START_FILTER}" title="{'start_filter_hint'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/start_filter.png" class="button" alt=" {'start_filter_hint'|@translate}"></a>24 <a href="{$U_START_FILTER}" title="{'start_filter_hint'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/start_filter.png" class="button" alt="start filter"></a> 25 25 {/if} 26 26 {if isset($U_STOP_FILTER)} 27 <a href="{$U_STOP_FILTER}" title="{'stop_filter_hint'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/stop_filter.png" class="button" alt=" {'stop_filter_hint'|@translate}"></a>27 <a href="{$U_STOP_FILTER}" title="{'stop_filter_hint'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/stop_filter.png" class="button" alt="stop filter"></a> 28 28 {/if} 29 29 … … 49 49 {foreach from=$related_tags item=tag} 50 50 <li> 51 {if !empty($tag. add) }52 <a href="{$tag. add.URL}"53 title="{$pwg->l10n_dec('%d element are also linked to current tags', '%d elements are also linked to current tags', $tag. add.COUNTER)}"51 {if !empty($tag.U_ADD) } 52 <a href="{$tag.U_ADD}" 53 title="{$pwg->l10n_dec('%d element are also linked to current tags', '%d elements are also linked to current tags', $tag.counter)}" 54 54 rel="nofollow"> 55 55 <img src="{$ROOT_URL}{$themeconf.icon_dir}/add_tag.png" alt="+" /> 56 56 </a> 57 57 {/if} 58 <a href="{$tag.U _TAG}" class="{$tag.CLASS}" title="{'See elements linked to this tag only'|@translate}">{$tag.NAME}</a>58 <a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{'See elements linked to this tag only'|@translate}">{$tag.name}</a> 59 59 </li> 60 60 {/foreach} -
trunk/template/yoga/tags.tpl
r2396 r2409 21 21 <ul id="fullTagCloud"> 22 22 {foreach from=$tags item=tag} 23 <li><a href="{$tag.URL}" class=" {$tag.CLASS}" title="{$tag.TITLE}">{$tag.NAME}</a></li>23 <li><a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{$tag.counter}">{$tag.name}</a></li> 24 24 {/foreach} 25 25 </ul> … … 36 36 {foreach from=$letter.tags item=tag} 37 37 <tr class="tagLine"> 38 <td><a href="{$tag.URL}">{$tag. NAME}</a></td>39 <td class="nbEntries">{$pwg->l10n_dec('%d element', '%d elements', $tag. COUNTER)}</td>38 <td><a href="{$tag.URL}">{$tag.name}</a></td> 39 <td class="nbEntries">{$pwg->l10n_dec('%d element', '%d elements', $tag.counter)}</td> 40 40 </tr> 41 41 {/foreach}
Note: See TracChangeset
for help on using the changeset viewer.