} } $marks = array(); foreach ($fields as $fieldName) { if ($fieldName === "clientTime") { $marks[] = "FROM_UNIXTIME(?)"; } else { $marks[] = "?"; } } $query = "INSERT INTO `" . strtolower($tableName) . "` (`" . implode("` , `", $fields) . "`) VALUES (" . implode(", ", $marks) . ")"; $stmt = $db->prepare($query); return array("stmt" => $stmt, "fields" => $fields); } $db = connect(); $queries = array("selectQuestion" => prepareQuery($db, "tracking_selectQuestion"), "answer" => prepareQuery($db, "tracking_answer"), "checkbox" => prepareQuery($db, "tracking_checkbox"), "textinput" => prepareQuery($db, "tracking_textinput"), "clickitem" => prepareQuery($db, "tracking_clickitem"), "nonSavedAnswer" => prepareQuery($db, "tracking_nonSavedAnswer")); $query = "SELECT * FROM `tracking_rawdata` where extracted = 0 LIMIT 0, 200"; $stmt = $db->prepare($query); $stmt->execute(array()); $nbRecords = 0; $nbValid = 0; $nbErrors = 0; $nbQueries = 0; $queryUpdate = "UPDATE `tracking_rawdata` set `extracted` = 1 WHERE ID = ?"; $stmtUpdate = $db->prepare($queryUpdate); while ($row = $stmt->fetchObject()) { $data = json_decode($row->data); if (is_array($data)) { foreach ($data as $record) { if (isset($record->clientTime) && isset($record->dataType)) { $record->rawdataID = $row->ID;
} // 0 1 2 3 4 5 6 7 $squery = "select distinct rec_ID, rec_URL, rec_Title, rec_ScratchPad, rec_RecTypeID, rec_Modified, rec_Added, " . "b.dtl_Value, c.dtl_Value "; $joinTable = " left join recDetails b on (b.dtl_RecID=rec_ID and b.dtl_DetailTypeID=" . (defined('DT_SHORT_SUMMARY') ? DT_SHORT_SUMMARY : "0") . ") left join recDetails c on (c.dtl_RecID=rec_ID and c.dtl_DetailTypeID=" . (defined('DT_CREATOR') ? DT_CREATOR : "0") . ") "; if (array_key_exists('w', $_REQUEST) && ($_REQUEST['w'] == 'B' || $_REQUEST['w'] == 'bookmark')) { $search_type = BOOKMARK; } else { $search_type = BOTH; } // all records $limit = intval(@$_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']["display-preferences"]['report-output-limit']); if (!$limit || $limit < 1) { $limit = 1000; //default limit in dispPreferences } $squery = prepareQuery($squery, $search_type, $joinTable, "", $limit); /*****DEBUG****/ //error_log("1.>>>>".$squery); $res = mysql_query($squery); $reccount = mysql_num_rows($res); $uniq_id = 1; if ($reccount > 0) { while ($row = mysql_fetch_row($res)) { //find rectitle for creator if ($row[8]) { $creator = mysql__select_array("Records", "rec_Title", "rec_ID=" . $row[8]); $creator = count($creator) > 0 ? $creator[0] : null; } else { $creator = null; } // grab the user tags, as a single comma-delimited string
function get_item_from_eventsinformation() { $query = 'SELECT * FROM eventInformation ORDER BY id'; $result = prepareQuery($query); return $result; }
} else { if (array_key_exists('w', $_REQUEST) && ($_REQUEST['w'] == 'B' || $_REQUEST['w'] == 'bookmark')) { $search_type = BOOKMARK; } else { $search_type = BOTH; } // all records $limit = intval(@$_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']["display-preferences"]['smarty-output-limit']); if (!$limit || $limit < 1) { $limit = 1000; //default limit in dispPreferences } $limit = PHP_INT_MAX; $squery = prepareQuery(null, $squery, $search_type, $detTable, $ourwhere, null, $limit); if ($isSearchKml) { $squery2 = prepareQuery(null, $squery2, $search_type, $detTable2, $ourwhere2, null, $limit); } } } else { $squery = $squery . " from Records " . $detTable . " where rec_ID=" . $_REQUEST["id"] . $ourwhere; $squery2 = $squery2 . " from Records " . $detTable2 . " where rec_ID=" . $_REQUEST["id"] . $ourwhere2; } $wkt_reccount = 0; $kml_reccount = 0; if ($squery) { $res = mysql_query($squery); if ($res === false) { print '</Document></kml>'; return; } $wkt_reccount = mysql_num_rows($res);
print "<p class='error'>Failed to obtain structure for record type: " . $rt . "</p>"; continue; } else { while ($row = $res->fetch_row()) { //$row = $res->fetch_assoc()) { if (in_array($row[3], $unsupported)) { continue; } $dettypes[$row[0]] = array(); $recstruc[$row[0]] = $row; //keep detail defs } } $params["q"] = "t:" . $rt; //get all records for specified recordtype $query = prepareQuery($params, $squery, BOTH, $detTable, $ourwhere, $order); $filename; $res = $mysqli->query($query); if (!$res) { //die('Failed to obtain data for record type: '.$rt); print "<p class='error'>Failed to obtain data for record type: " . $rt . "</p>"; continue; } else { $recid = null; $records = array(); $details = $dettypes; $hasdetails = false; //loop for records/details while ($row = $res->fetch_row()) { //$row = $res->fetch_assoc()) { if ($recid != $row[0]) {
$reclist = explode(",", $reclist['recIDs']); } else { $h4way = false; if (array_key_exists('w', $_REQUEST) && ($_REQUEST['w'] == 'B' || $_REQUEST['w'] == 'bookmark')) { $search_type = BOOKMARK; } else { $search_type = BOTH; } // all records $limit = intval(@$_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']["display-preferences"]['smarty-output-limit']); if (!$limit || $limit < 1) { $limit = 1000; //default limit in dispPreferences } $limit = PHP_INT_MAX; $squery_res = prepareQuery(null, $squery, $search_type, $joinTable, "", null, $limit); $reclist = mysql_query($squery_res); $reccount = mysql_num_rows($reclist); } $uniq_id = 1; $idx = 0; if ($reccount > 0) { while ($h4way && $idx < $reccount || !$h4way && ($row = mysql_fetch_row($reclist))) { if ($h4way) { $recID = $reclist[$idx]; $idx++; $squery_res = $squery . " from Records " . $joinTable . " where rec_ID=" . $recID; $res = mysql_query($squery_res); if ($res) { $row = mysql_fetch_row($res); if (!$row) {
function deleteExpiredSessions($link, $maxLifeTime) { $stmt = prepareQuery($link, 'DELETE FROM sessions WHERE touch_time + ? < ?'); if (!$stmt) { return false; } $time = time(); if (!mysqli_stmt_bind_param($stmt, 'ii', $maxLifeTime, $time)) { logMysqlStmtError(CANNOT_BIND_SQL_PARAMS, $stmt); $result = false; } else { $result = executeStatement($stmt); } mysqli_stmt_close($stmt); return $result; }