Skip to content

Commit

Permalink
modified: 0.3/index.php
Browse files Browse the repository at this point in the history
- nettoyage de code
- urlToFolderWithTrailingSlash() pour corriger liens et iframes après ajout
- suppression code de contrôle "déjà existant" redondant avec functions
- un pti peu de CSS simplifié
- ajout lien sitemap
  • Loading branch information
Mitsukarenai committed Feb 23, 2013
1 parent 5d80708 commit c818b81
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions 0.3/index.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ function objectCmp($a, $b) {
$error = createAutoblog($sitetype, $sitename, $siteurl, $rssurl, $error);
if( empty($error)) {
$form .= '<p>'.$sitetype.'</p>';
$form .= '<iframe width="1" height="1" frameborder="0" src="'. urlToFolder($siteurl) .'/index.php"></iframe>';
$form .= '<p><span style="color:darkgreen">Autoblog <a href="'. urlToFolder($siteurl) .'">'. $sitename .'</a> ajouté avec succès.</span><br>';
$form .= '<iframe width="1" height="1" frameborder="0" src="'. urlToFolderWithTrailingSlash($siteurl) .'/index.php"></iframe>';
$form .= '<p><span style="color:darkgreen">Autoblog <a href="'. urlToFolderWithTrailingSlash($siteurl) .'">'. $sitename .'</a> ajouté avec succès.</span><br>';
}
else {
$form .= '<ul>';
Expand Down Expand Up @@ -323,7 +323,7 @@ function objectCmp($a, $b) {
if( empty($error) ) {
$error = createAutoblog($sitetype, ucfirst($socialinstance) .' - '. $socialaccount, $siteurl, $rssurl, $error);
if( empty($error))
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. urlToFolder( $siteurl ) .'/index.php"></iframe><b style="color:darkgreen">AutoMicroblog <a href="'.$foldername.'">ajouté avec succès</a>.</b>';
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. urlToFolderWithTrailingSlash( $siteurl ) .'/index.php"></iframe><b style="color:darkgreen">'.ucfirst($socialinstance) .' - '. $socialaccount.' <a href="'.urlToFolderWithTrailingSlash( $siteurl ).'">ajouté avec succès</a>.</b>';
}
}

Expand All @@ -348,29 +348,24 @@ function objectCmp($a, $b) {
$error = createAutoblog('generic', $sitename, $siteurl, $rssurl, $error);

if( empty($error))
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. urlToFolder( $siteurl ) .'/index.php"></iframe><b style="color:darkgreen">autoblog crée avec succès.</b> &rarr; <a target="_blank" href="'. urlToFolder( $siteurl ) .'">afficher l\'autoblog</a>';
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. urlToFolderWithTrailingSlash( $siteurl ) .'/index.php"></iframe><b style="color:darkgreen">autoblog crée avec succès.</b> &rarr; <a target="_blank" href="'. urlToFolderWithTrailingSlash( $siteurl ) .'">afficher l\'autoblog</a>';
}
else {
// checking procedure
$rssurl = DetectRedirect($rssurl);
$datafeed = file_get_contents($rssurl);
$sitetype = 'generic';
$siteurl = get_link_from_datafeed($datafeed);
$foldername = urlToFolder($siteurl);
$sitename = get_title_from_datafeed($datafeed);

if(file_exists($foldername)) {
$error[] = 'Erreur: l\'autoblog <a href="./'.$foldername.'/">existe déjà</a>.';
}
else {

$form = '<span style="color:blue">Merci de vérifier les informations suivantes, corrigez si nécessaire.</span><br>
<form method="POST"><input type="hidden" name="generic" value="1" />
<input style="color:black" type="text" id="sitename" value="'.$sitename.'" disabled><label for="sitename">&larr; titre du site (auto)</label><br>
<input placeholder="Adresse du site" type="text" name="siteurl" id="siteurl" value="'.$siteurl.'"><label for="siteurl">&larr; page d\'accueil (auto)</label><br>
<input placeholder="Adresse du flux RSS/ATOM" type="text" name="rssurl" id="rssurl" value="'.$rssurl.'"><label for="rssurl">&larr; adresse du flux</label><br>
<input placeholder=""Type de site" type="text" name="sitetype" id="sitetype" value="'.$sitetype.'" disabled><label for="sitetype">&larr; type de site</label><br>
<input placeholder="Antibot: \'dix sept\' en chiffre" type="text" name="number" id="number" value="17"><label for="number">&larr; antibot</label><br><input type="submit" value="Créer"></form>';
}

}
}
}
Expand All @@ -390,7 +385,7 @@ function objectCmp($a, $b) {

$error = createAutoblog( 'generic', $sitename, $siteurl, $rssurl, $error );
if( empty ( $error ))
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. urlToFolder( $siteurl ) .'/index.php"></iframe>Autoblog "'. $sitename .'" crée avec succès. &rarr; <a target="_blank" href="'. urlToFolder( $siteurl ) .'">afficher l\'autoblog</a>.';
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. urlToFolderWithTrailingSlash( $siteurl ) .'/index.php"></iframe>Autoblog "'. $sitename .'" crée avec succès. &rarr; <a target="_blank" href="'. urlToFolderWithTrailingSlash( $siteurl ) .'">afficher l\'autoblog</a>.';
}
}
}
Expand Down Expand Up @@ -419,7 +414,7 @@ function objectCmp($a, $b) {
input {width:30em;}
input[type="radio"] { width:1em; }
input[type="submit"] { width:8em; }
input[type="text"]#socialaccount, input[type="text"]#statusneturl, input[type="text"]#shaarliurl, input[type="text"]#socialsub {width:12em;}
input[type="text"]#socialaccount, input[type="text"]#statusneturl, input[type="text"]#shaarliurl {width:12em;}
div.form {padding:0.2em;border:1px solid #fff;}
div.form:hover {background-color:#FAF4DA;border:1px dotted; }
.vignette { width:20em;height:2em;float:left;margin:0; padding:20px;background-color:#eee;border: 1px solid #888;}
Expand Down Expand Up @@ -489,23 +484,23 @@ function objectCmp($a, $b) {
<h3>Ajouter un compte social</h3>

<form method="POST">
<input class="text" placeholder="Identifiant du compte" type="text" name="socialaccount" id="socialaccount"><br>
<input placeholder="Identifiant du compte" type="text" name="socialaccount" id="socialaccount"><br>
<input type="radio" name="socialinstance" value="twitter">Twitter<br>
<input type="radio" name="socialinstance" value="identica">Identica<br>
<input type="radio" name="socialinstance" value="statusnet">
<input placeholder="statusnet.personnel.com" type="text" name="statusneturl" id="statusneturl"><br>

<input id="socialsub" type="submit" value="Créer">
<input type="submit" value="Créer">
</form>
</div>

<div class="form">
<h3>Ajouter un Shaarli</h3>

<form method="POST">
<input class="text" placeholder="identifiant compte" type="hidden" name="socialaccount" id="socialaccount" value="shaarli">
<input type="hidden" name="socialaccount" value="shaarli">
<input type="hidden" name="socialinstance" value="shaarli"><input placeholder="shaarli.personnel.com" type="text" name="shaarliurl" id="shaarliurl"><br>
<input id="socialsub" type="submit" value="Créer">
<input type="submit" value="Créer">
</form>
</div>
<?php }
Expand Down

3 comments on commit c818b81

@ArthurHoaro
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On considère donc que urlToFolderWithTrailingSlash() est la norme pour toute nouvelle génération de dossiers ?

@mitsukarenai
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep :)

Oh tu me fais penser: risque de /index.php/ par exemple. ... euh... enlever tout ce qui se trouve après le dernier / dans l'URL avant de urlToFolderWithTrailingSlash ? Je sais pas 😧

@ArthurHoaro
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ca risque de générer plus de bugs qu'autres chose. A défaut d'une meilleure idée, j'exclu simplement index.php et index.html de la génération : 27830d9

EDIT : Bien vu ceci dit 👍

Please sign in to comment.