didiflo
03-03-2007, 2:01
Citation :<?phpbonjour a tous voila mon souci je voudrais que les membre soit tout le temps rediriger vers le portail de mon forum
// Portal Redirect Plugin
// By DennisTT
// Version 1.0.3
// This plugin © DennisTT 2006. You may not redistribute this plugin without the permission from DennisTT.
// Tell MyBB when to run the hooks
// $plugins->add_hook("hook name", "function name");
$plugins->add_hook("portal_start", "portalredirect_portalrun");
$plugins->add_hook("index_start", "portalredirect_indexrun");
// The information that shows up on the plugin manager
// Note that the name of the function before _info, _activate, _deactivate must be the same as the filename before the extension.
function portalredirect_info()
{
return array(
"name" => "Portal Redirect",
"description" => "Redirects users from the index page to the portal when they arrive each day. For MyBB 1.2.x",
"website" => "http://www.dennistt.net",
"author" => "DennisTT",
"authorsite" => "http://www.dennistt.net",
"version" => "1.0.3",
);
}
// This function runs when the plugin is activated.
function portalredirect_activate()
{
global $db;
$info = portalredirect_info();
$setting_group_array = array(
'name' => str_replace(' ', '_', 'dennistt_'.strtolower($info['name'])),
'title' => "$info[name] (DennisTT)",
'description' => "Settings for the $info[name] plugin",
'disporder' => 1,
'isdefault' => 'no',
);
$db->insert_query(TABLE_PREFIX.'settinggroups', $setting_group_array);
$group = $db->insert_id();
$db->query("INSERT INTO ".TABLE_PREFIX."settings (name,title,description,optionscode,value,gid,disporder) VALUES ('portalredirect_url', 'Portal URL', 'The URL of your portal', 'text', 'portal.php', $group, 1)");
rebuildsettings();
}
// This function runs when the plugin is deactivated.
function portalredirect_deactivate()
{
global $db;
$info = portalredirect_info();
$result = $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups WHERE name = '$info[name] (DennisTT)' LIMIT 1");
$group = $db->fetch_array($result);
if(!empty($group['gid']))
{
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE gid = $group[gid] LIMIT 1");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE gid = $group[gid]");
rebuildsettings();
}
}
// This is the function that is run when the hook is called.
// It must match the function name you placed when you called add_hook.
// You are not just limited to 1 hook per page. You can add as many as you want.
function portalredirect_indexrun()
{
global $mybb;
if ((!isset($_COOKIE['viewedportal']) && !isset($mybb->input['noredirect'])) || isset($mybb->input['forceredirect'])) {
header('Location: '.$mybb->settings['portalredirect_url']);
}
}
function portalredirect_portalrun()
{
global $mybb;
if($mybb->settings['cookiedomain'])
{
@setcookie('viewedportal', true, (time() + (60*60*18)), $mybb->settings['cookiepath'], $mybb->settings['cookiedomain']);
}
else
{
@setcookie('viewedportal', true, (time() + (60*60*18)), $mybb->settings['cookiepath']);
}
}
// End of Plugin
?>
que doit je enveler pour sa ou changer merci de votre aide