Skip to content

Commit

Permalink
Synced with cziehr
Browse files Browse the repository at this point in the history
  • Loading branch information
turnermm committed Sep 17, 2020
1 parent 2be3a53 commit 032df59
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
8 changes: 6 additions & 2 deletions action.php
Expand Up @@ -17,10 +17,14 @@ function handle_act(Doku_Event $event, $param) {
if($act != 'login') {
return;
}
$auto_login = $this->getConf('auto_login');
if(!$auto_login) return;
$user = $_SERVER['REMOTE_USER'];
if(!$user) return;
$auto_login = $this->getConf('auto_login');
if(!$auto_login) {
setcookie("GOTO_LOGIN",":$user" , time()+120, DOKU_BASE); //setup user for possible ~~GOTO>user~~
return;
}


$which_only = $this->getConf('only_option');
if($which_only == 'default') {
Expand Down
8 changes: 8 additions & 0 deletions lang/ru/lang.php
@@ -0,0 +1,8 @@
<?php
/*
English language file
%d will be replaced with a link to the destination.
%s will be replaced with the number of seconds before redirect.
*/
$lang['redirect']="Вы будете перенаправлены на страницу %d примерно через %s секунд.";
23 changes: 23 additions & 0 deletions lang/ru/settings.php
@@ -0,0 +1,23 @@
<?php

/**
* @author Intervision https://github.com/intervisionlord
* v.0.5
*/
$lang['seconds'] = 'Время до редиректа (сек)';
$lang['minSeconds'] = 'Минимально разрешенное время ожидания перед редиректом (сек)';
$lang['auto_login'] = 'При входе автоматически перенаправлять на преднастроенную страницу, указанную в <code>auto_options</code> и/или настройках<code>group options</code>.';
$lang['auto_options'] = 'Цель редиректа при входе. В любом случае <b>user</b> используется для перенаправления в пространство имен \'user\' ' .
'. Если имя пользователя "foo", то ":user_page" будет ":foo"; ' .
' "user_ns:user_page" в таком случае будет ":foo:foo"; ":user_ns:start_page" будет ":foo:start". <b>common_ns</b> ' .
'определяется в настройках <code>common_ns</code>.';
$lang['common_ns'] = 'An arbitrarily defined namespace of any depth where all auto login pages will reside. This can include the wildcard <code>user_ns<code>';
$lang['group'] = 'Группа пространств имен, на которые пользователи могут быть перенаправлены (через запятую). Разные пользователи могут быть в разных группах. Если пользователь состоит в двух группах, то будет перенаправлен в первую указанную.';
$lang['group_options'] = "Пользователь модет быть перенаправлен или на начальную страницу группы или на страницу пользователя в пространстве группы.";
/*
$lang['group_only'] ="Redirect only to group namespaces, i.e. not to user namespaces and pages";
$lang['user_only'] = "Redirect to user namespaces and pages only, i.e. not to group namespaces.";
*/
$lang['only_option'] = '<b><code>group</code></b> перенаправляет только на группу пространства имен и их страницы; ' .
'<b><code>user</code></b> для пространства имен пользователей и их страниц; ' .
'<b><code>default</code></b> to either, with group having precedence.';
2 changes: 1 addition & 1 deletion plugin.info.txt
@@ -1,7 +1,7 @@
base goto
author Allen Ormond
email aormond@gmail.com
date 2017-02-16
date 2020-09-17
name GOTO
desc Easily redirect to other pages in your wiki.
url https://www.dokuwiki.org/plugin:goto
4 changes: 2 additions & 2 deletions script.js
Expand Up @@ -7,7 +7,7 @@ function goto_redirect(which,mode) {
location.href = which;
return;
}
var user = goto_getCookie("DOKU_GOTO");
var user = goto_getCookie("GOTO_LOGIN");
if(!user) {
return;
}
Expand All @@ -16,7 +16,7 @@ function goto_redirect(which,mode) {
which = which.replace(/user/, user);
}
location.href = which;
setGotoCookie("DOKU_GOTO", "") ;
setGotoCookie("GOTO_LOGIN", "") ;


}
Expand Down

0 comments on commit 032df59

Please sign in to comment.