Esempio n. 1
0
/**
* create or update records
*
* @param mixed $mysqli
* @param mixed $imp_session
* @param mixed $params
*/
function doImport($mysqli, $imp_session, $params, $mode_output)
{
    global $rep_processed, $rep_added, $rep_updated, $rep_skipped, $rep_permission, $wg_id, $rec_visibility;
    $addRecDefaults = getDefaultOwnerAndibility(null);
    $wg_id = $addRecDefaults[1];
    $rec_visibility = $addRecDefaults[2];
    //rectype to import
    $import_table = $imp_session['import_table'];
    $recordType = @$params['sa_rectype'];
    $currentSeqIndex = @$params['seq_index'];
    $use_sequence = false;
    if ($currentSeqIndex >= 0 && @$imp_session['sequence'] && is_array(@$imp_session['sequence'][$currentSeqIndex])) {
        $use_sequence = true;
    }
    $id_field = @$params['recid_field'];
    //record ID field is always defined explicitly
    $id_field_not_defined = $id_field == null || $id_field == '';
    if ($id_field && @$imp_session['indexes_keyfields'][$id_field]) {
        //indexes_keyfields not used anymore in new method
        $is_mulivalue_index = true;
    } else {
        $is_mulivalue_index = false;
        //so we always have FALSE
    }
    if (intval($recordType) < 1) {
        return "record type not defined";
    }
    $field_types = array();
    // idx => fieldtype ID
    $sel_query = array();
    $mapping = array();
    //get field mapping and selection query from _REQUEST(params)
    if (@$params['mapping']) {
        //new way
        $mapping = @$params['mapping'];
        // idx => fieldtype ID
        if (is_array($mapping) && count($mapping) > 0) {
            foreach ($mapping as $index => $field_type) {
                $field_name = "field_" . $index;
                array_push($field_types, $field_type);
                array_push($sel_query, $field_name);
            }
        } else {
            return 'Mapping is not defined';
        }
    } else {
        foreach ($params as $key => $field_type) {
            if (strpos($key, "sa_dt_") === 0 && $field_type) {
                //search for values of field selector
                //get index
                $index = substr($key, 6);
                $field_name = "field_" . $index;
                //all mapped fields - they will be used in validation query
                array_push($sel_query, $field_name);
                array_push($field_types, $field_type);
                $mapping[$index] = $field_type;
            }
        }
        if (count($sel_query) < 1) {
            return "mapping not defined";
        }
    }
    //indexes
    $recStruc = getRectypeStructures(array($recordType));
    $recTypeName = $recStruc[$recordType]['commonFields'][$recStruc['commonNamesToIndex']['rty_Name']];
    $idx_name = $recStruc['dtFieldNamesToIndex']['rst_DisplayName'];
    $idx_fieldtype = $recStruc['dtFieldNamesToIndex']['dty_Type'];
    $idx_term_tree = $recStruc['dtFieldNamesToIndex']['rst_FilteredJsonTermIDTree'];
    $idx_term_nosel = $recStruc['dtFieldNamesToIndex']['dty_TermIDTreeNonSelectableIDs'];
    $idx_reqtype = $recStruc['dtFieldNamesToIndex']['rst_RequirementType'];
    $recordTypeStructure = $recStruc[$recordType]['dtFields'];
    //get terms name=>id
    $terms_enum = null;
    $terms_relation = null;
    $select_query = "SELECT " . implode(",", $sel_query) . ($id_field ? ", " . $id_field : "") . ", imp_id " . " FROM " . $import_table;
    $ignore_insert = $params['ignore_insert'] == 1;
    if ($id_field) {
        //index field defined - add to list of columns
        $id_field_idx = count($field_types);
        //last one
        if ($ignore_insert) {
            $select_query = $select_query . " WHERE (" . $id_field . ">0) ";
            //use records with defined value in index field
        }
        $select_query = $select_query . " ORDER BY " . $id_field;
    } else {
        if ($ignore_insert) {
            return "id field not defined";
        }
        //create id field by default - add to import table
        $id_fieldname = "ID field for Record type #" . $recordType;
        $index = array_search($id_fieldname, $imp_session['columns']);
        //find it among existing columns
        if ($index !== false) {
            //this is existing field
            $id_field_def = "field_" . $index;
            $imp_session['indexes'][$id_field] = $recordType;
        } else {
            $field_count = count($imp_session['columns']);
            $id_field_def = "field_" . $field_count;
            $altquery = "alter table " . $import_table . " add column " . $id_field_def . " int(10) ";
            if (!$mysqli->query($altquery)) {
                return "SQL error: cannot alter import session table, cannot add new index field: " . $mysqli->error;
            }
            $imp_session['indexes'][$id_field_def] = $recordType;
            array_push($imp_session['columns'], $id_fieldname);
        }
    }
    $res = $mysqli->query($select_query);
    if (!$res) {
        return "import table is empty";
    } else {
        $rep_processed = 0;
        $rep_added = 0;
        $rep_updated = 0;
        $rep_skipped = 0;
        $rep_permission = 0;
        $tot_count = $imp_session['reccount'];
        $first_time = true;
        $step = ceil($tot_count / 10);
        if ($step > 10) {
            $step = 10;
        } else {
            if ($step < 1) {
                $step = 1;
            }
        }
        $csv_mvsep = @$params['csv_mvsep'] ? $params['csv_mvsep'] : $imp_session['csv_mvsep'];
        $csv_enclosure = @$params['csv_enclosure'] ? $params['csv_enclosure'] : $imp_session['csv_enclosure'];
        $previos_recordId = null;
        $recordId = null;
        $details = array();
        $details2 = array();
        //to keep original for sa_mode=2 (replace all existing value)
        $new_record_ids = array();
        $imp_id = null;
        $pairs = array();
        // for multivalue rec_id => new_rec_id  (keep new id if such id already used)
        while ($row = $res->fetch_row()) {
            //split multivalue index field
            $id_field_values = array();
            if ($id_field) {
                if (@$row[$id_field_idx]) {
                    //id field defined - detect insert or update
                    $id_field_values = explode($csv_mvsep, $row[$id_field_idx]);
                } else {
                    if (!$ignore_insert) {
                        //field value is not defined - add new record
                        $id_field_values = array(0 => null);
                    }
                }
            }
            //loop all id values - because on index field may have multivalue ID
            foreach ($id_field_values as $idx2 => $recordId_in_import) {
                if (@$pairs[$recordId_in_import]) {
                    //already impported
                    $recordId_in_import = $pairs[$recordId_in_import];
                }
                //we already have recordID
                if ($recordId_in_import) {
                    //id field defined - detect insert or update
                    //@toremove OLD $recordId_in_import = $row[$id_field_idx];
                    if ($previos_recordId != $recordId_in_import) {
                        //next record ID
                        //save data
                        if ($previos_recordId != null && !$is_mulivalue_index && count($details) > 0) {
                            //perform action
                            //$details = retainExisiting($details, $details2, $params, $recordTypeStructure, $idx_reqtype);
                            //import detail is sorted by rec_id -0 thus it is possible to assign the same recId for several imp_id
                            doInsertUpdateRecord($recordId, $params, $details, $id_field, $mode_output);
                        }
                        $previos_recordId = $recordId_in_import;
                        //reset
                        $details = array();
                        $details2 = array();
                        if ($recordId_in_import > 0) {
                            //possible update
                            // find original record in HDB
                            $details2 = findOriginalRecord($recordId_in_import);
                            if (count($details2) == 0) {
                                //record not found - this is insert with predefined ID
                                $recordId = -$recordId_in_import;
                            } else {
                                // record found - update detail according TO settings
                                $recordId = $recordId_in_import;
                            }
                        } else {
                            $recordId = null;
                            //insert for negative
                        }
                    }
                } else {
                    //INSERT - if field is not defined - always insert for each line in import data
                    $recordId = null;
                    $details = array();
                }
                //START TO FILL DETAILS ============================
                if (@$details['imp_id'] == null) {
                    $details['imp_id'] = array();
                }
                array_push($details['imp_id'], end($row));
                $lat = null;
                $long = null;
                foreach ($field_types as $index => $field_type) {
                    if ($field_type == "url") {
                        if ($row[$index]) {
                            $details['recordURL'] = trim($row[$index]);
                        }
                    } else {
                        if ($field_type == "scratchpad") {
                            if ($row[$index]) {
                                $details['recordNotes'] = trim($row[$index]);
                            }
                        } else {
                            if (substr($field_type, -strlen("_lat")) === "_lat") {
                                $field_type = substr($field_type, 0, strlen($field_type) - 4);
                                $fieldtype_type = "lat";
                            } else {
                                if (substr($field_type, -strlen("_long")) === "_long") {
                                    $field_type = substr($field_type, 0, strlen($field_type) - 5);
                                    $fieldtype_type = "long";
                                } else {
                                    $ft_vals = $recordTypeStructure[$field_type];
                                    //field type description
                                    $fieldtype_type = $ft_vals[$idx_fieldtype];
                                }
                            }
                            if (strpos($row[$index], $csv_mvsep) !== false) {
                                $values = getMultiValues($row[$index], $csv_enclosure, $csv_mvsep);
                                //  if this is multivalue index field we have to take only current value
                                if ($is_mulivalue_index && @$imp_session['indexes_keyfields'][$id_field][$sel_query[$index]] && $idx2 < count($values)) {
                                    $values = array($values[$idx2]);
                                }
                            } else {
                                $values = array($row[$index]);
                            }
                            foreach ($values as $idx => $r_value) {
                                $value = null;
                                $r_value = trim($r_value);
                                if ($fieldtype_type == "enum" || $fieldtype_type == "relationtype") {
                                    $r_value = trim_lower_accent($r_value);
                                    if ($r_value != "") {
                                        if (ctype_digit($r_value) && isValidTerm($ft_vals[$idx_term_tree], $ft_vals[$idx_term_nosel], $r_value, $field_type)) {
                                            $value = $r_value;
                                        }
                                        if ($value == null) {
                                            $value = isValidTermLabel($ft_vals[$idx_term_tree], $ft_vals[$idx_term_nosel], $r_value, $field_type);
                                        }
                                    }
                                } else {
                                    if ($fieldtype_type == "resource") {
                                        if (!isValidPointer(null, $r_value, $field_type)) {
                                            $value = null;
                                        } else {
                                            $value = $r_value;
                                        }
                                    } else {
                                        if ($fieldtype_type == "geo") {
                                            //verify WKT
                                            $geoType = null;
                                            //get WKT type
                                            if (strpos($r_value, 'POINT') !== false) {
                                                $geoType = "p";
                                            } else {
                                                if (strpos($r_value, 'LINESTRING') !== false) {
                                                    $geoType = "l";
                                                } else {
                                                    if (strpos($r_value, 'POLYGON') !== false) {
                                                        $geoType = "pl";
                                                    }
                                                }
                                            }
                                            if ($geoType) {
                                                $value = $geoType . " " . $r_value;
                                            } else {
                                                $value = null;
                                            }
                                        } else {
                                            if ($fieldtype_type == "lat") {
                                                $lat = $r_value;
                                            } else {
                                                if ($fieldtype_type == "long") {
                                                    //WARNING MILTIVALUE IS NOT SUPPORTED
                                                    $long = $r_value;
                                                } else {
                                                    //double spaces are removed on preprocess stage $value = trim(preg_replace('/([\s])\1+/', ' ', $r_value));
                                                    $value = trim($r_value);
                                                    if ($value != "") {
                                                        if ($fieldtype_type == "date") {
                                                            //$value = strtotime($value);
                                                            //$value = date('Y-m-d H:i:s', $value);
                                                        } else {
                                                            //replace \\r to\r \\n to \n
                                                            $value = str_replace("\\r", "\r", $value);
                                                            $value = str_replace("\\n", "\n", $value);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if ($lat && $long) {
                                    $value = "p POINT (" . $long . "  " . $lat . ")";
                                    //TODO Where does the 'p' come from? This appears to have been a local invention ...
                                    //reset
                                    $lat = null;
                                    $long = null;
                                }
                                if ($value && ($params['sa_upd'] != 1 || !@$details2["t:" . $field_type])) {
                                    //$params['sa_upd']==1 Add new data only if field is empty (new data ignored for non-empty fields)
                                    $details_lc = array();
                                    $details2_lc = array();
                                    /*if($params['sa_upd']==2 && $params['sa_upd2']==1 && !@$details["t:".$field_type]["bd:delete"]){
                                      unset($details["t:".$field_type]["bd:delete"]); //new data is porvided - no need to delete
                                      }else if($params['sa_upd']==2 && $params['sa_upd2']!=1 && !@$details["t:".$field_type]["bd:delete"]){
                                      $details["t:".$field_type]["bd:delete"] = "ups!"; //if new data are provided then remove old data
                                      }*/
                                    if ($params['sa_upd'] == 2) {
                                        $details["t:" . $field_type]["bd:delete"] = "ups!";
                                        //if new data are provided then remove old data
                                    }
                                    if (is_array(@$details["t:" . $field_type])) {
                                        $details_lc = array_map('trim_lower_accent', $details["t:" . $field_type]);
                                    }
                                    if ($params['sa_upd'] != 2 && is_array(@$details2["t:" . $field_type])) {
                                        $details2_lc = array_map('trim_lower_accent', $details2["t:" . $field_type]);
                                    }
                                    if ((!@$details["t:" . $field_type] || array_search(trim_lower_accent($value), $details_lc, true) === false) && (!@$details2["t:" . $field_type] || array_search(trim_lower_accent($value), $details2_lc, true) === false)) {
                                        $cnt = count(@$details["t:" . $field_type]) + 1;
                                        $details["t:" . $field_type][$cnt] = $value;
                                    } else {
                                    }
                                }
                                if ($params['sa_upd'] == 2 && $params['sa_upd2'] == 1 && !@$details["t:" . $field_type]["bd:delete"] && !$value && $recordTypeStructure[$field_type][$idx_reqtype] != "required") {
                                    //delete old even if new is not provided
                                    $details["t:" . $field_type]["bd:delete"] = "ups!";
                                }
                            }
                            //$values
                            //if insert and require field is not defined - skip it
                            if (!($recordId > 0) && $recordTypeStructure[$field_type][$idx_reqtype] == "required") {
                                //error_log($field_type.' = '.print_r(@$details["t:".$field_type],true));
                                //$is_valid_newrecord = false;
                                //break;
                            }
                        }
                    }
                }
                //for import data
                //END FILL DETAILS =============================
                $new_id = null;
                // || $recordId==null
                //add - update record for 2 cases: idfield not defined, idfield is multivalue
                if (($id_field_not_defined || $recordId == null) && count($details) > 0) {
                    //id field not defined - insert for each line
                    if (!$ignore_insert) {
                        $new_id = doInsertUpdateRecord($recordId, $params, $details, $id_field, $mode_output);
                        $details = array();
                    }
                } else {
                    if ($is_mulivalue_index) {
                        //idfield is multivalue (now is is assummed that index field is always multivalue)
                        //THIS SECTION IS NOT USED
                        //$details = retainExisiting($details, $details2, $params, $recordTypeStructure, $idx_reqtype);
                        if (count($details) > 1) {
                            $new_id = doInsertUpdateRecord($recordId, $params, $details, null, $mode_output);
                            if ($new_id != null && intval($new_id) > 0) {
                                array_push($new_record_ids, $new_id);
                            }
                            $previos_recordId = null;
                            if (($recordId == null || $recordId < 0) && intval($new_id) > 0) {
                                //new records OR predefined id
                                $pairs[$id_field_values[$idx2]] = $new_id;
                            }
                        } else {
                            if ($recordId > 0) {
                                array_push($new_record_ids, $recordId);
                            }
                        }
                    }
                }
                $rep_processed++;
                if ($mode_output == 'html' && $rep_processed % $step == 0) {
                    ob_start();
                    if ($first_time) {
                        print '<script type="text/javascript">$("#div-progress").hide();</script>';
                        $first_time = false;
                    }
                    print '<script type="text/javascript">update_counts(' . $rep_processed . ',' . $rep_added . ',' . $rep_updated . ',' . $tot_count . ')</script>' . "\n";
                    ob_flush();
                    flush();
                }
            }
            //foreach multivalue index
            if ($is_mulivalue_index && is_array($new_record_ids) && count($new_record_ids) > 0) {
                //save record ids in import table
                updateRecIds($import_table, end($row), $id_field, $new_record_ids, $csv_mvsep);
                $new_record_ids = array();
                //to save in import table
            }
        }
        //main  all recs in import table
        $res->close();
        if ($id_field && count($details) > 0 && !$is_mulivalue_index && $recordId != null) {
            //action for last record
            //$details = retainExisiting($details, $details2, $params, $recordTypeStructure, $idx_reqtype);
            $new_id = doInsertUpdateRecord($recordId, $params, $details, $id_field, $mode_output);
        }
        if (!$id_field) {
            array_push($imp_session['uniqcnt'], $rep_added);
        }
        $import_report = array('processed' => $rep_processed, 'inserted' => $rep_added, 'updated' => $rep_updated, 'total' => $tot_count, 'skipped' => $rep_skipped, 'permission' => $rep_permission);
        //update counts array
        $new_counts = array($rep_updated + $rep_added, $rep_processed, 0, 0);
        if ($ignore_insert) {
            if ($use_sequence) {
                $prev_counts = @$imp_session['sequence'][$currentSeqIndex]['counts'];
            } else {
                if (@$imp_session['counts'][$recordType]) {
                    $prev_counts = $imp_session['counts'][$recordType];
                }
            }
            if (is_array($prev_counts) && count($prev_counts) == 4) {
                $new_counts[2] = $prev_counts[2];
                $new_counts[3] = $prev_counts[3];
            }
        }
        if ($use_sequence) {
            $imp_session['sequence'][$currentSeqIndex]['counts'] = $new_counts;
        } else {
            if (!@$imp_session['counts']) {
                $imp_session['counts'] = array();
            }
            $imp_session['counts'][$recordType] = $new_counts;
        }
        if ($mode_output != 'array') {
            print '<script type="text/javascript">update_counts(' . $rep_processed . ',' . $rep_added . ',' . $rep_updated . ',' . $tot_count . ')</script>' . "\n";
            if ($rep_skipped > 0) {
                print '<p>' . $rep_skipped . ' rows skipped</p>';
            }
        }
    }
    //save mapping into import_sesssion
    if ($use_sequence) {
        $imp_session['sequence'][$currentSeqIndex]['mapping_flds'] = $mapping;
    } else {
        //old way
        if (!@$imp_session['mapping_flds']) {
            $imp_session['mapping_flds'] = array();
        }
        $imp_session['mapping_flds'][$recordType] = $mapping;
    }
    $imp_session['import_report'] = $import_report;
    return saveSession($mysqli, $imp_session);
}
require_once dirname(__FILE__) . "/../../common/php/getRecordInfoLibrary.php";
mysql_connection_overwrite(DATABASE);
header("Content-type: text/javascript");
if (strpos(@$_REQUEST["recID"], ",") !== false) {
    $recIDs = array_map("intval", explode(",", $_REQUEST["recID"]));
    if (count($recIDs) < 1) {
        return;
    }
    $recID = null;
} else {
    $recID = intval(@$_REQUEST["recID"]);
    if (!$recID) {
        return;
    }
}
$addRecDefaults = getDefaultOwnerAndibility($_REQUEST);
if (@$_REQUEST["delete"] && $recID) {
    $deletions = array_map("intval", $_REQUEST["delete"]);
}
if (count(@$deletions) > 0) {
    /* check the deletion recIDs to make sure they actually involve the given rec_ID */
    $res = mysql_query("select rec_ID from Records, recDetails\n\t\twhere dtl_RecID=rec_ID and dtl_DetailTypeID in (" . (defined('DT_PRIMARY_RESOURCE') ? DT_PRIMARY_RESOURCE : "0") . "," . (defined('DT_TARGET_RESOURCE') ? DT_TARGET_RESOURCE : "0") . ") and dtl_Value={$recID} and rec_ID in (" . join(",", $deletions) . ")");
    $deletions = array();
    while ($row = mysql_fetch_row($res)) {
        array_push($deletions, $row[0]);
    }
    if ($deletions) {
        foreach ($deletions as $del_recID) {
            /* one delete query per rec_ID, this way the archive_bib* versioning stuff works */
            mysql_query("update Records set rec_Modified=now() where rec_ID = {$del_recID}");
            mysql_query("delete from recDetails where dtl_RecID = {$del_recID}");
function insertRecord($rtyID = null)
{
    // check if there is preference for OwnerGroup and visibility
    $addRecDefaults = getDefaultOwnerAndibility($_REQUEST);
    $usrID = get_user_id();
    // Try to insert anything in POST as details of a new Record.
    // We do this by creating a stub record, and then updating it.
    mysql__insert("Records", array("rec_Added" => date('Y-m-d H:i:s'), "rec_AddedByUGrpID" => get_user_id(), "rec_RecTypeID" => intval($rtyID), "rec_ScratchPad" => @$_REQUEST["notes"] ? $_REQUEST["notes"] : null, "rec_OwnerUGrpID" => $addRecDefaults[1], "rec_NonOwnerVisibility" => $addRecDefaults[2], "rec_URL" => @$_REQUEST["rec_url"] ? $_REQUEST["rec_url"] : ""));
    $_REQUEST["recID"] = $recID = mysql_insert_id();
    if ($recID) {
        if ($usrID) {
            mysql__insert('usrBookmarks', array('bkm_recID' => $recID, 'bkm_Added' => date('Y-m-d H:i:s'), 'bkm_Modified' => date('Y-m-d H:i:s'), 'bkm_UGrpID' => $usrID));
        }
        updateRecord($recID, $rtyID);
        return true;
    } else {
        return false;
    }
}
Esempio n. 4
0
require_once dirname(__FILE__) . "/../../common/php/dbMySqlWrappers.php";
require_once dirname(__FILE__) . '/../disambig/testSimilarURLs.php';
require_once dirname(__FILE__) . '/../woot/woot.php';
if (!is_logged_in()) {
    if (!(@$_REQUEST['bkmrk_bkmk_url'] || @$_REQUEST['bkmrk_bkmk_title'] || @$_REQUEST['bkmrk_bkmk_description'])) {
        header('Location: ' . HEURIST_BASE_URL . 'common/connect/login.php?db=' . HEURIST_DBNAME);
    } else {
        header('Location: ' . HEURIST_BASE_URL . 'common/connect/login.php?db=' . HEURIST_DBNAME . '&bkmrk_bkmk_title=' . urlencode(@$_REQUEST['bkmrk_bkmk_title']) . '&bkmrk_bkmk_url=' . urlencode(@$_REQUEST['bkmrk_bkmk_url']) . '&bkmrk_bkmk_description=' . urlencode(@$_REQUEST['bkmrk_bkmk_description']));
    }
    return;
}
$usrID = get_user_id();
mysql_connection_overwrite(DATABASE);
mysql_query("set @logged_in_user_id = {$usrID}");
//saw TODO: check where else this needs to be used
list($userDefaultRectype, $userDefaultOwnerGroupID, $userDefaultVisibility) = getDefaultOwnerAndibility($_REQUEST);
/* preprocess any description */
if (@$_REQUEST['bkmrk_bkmk_description']) {
    $description = $_REQUEST['bkmrk_bkmk_description'];
    /* use UNIX-style lines */
    $description = str_replace("\r\n", "\n", $description);
    $description = str_replace("\r", "\n", $description);
    /* liposuction away those unsightly double, triple and quadruple spaces */
    $description = preg_replace('/ +/', ' ', $description);
    /* trim() each line */
    $description = preg_replace('/^[ \\t\\v\\f]+|[ \\t\\v\\f]+$/m', '', $description);
    $description = preg_replace('/^\\s+|\\s+$/s', '', $description);
    /* reduce anything more than two newlines in a row */
    $description = preg_replace("/\n\n\n+/s", "\n\n", $description);
    if (@$_REQUEST['version']) {
        $description .= ' [source: web page ' . date('Y-m-d') . ']';
Esempio n. 5
0
*/
/*
* Licensed under the GNU License, Version 3.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at http://www.gnu.org/licenses/gpl-3.0.txt
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
* See the License for the specific language governing permissions and limitations under the License.
*/
define('SAVE_URI', 'disabled');
require_once dirname(__FILE__) . '/../../common/connect/applyCredentials.php';
require_once dirname(__FILE__) . '/../../common/php/dbMySqlWrappers.php';
if (!is_logged_in()) {
    return;
}
mysql_connection_select(DATABASE);
$addRecDefaults = getDefaultOwnerAndibility(null);
if (@$_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']["display-preferences"]["record-add-defaults"]) {
    $showAccessRights = @$_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']["display-preferences"]["record-add-showaccess"] != "false";
} else {
    $showAccessRights = true;
}
?>

<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <link rel=stylesheet href="<?php 
echo HEURIST_BASE_URL;
?>
common/css/global.css">
        <link rel=stylesheet href="<?php