Minahito
minah****@users*****
2006年 3月 8日 (水) 19:24:11 JST
Index: xoops2jp/html/modules/user/class/avatar.php diff -u xoops2jp/html/modules/user/class/avatar.php:1.1.2.1 xoops2jp/html/modules/user/class/avatar.php:1.1.2.2 --- xoops2jp/html/modules/user/class/avatar.php:1.1.2.1 Thu Jan 19 21:12:07 2006 +++ xoops2jp/html/modules/user/class/avatar.php Wed Mar 8 19:24:11 2006 @@ -13,6 +13,13 @@ $this->initVar('avatar_weight', XOBJ_DTYPE_INT, '0', true); $this->initVar('avatar_type', XOBJ_DTYPE_STRING, 'S', true, 1); } + + function getUsingCount() + { + $handler =& xoops_getmodulehandler('avatar_user_link', 'user'); + $criteria =& new Criteria('avatar_id', $this->get('avatar_id')); + return $handler->getCount($criteria); + } } class UserAvatarHandler extends XoopsObjectGenericHandler @@ -23,8 +30,17 @@ function delete(&$obj) { - @unlink(XOOPS_UPLOAD_PATH . "/" . $obj->get('avatar_name')); - return parent::delete($obj); + @unlink(XOOPS_UPLOAD_PATH . "/" . $obj->get('avatar_file')); + if (parent::delete($obj)) { + $linkHandler =& xoops_getmodulehandler('avatar_user_link'); + $criteria =& new Criteria('avatar_id', $obj->get('avatar_id')); + $linkHandler->deleteAll($criteria); + + return true; + } + else { + return false; + } } }