diff options
author | Adrian Lang <mail@adrianlang.de> | 2011-05-08 20:55:40 +0200 |
---|---|---|
committer | Adrian Lang <mail@adrianlang.de> | 2011-05-08 20:55:40 +0200 |
commit | 9199737c351d653a1d384cb50ed0d185f6512826 (patch) | |
tree | 2da4dbc0b92a72c767712549b6d90f53b0a3605e /inc | |
parent | e68653d8ef3df043761e4042c563d65731f9b9c6 (diff) | |
parent | 2b537ba8dc1863d603770c208ae4f91d4d0877b9 (diff) | |
download | rpg-9199737c351d653a1d384cb50ed0d185f6512826.tar.gz rpg-9199737c351d653a1d384cb50ed0d185f6512826.tar.bz2 |
Merge branch 'master' into stable
Conflicts:
doku.php
Diffstat (limited to 'inc')
-rw-r--r-- | inc/PassHash.class.php | 2 | ||||
-rw-r--r-- | inc/actions.php | 4 | ||||
-rw-r--r-- | inc/common.php | 4 | ||||
-rw-r--r-- | inc/fulltext.php | 24 | ||||
-rw-r--r-- | inc/indexer.php | 18 | ||||
-rw-r--r-- | inc/infoutils.php | 33 | ||||
-rw-r--r-- | inc/lang/bg/lang.php | 2 | ||||
-rw-r--r-- | inc/lang/cs/lang.php | 8 | ||||
-rw-r--r-- | inc/lang/es/lang.php | 4 | ||||
-rw-r--r-- | inc/lang/eu/lang.php | 3 | ||||
-rw-r--r-- | inc/lang/ko/lang.php | 15 | ||||
-rw-r--r-- | inc/lang/pt-br/lang.php | 56 | ||||
-rw-r--r-- | inc/lang/pt-br/subscr_digest.txt | 9 | ||||
-rw-r--r-- | inc/lang/pt-br/subscr_list.txt | 19 | ||||
-rw-r--r-- | inc/lang/pt-br/subscr_single.txt | 10 | ||||
-rw-r--r-- | inc/lang/zh/lang.php | 5 | ||||
-rw-r--r-- | inc/parser/metadata.php | 2 | ||||
-rw-r--r-- | inc/parser/xhtml.php | 2 | ||||
-rw-r--r-- | inc/parserutils.php | 124 | ||||
-rw-r--r-- | inc/search.php | 2 | ||||
-rw-r--r-- | inc/template.php | 16 |
21 files changed, 246 insertions, 116 deletions
diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php index cb46c5928..541de6752 100644 --- a/inc/PassHash.class.php +++ b/inc/PassHash.class.php @@ -126,7 +126,7 @@ class PassHash { return crypt($clear,'$1$'.$salt.'$'); }else{ // Fall back to PHP-only implementation - return $this->apr1($clear, $salt, '1'); + return $this->hash_apr1($clear, $salt, '1'); } } diff --git a/inc/actions.php b/inc/actions.php index fa11bb7f1..a36fdfd5b 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -190,6 +190,7 @@ function act_sendheaders($headers) { function act_clean($act){ global $lang; global $conf; + global $INFO; // check if the action was given as array key if(is_array($act)){ @@ -219,6 +220,9 @@ function act_clean($act){ return 'show'; } + //is there really a draft? + if($act == 'draft' && !file_exists($INFO['draft'])) return 'edit'; + if(!in_array($act,array('login','logout','register','save','cancel','edit','draft', 'preview','search','show','check','index','revisions', 'diff','recent','backlink','admin','subscribe','revert', diff --git a/inc/common.php b/inc/common.php index ac7ddd653..7522095ab 100644 --- a/inc/common.php +++ b/inc/common.php @@ -284,7 +284,7 @@ function breadcrumbs(){ $name = noNSorNS($ID); if (useHeading('navigation')) { // get page title - $title = p_get_first_heading($ID,true); + $title = p_get_first_heading($ID,METADATA_RENDER_USING_SIMPLE_CACHE); if ($title) { $name = $title; } @@ -845,7 +845,7 @@ function pageTemplate($id){ // load the content $data['tpl'] = io_readFile($data['tplfile']); } - if($data['doreplace']) parsePageTemplate(&$data); + if($data['doreplace']) parsePageTemplate($data); } $evt->advise_after(); unset($evt); diff --git a/inc/fulltext.php b/inc/fulltext.php index 8155325ee..6ab710d54 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -230,22 +230,21 @@ function _ft_pageLookup(&$data){ foreach ($page_idx as $p_id) { if ((strpos($in_ns ? $p_id : noNSorNS($p_id), $cleaned) !== false)) { if (!isset($pages[$p_id])) - $pages[$p_id] = p_get_first_heading($p_id, false); + $pages[$p_id] = p_get_first_heading($p_id, METADATA_DONT_RENDER); } } if ($in_title) { - $wildcard_id = "*$id*"; - foreach ($Indexer->lookupKey('title', $wildcard_id) as $p_id) { + foreach ($Indexer->lookupKey('title', $id, '_ft_pageLookupTitleCompare') as $p_id) { if (!isset($pages[$p_id])) - $pages[$p_id] = p_get_first_heading($p_id, false); + $pages[$p_id] = p_get_first_heading($p_id, METADATA_DONT_RENDER); } } } + if (isset($ns)) { - foreach ($page_idx as $p_id) { - if (strpos($p_id, $ns) === 0) { - if (!isset($pages[$p_id])) - $pages[$p_id] = p_get_first_heading($p_id, false); + foreach (array_keys($pages) as $p_id) { + if (strpos($p_id, $ns) !== 0) { + unset($pages[$p_id]); } } } @@ -265,6 +264,15 @@ 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. + */ +function _ft_pageLookupTitleCompare($search, $title) { + return stripos($title, $search) !== false; +} + +/** * Sort pages based on their namespace level first, then on their string * values. This makes higher hierarchy pages rank higher than lower hierarchy * pages. diff --git a/inc/indexer.php b/inc/indexer.php index 714feb4f7..3b4796676 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -489,6 +489,9 @@ class Doku_Indexer { foreach ($result as $word => $res) { $final[$word] = array(); foreach ($res as $wid) { + // handle the case when ($ixid < count($index)) has been false + // and thus $docs[$wid] hasn't been set. + if (!isset($docs[$wid])) continue; $hits = &$docs[$wid]; foreach ($hits as $hitkey => $hitcnt) { // make sure the document still exists @@ -857,6 +860,8 @@ class Doku_Indexer { $fh = @fopen($fn.'.tmp', 'w'); if (!$fh) return false; fwrite($fh, join("\n", $lines)); + if (!empty($lines)) + fwrite($fh, "\n"); fclose($fh); if (isset($conf['fperm'])) chmod($fn.'.tmp', $conf['fperm']); @@ -1161,13 +1166,14 @@ 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 * @author Tom N Harris <tnharris@whoopdedo.org> */ -function idx_addPage($page, $verbose=false) { +function idx_addPage($page, $verbose=false, $force=false) { // check if indexing needed $idxtag = metaFN($page,'.indexed'); - if(@file_exists($idxtag)){ + if(!$force && @file_exists($idxtag)){ if(trim(io_readFile($idxtag)) == idx_get_version()){ $last = @filemtime($idxtag); if($last > @filemtime(wikiFN($page))){ @@ -1191,7 +1197,7 @@ function idx_addPage($page, $verbose=false) { @unlink($idxtag); return $result; } - $indexenabled = p_get_metadata($page, 'internal index', true); + $indexenabled = p_get_metadata($page, 'internal index', METADATA_RENDER_UNLIMITED); if ($indexenabled === false) { $result = false; if (@file_exists($idxtag)) { @@ -1209,8 +1215,8 @@ function idx_addPage($page, $verbose=false) { $body = ''; $metadata = array(); - $metadata['title'] = p_get_metadata($page, 'title', true); - if (($references = p_get_metadata($page, 'relation references', true)) !== null) + $metadata['title'] = p_get_metadata($page, 'title', METADATA_RENDER_UNLIMITED); + if (($references = p_get_metadata($page, 'relation references', METADATA_RENDER_UNLIMITED)) !== null) $metadata['relation_references'] = array_keys($references); else $metadata['relation_references'] = array(); @@ -1317,7 +1323,7 @@ function idx_listIndexLengths() { $dir = @opendir($conf['indexdir']); if ($dir === false) return array(); - $idx[] = array(); + $idx = array(); while (($f = readdir($dir)) !== false) { if (substr($f, 0, 1) == 'i' && substr($f, -4) == '.idx') { $i = substr($f, 1, -4); diff --git a/inc/infoutils.php b/inc/infoutils.php index 5f406aa3e..786661d01 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -176,7 +176,8 @@ function check(){ } if($conf['authtype'] == 'plain'){ - if(is_writable(DOKU_CONF.'users.auth.php')){ + global $config_cascade; + if(is_writable($config_cascade['plainauth.users']['default'])){ msg('conf/users.auth.php is writable',1); }else{ msg('conf/users.auth.php is not writable',0); @@ -238,6 +239,36 @@ function check(){ Make sure this directory is properly protected (See <a href="http://www.dokuwiki.org/security">security</a>)',-1); } + + // Check for corrupted search index + $lengths = idx_listIndexLengths(); + $index_corrupted = false; + foreach ($lengths as $length) { + if (count(idx_getIndex('w', $length)) != count(idx_getIndex('i', $length))) { + $index_corrupted = true; + break; + } + } + + foreach (idx_getIndex('metadata', '') as $index) { + if (count(idx_getIndex($index.'_w', '')) != count(idx_getIndex($index.'_i', ''))) { + $index_corrupted = true; + break; + } + } + + if ($index_corrupted) + msg('The search index is corrupted. It might produce wrong results and most + probably needs to be rebuilt. See + <a href="http://www.dokuwiki.org/faq:searchindex">faq:searchindex</a> + for ways to rebuild the search index.', -1); + elseif (!empty($lengths)) + msg('The search index seems to be working', 1); + else + msg('The search index is empty. See + <a href="http://www.dokuwiki.org/faq:searchindex">faq:searchindex</a> + for help on how to fix the search index. If the default indexer + isn\'t used or the wiki is actually empty this is normal.'); } /** diff --git a/inc/lang/bg/lang.php b/inc/lang/bg/lang.php index 1acf39acb..3f8460286 100644 --- a/inc/lang/bg/lang.php +++ b/inc/lang/bg/lang.php @@ -241,7 +241,7 @@ $lang['i_wikiname'] = 'Име на Wiki-то'; $lang['i_enableacl'] = 'Ползване на списък за достъп (ACL) [препоръчително]'; $lang['i_superuser'] = 'Супер потребител'; $lang['i_problems'] = 'Открити са проблеми, които възпрепятстват инсталирането. Ще можете да продължите след като отстраните долуизброените проблеми.'; -$lang['i_modified'] = 'Поради мерки за сигурност инсталатора работи само с нова и непроменена инсталация на Dokuwiki. Трябва да разархивирате отново файловете от сваления архив или да се посъветвате с <a href="http://dokuwiki.org/install">Инструкциите за инсталиране на Dokuwiki</a>.'; +$lang['i_modified'] = 'Поради мерки за сигурност инсталаторът работи само с нови и непроменени инсталационни файлове. Трябва да разархивирате отново файловете от сваления архив или да се посъветвате с <a href="http://dokuwiki.org/install">Инструкциите за инсталиране на Dokuwiki</a>.'; $lang['i_funcna'] = 'PHP функцията <code>%s</code> не е достъпна. Може би е забранена от доставчика на хостинг.'; $lang['i_phpver'] = 'Инсталираната версия <code>%s</code> на PHP е по-стара от необходимата <code>%s</code>. Актуализирайте PHP инсталацията.'; $lang['i_permfail'] = '<code>%s</code> не е достъпна за писане от DokuWiki. Трябва да промените правата за достъп до директорията!'; diff --git a/inc/lang/cs/lang.php b/inc/lang/cs/lang.php index 22aa00d7d..e1c45e0c9 100644 --- a/inc/lang/cs/lang.php +++ b/inc/lang/cs/lang.php @@ -9,6 +9,7 @@ * @author Zbynek Krivka <zbynek.krivka@seznam.cz> * @author Marek Sacha <sachamar@fel.cvut.cz> * @author Lefty <lefty@multihost.cz> + * @author Vojta Beran <xmamut@email.cz> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -158,9 +159,12 @@ $lang['quickhits'] = 'Odpovídající stránky'; $lang['toc'] = 'Obsah'; $lang['current'] = 'aktuální'; $lang['yours'] = 'Vaše verze'; -$lang['diff'] = 'zobrazit rozdíly vůči aktuální verzi'; -$lang['diff2'] = 'zobrazit rozdíly mezi vybranými verzemi'; +$lang['diff'] = 'Zobrazit rozdíly vůči aktuální verzi'; +$lang['diff2'] = 'Zobrazit rozdíly mezi vybranými verzemi'; $lang['difflink'] = 'Odkaz na výstup diff'; +$lang['diff_type'] = 'Prohlédnout rozdíly:'; +$lang['diff_inline'] = 'Vložené'; +$lang['diff_side'] = 'Přidané'; $lang['line'] = 'Řádek'; $lang['breadcrumb'] = 'Historie'; $lang['youarehere'] = 'Umístění'; diff --git a/inc/lang/es/lang.php b/inc/lang/es/lang.php index 427f7e0a2..aad93c075 100644 --- a/inc/lang/es/lang.php +++ b/inc/lang/es/lang.php @@ -23,6 +23,7 @@ * @author Fernando J. Gómez <fjgomez@gmail.com> * @author Victor Castelan <victorcastelan@gmail.com> * @author Mauro Javier Giamberardino <mgiamberardino@gmail.com> + * @author emezeta <emezeta@infoprimo.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -175,6 +176,9 @@ $lang['yours'] = 'Tu versión'; $lang['diff'] = 'Muestra diferencias a la versión actual'; $lang['diff2'] = 'Muestra las diferencias entre las revisiones seleccionadas'; $lang['difflink'] = 'Enlace a la vista de comparación'; +$lang['diff_type'] = 'Ver diferencias'; +$lang['diff_inline'] = 'En línea'; +$lang['diff_side'] = 'Lado a lado'; $lang['line'] = 'Línea'; $lang['breadcrumb'] = 'Traza'; $lang['youarehere'] = 'Estás aquí'; diff --git a/inc/lang/eu/lang.php b/inc/lang/eu/lang.php index 503b20b30..e49290e5e 100644 --- a/inc/lang/eu/lang.php +++ b/inc/lang/eu/lang.php @@ -157,6 +157,9 @@ $lang['yours'] = 'Zure Bertsioa'; $lang['diff'] = 'egungo bertsioarekin dituen aldaketak aurkezten ditu'; $lang['diff2'] = 'Erakutsi desberdintasunak aukeratutako bertsioen artean'; $lang['difflink'] = 'Estekatu konparaketa bista honetara'; +$lang['diff_type'] = 'Ikusi diferentziak:'; +$lang['diff_inline'] = 'Lerro tartean'; +$lang['diff_side'] = 'Ondoz ondo'; $lang['line'] = 'Marra'; $lang['breadcrumb'] = 'Traza'; $lang['youarehere'] = 'Hemen zaude'; diff --git a/inc/lang/ko/lang.php b/inc/lang/ko/lang.php index 0b45c6ce0..c85a66d38 100644 --- a/inc/lang/ko/lang.php +++ b/inc/lang/ko/lang.php @@ -87,7 +87,7 @@ $lang['resendpwdsuccess'] = '새로운 패스워드는 이메일로 보내 $lang['license'] = '이 위키의 내용은 다음의 라이센스에 따릅니다 :'; $lang['licenseok'] = '주의 : 이 페이지를 수정한다는 다음의 라이센스에 동의함을 의미합니다 :'; $lang['searchmedia'] = '파일이름 찾기:'; -$lang['searchmedia_in'] = ' %에서 검색'; +$lang['searchmedia_in'] = ' %s에서 검색'; $lang['txt_upload'] = '업로드 파일을 선택합니다.'; $lang['txt_filename'] = '업로드 파일 이름을 입력합니다.(선택 사항)'; $lang['txt_overwrt'] = '새로운 파일로 이전 파일을 교체합니다.'; @@ -107,6 +107,7 @@ $lang['js']['mediatarget'] = '링크 목표'; $lang['js']['mediaclose'] = '닫기'; $lang['js']['mediainsert'] = '삽입'; $lang['js']['mediadisplayimg'] = '그림보기'; +$lang['js']['mediadisplaylnk'] = '링크만 보여줍니다.'; $lang['js']['mediasmall'] = '작게'; $lang['js']['mediamedium'] = '중간'; $lang['js']['medialarge'] = '크게'; @@ -158,6 +159,10 @@ $lang['current'] = '현재'; $lang['yours'] = '버전'; $lang['diff'] = '현재 버전과의 차이 보기'; $lang['diff2'] = '선택된 버전들 간 차이 보기'; +$lang['difflink'] = '차이 보기로 연결'; +$lang['diff_type'] = '버전간 차이 표시:'; +$lang['diff_inline'] = '인라인 방식'; +$lang['diff_side'] = '다중창 방식'; $lang['line'] = '줄'; $lang['breadcrumb'] = '추적'; $lang['youarehere'] = '현재 위치'; @@ -215,7 +220,13 @@ $lang['img_copyr'] = '저작권'; $lang['img_format'] = '포맷'; $lang['img_camera'] = '카메라'; $lang['img_keywords'] = '키워드'; -$lang['subscr_subscribe_noaddress'] = '등록된 주소가 없기 때문에 구독목록에 등록되지 않았습니다.'; +$lang['subscr_subscribe_success'] = '%s을(를) 구독목록 %s에 추가하였습니다'; +$lang['subscr_subscribe_error'] = '%s을(를) 구독목록 %s에 추가하는데 실패했습니다'; +$lang['subscr_subscribe_noaddress'] = '등록된 주소가 없기 때문에 구독목록에 등록되지 않았습니다'; +$lang['subscr_unsubscribe_success'] = '%s을(를) 구독목록 %s에서 제거하였습니다'; +$lang['subscr_unsubscribe_error'] = '%s을(를) 구독목록 %s에서 제거하는데 실패했습니다'; +$lang['subscr_already_subscribed'] = '%s은(는) 이미 %s에 구독되고 있습니다'; +$lang['subscr_not_subscribed'] = '%s은(는) 이미 %s에 구독되어 있지 않습니다'; $lang['subscr_m_not_subscribed'] = '현재의 페이지나 네임스페이스에 구독등록이 되어있지 않습니다.'; $lang['subscr_m_new_header'] = '구독 추가'; $lang['subscr_m_current_header'] = '현재 구독중인 것들'; diff --git a/inc/lang/pt-br/lang.php b/inc/lang/pt-br/lang.php index e3568b56b..f3b012521 100644 --- a/inc/lang/pt-br/lang.php +++ b/inc/lang/pt-br/lang.php @@ -17,6 +17,7 @@ * @author Jair Henrique <jair.henrique@gmail.com> * @author Sergio Motta <sergio@cisne.com.br> * @author Isaias Masiero Filho <masiero@masiero.org> + * @author Frederico Guimarães <frederico@teia.bio.br> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -41,7 +42,7 @@ $lang['btn_upload'] = 'Enviar'; $lang['btn_cancel'] = 'Cancelar'; $lang['btn_index'] = 'Índice'; $lang['btn_secedit'] = 'Editar'; -$lang['btn_login'] = 'Autenticar-se'; +$lang['btn_login'] = 'Entrar'; $lang['btn_logout'] = 'Sair'; $lang['btn_admin'] = 'Administrar'; $lang['btn_update'] = 'Atualizar'; @@ -49,21 +50,21 @@ $lang['btn_delete'] = 'Excluir'; $lang['btn_back'] = 'Voltar'; $lang['btn_backlink'] = 'Links reversos'; $lang['btn_backtomedia'] = 'Voltar à seleção do arquivo de mídia'; -$lang['btn_subscribe'] = 'Monitorar alterações na página'; +$lang['btn_subscribe'] = 'Monitorar alterações'; $lang['btn_profile'] = 'Atualizar o perfil'; $lang['btn_reset'] = 'Limpar'; -$lang['btn_resendpwd'] = 'Enviar uma nova senha'; +$lang['btn_resendpwd'] = 'Envie-me uma nova senha'; $lang['btn_draft'] = 'Editar o rascunho'; $lang['btn_recover'] = 'Recuperar o rascunho'; $lang['btn_draftdel'] = 'Excluir o rascunho'; -$lang['btn_revert'] = 'Restaure'; -$lang['btn_register'] = 'Registrar'; -$lang['loggedinas'] = 'Autenticado(a) como'; +$lang['btn_revert'] = 'Restaurar'; +$lang['btn_register'] = 'Cadastre-se'; +$lang['loggedinas'] = 'Identificado(a) como'; $lang['user'] = 'Nome de usuário'; $lang['pass'] = 'Senha'; $lang['newpass'] = 'Nova senha'; $lang['oldpass'] = 'Confirme a senha atual'; -$lang['passchk'] = 'mais uma vez'; +$lang['passchk'] = 'Outra vez'; $lang['remember'] = 'Lembre-se de mim'; $lang['fullname'] = 'Nome completo'; $lang['email'] = 'E-mail'; @@ -80,12 +81,12 @@ $lang['regmailfail'] = 'Aparentemente ocorreu um erro no envio da senh $lang['regbadmail'] = 'O endereço de e-mail fornecido é, aparentemente, inválido - se você acha que isso é um erro, entre em contato com o administrador'; $lang['regbadpass'] = 'As senhas digitadas não são idênticas. Por favor, tente novamente.'; $lang['regpwmail'] = 'A sua senha do DokuWiki'; -$lang['reghere'] = 'Ainda não tem uma conta? Cadastre-se para obter uma.'; +$lang['reghere'] = 'Ainda não tem uma conta? Crie uma'; $lang['profna'] = 'Esse wiki não suporta modificações do perfil.'; $lang['profnochange'] = 'Sem alterações, nada para fazer.'; $lang['profnoempty'] = 'Não são permitidos nomes ou endereços de e-mail em branco.'; $lang['profchanged'] = 'O perfil do usuário foi atualizado com sucesso.'; -$lang['pwdforget'] = 'Esqueceu sua senha? Obtenha uma nova.'; +$lang['pwdforget'] = 'Esqueceu sua senha? Solicite outra'; $lang['resendna'] = 'Esse wiki não tem suporte para o reenvio de senhas.'; $lang['resendpwd'] = 'Enviar a nova senha para'; $lang['resendpwdmissing'] = 'Desculpe, você deve preencher todos os campos.'; @@ -150,7 +151,7 @@ $lang['uploadsize'] = 'O arquivo transmitido era grande demais. (max. $lang['deletesucc'] = 'O arquivo "%s" foi excluído.'; $lang['deletefail'] = 'Não foi possível excluir "%s" - verifique as permissões.'; $lang['mediainuse'] = 'O arquivo "%s" não foi excluído - ele ainda está em uso.'; -$lang['namespaces'] = 'Espaços de nome'; +$lang['namespaces'] = 'Espaços de nomes'; $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:'; @@ -169,6 +170,9 @@ $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['diff_type'] = 'Ver as diferenças:'; +$lang['diff_inline'] = 'Mescladas'; +$lang['diff_side'] = 'Lado a lado'; $lang['line'] = 'Linha'; $lang['breadcrumb'] = 'Visitou'; $lang['youarehere'] = 'Você está aqui'; @@ -183,7 +187,7 @@ $lang['noflash'] = 'O <a href="http://www.adobe.com/products/flash $lang['download'] = 'Download Snippet'; $lang['mail_newpage'] = 'página adicionada:'; $lang['mail_changed'] = 'página modificada:'; -$lang['mail_subscribe_list'] = 'páginas alteradas no namespace:'; +$lang['mail_subscribe_list'] = 'páginas alteradas no espaço de nomes:'; $lang['mail_new_user'] = 'novo usuário:'; $lang['mail_upload'] = 'arquivo enviado:'; $lang['qb_bold'] = 'Texto em negrito'; @@ -226,22 +230,22 @@ $lang['img_copyr'] = 'Direitos autorais'; $lang['img_format'] = 'Formato'; $lang['img_camera'] = 'Câmera'; $lang['img_keywords'] = 'Palavras-chave'; -$lang['subscr_subscribe_success'] = 'Adicionado %s para a lista de inscrição para %s'; -$lang['subscr_subscribe_error'] = 'Erro adicionando %s para a lista de inscrição para %s'; -$lang['subscr_subscribe_noaddress'] = 'Não há endereço associado com seu login, você não pode ser adicionado à lista de inscrição'; -$lang['subscr_unsubscribe_success'] = 'Removido %s da lista de inscrição para %s'; -$lang['subscr_unsubscribe_error'] = 'Erro removendo %s da lista de inscrição para %s'; -$lang['subscr_already_subscribed'] = '%s já está inscrito para s%'; -$lang['subscr_not_subscribed'] = 's% não está inscrito para s%'; -$lang['subscr_m_not_subscribed'] = 'Voce não está inscrito na pagina ou namespace corrent'; -$lang['subscr_m_new_header'] = 'Adicionar inscrição'; -$lang['subscr_m_current_header'] = 'Inscrições correntes'; -$lang['subscr_m_unsubscribe'] = 'cancelar inscrição'; -$lang['subscr_m_subscribe'] = 'Inscrição'; +$lang['subscr_subscribe_success'] = 'Adicionado %s à lista de monitoramentos de %s'; +$lang['subscr_subscribe_error'] = 'Ocorreu um erro na adição de %s à lista de monitoramentos de %s'; +$lang['subscr_subscribe_noaddress'] = 'Como não há nenhum endereço associado ao seu usuário, você não pode ser adicionado à lista de monitoramento'; +$lang['subscr_unsubscribe_success'] = '%s foi removido da lista de monitoramento de %s'; +$lang['subscr_unsubscribe_error'] = 'Ocorreu um erro na remoção de %s da lista de monitoramentos de %s'; +$lang['subscr_already_subscribed'] = '%s já está monitorando s%'; +$lang['subscr_not_subscribed'] = 's% não está monitorando s%'; +$lang['subscr_m_not_subscribed'] = 'Você não está monitorando nem a página atual nem o espaço de nomes.'; +$lang['subscr_m_new_header'] = 'Adicionar monitoramento'; +$lang['subscr_m_current_header'] = 'Monitoramentos atuais'; +$lang['subscr_m_unsubscribe'] = 'Cancelar monitoramento'; +$lang['subscr_m_subscribe'] = 'Monitorar'; $lang['subscr_m_receive'] = 'Receber'; -$lang['subscr_style_every'] = 'email em cada modificação'; -$lang['subscr_style_digest'] = 'digerir emails de mudanças para cada página (A cada %.2f dias)'; -$lang['subscr_style_list'] = 'Lista de mudanças desde o último email (A cada %.2f dias)'; +$lang['subscr_style_every'] = 'um e-mail a cada modificação'; +$lang['subscr_style_digest'] = 'um agrupamento de e-mails com as mudanças para cada página (a cada %.2f dias)'; +$lang['subscr_style_list'] = 'uma lista de páginas modificadas desde o último e-mail (a cada %.2f dias)'; $lang['authmodfailed'] = 'A configuração da autenticação de usuário está com problemas. Por favor, informe ao administrador do wiki.'; $lang['authtempfail'] = 'A autenticação de usuários está temporariamente desabilitada. Se essa situação persistir, por favor, informe ao administrador do Wiki.'; $lang['i_chooselang'] = 'Selecione o seu idioma'; diff --git a/inc/lang/pt-br/subscr_digest.txt b/inc/lang/pt-br/subscr_digest.txt index 6632b1f57..77f76e1c3 100644 --- a/inc/lang/pt-br/subscr_digest.txt +++ b/inc/lang/pt-br/subscr_digest.txt @@ -1,6 +1,6 @@ Olá! -A página @PAGE@ na wiki @TITLE@ mudou. +A página @PAGE@ na wiki @TITLE@ foi modificada. Estas foram as mudanças: -------------------------------------------------------- @@ -10,8 +10,11 @@ Estas foram as mudanças: Revisão antiga:@OLDPAGE@ Nova Revisão:@NEWPAGE@ -Para cancelar a página de notificações, entre na wiki @DOKUWIKIURL@ -e então visite a página de @SUBSCRIBE@ e cancele a inscrição de edição da página ou namespace. +Para cancelar as notificações de mudanças, entre em +@DOKUWIKIURL@, vá até @SUBSCRIBE@ +e cancele o monitoramento da página e/ou do espaço de +nomes. + -- Este e-mail foi gerado pelo DokuWiki em @DOKUWIKIURL@ diff --git a/inc/lang/pt-br/subscr_list.txt b/inc/lang/pt-br/subscr_list.txt index 8f4a66d1a..c6011d063 100644 --- a/inc/lang/pt-br/subscr_list.txt +++ b/inc/lang/pt-br/subscr_list.txt @@ -1,14 +1,25 @@ Olá! -Páginas no namespace @PAGE@ na wiki @TITLE@ mudaram. -Estas foram as mudanças: +Páginas no espaço de nomes @PAGE@ na wiki +@TITLE@ foram modificadas. +Estas são as páginas modificadas: -------------------------------------------------------- @DIFF@ -------------------------------------------------------- -Para cancelar a página de notificações, entre na wiki @DOKUWIKIURL@ -e então visite a página de @SUBSCRIBE@ e cancele a inscrição de edição da página ou namespace. +Para cancelar as notificações de alterações, entre em +@DOKUWIKIURL@, vá até @SUBSCRIBE@ +e cancele o monitoramento da página e/ou do espaço de +nomes. + + +Para cancelar as notificações de páginas, entre na wiki @DOKUWIKIURL@ +e então visite @SUBSCRIBE@ e cancele a inscrição de edição da página ou namespace. + + +Para cancelar a página de notificações, entre na wiki @DOKUWIKIURL@, +visite a página de @SUBSCRIBE@ e cancele a inscrição de edição da página ou namespace. -- Este e-mail foi gerado pelo DokuWiki em @DOKUWIKIURL@ diff --git a/inc/lang/pt-br/subscr_single.txt b/inc/lang/pt-br/subscr_single.txt index 1a103558c..b1c052e84 100644 --- a/inc/lang/pt-br/subscr_single.txt +++ b/inc/lang/pt-br/subscr_single.txt @@ -1,6 +1,6 @@ Olá! -A página @PAGE@ na wiki @TITLE@ mudou. +A página @PAGE@ na wiki @TITLE@ foi alterada. Estas foram as mudanças: -------------------------------------------------------- @@ -13,8 +13,10 @@ Sumário : @SUMMARY@ Revisão antiga:@OLDPAGE@ Nova Revisão:@NEWPAGE@ -Para cancelar a página de notificações, entre na wiki @DOKUWIKIURL@ visite @NEWPAGE@ -e cancele a inscrição de edição da página ou namespace. +Para cancelar as notificações de mudanças, entre em +@DOKUWIKIURL@, vá até @NEWPAGE@ +e cancele o monitoramento da página e/ou do espaço de +nomes. -- Este e-mail foi gerado pelo DokuWiki em -@DOKUWIKIURL@ +@DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/zh/lang.php b/inc/lang/zh/lang.php index ea677ac2e..14c92c4b3 100644 --- a/inc/lang/zh/lang.php +++ b/inc/lang/zh/lang.php @@ -12,6 +12,7 @@ * @author lainme <lainme993@gmail.com> * @author caii <zhoucaiqi@gmail.com> * @author Hiphen Lee <jacob.b.leung@gmail.com> + * @author caii, patent agent in China <zhoucaiqi@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -34,7 +35,7 @@ $lang['btn_revs'] = '修订记录'; $lang['btn_recent'] = '最近更改'; $lang['btn_upload'] = '上传'; $lang['btn_cancel'] = '取消'; -$lang['btn_index'] = '索引'; +$lang['btn_index'] = '网站地图'; $lang['btn_secedit'] = '编辑'; $lang['btn_login'] = '登录'; $lang['btn_logout'] = '退出'; @@ -165,6 +166,8 @@ $lang['diff'] = '显示与当前版本的差别'; $lang['diff2'] = '显示跟目前版本的差异'; $lang['difflink'] = '到此差别页面的链接'; $lang['diff_type'] = '查看差异:'; +$lang['diff_inline'] = '行内显示'; +$lang['diff_side'] = '并排显示'; $lang['line'] = '行'; $lang['breadcrumb'] = '您的足迹'; $lang['youarehere'] = '您在这里'; diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index fc2c8cbc5..136c37531 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -457,7 +457,7 @@ class Doku_Renderer_metadata extends Doku_Renderer { $isImage = false; if (is_null($title)){ if (useHeading('content') && $id){ - $heading = p_get_first_heading($id,false); + $heading = p_get_first_heading($id,METADATA_DONT_RENDER); if ($heading) return $heading; } return $default; diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index ab295dd01..1041268b1 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -1144,7 +1144,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { return $this->_imageTitle($title); } elseif ( is_null($title) || trim($title)=='') { if (useHeading($linktype) && $id) { - $heading = p_get_first_heading($id,true); + $heading = p_get_first_heading($id); if ($heading) { return $this->_xmlEntities($heading); } diff --git a/inc/parserutils.php b/inc/parserutils.php index 9b2d99328..abba89b5a 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -10,11 +10,43 @@ if(!defined('DOKU_INC')) die('meh.'); /** - * For how many different pages shall the first heading be loaded from the - * metadata? When this limit is reached the title index is loaded and used for - * all following requests. + * How many pages shall be rendered for getting metadata during one request + * at maximum? Note that this limit isn't respected when METADATA_RENDER_UNLIMITED + * is passed as render parameter to p_get_metadata. */ -if (!defined('P_GET_FIRST_HEADING_METADATA_LIMIT')) define('P_GET_FIRST_HEADING_METADATA_LIMIT', 10); +if (!defined('P_GET_METADATA_RENDER_LIMIT')) define('P_GET_METADATA_RENDER_LIMIT', 5); + +/** Don't render metadata even if it is outdated or doesn't exist */ +define('METADATA_DONT_RENDER', 0); +/** + * Render metadata when the page is really newer or the metadata doesn't exist. + * Uses just a simple check, but should work pretty well for loading simple + * metadata values like the page title and avoids rendering a lot of pages in + * one request. The P_GET_METADATA_RENDER_LIMIT is used in this mode. + * Use this if it is unlikely that the metadata value you are requesting + * does depend e.g. on pages that are included in the current page using + * the include plugin (this is very likely the case for the page title, but + * not for relation references). + */ +define('METADATA_RENDER_USING_SIMPLE_CACHE', 1); +/** + * Render metadata using the metadata cache logic. The P_GET_METADATA_RENDER_LIMIT + * is used in this mode. Use this mode when you are requesting more complex + * metadata. Although this will cause rendering more often it might actually have + * the effect that less current metadata is returned as it is more likely than in + * the simple cache mode that metadata needs to be rendered for all pages at once + * which means that when the metadata for the page is requested that actually needs + * to be updated the limit might have been reached already. + */ +define('METADATA_RENDER_USING_CACHE', 2); +/** + * Render metadata without limiting the number of pages for which metadata is + * rendered. Use this mode with care, normally it should only be used in places + * like the indexer or in cli scripts where the execution time normally isn't + * limited. This can be combined with the simple cache using + * METADATA_RENDER_USING_CACHE | METADATA_RENDER_UNLIMITED. + */ +define('METADATA_RENDER_UNLIMITED', 4); /** * Returns the parsed Wikitext in XHTML for the given id and revision. @@ -229,14 +261,21 @@ function p_get_instructions($text){ * * @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 boolean $render If the page should be rendererd when the cache can't be used - default true + * @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 * @return mixed The requested metadata fields * * @author Esther Brunner <esther@kaffeehaus.ch> * @author Michael Hamann <michael@content-space.de> */ -function p_get_metadata($id, $key='', $render=true){ +function p_get_metadata($id, $key='', $render=METADATA_RENDER_USING_CACHE){ global $ID; + static $render_count = 0; + // track pages that have already been rendered in order to avoid rendering the same page + // again + static $rendered_pages = array(); // cache the current page // Benchmarking shows the current page's metadata is generally the only page metadata @@ -244,14 +283,36 @@ function p_get_metadata($id, $key='', $render=true){ $cache = ($ID == $id); $meta = p_read_metadata($id, $cache); + if (!is_numeric($render)) { + if ($render) { + $render = METADATA_RENDER_USING_SIMPLE_CACHE; + } else { + $render = METADATA_DONT_RENDER; + } + } + // prevent recursive calls in the cache static $recursion = false; - if (!$recursion && $render){ + if (!$recursion && $render != METADATA_DONT_RENDER && !isset($rendered_pages[$id])&& page_exists($id)){ $recursion = true; $cachefile = new cache_renderer($id, wikiFN($id), 'metadata'); - if (page_exists($id) && !$cachefile->useCache()){ + $do_render = false; + if ($render & METADATA_RENDER_UNLIMITED || $render_count < P_GET_METADATA_RENDER_LIMIT) { + if ($render & METADATA_RENDER_USING_SIMPLE_CACHE) { + $pagefn = wikiFN($id); + $metafn = metaFN($id, '.meta'); + if (!@file_exists($metafn) || @filemtime($pagefn) > @filemtime($cachefile->cache)) { + $do_render = true; + } + } elseif (!$cachefile->useCache()){ + $do_render = true; + } + } + if ($do_render) { + ++$render_count; + $rendered_pages[$id] = true; $old_meta = $meta; $meta = p_render_metadata($id, $meta); // only update the file when the metadata has been changed @@ -648,49 +709,18 @@ function & p_get_renderer($mode) { * Gets the first heading from a file * * @param string $id dokuwiki page id - * @param bool $render rerender if first heading not known - * default: true -- must be set to false for calls from the metadata renderer to - * protects against loops and excessive resource usage when pages - * for which only a first heading is required will attempt to - * render metadata for all the pages for which they require first - * headings ... and so on. + * @param int $render rerender if first heading not known + * default: METADATA_RENDER_USING_SIMPLE_CACHE + * Possible values: METADATA_DONT_RENDER, + * METADATA_RENDER_USING_SIMPLE_CACHE, + * METADATA_RENDER_USING_CACHE, + * METADATA_RENDER_UNLIMITED * * @author Andreas Gohr <andi@splitbrain.org> * @author Michael Hamann <michael@content-space.de> */ -function p_get_first_heading($id, $render=true){ - // counter how many titles have been requested using p_get_metadata - static $count = 1; - // the index of all titles, only loaded when many titles are requested - static $title_index = null; - // cache for titles requested using p_get_metadata - static $title_cache = array(); - - $id = cleanID($id); - - // check if this title has already been requested - if (isset($title_cache[$id])) - return $title_cache[$id]; - - // check if already too many titles have been requested and probably - // using the title index is better - if ($count > P_GET_FIRST_HEADING_METADATA_LIMIT) { - if (is_null($title_index)) { - $pages = array_map('rtrim', idx_getIndex('page', '')); - $titles = array_map('rtrim', idx_getIndex('title', '')); - // check for corrupt title index #FS2076 - if(count($pages) != count($titles)){ - $titles = array_fill(0,count($pages),''); - @unlink($conf['indexdir'].'/title.idx'); // will be rebuilt in inc/init.php - } - $title_index = array_combine($pages, $titles); - } - return $title_index[$id]; - } - - ++$count; - $title_cache[$id] = p_get_metadata($id,'title',$render); - return $title_cache[$id]; +function p_get_first_heading($id, $render=METADATA_RENDER_USING_SIMPLE_CACHE){ + return p_get_metadata(cleanID($id),'title',$render); } /** diff --git a/inc/search.php b/inc/search.php index db0b008f0..7b53edabe 100644 --- a/inc/search.php +++ b/inc/search.php @@ -616,7 +616,7 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ if($type == 'f'){ if($opts['hash']) $item['hash'] = md5(io_readFile($base.'/'.$file,false)); - if($opts['firsthead']) $item['title'] = p_get_first_heading($item['id'],false); + if($opts['firsthead']) $item['title'] = p_get_first_heading($item['id'],METADATA_DONT_RENDER); } // finally add the item diff --git a/inc/template.php b/inc/template.php index 0f0fb92a0..b9b3951ff 100644 --- a/inc/template.php +++ b/inc/template.php @@ -155,7 +155,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, true); + $meta = p_get_metadata($ID, false, METADATA_RENDER_USING_CACHE); if(isset($meta['internal']['toc'])){ $tocok = $meta['internal']['toc']; }else{ @@ -986,7 +986,7 @@ function tpl_indexerWebBug(){ $p = array(); $p['src'] = DOKU_BASE.'lib/exe/indexer.php?id='.rawurlencode($ID). '&'.time(); - $p['width'] = 1; + $p['width'] = 2; $p['height'] = 1; $p['alt'] = ''; $att = buildAttributes($p); @@ -1346,9 +1346,15 @@ function tpl_flush(){ * * @author Anika Henke <anika@selfthinker.org> */ -function tpl_getFavicon() { - if (file_exists(mediaFN('favicon.ico'))) - return ml('favicon.ico'); +function tpl_getFavicon($abs=false) { + if (file_exists(mediaFN('favicon.ico'))) { + return ml('favicon.ico', '', true, '', $abs); + } + + if($abs) { + return DOKU_URL.substr(DOKU_TPL.'images/favicon.ico', strlen(DOKU_REL)); + } + return DOKU_TPL.'images/favicon.ico'; } |