Browse code

admin/versioncheck.php: bring back original versioncheck.php script, but update it for the following: URL change, remove any padding in version number output, update ancient user agent for cURL version, severely limit version number character count (should not exceed 7 at the moment), preliminary check for invalid version numbers (will not output a Github link if that ever happens)

Clarissa Walker authored on 2026/11/13 11:24:07
Showing 1 changed files
... ...
@@ -1,42 +1,114 @@
1
-<?php
2
-
3
-// ----------------------------------------------------------------------
4
-// eFiction 3.2
5
-// Copyright (c) 2007 by Tammy Keefer
6
-// Valid HTML 4.01 Transitional
7
-// Based on eFiction 1.1
8
-// Copyright (C) 2003 by Rebecca Smallwood.
9
-// http://efiction.sourceforge.net/
10
-// ----------------------------------------------------------------------
11
-// LICENSE
12
-//
13
-// This program is free software; you can redistribute it and/or
14
-// modify it under the terms of the GNU General Public License (GPL)
15
-// as published by the Free Software Foundation; either version 2
16
-// of the License, or (at your option) any later version.
17
-//
18
-// This program is distributed in the hope that it will be useful,
19
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
-// GNU General Public License for more details.
22
-//
23
-// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
-// ----------------------------------------------------------------------
25
-
26
-if(!defined("_CHARSET")) exit( );
27
-
28
-
29
-	$currentversion = "0.9.0";
30
-
31
-	$output .= "<div id=\"pagetitle\">"._VERSIONCHECK."</div>";
32
-
33
- 
34
-	 $output .= write_message(_CURRENTVERSION. "$currentversion");
35
-
36
-	if ($currentversion != $version) {
37
-	$output .= write_message (_UPDATEVERSION);
38
-	}
39
-	else $output .= write_message (_UPTODATE);
40
- 
41
-
42
-?>
1
+<?php
2
+
3
+// ----------------------------------------------------------------------
4
+// eFiction 3.2
5
+// Copyright (c) 2007 by Tammy Keefer
6
+// Valid HTML 4.01 Transitional
7
+// Based on eFiction 1.1
8
+// Copyright (C) 2003 by Rebecca Smallwood.
9
+// http://efiction.sourceforge.net/
10
+// ----------------------------------------------------------------------
11
+// LICENSE
12
+//
13
+// This program is free software; you can redistribute it and/or
14
+// modify it under the terms of the GNU General Public License (GPL)
15
+// as published by the Free Software Foundation; either version 2
16
+// of the License, or (at your option) any later version.
17
+//
18
+// This program is distributed in the hope that it will be useful,
19
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+// GNU General Public License for more details.
22
+//
23
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
+// ----------------------------------------------------------------------
25
+
26
+if(!defined("_CHARSET")) exit( );
27
+
28
+
29
+
30
+	$output .= "<div id=\"pagetitle\">"._VERSIONCHECK."</div>";
31
+
32
+	$url = 'http://cwcyrix.nsupdate.info/_ef3m/version.txt';
33
+
34
+	// make sure curl is installed
35
+	if (function_exists('curl_init')) {
36
+		$output .= write_message(_RUNNINGVERSION);
37
+		// initialize a new curl resource
38
+		$ch = curl_init();
39
+
40
+		// set the url to fetch
41
+		curl_setopt($ch, CURLOPT_URL, "$url");
42
+
43
+		// don't give me the headers just the content
44
+		curl_setopt($ch, CURLOPT_HEADER, 0);
45
+
46
+		// return the value instead of printing the response to browser
47
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
48
+
49
+		// use a user agent to mimic a browser
50
+		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:156.0) Gecko/20100101 Firefox/156.0');
51
+
52
+		$content = curl_exec($ch);
53
+		$currentversion = trim($content);
54
+		$curlength = strlen($currentversion);
55
+
56
+		if($curlength < 3 || $curlength > 7) {
57
+			errorVer();
58
+		}
59
+		else $output .= write_message(_CURRENTVERSION. "$currentversion" .".");
60
+
61
+		if ($currentversion != $version) {
62
+			$output .= write_message (_UPDATEVERSION);
63
+			$output .= write_message ("<a href=\"https://github.com/AmiSapphire/efiction3-mod/tags/".$currentversion."\">https://github.com/AmiSapphire/efiction3-mod/tags/".$currentversion."</a>");
64
+		}
65
+		else $output .= write_message (_UPTODATE);
66
+
67
+		// remember to always close the session and free all resources
68
+		// deprecated in PHP 8.5.0, does nothing since PHP 8.0.0
69
+		// bugged? - https://www.php.net/manual/en/function.curl-close.php#128829
70
+		if (version_compare(PHP_VERSION, '7.3.33', '<=')) {
71
+			curl_close($ch);
72
+		}
73
+		else curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
74
+	}
75
+
76
+	else if(ini_get("allow_url_fopen")) {
77
+		$output .= write_message(_RUNNINGVERSION);
78
+
79
+		$location = fopen ("$url", "r");
80
+		$buffer = '';
81
+		while (!feof ($location)) {
82
+			$buffer .= fgets($location, 4096);
83
+		}
84
+		fclose ($location);
85
+
86
+		if ($buffer != '') {
87
+			$currentversion = trim($buffer);
88
+			$curlength = strlen($currentversion);
89
+
90
+			if($curlength < 3 || $curlength > 7) {
91
+				errorVer();
92
+			}
93
+			else $output .= write_message(_CURRENTVERSION. "$currentversion" .".");
94
+
95
+			if ($currentversion != $version) {
96
+			$output .= write_message (_UPDATEVERSION);
97
+			$output .= write_message ("<a href=\"https://github.com/AmiSapphire/efiction3-mod/tags/".$currentversion."\">https://github.com/AmiSapphire/efiction3-mod/tags/".$currentversion."</a>");
98
+			}
99
+			else $output .= write_message (_UPTODATE);
100
+		}
101
+	}
102
+	else {	
103
+		$output .= write_message(_VERSIONNOTALLOWED);
104
+	}
105
+
106
+function errorVer(){
107
+	global $tpl,$output;
108
+
109
+	$output .= write_error("<center>Not a version number!</center>");
110
+	$tpl->assign("output", $output);
111
+	$tpl->printToScreen( );
112
+}
113
+
114
+?>
Browse code

change version numbering scheme to eFiction 3 Mod 0.9.0

Clarissa Walker authored on 2026/11/09 20:23:15
Showing 1 changed files
... ...
@@ -26,7 +26,7 @@
26 26
 if(!defined("_CHARSET")) exit( );
27 27
 
28 28
 
29
-	$currentversion = "3.5.6";
29
+	$currentversion = "0.9.0";
30 30
 
31 31
 	$output .= "<div id=\"pagetitle\">"._VERSIONCHECK."</div>";
32 32
 
... ...
@@ -39,4 +39,4 @@ if(!defined("_CHARSET")) exit( );
39 39
 	else $output .= write_message (_UPTODATE);
40 40
  
41 41
 
42
-?>
43 42
\ No newline at end of file
43
+?>
Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,42 @@
1
+<?php
2
+
3
+// ----------------------------------------------------------------------
4
+// eFiction 3.2
5
+// Copyright (c) 2007 by Tammy Keefer
6
+// Valid HTML 4.01 Transitional
7
+// Based on eFiction 1.1
8
+// Copyright (C) 2003 by Rebecca Smallwood.
9
+// http://efiction.sourceforge.net/
10
+// ----------------------------------------------------------------------
11
+// LICENSE
12
+//
13
+// This program is free software; you can redistribute it and/or
14
+// modify it under the terms of the GNU General Public License (GPL)
15
+// as published by the Free Software Foundation; either version 2
16
+// of the License, or (at your option) any later version.
17
+//
18
+// This program is distributed in the hope that it will be useful,
19
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+// GNU General Public License for more details.
22
+//
23
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
+// ----------------------------------------------------------------------
25
+
26
+if(!defined("_CHARSET")) exit( );
27
+
28
+
29
+	$currentversion = "3.5.6";
30
+
31
+	$output .= "<div id=\"pagetitle\">"._VERSIONCHECK."</div>";
32
+
33
+ 
34
+	 $output .= write_message(_CURRENTVERSION. "$currentversion");
35
+
36
+	if ($currentversion != $version) {
37
+	$output .= write_message (_UPDATEVERSION);
38
+	}
39
+	else $output .= write_message (_UPTODATE);
40
+ 
41
+
42
+?>
0 43
\ No newline at end of file