function XsnsCommunity() { // $key, $data_type, $default, $required, $size $this->initVar('c_commu_id', XOBJ_DTYPE_INT); $this->initVar('name', XOBJ_DTYPE_TXTBOX); $this->initVar('uid_admin', XOBJ_DTYPE_INT); $this->initVar('uid_sub_admin', XOBJ_DTYPE_INT); $this->initVar('info', XOBJ_DTYPE_TXTAREA); $this->initVar('c_commu_category_id', XOBJ_DTYPE_INT); $this->initVar('r_datetime', XOBJ_DTYPE_DATETIME); $this->initVar('r_date', XOBJ_DTYPE_DATE); $this->initVar('public_flag', XOBJ_DTYPE_INT); $this->initVar('access_count', XOBJ_DTYPE_INT); $this->initVar('update_freq', XOBJ_DTYPE_FLOAT); $this->initVar('popularity', XOBJ_DTYPE_FLOAT); $this->initVar('up_datetime', XOBJ_DTYPE_DATETIME); $this->handler = array( 'community' => XsnsCommunityHandler::getInstance(), 'user' => XsnsUserHandler::getInstance(), 'member' => XsnsMemberHandler::getInstance(), 'image' => XsnsImageHandler::getInstance(), 'topic' => XsnsTopicHandler::getInstance(), 'comment' => XsnsTopicCommentHandler::getInstance(), 'category' => XsnsCategoryHandler::getInstance(), 'access_log' => XsnsAccessLogHandler::getInstance(), ); }
function dispatch() { $err = $this->checkPermission(); if(!is_array($err) || count($err) > 0){ $this->context->setAttribute('perm_error', $err); return "default"; } $log_handler =& XsnsAccessLogHandler::getInstance(); $limit = 50; $start = $this->getIntRequest('s', XSNS_REQUEST_GET); if(!isset($start) || $start<0){ $start = 0; } $cid = $this->getIntRequest('cid', XSNS_REQUEST_GET); $uid = $this->getIntRequest('uid', XSNS_REQUEST_GET); $access_log =& $log_handler->getList($cid, $uid, $limit, $start); $access_log_count = $log_handler->getListCount($cid, $uid); $cid_url = ($cid>0)? '&cid='.$cid : ''; $uid_url = ($uid>0)? '&uid='.$uid : ''; $pager = $this->getPageSelector('index.php?'.XSNS_ACTION_ARG.'=access'.$cid_url.$uid_url, $start, $limit, count($access_log), $access_log_count, "#FFCCCC"); $this->context->setAttribute('access_log', $access_log); $this->context->setAttribute('pager', $pager); }
function dispatch() { if($this->isGuest() || !$this->validateToken('COMMUNITY_DELETE')){ redirect_header(XOOPS_URL, 2, _NOPERM); } $cid = $this->getIntRequest('cid'); if(!isset($cid)){ redirect_header(XOOPS_URL, 2, _NOPERM); } // コミュニティの取得 $perm = XSNS_AUTH_XOOPS_ADMIN | XSNS_AUTH_ADMIN; $commu_handler =& XsnsCommunityHandler::getInstance(); $community =& $commu_handler->get($cid); if(!is_object($community) || !$community->checkAuthority($perm) || $community->getTopicCount() > 0){ redirect_header(XOOPS_URL, 2, _NOPERM); } $old_name = $community->getVar('name'); if($commu_handler->delete($community)){ $category_handler =& XsnsCategoryHandler::getInstance(); if($category_handler->updateSelector()){ $criteria = new Criteria('c_commu_id', $cid); // 所属メンバーデータの削除 $c_member_handler =& XsnsMemberHandler::getInstance(); $c_member_handler->deleteObjects($criteria); // 依頼データの削除 $confirm_handler =& XsnsConfirmHandler::getInstance(); $confirm_handler->deleteObjects($criteria); // アクセスログの削除 $access_log_handler =& XsnsAccessLogHandler::getInstance(); $access_log_handler->deleteObjects($criteria); // 画像の削除 $image_criteria = new CriteriaCompo(new Criteria('target', 1)); $image_criteria->add(new Criteria('target_id', $cid)); $image_handler =& XsnsImageHandler::getInstance(); $image_handler->deleteObjects($image_criteria); redirect_header(XSNS_URL_COMMU, 2, sprintf(_MD_XSNS_INDEX_DEL_OK, $old_name)); } } redirect_header(XSNS_URL_COMMU, 2, _MD_XSNS_INDEX_DEL_NG); }