Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions html/webapp/modules/pm/components/Action.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ function setMessage()
if(!$this->_db->updateExecute("uploads", $params, "upload_id", true)) {
return false;
}
//アップロードファイルの参照を複数のメッセージ間で共有可能にする add by horiguchi@horitada.info
$messageUploadsParams = array(
"message_id" => $message_id,
"upload_id" => $upload_id
);
if(!$this->_db->insertExecute("pm_message_uploads", $messageUploadsParams, true)) {
return false;
}
}
}

Expand Down
18 changes: 13 additions & 5 deletions html/webapp/modules/pm/components/View.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1288,14 +1288,22 @@ function getUploadOwner($upload_id = 0){
function &getUploadReaders($upload_id = 0){
$readers = array();

//アップロードファイルの参照を複数のメッセージ間で共有可能にする add by horiguchi@horitada.info
$params = array(
$upload_id,
$upload_id
);

$sql = "SELECT r.receiver_user_id ".
"FROM {pm_message_receiver} as r, {uploads} as u ".
"WHERE u.unique_id = r.message_id ".
"AND u.upload_id = ?";
$sql = "( ".
"SELECT r.receiver_user_id ".
"FROM {pm_message_receiver} r ".
"LEFT JOIN {uploads} u ON u.unique_id = r.message_id ".
"WHERE u.upload_id = ? ".
") UNION ( ".
"SELECT r.receiver_user_id ".
"FROM {pm_message_receiver} r ".
"LEFT JOIN {pm_message_uploads} mu ON mu.message_id = r.message_id ".
"WHERE mu.upload_id = ? ".
") ";

$records = $this->_db->execute($sql, $params, null, null, true, null);
if ($records === false) {
Expand Down
2 changes: 1 addition & 1 deletion html/webapp/modules/pm/install.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "2.4.2.1"
version = "2.4.2.1-osws20161111"
action_name="pm_view_main_init"
delete_action = "pm_action_admin_operation"
module_update_action="pm_update"
Expand Down
8 changes: 8 additions & 0 deletions html/webapp/modules/pm/sql/mysql/table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,11 @@ CREATE TABLE `pm_forward` (
PRIMARY KEY (`forward_id`),
INDEX pm_forward_insert_user_id (insert_user_id)
) ENGINE=MyISAM;

-- -
-- テーブルの構造 `pm_message_uploads`
-- -
CREATE TABLE `pm_message_uploads` (
`message_id` int(11) unsigned NOT NULL,
`upload_id` int(11) unsigned NOT NULL
) ENGINE=MyISAM;
15 changes: 15 additions & 0 deletions html/webapp/modules/pm/update/Update.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ function execute()
$result = $this->db->execute($sql);
if($result === false) return false;
}

//アップロードファイルの参照を複数のメッセージ間で共有可能にする add by horiguchi@horitada.info
$adodb = $this->db->getAdoDbObject();
$metaTables = $adodb->MetaTables();
if (!in_array($this->db->getPrefix()."pm_message_uploads", $metaTables)) {
$sql = "CREATE TABLE `".$this->db->getPrefix()."pm_message_uploads` (" .
"`message_id` int(11) UNSIGNED NOT NULL,".
"`upload_id` int(11) UNSIGNED NOT NULL ".
") TYPE=MyISAM;";
$result = $this->db->execute($sql);
if ($result === false) {
return false;
}
}

return true;
}
}
Expand Down