/** * uploadモードのパラメーター検証を行う. * * @param SC_FormParam $objFormParam SC_FormParamのインスタンス * @param SC_UploadFile_Ex $objUpFile SC_UploadFileのインスタンス * @return array エラー情報を格納した連想配列, エラーが無ければ(多分)nullを返す */ public function lfCheckError(&$objFormParam, &$objUpFile) { $arrErr = $objFormParam->checkError(); $template_code = $objFormParam->getValue('template_code'); // 同名のフォルダが存在する場合はエラー if (file_exists(USER_TEMPLATE_REALDIR . $template_code) && $template_code != "") { $arrErr['template_code'] = '※ 同名のファイルがすでに存在します。<br/>'; } // 登録不可の文字列チェック $arrIgnoreCode = array('admin', MOBILE_DEFAULT_TEMPLATE_NAME, SMARTPHONE_DEFAULT_TEMPLATE_NAME, DEFAULT_TEMPLATE_NAME); if (in_array($template_code, $arrIgnoreCode)) { $arrErr['template_code'] = '※ このテンプレートコードは使用できません。<br/>'; } // DBにすでに登録されていないかチェック $objQuery =& SC_Query_Ex::getSingletonInstance(); $exists = $objQuery->exists('dtb_templates', 'template_code = ?', array($template_code)); if ($exists) { $arrErr['template_code'] = '※ すでに登録されているテンプレートコードです。<br/>'; } /* * ファイル形式チェック * ファイルが壊れていることも考慮して, 展開可能かチェックする. */ $tar = new Archive_Tar($_FILES['template_file']['tmp_name'], true); $arrArchive = $tar->listContent(); if (!is_array($arrArchive)) { $arrErr['template_file'] = '※ テンプレートファイルが解凍できません。許可されている形式は、tar/tar.gzです。<br />'; } else { $make_temp_error = $objUpFile->makeTempFile('template_file', false); if (!SC_Utils_Ex::isBlank($make_temp_error)) { $arrErr['template_file'] = $make_temp_error; } } return $arrErr; }