diff --git a/tftpboot/index.cnf b/tftpboot/index.cnf
index fd91003..15e47de 100644
--- a/tftpboot/index.cnf
+++ b/tftpboot/index.cnf
@@ -1,7 +1,7 @@
[main]
debug = on ; The output in the browser window for more information
-
tftproot = /tftpboot
+;default_language = English_United_States
;firmware = firmware
;settings = settings
@@ -10,4 +10,3 @@ tftproot = /tftpboot
;locales = locales
;countries = locales/countries
;languages = locales/languages
-;default_language = English_United_States
diff --git a/tftpboot/index.php b/tftpboot/index.php
index 7607245..a5084a0 100644
--- a/tftpboot/index.php
+++ b/tftpboot/index.php
@@ -3,35 +3,34 @@
// Written by Alex / github.com/PhantomVI
//
-//Setup should be moved to ini/json file
-// -- tftpboot path
+$base_path = realpath($_SERVER['DOCUMENT_ROOT']);
+$base_config = Array(
+ 'debug' => 1,
+ 'tftproot' => $base_path,
+ 'default_language' => 'English_United_States',
+ 'firmware' => 'firmware', 'settings' => 'settings', 'wallpapers' => 'wallpapers', 'ringtones' => 'ringtones',
+ 'locales' => 'locales', 'countries' => 'countries', 'languages' => 'languages'
+);
+# Merge config
$ini_array = parse_ini_file('index.cnf');
if (!empty($ini_array)) {
- foreach ($ini_array as $key => $value) {
- $config[$key] = $value;
- }
+ $config = array_merge($base_config, $ini_array);
}
-if (empty($config['firmware'])) { $config['firmware'] = 'firmware';}
-if (empty($config['settings'])) {$config['settings'] = 'settings';}
-if (empty($config['wallpapers'])) {$config['wallpapers'] = 'wallpapers';}
-if (empty($config['ringtones'])) {$config['ringtones'] = 'ringtones';}
-if (empty($config['locales'])) {$config['locales'] = 'locales';}
-if (empty($config['countries'])) {$config['countries'] = 'countries';}
-if (empty($config['languages'])) {$config['languages'] = 'languages';}
-if (empty($config['default_language'])) {$config['default_language'] = $config['languages']. 'English_United_States';}
+#$config['tftproot'] = (!empty($config['tftproot'])) ? $config['tftproot'] : '/tftpboot';
-$config['tftproot'] = (!empty($config['tftproot'])) ? $config['tftproot'] : '/tftpboot';
+# Fixup debug
$print_debug = (!empty($config['debug'])) ? $config['debug'] : 'off';
$print_debug = ($print_debug == 1) ? 'on' : $print_debug;
+# Parse request
$request = $_REQUEST;
$req_file = !empty($request['id']) ? $request['id'] : '';
-// -- TFTPD - structure
-//$fw_suffix = array('bin', 'loads', 'sbn', 'sb2', 'sbin', 'zz', 'zup');
+# directory content extensions map
$fw_suffix = array('.bin', '.loads', '.sbn', '.sb2', '.sbin', '.zz', '.zup');
+
//$settings_suffix = array('cnf.xml');
$ringtones_list = array('distinctive.xml', 'ringlist.xml');
@@ -39,6 +38,7 @@ $ringtones_list = array('distinctive.xml', 'ringlist.xml');
$locale_list = array('-dictionary.', 'dictionary-ext.', '-dictionary.utf-8.', '-kate.xml', '-font.xml', '-font.dat','-tones.xml',
'be-sccp.jar', 'tc-sccp.jar', 'td-sccp.jar', 'ipc-sccp.jar', 'mk-sccp.jar', '_locale.loads', 'i-button-help.xml');
+# Show debug output
if ($print_debug == 'on') {
print_r("
Config:
"); print_r($config); @@ -48,6 +48,7 @@ if ($print_debug == 'on') { print(""); } +# Start parsing the request $req_file_full_path = '' ; if (!empty($req_file)) {