02.05.2008, 13:00
Hallo,
ich denke, dass das ein sehr wichtiges Plugin ist. Hide Links to Guests! Alle Links in Beiträgen etc. werden Gästen nicht angezeigt. Das Problem, ich habe ein Forum von MyBB gesehen wo das geht, bei mir läuft das nicht. Ich was nicht warum das nicht klappt. Kann es ein das etwas an dem Code nicht stimmt. Schaut mal rein:
Vielen Dank!!
MFG
ich denke, dass das ein sehr wichtiges Plugin ist. Hide Links to Guests! Alle Links in Beiträgen etc. werden Gästen nicht angezeigt. Das Problem, ich habe ein Forum von MyBB gesehen wo das geht, bei mir läuft das nicht. Ich was nicht warum das nicht klappt. Kann es ein das etwas an dem Code nicht stimmt. Schaut mal rein:
PHP-Code:
<?php
/**
* Hide Links to Guests
* Copyright v1.2 DragonFever
*/
function hltg_info()
{
return array(
"name" => "Hide Links to Guests",
"description" => "Don't show links in the messages to guests.",
"website" => "http://www.mybbdestek.com/",
"author" => "DragonFever",
"authorsite" => "http://www.dragonfever.info/",
"version" => "1.2",
);
}
function hltg_activate()
{
global $db, $viewing;
$hltg_group = array(
"gid" => "NULL",
"name" => "Hide Links to Guests",
"title" => "Hide Links to Guests",
"description" => "Settings for Hide Links to Guests.",
"disporder" => "4",
"isdefault" => "no",
);
$db->insert_query(TABLE_PREFIX."settinggroups", $hltg_group);
$gid = $db->insert_id();
$hltg_setting_1 = array(
"sid" => "NULL",
"name" => "hltg",
"title" => "Showing Text",
"description" => "The following text will show to guests instead of links",
"optionscode" => "textarea",
"value" => 'You Cannot View the Links Before Login the Site. Please Login or Register Our Site..',
"disporder" => '1',
"gid" => intval($gid),
);
$db->insert_query(TABLE_PREFIX."settings", $hltg_setting_1);
rebuild_settings();
$fh = fopen('../inc/class_parser.php', "r") or cperror("Could not open file!"); //OPEN FILE
$data = fread($fh, filesize('../inc/class_parser.php')) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
fclose($fh); //CLOSE FILE AGAIN
$newdata = preg_replace('#'.preg_quote('// Replace MyCode if requested.
if($options[\'allow_mycode\'] != "no")
{
$message = $this->parse_mycode($message, $options);
}').'#','// Replace MyCode if requested.
if($options[\'allow_mycode\'] != "no")
{
// Ziyaretciler Linki Goremez Eklentisi By DragonFever <mhanyak@hotmail.com>
if($mybb->user[\'usergroup\'] != "1")
{
$message = $this->parse_mycode($message, $options);
}else{
$message = $this->parse_mycode($message, $options);
$message = preg_replace("!<a[^>]*(http|www)(.*)</a>!siU", "<font color=red><b>{$mybb->settings[\'hltg\']}</b></font>", $message);
}
}',$data); //REPLACE IN STRING
$fw = fopen('../inc/class_parser.php', "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
fclose($fw); //CLOSE FILE AGAIN
}
function hltg_deactivate()
{
global $db;
//revert index.php must be chmoded 777
$fh = fopen('../inc/class_parser.php', "r") or cperror("Could not open file!"); //OPEN FILE
$data = fread($fh, filesize('../inc/class_parser.php')) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
fclose($fh); //CLOSE FILE AGAIN
$newdata = preg_replace('#'.preg_quote('// Replace MyCode if requested.
if($options[\'allow_mycode\'] != "no")
{
// Ziyaretciler Linki Goremez Eklentisi By DragonFever <mhanyak@hotmail.com>
if($mybb->user[\'usergroup\'] != "1")
{
$message = $this->parse_mycode($message, $options);
}else{
$message = $this->parse_mycode($message, $options);
$message = preg_replace("!<a[^>]*(http|www)(.*)</a>!siU", "<font color=red><b>{$mybb->settings[\'hltg\']}</b></font>", $message);
}
}').'#','// Replace MyCode if requested.
if($options[\'allow_mycode\'] != "no")
{
$message = $this->parse_mycode($message, $options);
}',$data); //REPLACE IN STRING
$fw = fopen('../inc/class_parser.php', "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
fclose($fw); //CLOSE FILE AGAIN
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='hltg'");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='Hide Links to Guests'");
rebuild_settings();
}
if(!function_exists("rebuild_settings"))
{
function rebuild_settings()
{
global $db;
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."settings ORDER BY title ASC");
while($setting = $db->fetch_array($query))
{
$setting['value'] = addslashes($setting['value']);
$settings .= "\$settings['".$setting['name']."'] = \"".$setting['value']."\";\n";
}
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?>";
$file = fopen(MYBB_ROOT."/inc/settings.php", "w");
fwrite($file, $settings);
fclose($file);
}
}
?>
Vielen Dank!!
MFG
Jetzt kostenlos eine Domain registrieren!!
Hier klicken: www.domains-for-free.de