Codice PHP:
<?php
/************************************************************************/
/* FlatNuke - Flat Text Based Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2003-2004 by Simone Vellei */
/* [url]http://flatnuke.sourceforge.net[/url] */
/* */
/* This program 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. */
/************************************************************************/
/* if there aren't a registered user go to setup */
/*if(file_exists("setup.php")) {
$mod = $_GET['mod'];
if(strcmp($mod, "none_Login") == 0)
{}
else
if(file_exists("misc/firstinstall"))
header("Location: setup.php");
}*/
include_once "functions.php";
// automatically load PHP code in files contained in include/phpfunctions
load_php_code("include/phpfunctions");
include "header.php";
// check if IP address is blacklisted
$ip = getparam("REMOTE_ADDR", PAR_SERVER, SAN_NULL);
if (is_blocked_ip($ip)){
fnlog("IPBLOCK","Access denied to IP address ".strip_tags($ip));
// have fun ;)
header("Location: [url]http://www.spam.com/[/url]");
exit;
}
// security option
$req=getparam("REQUEST_URI", PAR_SERVER, SAN_FLAT);
if(strstr($req,"myforum="))
die(_NONPUOI);
// first microtime to calculate time generation page
$time1 = get_microtime();
//AUTOBUILD -->
// prevent annoying newbies still using that fuckin' Winzip(C) ...
$list_empty_dirs = array("news", "forum/users");
foreach($list_empty_dirs as $empty_dir) {
if(!file_exists($empty_dir)) {
if(mkdir($empty_dir, 0777)) {
fnlog("Homepage", "$ip||".get_username()."||Directory $empty_dir created.");
} else {
fnlog("Homepage", "$ip||".get_username()."||Directory $empty_dir cannot be created, check write permissions.");
}
}
}
// create some system files on-the-fly
$list_new_files = array("misc/motd.php");
foreach($list_new_files as $new_file) {
if(!file_exists($new_file)) {
fnwrite($new_file, _MOTDMESS, "w+", array("nonull"));
}
}
//<-- AUTOBUID
// STATISTICS -->
$from = getparam("HTTP_REFERER", PAR_SERVER, SAN_FLAT);
$host = getparam("HTTP_HOST", PAR_SERVER, SAN_FLAT);
$self = getparam("PHP_SELF", PAR_SERVER, SAN_FLAT);
$where= "http://".$host.$self;
$where = str_replace(basename($where),"",$where);
$url=str_replace("http://","",$where);
$url=str_replace("www.","",$url);
$from=str_replace("http://","",$from);
$from=str_replace("www.","",$from);
if (file_exists("sections/none_Statistiche/stat.php") AND !stristr($from,$url)) {
include "sections/none_Statistiche/stat.php";
stats();
}
// <-- STATISTICS
// MAINTENANCE --> _MAINT _MAINT_MSG
if ($maintenance == "1") {
if(!is_admin()) {
?><div align="center" style="padding:2em;">
<div style="background-color:#F0F0F0;max-width:250px;padding:10px;border:1px solid #999999;">
[img]images/maintenance.png[/img]
<span style="color:#CC0000;">
[b]<?= _MAINT ?>[/b]
<?= _MAINT_MSG ?>
</span>
<form action="sections/none_Login/section.php" method="post">
<input type="hidden" name="action" value="login" />
<label for="username" style="font-size:20px;"><?= _NOMEUTENTE ?>:</label>
<input alt="username" name="nome" size="15" id="username" style="border:0.5px solid #333333;font-size:20px;" />
<label for="password" style="font-size:20px;"><?= _PASSWORD ?></label>:
<input alt="password" name="logpassword" type="password" size="15" id="password" style="border:0.5px solid #333333;font-size:20px;" />
<input type="submit" value="<?= _LOGIN ?>" style="border:0.5px solid #333333;font-size:16px;font-weight:bold;" />
</form>
</div>
</div><?
if(defined('_THEME_VER')) {
if(_THEME_VER > 0) {
}
}
else {
include_once "footer.php";
}
exit();
} else {
echo "<div style='padding:1em;color:red;background-color:yellow;border:3px solid red;text-align:center;font-weight:bold;font-size:larger;'>"._MAINT."</div>";
}
}
// <-- MAINTENANCE
function getflopt(){
global $home_section, $theme;
$req = getparam("REQUEST_URI", PAR_SERVER, SAN_FLAT);
if(strstr($req,"myforum="))
die(_NONPUOI);
$op = getparam("mod",PAR_GET,SAN_FLAT);
$file = getparam("file",PAR_GET,SAN_FLAT);
$file = stripslashes($file);
$id = getparam("id",PAR_GET,SAN_FLAT);
$myforum = getparam("myforum",PAR_COOKIE,SAN_FLAT);
// check option to execute
switch($op){
// no option given: homepage
case "":
// print motd content if exists
if(file_exists("misc/motd.php") AND trim(get_file("misc/motd.php"))!="") {
OpenTable();
echo "<div class=\"motd\">";
// print motd image if exists
if(file_exists("themes/$theme/images/motd.png")) {
echo "[img]themes/$theme/images/motd.png[/img]";
} else echo "";
include ("misc/motd.php");
echo "</div>";
CloseTable();
}
if(($home_section == "") or !isset($home_section))
create_news(); // display news as default
else
view_section($home_section); // display section in homepage
break;
// read details of a news
case "read":
read_news($id);
break;
// publish a news
case "news":
$req=getparam("REQUEST_URI",PAR_SERVER,SAN_FLAT);
if(strstr($req,"myforum="))
die(_NONPUOI);
if(is_admin())
insert_news();
else {
OpenTable();
print("<div align='center'>[b]"._NOLEVELSECT."[/b]</div>");
CloseTable();
return;
}
break;
// modify a file
case "modcont":
$req = getparam("REQUEST_URI",PAR_SERVER,SAN_FLAT);
$fneditor=getparam("fneditor",PAR_GET,SAN_FLAT);
if(strstr($req,"myforum="))
die(_NONPUOI);
if(is_admin())
edit_content($file,$fneditor);
else {
OpenTable();
print("<div align='center'>[b]"._NOLEVELSECT."[/b]</div>");
CloseTable();
return;
}
break;
// insert a comment to a news
case "comment":
insert_comment($id);
break;
// view a section
default:
view_section($op);
break;
}
}
include_once "themes/$theme/theme.php";
include "themes/$theme/structure.php";
if(defined('_THEME_VER')) {
if(_THEME_VER > 0) {
}
} else {
include_once "footer.php";
}
?>