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

index.php 8.2KB

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