Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/splitbrain/dokuwiki
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakan Sandell committed Oct 3, 2010
2 parents 831c10d + c1e6807 commit 7cceaa7
Show file tree
Hide file tree
Showing 23 changed files with 355 additions and 160 deletions.
61 changes: 0 additions & 61 deletions _test/cases/inc/indexer_idx_indexlengths.test.php
Expand Up @@ -56,66 +56,5 @@ function test_minValue() {
}
}

class indexer_idx_indexlengths_time extends UnitTestCase {

/**
* Test the time improvments of the new function
* Time reference for 10000 call oneWords: 4,6s
* It's 90% faster
*/
function test_oneWord(){
global $conf;
$filter[8] = array('dokuwiki');
$start = microtime(true);
for ($i = 0; $i < 10000; $i++) {
$result = idx_indexLengths(&$filter);
}
$end = microtime(true);
$time = $end - $start;
$timeref = 4.6*0.10; // actual execution time of 4,6s for 10000 calls
echo "1) 10% ref : $timeref -> $time \n";
$this->assertTrue($time < $timeref);
}

/**
* Test the time improvments of the new function
* Time reference for 10000 call moreWords: 4,6s
* It's 90% faster
*/
function test_moreWords() {
global $conf;
$filter = array( 4 => array('test'), 8 => array('dokuwiki'), 7 => array('powered'));
// more words should return the indexes
$start = microtime(true);
for ($i = 0; $i < 10000; $i++) {
$result = idx_indexLengths(&$filter);
}
$end = microtime(true);
$time = $end - $start;
$timeref = 4.6*0.10; // actual execution time of 4,6s for 10000 calls
echo "2) 10% ref : $timeref -> $time \n";
$this->assertTrue($time < $timeref);
}

/**
* Test the time improvments of the new function
* Time reference for 10000 call on minValue: 4,9s
* Sould be at least 65% faster
* Test fail with no cache
*/
function test_minValue() {
global $conf;
$filter = 5;
$start = microtime(true);
for ($i = 0; $i < 10000; $i++) {
$result = idx_indexLengths(&$filter);
}
$end = microtime(true);
$time = $end - $start;
$timeref = 4.9 * 0.35; // actual execution time of 4,9s for 10000 calls
echo "3) 35% ref : $timeref -> $time \n";
$this->assertTrue($time < $timeref);
}
}

//Setup VIM: ex: et ts=4 enc=utf-8 :
8 changes: 8 additions & 0 deletions _test/lib/cli_reporter.php
Expand Up @@ -61,6 +61,14 @@ function paintFail($message) {
}
}

/**
* reset failinfo
*/
function paintPass($message) {
parent::paintPass($message);
$this->_failinfo = '';
}

/**
* Paint exception faildetail to STDERR.
*/
Expand Down
5 changes: 3 additions & 2 deletions inc/common.php
Expand Up @@ -987,9 +987,10 @@ function saveWikiText($id,$text,$summary,$minor=false){
$mfiles = metaFiles($id);
$changelog = metaFN($id, '.changes');
$metadata = metaFN($id, '.meta');
$subscribers = metaFN($id, '.mlist');
foreach ($mfiles as $mfile) {
// but keep per-page changelog to preserve page history and keep meta data
if (@file_exists($mfile) && $mfile!==$changelog && $mfile!==$metadata) { @unlink($mfile); }
// but keep per-page changelog to preserve page history, keep subscriber list and keep meta data
if (@file_exists($mfile) && $mfile!==$changelog && $mfile!==$metadata && $mfile!==$subscribers) { @unlink($mfile); }
}
// purge meta data
p_purge_metadata($id);
Expand Down
24 changes: 21 additions & 3 deletions inc/fulltext.php
Expand Up @@ -313,7 +313,7 @@ function ft_snippet($id,$highlight){
$len = utf8_strlen($text);

// build a regexp from the phrases to highlight
$re1 = '('.join('|',array_map('preg_quote_cb',array_filter((array) $highlight))).')';
$re1 = '('.join('|',array_map('ft_snippet_re_preprocess', array_map('preg_quote_cb',array_filter((array) $highlight)))).')';
$re2 = "$re1.{0,75}(?!\\1)$re1";
$re3 = "$re1.{0,45}(?!\\1)$re1.{0,45}(?!\\1)(?!\\2)$re1";

Expand Down Expand Up @@ -386,6 +386,24 @@ function ft_snippet($id,$highlight){
return $evdata['snippet'];
}

/**
* Wraps a search term in regex boundary checks.
*/
function ft_snippet_re_preprocess($term) {
if(substr($term,0,2) == '\\*'){
$term = substr($term,2);
}else{
$term = '\b'.$term;
}

if(substr($term,-2,2) == '\\*'){
$term = substr($term,0,-2);
}else{
$term = $term.'\b';
}
return $term;
}

/**
* Combine found documents and sum up their scores
*
Expand Down Expand Up @@ -678,15 +696,15 @@ function ft_queryParser($query){
break;
case 'W+:':
$q['words'][] = $body;
$q['highlight'][] = str_replace('*', '', $body);
$q['highlight'][] = $body;
$q['and'][] = $body; // for backward compatibility
break;
case 'P-:':
$q['phrases'][] = $body;
break;
case 'P+:':
$q['phrases'][] = $body;
$q['highlight'][] = str_replace('*', '', $body);
$q['highlight'][] = $body;
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion inc/html.php
Expand Up @@ -285,7 +285,7 @@ function html_draft(){
*/
function html_hilight($html,$phrases){
$phrases = array_filter((array) $phrases);
$regex = join('|',array_map('preg_quote_cb',$phrases));
$regex = join('|',array_map('ft_snippet_re_preprocess', array_map('preg_quote_cb',$phrases)));

if ($regex === '') return $html;
$html = preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html);
Expand Down
4 changes: 2 additions & 2 deletions inc/lang/en/index.txt
@@ -1,4 +1,4 @@
====== Index ======
====== Sitemap ======

This is an index over all available pages ordered by [[doku>namespaces|namespaces]].
This is a sitemap over all available pages ordered by [[doku>namespaces|namespaces]].

2 changes: 1 addition & 1 deletion inc/lang/en/lang.php
Expand Up @@ -29,7 +29,7 @@
$lang['btn_recent'] = 'Recent changes';
$lang['btn_upload'] = 'Upload';
$lang['btn_cancel'] = 'Cancel';
$lang['btn_index'] = 'Index';
$lang['btn_index'] = 'Sitemap';
$lang['btn_secedit']= 'Edit';
$lang['btn_login'] = 'Login';
$lang['btn_logout'] = 'Logout';
Expand Down
9 changes: 6 additions & 3 deletions inc/lang/pt-br/lang.php
Expand Up @@ -17,8 +17,9 @@
* @author Jair Henrique <jair.henrique@gmail.com>
* @author Luis Dantas <luisdantas@gmail.com>
* @author Sergio Motta sergio@cisne.com.br
* @author Isaias Masiero Filho <masiero@masiero.org>
*/
$lang['encoding'] = 'utf-8';
$lang['encoding'] = 'utf-8<';
$lang['direction'] = 'ltr';
$lang['doublequoteopening'] = '“';
$lang['doublequoteclosing'] = '”';
Expand Down Expand Up @@ -121,7 +122,7 @@
$lang['js']['mediamedium'] = 'Versão Média';
$lang['js']['medialarge'] = 'Versão Grande';
$lang['js']['mediaoriginal'] = 'Versão Original';
$lang['js']['medialnk'] = 'Link para pagina de detalhes';
$lang['js']['medialnk'] = 'Link para página de detalhes';
$lang['js']['mediadirect'] = 'Link direto para original';
$lang['js']['medianolnk'] = 'Sem Link';
$lang['js']['medianolink'] = 'Sem link na imagem';
Expand Down Expand Up @@ -152,6 +153,7 @@
$lang['mediainuse'] = 'O arquivo "%s" não foi excluído - ele ainda está em uso.';
$lang['namespaces'] = 'Espaços de nome';
$lang['mediafiles'] = 'Arquivos disponíveis em';
$lang['accessdenied'] = 'Você não tem permissão para visualizar esta página.';
$lang['mediausage'] = 'Use a seguinte sintaxe para referenciar esse arquivo:';
$lang['mediaview'] = 'Ver o arquivo original';
$lang['mediaroot'] = 'raiz';
Expand All @@ -167,6 +169,7 @@
$lang['yours'] = 'Sua versão';
$lang['diff'] = 'Mostrar diferenças com a revisão atual';
$lang['diff2'] = 'Mostrar diferenças entre as revisões selecionadas';
$lang['difflink'] = 'Link para esta página de comparações';
$lang['line'] = 'Linha';
$lang['breadcrumb'] = 'Visitou';
$lang['youarehere'] = 'Você está aqui';
Expand All @@ -188,7 +191,7 @@
$lang['qb_italic'] = 'Texto em itálico';
$lang['qb_underl'] = 'Texto sublinhado';
$lang['qb_code'] = 'Texto de código';
$lang['qb_strike'] = 'Texto riscado';
$lang['qb_strike'] = 'Texto tachado';
$lang['qb_h1'] = 'Cabeçalho de nível 1';
$lang['qb_h2'] = 'Cabeçalho de nível 2';
$lang['qb_h3'] = 'Cabeçalho de nível 3';
Expand Down
2 changes: 1 addition & 1 deletion inc/parser/handler.php
Expand Up @@ -440,7 +440,7 @@ function internallink($match, $state, $pos) {
array($link[0],$link[1],strtolower($interwiki[0]),$interwiki[1]),
$pos
);
}elseif ( preg_match('/^\\\\\\\\[\w.:?\-;,]+?\\\\/u',$link[0]) ) {
}elseif ( preg_match('/^\\\\\\\\[^\\\\]+?\\\\/u',$link[0]) ) {
// Windows Share
$this->_addCall(
'windowssharelink',
Expand Down
2 changes: 1 addition & 1 deletion inc/template.php
Expand Up @@ -664,7 +664,7 @@ function tpl_searchform($ajax=true,$autocomplete=true){
// don't print the search form if search action has been disabled
if (!actionOk('search')) return false;

print '<form action="'.wl().'" accept-charset="utf-8" class="search" id="dw__search"><div class="no">';
print '<form action="'.wl().'" accept-charset="utf-8" class="search" id="dw__search" method="get"><div class="no">';
print '<input type="hidden" name="do" value="search" />';
print '<input type="text" ';
if($ACT == 'search') print 'value="'.htmlspecialchars($QUERY).'" ';
Expand Down
79 changes: 38 additions & 41 deletions lib/exe/detail.php
@@ -1,51 +1,48 @@
<?php
if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
define('DOKU_MEDIADETAIL',1);
require_once(DOKU_INC.'inc/init.php');
//close session
session_write_close();

$IMG = getID('media');
$ID = cleanID($_REQUEST['id']);

if($conf['allowdebug'] && $_REQUEST['debug']){
print '<pre>';
foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
print '$'."conf['$x'] = '".$conf[$x]."';\n";
}
foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '.
'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){
print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n";
}
print "getID('media'): ".getID('media')."\n";
print "getID('media',false): ".getID('media',false)."\n";
print '</pre>';
}

$ERROR = false;
// check image permissions
$AUTH = auth_quickaclcheck($IMG);
if($AUTH >= AUTH_READ){
if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
define('DOKU_MEDIADETAIL',1);
require_once(DOKU_INC.'inc/init.php');
//close session
session_write_close();

$IMG = getID('media');
$ID = cleanID($_REQUEST['id']);

if($conf['allowdebug'] && $_REQUEST['debug']){
print '<pre>';
foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
print '$'."conf['$x'] = '".$conf[$x]."';\n";
}
foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '.
'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){
print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n";
}
print "getID('media'): ".getID('media')."\n";
print "getID('media',false): ".getID('media',false)."\n";
print '</pre>';
}

$ERROR = false;
// check image permissions
$AUTH = auth_quickaclcheck($IMG);
if($AUTH >= AUTH_READ){
// check if image exists
$SRC = mediaFN($IMG);
if(!@file_exists($SRC)){
//doesn't exist!

//doesn't exist!
header("HTTP/1.0 404 File not Found");
$ERROR = 'File not found';
}
}else{
}else{
// no auth
$ERROR = p_locale_xhtml('denied');
}

/*if(!$ERROR){
// load EXIF/IPTC/image details
$INFO = array();
$INFO['std']['']
imagesize
}*/
}

// this makes some general infos available as well as the info about the
// "parent" page
$INFO = pageinfo();

//start output and load template
header('Content-Type: text/html; charset=utf-8');
include(template('detail.php'));
//start output and load template
header('Content-Type: text/html; charset=utf-8');
include(template('detail.php'));

1 change: 1 addition & 0 deletions lib/plugins/acl/lang/pt-br/lang.php
Expand Up @@ -17,6 +17,7 @@
* @author Jair Henrique <jair.henrique@gmail.com>
* @author Luis Dantas <luisdantas@gmail.com>
* @author Sergio Motta sergio@cisne.com.br
* @author Isaias Masiero Filho <masiero@masiero.org>
*/
$lang['admin_acl'] = 'Administração da Lista de Controles de Acesso';
$lang['acl_group'] = 'Grupo';
Expand Down
40 changes: 40 additions & 0 deletions lib/plugins/acl/rtl.css
@@ -0,0 +1,40 @@
div#acl_manager div#acl__tree {
float: right;
text-align: right;
}

div#acl_manager div#acl__tree li {
padding-left: 0em;
padding-right: 1em;
}

div#acl_manager div#acl__tree ul img {
margin-left: 0.25em;
margin-right: 0em;
}


div#acl_manager div#acl__detail {
float: left;
}

div#acl_manager .aclgroup {
background: transparent url(pix/group.png) right 1px no-repeat;
padding: 1px 18px 1px 0px;
}

div#acl_manager .acluser {
background: transparent url(pix/user.png) right 1px no-repeat;
padding: 1px 18px 1px 0px;
}

div#acl_manager .aclpage {
background: transparent url(pix/page.png) right 1px no-repeat;
padding: 1px 18px 1px 0px;
}

div#acl_manager .aclns {
background: transparent url(pix/ns.png) right 1px no-repeat;
padding: 1px 18px 1px 0px;
}

2 changes: 1 addition & 1 deletion lib/plugins/config/lang/en/lang.php
Expand Up @@ -161,7 +161,7 @@
$lang['proxy____port'] = 'Proxy port';
$lang['proxy____user'] = 'Proxy user name';
$lang['proxy____pass'] = 'Proxy password';
$lang['proxy____ssl'] = 'Use SLL to connect to proxy';
$lang['proxy____ssl'] = 'Use SSL to connect to proxy';
$lang['proxy____except'] = 'Regular expression to match URLs for which the proxy should be skipped for.';

/* Safemode Hack */
Expand Down
3 changes: 2 additions & 1 deletion lib/plugins/config/lang/pt-br/lang.php
Expand Up @@ -14,6 +14,7 @@
* @author Jair Henrique <jair.henrique@gmail.com>
* @author Luis Dantas <luisdantas@gmail.com>
* @author Sergio Motta sergio@cisne.com.br
* @author Isaias Masiero Filho <masiero@masiero.org>
*/
$lang['menu'] = 'Configurações do DokuWiki';
$lang['error'] = 'As configurações não foram atualizadas devido a um valor inválido. Por favor, reveja suas alterações e reenvie-as.<br />O(s) valor(es) incorreto(s) serão exibidos contornados por uma borda vermelha.';
Expand Down Expand Up @@ -169,7 +170,7 @@
$lang['rss_type_o_rss2'] = 'RSS 2.0';
$lang['rss_type_o_atom'] = 'Atom 0.3';
$lang['rss_type_o_atom1'] = 'Atom 1.0';
$lang['rss_content_o_abstract'] = 'abstrato';
$lang['rss_content_o_abstract'] = 'resumo';
$lang['rss_content_o_diff'] = 'diff unificado';
$lang['rss_content_o_htmldiff'] = 'tabela de diff formatada em HTML';
$lang['rss_content_o_html'] = 'conteúdo completo da página em HTML';
Expand Down

0 comments on commit 7cceaa7

Please sign in to comment.