Skip to content

Commit

Permalink
removed safemode hack
Browse files Browse the repository at this point in the history
Safemode has been removed in PHP 5.4.0. We finally no longer need to
deal with this insanity.
  • Loading branch information
splitbrain committed Jun 7, 2018
1 parent 9bd73f3 commit fe22708
Show file tree
Hide file tree
Showing 48 changed files with 6 additions and 341 deletions.
9 changes: 0 additions & 9 deletions conf/dokuwiki.php
Expand Up @@ -169,12 +169,3 @@
$conf['proxy']['pass'] = '';
$conf['proxy']['ssl'] = 0;
$conf['proxy']['except'] = '';
// Safemode Hack - read http://www.dokuwiki.org/config:safemodehack !
$conf['safemodehack'] = 0;
$conf['ftp']['host'] = 'localhost';
$conf['ftp']['port'] = '21';
$conf['ftp']['user'] = 'user';
$conf['ftp']['pass'] = 'password';
$conf['ftp']['root'] = '/home/user/htdocs';


54 changes: 3 additions & 51 deletions inc/io.php
Expand Up @@ -16,7 +16,6 @@
* $data[0] ns: The colon separated namespace path minus the trailing page name.
* $data[1] ns_type: 'pages' or 'media' namespace tree.
*
* @todo use safemode hack
* @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
Expand Down Expand Up @@ -400,8 +399,6 @@ function io_deleteFromFile($file,$badline,$regex=false){
*/
function io_lock($file){
global $conf;
// no locking if safemode hack
if($conf['safemodehack']) return;

$lockDir = $conf['lockdir'].'/'.md5($file);
@ignore_user_abort(1);
Expand All @@ -428,8 +425,6 @@ function io_lock($file){
*/
function io_unlock($file){
global $conf;
// no locking if safemode hack
if($conf['safemodehack']) return;

$lockDir = $conf['lockdir'].'/'.md5($file);
@rmdir($lockDir);
Expand Down Expand Up @@ -508,14 +503,9 @@ function io_mkdir_p($target){
if (file_exists($target) && !is_dir($target)) return 0;
//recursion
if (io_mkdir_p(substr($target,0,strrpos($target,'/')))){
if($conf['safemodehack']){
$dir = preg_replace('/^'.preg_quote(fullpath($conf['ftp']['root']),'/').'/','', $target);
return io_mkdir_ftp($dir);
}else{
$ret = @mkdir($target,$conf['dmode']); // crawl back up & create dir tree
if($ret && !empty($conf['dperm'])) chmod($target, $conf['dperm']);
return $ret;
}
$ret = @mkdir($target,$conf['dmode']); // crawl back up & create dir tree
if($ret && !empty($conf['dperm'])) chmod($target, $conf['dperm']);
return $ret;
}
return 0;
}
Expand Down Expand Up @@ -570,44 +560,6 @@ function io_rmdir($path, $removefiles = false) {
return false;
}

/**
* Creates a directory using FTP
*
* 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;

if(!function_exists('ftp_connect')){
msg("FTP support not found - safemode workaround not usable",-1);
return false;
}

$conn = @ftp_connect($conf['ftp']['host'],$conf['ftp']['port'],10);
if(!$conn){
msg("FTP connection failed",-1);
return false;
}

if(!@ftp_login($conn, $conf['ftp']['user'], conf_decodeString($conf['ftp']['pass']))){
msg("FTP login failed",-1);
return false;
}

//create directory
$ok = @ftp_mkdir($conn, $dir);
//set permissions
@ftp_site($conn,sprintf("CHMOD %04o %s",$conf['dmode'],$dir));

@ftp_close($conn);
return $ok;
}

/**
* Creates a unique temporary directory and returns
* its path.
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/ar/lang.php
Expand Up @@ -142,12 +142,6 @@
$lang['proxy____pass'] = 'كلمة سر الوكيل';
$lang['proxy____ssl'] = 'استخدم ssl للاتصال بالوكيل';
$lang['proxy____except'] = 'تعبير شرطي لمقابلة العناوين التي ستتجاوز البروكسي.';
$lang['safemodehack'] = 'مكّن hack الوضع الآمن';
$lang['ftp____host'] = 'خادوم FTP ل hack الوضع الآمن';
$lang['ftp____port'] = 'منفذ FTP ل hack الوضع الآمن';
$lang['ftp____user'] = 'اسم مستخدم FTP ل hack الوضع الآمن';
$lang['ftp____pass'] = 'كلمة سر FTP ل hack الوضع الآمن';
$lang['ftp____root'] = 'دليل الجذر ل FTP لأجل hack الوضع الآمن';
$lang['license_o_'] = 'غير مختار';
$lang['typography_o_0'] = 'لاشيء';
$lang['typography_o_1'] = 'استبعاد الاقتباس المفرد';
Expand Down
8 changes: 1 addition & 7 deletions lib/plugins/config/lang/bg/lang.php
Expand Up @@ -2,7 +2,7 @@

/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
*
* @author Nikolay Vladimirov <nikolay@vladimiroff.com>
* @author Viktor Usunov <usun0v@mail.bg>
* @author Kiril <neohidra@gmail.com>
Expand Down Expand Up @@ -145,12 +145,6 @@
$lang['proxy____pass'] = 'Парола за проксито';
$lang['proxy____ssl'] = 'Ползване на SSL при свързване с проксито';
$lang['proxy____except'] = 'Регулярен израз определящ за кои URL адреси да не се ползва прокси сървър.';
$lang['safemodehack'] = 'Ползване на хака safemode';
$lang['ftp____host'] = 'FTP сървър за хака safemode';
$lang['ftp____port'] = 'FTP порт за хака safemode';
$lang['ftp____user'] = 'FTP потребител за хака safemode';
$lang['ftp____pass'] = 'FTP парола за хака safemode';
$lang['ftp____root'] = 'FTP главна директория за хака safemode';
$lang['license_o_'] = 'Нищо не е избрано';
$lang['typography_o_0'] = 'без';
$lang['typography_o_1'] = 'с изключение на единични кавички';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/ca-valencia/lang.php
Expand Up @@ -128,12 +128,6 @@
$lang['proxy____user'] = 'Nom d\'usuari del proxy';
$lang['proxy____pass'] = 'Contrasenya del proxy';
$lang['proxy____ssl'] = 'Utilisar SSL per a conectar al proxy';
$lang['safemodehack'] = 'Activar \'hack\' de modo segur';
$lang['ftp____host'] = 'Servidor FTP per al \'hack\' de modo segur';
$lang['ftp____port'] = 'Port FTP per al \'hack\' de modo segur';
$lang['ftp____user'] = 'Nom de l\'usuari per al \'hack\' de modo segur';
$lang['ftp____pass'] = 'Contrasenya FTP per al \'hack\' de modo segur';
$lang['ftp____root'] = 'Directori base FTP per al \'hack\' de modo segur';
$lang['license_o_'] = 'Cap triada';
$lang['typography_o_0'] = 'cap';
$lang['typography_o_1'] = 'Excloure cometes simples';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/ca/lang.php
Expand Up @@ -139,12 +139,6 @@
$lang['proxy____user'] = 'Nom d\'usuari del servidor intermediari';
$lang['proxy____pass'] = 'Contrasenya del servidor intermediari';
$lang['proxy____ssl'] = 'Utilitza SSL per connectar amb el servidor intermediari';
$lang['safemodehack'] = 'Utilitza el hack per a safemode';
$lang['ftp____host'] = 'Servidor FTP per al hack de safemode';
$lang['ftp____port'] = 'Port FTP per al hack de safemode';
$lang['ftp____user'] = 'Nom d\'usuari FTP per al hack de safemode';
$lang['ftp____pass'] = 'Contrasenya FTP per al hack de safemode';
$lang['ftp____root'] = 'Directori arrel FTP per al hack de safemode';
$lang['license_o_'] = 'Cap selecció';
$lang['typography_o_0'] = 'cap';
$lang['typography_o_1'] = 'només cometes dobles';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/cs/lang.php
Expand Up @@ -177,12 +177,6 @@
$lang['proxy____pass'] = 'Proxy heslo';
$lang['proxy____ssl'] = 'Použít SSL při připojení k proxy';
$lang['proxy____except'] = 'Regulární výrazy pro URL, pro které bude přeskočena proxy.';
$lang['safemodehack'] = 'Zapnout safemode hack';
$lang['ftp____host'] = 'FTP server pro safemode hack';
$lang['ftp____port'] = 'FTP port pro safemode hack';
$lang['ftp____user'] = 'FTP uživatelské jméno pro safemode hack';
$lang['ftp____pass'] = 'FTP heslo pro safemode hack';
$lang['ftp____root'] = 'FTP kořenový adresář pro safemode hack';
$lang['license_o_'] = 'Nic nevybráno';
$lang['typography_o_0'] = 'vypnuto';
$lang['typography_o_1'] = 'Pouze uvozovky';
Expand Down
8 changes: 0 additions & 8 deletions lib/plugins/config/lang/cy/lang.php
Expand Up @@ -185,14 +185,6 @@
$lang['proxy____ssl'] = 'Defnyddio SSL i gysylltu â\'r procsi';
$lang['proxy____except'] = 'Mynegiad rheolaidd i gydweddu URL ar gyfer y procsi a ddylai cael eu hanwybyddu.';

/* Safemode Hack */
$lang['safemodehack'] = 'Galluogi safemode hack';
$lang['ftp____host'] = 'Gweinydd FTP safemode hack';
$lang['ftp____port'] = 'Porth FTP safemode hack';
$lang['ftp____user'] = 'Defnyddair FTP safemode hack';
$lang['ftp____pass'] = 'Cyfrinair FTP safemode hack';
$lang['ftp____root'] = 'Gwraiddffolder FTP safemode hack';

/* License Options */
$lang['license_o_'] = 'Dim wedi\'i ddewis';

Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/da/lang.php
Expand Up @@ -150,12 +150,6 @@
$lang['proxy____pass'] = 'Proxy-kodeord';
$lang['proxy____ssl'] = 'Brug SSL til at forbinde til proxy';
$lang['proxy____except'] = 'Regular expression til at matche URL\'er for hvilke proxier der skal ignores';
$lang['safemodehack'] = 'Slå "safemode hack" til ';
$lang['ftp____host'] = 'FTP-server til "safemode hack"';
$lang['ftp____port'] = 'FTP-port til "safemode hack"';
$lang['ftp____user'] = 'FTP-brugernavn til "safemode hack"';
$lang['ftp____pass'] = 'FTP-adgangskode til "safemode hack"';
$lang['ftp____root'] = 'FTP-rodmappe til "safemode hack"';
$lang['license_o_'] = 'Ingen valgt';
$lang['typography_o_0'] = 'ingen';
$lang['typography_o_1'] = 'Kun gåseøjne';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/de-informal/lang.php
Expand Up @@ -157,12 +157,6 @@
$lang['proxy____pass'] = 'Passwort von dem Proxybenutzer';
$lang['proxy____ssl'] = 'SSL verwenden um auf den Proxy zu zugreifen';
$lang['proxy____except'] = 'Regulärer Ausdruck um Adressen zu beschreiben, für die kein Proxy verwendet werden soll';
$lang['safemodehack'] = 'Aktiviere safemode Hack';
$lang['ftp____host'] = 'FTP Server für safemode Hack';
$lang['ftp____port'] = 'FTP Port für safemode Hack';
$lang['ftp____user'] = 'FTP Benutzername für safemode Hack';
$lang['ftp____pass'] = 'FTP Passwort für safemode Hack';
$lang['ftp____root'] = 'FTP Wurzelverzeichnis für Safemodehack';
$lang['license_o_'] = 'Nichts ausgewählt';
$lang['typography_o_0'] = 'nichts';
$lang['typography_o_1'] = 'ohne einfache Anführungszeichen';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/de/lang.php
Expand Up @@ -174,12 +174,6 @@
$lang['proxy____pass'] = 'Proxy Passwort';
$lang['proxy____ssl'] = 'SSL bei Verbindung zum Proxy verwenden';
$lang['proxy____except'] = 'Regulärer Ausdruck für URLs, bei denen kein Proxy verwendet werden soll';
$lang['safemodehack'] = 'Safemodehack verwenden';
$lang['ftp____host'] = 'FTP-Host für Safemodehack';
$lang['ftp____port'] = 'FTP-Port für Safemodehack';
$lang['ftp____user'] = 'FTP Benutzername für Safemodehack';
$lang['ftp____pass'] = 'FTP Passwort für Safemodehack';
$lang['ftp____root'] = 'FTP Wurzelverzeichnis für Safemodehack';
$lang['license_o_'] = 'Keine gewählt';
$lang['typography_o_0'] = 'keine';
$lang['typography_o_1'] = 'ohne einfache Anführungszeichen';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/el/lang.php
Expand Up @@ -149,12 +149,6 @@
$lang['proxy____pass'] = 'Κωδικός χρήστη Proxy';
$lang['proxy____ssl'] = 'Χρήση ssl για σύνδεση με διακομιστή Proxy';
$lang['proxy____except'] = 'Regular expression για να πιάνει τα URLs για τα οποία θα παρακάμπτεται το proxy.';
$lang['safemodehack'] = 'Ενεργοποίηση safemode hack';
$lang['ftp____host'] = 'Διακομιστής FTP για safemode hack';
$lang['ftp____port'] = 'Θύρα FTP για safemode hack';
$lang['ftp____user'] = 'Όνομα χρήστη FTP για safemode hack';
$lang['ftp____pass'] = 'Κωδικός χρήστη FTP για safemode hack';
$lang['ftp____root'] = 'Αρχικός φάκελος FTP για safemode hack';
$lang['license_o_'] = 'Δεν επελέγει άδεια';
$lang['typography_o_0'] = 'κανένα';
$lang['typography_o_1'] = 'μόνο διπλά εισαγωγικά';
Expand Down
8 changes: 0 additions & 8 deletions lib/plugins/config/lang/en/lang.php
Expand Up @@ -202,14 +202,6 @@
$lang['proxy____ssl'] = 'Use SSL to connect to proxy';
$lang['proxy____except'] = 'Regular expression to match URLs for which the proxy should be skipped.';

/* Safemode Hack */
$lang['safemodehack'] = 'Enable safemode hack';
$lang['ftp____host'] = 'FTP server for safemode hack';
$lang['ftp____port'] = 'FTP port for safemode hack';
$lang['ftp____user'] = 'FTP user name for safemode hack';
$lang['ftp____pass'] = 'FTP password for safemode hack';
$lang['ftp____root'] = 'FTP root directory for safemode hack';

/* License Options */
$lang['license_o_'] = 'None chosen';

Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/eo/lang.php
Expand Up @@ -152,12 +152,6 @@
$lang['proxy____pass'] = 'Pasvorto ĉe la "Proxy"';
$lang['proxy____ssl'] = 'Uzi SSL por konekti al la "Proxy"';
$lang['proxy____except'] = 'Regula esprimo por URL-oj, kiujn la servilo preterrigardu.';
$lang['safemodehack'] = 'Ebligi sekuran modon';
$lang['ftp____host'] = 'FTP-a servilo por sekura modo';
$lang['ftp____port'] = 'FTP-a pordo por sekura modo';
$lang['ftp____user'] = 'FTP-a uzantonomo por sekura modo';
$lang['ftp____pass'] = 'FTP-a pasvorto por sekura modo';
$lang['ftp____root'] = 'FTP-a superuzanta (root) subdosierujo por sekura modo';
$lang['license_o_'] = 'Nenio elektita';
$lang['typography_o_0'] = 'nenio';
$lang['typography_o_1'] = 'Nur duoblaj citiloj';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/es/lang.php
Expand Up @@ -177,12 +177,6 @@
$lang['proxy____pass'] = 'Contraseña para el servidor Proxy';
$lang['proxy____ssl'] = 'Usar ssl para conectarse al servidor Proxy';
$lang['proxy____except'] = 'Expresiones regulares para encontrar URLs que el proxy debería omitir.';
$lang['safemodehack'] = 'Habilitar edición (hack) de modo seguro';
$lang['ftp____host'] = 'Nombre del servidor FTP para modo seguro';
$lang['ftp____port'] = 'Puerto del servidor FTP para modo seguro';
$lang['ftp____user'] = 'Nombre de usuario para el servidor FTP para modo seguro';
$lang['ftp____pass'] = 'Contraseña para el servidor FTP para modo seguro';
$lang['ftp____root'] = 'Directorio raiz para el servidor FTP para modo seguro';
$lang['license_o_'] = 'No se eligió ninguna';
$lang['typography_o_0'] = 'ninguno';
$lang['typography_o_1'] = 'Dobles comillas solamente';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/eu/lang.php
Expand Up @@ -135,12 +135,6 @@
$lang['proxy____pass'] = 'Proxyaren pasahitza ';
$lang['proxy____ssl'] = 'Erabili SSL Proxyra konektatzeko';
$lang['proxy____except'] = 'URLak detektatzeko espresio erregularra, zeinentzat Proxy-a sahiestu beharko litzatekeen.';
$lang['safemodehack'] = 'Gaitu modu segurua hack-a';
$lang['ftp____host'] = 'FTP zerbitzaria modu seguruarentzat';
$lang['ftp____port'] = 'FTP portua modu seguruarentzat';
$lang['ftp____user'] = 'FTP erabiltzailea modu seguruarentzat';
$lang['ftp____pass'] = 'FTP pasahitza modu seguruarentzat';
$lang['ftp____root'] = 'FTP erro direktorioa modu seguruarentzat';
$lang['license_o_'] = 'Bat ere ez hautaturik';
$lang['typography_o_0'] = 'ezer';
$lang['typography_o_1'] = 'Komatxo bikoitzak bakarrik';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/fa/lang.php
Expand Up @@ -153,12 +153,6 @@
$lang['proxy____pass'] = 'گذرواژهي پروکسی';
$lang['proxy____ssl'] = 'استفاده از SSL برای اتصال به پروکسی';
$lang['proxy____except'] = 'عبارت منظم برای تطبیق با URLها برای این‌که دریابیم که از روی چه پروکسی‌ای باید بپریم!';
$lang['safemodehack'] = 'فعال کردن safemode hack';
$lang['ftp____host'] = 'آدرس FTP برای safemode hack';
$lang['ftp____port'] = 'پورت FTP برای safemode hack';
$lang['ftp____user'] = 'نام کاربری FTP برای safemode hack';
$lang['ftp____pass'] = 'گذرواژه‌ی FTP برای safemode hack';
$lang['ftp____root'] = 'شاخه‌ی FTP برای safemode hack';
$lang['license_o_'] = 'هیچ کدام';
$lang['typography_o_0'] = 'هیچ';
$lang['typography_o_1'] = 'حذف کردن single-quote';
Expand Down
8 changes: 1 addition & 7 deletions lib/plugins/config/lang/fi/lang.php
Expand Up @@ -2,7 +2,7 @@

/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
*
* @author otto@valjakko.net
* @author Otto Vainio <otto@valjakko.net>
* @author Teemu Mattila <ghcsystems@gmail.com>
Expand Down Expand Up @@ -148,12 +148,6 @@
$lang['proxy____pass'] = 'Proxy salasana';
$lang['proxy____ssl'] = 'Käytä ssl-yhteyttä kytkeytyäksesi proxy-palvelimeen';
$lang['proxy____except'] = 'Säännönmukainen lause, URLiin, jolle proxy ohitetaan.';
$lang['safemodehack'] = 'Käytä safemode kiertoa';
$lang['ftp____host'] = 'FTP-palvelin safemode kiertoa varten';
$lang['ftp____port'] = 'FTP-portti safemode kiertoa varten';
$lang['ftp____user'] = 'FTP-käyttäjä safemode kiertoa varten';
$lang['ftp____pass'] = 'FTP-salasana safemode kiertoa varten';
$lang['ftp____root'] = 'FTP-juurihakemisto safemode kiertoa varten';
$lang['license_o_'] = 'ei mitään valittuna';
$lang['typography_o_0'] = 'ei mitään';
$lang['typography_o_1'] = 'ilman yksinkertaisia lainausmerkkejä';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/fr/lang.php
Expand Up @@ -182,12 +182,6 @@
$lang['proxy____pass'] = 'Mandataire - Mot de passe';
$lang['proxy____ssl'] = 'Mandataire - Utilisation de SSL';
$lang['proxy____except'] = 'Mandataire - Expression régulière de test des URLs pour lesquelles le mandataire (proxy) ne doit pas être utilisé.';
$lang['safemodehack'] = 'Activer l\'option Mode sans échec';
$lang['ftp____host'] = 'FTP / Mode sans échec - Serveur hôte';
$lang['ftp____port'] = 'FTP / Mode sans échec - Port';
$lang['ftp____user'] = 'FTP / Mode sans échec - Identifiant';
$lang['ftp____pass'] = 'FTP / Mode sans échec - Mot de passe';
$lang['ftp____root'] = 'FTP / Mode sans échec - Répertoire racine';
$lang['license_o_'] = 'Aucune choisie';
$lang['typography_o_0'] = 'aucun';
$lang['typography_o_1'] = 'guillemets uniquement';
Expand Down
6 changes: 0 additions & 6 deletions lib/plugins/config/lang/gl/lang.php
Expand Up @@ -144,12 +144,6 @@
$lang['proxy____pass'] = 'Contrasinal do Proxy';
$lang['proxy____ssl'] = 'Utilizar ssl para conectar ao Proxy';
$lang['proxy____except'] = 'Expresión regular para atopar URLs que deban ser omitidas polo Proxy.';
$lang['safemodehack'] = 'Activar hack de modo seguro (safemode)';
$lang['ftp____host'] = 'Servidor FTP para o hack de modo seguro (safemode)';
$lang['ftp____port'] = 'Porto FTP para o hack de modo seguro(safemode)';
$lang['ftp____user'] = 'Nome de usuario FTP para o hack de modo seguro(safemode)';
$lang['ftp____pass'] = 'Contrasinal FTP para o hack de modo seguro(safemode)';
$lang['ftp____root'] = 'Directorio raigaña do FTP para o hack de modo seguro(safemode)';
$lang['license_o_'] = 'Non se escolleu nada';
$lang['typography_o_0'] = 'ningunha';
$lang['typography_o_1'] = 'Só dobres aspas';
Expand Down

0 comments on commit fe22708

Please sign in to comment.