(empty log message)
@@ -4287,13 +4287,17 @@ | ||
4287 | 4287 | * |
4288 | 4288 | * @param string $contentType コンテンツタイプ |
4289 | 4289 | * @param string $dir ファイル格納ディレクトリ |
4290 | - * @return bool 1行以上取得 = true, 取得なし= false | |
4290 | + * @param array $fileIdArray 削除対象のファイルID | |
4291 | + * @return bool true=正常終了、false=異常終了 | |
4291 | 4292 | */ |
4292 | - public function cleanAttachFileInfo($contentType, $dir) | |
4293 | + public function cleanAttachFileInfo($contentType, $dir, $fileIdArray = null) | |
4293 | 4294 | { |
4294 | 4295 | global $gAccessManager; |
4295 | 4296 | global $gEnvManager; |
4296 | 4297 | |
4298 | + // パラメータチェック | |
4299 | + if (!is_null($fileIdArray) && empty($fileIdArray)) return true; // 削除対象がない場合は終了 | |
4300 | + | |
4297 | 4301 | $now = date("Y/m/d H:i:s"); // 現在日時 |
4298 | 4302 | $logSerial = $gEnvManager->getCurrentAccessLogSerial(); // 現在のアクセスログシリアル番号 |
4299 | 4303 |
@@ -4307,6 +4311,7 @@ | ||
4307 | 4311 | $queryStr .= 'AND af_client_id = ? '; |
4308 | 4312 | $queryStr .= 'AND af_content_id = \'\' '; // 仮登録ファイル |
4309 | 4313 | $queryStr .= 'AND af_file_deleted = false '; |
4314 | + if (!empty($fileIdArray)) $queryStr .= 'AND af_file_id in (' . implode(',', array_map(create_function('$a','return "\'" . $a . "\'";'), $fileIdArray)) . ') '; | |
4310 | 4315 | $ret = $this->selectRecords($queryStr, array($contentType, $clientId), $rows); |
4311 | 4316 | |
4312 | 4317 | // ファイル削除 |
@@ -48,8 +48,8 @@ | ||
48 | 48 | // ########## システム関係 ########## |
49 | 49 | // システム基本情報 |
50 | 50 | define('M3_SYSTEM_NAME', 'Magic3'); // システム名称 |
51 | -define('M3_SYSTEM_VERSION', '2.6.17'); // システムのバージョン | |
52 | -define('M3_SYSTEM_RELEASE_DATE', '2013/7/2'); // システムのリリース日付 | |
51 | +define('M3_SYSTEM_VERSION', '2.6.18'); // システムのバージョン | |
52 | +define('M3_SYSTEM_RELEASE_DATE', '2013/7/15'); // システムのリリース日付 | |
53 | 53 | define('M3_SYSTEM_ID', 'M3'); // コンポーネント識別用ID |
54 | 54 | define('M3_SYSTEM_DESCRIPTION', 'Magic3 is open source cms and web communication platform.'); // システムの説明 |
55 | 55 | define('M3_SYSTEM_MIN_MEMORY', '16M'); // 最小メモリ使用量 |
@@ -378,7 +378,7 @@ | ||
378 | 378 | DELETE FROM _widgets WHERE wd_id = 'comment'; |
379 | 379 | INSERT INTO _widgets |
380 | 380 | (wd_id, wd_name, wd_type, wd_content_type, wd_edit_content, wd_version, wd_author, wd_copyright, wd_license, wd_official_level, wd_description, wd_add_script_lib, wd_add_script_lib_a, wd_has_admin, wd_enable_operation, wd_use_instance_def, wd_initialized, wd_release_dt, wd_install_dt, wd_create_dt) VALUES |
381 | -('comment', '汎用コメント', '', 'comment', true, '0.9.0', 'Naoki Hirata', 'Magic3.org', 'GPL', 10, 'メインコンテンツウィジェットに付加する汎用のコメント機能', 'jquery.scrollto', '', true, true, false, true, '2013-06-28', now(), now()); | |
381 | +('comment', '汎用コメント', '', 'comment', true, '1.0.0', 'Naoki Hirata', 'Magic3.org', 'GPL', 10, 'メインコンテンツウィジェットに付加する汎用のコメント機能', 'jquery.scrollto', '', true, true, false, true, '2013-07-19', now(), now()); | |
382 | 382 | |
383 | 383 | -- ウィジェット情報(携帯用) |
384 | 384 | DELETE FROM _widgets WHERE wd_id = 'm/mainmenu'; |
@@ -184,11 +184,12 @@ | ||
184 | 184 | * |
185 | 185 | * @param string $contentType コンテンツタイプ |
186 | 186 | * @param string $dir ファイル格納ディレクトリ |
187 | - * @return bool true=成功、false=失敗 | |
187 | + * @param array $fileIdArray 削除対象のファイルID | |
188 | + * @return bool true=正常終了、false=異常終了 | |
188 | 189 | */ |
189 | - public function cleanAttachFileInfo($contentType, $dir) | |
190 | + public function cleanAttachFileInfo($contentType, $dir, $fileIdArray = null) | |
190 | 191 | { |
191 | - $ret = $this->db->cleanAttachFileInfo($contentType, $dir); | |
192 | + $ret = $this->db->cleanAttachFileInfo($contentType, $dir, $fileIdArray); | |
192 | 193 | return $ret; |
193 | 194 | } |
194 | 195 | /** |
@@ -25,7 +25,8 @@ | ||
25 | 25 | private $isReadImageCheck; // 画像読み込みチェックかどうか |
26 | 26 | private $isErrorInReadImage; // 画像読み込み中にエラーがあるかどうか |
27 | 27 | private $readImageCount; // 読み込み画像総数 |
28 | - private $addImageCount; // 読み込み画像追加数 | |
28 | +// private $addImageCount; // 読み込み画像追加数 | |
29 | + private $attachFileIdArray = array(); // コンテンツに実際に添付されている画像 | |
29 | 30 | private $currentPageUrl; // 現在のページURL |
30 | 31 | private $currentPageRootUrl; |
31 | 32 | private $widgetTitle; // ウィジェットタイトル |
@@ -352,17 +353,29 @@ | ||
352 | 353 | |
353 | 354 | // ##### 画像ありの場合は画像を取り込む ##### |
354 | 355 | if ($this->permitHtml && $this->permitImage){ |
355 | - // 仮登録画像を取得 | |
356 | + // 仮登録画像を取得(アップロード画像分) | |
356 | 357 | $this->imageFileInfoArray = $this->getImageFileInfo(); |
357 | - | |
358 | + | |
358 | 359 | // 画像URL変換 |
359 | 360 | $this->readImageCount = 0; // 読み込み画像総数 |
360 | - $this->addImageCount = 0; // 読み込み画像追加数 | |
361 | + //$this->addImageCount = 0; // 読み込み画像追加数 | |
361 | 362 | $commentHtml = $this->convertImageUrl($commentHtml); |
362 | - if ($this->readImageCount != count($this->imageFileInfoArray) + $this->addImageCount) $this->isErrorInReadImage = true; // 画像総数をチェック | |
363 | + //if ($this->readImageCount != count($this->imageFileInfoArray) + $this->addImageCount) $this->isErrorInReadImage = true; // 画像総数をチェック | |
363 | 364 | if ($this->isErrorInReadImage){ |
364 | 365 | $this->setUserErrorMsg('画像読み込みに失敗しました'); |
365 | 366 | $commentHtml = ''; |
367 | + } else { | |
368 | + // 仮登録画像を再取得(自動取得画像含む) | |
369 | + $this->imageFileInfoArray = $this->getImageFileInfo(); | |
370 | + | |
371 | + // ##### 実際に使用されない仮登録画像を削除 ##### | |
372 | + $delFileIdArray = array(); | |
373 | + for ($i = 0; $i < count($this->imageFileInfoArray); $i++){ | |
374 | + $fileInfo = $this->imageFileInfoArray[$i]; | |
375 | + $imageId = $fileInfo->fileId; // 画像ID | |
376 | + if (!in_array($imageId, $this->attachFileIdArray)) $delFileIdArray[] = $imageId; | |
377 | + } | |
378 | + $this->gInstance->getFileManager()->cleanAttachFileInfo(commentCommonDef::$_viewContentType, $this->imageDir, $delFileIdArray); | |
366 | 379 | } |
367 | 380 | } |
368 | 381 |
@@ -400,27 +413,11 @@ | ||
400 | 413 | if ($this->permitHtml && $this->permitImage){ |
401 | 414 | // 仮登録画像を取得 |
402 | 415 | $this->imageFileInfoArray = $this->getImageFileInfo(); |
403 | -/* $this->imageFileInfoArray = array(); | |
404 | - $clientId = $this->gAccess->getClientId(); | |
405 | - if (!empty($clientId)){ | |
406 | - $ret = $this->gInstance->getFileManager()->getAttachFileInfoByClientId(commentCommonDef::$_viewContentType, $clientId, $imageFileRows); | |
407 | - if ($ret){ | |
408 | - for ($i = 0; $i < count($imageFileRows); $i++){ | |
409 | - $fileRow = $imageFileRows[$i]; | |
410 | - $newInfoObj = new stdClass; | |
411 | - $newInfoObj->title = ''; | |
412 | - $newInfoObj->filename = ''; | |
413 | - $newInfoObj->fileId = $fileRow['af_file_id']; | |
414 | - $newInfoObj->originalUrl = $fileRow['af_original_url']; // 取得先URL | |
415 | - $this->imageFileInfoArray[] = $newInfoObj; | |
416 | - } | |
417 | - } | |
418 | - }*/ | |
419 | 416 | |
420 | 417 | // 画像URL変換 |
421 | 418 | $this->isReadImageCheck = true; // 画像読み込みチェック |
422 | 419 | $this->readImageCount = 0; // 読み込み画像総数 |
423 | - $this->addImageCount = 0; // 読み込み画像追加数 | |
420 | + // $this->addImageCount = 0; // 読み込み画像追加数 | |
424 | 421 | $commentHtml = $this->convertImageUrl($commentHtml); |
425 | 422 | if ($this->readImageCount != count($this->imageFileInfoArray)) $this->isErrorInReadImage = true; // 画像総数をチェック |
426 | 423 | if ($this->isErrorInReadImage){ |
@@ -1044,6 +1041,8 @@ | ||
1044 | 1041 | $newUrl = $this->createCmdUrlToCurrentWidget($param); |
1045 | 1042 | } |
1046 | 1043 | $destTag = '<img src="' . $newUrl . '" width="' . $width . '" height="' . $height . '" />'; |
1044 | + | |
1045 | + $this->attachFileIdArray[] = $imageId; // コンテンツに実際に添付されている画像 | |
1047 | 1046 | break; |
1048 | 1047 | } |
1049 | 1048 | } |
@@ -1062,6 +1061,8 @@ | ||
1062 | 1061 | $param = commentCommonDef::REQUEST_PARAM_IMAGE_ID . '=' . $imageId; |
1063 | 1062 | $newUrl = $this->createCmdUrlToCurrentWidget($param, true/*マクロ形式で取得*/); |
1064 | 1063 | $destTag = '<img src="' . $newUrl . '" width="' . $width . '" height="' . $height . '" />'; |
1064 | + | |
1065 | + $this->attachFileIdArray[] = $imageId; // コンテンツに実際に添付されている画像 | |
1065 | 1066 | break; |
1066 | 1067 | } |
1067 | 1068 | } |
@@ -1101,7 +1102,8 @@ | ||
1101 | 1102 | $newUrl = $this->createCmdUrlToCurrentWidget($param); |
1102 | 1103 | $destTag = '<img src="' . $this->getUrl($newUrl) . '" width="' . $destSize['width'] . '" height="' . $destSize['height'] . '" />'; |
1103 | 1104 | |
1104 | - $this->addImageCount++; // 読み込み画像追加数 | |
1105 | + $this->attachFileIdArray[] = $imageId; // コンテンツに実際に添付されている画像 | |
1106 | + // $this->addImageCount++; // 読み込み画像追加数 | |
1105 | 1107 | } |
1106 | 1108 | if (!$ret) $this->isErrorInReadImage = true; // 画像読み込みエラー発生 |
1107 | 1109 |