Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/mybb-es.com/html/inc/class_language.php on line 201
[Urgente]Compatibilizar Dados
Jaizu   11 Aug, 2011, 2:30 pm
#1
  • URL del foro: PkMystic.tk
  • Versión del foro: 1.6.4
  • Actualización: Ninguna

Pues necesito, muy urgente, el sistema de Rol en mi foro, y ningún plugin de dados vale para 1.6, por eso quiero que me ayudeis a compatibilizar este plugin:
Código PHP:
<?php
/***************************************************************************
*
* Dice roller plugin (/inc/plugins/diceroll.php)
* Author: Shadows
* Copyright: © 2009-2010 Shadows
*
* Website: http://geekhelps.net
* License: inside readme
*
* Adds the option to roll a dice in a certain posts
*
***************************************************************************/


if(!defined("IN_MYBB"))
die(
"This file cannot be accessed directly.");

// add hooks
$plugins->add_hook("newreply_end", "diceroll_replies");
$plugins->add_hook("newreply_do_newreply_end", "diceroll_roll");
$plugins->add_hook("postbit", "diceroll_show");
$plugins->add_hook("showthread_end", "diceroll_quick");

function
diceroll_info()
{
return array(
"name" => "MyDiceroller",
"description" => "Adds the option to roll a dice in certain forums for certain usergroups",
"website" => "http://geekhelps.net",
"author" => "Shadows",
"authorsite" => "http://geekhelps.net",
"version" => "1.10",
"guid" => "d69a9792246d9dcd25a2d8e391513077",
"compatibility" => "14*"
);
}

function
diceroll_activate()
{
global
$db, $lang;
// create settings group
$insertarray = array(
'name' => 'myroll',
'title' => 'Dice roller',
'description' => "A MyBB plugin to roll dices in posts",
'disporder' => 1,
'isdefault' => 0
);
$gid = $db->insert_query("settinggroups", $insertarray);
// add settings

$setting0 = array(
"sid" => NULL,
"name" => "maxfaces",
"title" => "Amount of dices to roll",
"description" => "Please enter a number (Usually 2)",
"optionscode" => "text",
"value" => "2",
"disporder" => 1,
"gid" => $gid
);

$db->insert_query("settings", $setting0);
$setting1 = array(
"sid" => NULL,
"name" => "diceroll_groups",
"title" => "Usergroup IDs allowed to roll dices",
"description" => "Seperate them by commas. - 0 for none",
"optionscode" => "text",
"value" => "2, 3, 4, 5, 6",
"disporder" => 1,
"gid" => $gid
);


$db->insert_query("settings", $setting1);

$setting2 = array(
"sid" => NULL,
"name" => "diceroll_forums",
"title" => "In which forum IDs, are users(depending on above setting) allowed to roll dices?",
"description" => "Seperate them by commas.",
"optionscode" => "text",
"value" => "1",
"disporder" => 1,
"gid" => $gid
);


$db->insert_query("settings", $setting2);
rebuild_settings();

// add templates
require "../inc/adminfunctions_templates.php";
find_replace_templatesets("newreply", '#'.preg_quote('{$lang->options_sig}</label>').'#', '{$lang->options_sig}</label>{$rolldice}');
find_replace_templatesets("postbit", '#'.preg_quote('{$post[\'user_details\']}').'#', '{$post[\'user_details\']}<!-- dice -->{$post[\'diceroll\']}<!-- end dice -->');
find_replace_templatesets("postbit_classic", '#'.preg_quote('{$post[\'user_details\']}').'#', '{$post[\'user_details\']}<!-- dice -->{$post[\'diceroll\']}<!-- end dice -->');
find_replace_templatesets("showthread_quickreply", '#'.preg_quote('{$lang->message_note}<br /><br />').'#', '{$lang->message_note}<br /><br /><!--quickrolling-->');
$db->query('ALTER TABLE ' . TABLE_PREFIX . 'posts ADD rolldice VARCHAR(1000) NOT NULL');
}


function
diceroll_deactivate()
{
global
$db, $mybb;
// delete settings group
$db->delete_query("settinggroups", "name = 'myroll'");

// remove settings
$db->delete_query('settings', 'name IN ( \'maxfaces\')');

rebuild_settings();
require
"../inc/adminfunctions_templates.php";
find_replace_templatesets("newreply", '#'.preg_quote('{$rolldice}').'#', "",0);
find_replace_templatesets("postbit", '#'.preg_quote('<!-- dice -->{$post[\'diceroll\']}<!-- end dice -->').'#', "",0);
find_replace_templatesets("postbit_classic", '#'.preg_quote('<!-- dice -->{$post[\'diceroll\']}<!-- end dice -->').'#', "",0);
find_replace_templatesets("showthread_quickreply", '#'.preg_quote('<!--quickrolling-->').'#', "",0);


$db->query('ALTER TABLE ' . TABLE_PREFIX . 'posts DROP rolldice');
}

function
diceroll_show(&$post)
{

global
$mybb, $db, $fid, $roll, $lang;
$lang->load("mydiceroller");

//wrong forum? don't show it then!
//= 0? then he didn't roll the dice, don't show it then!
if($post['rolldice'] == 'not' || $post['rolldice'] == '')
{
return
false;
//DID NOT ROLL DICES..
}
$forums = explode(",",$mybb->settings['diceroll_forums']);

if(!
in_array($fid, $forums))
{
return
false;
}

//$roll = $post['rolldice'];
$roll = unserialize($post['rolldice']);

$post['diceroll'] = "<br />";
$post['diceroll'] .= "<b>" . $lang->rolled . " </b>";
foreach(
$roll as $key => $nr)
{
//$post['diceroll'] .= "$value |";
$post['diceroll'] .= "<img src=\"images/dice/". $nr.".png\" alt=\"dice - " . $nr . "\" hspace=\"1\" />";
}

return
$post;
}

function
diceroll_roll()
{
global
$mybb, $rolled, $rolldice, $rolldices, $pid, $db, $fid, $roll, $ser;
//is he the right user in the right forum?
if($mybb->input['myroll'] == false)
{
//DO NOT ROLL DICE
return false;
}
$groups = explode(",",$mybb->settings['diceroll_groups']);
$forums = explode(",",$mybb->settings['diceroll_forums']);
if(!
in_array($fid, $forums))
{
return
false;
}
if(
$mybb->settings['diceroll_groups'] == '')
{
return
false;
}
if(!
in_array($mybb->user['usergroup'], $groups))
{
$additional = explode(',', $mybb->user['additionalgroups']);
if (
$additional)
{
if(!
array_intersect($additional, $groups))
{
return
false;
}
}
else
return
false;
}

for (
$counter = 1; $counter <= $mybb->settings['maxfaces']; $counter++)
{
$roll[] = mt_rand(1,6);
}
$ser = serialize($roll);
//$rolled = mt_rand(1,6);
$rolldices = array(
"rolldice" => $ser,
);

$db->update_query("posts", $rolldices, "pid='{$pid}'");

}

function
diceroll_replies()
{
//for the newreply template..
global $mybb, $db, $rolldice, $fid, $lang;
$lang->load("mydiceroller");
//is he the right user in the right forum?
$groups = explode(",",$mybb->settings['diceroll_groups']);
$forums = explode(",",$mybb->settings['diceroll_forums']);
if(!
in_array($fid, $forums))
{
return
false;
}
if(
$mybb->settings['diceroll_groups'] == '')
{
return
false;
}

if(!
in_array($mybb->user['usergroup'], $groups))
{
$additional = explode(',', $mybb->user['additionalgroups']);
if (
$additional)
{
if(!
array_intersect($additional, $groups))
{
return
false;
}
}
else
return
false;
}


$rolldice = '<br /><label><input type="checkbox" class="checkbox" name="myroll" id="myroll"/>&nbsp;' . $lang->checkbox . '</label>';


}


function
diceroll_quick()
{
global
$mybb, $db, $showthread, $fid, $lang;
$lang->load("mydiceroller");
//is he the right user in the right forum?
$groups = explode(",",$mybb->settings['diceroll_groups']);
$forums = explode(",",$mybb->settings['diceroll_forums']);
if(!
in_array($fid, $forums))
{
return
false;
}
if(
$mybb->settings['diceroll_groups'] == '')
{
return
false;
}
if(!
in_array($mybb->user['usergroup'], $groups))
{
$additional = explode(',', $mybb->user['additionalgroups']);
if (
$additional)
{
if(!
array_intersect($additional, $groups))
{
return
false;
}
}
else
return
false;
}

$checkbox = '<label><input type="checkbox" class="checkbox" name="myroll" id="myroll"/>&nbsp;<strong>' . $lang->quick . '</strong></label><br /> ';
$showthread = str_replace('<!--quickrolling-->', $checkbox, $showthread);

return
$showthread;

}
?>
nentab   11 Aug, 2011, 5:05 pm
#2
Cambiando simplemente lo de:

Código PHP:
<?php 
"compatibility" => "14*"

Por:

Código PHP:
<?php 
"compatibility" => "16*"

No va?
Jaizu   12 Aug, 2011, 3:16 am
#3
(11 Aug, 2011, 5:05 pm)nentab escribió: Cambiando simplemente lo de:

Código PHP:
<?php 
"compatibility" => "14*"

Por:

Código PHP:
<?php 
"compatibility" => "16*"

No va?
No Sad
Debe de ser algo más, pero qué HuhHuh
nentab   12 Aug, 2011, 4:46 am
#4
Pues me temo que yo no sé decirte, ya que casi no sé PHP. A ver si otra persona puede ayudarte.
Última modificación: 12 Aug, 2011, 4:46 am por Cluster.
Gypaete   12 Aug, 2011, 7:43 am
#5
Borra esa línea.
Jaizu   12 Aug, 2011, 7:55 am
#6
Ya lo hice, lo he activado, pero no hizo ningún fecto Huh
Juliens   12 Aug, 2011, 7:08 pm
#7
Disculpad si invado. ¿Podrías dejar un link al plugin? Yo he buscado y no encuentro :/
Gypaete   13 Aug, 2011, 11:05 am
#8
Pues será que no se han editado las plantillas, tienes que hacerlo manualmente.
Jaizu   13 Aug, 2011, 2:16 pm
#9
(13 Aug, 2011, 11:05 am)Gypaete escribió: Pues será que no se han editado las plantillas, tienes que hacerlo manualmente.

Y que pongo, quiero que aparezca en la respuesta rápida HuhHuhHuh
xcb777_mybb_import8741   14 Aug, 2011, 5:23 am
#10
(12 Aug, 2011, 7:08 pm)Juliens escribió: Disculpad si invado. ¿Podrías dejar un link al plugin? Yo he buscado y no encuentro :/

Creo que es este mod http://mods.mybb.com/view/mydiceroller ^^
  
Powered By MyBB, © 2002-2024 MyBB Group.
Made with by Curves UI.