/*$config = getConfig('../..'); $jsDir = $config[0]['js_directory']; $jsExt = $config[0]['js_extension'];*/ $settingsdb = $settingsdb->select(array()); $jsDir = $settingsdb[0]['js_directory']; $jsExt = $settingsdb[0]['js_extension']; $compDir = $settingsdb[0]['component_directory']; $compExt = $settingsdb[0]['component_extension']; $errors = array(); $data = array(); if ($catName !== $thisCat) { $errors['different'] = 'You did not spell <span class="u_textUnderline">' . $thisCat . ' </span>correctly.'; } if ($_POST['catName'] == "") { $errors['name'] = 'Input is required.'; } if (!empty($errors)) { $data['success'] = false; $data['errors'] = $errors; } else { deleteCatJsFile($jsDir, $jsExt, $compDir, $thisCat); deleteCompDir($catName); deleteScssDir($catName); deleteCatStylesImportString($catName); deleteDbRowByVal($compdb, $key, $catName); deleteDbRowByVal($catdb, $key, $catName); $data['success'] = true; $data['message'] = 'Success!'; } echo json_encode($data);
<?php require '../temp-functions/functions.php'; global $compdb; require "../fllat.php"; $compdb = new Fllat("components", "../../atomic-db"); $key = "component"; $catName = $_POST["catName"]; $compName = $_POST["compName"]; $hasJs = $_POST["hasJs"]; $errors = array(); $data = array(); if (!empty($errors)) { $data['success'] = false; $data['errors'] = $errors; } else { deleteDbRowByVal($compdb, $key, $compName); deleteCompFile($catName, $compName); deleteStyleFile($catName, $compName); deleteScssImportString($catName, $compName); if ($hasJs == "true") { deleteJsFile($compName); } $data['success'] = true; $data['message'] = 'Success!'; } echo json_encode($data);