From: Arno H. <aho...@us...> - 2000-11-01 11:31:44
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory slayer.i.sourceforge.net:/tmp/cvs-serv24731/lib Modified Files: dbmlib.php diff.php display.php editpage.php pageinfo.php savepage.php stdlib.php Log Message: fixed E_NOTICE warnings Index: dbmlib.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/dbmlib.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** dbmlib.php 2000/10/19 22:25:45 1.2 --- dbmlib.php 2000/11/01 11:31:41 1.3 *************** *** 31,47 **** global $WikiDB; // hash of all the DBM file names - ksort($WikiDB); reset($WikiDB); - while (list($key, $file) = each($WikiDB)) { while (($dbi[$key] = @dbmopen($file, "c")) < 1) { if ($numattempts > MAX_DBM_ATTEMPTS) { ExitWiki("Cannot open database '$key' : '$file', giving up."); } - $numattempts++; sleep(1); } } - return $dbi; } --- 31,44 ---- global $WikiDB; // hash of all the DBM file names reset($WikiDB); while (list($key, $file) = each($WikiDB)) { while (($dbi[$key] = @dbmopen($file, "c")) < 1) { + $numattempts++; if ($numattempts > MAX_DBM_ATTEMPTS) { ExitWiki("Cannot open database '$key' : '$file', giving up."); } sleep(1); } } return $dbi; } *************** *** 49,57 **** function CloseDataBase($dbi) { - - ksort($dbi); reset($dbi); while (list($dbmfile, $dbihandle) = each($dbi)) { ! dbmclose($dbi[$dbihandle]); } return; --- 46,52 ---- function CloseDataBase($dbi) { reset($dbi); while (list($dbmfile, $dbihandle) = each($dbi)) { ! dbmclose($dbihandle); } return; *************** *** 202,212 **** } - function cmp($a,$b) { - if ($a == $b) return 0; - return ($a > $b) ? -1 : 1; - } function InitMostPopular($dbi, $limit) { - // iterate through the whole dbm file for hit counts // sort the results highest to lowest, and return --- 197,202 ---- *************** *** 214,218 **** $pagename = dbmfirstkey($dbi['hitcount']); - $res[$pagename] = dbmfetch($dbi['hitcount'], $pagename); --- 204,207 ---- *************** *** 222,226 **** } ! uasort($res, cmp); return($res); } --- 211,215 ---- } ! arsort($res); return($res); } *************** *** 241,245 **** "pagename" => $pagename ); ! $dbm_mostpopular_cntr++; return $nextpage; } else { --- 230,234 ---- "pagename" => $pagename ); ! // $dbm_mostpopular_cntr++; return $nextpage; } else { Index: diff.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/diff.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** diff.php 2000/10/20 11:42:52 1.3 --- diff.php 2000/11/01 11:31:41 1.4 *************** *** 29,32 **** --- 29,33 ---- { var $edits; // List of editing operation to convert XV to YV. + var $xv = array(), $yv = array(); function _WikiDiffEngine ($from_lines, $to_lines) *************** *** 50,53 **** --- 51,57 ---- $n_to -= $skip; + $xlines = array(); + $ylines = array(); + // Ignore lines which do not exist in both files. for ($x = 0; $x < $n_from; $x++) *************** *** 57,61 **** $line = $to_lines[$y + $skip]; $ylines[] = $line; ! if ( ($this->ychanged[$y] = ! $xhash[$line]) ) continue; $yhash[$line] = 1; --- 61,65 ---- $line = $to_lines[$y + $skip]; $ylines[] = $line; ! if ( ($this->ychanged[$y] = empty($xhash[$line])) ) continue; $yhash[$line] = 1; *************** *** 67,72 **** $line = $from_lines[$x + $skip]; $xlines[] = $line; ! if ( ($this->xchanged[$x] = ! $yhash[$line]) ) ! continue; $this->xv[] = $line; $this->xind[] = $x; --- 71,77 ---- $line = $from_lines[$x + $skip]; $xlines[] = $line; ! if ( ($this->xchanged[$x] = empty($yhash[$line])) ) ! continue; // fixme? what happens to yhash/xhash when ! // there are two identical lines?? $this->xv[] = $line; $this->xind[] = $x; *************** *** 98,101 **** --- 103,107 ---- // Skip matching "snake". $x0 = $x; + $ncopy = 0; while ( $x < $n_from && $y < $n_to && !$this->xchanged[$x] && !$this->ychanged[$y]) *************** *** 110,113 **** --- 116,120 ---- // Find deletes. $x0 = $x; + $ndelete = 0; while ($x < $n_from && $this->xchanged[$x]) { *************** *** 127,131 **** } } ! if ($endskip) $this->edits[] = $endskip; } --- 134,138 ---- } } ! if (!empty($endskip)) $this->edits[] = $endskip; } *************** *** 354,358 **** // Find the end of this run of changes. ! while ($changed[++$i]) continue; while ($other_changed[$j]) --- 361,365 ---- // Find the end of this run of changes. ! while (isset($changed[++$i])) continue; while ($other_changed[$j]) *************** *** 387,391 **** * CORRESPONDING == LEN means no such point has been found. */ ! $corresponding = $other_changed[$j - 1] ? $i : $len; /* --- 394,398 ---- * CORRESPONDING == LEN means no such point has been found. */ ! $corresponding = empty($other_changed[$j - 1]) ? $len : $i; /* *************** *** 794,797 **** --- 801,805 ---- function _format ($edits, $from_lines) { + $html = ''; $x = 0; $y = 0; $xlim = sizeof($from_lines); *************** *** 807,811 **** { $ncopy = 0; ! if (!$hunk) { // Start of an output hunk. --- 815,819 ---- { $ncopy = 0; ! if (empty($hunk)) { // Start of an output hunk. *************** *** 836,840 **** $next = next($edits); ! if ($hunk) { if ( !$next || $ncopy > 2 * $this->context_lines) --- 844,848 ---- $next = next($edits); ! if (!empty($hunk)) { if ( !$next || $ncopy > 2 * $this->context_lines) *************** *** 887,890 **** --- 895,899 ---- function _emit_lines($lines, $prefix, $color) { + $html = ''; reset($lines); while (list ($junk, $line) = each($lines)) *************** *** 914,925 **** for (reset($hunks); $hunk = current($hunks); next($hunks)) { ! if ($lines = $hunk['c']) ! $html .= $this->_emit_lines($lines, $this->context_prefix, '#ffffff'); ! if ($lines = $hunk['d']) ! $html .= $this->_emit_lines($lines, $this->deletes_prefix, '#ccffcc'); ! if ($lines = $hunk['a']) ! $html .= $this->_emit_lines($lines, $this->adds_prefix, '#ffcccc'); } --- 923,934 ---- for (reset($hunks); $hunk = current($hunks); next($hunks)) { ! if (!empty($hunk['c'])) ! $html .= $this->_emit_lines($hunk['c'], $this->context_prefix, '#ffffff'); ! if (!empty($hunk['d'])) ! $html .= $this->_emit_lines($hunk['d'], $this->deletes_prefix, '#ccffcc'); ! if (!empty($hunk['a'])) ! $html .= $this->_emit_lines($hunk['a'], $this->adds_prefix, '#ffcccc'); } *************** *** 990,999 **** if (is_array($wiki)) { $html .= "<td>"; ! $html .= sprintf(gettext ("version %s"), $wiki[version]); $html .= "</td><td>"; $html .= sprintf(gettext ("last modified on %s"), date($datetimeformat, $wiki['lastmodified'])); $html .= "</td><td>"; ! $html .= sprintf (gettext ("by %s"), $wiki[author]); $html .= "</td>"; } else { --- 999,1008 ---- if (is_array($wiki)) { $html .= "<td>"; ! $html .= sprintf(gettext ("version %s"), $wiki['version']); $html .= "</td><td>"; $html .= sprintf(gettext ("last modified on %s"), date($datetimeformat, $wiki['lastmodified'])); $html .= "</td><td>"; ! $html .= sprintf (gettext ("by %s"), $wiki['author']); $html .= "</td>"; } else { *************** *** 1008,1017 **** if (is_array($archive)) { $html .= "<td>"; ! $html .= sprintf(gettext ("version %s"), $archive[version]); $html .= "</td><td>"; $html .= sprintf(gettext ("last modified on %s"), date($datetimeformat, $archive['lastmodified'])); $html .= "</td><td>"; ! $html .= sprintf(gettext ("by %s"), $archive[author]); $html .= "</td>"; } else { --- 1017,1026 ---- if (is_array($archive)) { $html .= "<td>"; ! $html .= sprintf(gettext ("version %s"), $archive['version']); $html .= "</td><td>"; $html .= sprintf(gettext ("last modified on %s"), date($datetimeformat, $archive['lastmodified'])); $html .= "</td><td>"; ! $html .= sprintf(gettext ("by %s"), $archive['author']); $html .= "</td>"; } else { Index: display.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/display.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** display.php 2000/10/19 21:36:50 1.3 --- display.php 2000/11/01 11:31:41 1.4 *************** *** 9,13 **** // if it wasn't this file would not have been included ! if ($argv[0]) { $pagename = rawurldecode($argv[0]); } else { --- 9,13 ---- // if it wasn't this file would not have been included ! if (!empty($argv[0])) { $pagename = rawurldecode($argv[0]); } else { Index: editpage.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/editpage.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** editpage.php 2000/10/26 15:38:38 1.5 --- editpage.php 2000/11/01 11:31:41 1.6 *************** *** 38,42 **** $textarea = implode("\n", $pagehash["content"]); ! if ($copy) { // $cdbi = OpenDataBase($WikiPageStore); $currentpage = RetrievePage($dbi, $pagename, $WikiPageStore); --- 38,42 ---- $textarea = implode("\n", $pagehash["content"]); ! if (isset($copy)) { // $cdbi = OpenDataBase($WikiPageStore); $currentpage = RetrievePage($dbi, $pagename, $WikiPageStore); Index: pageinfo.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/pageinfo.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pageinfo.php 2000/10/24 09:55:18 1.4 --- pageinfo.php 2000/11/01 11:31:41 1.5 *************** *** 7,11 **** $encname = htmlspecialchars($info); ! $enter .= gettext ("Enter a page name"); $go = gettext ("Go"); $html = "<form action=\"$ScriptUrl\" METHOD=GET>\n" . --- 7,11 ---- $encname = htmlspecialchars($info); ! $enter = gettext ("Enter a page name"); $go = gettext ("Go"); $html = "<form action=\"$ScriptUrl\" METHOD=GET>\n" . *************** *** 15,19 **** "<input type=checkbox name=showpagesource"; ! if ($showpagesource == "on") { $html .= " checked"; } --- 15,19 ---- "<input type=checkbox name=showpagesource"; ! if (isset($showpagesource) && ($showpagesource == "on")) { $html .= " checked"; } *************** *** 30,34 **** function ViewpageProps($name, $pagestore) { ! global $dbi, $showpagesource, $datetimeformat; $pagehash = RetrievePage($dbi, $name, $pagestore); --- 30,34 ---- function ViewpageProps($name, $pagestore) { ! global $dbi, $showpagesource, $datetimeformat, $FieldSeparator; $pagehash = RetrievePage($dbi, $name, $pagestore); Index: savepage.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/savepage.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** savepage.php 2000/10/26 15:47:51 1.4 --- savepage.php 2000/11/01 11:31:41 1.5 *************** *** 86,90 **** // convert spaces to tabs at user request ! if ($convert) { $pagehash["content"] = CookSpaces($pagehash["content"]); } --- 86,90 ---- // convert spaces to tabs at user request ! if (isset($convert)) { $pagehash["content"] = CookSpaces($pagehash["content"]); } Index: stdlib.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** stdlib.php 2000/10/31 19:23:03 1.7 --- stdlib.php 2000/11/01 11:31:41 1.8 *************** *** 88,92 **** { global $ScriptUrl, $AllowedProtocols, $templates; ! global $datetimeformat, $dbi, $logo; if (!is_array($hash)) --- 88,92 ---- { global $ScriptUrl, $AllowedProtocols, $templates; ! global $datetimeformat, $dbi, $logo, $FieldSeparator; if (!is_array($hash)) *************** *** 133,137 **** } ! if ($hash['copy']) { $page = str_replace("#$FieldSeparator#IFCOPY#$FieldSeparator#", '', $page); --- 133,137 ---- } ! if (isset($hash['copy'])) { $page = str_replace("#$FieldSeparator#IFCOPY#$FieldSeparator#", '', $page); *************** *** 216,220 **** class Stack { ! var $items; var $size = 0; --- 216,220 ---- class Stack { ! var $items = array(); var $size = 0; *************** *** 238,242 **** function top() { ! return $this->items[$this->size - 1]; } --- 238,245 ---- function top() { ! if($this->size) ! return $this->items[$this->size - 1]; ! else ! return ''; } *************** *** 396,400 **** // copy the rest of the page into the new array $pagename = preg_quote($pagename); ! for (; $i < ($numlines + 1); $i++) { // skip previous entry for $pagename if (preg_match("|\[$pagename\]|", $recentchanges["content"][$i])) { --- 399,403 ---- // copy the rest of the page into the new array $pagename = preg_quote($pagename); ! for (; $i < $numlines; $i++) { // skip previous entry for $pagename if (preg_match("|\[$pagename\]|", $recentchanges["content"][$i])) { *************** *** 493,497 **** $link = ParseAndLink($brktlinks[0][$i]); if($link['type'] == 'wiki' || $link['type'] == 'wiki-unknown') ! $wikilinks[$brktlinks[1][$i]]++; $brktlink = preg_quote($brktlinks[0][$i]); --- 496,500 ---- $link = ParseAndLink($brktlinks[0][$i]); if($link['type'] == 'wiki' || $link['type'] == 'wiki-unknown') ! $wikilinks[$brktlinks[1][$i]] = 1; $brktlink = preg_quote($brktlinks[0][$i]); *************** *** 500,506 **** if (preg_match_all("/!?$WikiNameRegexp/", $line, $link)) { ! for ($i = 0; $link[0][$i]; $i++) { if($link[0][$i][0] <> '!') ! $wikilinks[$link[0][$i]]++; } } --- 503,509 ---- if (preg_match_all("/!?$WikiNameRegexp/", $line, $link)) { ! for ($i = 0; isset($link[0][$i]); $i++) { if($link[0][$i][0] <> '!') ! $wikilinks[$link[0][$i]] = 1; } } |