[xoops-cvslog 3089] CVS update: xoops2jp/html/modules/legacyRender/admin/actions

Back to archive index

Minahito minah****@users*****
2006年 5月 17日 (水) 20:15:38 JST


Index: xoops2jp/html/modules/legacyRender/admin/actions/TplfileDownloadAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacyRender/admin/actions/TplfileDownloadAction.class.php:1.1.2.1
--- /dev/null	Wed May 17 20:15:38 2006
+++ xoops2jp/html/modules/legacyRender/admin/actions/TplfileDownloadAction.class.php	Wed May 17 20:15:38 2006
@@ -0,0 +1,48 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacyRender/admin/forms/TplfileEditForm.class.php";
+
+class LegacyRender_TplfileDownloadAction extends LegacyRender_Action
+{
+	var $mObject = null;
+	
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		$id = xoops_getrequest('tpl_id');
+		
+		$handler =& xoops_getmodulehandler('tplfile');
+		$this->mObject =& $handler->get($id);
+		
+		return $this->mObject != null ? LEGACYRENDER_FRAME_VIEW_SUCCESS : LEGACYRENDER_FRAME_VIEW_ERROR;
+	}
+
+	function executeViewSuccess(&$controller, &$xoopsUser, &$render)
+	{
+		$this->mObject->loadSource();
+		$source = $this->mObject->Source->get('tpl_source');
+		
+		header('Cache-Control: no-cache, must-revalidate');
+		header('Pragma: no-cache');
+		header('Content-Type: application/force-download');
+		
+		if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
+			header('Content-Disposition: filename=' . $this->mObject->getVar('tpl_file'));
+		} else {
+			header('Content-Disposition: attachment; filename=' . $this->mObject->getVar('tpl_file'));
+		}
+
+		header('Content-length: ' . strlen($source));
+		print $source;
+		
+		exit(0);
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$render)
+	{
+		redirect_header("./index.php?action=TplsetList", 1, _AD_LEGACYRENDER_ERROR_DBUPDATE_FAILED);
+	}
+}
+
+?>


xoops-cvslog メーリングリストの案内
Back to archive index