1323 lines
42 KiB
PHP
1323 lines
42 KiB
PHP
<?php
|
|
|
|
/*
|
|
+--------------------------------------------------------------------------
|
|
| Invision Power Board 2.1.7
|
|
| =============================================
|
|
| by Matthew Mecham
|
|
| (c) 2001 - 2005 Invision Power Services, Inc.
|
|
| http://www.invisionpower.com
|
|
| =============================================
|
|
| Web: http://www.invisionboard.com
|
|
| http://www.ibresource.ru/products/invisionpowerboard/
|
|
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
|
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
|
| Licence Info: http://www.invisionboard.com/?license
|
|
| http://www.ibresource.ru/license
|
|
+---------------------------------------------------------------------------
|
|
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
|
+---------------------------------------------------------------------------
|
|
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
|
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
|
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
|
+---------------------------------------------------------------------------
|
|
| > $Date: 2005-12-08 16:32:40 +0000 (Thu, 08 Dec 2005) $
|
|
| > $Revision: 96 $
|
|
| > $Author: bfarber $
|
|
+---------------------------------------------------------------------------
|
|
|
|
|
| > Language functions
|
|
| > Module written by Matt Mecham
|
|
| > Date started: 22nd April 2002
|
|
|
|
|
| > Module Version Number: 1.0.0
|
|
| > DBA Checked: Tue 25th May 2004
|
|
+--------------------------------------------------------------------------
|
|
*/
|
|
|
|
if ( ! defined( 'IN_ACP' ) )
|
|
{
|
|
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
|
|
exit();
|
|
}
|
|
|
|
class ad_languages {
|
|
|
|
var $base_url;
|
|
|
|
/**
|
|
* Section title name
|
|
*
|
|
* @var string
|
|
*/
|
|
var $perm_main = "lookandfeel";
|
|
|
|
/**
|
|
* Section title name
|
|
*
|
|
* @var string
|
|
*/
|
|
var $perm_child = "lang";
|
|
|
|
function auto_run()
|
|
{
|
|
if ( TRIAL_VERSION )
|
|
{
|
|
print "Ýòà ôóíêöèÿ îòêëþ÷åíà â áåñïëàòíîé âåðñèè.";
|
|
exit();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Kill globals - globals bad, Homer good.
|
|
//-----------------------------------------
|
|
|
|
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
|
|
|
|
foreach ( $tmp_in as $k => $v )
|
|
{
|
|
unset($$k);
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
switch($this->ipsclass->input['code'])
|
|
{
|
|
|
|
case 'add':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
|
|
$this->add_language();
|
|
break;
|
|
|
|
case 'edit':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
|
|
$this->do_form('edit');
|
|
break;
|
|
|
|
case 'edit2':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
|
|
$this->show_file();
|
|
break;
|
|
|
|
case 'doadd':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
|
|
$this->save_wrapper('add');
|
|
break;
|
|
|
|
case 'doedit':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
|
|
$this->save_langfile();
|
|
break;
|
|
|
|
case 'remove':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':remove' );
|
|
$this->remove();
|
|
break;
|
|
|
|
case 'editinfo':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
|
|
$this->edit_info();
|
|
break;
|
|
|
|
case 'export':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':export' );
|
|
$this->export();
|
|
break;
|
|
|
|
case 'import':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':import' );
|
|
$this->import();
|
|
break;
|
|
|
|
case 'doimport':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':import' );
|
|
$this->doimport();
|
|
break;
|
|
|
|
case 'makedefault':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
|
|
$this->make_default();
|
|
break;
|
|
|
|
case 'swap':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
|
|
$this->member_swap();
|
|
break;
|
|
//-----------------------------------------
|
|
default:
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
|
|
$this->list_current();
|
|
break;
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Swap members choice
|
|
//-----------------------------------------
|
|
|
|
function member_swap()
|
|
{
|
|
$new_dir = "";
|
|
$old_dir = "";
|
|
|
|
if ( $this->ipsclass->input['old'] and $this->ipsclass->input['new'] )
|
|
{
|
|
if ( $this->ipsclass->input['old'] != 'none' )
|
|
{
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid IN ( {$this->ipsclass->input['old']}, {$this->ipsclass->input['new']})" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid={$this->ipsclass->input['new']}" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
}
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
if ( $r['lid'] == $this->ipsclass->input['old'] )
|
|
{
|
|
$old_dir = $r['ldir'];
|
|
}
|
|
|
|
if ( $r['lid'] == $this->ipsclass->input['new'] )
|
|
{
|
|
$new_dir = $r['ldir'];
|
|
}
|
|
}
|
|
|
|
if ( $new_dir and $old_dir )
|
|
{
|
|
$this->ipsclass->DB->do_update( 'members', array( 'language' => $new_dir ), "language='{$old_dir}'" );
|
|
}
|
|
else if ( $this->ipsclass->input['old'] == 'none' )
|
|
{
|
|
$this->ipsclass->DB->do_update( 'members', array( 'language' => $new_dir ), "language='' or language IS NULL" );
|
|
}
|
|
}
|
|
|
|
$this->ipsclass->main_msg = "Ó âñåõ ïîëüçîâàòåëåé ïåðåóñòàíîâëåí ÿçûê";
|
|
$this->list_current();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Rebuild CACHE
|
|
//-----------------------------------------
|
|
|
|
function rebuild_cache()
|
|
{
|
|
$this->ipsclass->cache['languages'] = array();
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => 'ldir,lname', 'from' => 'languages' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->cache['languages'][] = $r;
|
|
}
|
|
|
|
$this->ipsclass->update_cache( array( 'name' => 'languages', 'array' => 1, 'deletefirst' => 1 ) );
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function make_default()
|
|
{
|
|
$new_dir = stripslashes(urldecode(trim($_GET['id'])));
|
|
|
|
if ($new_dir == "")
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî îïðåäåëèòü ID ÿçûêà");
|
|
}
|
|
|
|
// Update conf file
|
|
|
|
$this->ipsclass->admin->rebuild_config( array( 'default_language' => $new_dir ) );
|
|
|
|
// Bring it all back to yoooo!
|
|
|
|
$this->ipsclass->boink_it($this->ipsclass->base_url."&{$this->ipsclass->form_code}");
|
|
|
|
}
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// IMPORT - DO IT
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function doimport()
|
|
{
|
|
$messages = array();
|
|
|
|
//-----------------------------------------
|
|
// Check
|
|
//-----------------------------------------
|
|
|
|
if ( ! $this->ipsclass->input['lang_name'] )
|
|
{
|
|
$this->ipsclass->admin->error("Âû äîëæíû ââåñòè íàçâàíèÿ äëÿ èìïîðòèðóåìîãî ÿçûêà!");
|
|
}
|
|
|
|
if ( $_FILES['FILE_UPLOAD']['name'] == "" or ! $_FILES['FILE_UPLOAD']['name'] or ($_FILES['FILE_UPLOAD']['name'] == "none") )
|
|
{
|
|
//-----------------------------------------
|
|
// check and load from server
|
|
//-----------------------------------------
|
|
|
|
if ( ! $this->ipsclass->input['lang_location'] )
|
|
{
|
|
$this->ipsclass->main_msg = "Èìïîðòèðóåìûé ôàéë íå íàéäåí.";
|
|
$this->import();
|
|
}
|
|
|
|
if ( ! file_exists( ROOT_PATH . $this->ipsclass->input['lang_location'] ) )
|
|
{
|
|
$this->ipsclass->main_msg = "Íåâîçìîæíî íàéòè ôàéë: " . ROOT_PATH . $this->ipsclass->input['lang_location'];
|
|
$this->import();
|
|
}
|
|
|
|
if ( preg_match( "#\.gz$#", $this->ipsclass->input['lang_location'] ) )
|
|
{
|
|
if ( $FH = @gzopen( ROOT_PATH.$this->ipsclass->input['lang_location'], 'rb' ) )
|
|
{
|
|
while ( ! @gzeof( $FH ) )
|
|
{
|
|
$content .= @gzread( $FH, 1024 );
|
|
}
|
|
|
|
@gzclose( $FH );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ( $FH = @fopen( ROOT_PATH.$this->ipsclass->input['lang_location'], 'rb' ) )
|
|
{
|
|
$content = @fread( $FH, filesize(ROOT_PATH.$this->ipsclass->input['lang_location']) );
|
|
@fclose( $FH );
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//-----------------------------------------
|
|
// Get uploaded schtuff
|
|
//-----------------------------------------
|
|
|
|
$tmp_name = $_FILES['FILE_UPLOAD']['name'];
|
|
$tmp_name = preg_replace( "#\.gz$#", "", $tmp_name );
|
|
|
|
$content = $this->ipsclass->admin->import_xml( $tmp_name );
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Check dirs, etc
|
|
//-----------------------------------------
|
|
|
|
$safename = substr( str_replace( " ", "", strtolower( preg_replace( "[^a-zA-Z0-9]", "", $this->ipsclass->input['lang_name'] ) ) ), 0, 10 );
|
|
|
|
if ( @file_exists( CACHE_PATH.'cache/lang_cache/'.$safename ) )
|
|
{
|
|
$safename = $safename . substr( time(), 5, 10 );
|
|
}
|
|
|
|
if ( ! $content )
|
|
{
|
|
$this->ipsclass->main_msg = "XML-àðõèâ ïóñò, ïîæàëóéñòà, ïðîâåðüòå àðõèâ è ïîïðîáóéòå åùå ðàç";
|
|
$this->import();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Get xml mah-do-dah
|
|
//-----------------------------------------
|
|
|
|
require( KERNEL_PATH.'class_xml.php' );
|
|
|
|
$xml = new class_xml();
|
|
|
|
//-----------------------------------------
|
|
// Unpack the datafile
|
|
//-----------------------------------------
|
|
|
|
$xml->xml_parse_document( $content );
|
|
|
|
//-----------------------------------------
|
|
// pArse
|
|
//-----------------------------------------
|
|
|
|
$lang_array = array();
|
|
|
|
foreach( $xml->xml_array['languageexport']['languagegroup']['langbit'] as $idx => $entry )
|
|
{
|
|
$key = $entry['key']['VALUE'];
|
|
$value = $entry['value']['VALUE'];
|
|
$file = $entry['file']['VALUE'];
|
|
|
|
$lang_array[ $file ][ $key ] = $value;
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Sort...
|
|
//-----------------------------------------
|
|
|
|
ksort($lang_array);
|
|
|
|
if ( ! count( $lang_array ) )
|
|
{
|
|
$this->ipsclass->main_msg = "XML-àðõèâ ïóñò, ïîæàëóéñòà, ïðîâåðüòå àðõèâ è ïîïðîáóéòå åùå ðàç";
|
|
$this->import();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Attempt dir creation
|
|
//-----------------------------------------
|
|
|
|
if ( ! @mkdir( CACHE_PATH.'cache/lang_cache/'.$safename, 0777 ) )
|
|
{
|
|
$this->ipsclass->main_msg = "Íåâîçìîæíî ñîçäàòü ïàïêó '$safename' â ïàïêå './lang' - ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) ó ïàïêè 'lang' è ïîïðîáóéòå åùå ðàç.";
|
|
$this->import();
|
|
}
|
|
else
|
|
{
|
|
@chmod( CACHE_PATH.'cache/lang_cache/'.$safename, 0777 );
|
|
}
|
|
|
|
//print "<pre>"; print_r( $new_file_array ); exit();
|
|
|
|
//-----------------------------------------
|
|
// Loop, sort - compile and save
|
|
//-----------------------------------------
|
|
|
|
foreach( $lang_array as $file => $data )
|
|
{
|
|
$new_file_array = array();
|
|
|
|
$real_name = 'lang_'.$file.'.php';
|
|
|
|
foreach( $lang_array[ $file ] as $k => $v )
|
|
{
|
|
$new_file_array[ $k ] = $v;
|
|
}
|
|
|
|
ksort($new_file_array);
|
|
|
|
if ( count( $new_file_array ) )
|
|
{
|
|
$file_contents = "<?php\n\n";;
|
|
|
|
foreach( $new_file_array as $k => $v )
|
|
{
|
|
$file_contents .= "\n".'$lang['."'$k'".'] = "'.addslashes($v).'";';
|
|
}
|
|
|
|
$file_contents .= "\n?".">";
|
|
|
|
if ( $FH = @fopen( CACHE_PATH.'cache/lang_cache/'.$safename.'/'.$real_name, 'w' ) )
|
|
{
|
|
@fwrite( $FH, $file_contents );
|
|
@fclose( $FH );
|
|
|
|
$messages[] = "Ôàéë 'lang_{$file}.php' èìïîðòèðîâàí!";
|
|
}
|
|
else
|
|
{
|
|
$messages[] = "Íåâîçìîæíî ñîçäàòü ôàéë 'lang_{$file}.php', ôàéë ïðîïóùåí...";
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
$messages[] = "Ôàéë 'lang_{$file}.php' ïóñò, ôàéë ïðîïóùåí...";
|
|
}
|
|
|
|
unset($new_file_array);
|
|
unset($file_contents);
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Write to DB
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->do_insert( 'languages', array(
|
|
'ldir' => $safename,
|
|
'lname' => $this->ipsclass->input['lang_name'],
|
|
'lauthor' => $xml->xml_array['languageexport']['ATTRIBUTES']['author'],
|
|
'lemail' => $xml->xml_array['languageexport']['ATTRIBUTES']['email'],
|
|
) );
|
|
|
|
$this->rebuild_cache();
|
|
|
|
$this->ipsclass->main_msg = "Èìïîðòèðîâàíèå óñïåøíî çàâåðøåíî<br />".implode( "\n<br />", $messages );
|
|
$this->import();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Import XML Archive (FORM)
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function import()
|
|
{
|
|
$this->ipsclass->admin->page_detail = "Ýòà ñåêöèÿ ïîçâîëÿåò âàì èìïîðòèðîâàòü XML-ôàéëû ñîäåðæàùèå ÿçûêîâûå íàñòðîéêè.";
|
|
$this->ipsclass->admin->page_title = "Èìïîðò ÿçûêà";
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'doimport' ),
|
|
2 => array( 'act' , 'lang' ),
|
|
3 => array( 'MAX_FILE_SIZE' , '10000000000' ),
|
|
4 => array( 'section' , $this->ipsclass->section_code ),
|
|
) , "uploadform", " enctype='multipart/form-data'" );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "50%" );
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "50%" );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Èìïîðòèðîâàíèå XML-ôàéëà" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Çàãðóçêà XML-àðõèâà ñ ÿçûêîâûìè íàñòðîéêàìè</b><div style='color:gray'>Âûáåðèòå ôàéë äëÿ çàãðóçêè ñ âàøåãî êîìïüþòåðà. Âûáðàííûé ôàéë äîëæåí íà÷èíàòüñÿ ñ 'ipb_language' è çàêàí÷èâàòüñÿ ëèáî '.xml', ëèáî '.xml.gz'.</div>" ,
|
|
$this->ipsclass->adskin->form_upload( )
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b><u>ÈËÈ</u> ââåäèòå íàçâàíèå XML-àðõèâà</b><div style='color:gray'>Ýòîò ôàéë äîëæåí áûòü çàãðóæåí â îñíîâíóþ ïàïêó ôîðóìà.</div>" ,
|
|
$this->ipsclass->adskin->form_input( 'lang_location', 'ipb_language.xml.gz' )
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ââåäèòå íàçâàíèå äëÿ íîâûõ ÿçûêîâûõ íàñòðîåê</b><div style='color:gray'>Íàïðèìåð: Ðóññêèé, RU, English, US...</div>" ,
|
|
$this->ipsclass->adskin->form_input( 'lang_name', '' )
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Èìïîðòèðîâàíèå XML-ôàéëà");
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
$this->ipsclass->admin->output();
|
|
|
|
|
|
}
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// EXPORT: Export languages into XML download
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function export()
|
|
{
|
|
//-----------------------------------------
|
|
// check
|
|
//-----------------------------------------
|
|
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî îïðåäåëèòü ID ÿçûêà");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Get data from DB
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid='".$this->ipsclass->input['id']."'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( ! $row = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ÿçûê ïî ââåäåííîìó ID");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Get xml mah-do-dah
|
|
//-----------------------------------------
|
|
|
|
require( KERNEL_PATH.'class_xml.php' );
|
|
|
|
$xml = new class_xml();
|
|
|
|
//-----------------------------------------
|
|
// Set Doctype if not using ISO-8859-1
|
|
//-----------------------------------------
|
|
$xml->doc_type = $this->ipsclass->vars['gb_char_set'];
|
|
$xml->class_xml();
|
|
|
|
//-----------------------------------------
|
|
// Set up..
|
|
//-----------------------------------------
|
|
|
|
$lang_dir = ROOT_PATH."cache/lang_cache/".$row['ldir'];
|
|
|
|
if ( ! is_dir($lang_dir) )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ïàïêó '$lang_dir', ïðîâåðüòå ñóùåñòâóåò ëè ýòà ïàïêà?");
|
|
}
|
|
|
|
$lang_files = array( 'boards','buddy','calendar','emails', 'email_content', 'error','forum','global','help','legends','login','mlist',
|
|
'mod','msg','online','portal','post','printpage','profile','register','search','stats','subscriptions','topic','ucp',
|
|
'chatpara' , 'editors'
|
|
);
|
|
|
|
//-----------------------------------------
|
|
// Start XML
|
|
//-----------------------------------------
|
|
|
|
$xml->xml_set_root( 'languageexport', array( 'exported' => time(), 'author' => $row['lauthor'], 'email' => $row['lemail'] ) );
|
|
|
|
$xml->xml_add_group( 'languagegroup' );
|
|
|
|
//-----------------------------------------
|
|
// Get all the lang bits
|
|
//-----------------------------------------
|
|
|
|
foreach( $lang_files as $file )
|
|
{
|
|
if ( @is_file( $lang_dir.'/lang_'.$file.'.php' ) )
|
|
{
|
|
$lang = array();
|
|
|
|
require( $lang_dir.'/lang_'.$file.'.php' );
|
|
|
|
foreach( $lang as $k => $v )
|
|
{
|
|
$content = array();
|
|
|
|
$content[] = $xml->xml_build_simple_tag( 'key' , $k );
|
|
$content[] = $xml->xml_build_simple_tag( 'value', $v );
|
|
$content[] = $xml->xml_build_simple_tag( 'file' , $file );
|
|
|
|
$entry[] = $xml->xml_build_entry( 'langbit', $content );
|
|
}
|
|
}
|
|
}
|
|
|
|
$xml->xml_add_entry_to_group( 'languagegroup', $entry );
|
|
|
|
$xml->xml_format_document();
|
|
|
|
//-----------------------------------------
|
|
// Send to browser.
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->admin->show_download( $xml->xml_document, 'ipb_language.xml' );
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function show_file()
|
|
{
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî îïðåäåëèòü ID ÿçûêà");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid='".$this->ipsclass->input['id']."'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( ! $row = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ÿçûê ïî ââåäåííîìó ID.");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
$lang_dir = CACHE_PATH."cache/lang_cache/".$row['ldir'];
|
|
|
|
$form_array = array();
|
|
|
|
$lang_file = $lang_dir."/".$this->ipsclass->input['lang_file'];
|
|
|
|
|
|
if ( ! is_writeable($lang_dir) )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî çàïèñàòü â ïàïêó '$lang_dir', ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) è, åñëè íåîáõîäèìî óñòàíîâèòü ïðàâà äîñòóïà 0777. IPB íå ìîæåò ñäåëàòü ýòî çà âàñ.");
|
|
}
|
|
|
|
if (! file_exists($lang_file) )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ôàéë {$ibforums->input['lang_file']} â ïàïêó '$lang_dir', âåðíèòåñü íàçàä è ïîïðîáóéòå åùå ðàç");
|
|
}
|
|
else
|
|
{
|
|
require $lang_file;
|
|
}
|
|
|
|
if ($this->ipsclass->input['lang_file'] == 'email_content.php')
|
|
{
|
|
$is_email = 1;
|
|
}
|
|
|
|
if ( ! is_writeable($lang_file) )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî çàïèñàòü â ôàéë '$lang_file', ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) è, åñëè íåîáõîäèìî óñòàíîâèòü ïðàâà äîñòóïà 0777. IPB íå ìîæåò ñäåëàòü ýòî çà âàñ.");
|
|
}
|
|
|
|
|
|
$this->ipsclass->admin->page_detail = "Âû ìîæåòå èçìåíèòü ëþáóþ ôðàçó â ôîðìàõ íèæå.";
|
|
$this->ipsclass->admin->page_title = "Èçìåíåíèå ÿçûêîâîãî ìîäóëÿ: ".$row['lname'];
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'doedit' ),
|
|
2 => array( 'act' , 'lang' ),
|
|
3 => array( 'id' , $this->ipsclass->input['id'] ),
|
|
4 => array( 'lang_file' , $this->ipsclass->input['lang_file'] ),
|
|
5 => array( 'section', $this->ipsclass->section_code ),
|
|
) );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( "Íàçâàíèå ÿçûêîâîãî áëîêà" , "20%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Ñîäåðæèìîå ÿçûêîâîãî áëîêà" , "80%" );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "ßçûêîâîé ôàéë: ".$this->ipsclass->input['lang_file'] );
|
|
|
|
foreach($lang as $k => $v)
|
|
{
|
|
//-----------------------------------------
|
|
// Swop < and > into ascii entities
|
|
// to prevent textarea breaking html
|
|
//-----------------------------------------
|
|
|
|
$v = stripslashes($v);
|
|
|
|
$v = preg_replace("/&/", "&", $v );
|
|
$v = preg_replace("/</", "<", $v );
|
|
$v = preg_replace("/>/", ">", $v );
|
|
$v = preg_replace("/'/", "'", $v );
|
|
|
|
$rows = 5;
|
|
|
|
$cols = 70;
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array(
|
|
"<ibf.lang.<b>".$k."</b>>",
|
|
$this->ipsclass->adskin->form_textarea('XX_'.$k, $v, $cols, $rows),
|
|
) );
|
|
}
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Èçìåíèòü ýòîò ôàéë");
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
//-----------------------------------------
|
|
//-------------------------------
|
|
|
|
$this->ipsclass->admin->output();
|
|
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Edit language pack information
|
|
//-----------------------------------------
|
|
|
|
function edit_info()
|
|
{
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî îïðåäåëèòü ID ÿçûêà");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid='".$this->ipsclass->input['id']."'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( ! $row = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ÿçûê ïî ââåäåííîìó ID");
|
|
}
|
|
|
|
$final['lname'] = stripslashes($_POST['lname']);
|
|
|
|
if (isset($_POST['lname']))
|
|
{
|
|
$final['lauthor'] = stripslashes($_POST['lauthor']);
|
|
$final['lemail'] = stripslashes($_POST['lemail']);
|
|
}
|
|
|
|
$this->ipsclass->DB->do_update( 'languages', $final, "lid='".$this->ipsclass->input['id']."'" );
|
|
|
|
$this->rebuild_cache();
|
|
|
|
$this->ipsclass->admin->done_screen("ßçûêîâîé ìîäóëü îáíîâëåí", "Óïðàâëåíèå ÿçûêàìè", "{$this->ipsclass->form_code}" );
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Add language pack
|
|
//-----------------------------------------
|
|
|
|
|
|
function add_language()
|
|
{
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî îïðåäåëèòü ID ÿçûêà");
|
|
}
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid='".$this->ipsclass->input['id']."'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
//-----------------------------------------
|
|
|
|
if ( ! $row = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ÿçûê ïî ââåäåííîìó ID");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
//-----------------------------------------
|
|
|
|
if ( ! is_writeable(CACHE_PATH.'cache/lang_cache') )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî çàïèñàòü â ïàïêó /cache/lang_cache/, ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) è, åñëè íåîáõîäèìî óñòàíîâèòü ïðàâà äîñòóïà 0777. IPB íå ìîæåò ñäåëàòü ýòî çà âàñ");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
if ( ! is_dir(CACHE_PATH.'cache/lang_cache/'.$row['ldir']) )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè îðèãèíàëüíûé ÿçûê äëÿ êîïèðîâàíèÿ, âåðíèòåñü íàçàä è ïîïðîáóéòå åùå ðàç");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
$row['lname'] = $row['lname'].".2";
|
|
|
|
// Insert a new row into the DB...
|
|
|
|
$final = array();
|
|
|
|
foreach($row as $k => $v)
|
|
{
|
|
if ($k == 'lid')
|
|
{
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
$final[ $k ] = $v;
|
|
}
|
|
}
|
|
|
|
$this->ipsclass->DB->do_insert( 'languages', $final );
|
|
|
|
$new_id = $this->ipsclass->DB->get_insert_id();
|
|
|
|
//-----------------------------------------
|
|
|
|
if ( ! $this->ipsclass->admin->copy_dir( CACHE_PATH.'cache/lang_cache/'.$row['ldir'] , CACHE_PATH.'cache/lang_cache/'.$new_id ) )
|
|
{
|
|
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'languages', 'where' => "lid='$new_id'" ) );
|
|
|
|
$this->ipsclass->admin->error( $this->ipsclass->admin->errors );
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->DB->do_update( 'languages', array( 'ldir' => $new_id ), "lid='$new_id'" );
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Pass to edit / add form...
|
|
//-----------------------------------------
|
|
|
|
$this->rebuild_cache();
|
|
|
|
$this->do_form('add', $new_id);
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// REMOVE WRAPPERS
|
|
//-----------------------------------------
|
|
|
|
function remove()
|
|
{
|
|
//-----------------------------------------
|
|
|
|
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî îïðåäåëèòü ID ÿçûêà");
|
|
}
|
|
|
|
if ($this->ipsclass->input['id'] == 1)
|
|
{
|
|
$this->ipsclass->admin->error("Âû íå ìîæåòå óäàëèòü ýòîò ÿçûê.");
|
|
}
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid='".$this->ipsclass->input['id']."'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( ! $row = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ÿçûê ïî ââåäåííîìó ID");
|
|
}
|
|
|
|
// Is it default??????????????? ok enuff
|
|
|
|
if ($this->ipsclass->vars['default_language'] == "")
|
|
{
|
|
$this->ipsclass->vars['default_language'] = 'ru';
|
|
}
|
|
|
|
if ($row['ldir'] == $this->ipsclass->vars['default_language'])
|
|
{
|
|
$this->ipsclass->admin->error("Âû íå ìîæåòå óäàëèòü ýòîò ÿçûê, ïîêà îí óñòàíîâëåí, êàê ÿçûê ïî óìîë÷àíèþ. Âûáåðèòå äðóãîé ÿçûê è óñòàíîâèòå åãî ïî óìîë÷àíèþ, ïîñëå ýòîãî ïîïðîáóéòå åùå ðàç");
|
|
}
|
|
|
|
$this->ipsclass->DB->do_update( 'members', array( 'language' => $this->ipsclass->vars['default_language'] ), "language='{$row['ldir']}'" );
|
|
|
|
if ( $this->ipsclass->admin->rm_dir( CACHE_PATH.'cache/lang_cache/'.$row['ldir'] ) )
|
|
{
|
|
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'languages', 'where' => "lid='".$this->ipsclass->input['id']."'" ) );
|
|
|
|
$this->rebuild_cache();
|
|
|
|
$this->ipsclass->boink_it($this->ipsclass->base_url."&{$this->ipsclass->form_code}");
|
|
exit();
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî óäàëèòü ÿçûêîâûå ìîäóëè, ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) ê ôàéëàì ÿçûêà");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------
|
|
// ADD / EDIT IMAGE SETS
|
|
//-----------------------------------------
|
|
|
|
function save_langfile()
|
|
{
|
|
//-----------------------------------------
|
|
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî îïðåäåëèòü ID ÿçûêà");
|
|
}
|
|
|
|
if ($this->ipsclass->input['lang_file'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Âû äîëæíû óêàçàòü èìÿ ÿçûêîâîãî ìîäóëÿ, âåðíèòåñü íàçàä è ïîïðîáóéòå åùå ðàç");
|
|
}
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid='".$this->ipsclass->input['id']."'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( ! $row = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ÿçûê ïî ââåäåííîìó ID");
|
|
}
|
|
|
|
$lang_file = CACHE_PATH."cache/lang_cache/".$row['ldir']."/".$this->ipsclass->input['lang_file'];
|
|
|
|
if (! file_exists( $lang_file ) )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ôàéë '$lang_file', ïðîâåðüòå åñòü ëè îí.");
|
|
}
|
|
|
|
if (! is_writeable( $lang_file ) )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî çàïèñàòü â ôàéë '$lang_file', ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) è, åñëè íåîáõîäèìî óñòàíîâèòü ïðàâà äîñòóïà 0777. IPB íå ìîæåò ñäåëàòü ýòî çà âàñ");
|
|
}
|
|
|
|
$barney = array();
|
|
|
|
foreach ($this->ipsclass->input as $k => $v)
|
|
{
|
|
if ( preg_match( "/^XX_(\S+)$/", $k, $match ) )
|
|
{
|
|
if ( isset($this->ipsclass->input[ $match[0] ]) )
|
|
{
|
|
$v = preg_replace("/'/", "'", stripslashes($_POST[ $match[0] ]) );
|
|
$v = preg_replace("/</", "<", $v );
|
|
$v = preg_replace("/>/", ">", $v );
|
|
$v = preg_replace("/&/", "&", $v );
|
|
$v = preg_replace("/\r/", "", $v );
|
|
|
|
$barney[ $match[1] ] = $v;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( count($barney) < 1 )
|
|
{
|
|
$this->ipsclass->admin->error("×òî-òî ñäåëàíî íå òàê, âåðíèòåñü íàçàä è ïîïðîáóéòå åùå ðàç");
|
|
}
|
|
|
|
$start = "<?php\n\n";
|
|
|
|
foreach($barney as $key => $text)
|
|
{
|
|
$text = preg_replace("/\n{1,}$/", "", $text);
|
|
$start .= "\n".'$lang['."'$key'".'] = "'.addslashes($text).'";';
|
|
}
|
|
|
|
$start .= "\n\n?".">";
|
|
|
|
if ($fh = fopen( $lang_file, 'w') )
|
|
{
|
|
fwrite($fh, $start );
|
|
fclose($fh);
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->admin->error("Íåëüçÿ ñäåëàòü çàïèñü â $lang_file");
|
|
}
|
|
|
|
if ( $this->ipsclass->input['id'] )
|
|
{
|
|
$this->ipsclass->admin->done_screen("ßçûê îáíîâëåí", "Óïðàâëåíèå ÿçûêàìè", "{$this->ipsclass->form_code}&code=edit&id={$this->ipsclass->input['id']}", 'redirect' );
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->admin->done_screen("ßçûê îáíîâëåí", "Óïðàâëåíèå ÿçûêàìè", "{$this->ipsclass->form_code}", 'redirect' );
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// EDIT SPLASH
|
|
//-----------------------------------------
|
|
|
|
function do_form( $method='add', $id="" )
|
|
{
|
|
//-----------------------------------------
|
|
|
|
if ($id != "")
|
|
{
|
|
$this->ipsclass->input['id'] = $id;
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
if ($this->ipsclass->input['id'] == "")
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî îïðåäåëèòü ID ÿçûêà");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'languages', 'where' => "lid='".$this->ipsclass->input['id']."'" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( ! $row = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè ÿçûê ïî ââåäåííîìó ID");
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
$lang_dir = CACHE_PATH."cache/lang_cache/".$row['ldir'];
|
|
|
|
$form_array = array();
|
|
|
|
if ($method != 'add')
|
|
{
|
|
if ( ! is_writeable($lang_dir) )
|
|
{
|
|
$this->ipsclass->admin->error("Íåâîçìîæíî çàïèñàòü â ïàïêó '$lang_dir', ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) è, åñëè íåîáõîäèìî óñòàíîâèòü ïðàâà äîñòóïà 0777. IPB íå ìîæåò ñäåëàòü ýòî çà âàñ.");
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
if ( is_dir($lang_dir) )
|
|
{
|
|
$handle = opendir($lang_dir);
|
|
|
|
while (($filename = readdir($handle)) !== false)
|
|
{
|
|
if (($filename != ".") && ($filename != ".."))
|
|
{
|
|
if (preg_match("/^index/", $filename))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (preg_match("/\.php$/", $filename))
|
|
{
|
|
$form_array[] = array( $filename, preg_replace( "/\.php$/", "", $filename ) );
|
|
}
|
|
}
|
|
}
|
|
|
|
closedir($handle);
|
|
}
|
|
|
|
if ($row['lauthor'] and $row['lemail'])
|
|
{
|
|
$author = "<br><br>ßçûê <b>'{$row['lname']}'</b> áûë ñîçäàí <a href='mailto:{$row['lemail']}' target='_blank'>{$row['lauthor']}</a>";
|
|
}
|
|
else if ($row['lauthor'])
|
|
{
|
|
$author = "<br><br>ßçûê <b>'{$row['lname']}'</b> áûë ñîçäàí {$row['lauthor']}";
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->admin->page_detail = "Ýòà ñåêöèÿ ïîçâîëÿåò âàì èçìåíÿòü ÿçûêîâûå ìîäóëè âûáðàííîãî ÿçûêà.$author $url";
|
|
$this->ipsclass->admin->page_title = "Èçìåíåíèå ÿçûêîâûõ ìîäóëåé";
|
|
|
|
//-----------------------------------------
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'editinfo' ),
|
|
2 => array( 'act' , 'lang' ),
|
|
3 => array( 'id' , $this->ipsclass->input['id'] ),
|
|
4 => array( 'section', $this->ipsclass->section_code ),
|
|
) );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Èçìåíåíèå èíôîðìàöèè î ÿçûêå" );
|
|
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array(
|
|
"<b>Íàçâàíèå ÿçûêà</b>",
|
|
$this->ipsclass->adskin->form_input('lname', $row['lname']),
|
|
) );
|
|
|
|
if ($method == 'add')
|
|
{
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array(
|
|
"<b>Àâòîð ÿçûêà:</b>",
|
|
$this->ipsclass->adskin->form_input('lauthor', $row['lauthor']),
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array(
|
|
"<b>Àäðåñ email àâòîðà:</b>",
|
|
$this->ipsclass->adskin->form_input('lemail', $row['lemail']),
|
|
) );
|
|
|
|
}
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Èçìåíèòü óñòàíîâêè ÿçûêà");
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
//-----------------------------------------
|
|
//-------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'edit2' ),
|
|
2 => array( 'act' , 'lang' ),
|
|
3 => array( 'id' , $this->ipsclass->input['id'] ),
|
|
4 => array( 'section', $this->ipsclass->section_code ),
|
|
) );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ðåäàêòèðîâàíèå ÿçûêîâûõ ìîäóëåé ÿçûêà '".$row['lname']."'" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array(
|
|
"<b>Âûáåðåòå ÿçûêîâîé ôàéë äëÿ ðåäàêòèðîâàíèÿ</b>",
|
|
$this->ipsclass->adskin->form_dropdown('lang_file', $form_array),
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Ðåäàêòèðîâàòü ýòîò ôàéë");
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
//-----------------------------------------
|
|
//-------------------------------
|
|
|
|
$this->ipsclass->admin->output();
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// SHOW ALL LANGUAGE PACKS
|
|
//-----------------------------------------
|
|
|
|
function list_current()
|
|
{
|
|
if ($this->ipsclass->vars['default_language'] == "")
|
|
{
|
|
$this->ipsclass->vars['default_language'] = 'ru';
|
|
}
|
|
|
|
$form_array = array();
|
|
|
|
$this->ipsclass->admin->page_detail = "Â ýòîé ñåêöèè âû ìîæåòå èçìåíÿòü, óäàëÿòü ñóùåñòâóþùèå ÿçûêè è äîáàâëÿòü íîâûå";
|
|
$this->ipsclass->admin->page_title = "Óïðàâëåíèå ÿçûêàìè";
|
|
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->cache_add_query( 'languages_list_current', array() );
|
|
$this->ipsclass->DB->cache_exec_query();
|
|
|
|
$used_ids = array();
|
|
$show_array = array();
|
|
|
|
$this->ipsclass->html .= ""; // removed js check delete
|
|
|
|
if ( $this->ipsclass->DB->get_num_rows() )
|
|
{
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( "Íàçâàíèå" , "40%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Ïîëüçîâàòåëåé èñïîëüçóþò" , "30%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Ýêñïîðò" , "10%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Èçìåíåíèå" , "10%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Óäàëåíèå" , "10%" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Èñïîëüçóåìûå ÿçûêè" );
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
|
|
if ($this->ipsclass->vars['default_language'] == $r['ldir'])
|
|
{
|
|
$root = "<span style='color:red;font-weight:bold'> (èñïîëüçóåòñÿ ïî óìîë÷àíèþ)</span>";
|
|
}
|
|
else
|
|
{
|
|
$root = " ( <a href='{$this->ipsclass->base_url}&{$this->ipsclass->form_code}&code=makedefault&id=".urlencode($r['ldir'])."'>Ñäåëàòü ÿçûêîì ïî óìîë÷àíèþ</a> )";
|
|
}
|
|
|
|
$show_array[ $r['lid'] ] .= stripslashes($r['lname'])."<br>";
|
|
|
|
if ( in_array( $r['lid'], $used_ids ) )
|
|
{
|
|
continue;
|
|
}
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>".stripslashes($r['lname'])."</b> $root",
|
|
"<center>{$r['mcount']}</center>",
|
|
"<center><a href='".$this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=export&id={$r['lid']}'>Ýêñïîðòèðîâàòü</a></center>",
|
|
"<center><a href='".$this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=edit&id={$r['lid']}'>Èçìåíèòü</a></center>",
|
|
"<center><a href='javascript:checkdelete(\"{$this->ipsclass->form_code_js}&code=remove&id={$r['lid']}\")'>Óäàëèòü</a></center>",
|
|
) );
|
|
|
|
$used_ids[] = $r['lid'];
|
|
|
|
$form_array[] = array( $r['lid'], $r['lname'] );
|
|
|
|
}
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
}
|
|
|
|
if ( count($used_ids) < 1 )
|
|
{
|
|
$used_ids[] = '0';
|
|
}
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => 'lid, ldir, lname', 'from' => 'languages', 'where' => "lid NOT IN(".implode(",",$used_ids).")" ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
if ( $this->ipsclass->DB->get_num_rows() )
|
|
{
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( "Íàçâàíèå" , "40%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Ýêñïîðò" , "10%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Èçìåíåíèå" , "30%" );
|
|
$this->ipsclass->adskin->td_header[] = array( "Óäàëåíèå" , "20%" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Íåèñïîëüçóåìûå ÿçûêè" );
|
|
|
|
|
|
|
|
while ( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
|
|
if ($this->ipsclass->vars['default_language'] == $r['ldir'])
|
|
{
|
|
$root = "<span style='color:red;font-weight:bold'> (èñïîëüçóåòñÿ ïî óìîë÷àíèþ)</span>";
|
|
}
|
|
else
|
|
{
|
|
$root = " ( <a href='{$this->ipsclass->base_url}&{$this->ipsclass->form_code}&code=makedefault&id=".urlencode($r['ldir'])."'>Ñäåëàòü ÿçûêîì ïî óìîë÷àíèþ</a> )";
|
|
}
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>".stripslashes($r['lname'])."</b> $root",
|
|
"<center><a href='".$this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=export&id={$r['lid']}'>Ýêñïîðòèðîâàòü</a></center>",
|
|
"<center><a href='".$this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=edit&id={$r['lid']}'>Èçìåíèòü</a></center>",
|
|
"<center><a href='javascript:checkdelete(\"{$this->ipsclass->form_code_js}&code=remove&id={$r['lid']}\")'>Óäàëèòü</a></center>",
|
|
) );
|
|
|
|
$form_array[] = array( $r['lid'], $r['lname'] );
|
|
|
|
}
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Create new set?
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'add' ),
|
|
2 => array( 'act' , 'lang' ),
|
|
4 => array( 'section', $this->ipsclass->section_code ),
|
|
) );
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ñîçäàíèå ÿçûêà" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ñîçäàòü íîâûé ÿçûê èñïîëüçóÿ ñóùåñòâóþùèé...</b>" ,
|
|
$this->ipsclass->adskin->form_dropdown( "id", $form_array)
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Ñîçäàòü íîâûé ÿçûê");
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
//-----------------------------------------
|
|
// Create new set?
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'swap' ),
|
|
2 => array( 'act' , 'lang' ),
|
|
4 => array( 'section', $this->ipsclass->section_code ),
|
|
) );
|
|
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
|
|
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïåðåóñòàíîâêà ÿçûêà ó ïîëüçîâàòåëåé ôîðóìà" );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ïîëüçîâàòåëè èñïîëüçóþùèå ÿçûê...</b>" ,
|
|
$this->ipsclass->adskin->form_dropdown( "old", array_merge( array( -1 => array( 'none', 'ïî óìîë÷àíèþ' ) ), $form_array ) )
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Èçìåíèòü ÿçûê íà...</b>" ,
|
|
$this->ipsclass->adskin->form_dropdown( "new", $form_array)
|
|
) );
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Ïåðåóñòàíîâèòü ÿçûê");
|
|
|
|
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
|
|
|
|
|
|
//-----------------------------------------
|
|
//-------------------------------
|
|
|
|
$this->ipsclass->admin->output();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|