LEPTON CMS 7.2.0
feel free to keep it strictly simple...
Loading...
Searching...
No Matches
function.get_modul_version.php
Go to the documentation of this file.
1<?php
2
18// include secure.php to protect this file and the whole CMS!
19if(!defined("SEC_FILE")){define("SEC_FILE",'/framework/secure.php' );}
20if (defined('LEPTON_PATH')) {
21 include LEPTON_PATH.SEC_FILE;
22} else {
23 $oneback = "../";
24 $root = $oneback;
25 $level = 1;
26 while (($level < 10) && (!file_exists($root.SEC_FILE))) {
27 $root .= $oneback;
28 $level += 1;
29 }
30 if (file_exists($root.SEC_FILE)) {
31 include $root.SEC_FILE;
32 } else {
33 trigger_error(sprintf("[ <b>%s</b> ] Can't include secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
34 }
35}
36// end include secure file
37
38
48function get_modul_version(string $modulname, bool $source = true): string|null
49{
51 $version = null;
52 if ($source === false)
53 {
54 $sql = "SELECT `version` FROM `" . TABLE_PREFIX . "addons` WHERE `directory`='" . $modulname . "'";
55 $version = $database->get_one($sql);
56 }
57 else
58 {
59 $info_file = LEPTON_PATH . '/modules/' . $modulname . '/info.php';
60 if (file_exists($info_file))
61 {
62 $module_version = null;
63 require $info_file;
64 $version = &$module_version;
65 }
66 }
67 return $version;
68}
static getInstance(array &$settings=[])
$database
Definition constants.php:52
get_modul_version(string $modulname, bool $source=true)