} if (isset($_POST['cancel'])) { URL::redirect(URL::admin()); } if (isset($_POST['confirm'])) { del_folder($_GET['del']); cpg_error(get_lang_title($_GET['del']) . ' language pack successfully deleted', _TB_INFO, URL::admin()); } cpg_delete_msg(URL::admin('&del=' . $_GET['del']), 'Are you sure that you want to delete the ' . get_lang_title($_GET['del']) . ' language pack?'); } elseif (isset($_POST['cvs_lang'])) { require_once CORE_PATH . 'classes/cvs.php'; if (!preg_match('#^([a-zA-Z0-9_\\-]+)$#', $_POST['cvs_lang'])) { cpg_error('Invalid title'); } $path = 'language/' . $_POST['cvs_lang']; if (!CVS::create($path, 'dragonflycms.org', '/cvs', 'l10n/' . $_POST['cvs_lang'], $_POST['cvs_uname'], $_POST['cvs_pass'])) { cpg_error('Error creating important CVS files and folders'); } else { $log = CVS::update($path); if (!isset($log['error'])) { if (!isset($log['notes'])) { cpg_error(get_lang_title($_POST['cvs_lang']) . ' language pack successfully installed', _TB_INFO, URL::admin()); } $log = nl2br(CVS::formatlog($log)); cpg_error($log, _TB_INFO); } cpg_error($log['error']); } } elseif (isset($_POST['save_cfg'])) { foreach ($MAIN_CFG['global'] as $key => $val) { if (isset($_POST[$key]) && in_array($key, array('multilingual', 'useflags'))) {
header('Content-Encoding: none'); header('Content-Type: text/plain'); echo CVS::formatlog($log); echo "\n\n" . _TASK_COMPLETED; exit; } else { cpg_error($log['error']); } } else { if (isset($_POST['cvsmodule'])) { require_once CORE_PATH . 'classes/cvs.php'; if (!preg_match('#^([a-zA-Z0-9_\\-]+)$#', $_POST['cvsmodule'])) { cpg_error(sprintf(_ERROR_NO_EXIST, _FILENAME)); } $path = 'modules/' . $_POST['cvsmodule']; if (!CVS::create($path, $_POST['server'], $_POST['folder'], $_POST['module'], $_POST['cvsusername'], $_POST['cvspassword'])) { cpg_error('Error creating important CVS files and folders'); } else { $log = CVS::update($path); if (!isset($log['error'])) { if (!isset($log['notes'])) { $inst_file = is_file($path . '/sql/cpg_inst.php') ? $path . '/sql/cpg_inst.php' : (is_file($path . '/cpg_inst.php') ? $path . '/cpg_inst.php' : false); if ($inst_file) { $cpg_inst = implode('', file($inst_file)); if (preg_match('#class ([a-zA-Z0-9_\\-]+)#si', $cpg_inst, $matches)) { $cpg_inst = preg_replace("#(class|function) {$matches[1]}#", "\$1 {$_POST['cvsmodule']}", $cpg_inst); if (!file_write($inst_file, $cpg_inst)) { cpg_error('Module successfully recieved from CVS Repository.<br /><br /><b>NOTE</b><br />You must edit "' . $path . '/cpg_inst.php" to get the installer properly working', '', URL::admin('modules')); } } }