393 lines
8.5 KiB
PHP
393 lines
8.5 KiB
PHP
<?php
|
|
|
|
$index_check="1";
|
|
require_once ('user/config.php');
|
|
|
|
|
|
if(isset($root_path)){
|
|
$page_name=$meta_description;
|
|
include_once("user/top.php");
|
|
include("files/navheader.php");
|
|
}
|
|
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
if(isset($_GET['error']))
|
|
{
|
|
echo'<span class="error">';
|
|
$error=$_GET['error'];
|
|
if($error=="username")
|
|
{
|
|
echo'Error : Your username is invalid';
|
|
}
|
|
if($error=="pass")
|
|
{
|
|
echo'error : Your password is invalid';
|
|
}
|
|
if($error=="connection")
|
|
{
|
|
echo"error : Your password don't match with your username";
|
|
}
|
|
echo'</span>';
|
|
}
|
|
|
|
|
|
if(isset($root_path))
|
|
{
|
|
|
|
$nombre_utilisateur=$dbh->query("SELECT * FROM user") or die ('error : '.mysql_error());
|
|
$count_user=$nombre_utilisateur->rowCount();
|
|
}
|
|
if(isset($count_user) && $count_user == 0){
|
|
|
|
|
|
echo("<br><br>Ce site n'a pas encore été paramétré, vous êtes priés de procéder à l'inscription, en cliquant <a href ='".$root_path."/user/register.php'><span style='text-decoration: underline;'>ICI</span></a>");
|
|
|
|
|
|
} elseif(!isset($root_path)) {
|
|
echo "<br><br>Attention ! Vous n'avez pas encore modifié le fichier config.php ! Ceci est nécessaire au fonctionnement du CMS Blog Artisanal. <br><br> Vérifiez aussi que vous avez bien retiré les deux // devant la ligne";?> $root_path='/';<?php echo"<br><br>N'oubliez pas de lire le fichier install.txt situé dans le dossier /install !";
|
|
} else {
|
|
?>
|
|
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
html
|
|
{
|
|
height:100%;
|
|
width:100%;
|
|
}
|
|
#header
|
|
{
|
|
width:100%;
|
|
height:20%;
|
|
font-size:50px;
|
|
text-align:center;
|
|
border-style:solid;
|
|
border-color:black;
|
|
border-size:1px;
|
|
}
|
|
.corps
|
|
{
|
|
width:80%;
|
|
height:5%;
|
|
border-bottom-style:solid;
|
|
border-bottom-color:black;
|
|
border-bottom-size:1px;
|
|
//float:left;
|
|
z-index:2;
|
|
}
|
|
#widget
|
|
{
|
|
margin-left:80%;
|
|
width:15%;
|
|
z-index:1;
|
|
position:absolute;
|
|
border-left-style:solid;
|
|
border-left-color:black;
|
|
border-left-size:2px;
|
|
}
|
|
a
|
|
{
|
|
color:black;
|
|
text-decoration:none;
|
|
}
|
|
a:hover
|
|
{
|
|
color:black;
|
|
text-decoration:underline;
|
|
}
|
|
#contact
|
|
{
|
|
color:white;
|
|
text-decoration:none;
|
|
}
|
|
#contact:hover
|
|
{
|
|
color:white;
|
|
text-decoration:underline;
|
|
}
|
|
</style>
|
|
|
|
|
|
<div id="header"><p style="margin-top:3%;"><?php echo $site_name; ?></p></div>
|
|
<div style="width:100%; color:white;">
|
|
<p style="height:5%; background-color:black;">
|
|
|
|
<marquee onmouseout="this.start();" onmouseover="this.stop();" loop="infinite" scrolldelay="100" scrollamount="5" direction="left">
|
|
|
|
|
|
|
|
<?php echo $bandeau ?>
|
|
|
|
|
|
</marquee>
|
|
</p>
|
|
</div>
|
|
<div id="widget">
|
|
<b> Pages :</b>
|
|
<ul>
|
|
<?php
|
|
|
|
|
|
|
|
$sql_page_menu="SELECT * FROM page ORDER BY priority";
|
|
$req = $dbh->query($sql_page_menu) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
|
|
|
|
|
|
while($data_page_menu=$req->fetch(PDO::FETCH_ASSOC))
|
|
{
|
|
|
|
|
|
$titrepage_stripslashes=stripslashes($data_page_menu["titre"]);
|
|
echo"<a href='?id_page=".$data_page_menu["id_page"]."'>{$titrepage_stripslashes}</a><br><br>";
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="corps">
|
|
|
|
<?php
|
|
|
|
if(@!$_SESSION['session'])
|
|
{
|
|
|
|
$connected="0";
|
|
}
|
|
if(@$_SESSION['session'])
|
|
{
|
|
require_once(''.$MainDir.'user/verifications.php');
|
|
$connected="1";
|
|
|
|
|
|
|
|
$sql="SELECT user_rank FROM user WHERE id_user=$id_user";
|
|
$req = $dbh->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
|
|
$user_ranking = $req->fetch(PDO::FETCH_ASSOC);
|
|
$user_rank="$user_ranking[user_rank]";
|
|
if($user_rank==1){
|
|
|
|
$admin_mode = "1";
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$admin_mode = "0";
|
|
}
|
|
|
|
|
|
|
|
|
|
////Start check content
|
|
|
|
if(isset($_GET['id_page']) || $static_homepage_status=="1" && $static_homepage_id!=NULL && !isset($_GET['id'])){
|
|
|
|
if(isset($_GET['id_page'])){
|
|
|
|
$sql_page="SELECT * FROM page WHERE id_page=".$_GET['id_page']."";
|
|
|
|
}elseif($static_homepage_status=="1"){
|
|
|
|
$sql_page="SELECT * FROM page WHERE id_page=".$static_homepage_id."";
|
|
|
|
}
|
|
$req_page = $dbh->query($sql_page) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
|
|
$data_page=$req_page->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if($data_page["id_page"]== null && $static_homepage_status!="1"){
|
|
|
|
echo"<h1>QUATRE CENT QUATRE</h1><br>Non mais, cette page existe pas j'ai l'impression cher camarade !<br><br>";
|
|
|
|
|
|
}elseif($data_page["id_page"]== null && $static_homepage_status=="1"){
|
|
|
|
echo"La page que vous aviez défini en page d'accueil n'existe plus.<br><br>";
|
|
|
|
}else{
|
|
$page_name= stripslashes($data_page["titre"]);?>
|
|
<title><?php echo $website_name.' : '.$page_name; ?></title>
|
|
<?php
|
|
$titrepage_stripslash = stripslashes($data_page['titre']);
|
|
$page_stripslash = stripslashes($data_page['page']);
|
|
echo"<h2>{$titrepage_stripslash}</h2>";
|
|
echo"<b>".$page_date_display." :</b> {$data_page["date"]} par : {$data_page['user']}<br />";
|
|
echo"<b>".$page_page_display." :</b><br />{$page_stripslash}<br><br>";
|
|
|
|
|
|
if($connected==1){
|
|
|
|
if(isset($admin_mode) && $admin_mode==1){
|
|
echo"<br><br><b><a href='administration/edition_page.php?id={$data_page["id_page"]}'>Editer</a></b>";
|
|
|
|
echo" - <b><a href='files/page_suppression.php?id={$data_page["id_page"]}'>Supprimer</a></b><br><br>";
|
|
if($static_homepage_status=="1" && $static_homepage_id != $data_page["id_page"] && $data_page["id_page"]!= null){
|
|
|
|
echo "<div style='text-align:right'><a href='files/submit_blog_config.php?static_homepage_id={$_GET['id_page']}'>Définir la page {$data_page['titre']} comme page d'accueil !</a></div><br>";
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}elseif(isset($_GET['id'])){
|
|
|
|
$sql_article="SELECT * FROM article WHERE id_article=".$_GET['id']."";
|
|
$req_article = $dbh->query($sql_article) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
|
|
$data_article=$req_article->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if($data_article["id_article"]== null){
|
|
|
|
echo"<h1>QUATRE CENT QUATRE</h1><br>Non mais, cet article n'existe pas j'ai l'impression cher camarade !<br><br>";
|
|
|
|
|
|
}else{
|
|
$article_stripslashtitle = stripslashes($data_article['titre']);
|
|
$page_name= $data_article["titre"];?>
|
|
<title><?php echo $website_name.' : '.$page_name; ?></title>
|
|
<?php
|
|
$article_stripslash = stripslashes($data_article['article']);
|
|
echo"<h2>{$article_stripslashtitle}</h2>";
|
|
echo"<b>".$article_date_display." :</b> {$data_article["date"]} par : {$data_article['user']}<br />";
|
|
echo"<b>".$article_article_display." :</b><br />{$article_stripslash}<br><br>";
|
|
|
|
if($connected==1){
|
|
|
|
if($admin_mode==1){
|
|
echo"<br><br><b><a href='administration/edition_article.php?id={$data_article["id_article"]}'>Editer</a></b>";
|
|
|
|
echo" - <b><a href='files/article_suppression.php?id={$data_article["id_article"]}'>Supprimer</a></b><br /><br>";
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
?>
|
|
<?php
|
|
|
|
|
|
|
|
if(empty($_GET['p'])) {
|
|
$page='0,7'; }
|
|
else if (!empty($_GET['p'])){
|
|
$pg=$_GET['p'];
|
|
$fin=$pg*7;
|
|
$debut=$fin-7;
|
|
$page=$debut.', 7';
|
|
}
|
|
|
|
|
|
|
|
$sql_article="SELECT * FROM article ORDER BY id_article DESC LIMIT ".$page."";
|
|
$req_article = $dbh->query($sql_article) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
|
|
while($data=$req_article->fetch(PDO::FETCH_ASSOC))
|
|
{
|
|
|
|
$article_stripslash = stripslashes($data['article']);
|
|
|
|
echo"<br><br><b>".$article_title_display." :</b> <a href='?id=".$data["id_article"]."'>{$data["titre"]}</a><br />";
|
|
echo"<b>".$article_date_display." :</b> {$data["date"]}<br />";
|
|
echo"<b>".$article_article_display." :</b><br />{$article_stripslash}";
|
|
|
|
if($connected==1){
|
|
|
|
if(isset($admin_mode) && $admin_mode==1){
|
|
echo"<br><br><b><a href='administration/edition_article.php?id={$data["id_article"]}'>Editer</a></b>";
|
|
|
|
echo" - <b><a href='files/article_suppression.php?id={$data["id_article"]}'>Supprimer</a></b><br />";
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
<br><br>Page <?php
|
|
|
|
|
|
|
|
$sqlm='SELECT COUNT(*) AS nb_id FROM article';
|
|
$reqm = $dbh->query($sqlm) or die('Erreur SQL !<br />'.$sqlm.'<br />'.mysql_error());
|
|
$donnee = $reqm->fetch(PDO::FETCH_BOTH);
|
|
$nb_pg=((int)($donnee['nb_id']/7))+1;
|
|
$nb_pg_r=0;
|
|
while($nb_pg_r!=$nb_pg AND $nb_pg_r<10){
|
|
if(empty($_GET['p'])){
|
|
$_GET['p'] = "1";
|
|
}
|
|
$nb_pg_r=$nb_pg_r+1;
|
|
?>
|
|
<a class="page" href="?p=<?php echo $nb_pg_r; ?>">
|
|
<?php
|
|
if($_GET['p']==$nb_pg_r){
|
|
echo '<strong>'.$nb_pg_r.'</strong>';
|
|
}else{
|
|
echo $nb_pg_r;
|
|
}
|
|
?>
|
|
|
|
</a>
|
|
|
|
<?php
|
|
}
|
|
|
|
$dbh= null;
|
|
?>
|
|
<br>
|
|
<br>
|
|
<?php
|
|
}
|
|
////End check content
|
|
|
|
?>
|
|
<title><?php echo $website_name.' : '.$page_name; ?></title>
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
<div id="footer">
|
|
<?php
|
|
echo "(Copyleft) ".$site_name." | Ce site utilise le CMS <a href='http://www.blogartisanal.tk/'>Blog Artisanal</a>.";
|
|
}
|
|
|
|
?></div>
|
|
</html>
|
|
|