From ea6f226da8b6f89f34fc14143e0beeaa2cf06658 Mon Sep 17 00:00:00 2001 From: Bronco Date: Tue, 25 Jun 2013 12:05:16 +0200 Subject: [PATCH] 1.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit J'ai ajouté un bouton déconnect, les pages respawnées se chargent dans une iframe pour conserver un accès vers l'index (en plus ça fait joli, la barre de titre est réduite dans ce mode) j'ai supprimé le bouton 'supprimer une page' dans le mode public (même si son effet était déjà inhibé dans le code) ainsi que le bouton bookmarklet Les noms des fichiers zippés sont désormais plus explicites. --- design/style.css | 14 +- index.php | 179 +++++++++++++++----------- mypersonaldata/index.html | 0 mypersonaldata/private/index.html | 0 mypersonaldata/public/index.html | 0 mypersonaldata/zipversions/index.html | 0 6 files changed, 117 insertions(+), 76 deletions(-) create mode 100644 mypersonaldata/index.html create mode 100644 mypersonaldata/private/index.html create mode 100644 mypersonaldata/public/index.html create mode 100644 mypersonaldata/zipversions/index.html diff --git a/design/style.css b/design/style.css index badfce2..2bb9582 100644 --- a/design/style.css +++ b/design/style.css @@ -11,7 +11,7 @@ a:hover { color: #050;text-shadow:0 0 5px green;} a { color: black; text-decoration: none;} input{outline:none;-moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; height:25px;padding : 3px ; vertical-align: bottom; margin-top : 3px ;} -input[type=text]{width:80%;min-width:200px; background-color:rgba(255,255,255,0.8);border:1px solid #444;border-top-color:#333;border-bottom-color:#aaa; -moz-box-shadow: inset 0 1px 3px #000000; -webkit-box-shadow: inset 0 1px 3px #000000; box-shadow: inset 0 1px 3px #000000; #000} +input[type=text]{width:80%;min-width:200px; background-color:rgba(255,255,255,0.8);border:1px solid #444;border-top-color:#333;border-bottom-color:#aaa; -moz-box-shadow: inset 0 1px 3px #000000; -webkit-box-shadow: inset 0 1px 3px #000000; box-shadow: inset 0 1px 3px #000000; } input[type=text]:hover{background-color:rgba(200,255,200,0.8);-moz-box-shadow: inset 0 1px 3px #040; -webkit-box-shadow: inset 0 1px 3px #040; box-shadow: inset 0 1px 3px #040; } input[type=text]:focus{background-color:rgba(200,255,200,0.9);-moz-box-shadow: inset 0 0 3px #040; -webkit-box-shadow: inset 0 0 3px #040; box-shadow: inset 0 0 3px #040; } input[type=submit]{cursor: pointer; border:1px solid #494;border-bottom-color:#272;border-top-color:#afa; background-color:rgba(0,200,0,0.8); -moz-box-shadow: 0 1px 2px #080; -webkit-box-shadow: 0 1px 2px #080; box-shadow: 0 1px 2px #080; -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=135, Color='#000')"; filter: progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=135, Color='#000'); } @@ -19,6 +19,7 @@ input[type=submit]:hover{ background-color:rgba(0,255,0,0.8);} input[type=submit]:active{border-color:black; background-color:rgba(0,255,0,0.8);} #____q{margin-top:20px;} header{ + -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border-bottom:1px solid #222; -moz-box-shadow: 0 1px 3px #888; -webkit-box-shadow: 0 1px 3px #888; box-shadow: 0 1px 3px #888; -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=135, Color='#888')"; filter: progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=135, Color='#888'); @@ -31,7 +32,11 @@ header{ header nav{display:inline-block; vertical-align: top;} header nav p{color:lightgreen;text-shadow: 0 1px 1px black;font-size:20px;} + + + aside{height:100%;padding-bottom : 70px;text-align:center;} +aside iframe{height:100%;border:none;} aside ul{padding:0;} aside li{margin:5px;list-style:none;vertical-align:middle;border-radius:3px;} aside .public li{background:rgba(100,255,100,0.2);} @@ -55,3 +60,10 @@ footer {text-align: right; color:#F80;text-shadow: 0 1px 1px black; position:fix footer a {color:lightgreen;text-shadow:0 1px 1px green;} footer a:hover {color:white;} +body.iframe aside{padding-bottom:0!important;} +body.iframe header {padding:2px;vertical-align: top;} +body.iframe header img{width:32px;height:auto;} +body.iframe header input{vertical-align: top;} +body.iframe header #____q{margin-top:2px;} +body.iframe header nav{margin-top:2px;display:inline-block; vertical-align: top;} +body.iframe header nav p{margin:0;padding:0;} \ No newline at end of file diff --git a/index.php b/index.php index 8acd884..d57c197 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,11 @@ ';var_dump($a);echo '';if ($stop){exit();}} +function BodyClasses($add=''){$regex='#(msie)[/ ]([0-9])+|(firefox)/([0-9])+|(chrome)/([0-9])+|(opera)/([0-9]+)|(safari)/([0-9]+)|(android)|(iphone)|(ipad)|(blackberry)|(Windows Phone)|(symbian)|(mobile)|(bada])#i';@preg_match($regex,$_SERVER['HTTP_USER_AGENT'],$resultat);return ' class="'.$add.' '.@preg_replace('#([a-zA-Z ]+)[ /]([0-9]+)#','$1 $1$2',$resultat[0]).' '.basename($_SERVER['PHP_SELF'],'.php').'" ';} +function title2filename($chaine){$a=array(' ',':','|','#','/','\\','$','*','?','&','<','>');return substr(stripAccents(str_replace($a,'_',$chaine)),0,30);} +function stripAccents($string){ $a=explode(' ','à á â ã ä ç è é ê ë ì í î ï ñ ò ó ô õ ö ù ú û ü ý ÿ À Á Â Ã Ä Ç È É Ê Ë Ì Í Î Ï Ñ Ò Ó Ô Õ Ö Ù Ú Û Ü Ý');$b=explode(' ','a a a a a c e e e e i i i i n o o o o o u u u u y y A A A A A C E E E E I I I I N O O O O O U U U U Y');return str_replace($a,$b,$string);} +if(isset($_GET['publicget'])||isset($_GET['privateget'])){$bodyclass.=' iframe';} +$bodyclass=bodyclasses($bodyclass);$target=''; /* (webpage retriever by Timo Van Neerden; http://lehollandaisvolant.net/contact December 2012) * last updated : December, 10th, 2012 @@ -29,7 +35,7 @@ $GLOBALS['data_folder'] = 'mypersonaldata'; $GLOBALS['private_data_folder'] = $GLOBALS['data_folder'].'/private'; $GLOBALS['public_data_folder'] = $GLOBALS['data_folder'].'/public'; $GLOBALS['default_data_folder'] = $GLOBALS['public_data_folder']; -$GLOBAL['version']='1.0'; +$GLOBAL['version']='1.2'; $GLOBALS['message'] = 'Votre webliothèque perso'; $GLOBALS['public_title'] = 'Voici la webliothèque publique de Bronco'; $bookmarklet='Bookmarklet'; @@ -227,7 +233,8 @@ if (!$public){ $info .= 'DATE="'.time().'"'."\n"; file_put_contents($GLOBALS['target_folder'].'/'.'index.ini', $info); $GLOBALS['done']['d'] = 'ajout'; - $GLOBALS['done']['lien'] = $GLOBALS['target_folder'].'/'; + $GLOBALS['done']['lien'] = $GLOBALS['target_folder'].'/'; + } }//die; @@ -270,34 +277,49 @@ if (!$public){ header("location: index.php"); } } + // disconnect + if (isset($_GET['discotime'])){log_user('disco','');} - if (isset($_GET['zipprivate'])) { + if (isset($_GET['privateget'])&&is_dir($GLOBALS['private_data_folder'].'/'.$_GET['privateget'])){$target=$GLOBALS['private_data_folder'].'/'.$_GET['privateget'];} - $zip_filename=$GLOBALS['data_folder'].'/zipversions/'.$_GET['zipprivate'].'.zip'; - - if (is_file($zip_filename)){header("location: $zip_filename");exit();} - if (is_dir($GLOBALS['private_data_folder'].'/'.$_GET['zipprivate'])){ - include 'zip.php'; - zip($_GET['zipprivate'].'.zip',$GLOBALS['private_data_folder'].'/'.$_GET['zipprivate'],$GLOBALS['data_folder'].'/zipversions/'); - header("location: $zip_filename"); + + if (isset($_GET['zipprivate'])) { + $ini_file = $GLOBALS['private_data_folder'].'/'.$_GET['zipprivate'].'/index.ini'; + if(is_file($ini_file)){$info=parse_ini_file($ini_file);}else{$info['TITLE']='';} + $origin_folder_path=$GLOBALS['private_data_folder'].'/'.$_GET['zipprivate']; + $zip_foldername=title2filename($info['TITLE']).'-'.$_GET['zipprivate']; + $zip_filename=$zip_foldername.'.zip'; + $zip_completepath=$GLOBALS['data_folder'].'/zipversions/'.$zip_filename; + if (is_file($zip_completepath)){header("location: $zip_completepath");exit();}// il existe déjà, on envoie + if (is_dir($origin_folder_path)){// sinon on crée le zip si le dossier existe + include 'zip.php'; + rename ($origin_folder_path,$zip_foldername); // on le déplace pour éviter de voir la structure de dossiers apparaître dans le zip + zip($zip_filename,$zip_foldername,$GLOBALS['data_folder'].'/zipversions/'); + rename ($zip_foldername,$origin_folder_path); // on le remet à sa place + header('location: '.$GLOBALS['data_folder'].'/zipversions/'.$zip_filename); } } } // public get //download public zip version if (isset($_GET['zippublic'])) { - - $zip_filename=$GLOBALS['data_folder'].'/zipversions/'.$_GET['zippublic'].'.zip'; - if (is_file($zip_filename)){header("location: $zip_filename");exit();} - if (is_dir($GLOBALS['public_data_folder'].'/'.$_GET['zippublic'])){ - include 'zip.php'; - - rename ($GLOBALS['public_data_folder'].'/'.$_GET['zippublic'],$_GET['zippublic']); // on le déplace pour éviter de voir la structure de dossiers apparaître dans le zip - zip($_GET['zippublic'].'.zip',$_GET['zippublic'],$GLOBALS['data_folder'].'/zipversions/'); - rename ($_GET['zippublic'],$GLOBALS['public_data_folder'].'/'.$_GET['zippublic']); // on le remet à sa place - header("location: $zip_filename"); + $ini_file = $GLOBALS['public_data_folder'].'/'.$_GET['zippublic'].'/index.ini'; + if(is_file($ini_file)){$info=parse_ini_file($ini_file);}else{$info['TITLE']='';} + $origin_folder_path=$GLOBALS['public_data_folder'].'/'.$_GET['zippublic']; + $zip_foldername=title2filename($info['TITLE']).'-'.$_GET['zippublic']; + $zip_filename=$zip_foldername.'.zip'; + $zip_completepath=$GLOBALS['data_folder'].'/zipversions/'.$zip_filename; + if (is_file($zip_completepath)){header("location: $zip_completepath");exit();}// il existe déjà, on envoie + if (is_dir($origin_folder_path)){// sinon on crée le zip si le dossier existe + include 'zip.php'; + rename ($origin_folder_path,$zip_foldername); // on le déplace pour éviter de voir la structure de dossiers apparaître dans le zip + zip($zip_filename,$zip_foldername,$GLOBALS['data_folder'].'/zipversions/'); + rename ($zip_foldername,$origin_folder_path); // on le remet à sa place + header('location: '.$GLOBALS['data_folder'].'/zipversions/'.$zip_filename); } } + if (isset($_GET['publicget'])&&is_dir($GLOBALS['public_data_folder'].'/'.$_GET['publicget'])){$target=$GLOBALS['public_data_folder'].'/'.$_GET['publicget'];} + @@ -558,7 +580,7 @@ if ($GLOBALS['done']['d'] !== FALSE) { - +>