function get_email_footer() { if (strlen(get_opendb_lang_var('email_footer')) > 0) { $site_url = get_site_url(); $footer_text = get_opendb_lang_var('email_footer', array('site' => get_opendb_config_var('site', 'title'), 'version' => get_opendb_version(), 'site_url' => $site_url)); return "\n\n" . "--" . "\n" . $footer_text; } return ""; }
function generate_language_sql($language, $options = NULL) { $CRLF = get_user_browser_crlf(); $sqlscript = ''; //language, description, default_ind $language_r = fetch_language_r($language); if (is_not_empty_array($language_r)) { $sqlscript = '#########################################################' . $CRLF . '# OpenDb ' . get_opendb_version() . ' \'' . $language . '\' Language Pack' . $CRLF . '#########################################################' . $CRLF . $CRLF; $sqlscript .= "INSERT INTO s_language (language, description, default_ind) " . "VALUES ('" . $language_r['language'] . "', '" . addslashes($language_r['description']) . "', '" . $language_r['default_ind'] . "'); " . $CRLF; $results = fetch_language_langvar_rs($language, $options); if ($results) { $sqlscript .= $CRLF . '#' . $CRLF . '# System Language Variables' . $CRLF . '#' . $CRLF; while ($lang_var_r = db_fetch_assoc($results)) { if ($language_r['default_ind'] != 'Y') { $value = ifempty($lang_var_r['value'], $lang_var_r['default_value']); } else { $value = $lang_var_r['value']; } $sqlscript .= "INSERT INTO s_language_var (language, varname, value) " . "VALUES ('" . $language_r['language'] . "', '" . $lang_var_r['varname'] . "', '" . addslashes($value) . "'); " . $CRLF; } db_free_result($results); } if ($language_r['default_ind'] != 'Y') { $table_r = get_system_table_r(); if (is_array($table_r)) { $sqlscript .= $CRLF . '#' . $CRLF . '# System Table Language Variables' . $CRLF . '#' . $CRLF; reset($table_r); while (list(, $table) = each($table_r)) { $tableconf_r = get_system_table_config($table); // key, column if (is_array($tableconf_r) && is_array($tableconf_r['columns'])) { reset($tableconf_r['columns']); while (list(, $column) = each($tableconf_r['columns'])) { $results = fetch_system_table_column_langvar_rs($language, $table, $column, $options); if ($results) { while ($lang_var_r = db_fetch_assoc($results)) { if ($language_r['default_ind'] != 'Y') { $value = ifempty($lang_var_r['value'], $lang_var_r[$column]); } else { $value = $lang_var_r['value']; } if (strlen($value)) { $sqlscript .= "INSERT INTO s_table_language_var (language, tablename, columnname, key1, key2, key3, value) " . "VALUES ('" . $language_r['language'] . "', '" . $table . "', '" . $column . "', '" . $lang_var_r['key1'] . "', " . (strlen($lang_var_r['key2']) > 0 ? "'" . $lang_var_r['key2'] . "'" : "''") . ", " . (strlen($lang_var_r['key3']) > 0 ? "'" . $lang_var_r['key3'] . "'" : "''") . ", '" . addslashes($value) . "'); " . $CRLF; } } db_free_result($results); } } } } } } } return $sqlscript; }
/** @param $to_version - if NULL, then upgrading to current OpenDb version. @$steps_r = array( array(title=>'step title', description=>'step description', skippable=>[TRUE|FALSE]), */ function OpenDbUpgrader($from_version, $to_version = NULL, $steps_r = NULL) { // derive a upgrade sql directory from the classname $this->_upgraderdir = './install/upgrade/' . $from_version; if ($to_version != NULL) { // if only one upgrader upgrades from a version, there is no need to specify a TO directory component. $tmpdir = $this->_upgraderdir . '_' . $to_version; if (is_dir($tmpdir)) { $this->_upgraderdir .= '_' . $to_version; } } if (is_array($steps_r)) { $this->_steps = $steps_r; } else { $this->_steps[] = array(title => NULL, description => NULL, skippable => FALSE); } $this->_from_version = $from_version; if (strlen($to_version) > 0) { $this->_to_version = $to_version; } else { $this->_to_version = get_opendb_version(); } // defaults to current opendb version }
function generate_site_plugin_sql($site_type_r) { $CRLF = get_user_browser_crlf(); $buffer = "#########################################################" . $CRLF . "# OpenDb " . get_opendb_version() . " " . $site_type_r['title'] . " (" . $site_type_r['site_type'] . ") Site Plugin" . $CRLF . "#########################################################"; $buffer .= $CRLF . $CRLF . "#" . $CRLF . "# Site Plugin." . $CRLF . "#" . $CRLF; $buffer .= $CRLF . "INSERT INTO s_site_plugin ( site_type, classname, title, image, description, external_url, items_per_page, more_info_url ) " . "VALUES ( " . "'" . $site_type_r['site_type'] . "', " . "'" . $site_type_r['classname'] . "', " . "'" . addslashes($site_type_r['title']) . "', " . "'" . addslashes($site_type_r['image']) . "', " . "'" . addslashes($site_type_r['description']) . "', " . "'" . addslashes($site_type_r['external_url']) . "', " . "" . $site_type_r['items_per_page'] . ", " . "'" . addslashes($site_type_r['more_info_url']) . "' );"; $results = fetch_site_plugin_conf_rs($site_type_r['site_type']); if ($results) { $buffer .= $CRLF . $CRLF . "#" . $CRLF . "# Site Plugin Configuration" . $CRLF . "#" . $CRLF; while ($site_plugin_conf_r = db_fetch_assoc($results)) { $buffer .= $CRLF . "INSERT INTO s_site_plugin_conf ( site_type, name, keyid, description, value ) " . "VALUES ( " . "'" . $site_plugin_conf_r['site_type'] . "', " . "'" . addslashes($site_plugin_conf_r['name']) . "', " . "'" . addslashes($site_plugin_conf_r['keyid']) . "', " . "'" . addslashes($site_plugin_conf_r['description']) . "', " . "'" . addslashes($site_plugin_conf_r['value']) . "' );"; } db_fetch_assoc($results); } $results = fetch_site_plugin_input_field_rs($site_type_r['site_type']); if ($results) { $buffer .= $CRLF . $CRLF . "#" . $CRLF . "# Site Plugin Input Fields" . $CRLF . "#" . $CRLF; while ($site_plugin_input_field_r = db_fetch_assoc($results)) { $buffer .= $CRLF . "INSERT INTO s_site_plugin_input_field ( site_type, field, order_no, description, prompt, field_type, default_value, refresh_mask ) " . "VALUES ( " . "'" . $site_plugin_input_field_r['site_type'] . "', " . "'" . $site_plugin_input_field_r['field'] . "', " . "" . $site_plugin_input_field_r['order_no'] . ", " . "'" . addslashes($site_plugin_input_field_r['description']) . "', " . "'" . addslashes($site_plugin_input_field_r['prompt']) . "', " . "'" . $site_plugin_input_field_r['field_type'] . "', " . "'" . addslashes($site_plugin_input_field_r['default_value']) . "', " . "'" . addslashes($site_plugin_input_field_r['refresh_mask']) . "' );"; } db_fetch_assoc($results); } $results = fetch_site_plugin_link_rs($site_type_r['site_type']); if ($results) { $buffer .= $CRLF . $CRLF . "#" . $CRLF . "# Site Plugin Links" . $CRLF . "#" . $CRLF; while ($fetch_site_plugin_link_r = db_fetch_assoc($results)) { $buffer .= $CRLF . "INSERT INTO s_site_plugin_link ( site_type, s_item_type_group, s_item_type, order_no, description, url, title_url ) " . "VALUES ( " . "'" . $fetch_site_plugin_link_r['site_type'] . "', " . "'" . $fetch_site_plugin_link_r['s_item_type_group'] . "', " . "'" . $fetch_site_plugin_link_r['s_item_type'] . "', " . "" . $fetch_site_plugin_link_r['order_no'] . ", " . "'" . addslashes($fetch_site_plugin_link_r['description']) . "', " . "'" . addslashes($fetch_site_plugin_link_r['url']) . "', " . "'" . addslashes($fetch_site_plugin_link_r['title_url']) . "' );"; } db_fetch_assoc($results); } $results = fetch_site_plugin_s_attribute_type_map_rs($site_type_r['site_type']); if ($results) { $buffer .= $CRLF . $CRLF . "#" . $CRLF . "# Site Plugin System Attribute Type Map" . $CRLF . "#" . $CRLF; while ($site_plugin_s_attribute_type_map_r = db_fetch_assoc($results)) { $buffer .= $CRLF . "INSERT INTO s_site_plugin_s_attribute_type_map ( site_type, s_item_type_group, s_item_type, variable, s_attribute_type, lookup_attribute_val_restrict_ind ) " . "VALUES ( " . "'" . $site_plugin_s_attribute_type_map_r['site_type'] . "', " . "'" . $site_plugin_s_attribute_type_map_r['s_item_type_group'] . "', " . "'" . $site_plugin_s_attribute_type_map_r['s_item_type'] . "', " . "'" . addslashes($site_plugin_s_attribute_type_map_r['variable']) . "', " . "'" . $site_plugin_s_attribute_type_map_r['s_attribute_type'] . "', " . "'" . $site_plugin_s_attribute_type_map_r['lookup_attribute_val_restrict_ind'] . "' );"; } db_fetch_assoc($results); } $results = fetch_site_plugin_s_attribute_type_lookup_map_rs($site_type_r['site_type']); if ($results) { $buffer .= $CRLF . $CRLF . "#" . $CRLF . "# Site Plugin System Attribute Type Lookup Map" . $CRLF . "#" . $CRLF; while ($site_plugin_s_attribute_type_lookup_map_r = db_fetch_assoc($results)) { $buffer .= $CRLF . "INSERT INTO s_site_plugin_s_attribute_type_lookup_map ( site_type, s_attribute_type, value, lookup_attribute_val ) " . "VALUES ( " . "'" . $site_plugin_s_attribute_type_lookup_map_r['site_type'] . "', " . "'" . $site_plugin_s_attribute_type_lookup_map_r['s_attribute_type'] . "', " . "'" . addslashes($site_plugin_s_attribute_type_lookup_map_r['value']) . "', " . "'" . addslashes($site_plugin_s_attribute_type_lookup_map_r['lookup_attribute_val']) . "' ); "; } db_fetch_assoc($results); } $results = fetch_site_attribute_type_rs($site_type_r['site_type']); if ($results) { $buffer .= $CRLF . $CRLF . "####################################################################################################" . $CRLF . "# Item Type / Attribute Type relationships" . $CRLF . "####################################################################################################"; $attr_inserts = ""; $list_of_attribute_types = NULL; while ($site_attribute_type_r = db_fetch_assoc($results)) { $list_of_attribute_types[] = $site_attribute_type_r['s_attribute_type']; $attr_inserts .= $CRLF . "INSERT INTO s_attribute_type ( s_attribute_type, description, prompt, input_type, display_type, s_field_type, site_type ) " . "VALUES ( " . "'" . $site_attribute_type_r['s_attribute_type'] . "', " . "'" . addslashes($site_attribute_type_r['description']) . "', " . "'" . addslashes($site_attribute_type_r['prompt']) . "', " . "'" . addslashes($site_attribute_type_r['input_type']) . "', " . "'" . addslashes($site_attribute_type_r['display_type']) . "', " . "'" . $site_attribute_type_r['s_field_type'] . "', " . "'" . $site_attribute_type_r['site_type'] . "' );"; } db_fetch_assoc($results); $buffer .= $CRLF . $CRLF . "#" . $CRLF . "# Site Plugin Attribute Type(s)" . $CRLF . "#" . $CRLF; $buffer .= $attr_inserts; $results = fetch_site_item_attribute_type_rs($site_type_r['site_type']); if ($results) { $buffer .= $CRLF . $CRLF . "#" . $CRLF . "# Site Plugin Item Attribute Type Relationship(s)" . $CRLF . "#" . $CRLF; while ($site_item_attribute_type_r = db_fetch_assoc($results)) { $buffer .= $CRLF . "INSERT INTO s_item_attribute_type ( s_item_type, s_attribute_type, order_no, prompt, compulsory_ind ) " . "VALUES ( " . "'" . $site_item_attribute_type_r['s_item_type'] . "', " . "'" . $site_item_attribute_type_r['s_attribute_type'] . "', " . " " . $site_item_attribute_type_r['order_no'] . ", " . "'" . addslashes($site_item_attribute_type_r['prompt']) . "', " . "'" . ifempty($site_item_attribute_type_r['compulsory_ind'], 'N') . "' );"; } db_fetch_assoc($results); } } $buffer .= $CRLF; return $buffer; }
function validate_sql_script($patchdir, $sqlfile) { $patchdir = basename($patchdir); $sqlfile = basename($sqlfile); $file = "./admin/patch_facility/sql/{$patchdir}/{$sqlfile}"; if (file_exists($file)) { return $file; } else { return FALSE; } } @set_time_limit(600); if ($HTTP_VARS['op'] == 'previewsql') { echo "<html>"; echo "\n<head>"; echo "\n<title>" . get_opendb_config_var('site', 'title') . " " . get_opendb_version() . " - " . $HTTP_VARS['title'] . "</title>"; if (file_exists('./theme/default/style.css')) { echo "\n<link rel=stylesheet type=\"text/css\" href=\"./theme/default/style.css\">"; } echo "\n<style type=\"text/css\">"; echo "\n.code { color: black; font-family: courier; font-size:small }"; echo "\n</style>"; echo "\n</head><body>"; if (($file = validate_sql_script($HTTP_VARS['patchdir'], $HTTP_VARS['sqlfile'])) !== FALSE) { echo_install_sql_file($file); } echo "\n</body></html>"; } else { if ($HTTP_VARS['op'] == 'installsql') { if (($file = validate_sql_script($HTTP_VARS['patchdir'], $HTTP_VARS['sqlfile'])) !== FALSE) { if (exec_install_sql_file($file, $error)) {
function get_opendb_title_and_version() { return get_opendb_title(FALSE) . " " . get_opendb_version(); }
function install_opendb_upgrade($HTTP_VARS, &$errors) { // get last record added to database, regardless of whether complete or not. $opendb_release_r = fetch_opendb_release_version_r(FALSE); // if its numeric, then we are in the middle of an upgrade if (is_array($opendb_release_r) && is_numeric($opendb_release_r['upgrade_step'])) { $upgraders_r = get_upgrader_r($opendb_release_r['release_version']); $HTTP_VARS['upgrader_plugin'] = $upgraders_r['upgrader_plugin']; } else { $latest_to_version = NULL; // $latest_to_version is out param! $upgraders_rs = get_upgraders_rs(is_array($opendb_release_r) ? $opendb_release_r['release_version'] : NULL, get_opendb_version(), $latest_to_version); if (is_array($upgraders_rs)) { if (count($upgraders_rs) == 1) { $HTTP_VARS['upgrader_plugin'] = $upgraders_rs[0]['upgrader_plugin']; $upgraders_rs = NULL; } else { if (count($upgraders_rs) > 1) { $errors[] = "More than one upgrader is available for this version, this is an error, please contact the author."; reset($upgraders_rs); while (list(, $upgraders_r) = each($upgraders_rs)) { $errors[] = 'Upgrader: ' . $upgraders_r['description']; } return FALSE; // more than one upgrade step possible is an error! } else { // No upgraders available } } } else { return FALSE; } } //else - already defined, so should already have record. if (is_upgrader_plugin($HTTP_VARS['upgrader_plugin'])) { return perform_upgrade_step($HTTP_VARS, $opendb_release_r, $latest_to_version); } else { // no steps required insert_opendb_release(get_opendb_version(), 'Upgrade from ' . $opendb_release_r['release_version'] . ' to ' . get_opendb_version(), NULL); return TRUE; } }
reset($feeds_r); while (list(, $feed_r) = each($feeds_r)) { echo '<li><a href="' . $PHP_SELF . '?feed=' . $feed_r['feed'] . '">' . $feed_r['title'] . '</a></dd>'; } echo "</ul>"; echo _theme_footer(); } else { @set_time_limit(600); $feed_config_r = get_opendb_rss_feed_config($HTTP_VARS['feed']); if (is_not_empty_array($feed_config_r)) { $URL = get_site_url(); $rssoutput = ''; // Create the RSS header and channel information tags header('Content-type: text/xml'); header("Content-disposition: inline; filename={$feed_config_r['feed']}.rss"); $rssoutput .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>" . "\n<rss version=\"2.0\">" . "\n<channel>" . "\n\t<title>" . rss_encoded(get_opendb_config_var('site', 'title') . " " . get_opendb_version()) . "</title>" . "\n\t<link>" . $URL . "</link>" . "\n\t<description>" . $feed_config_r['title'] . "</description>" . "\n\t<image>" . "\n\t\t<url>" . $URL . "images/icon.gif</url>" . "\n\t\t<title>" . rss_encoded(get_opendb_config_var('site', 'title') . " " . get_opendb_version()) . "</title>" . "\n\t\t<link>" . $URL . "</link>" . "\n\t</image>"; $rssoutput .= build_opendb_rss_feed($feed_config_r, $URL); // Create the end tags $rssoutput .= "\n</channel>" . "\n</rss>"; if (function_exists("mb_convert_encoding") && function_exists("mb_detect_encoding")) { echo mb_convert_encoding($rssoutput, mb_detect_encoding($rssoutput), "UTF-8"); } else { echo $rssoutput; } } else { //else if($HTTP_VARS['type'] == 'announcements') opendb_operation_not_available(); } } } else { //not a valid session.
/** * Generate a complete s_item_type script. * * Data generated: * s_item_type * s_attribute_type's (Those not included in $_ATTRIBUTE_TYPES['core']) * s_item_attribute_type's * s_item_attribute_type_lookup (Those not included in $_ATTRIBUTE_TYPES['core']) */ function generate_s_item_type_sql($s_item_type) { global $_CORE_ATTRIBUTE_TYPES; $CRLF = get_user_browser_crlf(); $s_item_type_r = fetch_s_item_type_r($s_item_type); if ($s_item_type_r !== FALSE) { $type_sql = $CRLF . '#' . $CRLF . '# Item Type' . $CRLF . '#' . $CRLF . 'INSERT INTO s_item_type ( s_item_type, description, image ) VALUES ( \'' . $s_item_type . '\', \'' . addslashes($s_item_type_r['description']) . '\', \'' . addslashes($s_item_type_r['image']) . '\' );' . $CRLF; $results = fetch_item_type_group_rlshp_rs(NULL, $s_item_type); if ($results) { $type_sql .= $CRLF . '#' . $CRLF . '# Item Type Group Relationships' . $CRLF . '#' . $CRLF; while ($item_type_group_rlshp_r = db_fetch_assoc($results)) { $type_sql .= 'INSERT INTO s_item_type_group_rltshp ( s_item_type_group, s_item_type ) VALUES ( \'' . $item_type_group_rlshp_r['s_item_type_group'] . '\', \'' . $item_type_group_rlshp_r['s_item_type'] . '\' );' . $CRLF; } db_fetch_assoc($results); } $attr_sql = ''; $item_attr_sql = $CRLF . '#' . $CRLF . '# Item Attribute Relationships' . $CRLF . '#'; $attr_lookup_sql = ''; $result = fetch_s_item_attribute_type_rs($s_item_type); if ($result) { $attr_added = array(); while ($s_item_attribute_type_r = db_fetch_assoc($result)) { // Ensure to also check that the attribute has not already been encountered, in case we have duplicates // in s_item_attribute_type structure (such as CDTRACK for instance) if (strlen($s_item_attribute_type_r['site_type']) == 0 && (!is_array($_CORE_ATTRIBUTE_TYPES) || !in_array($s_item_attribute_type_r['s_attribute_type'], $_CORE_ATTRIBUTE_TYPES)) && !in_array($s_item_attribute_type_r['s_attribute_type'], $attr_added)) { // Add s_attribute_type, so we do not insert it twice. $attr_added[] = $s_item_attribute_type_r['s_attribute_type']; $s_attribute_type_r = fetch_s_attribute_type_r($s_item_attribute_type_r['s_attribute_type']); $attr_sql .= $CRLF . "INSERT INTO s_attribute_type ( s_attribute_type, description, prompt, input_type, input_type_arg1, input_type_arg2, input_type_arg3, input_type_arg4, input_type_arg5, display_type, display_type_arg1, display_type_arg2, display_type_arg3, display_type_arg4, display_type_arg5, listing_link_ind, file_attribute_ind, lookup_attribute_ind, multi_attribute_ind, s_field_type, site_type ) " . "VALUES ( '" . $s_attribute_type_r['s_attribute_type'] . "', " . "'" . addslashes($s_attribute_type_r['description']) . "', " . "'" . addslashes($s_attribute_type_r['prompt']) . "', " . "'" . $s_attribute_type_r['input_type'] . "', " . (strlen($s_attribute_type_r['input_type_arg1']) > 0 ? "'" . addslashes($s_attribute_type_r['input_type_arg1']) . "'" : "NULL") . ", " . (strlen($s_attribute_type_r['input_type_arg2']) > 0 ? "'" . addslashes($s_attribute_type_r['input_type_arg2']) . "'" : "NULL") . ", " . (strlen($s_attribute_type_r['input_type_arg3']) > 0 ? "'" . addslashes($s_attribute_type_r['input_type_arg3']) . "'" : "NULL") . ", " . (strlen($s_attribute_type_r['input_type_arg4']) > 0 ? "'" . addslashes($s_attribute_type_r['input_type_arg4']) . "'" : "NULL") . ", " . (strlen($s_attribute_type_r['input_type_arg5']) > 0 ? "'" . addslashes($s_attribute_type_r['input_type_arg5']) . "'" : "NULL") . ", " . "'" . $s_attribute_type_r['display_type'] . "'," . (strlen($s_attribute_type_r['display_type_arg1']) > 0 ? "'" . addslashes($s_attribute_type_r['display_type_arg1']) . "'" : "NULL") . ", " . (strlen($s_attribute_type_r['display_type_arg2']) > 0 ? "'" . addslashes($s_attribute_type_r['display_type_arg2']) . "'" : "NULL") . ", " . (strlen($s_attribute_type_r['display_type_arg3']) > 0 ? "'" . addslashes($s_attribute_type_r['display_type_arg3']) . "'" : "NULL") . ", " . (strlen($s_attribute_type_r['display_type_arg4']) > 0 ? "'" . addslashes($s_attribute_type_r['display_type_arg4']) . "'" : "NULL") . ", " . (strlen($s_attribute_type_r['display_type_arg5']) > 0 ? "'" . addslashes($s_attribute_type_r['display_type_arg5']) . "'" : "NULL") . ", " . "'" . $s_attribute_type_r['listing_link_ind'] . "', " . "'" . $s_attribute_type_r['file_attribute_ind'] . "', " . "'" . $s_attribute_type_r['lookup_attribute_ind'] . "', " . "'" . $s_attribute_type_r['multi_attribute_ind'] . "', " . (strlen($s_attribute_type_r['s_field_type']) > 0 ? "'" . $s_attribute_type_r['s_field_type'] . "'" : "NULL") . ", " . (strlen($s_attribute_type_r['site_type']) > 0 ? "'" . $s_attribute_type_r['s_field_type'] . "'" : "NULL") . ");"; $result2 = fetch_attribute_type_lookup_rs($s_item_attribute_type_r['s_attribute_type'], 'value ASC', FALSE); if ($result2) { $attr_lookup_sql .= $CRLF . '#' . $CRLF . '# Attribute Type Lookup (' . $s_item_attribute_type_r['s_attribute_type'] . ')' . $CRLF . '#'; while ($s_attribute_type_lookup_r = db_fetch_assoc($result2)) { $attr_lookup_sql .= $CRLF . 'INSERT INTO s_attribute_type_lookup ( s_attribute_type, order_no, value, display, img, checked_ind ) VALUES ( \'' . $s_item_attribute_type_r['s_attribute_type'] . '\', ' . (is_numeric($s_attribute_type_lookup_r['order_no']) ? $s_attribute_type_lookup_r['order_no'] : 'NULL') . ', \'' . addslashes($s_attribute_type_lookup_r['value']) . '\', \'' . addslashes($s_attribute_type_lookup_r['display']) . '\', \'' . addslashes($s_attribute_type_lookup_r['img']) . '\', \'' . $s_attribute_type_lookup_r['checked_ind'] . '\' );'; } db_fetch_assoc($result2); $attr_lookup_sql .= $CRLF; } } $item_attr_sql .= $CRLF . 'INSERT INTO s_item_attribute_type ( s_item_type, s_attribute_type, order_no, prompt, instance_attribute_ind, compulsory_ind, printable_ind, rss_ind ) VALUES ( \'' . $s_item_type . '\', \'' . $s_item_attribute_type_r['s_attribute_type'] . '\', ' . $s_item_attribute_type_r['order_no'] . ', ' . (strlen($s_item_attribute_type_r['prompt']) > 0 ? '\'' . $s_item_attribute_type_r['prompt'] . '\'' : 'NULL') . ', \'' . $s_item_attribute_type_r['instance_attribute_ind'] . '\', \'' . $s_item_attribute_type_r['compulsory_ind'] . '\', \'' . $s_item_attribute_type_r['printable_ind'] . '\', \'' . $s_item_attribute_type_r['rss_ind'] . '\' );'; } db_fetch_assoc($result); } if (strlen($attr_sql) > 0) { $attr_sql = $CRLF . '#' . $CRLF . '# Attributes (non-core)' . $CRLF . '#' . $attr_sql; } $sqlscript = '#########################################################' . $CRLF . '# OpenDb ' . get_opendb_version() . ' \'' . $s_item_type . '\' Item Type' . $CRLF . '#########################################################' . $CRLF . $type_sql . $attr_sql . $CRLF . $item_attr_sql . $CRLF . $attr_lookup_sql; return $sqlscript; } else { return NULL; } }
/** * Return TRUE if up to date, otherwise FALSE * * Assumes database exists */ function check_opendb_version() { $opendb_release_version = fetch_opendb_release_version(); if ($opendb_release_version !== FALSE) { // the $opendb_release_version is unlikely to be larger than get_opendb_version(), // so this could be simplified to a '=', but leave as is. if (opendb_version_compare($opendb_release_version, get_opendb_version(), '>=')) { return TRUE; } } //else return FALSE; }
function get_hello_param() { return "opendb+" . get_http_env('HTTP_HOST') . "+" . urlencode(get_opendb_config_var('site', 'title')) . "+" . get_opendb_version(); }