MyBB Community Forums

Full Version: Hide link until post removing white box help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i cant remove this white box in this picture. i have try to change/remove/delete.. color help please
Image:

http://i44.tinypic.com/25upuhg.png

Website:
Impossible to show you the website


The plugin html page:

Quote:<?php
/*
* Author: Dark Neo
* Copyright: © 2011 Soportemybb
* Website: http://www.soportemybb.com
* Version: 1.7
* MyBB: 1.6.x
*/

if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Llamamos a los enganches necesarios para el plugin
$plugins->add_hook("postbit", "hideip_clear");
$plugins->add_hook("postbit_prev", "hideip_clear");
$plugins->add_hook("postbit_pm", "hideip_clear");
$plugins->add_hook("postbit_announcement", "hideip_clear");
$plugins->add_hook("parse_message", "hideip_code");
$plugins->add_hook("newreply_do_newreply_end", "hideip_code_ajax");
$plugins->add_hook("parse_quoted_message", "hideip_quote");

// Informacion del Plugin
function hideip_info()
{

global $mybb, $db, $lang;

$lang->load("hideip");
$hideip_settings_link = '';

$query = $db->simple_select('settinggroups', '*', "name='hideip_settings'");

if (count($db->fetch_array($query)))
{
$hideip_settings_link = '(<a href="index.php?module=config&action=change&search=hideip_settings" style="color:#0000;">'.$lang->hideip_configure.'</a>)';
}

return array(
"name" => $db->escape_string($lang->hideip_name),
"title" => $db->escape_string($lang->hideip_title),
"description" => $db->escape_string($lang->hideip_descrip) . " " . $hideip_settings_link,
"website" => "http://www.soportemybb.com",
"author" => "Dark Neo",
"authorsite" => "http://darkneo.xunem.com",
"version" => "1.7",
"guid" => "2a556973bb6272ee420110b64573f58c",
"compatibility" => "16*"
);
}

// Cuando damos clic en instalar, para crear el grupo de opciones y las plantillas para el uso del plugin
function hideip_install()
{
// Creando las opciones del plugin
global $db, $lang, $cache;

$lang->load("hideip");

$group = array(
"name" => "hideip_settings",
"title" => $db->escape_string($lang->hideip_settings_title),
"description" => $db->escape_string($lang->hideip_settings_descrip),
"disporder" => "50",
"isdefault" => "no",
);

$db->insert_query("settinggroups", $group);
$gid = intval($db->insert_id());
$settings = array(

array(
"name" => "hideip_enabled",
"title" => $db->escape_string($lang->hideip_power),
"description" => $db->escape_string($lang->hideip_power_descrip . $settings_link),
"optionscode" => "yesno",
"value" => "yes",
"disporder" => 1,
"gid" => $gid,
),
array(
"name" => "hideip_link_enabled",
"title" => $db->escape_string($lang->hideip_links),
"description" => $db->escape_string($lang->hideip_links_descrip),
"optionscode" => "yesno",
"value" => "yes",
"disporder" => 2,
"gid" => $gid,
),
array(
"name" => "hideip_hide_enabled",
"title" => $db->escape_string($lang->hideip_hide),
"description" => $db->escape_string($lang->hideip_hide_descrip),
"optionscode" => "yesno",
"value" => "yes",
"disporder" => 3,
"gid" => $gid,
),
array(
"name" => "hideip_attach_enabled",
"title" => $db->escape_string($lang->hideip_attachments),
"description" => $db->escape_string($lang->hideip_attachments_descrip),
"optionscode" => "yesno",
"value" => "yes",
"disporder" => 4,
"gid" => $gid,
),
array(
"name" => "hideip_gid_exclude",
"title" => $db->escape_string($lang->hideip_groups),
"description" => $db->escape_string($lang->hideip_groups_descrip),
"optionscode" => "text",
"value" => 0,
"disporder" => 5,
"gid" => $gid,
),
array(
"name" => "hideip_fid_exclude",
"title" => $db->escape_string($lang->hideip_forums),
"description" => $db->escape_string($lang->hideip_forums_descrip),
"optionscode" => "text",
"value" => 0,
"disporder" => 6,
"gid" => $gid,
)
);
foreach($settings as $setting)
$db->insert_query("settings", $setting);
rebuildsettings();

// Creamos las plantillas necesarias
$template = array(
"tid" => NULL,
"title" => "hideip_box",
"template" => $db->escape_string("<fieldset style=\"padding: 5px; padding-top: 8px; border: 1px solid #0000; -moz-border-radius: 5px; webkit-border-radius: 5px;\">{\$msg}</fieldset>"),
"sid" => "-1"
);
$db->insert_query("templates", $template);

$template = array(
"tid" => NULL,
"title" => "unhideip_box",
"template" => $db->escape_string("<fieldset style=\"padding: 5px; padding-top: 8px; border: 1px solid #0000; -moz-border-radius: 5px; webkit-border-radius: 5px;\">{\$msg}</fieldset>"),
"sid" => "-1"
);
$db->insert_query("templates", $template);

return True;

}

// Verifica si ya esta instalado el plugin, mediante la consulta de las plantillas del plugin
function hideip_is_installed()
{
global $db;
$query = $db->simple_select("templates", "tid", "title = 'hideip_box' || title = 'unhideip_box'");
if($db->num_rows($query))
{
return True;
}
return False;
}

// Al desinstalar el plugin eliminamos las opciones creadas y las plantillas generadas al instalar el plugin
function hideip_uninstall()
{
global $db, $cache;
$db->delete_query("templates","title = 'hideip_box'");
$db->delete_query("templates","title = 'unhideip_box'");
$db->delete_query("settinggroups","name = 'hideip_settings'");
$db->delete_query("settings","name LIKE 'hideip_%'");
rebuildsettings();
return True;
}

// Guarda en cache si el usuario ya ha respondido al tema...
function hideip_count($tid,$uid)
{
global $db, $thread;

if($tid == '' || $tid == 0)
{
$tid = $thread['tid'];
}

if(!isset($posts))
{
static $posts = 0;
$query = $db->simple_select("posts","COUNT(pid) AS posts","tid='{$tid}' AND uid = '{$uid}'");
$posts = intval($db->fetch_field($query,"posts"));
}
return $posts;
}

//Vamos a validar las opciones de nuestra cuenta, para ver si podemos o no mirar los contenidos...
function hideip_validate($fid)
{
global $mybb;
// Verifica los grupos de usuario.
if($mybb->settings['hideip_gid_exclude'])
{
$groups = explode(",", $mybb->settings['hideip_gid_exclude']);
if(in_array($mybb->user['usergroup'], $groups))
{
return False;
}
}

// Verifica que la lista de foros sea tomada en el plugin.
if($mybb->settings['hideip_fid_exclude'])
{
$fids = explode(",", $mybb->settings['hideip_fid_exclude']);
if(in_array($fid, $fids))
{
return False;
}
}

return True;
}

// Filtro utilizado para el contenido de los mensajes...
function hideip_filter($msg,$fid,$tid)
{
global $mybb,$attachcache;

if(!hideip_count($tid,$mybb->user['uid']))
{
// Ocultar enlaces
if($mybb->settings['hideip_link_enabled'])
{
$msg = preg_replace("#(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)#is",'',$msg);
}
// Ocultar el contenido del MyCode hide
if($mybb->settings['hideip_hide_enabled'])
{
$msg = preg_replace("#\[hide\](.*)\[/hide\]#is",'',$msg);
}
//Ocultar adjuntos en el mensaje
if($mybb->settings['hideip_attach_enabled'])
{
if(!hideip_count($mybb->input['tid'],$mybb->user['uid']))
{
$msg = preg_replace("#\[attachment=(.*?)\]#is",'',$msg);
}
}
}
}

function hideip_code_ajax()
{
global $mybb,$templates,$thread,$lang,$post,$attachcache, $tid;

// Si utilizamos la respuesta rápida - entonces pasamos a esto xD...
if($mybb->settings['hideip_enabled'] && $mybb->input['ajax'])
{
//redirect(get_thread_link($tid, 0, "lastpost"));
redirect(get_thread_link($tid, 0, ""));
}
}

// Reemplaza los contenidos que tengan los criterios mostrados - En mi caso la etiqueta hide, las urls y los archivos adjuntos dentro del mensaje.
function hideip_code(&$message)
{
global $mybb,$templates,$thread,$lang,$post,$attachcache, $fid;

$lang->load("hideip");
$redirect = false;
$fids = explode(",", $mybb->settings['hideip_fid_exclude']);
$groups = explode(",", $mybb->settings['hideip_gid_exclude']);

if($mybb->settings['hideip_enabled'] == "0" || in_array($fid, $fids))
{
return false;
}

$mybburl = $mybb->settings['bburl'];
// Solo se efectua cuando vamos a responder al tema.
if(hideip_count($mybb->input['tid'],$mybb->user['uid']) || in_array($mybb->user['usergroup'], $groups))
{
// Se muestra el contenido si has respondido al tema
$msg = "<legend><Font Color=\"#0000\" Family=\"Verdana\" Size=\"2\"><b>".$lang->hideip_hide_show."</b></Font></legend>$1";
eval("\$box = \"".$templates->get("unhideip_box",1,0)."\";");
$message = preg_replace("#\[hide\](.*?)\[/hide\]#is",$box,$message);

$find = '<a href="';
$replace = '<b><a href="';
$message = str_replace($find, $replace, $message);
$find = '</a>';
$replace = '</a></b>';

$message = str_replace($find, $replace, $message);
$find = '<img src="';
$replace = '<img class="dnimg" src="';

$message = str_replace($find, $replace, $message);
$redirect = true;

}
//Si no has respondido o no eres el autor de tema, no te mostrara los contenidos elegidos...
else
{
if($mybb->settings['hideip_link_enabled'])
{
// Ocultamos los enlaces
$msg = "<legend><Font Color=\"#0000\" Family=\"Verdana\" Size=\"2\"><b>".$lang->hideip_hide_hidden."</b></Font></legend><Center><img src=\"{$mybburl}/images/oculto.gif\" style=\"align:overflow;\" ><br><Font Color=\"#0000\" Family=\"Verdana\" Size=\"1\"><b>".$lang->hideip_hide_url."</b></Font></center>";
eval("\$box = \"".$templates->get("hideip_box",1,0)."\";");
$message = preg_replace("#<a[^>]*(http|www)(.*)</a>#siU",$box,$message);
}
if($mybb->settings['hideip_hide_enabled'])
{
// Ocultamos el contenido del MyCode hide
$msg = "<legend><Font Color=\"#0000\" Family=\"Verdana\" Size=\"2\"><b>".$lang->hideip_hide_hidden."</b></Font></legend><Center><img src=\"{$mybburl}/images/oculto.gif\" style=\"align:overflow;\" ><br><Font Color=\"#0000\" Family=\"Verdana\" Size=\"1\"><b>".$lang->hideip_hide_text."</b></Font></center>";
eval("\$box = \"".$templates->get("hideip_box",1,0)."\";");
$message = preg_replace("#\[hide\](.*?)\[/hide\]#is",$box,$message);
}
if($mybb->settings['hideip_attach_enabled'])
{
// Ocultar adjuntos en los mensajes...
$msg = "<legend><Font Color=\"#0000\" Family=\"Verdana\" Size=\"2\"><b>".$lang->hideip_hide_hidden."</b></Font></legend><Center><img src=\"{$mybburl}/images/oculto.gif\" style=\"align:overflow;\" ><br><Font Color=\"#0000\" Family=\"Verdana\" Size=\"1\"><b>".$lang->hideip_hide_attach."</b></Font></center>";
eval("\$post['attachments'] = \"".$templates->get("hideip_box",1,0)."\";");
$message = preg_replace("#\[attachment=(.*?)\]#is",$box,$message);
}

$done = true;

}

}

//Se ejecuta al citar un tema, si ya has respondido podrás citar los contenidos, de otra forma, no puedes citar ninguna url
//ya sea contenida de un video, imagen, etc, ya que por defecto en el parse_quoted, toma los contenidos directamente.

function hideip_quote(&$quoted_post)
{
global $mybb, $db, $session, $templates,$lang,$thread,$post,$attachcache, $fid, $tid;
$fids = explode(",", $mybb->settings['hideip_fid_exclude']);
$groups = explode(",", $mybb->settings['hideip_gid_exclude']);
if($mybb->settings['hideip_enabled'] == "0" || in_array($fid, $fids))
{
return false;
}
if($tid == '' || $tid == 0)
{
$query = $db->simple_select("posts", "tid", "pid ={$post['pid']}");
$thread = $db->fetch_array($query);
$tid = $thread['tid'];
}

$lang->load("hideip");

// Solo se efectua cuando vamos a responder al tema.
if ($mybb->user['uid'] != $post['uid'] && hideip_validate($post['fid'])){
if(hideip_count($mybb->input['tid'],$mybb->user['uid']) || in_array($mybb->user['usergroup'], $groups))
{
// Se muestra el contenido si has respondido al tema, o tienes permisos para ello
$quoted_post['message'] = $quoted_post['message'];
}
else
{
if($mybb->settings['hideip_hide_enabled'])
{
$quoted_post['message'] = preg_replace('#\[hide\](.*?)\[/hide\]#is', "", $quoted_post['message']);
}
if($mybb->settings['hideip_link_enabled'])
{
//Creamos el bucle de engaño, para pasar los enlaces a urls y de ahi luego eliminarlos en la siguiente sentencia xD...
$quoted_post['message'] = preg_replace("#(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)#is","http://$1",$quoted_post['message']);
$quoted_post['message'] = preg_replace('#\[img\]\[url\](.*?)\[/url\]\[/img\]#is', "[img]$1[/img]", $quoted_post['message']);
$quoted_post['message'] = preg_replace('#\[video=(.*?)\]\[url\](.*?)\[/video\]\[/url\]#is', "[video=$1]$2$3[/video]", $quoted_post['message']);

}
$quoted_post['message'] = preg_replace('#\[url\](.*?)\[/url\]#is', "", $quoted_post['message']);
$quoted_post['message'] = preg_replace('#\[url=(.*?)\](.*?)\[/url\]#is', "", $quoted_post['message']);
}
}

}

//Sucede cuando buscamos los adjuntos en los temas para ocultarlos o mostrarlos, dependiendo de los criterios establecidos
function hideip_clear(&$post)
{
global $mybb,$attachcache,$templates, $lang;
$lang->load("hideip");
$fids = explode(",", $mybb->settings['hideip_fid_exclude']);
if($mybb->settings['hideip_enabled'] == "0" || in_array($fid, $fids))
{
return false;
}

if($mybb->settings['hideip_attach_enabled'] && is_array($attachcache[$post['pid']]) && $mybb->user['uid'] != $post['uid'] && hideip_validate($post['fid']))
{
if(!hideip_count($mybb->input['tid'],$mybb->user['uid']))
{
$mybburl = $mybb->settings['bburl'];
$msg = "<legend><Font Color=\"\" Family=\"Verdana\" Size=\"2\"><b>".$lang->hideip_hide_hidden."</b></Font></legend><Center><img src=\"{$mybburl}/images/oculto.gif\" style=\"align:overflow;\"><br><Font Color=\"\" Family=\"Verdana\" Size=\"1\"><b>".$lang->hideip_hide_attach."</b></Font></center>";
eval("\$post['attachments'] = \"".$templates->get("hideip_box",1,0)."\";");
}
}
}

?>
Forum dead?
^ can we have test url (url of a topic where you have hide code) to check
Edit: it appears to be this image --> /images/oculto.gif (Thank You @ erigo19)
No .m. . oculto.gif is just the black box, and not the complete image including the white background.
^ Thank You @ erigo19.
@ suprelacy, you can try adding below code at the bottom of your theme's global.css (through admin panel, advanced edit mode)
.post_body fieldset {background: #222!important;}
after adding the code and saving the global.css, hard refresh your browser (eg. press CTRL + F5) on a topic page

(see html color codes if required)
That thit not take effect on my board .m. I was also looking for a solution for this issue. On my board its looks that the background takes the color of the .botommenu
^ test url is required to check

Edit:
admin panel >> templates >> global templates >> hideip_box

<fieldset style="padding: 5px; padding-top: 8px; border: 1px solid #a8a8a8; background: #f5f5f5; -moz-border-radius: 5px; webkit-border-radius: 5px;">{$msg}</fieldset>

one can remove background: #f5f5f5; like below
<fieldset style="padding: 5px; padding-top: 8px; border: 1px solid #a8a8a8; -moz-border-radius: 5px; webkit-border-radius: 5px;">{$msg}</fieldset>
Thanks Fixed I search Templates for HideIPbox and find the right templates thanks u all guys
Well you have to use new 1.8 version working better for me on my forum.

I can help to you if you want.

1.- I have 1 image you have to upload this and the name are oculto.png.

But if you wanna change this value, you have to open plugin and for example, you have msg
$msg = "<legend><Font Color=\"#0000\" Family=\"Verdana\" Size=\"2\"><b>".$lang->hideip_hide_show."</b></Font></legend>$1";
Change it to
$msg = $lang->hideip_hide_show."<br />$1";
Then you have to serach for:
$msg = "<legend><Font Color=\"#0000\" Family=\"Verdana\" Size=\"2\"><b>".$lang->hideip_hide_hidden."</b></Font></legend><Center><img src=\"{$mybburl}/images/oculto.gif\" style=\"align:overflow;\" ><br><Font Color=\"#0000\" Family=\"Verdana\" Size=\"1\"><b>".$lang->hideip_hide_attach."</b></Font></center>";

Change ir for:
$msg = $lang->hideip_hide_attach;
This for attachments, you have to do the same for urls, and for hidetags, then you have to edit as you wish hideip_box and unhideip_box templates on global templates.

Put your own stylization and it works.

i make the html but it's obsolet i'm working on 1.9 version and i have to change all content of this mod to css and you can edit on you styeshets and existing templates.

Cheers.

In post i add 1.8v works better, but i'm still working on 1.9 and i'm thinking how can i add a better code and optimization for this.

Anyway the changes are the same on 1.8, but on 1.9 i add another html code to put an entire validation as my site xD and w3.