/** * 使用サイズをチェックする * * @return int 使用サイズ * @access public */ function checkCapacitySize($sum_size = 0) { $room_id = $this->_request->getParameter("room_id"); if ($room_id == 0) { return true; } $getdata =& $this->_container->getComponent("GetData"); $pages = $getdata->getParameter("pages"); if (!isset($pages[$room_id])) { $pagesView =& $this->_container->getComponent("pagesView"); $page = $pagesView->getPageById($room_id); } else { $page =& $pages[$room_id]; } $configView =& $this->_container->getComponent("configView"); $max_capacity = 0; if ($page["private_flag"] == _ON) { $max_capacity = $this->_session->getParameter("_private_max_size"); } elseif ($page["space_type"] == _SPACE_TYPE_GROUP) { $upload_max_capacity_group = $configView->getConfigByConfname(_SYS_CONF_MODID, "upload_max_capacity_group"); if (isset($upload_max_capacity_group["conf_value"])) { $max_capacity = intval($upload_max_capacity_group["conf_value"]); } else { $max_capacity = 0; } } else { $upload_max_capacity_public = $configView->getConfigByConfname(_SYS_CONF_MODID, "upload_max_capacity_public"); if (isset($upload_max_capacity_public["conf_value"])) { $max_capacity = intval($upload_max_capacity_public["conf_value"]); } else { $max_capacity = 0; } } if ($max_capacity != 0) { $commonMain =& $this->_container->getComponent("commonMain"); $fileView =& $commonMain->registerClass(WEBAPP_DIR . '/components/file/View.class.php', "File_View", "fileView"); $db_sum_size = intval($this->_db->sumExecute("uploads", "file_size", array("room_id" => $room_id))); $sum_size += $db_sum_size; if ($max_capacity < $sum_size) { if ($max_capacity - $db_sum_size < 0) { $rest_size = 0; } else { $rest_size = $max_capacity - $db_sum_size; } // エラー return sprintf(_FILE_UPLOAD_ERR_MAX_CAPACITY, $page["page_name"], $fileView->formatSize($max_capacity), $fileView->formatSize($rest_size)); } } return true; }