";
if ($_POST['panel_filename'] == "none") {
$panel_filename = "";
$panel_content = addslash($_POST['panel_content']);
$panel_type = "php";
} else {
$panel_filename = stripinput($_POST['panel_filename']);
$panel_type = "file";
$panel_content = "";
}
$panel_side = isNum($_POST['panel_side']) ? $_POST['panel_side'] : "1";
$panel_access = isNum($_POST['panel_access']) ? $_POST['panel_access'] : "0";
if ($panel_side == "1" || $panel_side == "4") {
$panel_display = "0";
} else {
$panel_display = isset($_POST['panel_display']) ? "1" : "0";
}
if (isset($panel_id)) {
if ($panel_name != "") {
$data = dbarray(dbquery("SELECT * FROM ".$db_prefix."panels WHERE panel_id='$panel_id'"));
if ($panel_name != $data['panel_name']) {
$result = dbquery("SELECT * FROM ".$db_prefix."panels WHERE panel_name='$panel_name'");
if (dbrows($result) != 0) $error .= $locale['471']."
";
}
}
if ($panel_type == "php" && $panel_content == "") $error .= $locale['472']."
";
if ($error == "") {
$result = dbquery("UPDATE ".$db_prefix."panels SET panel_name='$panel_name', panel_filename='$panel_filename', panel_content='$panel_content', panel_access='$panel_access', panel_display='$panel_display' WHERE panel_id='$panel_id'");
}
opentable($locale['480']);
echo "
\n";
if ($error != "") {
echo $locale['481']."
\n".$error."
\n";
} else {
echo $locale['482']."
\n";
}
echo "".$locale['486']."
".$locale['487']."
\n";
closetable();
} else {
if ($panel_name != "") {
$result = dbquery("SELECT * FROM ".$db_prefix."panels WHERE panel_name='$panel_name'");
if (dbrows($result) != 0) $error .= $locale['471']."
";
}
if ($panel_type == "php" && $panel_content == "") $error .= $locale['472']."
";
if ($panel_type == "file" && $panel_filename == "none") $error .= $locale['473']."
";
if ($error == "") {
$result = dbquery("SELECT * FROM ".$db_prefix."panels WHERE panel_side='$panel_side' ORDER BY panel_order DESC LIMIT 1");
if (dbrows($result) != 0) { $data = dbarray($result); $neworder = $data['panel_order'] + 1; } else { $neworder = 1; }
$result = dbquery("INSERT INTO ".$db_prefix."panels (panel_name, panel_filename, panel_content, panel_side, panel_order, panel_type, panel_access, panel_display, panel_status) VALUES ('$panel_name', '$panel_filename', '$panel_content', '$panel_side', '$neworder', '$panel_type', '$panel_access', '$panel_display', '0')");
}
opentable($locale['483']);
echo "
\n";
if ($error != "") {
echo $locale['484']."
".$error."
\n";
} else {
echo $locale['485']."
\n";
}
echo "".$locale['486']."
".$locale['487']."
\n";
closetable();
}
} else {
if (isset($_POST['preview'])) {
$panel_name = stripinput($_POST['panel_name']);
$panel_filename = $_POST['panel_filename'];
$panel_content = isset($_POST['panel_content']) ? $_POST['panel_content'] : "";
$panel_access = $_POST['panel_access'];
$panel_side = $_POST['panel_side'];
$panelon = isset($_POST['panel_display']) ? " checked" : "";
$panelopts = $_POST['panel_side'] == "1" || $_POST['panel_side'] == "4" ? " style='display:none'" : " style='display:block'";
$panel_content = stripslash($panel_content);
opentable($panel_name);
if ($panel_filename != "none") {
@include INFUSIONS.$panel_filename."/".$panel_filename.".php";
$panel_type = "file";
} else {
eval($panel_content);
$panel_type = "php";
}
$panel_content = phpentities($panel_content);
closetable();
tablebreak();
}
if (isset($step) && $step == "edit") {
$result = dbquery("SELECT * FROM ".$db_prefix."panels WHERE panel_id='$panel_id'");
if (dbrows($result) != 0) {
$data = dbarray($result);
$panel_name = $data['panel_name'];
$panel_filename = $data['panel_filename'];
$panel_content = phpentities(stripslashes($data['panel_content']));
$panel_type = $data['panel_type'];
$panel_access = $data['panel_access'];
$panel_side = $data['panel_side'];
$panelon = $data['panel_display'] == "1" ? " checked" : "";
$panelopts = $panel_side == "1" || $panel_side == "4" ? " style='display:none'" : " style='display:block'";
}
}
if (isset($panel_id)) {
$action = FUSION_SELF.$aidlink."&panel_id=$panel_id";
opentable($locale['450']);
} else {
if (!isset($_POST['preview'])) {
$panel_name = "";
$panel_filename = "";
$panel_content = "openside(\"name\");\n"." echo \"content\";\n"."closeside();";
$panel_type = "";
$panel_access = "";
$panel_side = "";
$panelon = "";
$panelopts = " style='display:none'";
}
$action = FUSION_SELF.$aidlink;
opentable($locale['451']);
}
$user_groups = getusergroups(); $access_opts = "";
while(list($key, $user_group) = each($user_groups)){
$sel = ($panel_access == $user_group['0'] ? " selected" : "");
$access_opts .= "\n";
}
echo "\n";
closetable();
}
echo "\n";
echo "\n";
require_once BASEDIR."footer.php";
?>