This commit has been accessed 579 times via Git panel.
commit c3d9b4ee2de3b7aea7a63b8dc6f503219f037c92
tree 3bf6bd2b49f6a93add17bbe46f40579bab320d27
parent 69a222cff7c947f620be1ec678a3d93289e4968a
author Engels Antonio <engels@majcms.org> 1321881091 +0800
committer Engels Antonio <engels@majcms.org> 1321881091 +0800
Add panel-entry association
diff --git a/core.php b/core.php
index cc86ff8..235ef43 100644
--- a/core.php
+++ b/core.php
@@ -669,13 +669,66 @@ function maj_download_file($file_name,$file_dir,$count_dir) {
function maj_panels($panel_array) {
global $maj_data_directory;
- global $maj_admin_username;
global $maj_logged_in_username;
+ global $maj_admin_username;
+ global $maj_req_entry;
global $maj_wspace;
if (count($panel_array) > 0) {
foreach ($panel_array as $panel) {
+
+ if (file_exists("$maj_data_directory/panels/$panel/link.txt") and ($maj_logged_in_username != $maj_admin_username)) {
+
+ if (file_get_contents("$maj_data_directory/panels/$panel/link.txt") != $maj_req_entry) {
+ continue;
+ }
+
+ if (file_get_contents("$maj_data_directory/panels/$panel/link.txt") == $maj_req_entry) {
+
+ $today = date("YmdHis",time() + $offset);
+
+ if ($maj_req_entry > $today) {
+ continue;
+ }
+
+ if (file_exists("$maj_data_directory/items/$maj_req_entry/private.txt")) {
+ continue;
+ }
+
+ $pvt_cat = "0";
+
+ if (file_exists("$maj_data_directory/items/$maj_req_entry/categories")) {
+
+ if ($dh_cat = opendir("$maj_data_directory/items/$maj_req_entry/categories")) {
+
+ while (($cat = readdir($dh_cat)) !== false) {
+
+ if ($cat != "." && $cat != "..") {
+
+ if (file_exists("$maj_data_directory/categories/$cat/private.txt")) {
+ $pvt_cat = $pvt_cat + 1;
+ }
+ }
+ }
+ closedir($dh_cat);
+ }
+ }
+
+ if (($pvt_cat > 0) and !file_exists("$maj_data_directory/items/$maj_req_entry/cat.txt")) {
+ continue;
+ }
+
+ if ((file_exists("$maj_data_directory/items/$maj_req_entry/members") and !isset($maj_logged_in_username)) or (isset($maj_logged_in_username) and !file_exists("$maj_data_directory/items/$maj_req_entry/members/$maj_logged_in_username"))) {
+ continue;
+ }
+
+ if (file_exists("$maj_data_directory/items/$maj_req_entry/member.txt") and (!isset($maj_logged_in_username))) {
+ continue;
+ }
+
+ }
+ }
if (!file_exists("$maj_data_directory/panels/$panel/free.txt")) {
diff --git a/index.php b/index.php
index 24e410b..09586d0 100644
--- a/index.php
+++ b/index.php
@@ -1125,7 +1125,7 @@ if ($maj_dh_items = opendir("$maj_data_directory/items")) {
$maj_latest[] = $maj_item;
- if ((file_exists("$maj_data_directory/items/$maj_item/members") and !isset($maj_logged_in_username)) or (file_exists("$maj_data_directory/items/$maj_item/members") and !file_exists("$maj_data_directory/items/$maj_item/members/$maj_logged_in_username"))) {
+ if ((file_exists("$maj_data_directory/items/$maj_item/members") and !isset($maj_logged_in_username)) or (isset($maj_logged_in_username) and !file_exists("$maj_data_directory/items/$maj_item/members/$maj_logged_in_username"))) {
continue;
}
diff --git a/panels.php b/panels.php
index 361b839..b82f432 100644
--- a/panels.php
+++ b/panels.php
@@ -12,293 +12,293 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP
header("Location: login.php");
}
-$login_username = file_get_contents("data/username.txt");
+$login_username = file_get_contents("$maj_data_directory/username.txt");
if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
exit();
}
-if (isset($_POST['new_id']) and !empty($_POST['new_id']) and isset($_POST['new_title']) and !empty($_POST['new_title']) and isset($_POST['new_content']) and !empty($_POST['new_content']) and !file_exists("data/panels/{$_POST['new_id']}")) {
+if (isset($_POST['new_id']) and !empty($_POST['new_id']) and isset($_POST['new_title']) and !empty($_POST['new_title']) and isset($_POST['new_content']) and !empty($_POST['new_content']) and !file_exists("$maj_data_directory/panels/{$_POST['new_id']}")) {
- if (!file_exists("data/panels")) {
- mkdir("data/panels");
+ if (!file_exists("$maj_data_directory/panels")) {
+ mkdir("$maj_data_directory/panels");
}
$new_id = trim(strip_tags(mb_strtolower(str_replace(" ", "_", $_POST['new_id']))));
- if (!file_exists("data/panels/$new_id")) {
- mkdir("data/panels/$new_id");
+ if (!file_exists("$maj_data_directory/panels/$new_id")) {
+ mkdir("$maj_data_directory/panels/$new_id");
}
$new_title = ucfirst(strip_tags(trim($_POST['new_title'])));
- $open_title_file = fopen("data/panels/$new_id/title.txt","w");
+ $open_title_file = fopen("$maj_data_directory/panels/$new_id/title.txt","w");
fwrite($open_title_file,$new_title);
fclose($open_title_file);
$panel_content = ucfirst(trim($_POST['new_content']));
- $new_content_file = fopen("data/panels/$new_id/panel.php","w");
+ $new_content_file = fopen("$maj_data_directory/panels/$new_id/panel.php","w");
fwrite($new_content_file,$panel_content);
fclose($new_content_file);
}
if ((!isset($_POST['panel_hide']) or empty($_POST['panel_hide'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/private.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/private.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/private.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/private.txt");
}
}
if (isset($_POST['panel_hide']) and !empty($_POST['panel_hide']) and ($_POST['panel_hide'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/private.txt")) {
- touch("data/panels/{$_POST['panel_id']}/private.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/private.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/private.txt");
}
}
if ((!isset($_POST['panel_auth']) or empty($_POST['panel_auth'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/auth.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/auth.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/auth.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/auth.txt");
}
}
if (isset($_POST['panel_auth']) and !empty($_POST['panel_auth']) and ($_POST['panel_auth'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/auth.txt")) {
- touch("data/panels/{$_POST['panel_id']}/auth.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/auth.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/auth.txt");
}
}
if ((!isset($_POST['panel_nomargin']) or empty($_POST['panel_nomargin'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/nomargin.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt");
}
}
if (isset($_POST['panel_nomargin']) and !empty($_POST['panel_nomargin']) and ($_POST['panel_nomargin'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
- touch("data/panels/{$_POST['panel_id']}/nomargin.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt");
}
}
if ((!isset($_POST['panel_free']) or empty($_POST['panel_free'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/free.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/free.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/free.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/free.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/nomargin.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt");
}
}
if (isset($_POST['panel_free']) and !empty($_POST['panel_free']) and ($_POST['panel_free'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/free.txt")) {
- touch("data/panels/{$_POST['panel_id']}/free.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/free.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/free.txt");
}
}
if ((!isset($_POST['panel_right']) or empty($_POST['panel_right'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
}
if (isset($_POST['panel_right']) and !empty($_POST['panel_right']) and ($_POST['panel_right'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- touch("data/panels/{$_POST['panel_id']}/right.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if ((!isset($_POST['panel_center']) or empty($_POST['panel_center'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
}
if (isset($_POST['panel_center']) and !empty($_POST['panel_center']) and ($_POST['panel_center'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- touch("data/panels/{$_POST['panel_id']}/center.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if ((!isset($_POST['panel_top']) or empty($_POST['panel_top'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
}
if (isset($_POST['panel_top']) and !empty($_POST['panel_top']) and ($_POST['panel_top'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- touch("data/panels/{$_POST['panel_id']}/top.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if ((!isset($_POST['panel_entry']) or empty($_POST['panel_entry'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if (isset($_POST['panel_entry']) and !empty($_POST['panel_entry']) and ($_POST['panel_entry'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- touch("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
}
if ((!isset($_POST['panel_bottom']) or empty($_POST['panel_bottom'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
}
if (isset($_POST['panel_bottom']) and !empty($_POST['panel_bottom']) and ($_POST['panel_bottom'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- touch("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if ((!isset($_POST['panel_header']) or empty($_POST['panel_header'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $_POST['panel_id'])) {
- unlink("data/header.txt");
+ if (file_exists("$maj_data_directory/header.txt") and (file_get_contents("$maj_data_directory/header.txt") == $_POST['panel_id'])) {
+ unlink("$maj_data_directory/header.txt");
}
}
if (isset($_POST['panel_header']) and !empty($_POST['panel_header']) and ($_POST['panel_header'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
- $new_header_file = fopen("data/header.txt","w");
+ $new_header_file = fopen("$maj_data_directory/header.txt","w");
fwrite($new_header_file,$_POST['panel_id']);
fclose($new_header_file);
}
if ((!isset($_POST['panel_footer']) or empty($_POST['panel_footer'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $_POST['panel_id'])) {
- unlink("data/footer.txt");
+ if (file_exists("$maj_data_directory/footer.txt") and (file_get_contents("$maj_data_directory/footer.txt") == $_POST['panel_id'])) {
+ unlink("$maj_data_directory/footer.txt");
}
}
if (isset($_POST['panel_footer']) and !empty($_POST['panel_footer']) and ($_POST['panel_footer'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
- $new_footer_file = fopen("data/footer.txt","w");
+ $new_footer_file = fopen("$maj_data_directory/footer.txt","w");
fwrite($new_footer_file,$_POST['panel_id']);
fclose($new_footer_file);
}
@@ -307,8 +307,8 @@ if (isset($_POST['panel_title']) and !empty($_POST['panel_title'])) {
$panel_title = ucfirst(strip_tags(trim($_POST['panel_title'])));
- if ($panel_title != file_get_contents("data/panels/{$_POST['panel_id']}/title.txt")) {
- $edit_title_file = fopen("data/panels/{$_POST['panel_id']}/title.txt","w");
+ if ($panel_title != file_get_contents("$maj_data_directory/panels/{$_POST['panel_id']}/title.txt")) {
+ $edit_title_file = fopen("$maj_data_directory/panels/{$_POST['panel_id']}/title.txt","w");
fwrite($edit_title_file,$panel_title);
fclose($edit_title_file);
}
@@ -318,34 +318,51 @@ if (isset($_POST['panel_content']) and !empty($_POST['panel_content'])) {
$panel_content = ucfirst(trim($_POST['panel_content']));
- if ($panel_content != file_get_contents("data/panels/{$_POST['panel_id']}/panel.php")) {
- $edit_content_file = fopen("data/panels/{$_POST['panel_id']}/panel.php","w");
+ if ($panel_content != file_get_contents("$maj_data_directory/panels/{$_POST['panel_id']}/panel.php")) {
+ $edit_content_file = fopen("$maj_data_directory/panels/{$_POST['panel_id']}/panel.php","w");
fwrite($edit_content_file,$panel_content);
fclose($edit_content_file);
}
}
+if (isset($_POST['panel_link']) and !empty($_POST['panel_link'])) {
+
+ $panel_link = trim($_POST['panel_link']);
+
+ if ($panel_link != file_get_contents("$maj_data_directory/panels/{$_POST['panel_id']}/link.txt")) {
+ $edit_link_file = fopen("$maj_data_directory/panels/{$_POST['panel_id']}/link.txt","w");
+ fwrite($edit_link_file,$panel_link);
+ fclose($edit_link_file);
+ }
+}
+
+if ((!isset($_POST['panel_link']) or empty($_POST['panel_link'])) and ($_POST['panel_edit'] == "on")) {
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/link.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/link.txt");
+ }
+}
+
if (isset($_POST['move_id']) and !empty($_POST['move_id']) and isset($_POST['old_id']) and !empty($_POST['old_id']) and isset($_POST['panel_edit']) and !empty($_POST['panel_edit']) and ($_POST['panel_edit'] == "on")) {
$move_id = trim(strip_tags(mb_strtolower(str_replace(" ", "_", $_POST['move_id']))));
$move_id = str_replace(",","_",$move_id);
- if (!file_exists("data/panels/$move_id")) {
- rename("data/panels/{$_POST['old_id']}","data/panels/$move_id");
+ if (!file_exists("$maj_data_directory/panels/$move_id")) {
+ rename("$maj_data_directory/panels/{$_POST['old_id']}","$maj_data_directory/panels/$move_id");
}
}
if (isset($_POST['panel_del']) and !empty($_POST['panel_del']) and ($_POST['panel_del'] == "on")) {
- if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $_POST['panel_id'])) {
- unlink("data/header.txt");
+ if (file_exists("$maj_data_directory/header.txt") and (file_get_contents("$maj_data_directory/header.txt") == $_POST['panel_id'])) {
+ unlink("$maj_data_directory/header.txt");
}
- if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $_POST['panel_id'])) {
- unlink("data/footer.txt");
+ if (file_exists("$maj_data_directory/footer.txt") and (file_get_contents("$maj_data_directory/footer.txt") == $_POST['panel_id'])) {
+ unlink("$maj_data_directory/footer.txt");
}
- rmdirr("data/panels/{$_POST['panel_id']}");
+ rmdirr("$maj_data_directory/panels/{$_POST['panel_id']}");
}
?>
@@ -361,8 +378,8 @@ body {
text-align: left;
font-size: 11px;
font-family: <?php
- if (file_exists("data/fonts/body.txt")) {
- $font_body = file_get_contents("data/fonts/body.txt");
+ if (file_exists("$maj_data_directory/fonts/body.txt")) {
+ $font_body = file_get_contents("$maj_data_directory/fonts/body.txt");
echo "{$font_body},";
}
?> arial, helvetica, sans-serif;
@@ -396,8 +413,8 @@ a:active {
border: #999999 solid 1px;
width: 350px;
font-family: <?php
- if (file_exists("data/fonts/input.txt")) {
- $font_input = file_get_contents("data/fonts/input.txt");
+ if (file_exists("$maj_data_directory/fonts/input.txt")) {
+ $font_input = file_get_contents("$maj_data_directory/fonts/input.txt");
echo "{$font_input},";
}
?> arial, helvetica, sans-serif;
@@ -420,8 +437,8 @@ a:active {
</table>
<?php
- if (file_exists("data/panels")) {
- if ($dh_panel = opendir("data/panels")) {
+ if (file_exists("$maj_data_directory/panels")) {
+ if ($dh_panel = opendir("$maj_data_directory/panels")) {
while (($entry_panel = readdir($dh_panel)) !== false) {
if ($entry_panel != "." && $entry_panel != ".." && fnmatch("*", $entry_panel)) {
@@ -454,67 +471,67 @@ a:active {
echo "<td valign=\"top\" rowspan=\"5\">";
echo "<input type=\"checkbox\" name=\"panel_hide\"";
- if (file_exists("data/panels/$panel/private.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/private.txt")) {
echo " checked";
}
echo "> hide<br>";
echo "<input type=\"checkbox\" name=\"panel_auth\"";
- if (file_exists("data/panels/$panel/auth.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/auth.txt")) {
echo " checked";
}
echo "> auth<br>";
echo "<input type=\"checkbox\" name=\"panel_free\"";
- if (file_exists("data/panels/$panel/free.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/free.txt")) {
echo " checked";
}
echo "> free<br>";
echo "<input type=\"checkbox\" name=\"panel_nomargin\"";
- if (file_exists("data/panels/$panel/nomargin.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/nomargin.txt")) {
echo " checked";
}
echo "> nomargin<br>";
echo "<input type=\"checkbox\" name=\"panel_header\"";
- if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $panel)) {
+ if (file_exists("$maj_data_directory/header.txt") and (file_get_contents("$maj_data_directory/header.txt") == $panel)) {
echo " checked";
}
echo "> header<br>";
echo "<input type=\"checkbox\" name=\"panel_footer\"";
- if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $panel)) {
+ if (file_exists("$maj_data_directory/footer.txt") and (file_get_contents("$maj_data_directory/footer.txt") == $panel)) {
echo " checked";
}
echo "> footer<br>";
echo "<input type=\"checkbox\" name=\"panel_right\"";
- if (file_exists("data/panels/$panel/right.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/right.txt")) {
echo " checked";
}
echo "> right<br>";
echo "<input type=\"checkbox\" name=\"panel_top\"";
- if (file_exists("data/panels/$panel/top.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/top.txt")) {
echo " checked";
}
echo "> top<br>";
echo "<input type=\"checkbox\" name=\"panel_bottom\"";
- if (file_exists("data/panels/$panel/bottom.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/bottom.txt")) {
echo " checked";
}
echo "> bottom<br>";
echo "<input type=\"checkbox\" name=\"panel_center\"";
- if (file_exists("data/panels/$panel/center.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/center.txt")) {
echo " checked";
}
echo "> center<br>";
echo "<input type=\"checkbox\" name=\"panel_entry\"";
- if (file_exists("data/panels/$panel/entry.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/entry.txt")) {
echo " checked";
}
echo "> entry<br>";
@@ -522,13 +539,38 @@ a:active {
echo "<input type=\"checkbox\" name=\"panel_del\"> delete </td></tr>";
echo "<tr></td><td><input type=\"text\" class=\"input\" name=\"panel_title\" value=\"";
- readfile("data/panels/$panel/title.txt");
+ readfile("$maj_data_directory/panels/$panel/title.txt");
echo "\" autocomplete=\"off\" maxlength=\"90\" required></td></tr>";
echo "<tr><td><textarea class=\"input\" name=\"panel_content\" rows=\"15\" required>";
- readfile("data/panels/$panel/panel.php");
+ readfile("$maj_data_directory/panels/$panel/panel.php");
echo "</textarea></td></tr>";
+ $links = glob("$maj_data_directory/items/*");
+
+ rsort($links);
+ reset($links);
+
+ if ((count($links) > 0) and ($panel != file_get_contents("$maj_data_directory/header.txt")) and ($panel != file_get_contents("$maj_data_directory/footer.txt"))) {
+
+ echo "<tr></td><td><select class=\"input\" name=\"panel_link\"><option></option>";
+
+ foreach ($links as $link) {
+
+ $link_title = file_get_contents("$link/title.txt");
+ $link_entry = str_replace("$maj_data_directory/items/","",$link);
+
+ if (file_exists("$maj_data_directory/panels/$panel/link.txt") and (file_get_contents("$maj_data_directory/panels/$panel/link.txt") == $link_entry)) {
+
+ echo "<option value=\"$link_entry\" selected>$link_title</option>";
+ }
+ else {
+ echo "<option value=\"$link_entry\">$link_title</option>";
+ }
+ }
+ echo "</select></td></tr>";
+ }
+
echo "<tr><td>";
echo "<input type=\"hidden\" name=\"panel_id\" value=\"$panel\">";
echo "<input type=\"hidden\" name=\"panel_edit\" value=\"on\">";
tree 3bf6bd2b49f6a93add17bbe46f40579bab320d27
parent 69a222cff7c947f620be1ec678a3d93289e4968a
author Engels Antonio <engels@majcms.org> 1321881091 +0800
committer Engels Antonio <engels@majcms.org> 1321881091 +0800
Add panel-entry association
diff --git a/core.php b/core.php
index cc86ff8..235ef43 100644
--- a/core.php
+++ b/core.php
@@ -669,13 +669,66 @@ function maj_download_file($file_name,$file_dir,$count_dir) {
function maj_panels($panel_array) {
global $maj_data_directory;
- global $maj_admin_username;
global $maj_logged_in_username;
+ global $maj_admin_username;
+ global $maj_req_entry;
global $maj_wspace;
if (count($panel_array) > 0) {
foreach ($panel_array as $panel) {
+
+ if (file_exists("$maj_data_directory/panels/$panel/link.txt") and ($maj_logged_in_username != $maj_admin_username)) {
+
+ if (file_get_contents("$maj_data_directory/panels/$panel/link.txt") != $maj_req_entry) {
+ continue;
+ }
+
+ if (file_get_contents("$maj_data_directory/panels/$panel/link.txt") == $maj_req_entry) {
+
+ $today = date("YmdHis",time() + $offset);
+
+ if ($maj_req_entry > $today) {
+ continue;
+ }
+
+ if (file_exists("$maj_data_directory/items/$maj_req_entry/private.txt")) {
+ continue;
+ }
+
+ $pvt_cat = "0";
+
+ if (file_exists("$maj_data_directory/items/$maj_req_entry/categories")) {
+
+ if ($dh_cat = opendir("$maj_data_directory/items/$maj_req_entry/categories")) {
+
+ while (($cat = readdir($dh_cat)) !== false) {
+
+ if ($cat != "." && $cat != "..") {
+
+ if (file_exists("$maj_data_directory/categories/$cat/private.txt")) {
+ $pvt_cat = $pvt_cat + 1;
+ }
+ }
+ }
+ closedir($dh_cat);
+ }
+ }
+
+ if (($pvt_cat > 0) and !file_exists("$maj_data_directory/items/$maj_req_entry/cat.txt")) {
+ continue;
+ }
+
+ if ((file_exists("$maj_data_directory/items/$maj_req_entry/members") and !isset($maj_logged_in_username)) or (isset($maj_logged_in_username) and !file_exists("$maj_data_directory/items/$maj_req_entry/members/$maj_logged_in_username"))) {
+ continue;
+ }
+
+ if (file_exists("$maj_data_directory/items/$maj_req_entry/member.txt") and (!isset($maj_logged_in_username))) {
+ continue;
+ }
+
+ }
+ }
if (!file_exists("$maj_data_directory/panels/$panel/free.txt")) {
diff --git a/index.php b/index.php
index 24e410b..09586d0 100644
--- a/index.php
+++ b/index.php
@@ -1125,7 +1125,7 @@ if ($maj_dh_items = opendir("$maj_data_directory/items")) {
$maj_latest[] = $maj_item;
- if ((file_exists("$maj_data_directory/items/$maj_item/members") and !isset($maj_logged_in_username)) or (file_exists("$maj_data_directory/items/$maj_item/members") and !file_exists("$maj_data_directory/items/$maj_item/members/$maj_logged_in_username"))) {
+ if ((file_exists("$maj_data_directory/items/$maj_item/members") and !isset($maj_logged_in_username)) or (isset($maj_logged_in_username) and !file_exists("$maj_data_directory/items/$maj_item/members/$maj_logged_in_username"))) {
continue;
}
diff --git a/panels.php b/panels.php
index 361b839..b82f432 100644
--- a/panels.php
+++ b/panels.php
@@ -12,293 +12,293 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP
header("Location: login.php");
}
-$login_username = file_get_contents("data/username.txt");
+$login_username = file_get_contents("$maj_data_directory/username.txt");
if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
exit();
}
-if (isset($_POST['new_id']) and !empty($_POST['new_id']) and isset($_POST['new_title']) and !empty($_POST['new_title']) and isset($_POST['new_content']) and !empty($_POST['new_content']) and !file_exists("data/panels/{$_POST['new_id']}")) {
+if (isset($_POST['new_id']) and !empty($_POST['new_id']) and isset($_POST['new_title']) and !empty($_POST['new_title']) and isset($_POST['new_content']) and !empty($_POST['new_content']) and !file_exists("$maj_data_directory/panels/{$_POST['new_id']}")) {
- if (!file_exists("data/panels")) {
- mkdir("data/panels");
+ if (!file_exists("$maj_data_directory/panels")) {
+ mkdir("$maj_data_directory/panels");
}
$new_id = trim(strip_tags(mb_strtolower(str_replace(" ", "_", $_POST['new_id']))));
- if (!file_exists("data/panels/$new_id")) {
- mkdir("data/panels/$new_id");
+ if (!file_exists("$maj_data_directory/panels/$new_id")) {
+ mkdir("$maj_data_directory/panels/$new_id");
}
$new_title = ucfirst(strip_tags(trim($_POST['new_title'])));
- $open_title_file = fopen("data/panels/$new_id/title.txt","w");
+ $open_title_file = fopen("$maj_data_directory/panels/$new_id/title.txt","w");
fwrite($open_title_file,$new_title);
fclose($open_title_file);
$panel_content = ucfirst(trim($_POST['new_content']));
- $new_content_file = fopen("data/panels/$new_id/panel.php","w");
+ $new_content_file = fopen("$maj_data_directory/panels/$new_id/panel.php","w");
fwrite($new_content_file,$panel_content);
fclose($new_content_file);
}
if ((!isset($_POST['panel_hide']) or empty($_POST['panel_hide'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/private.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/private.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/private.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/private.txt");
}
}
if (isset($_POST['panel_hide']) and !empty($_POST['panel_hide']) and ($_POST['panel_hide'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/private.txt")) {
- touch("data/panels/{$_POST['panel_id']}/private.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/private.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/private.txt");
}
}
if ((!isset($_POST['panel_auth']) or empty($_POST['panel_auth'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/auth.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/auth.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/auth.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/auth.txt");
}
}
if (isset($_POST['panel_auth']) and !empty($_POST['panel_auth']) and ($_POST['panel_auth'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/auth.txt")) {
- touch("data/panels/{$_POST['panel_id']}/auth.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/auth.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/auth.txt");
}
}
if ((!isset($_POST['panel_nomargin']) or empty($_POST['panel_nomargin'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/nomargin.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt");
}
}
if (isset($_POST['panel_nomargin']) and !empty($_POST['panel_nomargin']) and ($_POST['panel_nomargin'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
- touch("data/panels/{$_POST['panel_id']}/nomargin.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt");
}
}
if ((!isset($_POST['panel_free']) or empty($_POST['panel_free'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/free.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/free.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/free.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/free.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/nomargin.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/nomargin.txt");
}
}
if (isset($_POST['panel_free']) and !empty($_POST['panel_free']) and ($_POST['panel_free'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/free.txt")) {
- touch("data/panels/{$_POST['panel_id']}/free.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/free.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/free.txt");
}
}
if ((!isset($_POST['panel_right']) or empty($_POST['panel_right'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
}
if (isset($_POST['panel_right']) and !empty($_POST['panel_right']) and ($_POST['panel_right'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- touch("data/panels/{$_POST['panel_id']}/right.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if ((!isset($_POST['panel_center']) or empty($_POST['panel_center'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
}
if (isset($_POST['panel_center']) and !empty($_POST['panel_center']) and ($_POST['panel_center'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- touch("data/panels/{$_POST['panel_id']}/center.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if ((!isset($_POST['panel_top']) or empty($_POST['panel_top'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
}
if (isset($_POST['panel_top']) and !empty($_POST['panel_top']) and ($_POST['panel_top'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- touch("data/panels/{$_POST['panel_id']}/top.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if ((!isset($_POST['panel_entry']) or empty($_POST['panel_entry'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if (isset($_POST['panel_entry']) and !empty($_POST['panel_entry']) and ($_POST['panel_entry'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- touch("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
}
if ((!isset($_POST['panel_bottom']) or empty($_POST['panel_bottom'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
}
if (isset($_POST['panel_bottom']) and !empty($_POST['panel_bottom']) and ($_POST['panel_bottom'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- touch("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (!file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ touch("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
}
if ((!isset($_POST['panel_header']) or empty($_POST['panel_header'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $_POST['panel_id'])) {
- unlink("data/header.txt");
+ if (file_exists("$maj_data_directory/header.txt") and (file_get_contents("$maj_data_directory/header.txt") == $_POST['panel_id'])) {
+ unlink("$maj_data_directory/header.txt");
}
}
if (isset($_POST['panel_header']) and !empty($_POST['panel_header']) and ($_POST['panel_header'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
- $new_header_file = fopen("data/header.txt","w");
+ $new_header_file = fopen("$maj_data_directory/header.txt","w");
fwrite($new_header_file,$_POST['panel_id']);
fclose($new_header_file);
}
if ((!isset($_POST['panel_footer']) or empty($_POST['panel_footer'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $_POST['panel_id'])) {
- unlink("data/footer.txt");
+ if (file_exists("$maj_data_directory/footer.txt") and (file_get_contents("$maj_data_directory/footer.txt") == $_POST['panel_id'])) {
+ unlink("$maj_data_directory/footer.txt");
}
}
if (isset($_POST['panel_footer']) and !empty($_POST['panel_footer']) and ($_POST['panel_footer'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/right.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/top.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/bottom.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/bottom.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/bottom.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/center.txt");
}
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/entry.txt");
}
- $new_footer_file = fopen("data/footer.txt","w");
+ $new_footer_file = fopen("$maj_data_directory/footer.txt","w");
fwrite($new_footer_file,$_POST['panel_id']);
fclose($new_footer_file);
}
@@ -307,8 +307,8 @@ if (isset($_POST['panel_title']) and !empty($_POST['panel_title'])) {
$panel_title = ucfirst(strip_tags(trim($_POST['panel_title'])));
- if ($panel_title != file_get_contents("data/panels/{$_POST['panel_id']}/title.txt")) {
- $edit_title_file = fopen("data/panels/{$_POST['panel_id']}/title.txt","w");
+ if ($panel_title != file_get_contents("$maj_data_directory/panels/{$_POST['panel_id']}/title.txt")) {
+ $edit_title_file = fopen("$maj_data_directory/panels/{$_POST['panel_id']}/title.txt","w");
fwrite($edit_title_file,$panel_title);
fclose($edit_title_file);
}
@@ -318,34 +318,51 @@ if (isset($_POST['panel_content']) and !empty($_POST['panel_content'])) {
$panel_content = ucfirst(trim($_POST['panel_content']));
- if ($panel_content != file_get_contents("data/panels/{$_POST['panel_id']}/panel.php")) {
- $edit_content_file = fopen("data/panels/{$_POST['panel_id']}/panel.php","w");
+ if ($panel_content != file_get_contents("$maj_data_directory/panels/{$_POST['panel_id']}/panel.php")) {
+ $edit_content_file = fopen("$maj_data_directory/panels/{$_POST['panel_id']}/panel.php","w");
fwrite($edit_content_file,$panel_content);
fclose($edit_content_file);
}
}
+if (isset($_POST['panel_link']) and !empty($_POST['panel_link'])) {
+
+ $panel_link = trim($_POST['panel_link']);
+
+ if ($panel_link != file_get_contents("$maj_data_directory/panels/{$_POST['panel_id']}/link.txt")) {
+ $edit_link_file = fopen("$maj_data_directory/panels/{$_POST['panel_id']}/link.txt","w");
+ fwrite($edit_link_file,$panel_link);
+ fclose($edit_link_file);
+ }
+}
+
+if ((!isset($_POST['panel_link']) or empty($_POST['panel_link'])) and ($_POST['panel_edit'] == "on")) {
+ if (file_exists("$maj_data_directory/panels/{$_POST['panel_id']}/link.txt")) {
+ unlink("$maj_data_directory/panels/{$_POST['panel_id']}/link.txt");
+ }
+}
+
if (isset($_POST['move_id']) and !empty($_POST['move_id']) and isset($_POST['old_id']) and !empty($_POST['old_id']) and isset($_POST['panel_edit']) and !empty($_POST['panel_edit']) and ($_POST['panel_edit'] == "on")) {
$move_id = trim(strip_tags(mb_strtolower(str_replace(" ", "_", $_POST['move_id']))));
$move_id = str_replace(",","_",$move_id);
- if (!file_exists("data/panels/$move_id")) {
- rename("data/panels/{$_POST['old_id']}","data/panels/$move_id");
+ if (!file_exists("$maj_data_directory/panels/$move_id")) {
+ rename("$maj_data_directory/panels/{$_POST['old_id']}","$maj_data_directory/panels/$move_id");
}
}
if (isset($_POST['panel_del']) and !empty($_POST['panel_del']) and ($_POST['panel_del'] == "on")) {
- if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $_POST['panel_id'])) {
- unlink("data/header.txt");
+ if (file_exists("$maj_data_directory/header.txt") and (file_get_contents("$maj_data_directory/header.txt") == $_POST['panel_id'])) {
+ unlink("$maj_data_directory/header.txt");
}
- if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $_POST['panel_id'])) {
- unlink("data/footer.txt");
+ if (file_exists("$maj_data_directory/footer.txt") and (file_get_contents("$maj_data_directory/footer.txt") == $_POST['panel_id'])) {
+ unlink("$maj_data_directory/footer.txt");
}
- rmdirr("data/panels/{$_POST['panel_id']}");
+ rmdirr("$maj_data_directory/panels/{$_POST['panel_id']}");
}
?>
@@ -361,8 +378,8 @@ body {
text-align: left;
font-size: 11px;
font-family: <?php
- if (file_exists("data/fonts/body.txt")) {
- $font_body = file_get_contents("data/fonts/body.txt");
+ if (file_exists("$maj_data_directory/fonts/body.txt")) {
+ $font_body = file_get_contents("$maj_data_directory/fonts/body.txt");
echo "{$font_body},";
}
?> arial, helvetica, sans-serif;
@@ -396,8 +413,8 @@ a:active {
border: #999999 solid 1px;
width: 350px;
font-family: <?php
- if (file_exists("data/fonts/input.txt")) {
- $font_input = file_get_contents("data/fonts/input.txt");
+ if (file_exists("$maj_data_directory/fonts/input.txt")) {
+ $font_input = file_get_contents("$maj_data_directory/fonts/input.txt");
echo "{$font_input},";
}
?> arial, helvetica, sans-serif;
@@ -420,8 +437,8 @@ a:active {
</table>
<?php
- if (file_exists("data/panels")) {
- if ($dh_panel = opendir("data/panels")) {
+ if (file_exists("$maj_data_directory/panels")) {
+ if ($dh_panel = opendir("$maj_data_directory/panels")) {
while (($entry_panel = readdir($dh_panel)) !== false) {
if ($entry_panel != "." && $entry_panel != ".." && fnmatch("*", $entry_panel)) {
@@ -454,67 +471,67 @@ a:active {
echo "<td valign=\"top\" rowspan=\"5\">";
echo "<input type=\"checkbox\" name=\"panel_hide\"";
- if (file_exists("data/panels/$panel/private.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/private.txt")) {
echo " checked";
}
echo "> hide<br>";
echo "<input type=\"checkbox\" name=\"panel_auth\"";
- if (file_exists("data/panels/$panel/auth.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/auth.txt")) {
echo " checked";
}
echo "> auth<br>";
echo "<input type=\"checkbox\" name=\"panel_free\"";
- if (file_exists("data/panels/$panel/free.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/free.txt")) {
echo " checked";
}
echo "> free<br>";
echo "<input type=\"checkbox\" name=\"panel_nomargin\"";
- if (file_exists("data/panels/$panel/nomargin.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/nomargin.txt")) {
echo " checked";
}
echo "> nomargin<br>";
echo "<input type=\"checkbox\" name=\"panel_header\"";
- if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $panel)) {
+ if (file_exists("$maj_data_directory/header.txt") and (file_get_contents("$maj_data_directory/header.txt") == $panel)) {
echo " checked";
}
echo "> header<br>";
echo "<input type=\"checkbox\" name=\"panel_footer\"";
- if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $panel)) {
+ if (file_exists("$maj_data_directory/footer.txt") and (file_get_contents("$maj_data_directory/footer.txt") == $panel)) {
echo " checked";
}
echo "> footer<br>";
echo "<input type=\"checkbox\" name=\"panel_right\"";
- if (file_exists("data/panels/$panel/right.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/right.txt")) {
echo " checked";
}
echo "> right<br>";
echo "<input type=\"checkbox\" name=\"panel_top\"";
- if (file_exists("data/panels/$panel/top.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/top.txt")) {
echo " checked";
}
echo "> top<br>";
echo "<input type=\"checkbox\" name=\"panel_bottom\"";
- if (file_exists("data/panels/$panel/bottom.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/bottom.txt")) {
echo " checked";
}
echo "> bottom<br>";
echo "<input type=\"checkbox\" name=\"panel_center\"";
- if (file_exists("data/panels/$panel/center.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/center.txt")) {
echo " checked";
}
echo "> center<br>";
echo "<input type=\"checkbox\" name=\"panel_entry\"";
- if (file_exists("data/panels/$panel/entry.txt")) {
+ if (file_exists("$maj_data_directory/panels/$panel/entry.txt")) {
echo " checked";
}
echo "> entry<br>";
@@ -522,13 +539,38 @@ a:active {
echo "<input type=\"checkbox\" name=\"panel_del\"> delete </td></tr>";
echo "<tr></td><td><input type=\"text\" class=\"input\" name=\"panel_title\" value=\"";
- readfile("data/panels/$panel/title.txt");
+ readfile("$maj_data_directory/panels/$panel/title.txt");
echo "\" autocomplete=\"off\" maxlength=\"90\" required></td></tr>";
echo "<tr><td><textarea class=\"input\" name=\"panel_content\" rows=\"15\" required>";
- readfile("data/panels/$panel/panel.php");
+ readfile("$maj_data_directory/panels/$panel/panel.php");
echo "</textarea></td></tr>";
+ $links = glob("$maj_data_directory/items/*");
+
+ rsort($links);
+ reset($links);
+
+ if ((count($links) > 0) and ($panel != file_get_contents("$maj_data_directory/header.txt")) and ($panel != file_get_contents("$maj_data_directory/footer.txt"))) {
+
+ echo "<tr></td><td><select class=\"input\" name=\"panel_link\"><option></option>";
+
+ foreach ($links as $link) {
+
+ $link_title = file_get_contents("$link/title.txt");
+ $link_entry = str_replace("$maj_data_directory/items/","",$link);
+
+ if (file_exists("$maj_data_directory/panels/$panel/link.txt") and (file_get_contents("$maj_data_directory/panels/$panel/link.txt") == $link_entry)) {
+
+ echo "<option value=\"$link_entry\" selected>$link_title</option>";
+ }
+ else {
+ echo "<option value=\"$link_entry\">$link_title</option>";
+ }
+ }
+ echo "</select></td></tr>";
+ }
+
echo "<tr><td>";
echo "<input type=\"hidden\" name=\"panel_id\" value=\"$panel\">";
echo "<input type=\"hidden\" name=\"panel_edit\" value=\"on\">";