From: Geoffrey T. D. <da...@us...> - 2001-02-08 02:34:12
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv10891/lib Modified Files: setupwiki.php ziplib.php Log Message: Convert references to footnotes when reading a zip dump Index: setupwiki.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/setupwiki.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** setupwiki.php 2000/10/22 19:33:35 1.3 --- setupwiki.php 2001/02/08 02:34:32 1.4 *************** *** 38,42 **** 'flags' => 0, 'lastmodified' => $mtime, - 'refs' => array(), 'version' => 1); --- 38,41 ---- Index: ziplib.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/ziplib.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** ziplib.php 2001/02/06 23:16:31 1.3 --- ziplib.php 2001/02/08 02:34:32 1.4 *************** *** 518,524 **** if (($flags & FLAG_PAGE_LOCKED) != 0) $params['flags'] = 'PAGE_LOCKED'; ! for ($i = 1; $i <= NUM_LINKS; $i++) ! if ($ref = $refs[$i]) ! $params["ref$i"] = rawurlencode($ref); $out = MimeContentTypeHeader('application', 'x-phpwiki', $params); --- 518,529 ---- if (($flags & FLAG_PAGE_LOCKED) != 0) $params['flags'] = 'PAGE_LOCKED'; ! ! if (is_array($refs)) ! { ! // phpwiki's with versions > 1.2.x shouldn't have references. ! for ($i = 1; $i <= NUM_LINKS; $i++) ! if ($ref = $refs[$i]) ! $params["ref$i"] = rawurlencode($ref); ! } $out = MimeContentTypeHeader('application', 'x-phpwiki', $params); *************** *** 665,671 **** if (preg_match('/PAGE_LOCKED/', $params['flags'])) $pagehash['flags'] |= FLAG_PAGE_LOCKED; - for ($i = 1; $i <= NUM_LINKS; $i++) - if ($ref = $params["ref$i"]) - $pagehash['refs'][$i] = rawurldecode($ref); $encoding = strtolower($headers['content-transfer-encoding']); --- 670,673 ---- *************** *** 674,678 **** --- 676,699 ---- else if ($encoding && $encoding != 'binary') die("Unknown encoding type: $encoding"); + + // Convert references in meta-data to footnotes. + // Only zip archives generated by phpwiki 1.2.x or earlier should have + // references. + $footnotes = ''; + for ($i = 1; $i <= NUM_LINKS; $i++) + { + if (empty($params["ref$i"])) + continue; + $footnotes .= sprintf(gettext ("[%d] See [%s]"), + $i, rawurldecode($params["ref$i"])) . "\n%%%\n"; + } + if ($footnotes) + { + $data .= "-----\n"; + $data .= gettext ("!References") . "\n"; + $data .= $footnotes; + } + $pagehash['content'] = preg_split('/[ \t\r]*\n/', chop($data)); |