diff --git a/Source/Source.php b/Source/Source.php old mode 100644 new mode 100755 index 5239fd4..1d0b9dc --- a/Source/Source.php +++ b/Source/Source.php @@ -66,6 +66,8 @@ 'remote_imports' => OFF, 'import_urls' => serialize( array( 'localhost' ) ), + + 'api_key' => '', ); } diff --git a/Source/lang/strings_english.txt b/Source/lang/strings_english.txt old mode 100644 new mode 100755 index cbe3ea2..31ec2ca --- a/Source/lang/strings_english.txt +++ b/Source/lang/strings_english.txt @@ -141,3 +141,5 @@ $s_plugin_Source_changeset_column_title = 'C'; +$s_plugin_Source_api_key = 'Secret API Key'; +$s_plugin_Source_api_key_info = 'This is a password to be used for GitHub and similar cloud-hosted sites that do not have a strict set of IP Addresses to allow.'; \ No newline at end of file diff --git a/Source/pages/checkin.php b/Source/pages/checkin.php old mode 100644 new mode 100755 index a03fdf8..2ca0c6b --- a/Source/pages/checkin.php +++ b/Source/pages/checkin.php @@ -49,6 +49,10 @@ } } +if ( gpc_get_string( 'api_key' ) == plugin_config_get( 'api_key' ) ) { + $t_valid = true; +} + # Not validated by this point gets the boot! if ( !$t_valid ) { die( plugin_lang_get( 'invalid_checkin_url' ) ); diff --git a/Source/pages/manage_config.php b/Source/pages/manage_config.php old mode 100644 new mode 100755 index 47b873b..3d064e6 --- a/Source/pages/manage_config.php +++ b/Source/pages/manage_config.php @@ -63,6 +63,8 @@ $t_checkin_urls = check_urls( $f_checkin_urls ); $t_import_urls = check_urls( $f_import_urls ); +$f_api_key = gpc_get_string( 'api_key' ); + function maybe_set_option( $name, $value ) { if ( $value != plugin_config_get( $name ) ) { plugin_config_set( $name, $value ); @@ -120,6 +122,8 @@ maybe_set_option( 'remote_imports', $f_remote_imports ); maybe_set_option( 'import_urls', serialize( $t_import_urls ) ); +maybe_set_option( 'api_key', $f_api_key ); + foreach( SourceVCS::all() as $t_type => $t_vcs ) { if ( $t_vcs->configuration ) { $t_vcs->update_config(); diff --git a/Source/pages/manage_config_page.php b/Source/pages/manage_config_page.php old mode 100644 new mode 100755 index 341e641..9d433e6 --- a/Source/pages/manage_config_page.php +++ b/Source/pages/manage_config_page.php @@ -185,6 +185,12 @@ ?> +> + +
+ + + $t_vcs ) { if ( $t_vcs->configuration ) {