(2012-12-06, 05:00 PM)pavemen Wrote: [ -> ]change both
$temprights = $templates->get("giverights");
eval("\$giverights = \"$temprights\";");
to
eval("\$giverights = \".$templates->get("giverights")."\";");
There's no difference, 'cause before I inserted this:
eval("\$giverights = \"".$templates->get("giverights")."\";");
@crazy4cs I included $db, $mybb, $templates but nothing happens. I tried to install your plugins, and nothing happens. Maybe I need to reinstall the board?
New codes:
<?php
/**
* MyBB 1.6
* Copyright © 2006 MyBB Group, All Rights Reserved
*
* Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*
*
*/
if(!defined("IN_MYBB")) {
die("Non si può utilizzare questo file direttamente.<br /><br />assicurati che IN_MYBB sia definita.");
}
$plugins->add_hook("newthread_start", "give_rights_newthread_display");
$plugins->add_hook('datahandler_post_validate_thread', 'give_rights_newthread_validate');
$plugins->add_hook("datahandler_post_insert_thread", "give_rights_newthread_action");
$plugins->add_hook("editpost_action_start", "give_rights_editpost_display");
$plugins->add_hook("editpost_do_editpost_start", "give_rights_editpost_action");
$plugins->add_hook("showthread_start", "give_rights_check");
$plugins->add_hook("newreply_start", "give_rights_reply_check");
function give_rights_info() {
return array(
"name" => "Dai diritti",
"description" => "Permetti ad altri utenti di modificare il tuo thread",
"website" => "http://www.slimmer.it",
"version" => "1.0",
"author" => "Kaito",
"authorsite" => "http://www.slimmer.it",
"compatibility" => "*",
);
}
function give_rights_install() {
global $db;
$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD urights TEXT NOT NULL");
$template1 = array(
"title" => "giverights",
"template" => '<tr>
<td class=\"trow2\" valign=\"top\"><strong>Test</strong></td>
<td class=\"trow2\"><span class=\"smalltext\">
<label><input type=\"checkbox\" class=\"checkbox\" name=\"inviteonlycheck\" value=\"1\" {$checked}/> Prova</label><br />
Desc
</span></td>
</tr>',
"sid" => -1
);
$db->insert_query("templates", $template1);
}
function give_rights_is_installed() {
global $db;
if($db->field_exists("urights", "threads")) {
return true;
}
return false;
}
function give_rights_activate() {
global $mybb;
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("newthread", '#{\$modoptions}#', "{\$modoptions}{\$gr}");
find_replace_templatesets("editpost", '#{\$disablesmilies}#', "{\$disablesmilies}{\$gr}");
}
function give_rights_deactivate() {
global $mybb;
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("newthread", '#'.preg_quote('{$gr}').'#', '',0);
find_replace_templatesets("editpost", '#'.preg_quote('{$gr}').'#', '',0);
}
function give_rights_uninstall() {
global $db;
$db->query("ALTER TABLE ".TABLE_PREFIX."threads DROP `urights`");
$db->delete_query("templates","title = 'giverights'");
}
//Eval when creating new thread
function give_rights_newthread_display()
{
global $mybb, $templates, $iot, $lang;
eval("\$gr = \"".$templates->get("giverights")."\";");
}
function give_rights_newthread_validate(&$dh) {
global $mybb;
}
function give_rights_newthread_action(&$dh) {
global $mybb, $lang, $db;
}
//OP is editing his thread
function give_rights_editpost_display() {
global $mybb, $templates, $iot, $db, $existinguids, $checked, $post, $lang;
$query = $db->query("SELECT tid, urights, firstpost FROM ".TABLE_PREFIX."threads where tid='".$post['tid']."'");
while($do = $db->fetch_array($query)) {
$firstpost = $do['firstpost'];
}
if($firstpost == $post['pid']) {
eval("\$gr = \"".$templates->get("giverights")."\";");
}
}
function give_rights_editpost_action() {
global $mybb, $lang, $thread, $db, $post;
}
//We now have completed major tasking, time for action
function give_rights_check() {
global $mybb, $lang, $thread;
}
function give_rights_reply_check() {
global $mybb, $lang, $thread;
}
?>