4 prints out a short summary of changed wiki pages
5 (an "updated-articles-list")
7 It respects following $ewiki_config[] entries:
8 ["wikinews_num"] - how many new articles to be shown
9 ["wikinews_len"] - string length of the excerpts
10 ["wikinews_regex"] - use only pages that match this /pregex/
14 $ewiki_plugins["page"]["WikiNews"] = "ewiki_page_wikinews";
16 function ewiki_page_wikinews($newsid, $data, $action) {
20 ($n_num = $ewiki_config["wikinews_num"]) || ($n_num = 10);
21 ($n_len = $ewiki_config["wikinews_len"]) || ($n_len = 512);
22 ($c_regex = $ewiki_config["wikinews_regex"]) || ($c_regex = false);
24 return(ewiki_make_title($newsid,$newsid, 2).ewiki_wikinews_summary($n_num,$n_len,$c_regex));
27 function ewiki_wikinews_summary($n_num,$n_len,$c_regex){
28 global $ewiki_plugins, $ewiki_config;
30 #-- fetch all page entries from DB, for sorting on creation time
31 $result = ewiki_db::GETALL(array("lastmodified"));
33 while ($row = $result->get()) {
35 if (EWIKI_DB_F_TEXT == ($row["flags"] & EWIKI_DB_F_TYPE)) {
37 if ($c_regex && !preg_match($c_regex, $row["id"])) {
41 $sorted[$row["id"]] = $row["lastmodified"];
48 $displayed = 0;//$displayed will count pages successfully displayed
52 foreach ($sorted as $id=>$uu) {
54 $row = ewiki_db::GET($id);
57 if (EWIKI_PROTECTED_MODE && !ewiki_auth($id, $row, "view", $ring=false, $force=0)) {
58 if (EWIKI_PROTECTED_MODE_HIDING) {
61 $row["content"] = ewiki_t("FORBIDDEN");
65 $text = "\n".substr($row["content"], 0, $n_len);
66 $text = str_replace("[internal://", "[ internal://", $text);
67 $text .= " [...[read more | $id]]\n";
69 #-- title mangling (from ewiki.php)
71 if ($ewiki_config["split_title"] && $may_split) {
72 $title = ewiki_split_title($title, $ewiki_config["split_title"], 0&($title!=$ewiki_title)); //Why 0&?
75 $title = htmlentities($title);
77 if ($pf_a = @$ewiki_plugins["title_transform"]) {
78 foreach ($pf_a as $pf) { $pf($id, $title, $go_action); }
81 if($ewiki_config["wm_publishing_headers"]){
82 $text = preg_replace("/^!([^!])/m","!! \$1",$text);
86 $text = preg_replace("/^!!!/m","!!",$text);
88 "!!! [\"$title\"$id]";
90 $o .=" µµ". strftime(ewiki_t("LASTCHANGED"), $row["lastmodified"])."µµ\n";
100 #-- render requested wiki page <-- goal !!!
101 $render_args = array(
103 "html" => (EWIKI_ALLOW_HTML||(@$data["flags"]&EWIKI_DB_F_HTML)),
105 $o = $ewiki_plugins["render"][0] ($o, $render_args);