From 65b5bfe25ef7a00bb3a60e039910e4939bfa157b Mon Sep 17 00:00:00 2001 From: kteraguchi Date: Tue, 22 Jan 2013 15:12:46 +0900 Subject: [PATCH 01/39] =?UTF-8?q?Ver.2.4.0.0=E3=83=AA=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=81=8B=E3=82=892013/1/21=E3=81=BE=E3=81=A7=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maple/filter/Filter_AllowIdList.class.php | 2 +- html/maple/filter/Filter_FileUpload.class.php | 1299 +++++++++-------- html/maple/filter/Filter_Mobile.class.php | 836 +++++------ html/maple/nccore/common_func.php | 9 + html/webapp/components/mobile/View.class.php | 11 +- html/webapp/components/uploads/View.class.php | 1174 +++++++-------- html/webapp/components/users/View.class.php | 51 + .../components/whatsnew/Action.class.php | 235 ++- html/webapp/config/define.inc.php | 2 +- html/webapp/config/global-config.ini | 8 + html/webapp/language/chinese/global.ini | 2 + html/webapp/language/english/global.ini | 2 + html/webapp/language/english/items.ini | 12 +- html/webapp/language/english/lang_common.js | 20 +- html/webapp/language/japanese/global.ini | 2 + html/webapp/language/japanese/lang_common.js | 14 +- .../authority_view_admin_selectmodules.html | 2 +- .../restoreresult/Restoreresult.class.php | 1294 ++++++++-------- .../templates/default/bbs_mobile_thread.html | 3 + .../modules/chat/update/Update.class.php | 29 + .../action/main/postscript/add/maple.ini | 2 +- .../main/postscript/mail/Mail.class.php | 5 +- .../circular/files/css/default/style.css | 15 +- .../circular/files/js/default/circular.js | 7 +- .../circular/language/chinese/main.ini | 5 +- .../circular/language/english/main.ini | 5 +- .../circular/language/japanese/main.ini | 5 +- .../circular_view_main_postscript.html | 11 +- .../circular_view_main_postscript_list.html | 2 +- .../view/main/postscript/init/maple.ini | 4 + .../modules/common/files/js/prototype.js | 4 +- .../operation/common_operation_view_init.html | 12 +- .../modules/comp/files/js/comp_calendar.js | 104 +- .../files/js/plugins/comp_textareamain.js | 2 +- .../comp/language/chinese/textarea.ini | 7 + .../comp/language/english/textarea.ini | 7 + .../comp/language/japanese/textarea.ini | 7 + .../comp/templates/textarea/insert_image.html | 23 +- .../modules/install/sql/mysql/table.sql | 2 +- .../modules/journal/components/View.class.php | 12 +- .../journal_mobile_detail_feature.html | 2 +- .../default/journal_mobile_detail_smart.html | 2 +- .../journal/view/main/detail/Detail.class.php | 179 +-- .../linklist/components/View.class.php | 2 +- .../default/linklist_view_edit_style.html | 13 +- .../main/autoregist/Autoregist.class.php | 272 ++-- .../login/action/main/forgetpass/maple.ini | 1 + .../validator/Validator_Forgetpass.class.php | 144 +- .../validator/Validator_ItemsInputs.class.php | 325 ++--- .../login/view/main/init/Init.class.php | 154 +- .../menu/action/edit/addpage/maple.ini | 2 +- .../templates/default/menu_mobile_detail.html | 178 ++- .../default/menu_mobile_recursive_block.html | 115 +- .../menu/validator/Validator_Regist.class.php | 26 +- .../menu/view/mobile/init/Init.class.php | 17 + .../modules/module/update/Update.class.php | 68 - .../edit/addmetadata/Addmetadata.class.php | 56 +- .../photoalbum/files/css/default/style.css | 2 +- .../photoalbum/language/chinese/main.ini | 2 +- .../photoalbum/language/english/main.ini | 2 +- .../photoalbum/language/japanese/main.ini | 2 +- .../default/photoalbum_mobile_view_photo.html | 8 +- .../photoalbum_mobile_view_photo_list.html | 2 +- .../photoalbum/view/main/init/maple.ini | 2 +- .../view/mobile/list/List.class.php | 2 - .../modules/pm/components/View.class.php | 2 +- .../modules/pm/language/english/main.ini | 8 +- .../validator/Validator_ItemData.class.php | 6 +- .../reservation/components/Action.class.php | 1177 +++++++-------- .../reservation/components/View.class.php | 640 ++++---- .../modules/reservation/config/main.ini | 3 + .../reservation/language/chinese/main.ini | 4 +- .../reservation/language/english/main.ini | 14 +- .../reservation/language/japanese/main.ini | 10 +- .../modules/reservation/sql/mysql/table.sql | 3 +- ...reservation_location_regist_authority.html | 41 +- ...rvation_location_regist_location_name.html | 8 - ...reservation_view_edit_location_regist.html | 4 +- .../reservation_view_main_list_location.html | 2 +- .../reservation_view_main_list_monthly.html | 2 +- .../reservation_view_main_list_weekly.html | 2 +- .../reservation_view_recursive_room.html | 6 +- .../reservation/update/Update.class.php | 9 + .../Validator_LocationView.class.php | 35 +- .../view/edit/import/init/Init.class.php | 38 +- .../view/main/reserve/add/Add.class.php | 4 - .../view/main/reserve/modify/Modify.class.php | 4 - .../modules/rss/components/Parse.class.php | 15 +- html/webapp/modules/user/install.ini | 1 + .../validator/Validator_ItemsInputs.class.php | 272 ++-- .../view/admin/import/upload/Upload.class.php | 404 +++-- .../user/view/admin/import/upload/maple.ini | 1 - html/webapp/style/css/common.css | 2 +- html/webapp/templates/main/mobile_smart.html | 2 +- 94 files changed, 4886 insertions(+), 4659 deletions(-) diff --git a/html/maple/filter/Filter_AllowIdList.class.php b/html/maple/filter/Filter_AllowIdList.class.php index a21ca1a..483fe6d 100644 --- a/html/maple/filter/Filter_AllowIdList.class.php +++ b/html/maple/filter/Filter_AllowIdList.class.php @@ -418,7 +418,7 @@ function _showpages_fetchcallback($result, $func_param) { $row['page_name'] = _SPACE_TYPE_NAME_PUBLIC; } else if($row['space_type'] ==_SPACE_TYPE_GROUP && $row['private_flag'] ==_ON){ if($row['default_entry_flag'] ==_ON) - $row['page_name'] = RMAP_MYPOTAL; + $row['page_name'] = _SPACE_TYPE_NAME_MYPORTAL; else $row['page_name'] = _SPACE_TYPE_NAME_PRIVATE; } else { diff --git a/html/maple/filter/Filter_FileUpload.class.php b/html/maple/filter/Filter_FileUpload.class.php index 4de8642..72d5a04 100644 --- a/html/maple/filter/Filter_FileUpload.class.php +++ b/html/maple/filter/Filter_FileUpload.class.php @@ -45,11 +45,11 @@ //include_once MAPLE_DIR.'/core/Token.class.php'; if (!defined('UPLOAD_ERR_OK')) { - define('UPLOAD_ERR_OK', 0); - define('UPLOAD_ERR_INI_SIZE', 1); - define('UPLOAD_ERR_FORM_SIZE', 2); - define('UPLOAD_ERR_PARTIAL', 3); - define('UPLOAD_ERR_NO_FILE', 4); + define('UPLOAD_ERR_OK', 0); + define('UPLOAD_ERR_INI_SIZE', 1); + define('UPLOAD_ERR_FORM_SIZE', 2); + define('UPLOAD_ERR_PARTIAL', 3); + define('UPLOAD_ERR_NO_FILE', 4); } /** @@ -66,118 +66,118 @@ class Filter_FileUpload extends Filter { /** - * コンストラクター - * - * @access public - * @since 3.1.0 - */ - function Filter_FileUpload() - { - parent::Filter(); - } - - /** - * ファイルアップロード処理を行う - * - * @access public - * @since 3.1.0 - */ - function execute() - { - $log =& LogFactory::getLog(); - $log->trace("Filter_FileUploadの前処理が実行されました", "Filter_FileUpload#execute"); - - $container =& DIContainerFactory::getContainer(); + * コンストラクター + * + * @access public + * @since 3.1.0 + */ + function Filter_FileUpload() + { + parent::Filter(); + } + + /** + * ファイルアップロード処理を行う + * + * @access public + * @since 3.1.0 + */ + function execute() + { + $log =& LogFactory::getLog(); + $log->trace("Filter_FileUploadの前処理が実行されました", "Filter_FileUpload#execute"); + + $container =& DIContainerFactory::getContainer(); $fileUpload =& new FileUpload; $container->register($fileUpload, 'FileUpload'); - $actionChain =& $container->getComponent("ActionChain"); - $errorList =& $actionChain->getCurErrorList(); - if ($errorList->isExists()) { - $filterChain =& $container->getComponent("FilterChain"); - $filterChain->execute(); - return; - } - - $session =& $container->getComponent("Session"); - $request =& $container->getComponent("Request"); - $configView =& $container->getComponent("configView"); - $commonMain =& $container->getComponent("commonMain"); - $fileView =& $commonMain->registerClass(WEBAPP_DIR.'/components/file/View.class.php', "File_View", "fileView"); - - - //パラメータをセット - $upload_params = $request->getParameter("upload_params"); - $fileUpload->setPageid(intval($request->getParameter("page_id"))); - $fileUpload->setModuleid(intval($request->getParameter("module_id"))); - $unique_id = $request->getParameter("unique_id"); - if(!isset($unique_id)) { - $unique_id = "0"; - } - $fileUpload->setUniqueid($unique_id); - $fileUpload->setDownLoadactionName($request->getParameter("download_action_name")); - - $attributes = $this->getAttributes(); - - if (isset($attributes["name"])) { - $fileUpload->setName($attributes["name"]); - - if (isset($attributes["filemode"])) { - if (defined($attributes["filemode"])) $attributes["filemode"] = $this->constantDef($attributes["filemode"]); - $fileUpload->setFilemode($attributes["filemode"]); - } else { - //default - $fileUpload->setFilemode(_UPLOAD_FILE_MODE); - } - - //maple.iniを分析 - $maxsize_ini = array(); - $maxwidth_ini = array(); - $maxheight_ini = array(); - $type_ini = array(); - $extension_ini = array(); - $sizeError_ini = array(); - $widthError_ini = array(); - $heightError_ini = array(); - $typeError_ini = array(); - $extensionError_ini = array(); - $noFileError_ini = array(); - $resize = true; // default:画像の枠が範囲を超えていればリサイズ - if(isset($attributes["stopper"]) && ($attributes["stopper"] === 0 || $attributes["stopper"] === "0" || $attributes["stopper"] === false || $attributes["stopper"] === "false")) { - $stopper = false; - } else { - //stopper default:true - $stopper = true; - } - if (isset($attributes["allow_attachment"])) { - //configの権限でアップロード可能かどうかをセット - $allow_attachment_flag = $session->getParameter("_allow_attachment_flag"); - $attributes_allow_attachment_flag = $this->constantDef($attributes["allow_attachment"]); - } else { - $allow_attachment_flag = _ALLOW_ATTACHMENT_ALL; - $attributes_allow_attachment_flag = _ALLOW_ATTACHMENT_ALL; - } - - //エラーメッセージdefault値指定 - $sizeError_ini["default"] = _FILE_UPLOAD_ERR_SIZE; //vsprintf(_FILE_UPLOAD_ERR_SIZE,_UPLOAD_MAX_SIZE_IMAGE); - $widthError_ini["default"] = _FILE_UPLOAD_ERR_UPLOAD_WIDTHLARGE; //vsprintf(_FILE_UPLOAD_ERR_UPLOAD_WIDTHLARGE,_UPLOAD_MAX_WIDTH_IMAGE); - $heightError_ini["default"] = _FILE_UPLOAD_ERR_UPLOAD_HEIGHTLARGE; //vsprintf(_FILE_UPLOAD_ERR_UPLOAD_HEIGHTLARGE,_UPLOAD_MAX_HEIGHT_IMAGE); - $typeError_ini["default"] = _FILE_UPLOAD_ERR_MIMETYPE; - - $noFileError_ini["whether"] = _FILE_UPLOAD_ERR_UPLOAD_NOFILE; - $noFileError_whether = 0; - $maxsize_ini["default"] = _UPLOAD_MAX_SIZE_ATTACHMENT; - - foreach($attributes as $key => $value) { - //start_add code - - if ((!((strlen($key) == 4 && substr($key,0,4) == "type") || (substr($key,0,4) == "type" && is_numeric(substr($key,5,strlen($key)-6))))) && - (!((strlen($key) == 9 && substr($key,0,9) == "extension") || (substr($key,0,9) == "extension" && is_numeric(substr($key,10,strlen($key)-11)))))) { - $valueArray = explode(",", $value); - if (count($valueArray) > 1) { - $printParams = array_slice($valueArray, 1); - $count = 0; + $actionChain =& $container->getComponent("ActionChain"); + $errorList =& $actionChain->getCurErrorList(); + if ($errorList->isExists()) { + $filterChain =& $container->getComponent("FilterChain"); + $filterChain->execute(); + return; + } + + $session =& $container->getComponent("Session"); + $request =& $container->getComponent("Request"); + $configView =& $container->getComponent("configView"); + $commonMain =& $container->getComponent("commonMain"); + $fileView =& $commonMain->registerClass(WEBAPP_DIR.'/components/file/View.class.php', "File_View", "fileView"); + + + //パラメータをセット + $upload_params = $request->getParameter("upload_params"); + $fileUpload->setPageid(intval($request->getParameter("page_id"))); + $fileUpload->setModuleid(intval($request->getParameter("module_id"))); + $unique_id = $request->getParameter("unique_id"); + if(!isset($unique_id)) { + $unique_id = "0"; + } + $fileUpload->setUniqueid($unique_id); + $fileUpload->setDownLoadactionName($request->getParameter("download_action_name")); + + $attributes = $this->getAttributes(); + + if (isset($attributes["name"])) { + $fileUpload->setName($attributes["name"]); + + if (isset($attributes["filemode"])) { + if (defined($attributes["filemode"])) $attributes["filemode"] = $this->constantDef($attributes["filemode"]); + $fileUpload->setFilemode($attributes["filemode"]); + } else { + //default + $fileUpload->setFilemode(_UPLOAD_FILE_MODE); + } + + //maple.iniを分析 + $maxsize_ini = array(); + $maxwidth_ini = array(); + $maxheight_ini = array(); + $type_ini = array(); + $extension_ini = array(); + $sizeError_ini = array(); + $widthError_ini = array(); + $heightError_ini = array(); + $typeError_ini = array(); + $extensionError_ini = array(); + $noFileError_ini = array(); + $resize = true; // default:画像の枠が範囲を超えていればリサイズ + if(isset($attributes["stopper"]) && ($attributes["stopper"] === 0 || $attributes["stopper"] === "0" || $attributes["stopper"] === false || $attributes["stopper"] === "false")) { + $stopper = false; + } else { + //stopper default:true + $stopper = true; + } + if (isset($attributes["allow_attachment"])) { + //configの権限でアップロード可能かどうかをセット + $allow_attachment_flag = $session->getParameter("_allow_attachment_flag"); + $attributes_allow_attachment_flag = $this->constantDef($attributes["allow_attachment"]); + } else { + $allow_attachment_flag = _ALLOW_ATTACHMENT_ALL; + $attributes_allow_attachment_flag = _ALLOW_ATTACHMENT_ALL; + } + + //エラーメッセージdefault値指定 + $sizeError_ini["default"] = _FILE_UPLOAD_ERR_SIZE; //vsprintf(_FILE_UPLOAD_ERR_SIZE,_UPLOAD_MAX_SIZE_IMAGE); + $widthError_ini["default"] = _FILE_UPLOAD_ERR_UPLOAD_WIDTHLARGE; //vsprintf(_FILE_UPLOAD_ERR_UPLOAD_WIDTHLARGE,_UPLOAD_MAX_WIDTH_IMAGE); + $heightError_ini["default"] = _FILE_UPLOAD_ERR_UPLOAD_HEIGHTLARGE; //vsprintf(_FILE_UPLOAD_ERR_UPLOAD_HEIGHTLARGE,_UPLOAD_MAX_HEIGHT_IMAGE); + $typeError_ini["default"] = _FILE_UPLOAD_ERR_MIMETYPE; + + $noFileError_ini["whether"] = _FILE_UPLOAD_ERR_UPLOAD_NOFILE; + $noFileError_whether = 0; + $maxsize_ini["default"] = _UPLOAD_MAX_SIZE_ATTACHMENT; + + foreach($attributes as $key => $value) { + //start_add code + + if ((!((strlen($key) == 4 && substr($key,0,4) == "type") || (substr($key,0,4) == "type" && is_numeric(substr($key,5,strlen($key)-6))))) && + (!((strlen($key) == 9 && substr($key,0,9) == "extension") || (substr($key,0,9) == "extension" && is_numeric(substr($key,10,strlen($key)-11)))))) { + $valueArray = explode(",", $value); + if (count($valueArray) > 1) { + $printParams = array_slice($valueArray, 1); + $count = 0; foreach ($printParams as $subValue) { if (defined($subValue)) { $printParams[$count] = $this->constantDef($subValue); @@ -186,526 +186,569 @@ function execute() } if (defined($valueArray[0])) $valueArray[0] = $this->constantDef($valueArray[0]); $value = vsprintf($valueArray[0],$printParams); - } else { - if (defined($value)) $value = $this->constantDef($value); - } - } else { - $valueArray = explode(",", $value); - if (count($valueArray) == 1) { - if (defined($value)) $value = $this->constantDef($value); - } - } - if (substr($key,0,11) == "action_name") { - $fileUpload->setDownLoadactionName($value); - } - if (substr($key,0,8) == "maxwidth") { - if (strlen($key) == 8) { - $maxwidth_ini["default"] = $value; - } else if (is_numeric(substr($key,9,strlen($key)-10))) { - $maxwidth_ini[substr($key,9,strlen($key)-10)] = $value; - } - } - if (substr($key,0,9) == "maxheight") { - if (strlen($key) == 9) { - $maxheight_ini["default"] = $value; - } else if (is_numeric(substr($key,10,strlen($key)-11))) { - $maxheight_ini[substr($key,10,strlen($key)-11)] = $value; - } - } - if ($key == "resize") { - if(($value === 1 || $value === "1" || $value === "true" || $value === true)) { - $resize = true; - } else { - $resize = false; - } - } - // - // 解凍してアップロード - // - if ($key == "decompression") { - if(($value === 1 || $value === "1" || $value === "true" || $value === true)) { - $this->_decompression($attributes["name"], $fileUpload); - } - } - - if (substr($key,0,10) == "summaxsize") { - $summaxsize_ini = $value; - //if (strlen($key) == 10) { - // $summaxsize_ini["default"] = $value; - //} else if (is_numeric(substr($key,11,strlen($key)-12))) { - // $summaxsize_ini[substr($key,11,strlen($key)-12)] = $value; - //} - } - + } else { + if (defined($value)) $value = $this->constantDef($value); + } + } else { + $valueArray = explode(",", $value); + if (count($valueArray) == 1) { + if (defined($value)) $value = $this->constantDef($value); + } + } + if (substr($key,0,11) == "action_name") { + $fileUpload->setDownLoadactionName($value); + } + if (substr($key,0,8) == "maxwidth") { + if (strlen($key) == 8) { + $maxwidth_ini["default"] = $value; + } else if (is_numeric(substr($key,9,strlen($key)-10))) { + $maxwidth_ini[substr($key,9,strlen($key)-10)] = $value; + } + } + if (substr($key,0,9) == "maxheight") { + if (strlen($key) == 9) { + $maxheight_ini["default"] = $value; + } else if (is_numeric(substr($key,10,strlen($key)-11))) { + $maxheight_ini[substr($key,10,strlen($key)-11)] = $value; + } + } + if ($key == "resize") { + if(($value === 1 || $value === "1" || $value === "true" || $value === true)) { + $resize = true; + } else { + $resize = false; + } + } + // + // 解凍してアップロード + // + if ($key == "decompression") { + if(($value === 1 || $value === "1" || $value === "true" || $value === true)) { + $this->_decompression($attributes["name"], $fileUpload); + } + } + + if (substr($key,0,10) == "summaxsize") { + $summaxsize_ini = $value; + //if (strlen($key) == 10) { + // $summaxsize_ini["default"] = $value; + //} else if (is_numeric(substr($key,11,strlen($key)-12))) { + // $summaxsize_ini[substr($key,11,strlen($key)-12)] = $value; + //} + } + //end_add code - - if (substr($key,0,7) == "maxsize") { - if (strlen($key) == 7) { - $maxsize_ini["default"] = $value; - } else if (is_numeric(substr($key,8,strlen($key)-9))) { - $maxsize_ini[substr($key,8,strlen($key)-9)] = $value; - } - } - - if (substr($key,0,4) == "type") { - $typeArray = array(); - if (strlen($key) == 4) { - $typeArray = explode(",", $value); - $type_ini["default"] = $typeArray; - } else if (is_numeric(substr($key,5,strlen($key)-6))) { - $typeArray = explode(",", $value); - $type_ini[substr($key,5,strlen($key)-6)] = $typeArray; - } - } - //start_add code - if (substr($key,0,9) == "extension") { - $extensionArray = array(); - if (strlen($key) == 9) { - $extensionArray = explode(",", strtolower($value)); - $extension_ini["default"] = $extensionArray; - } else if (is_numeric(substr($key,10,strlen($key)-11))) { - $extensionArray = explode(",", strtolower($value)); - $extension_ini[substr($key,10,strlen($key)-11)] = $extensionArray; - } - } - //if ($allow_attachment_flag==_ALLOW_ATTACHMENT_ALL && substr($key,0,14) == "allow_mimetype" && ($value === _ON || $value === "true")) { - if (($key == "allow_extension" || $key == "allow_mimetype") && ($value === 1 || $value === "1" || $value === "true" || $value === true)) { - if(!isset($config)) { - $config = $configView->getConfigByConfname(_SYS_CONF_MODID, "allow_extension"); - } - if(isset($config["conf_value"])) { - $allow_extension = $config["conf_value"]; - if($allow_extension != "" && $allow_extension != null) { - $typeSubArray = array(); - $extensionSubArray = explode(",", strtolower($allow_extension)); - if ($key == "allow_mimetype") { - $count = 0; - //$uploadsView =& $this->_container->getComponent("uploadsView"); + + if (substr($key,0,7) == "maxsize") { + if (strlen($key) == 7) { + $maxsize_ini["default"] = $value; + } else if (is_numeric(substr($key,8,strlen($key)-9))) { + $maxsize_ini[substr($key,8,strlen($key)-9)] = $value; + } + } + + if (substr($key,0,4) == "type") { + $typeArray = array(); + if (strlen($key) == 4) { + $typeArray = explode(",", $value); + $type_ini["default"] = $typeArray; + } else if (is_numeric(substr($key,5,strlen($key)-6))) { + $typeArray = explode(",", $value); + $type_ini[substr($key,5,strlen($key)-6)] = $typeArray; + } + } + //start_add code + if (substr($key,0,9) == "extension") { + $extensionArray = array(); + if (strlen($key) == 9) { + $extensionArray = explode(",", strtolower($value)); + $extension_ini["default"] = $extensionArray; + } else if (is_numeric(substr($key,10,strlen($key)-11))) { + $extensionArray = explode(",", strtolower($value)); + $extension_ini[substr($key,10,strlen($key)-11)] = $extensionArray; + } + } + //if ($allow_attachment_flag==_ALLOW_ATTACHMENT_ALL && substr($key,0,14) == "allow_mimetype" && ($value === _ON || $value === "true")) { + if (($key == "allow_extension" || $key == "allow_mimetype") && ($value === 1 || $value === "1" || $value === "true" || $value === true)) { + if(!isset($config)) { + $config = $configView->getConfigByConfname(_SYS_CONF_MODID, "allow_extension"); + } + if(isset($config["conf_value"])) { + $allow_extension = $config["conf_value"]; + if($allow_extension != "" && $allow_extension != null) { + $typeSubArray = array(); + $extensionSubArray = explode(",", strtolower($allow_extension)); + if ($key == "allow_mimetype") { + $count = 0; + //$uploadsView =& $this->_container->getComponent("uploadsView"); if(!class_exists("Uploads_View")) { include_once WEBAPP_DIR .'/components/uploads/View.class.php'; } $uploadsView =& new Uploads_View; - foreach($extensionSubArray as $extensionValue) { - $typeSubArray[$count] = $uploadsView->mimeinfo("type", "." . $extensionValue); - $count++; - } - //if (strlen($key) == 14) { - if(isset($type_ini["default"]) && is_array($type_ini["default"]) && count($type_ini["default"]) > 0) { - $type_ini["default"] = array_merge($type_ini["default"], $typeSubArray); - } else { - $type_ini["default"] = $typeSubArray; - } - //} else if (is_numeric(substr($key,15,strlen($key)-16))) { - // if(count($typeArray) > 0) { - // $type_ini[substr($key,15,strlen($key)-16)] = array_merge($typeArray, $typeSubArray); - // } else { - // $type_ini[substr($key,15,strlen($key)-16)] = $typeSubArray; - // } - //} - } else { - // 拡張子 - if(isset($extension_ini["default"]) && is_array($extension_ini["default"]) && count($extension_ini["default"]) > 0) { - $extension_ini["default"] = array_merge($extension_ini["default"], $extensionSubArray); - } else { - $extension_ini["default"] = $extensionSubArray; - } - } - } - } - } - if(defined($value)) { - $value = constant($value); - } - if (substr($key,0,10) == "widthError") { - if (strlen($key) == 10) { - $widthError_ini["default"] = $value; - } else if (is_numeric(substr($key,11,strlen($key)-12))) { - $widthError_ini[substr($key,11,strlen($key)-12)] = $value; - } - } - if (substr($key,0,11) == "heightError") { - if (strlen($key) == 11) { - $heightError_ini["default"] = $value; - } else if (is_numeric(substr($key,12,strlen($key)-13))) { - $heightError_ini[substr($key,12,strlen($key)-13)] = $value; - } - } - if (substr($key,0,12) == "sumsizeError") { - $sumsizeError_ini = $value; - //if (strlen($key) == 12) { - // $sumsizeError_ini["default"] = $value; - //} else if (is_numeric(substr($key,13,strlen($key)-14))) { - // $sumsizeError_ini[substr($key,13,strlen($key)-14)] = $value; - //} - } - //end_add code - if (substr($key,0,9) == "sizeError") { - if (strlen($key) == 9) { - $sizeError_ini["default"] = $value; - } else if (is_numeric(substr($key,10,strlen($key)-11))) { - $sizeError_ini[substr($key,10,strlen($key)-11)] = $value; - } - } - - if (substr($key,0,9) == "typeError") { - if (strlen($key) == 9) { - $typeError_ini["default"] = $value; - } else if (is_numeric(substr($key,10,strlen($key)-11))) { - $typeError_ini[substr($key,10,strlen($key)-11)] = $value; - } - } - - if (substr($key,0,14) == "extensionError") { - if (strlen($key) == 14) { - $extensionError_ini["default"] = $value; - } else if (is_numeric(substr($key,15,strlen($key)-16))) { - $extensionError_ini[substr($key,15,strlen($key)-16)] = $value; - } - } - - if (substr($key,0,11) == "noFileError") { - if (strlen($key) == 11) { - $noFileError_ini["default"] = $value; - } else if (is_numeric(substr($key,12,strlen($key)-13))) { - $noFileError_ini[substr($key,12,strlen($key)-13)] = $value; - } else if (substr($key,12,7) == "whether") { - $noFileError_ini["whether"] = $value; - $noFileError_whether = 0; - } - } - } - - //関連配列 - $error = $fileUpload->getError(); - $extension_check = $fileUpload->checkExtension($extension_ini); - - $mime_type_check = $fileUpload->checkMimeType($type_ini); - - if($resize) { - // リサイズ処理 - $fileUpload->resizeFile($maxwidth_ini, $maxheight_ini); - } - - $filesize_check = $fileUpload->checkFilesize($maxsize_ini); - - $filewidth_check = $fileUpload->checkFilewidth($maxwidth_ini); - - $fileheight_check = $fileUpload->checkFileheight($maxheight_ini); - - $message = ""; - //以下はforeachで各ファイルでエラーチェックを行う - $first_key = null; - foreach ($error as $key => $val) { - if($first_key === null) { - $first_key = $key; - } - if ($val != UPLOAD_ERR_OK) {// PHP自体が感知するエラーが発生した場合 - if ($val == UPLOAD_ERR_INI_SIZE) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - if (isset($attributes["iniSizeError"])) { - $message = $attributes["iniSizeError"]; - } else { - //start_change code - $message = _FILE_UPLOAD_ERR_MAX_FILESIZE_INI; - //end_change code - } - $fileUpload->setErrorMes($key, $message); - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - break; - } else if ($val == UPLOAD_ERR_FORM_SIZE) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - if (isset($attributes["formSizeError"])) { - $message = $attributes["formSizeError"]; - } else { - $message = _FILE_UPLOAD_ERR_MAX_FILESIZE; - } - $fileUpload->setErrorMes($key, $message); - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - break; - } else if ($val == UPLOAD_ERR_PARTIAL) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - if (isset($attributes["partialError"])) { - $message = $attributes["partialError"]; - } else { - $message = _FILE_UPLOAD_ERR_PART_OF_FILE; - } - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - $fileUpload->setErrorMes($key, $message); - break; - } else if ($val == UPLOAD_ERR_NO_FILE) { - if (isset($noFileError_ini[$key])) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - $message = $noFileError_ini[$key]; - $fileUpload->setErrorMes($key, $message); - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - }else if (isset($noFileError_ini["default"])) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - $message = $noFileError_ini["default"]; - $fileUpload->setErrorMes($key, $message); - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - //break; - } else if (isset($noFileError_ini["whether"])) { - $noFileError_whether = $noFileError_whether +1; - } - } - }else {// PHP自体が感知するエラーは発生していない場合 - // - //アップロード不可 - // - if($allow_attachment_flag == _ALLOW_ATTACHMENT_NO || - ($allow_attachment_flag == _ALLOW_ATTACHMENT_IMAGE && $attributes_allow_attachment_flag ==_ALLOW_ATTACHMENT_ALL)) { - //var_dump($allow_attachment_flag); - //var_dump($attributes_allow_attachment_flag); - $message = _FILE_UPLOAD_ERR_FAILURE; - $fileUpload->setErrorMes($key, $message); - continue; - } - - // - // maple.iniで設定されたサイズを超えていた場合 - // - if (count($maxsize_ini) > 0) { - if (!$filesize_check[$key]) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - if (isset($sizeError_ini[$key])) { - $message = vsprintf($sizeError_ini[$key],$maxsize_ini[$key]); //$sizeError_ini[$key]; - }else if (isset($sizeError_ini["default"])) { - $message = vsprintf($sizeError_ini["default"],$maxsize_ini["default"]); - } else { - $message = _FILE_UPLOAD_ERR_FAILURE; - } - $fileUpload->setErrorMes($key, $message); - continue; - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - } - } - - // - // maple.iniで設定されたMIME-Typeではなかった場合 - // - if (count($type_ini) > 0) { - if (!$mime_type_check[$key]) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - if (isset($typeError_ini[$key])) { - $message = $typeError_ini[$key]; - }else if (isset($typeError_ini["default"])) { - $message = $typeError_ini["default"]; - } else { - $message = _FILE_UPLOAD_ERR_FILENAME_REJECRED; - } - $fileUpload->setErrorMes($key, $message); - continue; - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - } - } - - - // - // maple.iniで設定された拡張子ではなかった場合 - // - if (count($extension_ini) > 0) { - if (!$extension_check[$key]) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - if (isset($extensionError_ini[$key])) { - $message = $extensionError_ini[$key]; - }else if (isset($extensionError_ini["default"])) { - $message = $extensionError_ini["default"]; - } else { - $message = _FILE_UPLOAD_ERR_FILENAME_REJECRED; - } - $fileUpload->setErrorMes($key, $message); - continue; - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - } - } - - // - // maple.iniで設定されたWidthを超えていた場合 - // - if (count($maxwidth_ini) > 0) { - if (!$filewidth_check[$key]) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - if (isset($widthError_ini[$key])) { - $message = vsprintf($widthError_ini[$key],$maxwidth_ini[$key]); - }else if (isset($widthError_ini["default"])) { - $message = vsprintf($widthError_ini["default"],$maxwidth_ini["default"]); - } else { - $message = _FILE_UPLOAD_ERR_FAILURE; - } - $fileUpload->setErrorMes($key, $message); - continue; - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - } - } - - // - // maple.iniで設定されたHeightを超えていた場合 - // - if (count($maxheight_ini) > 0) { - if (!$fileheight_check[$key]) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - if (isset($heightError_ini[$key])) { - $message = vsprintf($heightError_ini[$key],$maxheight_ini[$key]); - }else if (isset($heightError_ini["default"])) { - $message = vsprintf($heightError_ini["default"],$maxheight_ini["default"]); - } else { - $message = _FILE_UPLOAD_ERR_FAILURE; - } - $fileUpload->setErrorMes($key, $message); - continue; - //$errorList->add($fileUpload->getName()."[".$key."]", $message); - } - } - } - } - if (isset($noFileError_whether) && count($error) == $noFileError_whether) { - //$errorList->setType(UPLOAD_ERROR_TYPE); - $message = $noFileError_ini["whether"]; - //少なくとも1つファイルを指定しないとならないエラーの場合、先頭のfileのエラーリストに追加する key=0固定 - $fileUpload->setErrorMes($first_key, $message); - //$errorList->add($fileUpload->getName(), $message); - } - - // - // start_add code - // ルーム毎の最大容量チェック - // - $room_id = intval($request->getParameter("room_id")); - if($room_id != 0) { - $getdata =& $container->getComponent("GetData"); - $pages = $getdata->getParameter("pages"); - if(!isset($pages[$room_id])) { + foreach($extensionSubArray as $extensionValue) { + $typeSubArray[$count] = $uploadsView->mimeinfo("type", "." . $extensionValue); + $count++; + } + //if (strlen($key) == 14) { + if(isset($type_ini["default"]) && is_array($type_ini["default"]) && count($type_ini["default"]) > 0) { + $type_ini["default"] = array_merge($type_ini["default"], $typeSubArray); + } else { + $type_ini["default"] = $typeSubArray; + } + //} else if (is_numeric(substr($key,15,strlen($key)-16))) { + // if(count($typeArray) > 0) { + // $type_ini[substr($key,15,strlen($key)-16)] = array_merge($typeArray, $typeSubArray); + // } else { + // $type_ini[substr($key,15,strlen($key)-16)] = $typeSubArray; + // } + //} + } else { + // 拡張子 + if(isset($extension_ini["default"]) && is_array($extension_ini["default"]) && count($extension_ini["default"]) > 0) { + $extension_ini["default"] = array_merge($extension_ini["default"], $extensionSubArray); + } else { + $extension_ini["default"] = $extensionSubArray; + } + } + } + } + } + if(defined($value)) { + $value = constant($value); + } + if (substr($key,0,10) == "widthError") { + if (strlen($key) == 10) { + $widthError_ini["default"] = $value; + } else if (is_numeric(substr($key,11,strlen($key)-12))) { + $widthError_ini[substr($key,11,strlen($key)-12)] = $value; + } + } + if (substr($key,0,11) == "heightError") { + if (strlen($key) == 11) { + $heightError_ini["default"] = $value; + } else if (is_numeric(substr($key,12,strlen($key)-13))) { + $heightError_ini[substr($key,12,strlen($key)-13)] = $value; + } + } + if (substr($key,0,12) == "sumsizeError") { + $sumsizeError_ini = $value; + //if (strlen($key) == 12) { + // $sumsizeError_ini["default"] = $value; + //} else if (is_numeric(substr($key,13,strlen($key)-14))) { + // $sumsizeError_ini[substr($key,13,strlen($key)-14)] = $value; + //} + } + //end_add code + if (substr($key,0,9) == "sizeError") { + if (strlen($key) == 9) { + $sizeError_ini["default"] = $value; + } else if (is_numeric(substr($key,10,strlen($key)-11))) { + $sizeError_ini[substr($key,10,strlen($key)-11)] = $value; + } + } + + if (substr($key,0,9) == "typeError") { + if (strlen($key) == 9) { + $typeError_ini["default"] = $value; + } else if (is_numeric(substr($key,10,strlen($key)-11))) { + $typeError_ini[substr($key,10,strlen($key)-11)] = $value; + } + } + + if (substr($key,0,14) == "extensionError") { + if (strlen($key) == 14) { + $extensionError_ini["default"] = $value; + } else if (is_numeric(substr($key,15,strlen($key)-16))) { + $extensionError_ini[substr($key,15,strlen($key)-16)] = $value; + } + } + + if (substr($key,0,11) == "noFileError") { + if (strlen($key) == 11) { + $noFileError_ini["default"] = $value; + } else if (is_numeric(substr($key,12,strlen($key)-13))) { + $noFileError_ini[substr($key,12,strlen($key)-13)] = $value; + } else if (substr($key,12,7) == "whether") { + $noFileError_ini["whether"] = $value; + $noFileError_whether = 0; + } + } + } + + //関連配列 + $error = $fileUpload->getError(); + $extension_check = $fileUpload->checkExtension($extension_ini); + + $mime_type_check = $fileUpload->checkMimeType($type_ini); + + if($resize) { + //指定された大きさ(解像度)を取得 + $resolution = $request->getParameter('resolution'); + + $maxwidth = array(); + $maxheight = array(); + + //解像度により maxwidthを設定(maxheightは自動設定) + switch ($resolution) { + //「実寸大」の場合はリサイズしない + case 'asis': + break; + + //「大」の場合 + case 'large': + // 幅、高さ設定値を取得 + $maxwidth['default'] = _UPLOAD_RESOLUTION_IMAGE_LARGE_WIDTH; + $maxheight['default'] = _UPLOAD_RESOLUTION_IMAGE_LARGE_HEIGHT; + //リサイズ処理 + $fileUpload->resizeFile($maxwidth, $maxheight); + break; + + //「中」の場合 + case 'middle': + // 幅、高さ設定値を取得 + $maxwidth['default'] = _UPLOAD_RESOLUTION_IMAGE_MIDDLE_WIDTH; + $maxheight['default'] = _UPLOAD_RESOLUTION_IMAGE_MIDDLE_HEIGHT; + //リサイズ処理 + $fileUpload->resizeFile($maxwidth, $maxheight); + break; + + //「小」の場合 + case 'small': + // 幅、高さ設定値を取得 + $maxwidth['default'] = _UPLOAD_RESOLUTION_IMAGE_SMALL_WIDTH; + $maxheight['default'] = _UPLOAD_RESOLUTION_IMAGE_SMALL_HEIGHT; + //リサイズ処理 + $fileUpload->resizeFile($maxwidth, $maxheight); + break; + + //「標準」、指定なしの場合 + default: + //各モジュールのmaple.iniに定義されたサイズでリサイズ処理 + $fileUpload->resizeFile($maxwidth_ini, $maxheight_ini); + break; + } + } + + $filesize_check = $fileUpload->checkFilesize($maxsize_ini); + + $filewidth_check = $fileUpload->checkFilewidth($maxwidth_ini); + + $fileheight_check = $fileUpload->checkFileheight($maxheight_ini); + + $message = ""; + //以下はforeachで各ファイルでエラーチェックを行う + $first_key = null; + foreach ($error as $key => $val) { + if($first_key === null) { + $first_key = $key; + } + if ($val != UPLOAD_ERR_OK) {// PHP自体が感知するエラーが発生した場合 + if ($val == UPLOAD_ERR_INI_SIZE) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + if (isset($attributes["iniSizeError"])) { + $message = $attributes["iniSizeError"]; + } else { + //start_change code + $message = _FILE_UPLOAD_ERR_MAX_FILESIZE_INI; + //end_change code + } + $fileUpload->setErrorMes($key, $message); + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + break; + } else if ($val == UPLOAD_ERR_FORM_SIZE) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + if (isset($attributes["formSizeError"])) { + $message = $attributes["formSizeError"]; + } else { + $message = _FILE_UPLOAD_ERR_MAX_FILESIZE; + } + $fileUpload->setErrorMes($key, $message); + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + break; + } else if ($val == UPLOAD_ERR_PARTIAL) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + if (isset($attributes["partialError"])) { + $message = $attributes["partialError"]; + } else { + $message = _FILE_UPLOAD_ERR_PART_OF_FILE; + } + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + $fileUpload->setErrorMes($key, $message); + break; + } else if ($val == UPLOAD_ERR_NO_FILE) { + if (isset($noFileError_ini[$key])) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + $message = $noFileError_ini[$key]; + $fileUpload->setErrorMes($key, $message); + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + }else if (isset($noFileError_ini["default"])) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + $message = $noFileError_ini["default"]; + $fileUpload->setErrorMes($key, $message); + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + //break; + } else if (isset($noFileError_ini["whether"])) { + $noFileError_whether = $noFileError_whether +1; + } + } + }else {// PHP自体が感知するエラーは発生していない場合 + // + //アップロード不可 + // + if($allow_attachment_flag == _ALLOW_ATTACHMENT_NO || + ($allow_attachment_flag == _ALLOW_ATTACHMENT_IMAGE && $attributes_allow_attachment_flag ==_ALLOW_ATTACHMENT_ALL)) { + //var_dump($allow_attachment_flag); + //var_dump($attributes_allow_attachment_flag); + $message = _FILE_UPLOAD_ERR_FAILURE; + $fileUpload->setErrorMes($key, $message); + continue; + } + + // + // maple.iniで設定されたサイズを超えていた場合 + // + if (count($maxsize_ini) > 0) { + if (!$filesize_check[$key]) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + if (isset($sizeError_ini[$key])) { + $message = vsprintf($sizeError_ini[$key],$maxsize_ini[$key]); //$sizeError_ini[$key]; + }else if (isset($sizeError_ini["default"])) { + $message = vsprintf($sizeError_ini["default"],$maxsize_ini["default"]); + } else { + $message = _FILE_UPLOAD_ERR_FAILURE; + } + $fileUpload->setErrorMes($key, $message); + continue; + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + } + } + + // + // maple.iniで設定されたMIME-Typeではなかった場合 + // + if (count($type_ini) > 0) { + if (!$mime_type_check[$key]) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + if (isset($typeError_ini[$key])) { + $message = $typeError_ini[$key]; + }else if (isset($typeError_ini["default"])) { + $message = $typeError_ini["default"]; + } else { + $message = _FILE_UPLOAD_ERR_FILENAME_REJECRED; + } + $fileUpload->setErrorMes($key, $message); + continue; + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + } + } + + + // + // maple.iniで設定された拡張子ではなかった場合 + // + if (count($extension_ini) > 0) { + if (!$extension_check[$key]) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + if (isset($extensionError_ini[$key])) { + $message = $extensionError_ini[$key]; + }else if (isset($extensionError_ini["default"])) { + $message = $extensionError_ini["default"]; + } else { + $message = _FILE_UPLOAD_ERR_FILENAME_REJECRED; + } + $fileUpload->setErrorMes($key, $message); + continue; + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + } + } + + // + // maple.iniで設定されたWidthを超えていた場合 + // + if (count($maxwidth_ini) > 0) { + if (!$filewidth_check[$key]) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + if (isset($widthError_ini[$key])) { + $message = vsprintf($widthError_ini[$key],$maxwidth_ini[$key]); + }else if (isset($widthError_ini["default"])) { + $message = vsprintf($widthError_ini["default"],$maxwidth_ini["default"]); + } else { + $message = _FILE_UPLOAD_ERR_FAILURE; + } + $fileUpload->setErrorMes($key, $message); + continue; + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + } + } + + // + // maple.iniで設定されたHeightを超えていた場合 + // + if (count($maxheight_ini) > 0) { + if (!$fileheight_check[$key]) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + if (isset($heightError_ini[$key])) { + $message = vsprintf($heightError_ini[$key],$maxheight_ini[$key]); + }else if (isset($heightError_ini["default"])) { + $message = vsprintf($heightError_ini["default"],$maxheight_ini["default"]); + } else { + $message = _FILE_UPLOAD_ERR_FAILURE; + } + $fileUpload->setErrorMes($key, $message); + continue; + //$errorList->add($fileUpload->getName()."[".$key."]", $message); + } + } + } + } + if (isset($noFileError_whether) && count($error) == $noFileError_whether) { + //$errorList->setType(UPLOAD_ERROR_TYPE); + $message = $noFileError_ini["whether"]; + //少なくとも1つファイルを指定しないとならないエラーの場合、先頭のfileのエラーリストに追加する key=0固定 + $fileUpload->setErrorMes($first_key, $message); + //$errorList->add($fileUpload->getName(), $message); + } + + // + // start_add code + // ルーム毎の最大容量チェック + // + $room_id = intval($request->getParameter("room_id")); + if($room_id != 0) { + $getdata =& $container->getComponent("GetData"); + $pages = $getdata->getParameter("pages"); + if(!isset($pages[$room_id])) { $pagesView =& $container->getComponent("pagesView"); $page = $pagesView->getPageById($room_id); - } else { - $page =& $pages[$room_id]; - } - $max_capacity = 0; - if($page['private_flag'] == _ON) { - $max_capacity = $session->getParameter("_private_max_size"); - } else if($page['space_type'] == _SPACE_TYPE_GROUP) { - $upload_max_capacity_group = $configView->getConfigByConfname(_SYS_CONF_MODID, "upload_max_capacity_group"); + } else { + $page =& $pages[$room_id]; + } + $max_capacity = 0; + if($page['private_flag'] == _ON) { + $max_capacity = $session->getParameter("_private_max_size"); + } else if($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"); + } 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) { - $filesize = $fileUpload->getFilesize(); - $sum_size = 0; - foreach($filesize as $size) { - $sum_size = $size; - } - $db =& $container->getComponent("DbObject"); - $db_sum_size = intval($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; - } - // エラー - $message = sprintf(_FILE_UPLOAD_ERR_MAX_CAPACITY, $page['page_name'], $fileView->formatSize($max_capacity), $fileView->formatSize($rest_size)); - - // key=0固定 - $stopper = _ON; - $fileUpload->setErrorMes($first_key, $message); - } - } - - } - // 合計サイズチェック - if(isset($summaxsize_ini)) { - $filesize = $fileUpload->getFilesize(); - $sum_size = 0; - foreach($filesize as $size) { - $sum_size = $size; - } - if ($summaxsize_ini < $sum_size) { - // エラー - if(isset($sumsizeError_ini)) { - $message = $sumsizeError_ini; - } else { - $message = sprintf(_FILE_UPLOAD_ERR_SUMSIZE_SIZE, $fileView->formatSize($summaxsize_ini)); - } - // key=0固定 - $stopper = _ON; - $fileUpload->setErrorMes($first_key, $message); - } - } - - //end_add code - - - if($message != "" && $stopper == _ON) { - //stopperがONならば、エラーリストに追加し、アクションを呼ばない(エラーリスト追加) - //最後に発生したエラーをエラーリストへ追加 - $errorList->setType(UPLOAD_ERROR_TYPE); - $errorList->add($fileUpload->getName(), $message); - } - } else { - $log->trace("フィールド名が指定されていません", "Filter_FileUpload#execute"); - } - - $filterChain =& $container->getComponent("FilterChain"); - $filterChain->execute(); - - $log->trace("Filter_FileUploadの後処理が実行されました", "Filter_FileUpload#execute"); - } - - function constantDef($str) { - if(defined($str)) { - return constant($str); - } else { - return $str; - } - } - - function _decompression($name, &$fileUpload) { - $container =& DIContainerFactory::getContainer(); - $actionChain =& $container->getComponent("ActionChain"); - $session =& $container->getComponent("Session"); - $file_extra =& $container->getComponent("File"); - - $commonMain =& $container->getComponent("commonMain"); - $fileAction =& $commonMain->registerClass(WEBAPP_DIR.'/components/file/Action.class.php', "File_Action", "fileAction"); - - $action_name = $actionChain->getCurActionName(); - $pathList = explode("_", $action_name); - - $cur_sess_id = $session->getID(); - - require_once "File/Archive.php"; - - // - // テンポラリーディレクトリ作成 - // - if(!file_exists(FILEUPLOADS_DIR.$pathList[0])) { - mkdir(FILEUPLOADS_DIR.$pathList[0], octdec(_UPLOAD_FOLDER_MODE)); - } - $file_path = $pathList[0]."/".strtolower($cur_sess_id); + } + if($max_capacity != 0) { + $filesize = $fileUpload->getFilesize(); + $sum_size = 0; + foreach($filesize as $size) { + $sum_size = $size; + } + $db =& $container->getComponent("DbObject"); + $db_sum_size = intval($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; + } + // エラー + $message = sprintf(_FILE_UPLOAD_ERR_MAX_CAPACITY, $page['page_name'], $fileView->formatSize($max_capacity), $fileView->formatSize($rest_size)); + + // key=0固定 + $stopper = _ON; + $fileUpload->setErrorMes($first_key, $message); + } + } + + } + // 合計サイズチェック + if(isset($summaxsize_ini)) { + $filesize = $fileUpload->getFilesize(); + $sum_size = 0; + foreach($filesize as $size) { + $sum_size = $size; + } + if ($summaxsize_ini < $sum_size) { + // エラー + if(isset($sumsizeError_ini)) { + $message = $sumsizeError_ini; + } else { + $message = sprintf(_FILE_UPLOAD_ERR_SUMSIZE_SIZE, $fileView->formatSize($summaxsize_ini)); + } + // key=0固定 + $stopper = _ON; + $fileUpload->setErrorMes($first_key, $message); + } + } + + //end_add code + + + if($message != "" && $stopper == _ON) { + //stopperがONならば、エラーリストに追加し、アクションを呼ばない(エラーリスト追加) + //最後に発生したエラーをエラーリストへ追加 + $errorList->setType(UPLOAD_ERROR_TYPE); + $errorList->add($fileUpload->getName(), $message); + } + } else { + $log->trace("フィールド名が指定されていません", "Filter_FileUpload#execute"); + } + + $filterChain =& $container->getComponent("FilterChain"); + $filterChain->execute(); + + $log->trace("Filter_FileUploadの後処理が実行されました", "Filter_FileUpload#execute"); + } + + function constantDef($str) { + if(defined($str)) { + return constant($str); + } else { + return $str; + } + } + + function _decompression($name, &$fileUpload) { + $container =& DIContainerFactory::getContainer(); + $actionChain =& $container->getComponent("ActionChain"); + $session =& $container->getComponent("Session"); + $file_extra =& $container->getComponent("File"); + + $commonMain =& $container->getComponent("commonMain"); + $fileAction =& $commonMain->registerClass(WEBAPP_DIR.'/components/file/Action.class.php', "File_Action", "fileAction"); + + $action_name = $actionChain->getCurActionName(); + $pathList = explode("_", $action_name); + + $cur_sess_id = $session->getID(); + + require_once "File/Archive.php"; + + // + // テンポラリーディレクトリ作成 + // + if(!file_exists(FILEUPLOADS_DIR.$pathList[0])) { + mkdir(FILEUPLOADS_DIR.$pathList[0], octdec(_UPLOAD_FOLDER_MODE)); + } + $file_path = $pathList[0]."/".strtolower($cur_sess_id); if (file_exists(FILEUPLOADS_DIR.$file_path)) { - $result = $fileAction->delDir(FILEUPLOADS_DIR.$file_path); - if ($result === false) { - return false; - } - } - - mkdir(FILEUPLOADS_DIR.$file_path, octdec(_UPLOAD_FOLDER_MODE)); - - // - // 圧縮ファイル取得 - // - $files = $file_extra->getParameterRef($name); + $result = $fileAction->delDir(FILEUPLOADS_DIR.$file_path); + if ($result === false) { + return false; + } + } + + mkdir(FILEUPLOADS_DIR.$file_path, octdec(_UPLOAD_FOLDER_MODE)); + + // + // 圧縮ファイル取得 + // + $files = $file_extra->getParameterRef($name); $file_name = FILEUPLOADS_DIR.$file_path."/".$files['name']; // @@ -713,24 +756,24 @@ function _decompression($name, &$fileUpload) { // $fileUpload->moveで移動してしまうとエラーとなる。 // $fileUpload->move(0, $file_name); - - // - // 圧縮ファイル解凍 - // + + // + // 圧縮ファイル解凍 + // File_Archive::extract(File_Archive::read($file_name."/"), $dest = FILEUPLOADS_DIR.$file_path); - + + // + // 圧縮ファイル削除 // - // 圧縮ファイル削除 - // $fileAction->delDir($file_name); - + + // + // 解凍したファイルをアップロードファイルとしてセット // - // 解凍したファイルをアップロードファイルとしてセット - // - $commonMain =& $container->getComponent("commonMain"); + $commonMain =& $container->getComponent("commonMain"); $uploadsAction =& $commonMain->registerClass(WEBAPP_DIR.'/components/uploads/Action.class.php', "Uploads_Action", "uploadsAction"); - + $uploadsAction->setFileByPath(FILEUPLOADS_DIR.$file_path, $name); - } + } } ?> \ No newline at end of file diff --git a/html/maple/filter/Filter_Mobile.class.php b/html/maple/filter/Filter_Mobile.class.php index 6e32614..8912b07 100644 --- a/html/maple/filter/Filter_Mobile.class.php +++ b/html/maple/filter/Filter_Mobile.class.php @@ -1,418 +1,418 @@ -_container =& DIContainerFactory::getContainer(); - $this->_log =& LogFactory::getLog(); - $this->_filterChain =& $this->_container->getComponent("FilterChain"); - $this->_actionChain =& $this->_container->getComponent("ActionChain"); - $this->_db =& $this->_container->getComponent("DbObject"); - $this->_session =& $this->_container->getComponent("Session"); - $this->_request =& $this->_container->getComponent("Request"); - $this->_modulesView =& $this->_container->getComponent("modulesView"); - //$this->_mobile_obj = $this->_modulesView->getModuleByDirname("mobile"); - $this->_usersView =& $this->_container->getComponent("usersView"); - - //mb_stringがロードされているかどうか - if (!extension_loaded('mbstring') && !function_exists("mb_convert_encoding")) { - include_once MAPLE_DIR . '/includes/mbstring.php'; - } else if(function_exists("mb_detect_order")){ - mb_detect_order(_MB_DETECT_ORDER_VALUE); - } - if (function_exists("mb_internal_encoding")) { - mb_internal_encoding(INTERNAL_CODE); - } - if (function_exists("mb_language")) { - mb_language("Japanese"); - } - - $this->_log->trace("{$this->_classname}の前処理が実行されました", "{$this->_classname}#execute"); - $this->_preFilter(); - - $this->_filterChain->execute(); - - $this->_log->trace("{$this->_classname}の後処理が実行されました", "{$this->_classname}#execute"); - $this->_postFilter(); - } - - /** - * プレフィルタ - * - * @access private - */ - function _preFilter() - { - require_once( WEBAPP_DIR . "/config/mobile.inc.php" ); - - $this->_session->setParameter("_mobile_flag", _OFF); - $this->_session->setParameter("_smartphone_flag", _OFF); - //if (!$this->_mobile_obj) { return; } - - // 読み上げソフト対応 - $actionName = $this->_actionChain->getCurActionName(); - if ($actionName == DEFAULT_MOBILE_ACTION) { - $reader_flag = $this->_request->getParameter("reader_flag"); - if (isset($reader_flag)) { - $reader_flag = intval($reader_flag); - } else { - $reader_flag = intval($this->_session->getParameter("_reader_flag")); - } - } else { - $reader_flag = intval($this->_session->getParameter("_reader_flag")); - } - // スマートフォンPCビューアー切り替え対応 - if($actionName == DEFAULT_ACTION) { - $pcviewer_flag = $this->_request->getParameter('pcviewer_flag'); - if (isset($pcviewer_flag)) { - $pcviewer_flag = intval($pcviewer_flag); - $this->_session->setParameter('_pcviewer_flag', $pcviewer_flag); - } else { - $pcviewer_flag = intval($this->_session->getParameter('_pcviewer_flag')); - } - } else { - $pcviewer_flag = intval($this->_session->getParameter('_pcviewer_flag')); - } - if($pcviewer_flag == _ON){ - return; - } - - if (in_array($actionName, $this->_clear_page_id)) { - $this->_session->removeParameter("_mobile_page_id"); - $this->_session->removeParameter("_mobile_room_id"); - $this->_session->removeParameter("_mobile_module_id"); - } - if (in_array($actionName, $this->_clear_reader)) { - $this->_session->removeParameter("_reader_flag"); - } else { - $this->_session->setParameter("_reader_flag", $reader_flag); - } - - $mobileCheck =& MobileCheck::getInstance(); - if ($mobileCheck->isMobile() == _OFF) { return; } - $mobile_info = $mobileCheck->getMobileInfo(); - $mobile_obj = $this->_modulesView->getModuleByDirname("mobile"); - - $configView =& $this->_container->getComponent("configView"); - $config = $configView->getConfig($mobile_obj["module_id"], false); - if ($config == false) { return; } - if ($config["allow_emulator"]["conf_value"] == _OFF && !$mobile_info["proper_route"]) { return; } - - // この人物が携帯をどのようなモードで見ようとしているかを取得 - $texthtml_mode = -1; - $imgdsp_size = -1; - $user_id = $this->_session->getParameter("_user_id"); - if( $user_id != '0' ) { - $texthtml_mode_item_id = $this->_usersView->getItemIdByTagName( "mobile_texthtml_mode" ); - $imgdsp_size_item_id = $this->_usersView->getItemIdByTagName( "mobile_imgdsp_size" ); - $user_items = $this->_usersView->getUserItemLinkById( $user_id ); - if( isset( $user_items[ $texthtml_mode_item_id ] ) && $user_items[ $texthtml_mode_item_id ]['content'] != "" ) { - $texthtml_mode = constant( str_replace( "USER_ITEM", "MOBILE", trim( $user_items[ $texthtml_mode_item_id ]['content'], "|" ) ) ); - } - if( isset( $user_items[ $imgdsp_size_item_id ] ) && $user_items[ $imgdsp_size_item_id ]['content'] != "" ) { - $imgdsp_size = constant( str_replace( "USER_ITEM", "MOBILE", trim( $user_items[ $imgdsp_size_item_id ]['content'], "|" ) ) ); - } - } - if( $texthtml_mode == -1 ) { - $texthtml_mode = $config["mobile_text_html_mode"]["conf_value"]; - } - if( $imgdsp_size == -1 ) { - $imgdsp_size = $config["mobile_imgdsp_size"]["conf_value"]; - } - $this->_session->setParameter("_mobile_text_html_mode", $texthtml_mode); - $this->_session->setParameter("_mobile_imgdsp_size", $imgdsp_size); - - $this->_session->setParameter("_mobile_info", $mobile_info); - $this->_session->setParameter("_mobile_flag", _ON); - if($mobileCheck->isSmartPhone() == true) { - $this->_session->setParameter('_smartphone_flag', _ON); - } - - $action_name = $this->_request->getParameter("action"); - $page_id = intval($this->_request->getParameter("page_id")); - $room_id = intval($this->_request->getParameter("room_id")); - if (!isset($page_id)) { - $page_id = intval($this->_session->getParameter("_mobile_page_id")); - } - $room_id = $this->_request->getParameter("room_id"); - if (!isset($room_id)) { - $room_id = intval($this->_session->getParameter("_mobile_room_id")); - } - $block_id = intval($this->_request->getParameter("block_id")); - - - $mobileView =& $this->_container->getComponent("mobileView"); - $getdata =& $this->_container->getComponent("GetData"); - - $mobile_modules = $mobileView->getModules(null, array($this,"_callbackFunc")); - $getdata->setParameter("mobile_modules", $mobile_modules); - - $active_action = $this->_request->getParameter("active_action"); - if ($active_action != "") { - $params = $this->_request->getParameters(); - - $this->_request->setParameter("action", $active_action); - $this->_request->setParameter("active_action", null); - $this->_request->setParameter(_ABBREVIATE_URL_REQUEST_KEY, null); - - $params = $this->_request->getParameters(); - $str_params = ""; - foreach($params as $key => $value) { - if (empty($value) || is_array($value)) { continue; } - if (substr($key, 0, 1) == "_") { continue; } - - $key = htmlspecialchars($key, ENT_QUOTES); - if ($key == session_name()) { - $value = session_id(); - } else { - $value = rawurlencode($value); - } - $str_params .= "&" . $key."=".$value; - } - - if ($this->_session->getParameter("_user_id") == "" && $block_id > 0) { - $blocksView =& $this->_container->getComponent("blocksView"); - $blocks = $blocksView->getBlockById($block_id); - if (empty($blocks)) { - header('Location: '.BASE_URL.INDEX_FILE_NAME); - exit; - } - - $authCheck =& $this->_container->getComponent("authCheck"); - $result = $authCheck->getPageAuthId(null, $blocks["page_id"]); - if ($result == _AUTH_OTHER) { - if ($reader_flag == _ON) { - $session_param = ""; - } else { - $session_param = "&".session_name()."=".session_id(); - } - $this->_session->setParameter("_mobile_redirect_url", $str_params); - header('Location: '.BASE_URL.INDEX_FILE_NAME."?".ACTION_KEY."=".$mobile_modules[_DISPLAY_POSITION_HEADER]["login"]["mobile_action_name"].$session_param); - exit; - } - } - - $this->_session->removeParameter("_mobile_redirect_url"); - header('Location: '.BASE_URL.INDEX_FILE_NAME."?".substr($str_params, 1)); - exit; - - } elseif ($action_name == DEFAULT_ACTION) { - $parameters = (!empty($page_id) ? "&page_id=".$page_id."&room_id=".intval($room_id) : "").(!empty($block_id) ? "&block_id=".$block_id : ""); - if ($reader_flag == _OFF) { - $parameters .= "&".session_name()."=".session_id(); - } - $action_name = DEFAULT_MOBILE_ACTION; - if (!empty($block_id)) { - $blocksView =& $this->_container->getComponent("blocksView"); - $modulesView =& $this->_container->getComponent("modulesView"); - $blocks = $blocksView->getBlockById($block_id); - if (!empty($blocks)) { - $modules = $modulesView->getModulesById($blocks["module_id"]); - if (!empty($modules)) { - $action_name = $modules["action_name"]; - } - } - } - header('Location: '.BASE_URL.INDEX_FILE_NAME."?".ACTION_KEY."=".$action_name.$parameters); - exit; - } - - $this->_session->setParameter("_mobile_default_module", $config["default_module"]["conf_value"]); - - /* - * リクエストの変換 - */ - $action =& $this->_actionChain->getCurAction(); - $attributes = $this->getAttributes(); - //if (empty($attributes)) { return; } - - $params = $this->_request->getParameters(); - $this->_strtoconvert($params); - $this->_request->clear(); - $this->_request->setParameters($params); - - foreach ($attributes as $key=>$value) { - $keyArr = explode(":", $key); - $parameter = null; - if ($keyArr[0] == "date" || $keyArr[0] == "input_date" || $keyArr[0] == "time" || $keyArr[0] == "time12" || $keyArr[0] == "full_date" || $keyArr[0] == "full_time") { - $valArr = explode(",", $keyArr[1]); - if (($keyArr[0] == "date" || $keyArr[0] == "input_date") && count($valArr) == 3 || - $keyArr[0] == "time" && count($valArr) <= 3 || - $keyArr[0] == "time12" && count($valArr) > 0 && count($valArr) <= 4 && (strtolower($valArr[0]) == "am" || strtolower($valArr[0]) == "pm") || - ($keyArr[0] == "full_date" || $keyArr[0] == "full_time") && count($valArr) == 6) { - - foreach ($valArr as $i=>$val) { - $valArr[$i] = $this->_request->getParameter($val); - } - if ($keyArr[0] == "date") { - list($month, $day, $year) = $valArr; - list($hour, $min, $sec) = array(0,0,0); - } elseif ($keyArr[0] == "input_date") { - list($month, $day, $year) = $valArr; - list($hour, $min, $sec) = array(0,0,0); - } elseif ($keyArr[0] == "time") { - list($month, $day, $year) = array(date("m"), date("d"), date("Y")); - if (count($valArr) < 1) { $valArr[0] = 0; } - if (count($valArr) < 2) { $valArr[1] = 0; } - if (count($valArr) < 3) { $valArr[2] = 0; } - list($hour, $min, $sec) = $valArr; - } elseif ($keyArr[0] == "time12") { - list($month, $day, $year) = array(date("m"), date("d"), date("Y")); - if (count($valArr) < 2) { $valArr[1] = 0; } - if (count($valArr) < 3) { $valArr[2] = 0; } - if (count($valArr) < 4) { $valArr[3] = 0; } - list($am_pm, $hour, $min, $sec) = $valArr; - if (strtolower($am_pm) == "pm") { - $hour = intval($hour) + 12; - } - } else { - list($hour, $min, $sec, $month, $day, $year) = $valArr; - } - if ($keyArr[0] == "time" || $keyArr[0] == "time12" || $keyArr[0] != "time" && $keyArr[0] != "time12" && checkdate(intval($month),intval($day),intval($year))) { - if ($keyArr[0] == "date" && empty($keyArr[2])) { $keyArr[2] = _DATE_FORMAT; } - if ($keyArr[0] == "input_date" && empty($keyArr[2])) { $keyArr[2] = _INPUT_DATE_FORMAT; } - if (($keyArr[0] == "time" || $keyArr[0] == "time12") && empty($keyArr[2])) { $keyArr[2] = _TIME_FORMAT; } - if (($keyArr[0] == "full_date" || $keyArr[0] == "full_time") && empty($keyArr[2])) { $keyArr[2] = _FULL_DATE_FORMAT; } - $parameter = date($keyArr[2], mktime(intval($hour), intval($min), intval($sec), intval($month), intval($day), intval($year))); - $this->_request->setParameter($value, $parameter); - continue; - } else { - $paramArr = explode(",", $keyArr[1]); - } - } else { - $paramArr = explode(",", $keyArr[1]); - } - } else { - $paramArr = explode(",", $key); - } - foreach ($paramArr as $i=>$keyVal) { - $str = $this->_request->getParameter($keyVal); - if (!isset($str)) { continue; } - $parameter .= $str; - } - if (!isset($parameter)) { continue; } - $this->_request->setParameter($value, $parameter); - } - - } - /** - * 携帯モジュール取得 - * - * @access private - */ - function _callbackFunc(&$recordSet) - { - $result = array(); - while ($row = $recordSet->fetchRow()) { - $pathList = explode("_", $row["mobile_action_name"]); - $row["dir_name"] = $pathList[0]; - $row["module_name"] = $this->_modulesView->loadModuleName($row["dir_name"]); - $result[$row["display_position"]][$row["dir_name"]] = $row; - } - return $result; - } - /** - * 携帯モジュール取得 - * - * @access private - */ - function _strtoconvert(&$params) - { - foreach (array_keys($params) as $key) { - if (is_array($params[$key])) { - $this->_strtoconvert($params[$key]); - } else { - $params[$key] = mb_convert_encoding($params[$key], "utf-8", "auto"); - } - } - } - - /** - * ポストフィルタ - * - * @access private - */ - function _postFilter() - { - //if (!$this->_mobile_obj) { return true; } - - $tel_id = $this->_session->getParameter("_mobile_tel_id"); - if (!empty($tel_id)) { - $user_id = $this->_session->getParameter("_user_id"); - $result = $this->_db->updateExecute("mobile_users", array(), array("user_id"=>$user_id), true); - if ($result === false) { - return false; - } - - if (rand(0, 10) != 0) { - $maxlifetime = $this->_session->getParameter('_session_gc_maxlifetime'); - $time = timezone_date(); - $timestamp = mktime(intval(substr($time,8,2)),intval(substr($time,10,2))-$maxlifetime,intval(substr($time,12,2)), - intval(substr($time,4,2)),intval(substr($time,6,2)),intval(substr($time,0,4))); - $sql = "DELETE FROM {mobile_users} WHERE update_time < ?"; - $result = $this->_db->execute($sql, array("update_time"=>date("YmdHis", $timestamp))); - if ($result === false) { - $this->_db->addError(); - return false; - } - } - } - - $page_id = intval($this->_request->getParameter("page_id")); - if ($page_id > 0) { - $this->_session->setParameter("_mobile_page_id", $page_id); - } - $room_id = intval($this->_request->getParameter("room_id")); - if ($room_id > 0) { - $this->_session->setParameter("_mobile_room_id", $room_id); - } - $module_id = intval($this->_request->getParameter("module_id")); - if ($module_id > 0) { - $this->_session->setParameter("_mobile_module_id", $module_id); - } - } -} -?> +_container =& DIContainerFactory::getContainer(); + $this->_log =& LogFactory::getLog(); + $this->_filterChain =& $this->_container->getComponent("FilterChain"); + $this->_actionChain =& $this->_container->getComponent("ActionChain"); + $this->_db =& $this->_container->getComponent("DbObject"); + $this->_session =& $this->_container->getComponent("Session"); + $this->_request =& $this->_container->getComponent("Request"); + $this->_modulesView =& $this->_container->getComponent("modulesView"); + //$this->_mobile_obj = $this->_modulesView->getModuleByDirname("mobile"); + $this->_usersView =& $this->_container->getComponent("usersView"); + + //mb_stringがロードされているかどうか + if (!extension_loaded('mbstring') && !function_exists("mb_convert_encoding")) { + include_once MAPLE_DIR . '/includes/mbstring.php'; + } else if(function_exists("mb_detect_order")){ + mb_detect_order(_MB_DETECT_ORDER_VALUE); + } + if (function_exists("mb_internal_encoding")) { + mb_internal_encoding(INTERNAL_CODE); + } + if (function_exists("mb_language")) { + mb_language("Japanese"); + } + + $this->_log->trace("{$this->_classname}の前処理が実行されました", "{$this->_classname}#execute"); + $this->_preFilter(); + + $this->_filterChain->execute(); + + $this->_log->trace("{$this->_classname}の後処理が実行されました", "{$this->_classname}#execute"); + $this->_postFilter(); + } + + /** + * プレフィルタ + * + * @access private + */ + function _preFilter() + { + require_once( WEBAPP_DIR . "/config/mobile.inc.php" ); + + $this->_session->setParameter("_mobile_flag", _OFF); + $this->_session->setParameter("_smartphone_flag", _OFF); + //if (!$this->_mobile_obj) { return; } + + // 読み上げソフト対応 + $actionName = $this->_actionChain->getCurActionName(); + if ($actionName == DEFAULT_MOBILE_ACTION) { + $reader_flag = $this->_request->getParameter("reader_flag"); + if (isset($reader_flag)) { + $reader_flag = intval($reader_flag); + } else { + $reader_flag = intval($this->_session->getParameter("_reader_flag")); + } + } else { + $reader_flag = intval($this->_session->getParameter("_reader_flag")); + } + // スマートフォンPCビューアー切り替え対応 + if($actionName == DEFAULT_ACTION) { + $pcviewer_flag = $this->_request->getParameter('pcviewer_flag'); + if (isset($pcviewer_flag)) { + $pcviewer_flag = intval($pcviewer_flag); + $this->_session->setParameter('_pcviewer_flag', $pcviewer_flag); + } else { + $pcviewer_flag = intval($this->_session->getParameter('_pcviewer_flag')); + } + } else { + $pcviewer_flag = intval($this->_session->getParameter('_pcviewer_flag')); + } + if($pcviewer_flag == _ON){ + return; + } + + if (in_array($actionName, $this->_clear_page_id)) { + $this->_session->removeParameter("_mobile_page_id"); + $this->_session->removeParameter("_mobile_room_id"); + $this->_session->removeParameter("_mobile_module_id"); + } + if (in_array($actionName, $this->_clear_reader)) { + $this->_session->removeParameter("_reader_flag"); + } else { + $this->_session->setParameter("_reader_flag", $reader_flag); + } + + $mobileCheck =& MobileCheck::getInstance(); + if ($mobileCheck->isMobile() == _OFF) { return; } + $mobile_info = $mobileCheck->getMobileInfo(); + $mobile_obj = $this->_modulesView->getModuleByDirname("mobile"); + + $configView =& $this->_container->getComponent("configView"); + $config = $configView->getConfig($mobile_obj["module_id"], false); + if ($config == false) { return; } + if ($config["allow_emulator"]["conf_value"] == _OFF && !$mobile_info["proper_route"]) { return; } + + // この人物が携帯をどのようなモードで見ようとしているかを取得 + $texthtml_mode = -1; + $imgdsp_size = -1; + $user_id = $this->_session->getParameter("_user_id"); + if( $user_id != '0' ) { + $texthtml_mode_item_id = $this->_usersView->getItemIdByTagName( "mobile_texthtml_mode" ); + $imgdsp_size_item_id = $this->_usersView->getItemIdByTagName( "mobile_imgdsp_size" ); + $user_items = $this->_usersView->getUserItemLinkById( $user_id ); + if( isset( $user_items[ $texthtml_mode_item_id ] ) && $user_items[ $texthtml_mode_item_id ]['content'] != "" ) { + $texthtml_mode = constant( str_replace( "USER_ITEM", "MOBILE", trim( $user_items[ $texthtml_mode_item_id ]['content'], "|" ) ) ); + } + if( isset( $user_items[ $imgdsp_size_item_id ] ) && $user_items[ $imgdsp_size_item_id ]['content'] != "" ) { + $imgdsp_size = constant( str_replace( "USER_ITEM", "MOBILE", trim( $user_items[ $imgdsp_size_item_id ]['content'], "|" ) ) ); + } + } + if( $texthtml_mode == -1 ) { + $texthtml_mode = $config["mobile_text_html_mode"]["conf_value"]; + } + if( $imgdsp_size == -1 ) { + $imgdsp_size = $config["mobile_imgdsp_size"]["conf_value"]; + } + $this->_session->setParameter("_mobile_text_html_mode", $texthtml_mode); + $this->_session->setParameter("_mobile_imgdsp_size", $imgdsp_size); + + $this->_session->setParameter("_mobile_info", $mobile_info); + $this->_session->setParameter("_mobile_flag", _ON); + if($mobileCheck->isSmartPhone() == true) { + $this->_session->setParameter('_smartphone_flag', _ON); + } + + $action_name = $this->_request->getParameter("action"); + $page_id = intval($this->_request->getParameter("page_id")); + $room_id = intval($this->_request->getParameter("room_id")); + if (!isset($page_id)) { + $page_id = intval($this->_session->getParameter("_mobile_page_id")); + } + $room_id = $this->_request->getParameter("room_id"); + if (!isset($room_id)) { + $room_id = intval($this->_session->getParameter("_mobile_room_id")); + } + $block_id = intval($this->_request->getParameter("block_id")); + + + $mobileView =& $this->_container->getComponent("mobileView"); + $getdata =& $this->_container->getComponent("GetData"); + + $mobile_modules = $mobileView->getModules(null, array($this,"_callbackFunc")); + $getdata->setParameter("mobile_modules", $mobile_modules); + + $active_action = $this->_request->getParameter("active_action"); + if ($active_action != "") { + $params = $this->_request->getParameters(); + + $this->_request->setParameter("action", $active_action); + $this->_request->setParameter("active_action", null); + $this->_request->setParameter(_ABBREVIATE_URL_REQUEST_KEY, null); + + $params = $this->_request->getParameters(); + $str_params = ""; + foreach($params as $key => $value) { + if (empty($value) || is_array($value)) { continue; } + if (substr($key, 0, 1) == "_") { continue; } + + $key = htmlspecialchars($key, ENT_QUOTES); + if ($key == session_name()) { + $value = session_id(); + } else { + $value = rawurlencode($value); + } + $str_params .= "&" . $key."=".$value; + } + + if ($this->_session->getParameter("_user_id") == "" && $block_id > 0) { + $blocksView =& $this->_container->getComponent("blocksView"); + $blocks = $blocksView->getBlockById($block_id); + if (empty($blocks)) { + header('Location: '.BASE_URL.INDEX_FILE_NAME); + exit; + } + + $authCheck =& $this->_container->getComponent("authCheck"); + $result = $authCheck->getPageAuthId(null, $blocks["page_id"]); + if ($result == _AUTH_OTHER) { + if ($reader_flag == _ON) { + $session_param = ""; + } else { + $session_param = "&".session_name()."=".session_id(); + } + $this->_session->setParameter("_mobile_redirect_url", $str_params); + header('Location: '.BASE_URL.INDEX_FILE_NAME."?".ACTION_KEY."=".$mobile_modules[_DISPLAY_POSITION_HEADER]["login"]["mobile_action_name"].$session_param); + exit; + } + } + + $this->_session->removeParameter("_mobile_redirect_url"); + header('Location: '.BASE_URL.INDEX_FILE_NAME."?".substr($str_params, 1)); + exit; + + } elseif ($action_name == DEFAULT_ACTION) { + $parameters = (!empty($page_id) ? "&page_id=".$page_id."&room_id=".intval($room_id) : "").(!empty($block_id) ? "&block_id=".$block_id : ""); + if ($reader_flag == _OFF) { + $parameters .= "&".session_name()."=".session_id(); + } + $action_name = DEFAULT_MOBILE_ACTION; + if (!empty($block_id)) { + $blocksView =& $this->_container->getComponent("blocksView"); + $modulesView =& $this->_container->getComponent("modulesView"); + $blocks = $blocksView->getBlockById($block_id); + if (!empty($blocks)) { + $modules = $modulesView->getModulesById($blocks["module_id"]); + if (!empty($modules)) { + $action_name = $modules["action_name"]; + } + } + } + header('Location: '.BASE_URL.INDEX_FILE_NAME."?".ACTION_KEY."=".$action_name.$parameters); + exit; + } + + $this->_session->setParameter("_mobile_default_module", $config["default_module"]["conf_value"]); + + /* + * リクエストの変換 + */ + $action =& $this->_actionChain->getCurAction(); + $attributes = $this->getAttributes(); + //if (empty($attributes)) { return; } + + $params = $this->_request->getParameters(); + $this->_strtoconvert($params); + $this->_request->clear(); + $this->_request->setParameters($params); + + foreach ($attributes as $key=>$value) { + $keyArr = explode(":", $key); + $parameter = null; + if ($keyArr[0] == "date" || $keyArr[0] == "input_date" || $keyArr[0] == "time" || $keyArr[0] == "time12" || $keyArr[0] == "full_date" || $keyArr[0] == "full_time") { + $valArr = explode(",", $keyArr[1]); + if (($keyArr[0] == "date" || $keyArr[0] == "input_date") && count($valArr) == 3 || + $keyArr[0] == "time" && count($valArr) <= 3 || + $keyArr[0] == "time12" && count($valArr) > 0 && count($valArr) <= 4 && (strtolower($valArr[0]) == "am" || strtolower($valArr[0]) == "pm") || + ($keyArr[0] == "full_date" || $keyArr[0] == "full_time") && count($valArr) == 6) { + + foreach ($valArr as $i=>$val) { + $valArr[$i] = $this->_request->getParameter($val); + } + if ($keyArr[0] == "date") { + list($month, $day, $year) = $valArr; + list($hour, $min, $sec) = array(0,0,0); + } elseif ($keyArr[0] == "input_date") { + list($month, $day, $year) = $valArr; + list($hour, $min, $sec) = array(0,0,0); + } elseif ($keyArr[0] == "time") { + list($month, $day, $year) = array(date("m"), date("d"), date("Y")); + if (count($valArr) < 1) { $valArr[0] = 0; } + if (count($valArr) < 2) { $valArr[1] = 0; } + if (count($valArr) < 3) { $valArr[2] = 0; } + list($hour, $min, $sec) = $valArr; + } elseif ($keyArr[0] == "time12") { + list($month, $day, $year) = array(date("m"), date("d"), date("Y")); + if (count($valArr) < 2) { $valArr[1] = 0; } + if (count($valArr) < 3) { $valArr[2] = 0; } + if (count($valArr) < 4) { $valArr[3] = 0; } + list($am_pm, $hour, $min, $sec) = $valArr; + if (strtolower($am_pm) == "pm") { + $hour = intval($hour) + 12; + } + } else { + list($hour, $min, $sec, $month, $day, $year) = $valArr; + } + if ($keyArr[0] == "time" || $keyArr[0] == "time12" || $keyArr[0] != "time" && $keyArr[0] != "time12" && checkdate(intval($month),intval($day),intval($year))) { + if ($keyArr[0] == "date" && empty($keyArr[2])) { $keyArr[2] = _DATE_FORMAT; } + if ($keyArr[0] == "input_date" && empty($keyArr[2])) { $keyArr[2] = _INPUT_DATE_FORMAT; } + if (($keyArr[0] == "time" || $keyArr[0] == "time12") && empty($keyArr[2])) { $keyArr[2] = _TIME_FORMAT; } + if (($keyArr[0] == "full_date" || $keyArr[0] == "full_time") && empty($keyArr[2])) { $keyArr[2] = _FULL_DATE_FORMAT; } + $parameter = date($keyArr[2], mktime(intval($hour), intval($min), intval($sec), intval($month), intval($day), intval($year))); + $this->_request->setParameter($value, $parameter); + continue; + } else { + $paramArr = explode(",", $keyArr[1]); + } + } else { + $paramArr = explode(",", $keyArr[1]); + } + } else { + $paramArr = explode(",", $key); + } + foreach ($paramArr as $i=>$keyVal) { + $str = $this->_request->getParameter($keyVal); + if (!isset($str)) { continue; } + $parameter .= $str; + } + if (!isset($parameter)) { continue; } + $this->_request->setParameter($value, $parameter); + } + + } + /** + * 携帯モジュール取得 + * + * @access private + */ + function _callbackFunc(&$recordSet) + { + $result = array(); + while ($row = $recordSet->fetchRow()) { + $pathList = explode("_", $row["mobile_action_name"]); + $row["dir_name"] = $pathList[0]; + $row["module_name"] = $this->_modulesView->loadModuleName($row["dir_name"]); + $result[$row["display_position"]][$row["dir_name"]] = $row; + } + return $result; + } + /** + * 携帯モジュール取得 + * + * @access private + */ + function _strtoconvert(&$params) + { + foreach (array_keys($params) as $key) { + if (is_array($params[$key])) { + $this->_strtoconvert($params[$key]); + } else { + $params[$key] = mb_convert_encoding($params[$key], "utf-8", "auto"); + } + } + } + + /** + * ポストフィルタ + * + * @access private + */ + function _postFilter() + { + //if (!$this->_mobile_obj) { return true; } + + $tel_id = $this->_session->getParameter("_mobile_tel_id"); + if (!empty($tel_id)) { + $user_id = $this->_session->getParameter("_user_id"); + $result = $this->_db->updateExecute("mobile_users", array(), array("user_id"=>$user_id), true); + if ($result === false) { + return false; + } + + if (rand(0, 10) != 0) { + $maxlifetime = $this->_session->getParameter('_session_gc_maxlifetime'); + $time = timezone_date(); + $timestamp = mktime(intval(substr($time,8,2)),intval(substr($time,10,2))-$maxlifetime,intval(substr($time,12,2)), + intval(substr($time,4,2)),intval(substr($time,6,2)),intval(substr($time,0,4))); + $sql = "DELETE FROM {mobile_users} WHERE update_time < ?"; + $result = $this->_db->execute($sql, array("update_time"=>date("YmdHis", $timestamp))); + if ($result === false) { + $this->_db->addError(); + return false; + } + } + } + + $page_id = intval($this->_request->getParameter("page_id")); + if ($page_id > 0) { + $this->_session->setParameter("_mobile_page_id", $page_id); + } + $room_id = intval($this->_request->getParameter("room_id")); + if ($room_id > 0) { + $this->_session->setParameter("_mobile_room_id", $room_id); + } + $module_id = intval($this->_request->getParameter("module_id")); + if ($module_id > 0) { + $this->_session->setParameter("_mobile_module_id", $module_id); + } + } +} +?> diff --git a/html/maple/nccore/common_func.php b/html/maple/nccore/common_func.php index a20d94c..884ab95 100644 --- a/html/maple/nccore/common_func.php +++ b/html/maple/nccore/common_func.php @@ -198,6 +198,15 @@ function wysiwig_convert_url($str) { } else { $str = preg_replace("/".sprintf(_WYSIWYG_CONVERT_OUTER, 'BASE_URL')."/iu", BASE_URL, $str); } + + $container =& DIContainerFactory::getContainer(); + $session =& $container->getComponent('Session'); + $isSmartphone = $session->getParameter('_smartphone_flag'); + if ($isSmartphone) { + $str = preg_replace('/()/iU', '\\1 onclick="$.mobile.silentScroll(0);"\\3', $str); + $str = preg_replace('/()/iU', '\\1\\3\\4', $str); + } + return $str; } diff --git a/html/webapp/components/mobile/View.class.php b/html/webapp/components/mobile/View.class.php index b50eaea..e0709c1 100644 --- a/html/webapp/components/mobile/View.class.php +++ b/html/webapp/components/mobile/View.class.php @@ -88,6 +88,8 @@ function _callbackBlockByPage(&$recordSet) { $result = array(); $i = 0; + $this->_session->setParameter('mobileDisplayTextHtml', _OFF); + $isSmartphone = $this->_session->getParameter('_smartphone_flag'); while ($row = $recordSet->fetchRow()) { if( !is_null( $row['display_position'] ) && $row['display_position'] != _DISPLAY_POSITION_CENTER ) { continue; @@ -99,6 +101,13 @@ function _callbackBlockByPage(&$recordSet) $row["module_name"] = $this->_modulesView->loadModuleName($row["dir_name"]); } + if (!$isSmartphone + && !empty($row['module_id']) + && empty($row['block_name']) + && !empty($row['content'])) { + $this->_session->setParameter('mobileDisplayTextHtml', _ON); + } + $result[ $row['parent_id'] ][ $row['block_id'] ] = $row; } return $result; @@ -493,7 +502,7 @@ function &_fetchPageTree(&$recordSet, &$params) } foreach ($mobileModuleChecks as $childPage) { if ($childPage['mobileModule'] - || $childPage['visible']) { + && $childPage['visible']) { $pageTree[$parentID][$mobileModuleCheckParentId]['mobileModule'] = true; break; } diff --git a/html/webapp/components/uploads/View.class.php b/html/webapp/components/uploads/View.class.php index 6e10f42..b58970e 100644 --- a/html/webapp/components/uploads/View.class.php +++ b/html/webapp/components/uploads/View.class.php @@ -1,584 +1,590 @@ -_container =& DIContainerFactory::getContainer(); - $this->_db =& $this->_container->getComponent("DbObject"); - } - - /** - * アップロードIDからアップロードオブジェクトを取得 - * @param int upload_id - * @return array uploads_object - * @access public - */ - function getUploadById($id) { - $params = array( - "upload_id" => $id - ); - $sql = "SELECT * FROM {uploads}" . - " WHERE {uploads}.upload_id = ?" . - " "; - $result = $this->_db->execute($sql,$params); - if($result === false) { - //エラーが発生した場合、エラーリストに追加 - $db->addError(); - return false; - } - if(isset($result[0])) - return $result; - else - return null; - } - - /** - * モジュールIDからアップロードオブジェクトを取得 - * @param int module_id - * @return array uploads_object - * @access public - */ - function getUploadByModuleid($module_id) { - $params = array( - "module_id" => $module_id - ); - $sql = "SELECT * FROM {uploads}" . - " WHERE {uploads}.module_id = ?" . - " "; - $result = $this->_db->execute($sql,$params); - if($result === false) { - //エラーが発生した場合、エラーリストに追加 - $db->addError(); - return false; - } - if(isset($result[0])) - return $result; - else - return null; - } - - - /** - * 画像表示できるかどうかのチェック - * @param int $upload_id - * @param int $show_auth_id 見ることができるルーム権限(主担以上など) - * @param int $thumbnail_flag 1 or 0 サムネイル表示するかどうか - * @param string $action_name - * @return array(string pathname, string file_name) - * @access public - */ - function downloadCheck($upload_id, $show_auth_id = null, $thumbnail_flag = 0, $action_name = null, $force_resize=null) { - $pathname = null; - $file_name = null; - $session =& $this->_container->getComponent("Session"); - $pagesView =& $this->_container->getComponent("pagesView"); - $actionChain =& $this->_container->getComponent("ActionChain"); - $action_name = isset($action_name) ? $action_name : $actionChain->getCurActionName(); - $user_id = $session->getParameter("_user_id"); - $physical_file_name = null; - $cache_flag = false; - $space_type = _SPACE_TYPE_GROUP; - - // add by AllCreator 2010.10.13 - $mobile_imgdsp_size = 0; - $needThumb = false; - $mobile_flag = $session->getParameter( "_mobile_flag" ); - if( $mobile_flag == _ON ) { - $mobile_imgdsp_size = $session->getParameter( "_mobile_imgdsp_size" ); - } - - - if( $force_resize === null ) { - if( $mobile_imgdsp_size != 0 ) { - $resize_spec = array( $mobile_imgdsp_size, 0 ); - } - else { - $resize_spec = 0; - } - } - else if( $force_resize === 0 ) { - $resize_spec = 0; - } - else { - $resize_spec = $force_resize; - } - - - if($upload_id != null) { - //権限チェック - $uploads_obj = $this->getUploadById($upload_id); - if(is_array($uploads_obj)) { - foreach($uploads_obj as $upload_obj) { // Loop, but here is only one data - - if( is_array($resize_spec) ) { - $needThumb = $this->_needThumb( $upload_obj, $resize_spec ); - } - // - // ActionNameチェック - // - if($action_name != $upload_obj['action_name']) { - break; - } - - $room_id = $upload_obj['room_id']; - $file_name = $upload_obj['file_name']; - - // thumbnail_flagを最優先で見ることにした AllCreator 2010.10.13 - if($thumbnail_flag) { - $physical_file_name = $upload_obj['upload_id']."_thumbnail.".$upload_obj['extension']; - //$normal_physical_file_name = $upload_obj['physical_file_name']; - } - else if( $force_resize !== null && $needThumb==true ) { - $physical_file_name = $upload_obj['upload_id']."_resize_".$resize_spec[0]."_".$resize_spec[1].".".$upload_obj['extension']; - } - // mod by AllCreator 2010.10.13 - else if( $mobile_imgdsp_size!=0 && $needThumb==true ) { - $physical_file_name = $upload_obj['upload_id']."_mobile_".$mobile_imgdsp_size.".".$upload_obj['extension']; - } - else { - $physical_file_name = $upload_obj['physical_file_name']; - } - if($room_id == 0) { - //room_id=0ならば、誰でも閲覧可能 - $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; - $cache_flag = true; - break; - } else { - $page =& $pagesView->getPageById($room_id); - if(isset($page)) { - $space_type = $page['space_type']; - if($space_type == _SPACE_TYPE_PUBLIC) { - // - //パブリックスペース - // - $auth_id = isset($page['authority_id']) ? $page['authority_id'] : $session->getParameter("_default_entry_auth_public"); - if($show_auth_id != null && $show_auth_id > $auth_id) { - // 見せれる権限より小さい - break; - } - $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; - $cache_flag = true; - break; - } else if($space_type == _SPACE_TYPE_GROUP && $page['private_flag'] == _ON) { - // - // プライベートスペース - // - $cache_flag = ($page['default_entry_flag'] == _ON) ? true : false; - - $err_flag = false; - switch($session->getParameter("_open_private_space")) { - case _OPEN_PRIVATE_SPACE_GROUP: - $err_flag = ($user_id != "0") ? false : true; - break; - case _OPEN_PRIVATE_SPACE_PUBLIC: - break; - case _OPEN_PRIVATE_SPACE_MYPORTAL_GROUP: - $err_flag = (($user_id != "0" && $page['default_entry_flag'] == _ON) || $user_id == $upload_obj['update_user_id']) ? false : true; - break; - case _OPEN_PRIVATE_SPACE_MYPORTAL_PUBLIC: - $err_flag = (($page['default_entry_flag'] == _ON) || $user_id == $upload_obj['update_user_id']) ? false : true; - break; - default: - $err_flag = ($user_id == $upload_obj['update_user_id']) ? false : true; - } - if($err_flag) break; - - $auth_id = isset($page['authority_id']) ? $page['authority_id'] : _AUTH_OTHER; - if($show_auth_id != null && $show_auth_id > $auth_id) { - // 見せれる権限より小さい - break; - } - - $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; - break; - } else if($space_type == _SPACE_TYPE_GROUP && $page['default_entry_flag'] == _ON) { - // - //グループスペース(すべての会員にデフォルトで参加させる) - // - $auth_id = isset($page['authority_id']) ? $page['authority_id'] : $session->getParameter("_default_entry_auth_group"); - if($show_auth_id != null && $show_auth_id > $auth_id) { - // 見せれる権限より小さい - break; - } - if($user_id != "0" && $auth_id != _AUTH_OTHER) { - $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; - break; - } - } else if($space_type == _SPACE_TYPE_GROUP) { - // - //グループスペース - // - $auth_id = isset($page['authority_id']) ? $page['authority_id'] : _AUTH_OTHER; - if($show_auth_id != null && $show_auth_id > $auth_id) { - // 見せれる権限より小さい - break; - } - if($auth_id == _AUTH_OTHER) { - break; - } - //if($auth_id != 0) { - $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; - break; - //} - } - } - } - } - } - } - // Thumbnail 最優先 - if($thumbnail_flag && !file_exists($pathname.$physical_file_name)) { - // - // common/avatar_thumbnail.gifを使用 - // - $pathname = MODULE_DIR."/common/files/images/"; - $physical_file_name = "thumbnail.gif"; - } - // add by AllCreator 2010.10.13 - if( $resize_spec!=0 && $needThumb==true && !file_exists($pathname.$physical_file_name) ) { - include_once MAPLE_DIR . '/core/FileUpload.class.php'; - $fileUpload =& new FileUpload; - $result = $fileUpload->resize( $pathname.$upload_obj['physical_file_name'], $resize_spec[0], $resize_spec[1], $pathname.$physical_file_name); - if( $result == false ) { - $physical_file_name = $upload_obj['physical_file_name']; - } - } - return array($pathname, $file_name, $physical_file_name, $cache_flag); - } - - /** - * モバイル用サムネイルを取得すべきアップロード画像か - * @param int mobile_imgdsp_size - * @param array uploadsObj - * @access public - * @return false:no_need true:need - */ - function _needThumb( $uploadsObj, $resize_spec ) - { - // 無条件にオリジナル画像が欲しいという指示だったら - if( $resize_spec == 0 ) { - return false; // そのままでいいという判断を返す - } - - //拡張子はgif,png,jpgのみ受け付ける - switch( strtolower($uploadsObj['extension']) ) { - case 'jpg': - case 'png': - case 'gif': - break; - default: - return false; - } - //実サイズが希望サイズを超えているか - $file_path = FILEUPLOADS_DIR . "/" . $uploadsObj['file_path'] . "/" . $uploadsObj['physical_file_name']; - $dimension = @getimagesize($file_path); - if ($dimension === false) { - return false; - } - if( $dimension[0] > $resize_spec[0] || $dimension[1] > $resize_spec[1] ) { - return true; - } - return false; - } - - /** - * ヘッダー出力 - * @param string pathname - * @param string filename - * @access public - */ - function headerOutput($pathname, $filename, $physical_file_name = null, $cache_flag = false) { - if($physical_file_name == null) $physical_file_name = $filename; - $pathname = $pathname.$physical_file_name; //urlencode($filename); - if ($pathname != null && file_exists($pathname)) { - $mimetype = $this->mimeinfo("type", $filename); - if($this->_headerOutput($filename, $pathname, filesize($pathname), $mimetype, $cache_flag) == "200") { - readfile($pathname); - }else{ - exit; - } - } else { - header("HTTP/1.0 404 not found"); - } - } - - function _headerOutput($filename, $pathname, $filesize, $mimetype, $cache_flag = false) { - $status_code = "200"; - $etag = null; - - if (!isset($_SERVER['HTTP_USER_AGENT'])) { - //HTTP_USER_AGENTがない場合、 - header("Content-disposition: inline; filename=\"".$filename."\""); - } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { - // IEの場合 - header("Content-disposition: inline; filename=\"".mb_convert_encoding($filename, "SJIS", _CHARSET)."\""); - } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "Opera")) { - // Operaの場合 - header("Content-disposition: attachment; filename=\"".$filename."\""); - } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "Firefox")) { - // FireFoxの場合 - if ($mimetype == "application/x-shockwave-flash") { - header("Content-disposition: inline; filename=\"".$filename."\""); - } else { - header("Content-disposition: attachment; filename=\"".$filename."\""); - } - } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "Chrome")) { - // GoogleChromeの場合 - if (stristr($_SERVER['HTTP_USER_AGENT'], "Windows")) { - // Windows版 - header("Content-disposition: inline; filename=\"".mb_convert_encoding($filename, "SJIS", _CHARSET)."\""); - } else { - // それ以外 - header("Content-disposition: inline; filename=\"".$filename."\""); - } - } else { - // 上記以外(Mozilla, Firefox, NetScape) - header("Content-disposition: inline; filename=\"".$filename."\""); - } - if(!empty($pathname)) { - $stats = stat( $pathname ); - $etag = sprintf( '"%x-%x-%x"', $stats['ino'], $stats['size'], $stats['mtime'] ); - header('Etag: '.$etag); - } - - //header("Content-disposition: inline; filename=\"".$filename."\""); - // パブリックの画像ならばキャッシュを取るように修正 - if($cache_flag == true) { - // 1Week - header("Cache-Control: max-age=604800, public"); - header('Pragma: cache'); //no-cache以外の文字列をセット - $offset = 60 * 60 * 24 * 7; // 1Week - header('Expires: '.gmdate('D, d M Y H:i:s', time() + $offset).' GMT'); - if (isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && - stripcslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) == $etag ) { - header( 'HTTP/1.1 304 Not Modified' ); - $status_code = "304"; - } - //} else if (isset($_SERVER['HTTPS']) && stristr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { - // // IE + サイト全体SSLの場合、ダウンロードが正常に行われない。 - // // ダウンロードさせるためには、以下コメントをはずす必要があるが、 - // // アップロードした画像ファイル等をローカルキャッシュにとられてしまう弊害がある。 - // // 1Week - // header("Cache-Control: max-age=604800, public"); - // header('Pragma: cache'); //no-cache以外の文字列をセット - // $offset = 60 * 60 * 24 * 7; // 1Week - // header('Expires: '.gmdate('D, d M Y H:i:s', time() + $offset).' GMT'); - } else { - header("Cache-Control: no-store, no-cache, must-revalidate"); - header("Pragma: no-cache"); - } - //header("Cache-Control: public");//キャッシュを有効にする設定(private or public) - - header("Content-length: ".$filesize); - header("Content-type: ".$mimetype); - return $status_code; - - //header("Content-type: application/force-download"); - //header("Content-type: ForceType application/octet-stream"); - //header("Content-type: AddType application/octet-stream"); - //header("Content-type: application/octet-stream"); - } - - /** - * PHPで作られたファイルダウンロードメソッド - * @param string $data - * @param string $filename (hogehoge.csv等) - * @param string $mime_type (document/unknown等) - * @access public - */ - function download($data, $filename, $mimetype = null) { - if($mimetype == null) { - $mimetype = $this->mimeinfo("type", $filename); - } - $this->_headerOutput($filename, null, strlen($data), $mimetype); - - echo $data; - } - - /** - * Mimeタイプ取得 - * @param int key(type or icon) - * @return string mime_type - * @access public - */ - function mimeinfo($key, $filename) { - $mimeinfo = array ( - "xxx" => array ("type"=>"document/unknown", "icon"=>"unknown.gif"), - "3gp" => array ("type"=>"video/quicktime", "icon"=>"video.gif"), - "ai" => array ("type"=>"application/postscript", "icon"=>"image.gif"), - "aif" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"), - "aiff" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"), - "aifc" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"), - "applescript" => array ("type"=>"text/plain", "icon"=>"text.gif"), - "asc" => array ("type"=>"text/plain", "icon"=>"text.gif"), - "au" => array ("type"=>"audio/au", "icon"=>"audio.gif"), - "avi" => array ("type"=>"video/x-ms-wm", "icon"=>"avi.gif"), - "bmp" => array ("type"=>"image/bmp", "icon"=>"image.gif"), - "cs" => array ("type"=>"application/x-csh", "icon"=>"text.gif"), - "css" => array ("type"=>"text/css", "icon"=>"text.gif"), - "csv" => array ("type"=>"text/plain", "icon"=>"csv.gif"), - "dv" => array ("type"=>"video/x-dv", "icon"=>"video.gif"), - "doc" => array ("type"=>"application/msword", "icon"=>"word.gif"), - "docx" => array ("type"=>"application/vnd.openxmlformats-officedocument.wordprocessingml.document", "icon"=>"word.gif"), - "dif" => array ("type"=>"video/x-dv", "icon"=>"video.gif"), - "eps" => array ("type"=>"application/postscript", "icon"=>"pdf.gif"), - "gif" => array ("type"=>"image/gif", "icon"=>"image.gif"), - "gtar" => array ("type"=>"application/x-gtar", "icon"=>"zip.gif"), - "gz" => array ("type"=>"application/g-zip", "icon"=>"zip.gif"), - "gzip" => array ("type"=>"application/g-zip", "icon"=>"zip.gif"), - "h" => array ("type"=>"text/plain", "icon"=>"text.gif"), - "hqx" => array ("type"=>"application/mac-binhex40", "icon"=>"zip.gif"), - "html" => array ("type"=>"text/html", "icon"=>"html.gif"), - "htm" => array ("type"=>"text/html", "icon"=>"html.gif"), - "jpe" => array ("type"=>"image/jpeg", "icon"=>"image.gif"), - "jpeg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"), - "jpg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"), - "js" => array ("type"=>"application/x-javascript", "icon"=>"text.gif"), - "latex"=> array ("type"=>"application/x-latex", "icon"=>"text.gif"), - "m" => array ("type"=>"text/plain", "icon"=>"text.gif"), - "flv" => array ("type"=>"video/x-flv", "icon"=>"video.gif"), - "mov" => array ("type"=>"video/quicktime", "icon"=>"video.gif"), - "movie"=> array ("type"=>"video/x-sgi-movie", "icon"=>"video.gif"), - "m3u" => array ("type"=>"audio/x-mpegurl", "icon"=>"audio.gif"), - "mp3" => array ("type"=>"audio/mp3", "icon"=>"audio.gif"), - "mp4" => array ("type"=>"video/mp4", "icon"=>"video.gif"), - "mpeg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"), - "mpe" => array ("type"=>"video/mpeg", "icon"=>"video.gif"), - "mpg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"), - "pct" => array ("type"=>"image/pict", "icon"=>"image.gif"), - "pdf" => array ("type"=>"application/pdf", "icon"=>"pdf.gif"), - "php" => array ("type"=>"text/plain", "icon"=>"text.gif"), - "pic" => array ("type"=>"image/pict", "icon"=>"image.gif"), - "pict" => array ("type"=>"image/pict", "icon"=>"image.gif"), - "png" => array ("type"=>"image/png", "icon"=>"image.gif"), - "pps" => array ("type"=>"application/vnd.ms-powerpoint", "icon"=>"powerpoint.gif"), - "ppt" => array ("type"=>"application/vnd.ms-powerpoint", "icon"=>"powerpoint.gif"), - "pptx" => array ("type"=>"application/vnd.openxmlformats-officedocument.presentationml.presentation", "icon"=>"powerpoint.gif"), - "ps" => array ("type"=>"application/postscript", "icon"=>"pdf.gif"), - "qt" => array ("type"=>"video/quicktime", "icon"=>"video.gif"), - "ra" => array ("type"=>"audio/x-realaudio", "icon"=>"audio.gif"), - "ram" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"), - "rm" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"), - "rtf" => array ("type"=>"text/rtf", "icon"=>"text.gif"), - "rtx" => array ("type"=>"text/richtext", "icon"=>"text.gif"), - "sh" => array ("type"=>"application/x-sh", "icon"=>"text.gif"), - "sit" => array ("type"=>"application/x-stuffit", "icon"=>"zip.gif"), - "smi" => array ("type"=>"application/smil", "icon"=>"text.gif"), - "smil" => array ("type"=>"application/smil", "icon"=>"text.gif"), - "swf" => array ("type"=>"application/x-shockwave-flash", "icon"=>"flash.gif"), - "tar" => array ("type"=>"application/x-tar", "icon"=>"zip.gif"), - "tgz" => array ("type"=>"application/x-tar", "icon"=>"zip.gif"), - "tif" => array ("type"=>"image/tiff", "icon"=>"image.gif"), - "tiff" => array ("type"=>"image/tiff", "icon"=>"image.gif"), - "tex" => array ("type"=>"application/x-tex", "icon"=>"text.gif"), - "texi" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"), - "texinfo" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"), - "tsv" => array ("type"=>"text/tab-separated-values", "icon"=>"text.gif"), - "txt" => array ("type"=>"text/plain", "icon"=>"text.gif"), - "wav" => array ("type"=>"audio/wav", "icon"=>"audio.gif"), - "wmv" => array ("type"=>"video/x-ms-wmv", "icon"=>"avi.gif"), - "asf" => array ("type"=>"video/x-ms-asf", "icon"=>"avi.gif"), - "xls" => array ("type"=>"application/vnd.ms-excel", "icon"=>"excel.gif"), - "xlsx" => array ("type"=>"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "icon"=>"excel.gif"), - "xml" => array ("type"=>"text/xml", "icon"=>"xml.gif"), - "xsl" => array ("type"=>"text/xml", "icon"=>"xml.gif"), - "zip" => array ("type"=>"application/zip", "icon"=>"zip.gif"), - "tex" => array ("type"=>"application/x-tex", "icon"=>"text.gif"), - "dvi" => array ("type"=>"application/x-dvi", "icon"=>"text.gif"), - "ps" => array ("type"=>"application/postscript", "icon"=>"text.gif"), - "ics" => array ("type"=>"application/octet-stream", "icon"=>"outlook.gif"), - "jtd" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "jbw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "jtt" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "jfw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "jvw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "juw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "jaw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "jtw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "jsw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "jxw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), - "odt" => array ("type"=>"application/vnd.oasis.opendocument.text", "icon"=>"unknown.gif"), - "odg" => array ("type"=>"application/vnd.oasis.opendocument.graphic", "icon"=>"unknown.gif"), - "ods" => array ("type"=>"application/vnd.oasis.opendocument.spreadsheet", "icon"=>"unknown.gif"), - "odp" => array ("type"=>"application/vnd.oasis.opendocument.presentation", "icon"=>"unknown.gif"), - "odb" => array ("type"=>"application/vnd.oasis.opendocument.database", "icon"=>"unknown.gif"), - "odf" => array ("type"=>"application/vnd.oasis.opendocument.formula", "icon"=>"unknown.gif") - ); - - if (eregi("\.([a-z0-9]+)$", $filename, $match)) { - if(isset($mimeinfo[strtolower($match[1])][$key])) { - return $mimeinfo[strtolower($match[1])][$key]; - } else { - return $mimeinfo["xxx"][$key]; // By default - } - } else { - return $mimeinfo["xxx"][$key]; // By default - } - } - - /** - * 指定された拡張子になっているか? - * - * @param string $file_name - * @param string $allow_extension 拡張子文字列(「,」区切りで複数指定可) - *  指定しない場合、configのallow_extensionの中にあるかどうかのチェック - * @return array pathInfo or false - * @access public - */ - function checkExtension($file_name, $allow_extension = null) - { - $pathinfo = pathinfo($file_name); - if(isset($pathinfo['extension'])) { - $extension_str = strtolower($pathinfo['extension']); - } else { - $extension_str = ""; - } - - if($allow_extension == null) { - $configView =& $this->_container->getComponent("configView"); - $config = $configView->getConfigByConfname(_SYS_CONF_MODID, "allow_extension"); - if(!isset($config["conf_value"])) { - return false; - } - $allow_extension = $config["conf_value"]; - } - - if($allow_extension != "") { - $extensionArray = explode(",", strtolower($allow_extension)); - if(!in_array($extension_str, $extensionArray)) { - return false; - } - } - // - // tar.gzの対応 - // tar.gzのほかにも同じような拡張子があるかも - // - if(preg_match("/.+\.tar\.gz$/i", $file_name)) { - $pathinfo['extension'] = "tar.gz"; - } - return $pathinfo; - } -} -?> +_container =& DIContainerFactory::getContainer(); + $this->_db =& $this->_container->getComponent("DbObject"); + } + + /** + * アップロードIDからアップロードオブジェクトを取得 + * @param int upload_id + * @return array uploads_object + * @access public + */ + function getUploadById($id) { + $params = array( + "upload_id" => $id + ); + $sql = "SELECT * FROM {uploads}" . + " WHERE {uploads}.upload_id = ?" . + " "; + $result = $this->_db->execute($sql,$params); + if($result === false) { + //エラーが発生した場合、エラーリストに追加 + $db->addError(); + return false; + } + if(isset($result[0])) + return $result; + else + return null; + } + + /** + * モジュールIDからアップロードオブジェクトを取得 + * @param int module_id + * @return array uploads_object + * @access public + */ + function getUploadByModuleid($module_id) { + $params = array( + "module_id" => $module_id + ); + $sql = "SELECT * FROM {uploads}" . + " WHERE {uploads}.module_id = ?" . + " "; + $result = $this->_db->execute($sql,$params); + if($result === false) { + //エラーが発生した場合、エラーリストに追加 + $db->addError(); + return false; + } + if(isset($result[0])) + return $result; + else + return null; + } + + + /** + * 画像表示できるかどうかのチェック + * @param int $upload_id + * @param int $show_auth_id 見ることができるルーム権限(主担以上など) + * @param int $thumbnail_flag 1 or 0 サムネイル表示するかどうか + * @param string $action_name + * @return array(string pathname, string file_name) + * @access public + */ + function downloadCheck($upload_id, $show_auth_id = null, $thumbnail_flag = 0, $action_name = null, $force_resize=null) { + $pathname = null; + $file_name = null; + $session =& $this->_container->getComponent("Session"); + $pagesView =& $this->_container->getComponent("pagesView"); + $actionChain =& $this->_container->getComponent("ActionChain"); + $action_name = isset($action_name) ? $action_name : $actionChain->getCurActionName(); + $user_id = $session->getParameter("_user_id"); + $physical_file_name = null; + $cache_flag = false; + $space_type = _SPACE_TYPE_GROUP; + + // add by AllCreator 2010.10.13 + $mobile_imgdsp_size = 0; + $needThumb = false; + $mobile_flag = $session->getParameter( "_mobile_flag" ); + if( $mobile_flag == _ON ) { + $mobile_imgdsp_size = $session->getParameter( "_mobile_imgdsp_size" ); + } + + + if( $force_resize === null ) { + if( $mobile_imgdsp_size != 0 ) { + $resize_spec = array( $mobile_imgdsp_size, 0 ); + } + else { + $resize_spec = 0; + } + } + else if( $force_resize === 0 ) { + $resize_spec = 0; + } + else { + $resize_spec = $force_resize; + } + + + if($upload_id != null) { + //権限チェック + $uploads_obj = $this->getUploadById($upload_id); + if(is_array($uploads_obj)) { + foreach($uploads_obj as $upload_obj) { // Loop, but here is only one data + + if( is_array($resize_spec) ) { + $needThumb = $this->_needThumb( $upload_obj, $resize_spec ); + } + // + // ActionNameチェック + // + if($action_name != $upload_obj['action_name']) { + break; + } + + $room_id = $upload_obj['room_id']; + $file_name = $upload_obj['file_name']; + + // thumbnail_flagを最優先で見ることにした AllCreator 2010.10.13 + if($thumbnail_flag) { + $physical_file_name = $upload_obj['upload_id']."_thumbnail.".$upload_obj['extension']; + //$normal_physical_file_name = $upload_obj['physical_file_name']; + } + else if( $force_resize !== null && $needThumb==true ) { + $physical_file_name = $upload_obj['upload_id']."_resize_".$resize_spec[0]."_".$resize_spec[1].".".$upload_obj['extension']; + } + // mod by AllCreator 2010.10.13 + else if( $mobile_imgdsp_size!=0 && $needThumb==true ) { + $physical_file_name = $upload_obj['upload_id']."_mobile_".$mobile_imgdsp_size.".".$upload_obj['extension']; + } + else { + $physical_file_name = $upload_obj['physical_file_name']; + } + if($room_id == 0) { + //room_id=0ならば、誰でも閲覧可能 + $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; + $cache_flag = true; + break; + } else { + $page =& $pagesView->getPageById($room_id); + if(isset($page)) { + $space_type = $page['space_type']; + if($space_type == _SPACE_TYPE_PUBLIC) { + // + //パブリックスペース + // + $auth_id = isset($page['authority_id']) ? $page['authority_id'] : $session->getParameter("_default_entry_auth_public"); + if($show_auth_id != null && $show_auth_id > $auth_id) { + // 見せれる権限より小さい + break; + } + $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; + $cache_flag = true; + break; + } else if($space_type == _SPACE_TYPE_GROUP && $page['private_flag'] == _ON) { + // + // プライベートスペース + // + $cache_flag = ($page['default_entry_flag'] == _ON) ? true : false; + + $err_flag = false; + switch($session->getParameter("_open_private_space")) { + case _OPEN_PRIVATE_SPACE_GROUP: + $err_flag = ($user_id != "0") ? false : true; + break; + case _OPEN_PRIVATE_SPACE_PUBLIC: + break; + case _OPEN_PRIVATE_SPACE_MYPORTAL_GROUP: + $err_flag = (($user_id != "0" && $page['default_entry_flag'] == _ON) || $user_id == $upload_obj['update_user_id']) ? false : true; + break; + case _OPEN_PRIVATE_SPACE_MYPORTAL_PUBLIC: + $err_flag = (($page['default_entry_flag'] == _ON) || $user_id == $upload_obj['update_user_id']) ? false : true; + break; + default: + $err_flag = ($user_id == $upload_obj['update_user_id']) ? false : true; + } + if($err_flag) break; + + $auth_id = isset($page['authority_id']) ? $page['authority_id'] : _AUTH_OTHER; + if($show_auth_id != null && $show_auth_id > $auth_id) { + // 見せれる権限より小さい + break; + } + + $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; + break; + } else if($space_type == _SPACE_TYPE_GROUP && $page['default_entry_flag'] == _ON) { + // + //グループスペース(すべての会員にデフォルトで参加させる) + // + $auth_id = isset($page['authority_id']) ? $page['authority_id'] : $session->getParameter("_default_entry_auth_group"); + if($show_auth_id != null && $show_auth_id > $auth_id) { + // 見せれる権限より小さい + break; + } + if($user_id != "0" && $auth_id != _AUTH_OTHER) { + $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; + break; + } + } else if($space_type == _SPACE_TYPE_GROUP) { + // + //グループスペース + // + $auth_id = isset($page['authority_id']) ? $page['authority_id'] : _AUTH_OTHER; + if($show_auth_id != null && $show_auth_id > $auth_id) { + // 見せれる権限より小さい + break; + } + if($auth_id == _AUTH_OTHER) { + break; + } + //if($auth_id != 0) { + $pathname = FILEUPLOADS_DIR.$upload_obj['file_path']; + break; + //} + } + } + } + } + } + } + // Thumbnail 最優先 + if($thumbnail_flag && !file_exists($pathname.$physical_file_name)) { + // + // common/avatar_thumbnail.gifを使用 + // + $pathname = MODULE_DIR."/common/files/images/"; + $physical_file_name = "thumbnail.gif"; + } + // add by AllCreator 2010.10.13 + if( $resize_spec!=0 && $needThumb==true && !file_exists($pathname.$physical_file_name) ) { + include_once MAPLE_DIR . '/core/FileUpload.class.php'; + $fileUpload =& new FileUpload; + $result = $fileUpload->resize( $pathname.$upload_obj['physical_file_name'], $resize_spec[0], $resize_spec[1], $pathname.$physical_file_name); + if( $result == false ) { + $physical_file_name = $upload_obj['physical_file_name']; + } + } + return array($pathname, $file_name, $physical_file_name, $cache_flag); + } + + /** + * モバイル用サムネイルを取得すべきアップロード画像か + * @param int mobile_imgdsp_size + * @param array uploadsObj + * @access public + * @return false:no_need true:need + */ + function _needThumb( $uploadsObj, $resize_spec ) + { + // 無条件にオリジナル画像が欲しいという指示だったら + if( $resize_spec == 0 ) { + return false; // そのままでいいという判断を返す + } + + //拡張子はgif,png,jpgのみ受け付ける + switch( strtolower($uploadsObj['extension']) ) { + case 'jpg': + case 'png': + case 'gif': + break; + default: + return false; + } + //実サイズが希望サイズを超えているか + $file_path = FILEUPLOADS_DIR . "/" . $uploadsObj['file_path'] . "/" . $uploadsObj['physical_file_name']; + $dimension = @getimagesize($file_path); + if ($dimension === false) { + return false; + } + if( $dimension[0] > $resize_spec[0] || $dimension[1] > $resize_spec[1] ) { + return true; + } + return false; + } + + /** + * ヘッダー出力 + * @param string pathname + * @param string filename + * @access public + */ + function headerOutput($pathname, $filename, $physical_file_name = null, $cache_flag = false) { + if($physical_file_name == null) $physical_file_name = $filename; + $pathname = $pathname.$physical_file_name; //urlencode($filename); + if ($pathname != null && file_exists($pathname)) { + $mimetype = $this->mimeinfo("type", $filename); + if($this->_headerOutput($filename, $pathname, filesize($pathname), $mimetype, $cache_flag) == "200") { + $handle = fopen($pathname, 'rb'); + while (!feof($handle)) { + echo fread($handle, 1 * (1024 * 1024)); + ob_flush(); + flush(); + } + fclose($handle); + }else{ + exit; + } + } else { + header("HTTP/1.0 404 not found"); + } + } + + function _headerOutput($filename, $pathname, $filesize, $mimetype, $cache_flag = false) { + $status_code = "200"; + $etag = null; + + if (!isset($_SERVER['HTTP_USER_AGENT'])) { + //HTTP_USER_AGENTがない場合、 + header("Content-disposition: inline; filename=\"".$filename."\""); + } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { + // IEの場合 + header("Content-disposition: inline; filename=\"".mb_convert_encoding($filename, "SJIS", _CHARSET)."\""); + } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "Opera")) { + // Operaの場合 + header("Content-disposition: attachment; filename=\"".$filename."\""); + } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "Firefox")) { + // FireFoxの場合 + if ($mimetype == "application/x-shockwave-flash") { + header("Content-disposition: inline; filename=\"".$filename."\""); + } else { + header("Content-disposition: attachment; filename=\"".$filename."\""); + } + } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "Chrome")) { + // GoogleChromeの場合 + if (stristr($_SERVER['HTTP_USER_AGENT'], "Windows")) { + // Windows版 + header("Content-disposition: inline; filename=\"".mb_convert_encoding($filename, "SJIS", _CHARSET)."\""); + } else { + // それ以外 + header("Content-disposition: inline; filename=\"".$filename."\""); + } + } else { + // 上記以外(Mozilla, Firefox, NetScape) + header("Content-disposition: inline; filename=\"".$filename."\""); + } + if(!empty($pathname)) { + $stats = stat( $pathname ); + $etag = sprintf( '"%x-%x-%x"', $stats['ino'], $stats['size'], $stats['mtime'] ); + header('Etag: '.$etag); + } + + //header("Content-disposition: inline; filename=\"".$filename."\""); + // パブリックの画像ならばキャッシュを取るように修正 + if($cache_flag == true) { + // 1Week + header("Cache-Control: max-age=604800, public"); + header('Pragma: cache'); //no-cache以外の文字列をセット + $offset = 60 * 60 * 24 * 7; // 1Week + header('Expires: '.gmdate('D, d M Y H:i:s', time() + $offset).' GMT'); + if (isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && + stripcslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) == $etag ) { + header( 'HTTP/1.1 304 Not Modified' ); + $status_code = "304"; + } + //} else if (isset($_SERVER['HTTPS']) && stristr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { + // // IE + サイト全体SSLの場合、ダウンロードが正常に行われない。 + // // ダウンロードさせるためには、以下コメントをはずす必要があるが、 + // // アップロードした画像ファイル等をローカルキャッシュにとられてしまう弊害がある。 + // // 1Week + // header("Cache-Control: max-age=604800, public"); + // header('Pragma: cache'); //no-cache以外の文字列をセット + // $offset = 60 * 60 * 24 * 7; // 1Week + // header('Expires: '.gmdate('D, d M Y H:i:s', time() + $offset).' GMT'); + } else { + header("Cache-Control: no-store, no-cache, must-revalidate"); + header("Pragma: no-cache"); + } + //header("Cache-Control: public");//キャッシュを有効にする設定(private or public) + + header("Content-length: ".$filesize); + header("Content-type: ".$mimetype); + return $status_code; + + //header("Content-type: application/force-download"); + //header("Content-type: ForceType application/octet-stream"); + //header("Content-type: AddType application/octet-stream"); + //header("Content-type: application/octet-stream"); + } + + /** + * PHPで作られたファイルダウンロードメソッド + * @param string $data + * @param string $filename (hogehoge.csv等) + * @param string $mime_type (document/unknown等) + * @access public + */ + function download($data, $filename, $mimetype = null) { + if($mimetype == null) { + $mimetype = $this->mimeinfo("type", $filename); + } + $this->_headerOutput($filename, null, strlen($data), $mimetype); + + echo $data; + } + + /** + * Mimeタイプ取得 + * @param int key(type or icon) + * @return string mime_type + * @access public + */ + function mimeinfo($key, $filename) { + $mimeinfo = array ( + "xxx" => array ("type"=>"document/unknown", "icon"=>"unknown.gif"), + "3gp" => array ("type"=>"video/quicktime", "icon"=>"video.gif"), + "ai" => array ("type"=>"application/postscript", "icon"=>"image.gif"), + "aif" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"), + "aiff" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"), + "aifc" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"), + "applescript" => array ("type"=>"text/plain", "icon"=>"text.gif"), + "asc" => array ("type"=>"text/plain", "icon"=>"text.gif"), + "au" => array ("type"=>"audio/au", "icon"=>"audio.gif"), + "avi" => array ("type"=>"video/x-ms-wm", "icon"=>"avi.gif"), + "bmp" => array ("type"=>"image/bmp", "icon"=>"image.gif"), + "cs" => array ("type"=>"application/x-csh", "icon"=>"text.gif"), + "css" => array ("type"=>"text/css", "icon"=>"text.gif"), + "csv" => array ("type"=>"text/plain", "icon"=>"csv.gif"), + "dv" => array ("type"=>"video/x-dv", "icon"=>"video.gif"), + "doc" => array ("type"=>"application/msword", "icon"=>"word.gif"), + "docx" => array ("type"=>"application/vnd.openxmlformats-officedocument.wordprocessingml.document", "icon"=>"word.gif"), + "dif" => array ("type"=>"video/x-dv", "icon"=>"video.gif"), + "eps" => array ("type"=>"application/postscript", "icon"=>"pdf.gif"), + "gif" => array ("type"=>"image/gif", "icon"=>"image.gif"), + "gtar" => array ("type"=>"application/x-gtar", "icon"=>"zip.gif"), + "gz" => array ("type"=>"application/g-zip", "icon"=>"zip.gif"), + "gzip" => array ("type"=>"application/g-zip", "icon"=>"zip.gif"), + "h" => array ("type"=>"text/plain", "icon"=>"text.gif"), + "hqx" => array ("type"=>"application/mac-binhex40", "icon"=>"zip.gif"), + "html" => array ("type"=>"text/html", "icon"=>"html.gif"), + "htm" => array ("type"=>"text/html", "icon"=>"html.gif"), + "jpe" => array ("type"=>"image/jpeg", "icon"=>"image.gif"), + "jpeg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"), + "jpg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"), + "js" => array ("type"=>"application/x-javascript", "icon"=>"text.gif"), + "latex"=> array ("type"=>"application/x-latex", "icon"=>"text.gif"), + "m" => array ("type"=>"text/plain", "icon"=>"text.gif"), + "flv" => array ("type"=>"video/x-flv", "icon"=>"video.gif"), + "mov" => array ("type"=>"video/quicktime", "icon"=>"video.gif"), + "movie"=> array ("type"=>"video/x-sgi-movie", "icon"=>"video.gif"), + "m3u" => array ("type"=>"audio/x-mpegurl", "icon"=>"audio.gif"), + "mp3" => array ("type"=>"audio/mp3", "icon"=>"audio.gif"), + "mp4" => array ("type"=>"video/mp4", "icon"=>"video.gif"), + "mpeg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"), + "mpe" => array ("type"=>"video/mpeg", "icon"=>"video.gif"), + "mpg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"), + "pct" => array ("type"=>"image/pict", "icon"=>"image.gif"), + "pdf" => array ("type"=>"application/pdf", "icon"=>"pdf.gif"), + "php" => array ("type"=>"text/plain", "icon"=>"text.gif"), + "pic" => array ("type"=>"image/pict", "icon"=>"image.gif"), + "pict" => array ("type"=>"image/pict", "icon"=>"image.gif"), + "png" => array ("type"=>"image/png", "icon"=>"image.gif"), + "pps" => array ("type"=>"application/vnd.ms-powerpoint", "icon"=>"powerpoint.gif"), + "ppt" => array ("type"=>"application/vnd.ms-powerpoint", "icon"=>"powerpoint.gif"), + "pptx" => array ("type"=>"application/vnd.openxmlformats-officedocument.presentationml.presentation", "icon"=>"powerpoint.gif"), + "ps" => array ("type"=>"application/postscript", "icon"=>"pdf.gif"), + "qt" => array ("type"=>"video/quicktime", "icon"=>"video.gif"), + "ra" => array ("type"=>"audio/x-realaudio", "icon"=>"audio.gif"), + "ram" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"), + "rm" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"), + "rtf" => array ("type"=>"text/rtf", "icon"=>"text.gif"), + "rtx" => array ("type"=>"text/richtext", "icon"=>"text.gif"), + "sh" => array ("type"=>"application/x-sh", "icon"=>"text.gif"), + "sit" => array ("type"=>"application/x-stuffit", "icon"=>"zip.gif"), + "smi" => array ("type"=>"application/smil", "icon"=>"text.gif"), + "smil" => array ("type"=>"application/smil", "icon"=>"text.gif"), + "swf" => array ("type"=>"application/x-shockwave-flash", "icon"=>"flash.gif"), + "tar" => array ("type"=>"application/x-tar", "icon"=>"zip.gif"), + "tgz" => array ("type"=>"application/x-tar", "icon"=>"zip.gif"), + "tif" => array ("type"=>"image/tiff", "icon"=>"image.gif"), + "tiff" => array ("type"=>"image/tiff", "icon"=>"image.gif"), + "tex" => array ("type"=>"application/x-tex", "icon"=>"text.gif"), + "texi" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"), + "texinfo" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"), + "tsv" => array ("type"=>"text/tab-separated-values", "icon"=>"text.gif"), + "txt" => array ("type"=>"text/plain", "icon"=>"text.gif"), + "wav" => array ("type"=>"audio/wav", "icon"=>"audio.gif"), + "wmv" => array ("type"=>"video/x-ms-wmv", "icon"=>"avi.gif"), + "asf" => array ("type"=>"video/x-ms-asf", "icon"=>"avi.gif"), + "xls" => array ("type"=>"application/vnd.ms-excel", "icon"=>"excel.gif"), + "xlsx" => array ("type"=>"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "icon"=>"excel.gif"), + "xml" => array ("type"=>"text/xml", "icon"=>"xml.gif"), + "xsl" => array ("type"=>"text/xml", "icon"=>"xml.gif"), + "zip" => array ("type"=>"application/zip", "icon"=>"zip.gif"), + "tex" => array ("type"=>"application/x-tex", "icon"=>"text.gif"), + "dvi" => array ("type"=>"application/x-dvi", "icon"=>"text.gif"), + "ps" => array ("type"=>"application/postscript", "icon"=>"text.gif"), + "ics" => array ("type"=>"application/octet-stream", "icon"=>"outlook.gif"), + "jtd" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "jbw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "jtt" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "jfw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "jvw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "juw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "jaw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "jtw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "jsw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "jxw" => array ("type"=>"application/x-js-taro", "icon"=>"unknown.gif"), + "odt" => array ("type"=>"application/vnd.oasis.opendocument.text", "icon"=>"unknown.gif"), + "odg" => array ("type"=>"application/vnd.oasis.opendocument.graphic", "icon"=>"unknown.gif"), + "ods" => array ("type"=>"application/vnd.oasis.opendocument.spreadsheet", "icon"=>"unknown.gif"), + "odp" => array ("type"=>"application/vnd.oasis.opendocument.presentation", "icon"=>"unknown.gif"), + "odb" => array ("type"=>"application/vnd.oasis.opendocument.database", "icon"=>"unknown.gif"), + "odf" => array ("type"=>"application/vnd.oasis.opendocument.formula", "icon"=>"unknown.gif") + ); + + if (eregi("\.([a-z0-9]+)$", $filename, $match)) { + if(isset($mimeinfo[strtolower($match[1])][$key])) { + return $mimeinfo[strtolower($match[1])][$key]; + } else { + return $mimeinfo["xxx"][$key]; // By default + } + } else { + return $mimeinfo["xxx"][$key]; // By default + } + } + + /** + * 指定された拡張子になっているか? + * + * @param string $file_name + * @param string $allow_extension 拡張子文字列(「,」区切りで複数指定可) + *  指定しない場合、configのallow_extensionの中にあるかどうかのチェック + * @return array pathInfo or false + * @access public + */ + function checkExtension($file_name, $allow_extension = null) + { + $pathinfo = pathinfo($file_name); + if(isset($pathinfo['extension'])) { + $extension_str = strtolower($pathinfo['extension']); + } else { + $extension_str = ""; + } + + if($allow_extension == null) { + $configView =& $this->_container->getComponent("configView"); + $config = $configView->getConfigByConfname(_SYS_CONF_MODID, "allow_extension"); + if(!isset($config["conf_value"])) { + return false; + } + $allow_extension = $config["conf_value"]; + } + + if($allow_extension != "") { + $extensionArray = explode(",", strtolower($allow_extension)); + if(!in_array($extension_str, $extensionArray)) { + return false; + } + } + // + // tar.gzの対応 + // tar.gzのほかにも同じような拡張子があるかも + // + if(preg_match("/.+\.tar\.gz$/i", $file_name)) { + $pathinfo['extension'] = "tar.gz"; + } + return $pathinfo; + } +} +?> diff --git a/html/webapp/components/users/View.class.php b/html/webapp/components/users/View.class.php index 6ececb4..a1a68a1 100644 --- a/html/webapp/components/users/View.class.php +++ b/html/webapp/components/users/View.class.php @@ -1075,5 +1075,56 @@ function &_fetchRoomUser($result, $func_params) // 不参加者を返す return $absence_users; } + + /** + * メールアドレスからユーザーIDを取得する + * + * @param string $mail メールアドレス + * @param boolean $isActive 利用可能ユーザー対象フラグ + * @return ユーザーID + * @access private + */ + function &getUserIdByMail($mail, $isActive = false) { + $userId = null; + if (empty($mail)) { + return $userId; + } + + $sql = "SELECT UI.user_id " + . "FROM {items} I " + . "INNER JOIN {users_items_link} UI " + . "ON I.item_id = UI.item_id "; + + if ($isActive) { + $sql .= "INNER JOIN {users} U " + . "ON UI.user_id = U.user_id "; + } + + $sql .= "WHERE (I.type = ? " + . "OR I.type = ?) " + . "AND UI.content = ? "; + + $bindValues = array( + USER_TYPE_EMAIL, + USER_TYPE_MOBILE_EMAIL, + $mail + ); + + if ($isActive) { + $sql .= "AND U.active_flag = ? "; + $bindValues[] = _USER_ACTIVE_FLAG_ON; + } + + $users = $this->_db->execute($sql, $bindValues); + if ($users === false) { + $this->_db->addError(); + } + + if (!empty($users)) { + $userId = $users[0]['user_id']; + } + + return $userId; + } } ?> \ No newline at end of file diff --git a/html/webapp/components/whatsnew/Action.class.php b/html/webapp/components/whatsnew/Action.class.php index 1e71a4e..c1aad0f 100644 --- a/html/webapp/components/whatsnew/Action.class.php +++ b/html/webapp/components/whatsnew/Action.class.php @@ -407,102 +407,175 @@ function _deleteUser(&$recordSet) } /** - * 新着情報の削除 - * + * ルーム、モジュール毎で、指定件数以上の古いデータを削除する + * + * @param string $moduleId モジュールID + * @param mixed $roomIds ルームID、ルームID配列 + * @return boolean true or false * @access public */ - function _deletePeriod($module_id, $arr_room_id) + function _deletePeriod($moduleId, $roomIds) { - if (rand(0, 10) != 0) { return true; } + //if (rand(0, 10) != 0) { return true; } - $modulesView =& $this->_container->getComponent("modulesView"); - $module = $modulesView->getModuleByDirname("whatsnew"); + $modulesView =& $this->_container->getComponent('modulesView'); + $module = $modulesView->getModuleByDirname('whatsnew'); - $configView =& $this->_container->getComponent("configView"); - $config = $configView->getConfig($module["module_id"], false); + $configView =& $this->_container->getComponent('configView'); + $config = $configView->getConfig($module['module_id'], false); if ($config === false) { - return false; - } - $whatsnew_period = $config["whatsnew_period"]["conf_value"]; - $offset = $config["whatsnew_delete_number"]["conf_value"]; - $limit = 1; - $time = timezone_date(); - $timestamp = mktime(intval(substr($time,8,2)),intval(substr($time,10,2)),intval(substr($time,12,2)), - intval(substr($time,4,2)),intval(substr($time,6,2))-intval($whatsnew_period),intval(substr($time,0,4))); - $timestamp = date("YmdHis", $timestamp); - - $array_room = array(); - if(is_array($arr_room_id)){ - $array_room = $arr_room_id; - }else{ - $array_room[0] = $arr_room_id; - } - foreach($array_room as $room_id){ - $sql = "SELECT insert_time, child_update_time, room_id FROM {whatsnew}" . - " WHERE module_id = ".$module_id. - " AND room_id = ".$room_id. - " ORDER BY child_update_time desc"; - $result = $this->_db->execute($sql, null, $limit, $offset); - if ($result === false) { - $this->_db->addError(); - return false; - } - //一定の件数以前の新着情報で一定の期間を過ぎている新着情報を削除する。 - if(isset($result[0]["insert_time"]) && ($result[0]["insert_time"] < $timestamp)){ - $max_time = ($result[0]["insert_time"] > $result[0]["child_update_time"]) ? $result[0]["insert_time"] : $result[0]["child_update_time"]; - $sql = "SELECT whatsnew_id FROM {whatsnew}" . - " WHERE insert_time < ? AND child_update_time < ?". - " AND module_id = ".$module_id. - " AND room_id = ".$result[0]["room_id"]; - $in_str = $this->_db->execute($sql, array("insert_time"=>$max_time, "child_update_time"=>$max_time),null,null,false,array($this,"_deletePeriodCallback")); - if ($in_str === false) { - $this->_db->addError(); - return false; - } - if($in_str != "") { - $sql = "DELETE FROM {whatsnew}" . - " WHERE 1 = 1". - $in_str; - $result = $this->_db->execute($sql); - if ($result === false) { - $this->_db->addError(); - return false; - } - - $sql = "DELETE FROM {whatsnew_user}" . - " WHERE 1 = 1". - $in_str; - $result = $this->_db->execute($sql); - if ($result === false) { - $this->_db->addError(); - return false; - } + return false; + } + $period = $config['whatsnew_period']['conf_value']; + $maximumNumber = $config['whatsnew_delete_number']['conf_value']; + + $periodTime = timezone_date(); + $periodTime = mktime(intval(substr($periodTime, 8, 2)), + intval(substr($periodTime, 10, 2)), + intval(substr($periodTime, 12, 2)), + intval(substr($periodTime, 4, 2)), + intval(substr($periodTime, 6, 2)) - intval($period), + intval(substr($periodTime,0,4))); + $periodTime = date('YmdHis', $periodTime); + + if (!is_array($roomIds)) { + $roomIds = array( + $roomIds + ); + } + + $sql = "SELECT room_id, COUNT(*) count " + . "FROM {whatsnew} " + . "WHERE room_id IN ('" . implode("','", $roomIds) . "') " + . "AND module_id = ? " + . "GROUP BY room_id " + . "HAVING count > ?"; + $bindValues = array( + $moduleId, + $maximumNumber + ); + $whatsnews = $this->_db->execute($sql, $bindValues); + + $inValue = ''; + foreach($whatsnews as $whatsnew){ + $sql = "SELECT whatsnew_id " + . "FROM {whatsnew} " + . "WHERE insert_time < ? " + . "AND child_update_time < ? " + . "AND module_id = ? " + . "AND room_id = ? " + . "ORDER BY child_update_time"; + $bindValues = array( + $periodTime, + $periodTime, + $moduleId, + $whatsnew['room_id'] + ); + $oldWhatsnews = $this->_db->execute($sql, $bindValues); + + $deleteNumber = $whatsnew['count'] - $maximumNumber; + foreach ($oldWhatsnews as $oldWhatsnew) { + $inValue .= $oldWhatsnew['whatsnew_id'] . ','; + $deleteNumber--; + if ($deleteNumber <= 0) { + break; } } + } + + if (empty($inValue)) { + return true; + } + $inValue = substr($inValue, 0, -1); + + if (!$this->_deleteByInOperator('whatsnew_user', $inValue)) { + return false; } + if (!$this->_deleteByInOperator('whatsnew', $inValue)) { + return false; + } + return true; } -/** - * 新着情報の削除 + /** + * ルームIDで新着データを削除する * - * @access public + * @param string $roomId ルームID + * @return boolean true or false + * @access public */ - function _deletePeriodCallback(&$recordSet) + function deleteByRoomId($roomId) { - $ret = ""; - $str = ""; - $first = true; - while ($row = $recordSet->fetchRow()) { - if($first == false) { - $str .= ","; - } - $str .= $row[0]; - $first = false; + $module =& $this->_modulesView->getModuleByDirname('whatsnew'); + if (!$module) { + return true; } - if($str != "") - $ret = " AND whatsnew_id IN (".$str.")"; - return $ret; + + $sql = "SELECT whatsnew_id " + . "FROM {whatsnew} " + . "WHERE room_id = ? "; + $inValue = $this->_db->execute($sql, $roomId, null, null, false, array($this, '_createDelimitedString')); + if ($inValue == false) { + $this->_db->addError(); + return false; + } + + if (!$this->_deleteByInOperator('whatsnew_user', $inValue)) { + return false; + } + + $sql = "DELETE FROM {whatsnew} " + . "WHERE room_id = ? "; + if (!$this->_db->execute($sql, $roomId)) { + $this->_db->addError(); + return false; + } + } + + /** + * ADORecordSetの1カラム目(ID)を指定文字区切りの文字列にする + * + * @param object $recordSet ADORecordSetオブジェクト + * @param string $glue 区切り文字 + * @return string 指定文字区切りの文字列 + * @access private + */ + function &_createDelimitedIdString(&$recordSet, $glue = ',') + { + $string = ''; + while ($whatsnew = $recordSet->fetchRow()) { + $string .= $whatsnew[0]. $glue; + } + if (!strlen($glue)) { + $string = substr($string, 0, strlen($glue) * -1); + } + + return $string; + } + + /** + * IN演算子でデータを削除する。 + * + * @param string $tableName 対象テーブル名称 + * @param string $inValue IN演算子の値(カンマ区切り文字列) + * @return boolean true or false + * @access public + */ + function _deleteByInOperator($tableName, $inValue) + { + if (!strlen($inValue)) { + return true; + } + + $sql = "DELETE FROM {" . $tableName . "} " + . "WHERE whatsnew_id IN (" . $inValue . ")"; + if (!$this->_db->execute($sql)) { + $this->_db->addError(); + return false; + } + + return true; } } -?> +?> \ No newline at end of file diff --git a/html/webapp/config/define.inc.php b/html/webapp/config/define.inc.php index 94ca8d5..a4e3a1e 100644 --- a/html/webapp/config/define.inc.php +++ b/html/webapp/config/define.inc.php @@ -219,7 +219,7 @@ define('_PERMALINK_PRIVATE_PREFIX_NAME', 'private'); define('_PERMALINK_GROUP_PREFIX_NAME', 'group'); -define('_PERMALINK_CONTENT', '(%| |#|<|>|\+|\\\\|\"|\'|&|\?|\.|=|\/|~|:|;|,|\$|@)'); +define('_PERMALINK_CONTENT', '(%| |#|<|>|\+|\\\\|\"|\'|&|\?|\.$|=|\/|~|:|;|,|\$|@|^\.|\||\]|\[|\!|\(|\)|\*)'); define('_PERMALINK_PROHIBITION', "/"._PERMALINK_CONTENT."/i"); define('_PERMALINK_PROHIBITION_REPLACE', "-"); define('_PERMALINK_DIR_CONTENT', "^(install|css|js|images|themes|htdocs|webapp|maple|". diff --git a/html/webapp/config/global-config.ini b/html/webapp/config/global-config.ini index 7f72f3b..7846f86 100644 --- a/html/webapp/config/global-config.ini +++ b/html/webapp/config/global-config.ini @@ -57,6 +57,14 @@ _UPLOAD_AVATAR_MAX_HEIGHT_IMAGE = 180 _UPLOAD_THUMBNAIL_MAX_WIDTH_IMAGE = 66 _UPLOAD_THUMBNAIL_MAX_HEIGHT_IMAGE = 66 +;-----------------画像アップロード後解像度--------------------------------- +_UPLOAD_RESOLUTION_IMAGE_LARGE_WIDTH = 800 +_UPLOAD_RESOLUTION_IMAGE_LARGE_HEIGHT = 600 +_UPLOAD_RESOLUTION_IMAGE_MIDDLE_WIDTH = 640 +_UPLOAD_RESOLUTION_IMAGE_MIDDLE_HEIGHT = 480 +_UPLOAD_RESOLUTION_IMAGE_SMALL_WIDTH = 480 +_UPLOAD_RESOLUTION_IMAGE_SMALL_HEIGHT = 360 + ;-----------------アップロードのパーミッション----------------------------- _UPLOAD_FOLDER_MODE = 0777 _UPLOAD_FILE_MODE = 0666 diff --git a/html/webapp/language/chinese/global.ini b/html/webapp/language/chinese/global.ini index cbb8195..6f199e9 100644 --- a/html/webapp/language/chinese/global.ini +++ b/html/webapp/language/chinese/global.ini @@ -149,6 +149,7 @@ _CANCEL="取消" _GUEST = "访客" ;//ログインしていないハンドル名 _SPACE_TYPE_NAME_PUBLIC = "公共空间" +_SPACE_TYPE_NAME_MYPORTAL = "我的空间" _SPACE_TYPE_NAME_PRIVATE = "个人空间" _SPACE_TYPE_NAME_GROUP = "群组空间" @@ -260,6 +261,7 @@ _cancel_grouping_title="拆分选中的区块" ;_cancel_grouping_confirm="您确定要拆分%s?" _audio_browser="语音浏览器用户" _pc_viewer = "切换到PC浏览器" +_confirm_pc_view="您切换到PC浏览器?" _move_center="移动到文本输入区" _invalid_auth=_INVALID_AUTH _invalid_input=_INVALID_INPUT diff --git a/html/webapp/language/english/global.ini b/html/webapp/language/english/global.ini index dec5c4d..5e0abbe 100644 --- a/html/webapp/language/english/global.ini +++ b/html/webapp/language/english/global.ini @@ -149,6 +149,7 @@ _CANCEL="Cancell" _GUEST = "Guest" ;//ログインしていないハンドル名 _SPACE_TYPE_NAME_PUBLIC = "Public Space" +_SPACE_TYPE_NAME_MYPORTAL = "My Portal" _SPACE_TYPE_NAME_PRIVATE = "Private Space" _SPACE_TYPE_NAME_GROUP = "Group Space" @@ -260,6 +261,7 @@ _cancel_grouping_title="Ungrouping the selected blocks" ;_cancel_grouping_confirm="You are ungrouping %s.
Are you sure?" _audio_browser="For the audio browser users" _pc_viewer="Switch to PC Viewer" +_confirm_pc_view="Switch to PC Viewer.\nAre you sure?" _move_center="Move to the content area" _invalid_auth=_INVALID_AUTH _invalid_input=_INVALID_INPUT diff --git a/html/webapp/language/english/items.ini b/html/webapp/language/english/items.ini index 6a20737..8bd423d 100644 --- a/html/webapp/language/english/items.ini +++ b/html/webapp/language/english/items.ini @@ -15,7 +15,7 @@ USER_ITEM_ACTIVE_FLAG="Status" USER_ITEM_ACTIVE_FLAG_OFF="nonactive" USER_ITEM_ACTIVE_FLAG_ON="active" USER_ITEM_ACTIVE_FLAG_PENDING="waiting" -USER_ITEM_ACTIVE_FLAG_MAILED="not yet logged-in" +USER_ITEM_ACTIVE_FLAG_MAILED="not yet logged-in" USER_ITEM_LANG_DIRNAME="Language" USER_ITEM_TIMEZONE_OFFSET="TimeZone" USER_ITEM_AVATAR="Avatar" @@ -27,8 +27,8 @@ USER_ITEM_INSERT_TIME="Registered" USER_ITEM_INSERT_USER_NAME="Creator" USER_ITEM_UPDATE_TIME="Last modified" USER_ITEM_UPDATE_USER_NAME="Updater" -USER_ITEM_EMAIL="e-mail" -USER_ITEM_MOBILE_EMAIL="mobile mail" +USER_ITEM_EMAIL="E-mail" +USER_ITEM_MOBILE_EMAIL="Mobile mail" USER_ITEM_GENDER="Sex" USER_ITEM_COUNTRY_CODE="Nationality" USER_ITEM_ADDRESS="Location" @@ -38,8 +38,8 @@ USER_ITEM_TEXTHTML_MODE = "Display format on mobile" USER_ITEM_IMGDSP_SIZE = "Image size on mobile" ;//アイテム項目-詳細 -USER_ITEM_GENDER_MAN="male" -USER_ITEM_GENDER_WOMAN="female" +USER_ITEM_GENDER_MAN="Male" +USER_ITEM_GENDER_WOMAN="Female" USER_ITEM_TEXTHTML_MODE_TEXT = "TEXT format" USER_ITEM_TEXTHTML_MODE_HTML = "HTML format" @@ -48,7 +48,7 @@ USER_ITEM_IMGDSP_SIZE_240 = "width 240px" USER_ITEM_IMGDSP_SIZE_480 = "width 480px" ;//アイテム項目-説明 -USER_ITEM_MES_CHAR_DESCRIPTION="Minimum 4 characters. No space or special character." +USER_ITEM_MES_CHAR_DESCRIPTION="Please choose at least 4 characters string. No space or special character is allowed." USER_ITEM_MES_AUTH_DESCRIPTION="If set to the administrator, it will be set to the room manager of all rooms and join these rooms." USER_ITEM_MES_TEXTHTML_MODE_DESCRIPTION = "Set initial display format on mobile phone. If you select HTML format, 'Display image size' set to 'reduce the width 240px' we strongly recommend that you." diff --git a/html/webapp/language/english/lang_common.js b/html/webapp/language/english/lang_common.js index 2ace85f..9f12ebf 100644 --- a/html/webapp/language/english/lang_common.js +++ b/html/webapp/language/english/lang_common.js @@ -16,7 +16,7 @@ compCalendarLang = { summary : "Calendar", icon_alt : "Calendar", icon_title : "Show Calendar", - year : "Year", + year : "", month : "Month", week_sun : "Sun", week_mon : "Mon", @@ -34,7 +34,19 @@ compCalendarLang = { btn_prev_year : "«", btn_next_year : "»", btn_prev_month : "‹", - btn_next_month : "›" + btn_next_month : "›", + month_jan : "Jan", + month_feb : "Feb", + month_mar : "Mar", + month_apr : "Apr", + month_may : "May", + month_jun : "Jun", + month_jul : "Jul", + month_aug : "Aug", + month_sep : "Sep", + month_oct : "Oct", + month_nov : "Nov", + month_dec : "Dec" }; /*WYSIWYG用定義ファイル*/ compTextareaLang = { @@ -128,7 +140,7 @@ compInsertLinkLang = { url : "URL(href=)", title : "Title(title=)", target : "Target(target=)", - target_none : "No specification", + target_none : "Not specified", target_blank : "New window(_blank)", target_other : "Other", ok : "Insert Link", @@ -210,7 +222,7 @@ compTableBorderLang = { row : "Row", col : "Col", cell : "Cell", - none : "No specification", + none : "Not specified", outer : "Borders", top : "Overline", bottom : "Underline", diff --git a/html/webapp/language/japanese/global.ini b/html/webapp/language/japanese/global.ini index 30ce7ca..e08c405 100644 --- a/html/webapp/language/japanese/global.ini +++ b/html/webapp/language/japanese/global.ini @@ -149,6 +149,7 @@ _CANCEL="キャンセル" _GUEST = "ゲスト" ;//ログインしていないハンドル名 _SPACE_TYPE_NAME_PUBLIC = "パブリックスペース" +_SPACE_TYPE_NAME_MYPORTAL = "マイポータル" _SPACE_TYPE_NAME_PRIVATE = "プライベートスペース" _SPACE_TYPE_NAME_GROUP = "グループスペース" @@ -260,6 +261,7 @@ _cancel_grouping_title="選択したブロックのグループ化を解除し ;_cancel_grouping_confirm="%sのグループ化を解除します
よろしいですか?" _audio_browser="音声ブラウザ対応ページへ" _pc_viewer="PCビューアーに切り替える" +_confirm_pc_view="PC表示に切り替えます。\nよろしいですか?" _move_center="コンテンツエリアへ" _invalid_auth=_INVALID_AUTH _invalid_input=_INVALID_INPUT diff --git a/html/webapp/language/japanese/lang_common.js b/html/webapp/language/japanese/lang_common.js index b6c2b7d..4d2a0fb 100644 --- a/html/webapp/language/japanese/lang_common.js +++ b/html/webapp/language/japanese/lang_common.js @@ -33,7 +33,19 @@ compCalendarLang = { btn_prev_year : "«", btn_next_year : "»", btn_prev_month : "‹", - btn_next_month : "›" + btn_next_month : "›", + month_jan : " 1月", + month_feb : " 2月", + month_mar : " 3月", + month_apr : " 4月", + month_may : " 5月", + month_jun : " 6月", + month_jul : " 7月", + month_aug : " 8月", + month_sep : " 9月", + month_oct : "10月", + month_nov : "11月", + month_dec : "12月" }; /*WYSIWYG用定義ファイル*/ compTextareaLang = { diff --git a/html/webapp/modules/authority/templates/default/authority_view_admin_selectmodules.html b/html/webapp/modules/authority/templates/default/authority_view_admin_selectmodules.html index 17ec2d3..6182c94 100644 --- a/html/webapp/modules/authority/templates/default/authority_view_admin_selectmodules.html +++ b/html/webapp/modules/authority/templates/default/authority_view_admin_selectmodules.html @@ -95,7 +95,7 @@ <{* 戻るボタン *}> <{* 次へボタン *}> - + <{* キャンセルボタン *}> diff --git a/html/webapp/modules/backup/action/main/restoreresult/Restoreresult.class.php b/html/webapp/modules/backup/action/main/restoreresult/Restoreresult.class.php index b5f1dde..024531d 100644 --- a/html/webapp/modules/backup/action/main/restoreresult/Restoreresult.class.php +++ b/html/webapp/modules/backup/action/main/restoreresult/Restoreresult.class.php @@ -17,32 +17,32 @@ class Backup_Action_Main_Restoreresult extends Action { // - // リクエストパラメータを受け取るため - // - var $upload_id = null; - var $backup_page_id = null; - var $module_id = null; - - // 状態 (restore_type != "top") - // バブリックのTop or プライベートのTopならば、必ず公開 - var $display_flag = null; - - // バックアップされた会員を参加させる(restore_type != "top" && restore_type != "subgroup") - // サブグループならば、必ず初期化 - // パブリックスペース、プライベートスペースならば、参加者は変更しない - // パブリックスペース内のルームについては、初期化する - var $entry_user = null; - - // サブグループならばリストア位置を変更できる(restore_type == "subgroup") - var $regist_location = null; - - // リストアするモジュール - var $entry_modules = null; - - // 使用コンポーネントを受け取るため - var $backupRestore = null; - var $fileAction = null; - var $pagesView = null; + // リクエストパラメータを受け取るため + // + var $upload_id = null; + var $backup_page_id = null; + var $module_id = null; + + // 状態 (restore_type != "top") + // バブリックのTop or プライベートのTopならば、必ず公開 + var $display_flag = null; + + // バックアップされた会員を参加させる(restore_type != "top" && restore_type != "subgroup") + // サブグループならば、必ず初期化 + // パブリックスペース、プライベートスペースならば、参加者は変更しない + // パブリックスペース内のルームについては、初期化する + var $entry_user = null; + + // サブグループならばリストア位置を変更できる(restore_type == "subgroup") + var $regist_location = null; + + // リストアするモジュール + var $entry_modules = null; + + // 使用コンポーネントを受け取るため + var $backupRestore = null; + var $fileAction = null; + var $pagesView = null; var $configView = null; var $db = null; var $usersView = null; @@ -54,71 +54,71 @@ class Backup_Action_Main_Restoreresult extends Action //var $room_arr_flat = null; - // 値をセットするため - var $transfer_id_arr = array(); - var $del_physical_file_name_arr = array(); - var $temporary_file_path = ""; - - var $_self_flag = false; - - // 手動ロールバックは、メモリが大量に使う可能性があるため、別ファイルに吐き出すほうがよい - var $deleteParams = array(); // 手動ロールバック用 - var $insertParams = array(); // 手動ロールバック用 - var $uploadParams = array(); // 手動ロールバック用 - var $uploadWhereParams = array(); // 手動ロールバック用 - var $selectParams = array(); // 手動ロールバック用 - - /** - * バックアップファイル-リストア処理(実行) - * - * @access public - */ - function execute() - { - $temporary_file_path = FILEUPLOADS_DIR."backup/".BACKUP_TEMPORARY_DIR_NAME."/".BACKUP_RESTORE_DIR_NAME."/" . $this->backup_page_id. "/"; + // 値をセットするため + var $transfer_id_arr = array(); + var $del_physical_file_name_arr = array(); + var $temporary_file_path = ""; + + var $_self_flag = false; + + // 手動ロールバックは、メモリが大量に使う可能性があるため、別ファイルに吐き出すほうがよい + var $deleteParams = array(); // 手動ロールバック用 + var $insertParams = array(); // 手動ロールバック用 + var $uploadParams = array(); // 手動ロールバック用 + var $uploadWhereParams = array(); // 手動ロールバック用 + var $selectParams = array(); // 手動ロールバック用 + + /** + * バックアップファイル-リストア処理(実行) + * + * @access public + */ + function execute() + { + $temporary_file_path = FILEUPLOADS_DIR."backup/".BACKUP_TEMPORARY_DIR_NAME."/".BACKUP_RESTORE_DIR_NAME."/" . $this->backup_page_id. "/"; $this->backupRestore->mkdirTemporary(BACKUP_RESTORE_DIR_NAME); - $ret = $this->backupRestore->getRestoreArray($this->upload_id, $this->backup_page_id, $this->module_id, $temporary_file_path); - - if($ret === false) { - return 'error'; - } - $backup_uploads = $this->db->selectExecute("backup_uploads", array("upload_id" => $this->upload_id)); - if($backup_uploads === false && !isset($backup_uploads[0])) { - return 'error'; - } - $this->temporary_file_path = $temporary_file_path; - - list($room_inf, $restore_modules, $version_arr, $modules) = $ret; - - $restore_data = $this->backupRestore->getRoomArray(); - - $restore_type = $restore_modules["system"]['restore_type']; - if(!isset($restore_data['system']['room'])) { - // 現状、未処理 - $this->fileAction->delDir($this->temporary_file_path); - return 'error'; - } - $this->_self_flag = $restore_modules["system"]['self_flag']; - - - //-------------------------------------------------- - // システム関連テーブルリストア - // - PKを振りなおす - - // XMLは、改竄されていないとして処理(電子認証) - //-------------------------------------------------- - $pages_buf = array(); - $page_id_arr = array(); - $pages_users_link_room_id = array(); - $normal_block_col_arr = array(); - $err_block_row_arr = array(); - $upload_id_arr = array(); - $physical_file_name_arr = array(); - $this->del_physical_file_name_arr = array(); - //$insert_blocks = array(); - $login_user_id = $this->session->getParameter("_user_id"); - - // room_idで削除できる項目は、はじめに削除 - if($restore_type == "top") { + $ret = $this->backupRestore->getRestoreArray($this->upload_id, $this->backup_page_id, $this->module_id, $temporary_file_path); + + if($ret === false) { + return 'error'; + } + $backup_uploads = $this->db->selectExecute("backup_uploads", array("upload_id" => $this->upload_id)); + if($backup_uploads === false && !isset($backup_uploads[0])) { + return 'error'; + } + $this->temporary_file_path = $temporary_file_path; + + list($room_inf, $restore_modules, $version_arr, $modules) = $ret; + + $restore_data = $this->backupRestore->getRoomArray(); + + $restore_type = $restore_modules["system"]['restore_type']; + if(!isset($restore_data['system']['room'])) { + // 現状、未処理 + $this->fileAction->delDir($this->temporary_file_path); + return 'error'; + } + $this->_self_flag = $restore_modules["system"]['self_flag']; + + + //-------------------------------------------------- + // システム関連テーブルリストア + // - PKを振りなおす - + // XMLは、改竄されていないとして処理(電子認証) + //-------------------------------------------------- + $pages_buf = array(); + $page_id_arr = array(); + $pages_users_link_room_id = array(); + $normal_block_col_arr = array(); + $err_block_row_arr = array(); + $upload_id_arr = array(); + $physical_file_name_arr = array(); + $this->del_physical_file_name_arr = array(); + //$insert_blocks = array(); + $login_user_id = $this->session->getParameter("_user_id"); + + // room_idで削除できる項目は、はじめに削除 + if($restore_type == "top") { // Topのものは置き換える対象なので // 現在のものを削除する // RollBackのため、SelectしてDelete @@ -131,10 +131,10 @@ function execute() $top_page = $this->pagesView->getPrivateSpaceByUserId($login_user_id, 0, 0, false); if($top_page === false) return 'error'; if($room_inf['default_entry_flag'] == _ON && isset($top_page[1])) { - $index_count = 1; - } else { - $index_count = 0; - } + $index_count = 1; + } else { + $index_count = 0; + } } else { // パブリックスペース $where_params = array( @@ -158,21 +158,21 @@ function execute() } } - //$adodb = $this->db->getAdoDbObject(); - foreach($restore_data['system']['room'] as $room_id => $restore_table_arr) { - // - // room_id毎にリストアしていく - // - foreach($restore_table_arr as $table_name => $rec_sets) { - foreach($rec_sets as $rec_set) { - if($restore_type == "top" && !$this->_self_flag) { - if(isset($rec_set['page_id']) && $rec_set['page_id'] == $pre_top_page_id) { - $rec_set['page_id'] = $room_inf['page_id']; - } - if(isset($rec_set['room_id']) && $rec_set['room_id'] == $pre_top_room_id) { - $rec_set['room_id'] = $room_inf['room_id']; - } - } + //$adodb = $this->db->getAdoDbObject(); + foreach($restore_data['system']['room'] as $room_id => $restore_table_arr) { + // + // room_id毎にリストアしていく + // + foreach($restore_table_arr as $table_name => $rec_sets) { + foreach($rec_sets as $rec_set) { + if($restore_type == "top" && !$this->_self_flag) { + if(isset($rec_set['page_id']) && $rec_set['page_id'] == $pre_top_page_id) { + $rec_set['page_id'] = $room_inf['page_id']; + } + if(isset($rec_set['room_id']) && $rec_set['room_id'] == $pre_top_room_id) { + $rec_set['room_id'] = $room_inf['room_id']; + } + } if ($restore_type == "top" && $room_inf['private_flag'] == _ON) { if (isset($rec_set['insert_site_id'])) { $rec_set['insert_site_id'] = $this->session->getParameter("_site_id"); @@ -188,152 +188,152 @@ function execute() } } - if($table_name == "pages") { - //------------------------------------------------------------------------- - // ページテーブル - //------------------------------------------------------------------------- - $prev_page_id = $rec_set['page_id']; - $prev_thread_num = $rec_set['thread_num']; - if($restore_type == "top" && $rec_set['thread_num'] == 0) { - // パブリックスペース、プライベートスペースならば、ID変更なし - // Insertも行わない - $this->_transferId($table_name, $rec_set, "page_id", null, $rec_set['page_id']); - } else if($rec_set['display_position'] != _DISPLAY_POSITION_CENTER){ - // 左右カラム、ヘッダー、フッターならばID変更なし - // Insertも行わない - $this->_transferId($table_name, $rec_set, "page_id", null, $rec_set['page_id']); - } else { - // サブグループならばリストア位置を変更 - if($this->regist_location != null && $restore_type == "subgroup") { - $restore_page = $this->pagesView->getPageById(intval($this->regist_location)); - if($restore_page === false || !isset($restore_page['page_id'])) { - $this->_rollBack(); - return 'error'; - } - if((($this->backup_page_id == 0 && $backup_uploads[0]['thread_num'] == $prev_thread_num) || $this->backup_page_id == $prev_page_id) && - $restore_page['authority_id'] >= _AUTH_CHIEF && $restore_page['createroom_flag'] == _ON) { - // リストアOKなルームID - $rec_set['parent_id'] = intval($this->regist_location); - } - } - - // ページ名称 - if($restore_type != "top" && ($this->backup_page_id == $rec_set['page_id'] || ($this->backup_page_id == 0 && $backup_uploads[0]['thread_num'] == $prev_thread_num))) { - $rec_set['page_name'] = $room_inf['page_name']; - $display_sequence = $this->pagesView->getMaxChildPage($rec_set['parent_id'], $rec_set['lang_dirname']); - $display_sequence = intval($display_sequence) + 1; - $rec_set['display_sequence'] = $display_sequence; - } - - // page_id振替 - $this->_transferId($table_name, $rec_set, "page_id"); - - //if($restore_type != "top") { - // room_id振替 - $this->_transferId($table_name, $rec_set, "page_id", "room_id"); - //} - if(isset($this->transfer_id_arr['page_id'][$rec_set['root_id']])) { - // root_id振替 - $this->_transferId($table_name, $rec_set, "page_id", "root_id"); - } - if(isset($this->transfer_id_arr['page_id'][$rec_set['parent_id']])) { - // parent_id振替 - //if($this->regist_location != null && $restore_type == "subgroup") { - // $this->_transferId($table_name, $rec_set, "page_id", "parent_id", $rec_set['parent_id']); - //} else { - $this->_transferId($table_name, $rec_set, "page_id", "parent_id"); - //} - } - // display_flagを_PAGES_DISPLAY_FLAG_DISABLEDにしておく - // TODO:準備中のルームも最終的に公開中にされてしまうが、仕様とする - if($rec_set['page_id'] == $rec_set['room_id']) { - $rec_set['display_flag'] = _PAGES_DISPLAY_FLAG_DISABLED; - } else { - $rec_set['display_flag'] = _ON; - } - $rec_set['site_id'] = $this->session->getParameter("_site_id"); - $result = $this->db->insertExecute($table_name, $rec_set, false); - if ($result === false) { - $this->_rollBack(); - return 'error'; + if($table_name == "pages") { + //------------------------------------------------------------------------- + // ページテーブル + //------------------------------------------------------------------------- + $prev_page_id = $rec_set['page_id']; + $prev_thread_num = $rec_set['thread_num']; + if($restore_type == "top" && $rec_set['thread_num'] == 0) { + // パブリックスペース、プライベートスペースならば、ID変更なし + // Insertも行わない + $this->_transferId($table_name, $rec_set, "page_id", null, $rec_set['page_id']); + } else if($rec_set['display_position'] != _DISPLAY_POSITION_CENTER){ + // 左右カラム、ヘッダー、フッターならばID変更なし + // Insertも行わない + $this->_transferId($table_name, $rec_set, "page_id", null, $rec_set['page_id']); + } else { + // サブグループならばリストア位置を変更 + if($this->regist_location != null && $restore_type == "subgroup") { + $restore_page = $this->pagesView->getPageById(intval($this->regist_location)); + if($restore_page === false || !isset($restore_page['page_id'])) { + $this->_rollBack(); + return 'error'; + } + if((($this->backup_page_id == 0 && $backup_uploads[0]['thread_num'] == $prev_thread_num) || $this->backup_page_id == $prev_page_id) && + $restore_page['authority_id'] >= _AUTH_CHIEF && $restore_page['createroom_flag'] == _ON) { + // リストアOKなルームID + $rec_set['parent_id'] = intval($this->regist_location); + } + } + + // ページ名称 + if($restore_type != "top" && ($this->backup_page_id == $rec_set['page_id'] || ($this->backup_page_id == 0 && $backup_uploads[0]['thread_num'] == $prev_thread_num))) { + $rec_set['page_name'] = $room_inf['page_name']; + $display_sequence = $this->pagesView->getMaxChildPage($rec_set['parent_id'], $rec_set['lang_dirname']); + $display_sequence = intval($display_sequence) + 1; + $rec_set['display_sequence'] = $display_sequence; + } + + // page_id振替 + $this->_transferId($table_name, $rec_set, "page_id"); + + //if($restore_type != "top") { + // room_id振替 + $this->_transferId($table_name, $rec_set, "page_id", "room_id"); + //} + if(isset($this->transfer_id_arr['page_id'][$rec_set['root_id']])) { + // root_id振替 + $this->_transferId($table_name, $rec_set, "page_id", "root_id"); + } + if(isset($this->transfer_id_arr['page_id'][$rec_set['parent_id']])) { + // parent_id振替 + //if($this->regist_location != null && $restore_type == "subgroup") { + // $this->_transferId($table_name, $rec_set, "page_id", "parent_id", $rec_set['parent_id']); + //} else { + $this->_transferId($table_name, $rec_set, "page_id", "parent_id"); + //} + } + // display_flagを_PAGES_DISPLAY_FLAG_DISABLEDにしておく + // TODO:準備中のルームも最終的に公開中にされてしまうが、仕様とする + if($rec_set['page_id'] == $rec_set['room_id']) { + $rec_set['display_flag'] = _PAGES_DISPLAY_FLAG_DISABLED; + } else { + $rec_set['display_flag'] = _ON; + } + $rec_set['site_id'] = $this->session->getParameter("_site_id"); + $result = $this->db->insertExecute($table_name, $rec_set, false); + if ($result === false) { + $this->_rollBack(); + return 'error'; } $this->deleteParams[$table_name][] = $rec_set; - } - // permalink - if(($this->backup_page_id == 0 && $backup_uploads[0]['thread_num'] == $prev_thread_num) || $this->backup_page_id == $prev_page_id) { - $pages_permalink = $rec_set; - } - // Bufferセット - $page_id_arr[] = $rec_set['page_id']; - $pages_buf[$rec_set['page_id']] = $rec_set; - } else if($table_name == "pages_modules_link") { - //------------------------------------------------------------------------- - // ページモジュールリンクテーブル - // module_idからリストア先のmodule_idに変換 - // エラーがあったモジュールはリストアしない - //------------------------------------------------------------------------- - if($restore_type == "top" && $room_inf['page_id'] == $rec_set['room_id']) { - // パブリックスペース、プライベートスペースならば、ID変更なし - // Insertも行わない - $this->_transferId($table_name, $rec_set, "page_id", "room_id", $rec_set['room_id']); - } else { - // dirname取得 - if(isset($version_arr['__'.$rec_set['module_id']])) { - $dirname = $version_arr['__'.$rec_set['module_id']]; - if(!isset($restore_modules[$dirname]['error_mes'])) { - // エラーなし - // module_id振替 - $this->_transferId($table_name, $rec_set, "module_id", null, $modules[$dirname]['module_id']); - - // room_id振替 - $this->_transferId($table_name, $rec_set, "page_id", "room_id"); - - $result = $this->db->insertExecute($table_name, $rec_set, false); - if ($result === false) { - $this->_rollBack(); - return 'error'; + } + // permalink + if(($this->backup_page_id == 0 && $backup_uploads[0]['thread_num'] == $prev_thread_num) || $this->backup_page_id == $prev_page_id) { + $pages_permalink = $rec_set; + } + // Bufferセット + $page_id_arr[] = $rec_set['page_id']; + $pages_buf[$rec_set['page_id']] = $rec_set; + } else if($table_name == "pages_modules_link") { + //------------------------------------------------------------------------- + // ページモジュールリンクテーブル + // module_idからリストア先のmodule_idに変換 + // エラーがあったモジュールはリストアしない + //------------------------------------------------------------------------- + if($restore_type == "top" && $room_inf['page_id'] == $rec_set['room_id']) { + // パブリックスペース、プライベートスペースならば、ID変更なし + // Insertも行わない + $this->_transferId($table_name, $rec_set, "page_id", "room_id", $rec_set['room_id']); + } else { + // dirname取得 + if(isset($version_arr['__'.$rec_set['module_id']])) { + $dirname = $version_arr['__'.$rec_set['module_id']]; + if(!isset($restore_modules[$dirname]['error_mes'])) { + // エラーなし + // module_id振替 + $this->_transferId($table_name, $rec_set, "module_id", null, $modules[$dirname]['module_id']); + + // room_id振替 + $this->_transferId($table_name, $rec_set, "page_id", "room_id"); + + $result = $this->db->insertExecute($table_name, $rec_set, false); + if ($result === false) { + $this->_rollBack(); + return 'error'; } $this->deleteParams[$table_name][] = $rec_set; - } - - } - } - } else if($table_name == "pages_users_link") { - //------------------------------------------------------------------------- - // ページユーザーリンクテーブル - // - // バックアップされた会員を参加させる(restore_type != "top" && restore_type != "subgroup") - // サブグループならば、必ず初期化 - // パブリックスペース、プライベートスペースならば、参加者は変更しない - // パブリックスペース内のルームについては、初期化する - //------------------------------------------------------------------------- - if($restore_type == "top" && $room_inf['page_id'] == $rec_set['room_id']) { - // 参加者情報はリストアしない(現状のまま) - } else{ - // room_id振替 - $this->_transferId($table_name, $rec_set, "page_id", "room_id"); - - if ($restore_type != "top" && $restore_type != "subgroup" && $this->entry_user == _ON && - (!isset($admin_users) || !isset($admin_users[$rec_set['user_id']]))) { + } + + } + } + } else if($table_name == "pages_users_link") { + //------------------------------------------------------------------------- + // ページユーザーリンクテーブル + // + // バックアップされた会員を参加させる(restore_type != "top" && restore_type != "subgroup") + // サブグループならば、必ず初期化 + // パブリックスペース、プライベートスペースならば、参加者は変更しない + // パブリックスペース内のルームについては、初期化する + //------------------------------------------------------------------------- + if($restore_type == "top" && $room_inf['page_id'] == $rec_set['room_id']) { + // 参加者情報はリストアしない(現状のまま) + } else{ + // room_id振替 + $this->_transferId($table_name, $rec_set, "page_id", "room_id"); + + if ($restore_type != "top" && $restore_type != "subgroup" && $this->entry_user == _ON && + (!isset($admin_users) || !isset($admin_users[$rec_set['user_id']]))) { // バックアップされた会員を参加させる - // 登録されていない会員がいれば、INSERTしない - $pages_users_link_user = $this->usersView->getUserById($rec_set['user_id']); - if(isset($pages_users_link_user['user_id'])) { - - $result = $this->db->insertExecute($table_name, $rec_set, false); - if ($result === false) { - $this->_rollBack(); - return 'error'; + // 登録されていない会員がいれば、INSERTしない + $pages_users_link_user = $this->usersView->getUserById($rec_set['user_id']); + if(isset($pages_users_link_user['user_id'])) { + + $result = $this->db->insertExecute($table_name, $rec_set, false); + if ($result === false) { + $this->_rollBack(); + return 'error'; } $this->deleteParams[$table_name][] = $rec_set; - } - } + } + } - // - // リストアを行った会員、管理者は少なくとも参加 - // - // 管理者一覧取得 + // + // リストアを行った会員、管理者は少なくとも参加 + // + // 管理者一覧取得 if(!isset($admin_users)) { if($pages_buf[$rec_set['room_id']]['private_flag'] == _OFF) { // プライベートルームは自分自身のみ @@ -379,117 +379,117 @@ function execute() } $result = $this->db->insertExecute($table_name, $rec_set, false); if ($result === false) { - $this->_rollBack(); - return 'error'; + $this->_rollBack(); + return 'error'; } $this->deleteParams[$table_name][] = $rec_set; } } - } - } else if($table_name == "pages_meta_inf") { - //------------------------------------------------------------------------- - // pages_meta_infテーブル - //------------------------------------------------------------------------- - // page_id振替 - $this->_transferId($table_name, $rec_set, "page_id"); + } + } else if($table_name == "pages_meta_inf") { + //------------------------------------------------------------------------- + // pages_meta_infテーブル + //------------------------------------------------------------------------- + // page_id振替 + $this->_transferId($table_name, $rec_set, "page_id"); $result = $this->db->insertExecute($table_name, $rec_set, false); - if ($result === false) { - $this->_rollBack(); - return 'error'; + if ($result === false) { + $this->_rollBack(); + return 'error'; } $this->deleteParams[$table_name][] = $rec_set; - } else if($table_name == "pages_style") { - //------------------------------------------------------------------------- - // ページスタイルテーブル - // 自サイトでないならば、本テーブルは、デフォルトに強制的に戻す - // header_flag,leftcolumn_flag等が、権限によっては変更できなくなるおそれがあるため - // 権限毎で、レイアウトを変更できるかどうかをもっているので - // レイアウト変更できる権限の場合のみリストアすることも可能だが、現状、しない - //------------------------------------------------------------------------- - if($restore_modules["system"]['self_flag']) { - // set_page_id振替 - $this->_transferId($table_name, $rec_set, "page_id", "set_page_id"); - - $result = $this->db->insertExecute($table_name, $rec_set, false); - if ($result === false) { - $this->_rollBack(); - return 'error'; + } else if($table_name == "pages_style") { + //------------------------------------------------------------------------- + // ページスタイルテーブル + // 自サイトでないならば、本テーブルは、デフォルトに強制的に戻す + // header_flag,leftcolumn_flag等が、権限によっては変更できなくなるおそれがあるため + // 権限毎で、レイアウトを変更できるかどうかをもっているので + // レイアウト変更できる権限の場合のみリストアすることも可能だが、現状、しない + //------------------------------------------------------------------------- + if($restore_modules["system"]['self_flag']) { + // set_page_id振替 + $this->_transferId($table_name, $rec_set, "page_id", "set_page_id"); + + $result = $this->db->insertExecute($table_name, $rec_set, false); + if ($result === false) { + $this->_rollBack(); + return 'error'; } $this->deleteParams[$table_name][] = $rec_set; - } - } else if($table_name == "monthly_number") { - //------------------------------------------------------------------------- - // 月別一覧テーブル - //------------------------------------------------------------------------- - $insert_flag = false; - - if($rec_set['module_id'] == 0) { - // アクセス数等 - $insert_flag = true; - } else if(isset($version_arr['__'.$rec_set['module_id']])) { - $dirname = $version_arr['__'.$rec_set['module_id']]; - if(!isset($restore_modules[$dirname]['error_mes'])) { - // エラーなし - // module_id振替 - $this->_transferId($table_name, $rec_set, "module_id", null, $modules[$dirname]['module_id']); - if(isset($this->entry_modules[$dirname]) && - $this->entry_modules[$dirname] == _ON) { - // リストアするモジュールに含まれている - $insert_flag = true; - } - - } - } - /* ループ前に行うので、ここはコメント 後に削除 - if($restore_type == "top" && $room_inf['page_id'] == $rec_set['room_id']) { - // Topのものは置き換える対象なので - // 現在のものを削除する - // RollBackのため、SelectしてDelete - $sel_where_params = array( - "room_id" => $rec_set['room_id'] - ); - //$sel_where_params = array( - // "user_id" => $rec_set['user_id'], - // "room_id" => $rec_set['room_id'], - // "module_id" => $rec_set['module_id'] - //); - if(!$this->_selectDelete($table_name, $sel_where_params)) { - return 'error'; - } - } - */ - if($insert_flag == true) { - // room_id振替 - $this->_transferId($table_name, $rec_set, "page_id", "room_id"); + } + } else if($table_name == "monthly_number") { + //------------------------------------------------------------------------- + // 月別一覧テーブル + //------------------------------------------------------------------------- + $insert_flag = false; + + if($rec_set['module_id'] == 0) { + // アクセス数等 + $insert_flag = true; + } else if(isset($version_arr['__'.$rec_set['module_id']])) { + $dirname = $version_arr['__'.$rec_set['module_id']]; + if(!isset($restore_modules[$dirname]['error_mes'])) { + // エラーなし + // module_id振替 + $this->_transferId($table_name, $rec_set, "module_id", null, $modules[$dirname]['module_id']); + if(isset($this->entry_modules[$dirname]) && + $this->entry_modules[$dirname] == _ON) { + // リストアするモジュールに含まれている + $insert_flag = true; + } + + } + } + /* ループ前に行うので、ここはコメント 後に削除 + if($restore_type == "top" && $room_inf['page_id'] == $rec_set['room_id']) { + // Topのものは置き換える対象なので + // 現在のものを削除する + // RollBackのため、SelectしてDelete + $sel_where_params = array( + "room_id" => $rec_set['room_id'] + ); + //$sel_where_params = array( + // "user_id" => $rec_set['user_id'], + // "room_id" => $rec_set['room_id'], + // "module_id" => $rec_set['module_id'] + //); + if(!$this->_selectDelete($table_name, $sel_where_params)) { + return 'error'; + } + } + */ + if($insert_flag == true) { + // room_id振替 + $this->_transferId($table_name, $rec_set, "page_id", "room_id"); $result = $this->db->insertExecute($table_name, $rec_set, false); - if ($result === false) { - $this->_rollBack(); - return 'error'; + if ($result === false) { + $this->_rollBack(); + return 'error'; } $this->deleteParams[$table_name][] = $rec_set; - } - } else if($table_name == "blocks") { - //------------------------------------------------------------------------- - // ブロックテーブル - //------------------------------------------------------------------------- - if($rec_set['module_id'] == 0) { - // グループ化されたブロック - // 内部にモジュールがあるかどうかチェック - // なければリストア対象としない - if(!isset($normal_block_col_arr[$rec_set['page_id']][$rec_set['block_id']])) { - $dirname = ""; - } else { - $dirname = "_grouping"; - } - } else if(isset($version_arr['__'.$rec_set['module_id']])) { - $dirname = $version_arr['__'.$rec_set['module_id']]; - } else { - $dirname = ""; - } - if(($dirname != "_grouping" && - (!isset($this->entry_modules[$dirname]) || + } + } else if($table_name == "blocks") { + //------------------------------------------------------------------------- + // ブロックテーブル + //------------------------------------------------------------------------- + if($rec_set['module_id'] == 0) { + // グループ化されたブロック + // 内部にモジュールがあるかどうかチェック + // なければリストア対象としない + if(!isset($normal_block_col_arr[$rec_set['page_id']][$rec_set['block_id']])) { + $dirname = ""; + } else { + $dirname = "_grouping"; + } + } else if(isset($version_arr['__'.$rec_set['module_id']])) { + $dirname = $version_arr['__'.$rec_set['module_id']]; + } else { + $dirname = ""; + } + if(($dirname != "_grouping" && + (!isset($this->entry_modules[$dirname]) || $this->entry_modules[$dirname] == _OFF || $dirname == "" || isset($restore_modules[$dirname]['error_mes']) @@ -500,39 +500,39 @@ function execute() $err_block_row_arr[$rec_set['page_id']][$rec_set['parent_id']][$rec_set['col_num']][$rec_set['row_num']] = true; } else { - // エラーなし - $normal_block_col_arr[$rec_set['page_id']][$rec_set['parent_id']][$rec_set['col_num']] = true; - // 詰めるかどうかチェック - if($rec_set['row_num'] > 1 && isset($err_block_row_arr[$rec_set['page_id']][$rec_set['parent_id']])) { - $set_row_num = $rec_set['row_num']; - $chk_row_num = intval($set_row_num) - 1; - while(1) { - if($chk_row_num == 0) break; - if(isset($err_block_row_arr[$rec_set['page_id']][$rec_set['parent_id']][$rec_set['col_num']][$chk_row_num])) { - $set_row_num--; - } - $chk_row_num--; - } - $rec_set['row_num'] = $set_row_num; - } - if($rec_set['col_num'] > 1) { - $set_col_num = $rec_set['col_num']; - $chk_col_num = intval($set_col_num) - 1; - while(1) { - if($chk_col_num == 0) break; - if(!isset($normal_block_col_arr[$rec_set['page_id']][$rec_set['parent_id']][$chk_col_num])) { - $set_col_num--; - } - $chk_col_num--; - } - $rec_set['col_num'] = $set_col_num; - } - - // block_id振替 - $this->_transferId($table_name, $rec_set, "block_id"); - - // page_id振替 - $this->_transferId($table_name, $rec_set, "page_id"); + // エラーなし + $normal_block_col_arr[$rec_set['page_id']][$rec_set['parent_id']][$rec_set['col_num']] = true; + // 詰めるかどうかチェック + if($rec_set['row_num'] > 1 && isset($err_block_row_arr[$rec_set['page_id']][$rec_set['parent_id']])) { + $set_row_num = $rec_set['row_num']; + $chk_row_num = intval($set_row_num) - 1; + while(1) { + if($chk_row_num == 0) break; + if(isset($err_block_row_arr[$rec_set['page_id']][$rec_set['parent_id']][$rec_set['col_num']][$chk_row_num])) { + $set_row_num--; + } + $chk_row_num--; + } + $rec_set['row_num'] = $set_row_num; + } + if($rec_set['col_num'] > 1) { + $set_col_num = $rec_set['col_num']; + $chk_col_num = intval($set_col_num) - 1; + while(1) { + if($chk_col_num == 0) break; + if(!isset($normal_block_col_arr[$rec_set['page_id']][$rec_set['parent_id']][$chk_col_num])) { + $set_col_num--; + } + $chk_col_num--; + } + $rec_set['col_num'] = $set_col_num; + } + + // block_id振替 + $this->_transferId($table_name, $rec_set, "block_id"); + + // page_id振替 + $this->_transferId($table_name, $rec_set, "page_id"); // root_id振替 if($rec_set['root_id'] != 0) { @@ -547,53 +547,53 @@ function execute() $this->_transferId($table_name, $rec_set, "module_id", null, $modules[$dirname]['module_id']); } $result = $this->db->insertExecute($table_name, $rec_set, false); - if ($result === false) { - $this->_rollBack(); - return 'error'; + if ($result === false) { + $this->_rollBack(); + return 'error'; } $this->deleteParams[$table_name][] = $rec_set; - } - } else if($table_name == "uploads") { - //------------------------------------------------------------------------- - // アップロードテーブル - // アップロードする実ファイルは、リストアが完全に終わった後 - // コピー or 削除を行う - // 現状、アップロードできる拡張子以外のものがあってもリストアしている - //------------------------------------------------------------------------- - $insert_flag = false; - - if(isset($version_arr['__'.$rec_set['module_id']])) { - $dirname = $version_arr['__'.$rec_set['module_id']]; - if(!isset($restore_modules[$dirname]['error_mes'])) { - // エラーなし - // module_id振替 - $this->_transferId($table_name, $rec_set, "module_id", null, $modules[$dirname]['module_id']); - - if(isset($this->entry_modules[$dirname]) && - $this->entry_modules[$dirname] == _ON) { - // リストアするモジュールに含まれている - $insert_flag = true; - } - } - } - /* ループ前に行うので、ここはコメント 後に削除 - if($restore_type == "top" && $room_inf['page_id'] == $rec_set['room_id']) { - // Topのものは置き換える対象なので - // 現在のものを削除する - // RollBackのため、SelectしてDelete - $sel_where_params = array( - "room_id" => $rec_set['room_id'] - ); - if(!$this->_selectDelete($table_name, $sel_where_params)) { - return 'error'; - } - } - */ - if($insert_flag == true) { - //$old_upload_id = $rec_set['upload_id']; - $old_physical_file_name = $rec_set['file_path'] . $rec_set['physical_file_name']; - // upload_id振替 - $this->_transferId($table_name, $rec_set, "upload_id"); + } + } else if($table_name == "uploads") { + //------------------------------------------------------------------------- + // アップロードテーブル + // アップロードする実ファイルは、リストアが完全に終わった後 + // コピー or 削除を行う + // 現状、アップロードできる拡張子以外のものがあってもリストアしている + //------------------------------------------------------------------------- + $insert_flag = false; + + if(isset($version_arr['__'.$rec_set['module_id']])) { + $dirname = $version_arr['__'.$rec_set['module_id']]; + if(!isset($restore_modules[$dirname]['error_mes'])) { + // エラーなし + // module_id振替 + $this->_transferId($table_name, $rec_set, "module_id", null, $modules[$dirname]['module_id']); + + if(isset($this->entry_modules[$dirname]) && + $this->entry_modules[$dirname] == _ON) { + // リストアするモジュールに含まれている + $insert_flag = true; + } + } + } + /* ループ前に行うので、ここはコメント 後に削除 + if($restore_type == "top" && $room_inf['page_id'] == $rec_set['room_id']) { + // Topのものは置き換える対象なので + // 現在のものを削除する + // RollBackのため、SelectしてDelete + $sel_where_params = array( + "room_id" => $rec_set['room_id'] + ); + if(!$this->_selectDelete($table_name, $sel_where_params)) { + return 'error'; + } + } + */ + if($insert_flag == true) { + //$old_upload_id = $rec_set['upload_id']; + $old_physical_file_name = $rec_set['file_path'] . $rec_set['physical_file_name']; + // upload_id振替 + $this->_transferId($table_name, $rec_set, "upload_id"); // room_id振替 $this->_transferId($table_name, $rec_set, "page_id", "room_id"); @@ -607,22 +607,23 @@ function execute() // insert $result = $this->db->insertExecute($table_name, $rec_set, false); - if ($result === false) { - $this->_rollBack(); - return 'error'; + if ($result === false) { + $this->_rollBack(); + return 'error'; } - $this->deleteParams[$table_name][] = $rec_set; + $key = $rec_set['upload_id']; + $this->deleteParams[$table_name][$key] = $rec_set; // upload_id保存 - $upload_id_arr[$dirname][$rec_set['upload_id']] = $rec_set['unique_id']; + $upload_id_arr[$dirname][$key] = $rec_set['unique_id']; $physical_file_name_arr[$old_physical_file_name] = $rec_set['file_path'] . $rec_set['physical_file_name']; - } - } - } - } - } + } + } + } + } + } - // permalink + // permalink if(isset($pages_permalink)) { $permalink = $pages_permalink['permalink']; $buf_permalink = $permalink; @@ -649,19 +650,19 @@ function execute() } } - //-------------------------------------------------- - // 一般系テーブルリストア - //-------------------------------------------------- - $all_transfer_id_arr = array(); - $transfer_user_id_arr = array(); - foreach($restore_data as $dirname => $modules_restore_arr) { - if($dirname == "system") { - continue; - } - // - // リストア対象かどうかチェック - // - if(isset($restore_modules[$dirname]['error_mes'])) { + //-------------------------------------------------- + // 一般系テーブルリストア + //-------------------------------------------------- + $all_transfer_id_arr = array(); + $transfer_user_id_arr = array(); + foreach($restore_data as $dirname => $modules_restore_arr) { + if($dirname == "system") { + continue; + } + // + // リストア対象かどうかチェック + // + if(isset($restore_modules[$dirname]['error_mes'])) { // エラーあり continue; } @@ -742,146 +743,146 @@ function execute() } // - // room_id毎にリストアしていく - // - foreach($modules_restore_arr['room'] as $room_id => $restore_table_arr) { - foreach($restore_table_arr as $table_name => $rec_sets) { - if(isset($transfer_module_id_arr[$table_name]["*"]) && - $transfer_module_id_arr[$table_name]["*"] == "none_transfer") { - // 本テーブルは振替対象外 - continue; - } - // ハンドル名が重複する可能性があるため、 - // ハンドル名称を振り替える - $this->_transferIdHandle($transfer_user_id_arr, $rec_sets); - - foreach($rec_sets as $rec_set) { - if($restore_type == "top" && !$this->_self_flag) { - if(isset($rec_set['page_id']) && $rec_set['page_id'] == $pre_top_page_id) { - $rec_set['page_id'] = $room_inf['page_id']; - } - if(isset($rec_set['room_id']) && $rec_set['room_id'] == $pre_top_room_id) { - $rec_set['room_id'] = $room_inf['room_id']; - } - } - - if($rec_set["room_id"] && $rec_set["room_id"] == BACKUP_NULL_COLUMN) { - //if($this->_self_flag && $rec_set["room_id"] && $rec_set["room_id"] == BACKUP_NULL_COLUMN) { - // - // room_idがnullのカラムがあった場合 - // - continue; - } - - foreach($rec_set as $column_name => $value) { - // null表記 - if($value == BACKUP_NULL_COLUMN) { - $rec_set[$column_name] = null; - $value = null; - } - if($value != "0") { - $transfer_column_name = ""; - if(isset($transfer_module_id_arr["all"][$column_name])) { - $transfer_column_name = $transfer_module_id_arr["all"][$column_name]; - $set_key = "all"; - } else if(isset($transfer_module_id_arr[$table_name][$column_name])) { - $transfer_column_name = $transfer_module_id_arr[$table_name][$column_name]; - $set_key = $table_name; - } - $mode = ""; - if(isset($set_key) && isset($transfer_core_id_arr[$set_key][$column_name])) { - $mode = $transfer_core_id_arr[$set_key][$column_name]; - } - $other_module = ""; - if(isset($set_key) && isset($transfer_other_module_id_arr[$set_key][$column_name])) { - $other_module = $transfer_other_module_id_arr[$set_key][$column_name]; - } - $separator = ""; - if(isset($set_key) && isset($transfer_separator_id_arr[$set_key][$column_name])) { - $separator = $transfer_separator_id_arr[$set_key][$column_name]; - } - - if($transfer_column_name == "none_transfer") { - // 振替ない - } else if($transfer_column_name != "") { - if($mode != "" && $mode != "wysiwyg" && $mode != "text" && $mode != "physical_file_name" && !isset($this->transfer_id_arr[$transfer_column_name][$rec_set[$column_name]])) { - // Coreから振替 - continue; - } - if($separator == "") { - if($mode != "") { - // Coreから振替 - if($transfer_column_name == "module_id") { - if(isset($version_arr['__'.$rec_set[$column_name]])) { - // module_idに対応したモジュールあり - $this->_transferId($table_name, $rec_set, $transfer_column_name, $column_name, $modules[$version_arr['__'.$rec_set[$column_name]]]['module_id'], $mode); - } - } else { - $this->_transferId($table_name, $rec_set, $transfer_column_name, $column_name, null, $mode); - } - } else if($other_module != "") { - $this->_transferIdModules($dirname, $all_transfer_id_arr[$other_module], $table_name, $rec_set, $transfer_column_name, $column_name); - } else { - $this->_transferIdModules($dirname, $transfer_id_arr, $table_name, $rec_set, $transfer_column_name, $column_name); - } - } else { - $rec_set_column_arr = explode($separator, $rec_set[$column_name]); - $rec_set_column_str = ""; - foreach($rec_set_column_arr as $rec_set_column) { - if($rec_set_column_str != "") { - $rec_set_column_str .= ","; - } - if($rec_set_column != "") { - $rec_set[$column_name] = $rec_set_column; - if($mode != "") { - // Coreから振替 - if($transfer_column_name == "module_id") { - if(isset($version_arr['__'.$rec_set[$column_name]])) { - // module_idに対応したモジュールあり - $this->_transferId($table_name, $rec_set, $transfer_column_name, $column_name, $modules[$version_arr['__'.$rec_set[$column_name]]]['module_id'], $mode); - } - } else { - $this->_transferId($table_name, $rec_set, $transfer_column_name, $column_name, null, $mode); - } - } else if($other_module != "") { - $this->_transferIdModules($dirname, $all_transfer_id_arr[$other_module], $table_name, $rec_set, $transfer_column_name, $column_name); - } else { - $this->_transferIdModules($dirname, $transfer_id_arr, $table_name, $rec_set, $transfer_column_name, $column_name); - } - $rec_set_column_str .= $rec_set[$column_name]; - } - } - $rec_set[$column_name] = $rec_set_column_str; - } - } - - } - } - - $result = $this->db->insertExecute($table_name, $rec_set, false); - if ($result === false) { - $this->_rollBack(); - return 'error'; + // room_id毎にリストアしていく + // + foreach($modules_restore_arr['room'] as $room_id => $restore_table_arr) { + foreach($restore_table_arr as $table_name => $rec_sets) { + if(isset($transfer_module_id_arr[$table_name]["*"]) && + $transfer_module_id_arr[$table_name]["*"] == "none_transfer") { + // 本テーブルは振替対象外 + continue; + } + // ハンドル名が重複する可能性があるため、 + // ハンドル名称を振り替える + $this->_transferIdHandle($transfer_user_id_arr, $rec_sets); + + foreach($rec_sets as $rec_set) { + if($restore_type == "top" && !$this->_self_flag) { + if(isset($rec_set['page_id']) && $rec_set['page_id'] == $pre_top_page_id) { + $rec_set['page_id'] = $room_inf['page_id']; + } + if(isset($rec_set['room_id']) && $rec_set['room_id'] == $pre_top_room_id) { + $rec_set['room_id'] = $room_inf['room_id']; + } + } + + if($rec_set["room_id"] && $rec_set["room_id"] == BACKUP_NULL_COLUMN) { + //if($this->_self_flag && $rec_set["room_id"] && $rec_set["room_id"] == BACKUP_NULL_COLUMN) { + // + // room_idがnullのカラムがあった場合 + // + continue; + } + + foreach($rec_set as $column_name => $value) { + // null表記 + if($value == BACKUP_NULL_COLUMN) { + $rec_set[$column_name] = null; + $value = null; + } + if($value != "0") { + $transfer_column_name = ""; + if(isset($transfer_module_id_arr["all"][$column_name])) { + $transfer_column_name = $transfer_module_id_arr["all"][$column_name]; + $set_key = "all"; + } else if(isset($transfer_module_id_arr[$table_name][$column_name])) { + $transfer_column_name = $transfer_module_id_arr[$table_name][$column_name]; + $set_key = $table_name; + } + $mode = ""; + if(isset($set_key) && isset($transfer_core_id_arr[$set_key][$column_name])) { + $mode = $transfer_core_id_arr[$set_key][$column_name]; + } + $other_module = ""; + if(isset($set_key) && isset($transfer_other_module_id_arr[$set_key][$column_name])) { + $other_module = $transfer_other_module_id_arr[$set_key][$column_name]; + } + $separator = ""; + if(isset($set_key) && isset($transfer_separator_id_arr[$set_key][$column_name])) { + $separator = $transfer_separator_id_arr[$set_key][$column_name]; + } + + if($transfer_column_name == "none_transfer") { + // 振替ない + } else if($transfer_column_name != "") { + if($mode != "" && $mode != "wysiwyg" && $mode != "text" && $mode != "physical_file_name" && !isset($this->transfer_id_arr[$transfer_column_name][$rec_set[$column_name]])) { + // Coreから振替 + continue; + } + if($separator == "") { + if($mode != "") { + // Coreから振替 + if($transfer_column_name == "module_id") { + if(isset($version_arr['__'.$rec_set[$column_name]])) { + // module_idに対応したモジュールあり + $this->_transferId($table_name, $rec_set, $transfer_column_name, $column_name, $modules[$version_arr['__'.$rec_set[$column_name]]]['module_id'], $mode); + } + } else { + $this->_transferId($table_name, $rec_set, $transfer_column_name, $column_name, null, $mode); + } + } else if($other_module != "") { + $this->_transferIdModules($dirname, $all_transfer_id_arr[$other_module], $table_name, $rec_set, $transfer_column_name, $column_name); + } else { + $this->_transferIdModules($dirname, $transfer_id_arr, $table_name, $rec_set, $transfer_column_name, $column_name); + } + } else { + $rec_set_column_arr = explode($separator, $rec_set[$column_name]); + $rec_set_column_str = ""; + foreach($rec_set_column_arr as $rec_set_column) { + if($rec_set_column_str != "") { + $rec_set_column_str .= ","; + } + if($rec_set_column != "") { + $rec_set[$column_name] = $rec_set_column; + if($mode != "") { + // Coreから振替 + if($transfer_column_name == "module_id") { + if(isset($version_arr['__'.$rec_set[$column_name]])) { + // module_idに対応したモジュールあり + $this->_transferId($table_name, $rec_set, $transfer_column_name, $column_name, $modules[$version_arr['__'.$rec_set[$column_name]]]['module_id'], $mode); + } + } else { + $this->_transferId($table_name, $rec_set, $transfer_column_name, $column_name, null, $mode); + } + } else if($other_module != "") { + $this->_transferIdModules($dirname, $all_transfer_id_arr[$other_module], $table_name, $rec_set, $transfer_column_name, $column_name); + } else { + $this->_transferIdModules($dirname, $transfer_id_arr, $table_name, $rec_set, $transfer_column_name, $column_name); + } + $rec_set_column_str .= $rec_set[$column_name]; + } + } + $rec_set[$column_name] = $rec_set_column_str; + } + } + + } + } + + $result = $this->db->insertExecute($table_name, $rec_set, false); + if ($result === false) { + $this->_rollBack(); + return 'error'; } $this->deleteParams[$table_name][] = $rec_set; - } - } - } - // - // uploadsテーブルのunique_idの振替 - // - if(isset($transfer_module_id_arr['uploads']['unique_id']) && isset($upload_id_arr[$dirname]) && $upload_id_arr[$dirname]) { - $other_module = ""; + } + } + } + // + // uploadsテーブルのunique_idの振替 + // + if(isset($transfer_module_id_arr['uploads']['unique_id']) && isset($upload_id_arr[$dirname]) && $upload_id_arr[$dirname]) { + $other_module = ""; if(isset($transfer_other_module_id_arr['uploads']['unique_id'])) { $other_module = $transfer_other_module_id_arr['uploads']['unique_id']; } $transfer_column_name = $transfer_module_id_arr['uploads']['unique_id']; - foreach($upload_id_arr[$dirname] as $new_upload_id => $unique_id) { - if($unique_id != "0") { - $buf_rec_set['unique_id'] = $unique_id; - // 振替対象 - // Coreからの振替はないものとして処理 - if($other_module != "") { + foreach($upload_id_arr[$dirname] as $new_upload_id => $unique_id) { + if($unique_id != "0") { + $buf_rec_set['unique_id'] = $unique_id; + // 振替対象 + // Coreからの振替はないものとして処理 + if($other_module != "") { $this->_transferIdModules($dirname, $all_transfer_id_arr[$other_module], 'uploads', $buf_rec_set, $transfer_column_name, 'unique_id'); } else { $this->_transferIdModules($dirname, $transfer_id_arr, 'uploads', $buf_rec_set, $transfer_column_name, 'unique_id'); @@ -889,67 +890,66 @@ function execute() $upd_params = array("unique_id" => $buf_rec_set['unique_id']); $upd_where_params = array("upload_id" => $new_upload_id); $result = $this->db->updateExecute('uploads', $upd_params, $upd_where_params, false); - if ($result === false) { - $this->_rollBack(); - return false; + if ($result === false) { + $this->_rollBack(); + return false; } - $upd_params = array("unique_id" => $unique_id); - $this->uploadParams['uploads'][] = $upd_params; - $this->uploadWhereParams['uploads'][] = $upd_where_params; - } - } - } - - // - // 振替たIDをセット - // モジュール間の振替が必要なモジュールがあるため(施設予約、TODOのカレンダーID等) - // - $all_transfer_id_arr[$dirname] = $transfer_id_arr; - } + + $this->deleteParams['uploads'][$new_upload_id]['unique_id'] = $buf_rec_set['unique_id']; + } + } + } + + // + // 振替たIDをセット + // モジュール間の振替が必要なモジュールがあるため(施設予約、TODOのカレンダーID等) + // + $all_transfer_id_arr[$dirname] = $transfer_id_arr; + } // test - //$this->_rollBack(); - - //--------------------------------------------------------- - // 画像コピー・削除 - //--------------------------------------------------------- - //$this->del_physical_file_name_arr - foreach($this->del_physical_file_name_arr as $del_name) { - if(file_exists(FILEUPLOADS_DIR.$del_name)) { - // エラー処理は行わない - $this->fileAction->delDir(FILEUPLOADS_DIR.$del_name); - } - } - //$physical_file_name_arr - foreach($physical_file_name_arr as $old_name => $new_name) { - if(file_exists($temporary_file_path. "uploads/".$old_name)) { - $this->fileAction->copyFile($temporary_file_path. "uploads/".$old_name, FILEUPLOADS_DIR . $new_name); - } - } - $this->fileAction->delDir($this->temporary_file_path); - //--------------------------------------------------------- - // 正常終了 - //--------------------------------------------------------- - $this->display_flag = ($this->display_flag == _OFF && $this->display_flag != null) ? _OFF : _ON; - // display_flag=_PAGES_DISPLAY_FLAG_DISABLEDを元に戻す - $params = array( - "display_flag" => $this->display_flag - ); - $where_params = array( - "page_id IN (". implode(",", $page_id_arr). ") " => null, - "{pages}.page_id = {pages}.room_id" => null - ); - //page_id IN (". implode(",", $page_id_arr). ") "; - $result = $this->db->updateExecute("pages", $params, $where_params, false); - - // 正常終了 - $errorList =& $this->actionChain->getCurErrorList(); - $errorList->add("backup", BACKUP_RESTORE_SUCCESS_MES); - - return 'success'; - } - - // 手動ロールバック - function _rollBack() + //$this->_rollBack(); + + //--------------------------------------------------------- + // 画像コピー・削除 + //--------------------------------------------------------- + //$this->del_physical_file_name_arr + foreach($this->del_physical_file_name_arr as $del_name) { + if(file_exists(FILEUPLOADS_DIR.$del_name)) { + // エラー処理は行わない + $this->fileAction->delDir(FILEUPLOADS_DIR.$del_name); + } + } + //$physical_file_name_arr + foreach($physical_file_name_arr as $old_name => $new_name) { + if(file_exists($temporary_file_path. "uploads/".$old_name)) { + $this->fileAction->copyFile($temporary_file_path. "uploads/".$old_name, FILEUPLOADS_DIR . $new_name); + } + } + $this->fileAction->delDir($this->temporary_file_path); + //--------------------------------------------------------- + // 正常終了 + //--------------------------------------------------------- + $this->display_flag = ($this->display_flag == _OFF && $this->display_flag != null) ? _OFF : _ON; + // display_flag=_PAGES_DISPLAY_FLAG_DISABLEDを元に戻す + $params = array( + "display_flag" => $this->display_flag + ); + $where_params = array( + "page_id IN (". implode(",", $page_id_arr). ") " => null, + "{pages}.page_id = {pages}.room_id" => null + ); + //page_id IN (". implode(",", $page_id_arr). ") "; + $result = $this->db->updateExecute("pages", $params, $where_params, false); + + // 正常終了 + $errorList =& $this->actionChain->getCurErrorList(); + $errorList->add("backup", BACKUP_RESTORE_SUCCESS_MES); + + return 'success'; + } + + // 手動ロールバック + function _rollBack() { foreach($this->deleteParams as $table_name => $params) { if(is_array($params)) { @@ -1021,16 +1021,16 @@ function _selectDelete($table_name, $sel_where_params = array()) $sel_result = $this->db->selectExecute($table_name, $sel_where_params); if ($sel_result === false) { - $this->_rollBack(); - return false; + $this->_rollBack(); + return false; } $this->selectParams[$table_name][$whereStr] = $sel_where_params; if(is_array($sel_result) && count($sel_result) > 0) { $result = $this->db->deleteExecute($table_name, $sel_where_params); if ($result === false) { - $this->_rollBack(); - return false; + $this->_rollBack(); + return false; } foreach($sel_result as $row) { if($table_name == "uploads") { @@ -1051,7 +1051,7 @@ function _selectDelete($table_name, $sel_where_params = array()) * @param array column_records * @param string 変換配列保存キー * @param string 変換カラム名称 - * @param int 変換ID 指定がなければ振りなおす(nextSeq) + * @param int 変換ID 指定がなければ振りなおす(nextSeq) * @param string core or wysiwyg * @access private */ @@ -1133,7 +1133,7 @@ function _transferId($table_name, &$rec_set, $transfer_column_name, $column_name * @param array column_records * @param string 変換配列保存キー * @param string 変換カラム名称 - * @param int 変換ID 指定がなければ振りなおす(nextSeq) + * @param int 変換ID 指定がなければ振りなおす(nextSeq) * @access private */ function _transferIdModules($dirname, &$transfer_id_arr, $table_name, &$rec_set, $transfer_column_name, $column_name = null, $transfer_id = null) { @@ -1271,9 +1271,9 @@ function _delRoomDb($top_room_id) { $upd_params = array("display_flag" => _PAGES_DISPLAY_FLAG_DISABLED); $upd_where_params = array("page_id" => $page['page_id']); $result = $this->db->updateExecute($table_name, $upd_params, $upd_where_params, false); - if ($result === false) { - $this->_rollBack(); - return false; + if ($result === false) { + $this->_rollBack(); + return false; } $upd_params = array("display_flag" => _ON); $this->uploadParams[$table_name][] = $upd_params; diff --git a/html/webapp/modules/bbs/templates/default/bbs_mobile_thread.html b/html/webapp/modules/bbs/templates/default/bbs_mobile_thread.html index 3ac2503..8e9dcdf 100644 --- a/html/webapp/modules/bbs/templates/default/bbs_mobile_thread.html +++ b/html/webapp/modules/bbs/templates/default/bbs_mobile_thread.html @@ -8,6 +8,9 @@
<{foreach from=$parents|smarty:nodefaults key=postID item=post}>
+ <{if $smarty.session._smartphone_flag != _ON}> + <{" "|str_repeat:$depth}> + <{/if}> <{include file = "bbs_mobile_subject.html" display_type="list"}>
diff --git a/html/webapp/modules/chat/update/Update.class.php b/html/webapp/modules/chat/update/Update.class.php index c453f7d..a15a6c8 100644 --- a/html/webapp/modules/chat/update/Update.class.php +++ b/html/webapp/modules/chat/update/Update.class.php @@ -92,6 +92,35 @@ function execute() $result = $this->db->execute($sql); if($result === false) return false; } + + $sql = "SELECT block_id " + . "FROM " . $this->db->getPrefix() . "chat_contents " + . "GROUP BY block_id " + . "HAVING COUNT(chat_id) != MAX(chat_id)"; + $chatBlocks = $this->db->execute($sql); + foreach ($chatBlocks as $chatBlock) { + $chatId = 1; + $sql = "SELECT chat_id " + . "FROM " . $this->db->getPrefix() . "chat_contents " + . "WHERE block_id = ? " + . "ORDER BY chat_id"; + $chatContents = $this->db->execute($sql, $chatBlock['block_id']); + foreach ($chatContents as $chatContent) { + $updateColumns = array( + 'chat_id' => $chatId + ); + $whereColumns = array( + 'block_id' => $chatBlock['block_id'], + 'chat_id' => $chatContent['chat_id'] + ); + $result = $this->db->updateExecute('chat_contents', $updateColumns, $whereColumns, false); + if ($result === false) { + return false; + } + $chatId++; + } + } + return true; } } diff --git a/html/webapp/modules/circular/action/main/postscript/add/maple.ini b/html/webapp/modules/circular/action/main/postscript/add/maple.ini index a0f3c3e..f642b59 100644 --- a/html/webapp/modules/circular/action/main/postscript/add/maple.ini +++ b/html/webapp/modules/circular/action/main/postscript/add/maple.ini @@ -3,7 +3,7 @@ mode="check" action="circular_view_main_postscript_init" [Convert] -postscript_body.EscapeText = +postscript_body.EscapeTextarea = [ValidateDef] postscript_body.required:g="1:lang._required,lang.circular_body" diff --git a/html/webapp/modules/circular/action/main/postscript/mail/Mail.class.php b/html/webapp/modules/circular/action/main/postscript/mail/Mail.class.php index 05b637a..d83e625 100644 --- a/html/webapp/modules/circular/action/main/postscript/mail/Mail.class.php +++ b/html/webapp/modules/circular/action/main/postscript/mail/Mail.class.php @@ -15,6 +15,7 @@ class Circular_Action_Main_Postscript_Mail extends Action // リクエストパラメータを受け取るため var $block_id = null; var $circular_id = null; + var $mail_subject = null; var $mail_body = null; // 使用コンポーネントを受け取るため @@ -33,7 +34,7 @@ function execute() return "success"; } - $this->mailMain->setSubject(CIRCULAR_MAIL_SUBJECT); + $this->mailMain->setSubject($this->mail_subject); $this->mailMain->setBody($this->mail_body); $circularInfo = $this->circularView->getCircularInfo($this->circular_id); @@ -48,7 +49,7 @@ function execute() $tags['X-CIRCULAR_SUBJECT'] = htmlspecialchars($circularInfo['circular_subject']); $tags['X-CIRCULAR_BODY'] = $circularInfo['circular_body']; - $tags['X-POSTSCRIPT_BODY'] = htmlspecialchars($sendPostscript['postscript_value']); + $tags['X-POSTSCRIPT_BODY'] = $sendPostscript['postscript_value']; $tags['X-POSTSCRIPT_DATE'] = timezone_date($sendPostscript['insert_time'], false, _FULL_DATE_FORMAT); $tags['X-CIRCULAR_URL'] = BASE_URL. INDEX_FILE_NAME . '?action=' . DEFAULT_ACTION . diff --git a/html/webapp/modules/circular/files/css/default/style.css b/html/webapp/modules/circular/files/css/default/style.css index 290d959..21aae58 100644 --- a/html/webapp/modules/circular/files/css/default/style.css +++ b/html/webapp/modules/circular/files/css/default/style.css @@ -120,10 +120,19 @@ div.circular_detail_date { div.circular_postscript { margin:10px; } - + div.circular_postscript textarea { - width:300px; - height:100px; + height:150px; +} + +div.circular_postscript_mail { + width:530px; +} +div.circular_postscript_mail input { + width:400px; +} +div.circular_postscript_mail textarea { + width:99%; } table.circular_create_frame { diff --git a/html/webapp/modules/circular/files/js/default/circular.js b/html/webapp/modules/circular/files/js/default/circular.js index a993137..0c5db31 100644 --- a/html/webapp/modules/circular/files/js/default/circular.js +++ b/html/webapp/modules/circular/files/js/default/circular.js @@ -323,6 +323,8 @@ clsCircular.prototype = { addPostscript: function() { var form_el = $("postscript_circular_form" + this.id); + form_el.postscript_body.value = this.textarea.getTextArea(); + var viewParams = new Object(); viewParams["action"] = "circular_view_main_postscript_add"; viewParams["circular_id"] = form_el.circular_id.value; @@ -342,14 +344,15 @@ clsCircular.prototype = { parameter["callbackfunc"] = function(){ for (i=0; i
- +
-
- +
+ +
+
<{$lang.circular_postscript_setting_note|smarty:nodefaults}>
@@ -31,6 +31,7 @@
<{include file="../circular_script.html"}> <{/strip}> \ No newline at end of file diff --git a/html/webapp/modules/circular/templates/default/circular_view_main_postscript_list.html b/html/webapp/modules/circular/templates/default/circular_view_main_postscript_list.html index f18f6e2..38293c0 100644 --- a/html/webapp/modules/circular/templates/default/circular_view_main_postscript_list.html +++ b/html/webapp/modules/circular/templates/default/circular_view_main_postscript_list.html @@ -9,7 +9,7 @@ <{$postscript.insert_user_name}> -
<{$postscript.postscript_value|nl2br}>
+
<{$postscript.postscript_value|smarty:nodefaults}>
diff --git a/html/webapp/modules/circular/view/main/postscript/init/maple.ini b/html/webapp/modules/circular/view/main/postscript/init/maple.ini index ce77367..263b757 100644 --- a/html/webapp/modules/circular/view/main/postscript/init/maple.ini +++ b/html/webapp/modules/circular/view/main/postscript/init/maple.ini @@ -1,6 +1,10 @@ [TokenExtra] mode="build" +[HeaderInc] +textarea_css = "comp:{$theme_name}/comp_textarea.css" +titleicon_css = "comp:{$theme_name}/comp_titleicon.css" + [View] define:theme = 1 define:theme_name = "system" diff --git a/html/webapp/modules/common/files/js/prototype.js b/html/webapp/modules/common/files/js/prototype.js index 3fc93dc..cbe70f3 100644 --- a/html/webapp/modules/common/files/js/prototype.js +++ b/html/webapp/modules/common/files/js/prototype.js @@ -217,7 +217,7 @@ Object.extend(String.prototype, { escapeHTML: function() { //IEの場合、テキストノードに含まれる\nが空白になってしまうため修正 - return this.replace(/&/g, "&").replace(/"/g, """).replace(//g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/ /g, " "); + return String(this).replace(/&/g, "&").replace(/"/g, """).replace(//g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/ /g, " "); //var div = document.createElement('div'); //var text = document.createTextNode(this); @@ -227,7 +227,7 @@ Object.extend(String.prototype, { unescapeHTML: function() { //escapeHTMLを修正したため、同様に修正 - return this.replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>').replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'").replace(/ /g, " ").replace(/&/g,'&'); + return String(this).replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>').replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'").replace(/ /g, " ").replace(/&/g,'&'); //var div = document.createElement('div'); //div.innerHTML = this.stripTags(); //return div.childNodes[0] ? (div.childNodes.length > 1 ? diff --git a/html/webapp/modules/common/templates/operation/common_operation_view_init.html b/html/webapp/modules/common/templates/operation/common_operation_view_init.html index 058ce4b..e665b48 100644 --- a/html/webapp/modules/common/templates/operation/common_operation_view_init.html +++ b/html/webapp/modules/common/templates/operation/common_operation_view_init.html @@ -34,9 +34,9 @@ <{assign var="pages_list" value=$action.pages_list.0.0}> <{include file="operation/common_operation_view_pageslist.html"}> - - - + + + <{if $action.headercolumn_page_id != null}> <{if $action.column_space_type_use == _OFF}> -
+
<{$lang.insert_image_size}>
<{$lang.insert_image_width|smarty:nodefaults}> @@ -73,6 +73,16 @@  px
+
+ <{$lang.insert_image_size}> + +
<{$lang.insert_image_border}> @@ -228,6 +238,17 @@ } function changeTabDisplay(tab_name) { + <{*// 「大きさ」内容の切り替え *}> + var resolution_obj = document.getElementById("resolution_f"); + var size_obj = document.getElementById("size_f"); + if(tab_name == "upload_tab") { + resolution_obj.style.display = "block"; + size_obj.style.display = "none"; + } else { + resolution_obj.style.display = "none"; + size_obj.style.display = "block"; + } + g_tab_name = tab_name; <{* 詳細移動 *}> var el = document.getElementById(tab_name+ "_detail"); diff --git a/html/webapp/modules/install/sql/mysql/table.sql b/html/webapp/modules/install/sql/mysql/table.sql index 8c583b7..e5ad4d5 100644 --- a/html/webapp/modules/install/sql/mysql/table.sql +++ b/html/webapp/modules/install/sql/mysql/table.sql @@ -199,7 +199,7 @@ CREATE TABLE `users_items_link` ( `content` text, PRIMARY KEY (`user_id`,`item_id`), KEY `item_id` (`item_id`,`email_reception_flag`), - FULLTEXT KEY `content` (`content`) + KEY `content` (`content`(255)) ) ENGINE=MyISAM; -- - diff --git a/html/webapp/modules/journal/components/View.class.php b/html/webapp/modules/journal/components/View.class.php index d7b8f6c..af3afe3 100644 --- a/html/webapp/modules/journal/components/View.class.php +++ b/html/webapp/modules/journal/components/View.class.php @@ -593,11 +593,7 @@ function getPostDetailData($post_id) { $sql_common .= "WHERE P.root_id = 0 AND P.parent_id = 0 AND P.journal_id = ".$post[0]['journal_id']." "; $sql_common .= $this->_getAuthorityWhereSQL($params); - $where_params = array( - "P.journal_date <= ".$post[0]['journal_date'] => null, - "P.post_id < ".$post[0]['post_id'] => null - ); - $sql_where = $this->_db->getWhereSQL($params, $where_params, false); + $sql_where = " AND (P.journal_date < '".$post[0]['journal_date']."' OR P.journal_date = '".$post[0]['journal_date']."' AND P.post_id < ".$post[0]['post_id'].")"; $sql_order = " ORDER BY P.journal_date DESC, P.post_id DESC"; $sql = $sql_common.$sql_where.$sql_order; @@ -609,11 +605,7 @@ function getPostDetailData($post_id) { $post[0]['older_post_id'] = empty($result) ? "":$result[0]['post_id']; $post[0]['older_short_url'] = empty($result) ? "":$result[0]['short_url']; - $where_params = array( - "P.journal_date >= ".$post[0]['journal_date'] => null, - "P.post_id > ".$post[0]['post_id'] => null - ); - $sql_where = $this->_db->getWhereSQL($params, $where_params, false); + $sql_where = " AND (P.journal_date > '".$post[0]['journal_date']."' OR P.journal_date = '".$post[0]['journal_date']."' AND P.post_id > ".$post[0]['post_id'].")"; $sql_order = " ORDER BY P.journal_date ASC, P.post_id ASC"; $sql = $sql_common.$sql_where.$sql_order; diff --git a/html/webapp/modules/journal/templates/default/journal_mobile_detail_feature.html b/html/webapp/modules/journal/templates/default/journal_mobile_detail_feature.html index e4ce9ee..4bbf579 100644 --- a/html/webapp/modules/journal/templates/default/journal_mobile_detail_feature.html +++ b/html/webapp/modules/journal/templates/default/journal_mobile_detail_feature.html @@ -54,7 +54,7 @@
<{/if}> <{if ($action.journal_obj.comment_flag == $smarty.const._ON) }> - + <{$lang.journal_comment|smarty:nodefaults}>(<{$action.post.comment_count}>) <{/if}> diff --git a/html/webapp/modules/journal/templates/default/journal_mobile_detail_smart.html b/html/webapp/modules/journal/templates/default/journal_mobile_detail_smart.html index b1c1e7b..2c3ddf7 100644 --- a/html/webapp/modules/journal/templates/default/journal_mobile_detail_smart.html +++ b/html/webapp/modules/journal/templates/default/journal_mobile_detail_smart.html @@ -21,7 +21,7 @@

<{$action.post.more_title}>

<{/if}> <{$lang.journal_mobile_er_post_empty|smarty:nodefaults}> <{if ($action.journal_obj.comment_flag == $smarty.const._ON) }> - + <{$lang.journal_comment|smarty:nodefaults}>(<{$action.post.comment_count}>) <{/if}> diff --git a/html/webapp/modules/journal/view/main/detail/Detail.class.php b/html/webapp/modules/journal/view/main/detail/Detail.class.php index 79a888d..02ada56 100644 --- a/html/webapp/modules/journal/view/main/detail/Detail.class.php +++ b/html/webapp/modules/journal/view/main/detail/Detail.class.php @@ -1,90 +1,91 @@ -session->getParameter("_mobile_flag"); - - $this->trackback_url = BASE_URL. INDEX_FILE_NAME. - "?action=".JOURNAL_DEFAULT_TRACKBACK_URL. - "&post_id=". $this->post_id; - - $this->category = $this->journalView->getCatByPostId($this->post_id); - - if ($mobile_flag == _OFF || ($this->journal_obj['comment_flag'] == _ON && $this->comment_flag == _ON)) { - $this->comments = $this->journalView->getChildDetail($this->post_id); - if($this->comments === false) { - return 'error'; - } - } - - if($mobile_flag == _OFF || $this->trackback_flag == _ON) { - $this->trackbacks = $this->journalView->getChildDetail($this->post_id, JOURNAL_TRACKBACK_RECEIVE); - if($this->trackbacks === false) { - return 'error'; - } - } - // タイトル設定 - if(isset($this->active_action) || isset($this->active_center)) { - $this->session->setParameter("_page_title", $this->post['title']); - } - - if ($mobile_flag == _ON ) { - if( $this->comment_flag == _ON) { - return 'comment'; - } - else { - $this->html_flag = $this->mobileView->getTextHtmlMode( $this->html_flag ); - return 'success'; - } - } else { - return 'success'; - } - } -} +session->getParameter("_mobile_flag"); + + $this->trackback_url = BASE_URL. INDEX_FILE_NAME. + "?action=".JOURNAL_DEFAULT_TRACKBACK_URL. + "&post_id=". $this->post_id; + + $this->category = $this->journalView->getCatByPostId($this->post_id); + + if ($mobile_flag == _OFF || ($this->journal_obj['comment_flag'] == _ON && $this->mobile_comment_flag == _ON)) { + $this->comments = $this->journalView->getChildDetail($this->post_id); + if($this->comments === false) { + return 'error'; + } + } + + if($mobile_flag == _OFF || $this->trackback_flag == _ON) { + $this->trackbacks = $this->journalView->getChildDetail($this->post_id, JOURNAL_TRACKBACK_RECEIVE); + if($this->trackbacks === false) { + return 'error'; + } + } + // タイトル設定 + if(isset($this->active_action) || isset($this->active_center)) { + $this->session->setParameter("_page_title", $this->post['title']); + } + + if ($mobile_flag == _ON ) { + if( $this->mobile_comment_flag == _ON) { + return 'comment'; + } + else { + $this->html_flag = $this->mobileView->getTextHtmlMode( $this->html_flag ); + return 'success'; + } + } else { + return 'success'; + } + } +} ?> \ No newline at end of file diff --git a/html/webapp/modules/linklist/components/View.class.php b/html/webapp/modules/linklist/components/View.class.php index 75d5c7e..14e4807 100644 --- a/html/webapp/modules/linklist/components/View.class.php +++ b/html/webapp/modules/linklist/components/View.class.php @@ -170,7 +170,7 @@ function &getLinklists() function &_getMarkStyle($mark) { if(preg_match("/[.gif|.jpg|.png|bmp]$/i", $mark)) { - $style = "list-style-image:url('".CORE_BASE_URL."/images/common/mark/". $mark. "');"; + $style = "list-style-image:url('".get_image_url()."/images/common/mark/". $mark. "');"; } else { $style = "list-style-type:". $mark. ";"; } diff --git a/html/webapp/modules/linklist/templates/default/linklist_view_edit_style.html b/html/webapp/modules/linklist/templates/default/linklist_view_edit_style.html index 85d0b13..173ec98 100644 --- a/html/webapp/modules/linklist/templates/default/linklist_view_edit_style.html +++ b/html/webapp/modules/linklist/templates/default/linklist_view_edit_style.html @@ -50,10 +50,10 @@ <{$lang.linklist_target_blank_flag_on|smarty:nodefaults}> - + - - + + @@ -65,9 +65,9 @@ <{$lang.linklist_view_count_flag_on|smarty:nodefaults}> - + - <{* TODO:タブで次のエレメント、PgUp,PgDnで選択できるように修正すること *}> + <{* TODO:タブで次のエレメント、PgUp,PgDnで選択できるように修正すること *}>