/[pkg-tikiwiki]/trunk/tiki-imexport_languages.php
ViewVC logotype

Contents of /trunk/tiki-imexport_languages.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download)
Tue Jul 11 06:27:24 2006 UTC (6 years, 10 months ago) by marcusb-guest
File size: 2756 byte(s)
Imported into trunk (integration branch).
1 <?php
2
3 // $Header: /cvsroot/tikiwiki/tiki/tiki-imexport_languages.php,v 1.15.2.1 2005/01/01 00:11:24 damosoft Exp $
4
5 // Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
6 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
7 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
8
9 // Initialization
10 require_once ('tiki-setup.php');
11
12 if ($lang_use_db != 'y') {
13 $smarty->assign('msg', tra("This feature is disabled").": lang_use_db");
14
15 $smarty->display("error.tpl");
16 die;
17 }
18
19 if ($tiki_p_edit_languages != 'y') {
20 $smarty->assign('msg', tra("Permission denied to use this feature"));
21
22 $smarty->display("error.tpl");
23 die;
24 }
25
26 $query = "select `lang` from `tiki_languages`";
27 $result = $tikilib->query($query,array());
28 $languages = array();
29
30 while ($res = $result->fetchRow()) {
31 $languages[] = $res["lang"];
32 }
33
34 // Lookup translated names for the languages
35 $languages = $tikilib->format_language_list($languages);
36 $smarty->assign_by_ref('languages',$languages);
37
38 // Get available languages from Disk
39 $languages_files = array();
40 $languages_files = $tikilib->list_languages();
41 $smarty->assign_by_ref('languages_files', $languages_files);
42
43 // Save Variables
44 if (isset($_REQUEST["imp_language"])) {
45 $imp_language = $_REQUEST["imp_language"];
46
47 $smarty->assign('imp_language', $imp_language);
48 }
49
50 if (isset($_REQUEST["exp_language"])) {
51 $exp_language = $_REQUEST["exp_language"];
52
53 $smarty->assign('exp_language', $exp_language);
54 }
55
56 // Import
57 if (isset($_REQUEST["import"])) {
58 check_ticket('import-lang');
59
60 include_once ('lang/' . $imp_language . '/language.php');
61
62 $impmsg = "Included lang/" . $imp_language . "/language.php";
63 $query = "insert into `tiki_languages` values (?,?)";
64 $result = $tikilib->query($query, array($imp_language,''), -1, -1, false);
65
66 while (list($key, $val) = each($lang)) {
67 $query = "insert into `tiki_language` values (?,?,?)";
68 $result = $tikilib->query($query, array($key,$imp_language,$val), -1, -1, false);
69 }
70
71 $smarty->assign('impmsg', $impmsg);
72 }
73
74 // Export
75 if (isset($_REQUEST["export"])) {
76 check_ticket('import-lang');
77 $query = "select `source`, `tran` from `tiki_language` where `lang`=?";
78 $result = $tikilib->query($query,array($exp_language));
79 $data = "<?php\n\$lang=Array(\n";
80
81 while ($res = $result->fetchRow()) {
82 $data = $data . "\"" . $res["source"] . "\" => \"" . $res["tran"] . "\",\n";
83 }
84
85 $data = $data . ");\n?>";
86 header ("Content-type: application/unknown");
87 header ("Content-Disposition: inline; filename=language.php");
88 echo $data;
89 exit (0);
90 $smarty->assign('expmsg', $expmsg);
91 }
92 ask_ticket('import-lang');
93
94 $smarty->assign('mid', 'tiki-imexport_languages.tpl');
95 $smarty->display("tiki.tpl");
96
97 ?>

  ViewVC Help
Powered by ViewVC 1.1.5