BBCode [ukryj] przed gośćmi
|
BenLomax |
Dodany dnia 18.11.2008 16:58:30
|
Bywalec
Postów: 426 Pomógł: 25 Ostrzeżeń: 1
Data rejestracji: 25.06.2008 09:48
|
BBCode pokazujący tekst TYLKO użytkownikom.
[ukryj]tekst widoczny tylko dla użytkowników[/ukryj]
Czy można by było przerobić go tak by ukrywając tekst przed gościem pokazywał im napis np: Treść dostępna tylko dla użytkowników? W tej postaci ukrywa tekst kompletnie - widać tylko pusty post.
W załączniku dwie wersje:
- moja
- zmodyfikowana przez Wooye z tekstem dla nie uprawnionych (za co THX)
BenLomax dodał/a następującą plik:
Edytowane przez BenLomax dnia 19.11.2008 11:05:38
|
|
|
|
Wścibski Gość |
Dodany dnia 24.12.2024 18:08:43
|
Pan Kontekstualny
Postów: n^x
Data rejestracji: Zawsze
|
|
IP: localhost |
|
|
Wooya |
Dodany dnia 18.11.2008 18:12:59
|
Zaawansowany
Postów: 1449 Pomógł: 22
Data rejestracji: 30.01.2005 15:40
|
GeSHi: PHP <?php /*-------------------------------------------------------+ | PHP-Fusion Content Management System | Copyright (C) 2002 - 2008 Nick Jones | http://www.php-fusion.co.uk/ +--------------------------------------------------------+ | Filename: ukryj_bbcode_include.php | Author: BenLomax +--------------------------------------------------------+ | This program is released as free software under the | Affero GPL license. You can redistribute it and/or | modify it under the terms of this license which you | can read by viewing the included agpl.txt or online | at http://www.gnu.org/licenses/agpl.html. Removal of this | copyright header is strictly prohibited without | written permission from the original author(s). +--------------------------------------------------------*/ if (!defined("IN_FUSION")) { die("Access Denied"); } if (iUSER) { $text = preg_replace('#\[ukryj\](.*?)\[/ukryj\]#si', '<div class=\'quote\'><strong>'.$locale['bb_ukryj'].'</strong><br /><span style=\'color:red;font-weight:bold\'>\1</span></div>', $text); } else { $text = preg_replace('#\[ukryj\](.*?)\[/ukryj\]#si', '<div class=\'quote\'><strong>'.$locale['bb_ukryj_guest'].'</strong></div>', $text); } ?>
Zinterpretowano w sekund: 0.042, wykorzystano GeSHi 1.0.8.10
GeSHi: PHP <?php /* +--------------------------------------------------------+ | Filename: ukryj.php | Author: BenLomax +--------------------------------------------------------+ */ $locale['bb_ukryj'] = "Wiadomość dla użytkowników"; $locale['bb_ukryj_description'] = "Pokazuje zaznaczony tekst tylko użytkownikom"; $locale['bb_ukryj_usage'] = "tekst widoczny tylko dla użytkowników"; $locale['bb_ukryj_guest'] = "Treść dostępna tylko dla użytkowników"; ?>
Zinterpretowano w sekund: 0.036, wykorzystano GeSHi 1.0.8.10
... Pomagam tylko przy najnowszych wersjach PHP-Fusion ...
|
|
|
|
jedjak |
Dodany dnia 18.11.2008 19:41:56
|
Przedszkolak
Postów: 24 Ostrzeżeń: 1
Data rejestracji: 07.10.2006 16:18
|
Gdzie te pliki wkleić?
Edytowane przez ICEK dnia 18.11.2008 19:48:44
|
|
|
|
zezol |
Dodany dnia 18.11.2008 20:38:10
|
Bywalec
Postów: 593 Pomógł: 34
Data rejestracji: 09.12.2006 22:16
|
Pierwszy do: includes/bbcodes/
Drugi do: locale/Polish(-utf8)/bbcodes/
Zapoznaj się z tym artykułem.
|
|
|
|
jedjak |
Dodany dnia 18.11.2008 21:17:58
|
Przedszkolak
Postów: 24 Ostrzeżeń: 1
Data rejestracji: 07.10.2006 16:18
|
w "Tagi BBCODE" pokazuje się:
Warning: include() [function.include]: Failed opening '../includes/bbcodes/ukryj_bbcode_include_var.php' for inclusion (include_path='.:/:/usr/php/pear') in /administration/bbcodes.php on line 184
Fatal error: Cannot use string offset as an array in /administration/bbcodes.php on line 189
Kliknij i zaczekaj na załadowanie kodu ...
Aha - mój /administration/bbcodes.php
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: bbcodes.php
| Author: Wooya
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../maincore.php";
require_once THEMES."templates/admin_header.php";
include LOCALE.LOCALESET."admin/bbcodes.php";
if (!checkrights("BB") || !defined("iAUTH") || $_GET['aid'] != iAUTH) { redirect("../index.php"); }
if (!isset($_GET['page']) || !isnum($_GET['page'])) { $_GET['page'] = 1; }
global $p_data;
//prevent e_notice warning for included bbcode vars
$textarea_name = ""; $inputform_name = "";
$navigation = "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n<tr>\n";
$navigation .= "<td width='50%' align='center' class='".($_GET['page']==1?"tbl2":"tbl1")."'>".($_GET['page']==1?"<strong>":"")."<a href='".FUSION_SELF.$aidlink."&page=1'>".$locale['400']."</a>".($_GET['page']==1?"</strong>":"")."</td>\n";
$navigation .= "<td width='50%' align='center' class='".($_GET['page']==2?"tbl2":"tbl1")."'>".($_GET['page']==2?"<strong>":"")."<a href='".FUSION_SELF.$aidlink."&page=2'>".$locale['401']."</a>".($_GET['page']==2?"</strong>":"")."</td>\n";
$navigation .= "</tr>\n</table>\n";
$navigation .= "<div style='margin:5px'></div>\n";
if ($_GET['page'] == 1) {
if ((isset($_GET['action']) && $_GET['action'] == "mup") && (isset($_GET['bbcode_id']) && isnum($_GET['bbcode_id']))) {
$data = dbarray(dbquery("SELECT * FROM ".DB_BBCODES." WHERE bbcode_order='".intval($_GET['order'])."'"));
$result = dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order+1 WHERE bbcode_id='".$data['bbcode_id']."'");
$result = dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order-1 WHERE bbcode_id='".$_GET['bbcode_id']."'");
redirect(FUSION_SELF.$aidlink);
} elseif ((isset($_GET['action']) && $_GET['action'] == "mdown") && (isset($_GET['bbcode_id']) && isnum($_GET['bbcode_id']))) {
$data = dbarray(dbquery("SELECT * FROM ".DB_BBCODES." WHERE bbcode_order='".intval($_GET['order'])."'"));
$result = dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order-1 WHERE bbcode_id='".$data['bbcode_id']."'");
$result = dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order+1 WHERE bbcode_id='".$_GET['bbcode_id']."'");
redirect(FUSION_SELF.$aidlink);
} elseif (isset($_GET['enable']) && file_exists(INCLUDES."bbcodes/".$_GET['enable']."_bbcode_include_var.php") && file_exists(INCLUDES."bbcodes/".$_GET['enable']."_bbcode_include.php")) {
if (substr($_GET['enable'], 0, 1)!='!') {
$data2 = dbarray(dbquery("SELECT MAX(bbcode_order) AS xorder FROM ".DB_BBCODES));
$order = ($data2['xorder']==0?1:($data2['xorder']+1));
$result = dbquery("INSERT INTO ".DB_BBCODES." (bbcode_name, bbcode_order) VALUES ('".$_GET['enable']."', '".$order."')");
} else {
$result2 = dbquery("SELECT * FROM ".DB_BBCODES." ORDER BY bbcode_order ASC");
if ($rows2 = dbrows($result2)) {
$result3 = dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order+1");
}
$result3 = dbquery("INSERT INTO ".DB_BBCODES." (bbcode_name, bbcode_order) VALUES ('".$_GET['enable']."', '1')");
}
redirect (FUSION_SELF.$aidlink);
} elseif (isset($_GET['disable']) && isnum($_GET['disable'])) {
$result = dbquery("DELETE FROM ".DB_BBCODES." WHERE bbcode_id='".$_GET['disable']."'");
$result = dbquery("SELECT bbcode_order FROM ".DB_BBCODES." ORDER BY bbcode_order");
$order = 1;
while ($data = dbarray($result)) {
$result2 = dbquery("UPDATE ".DB_BBCODES." SET bbcode_order='".$order."' WHERE bbcode_order='".$data['bbcode_order']."'");
$order++;
}
redirect (FUSION_SELF.$aidlink);
}
$available_bbcodes = array();
if ($handle_bbcodes = opendir(INCLUDES."bbcodes/")) {
while (false !== ($file_bbcodes = readdir($handle_bbcodes))) {
if (!in_array($file_bbcodes, array("..",".","index.php")) && !is_dir(INCLUDES."bbcodes/".$file_bbcodes)) {
if (!eregi("_var.php", $file_bbcodes) && !eregi("_save.php", $file_bbcodes) && !eregi(".js", $file_bbcodes)) {
$bbcode_name = explode("_", $file_bbcodes);
$available_bbcodes[] = $bbcode_name[0];
unset($bbcode_name);
}
}
}
closedir($handle_bbcodes);
}
sort($available_bbcodes); $enabled_bbcodes = array();
opentable($locale['402']);
echo $navigation;
$result = dbquery("SELECT * FROM ".DB_BBCODES." ORDER BY bbcode_order");
if (dbrows($result)) {
echo "<div style='width:100%;height:250px;overflow:auto'>\n";
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n<tr>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['403']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['404']."</strong></td>\n";
echo "<td class='tbl2'><strong>".$locale['405']."</strong></td>\n";
echo "<td class='tbl2'><strong>".$locale['406']."</strong></td>\n";
echo "<td align='center' colspan='2' width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['407']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'></td>\n";
echo "</tr>\n";
$lp=0;
$ps = 1; $i = 1;
$numrows = dbcount("(bbcode_id)", DB_BBCODES);
while ($data = dbarray($result)) {
if ($numrows != 1) {
$up = $data['bbcode_order'] - 1;
$down = $data['bbcode_order'] + 1;
if ($i == 1) {
$up_down = " <a href='".FUSION_SELF.$aidlink."&action=mdown&bbcode_id=".$data['bbcode_id']."&order=$down'><img src='".get_image("down")."' alt='".$locale['408']."' title='".$locale['408']."' style='border:0px;' /></a>\n";
} else if ($i < $numrows) {
$up_down = " <a href='".FUSION_SELF.$aidlink."&action=mup&bbcode_id=".$data['bbcode_id']."&order=$up'><img src='".get_image("up")."' alt='".$locale['409']."' title='".$locale['409']."' style='border:0px;' /></a>\n";
$up_down .= " <a href='".FUSION_SELF.$aidlink."&action=mdown&bbcode_id=".$data['bbcode_id']."&order=$down'><img src='".get_image("down")."' alt='".$locale['408']."' title='".$locale['408']."' style='border:0px;' /></a>\n";
} else {
$up_down = " <a href='".FUSION_SELF.$aidlink."&action=mup&bbcode_id=".$data['bbcode_id']."&order=$up'><img src='".get_image("up")."' alt='".$locale['409']."' title='".$locale['409']."' style='border:0px;' /></a>\n";
}
} else {
$up_down = "";
}
$i++;
$lp++;
$enabled_bbcodes[] = $data['bbcode_name'];
if (file_exists(INCLUDES."bbcodes/images/".$data['bbcode_name'].".png")) {
$bbcode_image = "<img src='".INCLUDES."bbcodes/images/".$data['bbcode_name'].".png' alt='".$data['bbcode_name']."' style='border:1px solid black' />\n";
} else if (file_exists(INCLUDES."bbcodes/images/".$data['bbcode_name'].".gif")) {
$bbcode_image = "<img src='".INCLUDES."bbcodes/images/".$data['bbcode_name'].".gif' alt='".$data['bbcode_name']."' style='border:1px solid black' />\n";
} else if (file_exists(INCLUDES."bbcodes/images/".$data['bbcode_name'].".jpg")) {
$bbcode_image = "<img src='".INCLUDES."bbcodes/images/".$data['bbcode_name'].".jpg' alt='".$data['bbcode_name']."' style='border:1px solid black' />\n";
} else {
$bbcode_image = "-";
}
$cls = ($lp % 2 == 0 ? "tbl2" : "tbl1");
echo "<tr>\n";
if (file_exists(LOCALE.LOCALESET."bbcodes/".$data['bbcode_name'].".php")) {
include (LOCALE.LOCALESET."bbcodes/".$data['bbcode_name'].".php");
} elseif (file_exists(LOCALE."English/bbcodes/".$data['bbcode_name'].".php")) {
include (LOCALE."English/bbcodes/".$data['bbcode_name'].".php");
}
include INCLUDES."bbcodes/".$data['bbcode_name']."_bbcode_include_var.php";
echo "<td width='1%' class='$cls' style='white-space:nowrap'>".ucwords($data['bbcode_name'])."</td>\n";
echo "<td align='center' width='1%' class='$cls' style='white-space:nowrap'>".$bbcode_image."</td>\n";
echo "<td class='$cls'>".$__BBCODE__[0]['description']."</td>\n";
echo "<td class='$cls'>".$__BBCODE__[0]['usage']."</td>\n";
unset ($__BBCODE__);
echo "<td align='center' width='1%' class='$cls' style='white-space:nowrap'>".$data['bbcode_order']."</td>\n";
echo "<td align='center' width='1%' class='$cls' style='white-space:nowrap'>".$up_down."</td>\n";
echo "<td align='center' width='1%' class='$cls' style='white-space:nowrap'><a href='".FUSION_SELF.$aidlink."&disable=".$data['bbcode_id']."'>".$locale['410']."</a></td>\n";
echo "</tr>\n";
}
echo "</table>\n";
echo "</div>\n";
} else {
echo "<div style='text-align:center'>".$locale['411']."</div>\n";
}
closetable();
$enabled = dbcount("(bbcode_id)", DB_BBCODES);
opentable($locale['413']);
if (count($available_bbcodes) != $enabled) {
echo "<div style='width:100%;height:250px;overflow:auto'>\n";
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n<tr>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['403']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['404']."</strong></td>\n";
echo "<td class='tbl2'><strong>".$locale['405']."</strong></td>\n";
echo "<td class='tbl2'><strong>".$locale['406']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'></td>\n";
echo "</tr>\n";
$xx=0;
for ($lp=0; $lp < count($available_bbcodes); $lp++) {
$__BBCODE__ = "";
if (!in_array($available_bbcodes[$lp], $enabled_bbcodes)) {
if (file_exists(INCLUDES."bbcodes/images/".$available_bbcodes[$lp].".png")) {
$bbcode_image = "<img src='".INCLUDES."bbcodes/images/".$available_bbcodes[$lp].".png' alt='".$available_bbcodes[$lp]."' style='border:1px solid black' />\n";
} else if (file_exists(INCLUDES."bbcodes/images/".$available_bbcodes[$lp].".gif")) {
$bbcode_image = "<img src='".INCLUDES."bbcodes/images/".$available_bbcodes[$lp].".gif' alt='".$available_bbcodes[$lp]."' style='border:1px solid black' />\n";
} else if (file_exists(INCLUDES."bbcodes/images/".$available_bbcodes[$lp].".jpg")) {
$bbcode_image = "<img src='".INCLUDES."bbcodes/images/".$available_bbcodes[$lp].".jpg' alt='".$available_bbcodes[$lp]."' style='border:1px solid black' />\n";
} else {
$bbcode_image = "-";
}
if (file_exists(LOCALE.LOCALESET."bbcodes/".$available_bbcodes[$lp].".php")) {
include (LOCALE.LOCALESET."bbcodes/".$available_bbcodes[$lp].".php");
} elseif (file_exists(LOCALE."English/bbcodes/".$available_bbcodes[$lp].".php")) {
include (LOCALE."English/bbcodes/".$available_bbcodes[$lp].".php");
}
include INCLUDES."bbcodes/".$available_bbcodes[$lp]."_bbcode_include_var.php";
$cls = ($xx % 2 == 0 ? "tbl2" : "tbl1");
echo "<tr>\n";
echo "<td width='1%' class='$cls' style='white-space:nowrap'>".ucwords($available_bbcodes[$lp])."</td>\n";
echo "<td align='center' width='1%' class='$cls' style='white-space:nowrap'>".$bbcode_image."</td>\n";
echo "<td class='$cls'>".$__BBCODE__[0]['description']."</td>\n";
echo "<td class='$cls'>".$__BBCODE__[0]['usage']."</td>\n";
echo "<td align='center' width='1%' class='$cls' style='white-space:nowrap'><a href='".FUSION_SELF.$aidlink."&enable=".$available_bbcodes[$lp]."'>".$locale['414']."</a></td>\n";
echo "</tr>\n";
unset ($__BBCODE__);
$xx++;
}
}
echo "</table>\n";
echo "</div>\n";
} else {
echo "<div style='text-align:center'>".$locale['416']."</div>\n";
}
closetable();
} else if ($_GET['page'] == 2) {
if (isset($_POST['post_test'])) {
$test_message = stripinput($_POST['test_message']);
$smileys_checked = isset($_POST['test_smileys']) ? "checked='checked'" : "";
opentable($locale['417']);
echo parseubb(parsesmileys($test_message));
closetable();
} else {
$test_message = "";
$smileys_checked = "";
}
include LOCALE.LOCALESET."comments.php";
opentable($locale['401']);
echo $navigation;
echo "<form name='inputform' method='post' action='".FUSION_SELF.$aidlink."&page=2'>\n";
echo "<table cellspacing='0' cellpadding='0' class='center'>\n<tr>\n";
echo "<td align='center' class='tbl'><textarea name='test_message' cols='60' rows='6' class='textbox' style='width:400px'>".$test_message."</textarea><br />\n";
require_once INCLUDES."bbcode_include.php";
echo display_bbcodes("400px", "test_message");
echo "</td>\n</tr>\n<tr>\n";
echo "<td align='center' class='tbl'><input type='checkbox' name='test_smileys' value='1' ".$smileys_checked." />".$locale['418']."<br /><br />\n";
echo "<input type='submit' name='post_test' value='".$locale['401']."' class='button' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
closetable();
}
require_once THEMES."templates/footer.php";
?> Kliknij i zaczekaj na załadowanie kodu ...
Edytowane przez Wooya dnia 19.11.2008 20:19:04
|
|
|
|
Wooya |
Dodany dnia 19.11.2008 20:19:39
|
Zaawansowany
Postów: 1449 Pomógł: 22
Data rejestracji: 30.01.2005 15:40
|
Kolego, miales podmienic zawartosc twoich plikow na moja, wg wskazowek kolegi zezola.
... Pomagam tylko przy najnowszych wersjach PHP-Fusion ...
|
|
|