(27 Aug, 2009, 5:32 am)Aeroxis escribió: Esto no es el Ficons, de Labrocca?
http://www.mybb-es.com/showthread.php?tid=258
<?php
/**
* PL9 Forum Icons 1.1
*
* Copyright © 2009 Project Level 9, All Rights Reserved
*
* Website: http://www.projectlevel9.com
* Forum: http://forums.projectlevel9.com
* PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2008 - 2009
*/
if(!defined("IN_MYBB"))
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
// BEGIN PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2009
if(!defined('IN_ADMINCP'))
{
// gain control of $templates object
eval('
class phptpl_templates extends '.get_class($GLOBALS['templates']).'
{
function phptpl_templates(&$oldtpl)
{
$vars = get_object_vars($oldtpl);
foreach($vars as $var => $val)
$this->$var = $val;
$this->def_htmlcomments = $GLOBALS[\'mybb\']->settings[\'tplhtmlcomments\'];
$this->def_htmlcomments = (($this->def_htmlcomments == \'yes\' || $this->def_htmlcomments == 1) ? 1:0);
}
function get($title, $eslashes=1, $htmlcomments=1)
{
if($eslashes && $this->def_htmlcomments == $htmlcomments)
{
if(!isset($this->parsed_cache[$title]))
{
$this->parsed_cache[$title] = parent::get($title, $eslashes, $htmlcomments);
// parse the template
phptpl_parsetpl($this->parsed_cache[$title]);
}
return $this->parsed_cache[$title];
}
else
return parent::get($title, $eslashes, $htmlcomments);
}
}
');
$GLOBALS['templates'] = new phptpl_templates($GLOBALS['templates']);
}
// END PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2009
function pl9forumicons_info()
{
global $lang;
$lang->load("forum_pl9forumicons");
return array(
"name" => $lang->pl9_forum_icons,
"description" => $lang->pl9_forum_icons_desc,
"website" => "http://forums.projectlevel9.com",
"author" => "Steve Moore",
"authorsite" => "http://www.projectlevel9.com",
"version" => "1.1",
"guid" => "33a4ae3af077c412cb29c9bb578c826d",
"compatibility" => "1410"
);
}
// BEGIN PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2009
function phptpl_parsetpl(&$ourtpl)
{
$ourtpl = preg_replace(array(
'#\<\?.+?(\?\>)#se', // '#\<\?.*?(\?\>|$)#se',
'#\<if (.*?) then\>#sie',
'#\<elseif (.*?) then\>#sie',
'#\<else( /)?\>#i',
'#\</if\>#i',
'#\<func (htmlspecialchars|htmlspecialchars_uni|intval|file_get_contents|floatval|urlencode|rawurlencode|addslashes|stripslashes|trim|crc32|ltrim|rtrim|md5|nl2br|sha1|strrev|strtoupper|strtolower|my_strtoupper|my_strtolower|alt_trow|get_friendly_size|filesize|strlen|my_strlen|my_wordwrap|random_str|unicode_chr)\>#i',
'#\</func\>#i'
), array(
'phptpl_evalphp(\'$0\', \'$1\')',
'\'".phptpl_iif(\'.phptpl_unescape_string(\'$1\').\',"\'',
'\'",\'.phptpl_unescape_string(\'$1\').\',"\'',
'","',
'")."',
'".$1("',
'")."'
), $ourtpl);
}
function phptpl_unescape_string($str)
{
return strtr($str, array('\\\\"' => '"', '\\\\' => '\\'));
}
function phptpl_evalphp($str, $end)
{
return '".eval(\'ob_start(); ?>'
.strtr(phptpl_unescape_string($str), array('\'' => '\\\'', '\\' => '\\\\'))
.($end?'':'?>').'<?php return ob_get_clean();\')."';
}
function phptpl_iif($condition, $true)
{
$args = func_get_args();
for($i=1, $c=count($args); $i<$c; $i+=2)
if($args[$i-1]) return $args[$i];
return (isset($args[$i-1]) ? $args[$i-1] : '');
}
// END PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2009
function pl9forumicons_install()
{
global $mybb, $db;
$db->write_query("ALTER TABLE `". TABLE_PREFIX . "forums` ADD `forum_icon` VARCHAR( 155 ) NOT NULL");
global $db, $mybb;
$group = array(
"gid" => "NULL",
"title" => "PL9 Forum Icons",
"name" => "pl9forumicons",
"description" => "Settings for PL9 Forum Icons.",
"disporder" => "1",
"isdefault" => "no",
);
$db->insert_query("settinggroups", $group);
$gid = $db->insert_id(); //This will get the id of the just added record in the db
$setting_1 = array(
"sid" => "NULL",
"name" => "enable_pl9ForumIcons",
"title" => "Enable PL9 Forum Icons",
"description" => "Enable/Disable PL9 Forum Icons?",
"optionscode" => "yesno",
"value" => 'yes',
"disporder" => '1',
"gid" => intval($gid),
);
$db->insert_query("settings", $setting_1);
rebuild_settings();
}
function pl9forumicons_is_installed()
{
global $mybb, $db;
return $db->field_exists("forum_icon", "forums");
}
function pl9forumicons_uninstall()
{
global $db, $mybb;
$db->write_query("ALTER TABLE `". TABLE_PREFIX . "forums` DROP `forum_icon`");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='enable_pl9ForumIcons'");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='pl9forumicons'");
rebuild_settings();
}
//All the activation processes go here
function pl9forumicons_activate()
{
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets("forumbit_depth2_forum", '#'.preg_quote('<img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" />').'#' , '<if $mybb->settings[\'enable_pl9ForumIcons\'] then><if $forum[\'forum_icon\'] then><img src="{$forum[\'forum_icon\']}" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /><else /><img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /></if><else /><img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /></if>');
}
//All deactivation processes go here
function pl9forumicons_deactivate()
{
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets("forumbit_depth2_forum", '#'.preg_quote('<if $mybb->settings[\'enable_pl9ForumIcons\'] then><if $forum[\'forum_icon\'] then><img src="{$forum[\'forum_icon\']}" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /><else /><img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /></if><else /><img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /></if>').'#s' , '<img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" />',0);
}
?>
<?php
/**
* PL9 Forum Icons 1.1
*
* Copyright © 2009 Project Level 9, All Rights Reserved
*
* Website: http://www.projectlevel9.com
* Forum: http://forums.projectlevel9.com
* PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2008 - 2009
*/
if(!defined("IN_MYBB"))
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
// BEGIN PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2009
if(!defined('IN_ADMINCP'))
{
// gain control of $templates object
eval('
class phptpl_templates extends '.get_class($GLOBALS['templates']).'
{
function phptpl_templates(&$oldtpl)
{
$vars = get_object_vars($oldtpl);
foreach($vars as $var => $val)
$this->$var = $val;
$this->def_htmlcomments = $GLOBALS[\'mybb\']->settings[\'tplhtmlcomments\'];
$this->def_htmlcomments = (($this->def_htmlcomments == \'yes\' || $this->def_htmlcomments == 1) ? 1:0);
}
function get($title, $eslashes=1, $htmlcomments=1)
{
if($eslashes && $this->def_htmlcomments == $htmlcomments)
{
if(!isset($this->parsed_cache[$title]))
{
$this->parsed_cache[$title] = parent::get($title, $eslashes, $htmlcomments);
// parse the template
phptpl_parsetpl($this->parsed_cache[$title]);
}
return $this->parsed_cache[$title];
}
else
return parent::get($title, $eslashes, $htmlcomments);
}
}
');
$GLOBALS['templates'] = new phptpl_templates($GLOBALS['templates']);
}
// END PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2009
function pl9forumicons_info()
{
global $lang;
$lang->load("forum_pl9forumicons");
return array(
"name" => $lang->pl9_forum_icons,
"description" => $lang->pl9_forum_icons_desc,
"website" => "http://forums.projectlevel9.com",
"author" => "Steve Moore",
"authorsite" => "http://www.projectlevel9.com",
"version" => "1.1",
"guid" => "33a4ae3af077c412cb29c9bb578c826d",
"compatibility" => "14*"
);
}
// BEGIN PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2009
function phptpl_parsetpl(&$ourtpl)
{
$ourtpl = preg_replace(array(
'#\<\?.+?(\?\>)#se', // '#\<\?.*?(\?\>|$)#se',
'#\<if (.*?) then\>#sie',
'#\<elseif (.*?) then\>#sie',
'#\<else( /)?\>#i',
'#\</if\>#i',
'#\<func (htmlspecialchars|htmlspecialchars_uni|intval|file_get_contents|floatval|urlencode|rawurlencode|addslashes|stripslashes|trim|crc32|ltrim|rtrim|md5|nl2br|sha1|strrev|strtoupper|strtolower|my_strtoupper|my_strtolower|alt_trow|get_friendly_size|filesize|strlen|my_strlen|my_wordwrap|random_str|unicode_chr)\>#i',
'#\</func\>#i'
), array(
'phptpl_evalphp(\'$0\', \'$1\')',
'\'".phptpl_iif(\'.phptpl_unescape_string(\'$1\').\',"\'',
'\'",\'.phptpl_unescape_string(\'$1\').\',"\'',
'","',
'")."',
'".$1("',
'")."'
), $ourtpl);
}
function phptpl_unescape_string($str)
{
return strtr($str, array('\\\\"' => '"', '\\\\' => '\\'));
}
function phptpl_evalphp($str, $end)
{
return '".eval(\'ob_start(); ?>'
.strtr(phptpl_unescape_string($str), array('\'' => '\\\'', '\\' => '\\\\'))
.($end?'':'?>').'<?php return ob_get_clean();\')."';
}
function phptpl_iif($condition, $true)
{
$args = func_get_args();
for($i=1, $c=count($args); $i<$c; $i+=2)
if($args[$i-1]) return $args[$i];
return (isset($args[$i-1]) ? $args[$i-1] : '');
}
// END PHPTPL PROVIDED BY YUMI OF MYBBOARD.NET COPYRIGHT YUMI 2009
function pl9forumicons_install()
{
global $mybb, $db;
$db->write_query("ALTER TABLE `". TABLE_PREFIX . "forums` ADD `forum_icon` VARCHAR( 155 ) NOT NULL");
global $db, $mybb;
$group = array(
"gid" => "NULL",
"title" => "PL9 Forum Icons",
"name" => "pl9forumicons",
"description" => "Settings for PL9 Forum Icons.",
"disporder" => "1",
"isdefault" => "no",
);
$db->insert_query("settinggroups", $group);
$gid = $db->insert_id(); //This will get the id of the just added record in the db
$setting_1 = array(
"sid" => "NULL",
"name" => "enable_pl9ForumIcons",
"title" => "Enable PL9 Forum Icons",
"description" => "Enable/Disable PL9 Forum Icons?",
"optionscode" => "yesno",
"value" => 'yes',
"disporder" => '1',
"gid" => intval($gid),
);
$db->insert_query("settings", $setting_1);
rebuild_settings();
}
function pl9forumicons_is_installed()
{
global $mybb, $db;
return $db->field_exists("forum_icon", "forums");
}
function pl9forumicons_uninstall()
{
global $db, $mybb;
$db->write_query("ALTER TABLE `". TABLE_PREFIX . "forums` DROP `forum_icon`");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='enable_pl9ForumIcons'");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='pl9forumicons'");
rebuild_settings();
}
//All the activation processes go here
function pl9forumicons_activate()
{
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets("forumbit_depth2_forum", '#'.preg_quote('<img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" />').'#' , '<if $mybb->settings[\'enable_pl9ForumIcons\'] then><if $forum[\'forum_icon\'] then><img src="{$forum[\'forum_icon\']}" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /><else /><img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /></if><else /><img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /></if>');
}
//All deactivation processes go here
function pl9forumicons_deactivate()
{
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets("forumbit_depth2_forum", '#'.preg_quote('<if $mybb->settings[\'enable_pl9ForumIcons\'] then><if $forum[\'forum_icon\'] then><img src="{$forum[\'forum_icon\']}" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /><else /><img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /></if><else /><img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" /></if>').'#s' , '<img src="{$theme[\'imgdir\']}/{$lightbulb[\'folder\']}.gif" alt="{$lightbulb[\'altonoff\']}" title="{$lightbulb[\'altonoff\']}" class="ajax_mark_read" id="mark_read_{$forum[\'fid\']}" />',0);
}
?>