XOOPS  2.6.0
xoops_xlanguage.php
Go to the documentation of this file.
1 <?php
15 
17 if (!$helper) {
18  ob_end_flush();
19  return;
20 }
21 
22 require_once dirname(__FILE__).'/../../../../../../mainfile.php';
23 
25 $xoops->disableErrorReporting();
26 $xoops->simpleHeader(false);
27 
28 $helper->loadLanguage('admin');
29 $helper->loadLanguage('tinymce');
30 
31 $op = Request::getCmd('op', '');
32 if ($op == 'save') {
33  if (!$xoops->security()->check()) {
34  $xoops->redirect('xoops_xlanguage.php', 2, implode(',', $xoops->security()->getErrors()));
35  }
36 
37  XoopsLoad::load('system', 'system');
38  $lang = $helper->getHandlerLanguage()->create();
39  $lang->CleanVarsForDB();
40 
41  if ($helper->getHandlerLanguage()->insert($lang)) {
42  $helper->getHandlerLanguage()->createConfig();
43  $xoops->redirect('xoops_xlanguage.php', 2, _AM_XLANGUAGE_SAVED);
44  }
45 }
46 
47 // check user/group
48 $groups = $xoops->getUserGroups();
49 $gperm_handler = $xoops->getHandlerGroupperm();
50 $admin = false;
51 if ($gperm_handler) {
52  $xlanguage = $xoops->getHandlerModule()->getByDirName('xlanguage');
53  if ($xlanguage) {
54  $admin = $gperm_handler->checkRight('system_admin', $xlanguage->getVar('mid'), $groups);
55  }
56 }
57 
59 
60 if ($helper) {
61  $xoopsTpl->assign('form_txt', $helper->getForm($helper->getHandlerLanguage()->loadConfig(), 'tinymce')->render());
62  if ($admin) {
63  $xoopsTpl->assign('form_add', $helper->getForm($helper->getHandlerLanguage()->create(), 'language')->render());
64  }
65 }
66 
67 $xoopsTpl->display('module:xlanguage/xlanguage_tinymce.tpl');
68 $xoops->simpleFooter();
static getInstance()
Definition: Xoops.php:160
$lang
Definition: dialog.php:106
if($op== 'save') $groups
$gperm_handler
if($gperm_handler) $xoopsTpl
static getHelper($dirname= 'system')
Definition: Helper.php:27
static load($name, $type="core")
Definition: xoopsload.php:65