ThWboard Support-Forum (Archiv)
Ort: / Boardübersicht / Code Hack Requests / "admin-tag" funzt nicht
Seite 1 von 1
Bleep schrieb am 26.04.2003 um 16:34 Uhr
also, ich wollte einen Tag in den thwb-code einfügen, mit dem ich notes in posts schreiben kann, die nur von Admins gelesen werden können:
[admin]text[/admin]
das problem ist halt die Realisierung :)
habe bis jetzt
// [admin]
$a_thwbcode[SEARCH][] = '/\[admin\]/Ui';
$a_thwbcode[REPLACE][] = 'if( $g_user[\'userisadmin\'] ){';
// [/admin]
$a_thwbcode[SEARCH][] = '/\[\/admin\]/Ui';
$a_thwbcode[REPLACE][] = '}';
in der thwbcode.inc.php gemacht
aber das führt nur dazu dass das if dann mit ausgegeben wird, anstatt dass es "funktioniert"
wie könnte ich das sonst noch machen?
fingers schrieb am 26.04.2003 um 17:28 Uhr
you could try
// [admin] id is 1
$userid1='';
$thwb_cookie = $_COOKIE[thwb_cookie];
$userid1 = substr($thwb_cookie, 32);
if ($userid1 == "1")
{
$a_thwbcode[SEARCH][] = '/\[admin\](.*)\[\/admin\]/Uis';
$a_thwbcode[REPLACE][] = '<b>\1</b>';
}
else
{
$a_thwbcode[SEARCH][] = '/\[admin\](.*)\[\/admin\]/Uis';
$a_thwbcode[REPLACE][] = '';
}
Bleep schrieb am 26.04.2003 um 19:42 Uhr
thx
this works
theDon schrieb am 26.04.2003 um 23:50 Uhr
global $g_user;
if ($g_user['userid'] == "1")
{
$a_thwbcode[SEARCH][] = '/\[admin\](.*)\[\/admin\]/Uis';
$a_thwbcode[REPLACE][] = '<b>\1</b>';
}
else
{
$a_thwbcode[SEARCH][] = '/\[admin\](.*)\[\/admin\]/Uis';
$a_thwbcode[REPLACE][] = '';
}
noch besser :D
Bluetooth schrieb am 26.04.2003 um 23:52 Uhr
irgendwo gabs da nen design-fehler ... hab zur besseren lesbarkeit das
...
rausgenommen.
Bleep schrieb am 27.04.2003 um 00:25 Uhr
achja, sollte das auch jemand machen wollen. Man muss noch etwas ändern:
die zeile
$post['posttext'] = htmlspecialchars($post['posttext']);
in der datei showtopic.php muss in
$post['posttext'] = ereg_replace("\[admin\](.*)\[\/admin\]","",htmlspecialchars($post['posttext']));
geändert werden, sonst taucht die versteckte message bei einer zitatantwort mit auf :)
theDon schrieb am 27.04.2003 um 01:19 Uhr
Bluetooth postete
irgendwo gabs da nen design-fehler ... hab zur besseren lesbarkeit das
...
rausgenommen.
ja, das hatte ich auch gemerkt, hast scheinbar nach meinem edit deinen abgeschickt =)
fingers schrieb am 27.04.2003 um 03:56 Uhr
@Bleep so that admin can still see in quotations
replace
$post['posttext'] = ereg_replace("\[admin\](.*)\[\/admin\]","",htmlspecialchars($post['posttext']));
with
if ( $g_user[ ' userid ' ] !=='1')
$replytext = ereg_replace("\[admin\](.*)\[\/admin\] ","",htmlspecialchars( $post[ ' posttext ' ] ));
under
$post['posttext'] = htmlspecialchars($post['posttext']);
and i use the faster theDon/Bluetooth code
theDon schrieb am 27.04.2003 um 04:23 Uhr
fingers postete
and i use the faster theDon/Bluetooth code
it's my code, bluetooth just removed the [*quote]tags :D
fingers schrieb am 27.04.2003 um 07:53 Uhr
@theDon Sorry :D :D
theDon schrieb am 27.04.2003 um 10:01 Uhr
just wanted to correct that :D :D
Seite 1 von 1