=".$bb;
dbquery($query);
$query="INSERT INTO ".$prefix."menu (m1,m2,m3, page, nome) VALUES ($bb,0,0,\"".$filename1."\",\"".$label."\")";
dbquery($query);
// JSS added to allow for customised title and keyworks per page
if($create) addpage ($bb,0,$extra,$filename,$label,$descr,$templat,$restricted,$ptitle,$pkeywords);
// if($create) addpage ($bb,0,$extra,$filename,$label,$descr,$templat,$restricted);
break;
}
case "2": {
$bb=strval($menu[$count][1])+1;
$query="UPDATE ".$prefix."menu SET m2=m2+1 WHERE m1=".$menu[$count][0]." AND m2>=".$bb;
dbquery($query);
$query="INSERT INTO ".$prefix."menu (m1,m2,m3, page, nome) VALUES (".$menu[$count][0].",".$bb.",0,\"".$filename1."\",\"".$label."\")";
dbquery($query);
// JSS added to allow for customised title and keyworks per page
if($create) addpage ($menu[$count][0],$bb,$extra,$filename,$label,$descr,$templat,$restricted,$ptitle,$pkeywords);
// if($create) addpage ($menu[$count][0],$bb,$extra,$filename,$label,$descr,$templat,$restricted);
break;
}
case "3": {
$bb=strval($menu[$count][2])+1;
$query="UPDATE ".$prefix."menu SET m3=m3+1 WHERE m1=".$menu[$count][0]." AND m2=".$menu[$count][2]." AND m3>=$bb";
dbquery($query);
$query="INSERT INTO ".$prefix."menu (m1,m2,m3, page, nome) VALUES (".$menu[$count][0].",".$menu[$count][1].",".$bb.",\"".$filename1."\",\"".$label."\")";
dbquery($query);
// JSS added to allow for customised title and keyworks per page
if($create) addpage ($menu[$count][0],$menu[$count][1],$extra,$filename,$label,$descr,$templat,$restricted,$ptitle,$pkeywords);
// if($create) addpage ($menu[$count][0],$menu[$count][1],$extra,$filename,$label,$descr,$templat,$restricted);
break;
}
}
$message=$langmessage[87];
$pagenum="index";
readmenu();
}
break;
default:
}
$admintemplate=false;
if(isset($_GET['do']) && $_GET['do']!="profile" && $_GET['do']!="login" && $_GET['do']!="sitemap")
$admintemplate=true;
switch($_GET['do']) {
case "edit":
if($_SESSION[$set['password']]=="1") $edit=1;
else {
$edit=0;
unset($_GET['do']);
}
break;
case "editextra":
if($_SESSION[$set['password']]=="1") $editextra=1;
else {
$editextra=0;
unset($_GET['do']);
}
break;
default:
}
}
function generate() {
global $edit, $langmessage, $set, $pagenum, $menu, $templatepath, $selected, $LNEversion, $prefix, $out;
$edit=0;
$count=0;
$go_sm = "\n\n
\n
http://".sv(SERVER_NAME)."/\n
0.6\n
".date('Y-m-d')."\n
daily\n\n";
while($menu[$count][0]!="") {
$result1 = dbquery("SELECT * FROM ".$prefix."paginas WHERE page=\"".str_replace("_","",$menu[$count][3])."\"");
$row1=fetch_array($result1);
if($row1['template']!="")
$template1="templates/".$row1['template']."/template.php";
else
$template1=$templatepath;
$out="";
$pagenum=str_replace("''", "'",$menu[$count][3]);
$pagenum=str_replace("_","",$pagenum);
if(!strval(strstr($menu[$count][3], "*"))) {
$selected['index']=$menu[$count][0];
$selected['name']=$menu[$count][4];
$selected['link']=$menu[$count][3];
if($set['extension']=="php")
$page="\n";
$page.=file_get_contents($template1);
$go_sm .= "\n
http://".sv(SERVER_NAME).dirname(sv(REQUEST_URI)).$menu[$count][3].".".$set['extension']."\n
0.5\n
". date('Y-m-d') ."\n
daily\n
\n";
if(!$fp=fopen($pagenum.".".$set['extension'],"w"))
die($langmessage[110].$pagenum.".".$set['extension']);
$contnt=html_entity_decode(stripslashes($row1['content']));
//Look in the content for header modules
while($page != "") {
if($pagearray=explode($set['openfield'],$page,2)) {
$out.=$pagearray[0];
$page=$pagearray[1];
if($pagearray=explode($set['closefield'],$page,2)) {
$command=trim($pagearray[0]);
$page=$pagearray[1];
switch($command) {
case "content": {
contentmarkers($contnt);
$out.="";
break;
}
case "header": {
$result1 = dbquery("SELECT * FROM ".$prefix."paginas WHERE page=\"".$menu[$count][3]."\"");
$row1=fetch_array($result1);
// JSS added to allow for customised title and keyworks per page
$out.=printheader(1,$selected['name'],$row1['description'],$row1['template'],$row1['title'],$row1['keywords']);
// $out.=printheader(1,$selected['name'],$row1['description'],$row1['template']);
break;
}
case "footer": $out.=''; break;
case "homelink": $out.=''.$langmessage[111].''; break;
case "image": $out.="templates/".$set['template']."/images/"; break;
case "extra": $out.="\n"; break;
case "login": $out.="\n"; break;
case "loginform": $out.="\n"; break;
case "mainmenu": $out.="\n"; break;
case "mainmenu1": $out.="\n"; break;
case "mainmenu2": $out.="\n"; break;
case "mainmenu3": $out.="\n"; break;
case "treemenu": $out.="\n"; break;
case "fullmenu": $out.="\n"; break;
case "expmenu": $out.="\n"; break;
case "submenu": $out.="\n"; break;
case "selected": $out.=$selected['name']; break;
case "sitemap": $out.=sitemap(1); break;
case "subtitle": $out.=$set['subtitle']; break;
case "title": $out.=''.$set['title'].''; break;
default: {
if(strpos($command, "plugin")!== false) {
$aa=explode(" ",$command,2);
$pluginpath="plugins/".trim($aa[1]);
if(file_exists($pluginpath."/first.mod"))
$out=file_get_contents($pluginpath."/first.mod").$out;
if(file_exists($pluginpath."/header.mod"))
$out=str_replace("",file_get_contents($pluginpath."/header.mod")."\n",$out);
if(file_exists($pluginpath."/onload.mod"))
$out=str_replace("\n";
if(file_exists($pluginpath."/place.mod"))
$out.=file_get_contents("$pluginpath/place.mod");
} elseif(strpos($command, "extra")!== false) {
$aa=explode(" ",$command,2);
$out.="";
} else {
$found=false;
$addons=fetch_all(dbquery("SELECT * FROM ".$prefix."addons WHERE active=1"));
foreach($addons as $addon) {
if($command==$addon['name']) {
$out.="";
$found=true;
break;
} elseif(substr($command,0,strlen($addon['name'])) == $addon['name']) {
$found=true;
$out.="";
break;
}
}
if(!$found)
$out.=$command;
}
}
}
} else break;
} else break;
}
if($page != "") $out.=$page;
$addons=fetch_all(dbquery("SELECT * FROM ".$prefix."addons WHERE active=1 AND header=1"));
foreach($addons as $addon)
if(strpos($contnt,"%!$".$addon['name']))
require_once "addons/".$addon['name']."/header.php";
fwrite($fp,$out);
fclose($fp);
@chmod($menu[$count][3].".".$extension, 0755);
if($set['extension'] == "php") {
if(file_exists($menu[$count][3].".html")) unlink($menu[$count][3].".html");
} else {
if($menu[$count][3]!="index") if(file_exists($menu[$count][3].".php")) unlink($menu[$count][3].".php");
}
}
$count++;
}
$go_sm .= "\n";
$fp_go = fopen('sitemap.xml', 'w');
fwrite($fp_go, $go_sm);
fclose($fp_go);
unset($_SESSION[$set['password']]);
setcookie('userpass', "", time() - 60);
setcookie('userhandle', "", time() - 60);
session_destroy();
unset($_GET['do']);
header("Location: ".$set['homepath']);
}
function contentmarkers($contnt) {
global $out;
if(strpos($contnt, '%!$plugin')!==false) {
$one=explode('%!$plugin',$contnt,2);
$two=explode('$!%',$one[1],2);
$pluginame="./plugins/".trim($two[0]);
if(file_exists($pluginame."/header.mod"))
$out=str_replace("",file_get_contents($pluginame."/header.mod")."\n",$out);
if(file_exists($pluginame."/onload.mod"))
$out=str_replace("
";
$out=str_replace("",$three,$out);
}
}
// JSS altered to allow customised title and keywords per page
function addpage($m1,$m2,$m3,$page,$nome,$descr,$templat,$restricted,$ptitle,$pkeywords) {
// function addpage($m1,$m2,$m3,$page,$nome,$descr,$templat,$restricted) {
global $prefix;
// JSS altered to allow customised title and keywords per page
$query='INSERT INTO '.$prefix.'paginas (m1,m2,m3,page,nome,content,description,template,restricted,title,keywords) VALUES ('.$m1.','.$m2.','.$m3.',"'.$page.'","'.$nome.'","'.htmlentities("
".$nome."
").'","'.$descr.'","'.$templat.'",'.$restricted.',"'.$ptitle.'","'.$pkeywords.'")';
// $query='INSERT INTO '.$prefix.'paginas (m1,m2,m3,page,nome,content,description,template,restricted) VALUES ('.$m1.','.$m2.','.$m3.',"'.$page.'","'.$nome.'","'.htmlentities("
".$nome."
").'","'.$descr.'","'.$templat.'",'.$restricted.')';
dbquery($query);
}
function addons() {
global $out, $prefix, $langmessage, $message;
$out.="
Addons
\n";
if($_GET['action']=="edit" && $_GET['name']!="") {
if(!isset($_POST['submit'])) {
$addon=fetch_array(dbquery("SELECT * FROM ".$prefix."addons WHERE name=\"".$_GET['name']."\""));
$out.="\n";
} else {
dbquery("UPDATE ".$prefix."addons SET name=\"".$_POST['name']."\", fname=\"".$_POST['fname']."\", aname=\"".$_POST['aname']."\", active=\"".$_POST['active']."\", adminlevel=\"".$_POST['adminlevel']."\", header=\"".$_POST['header']."\" WHERE id=\"".$_POST['id']."\"");
$out.="
\n";
}
//displays the 3 icons: edit, delete, admin menu
function adminmenu() {
global $set,$pagenum, $langmessage;
$aa="";
if($_SESSION[$set['password']]=="1") {
$aa.="\n
\n";
}
return $aa;
}
function create_page() {
global $set, $menu, $prefix, $langmessage;
$out.="\n";
return $out;
}
function delete_page() {
global $out, $pagenum, $langmessage, $selected, $prefix;
$out.="
\n
$langmessage[131]".$selected['name']."?
\n";
$out.="\n
\n";
$result = dbquery("SELECT * FROM ".$prefix."paginas WHERE page=\"".$pagenum."\"");
if($row=fetch_array($result))
$out.=showcontent(stripslashes(html_entity_decode($row['content'])));
else
$out.="
$langmessage[116]
";
}
function editextra($id) {
global $prefix;
$result=dbquery("SELECT id, content FROM ".$prefix."extras WHERE id=$id");
$row=fetch_array($result);
print "