<?php
/**
* Forum Age 1.0
* © 2011 lorataco
* http://lorataco.es
*/
if(!defined("IN_MYBB"))
{
die("You Cannot Access This File Directly");
}
$plugins->add_hook("global_start","Global_ini");
$plugins->add_hook("admin_style_templates_start","Foro");
function forum_age_info()
{
return array(
"name" => "Forum Age",
"description"=> "Muestra el tiempo desde que se creo tu foro",
"website" => "http://mybb-es.com",
"author" => "Lorataco",
"authorsite" => "http://lorataco.es",
"version" => "1.0",
"guid" => "",
"compatibility" => "*"
);
}
function forum_age_activate()
{
global $db;
$forum_age_group = array(
'gid' => 'NULL',
'name' => 'forum_age',
'title' => 'Forum Age',
'description' => 'Configuracion para forum age',
'disporder' => "1",
'isdefault' => 'no',
);
$db->insert_query('settinggroups', $forum_age_group);
$gid = $db->insert_id();
$forum_age_setting = array(
'sid' => 'NULL',
'name' => 'enabled_forum_age',
'title' => 'Forum age esta activo',
'description' => 'Elige si se ve el tiempo de tu foro o no',
'optionscode' => 'yesno',
'value' => '1',
'disporder' => 1,
'gid' => intval($gid),
);
$db->insert_query('settings', $forum_age_setting);
rebuild_settings();
}
function forum_age_deactivate()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('enabled_forum_age')");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='forum_age'");
rebuild_settings();
}
function Global_ini($page){
global $mybb;
find_replace_global('global', '$timenow = my_date($mybb->settings[\'timeformat\'], TIME_NOW);', '$age_query = $db->query("SELECT * FROM ".TABLE_PREFIX."users LIMIT 1");
$age_result = $db->fetch_array($age_query);
$age = time() - $age_result[\'regdate\'];
$forumage = nice_time($age);
');
function Foro(){
global $mybb;
find_add_templatesets('index', '<br />Foro creado: {$forumage} ');
}
}
?>