Minahito
minah****@users*****
2006年 10月 14日 (土) 23:55:22 JST
Index: xoops2jp/html/modules/legacy/class/imagecategory.php diff -u /dev/null xoops2jp/html/modules/legacy/class/imagecategory.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/imagecategory.php Sat Oct 14 23:55:21 2006 @@ -0,0 +1,248 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class BaseImagecategoryObject extends XoopsSimpleObject +{ + var $mImage = array(); + var $_mImageLoadedFlag = false; + + /** + * Array of group objects which are allowed to read files of this category. + */ + var $mReadGroups = array(); + var $_mReadGroupsLoadedFlag = false; + + /** + * Array of group objects which are allowed to upload a file to this category. + */ + var $mUploadGroups = array(); + var $_mUploadGroupsLoadedFlag = false; + + + function BaseImagecategoryObject() + { + $this->initVar('imgcat_id', XOBJ_DTYPE_INT, '', false); + $this->initVar('imgcat_name', XOBJ_DTYPE_STRING, '', true, 100); + $this->initVar('imgcat_maxsize', XOBJ_DTYPE_INT, '50000', true); + $this->initVar('imgcat_maxwidth', XOBJ_DTYPE_INT, '120', true); + $this->initVar('imgcat_maxheight', XOBJ_DTYPE_INT, '120', true); + $this->initVar('imgcat_display', XOBJ_DTYPE_BOOL, '1', true); + $this->initVar('imgcat_weight', XOBJ_DTYPE_INT, '0', true); + $this->initVar('imgcat_type', XOBJ_DTYPE_STRING, 'C', true, 1); + $this->initVar('imgcat_storetype', XOBJ_DTYPE_STRING, 'file', true, 5); + } + + function loadImage() + { + if ($this->_mImageLoadedFlag == false) { + $handler =& xoops_getmodulehandler('image', 'base'); + $this->mImage =& $handler->getObjects(new Criteria('imagecat_id', $this->get('imagecat_id'))); + $this->_mImageLoadedFlag = true; + } + } + + function &createImage() + { + $handler =& xoops_getmodulehandler('image', 'base'); + $obj =& $handler->create(); + $obj->set('imagecat_id', $this->get('imagecat_id')); + return $obj; + } + + function getImageCount() + { + $handler =& xoops_getmodulehandler('image', 'base'); + return $handler->getCount(new Criteria('imgcat_id', $this->get('imgcat_id'))); + } + + function loadReadGroups() + { + if ($this->_mReadGroupsLoadedFlag) { + return; + } + + $handler =& xoops_gethandler('groupperm'); + $gidArr = $handler->getGroupIds('imgcat_read', $this->get('imgcat_id')); + + $handler =& xoops_gethandler('group'); + foreach ($gidArr as $gid) { + $object =& $handler->get($gid); + + if (is_object($object)) { + $this->mReadGroups[] =& $object; + } + + unset($object); + } + + $this->_mReadGroupsLoadedFlag = true; + } + + function isLoadedReadGroups() + { + return $this->_mReadGroupsLoadedFlag; + } + + /** + * If $groups has the permission of reading this object, return true. + */ + function hasReadPerm($groups) + { + $this->loadReadGroups(); + foreach (array_keys($this->mReadGroups) as $key) { + foreach ($groups as $group) { + if ($this->mReadGroups[$key]->get('groupid') == $group) { + return true; + } + } + } + + return false; + } + + function loadUploadGroups() + { + if ($this->_mUploadGroupsLoadedFlag) { + return; + } + + $handler =& xoops_gethandler('groupperm'); + $gidArr = $handler->getGroupIds('imgcat_write', $this->get('imgcat_id')); + + $handler =& xoops_gethandler('group'); + foreach ($gidArr as $gid) { + $object =& $handler->get($gid); + + if (is_object($object)) { + $this->mUploadGroups[] =& $object; + } + + unset($object); + } + + $this->_mUploadGroupsLoadedFlag = true; + } + + function isLoadedUploadGroups() + { + return $this->_mUploadGroupsLoadedFlag; + } + + function hasUploadPerm($groups) + { + $this->loadUploadGroups(); + foreach (array_keys($this->mUploadGroups) as $key) { + foreach ($groups as $group) { + if ($this->mUploadGroups[$key]->get('groupid') == $group) { + return true; + } + } + } + + return false; + } +} + +class BaseImagecategoryHandler extends XoopsObjectGenericHandler +{ + var $mTable = "imagecategory"; + var $mPrimary = "imgcat_id"; + var $mClass = "BaseImagecategoryObject"; + + function insert(&$obj, $force = false) + { + $returnFlag = parent::insert($obj, $force); + + $handler =& xoops_gethandler('groupperm'); + + // + // If the object has groups which are allowed to read. + // + if ($obj->isLoadedReadGroups()) { + $criteria =& new CriteriaCompo(); + $criteria->add(new Criteria('gperm_itemid', $obj->get('imgcat_id'))); + $criteria->add(new Criteria('gperm_modid', 1)); + $criteria->add(new Criteria('gperm_name', 'imgcat_read')); + $handler->deleteAll($criteria); + + foreach ($obj->mReadGroups as $group) { + $perm =& $handler->create(); + $perm->set('gperm_groupid', $group->get('groupid')); + $perm->set('gperm_itemid', $obj->get('imgcat_id')); + $perm->set('gperm_modid', 1); + $perm->set('gperm_name', 'imgcat_read'); + + $returnFlag &= $handler->insert($perm, $force); + } + } + + // + // If the object has groups which are allowed to upload. + // + if ($obj->isLoadedUploadGroups()) { + $criteria =& new CriteriaCompo(); + $criteria->add(new Criteria('gperm_itemid', $obj->get('imgcat_id'))); + $criteria->add(new Criteria('gperm_modid', 1)); + $criteria->add(new Criteria('gperm_name', 'imgcat_write')); + $handler->deleteAll($criteria); + + foreach ($obj->mUploadGroups as $group) { + $perm =& $handler->create(); + $perm->set('gperm_groupid', $group->get('groupid')); + $perm->set('gperm_itemid', $obj->get('imgcat_id')); + $perm->set('gperm_modid', 1); + $perm->set('gperm_name', 'imgcat_write'); + + $returnFlag &= $handler->insert($perm, $force); + } + } + + return $returnFlag; + } + + function &getObjectsWithReadPerm($groups = array(), $display = null) + { + $criteria = new CriteriaCompo(); + if ($display != null) { + $criteria->add(new Criteria('imgcat_display', $display)); + } + $criteria->setSort('imgcat_weight'); + $objs =& $this->getObjects($criteria); + unset($criteria); + + $handler =& xoops_gethandler('groupperm'); + $ret = array(); + foreach (array_keys($objs) as $key) { + if ($objs[$key]->hasReadPerm($groups)) { + $ret[] =& $objs[$key]; + } + } + + return $ret; + } + + function delete(&$obj, $force = false) + { + $handler =& xoops_getmodulehandler('image', 'base'); + $handler->deleteAll(new Criteria('imagecat_id', $obj->get('imagecat_id'))); + unset($handler); + + $handler =& xoops_gethandler('groupperm'); + $criteria =& new CriteriaCompo(); + $criteria->add(new Criteria('gperm_itemid', $obj->get('imgcat_id'))); + $criteria->add(new Criteria('gperm_modid', 1)); + + $nameCriteria =& new CriteriaCompo(); + $nameCriteria->add(new Criteria('gperm_name', 'imgcat_read')); + $nameCriteria->add(new Criteria('gperm_name', 'imgcat_write'), 'OR'); + + $criteria->add($nameCriteria); + + $handler->deleteAll($criteria); + + return parent::delete($obj, $force); + } +} + +?> Index: xoops2jp/html/modules/legacy/class/theme.php diff -u /dev/null xoops2jp/html/modules/legacy/class/theme.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/theme.php Sat Oct 14 23:55:21 2006 @@ -0,0 +1,101 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; + +class BaseThemeObject extends XoopsSimpleObject +{ + function BaseThemeObject() + { + $this->initVar('name', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('dirname', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('screenshot', XOBJ_DTYPE_STRING, '', false, 255); + $this->initVar('description', XOBJ_DTYPE_STRING, '', false, 255); + $this->initVar('format', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('render_system', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('version', XOBJ_DTYPE_STRING, '', true, 32); + $this->initVar('author', XOBJ_DTYPE_STRING, '', true, 64); + $this->initVar('url', XOBJ_DTYPE_STRING, '', true, 255); + } +} + +class BaseThemeHandler extends XoopsObjectHandler +{ + var $_mResults = array(); + + /** + * @var XCube_Delegate + */ + var $mGetInstalledThemes = null; + + function BaseThemeHandler(&$db) + { + $this->mGetInstalledThemes =& new XCube_Delegate(); + $this->mGetInstalledThemes->register('BaseThemeHandler.GetInstalledThemes'); + } + + function &create() + { + $ret =& new BaseThemeObject(); + return $ret; + } + + function &get($name) + { + $ret = null; + $this->_makeCache(); + + foreach (array_keys($this->_mResults) as $key) { + if ($this->_mResults[$key]->get('dirname') == $name) { + return $this->_mResults[$key]; + } + } + + return $ret; + } + + function &getObjects($criteria = null, $id_as_key = false) + { + $this->_makeCache(); + return $this->_mResults; + } + + /** + * Create cache at $this->mResult by Delegate, if cache is empty. + */ + function _makeCache() + { + if (count($this->_mResults) == 0) { + $t_themeArr = array(); + $this->mGetInstalledThemes->call(new XCube_Ref($t_themeArr)); + + foreach ($t_themeArr as $theme) { + $obj =& $this->create(); + $obj->set('name', $theme->mName); + $obj->set('dirname', $theme->mDirname); + $obj->set('screenshot', $theme->mScreenShot); + $obj->set('description', $theme->mDescription); + $obj->set('format', $theme->mFormat); + $obj->set('render_system', $theme->mRenderSystemName); + $obj->set('version', $theme->mVersion); + $obj->set('author', $theme->mAuthor); + $obj->set('url', $theme->mUrl); + $this->_mResults[] =& $obj; + unset($obj); + } + } + } + + function insert(&$obj, $force = false) + { + return false; + } + + function delete(&$obj, $force = false) + { + return false; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/comment.php diff -u /dev/null xoops2jp/html/modules/legacy/class/comment.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/comment.php Sat Oct 14 23:55:21 2006 @@ -0,0 +1,145 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class BaseCommentObject extends XoopsSimpleObject +{ + var $mUser = null; + var $mModule = null; + var $mStatus = null; + + function BaseCommentObject() + { + $this->initVar('com_id', XOBJ_DTYPE_INT, '', true); + $this->initVar('com_pid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('com_rootid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('com_modid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('com_itemid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('com_icon', XOBJ_DTYPE_STRING, '', true, 25); + $this->initVar('com_created', XOBJ_DTYPE_INT, '0', true); + $this->initVar('com_modified', XOBJ_DTYPE_INT, '0', true); + $this->initVar('com_uid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('com_ip', XOBJ_DTYPE_STRING, '', true, 15); + $this->initVar('com_title', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('com_text', XOBJ_DTYPE_TEXT, '', true); + $this->initVar('com_sig', XOBJ_DTYPE_BOOL, '0', true); + $this->initVar('com_status', XOBJ_DTYPE_INT, '1', true); + $this->initVar('com_exparams', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('dohtml', XOBJ_DTYPE_BOOL, '0', true); + $this->initVar('dosmiley', XOBJ_DTYPE_BOOL, '1', true); + $this->initVar('doxcode', XOBJ_DTYPE_BOOL, '1', true); + $this->initVar('doimage', XOBJ_DTYPE_BOOL, '1', true); + $this->initVar('dobr', XOBJ_DTYPE_BOOL, '1', true); + } + + /** + * Load a user object who wrote this comment to $mUser. + */ + function loadUser() + { + $handler =& xoops_gethandler('member'); + $this->mUser =& $handler->getUser($this->get('com_uid')); + } + + /** + * Load a module object to $mModule. + */ + function loadModule() + { + $handler =& xoops_gethandler('module'); + $this->mModule =& $handler->get($this->get('com_modid')); + } + + function loadStatus() + { + $handler =& xoops_getmodulehandler('commentstatus', 'base'); + $this->mStatus =& $handler->get($this->get('com_status')); + } + + function getVar($key) + { + if ($key == 'com_text') { + $ts =& MyTextSanitizer::getInstance(); + return $ts->displayTarea($this->get($key), $this->get('dohtml'), $this->get('dosmiley'), $this->get('doxcode'), $this->get('doimage'), $this->get('dobr')); + } + else { + return parent::getVar($key); + } + } +} + +class BaseCommentHandler extends XoopsObjectGenericHandler +{ + var $mTable = "xoopscomments"; + var $mPrimary = "com_id"; + var $mClass = "BaseCommentObject"; + + /** + * @var XCube_Delegate + */ + var $mUpdateSuccess; + + /** + * @var XCube_Delegate + */ + var $mDeleteSuccess; + + function BaseCommentHandler(&$db) + { + parent::XoopsObjectGenericHandler($db); + + $this->mUpdateSuccess =& new XCube_Delegate(); + $this->mDeleteSuccess =& new XCube_Delegate(); + } + + function insert(&$comment, $force = false) + { + if (parent::insert($comment, $force)) { + $this->mUpdateSuccess->call($comment); + return true; + } + else { + return false; + } + } + + /** + * Delete $comment and childlen of $comment. + */ + function delete(&$comment, $force = false) + { + $criteria =& new Criteria('com_pid', $comment->get('com_id')); + $this->deleteAll($criteria); + + if (parent::delete($comment, $force)) { + $this->mDeleteSuccess->call($comment); + return true; + } + else{ + return false; + } + } + + /** + * + * Return array of module id that comments are written. + * + * @return array + */ + function getModuleIds() + { + $ret = array(); + + $sql = "SELECT DISTINCT com_modid FROM " . $this->mTable; + $res = $this->db->query($sql); + if ($res) { + while ($row = $this->db->fetchArray($res)) { + $ret[] = $row['com_modid']; + } + } + + return $ret; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/newblocks.php diff -u /dev/null xoops2jp/html/modules/legacy/class/newblocks.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/newblocks.php Sat Oct 14 23:55:21 2006 @@ -0,0 +1,128 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class BaseNewblocksObject extends XoopsSimpleObject +{ + var $mModule = null; + + /** + * Array of group objects who can access this object. + * It need lazy loading to access. + */ + var $mGroup = array(); + + var $mBmodule = array(); + + var $mColumn = null; + + var $mCachetime = null; + + function BaseNewblocksObject() + { + $this->initVar('bid', XOBJ_DTYPE_INT, '', true); + $this->initVar('mid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('func_num', XOBJ_DTYPE_INT, '0', true); + $this->initVar('options', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('name', XOBJ_DTYPE_STRING, '', true, 150); + $this->initVar('title', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('content', XOBJ_DTYPE_TEXT, '', true); + $this->initVar('side', XOBJ_DTYPE_INT, '0', true); + $this->initVar('weight', XOBJ_DTYPE_INT, '0', true); + $this->initVar('visible', XOBJ_DTYPE_BOOL, '0', true); + $this->initVar('block_type', XOBJ_DTYPE_STRING, '', true, 1); + $this->initVar('c_type', XOBJ_DTYPE_STRING, '', true, 1); + $this->initVar('isactive', XOBJ_DTYPE_BOOL, '0', true); + $this->initVar('dirname', XOBJ_DTYPE_STRING, '', true, 50); + $this->initVar('func_file', XOBJ_DTYPE_STRING, '', true, 50); + $this->initVar('show_func', XOBJ_DTYPE_STRING, '', true, 50); + $this->initVar('edit_func', XOBJ_DTYPE_STRING, '', true, 50); + $this->initVar('template', XOBJ_DTYPE_STRING, '', true, 50); + $this->initVar('bcachetime', XOBJ_DTYPE_INT, '0', true); + $this->initVar('last_modified', XOBJ_DTYPE_INT, '0', true); + } + + function loadModule() + { + $handler =& xoops_gethandler('module'); + $this->mModule =& $handler->get($this->get('mid')); + } + + /** + * Load group objects who can access this object. And, set the objects to mGroup. + * + * TODO Need lock double loading. + */ + function loadGroup() + { + $handler =& xoops_gethandler('groupperm'); + $criteria =& new CriteriaCompo(); + $criteria->add(new Criteria('gperm_modid', 1)); + $criteria->add(new Criteria('gperm_itemid', $this->get('bid'))); + $criteria->add(new Criteria('gperm_name', 'block_read')); + + $gpermArr =& $handler->getObjects($criteria); + + $handler =& xoops_gethandler('group'); + foreach ($gpermArr as $gperm) { + $this->mGroup[] =& $handler->get($gperm->get('gperm_groupid')); + } + } + + function loadBmodule() + { + $handler =& xoops_getmodulehandler('block_module_link', 'base'); + $criteria =& new Criteria('block_id', $this->get('bid')); + + $this->mBmodule =& $handler->getObjects($criteria); + } + + function loadColumn() + { + $handler =& xoops_getmodulehandler('columnside', 'base'); + $this->mColumn =& $handler->get($this->get('side')); + } + + function loadCachetime() + { + $handler =& xoops_gethandler('cachetime'); + $this->mCachetime =& $handler->get($this->get('bcachetime')); + } +} + +class BaseNewblocksHandler extends XoopsObjectGenericHandler +{ + var $mTable = "newblocks"; + var $mPrimary = "bid"; + var $mClass = "BaseNewblocksObject"; + + function delete(&$obj, $force = false) + { + if (parent::delete($obj, $force)) { + // + // Delete related data from block_module_link. + // + $handler =& xoops_getmodulehandler('block_module_link', 'base'); + $handler->deleteAll(new Criteria('block_id'), $obj->get('bid')); + + // + // Delete related permissions from groupperm. + // + $handler =& xoops_gethandler('groupperm'); + + $criteria =& new CriteriaCompo(); + $criteria->add(new Criteria('gperm_modid', 1)); + $criteria->add(new Criteria('gperm_itemid', $obj->get('bid'))); + $criteria->add(new Criteria('gperm_name', 'block_read')); + + $handler->deleteAll($criteria); + + return true; + } + else { + return false; + } + } +} + +?> Index: xoops2jp/html/modules/legacy/class/Legacy_Validator.class.php diff -u /dev/null xoops2jp/html/modules/legacy/class/Legacy_Validator.class.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/Legacy_Validator.class.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,31 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . "/core/XCube_Validator.class.php"; + +class XCube_ObjectExistValidator extends XCube_Validator +{ + function isValid(&$form, $vars) + { + if ($form->isNull()) { + return true; + } + else { + $handleName = $vars['handler']; + $moduleName = isset($vars['module']) ? $vars['module'] : null; + + if ($moduleName == null) { + $handler =& xoops_gethandler($handleName); + } + else { + $handler =& xoops_getmodulehandler($handleName, $moduleName); + } + $obj =& $handler->get($form->getValue()); + + return is_object($obj); + } + } +} + +?> \ No newline at end of file Index: xoops2jp/html/modules/legacy/class/DebuggerManager.class.php diff -u /dev/null xoops2jp/html/modules/legacy/class/DebuggerManager.class.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/DebuggerManager.class.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,161 @@ +<?php +// $Id$ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2000 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +define("XOOPS_DEBUG_OFF",0); +define("XOOPS_DEBUG_PHP",1); +define("XOOPS_DEBUG_MYSQL",2); +define("XOOPS_DEBUG_SMARTY",3); + +class Legacy_DebuggerManager +{ + function getInstance($debug_mode) + { + static $instance = array(); + + if (empty($instance[$debug_mode])) { + $instance[$debug_mode] =& Legacy_DebuggerManager::_createInstance($debug_mode); + } + + return $instance[$debug_mode]; + } + + /** + Create XoopsDebugger instance. + You must not communicate with this method directly. + */ + function &_createInstance($debug_mode) + { + $instance = null; + switch($debug_mode) { + case XOOPS_DEBUG_PHP: + $instance =& new Legacy_PHPDebugger(); + break; + + case XOOPS_DEBUG_MYSQL: + $instance =& new Legacy_MysqlDebugger(); + break; + + case XOOPS_DEBUG_SMARTY: + $instance =& new Legacy_SmartyDebugger(); + break; + + case XOOPS_DEBUG_OFF: + default: + // @todo I can not realize abstract class to instance. + $instance =& new Legacy_AbstractDebugger(); + break; + } + + return $instance; + } +} + +class Legacy_AbstractDebugger +{ + function Legacy_AbstractDebugger() + { + } + + function prepare() + { + } + + function isDebugRenderSystem() + { + return false; + } + + /** + * @return string Log as html code. + */ + function renderLog() + { + } + + function displayLog() + { + } +} + +/** +This class works for "PHP debugging mode". +*/ +class Legacy_PHPDebugger extends Legacy_AbstractDebugger +{ + function prepare() + { + error_reporting(E_ALL); + } +} + +/** +This class works for "Mysql debugging mode". +*/ +class Legacy_MysqlDebugger extends Legacy_AbstractDebugger +{ + function renderLog() + { + $xoopsLogger =& XoopsLogger::instance(); + return $xoopsLogger->dumpAll(); + } + + function displayLog() + { + echo '<script type="text/javascript"> + <!--// + debug_window = openWithSelfMain("", "xoops_debug", 680, 600, true); + '; + $content = '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" /><meta http-equiv="content-language" content="'._LANGCODE.'" /><title>'.htmlspecialchars($GLOBALS['xoopsConfig']['sitename']).'</title><link rel="stylesheet" type="text/css" media="all" href="'.getcss($GLOBALS['xoopsConfig']['theme_set']).'" /></head><body>'.$this->renderLog().'<div style="text-align:center;"><input class="formButton" value="'._CLOSE.'" type="button" onclick="javascript:window.close();" /></div></body></html>'; + $lines = preg_split("/(\r\n|\r|\n)( *)/", $content); + foreach ($lines as $line) { + echo 'debug_window.document.writeln("'.str_replace('"', '\"', $line).'");'; + } + echo ' + debug_window.document.close(); + //--> + </script>'; + } +} + + +/** +This class works for "Smarty debugging mode". +*/ +class Legacy_SmartyDebugger extends Legacy_AbstractDebugger +{ + function isDebugRenderSystem() + { + $root =& XCube_Root::getSingleton(); + $user =& $root->mContext->mXoopsUser; + + return is_object($user) ? $user->isAdmin(0) : false; + } +} + +?> \ No newline at end of file Index: xoops2jp/html/modules/legacy/class/AbstractListAction.class.php diff -u /dev/null xoops2jp/html/modules/legacy/class/AbstractListAction.class.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/AbstractListAction.class.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,43 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . "/core/XCube_PageNavigator.class.php"; + +class Legacy_AbstractListAction extends Legacy_Action +{ + var $mObjects = array(); + + var $mFilter = null; + + function &_getHandler() + { + } + + function &_getFilterForm() + { + } + + function _getBaseUrl() + { + } + + function &_getPageNavi() + { + $navi =& new XCube_PageNavigator($this->_getBaseUrl(), XCUBE_PAGENAVI_START); + return $navi; + } + + function getDefaultView(&$controller, &$xoopsUser) + { + $this->mFilter =& $this->_getFilterForm(); + $this->mFilter->fetch(); + + $handler =& $this->_getHandler(); + $this->mObjects =& $handler->getObjects($this->mFilter->getCriteria()); + + return LEGACY_FRAME_VIEW_INDEX; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/block_module_link.php diff -u /dev/null xoops2jp/html/modules/legacy/class/block_module_link.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/block_module_link.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,21 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class BaseBlock_module_linkObject extends XoopsSimpleObject +{ + function BaseBlock_module_linkObject() + { + $this->initVar('block_id', XOBJ_DTYPE_INT, '0', true); + $this->initVar('module_id', XOBJ_DTYPE_INT, '0', true); + } +} + +class BaseBlock_module_linkHandler extends XoopsObjectGenericHandler +{ + var $mTable = "block_module_link"; + var $mPrimary = "block_id"; + var $mClass = "BaseBlock_module_linkObject"; +} + +?> Index: xoops2jp/html/modules/legacy/class/smiles.php diff -u /dev/null xoops2jp/html/modules/legacy/class/smiles.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/smiles.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,31 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class BaseSmilesObject extends XoopsSimpleObject +{ + function BaseSmilesObject() + { + $this->initVar('id', XOBJ_DTYPE_INT, '', true); + $this->initVar('code', XOBJ_DTYPE_STRING, '', true, 50); + $this->initVar('smile_url', XOBJ_DTYPE_STRING, '', true, 100); + $this->initVar('emotion', XOBJ_DTYPE_STRING, '', true, 75); + $this->initVar('display', XOBJ_DTYPE_BOOL, '0', true); + } +} + +class BaseSmilesHandler extends XoopsObjectGenericHandler +{ + var $mTable = "smiles"; + var $mPrimary = "id"; + var $mClass = "BaseSmilesObject"; + + function delete(&$obj) + { + @unlink(XOOPS_UPLOAD_PATH . "/" . $obj->get('smile_url')); + + return parent::delete($obj); + } +} + +?> Index: xoops2jp/html/modules/legacy/class/group_permission.php diff -u /dev/null xoops2jp/html/modules/legacy/class/group_permission.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/group_permission.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,56 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class BaseGroup_permissionObject extends XoopsSimpleObject +{ + function BaseGroup_permissionObject() + { + $this->initVar('gperm_id', XOBJ_DTYPE_INT, '', true); + $this->initVar('gperm_groupid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('gperm_itemid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('gperm_modid', XOBJ_DTYPE_INT, '0', true); + $this->initVar('gperm_name', XOBJ_DTYPE_STRING, '', true, 50); + } +} + +class BaseGroup_permissionHandler extends XoopsObjectGenericHandler +{ + var $mTable = "group_permission"; + var $mPrimary = "gperm_id"; + var $mClass = "BaseGroup_permissionObject"; + + /** + * Gets array of roles by array of group ID. + * @param int $mid + * @param array $groups + * @return array + */ + function getRolesByModule($mid, $groups) + { + $retRoles = array(); + + $sql = "SELECT gperm_name FROM " . $this->db->prefix($this->mTable) . " WHERE gperm_modid=" . intval($mid) . " AND gperm_itemid=0 AND "; + $groupSql = array(); + + foreach ($groups as $gid) { + $groupSql[] = "gperm_groupid=" . intval($gid); + } + + $sql .= "(" . implode(' OR ', $groupSql) . ")"; + + $result = $this->db->query($sql); + + if (!$result) { + return $retRoles; + } + + while ($row = $this->db->fetchArray($result)) { + $retRoles[] = $row['gperm_name']; + } + + return $retRoles; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php diff -u /dev/null xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,115 @@ +<?php +/** + * @package Legacy + * @version $Id$ + */ + +/** + * The static member functions class for Legacy. + */ +class Legacy_Utils +{ + /** + * Checks whether must modules have been installed. + * @static + * @return mixed Returns hashmap including the list of uninstalled, + * disabled and recommended modules, basically. But, if there is no problem, + * returns true. + */ + function checkSystemModules() + { + $root=&XCube_Root::getSingleton(); + $systemModules = array_map('trim', explode(',', $root->getSiteConfig('Cube', 'SystemModules'))); + $recommendedModules = array_map('trim', explode(',', $root->getSiteConfig('Cube',' RecommendedModules'))); + $moduleHandler =& xoops_gethandler('module'); + $uninstalledModules = array(); + $disabledModules = array(); + foreach ($systemModules as $systemModule) { + if (!empty($systemModule)) { + if (!($moduleObject =& $moduleHandler->getByDirname($systemModule))) { + $uninstalledModules[] = $systemModule; + } + elseif (!$moduleObject->get('isactive')) { + $disabledModules[] = $systemModule; + } + } + } + if (count($uninstalledModules) == 0 && count($disabledModules) == 0) { + return true; + } + else { + return array('uninstalled' =>$uninstalledModules, 'disabled'=>$disabledModules, 'recommended'=>$recommendedModules); + } + } + + /** + * Creates a instance of the module with the generating convention. And, + * returns it. + * @param XoopsModule $module + * @return Legacy_Module + */ + function &createModule($module) + { + $instance = null; + $dirname = $module->get('dirname'); + + // + // IMPORTANT CONVENTION + // + $className = ucfirst($dirname) . "_Module"; + if (!class_exists($className)) { + $filePath = XOOPS_ROOT_PATH . "/modules/${dirname}/class/Module.class.php"; + if (file_exists($filePath)) { + require_once $filePath; + } + } + + if (class_exists($className)) { + $instance =& new $className($module); + } + else { + $instance =& new Legacy_ModuleAdapter($module); + } + + return $instance; + } + + /** + * Creates a instance of the block procedure with the generating convention. + * And, returns it. + * @static + * @return Legacy_BlockProcedure + */ + function createBlockProcedure(&$block) + { + // + // IMPORTANT CONVENTION + // + $retBlock = null; + $func = $block->get('show_func'); + if (substr($func, 0, 4) == 'cl::') { + $className = ucfirst($block->get('dirname')) . '_' . substr($func, 4); + if (!class_exists($className)) { + $filePath = XOOPS_ROOT_PATH . '/modules/' . $block->get('dirname') . '/blocks/' . $block->get('func_file'); + if (!file_exists($filePath)) { + continue; + } + + require_once $filePath; + + if (!class_exists($className)) { + continue; + } + } + + $retBlock =& new $className($block); + } + else { + $retBlock =& new Legacy_BlockProcedureAdapter($block); + } + + return $retBlock; + } +} + +?> \ No newline at end of file Index: xoops2jp/html/modules/legacy/class/non_installation_module.php diff -u /dev/null xoops2jp/html/modules/legacy/class/non_installation_module.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/non_installation_module.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,82 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +/** + * This handler handles XoopsModule objects without DB. So it doesn't implement + * some methods for difficult query. Only override methods are usable. + */ +class BaseNon_installation_moduleHandler extends XoopsObjectHandler +{ + /** + * object cache. + * + * @var Array + */ + var $_mXoopsModules = array(); + + /** + * readonly property + */ + var $_mExclusions = array(".", "..", "CVS"); + + function BaseNon_installation_moduleHandler(&$db) + { + parent::XoopsObjectHandler($db); + $this->_setupObjects(); + } + + /** + * Once, load module objects to a member property from XOOPS_MODULE_PATH. + */ + function _setupObjects() + { + if (count($this->_mXoopsModules) == 0) { + if ($handler = opendir(XOOPS_MODULE_PATH)) { + while (($dir = readdir($handler)) !== false) { + if (!in_array($dir, $this->_mExclusions) && is_dir(XOOPS_MODULE_PATH . "/" . $dir)) { + $module =& $this->get($dir); + if ($module !== false ) { + $this->_mXoopsModules[] =& $module; + unset($module); + } + } + } + } + } + } + + /** + * Return module object by $dirname that is specified module directory. + * If specified module has been installed or doesn't keep xoops_version, not return it. + * @param $dirname string + * @param XoopsModule or false + */ + function &get($dirname) + { + $ret = false; + + if (!file_exists(XOOPS_MODULE_PATH . "/" . $dirname . "/xoops_version.php")) { + return $ret; + } + + $moduleHandler =& xoops_gethandler('module'); + + $check =& $moduleHandler->getByDirname($dirname); + if (is_object($check)) { + return $ret; + } + + $module =& $moduleHandler->create(); + $module->loadInfoAsVar($dirname); + + return $module; + } + + function &getObjects($criteria=null) + { + return $this->_mXoopsModules; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/blockctype.php diff -u /dev/null xoops2jp/html/modules/legacy/class/blockctype.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/blockctype.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,77 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class BaseBlockctypeObject extends XoopsSimpleObject +{ + function BaseBlockctypeObject() + { + $this->initVar('type', XOBJ_DTYPE_STRING, '', true); + $this->initVar('label', XOBJ_DTYPE_STRING, '', true, 255); + } +} + +class BaseBlockctypeHandler extends XoopsObjectHandler +{ + var $_mResults = array(); + + function BaseBlockctypeHandler(&$db) + { + $t_arr = array ( + 'H' => _AD_BASE_LANG_CTYPE_HTML, + 'P' => _AD_BASE_LANG_CTYPE_PHP, + 'S' => _AD_BASE_LANG_CTYPE_WITH_SMILIES, + 'T' => _AD_BASE_LANG_CTYPE_WITHOUT_SMILIES + ); + + foreach ($t_arr as $id => $name) { + $this->_mResults[$id] =& $this->create(); + $this->_mResults[$id]->setVar('type', $id); + $this->_mResults[$id]->setVar('label', $name); + } + } + + function &create() + { + $ret =& new BaseBlockctypeObject(); + return $ret; + } + + function get($id) + { + if (isset($this->_mResults[$id])) { + return $this->_mResults[$id]; + } + + $ret = null; + return $ret; + } + + function &getObjects($criteria = null, $id_as_key = false) + { + if ($id_as_key) { + return $this->_mResults; + } + else { + $ret = array(); + + foreach (array_keys($this->_mResults) as $key) { + $ret[] =& $this->_mResults[$key]; + } + + return $ret; + } + } + + function insert(&$obj) + { + return false; + } + + function delete(&$obj) + { + return false; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/AbstractDeleteAction.class.php diff -u /dev/null xoops2jp/html/modules/legacy/class/AbstractDeleteAction.class.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/AbstractDeleteAction.class.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,20 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/base/class/AbstractEditAction.class.php"; + +class Legacy_AbstractDeleteAction extends Legacy_AbstractEditAction +{ + function isEnableCreate() + { + return false; + } + + function _doExecute() + { + return $this->mObjectHandler->delete($this->mObject); + } +} + +?> Index: xoops2jp/html/modules/legacy/class/ActionFrame.class.php diff -u /dev/null xoops2jp/html/modules/legacy/class/ActionFrame.class.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/ActionFrame.class.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,221 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +define ("LEGACY_FRAME_PERFORM_SUCCESS", 1); +define ("LEGACY_FRAME_PERFORM_FAIL", 2); +define ("LEGACY_FRAME_INIT_SUCCESS", 3); + +define ("LEGACY_FRAME_VIEW_NONE", 1); +define ("LEGACY_FRAME_VIEW_SUCCESS", 2); +define ("LEGACY_FRAME_VIEW_ERROR", 3); +define ("LEGACY_FRAME_VIEW_INDEX", 4); +define ("LEGACY_FRAME_VIEW_INPUT", 5); +define ("LEGACY_FRAME_VIEW_PREVIEW", 6); +define ("LEGACY_FRAME_VIEW_CANCEL", 7); + +// +// Constatns for the mode of the frame. +// +define ("LEGACY_FRAME_MODE_MISC", "Misc"); +define ("LEGACY_FRAME_MODE_NOTIFY", "Notify"); +define ("LEGACY_FRAME_MODE_IMAGE", "Image"); +define ("LEGACY_FRAME_MODE_SEARCH", "Search"); + +class Legacy_ActionFrame +{ + var $mActionName = null; + var $mAction = null; + var $mAdminFlag = null; + + /** + * Mode. The rule refers this property to load a file and create an + * instance in execute(). + * + * @var string + */ + var $mMode = null; + + function Legacy_ActionFrame($admin) + { + $this->mAdminFlag = $admin; + } + + function setActionName($name) + { + $this->mActionName = $name; + + // + // Temp FIXME! + // + $root =& XCube_Root::getSingleton(); + $root->mContext->setAttribute('actionName', $name); + $root->mContext->mModule->setAttribute('actionName', $name); + } + + /** + * Set mode. + * + * @param string $mode Use constants (LEGACY_FRAME_MODE_MISC and more...) + */ + function setMode($mode) + { + $this->mMode = $mode; + } + + function execute(&$controller) + { + if (strlen($this->mActionName) > 0 && !preg_match("/^\w+$/", $this->mActionName)) { + die(); + } + + // + // Actions of the public side in this module are hook type. So it's + // necessary to load catalog here. + // + if (!$this->mAdminFlag) { + $controller->mRoot->mLanguageManager->loadModuleMessageCatalog('base'); + } + + // + // Add mode. + // + $this->setActionName($this->mMode . $this->mActionName); + + // + // Create action object by mActionName + // + $className = "Legacy_" . 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(); + } + + $this->mAction->prepare($controller, $controller->mRoot->mContext->mXoopsUser); + + if (!$this->mAction->hasPermission($controller, $controller->mRoot->mContext->mXoopsUser)) { + if ($this->mAdminFlag) { + $controller->executeForward(XOOPS_URL . "/admin.php"); + } + else { + $controller->executeForward(XOOPS_URL); + } + } + + if (xoops_getenv("REQUEST_METHOD") == "POST") { + $viewStatus = $this->mAction->execute($controller, $controller->mRoot->mContext->mXoopsUser); + } + else { + $viewStatus = $this->mAction->getDefaultView($controller, $controller->mRoot->mContext->mXoopsUser); + } + + switch($viewStatus) { + case LEGACY_FRAME_VIEW_SUCCESS: + $this->mAction->executeViewSuccess($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderBuffer()); + break; + + case LEGACY_FRAME_VIEW_ERROR: + $this->mAction->executeViewError($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderBuffer()); + break; + + case LEGACY_FRAME_VIEW_INDEX: + $this->mAction->executeViewIndex($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderBuffer()); + break; + + case LEGACY_FRAME_VIEW_INPUT: + $this->mAction->executeViewInput($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderBuffer()); + break; + + case LEGACY_FRAME_VIEW_PREVIEW: + $this->mAction->executeViewPreview($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderBuffer()); + break; + + case LEGACY_FRAME_VIEW_CANCEL: + $this->mAction->executeViewCancel($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderBuffer()); + break; + } + } +} + +class Legacy_Action +{ + /** + * @access private + */ + var $_mAdminFlag = false; + + function Legacy_Action($adminFlag = false) + { + $this->_mAdminFlag = $adminFlag; + } + + function hasPermission(&$controller, &$xoopsUser) + { + if ($this->_mAdminFlag) { + return $controller->mRoot->mContext->mUser->isInRole('Module.base.Admin'); + } + else { + // + // TODO Really? + // + 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) + { + } + + function executeViewPreview(&$controller, &$xoopsUser, &$render) + { + } + + function executeViewCancel(&$controller, &$xoopsUser, &$render) + { + } +} + +?> Index: xoops2jp/html/modules/legacy/class/AbstractEditAction.class.php diff -u /dev/null xoops2jp/html/modules/legacy/class/AbstractEditAction.class.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/AbstractEditAction.class.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,93 @@ +<?php +/** + * @package Legacy + * @version $Id$ + */ + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class Legacy_AbstractEditAction extends Legacy_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->_setupObject(); + $this->_setupActionForm(); + } + + function getDefaultView(&$controller, &$xoopsUser) + { + if ($this->mObject == null) { + return LEGACY_FRAME_VIEW_ERROR; + } + + $this->mActionForm->load($this->mObject); + + return LEGACY_FRAME_VIEW_INPUT; + } + + function execute(&$controller, &$xoopsUser) + { + if ($this->mObject == null) { + return LEGACY_FRAME_VIEW_ERROR; + } + + if (xoops_getrequest('_form_control_cancel') != null) { + return LEGACY_FRAME_VIEW_CANCEL; + } + + $this->mActionForm->load($this->mObject); + + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + if($this->mActionForm->hasError()) { + return LEGACY_FRAME_VIEW_INPUT; + } + + $this->mActionForm->update($this->mObject); + + return $this->_doExecute($this->mObject) ? LEGACY_FRAME_VIEW_SUCCESS + : LEGACY_FRAME_VIEW_ERROR; + } + + function _doExecute() + { + return $this->mObjectHandler->insert($this->mObject); + } +} + +?> Index: xoops2jp/html/modules/legacy/class/columnside.php diff -u /dev/null xoops2jp/html/modules/legacy/class/columnside.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/columnside.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,80 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; + +class BaseColumnsideObject extends XoopsSimpleObject +{ + function BaseColumnsideObject() + { + $this->initVar('id', XOBJ_DTYPE_INT, '', true); + $this->initVar('name', XOBJ_DTYPE_STRING, '', true, 255); + } +} + +class BaseColumnsideHandler extends XoopsObjectHandler +{ + var $_mResults = array(); + + function BaseColumnsideHandler(&$db) + { + $t_arr = array ( + 0 => _AD_BASE_LANG_SIDE_BLOCK_LEFT, + 1 => _AD_BASE_LANG_SIDE_BLOCK_RIGHT, + 3 => _AD_BASE_LANG_CENTER_BLOCK_LEFT, + 4 => _AD_BASE_LANG_CENTER_BLOCK_RIGHT, + 5 => _AD_BASE_LANG_CENTER_BLOCK_CENTER + ); + + foreach ($t_arr as $id => $name) { + $this->_mResults[$id] =& $this->create(); + $this->_mResults[$id]->setVar('id', $id); + $this->_mResults[$id]->setVar('name', $name); + } + } + + function &create() + { + $ret =& new BaseColumnsideObject(); + return $ret; + } + + function &get($id) + { + if (isset($this->_mResults[$id])) { + return $this->_mResults[$id]; + } + + $ret = null; + return $ret; + } + + function &getObjects($criteria = null, $id_as_key = false) + { + if ($id_as_key) { + return $this->_mResults; + } + else { + $ret = array(); + + foreach (array_keys($this->_mResults) as $key) { + $ret[] =& $this->_mResults[$key]; + } + + return $ret; + } + } + + function insert(&$obj) + { + return false; + } + + function delete(&$obj) + { + return false; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/commentstatus.php diff -u /dev/null xoops2jp/html/modules/legacy/class/commentstatus.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/commentstatus.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,82 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; + +class BaseCommentstatusObject extends XoopsSimpleObject +{ + function BaseCommentstatusObject() + { + $this->initVar('id', XOBJ_DTYPE_INT, '', true); + $this->initVar('name', XOBJ_DTYPE_STRING, '', true, 255); + } +} + +class BaseCommentstatusHandler extends XoopsObjectHandler +{ + var $_mResults = array(); + + function BaseCommentstatusHandler(&$db) + { + $root =& XCube_Root::getSingleton(); + $language = $root->mContext->getXoopsConfig('language'); + $root->mLanguageManager->loadPageTypeMessageCatalog('comment'); + + $this->_mResults[XOOPS_COMMENT_PENDING] =& $this->create(); + $this->_mResults[XOOPS_COMMENT_PENDING]->setVar('id', XOOPS_COMMENT_PENDING); + $this->_mResults[XOOPS_COMMENT_PENDING]->setVar('name', _CM_PENDING); + + $this->_mResults[XOOPS_COMMENT_ACTIVE] =& $this->create(); + $this->_mResults[XOOPS_COMMENT_ACTIVE]->setVar('id', XOOPS_COMMENT_ACTIVE); + $this->_mResults[XOOPS_COMMENT_ACTIVE]->setVar('name', _CM_ACTIVE); + + $this->_mResults[XOOPS_COMMENT_HIDDEN] =& $this->create(); + $this->_mResults[XOOPS_COMMENT_HIDDEN]->setVar('id', XOOPS_COMMENT_HIDDEN); + $this->_mResults[XOOPS_COMMENT_HIDDEN]->setVar('name', _CM_HIDDEN); + } + + function &create() + { + $ret =& new BaseCommentstatusObject(); + return $ret; + } + + function get($id) + { + if (isset($this->_mResults[$id])) { + return $this->_mResults[$id]; + } + + $ret = null; + return $ret; + } + + function &getObjects($criteria = null, $id_as_key = false) + { + if ($id_as_key) { + return $this->_mResults; + } + else { + $ret = array(); + + foreach (array_keys($this->_mResults) as $key) { + $ret[] =& $this->_mResults[$key]; + } + + return $ret; + } + } + + function insert(&$obj) + { + return false; + } + + function delete(&$obj) + { + return false; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/image.php diff -u /dev/null xoops2jp/html/modules/legacy/class/image.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/image.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,102 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class BaseImageObject extends XoopsSimpleObject +{ + var $mImageCategory = null; + var $_mImageCategoryLoadedFlag = false; + var $mImageBody = null; + var $_mImageBodyLoadedFlag = false; + + function BaseImageObject() + { + $this->initVar('image_id', XOBJ_DTYPE_INT, '', false); + $this->initVar('image_name', XOBJ_DTYPE_STRING, '', true, 30); + $this->initVar('image_nicename', XOBJ_DTYPE_STRING, '', true, 255); + $this->initVar('image_mimetype', XOBJ_DTYPE_STRING, '', true, 30); + $this->initVar('image_created', XOBJ_DTYPE_INT, time(), true); + $this->initVar('image_display', XOBJ_DTYPE_BOOL, '1', true); + $this->initVar('image_weight', XOBJ_DTYPE_INT, '0', true); + $this->initVar('imgcat_id', XOBJ_DTYPE_INT, '0', true); + } + + function loadImagecategory() + { + if ($this->_mImageCategoryLoadedFlag == false) { + $handler =& xoops_getmodulehandler('imagecategory', 'base'); + $this->mImageCategory =& $handler->get($this->get('imgcat_id')); + $this->_mImageCategoryLoadedFlag = true; + } + } + + function loadImagebody() + { + if ($this->_mImageBodyLoadedFlag == false) { + $handler =& xoops_getmodulehandler('imagebody', 'base'); + $this->mImageBody =& $handler->get($this->get('image_id')); + $this->_mImageBodyLoadedFlag = true; + } + } + + function &createImagebody() + { + $handler =& xoops_getmodulehandler('imagebody', 'base'); + $obj =& $handler->create(); + $obj->set('image_id', $this->get('image_id')); + return $obj; + } +} + +class BaseImageHandler extends XoopsObjectGenericHandler +{ + var $mTable = "image"; + var $mPrimary = "image_id"; + var $mClass = "BaseImageObject"; + + function insert(&$obj, $force = false) + { + if (parent::insert($obj, $force)) { + if (is_object($obj->mImageBody)) { + $obj->mImageBody->set('image_id', $obj->get('image_id')); + $handler =& xoops_getmodulehandler('imagebody', 'base'); + return $handler->insert($obj->mImageBody, $force); + } + + return true; + } + + return false; + } + + /** + * + * Delete object and image file. + * + * @param $obj BaseImageObject + * @param $force boolean + * @return boolean + */ + function delete(&$obj, $force = false) + { + $obj->loadImagebody(); + + if (parent::delete($obj, $force)) { + $filepath = XOOPS_UPLOAD_PATH . "/" . $obj->get('image_name'); + if (file_exists($filepath)) { + @unlink($filepath); + } + + if (is_object($obj->mImageBody)) { + $handler =& xoops_getmodulehandler('imagebody', 'base'); + $handler->delete($obj->mImageBody, $force); + } + + return true; + } + + return false; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/AbstractFilterForm.class.php diff -u /dev/null xoops2jp/html/modules/legacy/class/AbstractFilterForm.class.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/AbstractFilterForm.class.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,76 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class Legacy_AbstractFilterForm +{ + var $mSort = 0; + var $mSortKeys = array(); + var $_mCriteria = null; + var $mNavi = null; + + var $_mHandler = null; + + function Legacy_AbstractFilterForm(&$navi, &$handler) + { + $this->mNavi =& $navi; + $this->_mHandler =& $handler; + + $this->_mCriteria =& new CriteriaCompo(); + + $this->mNavi->mGetTotalItems->add(array(&$this, 'getTotalItems')); + } + + function getDefaultSortKey() + { + } + + function getTotalItems(&$total) + { + $total = $this->_mHandler->getCount($this->getCriteria()); + } + + function fetchSort() + { + $root =& XCube_Root::getSingleton(); + $this->mSort = intval($root->mContext->mRequest->getRequest('sort')); + + if (!isset($this->mSortKeys[abs($this->mSort)])) { + $this->mSort = $this->getDefaultSortKey(); + } + + $this->mNavi->mSort['sort'] = $this->mSort; + } + + function fetch() + { + $this->mNavi->fetch(); + $this->fetchSort(); + } + + function getSort() + { + $sortkey = abs($this->mNavi->mSort['sort']); + return isset($this->mSortKeys[$sortkey]) ? $this->mSortKeys[$sortkey] : null; + } + + function getOrder() + { + return ($this->mSort < 0) ? "DESC" : "ASC"; + } + + function getCriteria($start = null, $limit = null) + { + $t_start = ($start === null) ? $this->mNavi->getStart() : intval($start); + $t_limit = ($limit === null) ? $this->mNavi->getPerpage() : intval($limit); + + $criteria = $this->_mCriteria; + + $criteria->setStart($t_start); + $criteria->setLimit($t_limit); + + return $criteria; + } +} + +?> Index: xoops2jp/html/modules/legacy/class/imagebody.php diff -u /dev/null xoops2jp/html/modules/legacy/class/imagebody.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/imagebody.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,21 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class BaseImagebodyObject extends XoopsSimpleObject +{ + function BaseImagebodyObject() + { + $this->initVar('image_id', XOBJ_DTYPE_INT, '', false); + $this->initVar('image_body', XOBJ_DTYPE_TEXT, '', true); + } +} + +class BaseImagebodyHandler extends XoopsObjectGenericHandler +{ + var $mTable = "imagebody"; + var $mPrimary = "image_id"; + var $mClass = "BaseImagebodyObject"; +} + +?> Index: xoops2jp/html/modules/legacy/class/index.html diff -u /dev/null xoops2jp/html/modules/legacy/class/index.html:1.1.2.1 --- /dev/null Sat Oct 14 23:55:22 2006 +++ xoops2jp/html/modules/legacy/class/index.html Sat Oct 14 23:55:22 2006 @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file