Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 1425 → Rev 1426

/trunk/includes/classes/OIDplus.class.php
1901,14 → 1901,6
public static function getInstallType() {
$counter = 0;
 
if ($new_version_file_exists = file_exists(OIDplus::localpath().'.version.php')) {
$counter++;
}
if ($old_version_file_exists = file_exists(OIDplus::localpath().'oidplus_version.txt')) {
$counter++;
}
$version_file_exists = $old_version_file_exists | $new_version_file_exists;
 
if ($svn_dir_exists = (OIDplus::findSvnFolder() !== false)) {
$counter++;
}
1916,10 → 1908,7
$counter++;
}
 
if ($counter === 0) {
return 'unknown'; // do not translate
}
else if ($counter > 1) {
if ($counter > 1) {
return 'ambigous'; // do not translate
}
else if ($svn_dir_exists) {
1928,8 → 1917,8
else if ($git_dir_exists) {
return 'git-wc'; // do not translate
}
else if ($version_file_exists) {
return 'svn-snapshot'; // do not translate
else {
return 'manual'; // do not translate
}
}
 
1955,14 → 1944,36
}
 
/**
* @param string $infoFile Path to a changelog.json.php file (It must be in its source code form!)
* @param bool $allow_dev_version If set to false, then versions ending with "-dev" will be ignored
* @return false|string
*/
public static function getVersion() {
static $cachedVersion = null;
if (!is_null($cachedVersion)) {
return $cachedVersion;
public static function getVersion(string $infoFile = __DIR__.'/../../changelog.json.php', bool $allow_dev_version=true) {
static $cachedVersion = [];
if ($cachedVersion[$infoFile] ?? false) {
return $cachedVersion[$infoFile];
}
 
if ((stripos($infoFile,'http://')===0) || (stripos($infoFile,'https://')===0)) {
$cont = @url_get_contents($infoFile);
} else {
$cont = @file_get_contents($infoFile);
}
if ($cont === false) return false;
$json = @json_decode($cont, true);
if ($json === null) return false;
$latest_version = false;
foreach ($json as $v) {
if (isset($v['version'])) {
if (!$allow_dev_version && str_ends_with($v['version'],'-dev')) continue;
$latest_version = $v['version'];
break; // the first item is the latest version
}
}
return ($cachedVersion[$infoFile] = $latest_version);
 
/*
 
$installType = OIDplus::getInstallType();
 
if ($installType === 'svn-wc') {
1969,7 → 1980,7
if (is_dir($svn_dir = OIDplus::findSvnFolder())) {
$ver = get_svn_revision($svn_dir);
if ($ver)
return ($cachedVersion = 'svn-'.$ver);
return ($cachedVersion[$infoFile] = 'svn-'.$ver);
}
}
 
1976,10 → 1987,10
if ($installType === 'git-wc') {
$ver = OIDplus::getGitsvnRevision();
if ($ver)
return ($cachedVersion = 'svn-'.$ver);
return ($cachedVersion[$infoFile] = 'svn-'.$ver);
}
 
if ($installType === 'svn-snapshot') {
if ($installType === 'manual') {
$cont = '';
if (file_exists($filename = OIDplus::localpath().'oidplus_version.txt'))
$cont = file_get_contents($filename);
1987,10 → 1998,12
$cont = file_get_contents($filename);
$m = array();
if (preg_match('@Revision (\d+)@', $cont, $m)) // do not translate
return ($cachedVersion = 'svn-'.$m[1]); // do not translate
return ($cachedVersion[$infoFile] = 'svn-'.$m[1]); // do not translate
}
 
return ($cachedVersion = false); // version ambigous or unknown
return ($cachedVersion[$infoFile] = false); // version ambigous or unknown
 
*/
}
 
const ENFORCE_SSL_NO = 0;
/trunk/includes/edition.ini
14,19 → 14,16
; Distribution channels
gitrepo = https://github.com/danielmarschall/oidplus
svnrepo = https://svn.viathinksoft.com/svn/oidplus
; Note: downloadpage can also be GitHub (= "releases")
downloadpage = https://www.oidplus.com/download.php
 
; Master changelog (is updated by hand)
master_changelog = https://raw.githubusercontent.com/danielmarschall/oidplus/master/changelog.json.php
 
; These files can be created using plugins/viathinksoft/adminPages/900_software_update/private/
revisionlog = https://www.oidplus.com/updates/releases.ser
revisionlog_gz = https://www.oidplus.com/updates/releases.ser.gz
update_package = https://www.oidplus.com/updates/update_%s_to_%s.txt
update_package_gz = https://www.oidplus.com/updates/update_%s_to_%s.txt.gz
; They can also be put on an extra GitHub repo
update_packages = https://www.oidplus.com/updates/v3/
 
; These files can be created using plugins/viathinksoft/adminPages/902_systemfile_check/private/
checksum_file = https://www.oidplus.com/checksums/svn-rev%s.txt
; Server runs https://websvnphp.github.io/ Web UI
svn_original = "https://svn.viathinksoft.com/websvn/filedetails.php?repname=oidplus&path=%%2Ftrunk%%2F%s&rev=%s"
 
; Note: More things to change:
; - /res/
; - /plugins/viathinksoft/publicPages/000_objects/welcome*.html
/trunk/includes/oidplus.inc.php
73,8 → 73,8
require_once __DIR__ . '/../vendor/danielmarschall/php_utils/ipv4_functions.inc.php';
require_once __DIR__ . '/../vendor/danielmarschall/php_utils/ipv6_functions.inc.php';
require_once __DIR__ . '/../vendor/danielmarschall/php_utils/anti_xss.inc.php';
require_once __DIR__ . '/../vendor/danielmarschall/php_utils/git_utils.inc.php';
require_once __DIR__ . '/../vendor/danielmarschall/php_utils/svn_utils.inc.php';
//require_once __DIR__ . '/../vendor/danielmarschall/php_utils/git_utils.inc.php';
//require_once __DIR__ . '/../vendor/danielmarschall/php_utils/svn_utils.inc.php';
require_once __DIR__ . '/../vendor/danielmarschall/php_utils/aid_decoder.inc.php';
require_once __DIR__ . '/../vendor/danielmarschall/php_utils/misc_functions.inc.php';
require_once __DIR__ . '/../vendor/danielmarschall/php_utils/vts_crypt.inc.php';