$_SESSION['filter_page'] = isset($_GET['filter_page']) ? urldecode($_GET['filter_page']) : $_SESSION['filter_page']; // Remove the lock status when unloading an editor page $cancel_user_now = isset($_GET['cancel']) ? $_GET['cancel'] == "True" : false; if ($cancel_user_now) { $cid = isset($_GET['cid']) ? $_GET['cid'] : ''; $ccat = isset($_GET['ccat']) ? $_GET['ccat'] : ''; if ($cid != "") { backOver($ccat, $cid); } } //Get the user's rights $user_id_for_rights = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : 0; $_SESSION['user_rights'] = isset($_SESSION['user_rights']) ? $_SESSION['user_rights'] : getUserRights($user_id_for_rights); //Show the coords converter if needed $_SESSION['show_converter'] = isset($_GET['c']) ? true : (isset($_SESSION['show_converter']) ? $_SESSION['show_converter'] : false); define("USER_IS_CONNECTED", userIsConnected(), true); $FAQPages = array("Fr" => array("home" => 13), "En" => array("home" => 14), "Es" => array("home" => 19)); define("LEADER_GROUP_ID", 5, true); define("ENTRY_COUNT_MAX", 3000, true); define("Max_detail_level", 1000, true); define("Select_default", "00", true); define("start_comment", "<!--", true); define("end_comment", "-->", true); define("Contact_for_nobody", "0", true); define("Contact_for_registered", "1", true); define("Contact_for_everybody", "2", true); define("Google_key", "ABQIAAAABppewhix0m2aGtrxzFsM1hTUoYxFMVJ0pZ8eIP2qT6O2FCqTDBSrYiCqarW5lo9hEXEt4pCtZ6bVVA", true); //GMaps API Key for grottocenter.org //define ("Google_key", "ABQIAAAA_X2bDeJ9Hz-baUkItUM1WRQODwNLvymVen2-L56iEshlhUPpFBShcyTJURuPJ0Mx3AIa8-nTBRJBXg", true); //GMaps API Key for localhost define("Geoportal_key", "2228631060319443257", true); //Geoportal API Key for grottocenter.org
function getWhereClause($POST_vars, $category = "", $sql = "") { //Take into account the filter $where_clause = ""; $where_value_flag = false; if (isset($POST_vars['submit_filter']) || isset($POST_vars['order']) || isset($POST_vars['current']) || isset($POST_vars['overview_filter']) || isset($POST_vars['records_by_page'])) { foreach ($POST_vars as $key => $value) { if (!is_array($value)) { $value = trim($value); } $buttons = array("submit_filter", "reset_filter", "reset", "overview_filter", "current", "order", "by", "records_by_page", "PHPSESSID"); if (!in_array($key, $buttons) && ($value != Select_default || $value === "0") && $value != "") { $key = idDecode($key); if (strpos($key, "|") !== false) { $key_array = explode("|", $key); $operator = $key_array[0]; $key = $key_array[1]; $value = $value + 0.0; $last_operator = ""; } else { if (is_array($value)) { $myValue = ""; $array_for_walk = $value; array_walk($array_for_walk, 'set_quotes', "'"); $myValue = implode(",", $array_for_walk); $value = $myValue; $operator = "in ("; $last_operator = ")"; } else { $value = str_replace("*", "%", $value); $operator = "like '"; $last_operator = "%'"; } } $where_clause .= str_replace("@", " ", str_replace("*", ".", $key)) . " " . $operator . $value . $last_operator . " AND "; } } $where_value_flag = true; } /*if (!$where_value_flag) { $where_clause .= "1 = 0 AND "; }*/ if (!userIsConnected()) { if (strpos($sql, "T_entry.") !== false || strpos($sql, ".`T_entry`") !== false) { if (strpos($sql, "T_entry.Is_public = 'YES'") === false) { $where_clause .= "(T_entry.Is_public IS NULL OR T_entry.Is_public = 'YES') AND "; } } } if ($category != "") { if (isset($_SESSION[$category . '_load_conditions']) && $_SESSION[$category . '_load_conditions'] != "") { $where_clause .= $_SESSION[$category . '_load_conditions'] . " AND "; } } if ($where_clause != "") { $where_clause = substr($where_clause, 0, strlen($where_clause) - 5); } return $where_clause; }