svnno****@sourc*****
svnno****@sourc*****
2009年 8月 28日 (金) 11:43:30 JST
Revision: 37 http://sourceforge.jp/projects/xoopstokita/svn/view?view=rev&revision=37 Author: tokita Date: 2009-08-28 11:43:30 +0900 (Fri, 28 Aug 2009) Log Message: ----------- imageテーブルのbookmark数の増減処理を追加 Modified Paths: -------------- spicky/trunc/xoops_trust_path/modules/spicky/include/db.php spicky/trunc/xoops_trust_path/modules/spicky/main/bookmark_add.php spicky/trunc/xoops_trust_path/modules/spicky/main/bookmark_manage_delete.php spicky/trunc/xoops_trust_path/modules/spicky/sql/mysql.sql Modified: spicky/trunc/xoops_trust_path/modules/spicky/include/db.php =================================================================== --- spicky/trunc/xoops_trust_path/modules/spicky/include/db.php 2009-08-28 01:20:28 UTC (rev 36) +++ spicky/trunc/xoops_trust_path/modules/spicky/include/db.php 2009-08-28 02:43:30 UTC (rev 37) @@ -172,7 +172,24 @@ $xoopsDB->queryF($sql); } +function spicky_update_image_bookmark($id, $plus_maenas) +{ + global $xoopsDB; + global $mydirname; + + $sql = "UPDATE "; + $sql .= $xoopsDB->prefix($mydirname . '_image'); + $sql .= " SET "; + if (0 < $plus_maenas) { + $sql .= ' bookmark = bookmark + 1 '; + } else { + $sql .= ' bookmark = bookmark - 1 '; + } + $sql .= ' WHERE id = ' . intval($id); + $xoopsDB->queryF($sql); +} + function spicky_delete_image($id) { global $xoopsDB; Modified: spicky/trunc/xoops_trust_path/modules/spicky/main/bookmark_add.php =================================================================== --- spicky/trunc/xoops_trust_path/modules/spicky/main/bookmark_add.php 2009-08-28 01:20:28 UTC (rev 36) +++ spicky/trunc/xoops_trust_path/modules/spicky/main/bookmark_add.php 2009-08-28 02:43:30 UTC (rev 37) @@ -27,6 +27,8 @@ spicky_add_bookmark($_GET['image_id'], $user_id); +spicky_update_image_bookmark($_GET['image_id'], 1); + print _MD_SPICKY_ADDED_BOOKAMRK; exit(); Modified: spicky/trunc/xoops_trust_path/modules/spicky/main/bookmark_manage_delete.php =================================================================== --- spicky/trunc/xoops_trust_path/modules/spicky/main/bookmark_manage_delete.php 2009-08-28 01:20:28 UTC (rev 36) +++ spicky/trunc/xoops_trust_path/modules/spicky/main/bookmark_manage_delete.php 2009-08-28 02:43:30 UTC (rev 37) @@ -8,6 +8,7 @@ foreach ($_POST['bookmark_id'] as $id) { spicky_delete_bookmark($id); + spicky_update_image_bookmark($id, 0); } redirect_header('index.php?page=bookmark_manage', 2, _MD_SPICKY_DELETED_BOOKMARK); Modified: spicky/trunc/xoops_trust_path/modules/spicky/sql/mysql.sql =================================================================== --- spicky/trunc/xoops_trust_path/modules/spicky/sql/mysql.sql 2009-08-28 01:20:28 UTC (rev 36) +++ spicky/trunc/xoops_trust_path/modules/spicky/sql/mysql.sql 2009-08-28 02:43:30 UTC (rev 37) @@ -32,7 +32,7 @@ `desc` text default '', `type` int(1) NOT NULL, `view` int(11) NOT NULL default 0, - `bookamark` int(11) NOT NULL default 0, + `bookmark` int(11) NOT NULL default 0, `paint_from_id` int(11) default NULL, `public_level` int not null default 1, `pasteok` int(1) not null default 1,