diff --git a/design/actions.png b/design/actions.png index ac00de9..1e43e39 100644 Binary files a/design/actions.png and b/design/actions.png differ diff --git a/design/style.css b/design/style.css index 79953d6..badfce2 100644 --- a/design/style.css +++ b/design/style.css @@ -37,12 +37,13 @@ aside li{margin:5px;list-style:none;vertical-align:middle;border-radius:3px;} aside .public li{background:rgba(100,255,100,0.2);} aside .private li{background:rgba(255,100,100,0.2);} aside .public {background:rgba(100,255,100,0.2);} -aside .private {background:rgba(255,100,100,0.2);} +aside .private {background:rgba(255,100,100,0.2);} aside li em {font-size:10px ; color:#484;} aside li img {vertical-align:bottom;margin:1px;width:16px;height:16px;} -aside li a.suppr, aside li a.origine{opacity:0.5;width:16px;height:16px;display:inline-block;background:url(actions.png) no-repeat 0 -159px ;} +aside li a.suppr, aside li a.origine, aside li a.zip{opacity:0.5;width:16px;height:16px;display:inline-block;background:url(actions.png) no-repeat 0 -159px ;} aside li a.origine{background-position: 0 -396px ;} -aside li a.suppr:hover,aside li a.origine:hover{opacity:1;} +aside li a.zip{background-position: 0 2px ;} +aside li a.suppr:hover,aside li a.origine:hover,aside li a.zip:hover{opacity:1;} aside li a.toprivate,aside li a.topublic{float:right;margin-right:5px;opacity:0.5;} aside li a.toprivate:hover,aside li a.topublic:hover{opacity:1;} diff --git a/index.php b/index.php index e40b680..eb0f3ac 100644 --- a/index.php +++ b/index.php @@ -36,6 +36,7 @@ $bookmarklet=' $link) { $link[1] = trim($link[1]); if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1]) ) { - // absolute path w/o HTTP : add http. if (preg_match('#^//#', $link[1])) { $matches[$i][1] = $url_p['s'].':'.$link[1]; @@ -559,7 +572,8 @@ if ($GLOBALS['done']['d'] !== FALSE) { } else { $titre = 'titre'; $url = '#'; $date = 'date inconnue'; } - echo "\t".'
  • - '.$titre.' ['.$date.']
  • '."\n"; + echo "\t".'
  • - '.$titre.' ['.$date.']'; + if (!$public){echo '
  • '."\n";}else{echo "\n";} } } echo ''."\n"; @@ -590,7 +604,7 @@ if ($GLOBALS['done']['d'] !== FALSE) { } else { $titre = 'titre'; $url = '#'; $date = 'date inconnue'; } - echo "\t".'
  • - '.$titre.' ['.$date.']
  • '."\n"; + echo "\t".'
  • - '.$titre.' ['.$date.']
  • '."\n"; } } echo ''."\n"; diff --git a/zip.php b/zip.php new file mode 100644 index 0000000..54a00b1 --- /dev/null +++ b/zip.php @@ -0,0 +1,84 @@ +open($nom_archive, ZipArchive::CREATE) !== TRUE) { + // La création de l'archive a échouée + return false; + } + } + + if(substr($adr_dossier, -1)!='/') { + // Si l'adresse du dossier ne se termine pas par '/', on le rajoute + $adr_dossier .= '/'; + } + + if($dossier_base=="") { + // Si $dossier_base est vide ça veut dire que l'on rentre + // dans la fonction pour la première fois. Donc on retient + // le tout premier dossier (le dossier racine) dans $dossier_base + $dossier_base=$adr_dossier; + } + + if(file_exists($adr_dossier)) { + if(@$dossier = opendir($adr_dossier)) { + while(false !== ($fichier = readdir($dossier))) { + if($fichier != '.' && $fichier != '..') { + if(is_dir($adr_dossier.$fichier)) { + $zip->addEmptyDir($adr_dossier.$fichier); + zip($nom_archive, $adr_dossier.$fichier, $dossier_destination, $zip, $dossier_base); + } + else { + $zip->addFile($adr_dossier.$fichier); + } + } + } + } + } + + if($dossier_base==$adr_dossier) { + // On ferme la zip + $zip->close(); + + if($dossier_destination!='') { + if(substr($dossier_destination, -1)!='/') { + // Si l'adresse du dossier ne se termine pas par '/', on le rajoute + $dossier_destination .= '/'; + } + + // On déplace l'archive dans le dossier voulu + if(rename($nom_archive, $dossier_destination.$nom_archive)) { + return true; + } + else { + return false; + } + } + else { + return true; + } + } +} + +?>