Пример #1
0
/**
 * Plugin SkelEditor
 * Editeur de squelette en ligne
 * (c) 2007-2010 erational
 * Licence GPL-v3
 *
 */

function action_skeleditor_new_from_dist(){
	$securiser_action = charger_fonction('securiser_action','inc');
	$arg = $securiser_action();

	// $arg est le fichier que l'on veut personaliser
	if (strncmp($arg,_DIR_RACINE,strlen(_DIR_RACINE)!==0))
		$arg = _DIR_RACINE.$arg;

	include_spip('inc/skeleditor');
	$file = skeleditor_nom_copie($arg);
	if ($file){
		include_spip('inc/skeleditor');
		$path_base = skeleditor_path_editable();
		list($chemin,) = skeleditor_cree_chemin($path_base, $file);
		if ($chemin){
			$file = basename($file);

			if (!file_exists($chemin . $file)) {
				lire_fichier($arg, $contenu);
				ecrire_fichier($chemin . $file, skeleditor_commente_copie($arg,$contenu));
			}

			if (file_exists($f=$chemin.$file))
				$GLOBALS['redirect'] = parametre_url(_request('redirect'),'f',$f);
		}
	}

}
Пример #2
0
/**
 * Lister les fichiers editables
 */
function skeleditor_files_editables($path=null){
	if (is_null($path))
		$path = skeleditor_path_editable();
	if (!$path) return array();

	$files_editable = preg_files($path,'[.]('._SE_EXTENSIONS.')$');
	$files_editable = sort_directory_first($files_editable,$path); // utile ?

	return $files_editable;
}
Пример #3
0
function skeleditor_dossier(){
	include_spip('inc/skeleditor');
	return skeleditor_path_editable();
}
Пример #4
0
/**
 * Autoriser a creer dans un dossier squelette
 *
 */
function autoriser_squelette_creerdans_dist($faire, $type, $path, $qui, $opt) {
	include_spip('inc/skeleditor');
	$path = rtrim($path,'/');
	$path_editable = skeleditor_path_editable();
	$files_editable = skeleditor_files_editables($path_editable);
	
  return (autoriser('skeleditor','','',$qui)
					AND ($path==rtrim($path_editable,'/') OR in_array($path,array_map('dirname',$files_editable))));
}