Ajout de la possibilité de sauver des fichiers seul.
Ajout d'une favicon en fonction du type de fichier. Ajout d'une favicon par défaut si aucune favicon est trouvé
26
config.php
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/* The configuration generated with auto_form*/
|
/* The configuration generated with auto_form*/
|
||||||
|
|
||||||
$GLOBAL['data_folder'] = 'mypersonaldata';
|
$GLOBAL['data_folder'] = 'mypersonaldata';
|
||||||
$GLOBAL['default_data_folder'] = 'public';
|
$GLOBAL['default_data_folder'] = 'public';
|
||||||
$GLOBAL['rss_title'] = 'Respawn: le flux de la webliothèque';
|
$GLOBAL['rss_title'] = 'Respawn: le flux de la webliothèque';
|
||||||
|
@ -9,4 +8,29 @@ $GLOBAL['message']='Votre webliothèque perso';
|
||||||
$GLOBAL['public_title'] = 'Voici la webliothèque publique de Bronco';
|
$GLOBAL['public_title'] = 'Voici la webliothèque publique de Bronco';
|
||||||
$GLOBAL['skin'] = 'pinterest';
|
$GLOBAL['skin'] = 'pinterest';
|
||||||
|
|
||||||
|
// File restriction
|
||||||
|
$GLOBAL['image'] = array(
|
||||||
|
'image/png' => 'png',
|
||||||
|
'image/jpg' => 'jpg',
|
||||||
|
'image/jpeg' => 'jpg',
|
||||||
|
'image/jpe' => 'jpg',
|
||||||
|
'image/gif' => 'gif',
|
||||||
|
'image/bmp' => 'bmp',
|
||||||
|
'image/tiff' => 'tiff'
|
||||||
|
);
|
||||||
|
$GLOBAL['document'] = array(
|
||||||
|
'application/vnd.oasis.opendocument.text' => 'odt',
|
||||||
|
'application/vnd.oasis.opendocument.spreadsheet' => 'ods',
|
||||||
|
'application/pdf' => 'pdf',
|
||||||
|
'application/msword' => 'doc',
|
||||||
|
'application/rtf' => 'rtf',
|
||||||
|
'application/vnd.ms-excel' => 'xls',
|
||||||
|
'application/vnd.ms-powerpoint' => 'ppt'
|
||||||
|
);
|
||||||
|
$GLOBAL['archive'] = array(
|
||||||
|
'application/zip' => 'zip',
|
||||||
|
'application/x-rar-compressed' => 'rar',
|
||||||
|
'application/x-msdownload' => 'exe',
|
||||||
|
'application/x-msdownload' => 'msi'
|
||||||
|
);
|
||||||
?>
|
?>
|
|
@ -134,6 +134,7 @@ if(file_exists('user_config.php')){
|
||||||
}
|
}
|
||||||
unset($GLOBAL['private_data_folder']);
|
unset($GLOBAL['private_data_folder']);
|
||||||
unset($GLOBAL['public_data_folder']);
|
unset($GLOBAL['public_data_folder']);
|
||||||
|
unset($GLOBAL['image'],$GLOBAL['document'],$GLOBAL['archive']);
|
||||||
$GLOBAL['default_data_folder']=basename($GLOBAL['default_data_folder']);
|
$GLOBAL['default_data_folder']=basename($GLOBAL['default_data_folder']);
|
||||||
|
|
||||||
$message='';
|
$message='';
|
||||||
|
|
5
design/icons/AUTHORS
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Faenza is designed and developed by Matthieu James <matthieu.james@gmail.com>.
|
||||||
|
|
||||||
|
Faenza icons are all licensed under the GPL.
|
||||||
|
|
||||||
|
Thanks to Holger Seelig and clemyeats for their help for having some text preview inside icons in Nautilus.
|
1
design/icons/bmp.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
png.png
|
1
design/icons/doc.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
odt.png
|
BIN
design/icons/exe.png
Normal file
After Width: | Height: | Size: 748 B |
1
design/icons/gif.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
png.png
|
BIN
design/icons/html.png
Normal file
After Width: | Height: | Size: 770 B |
1
design/icons/jpg.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
png.png
|
1
design/icons/msi.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
exe.png
|
BIN
design/icons/odp.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
design/icons/ods.png
Normal file
After Width: | Height: | Size: 495 B |
BIN
design/icons/odt.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
design/icons/pdf.png
Normal file
After Width: | Height: | Size: 799 B |
BIN
design/icons/png.png
Normal file
After Width: | Height: | Size: 671 B |
1
design/icons/rar.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
zip.png
|
BIN
design/icons/rtf.png
Normal file
After Width: | Height: | Size: 463 B |
1
design/icons/tiff.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
png.png
|
1
design/icons/xls.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
ods.png
|
BIN
design/icons/zip.png
Normal file
After Width: | Height: | Size: 551 B |
59
index.php
|
@ -232,9 +232,21 @@ if (!$GLOBAL['public']){ // private
|
||||||
else {
|
else {
|
||||||
$GLOBAL['target_folder'] = $GLOBAL['default_data_folder'].'/'.$new_folder;
|
$GLOBAL['target_folder'] = $GLOBAL['default_data_folder'].'/'.$new_folder;
|
||||||
}
|
}
|
||||||
|
$urlInfo =pathinfo($GLOBAL['url']);
|
||||||
/*GESTION DU PDF ICI*/
|
$title = $urlInfo['filename'];
|
||||||
if (strtolower(substr($_GET['q'],-4))=='.pdf'){
|
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||||
|
$mineType = $finfo->buffer($GLOBAL['main_page_data']);
|
||||||
|
if(array_key_exists($mineType, $GLOBAL['image'])){
|
||||||
|
$ext = $GLOBAL['image'][$mineType];
|
||||||
|
file_put_contents($GLOBAL['target_folder'].'/'.$title.'.'.$ext, $GLOBAL['main_page_data']);
|
||||||
|
file_put_contents($GLOBAL['target_folder'].'/index.php','<!DOCTYPE html><html><head><title>'.$title.'</title></head><body><img src="'.$title.'.'.$ext.'" alt="Save image from '.$GLOBAL['url'].'"/></body></html>');
|
||||||
|
} elseif(array_key_exists($mineType, $GLOBAL['document'])){
|
||||||
|
$ext = $GLOBAL['document'][$mineType];
|
||||||
|
$title=basename($_GET['q']);
|
||||||
|
file_put_contents($GLOBAL['target_folder'].'/'.$title,$GLOBAL['main_page_data']);
|
||||||
|
file_put_contents($GLOBAL['target_folder'].'/index.php','<?php header("location: '.$title.'");?>');
|
||||||
|
} elseif(array_key_exists($mineType, $GLOBAL['archive'])){
|
||||||
|
$ext = $GLOBAL['archive'][$mineType];
|
||||||
$title=basename($_GET['q']);
|
$title=basename($_GET['q']);
|
||||||
file_put_contents($GLOBAL['target_folder'].'/'.$title,$GLOBAL['main_page_data']);
|
file_put_contents($GLOBAL['target_folder'].'/'.$title,$GLOBAL['main_page_data']);
|
||||||
file_put_contents($GLOBAL['target_folder'].'/index.php','<?php header("location: '.$title.'");?>');
|
file_put_contents($GLOBAL['target_folder'].'/index.php','<?php header("location: '.$title.'");?>');
|
||||||
|
@ -374,12 +386,14 @@ if (!$GLOBAL['public']){ // private
|
||||||
$n++;
|
$n++;
|
||||||
$count = count($liste_css);
|
$count = count($liste_css);
|
||||||
}
|
}
|
||||||
|
$mineType = '';
|
||||||
}
|
}
|
||||||
// enregistre un fichier d’informations concernant la page (date, url, titre)
|
// enregistre un fichier d’informations concernant la page (date, url, titre, extension du fichier)
|
||||||
$info = '';
|
$info = '';
|
||||||
$info .= 'URL="'.$GLOBAL['url'].'"'."\n";
|
$info .= 'URL="'.$GLOBAL['url'].'"'."\n";
|
||||||
$info .= 'TITLE="'.$title.'"'."\n";
|
$info .= 'TITLE="'.$title.'"'."\n";
|
||||||
$info .= 'DATE="'.time().'"'."\n";
|
$info .= 'DATE="'.time().'"'."\n";
|
||||||
|
$info .= 'TYPE="'.$ext.'"'."\n";
|
||||||
file_put_contents($GLOBAL['target_folder'].'/'.'index.ini', $info);
|
file_put_contents($GLOBAL['target_folder'].'/'.'index.ini', $info);
|
||||||
/*$GLOBAL['done']['d'] = 'ajout';
|
/*$GLOBAL['done']['d'] = 'ajout';
|
||||||
$GLOBAL['done']['lien'] = $GLOBAL['target_folder'].'/'; */
|
$GLOBAL['done']['lien'] = $GLOBAL['target_folder'].'/'; */
|
||||||
|
@ -795,6 +809,36 @@ function rand_new_name($name) {
|
||||||
return 'f_'.str_shuffle('abcd').mt_rand(100, 999).'--'.preg_replace('#[^\w.]#', '_', substr($name, 15)).'.'.pathinfo($name, PATHINFO_EXTENSION);
|
return 'f_'.str_shuffle('abcd').mt_rand(100, 999).'--'.preg_replace('#[^\w.]#', '_', substr($name, 15)).'.'.pathinfo($name, PATHINFO_EXTENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function returnLocalFavicon($path,$fileType){
|
||||||
|
$favicon = glob($path.'*favicon.*');
|
||||||
|
if(empty($favicon)){
|
||||||
|
if(file_exists('design/icons/'.$fileType.'.png')){
|
||||||
|
return 'design/icons/'.$fileType.'.png';
|
||||||
|
} else {
|
||||||
|
return 'design/icons/html.png';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $favicon[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Améliore la sortie print
|
||||||
|
*
|
||||||
|
* @author Tatane http://www.tatane.info/index.php/print_rn
|
||||||
|
* @author http://www.blog.cactuscrew.com/77-print_rn.html
|
||||||
|
* @param $data (array) tableau à examiner
|
||||||
|
* @param $name (string) nom a affiché
|
||||||
|
* @return false affiche les clef valeur du tableau $data
|
||||||
|
*/
|
||||||
|
function n_print($data, $name = '') {
|
||||||
|
$aBackTrace = debug_backtrace();
|
||||||
|
echo '<h2>', $name, '</h2>';
|
||||||
|
echo '<fieldset style="border: 1px solid orange; padding: 5px;color: #333; background-color: #fff;">';
|
||||||
|
echo '<legend style="border:1px solid orange;padding: 1px;background-color:#eee;color:orange;">', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], '</legend>';
|
||||||
|
echo '<pre>', htmlentities(print_r($data, 1)), '</pre>';
|
||||||
|
echo '</fieldset><br />';
|
||||||
|
}
|
||||||
|
|
||||||
if ($GLOBAL['done']['d'] !== FALSE) {
|
if ($GLOBAL['done']['d'] !== FALSE) {
|
||||||
switch($GLOBAL['done']['d']) {
|
switch($GLOBAL['done']['d']) {
|
||||||
|
@ -890,9 +934,7 @@ if ($GLOBAL['done']['d'] !== FALSE) {
|
||||||
if (is_dir($GLOBAL['public_data_folder'].'/'.$liste_pages[$i]) and ($liste_pages[$i] != '.') and ($liste_pages[$i] != '..')) {
|
if (is_dir($GLOBAL['public_data_folder'].'/'.$liste_pages[$i]) and ($liste_pages[$i] != '.') and ($liste_pages[$i] != '..')) {
|
||||||
// each folder should contain such a file "index.ini".
|
// each folder should contain such a file "index.ini".
|
||||||
$ini_file = $GLOBAL['public_data_folder'].'/'.$liste_pages[$i].'/index.ini';
|
$ini_file = $GLOBAL['public_data_folder'].'/'.$liste_pages[$i].'/index.ini';
|
||||||
$favicon = glob($GLOBAL['public_data_folder'].'/'.$liste_pages[$i].'/*favicon.*');
|
|
||||||
|
|
||||||
$favicon = (isset($favicon[0])) ? $favicon[0] : '';
|
|
||||||
if ( is_file($ini_file) and is_readable($ini_file) ) {
|
if ( is_file($ini_file) and is_readable($ini_file) ) {
|
||||||
$infos = parse_ini_file($ini_file);
|
$infos = parse_ini_file($ini_file);
|
||||||
} else {
|
} else {
|
||||||
|
@ -903,7 +945,7 @@ if ($GLOBAL['done']['d'] !== FALSE) {
|
||||||
} else {
|
} else {
|
||||||
$titre = 'titre'; $url = '#'; $date = 'date inconnue';
|
$titre = 'titre'; $url = '#'; $date = 'date inconnue';
|
||||||
}
|
}
|
||||||
|
$favicon = returnLocalFavicon($GLOBAL['public_data_folder'].'/'.$liste_pages[$i].'/',$infos['TYPE']);
|
||||||
$tags=$taglinks='';
|
$tags=$taglinks='';
|
||||||
if (isset($GLOBAL['tag_array']['public'][$liste_pages[$i]])){$tags=$GLOBAL['tag_array']['public'][$liste_pages[$i]];$taglinks=tag2links($GLOBAL['tag_array']['public'][$liste_pages[$i]]);}
|
if (isset($GLOBAL['tag_array']['public'][$liste_pages[$i]])){$tags=$GLOBAL['tag_array']['public'][$liste_pages[$i]];$taglinks=tag2links($GLOBAL['tag_array']['public'][$liste_pages[$i]]);}
|
||||||
echo "\t".'<li>';
|
echo "\t".'<li>';
|
||||||
|
@ -940,8 +982,6 @@ if ($GLOBAL['done']['d'] !== FALSE) {
|
||||||
if (is_dir($GLOBAL['private_data_folder'].'/'.$liste_pages[$i]) and ($liste_pages[$i] != '.') and ($liste_pages[$i] != '..')) {
|
if (is_dir($GLOBAL['private_data_folder'].'/'.$liste_pages[$i]) and ($liste_pages[$i] != '.') and ($liste_pages[$i] != '..')) {
|
||||||
// each folder should contain such a file "index.ini".
|
// each folder should contain such a file "index.ini".
|
||||||
$ini_file = $GLOBAL['private_data_folder'].'/'.$liste_pages[$i].'/index.ini';
|
$ini_file = $GLOBAL['private_data_folder'].'/'.$liste_pages[$i].'/index.ini';
|
||||||
$favicon=glob($GLOBAL['private_data_folder'].'/'.$liste_pages[$i].'/*favicon.*');
|
|
||||||
$favicon = (isset($favicon[0])) ? $favicon[0] : '';
|
|
||||||
if ( is_file($ini_file) and is_readable($ini_file) ) {
|
if ( is_file($ini_file) and is_readable($ini_file) ) {
|
||||||
$infos = parse_ini_file($ini_file);
|
$infos = parse_ini_file($ini_file);
|
||||||
} else {
|
} else {
|
||||||
|
@ -952,6 +992,7 @@ if ($GLOBAL['done']['d'] !== FALSE) {
|
||||||
} else {
|
} else {
|
||||||
$titre = 'titre'; $url = '#'; $date = 'date inconnue';
|
$titre = 'titre'; $url = '#'; $date = 'date inconnue';
|
||||||
}
|
}
|
||||||
|
$favicon = returnLocalFavicon($GLOBAL['public_data_folder'].'/'.$liste_pages[$i].'/',$infos['TYPE']);
|
||||||
$tags=$taglinks='';
|
$tags=$taglinks='';
|
||||||
if (isset($GLOBAL['tag_array']['private'][$liste_pages[$i]])){$tags=$GLOBAL['tag_array']['private'][$liste_pages[$i]];$taglinks=tag2links($GLOBAL['tag_array']['private'][$liste_pages[$i]]);}
|
if (isset($GLOBAL['tag_array']['private'][$liste_pages[$i]])){$tags=$GLOBAL['tag_array']['private'][$liste_pages[$i]];$taglinks=tag2links($GLOBAL['tag_array']['private'][$liste_pages[$i]]);}
|
||||||
|
|
||||||
|
|