Exemple #1
0
		}
		$tpltpl_handler =& icms::handler('icms_view_template_file');
		$tplfile =& $tpltpl_handler->get($id, TRUE);
		$err = array();
		if (!is_object($tplfile)) {
			$err[] = sprintf(_MD_TPLSET_TEMPLATE_NOTEXIST, $id);
		} else {
			if ($tplfile->getVar('tpl_tplset') != 'default') {
				$tplfile->setVar('tpl_source', $html);
				$tplfile->setVar('tpl_lastmodified', time());

				if (!$tpltpl_handler->insert($tplfile)) {
					$err[] = sprintf(_MD_TPLSET_INSERT_FAILED, $tplfile->getVar('tpl_file'));
				} else {
					$xoopsTpl = new icms_view_Tpl();
					if ($xoopsTpl->is_cached('db:' . $tplfile->getVar('tpl_file'))) {
						if (!$xoopsTpl->clear_cache('db:' . $tplfile->getVar('tpl_file'))) {
						}
					}
					if ($tplfile->getVar('tpl_tplset') == $icmsConfig['template_set']) {
						$icmsAdminTpl->template_touch($id);
					}
				}
			} else {
				$err[] = _MD_TPLSET_DEFAULT_NOEDIT;
			}
		}

		if (count($err) == 0) {
			if (!empty($moddir)) {
				redirect_header('admin.php?fct=tplsets&op=edittpl&id=' . $tplfile->getVar('tpl_id'), 2, _MD_AM_DBUPDATED);