- Timestamp:
- 04/17/06 14:48:59 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/comment-registration/common/functions_blog.php
r147 r149 89 89 } 90 90 /* }}} */ 91 92 91 /* html_header: {{{ */ 93 92 /** … … 140 139 } 141 140 /* }}} */ 142 143 141 /* html_footer() {{{ */ 144 142 /** … … 158 156 } 159 157 /* }}} */ 160 161 /* show_article($iid) {{{ */ 158 /* show_article($id) {{{ */ 162 159 /** 163 160 * Show an article with all comments etc … … 302 299 } 303 300 /* }}} */ 304 //{{{ blog_get_description(): get the description from settings table 305 //------------------------------------------------------------------- 301 /* blog_get_description() {{{ */ 302 /** 303 * Get blogsetting description from database 304 * 305 * @return string The blogdescription 306 */ 306 307 function blog_get_description() { 307 308 $res =& $GLOBALS["db"]->query("SELECT settingvalue FROM settings WHERE settingname='blogdescription'"); … … 314 315 return $pagedescription; 315 316 } 316 317 //}}}----------------------------------------------------------------------------- 318 //{{{ blog_get_title(): get the blog title. return title or "blog" if no title set 319 //-------------------------------------------------------------------------------- 317 /* }}} */ 318 /* blog_get_title() {{{ */ 319 /** 320 * get the blog title. 321 * 322 * @return string title or "blog" if no title set 323 */ 320 324 function blog_get_title() { 321 325 $sql = "SELECT settingvalue FROM settings WHERE settingname='blogtitle'"; … … 329 333 return $title; 330 334 } 331 332 //}}}------------------------------------------------------------- 333 //{{{ blog_show_menulinks(): get usersupplied sidebar menu entries 334 //---------------------------------------------------------------- 335 /* }}} */ 336 /* blog_show_menulinks() {{{ */ 337 /** 338 * get usersupplied sidebar menu entries 339 */ 335 340 function blog_show_menulinks() { 336 341 $res =& $GLOBALS["db"]->query("SELECT * FROM menulinks ORDER BY sortorder,linktitle"); … … 347 352 } 348 353 } 349 350 //}}}----------------------------------------------------- 351 //{{{ blog_show_styleswitcher(): show dropdown with styles 352 //-------------------------------------------------------- 354 /* }}} */ 355 /* blog_show_styleswitcher() {{{ */ 356 /** 357 * show dropdown with styles 358 * 359 * This function opens the dir styles/ 360 * for every dir in there that contains a file index.css 361 * it puts the dirname in the dropdown. It also has an onchange 362 * javascript function attached so it will reload the blog with the new 363 * style applied. 364 * 365 * @return bool false if the styledir cannot be opened 366 */ 353 367 function blog_show_styleswitcher() { 354 368 if ($dh = opendir("style")) { … … 373 387 } 374 388 } 375 376 //}}}---------------------------------------------------------------------------------------------- 377 //{{{ blog_content($start, $limit): main function to give user correct html depending on action etc 378 //------------------------------------------------------------------------------------------------- 389 /* }}} */ 390 /* blog_content($start, $limit) {{{ */ 391 /** 392 * main function to give user correct html depending on action etc 393 * 394 * @param int (optional) Start entry in recordset 395 * @param int (optional) Number of records to show 396 */ 379 397 function blog_content($start=0, $limit=0) { 380 398 /* get limit from database, when no limit given by function call */ … … 409 427 } 410 428 } 411 412 //}}}---------------------------------------------- 413 //{{{ blog_default_links(): show default menu links 414 //------------------------------------------------- 429 /* }}} */ 430 /* blog_default_links() {{{ */ 431 /** 432 * show default menu links 433 */ 415 434 function blog_default_links() { 416 435 ?> … … 426 445 } 427 446 428 //}}}------------------------------------------------------- 429 //{{{ blog_archive_links($amount): show 'archive' menu links 430 //---------------------------------------------------------- 447 /* }}} */ 448 /* blog_archive_links($amount) {{{ */ 449 /** 450 * show 'month archive' menu links 451 * 452 * @param int The number of months to show 453 */ 431 454 function blog_archive_links($amount=5) { 432 455 global $db; … … 449 472 ?></ul><? 450 473 } 451 452 //}}}-------------------------------------------------------- 453 //{{{ blog_cats_links(): show 'categories' archive menu links 454 //----------------------------------------------------------- 474 /* }}} */ 475 /* blog_cats_links() {{{ */ 476 /** 477 * show 'categories' archive menu links 478 * 479 * @param int if set to 1 it will sort on the second letter instead of the first ;-) 480 */ 455 481 function blog_cats_links($easter_eggie=0) { 456 482 global $db; … … 496 522 ?></ul><? 497 523 } 498 499 //}}}-------------------------------------------------------------------------------------- 500 //{{{ post_comment($postdata): store comment in database and optionally mail author of post 501 //----------------------------------------------------------------------------------------- 524 /* }}} */ 525 /* post_comment($postdata) {{{ */ 526 /** 527 * store comment in database and optionally mail author of post 528 * 529 * If the user checked the 'mail' box in the admin this 530 * function will also send a mail to the author of the post. 531 * 532 * @todo Make a user database for commenting. 533 * @param array postdata, content of the comment entry form 534 */ 502 535 function post_comment($postdata) { 503 536 if ($postdata["comment_save_info"]) { … … 545 578 show_article($postdata["articles_id"]); 546 579 } 547 548 //}}}---------------------------------------------------------- 549 //{{{ limit_text($text, $length): limit the length of a message 550 //------------------------------------------------------------- 580 /* }}} */ 581 /* limit_text($text, $length) {{{ */ 582 /** 583 * limit the length of a message 584 * 585 * @param string the text to limit in length 586 * @param int the number of chars to limit to 587 * @return int 1 if truncated, 0 if original string is within limits 588 */ 551 589 function limit_text($text, $length=4000) { 552 590 if (strstr($text, "##BREAKPOINT##")) { … … 566 604 } 567 605 } 568 569 //}}}--------------------------------------------------------------------------- 570 //{{{ get_articles($start, $limit, $archive): show posts in pages or the archive 571 // $archive can be: 0 for none, 1 for archive by date, 2 for archive by category 572 //------------------------------------------------------------------------------ 606 /* }}} */ 607 /* get_articles($start, $limit, $archive) {{{ */ 608 /** 609 * show posts in pages or the archive 610 * 611 * @param int the starting point in the recordset 612 * @param int the ammount of items to show 613 * @param int type of archive. 0 = none, 1 = archive by date, 2 = archive by category 614 */ 573 615 function get_articles($start, $limit, $archive=0) { 574 616 global $db; … … 737 779 } 738 780 } 739 740 //}}}--------------------------------------- 741 //{{{ blog_show_search(): show livesearchbox 742 //------------------------------------------ 781 /* }}} */ 782 /* blog_show_search() {{{ */ 783 /** 784 * show livesearchbox 785 */ 743 786 function blog_show_search() { 744 787 ?> … … 752 795 <? 753 796 } 754 //}}}--------------------------------------------------------------- 755 //{{{ strip_invalid_xml(): strip some stuff leftover from old editor 756 //------------------------------------------------------------------ 797 /* }}} */ 798 /* strip_invalid_xml() {{{ */ 799 /** 800 * strip some stuff leftover from old editor 801 * 802 * @param string the text to process 803 * @return string the text with invalid xml stripped 804 */ 757 805 function strip_invalid_xml($data) { 758 806 $data = preg_replace("/ ref=\"[^\"].*\"/si", "", $data); 759 807 return $data; 760 808 } 761 //}}}------------------------------------- 762 //{{{ load_plugins(): load all the plugins 763 //---------------------------------------- 809 /* }}} */ 810 /* load_plugins() {{{ */ 811 /** 812 * load all the plugins 813 */ 764 814 function load_plugins() { 765 815 /* this should become a setting */ … … 775 825 } 776 826 } 777 827 /* }}} */ 828 /* register_plugin($name, $type) {{{ */ 829 /** 830 * register the plugin in the global plugin array 831 * 832 * @param string the plugin name 833 * @param string the kind of plugin 834 * @todo make more documentation for this 835 */ 778 836 function register_plugin($name, $type) { 779 837 $GLOBALS["plugins"][$type][] = $name; 780 838 } 781 839 /* }}} */ 840 /* getPluginsByType($type) {{{ */ 841 /** 842 * get plugins from global array that apply on given type 843 * 844 * @param string the plugintype to get plugins for 845 * @return array plugin names matching $type 846 */ 782 847 function getPluginsByType($type) { 783 848 if (is_array($GLOBALS["plugins"][$type])) { … … 790 855 return $plugs; 791 856 } 792 //}}}-------------------------------------------------- 793 //{{{ run_plugins($data, $types): run specified plugins 794 //----------------------------------------------------- 857 /* }}} */ 858 /* run_plugins($data, $types) {{{ */ 859 /** 860 * run specified plugins 861 * 862 * @param string the data to run the plugins on 863 * @param string the type of plugins to run 864 * @return string processed version of data 865 */ 795 866 function run_plugins($data, $types) { 796 867 if (!is_array($types)) { … … 810 881 return $data; 811 882 } 812 813 //}}}--------------------------------------- 814 //{{{ obfuscate_ip($ip): be privacy friendly 883 /* }}} */ 884 /* obfuscate_ip($ip) {{{ */ 885 /** 886 * obfuscate ip addresses so we are privacy friendly 887 * 888 * @param string the ip address to obfuscate 889 * @return string the ip with the last octet replaced by X 890 */ 815 891 //------------------------------------------ 816 892 function obfuscate_ip($ip) { … … 822 898 return $return; 823 899 } 824 / /}}}900 /* }}} */ 825 901 ?>
