From a38aada36fce839bb6b6dc4c1f0c445928bbbffa Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 17 Feb 2020 08:22:39 -0700 Subject: [PATCH] Apps: Remove deprecated edit and delete scripts. --- core/apps/apps_delete.php | 101 ----------------- core/apps/apps_edit.php | 221 -------------------------------------- 2 files changed, 322 deletions(-) delete mode 100644 core/apps/apps_delete.php delete mode 100644 core/apps/apps_edit.php diff --git a/core/apps/apps_delete.php b/core/apps/apps_delete.php deleted file mode 100644 index fe5eb38a0e..0000000000 --- a/core/apps/apps_delete.php +++ /dev/null @@ -1,101 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (if_group("superadmin")) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//get the id - if (is_uuid($_GET["id"])) { - - $app_uuid = $_GET["id"]; - - //get the list of installed apps from the core and mod directories - $config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php"); - $x=0; - foreach ($config_list as $config_path) { - include($config_path); - $x++; - } - //find the app using the $app_uuid - foreach ($apps as &$row) { - if ($row["uuid"] == $app_uuid) { - $name = $row['name']; - if ($row["uuid"] == $app_uuid && $row['category'] != "Core") { - //delete the app from the menu - foreach ($row['menu'] as $index => &$menu) { - //delete menu groups and permissions from the database - $array['menu_item_groups'][$index]['menu_item_uuid'] = $menu['uuid']; - $array['menu_items'][$index]['menu_item_uuid'] = $menu['uuid']; - //delete the app from the file system - if (strlen($menu['path']) > 0) { - system('rm -rf '.dirname($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.$menu['path'])); - } - } - if (is_array($array) && sizeof($array) != 0) { - $database = new database; - $database->app_name = 'apps'; - $database->app_uuid = 'd8704214-75a0-e52f-1336-f0780e29fef8'; - $database->delete($array); - unset($array); - } - - //delete the group permissions for the app - foreach ($row['permissions'] as $index => &$permission) { - $array['group_permissions'][$index]['permission_name'] = $permission['name']; - } - if (is_array($array) && sizeof($array) != 0) { - $database = new database; - $database->app_name = 'apps'; - $database->app_uuid = 'd8704214-75a0-e52f-1336-f0780e29fef8'; - $database->delete($array); - unset($array); - } - } - } - } - - //set message - message::add($text['message-delete']); - - } - - -//redirect the browser - header("Location: apps.php"); - return; - -?> diff --git a/core/apps/apps_edit.php b/core/apps/apps_edit.php deleted file mode 100644 index d1f9b9a4c7..0000000000 --- a/core/apps/apps_edit.php +++ /dev/null @@ -1,221 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (if_group("superadmin")) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//action add or update - if (is_uuid($_REQUEST["id"])) { - $action = "update"; - $app_uuid = $_REQUEST["id"]; - } - else { - $action = "add"; - } - -//get http post variables and set them to php variables - if (count($_POST)>0) { - $app_enabled = $_POST["app_enabled"]; - } - -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - - $msg = ''; - if ($action == "update") { - $app_uuid = $_POST["app_uuid"]; - } - - //validate the token - $token = new token; - if (!$token->validate($_SERVER['PHP_SELF'])) { - message::add($text['message-invalid_token'],'negative'); - header('Location: apps.php'); - exit; - } - - //check for all required data - //if (strlen($app_enabled) == 0) { $msg .= "Please provide: Enabled
\n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { - require_once "resources/header.php"; - require_once "resources/persist_form_var.php"; - echo "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } - - //add or update the database - if ($_POST["persistformvar"] != "true") { - if ($action == "add") { - $array['apps'][0]['app_uuid'] = uuid(); - message::add($text['message-add']); - } - - if ($action == "update") { - $array['apps'][0]['app_uuid'] = $app_uuid; - message::add($text['message-update']); - } - - if (is_array($array) && sizeof($array) != 0) { - $database = new database; - $database->app_name = 'apps'; - $database->app_uuid = 'd8704214-75a0-e52f-1336-f0780e29fef8'; - $database->save($array); - unset($array); - } - - header("Location: apps.php"); - exit; - } -} - -//pre-populate the form - if (count($_GET)>0 && $_POST["persistformvar"] != "true") { - $app_uuid = $_GET["id"]; - //get the list of installed apps from the core and mod directories - $config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php"); - $x=0; - foreach ($config_list as $config_path) { - include($config_path); - $x++; - } - foreach ($apps as &$row) { - if ($row["uuid"] == $app_uuid) { - $name = $row['name']; - $category = $row['category']; - $subcategory = $row['subcategory']; - $version = $row['version']; - $description = $row['description']['en-us']; - } - } - } - -//create token - $object = new token; - $token = $object->create($_SERVER['PHP_SELF']); - -//show the header - require_once "resources/header.php"; - if ($action == "update") { - $document['title'] = $text['title-app-edit']; - } - if ($action == "add") { - $document['title'] = $text['title-app-add']; - } - -//show the content - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo " \n"; - echo " \n"; - echo " \n"; - echo " "; - - echo " \n"; - echo " \n"; - echo " \n"; - echo " "; - - echo " \n"; - echo " \n"; - echo " \n"; - echo " "; - - echo " \n"; - echo " \n"; - echo " \n"; - echo " "; - - echo " \n"; - echo " \n"; - echo " \n"; - echo " "; - - echo " \n"; - echo " \n"; - echo " "; - echo "
".$text['header-app-edit'].""; - echo " "; - echo " \n"; - echo "
\n"; - echo $text['description-app-edit']."

\n"; - echo "
\n"; - echo " ".$text['label-name']."\n"; - echo " \n"; - echo " $name  \n"; - echo "
\n"; - echo " ".$text['label-category']."\n"; - echo " \n"; - echo " $category  \n"; - echo "
\n"; - echo " ".$text['label-subcategory']."\n"; - echo " \n"; - echo " $subcategory  \n"; - echo "
\n"; - echo " ".$text['label-version']."\n"; - echo " \n"; - echo " $version  \n"; - echo "
\n"; - echo " ".$text['label-description']."\n"; - echo " \n"; - echo " $description  \n"; - echo "
\n"; - if ($action == "update") { - echo " \n"; - } - echo " \n"; - echo "
"; - echo " \n"; - echo "
"; - echo "

"; - echo "
"; - -//include the footer - require_once "resources/footer.php"; -?> \ No newline at end of file