Ejemplo n.º 1
0
function xoops_module_update_xforum(&$module, $oldversion = null) 
{
	$xforumConfig = forum_load_config();
	
    //$oldversion = $module->getVar('version');
    //$oldconfig = $module->getVar('hasconfig');
    // xforum 1.0 -- no config
    //if (empty($oldconfig)) {
    if ($oldversion == 100) {
	    include_once dirname(__FILE__)."/module.v100.php";
	    xoops_module_update_XFORUM_v100($module);
    }
    
    // xforum 2.* and X-Forum 1.*
    // change group permission name
    // change forum moderators
    if ($oldversion < 220) {
	    include_once dirname(__FILE__)."/module.v220.php";
	    xoops_module_update_XFORUM_v220($module);
    }
    
    if ($oldversion < 230) {
        $GLOBALS['xoopsDB']->queryFromFile(XOOPS_ROOT_PATH."/modules/xforum/sql/upgrade_230.sql");
		//$module->setErrors("xf_moderates table inserted");
    }

    if ($oldversion < 304) {
        $GLOBALS['xoopsDB']->queryFromFile(XOOPS_ROOT_PATH."/modules/xforum/sql/mysql.304.sql");
    }
    
	if ($oldversion < 411) {
        $GLOBALS['xoopsDB']->queryF("ALTER TABLE " . $GLOBALS['xoopsDB']->prefix('xf_posts') . " ADD COLUMN (`tags` VARCHAR(255) DEFAULT '')");
    }
	
	if(!empty($xforumConfig["syncOnUpdate"])){
		forum_synchronization();
	}
	
	return true;
}
Ejemplo n.º 2
0
function forum_synchronization($type = "")
{
	switch($type){
	case "rate":
	case "report":
	case "post":
	case "topic":
	case "forum":
	case "category":
	case "moderate":
	case "read":
		$type = array($type);
		$clean = $type;
		break;
	default:
		$type = null;
		$clean = array("category", "forum", "topic", "post", "report", "rate", "moderate", "readtopic", "readforum");
		break;
	}
	foreach($clean as $item){
		$handler =& xoops_getmodulehandler($item, "xforum");
		$handler->cleanOrphan();
		unset($handler);
	}
    $xforumConfig = forum_load_config();
	if(empty($type) || in_array("post", $type)):
		$post_handler =& xoops_getmodulehandler("post", "xforum");
        $expires = isset($xforumConfig["pending_expire"])?intval($xforumConfig["pending_expire"]):7;
		$post_handler->cleanExpires($expires*24*3600);
	endif;
	if(empty($type) || in_array("topic", $type)):
		$topic_handler =& xoops_getmodulehandler("topic", "xforum");
        $expires = isset($xforumConfig["pending_expire"])?intval($xforumConfig["pending_expire"]):7;
		$topic_handler->cleanExpires($expires*24*3600);
		$topic_handler->synchronization();
	endif;
	if(empty($type) || in_array("forum", $type)):
		$forum_handler =& xoops_getmodulehandler("forum", "xforum");
		$forum_handler->synchronization();
	endif;
	if(empty($type) || in_array("moderate", $type)):
		$moderate_handler =& xoops_getmodulehandler("moderate", "xforum");
		$moderate_handler->clearGarbage();
	endif;
	if(empty($type) || in_array("read", $type)):
		$read_handler =& xoops_getmodulehandler("readforum", "xforum");
		$read_handler->clearGarbage();
		$read_handler->synchronization();
		$read_handler =& xoops_getmodulehandler("readtopic", "xforum");
		$read_handler->clearGarbage();
		$read_handler->synchronization();
	endif;
	return true;
}
Ejemplo n.º 3
0
    function xforumReadHandler(&$db, $type) {
	    $type = ("forum" == $type) ? "forum" : "topic";
        $this->ArtObjectHandler($db, 'xf_reads_'.$type, 'Read'.$type, 'read_id', 'post_id');
        $this->type = $type;
	    $xforumConfig = forum_load_config();
        $this->lifetime = !empty($xforumConfig["read_expire"]) ? $xforumConfig["read_expire"] *24*3600 : 30*24*3600;
        $this->mode = isset($xforumConfig["read_mode"]) ? $xforumConfig["read_mode"] : 2;
    }
Ejemplo n.º 4
0
    function xforumReadtopicHandler(&$db) {
        $this->xforumReadHandler($db, "topic");
	    $xforumConfig = forum_load_config();
        $this->items_per_forum = isset($xforumConfig["read_items"])?intval($xforumConfig["read_items"]):100;
    }
Ejemplo n.º 5
0
$last_visit = ($last_visit)?$last_visit:time();


// update LastVisit cookie.
forum_setcookie("LV", time(), $forumCookie['expire']); // set cookie life time to one month
//forum_setcookie("LVT", $last_visit);
forum_setsession("LV", $last_visit);

/* xforum cookie storage
	Long term cookie: (configurable, generally one month)
		LV - Last Visit
		M - Menu mode
		V - View mode
		G - Toggle
	Short term cookie: (same as session life time)
		ST - Stored Topic IDs for mark
		LP - Last Post
		LF - Forum Last view
		LT - Topic Last read
		LVT - Last Visit Temp
*/

// include customized variables
if( is_object($GLOBALS["xoopsModule"]) && "xforum" == $GLOBALS["xoopsModule"]->getVar("dirname", "n") ) {
	$GLOBALS["xoopsModuleConfig"] = forum_load_config();
}

forum_load_object();

error_reporting($ori_error_level);
?>
Ejemplo n.º 6
0
function getConfigForBlock()
{
	return forum_load_config();
	
	static $xforumConfig;
	if(isset($xforumConfig)){
		return $xforumConfig;
	}
	
    if(is_object($GLOBALS["xoopsModule"]) && $GLOBALS["xoopsModule"]->getVar("dirname") == "xforum"){
	    $xforumConfig =& $GLOBALS["xoopsModuleConfig"];
    }else{
		$module_handler =& xoops_gethandler('module');
		$xforum = $module_handler->getByDirname('xforum');
	
	    $config_handler =& xoops_gethandler('config');
	    $criteria = new CriteriaCompo(new Criteria('conf_modid', $xforum->getVar('mid')));
	    $criteria->add(new Criteria('conf_name', "('show_realname', 'subject_prefix', 'allow_require_reply')", "IN"));
	    $configs =& $config_handler->getConfigs($criteria);
	    foreach(array_keys($configs) as $i){
		    $xforumConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
	    }
	    unset($xforum, $configs);
    }
    return $xforumConfig;
}