+
+ function fix_extensions()
+ {
+ global $path_to_root, $next_extension_id, $installed_languages;
+
+ $lang_chd = false;
+ foreach($installed_languages as $i => $lang) {
+ if (!isset($lang['path'])) {
+ $code = $lang['code'];
+ $installed_languages[$i]['path'] = 'lang/'.$code;
+ $installed_languages[$i]['package'] = $code;
+ $lang_chd = true;
+ }
+ }
+ if ($lang_chd)
+ write_lang();
+
+ $installed_extensions= get_company_extensions();
+ if (!isset($next_extension_id))
+ $next_extension_id = 1;
+ $new_exts = array();
+
+/* Old extension modules are uninstalled - they need manual porting after
+ heavy changes in extension system in FA2.3
+
+ foreach($installed_extensions as $i => $ext)
+ {
+ if (isset($ext['title'])) // old type entry
+ {
+ if ($ext['type'] == 'module') {
+ $new['type'] = 'extension';
+ $new['tabs'][] = array(
+ 'url' => $ext['filename'],
+ 'access' => isset($ext['access']) ? $ext['access'] : 'SA_OPEN',
+ 'tab_id' => $ext['tab'],
+ 'title' => $ext['title']
+ );
+ $new['path'] = $ext['path'];
+ }
+ else // plugin
+ {
+ $new['type'] = 'extension';
+ $new['tabs'] = array();
+ $new['path'] = 'modules/'.$ext['path'];
+ $new['entries'][] = array(
+ 'url' => $ext['filename'],
+ 'access' => isset($ext['access']) ? $ext['access'] : 'SA_OPEN',
+ 'tab_id' => $ext['tab'],
+ 'title' => $ext['title']
+ );
+ }
+ if (isset($ext['acc_file']))
+ $new['acc_file'] = $ext['acc_file'];
+ $new['name'] = $ext['name'];
+ $new['package'] = $new['package'] = '';
+ $new['active'] = 1;
+
+ $new_exts[$i] = $new;
+ }
+ }
+*/
+ // Preserve non-standard themes
+ $path = $path_to_root.'/themes/';
+ $themes = array();
+ $themedir = opendir($path);
+ while (false !== ($fname = readdir($themedir)))
+ {
+ if ($fname!='.' && $fname!='..' && $fname!='CVS' && is_dir($path.$fname)
+ && !in_array($fname, array('aqua', 'cool', 'default')))
+ {
+ foreach($installed_extensions as $ext)
+ if ($ext['path'] == 'themes/'.$fname) // skip if theme is already listed
+ continue 2;
+ $new_exts[$next_extension_id++] = array(
+ 'name' => 'Theme '. ucwords($fname),
+ 'package' => $fname,
+ 'type' => 'theme',
+ 'active' => true,
+ 'path' => 'themes/'.$fname
+ );
+ }
+ }
+ closedir($themedir);
+
+ if (count($new_exts)) {
+ return update_extensions($new_exts);
+ } else
+ return true;
+ }
+
+ function update_lang_cfg()
+ {
+ global $dflt_lang, $installed_languages;
+
+ foreach($installed_languages as $n => $lang) {
+ if ($lang['code'] == 'en_GB') {
+ $installed_languages[$n] = array('code'=>'C','name'=>'English',
+ 'encoding'=>'iso-8859-1', 'path' => '', 'package' => '');
+ if ($dflt_lang == 'en_GB')
+ $dflt_lang = 'C';
+ write_lang();
+ }
+ }
+ }
+
+}
+