diff options
116 files changed, 3100 insertions, 695 deletions
diff --git a/_test/tests/inc/parser/parser_footnote.test.php b/_test/tests/inc/parser/parser_footnote.test.php index b47a575de..2457fb031 100644 --- a/_test/tests/inc/parser/parser_footnote.test.php +++ b/_test/tests/inc/parser/parser_footnote.test.php @@ -303,7 +303,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { array('nest', array ( array ( array('footnote_open',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), diff --git a/_test/tests/inc/parser/parser_lists.test.php b/_test/tests/inc/parser/parser_lists.test.php index e4ef1f83e..6acaff637 100644 --- a/_test/tests/inc/parser/parser_lists.test.php +++ b/_test/tests/inc/parser/parser_lists.test.php @@ -13,7 +13,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -46,7 +46,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listo_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -80,7 +80,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listo_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -109,7 +109,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -138,7 +138,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listo_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -188,7 +188,7 @@ Bar'); array('cdata',array("Foo")), array('p_close',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -227,7 +227,7 @@ Bar'); $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('strong_open',array()), array('cdata',array("A")), @@ -262,7 +262,7 @@ Bar'); $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('unformatted',array("A")), array('listcontent_close',array()), @@ -291,7 +291,7 @@ Bar'); $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('linebreak',array()), @@ -355,7 +355,7 @@ Bar'); $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('nest', array( array( array('footnote_open',array()), diff --git a/bin/gittool.php b/bin/gittool.php index 6944dde57..cbadb5bfa 100755 --- a/bin/gittool.php +++ b/bin/gittool.php @@ -101,7 +101,7 @@ class GitToolCLI extends DokuCLI { /** * Tries to install the given extensions using git clone * - * @param $extensions + * @param array $extensions */ public function cmd_clone($extensions) { $errors = array(); @@ -130,7 +130,7 @@ class GitToolCLI extends DokuCLI { /** * Tries to install the given extensions using git clone with fallback to install * - * @param $extensions + * @param array $extensions */ public function cmd_install($extensions) { $errors = array(); @@ -206,12 +206,13 @@ class GitToolCLI extends DokuCLI { * Install extension from the given download URL * * @param string $ext - * @return bool + * @return bool|null */ private function downloadExtension($ext) { /** @var helper_plugin_extension_extension $plugin */ $plugin = plugin_load('helper', 'extension_extension'); if(!$ext) die("extension plugin not available, can't continue"); + $plugin->setExtension($ext); $url = $plugin->getDownloadURL(); @@ -291,12 +292,13 @@ class GitToolCLI extends DokuCLI { * Returns the repository for the given extension * * @param $extension - * @return bool|string + * @return false|string */ private function getSourceRepo($extension) { /** @var helper_plugin_extension_extension $ext */ $ext = plugin_load('helper', 'extension_extension'); if(!$ext) die("extension plugin not available, can't continue"); + $ext->setExtension($extension); $repourl = $ext->getSourcerepoURL(); diff --git a/bin/wantedpages.php b/bin/wantedpages.php index 8fc4ba74f..54bfd4755 100755 --- a/bin/wantedpages.php +++ b/bin/wantedpages.php @@ -61,6 +61,13 @@ class WantedPagesCLI extends DokuCLI { } } + /** + * Determine directions of the search loop + * + * @param string $entry + * @param string $basepath + * @return int + */ protected function dir_filter($entry, $basepath) { if($entry == '.' || $entry == '..') { return WantedPagesCLI::DIR_CONTINUE; @@ -77,6 +84,13 @@ class WantedPagesCLI extends DokuCLI { return WantedPagesCLI::DIR_CONTINUE; } + /** + * Collects recursively the pages in a namespace + * + * @param string $dir + * @return array + * @throws DokuCLI_Exception + */ protected function get_pages($dir) { static $trunclen = null; if(!$trunclen) { @@ -108,6 +122,12 @@ class WantedPagesCLI extends DokuCLI { return $pages; } + /** + * Parse instructions and returns the non-existing links + * + * @param array $page array with page id and file path + * @return array + */ function internal_links($page) { global $conf; $instructions = p_get_instructions(file_get_contents($page['file'])); diff --git a/conf/mime.conf b/conf/mime.conf index 2a50fab10..c2e03b775 100644 --- a/conf/mime.conf +++ b/conf/mime.conf @@ -9,7 +9,6 @@ gif image/gif png image/png ico image/vnd.microsoft.icon -swf application/x-shockwave-flash mp3 audio/mpeg ogg audio/ogg wav audio/wav @@ -66,3 +65,7 @@ odt !application/vnd.oasis.opendocument.text #xml text/xml #csv text/csv +# Also flash may be able to execute arbitrary scripts in the website's +# context +#swf application/x-shockwave-flash + diff --git a/conf/mysql.conf.php.example b/conf/mysql.conf.php.example index c67e77c45..8337f51b4 100644 --- a/conf/mysql.conf.php.example +++ b/conf/mysql.conf.php.example @@ -56,7 +56,7 @@ $conf['plugin']['authmysql']['TablesToLock']= array("users", "users AS u","group * of the user. If the result table is empty or contains more than one * row, access will be denied. * - * The plugin accesses the password as 'pass' so a alias might be necessary. + * The plugin accesses the password as 'pass' so an alias might be necessary. * * Following patters will be replaced: * %{user} user name @@ -107,10 +107,10 @@ $conf['plugin']['authmysql']['getGroups'] = "SELECT name as `group` /* This statement should return a table containing all user login names * that meet certain filter criteria. The filter expressions will be added * case dependend by the plugin. At the end a sort expression will be added. - * Important is that this list contains no double entries fo a user. Each + * Important is that this list contains no double entries for a user. Each * user name is only allowed once in the table. * - * The login name will be accessed as 'user' to a alias might be neseccary. + * The login name will be accessed as 'user' to an alias might be neseccary. * No patterns will be replaced in this statement but following patters * will be replaced in the filter expressions: * %{user} in FilterLogin user's login name @@ -174,7 +174,7 @@ $conf['plugin']['authmysql']['delGroup'] = "DELETE FROM groups WHERE gid='%{gid}'"; /* This statement should return the database index of a given user name. - * The plugin will access the index with the name 'id' so a alias might be + * The plugin will access the index with the name 'id' so an alias might be * necessary. * following patters will be replaced: * %{user} user name @@ -240,7 +240,7 @@ $conf['plugin']['authmysql']['delUserGroup']= "DELETE FROM usergroup AND gid='%{gid}'"; /* This statement should return the database index of a given group name. - * The plugin will access the index with the name 'id' so a alias might + * The plugin will access the index with the name 'id' so an alias might * be necessary. * * Following patters will be replaced: @@ -9,7 +9,7 @@ */ // update message version -$updateVersion = 46.1; +$updateVersion = 47; // xdebug_start_profiling(); @@ -306,7 +306,7 @@ function rss_buildItems(&$rss, &$data, $opt) { $src_r = ''; $src_l = ''; - if($size = media_image_preview_size($id, false, new JpegMeta(mediaFN($id)), 300)) { + if($size = media_image_preview_size($id, '', new JpegMeta(mediaFN($id)), 300)) { $more = 'w='.$size[0].'&h='.$size[1].'&t='.@filemtime(mediaFN($id)); $src_r = ml($id, $more, true, '&', true); } @@ -355,7 +355,7 @@ function rss_buildItems(&$rss, &$data, $opt) { break; case 'html': if($ditem['media']) { - if($size = media_image_preview_size($id, false, new JpegMeta(mediaFN($id)))) { + if($size = media_image_preview_size($id, '', new JpegMeta(mediaFN($id)))) { $more = 'w='.$size[0].'&h='.$size[1].'&t='.@filemtime(mediaFN($id)); $src = ml($id, $more, true, '&', true); $content = '<img src="'.$src.'" alt="'.$id.'" />'; @@ -386,7 +386,7 @@ function rss_buildItems(&$rss, &$data, $opt) { case 'abstract': default: if($ditem['media']) { - if($size = media_image_preview_size($id, false, new JpegMeta(mediaFN($id)))) { + if($size = media_image_preview_size($id, '', new JpegMeta(mediaFN($id)))) { $more = 'w='.$size[0].'&h='.$size[1].'&t='.@filemtime(mediaFN($id)); $src = ml($id, $more, true, '&', true); $content = '<img src="'.$src.'" alt="'.$id.'" />'; diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 3c955cf88..210d1c0eb 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -14,6 +14,9 @@ class _DiffOp { var $orig; var $closing; + /** + * @return _DiffOp + */ function reverse() { trigger_error("pure virtual", E_USER_ERROR); } @@ -104,6 +107,21 @@ class _DiffOp_Change extends _DiffOp { */ class _DiffEngine { + var $xchanged = array(); + var $ychanged = array(); + var $xv = array(); + var $yv = array(); + var $xind = array(); + var $yind = array(); + var $seq; + var $in_seq; + var $lcs; + + /** + * @param array $from_lines + * @param array $to_lines + * @return _DiffOp[] + */ function diff($from_lines, $to_lines) { $n_from = count($from_lines); $n_to = count($to_lines); @@ -495,9 +513,9 @@ class Diff { * Constructor. * Computes diff between sequences of strings. * - * @param $from_lines array An array of strings. - * (Typically these are lines from a file.) - * @param $to_lines array An array of strings. + * @param array $from_lines An array of strings. + * (Typically these are lines from a file.) + * @param array $to_lines An array of strings. */ function __construct($from_lines, $to_lines) { $eng = new _DiffEngine; @@ -512,8 +530,9 @@ class Diff { * * $diff = new Diff($lines1, $lines2); * $rev = $diff->reverse(); - * @return object A Diff object representing the inverse of the - * original diff. + * + * @return Diff A Diff object representing the inverse of the + * original diff. */ function reverse() { $rev = $this; @@ -631,19 +650,19 @@ class MappedDiff extends Diff { * case-insensitve diffs, or diffs which ignore * changes in white-space. * - * @param $from_lines array An array of strings. - * (Typically these are lines from a file.) + * @param string[] $from_lines An array of strings. + * (Typically these are lines from a file.) * - * @param $to_lines array An array of strings. + * @param string[] $to_lines An array of strings. * - * @param $mapped_from_lines array This array should - * have the same size number of elements as $from_lines. - * The elements in $mapped_from_lines and - * $mapped_to_lines are what is actually compared - * when computing the diff. + * @param string[] $mapped_from_lines This array should + * have the same size number of elements as $from_lines. + * The elements in $mapped_from_lines and + * $mapped_to_lines are what is actually compared + * when computing the diff. * - * @param $mapped_to_lines array This array should - * have the same number of elements as $to_lines. + * @param string[] $mapped_to_lines This array should + * have the same number of elements as $to_lines. */ function __construct($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) { @@ -697,12 +716,13 @@ class DiffFormatter { /** * Format a diff. * - * @param $diff object A Diff object. + * @param Diff $diff A Diff object. * @return string The formatted output. */ function format($diff) { $xi = $yi = 1; + $x0 = $y0 = 0; $block = false; $context = array(); @@ -752,6 +772,13 @@ class DiffFormatter { return $this->_end_diff(); } + /** + * @param int $xbeg + * @param int $xlen + * @param int $ybeg + * @param int $ylen + * @param array $edits + */ function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) { $this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen)); foreach ($edits as $edit) { @@ -779,6 +806,13 @@ class DiffFormatter { return $val; } + /** + * @param int $xbeg + * @param int $xlen + * @param int $ybeg + * @param int $ylen + * @return string + */ function _block_header($xbeg, $xlen, $ybeg, $ylen) { if ($xlen > 1) $xbeg .= "," . ($xbeg + $xlen - 1); @@ -788,6 +822,9 @@ class DiffFormatter { return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; } + /** + * @param string $header + */ function _start_block($header) { echo $header; } @@ -896,6 +933,9 @@ class _HWLDF_WordAccumulator { $this->_tag = $new_tag; } + /** + * @param string $new_tag + */ function _flushLine($new_tag) { $this->_flushGroup($new_tag); if ($this->_line != '') @@ -1055,6 +1095,10 @@ class TableDiffFormatter extends DiffFormatter { $this->trailing_context_lines = 2; } + /** + * @param Diff $diff + * @return string + */ function format($diff) { // Preserve whitespaces by converting some to non-breaking spaces. // Do not convert all of them to allow word-wrap. @@ -1165,6 +1209,10 @@ class InlineDiffFormatter extends DiffFormatter { $this->trailing_context_lines = 2; } + /** + * @param Diff $diff + * @return string + */ function format($diff) { // Preserve whitespaces by converting some to non-breaking spaces. // Do not convert all of them to allow word-wrap. diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index cd4c7c4c5..2e991b52f 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -57,6 +57,12 @@ class DokuHTTPClient extends HTTPClient { * @triggers HTTPCLIENT_REQUEST_SEND * @author Andreas Gohr <andi@splitbrain.org> */ + /** + * @param string $url + * @param string|array $data the post data either as array or raw data + * @param string $method + * @return bool + */ function sendRequest($url,$data='',$method='GET'){ $httpdata = array('url' => $url, 'data' => $data, @@ -104,7 +110,7 @@ class HTTPClient { var $header_regexp; // if set this RE must match against the headers, else abort var $headers; var $debug; - var $start = 0; // for timings + var $start = 0.0; // for timings var $keep_alive = true; // keep alive rocks // don't set these, read on error @@ -166,7 +172,8 @@ class HTTPClient { * * @param string $url The URL to fetch * @param bool $sloppy304 Return body on 304 not modified - * @return bool|string response body, false on error + * @return false|string response body, false on error + * * @author Andreas Gohr <andi@splitbrain.org> */ function get($url,$sloppy304=false){ @@ -187,7 +194,8 @@ class HTTPClient { * @param string $url The URL to fetch * @param array $data Associative array of parameters * @param bool $sloppy304 Return body on 304 not modified - * @return bool|string response body, false on error + * @return false|string response body, false on error + * * @author Andreas Gohr <andi@splitbrain.org> */ function dget($url,$data,$sloppy304=false){ @@ -207,7 +215,7 @@ class HTTPClient { * * @param string $url The URL to fetch * @param array $data Associative array of parameters - * @return bool|string response body, false on error + * @return false|string response body, false on error * @author Andreas Gohr <andi@splitbrain.org> */ function post($url,$data){ @@ -229,6 +237,7 @@ class HTTPClient { * @param mixed $data - the post data either as array or raw data * @param string $method - HTTP Method usually GET or POST. * @return bool - true on success + * * @author Andreas Goetz <cpuidle@gmx.de> * @author Andreas Gohr <andi@splitbrain.org> */ @@ -596,6 +605,7 @@ class HTTPClient { * @param string $data The data to write * @param string $message Description of what is being read * @throws HTTPClientException + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function _sendData($socket, $data, $message) { @@ -640,6 +650,7 @@ class HTTPClient { * @param bool $ignore_eof End-of-file is not an error if this is set * @throws HTTPClientException * @return string + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function _readData($socket, $nbytes, $message, $ignore_eof = false) { @@ -689,6 +700,7 @@ class HTTPClient { * @param string $message Description of what is being read * @throws HTTPClientException * @return string + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function _readLine($socket, $message) { @@ -723,6 +735,9 @@ class HTTPClient { * Uses _debug_text or _debug_html depending on the SAPI name * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $info + * @param mixed $var */ function _debug($info,$var=null){ if(!$this->debug) return; @@ -736,8 +751,8 @@ class HTTPClient { /** * print debug info as HTML * - * @param $info - * @param null $var + * @param string $info + * @param mixed $var */ function _debug_html($info, $var=null){ print '<b>'.$info.'</b> '.($this->_time() - $this->start).'s<br />'; @@ -753,8 +768,8 @@ class HTTPClient { /** * prints debug info as plain text * - * @param $info - * @param null $var + * @param string $info + * @param mixed $var */ function _debug_text($info, $var=null){ print '*'.$info.'* '.($this->_time() - $this->start)."s\n"; @@ -764,6 +779,8 @@ class HTTPClient { /** * Return current timestamp in microsecond resolution + * + * @return float */ static function _time(){ list($usec, $sec) = explode(" ", microtime()); @@ -776,6 +793,9 @@ class HTTPClient { * All Keys are lowercased. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $string + * @return array */ function _parseHeaders($string){ $headers = array(); @@ -804,6 +824,9 @@ class HTTPClient { * convert given header array to header string * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $headers + * @return string */ function _buildHeaders($headers){ $string = ''; @@ -818,6 +841,8 @@ class HTTPClient { * get cookies as http header string * * @author Andreas Goetz <cpuidle@gmx.de> + * + * @return string */ function _getCookies(){ $headers = ''; @@ -833,6 +858,9 @@ class HTTPClient { * Encode data for posting * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $data + * @return string */ function _postEncode($data){ return http_build_query($data,'','&'); @@ -843,6 +871,9 @@ class HTTPClient { * * @fixme use of urlencode might be wrong here * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $data + * @return string */ function _postMultipartEncode($data){ $boundary = '--'.$this->boundary; diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index 979dc4d16..839298680 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -1,101 +1,146 @@ <?php + /** - * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002 + * IXR - The Incutio XML-RPC Library + * + * Copyright (c) 2010, Incutio Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of Incutio Ltd. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * @version 1.61 - * @author Simon Willison - * @date 11th July 2003 - * @link http://scripts.incutio.com/xmlrpc/ - * @link http://scripts.incutio.com/xmlrpc/manual.php - * @license Artistic License http://www.opensource.org/licenses/artistic-license.php + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @package IXR + * @since 1.5 + * + * @copyright Incutio Ltd 2010 (http://www.incutio.com) + * @version 1.7.4 7th September 2010 + * @author Simon Willison + * @link http://scripts.incutio.com/xmlrpc/ Site/manual * * Modified for DokuWiki * @author Andreas Gohr <andi@splitbrain.org> */ - - class IXR_Value { + + /** @var IXR_Value[]|IXR_Date|IXR_Base64|int|bool|double|string */ var $data; + /** @var string */ var $type; - function IXR_Value ($data, $type = false) { + + /** + * @param mixed $data + * @param bool $type + */ + function IXR_Value($data, $type = false) { $this->data = $data; - if (!$type) { + if(!$type) { $type = $this->calculateType(); } $this->type = $type; - if ($type == 'struct') { - /* Turn all the values in the array in to new IXR_Value objects */ - foreach ($this->data as $key => $value) { + if($type == 'struct') { + // Turn all the values in the array in to new IXR_Value objects + foreach($this->data as $key => $value) { $this->data[$key] = new IXR_Value($value); } } - if ($type == 'array') { - for ($i = 0, $j = count($this->data); $i < $j; $i++) { + if($type == 'array') { + for($i = 0, $j = count($this->data); $i < $j; $i++) { $this->data[$i] = new IXR_Value($this->data[$i]); } } } + + /** + * @return string + */ function calculateType() { - if ($this->data === true || $this->data === false) { + if($this->data === true || $this->data === false) { return 'boolean'; } - if (is_integer($this->data)) { + if(is_integer($this->data)) { return 'int'; } - if (is_double($this->data)) { + if(is_double($this->data)) { return 'double'; } + // Deal with IXR object types base64 and date - if (is_object($this->data) && is_a($this->data, 'IXR_Date')) { + if(is_object($this->data) && is_a($this->data, 'IXR_Date')) { return 'date'; } - if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) { + if(is_object($this->data) && is_a($this->data, 'IXR_Base64')) { return 'base64'; } - // If it is a normal PHP object convert it in to a struct - if (is_object($this->data)) { + // If it is a normal PHP object convert it in to a struct + if(is_object($this->data)) { $this->data = get_object_vars($this->data); return 'struct'; } - if (!is_array($this->data)) { + if(!is_array($this->data)) { return 'string'; } - /* We have an array - is it an array or a struct ? */ - if ($this->isStruct($this->data)) { + + // We have an array - is it an array or a struct? + if($this->isStruct($this->data)) { return 'struct'; } else { return 'array'; } } + + /** + * @return bool|string + */ function getXml() { - /* Return XML for this value */ - switch ($this->type) { + // Return XML for this value + switch($this->type) { case 'boolean': - return '<boolean>'.(($this->data) ? '1' : '0').'</boolean>'; + return '<boolean>' . (($this->data) ? '1' : '0') . '</boolean>'; break; case 'int': - return '<int>'.$this->data.'</int>'; + return '<int>' . $this->data . '</int>'; break; case 'double': - return '<double>'.$this->data.'</double>'; + return '<double>' . $this->data . '</double>'; break; case 'string': - return '<string>'.htmlspecialchars($this->data).'</string>'; + return '<string>' . htmlspecialchars($this->data) . '</string>'; break; case 'array': - $return = '<array><data>'."\n"; - foreach ($this->data as $item) { - $return .= ' <value>'.$item->getXml()."</value>\n"; + $return = '<array><data>' . "\n"; + foreach($this->data as $item) { + $return .= ' <value>' . $item->getXml() . "</value>\n"; } $return .= '</data></array>'; return $return; break; case 'struct': - $return = '<struct>'."\n"; - foreach ($this->data as $name => $value) { + $return = '<struct>' . "\n"; + foreach($this->data as $name => $value) { $return .= " <member><name>$name</name><value>"; - $return .= $value->getXml()."</value></member>\n"; + $return .= $value->getXml() . "</value></member>\n"; } $return .= '</struct>'; return $return; @@ -107,11 +152,17 @@ class IXR_Value { } return false; } + + /** + * Checks whether or not the supplied array is a struct or not + * + * @param array $array + * @return boolean + */ function isStruct($array) { - /* Nasty function to check if an array is a struct or not */ $expected = 0; - foreach ($array as $key => $value) { - if ((string)$key != (string)$expected) { + foreach($array as $key => $value) { + if((string) $key != (string) $expected) { return true; } $expected++; @@ -120,18 +171,25 @@ class IXR_Value { } } - +/** + * IXR_MESSAGE + * + * @package IXR + * @since 1.5 + * + */ class IXR_Message { var $message; - var $messageType; // methodCall / methodResponse / fault + var $messageType; // methodCall / methodResponse / fault var $faultCode; var $faultString; var $methodName; var $params; + // Current variable stacks - var $_arraystructs = array(); // The stack used to keep track of the current array/struct + var $_arraystructs = array(); // The stack used to keep track of the current array/struct var $_arraystructstypes = array(); // Stack keeping track of if things are structs or array - var $_currentStructName = array(); // A stack as well + var $_currentStructName = array(); // A stack as well var $_param; var $_value; var $_currentTag; @@ -139,12 +197,23 @@ class IXR_Message { var $_lastseen; // The XML parser var $_parser; - function IXR_Message ($message) { - $this->message = $message; + + /** + * @param string $message + */ + function IXR_Message($message) { + $this->message =& $message; } + + /** + * @return bool + */ function parse() { // first remove the XML declaration - $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message); + // merged from WP #10698 - this method avoids the RAM usage of preg_replace on very large messages + $header = preg_replace('/<\?xml.*?\?' . '>/', '', substr($this->message, 0, 100), 1); + $this->message = substr_replace($this->message, $header, 0, 100); + // workaround for a bug in PHP/libxml2, see http://bugs.php.net/bug.php?id=45996 $this->message = str_replace('<', '<', $this->message); $this->message = str_replace('>', '>', $this->message); @@ -152,7 +221,7 @@ class IXR_Message { $this->message = str_replace(''', ''', $this->message); $this->message = str_replace('"', '"', $this->message); $this->message = str_replace("\x0b", ' ', $this->message); //vertical tab - if (trim($this->message) == '') { + if(trim($this->message) == '') { return false; } $this->_parser = xml_parser_create(); @@ -162,23 +231,40 @@ class IXR_Message { xml_set_object($this->_parser, $this); xml_set_element_handler($this->_parser, 'tag_open', 'tag_close'); xml_set_character_data_handler($this->_parser, 'cdata'); - if (!xml_parse($this->_parser, $this->message)) { - /* die(sprintf('XML error: %s at line %d', - xml_error_string(xml_get_error_code($this->_parser)), - xml_get_current_line_number($this->_parser))); */ - return false; - } + $chunk_size = 262144; // 256Kb, parse in chunks to avoid the RAM usage on very large messages + $final = false; + do { + if(strlen($this->message) <= $chunk_size) { + $final = true; + } + $part = substr($this->message, 0, $chunk_size); + $this->message = substr($this->message, $chunk_size); + if(!xml_parse($this->_parser, $part, $final)) { + return false; + } + if($final) { + break; + } + } while(true); xml_parser_free($this->_parser); + // Grab the error messages, if any - if ($this->messageType == 'fault') { + if($this->messageType == 'fault') { $this->faultCode = $this->params[0]['faultCode']; $this->faultString = $this->params[0]['faultString']; } return true; } + + /** + * @param $parser + * @param string $tag + * @param $attr + */ function tag_open($parser, $tag, $attr) { - $this->currentTag = $tag; $this->_currentTagContents = ''; + $this->_currentTag = $tag; + switch($tag) { case 'methodCall': case 'methodResponse': @@ -186,7 +272,7 @@ class IXR_Message { $this->messageType = $tag; break; /* Deal with stacks of arrays and structs */ - case 'data': // data is to all intents and puposes more interesting than array + case 'data': // data is to all intents and purposes more interesting than array $this->_arraystructstypes[] = 'array'; $this->_arraystructs[] = array(); break; @@ -197,50 +283,52 @@ class IXR_Message { } $this->_lastseen = $tag; } + + /** + * @param $parser + * @param string $cdata + */ function cdata($parser, $cdata) { $this->_currentTagContents .= $cdata; } + + /** + * @param $parser + * @param $tag + */ function tag_close($parser, $tag) { $valueFlag = false; switch($tag) { case 'int': case 'i4': - $value = (int)trim($this->_currentTagContents); - $this->_currentTagContents = ''; + $value = (int) trim($this->_currentTagContents); $valueFlag = true; break; case 'double': - $value = (double)trim($this->_currentTagContents); - $this->_currentTagContents = ''; + $value = (double) trim($this->_currentTagContents); $valueFlag = true; break; case 'string': - $value = (string)$this->_currentTagContents; - $this->_currentTagContents = ''; + $value = (string) $this->_currentTagContents; $valueFlag = true; break; case 'dateTime.iso8601': $value = new IXR_Date(trim($this->_currentTagContents)); - // $value = $iso->getTimestamp(); - $this->_currentTagContents = ''; $valueFlag = true; break; case 'value': // "If no type is indicated, the type is string." - if($this->_lastseen == 'value'){ - $value = (string)$this->_currentTagContents; - $this->_currentTagContents = ''; + if($this->_lastseen == 'value') { + $value = (string) $this->_currentTagContents; $valueFlag = true; } break; case 'boolean': - $value = (boolean)trim($this->_currentTagContents); - $this->_currentTagContents = ''; + $value = (boolean) trim($this->_currentTagContents); $valueFlag = true; break; case 'base64': $value = base64_decode($this->_currentTagContents); - $this->_currentTagContents = ''; $valueFlag = true; break; /* Deal with stacks of arrays and structs */ @@ -255,75 +343,94 @@ class IXR_Message { break; case 'name': $this->_currentStructName[] = trim($this->_currentTagContents); - $this->_currentTagContents = ''; break; case 'methodName': $this->methodName = trim($this->_currentTagContents); - $this->_currentTagContents = ''; break; } - if ($valueFlag) { - /* - if (!is_array($value) && !is_object($value)) { - $value = trim($value); - } - */ - if (count($this->_arraystructs) > 0) { + + if($valueFlag) { + if(count($this->_arraystructs) > 0) { // Add value to struct or array - if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') { + if($this->_arraystructstypes[count($this->_arraystructstypes) - 1] == 'struct') { // Add to struct - $this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value; + $this->_arraystructs[count($this->_arraystructs) - 1][$this->_currentStructName[count($this->_currentStructName) - 1]] = $value; } else { // Add to array - $this->_arraystructs[count($this->_arraystructs)-1][] = $value; + $this->_arraystructs[count($this->_arraystructs) - 1][] = $value; } } else { - // Just add as a paramater + // Just add as a parameter $this->params[] = $value; } } + $this->_currentTagContents = ''; $this->_lastseen = $tag; } } - +/** + * IXR_Server + * + * @package IXR + * @since 1.5 + */ class IXR_Server { var $data; + /** @var array */ var $callbacks = array(); var $message; + /** @var array */ var $capabilities; - function IXR_Server($callbacks = false, $data = false) { + + /** + * @param array|bool $callbacks + * @param bool $data + * @param bool $wait + */ + function IXR_Server($callbacks = false, $data = false, $wait = false) { $this->setCapabilities(); - if ($callbacks) { + if($callbacks) { $this->callbacks = $callbacks; } $this->setCallbacks(); - $this->serve($data); + + if(!$wait) { + $this->serve($data); + } } + + /** + * @param bool|string $data + */ function serve($data = false) { - if (!$data) { + if(!$data) { $postData = trim(http_get_raw_post_data()); - if (!$postData) { + if(!$postData) { + header('Content-Type: text/plain'); // merged from WP #9093 die('XML-RPC server accepts POST requests only.'); } $data = $postData; } $this->message = new IXR_Message($data); - if (!$this->message->parse()) { + if(!$this->message->parse()) { $this->error(-32700, 'parse error. not well formed'); } - if ($this->message->messageType != 'methodCall') { + if($this->message->messageType != 'methodCall') { $this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall'); } $result = $this->call($this->message->methodName, $this->message->params); + // Is the result an error? - if (is_a($result, 'IXR_Error')) { + if(is_a($result, 'IXR_Error')) { $this->error($result); } + // Encode the result $r = new IXR_Value($result); $resultxml = $r->getXml(); + // Create the XML $xml = <<<EOD <methodResponse> @@ -340,16 +447,23 @@ EOD; // Send it $this->output($xml); } + + /** + * @param string $methodname + * @param array $args + * @return IXR_Error|mixed + */ function call($methodname, $args) { - if (!$this->hasMethod($methodname)) { - return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.'); + if(!$this->hasMethod($methodname)) { + return new IXR_Error(-32601, 'server error. requested method ' . $methodname . ' does not exist.'); } $method = $this->callbacks[$methodname]; + // Perform the callback and send the response # Removed for DokuWiki to have a more consistent interface # if (count($args) == 1) { - # // If only one paramater just send that instead of the whole array + # // If only one parameter just send that instead of the whole array # $args = $args[0]; # } @@ -359,16 +473,16 @@ EOD; $args = (array) $args; // Are we dealing with a function or a method? - if (substr($method, 0, 5) == 'this:') { + if(is_string($method) && substr($method, 0, 5) == 'this:') { // It's a class method - check it exists $method = substr($method, 5); - if (!method_exists($this, $method)) { - return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.'); + if(!method_exists($this, $method)) { + return new IXR_Error(-32601, 'server error. requested class method "' . $method . '" does not exist.'); } // Call the method #$result = $this->$method($args); - $result = call_user_func_array(array(&$this,$method),$args); - } elseif (substr($method, 0, 7) == 'plugin:') { + $result = call_user_func_array(array(&$this, $method), $args); + } elseif(substr($method, 0, 7) == 'plugin:') { list($pluginname, $callback) = explode(':', substr($method, 7), 2); if(!plugin_isdisabled($pluginname)) { $plugin = plugin_load('action', $pluginname); @@ -378,31 +492,49 @@ EOD; } } else { // It's a function - does it exist? - if (!function_exists($method)) { - return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.'); + if(is_array($method)) { + if(!is_callable(array($method[0], $method[1]))) { + return new IXR_Error(-32601, 'server error. requested object method "' . $method[1] . '" does not exist.'); + } + } else if(!function_exists($method)) { + return new IXR_Error(-32601, 'server error. requested function "' . $method . '" does not exist.'); } + // Call the function - #$result = $method($args); - $result = call_user_func_array($method,$args); + $result = call_user_func($method, $args); } return $result; } + /** + * @param int $error + * @param string|bool $message + */ function error($error, $message = false) { // Accepts either an error object or an error code and message - if ($message && !is_object($error)) { + if($message && !is_object($error)) { $error = new IXR_Error($error, $message); } $this->output($error->getXml()); } + + /** + * @param string $xml + */ function output($xml) { header('Content-Type: text/xml; charset=utf-8'); echo '<?xml version="1.0"?>', "\n", $xml; exit; } + + /** + * @param string $method + * @return bool + */ function hasMethod($method) { return in_array($method, array_keys($this->callbacks)); } + function setCapabilities() { // Initialises capabilities array $this->capabilities = array( @@ -420,31 +552,45 @@ EOD; ), ); } + + /** + * @return mixed + */ function getCapabilities() { return $this->capabilities; } + function setCallbacks() { $this->callbacks['system.getCapabilities'] = 'this:getCapabilities'; $this->callbacks['system.listMethods'] = 'this:listMethods'; $this->callbacks['system.multicall'] = 'this:multiCall'; } + + /** + * @return array + */ function listMethods() { // Returns a list of methods - uses array_reverse to ensure user defined // methods are listed before server defined methods return array_reverse(array_keys($this->callbacks)); } + + /** + * @param array $methodcalls + * @return array + */ function multiCall($methodcalls) { // See http://www.xmlrpc.com/discuss/msgReader$1208 $return = array(); - foreach ($methodcalls as $call) { + foreach($methodcalls as $call) { $method = $call['methodName']; $params = $call['params']; - if ($method == 'system.multicall') { + if($method == 'system.multicall') { $result = new IXR_Error(-32800, 'Recursive calls to system.multicall are forbidden'); } else { $result = $this->call($method, $params); } - if (is_a($result, 'IXR_Error')) { + if(is_a($result, 'IXR_Error')) { $return[] = array( 'faultCode' => $result->code, 'faultString' => $result->message @@ -457,10 +603,24 @@ EOD; } } +/** + * IXR_Request + * + * @package IXR + * @since 1.5 + */ class IXR_Request { + /** @var string */ var $method; + /** @var array */ var $args; + /** @var string */ var $xml; + + /** + * @param string $method + * @param array $args + */ function IXR_Request($method, $args) { $this->method = $method; $this->args = $args; @@ -471,7 +631,7 @@ class IXR_Request { <params> EOD; - foreach ($this->args as $arg) { + foreach($this->args as $arg) { $this->xml .= '<param><value>'; $v = new IXR_Value($arg); $this->xml .= $v->getXml(); @@ -479,15 +639,28 @@ EOD; } $this->xml .= '</params></methodCall>'; } + + /** + * @return int + */ function getLength() { return strlen($this->xml); } + + /** + * @return string + */ function getXml() { return $this->xml; } } /** + * IXR_Client + * + * @package IXR + * @since 1.5 + * * Changed for DokuWiki to use DokuHTTPClient * * This should be compatible to the original class, but uses DokuWiki's @@ -498,19 +671,34 @@ EOD; */ class IXR_Client extends DokuHTTPClient { var $posturl = ''; + /** @var IXR_Message|bool */ var $message = false; + + // Storage place for an error message + /** @var IXR_Error|bool */ var $xmlerror = false; - function IXR_Client($server, $path = false, $port = 80) { + /** + * @param string $server + * @param string|bool $path + * @param int $port + * @param int $timeout + */ + function IXR_Client($server, $path = false, $port = 80, $timeout = 15) { parent::__construct(); - if (!$path) { + if(!$path) { // Assume we have been given a URL instead $this->posturl = $server; - }else{ - $this->posturl = 'http://'.$server.':'.$port.$path; + } else { + $this->posturl = 'http://' . $server . ':' . $port . $path; } + $this->timeout = $timeout; } + /** + * parameters: method and arguments + * @return bool success or error + */ function query() { $args = func_get_args(); $method = array_shift($args); @@ -518,55 +706,87 @@ class IXR_Client extends DokuHTTPClient { $xml = $request->getXml(); $this->headers['Content-Type'] = 'text/xml'; - if(!$this->sendRequest($this->posturl,$xml,'POST')){ - $this->xmlerror = new IXR_Error(-32300, 'transport error - '.$this->error); + if(!$this->sendRequest($this->posturl, $xml, 'POST')) { + $this->xmlerror = new IXR_Error(-32300, 'transport error - ' . $this->error); return false; } // Check HTTP Response code - if($this->status < 200 || $this->status > 206){ - $this->xmlerror = new IXR_Error(-32300, 'transport error - HTTP status '.$this->status); + if($this->status < 200 || $this->status > 206) { + $this->xmlerror = new IXR_Error(-32300, 'transport error - HTTP status ' . $this->status); return false; } // Now parse what we've got back $this->message = new IXR_Message($this->resp_body); - if (!$this->message->parse()) { + if(!$this->message->parse()) { // XML error $this->xmlerror = new IXR_Error(-32700, 'parse error. not well formed'); return false; } + // Is the message a fault? - if ($this->message->messageType == 'fault') { + if($this->message->messageType == 'fault') { $this->xmlerror = new IXR_Error($this->message->faultCode, $this->message->faultString); return false; } + // Message must be OK return true; } + + /** + * @return mixed + */ function getResponse() { // methodResponses can only have one param - return that return $this->message->params[0]; } + + /** + * @return bool + */ function isError() { return (is_object($this->xmlerror)); } + + /** + * @return int + */ function getErrorCode() { return $this->xmlerror->code; } + + /** + * @return string + */ function getErrorMessage() { return $this->xmlerror->message; } } - +/** + * IXR_Error + * + * @package IXR + * @since 1.5 + */ class IXR_Error { var $code; var $message; + + /** + * @param int $code + * @param string $message + */ function IXR_Error($code, $message) { $this->code = $code; - $this->message = $message; + $this->message = htmlspecialchars($message); } + + /** + * @return string + */ function getXml() { $xml = <<<EOD <methodResponse> @@ -591,7 +811,12 @@ EOD; } } - +/** + * IXR_Date + * + * @package IXR + * @since 1.5 + */ class IXR_Date { var $year; var $month; @@ -599,14 +824,23 @@ class IXR_Date { var $hour; var $minute; var $second; + var $timezone; + + /** + * @param int|string $time + */ function IXR_Date($time) { // $time can be a PHP timestamp or an ISO one - if (is_numeric($time)) { + if(is_numeric($time)) { $this->parseTimestamp($time); } else { $this->parseIso($time); } } + + /** + * @param int $timestamp + */ function parseTimestamp($timestamp) { $this->year = gmdate('Y', $timestamp); $this->month = gmdate('m', $timestamp); @@ -614,43 +848,81 @@ class IXR_Date { $this->hour = gmdate('H', $timestamp); $this->minute = gmdate('i', $timestamp); $this->second = gmdate('s', $timestamp); + $this->timezone = ''; } + + /** + * @param string $iso + */ function parseIso($iso) { - if(preg_match('/^(\d\d\d\d)-?(\d\d)-?(\d\d)([T ](\d\d):(\d\d)(:(\d\d))?)?/',$iso,$match)){ - $this->year = (int) $match[1]; - $this->month = (int) $match[2]; - $this->day = (int) $match[3]; - $this->hour = (int) $match[5]; + if(preg_match('/^(\d\d\d\d)-?(\d\d)-?(\d\d)([T ](\d\d):(\d\d)(:(\d\d))?)?/', $iso, $match)) { + $this->year = (int) $match[1]; + $this->month = (int) $match[2]; + $this->day = (int) $match[3]; + $this->hour = (int) $match[5]; $this->minute = (int) $match[6]; $this->second = (int) $match[8]; } } + + /** + * @return string + */ function getIso() { - return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second; + return $this->year . $this->month . $this->day . 'T' . $this->hour . ':' . $this->minute . ':' . $this->second . $this->timezone; } + + /** + * @return string + */ function getXml() { - return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>'; + return '<dateTime.iso8601>' . $this->getIso() . '</dateTime.iso8601>'; } + + /** + * @return int + */ function getTimestamp() { return gmmktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year); } } - +/** + * IXR_Base64 + * + * @package IXR + * @since 1.5 + */ class IXR_Base64 { var $data; + + /** + * @param string $data + */ function IXR_Base64($data) { $this->data = $data; } + + /** + * @return string + */ function getXml() { - return '<base64>'.base64_encode($this->data).'</base64>'; + return '<base64>' . base64_encode($this->data) . '</base64>'; } } - +/** + * IXR_IntrospectionServer + * + * @package IXR + * @since 1.5 + */ class IXR_IntrospectionServer extends IXR_Server { + /** @var array[] */ var $signatures; + /** @var string[] */ var $help; + function IXR_IntrospectionServer() { $this->setCallbacks(); $this->setCapabilities(); @@ -683,82 +955,102 @@ class IXR_IntrospectionServer extends IXR_Server { 'Returns a documentation string for the specified method' ); } + + /** + * @param string $method + * @param string $callback + * @param string[] $args + * @param string $help + */ function addCallback($method, $callback, $args, $help) { $this->callbacks[$method] = $callback; $this->signatures[$method] = $args; $this->help[$method] = $help; } + + /** + * @param string $methodname + * @param array $args + * @return IXR_Error|mixed + */ function call($methodname, $args) { // Make sure it's in an array - if ($args && !is_array($args)) { + if($args && !is_array($args)) { $args = array($args); } + // Over-rides default call method, adds signature check - if (!$this->hasMethod($methodname)) { - return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.'); + if(!$this->hasMethod($methodname)) { + return new IXR_Error(-32601, 'server error. requested method "' . $this->message->methodName . '" not specified.'); } $method = $this->callbacks[$methodname]; $signature = $this->signatures[$methodname]; $returnType = array_shift($signature); // Check the number of arguments. Check only, if the minimum count of parameters is specified. More parameters are possible. // This is a hack to allow optional parameters... - if (count($args) < count($signature)) { + if(count($args) < count($signature)) { // print 'Num of args: '.count($args).' Num in signature: '.count($signature); return new IXR_Error(-32602, 'server error. wrong number of method parameters'); } + // Check the argument types $ok = true; $argsbackup = $args; - for ($i = 0, $j = count($args); $i < $j; $i++) { + for($i = 0, $j = count($args); $i < $j; $i++) { $arg = array_shift($args); $type = array_shift($signature); - switch ($type) { + switch($type) { case 'int': case 'i4': - if (is_array($arg) || !is_int($arg)) { + if(is_array($arg) || !is_int($arg)) { $ok = false; } break; case 'base64': case 'string': - if (!is_string($arg)) { + if(!is_string($arg)) { $ok = false; } break; case 'boolean': - if ($arg !== false && $arg !== true) { + if($arg !== false && $arg !== true) { $ok = false; } break; case 'float': case 'double': - if (!is_float($arg)) { + if(!is_float($arg)) { $ok = false; } break; case 'date': case 'dateTime.iso8601': - if (!is_a($arg, 'IXR_Date')) { + if(!is_a($arg, 'IXR_Date')) { $ok = false; } break; } - if (!$ok) { + if(!$ok) { return new IXR_Error(-32602, 'server error. invalid method parameters'); } } // It passed the test - run the "real" method call return parent::call($methodname, $argsbackup); } + + /** + * @param string $method + * @return array|IXR_Error + */ function methodSignature($method) { - if (!$this->hasMethod($method)) { - return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.'); + if(!$this->hasMethod($method)) { + return new IXR_Error(-32601, 'server error. requested method "' . $method . '" not specified.'); } // We should be returning an array of types $types = $this->signatures[$method]; $return = array(); - foreach ($types as $type) { - switch ($type) { + foreach($types as $type) { + switch($type) { case 'string': $return[] = 'string'; break; @@ -788,18 +1080,40 @@ class IXR_IntrospectionServer extends IXR_Server { } return $return; } + + /** + * @param string $method + * @return mixed + */ function methodHelp($method) { return $this->help[$method]; } } - +/** + * IXR_ClientMulticall + * + * @package IXR + * @since 1.5 + */ class IXR_ClientMulticall extends IXR_Client { + + /** @var array[] */ var $calls = array(); + + /** + * @param string $server + * @param string|bool $path + * @param int $port + */ function IXR_ClientMulticall($server, $path = false, $port = 80) { parent::IXR_Client($server, $path, $port); //$this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)'; } + + /** + * Add a call + */ function addCall() { $args = func_get_args(); $methodName = array_shift($args); @@ -809,6 +1123,10 @@ class IXR_ClientMulticall extends IXR_Client { ); $this->calls[] = $struct; } + + /** + * @return bool + */ function query() { // Prepare multicall, then call the parent::query() method return parent::query('system.multicall', $this->calls); diff --git a/inc/Input.class.php b/inc/Input.class.php index 94da2a10e..199994d8d 100644 --- a/inc/Input.class.php +++ b/inc/Input.class.php @@ -83,7 +83,6 @@ class Input { * * @see isset * @param string $name Parameter name - * @return bool */ public function remove($name) { if(isset($this->access[$name])) { @@ -132,7 +131,7 @@ class Input { * @param string $name Parameter name * @param mixed $default If parameter is not set, initialize with this value * @param bool $nonempty Init with $default if parameter is set but empty() - * @return &mixed + * @return mixed (reference) */ public function &ref($name, $default = '', $nonempty = false) { if(!isset($this->access[$name]) || ($nonempty && empty($this->access[$name]))) { @@ -146,7 +145,7 @@ class Input { * Access a request parameter as int * * @param string $name Parameter name - * @param mixed $default Default to return if parameter isn't set or is an array + * @param int $default Default to return if parameter isn't set or is an array * @param bool $nonempty Return $default if parameter is set but empty() * @return int */ @@ -164,7 +163,7 @@ class Input { * Access a request parameter as string * * @param string $name Parameter name - * @param mixed $default Default to return if parameter isn't set or is an array + * @param string $default Default to return if parameter isn't set or is an array * @param bool $nonempty Return $default if parameter is set but empty() * @return string */ @@ -246,7 +245,7 @@ class Input { * * This function returns the $INPUT object itself for easy chaining * - * @param $name + * @param string $name * @return Input */ public function extract($name){ diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php index a35ec3ed0..d50bad9b7 100644 --- a/inc/JpegMeta.php +++ b/inc/JpegMeta.php @@ -42,6 +42,7 @@ class JpegMeta { var $_fileName; var $_fp = null; + var $_fpout = null; var $_type = 'unknown'; var $_markers; @@ -132,6 +133,9 @@ class JpegMeta { * through one function * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array|string $fields field name or array with field names + * @return bool|string */ function getField($fields) { if(!is_array($fields)) $fields = array($fields); @@ -177,6 +181,10 @@ class JpegMeta { * through one function * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $field field name + * @param string $value + * @return bool success or fail */ function setField($field, $value) { if(strtolower(substr($field,0,5)) == 'iptc.'){ @@ -193,6 +201,9 @@ class JpegMeta { * through one function * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $field field name + * @return bool */ function deleteField($field) { if(strtolower(substr($field,0,5)) == 'iptc.'){ @@ -208,6 +219,9 @@ class JpegMeta { * Return a date field * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $field + * @return false|string */ function getDateField($field) { if (!isset($this->_info['dates'])) { @@ -225,6 +239,9 @@ class JpegMeta { * Return a file info field * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $field field name + * @return false|string */ function getFileField($field) { if (!isset($this->_info['file'])) { @@ -243,6 +260,8 @@ class JpegMeta { * * @author Andreas Gohr <andi@splitbrain.org> * @todo handle makernotes + * + * @return false|string */ function getCamera(){ $make = $this->getField(array('Exif.Make','Exif.TIFFMake')); @@ -256,6 +275,8 @@ class JpegMeta { * Return shutter speed as a ratio * * @author Joe Lapp <joe.lapp@pobox.com> + * + * @return string */ function getShutterSpeed() { if (!isset($this->_info['exif'])) { @@ -274,6 +295,9 @@ class JpegMeta { * Return an EXIF field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return false|string */ function getExifField($field) { if (!isset($this->_info['exif'])) { @@ -295,6 +319,9 @@ class JpegMeta { * Return an XMP field * * @author Hakan Sandell <hakan.sandell@mydata.se> + * + * @param string $field field name + * @return false|string */ function getXmpField($field) { if (!isset($this->_info['xmp'])) { @@ -316,6 +343,9 @@ class JpegMeta { * Return an Adobe Field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return false|string */ function getAdobeField($field) { if (!isset($this->_info['adobe'])) { @@ -337,6 +367,9 @@ class JpegMeta { * Return an IPTC field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return false|string */ function getIPTCField($field) { if (!isset($this->_info['iptc'])) { @@ -359,6 +392,10 @@ class JpegMeta { * * @author Sebastian Delmont <sdelmont@zonageek.com> * @author Joe Lapp <joe.lapp@pobox.com> + * + * @param string $field field name + * @param string $value + * @return bool */ function setExifField($field, $value) { if (!isset($this->_info['exif'])) { @@ -389,6 +426,10 @@ class JpegMeta { * Set an Adobe Field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @param string $value + * @return bool */ function setAdobeField($field, $value) { if (!isset($this->_info['adobe'])) { @@ -413,6 +454,10 @@ class JpegMeta { * dimensions * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param int $maxwidth + * @param int $maxheight + * @return float|int */ function getResizeRatio($maxwidth,$maxheight=0){ if(!$maxheight) $maxheight = $maxwidth; @@ -442,6 +487,10 @@ class JpegMeta { * Set an IPTC field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @param string $value + * @return bool */ function setIPTCField($field, $value) { if (!isset($this->_info['iptc'])) { @@ -465,6 +514,9 @@ class JpegMeta { * Delete an EXIF field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return bool */ function deleteExifField($field) { if (!isset($this->_info['exif'])) { @@ -486,6 +538,9 @@ class JpegMeta { * Delete an Adobe field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return bool */ function deleteAdobeField($field) { if (!isset($this->_info['adobe'])) { @@ -507,6 +562,9 @@ class JpegMeta { * Delete an IPTC field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return bool */ function deleteIPTCField($field) { if (!isset($this->_info['iptc'])) { @@ -527,12 +585,12 @@ class JpegMeta { /** * Get the image's title, tries various fields * - * @param int $max maximum number chars (keeps words) + * @param int $max maximum number chars (keeps words) + * @return false|string + * * @author Andreas Gohr <andi@splitbrain.org> */ function getTitle($max=80){ - $cap = ''; - // try various fields $cap = $this->getField(array('Iptc.Headline', 'Iptc.Caption', @@ -555,11 +613,14 @@ class JpegMeta { * Gather various date fields * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @return array|bool */ function getDates() { $this->_parseAll(); if ($this->_markers == null) { if (@isset($this->_info['file']['UnixTime'])) { + $dates = array(); $dates['FileModified'] = $this->_info['file']['UnixTime']; $dates['Time'] = $this->_info['file']['UnixTime']; $dates['TimeSource'] = 'FileModified'; @@ -690,6 +751,8 @@ class JpegMeta { * Get the image width, tries various fields * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @return false|string */ function getWidth() { if (!isset($this->_info['sof'])) { @@ -719,6 +782,8 @@ class JpegMeta { * Get the image height, tries various fields * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @return false|string */ function getHeight() { if (!isset($this->_info['sof'])) { @@ -748,6 +813,8 @@ class JpegMeta { * Get an dimension string for use in img tag * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @return false|string */ function getDimStr() { if ($this->_markers == null) { @@ -764,6 +831,9 @@ class JpegMeta { * Checks for an embedded thumbnail * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $which possible values: 'any', 'exif' or 'adobe' + * @return false|string */ function hasThumbnail($which = 'any') { if (($which == 'any') || ($which == 'exif')) { @@ -805,6 +875,9 @@ class JpegMeta { * Send embedded thumbnail to browser * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $which possible values: 'any', 'exif' or 'adobe' + * @return bool */ function sendThumbnail($which = 'any') { $data = null; @@ -855,6 +928,9 @@ class JpegMeta { * * @author Sebastian Delmont <sdelmont@zonageek.com> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $fileName file name or empty string for a random name + * @return bool */ function save($fileName = "") { if ($fileName == "") { @@ -1334,7 +1410,6 @@ class JpegMeta { return false; } - $pos = 0; $this->_info['jfif'] = array(); $vmaj = $this->_getByte($data, 5); @@ -1420,7 +1495,6 @@ class JpegMeta { break; default: return false; - break; } $this->_info['sof']['Format'] = $format; diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php index e90b45f99..087d82c99 100644 --- a/inc/Mailer.class.php +++ b/inc/Mailer.class.php @@ -108,6 +108,9 @@ class Mailer { /** * Callback function to automatically embed images referenced in HTML templates + * + * @param array $matches + * @return string placeholder */ protected function autoembed_cb($matches) { static $embeds = 0; @@ -130,7 +133,7 @@ class Mailer { * If an empy value is passed, the header is removed * * @param string $header the header name (no trailing colon!) - * @param string $value the value of the header + * @param string|string[] $value the value of the header * @param bool $clean remove all non-ASCII chars and line feeds? */ public function setHeader($header, $value, $clean = true) { @@ -160,6 +163,8 @@ class Mailer { * * Whatever is set here is directly passed to PHP's mail() command as last * parameter. Depending on the PHP setup this might break mailing alltogether + * + * @param string $param */ public function setParameters($param) { $this->sendparam = $param; @@ -177,7 +182,7 @@ class Mailer { * @param string $text plain text body * @param array $textrep replacements to apply on the text part * @param array $htmlrep replacements to apply on the HTML part, leave null to use $textrep - * @param array $html the HTML body, leave null to create it from $text + * @param string $html the HTML body, leave null to create it from $text * @param bool $wrap wrap the HTML in the default header/Footer */ public function setBody($text, $textrep = null, $htmlrep = null, $html = null, $wrap = true) { @@ -265,6 +270,8 @@ class Mailer { * Placeholders can be used to reference embedded attachments * * You probably want to use setBody() instead + * + * @param string $html */ public function setHTML($html) { $this->html = $html; @@ -274,6 +281,8 @@ class Mailer { * Set the plain text part of the mail * * You probably want to use setBody() instead + * + * @param string $text */ public function setText($text) { $this->text = $text; @@ -283,7 +292,7 @@ class Mailer { * Add the To: recipients * * @see cleanAddress - * @param string|array $address Multiple adresses separated by commas or as array + * @param string|string[] $address Multiple adresses separated by commas or as array */ public function to($address) { $this->setHeader('To', $address, false); @@ -293,7 +302,7 @@ class Mailer { * Add the Cc: recipients * * @see cleanAddress - * @param string|array $address Multiple adresses separated by commas or as array + * @param string|string[] $address Multiple adresses separated by commas or as array */ public function cc($address) { $this->setHeader('Cc', $address, false); @@ -303,7 +312,7 @@ class Mailer { * Add the Bcc: recipients * * @see cleanAddress - * @param string|array $address Multiple adresses separated by commas or as array + * @param string|string[] $address Multiple adresses separated by commas or as array */ public function bcc($address) { $this->setHeader('Bcc', $address, false); @@ -340,8 +349,8 @@ class Mailer { * Example: * cc("föö <foo@bar.com>, me@somewhere.com","TBcc"); * - * @param string|array $addresses Multiple adresses separated by commas or as array - * @return bool|string the prepared header (can contain multiple lines) + * @param string|string[] $addresses Multiple adresses separated by commas or as array + * @return false|string the prepared header (can contain multiple lines) */ public function cleanAddress($addresses) { // No named recipients for To: in Windows (see FS#652) @@ -418,6 +427,8 @@ class Mailer { * Prepare the mime multiparts for all attachments * * Replaces placeholders in the HTML with the correct CIDs + * + * @return string mime multiparts */ protected function prepareAttachments() { $mime = ''; @@ -565,9 +576,9 @@ class Mailer { /** * Returns a complete, EOL terminated header line, wraps it if necessary * - * @param $key - * @param $val - * @return string + * @param string $key + * @param string $val + * @return string line */ protected function wrappedHeaderLine($key, $val){ return wordwrap("$key: $val", 78, MAILHEADER_EOL.' ').MAILHEADER_EOL; diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php index db6a3a77c..15f896dcf 100644 --- a/inc/PassHash.class.php +++ b/inc/PassHash.class.php @@ -16,8 +16,9 @@ class PassHash { * match true is is returned else false * * @author Andreas Gohr <andi@splitbrain.org> - * @param $clear string Clear-Text password - * @param $hash string Hash to compare against + * + * @param string $clear Clear-Text password + * @param string $hash Hash to compare against * @return bool */ function verify_hash($clear, $hash) { @@ -109,9 +110,9 @@ class PassHash { * If $salt is not null, the value is kept, but the lenght restriction is * applied (unless, $cut is false). * - * @param string &$salt The salt, pass null if you want one generated - * @param int $len The length of the salt - * @param bool $cut Apply length restriction to existing salt? + * @param string|null &$salt The salt, pass null if you want one generated + * @param int $len The length of the salt + * @param bool $cut Apply length restriction to existing salt? */ public function init_salt(&$salt, $len = 32, $cut = true) { if(is_null($salt)) { @@ -135,6 +136,7 @@ class PassHash { * @author Andreas Gohr <andi@splitbrain.org> * @author <mikey_nich at hotmail dot com> * @link http://de.php.net/manual/en/function.crypt.php#73619 + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @return string Hashed password @@ -175,6 +177,7 @@ class PassHash { * * @author <mikey_nich at hotmail dot com> * @link http://de.php.net/manual/en/function.crypt.php#73619 + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @param string $magic The hash identifier (apr1 or 1) @@ -337,6 +340,7 @@ class PassHash { * an exception. * * @link http://www.openwall.com/phpass/ + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @param string $magic The hash identifier (P or H) @@ -404,6 +408,7 @@ class PassHash { * This is used by the Django Python framework * * @link http://docs.djangoproject.com/en/dev/topics/auth/#passwords + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @return string Hashed password @@ -420,6 +425,7 @@ class PassHash { * This is used by the Django Python framework * * @link http://docs.djangoproject.com/en/dev/topics/auth/#passwords + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @return string Hashed password @@ -486,6 +492,7 @@ class PassHash { * method 'A' is not supported. * * @link http://www.mediawiki.org/wiki/Manual_talk:User_table#user_password_column + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @return string Hashed password @@ -511,7 +518,6 @@ class PassHash { * @param string $data Message to be hashed. * @param string $key Shared secret key used for generating the HMAC variant of the message digest. * @param bool $raw_output When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits. - * * @return string */ public static function hmac($algo, $data, $key, $raw_output = false) { @@ -545,9 +551,8 @@ class PassHash { /** * Use DokuWiki's secure random generator if available * - * @param $min - * @param $max - * + * @param int $min + * @param int $max * @return int */ protected function random($min, $max){ diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index ffa03ee93..c0e6869f1 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -13,6 +13,11 @@ class RemoteAPICore { $this->api = $api; } + /** + * Returns details about the core methods + * + * @return array + */ function __getRemoteInfo() { return array( 'dokuwiki.getVersion' => array( @@ -158,19 +163,27 @@ class RemoteAPICore { ); } + /** + * @return string + */ function getVersion() { return getVersion(); } + /** + * @return int unix timestamp + */ function getTime() { return time(); } /** * Return a raw wiki page + * * @param string $id wiki page id - * @param string $rev revision number of the page - * @return page text. + * @param int|string $rev revision timestamp of the page or empty string + * @return string page text. + * @throws RemoteAccessDeniedException if no permission for page */ function rawPage($id,$rev=''){ $id = $this->resolvePageId($id); @@ -189,8 +202,11 @@ class RemoteAPICore { * Return a media file * * @author Gina Haeussge <osd@foosel.net> + * * @param string $id file id - * @return media file + * @return mixed media file + * @throws RemoteAccessDeniedException no permission for media + * @throws RemoteException not exist */ function getAttachment($id){ $id = cleanID($id); @@ -211,6 +227,9 @@ class RemoteAPICore { * Return info about a media file * * @author Gina Haeussge <osd@foosel.net> + * + * @param string $id page id + * @return array */ function getAttachmentInfo($id){ $id = cleanID($id); @@ -230,6 +249,11 @@ class RemoteAPICore { /** * Return a wiki page rendered to html + * + * @param string $id page id + * @param string|int $rev revision timestamp or empty string + * @return null|string html + * @throws RemoteAccessDeniedException no access to page */ function htmlPage($id,$rev=''){ $id = $this->resolvePageId($id); @@ -241,6 +265,8 @@ class RemoteAPICore { /** * List all pages - we use the indexer list here + * + * @return array */ function listPages(){ $list = array(); @@ -265,6 +291,12 @@ class RemoteAPICore { /** * List all pages in the given namespace (and below) + * + * @param string $ns + * @param array $opts + * $opts['depth'] recursion level, 0 for all + * $opts['hash'] do md5 sum of content? + * @return array */ function readNamespace($ns,$opts){ global $conf; @@ -281,9 +313,12 @@ class RemoteAPICore { /** * List all pages in the given namespace (and below) + * + * @param string $query + * @return array */ function search($query){ - $regex = ''; + $regex = array(); $data = ft_pageSearch($query,$regex); $pages = array(); @@ -314,6 +349,8 @@ class RemoteAPICore { /** * Returns the wiki title. + * + * @return string */ function getTitle(){ global $conf; @@ -328,6 +365,15 @@ class RemoteAPICore { * a regular expression matching their name. * * @author Gina Haeussge <osd@foosel.net> + * + * @param string $ns + * @param array $options + * $options['depth'] recursion level, 0 for all + * $options['showmsg'] shows message if invalid media id is used + * $options['pattern'] check given pattern + * $options['hash'] add hashes to result list + * @return array + * @throws RemoteAccessDeniedException no access to the media files */ function listAttachments($ns, $options = array()) { global $conf; @@ -359,6 +405,9 @@ class RemoteAPICore { /** * Return a list of backlinks + * + * @param string $id page id + * @return array */ function listBackLinks($id){ return ft_backlinks($this->resolvePageId($id)); @@ -366,6 +415,12 @@ class RemoteAPICore { /** * Return some basic data about a page + * + * @param string $id page id + * @param string|int $rev revision timestamp or empty string + * @return array + * @throws RemoteAccessDeniedException no access for page + * @throws RemoteException page not exist */ function pageInfo($id,$rev=''){ $id = $this->resolvePageId($id); @@ -395,6 +450,13 @@ class RemoteAPICore { * Save a wiki page * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @param string $text wiki text + * @param array $params parameters: summary, minor edit + * @return bool + * @throws RemoteAccessDeniedException no write access for page + * @throws RemoteException no id, empty new page or locked */ function putPage($id, $text, $params) { global $TEXT; @@ -451,6 +513,11 @@ class RemoteAPICore { /** * Appends text to a wiki page. + * + * @param string $id page id + * @param string $text wiki text + * @param array $params such as summary,minor + * @return bool|string */ function appendPage($id, $text, $params) { $currentpage = $this->rawPage($id); @@ -464,6 +531,12 @@ class RemoteAPICore { * Uploads a file to the wiki. * * Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @param string $file + * @param array $params such as overwrite + * @return false|string + * @throws RemoteException */ function putAttachment($id, $file, $params) { $id = cleanID($id); @@ -493,6 +566,11 @@ class RemoteAPICore { * Deletes a file from the wiki. * * @author Gina Haeussge <osd@foosel.net> + * + * @param string $id page id + * @return int + * @throws RemoteAccessDeniedException no permissions + * @throws RemoteException file in use or not deleted */ function deleteAttachment($id){ $id = cleanID($id); @@ -511,6 +589,9 @@ class RemoteAPICore { /** * Returns the permissions of a given wiki page + * + * @param string $id page id + * @return int permission level */ function aclCheck($id) { $id = $this->resolvePageId($id); @@ -521,6 +602,10 @@ class RemoteAPICore { * Lists all links contained in a wiki page * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @return array + * @throws RemoteAccessDeniedException no read access for page */ function listLinks($id) { $id = $this->resolvePageId($id); @@ -571,6 +656,10 @@ class RemoteAPICore { * * @author Michael Hamann <michael@content-space.de> * @author Michael Klier <chi@chimeric.de> + * + * @param int $timestamp unix timestamp + * @return array + * @throws RemoteException no valid timestamp */ function getRecentChanges($timestamp) { if(strlen($timestamp) != 10) { @@ -596,7 +685,7 @@ class RemoteAPICore { return $changes; } else { // in case we still have nothing at this point - return new RemoteException('There are no changes in the specified timeframe', 321); + throw new RemoteException('There are no changes in the specified timeframe', 321); } } @@ -605,6 +694,10 @@ class RemoteAPICore { * * @author Michael Hamann <michael@content-space.de> * @author Michael Klier <chi@chimeric.de> + * + * @param int $timestamp unix timestamp + * @return array + * @throws RemoteException no valid timestamp */ function getRecentMediaChanges($timestamp) { if(strlen($timestamp) != 10) @@ -637,6 +730,12 @@ class RemoteAPICore { * Returns a list of available revisions of a given wiki page * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @param int $first skip the first n changelog lines + * @return array + * @throws RemoteAccessDeniedException no read access for page + * @throws RemoteException empty id */ function pageVersions($id, $first) { $id = $this->resolvePageId($id); @@ -681,6 +780,7 @@ class RemoteAPICore { $pagelog->setChunkSize(1024); $info = $pagelog->getRevisionInfo($time); if(!empty($info)) { + $data = array(); $data['user'] = $info['user']; $data['ip'] = $info['ip']; $data['type'] = $info['type']; @@ -713,6 +813,9 @@ class RemoteAPICore { * * Returns an associative array with the keys locked, lockfail, unlocked and * unlockfail, each containing lists of pages. + * + * @param array[] $set list pages with array('lock' => array, 'unlock' => array) + * @return array */ function setLocks($set){ $locked = array(); @@ -747,13 +850,27 @@ class RemoteAPICore { ); } + /** + * Return API version + * + * @return int + */ function getAPIVersion(){ return DOKU_API_VERSION; } + /** + * Login + * + * @param string $user + * @param string $pass + * @return int + */ function login($user,$pass){ global $conf; + /** @var DokuWiki_Auth_Plugin $auth */ global $auth; + if(!$conf['useacl']) return 0; if(!$auth) return 0; @@ -774,6 +891,11 @@ class RemoteAPICore { return $ok; } + /** + * Log off + * + * @return int + */ function logoff(){ global $conf; global $auth; @@ -785,6 +907,12 @@ class RemoteAPICore { return 1; } + /** + * Resolve page id + * + * @param string $id page id + * @return string + */ private function resolvePageId($id) { $id = cleanID($id); if(empty($id)) { diff --git a/inc/Sitemapper.php b/inc/Sitemapper.php index 6332746a6..0325f6d44 100644 --- a/inc/Sitemapper.php +++ b/inc/Sitemapper.php @@ -24,6 +24,8 @@ class Sitemapper { * @author Andreas Gohr * @link https://www.google.com/webmasters/sitemaps/docs/en/about.html * @link http://www.sitemaps.org/ + * + * @return bool */ public static function generate(){ global $conf; @@ -53,7 +55,7 @@ class Sitemapper { foreach($pages as $id){ //skip hidden, non existing and restricted files if(isHiddenPage($id)) continue; - if(auth_aclcheck($id,'','') < AUTH_READ) continue; + if(auth_aclcheck($id,'',array()) < AUTH_READ) continue; $item = SitemapItem::createFromID($id); if ($item !== null) $items[] = $item; @@ -75,6 +77,7 @@ class Sitemapper { * * @param $items array The SitemapItems that shall be included in the sitemap. * @return string The sitemap XML. + * * @author Michael Hamann */ private static function getXML($items) { @@ -95,6 +98,7 @@ class Sitemapper { * Helper function for getting the path to the sitemap file. * * @return string The path to the sitemap file. + * * @author Michael Hamann */ public static function getFilePath() { @@ -123,6 +127,8 @@ class Sitemapper { * urls to ping using the SITEMAP_PING event. * * @author Michael Hamann + * + * @return bool */ public static function pingSearchEngines() { //ping search engines... @@ -168,9 +174,9 @@ class SitemapItem { /** * Create a new item. * - * @param $url string The url of the item - * @param $lastmod int Timestamp of the last modification - * @param $changefreq string How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never. + * @param string $url The url of the item + * @param int $lastmod Timestamp of the last modification + * @param string $changefreq How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never. * @param $priority float|string The priority of the item relative to other URLs on your site. Valid values range from 0.0 to 1.0. */ public function __construct($url, $lastmod, $changefreq = null, $priority = null) { @@ -183,9 +189,9 @@ class SitemapItem { /** * Helper function for creating an item for a wikipage id. * - * @param $id string A wikipage id. - * @param $changefreq string How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never. - * @param $priority float|string The priority of the item relative to other URLs on your site. Valid values range from 0.0 to 1.0. + * @param string $id A wikipage id. + * @param string $changefreq How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never. + * @param float|string $priority The priority of the item relative to other URLs on your site. Valid values range from 0.0 to 1.0. * @return SitemapItem The sitemap item. */ public static function createFromID($id, $changefreq = null, $priority = null) { diff --git a/inc/Tar.class.php b/inc/Tar.class.php index 903f7f35c..0dc7dace2 100644 --- a/inc/Tar.class.php +++ b/inc/Tar.class.php @@ -53,6 +53,7 @@ class Tar { protected $file = ''; protected $comptype = Tar::COMPRESS_AUTO; + /** @var resource|int */ protected $fh; protected $memory = ''; protected $closed = true; @@ -105,6 +106,9 @@ class Tar { * * The archive is closed afer reading the contents, because rewinding is not possible in bzip2 streams. * Reopen the file with open() again if you want to do additional operations + * + * @return array + * @throws TarIOException */ public function contents() { if($this->closed || !$this->file) throw new TarIOException('Can not read from a closed archive'); @@ -270,6 +274,7 @@ class Tar { * Add a file to the current TAR archive using an existing file in the filesystem * * @todo handle directory adding + * * @param string $file the original file * @param string $name the name to use for the file in the archive * @throws TarIOException @@ -377,6 +382,10 @@ class Tar { * Returns the created in-memory archive data * * This implicitly calls close() on the Archive + * + * @param int $comptype + * @param int $complevel + * @return mixed|string */ public function getArchive($comptype = Tar::COMPRESS_AUTO, $complevel = 9) { $this->close(); @@ -395,7 +404,7 @@ class Tar { * Note: It more memory effective to specify the filename in the create() function and * let the library work on the new file directly. * - * @param $file + * @param string $file * @param int $comptype * @param int $complevel * @throws TarIOException @@ -522,7 +531,7 @@ class Tar { * Decode the given tar file header * * @param string $block a 512 byte block containign the header data - * @return array|bool + * @return false|array */ protected function parseHeader($block) { if(!$block || strlen($block) != 512) return false; @@ -536,6 +545,7 @@ class Tar { $header = @unpack("a100filename/a8perm/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor/a155prefix", $block); if(!$header) return false; + $return = array(); $return['checksum'] = OctDec(trim($header['checksum'])); if($return['checksum'] != $chks) return false; @@ -570,7 +580,7 @@ class Tar { /** * Cleans up a path and removes relative parts, also strips leading slashes * - * @param string $p_dir + * @param string $path * @return string */ public function cleanPath($path) { @@ -590,7 +600,7 @@ class Tar { /** * Checks if the given compression type is available and throws an exception if not * - * @param $comptype + * @param int $comptype * @throws TarIllegalCompressionException */ protected function compressioncheck($comptype) { @@ -624,8 +634,14 @@ class Tar { } } +/** + * Class TarIOException + */ class TarIOException extends Exception { } +/** + * Class TarIllegalCompressionException + */ class TarIllegalCompressionException extends Exception { } diff --git a/inc/ZipLib.class.php b/inc/ZipLib.class.php index 918d38579..5b524c4ab 100644 --- a/inc/ZipLib.class.php +++ b/inc/ZipLib.class.php @@ -16,6 +16,10 @@ class ZipLib { var $old_offset = 0; var $dirs = Array("."); + /** + * @param string $zip_name filename path to file + * @return array|int + */ function get_List($zip_name) { $zip = @fopen($zip_name, 'rb'); if(!$zip) return(0); @@ -24,10 +28,12 @@ class ZipLib { @rewind($zip); @fseek($zip, $centd['offset']); + $ret = array(); for ($i=0; $i<$centd['entries']; $i++) { $header = $this->ReadCentralFileHeaders($zip); $header['index'] = $i; + $info = array(); $info['filename'] = $header['filename']; $info['stored_filename'] = $header['stored_filename']; $info['size'] = $header['size']; @@ -45,9 +51,15 @@ class ZipLib { return $ret; } + /** + * @param array $files array filled with array(string filename, string data) + * @param bool $compact + * @return array + */ function Add($files,$compact) { if(!is_array($files[0])) $files=Array($files); + $ret = array(); for($i=0;$files[$i];$i++){ $fn = $files[$i]; if(!in_Array(dirname($fn[0]),$this->dirs)) @@ -60,6 +72,10 @@ class ZipLib { /** * Zips recursively the $folder directory, from the $basedir directory + * + * @param string $folder filename path to file + * @param string|null $basedir + * @param string|null $parent */ function Compress($folder, $basedir=null, $parent=null) { $full_path = $basedir."/".$parent.$folder; @@ -70,6 +86,7 @@ class ZipLib { } $dir = new DirectoryIterator($full_path); foreach($dir as $file) { + /** @var DirectoryIterator $file */ if(!$file->isDot()) { $filename = $file->getFilename(); if($file->isDir()) { @@ -84,6 +101,8 @@ class ZipLib { /** * Returns the Zip file + * + * @return string */ function get_file() { $data = implode('', $this -> datasec); @@ -94,6 +113,9 @@ class ZipLib { pack('V', strlen($ctrldir)) . pack('V', strlen($data)) . "\x00\x00"; } + /** + * @param string $name the name of the directory + */ function add_dir($name) { $name = str_replace("\\", "/", $name); $fr = "\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00"; @@ -117,8 +139,13 @@ class ZipLib { /** * Add a file named $name from a string $data + * + * @param string $data + * @param string $name filename + * @param bool $compact + * @return bool */ - function add_File($data, $name, $compact = 1) { + function add_File($data, $name, $compact = true) { $name = str_replace('\\', '/', $name); $dtime = dechex($this->DosTime()); @@ -166,6 +193,9 @@ class ZipLib { return true; } + /** + * @return int + */ function DosTime() { $timearray = getdate(); if ($timearray['year'] < 1980) { @@ -186,10 +216,14 @@ class ZipLib { /** * Extract a zip file $zn to the $to directory + * + * @param string $zn filename + * @param string $to filename path to file + * @param array $index + * @return array|int */ function Extract ( $zn, $to, $index = Array(-1) ) { if(!@is_dir($to)) $this->_mkdir($to); - $ok = 0; $zip = @fopen($zn,'rb'); if(!$zip) return(-1); $cdir = $this->ReadCentralDir($zip,$zn); @@ -203,6 +237,7 @@ class ZipLib { return(-1); } + $stat = array(); for ($i=0; $i<$cdir['entries']; $i++) { @fseek($zip, $pos_entry); $header = $this->ReadCentralFileHeaders($zip); @@ -218,6 +253,11 @@ class ZipLib { return $stat; } + /** + * @param resource $zip + * @param array $header + * @return array + */ function ReadFileHeader($zip, $header) { $binary_data = fread($zip, 30); $data = unpack('vchk/vid/vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $binary_data); @@ -254,6 +294,10 @@ class ZipLib { return $header; } + /** + * @param resource $zip + * @return array + */ function ReadCentralFileHeaders($zip){ $binary_data = fread($zip, 46); $header = unpack('vchkid/vid/vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $binary_data); @@ -295,6 +339,11 @@ class ZipLib { return $header; } + /** + * @param resource $zip + * @param string $zip_name filename path to file + * @return array + */ function ReadCentralDir($zip,$zip_name) { $size = filesize($zip_name); if ($size < 277){ @@ -320,6 +369,7 @@ class ZipLib { $data=unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', fread($zip, 18)); + $centd = array(); if ($data['comment_size'] != 0){ $centd['comment'] = fread($zip, $data['comment_size']); } else { @@ -334,6 +384,12 @@ class ZipLib { return $centd; } + /** + * @param array $header + * @param string $to filename path to file + * @param resource $zip + * @return bool|int + */ function ExtractFile($header,$to,$zip) { $header = $this->readfileheader($zip, $header); @@ -414,14 +470,20 @@ class ZipLib { * centralize mkdir calls and use dokuwiki io functions * * @author Christopher Smith <chris@jalakai.co.uk> + * + * @param string $d filename path to file + * @return bool|int|string */ function _mkdir($d) { return io_mkdir_p($d); } - + /** + * @param string $zn + * @param string $name + * @return null|string + */ function ExtractStr($zn, $name) { - $ok = 0; $zip = @fopen($zn,'rb'); if(!$zip) return(null); $cdir = $this->ReadCentralDir($zip,$zn); @@ -445,8 +507,13 @@ class ZipLib { return null; } + /** + * @param array $header + * @param resource $zip + * @return null|string + */ function ExtractStrFile($header,$zip) { - $hdr = $this->readfileheader($zip); + $hdr = $this->readfileheader($zip, $header); $binary_data = ''; if (!($header['external']==0x41FF0010) && !($header['external']==16)) { if ($header['compression']==0) { @@ -484,6 +551,10 @@ class ZipLib { return null; } + /** + * @param string $val + * @return int|string + */ function _ret_bytes($val) { $val = trim($val); $last = $val{strlen($val)-1}; diff --git a/inc/actions.php b/inc/actions.php index ef09a0dc7..709c19ddd 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -200,6 +200,7 @@ function act_dispatch(){ global $license; //call template FIXME: all needed vars available? + $headers = array(); $headers[] = 'Content-Type: text/html; charset=utf-8'; trigger_event('ACTION_HEADERS_SEND',$headers,'act_sendheaders'); @@ -221,6 +222,9 @@ function act_sendheaders($headers) { * Sanitize the action command * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array|string $act + * @return string */ function act_clean($act){ // check if the action was given as array key @@ -245,6 +249,9 @@ function act_clean($act){ * Add all allowed commands here. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array|string $act + * @return string */ function act_validate($act) { global $conf; @@ -284,10 +291,12 @@ function act_validate($act) { * Run permissionchecks * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_permcheck($act){ global $INFO; - global $conf; if(in_array($act,array('save','preview','edit','recover'))){ if($INFO['exists']){ @@ -330,6 +339,9 @@ function act_permcheck($act){ * Handle 'draftdel' * * Deletes the draft for the current page and user + * + * @param string $act action command + * @return string action command */ function act_draftdel($act){ global $INFO; @@ -342,6 +354,9 @@ function act_draftdel($act){ * Saves a draft on preview * * @todo this currently duplicates code from ajax.php :-/ + * + * @param string $act action command + * @return string action command */ function act_draftsave($act){ global $INFO; @@ -372,6 +387,9 @@ function act_draftsave($act){ * returns a new action. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_save($act){ global $ID; @@ -394,7 +412,7 @@ function act_save($act){ return 'conflict'; //save it - saveWikiText($ID,con($PRE,$TEXT,$SUF,1),$SUM,$INPUT->bool('minor')); //use pretty mode for con + saveWikiText($ID,con($PRE,$TEXT,$SUF,true),$SUM,$INPUT->bool('minor')); //use pretty mode for con //unlock it unlock($ID); @@ -410,6 +428,9 @@ function act_save($act){ * Revert to a certain revision * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_revert($act){ global $ID; @@ -457,6 +478,9 @@ function act_revert($act){ * Do a redirect after receiving post data * * Tries to add the section id as hash mark after section editing + * + * @param string $id page id + * @param string $preact action command before redirect */ function act_redirect($id,$preact){ global $PRE; @@ -478,7 +502,7 @@ function act_redirect($id,$preact){ /** * Execute the redirect * - * @param array $opts id and fragment for the redirect + * @param array $opts id and fragment for the redirect and the preact */ function act_redirect_execute($opts){ $go = wl($opts['id'],'',true); @@ -492,6 +516,9 @@ function act_redirect_execute($opts){ * Handle 'login', 'logout' * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_auth($act){ global $ID; @@ -527,6 +554,9 @@ function act_auth($act){ * Handle 'edit', 'preview', 'recover' * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_edit($act){ global $ID; @@ -591,6 +621,9 @@ function act_edit($act){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Michael Klier <chi@chimeric.de> + * + * @param string $act action command + * @return string action command */ function act_export($act){ global $ID; @@ -600,7 +633,6 @@ function act_export($act){ $pre = ''; $post = ''; - $output = ''; $headers = array(); // search engines: never cache exported docs! (Google only currently) @@ -644,7 +676,7 @@ function act_export($act){ $output = p_wiki_xhtml($ID,$REV,false); break; default: - $output = p_cached_output(wikiFN($ID,$REV), $mode); + $output = p_cached_output(wikiFN($ID,$REV), $mode, $ID); $headers = p_get_metadata($ID,"format $mode"); break; } @@ -672,6 +704,8 @@ function act_export($act){ * Handle sitemap delivery * * @author Michael Hamann <michael@content-space.de> + * + * @param string $act action command */ function act_sitemap($act) { global $conf; @@ -720,6 +754,10 @@ function act_sitemap($act) { * Throws exception on error. * * @author Adrian Lang <lang@cosmocode.de> + * + * @param string $act action command + * @return string action command + * @throws Exception if (un)subscribing fails */ function act_subscription($act){ global $lang; @@ -779,6 +817,9 @@ function act_subscription($act){ * default action for the event ACTION_HANDLE_SUBSCRIBE. * * @author Adrian Lang <lang@cosmocode.de> + * + * @param array &$params the parameters: target, style and action + * @throws Exception */ function subscription_handle_post(&$params) { global $INFO; diff --git a/inc/auth.php b/inc/auth.php index 4b1e6ce31..d51534e67 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -127,6 +127,7 @@ function auth_setup() { * Loads the ACL setup and handle user wildcards * * @author Andreas Gohr <andi@splitbrain.org> + * * @return array */ function auth_loadACL() { @@ -173,7 +174,7 @@ function auth_loadACL() { /** * Event hook callback for AUTH_LOGIN_CHECK * - * @param $evdata + * @param array $evdata * @return bool */ function auth_login_wrapper($evdata) { @@ -280,8 +281,9 @@ function auth_login($user, $pass, $sticky = false, $silent = false) { * token is correct. Will exit with a 401 Status if not. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $token The authentication token - * @return boolean true (or will exit on failure) + * @return boolean|null true (or will exit on failure) */ function auth_validateToken($token) { if(!$token || $token != $_SESSION[DOKU_COOKIE]['auth']['token']) { @@ -307,6 +309,7 @@ function auth_validateToken($token) { * NOTE: this is completely unrelated to the getSecurityToken() function * * @author Andreas Gohr <andi@splitbrain.org> + * * @return string The auth token */ function auth_createToken() { @@ -350,6 +353,7 @@ function auth_browseruid() { * and stored in this file. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $addsession if true, the sessionid is added to the salt * @param bool $secure if security is more important than keeping the old value * @return string @@ -377,6 +381,7 @@ function auth_cookiesalt($addsession = false, $secure = false) { * @author Mark Seecof * @author Michael Hamann <michael@content-space.de> * @link http://www.php.net/manual/de/function.mt-rand.php#83655 + * * @param int $length number of bytes to get * @return string binary random strings */ @@ -443,6 +448,7 @@ function auth_randombytes($length) { * * @author Michael Samuel * @author Michael Hamann <michael@content-space.de> + * * @param int $min * @param int $max * @return int @@ -514,6 +520,7 @@ function auth_decrypt($ciphertext, $secret) { * off. It also clears session data. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $keepbc - when true, the breadcrumb data is not cleared */ function auth_logoff($keepbc = false) { @@ -554,6 +561,7 @@ function auth_logoff($keepbc = false) { * * @author Andreas Gohr <andi@splitbrain.org> * @see auth_isadmin + * * @param string $user Username * @param array $groups List of groups the user is in * @param bool $adminonly when true checks if user is admin @@ -598,6 +606,7 @@ function auth_ismanager($user = null, $groups = null, $adminonly = false) { * * @author Andreas Gohr <andi@splitbrain.org> * @see auth_ismanager() + * * @param string $user Username * @param array $groups List of groups the user is in * @return bool @@ -612,9 +621,9 @@ function auth_isadmin($user = null, $groups = null) { * * Note: all input should NOT be nameencoded. * - * @param $memberlist string commaseparated list of allowed users and groups - * @param $user string user to match against - * @param $groups array groups the user is member of + * @param string $memberlist commaseparated list of allowed users and groups + * @param string $user user to match against + * @param array $groups groups the user is member of * @return bool true for membership acknowledged */ function auth_isMember($memberlist, $user, array $groups) { @@ -677,6 +686,7 @@ function auth_quickaclcheck($id) { * Returns the maximum rights a user has for the given ID or its namespace * * @author Andreas Gohr <andi@splitbrain.org> + * * @triggers AUTH_ACL_CHECK * @param string $id page ID (needs to be resolved and cleaned) * @param string $user Username @@ -699,6 +709,7 @@ function auth_aclcheck($id, $user, $groups) { * DO NOT CALL DIRECTLY, use auth_aclcheck() instead * * @author Andreas Gohr <andi@splitbrain.org> + * * @param array $data event data * @return int permission level */ @@ -831,6 +842,10 @@ function auth_aclcheck_cb($data) { * * @author Andreas Gohr <gohr@cosmocode.de> * @see rawurldecode() + * + * @param string $name + * @param bool $skip_group + * @return string */ function auth_nameencode($name, $skip_group = false) { global $cache_authname; @@ -912,6 +927,7 @@ function auth_pwgen($foruser = '') { * Sends a password to the given user * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $user Login name of the user * @param string $password The new password in clear text * @return bool true on success @@ -947,6 +963,7 @@ function auth_sendPassword($user, $password) { * This registers a new user - Data is read directly from $_POST * * @author Andreas Gohr <andi@splitbrain.org> + * * @return bool true on success, false on any error */ function register() { @@ -1128,6 +1145,7 @@ function auth_deleteprofile(){ } } + $deleted = array(); $deleted[] = $INPUT->server->str('REMOTE_USER'); if($auth->triggerUserMod('delete', array($deleted))) { // force and immediate logout including removing the sticky cookie @@ -1278,6 +1296,7 @@ function act_resendpwd() { * is chosen. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $clear The clear text password * @param string $method The hashing method * @param string $salt A salt, null for random @@ -1302,6 +1321,7 @@ function auth_cryptPassword($clear, $method = '', $salt = null) { * Verifies a cleartext password against a crypted hash * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $clear The clear text password * @param string $crypt The hash to compare with * @return bool true if both match diff --git a/inc/blowfish.php b/inc/blowfish.php index bcf5804a2..7499515bc 100644 --- a/inc/blowfish.php +++ b/inc/blowfish.php @@ -356,7 +356,7 @@ class Horde_Cipher_blowfish * Encrypt a block on data. * * @param String $block The data to encrypt - * @param optional String $key The key to use + * @param String $key optional The key to use * * @return String the encrypted output */ @@ -404,8 +404,8 @@ class Horde_Cipher_blowfish /** * Decrypt a block on data. * - * @param String $block The data to decrypt - * @param optional String $key The key to use + * @param String $block The data to decrypt + * @param String $key optional The key to use * * @return String the decrypted output */ @@ -452,6 +452,7 @@ class Horde_Cipher_blowfish /** * Converts a text key into an array. * + * @param string $key * @return array The key. */ function _formatKey($key) { @@ -464,8 +465,8 @@ class Horde_Cipher_blowfish /** * Encryption using blowfish algorithm * - * @param string original data - * @param string the secret + * @param string $data original data + * @param string $secret the secret * * @return string the encrypted result * @@ -493,8 +494,8 @@ function PMA_blowfish_encrypt($data, $secret) { /** * Decryption using blowfish algorithm * - * @param string encrypted data - * @param string the secret + * @param string $encdata encrypted data + * @param string $secret the secret * * @return string original data * diff --git a/inc/cache.php b/inc/cache.php index 6817e771b..edf394134 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -50,7 +50,7 @@ class cache { $this->_addDependencies(); if ($this->_event) { - return $this->_stats(trigger_event($this->_event,$this,array($this,'_useCache'))); + return $this->_stats(trigger_event($this->_event, $this, array($this,'_useCache'))); } else { return $this->_stats($this->_useCache()); } @@ -316,7 +316,7 @@ class cache_instructions extends cache_parser { * retrieve the cached data * * @param bool $clean true to clean line endings, false to leave line endings alone - * @return string cache contents + * @return array cache contents */ public function retrieveCache($clean=true) { $contents = io_readFile($this->cache, false); @@ -326,7 +326,7 @@ class cache_instructions extends cache_parser { /** * cache $instructions * - * @param string $instructions the instruction to be cached + * @param array $instructions the instruction to be cached * @return bool true on success, false otherwise */ public function storeCache($instructions) { diff --git a/inc/changelog.php b/inc/changelog.php index 9642cf9cd..c2d3cb489 100644 --- a/inc/changelog.php +++ b/inc/changelog.php @@ -727,8 +727,10 @@ abstract class ChangeLog { * If file larger than $chuncksize, only chunck is read that could contain $rev. * * @param int $rev revision timestamp - * @return array(fp, array(changeloglines), $head, $tail, $eof)|bool - * returns false when not succeed. fp only defined for chuck reading, needs closing. + * @return array|false + * if success returns array(fp, array(changeloglines), $head, $tail, $eof) + * where fp only defined for chuck reading, needs closing. + * otherwise false */ protected function readloglines($rev) { $file = $this->getChangelogFilename(); diff --git a/inc/cli.php b/inc/cli.php index 25bfddf7d..14e2c0c8d 100644 --- a/inc/cli.php +++ b/inc/cli.php @@ -108,7 +108,7 @@ abstract class DokuCLI { /** * Print an error message * - * @param $string + * @param string $string */ public function error($string) { $this->colors->ptln("E: $string", 'red', STDERR); @@ -117,7 +117,7 @@ abstract class DokuCLI { /** * Print a success message * - * @param $string + * @param string $string */ public function success($string) { $this->colors->ptln("S: $string", 'green', STDERR); @@ -126,7 +126,7 @@ abstract class DokuCLI { /** * Print an info message * - * @param $string + * @param string $string */ public function info($string) { $this->colors->ptln("I: $string", 'cyan', STDERR); @@ -199,8 +199,8 @@ class DokuCLI_Colors { /** * Convenience function to print a line in a given color * - * @param $line - * @param $color + * @param string $line + * @param string $color * @param resource $channel */ public function ptln($line, $color, $channel = STDOUT) { @@ -470,8 +470,8 @@ class DokuCLI_Options { * Can only be used after parseOptions() has been run * * @param string $option - * @param mixed $default what to return if the option was not set - * @return mixed + * @param bool|string $default what to return if the option was not set + * @return bool|string */ public function getOpt($option, $default = false) { if(isset($this->options[$option])) return $this->options[$option]; @@ -593,8 +593,8 @@ class DokuCLI_Options { /** * Displays text in multiple word wrapped columns * - * @param array $widths list of column widths (in characters) - * @param array $texts list of texts for each column + * @param int[] $widths list of column widths (in characters) + * @param string[] $texts list of texts for each column * @return string */ private function tableFormat($widths, $texts) { @@ -640,6 +640,11 @@ class DokuCLI_Exception extends Exception { const E_OPT_ABIGUOUS = 4; //Option abiguous const E_ARG_READ = 5; //Could not read argv + /** + * @param string $message The Exception message to throw. + * @param int $code The Exception code + * @param Exception $previous The previous exception used for the exception chaining. + */ public function __construct($message = "", $code = 0, Exception $previous = null) { if(!$code) $code = DokuCLI_Exception::E_ANY; parent::__construct($message, $code, $previous); diff --git a/inc/cliopts.php b/inc/cliopts.php index c75a5a93b..7d71c7dc9 100644 --- a/inc/cliopts.php +++ b/inc/cliopts.php @@ -36,9 +36,9 @@ if (version_compare(phpversion(), '4.3.0', '<') || php_sapi_name() == 'cgi') { // PHP ini settings set_time_limit(0); - ini_set('track_errors', true); - ini_set('html_errors', false); - ini_set('magic_quotes_runtime', false); + ini_set('track_errors', "1"); + ini_set('html_errors', "0"); + ini_set('magic_quotes_runtime', "0"); // Define stream constants define('STDIN', fopen('php://stdin', 'r')); @@ -78,7 +78,7 @@ class Doku_Cli_Opts { * @param string $bin_file executing file name - this MUST be passed the __FILE__ constant * @param string $short_options short options * @param array $long_options (optional) long options - * @return Doku_Cli_Opts_Container or Doku_Cli_Opts_Error + * @return Doku_Cli_Opts_Container|Doku_Cli_Opts_Error */ function & getOptions($bin_file, $short_options, $long_options = null) { $args = Doku_Cli_Opts::readPHPArgv(); diff --git a/inc/common.php b/inc/common.php index 11b8a7e26..b5fdd1ea5 100644 --- a/inc/common.php +++ b/inc/common.php @@ -49,7 +49,7 @@ function ptln($string, $indent = 0) { * * @author Andreas Gohr <andi@splitbrain.org> * - * @param $string string being stripped + * @param string $string being stripped * @return string */ function stripctl($string) { @@ -62,6 +62,7 @@ function stripctl($string) { * @author Andreas Gohr <andi@splitbrain.org> * @link http://en.wikipedia.org/wiki/Cross-site_request_forgery * @link http://christ1an.blogspot.com/2007/04/preventing-csrf-efficiently.html + * * @return string */ function getSecurityToken() { @@ -95,7 +96,7 @@ function checkSecurityToken($token = null) { * @author Andreas Gohr <andi@splitbrain.org> * * @param bool $print if true print the field, otherwise html of the field is returned - * @return void|string html of hidden form field + * @return string html of hidden form field */ function formSecurityToken($print = true) { $ret = '<div class="no"><input type="hidden" name="sectok" value="'.getSecurityToken().'" /></div>'."\n"; @@ -120,6 +121,7 @@ function basicinfo($id, $htmlClient=true){ global $INPUT; // set info about manager/admin status. + $info = array(); $info['isadmin'] = false; $info['ismanager'] = false; if($INPUT->server->has('REMOTE_USER')) { @@ -335,7 +337,7 @@ function buildAttributes($params, $skipempty = false) { * * @author Andreas Gohr <andi@splitbrain.org> * - * @return array(pageid=>name, ... ) + * @return string[] with the data: array(pageid=>name, ... ) */ function breadcrumbs() { // we prepare the breadcrumbs early for quick session closing @@ -688,6 +690,7 @@ function checkwordblock($text = '') { } if(count($re) && preg_match('#('.join('|', $re).')#si', $text, $matches)) { // prepare event data + $data = array(); $data['matches'] = $matches; $data['userinfo']['ip'] = $INPUT->server->str('REMOTE_ADDR'); if($INPUT->server->str('REMOTE_USER')) { @@ -971,7 +974,7 @@ function rawLocale($id, $ext = 'txt') { * @author Andreas Gohr <andi@splitbrain.org> * * @param string $id page id - * @param string $rev timestamp when a revision of wikitext is desired + * @param string|int $rev timestamp when a revision of wikitext is desired * @return string */ function rawWiki($id, $rev = '') { @@ -1111,7 +1114,7 @@ function parsePageTemplate(&$data) { * @param string $range in form "from-to" * @param string $id page id * @param string $rev optional, the revision timestamp - * @return array with three slices + * @return string[] with three slices */ function rawWikiSlices($range, $id, $rev = '') { $text = io_readWikiPage(wikiFN($id, $rev), $id, $rev); @@ -1122,6 +1125,7 @@ function rawWikiSlices($range, $id, $rev = '') { $from = !$from ? 0 : ($from - 1); $to = !$to ? strlen($text) : ($to - 1); + $slices = array(); $slices[0] = substr($text, 0, $from); $slices[1] = substr($text, $from, $to - $from); $slices[2] = substr($text, $to); @@ -1296,7 +1300,7 @@ function saveOldRevision($id) { * @param int|string $rev Old page revision * @param string $summary What changed * @param boolean $minor Is this a minor edit? - * @param array $replace Additional string substitutions, @KEY@ to be replaced by value + * @param string[] $replace Additional string substitutions, @KEY@ to be replaced by value * @return bool * * @author Andreas Gohr <andi@splitbrain.org> @@ -1376,8 +1380,8 @@ function getGoogleQuery() { /** * Return the human readable size of a file * - * @param int $size A file size - * @param int $dec A number of decimal places + * @param int $size A file size + * @param int $dec A number of decimal places * @return string human readable size * * @author Martin Benjamin <b.martin@cybernet.ch> @@ -1460,7 +1464,7 @@ function dformat($dt = null, $format = '') { * @author <ungu at terong dot com> * @link http://www.php.net/manual/en/function.date.php#54072 * - * @param int $int_date: current date in UNIX timestamp + * @param int $int_date current date in UNIX timestamp * @return string */ function date_iso8601($int_date) { @@ -1914,7 +1918,7 @@ function set_doku_pref($pref, $val) { /** * Strips source mapping declarations from given text #601 * - * @param &string $text reference to the CSS or JavaScript code to clean + * @param string &$text reference to the CSS or JavaScript code to clean */ function stripsourcemaps(&$text){ $text = preg_replace('/^(\/\/|\/\*)[@#]\s+sourceMappingURL=.*?(\*\/)?$/im', '\\1\\2', $text); diff --git a/inc/config_cascade.php b/inc/config_cascade.php index 1d9f67edb..a6dfadc80 100644 --- a/inc/config_cascade.php +++ b/inc/config_cascade.php @@ -49,13 +49,13 @@ $config_cascade = array_merge( 'local' => array(DOKU_CONF . 'wordblock.local.conf'), ), 'userstyle' => array( - 'screen' => DOKU_CONF . 'userstyle.css', - 'print' => DOKU_CONF . 'userprint.css', - 'feed' => DOKU_CONF . 'userfeed.css', - 'all' => DOKU_CONF . 'userall.css', + 'screen' => array(DOKU_CONF . 'userstyle.css', DOKU_CONF . 'userstyle.less'), + 'print' => array(DOKU_CONF . 'userprint.css', DOKU_CONF . 'userprint.less'), + 'feed' => array(DOKU_CONF . 'userfeed.css', DOKU_CONF . 'userfeed.less'), + 'all' => array(DOKU_CONF . 'userall.css', DOKU_CONF . 'userall.less') ), 'userscript' => array( - 'default' => DOKU_CONF . 'userscript.js' + 'default' => array(DOKU_CONF . 'userscript.js') ), 'acl' => array( 'default' => DOKU_CONF . 'acl.auth.php', diff --git a/inc/confutils.php b/inc/confutils.php index 31371d41f..85bf5128c 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -14,6 +14,10 @@ * are returned. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file file name + * @param bool $knownonly + * @return array with extension, mimetype and if it should be downloaded */ function mimetype($file, $knownonly=true){ $mtypes = getMimeTypes(); // known mimetypes diff --git a/inc/events.php b/inc/events.php index 318a7617e..256fb561e 100644 --- a/inc/events.php +++ b/inc/events.php @@ -27,6 +27,9 @@ class Doku_Event { /** * event constructor + * + * @param string $name + * @param mixed $data */ function Doku_Event($name, &$data) { @@ -120,14 +123,18 @@ class Doku_Event { * stop any further processing of the event by event handlers * this function does not prevent the default action taking place */ - function stopPropagation() { $this->_continue = false; } + function stopPropagation() { + $this->_continue = false; + } /** * preventDefault * * prevent the default action taking place */ - function preventDefault() { $this->_default = false; } + function preventDefault() { + $this->_default = false; + } } /** @@ -165,13 +172,13 @@ class Doku_Event_Handler { * * register a hook for an event * - * @param $event string name used by the event, (incl '_before' or '_after' for triggers) - * @param $advise string - * @param $obj object object in whose scope method is to be executed, + * @param string $event string name used by the event, (incl '_before' or '_after' for triggers) + * @param string $advise + * @param object $obj object in whose scope method is to be executed, * if NULL, method is assumed to be a globally available function - * @param $method string event handler function - * @param $param mixed data passed to the event handler - * @param $seq int sequence number for ordering hook execution (ascending) + * @param string $method event handler function + * @param mixed $param data passed to the event handler + * @param int $seq sequence number for ordering hook execution (ascending) */ function register_hook($event, $advise, $obj, $method, $param=null, $seq=0) { $seq = (int)$seq; @@ -216,14 +223,14 @@ class Doku_Event_Handler { * * function wrapper to process (create, trigger and destroy) an event * - * @param $name string name for the event - * @param $data mixed event data - * @param $action callback (optional, default=NULL) default action, a php callback function - * @param $canPreventDefault bool (optional, default=true) can hooks prevent the default action + * @param string $name name for the event + * @param mixed $data event data + * @param callback $action (optional, default=NULL) default action, a php callback function + * @param bool $canPreventDefault (optional, default=true) can hooks prevent the default action * * @return mixed the event results value after all event processing is complete - * by default this is the return value of the default action however - * it can be set or modified by event handler hooks + * by default this is the return value of the default action however + * it can be set or modified by event handler hooks */ function trigger_event($name, &$data, $action=null, $canPreventDefault=true) { diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php index c61c54503..70becc01e 100644 --- a/inc/fetch.functions.php +++ b/inc/fetch.functions.php @@ -16,6 +16,7 @@ * @author Andreas Gohr <andi@splitbrain.org> * @author Ben Coburn <btcoburn@silicodon.net> * @author Gerry Weissbach <dokuwiki@gammaproduction.de> + * * @param string $file local file to send * @param string $mime mime type of the file * @param bool $dl set to true to force a browser download @@ -96,12 +97,13 @@ function sendFile($file, $mime, $dl, $cache, $public = false, $orig = null) { * WRITE: MEDIA, FILE, array( STATUS, STATUSMESSAGE ) * * @author Gerry Weissbach <gerry.w@gammaproduction.de> + * * @param string $media reference to the media id * @param string $file reference to the file variable * @param string $rev * @param int $width * @param int $height - * @return array(STATUS, STATUSMESSAGE) + * @return array as array(STATUS, STATUSMESSAGE) */ function checkFileStatus(&$media, &$file, $rev = '', $width=0, $height=0) { global $MIME, $EXT, $CACHE, $INPUT; @@ -149,6 +151,9 @@ function checkFileStatus(&$media, &$file, $rev = '', $width=0, $height=0) { * Resolves named constants * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $cache + * @return int cachetime in seconds */ function calc_cache($cache) { global $conf; diff --git a/inc/form.php b/inc/form.php index fadc71d3e..00eea9b3a 100644 --- a/inc/form.php +++ b/inc/form.php @@ -52,6 +52,7 @@ class Doku_Form { * @param bool|string $action (optional, deprecated) submit URL, defaults to current page * @param bool|string $method (optional, deprecated) 'POST' or 'GET', default is POST * @param bool|string $enctype (optional, deprecated) Encoding type of the data + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function Doku_Form($params, $action=false, $method=false, $enctype=false) { @@ -84,6 +85,7 @@ class Doku_Form { * Usually results in a border drawn around the form. * * @param string $legend Label that will be printed with the border. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function startFieldset($legend) { @@ -115,6 +117,7 @@ class Doku_Form { * * @param string $name Field name. * @param string $value Field value. If null, remove a previously added field. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function addHidden($name, $value) { @@ -132,6 +135,7 @@ class Doku_Form { * If string, it is printed without escaping special chars. * * * @param string|array $elem Pseudo-tag or string to add to the form. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function addElement($elem) { @@ -145,6 +149,7 @@ class Doku_Form { * * @param string $pos 0-based index where the element will be inserted. * @param string|array $elem Pseudo-tag or string to add to the form. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function insertElement($pos, $elem) { @@ -158,6 +163,7 @@ class Doku_Form { * * @param int $pos 0-based index the element will be placed at. * @param string|array $elem Pseudo-tag or string to add to the form. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function replaceElement($pos, $elem) { @@ -172,7 +178,8 @@ class Doku_Form { * Gets the position of the first of a type of element. * * @param string $type Element type to look for. - * @return int position of element if found, otherwise false + * @return int|false position of element if found, otherwise false + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function findElementByType($type) { @@ -189,7 +196,8 @@ class Doku_Form { * Gets the position of the element with an ID attribute. * * @param string $id ID of the element to find. - * @return int position of element if found, otherwise false + * @return int|false position of element if found, otherwise false + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function findElementById($id) { @@ -207,7 +215,8 @@ class Doku_Form { * * @param string $name Attribute name. * @param string $value Attribute value. - * @return int position of element if found, otherwise false + * @return int|false position of element if found, otherwise false + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function findElementByAttribute($name, $value) { @@ -227,6 +236,7 @@ class Doku_Form { * * @param int $pos 0-based index * @return array reference pseudo-element + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function &getElementAt($pos) { @@ -243,6 +253,8 @@ class Doku_Form { * 'form_$type'. The function should return the HTML to be printed. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @return string html of the form */ function getForm() { global $lang; @@ -310,6 +322,7 @@ class Doku_Form { * @param string $tag Tag name. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeTag($tag, $attrs=array()) { @@ -326,6 +339,7 @@ function form_makeTag($tag, $attrs=array()) { * @param string $tag Tag name. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeOpenTag($tag, $attrs=array()) { @@ -341,6 +355,7 @@ function form_makeOpenTag($tag, $attrs=array()) { * * @param string $tag Tag name. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeCloseTag($tag) { @@ -358,6 +373,7 @@ function form_makeCloseTag($tag) { * @param string $text Text to fill the field with. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeWikiText($text, $attrs=array()) { @@ -378,6 +394,7 @@ function form_makeWikiText($text, $attrs=array()) { * @param string $value (optional) Displayed label. Uses $act if not provided. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeButton($type, $act, $value='', $attrs=array()) { @@ -406,6 +423,7 @@ function form_makeButton($type, $act, $value='', $attrs=array()) { * reference it with a 'for' attribute. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeField($type, $name, $value='', $label=null, $id='', $class='', $attrs=array()) { @@ -522,6 +540,18 @@ function form_makeRadioField($name, $value='1', $label=null, $id='', $class='', * a string. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $name Name attribute of the input. + * @param string[]|array[] $values The list of values can be strings, arrays of (value,text), + * or an associative array with the values as keys and labels as values. + * @param string|int $selected default selected value, string or index number + * @param string $class Class attribute of the label. If this is 'block', + * then a line break will be added after the field. + * @param string $label Label that will be printed before the input. + * @param string $id ID attribute of the input. If set, the label will + * reference it with a 'for' attribute. + * @param array $attrs Optional attributes. + * @return array pseudo-tag */ function form_makeMenuField($name, $values, $selected='', $label=null, $id='', $class='', $attrs=array()) { if (is_null($label)) $label = $name; @@ -556,6 +586,18 @@ function form_makeMenuField($name, $values, $selected='', $label=null, $id='', $ * Items are selected by supplying its value or an array of values. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $name Name attribute of the input. + * @param string[]|array[] $values The list of values can be strings, arrays of (value,text), + * or an associative array with the values as keys and labels as values. + * @param array|string $selected value or array of values of the items that need to be selected + * @param string $class Class attribute of the label. If this is 'block', + * then a line break will be added after the field. + * @param string $label Label that will be printed before the input. + * @param string $id ID attribute of the input. If set, the label will + * reference it with a 'for' attribute. + * @param array $attrs Optional attributes. + * @return array pseudo-tag */ function form_makeListboxField($name, $values, $selected='', $label=null, $id='', $class='', $attrs=array()) { if (is_null($label)) $label = $name; @@ -595,6 +637,9 @@ function form_makeListboxField($name, $values, $selected='', $label=null, $id='' * Attributes are passed to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html of tag */ function form_tag($attrs) { return '<'.$attrs['_tag'].' '.buildAttributes($attrs,true).'/>'; @@ -608,6 +653,9 @@ function form_tag($attrs) { * Attributes are passed to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html of tag */ function form_opentag($attrs) { return '<'.$attrs['_tag'].' '.buildAttributes($attrs,true).'>'; @@ -621,6 +669,9 @@ function form_opentag($attrs) { * There are no attributes. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html of tag */ function form_closetag($attrs) { return '</'.$attrs['_tag'].'>'; @@ -634,6 +685,9 @@ function form_closetag($attrs) { * Attributes are passed to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_openfieldset($attrs) { $s = '<fieldset '.buildAttributes($attrs,true).'>'; @@ -648,6 +702,8 @@ function form_openfieldset($attrs) { * There are no attributes. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @return string html */ function form_closefieldset() { return '</fieldset>'; @@ -661,6 +717,9 @@ function form_closefieldset() { * Value is passed to formText() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_hidden($attrs) { return '<input type="hidden" name="'.$attrs['name'].'" value="'.formText($attrs['value']).'" />'; @@ -674,6 +733,9 @@ function form_hidden($attrs) { * Text will be passed to formText(), attributes to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_wikitext($attrs) { // mandatory attributes @@ -693,6 +755,9 @@ function form_wikitext($attrs) { * Other attributes are passed to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_button($attrs) { $p = (!empty($attrs['_action'])) ? 'name="do['.$attrs['_action'].']" ' : ''; @@ -708,6 +773,9 @@ function form_button($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_field($attrs) { $s = '<label'; @@ -729,6 +797,9 @@ function form_field($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_fieldright($attrs) { $s = '<label'; @@ -750,6 +821,9 @@ function form_fieldright($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_textfield($attrs) { // mandatory attributes @@ -773,6 +847,9 @@ function form_textfield($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_passwordfield($attrs) { // mandatory attributes @@ -798,6 +875,9 @@ function form_passwordfield($attrs) { * Other attributes are passed to buildAttributes() for the input tag * * @author Michael Klier <chi@chimeric.de> + * + * @param array $attrs attributes + * @return string html */ function form_filefield($attrs) { $s = '<label'; @@ -824,6 +904,9 @@ function form_filefield($attrs) { * $attrs['value'][1] is constructed as well. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_checkboxfield($attrs) { // mandatory attributes @@ -853,6 +936,9 @@ function form_checkboxfield($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_radiofield($attrs) { // mandatory attributes @@ -879,6 +965,9 @@ function form_radiofield($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_menufield($attrs) { $attrs['size'] = '1'; @@ -924,6 +1013,9 @@ function form_menufield($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_listboxfield($attrs) { $s = '<label'; diff --git a/inc/fulltext.php b/inc/fulltext.php index aaef090e1..d6cddc566 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -20,9 +20,13 @@ if(!defined('FT_SNIPPET_NUMBER')) define('FT_SNIPPET_NUMBER',15); * * refactored into ft_pageSearch(), _ft_pageSearch() and trigger_event() * + * @param string $query + * @param array $highlight + * @return array */ function ft_pageSearch($query,&$highlight){ + $data = array(); $data['query'] = $query; $data['highlight'] =& $highlight; @@ -34,6 +38,9 @@ function ft_pageSearch($query,&$highlight){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Kazutaka Miyasaka <kazmiya@gmail.com> + * + * @param array $data event data + * @return array matching documents */ function _ft_pageSearch(&$data) { $Indexer = idx_get_indexer(); @@ -205,6 +212,11 @@ function ft_mediause($id, $ignore_perms = false){ * @triggers SEARCH_QUERY_PAGELOOKUP * @author Andreas Gohr <andi@splitbrain.org> * @author Adrian Lang <lang@cosmocode.de> + * + * @param string $id page id + * @param bool $in_ns match against namespace as well? + * @param bool $in_title search in title? + * @return string[] */ function ft_pageLookup($id, $in_ns=false, $in_title=false){ $data = compact('id', 'in_ns', 'in_title'); @@ -212,6 +224,12 @@ function ft_pageLookup($id, $in_ns=false, $in_title=false){ return trigger_event('SEARCH_QUERY_PAGELOOKUP', $data, '_ft_pageLookup'); } +/** + * Returns list of pages as array(pageid => First Heading) + * + * @param array &$data event data + * @return string[] + */ function _ft_pageLookup(&$data){ // split out original parameters $id = $data['id']; @@ -269,6 +287,10 @@ function _ft_pageLookup(&$data){ * Tiny helper function for comparing the searched title with the title * from the search index. This function is a wrapper around stripos with * adapted argument order and return value. + * + * @param string $search searched title + * @param string $title title from index + * @return bool */ function _ft_pageLookupTitleCompare($search, $title) { return stripos($title, $search) !== false; @@ -278,6 +300,10 @@ function _ft_pageLookupTitleCompare($search, $title) { * Sort pages based on their namespace level first, then on their string * values. This makes higher hierarchy pages rank higher than lower hierarchy * pages. + * + * @param string $a + * @param string $b + * @return int Returns < 0 if $a is less than $b; > 0 if $a is greater than $b, and 0 if they are equal. */ function ft_pagesorter($a, $b){ $ac = count(explode(':',$a)); @@ -295,6 +321,10 @@ function ft_pagesorter($a, $b){ * * @author Andreas Gohr <andi@splitbrain.org> * @triggers FULLTEXT_SNIPPET_CREATE + * + * @param string $id page id + * @param array $highlight + * @return mixed */ function ft_snippet($id,$highlight){ $text = rawWiki($id); @@ -389,6 +419,9 @@ function ft_snippet($id,$highlight){ /** * Wraps a search term in regex boundary checks. + * + * @param string $term + * @return string */ function ft_snippet_re_preprocess($term) { // do not process asian terms where word boundaries are not explicit @@ -432,6 +465,7 @@ function ft_snippet_re_preprocess($term) { * based upon PEAR's PHP_Compat function for array_intersect_key() * * @param array $args An array of page arrays + * @return array */ function ft_resultCombine($args){ $array_count = count($args); @@ -461,6 +495,8 @@ function ft_resultCombine($args){ * based upon ft_resultCombine() function * * @param array $args An array of page arrays + * @return array + * * @author Kazutaka Miyasaka <kazmiya@gmail.com> */ function ft_resultUnite($args) { @@ -484,6 +520,8 @@ function ft_resultUnite($args) { * nearly identical to PHP5's array_diff_key() * * @param array $args An array of page arrays + * @return array + * * @author Kazutaka Miyasaka <kazmiya@gmail.com> */ function ft_resultComplement($args) { @@ -506,6 +544,10 @@ function ft_resultComplement($args) { * * @author Andreas Gohr <andi@splitbrain.org> * @author Kazutaka Miyasaka <kazmiya@gmail.com> + * + * @param Doku_Indexer $Indexer + * @param string $query search query + * @return array of search formulas */ function ft_queryParser($Indexer, $query){ /** @@ -736,6 +778,12 @@ function ft_queryParser($Indexer, $query){ * This function is used in ft_queryParser() and not for general purpose use. * * @author Kazutaka Miyasaka <kazmiya@gmail.com> + * + * @param Doku_Indexer $Indexer + * @param string $term + * @param bool $consider_asian + * @param bool $phrase_mode + * @return string */ function ft_termParser($Indexer, $term, $consider_asian = true, $phrase_mode = false) { $parsed = ''; diff --git a/inc/html.php b/inc/html.php index 495bdf919..87affd47b 100644 --- a/inc/html.php +++ b/inc/html.php @@ -83,6 +83,10 @@ function html_denied() { * inserts section edit buttons if wanted or removes the markers * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $text + * @param bool $show show section edit buttons? + * @return string */ function html_secedit($text,$show=true){ global $INFO; @@ -101,8 +105,11 @@ function html_secedit($text,$show=true){ * prepares section edit button data for event triggering * used as a callback in html_secedit * - * @triggers HTML_SECEDIT_BUTTON * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $matches matches with regexp + * @return string + * @triggers HTML_SECEDIT_BUTTON */ function html_secedit_button($matches){ $data = array('secid' => $matches[1], @@ -121,6 +128,9 @@ function html_secedit_button($matches){ * used as default action form HTML_SECEDIT_BUTTON * * @author Adrian Lang <lang@cosmocode.de> + * + * @param array $data name, section id and target + * @return string html */ function html_secedit_get_button($data) { global $ID; @@ -147,6 +157,8 @@ function html_secedit_get_button($data) { * Just the back to top button (in its own form) * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return string html */ function html_topbtn(){ global $lang; @@ -161,6 +173,15 @@ function html_topbtn(){ * If tooltip exists, the access key tooltip is replaced. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $name + * @param string $id + * @param string $akey access key + * @param string[] $params key-value pairs added as hidden inputs + * @param string $method + * @param string $tooltip + * @param bool|string $label label text, false: lookup btn_$name in localization + * @return string */ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false){ global $conf; @@ -213,9 +234,11 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false } /** - * show a wiki page + * Show a wiki page * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param null|string $txt wiki text or null for showing $ID */ function html_show($txt=null){ global $ID; @@ -282,6 +305,10 @@ function html_draft(){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Harry Fuecks <hfuecks@gmail.com> + * + * @param string $html + * @param array|string $phrases + * @return string html */ function html_hilight($html,$phrases){ $phrases = (array) $phrases; @@ -300,6 +327,9 @@ function html_hilight($html,$phrases){ * Callback used by html_hilight() * * @author Harry Fuecks <hfuecks@gmail.com> + * + * @param array $m matches + * @return string html */ function html_hilight_callback($m) { $hlight = unslash($m[0]); @@ -425,6 +455,9 @@ function html_locked(){ * @author Andreas Gohr <andi@splitbrain.org> * @author Ben Coburn <btcoburn@silicodon.net> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param int $first skip the first n changelog lines + * @param bool|string $media_id id of media, or false for current page */ function html_revisions($first=0, $media_id = false){ global $ID; @@ -646,6 +679,9 @@ function html_revisions($first=0, $media_id = false){ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> * @author Ben Coburn <btcoburn@silicodon.net> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param int $first + * @param string $show_changes */ function html_recent($first=0, $show_changes='both'){ global $conf; @@ -833,6 +869,8 @@ function html_recent($first=0, $show_changes='both'){ * Display page index * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $ns */ function html_index($ns){ global $conf; @@ -861,6 +899,9 @@ function html_index($ns){ * User function for html_buildlist() * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string */ function html_list_index($item){ global $ID, $conf; @@ -891,10 +932,23 @@ function html_list_index($item){ * it gives different classes to opened or closed "folders" * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string html */ function html_li_index($item){ + global $INFO; + + $class = ''; + $id = ''; + if($item['type'] == "f"){ - return '<li class="level'.$item['level'].'">'; + // scroll to the current item + if($item['id'] == $INFO['id']) { + $id = ' id="scroll__here"'; + $class = ' bounce'; + } + return '<li class="level'.$item['level'].$class.'" '.$id.'>'; }elseif($item['open']){ return '<li class="open">'; }else{ @@ -906,6 +960,9 @@ function html_li_index($item){ * Default List item * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string html */ function html_li_default($item){ return '<li class="level'.$item['level'].'">'; @@ -929,7 +986,7 @@ function html_li_default($item){ * @param array $data array with item arrays * @param string $class class of ul wrapper * @param callable $func callback to print an list item - * @param string $lifunc callback to the opening li tag + * @param callable $lifunc callback to the opening li tag * @param bool $forcewrapper Trigger building a wrapper ul if the first level is 0 (we have a root object) or 1 (just the root content) * @return string html of an unordered list @@ -1021,12 +1078,13 @@ function html_backlinks(){ /** * Get header of diff HTML + * * @param string $l_rev Left revisions * @param string $r_rev Right revision * @param string $id Page id, if null $ID is used * @param bool $media If it is for media files * @param bool $inline Return the header on a single line - * @return array HTML snippets for diff header + * @return string[] HTML snippets for diff header */ function html_diff_head($l_rev, $r_rev, $id = null, $media = false, $inline = false) { global $lang; @@ -1482,7 +1540,7 @@ function html_diff_navigationlink($difftype, $linktype, $lrev, $rrev = null) { /** * Insert soft breaks in diff html * - * @param $diffhtml + * @param string $diffhtml * @return string */ function html_insert_softbreaks($diffhtml) { @@ -1521,6 +1579,9 @@ REGEX; * show warning on conflict detection * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $text + * @param string $summary */ function html_conflict($text,$summary){ global $ID; @@ -1681,7 +1742,6 @@ function html_edit(){ global $lang; global $conf; global $TEXT; - global $RANGE; if ($INPUT->has('changecheck')) { $check = $INPUT->str('changecheck'); @@ -1783,6 +1843,7 @@ function html_edit(){ * Display the default edit form * * Is the default action for HTML_EDIT_FORMSELECTION. + * * @param mixed[] $param */ function html_edit_form($param) { @@ -1802,6 +1863,8 @@ function html_edit_form($param) { * Adds a checkbox for minor edits for logged in users * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return array|bool */ function html_minoredit(){ global $conf; @@ -1902,6 +1965,7 @@ function html_debug(){ print '</pre>'; if (function_exists('apache_get_version')) { + $apache = array(); $apache['version'] = apache_get_version(); if (function_exists('apache_get_modules')) { @@ -2080,6 +2144,9 @@ function html_resendpwd() { * Return the TOC rendered to XHTML * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $toc + * @return string html */ function html_TOC($toc){ if(!count($toc)) return ''; @@ -2098,6 +2165,9 @@ function html_TOC($toc){ /** * Callback for html_buildlist + * + * @param array $item + * @return string html */ function html_list_toc($item){ if(isset($item['hid'])){ @@ -2132,6 +2202,7 @@ function html_mktocitem($link, $text, $level, $hash='#'){ * Triggers an event with the form name: HTML_{$name}FORM_OUTPUT * * @author Tom N Harris <tnharris@whoopdedo.org> + * * @param string $name The name of the form * @param Doku_Form $form The form */ @@ -2144,6 +2215,7 @@ function html_form($name, &$form) { /** * Form print function. * Just calls printForm() on the data object. + * * @param Doku_Form $data The form */ function html_form_output($data) { diff --git a/inc/httputils.php b/inc/httputils.php index efeb2a56c..ac79aa176 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -15,6 +15,7 @@ define('HTTP_CHUNK_SIZE',16*1024); * * @author Simon Willison <swillison@gmail.com> * @link http://simonwillison.net/2003/Apr/23/conditionalGet/ + * * @param int $timestamp lastmodified time of the cache file * @returns void or exits with previously header() commands executed */ @@ -64,6 +65,7 @@ function http_conditionalRequest($timestamp){ * Let the webserver send the given file via x-sendfile method * * @author Chris Smith <chris@jalakai.co.uk> + * * @param string $file absolute path of file to send * @returns void or exits with previous header() commands executed */ @@ -190,6 +192,9 @@ function http_rangeRequest($fh,$size,$mime){ * (samepath/samefilename.sameext.gz) created after the uncompressed file * * @author Chris Smith <chris.eureka@jalakai.co.uk> + * + * @param string $uncompressed_file + * @return bool */ function http_gzip_valid($uncompressed_file) { $gzip = $uncompressed_file.'.gz'; @@ -206,6 +211,9 @@ function http_gzip_valid($uncompressed_file) { * This function handles output of cacheable resource files. It ses the needed * HTTP headers. If a useable cache is present, it is passed to the web server * and the script is terminated. + * + * @param string $cache cache file name + * @param bool $cache_ok if cache can be used */ function http_cached($cache, $cache_ok) { global $conf; @@ -235,6 +243,9 @@ function http_cached($cache, $cache_ok) { /** * Cache content and print it + * + * @param string $file file name + * @param string $content */ function http_cached_finish($file, $content) { global $conf; diff --git a/inc/indexer.php b/inc/indexer.php index 5ca2f0bb1..014c5c5eb 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -61,6 +61,8 @@ define('IDX_ASIAN', '(?:'.IDX_ASIAN1.'|'.IDX_ASIAN2.'|'.IDX_ASIAN3.')'); * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Michael Hamann <michael@content-space.de> + * + * @return int|string */ function idx_get_version(){ static $indexer_version = null; @@ -84,6 +86,9 @@ function idx_get_version(){ * Differs from strlen in handling of asian characters. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $w + * @return int */ function wordlen($w){ $l = strlen($w); @@ -115,7 +120,8 @@ class Doku_Indexer { * * @param string $page a page name * @param string $text the body of the page - * @return boolean the function completed successfully + * @return string|boolean the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Andreas Gohr <andi@splitbrain.org> */ @@ -190,6 +196,7 @@ class Doku_Indexer { * * @param string $text content of the page * @return array list of word IDs and number of times used + * * @author Andreas Gohr <andi@splitbrain.org> * @author Christopher Smith <chris@jalakai.co.uk> * @author Tom N Harris <tnharris@whoopdedo.org> @@ -245,7 +252,8 @@ class Doku_Indexer { * @param string $page a page name * @param mixed $key a key string or array of key=>value pairs * @param mixed $value the value or list of values - * @return boolean the function completed successfully + * @return boolean|string the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Michael Hamann <michael@content-space.de> */ @@ -453,7 +461,8 @@ class Doku_Indexer { * Erases entries in all known indexes. * * @param string $page a page name - * @return boolean the function completed successfully + * @return string|boolean the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> */ public function deletePage($page) { @@ -474,6 +483,7 @@ class Doku_Indexer { * * @param string $page a page name * @return boolean the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function deletePageNoLock($page) { @@ -568,6 +578,7 @@ class Doku_Indexer { * @param string $text plain text * @param boolean $wc are wildcards allowed? * @return array list of words in the text + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Andreas Gohr <andi@splitbrain.org> */ @@ -676,6 +687,7 @@ class Doku_Indexer { * * @param array $tokens list of words to search for * @return array list of page names with usage counts + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Andreas Gohr <andi@splitbrain.org> */ @@ -730,6 +742,7 @@ class Doku_Indexer { * @param string $value search term to look for, must be a string or array of strings * @param callback $func comparison function * @return array lists with page names, keys are query values if $value is array + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Michael Hamann <michael@content-space.de> */ @@ -829,6 +842,7 @@ class Doku_Indexer { * @param array $words The query terms. * @param array $result Set to word => array("length*id" ...) * @return array Set to length => array(id ...) + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function getIndexWords(&$words, &$result) { @@ -909,6 +923,7 @@ class Doku_Indexer { * * @param string $key list only pages containing the metadata key (optional) * @return array list of page names + * * @author Tom N Harris <tnharris@whoopdedo.org> */ public function getPages($key=null) { @@ -942,6 +957,7 @@ class Doku_Indexer { * @param int $minlen minimum length of words to count * @param string $key metadata key to list. Uses the fulltext index if not given * @return array list of words as the keys and frequency as values + * * @author Tom N Harris <tnharris@whoopdedo.org> */ public function histogram($min=1, $max=0, $minlen=3, $key=null) { @@ -1002,6 +1018,8 @@ class Doku_Indexer { * Lock the indexer. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @return bool|string */ protected function lock() { global $conf; @@ -1033,6 +1051,8 @@ class Doku_Indexer { * Release the indexer lock. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @return bool */ protected function unlock() { global $conf; @@ -1050,6 +1070,7 @@ class Doku_Indexer { * @param string $idx name of the index * @param string $suffix subpart identifier * @return array list of lines without CR or LF + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function getIndex($idx, $suffix) { @@ -1066,6 +1087,7 @@ class Doku_Indexer { * @param string $suffix subpart identifier * @param array $lines list of lines without LF * @return bool If saving succeeded + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function saveIndex($idx, $suffix, &$lines) { @@ -1090,6 +1112,7 @@ class Doku_Indexer { * @param string $suffix subpart identifier * @param int $id the line number * @return string a line with trailing whitespace removed + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function getIndexKey($idx, $suffix, $id) { @@ -1114,6 +1137,7 @@ class Doku_Indexer { * @param int $id the line number * @param string $line line to write * @return bool If saving succeeded + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function saveIndexKey($idx, $suffix, $id, $line) { @@ -1155,6 +1179,7 @@ class Doku_Indexer { * @param string $suffix subpart identifier * @param string $value line to find in the index * @return int|bool line number of the value in the index or false if writing the index failed + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function addIndexKey($idx, $suffix, $value) { @@ -1178,6 +1203,8 @@ class Doku_Indexer { * a sorted array of lengths of the words used in the wiki. * * @author YoBoY <yoboy.leguesh@gmail.com> + * + * @return array */ protected function listIndexLengths() { return idx_listIndexLengths(); @@ -1190,6 +1217,9 @@ class Doku_Indexer { * that there are indices for. * * @author YoBoY <yoboy.leguesh@gmail.com> + * + * @param array|int $filter + * @return array */ protected function indexLengths($filter) { global $conf; @@ -1216,6 +1246,11 @@ class Doku_Indexer { * Insert or replace a tuple in a line. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $line + * @param string|int $id + * @param int $count + * @return string */ protected function updateTuple($line, $id, $count) { if ($line != ''){ @@ -1237,6 +1272,10 @@ class Doku_Indexer { * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $keys + * @param string $line + * @return array */ protected function parseTuples(&$keys, $line) { $result = array(); @@ -1257,13 +1296,16 @@ class Doku_Indexer { * Sum the counts in a list of tuples. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $line + * @return int */ protected function countTuples($line) { $freq = 0; $parts = explode(':', $line); foreach ($parts as $tuple) { if ($tuple === '') continue; - list($pid, $cnt) = explode('*', $tuple); + list(/* $pid */, $cnt) = explode('*', $tuple); $freq += (int)$cnt; } return $freq; @@ -1273,7 +1315,8 @@ class Doku_Indexer { /** * Create an instance of the indexer. * - * @return Doku_Indexer a Doku_Indexer + * @return Doku_Indexer a Doku_Indexer + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function idx_get_indexer() { @@ -1288,6 +1331,7 @@ function idx_get_indexer() { * Returns words that will be ignored. * * @return array list of stop words + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function & idx_get_stopwords() { @@ -1312,7 +1356,8 @@ function & idx_get_stopwords() { * @param string $page name of the page to index * @param boolean $verbose print status messages * @param boolean $force force reindexing even when the index is up to date - * @return boolean the function completed successfully + * @return string|boolean the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function idx_addPage($page, $verbose=false, $force=false) { @@ -1441,6 +1486,10 @@ function idx_tokenizer($string, $wc=false) { * Read the list of words in an index (if it exists). * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $idx + * @param string $suffix + * @return array */ function idx_getIndex($idx, $suffix) { global $conf; @@ -1456,6 +1505,8 @@ function idx_getIndex($idx, $suffix) { * a sorted array of lengths of the words used in the wiki. * * @author YoBoY <yoboy.leguesh@gmail.com> + * + * @return array */ function idx_listIndexLengths() { global $conf; @@ -1510,6 +1561,9 @@ function idx_listIndexLengths() { * that there are indices for. * * @author YoBoY <yoboy.leguesh@gmail.com> + * + * @param array|int $filter + * @return array */ function idx_indexLengths($filter) { global $conf; @@ -1539,6 +1593,9 @@ function idx_indexLengths($filter) { * not a letter, number, or underscore. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $name + * @return string */ function idx_cleanName($name) { $name = utf8_romanize(trim((string)$name)); diff --git a/inc/infoutils.php b/inc/infoutils.php index 06e03e90f..399963176 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -297,6 +297,7 @@ define('MSG_ADMINS_ONLY',4); */ function msg($message,$lvl=0,$line='',$file='',$allow=MSG_PUBLIC){ global $MSG, $MSG_shown; + $errors = array(); $errors[-1] = 'error'; $errors[0] = 'info'; $errors[1] = 'success'; @@ -453,7 +454,7 @@ function dbg_backtrace(){ }elseif(is_array($arg)){ $params[] = '[Array]'; }elseif(is_null($arg)){ - $param[] = '[NULL]'; + $params[] = '[NULL]'; }else{ $params[] = (string) '"'.$arg.'"'; } diff --git a/inc/init.php b/inc/init.php index 24920a17d..d0d9101e6 100644 --- a/inc/init.php +++ b/inc/init.php @@ -178,14 +178,6 @@ $_REQUEST = array_merge($_GET,$_POST); // we don't want a purge URL to be digged if(isset($_REQUEST['purge']) && !empty($_SERVER['HTTP_REFERER'])) unset($_REQUEST['purge']); -// disable gzip if not available -if($conf['compression'] == 'bz2' && !function_exists('bzopen')){ - $conf['compression'] = 'gz'; -} -if($conf['compression'] == 'gz' && !function_exists('gzopen')){ - $conf['compression'] = 0; -} - // precalculate file creation modes init_creationmodes(); @@ -201,6 +193,14 @@ if (empty($plugin_controller_class)) $plugin_controller_class = 'Doku_Plugin_Con // load libraries require_once(DOKU_INC.'inc/load.php'); +// disable gzip if not available +if($conf['compression'] == 'bz2' && !function_exists('bzopen')){ + $conf['compression'] = 'gz'; +} +if($conf['compression'] == 'gz' && !function_exists('gzopen')){ + $conf['compression'] = 0; +} + // input handle class global $INPUT; $INPUT = new Input(); diff --git a/inc/io.php b/inc/io.php index 27a34b045..bfa394a17 100644 --- a/inc/io.php +++ b/inc/io.php @@ -20,6 +20,7 @@ if(!defined('DOKU_INC')) die('meh.'); * @param string $id - a pageid, the namespace of that id will be tried to deleted * @param string $basedir - the config name of the type to delete (datadir or mediadir usally) * @return bool - true if at least one namespace was deleted + * * @author Andreas Gohr <andi@splitbrain.org> * @author Ben Coburn <btcoburn@silicodon.net> */ @@ -60,6 +61,11 @@ function io_sweepNS($id,$basedir='datadir'){ * $data[3] rev: The page revision, false for current wiki pages. * * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param string $file filename + * @param string $id page id + * @param bool|int $rev revision timestamp + * @return string */ function io_readWikiPage($file, $id, $rev=false) { if (empty($rev)) { $rev = false; } @@ -69,7 +75,11 @@ function io_readWikiPage($file, $id, $rev=false) { /** * Callback adapter for io_readFile(). + * * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param array $data event data + * @return string */ function _io_readWikiPage_action($data) { if (is_array($data) && is_array($data[0]) && count($data[0])===2) { @@ -88,6 +98,10 @@ function _io_readWikiPage_action($data) { * be sure to set $clean to false! * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename + * @param bool $clean + * @return string */ function io_readFile($file,$clean=true){ $ret = ''; @@ -108,9 +122,12 @@ function io_readFile($file,$clean=true){ } /** * Returns the content of a .bz2 compressed file as string + * * @author marcel senf <marcel@rucksackreinigung.de> + * + * @param string $file filename + * @return string content */ - function bzfile($file){ $bz = bzopen($file,"r"); $str = ''; @@ -138,6 +155,12 @@ function bzfile($file){ * $data[3] rev: The page revision, false for current wiki pages. * * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param string $file filename + * @param string $content + * @param string $id page id + * @param int|bool $rev timestamp of revision + * @return bool */ function io_writeWikiPage($file, $content, $id, $rev=false) { if (empty($rev)) { $rev = false; } @@ -149,6 +172,9 @@ function io_writeWikiPage($file, $content, $id, $rev=false) { /** * Callback adapter for io_saveFile(). * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param array $data event data + * @return bool */ function _io_writeWikiPage_action($data) { if (is_array($data) && is_array($data[0]) && count($data[0])===3) { @@ -168,7 +194,11 @@ function _io_writeWikiPage_action($data) { * and bz2 if extension is .bz2 * * @author Andreas Gohr <andi@splitbrain.org> - * @return bool true on success + * + * @param string $file filename path to file + * @param string $content + * @param bool $append + * @return bool true on success, otherwise false */ function io_saveFile($file,$content,$append=false){ global $conf; @@ -221,6 +251,10 @@ function io_saveFile($file,$content,$append=false){ * 2005-10-14 : added regex option -- Christopher Smith <chris@jalakai.co.uk> * * @author Steven Danz <steven-danz@kc.rr.com> + * + * @param string $file filename + * @param string $badline exact linematch to remove + * @param bool $regex use regexp? * @return bool true on success */ function io_deleteFromFile($file,$badline,$regex=false){ @@ -285,6 +319,8 @@ function io_deleteFromFile($file,$badline,$regex=false){ * the lock is assumed to be stale and the function goes on * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename */ function io_lock($file){ global $conf; @@ -311,6 +347,8 @@ function io_lock($file){ * Unlocks a file * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename */ function io_unlock($file){ global $conf; @@ -331,6 +369,9 @@ function io_unlock($file){ * $data[1] ns_type: 'pages' or 'media' namespace tree. * * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param string $id page id + * @param string $ns_type 'pages' or 'media' */ function io_createNamespace($id, $ns_type='pages') { // verify ns_type @@ -365,6 +406,8 @@ function io_createNamespace($id, $ns_type='pages') { * Create the directory needed for the given file * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file file name */ function io_makeFileDir($file){ $dir = dirname($file); @@ -379,6 +422,9 @@ function io_makeFileDir($file){ * @link http://www.php.net/manual/en/function.mkdir.php * @author <saint@corenova.com> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $target filename + * @return bool|int|string */ function io_mkdir_p($target){ global $conf; @@ -454,6 +500,9 @@ function io_rmdir($path, $removefiles = false) { * This is used when the safemode workaround is enabled * * @author <andi@splitbrain.org> + * + * @param string $dir name of the new directory + * @return false|string */ function io_mkdir_ftp($dir){ global $conf; @@ -488,6 +537,8 @@ function io_mkdir_ftp($dir){ * its path. * * @author Michael Klier <chi@chimeric.de> + * + * @return false|string path to new directory or false */ function io_mktmpdir() { global $conf; @@ -516,6 +567,13 @@ function io_mktmpdir() { * * @author Andreas Gohr <andi@splitbrain.org> * @author Chris Smith <chris@jalakai.co.uk> + * + * @param string $url url to download + * @param string $file path to file or directory where to save + * @param bool $useAttachment if true: try to use name of download, uses otherwise $defaultName, false: uses $file as path to file + * @param string $defaultName fallback for if using $useAttachment + * @param int $maxSize maximum file size + * @return bool|string if failed false, otherwise true or the name of the file in the given dir */ function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=2097152){ global $conf; @@ -563,6 +621,10 @@ function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=20 * * rename() can not overwrite existing files on Windows * this function will use copy/unlink instead + * + * @param string $from + * @param string $to + * @return bool succes or fail */ function io_rename($from,$to){ global $conf; @@ -582,6 +644,11 @@ function io_rename($from,$to){ * Returns the exit code from the process. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $cmd + * @param string $input input pipe + * @param string $output output pipe + * @return int exit code from process */ function io_exec($cmd, $input, &$output){ $descspec = array( diff --git a/inc/lang/cs/lang.php b/inc/lang/cs/lang.php index fd0820b13..ad889f858 100644 --- a/inc/lang/cs/lang.php +++ b/inc/lang/cs/lang.php @@ -80,7 +80,7 @@ $lang['badpassconfirm'] = 'Bohužel špatné heslo'; $lang['minoredit'] = 'Drobné změny'; $lang['draftdate'] = 'Koncept automaticky uložen v'; $lang['nosecedit'] = 'Stránka byla v mezičase změněna. Informace o sekci již nebylo platné, byla načtena celá stránka.'; -$lang['searchcreatepage'] = "Pokud jste nenašli, co hledáte, zkuste požadovanou stránku sami vytvořit stisknutím tlačítka ''Vytvořit stránku''."; +$lang['searchcreatepage'] = 'Pokud jste nenašli, co hledáte, zkuste požadovanou stránku sami vytvořit stisknutím tlačítka \'\'Vytvořit stránku\'\'.'; $lang['regmissing'] = 'Musíte vyplnit všechny údaje.'; $lang['reguexists'] = 'Uživatel se stejným jménem už je zaregistrován.'; $lang['regsuccess'] = 'Uživatelský účet byl vytvořen a heslo zasláno mailem.'; @@ -200,6 +200,8 @@ $lang['diff_side'] = 'Přidané'; $lang['diffprevrev'] = 'Předchozí verze'; $lang['diffnextrev'] = 'Následující verze'; $lang['difflastrev'] = 'Poslední revize'; +$lang['diffbothprevrev'] = 'Obě strany předchozí revize'; +$lang['diffbothnextrev'] = 'Obě strany příští revize'; $lang['line'] = 'Řádek'; $lang['breadcrumb'] = 'Historie:'; $lang['youarehere'] = 'Umístění:'; @@ -295,6 +297,7 @@ $lang['i_problems'] = 'Instalátor narazil na níže popsané problé $lang['i_modified'] = 'Instalátor bude z bezpečnostních důvodů pracovat pouze s čistou a ještě neupravenou instalací DokuWiki. Buď znovu rozbalte soubory z instalačního balíčku, nebo zkuste prostudovat <a href="http://dokuwiki.org/install">instrukce pro instalaci DokuWiki</a>.'; $lang['i_funcna'] = 'PHP funkce <code>%s</code> není dostupná. Váš webhosting ji možná z nějakého důvodu vypnul.'; $lang['i_phpver'] = 'Verze vaší instalace PHP <code>%s</code> je nižší než požadovaná <code>%s</code>. Budete muset aktualizovat svou instalaci PHP.'; +$lang['i_mbfuncoverload'] = 'mbstring.func_overload musí být vypnut v php.ini pro běh DokuWiki.'; $lang['i_permfail'] = 'DokuWiki nemůže zapisovat do <code>%s</code>. Budete muset opravit práva k tomuto adresáři.'; $lang['i_confexists'] = '<code>%s</code> již existuje'; $lang['i_writeerr'] = 'Nelze vytvořit <code>%s</code>. Budete muset zkontrolovat práva k souborům či adresářům a vytvořit tento soubor ručně.'; @@ -348,3 +351,5 @@ $lang['currentns'] = 'Aktuální jmenný prostor'; $lang['searchresult'] = 'Výsledek hledání'; $lang['plainhtml'] = 'Čisté HTML'; $lang['wikimarkup'] = 'Wiki jazyk'; +$lang['page_nonexist_rev'] = 'Stránka neexistovala na %s. Byla vytvořena dodatečne na <a href="%s">%s</a>.'; +$lang['unable_to_parse_date'] = 'Nelze rozebrat parametr "%s".'; diff --git a/inc/lang/da/lang.php b/inc/lang/da/lang.php index d27f0aa39..3b353d50c 100644 --- a/inc/lang/da/lang.php +++ b/inc/lang/da/lang.php @@ -17,6 +17,8 @@ * @author Soren Birk <soer9648@hotmail.com> * @author Jens Hyllegaard <jens.hyllegaard@gmail.com> * @author soer9648 <soer9648@eucl.dk> + * @author Søren Birk <sbi@eucl.dk> + * @author Søren Birk <soer9648@eucl.dk> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -61,6 +63,8 @@ $lang['btn_register'] = 'Registrér'; $lang['btn_apply'] = 'Anvend'; $lang['btn_media'] = 'Media Manager'; $lang['btn_deleteuser'] = 'Fjern Min Konto'; +$lang['btn_img_backto'] = 'Tilbage til %s'; +$lang['btn_mediaManager'] = 'Vis i Media Manager'; $lang['loggedinas'] = 'Logget ind som:'; $lang['user'] = 'Brugernavn'; $lang['pass'] = 'Adgangskode'; @@ -76,7 +80,7 @@ $lang['badpassconfirm'] = 'Kodeordet var desværre forkert'; $lang['minoredit'] = 'Mindre ændringer'; $lang['draftdate'] = 'Kladde automatisk gemt d.'; $lang['nosecedit'] = 'Siden blev ændret i mellemtiden, sektions information var for gammel, hentede hele siden i stedet.'; -$lang['searchcreatepage'] = "Hvis resultaterne ikke indeholder det du søgte efter kan du oprette et nyt dokument med samme navn som søgningen ved at trykke på knappen **''[Opret dette dokument]''**."; +$lang['searchcreatepage'] = 'Hvis resultaterne ikke indeholder det du søgte efter kan du oprette et nyt dokument med samme navn som søgningen ved at trykke på knappen **\'\'[Opret dette dokument]\'\'**.'; $lang['regmissing'] = 'Du skal udfylde alle felter.'; $lang['reguexists'] = 'Dette brugernavn er allerede i brug.'; $lang['regsuccess'] = 'Du er nu oprettet som bruger. Dit adgangskode bliver sendt til dig i en e-mail.'; @@ -148,6 +152,7 @@ $lang['js']['restore_confirm'] = 'Vil du virkeligt genskabe denne version?'; $lang['js']['media_diff'] = 'Vis forskelle:'; $lang['js']['media_diff_both'] = 'Side ved Side'; $lang['js']['media_diff_opacity'] = 'Skin-igennem'; +$lang['js']['media_diff_portions'] = 'Skub'; $lang['js']['media_select'] = 'Vælg filer...'; $lang['js']['media_upload_btn'] = 'Upload'; $lang['js']['media_done_btn'] = 'Færdig'; @@ -191,6 +196,11 @@ $lang['difflink'] = 'Link til denne sammenlinings vising'; $lang['diff_type'] = 'Vis forskelle:'; $lang['diff_inline'] = 'Indeni'; $lang['diff_side'] = 'Side ved Side'; +$lang['diffprevrev'] = 'Forrige revision'; +$lang['diffnextrev'] = 'Næste revision'; +$lang['difflastrev'] = 'Sidste revision'; +$lang['diffbothprevrev'] = 'Begge sider forrige revision'; +$lang['diffbothnextrev'] = 'Begge sider næste revision'; $lang['line'] = 'Linje'; $lang['breadcrumb'] = 'Sti:'; $lang['youarehere'] = 'Du er her:'; @@ -247,7 +257,6 @@ $lang['admin_register'] = 'Tilføj ny bruger'; $lang['metaedit'] = 'Rediger metadata'; $lang['metasaveerr'] = 'Skrivning af metadata fejlede'; $lang['metasaveok'] = 'Metadata gemt'; -$lang['btn_img_backto'] = 'Tilbage til %s'; $lang['img_title'] = 'Titel:'; $lang['img_caption'] = 'Billedtekst:'; $lang['img_date'] = 'Dato:'; @@ -260,7 +269,6 @@ $lang['img_camera'] = 'Kamera:'; $lang['img_keywords'] = 'Emneord:'; $lang['img_width'] = 'Bredde:'; $lang['img_height'] = 'Højde:'; -$lang['btn_mediaManager'] = 'Vis i Media Manager'; $lang['subscr_subscribe_success'] = 'Tilføjede %s til abonnement listen for %s'; $lang['subscr_subscribe_error'] = 'Fejl ved tilføjelse af %s til abonnement listen for %s'; $lang['subscr_subscribe_noaddress'] = 'Der er ikke nogen addresse forbundet til din bruger, så du kan ikke blive tilføjet til abonnement listen'; @@ -290,6 +298,7 @@ Du burde enten gen-udpakke filerne fra den hentede pakke eller tjekke den fuldst <a href="http://dokuwiki.org/install">DokuWiki installations instruktioner</a>'; $lang['i_funcna'] = 'PHP funtionen <code>%s</code> er ikke tilgængelig. Måske har din udbyder slået det fra af en eller anden grund?'; $lang['i_phpver'] = 'Din PHP version <code>%s</code> er mindre en den nødvendige <code>%s</code>. Du er nød til at opgradere din PHP installation.'; +$lang['i_mbfuncoverload'] = 'mbstring.func_overload skal være deaktiveret i php.ini for at køre DokuWiki.'; $lang['i_permfail'] = 'DokuWiki kan ikke skrive til <code>%s</code>. Du er nød til at rette tilladelses indstillingerne for denne mappe!'; $lang['i_confexists'] = '<code>%s</code> eksisterer allerede'; $lang['i_writeerr'] = 'Kunne ikke oprette <code>%s</code>. Du bliver nød til at tjekke mappe/fil- tilladelserne og oprette filen manuelt.'; @@ -301,10 +310,12 @@ $lang['i_policy'] = 'Begyndende ACL politik'; $lang['i_pol0'] = 'Åben Wiki (alle kan læse, skrive og uploade)'; $lang['i_pol1'] = 'Offentlig Wiki (alle kan læse, kun registrerede brugere kan skrive og overføre)'; $lang['i_pol2'] = 'Lukket Wiki (kun for registerede brugere kan læse, skrive og overføre)'; +$lang['i_allowreg'] = 'Tillad at brugere kan registrere sig selv'; $lang['i_retry'] = 'Forsøg igen'; $lang['i_license'] = 'Vælg venligst licensen du vil tilføje dit indhold under:'; $lang['i_license_none'] = 'Vis ikke licensinformationer'; $lang['i_pop_field'] = 'Hjælp os venligst med at forbedre oplevelsen af DokuWiki:'; +$lang['i_pop_label'] = 'Send anonymt brugsdata til DokuWikis udviklere, én gang om måneden'; $lang['recent_global'] = 'Du ser lige nu ændringerne i <b>%s</b> navnerummet. Du kan også <a href="%s">se de sidste ændringer for hele wiki siden </a>'; $lang['years'] = '%d år siden'; $lang['months'] = '%d måned siden'; @@ -337,3 +348,8 @@ $lang['media_perm_read'] = 'Du har ikke nok rettigheder til at læse filer $lang['media_perm_upload'] = 'Du har ikke nok rettigheder til at uploade filer.'; $lang['media_update'] = 'Upload ny version'; $lang['media_restore'] = 'Genskab denne version'; +$lang['currentns'] = 'Nuværende navnerum'; +$lang['searchresult'] = 'Søgsresultat'; +$lang['plainhtml'] = 'Ren HTML'; +$lang['wikimarkup'] = 'Wiki Opmærkning'; +$lang['page_nonexist_rev'] = 'Siden blev ikke fundet ved %s. Den blev efterfølgende oprettet ved <a href="%s">%s</a>.'; diff --git a/inc/lang/de/lang.php b/inc/lang/de/lang.php index 2886b84d5..2725c247a 100644 --- a/inc/lang/de/lang.php +++ b/inc/lang/de/lang.php @@ -27,6 +27,7 @@ * @author Simon <st103267@stud.uni-stuttgart.de> * @author Hoisl <hoisl@gmx.at> * @author Marcel Eickhoff <eickhoff.marcel@gmail.com> + * @author Pascal Schröder <Pascal1802@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -88,7 +89,7 @@ $lang['badpassconfirm'] = 'Das Passwort war falsch.'; $lang['minoredit'] = 'kleine Änderung'; $lang['draftdate'] = 'Entwurf gespeichert am'; $lang['nosecedit'] = 'Diese Seite wurde in der Zwischenzeit geändert, Sektionsinfo ist veraltet, lade stattdessen volle Seite.'; -$lang['searchcreatepage'] = "Falls der gesuchte Begriff nicht gefunden wurde, können Sie direkt eine neue Seite für den Suchbegriff anlegen, indem Sie auf den **''[Seite anlegen]''** Knopf drücken."; +$lang['searchcreatepage'] = 'Falls der gesuchte Begriff nicht gefunden wurde, können Sie direkt eine neue Seite für den Suchbegriff anlegen, indem Sie auf den **\'\'[Seite anlegen]\'\'** Knopf drücken.'; $lang['regmissing'] = 'Alle Felder müssen ausgefüllt werden.'; $lang['reguexists'] = 'Der Benutzername existiert leider schon.'; $lang['regsuccess'] = 'Der neue Benutzer wurde angelegt und das Passwort per E-Mail versandt.'; @@ -206,6 +207,8 @@ $lang['diff_side'] = 'Side by Side'; $lang['diffprevrev'] = 'Vorhergehende Überarbeitung'; $lang['diffnextrev'] = 'Nächste Überarbeitung'; $lang['difflastrev'] = 'Letzte Überarbeitung'; +$lang['diffbothprevrev'] = 'Beide Seiten der vorigen Revision'; +$lang['diffbothnextrev'] = 'Beide Seiten der Revision'; $lang['line'] = 'Zeile'; $lang['breadcrumb'] = 'Zuletzt angesehen:'; $lang['youarehere'] = 'Sie befinden sich hier:'; @@ -355,3 +358,5 @@ $lang['currentns'] = 'Aktueller Namensraum'; $lang['searchresult'] = 'Suchergebnisse'; $lang['plainhtml'] = 'HTML Klartext'; $lang['wikimarkup'] = 'Wiki Markup'; +$lang['page_nonexist_rev'] = 'DIe Seite exitiert nicht unter %s. Sie wurde aber unter <a herf="%s">%s</a>'; +$lang['unable_to_parse_date'] = 'Parameter "%s" kann nicht geparsed werden.'; diff --git a/inc/lang/fa/lang.php b/inc/lang/fa/lang.php index fea8fa210..25de5c92e 100644 --- a/inc/lang/fa/lang.php +++ b/inc/lang/fa/lang.php @@ -13,6 +13,8 @@ * @author reza_khn <reza_khn@yahoo.com> * @author Hamid <zarrabi@sharif.edu> * @author Mohamad Mehdi Habibi <habibi.esf@gmail.com> + * @author Mohammad Sadegh <msdn2013@gmail.com> + * @author Omid Hezaveh <hezpublic@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'rtl'; diff --git a/inc/lang/fr/lang.php b/inc/lang/fr/lang.php index dfaa8df2e..7a9b82158 100644 --- a/inc/lang/fr/lang.php +++ b/inc/lang/fr/lang.php @@ -35,6 +35,7 @@ * @author Caillot <remicaillot5@gmail.com> * @author Schplurtz le Déboulonné <schplurtz@laposte.net> * @author YoBoY <yoboy@ubuntu-fr.org> + * @author james <j.mccann@celcat.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -77,7 +78,7 @@ $lang['btn_draftdel'] = 'Effacer le brouillon'; $lang['btn_revert'] = 'Restaurer'; $lang['btn_register'] = 'Créer un compte'; $lang['btn_apply'] = 'Appliquer'; -$lang['btn_media'] = 'Gestionnaire de médias'; +$lang['btn_media'] = 'Gestionnaire Multimédia'; $lang['btn_deleteuser'] = 'Supprimer mon compte'; $lang['btn_img_backto'] = 'Retour vers %s'; $lang['btn_mediaManager'] = 'Voir dans le gestionnaire de médias'; diff --git a/inc/lang/it/lang.php b/inc/lang/it/lang.php index 9cde9d28e..c6b99d5b5 100644 --- a/inc/lang/it/lang.php +++ b/inc/lang/it/lang.php @@ -20,6 +20,7 @@ * @author Mirko <malisan.mirko@gmail.com> * @author Francesco <francesco.cavalli@hotmail.com> * @author Fabio <fabioslurp@yahoo.it> + * @author Torpedo <dgtorpedo@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -81,7 +82,7 @@ $lang['badpassconfirm'] = 'La password è errata'; $lang['minoredit'] = 'Modifiche minori'; $lang['draftdate'] = 'Bozza salvata in automatico il'; $lang['nosecedit'] = 'La pagina è stata modificata nel frattempo; è impossibile modificare solo la sezione scelta, quindi è stata caricata la pagina intera.'; -$lang['searchcreatepage'] = "Se non hai trovato quello che cercavi, puoi creare una nuova pagina con questo titolo usando il pulsante ''Crea questa pagina''."; +$lang['searchcreatepage'] = 'Se non hai trovato quello che cercavi, puoi creare una nuova pagina con questo titolo usando il pulsante \'\'Crea questa pagina\'\'.'; $lang['regmissing'] = 'Devi riempire tutti i campi.'; $lang['reguexists'] = 'Il nome utente inserito esiste già.'; $lang['regsuccess'] = 'L\'utente è stato creato. La password è stata spedita via email.'; @@ -152,6 +153,7 @@ $lang['js']['del_confirm'] = 'Eliminare veramente questa voce?'; $lang['js']['restore_confirm'] = 'Vuoi davvero ripristinare questa versione?'; $lang['js']['media_diff'] = 'Guarda le differenze:'; $lang['js']['media_diff_both'] = 'Fianco a Fianco'; +$lang['js']['media_diff_opacity'] = 'Trasparire'; $lang['js']['media_diff_portions'] = 'rubare'; $lang['js']['media_select'] = 'Seleziona files..'; $lang['js']['media_upload_btn'] = 'Upload'; @@ -199,6 +201,8 @@ $lang['diff_side'] = 'Fianco a Fianco'; $lang['diffprevrev'] = 'Revisione precedente'; $lang['diffnextrev'] = 'Prossima revisione'; $lang['difflastrev'] = 'Ultima revisione'; +$lang['diffbothprevrev'] = 'Entrambe le parti precedenti la revisione'; +$lang['diffbothnextrev'] = 'Entrambe le parti successive la revisione'; $lang['line'] = 'Linea'; $lang['breadcrumb'] = 'Traccia:'; $lang['youarehere'] = 'Ti trovi qui:'; @@ -296,6 +300,7 @@ Prova a estrarre di nuovo i file dal pacchetto scaricato oppure consulta le <a href="http://dokuwiki.org/install">istruzioni per l\'installazione di Dokuwiki</a>'; $lang['i_funcna'] = 'La funzione PHP <code>%s</code> non è disponibile. Forse è stata disabilitata dal tuo provider per qualche motivo?'; $lang['i_phpver'] = 'La versione di PHP <code>%s</code> è inferiore a quella richiesta <code>%s</code>. Devi aggiornare l\'installazione di PHP.'; +$lang['i_mbfuncoverload'] = 'mbstring.func_overload deve essere disabilitato in php.ini per eseguire DokuWiki.'; $lang['i_permfail'] = 'DokuWiki non può scrivere <code>%s</code>. E\' necessario correggere i permessi per questa directory!'; $lang['i_confexists'] = '<code>%s</code> esiste già'; $lang['i_writeerr'] = 'Impossibile creare <code>%s</code>. E\' necessario verificare i permessi della directory o del file oppure creare il file manualmente.'; @@ -348,3 +353,4 @@ $lang['media_restore'] = 'Ripristina questa versione'; $lang['currentns'] = 'Namespace corrente'; $lang['searchresult'] = 'Risultati della ricerca'; $lang['plainhtml'] = 'HTML'; +$lang['page_nonexist_rev'] = 'Pagina non esistente a %s. E\' stata creata successivamente a <a href="%s">%s</a>.'; diff --git a/inc/lang/no/lang.php b/inc/lang/no/lang.php index aeea982f2..ecf10ff5b 100644 --- a/inc/lang/no/lang.php +++ b/inc/lang/no/lang.php @@ -21,6 +21,7 @@ * @author Thomas Juberg <Thomas.Juberg@Gmail.com> * @author Boris <boris@newton-media.no> * @author Christopher Schive <chschive@frisurf.no> + * @author Patrick <spill.p@hotmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -82,7 +83,7 @@ $lang['badpassconfirm'] = 'Beklager, passordet var feil'; $lang['minoredit'] = 'Mindre endringer'; $lang['draftdate'] = 'Kladd autolagret'; $lang['nosecedit'] = 'Siden ble endret i mellomtiden, seksjonsinfo har blitt foreldet - lastet full side istedet.'; -$lang['searchcreatepage'] = "Hvis du ikke finner det du leter etter, så kan du skape en ny side med samme navn som ditt søk ved å klikke på ''**Lag denne siden**''-knappen."; +$lang['searchcreatepage'] = 'Hvis du ikke finner det du leter etter, så kan du skape en ny side med samme navn som ditt søk ved å klikke på \'\'**Lag denne siden**\'\'-knappen.'; $lang['regmissing'] = 'Vennligst fyll ut alle felt.'; $lang['reguexists'] = 'Det finnes allerede en konto med dette brukernavnet.'; $lang['regsuccess'] = 'Brukerkonto har blitt laget og passord har blitt sendt via e-post.'; @@ -356,3 +357,4 @@ $lang['currentns'] = 'gjeldende navnemellomrom'; $lang['searchresult'] = 'Søk i resultat'; $lang['plainhtml'] = 'Enkel HTML'; $lang['wikimarkup'] = 'wiki-format'; +$lang['page_nonexist_rev'] = 'Finnes ingen side på %s. Den er derfor laget på <a href="%s">%s</a>'; diff --git a/inc/lang/zh-tw/lang.php b/inc/lang/zh-tw/lang.php index 57c0d03e9..c5e7da000 100644 --- a/inc/lang/zh-tw/lang.php +++ b/inc/lang/zh-tw/lang.php @@ -15,6 +15,7 @@ * @author Danny Lin <danny0838@gmail.com> * @author Stan <talktostan@gmail.com> * @author June-Hao Hou <junehao@gmail.com> + * @author lioujheyu <lioujheyu@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; diff --git a/inc/mail.php b/inc/mail.php index 9994ac63e..9f1b1f3d6 100644 --- a/inc/mail.php +++ b/inc/mail.php @@ -27,7 +27,7 @@ if(!defined('MAILHEADER_EOL')) define('MAILHEADER_EOL',"\n"); * Check if a given mail address is valid */ if (!defined('RFC2822_ATEXT')) define('RFC2822_ATEXT',"0-9a-zA-Z!#$%&'*+/=?^_`{|}~-"); -if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', '['.RFC2822_ATEXT.']+(?:\.['.RFC2822_ATEXT.']+)*@(?i:[0-9a-z][0-9a-z-]*\.)+(?i:[a-z]{2,4}|museum|travel)'); +if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', '['.RFC2822_ATEXT.']+(?:\.['.RFC2822_ATEXT.']+)*@(?i:[0-9a-z][0-9a-z-]*\.)+(?i:[a-z]{2,63})'); /** * Prepare mailfrom replacement patterns diff --git a/inc/media.php b/inc/media.php index 5190862d7..09bfc99ac 100644 --- a/inc/media.php +++ b/inc/media.php @@ -16,6 +16,9 @@ if(!defined('NL')) define('NL',"\n"); * their CSS tags except pagenames won't be links. * * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> + * + * @param array $data + * @param string $id */ function media_filesinuse($data,$id){ global $lang; @@ -41,6 +44,11 @@ function media_filesinuse($data,$id){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $id media id + * @param int $auth permission level + * @param array $data + * @return false|string */ function media_metasave($id,$auth,$data){ if($auth < AUTH_UPLOAD) return false; @@ -86,6 +94,7 @@ function media_metasave($id,$auth,$data){ * check if a media is external source * * @author Gerrit Uitslag <klapinklapin@gmail.com> + * * @param string $id the media ID or URL * @return bool */ @@ -98,6 +107,7 @@ function media_isexternal($id){ * Check if a media item is public (eg, external URL or readable by @ALL) * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $id the media ID or URL * @return bool */ @@ -113,6 +123,10 @@ function media_ispublic($id){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $id media id + * @param int $auth permission level + * @return bool */ function media_metaform($id,$auth){ global $lang; @@ -175,6 +189,9 @@ function media_metaform($id,$auth){ * Convenience function to check if a media file is still in use * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id media id + * @return array|bool */ function media_inuse($id) { global $conf; @@ -202,6 +219,7 @@ define('DOKU_MEDIA_EMPTY_NS', 8); * If configured, checks for media references before deletion * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $id media id * @param int $auth no longer used * @return int One of: 0, @@ -219,6 +237,7 @@ function media_delete($id,$auth){ $file = mediaFN($id); // trigger an event - MEDIA_DELETE_FILE + $data = array(); $data['id'] = $id; $data['name'] = utf8_basename($file); $data['path'] = $file; @@ -253,9 +272,9 @@ function media_delete($id,$auth){ /** * Handle file uploads via XMLHttpRequest * - * @param string $ns target namespace - * @param int $auth current auth check result - * @return mixed false on error, id of the new file on success + * @param string $ns target namespace + * @param int $auth current auth check result + * @return false|string false on error, id of the new file on success */ function media_upload_xhr($ns,$auth){ if(!checkSecurityToken()) return false; @@ -298,10 +317,11 @@ function media_upload_xhr($ns,$auth){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Michael Klier <chi@chimeric.de> - * @param string $ns target namespace - * @param int $auth current auth check result - * @param bool|array $file $_FILES member, $_FILES['upload'] if false - * @return mixed false on error, id of the new file on success + * + * @param string $ns target namespace + * @param int $auth current auth check result + * @param bool|array $file $_FILES member, $_FILES['upload'] if false + * @return false|string false on error, id of the new file on success */ function media_upload($ns,$auth,$file=false){ if(!checkSecurityToken()) return false; @@ -345,6 +365,7 @@ function media_upload($ns,$auth,$file=false){ * Using copy, makes sure any setgid bits on the media directory are honored * * @see move_uploaded_file() + * * @param string $from * @param string $to * @return bool @@ -362,13 +383,21 @@ function copy_uploaded_file($from, $to){ * (The triggered event is preventable.) * * Event data: - * $data[0] fn_tmp: the temporary file name (read from $_FILES) - * $data[1] fn: the file name of the uploaded file - * $data[2] id: the future directory id of the uploaded file - * $data[3] imime: the mimetype of the uploaded file + * $data[0] fn_tmp: the temporary file name (read from $_FILES) + * $data[1] fn: the file name of the uploaded file + * $data[2] id: the future directory id of the uploaded file + * $data[3] imime: the mimetype of the uploaded file * $data[4] overwrite: if an existing file is going to be overwritten + * $data[5] move: name of function that performs move/copy/.. * * @triggers MEDIA_UPLOAD_FINISH + * + * @param array $file + * @param string $id media id + * @param bool $ow overwrite? + * @param int $auth permission level + * @param string $move name of functions that performs move/copy/.. + * @return false|array|string */ function media_save($file, $id, $ow, $auth, $move) { if($auth < AUTH_UPLOAD) { @@ -418,6 +447,7 @@ function media_save($file, $id, $ow, $auth, $move) { } // prepare event data + $data = array(); $data[0] = $file['name']; $data[1] = $fn; $data[2] = $id; @@ -430,8 +460,12 @@ function media_save($file, $id, $ow, $auth, $move) { } /** - * Callback adapter for media_upload_finish() + * Callback adapter for media_upload_finish() triggered by MEDIA_UPLOAD_FINISH + * * @author Michael Klier <chi@chimeric.de> + * + * @param array $data event data + * @return false|array|string */ function _media_upload_action($data) { // fixme do further sanity tests of given data? @@ -448,6 +482,14 @@ function _media_upload_action($data) { * @author Andreas Gohr <andi@splitbrain.org> * @author Michael Klier <chi@chimeric.de> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $fn_tmp + * @param string $fn + * @param string $id media id + * @param string $imime mime type + * @param bool $overwrite overwrite existing? + * @param string $move function name + * @return array|string */ function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'move_uploaded_file') { global $conf; @@ -491,6 +533,7 @@ function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'mov * directory * * @author Kate Arzamastseva <pshns@ukr.net> + * * @param string $id * @return int - revision date */ @@ -534,6 +577,10 @@ function media_saveOldRevision($id){ * @author Andreas Gohr <andi@splitbrain.org> * @link http://www.splitbrain.org/blog/2007-02/12-internet_explorer_facilitates_cross_site_scripting * @fixme check all 26 magic IE filetypes here? + * + * @param string $file path to file + * @param string $mime mimetype + * @return int */ function media_contentcheck($file,$mime){ global $conf; @@ -543,14 +590,14 @@ function media_contentcheck($file,$mime){ $bytes = fread($fh, 256); fclose($fh); if(preg_match('/<(script|a|img|html|body|iframe)[\s>]/i',$bytes)){ - return -3; + return -3; //XSS: possibly malicious content } } } if(substr($mime,0,6) == 'image/'){ $info = @getimagesize($file); if($mime == 'image/gif' && $info[2] != 1){ - return -1; + return -1; // uploaded content did not match the file extension }elseif($mime == 'image/jpeg' && $info[2] != 2){ return -1; }elseif($mime == 'image/png' && $info[2] != 3){ @@ -561,7 +608,7 @@ function media_contentcheck($file,$mime){ global $TEXT; $TEXT = io_readFile($file); if(checkwordblock()){ - return -2; + return -2; //blocked by the spam blacklist } } return 0; @@ -571,6 +618,12 @@ function media_contentcheck($file,$mime){ * Send a notify mail on uploads * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $id media id + * @param string $file path to file + * @param string $mime mime type + * @param bool|int $old_rev revision timestamp or false + * @return bool */ function media_notify($id,$file,$mime,$old_rev=false){ global $conf; @@ -583,11 +636,11 @@ function media_notify($id,$file,$mime,$old_rev=false){ /** * List all files in a given Media namespace * - * @param string $ns namespace - * @param null|int $auth permission level - * @param string $jump - * @param bool $fullscreenview - * @param bool|string $sort sorting, false skips sorting + * @param string $ns namespace + * @param null|int $auth permission level + * @param string $jump id + * @param bool $fullscreenview + * @param bool|string $sort sorting order, false skips sorting */ function media_filelist($ns,$auth=null,$jump='',$fullscreenview=false,$sort=false){ global $conf; @@ -730,6 +783,7 @@ function media_tab_files_options(){ * Returns type of sorting for the list of files in media manager * * @author Kate Arzamastseva <pshns@ukr.net> + * * @return string - sort type */ function _media_get_sort_type() { @@ -740,6 +794,7 @@ function _media_get_sort_type() { * Returns type of listing for the list of files in media manager * * @author Kate Arzamastseva <pshns@ukr.net> + * * @return string - list type */ function _media_get_list_type() { @@ -771,6 +826,10 @@ function _media_get_display_param($param, $values) { * Prints tab that displays a list of all files * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param null|int $auth permission level + * @param string $jump item id */ function media_tab_files($ns,$auth=null,$jump='') { global $lang; @@ -787,6 +846,10 @@ function media_tab_files($ns,$auth=null,$jump='') { * Prints tab that displays uploading form * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param null|int $auth permission level + * @param string $jump item id */ function media_tab_upload($ns,$auth=null,$jump='') { global $lang; @@ -804,6 +867,9 @@ function media_tab_upload($ns,$auth=null,$jump='') { * Prints tab that displays search form * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param null|int $auth permission level */ function media_tab_search($ns,$auth=null) { global $INPUT; @@ -823,8 +889,13 @@ function media_tab_search($ns,$auth=null) { * Prints tab that displays mediafile details * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image media id + * @param string $ns + * @param null|int $auth permission level + * @param string|int $rev revision timestamp or empty string */ -function media_tab_view($image, $ns, $auth=null, $rev=false) { +function media_tab_view($image, $ns, $auth=null, $rev='') { global $lang; if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); @@ -843,6 +914,10 @@ function media_tab_view($image, $ns, $auth=null, $rev=false) { * Prints tab that displays form for editing mediafile metadata * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image media id + * @param string $ns + * @param null|int $auth permission level */ function media_tab_edit($image, $ns, $auth=null) { if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); @@ -857,6 +932,10 @@ function media_tab_edit($image, $ns, $auth=null) { * Prints tab that displays mediafile revisions * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image media id + * @param string $ns + * @param null|int $auth permission level */ function media_tab_history($image, $ns, $auth=null) { global $lang; @@ -880,13 +959,14 @@ function media_tab_history($image, $ns, $auth=null) { /** * Prints mediafile details * - * @param string $image media id - * @param $auth - * @param int|bool $rev - * @param JpegMeta|bool $meta + * @param string $image media id + * @param int $auth permission level + * @param int|string $rev revision timestamp or empty string + * @param JpegMeta|bool $meta + * * @author Kate Arzamastseva <pshns@ukr.net> */ -function media_preview($image, $auth, $rev=false, $meta=false) { +function media_preview($image, $auth, $rev='', $meta=false) { $size = media_image_preview_size($image, $rev, $meta); @@ -918,8 +998,12 @@ function media_preview($image, $auth, $rev=false, $meta=false) { * Prints mediafile action buttons * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image media id + * @param int $auth permission level + * @param string|int $rev revision timestamp, or empty string */ -function media_preview_buttons($image, $auth, $rev=false) { +function media_preview_buttons($image, $auth, $rev='') { global $lang, $conf; echo '<ul class="actions">'.NL; @@ -967,11 +1051,11 @@ function media_preview_buttons($image, $auth, $rev=false) { * Returns image width and height for mediamanager preview panel * * @author Kate Arzamastseva <pshns@ukr.net> - * @param string $image - * @param int $rev - * @param JpegMeta $meta - * @param int $size - * @return array + * @param string $image + * @param int|string $rev + * @param JpegMeta|bool $meta + * @param int $size + * @return array|false */ function media_image_preview_size($image, $rev, $meta, $size = 500) { if (!preg_match("/\.(jpe?g|gif|png)$/", $image) || !file_exists(mediaFN($image, $rev))) return false; @@ -992,9 +1076,10 @@ function media_image_preview_size($image, $rev, $meta, $size = 500) { * Returns the requested EXIF/IPTC tag from the image meta * * @author Kate Arzamastseva <pshns@ukr.net> - * @param array $tags + * + * @param array $tags array with tags, first existing is returned * @param JpegMeta $meta - * @param string $alt + * @param string $alt alternative value * @return string */ function media_getTag($tags,$meta,$alt=''){ @@ -1008,8 +1093,9 @@ function media_getTag($tags,$meta,$alt=''){ * Returns mediafile tags * * @author Kate Arzamastseva <pshns@ukr.net> + * * @param JpegMeta $meta - * @return array + * @return array list of tags of the mediafile */ function media_file_tags($meta) { // load the field descriptions @@ -1038,8 +1124,13 @@ function media_file_tags($meta) { * Prints mediafile tags * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image image id + * @param int $auth permission level + * @param string|int $rev revision timestamp, or empty string + * @param bool|JpegMeta $meta image object, or create one if false */ -function media_details($image, $auth, $rev=false, $meta=false) { +function media_details($image, $auth, $rev='', $meta=false) { global $lang; if (!$meta) $meta = new JpegMeta(mediaFN($image, $rev)); @@ -1062,6 +1153,12 @@ function media_details($image, $auth, $rev=false, $meta=false) { * Shows difference between two revisions of file * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image image id + * @param string $ns + * @param int $auth permission level + * @param bool $fromajax + * @return false|null|string */ function media_diff($image, $ns, $auth, $fromajax = false) { global $conf; @@ -1111,6 +1208,7 @@ function media_diff($image, $ns, $auth, $fromajax = false) { } // prepare event data + $data = array(); $data[0] = $image; $data[1] = $l_rev; $data[2] = $r_rev; @@ -1120,14 +1218,13 @@ function media_diff($image, $ns, $auth, $fromajax = false) { // trigger event return trigger_event('MEDIA_DIFF', $data, '_media_file_diff', true); - } /** * Callback for media file diff * - * @param $data - * @return bool|void + * @param array $data event data + * @return false|null */ function _media_file_diff($data) { if(is_array($data) && count($data)===6) { @@ -1141,6 +1238,13 @@ function _media_file_diff($data) { * Shows difference between two revisions of image * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image + * @param string|int $l_rev revision timestamp, or empty string + * @param string|int $r_rev revision timestamp, or empty string + * @param string $ns + * @param int $auth permission level + * @param bool $fromajax */ function media_file_diff($image, $l_rev, $r_rev, $ns, $auth, $fromajax){ global $lang; @@ -1261,11 +1365,12 @@ function media_file_diff($image, $l_rev, $r_rev, $ns, $auth, $fromajax){ * and slider * * @author Kate Arzamastseva <pshns@ukr.net> - * @param string $image - * @param int $l_rev - * @param int $r_rev - * @param array $l_size - * @param array $r_size + * + * @param string $image image id + * @param int $l_rev revision timestamp, or empty string + * @param int $r_rev revision timestamp, or empty string + * @param array $l_size array with width and height + * @param array $r_size array with width and height * @param string $type */ function media_image_diff($image, $l_rev, $r_rev, $l_size, $r_size, $type) { @@ -1298,10 +1403,11 @@ function media_image_diff($image, $l_rev, $r_rev, $l_size, $r_size, $type) { /** * Restores an old revision of a media file * - * @param string $image - * @param int $rev - * @param int $auth + * @param string $image media id + * @param int $rev revision timestamp or empty string + * @param int $auth * @return string - file's id + * * @author Kate Arzamastseva <pshns@ukr.net> */ function media_restore($image, $rev, $auth){ @@ -1331,19 +1437,24 @@ function media_restore($image, $rev, $auth){ * @author Andreas Gohr <gohr@cosmocode.de> * @author Kate Arzamastseva <pshns@ukr.net> * @triggers MEDIA_SEARCH + * + * @param string $query + * @param string $ns + * @param null|int $auth + * @param bool $fullscreen + * @param string $sort */ function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort='natural'){ global $conf; global $lang; $ns = cleanID($ns); - + $evdata = array( + 'ns' => $ns, + 'data' => array(), + 'query' => $query + ); if ($query) { - $evdata = array( - 'ns' => $ns, - 'data' => array(), - 'query' => $query - ); $evt = new Doku_Event('MEDIA_SEARCH', $evdata); if ($evt->advise_before()) { $dir = utf8_encodeFN(str_replace(':','/',$evdata['ns'])); @@ -1381,10 +1492,14 @@ function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort='natural /** * Formats and prints one file in the list + * + * @param array $item + * @param int $auth permission level + * @param string $jump item id + * @param bool $display_namespace */ function media_printfile($item,$auth,$jump,$display_namespace=false){ global $lang; - global $conf; // Prepare zebra coloring // I always wanted to use this variable name :-D @@ -1458,9 +1573,9 @@ function media_printfile($item,$auth,$jump,$display_namespace=false){ /** * Display a media icon * - * @param $filename - * @param string $size the size subfolder, if not specified 16x16 is used - * @return string + * @param string $filename media id + * @param string $size the size subfolder, if not specified 16x16 is used + * @return string html */ function media_printicon($filename, $size=''){ list($ext) = mimetype(mediaFN($filename),false); @@ -1478,6 +1593,11 @@ function media_printicon($filename, $size=''){ * Formats and prints one file in the list in the thumbnails view * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param array $item + * @param int $auth permission level + * @param bool|string $jump item id + * @param bool $display_namespace */ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false){ @@ -1525,6 +1645,9 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false /** * Prints a thumbnail and metainfo + * + * @param array $item + * @param bool $fullscreen */ function media_printimgdetail($item, $fullscreen=false){ // prepare thumbnail @@ -1588,15 +1711,15 @@ function media_printimgdetail($item, $fullscreen=false){ } /** - * Build link based on the current, adding/rewriting - * parameters + * Build link based on the current, adding/rewriting parameters * * @author Kate Arzamastseva <pshns@ukr.net> + * * @param array|bool $params - * @param string $amp - separator - * @param bool $abs - * @param bool $params_array - * @return string|array - link + * @param string $amp separator + * @param bool $abs absolute url? + * @param bool $params_array return the parmeters array? + * @return string|array - link or link parameters */ function media_managerURL($params=false, $amp='&', $abs=false, $params_array=false) { global $ID; @@ -1627,6 +1750,10 @@ function media_managerURL($params=false, $amp='&', $abs=false, $params_array * * @author Andreas Gohr <andi@splitbrain.org> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param int $auth permission level + * @param bool $fullscreen */ function media_uploadform($ns, $auth, $fullscreen = false){ global $lang; @@ -1714,6 +1841,10 @@ function media_getuploadsize(){ * * @author Tobias Sarnowski <sarnowski@cosmocode.de> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param string $query + * @param bool $fullscreen */ function media_searchform($ns,$query='',$fullscreen=false){ global $lang; @@ -1741,6 +1872,8 @@ function media_searchform($ns,$query='',$fullscreen=false){ * Build a tree outline of available media namespaces * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $ns */ function media_nstree($ns){ global $conf; @@ -1789,6 +1922,9 @@ function media_nstree($ns){ * Prints a media namespace tree item * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string html */ function media_nstree_item($item){ global $INPUT; @@ -1812,6 +1948,9 @@ function media_nstree_item($item){ * Prints a media namespace tree item opener * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string html */ function media_nstree_li($item){ $class='media level'.$item['level']; @@ -1833,6 +1972,12 @@ function media_nstree_li($item){ * Resizes the given image to the given size * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename, path to file + * @param string $ext extension + * @param int $w desired width + * @param int $h desired height + * @return string path to resized or original size if failed */ function media_resize_image($file, $ext, $w, $h=0){ global $conf; @@ -1853,9 +1998,10 @@ function media_resize_image($file, $ext, $w, $h=0){ $local = getCacheName($file,'.media.'.$w.'x'.$h.'.'.$ext); $mtime = @filemtime($local); // 0 if not exists - if( $mtime > filemtime($file) || - media_resize_imageIM($ext,$file,$info[0],$info[1],$local,$w,$h) || - media_resize_imageGD($ext,$file,$info[0],$info[1],$local,$w,$h) ){ + if($mtime > filemtime($file) || + media_resize_imageIM($ext, $file, $info[0], $info[1], $local, $w, $h) || + media_resize_imageGD($ext, $file, $info[0], $info[1], $local, $w, $h) + ) { if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']); return $local; } @@ -1871,6 +2017,12 @@ function media_resize_image($file, $ext, $w, $h=0){ * image because most pics are more interesting in that area (rule of thirds) * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename, path to file + * @param string $ext extension + * @param int $w desired width + * @param int $h desired height + * @return string path to resized or original size if failed */ function media_crop_image($file, $ext, $w, $h=0){ global $conf; @@ -1935,7 +2087,7 @@ function media_crop_image($file, $ext, $w, $h=0){ * @param string $id id of the image * @param int $w resize/crop width * @param int $h resize/crop height - * @return string + * @return string token or empty string if no token required */ function media_get_token($id,$w,$h){ // token is only required for modified images @@ -1958,6 +2110,11 @@ function media_get_token($id,$w,$h){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Pavel Vitis <Pavel.Vitis@seznam.cz> + * + * @param string $url + * @param string $ext extension + * @param int $cache cachetime in seconds + * @return false|string path to cached file */ function media_get_from_URL($url,$ext,$cache){ global $conf; @@ -1970,12 +2127,12 @@ function media_get_from_URL($url,$ext,$cache){ $mtime = @filemtime($local); // 0 if not exists //decide if download needed: - if( ($mtime == 0) || // cache does not exist - ($cache != -1 && $mtime < time()-$cache) // 'recache' and cache has expired - ){ - if(media_image_download($url,$local)){ + if(($mtime == 0) || // cache does not exist + ($cache != -1 && $mtime < time() - $cache) // 'recache' and cache has expired + ) { + if(media_image_download($url, $local)) { return $local; - }else{ + } else { return false; } } @@ -1991,6 +2148,10 @@ function media_get_from_URL($url,$ext,$cache){ * Download image files * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $url + * @param string $file path to file in which to put the downloaded content + * @return bool */ function media_image_download($url,$file){ global $conf; @@ -2026,6 +2187,15 @@ function media_image_download($url,$file){ * * @author Pavel Vitis <Pavel.Vitis@seznam.cz> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $ext extension + * @param string $from filename path to file + * @param int $from_w original width + * @param int $from_h original height + * @param string $to path to resized file + * @param int $to_w desired width + * @param int $to_h desired height + * @return bool */ function media_resize_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ global $conf; @@ -2050,6 +2220,17 @@ function media_resize_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ * crop images using external ImageMagick convert program * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $ext extension + * @param string $from filename path to file + * @param int $from_w original width + * @param int $from_h original height + * @param string $to path to resized file + * @param int $to_w desired width + * @param int $to_h desired height + * @param int $ofs_x offset of crop centre + * @param int $ofs_y offset of crop centre + * @return bool */ function media_crop_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x,$ofs_y){ global $conf; @@ -2075,6 +2256,17 @@ function media_crop_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x,$o * * @author Andreas Gohr <andi@splitbrain.org> * @author Sebastian Wienecke <s_wienecke@web.de> + * + * @param string $ext extension + * @param string $from filename path to file + * @param int $from_w original width + * @param int $from_h original height + * @param string $to path to resized file + * @param int $to_w desired width + * @param int $to_h desired height + * @param int $ofs_x offset of crop centre + * @param int $ofs_y offset of crop centre + * @return bool */ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x=0,$ofs_y=0){ global $conf; @@ -2087,6 +2279,7 @@ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x= } // create an image of the given filetype + $image = false; if ($ext == 'jpg' || $ext == 'jpeg'){ if(!function_exists("imagecreatefromjpeg")) return false; $image = @imagecreatefromjpeg($from); @@ -2100,6 +2293,7 @@ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x= } if(!$image) return false; + $newimg = false; if(($conf['gdlib']>1) && function_exists("imagecreatetruecolor") && $ext != 'gif'){ $newimg = @imagecreatetruecolor ($to_w, $to_h); } @@ -2175,23 +2369,23 @@ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x= * Return other media files with the same base name * but different extensions. * - * @param string $src - ID of media file - * @param array $exts - alternative extensions to find other files for - * @return array - mime type => file ID + * @param string $src - ID of media file + * @param string[] $exts - alternative extensions to find other files for + * @return array - array(mime type => file ID) * * @author Anika Henke <anika@selfthinker.org> */ function media_alternativefiles($src, $exts){ $files = array(); - list($srcExt, $srcMime) = mimetype($src); + list($srcExt, /* $srcMime */) = mimetype($src); $filebase = substr($src, 0, -1 * (strlen($srcExt)+1)); foreach($exts as $ext) { $fileid = $filebase.'.'.$ext; $file = mediaFN($fileid); if(file_exists($file)) { - list($fileExt, $fileMime) = mimetype($file); + list(/* $fileExt */, $fileMime) = mimetype($file); $files[$fileMime] = $fileid; } } @@ -2202,7 +2396,7 @@ function media_alternativefiles($src, $exts){ * Check if video/audio is supported to be embedded. * * @param string $mime - mimetype of media file - * @param string $type - type of media files to check ('video', 'audio', or none) + * @param string $type - type of media files to check ('video', 'audio', or null for all) * @return boolean * * @author Anika Henke <anika@selfthinker.org> diff --git a/inc/pageutils.php b/inc/pageutils.php index 49c00d36f..2fbcbfd1f 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -20,7 +20,7 @@ * * @param string $param the $_REQUEST variable name, default 'id' * @param bool $clean if true, ID is cleaned - * @return mixed|string + * @return string */ function getID($param='id',$clean=true){ /** @var Input $INPUT */ @@ -97,6 +97,7 @@ function getID($param='id',$clean=true){ * converted to unaccented ones * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $raw_id The pageid to clean * @param boolean $ascii Force ASCII * @return string cleaned id @@ -152,7 +153,7 @@ function cleanID($raw_id,$ascii=false){ * @author Andreas Gohr <andi@splitbrain.org> * * @param string $id - * @return string|bool the namespace part or false if the given ID has no namespace (root) + * @return string|false the namespace part or false if the given ID has no namespace (root) */ function getNS($id){ $pos = strrpos((string)$id,':'); @@ -271,7 +272,7 @@ function page_exists($id,$rev='',$clean=true, $date_at=false) { * The filename is URL encoded to protect Unicode chars * * @param $raw_id string id of wikipage - * @param $rev string page revision, empty string for current + * @param $rev int|string page revision, empty string for current * @param $clean bool flag indicating that $raw_id should be cleaned. Only set to false * when $id is guaranteed to have been cleaned already. * @return string full path @@ -441,7 +442,7 @@ function localeFN($id,$ext='txt'){ * @param string $ns namespace which is context of id * @param string $id relative id * @param bool $clean flag indicating that id should be cleaned - * @return mixed|string + * @return string */ function resolve_id($ns,$id,$clean=true){ global $conf; @@ -738,6 +739,7 @@ function utf8_decodeFN($file){ * Used for sidebars, but can be used other stuff as well * * @todo add event hook + * * @param string $page the pagename you're looking for * @return string|false the full page id of the found page, false if any */ diff --git a/inc/parser/handler.php b/inc/parser/handler.php index a1040d12e..d96a01a60 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -71,6 +71,7 @@ class Doku_Handler { */ function plugin($match, $state, $pos, $pluginname){ $data = array($match); + /** @var DokuWiki_Syntax_Plugin $plugin */ $plugin = plugin_load('syntax',$pluginname); if($plugin != null){ $data = $plugin->handle($match, $state, $pos, $this); @@ -711,6 +712,9 @@ class Doku_Handler_CallWriter { var $Handler; + /** + * @param Doku_Handler $Handler + */ function Doku_Handler_CallWriter(& $Handler) { $this->Handler = & $Handler; } @@ -747,7 +751,7 @@ class Doku_Handler_Nest { /** * constructor * - * @param object $CallWriter the renderers current call writer + * @param Doku_Handler_CallWriter $CallWriter the renderers current call writer * @param string $close closing instruction name, this is required to properly terminate the * syntax mode if the document ends without a closing pattern */ @@ -805,6 +809,8 @@ class Doku_Handler_List { var $listCalls = array(); var $listStack = array(); + const NODE = 1; + function Doku_Handler_List(& $CallWriter) { $this->CallWriter = & $CallWriter; } @@ -856,7 +862,8 @@ class Doku_Handler_List { $depth = $this->interpretSyntax($call[1][0], $listType); $this->initialDepth = $depth; - $this->listStack[] = array($listType, $depth); + // array(list type, current depth, index of current listitem_open) + $this->listStack[] = array($listType, $depth, 1); $this->listCalls[] = array('list'.$listType.'_open',array(),$call[2]); $this->listCalls[] = array('listitem_open',array(1),$call[2]); @@ -881,6 +888,7 @@ class Doku_Handler_List { function listOpen($call) { $depth = $this->interpretSyntax($call[1][0], $listType); $end = end($this->listStack); + $key = key($this->listStack); // Not allowed to be shallower than initialDepth if ( $depth < $this->initialDepth ) { @@ -897,6 +905,9 @@ class Doku_Handler_List { $this->listCalls[] = array('listitem_open',array($depth-1),$call[2]); $this->listCalls[] = array('listcontent_open',array(),$call[2]); + // new list item, update list stack's index into current listitem_open + $this->listStack[$key][2] = count($this->listCalls) - 2; + // Switched list type... } else { @@ -908,7 +919,7 @@ class Doku_Handler_List { $this->listCalls[] = array('listcontent_open',array(),$call[2]); array_pop($this->listStack); - $this->listStack[] = array($listType, $depth); + $this->listStack[] = array($listType, $depth, count($this->listCalls) - 2); } //------------------------------------------------------------------------ @@ -920,7 +931,10 @@ class Doku_Handler_List { $this->listCalls[] = array('listitem_open', array($depth-1), $call[2]); $this->listCalls[] = array('listcontent_open',array(),$call[2]); - $this->listStack[] = array($listType, $depth); + // set the node/leaf state of this item's parent listitem_open to NODE + $this->listCalls[$this->listStack[$key][2]][1][1] = self::NODE; + + $this->listStack[] = array($listType, $depth, count($this->listCalls) - 2); //------------------------------------------------------------------------ // Getting shallower ( $depth < $end[1] ) @@ -934,6 +948,7 @@ class Doku_Handler_List { while (1) { $end = end($this->listStack); + $key = key($this->listStack); if ( $end[1] <= $depth ) { @@ -946,6 +961,9 @@ class Doku_Handler_List { $this->listCalls[] = array('listitem_open',array($depth-1),$call[2]); $this->listCalls[] = array('listcontent_open',array(),$call[2]); + // new list item, update list stack's index into current listitem_open + $this->listStack[$key][2] = count($this->listCalls) - 2; + } else { // Switching list type... $this->listCalls[] = array('list'.$end[0].'_close', array(), $call[2]); @@ -954,7 +972,7 @@ class Doku_Handler_List { $this->listCalls[] = array('listcontent_open',array(),$call[2]); array_pop($this->listStack); - $this->listStack[] = array($listType, $depth); + $this->listStack[] = array($listType, $depth, count($this->listCalls) - 2); } break; diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php index 2e84eca7c..b46a5f505 100644 --- a/inc/parser/lexer.php +++ b/inc/parser/lexer.php @@ -56,12 +56,12 @@ class Doku_LexerParallelRegex { /** * Adds a pattern with an optional label. * - * @param mixed $pattern Perl style regex. Must be UTF-8 + * @param mixed $pattern Perl style regex. Must be UTF-8 * encoded. If its a string, the (, ) * lose their meaning unless they * form part of a lookahead or * lookbehind assertation. - * @param string $label Label of regex to be returned + * @param bool|string $label Label of regex to be returned * on a match. Label must be ASCII * @access public */ @@ -151,7 +151,8 @@ class Doku_LexerParallelRegex { * "or" operator. Caches the regex. * Will automatically escape (, ) and / tokens. * - * @param array $patterns List of patterns in order. + * @internal array $_patterns List of patterns in order. + * @return null|string * @access private */ function _getCompoundedRegex() { @@ -297,6 +298,7 @@ class Doku_Lexer { */ function Doku_Lexer(&$parser, $start = "accept", $case = false) { $this->_case = $case; + /** @var Doku_LexerParallelRegex[] _regexes */ $this->_regexes = array(); $this->_parser = &$parser; $this->_mode = new Doku_LexerStateStack($start); @@ -425,11 +427,13 @@ class Doku_Lexer { * Sends the matched token and any leading unmatched * text to the parser changing the lexer to a new * mode if one is listed. - * @param string $unmatched Unmatched leading portion. - * @param string $matched Actual token match. - * @param string $mode Mode after match. A boolean + * @param string $unmatched Unmatched leading portion. + * @param string $matched Actual token match. + * @param bool|string $mode Mode after match. A boolean * false mode causes no change. - * @param int $pos Current byte index location in raw doc + * @param int $initialPos + * @param int $matchPos + * Current byte index location in raw doc * thats being parsed * @return boolean False if there was any error * from the parser. @@ -498,11 +502,12 @@ class Doku_Lexer { * Calls the parser method named after the current * mode. Empty content will be ignored. The lexer * has a parser handler for each mode in the lexer. - * @param string $content Text parsed. - * @param boolean $is_match Token is recognised rather + * @param string $content Text parsed. + * @param boolean $is_match Token is recognised rather * than unparsed data. - * @param int $pos Current byte index location in raw doc + * @param int $pos Current byte index location in raw doc * thats being parsed + * @return bool * @access private */ function _invokeParser($content, $is_match, $pos) { diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index 25bf3fe3d..ac8fd2130 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -165,7 +165,7 @@ class Doku_Renderer_metadata extends Doku_Renderer { if(!isset($this->meta['title'])) $this->meta['title'] = $text; // add the header to the TOC - $hid = $this->_headerToLink($text, 'true'); + $hid = $this->_headerToLink($text, true); $this->toc_additem($hid, $text, $level); // add to summary @@ -251,8 +251,9 @@ class Doku_Renderer_metadata extends Doku_Renderer { * Open a list item * * @param int $level the nesting level + * @param bool $node true when a node; false when a leaf */ - function listitem_open($level) { + function listitem_open($level,$node=false) { $this->cdata(str_repeat(DOKU_TAB, $level).'* '); } @@ -421,8 +422,8 @@ class Doku_Renderer_metadata extends Doku_Renderer { /** * keep track of internal links in $this->meta['relation']['references'] * - * @param string $id page ID to link to. eg. 'wiki:syntax' - * @param string|array $name name for the link, array for media file + * @param string $id page ID to link to. eg. 'wiki:syntax' + * @param string|array|null $name name for the link, array for media file */ function internallink($id, $name = null) { global $ID; @@ -458,8 +459,8 @@ class Doku_Renderer_metadata extends Doku_Renderer { /** * Render an external link * - * @param string $url full URL with scheme - * @param string|array $name name for the link, array for media file + * @param string $url full URL with scheme + * @param string|array|null $name name for the link, array for media file */ function externallink($url, $name = null) { if(is_array($name)) { @@ -628,9 +629,9 @@ class Doku_Renderer_metadata extends Doku_Renderer { * Construct a title and handle images in titles * * @author Harry Fuecks <hfuecks@gmail.com> - * @param string|array $title either string title or media array - * @param string $default default title if nothing else is found - * @param null|string $id linked page id (used to extract title from first heading) + * @param string|array|null $title either string title or media array + * @param string $default default title if nothing else is found + * @param null|string $id linked page id (used to extract title from first heading) * @return string title text */ function _getLinkTitle($title, $default, $id = null) { diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 09294539e..e1d28267a 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -190,7 +190,7 @@ class Doku_Renderer extends DokuWiki_Plugin { /** * Render plain text data * - * @param $text + * @param string $text */ function cdata($text) { } @@ -343,8 +343,9 @@ class Doku_Renderer extends DokuWiki_Plugin { * Open a list item * * @param int $level the nesting level + * @param bool $node true when a node; false when a leaf */ - function listitem_open($level) { + function listitem_open($level,$node=false) { } /** @@ -759,6 +760,9 @@ class Doku_Renderer extends DokuWiki_Plugin { * casing and special chars * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $name + * @return string */ function _simpleTitle($name) { global $conf; @@ -778,6 +782,11 @@ class Doku_Renderer extends DokuWiki_Plugin { /** * Resolve an interwikilink + * + * @param string $shortcut identifier for the interwiki link + * @param string $reference fragment that refers the content + * @param null|bool $exists reference which returns if an internal page exists + * @return string interwikilink */ function _resolveInterWiki(&$shortcut, $reference, &$exists = null) { //get interwiki URL diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 5627a0353..f1703111e 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -59,10 +59,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Register a new edit section range * - * @param $type string The section type identifier - * @param $title string The section title - * @param $start int The byte position for the edit start - * @return string A marker class for the starting HTML element + * @param string $type The section type identifier + * @param string $title The section title + * @param int $start The byte position for the edit start + * @return string A marker class for the starting HTML element + * * @author Adrian Lang <lang@cosmocode.de> */ public function startSectionEdit($start, $type, $title = null) { @@ -73,8 +74,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Finish an edit section range * - * @param $end int The byte position for the edit end; null for the rest of - * the page + * @param int $end The byte position for the edit end; null for the rest of the page + * * @author Adrian Lang <lang@cosmocode.de> */ public function finishSectionEdit($end = null) { @@ -456,9 +457,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * Open a list item * * @param int $level the nesting level + * @param bool $node true when a node; false when a leaf */ - function listitem_open($level) { - $this->doc .= '<li class="level'.$level.'">'; + function listitem_open($level, $node=false) { + $branching = $node ? ' node' : ''; + $this->doc .= '<li class="level'.$level.$branching.'">'; } /** @@ -821,6 +824,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // now first resolve and clean up the $id resolve_pageid(getNS($ID), $id, $exists, $this->date_at, true); + $link = array(); $name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype); if(!$isImage) { if($exists) { @@ -908,6 +912,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } //prepare for formating + $link = array(); $link['target'] = $conf['target']['extern']; $link['style'] = ''; $link['pre'] = ''; @@ -985,6 +990,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $conf; //simple setup + $link = array(); $link['target'] = $conf['target']['windows']; $link['pre'] = ''; $link['suf'] = ''; @@ -999,6 +1005,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['title'] = $this->_xmlEntities($url); $url = str_replace('\\', '/', $url); + $url = ltrim($url,'/'); $url = 'file:///'.$url; $link['url'] = $url; @@ -1575,7 +1582,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * Returns HTML code for images used in link titles * * @author Andreas Gohr <andi@splitbrain.org> - * @param string $img + * @param array $img * @return string HTML img tag or similar */ function _imageTitle($img) { @@ -1660,7 +1667,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // prepare alternative formats $extensions = array('webm', 'ogv', 'mp4'); $files = media_alternativefiles($src, $extensions); - $poster = media_alternativefiles($src, array('jpg', 'png'), true); + $poster = media_alternativefiles($src, array('jpg', 'png')); if(!empty($poster)) { $posterUrl = ml(reset($poster), '', true, '&'); } @@ -1704,7 +1711,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @param array $atts - additional attributes for the <audio> tag * @return string */ - function _audio($src, $atts = null) { + function _audio($src, $atts = array()) { $files = array(); $isExternal = media_isexternal($src); diff --git a/inc/parserutils.php b/inc/parserutils.php index ba073f15d..3ef8138a7 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -55,6 +55,11 @@ define('METADATA_RENDER_UNLIMITED', 4); * wasn't found * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $id page id + * @param string|int $rev revision timestamp or empty string + * @param bool $excuse + * @return null|string */ function p_wiki_xhtml($id, $rev='', $excuse=true,$date_at=''){ $file = wikiFN($id,$rev); @@ -89,6 +94,9 @@ function p_wiki_xhtml($id, $rev='', $excuse=true,$date_at=''){ * Returns the specified local text in parsed format * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $id page id + * @return null|string */ function p_locale_xhtml($id){ //fetch parsed locale @@ -101,6 +109,11 @@ function p_locale_xhtml($id){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Chris Smith <chris@jalakai.co.uk> + * + * @param string $file filename, path to file + * @param string $format + * @param string $id page id + * @return null|string */ function p_cached_output($file, $format='xhtml', $id='') { global $conf; @@ -129,6 +142,11 @@ function p_cached_output($file, $format='xhtml', $id='') { * Uses and creates a serialized cache file * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename, path to file + * @param bool $cacheonly + * @param string $id page id + * @return array|null */ function p_cached_instructions($file,$cacheonly=false,$id='') { static $run = null; @@ -157,7 +175,8 @@ function p_cached_instructions($file,$cacheonly=false,$id='') { * * @author Harry Fuecks <hfuecks@gmail.com> * @author Andreas Gohr <andi@splitbrain.org> - * @param string $text raw wiki syntax text + * + * @param string $text raw wiki syntax text * @return array a list of instruction arrays */ function p_get_instructions($text){ @@ -185,9 +204,9 @@ function p_get_instructions($text){ /** * returns the metadata of a page * - * @param string $id The id of the page the metadata should be returned from - * @param string $key The key of the metdata value that shall be read (by default everything) - separate hierarchies by " " like "date created" - * @param int $render If the page should be rendererd - possible values: + * @param string $id The id of the page the metadata should be returned from + * @param string $key The key of the metdata value that shall be read (by default everything) - separate hierarchies by " " like "date created" + * @param int $render If the page should be rendererd - possible values: * METADATA_DONT_RENDER, METADATA_RENDER_USING_SIMPLE_CACHE, METADATA_RENDER_USING_CACHE * METADATA_RENDER_UNLIMITED (also combined with the previous two options), * default: METADATA_RENDER_USING_CACHE @@ -360,6 +379,9 @@ function p_set_metadata($id, $data, $render=false, $persistent=true){ * used on page deletion * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @return bool success / fail */ function p_purge_metadata($id) { $meta = p_read_metadata($id); @@ -423,6 +445,10 @@ function p_save_metadata($id, $meta) { * renders the metadata of a page * * @author Esther Brunner <esther@kaffeehaus.ch> + * + * @param string $id page id + * @param array $orig the original metadata + * @return array|null array('current'=> array,'persistent'=> array); */ function p_render_metadata($id, $orig){ // make sure the correct ID is in global ID @@ -477,6 +503,8 @@ function p_render_metadata($id, $orig){ * returns all available parser syntax modes in correct order * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return array[] with for each plugin the array('sort' => sortnumber, 'mode' => mode string, 'obj' => plugin object) */ function p_get_parsermodes(){ global $conf; @@ -569,6 +597,10 @@ function p_get_parsermodes(){ * Callback function for usort * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $a + * @param array $b + * @return int $a is lower/equal/higher than $b */ function p_sort_modes($a, $b){ if($a['sort'] == $b['sort']) return 0; @@ -582,9 +614,15 @@ function p_sort_modes($a, $b){ * * @author Harry Fuecks <hfuecks@gmail.com> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $mode + * @param array|null|false $instructions + * @param array $info returns render info like enabled toc and cache + * @return null|string rendered output */ function p_render($mode,$instructions,&$info,$date_at=''){ if(is_null($instructions)) return ''; + if($instructions === false) return ''; $Renderer = p_get_renderer($mode); if (is_null($Renderer)) return null; @@ -621,7 +659,7 @@ function p_render($mode,$instructions,&$info,$date_at=''){ * Figure out the correct renderer class to use for $mode, * instantiate and return it * - * @param $mode string Mode of the renderer to get + * @param string $mode Mode of the renderer to get * @return null|Doku_Renderer The renderer * * @author Christopher Smith <chris@jalakai.co.uk> @@ -678,8 +716,8 @@ function p_get_renderer($mode) { * METADATA_RENDER_USING_SIMPLE_CACHE, * METADATA_RENDER_USING_CACHE, * METADATA_RENDER_UNLIMITED - * * @return string|null The first heading + * * @author Andreas Gohr <andi@splitbrain.org> * @author Michael Hamann <michael@content-space.de> */ @@ -693,8 +731,8 @@ function p_get_first_heading($id, $render=METADATA_RENDER_USING_SIMPLE_CACHE){ * @param string $code source code to be highlighted * @param string $language language to provide highlighting * @param string $wrapper html element to wrap the returned highlighted text - * * @return string xhtml code + * * @author Christopher Smith <chris@jalakai.co.uk> * @author Andreas Gohr <andi@splitbrain.org> */ diff --git a/inc/plugin.php b/inc/plugin.php index 80689e389..9d9b2044c 100644 --- a/inc/plugin.php +++ b/inc/plugin.php @@ -48,14 +48,25 @@ class DokuWiki_Plugin { // plugin introspection methods // extract from class name, format = <plugin type>_plugin_<name>[_<component name>] + /** + * @return string plugin type + */ public function getPluginType() { list($t) = explode('_', get_class($this), 2); return $t; } + + /** + * @return string plugin name + */ public function getPluginName() { list(/* $t */, /* $p */, $n) = explode('_', get_class($this), 4); return $n; } + + /** + * @return string component name + */ public function getPluginComponent() { list(/* $t */, /* $p */, /* $n */, $c) = explode('_', get_class($this), 4); return (isset($c)?$c:''); @@ -91,9 +102,11 @@ class DokuWiki_Plugin { } /** - * localFN($id) - * prepends appropriate path for a language dependent filename + * Prepends appropriate path for a language dependent filename * plugin equivalent of localFN() + * + * @param string $id id of localization file + * @return string wiki text */ public function localFN($id) { global $conf; @@ -110,9 +123,8 @@ class DokuWiki_Plugin { } /** - * setupLocale() - * reads all the plugins language dependent strings into $this->lang - * this function is automatically called by getLang() + * Reads all the plugins language dependent strings into $this->lang + * this function is automatically called by getLang() */ function setupLocale() { if($this->localised) return; @@ -209,8 +221,7 @@ class DokuWiki_Plugin { * * @param string $name name of plugin to load * @param bool $msg if a message should be displayed in case the plugin is not available - * - * @return object helper plugin object + * @return DokuWiki_Plugin|null helper plugin object */ public function loadHelper($name, $msg = true){ $obj = plugin_load('helper',$name); @@ -224,6 +235,12 @@ class DokuWiki_Plugin { /** * email * standardised function to generate an email link according to obfuscation settings + * + * @param string $email + * @param string $name + * @param string $class + * @param string $more + * @return string html */ public function email($email, $name='', $class='', $more='') { if (!$email) return $name; @@ -236,6 +253,13 @@ class DokuWiki_Plugin { /** * external_link * standardised function to generate an external link according to conf settings + * + * @param string $link + * @param string $title + * @param string $class + * @param string $target + * @param string $more + * @return string */ public function external_link($link, $title='', $class='', $target='', $more='') { global $conf; @@ -260,8 +284,9 @@ class DokuWiki_Plugin { * Instead use render_text() * * @deprecated 2014-01-22 - * @param $name - * @param $arguments + * + * @param string $name + * @param array $arguments * @return null|string */ public function __call($name, $arguments) { @@ -278,7 +303,7 @@ class DokuWiki_Plugin { * output text string through the parser, allows dokuwiki markup to be used * very ineffecient for small pieces of data - try not to use * - * @param string $text wiki markup to parse + * @param string $text wiki markup to parse * @param string $format output format * @return null|string */ diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php index 4f0cd58e6..dfd4d0a29 100644 --- a/inc/plugincontroller.class.php +++ b/inc/plugincontroller.class.php @@ -66,14 +66,14 @@ class Doku_Plugin_Controller { * @param $name string name of the plugin to load * @param $new bool true to return a new instance of the plugin, false to use an already loaded instance * @param $disabled bool true to load even disabled plugins - * @return DokuWiki_Plugin|DokuWiki_Syntax_Plugin|null the plugin object or null on failure + * @return DokuWiki_Plugin|DokuWiki_Syntax_Plugin|DokuWiki_Auth_Plugin|DokuWiki_Admin_Plugin|DokuWiki_Action_Plugin|DokuWiki_Remote_Plugin|null the plugin object or null on failure */ public function load($type,$name,$new=false,$disabled=false){ //we keep all loaded plugins available in global scope for reuse global $DOKU_PLUGINS; - list($plugin,$component) = $this->_splitName($name); + list($plugin, /* $component */) = $this->_splitName($name); // check if disabled if(!$disabled && $this->isdisabled($plugin)){ @@ -114,7 +114,7 @@ class Doku_Plugin_Controller { * Whether plugin is disabled * * @param string $plugin name of plugin - * @return bool; true disabled, false enabled + * @return bool true disabled, false enabled */ public function isdisabled($plugin) { return empty($this->tmp_plugins[$plugin]); @@ -124,7 +124,7 @@ class Doku_Plugin_Controller { * Disable the plugin * * @param string $plugin name of plugin - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ public function disable($plugin) { if(array_key_exists($plugin,$this->plugin_cascade['protected'])) return false; @@ -136,7 +136,7 @@ class Doku_Plugin_Controller { * Enable the plugin * * @param string $plugin name of plugin - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ public function enable($plugin) { if(array_key_exists($plugin,$this->plugin_cascade['protected'])) return false; @@ -229,7 +229,7 @@ class Doku_Plugin_Controller { * @param bool $forceSave; * false to save only when config changed * true to always save - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ protected function saveList($forceSave = false) { global $conf; @@ -302,12 +302,9 @@ class Doku_Plugin_Controller { /** * Returns a list of available plugin components of given type * - * @param string $type, plugin_type name; - * the type of plugin to return, - * @param bool $enabled; - * true to return enabled plugins, - * false to return disabled plugins - * + * @param string $type plugin_type name; the type of plugin to return, + * @param bool $enabled true to return enabled plugins, + * false to return disabled plugins * @return array of plugin components of requested type */ protected function _getListByType($type, $enabled) { diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 911c4e5c0..4d591869d 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -49,7 +49,7 @@ function plugin_load($type,$name,$new=false,$disabled=false) { * Whether plugin is disabled * * @param string $plugin name of plugin - * @return bool; true disabled, false enabled + * @return bool true disabled, false enabled */ function plugin_isdisabled($plugin) { /** @var $plugin_controller Doku_Plugin_Controller */ @@ -61,7 +61,7 @@ function plugin_isdisabled($plugin) { * Enable the plugin * * @param string $plugin name of plugin - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ function plugin_enable($plugin) { /** @var $plugin_controller Doku_Plugin_Controller */ @@ -73,7 +73,7 @@ function plugin_enable($plugin) { * Disable the plugin * * @param string $plugin name of plugin - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ function plugin_disable($plugin) { /** @var $plugin_controller Doku_Plugin_Controller */ diff --git a/inc/remote.php b/inc/remote.php index e27aa74f8..861353a19 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -60,6 +60,9 @@ class RemoteAPI { private $dateTransformation; private $fileTransformation; + /** + * constructor + */ public function __construct() { $this->dateTransformation = array($this, 'dummyTransformation'); $this->fileTransformation = array($this, 'dummyTransformation'); @@ -75,7 +78,7 @@ class RemoteAPI { } /** - * call a method via remote api. + * Call a method via remote api. * * @param string $method name of the method to call. * @param array $args arguments to pass to the given method @@ -85,7 +88,7 @@ class RemoteAPI { if ($args === null) { $args = array(); } - list($type, $pluginName, $call) = explode('.', $method, 3); + list($type, $pluginName, /* $call */) = explode('.', $method, 3); if ($type === 'plugin') { return $this->callPlugin($pluginName, $method, $args); } @@ -95,11 +98,25 @@ class RemoteAPI { return $this->callCustomCallPlugin($method, $args); } + /** + * Check existance of core methods + * + * @param string $name name of the method + * @return bool if method exists + */ private function coreMethodExist($name) { $coreMethods = $this->getCoreMethods(); return array_key_exists($name, $coreMethods); } + /** + * Try to call custom methods provided by plugins + * + * @param string $method name of method + * @param array $args + * @return mixed + * @throws RemoteException if method not exists + */ private function callCustomCallPlugin($method, $args) { $customCalls = $this->getCustomCallPlugins(); if (!array_key_exists($method, $customCalls)) { @@ -109,6 +126,12 @@ class RemoteAPI { return $this->callPlugin($customCall[0], $customCall[1], $args); } + /** + * Returns plugin calls that are registered via RPC_CALL_ADD action + * + * @return array with pairs of custom plugin calls + * @triggers RPC_CALL_ADD + */ private function getCustomCallPlugins() { if ($this->pluginCustomCalls === null) { $data = array(); @@ -118,6 +141,15 @@ class RemoteAPI { return $this->pluginCustomCalls; } + /** + * Call a plugin method + * + * @param string $pluginName + * @param string $method method name + * @param array $args + * @return mixed return of custom method + * @throws RemoteException + */ private function callPlugin($pluginName, $method, $args) { $plugin = plugin_load('remote', $pluginName); $methods = $this->getPluginMethods(); @@ -129,6 +161,14 @@ class RemoteAPI { return call_user_func_array(array($plugin, $name), $args); } + /** + * Call a core method + * + * @param string $method name of method + * @param array $args + * @return mixed + * @throws RemoteException if method not exist + */ private function callCoreMethod($method, $args) { $coreMethods = $this->getCoreMethods(); $this->checkAccess($coreMethods[$method]); @@ -139,6 +179,11 @@ class RemoteAPI { return call_user_func_array(array($this->coreMethods, $this->getMethodName($coreMethods, $method)), $args); } + /** + * Check if access should be checked + * + * @param array $methodMeta data about the method + */ private function checkAccess($methodMeta) { if (!isset($methodMeta['public'])) { $this->forceAccess(); @@ -149,12 +194,26 @@ class RemoteAPI { } } - private function checkArgumentLength($method, $args) { - if (count($method['args']) < count($args)) { + /** + * Check the number of parameters + * + * @param array $methodMeta data about the method + * @param array $args + * @throws RemoteException if wrong parameter count + */ + private function checkArgumentLength($methodMeta, $args) { + if (count($methodMeta['args']) < count($args)) { throw new RemoteException('Method does not exist - wrong parameter count.', -32603); } } + /** + * Determine the name of the real method + * + * @param array $methodMeta list of data of the methods + * @param string $method name of method + * @return string + */ private function getMethodName($methodMeta, $method) { if (isset($methodMeta[$method]['name'])) { return $methodMeta[$method]['name']; @@ -164,6 +223,8 @@ class RemoteAPI { } /** + * Perform access check for current user + * * @return bool true if the current user has access to remote api. */ public function hasAccess() { @@ -186,8 +247,10 @@ class RemoteAPI { } /** - * @throws RemoteException On denied access. + * Requests access + * * @return void + * @throws RemoteException On denied access. */ public function forceAccess() { if (!$this->hasAccess()) { @@ -196,7 +259,10 @@ class RemoteAPI { } /** + * Collects all the methods of the enabled Remote Plugins + * * @return array all plugin methods. + * @throws RemoteException if not implemented */ public function getPluginMethods() { if ($this->pluginMethods === null) { @@ -204,6 +270,7 @@ class RemoteAPI { $plugins = plugin_list('remote'); foreach ($plugins as $pluginName) { + /** @var DokuWiki_Remote_Plugin $plugin */ $plugin = plugin_load('remote', $pluginName); if (!is_subclass_of($plugin, 'DokuWiki_Remote_Plugin')) { throw new RemoteException("Plugin $pluginName does not implement DokuWiki_Remote_Plugin"); @@ -219,6 +286,8 @@ class RemoteAPI { } /** + * Collects all the core methods + * * @param RemoteAPICore $apiCore this parameter is used for testing. Here you can pass a non-default RemoteAPICore * instance. (for mocking) * @return array all core methods. @@ -234,22 +303,50 @@ class RemoteAPI { return $this->coreMethods->__getRemoteInfo(); } + /** + * Transform file to xml + * + * @param mixed $data + * @return mixed + */ public function toFile($data) { return call_user_func($this->fileTransformation, $data); } + /** + * Transform date to xml + * + * @param mixed $data + * @return mixed + */ public function toDate($data) { return call_user_func($this->dateTransformation, $data); } + /** + * A simple transformation + * + * @param mixed $data + * @return mixed + */ public function dummyTransformation($data) { return $data; } + /** + * Set the transformer function + * + * @param callback $dateTransformation + */ public function setDateTransformation($dateTransformation) { $this->dateTransformation = $dateTransformation; } + /** + * Set the transformer function + * + * @param callback $fileTransformation + */ public function setFileTransformation($fileTransformation) { $this->fileTransformation = $fileTransformation; } diff --git a/inc/search.php b/inc/search.php index 5489dc2c0..935969d3f 100644 --- a/inc/search.php +++ b/inc/search.php @@ -134,6 +134,11 @@ function search_namespaces(&$data,$base,$file,$type,$lvl,$opts){ /** * List all mediafiles in a namespace + * $opts['depth'] recursion level, 0 for all + * $opts['showmsg'] shows message if invalid media id is used + * $opts['skipacl'] skip acl checking + * $opts['pattern'] check given pattern + * $opts['hash'] add hashes to result list * * @author Andreas Gohr <andi@splitbrain.org> */ @@ -258,6 +263,7 @@ function search_allpages(&$data,$base,$file,$type,$lvl,$opts){ //only search txt files if(substr($file,-4) != '.txt') return true; + $item = array(); $item['id'] = pathID($file); if(!$opts['skipacl'] && auth_quickaclcheck($item['id']) < AUTH_READ){ return false; diff --git a/inc/subscription.php b/inc/subscription.php index aab6de926..58376f2ec 100644 --- a/inc/subscription.php +++ b/inc/subscription.php @@ -444,17 +444,17 @@ class Subscription { * Send the diff for some media change * * @fixme this should embed thumbnails of images in HTML version + * * @param string $subscriber_mail The target mail address * @param string $template Mail template ('uploadmail', ...) * @param string $id Media file for which the notification is * @param int|bool $rev Old revision if any - * @return bool true if successfully sent */ public function send_media_diff($subscriber_mail, $template, $id, $rev = false) { global $conf; $file = mediaFN($id); - list($mime, $ext) = mimetype($id); + list($mime, /* $ext */) = mimetype($id); $trep = array( 'MIME' => $mime, @@ -515,7 +515,7 @@ class Subscription { * @author Adrian Lang <lang@cosmocode.de> * * @param string $subscriber_mail The target mail address - * @param array $id The ID + * @param string $id The ID * @param int $lastupdate Time of the last notification * @return bool */ @@ -619,6 +619,7 @@ class Subscription { /** * Get a valid message id for a certain $id and revision (or the current revision) + * * @param string $id The id of the page (or media file) the message id should be for * @param string $rev The revision of the page, set to the current revision of the page $id if not set * @return string diff --git a/inc/template.php b/inc/template.php index 31a65ce61..3bccb0bd8 100644 --- a/inc/template.php +++ b/inc/template.php @@ -68,6 +68,7 @@ function tpl_basedir($tpl='') { * handled by this function. ACL stuff is not done here either. * * @author Andreas Gohr <andi@splitbrain.org> + * * @triggers TPL_ACT_RENDER * @triggers TPL_CONTENT_DISPLAY * @param bool $prependTOC should the TOC be displayed here? @@ -170,8 +171,9 @@ function tpl_content_core() { break; default: $evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT); - if($evt->advise_before()) + if($evt->advise_before()) { msg("Failed to handle command: ".hsc($ACT), -1); + } $evt->advise_after(); unset($evt); return false; @@ -186,6 +188,7 @@ function tpl_content_core() { * a false argument * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $return Should the TOC be returned instead to be printed? * @return string */ @@ -204,7 +207,7 @@ function tpl_toc($return = false) { $toc = $TOC; } elseif(($ACT == 'show' || substr($ACT, 0, 6) == 'export') && !$REV && $INFO['exists']) { // get TOC from metadata, render if neccessary - $meta = p_get_metadata($ID, false, METADATA_RENDER_USING_CACHE); + $meta = p_get_metadata($ID, '', METADATA_RENDER_USING_CACHE); if(isset($meta['internal']['toc'])) { $tocok = $meta['internal']['toc']; } else { @@ -243,6 +246,8 @@ function tpl_toc($return = false) { * Handle the admin page contents * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return bool */ function tpl_admin() { global $INFO; @@ -277,6 +282,7 @@ function tpl_admin() { * This has to go into the head section of your template. * * @author Andreas Gohr <andi@splitbrain.org> + * * @triggers TPL_METAHEADER_OUTPUT * @param bool $alt Should feeds and alternative format links be added? * @return bool @@ -426,10 +432,12 @@ function tpl_metaheaders($alt = true) { * instances. Attributes are given as key value pairs. Values will be HTML * encoded automatically so they should be provided as is in the $data array. * - * For tags having a body attribute specify the the body data in the special + * For tags having a body attribute specify the body data in the special * attribute '_data'. This field will NOT BE ESCAPED automatically. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $data */ function _tpl_metaheaders_action($data) { foreach($data as $tag => $inst) { @@ -460,7 +468,7 @@ function _tpl_metaheaders_action($data) { * @param string $url * @param string $name * @param string $more - * @param bool $return if true return the link html, otherwise print + * @param bool $return if true return the link html, otherwise print * @return bool|string html of the link, or true if printed */ function tpl_link($url, $name, $more = '', $return = false) { @@ -480,7 +488,7 @@ function tpl_link($url, $name, $more = '', $return = false) { * @author Andreas Gohr <andi@splitbrain.org> * * @param string $id page id - * @param string|null $name link name + * @param string|null $name the name of the link * @return bool true */ function tpl_pagelink($id, $name = null) { @@ -495,6 +503,9 @@ function tpl_pagelink($id, $name = null) { * returns false if none is available * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $id page id + * @return false|string */ function tpl_getparent($id) { $parent = getNS($id).':'; @@ -513,6 +524,10 @@ function tpl_getparent($id) { * * @author Adrian Lang <mail@adrianlang.de> * @see tpl_get_action + * + * @param string $type + * @param bool $return + * @return bool|string html, or false if no data, true if printed */ function tpl_button($type, $return = false) { $data = tpl_get_action($type); @@ -545,12 +560,12 @@ function tpl_button($type, $return = false) { * @author Adrian Lang <mail@adrianlang.de> * @see tpl_get_action * - * @param string $type action name - * @param string $pre prefix of link - * @param string $suf suffix of link - * @param string $inner inner HTML for link - * @param bool $return if true it returns html, otherwise prints - * @return bool|string html of action link or false if nothing, or true if printed + * @param string $type action command + * @param string $pre prefix of link + * @param string $suf suffix of link + * @param string $inner innerHML of link + * @param bool $return if true it returns html, otherwise prints + * @return bool|string html or false if no data, true if printed */ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = false) { global $lang; @@ -616,6 +631,7 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals * @author Andreas Gohr <andi@splitbrain.org> * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> * @author Adrian Lang <mail@adrianlang.de> + * * @param string $type * @return array|bool|string */ @@ -772,13 +788,14 @@ function tpl_get_action($type) { * Wrapper around tpl_button() and tpl_actionlink() * * @author Anika Henke <anika@selfthinker.org> - * @param - * @param bool $link link or form button? - * @param bool $wrapper HTML element wrapper - * @param bool $return return or print - * @param string $pre prefix for links - * @param string $suf suffix for links - * @param string $inner inner HTML for links + * + * @param string $type action command + * @param bool $link link or form button? + * @param string|bool $wrapper HTML element wrapper + * @param bool $return return or print + * @param string $pre prefix for links + * @param string $suf suffix for links + * @param string $inner inner HTML for links * @return bool|string */ function tpl_action($type, $link = false, $wrapper = false, $return = false, $pre = '', $suf = '', $inner = '') { @@ -806,6 +823,7 @@ function tpl_action($type, $link = false, $wrapper = false, $return = false, $pr * autocompletion feature (MSIE and Firefox) * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $ajax * @param bool $autocomplete * @return bool @@ -834,6 +852,7 @@ function tpl_searchform($ajax = true, $autocomplete = true) { * Print the breadcrumbs trace * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $sep Separator between entries * @return bool */ @@ -875,6 +894,7 @@ function tpl_breadcrumbs($sep = '•') { * @author Sean Coates <sean@caedmon.net> * @author <fredrik@averpil.com> * @todo May behave strangely in RTL languages + * * @param string $sep Separator between entries * @return bool */ @@ -925,6 +945,7 @@ function tpl_youarehere($sep = ' » ') { * Could be enhanced with a profile link in future? * * @author Andreas Gohr <andi@splitbrain.org> + * * @return bool */ function tpl_userinfo() { @@ -943,6 +964,7 @@ function tpl_userinfo() { * Print some info about the current page * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $ret return content instead of printing it * @return bool|string */ @@ -1006,6 +1028,7 @@ function tpl_pageinfo($ret = false) { * the given ID is used. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $id page id * @param bool $ret return content instead of printing * @return bool|string @@ -1043,9 +1066,10 @@ function tpl_pagetitle($id = null, $ret = false) { * Only allowed in: detail.php * * @author Andreas Gohr <andi@splitbrain.org> - * @param array|string $tags tag or array of tags to try - * @param string $alt alternative output if no data was found - * @param null $src the image src, uses global $SRC if not given + * + * @param array|string $tags tag or array of tags to try + * @param string $alt alternative output if no data was found + * @param null|string $src the image src, uses global $SRC if not given * @return string */ function tpl_img_getTag($tags, $alt = '', $src = null) { @@ -1133,7 +1157,7 @@ function tpl_get_img_meta() { * @param $maxheight int - maximal height of the image * @param $link bool - link to the orginal size? * @param $params array - additional image attributes - * @return mixed Result of TPL_IMG_DISPLAY + * @return bool Result of TPL_IMG_DISPLAY */ function tpl_img($maxwidth = 0, $maxheight = 0, $link = true, $params = null) { global $IMG; @@ -1286,6 +1310,9 @@ function tpl_loadConfig() { * tpl_getLang($id) * * use this function to access template language variables + * + * @param string $id key of language string + * @return string */ function tpl_getLang($id) { static $lang = array(); @@ -1330,6 +1357,9 @@ function tpl_locale_xhtml($id) { /** * Prepends appropriate path for a language dependent filename + * + * @param string $id id of localized text + * @return string wiki text */ function tpl_localeFN($id) { $path = tpl_incdir().'lang/'; @@ -1357,6 +1387,7 @@ function tpl_localeFN($id) { * @triggers MEDIAMANAGER_CONTENT_OUTPUT * @param bool $fromajax - set true when calling this function via ajax * @param string $sort + * * @author Andreas Gohr <andi@splitbrain.org> */ function tpl_mediaContent($fromajax = false, $sort='natural') { @@ -1531,6 +1562,9 @@ function tpl_mediaTree() { * Note: this will not use any pretty URLs * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $empty empty option label + * @param string $button submit button label */ function tpl_actiondropdown($empty = '', $button = '>') { global $ID; @@ -1644,6 +1678,11 @@ function tpl_license($img = 'badge', $imgonly = false, $return = false, $wrap = * * This function is useful to populate sidebars or similar features in a * template + * + * @param string $pageid + * @param bool $print + * @param bool $propagate + * @return bool|null|string */ function tpl_include_page($pageid, $print = true, $propagate = false) { if (!$pageid) return false; @@ -1752,10 +1791,11 @@ function tpl_flush() { * If a given location starts with a colon it is assumed to be a media * file, otherwise it is assumed to be relative to the current template * - * @param array $search locations to look at - * @param bool $abs if to use absolute URL - * @param array &$imginfo filled with getimagesize() + * @param string[] $search locations to look at + * @param bool $abs if to use absolute URL + * @param array &$imginfo filled with getimagesize() * @return string + * * @author Andreas Gohr <andi@splitbrain.org> */ function tpl_getMediaFile($search, $abs = false, &$imginfo = null) { @@ -1806,6 +1846,8 @@ function tpl_getMediaFile($search, $abs = false, &$imginfo = null) { * * @author Anika Henke <anika@selfthinker.org> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file */ function tpl_includeFile($file) { global $config_cascade; @@ -1831,6 +1873,7 @@ function tpl_includeFile($file) { * Returns <link> tag for various icon types (favicon|mobile|generic) * * @author Anika Henke <anika@selfthinker.org> + * * @param array $types - list of icon types to display (favicon|mobile|generic) * @return string */ @@ -1906,6 +1949,8 @@ function tpl_media() { * Return useful layout classes * * @author Anika Henke <anika@selfthinker.org> + * + * @return string */ function tpl_classes() { global $ACT, $conf, $ID, $INFO; diff --git a/inc/utf8.php b/inc/utf8.php index c944667f7..f86217686 100644 --- a/inc/utf8.php +++ b/inc/utf8.php @@ -43,6 +43,9 @@ if(!function_exists('utf8_isASCII')){ * Checks if a string contains 7bit ASCII only * * @author Andreas Haerter <andreas.haerter@dev.mail-node.com> + * + * @param string $str + * @return bool */ function utf8_isASCII($str){ return (preg_match('/(?:[^\x00-\x7F])/', $str) !== 1); @@ -56,6 +59,9 @@ if(!function_exists('utf8_strip')){ * Returns a pure ASCII7 string * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $str + * @return string */ function utf8_strip($str){ $ascii = ''; @@ -75,6 +81,9 @@ if(!function_exists('utf8_check')){ * * @author <bmorel@ssi.fr> * @link http://www.php.net/manual/en/function.utf8-encode.php + * + * @param string $Str + * @return bool */ function utf8_check($Str) { $len = strlen($Str); @@ -105,6 +114,7 @@ if(!function_exists('utf8_basename')){ * * @see basename() * @link https://bugs.php.net/bug.php?id=37738 + * * @param string $path A path * @param string $suffix If the name component ends in suffix this will also be cut off * @return string @@ -134,6 +144,9 @@ if(!function_exists('utf8_strlen')){ * @author <chernyshevsky at hotmail dot com> * @see strlen() * @see utf8_decode() + * + * @param string $string + * @return int */ function utf8_strlen($string){ return strlen(utf8_decode($string)); @@ -148,10 +161,11 @@ if(!function_exists('utf8_substr')){ * * @author Harry Fuecks <hfuecks@gmail.com> * @author Chris Smith <chris@jalakai.co.uk> + * * @param string $str * @param int $offset number of UTF-8 characters offset (from left) * @param int $length (optional) length in UTF-8 characters from offset - * @return mixed string or false if failure + * @return string */ function utf8_substr($str, $offset, $length = null) { if(UTF8_MBSTRING){ @@ -250,6 +264,14 @@ if(!function_exists('utf8_substr_replace')){ * * @author Andreas Gohr <andi@splitbrain.org> * @see substr_replace() + * + * @param string $string input string + * @param string $replacement the replacement + * @param int $start the replacing will begin at the start'th offset into string. + * @param int $length If given and is positive, it represents the length of the portion of string which is + * to be replaced. If length is zero then this function will have the effect of inserting + * replacement into string at the given start offset. + * @return string */ function utf8_substr_replace($string, $replacement, $start , $length=0 ){ $ret = ''; @@ -266,6 +288,7 @@ if(!function_exists('utf8_ltrim')){ * * @author Andreas Gohr <andi@splitbrain.org> * @see ltrim() + * * @param string $str * @param string $charlist * @return string @@ -286,6 +309,7 @@ if(!function_exists('utf8_rtrim')){ * * @author Andreas Gohr <andi@splitbrain.org> * @see rtrim() + * * @param string $str * @param string $charlist * @return string @@ -306,6 +330,7 @@ if(!function_exists('utf8_trim')){ * * @author Andreas Gohr <andi@splitbrain.org> * @see trim() + * * @param string $str * @param string $charlist * @return string @@ -326,6 +351,9 @@ if(!function_exists('utf8_strtolower')){ * @author Leo Feyer <leo@typolight.org> * @see strtolower() * @see utf8_strtoupper() + * + * @param string $string + * @return string */ function utf8_strtolower($string){ if(UTF8_MBSTRING) return mb_strtolower($string,'utf-8'); @@ -344,6 +372,9 @@ if(!function_exists('utf8_strtoupper')){ * @author Leo Feyer <leo@typolight.org> * @see strtoupper() * @see utf8_strtoupper() + * + * @param string $string + * @return string */ function utf8_strtoupper($string){ if(UTF8_MBSTRING) return mb_strtoupper($string,'utf-8'); @@ -359,7 +390,8 @@ if(!function_exists('utf8_ucfirst')){ * Make a string's first character uppercase * * @author Harry Fuecks - * @param string + * + * @param string $str * @return string with first character as upper case (if applicable) */ function utf8_ucfirst($str){ @@ -381,9 +413,10 @@ if(!function_exists('utf8_ucwords')){ * Uppercase the first character of each word in a string * * @author Harry Fuecks - * @param string - * @return string with first char of each word uppercase * @see http://www.php.net/ucwords + * + * @param string $str + * @return string with first char of each word uppercase */ function utf8_ucwords($str) { // Note: [\x0c\x09\x0b\x0a\x0d\x20] matches; @@ -399,10 +432,11 @@ if(!function_exists('utf8_ucwords')){ * You don't need to call this yourself * * @author Harry Fuecks - * @param array $matches matches corresponding to a single word - * @return string with first char of the word in uppercase * @see utf8_ucwords * @see utf8_strtoupper + * + * @param array $matches matches corresponding to a single word + * @return string with first char of the word in uppercase */ function utf8_ucwords_callback($matches) { $leadingws = $matches[2]; @@ -420,6 +454,10 @@ if(!function_exists('utf8_deaccent')){ * letters. Default is to deaccent both cases ($case = 0) * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $string + * @param int $case + * @return string */ function utf8_deaccent($string,$case=0){ if($case <= 0){ @@ -439,6 +477,9 @@ if(!function_exists('utf8_romanize')){ * Romanize a non-latin string * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $string + * @return string */ function utf8_romanize($string){ if(utf8_isASCII($string)) return $string; //nothing to do @@ -456,6 +497,7 @@ if(!function_exists('utf8_stripspecials')){ * stripped chars (they are not included in $UTF8_SPECIAL_CHARS) * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $string The UTF8 string to strip of special chars * @param string $repl Replace special with this string * @param string $additional Additional chars to strip (used in regexp char class) @@ -480,9 +522,10 @@ if(!function_exists('utf8_strpos')){ * * @author Leo Feyer <leo@typolight.org> * @see strpos() - * @param string - * @param string - * @param integer + * + * @param string $haystack + * @param string $needle + * @param integer $offset * @return integer */ function utf8_strpos($haystack, $needle, $offset=0){ @@ -512,6 +555,9 @@ if(!function_exists('utf8_tohtml')){ * @author Tom N Harris <tnharris@whoopdedo.org> * @author <vpribish at shopping dot com> * @link http://www.php.net/manual/en/function.utf8-decode.php + * + * @param string $str + * @return string */ function utf8_tohtml ($str) { $ret = ''; @@ -542,6 +588,7 @@ if(!function_exists('utf8_unhtml')){ * what it should be -> "&&#38;" * * @author Tom N Harris <tnharris@whoopdedo.org> + * * @param string $str UTF-8 encoded string * @param boolean $entities Flag controlling decoding of named entities. * @return string UTF-8 encoded string with numeric (and named) entities replaced. @@ -564,7 +611,7 @@ if(!function_exists('utf8_decode_numeric')){ * Decodes numeric HTML entities to their correct UTF-8 characters * * @param $ent string A numeric entity - * @return string + * @return string|false */ function utf8_decode_numeric($ent) { switch ($ent[2]) { @@ -597,10 +644,10 @@ if(!class_exists('utf8_entity_decoder')){ } /** - * Wrapper aorund unicode_to_utf8() + * Wrapper around unicode_to_utf8() * - * @param $c string - * @return mixed + * @param string $c + * @return string|false */ function makeutf8($c) { return unicode_to_utf8(array(ord($c))); @@ -609,8 +656,8 @@ if(!class_exists('utf8_entity_decoder')){ /** * Decodes any HTML entity to it's correct UTF-8 char equivalent * - * @param $ent string An entity - * @return string + * @param string $ent An entity + * @return string|false */ function decode($ent) { if ($ent[1] == '#') { @@ -640,12 +687,13 @@ if(!function_exists('utf8_to_unicode')){ * * @author <hsivonen@iki.fi> * @author Harry Fuecks <hfuecks@gmail.com> - * @param string $str UTF-8 encoded string - * @param boolean $strict Check for invalid sequences? - * @return mixed array of unicode code points or false if UTF-8 invalid * @see unicode_to_utf8 * @link http://hsivonen.iki.fi/php-utf8/ * @link http://sourceforge.net/projects/phputf8/ + * + * @param string $str UTF-8 encoded string + * @param boolean $strict Check for invalid sequences? + * @return mixed array of unicode code points or false if UTF-8 invalid */ function utf8_to_unicode($str,$strict=false) { $mState = 0; // cached expected number of octets after the current octet @@ -815,7 +863,8 @@ if(!function_exists('unicode_to_utf8')){ * * @param array $arr of unicode code points representing a string * @param boolean $strict Check for invalid sequences? - * @return mixed UTF-8 string or false if array contains invalid code points + * @return string|false UTF-8 string or false if array contains invalid code points + * * @author <hsivonen@iki.fi> * @author Harry Fuecks <hfuecks@gmail.com> * @see utf8_to_unicode @@ -896,6 +945,10 @@ if(!function_exists('utf8_to_utf16be')){ * UTF-8 to UTF-16BE conversion. * * Maybe really UCS-2 without mb_string due to utf8_to_unicode limits + * + * @param string $str + * @param bool $bom + * @return string */ function utf8_to_utf16be(&$str, $bom = false) { $out = $bom ? "\xFE\xFF" : ''; @@ -914,6 +967,9 @@ if(!function_exists('utf16be_to_utf8')){ * UTF-8 to UTF-16BE conversion. * * Maybe really UCS-2 without mb_string due to utf8_to_unicode limits + * + * @param string $str + * @return false|string */ function utf16be_to_utf8(&$str) { $uni = unpack('n*',$str); @@ -933,6 +989,7 @@ if(!function_exists('utf8_bad_replace')){ * * @author Harry Fuecks <hfuecks@gmail.com> * @see http://www.w3.org/International/questions/qa-forms-utf-8 + * * @param string $str to search * @param string $replace to replace bad bytes with (defaults to '?') - use ASCII * @return string @@ -967,8 +1024,8 @@ if(!function_exists('utf8_correctIdx')){ /** * adjust a byte index into a utf8 string to a utf8 character boundary * - * @param $str string utf8 character string - * @param $i int byte index into $str + * @param string $str utf8 character string + * @param int $i byte index into $str * @param $next bool direction to search for boundary, * false = up (current character) * true = down (next character) diff --git a/install.php b/install.php index d13a5eaab..d031cb3d9 100644 --- a/install.php +++ b/install.php @@ -159,6 +159,8 @@ header('Content-Type: text/html; charset=utf-8'); /** * Print the input form + * + * @param array $d submitted entry 'd' of request data */ function print_form($d){ global $lang; @@ -264,6 +266,9 @@ function print_retry() { * Check validity of data * * @author Andreas Gohr + * + * @param array $d + * @return bool ok? */ function check_data(&$d){ static $form_default = array( @@ -333,6 +338,9 @@ function check_data(&$d){ * Writes the data to the config files * * @author Chris Smith <chris@jalakai.co.uk> + * + * @param array $d + * @return bool */ function store_data($d){ global $LC; @@ -437,6 +445,10 @@ EOT; * Write the given content to a file * * @author Chris Smith <chris@jalakai.co.uk> + * + * @param string $filename + * @param string $data + * @return bool */ function fileWrite($filename, $data) { global $error; @@ -459,6 +471,8 @@ function fileWrite($filename, $data) { * unmodified main config file * * @author Chris Smith <chris@jalakai.co.uk> + * + * @return bool */ function check_configs(){ global $error; @@ -497,6 +511,8 @@ function check_configs(){ * Check other installation dir/file permission requirements * * @author Chris Smith <chris@jalakai.co.uk> + * + * @return bool */ function check_permissions(){ global $error; @@ -532,6 +548,8 @@ function check_permissions(){ * Check the availability of functions used in DokuWiki and the PHP version * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return bool */ function check_functions(){ global $error; @@ -625,6 +643,8 @@ function print_errors(){ * remove magic quotes recursivly * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $array */ function remove_magic_quotes(&$array) { foreach (array_keys($array) as $key) { diff --git a/lib/exe/css.php b/lib/exe/css.php index f7235fd4e..b1065f518 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -52,7 +52,7 @@ function css_out(){ // if old 'default' userstyle setting exists, make it 'screen' userstyle for backwards compatibility if (isset($config_cascade['userstyle']['default'])) { - $config_cascade['userstyle']['screen'] = $config_cascade['userstyle']['default']; + $config_cascade['userstyle']['screen'] = array($config_cascade['userstyle']['default']); } // cache influencers @@ -82,8 +82,10 @@ function css_out(){ $files[$mediatype] = array_merge($files[$mediatype], $styleini['stylesheets'][$mediatype]); } // load user styles - if(isset($config_cascade['userstyle'][$mediatype])){ - $files[$mediatype][$config_cascade['userstyle'][$mediatype]] = DOKU_BASE; + if(!empty($config_cascade['userstyle'][$mediatype])) { + foreach($config_cascade['userstyle'][$mediatype] as $userstyle) { + $files[$mediatype][$userstyle] = DOKU_BASE; + } } $cache_files = array_merge($cache_files, array_keys($files[$mediatype])); @@ -162,7 +164,7 @@ function css_out(){ * most of this function is error handling to show a nice useful error when * LESS compilation fails * - * @param $css + * @param string $css * @return string */ function css_parseless($css) { @@ -225,6 +227,10 @@ function css_parseless($css) { * (sans the surrounding __ and with a ini_ prefix) * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $css + * @param array $replacements array(placeholder => value) + * @return string */ function css_applystyle($css, $replacements) { // we convert ini replacements to LESS variable names @@ -253,6 +259,7 @@ function css_applystyle($css, $replacements) { * the stylesheet modes * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $tpl the used template * @return array with keys 'stylesheets' and 'replacements' */ @@ -323,6 +330,10 @@ function css_styleini($tpl) { * Amend paths used in replacement relative urls, refer FS#2879 * * @author Chris Smith <chris@jalakai.co.uk> + * + * @param array $replacements with key-value pairs + * @param string $location + * @return array */ function css_fixreplacementurls($replacements, $location) { foreach($replacements as $key => $value) { @@ -406,6 +417,10 @@ function css_filetypes(){ /** * Loads a given file and fixes relative URLs with the * given location prefix + * + * @param string $file file system path + * @param string $location + * @return string */ function css_loadfile($file,$location=''){ $css_file = new DokuCssFile($file); @@ -421,7 +436,7 @@ class DokuCssFile { protected $filepath; // file system path to the CSS/Less file protected $location; // base url location of the CSS/Less file - private $relative_path = null; + protected $relative_path = null; public function __construct($file) { $this->filepath = $file; @@ -454,7 +469,7 @@ class DokuCssFile { * * @return string relative file system path */ - private function getRelativePath(){ + protected function getRelativePath(){ if (is_null($this->relative_path)) { $basedir = array(DOKU_INC); @@ -504,6 +519,9 @@ class DokuCssFile { * Convert local image URLs to data URLs if the filesize is small * * Callback for preg_replace_callback + * + * @param array $match + * @return string */ function css_datauri($match){ global $conf; @@ -531,9 +549,11 @@ function css_datauri($match){ * Returns a list of possible Plugin Styles (no existance check here) * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $mediatype + * @return array */ function css_pluginstyles($mediatype='screen'){ - global $lang; $list = array(); $plugins = plugin_list(); foreach ($plugins as $p){ @@ -552,6 +572,9 @@ function css_pluginstyles($mediatype='screen'){ * Very simple CSS optimizer * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $css + * @return string */ function css_compress($css){ //strip comments through a callback @@ -588,6 +611,9 @@ function css_compress($css){ * Keeps short comments (< 5 chars) to maintain typical browser hacks * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $matches + * @return string */ function css_comment_cb($matches){ if(strlen($matches[2]) > 4) return ''; @@ -599,7 +625,7 @@ function css_comment_cb($matches){ * * Strips one line comments but makes sure it will not destroy url() constructs with slashes * - * @param $matches + * @param array $matches * @return string */ function css_onelinecomment_cb($matches) { diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 3ab117736..89c4b7cd0 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -51,8 +51,9 @@ exit; /** * Trims the recent changes cache (or imports the old changelog) as needed. * - * @param media_changes If the media changelog shall be trimmed instead of - * the page changelog + * @param bool $media_changes If the media changelog shall be trimmed instead of + * the page changelog + * @return bool * * @author Ben Coburn <btcoburn@silicodon.net> */ @@ -83,7 +84,7 @@ function runTrimRecentChanges($media_changes = false) { io_saveFile($fn.'_tmp', ''); // presave tmp as 2nd lock $trim_time = time() - $conf['recent_days']*86400; $out_lines = array(); - + $old_lines = array(); for ($i=0; $i<count($lines); $i++) { $log = parseChangelogLine($lines[$i]); if ($log === false) continue; // discard junk diff --git a/lib/exe/js.php b/lib/exe/js.php index 545ba7b23..793104e81 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -72,8 +72,10 @@ function js_out(){ // add possible plugin scripts and userscript $files = array_merge($files,js_pluginscripts()); - if(isset($config_cascade['userscript']['default'])){ - $files[] = $config_cascade['userscript']['default']; + if(!empty($config_cascade['userscript']['default'])) { + foreach($config_cascade['userscript']['default'] as $userscript) { + $files[] = $userscript; + } } $cache_files = array_merge($files, getConfigFiles('main')); @@ -154,6 +156,8 @@ function js_out(){ * Load the given file, handle include calls and print it * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename path to file */ function js_load($file){ if(!@file_exists($file)) return; @@ -189,6 +193,8 @@ function js_load($file){ * Returns a list of possible Plugin Scripts (no existance check here) * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return array */ function js_pluginscripts(){ $list = array(); @@ -206,6 +212,8 @@ function js_pluginscripts(){ * - Nothing is returned for plugins without an entry for $lang['js'] * * @author Gabriel Birke <birke@d-scribe.de> + * + * @return array */ function js_pluginstrings() { global $conf; @@ -231,6 +239,8 @@ function js_pluginstrings() { * * - $lang['js'] must be an array. * - Nothing is returned for template without an entry for $lang['js'] + * + * @return array */ function js_templatestrings() { global $conf; @@ -252,6 +262,9 @@ function js_templatestrings() { * as newline * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $string + * @return string */ function js_escape($string){ return str_replace('\\\\n','\\n',addslashes($string)); @@ -261,6 +274,8 @@ function js_escape($string){ * Adds the given JavaScript code to the window.onload() event * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $func */ function js_runonstart($func){ echo "jQuery(function(){ $func; });".NL; @@ -275,6 +290,9 @@ function js_runonstart($func){ * @author Nick Galbreath <nickg@modp.com> * @author Andreas Gohr <andi@splitbrain.org> * @link http://code.google.com/p/jsstrip/ + * + * @param string $s + * @return string */ function js_compress($s){ $s = ltrim($s); // strip all initial whitespace diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index c09daa17c..61a68281f 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -23,6 +23,11 @@ class dokuwiki_xmlrpc_server extends IXR_Server { $this->IXR_Server(); } + /** + * @param string $methodname + * @param array $args + * @return IXR_Error|mixed + */ function call($methodname, $args){ try { $result = $this->remote->call($methodname, $args); @@ -40,10 +45,18 @@ class dokuwiki_xmlrpc_server extends IXR_Server { } } + /** + * @param string|int $data iso date(yyyy[-]mm[-]dd[ hh:mm[:ss]]) or timestamp + * @return IXR_Date + */ function toDate($data) { return new IXR_Date($data); } + /** + * @param string $data + * @return IXR_Base64 + */ function toFile($data) { return new IXR_Base64($data); } diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php index ebb097a04..814bbfe9c 100644 --- a/lib/plugins/acl/admin.php +++ b/lib/plugins/acl/admin.php @@ -762,6 +762,8 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { */ function _html_select(){ $inlist = false; + $usel = ''; + $gsel = ''; if($this->who && !in_array($this->who,$this->usersgroups) && @@ -770,11 +772,9 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { if($this->who{0} == '@'){ $gsel = ' selected="selected"'; }else{ - $usel = ' selected="selected"'; + $usel = ' selected="selected"'; } }else{ - $usel = ''; - $gsel = ''; $inlist = true; } diff --git a/lib/plugins/acl/remote.php b/lib/plugins/acl/remote.php index 6d5201cf6..b10c544ee 100644 --- a/lib/plugins/acl/remote.php +++ b/lib/plugins/acl/remote.php @@ -1,7 +1,16 @@ <?php +/** + * Class remote_plugin_acl + */ class remote_plugin_acl extends DokuWiki_Remote_Plugin { - function _getMethods() { + + /** + * Returns details about the remote plugin methods + * + * @return array + */ + public function _getMethods() { return array( 'addAcl' => array( 'args' => array('string','string','int'), @@ -17,12 +26,29 @@ class remote_plugin_acl extends DokuWiki_Remote_Plugin { ); } - function addAcl($scope, $user, $level){ + /** + * Add a new entry to ACL config + * + * @param string $scope + * @param string $user + * @param int $level see also inc/auth.php + * @return bool + */ + public function addAcl($scope, $user, $level){ + /** @var admin_plugin_acl $apa */ $apa = plugin_load('admin', 'acl'); return $apa->_acl_add($scope, $user, $level); } - function delAcl($scope, $user){ + /** + * Remove an entry from ACL config + * + * @param string $scope + * @param string $user + * @return bool + */ + public function delAcl($scope, $user){ + /** @var admin_plugin_acl $apa */ $apa = plugin_load('admin', 'acl'); return $apa->_acl_del($scope, $user); } diff --git a/lib/plugins/admin.php b/lib/plugins/admin.php index 9a1fb9fdc..39dece453 100644 --- a/lib/plugins/admin.php +++ b/lib/plugins/admin.php @@ -14,7 +14,14 @@ if(!defined('DOKU_INC')) die(); */ class DokuWiki_Admin_Plugin extends DokuWiki_Plugin { - function getMenuText($language) { + /** + * Return the text that is displayed at the main admin menu + * (Default localized language string 'menu' is returned, override this function for setting another name) + * + * @param string $language language code + * @return string menu string + */ + public function getMenuText($language) { $menutext = $this->getLang('menu'); if (!$menutext) { $info = $this->getInfo(); @@ -23,23 +30,48 @@ class DokuWiki_Admin_Plugin extends DokuWiki_Plugin { return $menutext; } - function getMenuSort() { + /** + * Determine position in list in admin window + * Lower values are sorted up + * + * @return int + */ + public function getMenuSort() { return 1000; } - function handle() { + /** + * Carry out required processing + */ + public function handle() { trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING); } - function html() { + /** + * Output html of the admin page + */ + public function html() { trigger_error('html() not implemented in '.get_class($this), E_USER_WARNING); } - function forAdminOnly() { + /** + * Return true for access only by admins (config:superuser) or false if managers are allowed as well + * + * @return bool + */ + public function forAdminOnly() { return true; } - function getTOC(){ + /** + * Return array with ToC items. Items can be created with the html_mktocitem() + * + * @see html_mktocitem() + * @see tpl_toc() + * + * @return array + */ + public function getTOC(){ return array(); } } diff --git a/lib/plugins/auth.php b/lib/plugins/auth.php index 02e0613dd..4799b3a38 100644 --- a/lib/plugins/auth.php +++ b/lib/plugins/auth.php @@ -116,7 +116,7 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { * @author Gabriel Birke <birke@d-scribe.de> * @param string $type Modification type ('create', 'modify', 'delete') * @param array $params Parameters for the createUser, modifyUser or deleteUsers method. The content of this array depends on the modification type - * @return mixed Result from the modification function or false if an event handler has canceled the action + * @return bool|null|int Result from the modification function or false if an event handler has canceled the action */ public function triggerUserMod($type, $params) { $validTypes = array( @@ -124,8 +124,11 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { 'modify' => 'modifyUser', 'delete' => 'deleteUsers' ); - if(empty($validTypes[$type])) + if(empty($validTypes[$type])) { return false; + } + + $result = false; $eventdata = array('type' => $type, 'params' => $params, 'modification_result' => null); $evt = new Doku_Event('AUTH_USER_CHANGE', $eventdata); if($evt->advise_before(true)) { @@ -235,7 +238,7 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { * @author Andreas Gohr <andi@splitbrain.org> * @param string $user the user name * @param bool $requireGroups whether or not the returned data must include groups - * @return array containing user data or false + * @return false|array containing user data or false */ public function getUserData($user, $requireGroups=true) { if(!$this->cando['external']) msg("no valid authorisation system in use", -1); diff --git a/lib/plugins/authad/adLDAP/adLDAP.php b/lib/plugins/authad/adLDAP/adLDAP.php index c1f92abe2..5563e4fe9 100644 --- a/lib/plugins/authad/adLDAP/adLDAP.php +++ b/lib/plugins/authad/adLDAP/adLDAP.php @@ -947,5 +947,3 @@ class adLDAP { * } */ class adLDAPException extends Exception {} - -?>
\ No newline at end of file diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php index a3119dda6..88b56046c 100644 --- a/lib/plugins/authad/auth.php +++ b/lib/plugins/authad/auth.php @@ -203,6 +203,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { } //general user info + $info = array(); $info['name'] = $result[0]['displayname'][0]; $info['mail'] = $result[0]['mail'][0]; $info['uid'] = $result[0]['samaccountname'][0]; @@ -328,6 +329,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { * Bulk retrieval of user data * * @author Dominik Eckelmann <dokuwiki@cosmocode.de> + * * @param int $start index of first user to be returned * @param int $limit max number of users to be returned * @param array $filter array of field/pattern pairs, null for no filter @@ -446,7 +448,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { /** * Get the domain part from a user * - * @param $user + * @param string $user * @return string */ public function _userDomain($user) { @@ -457,7 +459,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { /** * Get the user part from a user * - * @param $user + * @param string $user * @return string */ public function _userName($user) { @@ -543,6 +545,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { * The patterns are set up with $this->_constructPattern() * * @author Chris Smith <chris@jalakai.co.uk> + * * @param string $user * @param array $info * @return bool @@ -564,6 +567,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { * Create a pattern for $this->_filter() * * @author Chris Smith <chris@jalakai.co.uk> + * * @param array $filter */ protected function _constructPattern($filter) { diff --git a/lib/plugins/authad/lang/fa/settings.php b/lib/plugins/authad/lang/fa/settings.php new file mode 100644 index 000000000..161479afb --- /dev/null +++ b/lib/plugins/authad/lang/fa/settings.php @@ -0,0 +1,10 @@ +<?php + +/** + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * + * @author Omid Hezaveh <hezpublic@gmail.com> + */ +$lang['admin_password'] = 'رمز کاربر بالایی '; +$lang['use_ssl'] = 'از اساسال استفاده میکنید؟ در این صورت تیالاس را در پایین فعال نکنید. '; +$lang['use_tls'] = 'از تیالاس استفاده میکنید؟ در این صورت اساسال را در بالا فعال نکنید. '; diff --git a/lib/plugins/authad/lang/no/lang.php b/lib/plugins/authad/lang/no/lang.php new file mode 100644 index 000000000..a1c9c7e8a --- /dev/null +++ b/lib/plugins/authad/lang/no/lang.php @@ -0,0 +1,8 @@ +<?php + +/** + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * + * @author Patrick <spill.p@hotmail.com> + */ +$lang['domain'] = 'Loggpå-domene'; diff --git a/lib/plugins/authad/lang/no/settings.php b/lib/plugins/authad/lang/no/settings.php index bab5ce67d..f309ead50 100644 --- a/lib/plugins/authad/lang/no/settings.php +++ b/lib/plugins/authad/lang/no/settings.php @@ -4,6 +4,8 @@ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * * @author Christopher Schive <chschive@frisurf.no> + * @author Patrick <spill.p@hotmail.com> */ +$lang['account_suffix'] = 'Ditt konto-suffiks F. Eks. <code>@my.domain.org</code>'; $lang['admin_password'] = 'Passordet til brukeren over.'; $lang['expirywarn'] = 'Antall dager på forhånd brukeren varsles om at passordet utgår. 0 for å deaktivere.'; diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php index b22b82ecc..fd4729331 100644 --- a/lib/plugins/authldap/auth.php +++ b/lib/plugins/authldap/auth.php @@ -181,6 +181,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { } } + $info = array(); $info['user'] = $user; $info['server'] = $this->getConf('server'); @@ -564,15 +565,13 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { * Wraps around ldap_search, ldap_list or ldap_read depending on $scope * * @author Andreas Gohr <andi@splitbrain.org> - * @param resource $link_identifier - * @param string $base_dn - * @param string $filter - * @param string $scope can be 'base', 'one' or 'sub' - * @param null $attributes - * @param int $attrsonly - * @param int $sizelimit - * @param int $timelimit - * @param int $deref + * @param resource $link_identifier + * @param string $base_dn + * @param string $filter + * @param string $scope can be 'base', 'one' or 'sub' + * @param null|array $attributes + * @param int $attrsonly + * @param int $sizelimit * @return resource */ protected function _ldapsearch($link_identifier, $base_dn, $filter, $scope = 'sub', $attributes = null, diff --git a/lib/plugins/authldap/lang/fa/settings.php b/lib/plugins/authldap/lang/fa/settings.php new file mode 100644 index 000000000..49d485afd --- /dev/null +++ b/lib/plugins/authldap/lang/fa/settings.php @@ -0,0 +1,10 @@ +<?php + +/** + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * + * @author Mohammad Sadegh <msdn2013@gmail.com> + * @author Omid Hezaveh <hezpublic@gmail.com> + */ +$lang['starttls'] = 'از تیالاس (TLS) استفاده میکنید؟'; +$lang['bindpw'] = 'رمزعبور کاربر بالا'; diff --git a/lib/plugins/authldap/lang/no/settings.php b/lib/plugins/authldap/lang/no/settings.php index 6bedb2991..61671ed46 100644 --- a/lib/plugins/authldap/lang/no/settings.php +++ b/lib/plugins/authldap/lang/no/settings.php @@ -4,6 +4,8 @@ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * * @author Christopher Schive <chschive@frisurf.no> + * @author Patrick <spill.p@hotmail.com> */ $lang['port'] = 'LDAP serverport dersom ingen full URL var gitt over.'; $lang['starttls'] = 'Bruke TLS-forbindelser?'; +$lang['bindpw'] = 'Passord til brukeren over'; diff --git a/lib/plugins/authmysql/auth.php b/lib/plugins/authmysql/auth.php index 95c62f636..0d423b6c9 100644 --- a/lib/plugins/authmysql/auth.php +++ b/lib/plugins/authmysql/auth.php @@ -115,7 +115,8 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { * Check if the given config strings are set * * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> - * @param array $keys + * + * @param string[] $keys * @param bool $wop is this a check for a write operation? * @return bool */ @@ -284,7 +285,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { $grpdel = array_diff($groups, $changes['grps']); foreach($grpadd as $group) { - if(($this->_addUserToGroup($user, $group, 1)) == false) { + if(($this->_addUserToGroup($user, $group, true)) == false) { $rc = false; } } @@ -366,7 +367,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { * * @param int $first index of first user to be returned * @param int $limit max number of users to be returned - * @param array|string $filter array of field/pattern pairs + * @param array $filter array of field/pattern pairs * @return array userinfo (refer getUserData for internal userinfo details) */ public function retrieveUsers($first = 0, $limit = 0, $filter = array()) { @@ -612,7 +613,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { if($uid) { foreach($grps as $group) { - $gid = $this->_addUserToGroup($user, $group, 1); + $gid = $this->_addUserToGroup($user, $group, true); if($gid === false) break; } @@ -668,7 +669,6 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { * * @param string $user username of the user whose data is to be removed from the cache * if null, empty the whole cache - * @return none */ protected function _flushUserInfoCache($user=null) { if (is_null($user)) { @@ -750,7 +750,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> * * @param string $user user's nick to get data for - * @return bool|array false on error, user info on success + * @return false|array false on error, user info on success */ protected function _retrieveUserInfo($user) { $sql = str_replace('%{user}', $this->_escape($user), $this->getConf('getUserInfo')); @@ -777,7 +777,6 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { * * @param string $user user's nick being updated * @param array $changes array of items to change as pairs of item and value - * @param mixed $uid user id of dataset to change, must be unique in DB * @return bool true on success or false on error * * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> @@ -838,7 +837,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> * * @param string $group group name which id is desired - * @return mixed group id + * @return false|string group id */ protected function _getGroupID($group) { if($this->dbcon) { @@ -911,7 +910,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> * * @param string $query SQL string that contains the query - * @return array with the result table + * @return array|false with the result table */ protected function _queryDB($query) { if($this->getConf('debug') >= 2) { @@ -1002,6 +1001,8 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { * abrogated. * * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> + * + * @return bool */ protected function _unlockTables() { if($this->dbcon) { diff --git a/lib/plugins/authmysql/lang/da/settings.php b/lib/plugins/authmysql/lang/da/settings.php index 1e38cb6b4..ed21201fb 100644 --- a/lib/plugins/authmysql/lang/da/settings.php +++ b/lib/plugins/authmysql/lang/da/settings.php @@ -2,7 +2,7 @@ /** * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) - * + * * @author Jens Hyllegaard <jens.hyllegaard@gmail.com> * @author soer9648 <soer9648@eucl.dk> */ @@ -11,6 +11,7 @@ $lang['user'] = 'MySQL brugernavn'; $lang['password'] = 'Kodeord til ovenstående bruger'; $lang['database'] = 'Database der skal benyttes'; $lang['charset'] = 'Tegnsæt benyttet i database'; +$lang['debug'] = 'Vis yderligere debug output'; $lang['checkPass'] = 'SQL-sætning til at kontrollere kodeord'; $lang['getUserInfo'] = 'SQL-sætning til at hente brugerinformation'; $lang['getUsers'] = 'SQL-sætning til at liste alle brugere'; @@ -21,7 +22,6 @@ $lang['delGroup'] = 'SQL-sætning til at fjerne en gruppe'; $lang['delUser'] = 'SQL-sætning til at slette en bruger'; $lang['delUserRefs'] = 'SQL-sætning til at fjerne en bruger fra alle grupper'; $lang['updateUser'] = 'SQL-sætning til at opdatere en brugerprofil'; -$lang['debug'] = 'Vis yderligere debug output'; $lang['debug_o_0'] = 'ingen'; $lang['debug_o_1'] = 'kun ved fejl'; $lang['debug_o_2'] = 'alle SQL forespørgsler'; diff --git a/lib/plugins/authmysql/lang/no/settings.php b/lib/plugins/authmysql/lang/no/settings.php new file mode 100644 index 000000000..45ab09819 --- /dev/null +++ b/lib/plugins/authmysql/lang/no/settings.php @@ -0,0 +1,14 @@ +<?php + +/** + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * + * @author Patrick <spill.p@hotmail.com> + */ +$lang['server'] = 'Din MySQL-server'; +$lang['user'] = 'Ditt MySQL-brukernavn'; +$lang['password'] = 'Passord til brukeren'; +$lang['database'] = 'Database som skal brukes'; +$lang['debug_o_0'] = 'ingen'; +$lang['debug_o_1'] = 'bare ved feil'; +$lang['debug_o_2'] = 'alle SQL-forespørsler'; diff --git a/lib/plugins/authpgsql/auth.php b/lib/plugins/authpgsql/auth.php index de41598e0..4cb280aae 100644 --- a/lib/plugins/authpgsql/auth.php +++ b/lib/plugins/authpgsql/auth.php @@ -104,7 +104,7 @@ class auth_plugin_authpgsql extends auth_plugin_authmysql { * * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> * - * @param array $keys + * @param string[] $keys * @param bool $wop * @return bool */ @@ -267,7 +267,7 @@ class auth_plugin_authpgsql extends auth_plugin_authmysql { if($uid) { foreach($grps as $group) { - $gid = $this->_addUserToGroup($user, $group, 1); + $gid = $this->_addUserToGroup($user, $group, true); if($gid === false) break; } @@ -342,7 +342,7 @@ class auth_plugin_authpgsql extends auth_plugin_authmysql { * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> * * @param string $query SQL string that contains the query - * @return array the result table + * @return array|false the result table */ protected function _queryDB($query) { $resultarray = array(); @@ -365,6 +365,9 @@ class auth_plugin_authpgsql extends auth_plugin_authmysql { * MySQL one because it does NOT return the last insertID * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $query + * @return bool */ protected function _modifyDB($query) { if($this->dbcon) { @@ -398,6 +401,8 @@ class auth_plugin_authpgsql extends auth_plugin_authmysql { * Commit a transaction * * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> + * + * @return bool */ protected function _unlockTables() { if($this->dbcon) { diff --git a/lib/plugins/authpgsql/lang/it/settings.php b/lib/plugins/authpgsql/lang/it/settings.php index baf40a468..e8a40dcb2 100644 --- a/lib/plugins/authpgsql/lang/it/settings.php +++ b/lib/plugins/authpgsql/lang/it/settings.php @@ -4,8 +4,10 @@ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * * @author Francesco <francesco.cavalli@hotmail.com> + * @author Torpedo <dgtorpedo@gmail.com> */ $lang['server'] = 'Il tuo server PostgreSQL '; $lang['port'] = 'La porta del tuo server PostgreSQL '; $lang['user'] = 'Lo username PostgreSQL'; $lang['database'] = 'Database da usare'; +$lang['getUsers'] = 'Dichiarazione SQL per elencare tutti gli utenti'; diff --git a/lib/plugins/authplain/_test/escaping.test.php b/lib/plugins/authplain/_test/escaping.test.php index cbfbbc587..9df96389a 100644 --- a/lib/plugins/authplain/_test/escaping.test.php +++ b/lib/plugins/authplain/_test/escaping.test.php @@ -12,10 +12,11 @@ * @group plugins */ class helper_plugin_authplain_escaping_test extends DokuWikiTest { - + protected $pluginsEnabled = array('authplainharness'); + /** @var auth_plugin_authplain|auth_plugin_authplainharness */ protected $auth; - + protected function reloadUsers() { /* auth caches data loaded from file, but recreated object forces reload */ $this->auth = new auth_plugin_authplainharness(); @@ -116,4 +117,4 @@ class auth_plugin_authplainharness extends auth_plugin_authplain { public function splitUserData($line){ return $this->_splitUserData($line); } -}
\ No newline at end of file +} diff --git a/lib/plugins/authplain/auth.php b/lib/plugins/authplain/auth.php index 3d303597c..fd2d0b249 100644 --- a/lib/plugins/authplain/auth.php +++ b/lib/plugins/authplain/auth.php @@ -82,7 +82,7 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin { * @author Andreas Gohr <andi@splitbrain.org> * @param string $user * @param bool $requireGroups (optional) ignored by this plugin, grps info always supplied - * @return array|bool + * @return array|false */ public function getUserData($user, $requireGroups=true) { if($this->users === null) $this->_loadUserData(); diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php index 835d27775..9202a221b 100644 --- a/lib/plugins/config/admin.php +++ b/lib/plugins/config/admin.php @@ -32,6 +32,9 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { var $_session_started = false; var $_localised_prompts = false; + /** + * @return int + */ function getMenuSort() { return 100; } /** @@ -40,14 +43,20 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { function handle() { global $ID, $INPUT; - if (!$this->_restore_session()) return $this->_close_session(); - if ($INPUT->int('save') != 1) return $this->_close_session(); - if (!checkSecurityToken()) return $this->_close_session(); + if(!$this->_restore_session() || $INPUT->int('save') != 1 || !checkSecurityToken()) { + $this->_close_session(); + return; + } - if (is_null($this->_config)) { $this->_config = new configuration($this->_file); } + if(is_null($this->_config)) { + $this->_config = new configuration($this->_file); + } // don't go any further if the configuration is locked - if ($this->_config->_locked) return $this->_close_session(); + if($this->_config->locked) { + $this->_close_session(); + return; + } $this->_input = $INPUT->arr('config'); @@ -104,6 +113,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { formSecurityToken(); $this->_print_h1('dokuwiki_settings', $this->getLang('_header_dokuwiki')); + /** @var setting[] $undefined_settings */ $undefined_settings = array(); $in_fieldset = false; $first_plugin_fieldset = true; @@ -162,7 +172,17 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { // show undefined settings list if ($allow_debug && !empty($undefined_settings)) { - function _setting_natural_comparison($a, $b) { return strnatcmp($a->_key, $b->_key); } + /** + * Callback for sorting settings + * + * @param setting $a + * @param setting $b + * @return int if $a is lower/equal/higher than $b + */ + function _setting_natural_comparison($a, $b) { + return strnatcmp($a->_key, $b->_key); + } + usort($undefined_settings, '_setting_natural_comparison'); $this->_print_h1('undefined_settings', $this->getLang('_header_undefined')); ptln('<fieldset>'); @@ -235,6 +255,9 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { if ($this->_session_started) session_write_close(); } + /** + * @param bool $prompts + */ function setupLocale($prompts=false) { parent::setupLocale(); @@ -245,6 +268,9 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { } + /** + * @return bool + */ function _setup_localised_plugin_prompts() { global $conf; @@ -299,6 +325,8 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { * Generates a two-level table of contents for the config plugin. * * @author Ben Coburn <btcoburn@silicodon.net> + * + * @return array */ function getTOC() { if (is_null($this->_config)) { $this->_config = new configuration($this->_file); } @@ -328,6 +356,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { $t[] = html_mktocitem('configuration_manager', $this->getLang('_configuration_manager'), 1); $t[] = html_mktocitem('dokuwiki_settings', $this->getLang('_header_dokuwiki'), 1); + /** @var setting $setting */ foreach($toc['conf'] as $setting) { $name = $setting->prompt($this); $t[] = html_mktocitem($setting->_key, $name, 2); @@ -352,6 +381,10 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { return $t; } + /** + * @param string $id + * @param string $text + */ function _print_h1($id, $text) { ptln('<h1 id="'.$id.'">'.$text.'</h1>'); } diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 8dae23110..590631dae 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -10,7 +10,9 @@ if(!defined('CM_KEYMARKER')) define('CM_KEYMARKER','____'); if (!class_exists('configuration')) { - + /** + * Class configuration + */ class configuration { var $_name = 'conf'; // name of the config variable found in the files (overridden by $config['varname']) @@ -151,6 +153,8 @@ if (!class_exists('configuration')) { /** * Update last modified time stamp of the config file + * + * @return bool */ public function touch_settings(){ if ($this->locked) return false; @@ -285,6 +289,10 @@ if (!class_exists('configuration')) { /** * not used ... conf's contents are an array! * reduce any multidimensional settings to one dimension using CM_KEYMARKER + * + * @param $conf + * @param string $prefix + * @return array */ protected function _flatten($conf,$prefix='') { @@ -403,6 +411,9 @@ if (!class_exists('configuration')) { } if (!class_exists('setting')) { + /** + * Class setting + */ class setting { var $_key = ''; @@ -452,7 +463,7 @@ if (!class_exists('setting')) { * - if changed value passes error check, set $this->_local to the new value * * @param mixed $input the new value - * @return boolean true if changed, false otherwise (incl. on error) + * @return boolean true if changed, false otherwise (also on error) */ public function update($input) { if (is_null($input)) return false; @@ -476,10 +487,9 @@ if (!class_exists('setting')) { * * @param DokuWiki_Plugin $plugin object of config plugin * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting - * @return array(string $label_html, string $input_html) + * @return array with content array(string $label_html, string $input_html) */ public function html(&$plugin, $echo=false) { - $value = ''; $disable = ''; if ($this->is_protected()) { @@ -503,6 +513,10 @@ if (!class_exists('setting')) { /** * Generate string to save setting value to file according to $fmt + * + * @param string $var name of variable + * @param string $fmt save format + * @return string */ public function out($var, $fmt='php') { @@ -556,7 +570,7 @@ if (!class_exists('setting')) { /** * Returns caution * - * @return bool|string caution string, otherwise false for invalid caution + * @return false|string caution string, otherwise false for invalid caution */ public function caution() { if (!empty($this->_caution)) { @@ -603,12 +617,15 @@ if (!class_exists('setting')) { if (!class_exists('setting_array')) { + /** + * Class setting_array + */ class setting_array extends setting { /** * Create an array from a string * - * @param $string + * @param string $string * @return array */ protected function _from_string($string){ @@ -622,7 +639,7 @@ if (!class_exists('setting_array')) { /** * Create a string from an array * - * @param $array + * @param array $array * @return string */ protected function _from_array($array){ @@ -657,13 +674,23 @@ if (!class_exists('setting_array')) { return true; } + /** + * Escaping + * + * @param string $string + * @return string + */ protected function _escape($string) { $tr = array("\\" => '\\\\', "'" => '\\\''); return "'".strtr( cleanText($string), $tr)."'"; } /** - * generate string to save setting value to file according to $fmt + * Generate string to save setting value to file according to $fmt + * + * @param string $var name of variable + * @param string $fmt save format + * @return string */ function out($var, $fmt='php') { @@ -680,8 +707,14 @@ if (!class_exists('setting_array')) { return $out; } + /** + * Build html for label and input of setting + * + * @param DokuWiki_Plugin $plugin object of config plugin + * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting + * @return array with content array(string $label_html, string $input_html) + */ function html(&$plugin, $echo=false) { - $value = ''; $disable = ''; if ($this->is_protected()) { @@ -706,9 +739,18 @@ if (!class_exists('setting_array')) { } if (!class_exists('setting_string')) { + /** + * Class setting_string + */ class setting_string extends setting { + /** + * Build html for label and input of setting + * + * @param DokuWiki_Plugin $plugin object of config plugin + * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting + * @return array with content array(string $label_html, string $input_html) + */ function html(&$plugin, $echo=false) { - $value = ''; $disable = ''; if ($this->is_protected()) { @@ -733,10 +775,21 @@ if (!class_exists('setting_string')) { } if (!class_exists('setting_password')) { + /** + * Class setting_password + */ class setting_password extends setting_string { var $_code = 'plain'; // mechanism to be used to obscure passwords + /** + * update changed setting with user provided value $input + * - if changed value fails error check, save it to $this->_input (to allow echoing later) + * - if changed value passes error check, set $this->_local to the new value + * + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (also on error) + */ function update($input) { if ($this->is_protected()) return false; if (!$input) return false; @@ -751,9 +804,15 @@ if (!class_exists('setting_password')) { return true; } + /** + * Build html for label and input of setting + * + * @param DokuWiki_Plugin $plugin object of config plugin + * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting + * @return array with content array(string $label_html, string $input_html) + */ function html(&$plugin, $echo=false) { - $value = ''; $disable = $this->is_protected() ? 'disabled="disabled"' : ''; $key = htmlspecialchars($this->_key); @@ -766,7 +825,9 @@ if (!class_exists('setting_password')) { } if (!class_exists('setting_email')) { - + /** + * Class setting_email + */ class setting_email extends setting_string { var $_multiple = false; var $_placeholders = false; @@ -775,6 +836,7 @@ if (!class_exists('setting_email')) { * update setting with user provided value $input * if value fails error check, save it * + * @param mixed $input * @return boolean true if changed, false otherwise (incl. on error) */ function update($input) { @@ -829,7 +891,17 @@ if (!class_exists('setting_email')) { * @deprecated 2013-02-16 */ if (!class_exists('setting_richemail')) { + /** + * Class setting_richemail + */ class setting_richemail extends setting_email { + /** + * update changed setting with user provided value $input + * - if changed value fails error check, save it + * + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (also on error) + */ function update($input) { $this->_placeholders = true; return parent::update($input); @@ -839,6 +911,9 @@ if (!class_exists('setting_richemail')) { if (!class_exists('setting_numeric')) { + /** + * Class setting_numeric + */ class setting_numeric extends setting_string { // This allows for many PHP syntax errors... // var $_pattern = '/^[-+\/*0-9 ]*$/'; @@ -847,6 +922,14 @@ if (!class_exists('setting_numeric')) { var $_min = null; var $_max = null; + /** + * update changed setting with user provided value $input + * - if changed value fails error check, save it to $this->_input (to allow echoing later) + * - if changed value passes error check, set $this->_local to the new value + * + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (also on error) + */ function update($input) { $local = $this->_local; $valid = parent::update($input); @@ -863,6 +946,13 @@ if (!class_exists('setting_numeric')) { return $valid; } + /** + * Generate string to save setting value to file according to $fmt + * + * @param string $var name of variable + * @param string $fmt save format + * @return string + */ function out($var, $fmt='php') { if ($this->is_protected()) return ''; @@ -881,6 +971,9 @@ if (!class_exists('setting_numeric')) { } if (!class_exists('setting_numericopt')) { + /** + * Class setting_numericopt + */ class setting_numericopt extends setting_numeric { // just allow an empty config var $_pattern = '/^(|[-]?[0-9]+(?:[-+*][0-9]+)*)$/'; @@ -888,10 +981,18 @@ if (!class_exists('setting_numericopt')) { } if (!class_exists('setting_onoff')) { + /** + * Class setting_onoff + */ class setting_onoff extends setting_numeric { - + /** + * Build html for label and input of setting + * + * @param DokuWiki_Plugin $plugin object of config plugin + * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting + * @return array with content array(string $label_html, string $input_html) + */ function html(&$plugin, $echo = false) { - $value = ''; $disable = ''; if ($this->is_protected()) { @@ -909,6 +1010,14 @@ if (!class_exists('setting_onoff')) { return array($label,$input); } + /** + * update changed setting with user provided value $input + * - if changed value fails error check, save it to $this->_input (to allow echoing later) + * - if changed value passes error check, set $this->_local to the new value + * + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (also on error) + */ function update($input) { if ($this->is_protected()) return false; @@ -923,11 +1032,21 @@ if (!class_exists('setting_onoff')) { } if (!class_exists('setting_multichoice')) { + /** + * Class setting_multichoice + */ class setting_multichoice extends setting_string { var $_choices = array(); + var $lang; //some custom language strings are stored in setting + /** + * Build html for label and input of setting + * + * @param DokuWiki_Plugin $plugin object of config plugin + * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting + * @return array with content array(string $label_html, string $input_html) + */ function html(&$plugin, $echo = false) { - $value = ''; $disable = ''; $nochoice = ''; @@ -970,6 +1089,14 @@ if (!class_exists('setting_multichoice')) { return array($label,$input); } + /** + * update changed setting with user provided value $input + * - if changed value fails error check, save it to $this->_input (to allow echoing later) + * - if changed value passes error check, set $this->_local to the new value + * + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (also on error) + */ function update($input) { if (is_null($input)) return false; if ($this->is_protected()) return false; @@ -987,10 +1114,20 @@ if (!class_exists('setting_multichoice')) { if (!class_exists('setting_dirchoice')) { + /** + * Class setting_dirchoice + */ class setting_dirchoice extends setting_multichoice { var $_dir = ''; + /** + * Receives current values for the setting $key + * + * @param mixed $default default setting value + * @param mixed $local local setting value + * @param mixed $protected protected setting value + */ function initialize($default,$local,$protected) { // populate $this->_choices with a list of directories @@ -1016,12 +1153,18 @@ if (!class_exists('setting_dirchoice')) { if (!class_exists('setting_hidden')) { + /** + * Class setting_hidden + */ class setting_hidden extends setting { // Used to explicitly ignore a setting in the configuration manager. } } if (!class_exists('setting_fieldset')) { + /** + * Class setting_fieldset + */ class setting_fieldset extends setting { // A do-nothing class used to detect the 'fieldset' type. // Used to start a new settings "display-group". @@ -1029,6 +1172,9 @@ if (!class_exists('setting_fieldset')) { } if (!class_exists('setting_undefined')) { + /** + * Class setting_undefined + */ class setting_undefined extends setting_hidden { // A do-nothing class used to detect settings with no metadata entry. // Used internaly to hide undefined settings, and generate the undefined settings list. @@ -1036,6 +1182,9 @@ if (!class_exists('setting_undefined')) { } if (!class_exists('setting_no_class')) { + /** + * Class setting_no_class + */ class setting_no_class extends setting_undefined { // A do-nothing class used to detect settings with a missing setting class. // Used internaly to hide undefined settings, and generate the undefined settings list. @@ -1043,6 +1192,9 @@ if (!class_exists('setting_no_class')) { } if (!class_exists('setting_no_default')) { + /** + * Class setting_no_default + */ class setting_no_default extends setting_undefined { // A do-nothing class used to detect settings with no default value. // Used internaly to hide undefined settings, and generate the undefined settings list. @@ -1050,11 +1202,22 @@ if (!class_exists('setting_no_default')) { } if (!class_exists('setting_multicheckbox')) { + /** + * Class setting_multicheckbox + */ class setting_multicheckbox extends setting_string { var $_choices = array(); var $_combine = array(); + /** + * update changed setting with user provided value $input + * - if changed value fails error check, save it to $this->_input (to allow echoing later) + * - if changed value passes error check, set $this->_local to the new value + * + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (also on error) + */ function update($input) { if ($this->is_protected()) return false; @@ -1075,9 +1238,15 @@ if (!class_exists('setting_multicheckbox')) { return true; } + /** + * Build html for label and input of setting + * + * @param DokuWiki_Plugin $plugin object of config plugin + * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting + * @return array with content array(string $label_html, string $input_html) + */ function html(&$plugin, $echo=false) { - $value = ''; $disable = ''; if ($this->is_protected()) { @@ -1125,7 +1294,7 @@ if (!class_exists('setting_multicheckbox')) { // handle any remaining values $other = join(',',$value); - $class = (count($default == count($value)) && (count($value) == count(array_intersect($value,$default)))) ? + $class = ((count($default) == count($value)) && (count($value) == count(array_intersect($value,$default)))) ? " selectiondefault" : ""; $input .= '<div class="other'.$class.'">'."\n"; @@ -1139,6 +1308,9 @@ if (!class_exists('setting_multicheckbox')) { /** * convert comma separated list to an array and combine any complimentary values + * + * @param string $str + * @return array */ function _str2array($str) { $array = explode(',',$str); @@ -1162,6 +1334,9 @@ if (!class_exists('setting_multicheckbox')) { /** * convert array of values + other back to a comma separated list, incl. splitting any combined values + * + * @param array $input + * @return string */ function _array2str($input) { @@ -1190,6 +1365,9 @@ if (!class_exists('setting_multicheckbox')) { } if (!class_exists('setting_regex')){ + /** + * Class setting_regex + */ class setting_regex extends setting_string { var $_delimiter = '/'; // regex delimiter to be used in testing input @@ -1213,7 +1391,7 @@ if (!class_exists('setting_regex')){ // see if the regex compiles and runs (we don't check for effectiveness) $regex = $this->_delimiter . $input . $this->_delimiter . $this->_pregflags; $lastError = error_get_last(); - $ok = @preg_match($regex,'testdata'); + @preg_match($regex,'testdata'); if (preg_last_error() != PREG_NO_ERROR || error_get_last() != $lastError) { $this->_input = $input; $this->_error = true; diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index 83de802a3..232a8177f 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -6,8 +6,15 @@ */ if (!class_exists('setting_sepchar')) { + /** + * Class setting_sepchar + */ class setting_sepchar extends setting_multichoice { + /** + * @param string $key + * @param array|null $param array with metadata of setting + */ function setting_sepchar($key,$param=null) { $str = '_-.'; for ($i=0;$i<strlen($str);$i++) $this->_choices[] = $str{$i}; @@ -19,8 +26,19 @@ if (!class_exists('setting_sepchar')) { } if (!class_exists('setting_savedir')) { + /** + * Class setting_savedir + */ class setting_savedir extends setting_string { + /** + * update changed setting with user provided value $input + * - if changed value fails error check, save it to $this->_input (to allow echoing later) + * - if changed value passes error check, set $this->_local to the new value + * + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (also on error) + */ function update($input) { if ($this->is_protected()) return false; @@ -40,9 +58,20 @@ if (!class_exists('setting_savedir')) { } if (!class_exists('setting_authtype')) { + /** + * Class setting_authtype + */ class setting_authtype extends setting_multichoice { + /** + * Receives current values for the setting $key + * + * @param mixed $default default setting value + * @param mixed $local local setting value + * @param mixed $protected protected setting value + */ function initialize($default,$local,$protected) { + /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; // retrieve auth types provided by plugins @@ -53,7 +82,16 @@ if (!class_exists('setting_authtype')) { parent::initialize($default,$local,$protected); } + /** + * update changed setting with user provided value $input + * - if changed value fails error check, save it to $this->_input (to allow echoing later) + * - if changed value passes error check, set $this->_local to the new value + * + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (also on error) + */ function update($input) { + /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; // is an update possible/requested? @@ -92,8 +130,19 @@ if (!class_exists('setting_authtype')) { } if (!class_exists('setting_im_convert')) { + /** + * Class setting_im_convert + */ class setting_im_convert extends setting_string { + /** + * update changed setting with user provided value $input + * - if changed value fails error check, save it to $this->_input (to allow echoing later) + * - if changed value passes error check, set $this->_local to the new value + * + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (also on error) + */ function update($input) { if ($this->is_protected()) return false; @@ -115,14 +164,24 @@ if (!class_exists('setting_im_convert')) { } if (!class_exists('setting_disableactions')) { + /** + * Class setting_disableactions + */ class setting_disableactions extends setting_multicheckbox { + /** + * Build html for label and input of setting + * + * @param DokuWiki_Plugin $plugin object of config plugin + * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting + * @return array with content array(string $label_html, string $input_html) + */ function html(&$plugin, $echo=false) { global $lang; // make some language adjustments (there must be a better way) // transfer some DokuWiki language strings to the plugin - if (!$plugin->localised) $this->setupLocale(); + if (!$plugin->localised) $plugin->setupLocale(); $plugin->lang[$this->_key.'_revisions'] = $lang['btn_revs']; foreach ($this->_choices as $choice) @@ -134,10 +193,20 @@ if (!class_exists('setting_disableactions')) { } if (!class_exists('setting_compression')) { + /** + * Class setting_compression + */ class setting_compression extends setting_multichoice { var $_choices = array('0'); // 0 = no compression, always supported + /** + * Receives current values for the setting $key + * + * @param mixed $default default setting value + * @param mixed $local local setting value + * @param mixed $protected protected setting value + */ function initialize($default,$local,$protected) { // populate _choices with the compression methods supported by this php installation @@ -150,16 +219,26 @@ if (!class_exists('setting_compression')) { } if (!class_exists('setting_license')) { + /** + * Class setting_license + */ class setting_license extends setting_multichoice { var $_choices = array(''); // none choosen + /** + * Receives current values for the setting $key + * + * @param mixed $default default setting value + * @param mixed $local local setting value + * @param mixed $protected protected setting value + */ function initialize($default,$local,$protected) { global $license; foreach($license as $key => $data){ $this->_choices[] = $key; - $this->lang[$this->_key.'_o_'.$key] = $data['name']; + $this->lang[$this->_key.'_o_'.$key] = $data['name']; // stored in setting } parent::initialize($default,$local,$protected); @@ -169,9 +248,20 @@ if (!class_exists('setting_license')) { if (!class_exists('setting_renderer')) { + /** + * Class setting_renderer + */ class setting_renderer extends setting_multichoice { var $_prompts = array(); - + var $_format = null; + + /** + * Receives current values for the setting $key + * + * @param mixed $default default setting value + * @param mixed $local local setting value + * @param mixed $protected protected setting value + */ function initialize($default,$local,$protected) { $format = $this->_format; @@ -188,11 +278,18 @@ if (!class_exists('setting_renderer')) { parent::initialize($default,$local,$protected); } + /** + * Build html for label and input of setting + * + * @param DokuWiki_Plugin $plugin object of config plugin + * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting + * @return array with content array(string $label_html, string $input_html) + */ function html(&$plugin, $echo=false) { // make some language adjustments (there must be a better way) // transfer some plugin names to the config plugin - if (!$plugin->localised) $this->setupLocale(); + if (!$plugin->localised) $plugin->setupLocale(); foreach ($this->_choices as $choice) { if (!isset($plugin->lang[$this->_key.'_o_'.$choice])) { diff --git a/lib/plugins/extension/admin.php b/lib/plugins/extension/admin.php index 99c74848b..de4992937 100644 --- a/lib/plugins/extension/admin.php +++ b/lib/plugins/extension/admin.php @@ -75,10 +75,10 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin { case 'uninstall': $extension->setExtension($extname); $status = $extension->uninstall(); - if($status !== true) { - msg($status, -1); - } else { + if($status) { msg(sprintf($this->getLang('msg_delete_success'), hsc($extension->getDisplayName())), 1); + } else { + msg(sprintf($this->getLang('msg_delete_failed'), hsc($extension->getDisplayName())), -1); } break; case 'enable'; diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index 2aca0e218..dfa624907 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -799,7 +799,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { * * The directory is registered for cleanup when the class is destroyed * - * @return bool|string + * @return false|string */ protected function mkTmpDir(){ $dir = io_mktmpdir(); @@ -1079,7 +1079,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> * @param string $file The file to analyze - * @return string|bool false if the file can't be read, otherwise an "extension" + * @return string|false false if the file can't be read, otherwise an "extension" */ private function guess_archive($file) { $fh = fopen($file, 'rb'); @@ -1095,6 +1095,10 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { /** * Copy with recursive sub-directory support + * + * @param string $src filename path to file + * @param string $dst filename path to file + * @return bool|int|string */ private function dircopy($src, $dst) { global $conf; diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php index 9b1988d84..872cccc8c 100644 --- a/lib/plugins/extension/helper/list.php +++ b/lib/plugins/extension/helper/list.php @@ -333,7 +333,6 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * Shortens the URL for display * * @param string $url - * * @return string HTML link */ function shortlink($url){ @@ -461,6 +460,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @return string The HTML code */ function make_actions(helper_plugin_extension_extension $extension) { + global $conf; $return = ''; $errors = ''; @@ -492,6 +492,10 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { $errors .= '<p class="permerror">'.$this->getLang('git').'</p>'; } + if ($extension->isEnabled() && in_array('Auth', $extension->getTypes()) && $conf['auth'] != $extension->getID()) { + $errors .= '<p class="permerror">'.$this->getLang('auth').'</p>'; + } + }else{ if (($canmod = $extension->canModify()) === true) { if ($extension->getDownloadURL()) { diff --git a/lib/plugins/extension/helper/repository.php b/lib/plugins/extension/helper/repository.php index 6ffe89eb7..5dc2707cf 100644 --- a/lib/plugins/extension/helper/repository.php +++ b/lib/plugins/extension/helper/repository.php @@ -32,7 +32,7 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { $request_needed = false; foreach ($list as $name) { $cache = new cache('##extension_manager##'.$name, '.repo'); - $result = null; + if (!isset($this->loaded_extensions[$name]) && $this->hasAccess() && !$cache->useCache(array('age' => 3600 * 24))) { $this->loaded_extensions[$name] = true; $request_data['ext'][] = $name; @@ -64,7 +64,7 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { public function hasAccess() { if ($this->has_access === null) { $cache = new cache('##extension_manager###hasAccess', '.repo'); - $result = null; + if (!$cache->useCache(array('age' => 3600 * 24, 'purge'=>1))) { $httpclient = new DokuHTTPClient(); $httpclient->timeout = 5; @@ -91,7 +91,7 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { */ public function getData($name) { $cache = new cache('##extension_manager##'.$name, '.repo'); - $result = null; + if (!isset($this->loaded_extensions[$name]) && $this->hasAccess() && !$cache->useCache(array('age' => 3600 * 24))) { $this->loaded_extensions[$name] = true; $httpclient = new DokuHTTPClient(); diff --git a/lib/plugins/extension/lang/cs/intro_templates.txt b/lib/plugins/extension/lang/cs/intro_templates.txt new file mode 100644 index 000000000..45abe952c --- /dev/null +++ b/lib/plugins/extension/lang/cs/intro_templates.txt @@ -0,0 +1 @@ +Toto jsou šablony, které jsou momentálně nainstalovány v této DokuWiki. Aktuálně používanu šablonu lze vybrat ve [[?do=admin&page=config|Správci rozšíření]].
\ No newline at end of file diff --git a/lib/plugins/extension/lang/cs/lang.php b/lib/plugins/extension/lang/cs/lang.php index 27b3a94a3..f6db2b153 100644 --- a/lib/plugins/extension/lang/cs/lang.php +++ b/lib/plugins/extension/lang/cs/lang.php @@ -15,6 +15,7 @@ $lang['notimplemented'] = 'Tato vychytávka není dosud implementována'; $lang['notinstalled'] = 'Toto rozšíření není instalováno'; $lang['alreadyenabled'] = 'Toto rozšíření je již povoleno'; $lang['alreadydisabled'] = 'Toto rozšíření je již vypnuto'; +$lang['pluginlistsaveerror'] = 'Došlo k chybě při ukládání seznamu zásuvných modulů'; $lang['unknownauthor'] = 'Neznámý autor'; $lang['unknownversion'] = 'Neznámá verze'; $lang['btn_info'] = 'Zobrazit více informací'; @@ -27,12 +28,15 @@ $lang['btn_reinstall'] = 'Přeinstalovat'; $lang['js']['reallydel'] = 'Opravdu odinstalovat toto rozšíření?'; $lang['search_for'] = 'Hledat rozšíření:'; $lang['search'] = 'Hledat'; +$lang['extensionby'] = '<strong>%s</strong> od %s'; +$lang['screenshot'] = 'Screenshot %s'; $lang['popularity'] = 'Popularita: %s%%'; $lang['homepage_link'] = 'Dokumenty'; $lang['bugs_features'] = 'Chyby'; $lang['tags'] = 'Štítky:'; $lang['author_hint'] = 'Vyhledat rozšíření podle tohoto autora'; $lang['installed'] = 'Nainstalováno:'; +$lang['downloadurl'] = 'URL stahování:'; $lang['repository'] = 'Repozitář:'; $lang['unknown'] = '<em>neznámý</em>'; $lang['installed_version'] = 'Nainstalovaná verze:'; @@ -41,6 +45,7 @@ $lang['available_version'] = 'Dostupná verze:'; $lang['compatible'] = 'Kompatibilní s:'; $lang['depends'] = 'Závisí na:'; $lang['similar'] = 'Podobný jako:'; +$lang['conflicts'] = 'Koliduje s:'; $lang['donate'] = 'Líbí se ti to?'; $lang['donate_action'] = 'Kup autorovi kávu!'; $lang['repo_retry'] = 'Opakovat'; @@ -54,4 +59,25 @@ $lang['status_disabled'] = 'zakázaný'; $lang['status_unmodifiable'] = 'neměnný'; $lang['status_plugin'] = 'zásuvný modul'; $lang['status_template'] = 'šablona'; +$lang['status_bundled'] = 'svázaný'; +$lang['msg_enabled'] = 'Zásuvný modul %s povolen'; +$lang['msg_disabled'] = 'Zásuvný modul %s zakázán'; $lang['msg_delete_success'] = 'Rozšíření odinstalováno'; +$lang['msg_template_install_success'] = 'Šablona %s úspěšně nainstalována'; +$lang['msg_template_update_success'] = 'Šablona %s úspěšně aktualizována'; +$lang['msg_plugin_install_success'] = 'Zásuvný modul %s úspěšně nainstalován.'; +$lang['msg_plugin_update_success'] = 'Zásuvný modul %s úspěšně aktualizován.'; +$lang['msg_upload_failed'] = 'Nahrávání souboru selhalo'; +$lang['missing_dependency'] = '<strong>Chybějící nebo zakázaná závislost:</strong> %s'; +$lang['security_issue'] = '<strong>Bezpečnostní problém:</strong> %s'; +$lang['security_warning'] = '<strong>Bezpečnostní varování:</strong> %s'; +$lang['update_available'] = '<strong>Aktualizace:</strong> Je dostupná nová verze %s.'; +$lang['wrong_folder'] = '<strong>Zásuvný modul nesprávně nainstalován:</strong> Přejmenujte adresár modulu "%s" na "%s".'; +$lang['error_badurl'] = 'Adresy URL by měly začínat s http nebo https'; +$lang['error_dircreate'] = 'Nelze vytvořit dočasný adresář pro přijetí stahování'; +$lang['error_download'] = 'Nelze stáhnout soubor: %s'; +$lang['error_findfolder'] = 'Nelze rozpoznat adresář pro rozšíření, je třeba stáhnout a instalovat ručně'; +$lang['noperms'] = 'Nelze zapisovat do adresáře pro rozšíření'; +$lang['notplperms'] = 'Nelze zapisovat do odkládacího adresáře'; +$lang['nopluginperms'] = 'Nelze zapisovat do adresáře se zásuvnými moduly'; +$lang['git'] = 'Toto rozšíření bylo nainstalováno přes git, nejspíš ho tady aktualizovat nechcete.'; diff --git a/lib/plugins/extension/lang/da/lang.php b/lib/plugins/extension/lang/da/lang.php new file mode 100644 index 000000000..c341bc5f9 --- /dev/null +++ b/lib/plugins/extension/lang/da/lang.php @@ -0,0 +1,24 @@ +<?php + +/** + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * + * @author Søren Birk <soer9648@eucl.dk> + */ +$lang['update_available'] = '<strong>Opdatering:</strong> Ny version %s er tilgængelig.'; +$lang['wrong_folder'] = '<strong>Plugin ikke installeret korrekt:</strong> Omdøb plugin-mappe "%s" til "%s".'; +$lang['url_change'] = '<strong>URL ændret:</strong> Download-URL er blevet ændret siden sidste download. Kontrollér om den nye URL er valid, inden udvidelsen opdateres.<br />Ny: %s<br />Gammel: %s'; +$lang['error_badurl'] = 'URL\'er skal starte med http eller https'; +$lang['error_dircreate'] = 'Ikke i stand til at oprette midlertidig mappe til modtagelse af download'; +$lang['error_download'] = 'Ikke i stand til at downloade filen: %s'; +$lang['error_decompress'] = 'Ikke i stand til at dekomprimere den downloadede fil. Dette kan være et resultat af en dårlig download, hvor du i så fald bør du prøve igen; eller komprimeringsformatet kan være ukendt, hvor du i så fald bliver nød til at downloade og installere manuelt.'; +$lang['error_findfolder'] = 'Ikke i stand til at identificere udvidelsesmappe - du bliver nød til at downloade og installere manuelt.'; +$lang['error_copy'] = 'Der opstod en kopieringsfejl under installation af filer til mappen <em>%s</em>: disken kan være fuld, eller mangel på fil-tilladelser. Dette kan have resulteret i et delvist installeret plugin, og efterladt din wiki-installation ustabil.'; +$lang['noperms'] = 'Udvidelsesmappe er ikke skrivbar'; +$lang['notplperms'] = 'Skabelonmappe er ikke skrivbar'; +$lang['nopluginperms'] = 'Pluginmappe er ikke skrivbar'; +$lang['git'] = 'Udvidelsen blev installeret via git - du vil muligvis ikke opdatere herfra.'; +$lang['auth'] = 'Auth-plugin er ikke aktiveret i konfigurationen - overvej at deaktivere den.'; +$lang['install_url'] = 'Installér fra URL:'; +$lang['install_upload'] = 'Upload Udvidelse:'; +$lang['repo_error'] = 'Plugin-arkivet kunne ikke kontaktes. Kontrollér at din server kan kontakte www.dokuwiki.org kontrollér dine proxy-indstillinger.'; diff --git a/lib/plugins/extension/lang/en/lang.php b/lib/plugins/extension/lang/en/lang.php index 72c9b9e2d..d7541b422 100644 --- a/lib/plugins/extension/lang/en/lang.php +++ b/lib/plugins/extension/lang/en/lang.php @@ -69,7 +69,8 @@ $lang['status_bundled'] = 'bundled'; $lang['msg_enabled'] = 'Plugin %s enabled'; $lang['msg_disabled'] = 'Plugin %s disabled'; -$lang['msg_delete_success'] = 'Extension uninstalled'; +$lang['msg_delete_success'] = 'Extension %s uninstalled'; +$lang['msg_delete_failed'] = 'Uninstalling Extension %s failed'; $lang['msg_template_install_success'] = 'Template %s installed successfully'; $lang['msg_template_update_success'] = 'Template %s updated successfully'; $lang['msg_plugin_install_success'] = 'Plugin %s installed successfully'; @@ -94,6 +95,7 @@ $lang['noperms'] = 'Extension directory is not writable'; $lang['notplperms'] = 'Template directory is not writable'; $lang['nopluginperms'] = 'Plugin directory is not writable'; $lang['git'] = 'This extension was installed via git, you may not want to update it here.'; +$lang['auth'] = 'This auth plugin is not enabled in configuration, consider disabling it.'; $lang['install_url'] = 'Install from URL:'; $lang['install_upload'] = 'Upload Extension:'; diff --git a/lib/plugins/extension/lang/it/lang.php b/lib/plugins/extension/lang/it/lang.php index 7dff6c5b2..1aa658e0f 100644 --- a/lib/plugins/extension/lang/it/lang.php +++ b/lib/plugins/extension/lang/it/lang.php @@ -5,11 +5,18 @@ * * @author Francesco <francesco.cavalli@hotmail.com> * @author Fabio <fabioslurp@yahoo.it> + * @author Torpedo <dgtorpedo@gmail.com> */ +$lang['unknownauthor'] = 'Autore sconosciuto'; +$lang['unknownversion'] = 'Revisione sconosciuta'; +$lang['btn_info'] = 'Mostra maggiori informazioni'; +$lang['btn_update'] = 'Aggiorna'; +$lang['btn_uninstall'] = 'Disinstalla'; $lang['btn_enable'] = 'Abilita'; $lang['btn_disable'] = 'Disabilita'; $lang['btn_install'] = 'Installa'; $lang['btn_reinstall'] = 'Reinstalla'; +$lang['js']['reallydel'] = 'Sicuro di disinstallare questa estensione?'; $lang['search'] = 'Cerca'; $lang['homepage_link'] = 'Documenti'; $lang['bugs_features'] = 'Bug'; @@ -18,13 +25,18 @@ $lang['author_hint'] = 'Cerca estensioni per questo autore'; $lang['installed'] = 'Installato:'; $lang['downloadurl'] = 'URL download:'; $lang['repository'] = 'Repository'; +$lang['unknown'] = '<em>sconosciuto</em>'; $lang['installed_version'] = 'Versione installata'; $lang['install_date'] = 'Il tuo ultimo aggiornamento:'; $lang['available_version'] = 'Versione disponibile:'; $lang['compatible'] = 'Compatibile con:'; +$lang['depends'] = 'Dipende da:'; $lang['similar'] = 'Simile a:'; +$lang['conflicts'] = 'Conflitto con:'; $lang['donate'] = 'Simile a questo?'; +$lang['donate_action'] = 'Paga un caffè all\'autore!'; $lang['repo_retry'] = 'Riprova'; +$lang['provides'] = 'Fornisce:'; $lang['status'] = 'Status:'; $lang['status_installed'] = 'installato'; $lang['status_not_installed'] = 'non installato'; @@ -34,6 +46,15 @@ $lang['status_disabled'] = 'disabilitato'; $lang['status_unmodifiable'] = 'inmodificabile'; $lang['status_plugin'] = 'plugin'; $lang['status_template'] = 'modello'; +$lang['msg_enabled'] = 'Plugin %s abilitato'; +$lang['msg_disabled'] = 'Plugin %s disabilitato'; +$lang['msg_delete_success'] = 'Estensione %s disinstallata'; +$lang['msg_plugin_install_success'] = 'Plugin %s installato con successo'; +$lang['msg_plugin_update_success'] = 'Plugin %s aggiornato con successo'; +$lang['msg_upload_failed'] = 'Caricamento del file fallito'; +$lang['missing_dependency'] = '<strong>Dipendenza mancante o disabilitata: </strong> %s'; +$lang['update_available'] = '<strong>Aggiornamento:</strong> Nuova versione %s disponibile.'; +$lang['wrong_folder'] = '<strong>Plugin non installato correttamente:</strong> rinomina la directory del plugin "%s" in "%s".'; $lang['error_badurl'] = 'URLs deve iniziare con http o https'; $lang['error_dircreate'] = 'Impossibile creare una cartella temporanea per ricevere il download'; $lang['error_download'] = 'Impossibile scaricare il file: %s'; diff --git a/lib/plugins/extension/lang/nl/lang.php b/lib/plugins/extension/lang/nl/lang.php index a54924e93..f75f78121 100644 --- a/lib/plugins/extension/lang/nl/lang.php +++ b/lib/plugins/extension/lang/nl/lang.php @@ -63,7 +63,7 @@ $lang['status_template'] = 'template'; $lang['status_bundled'] = 'Gebundeld'; $lang['msg_enabled'] = 'Plugin %s ingeschakeld'; $lang['msg_disabled'] = 'Plugin %s uitgeschakeld'; -$lang['msg_delete_success'] = 'Uitbreiding gedeinstalleerd'; +$lang['msg_delete_success'] = 'Uitbreiding %s gedeinstalleerd'; $lang['msg_template_install_success'] = 'Template %s werd succesvol geïnstalleerd'; $lang['msg_template_update_success'] = 'Template %s werd succesvol geüpdatet'; $lang['msg_plugin_install_success'] = 'Plugin %s werd succesvol geïnstalleerd'; diff --git a/lib/plugins/extension/lang/zh-tw/intro_plugins.txt b/lib/plugins/extension/lang/zh-tw/intro_plugins.txt new file mode 100644 index 000000000..b5b77a267 --- /dev/null +++ b/lib/plugins/extension/lang/zh-tw/intro_plugins.txt @@ -0,0 +1 @@ +已經有一些外掛套件被安裝在你的DokuWiki之中。你可以在這裡啟用、禁用,甚至是完全移除它們。如外掛可更新也同時會顯示在這裡,請確保在更新前先閱讀過該套件之文件。
\ No newline at end of file diff --git a/lib/plugins/extension/lang/zh-tw/lang.php b/lib/plugins/extension/lang/zh-tw/lang.php index a86364d7a..79657ffeb 100644 --- a/lib/plugins/extension/lang/zh-tw/lang.php +++ b/lib/plugins/extension/lang/zh-tw/lang.php @@ -5,6 +5,7 @@ * * @author Stan <talktostan@gmail.com> * @author June-Hao Hou <junehao@gmail.com> + * @author lioujheyu <lioujheyu@gmail.com> */ $lang['menu'] = '延伸功能管理'; $lang['tab_plugins'] = '已安裝外掛'; @@ -28,20 +29,49 @@ $lang['btn_reinstall'] = '重新安裝'; $lang['js']['reallydel'] = '確定要移除此延伸功能?'; $lang['search_for'] = '搜尋延伸功能:'; $lang['search'] = '搜尋'; +$lang['homepage_link'] = '文件'; $lang['tags'] = '標籤:'; $lang['author_hint'] = '搜尋相同作者的延伸功能'; $lang['installed'] = '已安裝:'; $lang['downloadurl'] = '下載網址:'; +$lang['unknown'] = '<em>未知</em>'; $lang['installed_version'] = '已安裝版本:'; +$lang['install_date'] = '你最後一次更新: '; $lang['available_version'] = '可用版本:'; $lang['compatible'] = '相容於:'; +$lang['depends'] = '依賴於: '; +$lang['similar'] = '類似於: '; +$lang['conflicts'] = '相衝突於: '; +$lang['donate'] = '像這樣?'; +$lang['donate_action'] = '請作者一杯咖啡!'; $lang['repo_retry'] = '再試一次'; $lang['status'] = '狀態:'; $lang['status_installed'] = '已安裝'; $lang['status_not_installed'] = '未安裝'; +$lang['status_protected'] = '已保護'; $lang['status_enabled'] = '作用中'; $lang['status_disabled'] = '停用中'; +$lang['status_unmodifiable'] = '不可更動'; $lang['status_plugin'] = '外掛'; +$lang['status_template'] = '模板'; +$lang['status_bundled'] = '已綑綁內附'; +$lang['msg_enabled'] = '外掛 %s 已啟用'; +$lang['msg_disabled'] = '外掛 %s 已禁用'; +$lang['msg_delete_success'] = '附加元件已移除'; +$lang['msg_template_install_success'] = '模板 %s 以成功安裝'; +$lang['msg_template_update_success'] = '模板 %s 以成功更新'; +$lang['msg_plugin_install_success'] = '外掛 %s 以成功安裝'; +$lang['msg_plugin_update_success'] = '外掛 %s 以成功更新'; +$lang['msg_upload_failed'] = '上傳檔案失敗'; +$lang['missing_dependency'] = '<strong>遺失或禁用相依性套件:</strong> %s'; +$lang['security_issue'] = '<strong>安全性問題:</strong> %s'; +$lang['security_warning'] = '<strong>安全問題警告:</strong> %s'; +$lang['update_available'] = '<strong>更新:</strong> 已可取得 %s 的新版本'; +$lang['wrong_folder'] = '<strong>外掛安裝不正確:</strong> 將外掛資料夾從 "%s" 更名至 "%s"。'; +$lang['url_change'] = '<strong>網址已變更:</strong> 自從上次下載後下載網址已變更。在更新延伸功能前請先檢查新網址是否可用。<br />新: %s<br />舊: %s'; +$lang['error_download'] = '無法下載檔案:%s'; +$lang['error_decompress'] = '無法解壓縮檔案。這可能是下載品質不佳所致,在這個情況下你應該再試一次;也有可能是因為無法辨識的壓縮格式,在這個情況下你應該自行下載並手動安裝'; +$lang['error_findfolder'] = '無法辨認延伸功能資料夾,你必須自行下載並手動安裝'; $lang['noperms'] = '延伸功能資料夾無法寫入'; $lang['notplperms'] = '版型資料夾無法寫入'; $lang['nopluginperms'] = '外掛資料夾無法寫入'; diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php index 9265f44d5..773256faf 100644 --- a/lib/plugins/info/syntax.php +++ b/lib/plugins/info/syntax.php @@ -44,9 +44,14 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { $this->Lexer->addSpecialPattern('~~INFO:\w+~~',$mode,'plugin_info'); } - /** * Handle the match + * + * @param string $match The text matched by the patterns + * @param int $state The lexer state for the match + * @param int $pos The character position of the matched text + * @param Doku_Handler $handler The Doku_Handler object + * @return array Return an array with all data you want to use in render */ function handle($match, $state, $pos, Doku_Handler $handler){ $match = substr($match,7,-2); //strip ~~INFO: from start and ~~ from end @@ -55,6 +60,11 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * Create output + * + * @param string $format string output format being rendered + * @param Doku_Renderer $renderer the current renderer object + * @param array $data data created by handler() + * @return boolean rendered correctly? */ function render($format, Doku_Renderer $renderer, $data) { if($format == 'xhtml'){ @@ -103,8 +113,11 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * list all installed plugins * * uses some of the original renderer methods + * + * @param string $type + * @param Doku_Renderer_xhtml $renderer */ - function _plugins_xhtml($type, Doku_Renderer &$renderer){ + function _plugins_xhtml($type, Doku_Renderer_xhtml $renderer){ global $lang; $renderer->doc .= '<ul>'; @@ -114,7 +127,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { // remove subparts foreach($plugins as $p){ if (!$po = plugin_load($type,$p)) continue; - list($name,$part) = explode('_',$p,2); + list($name,/* $part */) = explode('_',$p,2); $plginfo[$name] = $po->getInfo(); } @@ -141,8 +154,10 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * list all installed plugins * * uses some of the original renderer methods + * + * @param Doku_Renderer_xhtml $renderer */ - function _helpermethods_xhtml(Doku_Renderer &$renderer){ + function _helpermethods_xhtml(Doku_Renderer_xhtml $renderer){ $plugins = plugin_list('helper'); foreach($plugins as $p){ if (!$po = plugin_load('helper',$p)) continue; @@ -189,6 +204,8 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * lists all known syntax types and their registered modes + * + * @return string */ function _syntaxtypes_xhtml(){ global $PARSER_MODES; @@ -211,6 +228,8 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * lists all known syntax modes and their sorting value + * + * @return string */ function _syntaxmodes_xhtml(){ $modes = p_get_parsermodes(); @@ -249,13 +268,18 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * Adds a TOC item + * + * @param string $text + * @param int $level + * @param Doku_Renderer_xhtml $renderer + * @return string */ - function _addToTOC($text, $level, Doku_Renderer &$renderer){ + protected function _addToTOC($text, $level, Doku_Renderer_xhtml $renderer){ global $conf; + $hid = ''; if (($level >= $conf['toptoclevel']) && ($level <= $conf['maxtoclevel'])){ - /** @var $renderer Doku_Renderer_xhtml */ - $hid = $renderer->_headerToLink($text, 'true'); + $hid = $renderer->_headerToLink($text, true); $renderer->toc[] = array( 'hid' => $hid, 'title' => $text, diff --git a/lib/plugins/popularity/helper.php b/lib/plugins/popularity/helper.php index eacde06d0..b4fb33b90 100644 --- a/lib/plugins/popularity/helper.php +++ b/lib/plugins/popularity/helper.php @@ -74,6 +74,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { /** * Check if autosubmit is enabled + * * @return boolean TRUE if we should send data once a month, FALSE otherwise */ function isAutoSubmitEnabled(){ @@ -82,6 +83,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { /** * Send the data, to the submit url + * * @param string $data The popularity data * @return string An empty string if everything worked fine, a string describing the error otherwise */ @@ -97,6 +99,8 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { /** * Compute the last time the data was sent. If it has never been sent, we return 0. + * + * @return int */ function lastSentTime(){ $manualSubmission = @filemtime($this->popularityLastSubmitFile); @@ -107,6 +111,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { /** * Gather all information + * * @return string The popularity data as a string */ function gatherAsString(){ @@ -124,6 +129,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { /** * Gather all information + * * @return array The popularity data as an array */ function _gather(){ @@ -288,17 +294,24 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { * * @author <gilthans dot NO dot SPAM at gmail dot com> * @link http://de3.php.net/manual/en/ini.core.php#79564 + * + * @param string $v + * @return int|string */ function _to_byte($v){ $l = substr($v, -1); $ret = substr($v, 0, -1); switch(strtoupper($l)){ + /** @noinspection PhpMissingBreakStatementInspection */ case 'P': $ret *= 1024; + /** @noinspection PhpMissingBreakStatementInspection */ case 'T': $ret *= 1024; + /** @noinspection PhpMissingBreakStatementInspection */ case 'G': $ret *= 1024; + /** @noinspection PhpMissingBreakStatementInspection */ case 'M': $ret *= 1024; case 'K': diff --git a/lib/plugins/revert/lang/no/lang.php b/lib/plugins/revert/lang/no/lang.php index 6806dcd93..76da8ca9c 100644 --- a/lib/plugins/revert/lang/no/lang.php +++ b/lib/plugins/revert/lang/no/lang.php @@ -19,6 +19,7 @@ * @author Thomas Juberg <Thomas.Juberg@Gmail.com> * @author Boris <boris@newton-media.no> * @author Christopher Schive <chschive@frisurf.no> + * @author Patrick <spill.p@hotmail.com> */ $lang['menu'] = 'Tilbakestillingsbehandler'; $lang['filter'] = 'Søk etter søppelmeldinger'; diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php index 4a301f927..9e2913d78 100644 --- a/lib/plugins/syntax.php +++ b/lib/plugins/syntax.php @@ -52,6 +52,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin { * 'stack' - Special case. Plugin wraps other paragraphs. * * @see Doku_Handler_Block + * * @return string */ function getPType(){ @@ -70,7 +71,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin { * @param int $state The lexer state for the match * @param int $pos The character position of the matched text * @param Doku_Handler $handler The Doku_Handler object - * @return array Return an array with all data you want to use in render + * @return bool|array Return an array with all data you want to use in render, false don't add an instruction */ function handle($match, $state, $pos, Doku_Handler $handler){ trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING); @@ -94,10 +95,10 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin { * The contents of the $data array depends on what the handler() function above * created * - * @param $format string output format being rendered - * @param $renderer Doku_Renderer the current renderer object - * @param $data array data created by handler() - * @return boolean rendered correctly? + * @param string $format output format being rendered + * @param Doku_Renderer $renderer the current renderer object + * @param array $data data created by handler() + * @return boolean rendered correctly? (however, returned value is not used at the moment) */ function render($format, Doku_Renderer $renderer, $data) { trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING); diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php index b67d91b36..86562f1dd 100644 --- a/lib/plugins/usermanager/admin.php +++ b/lib/plugins/usermanager/admin.php @@ -58,9 +58,12 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { } } - /** - * Return prompt for admin menu - */ + /** + * Return prompt for admin menu + * + * @param string $language + * @return string + */ public function getMenuText($language) { if (!is_null($this->_auth)) @@ -71,6 +74,8 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { /** * return sort order for position in admin menu + * + * @return int */ public function getMenuSort() { return 2; @@ -78,6 +83,8 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { /** * Handle user request + * + * @return bool */ public function handle() { global $INPUT; @@ -128,6 +135,8 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { /** * Output appropriate html + * + * @return bool */ public function html() { global $ID; @@ -738,6 +747,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { global $auth; global $INPUT; + $user = array(); $user[0] = ($clean) ? $auth->cleanUser($INPUT->str('userid')) : $INPUT->str('userid'); $user[1] = $INPUT->str('userpass'); $user[2] = $INPUT->str('username'); @@ -764,7 +774,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { $this->_filter = array(); if ($op == 'new') { - list($user,$pass,$name,$mail,$grps) = $this->_retrieveUser(false); + list($user,/* $pass */,$name,$mail,$grps) = $this->_retrieveUser(false); if (!empty($user)) $this->_filter['user'] = $user; if (!empty($name)) $this->_filter['name'] = $name; @@ -816,6 +826,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { $disabled = 'disabled="disabled"'; + $buttons = array(); $buttons['start'] = $buttons['prev'] = ($this->_start == 0) ? $disabled : ''; if ($this->_user_total == -1) { @@ -937,8 +948,8 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { * Returns cleaned user data * * @param array $candidate raw values of line from input file - * @param $error - * @return array|bool cleaned data or false + * @param string $error + * @return array|false cleaned data or false */ protected function _cleanImportUser($candidate, & $error){ global $INPUT; @@ -951,7 +962,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { $INPUT->set('usergroups', $candidate[4]); $cleaned = $this->_retrieveUser(); - list($user,$pass,$name,$mail,$grps) = $cleaned; + list($user,/* $pass */,$name,$mail,/* $grps */) = $cleaned; if (empty($user)) { $error = $this->lang['import_error_baduserid']; return false; @@ -1021,6 +1032,9 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { /** * wrapper for is_uploaded_file to facilitate overriding by test suite + * + * @param string $file filename + * @return bool */ protected function _isUploadedFile($file) { return is_uploaded_file($file); @@ -1031,6 +1045,9 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { * * @deprecated remove when dokuwiki php requirement increases to 5.3+ * also associated unit test & mock access method + * + * @param string $csv string to parse + * @return array */ protected function _getcsv($csv) { return function_exists('str_getcsv') ? str_getcsv($csv) : $this->str_getcsv($csv); @@ -1041,6 +1058,9 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { * loosely based on www.php.net/str_getcsv#88311 * * @deprecated remove when dokuwiki php requirement increases to 5.3+ + * + * @param string $str string to parse + * @return array */ protected function str_getcsv($str) { $fp = fopen("php://temp/maxmemory:1048576", 'r+'); // 1MiB diff --git a/lib/plugins/usermanager/lang/cs/lang.php b/lib/plugins/usermanager/lang/cs/lang.php index bbb560679..6fbfe8535 100644 --- a/lib/plugins/usermanager/lang/cs/lang.php +++ b/lib/plugins/usermanager/lang/cs/lang.php @@ -15,6 +15,7 @@ * @author Jakub A. Těšínský (j@kub.cz) * @author mkucera66@seznam.cz * @author Zbyněk Křivka <krivka@fit.vutbr.cz> + * @author Jaroslav Lichtblau <jlichtblau@seznam.cz> */ $lang['menu'] = 'Správa uživatelů'; $lang['noauth'] = '(autentizace uživatelů není k dispozici)'; @@ -62,6 +63,8 @@ $lang['add_ok'] = 'Uživatel úspěšně vytvořen'; $lang['add_fail'] = 'Vytvoření uživatele selhalo'; $lang['notify_ok'] = 'Odeslán mail s upozorněním'; $lang['notify_fail'] = 'Mail s upozorněním nebylo možno odeslat'; +$lang['import_userlistcsv'] = 'Seznam uživatelů (CSV):'; +$lang['import_header'] = 'Poslední selhání importu'; $lang['import_success_count'] = 'Import uživatelů: nalezeno %d uživatelů, %d úspěšně importováno.'; $lang['import_failure_count'] = 'Import uživatelů: %d selhalo. Seznam chybných je níže.'; $lang['import_error_fields'] = 'Nedostatek položek, nalezena/y %d, požadovány 4.'; diff --git a/lib/plugins/usermanager/lang/da/import.txt b/lib/plugins/usermanager/lang/da/import.txt new file mode 100644 index 000000000..8ff1946b8 --- /dev/null +++ b/lib/plugins/usermanager/lang/da/import.txt @@ -0,0 +1,9 @@ +===== Samling af Brugere Import ===== + +Kræver en CSV-fil med brugere på mindst fire kolonner. +Kolonnerne skal indeholde, i denne orden: bruger-id, fulde navn, email-adresse og grupper. +CSV-felterne skal separeres af kommaer (,) og strengafgrænser med anførelsestegn (%%""%%). Backslash (\) kan benyttes som "escape character". +For et eksempel på en brugbar fil, kan du prøve "Eksportér Brugere"-funktionen her over. +Overlappende bruger-id'er bliver ignoreret. + +En adgangskode vil blive genereret og sendt til hver succesfuldt importeret bruger.
\ No newline at end of file diff --git a/lib/plugins/usermanager/lang/da/lang.php b/lib/plugins/usermanager/lang/da/lang.php index 47d7efea2..795024f89 100644 --- a/lib/plugins/usermanager/lang/da/lang.php +++ b/lib/plugins/usermanager/lang/da/lang.php @@ -13,6 +13,7 @@ * @author Michael Pedersen subben@gmail.com * @author Mikael Lyngvig <mikael@lyngvig.org> * @author soer9648 <soer9648@eucl.dk> + * @author Søren Birk <soer9648@eucl.dk> */ $lang['menu'] = 'Brugerstyring'; $lang['noauth'] = '(Brugervalidering er ikke tilgængelig)'; @@ -72,3 +73,4 @@ $lang['import_error_upload'] = 'Import Fejlet. CSV-filen kunne ikke uploades e $lang['import_error_readfail'] = 'Import Fejlet. Ikke muligt at læse uploadede fil.'; $lang['import_error_create'] = 'Ikke muligt at oprette brugeren'; $lang['import_notify_fail'] = 'Notifikationsmeddelelse kunne ikke sendes for importerede bruger %s, med emailen %s.'; +$lang['import_downloadfailures'] = 'Download Fejl som CSV til rettelser'; diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index 6b46add07..fb61f6e48 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -56,6 +56,8 @@ var dw_behaviour = { jQuery(document).on('click','#page__revisions input[type=checkbox]', dw_behaviour.revisionBoxHandler ); + + jQuery('.bounce').effect('bounce', {times:10}, 2000 ); }, /** @@ -64,7 +66,14 @@ var dw_behaviour = { scrollToMarker: function(){ var $obj = jQuery('#scroll__here'); if($obj.length) { - $obj[0].scrollIntoView(); + if($obj.offset().top != 0) { + jQuery('html, body').animate({ + scrollTop: $obj.offset().top - 100 + }, 500); + } else { + // hidden object have no offset but can still be scrolled into view + $obj[0].scrollIntoView(); + } } }, @@ -77,13 +86,11 @@ var dw_behaviour = { /** * Remove all search highlighting when clicking on a highlighted term - * - * @FIXME would be nice to have it fade out */ removeHighlightOnClick: function(){ jQuery('span.search_hit').click( function(e){ - jQuery(e.target).removeClass('search_hit'); + jQuery(e.target).removeClass('search_hit', 1000); } ); }, diff --git a/lib/tpl/dokuwiki/detail.php b/lib/tpl/dokuwiki/detail.php index 9bd841d8c..d4f9c39d1 100644 --- a/lib/tpl/dokuwiki/detail.php +++ b/lib/tpl/dokuwiki/detail.php @@ -82,8 +82,8 @@ header('X-UA-Compatible: IE=edge,chrome=1'); $data = array( 'view' => 'detail', 'items' => array( - 'mediaManager' => tpl_action('mediaManager', 1, 'li', 1, '<span>', '</span>'), - 'img_backto' => tpl_action('img_backto', 1, 'li', 1, '<span>', '</span>'), + 'mediaManager' => tpl_action('mediaManager', true, 'li', true, '<span>', '</span>'), + 'img_backto' => tpl_action('img_backto', true, 'li', true, '<span>', '</span>'), ) ); diff --git a/lib/tpl/dokuwiki/images/pagetools-build.php b/lib/tpl/dokuwiki/images/pagetools-build.php index 1b7262ad5..3cf35b2ea 100644 --- a/lib/tpl/dokuwiki/images/pagetools-build.php +++ b/lib/tpl/dokuwiki/images/pagetools-build.php @@ -92,7 +92,7 @@ function hex2rgb($hex) { /** * Scale (darken/lighten) a given image * - * @param ressource $img The truetype GD image to work on + * @param resource $img The truetype GD image to work on * @param float $scale Scale the colors by this value ( <1 darkens, >1 lightens) */ function imagecolorscale(&$img, $scale){ diff --git a/lib/tpl/dokuwiki/main.php b/lib/tpl/dokuwiki/main.php index 44fef81eb..10c0bf91e 100644 --- a/lib/tpl/dokuwiki/main.php +++ b/lib/tpl/dokuwiki/main.php @@ -41,7 +41,7 @@ $showSidebar = $hasSidebar && ($ACT=='show'); <div class="content"> <?php tpl_flush() ?> <?php tpl_includeFile('sidebarheader.html') ?> - <?php tpl_include_page($conf['sidebar'], 1, 1) ?> + <?php tpl_include_page($conf['sidebar'], true, true) ?> <?php tpl_includeFile('sidebarfooter.html') ?> </div> </div></div><!-- /aside --> @@ -77,12 +77,12 @@ $showSidebar = $hasSidebar && ($ACT=='show'); $data = array( 'view' => 'main', 'items' => array( - 'edit' => tpl_action('edit', 1, 'li', 1, '<span>', '</span>'), - 'revert' => tpl_action('revert', 1, 'li', 1, '<span>', '</span>'), - 'revisions' => tpl_action('revisions', 1, 'li', 1, '<span>', '</span>'), - 'backlink' => tpl_action('backlink', 1, 'li', 1, '<span>', '</span>'), - 'subscribe' => tpl_action('subscribe', 1, 'li', 1, '<span>', '</span>'), - 'top' => tpl_action('top', 1, 'li', 1, '<span>', '</span>') + 'edit' => tpl_action('edit', true, 'li', true, '<span>', '</span>'), + 'revert' => tpl_action('revert', true, 'li', true, '<span>', '</span>'), + 'revisions' => tpl_action('revisions', true, 'li', true, '<span>', '</span>'), + 'backlink' => tpl_action('backlink', true, 'li', true, '<span>', '</span>'), + 'subscribe' => tpl_action('subscribe', true, 'li', true, '<span>', '</span>'), + 'top' => tpl_action('top', true, 'li', true, '<span>', '</span>') ) ); diff --git a/lib/tpl/dokuwiki/tpl_header.php b/lib/tpl/dokuwiki/tpl_header.php index a2bfd4346..7d9c88347 100644 --- a/lib/tpl/dokuwiki/tpl_header.php +++ b/lib/tpl/dokuwiki/tpl_header.php @@ -46,10 +46,10 @@ if (!defined('DOKU_INC')) die(); tpl_userinfo(); /* 'Logged in as ...' */ echo '</li>'; } - tpl_action('admin', 1, 'li'); - tpl_action('profile', 1, 'li'); - tpl_action('register', 1, 'li'); - tpl_action('login', 1, 'li'); + tpl_action('admin', true, 'li'); + tpl_action('profile', true, 'li'); + tpl_action('register', true, 'li'); + tpl_action('login', true, 'li'); ?> </ul> </div> @@ -64,9 +64,9 @@ if (!defined('DOKU_INC')) die(); </div> <ul> <?php - tpl_action('recent', 1, 'li'); - tpl_action('media', 1, 'li'); - tpl_action('index', 1, 'li'); + tpl_action('recent', true, 'li'); + tpl_action('media', true, 'li'); + tpl_action('index', true, 'li'); ?> </ul> </div> |