Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/includes/blocks/thelang.php
<?php
// File: $Id: thelang.php,v 1.22 2001/12/06 14:46:31 jgm Exp $ $Name:  $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Francisco Burzi
// Purpose of file:
// ----------------------------------------------------------------------

$blocks_modules['thelang'] = array(
    'func_display' => 'blocks_thelang_block',
    'func_edit' => 'blocks_thelang_select',
    'text_type' => 'Language',
    'text_type_long' => 'Languages',
    'allow_multiple' => false,
    'form_content' => false,
    'form_refresh' => false,
    'show_preview' => true
    );

// Security
addinstanceschemainfo('Languageblock::', '::');

function blocks_thelang_block($row)
{
    /* selectlanguage is modified to have a choice between flags and a dropdown box - Crocket */
    global $useflags, $currentlang; /* useflags is set in the multilingual options in the prefs */

    if (!authorised(0, 'Languageblock::', '::', ACCESS_OVERVIEW)) {
        return;
    }

    $lang = languagelist();
    if ($useflags || $row['url'])
    {
        $content = '<center><font class="pn-normal">'._SELECTGUILANG.'</font><br><br>';
        $handle = opendir('language');
        while ($f = readdir($handle))
        {
            if (is_dir("language/$f") && (!empty($lang[$f])))
            {
                $langlist[$f] = $lang[$f];
            }
        }
        asort($langlist);
        $i = 1;
        foreach ($langlist as $k=>$v)
        {
            if ($i > 3) {
                $content.= "<br>\n";
                $i = 1;
            }
            $imgsize = @getimagesize("images/flags/flag-$k.png");
            $content .= "<a href=\"index.php?newlang=$k\"><img src=\"images/flags/flag-$k.png\" border=\"0\" alt=\"$lang[$k]\" hspace=\"3\" vspace=\"3\" $imgsize[3]></a>";
            $i++;
        }
        $content .= '</center>';
        $row['title'] = _SELECTLANGUAGE;
        $row['content'] = $content;
        themesideblock($row);
    } else {
        $content = '<center><font class="pn-normal">'._SELECTGUILANG.'</font><br><br>'
            .'<form method="post" action="index.php"><select class="pn-text" name="newlanguage" onChange="top.location.href=this.options[this.selectedIndex].value">'
        ;
        $handle = opendir('language');
        while ($f = readdir($handle))
        {
            if (is_dir("language/$f") && (!empty($lang[$f])))
            {
                $langlist[$f] = $lang[$f];
                $sel_lang[$f] = '';
            }
        }
        $sel_lang[$currentlang] = ' selected';
        asort($langlist);
        foreach ($langlist as $k=>$v)
        {
            $content .= "<option value=\"index.php?newlang=$k\"$sel_lang[$k]>$v</option>\n";
        }
        $content .= '</select></form></center>';
        $row['title'] = _SELECTLANGUAGE;
        $row['content'] = $content;
        themesideblock($row);
    }
}

function blocks_thelang_select($row)
{
    if ($GLOBALS[useflags])
    {
        $row[url] = 1;
    }
    $sel[$row[url]] = ' checked';
    return "<tr><td class=\"pn-normal\">"._LANGUAGE_USEFLAGS
		.":</td><td><input type=\"checkbox\" name=\"url\" value=\"1\"$sel[1]></td></tr>";
}
?>
Return current item: ProNuke. Postnuke To Oracle