Naujokas
Reputacija:
0 Pranešimai: 17
Įstojo: 2007-10-24
Klaida : Code Notice: Undefined index: global_182 in /home/fiureris/reallife.gan.lt/administration/panel_editor.php on line 136
Code
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: panel_editor.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once \"../maincore.php\";
require_once THEMES.\"templates/admin_header.php\";
include LOCALE.LOCALESET.\"admin/panels.php\";
if (!checkrights(\"P\") || !defined(\"iAUTH\") || $_GET['aid'] != iAUTH) { redirect(\"../index.php\"); }
$temp = opendir(INFUSIONS);
while ($folder = readdir($temp)) {
if (!in_array($folder, array(\".\",\"..\")) && strstr($folder, \"_panel\")) {
if (is_dir(INFUSIONS.$folder)) $panel_list[] = $folder;
}
}
closedir($temp); sort($panel_list); array_unshift($panel_list, \"none\");
if (isset($_POST['save'])) {
$error = \"\";
$panel_name = stripinput($_POST['panel_name']);
if ($panel_name == \"\") $error .= $locale['470'].\" \";
if ($_POST['panel_filename'] == \"none\") {
$panel_filename = \"\";
$panel_content = addslash($_POST['panel_content']);
$panel_type = \"php\";
} else {
$panel_filename = stripinput($_POST['panel_filename']);
$panel_content = \"\";
$panel_type = \"file\";
}
$admin_password = isset($_POST['admin_password']) ? $_POST['admin_password'] : \"\";
$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($_GET['panel_id']) && isnum($_GET['panel_id'])) {
if ($panel_name) {
$data = dbarray(dbquery(\"SELECT * FROM \".DB_PANELS.\" WHERE panel_id='\".$_GET['panel_id'].\"'\"));
if ($panel_name != $data['panel_name']) {
$result = dbquery(\"SELECT * FROM \".DB_PANELS.\" WHERE panel_name='$panel_name'\");
if (dbrows($result)) { $error .= $locale['471'].\" \"; }
}
}
if ($panel_type == \"php\" && $panel_content == \"\") { $error .= $locale['472'].\" \"; }
if ((!isset($_COOKIE[COOKIE_PREFIX.'admin']) || md5($_COOKIE[COOKIE_PREFIX.'admin']) != $userdata['user_admin_password']) && md5(md5($admin_password)) != $userdata['user_admin_password']) {
$error .= $locale['474'].\" \";
}
if (!$error) {
$result = dbquery(\"UPDATE \".DB_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='\".$_GET['panel_id'].\"'\");
}
opentable($locale['480']);
echo \"\n\";
closetable();
if (!isset($_COOKIE[COOKIE_PREFIX.'admin']) && md5(md5($admin_password)) == $userdata['user_admin_password']) {
setcookie(COOKIE_PREFIX.\"admin\", md5($admin_password), time() + 3600, \"/\", \"\", \"0\");
}
} else {
if ($panel_name) {
$result = dbquery(\"SELECT * FROM \".DB_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 ((!isset($_COOKIE[COOKIE_PREFIX.'admin']) || md5($_COOKIE[COOKIE_PREFIX.'admin']) != $userdata['user_admin_password']) && md5(md5($admin_password)) != $userdata['user_admin_password']) {
$error .= $locale['474'].\" \";
}
if (!$error) {
$result = dbquery(\"SELECT * FROM \".DB_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_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\";
closetable();
if (!isset($_COOKIE[COOKIE_PREFIX.'admin']) && md5(md5($admin_password)) == $userdata['user_admin_password']) {
setcookie(COOKIE_PREFIX.\"admin\", md5($admin_password), time() + 3600, \"/\", \"\", \"0\");
}
}
} else {
if (isset($_POST['preview'])) {
$panel_name = stripinput($_POST['panel_name']);
$panel_filename = $_POST['panel_filename'];
$panel_content = isset($_POST['panel_content']) ? stripslash($_POST['panel_content']) : \"\";
$admin_password = isset($_POST['admin_password']) ? $_POST['admin_password'] : \"\";
$panel_side = $_POST['panel_side'];
$panel_access = $_POST['panel_access'];
$panelon = isset($_POST['panel_display']) ? \" checked='checked'\" : \"\";
$panelopts = $_POST['panel_side'] == \"1\" || $_POST['panel_side'] == \"4\" ? \" style='display:none'\" : \" style='display:block'\";
$panel_type = $panel_filename == \"none\" ? \"php\" : \"file\";
if ((isset($_COOKIE[COOKIE_PREFIX.'admin']) && md5($_COOKIE[COOKIE_PREFIX.'admin']) == $userdata['user_admin_password']) || md5(md5($admin_password)) == $userdata['user_admin_password']) {
opentable($panel_name);
if ($panel_type == \"file\") {
@include INFUSIONS.$panel_filename.\"/\".$panel_filename.\".php\";
} else {
eval($panel_content);
}
$panel_content = phpentities($panel_content);
closetable();
if (!isset($_COOKIE[COOKIE_PREFIX.'admin']) && md5(md5($admin_password)) == $userdata['user_admin_password']) {
setcookie(COOKIE_PREFIX.\"admin\", md5($admin_password), time() + 3600, \"/\", \"\", \"0\");
}
} else {
echo \"\".$locale['global_182'].\"
\n\";
$panel_content = phpentities($panel_content);
}
}
if ((isset($_GET['action']) && $_GET['action'] == \"edit\") && (isset($_GET['panel_id']) && isnum($_GET['panel_id']))) {
$result = dbquery(\"SELECT * FROM \".DB_PANELS.\" WHERE panel_id='\".$_GET['panel_id'].\"'\");
if (dbrows($result)) {
$data = dbarray($result);
$panel_name = $data['panel_name'];
$panel_filename = $data['panel_filename'];
$panel_content = phpentities(stripslashes($data['panel_content']));
$admin_password = \"\";
$panel_type = $data['panel_type'];
$panel_side = $data['panel_side'];
$panel_access = $data['panel_access'];
$panelon = $data['panel_display'] == \"1\" ? \" checked='checked'\" : \"\";
$panelopts = $panel_side == \"1\" || $panel_side == \"4\" ? \" style='display:none'\" : \" style='display:block'\";
} else {
redirect(FUSION_SELF.$aidlink);
}
}
if (isset($_GET['panel_id']) && isnum($_GET['panel_id'])) {
$action = FUSION_SELF.$aidlink.\"&panel_id=\".$_GET['panel_id'];
opentable($locale['450']);
} else {
if (!isset($_POST['preview'])) {
$panel_name = \"\";
$panel_filename = \"\";
$panel_content = \"openside(\\"name\\");\n\".\" echo \\"content\\";\n\".\"closeside();\";
$admin_password = \"\";
$panel_type = \"\";
$panel_side = \"\";
$panel_access = \"\";
$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='selected'\" : \"\");
$access_opts .= \"\".$user_group['1'].\" \n\";
}
echo \"\n\";
closetable();
}
echo \"\n\";
require_once THEMES.\"templates/footer.php\";
?>
Toj eilutj lyg viskas ir gerai. Beje ia panel_editor.php failas.