Beispiel #1
0
function xoops_module_update_newbb(&$module, $oldversion = null)
{
    require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.config.php";
    $newbbConfig = newbb_loadConfig();
    // NewBB 1.0
    if ($oldversion == 100) {
        include_once dirname(__FILE__) . "/module.v100.php";
        xoops_module_update_newbb_v100($module);
    }
    // NewBB 2.* and CBB 1.*
    // change group permission name
    // change forum moderators
    if ($oldversion < 220) {
        include_once dirname(__FILE__) . "/module.v220.php";
        xoops_module_update_newbb_v220($module);
    }
    if ($oldversion < 230) {
        $GLOBALS['xoopsDB']->queryFromFile(XOOPS_ROOT_PATH . "/modules/" . $module->getVar("dirname", "n") . "/sql/upgrade_230.sql");
    }
    if ($oldversion < 304) {
        $GLOBALS['xoopsDB']->queryFromFile(XOOPS_ROOT_PATH . "/modules/" . $module->getVar("dirname", "n") . "/sql/mysql.304.sql");
    }
    if ($oldversion < 400) {
        $GLOBALS['xoopsDB']->queryFromFile(XOOPS_ROOT_PATH . "/modules/" . $module->getVar("dirname", "n") . "/sql/mysql.400.sql");
        include dirname(__FILE__) . "/module.v400.php";
        xoops_module_update_newbb_v400($module);
    }
    if (!empty($newbbConfig["syncOnUpdate"])) {
        require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.recon.php";
        newbb_synchronization();
    }
    return true;
}
Beispiel #2
0
function xoops_module_update_newbb(&$module, $oldversion = null)
{
    load_functions("config");
    mod_clearConfg($module->getVar("dirname", "n"));
    $newbbConfig = newbb_load_config();
    //$oldversion = $module->getVar('version');
    //$oldconfig = $module->getVar('hasconfig');
    // NewBB 1.0 -- no config
    //if (empty($oldconfig)) {
    if ($oldversion == 100) {
        include_once dirname(__FILE__) . "/module.v100.php";
        xoops_module_update_newbb_v100($module);
    }
    // NewBB 2.* and CBB 1.*
    // change group permission name
    // change forum moderators
    if ($oldversion < 220) {
        include_once dirname(__FILE__) . "/module.v220.php";
        xoops_module_update_newbb_v220($module);
    }
    if ($oldversion < 230) {
        $GLOBALS['xoopsDB']->queryFromFile(XOOPS_ROOT_PATH . "/modules/" . $module->getVar("dirname", "n") . "/sql/upgrade_230.sql");
        //$module->setErrors("bb_moderates table inserted");
    }
    if ($oldversion < 304) {
        $GLOBALS['xoopsDB']->queryFromFile(XOOPS_ROOT_PATH . "/modules/" . $module->getVar("dirname", "n") . "/sql/mysql.304.sql");
    }
    if ($oldversion < 400) {
        $GLOBALS['xoopsDB']->queryFromFile(XOOPS_ROOT_PATH . "/modules/" . $module->getVar("dirname", "n") . "/sql/mysql.400.sql");
        include dirname(__FILE__) . "/module.v400.php";
        xoops_module_update_newbb_v400($module);
    }
    if ($oldversion < 403) {
        $sql = "\tALTER TABLE " . $GLOBALS['xoopsDB']->prefix("bb_posts") . " CHANGE `poster_ip` `poster_ipd` varchar(15) NOT NULL default '0.0.0.0'";
        $GLOBALS['xoopsDB']->queryF($sql);
    }
    if (!empty($newbbConfig["syncOnUpdate"])) {
        mod_loadFunctions("recon", "newbb");
        newbb_synchronization();
    }
    return true;
}
                list($posts) = $xoopsDB->fetchRow($result);
                $xoopsDB->queryF("\tINSERT INTO {$stats_handler->table}" . "\t\t(`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) " . "\tVALUES " . "\t\t('{$forum_id}', '{$posts}', '" . array_search("post", $stats_handler->param["type"]) . "', '" . array_search($period, $stats_handler->param["period"]) . "', NOW(), '{$format}')");
                @($counts["post"][$period] += $posts);
            }
        }
        $xoopsDB->queryF("\tDELETE FROM {$stats_handler->table}" . "\tWHERE stats_id = '0' AND stats_period <> " . array_search("total", $stats_handler->param["period"]));
        foreach ($time_start as $period => $format) {
            foreach (array_keys($counts) as $type) {
                $xoopsDB->queryF("\tINSERT INTO {$stats_handler->table}" . "\t\t(`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) " . "\tVALUES " . "\t\t('0', '{$counts[$type][$period]}', '" . array_search($type, $stats_handler->param["type"]) . "', '" . array_search($period, $stats_handler->param["period"]) . "', NOW(), '{$format}')");
            }
        }
        break;
    case "misc":
    default:
        mod_loadFunctions("recon", "newbb");
        newbb_synchronization();
        break;
}
$form = '<fieldset><legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_SYNCFORUM . '</legend>';
$form .= '<form action="admin_synchronization.php" method="get">';
$form .= '<div style="padding: 10px 2px;">';
$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_FORUM . '</h2>';
$form .= '<input type="hidden" name="type" value="forum">';
$form .= _AM_NEWBB_SYNC_ITEMS . '<input type="text" name="limit" value="20">';
$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />';
$form .= '</div>';
$form .= '</form>';
$form .= '<form action="admin_synchronization.php" method="get">';
$form .= '<div style="padding: 10px 2px;">';
$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_TOPIC . '</h2>';
$form .= '<input type="hidden" name="type" value="topic">';