Файл: adultscript-2.0.3-pro/files/admin/modules/language/components/files_edit.php
Строк: 47
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_language_files_edit extends VModule_Admin_language
{
public function __construct()
{
}
public function render()
{
$db = VF::factory('database');
$errors = array();
$messages = array();
$file = array();
$file_id = (isset($_GET['id'])) ? (int) trim($_GET['id']) : 0;
$db->query("SELECT code, name, type FROM #__language_files WHERE file_id = ".$file_id." LIMIT 1");
if ($db->affected_rows()) {
$file = $db->fetch_assoc();
$cache_id = $file['code'].'.'.$file['type'].'.'.$file['name'];
if (isset($_POST['submit-edit'])) {
$translation = array();
foreach ($_POST as $key => $value) {
if ($key != '' && $key != 'submit-edit' && $value != '') {
$translation[$key] = str_replace("'", ''', $value);
}
}
$db->query("UPDATE #__language_files
SET file = '".$db->escape(serialize($translation))."'
WHERE file_id = ".$file_id."
LIMIT 1");
VF::cache_set($cache_id, $translation, 'language', FALSE);
$messages[] = 'Language file updated!';
}
$db->query("SELECT file_id, code, type, name, description, file
FROM #__language_files
WHERE file_id = ".$file_id."
LIMIT 1");
$file = $db->fetch_assoc();
$file['file'] = ($file['file'] == '') ? array() : unserialize($file['file']);
}
$tpl = VF::factory('template');
$tpl->menu = 'main';
$tpl->submenu = 'extend';
$tpl->extramenu = 'language_manage';
$tpl->meta_title = 'Admin::Language::Edit';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->file = $file;
$tpl->code = $file['code'];
$tpl->load(array('header', 'language_files_edit', 'footer'));
$tpl->display();
}
private function update_cache($code, $type, $name, $file)
{
}
}