Changeset 216
- Timestamp:
- 06/12/03 22:45:08 (5 years ago)
- Files:
-
- trunk/b2-include/b2functions.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/b2-include/b2functions.php
r203 r216 1 1 <?php 2 3 /* new and improved ! now with more querystring stuff ! */4 5 if (!isset($querystring_start)) {6 $querystring_start = '?';7 $querystring_equal = '=';8 $querystring_separator = '&';9 }10 2 11 3 if (!function_exists('_')) { … … 482 474 global $tablesettings, $wpdb, $cache_settings, $use_cache, $querycount; 483 475 if ((empty($cache_settings)) OR (!$use_cache)) { 484 $settings = $wpdb->get_row("SELECT * FROM $tablesettings"); 485 ++$querycount; 476 $settings = get_alloptions(); 486 477 $cache_settings = $settings; 487 478 } else { 488 479 $settings = $cache_settings; 489 480 } 481 if (!isset($settings->$setting)) { 482 error_log("get_settings: Didn't find setting $setting"); 483 } 490 484 return $settings->$setting; 491 485 } 492 486 487 function get_alloptions() { 488 global $tableoptions, $wpdb; 489 $options = $wpdb->get_results("SELECT option_name, option_value FROM $tableoptions"); 490 ++$querycount; 491 if ($options) { 492 foreach ($options as $option) { 493 $all_options->{$option->option_name} = $option->option_value; 494 } 495 } 496 return $all_options; 497 } 498 493 499 function get_postdata($postid) { 494 500 global $tableusers, $tablesettings, $tablecategories, $tableposts, $tablecomments, $querycount, $wpdb; … … 577 583 } 578 584 579 function dropdown_categories($blog_ID=1 ) {585 function dropdown_categories($blog_ID=1, $default=1) { 580 586 global $postdata,$tablecategories,$mode,$querycount; 581 587 $query="SELECT * FROM $tablecategories"; … … 584 590 $width = ($mode=="sidebar") ? "100%" : "170px"; 585 591 echo '<select name="post_category" style="width:'.$width.';" tabindex="2" id="category">'; 592 if ($postdata["Category"] != '') { 593 $default = $postdata["Category"]; 594 } 586 595 while($post = mysql_fetch_object($result)) { 587 596 echo "<option value=\"".$post->cat_ID."\""; 588 if ($post->cat_ID == $ postdata["Category"])597 if ($post->cat_ID == $default) 589 598 echo " selected"; 590 599 echo ">".$post->cat_name."</option>"; … … 703 712 // ( or just any time between timer_start() and timer_stop() ) 704 713 705 function timer_start() {706 global $timestart;707 $mtime = microtime();708 $mtime = explode(" ",$mtime);709 $mtime = $mtime[1] + $mtime[0];710 $timestart = $mtime;711 return true;712 }713 714 function timer_stop($display=0,$precision=3) { //if called like timer_stop(1), will echo $timetotal715 global $timestart,$timeend;716 $mtime = microtime();717 $mtime = explode(" ",$mtime);718 $mtime = $mtime[1] + $mtime[0];719 $timeend = $mtime;720 $timetotal = $timeend-$timestart;721 if ($display)722 echo number_format($timetotal,$precision);723 return $timetotal;724 }714 function timer_start() { 715 global $timestart; 716 $mtime = microtime(); 717 $mtime = explode(" ",$mtime); 718 $mtime = $mtime[1] + $mtime[0]; 719 $timestart = $mtime; 720 return true; 721 } 722 723 function timer_stop($display=0,$precision=3) { //if called like timer_stop(1), will echo $timetotal 724 global $timestart,$timeend; 725 $mtime = microtime(); 726 $mtime = explode(" ",$mtime); 727 $mtime = $mtime[1] + $mtime[0]; 728 $timeend = $mtime; 729 $timetotal = $timeend-$timestart; 730 if ($display) 731 echo number_format($timetotal,$precision); 732 return $timetotal; 733 } 725 734 726 735
