/*****************************************************************************/ /* Aztek Forum - PHP/Mysql forum */ /* Copyright (C) 2003, 2004 Le Guilcher Yannick */ /* */ /* This file is part of Aztek Forum. */ /* */ /* Aztek Forum is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /* Aztek Forum is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with Aztek Forum; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* */ /* Contact: webmaster@forum-aztek.com */ /* Website: http://www.forum-aztek.com */ /*****************************************************************************/ /********************************************/ /* Gestion de sécurité des variables entrantes */ /********************************************/ include("./common/safety.php"); /***************************************/ /* Initialise les données et fonctions */ /***************************************/ include("./forum/init.php"); /**************************/ /* Traitement des actions */ /**************************/ switch($action){ // Change le mode d'affichage du forum case "switch": switch_button(); break; // Affiche la prévisualisation case "prev": include("./index/prev.php"); exit; break; // Mot de passe oublié case "new_passwd": $message=random_passwd($login); break; // Changement de mot de passe case "passwd": $message=modify_passwd($new_passwd_1,$new_passwd_2,$old_passwd); break; // Suppression d'un post case "delete": $message=delete_post($id_suppr); break; // Enregistrement d'un nouveau post case "send": if(!isset($passwd)) $passwd=""; if(!isset($alert)) $alert=0; if(!isset($smiley)) $smiley=0; if(!isset($question)) $question=""; if(!isset($choices)) $choices=""; if(!isset($nodelay)) $nodelay=0; $message=send($login,$passwd,$alert,$smiley,$title,$comment,$question,$choices,$day,$hour,$text,$answer,$nodelay); break; // Connexion d'un utilisateur case "login": if(!isset($cookie)) $cookie=0; if(!isset($passwd)) $passwd=""; $message=login($login,$passwd,$cookie); break; // L'utilisateur se déconnecte case "disconnect": $message=disconnect(); break; // Traitement des inscriptions case "subscribe": if(!isset($show_email)) $show_email=0; if(!isset($cookie)) $cookie=0; $message=subscribe($passwd,$passwd2,$login,$email,$show_email,$cookie); break; // Modifie le profil case "profile": if(!isset($show_email)) $show_email=0; if(!isset($alert_mp)) $alert_mp=0; if(!isset($other)) $other=""; if(!isset($fast_view)) $fast_view=0; if(!isset($smiley)) $smiley=0; $message=profile($email,$show_email,$alert_mp,$avatar,$town, $text,$url,$smiley,$msn,$aim,$skype,$yahoo,$icq,$other,$fast_view); break; // Log sur les forums privés case "private": $message=acces($passwd); break; // Envoie un message sur une messagerie case "inbox_send": $message=inbox_send($recipient,$title,$text); break; // Vide les message supprimé de la corbeille case "inbox_purge": $message=inbox_purge(); break; // Vide les message supprimé de la corbeille case "inbox_del": inbox_del($select); break; // Enregistre les modifications d'une édition case "modify": if(empty($smiley)) $smiley=0; if(empty($comment)) $comment=""; if(!isset($nodelay)) $nodelay=0; $message=modify($post, $title, $comment, $question, $choices, $day, $hour, $text, $smiley, $nodelay); break; // Verrouille un sujet case "lock": lock($group); break; // Met un message en post-it case "post_it": post_it($group); break; // Déplace un sujet case "move": if(!empty($moveto)) $message=do_move($group, $moveto); break; // Enregistre un vote pour un sondage case "vote": if(isset($vote)) $message = vote($id_poll, $vote); else $message = $LANG["VOTE-ERROR"]; break; // Considère tous les messages comme lu case "valid": $time = time(); if(!empty($ID_SESS)){ $query = "UPDATE atk_sessions SET last_visit='" . $time . "' WHERE id = '$ID_SESS'"; dbquery($query); } $LAST_VISIT = $time; break; // Coupe un sujet case "cut": break; } /*******************************************/ /* Vérification de l'accès pour les logins */ /*******************************************/ if($PF["log_login"] != "") { $list_login = explode("\n", $PF["log_login"]); $LOG_FORUM = 0; foreach($list_login AS $login_allowed){ $login_allowed = str_replace("\r","",$login_allowed); if(strtolower($login_allowed) == strtolower($ATK_LOGIN)) $LOG_FORUM = 1; } } /***********************************************/ /* Valide la lecture du livre d'or ou des news */ /***********************************************/ if($PF["structure"]>1){ $time = time(); if(!empty($ID_SESS)){ $query = "UPDATE atk_sessions SET last_visit='" . $time . "' WHERE id = '$ID_SESS'"; dbquery($query); } } /******************************************************/ /* Envoie les cookies de vérification des messages lu */ /******************************************************/ if($msg) $tmp_id=$msg; if($cit) $tmp_id=$cit; if(!empty($tmp_id) && $ACCES && ($PF["log_login"]=="" || $LOG_FORUM)){ $query = "SELECT group_id FROM atk_posts WHERE id=$tmp_id"; $group = dbgetfirst($query); // Session php if($PHP_SESS_ENABLED){ if(isset($_SESSION["READ"][$group])) $LAST_READ = $_SESSION["READ"][$group]; else $LAST_READ = $LAST_VISIT_DEFAULT; $_SESSION["READ"][$group] = $DATE; // Session "maison" } else { if(isset($ATK_READ[$group])) $LAST_READ = $ATK_READ[$group]; else $LAST_READ = $LAST_VISIT_DEFAULT; $ATK_READ[$group]=$DATE; $tmp = serialize($ATK_READ); setcookie("ATK_READ", $tmp); } unset($tmp_id); } /********************************/ /* Calcul les membres connectés */ /********************************/ if(!empty($PF["show_connected"])){ $expire=$SESSION_EXPIRE-$USER_CONNEXION_TIME; // Session php if($PHP_SESS_ENABLED){ // Recherche des connectés non invités $query = " SELECT atk_sessions.user, atk_sessions.session, atk_sessions.forum FROM atk_forums, atk_sessions WHERE atk_sessions.expire >= $expire AND atk_sessions.user <> 'nobody' AND atk_sessions.forum = atk_forums.id AND atk_forums.owner = '$owner'"; $sql = dbquery($query); // Recherche les connectés $ii = 0; $if = 0; while($row=mysql_fetch_array($sql)){ if($row["forum"]==$FORUM){ $CONNECTED_FORUM[$if++]=$row["user"]; $CONNECTED_FORUM_USER[$row["user"]]=1; } if(empty($SESS_USE[$row["session"]])){ $CONNECTED_INDEX[$ii++]=$row["user"]; $CONNECTED_INDEX_USER[$row["user"]]=1; } $SESS_USE[$row["session"]] = 1; } } else { $query = " SELECT atk_sessions.user, atk_users.email, atk_users.show_email, atk_sessions.ip, atk_sessions.forum FROM atk_forums, atk_sessions LEFT OUTER JOIN atk_users ON atk_sessions.user=atk_users.login WHERE atk_sessions.expire >= $expire AND atk_sessions.forum = atk_forums.id AND atk_forums.owner = '$owner'"; $sql = dbquery($query); // Recherche les connectés $ii = 0; $NOBODY_INDEX = 0; $if = 0; $NOBODY_FORUM = 0; while($row=mysql_fetch_array($sql)){ // Enlève le dernier nombre de l'ip pour les no_ip qui changent toujours d'ip... ereg ("([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})", $row["ip"], $regs); $row["ip"] = $regs[1] . "." . $regs[2] . "." . $regs[3]; if($row["forum"]==$FORUM && $row["user"]=="nobody" && empty($IP_forum[$row["ip"]])){ $IP_forum[$row["ip"]]=1; $NOBODY_FORUM++; } if($row["user"]=="nobody" && empty($IP_index[$row["ip"]])){ $IP_index[$row["ip"]]=1; $NOBODY_INDEX++; } if($row["forum"]==$FORUM && $row["user"]!="nobody" && empty($CONNECTED_FORUM_USER[$row["user"]])){ $CONNECTED_FORUM[$if++]=$row["user"]; $CONNECTED_FORUM_USER[$row["user"]]=1; } if($row["user"]!="nobody" && empty($CONNECTED_INDEX_USER[$row["user"]])){ $CONNECTED_INDEX[$ii++]=$row["user"]; $CONNECTED_INDEX_USER[$row["user"]]=1; } } } } /*****************************/ /* Gestion des confirmations */ /*****************************/ switch($avertissement){ case 1: $message=$LANG["ALERT-LOGIN"]; break; case 2: $message=$LANG["ALERT-DISCONNECT"]; break; case 3: $message=$LANG["ALERT-SUBSCRIBE"]; break; } /**********************************/ /* Ne mets pas les pages en cache */ /**********************************/ no_cache(); /************************/ /* Début Affichage HTML */ /************************/ echo "
"; meta_tags(); echo ""; echo ""; echo ""; /*******************************/ /* Options de personnalisation */ /*******************************/ // Mise en place du Fade if($PF["fade_link"] OR $PF["fade_icon"]) include("./javascript/Fade.js"); // Inclusion du fichier d'entete if($PF["top_url"] && substr($PF["top_url"],0, 7) != "http://") @include($PF["top_url"]); /***********************/ /* Affichage principal */ /***********************/ // Affichage du tableau principal qui contient tout echo "| ";
// Affichage du titre
if($PF["url_title"])
echo " " . $PF["title"] . " "; /******************************************/ /* Vérification du log pour forum privées */ /******************************************/ if(!$ACCES){ if($message!="") alert("" . $message . " " . $LANG["MENU-RETURN-INDEX"] . " "); else alert(" " . $LANG["ALERT-LOG-PASSWORD-EXPLAIN"] . " " . $LANG["MENU-RETURN-INDEX"] . " "); show_log(); } elseif($PF["log_login"] != "" && !$LOG_FORUM) { if($ATK_LOGIN == "nobody"){ include_once("./index/login.php"); if(!empty($message)) alert(" " . $message . " " . $LANG["MENU-RETURN-INDEX"] . " "); else alert(" " . $LANG["ALERT-LOG_LOGIN-EXPLAIN"] . " " . $LANG["MENU-RETURN-INDEX"] . " "); show_connexion(); } else { alert(" " . $LANG["ALERT-LOG_LOGIN"] . " " . $LANG["MENU-RETURN-INDEX"] . " "); } /**********************/ /* Affichage du forum */ /**********************/ } else { // Affichage du texte d'intro if(!$PF["top_url"] && $PF["intro"]) echo " " . $PF["intro"] . " " . $LANG["GET-YOUR-FORUM"];
echo " - " . $LANG["ADMINISTRATION"] . "";
echo " - " . $LANG["MyStats"] . "";
echo " |