LEPTON CMS 7.1.0
feel free to keep it strictly simple...
Loading...
Searching...
No Matches
function.load_language.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
45function load_language( $file )
46{
47 global $MESSAGE;
49
50 if ( file_exists( LEPTON_PATH.'/languages/'.$file ) && preg_match( '#^([A-Z]{2}[_custom]{0,1}.php)#', basename( $file ) ) )
51 {
52 $language_license = null;
53 $language_code = null;
54 $language_version = null;
55 $language_delete = true;
56 $language_guid = null;
57 $language_name = null;
58 $language_author = null;
59 $language_platform = null;
60
61 require LEPTON_PATH.'/languages/'.$file;
62
63 if ( ( $language_license == NULL )
64 || ( $language_code == NULL )
65 || ( $language_version == NULL )
66 || ( $language_guid == NULL )
67 )
68 {
69 echo(LEPTON_tools::display($MESSAGE[ "LANG_MISSING_PARTS_NOTICE" ]. $language_name, 'pre','ui red message'));
70 }
71
72 // Check that it doesn't already exist
73 $sqlwhere = '`type` = \'language\' AND `directory` = \'' . $language_directory . '\'';
74 $sql = 'SELECT COUNT(*) FROM `' . TABLE_PREFIX . 'addons` WHERE ' . $sqlwhere;
75 if ( $database->get_one( $sql ) )
76 {
77 $sql_job = "update";
78 }
79 else
80 {
81 $sql_job = "insert";
82 $sqlwhere = '';
83 }
84
85 $fields = array(
86 'directory' => $language_directory,
87 'name' => $language_name,
88 'type' => 'language',
89 'version' => $language_version,
90 'platform' => $language_platform,
91 'author' => addslashes( $language_author ),
92 'license' => addslashes( $language_license ),
93 'to_delete' => intval( $language_delete ),
94 'guid' => $language_guid,
95 'description' => ""
96 );
97
98 $database->build_and_execute(
99 $sql_job,
100 TABLE_PREFIX . "addons",
101 $fields,
102 $sqlwhere
103 );
104 }
105}
static getInstance(array &$settings=[])
static display(mixed $something_to_display="", string $tag="pre", string|null $css_class=null)
$database
Definition constants.php:52
load_language( $file)