Changeset 1086 for trunk/include/functions.inc.php
- Timestamp:
- Mar 17, 2006, 5:13:19 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r1084 r1086 224 224 $height = $original_height; 225 225 $is_original_size = true; 226 226 227 227 if ( $max_width != "" ) 228 228 { … … 250 250 { 251 251 if ( $ratioWidth < $ratioHeight ) 252 { 252 { 253 253 $width = floor( $original_width / $ratioHeight ); 254 254 $height = $max_height; 255 255 } 256 256 else 257 { 258 $width = $max_width; 257 { 258 $width = $max_width; 259 259 $height = floor( $original_height / $ratioWidth ); 260 260 } … … 331 331 $remaining ); 332 332 $return_string.= $treatment; 333 333 334 334 return $return_string; 335 335 } … … 341 341 // FIXME : with new advanced search, this function needs a rewrite 342 342 return $string; 343 343 344 344 $words = explode( ',', $search ); 345 345 $style = 'background-color:white;color:red;'; … … 360 360 $login = ($user['id'] == $conf['guest_id']) 361 361 ? 'guest' : addslashes($user['username']); 362 362 363 363 $query = ' 364 364 INSERT INTO '.HISTORY_TABLE.' … … 388 388 389 389 list($year,$month,$day,$hour,$minute,$second) = array(0,0,0,0,0,0); 390 390 391 391 switch ( $type ) 392 392 { … … 433 433 { 434 434 global $conf,$page,$debug,$t2; 435 435 436 436 $start = get_moment(); 437 437 $result = mysql_query($query) or my_error($query."\n"); 438 438 439 439 $time = get_moment() - $start; 440 440 … … 444 444 $page['queries_time'] = 0; 445 445 } 446 446 447 447 $page['count_queries']++; 448 448 $page['queries_time']+= $time; 449 449 450 450 if ($conf['show_queries']) 451 451 { … … 460 460 $output.= number_format( ($time+$start-$t2), 3, '.', ' ').' s)'; 461 461 $output.= "</pre>\n"; 462 462 463 463 $debug .= $output; 464 464 } 465 465 466 466 return $result; 467 467 } … … 501 501 502 502 include( PHPWG_ROOT_PATH.'include/page_header.php' ); 503 503 504 504 $template->set_filenames( array( 'redirect' => 'redirect.tpl' ) ); 505 505 $template->parse('redirect'); 506 506 507 507 include( PHPWG_ROOT_PATH.'include/page_tail.php' ); 508 508 … … 519 519 { 520 520 $query_string = ''; 521 521 522 522 $str = $_SERVER['QUERY_STRING']; 523 523 parse_str($str, $vars); 524 524 525 525 $is_first = true; 526 526 foreach ($vars as $key => $value) … … 554 554 555 555 $template_dir = PHPWG_ROOT_PATH.'template'; 556 556 557 557 foreach (get_dirs($template_dir) as $template) 558 558 { … … 596 596 $src.= strtolower(get_extension($path)).'.png'; 597 597 } 598 598 599 599 return $src; 600 600 } … … 623 623 { 624 624 $array = array(); 625 625 626 626 $result = pwg_query($query); 627 627 while ($row = mysql_fetch_array($result)) … … 642 642 { 643 643 global $template; 644 644 645 645 $template->assign_block_vars( 646 646 $blockname, array('SELECTED' => '', 'VALUE' => 0, 'OPTION' => '--')); 647 647 648 648 for ($i = 1; $i <= 31; $i++) 649 649 { … … 669 669 { 670 670 global $template, $lang; 671 671 672 672 $template->assign_block_vars( 673 673 $blockname, array('SELECTED' => '', … … 698 698 { 699 699 global $user; 700 700 701 701 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 702 702 703 703 $query = ' 704 704 SELECT element_id … … 750 750 echo '[l10n] language key "'.$key.'" is not defined<br />'; 751 751 } 752 752 753 753 return isset($lang[$key]) ? $lang[$key] : $key; 754 754 } … … 798 798 die('Search id must be an integer'); 799 799 } 800 800 801 801 $query = ' 802 802 SELECT rules … … 805 805 ;'; 806 806 list($serialized_rules) = mysql_fetch_row(pwg_query($query)); 807 807 808 808 return unserialize($serialized_rules); 809 809 } … … 821 821 { 822 822 $search = get_search_array($search_id); 823 823 824 824 // SQL where clauses are stored in $clauses array during query 825 825 // construction 826 826 $clauses = array(); 827 827 828 828 foreach (array('file','name','comment','keywords','author') as $textfield) 829 829 { … … 848 848 } 849 849 } 850 850 851 851 if (isset($search['fields']['allwords'])) 852 852 { … … 876 876 ); 877 877 } 878 878 879 879 array_walk( 880 880 $word_clauses, 881 881 create_function('&$s','$s="(".$s.")";') 882 882 ); 883 883 884 884 array_push( 885 885 $clauses, … … 893 893 ); 894 894 } 895 895 896 896 foreach (array('date_available', 'date_creation') as $datefield) 897 897 { … … 903 903 ); 904 904 } 905 905 906 906 foreach (array('after','before') as $suffix) 907 907 { 908 908 $key = $datefield.'-'.$suffix; 909 909 910 910 if (isset($search['fields'][$key])) 911 911 { 912 912 array_push( 913 913 $clauses, 914 914 915 915 $datefield. 916 916 ($suffix == 'after' ? ' >' : ' <'). 917 917 ($search['fields'][$key]['inc'] ? '=' : ''). 918 918 " '".$search['fields'][$key]['date']."'" 919 919 920 920 ); 921 921 } 922 922 } 923 923 } 924 924 925 925 if (isset($search['fields']['cat'])) 926 926 { … … 934 934 $cat_ids = $search['fields']['cat']['words']; 935 935 } 936 936 937 937 $local_clause = 'category_id IN ('.implode(',', $cat_ids).')'; 938 938 array_push($clauses, $local_clause); 939 939 } 940 940 941 941 // adds brackets around where clauses 942 942 $clauses = prepend_append_array_items($clauses, '(', ')'); 943 943 944 944 $where_separator = 945 945 implode( … … 947 947 $clauses 948 948 ); 949 949 950 950 $search_clause = $where_separator; 951 951 952 952 if (isset($forbidden)) 953 953 { … … 987 987 988 988 $available_upgrade_ids = array(); 989 989 990 990 if ($contents = opendir($upgrades_path)) 991 991 { … … 1016 1016 .'/'.make_section_in_URL($params) 1017 1017 ; 1018 1019 if (isset($params['start']) and $params['start'] > 0) 1020 { 1021 $url.= '/start-'.$params['start']; 1022 } 1018 1019 $url = add_well_known_params_in_url($url, $params); 1023 1020 1024 1021 return $url; … … 1107 1104 die('make_picture_URL: image_id is a required parameter'); 1108 1105 } 1109 1106 1110 1107 $url = 1111 1108 PHPWG_ROOT_PATH.'picture.php?' … … 1114 1111 ; 1115 1112 1116 // first comment to start on 1113 $url = add_well_known_params_in_url($url, $params); 1114 return $url; 1115 } 1116 1117 /** 1118 *adds to the url the chronology and start parameters 1119 */ 1120 function add_well_known_params_in_url($url, $params) 1121 { 1122 if ( isset($params['chronology']) ) 1123 { 1124 $url .= '/'. $params['chronology']['field']; 1125 $url .= '-'. $params['chronology']['style']; 1126 if ( isset($params['chronology']['view']) ) 1127 { 1128 $url .= '-'. $params['chronology']['view']; 1129 } 1130 if ( isset($params['chronology_date']) ) 1131 { 1132 $url .= '-'. implode('-', $params['chronology_date'] ); 1133 } 1134 } 1135 1117 1136 if (isset($params['start']) and $params['start'] > 0) 1118 1137 { 1119 1138 $url.= '/start-'.$params['start']; 1120 1139 } 1121 1122 1140 return $url; 1123 1141 } … … 1135 1153 { 1136 1154 $section_string = ''; 1137 1155 1138 1156 if (!isset($params['section'])) 1139 1157 { … … 1160 1178 $params['section'] = 'categories'; 1161 1179 } 1162 1180 1163 1181 switch($params['section']) 1164 1182 { … … 1173 1191 $section_string.= 'category/'.$params['category']; 1174 1192 } 1175 1193 1176 1194 break; 1177 1195 } … … 1189 1207 $section_string.= '/'.$tag; 1190 1208 } 1191 1209 1192 1210 break; 1193 1211 } … … 1198 1216 die('make_section_in_URL: require a search identifier'); 1199 1217 } 1200 1218 1201 1219 $section_string.= 'search/'.$params['search']; 1202 1220 … … 1211 1229 1212 1230 $section_string.= 'list/'.implode(',', $params['list']); 1213 1231 1214 1232 break; 1215 1233 }
Note: See TracChangeset
for help on using the changeset viewer.