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

index.php 8.4KB

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. 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. $titrepage_stripslashes=stripslashes($data_page_menu["titre"]);
  115. echo"<a href='?id_page=".$data_page_menu["id_page"]."'>{$titrepage_stripslashes}</a><br><br>";
  116. }
  117. ?>
  118. </ul>
  119. </div>
  120. <div class="corps">
  121. <?php
  122. if(@!$_SESSION['session'])
  123. {
  124. $connected="0";
  125. }
  126. if(@$_SESSION['session'])
  127. {
  128. require_once(''.$MainDir.'user/verifications.php');
  129. $connected="1";
  130. $sql="SELECT user_rank FROM user WHERE id_user=$id_user";
  131. $req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
  132. $user_ranking = mysql_fetch_assoc($req);
  133. $user_rank="$user_ranking[user_rank]";
  134. if($user_rank==1){
  135. $admin_mode = "1";
  136. }
  137. }else{
  138. $admin_mode = "0";
  139. }
  140. ////Start check content
  141. if(isset($_GET['id_page']) || $static_homepage_status=="1" && $static_homepage_id!=NULL){
  142. if(isset($_GET['id_page'])){
  143. $sql_page="SELECT * FROM page WHERE id_page=".$_GET['id_page']."";
  144. }elseif($static_homepage_status=="1"){
  145. $sql_page="SELECT * FROM page WHERE id_page=".$static_homepage_id."";
  146. }
  147. $req_page = mysql_query($sql_page) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
  148. $data_page=mysql_fetch_assoc($req_page);
  149. if($data_page["id_page"]== null && $static_homepage_status!="1"){
  150. echo"<h1>QUATRE CENT QUATRE</h1><br>Non mais, cette page existe pas j'ai l'impression cher camarade !<br><br>";
  151. }elseif($data_page["id_page"]== null && $static_homepage_status=="1"){
  152. echo"La page que vous aviez défini en page d'accueil n'existe plus.<br><br>";
  153. }else{
  154. $page_name= stripslashes($data_page["titre"]);?>
  155. <title><?php echo $website_name.' : '.$page_name; ?></title>
  156. <?php
  157. $titrepage_stripslash = stripslashes($data_page['titre']);
  158. $page_stripslash = stripslashes($data_page['page']);
  159. echo"<h2>{$titrepage_stripslash}</h2>";
  160. echo"<b>".$page_date_display." :</b> {$data_page["date"]} par : {$data_page['user']}<br />";
  161. echo"<b>".$page_page_display." :</b><br />{$page_stripslash}<br><br>";
  162. if($connected==1){
  163. if(isset($admin_mode) && $admin_mode==1){
  164. echo"<br><br><b><a href='administration/edition_page.php?id={$data_page["id_page"]}'>Editer</a></b>";
  165. echo" - <b><a href='files/page_suppression.php?id={$data_page["id_page"]}'>Supprimer</a></b><br><br>";
  166. if($static_homepage_status=="1" && $static_homepage_id != $data_page["id_page"] && $data_page["id_page"]!= null){
  167. 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>";
  168. }
  169. }
  170. }
  171. }
  172. }elseif(isset($_GET['id'])){
  173. $sql_article="SELECT * FROM article WHERE id_article=".$_GET['id']."";
  174. $req_article = mysql_query($sql_article) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
  175. $data_article=mysql_fetch_assoc($req_article);
  176. if($data_article["id_article"]== null){
  177. echo"<h1>QUATRE CENT QUATRE</h1><br>Non mais, cet article n'existe pas j'ai l'impression cher camarade !<br><br>";
  178. }else{
  179. $page_name= $data_article["titre"];?>
  180. <title><?php echo $website_name.' : '.$page_name; ?></title>
  181. <?php
  182. $article_stripslash = stripslashes($data_article['article']);
  183. echo"<h2>{$data_article["titre"]}</h2>";
  184. echo"<b>".$article_date_display." :</b> {$data_article["date"]} par : {$data_article['user']}<br />";
  185. echo"<b>".$article_article_display." :</b><br />{$article_stripslash}<br><br>";
  186. if($connected==1){
  187. if($admin_mode==1){
  188. echo"<br><br><b><a href='administration/edition_article.php?id={$data_article["id_article"]}'>Editer</a></b>";
  189. echo" - <b><a href='files/article_suppression.php?id={$data_article["id_article"]}'>Supprimer</a></b><br /><br>";
  190. }
  191. }
  192. }
  193. }else{
  194. ?>
  195. <?php
  196. if(empty($_GET['p'])) {
  197. $page='0,7'; }
  198. else if (!empty($_GET['p'])){
  199. $pg=$_GET['p'];
  200. $fin=$pg*7;
  201. $debut=$fin-7;
  202. $page=$debut.', 7';
  203. }
  204. $sql="SELECT * FROM article ORDER BY id_article DESC LIMIT ".$page."";
  205. $req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
  206. while($data=mysql_fetch_assoc($req))
  207. {
  208. $article_stripslash = stripslashes($data['article']);
  209. echo"<br><br><b>".$article_title_display." :</b> <a href='?id=".$data["id_article"]."'>{$data["titre"]}</a><br />";
  210. echo"<b>".$article_date_display." :</b> {$data["date"]}<br />";
  211. echo"<b>".$article_article_display." :</b><br />{$article_stripslash}";
  212. if($connected==1){
  213. if(isset($admin_mode) && $admin_mode==1){
  214. echo"<br><br><b><a href='administration/edition_article.php?id={$data["id_article"]}'>Editer</a></b>";
  215. echo" - <b><a href='files/article_suppression.php?id={$data["id_article"]}'>Supprimer</a></b><br />";
  216. }
  217. }
  218. }
  219. ?>
  220. <br><br>Page <?php
  221. $sqlm='SELECT COUNT(*) AS nb_id FROM article';
  222. $reqm = mysql_query($sqlm) or die('Erreur SQL !<br />'.$sqlm.'<br />'.mysql_error());
  223. $donnee = mysql_fetch_array($reqm);
  224. $nb_pg=((int)($donnee['nb_id']/7))+1;
  225. $nb_pg_r=0;
  226. while($nb_pg_r!=$nb_pg AND $nb_pg_r<10){
  227. if(empty($_GET['p'])){
  228. $_GET['p'] = "1";
  229. }
  230. $nb_pg_r=$nb_pg_r+1;
  231. ?>
  232. <a class="page" href="?p=<?php echo $nb_pg_r; ?>">
  233. <?php
  234. if($_GET['p']==$nb_pg_r){
  235. echo '<strong>'.$nb_pg_r.'</strong>';
  236. }else{
  237. echo $nb_pg_r;
  238. }
  239. ?>
  240. </a> &nbsp;
  241. <?php
  242. }
  243. mysql_close();
  244. ?>
  245. <br>
  246. <br>
  247. <?php
  248. }
  249. ////End check content
  250. ?>
  251. <title><?php echo $website_name.' : '.$page_name; ?></title>
  252. </div>
  253. </body>
  254. <div id="footer">
  255. <?php
  256. echo "(Copyleft) ".$site_name." | Ce site utilise le CMS <a href='http://www.blogartisanal.tk/'>Blog Artisanal</a>.";
  257. }
  258. ?></div>
  259. </html>