[SPIP] ~v3.0.20-->v3.0.25
[lhc/web/clavette_www.git] / www / ecrire / inc / flock.php
index 75b0fcb..6a96201 100644 (file)
@@ -3,7 +3,7 @@
 /***************************************************************************\
  *  SPIP, Systeme de publication pour l'internet                           *
  *                                                                         *
- *  Copyright (c) 2001-2014                                                *
+ *  Copyright (c) 2001-2016                                                *
  *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
  *                                                                         *
  *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
@@ -181,7 +181,9 @@ function ecrire_fichier ($fichier, $contenu, $ignorer_echec = false, $truncate=t
                // liberer le verrou et fermer le fichier
                @chmod($fichier, _SPIP_CHMOD & 0666);
                if ($ok) {
-                       spip_clear_opcode_cache(realpath($fichier));
+                       if (strpos($fichier,".php")!==false){
+                               spip_clear_opcode_cache(realpath($fichier));
+                       }
                        return $ok;
                }
        }
@@ -415,14 +417,7 @@ function sous_repertoire($base, $subdir='', $nobase = false, $tantpis=false) {
        @mkdir($path, _SPIP_CHMOD);
        @chmod($path, _SPIP_CHMOD);
 
-       $ok = false;
-       if ($test = @fopen("$path/dir_test.php", "w")) {
-               @fputs($test, '<'.'?php $ok = true; ?'.'>');
-               @fclose($test);
-               @include("$path/dir_test.php");
-               spip_unlink("$path/dir_test.php");
-       }
-       if ($ok) {
+       if (is_dir($path) && is_writable($path)) {
                @touch ("$path/.ok");
                spip_log("creation $base$subdir/");
                return $baseaff.($dirs[$base.$subdir] = "$subdir/");
@@ -440,7 +435,7 @@ function sous_repertoire($base, $subdir='', $nobase = false, $tantpis=false) {
                if (!_DIR_RESTREINT)
                        $base = preg_replace(',^' . _DIR_RACINE .',', '',$base);
                $base .= $subdir;
-               raler_fichier($base . ($test?'/.ok':'/dir_test.php'));
+               raler_fichier($base . '/.plat');
        }
        spip_log("faux sous-repertoire $base${subdir}");
        return $baseaff.($dirs[$base.$subdir] = "${subdir}_");