Ajout d'un fichier de config utilisateur

This commit is contained in:
Knah Tsaeb 2014-08-29 15:51:57 +02:00
parent 02b0829c8f
commit f23d8631f9
3 changed files with 71 additions and 64 deletions

1
.gitignore vendored
View file

@ -213,3 +213,4 @@ pip-log.txt
#Mr Developer #Mr Developer
.mr.developer.cfg .mr.developer.cfg
user_config.php

View file

@ -3,10 +3,10 @@
* @author bronco@warriordudimanche.com * @author bronco@warriordudimanche.com
* @copyright open source and free to adapt (keep me aware !) * @copyright open source and free to adapt (keep me aware !)
* @version 0.1 * @version 0.1
* auto_form.php is a little script to auto create a form and * auto_form.php is a little script to auto create a form and
* its content only with an array. * its content only with an array.
* It can create text inputs radiobuttons, select lists, passwords inputs. * It can create text inputs radiobuttons, select lists, passwords inputs.
* All the generated form's elements can be reached by classes * All the generated form's elements can be reached by classes
* and ids with css or jquery. * and ids with css or jquery.
* *
* It's possible to configure auto_form to add some features * It's possible to configure auto_form to add some features
@ -23,7 +23,7 @@ $config=array(
'use_a_radiobutton_choice'=>'choice one',// current value: other values are defined below 'use_a_radiobutton_choice'=>'choice one',// current value: other values are defined below
'my_password'=>'password', 'my_password'=>'password',
'confirm_password'=>'', 'confirm_password'=>'',
);*/ );*/
//then render_form($config); //then render_form($config);
@ -31,7 +31,7 @@ $config=array(
/* ##################################################################### /* #####################################################################
# auto_form config # # auto_form config #
##################################################################### #####################################################################
*/ */
// here are the basic parameters // here are the basic parameters
@ -68,7 +68,7 @@ function render_form($var){
if ($autoform_config['form_class']){$class=' class="'.$autoform_config['form_class'].'" ';} if ($autoform_config['form_class']){$class=' class="'.$autoform_config['form_class'].'" ';}
if ($autoform_config['enctype']){$enctype=' enctype="'.$autoform_config['enctype'].'" ';} if ($autoform_config['enctype']){$enctype=' enctype="'.$autoform_config['enctype'].'" ';}
if (isset($autoform_config['reset_button_label'])){$reset="<input type='reset' value='".$autoform_config['reset_button_label'].'"/>';} if (isset($autoform_config['reset_button_label'])){$reset="<input type='reset' value='".$autoform_config['reset_button_label'].'"/>';}
echo '<form name="'.$autoform_config['form_name']."\" $id $class $enctype method=\"".$autoform_config['method']."\" action=\"".$autoform_config['action']."\">\n "; echo '<form name="'.$autoform_config['form_name']."\" $id $class $enctype method=\"".$autoform_config['method']."\" action=\"".$autoform_config['action']."\">\n ";
foreach($var as $key=>$value){ foreach($var as $key=>$value){
$all_keys.=$key.' | '; $all_keys.=$key.' | ';
@ -77,7 +77,7 @@ function render_form($var){
$idclasname="name='$key' id='$key' class='$key'"; $idclasname="name='$key' id='$key' class='$key'";
// //
echo '<li>'; echo '<li>';
if (is_bool($value)){ if (is_bool($value)){
// oh, a checkbox ! // oh, a checkbox !
if ($value==true){$checked=' checked ';}else{$checked='';} if ($value==true){$checked=' checked ';}else{$checked='';}
echo $label; echo $label;
@ -89,7 +89,7 @@ function render_form($var){
// lists of choices // lists of choices
if (isset($autoform_config[$key]['type'])&&$autoform_config[$key]['type']=='radio'){ if (isset($autoform_config[$key]['type'])&&$autoform_config[$key]['type']=='radio'){
unset($autoform_config[$key]['type']); unset($autoform_config[$key]['type']);
// oh, a radiobutton list ! // oh, a radiobutton list !
echo $txt.'<br/>'; echo $txt.'<br/>';
echo "<ul>\n"; echo "<ul>\n";
@ -98,11 +98,11 @@ function render_form($var){
echo "<li><label for='$choice$key'> $choice </label><input name='$key' type='radio' value='$choice' $checked id='$choice$key'/></li>\n"; echo "<li><label for='$choice$key'> $choice </label><input name='$key' type='radio' value='$choice' $checked id='$choice$key'/></li>\n";
} }
echo "</ul>\n"; echo "</ul>\n";
}else{ }else{
// oh, a select input ! // oh, a select input !
echo $label; echo $label;
echo "<select $idclasname text='$value'>\n"; echo "<select $idclasname text='$value'>\n";
foreach ($autoform_config[$key] as $choice){ foreach ($autoform_config[$key] as $choice){
if ($choice==$value){$checked='selected';}else{$checked='';} if ($choice==$value){$checked='selected';}else{$checked='';}
echo "<option $checked value='$choice'>$choice</option>\n"; echo "<option $checked value='$choice'>$choice</option>\n";
@ -112,15 +112,15 @@ function render_form($var){
}else if (isset($autoform_config[$key]) && $autoform_config[$key]=='pass'){ }else if (isset($autoform_config[$key]) && $autoform_config[$key]=='pass'){
//oh, a password input ! //oh, a password input !
echo $label; echo $label;
echo "<input type='password' $idclasname value='$value' />\n"; echo "<input type='password' $idclasname value='$value' />\n";
}else{ }else{
// ok, so that's a text input... // ok, so that's a text input...
echo $label; echo $label;
if ($autoform_config['use_placeholder']){$placeholder=" placeholder='$txt'";}else{$placeholder='';} if ($autoform_config['use_placeholder']){$placeholder=" placeholder='$txt'";}else{$placeholder='';}
echo "<input type='text' $idclasname value='$value' $placeholder/>\n"; echo "<input type='text' $idclasname value='$value' $placeholder/>\n";
} }
} }
echo "</li>\n"; echo "</li>\n";
} }
@ -129,13 +129,16 @@ function render_form($var){
} }
include('auto_restrict.php'); include('auto_restrict.php');
include('config.php'); include('config.php');
if(file_exists('user_config.php')){
include('user_config.php');
}
unset($GLOBAL['private_data_folder']); unset($GLOBAL['private_data_folder']);
unset($GLOBAL['public_data_folder']); unset($GLOBAL['public_data_folder']);
$GLOBAL['default_data_folder']=basename($GLOBAL['default_data_folder']); $GLOBAL['default_data_folder']=basename($GLOBAL['default_data_folder']);
$message=''; $message='';
if ($_POST){ if ($_POST){
$auto_form['filename']='config.php'; $auto_form['filename']='user_config.php';
$auto_form['filecontent']="<?php \n /* The configuration generated with auto_form*/\n\n"; $auto_form['filecontent']="<?php \n /* The configuration generated with auto_form*/\n\n";
$auto_form['variable_name']='$GLOBAL'; $auto_form['variable_name']='$GLOBAL';
$all_keys=explode(' | ',$_POST['all_keys']); $all_keys=explode(' | ',$_POST['all_keys']);
@ -150,7 +153,7 @@ if ($_POST){
}else{// not bool }else{// not bool
$auto_form['filecontent'].=$auto_form['variable_name']."['$key']='".$postdata[$key]."';\n"; $auto_form['filecontent'].=$auto_form['variable_name']."['$key']='".$postdata[$key]."';\n";
} }
} }
$auto_form['filecontent'].="\n?>"; $auto_form['filecontent'].="\n?>";
@ -164,9 +167,9 @@ if ($_POST){
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8" /></head> <meta charset="utf-8" /></head>
<title>Configuration</title> <title>Configuration</title>
<link rel="stylesheet" type="text/css" href="design/<?php echo $GLOBAL['skin']; ?>/style.css"/> <link rel="stylesheet" type="text/css" href="design/<?php echo $GLOBAL['skin']; ?>/style.css"/>
<link rel="shortcut icon" type="/image/png" href="design/<?php echo $GLOBAL['skin']; ?>/favicon2.png"> <link rel="shortcut icon" type="/image/png" href="design/<?php echo $GLOBAL['skin']; ?>/favicon2.png">
<!--[if IE]><script> document.createElement("article");document.createElement("aside");document.createElement("section");document.createElement("footer");</script> <![endif]--> <!--[if IE]><script> document.createElement("article");document.createElement("aside");document.createElement("section");document.createElement("footer");</script> <![endif]-->
@ -178,7 +181,7 @@ if ($_POST){
</nav> </nav>
</header> </header>
<aside> <aside>
<?php <?php
render_form($GLOBAL); render_form($GLOBAL);
?> ?>
</aside> </aside>

View file

@ -3,18 +3,18 @@
/* (webpage retriever by Timo Van Neerden; http://lehollandaisvolant.net/contact December 2012) /* (webpage retriever by Timo Van Neerden; http://lehollandaisvolant.net/contact December 2012)
* last updated : December, 10th, 2012 * last updated : December, 10th, 2012
* *
* This piece of software is under the WTF Public Licence. * This piece of software is under the WTF Public Licence.
* Everyone is permitted to copy and distribute verbatim or modified * Everyone is permitted to copy and distribute verbatim or modified
* copies of this program, under the following terms of the WFTPL : * copies of this program, under the following terms of the WFTPL :
* *
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
* *
* 0. You just DO WHAT THE FUCK YOU WANT TO. * 0. You just DO WHAT THE FUCK YOU WANT TO.
* *
*/ */
/* all the enhancements (logo, css, session lock, bookmarklet, tags, rss feed, api) are from Bronco (www.warriordudimanche.net) /* all the enhancements (logo, css, session lock, bookmarklet, tags, rss feed, api) are from Bronco (www.warriordudimanche.net)
* and are based on the same licence ;) * and are based on the same licence ;)
* thanks a lot to Timo for his great job on this app ;) */ * thanks a lot to Timo for his great job on this app ;) */
@ -35,6 +35,9 @@ if (isset($_GET['tag'])){$search_tags=strip_tags($_GET['tag']);}else{$search_tag
// CONFIGURABLE OPTIONS // CONFIGURABLE OPTIONS
// adapter la configuration dans le fichier config.php // adapter la configuration dans le fichier config.php
include('config.php'); include('config.php');
if(file_exists('user_config.php')){
include('user_config.php');
}
$GLOBAL['version']='2.2'; $GLOBAL['version']='2.2';
$GLOBAL['respawn_url']=returncurrenturl(); $GLOBAL['respawn_url']=returncurrenturl();
@ -299,7 +302,7 @@ if (!$GLOBAL['public']){ // private
$matches_url = array_merge($matches_url2, $matches_url); $matches_url = array_merge($matches_url2, $matches_url);
// pour chaque URL/URI // pour chaque URL/URI
foreach ($matches_url as $j => $valuej) { foreach ($matches_url as $j => $valuej) {
@ -378,11 +381,11 @@ if (!$GLOBAL['public']){ // private
$info .= 'TITLE="'.$title.'"'."\n"; $info .= 'TITLE="'.$title.'"'."\n";
$info .= 'DATE="'.time().'"'."\n"; $info .= 'DATE="'.time().'"'."\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'].'/'; */
} }
}//die; }//die;
@ -394,7 +397,7 @@ if (!$GLOBAL['public']){ // private
$id=idfrompath($_GET['suppr']); $id=idfrompath($_GET['suppr']);
$status=statuspath($_GET['suppr']); $status=statuspath($_GET['suppr']);
if (isset($GLOBAL['tag_array'][$status][$id])){deltags($GLOBAL['tag_array'][$status][$id],$_GET['suppr'],$id,$status);} if (isset($GLOBAL['tag_array'][$status][$id])){deltags($GLOBAL['tag_array'][$status][$id],$_GET['suppr'],$id,$status);}
// suppr page // suppr page
$sousliste = scandir($_GET['suppr']); // listage des dossiers de data. $sousliste = scandir($_GET['suppr']); // listage des dossiers de data.
$nb_sousfichier = count($sousliste); $nb_sousfichier = count($sousliste);
@ -405,11 +408,11 @@ if (!$GLOBAL['public']){ // private
} }
// then the folder itself. // then the folder itself.
if (TRUE === rmdir($_GET['suppr'])) { if (TRUE === rmdir($_GET['suppr'])) {
$GLOBAL['done']['d'] = 'remove'; $GLOBAL['done']['d'] = 'remove';
} }
} }
header("location: index.php"); header("location: index.php");
} }
@ -444,7 +447,7 @@ if (!$GLOBAL['public']){ // private
if (isset($_GET['privateget'])&&is_dir($GLOBAL['private_data_folder'].'/'.$_GET['privateget'])){$target=$GLOBAL['private_data_folder'].'/'.$_GET['privateget'];} if (isset($_GET['privateget'])&&is_dir($GLOBAL['private_data_folder'].'/'.$_GET['privateget'])){$target=$GLOBAL['private_data_folder'].'/'.$_GET['privateget'];}
if (isset($_GET['zipprivate'])) { if (isset($_GET['zipprivate'])) {
$ini_file = $GLOBAL['private_data_folder'].'/'.$_GET['zipprivate'].'/index.ini'; $ini_file = $GLOBAL['private_data_folder'].'/'.$_GET['zipprivate'].'/index.ini';
if(is_file($ini_file)){$info=parse_ini_file($ini_file);}else{$info['TITLE']='';} if(is_file($ini_file)){$info=parse_ini_file($ini_file);}else{$info['TITLE']='';}
$origin_folder_path=$GLOBAL['private_data_folder'].'/'.$_GET['zipprivate']; $origin_folder_path=$GLOBAL['private_data_folder'].'/'.$_GET['zipprivate'];
@ -453,31 +456,31 @@ if (!$GLOBAL['public']){ // private
$zip_completepath=$GLOBAL['data_folder'].'/zipversions/'.$zip_filename; $zip_completepath=$GLOBAL['data_folder'].'/zipversions/'.$zip_filename;
if (is_file($zip_completepath)){header("location: $zip_completepath");exit();}// il existe déjà, on envoie 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 if (is_dir($origin_folder_path)){// sinon on crée le zip si le dossier existe
include 'zip.php'; 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 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,$GLOBAL['data_folder'].'/zipversions/'); zip($zip_filename,$zip_foldername,$GLOBAL['data_folder'].'/zipversions/');
rename ($zip_foldername,$origin_folder_path); // on le remet à sa place rename ($zip_foldername,$origin_folder_path); // on le remet à sa place
header('location: '.$GLOBAL['data_folder'].'/zipversions/'.$zip_filename); header('location: '.$GLOBAL['data_folder'].'/zipversions/'.$zip_filename);
} }
} }
if (isset($_GET['rename'])&&isset($_GET['to'])&&isset($_GET['file'])) { if (isset($_GET['rename'])&&isset($_GET['to'])&&isset($_GET['file'])) {
if (is_file($_GET['file'].'/index.ini')){ if (is_file($_GET['file'].'/index.ini')){
$ini=parse_ini_file($_GET['file'].'/index.ini'); $ini=parse_ini_file($_GET['file'].'/index.ini');
$old=strip_tags(urldecode($_GET['rename'])); $old=strip_tags(urldecode($_GET['rename']));
$new=strip_tags(urldecode($_GET['to'])); $new=strip_tags(urldecode($_GET['to']));
$newini='URL="'.$ini['URL'].'"'."\n".'TITLE="'.$new.'"'."\n".'DATE="'.$ini['DATE'].'"'; $newini='URL="'.$ini['URL'].'"'."\n".'TITLE="'.$new.'"'."\n".'DATE="'.$ini['DATE'].'"';
file_put_contents($_GET['file'].'/index.ini',$newini); file_put_contents($_GET['file'].'/index.ini',$newini);
} }
} }
if (isset($_GET['settag'])&&isset($_GET['file'])) { if (isset($_GET['settag'])&&isset($_GET['file'])) {
if (is_file($GLOBAL['data_folder'].'/tags.txt')){$GLOBAL['tag_array']=unstore($GLOBAL['data_folder'].'/tags.txt');}else{$GLOBAL['tag_array']=array();} if (is_file($GLOBAL['data_folder'].'/tags.txt')){$GLOBAL['tag_array']=unstore($GLOBAL['data_folder'].'/tags.txt');}else{$GLOBAL['tag_array']=array();}
if (isset($_GET['ispublic'])){$type='public';}else{$type='private';} if (isset($_GET['ispublic'])){$type='public';}else{$type='private';}
$GLOBAL['tag_array'][$type][$_GET['file']]=strip_tags($_GET['settag']); $GLOBAL['tag_array'][$type][$_GET['file']]=strip_tags($_GET['settag']);
store($GLOBAL['data_folder'].'/tags.txt',$GLOBAL['tag_array']); store($GLOBAL['data_folder'].'/tags.txt',$GLOBAL['tag_array']);
} }
}else{ // public get }else{ // public get
//download public zip version //download public zip version
if (isset($_GET['zippublic'])) { if (isset($_GET['zippublic'])) {
$ini_file = $GLOBAL['public_data_folder'].'/'.$_GET['zippublic'].'/index.ini'; $ini_file = $GLOBAL['public_data_folder'].'/'.$_GET['zippublic'].'/index.ini';
@ -488,9 +491,9 @@ if (!$GLOBAL['public']){ // private
$zip_completepath=$GLOBAL['data_folder'].'/zipversions/'.$zip_filename; $zip_completepath=$GLOBAL['data_folder'].'/zipversions/'.$zip_filename;
if (is_file($zip_completepath)){header("location: $zip_completepath");exit();}// il existe déjà, on envoie 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 if (is_dir($origin_folder_path)){// sinon on crée le zip si le dossier existe
include 'zip.php'; 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 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,$GLOBAL['data_folder'].'/zipversions/'); zip($zip_filename,$zip_foldername,$GLOBAL['data_folder'].'/zipversions/');
rename ($zip_foldername,$origin_folder_path); // on le remet à sa place rename ($zip_foldername,$origin_folder_path); // on le remet à sa place
header('location: '.$GLOBAL['data_folder'].'/zipversions/'.$zip_filename); header('location: '.$GLOBAL['data_folder'].'/zipversions/'.$zip_filename);
} }
@ -508,8 +511,8 @@ if (!$GLOBAL['public']){ // private
) )
); );
foreach ($items as $key=>$item){ foreach ($items as $key=>$item){
if ($item!='index.html'){ if ($item!='index.html'){
if (is_dir($GLOBAL['public_data_folder'].'/'.$item)){ if (is_dir($GLOBAL['public_data_folder'].'/'.$item)){
if (is_file($GLOBAL['public_data_folder'].'/'.$item.'/index.ini')){ if (is_file($GLOBAL['public_data_folder'].'/'.$item.'/index.ini')){
$infos=parse_ini_file($GLOBAL['public_data_folder'].'/'.$item.'/index.ini'); $infos=parse_ini_file($GLOBAL['public_data_folder'].'/'.$item.'/index.ini');
date_default_timezone_set('Europe/Paris'); date_default_timezone_set('Europe/Paris');
@ -531,10 +534,10 @@ if (!$GLOBAL['public']){ // private
} }
if (isset($_GET['api'])){ if (isset($_GET['api'])){
$content=array(); $content=array();
$items=search('public',$search_tags); $items=search('public',$search_tags);
foreach ($items as $key=>$item){ foreach ($items as $key=>$item){
if ($item!='index.html'){ if ($item!='index.html'){
if (is_dir($GLOBAL['public_data_folder'].'/'.$item)){ if (is_dir($GLOBAL['public_data_folder'].'/'.$item)){
if (is_file($GLOBAL['public_data_folder'].'/'.$item.'/index.ini')){ if (is_file($GLOBAL['public_data_folder'].'/'.$item.'/index.ini')){
$infos=parse_ini_file($GLOBAL['public_data_folder'].'/'.$item.'/index.ini'); $infos=parse_ini_file($GLOBAL['public_data_folder'].'/'.$item.'/index.ini');
date_default_timezone_set('Europe/Paris'); date_default_timezone_set('Europe/Paris');
@ -572,7 +575,7 @@ function url_parts() {
} }
// //
// Gets external file by URL. // Gets external file by URL.
// Make a stream context (better). // Make a stream context (better).
// //
@ -813,7 +816,7 @@ if ($GLOBAL['done']['d'] !== FALSE) {
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<?php <?php
if (!empty($_GET['publicget'])){ if (!empty($_GET['publicget'])){
$id=strip_tags($_GET['publicget']); $id=strip_tags($_GET['publicget']);
$temp=parse_ini_file($GLOBAL['public_data_folder'].'/'.$id.'/index.ini'); $temp=parse_ini_file($GLOBAL['public_data_folder'].'/'.$id.'/index.ini');
@ -825,16 +828,16 @@ if ($GLOBAL['done']['d'] !== FALSE) {
else{$page_title='Respawn';} else{$page_title='Respawn';}
?> ?>
<meta charset="utf-8" /></head> <meta charset="utf-8" /></head>
<title><?php echo $page_title; ?></title> <title><?php echo $page_title; ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBAL['css_folder']; ?>/style.css"/> <link rel="stylesheet" type="text/css" href="<?php echo $GLOBAL['css_folder']; ?>/style.css"/>
<?php link2favicon($target);?> <?php link2favicon($target);?>
<!--[if IE]><script> document.createElement("article");document.createElement("aside");document.createElement("section");document.createElement("footer");</script> <![endif]--> <!--[if IE]><script> document.createElement("article");document.createElement("aside");document.createElement("section");document.createElement("footer");</script> <![endif]-->
</head> </head>
<body <?php echo $bodyclass;?>> <body <?php echo $bodyclass;?>>
<header><a href="<?php echo $GLOBAL['respawn_url'].$publicarg; ?>"><img src="<?php echo $GLOBAL['css_folder']; ?>/logo2.png"/></a> <header><a href="<?php echo $GLOBAL['respawn_url'].$publicarg; ?>"><img src="<?php echo $GLOBAL['css_folder']; ?>/logo2.png"/></a>
<nav id="orpx_nav-bar"> <nav id="orpx_nav-bar">
<?php <?php
if (!$GLOBAL['public']){ if (!$GLOBAL['public']){
echo "\t".'<form method="get" action="'.$_SERVER['PHP_SELF'].'" >'."\n"; echo "\t".'<form method="get" action="'.$_SERVER['PHP_SELF'].'" >'."\n";
@ -846,7 +849,7 @@ if ($GLOBAL['done']['d'] !== FALSE) {
if (!empty($target)){echo $page_title.' <a class="zip" href="?zippublic='.strip_tags($_GET['publicget']).'" title="Get ZIP version"></a>';}else{echo $GLOBAL['message'];} if (!empty($target)){echo $page_title.' <a class="zip" href="?zippublic='.strip_tags($_GET['publicget']).'" title="Get ZIP version"></a>';}else{echo $GLOBAL['message'];}
echo '</p>'; echo '</p>';
} }
echo '<div class="tag_cloud">'; echo '<div class="tag_cloud">';
tagcloud(); tagcloud();
echo '</div>'; echo '</div>';
@ -925,8 +928,8 @@ if ($GLOBAL['done']['d'] !== FALSE) {
// PRIVATE PAGES ------------------------------------------------------------------------------------------ // PRIVATE PAGES ------------------------------------------------------------------------------------------
if (!$GLOBAL['public']){ if (!$GLOBAL['public']){
echo '<div class="private" style="'.$column_width.'">'."\n"; echo '<div class="private" style="'.$column_width.'">'."\n";
$liste_pages = search('private',$search_tags); $liste_pages = search('private',$search_tags);
if ( ($nb = count($liste_pages)) != 0 ) { if ( ($nb = count($liste_pages)) != 0 ) {
@ -951,17 +954,17 @@ if ($GLOBAL['done']['d'] !== FALSE) {
} }
$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]]);}
echo "\t".' echo "\t".'
<li> <li>
<a class="icon suppr" onclick="return window.confirm(\'Sure to remove?\')" href="?suppr='.$GLOBAL['private_data_folder'].'/'.$liste_pages[$i].'" title="suppr">X</a> <a class="icon suppr" onclick="return window.confirm(\'Sure to remove?\')" href="?suppr='.$GLOBAL['private_data_folder'].'/'.$liste_pages[$i].'" title="suppr">X</a>
<a class="title" href="?privateget='.$liste_pages[$i].'" title="'.$titre.'('.$date.')"><img src="'.$favicon.'"/>'.$titre.'</a> <a class="title" href="?privateget='.$liste_pages[$i].'" title="'.$titre.'('.$date.')"><img src="'.$favicon.'"/>'.$titre.'</a>
<p class="infos">'.$taglinks.'</p> <p class="infos">'.$taglinks.'</p>
<p class="tools"> <p class="tools">
<a class="icon rename" onclick="rename(\''.$GLOBAL['public_data_folder'].'/'.$liste_pages[$i].'\',\''.$titre.'\',this)" href="#" title="rename">R</a> <a class="icon rename" onclick="rename(\''.$GLOBAL['public_data_folder'].'/'.$liste_pages[$i].'\',\''.$titre.'\',this)" href="#" title="rename">R</a>
<a class="icon tagme" onclick="tag(\'\',\''.$liste_pages[$i].'\',\''.$tags.'\',this)" href="#" title="edit tags">T</a> <a class="icon tagme" onclick="tag(\'\',\''.$liste_pages[$i].'\',\''.$tags.'\',this)" href="#" title="edit tags">T</a>
<a class="icon zip" href="?zipprivate='.$liste_pages[$i].'" title="Download zip version">Z</a> <a class="icon zip" href="?zipprivate='.$liste_pages[$i].'" title="Download zip version">Z</a>
<a class="icon origine" href="'.$url.'" title="origin">&#10150;</a> <a class="icon origine" href="'.$url.'" title="origin">&#10150;</a>
<a href="?topublic='.$liste_pages[$i].'" class="topublic" title="Change to public">&#9664;</a> <a href="?topublic='.$liste_pages[$i].'" class="topublic" title="Change to public">&#9664;</a>
</p> </p>
</li>'."\n"; </li>'."\n";
@ -974,11 +977,11 @@ if ($GLOBAL['done']['d'] !== FALSE) {
} }
?> ?>
</aside> </aside>
<footer> <footer>
<a title='from TiMo' href='http://lehollandaisvolant.net/index.php?mode=links&id=20121211195941'>Respawn</a> (bronco edition v<?php echo $GLOBAL['version'];?>) - <a href='?public'>Public page link</a> - <a title='from TiMo' href='http://lehollandaisvolant.net/index.php?mode=links&id=20121211195941'>Respawn</a> (bronco edition v<?php echo $GLOBAL['version'];?>) - <a href='?public'>Public page link</a> -
<a href="?rss<?php if ($search_tags!='') {echo '&tag='.$search_tags; }?>"> RSS </a> - <a href="?rss<?php if ($search_tags!='') {echo '&tag='.$search_tags; }?>"> RSS </a> -
<?php if (!$GLOBAL['public']){echo $bookmarklet;} ?> - <?php if (!$GLOBAL['public']){echo $bookmarklet;} ?> -
<?php if (!$GLOBAL['public']){echo '<a href="config_page.php">Config</a>';} ?> - <?php if (!$GLOBAL['public']){echo '<a href="config_page.php">Config</a>';} ?> -
<?php if (!$GLOBAL['public']){echo '<a href="?discotime">Disconnect</a>';}else{echo '<a href="login_form.php">Admin</a>';}?> <?php if (!$GLOBAL['public']){echo '<a href="?discotime">Disconnect</a>';}else{echo '<a href="login_form.php">Admin</a>';}?>
</footer> </footer>
@ -987,14 +990,14 @@ if ($GLOBAL['done']['d'] !== FALSE) {
newname= prompt('Rename this page:',oldname); newname= prompt('Rename this page:',oldname);
if (newname && newname!=oldname){ if (newname && newname!=oldname){
obj.setAttribute('href',"<?php echo $GLOBAL['respawn_url']; ?>?rename="+encodeURIComponent(oldname)+"&to="+encodeURIComponent(newname)+"&file="+file); obj.setAttribute('href',"<?php echo $GLOBAL['respawn_url']; ?>?rename="+encodeURIComponent(oldname)+"&to="+encodeURIComponent(newname)+"&file="+file);
}else{} }else{}
} }
function tag(ispublic,file,oldtags,obj){ function tag(ispublic,file,oldtags,obj){
newtags= prompt('Tags for this page:',oldtags); newtags= prompt('Tags for this page:',oldtags);
if (newtags && newtags!=oldtags){ if (newtags && newtags!=oldtags){
obj.setAttribute('href',"<?php echo $GLOBAL['respawn_url']; ?>?settag="+encodeURIComponent(newtags)+"&file="+file+ispublic); obj.setAttribute('href',"<?php echo $GLOBAL['respawn_url']; ?>?settag="+encodeURIComponent(newtags)+"&file="+file+ispublic);
}else{} }else{}
} }
</script> </script>