Extboard Logo
Startseite · Diskussionsforum · KontaktDienstag, 07. September 2010
Language Switcher
Navigation
Startseite
Extboard 1.2 Featureliste
Extboard 1.2 Features
Fotogalerie
Suche
Gästebuch
Theme Switcher
Wechseln zu:
Extboard Spende
Security System 1.9.0 © 2006 by BS-Fusion Deutschland
6182 Angriff(e) blockiert
Thema ansehen
 phpFusion ExtBoard > Test Area
 Testforum 1
Vorheriges Thema Nächstes Thema

Seite 1 von 7 1 2 3 4 > >>
search
Umfrage: test
0%
0 Antworten
1erster
1erster
0%
0 Antworten
2ter
2ter
Autor: admin | Begonnen: 30.08.2008 21:31 | Beendet: 31.08.2008 21:31 | Votes: 0
Autor php highlighting   1 # 64 top
admin
Oberhäuptling


User Avatar



Beiträge: 908

Eingetreten: 19.03.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 10.04.2007 19:36  

Erstmal manuell ... von Hand.

hier mal etwas php-code:
Code: PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
include LOCALE.LOCALESET."forum/options.php";<br />
<br />
if (iMEMBER) {<br />
        if (!isset($forum_id) || !isNum($forum_id)) fallback("../index.php");<br />
        $data = dbarray(dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_id='".$forum_id."'"));<br />
        if (!forum_groupaccess($forum_id, "auth_read", $data['forum_access'])) fallback("index.php");<br />
        if (is_forummod($forum_id)) { define("iMOD", true); } else { define("iMOD", false); }<br />
} else {<br />
        define("iMOD", false);<br />
}<br />
if (!iMOD && !iSUPERADMIN) fallback("index.php");<br />
<br />
$threads = "";<br />
if (isset($_POST['thread_id_list']))<br />
{<br />
        if (is_array($_POST['thread_id_list']) && count($_POST['thread_id_list']) > 0)<br />
        {<br />
                foreach ($_POST['thread_id_list'] as $thisnum)<br />
                {<br />
                        if (isNum($thisnum)) $threads .= ($threads ? "," : "").$thisnum;<br />
                }<br />
        }<br />
}



Ist das SQL ?? :-)
Code: SQL
1
2
3
4
5
<br />
SELECT column_name FROM table_name<br />
WHERE column_name<br />
BETWEEN value1 AND value2<br />


und wie ist es mit CSS:
Code: CSS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* The content of the posts (body of text) */<br />
body {<br />
        font-family:Verdana,Tahoma,Arial,Sans-Serif;<br />
        font-size:10px;<br />
        padding:0px 0px 0px 0px;<br />
        margin: 0px 0px 0px 0px;<br />
        scrollbar-face-color:#577BAB; <br />
        scrollbar-shadow-color:#0B589B; <br />
        scrollbar-highlight-color:#76A5CB; <br />
        scrollbar-3dlight-color:#7795BC; <br />
        scrollbar-darkshadow-color:#111; <br />
        scrollbar-track-color:#6D88B5; <br />
        scrollbar-arrow-color:#C6C9CA; <br />
}<br />
<br />
.sub-header {<br />
        font-family:Verdana,Tahoma,Arial,Sans-Serif;<br />
        font-size:10px;<br />
        color:#000;<br />
        padding: 4px;<br />
}


Bearbeitet von admin am 12.05.2007 23:15
http://www.wuschelkiste.de/fusion/  
Autor RE: php highlighting   2 # 64 top
admin
Oberhäuptling


User Avatar


Threadstarter

Beiträge: 908

Eingetreten: 19.03.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 10.04.2007 23:45  

so ... ne Antwort, für die, die hier nicht posten können, sieht nun so aus (also postreply.php)

SIEHE ANHANG.


 Anhänge 
antwort.jpg
(Size: 53.62KB, px: 703x522)
http://www.wuschelkiste.de/fusion/  
Autor RE: php highlighting   3 # 64 top
admin
Oberhäuptling


User Avatar


Threadstarter

Beiträge: 908

Eingetreten: 19.03.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 10.04.2007 23:55  

This is a try for php code ... now:
Code: PHP
1
2
3
4
5
6
7
8
9
10
11
if(date("U", mktime (0, 0, 0, ($monat1+$i), 1, $jahr1))>date("U")) break;<br />
 $anz = dbrows(dbquery("SELECT * FROM ".$db_prefix."users WHERE user_joined>='".date("U", mktime (0, 0, 0, ($monat1+$i), 1, $jahr1))."' AND user_joined<'".date("U", mktime (0, 0, 0, ($monat1+($i+1)), 1, $jahr1))."'")>);<br />
 $anzg = $anzg+$anz;<br />
 echo "<tr class='tbl1'><br />
 <td align='center'>"
.date("m / Y", mktime (0, 0, 0, ($monat1+$i), 1, $jahr1))."</td><br />
 <td align='right'>"
.$anz." ".($anz==1 ? "Mitglied" : "Mitglieder" )."</td><br />
 <td align='right'>"
.$anzg." ".($anzg==1 ? "Mitglied" : "Mitglieder" )."</td><br />
 </tr>"
;<br />
 }<br />
 echo "</table><br />
 <br>"
;

Thats it ... see this ... :chee


Bearbeitet von admin am 19.08.2007 18:56
http://www.wuschelkiste.de/fusion/  
Autor RE: php highlighting   4 # 64 top
sysop
Admin




Beiträge: 10

Eingetreten: 20.03.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 09.05.2007 21:57  
Code: PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?PHP<br />
<br />
function size_hum_read($size)<br />
{<br />
        $i = 0;<br />
        $iec = array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");<br />
        while (($size/1024)>1)<br />
        {<br />
                $size=$size/1024;<br />
                $i++;<br />
        }<br />
        return substr($size,0,strpos($size,'.')+2)." ".$iec[$i];<br />
}<br />
<br />
<br />
function echodir($path = ".")<br />
{<br />
        global $check;<br />
<br />
        $dir = dir($path);<br />
        $check[0] = ".";<br />
<br />
        while(false !== ($file = $dir->read()))<br />
        {<br />
                if(("."  == $file) OR<br />
                (".." == $file))<br />
                continue;<br />
                if(is_dir($path."/".$file))<br />
                {<br />
                        $check[] = $path."/".$file;<br />
                        echodir($path."/".$file);<br />
                }<br />
        }<br />
        $dir->close();<br />
//      sort($check);<br />
        return $check;<br />
}<br />
<br />
function get_files_size($folders,$showfile=0)<br />
{<br />
        $filesum = 0;<br />
        $used_size = 0;<br />
<br />
        if($showfile != 0)<br />
        {<br />
                echo "<br>\n<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";<br />
                echo "<tr>\n<td colspan=\"3\" align=\"center\">\nfile-listing</td>\n</tr>\n";<br />
        }<br />
        // save name of alle files to save<br />
        for($ii = 0; $ii < sizeof($folders); $ii++)<br />
        {<br />
                $akt_folder = $folders[$ii];<br />
                if($dp = opendir($akt_folder))<br />
                {<br />
                        while($akt_file = readdir($dp))<br />
                        {<br />
                                if($akt_file != '.' && $akt_file != '..')<br />
                                {<br />
                                        if(filesize("$akt_folder/$akt_file") > 0)<br />
                                        {<br />
                                                if(!is_dir("$akt_folder/$akt_file"))<br />
                                                {<br />
                                                        $used_size = $used_size + filesize("$akt_folder/$akt_file");<br />
                                                        if($showfile != 0) echo "<tr>\n<td align=\"right\">".($filesum + 1)."</td>\n<td>".$akt_folder."/".$akt_file."</td>\n<td>".size_hum_read(filesize("$akt_folder/$akt_file"))."</td>\n</tr>\n";<br />
                                                        if(!is_dir("$akt_folder/$akt_file")) $filesum ++;<br />
                                                }<br />
                                        }<br />
                                }<br />
                        }<br />
                        closedir($dp);<br />
                }<br />
        }<br />
<br />
        if($showfile != 0)<br />
        {<br />
                echo "<tr>\n<td colspan=\"2\">Files</td>\n<td>".$filesum."</td></tr>\n";<br />
                echo "</table>\n<br>\n";<br />
        }<br />
<br />
        return $used_size;<br />
}<br />
<br />
echo "<br>freier platz auf der platte: <b>".size_hum_read(disk_free_space("./"))."</b><br>\n";<br />
$folders = echodir(".");<br />
if(isset($_GET['list']) and ($_GET['list'] != "")) $showfile = 1;<br />
else $showfile = 0;<br />
echo "genutzter platz auf der Platte : <b>".size_hum_read(get_files_size($folders,$showfile))."</b><br>\n";<br />
<br />
?>


hmmmm
tabs werden komplett rausgenommen und die php tags werden nicht automatisch gesetzt.
ansonsten nett, auch die nummerierung

EDIT: jetzt nicht mehr, jetzt ist es ok :-)
Bearbeitet von admin am 12.05.2007 20:33
 
Autor RE: php highlighting   5 # 64 top
admin
Oberhäuptling


User Avatar


Threadstarter

Beiträge: 908

Eingetreten: 19.03.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 09.05.2007 22:52  

Hi ... danke fürs testen ...
Diese Umwandlung ist nicht von uns oder mir, sondern woanders her.
Keine Ahnung wie man das mit den Tabs machen könnte, ist wirklich nicht so schön, aber alles kann man wohl nicht haben.
Vielleicht testen wir aber nochmal "geshi" :-)
http://portal.wuschelkiste.de/fusio...ple2.php

Das mit den php-tags hab ich nicht verstanden ...



Der Chef.
http://www.wuschelkiste.de/fusion/  
Autor RE: php highlighting   6 # 64 top
admin
Oberhäuptling


User Avatar


Threadstarter

Beiträge: 908

Eingetreten: 19.03.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 12.05.2007 15:37  

Puh ... im Moment ist mir schleierhaft, wie ich das php-highlighting mit dem geshi machen soll.
Das umwandeln an sich, ist nicht so ganz schwer, theoretisch gehts mit so einer Funktion:

Code
// geshi highlight
function highlight_code_php($text) {

//$geshi =& new GeSHi($source, $language);
$geshi =& new GeSHi($text, "php");

// Enable line numbers.
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS, 0);

$geshi->set_overall_style('color: #000066; border: 2px solid #d0d0d0; background-color: #f0f0f0;', true);
$geshi->set_line_style('font-family: Verdana, Arial; font-size: 90%; color: #003030;', 'font-weight: bold; color: #006060;', true);
$geshi->set_code_style('color: #000020;', 'color: #000020;');

$text = $geshi->parse_code();
return $text;
}

DAS Problem ist aber, das das eine Funktion ist.
Die kann man ohne weitere Abfrage (ob nun [ php] an ist) nicht einfach einsetzen ...
Und wie ich das mit in den "replaces" bei der Funktion parseubb reinbekommen soll, ist mir auch schleierhaft ....

Vorschläge ??



Der Chef.
http://www.wuschelkiste.de/fusion/  
Autor RE: php highlighting   7 # 64 top
admin
Oberhäuptling


User Avatar


Threadstarter

Beiträge: 908

Eingetreten: 19.03.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 12.05.2007 17:06  

nun mal nen Test in der nächsten Zeile:

Code: PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<br />
/*<br />
* Code Highlighting Mambot<br />
*<br />
* Replaces <pre>...</pre> tags with highlighted text<br />
*/
<br />
function botGeshi( $published, &$row, &$params, $page=0 ) {<br />
        require_once( $GLOBALS['mosConfig_absolute_path'] . '/includes/domit/xml_saxy_shared.php' );<br />
<br />
        // define the regular expression for the bot<br />
        $regex = "#<pre\s*(.*?)>(.*?)</pre>#s";<br />
<br />
        if (!$published) {<br />
                $row->text = preg_replace( $regex, '', $row->text );<br />
                return;<br />
        }<br />
<br />
        $GLOBALS['_MAMBOT_GESHI_PARAMS'] =& $params;<br />
<br />
        // perform the replacement<br />
        $row->text = preg_replace_callback( $regex, 'botGeshi_replacer', $row->text );<br />
<br />
        return true;<br />
}<br />


Verdammt ... das klappt noch nicht mit dem geshi ...

Ich habe in dem parseubb folgende Zeile eingefügt:
Quote
$text = preg_replace("#\[php\](.*?)\[\/php\]#esi","highlight_code_php('\\1'",$text);



und als eigentliche Highlight-Funktion dann:
Quote
function highlight_code_php($code) {

$html_entities_match = array( "|\<br \/\>|", "#<#", "#>#", "|'|", '#"#', '# #' );
$html_entities_replace = array( "\n", '<', '>', "'", '"', ' ' );
$code = preg_replace( $html_entities_match, $html_entities_replace, $code );
$code = str_replace('<', '<', $code);
$code = str_replace('>', '>', $code);

//$geshi =& new GeSHi($source, $language);
$geshi =& new GeSHi($code, "php";

$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS, 0);
$geshi->set_overall_style('color: #000066; border: 2px solid #d0d0d0; background-color: #f0f0f0;', true);
$geshi->set_line_style('font-family: Verdana, Arial; font-size: 90%; color: #003030;', 'font-weight: bold; color: #006060;', true);
$geshi->set_code_style('color: #000020;', 'color: #000020;';

$code = $geshi->parse_code();
return $code;
}



WO ist der Fehler ???



Der Chef.
Bearbeitet von admin am 12.05.2007 20:34
http://www.wuschelkiste.de/fusion/  
Autor RE: php highlighting   8 # 64 top
admin
Oberhäuptling


User Avatar


Threadstarter

Beiträge: 908

Eingetreten: 19.03.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 12.05.2007 22:55  

So ... das neue Highlighting ist nun aktiviert und kann genutzt werden.
Hier mal Beispiele für die möglichen Codes.

Code: PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
while($data = dbarray($result)) {<br />
        $tbl = "tbl".(($count++ % 2)+1);<br />
// zusatz<br />
$data2 = dbarray(dbquery("SELECT * FROM ".$db_prefix."posts WHERE thread_id='".$data['thread_id']."' ORDER BY post_id DESC LIMIT 1"));<br />
$post_message = $data2['post_smileys'] == 1 ? parsesmileys_shout($data2['post_message']) : $data2['post_message'];<br />
$post_message = phpentities(nl2br(parseubb($post_message)));<br />
        if($data['thread_locked']) {<br />
                $img = "folderlock.gif";<br />
        } else if(iMEMBER && $data['thread_lastpost'] > $lastvisited) {<br />
                $img = "foldernew.gif";<br />
        } else {<br />
                $img = "folder.gif";<br />
        }<br />
        echo "<tr><br />
        <td class='$tbl'><img src='"
.THEME."forum/$img' alt=''></td><br />
        <td class='$tbl'><a href='"
.FORUM."viewthread.php?forum_id=".$data['forum_id']."&thread_id=".$data['thread_id']."&pid=".$data['last_id']."#post_".$data['last_id']."' title=\"header=[&nbsp;".str_replace("]", "]]", str_replace("[", "[[", trimlink($data['thread_subject'], 32)))."] body=[".str_replace("]", "]]", str_replace("[", "[[", trimlink($post_message, 250)))."] delay=[0] fade=[on]\"><b>".trimlink($data['thread_subject'], 35)."</b></a></span><br />
        <br>--> "
.$data['forum_name']."</td> <br />
<br />
        <td align='center' class='$tbl' style='white-space:nowrap'>"
.($data['count_posts']-1)."<br><small>(".$data['thread_views']." ".($data['thread_views']==1 ? "Hit" : "Hits")."</small></td><br />
        <td class='$tbl' align='right' style='white-space:nowrap'>"
.showdate("forumdate", $data['thread_lastpost'])."<br><a href='".BASEDIR."profile.php?lookup=".$data['thread_lastuser']."'>".$data['last_user']."</a></td><br />
</tr>\n"
;<br />
}<br />
if(dbrows($result)) {<br />
        echo "</tbody><br />
</table>\n"
;<br />
}



Code: CSS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#globalnav A.here:link, #globalnav A.here:visited {<br />
position : relative;<br />
z-index : 102;<br />
}<br />
<br />
a {<br />
color : #343365;<br />
text-decoration : none;<br />
font-size : 11px;<br />
font-weight : normal;<br />
font-family : Verdana, Arial, Helvetica, sans-serif;<br />
}<br />
a:hover {<br />
color : #5756A9;<br />
text-decoration : underline;<br />
font-size : 11px;<br />
font-weight : normal;<br />
font-family : Verdana, Arial, Helvetica, sans-serif;<br />
}<br />
a.side {<br />
color : #3E2F00;<br />
text-decoration : none;<br />
font-size : 10px;<br />
font-weight : bold;<br />
font-family : Verdana, Arial, Helvetica, sans-serif;<br />
}



Code: HTML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<h2 id="contents">Contents</h2><br />
<br />
<ul><br />
        <li><a href="#introduction">1. Introduction</a></li><br />
        <ul><br />
                <li><a href="#features">1.1 Features</a></li><br />
                <li><a href="#about-geshi">1.2 About GeSHi</a></li><br />
                <li><a href="#credits">1.3 Credits</a></li><br />
                <li><a href="#feedback">1.4 Feedback</a></li><br />
        </ul><br />
<br />
        <li><a href="#the-basics">2. The Basics</a></li><br />
        <ul><br />
                <li><a href="#getting-geshi">2.1 Getting GeSHi</a></li><br />
                <li><a href="#installing-geshi">2.2 Installing GeSHi</a></li><br />
                <ul><br />
                        <li><a href="#requirements">2.2.1 Requirements</a></li><br />
                        <li><a href="#extracting-geshi">2.2.2 Extracting GeSHi</a></li><br />
                        <li><a href="#installation">2.2.3 Installation</a></li><br />
                </ul><br />
                <li><a href="#basic-usage">2.3 Basic Usage</a></li><br />
        </ul><br />



Code: Javascript
1
2
3
4
5
6
7
8
9
10
11
12
function flipBox(who) {<br />
        var tmp; <br />
        if (document.images['b_' + who].src.indexOf('_on') == -1) { <br />
                tmp = document.images['b_' + who].src.replace('_off', '_on');<br />
                document.getElementById('box_' + who).style.display = 'none';<br />
                document.images['b_' + who].src = tmp;<br />
        } else { <br />
                tmp = document.images['b_' + who].src.replace('_on', '_off');<br />
                document.getElementById('box_' + who).style.display = 'block';<br />
                document.images['b_' + who].src = tmp;<br />
        } <br />
}



Code: SQL
1
2
3
4
5
6
7
8
9
10
11
CREATE TABLE pdp_cats (<br />
        cat_id smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,<br />
        top_cat smallint(5) UNSIGNED NOT NULL DEFAULT '0',<br />
        cat_name varchar(50) NOT NULL DEFAULT '',<br />
        cat_desc varchar(255) NOT NULL DEFAULT '',<br />
        cat_sorting varchar(50) NOT NULL DEFAULT 'name ASC',<br />
        cat_access tinyint(3) UNSIGNED DEFAULT '0',<br />
        cat_upload_access tinyint(3) UNSIGNED DEFAULT '103',<br />
        cat_order smallint(5) UNSIGNED NOT NULL DEFAULT '0',<br />
        PRIMARY KEY (cat_id)<br />
) TYPE=MyISAM;



Zu beachten ist höchstens die Kleinigkeit, dass die Nummerierung nur dann auch bei 1 am Code anfängt, wenn nach dem [geshi ] auch die direkt der Code geschrieben wird ...



Der Chef.
Bearbeitet von admin am 12.05.2007 23:13
http://www.wuschelkiste.de/fusion/  
Autor RE: php highlighting   9 # 64 top
wibix
Admin




Beiträge: 86

Eingetreten: 01.05.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 13.05.2007 09:47  

wie sieht es eigentlich mit der performance von geshi & co. aus? gibt es da schon erfahrungen?

http://www.wibix.de  
Autor RE: php highlighting   10 # 64 top
admin
Oberhäuptling


User Avatar


Threadstarter

Beiträge: 908

Eingetreten: 19.03.07
Status: Offline


Verwarnstatus:
warningwarningwarningwarning
Eingetragen am 13.05.2007 09:58  
Quote
wibix schrieb:
wie sieht es eigentlich mit der performance von geshi & co. aus? gibt es da schon erfahrungen?



Nunja ... Du siehst es ja hier ... mach Dir selbst nen Bild.
Wer viel Codes verwendet, wird das sicherlich spüren ...
Alles kann man nicht haben ;-)



Der Chef.
http://www.wuschelkiste.de/fusion/  
Seite 1 von 7 1 2 3 4 > >>
Springe zu Forum:
runtime: 2.0401s / sql queries: 58 / sql time: 0.0723s