- Timestamp:
- 04/02/06 17:33:30 (3 years ago)
- Files:
-
- 1 modified
-
branches/mvblog-plugins/common/functions_blog.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/mvblog-plugins/common/functions_blog.php
r81 r82 3 3 * MvBlog -- An open source no-noncence blogtool 4 4 * 5 * Copyright (C) 2005 , Michiel van Baak5 * Copyright (C) 2005-2006, Michiel van Baak 6 6 * Logo design (C) 2005, Sofie van Tendeloo 7 7 * … … 37 37 return $db; 38 38 } 39 //}}}--------------------------- 40 //{{{ initialize the mvblog tool 41 //------------------------------ 39 42 session_start(); 40 43 ob_start(); 41 44 $db = db_init(); 42 $acronyms = array();43 45 $version = "SVN \$Id$"; 44 46 $plugins = array(); … … 111 113 //------------------------------------------------------- 112 114 function show_article($id) { 113 global $db , $acronyms;115 global $db; 114 116 //get all the authors in an array 115 117 $res =& $db->query("SELECT * FROM authors"); … … 132 134 $categories[$row["id"]] = $row["name"]; 133 135 } 134 //same with acronyms135 $res =& $db->query("SELECT acronym,description FROM acronyms");136 if (PEAR::isError($res)) {137 die($res->getMessage());138 }139 while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) {140 $acronyms[$row["acronym"]] = $row["description"];141 }142 143 136 $res =& $db->query("SELECT * FROM articles WHERE id=$id"); 144 137 … … 157 150 <div class="log_body"> 158 151 <div class="log_contents"> 159 <?= acro_replace(strip_invalid_xml(str_replace("##BREAKPOINT##", "", $row["body"])))?>152 <?=run_plugins(strip_invalid_xml(str_replace("##BREAKPOINT##", "", $row["body"])), "text_output")?> 160 153 </div> 161 154 </div> … … 187 180 <div class="log_body"> 188 181 <div class="log_contents"> 189 <?=nl2br(strip_invalid_xml( acro_replace($row["comment"])))?>182 <?=nl2br(strip_invalid_xml(run_plugins($row["comment"], "text_output")))?> 190 183 </div> 191 184 <div class="log_foot"> … … 338 331 switch ($_REQUEST["action"]) { 339 332 case "view" : show_article($_REQUEST["id"]); break; 340 case "saveacro" : save_acro_to_db(); break;341 333 case "post_comment" : post_comment($_POST); break; 342 334 case "rss" : header("Location: common/rss.php"); break; … … 694 686 <? 695 687 } 696 697 //}}}------------------------------------------698 //{{{ acro_replace(): do some acronym replacing699 //---------------------------------------------700 function acro_replace($text) {701 global $acronyms;702 foreach ($acronyms as $acronym => $description) {703 //replace all the supplied acronyms704 $text = preg_replace("|(?!<[^<>]*?)(?<![?./&])\b$acronym\b(?!:)(?![^<>]*?>)|imsU","<acronym class=\"blog_acro\" title=\"$description\">$acronym</acronym>" , $text);705 //allow user to overwrite acronym replacing by putting the term between $ signs706 $text = preg_replace("|[$]<acronym class=\"blog_acro\" title=\"$description\">$acronym</acronym>[$]|imsU" , "$acronym" , $text);707 }708 return trim($text);709 }710 688 //}}}--------------------------------------------------------------- 711 689 //{{{ strip_invalid_xml(): strip some stuff leftover from old editor
