Commit 8d5be1cd6feb3e375d44a4de3c782fcdb65c340a

Authored by Neil Blakey-Milner
1 parent d7e257d6

Implement getSystemIdentifier, a unique, information-free, identifier

for the system.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5567 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 20 additions and 2 deletions
lib/util/ktutil.inc
... ... @@ -640,9 +640,27 @@ class KTUtil {
640 640 }
641 641 }
642 642  
  643 + function getSystemIdentifier() {
  644 + $sIdentifier = KTUtil::getSystemSetting('kt_system_identifier');
  645 + if (empty($sIdentifier)) {
  646 + $sIdentifier = md5(uniqid(mt_rand(), true));
  647 + KTUtil::setSystemSetting('kt_system_identifier', $sIdentifier);
  648 + }
  649 + return $sIdentifier;
  650 + }
  651 +
643 652 function getKTVersions() {
644   - return array('OSS' => '3.0.3',
645   - 'Pro' => '1.0.0');
  653 + $aVersions = array();
  654 + $sProfessionalFile = KT_DIR . '/docs/VERSION-PRO.txt';
  655 + $sOssFile = KT_DIR . '/docs/VERSION-OSS.txt';
  656 + if (file_exists($sProfessionalFile)) {
  657 + $sVersion = trim(file_get_contents($sProfessionalFile));
  658 + $aVersions['Pro'] = $sVersion;
  659 + } else {
  660 + $sVersion = trim(file_get_contents($sOssFile));
  661 + $aVersions['OSS'] = $sVersion;
  662 + }
  663 + return $aVersions;
646 664 }
647 665  
648 666 }
... ...