Skip to content

Commit

Permalink
Fixes for language blocks not being shown
Browse files Browse the repository at this point in the history
  • Loading branch information
tinoest committed Mar 6, 2022
1 parent f283331 commit db79813
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
7 changes: 3 additions & 4 deletions TinyPortal/Controller/BlockAdmin.php
Expand Up @@ -275,10 +275,9 @@ public function action_edit( $block_id = 0 ) {{{

if($context['TPortal']['blockedit']['lang'] != '') {
$context['TPortal']['blockedit']['langfiles'] = array();
$lang = explode('|', $context['TPortal']['blockedit']['lang']);
$num = count($lang);
for($i = 0; $i < $num; $i = $i + 2)
{
$lang = explode('|', $context['TPortal']['blockedit']['lang']);
$num = count($lang);
for($i = 0; $i < $num; $i = $i + 2) {
$context['TPortal']['blockedit']['langfiles'][$lang[$i]] = $lang[$i+1];
}
}
Expand Down
31 changes: 24 additions & 7 deletions TinyPortal/Model/Subs.php
Expand Up @@ -2288,16 +2288,33 @@ public function uploadpicture($widthhat, $prefix, $maxsize='1800', $exts='jpg,gi
}}}

public function langfiles() {{{
global $context, $settings;
global $context, $settings, $boarddir;

// get all languages for blocktitles
$language_dir = $settings['default_theme_dir'] . '/languages';
$context['TPortal']['langfiles'] = array();
$dir = dir($language_dir);
while ($entry = $dir->read())
if (substr($entry, 0, 6) == 'index.' && substr($entry,(strlen($entry) - 4) ,4) == '.php' && strlen($entry) > 9)
$context['TPortal']['langfiles'][] = substr(substr($entry, 6), 0, -4);
$dir->close();
$dirs = array();

$language_dirs = array ( $settings['default_theme_dir'] . '/languages' , $boarddir.'/TinyPortal/Views/languages');
foreach($language_dirs as $language_dir) {
$dir = dir($language_dir);
while ($entry = $dir->read()) {
if($entry != '.' && $entry != '..' && is_dir($language_dir.'/'.$entry)) {
$dirs[] = $language_dir.'/'.$entry;
}
}
$dir->close();
}

foreach($dirs as $language_dir) {
$dir = dir($language_dir);
while ($entry = $dir->read()) {
if ((substr($entry, 0, 8) == 'TPortal.') && (substr($entry,(strlen($entry) - 4) , 4) == '.php') && (strlen($entry) > 12)) {
$context['TPortal']['langfiles'][] = substr(substr($entry, 8), 0, -4);
}
}
$dir->close();
}

}}}

public function catLayouts() {{{
Expand Down

0 comments on commit db79813

Please sign in to comment.