$sql .= " SET "; //$sql .= "`Min_depth` = ".returnDefault($cave_min_depth, 'float').", "; //$sql .= "`Max_depth` = ".returnDefault($cave_max_depth, 'float').", "; $sql .= "`Depth` = " . returnDefault($cave_depth, 'float') . ", "; $sql .= "`Length` = " . returnDefault($cave_length, 'float') . ", "; $sql .= "`Temperature` = " . returnDefault($cave_temperature, 'float') . ", "; $sql .= "`Is_diving` = " . returnDefault($cave_diving, 'checkbox') . " "; $sql .= "WHERE `Id` = " . $onid; } $req = execSQL($sql, $frame, __FILE__, __FUNCTION__); $save_failed = false; $type = "menu"; } else { if (isset($_GET['id'])) { $id = isset($_GET['id']) ? $_GET['id'] : ''; if (takeOver("entry", $id) && $id != "") { $sql = "SELECT ey.*, ce.Id_cave, mc.Id_massif FROM `" . $_SESSION['Application_host'] . "`.`T_entry` ey "; $sql .= "LEFT OUTER JOIN `" . $_SESSION['Application_host'] . "`.`J_cave_entry` ce ON ey.Id = ce.Id_entry "; $sql .= "LEFT OUTER JOIN `" . $_SESSION['Application_host'] . "`.`J_massif_cave` mc ON ey.Id = mc.Id_entry "; $sql .= "WHERE ey.Id = " . $id; $data = getDataFromSQL($sql, __FILE__, $frame, __FUNCTION__); if ($data['Count'] > 0) { $name = $data[0]['Name']; $country = $data[0]['Country']; $region = $data[0]['Region']; $city = $data[0]['City']; $birth = $data[0]['Year_discovery']; $cave_type = $data[0]['Id_type']; $isPublic = $data[0]['Is_public']; $isSensitive = $data[0]['Is_sensitive']; $contact = $data[0]['Contact'];
} $arrList = explode("|", $list); $sql = "INSERT INTO `" . $_SESSION['Application_host'] . "`.`J_massif_cave` (`Id_massif`, `Id_cave`, `Id_entry`) VALUES "; foreach ($arrList as $value) { $linked_id = explode($regForCat, $value); $sql .= "(" . $onid . ", " . $linked_id[0] . ", " . $linked_id[1] . "), "; } $sql = substr($sql, 0, strlen($sql) - 2); $req = execSQL($sql, $frame, __FILE__, __FUNCTION__); } $save_failed = false; $type = "menu"; } else { if (isset($_GET['id'])) { $id = isset($_GET['id']) ? $_GET['id'] : ''; if (takeOver("massif", $id) && $id != "") { $sql = "SELECT * FROM `" . $_SESSION['Application_host'] . "`.`T_massif` "; $sql .= "WHERE Id = " . $id; $data = getDataFromSQL($sql, __FILE__, $frame, __FUNCTION__); if ($data['Count'] > 0) { $name = $data[0]['Name']; $isNew = "False"; // $massif_id = $id; } $parameters = "&cancel=True&cid=" . $id . "&ccat=massif"; } else { $locked = true; $type = "menu"; } } else { $isNew = "True";
} } else { $isNew = "True"; if (isset($_GET['nlat']) && isset($_GET['nlng'])) { $latitude = isset($_GET['nlat']) ? $_GET['nlat'] : ''; $longitude = isset($_GET['nlng']) ? $_GET['nlng'] : ''; $showMe = "True"; } else { $showMe = "False"; } } } } if ($type == "logo") { $id = isset($_GET['id']) ? $_GET['id'] : ''; if (takeOver("grotto", $id) && $id != "") { if (isset($_GET['logo_changed']) && $_GET['logo_changed'] == "true") { $logo_file = isset($_GET['logo_name']) ? $_GET['logo_name'] : ''; $logo_file = urldecode($logo_file); $sql = "UPDATE `" . $_SESSION['Application_host'] . "`.`T_grotto` SET "; $sql .= "Picture_file_name = " . returnDefault($logo_file, 'text') . ", "; $sql .= "Id_reviewer = " . $_SESSION['user_id'] . ", "; $sql .= "Date_reviewed = Now() "; $sql .= "WHERE Id = " . $id; $req = execSQL($sql, $frame, __FILE__, __FUNCTION__); } $sql = "SELECT Name, Picture_file_name FROM `" . $_SESSION['Application_host'] . "`.`T_grotto` WHERE Id = " . $id; $result = getDataFromSQL($sql, __FILE__, $frame, __FUNCTION__); $logo_file = $result[0]['Picture_file_name']; $grotto_name = $result[0]['Name']; $parameters = "&cancel=True&cid=" . $id . "&ccat=grotto";
// Lock / Unlock the content if ($status == "true") { takeOver($lcat, $lid); } else { backOver($lcat, $lid); } $type = ""; } } if ($type == "delete") { $contributionDeleted = false; // Get the parameters $did = isset($_GET['did']) ? $_GET['did'] : ''; $dcat = isset($_GET['dcat']) ? $_GET['dcat'] : ''; if ($dcat == "location" && allowAccess(location_delete_all) || $dcat == "description" && allowAccess(description_delete_all) || $dcat == "rigging" && allowAccess(rigging_delete_all) || $dcat == "history" && allowAccess(history_delete_all) || $dcat == "bibliography" && allowAccess(biblio_delete_all) || $dcat == "comment" && allowAccess(comment_delete_all)) { if (takeOver($dcat, $did) && $did != "") { //Tracker trackAction("delete_" . $dcat, $did, "T_" . $dcat); // Delete the content $sql = "DELETE FROM `" . $_SESSION['Application_host'] . "`.`T_" . $dcat . "` "; $sql .= "WHERE `Id` = " . $did; $req = execSQL($sql, $frame, __FILE__, __FUNCTION__); if ($dcat == "description" || $dcat == "rigging") { $sql = "DELETE FROM `" . $_SESSION['Application_host'] . "`.`J_entry_" . $dcat . "` "; $sql .= "WHERE `Id_" . $dcat . "` = " . $did; $req = execSQL($sql, $frame, __FILE__, __FUNCTION__); } //Update the entry contribution flag $sql = "UPDATE `" . $_SESSION['Application_host'] . "`.`T_entry` "; $sql .= "SET Has_contributions = IF((SELECT COUNT(*) FROM `" . $_SESSION['Application_host'] . "`.`V_contributions` WHERE Id_entry = " . $id . ") = 0, 'NO', 'YES') "; $sql .= "WHERE Id = " . $id;
if ($id != "") { $sql = "SELECT ca.Nickname, req.Name, req.Id_recipient, req.Id_status, st.Name AS Status_name, lbl." . $_SESSION['language'] . " AS Status_label, "; $sql .= "req.Id_author, req.Comments, topo.Is_public, topo.Remove_north, topo.Remove_scale, topo.Distort_topo, topo.Id AS Id_topography "; $sql .= "FROM `" . $_SESSION['Application_host'] . "`.`T_request` req "; $sql .= "INNER JOIN `" . $_SESSION['Application_host'] . "`.`T_topography` topo ON req.Id = topo.Id_request "; $sql .= "INNER JOIN `" . $_SESSION['Application_host'] . "`.`T_caver` ca ON req.Id_author = ca.Id "; $sql .= "INNER JOIN `" . $_SESSION['Application_host'] . "`.`T_status` st ON st.Id = req.Id_status "; $sql .= "INNER JOIN `" . $_SESSION['Application_host'] . "`.`T_label` lbl ON lbl.Id = st.Id_label "; $sql .= "WHERE req.Id = " . $id; $data = getDataFromSQL($sql, __FILE__, $frame, __FUNCTION__); } $taken = false; if ($data[0]['Status_name'] == 'approved') { $taken = true; } else { $taken = takeOver("request", $id); } if ($taken) { if ($data['Count'] > 0) { $name = $data[0]['Name']; $recipient = $data[0]['Id_recipient']; $status_id = $data[0]['Id_status']; $status_name = $data[0]['Status_name']; $status = $data[0]['Status_name']; $diag_status = $data[0]['Status_name']; $status_lbl = $data[0]['Status_label']; $applicant_lbl = $data[0]['Nickname']; $comments = $data[0]['Comments']; $is_public = $data[0]['Is_public']; $remove_north = $data[0]['Remove_north']; $remove_scale = $data[0]['Remove_scale'];
if ($list != "") { $arrList = split('[|]+', $list); //Establish the relationship between entries and this url $sql = "INSERT INTO `" . $_SESSION['Application_host'] . "`.`J_entry_url` (`Id_url`, `Id_entry`) VALUES "; foreach ($arrList as $value) { $sql .= "(" . $onid . ", " . $value . "), "; } $sql = substr($sql, 0, strlen($sql) - 2); $req = execSQL($sql, $frame, __FILE__, __FUNCTION__); } $save_failed = false; $type = "menu"; } else { if (isset($_GET['id'])) { $id = isset($_GET['id']) ? $_GET['id'] : ''; if (takeOver("url", $id) && $id != "") { $sql = "SELECT * FROM `" . $_SESSION['Application_host'] . "`.`T_url` "; $sql .= "WHERE Id = " . $id; $data = getDataFromSQL($sql, __FILE__, $frame, __FUNCTION__); if ($data['Count'] > 0) { $name = $data[0]['Name']; $link = $data[0]['Url']; $comments = $data[0]['Comments']; $isNew = "False"; } $parameters = "&cancel=True&cid=" . $id . "&ccat=url"; } else { $locked = true; $type = "menu"; } } else {
$req = execSQL($sql, $frame, __FILE__, __FUNCTION__); $massif_id = $req['mysql_insert_id']; trackAction("insert_massif", $massif_id, "T_massif"); } $sql = "INSERT INTO `" . $_SESSION['Application_host'] . "`.`J_massif_cave` (`Id_massif`, `Id_cave`, `Id_entry`) VALUES ("; $sql .= returnDefault($massif_id, 'text') . ", "; $sql .= returnDefault($onid, 'text') . ", "; $sql .= "0) "; $req = execSQL($sql, $frame, __FILE__, __FUNCTION__); } $save_failed = false; $type = "menu"; } else { if (isset($_GET['id'])) { $id = isset($_GET['id']) ? $_GET['id'] : ''; if (takeOver("cave", $id) && $id != "") { $sql = "SELECT ca.*, mc.Id_massif FROM `" . $_SESSION['Application_host'] . "`.`T_cave` ca "; $sql .= "LEFT OUTER JOIN `" . $_SESSION['Application_host'] . "`.`J_massif_cave` mc ON ca.Id = mc.Id_cave "; $sql .= "WHERE ca.Id = " . $id; $data = getDataFromSQL($sql, __FILE__, $frame, __FUNCTION__); if ($data['Count'] > 0) { $name = $data[0]['Name']; //$min_depth = $data[0]['Min_depth']; //$max_depth = $data[0]['Max_depth']; $depth = $data[0]['Depth']; $length = $data[0]['Length']; $diving = $data[0]['Is_diving']; $temperature = $data[0]['Temperature']; $massif_id = $data[0]['Id_massif']; if ($data[0]['Id_massif'] == "") { $isMassifed = "NO";