]> git.mxchange.org Git - mailer.git/blob - inc/modules/admin/what-repair_lang.php
- Rewrites to use more the userid than the actual email address when sending
[mailer.git] / inc / modules / admin / what-repair_lang.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 02/12/2004 *
4  * ===================                          Last change: 02/12/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-repair_lang.php                             *
8  * -------------------------------------------------------------------- *
9  * Short description : "Repairs" the language system                    *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : "Repariert" das Sprachsystem                     *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
20  * For more information visit: http://www.mxchange.org                  *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
40         die();
41 } // END - if
42
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
45
46 // Get a list with current language files
47 $langFiles = getArrayFromDirectory('inc/language/', '', false, false, array('_de.php'), '.php', '@(\.|\.\.)$@', true, getCurrentLanguage());
48
49 // By default nothing is checked, which is isn't right...
50 $OUT = '';
51
52 // Get valid languages
53 $validLanguages = getValidLanguages(getCurrentLanguage());
54
55 // Check for all languages except current language
56 foreach ($validLanguages as $lang) {
57         // Now check for all files
58         foreach ($langFiles as $langFile) {
59                 // Get prefix
60                 $prefix = explode('_', $langFile);
61                 $prefix = $prefix[0];
62
63                 // If we have a prefix append the underscore
64                 if ((!empty($prefix)) && ($prefix != $langFile)) {
65                         // Add underscore for prefix files
66                         $prefix .= '_';
67                 } else {
68                         // Keep it empty for general language file
69                         $prefix = '';
70                 }
71
72                 // Construct english include filename
73                 $INC = sprintf("inc/language/%s%s.php", $prefix, $lang);
74
75                 // Is the file readable?
76                 if (isIncludeReadable($INC)) {
77                         // Readable so compare both
78                         if (ifLanguageFilesCompares('inc/language/' . $langFile, $INC, $lang)) {
79                                 // Compares so prepare content
80                                 $content = array(
81                                         'source' => $langFile,
82                                         'target' => basename($INC),
83                                 );
84
85                                 // Compares, all fine
86                                 $OUT .= loadTemplate('admin_repair_lang_row_compares', true, $content);
87                         } else {
88                                 // Generate difference output only if count is smaller/equals 100 entries
89                                 $diffContent = '<ul>';
90                                 if (count($GLOBALS['lang_diff'][$INC]) <= 100) {
91                                         // Display them, it is not more than 100 entries difference
92                                         foreach ($GLOBALS['lang_diff'][$INC] as $key => $value) {
93                                                 $diffContent .= '<li>' . $key . '=' . encodeEntities($value) . '</li>';
94                                         } // END - foreach
95                                 } else {
96                                         // To much to display!
97                                         $diffContent .= '<li>{--ADMIN_REPAIR_LANGUAGE_TO_MUCH--}</li>';
98                                 }
99                                 $diffContent .= '</ul>';
100
101                                 // Prepare content
102                                 $content = array(
103                                         'inc'          => $INC,
104                                         'source'       => $langFile,
105                                         'diff_content' => $diffContent,
106                                 );
107
108                                 // Compares, all fine
109                                 $OUT .= loadTemplate('admin_repair_lang_row_diff', true, $content);
110                         }
111                 } else {
112                         // Not readable, prepare content
113                         $content = array(
114                                 'inc'  => $INC,
115                                 'lang' => $lang,
116                         );
117
118                         // Load template
119                         $OUT .= loadTemplate('admin_repair_lang_row_404', true, $content);
120                 }
121         } // END - foreach
122 } // END - foreach
123
124 // Preapre content
125 $content = array(
126         'rows'       => $OUT,
127         'file_count' => count($langFiles),
128         'total_diff' => $GLOBALS['lang_diff_count']['total'],
129         'total_msgs' => $GLOBALS['msg_count'][getCurrentLanguage()],
130 );
131
132 // Load main template
133 loadTemplate('admin_repair_lang', false, $content);
134
135 // [EOF]
136 ?>