From: <var...@us...> - 2011-03-05 17:05:39
|
Revision: 7964 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7964&view=rev Author: vargenau Date: 2011-03-05 17:05:30 +0000 (Sat, 05 Mar 2011) Log Message: ----------- No tabs Modified Paths: -------------- trunk/lib/AccessLog.php trunk/lib/ArchiveCleaner.php trunk/lib/AtomParser.php trunk/lib/BlockParser.php trunk/lib/CachedMarkup.php trunk/lib/Captcha.php trunk/lib/DbSession.php trunk/lib/DbaDatabase.php trunk/lib/DbaListSet.php trunk/lib/DbaPartition.php trunk/lib/EditToolbar.php trunk/lib/ErrorManager.php trunk/lib/ExternalReferrer.php trunk/lib/FileFinder.php trunk/lib/Google.php trunk/lib/HtmlElement.php trunk/lib/HtmlElement5.php trunk/lib/HtmlParser.php trunk/lib/HttpClient.php trunk/lib/InlineParser.php trunk/lib/MailNotify.php trunk/lib/PageList.php trunk/lib/PagePerm.php trunk/lib/PageType.php trunk/lib/RSSWriter091.php trunk/lib/Request.php trunk/lib/RssParser.php trunk/lib/RssWriter.php trunk/lib/RssWriter2.php trunk/lib/SemanticWeb.php trunk/lib/SpamBlocklist.php trunk/lib/Template.php trunk/lib/TextSearchQuery.php trunk/lib/Units.php trunk/lib/WikiCallback.php trunk/lib/WikiDB.php trunk/lib/WikiGroup.php trunk/lib/WikiPlugin.php trunk/lib/WikiPluginCached.php trunk/lib/WikiTheme.php trunk/lib/WikiUser.php trunk/lib/WikiUserNew.php trunk/lib/WysiwygEdit.php trunk/lib/XmlElement.php trunk/lib/XmlParser.php trunk/lib/XmlRpcClient.php trunk/lib/XmlRpcServer.php trunk/lib/config.php trunk/lib/diff3.php trunk/lib/difflib.php trunk/lib/display.php trunk/lib/editpage.php trunk/lib/fortune.php trunk/lib/fpdf.php trunk/lib/gif.php trunk/lib/imagecache.php trunk/lib/imdb.php trunk/lib/install.php trunk/lib/loadsave.php trunk/lib/main.php trunk/lib/pdf.php trunk/lib/prepend.php trunk/lib/spam_babycart.php trunk/lib/stdlib.php trunk/lib/upgrade.php trunk/lib/ziplib.php trunk/tests/CompatInfo.php trunk/tests/unit_test_backend_cvs.php trunk/uploads/index.php Modified: trunk/lib/AccessLog.php =================================================================== --- trunk/lib/AccessLog.php 2011-03-04 16:43:43 UTC (rev 7963) +++ trunk/lib/AccessLog.php 2011-03-05 17:05:30 UTC (rev 7964) @@ -57,7 +57,7 @@ if (!$request->_dbi->isSQL()) { trigger_error("Unsupported database backend for ACCESS_LOG_SQL.\nNeed DATABASE_TYPE=SQL or ADODB or PDO"); } else { - global $DBParams; + global $DBParams; //$this->_dbi =& $request->_dbi; $this->logtable = (!empty($DBParams['prefix']) ? $DBParams['prefix'] : '')."accesslog"; } @@ -126,8 +126,8 @@ if ($this->logtable) { // mysql specific only: return $this->read_sql("request_host=".$this->_dbi->quote($host) - ." AND time_stamp > ". (time()-$since_minutes*60) - ." ORDER BY time_stamp DESC"); + ." AND time_stamp > ". (time()-$since_minutes*60) + ." ORDER BY time_stamp DESC"); } else { $iter = new WikiDB_Array_generic_iter(); $logs =& $iter->_array; @@ -160,7 +160,7 @@ $entry = new Request_AccessLogEntry($this); $re = '/^(\S+)\s(\S+)\s(\S+)\s\[(.+?)\] "([^"]+)" (\d+) (\d+) "([^"]*)" "([^"]*)"$/'; if (preg_match($re, $s, $m)) { - list(,$entry->host, $entry->ident, $entry->user, $entry->time, + list(,$entry->host, $entry->ident, $entry->user, $entry->time, $entry->request, $entry->status, $entry->size, $entry->referer, $entry->user_agent) = $m; } @@ -176,8 +176,8 @@ return $this->sqliter->next(); } function _read_sql_query($where='') { - global $request; - $dbh =& $request->_dbi; + global $request; + $dbh =& $request->_dbi; $log_tbl =& $this->logtable; return $dbh->genericSqlIter("SELECT *,request_uri as request,request_time as time,remote_user as user," ."remote_host as host,agent as user_agent" @@ -187,8 +187,8 @@ /* done in request->finish() before the db is closed */ function write_sql() { - global $request; - $dbh =& $request->_dbi; + global $request; + $dbh =& $request->_dbi; if (isset($this->entries) and $dbh and $dbh->isOpen()) foreach ($this->entries as $entry) { $entry->write_sql(); @@ -236,7 +236,7 @@ $this->logfile = $accesslog->logfile; $this->time = time(); $this->status = 200; // see setStatus() - $this->size = 0; // see setSize() + $this->size = 0; // see setSize() } /** @@ -350,7 +350,7 @@ /* This is better been done by apache mod_log_sql */ /* If ACCESS_LOG_SQL & 2 we do write it by our own */ function write_sql() { - global $request; + global $request; $dbh =& $request->_dbi; if ($dbh and $dbh->isOpen() and $this->_accesslog->logtable) { @@ -365,7 +365,7 @@ if (!empty($args['pref']['passwd2'])) $args['pref']['passwd2'] = '<not displayed>'; $this->request_args = substr(serialize($args),0,254); // if VARCHAR(255) is used. } else { - $this->request_args = $request->get('QUERY_STRING'); + $this->request_args = $request->get('QUERY_STRING'); } $this->request_method = $request->get('REQUEST_METHOD'); $this->request_uri = $request->get('REQUEST_URI'); Modified: trunk/lib/ArchiveCleaner.php =================================================================== --- trunk/lib/ArchiveCleaner.php 2011-03-04 16:43:43 UTC (rev 7963) +++ trunk/lib/ArchiveCleaner.php 2011-03-05 17:05:30 UTC (rev 7964) @@ -1,19 +1,19 @@ -<?php +<?php // $Id$ /* Copyright (C) 2002 Geoffrey T. Dairiki <da...@da...> * * This file is part of PhpWiki. - * + * * PhpWiki is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * PhpWiki is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with PhpWiki; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -24,7 +24,7 @@ function ArchiveCleaner ($expire_params) { $this->expire_params = $expire_params; } - + function isMergeable($revision) { if ( ! $revision->get('is_minor_edit') ) return false; @@ -43,20 +43,20 @@ while ($page = $iter->next()) $this->cleanPageRevisions($page); } - + function cleanPageRevisions($page) { $INFINITY = 0x7fffffff; $expire = &$this->expire_params; foreach (array('major', 'minor', 'author') as $class) $counter[$class] = new ArchiveCleaner_Counter($expire[$class]); - // shortcut to keep all - if (($counter['minor']->min_keep == $INFINITY) + // shortcut to keep all + if (($counter['minor']->min_keep == $INFINITY) and ($counter['major']->min_keep == $INFINITY)) return; $authors_seen = array(); - + $current = $page->getCurrentRevision(false); for ( $revision = $page->getRevisionBefore($current,false); @@ -117,11 +117,11 @@ if ($this->min_age > $this->max_age) $this->min_age = $this->max_age; - + $this->now = time(); $this->count = 0; $this->previous_supplanted = false; - + } function computeAge($revision) { @@ -148,14 +148,14 @@ $this->previous_supplanted = $supplanted; return ($this->now - $supplanted) / (24 * 3600); } - + function keep($revision) { - $INFINITY = 0x7fffffff; - if ($this->min_keep == $INFINITY) - return true; + $INFINITY = 0x7fffffff; + if ($this->min_keep == $INFINITY) + return true; $count = ++$this->count; $age = $this->computeAge($revision); - + if ($count > $this->max_keep) return false; if ($age <= $this->min_age || $count <= $this->min_keep) @@ -170,5 +170,5 @@ // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> Modified: trunk/lib/AtomParser.php =================================================================== --- trunk/lib/AtomParser.php 2011-03-04 16:43:43 UTC (rev 7963) +++ trunk/lib/AtomParser.php 2011-03-05 17:05:30 UTC (rev 7964) @@ -23,7 +23,7 @@ * This class is a poor-man Atom parser, it does no validation of the feed. * The content of an entry ("payload") is not parsed but rather returned "as-is", * as its format can be text, html or xhtml. - * + * * @author: Sébastien Le Callonnec */ require_once('lib/XmlParser.php'); @@ -44,7 +44,7 @@ var $icon = ''; var $rights = ''; var $logo = ''; - + var $categories = array(); var $authors = array(); @@ -64,7 +64,7 @@ var $id = ''; var $links = array(); var $summary = ''; - + var $inside_content = false; var $content = ''; @@ -165,7 +165,7 @@ function cdata($parser, $data) { global $current_tag, $current_attrs; - + if ($this->inside_content) { $this->content .= $data; } else { @@ -244,7 +244,7 @@ return trim($element); } } - + function serialize_tag($tag_name, $attributes) { $tag = "<" . $tag_name; foreach ($attributes as $k => $v) { Modified: trunk/lib/BlockParser.php =================================================================== --- trunk/lib/BlockParser.php 2011-03-04 16:43:43 UTC (rev 7963) +++ trunk/lib/BlockParser.php 2011-03-05 17:05:30 UTC (rev 7964) @@ -93,11 +93,11 @@ * @return object A RegexpSet_match object, or false if no match. */ function match ($text) { - if (!is_string($text)) return false; + if (!is_string($text)) return false; if (! preg_match($this->_re, $text, $m)) { return false; } - + $match = new AnchoredRegexpSet_match; $match->postmatch = substr($text, strlen($m[0])); $match->match = $m[1]; @@ -136,7 +136,7 @@ if (! preg_match($pat, $text, $m)) { return false; } - + $match = new AnchoredRegexpSet_match; $match->postmatch = substr($text, strlen($m[0])); $match->match = $m[1]; @@ -146,11 +146,11 @@ } - + class BlockParser_Input { function BlockParser_Input ($text) { - + // Expand leading tabs. // FIXME: do this better. // @@ -182,14 +182,14 @@ } return $this->_atSpace; } - + function currentLine () { if ($this->_pos >= count($this->_lines)) { return false; } return $this->_lines[$this->_pos]; } - + function nextLine () { $this->_atSpace = $this->_lines[$this->_pos++] === ''; if ($this->_pos >= count($this->_lines)) { @@ -202,7 +202,7 @@ $this->_atSpace = ($this->_lines[$this->_pos] === ''); $this->_pos++; } - + function getPos () { return array($this->_pos, $this->_atSpace); } @@ -225,7 +225,7 @@ else return "<EOF>"; } - + function _debug ($tab, $msg) { //return ; $where = $this->where(); @@ -233,7 +233,7 @@ printXML(HTML::div("$tab $msg: at: '", HTML::tt($where), "'")); - flush(); + flush(); } } @@ -271,7 +271,7 @@ else return $this->_atSpace; } - + function currentLine () { return $this->_line; } @@ -296,7 +296,7 @@ function advance () { $this->nextLine(); } - + function getPos () { return array($this->_line, $this->_atSpace, $this->_input->getPos()); } @@ -306,7 +306,7 @@ $this->_atSpace = $pos[1]; $this->_input->setPos($pos[2]); } - + function getPrefix () { assert ($this->_line !== false); $line = $this->_input->currentLine(); @@ -322,8 +322,8 @@ return $this->_input->where(); } } - + class Block_HtmlElement extends HtmlElement { function Block_HtmlElement($tag /*, ... */) { @@ -335,7 +335,7 @@ } class ParsedBlock extends Block_HtmlElement { - + function ParsedBlock (&$input, $tag = 'div', $attr = false) { $this->Block_HtmlElement($tag, $attr); $this->_initBlockTypes(); @@ -362,22 +362,22 @@ // FIXME: hackish. This should only be called once. function _initBlockTypes () { - // better static or global? - static $_regexpset, $_block_types; + // better static or global? + static $_regexpset, $_block_types; - if (!is_object($_regexpset)) { + if (!is_object($_regexpset)) { // nowiki_wikicreole must be before template_plugin - $Block_types = array - ('nowiki_wikicreole', 'template_plugin', 'placeholder', 'oldlists', 'list', 'dl', + $Block_types = array + ('nowiki_wikicreole', 'template_plugin', 'placeholder', 'oldlists', 'list', 'dl', 'table_dl', 'table_wikicreole', 'table_mediawiki', 'blockquote', 'heading', 'heading_wikicreole', 'hr', 'pre', 'email_blockquote', 'wikicreole_indented', - 'plugin', 'plugin_wikicreole', 'p'); + 'plugin', 'plugin_wikicreole', 'p'); // insert it before p! if (ENABLE_MARKUP_DIVSPAN) { - array_pop($Block_types); - $Block_types[] = 'divspan'; - $Block_types[] = 'p'; + array_pop($Block_types); + $Block_types[] = 'divspan'; + $Block_types[] = 'p'; } foreach ($Block_types as $type) { $class = "Block_$type"; @@ -389,7 +389,7 @@ $_regexpset = $this->_regexpset; $_block_types = $this->_block_types; unset($Block_types); - } else { + } else { $this->_regexpset = $_regexpset; $this->_block_types = $_block_types; } @@ -409,9 +409,9 @@ $block = clone($this->_block_types[$m->regexp_ind]); if (DEBUG & _DEBUG_PARSER) $input->_debug('>', get_class($block)); - + if ($block->_match($input, $m)) { - //$block->_text = $line; + //$block->_text = $line; if (DEBUG & _DEBUG_PARSER) $input->_debug('<', get_class($block)); $tight_bottom = ! $input->skipSpace(); @@ -500,12 +500,12 @@ 'blockquote'); return true; } - + function merge ($nextBlock) { if (get_class($nextBlock) == get_class($this)) { assert ($nextBlock->_depth < $this->_depth); $nextBlock->_element->unshiftContent($this->_element); - if (!empty($this->_tight_top)) + if (!empty($this->_tight_top)) $nextBlock->_tight_top = $this->_tight_top; return $nextBlock; } @@ -535,7 +535,7 @@ if (preg_match('/[*#+-o]/', $input->getPrefix())) { return false; } - + $prefix = $m->match; $indent = sprintf("\\ {%d}", strlen($prefix)); @@ -619,13 +619,13 @@ { var $nrows; var $ncols; - + function Block_table_dl_defn ($term, $defn) { $this->XmlContent(); if (!is_array($defn)) $defn = $defn->getContent(); - $this->_next_tight_top = false; // value irrelevant - gets fixed later + $this->_next_tight_top = false; // value irrelevant - gets fixed later $this->_ncols = $this->_ComputeNcols($defn); $this->_nrows = 0; @@ -645,9 +645,9 @@ function setTightness($tight_top, $tight_bot) { $this->_tight_top = $tight_top; - $this->_tight_bot = $tight_bot; + $this->_tight_bot = $tight_bot; } - + function _addToRow ($item) { if (empty($this->_accum)) { $this->_accum = HTML::td(); @@ -663,7 +663,7 @@ $row->setTightness($this->_next_tight_top, $tight_bottom); $this->_next_tight_top = $tight_bottom; - + $this->pushContent($row); $this->_accum = false; $this->_nrows++; @@ -675,7 +675,7 @@ return; $this->_flushRow($table_rows[0]->_tight_top); - + foreach ($table_rows as $subdef) { $this->pushContent($subdef); $this->_nrows += $subdef->nrows(); @@ -690,7 +690,7 @@ else $first_row->unshiftContent($th); } - + function _ComputeNcols ($defn) { $ncols = 2; foreach ($defn as $item) { @@ -722,17 +722,17 @@ } function & firstTR() { - $first = &$this->_content[0]; - if (isa($first, 'Block_table_dl_defn')) - return $first->firstTR(); - return $first; + $first = &$this->_content[0]; + if (isa($first, 'Block_table_dl_defn')) + return $first->firstTR(); + return $first; } function & lastTR() { - $last = &$this->_content[$this->_nrows - 1]; - if (isa($last, 'Block_table_dl_defn')) - return $last->lastTR(); - return $last; + $last = &$this->_content[$this->_nrows - 1]; + if (isa($last, 'Block_table_dl_defn')) + return $last->lastTR(); + return $last; } function setWidth ($ncols) { @@ -774,7 +774,7 @@ function _setTightness($top, $bot) { $this->_content[0]->setTightness($top, $bot); } - + function finish () { $defs = &$this->_content; @@ -782,7 +782,7 @@ $ncols = 0; foreach ($defs as $defn) $ncols = max($ncols, $defn->ncols()); - + foreach ($defs as $key => $defn) $defs[$key]->setWidth($ncols); @@ -807,8 +807,8 @@ if (!preg_match('/[*#;]*$/A', $input->getPrefix())) { return false; } - + $prefix = $m->match; $oldindent = '[*#;](?=[#*]|;.*:.*\S)'; $newindent = sprintf('\\ {%d}', strlen($prefix)); @@ -873,7 +873,7 @@ */ echo 'count($this->_content): ', count($this->_content),"\n"; echo "\$this->_content[0]: "; var_dump ($this->_content[0]); - + for ($i=1; $i < min(5, count($this->_content)); $i++) { $c =& $this->_content[$i]; echo '$this->_content[',$i,"]: \n"; @@ -918,26 +918,26 @@ } } $input->advance(); - - if ($m->match == '<nowiki>') - $text = join("<br>\n", $text); - else + + if ($m->match == '<nowiki>') + $text = join("<br>\n", $text); + else $text = join("\n", $text); - + // FIXME: no <img>, <big>, <small>, <sup>, or <sub>'s allowed // in a <pre>. if ($m->match == '<pre>') { $text = TransformInline($text); } - if ($m->match == '<noinclude>') { - $text = TransformText($text); - $this->_element = new Block_HtmlElement('div', false, $text); - } else if ($m->match == '<nowiki>') { + if ($m->match == '<noinclude>') { + $text = TransformText($text); + $this->_element = new Block_HtmlElement('div', false, $text); + } else if ($m->match == '<nowiki>') { $text = TransformInlineNowiki($text); - $this->_element = new Block_HtmlElement('p', false, $text); - } else { + $this->_element = new Block_HtmlElement('p', false, $text); + } else { $this->_element = new Block_HtmlElement('pre', false, $text); - } + } return true; } } @@ -1019,7 +1019,7 @@ } $input->advance(); - $this->_element = new Cached_PluginInvocation($pi); + $this->_element = new Cached_PluginInvocation($pi); return true; } } @@ -1207,7 +1207,7 @@ { var $_attr = array('class' => 'mail-style-quote'); var $_re = '>\ ?'; - + function _match (&$input, $m) { //$indent = str_replace(' ', '\\ ', $m->match) . '|>$'; $indent = $this->_re; @@ -1244,14 +1244,14 @@ class Block_heading extends BlockMarkup { var $_re = '!{1,3}'; - + function _match (&$input, $m) { $tag = "h" . (5 - strlen($m->match)); $text = TransformInline(trim($m->postmatch)); $input->advance(); $this->_element = new Block_HtmlElement($tag, false, $text); - + return true; } } @@ -1259,7 +1259,7 @@ class Block_heading_wikicreole extends BlockMarkup { var $_re = '={2,6}'; - + function _match (&$input, $m) { $tag = "h" . strlen($m->match); // Remove spaces @@ -1270,7 +1270,7 @@ $input->advance(); $this->_element = new Block_HtmlElement($tag, false, $text); - + return true; } } @@ -1315,12 +1315,12 @@ var $_re = '<(?im)(?: div|span)(?:[^>]*)?>'; function _match (&$input, $m) { - if (substr($m->match,1,4) == 'span') { - $tag = 'span'; - } else { - $tag = 'div'; - } - // without last > + if (substr($m->match,1,4) == 'span') { + $tag = 'span'; + } else { + $tag = 'div'; + } + // without last > $argstr = substr(trim(substr($m->match,strlen($tag)+1)),0,-1); $pos = $input->getPos(); $pi = $content = $m->postmatch; @@ -1339,22 +1339,22 @@ $input->advance(); if (strstr($content, "\n")) $content = TransformText($content); - else + else $content = TransformInline($content); if (!$argstr) $args = false; else { $args = array(); while (preg_match("/(\w+)=(.+)/", $argstr, $m)) { - $k = $m[1]; $v = $m[2]; - if (preg_match("/^\"(.+?)\"(.*)$/", $v, $m)) { - $v = $m[1]; - $argstr = $m[2]; - } else { - preg_match("/^(\s+)(.*)$/", $v, $m); - $v = $m[1]; - $argstr = $m[2]; - } + $k = $m[1]; $v = $m[2]; + if (preg_match("/^\"(.+?)\"(.*)$/", $v, $m)) { + $v = $m[1]; + $argstr = $m[2]; + } else { + preg_match("/^(\s+)(.*)$/", $v, $m); + $v = $m[1]; + $argstr = $m[2]; + } if (trim($k) and trim($v)) $args[$k] = $v; } } @@ -1382,7 +1382,7 @@ } // WikiCreole /*if (!empty($markup) && $markup == 3) { - $text = ConvertFromCreole($text); + $text = ConvertFromCreole($text); }*/ // Expand leading tabs. $text = expand_tabs($text); @@ -1413,5 +1413,5 @@ // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> Modified: trunk/lib/CachedMarkup.php =================================================================== --- trunk/lib/CachedMarkup.php 2011-03-04 16:43:43 UTC (rev 7963) +++ trunk/lib/CachedMarkup.php 2011-03-05 17:05:30 UTC (rev 7964) @@ -27,12 +27,12 @@ function CacheableMarkup($content, $basepage) { $this->_basepage = $basepage; - $this->_buf = ''; - $this->_content = array(); - $this->_append($content); - if ($this->_buf != '') - $this->_content[] = $this->_buf; - unset($this->_buf); + $this->_buf = ''; + $this->_content = array(); + $this->_append($content); + if ($this->_buf != '') + $this->_content[] = $this->_buf; + unset($this->_buf); } function pack() { @@ -88,15 +88,15 @@ E_USER_WARNING); return false; } - + /** Get names of wikipages linked to. * * @return array of hashes { linkto=>pagename, relation=>pagename } */ function getWikiPageLinks() { - $links = array(); - foreach ($this->_content as $item) { - if (!isa($item, 'Cached_DynamicContent')) + $links = array(); + foreach ($this->_content as $item) { + if (!isa($item, 'Cached_DynamicContent')) continue; if (!($item_links = $item->getWikiPageLinks($this->_basepage))) continue; @@ -104,8 +104,8 @@ } // array_unique has a bug with hashes! // set_links checks for duplicates, array_merge does not - //return array_unique($links); - return $links; + //return array_unique($links); + return $links; } /** Get link info. @@ -116,63 +116,63 @@ * Returns an array of hashes. */ function getLinkInfo() { - $link = array(); - foreach ($this->_content as $link) { - if (! isa($link, 'Cached_Link')) - continue; - $info = $link->getLinkInfo($this->_basepage); - $links[$info->href] = $info; - } - return array_values($links); + $link = array(); + foreach ($this->_content as $link) { + if (! isa($link, 'Cached_Link')) + continue; + $info = $link->getLinkInfo($this->_basepage); + $links[$info->href] = $info; } + return array_values($links); + } function _append($item) { - if (is_array($item)) { - foreach ($item as $subitem) - $this->_append($subitem); - } - elseif (!is_object($item)) { - $this->_buf .= $this->_quote((string) $item); - } - elseif (isa($item, 'Cached_DynamicContent')) { - if ($this->_buf) { - $this->_content[] = $this->_buf; - $this->_buf = ''; - } - $this->_content[] = $item; - } - elseif (isa($item, 'XmlElement')) { - if ($item->isEmpty()) { - $this->_buf .= $item->emptyTag(); - } - else { - $this->_buf .= $item->startTag(); - foreach ($item->getContent() as $subitem) - $this->_append($subitem); - $this->_buf .= "</$item->_tag>"; + if (is_array($item)) { + foreach ($item as $subitem) + $this->_append($subitem); + } + elseif (!is_object($item)) { + $this->_buf .= $this->_quote((string) $item); + } + elseif (isa($item, 'Cached_DynamicContent')) { + if ($this->_buf) { + $this->_content[] = $this->_buf; + $this->_buf = ''; + } + $this->_content[] = $item; + } + elseif (isa($item, 'XmlElement')) { + if ($item->isEmpty()) { + $this->_buf .= $item->emptyTag(); + } + else { + $this->_buf .= $item->startTag(); + foreach ($item->getContent() as $subitem) + $this->_append($subitem); + $this->_buf .= "</$item->_tag>"; if (!$this->getDescription() and $item->getTag() == 'p') { // performance: when is this really needed? $this->_glean_description($item->asString()); } - } - if (!$item->isInlineElement()) - $this->_buf .= "\n"; - } - elseif (isa($item, 'XmlContent')) { - foreach ($item->getContent() as $item) - $this->_append($item); - } - elseif (method_exists($item, 'asXML')) { - $this->_buf .= $item->asXML(); - } - elseif (method_exists($item, 'asString')) { - $this->_buf .= $this->_quote($item->asString()); - } - else { - $this->_buf .= sprintf("==Object(%s)==", get_class($item)); - } + } + if (!$item->isInlineElement()) + $this->_buf .= "\n"; } + elseif (isa($item, 'XmlContent')) { + foreach ($item->getContent() as $item) + $this->_append($item); + } + elseif (method_exists($item, 'asXML')) { + $this->_buf .= $item->asXML(); + } + elseif (method_exists($item, 'asString')) { + $this->_buf .= $this->_quote($item->asString()); + } + else { + $this->_buf .= sprintf("==Object(%s)==", get_class($item)); + } + } function _glean_description($text) { static $two_sentences; @@ -181,7 +181,7 @@ . ".*" . "[.?!][\")]*\s*[\"(]*([[:upper:])]|$)"; } - + if (!isset($this->_description) and preg_match("/$two_sentences/sx", $text)) $this->_description = preg_replace("/\s*\n\s*/", " ", trim($text)); } @@ -204,12 +204,12 @@ function getDescription () { return isset($this->_description) ? $this->_description : ''; } - + function asXML () { - $xml = ''; + $xml = ''; $basepage = $this->_basepage; - - foreach ($this->_content as $item) { + + foreach ($this->_content as $item) { if (is_string($item)) { $xml .= $item; } @@ -224,15 +224,15 @@ else { $xml .= $item->asXML(); } - } - return $xml; } + return $xml; + } function printXML () { $basepage = $this->_basepage; // _content might be changed from a plugin (CreateToc) - for ($i=0; $i < count($this->_content); $i++) { - $item = $this->_content[$i]; + for ($i=0; $i < count($this->_content); $i++) { + $item = $this->_content[$i]; if (is_string($item)) { print $item; } @@ -240,8 +240,8 @@ check_php_version(5) ? 'Cached_DynamicContent' : 'cached_dynamiccontent')) - { // give the content the chance to know about itself or even - // to change itself + { // give the content the chance to know about itself or even + // to change itself $val = $item->expand($basepage, $this); if ($val) $val->printXML(); else trigger_error('empty item ' . print_r($item, true)); @@ -249,8 +249,8 @@ else { $item->printXML(); } - } } + } } /** @@ -262,7 +262,7 @@ class Cached_DynamicContent { function cache(&$cache) { - $cache[] = $this; + $cache[] = $this; } function expand($basepage, &$obj) { @@ -276,18 +276,18 @@ class XmlRpc_LinkInfo { function XmlRpc_LinkInfo($page, $type, $href, $relation = '') { - $this->page = $page; - $this->type = $type; - $this->href = $href; - $this->relation = $relation; - //$this->pageref = str_replace("/RPC2.php", "/index.php", $href); + $this->page = $page; + $this->type = $type; + $this->href = $href; + $this->relation = $relation; + //$this->pageref = str_replace("/RPC2.php", "/index.php", $href); } } class Cached_Link extends Cached_DynamicContent { function isInlineElement() { - return true; + return true; } /** Get link info (for XML-RPC support) @@ -296,17 +296,17 @@ * (See http://www.ecyrd.com/JSPWiki/Wiki.jsp?page=WikiRPCInterface) */ function getLinkInfo($basepage) { - return new XmlRpc_LinkInfo($this->_getName($basepage), + return new XmlRpc_LinkInfo($this->_getName($basepage), $this->_getType(), $this->_getURL($basepage), $this->_getRelation($basepage)); } - + function _getURL($basepage) { - return $this->_url; + return $this->_url; } function __getRelation($basepage) { - return $this->_relation; + return $this->_relation; } } /* @@ -315,55 +315,55 @@ */ class Cached_InlinedImage extends Cached_DynamicContent { function isInlineElement() { - return true; + return true; } function _getURL($basepage) { - return $this->_url; + return $this->_url; } // TODO: fix interwiki inline links in case of static dumps function expand($basepage, &$markup) { - global $WikiTheme; - $this->_basepage = $basepage; - $label = isset($this->_label) ? $this->_label : false; - if ($WikiTheme->DUMP_MODE) { + global $WikiTheme; + $this->_basepage = $basepage; + $label = isset($this->_label) ? $this->_label : false; + if ($WikiTheme->DUMP_MODE) { // In case of static dumps we need to check if we should // inline the image or not: external: keep link, internal: copy locally - return LinkImage($label); - } else { - return LinkImage($label); - } + return LinkImage($label); + } else { + return LinkImage($label); } + } } class Cached_WikiLink extends Cached_Link { function Cached_WikiLink ($page, $label = false, $anchor = false) { - $this->_page = $page; - /* ":DontStoreLink" */ - if (substr($this->_page,0,1) == ':') { - $this->_page = substr($this->_page,1); - $this->_nolink = true; - } + $this->_page = $page; + /* ":DontStoreLink" */ + if (substr($this->_page,0,1) == ':') { + $this->_page = substr($this->_page,1); + $this->_nolink = true; + } if ($anchor) $this->_anchor = $anchor; if ($label and $label != $page) $this->_label = $label; - $this->_basepage = false; + $this->_basepage = false; } function _getType() { return 'internal'; } - + function getPagename($basepage) { $page = new WikiPageName($this->_page, $basepage); - if ($page->isValid()) return $page->name; - else return false; + if ($page->isValid()) return $page->name; + else return false; } function getWikiPageLinks($basepage) { if ($basepage == '') return false; - if (isset($this->_nolink)) return false; + if (isset($this->_nolink)) return false; if ($link = $this->getPagename($basepage)) return array(array('linkto' => $link)); else @@ -371,41 +371,41 @@ } function _getName($basepage) { - return $this->getPagename($basepage); + return $this->getPagename($basepage); } function _getURL($basepage) { - return WikiURL($this->getPagename($basepage)); - //return WikiURL($this->getPagename($basepage), false, 'abs_url'); + return WikiURL($this->getPagename($basepage)); + //return WikiURL($this->getPagename($basepage), false, 'abs_url'); } function expand($basepage, &$markup) { - global $WikiTheme; - $this->_basepage = $basepage; - $label = isset($this->_label) ? $this->_label : false; - $anchor = isset($this->_anchor) ? (string)$this->_anchor : ''; + global $WikiTheme; + $this->_basepage = $basepage; + $label = isset($this->_label) ? $this->_label : false; + $anchor = isset($this->_anchor) ? (string)$this->_anchor : ''; $page = new WikiPageName($this->_page, $basepage, $anchor); - if ($WikiTheme->DUMP_MODE and !empty($WikiTheme->VALID_LINKS)) { - if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) - return HTML($label ? $label : $page->getName()); - } + if ($WikiTheme->DUMP_MODE and !empty($WikiTheme->VALID_LINKS)) { + if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) + return HTML($label ? $label : $page->getName()); + } if ($page->isValid()) return WikiLink($page, 'auto', $label); - else return HTML($label); + else return HTML($label); } function asXML() { - global $WikiTheme; - $label = isset($this->_label) ? $this->_label : false; - $anchor = isset($this->_anchor) ? (string)$this->_anchor : ''; - //TODO: need basepage for subpages like /Remove (within CreateTOC) + global $WikiTheme; + $label = isset($this->_label) ? $this->_label : false; + $anchor = isset($this->_anchor) ? (string)$this->_anchor : ''; + //TODO: need basepage for subpages like /Remove (within CreateTOC) $page = new WikiPageName($this->_page, $this->_basepage, $anchor); - if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) { - if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) - return $label ? $label : $page->getName(); - } - $link = WikiLink($page, 'auto', $label); - return $link->asXML(); + if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) { + if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) + return $label ? $label : $page->getName(); } + $link = WikiLink($page, 'auto', $label); + return $link->asXML(); + } function asString() { if (isset($this->_label)) @@ -417,54 +417,54 @@ class Cached_WikiLinkIfKnown extends Cached_WikiLink { function Cached_WikiLinkIfKnown ($moniker) { - $this->_page = $moniker; + $this->_page = $moniker; } function expand($basepage, &$markup) { - global $WikiTheme; - if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) { - if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) - return HTML($label ? $label : $page->getName()); - } + global $WikiTheme; + if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) { + if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) + return HTML($label ? $label : $page->getName()); + } return WikiLink($this->_page, 'if_known'); } -} +} class Cached_SpellCheck extends Cached_WikiLink { function Cached_SpellCheck ($word, $suggs) { - $this->_page = $word; - $this->suggestions = $suggs; + $this->_page = $word; + $this->suggestions = $suggs; } function expand($basepage, &$markup) { $link = HTML::a(array('class' => 'spell-wrong', - 'title' => 'SpellCheck: '.join(', ', $this->suggestions), - 'name' => $this->_page), - $this->_page); + 'title' => 'SpellCheck: '.join(', ', $this->suggestions), + 'name' => $this->_page), + $this->_page); return $link; } -} - +} + class Cached_PhpwikiURL extends Cached_DynamicContent { function Cached_PhpwikiURL ($url, $label) { - $this->_url = $url; + $this->_url = $url; if ($label) $this->_label = $label; } function isInlineElement() { - return true; + return true; } function expand($basepage, &$markup) { - global $WikiTheme; + global $WikiTheme; $label = isset($this->_label) ? $this->_label : false; - if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) { - if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) - return HTML($label ? $label : $page->getName()); - } + if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) { + if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) + return HTML($label ? $label : $page->getName()); + } return LinkPhpwikiURL($this->_url, $label, $basepage); } @@ -479,7 +479,7 @@ return $this->_label; return $this->_url; } -} +} /* * Relations (::) are named links to pages. @@ -494,21 +494,21 @@ class Cached_SemanticLink extends Cached_WikiLink { function Cached_SemanticLink ($url, $label=false) { - $this->_url = $url; + $this->_url = $url; if ($label && $label != $url) $this->_label = $label; $this->_expandurl($this->_url); } function isInlineElement() { - return true; + return true; } function getPagename($basepage) { - if (!isset($this->_page)) return false; - $page = new WikiPageName($this->_page, $basepage); - if ($page->isValid()) return $page->name; - else return false; + if (!isset($this->_page)) return false; + $page = new WikiPageName($this->_page, $basepage); + if ($page->isValid()) return $page->name; + else return false; } /* Add relation to the link table. @@ -516,14 +516,14 @@ */ function getWikiPageLinks($basepage) { if ($basepage == '') return false; - if (!isset($this->_page) and isset($this->_attribute)) { + if (!isset($this->_page) and isset($this->_attribute)) { // An attribute: we store it in the basepage now, to fill the cache for page->save // TODO: side-effect free query $page = $GLOBALS['request']->getPage($basepage); $page->setAttribute($this->_relation, $this->_attribute); $this->_page = $basepage; return array(array('linkto' => '', 'relation' => $this->_relation)); - } + } if ($link = $this->getPagename($basepage)) return array(array('linkto' => $link, 'relation' => $this->_relation)); else @@ -535,67 +535,67 @@ if (!preg_match('/^ ([^:]+) (:[:=]) (.+) $/x', $url, $m)) { return HTML::span(array('class' => 'error'), _("BAD semantic relation link")); } - $this->_relation = urldecode($m[1]); + $this->_relation = urldecode($m[1]); $is_attribute = ($m[2] == ':='); if ($is_attribute) { $this->_attribute = urldecode($m[3]); - // since this stored in the markup cache, we are extra sensible - // not to store false empty stuff. - $units = new Units(); + // since this stored in the markup cache, we are extra sensible + // not to store false empty stuff. + $units = new Units(); if (!DISABLE_UNITS and !$units->errcode) - { - $this->_attribute_base = $units->Definition($this->_attribute); - $this->_unit = $units->baseunit($this->_attribute); - } + { + $this->_attribute_base = $units->Definition($this->_attribute); + $this->_unit = $units->baseunit($this->_attribute); + } } else { - $this->_page = urldecode($m[3]); + $this->_page = urldecode($m[3]); } - return $m; + return $m; } function _expand($url, $label = false) { - global $WikiTheme; - $m = $this->_expandurl($url); + global $WikiTheme; + $m = $this->_expandurl($url); $class = 'wiki'; // do not link to the attribute value, but to the attribute $is_attribute = ($m[2] == ':='); - if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) { - if (isset($this->_page) and !in_array($this->_page, $WikiTheme->VALID_LINKS)) - return HTML($label ? $label : ($is_attribute ? $this->_relation : $this->_page)); - } - if ($is_attribute) - $title = isset($this->_attribute_base) - ? sprintf(_("Attribute %s, base value: %s"), $this->_relation, $this->_attribute_base) - : sprintf(_("Attribute %s, value: %s"), $this->_relation, $this->_attribute); + if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) { + if (isset($this->_page) and !in_array($this->_page, $WikiTheme->VALID_LINKS)) + return HTML($label ? $label : ($is_attribute ? $this->_relation : $this->_page)); + } + if ($is_attribute) + $title = isset($this->_attribute_base) + ? sprintf(_("Attribute %s, base value: %s"), $this->_relation, $this->_attribute_base) + : sprintf(_("Attribute %s, value: %s"), $this->_relation, $this->_attribute); if ($label) { return HTML::span - ( - HTML::a(array('href' => WikiURL($is_attribute ? $this->_relation : $this->_page), - 'class' => "wiki ".($is_attribute ? "attribute" : "relation"), - 'title' => $is_attribute - ? $title - : sprintf(_("Relation %s to page %s"), $this->_relation, $this->_page)), - $label) - ); + ( + HTML::a(array('href' => WikiURL($is_attribute ? $this->_relation : $this->_page), + 'class' => "wiki ".($is_attribute ? "attribute" : "relation"), + 'title' => $is_attribute + ? $title + : sprintf(_("Relation %s to page %s"), $this->_relation, $this->_page)), + $label) + ); } elseif ($is_attribute) { return HTML::span - ( - HTML::a(array('href' => WikiURL($this->_relation), - 'class' => "wiki attribute", - 'title' => $title), - $url) - ); + ( + HTML::a(array('href' => WikiURL($this->_relation), + 'class' => "wiki attribute", + 'title' => $title), + $url) + ); } else { return HTML::span - ( - HTML::a(array('href' => WikiURL($this->_relation), - 'class' => "wiki relation"), - $this->_relation), - HTML::span(array('class'=>'relation-symbol'), $m[2]), - HTML::a(array('href' => WikiURL($this->_page), - 'class' => "wiki"), - $this->_page) - ); + ( + HTML::a(array('href' => WikiURL($this->_relation), + 'class' => "wiki relation"), + $this->_relation), + HTML::span(array('class'=>'relation-symbol'), $m[2]), + HTML::a(array('href' => WikiURL($this->_page), + 'class' => "wiki"), + $this->_page) + ); } } @@ -623,8 +623,8 @@ class Cached_SearchHighlight extends Cached_DynamicContent { function Cached_SearchHighlight ($word, $engine) { - $this->_word = $word; - $this->engine = $engine; + $this->_word = $word; + $this->engine = $engine; } function expand($basepage, &$markup) { @@ -632,12 +632,12 @@ 'title' => _("Found by ") . $this->engine), $this->_word); } -} - +} + class Cached_ExternalLink extends Cached_Link { function Cached_ExternalLink($url, $label=false) { - $this->_url = $url; + $this->_url = $url; if ($label && $label != $url) $this->_label = $label; } @@ -645,17 +645,17 @@ function _getType() { return 'external'; } - + function _getName($basepage) { - $label = isset($this->_label) ? $this->_label : false; - return ($label and is_string($label)) ? $label : $this->_url; + $label = isset($this->_label) ? $this->_label : false; + return ($label and is_string($label)) ? $label : $this->_url; } function expand($basepage, &$markup) { global $request; - $label = isset($this->_label) ? $this->_label : false; - $link = LinkURL($this->_url, $label); + $label = isset($this->_label) ? $this->_label : false; + $link = LinkURL($this->_url, $label); if (GOOGLE_LINKS_NOFOLLOW) { // Ignores nofollow when the user who saved the page was authenticated. @@ -675,26 +675,26 @@ } class Cached_InterwikiLink extends Cached_ExternalLink { - + function Cached_InterwikiLink($link, $label=false) { - $this->_link = $link; + $this->_link = $link; if ($label) $this->_label = $label; } function getPagename($basepage) { list ($moniker, $page) = explode (":", $this->_link, 2); - $page = new WikiPageName($page, $basepage); - if ($page->isValid()) return $page->name; - else return false; + $page = new WikiPageName($page, $basepage); + if ($page->isValid()) return $page->name; + else return false; } function getWikiPageLinks($basepage) { if ($basepage == '') return false; - /* ":DontStoreLink" */ - if (substr($this->_link,0,1) == ':') return false; - /* store only links to valid pagenames */ - $dbi = $GLOBALS['request']->getDbh(); + /* ":DontStoreLink" */ + if (substr($this->_link,0,1) == ':') return false; + /* store only links to valid pagenames */ + $dbi = $GLOBALS['request']->getDbh(); if ($link = $this->getPagename($basepage) and $dbi->isWikiPage($link)) { return array(array('linkto' => $link)); } else { @@ -703,31 +703,31 @@ } function _getName($basepage) { - $label = isset($this->_label) ? $this->_label : false; - return ($label and is_string($label)) ? $label : $this->_link; + $label = isset($this->_label) ? $this->_label : false; + return ($label and is_string($label)) ? $label : $this->_link; } - + /* there may be internal interwiki links also */ function _getType() { return $this->getPagename(false) ? 'internal' : 'external'; } function _getURL($basepage) { - $link = $this->expand($basepage, $this); - return $link->getAttr('href'); + $link = $this->expand($basepage, $this); + return $link->getAttr('href'); } function expand($basepage, &$markup) { - global $WikiTheme; - $intermap = getInterwikiMap(); - $label = isset($this->_label) ? $this->_label : false; - //FIXME: check Upload: inlined images - if ($WikiTheme->DUMP_MODE and !empty($WikiTheme->VALID_LINKS)) { - if (!in_array($this->_link, $WikiTheme->VALID_LINKS)) - return HTML($label ? $label : $this->_link); - } - return $intermap->link($this->_link, $label); + global $WikiTheme; + $intermap = getInterwikiMap(); + $label = isset($this->_label) ? $this->_label : false; + //FIXME: check Upload: inlined images + if ($WikiTheme->DUMP_MODE and !empty($WikiTheme->VALID_LINKS)) { + if (!in_array($this->_link, $WikiTheme->VALID_LINKS)) + return HTML($label ? $label : $this->_link); } + return $intermap->link($this->_link, $label); + } function asString() { if (isset($this->_label)) @@ -742,9 +742,9 @@ class Cached_UserLink extends Cached_WikiLink { function expand($basepage, &$markup) { $label = isset($this->_label) ? $this->_label : false; - $anchor = isset($this->_anchor) ? (string)$this->_anchor : ''; + $anchor = isset($this->_anchor) ? (string)$this->_anchor : ''; $page = new WikiPageName($this->_page, $basepage, $anchor); - $link = WikiLink($page, 'auto', $label); + $link = WikiLink($page, 'auto', $label); // $link = HTML::a(array('href' => $PageName)); $link->setContent(PossiblyGlueIconToText('wikiuser', $this->_page)); $link->setAttr('class', 'wikiuser'); @@ -760,8 +760,8 @@ class Cached_PluginInvocation extends Cached_DynamicContent { function Cached_PluginInvocation ($pi) { - $this->_pi = $pi; - $loader = $this->_getLoader(); + $this->_pi = $pi; + $loader = $this->_getLoader(); if (is_array($plugin_cmdline = $loader->parsePI($pi)) and $plugin_cmdline[1]) { $this->pi_name = $plugin_cmdline[0]; // plugin, plugin-form, plugin-list $this->name = $plugin_cmdline[1]->getName(); @@ -771,9 +771,9 @@ function setTightness($top, $bottom) { } - + function isInlineElement() { - return false; + return false; } function expand($basepage, &$markup) { @@ -795,9 +795,9 @@ function & _getLoader() { static $loader = false; - if (!$loader) { + if (!$loader) { include_once('lib/WikiPlugin.php'); - $loader = new WikiPluginLoader; + $loader = new WikiPluginLoader; } return $loader; } @@ -809,5 +809,5 @@ // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> Modified: trunk/lib/Captcha.php =================================================================== --- trunk/lib/Captcha.php 2011-03-04 16:43:43 UTC (rev 7963) +++ trunk/lib/Captcha.php 2011-03-05 17:05:30 UTC (rev 7964) @@ -11,7 +11,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This File is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -35,20 +35,20 @@ function captchaword() { if ( ! $this->request->getSessionVar('captchaword')) { - $this->request->setSessionVar('captchaword', $this->get_word()); - } + $this->request->setSessionVar('captchaword', $this->get_word()); + } return $this->request->getSessionVar('captchaword'); } function Failed () { if ($this->request->getSessionVar('captcha_ok') == true) return false; - + if ( ! array_key_exists ( 'captcha_input', $this->meta ) or ($this->request->getSessionVar('captchaword') and ($this->request->getSessionVar('captchaword') != $this->meta['captcha_input']))) return true; - + $this->request->setSessionVar('captcha_ok', true); return false; } @@ -70,9 +70,9 @@ return $el; } - function get_word () { + function get_word () { if (USE_CAPTCHA_RANDOM_WORD) - return get_dictionary_word(); + return get_dictionary_word(); else return rand_ascii_readable($this->length); // lib/stdlib.php } @@ -99,10 +99,10 @@ // Draw the Spiral function spiral( &$im, $origin_x = 100, $origin_y = 100, $r = 0, $g = 0, $b = 0 ) { $theta = 1; - $thetac = 6; - $radius = 15; - $circles = 10; - $points = 35; + $thetac = 6; + $radius = 15; + $circles = 10; + $points = 35; $lcolor = imagecolorallocate( $im, $r, $g, $b ); for( $i = 0; $i < ( $circles * $points ) - 1; $i++ ) { $theta = $theta + $thetac; @@ -121,7 +121,7 @@ function image ( $word ) { $width =& $this->width; $height =& $this->height; - + // Create the Image $jpg = ImageCreate($width,$height); $bg = ImageColorAllocate($jpg,255,255,255); @@ -134,7 +134,7 @@ $x = rand(10, 30); $y = rand(50, $height-20); //50-60 - + // randomize the chars for ($i=0; $i < strlen($word); $i++) { $angle += rand(-5, 5); @@ -145,8 +145,8 @@ if ( $y < 10 ) $y = 11; elseif ( $y > $height-10 ) $y = $height-11; $x += rand($size, $size*2); - imagettftext($jpg, $size, $angle, $x, $y, $tx, - realpath(findfile("lib/captcha/Vera.ttf")), + imagettftext($jpg, $size, $angle, $x, $y, $tx, + realpath(findfile("lib/captcha/Vera.ttf")), $word[$i]); } @@ -159,19 +159,19 @@ imageline($jpg, 0,$height-1,$width-1,$height-1,$tx); imageline($jpg, $width-1,0,$width-1,$height-1,$tx); - if (function_exists("ImageJpeg")) { - header("Content-type: image/jpeg"); - ImageJpeg($jpg); - } elseif (function_exists("ImagePNG")) { - header("Content-type: image/png"); - ImagePNG($jpg); - } elseif (function_exists("ImageGIF")) { - header("Content-type: image/gif"); - ImageGIF($jpg); - } else { - trigger_error("missing GD bitmap support", E_USER_WARNING); - } + if (function_exists("ImageJpeg")) { + header("Content-type: image/jpeg"); + ImageJpeg($jpg); + } elseif (function_exists("ImagePNG")) { + header("Content-type: image/png"); + ImagePNG($jpg); + } elseif (function_exists("ImageGIF")) { + header("Content-type: image/gif"); + ImageGIF($jpg); + } else { + trigger_error("missing GD bitmap support", E_USER_WARNING); } + } } @@ -181,5 +181,5 @@ // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> Modified: trunk/lib/DbSession.php =================================================================== --- trunk/lib/DbSession.php 2011-03-04 16:43:43 UTC (rev 7963) +++ trunk/lib/DbSession.php 2011-03-05 17:05:30 UTC (rev 7964) @@ -29,7 +29,7 @@ $db_type = $dbh->getParam('dbtype'); if (isa($dbh, 'WikiDB')) { @include_once("lib/DbSession/".$db_type.".php"); - + $class = "DbSession_".$db_type; if (class_exists($class)) { // dba has no ->_dbh, so this is used for the session link @@ -43,7 +43,7 @@ $db_type), E_USER_WARNING); return false; } - + function currentSessions() { return $this->_backend->currentSessions(); } Modified: trunk/lib/DbaDatabase.php =================================================================== --- trunk/lib/DbaDatabase.php 2011-03-04 16:43:43 UTC (rev 7963) +++ trunk/lib/DbaDatabase.php 2011-03-05 17:05:30 UTC (rev 7964) @@ -18,9 +18,9 @@ if (!in_array($handler, dba_handlers())) $this->_error( sprintf( - _("The DBA handler %s is unsupported!")."\n". - _("Supported handlers are: %s"), - $handler, join(",",dba_handlers()))); + _("The DBA handler %s is unsupported!")."\n". + _("Supported handlers are: %s"), + $handler, join(",",dba_handlers()))); } $this->readonly = false; if ($mode) @@ -30,11 +30,11 @@ function set_timeout($timeout) { $this->_timeout = $timeout; } - + function open($mode = 'w') { if ($this->_dbh) return; // already open. - + $watchdog = $this->_timeout; global $ErrorManager; @@ -53,9 +53,9 @@ if ((strlen($mode) == 1)) { // PHP 4.3.x Windows lock bug workaround: http://bugs.php.net/bug.php?id=23975 if (isWindows()) { - $mode .= "-"; // suppress locking, or - } elseif ($this->_handler != 'gdbm') { // gdbm does it internally - $mode .= "d"; // else use internal locking + $mode .= "-"; // suppress locking, or + } elseif ($this->_handler != 'gdbm') { // gdbm does it internally + $mode .= "d"; // else use internal locking } } while (($dbh = dba_open($this->_file, $mode, $this->_handler)) < 1) { @@ -96,7 +96,7 @@ $this->readonly = true; if (!file_exists($this->_file)) { $ErrorManager->handleError($error); - flush(); + flush(); } } else { @@ -116,7 +116,7 @@ function exists($key) { return dba_exists($key, $this->_dbh); } - + function fetch($key) { $val = dba_fetch($key, $this->_dbh); if ($val === false) @@ -134,7 +134,7 @@ return $this->_error("replace($key)"); } - + function firstkey() { return dba_firstkey($this->_dbh); } @@ -182,7 +182,7 @@ return $this->_error("optimize()"); return 1; } - + function _error($mes) { //trigger_error("DbaDatabase: $mes", E_USER_WARNING); //return false; @@ -207,5 +207,5 @@ // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> Modified: trunk/lib/DbaListSet.php =================================================================== --- trunk/lib/DbaListSet.php 2011-03-04 16:43:43 UTC (rev 7963) +++ trunk/lib/DbaListSet.php 2011-03-05 17:05:30 UTC (rev 7964) @@ -52,7 +52,7 @@ list( $prev , , ) = explode(':', $this->_dbh->fetch(intval($i)), 3); return intval($prev); } - + function exists($i) { $i = intval($i); return $i && $this->_dbh->exists($i); @@ -68,7 +68,7 @@ list($prev, $next,) = explode(':', $dbh->fetch(intval($i)), 3); $dbh->replace($i, "$prev:$next:$data"); } - + function insert_before($i, $data) { assert(intval($i)); return $this->_insert_before_nc($i, $data); @@ -78,7 +78,7 @@ assert(intval($i)); return $this->_insert_after_nc($i, $data); } - + function append($seq, $data) { $key = "s" . urlencode($seq); $this->_insert_before_nc($key, $data); @@ -88,7 +88,7 @@ $key = "s" . urlencode($seq); $this->_insert_after_nc($key, $data); } - + function _insert_before_nc($i, &$data) { $newkey = $this->_new_key();... [truncated message content] |