Overview
Comment:Upload de fichier fonctionnel
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9ed4a2c5d0157d641066843d6f21988a3531bca5
User & Date: bohwaz on 2015-03-10 04:30:07
Other Links: manifest | tags
Context
2015-03-10
05:01
Insertion de fichier en JS à la fin de l'upload check-in: 0c126d2308 user: bohwaz tags: trunk
04:30
Upload de fichier fonctionnel check-in: 9ed4a2c5d0 user: bohwaz tags: trunk
02:51
Correction bug couleur non définie avec un nombre important de comptes check-in: 2b37f67952 user: bohwaz tags: trunk
Changes

Modified src/include/data/0.7.0.sql from [03c2810d89] to [acaa57e895].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
);

CREATE TABLE fichiers
-- Données sur les fichiers
(
    id INTEGER NOT NULL PRIMARY KEY,
    nom TEXT NOT NULL, -- nom de fichier (par exemple image1234.jpeg)
    type TEXT NOT NULL, -- Type MIME
    image INTEGER NOT NULL DEFAULT 0, -- 1 = image reconnue
    titre TEXT NOT NULL, -- Titre/description
    date TEXT NOT NULL DEFAULT CURRENT_DATE, -- Date d'ajout ou mise à jour du fichier
    id_contenu INTEGER NOT NULL REFERENCES fichiers_contenu (id)
);

CREATE INDEX fichiers_titre ON fichiers (titre);
CREATE INDEX fichiers_date ON fichiers (date);

CREATE TABLE fichiers_contenu
-- Contenu des fichiers
(
    id INTEGER NOT NULL PRIMARY KEY,
    hash TEXT NOT NULL, -- Hash SHA1 du contenu du fichier
    taille INTEGER NOT NULL, -- Taille en octets
    contenu BLOB
);

CREATE UNIQUE INDEX fichiers_hash ON fichiers_contenu (hash);

CREATE TABLE fichiers_membres
-- Associations entre fichiers et membres (photo de profil par exemple)
(







|

<
|



<
|







|







16
17
18
19
20
21
22
23
24

25
26
27
28

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
);

CREATE TABLE fichiers
-- Données sur les fichiers
(
    id INTEGER NOT NULL PRIMARY KEY,
    nom TEXT NOT NULL, -- nom de fichier (par exemple image1234.jpeg)
    type TEXT NULL, -- Type MIME
    image INTEGER NOT NULL DEFAULT 0, -- 1 = image reconnue

    datetime TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, -- Date d'ajout ou mise à jour du fichier
    id_contenu INTEGER NOT NULL REFERENCES fichiers_contenu (id)
);


CREATE INDEX fichiers_date ON fichiers (datetime);

CREATE TABLE fichiers_contenu
-- Contenu des fichiers
(
    id INTEGER NOT NULL PRIMARY KEY,
    hash TEXT NOT NULL, -- Hash SHA1 du contenu du fichier
    taille INTEGER NOT NULL, -- Taille en octets
    contenu BLOB NULL
);

CREATE UNIQUE INDEX fichiers_hash ON fichiers_contenu (hash);

CREATE TABLE fichiers_membres
-- Associations entre fichiers et membres (photo de profil par exemple)
(

Modified src/include/data/schema.sql from [51479b06fb] to [62a39221a8].

322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
);

CREATE TABLE fichiers
-- Données sur les fichiers
(
    id INTEGER NOT NULL PRIMARY KEY,
    nom TEXT NOT NULL, -- nom de fichier (par exemple image1234.jpeg)
    type TEXT NOT NULL, -- Type MIME
    image INTEGER NOT NULL DEFAULT 0, -- 1 = image reconnue
    titre TEXT NOT NULL, -- Titre/description
    date TEXT NOT NULL DEFAULT CURRENT_DATE, -- Date d'ajout ou mise à jour du fichier
    id_contenu INTEGER NOT NULL REFERENCES fichiers_contenu (id)
);

CREATE INDEX fichiers_titre ON fichiers (titre);
CREATE INDEX fichiers_date ON fichiers (date);

CREATE TABLE fichiers_contenu
-- Contenu des fichiers
(
    id INTEGER NOT NULL PRIMARY KEY,
    hash TEXT NOT NULL, -- Hash SHA1 du contenu du fichier
    taille INTEGER NOT NULL, -- Taille en octets
    contenu BLOB
);

CREATE UNIQUE INDEX fichiers_hash ON fichiers_contenu (hash);

CREATE TABLE fichiers_membres
-- Associations entre fichiers et membres (photo de profil par exemple)
(







|

<
|



<








|







322
323
324
325
326
327
328
329
330

331
332
333
334

335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
);

CREATE TABLE fichiers
-- Données sur les fichiers
(
    id INTEGER NOT NULL PRIMARY KEY,
    nom TEXT NOT NULL, -- nom de fichier (par exemple image1234.jpeg)
    type TEXT NULL, -- Type MIME
    image INTEGER NOT NULL DEFAULT 0, -- 1 = image reconnue

    datetime TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, -- Date d'ajout ou mise à jour du fichier
    id_contenu INTEGER NOT NULL REFERENCES fichiers_contenu (id)
);


CREATE INDEX fichiers_date ON fichiers (date);

CREATE TABLE fichiers_contenu
-- Contenu des fichiers
(
    id INTEGER NOT NULL PRIMARY KEY,
    hash TEXT NOT NULL, -- Hash SHA1 du contenu du fichier
    taille INTEGER NOT NULL, -- Taille en octets
    contenu BLOB NULL
);

CREATE UNIQUE INDEX fichiers_hash ON fichiers_contenu (hash);

CREATE TABLE fichiers_membres
-- Associations entre fichiers et membres (photo de profil par exemple)
(

Modified src/include/lib/Garradin/DB.php from [7e56a5c401] to [ce44687ceb].

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166









167
168
169
170
171
172
173
    public function rollback()
    {
        $this->exec('ROLLBACK;');
        $this->_transaction = 0;
        return true;
    }

    public function getArgType($arg, $name = '')
    {
        switch (gettype($arg))
        {
            case 'double':
                return \SQLITE3_FLOAT;
            case 'integer':
            case 'boolean':
                return \SQLITE3_INTEGER;
            case 'NULL':
                return \SQLITE3_NULL;
            case 'string':
                return \SQLITE3_TEXT;









            default:
                throw new \InvalidArgumentException('Argument '.$name.' is of invalid type '.gettype($arg));
        }
    }

    public function simpleStatement($query, $args = [])
    {







|












>
>
>
>
>
>
>
>
>







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    public function rollback()
    {
        $this->exec('ROLLBACK;');
        $this->_transaction = 0;
        return true;
    }

    public function getArgType(&$arg, $name = '')
    {
        switch (gettype($arg))
        {
            case 'double':
                return \SQLITE3_FLOAT;
            case 'integer':
            case 'boolean':
                return \SQLITE3_INTEGER;
            case 'NULL':
                return \SQLITE3_NULL;
            case 'string':
                return \SQLITE3_TEXT;
            case 'array':
                if (count($arg) == 2 
                    && in_array($arg[0], [\SQLITE3_FLOAT, \SQLITE3_INTEGER, \SQLITE3_NULL, \SQLITE3_TEXT, \SQLITE3_BLOB]))
                {
                    $type = $arg[0];
                    $arg = $arg[1];

                    return $type;
                }
            default:
                throw new \InvalidArgumentException('Argument '.$name.' is of invalid type '.gettype($arg));
        }
    }

    public function simpleStatement($query, $args = [])
    {
188
189
190
191
192
193
194

195
196
197
198
199
200
201
202
203
204
205
206

207
208
209
210
211
212
213
214

            reset($args);

            if (is_int(key($args)))
            {
                foreach ($args as $i=>$arg)
                {

                    $statement->bindValue((int)$i+1, $arg, $this->getArgType($arg, $i+1));
                }
            }
            else
            {
                foreach ($args as $key=>$value)
                {
                    if (is_int($key))
                    {
                        throw new \InvalidArgumentException(__FUNCTION__ . ' requires argument to be a named-associative array, but key '.$key.' is an integer.');
                    }


                    $statement->bindValue(':'.$key, $value, $this->getArgType($value, $key));
                }
            }
        }

        try {
            return $statement->execute();
        }







>
|











>
|







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225

            reset($args);

            if (is_int(key($args)))
            {
                foreach ($args as $i=>$arg)
                {
                    $type = $this->getArgType($arg, $i+1);
                    $statement->bindValue((int)$i+1, $arg, $type);
                }
            }
            else
            {
                foreach ($args as $key=>$value)
                {
                    if (is_int($key))
                    {
                        throw new \InvalidArgumentException(__FUNCTION__ . ' requires argument to be a named-associative array, but key '.$key.' is an integer.');
                    }

                    $type = $this->getArgType($value, $key);
                    $statement->bindValue(':'.$key, $value, $type);
                }
            }
        }

        try {
            return $statement->execute();
        }

Modified src/include/lib/Garradin/Fichiers.php from [0cd1cbc469] to [ad60ab4d6d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

namespace Garradin;

class Fichiers
{
	public $type;
	public $titre;
	public $nom;
	public $date;
	public $hash;
	public $taille;
	public $id;

	const LIEN_COMPTA = 'compta_journal';
	const LIEN_WIKI = 'wiki_pages';
	const LIEN_MEMBRES = 'membres';

	public function __construct($id)
	{
		$data = DB::getInstance()->simpleQuerySingle('SELECT *, strftime(\'%s\', date) AS date
			FROM fichiers WHERE id = ?;', true, (int)$id);

		foreach ($data as $key=>$value)
		{
			$this->$key = $value;
		}
	}	







<

|










|







1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

namespace Garradin;

class Fichiers
{
	public $type;

	public $nom;
	public $datetime;
	public $hash;
	public $taille;
	public $id;

	const LIEN_COMPTA = 'compta_journal';
	const LIEN_WIKI = 'wiki_pages';
	const LIEN_MEMBRES = 'membres';

	public function __construct($id)
	{
		$data = DB::getInstance()->simpleQuerySingle('SELECT *, strftime(\'%s\', datetime) AS datetime
			FROM fichiers WHERE id = ?;', true, (int)$id);

		foreach ($data as $key=>$value)
		{
			$this->$key = $value;
		}
	}	
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
		$db->simpleExec('DELETE FROM fichiers WHERE id = ?;', (int)$this->id);

		return $db->exec('END;');
	}

	/**
	 * Modifie les informations du fichier
	 * @param  string $titre Le titre du fichier
	 * @param  string $nom   Le nom du fichier (avec extension)
	 * @return boolean TRUE en cas de succès
	 */
	public function edit($titre, $nom)
	{

	}

	/**
	 * Envoie le fichier au client HTTP
	 * @return void







<



|







83
84
85
86
87
88
89

90
91
92
93
94
95
96
97
98
99
100
		$db->simpleExec('DELETE FROM fichiers WHERE id = ?;', (int)$this->id);

		return $db->exec('END;');
	}

	/**
	 * Modifie les informations du fichier

	 * @param  string $nom   Le nom du fichier (avec extension)
	 * @return boolean TRUE en cas de succès
	 */
	public function edit($nom)
	{

	}

	/**
	 * Envoie le fichier au client HTTP
	 * @return void
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204

205
206

207













208
209

210









211
212
213
214
215

216


217

218
219
220
221


222
223
224
225
226


227

228
229

230

















































		$hash_list = substr($hash_list, 0, -1);

		return $db->queryFetchAssoc('SELECT hash, 1
			FROM fichiers_contenu WHERE hash IN (' . $hash_list . ');');
	}

	/**
	 * Upload du fichier par POST
	 * @param  array  $file  Caractéristiques du fichier envoyé
	 * @param  string $titre Titre descriptif du fichier
	 * @return boolean TRUE en cas de succès
	 */
	static public function upload($file, $titre, $allow_anything = false)
	{
		// FIXME traiter les images envoyées redimensionnées par javascript (base64)


		$name = '...';

		// FIXME name sanitization














		if (!$allow_anything && preg_match('/\.(?:php\d*|cgi|pl|perl|jsp|asp|py|exe|com|bat|vb[se]?|chm|pif|reg|ws[cfh]|scr|asp)$/i', $name))

		{









			throw new UserException('Extension de fichier interdite.');
		}

		$ext = substr($name, strrpos($name, '.')+1);
		$ext = strtolower($ext);




		if (!$allow_anything && !array_key_exists($ext, $this->allowed_files))

		{
			throw new UserException('Ce type de fichier n\'est pas autorisé.');
		}



		$bytes = file_get_contents($path, false, null, -1, 1024);
		$type = \KD2\FileInfo::guessMimeType($bytes);

		if (!$allow_anything && !$type)
		{


			throw new UserException('Type de fichier inconnu.');

		}
	}

}
























































|
<
|
|

|

<
>
|
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
|
>
>
>
>
>
>
>
>
>
|


<
<
>
|
>
>
|
>

|


>
>
|


|

>
>
|
>

|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
188
189
190
191
192
193
194
195

196
197
198
199
200

201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219

220
221
222
223
224
225
226
227
228
229
230
231
232
233


234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
		$hash_list = substr($hash_list, 0, -1);

		return $db->queryFetchAssoc('SELECT hash, 1
			FROM fichiers_contenu WHERE hash IN (' . $hash_list . ');');
	}

	/**
	 * Récupération du message d'erreur

	 * @param  integer $error Code erreur du $_FILE
	 * @return string Message d'erreur
	 */
	static public function getErrorMessage($error)
	{

		switch ($error)
		{
			case UPLOAD_ERR_INI_SIZE:
				return 'Le fichier excède la taille permise par la configuration du serveur.';
			case UPLOAD_ERR_FORM_SIZE:
				return 'Le fichier excède la taille permise par le formulaire.';
			case UPLOAD_ERR_PARTIAL:
				return 'L\'envoi du fichier a été interrompu.';
			case UPLOAD_ERR_NO_FILE:
				return 'Aucun fichier n\'a été reçu.';
			case UPLOAD_ERR_NO_TMP_DIR:
				return 'Pas de répertoire temporaire pour stocker le fichier.';
			case UPLOAD_ERR_CANT_WRITE:
				return 'Impossible d\'écrire le fichier sur le disque du serveur.';
			case UPLOAD_ERR_EXTENSION:
				return 'Une extension du serveur a interrompu l\'envoi du fichier.';
			default:
				return 'Erreur inconnue: ' . $error;
		}

	}

	/**
	 * Upload du fichier par POST
	 * @param  array  $file  Caractéristiques du fichier envoyé
	 * @return boolean TRUE en cas de succès
	 */
	static public function upload($file)
	{
		if (!empty($file['error']))
		{
			throw new UserException(self::getErrorMessage($file['error']));
		}



		if (empty($file['size']) || empty($file['name']))
		{
			throw new UserException('Fichier reçu invalide : vide ou sans nom de fichier.');
		}

		if (!is_uploaded_file($file['tmp_name']))
		{
			throw new \RuntimeException('Le fichier n\'a pas été envoyé de manière conventionnelle.');
		}

		$name = preg_replace('/[^\d\w._-]/ui', '', $file['name']);

		$bytes = file_get_contents($file['tmp_name'], false, null, -1, 1024);
		$type = \KD2\FileInfo::guessMimeType($bytes);

		if (!$type)
		{
			$ext = substr($name, strrpos($name, '.')+1);
			$ext = strtolower($ext);

			$type = \KD2\FileInfo::getMimeTypeFromFileExtension($ext);
		}

		$is_image = preg_match('/^image\//', $type);

		$hash = sha1_file($file['tmp_name']);
		$size = filesize($file['tmp_name']);

		$db = DB::getInstance();
		$db->exec('BEGIN;');

		$db->simpleInsert('fichiers_contenu', [
			'hash'		=>	$hash,
			'taille'	=>	(int)$size,
			'contenu'	=>	[\SQLITE3_BLOB, file_get_contents($file['tmp_name'])],
		]);

		$id_contenu = $db->lastInsertRowID();

		$db->simpleInsert('fichiers', [
			'id_contenu'	=>	(int)$id_contenu,
			'nom'			=>	$name,
			'type'			=>	$type,
			'image'			=>	(int)$is_image,
		]);

		$db->exec('END;');

		return new Fichiers($db->lastInsertRowID());
	}

	static public function uploadExistingHash($name, $hash)
	{
		$db = DB::getInstance();
		$name = preg_replace('/[^\d\w._-]/ui', '', $name);

		$file = $db->simpleQuerySingle('SELECT * FROM fichiers 
			INNER JOIN fichiers_contenu AS fc ON fc.id = fichiers.id_contenu AND fc.hash = ?;', true, trim($hash));

		if (!$file)
		{
			throw new UserException('Le fichier à copier n\'existe pas (aucun hash ne correspond à '.$hash.').');
		}

		$db->simpleInsert('fichiers', [
			'id_contenu'	=>	(int)$file['id_contenu'],
			'nom'			=>	$name,
			'type'			=>	$file['type'],
			'image'			=>	(int)$file['image'],
		]);

		return new Fichiers($db->lastInsertRowID());
	}
}

Modified src/templates/admin/wiki/_fichiers.tpl from [37679bfb54] to [126584a328].

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{include file="admin/_head.tpl" title="Inclure un fichier" current="wiki" body_id="popup" is_popup=true js=1}

 <form method="post" enctype="multipart/form-data" action="{$self_url|escape}" id="f_upload">
    <fieldset>
        <legend>Téléverser un fichier</legend>
        <input type="hidden" name="MAX_FILE_SIZE" value="{$max_size|escape}" id="f_maxsize" />
        <dl>
            <dt><label for="f_fichier">Sélectionner un fichier</label></dt>
            <dd class="help">Taille maximale : {$max_size|format_bytes}</dd>
            <dd class="fileUpload"><input type="file" name="fichier" id="f_fichier" data-hash-check /></dd>
            <dt><label for="f_titre">Titre du fichier (description)</label></dt>
            <dd><input type="text" name="titre" id="f_titre" /></dd>
        </dl>
        <p class="submit">

            <input type="submit" id="f_submit" value="Envoyer le fichier" />
        </p>
    </fieldset>
</form>

<script type="text/javascript">
{literal}
uploadHelper($('#f_fichier'), {
    width: 1920,
    height: 1920,
    resize: true,
    bytes: 'o',
    size_error_msg: 'Le fichier %file fait %size, soit plus que la taille maximale autorisée de %max_size.'
});

$('#f_fichier').onchange = function () {
    var name = this.value.replace(/\.[^.]+/g, '');
    name = name.replace(/[_.-]+/g, ' ');
    name = name.replace(/\w/, function (match) { return match.toUpperCase(); });
    $('#f_titre').value = name;
}
{/literal}
</script>

{include file="admin/_foot.tpl"}
|






<


<
<


>














<
<
<
<
<
<
<




1
2
3
4
5
6
7

8
9


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26







27
28
29
30
{include file="admin/_head.tpl" title="Inclure un fichier" current="wiki" body_id="transparent" is_popup=true js=1}

 <form method="post" enctype="multipart/form-data" action="{$self_url|escape}" id="f_upload">
    <fieldset>
        <legend>Téléverser un fichier</legend>
        <input type="hidden" name="MAX_FILE_SIZE" value="{$max_size|escape}" id="f_maxsize" />
        <dl>

            <dd class="help">Taille maximale : {$max_size|format_bytes}</dd>
            <dd class="fileUpload"><input type="file" name="fichier" id="f_fichier" data-hash-check /></dd>


        </dl>
        <p class="submit">
            {csrf_field key="wiki_upload_`$page.id`"}
            <input type="submit" id="f_submit" value="Envoyer le fichier" />
        </p>
    </fieldset>
</form>

<script type="text/javascript">
{literal}
uploadHelper($('#f_fichier'), {
    width: 1920,
    height: 1920,
    resize: true,
    bytes: 'o',
    size_error_msg: 'Le fichier %file fait %size, soit plus que la taille maximale autorisée de %max_size.'
});







{/literal}
</script>

{include file="admin/_foot.tpl"}

Modified src/www/admin/static/scripts/upload_helper.min.js from [9a296fb1c0] to [79dd907c6b].

1
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(w(){7(!1Z||!39||!1g.21||!1B||!1C||!1n)x C;w 1D(a,b){7(a<17)x a+\' \'+b;I 7(a<17*17)x F.P(a/17)+\' K\'+b;I x(F.P(a/17/17*1o)/1o)+\' M\'+b}Q.3a=w(m,n){6 o=z 22();6 p=m.3b;6 q=m.3c(\'18-N-3d\');6 r=C;6 s=C;6 t=C;6 u=C;6 n=n||{};n.E=n.E||C;n.y=n.y||1h;n.19=(n.E&&n.19)?O:C;n.1p=n.1p||\'B\';n.1E=n.1E||\'3e 1q %1q 3f a T 23 %T, 3g 3h 3i 25 %26 25.\';6 v=1h;7(i=p.21(\'3j[R=3k]\')){6 v=i.1i}m.28(\'3l\',w(){6 c=H.1a;s=[];7(c.G<1){x C}7(!H.29&&c.G>1){H.1i=\'\';x C}6 l=c.G;D(6 i=0;i<l;i++){6 d=c[i];7(d.T>v&&(!n.19||!d.X.2a(/^1F\\//))){H.1i=\'\';6 e={R:d.R,T:1D(d.T,n.1p),26:1D(v,n.1p)};6 f=n.1E.3m(/%([a-3n]+)/g,w(a,b){x e[b]});x!2b(f)}s.3o(d)}1G()},C);p.28(\'3p\',w(e){7(!m.1a||m.1a.G==0){x O}e.3q();7(r!==C){x C}7(r.G==0){x O}r=3r.3s(m.1a).3t(w(a){x m.1a[a]});m.1H=O;6 c=p.1I;D(6 i=0;i<c.G;i++){7(c[i].X!=\'1J\'){c[i].2c=O}}6 d=1g.1r(\'3u\');d.3v=\'3w\';u=1g.1r(\'3x\');d.3y(u);m.1s.3z(d,m.3A);7(q){6 f=z 1C();6 g=z 1B();6 h=0;D(6 i=0;i<r.G;i++){7(r[i].N){g.Y(\'3B[]\',r[i].N);h++}}7(h>0){f.2e=w(){7(f.2f!=4)x;7(f.1K==2g){6 b=f.2h;b=Q.1n.2i(b);r=r.3C(w(a){7(!a.N)x O;7(a.N 3D b)a.1L=O;x O})}1t()};f.2j(\'2k\',p.2l,O);f.2m(g);x C}}1t();x C},C);w 1G(){7(s.G==0)x C;6 a=s.2n();6 b=z 1Z;b.1q=a;b.3E=w(){7(H.Z)x C;b.1q.N=o.2o(b.3F);1b b;1G()};b.2p(a)}w 1t(){7(r.G==0){x C}6 b=r.2n();t=r.G;7(n.19&&b.X.2a(/^1F\\//)&&!b.1L){u.2q(\'2r\');u.2q(\'1i\');19(b,n.E,n.y,w(a){1M(b,a)})}I{1M(b,C)}}w 1M(b,c){6 d=z 1C();6 f=z 1B(p);7(b.1L){f.Y(m.1N(\'R\'),b.R)}I 7(c){f.Y(m.1N(\'R\'),c,b.R)}I{f.Y(m.1N(\'R\'),b)}7(b.N){f.Y(\'3G\',b.N)}f.Y(\'3H\',t);d.3I=w(e){u.2r=e.2s;7(e.3J){u.1i=e.1O;u.2t=F.P(e.1O/e.2s)+\'%\'}I{u.2t=e.1O}};d.2e=w(){7(d.2f!=4)x;7(d.1K==2g){1u{6 a=Q.1n.2i(d.2h);7(a.2u){3K.3L=a.2u;x C}I 7(a.3M){1t();x C}}1v(e){6 a={Z:\'2v 3N 3O 3P 1n\'}}}I{6 a={Z:\'2v 3Q Z. 3R 3S: \'+d.1K}}2b(a.Z);2w();1b d};d.2j(\'2k\',p.2l,O);d.2m(f);1b f;7(r.G+1==m.1a.G){6 g=p.1I;D(6 i=0;i<g.G;i++){7(g[i].X!=\'1J\'){g[i].1H=O}}}}w 2w(){6 a=p.1I;D(6 i=0;i<a.G;i++){7(a[i].X!=\'1J\'){a[i].1H=C;a[i].2c=C}}t=\'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(c+j)}},j=w(a,b,c,d,e){6 f,g=H,h=e%4,i=d%4,j=d-i;7(j>0)11(h){A 0:a[e+3|0]=g[c];A 1:a[e+2|0]=g[c+1];A 2:a[e+1|0]=g[c+2];A 3:a[0|e]=g[c+3]}D(f=4-h;j>f;f=f+=4)b[e+f>>2]=g[c+f]<<24|g[c+f+1]<<16|g[c+f+2]<<8|g[c+f+3];11(i){A 3:a[e+j+1|0]=g[c+j+2];A 2:a[e+j+2|0]=g[c+j+1];A 1:a[e+j+3|0]=g[c+j]}},k=w(a,b,d,e,f){6 g,h=H,i=f%4,j=e%4,k=e-j,l=z U(c.2p(h.43(d,d+e)));7(k>0)11(i){A 0:a[f+3|0]=l[0];A 1:a[f+2|0]=l[1];A 2:a[f+1|0]=l[2];A 3:a[0|f]=l[3]}D(g=4-i;k>g;g=g+=4)b[f+g>>2]=l[g]<<24|l[g+1]<<16|l[g+2]<<8|l[g+3];11(j){A 3:a[f+k+1|0]=l[k+2];A 2:a[f+k+2|0]=l[k+1];A 1:a[f+k+3|0]=l[k]}},l=w(a){11(e.2F(a)){A"1Q":x i.1c(a);A"2G":x j.1c(a);A"13":x j.1c(a);A"2H":x j.1c(z U(a));A"2I":x j.1c(z U(a.13,a.44,a.2J));A"1R":x k.1c(a)}},m=w(a){6 b,c,d="45",e=[],f=z U(a);D(b=0;b<f.G;b++)c=f[b],e[b]=d.2K(c>>4&15)+d.2K(c>>0&15);x e.46("")},n=w(a){6 b;7(1S>=a)x 1S;7(1T>a)D(b=1;a>b;b<<=1);I D(b=1T;a>b;b+=1T);x b},o=w(a){7(a%J>0)2L z 2M("47 T 48 49 a 29 23 2E 4a");d.2N=a,d.1j=f(a),d.14=z 1k(n(d.1j+1d+20)),d.2O=z V(d.14),d.2P=z 4b(d.14),d.2Q=b({V:V,1U:1U},{},d.14),d.13=1h};o(a||1S);6 p=w(a,b){6 c=z V(a,b+1d,5);c[0]=4c,c[1]=-4d,c[2]=-4e,c[3]=4f,c[4]=-4g},q=w(a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U&&w(){1u{x 1o===z 1m([z U(1o)]).T}1v(a){x!1}}(),e=a.4w||a.4x||a.4y||a.4z,f=(c||e)&&a.37&&a.1k&&a.U&&w(a){6 b,f,g,h,i,j;D(b=a.1f(",")[0].4A("4B")>=0?37(a.1f(",")[1]):4C(a.1f(",")[1]),f=z 1k(b.G),g=z U(f),h=0;h<b.G;h+=1)g[h]=b.L(h);x i=a.1f(",")[0].1f(":")[1].1f(";")[0],c?z 1m([d?g:f],{X:i}):(j=z e,j.Y(f),j.4D(i))};a.1X&&!b.1w&&(b.38?b.1w=w(a,c,d){d&&b.1A&&f?a(f(H.1A(c,d))):a(H.38("1R",c))}:b.1A&&f&&(b.1w=w(a,b,c){a(f(H.1A(b,c)))})),"w"==1e 1Y&&1Y.4E?1Y(w(){x f}):a.4F=f}(H)}());',62,290,'||||||var|if|||||||||||||||||||||||||function|return|height|new|case||false|for|width|Math|length|this|else|64||charCodeAt||hash|true|round|window|name|abs|size|Uint8Array|Int32Array|56|type|append|error||switch||buffer|heap|||1024|data|resize|files|delete|bind|320|typeof|split|document|null|value|padMaxChunkLen|ArrayBuffer|setInt32|Blob|JSON|100|bytes|file|createElement|parentNode|runUploadQueue|try|catch|toBlob|undefined|id|instanceof|toDataURL|FormData|XMLHttpRequest|getByteSize|size_error_msg|image|runHashQueue|disabled|elements|hidden|status|noUpload|uploadFile|getAttribute|loaded|use|string|blob|65536|16777216|DataView|self|global|HTMLCanvasElement|define|FileReader||querySelector|Rusha|of||allowed|max_size||addEventListener|multiple|match|alert|readOnly||onreadystatechange|readyState|200|responseText|parse|open|POST|action|send|shift|digestFromArrayBuffer|readAsArrayBuffer|removeAttribute|max|total|innerHTML|redirect|Server|abortUpload|src|URL|webkitURL|canvas|getContext|drawImage|strict|128|getDataType|array|arraybuffer|view|byteLength|charAt|throw|Error|maxChunkLen|h32|h8|core|digest|324|328|332|336|1518500249|80|160|240||||module|FileReaderSync|postMessage|Buffer|atob|mozGetAsFile|File|uploadHelper|form|hasAttribute|check|The|has|more|than|the|input|MAX_FILE_SIZE|change|replace|z_|push|submit|preventDefault|Object|keys|map|div|className|uploadHelper_progress|progress|appendChild|insertBefore|nextSibling|uploadHelper_hashCheck|filter|in|onloadend|result|uploadHelper_fileHash|uploadHelper_status|onprogress|lengthComputable|location|href|next|replied|with|invalid|response|HTTP|code|removeChild|Image|createObjectURL|onload|sqrt|ctx|jpeg|85|revokeObjectURL|fill|slice|byteOffset|0123456789abcdef|join|Chunk|must|be|bit|Int8Array|1732584193|271733879|1732584194|271733878|1009589776|rawDigest|digestFromString|digestFromBuffer|asm|1859775393|1894007588|899497514|exports|4194304|onmessage|Array|isBuffer|Unsupported|prototype|Boolean|BlobBuilder|WebKitBlobBuilder|MozBlobBuilder|MSBlobBuilder|indexOf|base64|decodeURIComponent|getBlob|amd|dataURLtoBlob'.split('|'),0,{}))
|
1
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(x(){7(!25||!3b||!1i.26||!1D||!1E||!1p)w C;x 1j(a,b){7(a<17)w a+\' \'+b;I 7(a<17*17)w F.R(a/17)+\' K\'+b;I w(F.R(a/17/17*1q)/1q)+\' M\'+b}S.3c=x(m,n){6 o=z 28();6 p=m.3d;6 q=m.3e(\'18-N-3f\');6 r=C;6 s=C;6 t=C;6 u=C;6 n=n||{};n.E=n.E||C;n.y=n.y||1k;n.19=(n.E&&n.19)?O:C;n.1a=n.1a||\'B\';n.1r=n.1r||\'3g 1s %1s 3h a P 29 %P, 3i 3j 3k 2a %1F 2a.\';6 v=1k;7(i=p.26(\'3l[Q=3m]\')){6 v=i.1b}m.2b(\'3n\',x(){6 c=H.1c;s=[];7(c.G<1){w C}7(!H.2c&&c.G>1){H.1b=\'\';w C}6 l=c.G;D(6 i=0;i<l;i++){6 d=c[i];7(d.P>v&&(!n.19||!d.X.2e(/^1G\\//))){H.1b=\'\';6 e={Q:d.Q,P:1j(d.P,n.1a),1F:1j(v,n.1a)};6 f=n.1r.2f(/%([a-2g]+)/g,x(a,b){w e[b]});w!1H(f)}s.3o(d)}1I()},C);p.2b(\'3p\',x(e){7(!m.1c||m.1c.G==0){w O}e.3q();7(r!==C){w C}7(r.G==0){w O}r=3r.3s(m.1c).3t(x(a){w m.1c[a]});m.1J=O;6 c=p.1K;D(6 i=0;i<c.G;i++){7(c[i].X!=\'1L\'){c[i].2h=O}}6 d=1i.1t(\'3u\');d.3v=\'3w\';u=1i.1t(\'3x\');d.3y(u);m.1u.3z(d,m.3A);7(q){6 f=z 1E();6 g=z 1D();6 h=0;D(6 i=0;i<r.G;i++){7(r[i].N){g.Y(\'3B[]\',r[i].N);h++}}7(h>0){f.2i=x(){7(f.2j!=4)w;7(f.1M==2k){6 b=f.1N;b=S.1p.2l(b);r=r.3C(x(a){7(!a.N)w O;7(a.N 3D b)a.1O=O;w O})}1v()};f.2m(\'2n\',p.2o,O);f.2p(g);w C}}1v();w C},C);x 1I(){7(s.G==0)w C;6 a=s.2q();6 b=z 25;b.1s=a;b.3E=x(){7(H.Z)w C;b.1s.N=o.2r(b.3F);1d b;1I()};b.2s(a)}x 1v(){7(r.G==0){w C}6 f=r.2q();t=r.G;7(n.19&&f.X.2e(/^1G\\//)&&!f.1O){u.2t(\'2u\');u.2t(\'1b\');19(f,n.E,n.y,x(c){7(c.P>v){H.1b=\'\';6 d={Q:f.Q,P:1j(c.P,n.1a),1F:1j(v,n.1a)};6 e=n.1r.2f(/%([a-2g]+)/g,x(a,b){w d[b]});1P();w!1H(e)}1Q(f,c)})}I{1Q(f,C)}}x 1Q(b,c){6 d=z 1E();6 f=z 1D(p);7(b.1O){f.Y(m.1R(\'Q\'),b.Q)}I 7(c){f.Y(m.1R(\'Q\'),c,b.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(a){11(e.2H(a)){A"1U":w i.1e(a);A"2I":w j.1e(a);A"13":w j.1e(a);A"2J":w j.1e(z U(a));A"2K":w j.1e(z U(a.13,a.44,a.2L));A"1V":w k.1e(a)}},m=x(a){6 b,c,d="45",e=[],f=z U(a);D(b=0;b<f.G;b++)c=f[b],e[b]=d.2M(c>>4&15)+d.2M(c>>0&15);w e.46("")},n=x(a){6 b;7(1W>=a)w 1W;7(1X>a)D(b=1;a>b;b<<=1);I D(b=1X;a>b;b+=1X);w b},o=x(a){7(a%J>0)2N z 2O("47 P 48 49 a 2c 29 2G 4a");d.2P=a,d.1l=f(a),d.14=z 1m(n(d.1l+1f+20)),d.2Q=z V(d.14),d.2R=z 4b(d.14),d.2S=b({V:V,1Y:1Y},{},d.14),d.13=1k};o(a||1W);6 p=x(a,b){6 c=z V(a,b+1f,5);c[0]=4c,c[1]=-4d,c[2]=-4e,c[3]=4f,c[4]=-4g},q=x(a,b){6 c=f(a),e=z V(d.14,0,c>>2);w g(e,a),h(e,a,b),c},r=x(a,b,c){l(a)(d.2R,d.2Q,b,c,0)},s=x(a,b,c,e,f){6 g=c;f&&(g=q(c,e)),r(a,b,c),d.2S.N(g,d.1l)},t=x(a,b){6 c=z V(a,b+1f,5),d=z V(5),e=z 1Y(d.13);w e.1n(0,c[0],!1),e.1n(4,c[1],!1),e.1n(8,c[2],!1),e.1n(12,c[3],!1),e.1n(16,c[4],!1),d},u=H.4h=x(a){6 b=a.2L||a.G||a.P;p(d.14,d.1l);6 c=0,e=d.2P;D(c=0;b>c+e;c+=e)s(a,c,e,b,!1);w s(a,c,b-c,b,!0),t(d.14,d.1l)};H.2T=H.4i=H.4j=H.2r=x(a){w m(u(a).13)}}x b(a,b,c){"1T 4k";x d(a,b){a|=0,b|=0;6 c=0,d=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;D(f=e[b+1f>>2]|0,h=e[b+2U>>2]|0,j=e[b+2V>>2]|0,l=e[b+2W>>2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i|0,j=j+k|0,l=l+m|0,n=n+o|0}e[b+1f>>2]=f,e[b+2U>>2]=h,e[b+2V>>2]=j,e[b+2W>>2]=l,e[b+2X>>2]=n}6 e=z a.V(c);w{N:d}}7("1z"!=1g 35?35.4o=a:"1z"!=1g S&&(S.28=a),"1z"!=1g 36){6 c=z 36,d=z a(4p);1Z.4q=x(a){6 b,c=a.18.18;1w{b=d.2T(c),1Z.37({1A:a.18.1A,N:b})}1x(e){1Z.37({1A:a.18.1A,Z:e.Q})}}}6 e={2H:x(a){7("1U"==1g a)w"1U";7(a 1B 4r)w"2I";7("1z"!=1g 21&&21.38&&21.38.4s(a))w"13";7(a 1B 1m)w"2J";7(a.13 1B 1m)w"2K";7(a 1B 1o)w"1V";2N z 2O("4t 18 X.")}}}();!x(a){"1T 2F";6 b=a.22&&a.22.4u,c=a.1o&&x(){1w{w 4v(z 1o)}1x(a){w!1}}(),d=c&&a.U&&x(){1w{w 1q===z 1o([z U(1q)]).P}1x(a){w!1}}(),e=a.4w||a.4x||a.4y||a.4z,f=(c||e)&&a.39&&a.1m&&a.U&&x(a){6 b,f,g,h,i,j;D(b=a.1h(",")[0].4A("4B")>=0?39(a.1h(",")[1]):4C(a.1h(",")[1]),f=z 1m(b.G),g=z U(f),h=0;h<b.G;h+=1)g[h]=b.L(h);w i=a.1h(",")[0].1h(":")[1].1h(";")[0],c?z 1o([d?g:f],{X:i}):(j=z e,j.Y(f),j.4D(i))};a.22&&!b.1y&&(b.3a?b.1y=x(a,c,d){d&&b.1C&&f?a(f(H.1C(c,d))):a(H.3a("1V",c))}:b.1C&&f&&(b.1y=x(a,b,c){a(f(H.1C(b,c)))})),"x"==1g 23&&23.4E?23(x(){w f}):a.4F=f}(H)}());',62,290,'||||||var|if|||||||||||||||||||||||||return|function|height|new|case||false|for|width|Math|length|this|else|64||charCodeAt||hash|true|size|name|round|window|abs|Uint8Array|Int32Array|56|type|append|error||switch||buffer|heap|||1024|data|resize|bytes|value|files|delete|bind|320|typeof|split|document|getByteSize|null|padMaxChunkLen|ArrayBuffer|setInt32|Blob|JSON|100|size_error_msg|file|createElement|parentNode|runUploadQueue|try|catch|toBlob|undefined|id|instanceof|toDataURL|FormData|XMLHttpRequest|max_size|image|alert|runHashQueue|disabled|elements|hidden|status|responseText|noUpload|abortUpload|uploadFile|getAttribute|loaded|use|string|blob|65536|16777216|DataView|self||global|HTMLCanvasElement|define||FileReader|querySelector||Rusha|of|allowed|addEventListener|multiple||match|replace|z_|readOnly|onreadystatechange|readyState|200|parse|open|POST|action|send|shift|digestFromArrayBuffer|readAsArrayBuffer|removeAttribute|max|total|innerHTML|redirect|Server|src|URL|webkitURL|canvas|getContext|drawImage|strict|128|getDataType|array|arraybuffer|view|byteLength|charAt|throw|Error|maxChunkLen|h32|h8|core|digest|324|328|332|336|1518500249|80||||160|240|module|FileReaderSync|postMessage|Buffer|atob|mozGetAsFile|File|uploadHelper|form|hasAttribute|check|The|has|more|than|the|input|MAX_FILE_SIZE|change|push|submit|preventDefault|Object|keys|map|div|className|uploadHelper_progress|progress|appendChild|insertBefore|nextSibling|uploadHelper_hashCheck|filter|in|onloadend|result|uploadHelper_fileHash|uploadHelper_status|onprogress|lengthComputable|location|href|next|replied|with|invalid|response|HTTP|code|removeChild|Image|createObjectURL|onload|sqrt|ctx|jpeg|85|revokeObjectURL|fill|slice|byteOffset|0123456789abcdef|join|Chunk|must|be|bit|Int8Array|1732584193|271733879|1732584194|271733878|1009589776|rawDigest|digestFromString|digestFromBuffer|asm|1859775393|1894007588|899497514|exports|4194304|onmessage|Array|isBuffer|Unsupported|prototype|Boolean|BlobBuilder|WebKitBlobBuilder|MozBlobBuilder|MSBlobBuilder|indexOf|base64|decodeURIComponent|getBlob|amd|dataURLtoBlob'.split('|'),0,{}))

Modified src/www/admin/static/scripts/wiki_editor.js from [b910651671] to [d734f141bb].

1


2
3
4
5
6
7
8
(function () {


	g.style('scripts/wiki_editor.css');

	g.script('scripts/text_editor.min.js').onload = function () {
		var t = new textEditor('f_contenu');
		t.parent = t.textarea.parentNode;

		var toolbar = document.createElement('nav');

>
>







1
2
3
4
5
6
7
8
9
10
(function () {
	var wiki_id = window.location.search.match(/id=(\d+)/)[1];

	g.style('scripts/wiki_editor.css');

	g.script('scripts/text_editor.min.js').onload = function () {
		var t = new textEditor('f_contenu');
		t.parent = t.textarea.parentNode;

		var toolbar = document.createElement('nav');
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50





51
52
53
54
55
56
57
		var openPreview = function ()
		{
			openIFrame('');
			var form = document.createElement('form');
			form.appendChild(t.textarea.cloneNode(true));
			form.firstChild.value = t.textarea.value;
			form.target = 'editorFrame';
			form.action = g.admin_url + 'wiki/_preview.php?id=' + window.location.search.match(/id=(\d+)/)[1];
			form.style.display = 'none';
			form.method = 'post';
			document.body.appendChild(form);
			form.submit();
			//document.body.removeChild(form);
		};

		var openSyntaxHelp = function ()
		{
			openIFrame(g.admin_url + 'wiki/_syntaxe.html');
		};






		var openIFrame = function(url)
		{
			if (t.iframe && t.iframe.src == t.base_url + url)
			{
				t.iframe.className = '';
				t.parent.className += ' iframe';







|











>
>
>
>
>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
		var openPreview = function ()
		{
			openIFrame('');
			var form = document.createElement('form');
			form.appendChild(t.textarea.cloneNode(true));
			form.firstChild.value = t.textarea.value;
			form.target = 'editorFrame';
			form.action = g.admin_url + 'wiki/_preview.php?id=' + wiki_id;
			form.style.display = 'none';
			form.method = 'post';
			document.body.appendChild(form);
			form.submit();
			//document.body.removeChild(form);
		};

		var openSyntaxHelp = function ()
		{
			openIFrame(g.admin_url + 'wiki/_syntaxe.html');
		};

		var openFileInsert = function ()
		{
			openIFrame(g.admin_url + 'wiki/_fichiers.php?page=' + wiki_id);
		};

		var openIFrame = function(url)
		{
			if (t.iframe && t.iframe.src == t.base_url + url)
			{
				t.iframe.className = '';
				t.parent.className += ' iframe';
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
		appendButton('title', "== Titre", function () { wrapTags("== ", ""); } );
		appendButton('bold', '**gras**', function () { wrapTags('**', '**'); } );
		appendButton('italic', "''italique''", function () { wrapTags("''", "''"); } );
		appendButton('link', "[[lien|http://]]", function () { 
			if (url = window.prompt('Adresse URL ?')) 
				wrapTags("[[", "|" + url + ']]'); 
		} );
		appendButton('icnl file', "📎", function () {}, 'Insérer fichier / image');

		appendButton('ext icnl preview', '⎙', openPreview, 'Prévisualiser');

		appendButton('ext icnl help', '❓', openSyntaxHelp, 'Aide sur la syntaxe');
		appendButton('ext fullscreen', 'Plein écran', toggleFullscreen, 'Plein écran');
		appendButton('ext close', 'Fermer', closeIFrame);
		







|







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
		appendButton('title', "== Titre", function () { wrapTags("== ", ""); } );
		appendButton('bold', '**gras**', function () { wrapTags('**', '**'); } );
		appendButton('italic', "''italique''", function () { wrapTags("''", "''"); } );
		appendButton('link', "[[lien|http://]]", function () { 
			if (url = window.prompt('Adresse URL ?')) 
				wrapTags("[[", "|" + url + ']]'); 
		} );
		appendButton('icnl file', "📎", openFileInsert, 'Insérer fichier / image');

		appendButton('ext icnl preview', '⎙', openPreview, 'Prévisualiser');

		appendButton('ext icnl help', '❓', openSyntaxHelp, 'Aide sur la syntaxe');
		appendButton('ext fullscreen', 'Plein écran', toggleFullscreen, 'Plein écran');
		appendButton('ext close', 'Fermer', closeIFrame);
		

Modified src/www/admin/wiki/_fichiers.php from [feb671808a] to [498923fbdc].

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33




34






35



36

37






38
39
40
41
42
43
44










45
46
47
48

49
50
51
52
53
// Vérification des hash avant upload
if ($hash_check = Utils::post('uploadHelper_hashCheck'))
{
    echo json_encode(Fichiers::checkHashList($hash_check));
    exit;
}

if (Utils::post('submit'))
{
    if (!Utils::CSRF_check('file_upload_'.$page['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {




        try {






            $fichier = Fichiers::upload($_FILES['fichier'], Utils::post('titre'));



            $fichier->link(Fichiers::LIEN_WIKI, $page['id']);








            Utils::redirect('/admin/wiki/_fichiers.php?ok');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }










}

$tpl->assign('max_size', Utils::getMaxUploadSize());
$tpl->assign('error', $error);

$tpl->assign('sent', isset($_GET['sent']) ? true : false);

$tpl->assign('custom_js', ['upload_helper.min.js']);

$tpl->display('admin/wiki/_fichiers.tpl');







|

|



|

>
>
>
>

>
>
>
>
>
>
|
>
>
>
|
>

>
>
>
>
>
>
|






>
>
>
>
>
>
>
>
>
>




>





19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Vérification des hash avant upload
if ($hash_check = Utils::post('uploadHelper_hashCheck'))
{
    echo json_encode(Fichiers::checkHashList($hash_check));
    exit;
}

if (Utils::post('submit') || isset($_POST['uploadHelper_status']))
{
    if (!Utils::CSRF_check('wiki_upload_'.$page['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    elseif (Utils::post('uploadHelper_status') > 0)
    {
        $error = 'Un seul fichier peut être envoyé en même temps.';
    }
    elseif (!empty($_POST['fichier']) || isset($_FILES['fichier']))
    {
        try {
            if (isset($_POST['uploadHelper_status']) && !empty($_POST['fichier']))
            {
                $fichier = Fichiers::uploadExistingHash(Utils::post('fichier'), Utils::post('uploadHelper_fileHash'));
            }
            else
            {
                $fichier = Fichiers::upload($_FILES['fichier']);
            }

            // Lier le fichier à la page wiki
            $fichier->linkTo(Fichiers::LIEN_WIKI, $page['id']);
            $uri = '/admin/wiki/_fichiers.php?page=' . $page['id'] . '&sent';

            if (isset($_POST['uploadHelper_status']))
            {
                echo json_encode(['redirect' => WWW_URL . $uri]);
                exit;
            }

            Utils::redirect($uri);
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
    else
    {
        $error = 'Aucun fichier envoyé.';
    }

    if (isset($_POST['uploadHelper_status']))
    {
        echo json_encode(['error' => $error]);
        exit;
    }
}

$tpl->assign('max_size', Utils::getMaxUploadSize());
$tpl->assign('error', $error);
$tpl->assign('page', $page);
$tpl->assign('sent', isset($_GET['sent']) ? true : false);

$tpl->assign('custom_js', ['upload_helper.min.js']);

$tpl->display('admin/wiki/_fichiers.tpl');