Overview
SHA1 Hash:addaea15a943585299abded6f0a2d5b80d1e7cd0
Date: 2017-01-16 21:38:16
User: bohwaz
Comment:Fix don't try to fetch plugin directories
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2017-01-16
21:38
[5004acdf3a] Fix plugin name match in router (user: bohwaz, tags: trunk)
21:38
[addaea15a9] Fix don't try to fetch plugin directories (user: bohwaz, tags: trunk)
2016-12-07
22:08
[e683f5cefe] New release (user: bohwaz, tags: trunk, stable, 0.7.6)
Changes

Modified src/include/lib/Garradin/Plugin.php from [a9ad3fd1ec] to [933423603a].

173
174
175
176
177
178
179
180
181



182
183
184




185
186
187
188
189

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
		}

		if (!file_exists($this->path() . '/www/' . $file))
		{
			throw new UserException('Le fichier ' . $file . ' n\'existe pas dans le plugin ' . $this->id);
		}

		$plugin = $this;
		global $tpl, $config, $user, $membres;




		if (substr($file, -4) === '.php')
		{




			include $this->path() . '/www/' . $file;
		}
		else
		{
			// Récupération du type MIME à partir de l'extension

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

			if (isset($this->mimes[$ext]))
			{
				$mime = $this->mimes[$ext];
			}
			else
			{
				$mime = 'text/plain';
			}

			header('Content-Type: ' .$this->mimes[$ext]);
			header('Content-Length: ' . filesize($this->path() . '/www/' . $file));

			readfile($this->path() . '/www/' . $file);
		}
	}

	/**







|
<
>
>
>



>
>
>
>





>
|










|







173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
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
		}

		if (!file_exists($this->path() . '/www/' . $file))
		{
			throw new UserException('Le fichier ' . $file . ' n\'existe pas dans le plugin ' . $this->id);
		}

		if (is_dir($this->path() . '/www/' . $file))

		{
			throw new UserException(sprintf('Sécurité : impossible de lister le répertoire "%s" du plugin "%s".', $file, $this->id));
		}

		if (substr($file, -4) === '.php')
		{
			// Créer l'environnement d'exécution du plugin
			$plugin = $this;
			global $tpl, $config, $user, $membres;

			include $this->path() . '/www/' . $file;
		}
		else
		{
			// Récupération du type MIME à partir de l'extension
			$pos = strrpos($file, '.');
			$ext = substr($file, $pos+1);

			if (isset($this->mimes[$ext]))
			{
				$mime = $this->mimes[$ext];
			}
			else
			{
				$mime = 'text/plain';
			}

			header('Content-Type: ' .$mime);
			header('Content-Length: ' . filesize($this->path() . '/www/' . $file));

			readfile($this->path() . '/www/' . $file);
		}
	}

	/**