[ewiki] correction of bug in latest CVS (200312080005)

Hi Ewikis!

init-pages (when setting up the wiki) will work w/ the latest CVS 
(latest-CVS-200312080005 i.e. 8.12.03) again, if you change the following in 
ewiki:

In function ewiki_eventually_initialize replace "$pathname/$filename" by 
EWIKI_INIT_PAGES."/$filename" (lines 2578, 2588, 2589). Below you find the 
corrected function.

Mario, can you just change that w/ the next CVS? 

Solong,
Timm

-----------------------------

/*  reads all files from "./init-pages/" into the database,
    when ewiki is run for the very first time and the FrontPage
    does not yet exist in the database
*/
function ewiki_eventually_initialize(&$id, &$data, &$action) {

   #-- initialize database only if frontpage missing
   if (($id==EWIKI_PAGE_INDEX) && ($action=="edit") && 
empty($data["version"])) {

      ewiki_database("INIT");
      if ($dh = @opendir(EWIKI_INIT_PAGES)) {
         while ($filename = readdir($dh)) {
            if (preg_match('/^(['.EWIKI_CHARS_U.']+['.EWIKI_CHARS_L.']+\w*)
+/', $filename)) {
               $found = ewiki_database("FIND", array($filename));
               if (! $found[$filename]) {
                  $content = implode("", file(EWIKI_INIT_PAGES."/$filename"));
                  ewiki_scan_wikiwords($content, $ewiki_links, 
"_STRIP_EMAIL=1");
                  $refs = "\n\n" . implode("\n", array_keys($ewiki_links)) . 
"\n\n";
                  $save = array(
                     "id" => "$filename",
                     "version" => "1",
                     "flags" => "1",
                     "content" => $content,
                     "author" => ewiki_author("ewiki_initialize"),
                     "refs" => $refs,
                     "lastmodified" => filemtime(EWIKI_INIT_PAGES."/
$filename"),
                     "created" => filectime(EWIKI_INIT_PAGES."/
$filename")   // (not exact)
                  );
                  ewiki_database("WRITE", $save);
               }
            }
         }
         closedir($dh);
      }
      else {
         echo "<b>ewiki error</b>: could not read from directory ". 
realpath(EWIKI_INIT_PAGES) ."<br>\n";
      }

      #-- try to view/ that newly inserted page
      if ($data = ewiki_database("GET", array("id"=>$id))) {
         $action = "view";
      }
   }
}



Other related posts: