diff --git a/admin/schema.php b/admin/schema.php index adae36fe1e..7f2faebd46 100644 --- a/admin/schema.php +++ b/admin/schema.php @@ -411,5 +411,4 @@ $upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), " filter_by L NOTNULL DEFAULT \" '1' \"" ) ); -#$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_version_table' ), " -# upgrade_tag C(128) NOTNULL DEFAULT '' " ) ); + diff --git a/check_version.php b/check_version.php deleted file mode 100644 index 8e1215e0ce..0000000000 --- a/check_version.php +++ /dev/null @@ -1,121 +0,0 @@ -. - -/** - * @package MantisBT - * @version $Id$ - * @copyright Copyright (C) 2000 - 2008 Mantis Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -require_once( 'core.php' ); - -$t_core_path = config_get( 'core_path' ); - -require_once( $t_core_path . 'version_api.php' ); - -$f_protocol_version = gpc_get_int( 'protocol_version', -1 ); -$f_project_id = gpc_get_int( 'project_id', -1 ); -$f_version = gpc_get_string( 'version', '' ); - -# Make sure that IE can download the attachments under https. -header( 'Pragma: public' ); -header( 'Content-Type: text/plain' ); - -# Protocol Version 1 -# -# -# -# -# operation result: up_to_date | update_available | access_denied | failure -# -# up_to_date has no parameters -# -# update_available Parameters: -# latest version -# changelog link -# version description -# -# Access Denied has no parameters. Issue for case where access is denied or project/version doesn't exist. -# -# Failure: -# error message (e.g. database failure, in maintenance, etc) - -$t_latest_supported_protocol = 1; -$t_access_denied_string = VERSION_CHECK_ACCESS_DENIED . "\n"; -$t_failure_string = VERSION_CHECK_FAILURE . "\n"; - -# Make sure protocol version is specified. -if ( $f_protocol_version == -1 ) { - echo $t_failure_string, "protocol version not specified.\n"; - die; -} - -# Make sure request version is supported. -if ( $f_protocol_version < 1 || $f_protocol_version > $t_latest_supported_protocol ) { - echo $t_failure_string, "protocol version '" . $f_protocol_version . "' not supported.\n"; - die; -} - -# Make sure project id is specified. -if ( $f_project_id == -1 ) { - echo $t_failure_string, "project id not specified.\n"; - die; -} - -# Make sure version name is specified. -if ( $f_version == '' ) { - echo $t_failure_string, "version name not specified.\n"; - die; -} - -# Retrieve configuration -$t_public_projects = config_get( 'check_version_for_public_projects_enabled' ); -$t_private_projects = config_get( 'check_version_for_public_projects_enabled' ); - -# if the feature is disabled for all kinds of projects, then return access denied response. -if ( !$t_public_projects && !$t_private_projects ) { - echo $t_access_denied_string; - die; -} - -# if only public projects available, make sure the request is not referring to a public project. -if ( !$t_private_projects ) { - $t_view_state = project_get_field( $f_project_id, 'view_state'); - if ( $t_view_state != VS_PUBLIC ) { - echo $t_access_denied_string; - die; - } -} - -$t_client_version_id = version_get_id( $f_version, $f_project_id ); -if ( $t_client_version_id === false ) { - echo $t_failure_string, "version not found.\n"; - die; -} - -$t_version = version_get_latest_by_upgrade_tag( $t_client_version_id ); - -if ( $t_version->id == $t_client_version_id ) { - echo VERSION_CHECK_UP_TO_DATE . "\n"; - die; -} - -echo VERSION_CHECK_UPDATE_AVAILABLE . "\n"; -echo $t_version->version, "\n"; -$t_path = config_get( 'path' ); -echo $t_path . "changelog_page.php?version=", $t_version->id, "\n"; -echo $t_version->description, "\n"; \ No newline at end of file diff --git a/config_defaults_inc.php b/config_defaults_inc.php index 5cebfb6b75..1027afd16a 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -2038,21 +2038,3 @@ # threshold to see due date $g_due_date_view_threshold = NOBODY; - ############################# - # Checking for Updates - ############################# - - # Ability for applications to anonymously check for updates available for public projects. - # This feature exposes the availability of released version names, project ids, and the - # version descriptions. This feature works independent of anonymous access. - $g_check_version_for_public_projects_enabled = OFF; - - # Ability for clients to anonymously check for updates available for private projects. - # This feature exposes the availability of released version names, project ids, and the - # version descriptions. This feature works independent of anonymous access. - $g_check_version_for_private_projects_enabled = OFF; - - # Enable Mantis checking for updates for its own code base. - # This is shown for administrators on the Manage Overview Page. - # @@@ Apache seems to crash if remote URL is not found. - $g_check_version_for_mantis_enabled = OFF; \ No newline at end of file diff --git a/core/check_version_api.php b/core/check_version_api.php deleted file mode 100644 index 638f213c64..0000000000 --- a/core/check_version_api.php +++ /dev/null @@ -1,127 +0,0 @@ -. - -/** - * @package MantisBT - * @version $Id$ - * @copyright Copyright (C) 2000 - 2008 Mantis Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * A class that includes the response information of a version update check. - */ -class VersionUpdateInfo -{ - var $result = ''; - var $name = ''; - var $changelog_url = ''; - var $description = ''; -} - -/** - * Retrieve contents from remotely stored file - */ -function get_remote_file( $host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 10 ) { - if ( $fsock = @fsockopen( $host, $port, $errno, $errstr, $timeout ) ) { - @fputs( $fsock, "GET $directory/$filename HTTP/1.1\r\n" ); - @fputs( $fsock, "HOST: $host\r\n" ); - @fputs( $fsock, "Connection: close\r\n\r\n" ); - - $file_info = ''; - $get_info = false; - - while ( !@feof( $fsock ) ) { - if ( $get_info ) { - $file_info .= @fread( $fsock, 1024 ); - } else { - $line = @fgets( $fsock, 1024 ); - if ( $line == "\r\n" ) { - $get_info = true; - } else if ( stripos( $line, '404 not found') !== false ) { - $errstr = '404'; - return false; - } - } - } - - @fclose($fsock); - } else { - if ( $errstr ) { - return false; - } - - $errstr = 'fsock open disabled.'; - return false; - } - - return $file_info; -} - -/** - * Connects to Mantis Bug Tracker to retrieve the latest release that is considered an update to the current release. - */ -function version_check() { - $t_errstr = ''; - $t_errno = 0; - $t_version_update = new VersionUpdateInfo(); - - $t_context = stream_context_create(array( - 'http' => array( - 'timeout' => 1 - ) - ) - ); - - #$t_result = @file_get_contents( 'http://127.0.0.1/mantisbt/check_version.php?protocol_version=1&project_id=1&version=1.0.0' ); - $t_result = @file_get_contents( 'http://www.mantisbt.org/bugs/check_version.php?protocol_version=1&project_id=1&version=1.0.0', 0, $t_context ); - #$t_result = get_remote_file( '127.0.0.1', '/mantisbt', 'check_version.php?protocol_version=1&project_id=1&version=1.0.0', $t_errstr, $t_errno ); - #$t_result = get_remote_file( 'mantisbt.org', '/bugs', 'check_version.php?protocol_version=1&project_id=1&version=' . urlencode( MANTIS_VERSION ), $t_errstr, $t_errno, 80, 1 ); - - # If unable to read the file, then try another attempt with the sub-domain format. - if ( $t_result === false || is_blank( $t_result ) || $t_errno != 0 ) { - $t_version_update->result = 'failure'; - $t_version_update->description = $t_errno . ': ' . $t_errstr; - return $t_version_update; - } - - $t_lines = explode( "\n", $t_result, 4 ); - - switch ( $t_lines[0] ) { - case VERSION_CHECK_UP_TO_DATE: - $t_version_update->result = $t_lines[0]; - break; - case VERSION_CHECK_UPDATE_AVAILABLE: - $t_version_update->result = $t_lines[0]; - $t_version_update->name = $t_lines[1]; - $t_version_update->changelog_url = $t_lines[2]; - $t_version_update->description = $t_lines[3]; - break; - case VERSION_CHECK_ACCESS_DENIED: - $t_version_update->result = $t_lines[0]; - break; - case VERSION_CHECK_FAILURE: - default: - $t_version_update->result = VERSION_CHECK_FAILURE; - if ( isset( $t_lines[1] ) ) { - $t_version_update->description = $t_lines[1]; - } - break; - } - - return $t_version_update; -} -?> \ No newline at end of file diff --git a/core/constant_inc.php b/core/constant_inc.php index f8999b337b..7e8444ae64 100644 --- a/core/constant_inc.php +++ b/core/constant_inc.php @@ -466,9 +466,3 @@ # Timeline types define( 'TIMELINE_TARGETTED', 1 ); define( 'TIMELINE_FIXED', 2 ); - -# Version Check Result Strings -define( 'VERSION_CHECK_UP_TO_DATE', 'up_to_date' ); -define( 'VERSION_CHECK_UPDATE_AVAILABLE', 'update_available' ); -define( 'VERSION_CHECK_ACCESS_DENIED', 'access_denied' ); -define( 'VERSION_CHECK_FAILURE', 'failure' ); diff --git a/core/version_api.php b/core/version_api.php index 49533f856a..7e7bc98f0a 100644 --- a/core/version_api.php +++ b/core/version_api.php @@ -31,7 +31,6 @@ class VersionData { var $id = 0; var $project_id = 0; var $version = ''; - var $upgrade_tag = ''; var $description = ''; var $released = VERSION_FUTURE; var $date_order = ''; @@ -122,14 +121,15 @@ function version_ensure_unique( $p_version, $p_project_id = null ) { # =================================== # -------------------- # Add a version to the project -function version_add( $p_project_id, $p_version, $p_released = VERSION_FUTURE, $p_description = '', $p_date_order = null, $p_obsolete = false, $p_upgrade_tag = '' ) { +function version_add( $p_project_id, $p_version, $p_released = VERSION_FUTURE, $p_description = '', $p_date_order = null, $p_obsolete = false ) { $c_project_id = db_prepare_int( $p_project_id ); $c_released = db_prepare_int( $p_released ); $c_obsolete = db_prepare_bool( $p_obsolete ); if( null === $p_date_order ) { $c_date_order = db_now(); - } else { + } + else { $c_date_order = db_timestamp( $p_date_order ); } @@ -138,10 +138,10 @@ function version_add( $p_project_id, $p_version, $p_released = VERSION_FUTURE, $ $t_project_version_table = db_get_table( 'mantis_project_version_table' ); $query = "INSERT INTO $t_project_version_table - ( project_id, version, upgrade_tag, date_order, description, released, obsolete ) + ( project_id, version, date_order, description, released, obsolete ) VALUES - (" . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )'; - db_query_bound( $query, array( $c_project_id, $p_version, $p_upgrade_tag, $c_date_order, $p_description, $c_released, $c_obsolete ) ); + (" . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )'; + db_query_bound( $query, Array( $c_project_id, $p_version, $c_date_order, $p_description, $c_released, $c_obsolete ) ); # db_query errors on failure so: return true; @@ -163,7 +163,6 @@ function version_update( $p_version_info ) { $c_version_name = $p_version_info->version; $c_old_version_name = $t_old_version_name; $c_description = $p_version_info->description; - $c_upgrade_tag = $p_version_info->upgrade_tag; $c_released = db_prepare_int( $p_version_info->released ); $c_obsolete = db_prepare_bool( $p_version_info->obsolete ); $c_date_order = db_timestamp( $p_version_info->date_order ); @@ -174,13 +173,12 @@ function version_update( $p_version_info ) { $query = "UPDATE $t_project_version_table SET version=" . db_param() . ", - upgrade_tag =" . db_param() .", description=" . db_param() . ", released=" . db_param() . ", date_order=" . db_param() . ", obsolete=" . db_param() . " WHERE id=" . db_param(); - db_query_bound( $query, array( $c_version_name, $c_upgrade_tag, $c_description, $c_released, $c_date_order, $c_obsolete, $c_version_id ) ); + db_query_bound( $query, Array( $c_version_name, $c_description, $c_released, $c_date_order, $c_obsolete, $c_version_id ) ); if( $c_version_name != $c_old_version_name ) { $query = "UPDATE $t_bug_table @@ -209,30 +207,6 @@ function version_update( $p_version_info ) { return true; } -# -------------------- -# Get the latest version with the specified upgrade tag as the specified client version -function version_get_latest_by_upgrade_tag( $p_client_version_id ) { - $t_project_version_table = db_get_table( 'mantis_project_version_table' ); - - $t_client_version = version_get( $p_client_version_id ); - - $query = "SELECT id FROM $t_project_version_table - WHERE project_id = " . db_param() . " AND released = 1 AND upgrade_tag = " . db_param() . " - ORDER BY date_order DESC"; - - $t_result = db_query_bound( $query, array( $t_client_version->project_id, $t_client_version->upgrade_tag ), /* limit */ 1, /* offset */ 0 ); - if ( $t_result === false ) { - return $t_client_version; - } - - $t_row = db_fetch_array( $t_result ); - if ( $t_row === false ) { - return $t_client_version; - } - - return version_get( $t_row['id'] ); -} - # -------------------- # Remove a version from the project function version_remove( $p_version_id, $p_new_version = '' ) { @@ -298,7 +272,7 @@ function version_remove_all( $p_project_id ) { # =================================== # -------------------- # Return all versions for the specified project -function version_get_all_rows( $p_project_id, $p_released = null, $p_obsolete = false, $p_upgrade_tag = null ) { +function version_get_all_rows( $p_project_id, $p_released = null, $p_obsolete = false ) { global $g_cache_versions; $c_project_id = db_prepare_int( $p_project_id ); @@ -325,11 +299,6 @@ function version_get_all_rows( $p_project_id, $p_released = null, $p_obsolete = $query_params[] = $c_obsolete; } - if ( $p_upgrade_tag !== null ) { - $query .= " AND upgrade_tag = " . db_param( $t_param_count++ ); - $query_params[] = $p_upgrade_tag; - } - $query .= " ORDER BY date_order DESC"; $result = db_query_bound( $query, $query_params ); diff --git a/lang/strings_english.txt b/lang/strings_english.txt index 61f512ece8..1d0604114b 100644 --- a/lang/strings_english.txt +++ b/lang/strings_english.txt @@ -726,10 +726,6 @@ $s_schema_version = 'Schema Version'; $s_site_path = 'Site Path'; $s_core_path = 'Core Path'; $s_plugin_path = 'Plugin Path'; -$s_check_version_mantis_update = 'Mantis Updates Check'; -$s_check_version_up_to_date = 'Mantis version is up to date.'; -$s_check_version_update_available = 'Mantis \'%s\' is available.'; -$s_check_version_failure = 'Unable to check for latest Mantis version.'; # manage_create_new_user.php $s_created_user_part1 = 'Created user'; @@ -953,7 +949,6 @@ $s_released = 'Released'; $s_not_released = 'Not Yet Released'; $s_scheduled_release = 'Scheduled For Release'; $s_obsolete = 'Obsolete'; -$s_upgrade_tag = 'Upgrade Tag'; # manage_proj_version_update.php $s_version_updated_msg = 'Version has been successfully updated...'; diff --git a/manage_overview_page.php b/manage_overview_page.php index a5c6ef2272..3b174bd8c6 100644 --- a/manage_overview_page.php +++ b/manage_overview_page.php @@ -25,10 +25,6 @@ */ require_once( 'core.php' ); - $t_core_path = config_get( 'core_path' ); - - require_once( $t_core_path . 'check_version_api.php' ); - auth_reauthenticate(); access_ensure_global_level( config_get( 'manage_site_threshold' ) ); $t_is_admin = access_has_global_level( config_get( 'admin_site_threshold' ) ); @@ -53,48 +49,6 @@ - -> - -result ) { - case VERSION_CHECK_UP_TO_DATE: - echo lang_get( 'check_version_up_to_date' ); - break; - case VERSION_CHECK_UPDATE_AVAILABLE: - echo ''; - $t_hyperlinked_name = '' . $t_version_update_info->name . ''; - echo sprintf( lang_get( 'check_version_update_available' ), $t_hyperlinked_name ), '
'; - - if ( !is_blank( $t_version_update_info->description ) ) { - echo '
', nl2br( $t_version_update_info->description ); - } - - echo '
'; - break; - case VERSION_CHECK_FAILURE: - case VERSION_CHECK_ACCESS_DENIED: - echo ''; - echo lang_get( 'check_version_failure' ), '
'; - - # If there is an error include it. Note that the error is not localized and it shouldn't. - if ( !is_blank( $t_version_update_info->description ) ) { - echo '
', nl2br( $t_version_update_info->description ); - } - - echo '
'; - break; - } -?> - - - > diff --git a/manage_proj_edit_page.php b/manage_proj_edit_page.php index 420fd7c163..73a15c5daa 100644 --- a/manage_proj_edit_page.php +++ b/manage_proj_edit_page.php @@ -431,19 +431,16 @@ - - - - + - + - + - + @@ -452,7 +449,6 @@ foreach ( $t_versions as $t_version ) { $t_name = $t_version['version']; - $t_upgrade_tag = $t_version['upgrade_tag']; $t_released = $t_version['released']; $t_obsolete = $t_version['obsolete']; $t_date_order = $t_version['date_order']; @@ -463,9 +459,6 @@ - - - diff --git a/manage_proj_ver_edit_page.php b/manage_proj_ver_edit_page.php index 258dbd601e..152a69e09a 100644 --- a/manage_proj_ver_edit_page.php +++ b/manage_proj_ver_edit_page.php @@ -67,14 +67,6 @@ -> - - - - - - - > diff --git a/manage_proj_ver_update.php b/manage_proj_ver_update.php index 731ef4afac..ded6720f3e 100644 --- a/manage_proj_ver_update.php +++ b/manage_proj_ver_update.php @@ -40,7 +40,6 @@ $f_date_order = gpc_get_string( 'date_order' ); $f_new_version = gpc_get_string( 'new_version' ); - $f_upgrade_tag = gpc_get_string( 'upgrade_tag' ); $f_description = gpc_get_string( 'description' ); $f_released = gpc_get_bool( 'released' ); $f_obsolete = gpc_get_bool( 'obsolete' ); @@ -54,7 +53,6 @@ $f_new_version = trim( $f_new_version ); $t_version->version = $f_new_version; - $t_version->upgrade_tag = $f_upgrade_tag; $t_version->description = $f_description; $t_version->released = $f_released ? VERSION_RELEASED : VERSION_FUTURE; $t_version->obsolete = $f_obsolete;