CMS ultra léger au style oldschool, projet de la communauté Kalaïn Hundin.

index.php 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <?php
  2. $index_check="1";
  3. require_once ('user/config.php');
  4. if(isset($root_path)){
  5. $page_name=$meta_description;
  6. include_once("user/top.php");
  7. include("files/navheader.php");
  8. }
  9. session_start();
  10. if(isset($_GET['error']))
  11. {
  12. echo'<span class="error">';
  13. $error=$_GET['error'];
  14. if($error=="username")
  15. {
  16. echo'Error : Your username is invalid';
  17. }
  18. if($error=="pass")
  19. {
  20. echo'error : Your password is invalid';
  21. }
  22. if($error=="connection")
  23. {
  24. echo"error : Your password don't match with your username";
  25. }
  26. echo'</span>';
  27. }
  28. if(isset($root_path))
  29. {
  30. $nombre_utilisateur=$dbh->query("SELECT * FROM user") or die ('error : '.mysql_error());
  31. $count_user=$nombre_utilisateur->rowCount();
  32. }
  33. if(isset($count_user) && $count_user == 0){
  34. 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>");
  35. } elseif(!isset($root_path)) {
  36. 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 !";
  37. } else {
  38. ?>
  39. <style type="text/css">
  40. html
  41. {
  42. height:100%;
  43. width:100%;
  44. }
  45. #header
  46. {
  47. width:100%;
  48. height:20%;
  49. font-size:50px;
  50. text-align:center;
  51. border-style:solid;
  52. border-color:black;
  53. border-size:1px;
  54. }
  55. .corps
  56. {
  57. width:80%;
  58. height:5%;
  59. border-bottom-style:solid;
  60. border-bottom-color:black;
  61. border-bottom-size:1px;
  62. //float:left;
  63. z-index:2;
  64. }
  65. #widget
  66. {
  67. margin-left:80%;
  68. width:15%;
  69. z-index:1;
  70. position:absolute;
  71. border-left-style:solid;
  72. border-left-color:black;
  73. border-left-size:2px;
  74. }
  75. a
  76. {
  77. color:black;
  78. text-decoration:none;
  79. }
  80. a:hover
  81. {
  82. color:black;
  83. text-decoration:underline;
  84. }
  85. #contact
  86. {
  87. color:white;
  88. text-decoration:none;
  89. }
  90. #contact:hover
  91. {
  92. color:white;
  93. text-decoration:underline;
  94. }
  95. </style>
  96. <div id="header"><p style="margin-top:3%;"><?php echo $site_name; ?></p></div>
  97. <div style="width:100%; color:white;">
  98. <p style="height:5%; background-color:black;">
  99. <marquee onmouseout="this.start();" onmouseover="this.stop();" loop="infinite" scrolldelay="100" scrollamount="5" direction="left">
  100. <?php echo $bandeau ?>
  101. </marquee>
  102. </p>
  103. </div>
  104. <div id="widget">
  105. <b>&nbsp;Pages :</b>
  106. <ul>
  107. <?php
  108. $sql_page_menu="SELECT * FROM page ORDER BY priority";
  109. $req = $dbh->query($sql_page_menu) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
  110. while($data_page_menu=$req->fetch(PDO::FETCH_ASSOC))
  111. {
  112. $titrepage_stripslashes=stripslashes($data_page_menu["titre"]);
  113. echo"<a href='?id_page=".$data_page_menu["id_page"]."'>{$titrepage_stripslashes}</a><br><br>";
  114. }
  115. ?>
  116. </ul>
  117. </div>
  118. <div class="corps">
  119. <?php
  120. if(@!$_SESSION['session'])
  121. {
  122. $connected="0";
  123. }
  124. if(@$_SESSION['session'])
  125. {
  126. require_once(''.$MainDir.'user/verifications.php');
  127. $connected="1";
  128. $sql="SELECT user_rank FROM user WHERE id_user=$id_user";
  129. $req = $dbh->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
  130. $user_ranking = $req->fetch(PDO::FETCH_ASSOC);
  131. $user_rank="$user_ranking[user_rank]";
  132. if($user_rank==1){
  133. $admin_mode = "1";
  134. }
  135. }else{
  136. $admin_mode = "0";
  137. }
  138. ////Start check content
  139. if(isset($_GET['id_page']) || $static_homepage_status=="1" && $static_homepage_id!=NULL && !isset($_GET['id'])){
  140. if(isset($_GET['id_page'])){
  141. $sql_page="SELECT * FROM page WHERE id_page=".$_GET['id_page']."";
  142. }elseif($static_homepage_status=="1"){
  143. $sql_page="SELECT * FROM page WHERE id_page=".$static_homepage_id."";
  144. }
  145. $req_page = $dbh->query($sql_page) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
  146. $data_page=$req_page->fetch(PDO::FETCH_ASSOC);
  147. if($data_page["id_page"]== null && $static_homepage_status!="1"){
  148. echo"<h1>QUATRE CENT QUATRE</h1><br>Non mais, cette page existe pas j'ai l'impression cher camarade !<br><br>";
  149. }elseif($data_page["id_page"]== null && $static_homepage_status=="1"){
  150. echo"La page que vous aviez défini en page d'accueil n'existe plus.<br><br>";
  151. }else{
  152. $page_name= stripslashes($data_page["titre"]);?>
  153. <title><?php echo $website_name.' : '.$page_name; ?></title>
  154. <?php
  155. $titrepage_stripslash = stripslashes($data_page['titre']);
  156. $page_stripslash = stripslashes($data_page['page']);
  157. echo"<h2>{$titrepage_stripslash}</h2>";
  158. echo"<b>".$page_date_display." :</b> {$data_page["date"]} par : {$data_page['user']}<br />";
  159. echo"<b>".$page_page_display." :</b><br />{$page_stripslash}<br><br>";
  160. if($connected==1){
  161. if(isset($admin_mode) && $admin_mode==1){
  162. echo"<br><br><b><a href='administration/edition_page.php?id={$data_page["id_page"]}'>Editer</a></b>";
  163. echo" - <b><a href='files/page_suppression.php?id={$data_page["id_page"]}'>Supprimer</a></b><br><br>";
  164. if($static_homepage_status=="1" && $static_homepage_id != $data_page["id_page"] && $data_page["id_page"]!= null){
  165. 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>";
  166. }
  167. }
  168. }
  169. }
  170. }elseif(isset($_GET['id'])){
  171. $sql_article="SELECT * FROM article WHERE id_article=".$_GET['id']."";
  172. $req_article = $dbh->query($sql_article) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
  173. $data_article=$req_article->fetch(PDO::FETCH_ASSOC);
  174. if($data_article["id_article"]== null){
  175. echo"<h1>QUATRE CENT QUATRE</h1><br>Non mais, cet article n'existe pas j'ai l'impression cher camarade !<br><br>";
  176. }else{
  177. $article_stripslashtitle = stripslashes($data_article['titre']);
  178. $page_name= $data_article["titre"];?>
  179. <title><?php echo $website_name.' : '.$page_name; ?></title>
  180. <?php
  181. $article_stripslash = stripslashes($data_article['article']);
  182. echo"<h2>{$article_stripslashtitle}</h2>";
  183. echo"<b>".$article_date_display." :</b> {$data_article["date"]} par : {$data_article['user']}<br />";
  184. echo"<b>".$article_article_display." :</b><br />{$article_stripslash}<br><br>";
  185. if($connected==1){
  186. if($admin_mode==1){
  187. echo"<br><br><b><a href='administration/edition_article.php?id={$data_article["id_article"]}'>Editer</a></b>";
  188. echo" - <b><a href='files/article_suppression.php?id={$data_article["id_article"]}'>Supprimer</a></b><br /><br>";
  189. }
  190. }
  191. }
  192. }else{
  193. ?>
  194. <?php
  195. if(empty($_GET['p'])) {
  196. $page='0,7'; }
  197. else if (!empty($_GET['p'])){
  198. $pg=$_GET['p'];
  199. $fin=$pg*7;
  200. $debut=$fin-7;
  201. $page=$debut.', 7';
  202. }
  203. $sql_article="SELECT * FROM article ORDER BY id_article DESC LIMIT ".$page."";
  204. $req_article = $dbh->query($sql_article) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
  205. while($data=$req_article->fetch(PDO::FETCH_ASSOC))
  206. {
  207. $article_stripslash = stripslashes($data['article']);
  208. echo"<br><br><b>".$article_title_display." :</b> <a href='?id=".$data["id_article"]."'>{$data["titre"]}</a><br />";
  209. echo"<b>".$article_date_display." :</b> {$data["date"]}<br />";
  210. echo"<b>".$article_article_display." :</b><br />{$article_stripslash}";
  211. if($connected==1){
  212. if(isset($admin_mode) && $admin_mode==1){
  213. echo"<br><br><b><a href='administration/edition_article.php?id={$data["id_article"]}'>Editer</a></b>";
  214. echo" - <b><a href='files/article_suppression.php?id={$data["id_article"]}'>Supprimer</a></b><br />";
  215. }
  216. }
  217. }
  218. ?>
  219. <br><br>Page <?php
  220. $sqlm='SELECT COUNT(*) AS nb_id FROM article';
  221. $reqm = $dbh->query($sqlm) or die('Erreur SQL !<br />'.$sqlm.'<br />'.mysql_error());
  222. $donnee = $reqm->fetch(PDO::FETCH_BOTH);
  223. $nb_pg=((int)($donnee['nb_id']/7))+1;
  224. $nb_pg_r=0;
  225. while($nb_pg_r!=$nb_pg AND $nb_pg_r<10){
  226. if(empty($_GET['p'])){
  227. $_GET['p'] = "1";
  228. }
  229. $nb_pg_r=$nb_pg_r+1;
  230. ?>
  231. <a class="page" href="?p=<?php echo $nb_pg_r; ?>">
  232. <?php
  233. if($_GET['p']==$nb_pg_r){
  234. echo '<strong>'.$nb_pg_r.'</strong>';
  235. }else{
  236. echo $nb_pg_r;
  237. }
  238. ?>
  239. </a> &nbsp;
  240. <?php
  241. }
  242. $dbh= null;
  243. ?>
  244. <br>
  245. <br>
  246. <?php
  247. }
  248. ////End check content
  249. ?>
  250. <title><?php echo $website_name.' : '.$page_name; ?></title>
  251. </div>
  252. </body>
  253. <div id="footer">
  254. <?php
  255. echo "(Copyleft) ".$site_name." | Ce site utilise le CMS <a href='http://www.blogartisanal.tk/'>Blog Artisanal</a>.";
  256. }
  257. ?></div>
  258. </html>