From: <ir...@us...> - 2012-09-18 09:52:05
|
Revision: 10184 http://xoops.svn.sourceforge.net/xoops/?rev=10184&view=rev Author: irmtfan Date: 2012-09-18 09:51:54 +0000 (Tue, 18 Sep 2012) Log Message: ----------- bug fix: delete, pending, restore functionality (very important) Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/action.topic.php XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_synchronization.php XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/post.php XoopsModules/newbb/branches/irmtfan/newbb/class/topic.php XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html XoopsModules/newbb/branches/irmtfan/newbb/topicmanager.php XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/action.topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/action.topic.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/action.topic.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -96,7 +96,8 @@ $topics_obj =& $topic_handler->getAll(new Criteria("topic_id", "(".implode(",", $topic_id).")", "IN")); foreach (array_keys($topics_obj) as $id) { $topic_obj =& $topics_obj[$id]; - $topic_handler->delete($topic_obj,true); + // irmtfan should be set to false to not delete topic from database + $topic_handler->delete($topic_obj,false); $topic_handler->synchronization($topic_obj); $forums[$topic_obj->getVar("forum_id")] = 1; } Modified: XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_synchronization.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_synchronization.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_synchronization.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -9,7 +9,7 @@ * @version $Id: admin_synchronization.php 62 2012-08-17 10:15:26Z alfred $ * @package module::newbb */ - +// irmtfan - TODO - should be changed completly with Newbb new function newbb_synchronization include 'admin_header.php'; xoops_cp_header(); @@ -84,7 +84,8 @@ $forums_obj[$key]->setVar("forum_posts", $posts); } } - $sql = "SELECT COUNT(*) AS total FROM ".$xoopsDB->prefix("bb_topics")." WHERE approved=1 AND forum_id = ".$key; + // irmtfan approved=1 AND + $sql = "SELECT COUNT(*) AS total FROM ".$xoopsDB->prefix("bb_topics")." WHERE forum_id = ".$key; $result = $xoopsDB->query($sql); if ( $row = $xoopsDB->fetchArray($result) ) { if ($forums_obj[$key]->getVar("forum_topics") != $row['total']) { @@ -105,9 +106,10 @@ if ($start >= ($count = $topic_handler->getCount(new Criteria("approved", 1))) ) { break; } + // irmtfan WHERE approved=1 $sql = " SELECT topic_id, topic_last_post_id, topic_replies". " FROM " . $xoopsDB->prefix("bb_topics") . - " WHERE approved=1"; + " "; $result = $xoopsDB->query($sql, $limit, $start); while ( list($topic_id, $last_post, $replies) = $xoopsDB->fetchRow($result) ) { $sql = " SELECT MAX(post_id) AS last_post, COUNT(*) - 1 AS replies ". @@ -133,14 +135,16 @@ if ($start >= ($count = $post_handler->getCount(new Criteria("approved", 1))) ) { break; } + // irmtfan WHERE approved=1 AND $sql = " SELECT topic_id". " FROM " . $xoopsDB->prefix("bb_topics") . - " WHERE approved=1"; + " "; $result = $xoopsDB->query($sql, $limit, $start); while ( list($topic_id) = $xoopsDB->fetchRow($result) ) { + // irmtfan approved=1 AND $sql = " SELECT MIN(post_id) AS top_post". " FROM " . $xoopsDB->prefix("bb_posts") . - " WHERE approved=1 AND topic_id = {$topic_id}"; + " WHERE topic_id = {$topic_id}"; $ret = $xoopsDB->query($sql); list($top_post) = $xoopsDB->fetchRow($ret); $sql = " UPDATE ".$xoopsDB->prefix("bb_posts"). @@ -174,21 +178,22 @@ " FROM " . $xoopsDB->prefix("users"); $result = $xoopsDB->query($sql, $limit, $start); while ( list($uid) = $xoopsDB->fetchRow($result) ) { + // irmtfan approved=1 AND $sql = " SELECT count(*)". " FROM " . $xoopsDB->prefix("bb_topics") . - " WHERE approved=1 AND topic_poster = {$uid}"; + " WHERE topic_poster = {$uid}"; $ret = $xoopsDB->query($sql); list($topics) = $xoopsDB->fetchRow($ret); - + // irmtfan approved=1 AND $sql = " SELECT count(*)". " FROM " . $xoopsDB->prefix("bb_topics") . - " WHERE approved=1 AND topic_digest > 0 AND topic_poster = {$uid}"; + " WHERE topic_digest > 0 AND topic_poster = {$uid}"; $ret = $xoopsDB->query($sql); list($digests) = $xoopsDB->fetchRow($ret); - + // irmtfan approved=1 AND $sql = " SELECT count(*), MAX(post_time)". " FROM " . $xoopsDB->prefix("bb_posts") . - " WHERE approved=1 AND uid = {$uid}"; + " WHERE uid = {$uid}"; $ret = $xoopsDB->query($sql); list($posts, $lastpost) = $xoopsDB->fetchRow($ret); Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-09-18 09:51:54 UTC (rev 10184) @@ -1,3 +1,45 @@ +date 2012-09-18 +=================================== +1- bug fix: in topic delete process: in view all and view forum: after delete selected topics all topics and their posts will be wrongly deleted from database.(very important) +in newbb/action.topic.php + +2- bug fix: in post restore process: it will not approve post if approved = -1 (deleted) (important) +in newbb/class/post.php + +3- bug fix: in post delete process: wrongly set new pid for not approved posts and set pid=0(very important) +in newbb/class/post.php + +4- bug fix: wrongly check topic is not object after set it as object (important) +in newbb/class/topic.php + +5- bug fix: in view all topic page: if empty($_GET(status)) it will show all topics include deleted and pendings. +in newbb/list.topic.php + +6- bug fix: sync topic not added after delete +in newbb/topicmanager.php + +7- bug fix: remove unneeded codes: manually approve posts after restore +in newbb/topicmanager.php + +8- improve: ability to restore a topic in viewtopic page +in newbb/topicmanager.php, newbb/viewtopic.php +newbb/language/english/main.php, newbb/docs/lang_diff.txt + +9- fix: slash "/" missing in URL +in newbb/topicmanager.php + +10- fix: add "mode" smarty variable in viewforum to see admin links +in newbb/viewforum.php + +11- improve: in view all topic page: show all admin links in admin mode in the initial page loading +newbb/templates/newbb_viewall.html + +12- bug fix: admin main sync wrongly delete all pending and deleted posts/topics (very important) +in newbb/admin_synchronization.php + +13- bug fix: admin main sync (misc) wrongly delete all pending and deleted posts/topics when the pending_expire=0 in newbb/include/plugin.php (very important) +in newbb/class/post.php, newbb/class/topic.php + date 2012-09-16 =================================== 1- improve: Add forum_post_prefix smarty variable to have unique Ids for posts. Add js function to scroll to current post in viewtopic.php links. Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/post.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/post.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/post.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -634,7 +634,8 @@ $post_id = $post->getVar("post_id"); $wasApproved = $post->getVar("approved"); - if (empty($force) && $wasApproved) { + // irmtfan approve post if the approved = 0 (pending) or -1 (deleted) + if (empty($force) && $wasApproved > 0) { return true; } $post->setVar("approved", 1); @@ -913,10 +914,12 @@ unset($poster); } } - - $sql = "UPDATE " . $this->db->prefix("bb_posts") . " SET pid = " . $post->getVar('pid') . " WHERE pid=" . $post->getVar('post_id'); - if (!$result = $this->db->queryF($sql)) { - //xoops_error($this->db->error()); + // irmtfan - just update the pid for approved posts when the post is not topic (pid=0) + if (!$post->isTopic()) { + $sql = "UPDATE " . $this->db->prefix("bb_posts") . " SET pid = " . $post->getVar('pid') . " WHERE approved=1 AND pid=" . $post->getVar('post_id'); + if (!$result = $this->db->queryF($sql)) { + //xoops_error($this->db->error()); + } } } @@ -1010,6 +1013,12 @@ */ function cleanExpires($expire = 0) { + // irmtfan if 0 no cleanup look include/plugin.php + if (!func_num_args()){ + $newbbConfig = newbb_load_config(); + $expire = isset($newbbConfig["pending_expire"]) ? intval($newbbConfig["pending_expire"]) : 7; + } + if (empty($expire)) return false; $crit_expire = new CriteriaCompo(new Criteria("approved", 0, "<=")); //if (!empty($expire)) { $crit_expire->add(new Criteria("post_time", time()-intval($expire), "<")); Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -414,6 +414,12 @@ */ function cleanExpires($expire = 0) { + // irmtfan if 0 no cleanup look include/plugin.php + if (!func_num_args()){ + $newbbConfig = newbb_load_config(); + $expire = isset($newbbConfig["pending_expire"]) ? intval($newbbConfig["pending_expire"]) : 7; + } + if (empty($expire)) return false; $crit_expire = new CriteriaCompo(new Criteria("approved", 0, "<=")); $crit_expire->add(new Criteria("topic_time", time() - intval($expire), "<")); return $this->deleteAll($crit_expire, true/*, true*/); @@ -424,7 +430,8 @@ if (!is_object($object)) { $object =& $this->get(intval($object)); } - if (!is_object($object) || !$object->getVar("topic_id")) return false; + // irmtfan bad coding error - $object is object now + if (!$object->getVar("topic_id")) return false; $sql = " SELECT MAX(post_id) AS last_post, COUNT(*) AS total ". " FROM " . $this->db->prefix("bb_posts") . Modified: XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2012-09-18 09:51:54 UTC (rev 10184) @@ -46,3 +46,7 @@ define('_MD_NEWBB_HIDEUSERDATA','Hide User information'); define('_MD_NEWBB_HIDE','Hide'); define('_MD_NEWBB_SEE','See'); + +define('_MD_RESTORETOPIC','Restore this topic'); +define('_MD_TOPICRESTORE','The topic has been restored.'); +define('_MD_DESC_RESTORE','Once you press the restore button at the bottom of this form the topic you have selected, and all its related posts, will be restored.'); Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -154,6 +154,8 @@ define('_MD_MERGETOPIC','Merge this topic'); define('_MD_MOVETOPIC','Move this topic'); define('_MD_DELETETOPIC','Delete this topic'); +// irmtfan add restore to viewtopic +define('_MD_RESTORETOPIC','Restore this topic'); define('_MD_TOP','Top'); define('_MD_BOTTOM','Bottom'); define('_MD_PREVTOPIC','Previous Topic'); @@ -285,6 +287,8 @@ define('_MD_ERROR_BACK','Error - Please go back and try again.'); define('_MD_GOTONEWFORUM','View the updated topic'); define('_MD_TOPICDELETE','The topic has been deleted.'); +// irmtfan add restore to viewtopic +define('_MD_TOPICRESTORE','The topic has been restored.'); define('_MD_TOPICMERGE','The topic has been merged.'); define('_MD_TOPICMOVE','The topic has been moved.'); define('_MD_TOPICLOCK','The topic has been locked.'); @@ -303,6 +307,8 @@ define('_MD_DIGEST','Digest'); define('_MD_UNDIGEST','unDigest'); define('_MD_DESC_DELETE','Once you press the delete button at the bottom of this form the topic you have selected, and all its related posts, will be <strong>permanently</strong> removed.'); +// irmtfan add restore to viewtopic +define('_MD_DESC_RESTORE','Once you press the restore button at the bottom of this form the topic you have selected, and all its related posts, will be restored.'); define('_MD_DESC_MOVE','Once you press the move button at the bottom of this form the topic you have selected, and its related posts, will be moved to the forum you have selected.'); define('_MD_DESC_MERGE','Once you press the merge button at the bottom of this form the topic you have selected, and its related posts, will be merged to the topic you have selected.<br /><strong>The destination topic ID must be smaller than current one</strong>.'); define('_MD_DESC_LOCK','Once you press the lock button at the bottom of this form the topic you have selected will be locked. You may unlock it at a later time if you like.'); Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -62,7 +62,7 @@ //page_header.php define('_MD_MODERATEDBY','نظارت توسط'); define('_MD_SEARCH','جستجو'); -define('_MD_FORUMINDEX','%s صفحهی اصلی انجمنها'); +define('_MD_FORUMINDEX','صفحهی اصلی انجمنها'); define('_MD_POSTNEW','ارسال عنوان جدید'); define('_MD_REGTOPOST','برای ارسال پیام باید ابتدا ثبت نام کنید'); @@ -154,6 +154,8 @@ define('_MD_MERGETOPIC','این عنوان را ادغام کن'); define('_MD_MOVETOPIC','این عنوان را منتقل کن'); define('_MD_DELETETOPIC','این عنوان را حذف کن'); +// irmtfan add restore to viewtopic +define('_MD_RESTORETOPIC','این عنوان را بازیابی کن'); define('_MD_TOP','بالا'); define('_MD_BOTTOM','پایین'); define('_MD_PREVTOPIC','پیام قبلی'); @@ -284,14 +286,16 @@ define('_MD_RETURNFORUMINDEX','بازگشت به صفحهی اصلی انجمنها'); define('_MD_ERROR_BACK','خطا - لطفا بازگردید و دوباره سعی کنید.'); define('_MD_GOTONEWFORUM','دیدن عنوانهای به روز شده'); -define('_MD_TOPICDELETE','عنوان حذف شده.'); -define('_MD_TOPICMERGE','عنوان ادغام شده.'); -define('_MD_TOPICMOVE','عنوان منتقل شده.'); -define('_MD_TOPICLOCK','عنوان مورد نظر قفل شده.'); +define('_MD_TOPICDELETE','عنوان حذف شده است.'); +// irmtfan add restore to viewtopic +define('_MD_TOPICRESTORE','عنوان بازیابی شده است.'); +define('_MD_TOPICMERGE','عنوان ادغام شده است.'); +define('_MD_TOPICMOVE','عنوان منتقل شده است.'); +define('_MD_TOPICLOCK','عنوان مورد نظر قفل شده است.'); define('_MD_TOPICUNLOCK','قفل عنوان مورد نظر باز شد.'); -define('_MD_TOPICSTICKY','عنوان مورد نظر مهم(چسبان) شده.'); +define('_MD_TOPICSTICKY','عنوان مورد نظر مهم(چسبان) شده است.'); define('_MD_TOPICUNSTICKY','عنوان مورد نظر از حالت مهم(چسبان) در آمده.'); -define('_MD_TOPICDIGEST','عنوان خلاصه شده.'); +define('_MD_TOPICDIGEST','عنوان خلاصه شده است.'); define('_MD_TOPICUNDIGEST','عنوان از خلاصه درآمده.'); define('_MD_DELETE','حذف کن'); define('_MD_MOVE','منتقلکن'); @@ -303,6 +307,7 @@ define('_MD_DIGEST','خلاصه کن'); define('_MD_UNDIGEST','غیر خلاصه کن'); define('_MD_DESC_DELETE','وقتی شما دکمه حذف کن را در پایین میزنید؛ این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن <strong>کاملاً</strong>حذف خواهند شد.'); +define('_MD_DESC_RESTORE','وقتی شما دکمه بازیابی کن را در پایین میزنید؛ این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن بازیابی خواهند شد.'); define('_MD_DESC_MOVE','وقتی شما دکمه منتقل کن در پایین را میزنید، این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن به انجمنی که انتخاب کرده اید منتقل میشود.'); define('_MD_DESC_MERGE','وقتی شما دکمه ادغام کن در پایین را میزنید، این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن با عنوانی که انتخاب خواهید کرد ادغام می شود.<br /><strong>شماره شناسایی (ID) عنوان مقصد باید کوچکتر از این عنوان باشد</strong>.'); define('_MD_DESC_LOCK','وقتی شما دکمه قفل کن در پایین را میزنید، این عنوان که انتخاب کرده اید قفل خواهد شد. شما بعدا اگر بخواهید دوباره می توانید آن را از حالت قفل خارج کنید.'); Modified: XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -33,6 +33,8 @@ $type = intval( @$_GET['type'] ); $status = (!empty($_GET['status']) && in_array($_GET['status'], array("active", "pending", "deleted", "digest", "unreplied", "unread")))? $_GET['status'] : "all"; +//irmtfan parse status for rendering topic correctly - if empty($_GET(status)) it will show all topics include deleted and pendings. +$topic_renderer->parseVar('status',$status); $mode = (!empty($status) && in_array($status, array("active", "pending", "deleted"))) ? 2 : (!empty($_GET['mode']) ? intval($_GET['mode']) : 0); $isadmin = $GLOBALS["xoopsUserIsAdmin"]; Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html 2012-09-18 09:51:54 UTC (rev 10184) @@ -45,13 +45,16 @@ <input type="hidden" name="forum_id" value="<{$forum_id}>" /> <input type="submit" name="submit" value="<{$smarty.const._SUBMIT}>" /> | <a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/list.topic.php" target="_self" title="<{$smarty.const._MD_TYPE_VIEW}>"><{$smarty.const._MD_TYPE_VIEW}></a> -<{elseif $mode eq 1}> +<!-- irmtfan remove < { elseif $mode eq 1} > to show all admin links in admin mode in the initial page loading --> +<{else}> <a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/list.topic.php?status=active#admin" target="_self" title="<{$smarty.const._MD_TYPE_ADMIN}>"><{$smarty.const._MD_TYPE_ADMIN}></a> | <a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/list.topic.php?status=pending#admin" target="_self" title="<{$smarty.const._MD_TYPE_PENDING}>"><{$smarty.const._MD_TYPE_PENDING}></a> | <a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/list.topic.php?status=deleted#admin" target="_self" title="<{$smarty.const._MD_TYPE_DELETED}>"><{$smarty.const._MD_TYPE_DELETED}></a> | <a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/moderate.php" target="_self" title="<{$smarty.const._MD_TYPE_SUSPEND}>"><{$smarty.const._MD_TYPE_SUSPEND}></a> -<{else}> -<a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/list.topic.php?mode=1#admin" target="_self" title="<{$smarty.const._MD_TYPE_VIEW}>"><{$smarty.const._MD_TYPE_VIEW}></a> +<!-- irmtfan remove < { else } > no need for mode=1 +< { else } > +<!--<a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/list.topic.php?mode=1#admin" target="_self" title="<{$smarty.const._MD_TYPE_VIEW}>"><{$smarty.const._MD_TYPE_VIEW}></a> +--> <{/if}> </div> <br /> Modified: XoopsModules/newbb/branches/irmtfan/newbb/topicmanager.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/topicmanager.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/topicmanager.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -70,8 +70,8 @@ $online_handler =& xoops_getmodulehandler('online', 'newbb'); $online_handler->init($forum); } - -$action_array = array('merge', 'delete','move','lock','unlock','sticky','unsticky','digest','undigest'); +// irmtfan add restore to viewtopic +$action_array = array('merge', 'delete','restore', 'move','lock','unlock','sticky','unsticky','digest','undigest'); foreach ($action_array as $_action) { $action[$_action] = array( "name" => $_action, @@ -98,6 +98,8 @@ foreach ($topic_id as $tid) { $topic_obj =& $topic_handler->get($tid); $topic_handler->delete($topic_obj,false); + // irmtfan - sync topic after delete + $topic_handler->synchronization($topic_obj); $forum_handler->synchronization($forum); //$topic_obj->loadFilters("delete"); //sync($topic_id, "topic"); @@ -115,16 +117,20 @@ $topic_handler->synchronization($topic_obj); $forums[$topic_obj->getVar("forum_id")] = 1; } - $criteria = new Criteria('topic_id', "(".implode(",", $topic_id).")", "IN"); - $post_handler =& xoops_getmodulehandler('post', 'newbb'); - $post_handler->updateAll("approved", 1, $criteria, true); + //irmtfan remove - no need to approve posts manually - see class/post.php approve function $criteria_forum = new Criteria("forum_id", "(".implode(",", array_keys($forums)).")", "IN"); $forums_obj =& $forum_handler->getAll($criteria_forum); foreach (array_keys($forums_obj) as $id) { $forum_handler->synchronization($forums_obj[$id]); } - unset($topics_obj, $forums_obj); - echo $action[$mode]['msg']."<p><a href='".XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."viewforum.php?forum=$forum'>"._MD_RETURNTOTHEFORUM."</a></p><p><a href='index.php'>"._MD_RETURNFORUMINDEX."</a></p>"; + unset($topics_obj, $forums_obj); + // irmtfan add restore to viewtopic + $restoretopic_id=$topic_obj->getVar("topic_id"); + // irmtfan / missing in URL + echo $action[$mode]['msg']. + "<p><a href='".XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/viewtopic.php?topic_id=$restoretopic_id'>"._MD_VIEWTHETOPIC."</a></p>". + "<p><a href='".XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/viewforum.php?forum=$forum'>"._MD_RETURNTOTHEFORUM."</a></p>". + "<p><a href='index.php'>"._MD_RETURNFORUMINDEX."</a></p>"; } elseif ('merge' == $mode) { $post_handler =& xoops_getmodulehandler('post', 'newbb'); Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -44,6 +44,8 @@ $forum_id = intval($_GET['forum']); $type = @intval($_GET['type']); $status = (!empty($_GET['status']) && in_array($_GET['status'], array("active", "pending", "deleted", "digest", "unreplied", "unread")))? $_GET['status'] : ""; +// irmtfan add mode +$mode = (!empty($status) && in_array($status, array("active", "pending", "deleted"))) ? 2 : (!empty($_GET['mode']) ? intval($_GET['mode']) : 0); $forum_handler = xoops_getmodulehandler('forum', 'newbb'); $forum_obj = $forum_handler->get($forum_id); @@ -81,8 +83,11 @@ /* Only admin has access to admin mode */ if (!$isadmin) { $status = (!empty($status) && in_array($status, array("active", "pending", "deleted"))) ? "" : $status; + // irmtfan add mode + $mode=0; } - +// irmtfan add mode +$xoopsTpl->assign('mode', $mode); $xoopsTpl->assign('status', $status); if ( $isadmin ) { $xoopsTpl->assign('forum_index_cpanel',array("link" => "admin/index.php", "name" => _MD_ADMINCP)); Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-09-17 13:16:30 UTC (rev 10183) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-09-18 09:51:54 UTC (rev 10184) @@ -312,6 +312,8 @@ $ad_merge = ""; $ad_move = ""; $ad_delete = ""; +// irmtfan add restore to viewtopic +$ad_restore=""; $ad_lock = ""; $ad_unlock = ""; $ad_sticky = ""; @@ -319,6 +321,9 @@ $ad_digest = ""; $ad_undigest = ""; +// START irmtfan add restore to viewtopic +// if the topic is active +if ($topic_obj->getVar('approved') > 0 ){ $admin_actions['merge'] = array( "link" => XOOPS_URL.'/modules/'.$xoopsModule->getVar("dirname", "n").'/topicmanager.php?mode=merge&topic_id='.$topic_id, "name" => _MD_MERGETOPIC, @@ -364,6 +369,15 @@ "image" => $ad_undigest, "name" => _MD_UNDIGESTTOPIC); } +// if the topic is pending/deleted then restore/approve +}else{ +$admin_actions['restore'] = array( + "link" => XOOPS_URL.'/modules/'.$xoopsModule->getVar("dirname", "n").'/topicmanager.php?mode=restore&topic_id='.$topic_id, + "name" => _MD_RESTORETOPIC, + "image" => $ad_restore); +} +// END irmtfan add restore to viewtopic + $xoopsTpl->assign_by_ref('admin_actions', $admin_actions); $xoopsTpl->assign('viewer_level', intval(($isadmin) ? 2 : is_object($xoopsUser)) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |