From: <ir...@us...> - 2012-10-10 11:01:42
|
Revision: 10211 http://sourceforge.net/p/xoops/svn/10211 Author: irmtfan Date: 2012-10-10 11:01:37 +0000 (Wed, 10 Oct 2012) Log Message: ----------- bug fix: search.php, list.topic.php - feature add: topic search, highlight keywords, show post text in search Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php XoopsModules/newbb/branches/irmtfan/newbb/class/post.php XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php XoopsModules/newbb/branches/irmtfan/newbb/include/search.inc.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php XoopsModules/newbb/branches/irmtfan/newbb/search.php XoopsModules/newbb/branches/irmtfan/newbb/templates/css/language/english/style.css XoopsModules/newbb/branches/irmtfan/newbb/templates/css/language/persian/style.css XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_index.html XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_search.html XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_searchresults.html XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewforum.html XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewpost.html XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewtopic.html Added Paths: ----------- XoopsModules/newbb/branches/irmtfan/newbb/include/functions.text.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-10 11:01:37 UTC (rev 10211) @@ -1,3 +1,52 @@ +date 2012-10-10 +=================================== +1- bug fix: in list.topic.php: remove empty arrays in getStatus function +in newbb/class/topic.renderer.php + +2- bug fix: add template smarty variables to search.php to save the user inputs in submit. move select boxes from template to php file +in newbb/templates/newbb_search.html, newbb/search.php + +3- bug fix: in search.php (previously in newbb_search.html): wrongly the andor value="all" (it should be value="AND"), change default andor="OR" to andor="AND" to be like XOOPS CORE setting +in newbb/search.php + +4- bug fix: wrongly p.post_time = since (should be >= since) +in newbb/class/topic.renderer.php + +5- bug fix: $hidvar should be <{$hidvar}> smarty. Improve $hidvar and $hidval in template +in newbb/templates/newbb_viewall.html + +6- bug fix: we need old vars for selection boxes. +in newbb/class/topic.renderer.php, newbb/templates/newbb_viewall.html + +7- bug fix: remove name attribute from submit buttons when method=get +in newbb/templates/newbb_index.html, newbb/templates/newbb_viewall.html, newbb/templates/newbb_viewforum.html, newbb/templates/newbb_search.html + +8- bug fix: wrongly dont parse negative values (categories) when newbb_forumSelectBox is multiple. add a new getIdsByValues function to class/forum.php +in newbb/class/forum.php, newbb/include/search.inc.php, newbb/include/topic.renderer.php, + +9- bug fix: id="xo-pagenav" is hardcoded in the XOOPS Core 2.5.5 and 2.6 (mrphilong/irmtfan) +in newbb/templates/newbb_viewall.html, newbb/templates/newbb_viewforum.html, +newbb/templates/newbb_viewpost.html, newbb/templates/newbb_viewtopic.html + +10- feature add: add newbb_forumSelectBox multiple to list.topic.php +in newbb/class/topic.renderer.php, newbb/templates/newbb_viewall.html + +11- feature add: show search results: 1- post title 2- post text +in newbb/search.php, newbb/templates/newbb_search.html, newbb/templates/newbb_searchresults.html, newbb/language/LANG/main.php, newbb/docs/lang_diff.txt + +12- feature add: add "select text" and "highlighter" to search keywords. add a new file include/functions.text.php to handle text +in newbb/include/functions.text.php, newbb/include/plugin.php, newbb/class/post.php, newbb/include/search.inc.php, newbb/search.php +newbb/templates/css/language/LANG/style.css + +13- bug fix: remove hardcode database access, solve order issues, reduce queries, permissions issues. file include/search.inc.php is completely rewritten (important) +in newbb/include/search.inc.php + +14- feature add: add topic search to viewtopic and viewpost +in newbb/templates/newbb_viewtopic.html, newbb/search.php, newbb/language/LANG/main.php, newbb/docs/lang_diff.txt + +15- bug fix: in list.topic.php the topic_link is hardcoded. add topic_excerpt +in newbb/class/topic.renderer.php + date 2012-10-02 =================================== 1- feature add: jump to last post read in the topic when the post_id is not in the URL(kwaltman/irmtfan) Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-10-10 11:01:37 UTC (rev 10211) @@ -917,5 +917,44 @@ unset($parents, $parents_list); return $ret; } + + // START irmtfan - get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums + /** + * function for get forum Ids by positive and negative values + * + * @param text $values: positive values = forums | negative values = cats | $values=0 = all valid forums, $permission , true/false $parse_cats + * @return $valid_forums + */ + function getIdsByValues($values = 0, $permission = "access", $parse_cats = true) { + // Get all valid forums with this permission + $valid_forums = $this->getIdsByPermission($permission); + // if no value or value=0 return all valid forums + if ( empty($values) ) { + return $valid_forums; + } + $values = is_numeric($values) ? array($values) : $values; + //parse negative values to category IDs + $forums = array(); + $cats = array(); + foreach ($values as $val) { + if ($val == 0) { + // value=0 => all valid forums + return $valid_forums; + } elseif ($val > 0) { + $forums[] = $val; + } else { + $cats[] = abs($val); + } + } + // if dont want to parse categories OR no cats return all forums + if ( empty($parse_cats) || empty($cats) ) { + return array_intersect($valid_forums, $forums); + } + // Get all forums by category IDs + $forumObjs = $this->getForumsByCategory($cats, $permission, true); + $forums = array_merge( $forums, array_keys($forumObjs) ); + return array_intersect($valid_forums, $forums); + } + // END irmtfan - get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums } ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/post.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/post.php 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/post.php 2012-10-10 11:01:37 UTC (rev 10211) @@ -348,6 +348,7 @@ mod_loadFunctions("time", "newbb"); mod_loadFunctions("render", "newbb"); + mod_loadFunctions("text", "newbb"); // irmtfan add text functions $post_id = $this->getVar('post_id'); $topic_id = $this->getVar('topic_id'); @@ -388,6 +389,15 @@ $post_text = $this->getVar('post_text'); $post_attachment = $this->displayAttachment(); } + // START irmtfan add highlight feature + // Hightlighting searched words + $post_title = $this->getVar('subject'); + if (isset($_GET['keywords']) && !empty($_GET['keywords'])) { + $keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords']))); + $post_text = newbb_highlightText($post_text, $keywords); + $post_title = newbb_highlightText($post_title, $keywords); + } + // END irmtfan add highlight feature if ( isset($viewtopic_users[$this->getVar('uid')]) ) { $poster = $viewtopic_users[$this->getVar('uid')]; } else { @@ -547,7 +557,7 @@ 'post_parent_id' => $this->getVar('pid'), 'post_date' => newbb_formatTimestamp($this->getVar('post_time')), 'post_image' => $post_image, - 'post_title' => $this->getVar('subject'), + 'post_title' => $post_title, // irmtfan $post_title to add highlight keywords 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $this->displayPostEdit(), Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-10-10 11:01:37 UTC (rev 10211) @@ -101,9 +101,13 @@ case "forum": if (is_numeric($val)) { $val = intval($val); - } elseif (!empty($val)) { - $val = implode("|", array_map("intval", explode(", ", $val))); + // START irmtfan - if the forum is array + } elseif (is_array($val)) { + $val = implode("|", $val); + //} elseif (!empty($val)) { + // $val = implode("|", array_map("intval", explode(", ", $val))); } + // END irmtfan - if the forum is array break; case "uid": @@ -199,12 +203,16 @@ switch($var) { case "forum": $forum_handler = xoops_getmodulehandler('forum', 'newbb'); + // START irmtfan - get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums // Get accessible forums - $access_forums = $forum_handler->getIdsByPermission(); + $access_forums = $forum_handler->getIdsByValues(array_map("intval", @explode("|", $val))); // Filter specified forums if any - if (!empty($val) && $_forums = @explode("|", $val)) { - $access_forums = array_intersect($access_forums, array_map("intval", $_forums)); - } + //if (!empty($val) && $_forums = @explode("|", $val)) { + //$access_forums = array_intersect($access_forums, array_map("intval", $_forums)); + //} + $this->vars["forum"] = $this->setVar("forum", $access_forums); + // END irmtfan - get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums + if (empty($access_forums)) { $this->noperm = true; // irmtfan - it just return return the forum_id only when the forum_id is the first allowed forum - no need for this code implode is enough removed. @@ -223,7 +231,8 @@ case "since": if (!empty($val)) { - $this->query["where"][] = "p.post_time = ". (time() - newbb_getSinceTime($val)); + // irmtfan - should be >= instead of = + $this->query["where"][] = "p.post_time >= ". (time() - newbb_getSinceTime($val)); } break; @@ -320,14 +329,14 @@ function getStatus($type = null, $status = null) { $links = array( - "" => "", + //"" => "", /* irmtfan remove empty array */ "all" => _ALL, "digest" => _MD_DIGEST, "unreplied" => _MD_UNREPLIED, "unread" => _MD_UNREAD, ); $links_admin = array( - " " => "", + //" " => "", /* irmtfan remove empty array */ "active" => _MD_TYPE_ADMIN, "pending" => _MD_TYPE_PENDING, "deleted" => _MD_TYPE_DELETED, @@ -356,8 +365,17 @@ { $selection = array("action" => $this->page); $selection["vars"] = $this->vars; - $selection["vars"]["order"] = $selection["vars"]["since"] = null; - + // irmtfan need vars for other selections + //$selection["vars"]["order"] = $selection["vars"]["since"] = null; + // START irmtfan add forum selection box + mod_loadFunctions("forum", "newbb"); + $forum_selected = empty($this->vars["forum"]) ? null : explode("|", @$this->vars["forum"]); + $selection["forum"] = '<select name="forum[]" multiple="multiple">'; + $selection["forum"] .= '<option value="0">'._MD_ALL.'</option>'; + $selection["forum"] .= newbb_forumSelectBox($forum_selected); + $selection["forum"] .= '</select>'; + // END irmtfan add forum selection box + $sort_selected = empty($this->vars["sort"]) ? "lastpost" : $this->vars["sort"]; $sorts = $this->getSort("", "title"); $selection["sort"] = "<select name='sort'>"; @@ -677,7 +695,8 @@ 'topic_icon' => $topic_icon, 'type_id' => $myrow['type_id'], 'topic_title' => $topic_title, - 'topic_link' => XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'], // . '&forum=' . $myrow['forum_id'], + //'topic_link' => XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'], // . '&forum=' . $myrow['forum_id'], // irmtfan comment + 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'], // irmtfan remove hardcode link 'rating_img' => $rating_img, 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, Modified: XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2012-10-10 11:01:37 UTC (rev 10211) @@ -58,6 +58,11 @@ define("_MI_SINCE_DEFAULT","'Since' default value in selection box"); define("_MI_SINCE_DEFAULT_DESC","Default value in the selection box if not specified by users. Positive value for days and negative value for hours. (0=From the beginning) (365=From the last year)"); +add: +define('_MD_SEARCHTOPIC','Search Topic'); +define('_MD_SHOWSEARCH','Show results:'); +define('_MD_SEARCHPOSTTEXT','posts text'); + admin.php --------- define('_AM_NEWBB_REPORTSAVE','Selected Reports have been processed successfully'); Added: XoopsModules/newbb/branches/irmtfan/newbb/include/functions.text.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/functions.text.php (rev 0) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/functions.text.php 2012-10-10 11:01:37 UTC (rev 10211) @@ -0,0 +1,102 @@ +<?php +/** + * CBB 4.0, or newbb, the forum module for XOOPS project + * + * @copyright The XOOPS Project http://xoops.sf.net + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author Taiwen Jiang (phppp or D.J.) <ph...@us...>, irmtfan <ir...@us...> + * @since 4.3 + * @version $Id $ + * @package module::newbb + */ + +if (!defined('XOOPS_ROOT_PATH')) { exit(); } + +define("NEWBB_FUNCTIONS_TEXT_LOADED", TRUE); + +IF (!defined("NEWBB_FUNCTIONS_TEXT")): +define("NEWBB_FUNCTIONS_TEXT", 1); +/** +* function for select from a text where it have some keywords +* +* @param text $text, array text $queryarray, int $selectlength = 200, int $selectstartlag = 100, int $highlight = true +* @return text $select_text +*/ + +function newbb_selectText($text, $queryarray, $selectstartlag = 100, $selectlength = 200, $striptags = true, $excludetags = '<br>') { + $sanitized_text = $striptags ? strip_tags($text, $excludetags) : $text; + $queryarray = newbb_str2array($queryarray); + $text_i = strtolower($sanitized_text); + $queryarray = array_map('strtolower', $queryarray); + $lengtharray = array_map('strlen', $queryarray); + $maxlengthquery = max($lengtharray); + $select_text = ""; + $startpos = 0; + $endpos = strlen($sanitized_text); + while ($startpos < $endpos) { + $pos = $endpos; + foreach ($queryarray as $query) { + if ( ($thispos = strpos($text_i, $query, $startpos)) !== false) { + $pos = min($thispos, $pos); + } + } + if ($pos == $endpos) break; + $start = max(($pos - $selectstartlag), ($startpos - $maxlengthquery), 0); // $startpos is the last position in the previous select text + $length = $maxlengthquery + $selectlength; //xoops_local("strlen", $query) + 200; + $select_text .= "<p>[...] " . xoops_substr($sanitized_text, $start, $length, " [...]") . "</p>"; + $startpos = $start + $length + 1; // start searching from next position. + } + return '<span class="newbb_select_text">' . $select_text . '</span>'; + +} +/** +* function for highlight a text when it have some keywords +* +* @param text $text, array text $queryarray +* @return text $highlight_text +*/ + +function newbb_highlightText($text, $queryarray) { + global $xoopsModuleConfig; + if (empty($xoopsModuleConfig['highlight_search_enable'])) return $text; + $queryarray = newbb_str2array($queryarray); + // if $queryarray is string + $highlight_text = $text; + foreach ($queryarray as $key => $query) { + // use preg_replace instead of str_replace to exclude all $queries inside html span tag + $highlight_text = preg_replace("/(?!(?:[^<]+>|[^>]+<\/a>))(". preg_quote($query) .")/si", newbb_highlighter($query, $key), $highlight_text); + } + return $highlight_text; +} +/** +* function for highlighting search results +* +* @param text $query, int $i +* @return unknown +*/ +function newbb_highlighter($query, $i) { + return '<span class="newbb_highlight term' . $i . '">' . $query . '</span>'; +} +/** +* function for convert string to array +* +* @param text/array $str +* @return unknown +*/ + +function newbb_str2array($str) { + if (!is_array($str)) { + // split the phrase by any number of commas or space characters, + // which include " ", \r, \t, \n and \f + $temp_str = preg_split('/[\s,]+/', $str); + $strarray = array(); + foreach ($temp_str as $s) { + $strarray[] = addSlashes($s); + } + return $strarray; + } else { + return $str; + } +} +ENDIF; +?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2012-10-10 11:01:37 UTC (rev 10211) @@ -96,6 +96,8 @@ $customConfig["display_text_each_link"] = include XOOPS_ROOT_PATH."/modules/newbb/include/display.php"; // jump to last post read in the topic $customConfig["jump_to_topic_last_post_read_enabled"] = true; +// highlight keywords in search +$customConfig["highlight_search_enable"] = true; // END hacked by irmtfan return $customConfig; Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/search.inc.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/search.inc.php 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/search.inc.php 2012-10-10 11:01:37 UTC (rev 10211) @@ -1,160 +1,116 @@ <?php -// $Id: search.inc.php 62 2012-08-17 10:15:26Z alfred $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2000 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// You may not change or alter any portion of this comment or credits // -// of supporting developers from this source code or any supporting // -// source code which is considered copyrighted (c) material of the // -// original comment or credit authors. // -// // -// This program is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// Author: phppp (D.J., in...@gm...) // -// URL: http://xoopsforge.com, http://xoops.org.cn // -// Project: Article Project // -// ------------------------------------------------------------------------ // +/** + * CBB 4.0, or newbb, the forum module for XOOPS project + * + * @copyright The XOOPS Project http://xoops.sf.net + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author Taiwen Jiang (phppp or D.J.) <ph...@us...>, irmtfan <ir...@us...> + * @since 4.3 + * @version $Id $ + * @package module::newbb + */ +// completely rewrite by irmtfan - remove hardcode database access, solve order issues, add post_text & topic_id, add highlight and reduce queries if (!defined('XOOPS_ROOT_PATH')) { exit(); } -require_once(XOOPS_ROOT_PATH.'/modules/newbb/include/functions.php'); -function newbb_search($queryarray, $andor, $limit, $offset, $userid, $forums = 0, $sortby = 0, $searchin = "both", $subquery = "") +function newbb_search($queryarray, $andor, $limit, $offset, $userid, $forums = 0, $sortby = 0, $searchin = "both", $criteriaExtra = "") { - global $xoopsDB, $xoopsConfig, $myts, $xoopsUser; + global $myts; - $uid = ( is_object($xoopsUser) && $xoopsUser->isactive() ) ? $xoopsUser->getVar('uid') : 0; - $forum_handler = xoops_getmodulehandler('forum', 'newbb'); - $valid_forums = $forum_handler->getIdsByPermission(); + $valid_forums = $forum_handler->getIdsByValues($forums); // can we use view permission? $forum_handler->getIdsByValues($forums, "view") + + $criteriaPost = new CriteriaCompo(); + $criteriaPost->add(new Criteria('p.approved', 1), 'AND'); // only active posts - if (is_array($forums) && count($forums) > 0) { - $valid_forums = array_intersect($valid_forums, $forums); - } elseif (is_numeric($forums) && $forums > 0) { - $valid_forums = array_intersect($valid_forums, array($forums)); + $forum_list = array();// get forum lists just for forum names + if (count($valid_forums) > 0) { + $criteriaPermissions = new CriteriaCompo(); + $criteriaPermissions->add(new Criteria("p.forum_id", "(".implode(",",$valid_forums).")", "IN"), 'AND'); + $forum_list = $forum_handler->getAll(new Criteria("forum_id", "(".implode(", ", $valid_forums).")", "IN"), "forum_name" , false); } - - $sql = 'SELECT p.uid,f.forum_id, p.topic_id, p.poster_name, p.post_time,'; - $sql .= ' f.forum_name, p.post_id, p.subject - FROM '.$xoopsDB->prefix('bb_posts').' p, - '.$xoopsDB->prefix('bb_posts_text').' pt, - '.$xoopsDB->prefix('bb_forums').' f'; - $sql .= ' WHERE p.post_id = pt.post_id'; - $sql .= ' AND p.approved = 1'; - $sql .= ' AND p.forum_id = f.forum_id'; -// AND p.uid = u.uid'; // In case exists a userid with which the associated user is removed, this line will block search results. Can do nothing unless xoops changes its way dealing with user removal - if (!empty($valid_forums)) { - $sql .= ' AND f.forum_id IN ('.implode(',', $valid_forums).')'; - } - - $isUser=false; + if ( is_numeric($userid) && $userid != 0 ) { - $sql .= " AND p.uid=".$userid." "; - $isUser=true; - } else - // TODO - if (is_array($userid) && count($userid) > 0) { + $criteriaUser = new CriteriaCompo(); + $criteriaUser->add(new Criteria('p.uid', $userid), 'OR'); + } elseif (is_array($userid) && count($userid) > 0) { $userid = array_map('intval', $userid); - $sql .= " AND p.uid IN (".implode(',', $userid).") "; - $isUser=true; + $criteriaUser = new CriteriaCompo(); + $criteriaUser->add(new Criteria('p.uid', '(' . implode(',', $userid) . ')', 'IN'), 'OR'); } - + $count = count($queryarray); + $hightlight_key = ""; if ( is_array($queryarray) && $count > 0) { - switch ($searchin) { - case 'title': - $sql .= " AND ((p.subject LIKE '%$queryarray[0]%')"; - for ($i = 1; $i < $count; $i++) { - $sql .= " $andor "; - $sql .= "(p.subject LIKE '%$queryarray[$i]%')"; - } - $sql .= ") "; - break; - - case 'text': - $sql .= " AND ((pt.post_text LIKE '%$queryarray[0]%')"; - for ($i = 1; $i < $count; $i++) { - $sql .= " $andor "; - $sql .= "(pt.post_text LIKE '%$queryarray[$i]%')"; - } - $sql .= ") "; - break; - case 'both' : - default; - $sql .= " AND ((p.subject LIKE '%$queryarray[0]%' OR pt.post_text LIKE '%$queryarray[0]%')"; - for ($i = 1; $i < $count; $i++) { - $sql .= " $andor "; - $sql .= "(p.subject LIKE '%$queryarray[$i]%' OR pt.post_text LIKE '%$queryarray[$i]%')"; - } - $sql .= ") "; - break; - } + $criteriaKeywords = new CriteriaCompo(); + for ($i = 0; $i < $count; $i++) { + $criteriaKeyword = new CriteriaCompo(); + switch ($searchin) { + case 'title': + $criteriaKeyword->add(new Criteria('p.subject', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); + break; + case 'text': + $criteriaKeyword->add(new Criteria('t.post_text', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); + break; + case 'both' : + default : + $criteriaKeyword->add(new Criteria('p.subject', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); + $criteriaKeyword->add(new Criteria('t.post_text', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); + break; + } + $criteriaKeywords->add($criteriaKeyword, $andor); + unset($criteriaKeyword); + } + // add highlight keywords to post links + $hightlight_key = "&keywords=" . implode('+', $queryarray); } + $criteria = new CriteriaCompo(); + $criteria->add($criteriaPost, 'AND'); + if (!empty($criteriaPermissions)) { + $criteria->add($criteriaPermissions, 'AND'); + } + if (!empty($criteriaUser)) { + $criteria->add($criteriaUser, 'AND'); + } + if (!empty($criteriaKeywords)) { + $criteria->add($criteriaKeywords, 'AND'); + } + if (!empty($criteriaExtra)) { + $criteria->add($criteriaExtra, 'AND'); + } + //$criteria->setLimit($limit); // no need for this + //$criteria->setStart($offset); // no need for this + + if (empty($sortby)) { + $sortby = "p.post_time"; + } + $criteria->setSort($sortby); + $order = 'ASC'; + if ($sortby == "p.post_time") { + $order = 'DESC'; + } + $criteria->setOrder($order); + + $post_handler =& xoops_getmodulehandler('post', 'newbb'); + $posts = $post_handler->getPostsByLimit($criteria, $limit, $offset); - if (!$sortby) { - $sortby = "p.post_time DESC"; - } - $sql .= $subquery." ORDER BY ".$sortby; - $result = $xoopsDB->query($sql,$limit,$offset); - $ret = array(); - $users = array(); + $ret = array(); $i = 0; - while($myrow = $xoopsDB->fetchArray($result)) { - $ret[$i]['link'] = XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=".$myrow['post_id']; - $ret[$i]['title'] = $myrow['subject']; - $ret[$i]['time'] = $myrow['post_time']; - $ret[$i]['uid'] = $myrow['uid']; - $ret[$i]['forum_name'] = $myts->htmlSpecialChars($myrow['forum_name']); - $ret[$i]['forum_link'] = XOOPS_URL . "/modules/newbb/viewforum.php?forum=".$myrow['forum_id']; - $users[$myrow['uid']] = 1; - $ret[$i]['poster_name'] = $myrow['poster_name']; + foreach (array_keys($posts) as $id) { + $post =& $posts[$id]; + $post_data = $post->getPostBody(); + $ret[$i]['topic_id'] = $post->getVar('topic_id'); + $ret[$i]['link'] = XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $post->getVar('post_id') . $hightlight_key; // add highlight key + $ret[$i]['title'] = $post_data['subject']; + $ret[$i]['time'] = $post_data['date']; + $ret[$i]['forum_name'] = $myts->htmlSpecialChars($forum_list[$post->getVar('forum_id')]["forum_name"]); + $ret[$i]['forum_link'] = XOOPS_URL . "/modules/newbb/viewforum.php?forum=" .$post->getVar('forum_id'); + $ret[$i]['post_text'] = $post_data['text']; + $ret[$i]['uid'] = $post->getVar('uid'); + $ret[$i]['poster'] = $post->getVar('uid') ? '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$ret[$i]['uid'].'">' . $post_data['author'] . '</a>' : $post_data['author']; $i++; } - - if (count($users)>0) { - $member_handler = xoops_gethandler('member'); - $userid_array = array_keys($users); - $user_criteria = "(".implode(",",$userid_array).")"; - $users = $member_handler->getUsers( new Criteria('uid', $user_criteria, 'IN'), true); - } else { - $users = null; - } - - $newbbConfig = newbb_load_config(); - - $count = count($ret); - for($i =0; $i < $count; $i ++ ) { - if ($ret[$i]['uid'] >0) { - if ( isset($users[$ret[$i]['uid']]) && (is_object($users[$ret[$i]['uid']])) && ($users[$ret[$i]['uid']]->isActive()) ) { - $poster = ($newbbConfig['show_realname'] && $users[$ret[$i]['uid']]->getVar('name'))? $users[$ret[$i]['uid']]->getVar('name') : $users[$ret[$i]['uid']]->getVar('uname'); - $poster = $myts->htmlSpecialChars($poster); - $ret[$i]['poster'] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$ret[$i]['uid'].'">'.$poster.'</a>'; - $title = $myts->htmlSpecialChars($ret[$i]['title']); - } else { - $ret[$i]['poster'] = $xoopsConfig['anonymous']; - $ret[$i]['uid'] = 0; // Have to force this to fit xoops search.php - } - } else { - $ret[$i]['poster'] = (empty($ret[$i]['poster_name']))?$xoopsConfig['anonymous']:$myts->htmlSpecialChars($ret[$i]['poster_name']); - $ret[$i]['uid'] = 0; - } - } - unset($users); - return $ret; } ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2012-10-10 11:01:37 UTC (rev 10211) @@ -497,4 +497,7 @@ define('_MD_NEWBB_SEE','See'); // votepolls.php - irmtfan define('_MD_POLL_NOOPTION','You must choose an option !!'); +define('_MD_SEARCHTOPIC','Search Topic'); +define('_MD_SHOWSEARCH','Show results:'); +define('_MD_SEARCHPOSTTEXT','Posts text'); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2012-10-10 11:01:37 UTC (rev 10211) @@ -495,4 +495,7 @@ define('_MD_NEWBB_SEE','نمایش'); // votepolls.php - irmtfan define('_MD_POLL_NOOPTION','شما باید یکی از گزینه ها را انتخاب کنید!!'); +define('_MD_SEARCHTOPIC','جستجو تاپیک'); +define('_MD_SHOWSEARCH','نمایش نتایج:'); +define('_MD_SEARCHPOSTTEXT','متن پست'); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/search.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-10-10 11:01:37 UTC (rev 10211) @@ -45,6 +45,7 @@ mod_loadFunctions("render", "newbb"); mod_loadFunctions("forum", "newbb"); mod_loadFunctions("time", "newbb"); +mod_loadFunctions("text", "newbb"); // irmtfan add text functions include_once XOOPS_ROOT_PATH.'/modules/newbb/include/search.inc.php'; $limit = $xoopsModuleConfig['topics_per_page']; @@ -54,8 +55,8 @@ $start = 0; $uid = 0; $forum = 0; -$sortby = 'p.post_time DESC'; -$subquery = ""; +$sortby = 'p.post_time'; // irmtfan remove DESC +$criteriaExtra = "";// irmtfan change to criteria $searchin = "both"; $sort = ""; $since = isset($_POST['since']) ? $_POST['since'] : (isset($_GET['since']) ? $_GET['since'] : null); @@ -80,18 +81,26 @@ $forum = array_map("intval",explode("|", $forum)); } $next_search['forum'] = implode("|", $forum); + // START irmtfan topic search + $topic = isset($_POST['topic']) ? $_POST['topic'] : (isset($_GET['topic']) ? $_GET['topic'] : null); + $next_search['topic'] = $topic; + // END irmtfan topic search + // START irmtfan add show search + $show_search = isset($_POST['show_search']) ? $_POST['show_search'] : (isset($_GET['show_search']) ? $_GET['show_search'] : 'post_text'); + $next_search['show_search'] = $show_search; + // START irmtfan add show search $addterms = isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : ""); $next_search['andor'] = $addterms; if ( !in_array(strtolower($addterms), array("or", "and", "exact"))) { - $andor = "OR"; + // irmtfan change default to AND + $andor = "AND"; } else { $andor = strtoupper($addterms); } $uname_required = false; - $search_username = $uname; - $search_username = trim($search_username); + $search_username = trim($uname);// irmtfan one line is enough $next_search['uname'] = $search_username; if ( !empty($search_username) ) { $uname_required = true; @@ -136,77 +145,154 @@ } // entries must be lowercase - //$allowed = array('t.topic_last_post_id desc', 'p.post_time desc', 't.topic_title', 't.topic_views', 't.topic_replies', 'f.forum_name', 'u.uname'); - $allowed = array('p.post_time desc', 't.topic_title', 't.topic_views', 't.topic_replies', 'f.forum_name', 'u.uname'); + $allowed = array('p.post_time', 'p.subject'); // irmtfan just post time and subject $sortby = isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null); $next_search['sortby'] = $sortby; - //$sortby = (in_array(strtolower($sortby), $allowed)) ? $sortby : 't.topic_last_post_id desc'; - $sortby = (in_array(strtolower($sortby), $allowed)) ? $sortby : 'p.post_time desc'; + //$sortby = (in_array(strtolower($sortby), $allowed)) ? $sortby : 't.topic_last_post_id'; + $sortby = (in_array(strtolower($sortby), $allowed)) ? $sortby : 'p.post_time'; $searchin = isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? $_GET['searchin'] : 'both'); $next_search['searchin'] = $searchin; + // START irmtfan use criteria - add topic search if (!empty($since)) { - $subquery = ' AND p.post_time >= ' . (time() - newbb_getSinceTime($since)); - } - - if ($uname_required&&(!$uid||count($uid)<1)) $result = false; - else $results = newbb_search($queries, $andor, $limit, $start, $uid, $forum, $sortby, $searchin, $subquery); - - if ( count($results) < 1 ) { + $criteriaExtra = new CriteriaCompo(); + $criteriaExtra->add(new Criteria('p.post_time', (time() - newbb_getSinceTime($since)), '>='), 'OR'); + } elseif (is_numeric($topic) && !empty($topic)) { + $criteriaExtra = new CriteriaCompo(); + $criteriaExtra->add(new Criteria('p.topic_id', $topic), 'OR'); + } + // END irmtfan use criteria - add topic search + + if ($uname_required&&(!$uid||count($uid)<1)) $results = array(); // irmtfan bug fix array() + else $results = newbb_search($queries, $andor, $limit, $start, $uid, $forum, $sortby, $searchin, $criteriaExtra); // irmtfan $criteriaExtra + + // add newbb_highlightText function to keywords + $search_info_keywords=newbb_highlightText($myts->htmlSpecialChars($term), $queries); + // add number of results + $num_results = count($results); + if ( $num_results < 1 ) { $xoopsTpl->assign("lang_nomatch", _SR_NOMATCH); } else { + // START irmtfan add show search post_text foreach ($results as $row) { - $xoopsTpl->append('results', array('forum_name' => $myts->htmlSpecialChars($row['forum_name']), 'forum_link' => $row['forum_link'], 'link' => $row['link'], 'title' => $row['title'], 'poster' => $row['poster'], 'post_time' => formatTimestamp($row['time'], "m"))); + $post_text = ""; + if ($show_search == 'post_text') { + $post_text = newbb_selectText($row['post_text'], $queries, 100, 200, false); // strip html tags = false + $post_text = newbb_highlightText($post_text, $queries); + } + // add newbb_highlightText function to subject - add post_text + $xoopsTpl->append('results', array('forum_name' => $row['forum_name'], 'forum_link' => $row['forum_link'], 'link' => $row['link'], 'title' => newbb_highlightText($row['title'],$queries), 'poster' => $row['poster'], 'post_time' => formatTimestamp($row['time'], "m"), 'post_text' => $post_text)); } + // END irmtfan add show search post_text unset($results); if (count($next_search)>0) { $items = array(); foreach ($next_search as $para => $val) { - if (!empty($val)) $items[] = "$para=$val"; + if (!empty($val)) $items[] = "{$para}={$val}";// irmtfan add { and } } if (count($items)>0) $paras = implode("&",$items); unset($next_search); unset($items); } $search_url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/search.php?".$paras; - - $next_results = newbb_search($queries, $andor, 1, $start + $limit, $uid, $forum, $sortby, $searchin, $subquery); - $next_count = count($next_results); - $has_next = false; - if (is_array($next_results) && $next_count >0) { - $has_next = true; - } - if (false != $has_next) { + // irmtfan remove to have just one query and appropriate next and prev links + //$next_results = newbb_search($queries, $andor, 1, $start + $limit, $uid, $forum, $sortby, $searchin, $subquery); + //$next_count = count($next_results); + //$has_next = false; + //if (is_array($next_results) && $next_count >0) { + //$has_next = true; + //} + // irmtfan if $results < $limit => it is impossible to have next + if ($num_results == $limit) { $next = $start + $limit; $queries = implode(',',$queries); - $search_url_next = $search_url."&start=$next"; + $search_url_next = $search_url."&start={$next}"; // irmtfan add { and } $search_next = '<a href="'.htmlspecialchars($search_url_next).'">'._SR_NEXT.'</a>'; $xoopsTpl->assign("search_next", $search_next); } if ( $start > 0 ) { $prev = $start - $limit; - $search_url_prev = $search_url."&start=$prev"; + $search_url_prev = $search_url."&start={$prev}"; // irmtfan add { and } $search_prev = '<a href="'.htmlspecialchars($search_url_prev).'">'._SR_PREVIOUS.'</a>'; $xoopsTpl->assign("search_prev", $search_prev); } } - - $search_info = _SR_KEYWORDS.": ".$myts->htmlSpecialChars($term); + // irmtfan add newbb_highlightText function + $search_info = _SR_KEYWORDS.": ".$search_info_keywords; if ($uname_required) { if ($search_info) $search_info .= "<br />"; $search_info .= _MD_USERNAME.": ".$myts->htmlSpecialChars($search_username); } + // add num_results + $search_info .= "<br />" . sprintf(_SR_SHOWING, $start + 1, $start + $num_results); $xoopsTpl->assign("search_info", $search_info); } +// START irmtfan - assign template vars for search +/* term */ +$xoopsTpl->assign("search_term", $term); +/* andor */ +$andor_select = "<select name=\"andor\">"; +$andor_select .= "<option value=\"OR\""; +if ("OR" == $andor) $andor_select .= " selected=\"selected\""; +$andor_select .= ">" . _SR_ANY . "</option>"; +$andor_select .= "<option value=\"AND\""; +if ("AND" == $andor || empty($andor)) $andor_select .= " selected=\"selected\""; +$andor_select .= ">" . _SR_ALL . "</option>"; +$andor_select .= "<option value=\"EXACT\""; +if ("EXACT" == $andor) $andor_select .= " selected=\"selected\""; +$andor_select .= ">" . _SR_EXACT . "</option>"; +$andor_select .= "</select>"; +$xoopsTpl->assign("andor_selection_box", $andor_select); + +/* forum */ $select_forum = '<select name="forum[]" size="5" multiple="multiple">'; $select_forum .= '<option value="all">'._MD_SEARCHALLFORUMS.'</option>'; -$select_forum .= newbb_forumSelectBox(); +$select_forum .= newbb_forumSelectBox($forum); $select_forum .= '</select>'; $xoopsTpl->assign_by_ref("forum_selection_box", $select_forum); + +/* searchin */ +$searchin_select = ""; +$searchin_select .= "<input type=\"radio\" name=\"searchin\" value=\"title\""; +if ("title" == $searchin) $searchin_select .= " checked"; +$searchin_select .= " />" . _MD_SUBJECT . " "; +$searchin_select .= "<input type=\"radio\" name=\"searchin\" value=\"text\""; +if ("text" == $searchin) $searchin_select .= " checked"; +$searchin_select .= " />" . _MD_BODY . " "; +$searchin_select .= "<input type=\"radio\" name=\"searchin\" value=\"both\""; +if ("both" == $searchin || empty($searchin)) $searchin_select .= " checked"; +$searchin_select .= " />" . _MD_SUBJECT . " & " . _MD_BODY. " "; +$xoopsTpl->assign("searchin_radio", $searchin_select); + +/* show_search */ +$show_search_select = ""; +$show_search_select .= "<input type=\"radio\" name=\"show_search\" value=\"post\""; +if ("post" == $show_search) $show_search_select .= " checked"; +$show_search_select .= " />" . _MD_POSTS . " "; +$show_search_select .= "<input type=\"radio\" name=\"show_search\" value=\"post_text\""; +if ("post_text" == $show_search || empty($show_search)) $show_search_select .= " checked"; +$show_search_select .= " />" . _MD_SEARCHPOSTTEXT. " "; +$xoopsTpl->assign("show_search_radio", $show_search_select); + +/* author */ +$xoopsTpl->assign("author_select", $search_username); + +/* sortby */ +$sortby_select = "<select name=\"sortby\">"; +$sortby_select .= "<option value=\"p.post_time\""; +if ("p.post_time" == $sortby || empty($sortby)) $sortby_select .= " selected=\"selected\""; +$sortby_select .= ">" . _MD_DATE . "</option>"; +$sortby_select .= "<option value=\"p.subject\""; +if ("p.subject" == $sortby) $sortby_select .= " selected=\"selected\""; +$sortby_select .= ">" . _MD_TOPIC . "</option>"; +$sortby_select .= "</select>"; +$xoopsTpl->assign("sortby_selection_box", $sortby_select); +// END irmtfan - assign template vars for search + // irmtfan get since from the user for selction box $since = isset($_GET['since']) ? intval($_GET['since']) : $xoopsModuleConfig["since_default"]; $select_since = newbb_sinceSelectBox($since); Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/css/language/english/style.css =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/css/language/english/style.css 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/css/language/english/style.css 2012-10-10 11:01:37 UTC (rev 10211) @@ -355,4 +355,19 @@ border-color: white #a1c1e6 black #a1c1e6; font-weight: normal; } + +span.newbb_highlight { +background-color: #FFFF80 !important; +font-weight: bold !important; +} +span.term0 { +background-color: #00FF00 !important; +} +span.term1 { +background-color: #FF0000 !important; +} +span.term2 { +background-color: #0000FF !important; +} + /* color - end */ \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/css/language/persian/style.css =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/css/language/persian/style.css 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/css/language/persian/style.css 2012-10-10 11:01:37 UTC (rev 10211) @@ -358,4 +358,18 @@ border-color: white #a1c1e6 black #a1c1e6; font-weight: normal; } +span.newbb_highlight { +background-color: #FFFF80 !important; +font-weight: bold !important; +} +span.term0 { +background-color: #00FF00 !important; +} +span.term1 { +background-color: #FF0000 !important; +} +span.term2 { +background-color: #0000FF !important; +} + /* color - end */ \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_index.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_index.html 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_index.html 2012-10-10 11:01:37 UTC (rev 10211) @@ -307,7 +307,8 @@ <input type="hidden" name="forum" id="forum" value="all" /> <input type="hidden" name="sortby" id="sortby" value="p.post_time desc" /> <input type="hidden" name="searchin" id="searchin" value="both" /> - <input type="submit" name="submit" id="submit" value="<{$smarty.const._MD_SEARCH}>" /> + <!-- irmtfan remove name="submit" --> + <input type="submit" id="submit" value="<{$smarty.const._MD_SEARCH}>" /> <br /> [ <a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/search.php"><{$smarty.const._MD_ADVSEARCH}></a> ] </form> Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_search.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_search.html 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_search.html 2012-10-10 11:01:37 UTC (rev 10211) @@ -14,18 +14,13 @@ <tr> <!-- irmtfan hardcode removed align="right" --> <td class="head" width="10%" id="align_right"><strong><{$smarty.const._SR_KEYWORDS}></strong> </td> - <td class="even"><input type="text" name="term" /></td> +<!-- irmtfan add value="$search_term" --> + <td class="even"><input type="text" name="term" value="<{$search_term}>" /></td> </tr> <tr> -<!-- irmtfan hardcode removed align="right" --> +<!-- irmtfan hardcode removed align="right" add $andor_selection_box --> <td class="head" id="align_right"><strong><{$smarty.const._SR_TYPE}></strong> </td> - <td class="even"> - <select name="andor"> - <option value="or" selected="selected"><{$smarty.const._SR_ANY}></option> - <option value="all"><{$smarty.const._SR_ALL}></option> - <option value="exact"><{$smarty.const._SR_EXACT}></option> - </select> - </td> + <td class="even"><{$andor_selection_box}></td> </tr> <tr> <!-- irmtfan hardcode removed align="right" --> @@ -33,34 +28,31 @@ <td class="even"><{$forum_selection_box}></td> </tr> <tr> -<!-- irmtfan hardcode removed align="right" --> +<!-- irmtfan hardcode removed align="right" add $searchin_radio --> <td class="head" id="align_right"><strong><{$smarty.const._SR_SEARCHIN}></strong> </td> - <td class="even"><input type="radio" name="searchin" value="title" /><{$smarty.const._MD_SUBJECT}> - <input type="radio" name="searchin" value="text" /><{$smarty.const._MD_BODY}> - <input type="radio" name="searchin" value="both" checked="checked" /><{$smarty.const._MD_SUBJECT}> & <{$smarty.const._MD_BODY}> </td> + <td class="even"><{$searchin_radio}></td> </tr> <tr> -<!-- irmtfan hardcode removed align="right" --> +<!-- irmtfan hardcode removed align="right" add value="$author_select"--> <td class="head" id="align_right"><strong><{$smarty.const._MD_AUTHOR}></strong> </td> - <td class="even"><input type="text" name="uname" value="" /></td> + <td class="even"><input type="text" name="uname" value="<{$author_select}>" /></td> </tr> <tr> -<!-- irmtfan hardcode removed align="right" --> +<!-- irmtfan hardcode removed align="right" add $sortby_selection_box --> <td class="head" id="align_right"><strong><{$smarty.const._MD_SORTBY}></strong> </td> - <td class="even"> - <select name=="sortby"> - <option value="p.post_time desc" selected="selected"><{$smarty.const._MD_DATE}></option> - <option value="t.topic_title"><{$smarty.const._MD_TOPIC}></option> - <option value="f.forum_name"><{$smarty.const._MD_FORUM}></option> - <option value="u.uname"><{$smarty.const._MD_USERNAME}></option> - </select> - </td> + <td class="even"><{$sortby_selection_box}></td> </tr> <tr> <!-- irmtfan hardcode removed align="right" --> <td class="head" id="align_right"><strong><{$smarty.const._MD_SINCE}></strong> </td> <td class="even"><{$since_selection_box}></td> </tr> +<!-- START irmtfan add show search --> + <tr> + <td class="head" id="align_right"><strong><{$smarty.const._MD_SHOWSEARCH}></strong> </td> + <td class="even"><{$show_search_radio}></td> + </tr> +<!-- START irmtfan add show search --> <{if $search_rule}> <tr> <!-- irmtfan hardcode removed align="right" --> @@ -71,7 +63,8 @@ <tr> <!-- irmtfan hardcode removed align="right" --> <td class="head" id="align_right"> </td> - <td class="even"><input type="submit" name="submit" value="<{$smarty.const._MD_SEARCH}>" /></td> + <!-- irmtfan remove name="submit" --> + <td class="even"><input type="submit" value="<{$smarty.const._MD_SEARCH}>" /></td> </table></td> </tr> </table> Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_searchresults.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_searchresults.html 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_searchresults.html 2012-10-10 11:01:37 UTC (rev 10211) @@ -20,6 +20,18 @@ <td class="even"><{$results[i].poster}></a></td> <td class="odd"><{$results[i].post_time}></td> </tr> +<!-- START irmtfan add show search --> + <{if $results[i].post_text }> + <tr align="center"> + <td class="even"></td> + <td class="odd"> + <{$results[i].post_text}> + </td> + <td class="even"></td> + <td class="odd"></td> + </tr> + <{/if}> +<!-- END irmtfan add show search --> <!-- end each result --> <{/section}> <!-- end search results --> Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html 2012-10-10 11:01:37 UTC (rev 10211) @@ -75,6 +75,8 @@ <option value=""><{$smarty.const._MD_TOPICOPTION}></option> <option value="<{$post_link}>"><{$smarty.const._MD_VIEW}> <{$smarty.const._MD_ALLPOSTS}></option> <option value="<{$newpost_link}>"><{$smarty.const._MD_VIEW}> <{$smarty.const._MD_NEWPOSTS}></option> + <!-- irmtfan add a separator --> + <option value="">--------</option> <{foreach item=filter from=$filters}> <option value="<{$filter.link}>"><{$filter.title}></option> <{/foreach}> @@ -123,7 +125,7 @@ </div> <!-- irmtfan hardcode removed style="padding: 5px;float: right; text-align:right;" --> <div class="pagenav"> -<{$pagenav|replace:'form':'div'}> <!-- irmtfan to solve nested forms issue --> +<{$pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> <!-- irmtfan to solve nested forms and id="xo-pagenav" issue --> </div> </div> <div class="clear"></div> @@ -159,7 +161,8 @@ <{/if}> </td> <td width="4%" align="center"><{$topic.topic_icon}></td> - <td> <a href="<{$topic.topic_link}>"> +<!-- irmtfan remove topic_link hardcode and add topic_excerpt --> + <td> <a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/<{$topic.topic_link}>" title="<{$topic.topic_excerpt}>"> <{if $topic.allow_prefix AND $topic.topic_subject}> <{$topic.topic_subject}> <{/if}> @@ -191,9 +194,13 @@ <{$selection.order}> <{$selection.since}> <{foreach item=hidval key=hidvar from=$selection.vars}> - <input type="hidden" name="$hidvar" value="<{$hidval}>" /> + <{if $hidval && $hidvar neq "sort" && $hidvar neq "order" && $hidvar neq "since"}> + <!-- irmtfan correct name="$hidvar" --> + <input type="hidden" name="<{$hidvar}>" value="<{$hidval}>" /> + <{/if}> <{/foreach}> - <input type="submit" name="refresh" value="<{$smarty.const._SUBMIT}>" /> + <!-- irmtfan remove name="refresh" --> + <input type="submit" value="<{$smarty.const._SUBMIT}>" /> </form> <{/strip}> </td> @@ -203,7 +210,7 @@ <{if $pagenav}> <!-- irmtfan hardcode removed style="padding: 5px;float: right; text-align:right;" --> -<div class="pagenav"><{$pagenav|replace:'form':'div'}> <!-- irmtfan to solve nested forms issue --></div> +<div class="pagenav"><{$pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> <!-- irmtfan to solve nested forms and id="xo-pagenav" issue --></div> <br /> <{/if}> <div class="clear"></div> @@ -222,12 +229,28 @@ <form action="<{$xoops_url}>/modules/<{$xoops_dirname}>/search.php" method="get"> <input name="term" id="term" type="text" size="15" /> <{foreach item=hidval key=hidvar from=$search}> - <input type="hidden" name="$hidvar" value="<{$hidval}>" /> + <{if $hidval }> + <!-- irmtfan correct name="$hidvar" --> + <input type="hidden" name="<{$hidvar}>" value="<{$hidval}>" /> + <{/if}> <{/foreach}> <input type="submit" class="formButton" value="<{$smarty.const._MD_SEARCH}>" /><br /> [<a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/search.php"><{$smarty.const._MD_ADVSEARCH}></a>] </form><br /> - <{$forum_jumpbox}> + <!-- START irmtfan add forum selection box --> + <{if $forum_jumpbox }> + <form method="get" action="<{$selection.action}>"> + <{$selection.forum}> + <{foreach item=hidval key=hidvar from=$selection.vars}> + <{if $hidval && $hidvar neq "forum"}> + <input type="hidden" name="<{$hidvar}>" value="<{$hidval}>" /> + <{/if}> + <{/foreach}> + <input type="submit" value="<{$smarty.const._SUBMIT}>" /> + </form><br /> + <{$forum_jumpbox}> + <{/if}> + <!-- END irmtfan add forum selection box --> </div> </div> <div class="clear"></div> Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewforum.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewforum.html 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewforum.html 2012-10-10 11:01:37 UTC (rev 10211) @@ -76,7 +76,7 @@ </div> <!-- irmtfan hardcode removed style="float: right; text-align:right;" --> <div class="icon_right"> - <{$forum_pagenav|replace:'form':'div'}> <!-- irmtfan to solve nested forms issue --> + <{$forum_pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> <!-- irmtfan to solve nested forms and id="xo-pagenav" issue --> </div> </div> <div class="clear"></div> @@ -172,7 +172,8 @@ <strong><{$smarty.const._MD_SORTEDBY}></strong> <{$forum_selection_sort}> <{$forum_selection_order}> <{$forum_selection_since}> <input type="hidden" name="forum" id="forum" value="<{$forum_id}>" /> <input type="hidden" name="status" value="<{$status}>" /> - <input type="submit" name="refresh" value="<{$smarty.const._SUBMIT}>" /> + <!-- irmtfan remove name="submit" --> + <input type="submit" value="<{$smarty.const._SUBMIT}>" /> </form> <{/strip}> </td> @@ -187,7 +188,7 @@ <{$forum_addpoll}> <{$forum_post_or_register}> </div> <div class="right"> - <{$forum_pagenav|replace:'form':'div'}> <!-- irmtfan to solve nested forms issue --> + <{$forum_pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> <!-- irmtfan to solve nested forms and id="xo-pagenav" issue --> </div> </div> <div class="clear"></div> Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewpost.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewpost.html 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewpost.html 2012-10-10 11:01:37 UTC (rev 10211) @@ -82,7 +82,7 @@ </div> <!-- irmtfan hardcode removed style="padding: 5px;float: right; text-align:right;" --> <div class="pagenav"> - <{$pagenav|replace:'form':'div'}> <!-- irmtfan to solve nested forms issue --> + <{$pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> <!-- irmtfan to solve nested forms and id="xo-pagenav" issue --> </div> </div> <div class="clear"></div> @@ -116,7 +116,7 @@ </div> <!-- irmtfan hardcode removed style="float: right; text-align:right;" --> <div class="icon_right"> - <{$pagenav|replace:'form':'div'}> <!-- irmtfan to solve nested forms issue --> + <{$pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> <!-- irmtfan to solve nested forms and id="xo-pagenav" issue --> </div> </div> <div class="clear"></div> Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewtopic.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewtopic.html 2012-10-09 22:03:21 UTC (rev 10210) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewtopic.html 2012-10-10 11:01:37 UTC (rev 10211) @@ -148,10 +148,26 @@ <option value="<{$act.link}>"><{$act.title}></option> <{/foreach}> </select> + <!-- START irmtfan add topic search --> + <{if $mode lte 1}> + <form id="search-topic" action="<{$xoops_url}>/modules/<{$xoops_dirname}>/search.php" method="get"> + <fieldset> + <input name="term" id="term" type="text" size="15" value="<{$smarty.const._MD_SEARCHTOPIC}>..." onBlur="if(this.value=='') this.value='<{$smarty.const._MD_SEARCHTOPIC}>...'" onFocus="if(this.v... [truncated message content] |
From: <ir...@us...> - 2012-10-11 08:41:50
|
Revision: 10212 http://sourceforge.net/p/xoops/svn/10212 Author: irmtfan Date: 2012-10-11 08:41:48 +0000 (Thu, 11 Oct 2012) Log Message: ----------- bug fix: viewpost.php?status=new was wrongly returned Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/post.php XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-10 11:01:37 UTC (rev 10211) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-11 08:41:48 UTC (rev 10212) @@ -1,3 +1,8 @@ +date 2012-10-11 +=================================== +1- bug fix: viewpost.php?status=new was wrongly return the new posts and new posts counts based on read_mode=1 (cookie) when the read_mode=2 (database) (important) +in newbb/viewpost.php and newbb/class/post.php + date 2012-10-10 =================================== 1- bug fix: in list.topic.php: remove empty arrays in getStatus function Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/post.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/post.php 2012-10-10 11:01:37 UTC (rev 10211) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/post.php 2012-10-11 08:41:48 UTC (rev 10212) @@ -936,12 +936,31 @@ return true; } - - function getPostCount($criteria = null) +// START irmtfan enhance getPostCount when there is join (read_mode = 2) + function getPostCount($criteria = null, $join = null) { - return parent::getCount($criteria); + // If not join get the count from XOOPS/class/model/stats as before + if (empty($join)) + return parent::getCount($criteria); + + $sql = 'SELECT COUNT(*) as count'. + ' FROM ' . $this->db->prefix('bb_posts') . ' AS p'. + ' LEFT JOIN ' . $this->db->prefix('bb_posts_text') . " AS t ON t.post_id = p.post_id"; + // LEFT JOIN + $sql .= $join; + // WHERE + if (isset($criteria) && is_subclass_of($criteria, "criteriaelement")) { + $sql .= " ".$criteria->renderWhere(); + } + if (!$result = $this->db->query($sql)) { + //xoops_error($this->db->error().'<br />'.$sql); + return null; + } + $myrow = $this->db->fetchArray($result); + $count = $myrow['count']; + return $count; } - +// END irmtfan enhance getPostCount when there is join (read_mode = 2) /* * TODO: combining viewtopic.php */ Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-10-10 11:01:37 UTC (rev 10211) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-10-11 08:41:48 UTC (rev 10212) @@ -79,45 +79,49 @@ } $join = null; +// START irmtfan solve the status issues and specially status = new issue switch($status) { case "pending": - $criteria_status_count = new Criteria("approved", 0); - $criteria_status_post = new Criteria("p.approved", 0); + $criteria_count->add(new Criteria("approved", 0)); // irmtfan add new criteria + $criteria_post->add(new Criteria("p.approved", 0)); // irmtfan add new criteria break; case "deleted": - $criteria_status_count = new Criteria("approved", -1); - $criteria_status_post = new Criteria("p.approved", -1); + $criteria_count->add(new Criteria("approved", -1)); // irmtfan add new criteria + $criteria_post->add(new Criteria("p.approved", -1)); // irmtfan add new criteria break; case "new": - $criteria_status_count = new CriteriaCompo(new Criteria("post_time", intval($last_visit), ">")); - $criteria_status_post = new CriteriaCompo(new Criteria("p.post_time", intval($last_visit), ">")); - //$criteria_status_count->add(new Criteria("approved", 1)); - //$criteria_status_post->add(new Criteria("p.approved", 1)); - // following is for "unread" -- not finished + //$criteria_status_count = new CriteriaCompo(new Criteria("post_time", intval($last_visit), ">"));// irmtfan commented and removed + //$criteria_status_post = new CriteriaCompo(new Criteria("p.post_time", intval($last_visit), ">"));// irmtfan commented and removed + $criteria_count->add(new Criteria("approved", 1)); // irmtfan uncomment + $criteria_post->add(new Criteria("p.approved", 1)); // irmtfan uncomment + // following is for "unread" -- not finished -- irmtfan Now it is finished! if (empty($xoopsModuleConfig["read_mode"])) { - $criteria_status_count->add(new Criteria("approved", 1)); - $criteria_status_post->add(new Criteria("p.approved", 1)); + //$criteria_status_count->add(new Criteria("approved", 1));// irmtfan commented and removed + //$criteria_status_post->add(new Criteria("p.approved", 1));// irmtfan commented and removed } elseif ($xoopsModuleConfig["read_mode"] ==2) { - $join = ' LEFT JOIN ' . $xoopsDB->prefix('bb_reads_topic') . ' r ON r.read_item = p.topic_id'; - $criteria_status_post = new CriteriaCompo(new Criteria("p.post_id", "r.post_id", ">")); - $criteria_status_post->add(new Criteria("r.read_id", NULL, "IS"), "OR"); - $criteria_status_post->add(new Criteria("p.approved", 1)); + $join = ' LEFT JOIN ' . $xoopsDB->prefix('bb_reads_topic') . ' AS r ON r.read_item = p.topic_id'; // irmtfan corrected add AS + $criteria_status_post = new CriteriaCompo();// irmtfan new criteria + $criteria_status_post->add(new Criteria("p.post_id", "r.`post_id`", ">")); // irmtfan corrected - should use $value="r.``" to render in XOOPS/class/criteria.php + $criteria_status_post->add(new Criteria("r.read_id", NULL, "IS NULL"), "OR");// irmtfan corrected - should use "IS NULL" to render in XOOPS/class/criteria.php + //$criteria_status_post->add(new Criteria("p.approved", 1)); // irmtfan commented and removed //$criteria_status_count =& $criteria_status_post; + $criteria_post->add($criteria_status_post); // irmtfan add the status criteria to post criteria + $criteria_count =& $criteria_post;// irmtfan criteria count is equal to criteria post } elseif ($xoopsModuleConfig["read_mode"] == 1) { - $criteria_status_count = new CriteriaCompo(new Criteria("post_time", intval($last_visit), ">")); - $criteria_status_post = new CriteriaCompo(new Criteria("p.post_time", intval($last_visit), ">")); - $criteria_status_count->add(new Criteria("approved", 1)); - $criteria_status_post->add(new Criteria("p.approved", 1)); - } + $criteria_count->add(new Criteria("post_time", intval($last_visit), ">")); // irmtfan add new criteria + $criteria_post->add(new Criteria("p.post_time", intval($last_visit), ">")); // irmtfan add new criteria + //$criteria_status_count->add(new Criteria("approved", 1));// irmtfan commented and removed + //$criteria_status_post->add(new Criteria("p.approved", 1));// irmtfan commented and removed + } break; default: - $criteria_status_count = new Criteria("approved", 1); - $criteria_status_post = new Criteria("p.approved", 1); + $criteria_count->add(new Criteria("approved", 1)); // irmtfan add new criteria + $criteria_post->add(new Criteria("p.approved", 1)); // irmtfan add new criteria break; } -$criteria_count->add($criteria_status_count); -$criteria_post->add($criteria_status_post); - +//$criteria_count->add($criteria_status_count); // irmtfan commented and removed +//$criteria_post->add($criteria_status_post); // irmtfan commented and removed +// END irmtfan solve the status issues and specially status = new issue $karma_handler =& xoops_getmodulehandler('karma', 'newbb'); $user_karma = $karma_handler->getUserKarma(); @@ -135,8 +139,8 @@ ); $viewmode = in_array($viewmode, $valid_modes) ? $viewmode : $valid_modes[0]; -$postCount = $post_handler->getPostCount($criteria_count); -$posts = $post_handler->getPostsByLimit($criteria_post, $post_perpage, $start/*, $join*/); +$postCount = $post_handler->getPostCount($criteria_count, $join);// irmtfan add join for read_mode = 2 +$posts = $post_handler->getPostsByLimit($criteria_post, $post_perpage, $start, $join);// irmtfan add join for read_mode = 2 $poster_array = array(); if (count($posts)>0) foreach (array_keys($posts) as $id) { |
From: <ir...@us...> - 2012-10-15 09:27:21
|
Revision: 10215 http://sourceforge.net/p/xoops/svn/10215 Author: irmtfan Date: 2012-10-15 09:27:16 +0000 (Mon, 15 Oct 2012) Log Message: ----------- bug fix: read_mode = 2 (DB) in viewpost.php?status=new AND viewforum.php?forum=FFF&status=unread and list.topic.php?status=unread Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_synchronization.php XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php XoopsModules/newbb/branches/irmtfan/newbb/class/read.php XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/admin.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/admin.php XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php XoopsModules/newbb/branches/irmtfan/newbb/sql/mysql.430.sql XoopsModules/newbb/branches/irmtfan/newbb/sql/mysql.sql XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_synchronization.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_synchronization.php 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_synchronization.php 2012-10-15 09:27:16 UTC (rev 10215) @@ -211,7 +211,15 @@ $stats_handler =& xoops_getmodulehandler('stats', 'newbb'); $stats_handler->reset(); break; - + // START irmtfan add read sync + case "read": + mod_loadFunctions("recon", "newbb"); + $result = newbb_synchronization("read"); + if (!empty($result)) { + redirect_header("admin_synchronization.php", 2, _AM_NEWBB_SYNC_TYPE_READ . "<br />" . _AM_NEWBB_DATABASEUPDATED); + } + exit(); + // END irmtfan add read sync case "misc": default: mod_loadFunctions("recon", "newbb"); @@ -257,6 +265,15 @@ $form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; $form .= '</div>'; $form .= '</form>'; +// START irmtfan add read sync +$form .= '<form action="admin_synchronization.php" method="get">'; +$form .= '<div style="padding: 10px 2px;">'; +$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_READ.'</h2>'; +$form .= '<input type="hidden" name="type" value="read">'; +$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; +$form .= '</div>'; +$form .= '</form>'; +// END irmtfan add read sync $form .= '<form action="admin_synchronization.php" method="get">'; $form .= '<div style="padding: 10px 2px;">'; Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-15 09:27:16 UTC (rev 10215) @@ -1,3 +1,21 @@ +date 2012-10-15 +=================================== +1- bug fix: viewpost.php?status=new AND viewforum.php?forum=FFF&status=unread and list.topic.php?status=unread criteria was wrong when read_mode = 2(important) +in newbb/viewpost.php, newbb/class/forum.php, newbb/class/topic.renderer.php + +2- bug fix: in view all topic page: if empty($_GET(status)) it will show all topics include deleted and pendings. + the last solution removed in list.topic.php and move to topic.renderer.php because the last solution cause double query and error. +in newbb/list.topic.php, newbb/class/topic.renderer.php + +3- bug fix: add read_item_uid indexes to avoid duplicate (read_item, uid) when submit a post (very important) +newbb/sql/mysql.sql, newbb/sql/mysql.430.sql + +4- bug fix: add clearDuplicate function for clear duplicate rows in bb_reads_topic and bb_reads_forum tables. old newbb users should click on "Read Data" in newbb -> admin -> syncronization page. (very important) +in newbb/class/read.php, newbb/admin/admin_synchronization.php, newbb/language/LANG/admin.php, newbb/docs/lang_diff.txt + +5- improve: add read_expire = 0 => no clean up reads tables +in newbb/class/read.php, newbb/include/plugin.php + date 2012-10-11 =================================== 1- bug fix: viewpost.php?status=new was wrongly return the new posts and new posts counts based on read_mode=1 (cookie) when the read_mode=2 (database) (important) Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-10-15 09:27:16 UTC (rev 10215) @@ -211,8 +211,15 @@ case 'unread': if (empty($xoopsModuleConfig["read_mode"])) { } elseif ($xoopsModuleConfig["read_mode"] ==2) { - $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('bb_reads_topic') . ' r ON r.read_item = t.topic_id'; - $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; + // START irmtfan use read_uid to find the unread posts when the user is logged in + global $xoopsUser; + $read_uid = is_object($xoopsUser)?$xoopsUser->getVar("uid"):0; + if (!empty($read_uid)) { + $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('bb_reads_topic') . ' r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; + $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; + } else { + } + // END irmtfan use read_uid to find the unread posts when the user is logged in } elseif ($xoopsModuleConfig["read_mode"] == 1) { $topics = array(); $topic_lastread = newbb_getcookie('LT', true); @@ -477,8 +484,15 @@ case 'unread': if (empty($xoopsModuleConfig["read_mode"])) { } elseif ($xoopsModuleConfig["read_mode"] ==2) { - $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('bb_reads_topic') . ' r ON r.read_item = t.topic_id'; - $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; + // START irmtfan use read_uid to find the unread posts when the user is logged in + global $xoopsUser; + $read_uid = is_object($xoopsUser)?$xoopsUser->getVar("uid"):0; + if (!empty($read_uid)) { + $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('bb_reads_topic') . ' r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; + $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; + } else { + } + // END irmtfan use read_uid to find the unread posts when the user is logged in } elseif ($xoopsModuleConfig["read_mode"] == 1) { $criteria_post = ' p.post_time > ' . max($GLOBALS['last_visit'], $startdate); $topics = array(); Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/read.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/read.php 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/read.php 2012-10-15 09:27:16 UTC (rev 10215) @@ -101,7 +101,8 @@ $this->ArtObjectHandler($db, 'bb_reads_'.$type, 'Read'.$type, 'read_id', 'post_id'); $this->type = $type; $newbbConfig = newbb_load_config(); - $this->lifetime = !empty($newbbConfig["read_expire"]) ? $newbbConfig["read_expire"] *24*3600 : 30*24*3600; + // irmtfan if read_expire = 0 dont clean + $this->lifetime = isset($newbbConfig["read_expire"]) ? intval($newbbConfig["read_expire"]) *24*3600 : 30*24*3600; $this->mode = isset($newbbConfig["read_mode"]) ? $newbbConfig["read_mode"] : 2; } @@ -110,10 +111,12 @@ * * Delete all expired and duplicated records */ + // START irmtfan rephrase function to 1- add clearDuplicate and 2- dont clean when read_expire = 0 function clearGarbage() { - $expire = time() - intval($this->lifetime); - $sql = "DELETE FROM ".$this->table." WHERE read_time < ". $expire; - $this->db->queryF($sql); + // irmtfan clear duplicaed rows + if(!$result = $this->clearDuplicate()) { + return false; + } /* for MySQL 4.1+ */ if ($this->mysql_major_version() >= 4): @@ -130,9 +133,18 @@ //xoops_error($this->db->error()); return false; } + // irmtfan if read_expire = 0 dont clean + if (empty($this->lifetime)) return true; + // irmtfan move here and rephrase + $expire = time() - intval($this->lifetime); + $sql = "DELETE FROM ".$this->table." WHERE read_time < ". $expire; + if (!$result = $this->db->queryF($sql)) { + //xoops_error($this->db->error()); + return false; + } return true; } - + // END irmtfan rephrase function to 1- add clearDuplicate and 2- dont clean when read_expire = 0 function getRead($read_item, $uid = null) { if (empty($this->mode)) return null; @@ -259,6 +271,45 @@ } return $ret; } - + // START irmtfan add clear duplicated rows function + function clearDuplicate() + { + $sql = "CREATE TABLE " . $this->table . "_duplicate like " . $this->table . "; "; + if (!$result = $this->db->queryF($sql)) { + xoops_error($this->db->error().'<br />'.$sql); + return false; + } + $sql = "INSERT " . $this->table . "_duplicate SELECT * FROM " . $this->table . " GROUP BY read_item, uid; "; + if (!$result = $this->db->queryF($sql)) { + xoops_error($this->db->error().'<br />'.$sql); + return false; + } + $sql = "RENAME TABLE " . $this->table . " TO " . $this->table . "_with_duplicate; "; + if (!$result = $this->db->queryF($sql)) { + xoops_error($this->db->error().'<br />'.$sql); + return false; + } + $sql = "RENAME TABLE " . $this->table . "_duplicate TO " . $this->table . "; "; + if (!$result = $this->db->queryF($sql)) { + xoops_error($this->db->error().'<br />'.$sql); + return false; + } + $sql = "SHOW INDEX FROM " . $this->table . " WHERE KEY_NAME = 'read_item_uid'"; + $result = $this->db->queryF($sql); + if (empty($result)) { + $sql.= "ALTER TABLE " . $this->table . " ADD INDEX read_item_uid ( read_item, uid ); "; + if (!$result = $this->db->queryF($sql)) { + xoops_error($this->db->error().'<br />'.$sql); + return false; + } + } + $sql = "DROP TABLE " . $this->table . "_with_duplicate; "; + if (!$result = $this->db->queryF($sql)) { + xoops_error($this->db->error().'<br />'.$sql); + return false; + } + return true; + } + // END irmtfan add clear duplicated rows function } ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-10-15 09:27:16 UTC (rev 10215) @@ -160,8 +160,15 @@ if (empty($this->config["read_mode"])) { // Use database } elseif ($this->config["read_mode"] == 2) { - $this->query["join"][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_reads_topic') . ' AS r ON r.read_item = t.topic_id'; - $this->query["where"][] = '(r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; + // START irmtfan use read_uid to find the unread posts when the user is logged in + global $xoopsUser; + $read_uid = is_object($xoopsUser)?$xoopsUser->getVar("uid"):0; + if (!empty($read_uid)) { + $this->query["join"][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_reads_topic') . ' AS r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; + $this->query["where"][] = '(r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; + } else { + } + // END irmtfan change criteria to get from uid p.uid = last post submit user id // User cookie } elseif ($this->config["read_mode"] == 1) { if ($lastvisit =$GLOBALS['last_visit']) { @@ -263,6 +270,8 @@ if (isset($parsed)) return true; if (!isset($this->vars["forum"])) $this->vars["forum"] = null; + //irmtfan parse status for rendering topic correctly - if empty($_GET(status)) it will show all topics include deleted and pendings. + if (!isset($this->vars["status"])) $this->vars["status"] = all; foreach ($this->vars as $var => $val) { $this->parseVar($var, $val); Modified: XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2012-10-15 09:27:16 UTC (rev 10215) @@ -67,4 +67,6 @@ --------- define('_AM_NEWBB_REPORTSAVE','Selected Reports have been processed successfully'); define('_AM_NEWBB_REPORTDELETE','Selected Reports have been deleted from database successfully'); -define('_AM_NEWBB_REPORTNOTSELECT','No Report is selected!'); \ No newline at end of file +define('_AM_NEWBB_REPORTNOTSELECT','No Report is selected!'); +define("_AM_NEWBB_SYNC_TYPE_READ","Read Data"); +define("_AM_NEWBB_DATABASEUPDATED","Database Updated Successfully!"); \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2012-10-15 09:27:16 UTC (rev 10215) @@ -57,8 +57,8 @@ // storage method for reading records: 0 - none; 1 - cookie; 2 - db $customConfig["read_mode"] = 2; -// expire time for reading records, in days -$customConfig["read_expire"] = 30; +// expire time for reading records, in days; irmtfan add feature: 0 or no cleanup +$customConfig["read_expire"] = 0; // maximum records per forum for one user $customConfig["read_items"] = 100; Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/admin.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/admin.php 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/admin.php 2012-10-15 09:27:16 UTC (rev 10215) @@ -301,4 +301,6 @@ define('_AM_NEWBB_REPORTSAVE','Selected Reports have been processed successfully'); define('_AM_NEWBB_REPORTDELETE','Selected Reports have been deleted from database successfully'); define('_AM_NEWBB_REPORTNOTSELECT','No Report is selected!'); +define("_AM_NEWBB_SYNC_TYPE_READ","Read Data"); +define("_AM_NEWBB_DATABASEUPDATED","Database Updated Successfully!"); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/admin.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/admin.php 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/admin.php 2012-10-15 09:27:16 UTC (rev 10215) @@ -300,4 +300,6 @@ define('_AM_NEWBB_UPLOAD','حداکثر اندازه هر فایل برای آپلود:'); define('_AM_NEWBB_MEMLIMITTOLARGE','توجه کنید که متغیر \'memory_limit\' در فایل PHP.INI کمتر از متغیر \'post_max_size\' است.'); define('_AM_NEWBB_MEMLIMITOK','فایل های با حداکثر اندازه %s قابل آپلود در این سایت هستند.'); +define("_AM_NEWBB_SYNC_TYPE_READ","اطلاعات جدول خوانده شده ها"); +define("_AM_NEWBB_DATABASEUPDATED","پایگاه داده با موفقیت به روز شد!"); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2012-10-15 09:27:16 UTC (rev 10215) @@ -35,8 +35,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); +//irmtfan parse status for rendering topic correctly - remove here and move to topic.renderer.php +//$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/sql/mysql.430.sql =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/sql/mysql.430.sql 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/sql/mysql.430.sql 2012-10-15 09:27:16 UTC (rev 10215) @@ -2,4 +2,10 @@ ALTER TABLE `bb_posts` ADD INDEX `forumid_uid` ( `forum_id` , `uid` ); ALTER TABLE `bb_posts` ADD INDEX `topicid_uid` ( `topic_id` , `uid` ); -ALTER TABLE `bb_posts` ADD INDEX `forumid_approved_postid` ( `forum_id` , `approved` , `post_id` ); \ No newline at end of file +ALTER TABLE `bb_posts` ADD INDEX `forumid_approved_postid` ( `forum_id` , `approved` , `post_id` ); +-- irmtfan add read_time indexes +ALTER TABLE `bb_reads_topic` + ADD INDEX `read_item_uid` ( `read_item`, `uid` ); + +ALTER TABLE `bb_reads_forum` + ADD INDEX `read_item_uid` ( `read_item`, `uid` ); \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/sql/mysql.sql =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/sql/mysql.sql 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/sql/mysql.sql 2012-10-15 09:27:16 UTC (rev 10215) @@ -220,7 +220,8 @@ PRIMARY KEY (`read_id`), KEY `uid` (`uid`), KEY `read_item` (`read_item`), - KEY `post_id` (`post_id`) + KEY `post_id` (`post_id`), + KEY `read_item_uid` (`read_item`, `uid`) ) ENGINE=MyISAM; -- -------------------------------------------------------- @@ -239,7 +240,8 @@ PRIMARY KEY (`read_id`), KEY `uid` (`uid`), KEY `read_item` (`read_item`), - KEY `post_id` (`post_id`) + KEY `post_id` (`post_id`), + KEY `read_item_uid` (`read_item`, `uid`) ) ENGINE=MyISAM; -- -------------------------------------------------------- Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-10-12 00:38:13 UTC (rev 10214) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-10-15 09:27:16 UTC (rev 10215) @@ -99,10 +99,16 @@ //$criteria_status_count->add(new Criteria("approved", 1));// irmtfan commented and removed //$criteria_status_post->add(new Criteria("p.approved", 1));// irmtfan commented and removed } elseif ($xoopsModuleConfig["read_mode"] ==2) { - $join = ' LEFT JOIN ' . $xoopsDB->prefix('bb_reads_topic') . ' AS r ON r.read_item = p.topic_id'; // irmtfan corrected add AS - $criteria_status_post = new CriteriaCompo();// irmtfan new criteria - $criteria_status_post->add(new Criteria("p.post_id", "r.`post_id`", ">")); // irmtfan corrected - should use $value="r.``" to render in XOOPS/class/criteria.php - $criteria_status_post->add(new Criteria("r.read_id", NULL, "IS NULL"), "OR");// irmtfan corrected - should use "IS NULL" to render in XOOPS/class/criteria.php + // START irmtfan use read_uid to find the unread posts when the user is logged in + $read_uid = is_object($xoopsUser)?$xoopsUser->getVar("uid"):0; + if (!empty($read_uid)) { + $join = ' LEFT JOIN ' . $xoopsDB->prefix('bb_reads_topic') . ' AS r ON r.read_item = p.topic_id AND r.uid = ' . $read_uid . ' '; // irmtfan corrected add AS + $criteria_status_post = new CriteriaCompo();// irmtfan new criteria + $criteria_status_post->add(new Criteria("p.post_id", "r.`post_id`", ">")); // irmtfan corrected - should use $value="r.``" to render in XOOPS/class/criteria.php + $criteria_status_post->add(new Criteria("r.read_id", NULL, "IS NULL"), "OR");// irmtfan corrected - should use "IS NULL" to render in XOOPS/class/criteria.php + } else { + } + // END irmtfan use read_uid to find the unread posts when the user is logged in //$criteria_status_post->add(new Criteria("p.approved", 1)); // irmtfan commented and removed //$criteria_status_count =& $criteria_status_post; $criteria_post->add($criteria_status_post); // irmtfan add the status criteria to post criteria |
From: <ir...@us...> - 2012-10-17 08:19:35
|
Revision: 10226 http://sourceforge.net/p/xoops/svn/10226 Author: irmtfan Date: 2012-10-17 08:19:31 +0000 (Wed, 17 Oct 2012) Log Message: ----------- improve: add startlag, length, striptag=true/false, strip tages excludes improve: skip empty results improve: default path for themes Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/icon.php XoopsModules/newbb/branches/irmtfan/newbb/class/read.php XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt XoopsModules/newbb/branches/irmtfan/newbb/include/functions.text.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php XoopsModules/newbb/branches/irmtfan/newbb/search.php XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_search.html Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-17 00:12:33 UTC (rev 10225) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-17 08:19:31 UTC (rev 10226) @@ -1,3 +1,20 @@ +date 2012-10-17 +=================================== +1- improve: add startlag, length, striptag=true/false, strip tages excludes in search form. +in newbb/search.php, newbb/include/functions.text.php, newbb/templates/newbb_search.php, newbb/language/LANG/main.php, newbb/docs/lang_diff.txt + +2- improve: in search form: dont show (skip) the result if both (post text) and (post subject) are empty. +in newbb/search.php, newbb/include/functions.text.php + +3- improve: in search fucntion: ability to create criteria for both since and search topic +in newbb/search.php + +4- comment add: the comment in class read about read_expire values was wrong +in newbb/class/read.php + +5- improve: add default path for themes/default and themes/YOUR_THEME (images, css, js) +in newbb/class/icon.php + date 2012-10-15 =================================== 1- bug fix: viewpost.php?status=new AND viewforum.php?forum=FFF&status=unread and list.topic.php?status=unread criteria was wrong when read_mode = 2(important) Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/icon.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/icon.php 2012-10-17 00:12:33 UTC (rev 10225) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/icon.php 2012-10-17 08:19:31 UTC (rev 10226) @@ -102,16 +102,32 @@ $theme_path = $this->template->currentTheme->path; $rel_dir = "modules/{$dirname}/{$end_dir}"; - - $path = is_dir($theme_path."/{$rel_dir}/{$type}/") - ? $theme_path."/{$rel_dir}/{$type}" - : ( is_dir(XOOPS_THEME_PATH."/default/{$rel_dir}/{$type}/") - ? XOOPS_THEME_PATH."/default/{$rel_dir}/{$type}" - : ( empty($default) || is_dir(XOOPS_ROOT_PATH."/modules/{$dirname}/templates/{$end_dir}/{$type}/") - ? XOOPS_ROOT_PATH."/modules/{$dirname}/templates/{$end_dir}/{$type}" - : XOOPS_ROOT_PATH."/modules/{$dirname}/templates/{$end_dir}/{$default}" - ) - ); + // START irmtfan add default for all pathes + if (empty($default)) { + $path = is_dir($theme_path."/{$rel_dir}/{$type}/") + ? $theme_path."/{$rel_dir}/{$type}" + : ( is_dir(XOOPS_THEME_PATH."/default/{$rel_dir}/{$type}/") + ? XOOPS_THEME_PATH."/default/{$rel_dir}/{$type}" + : XOOPS_ROOT_PATH."/modules/{$dirname}/templates/{$end_dir}/{$type}" + ); + } else { + $path = is_dir($theme_path."/{$rel_dir}/{$type}/") + ? $theme_path."/{$rel_dir}/{$type}" + : ( is_dir($theme_path."/{$rel_dir}/{$default}/") + ? $theme_path."/{$rel_dir}/{$default}" + : ( is_dir(XOOPS_THEME_PATH."/default/{$rel_dir}/{$type}/") + ? XOOPS_THEME_PATH."/default/{$rel_dir}/{$type}" + : ( is_dir(XOOPS_THEME_PATH."/default/{$rel_dir}/{$default}/") + ? XOOPS_THEME_PATH."/default/{$rel_dir}/{$default}" + : ( is_dir(XOOPS_ROOT_PATH."/modules/{$dirname}/templates/{$end_dir}/{$type}/") + ? XOOPS_ROOT_PATH."/modules/{$dirname}/templates/{$end_dir}/{$type}" + : XOOPS_ROOT_PATH."/modules/{$dirname}/templates/{$end_dir}/{$default}" + ) // XOOPS_ROOT_PATH + ) // XOOPS_THEME_PATH {$default} + ) // XOOPS_THEME_PATH + ); // $theme_path {$default} + } + // END irmtfan add default for all pathes $paths[$end_dir . '/' . $type] = str_replace(XOOPS_ROOT_PATH, "", $path); return $paths[$end_dir . '/' . $type]; Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/read.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/read.php 2012-10-17 00:12:33 UTC (rev 10225) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/read.php 2012-10-17 08:19:31 UTC (rev 10226) @@ -75,8 +75,9 @@ * seconds records will persist. * assigned from $xoopsModuleConfig["read_expire"] * <ul> - * <li>0 = never records</li> - * <li>-1 = never expires</li> + * <li>positive days = delete all read records exist in the tables before expire time // irmtfan add comment</li> + * <li>0 = never expires // irmtfan change comment</li> + * <li>-1 or any negative days = never records // irmtfan change comment</li> * </ul> * * @var integer Modified: XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2012-10-17 00:12:33 UTC (rev 10225) +++ XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2012-10-17 08:19:31 UTC (rev 10226) @@ -62,6 +62,12 @@ define('_MD_SEARCHTOPIC','Search Topic'); define('_MD_SHOWSEARCH','Show results:'); define('_MD_SEARCHPOSTTEXT','posts text'); +define('_MD_SELECT_STARTLAG','Start lag of selected text'); +define('_MD_SELECT_STARTLAG_DESC','Select text from X characters before the first keyword'); +define('_MD_SELECT_LENGTH','Length of selected text'); +define('_MD_SELECT_HTML','Strip all html from result?'); +define('_MD_SELECT_EXCLUDE','Exclude these tags:'); +define('_MD_SELECT_TAG','Tag'); admin.php --------- Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/functions.text.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/functions.text.php 2012-10-17 00:12:33 UTC (rev 10225) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/functions.text.php 2012-10-17 08:19:31 UTC (rev 10226) @@ -23,13 +23,14 @@ * @return text $select_text */ -function newbb_selectText($text, $queryarray, $selectstartlag = 100, $selectlength = 200, $striptags = true, $excludetags = '<br>') { +function newbb_selectText($text, $queryarray, $selectstartlag = 100, $selectlength = 200, $striptags = true, $excludetags = '<br>', $start_trimmarker = '[...]', $end_trimmarker = '[...]') { $sanitized_text = $striptags ? strip_tags($text, $excludetags) : $text; $queryarray = newbb_str2array($queryarray); $text_i = strtolower($sanitized_text); $queryarray = array_map('strtolower', $queryarray); $lengtharray = array_map('strlen', $queryarray); $maxlengthquery = max($lengtharray); + $lengthend_trimmarker = strlen($end_trimmarker); $select_text = ""; $startpos = 0; $endpos = strlen($sanitized_text); @@ -43,9 +44,12 @@ if ($pos == $endpos) break; $start = max(($pos - $selectstartlag), ($startpos - $maxlengthquery), 0); // $startpos is the last position in the previous select text $length = $maxlengthquery + $selectlength; //xoops_local("strlen", $query) + 200; - $select_text .= "<p>[...] " . xoops_substr($sanitized_text, $start, $length, " [...]") . "</p>"; + $select_text .= "<p>"; + $select_text .= ($start > 0) ? $start_trimmarker . " " : " "; + $select_text .= xoops_substr($sanitized_text, $start, $length + $lengthend_trimmarker + 1, " ". $end_trimmarker) . "</p>"; $startpos = $start + $length + 1; // start searching from next position. } + if ( empty($select_text) ) return ''; // if no text return empty string return '<span class="newbb_select_text">' . $select_text . '</span>'; } Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2012-10-17 00:12:33 UTC (rev 10225) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2012-10-17 08:19:31 UTC (rev 10226) @@ -500,4 +500,10 @@ define('_MD_SEARCHTOPIC','Search Topic'); define('_MD_SHOWSEARCH','Show results:'); define('_MD_SEARCHPOSTTEXT','Posts text'); +define('_MD_SELECT_STARTLAG','Start lag of selected text'); +define('_MD_SELECT_STARTLAG_DESC','Select text from X characters before the first keyword'); +define('_MD_SELECT_LENGTH','Length of selected text'); +define('_MD_SELECT_HTML','Strip all html from result?'); +define('_MD_SELECT_EXCLUDE','Exclude these tags:'); +define('_MD_SELECT_TAG','Tag'); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2012-10-17 00:12:33 UTC (rev 10225) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2012-10-17 08:19:31 UTC (rev 10226) @@ -498,4 +498,10 @@ define('_MD_SEARCHTOPIC','جستجو تاپیک'); define('_MD_SHOWSEARCH','نمایش نتایج:'); define('_MD_SEARCHPOSTTEXT','متن پست'); +define('_MD_SELECT_STARTLAG','شروع متن انتخابی'); +define('_MD_SELECT_STARTLAG_DESC','شروع انتخاب متن این مقدار کاراکتر قبل از اولین کلمه کلیدی پیدا شده در متن خواهد بود.'); +define('_MD_SELECT_LENGTH','طول متن انتخابی'); +define('_MD_SELECT_HTML','پاک کردن همه کد های html از متن جستجو شده؟'); +define('_MD_SELECT_EXCLUDE','این تگ های html را پاک نکن'); +define('_MD_SELECT_TAG','تگ'); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/search.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-10-17 00:12:33 UTC (rev 10225) +++ XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-10-17 08:19:31 UTC (rev 10226) @@ -56,13 +56,19 @@ $uid = 0; $forum = 0; $sortby = 'p.post_time'; // irmtfan remove DESC -$criteriaExtra = "";// irmtfan change to criteria +$criteriaExtra = new CriteriaCompo(); // irmtfan new criteria $searchin = "both"; $sort = ""; $since = isset($_POST['since']) ? $_POST['since'] : (isset($_GET['since']) ? $_GET['since'] : null); $next_search['since'] = $since; $term = isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : null); $uname = isset($_POST['uname']) ? $_POST['uname'] : (isset($_GET['uname']) ? $_GET['uname'] : null); +// irmtfan add select parameters +$selectstartlag = !empty($_GET['selectstartlag']) ? intval($_GET['selectstartlag']) : 100; +$selectlength = !empty($_GET['selectlength']) ? intval($_GET['selectlength']) : 200; +$selecthtml = isset($_GET['selecthtml']) ? ( !empty($_GET['selecthtml']) ? true : false ) : true; +$selectexclude = isset($_GET['selectexclude']) ? $_GET['selectexclude']: ''; +$selectexclude = newbb_str2array($selectexclude); if ($xoopsModuleConfig['wol_enabled']) { $online_handler =& xoops_getmodulehandler('online', 'newbb'); @@ -73,6 +79,15 @@ //$xoopsTpl->assign("img_folder", newbb_displayImage($forumImage['topic'])); if ( !empty($_REQUEST['submit']) || !empty($uname) || !empty($term)) { + // irmtfan filter positive numbers + $selectstartlag = !empty($selectstartlag) ? abs($selectstartlag) : 100; + $selectlength = !empty($selectlength) ? abs($selectlength) : 200; + // irmtfan add select parameters for next search + $next_search['selectstartlag'] = $selectstartlag; + $next_search['selectlength'] = $selectlength; + $next_search['selecthtml'] = $selecthtml; + $next_search['selectexclude'] = implode(", ", $selectexclude); + $start = isset($_GET['start']) ? $_GET['start'] : 0; $forum = isset($_POST['forum']) ? $_POST['forum'] : (isset($_GET['forum']) ? $_GET['forum'] : null); if (empty($forum) or $forum == 'all' or (is_array($forum) and in_array('all', $forum))) { @@ -154,15 +169,14 @@ $sortby = (in_array(strtolower($sortby), $allowed)) ? $sortby : 'p.post_time'; $searchin = isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? $_GET['searchin'] : 'both'); $next_search['searchin'] = $searchin; - // START irmtfan use criteria - add topic search + // START irmtfan use criteria - add since and topic search if (!empty($since)) { - $criteriaExtra = new CriteriaCompo(); $criteriaExtra->add(new Criteria('p.post_time', (time() - newbb_getSinceTime($since)), '>='), 'OR'); - } elseif (is_numeric($topic) && !empty($topic)) { - $criteriaExtra = new CriteriaCompo(); + } + if (is_numeric($topic) && !empty($topic)) { $criteriaExtra->add(new Criteria('p.topic_id', $topic), 'OR'); } - // END irmtfan use criteria - add topic search + // END irmtfan use criteria - add since and topic search if ($uname_required&&(!$uid||count($uid)<1)) $results = array(); // irmtfan bug fix array() else $results = newbb_search($queries, $andor, $limit, $start, $uid, $forum, $sortby, $searchin, $criteriaExtra); // irmtfan $criteriaExtra @@ -175,13 +189,27 @@ $xoopsTpl->assign("lang_nomatch", _SR_NOMATCH); } else { - // START irmtfan add show search post_text + // START irmtfan add show search post_text, skip the result if both (post text) and (post subject) are empty + $skipresults = 0; foreach ($results as $row) { $post_text = ""; + $post_text_select = "have text"; + $post_subject_select = "have text"; if ($show_search == 'post_text') { - $post_text = newbb_selectText($row['post_text'], $queries, 100, 200, false); // strip html tags = false + $post_text = newbb_selectText($row['post_text'], $queries, $selectstartlag, $selectlength, $selecthtml, implode("",$selectexclude)); // strip html tags = $selecthtml + $post_text_select = $post_text; $post_text = newbb_highlightText($post_text, $queries); + } elseif ( "title" != $searchin && !empty($selecthtml) ) { // find if there is any query left after strip html tags + $post_text_select = newbb_selectText($row['post_text'], $queries, 100, 30000, true, implode("",$selectexclude)); // strip html tags = true } + if ("text" != $searchin) { + $post_subject_select = newbb_selectText($row['title'], $queries, 100, 400, true);// strip html tags = true + } + // if no text remained after select text continue + if (empty($post_text_select) && empty($post_subject_select)) { + $skipresults = $skipresults + 1; + continue; + } // add newbb_highlightText function to subject - add post_text $xoopsTpl->append('results', array('forum_name' => $row['forum_name'], 'forum_link' => $row['forum_link'], 'link' => $row['link'], 'title' => newbb_highlightText($row['title'],$queries), 'poster' => $row['poster'], 'post_time' => formatTimestamp($row['time'], "m"), 'post_text' => $post_text)); } @@ -209,16 +237,22 @@ if ($num_results == $limit) { $next = $start + $limit; $queries = implode(',',$queries); - $search_url_next = $search_url."&start={$next}"; // irmtfan add { and } + $search_url_next = $search_url."&direction=next&start={$next}"; // irmtfan add { and } direction=next $search_next = '<a href="'.htmlspecialchars($search_url_next).'">'._SR_NEXT.'</a>'; $xoopsTpl->assign("search_next", $search_next); } if ( $start > 0 ) { $prev = $start - $limit; - $search_url_prev = $search_url."&start={$prev}"; // irmtfan add { and } + $search_url_prev = $search_url."&direction=previous&start={$prev}"; // irmtfan add { and } and direction=previous $search_prev = '<a href="'.htmlspecialchars($search_url_prev).'">'._SR_PREVIOUS.'</a>'; $xoopsTpl->assign("search_prev", $search_prev); } + // irmtfan if all results skipped then redirect to the next/previous page + if ( $num_results == $skipresults ) { + $direction = isset($_POST['direction']) ? $_POST['direction'] : (isset($_GET['direction']) ? $_GET['direction'] : 'next'); + $search_url_redirect = (strtolower($direction) == "next") ? $search_url_next : $search_url_prev; + redirect_header($search_url_redirect, 1, constant(strtoupper("_SR_{$direction}"))); + } } // irmtfan add newbb_highlightText function $search_info = _SR_KEYWORDS.": ".$search_info_keywords; @@ -228,6 +262,10 @@ } // add num_results $search_info .= "<br />" . sprintf(_SR_SHOWING, $start + 1, $start + $num_results); + // if any result skip show the counter + if (!empty($skipresults)) { + $search_info .= " - " . sprintf(_SR_FOUND, $num_results - $skipresults); + } $xoopsTpl->assign("search_info", $search_info); } // START irmtfan - assign template vars for search @@ -291,6 +329,47 @@ $sortby_select .= ">" . _MD_TOPIC . "</option>"; $sortby_select .= "</select>"; $xoopsTpl->assign("sortby_selection_box", $sortby_select); + +/* selectstartlag */ +$xoopsTpl->assign("selectstartlag_select", $selectstartlag); + +/* selectlength */ +$xoopsTpl->assign("selectlength_select", $selectlength); + +/* selecthtml */ +$selecthtml_select = ""; +$selecthtml_select .= "<input type=\"radio\" name=\"selecthtml\" value=\"1\" onclick=\"javascript: {document.Search.selectexcludeset.disabled=false;}\""; +if (!empty($selecthtml)) $selecthtml_select .= " checked"; +$selecthtml_select .= " />" . _YES . " "; +$selecthtml_select .= "<input type=\"radio\" name=\"selecthtml\" value=\"0\" onclick=\"javascript: {document.Search.selectexcludeset.disabled=true;}\""; +if (empty($selecthtml)) $selecthtml_select .= " checked"; +$selecthtml_select .= " />" . _NO . " "; +$xoopsTpl->assign("selecthtml_radio", $selecthtml_select); + +/* selectexclude */ +$selectexclude_select = "<fieldset name=\"selectexcludeset\""; +if (empty($selecthtml)) $selectexclude_select .= " disabled"; +$selectexclude_select .= " />"; +$selectexclude_select .= "<input type=\"checkbox\" name=\"selectexclude[]\" value=\"<p>\""; +if (in_array("<p>", $selectexclude)) $selectexclude_select .= " checked"; +$selectexclude_select .= " /> " . _MD_SELECT_TAG . " p "; +$selectexclude_select .= "<input type=\"checkbox\" name=\"selectexclude[]\" value=\"<br>\""; +if (in_array("<br>", $selectexclude)) $selectexclude_select .= " checked"; +$selectexclude_select .= " /> " . _MD_SELECT_TAG . " br "; +$selectexclude_select .= "<input type=\"checkbox\" name=\"selectexclude[]\" value=\"<a>\""; +if (in_array("<a>", $selectexclude)) $selectexclude_select .= " checked"; +$selectexclude_select .= " /> " . _MD_SELECT_TAG . " a "; +$selectexclude_select .= "<input type=\"checkbox\" name=\"selectexclude[]\" value=\"<div>\""; +if (in_array("<div>", $selectexclude)) $selectexclude_select .= " checked"; +$selectexclude_select .= " /> " . _MD_SELECT_TAG . " div "; +$selectexclude_select .= "<input type=\"checkbox\" name=\"selectexclude[]\" value=\"<img>\""; +if (in_array("<img>", $selectexclude)) $selectexclude_select .= " checked"; +$selectexclude_select .= " /> " . _MD_SELECT_TAG . " img "; +$selectexclude_select .= "<input type=\"checkbox\" name=\"selectexclude[]\" value=\"<span>\""; +if (in_array("<span>", $selectexclude)) $selectexclude_select .= " checked"; +$selectexclude_select .= " /> " . _MD_SELECT_TAG . " span "; +$selectexclude_select .= "</fieldset>"; +$xoopsTpl->assign("selectexclude_check_box", $selectexclude_select); // END irmtfan - assign template vars for search // irmtfan get since from the user for selction box Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_search.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_search.html 2012-10-17 00:12:33 UTC (rev 10225) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_search.html 2012-10-17 08:19:31 UTC (rev 10226) @@ -47,6 +47,24 @@ <td class="head" id="align_right"><strong><{$smarty.const._MD_SINCE}></strong> </td> <td class="even"><{$since_selection_box}></td> </tr> +<!-- START irmtfan add select text options --> + <tr> + <td class="head" id="align_right" title="<{$smarty.const._MD_SELECT_STARTLAG_DESC}>"><strong><{$smarty.const._MD_SELECT_STARTLAG}></strong> </td> + <td class="even" title="<{$smarty.const._MD_SELECT_STARTLAG_DESC}>"><input type="text" name="selectstartlag" value="<{$selectstartlag_select}>" /></td> + </tr> + <tr> + <td class="head" id="align_right"><strong><{$smarty.const._MD_SELECT_LENGTH}></strong> </td> + <td class="even"><input type="text" name="selectlength" value="<{$selectlength_select}>" /></td> + </tr> + <tr> + <td class="head" id="align_right"><strong><{$smarty.const._MD_SELECT_HTML}></strong> </td> + <td class="even"><{$selecthtml_radio}></td> + </tr> + <tr> + <td class="head" id="align_right"><strong><{$smarty.const._MD_SELECT_EXCLUDE}></strong> </td> + <td class="even"><{$selectexclude_check_box}></td> + </tr> +<!-- END irmtfan add select text options --> <!-- START irmtfan add show search --> <tr> <td class="head" id="align_right"><strong><{$smarty.const._MD_SHOWSEARCH}></strong> </td> |
From: <ir...@us...> - 2012-10-22 07:38:29
|
Revision: 10230 http://sourceforge.net/p/xoops/svn/10230 Author: irmtfan Date: 2012-10-22 07:38:25 +0000 (Mon, 22 Oct 2012) Log Message: ----------- bug fix: viewpost.php?status=new AND viewforum.php?forum=FFF&status=unread and list.topic.php?status=unread when read_mode = 1 (cookie) improve: read_mode = 1 for anon Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php XoopsModules/newbb/branches/irmtfan/newbb/include/functions.ini.php XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php XoopsModules/newbb/branches/irmtfan/newbb/index.php XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_index.html XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_index.html XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-20 11:50:14 UTC (rev 10229) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-22 07:38:25 UTC (rev 10230) @@ -1,3 +1,14 @@ +date 2012-10-22 +=================================== +1- bug fix: viewpost.php?status=new AND viewforum.php?forum=FFF&status=unread and list.topic.php?status=unread when read_mode = 1 (cookie) +in newbb/viewpost.php, newbb/class/forum.php, newbb/class/topic.renderer.php + +2- improve: change the read_mode = 2 (db) to read_mode = 1 (cookie) for anonymous users +in newbb/include/functions.ini.php, newbb/include/plugin.php + +3- minor bug fix: <{$lastvisit}> smarty variable is added for all users (members and anons) it was wrongly only for members +in newbb/index.php, newbb/templates/newbb_index.html, newbb/templates_fulldiv_opacity/newbb_index.html + date 2012-10-20 =================================== 1- bug fix: wrongly do not count sub forum posts/topics when count_subforum = 1 Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-10-20 11:50:14 UTC (rev 10229) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-10-22 07:38:25 UTC (rev 10230) @@ -221,22 +221,25 @@ } // END irmtfan use read_uid to find the unread posts when the user is logged in } elseif ($xoopsModuleConfig["read_mode"] == 1) { - $topics = array(); - $topic_lastread = newbb_getcookie('LT', true); - if (count($topic_lastread)>0) { - foreach ($topic_lastread as $id => $time) { - if ($time > $time_criterion) $topics[] = $id; - } - } - if (count($topics)>0) { - $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')'; - } - if ($lastvisit = max($GLOBALS['last_visit'], $startdate)) { - $criteria_post = ' p.post_time > ' . max($GLOBALS['last_visit'], $startdate); - } + // START irmtfan fix read_mode = 1 bugs + if ( $time_criterion = max($GLOBALS['last_visit'], $startdate) ) { + $criteria_post = ' p.post_time > ' . $time_criterion; // for all users + if (is_object($GLOBALS["xoopsUser"])) { // only for members + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > $time_criterion) $topics[] = $id; + } + } + if (count($topics)>0) { + $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')'; + } + } + } + // END irmtfan fix read_mode = 1 bugs } break; - case 'pending': $post_on = ' p.topic_id = t.topic_id'; $criteria_post .= ' AND p.pid = 0'; @@ -495,15 +498,23 @@ } // END irmtfan use read_uid to find the unread posts when the user is logged in } elseif ($xoopsModuleConfig["read_mode"] == 1) { - $criteria_post = ' p.post_time > ' . max($GLOBALS['last_visit'], $startdate); - $topics = array(); - $topic_lastread = newbb_getcookie('LT', true); - if (count($topic_lastread)>0) foreach ($topic_lastread as $id=>$time) { - if ($time > $time_criterion) $topics[] = $id; - } - if (count($topics)>0) { - $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')'; - } + // START irmtfan fix read_mode = 1 bugs + if ( $time_criterion = max($GLOBALS['last_visit'], $startdate) ) { + $criteria_post = ' p.post_time > ' . $time_criterion; // for all users + if (is_object($GLOBALS["xoopsUser"])) { // only for members + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > $time_criterion) $topics[] = $id; + } + } + if (count($topics)>0) { + $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')'; + } + } + } + // END irmtfan fix read_mode = 1 bugs } break; case 'pending': Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-10-20 11:50:14 UTC (rev 10229) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-10-22 07:38:25 UTC (rev 10230) @@ -171,9 +171,26 @@ // END irmtfan change criteria to get from uid p.uid = last post submit user id // User cookie } elseif ($this->config["read_mode"] == 1) { - if ($lastvisit =$GLOBALS['last_visit']) { - $this->query["where"][] = 'p.post_time > ' . $lastvisit; + // START irmtfan fix read_mode = 1 bugs + $startdate = !empty($this->vars["since"]) ? (time() - newbb_getSinceTime($this->vars["since"])) : 0; + if ( $lastvisit = max($GLOBALS['last_visit'], $startdate) ) { + if ( $lastvisit > $startdate ) { + $this->query["where"][] = 'p.post_time > ' . $lastvisit; + } + if (is_object($GLOBALS["xoopsUser"])) { // only for members + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > $lastvisit) $topics[] = $id; + } + } + if (count($topics)>0) { + $this->query["where"][] = ' t.topic_id NOT IN (' . implode(",", $topics) . ')'; + } + } } + // END irmtfan fix read_mode = 1 bugs } break; @@ -238,8 +255,13 @@ case "since": if (!empty($val)) { + // START irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query + $startdate = time() - newbb_getSinceTime($val); + if ( $this->vars["status"] == "unread" && $this->config["read_mode"] == 1 && $GLOBALS['last_visit'] > $startdate ) + break; // irmtfan - should be >= instead of = - $this->query["where"][] = "p.post_time >= ". (time() - newbb_getSinceTime($val)); + $this->query["where"][] = "p.post_time >= ". $startdate; + // START irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query } break; Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/functions.ini.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/functions.ini.php 2012-10-20 11:50:14 UTC (rev 10229) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/functions.ini.php 2012-10-22 07:38:25 UTC (rev 10230) @@ -50,6 +50,10 @@ load_functions("config"); $moduleConfig = mod_loadConfig("newbb"); + // irmtfan - change the read_mode = 2 (db) to read_mode = 1 (cookie) for anonymous users + if (!is_object($GLOBALS["xoopsUser"]) && $moduleConfig["read_mode_db_to_cookie_for_anon"] && 2 == $moduleConfig["read_mode"]) { + $moduleConfig["read_mode"] = 1; + } return $moduleConfig; } Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2012-10-20 11:50:14 UTC (rev 10229) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2012-10-22 07:38:25 UTC (rev 10230) @@ -98,6 +98,9 @@ $customConfig["jump_to_topic_last_post_read_enabled"] = true; // highlight keywords in search $customConfig["highlight_search_enable"] = true; +// change the read_mode = 2 (db) to read_mode = 1 (cookie) for anonymous users +// Note: if set to true only change read_mode for anonymous users if read_mode = 2 (db), set to false to no action. +$customConfig["read_mode_db_to_cookie_for_anon"] = true; // END hacked by irmtfan return $customConfig; Modified: XoopsModules/newbb/branches/irmtfan/newbb/index.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/index.php 2012-10-20 11:50:14 UTC (rev 10229) +++ XoopsModules/newbb/branches/irmtfan/newbb/index.php 2012-10-22 07:38:25 UTC (rev 10230) @@ -215,12 +215,14 @@ $userstats["topics"] = sprintf(_MD_USER_TOPICS, intval( @$userstats_row["user_topics"] )); $userstats["posts"] = sprintf(_MD_USER_POSTS, intval( @$userstats_row["user_posts"] )); $userstats["digests"] = sprintf(_MD_USER_DIGESTS, intval( @$userstats_row["user_digests"] )); - $userstats["currenttime"] = sprintf(_MD_TIMENOW, formatTimestamp(time(), "s")); - $userstats["lastvisit"] = sprintf(_MD_USER_LASTVISIT, formatTimestamp($last_visit, "s")); + $userstats["currenttime"] = sprintf(_MD_TIMENOW, formatTimestamp(time(), "s")); // irmtfan should be removed because it is for anon users too + $userstats["lastvisit"] = sprintf(_MD_USER_LASTVISIT, formatTimestamp($last_visit, "s")); // irmtfan should be removed because it is for anon users too $userstats["lastpost"] = empty($userstats_row["user_lastpost"]) ? _MD_USER_NOLASTPOST : sprintf(_MD_USER_LASTPOST, formatTimestamp($userstats_row["user_lastpost"], "s")); } $xoopsTpl->assign_by_ref("userstats", $userstats); - $xoopsTpl->assign('currenttime', sprintf(_MD_TIMENOW, formatTimestamp(time(), "m"))); + // irmtfan add lastvisit smarty variable for all users + $xoopsTpl->assign('lastvisit', sprintf(_MD_USER_LASTVISIT, formatTimestamp($last_visit, "l"))); + $xoopsTpl->assign('currenttime', sprintf(_MD_TIMENOW, formatTimestamp(time(), "m")) ); } Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_index.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_index.html 2012-10-20 11:50:14 UTC (rev 10229) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_index.html 2012-10-22 07:38:25 UTC (rev 10230) @@ -336,6 +336,8 @@ <div class="forum_stats odd" style="padding: 5px; line-height: 150%;"> <div class="forum_stats_left odd"> <{$currenttime}><br /> + <!-- irmtfan add lastvisit smarty variable for all users --> + <{$lastvisit}><br /> <{$smarty.const._MD_TOTALTOPICSC}> <strong><a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/list.topic.php" title="<{$smarty.const._MD_ALL}>"><{$stats[0].topic.total}></a></strong> | <{$smarty.const._MD_TOTALPOSTSC}><strong><a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/viewpost.php" title="<{$smarty.const._MD_ALLPOSTS}>"><{$stats[0].post.total}></a></strong> @@ -344,7 +346,8 @@ <{/if}> <{if $userstats}> <br /><br /> - <{$userstats.lastvisit}><br /><{$userstats.lastpost}> + <!-- irmtfan userstats.lastvisit should be removed because it is for anon users too --> + <{*$userstats.lastvisit*}><br /><{$userstats.lastpost}> <{/if}> </div> <div class="forum_stats_right odd"> Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_index.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_index.html 2012-10-20 11:50:14 UTC (rev 10229) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_index.html 2012-10-22 07:38:25 UTC (rev 10230) @@ -216,6 +216,7 @@ <div class="index_stat_foot forum_stats odd"> <div class="forum_stats_col odd left floatleft"> <{$currenttime}><br /> + <{$lastvisit}><br /> <{$smarty.const._MD_TOTALTOPICSC}> <strong><a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/list.topic.php" title="<{$smarty.const._MD_ALL}>"><{$stats[0].topic.total}></a></strong> | <{$smarty.const._MD_TOTALPOSTSC}><strong><a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/viewpost.php" title="<{$smarty.const._MD_ALLPOSTS}>"><{$stats[0].post.total}></a></strong> @@ -224,7 +225,7 @@ <{/if}> <{if $userstats}> <br /><br /> - <{$userstats.lastvisit}><br /><{$userstats.lastpost}> + <{*$userstats.lastvisit*}><br /><{$userstats.lastpost}> <{/if}> </div> <div class="forum_stats_col odd right floatright"> Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-10-20 11:50:14 UTC (rev 10229) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-10-22 07:38:25 UTC (rev 10230) @@ -116,6 +116,21 @@ } elseif ($xoopsModuleConfig["read_mode"] == 1) { $criteria_count->add(new Criteria("post_time", intval($last_visit), ">")); // irmtfan add new criteria $criteria_post->add(new Criteria("p.post_time", intval($last_visit), ">")); // irmtfan add new criteria + // START irmtfan fix read_mode = 1 bugs + if (is_object($GLOBALS["xoopsUser"])) { // only for members + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > intval($last_visit)) $topics[] = $id; + } + } + if (count($topics)>0) { + $criteria_count->add(new Criteria("topic_id", "(".implode(",",$topics).")", "NOT IN")); + $criteria_post->add(new Criteria("p.topic_id", "(".implode(",",$topics).")", "NOT IN")); + } + } + // END irmtfan fix read_mode = 1 bugs //$criteria_status_count->add(new Criteria("approved", 1));// irmtfan commented and removed //$criteria_status_post->add(new Criteria("p.approved", 1));// irmtfan commented and removed } |
From: <ir...@us...> - 2012-10-28 12:36:50
|
Revision: 10240 http://sourceforge.net/p/xoops/svn/10240 Author: irmtfan Date: 2012-10-28 12:36:47 +0000 (Sun, 28 Oct 2012) Log Message: ----------- bug fix: getRead_cookie should return array. bug fix: increment topic_views only if the topic is unread Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php XoopsModules/newbb/branches/irmtfan/newbb/class/read.php XoopsModules/newbb/branches/irmtfan/newbb/class/topic.php XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-28 08:29:50 UTC (rev 10239) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-28 12:36:47 UTC (rev 10240) @@ -1,3 +1,17 @@ +date 2012-10-28 +=================================== +1- bug fix: getRead_cookie should return array. (important) +in newbb/class/read.php + +2- improve: add LAST_INSERT_ID to enhance the mysql performances +in newbb/class/topic.php + +3- improve: set IP as COOKIE prefix for anonymous users +in newbb/include/vars.php, newbb/viewpost.php, newbb/class/forum.php, newbb/class/topic.renderer.php + +4- bug fix: increment topic_views only if the topic is unread (important) +in newbb/viewtopic.php + date 2012-10-22 =================================== 1- bug fix: viewpost.php?status=new AND viewforum.php?forum=FFF&status=unread and list.topic.php?status=unread when read_mode = 1 (cookie) Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-10-28 08:29:50 UTC (rev 10239) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-10-28 12:36:47 UTC (rev 10240) @@ -221,23 +221,21 @@ } // END irmtfan use read_uid to find the unread posts when the user is logged in } elseif ($xoopsModuleConfig["read_mode"] == 1) { - // START irmtfan fix read_mode = 1 bugs + // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) if ( $time_criterion = max($GLOBALS['last_visit'], $startdate) ) { $criteria_post = ' p.post_time > ' . $time_criterion; // for all users - if (is_object($GLOBALS["xoopsUser"])) { // only for members - $topics = array(); - $topic_lastread = newbb_getcookie('LT', true); - if (count($topic_lastread)>0) { - foreach ($topic_lastread as $id => $time) { - if ($time > $time_criterion) $topics[] = $id; - } + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > $time_criterion) $topics[] = $id; } - if (count($topics)>0) { - $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')'; - } } + if (count($topics)>0) { + $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')'; + } } - // END irmtfan fix read_mode = 1 bugs + // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) } break; case 'pending': @@ -498,23 +496,21 @@ } // END irmtfan use read_uid to find the unread posts when the user is logged in } elseif ($xoopsModuleConfig["read_mode"] == 1) { - // START irmtfan fix read_mode = 1 bugs + // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) if ( $time_criterion = max($GLOBALS['last_visit'], $startdate) ) { $criteria_post = ' p.post_time > ' . $time_criterion; // for all users - if (is_object($GLOBALS["xoopsUser"])) { // only for members - $topics = array(); - $topic_lastread = newbb_getcookie('LT', true); - if (count($topic_lastread)>0) { - foreach ($topic_lastread as $id => $time) { - if ($time > $time_criterion) $topics[] = $id; - } + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > $time_criterion) $topics[] = $id; } - if (count($topics)>0) { - $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')'; - } } + if (count($topics)>0) { + $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')'; + } } - // END irmtfan fix read_mode = 1 bugs + // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) } break; case 'pending': Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/read.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/read.php 2012-10-28 08:29:50 UTC (rev 10239) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/read.php 2012-10-28 12:36:47 UTC (rev 10240) @@ -157,7 +157,8 @@ { $cookie_name = ($this->type == "forum") ? "LF" : "LT"; $cookie_var = $item_id; - $lastview = newbb_getcookie($cookie_name); + // irmtfan set true to return array + $lastview = newbb_getcookie($cookie_name, true); return @$lastview[$cookie_var]; } Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.php 2012-10-28 08:29:50 UTC (rev 10239) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.php 2012-10-28 12:36:47 UTC (rev 10240) @@ -48,10 +48,10 @@ $this->initVar('poll_id', XOBJ_DTYPE_INT); $this->initVar('topic_tags', XOBJ_DTYPE_SOURCE); } - + // irmtfan add LAST_INSERT_ID to enhance the mysql performances function incrementCounter() { - $sql = 'UPDATE ' . $GLOBALS["xoopsDB"]->prefix('bb_topics') . ' SET topic_views = topic_views + 1 WHERE topic_id =' . $this->getVar('topic_id'); + $sql = 'UPDATE ' . $GLOBALS["xoopsDB"]->prefix('bb_topics') . ' SET topic_views = LAST_INSERT_ID(topic_views + 1) WHERE topic_id =' . $this->getVar('topic_id'); $GLOBALS["xoopsDB"]->queryF($sql); } Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-10-28 08:29:50 UTC (rev 10239) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-10-28 12:36:47 UTC (rev 10240) @@ -171,26 +171,24 @@ // END irmtfan change criteria to get from uid p.uid = last post submit user id // User cookie } elseif ($this->config["read_mode"] == 1) { - // START irmtfan fix read_mode = 1 bugs + // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) $startdate = !empty($this->vars["since"]) ? (time() - newbb_getSinceTime($this->vars["since"])) : 0; if ( $lastvisit = max($GLOBALS['last_visit'], $startdate) ) { if ( $lastvisit > $startdate ) { $this->query["where"][] = 'p.post_time > ' . $lastvisit; } - if (is_object($GLOBALS["xoopsUser"])) { // only for members - $topics = array(); - $topic_lastread = newbb_getcookie('LT', true); - if (count($topic_lastread)>0) { - foreach ($topic_lastread as $id => $time) { - if ($time > $lastvisit) $topics[] = $id; - } + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > $lastvisit) $topics[] = $id; } - if (count($topics)>0) { - $this->query["where"][] = ' t.topic_id NOT IN (' . implode(",", $topics) . ')'; - } } + if (count($topics)>0) { + $this->query["where"][] = ' t.topic_id NOT IN (' . implode(",", $topics) . ')'; + } } - // END irmtfan fix read_mode = 1 bugs + // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) } break; Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php 2012-10-28 08:29:50 UTC (rev 10239) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php 2012-10-28 12:36:47 UTC (rev 10240) @@ -15,6 +15,8 @@ } include_once XOOPS_ROOT_PATH.'/modules/newbb/include/functions.ini.php'; mod_loadFunctions("session", "newbb"); +// irmtfan include user functions for newbb_getIP +mod_loadFunctions("user", "newbb"); // NewBB cookie structure /* NewBB cookie storage @@ -36,7 +38,7 @@ $forumCookie['path'] = "/"; $forumCookie['secure'] = false; $forumCookie['expire'] = time() + 3600 * 24 * 30; // one month -$forumCookie['prefix'] = 'newbb_'.((is_object($xoopsUser)) ? $xoopsUser->getVar('uid') : 0); +$forumCookie['prefix'] = 'newbb_'.((is_object($xoopsUser)) ? $xoopsUser->getVar('uid') : '0IP' . newbb_getIP()); // irmtfan IP for anons // set LastVisitTemp cookie, which only gets the time from the LastVisit cookie if it does not exist yet // otherwise, it gets the time from the LastVisitTemp cookie Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-10-28 08:29:50 UTC (rev 10239) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-10-28 12:36:47 UTC (rev 10240) @@ -116,21 +116,19 @@ } elseif ($xoopsModuleConfig["read_mode"] == 1) { $criteria_count->add(new Criteria("post_time", intval($last_visit), ">")); // irmtfan add new criteria $criteria_post->add(new Criteria("p.post_time", intval($last_visit), ">")); // irmtfan add new criteria - // START irmtfan fix read_mode = 1 bugs - if (is_object($GLOBALS["xoopsUser"])) { // only for members - $topics = array(); - $topic_lastread = newbb_getcookie('LT', true); - if (count($topic_lastread)>0) { - foreach ($topic_lastread as $id => $time) { - if ($time > intval($last_visit)) $topics[] = $id; - } + // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > intval($last_visit)) $topics[] = $id; } - if (count($topics)>0) { - $criteria_count->add(new Criteria("topic_id", "(".implode(",",$topics).")", "NOT IN")); - $criteria_post->add(new Criteria("p.topic_id", "(".implode(",",$topics).")", "NOT IN")); - } } - // END irmtfan fix read_mode = 1 bugs + if (count($topics)>0) { + $criteria_count->add(new Criteria("topic_id", "(".implode(",",$topics).")", "NOT IN")); + $criteria_post->add(new Criteria("p.topic_id", "(".implode(",",$topics).")", "NOT IN")); + } + // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) //$criteria_status_count->add(new Criteria("approved", 1));// irmtfan commented and removed //$criteria_status_post->add(new Criteria("p.approved", 1));// irmtfan commented and removed } Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-10-28 08:29:50 UTC (rev 10239) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-10-28 12:36:47 UTC (rev 10240) @@ -76,13 +76,6 @@ } else { $topic_obj = $topic_handler->get($topic_id); } -// START irmtfan - jump to last post read -if (empty($post_id) && !empty($xoopsModuleConfig['jump_to_topic_last_post_read_enabled'])) { - $topic_last_post_id_read = newbb_getRead("topic", $topic_id); - if (!empty($topic_last_post_id_read) && $topic_last_post_id_read!=$topic_obj->getVar("topic_last_post_id")) - header("Location: ".$_SERVER['REQUEST_URI']."&post_id=".$topic_last_post_id_read); -} -// END irmtfan - jump to last post read if ( !is_object($topic_obj) || !$topic_id = $topic_obj->getVar('topic_id') ) { $redirect = empty($forum_id) ? XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/index.php" : XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/viewforum.php?forum={$forum_id}"; @@ -99,6 +92,34 @@ exit(); } +// START irmtfan - find if topic is read or unread - for all users (member and anon) +$topic_is_unread = true; +/* if $xoopsModuleConfig["read_mode"] == 0 || + * never read && $xoopsModuleConfig["read_mode"] == 1 || + * never read && $xoopsModuleConfig["read_mode"] == 2 || + * => $topic_last_post_time_or_id_read = NULL + * if !$xoopsUser && $xoopsModuleConfig["read_mode"] == 2 + * => $topic_last_post_time_or_id_read = false + * if !$xoopsUser && $xoopsModuleConfig["read_mode"] == 1 + * => $topic_last_post_time_or_id_read = lastview(newbb_IP{ip}LT) +*/ +$topic_last_post_time_or_id_read = newbb_getRead("topic", $topic_id); +if ( !empty($topic_last_post_time_or_id_read) ) { + if ( $xoopsModuleConfig["read_mode"] == 1 ) { + $post_handler =& xoops_getmodulehandler('post', 'newbb'); + $post_obj =& $post_handler->get($topic_obj->getVar("topic_last_post_id")); + $topic_is_unread = ( $topic_last_post_time_or_id_read < $post_obj->getVar("post_time") ); + } + if ( $xoopsModuleConfig["read_mode"] == 2 ) { + $topic_is_unread = ( $topic_last_post_time_or_id_read < $topic_obj->getVar("topic_last_post_id") ); + // hack jump to last post read if post_id is empty - is there any better way? + if ( empty($post_id) && !empty($xoopsModuleConfig['jump_to_topic_last_post_read_enabled']) && $topic_is_unread) { + header("Location: ".$_SERVER['REQUEST_URI']."&post_id=" . $topic_last_post_time_or_id_read); + } + } +} +// END irmtfan - find if topic is read or unread - for all users (member and anon) + /* Only admin has access to admin mode */ if (!$isadmin) { $status = ""; @@ -115,8 +136,8 @@ $total_posts = $topic_handler->getPostCount($topic_obj, $status); $postsArray = $topic_handler->getAllPosts($topic_obj, $order, $xoopsModuleConfig['posts_per_page'], $start, $post_id, $status); -//Threadersteller zählt nicht -if (!$xoopsUser || ($xoopsUser->getVar('uid') != $topic_obj->getVar('topic_poster')) ) { +//irmtfan - increment topic_views only if the topic is unread +if ($topic_is_unread) { $topic_obj->incrementCounter(); } newbb_setRead("topic", $topic_id, $topic_obj->getVar("topic_last_post_id")); |
From: <ir...@us...> - 2012-11-06 07:25:36
|
Revision: 10244 http://sourceforge.net/p/xoops/svn/10244 Author: irmtfan Date: 2012-11-06 07:25:31 +0000 (Tue, 06 Nov 2012) Log Message: ----------- bug fix: "all" typo in view all topic page Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-10-29 18:38:28 UTC (rev 10243) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-06 07:25:31 UTC (rev 10244) @@ -1,3 +1,8 @@ +date 2012-11-06 +=================================== +1- bug fix: in view all topic page: a typo "all" instead of all when the status is not set +in newbb/class/topic.renderer.php + date 2012-10-28 =================================== 1- bug fix: getRead_cookie should return array. (important) Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-10-29 18:38:28 UTC (rev 10243) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2012-11-06 07:25:31 UTC (rev 10244) @@ -290,8 +290,8 @@ if (isset($parsed)) return true; if (!isset($this->vars["forum"])) $this->vars["forum"] = null; - //irmtfan parse status for rendering topic correctly - if empty($_GET(status)) it will show all topics include deleted and pendings. - if (!isset($this->vars["status"])) $this->vars["status"] = all; + //irmtfan parse status for rendering topic correctly - if empty($_GET(status)) it will show all topics include deleted and pendings. "all" instead of all + if (!isset($this->vars["status"])) $this->vars["status"] = "all"; foreach ($this->vars as $var => $val) { $this->parseVar($var, $val); |
From: <ir...@us...> - 2012-11-07 12:51:05
|
Revision: 10246 http://sourceforge.net/p/xoops/svn/10246 Author: irmtfan Date: 2012-11-07 12:51:02 +0000 (Wed, 07 Nov 2012) Log Message: ----------- bug fix: in XOOPSCORE/search.php $xoopsModuleConfig and $xoopsModule is not set Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/include/search.inc.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-07 00:33:42 UTC (rev 10245) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-07 12:51:02 UTC (rev 10246) @@ -1,3 +1,8 @@ +date 2012-11-07 +=================================== +1- bug fix: in XOOPSCORE/search.php $xoopsModuleConfig and $xoopsModule is not set +in newbb/include/search.inc.php + date 2012-11-06 =================================== 1- bug fix: in view all topic page: a typo "all" instead of all when the status is not set Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/search.inc.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/search.inc.php 2012-11-07 00:33:42 UTC (rev 10245) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/search.inc.php 2012-11-07 12:51:02 UTC (rev 10246) @@ -13,11 +13,19 @@ if (!defined('XOOPS_ROOT_PATH')) { exit(); } +include_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.ini.php"; function newbb_search($queryarray, $andor, $limit, $offset, $userid, $forums = 0, $sortby = 0, $searchin = "both", $criteriaExtra = "") { global $myts; - + // irmtfan - in XOOPSCORE/search.php $xoopsModuleConfig is not set + if ( !isset($GLOBALS["xoopsModuleConfig"]) ) { + $GLOBALS["xoopsModuleConfig"] = newbb_load_config(); + } + // irmtfan - in XOOPSCORE/search.php $xoopsModule is not set + if ( !is_object($GLOBALS["xoopsModule"]) && is_object($GLOBALS["module"]) && $GLOBALS["module"]->getVar("dirname") == "newbb" ) { + $GLOBALS["xoopsModule"] = $GLOBALS["module"]; + } $forum_handler = xoops_getmodulehandler('forum', 'newbb'); $valid_forums = $forum_handler->getIdsByValues($forums); // can we use view permission? $forum_handler->getIdsByValues($forums, "view") |
From: <ir...@us...> - 2012-11-08 08:17:10
|
Revision: 10250 http://sourceforge.net/p/xoops/svn/10250 Author: irmtfan Date: 2012-11-08 08:17:07 +0000 (Thu, 08 Nov 2012) Log Message: ----------- bug fix: in viewforum.php?forum=XXX : change sort fields Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-07 16:18:31 UTC (rev 10249) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-08 08:17:07 UTC (rev 10250) @@ -1,3 +1,8 @@ +date 2012-11-08 +=================================== +1- bug fix: in viewforum.php?forum=XXX : change sort fields u.uname => t.topic_poster | t.topic_time => t.topic_id | "t.topic_ratings"=>_MD_RATINGS, | p.post_time => t.topic_last_post_id +in newbb/viewforum.php + date 2012-11-07 =================================== 1- bug fix: in XOOPSCORE/search.php $xoopsModuleConfig and $xoopsModule is not set Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php 2012-11-07 16:18:31 UTC (rev 10249) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php 2012-11-08 08:17:07 UTC (rev 10250) @@ -142,8 +142,8 @@ $xoopsTpl->assign('forum_name', $forum_obj->getVar('forum_name')); $xoopsTpl->assign('forum_moderators', $forum_obj->disp_forumModerators()); - -$sel_sort_array = array("t.topic_title"=>_MD_TOPICTITLE, "u.uname"=>_MD_TOPICPOSTER, "t.topic_time"=>_MD_TOPICTIME, "t.topic_replies"=>_MD_NUMBERREPLIES, "t.topic_views"=>_MD_VIEWS, "p.post_time"=>_MD_LASTPOSTTIME); +// irmtfan - add and edit: u.uname => t.topic_poster | t.topic_time => t.topic_id | "t.topic_ratings"=>_MD_RATINGS, | p.post_time => t.topic_last_post_id +$sel_sort_array = array("t.topic_title"=>_MD_TOPICTITLE, "t.topic_poster"=>_MD_TOPICPOSTER, "t.topic_id"=>_MD_TOPICTIME, "t.topic_replies"=>_MD_NUMBERREPLIES, "t.topic_views"=>_MD_VIEWS, "t.topic_ratings"=>_MD_RATINGS, "t.topic_last_post_id"=>_MD_LASTPOSTTIME); if ( !isset($_GET['sort']) || !in_array($_GET['sort'], array_keys($sel_sort_array)) ) { $sort = "t.topic_last_post_id"; } else { @@ -175,13 +175,14 @@ unset($query_sort["sort"], $query_sort["order"]); $page_query_sort = implode("&", array_values($query_sort)); unset($query_sort); +// irmtfan - edit: u.uname => t.topic_poster | t.topic_time => t.topic_id | p.post_time => t.topic_last_post_id $xoopsTpl->assign('h_topic_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_title&order=". (($sort == "t.topic_title" && $order == "DESC") ? "ASC" : "DESC")); $xoopsTpl->assign('h_reply_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_replies&order=". (($sort == "t.topic_replies" && $order == "DESC") ? "ASC" : "DESC")); -$xoopsTpl->assign('h_poster_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=u.uname&order=". (($sort == "u.uname" && $order == "DESC") ? "ASC" : "DESC")); +$xoopsTpl->assign('h_poster_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_poster&order=". (($sort == "t.topic_poster" && $order == "DESC") ? "ASC" : "DESC")); $xoopsTpl->assign('h_views_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_views&order=". (($sort == "t.topic_views" && $order == "DESC") ? "ASC" : "DESC")); $xoopsTpl->assign('h_rating_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_ratings&order=". (($sort == "t.topic_ratings" && $order == "DESC") ? "ASC" : "DESC")); -$xoopsTpl->assign('h_date_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=p.post_time&order=". (($sort == "p.post_time" && $order == "DESC") ? "ASC" : "DESC")); -$xoopsTpl->assign('h_publish_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_time&order=". (($sort == "t.topic_time" && $order == "DESC") ? "ASC" : "DESC")); +$xoopsTpl->assign('h_date_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_last_post_id&order=". (($sort == "t.topic_last_post_id" && $order == "DESC") ? "ASC" : "DESC")); +$xoopsTpl->assign('h_publish_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_id&order=". (($sort == "t.topic_id" && $order == "DESC") ? "ASC" : "DESC")); $xoopsTpl->assign('forum_since', $since); // For $since in search.php // irmtfan - if no since it should be 0 |
From: <ir...@us...> - 2012-11-12 07:26:35
|
Revision: 10253 http://sourceforge.net/p/xoops/svn/10253 Author: irmtfan Date: 2012-11-12 07:26:28 +0000 (Mon, 12 Nov 2012) Log Message: ----------- bug fix: in full div templates: replacing tr/td to span was incorrectly done bug fix: add selecthtml=0 to the next search Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/search.php XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_edit_post.html Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-09 13:27:35 UTC (rev 10252) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-12 07:26:28 UTC (rev 10253) @@ -1,3 +1,11 @@ +date 2012-11-12 +=================================== +1- bug fix: in full div templates set: in smarty replace: replacing tr/td to span was incorrectly done +in newbb/templates_fulldiv_opacity/newbb_edit_post.html + +2- bug fix: in newbb/search.php: add selecthtml=0 to the next search link +in newbb/search.php + date 2012-11-08 =================================== 1- bug fix: in viewforum.php?forum=XXX : change sort fields u.uname => t.topic_poster | t.topic_time => t.topic_id | "t.topic_ratings"=>_MD_RATINGS, | p.post_time => t.topic_last_post_id Modified: XoopsModules/newbb/branches/irmtfan/newbb/search.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-11-09 13:27:35 UTC (rev 10252) +++ XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-11-12 07:26:28 UTC (rev 10253) @@ -219,7 +219,7 @@ if (count($next_search)>0) { $items = array(); foreach ($next_search as $para => $val) { - if (!empty($val)) $items[] = "{$para}={$val}";// irmtfan add { and } + if (!empty($val) || $para == "selecthtml") $items[] = "{$para}={$val}";// irmtfan add { and } - add $para when selecthtml = 0 (no strip) } if (count($items)>0) $paras = implode("&",$items); unset($next_search); Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_edit_post.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_edit_post.html 2012-11-09 13:27:35 UTC (rev 10252) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_edit_post.html 2012-11-12 07:26:28 UTC (rev 10253) @@ -53,7 +53,7 @@ <div class="xoops-form-element-help"><{$element.description}></div> <{/if}> </div> - <div class="_col_end odd"><{$element.body|replace:'tr':'span'|replace:'td':'span'}></div> + <div class="_col_end odd"><{$element.body|replace:'<tr':'<span'|replace:'<td':'<span'|replace:'</tr':'</span'|replace:'</td':'</span'}></div> <div class="clear"></div> <{/if}> <{/foreach}> |
From: <ir...@us...> - 2012-11-15 06:59:10
|
Revision: 10254 http://sourceforge.net/p/xoops/svn/10254 Author: irmtfan Date: 2012-11-15 06:59:03 +0000 (Thu, 15 Nov 2012) Log Message: ----------- feature add: add pdf and print permissions. FAQ add: access denied in admin => permission. Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/permission.forum.php XoopsModules/newbb/branches/irmtfan/newbb/class/post.php XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt XoopsModules/newbb/branches/irmtfan/newbb/docs/readme.txt XoopsModules/newbb/branches/irmtfan/newbb/include/module.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/admin.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/admin.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php XoopsModules/newbb/branches/irmtfan/newbb/makepdf.php XoopsModules/newbb/branches/irmtfan/newbb/print.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-12 07:26:28 UTC (rev 10253) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-15 06:59:03 UTC (rev 10254) @@ -1,3 +1,13 @@ +date 2012-11-14 +=================================== +1- feature add: add pdf and print permissions. fix html and signature permission in new install. +Important Note: you must set permissions for each group and each forum in newbb -> admin -> set permissions otherwise only newbb admins have permissions. +in newbb/class/post.php, newbb/class/permission.forum.php, newbb/makepdf.php, newbb/print.php, + newbb/language/LANG/main.php, newbb/language/LANG/admin.php, newbb/docs/lang_diff.txt + +2- FAQ add: after submit in newbb => admin => permissions it said "Sorry, you don't have the permission to access this area" +in newbb/docs/readme.txt + date |
From: <ir...@us...> - 2012-11-19 07:18:34
|
Revision: 10257 http://sourceforge.net/p/xoops/svn/10257 Author: irmtfan Date: 2012-11-19 07:18:31 +0000 (Mon, 19 Nov 2012) Log Message: ----------- bug fix: moderator have all access over forum regardless of his/her group access Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-18 22:32:49 UTC (rev 10256) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-11-19 07:18:31 UTC (rev 10257) @@ -1,3 +1,8 @@ +date 2012-11-19 +=================================== +1- bug fix: in viewforum.php?forum=XXX . moderator have all access over the forum regardless of his/her group access. +in newbb/class/forum.php + date 2012-11-14 =================================== 1- feature add: add pdf and print permissions. fix html and signature permission in new install. Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-11-18 22:32:49 UTC (rev 10256) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/forum.php 2012-11-19 07:18:31 UTC (rev 10257) @@ -555,9 +555,12 @@ static $_cachedPerms; if ($type == "all") return true; - if ($GLOBALS["xoopsUserIsAdmin"] && $xoopsModule->getVar("dirname") == "newbb") { - return true; - } + // irmtfan - if user is forum moderator then return true + mod_loadFunctions("user", "newbb"); + if (newbb_isAdmin($forum)) return true; + //if ($GLOBALS["xoopsUserIsAdmin"] && $xoopsModule->getVar("dirname") == "newbb") { + //return true; + //} if (!is_object($forum)) $forum =& $this->get($forum); @@ -568,14 +571,16 @@ } $type = strtolower($type); - if ("moderate" == $type) { - require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.user.php"; - $permission = newbb_isModerator($forum); - } else { + // START irmtfan commented and removed + //if ("moderate" == $type) { + //require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.user.php"; + //$permission = newbb_isModerator($forum); + //} else { $forum_id = $forum->getVar('forum_id'); $perm_handler =& xoops_getmodulehandler('permission', 'newbb'); $permission = $perm_handler->getPermission("forum", $type, $forum_id); - } + //} + // END irmtfan commented and removed return $permission; } |
From: <be...@us...> - 2012-11-21 02:25:06
|
Revision: 10262 http://sourceforge.net/p/xoops/svn/10262 Author: beckmi Date: 2012-11-21 02:25:02 +0000 (Wed, 21 Nov 2012) Log Message: ----------- Adding corrected .htaccess file (Trabis) Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/docs/changelog.txt Added Paths: ----------- XoopsModules/newbb/branches/irmtfan/newbb/.htaccess Removed Paths: ------------- XoopsModules/newbb/branches/irmtfan/newbb/_htaccess Added: XoopsModules/newbb/branches/irmtfan/newbb/.htaccess =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/.htaccess (rev 0) +++ XoopsModules/newbb/branches/irmtfan/newbb/.htaccess 2012-11-21 02:25:02 UTC (rev 10262) @@ -0,0 +1,3 @@ +RewriteEngine on +RewriteRule ^([a-z]+)-([0-9]+)(/(.+))? modules/newbb/seo.php?seoOp=$1&seoArg=$2&seoOther=$4&%{QUERY_STRING} [L] +#RewriteRule ^(.*)$ $1 [L] \ No newline at end of file Deleted: XoopsModules/newbb/branches/irmtfan/newbb/_htaccess =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/_htaccess 2012-11-20 08:47:14 UTC (rev 10261) +++ XoopsModules/newbb/branches/irmtfan/newbb/_htaccess 2012-11-21 02:25:02 UTC (rev 10262) @@ -1,3 +0,0 @@ -RewriteEngine on -RewriteRule ^([a-z]+)-([0-9]+)(/(.+))? seo.php?seoOp=$1&seoArg=$2&seoOther=$4&%{QUERY_STRING} [L] -RewriteRule ^(.*)$ $1 [L] Modified: XoopsModules/newbb/branches/irmtfan/newbb/docs/changelog.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/docs/changelog.txt 2012-11-20 08:47:14 UTC (rev 10261) +++ XoopsModules/newbb/branches/irmtfan/newbb/docs/changelog.txt 2012-11-21 02:25:02 UTC (rev 10262) @@ -1,4 +1,11 @@ newBB +Changelog 4.3i (changes by Irmtfan) +11/20/2012 +=========================================== +- needs to be updated with all the changes +- fixed .htaccess (Trabis) + +newBB Changelog 4.3 08/25/2012 =========================================== |
From: <ir...@us...> - 2012-12-25 09:21:56
|
Revision: 10545 http://sourceforge.net/p/xoops/svn/10545 Author: irmtfan Date: 2012-12-25 09:21:53 +0000 (Tue, 25 Dec 2012) Log Message: ----------- bug fix: update regarding xoopspoll 1.33 changes - also working with prev versions Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/polls.php XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php XoopsModules/newbb/branches/irmtfan/newbb/votepolls.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-25 09:14:22 UTC (rev 10544) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-25 09:21:53 UTC (rev 10545) @@ -1,3 +1,14 @@ +date 2012-12-25 +=================================== +1- bug fix: when vote in polls it should save user ip to db +in newbb/votepolls.php + +2- bug fix: user is not allowed to vote when the poll is expired +in newbb/viewtopic.php, newbb/votepolls.php + +3- bug fix: in edit poll page topic_id is missing in restart this poll url +in newbb/polls.php + date 2012-11-19 =================================== 1- bug fix: in viewforum.php?forum=XXX . moderator have all access over the forum regardless of his/her group access. Modified: XoopsModules/newbb/branches/irmtfan/newbb/polls.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/polls.php 2012-12-25 09:14:22 UTC (rev 10544) +++ XoopsModules/newbb/branches/irmtfan/newbb/polls.php 2012-12-25 09:21:53 UTC (rev 10545) @@ -266,8 +266,8 @@ $expire_text = new XoopsFormText(_MD_POLL_EXPIRATION . "<br /><small>" . _MD_POLL_FORMAT . "<br />" . sprintf(_MD_POLL_CURRENTTIME, formatTimestamp(time(), "Y-m-d H:i:s")) . "</small>", "end_time", 20, 19, $date); $poll_form->addElement($expire_text); } else { - // irmtfan full URL - $restart_label = new XoopsFormLabel(_MD_POLL_EXPIRATION, sprintf(_MD_POLL_EXPIREDAT, $date) . "<br /><a href='".XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/polls.php?op=restart&poll_id=" . $poll->getVar("poll_id") . "'>" . _MD_POLL_RESTART . "</a>"); + // irmtfan full URL - add topic_id + $restart_label = new XoopsFormLabel(_MD_POLL_EXPIRATION, sprintf(_MD_POLL_EXPIREDAT, $date) . "<br /><a href='".XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/polls.php?op=restart&poll_id=" . $poll->getVar("poll_id") . "&topic_id=" . $topic_id . "'>" . _MD_POLL_RESTART . "</a>"); $poll_form->addElement($restart_label); } $weight_text = new XoopsFormText(_MD_POLL_DISPLAYORDER, "weight", 6, 5, $poll->getVar("weight")); Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-12-25 09:14:22 UTC (rev 10544) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-12-25 09:21:53 UTC (rev 10545) @@ -472,7 +472,8 @@ if ($pollmodul == 'xoopspoll') { $poll = new XoopsPoll($topic_obj->getVar('poll_id')); $renderer = new XoopsPollRenderer($poll); - if ( XoopsPollLog::hasVoted($topic_obj->getVar('poll_id'), $_SERVER['REMOTE_ADDR'], $uid) ) { + // irmtfan - if the poll is expired show the result + if ( XoopsPollLog::hasVoted($topic_obj->getVar('poll_id'), $_SERVER['REMOTE_ADDR'], $uid) || $poll->hasExpired() ) { $renderer->assignResults($xoopsTpl); $xoopsTpl->assign('topic_pollresult', 1); setcookie("bb_polls[".$topic_obj->getVar("poll_id")."]", 1); Modified: XoopsModules/newbb/branches/irmtfan/newbb/votepolls.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/votepolls.php 2012-12-25 09:14:22 UTC (rev 10544) +++ XoopsModules/newbb/branches/irmtfan/newbb/votepolls.php 2012-12-25 09:21:53 UTC (rev 10545) @@ -80,13 +80,17 @@ $mail_author = false; if ( $pollmodules == 'xoopspoll') { $poll = new XoopsPoll($poll_id); - + // irmtfan - if the poll is expired redirect + if ( $poll->hasExpired() ) { + redirect_header("viewtopic.php?topic_id=$topic_id", 1, _PL_SORRYEXPIRED); + } if ( is_object($xoopsUser) ) { if ( XoopsPollLog::hasVoted($poll_id, $_SERVER['REMOTE_ADDR'], $xoopsUser->getVar("uid")) ) { $msg = _PL_ALREADYVOTED; setcookie("bb_polls[$poll_id]", 1); } else { - $poll->vote($_POST['option_id'], '', $xoopsUser->getVar("uid")); + // irmtfan save ip to db + $poll->vote($_POST['option_id'], $_SERVER['REMOTE_ADDR'], $xoopsUser->getVar("uid")); $poll->updateCount(); $msg = _PL_THANKSFORVOTE; setcookie("bb_polls[$poll_id]", 1); @@ -109,7 +113,8 @@ $msg = _PL_ALREADYVOTED; setcookie("bb_polls[$poll_id]", 1); } else { - $poll->vote($_POST['option_id'], '', $xoopsUser->getVar("uid")); + // irmtfan save ip to db + $poll->vote($_POST['option_id'], $_SERVER['REMOTE_ADDR'], $xoopsUser->getVar("uid")); $poll->updateCount(); $msg = _PL_THANKSFORVOTE; setcookie("bb_polls[$poll_id]", 1); @@ -126,9 +131,10 @@ } } } - redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id=$topic_id&forum=$forum&poll_id=$poll_id&pollresult=1", 1, $msg); + // irmtfan - simple url + redirect_header("viewtopic.php?topic_id=$topic_id", 1, $msg); exit(); } -// irmtfan - add error message -redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id=$topic_id&forum=$forum", 1, _MD_POLL_NOOPTION); +// irmtfan - add error message - simple url +redirect_header("viewtopic.php?topic_id=$topic_id", 1, _MD_POLL_NOOPTION); ?> \ No newline at end of file |
From: <ir...@us...> - 2012-12-26 13:26:23
|
Revision: 10557 http://sourceforge.net/p/xoops/svn/10557 Author: irmtfan Date: 2012-12-26 13:26:21 +0000 (Wed, 26 Dec 2012) Log Message: ----------- bug fix: Warning: xoopsOption[template_main] should be defined before including header.php in file /footer.php line 59 Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/edit.php XoopsModules/newbb/branches/irmtfan/newbb/footer.php XoopsModules/newbb/branches/irmtfan/newbb/header.php XoopsModules/newbb/branches/irmtfan/newbb/index.php XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php XoopsModules/newbb/branches/irmtfan/newbb/newtopic.php XoopsModules/newbb/branches/irmtfan/newbb/post.php XoopsModules/newbb/branches/irmtfan/newbb/reply.php XoopsModules/newbb/branches/irmtfan/newbb/search.php XoopsModules/newbb/branches/irmtfan/newbb/topicmanager.php XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-26 13:26:21 UTC (rev 10557) @@ -1,3 +1,12 @@ +date 2012-12-26 +=================================== +1- bug fix: Warning: xoopsOption[template_main] should be defined before including header.php in file /footer.php line 59 +in newbb/edit.php, newbb/header.php, newbb/index.php, newbb/list.topic.php, newbb/newtopic.php, newbb/post.php, newbb/reply.php, +newbb/search.php, newbb/topicmanager.php, newbb/viewforum.php, newbb/viewpost.php, newbb/viewtopic.php + +2- improve: use addStylesheet instead of xoops_module_header to add toggle script because some themes are not standard +in newbb/header.php, newbb/footer.php + date 2012-12-25 =================================== 1- bug fix: when vote in polls it should save user ip to db Modified: XoopsModules/newbb/branches/irmtfan/newbb/edit.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/edit.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/edit.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -75,8 +75,8 @@ $xoopsOption['template_main'] = 'newbb_edit_post.html'; $xoopsConfig["module_cache"][$xoopsModule->getVar("mid")] = 0; -// irmtfan remove and move to header.php -//include XOOPS_ROOT_PATH.'/header.php'; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH.'/header.php'; /* $xoopsTpl->assign('lang_forum_index', sprintf(_MD_FORUMINDEX, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES))); Modified: XoopsModules/newbb/branches/irmtfan/newbb/footer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/footer.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/footer.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -40,4 +40,7 @@ $xoTheme->addScript($js_rel_path . '/' . $jsfile); } } +// add toggle script +$toggle_script="var toggle_cookie=\"" . $forumCookie["prefix"] . "G" . "\";"; +$xoTheme->addScript( null, array ('type' => 'text/javascript'), $toggle_script); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/header.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/header.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/header.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -12,9 +12,9 @@ include_once '../../mainfile.php'; defined('XOOPS_ROOT_PATH') or die('Restricted access'); $xoopsLogger->startTime('newBB_Header'); -// irmtfan assign newbb dirname then replace all. include xoops header.php +// irmtfan assign newbb dirname then replace all. include xoops header.php (now commented and removed) $dirname = $xoopsModule->getVar("dirname"); -include_once XOOPS_ROOT_PATH . "/header.php"; +//include_once XOOPS_ROOT_PATH . "/header.php"; if (!empty($xoopsModuleConfig['do_rewrite'])) { include_once "seo_url.php"; @@ -71,11 +71,11 @@ foreach ($xoopsModuleConfig["valid_menumodes"] as $key => $val) { if ($key != $menumode) $menumode_other[] = array("title"=>$val, "link"=>$menu_url.$key); } -// irmtfan new method for add js scripts -global $xoopsTpl; -$xoopsTpl->assign("xoops_module_header",' - <script type="text/javascript">var toggle_cookie="'.$forumCookie['prefix'].'G'.'";</script> - '. @$xoopsTpl->get_template_vars("xoops_module_header")); +// irmtfan new method for add js scripts - commented and move to footer.php +//global $xoopsTpl; +//$xoopsTpl->assign("xoops_module_header",' + //<script type="text/javascript">var toggle_cookie="'.$forumCookie['prefix'].'G'.'";</script> + //'. @$xoopsTpl->get_template_vars("xoops_module_header")); /* START irmtfan remove and move to newbb/footer.php */ /* Modified: XoopsModules/newbb/branches/irmtfan/newbb/index.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/index.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/index.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -50,6 +50,13 @@ exit(); } +$xoopsOption['template_main'] = 'newbb_index.html'; +$xoopsOption['xoops_pagetitle'] = $xoops_pagetitle; +// irmtfan remove and move to footer.php +//$xoopsOption['xoops_module_header'] = $xoops_module_header; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once $GLOBALS['xoops']->path('header.php'); +mod_loadFunctions("render", "newbb"); /* rss feed */ // irmtfan new method if (!empty($xoopsModuleConfig['rss_enable'])) { @@ -57,14 +64,6 @@ <link rel="alternate" type="application/xml+rss" title="'.$xoopsModule->getVar('name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/rss.php" /> '. @$xoopsTpl->get_template_vars("xoops_module_header")); } - -$xoopsOption['template_main'] = 'newbb_index.html'; -$xoopsOption['xoops_pagetitle'] = $xoops_pagetitle; -// irmtfan remove and move to footer.php -//$xoopsOption['xoops_module_header'] = $xoops_module_header; -//include $GLOBALS['xoops']->path('header.php'); -mod_loadFunctions("render", "newbb"); - $xoopsTpl->assign('xoops_pagetitle', $xoops_pagetitle); // irmtfan remove and move to footer.php //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); Modified: XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -11,16 +11,17 @@ */ include_once dirname(__FILE__) . "/header.php"; + +//$xoopsOption['xoops_module_header']= $xoops_module_header; +$xoopsOption['template_main'] = 'newbb_viewall.html'; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH."/header.php"; // irmtfan new method if (!empty($xoopsModuleConfig['rss_enable'])) { $xoopsTpl->assign("xoops_module_header",' <link rel="alternate" type="application/xml+rss" title="'.$xoopsModule->getVar('name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/rss.php" /> '. @$xoopsTpl->get_template_vars("xoops_module_header")); } -//$xoopsOption['xoops_module_header']= $xoops_module_header; -$xoopsOption['template_main'] = 'newbb_viewall.html'; -//include XOOPS_ROOT_PATH."/header.php"; - //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); mod_loadFunctions("time", "newbb"); Modified: XoopsModules/newbb/branches/irmtfan/newbb/newtopic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/newtopic.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/newtopic.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -52,7 +52,8 @@ $xoopsConfig["module_cache"][$xoopsModule->getVar("mid")] = 0; // Disable cache // irmtfan remove and move to footer.php //$xoopsOption['xoops_module_header']= $xoops_module_header; -//include XOOPS_ROOT_PATH.'/header.php'; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH.'/header.php'; //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); /* Modified: XoopsModules/newbb/branches/irmtfan/newbb/post.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/post.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/post.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -414,7 +414,8 @@ $xoopsConfig["module_cache"][$xoopsModule->getVar("mid")] = 0; // irmtfan remove and move to footer.php //$xoopsOption['xoops_module_header']= $xoops_module_header; -//include XOOPS_ROOT_PATH . "/header.php"; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH . "/header.php"; //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); if ( !empty($_POST['contents_upload']) ) { Modified: XoopsModules/newbb/branches/irmtfan/newbb/reply.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/reply.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/reply.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -88,7 +88,8 @@ $xoopsConfig["module_cache"][$xoopsModule->getVar("mid")] = 0; // irmtfan remove and move to footer.php //$xoopsOption['xoops_module_header']= $xoops_module_header; -//include XOOPS_ROOT_PATH.'/header.php'; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH.'/header.php'; //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); /* Modified: XoopsModules/newbb/branches/irmtfan/newbb/search.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -39,8 +39,8 @@ $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; $xoopsOption['template_main']= 'newbb_search.html'; -// irmtfan remove and move to header.php -//include XOOPS_ROOT_PATH.'/header.php'; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH.'/header.php'; mod_loadFunctions("render", "newbb"); mod_loadFunctions("forum", "newbb"); Modified: XoopsModules/newbb/branches/irmtfan/newbb/topicmanager.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/topicmanager.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/topicmanager.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -89,8 +89,8 @@ // Disable cache $xoopsConfig["module_cache"][$xoopsModule->getVar("mid")] = 0; -// irmtfan remove here and move to header.php -//include XOOPS_ROOT_PATH.'/header.php'; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH.'/header.php'; if ( isset($_POST['submit']) ) { $mode = $_POST['mode']; Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -63,21 +63,20 @@ $xoops_pagetitle = $forum_obj->getVar('forum_name') . " [" .$xoopsModule->getVar('name')."]"; + +$xoopsOption['template_main'] = 'newbb_viewforum.html'; +$xoopsOption['xoops_pagetitle']= $xoops_pagetitle; +// irmtfan remove and move to footer.php +//$xoopsOption['xoops_module_header']= $xoops_module_header; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH."/header.php"; +mod_loadFunctions("render", "newbb"); // irmtfan new method if (!empty($xoopsModuleConfig['rss_enable'])) { $xoopsTpl->assign("xoops_module_header",' <link rel="alternate" type="application/xml+rss" title="'.$xoopsModule->getVar('name').'-'.$forum_obj->getVar('forum_name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/rss.php?f='.$forum_id.'" /> '. @$xoopsTpl->get_template_vars("xoops_module_header")); } - -$xoopsOption['template_main'] = 'newbb_viewforum.html'; -$xoopsOption['xoops_pagetitle']= $xoops_pagetitle; -// irmtfan remove and move to footer.php -//$xoopsOption['xoops_module_header']= $xoops_module_header; - -//include XOOPS_ROOT_PATH."/header.php"; -mod_loadFunctions("render", "newbb"); - //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); $xoopsTpl->assign("forum_id", $forum_id); $xoopsTpl->assign('version', $xoopsModule->getVar("version")); Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -171,8 +171,8 @@ // irmtfan remove and move to footer.php //$xoopsOption['xoops_module_header']= $xoops_module_header; $xoopsOption['template_main'] = 'newbb_viewpost.html'; - -//include XOOPS_ROOT_PATH."/header.php"; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH."/header.php"; mod_loadFunctions("time", "newbb"); mod_loadFunctions("render", "newbb"); Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-12-26 09:57:13 UTC (rev 10556) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2012-12-26 13:26:21 UTC (rev 10557) @@ -141,6 +141,13 @@ $topic_obj->incrementCounter(); } newbb_setRead("topic", $topic_id, $topic_obj->getVar("topic_last_post_id")); + +$xoopsOption['template_main'] = 'newbb_viewtopic.html'; +// irmtfan remove and move to footer.php +//$xoopsOption['xoops_module_header']= $xoops_module_header; +// irmtfan include header.php after defining $xoopsOption['template_main'] +include_once XOOPS_ROOT_PATH."/header.php"; +//$xoopsTpl->assign('xoops_module_header', $xoops_module_header); // irmtfan new method if (!empty($xoopsModuleConfig['rss_enable'])) { $xoopsTpl->assign("xoops_module_header",' @@ -148,12 +155,6 @@ '. @$xoopsTpl->get_template_vars("xoops_module_header")); } -$xoopsOption['template_main'] = 'newbb_viewtopic.html'; -// irmtfan remove and move to footer.php -//$xoopsOption['xoops_module_header']= $xoops_module_header; -//include XOOPS_ROOT_PATH."/header.php"; -//$xoopsTpl->assign('xoops_module_header', $xoops_module_header); - if ($xoopsModuleConfig['wol_enabled']) { $online_handler =& xoops_getmodulehandler('online', 'newbb'); $online_handler->init($forum_obj, $topic_obj); |
From: <ir...@us...> - 2012-12-26 14:25:13
|
Revision: 10558 http://sourceforge.net/p/xoops/svn/10558 Author: irmtfan Date: 2012-12-26 14:25:10 +0000 (Wed, 26 Dec 2012) Log Message: ----------- fix some notices in search.php Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/search.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-26 13:26:21 UTC (rev 10557) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-26 14:25:10 UTC (rev 10558) @@ -7,6 +7,9 @@ 2- improve: use addStylesheet instead of xoops_module_header to add toggle script because some themes are not standard in newbb/header.php, newbb/footer.php +3- bug fix: assign default values to variables to fix some notices +in newbb/search.php + date 2012-12-25 =================================== 1- bug fix: when vote in polls it should save user ip to db Modified: XoopsModules/newbb/branches/irmtfan/newbb/search.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-12-26 13:26:21 UTC (rev 10557) +++ XoopsModules/newbb/branches/irmtfan/newbb/search.php 2012-12-26 14:25:10 UTC (rev 10558) @@ -69,6 +69,9 @@ $selecthtml = isset($_GET['selecthtml']) ? ( !empty($_GET['selecthtml']) ? true : false ) : true; $selectexclude = isset($_GET['selectexclude']) ? $_GET['selectexclude']: ''; $selectexclude = newbb_str2array($selectexclude); +// irmtfan assign default values to variables +$show_search = "post_text"; +$search_username = trim($uname); if ($xoopsModuleConfig['wol_enabled']) { $online_handler =& xoops_getmodulehandler('online', 'newbb'); @@ -115,7 +118,6 @@ } $uname_required = false; - $search_username = trim($uname);// irmtfan one line is enough $next_search['uname'] = $search_username; if ( !empty($search_username) ) { $uname_required = true; |
From: <ir...@us...> - 2012-12-26 14:52:56
|
Revision: 10559 http://sourceforge.net/p/xoops/svn/10559 Author: irmtfan Date: 2012-12-26 14:52:53 +0000 (Wed, 26 Dec 2012) Log Message: ----------- minor bug in viewpost.php Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-26 14:25:10 UTC (rev 10558) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2012-12-26 14:52:53 UTC (rev 10559) @@ -4,12 +4,15 @@ in newbb/edit.php, newbb/header.php, newbb/index.php, newbb/list.topic.php, newbb/newtopic.php, newbb/post.php, newbb/reply.php, newbb/search.php, newbb/topicmanager.php, newbb/viewforum.php, newbb/viewpost.php, newbb/viewtopic.php -2- improve: use addStylesheet instead of xoops_module_header to add toggle script because some themes are not standard +2- improve: use addScript instead of xoops_module_header to add toggle script because some themes are not standard in newbb/header.php, newbb/footer.php 3- bug fix: assign default values to variables to fix some notices in newbb/search.php +4- bug fix: use addScript before include header.php +in newbb/viewpost.php + date 2012-12-25 =================================== 1- bug fix: when vote in polls it should save user ip to db Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-12-26 14:25:10 UTC (rev 10558) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewpost.php 2012-12-26 14:52:53 UTC (rev 10559) @@ -29,10 +29,6 @@ // Project: Article Project // // ------------------------------------------------------------------------ // include_once dirname(__FILE__) . "/header.php"; -// To enable image auto-resize by js -// irmtfan - new method -global $xoTheme; -$xoTheme->addScript('/Frameworks/textsanitizer/xoops.js'); $start = !empty($_GET['start']) ? intval($_GET['start']) : 0; $forum_id = !empty($_GET['forum']) ? intval($_GET['forum']) : 0; @@ -175,6 +171,10 @@ include_once XOOPS_ROOT_PATH."/header.php"; mod_loadFunctions("time", "newbb"); mod_loadFunctions("render", "newbb"); +// To enable image auto-resize by js +// irmtfan - new method +global $xoTheme; +$xoTheme->addScript('/Frameworks/textsanitizer/xoops.js'); if (!empty($forum_id)) { if (!$forum_handler->getPermission($forum_obj, "view")) { |
From: <ir...@us...> - 2013-02-05 06:47:47
|
Revision: 10987 http://sourceforge.net/p/xoops/svn/10987 Author: irmtfan Date: 2013-02-05 06:47:41 +0000 (Tue, 05 Feb 2013) Log Message: ----------- New topic list block using NewbbTopicRenderer class, fix topic type and prune system Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_forum_prune.php XoopsModules/newbb/branches/irmtfan/newbb/blocks/newbb_block.php XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php XoopsModules/newbb/branches/irmtfan/newbb/class/type.php XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt XoopsModules/newbb/branches/irmtfan/newbb/footer.php XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/blocks.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php XoopsModules/newbb/branches/irmtfan/newbb/language/english/modinfo.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/blocks.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php XoopsModules/newbb/branches/irmtfan/newbb/language/persian/modinfo.php XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php XoopsModules/newbb/branches/irmtfan/newbb/templates/newbb_viewall.html XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/newbb_viewall.html XoopsModules/newbb/branches/irmtfan/newbb/viewforum.php XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php Added Paths: ----------- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html XoopsModules/newbb/branches/irmtfan/newbb/templates/js/language/english/newbb_validation.js XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/js/language/english/newbb_validation.js Modified: XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_forum_prune.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_forum_prune.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/admin/admin_forum_prune.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -43,8 +43,8 @@ $topics_number = 0; $posts_number = 0; $selected_forums = ''; - - if (empty($_POST["forums"])) { + // irmtfan fix if it is array + if (empty($_POST["forums"]) || empty($_POST["forums"][0])) { redirect_header("./admin_forum_prune.php", 1, _AM_NEWBB_PRUNE_FORUMSELERROR); } elseif (is_array($_POST["forums"])) { $selected_forums = implode(",", $_POST["forums"]); @@ -59,6 +59,7 @@ $digest = $myts->addSlashes($_POST["digest"]); $lock = $myts->addSlashes($_POST["lock"]); $hot = $myts->addSlashes($_POST["hot"]); + $store = null; //irmtfan define to fix if (!empty($_POST["store"])) { $store = $myts->addSlashes($_POST["store"]); } @@ -184,7 +185,17 @@ ) ); $sform->addElement($days); - + // START irmtfan remove hardcode db access + include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/footer.php"; // to include js files + mod_loadFunctions("forum", "newbb"); + $forumSelMulti = "<select name=\"forums[]\" multiple=\"multiple\" onfocus = \"validate('forums[]','select', false,true)\">";// disable all categories + $forumSelSingle = "<select name=\"store\" onfocus = \"validate('store','select', false,true)\">"; // disable all categories + $forumSelBox ="<option value = 0 >-- "._AM_NEWBB_PERM_FORUMS." --</option>"; + $forumSelBox .= newbb_forumSelectBox(null, "access", false); //$access_forums = nothing, $permission = "access", $delimitor_category = false + $forumSelBox .= "</select>"; + $forumEle = new XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox); + $storeEle = new XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox); + /* irmtfan remove hardcode $checkbox = new XoopsFormCheckBox(_AM_NEWBB_PRUNE_FORUMS, 'forums'); $radiobox = new XoopsFormRadio(_AM_NEWBB_PRUNE_STORE, 'store'); // PUAJJ I HATE IT, please tidy up @@ -201,9 +212,11 @@ } else { echo "DB ERROR"; } + */ + // END irmtfan remove hardcode db access + + $sform->addElement(/*$checkbox*/ $forumEle); // irmtfan - $sform->addElement($checkbox); - $sticky_confirmation = new XoopsFormRadio(_AM_NEWBB_PRUNE_STICKY, 'sticky', 1); $sticky_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); $sticky_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); @@ -233,7 +246,7 @@ ); $sform->addElement($hot_confirmation); - $sform->addElement($radiobox); + $sform->addElement(/*$radiobox*/$storeEle); // irmtfan $archive_confirmation = new XoopsFormRadio(_AM_NEWBB_PRUNE_ARCHIVE, 'archive', 1); $archive_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); Added: XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php (rev 0) +++ XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -0,0 +1,192 @@ +<?php +/** + * CBB 4.0, or newbb, the forum module for XOOPS project + * + * @copyright The XOOPS Project http://xoops.sf.net + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author Taiwen Jiang (phppp or D.J.) <ph...@us...>, irmtfan <ir...@us...> + * @author The Persian Xoops Support Site <www.xoops.ir> + * @since 4.3 + * @version $Id $ + * @package module::newbb + */ + +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); + +if (defined('LIST_TOPIC_DEFINED')) return; +define('LIST_TOPIC_DEFINED',true); + +include_once dirname(dirname(__FILE__)) . "/include/functions.ini.php"; +require_once dirname(dirname(__FILE__)) . "/class/topic.renderer.php"; +include_once dirname(dirname(__FILE__)) . "/footer.php"; // to include js/style files like validate function + +xoops_loadLanguage("main","newbb"); + +mod_loadFunctions("time", "newbb"); +mod_loadFunctions("session", "newbb"); +mod_loadFunctions("render", "newbb"); +mod_loadFunctions("user", "newbb"); + +// options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) +// options[1] - Uid in WHERE claus: uid of the topic poster : 0 - all users (by default) +// options[2] - Type in WHERE claus: topic type in the forum : 0 - none (by default) +// options[3] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default),ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode) +// options[4] - Order in ORDER claus: Descending(by default), Ascending +// options[5] - NumberToDisplay: any positive integer +// options[6] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days +// options[7] - DisplayMode: all fields same as sort +// options[8] - Display Navigator: 1 (by default), 0 (No) +// options[9] - Title Length : 0 - no limit and show complete title +// options[10] - Post text Length: 0 - dont show post text +// options[11] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default) + +function newbb_list_topic_show($options) +{ + $newbbConfig = newbb_load_config(); // load all newbb configs + + $topicRenderer = new NewbbTopicRenderer(); + $topicRenderer->userlevel = $GLOBALS["xoopsUserIsAdmin"] ? 2 : is_object($GLOBALS["xoopsUser"]); // Vistitor's level: 0 - anonymous; 1 - user; 2 - moderator or admin + + $topicRenderer->force = true; // force against static vars for parse + + $topicRenderer->is_multiple = true; // is it for multiple forums + $topicRenderer->config =& $newbbConfig; // get all configs + if (!empty($options[5])) { + $topicRenderer->config['topics_per_page'] = intval($options[5]); // number of topics (items) to display + } + $topicRenderer->config['topic_title_excerpt'] = intval($options[9]); // topic title length 0 = dont excerpt + $topicRenderer->config['post_excerpt'] = intval($options[10]); // post text excerpt 0 = no post text + + $options_status = explode(',', $options[0]); // status in where claus + $options_forum = explode(',', $options[11]); + + // set and parse values: + // forum: parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums + $topicRenderer->setVars(array( + 'status' => $options_status, + 'uid' => $options[1], + 'type' => $options[2], + 'sort' => $options[3], + 'order' => $options[4], + 'since' => $options[6], + 'forum' => $options_forum, + )); + $block = array(); + $options_headers = explode(',', $options[7]);// headers to display in block + // get the title for each header + foreach ($options_headers as $header) { + $block['headers'][$header] = $topicRenderer->getSort($header, "title"); + } + // render a list of topics using all above criterias + list($block['topics'], $block['sticky']) = $topicRenderer->renderTopics(); + + // show index navigation + $block['indexNav'] = !empty($options[8]); + + return $block; +} + + +function newbb_list_topic_edit($options) +{ + // include_once XOOPS_ROOT_PATH . "/class/blockform.php"; //reserve for 2.6 + xoops_load('XoopsFormLoader'); + // $form = new XoopsBlockForm(); //reserve for 2.6 + $form = new XoopsThemeForm(_MB_NEWBB_DISPLAYMODE_DESC,'list_topic',''); + + $topicRenderer = new NewbbTopicRenderer(); + $topicRenderer->userlevel = 2; // 2 - moderator or admin + + // status element + $options_status = explode(',', $options[0]); + $statusEle = new XoopsFormSelect(_MB_NEWBB_CRITERIA, 'options[0]', $options_status, 5, true); + $status = $topicRenderer -> getStatus( $topicRenderer->userlevel ); // get all public status + admin status (admin mode, pending deleted) + $statusEle->addOptionArray($status); + $statusEle->setExtra("onchange = \"validate('options[0][]','select', true)\""); // if user dont select any option it select "all" + $statusEle->setDescription(_MB_NEWBB_CRITERIA_DESC); + + // topic_poster element + $topicPosterEle = new XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, $options[1], 1, false); + + // type element + $types = $topicRenderer -> getTypes(); // get all available types in all forums + $typeEle = new XoopsFormSelect(_MD_NEWBB_TYPE, 'options[2]', $options[2]); + $typeEle->addOption(0, _NONE); + if (!empty($types)) { + foreach ($types as $type_id => $type) { + $typeEle->addOption($type_id, $type["type_name"]); + } + } + + // sort element + $sortEle = new XoopsFormSelect(_MD_SORTBY, 'options[3]', $options[3]); + $sortEle->setDescription(_MB_NEWBB_CRITERIA_SORT_DESC); + $sorts = $topicRenderer -> getSort("", "title"); + $sortEle->addOptionArray($sorts); + + // order element + $orderEle = new XoopsFormSelect(_MB_NEWBB_CRITERIA_ORDER, 'options[4]', $options[4]); + $orderEle->addOption(0, _DESCENDING); + $orderEle->addOption(1, _ASCENDING); + + // number of topics to display element + $numdispEle = new XoopsFormText(_MB_NEWBB_DISPLAY, 'options[5]', 10, 255, intval($options[5])); + + $timeEle = new XoopsFormText(_MB_NEWBB_TIME, 'options[6]', 10, 255, $options[6]); + $timeEle->setDescription(_MB_NEWBB_TIME_DESC); + + // mode disp element + $options_headers = explode(',', $options[7]); + $modeEle = new XoopsFormCheckBox(_MB_NEWBB_DISPLAYMODE, 'options[7][]', $options_headers); + $modeEle->setDescription(_MB_NEWBB_DISPLAYMODE_DESC); + $modeEle->columns = 4; + $modeEle->addOptionArray($sorts); + $modeEle->addOption("attachment",_MD_TOPICSHASATT); //add attachment hardcoded in NewbbTopicRenderer + $modeEle->setExtra("onchange = \"validate('options[7][]','checkbox', true)\""); // prevent user select no option + // Index navigation element + $navEle = new XoopsFormRadioYN(_MB_NEWBB_INDEXNAV, 'options[8]', !empty($options[8])); + + // Topic title element + $lengthEle = new XoopsFormText( _MB_NEWBB_TITLE_LENGTH, 'options[9]', 10, 255, intval($options[9])); + $lengthEle->setDescription(_MB_NEWBB_TITLE_LENGTH_DESC); + + // Post text element + $postExcerptEle = new XoopsFormText( _MB_NEWBB_POST_EXCERPT, 'options[10]', 10, 255, intval($options[10])); + $postExcerptEle->setDescription(_MB_NEWBB_POST_EXCERPT_DESC); + + // forum element + $options_forum = explode(',', $options[11]); + mod_loadFunctions("forum", "newbb"); + $forum_handler = xoops_getmodulehandler('forum', 'newbb'); + //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums + // Get accessible forums + $access_forums = $forum_handler->getIdsByValues(array_map("intval", $options_forum)); + $isAll = (count($options_forum) == 0 || empty($options_forum[0])); + $forumSel = "<select name=\"options[11][]\" multiple=\"multiple\" onchange = \"validate('options[11][]','select', true)\">";// if user dont select any it select "0" + $forumSel .= "<option value=\"0\" "; + if ($isAll) { + $forumSel .= " selected"; + $access_forums = null; // just select _ALL option + } + $forumSel .= ">"._ALL."</option>"; + $forumSel .= newbb_forumSelectBox($access_forums, "access", false); //$access_forums, $permission = "access", $delimitor_category = false + $forumSel .= "</select>"; + $forumEle = new XoopsFormLabel(_MB_NEWBB_FORUMLIST, $forumSel); + + // add all elements to form + $form->addElement($statusEle); + $form->addElement($topicPosterEle); + $form->addElement($typeEle); + $form->addElement($sortEle); + $form->addElement($orderEle); + $form->addElement($numdispEle); + $form->addElement($timeEle); + $form->addElement($modeEle,true); // required: user should select at least one otherwise it will select the first one + $form->addElement($navEle); + $form->addElement($lengthEle); + $form->addElement($postExcerptEle); + $form->addElement($forumEle); + + return $form->render(); +} +?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/blocks/newbb_block.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/blocks/newbb_block.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/blocks/newbb_block.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -142,10 +142,8 @@ foreach ($rows as $arr) { - // irmtfan add lastposticon - if(!defined('_MD_NEWBB_GOTOLASTPOST')) { - define("_MD_NEWBB_GOTOLASTPOST", _MB_NEWBB_LPOST); - } + // irmtfan add lastposticon - load main lang + xoops_loadLanguage("main","newbb"); $topic_page_jump = newbb_displayImage('lastposticon',_MD_NEWBB_GOTOLASTPOST); $topic['topic_subject'] = empty($type_list[$arr["type_id"]])? "" : "[".$type_list[$arr["type_id"]]."]"; Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-05 06:47:41 UTC (rev 10987) @@ -1,3 +1,49 @@ +date 2013-02-05 +=================================== +1- bug fix: when update the type for a specific forum it delete other forum's types too.(important) +in newbb/class/type.php + +2- bug fix: t.topic_rating to t.rating in viewforum and topic renderer pages +in newbb/viewforum.php, newbb/topic.renderer.php + +3- bug fix: dont add sort to criteria if sort=null eg: /list.topic.php?sort= will cause db error +in newbb/topic.renderer.php + +4- bug fix: if user set post_excerpt = 0 in preferences, there is no join in criteria and Undefined index: join error occured. +in newbb/topic.renderer.php + +5- feature add: NewbbTopicRenderer class can accept multiple status. more status and sort is added. + status supproted: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) +in newbb/topic.renderer.php + +6- feature add: add "topic_title_excerpt" setting. render topics with the specific title length. 0 = dont excerpt and show the whole topic title. +in newbb/plugin.php, newbb/topic.renderer.php + +7- feature add: a new block for topics using NewbbTopicRenderer class. + users can drop old "Recent Topics" and "Recent Replied Topics" block and use this block instead. +in newbb/xoops_version.php, newbb/language/LANG/main.php, newbb/language/LANG/blocks.php, newbb/language/LANG/modinfo.php +newbb/list.topic.php, +add: newbb/blocks/list_topic.php, newbb/templates/blocks/newbb_block_list_topic.html, newbb/templates/js/language/english/newbb_validation.js + newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html, newbb/templates_fulldiv_opacity/js/language/english/newbb_validation.js + +8- fix: remove hardcoded items from topic_icon and topic_folder smarty and add sticky, digest, poll, lock, publish time and rating smarty +in newbb/templates_fulldiv_opacity/viewall.html, in newbb/templates/viewall.html + +9- bug fix: remove hardcoded access to database for creating forum selection box (multiple and single) in admin prune. +in newbb/admin/admin_forum_prune.php + +10- fix: change $xoopsUser to $GLOBALS["xoopsUser"] because $xoopsUser is not defined in admin side +in newbb/include/vars.php + +11- bug fix: Undefined variable: forumCookie +in newbb/footer.php + +12- fix: _MD_NEWBB_GOTOLASTPOST already defined +in newbb/blocks/newbb_block.php + +13- change the status to RC5 +in newbb/xoops_version.php + date 2012-12-26 =================================== 1- bug fix: Warning: xoopsOption[template_main] should be defined before including header.php in file /footer.php line 59 Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -52,6 +52,11 @@ var $is_multiple = false; /** + * force to parse vars (run against static vars) irmtfan + */ + var $force = false; + + /** * Vistitor's level: 0 - anonymous; 1 - user; 2 - moderator or admin */ var $userlevel = 0; @@ -120,8 +125,12 @@ break; case "status": - $val = ( !empty($val) && in_array($val, array_keys($this->getStatus( $this->userlevel ))) ) ? $val : "all"; - if ($val == "all" && !$this->is_multiple) $val = ""; + // START irmtfan to accept multiple status + $val = is_array($val) ? $val : array($val); + $val = implode(",", $val); + //$val = (in_array($val, array_keys($this->getStatus( $this->userlevel ))) ) ? $val : "all"; //irmtfan no need to check if status is empty or not + //if ($val == "all" && !$this->is_multiple) $val = ""; irmtfan commented because it is done in sort + // END irmtfan to accept multiple status break; default: @@ -144,18 +153,101 @@ function _parseStatus($status = null) { switch ($status) { + // START irmtfan to accept multiple status and add more status case 'digest': - $this->query["where"][] = 't.approved = 1'; $this->query["where"][] = 't.topic_digest = 1'; break; + + case 'undigest': + $this->query["where"][] = 't.topic_digest = 0'; + break; + + case 'sticky': + $this->query["where"][] = 't.topic_sticky = 1'; + break; + + case 'unsticky': + $this->query["where"][] = 't.topic_sticky = 0'; + break; + + case 'lock': + $this->query["where"][] = 't.topic_status = 1'; + break; + + case 'unlock': + $this->query["where"][] = 't.topic_status = 0'; + break; + + case 'poll': + $this->query["where"][] = 't.topic_haspoll = 1'; + break; + + case 'unpoll': + $this->query["where"][] = 't.topic_haspoll = 0'; + break; + + case 'voted': + $this->query["where"][] = 't.votes > 0'; + break; + + case 'unvoted': + $this->query["where"][] = 't.votes < 1'; + break; + + case 'replied': + $this->query["where"][] = 't.topic_replies > 0'; + break; case 'unreplied': - $this->query["where"][] = 't.approved = 1'; $this->query["where"][] = 't.topic_replies < 1'; break; + + case 'viewed': + $this->query["where"][] = 't.topic_views > 0'; + break; + case 'unviewed': + $this->query["where"][] = 't.topic_views < 1'; + break; + + case 'read': + // Skip + if (empty($this->config["read_mode"])) { + // Use database + } elseif ($this->config["read_mode"] == 2) { + // START irmtfan use read_uid to find the unread posts when the user is logged in + global $xoopsUser; + $read_uid = is_object($xoopsUser)?$xoopsUser->getVar("uid"):0; + if (!empty($read_uid)) { + $this->query["join"][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_reads_topic') . ' AS r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; + $this->query["where"][] = 'r.post_id = t.topic_last_post_id'; + } else { + } + // END irmtfan change criteria to get from uid p.uid = last post submit user id + // User cookie + } elseif ($this->config["read_mode"] == 1) { + // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) + $startdate = !empty($this->vars["since"]) ? (time() - newbb_getSinceTime($this->vars["since"])) : 0; + if ( $lastvisit = max($GLOBALS['last_visit'], $startdate) ) { + if ( $lastvisit > $startdate ) { + $this->query["where"][] = 'p.post_time < ' . $lastvisit; + } + $topics = array(); + $topic_lastread = newbb_getcookie('LT', true); + if (count($topic_lastread)>0) { + foreach ($topic_lastread as $id => $time) { + if ($time > $lastvisit) $topics[] = $id; + } + } + if (count($topics)>0) { + $this->query["where"][] = ' t.topic_id IN (' . implode(",", $topics) . ')'; + } + } + // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) + } + break; + case 'unread': - $this->query["where"][] = 't.approved = 1'; // Skip if (empty($this->config["read_mode"])) { // Use database @@ -213,10 +305,9 @@ $this->query["where"][] = 't.approved = 1'; break; - default: - $this->query["where"][] = 't.approved = 1'; - $this->query["sort"][] = 't.topic_sticky DESC'; + default: // irmtfan do nothing break; + // END irmtfan to accept multiple status and add more status } } @@ -257,6 +348,10 @@ $startdate = time() - newbb_getSinceTime($val); if ( $this->vars["status"] == "unread" && $this->config["read_mode"] == 1 && $GLOBALS['last_visit'] > $startdate ) break; + // irmtfan digest_time + if ($this->vars["status"] == "digest") { + $this->query["where"][] = "t.digest_time > ". $startdate; + } // irmtfan - should be >= instead of = $this->query["where"][] = "p.post_time >= ". $startdate; // START irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query @@ -270,12 +365,23 @@ break; case "status": - $this->_parseStatus($val); + // START irmtfan to accept multiple status + $val = explode(",", $val); + // irmtfan - add "all" to always parse t.approved = 1 + if (count(array_intersect($val, array("all","active","pending","deleted"))) == 0) { + $val[] = "all"; + } + foreach ($val as $key => $status){ + $this->_parseStatus($status); + } + // END irmtfan to accept multiple status break; case "sort": if ($sort = $this->getSort($val, "sort")) { $this->query["sort"][] = $sort.(empty($this->vars["order"]) ? " DESC" : " ASC"); + } else { // irmtfan if sort is not in the list + $this->query["sort"][] = "t.topic_last_post_id".(empty($this->vars["order"]) ? " DESC" : " ASC"); } break; @@ -287,12 +393,15 @@ function parseVars() { static $parsed; - if (isset($parsed)) return true; + // irmtfan - force to parse vars (run against static vars) + if (isset($parsed) && !$this->force) return true; if (!isset($this->vars["forum"])) $this->vars["forum"] = null; //irmtfan parse status for rendering topic correctly - if empty($_GET(status)) it will show all topics include deleted and pendings. "all" instead of all if (!isset($this->vars["status"])) $this->vars["status"] = "all"; - + // irmtfan if sort is not set or is empty get a default sort- if empty($_GET(sort)) | if sort=null eg: /list.topic.php?sort= + if (empty($this->vars["sort"])) $this->vars["sort"] = in_array("sticky", explode(",",$this->vars["status"])) ? "lastpost" : "sticky"; + foreach ($this->vars as $var => $val) { $this->parseVar($var, $val); if (empty($val)) unset($this->vars[$var]); @@ -331,14 +440,48 @@ ), "ratings" => array( "title" => _MD_RATINGS, - "sort" => "t.topic_ratings", + "sort" => "t.rating", // irmtfan t.topic_rating to t.rating ), + // START irmtfan add more sorts + "votes" => array( + "title" => _MD_VOTES, + "sort" => "t.votes", + ), "publish" => array( "title" => _MD_TOPICTIME, "sort" => "t.topic_id", ), + "digest" => array( + "title" => _MD_DIGEST, + "sort" => "t.digest_time", + ), + "sticky" => array( + "title" => _MD_STICKY, + "sort" => "t.topic_sticky", + ), + "lock" => array( + "title" => _MD_LOCK, + "sort" => "t.topic_status", + ), + "poll" => array( + "title" => _MD_POLL_POLL, + "sort" => "t.poll_id", + ), ); - + $types = $this->getTypes(); + if (!empty($types)) { + $headers["type"] = array( + "title" => _MD_NEWBB_TYPE, + "sort" => "t.type_id", + ); + } + if ($this->userlevel == 2) { + $headers["approve"] = array( + "title" => _MD_APPROVE, + "sort" => "t.approved", + ); + } + // END irmtfan add more sorts if (empty($header) && empty($var)) { return $headers; } @@ -361,7 +504,20 @@ //"" => "", /* irmtfan remove empty array */ "all" => _ALL, "digest" => _MD_DIGEST, + "undigest" => _MD_UNDIGEST, // irmtfan add + "sticky" => _MD_STICKY, // irmtfan add + "unsticky" => _MD_UNSTICKY, // irmtfan add + "lock" => _MD_LOCK, // irmtfan add + "unlock" => _MD_UNLOCK, // irmtfan add + "poll" => _MD_TOPICHASPOLL, // irmtfan add + "unpoll" => _MD_TOPICHASNOTPOLL, // irmtfan add + "voted" => _MD_VOTED, // irmtfan add + "unvoted" => _MD_UNVOTED, // irmtfan add + "viewed" => _MD_VIEWED, // irmtfan add + "unviewed" => _MD_UNVIEWED, // irmtfan add + "replied" => _MD_REPLIED, // irmtfan add "unreplied" => _MD_UNREPLIED, + "read" => _MD_READ, // irmtfan add "unread" => _MD_UNREAD, ); $links_admin = array( @@ -405,7 +561,7 @@ $selection["forum"] .= '</select>'; // END irmtfan add forum selection box - $sort_selected = empty($this->vars["sort"]) ? "lastpost" : $this->vars["sort"]; + $sort_selected = $this->vars["sort"]; // irmtfan no need to check $sorts = $this->getSort("", "title"); $selection["sort"] = "<select name='sort'>"; foreach ($sorts as $sort => $title) { @@ -569,7 +725,7 @@ $sql = ' SELECT '.implode(", ", $selects). ' FROM '.implode(", ", $froms). ' '.implode(" ", $joins). - ' '.implode(" ", $this->query["join"]). + (!empty($this->query["join"]) ? ' '.implode(" ", $this->query["join"]) : ''). // irmtfan bug fix: Undefined index: join when post_excerpt = 0 ' WHERE '.implode(" AND ", $wheres). ' AND '.@implode(" AND ", @$this->query["where"]); @@ -582,7 +738,7 @@ function renderTopics($xoopsTpl = null) { - global $myts; + $myts = MyTextSanitizer::getInstance(); // irmtfan Instanciate $ret = array(); //$this->parseVars(); @@ -613,13 +769,12 @@ $selects[] = 'p.post_karma, p.require_reply, pt.post_text'; $this->query["join"][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts_text') . ' AS pt ON pt.post_id = t.topic_last_post_id'; } - if (empty($this->query["sort"])) $this->query["sort"][] = 't.topic_last_post_id DESC'; + //if (empty($this->query["sort"])) $this->query["sort"][] = 't.topic_last_post_id DESC'; // irmtfan commented no need - $sql = ' SELECT '.implode(", ", $selects). ' FROM '.implode(", ", $froms). ' '.implode(" ", $joins). - ' '.implode(" ", $this->query["join"]). + (!empty($this->query["join"]) ? ' '.implode(" ", $this->query["join"]) : ''). // irmtfan bug fix: Undefined index join when post_excerpt = 0 ' WHERE '.implode(" AND ", $wheres). ' AND '.@implode(" AND ", @$this->query["where"]). ' ORDER BY '.implode(", ", $this->query["sort"]); @@ -652,21 +807,14 @@ } // ------------------------------------------------------ - // topic_icon: priority: sticky -> digest -> regular - - if ($myrow['topic_haspoll']) { - if ($myrow['topic_sticky']) { - $topic_icon = newbb_displayImage("topic_sticky", _MD_TOPICSTICKY) . '<br />' . newbb_displayImage("poll", _MD_TOPICHASPOLL); - } else { - $topic_icon = newbb_displayImage('poll', _MD_TOPICHASPOLL); - } - } elseif ($myrow['topic_sticky']) { - $topic_icon = newbb_displayImage('topic_sticky', _MD_TOPICSTICKY); - } elseif (!empty($myrow['icon'])) { - $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />'; + // START irmtfan remove topic_icon hardcode smarty + // topic_icon: just regular topic_icon + if (!empty($myrow['icon'])) { + $topic_icon = '<img align="middle" src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />'; } else { - $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; + $topic_icon = '<img align="middle" src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; } + // END irmtfan remove topic_icon hardcode smarty // ------------------------------------------------------ // rating_img @@ -706,9 +854,16 @@ // => topic array $topic_title = $myts->htmlSpecialChars( $myrow['topic_title'] ); - if ($myrow['topic_digest']) { - $topic_title = "<span class='digest'>" . $topic_title . "</span>"; - } + // irmtfan use topic_title_excerpt for block topic title length + if (!empty($this->config['topic_title_excerpt'])) { + $topic_title_excerpt = xoops_substr($topic_title, 0, $this->config['topic_title_excerpt']); + } else { + $topic_title_excerpt = $topic_title; + } + // irmtfan hardcode class commented + //if ($myrow['topic_digest']) { + // $topic_title = "<span class='digest'>" . $topic_title . "</span>"; + //} if ( empty($this->config["post_excerpt"]) ) { $topic_excerpt = ""; @@ -723,10 +878,11 @@ 'topic_id' => $myrow['topic_id'], 'topic_icon' => $topic_icon, 'type_id' => $myrow['type_id'], - 'topic_title' => $topic_title, + 'topic_title_excerpt' => $topic_title_excerpt, //irmtfan use topic_title_excerpt //'topic_link' => XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'], // . '&forum=' . $myrow['forum_id'], // irmtfan comment 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'], // irmtfan remove hardcode link 'rating_img' => $rating_img, + 'votes' => $myrow['votes'], //irmtfan added 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, 'topic_replies' => $myrow['topic_replies'], @@ -739,8 +895,11 @@ 'topic_last_poster_name' => !empty($myrow['last_poster_name']) ? $myts->htmlSpecialChars( $myrow['last_poster_name'] ) : $anonymous, 'topic_forum' => $myrow['forum_id'], 'topic_excerpt' => $topic_excerpt, - 'stick' => empty($myrow['topic_sticky']), - "stats" => array($myrow['topic_status'], $myrow['topic_digest'], $myrow['topic_replies']), + 'sticky' => $myrow['topic_sticky'] ? newbb_displayImage('topic_sticky', _MD_TOPICSTICKY) : '', // irmtfan bug fixed + 'lock' => $myrow['topic_status'] ? newbb_displayImage('topic_locked', _MD_TOPICLOCK) : '', //irmtfan added + 'digest' => $myrow['topic_digest'] ? newbb_displayImage('topic_digest', _MD_TOPICDIGEST) : '', //irmtfan added + 'poll' => $myrow['topic_haspoll'] ? newbb_displayImage('poll', _MD_TOPICHASPOLL) : '', //irmtfan added + 'approve' => $myrow['approved'], //irmtfan added ); /* users */ @@ -778,8 +937,9 @@ $topics[$id]['topic_read'] = empty($topic_isRead[$id]) ? 0 : 1; // add topic-read/topic-new smarty variable $topics[$id]["topic_forum_link"] = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $topics[$id]["topic_forum"] . '">' . $forum_list[$topics[$id]["topic_forum"]]["forum_name"] . '</a>'; + //irmtfan use topic_title_excerpt if (!empty($topics[$id]["type_id"]) && isset($type_list[$topics[$id]["type_id"]])) { - $topics[$id]["topic_title"] = getTopicTitle($topics[$id]["topic_title"], $type_list[$topics[$id]["type_id"]]["type_name"], $type_list[$topics[$id]["type_id"]]["type_color"]); + $topics[$id]["topic_title"] = getTopicTitle($topics[$id]["topic_title_excerpt"], $type_list[$topics[$id]["type_id"]]["type_name"], $type_list[$topics[$id]["type_id"]]["type_color"]); } $topics[$id]["topic_poster"] = !empty($posters_name[$topics[$id]["topic_poster_uid"]]) ? $posters_name[$topics[$id]["topic_poster_uid"]] @@ -788,28 +948,30 @@ ? $posters_name[$topics[$id]["topic_last_poster_uid"]] : $topics[$id]["topic_last_poster_name"]; // ------------------------------------------------------ + // START irmtfan remove hardcodes from topic_folder smarty // topic_folder: priority: newhot -> hot/new -> regular - list($topic_status, $topic_digest, $topic_replies) = $topics[$id]["stats"]; + //list($topic_status, $topic_digest, $topic_replies) = $topics[$id]["stats"]; irmtfan // START irmtfan - add topic_folder_text for alt - if ($topic_status == 1) { - $topic_folder = 'topic_locked'; - $topic_folder_text = _MD_TOPICLOCKED; - } else { - if ($topic_digest) { - $topic_folder = 'topic_digest'; - $topic_folder_text = _MD_TOPICDIGEST; - } elseif ($topic_replies >= $forum_list[$topics[$id]["topic_forum"]]["hot_threshold"]) { + //if ($topics[$id]["lock"] == 1) { + // $topic_folder = 'topic_locked'; + // $topic_folder_text = _MD_TOPICLOCKED; + //} else { + //if ($topic_digest) { + // $topic_folder = 'topic_digest'; + // $topic_folder_text = _MD_TOPICDIGEST; + if ($topics[$id]["topic_replies"] >= $forum_list[$topics[$id]["topic_forum"]]["hot_threshold"]) { $topic_folder = empty($topic_isRead[$id]) ? 'topic_hot_new' : 'topic_hot'; $topic_folder_text = empty($topic_isRead[$id]) ? _MD_MORETHAN : _MD_MORETHAN2; } else { $topic_folder = empty($topic_isRead[$id]) ? 'topic_new' : 'topic'; $topic_folder_text = empty($topic_isRead[$id]) ? _MD_NEWPOSTS : _MD_NONEWPOSTS; } - } + //} + // END irmtfan remove hardcodes from topic_folder smarty $topics[$id]['topic_folder'] = newbb_displayImage($topic_folder, $topic_folder_text); // END irmtfan - add topic_folder_text for alt - unset($topics[$id]["topic_poster_name"], $topics[$id]["topic_last_poster_name"], $topics[$id]["stats"]); + unset($topics[$id]["topic_poster_name"], $topics[$id]["topic_last_poster_name"]);// irmtfan remove $topics[$id]["stats"] because it is not exist now } if ( count($topics) > 0) { Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/type.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/type.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/type.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -142,6 +142,7 @@ if (!empty($types_valid)) { $sql = "DELETE FROM " . $this->db->prefix("bb_type_forum"). " WHERE ". + " forum_id = " . $forum_id . " AND ". // irmtfan bug fix: delete other forums types when update the type for a specific forum " {$this->keyName} NOT IN (".implode(", ", $types_valid).")"; if ( ($result = $this->db->queryF($sql)) == false) { } Modified: XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2013-02-05 06:47:41 UTC (rev 10987) @@ -74,6 +74,14 @@ define("_MD_CANNOT_PRINT","You <strong>cannot</strong> get print page.<br />"); define('_MD_NORIGHTTOPDF','You don\'t have the right to create pdf in this forum.'); define('_MD_NORIGHTTOPRINT','You don\'t have the right to get print in this forum.'); +define('_MD_TOPICHASNOTPOLL','Topic hasnot poll'); +define('_MD_VOTED','Voted topics'); +define('_MD_UNVOTED','Unvoted topics'); +define('_MD_VIEWED','Viewed topics'); +define('_MD_UNVIEWED','Unviewed topics'); +define('_MD_REPLIED','Replied topics'); +define('_MD_READ','Read topics'); +define('_MD_POLL_POLL','Poll'); admin.php --------- @@ -84,3 +92,24 @@ define("_AM_NEWBB_DATABASEUPDATED","Database Updated Successfully!"); define("_AM_NEWBB_CAN_PDF","Can create pdf files"); define("_AM_NEWBB_CAN_PRINT","Can get print page"); + +modinfo.php +----------- +revise: +define("_MI_NEWBB_BLOCK_TOPIC_POST","Recent Replied Topics. It Will drop (use advance topic renderer block)"); // irmtfan +define("_MI_NEWBB_BLOCK_TOPIC","Recent Topics. It Will drop (use advance topic renderer block)"); // irmtfan + +add: +define("_MI_NEWBB_BLOCK_LIST_TOPIC","Render a list of topics"); + + +blocks.php +----------- +add: +define("_MB_NEWBB_CRITERIA_DESC","you can select multiple criterias and they parsed in WHERE claus by AND. eg: sticky AND unreplied topics. null = all "); +define("_MB_NEWBB_CRITERIA_SORT_DESC","Note: Newest/Oldest Most/Least should be set in Order by"); +define("_MB_NEWBB_DISPLAYMODE_DESC","Display selected items of topic in block IF topic has them AND user has the right access"); +define("_MB_NEWBB_CRITERIA_ORDER","Order by"); +define("_MB_NEWBB_TITLE_LENGTH_DESC","Length of topic title excerpt in block. 0 for show the whole title and no excerpt."); +define("_MB_NEWBB_POST_EXCERPT","Post text excerpt in block"); +define("_MB_NEWBB_POST_EXCERPT_DESC","Length of post text excerpt by mouse over on topic title in block. 0 for dont show post text."); \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/footer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/footer.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/footer.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -40,6 +40,7 @@ $xoTheme->addScript($js_rel_path . '/' . $jsfile); } } +include_once dirname(__FILE__) . "/include/vars.php"; // for $forumCookie["prefix"] // add toggle script $toggle_script="var toggle_cookie=\"" . $forumCookie["prefix"] . "G" . "\";"; $xoTheme->addScript( null, array ('type' => 'text/javascript'), $toggle_script); Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/plugin.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -101,6 +101,8 @@ // change the read_mode = 2 (db) to read_mode = 1 (cookie) for anonymous users // Note: if set to true only change read_mode for anonymous users if read_mode = 2 (db), set to false to no action. $customConfig["read_mode_db_to_cookie_for_anon"] = true; +// render topics with the specific title length. 0 = dont excerpt +$customConfig["topic_title_excerpt"] = 0; // END hacked by irmtfan return $customConfig; Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/vars.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -38,7 +38,7 @@ $forumCookie['path'] = "/"; $forumCookie['secure'] = false; $forumCookie['expire'] = time() + 3600 * 24 * 30; // one month -$forumCookie['prefix'] = 'newbb_'.((is_object($xoopsUser)) ? $xoopsUser->getVar('uid') : '0IP' . newbb_getIP()); // irmtfan IP for anons +$forumCookie['prefix'] = 'newbb_'.((is_object($GLOBALS["xoopsUser"])) ? $GLOBALS["xoopsUser"]->getVar('uid') : '0IP' . newbb_getIP()); // irmtfan IP for anons - use $GLOBALS["xoopsUser"] // set LastVisitTemp cookie, which only gets the time from the LastVisit cookie if it does not exist yet // otherwise, it gets the time from the LastVisitTemp cookie Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/blocks.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/blocks.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/blocks.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -37,4 +37,13 @@ define("_MB_NEWBB_COUNT","Count"); define("_MB_NEWBB_INDEXNAV","Display Navigator"); define("_MB_NEWBB_TITLE_LENGTH","Title/Post length"); +// 4.3 +// added by irmtfan +define("_MB_NEWBB_CRITERIA_DESC","you can select multiple criterias and they parsed in WHERE claus by AND. eg: sticky AND unreplied topics. null = all "); +define("_MB_NEWBB_CRITERIA_SORT_DESC","Note: Newest/Oldest Most/Least should be set in Order by"); +define("_MB_NEWBB_DISPLAYMODE_DESC","Display selected items of topic in block IF topic has them AND user has the right access"); +define("_MB_NEWBB_CRITERIA_ORDER","Order by"); +define("_MB_NEWBB_TITLE_LENGTH_DESC","Length of topic title excerpt in block. 0 for show the whole title and no excerpt."); +define("_MB_NEWBB_POST_EXCERPT","Post text excerpt in block"); +define("_MB_NEWBB_POST_EXCERPT_DESC","Length of post text excerpt by mouse over on topic title in block. 0 for dont show post text."); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -513,5 +513,13 @@ define("_MD_CANNOT_PRINT","You <strong>cannot</strong> get print page.<br />"); define('_MD_NORIGHTTOPDF','You don\'t have the right to create pdf in this forum.'); define('_MD_NORIGHTTOPRINT','You don\'t have the right to get print in this forum.'); - +// irmtfan for new block system +define('_MD_TOPICHASNOTPOLL','Topic hasnot poll'); +define('_MD_VOTED','Voted topics'); +define('_MD_UNVOTED','Unvoted topics'); +define('_MD_VIEWED','Viewed topics'); +define('_MD_UNVIEWED','Unviewed topics'); +define('_MD_REPLIED','Replied topics'); +define('_MD_READ','Read topics'); +define('_MD_POLL_POLL','Poll'); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/modinfo.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/modinfo.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/modinfo.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -14,8 +14,8 @@ define("_MI_NEWBB_DESC","XOOPS Community Bulletin Board"); // Names of blocks for this module (Not all module has blocks) -define("_MI_NEWBB_BLOCK_TOPIC_POST","Recent Replied Topics"); -define("_MI_NEWBB_BLOCK_TOPIC","Recent Topics"); +define("_MI_NEWBB_BLOCK_TOPIC_POST","Recent Replied Topics. It Will drop (use advance topic renderer block)"); // irmtfan +define("_MI_NEWBB_BLOCK_TOPIC","Recent Topics. It Will drop (use advance topic renderer block)"); // irmtfan define("_MI_NEWBB_BLOCK_POST","Recent Posts"); define("_MI_NEWBB_BLOCK_AUTHOR","Authors"); define("_MI_NEWBB_BLOCK_TAG_CLOUD","Tag Cloud"); @@ -257,5 +257,7 @@ define("_MI_ADVERTISING_DESC","shows a commercial break after the 2nd Thread"); define("_MI_USERATTACH_ENABLE","Display attachments only for registered users"); define("_MI_USERATTACH_DESC","shows attachments in the forum only after logging in."); +// 4.3 +define("_MI_NEWBB_BLOCK_LIST_TOPIC","Render a list of topics");// irmtfan ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/blocks.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/blocks.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/blocks.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -1,4 +1,4 @@ -<?php +<?php // $Id: blocks.php,v 1.3 2005/10/19 17:20:33 phppp Exp $ // Blocks if(defined('_MB_NEWBB_DEFINED')) return; @@ -36,5 +36,14 @@ define("_MB_NEWBB_AUTHOR","نویسنده"); define("_MB_NEWBB_COUNT","تعداد"); define("_MB_NEWBB_INDEXNAV","هدایت گر را نشان بده"); -define("_MB_NEWBB_TITLE_LENGTH","طول عنوان/پیام"); +define("_MB_NEWBB_TITLE_LENGTH","طول عنوان تاپیک ها"); +// 4.3 +// added by irmtfan +define("_MB_NEWBB_CRITERIA_DESC","شما میتوانید چندین شرط را انتخاب کنید و تمامی آنها در فراخوانی از پایگاه داده با AND و در قسمت WHERE آورده میشوند. مثلا: چسبان AND بدون پاسخ. بدون انتخاب = همه"); +define("_MB_NEWBB_CRITERIA_SORT_DESC","توجه: جدیدترین/قدیمیترین بیشترین/کمترین را باید در قسمت صعودی نزولی انتخاب کنید."); +define("_MB_NEWBB_DISPLAYMODE_DESC","آیتم های مختلفی از تاپیک را بر حسب اینکه آیا تاپیک آنها را دارد و آیا بیننده دسترسی دیدن دارد یا نه در بلاک نمایش میدهد."); +define("_MB_NEWBB_CRITERIA_ORDER","مرتب سازی"); +define("_MB_NEWBB_TITLE_LENGTH_DESC","حداکثر تعداد کاراکتر هایی از عنوان تاپیک که در بلاک نمایش داده میشود. اگر 0 باشد کل عنوان نمایش داده میشود."); +define("_MB_NEWBB_POST_EXCERPT","طول متن پیام"); +define("_MB_NEWBB_POST_EXCERPT_DESC","حداکثر تعداد کاراکتر هایی که از متن پیام با بردن موس روی عنوان تاپیک نمایش داده میشود. اگر 0 را بنویسید هیچ متنی نمایش داده نمیشود."); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -1,4 +1,4 @@ -<?php +<?php // $Id: main.php 17 2007-11-18 14:22:36Z LupusC $ if(defined('MAIN_DEFINED')) return; define('MAIN_DEFINED',true); @@ -300,12 +300,12 @@ define('_MD_DELETE','حذف کن'); define('_MD_MOVE','منتقلکن'); define('_MD_MERGE','ادغام کن'); -define('_MD_LOCK','قفل کن'); -define('_MD_UNLOCK','قفل را باز کن'); -define('_MD_STICKY','مهم (چسبان) کن'); -define('_MD_UNSTICKY','غیر مهم (عادی) کن'); -define('_MD_DIGEST','خلاصه کن'); -define('_MD_UNDIGEST','غیر خلاصه کن'); +define('_MD_LOCK','عنوان های قفل شده'); +define('_MD_UNLOCK','عنوان های قفل نشده (باز)'); +define('_MD_STICKY','عنوان های مهم (چسبان)'); +define('_MD_UNSTICKY','عنوان های غیر مهم (عادی)'); +define('_MD_DIGEST','عنوان های خلاصه'); +define('_MD_UNDIGEST','عنوان های غیر خلاصه'); define('_MD_DESC_DELETE','وقتی شما دکمه حذف کن را در پایین میزنید؛ این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن <strong>کاملاً</strong>حذف خواهند شد.'); define('_MD_DESC_RESTORE','وقتی شما دکمه بازیابی کن را در پایین میزنید؛ این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن بازیابی خواهند شد.'); define('_MD_DESC_MOVE','وقتی شما دکمه منتقل کن در پایین را میزنید، این عنوان که انتخاب کرده اید به همراه تمام پیامهای نوشته شده و متعلق به آن به انجمنی که انتخاب کرده اید منتقل میشود.'); @@ -511,5 +511,13 @@ define("_MD_CANNOT_PRINT","شما <strong>نمی توانید</strong> پرینت بگیرید.<br />"); define('_MD_NORIGHTTOPDF','شما در این فروم دسترسی برای ساختن فایل pdf ندارید.'); define('_MD_NORIGHTTOPRINT','شما در این فروم دسترسی برای گرفتن پرینت ندارید.'); - +// irmtfan for new block system +define('_MD_TOPICHASNOTPOLL','عنوان بدون نظر سنجی'); +define('_MD_VOTED','عنوان های ارزشیابی شده'); +define('_MD_UNVOTED','عنوان های ارزشیابی نشده'); +define('_MD_VIEWED','عنوان های بازدید شده'); +define('_MD_UNVIEWED','عنوان های بازدید نشده'); +define('_MD_REPLIED','عنوان های دارای پاسخ'); +define('_MD_READ','عنوان های خوانده شده'); +define('_MD_POLL_POLL','نظرسنجی'); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/modinfo.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/modinfo.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/modinfo.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -262,4 +262,7 @@ define("_MI_ADVERTISING_DESC","بعد از پست دوم هر تاپیک یک تبلیغ را نمایش میدهد"); define("_MI_USERATTACH_ENABLE","نمایش فایل های پیوست به پست فقط به کابران عضو"); define("_MI_USERATTACH_DESC","فقط بعد از ورود به سایت فایل های الصاق شده را نمایش میدهد."); +// 4.3 +define("_MI_NEWBB_BLOCK_LIST_TOPIC","نمایش فهرستی از تاپیک ها");// irmtfan + ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2013-02-05 04:05:43 UTC (rev 10986) +++ XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2013-02-05 06:47:41 UTC (rev 10987) @@ -27,9 +27,15 @@ mod_loadFunctions("time", "newbb"); mod_loadFunctions("render", "newbb"); -require "./class/topic.renderer.php"; +// irmtfan use require_once because it will redeclared in newbb/blocks/list_topic.php +require_once "./class/topic.renderer.php"; $topic_renderer = NewbbTopicRenderer::instance(); $topic_renderer->userlevel = $GLOBALS["xoopsUserIsAdmin"] ? 2 : is_object($xoopsUser); +// irmtfan if list topic block is in the page then force to parse +if (defined('LIST_TOPIC_DEFINED')) { + $topic_renderer->force = true; // force against static vars +} + $topic_renderer->is_multiple = true; $topic_renderer->config =& $xoopsModuleConfig; $topic_renderer->setVars( @$_GET ); Added: XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html (rev 0) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html 2013-02-05 06:47:41 UTC (rev 10987) @@ -0,0 +1,121 @@ +<!-- a new block template for newbb --> +<!-- all classes can be found in xoops.css --> +<!-- define your desired width here --> +<{assign var=minwidth value=300}> <!-- minimum block minwidth property --> +<{assign var=topicwidth value=100}> <!-- maximum topic width property --> + +<{if $block.headers.forum}> + <{assign var=minwidth value=$minwidth+50}> + <{assign var=topicwidth value=$topicwidth-20}> + <{assign var=block_forum value="width20"}> +<{/if}> +<{if $block.headers.views}> + <{assign var=minwidth value=$minwidth+25}> + <{assign var=topicwidth value=$topicwidth-10}> + <{assign var=block_view value="width10"}> +<{/if}> +<{if $block.headers.replies}> + <{assign var=minwidth value=$minwidth+25}> + <{assign var=topicwidth value=$topicwidth-10}> + <{assign var=block_reply value="width10"}> +<{/if}> +<{if $block.headers.lastpost}> + <{assign var=minwidth value=$minwidth+100}> + <{assign var=topicwidth value=$topicwidth-30}> +<{/if}> +<{assign var=block_topic value=width$topicwidth}> <!-- block topic width after reduction above --> +<div class="outer" style="min-width: <{$minwidth}>px;"> + <div class="head border x-small center"> + <div class="<{$block_topic}> floatleft"><{$block.headers.topic}></div> + <{if $block.headers.forum}> + <div class="<{$block_forum}> floatleft"><{$block.headers.forum}></div> + <{/if}> + <{if $block.headers.replies}> + <div class="<{$block_reply}> floatleft"><{$block.headers.replies}></div> + <{/if}> + <{if $block.headers.views}> + <div class="<{$block_view}> floatleft"><{$block.headers.views}></div> + <{/if}> + <div style="overflow: hidden;"><{$block.headers.lastpost}></div> + <div class="clear"></div> + </div> + <!-- start forum topic --> + <{foreachq name=loop item=topic from=$block.topics}> + <div class="<{cycle values="even,odd"}> border"> + <div class="<{$block_topic}> floatleft left"> + <{if $block.headers.approve}> + <{if $topic.approve eq 1}><a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>&status=active#admin" target="_self" title="<{$smarty.const._MD_TYPE_ADMIN}>"><{$smarty.const._MD_TYPE_ADMIN}></a><{/if}> + <{if $topic.approve eq 0}><a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>&status=pending#admin" target="_self" title="<{$smarty.const._MD_TYPE_PENDING}>"><{$smarty.const._MD_TYPE_PENDING}></a><{/if}> + <{if $topic.approve eq -1}><a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>&status=deleted#admin" target="_self" title="<{$smarty.const._MD_TYPE_DELETED}>"><{$smarty.const._MD_TYPE_DELETED}></a><{/if}> + <br /> + <{/if}> + <{if $block.headers.topic}> + <{$topic.topic_folder}> + <a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>" title="<{$topic.topic_excerpt}>"> + <{if $block.headers.type && $topic.topic_title}><{$topic.topic_title}><{else}><{$topic.topic_title_excerpt}><{/if}> + </a> + <{if $block.headers.attachment}><{$topic.attachment}><{/if}><{$topic.topic_page_jump}> + <br /> + <{/if}> + <{if $block.headers.lock}><{$topic.lock}><{/if}> + <{if $block.headers.sticky}><{$topic.sticky}><{/if}> + <{if $block.headers.digest}><{$topic.digest}><{/if}> + <{if $block.headers.poll}><{$topic.poll}><{/if}> + <{if $block.headers.publish }> + <br /> + <span class="xx-small"> + <{$block.headers.publish}>: <{$topic.topic_time}> + </span> + <{/if}> + <{if $block.headers.votes && $topic.votes}> + <br /> + <span class="xx-small"> + <{$block.headers.votes}>: <{$topic.votes}><{if $block.headers.ratings}> <{$topic.rating_img}><{/if}> + </span> + <{/if}> + <{if $block.headers.poster}> + <br /> + <span class="xx-small"> + <{$block.headers.poster}>: <{$topic.topic_poster}> + </span> + <{/if}> + </div> + <{if $block.headers.forum}> + <div class="<{$block_forum}> floatleft left"><{$topic.topic_forum_link}></div> + <{/if}> + <{if $block.headers.replies}> + <div class="<{$block_reply}> floatleft center"><{$topic.topic_replies}></div> + <{/if}> + <{if $block.headers.views}> + <div class="<{$block_view}> floatleft center"><{$topic.topic_views}></div> + <{/if}> + <div style="overflow: hidden;" class="right"> + <{if $block.headers.lastpost}> + <{$topic.topic_last_posttime}><br /> + <{$topic.topic_last_poster}> <{$topic.topic_page_jump_icon}> + <{/if}> + </div> + <div class="clear"></div> + </div> + <{/foreach}> + <!-- end forum topic --> +</div> +<div class="clear"></div> +<{if $block.indexNav}> + <!-- a sample of pagenav. you can create your own! --> + <div class="floatright right"> + <a href="<{$xoops_url}>/modules/newbb/viewpost.php"><{$smarty.const._MB_NEWBB_ALLPOSTS}></a> | + <a href="<{$xoops_url}>/modules/newbb/list.topic.php"><{$smarty.const._MB_NEWBB_ALLTOPICS}></a> | + <a href="<{$xoops_url}>/modules/newbb/list.topic.php?status=unread"><{$smarty.const._MD_UNREAD}></a> | + <{if $block.headers.replies}> + <a href="<{$xoops_url}>/modules/newbb/list.topic.php?status=unreplied"><{$smarty.const._MD_UNREPLIED}></a> | + <{/if}> + <{if $block.headers.votes}> + <a href="<{$xoops_url}>/modules/newbb/list.topic.php?status=voted"><{$smarty.const._MD_VOTED}></a> | + <{/if}> + <{if $block.headers.poll}> + <a href="<{$xoops_url}>/modules/newbb/list.topic.php?status=poll"><{$smarty.const._MD_POLL_POLL}></a> | + <{/if}> + <a href="<{$xoops_url}>/modules/newbb"><{$smarty.const._MB_NEWBB_VSTFRMS}></a> + </div> +<{/if}> \ No newline at end of file Added: XoopsModules/newbb/branches/irmtfan/newbb/templates/js/language/english/newbb_validation.js =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/js/language/english/newbb_validation.js (rev 0) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/js/language/english/newbb_validation.js 2013-02-05 06:47:41 UTC (rev 10987) @@ -0,0 +1,78 @@ +/** + * Newbb Javascript Validation functions + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @module newbb + * @since 4.3 + * @author irmtfan + * @version $Id$ + */ + +/** +* Function for validation of xoops forms: prevent... [truncated message content] |
From: <ir...@us...> - 2013-02-06 01:58:43
|
Revision: 10994 http://sourceforge.net/p/xoops/svn/10994 Author: irmtfan Date: 2013-02-06 01:58:40 +0000 (Wed, 06 Feb 2013) Log Message: ----------- bug fix: undefined forumCookie in footer Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/footer.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-05 23:28:52 UTC (rev 10993) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-06 01:58:40 UTC (rev 10994) @@ -1,3 +1,8 @@ +date 2013-02-06 +=================================== +1- bug fix: Undefined variable: forumCookie revert last change - use global instead of include_once +in newbb/footer.php + date 2013-02-05 =================================== 1- bug fix: when update the type for a specific forum it delete other forum's types too.(important) Modified: XoopsModules/newbb/branches/irmtfan/newbb/footer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/footer.php 2013-02-05 23:28:52 UTC (rev 10993) +++ XoopsModules/newbb/branches/irmtfan/newbb/footer.php 2013-02-06 01:58:40 UTC (rev 10994) @@ -40,7 +40,7 @@ $xoTheme->addScript($js_rel_path . '/' . $jsfile); } } -include_once dirname(__FILE__) . "/include/vars.php"; // for $forumCookie["prefix"] +global $forumCookie; // for $forumCookie["prefix"] revert last change - use global instead of include_once // add toggle script $toggle_script="var toggle_cookie=\"" . $forumCookie["prefix"] . "G" . "\";"; $xoTheme->addScript( null, array ('type' => 'text/javascript'), $toggle_script); |
From: <ir...@us...> - 2013-02-06 03:07:31
|
Revision: 10995 http://sourceforge.net/p/xoops/svn/10995 Author: irmtfan Date: 2013-02-06 03:07:29 +0000 (Wed, 06 Feb 2013) Log Message: ----------- bug fix: Undefined index: newbb config in blocks activated in some modules like profile Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/post.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-06 01:58:40 UTC (rev 10994) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-06 03:07:29 UTC (rev 10995) @@ -3,6 +3,8 @@ 1- bug fix: Undefined variable: forumCookie revert last change - use global instead of include_once in newbb/footer.php +2- bug fix: Undefined index: newbb config in blocks activated in some modules like profile + date 2013-02-05 =================================== 1- bug fix: when update the type for a specific forum it delete other forum's types too.(important) Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/post.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/post.php 2013-02-06 01:58:40 UTC (rev 10994) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/post.php 2013-02-06 03:07:29 UTC (rev 10995) @@ -263,7 +263,8 @@ function &getPostBody() { - global $xoopsConfig, $xoopsModuleConfig, $xoopsUser, $myts; + global $xoopsConfig, $xoopsUser, $myts; + $xoopsModuleConfig = newbb_load_config(); // irmtfan load all newbb configs - newbb config in blocks activated in some modules like profile mod_loadFunctions("user", "newbb"); mod_loadFunctions("render", "newbb"); |
From: <ir...@us...> - 2013-02-06 06:13:20
|
Revision: 10996 http://sourceforge.net/p/xoops/svn/10996 Author: irmtfan Date: 2013-02-06 06:13:16 +0000 (Wed, 06 Feb 2013) Log Message: ----------- bug fix: dont show topic title in list.topic.php Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-06 03:07:29 UTC (rev 10995) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-06 06:13:16 UTC (rev 10996) @@ -4,7 +4,11 @@ in newbb/footer.php 2- bug fix: Undefined index: newbb config in blocks activated in some modules like profile +in newbb/class/post.php +3- bug fix: dont show topic title in list.topic.php +in newbb/class/topic.renderer.php, newbb/templates/blocks/newbb_block_list_topic.html, newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html + date 2013-02-05 =================================== 1- bug fix: when update the type for a specific forum it delete other forum's types too.(important) Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-06 03:07:29 UTC (rev 10995) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-06 06:13:16 UTC (rev 10996) @@ -937,10 +937,12 @@ $topics[$id]['topic_read'] = empty($topic_isRead[$id]) ? 0 : 1; // add topic-read/topic-new smarty variable $topics[$id]["topic_forum_link"] = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $topics[$id]["topic_forum"] . '">' . $forum_list[$topics[$id]["topic_forum"]]["forum_name"] . '</a>'; - //irmtfan use topic_title_excerpt + //irmtfan use topic_title_excerpt -- add else if (!empty($topics[$id]["type_id"]) && isset($type_list[$topics[$id]["type_id"]])) { $topics[$id]["topic_title"] = getTopicTitle($topics[$id]["topic_title_excerpt"], $type_list[$topics[$id]["type_id"]]["type_name"], $type_list[$topics[$id]["type_id"]]["type_color"]); - } + } else { + $topics[$id]["topic_title"] = $topics[$id]["topic_title_excerpt"]; + } $topics[$id]["topic_poster"] = !empty($posters_name[$topics[$id]["topic_poster_uid"]]) ? $posters_name[$topics[$id]["topic_poster_uid"]] : $topics[$id]["topic_poster_name"]; Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html 2013-02-06 03:07:29 UTC (rev 10995) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html 2013-02-06 06:13:16 UTC (rev 10996) @@ -52,7 +52,7 @@ <{if $block.headers.topic}> <{$topic.topic_folder}> <a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>" title="<{$topic.topic_excerpt}>"> - <{if $block.headers.type && $topic.topic_title}><{$topic.topic_title}><{else}><{$topic.topic_title_excerpt}><{/if}> + <{if $block.headers.type}><{$topic.topic_title}><{else}><{$topic.topic_title_excerpt}><{/if}> </a> <{if $block.headers.attachment}><{$topic.attachment}><{/if}><{$topic.topic_page_jump}> <br /> Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html 2013-02-06 03:07:29 UTC (rev 10995) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html 2013-02-06 06:13:16 UTC (rev 10996) @@ -52,7 +52,7 @@ <{if $block.headers.topic}> <{$topic.topic_folder}> <a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>" title="<{$topic.topic_excerpt}>"> - <{if $block.headers.type && $topic.topic_title}><{$topic.topic_title}><{else}><{$topic.topic_title_excerpt}><{/if}> + <{if $block.headers.type}><{$topic.topic_title}><{else}><{$topic.topic_title_excerpt}><{/if}> </a> <{if $block.headers.attachment}><{$topic.attachment}><{/if}><{$topic.topic_page_jump}> <br /> |
From: <ir...@us...> - 2013-02-07 04:06:44
|
Revision: 11001 http://sourceforge.net/p/xoops/svn/11001 Author: irmtfan Date: 2013-02-07 04:06:40 +0000 (Thu, 07 Feb 2013) Log Message: ----------- enhance the advance block add more sorts lastposttime, lastposter, lastpostmsgicon . add more display mode: attachment, read, pagenav bug fix: read topics do not show for readmode = 1 Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.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/templates/blocks/newbb_block_list_topic.html XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php 2013-02-06 09:35:02 UTC (rev 11000) +++ XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php 2013-02-07 04:06:40 UTC (rev 11001) @@ -30,11 +30,11 @@ // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) // options[1] - Uid in WHERE claus: uid of the topic poster : 0 - all users (by default) // options[2] - Type in WHERE claus: topic type in the forum : 0 - none (by default) -// options[3] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default),ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode) +// options[3] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default), lastposttime, lastposter, lastpostmsgicon, ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode) // options[4] - Order in ORDER claus: Descending(by default), Ascending // options[5] - NumberToDisplay: any positive integer // options[6] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days -// options[7] - DisplayMode: all fields same as sort +// options[7] - DisplayMode: all fields in sort PLUS attachment, read, pagenav // options[8] - Display Navigator: 1 (by default), 0 (No) // options[9] - Title Length : 0 - no limit and show complete title // options[10] - Post text Length: 0 - dont show post text @@ -75,7 +75,7 @@ $options_headers = explode(',', $options[7]);// headers to display in block // get the title for each header foreach ($options_headers as $header) { - $block['headers'][$header] = $topicRenderer->getSort($header, "title"); + $block['headers'][$header] = $topicRenderer->getHeader($header); } // render a list of topics using all above criterias list($block['topics'], $block['sticky']) = $topicRenderer->renderTopics(); @@ -140,8 +140,8 @@ $modeEle = new XoopsFormCheckBox(_MB_NEWBB_DISPLAYMODE, 'options[7][]', $options_headers); $modeEle->setDescription(_MB_NEWBB_DISPLAYMODE_DESC); $modeEle->columns = 4; - $modeEle->addOptionArray($sorts); - $modeEle->addOption("attachment",_MD_TOPICSHASATT); //add attachment hardcoded in NewbbTopicRenderer + $disps = $topicRenderer -> getHeader(); + $modeEle->addOptionArray($disps); $modeEle->setExtra("onchange = \"validate('options[7][]','checkbox', true)\""); // prevent user select no option // Index navigation element $navEle = new XoopsFormRadioYN(_MB_NEWBB_INDEXNAV, 'options[8]', !empty($options[8])); Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-06 09:35:02 UTC (rev 11000) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-07 04:06:40 UTC (rev 11001) @@ -1,3 +1,16 @@ +date 2013-02-07 +=================================== +1- improve: enhance the advance block. add more sorts: lastposttime, lastposter, lastpostmsgicon . add more display mode: attachment, read, pagenav +newbb/class/topic.renderer.php, newbb/xoops_version.php, + newbb/blocks/list_topic.php, newbb/templates/blocks/newbb_block_list_topic.html, newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html + newbb/language/LANG/main.php, newbb/docs/lang_diff.txt + +2- change default from sticky to lastpost +newbb/class/topic.renderer.php + +3- bug fix: read status: read topics do not show for readmode = 1 in list.topic.php +newbb/class/topic.renderer.php + date 2013-02-06 =================================== 1- bug fix: Undefined variable: forumCookie revert last change - use global instead of include_once @@ -15,24 +28,24 @@ in newbb/class/type.php 2- bug fix: t.topic_rating to t.rating in viewforum and topic renderer pages -in newbb/viewforum.php, newbb/topic.renderer.php +in newbb/viewforum.php, newbb/class/topic.renderer.php 3- bug fix: dont add sort to criteria if sort=null eg: /list.topic.php?sort= will cause db error -in newbb/topic.renderer.php +in newbb/class/topic.renderer.php 4- bug fix: if user set post_excerpt = 0 in preferences, there is no join in criteria and Undefined index: join error occured. -in newbb/topic.renderer.php +in newbb/class/topic.renderer.php 5- feature add: NewbbTopicRenderer class can accept multiple status. more status and sort is added. status supproted: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) -in newbb/topic.renderer.php +in newbb/class/topic.renderer.php 6- feature add: add "topic_title_excerpt" setting. render topics with the specific title length. 0 = dont excerpt and show the whole topic title. -in newbb/plugin.php, newbb/topic.renderer.php +in newbb/include/plugin.php, newbb/class/topic.renderer.php 7- feature add: a new block for topics using NewbbTopicRenderer class. users can drop old "Recent Topics" and "Recent Replied Topics" block and use this block instead. -in newbb/xoops_version.php, newbb/language/LANG/main.php, newbb/language/LANG/blocks.php, newbb/language/LANG/modinfo.php +in newbb/xoops_version.php, newbb/language/LANG/main.php, newbb/language/LANG/blocks.php, newbb/language/LANG/modinfo.php, newbb/docs/lang_diff.txt newbb/list.topic.php, add: newbb/blocks/list_topic.php, newbb/templates/blocks/newbb_block_list_topic.html, newbb/templates/js/language/english/newbb_validation.js newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html, newbb/templates_fulldiv_opacity/js/language/english/newbb_validation.js Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-06 09:35:02 UTC (rev 11000) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-07 04:06:40 UTC (rev 11001) @@ -229,8 +229,9 @@ // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) $startdate = !empty($this->vars["since"]) ? (time() - newbb_getSinceTime($this->vars["since"])) : 0; if ( $lastvisit = max($GLOBALS['last_visit'], $startdate) ) { + $readmode1query = ''; if ( $lastvisit > $startdate ) { - $this->query["where"][] = 'p.post_time < ' . $lastvisit; + $readmode1query = 'p.post_time < ' . $lastvisit; } $topics = array(); $topic_lastread = newbb_getcookie('LT', true); @@ -240,8 +241,11 @@ } } if (count($topics)>0) { - $this->query["where"][] = ' t.topic_id IN (' . implode(",", $topics) . ')'; - } + $topicquery = ' t.topic_id IN (' . implode(",", $topics) . ')'; + // because it should be OR + $readmode1query = !empty($readmode1query) ? '(' . $readmode1query . ' OR ' . $topicquery . ')' : $topicquery; + } + $this->query["where"][] = $readmode1query; } // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) } @@ -400,7 +404,7 @@ //irmtfan parse status for rendering topic correctly - if empty($_GET(status)) it will show all topics include deleted and pendings. "all" instead of all if (!isset($this->vars["status"])) $this->vars["status"] = "all"; // irmtfan if sort is not set or is empty get a default sort- if empty($_GET(sort)) | if sort=null eg: /list.topic.php?sort= - if (empty($this->vars["sort"])) $this->vars["sort"] = in_array("sticky", explode(",",$this->vars["status"])) ? "lastpost" : "sticky"; + if (empty($this->vars["sort"])) $this->vars["sort"] = "lastpost"; // use lastpost instead of sticky foreach ($this->vars as $var => $val) { $this->parseVar($var, $val); @@ -434,15 +438,27 @@ "title" => _MD_VIEWS, "sort" => "t.topic_views", ), - "lastpost" => array( - "title" => _MD_LASTPOSTTIME, /*irmtfan _MD_DATE to _MD_LASTPOSTTIME*/ + "lastpost" => array( // irmtfan show topic_page_jump_icon smarty + "title" => _MD_LASTPOST, /*irmtfan _MD_DATE to _MD_LASTPOSTTIME again change to _MD_LASTPOST*/ "sort" => "t.topic_last_post_id", ), + // START irmtfan add more sorts + "lastposttime" => array( // irmtfan same as lastpost + "title" => _MD_LASTPOSTTIME, + "sort" => "t.topic_last_post_id", + ), + "lastposter" => array( // irmtfan + "title" => _MD_POSTER, + "sort" => "p.uid", // poster uid + ), + "lastpostmsgicon" => array( // irmtfan + "title" => _MD_MESSAGEICON, + "sort" => "p.icon", // post message icon + ), "ratings" => array( "title" => _MD_RATINGS, "sort" => "t.rating", // irmtfan t.topic_rating to t.rating ), - // START irmtfan add more sorts "votes" => array( "title" => _MD_VOTES, "sort" => "t.votes", @@ -497,7 +513,22 @@ } return $ret; } - + // START irmtfan add Display topic headers function + function getHeader($header = null) + { + $headersSort = $this -> getSort("", "title"); + // additional headers - important: those cannot be in sort anyway + $headers = array_merge($headersSort, array( + "attachment" => _MD_TOPICSHASATT, // show attachment smarty + "read" => _MD_MARK_UNREAD.'|'._MD_MARK_READ, // read/unread show topic_folder smarty + "pagenav" => _MD_PAGENAV_DISPLAY, // show topic_page_jump smarty - sort by topic_replies? + )); + if (empty($header)) { + return $headers; + } + return @$headers[$header]; + } + // END irmtfan add Display topic headers function function getStatus($type = null, $status = null) { $links = array( @@ -890,6 +921,7 @@ 'topic_poster_name' => !empty($myrow['poster_name']) ? $myts->htmlSpecialChars($myrow['poster_name']) : $anonymous, 'topic_views' => $myrow['topic_views'], 'topic_time' => newbb_formatTimestamp($myrow['topic_time']), + 'topic_last_post_id' => $myrow['topic_last_post_id'], //irmtfan added 'topic_last_posttime' => newbb_formatTimestamp($myrow['last_post_time']), 'topic_last_poster_uid' => $myrow['uid'], 'topic_last_poster_name' => !empty($myrow['last_poster_name']) ? $myts->htmlSpecialChars( $myrow['last_poster_name'] ) : $anonymous, Modified: XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2013-02-06 09:35:02 UTC (rev 11000) +++ XoopsModules/newbb/branches/irmtfan/newbb/docs/lang_diff.txt 2013-02-07 04:06:40 UTC (rev 11001) @@ -82,6 +82,7 @@ define('_MD_REPLIED','Replied topics'); define('_MD_READ','Read topics'); define('_MD_POLL_POLL','Poll'); +define("_MD_PAGENAV_DISPLAY","Display of navigation"); admin.php --------- Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2013-02-06 09:35:02 UTC (rev 11000) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/english/main.php 2013-02-07 04:06:40 UTC (rev 11001) @@ -522,4 +522,5 @@ define('_MD_REPLIED','Replied topics'); define('_MD_READ','Read topics'); define('_MD_POLL_POLL','Poll'); +define("_MD_PAGENAV_DISPLAY","Display of navigation"); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2013-02-06 09:35:02 UTC (rev 11000) +++ XoopsModules/newbb/branches/irmtfan/newbb/language/persian/main.php 2013-02-07 04:06:40 UTC (rev 11001) @@ -520,4 +520,5 @@ define('_MD_REPLIED','عنوان های دارای پاسخ'); define('_MD_READ','عنوان های خوانده شده'); define('_MD_POLL_POLL','نظرسنجی'); +define("_MD_PAGENAV_DISPLAY","صفحه بندی"); ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html 2013-02-06 09:35:02 UTC (rev 11000) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates/blocks/newbb_block_list_topic.html 2013-02-07 04:06:40 UTC (rev 11001) @@ -1,7 +1,7 @@ <!-- a new block template for newbb --> <!-- all classes can be found in xoops.css --> <!-- define your desired width here --> -<{assign var=minwidth value=300}> <!-- minimum block minwidth property --> +<{assign var=minwidth value=200}> <!-- minimum block minwidth property --> <{assign var=topicwidth value=100}> <!-- maximum topic width property --> <{if $block.headers.forum}> @@ -21,22 +21,22 @@ <{/if}> <{if $block.headers.lastpost}> <{assign var=minwidth value=$minwidth+100}> - <{assign var=topicwidth value=$topicwidth-30}> + <{assign var=topicwidth value=$topicwidth-20}> <{/if}> <{assign var=block_topic value=width$topicwidth}> <!-- block topic width after reduction above --> <div class="outer" style="min-width: <{$minwidth}>px;"> - <div class="head border x-small center"> - <div class="<{$block_topic}> floatleft"><{$block.headers.topic}></div> + <div class="head border x-small"> + <div class="<{$block_topic}> floatleft center"><{$block.headers.topic}></div> <{if $block.headers.forum}> - <div class="<{$block_forum}> floatleft"><{$block.headers.forum}></div> + <div class="<{$block_forum}> floatleft center"><{$block.headers.forum}></div> <{/if}> <{if $block.headers.replies}> - <div class="<{$block_reply}> floatleft"><{$block.headers.replies}></div> + <div class="<{$block_reply}> floatleft center"><{$block.headers.replies}></div> <{/if}> <{if $block.headers.views}> - <div class="<{$block_view}> floatleft"><{$block.headers.views}></div> + <div class="<{$block_view}> floatleft center"><{$block.headers.views}></div> <{/if}> - <div style="overflow: hidden;"><{$block.headers.lastpost}></div> + <div style="overflow: hidden;" class="center" ><{$block.headers.lastpost}></div> <div class="clear"></div> </div> <!-- start forum topic --> @@ -49,14 +49,15 @@ <{if $topic.approve eq -1}><a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>&status=deleted#admin" target="_self" title="<{$smarty.const._MD_TYPE_DELETED}>"><{$smarty.const._MD_TYPE_DELETED}></a><{/if}> <br /> <{/if}> + <{if $block.headers.read}><{$topic.topic_folder}><{/if}> <{if $block.headers.topic}> - <{$topic.topic_folder}> <a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>" title="<{$topic.topic_excerpt}>"> <{if $block.headers.type}><{$topic.topic_title}><{else}><{$topic.topic_title_excerpt}><{/if}> </a> - <{if $block.headers.attachment}><{$topic.attachment}><{/if}><{$topic.topic_page_jump}> + <{if $block.headers.pagenav}><{$topic.topic_page_jump}><{/if}> <br /> <{/if}> + <{if $block.headers.attachment}><{$topic.attachment}><{/if}> <{if $block.headers.lock}><{$topic.lock}><{/if}> <{if $block.headers.sticky}><{$topic.sticky}><{/if}> <{if $block.headers.digest}><{$topic.digest}><{/if}> @@ -67,10 +68,11 @@ <{$block.headers.publish}>: <{$topic.topic_time}> </span> <{/if}> - <{if $block.headers.votes && $topic.votes}> + <{if $topic.votes}> <br /> <span class="xx-small"> - <{$block.headers.votes}>: <{$topic.votes}><{if $block.headers.ratings}> <{$topic.rating_img}><{/if}> + <{if $block.headers.votes}><{$block.headers.votes}>: <{$topic.votes}><{/if}> + <{if $block.headers.ratings}> <{$topic.rating_img}><{/if}> </span> <{/if}> <{if $block.headers.poster}> @@ -90,10 +92,12 @@ <div class="<{$block_view}> floatleft center"><{$topic.topic_views}></div> <{/if}> <div style="overflow: hidden;" class="right"> - <{if $block.headers.lastpost}> - <{$topic.topic_last_posttime}><br /> - <{$topic.topic_last_poster}> <{$topic.topic_page_jump_icon}> - <{/if}> + <{if $block.headers.lastpostmsgicon}><{$topic.topic_icon}><{/if}> + <{if $block.headers.lastposttime}><{$topic.topic_last_posttime}><{/if}> + <br /> + <{if $block.headers.lastposter}><{$topic.topic_last_poster}><{/if}> + + <{if $block.headers.lastpost}><{$topic.topic_page_jump_icon}><{/if}> </div> <div class="clear"></div> </div> Modified: XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html 2013-02-06 09:35:02 UTC (rev 11000) +++ XoopsModules/newbb/branches/irmtfan/newbb/templates_fulldiv_opacity/blocks/newbb_block_list_topic.html 2013-02-07 04:06:40 UTC (rev 11001) @@ -1,7 +1,7 @@ <!-- a new block template for newbb --> <!-- all classes can be found in xoops.css --> <!-- define your desired width here --> -<{assign var=minwidth value=300}> <!-- minimum block minwidth property --> +<{assign var=minwidth value=200}> <!-- minimum block minwidth property --> <{assign var=topicwidth value=100}> <!-- maximum topic width property --> <{if $block.headers.forum}> @@ -21,22 +21,22 @@ <{/if}> <{if $block.headers.lastpost}> <{assign var=minwidth value=$minwidth+100}> - <{assign var=topicwidth value=$topicwidth-30}> + <{assign var=topicwidth value=$topicwidth-20}> <{/if}> <{assign var=block_topic value=width$topicwidth}> <!-- block topic width after reduction above --> <div class="outer" style="min-width: <{$minwidth}>px;"> - <div class="head border x-small center"> - <div class="<{$block_topic}> floatleft"><{$block.headers.topic}></div> + <div class="head border x-small"> + <div class="<{$block_topic}> floatleft center"><{$block.headers.topic}></div> <{if $block.headers.forum}> - <div class="<{$block_forum}> floatleft"><{$block.headers.forum}></div> + <div class="<{$block_forum}> floatleft center"><{$block.headers.forum}></div> <{/if}> <{if $block.headers.replies}> - <div class="<{$block_reply}> floatleft"><{$block.headers.replies}></div> + <div class="<{$block_reply}> floatleft center"><{$block.headers.replies}></div> <{/if}> <{if $block.headers.views}> - <div class="<{$block_view}> floatleft"><{$block.headers.views}></div> + <div class="<{$block_view}> floatleft center"><{$block.headers.views}></div> <{/if}> - <div style="overflow: hidden;"><{$block.headers.lastpost}></div> + <div style="overflow: hidden;" class="center" ><{$block.headers.lastpost}></div> <div class="clear"></div> </div> <!-- start forum topic --> @@ -49,14 +49,15 @@ <{if $topic.approve eq -1}><a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>&status=deleted#admin" target="_self" title="<{$smarty.const._MD_TYPE_DELETED}>"><{$smarty.const._MD_TYPE_DELETED}></a><{/if}> <br /> <{/if}> + <{if $block.headers.read}><{$topic.topic_folder}><{/if}> <{if $block.headers.topic}> - <{$topic.topic_folder}> <a href="<{$xoops_url}>/modules/newbb/<{$topic.topic_link}>" title="<{$topic.topic_excerpt}>"> <{if $block.headers.type}><{$topic.topic_title}><{else}><{$topic.topic_title_excerpt}><{/if}> </a> - <{if $block.headers.attachment}><{$topic.attachment}><{/if}><{$topic.topic_page_jump}> + <{if $block.headers.pagenav}><{$topic.topic_page_jump}><{/if}> <br /> <{/if}> + <{if $block.headers.attachment}><{$topic.attachment}><{/if}> <{if $block.headers.lock}><{$topic.lock}><{/if}> <{if $block.headers.sticky}><{$topic.sticky}><{/if}> <{if $block.headers.digest}><{$topic.digest}><{/if}> @@ -67,10 +68,11 @@ <{$block.headers.publish}>: <{$topic.topic_time}> </span> <{/if}> - <{if $block.headers.votes && $topic.votes}> + <{if $topic.votes}> <br /> <span class="xx-small"> - <{$block.headers.votes}>: <{$topic.votes}><{if $block.headers.ratings}> <{$topic.rating_img}><{/if}> + <{if $block.headers.votes}><{$block.headers.votes}>: <{$topic.votes}><{/if}> + <{if $block.headers.ratings}> <{$topic.rating_img}><{/if}> </span> <{/if}> <{if $block.headers.poster}> @@ -90,10 +92,12 @@ <div class="<{$block_view}> floatleft center"><{$topic.topic_views}></div> <{/if}> <div style="overflow: hidden;" class="right"> - <{if $block.headers.lastpost}> - <{$topic.topic_last_posttime}><br /> - <{$topic.topic_last_poster}> <{$topic.topic_page_jump_icon}> - <{/if}> + <{if $block.headers.lastpostmsgicon}><{$topic.topic_icon}><{/if}> + <{if $block.headers.lastposttime}><{$topic.topic_last_posttime}><{/if}> + <br /> + <{if $block.headers.lastposter}><{$topic.topic_last_poster}><{/if}> + + <{if $block.headers.lastpost}><{$topic.topic_page_jump_icon}><{/if}> </div> <div class="clear"></div> </div> Modified: XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php 2013-02-06 09:35:02 UTC (rev 11000) +++ XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php 2013-02-07 04:06:40 UTC (rev 11001) @@ -238,7 +238,7 @@ 'name' => _MI_NEWBB_BLOCK_LIST_TOPIC, 'description' => "Shows a list of topics (advance renderer)", 'show_func' => "newbb_list_topic_show", - 'options' => "all|0|0|lastpost|0|5|360|topic,forum,poster,replies,lastpost,publish|1|0|200|0", + 'options' => "all|0|0|lastpost|0|5|360|topic,forum,replies,lastpost,lastposttime,lastposter,lastpostmsgicon,publish|1|0|200|0", 'edit_func' => "newbb_list_topic_edit", 'template' => 'newbb_block_list_topic.html'); // irmtfan END add list topic block |
From: <ir...@us...> - 2013-02-12 01:49:58
|
Revision: 11025 http://sourceforge.net/p/xoops/svn/11025 Author: irmtfan Date: 2013-02-12 01:49:55 +0000 (Tue, 12 Feb 2013) Log Message: ----------- improve: add multi topic poster and multi last poster fix: multi status and multi display header in NewbbTopicRenderer class Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php 2013-02-12 00:36:10 UTC (rev 11024) +++ XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php 2013-02-12 01:49:55 UTC (rev 11025) @@ -29,16 +29,17 @@ // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) // options[1] - Uid in WHERE claus: uid of the topic poster : 0 - all users (by default) -// options[2] - Type in WHERE claus: topic type in the forum : 0 - none (by default) -// options[3] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default), lastposttime, lastposter, lastpostmsgicon, ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode) -// options[4] - Order in ORDER claus: Descending(by default), Ascending -// options[5] - NumberToDisplay: any positive integer -// options[6] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days -// options[7] - DisplayMode: all fields in sort PLUS attachment, read, pagenav -// options[8] - Display Navigator: 1 (by default), 0 (No) -// options[9] - Title Length : 0 - no limit and show complete title -// options[10] - Post text Length: 0 - dont show post text -// options[11] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default) +// options[2] - Lastposter in WHERE claus: uid of the lastposter in topic : 0 - all users (by default) +// options[3] - Type in WHERE claus: topic type in the forum : 0 - none (by default) +// options[4] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default), lastposttime, lastposter, lastpostmsgicon, ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode) +// options[5] - Order in ORDER claus: Descending(by default), Ascending +// options[6] - NumberToDisplay: any positive integer +// options[7] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days +// options[8] - DisplayMode: all fields in sort PLUS attachment, read, pagenav +// options[9] - Display Navigator: 1 (by default), 0 (No) +// options[10] - Title Length : 0 - no limit and show complete title +// options[11] - Post text Length: 0 - dont show post text +// options[12] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default) function newbb_list_topic_show($options) { @@ -51,37 +52,36 @@ $topicRenderer->is_multiple = true; // is it for multiple forums $topicRenderer->config =& $newbbConfig; // get all configs - if (!empty($options[5])) { - $topicRenderer->config['topics_per_page'] = intval($options[5]); // number of topics (items) to display + if (!empty($options[6])) { + $topicRenderer->config['topics_per_page'] = intval($options[6]); // number of topics (items) to display } - $topicRenderer->config['topic_title_excerpt'] = intval($options[9]); // topic title length 0 = dont excerpt - $topicRenderer->config['post_excerpt'] = intval($options[10]); // post text excerpt 0 = no post text + $topicRenderer->config['topic_title_excerpt'] = intval($options[10]); // topic title length 0 = dont excerpt + $topicRenderer->config['post_excerpt'] = intval($options[11]); // post text excerpt 0 = no post text $options_status = explode(',', $options[0]); // status in where claus - $options_forum = explode(',', $options[11]); + $options_forum = explode(',', $options[12]); // set and parse values: // forum: parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums $topicRenderer->setVars(array( 'status' => $options_status, 'uid' => $options[1], - 'type' => $options[2], - 'sort' => $options[3], - 'order' => $options[4], - 'since' => $options[6], + 'lastposter' => $options[2], + 'type' => $options[3], + 'sort' => $options[4], + 'order' => $options[5], + 'since' => $options[7], 'forum' => $options_forum, )); $block = array(); - $options_headers = explode(',', $options[7]);// headers to display in block - // get the title for each header - foreach ($options_headers as $header) { - $block['headers'][$header] = $topicRenderer->getHeader($header); - } + // headers to display in block + $block['headers'] = $topicRenderer->getHeader($options[8]); + // render a list of topics using all above criterias list($block['topics'], $block['sticky']) = $topicRenderer->renderTopics(); // show index navigation - $block['indexNav'] = !empty($options[8]); + $block['indexNav'] = !empty($options[9]); return $block; } @@ -106,11 +106,24 @@ $statusEle->setDescription(_MB_NEWBB_CRITERIA_DESC); // topic_poster element - $topicPosterEle = new XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, $options[1], 1, false); + $topicPosterRadioEle = new XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', !empty($options[1])); + $topicPosterRadioEle->addOption(0,_MD_TOTALUSER); + $topicPosterRadioEle->addOption(!empty($options[1]) ? $options[1] : 1,_SELECT); // if no user in selection box it select uid=1 + $topicPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[1]'); el.disabled=(this.id == 'options[1]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" + $topicPosterSelectEle = new XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', false, explode(',', $options[1]), 5, true); + $topicPosterEle = new XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render().$topicPosterSelectEle->render()); + + // lastposter element + $lastPosterRadioEle = new XoopsFormRadio(_MD_POSTER, 'options[2]', !empty($options[2])); + $lastPosterRadioEle->addOption(0,_MD_TOTALUSER); + $lastPosterRadioEle->addOption(!empty($options[2]) ? $options[2] : 1,_SELECT); // if no user in selection box it select uid=1 + $lastPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[2]'); el.disabled=(this.id == 'options[2]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" + $lastPosterSelectEle = new XoopsFormSelectUser(_MD_POSTER, 'options[2]', false, explode(',', $options[2]), 5, true); + $lastPosterEle = new XoopsFormLabel(_MD_POSTER, $lastPosterRadioEle->render().$lastPosterSelectEle->render()); // type element $types = $topicRenderer -> getTypes(); // get all available types in all forums - $typeEle = new XoopsFormSelect(_MD_NEWBB_TYPE, 'options[2]', $options[2]); + $typeEle = new XoopsFormSelect(_MD_NEWBB_TYPE, 'options[3]', $options[3]); $typeEle->addOption(0, _NONE); if (!empty($types)) { foreach ($types as $type_id => $type) { @@ -119,50 +132,50 @@ } // sort element - $sortEle = new XoopsFormSelect(_MD_SORTBY, 'options[3]', $options[3]); + $sortEle = new XoopsFormSelect(_MD_SORTBY, 'options[4]', $options[4]); $sortEle->setDescription(_MB_NEWBB_CRITERIA_SORT_DESC); $sorts = $topicRenderer -> getSort("", "title"); $sortEle->addOptionArray($sorts); // order element - $orderEle = new XoopsFormSelect(_MB_NEWBB_CRITERIA_ORDER, 'options[4]', $options[4]); + $orderEle = new XoopsFormSelect(_MB_NEWBB_CRITERIA_ORDER, 'options[5]', $options[5]); $orderEle->addOption(0, _DESCENDING); $orderEle->addOption(1, _ASCENDING); // number of topics to display element - $numdispEle = new XoopsFormText(_MB_NEWBB_DISPLAY, 'options[5]', 10, 255, intval($options[5])); + $numdispEle = new XoopsFormText(_MB_NEWBB_DISPLAY, 'options[6]', 10, 255, intval($options[6])); - $timeEle = new XoopsFormText(_MB_NEWBB_TIME, 'options[6]', 10, 255, $options[6]); + $timeEle = new XoopsFormText(_MB_NEWBB_TIME, 'options[7]', 10, 255, $options[7]); $timeEle->setDescription(_MB_NEWBB_TIME_DESC); // mode disp element - $options_headers = explode(',', $options[7]); - $modeEle = new XoopsFormCheckBox(_MB_NEWBB_DISPLAYMODE, 'options[7][]', $options_headers); + $options_headers = explode(',', $options[8]); + $modeEle = new XoopsFormCheckBox(_MB_NEWBB_DISPLAYMODE, 'options[8][]', $options_headers); $modeEle->setDescription(_MB_NEWBB_DISPLAYMODE_DESC); $modeEle->columns = 4; $disps = $topicRenderer -> getHeader(); $modeEle->addOptionArray($disps); - $modeEle->setExtra("onchange = \"validate('options[7][]','checkbox', true)\""); // prevent user select no option + $modeEle->setExtra("onchange = \"validate('options[8][]','checkbox', true)\""); // prevent user select no option // Index navigation element - $navEle = new XoopsFormRadioYN(_MB_NEWBB_INDEXNAV, 'options[8]', !empty($options[8])); + $navEle = new XoopsFormRadioYN(_MB_NEWBB_INDEXNAV, 'options[9]', !empty($options[9])); // Topic title element - $lengthEle = new XoopsFormText( _MB_NEWBB_TITLE_LENGTH, 'options[9]', 10, 255, intval($options[9])); + $lengthEle = new XoopsFormText( _MB_NEWBB_TITLE_LENGTH, 'options[10]', 10, 255, intval($options[10])); $lengthEle->setDescription(_MB_NEWBB_TITLE_LENGTH_DESC); // Post text element - $postExcerptEle = new XoopsFormText( _MB_NEWBB_POST_EXCERPT, 'options[10]', 10, 255, intval($options[10])); + $postExcerptEle = new XoopsFormText( _MB_NEWBB_POST_EXCERPT, 'options[11]', 10, 255, intval($options[11])); $postExcerptEle->setDescription(_MB_NEWBB_POST_EXCERPT_DESC); // forum element - $options_forum = explode(',', $options[11]); + $options_forum = explode(',', $options[12]); mod_loadFunctions("forum", "newbb"); $forum_handler = xoops_getmodulehandler('forum', 'newbb'); //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums // Get accessible forums $access_forums = $forum_handler->getIdsByValues(array_map("intval", $options_forum)); $isAll = (count($options_forum) == 0 || empty($options_forum[0])); - $forumSel = "<select name=\"options[11][]\" multiple=\"multiple\" onchange = \"validate('options[11][]','select', true)\">";// if user dont select any it select "0" + $forumSel = "<select name=\"options[12][]\" multiple=\"multiple\" onchange = \"validate('options[12][]','select', true)\">";// if user dont select any it select "0" $forumSel .= "<option value=\"0\" "; if ($isAll) { $forumSel .= " selected"; @@ -176,6 +189,7 @@ // add all elements to form $form->addElement($statusEle); $form->addElement($topicPosterEle); + $form->addElement($lastPosterEle); $form->addElement($typeEle); $form->addElement($sortEle); $form->addElement($orderEle); Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-12 00:36:10 UTC (rev 11024) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-02-12 01:49:55 UTC (rev 11025) @@ -1,3 +1,12 @@ +date 2013-02-11 +=================================== +1- improve: add multi topic poster and multi last poster to NewbbTopicRenderer class (used in block and list.topic.php) +newbb/class/topic.renderer.php, newbb/xoops_version.php, +newbb/list.topic.php, newbb/blocks/list_topic.php + +2- improve and fix: multi status and multi display header in NewbbTopicRenderer class +newbb/class/topic.renderer.php, newbb/list.topic.php, newbb/blocks/list_topic.php + date 2013-02-07 =================================== 1- improve: enhance the advance block. add more sorts: lastposttime, lastposter, lastpostmsgicon . add more display mode: attachment, read, pagenav Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-12 00:36:10 UTC (rev 11024) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-02-12 01:49:55 UTC (rev 11025) @@ -43,7 +43,7 @@ /** * query variables */ - var $args = array("forum", "uid", "type", "status", "mode", "sort", "order", "start", "since"); + var $args = array("forum", "uid", "lastposter", "type", "status", "mode", "sort", "order", "start", "since");// irmtfan add multi lastposter var $vars = array(); /** @@ -115,7 +115,6 @@ // END irmtfan - if the forum is array break; - case "uid": case "type": case "mode": case "order": @@ -123,7 +122,11 @@ case "since": $val = intval($val); break; - + + case "uid": // irmtfan add multi topic poster + case "lastposter": // irmtfan add multi lastposter + break; + case "status": // START irmtfan to accept multiple status $val = is_array($val) ? $val : array($val); @@ -340,25 +343,32 @@ } break; - case "uid": + case "uid": // irmtfan add multi topic poster if (!empty($val)) { - $this->query["where"][] = "t.topic_poster = ". $val; + $val = implode(",",array_map("intval", explode(",", $val))); + $this->query["where"][] = "t.topic_poster IN ( ". $val ." )"; } break; + case "lastposter": // irmtfan add multi lastposter + if (!empty($val)) { + $val = implode(",",array_map("intval", explode(",", $val))); + $this->query["where"][] = "p.uid IN ( ". $val ." )"; + } + break; case "since": if (!empty($val)) { - // START irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query + // START irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query | to accept multiple status $startdate = time() - newbb_getSinceTime($val); - if ( $this->vars["status"] == "unread" && $this->config["read_mode"] == 1 && $GLOBALS['last_visit'] > $startdate ) + if ( in_array("unread", explode(",",$this->vars["status"])) && $this->config["read_mode"] == 1 && $GLOBALS['last_visit'] > $startdate ) break; - // irmtfan digest_time - if ($this->vars["status"] == "digest") { + // irmtfan digest_time | to accept multiple status + if (in_array("digest", explode(",",$this->vars["status"]))) { $this->query["where"][] = "t.digest_time > ". $startdate; } // irmtfan - should be >= instead of = $this->query["where"][] = "p.post_time >= ". $startdate; - // START irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query + // END irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query } break; @@ -523,10 +533,7 @@ "read" => _MD_MARK_UNREAD.'|'._MD_MARK_READ, // read/unread show topic_folder smarty "pagenav" => _MD_PAGENAV_DISPLAY, // show topic_page_jump smarty - sort by topic_replies? )); - if (empty($header)) { - return $headers; - } - return @$headers[$header]; + return $this->getFromKeys($headers, $header); } // END irmtfan add Display topic headers function function getStatus($type = null, $status = null) @@ -558,23 +565,11 @@ "deleted" => _MD_TYPE_DELETED, ); - // specified status - if ($status !== null) { - if (isset($links[$status])) return $links[$status]; - return @$links_admin[$status]; - } - // all status, for admin if ($type > 1) { - return array_merge($links, $links_admin); + $links = array_merge($links, $links_admin);// irmtfan to accept multiple status } - - // for regular users - //if ($type == 1) { - return $links; - //} - - //return $links_admin; + return $this->getFromKeys($links, $status); // irmtfan to accept multiple status } function buildSelection(&$xoopsTpl) @@ -702,7 +697,7 @@ } $status = array(); - $status["title"] = $this->getStatus(0, empty($this->vars["status"]) ? "all" : $this->vars["status"]); + $status["title"] = implode(",",$this->getStatus($this->userlevel, $this->vars["status"])); // irmtfan to accept multiple status //$status["link"] = $this->page.(empty($this->vars["status"]) ? "" : "?status=".$this->vars["status"]); $status["link"] = $this->page.(empty($args) ? "" : "?".implode("&", $args)); @@ -1026,6 +1021,19 @@ } return array($topics, $sticky); } + // START irmtfan to create an array from selected keys of an array + function getFromKeys($array, $keys = null) + { + if (empty($keys)) return $array; // all keys + $keyarr = is_string($keys) ? explode(",",$keys) : $keys; + $keyarr = array_intersect(array_keys($array),$keyarr); // keys should be in array + $ret = array(); + foreach ($keyarr as $key) { + $ret[$key] = $array[$key]; + } + return $ret; + } + // END irmtfan to create an array from selected keys of an array } ?> \ No newline at end of file Modified: XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2013-02-12 00:36:10 UTC (rev 11024) +++ XoopsModules/newbb/branches/irmtfan/newbb/list.topic.php 2013-02-12 01:49:55 UTC (rev 11025) @@ -41,14 +41,15 @@ $topic_renderer->setVars( @$_GET ); $type = intval( @$_GET['type'] ); -$status = (!empty($_GET['status']) && in_array($_GET['status'], array("active", "pending", "deleted", "digest", "unreplied", "unread")))? $_GET['status'] : "all"; +$status = explode(",",$topic_renderer->vars["status"]); // irmtfan to accept multiple status //irmtfan parse status for rendering topic correctly - remove here and move to topic.renderer.php //$topic_renderer->parseVar('status',$status); -$mode = (!empty($status) && in_array($status, array("active", "pending", "deleted"))) ? 2 : (!empty($_GET['mode']) ? intval($_GET['mode']) : 0); +// irmtfan to accept multiple status +$mode = count(array_intersect($status, array("active", "pending", "deleted"))) > 0 ? 2 : (!empty($_GET['mode']) ? intval($_GET['mode']) : 0); -$isadmin = $GLOBALS["xoopsUserIsAdmin"]; +//$isadmin = $GLOBALS["xoopsUserIsAdmin"]; /* Only admin has access to admin mode */ -if (!$isadmin) { +if ($topic_renderer->userlevel < 2) { // irmtfan use userlevel $mode = 0; } @@ -92,7 +93,7 @@ $xoopsTpl->assign('mode', $mode); $xoopsTpl->assign('status', $status); -$xoopsTpl->assign('viewer_level', ($isadmin) ? 2 : is_object($xoopsUser) ); +$xoopsTpl->assign('viewer_level', $topic_renderer->userlevel );// irmtfan use userlevel $pagetitle = sprintf(_MD_FORUMINDEX, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)); $xoopsTpl->assign('forum_index_title', $pagetitle); Modified: XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php 2013-02-12 00:36:10 UTC (rev 11024) +++ XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php 2013-02-12 01:49:55 UTC (rev 11025) @@ -222,23 +222,24 @@ // irmtfan START add list topic block // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) // options[1] - Uid in WHERE claus: uid of the topic poster : 0 - all users (by default) -// options[2] - Type in WHERE claus: topic type in the forum : 0 - none (by default) -// options[3] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default),ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode), attachment -// options[4] - Order in ORDER claus: Descending(by default), Ascending -// options[5] - NumberToDisplay: any positive integer -// options[6] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days -// options[7] - DisplayMode: all fields same as sort -// options[8] - Display Navigator: 1 (by default), 0 (No) -// options[9] - Title Length : 0 - no limit and show complete title -// options[10] - Post text Length: 0 - dont show post text -// options[11] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default) +// options[2] - Lastposter in WHERE claus: uid of the lastposter in topic : 0 - all users (by default) +// options[3] - Type in WHERE claus: topic type in the forum : 0 - none (by default) +// options[4] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default), lastposttime, lastposter, lastpostmsgicon, ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode) +// options[5] - Order in ORDER claus: Descending(by default), Ascending +// options[6] - NumberToDisplay: any positive integer +// options[7] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days +// options[8] - DisplayMode: all fields in sort PLUS attachment, read, pagenav +// options[9] - Display Navigator: 1 (by default), 0 (No) +// options[10] - Title Length : 0 - no limit and show complete title +// options[11] - Post text Length: 0 - dont show post text +// options[12] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default) $modversion['blocks'][] = array( 'file' => "list_topic.php", 'name' => _MI_NEWBB_BLOCK_LIST_TOPIC, 'description' => "Shows a list of topics (advance renderer)", 'show_func' => "newbb_list_topic_show", - 'options' => "all|0|0|lastpost|0|5|360|topic,forum,replies,lastpost,lastposttime,lastposter,lastpostmsgicon,publish|1|0|200|0", + 'options' => "all|0|0|0|lastpost|0|5|360|topic,forum,replies,lastpost,lastposttime,lastposter,lastpostmsgicon,publish|1|0|200|0", 'edit_func' => "newbb_list_topic_edit", 'template' => 'newbb_block_list_topic.html'); // irmtfan END add list topic block |
From: <ir...@us...> - 2013-04-15 11:22:12
|
Revision: 11384 http://sourceforge.net/p/xoops/svn/11384 Author: irmtfan Date: 2013-04-15 11:22:09 +0000 (Mon, 15 Apr 2013) Log Message: ----------- improve: add anon users to topic poster and last poster in NewbbTopicRenderer class (used in block and list.topic.php) newbb/class/topic.renderer.php, newbb/xoops_version.php, newbb/list.topic.php, newbb/blocks/list_topic.php Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php 2013-04-15 10:52:09 UTC (rev 11383) +++ XoopsModules/newbb/branches/irmtfan/newbb/blocks/list_topic.php 2013-04-15 11:22:09 UTC (rev 11384) @@ -28,17 +28,17 @@ mod_loadFunctions("user", "newbb"); // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) -// options[1] - Uid in WHERE claus: uid of the topic poster : 0 - all users (by default) -// options[2] - Lastposter in WHERE claus: uid of the lastposter in topic : 0 - all users (by default) +// options[1] - Uid in WHERE claus: uid of the topic poster : -1 - all users (by default) +// options[2] - Lastposter in WHERE claus: uid of the lastposter in topic : -1 - all users (by default) // options[3] - Type in WHERE claus: topic type in the forum : 0 - none (by default) // options[4] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default), lastposttime, lastposter, lastpostmsgicon, ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode) -// options[5] - Order in ORDER claus: Descending(by default), Ascending -// options[6] - NumberToDisplay: any positive integer -// options[7] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days +// options[5] - Order in ORDER claus: Descending 0(by default), Ascending 1 +// options[6] - NumberToDisplay: any positive integer - 5 by default +// options[7] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days - 360 by default // options[8] - DisplayMode: all fields in sort PLUS attachment, read, pagenav // options[9] - Display Navigator: 1 (by default), 0 (No) -// options[10] - Title Length : 0 - no limit and show complete title -// options[11] - Post text Length: 0 - dont show post text +// options[10] - Title Length : 0 by default - no limit and show complete title +// options[11] - Post text Length: 0 - dont show post text - 200 by default // options[12] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default) function newbb_list_topic_show($options) @@ -106,19 +106,19 @@ $statusEle->setDescription(_MB_NEWBB_CRITERIA_DESC); // topic_poster element - $topicPosterRadioEle = new XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', !empty($options[1])); - $topicPosterRadioEle->addOption(0,_MD_TOTALUSER); - $topicPosterRadioEle->addOption(!empty($options[1]) ? $options[1] : 1,_SELECT); // if no user in selection box it select uid=1 + $topicPosterRadioEle = new XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', $options[1]); + $topicPosterRadioEle->addOption(-1,_MD_TOTALUSER); + $topicPosterRadioEle->addOption(($options[1] != -1) ? $options[1] : 0,_SELECT); // if no user in selection box it select uid=0 anon users $topicPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[1]'); el.disabled=(this.id == 'options[1]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" - $topicPosterSelectEle = new XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', false, explode(',', $options[1]), 5, true); + $topicPosterSelectEle = new XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true); $topicPosterEle = new XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render().$topicPosterSelectEle->render()); // lastposter element - $lastPosterRadioEle = new XoopsFormRadio(_MD_POSTER, 'options[2]', !empty($options[2])); - $lastPosterRadioEle->addOption(0,_MD_TOTALUSER); - $lastPosterRadioEle->addOption(!empty($options[2]) ? $options[2] : 1,_SELECT); // if no user in selection box it select uid=1 + $lastPosterRadioEle = new XoopsFormRadio(_MD_POSTER, 'options[2]', $options[2]); + $lastPosterRadioEle->addOption(-1,_MD_TOTALUSER); + $lastPosterRadioEle->addOption(($options[2] != -1) ? $options[2] : 0,_SELECT); // if no user in selection box it select uid=1 $lastPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[2]'); el.disabled=(this.id == 'options[2]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" - $lastPosterSelectEle = new XoopsFormSelectUser(_MD_POSTER, 'options[2]', false, explode(',', $options[2]), 5, true); + $lastPosterSelectEle = new XoopsFormSelectUser(_MD_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true); $lastPosterEle = new XoopsFormLabel(_MD_POSTER, $lastPosterRadioEle->render().$lastPosterSelectEle->render()); // type element Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-04-15 10:52:09 UTC (rev 11383) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-04-15 11:22:09 UTC (rev 11384) @@ -1,3 +1,9 @@ +date 2013-04-15 +=================================== +1- improve: add anon users to topic poster and last poster in NewbbTopicRenderer class (used in block and list.topic.php) +newbb/class/topic.renderer.php, newbb/xoops_version.php, +newbb/list.topic.php, newbb/blocks/list_topic.php + date 2013-02-11 =================================== 1- improve: add multi topic poster and multi last poster to NewbbTopicRenderer class (used in block and list.topic.php) Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-04-15 10:52:09 UTC (rev 11383) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/topic.renderer.php 2013-04-15 11:22:09 UTC (rev 11384) @@ -344,13 +344,13 @@ break; case "uid": // irmtfan add multi topic poster - if (!empty($val)) { + if ($val != -1) { $val = implode(",",array_map("intval", explode(",", $val))); $this->query["where"][] = "t.topic_poster IN ( ". $val ." )"; } break; case "lastposter": // irmtfan add multi lastposter - if (!empty($val)) { + if ($val != -1) { $val = implode(",",array_map("intval", explode(",", $val))); $this->query["where"][] = "p.uid IN ( ". $val ." )"; } Modified: XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php 2013-04-15 10:52:09 UTC (rev 11383) +++ XoopsModules/newbb/branches/irmtfan/newbb/xoops_version.php 2013-04-15 11:22:09 UTC (rev 11384) @@ -221,17 +221,17 @@ ); // irmtfan START add list topic block // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) -// options[1] - Uid in WHERE claus: uid of the topic poster : 0 - all users (by default) -// options[2] - Lastposter in WHERE claus: uid of the lastposter in topic : 0 - all users (by default) +// options[1] - Uid in WHERE claus: uid of the topic poster : -1 - all users (by default) +// options[2] - Lastposter in WHERE claus: uid of the lastposter in topic : -1 - all users (by default) // options[3] - Type in WHERE claus: topic type in the forum : 0 - none (by default) // options[4] - Sort in ORDER claus: topic, forum, poster, replies, views, lastpost(by default), lastposttime, lastposter, lastpostmsgicon, ratings, votes, publish, digest, sticky, lock, poll, type (if exist), approve(admin mode) -// options[5] - Order in ORDER claus: Descending(by default), Ascending -// options[6] - NumberToDisplay: any positive integer -// options[7] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days +// options[5] - Order in ORDER claus: Descending 0(by default), Ascending 1 +// options[6] - NumberToDisplay: any positive integer - 5 by default +// options[7] - TimeDuration: negative for hours, positive for days, for instance, -5 for 5 hours and 5 for 5 days - 360 by default // options[8] - DisplayMode: all fields in sort PLUS attachment, read, pagenav // options[9] - Display Navigator: 1 (by default), 0 (No) -// options[10] - Title Length : 0 - no limit and show complete title -// options[11] - Post text Length: 0 - dont show post text +// options[10] - Title Length : 0 by default - no limit and show complete title +// options[11] - Post text Length: 0 - dont show post text - 200 by default // options[12] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default) $modversion['blocks'][] = array( @@ -239,7 +239,7 @@ 'name' => _MI_NEWBB_BLOCK_LIST_TOPIC, 'description' => "Shows a list of topics (advance renderer)", 'show_func' => "newbb_list_topic_show", - 'options' => "all|0|0|0|lastpost|0|5|360|topic,forum,replies,lastpost,lastposttime,lastposter,lastpostmsgicon,publish|1|0|200|0", + 'options' => "all|-1|-1|0|lastpost|0|5|360|topic,forum,replies,lastpost,lastposttime,lastposter,lastpostmsgicon,publish|1|0|200|0", 'edit_func' => "newbb_list_topic_edit", 'template' => 'newbb_block_list_topic.html'); // irmtfan END add list topic block |
From: <ir...@us...> - 2013-04-17 01:49:24
|
Revision: 11389 http://sourceforge.net/p/xoops/svn/11389 Author: irmtfan Date: 2013-04-17 01:49:19 +0000 (Wed, 17 Apr 2013) Log Message: ----------- 1- bug fix: should not ban the user in forum who is moderator of that forum. in newbb/include/form.post.php and newbb/class/moderate.php 2- bug fix: uid=0 for anonymous users in newbb/class/moderate.php 3- bug fix: if forum=0 should return true in any forum in newbb/class/moderate.php 4- bug fix: should not show quick reply for suspend users otherwise they can post in newbb/viewtopic.php 5- add: forum select box for admins to be able to suspend users in any forum or all forums in newbb/moderate.php Modified Paths: -------------- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt XoopsModules/newbb/branches/irmtfan/newbb/class/moderate.php XoopsModules/newbb/branches/irmtfan/newbb/include/form.post.php XoopsModules/newbb/branches/irmtfan/newbb/moderate.php XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php Modified: XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-04-16 15:22:50 UTC (rev 11388) +++ XoopsModules/newbb/branches/irmtfan/newbb/changelog-rev10109.txt 2013-04-17 01:49:19 UTC (rev 11389) @@ -1,3 +1,11 @@ +date 2013-04-17 +=================================== +1- bug fix: should not ban the user in forum who is moderator of that forum. in newbb/include/form.post.php and newbb/class/moderate.php +2- bug fix: uid=0 for anonymous users in newbb/class/moderate.php +3- bug fix: if forum=0 should return true in any forum in newbb/class/moderate.php +4- bug fix: should not show quick reply for suspend users otherwise they can post in newbb/viewtopic.php +5- add: forum select box for admins to be able to suspend users in any forum or all forums in newbb/moderate.php + date 2013-04-15 =================================== 1- improve: add anon users to topic poster and last poster in NewbbTopicRenderer class (used in block and list.topic.php) Modified: XoopsModules/newbb/branches/irmtfan/newbb/class/moderate.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/class/moderate.php 2013-04-16 15:22:50 UTC (rev 11388) +++ XoopsModules/newbb/branches/irmtfan/newbb/class/moderate.php 2013-04-17 01:49:19 UTC (rev 11389) @@ -73,12 +73,14 @@ * @param string $ip user ip */ function verifyUser($uid = -1, $ip = "", $forum = 0) { + if(newbb_isAdmin($forum)) return false; // irmtfan - if user is admin do not suspend if (!empty($GLOBALS["xoopsModuleConfig"]['cache_enabled'])) { $forums = $this->forumList($uid, $ip); + if(in_array(0, $forums)) return true; // irmtfan - if user is suspend in All forums return in_array($forum, $forums); } $uid = ($uid < 0) ? ( is_object($GLOBALS["xoopsUser"]) ? $GLOBALS["xoopsUser"]->getVar("uid") : 0 ) : $uid; - $uid_criteria = empty($uid) ? "1=1" : "uid=" . intval($uid); + $uid_criteria = empty($uid) ? "uid=0" : "uid=" . intval($uid); // irmtfan - uid=0 for anons $ip = empty($ip) ? newbb_getIP(true) : $ip; if (!empty($ip)) { $ip_segs = explode(".", $ip); @@ -120,7 +122,7 @@ return $forums[$uid][$ip]; } } - $uid_criteria = empty($uid) ? "1=1" : "uid=" . intval($uid); + $uid_criteria = empty($uid) ? "uid=0" : "uid=" . intval($uid); // irmtfan - uid=0 for anons if (!empty($ip)) { $ip_segs = explode(".", $ip); for($i = 1; $i <= 4; $i++) { Modified: XoopsModules/newbb/branches/irmtfan/newbb/include/form.post.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/include/form.post.php 2013-04-16 15:22:50 UTC (rev 11388) +++ XoopsModules/newbb/branches/irmtfan/newbb/include/form.post.php 2013-04-17 01:49:19 UTC (rev 11389) @@ -30,11 +30,11 @@ //check banning $moderated_id = ( is_object($xoopsUser) && $xoopsUser->uid() > 0 ) ? $xoopsUser->uid() : 0; -$moderated_isadmin = ( is_object($xoopsUser) && $xoopsUser->isAdmin() ) ? true : false; +// $moderated_isadmin = ( is_object($xoopsUser) && $xoopsUser->isAdmin() ) ? true : false; // irmtfan commented $moderated_ip = $_SERVER['REMOTE_ADDR']; $moderated_forum = $forum_obj->getVar('forum_id'); $moderate_handler =& xoops_getmodulehandler('moderate', 'newbb'); -if ($moderate_handler->verifyUser($moderated_id, $moderated_ip,$moderated_forum) && !$moderated_isadmin) { +if ($moderate_handler->verifyUser($moderated_id, $moderated_ip,$moderated_forum)) { // irmtfan removed $criteria = new CriteriaCompo(); $criteria->add( new criteria('uid',$moderated_id,'=') ); $criteria->setSort('mod_end'); Modified: XoopsModules/newbb/branches/irmtfan/newbb/moderate.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/moderate.php 2013-04-16 15:22:50 UTC (rev 11388) +++ XoopsModules/newbb/branches/irmtfan/newbb/moderate.php 2013-04-17 01:49:19 UTC (rev 11389) @@ -219,7 +219,24 @@ $forum_form->addElement(new XoopsFormText(_MD_SUSPEND_IP, 'ip', 20, 25)); $forum_form->addElement(new XoopsFormText(_MD_SUSPEND_DURATION, 'expire', 20, 25, '5'), true); $forum_form->addElement(new XoopsFormText(_MD_SUSPEND_DESC, 'desc', 50, 255)); -$forum_form->addElement(new XoopsFormHidden('forum', $forum_id)); +// START irmtfan add forum select box for admins +mod_loadFunctions("forum", "newbb"); +if(newbb_isAdmin()) { + $forumSel = "<select name=\"forum\">";// if user dont select any it select "0" + $forumSel .= "<option value=\"0\" "; + if ($forum_id == 0) { + $forumSel .= " selected"; + } + $forumSel .= ">"._ALL."</option>"; + $forumSel .= newbb_forumSelectBox($forum_id, "access", false); //$access_forums, $permission = "access", $delimitor_category = true + $forumSel .= "</select>"; + $forumEle = new XoopsFormLabel(_MD_SELFORUM, $forumSel); + $forumEle->customValidationCode[]="if (document.suspend.forum.value < 0) {return false;} "; + $forum_form->addElement($forumEle); +} else { + $forum_form->addElement(new XoopsFormHidden('forum', $forum_id)); +} +// END irmtfan add forum select box for admins $forum_form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, "submit")); $forum_form->display(); include XOOPS_ROOT_PATH.'/footer.php'; Modified: XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php =================================================================== --- XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2013-04-16 15:22:50 UTC (rev 11388) +++ XoopsModules/newbb/branches/irmtfan/newbb/viewtopic.php 2013-04-17 01:49:19 UTC (rev 11389) @@ -642,9 +642,14 @@ $xoopsTpl->assign('menumode',$menumode); $xoopsTpl->assign('menumode_other',$menumode_other); +// START irmtfan add verifyUser to quick reply +//check banning +$moderate_handler =& xoops_getmodulehandler('moderate', 'newbb'); if ( !empty($xoopsModuleConfig['quickreply_enabled']) && $topic_handler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), "reply") + && !$moderate_handler->verifyUser(-1, "",$forum_obj->getVar('forum_id')) ) { +// END irmtfan add verifyUser to quick reply $forum_form = new XoopsThemeForm(_MD_POSTREPLY, 'quick_reply', XOOPS_URL."/modules/".$xoopsModule->getVar("dirname", "n")."/post.php", 'post', true); if (!is_object($xoopsUser)) { //$config_handler =& xoops_gethandler('config'); |