Ejemplo n.º 1
0
/**
* lookup local id for a given detailtype concept id pair
* @global    type description of global variable usage in a function
* @staticvar array [$RTIDs] lookup array of local ids
* @param     int [$dtID] origin detailtype id
* @param     int [$dbID] origin database id (default to 2 which is reserved for coreDefinition)
* @return    int local detailtype ID or null if not found
*/
function detailtypeLocalIDLookup($dtID, $dbID = 2)
{
    static $DTIDs;
    if (!$DTIDs) {
        $res = mysql_query('select dty_ID as localID,dty_OriginatingDBID as dbID,dty_IDInOriginatingDB as id from defDetailTypes order by dbID');
        if (!$res) {
            returnErrorMsgPage(0, "Unable to build internal field type lookup table, MySQL error: " . mysql_error());
        }
        $DTIDs = array();
        while ($row = mysql_fetch_assoc($res)) {
            if (!@$DTIDs[$row['dbID']]) {
                $DTIDs[$row['dbID']] = array();
            }
            $DTIDs[$row['dbID']][$row['id']] = $row['localID'];
        }
    }
    return @$DTIDs[$dbID][$dtID] ? $DTIDs[$dbID][$dtID] : null;
}
Ejemplo n.º 2
0
        if (defined('HEURIST_SESSION_DB_PREFIX')) {
            $_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']['last_uri'] = $_SERVER['REQUEST_URI'];
        }
    }
    // update cookie expiry time. Besides make sure thah php.ini session.gc_maxlifetime set to the similar value
    if (@$_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']['keepalive']) {
        $rv = setcookie('heurist-sessionid', session_id(), time() + 30 * 24 * 60 * 60, '/');
        //, HEURIST_SERVER_NAME);
    }
    //	if (((! defined('REPLACE_DBNAME'))  ||  strtoupper(REPLACE_DBNAME) != 'DISABLED')&& defined("HEURIST_DBNAME")) {
    //		$_SESSION['heurist_last_used_dbname'] = HEURIST_DBNAME ;
    //	}
}
session_write_close();
if (!defined('SKIP_VERSIONCHECK2') && defined('HEURIST_DBVERSION') && HEURIST_MIN_DBVERSION > HEURIST_DBVERSION) {
    returnErrorMsgPage(3, "Need DB upgrade");
}
function is_cookie_current_version()
{
    return @$_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']['cookie_version'] == COOKIE_VERSION;
}
function get_roles()
{
    if (@$_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']['user_access']) {
        return $_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']['user_access'];
    } else {
        return NULL;
    }
}
function _is_logged_in()
{