Minahito
minah****@users*****
2006年 4月 24日 (月) 16:31:08 JST
Index: xoops2jp/html/modules/legacyRender/class/ActionFrame.class.php diff -u /dev/null xoops2jp/html/modules/legacyRender/class/ActionFrame.class.php:1.1.2.1 --- /dev/null Mon Apr 24 16:31:08 2006 +++ xoops2jp/html/modules/legacyRender/class/ActionFrame.class.php Mon Apr 24 16:31:08 2006 @@ -0,0 +1,151 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . "/class/XCube_ActionStrategy.class.php"; + +define ("LEGACYRENDER_FRAME_PERFORM_SUCCESS", 1); +define ("LEGACYRENDER_FRAME_PERFORM_FAIL", 2); +define ("LEGACYRENDER_FRAME_INIT_SUCCESS", 3); + +define ("LEGACYRENDER_FRAME_VIEW_NONE", 1); +define ("LEGACYRENDER_FRAME_VIEW_SUCCESS", 2); +define ("LEGACYRENDER_FRAME_VIEW_ERROR", 3); +define ("LEGACYRENDER_FRAME_VIEW_INDEX", 4); +define ("LEGACYRENDER_FRAME_VIEW_INPUT", 5); + +class LegacyRender_ActionFrame extends XCube_ActionStrategy +{ + var $mActionName = null; + var $mAction = null; + var $mAdminFlag = null; + + function Legacy_ActionFrame($admin) + { + $this->mAdminFlag = $admin; + } + + function setActionName($name) + { + $this->mActionName = $name; + } + + function &execute(&$controller) + { + if (!preg_match("/^\w+$/", $this->mActionName)) { + die(); + } + + // + // Create action object by mActionName + // + $className = "LegacyRender_" . ucfirst($this->mActionName) . "Action"; + $fileName = ucfirst($this->mActionName) . "Action"; + if ($this->mAdminFlag) { + $fileName = XOOPS_MODULE_PATH . "/base/admin/actions/${fileName}.class.php"; + } + else { + $fileName = XOOPS_MODULE_PATH . "/base/actions/${fileName}.class.php"; + } + + if (!file_exists($fileName)) { + die(); + } + + require_once $fileName; + + if (class_exists($className)) { + $this->mAction =& new $className($this->mAdminFlag); + } + + if (!is_object($this->mAction)) { + die(); + } + + if (!$this->mAction->hasPerm($controller, $controller->getXoopsUser())) { + if ($this->mAdminFlag) { + $controller->executeForward(XOOPS_URL . "/admin.php"); + } + else { + $controller->executeForward(XOOPS_URL); + } + } + + $this->mAction->prepare($controller, $controller->getXoopsUser()); + + if (xoops_getenv("REQUEST_METHOD") == "POST") { + $viewStatus = $this->mAction->execute($controller, $controller->getXoopsUser()); + } + else { + $viewStatus = $this->mAction->getDefaultView($controller, $controller->getXoopsUser()); + } + + switch($viewStatus) { + case LEGACYRENDER_FRAME_VIEW_SUCCESS: + $this->mAction->executeViewSuccess($controller, $controller->getXoopsUser(), $controller->mRenderSystem); + break; + + case LEGACYRENDER_FRAME_VIEW_ERROR: + $this->mAction->executeViewError($controller, $controller->getXoopsUser(), $controller->mRenderSystem); + break; + + case LEGACYRENDER_FRAME_VIEW_INDEX: + $this->mAction->executeViewIndex($controller, $controller->getXoopsUser(), $controller->mRenderSystem); + break; + + case LEGACYRENDER_FRAME_VIEW_INPUT: + $this->mAction->executeViewInput($controller, $controller->getXoopsUser(), $controller->mRenderSystem); + break; + } + } +} + +class LegacyRender_Action +{ + /** + * @access private + */ + var $_mAdminFlag = false; + + function Legacy_Action($adminFlag = false) + { + $this->_mAdminFlag = $adminFlag; + } + + function hasPerm(&$controller, &$xoopsUser) + { + return true; + } + + function prepare(&$controller, &$xoopsUser) + { + } + + function getDefaultView(&$controller, &$xoopsUser) + { + return LEGACY_FRAME_VIEW_NONE; + } + + function execute(&$controller, &$xoopsUser) + { + return LEGACY_FRAME_VIEW_NONE; + } + + function executeViewSuccess(&$controller, &$xoopsUser, &$render) + { + } + + function executeViewError(&$controller, &$xoopsUser, &$render) + { + } + + function executeViewIndex(&$controller, &$xoopsUser, &$render) + { + } + + function executeViewInput(&$controller, &$xoopsUser, &$render) + { + } +} + +?> Index: xoops2jp/html/modules/legacyRender/class/AbstractEditAction.class.php diff -u /dev/null xoops2jp/html/modules/legacyRender/class/AbstractEditAction.class.php:1.1.2.1 --- /dev/null Mon Apr 24 16:31:08 2006 +++ xoops2jp/html/modules/legacyRender/class/AbstractEditAction.class.php Mon Apr 24 16:31:08 2006 @@ -0,0 +1,85 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class LegacyRender_AbstractEditAction extends LegacyRender_Action +{ + var $mObject = null; + var $mObjectHandler = null; + var $mActionForm = null; + + function _getId() + { + } + + function &_getHandler() + { + } + + function _setupActionForm() + { + } + + function _setupObject() + { + $id = $this->_getId(); + + $this->mObjectHandler = $this->_getHandler(); + + $this->mObject =& $this->mObjectHandler->get($id); + + if ($this->mObject == null && $this->isEnableCreate()) { + $this->mObject =& $this->mObjectHandler->create(); + } + } + + function isEnableCreate() + { + return true; + } + + function prepare(&$controller, &$xoopsUser) + { + $this->_setupActionForm(); + $this->_setupObject(); + } + + function getDefaultView(&$controller, &$xoopsUser) + { + if ($this->mObject == null) { + return LEGACYRENDER_FRAME_VIEW_ERROR; + } + + $this->mActionForm->load($this->mObject); + + return LEGACYRENDER_FRAME_VIEW_INPUT; + } + + function execute(&$controller, &$xoopsUser) + { + if ($this->mObject == null) { + return LEGACYRENDER_FRAME_VIEW_ERROR; + } + + $this->mActionForm->load($this->mObject); + + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + if($this->mActionForm->hasError()) { + return LEGACYRENDER_FRAME_VIEW_INPUT; + } + + $this->mActionForm->update($this->mObject); + + return $this->_doExecute($this->mObject) ? LEGACYRENDER_FRAME_VIEW_SUCCESS + : LEGACYRENDER_FRAME_VIEW_ERROR; + } + + function _doExecute() + { + return $this->mObjectHandler->insert($this->mObject); + } +} + +?> Index: xoops2jp/html/modules/legacyRender/class/PageNavigator.class.php diff -u /dev/null xoops2jp/html/modules/legacyRender/class/PageNavigator.class.php:1.1.2.1 --- /dev/null Mon Apr 24 16:31:08 2006 +++ xoops2jp/html/modules/legacyRender/class/PageNavigator.class.php Mon Apr 24 16:31:08 2006 @@ -0,0 +1,37 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . "/class/XCube_PageNavigator.class.php"; + +class LegacyRender_PageNavigator extends XCube_PageNavigator +{ + function getRenderSortUrl() + { + return parent::renderSortUrl('sort'); + } + + function renderHidden($sort = null) + { + if ($mask == null) { + $mask = array(); + } + elseif (!is_array($mask)) { + $mask = array($mask); + } + + $ret = null; + + foreach ($this->mExtra as $key => $value) { + } + + if (!isset($mask[$key])) { + $value = htmlspecialchars($value, ENT_QUOTES); + $ret .= "<input type=\"hidden\" name=\"${key}\" value=\"${value}\" />"; + } + + return $ret; + } +} + +?> Index: xoops2jp/html/modules/legacyRender/class/AbstractDeleteAction.class.php diff -u /dev/null xoops2jp/html/modules/legacyRender/class/AbstractDeleteAction.class.php:1.1.2.1 --- /dev/null Mon Apr 24 16:31:08 2006 +++ xoops2jp/html/modules/legacyRender/class/AbstractDeleteAction.class.php Mon Apr 24 16:31:08 2006 @@ -0,0 +1,20 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/legacyRender/class/AbstractEditAction.class.php"; + +class LegacyRender_AbstractDeleteAction extends LegacyRender_AbstractEditAction +{ + function isEnableCreate() + { + return false; + } + + function _doExecute() + { + return $this->mObjectHandler->delete($this->mObject); + } +} + +?> Index: xoops2jp/html/modules/legacyRender/class/banner.php diff -u /dev/null xoops2jp/html/modules/legacyRender/class/banner.php:1.1.2.1 --- /dev/null Mon Apr 24 16:31:08 2006 +++ xoops2jp/html/modules/legacyRender/class/banner.php Mon Apr 24 16:31:08 2006 @@ -0,0 +1,41 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class LegacyRenderBannerObject extends XoopsSimpleObject +{ + var $mClient = null; + var $_mClientLoadedFlag = false; + + function LegacyRenderBannerObject() + { + $this->initVar('bid', XOBJ_DTYPE_INT, '', false); + $this->initVar('cid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('imptotal', XOBJ_DTYPE_INT, '0', true); + $this->initVar('impmade', XOBJ_DTYPE_INT, '0', true); + $this->initVar('clicks', XOBJ_DTYPE_INT, '0', true); + $this->initVar('imageurl', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('clickurl', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('date', XOBJ_DTYPE_INT, '0', true); + $this->initVar('htmlbanner', XOBJ_DTYPE_BOOL, '0', true); + $this->initVar('htmlcode', XOBJ_DTYPE_TEXT, '', true); + } + + function loadBannerclient() + { + if ($this->_mClientLoadedFlag == false) { + $handler =& xoops_getmodulehandler('bannerclient'); + $this->mClient =& $handler->get($this->get('cid')); + $this->_mClientLoadedFlag = true; + } + } +} + +class LegacyRenderBannerHandler extends XoopsObjectGenericHandler +{ + var $mTable = "banner"; + var $mPrimary = "bid"; + var $mClass = "LegacyRenderBannerObject"; +} + +?> Index: xoops2jp/html/modules/legacyRender/class/AbstractFilterForm.class.php diff -u /dev/null xoops2jp/html/modules/legacyRender/class/AbstractFilterForm.class.php:1.1.2.1 --- /dev/null Mon Apr 24 16:31:08 2006 +++ xoops2jp/html/modules/legacyRender/class/AbstractFilterForm.class.php Mon Apr 24 16:31:08 2006 @@ -0,0 +1,44 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class LegacyRender_AbstractFilterForm +{ + var $mSort = 0; + var $mSortKeys = array(); + var $_mCriteria = null; + var $_mNavi = null; + + function LegacyRender_AbstractFilterForm(&$navi) + { + $this->_mNavi =& $navi; + $this->_mCriteria =& new CriteriaCompo(); + } + + function fetch() + { + } + + function getSort() + { + $sortkey = abs($this->mSort); + return isset($this->_mSortKeys[$sortkey]) ? $this->_mSortKeys[$sortkey] : null; + } + + function getOrder() + { + return ($this->mSort < 0) ? "DESC" : "ASC"; + } + + function getCriteria($start = 0, $limit = 0) + { + $criteria = $this->_mCriteria; + + $criteria->setStart($start); + $criteria->setLimit($limit); + + return $criteria; + } +} + +?> Index: xoops2jp/html/modules/legacyRender/class/bannerclient.php diff -u /dev/null xoops2jp/html/modules/legacyRender/class/bannerclient.php:1.1.2.1 --- /dev/null Mon Apr 24 16:31:08 2006 +++ xoops2jp/html/modules/legacyRender/class/bannerclient.php Mon Apr 24 16:31:08 2006 @@ -0,0 +1,78 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class LegacyRenderBannerclientObject extends XoopsSimpleObject +{ + var $mBanners = array(); + var $_mBannersLoadedFlag = false; + var $mFinishBanners = array(); + var $_mFinishBannersLoadedFlag = false; + + function LegacyRenderBannerclientObject() + { + $this->initVar('cid', XOBJ_DTYPE_INT, '', false); + $this->initVar('name', XOBJ_DTYPE_STRING, '', true, 60); + $this->initVar('contact', XOBJ_DTYPE_STRING, '', true, 60); + $this->initVar('email', XOBJ_DTYPE_STRING, '', true, 60); + $this->initVar('login', XOBJ_DTYPE_STRING, '', true, 10); + $this->initVar('passwd', XOBJ_DTYPE_STRING, '', true, 10); + $this->initVar('extrainfo', XOBJ_DTYPE_TEXT, '', true); + } + + function loadBanner() + { + if ($this->_mBannersLoadedFlag == false) { + $handler =& xoops_getmodulehandler('banner'); + $this->mBanners =& $handler->getObjects(new Criteria('cid', $this->get('cid'))); + $this->_mBannersLoadedFlag = true; + } + } + + function &createBanner() + { + $handler =& xoops_getmodulehandler('banner'); + $obj =& $handler->create(); + $obj->set('cid', $this->get('cid')); + return $obj; + } + + function loadBannerfinish() + { + if ($this->_mFinishBannersLoadedFlag == false) { + $handler =& xoops_getmodulehandler('bannerfinish'); + $this->mFinishBanners =& $handler->getObjects(new Criteria('cid', $this->get('cid'))); + $this->_mFinishBannersLoadedFlag = true; + } + } + + function &createBannerfinish() + { + $handler =& xoops_getmodulehandler('bannerfinish'); + $obj =& $handler->create(); + $obj->set('cid', $this->get('cid')); + return $obj; + } +} + +class LegacyRenderBannerclientHandler extends XoopsObjectGenericHandler +{ + var $mTable = "bannerclient"; + var $mPrimary = "cid"; + var $mClass = "LegacyRenderBannerclientObject"; + + function delete(&$obj) + { + $handler =& xoops_getmodulehandler('banner'); + $handler->deleteAll(new Criteria('cid', $obj->get('cid'))); + unset($handler); + + $handler =& xoops_getmodulehandler('bannerfinish'); + $handler->deleteAll(new Criteria('cid', $obj->get('cid'))); + unset($handler); + + return parent::delete($obj); + } +} + +?> Index: xoops2jp/html/modules/legacyRender/class/AbstractListAction.class.php diff -u /dev/null xoops2jp/html/modules/legacyRender/class/AbstractListAction.class.php:1.1.2.1 --- /dev/null Mon Apr 24 16:31:08 2006 +++ xoops2jp/html/modules/legacyRender/class/AbstractListAction.class.php Mon Apr 24 16:31:08 2006 @@ -0,0 +1,45 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/legacyRender/class/PageNavigator.class.php"; + +class LegacyRender_AbstractListAction extends LegacyRender_Action +{ + var $mObjects = array(); + var $mFilter = null; + var $mNavi = null; + + function &_getHandler() + { + } + + function &_getFilterForm(&$navi) + { + } + + function _getBaseUrl() + { + } + + function getDefaultView(&$controller, &$xoopsUser) + { + $this->mNavi =& new LegacyRender_PageNavigator($this->_getBaseUrl(), 0, XCUBE_PAGENAVI_START | XCUBE_PAGENAVI_PERPAGE); + + $this->mFilter =& $this->_getFilterForm($this->mNavi); + $this->mFilter->fetch(); + $handler =& $this->_getHandler(); + + $total = $handler->getCount($this->mFilter->getCriteria()); + + $this->mNavi->setTotal($total); + $this->mNavi->fetch(); + + $criteria = $this->mFilter->getCriteria($this->mNavi->getStart(), $this->mNavi->getPerpage()); + $this->mObjects =& $handler->getObjects($criteria); + + return LEGACYRENDER_FRAME_VIEW_INDEX; + } +} + +?> Index: xoops2jp/html/modules/legacyRender/class/bannerfinish.php diff -u /dev/null xoops2jp/html/modules/legacyRender/class/bannerfinish.php:1.1.2.1 --- /dev/null Mon Apr 24 16:31:08 2006 +++ xoops2jp/html/modules/legacyRender/class/bannerfinish.php Mon Apr 24 16:31:08 2006 @@ -0,0 +1,37 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class LegacyRenderBannerfinishObject extends XoopsSimpleObject +{ + var $mClient = null; + var $_mClientLoadedFlag = false; + + function LegacyRenderBannerfinishObject() + { + $this->initVar('bid', XOBJ_DTYPE_INT, '', false); + $this->initVar('cid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('impressions', XOBJ_DTYPE_INT, '0', true); + $this->initVar('clicks', XOBJ_DTYPE_INT, '0', true); + $this->initVar('datestart', XOBJ_DTYPE_INT, '0', true); + $this->initVar('dateend', XOBJ_DTYPE_INT, '0', true); + } + + function loadBannerclient() + { + if ($this->_mClientLoadedFlag == false) { + $handler =& xoops_getmodulehandler('bannerclient'); + $this->mClient =& $handler->get($this->get('cid')); + $this->_mClientLoadedFlag = true; + } + } +} + +class LegacyRenderBannerfinishHandler extends XoopsObjectGenericHandler +{ + var $mTable = "bannerfinish"; + var $mPrimary = "bid"; + var $mClass = "LegacyRenderBannerfinishObject"; +} + +?>