1
wishcraft
Tag 2.30 RC - X-Forum Plugin

This is a plugin for the popular x-forum application for xoops.

<?php
/*
 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.
*/

/**
 * XOOPS tag management module
 *
 * @copyright       The XOOPS project http://sourceforge.net/projects/xoops/
 * @license         http://www.fsf.org/copyleft/gpl.html& ...  public license
 * @since           1.0.0
 * @author          Taiwen Jiang <phppp@users.sourceforge.net>
 * @version         $Id: xforum.php 2292 2008-10-12 04:53:18Z phppp $
 * @package         tag
 */
if (!defined('XOOPS_ROOT_PATH')) { exit(); }

/**
 * Get item fields:
 * title
 * content
 * time
 * link
 * uid
 * uname
 * tags
 *
 * @var        array    $items    associative array of items: [modid][catid][itemid]
 *
 * @return    boolean
 * 
 */
function xforum_tag_iteminfo(&$items)
{
    if (empty(
$items) || !is_array($items)) {
        return 
false;
    }
    
    
$items_id = array();
    foreach (
array_keys($items) as $cat_id) {
        
// Some handling here to build the link upon catid
        // catid is not used in xforum, so just skip it
        
foreach (array_keys($items[$cat_id]) as $item_id) {
            
// In xforum, the item_id is "topic_id"
            
$items_id[] = intval($item_id);
        }
    }
    
$item_handler =& xoops_getmodulehandler('post''xforum');
    
$items_obj $item_handler->getObjects(new Criteria("post_id""(" implode(", "$items_id) . ")""IN"), true);
    
$myts =& MyTextSanitizer::getInstance();
    foreach (
array_keys($items) as $cat_id) {
        foreach (
array_keys($items[$cat_id]) as $item_id) {
            
$item_obj =& $items_obj[$item_id];
            if (
is_object($item_obj))
            
$items[$cat_id][$item_id] = array(
                
"title"     => $item_obj->getVar("subject"),
                
"uid"       => $item_obj->getVar("uid"),
                
"link"      => 'viewtopic.php?post_id='.$item_obj->getVar("post_id").'&topic_id='.$item_obj->getVar("topic_id").'#forumpost'.$item_obj->getVar("post_id"),
                
"time"      => strtotime(date(_DATESTRING,$item_obj->getVar("post_time"))),
                
"tags"      => tag_parse_tag($item_obj->getVar("tags""n")),
                
"content"   => $myts->displayTarea($item_obj->getVar("post_text"),true,true,true,true,true,true)
                );
        }
    }
    unset(
$items_obj);    
}

/**
 * Remove orphan tag-item links
 *
 * @return    boolean
 * 
 */
function xforum_tag_synchronization($mid)
{
    
$item_handler =& xoops_getmodulehandler("post""xforum");
    
$link_handler =& xoops_getmodulehandler("link""tag");
        
    
/* clear tag-item links */
    
if (version_comparemysql_get_server_info(), "4.1.0""ge" )):
    
$sql =  "    DELETE FROM {$link_handler->table}.
            
"    WHERE " .
            
"        tag_modid = {$mid}.
            
"        AND " .
            
"        ( tag_itemid NOT IN " .
            
"            ( SELECT DISTINCT {$item_handler->keyName} " .
            
"                FROM {$item_handler->table} " .
            
"                WHERE {$item_handler->table}.approved > 0" .
            
"            ) " .
            
"        )";
    else:
    
$sql =  "    DELETE {$link_handler->table} FROM {$link_handler->table}.
            
"    LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " .
            
"    WHERE " .
            
"        tag_modid = {$mid}.
            
"        AND " .
            
"        ( aa.{$item_handler->keyName} IS NULL" .
            
"            OR aa.approved < 1" .
            
"        )";
    endif;
    if (!
$result $link_handler->db->queryF($sql)) {
        
//xoops_error($link_handler->db->error());
    
}
}
?>

2
chefry
Re: Tag 2.30 RC - X-Forum Plugin
  • 2010/1/12 3:00

  • chefry

  • Home away from home

  • Posts: 1005

  • Since: 2006/10/14


where can you download this for x-torrent?

3
Wondergnome
Re: Tag 2.30 RC - X-Forum Plugin

I'm stuck here - sorry for being such an idiot. Where does this script go?

4
ghia
Re: Tag 2.30 RC - X-Forum Plugin
  • 2010/1/13 2:25

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


/modules/X-Forum/include/plugin.tag.php
(not sure for the correct module directory name)

5
Wondergnome
Re: Tag 2.30 RC - X-Forum Plugin

Will try - thanks very much

6
Wondergnome
Re: Tag 2.30 RC - X-Forum Plugin

no joy I have uploaded the script, and refreshed the tag and x-forum modules, but I can't see the x-forum module from the tag module. Has anyone got this working?

7
chefry
Re: Tag 2.30 RC - X-Forum Plugin
  • 2010/1/13 12:56

  • chefry

  • Home away from home

  • Posts: 1005

  • Since: 2006/10/14


Where is the XOOPS Tags module (2.3 RC)???

it is NOT in the module repository or in wishcrafts website and some of his modules need it to work

8
Wondergnome
Re: Tag 2.30 RC - X-Forum Plugin

This is the download

hope that helps

9
chefry
Re: Tag 2.30 RC - X-Forum Plugin
  • 2010/1/13 13:02

  • chefry

  • Home away from home

  • Posts: 1005

  • Since: 2006/10/14


Ridiculous!

You can't find it searching the site. But the first hit on google is a link to this site

https://xoops.org/modules/news/article.php?storyid=4477

with the download link

10
chefry
Re: Tag 2.30 RC - X-Forum Plugin
  • 2010/1/13 13:08

  • chefry

  • Home away from home

  • Posts: 1005

  • Since: 2006/10/14


And after all that...

it doesn't work on 2.4.3

Login

Username:
Password:

Lost Password? Register now!

Who's Online

70 user(s) are online (36 user(s) are browsing Support Forums)


Members: 1


Guests: 69


heyula,

more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jan 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits