コード例 #1
0
     showsubmit('tplsubmit', 'submit', 'del');
     showtablefooter();
     showformfooter();
 } else {
     if ($_G['gp_newname']) {
         if (!$_G['gp_newdirectory']) {
             cpmsg('tpl_new_directory_invalid', '', 'error');
         } elseif (!istpldir($_G['gp_newdirectory'])) {
             $directory = $_G['gp_newdirectory'];
             cpmsg('tpl_directory_invalid', '', 'error', array('directory' => $directory));
         }
         DB::insert('common_template', array('name' => $_G['gp_newname'], 'directory' => $_G['gp_newdirectory'], 'copyright' => $_G['gp_newcopyright']));
     }
     foreach ($_G['gp_directorynew'] as $id => $directory) {
         if (!$_G['gp_delete'] || $_G['gp_delete'] && !in_array($id, $_G['gp_delete'])) {
             if (!istpldir($directory)) {
                 cpmsg('tpl_directory_invalid', '', 'error', array('directory' => $directory));
             } elseif ($id == 1 && $directory != './template/default') {
                 cpmsg('tpl_default_directory_invalid', '', 'error');
             }
             DB::query("UPDATE " . DB::table('common_template') . " SET name='{$_G['gp_namenew'][$id]}', directory='{$_G['gp_directorynew'][$id]}' WHERE templateid='{$id}'", 'UNBUFFERED');
             if (!empty($_G['gp_copyrightnew'][$id])) {
                 DB::query("UPDATE " . DB::table('common_template') . " SET copyright='{$_G['gp_copyrightnew'][$id]}' WHERE templateid='{$id}' AND copyright=''", 'UNBUFFERED');
             }
         }
     }
     if (is_array($_G['gp_delete'])) {
         if (in_array('1', $_G['gp_delete'])) {
             cpmsg('tpl_delete_invalid', '', 'error');
         }
         if ($ids = dimplode($_G['gp_delete'])) {
コード例 #2
0
		fclose($fp);

		if(substr(basename($filename), 0, 3) == 'css') {
			updatecache('styles');
		}

		cpmsg('templates_edit_succeed', "admincp.php?action=templates&edit=$templateid&keyword=$keywordenc");

	}

} elseif($action == 'tpladd') {
	checkpermission('tpledit');
	$query = $db->query("SELECT * FROM {$tablepre}templates WHERE templateid='$edit'");
	if(!$template = $db->fetch_array($query)) {
		cpmsg('templates_add_invalid');
	} elseif(!istpldir($template['directory'])) {
		$directory = $template['directory'];
		cpmsg('templates_directory_invalid');
	} elseif(file_exists(DISCUZ_ROOT."./$template[directory]/$name.htm")) {
		cpmsg('templates_add_duplicate');
	} elseif(!@$fp = fopen(DISCUZ_ROOT."./$template[directory]/$name.htm", 'wb')) {
		cpmsg('templates_add_file_invalid');
	}

	@fclose($fp);
	cpmsg('templates_add_succeed', "admincp.php?action=tpledit&templateid=1&fn=$name.htm");

}

function langedit($var) {
	$return = '<tr><td colspan="2"><b>'.$var.'</b></td></tr>';