[ewiki] Patches for ewiki-R1.02b

Good evening in the Lord.  

Is it possible for you to evaluate the inclusion of some of these
patches?  I'm using them in:
http://www.gfc.edu.co/fpv

The main motivation was to control more the news published in WikiNews 
(not every change produces an entry for WikiNews but only some explicitly 
selected changes).


Fix in documentation:

diff -ru ewiki-R1.02b/README.plugins fpv/README.plugins
--- ewiki-R1.02b/README.plugins Tue May 17 11:05:53 2005
+++ fpv/README.plugins  Fri Jul 29 07:30:33 2005
@@ -1902,7 +1902,7 @@
          The coolest about this plugin is, that it nicely integrates into
          the common WikiNameSpace.
 
-         Just include("plugins/calendar.php"); so it gets available.
+         Just include("plugins/module/calendar.php"); so it gets available.
          In yoursite.php integrate it as follows:


Reordering inclusion of local/config.php to allow usage of other
databases (I'm using sqlite) .  I'm sending also (at the end of
the message) part of my local/config.php

diff -ru ewiki-R1.02b/config.php fpv/config.php
--- ewiki-R1.02b/config.php     Thu Jun 16 10:45:54 2005
+++ fpv/config.php      Thu Jul 28 05:34:32 2005
@@ -10,10 +10,14 @@
 */
 
 
+$ok=false;
+#-- only loaded if it exists
+@include_once("local/config.php");
+
 #-- open mysql database connection if available,
 #   or load the flat file database backend as fallback
 #
-if (function_exists("mysql_connect")) {
+if (!$ok && function_exists("mysql_connect")) {
    $ok = @mysql_connect("localhost", "root", $password="")
          && mysql_query("USE test");
 }
@@ -23,8 +27,6 @@
 }
 
 
-#-- only loaded if it exists
-@include_once("local/config.php");
 
 #-- predefine some of the configuration constants
 define("EWIKI_LIST_LIMIT", 25);



New flag EWIKI_DB_F_NONEWS to avoid publication of changes in WikiNews.

diff -ru ewiki-R1.02b/ewiki.php fpv/ewiki.php
--- ewiki-R1.02b/ewiki.php      Wed Jun 15 11:23:50 2005
+++ fpv/ewiki.php       Tue Aug  2 13:22:46 2005
@@ -122,6 +123,7 @@
        define("EWIKI_DB_F_MINOR", 1<<9);
        define("EWIKI_DB_F_HIDDEN", 1<<10);
        define("EWIKI_DB_F_ARCHIVE", 1<<11);
+       define("EWIKI_DB_F_NONEWS", 1<<12);
        define("EWIKI_DB_F_EXEC", 1<<17);
        define("EWIKI_DB_F_TYPE", EWIKI_DB_F_TEXT | EWIKI_DB_F_BINARY | EWIKI_DB
_F_DISABLED | EWIKI_DB_F_SYSTEM | EWIKI_DB_F_PART);
        define("EWIKI_DB_F_ACCESS", EWIKI_DB_F_READONLY | EWIKI_DB_F_WRITEABLE |
 EWIKI_DB_F_APPENDONLY);
@@ -331,6 +333,8 @@
           "LIKEPAGES" => "Pages like this",
           "NEWESTPAGES" => "Newest Pages",
           "LASTCHANGED" => "last changed on %c",
+          "PUBLISHED" => "published on %c",
+          "CHANGES" => "changes",
           "DOESNOTEXIST" => "This page does not yet exist, please click on Edit
ThisPage if you'd like to create it.",
           "DISABLEDPAGE" => "This page is currently not available.",
           "ERRVERSIONSAVE" => "Sorry, while you edited this page someone else
@@ -360,13 +364,17 @@
         #
         $ewiki_t["es"] = (array)@$ewiki_t["es"] + array(
            "EDITTHISPAGE" => "EditarEstaPágina",
+           "APPENDTOPAGE" => "Agregar a",
            "BACKLINKS" => "EnlacesInversos",
+          "EDITCOMPLETE" => 'Su edición ha sido salvada, haga click <a href="$u
rl">aquí</a> para ver la página editada.',
            "PAGESLINKINGTO" => "Páginas enlazando \$title",
            "PAGEHISTORY" => "InfoPágina",
            "INFOABOUTPAGE" => "Información sobre la página",
            "LIKEPAGES" => "Páginas como esta",
            "NEWESTPAGES" => "Páginas más nuevas",
            "LASTCHANGED" => "última modificación %d/%m/%Y a las %H:%M",
+          "PUBLISHED" => "publicada %d/%m/%Y a las %H:%M",
+           "CHANGES" => "cambios",
            "DOESNOTEXIST" => "Esta página aún no existe, por favor eliga Editar
EstaPágina si desea crearla.",
            "DISABLEDPAGE" => "Esta página no está disponible en este momento.",
            "ERRVERSIONSAVE" => "Disculpe, mientras editaba esta página alguién 
más
@@ -406,6 +414,8 @@
           "LIKEPAGES" => "Ähnliche Seiten",
           "NEWESTPAGES" => "Neueste Seiten",
           "LASTCHANGED" => "zuletzt geändert am %d.%m.%Y um %H:%M",
+          "PUBLISHED" => "veroffentlich am %d.%m.%Y um %H:%M",
+           "CHANGES" => "geänderungen",
           "DISABLEDPAGE" => "Diese Seite kann momentan nicht angezeigt werden."
,
           "ERRVERSIONSAVE" => "Entschuldige, aber während Du an der Seite
                gearbeitet hast, hat bereits jemand anders eine geänderte
@@ -1173,7 +1183,7 @@
 }
 
 function ewiki_page_versions($id, $data, $action) {
-   return( ewiki_page_ordered_list("version", -1, "%n changes", EWIKI_PAGE_VERS
IONS) );
+   return( ewiki_page_ordered_list("version", -1, "%n ".ewiki_t("changes"), EWI
KI_PAGE_VERSIONS) );
 }
 

diff -ur ewiki-R1.02b/plugins/page/wikinews.php fpv/plugins/page/wikinews.php
--- ewiki-R1.02b/plugins/page/wikinews.php      Tue Jul 27 14:29:01 2004
+++ fpv/plugins/page/wikinews.php       Fri Aug 19 06:09:45 2005
@@ -1,17 +1,27 @@
 <?php
-
+# vim: set expandtab tabstop=3 shiftwidth=3 foldmethod=marker:
 /*
    prints out a short summary of changed wiki pages
    (an "updated-articles-list")
+   Excludes from the list those pages with the flags EWIKI_DB_F_MINOR or
+   EWIKI_DB_HIDDEN or EWIKI_DB_F_NONEWS. These flags can be changed during 
+   edition by using the plugin db/edit/flags.php
 
+   The name of the WikiNews page can be set for example in the config.php
+   file with:
+       define('EWIKI_PAGE_WIKINEWS', 'WikiNoticias');
+
    It respects following $ewiki_config[] entries:
     ["wikinews_num"] - how many new articles to be shown
     ["wikinews_len"] - string length of the excerpts
     ["wikinews_regex"] - use only pages that match this /pregex/
 */
 
+if (!defined('EWIKI_PAGE_WIKINEWS')) {
+       define('EWIKI_PAGE_WIKINEWS', 'WikiNews');
+}
 
-$ewiki_plugins["page"]["WikiNews"] = "ewiki_page_wikinews";
+$ewiki_plugins["page"][EWIKI_PAGE_WIKINEWS]= "ewiki_page_wikinews";
 
 function ewiki_page_wikinews($newsid, $data, $action) {
   global $ewiki_config;
@@ -21,38 +31,52 @@
    ($n_len = $ewiki_config["wikinews_len"]) || ($n_len = 512);
    ($c_regex = $ewiki_config["wikinews_regex"]) || ($c_regex = false);
 
-  return(ewiki_make_title($newsid,$newsid, 2).ewiki_wikinews_summary($n_num,$n_
len,$c_regex));
+  return(ewiki_make_title($newsid,$newsid, 2).
+       ewiki_wikinews_summary($n_num,$n_len,$c_regex));
 }
 
-function ewiki_wikinews_summary($n_num,$n_len,$c_regex){
-  global $ewiki_plugins, $ewiki_config;
 
-  #-- fetch all page entries from DB, for sorting on creation time
-  $result = ewiki_db::GETALL(array("lastmodified"));
+function wikinews_choose($result, $c_regex=null) {
   $sorted = array();
+  // Idea from recentchanges
   while ($row = $result->get()) {
-  
-    if (EWIKI_DB_F_TEXT == ($row["flags"] & EWIKI_DB_F_TYPE)) {
-  
-      if ($c_regex && !preg_match($c_regex, $row["id"])) {
-        continue;
-      }
-      
-      $sorted[$row["id"]] = $row["lastmodified"];
-    }
+     $id=$row['id'];
+     for($v=$row["version"]; $v>0; $v--) {
+        $row2 = ewiki_db::GET($id, $v);
+       if ($row2  && (EWIKI_DB_F_TEXT == ($row2["flags"] & EWIKI_DB_F_TYPE) &&
+          !($row2['flags'] & EWIKI_DB_F_MINOR) &&
+          !($row2['flags'] & EWIKI_DB_F_NONEWS) &&
+          !($row2['flags'] & EWIKI_DB_F_HIDDEN))) {
+          if (!$c_regex || preg_match($c_regex, $row2["id"])) {
+              $sorted[$row2["version"]."-".$row2["id"]] 
+                = $row2["lastmodified"];
+          }
+        }
+     }
   }
-  
-  #-- sort 
   arsort($sorted);
-    
+  return $sorted;
+}
+ 
+
+function ewiki_wikinews_summary($n_num,$n_len,$c_regex){
+  global $ewiki_plugins, $ewiki_config, $ewiki_db;
+
+  #-- fetch all page entries from DB, for sorting on creation time
+  $result = ewiki_db::GETALL(array("lastmodified"));
+ 
+  $sorted=wikinews_choose($result, $c_regex);
+
   $displayed  = 0;//$displayed will count pages successfully displayed
   
   #-- gen output
   $o = "";
-  foreach ($sorted as $id=>$uu) {
+  foreach ($sorted as $vid=>$uu) {
+    $p=strpos($vid, "-");
+    $ver=substr($vid,0,$p);
+    $id=substr($vid,$p+1);
+    $row = ewiki_db::GET($id, $ver);
   
-    $row = ewiki_db::GET($id);
-  
     #-- require auth
     if (EWIKI_PROTECTED_MODE && !ewiki_auth($id, $row, "view", $ring=false, $fo
rce=0)) {
        if (EWIKI_PROTECTED_MODE_HIDING) {
@@ -61,23 +85,17 @@
           $row["content"] = ewiki_t("FORBIDDEN");
        }
     }
-    
-    $text = "\n".substr($row["content"], 0, $n_len);
-    $text = str_replace("[internal://", "[  internal://", $text);
-    $text .= " [...[read more | $id]]\n";
-    
-    #-- title mangling (from ewiki.php)
-    $title=$id;      
-    if ($ewiki_config["split_title"] && $may_split) {
-      $title = ewiki_split_title($title, $ewiki_config["split_title"], 0&($titl
e!=$ewiki_title));   //Why 0&?
+    if (isset($row['meta']['log']) && $row['meta']['log']!='') {
+           $text=$row['meta']['log'];
     }
     else {
-      $title = htmlentities($title);
-    }      
-    if ($pf_a = @$ewiki_plugins["title_transform"]) {
-      foreach ($pf_a as $pf) { $pf($id, $title, $go_action); }
-    }
+       $text = "\n".substr($row["content"], 0, $n_len);
+       $text = str_replace("[internal://", "[  internal://", $text);
+       $text .= " [...[read more | $id]]\n";
+   }
     
+    $title=ewiki_split_title($id, -1, 0);      
+   
     if($ewiki_config["wm_publishing_headers"]){
       $text = preg_replace("/^!([^!])/m","!! \$1",$text);
       $o .= "\n" .
@@ -87,10 +105,10 @@
       $o .= "\n" .
           "!!! [\"$title\"$id]";      
     }
-    $o .=" µµ". strftime(ewiki_t("LASTCHANGED"), $row["lastmodified"])."µµ\n";
+    $o .=" µµ". strftime(ewiki_t("PUBLISHED"), $row["lastmodified"])."µµ\n";
     $o .= " $text\n";
     $o .= "----\n";
-  
+ 
     if (!($n_num--)) {
        break;
     }


diff -ur ewiki-R1.02b/plugins/edit/flags.php fpv/plugins/edit/flags.php
--- ewiki-R1.02b/plugins/edit/flags.php Fri Jul 23 20:11:23 2004
+++ fpv/plugins/edit/flags.php  Mon Aug  1 06:54:03 2005
@@ -5,22 +5,32 @@
    is a separate plugin for minor edits)
 */
 
-$ewiki_config["user_flags"] = array(
-   EWIKI_DB_F_MINOR => "minor edit",
-   EWIKI_DB_F_HIDDEN => "hidden page",
-#  EWIKI_DB_F_HTML => "html is allowed",
-);
 $ewiki_plugins["edit_form_append"][] = "ewiki_edit_user_flags";
 $ewiki_plugins["edit_save"][] = "ewiki_edit_save_user_flags";
 
 $ewiki_t["de"]["minor edit"] = "kleine Änderung";
 $ewiki_t["de"]["hidden page"] = "versteckte Seite";
+$ewiki_t["de"]["exclude from news"] = "kein Neurichtkeit";
 
+$ewiki_t["es"]["hidden page"] = "página escondida";
+$ewiki_t["es"]["minor edit"] = "pequeña modificación";
+$ewiki_t["es"]["exclude from news"] = "no es noticia";
 
+
+function possible_flags() {
+   return array(
+   EWIKI_DB_F_MINOR => "minor edit",
+   EWIKI_DB_F_HIDDEN => "hidden page",
+   EWIKI_DB_F_NONEWS => "exclude from news",
+   );
+}
+   
+
+
 function ewiki_edit_save_user_flags(&$save, &$old) {
-   global $ewiki_config;
+   $pf=possible_flags();
 
-   foreach ($ewiki_config["user_flags"] as $FLAG=>$str) {
+   foreach ($pf as $FLAG=>$str) {
       $save["flags"] = $save["flags"] & (0xFFFF ^ $FLAG)
         | ($_REQUEST["page_user_flag"][dechex($FLAG)] ? $FLAG : 0x00);
    }
@@ -28,12 +38,14 @@
 
 
 function ewiki_edit_user_flags($id, &$data, $action) {
-   global $ewiki_config;
-   
+   $pf=possible_flags();
+
    $o = "";
-   foreach ($ewiki_config as $FLAG => $str) {
+   foreach ($pf as $FLAG => $str) {
+
       $o .= '<input type="checkbox" name="page_user_flag['.dechex($FLAG).']" va
lue="1"'
-         . (($FLAG != EWIKI_DB_F_MINOR) && ($data["flags"] & $FLAG) ? " checked
" : "")
+         . (($FLAG == EWIKI_DB_F_NONEWS) || 
+               ($data["flags"] & $FLAG) ? " checked" : "")
          . ' id="page_user_flag_'.$FLAG.'"><label for="page_user_flag_'.$FLAG.'
"> '
          . ewiki_t($str) . '</label><br />' . "\n";
    }



To include other menus like MainMenu:

diff -ru ewiki-R1.02b/fragments/blocks/mainmenu.php fpv/fragments/blocks/mainmen
u.php
--- ewiki-R1.02b/fragments/blocks/mainmenu.php  Tue Jul 27 14:28:58 2004
+++ fpv/fragments/blocks/mainmenu.php   Tue Aug  2 06:42:21 2005
@@ -6,17 +6,16 @@
 */
 
 
-if (true) {
-
-   $mm = ewiki_db::GET("MainMenu");
-
+function f_menu($id='MainMenu', $class='MainMenu', $main_menu_sep='*') {
+   $mm = ewiki_db::GET($id);
    if ($mm = $mm["content"]) {
       $mm = preg_replace("/^([^*]+[^\n]+)?\n/m", "", $mm);
+      $mm = preg_replace("/^[*]/m", $main_menu_sep, $mm);
+      $mm = preg_replace("/$/m", "%%%", $mm);
       $mm = ewiki_format($mm);
-      echo '<div class="MainMenu">' .  "\n" . $mm . "\n</div>\n";
+      echo "<div class=\"$id\">" .  "\n" . $mm . "\n</div>\n";
    }
-
 }
 
 
-?>


Avoid warning in authentication

diff -ur ewiki-R1.02b/fragments/funcs/auth.php fpv/fragments/funcs/auth.php
--- ewiki-R1.02b/fragments/funcs/auth.php       Mon Aug 23 07:50:16 2004
+++ fpv/fragments/funcs/auth.php        Fri Aug  5 13:15:24 2005
@@ -20,9 +21,9 @@
     die("<h1>Restricted Access</h1>\nPlease first create an admin account in '<
tt>.../fragments/funcs/auth.php</tt>' or define() the '<tt>EWIKI_ADMIN_PW</tt>' 
constant.");
  }
 
-
  #-- fetch user:password
- if ($uu = $_SERVER["HTTP_AUTHORIZATION"]) {
+ if (isset($_SERVER["HTTP_AUTHORIZATION"]) && 
+       $uu = $_SERVER["HTTP_AUTHORIZATION"]) {
     foreach (explode(",", $uu) as $uu) {
        $uu = trim($uu);
        if (strtoupper(strtok($uu, " ")) == "BASIC") {
@@ -50,4 +51,4 @@
     die();
  }
 
-?>






Localization spanish

diff -ur ewiki-R1.02b/plugins/appearance/title_calendar.php fpv/plugins/appearan
ce/title_calendar.php
--- ewiki-R1.02b/plugins/appearance/title_calendar.php  Fri May 21 12:21:39 2004
+++ fpv/plugins/appearance/title_calendar.php   Tue Aug  2 06:15:04 2005
@@ -1,4 +1,5 @@
 <?php
+# vim: set expandtab tabstop=3 shiftwidth=3 foldmethod=marker:
 #  makes a pages` calendar title more readable,
 #  replaces the standard _print_title with a _calendar_title
 #
@@ -20,6 +21,7 @@
 @define("CALENDAR_PAGE_DATE_PARSE_REGEX", '#(.*)'. preg_quote(CALENDAR_NAME_SEP
) .' ?(\d{4})(\d{2})(\d{2})#');
 $ewiki_t["en"]['CALENDERENTRYFOR']='Calendar entry for ';
 $ewiki_t["de"]['CALENDERENTRYFOR']='KalenderEintrag für ';
+$ewiki_t["es"]['CALENDERENTRYFOR']='Calendario para ';
 
 function ewiki_calendar_list_pages(&$lines) {
     global $ewiki_plugins;
@@ -75,4 +77,4 @@
    }
    return($title);
 } 
diff -ur ewiki-R1.02b/plugins/auth/auth_method_form.php fpv/plugins/auth/auth_me
thod_form.php
--- ewiki-R1.02b/plugins/auth/auth_method_form.php      Fri Jul 23 20:11:22 2004
+++ fpv/plugins/auth/auth_method_form.php       Tue Aug  2 13:10:03 2005
@@ -26,6 +26,13 @@
 $ewiki_t["de"]["login"] = "Einloggen";
 
 
+$ewiki_t["es"]["LOGIN_QUERY"] = "Por favor ingrese para emplear esta función:";
+$ewiki_t["es"]["LOGIN_QUERY_2"] = "";
+$ewiki_t["es"]["user"] = "Usuario";
+$ewiki_t["es"]["password"] = "Clave";
+$ewiki_t["es"]["login"] = "Ingresar";
+$ewiki_t["es"]["Login"] = "Ingreso";
+
 #-- code
 function ewiki_auth_query_form(&$data, $force_query=0) {
 
@@ -70,7 +77,7 @@
 
       #-- print
       $o = '<div class="login-form auth-login">'
-         . ewiki_make_title($ewiki_id, "Login", $_title_class=4, $ewiki_action,
 $_go_action="info")
+         . ewiki_make_title($ewiki_id, ewiki_t("Login"), $_title_class=4, $ewik
i_action, $_go_action="info")
          . ewiki_t("LOGIN_QUERY") . "\n<br /><br />\n"
          . '<form action="'.$_SERVER["REQUEST_URI"].'" method="POST">' . "\n"
          . ewiki_t(
@@ -90,4 +97,4 @@
 
 
 
-?>


diff -ur ewiki-R1.02b/plugins/aview/posts.php fpv/plugins/aview/posts.php
--- ewiki-R1.02b/plugins/aview/posts.php        Tue Jul 27 14:28:59 2004
+++ fpv/plugins/aview/posts.php Tue Aug  2 06:50:28 2005
@@ -1,5 +1,5 @@
 <?php
-
+# vim: set expandtab tabstop=3 shiftwidth=3 foldmethod=marker:
 #  this plugin appends a class of wiki pages to the bottom of the
 # current page this will grow/merge into or support the forums
 # plugin
@@ -13,7 +13,13 @@
    "INFOABOUTPOST" => "Information about post",
    "COMPVERPOST" => "See Changes"
    ));
+$ewiki_t["es"] = array_merge($ewiki_t["es"], array(
+   "EDITTHISPOST" => "Editar Este Comentario",
+   "INFOABOUTPOST" => "Información sobre comentario",
+   "COMPVERPOST" => "Ver Cambios"
+   ));
 
+
 #-- entitle actions
 $ewiki_config['posts_action_links'] = array_merge(array(
     "edit" => "EDITTHISPOST",
@@ -31,6 +37,11 @@
 $ewiki_t["en"]["ADDPOST"] = "Add a post";
 $ewiki_t["en"]["TOO_MANY_POSTS"] = 'We are sorry.  The maximum number of posts 
has been exceeded.<br /><br />Return to [$id]';
 
+$ewiki_t["es"]["POSTS"] = "comentarios";
+$ewiki_t["es"]["POST"] = "Comentario: ";
+$ewiki_t["es"]["ADDPOST"] = "Comentario";
+$ewiki_t["es"]["TOO_MANY_POSTS"] = 'Lo sentimos. El máximo número de comentario
s ha sido sobrepasado. <br /><br />Regresar a [$id]';
+
 $ewiki_config["action_links"]["view"]["addpost"] =  $ewiki_t["en"]["ADDPOST"];
 
 $ewiki_plugins["action"]["addpost"] = "ewiki_add_post";



We look for posts by using LIKE 

diff -ur ewiki-R1.02b/plugins/db/any.php fpv/plugins/db/any.php
--- ewiki-R1.02b/plugins/db/any.php     Wed Dec 22 22:39:14 2004
+++ fpv/plugins/db/any.php      Tue Aug  2 13:10:19 2005
@@ -200,7 +199,10 @@
       if ($field != "id") { 
          $sqlfield = ", $field";
       }
-      if ($regex) {
+      if ($regex===-1) {
+         $WHERE="$field LIKE '$content'";
+      }
+      elseif ($regex) {
          if ($GLOBALS["anydb_type"] == ANYDB_MY) {
             $regex = "REGEXP";
          } else {



diff -ur ewiki-R1.02b/plugins/aview/posts.php fpv/plugins/aview/posts.php
--- ewiki-R1.02b/plugins/aview/posts.php        Tue Jul 27 14:28:59 2004
+++ fpv/plugins/aview/posts.php Tue Aug  2 06:50:28 2005
@@ -121,7 +132,7 @@
 
 /**
  * Code for the new database layer */
-   $result = ewiki_db::SEARCH("id", $id.'_POST');
+   $result = ewiki_db::SEARCH("id", $id.'_POST%', null, -1);
 
        #sort by post number
    $ord = array();
@@ -172,8 +183,8 @@
        #sort by post number
    $ord = array();
 
-   $scan =  $id.EWIKI_POST_SEPARATOR; //Should I escape $id here?
-   $result = ewiki_db::SEARCH("id", $scan);
+   $scan =  $id.EWIKI_POST_SEPARATOR."%"; //Should I escape $id here?
+   $result = ewiki_db::SEARCH("id", $scan, null, -1);
    while ($row = $result->get()) {
        preg_match('#_POST(\d{3})#', $row["id"],$matches=array($matches));
         $ord[$row["id"]] = $matches[1];
@@ -186,11 +197,11 @@
     $id = $GLOBALS["ewiki_id"];
     
     $result = $always || ($id)
-        && ($result = ewiki_db::SEARCH("id", $id.'_POST'))
+        && ($result = ewiki_db::SEARCH("id", $id.'_POST%', null, -1))
         && ($result->count());
     return( ($id) && ($id != EWIKI_PAGE_CALENDAR) && ($id != EWIKI_PAGE_YEAR_CA
LENDAR)
         && !isPost($id)
         && empty($_REQUEST["year"]) && $result );
 }
 
-?>






Refactoring in rss by using a function defined in wikinews

diff -ur ewiki-R1.02b/plugins/action/rss.php fpv/plugins/action/rss.php
--- ewiki-R1.02b/plugins/action/rss.php Tue Jul 27 14:28:59 2004
+++ fpv/plugins/action/rss.php  Fri Aug 19 05:49:45 2005
@@ -21,14 +21,13 @@
    #-- recentchanges as rss
    if (strtoupper($id) == "RSS") {
       $res = ewiki_db::GETALL(array("id", "flags", "version", "lastmodified"));
-      $sort = array();
-      while ($data = $res->get(0, 0x0137, EWIKI_DB_F_TEXT)) {
-         $sort[$data["id"]] = $data["lastmodified"];
-      }
-      arsort($sort);
+      $sort=wikinews_choose($res); // require plugins/page/wikinews.php
       $limit = 100;
-      foreach ($sort as $id=>$uu) {
-         $list[] = ewiki_db::GET($id);
+      foreach ($sort as $vid=>$uu) {
+        $p=strpos($vid, "-");
+        $ver=substr($vid,0,$p);
+        $id=substr($vid,$p+1);
+         $list[] = ewiki_db::GET($id, $ver);
          if ($limit-- < 0) { break; }
       }
    }
@@ -45,4 +44,4 @@
    ewiki_feed($list);
 }
 
-?>


Minor fixes

diff -ur ewiki-R1.02b/spages/HitCounter.php fpv/spages/HitCounter.php
--- ewiki-R1.02b/spages/HitCounter.php  Tue Jul 27 14:29:01 2004
+++ fpv/spages/HitCounter.php   Fri Jul 29 06:31:54 2005
@@ -16,7 +16,7 @@
  }
 
  #-- output
- $AllPages = '<a href="'. ewiki_script("", "PageIndex") .'">AllPages</a>';
+ $AllPages = '<a href="'. ewiki_script("", EWIKI_PAGE_INDEX) .'">AllPages</a>';
  echo <<< EOT
 $title
 The overall hit score of $AllPages is:


diff -ur ewiki-R1.02b/spages/WantedPages.php fpv/spages/WantedPages.php
--- ewiki-R1.02b/spages/WantedPages.php Tue Jul 27 14:29:02 2004
+++ fpv/spages/WantedPages.php  Fri Jul 29 06:34:42 2005
@@ -21,6 +21,7 @@
  $refs = array_unique(explode("\n", $refs));
 
  #-- strip existing pages from array
+ $wanted=array();
  $refs = ewiki_db::FIND($refs);
  foreach ($refs as $id=>$exists) {
     if (!$exists && !strstr($id, "://") && strlen(trim($id))) {


diff -ur ewiki-R1.02b/tools/t_config.php fpv/tools/t_config.php
--- ewiki-R1.02b/tools/t_config.php     Tue May 17 11:20:08 2005
+++ fpv/tools/t_config.php      Fri Aug  5 13:14:44 2005
@@ -44,7 +44,7 @@
 
 
      #-- PHP fixes
-     include("plugins/lib/fix.php");
+     require_once "plugins/lib/fix.php";
      include("plugins/lib/upgrade.php");
 
   }


Just for reference (how to use sqlite)  I'm sending part of my 
local/config.php:



<?php  

require_once("PEAR.php");
require_once("DB.php");

include("plugins/db/any.php");

$p=array('//users/vtamara/gfc/fpv/db', // OpenBSD con chroot
        '//var/www/users/vtamara/gfc/fpv/db', //OpenBSD sin chroot
        '//home/gfc/fpv/db' // GFC
        );

$dirdb="/.";
foreach($p as $d) {     
        if (!file_exists($dirdb."/ewiki.db")) { 
                $dirdb=$d;
        }
}
$arch="ewiki.db?mode=0666";
$dsn="sqlite://:@$dirdb/$arch";
$ok=anydb_connect("$dirdb", '', '', $arch, 'sqlite');
anydb_handle($ok);
if (!$ok || PEAR::isError($ok)) {
        
        die("Problema abriendo base de datos. ");

} 

define('EWIKI_PAGE_WIKINEWS', 'Novedades');
define('EWIKI_DEFAULT_LANG', 'es');
define('EWIKI_AUTO_EDIT', 1);
define('EWIKI_EDIT_REDIRECT', 0);


define("EWIKI_NAME", "Wiki de Formación para la Vida");         # Wiki title
define("EWIKI_PAGE_INDEX", "Novedades");        # default page
define("EWIKI_SCRIPT", "?id=");                 # relative to docroot
define("EWIKI_PAGE_LIST", "ÍndiceDePáginas");
define("EWIKI_PAGE_SEARCH", "BuscarPágina");
define("EWIKI_PAGE_NEWEST", "PáginasMásNuevas");
define("EWIKI_PAGE_HITS", "PáginasMásVisitadas");
define("EWIKI_PAGE_VERSIONS", "PáginasMásCambiadas");
define("EWIKI_PAGE_UPDATES", "PáginasActualizadas");
define("EWIKI_PAGE_POWERSEARCH", "BúsquedaPotente");
define("EWIKI_PAGE_RECENTCHANGES", "CambiosRecientes");
define("EWIKI_AUTOVIEW", 1);

define("EWIKI_PAGE_CALENDAR", "PáginaCalendario");
define("EWIKI_PAGE_YEAR_CALENDAR", "PáginaCalendarioAnual");


define("EWIKI_ADMIN_PW", "Jesús");
$main_menu_v="»";

include_once("plugins/page/wikinews.php");
include_once "plugins/edit/flags.php";
include_once "plugins/rss.php";
include_once "plugins/lib/feed.php";
include_once "plugins/page/textupload.php";
include_once "plugins/page/recentchanges.php";
include("plugins/mpi/mpi.php");

include("plugins/aview/posts.php");
include("plugins/lib/subpagelist.php");
include("plugins/aview/subpages.php");
$ewiki_config["action_links"]["view"]["addpost"] = $ewiki_t["es"]["ADDPOST"];

include("plugins/module/calendar.php");
include("plugins/appearance/title_calendar.php");
include("fragments/calendar.css");
unset($ewiki_plugins["action"][EWIKI_ACTION_CALENDAR]);
$ewiki_t["es"]['CALENDERENTRYFOR']='';

include("plugins/edit/log.php");

include("autentica.php");
$ewiki_perm_rings = array_merge(
        array(
                "addpost"          => 3
        ),
        (array)@$ewiki_perm_rings
);

include("plugins/spages.php");
ewiki_init_spages("/users/vtamara/fpv/spages/");

?>


I release these patches to the public domain.

God illuminate us.
-- 
Dios, por favor, ayudanos a hacer Tu voluntad que es felicidad desbordante.
http://www.primarilypublicdomain.org/letter/
--  
  Vladimir Támara Patiño.  
  http://www.geocities.com/v-tamara



Other related posts: