gestion simplifiée du pdf.
disparition du chemin dans la barre d'adresse après capture
This commit is contained in:
Bronco 2013-06-29 10:53:37 +02:00
parent e7bbb002bc
commit 2ceecc1292

View file

@ -1,9 +1,10 @@
<?php <?php
if (isset($_GET['public'])){$public=true;$bodyclass='publicpage';}else{$bodyclass='';$public=false;include 'auto_restrict.php';} if (isset($_GET['public'])){$publicarg='?public';$public=true;$bodyclass='publicpage';}else{$publicarg='';$bodyclass='';$public=false;include 'auto_restrict.php';}
function aff($a,$stop=true){echo 'Arret a la ligne '.__LINE__.' du fichier '.__FILE__.'<pre>';var_dump($a);echo '</pre>';if ($stop){exit();}} function aff($a,$stop=true){echo 'Arret a la ligne '.__LINE__.' du fichier '.__FILE__.'<pre>';var_dump($a);echo '</pre>';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 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 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);} 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';} if(isset($_GET['publicget'])||isset($_GET['privateget'])){$bodyclass.=' iframe';}
$bodyclass=bodyclasses($bodyclass);$target=''; $bodyclass=bodyclasses($bodyclass);$target='';
@ -35,7 +36,7 @@ $GLOBALS['data_folder'] = 'mypersonaldata';
$GLOBALS['private_data_folder'] = $GLOBALS['data_folder'].'/private'; $GLOBALS['private_data_folder'] = $GLOBALS['data_folder'].'/private';
$GLOBALS['public_data_folder'] = $GLOBALS['data_folder'].'/public'; $GLOBALS['public_data_folder'] = $GLOBALS['data_folder'].'/public';
$GLOBALS['default_data_folder'] = $GLOBALS['public_data_folder']; $GLOBALS['default_data_folder'] = $GLOBALS['public_data_folder'];
$GLOBAL['version']='1.2'; $GLOBAL['version']='1.3';
$GLOBALS['message'] = 'Votre webliothèque perso'; $GLOBALS['message'] = 'Votre webliothèque perso';
$GLOBALS['public_title'] = 'Voici la webliothèque publique de Bronco'; $GLOBALS['public_title'] = 'Voici la webliothèque publique de Bronco';
$bookmarklet='<a title="Drag this link to your shortcut bar" href=\'javascript:javascript:(function(){var url = location.href;window.open("http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].'?q="+ encodeURIComponent(url),"_blank","menubar=yes,height=600,width=1000,toolbar=yes,scrollbars=yes,status=yes");})();\' >Bookmarklet</a>'; $bookmarklet='<a title="Drag this link to your shortcut bar" href=\'javascript:javascript:(function(){var url = location.href;window.open("http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].'?q="+ encodeURIComponent(url),"_blank","menubar=yes,height=600,width=1000,toolbar=yes,scrollbars=yes,status=yes");})();\' >Bookmarklet</a>';
@ -93,6 +94,15 @@ if (!$public){
else { else {
$GLOBALS['target_folder'] = $GLOBALS['default_data_folder'].'/'.$new_folder; $GLOBALS['target_folder'] = $GLOBALS['default_data_folder'].'/'.$new_folder;
} }
/*GESTION DU PDF ICI*/
if (strtolower(substr($_GET['q'],-4))=='.pdf'){
$title=basename($_GET['q']);
file_put_contents($GLOBALS['target_folder'].'/'.$title,$GLOBALS['main_page_data']);
file_put_contents($GLOBALS['target_folder'].'/index.php','<?php header("location: '.$title.'");?>');
}else{
$liste_css = array(); $liste_css = array();
// parse le fichier principal à la recherche de données à télécharger // parse le fichier principal à la recherche de données à télécharger
$files = list_retrievable_data($GLOBALS['url'], $GLOBALS['main_page_data']); $files = list_retrievable_data($GLOBALS['url'], $GLOBALS['main_page_data']);
@ -226,14 +236,15 @@ if (!$public){
$n++; $n++;
$count = count($liste_css); $count = count($liste_css);
} }
}
// enregistre un fichier dinformations concernant la page (date, url, titre) // enregistre un fichier dinformations concernant la page (date, url, titre)
$info = ''; $info = '';
$info .= 'URL="'.$GLOBALS['url'].'"'."\n"; $info .= 'URL="'.$GLOBALS['url'].'"'."\n";
$info .= 'TITLE="'.$title.'"'."\n"; $info .= 'TITLE="'.$title.'"'."\n";
$info .= 'DATE="'.time().'"'."\n"; $info .= 'DATE="'.time().'"'."\n";
file_put_contents($GLOBALS['target_folder'].'/'.'index.ini', $info); file_put_contents($GLOBALS['target_folder'].'/'.'index.ini', $info);
$GLOBALS['done']['d'] = 'ajout'; /*$GLOBALS['done']['d'] = 'ajout';
$GLOBALS['done']['lien'] = $GLOBALS['target_folder'].'/'; $GLOBALS['done']['lien'] = $GLOBALS['target_folder'].'/'; */
} }
@ -581,7 +592,7 @@ if ($GLOBALS['done']['d'] !== FALSE) {
</head> </head>
<body <?php echo $bodyclass;?>> <body <?php echo $bodyclass;?>>
<header><a href="<?php echo $_SERVER['PHP_SELF'];if ($public){echo '?public'; }?>"><img src="design/logo2.png"/></a> <header><a href="<?php echo $_SERVER['PHP_SELF'].$publicarg; ?>"><img src="design/logo2.png"/></a>
<nav id="orpx_nav-bar"> <nav id="orpx_nav-bar">
<?php <?php
if (!$public){ if (!$public){