Issues (1177)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

application/modules/admin/languages.php (5 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
if (!defined('BASEPATH')) {
4
    exit('No direct script access allowed');
5
}
6
7
/**
8
 * @property Cms_admin cms_admin
9
 */
10
class Languages extends BaseAdminController
11
{
12
13 View Code Duplication
    public function __construct() {
14
15
        parent::__construct();
16
17
        $this->load->library('DX_Auth');
18
        admin_or_redirect();
19
20
        $this->load->library('lib_admin');
21
        $this->load->library('form_validation');
22
        $this->lib_admin->init_settings();
23
    }
24
25 View Code Duplication
    public function index() {
26
27
        $settings = $this->cms_admin->get_settings();
28
        $this->template->assign('template_selected', $settings['site_template']);
29
        $langs = $this->cms_admin->get_langs();
30
        $this->template->assign('langs', $langs);
31
        $this->template->show('languages', FALSE);
32
    }
33
34
    /**
35
     * return set of locales
36
     * @return array - locales
37
     */
38
    public function getLocales() {
39
40
        $langs_config = $this->config->item('locales');
41
        $langs = $langs_config;
42
43
        foreach ($langs as $key => $lang) {
44
            $locale = setlocale(LC_ALL, $lang . '.utf8', $lang . '.utf-8', $lang . '.UTF8', $lang . '.UTF-8', $lang . '.utf-8', $lang . '.UTF-8', $lang);
45
            if (!$locale) {
46
                unset($langs[$key]);
47
            }
48
        }
49
        if (!$langs) {
50
            return $langs_config;
51
        }
52
53
        return $langs;
54
    }
55
56
    /**
57
     * Show lang_create form
58
     */
59
    public function create_form() {
60
61
        //cp_check_perm('lang_create');
62
63
        $settings = $this->cms_admin->get_settings();
64
        $lang_folders = $this->_get_lang_folders();
65
66
        $this->template->assign('lang_folders', $lang_folders);
67
        $this->template->assign('templates', $this->_get_templates());
68
        $this->template->assign('template_selected', $settings['site_template']);
69
70
        $this->template->assign('locales', $this->getLocales());
71
        $this->template->assign('locale', '');
72
        $this->template->show('lang_create', FALSE);
73
    }
74
75
    /**
76
     * Insert new language
77
     */
78
    public function insert() {
79
        $this->form_validation->set_rules('name', lang('Language', 'admin'), 'trim|required|min_length[1]|max_length[100]');
80
        $this->form_validation->set_rules('identif', lang('Identifier', 'admin'), 'trim|required|min_length[1]|max_length[5]|alpha_dash|is_unique[languages.identif]');
81
        $this->form_validation->set_rules('locale', lang('Locale', 'admin'), 'required|max_length[250]');
82
83
        if ($this->form_validation->run($this) == FALSE) {
84
            showMessage(validation_errors(), '', 'r');
85
        } else {
86
87
            $data = [
88
                     'lang_name' => $this->input->post('name'),
89
                     'identif'   => $this->input->post('identif'),
90
                     'locale'    => $this->input->post('locale'),
91
                     'active'    => $this->input->post('active'),
92
                    ];
93
94
            $this->cms_admin->insert_lang($data);
95
96
            $this->lib_admin->log(lang('Create a language ', 'admin') . ' ' . $data['lang_name']);
97
98
            $this->cache->delete('main_site_langs');
99
100
            $this->createLanguageFolders($data['locale']);
101
102
            showMessage(lang('Language has been created', 'admin'));
103
104
            if ($this->input->post('create_exit')) {
105
                pjax('/admin/languages/');
106
            } else {
107
                $lastLangId = $this->db->query('SELECT id FROM languages ORDER BY id DESC')->row()->id;
108
                pjax('/admin/languages/edit/' . $lastLangId);
109
            }
110
        }
111
    }
112
113
    public function getPoFileSettingsText($lang = '', $type = '', $module = NULL) {
114
115
        $content = b"\xEF\xBB\xBF" .
116
            'msgid ""' . PHP_EOL .
117
            'msgstr ""' . PHP_EOL .
118
            '"Project-Id-Version: \n"' . PHP_EOL .
119
            '"Report-Msgid-Bugs-To: \n"' . PHP_EOL .
120
            '"POT-Creation-Date: ' . date('Y-m-d h:iO', time()) . '\n"' . PHP_EOL .
121
            '"PO-Revision-Date: ' . date('Y-m-d h:iO', time()) . '\n"' . PHP_EOL .
122
            '"Last-Translator:  \n"' . PHP_EOL .
123
            '"Language-Team:  \n"' . PHP_EOL .
124
            '"Language: ' . $lang . '\n"' . PHP_EOL .
125
            '"MIME-Version: 1.0\n"' . PHP_EOL .
126
            '"Content-Type: text/plain; charset=UTF-8\n"' . PHP_EOL .
127
            '"Content-Transfer-Encoding: 8bit\n"' . PHP_EOL .
128
            '"X-Poedit-KeywordsList: _;gettext;gettext_noop;lang\n"' . PHP_EOL;
129
        switch ($type) {
130
            case 'main':
131
                if (file_exists('./application/language/main/ru_RU/LC_MESSAGES/main.po')) {
132
                    $main_content = file('./application/language/main/ru_RU/LC_MESSAGES/main.po');
133
134
                    $content .= '"X-Poedit-Basepath: .\n"' . PHP_EOL .
135
                        '"X-Poedit-SourceCharset: utf-8\n"' . PHP_EOL .
136
                        '"X-Generator: Poedit 1.5.7\n"' . PHP_EOL .
137
                        '"X-Poedit-Language: \n"' . PHP_EOL .
138
                        '"X-Poedit-Country: \n"' . PHP_EOL;
139
140
                    foreach ($main_content as $line) {
141
                        if (strstr($line, 'X-Poedit-SearchPath')) {
142
                            $content .= $line;
143
                        }
144
                        if (!$line) {
145
                            break;
146
                        }
147
                    }
148 View Code Duplication
                } else {
149
                    $content .= '"X-Poedit-Basepath: .\n"' . PHP_EOL .
150
                        '"X-Poedit-SourceCharset: utf-8\n"' . PHP_EOL .
151
                        '"X-Generator: Poedit 1.5.7\n"' . PHP_EOL .
152
                        '"X-Poedit-Language: \n"' . PHP_EOL .
153
                        '"X-Poedit-Country: \n"' . PHP_EOL .
154
                        '"X-Poedit-SearchPath-0: ..\n"' . PHP_EOL;
155
                }
156
157
                break;
158
            case 'module':
159
160
                if ($module == 'admin') {
161
                    $content .= '"X-Poedit-Basepath: ../../..\n"' . PHP_EOL .
162
                        '"X-Poedit-SourceCharset: utf-8\n"' . PHP_EOL .
163
                        '"X-Generator: Poedit 1.5.7\n"' . PHP_EOL .
164
                        '"X-Poedit-Language: \n"' . PHP_EOL .
165
                        '"X-Poedit-Country: \n"' . PHP_EOL .
166
                        '"X-Poedit-SearchPath-0: .\n"' . PHP_EOL .
167
                        '"X-Poedit-SearchPath-1: ../../../templates/administrator\n"' . PHP_EOL .
168
                        '"X-Poedit-SearchPath-2: ../../' . getModContDirName('shop') . '/shop/admin\n"' . PHP_EOL .
169
                        'X-Poedit-SearchPath-3: ../../../application/' . getModContDirName('shop') . '/shop/models/build/classes\n' . PHP_EOL;
170 View Code Duplication
                } else {
171
                    $content .= '"X-Poedit-Basepath: ../../..\n"' . PHP_EOL .
172
                        '"X-Poedit-SourceCharset: utf-8\n"' . PHP_EOL .
173
                        '"X-Generator: Poedit 1.5.7\n"' . PHP_EOL .
174
                        '"X-Poedit-Language: \n"' . PHP_EOL .
175
                        '"X-Poedit-Country: \n"' . PHP_EOL .
176
                        '"X-Poedit-SearchPath-0: .\n"' . PHP_EOL;
177
                }
178
179
                break;
180
            case 'template':
181
                $content .= '"X-Poedit-Basepath: ../../../..\n"' . PHP_EOL .
182
                    '"X-Poedit-SourceCharset: utf-8\n"' . PHP_EOL .
183
                    '"X-Generator: Poedit 1.5.7\n"' . PHP_EOL .
184
                    '"X-Poedit-Language: \n"' . PHP_EOL .
185
                    '"X-Poedit-Country: \n"' . PHP_EOL .
186
                    '"X-Poedit-SearchPath-0: .\n"' . PHP_EOL;
187
                break;
188
        }
189
        return $content;
190
    }
191
192
    /**
193
     * Create language folders for templates, front, and modules
194
     * @param string $lang - locale identifier: ru_RU, en_US, de_DC
195
     */
196
    public function createLanguageFolders($lang) {
197
198
        $templates_dir = './templates';
199
        $main_dir = './application/language/main';
200
        $modules_dir = './application/modules';
201
202
        $template_content = $this->getPoFileSettingsText($lang, 'template');
203
        $main_content = $this->getPoFileSettingsText($lang, 'main');
204
        if (is_dir($templates_dir)) {
205
            $templates = scandir($templates_dir);
206
            foreach ($templates as $template) {
207
                if (is_dir("$templates_dir/$template") && $template != '.' && $template != '..' && $template[0] != '.') {
208
                    if (!is_dir("$templates_dir/$template/language/$template/$lang")) {
209
                        mkdir("$templates_dir/$template/language/$template/$lang", 0777);
210
                        mkdir("$templates_dir/$template/language/$template/$lang/LC_MESSAGES", 0777);
211
                        file_put_contents("$templates_dir/$template/language/$template/$lang/LC_MESSAGES/$template.po", $template_content);
212
                    }
213
                }
214
            }
215
        }
216
217
        if (is_dir($main_dir)) {
218
            if (!is_dir($main_dir . '/' . $lang)) {
219
                mkdir($main_dir . '/' . $lang, 0777);
220
                mkdir($main_dir . '/' . $lang . '/LC_MESSAGES', 0777);
221
                file_put_contents($main_dir . '/' . $lang . '/LC_MESSAGES/main.po', $main_content);
222
            }
223
        }
224
225
        if (is_dir($modules_dir)) {
226
            $modules = scandir($modules_dir);
227
            foreach ($modules as $module) {
228
                if (is_dir($modules_dir . '/' . $module . '/language') && $module != '.' && $module != '..' && $module[0] != '.') {
229
                    if (!is_dir($modules_dir . '/' . $module . '/language/' . $lang)) {
230
                        mkdir($modules_dir . '/' . $module . '/language/' . $lang, 0777);
231
                        mkdir($modules_dir . '/' . $module . '/language/' . $lang . '/LC_MESSAGES', 0777);
232
                        $module_content = $this->getPoFileSettingsText($lang, 'module', $module);
233
                        file_put_contents($modules_dir . '/' . $module . '/language/' . $lang . '/LC_MESSAGES/' . $module . '.po', $module_content);
234
                        // to delete lang folders
235
                        //                         system("rm -rf " . escapeshellarg($modules_dir . '/' . $module . '/language/de_DE'));
236
                    }
237
                }
238
            }
239
        }
240
    }
241
242
    /**
243
     * Rename locales folders (example ./application/modules/module_name/langauge/lo_LO)
244
     * @param string $from_locale - locale name to rename
245
     * @param string $to_locale - locale name rename by
246
     * @return boolean
247
     */
248
    private function renameLocaleFolders($from_locale, $to_locale) {
249
250
        if ($from_locale && $to_locale) {
251
            $templates_dir = './templates';
252
            $main_dir = './application/language/main';
253
            $modules_dir = './application/modules';
254
255
            if (is_dir($main_dir)) {
256
                $from_name = $main_dir . '/' . $from_locale;
257
                $to_name = $main_dir . '/' . $to_locale;
258
                if (is_dir($from_name)) {
259
                    chmod($from_name, 0777);
260
                    rename($from_name, $to_name);
261
                }
262
            }
263
264
            if (is_dir($modules_dir)) {
265
                foreach (new DirectoryIterator($modules_dir) as $module) {
266
                    $language_dir = $modules_dir . '/' . $module->getFilename() . '/language/';
267
                    if (is_dir($language_dir) && $module->isDir() && !$module->isDot()) {
268
                        $from_name = $language_dir . $from_locale;
269
                        $to_name = $language_dir . $to_locale;
270
                        if (is_dir($from_name)) {
271
                            chmod($from_name, 0777);
272
                            rename($from_name, $to_name);
273
                        }
274
                    }
275
                }
276
            }
277
278
            if (is_dir($templates_dir)) {
279
                foreach (new DirectoryIterator($templates_dir) as $template) {
280
                    if ($template->isDir() && !$template->isDot()) {
281
                        $from_name = $templates_dir . '/' . $template . '/language/' . $template . '/' . $from_locale;
282
                        $to_name = $templates_dir . '/' . $template . '/language/' . $template . '/' . $to_locale;
283
                        if (is_dir($from_name)) {
284
                            chmod($from_name, 0777);
285
                            rename($from_name, $to_name);
286
                        }
287
                    }
288
                }
289
            }
290
291
            return TRUE;
292
        } else {
293
            return FALSE;
294
        }
295
    }
296
297
    /**
298
     * @param string $dir
299
     */
300
    private function rrmdir($dir) {
301
302
        foreach (glob($dir . '/*') as $file) {
303
            if (is_dir($file)) {
304
                $this->rrmdir($file);
305
            } else {
306
                unlink($file);
307
            }
308
        }
309
        rmdir($dir);
310
    }
311
312
    private function deleteLanguageFolders($lang) {
313
314
        $templates_dir = './templates';
315
        $main_dir = './application/language/main';
316
        $modules_dir = './application/modules';
317
        if (is_dir($templates_dir)) {
318
            $templates = scandir($templates_dir);
319
            foreach ($templates as $template) {
320
                if (is_dir($templates_dir . '/' . $template) && $template != '.' && $template != '..' && $template[0] != '.') {
321
                    if (is_dir($templates_dir . '/' . $template . '/language/' . $template . '/' . $lang)) {
322
                        chmod($templates_dir . '/' . $template . '/language/' . $template . '/' . $lang, 0777);
323
                        $this->rrmdir($templates_dir . '/' . $template . '/language/' . $template . '/' . $lang);
324
                    }
325
                }
326
            }
327
        }
328
329
        if (is_dir($main_dir)) {
330
            if (is_dir($main_dir . '/' . $lang)) {
331
                chmod($main_dir . '/' . $lang, 0777);
332
                $this->rrmdir($main_dir . '/' . $lang);
333
            }
334
        }
335
336
        if (is_dir($modules_dir)) {
337
            $modules = scandir($modules_dir);
338
            foreach ($modules as $module) {
339
                if (is_dir($modules_dir . '/' . $module . '/language') && $module != '.' && $module != '..' && $module[0] != '.') {
340
                    if (is_dir($modules_dir . '/' . $module . '/language/' . $lang)) {
341
                        chmod($modules_dir . '/' . $module . '/language/' . $lang, 0777);
342
                        $this->rrmdir($modules_dir . '/' . $module . '/language/' . $lang);
343
                    }
344
                }
345
            }
346
        }
347
    }
348
349
    /**
350
     * Show lang_edit form
351
     */
352
    public function edit($lang_id) {
353
354
        //cp_check_perm('lang_edit');
355
        // get lang params
356
        $lang = $this->cms_admin->get_lang($lang_id);
357
        $this->template->add_array($lang);
358
359
        $this->template->assign('lang_folders', $this->_get_lang_folders());
360
        $this->template->assign('templates', $this->_get_templates());
361
362
        $this->template->assign('folder_selected', $lang['folder']);
363
        $this->template->assign('locales', $this->getLocales());
364
        $this->template->assign('locale', $lang['locale']);
365
        $this->template->assign('is_active', $lang['active']);
366
        $this->template->assign('is_default', $lang['default']);
367
        $this->template->assign('template_selected', $lang['template']);
368
369
        $settings = $this->cms_admin->get_settings();
370
        $this->template->assign('template_installed', $settings['site_template']);
371
372
        $this->template->show('lang_edit', FALSE);
373
    }
374
375
    /**
376
     * Update language
377
     * @param int $lang_id
378
     */
379
    public function update($lang_id) {
380
381
        //cp_check_perm('lang_edit');
382
383
        $this->form_validation->set_rules('lang_name', lang('Language', 'admin'), 'trim|required|min_length[1]|max_length[100]');
384
        $this->form_validation->set_rules('identif', lang('Identifier', 'admin'), 'trim|required|min_length[1]|max_length[5]|alpha_dash');
385
        $this->form_validation->set_rules('locale', lang('Locale', 'admin'), 'required|max_length[250]');
386
387
        if ($this->form_validation->run($this) == FALSE) {
388
            showMessage(validation_errors(), '', 'r');
389
        } else {
390
391
            $lang = $this->cms_admin->get_lang($lang_id);
392
            $post_locale = trim($this->input->post('locale'));
393
394
            $data = [
395
                     'lang_name' => $this->input->post('lang_name'),
396
                     'locale'    => $post_locale,
397
                    ];
398
399
            $this->cms_admin->update_lang($data, $lang_id);
400
401
            $this->lib_admin->log(lang('Changed a language', 'admin') . ' ' . $data['lang_name']);
402
403
            $this->cache->delete_all();
404
405
            /* Rename languages folders */
406
            if (($lang['locale'] !== $post_locale) && $post_locale) {
407
                $this->renameLocaleFolders($lang['locale'], $post_locale);
408
                $this->createLanguageFolders($post_locale);
409
            }
410
411
            showMessage(lang('Changes has been saved', 'admin'));
412
413
            $action = $this->input->post('action');
414
            if ($action == 'close') {
415
                pjax('/admin/languages');
416
            }
417
        }
418
    }
419
420
    /**
421
     * Delete language
422
     */
423
    public function delete() {
424
425
        //cp_check_perm('lang_delete');
426
        //$id = $this->input->post('lang_id');
427
        $id = $this->input->post('ids');
428
        if (is_array($id)) {
429
            foreach ($id as $item) {
430
                $lang = $this->cms_admin->get_lang($item);
431
                ($hook = get_hook('admin_language_delete')) ? eval($hook) : NULL;
0 ignored issues
show
The call to get_hook() has too many arguments starting with 'admin_language_delete'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
432 View Code Duplication
                if ($lang['default'] == 1) {
433
                    showMessage(lang('This language has been used by default and can not be deleted', 'admin'), lang('Blocking', 'admin'), 'r');
434
                    exit;
435
                }
436
                $this->cms_admin->delete_lang($item);
437
                $this->deleteLanguageFolders($lang['locale']);
438
                // delete translated pages
439
                $this->db->where('lang', $item);
440
                $this->db->delete('content');
441
                $this->cache->delete('main_site_langs');
442
                $this->lib_admin->log(lang('Deleted the ID language', 'admin') . ' ' . $item);
443
            }
444
        } else {
445
            $lang = $this->cms_admin->get_lang($id);
446
447
            ($hook = get_hook('admin_language_delete')) ? eval($hook) : NULL;
0 ignored issues
show
The call to get_hook() has too many arguments starting with 'admin_language_delete'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
448
449 View Code Duplication
            if ($lang['default'] == 1) {
450
                showMessage(lang('This language has been used by default and can not be deleted', 'admin'), lang('Blocking', 'admin'), 'r');
451
                exit;
452
            }
453
454
            $this->cms_admin->delete_lang($id);
455
456
            // delete translated pages
457
            $this->db->where('lang', $id);
458
            $this->db->delete('content');
459
460
            $this->deleteLanguageFolders($lang['locale']);
461
            $this->cache->delete('main_site_langs');
462
463
            $this->lib_admin->log(lang('Deleted the ID language', 'admin') . ' ' . $id);
464
        }
465
        showMessage(lang('the language has been deleted', 'admin'));
466
        pjax('/admin/languages');
467
        //updateDiv('languages_page_w_content', site_url('admin/languages/'));
468
    }
469
470
    /**
471
     * Set default language
472
     */
473
    public function set_default() {
474
475
        //cp_check_perm('lang_edit');
476
477
        $lang_id = $this->input->post('lang');
478
479
        ($hook = get_hook('admin_change_def_language')) ? eval($hook) : NULL;
0 ignored issues
show
The call to get_hook() has too many arguments starting with 'admin_change_def_language'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
480
481
        $this->cache->delete('main_site_langs');
482
483
        $this->cms_admin->set_default_lang($lang_id);
484
485
        $lang = $this->cms_admin->get_lang($lang_id);
486
487
        $this->lib_admin->log(lang('Specified a language or selected a language', 'admin') . ' ' . $lang['lang_name'] . ' ' . lang('by default', 'admin'));
488
489
        showMessage(lang('The language has been installed by default', 'admin') . ' <b> ' . $lang['lang_name'] . ' </b>');
490
    }
491
492
    /**
493
     * Search language folders
494
     *
495
     * @access private
496
     * @return array
0 ignored issues
show
Should the return type not be false|array? Also, consider making the array more specific, something like array<String>, or String[].

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

If the return type contains the type array, this check recommends the use of a more specific type like String[] or array<String>.

Loading history...
497
     */
498
    private function _get_lang_folders() {
499
500
        $new_arr = [];
501
502
        if ($handle = opendir(APPPATH . 'language/')) {
503
            while (false !== ($file = readdir($handle))) {
504
                if ($file != '.' && $file != '..' && $file != 'administrator') {
505
506
                    if (!is_file(APPPATH . 'language/' . $file)) {
507
                        $new_arr[$file] = $file;
508
                    }
509
                }
510
            }
511
            closedir($handle);
512
        } else {
513
            return FALSE;
514
        }
515
        return $new_arr;
516
    }
517
518
    /**
519
     * Search templates in TEMPLATES_PATH folder
520
     *
521
     * @access private
522
     * @return array
0 ignored issues
show
Should the return type not be array|false? Also, consider making the array more specific, something like array<String>, or String[].

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

If the return type contains the type array, this check recommends the use of a more specific type like String[] or array<String>.

Loading history...
523
     */
524
    public function _get_templates() {
525
526
        return get_templates();
527
    }
528
529
    /**
530
     * Change language activity via ajax request
531
     */
532
    public function ajaxChangeActive() {
533
        $id = $this->input->post('id');
534
        $active = $this->input->post('active');
535
536
        if ($id) {
537
            $this->db->where('id', $id)
538
                ->set('active', $active)
539
                ->update('languages');
540
        }
541
        $this->cache->delete_all();
542
    }
543
544
}