} if (substr($snippet, -2, 2) == '?>') { $snippet = substr($snippet, 0, -2); } } $properties = $modx->db->escape($_POST['properties']); $moduleguid = $modx->db->escape($_POST['moduleguid']); $sysevents = $_POST['sysevents']; //Kyle Jaebker - added category support if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { $categoryid = intval($_POST['categoryid']); } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { $categoryid = 0; } else { include_once MODX_MANAGER_PATH . 'includes/categories.inc.php'; $categoryid = checkCategory($_POST['newcategory']); if (!$categoryid) { $categoryid = newCategory($_POST['newcategory']); } } if ($name == "") { $name = "Untitled snippet"; } switch ($_POST['mode']) { case '23': // Save new snippet // invoke OnBeforeSnipFormSave event $modx->invokeEvent("OnBeforeSnipFormSave", array("mode" => "new", "id" => $id)); // disallow duplicate names for new snippets $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_snippets'), "name='{$name}'"); $count = $modx->db->getValue($rs);
include_once "header.inc.php"; $modx->webAlert($_lang["mgrlog_dateinvalid"], $url); include_once "footer.inc.php"; exit; } elseif ($unpub_date < $currentdate) { $published = 0; } } //Kyle Jaebker - added category support if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { $category = $modx->db->escape($_POST['categoryid']); } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { $category = 0; } else { include_once $modx->config['core_path'] . 'categories.inc.php'; $catCheck = checkCategory($modx->db->escape($_POST['newcategory'])); if ($catCheck) { $category = $catCheck; } else { $category = newCategory($_POST['newcategory']); } } switch ($_POST['mode']) { case '77': // invoke OnBeforeChunkFormSave event $modx->invokeEvent('OnBeforeChunkFormSave', array('mode' => 'new', 'id' => '')); // disallow duplicate names for new chunks $rs = $modx->db->select('COUNT(id)', '[+prefix+]site_htmlsnippets', "name='{$name}'"); $count = $modx->db->getValue($rs); if ($count > 0) { $url = "index.php?a=77";
<?php include "functions.php"; $main = $_POST["mainName"]; $check = checkCategory($main); if ($check) { $response = array("prompt" => 1); } else { $ids = addCostCategory($main); $id = $ids["id"]; addCostItems($id, $main); $response = array("prompt" => 0); } echo jsonify($response);
<?php chdir("../../database"); require_once "store_backoffice.php"; if (isset($_GET["storeId"]) and isset($_GET["category"]) and strlen($_GET["category"]) > 0) { $checkExists = checkCategory($_GET["category"], $_GET["storeId"]); if (!isset($checkExists[0]["id"])) { addCategory($_GET["category"], $_GET["storeId"], null); echo json_encode(array("result" => "ok")); } else { echo json_encode(array("result" => "category name in use")); } } else { echo json_encode(array("result" => "missingParams")); }
<?php chdir("../../database"); require_once "store_backoffice.php"; if (isset($_GET["storeId"]) and isset($_GET["name"]) and strlen($_GET["name"]) > 0 and isset($_GET["productId"]) and strlen($_GET["productId"]) > 0 and isset($_GET["description"]) and strlen($_GET["description"]) > 0 and isset($_GET["cost"]) and strlen($_GET["cost"]) > 0 and isset($_GET["category"]) and strlen($_GET["category"]) > 0 and isset($_GET["stock"]) and strlen($_GET["stock"]) > 0) { $categoryId = checkCategory($_GET["category"], $_GET["storeId"]); $categoryId = $categoryId[0]["id"]; if (isset($categoryId)) { updateProduct($_GET["productId"], $_GET["name"], $_GET["description"], $_GET["cost"], $_GET["stock"], $categoryId); if (isset($_GET['image']) and strlen($_GET['image']) > 0) { $imageId = addProductImage($_GET['image']); updateProductImage($_GET["productId"], $imageId); } echo json_encode(array("result" => "ok")); } else { echo json_encode(array("result" => "category doest exists")); } } else { echo json_encode(array("result" => "missingParams")); }