|
|
Latest News |
Latest Threads |
|
|
55.324 Posts & 4.945 Themen in 78 Foren |
|
|
|
|
Forensuche |
|
Suchbegriff |
Benutzerauswahl |
Ergebnisse anzeigen |
|
|
Warnung wegen Speicherplatzbelegung 37 Beiträge in diesem Thema |
|
|
|
|
|
15.01.2020 - 13:16 Uhr |
|
|
|
Moin ihr Lieben,
ich habe von meinem Host eine Mail mit folgendem Inhalt erhalten:
Zitat Der Benutzer Admin (teamtapert.de) hat sein Speicherplatzkontingent fast erreicht.
The account currently uses 94,12% (45,96 GB/48,83 GB) of its disk capacity.
The account currently has 35.488 files.
Entfernen Sie einige Dateien aus diesem Konto oder bitten Sie den Systemadministrator, das Speicherplatzkontingent des Kontos zu erhöhen. |
Kann es sein das da etwas mit unnützen Daten „vollmüllt“?
LG
mono
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von mono - 15.01.2020 - 13:17 Uhr |
|
|
|
|
|
|
|
|
|
|
17.01.2020 - 02:28 Uhr |
|
|
|
Nabend,
hast du denn schon mal selber geguckt? Also ob Datenbank oder im Dateisystem (über FTP) irgendwas ungewöhnlich ist?
Vielleicht hat ja jemand über den FTP / PHPKIT-Uploader (bei Inhaltsverwaltung) ein paar Dateien hochgeladen
|
|
|
|
|
|
|
|
|
|
17.01.2020 - 23:08 Uhr |
|
|
|
Mit der Datenbank kenne ich mich gar nicht aus, beim FTP kann ich nächste Woche mal am Laptop mit einem Backup vergleichen was da passiert sein könnte. Momentan habe ich nur mobile Geräte zur Verfügung und folgende Infos:
Mail vom 13. Januar:
"Der Benutzer „adm“ (teamtapert.de) hat sein Speicherplatzkontingent fast erreicht.
The account currently uses 81,36% (39,73 GB/48,83 GB) of its disk capacity.
The account currently has 35.332 files."
Mai vom 15. Januar:
"Der Benutzer „adm“ (teamtapert.de) hat sein Speicherplatzkontingent fast erreicht.
The account currently uses 94,12% (45,96 GB/48,83 GB) of its disk capacity.
The account currently has 35.488 files."
Mail von 16. Januar:
"Der Benutzer „adm“ (teamtapert.de) hat sein Speicherplatzkontingent erreicht.
The account currently uses 100,63% (49,14 GB/48,83 GB) of its disk capacity.
The account currently has 34.937 files."
Also innerhalb von drei Tagen knapp 10 GB mehr und insgesamt weniger files. Ob vor den Benachrichtigungen auch schon etwas dazu kam kann ich momentan nicht sagen. Während des Zeitraums ist von uns kein neuer Content erstellt worden. Ich kann mich auch nicht mehr auf der Website einloggen... sehr merkwürdig. Ich melde mich sobald ich mir das Backup anschauen konnte.
LG
mono
|
Dieser Beitrag wurde bereits 6 mal editiert, zuletzt von mono - 17.01.2020 - 23:24 Uhr |
|
|
|
|
|
|
|
|
|
|
18.01.2020 - 15:11 Uhr |
|
|
|
Ich glaube ich habe es gefunden: Der error_log ist 40 GB groß. Zum reinschauen ist er zu groß. Wir automatisch eine neue Datei erstellt wenn ich den lösche? Dann könnte ich den löschen und dann beim Neuen schauen, womit der voll läuft. Macht das Sinn?
Ich kann den error_log auch mit dem aus einem alten Backup ersetzen, da war er noch 18 MB groß.
LG
mono
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von mono - 18.01.2020 - 15:20 Uhr |
|
|
|
|
|
|
|
|
WEBI Unberechenbares Urgestein |
|
|
|
|
|
|
|
|
|
|
18.01.2020 - 20:12 Uhr |
|
|
|
Die solltest du getrost löschen können, so dass diese neu angelegt wird, sofern eben nicht mehr vorhanden. Andernfalls eine neue hinzufügen, unter selbiger Berechtigung (CHMOD + Nutzer). Im Anschluss definitiv mal hineinschauen, um in Erfahrung bringen zu können was dort so an Fehler anfallen. Ordentliche Lösung wäre natürlich das Beheben der Fehler, die schnellste wiederum das Deaktivieren der Fehlerarchivierung.
mfG
|
|
|
|
|
|
|
|
|
|
18.01.2020 - 23:17 Uhr |
|
|
|
Die Datei ist rausgelöscht. Jetzt klappts auch wieder mit dem Anmelden und unser Speicher liegt bei knapp 9 GB - jetzt ist wieder ordentlich Platz.
Die Datei hat sich wieder neu angelegt und liegt derzeit bei 3 MB. Wenn ich die Datei per Browser im cPanel öffne (jetzt geht das noch gut, aber sie wird dennoch beständig wieder größer) kommen vor allem Fehlermeldungen für folgende Pfade:
/home2/adm8872/public_html/hp/pkinc/cfg/galerie.php
/home2/adm8872/public_html/hp/pkinc/class/bbcode.php/home2/adm8872/public_html/hp/pkinc/class/bbcode.php
/home2/adm8872/public_html/hp/pkinc/public/contentarchive.php
Es sind eigentlich nur diese drei. Als ganze Zeile liest sich das dann so:
[18-Jan-2020 23:48:46 Europe/Berlin] PHP Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home2/adm8872/public_html/hp/pkinc/class/bbcode.php on line 324
https://cdn.discordapp.com/attachments/133015201858453504/668224252985475072/error_log
LG
mono und der Rest von teamtapert
EDIT: Das mit dem Anhang hat am Tablet nicht gefunzt - ich hoffe der Link zum error_log Protokoll funktioniert.
|
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von mono - 18.01.2020 - 23:22 Uhr |
|
|
|
|
|
|
|
|
|
|
20.01.2020 - 02:22 Uhr |
|
|
|
Nabend,
diese Fehlermeldungen sind fast nur Notice's-Meldungen (meist das eine Variable oder Konstante nicht definiert ist). Sollte im Prinzip mit diesen Code an bestimmten Stellen behoben sein:
| PHP-Quelltext $Varname = NULL; | |
Bei den Konstanten klappt das nicht ganz so einfach. Meisten haben diese einen fixen Wert, damit nachfolgende Scripte sich darauf berufen können.
Zum Beispiel hier:
| Quellcode [18-Jan-2020 23:43:31 Europe/Berlin] PHP Notice: Use of undefined constant bgConfigSubCatsSort - assumed 'bgConfigSubCatsSort' in ***/pkinc/cfg/galerie.php on line 151 | |
Hier wäre sicherlich sowas wie das normal:
| PHP-Quelltext Define('bgConfigSubCatsSort', 'ASC'); | |
Weiss jetzt aber nicht, ob ich das Script bei mir irgendwo habe. Kann also nicht nachgucken o.O"
--
Aber es gibt auch solche Meldungen:
| Quellcode [18-Jan-2020 23:39:26 Europe/Berlin] PHP Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ***/pkinc/class/bbcode.php on line 359 | |
Die Funktion preg_replace() ( Klick mich - siehe Punkt Changelog) wurde mit PHP 5.5.0 als veraltet, und mit PHP 7.0 komplett entfernt gelistet.
In diesen Fall also nur veraltet (Deprecated). Sollte aber irgendenwann der Serverbetreiber auf PHP 7 updaten wird jeder Text bei Artikel, Forenbeiträgen, alle möglichen Kommentare einfach nicht mehr angezeigt.
Dieses Thema hatten wir hier schon mal gehabt: PHP 7
Kurzfassung:
Problem gelöst. In den verlinkten Post wurde die Standard-Datei pkinc/class/bbcode.php soweit angepasst, das die obige veraltete / gelöschte Funktion wieder funktioniert (mit einer andere Funktion [preg_replace_callback()] getauscht).
DustFireSky hatte dann nochmal das ganze für seine Erweiterung ASCE angepasst (und noch ein paar weitere kleine Fixe eingebaut).
Es scheint auch nur die obige bbcode.php mit der Meldung gelistet zu sein.
--
Was diese Meldungen angeht:
| Quellcode [18-Jan-2020 22:39:20 UTC] PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in ***/pkinc/main.php on line 73 | |
Das hatten wir hier auch im PHP 7-Thread von oben (siehe Post #4).
Worum gehts:
Die Funktion date() benötigt für die ZEITEN die Info in welcher Zeitzone man ist. Da diese fehlt wird auf "UTC" gestellt.
Man kann die Zeitzone in der PHP.ini einstellen. Oder z.B. auch als .htaccess im Root-Verzeichnis des PHPKIT. Oder auch direkt im Script.
Das Problem (was ich damals in o.g. Thread irgendwie total nicht gesehen habe .. ^^"""):
In Zeile 73 wird die Funktion date() aufgerufen:
| PHP-Quelltext define('pkTIMETODAY', mktime(0,0,0,date('m',pkTIME),date('d',pkTIME),date('Y',pkTIME))); | |
Die Zeitzone im Script vom PHPKIT wird aber erst in Zeile ~283 definiert:
| PHP-Quelltext // configuration use
date_default_timezone_set(pkGetConfig('time_zone')); | |
Also erst SPÄTER. Man müsste also die Stelle von Zeile 73 hinter Zeile ~283 schubsen. Da ich aber jetzt nicht genau weis, inwieweit es da zu Problemem kommen kann .. Erstmal so lassen ^^""
Oder halt über die PHP.ini oder als .htaccess-Datei im Root-Verzeichniss vom PHPKIT.
--
Sonst scheinen keine weiteren Fehlerarten (also nur die Notice etc.) im Log zu sein.
Die Frage ist jetzt:
- Die ganzen Fehler im Script beheben? Sind ja jetzt nicht soooo viele - glaub so ~20? In vll. 5 Dateien?
Wenn du diese behben möchtest können wir hier das soweit wie möglich beheben.
Entweder du lädst die Dateien hier als Anhang hoch, oder irgendwo anders und verlinkst diese hier, oder du postest den Inhalt hier (dann via. BB-Code Klapptext und Code / PHP).
Die Dateien:
- /public_html/hp/pkinc/main.php
- /pkinc/class/session.php
- /pkinc/class/bbcode.php
- /pkinc/cfg/galerie.php
- /pkinc/public/galerie_pic.php
- /pkinc/class/galerie.php
- /pkinc/public/article.php
- /pkinc/publicinc/navbox.bgpotm.php
- /pkinc/publicinc/birthday_bot.php
- /pkinc/public.php
- /pkinc/public/contentarchive.php
- /pkinc/func/default.php
Okay, sind doch etwas mehr Dateien ^^""" Keine Ahnung ob das jetzt wirklich alle sind. Hab jetzt zumindest keine weiteren beim groben durchgucken gesehen ô.o"
- Oder die Log-Datei gar nicht erstellen lassen.
Kannst du da irgendwas einstellen? Z.B. das keine Notice-Meldungen gelistet werden sollen?
- Oder regelmäsig die Log-Datei löschen ;o
|
|
|
|
|
|
|
|
|
|
20.01.2020 - 23:52 Uhr |
|
|
|
Nabend,
ich würde die Fehler mit deiner Hilfe am liebsten beheben, schließlich soll es die Seite noch so lange wie möglich geben.
Zitat Kannst du da irgendwas einstellen? Z.B. das keine Notice-Meldungen gelistet werden sollen? |
Puh, davon habe ich bisher noch nichts gesehen, wo müsste ich denn nachgucken?
War gerade schon dabei die bbcode.php wie im PHP 7-Thread gezeigt anzupassen, als ich bemerkte, dass meine Datei wahrscheinlich zu sehr von der Standard-Datei abweicht. Ich habe da so einiges abgeändert und diesen Code hier haben ich in unserer bbcode.php zwei mal gefunden:
| PHP-Quelltext $pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU"; | |
Hab die Dateien hier hochgeladen. Der aktuellen error_log, der inzwischen schon wieder auf 1,7 GB gewachsen ist, ist ebenfalls dabei.
Vielen Dank für die Hilfe und LG
mono
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von mono - 20.01.2020 - 23:53 Uhr |
|
|
|
|
|
|
|
|
|
|
21.01.2020 - 16:14 Uhr |
|
|
|
Nabend ;o
Zuallerst:
Zitat Original geschrieben von mono
Hab die Dateien hier hochgeladen. Der aktuellen error_log, der inzwischen schon wieder auf 1,7 GB gewachsen ist, ist ebenfalls dabei. |
Kannst du diese in eine ZIP-Datei oder eine andere Pack-Datei hochladen? In dieser Form kann ich diese nicht runterladen. Entweder ist kein Inhalt drin, oder es kommt die interne Fehlermeldung vom PHPKIT (Direct access to this location is not permitted.).
Zitat Original geschrieben von mono
Nabend,
Zitat Kannst du da irgendwas einstellen? Z.B. das keine Notice-Meldungen gelistet werden sollen? |
Puh, davon habe ich bisher noch nichts gesehen, wo müsste ich denn nachgucken? |
Hab da mal ein bisschen geguckt. Bei einen Anbieter sah ich nur die Option "ErrorLog Aktiv / Inaktiv". Wird wahrscheinlich bei den meisten anderen auch so sein ô.o
Konnte aber bei PHP etwas anderes finden. Und zwar kann man, wenn ich das richtig verstanden habe, direkt in PHP die ErrorLog einstellen.
PHP - error_reporting()
Bei den Beispielen ist folgender Eintrag mit bei:
| PHP-Quelltext // Melde alle Fehler außer E_NOTICE
error_reporting(E_ALL & ~E_NOTICE); | |
Das wäre fast genau was nötig wäre.
Wenn man noch ~E_DEPRECATED hinzufügen würde müssten alle Fehlermeldungen vom Typ Notice und Deprecated im ErrorLog nicht mehr gespeichert werden.
Für das PHPKIT sähe das dann so aus:
- pkinc/main.php
- Öffne o.g. Datei und suche das (Zeile ~47 - 51):
| PHP-Quelltext else
{
@error_reporting(0);
@ini_set( 'display_errors', 0 );
} | |
Und mache daraus das:
| PHP-Quelltext else
{
#@error_reporting(0);
@error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
@ini_set( 'display_errors', 0 );
} | |
E_ALL ist wie vorher die 0 in der Klammer. Und durch die ~ sollten die beiden Fehlermeldungenstypen nicht mehr mitgespeichert werden.
Sofern das funktioniert und ausreichen sollte (höchsten vll. noch die PHP7-Sache unten) wäre das eigentliche Problem gelöst, oder?;o
Zitat Original geschrieben von mono
War gerade schon dabei die bbcode.php wie im PHP 7-Thread gezeigt anzupassen, als ich bemerkte, dass meine Datei wahrscheinlich zu sehr von der Standard-Datei abweicht. Ich habe da so einiges abgeändert und diesen Code hier haben ich in unserer bbcode.php zwei mal gefunden:
| PHP-Quelltext $pattern = "#[(".$code['tag'].")](.*)[/\1]#eisuSU"; | | |
Die gesuchte Stelle ansich gibt es zweimal. Einmal in Zeile 245 und die andere in Zeile 265. In diesen Fall reicht der erste Treffer in Zeile 245, da die zweite Stelle später nochmal kommt (beim dritten Suchpart im Thread).
Aber wenn einige Änderungen mit drin sind ist es vielleicht besser diese hochzuladen, hier anhängen oder direkt hier in den Code/PHP-BBCode posten
|
|
|
|
|
|
|
|
|
|
21.01.2020 - 19:38 Uhr |
|
|
|
Einen wunderschönen guten Abend
Zitat Original geschrieben von k!r!ka
Zitat Original geschrieben von mono
Hab die Dateien hier hochgeladen. Der aktuellen error_log, der inzwischen schon wieder auf 1,7 GB gewachsen ist, ist ebenfalls dabei. |
Kannst du diese in eine ZIP-Datei oder eine andere Pack-Datei hochladen? In dieser Form kann ich diese nicht runterladen. Entweder ist kein Inhalt drin, oder es kommt die interne Fehlermeldung vom PHPKIT (Direct access to this location is not permitted.). |
Habs als ZIP-Datei hochgeladen: *klick*
Zitat Für das PHPKIT sähe das dann so aus:
- pkinc/main.php
- Öffne o.g. Datei und suche das (Zeile ~47 - 51):
| PHP-Quelltext else
{
@error_reporting(0);
@ini_set( 'display_errors', 0 );
} | |
Und mache daraus das:
| PHP-Quelltext else
{
#@error_reporting(0);
@error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
@ini_set( 'display_errors', 0 );
} | |
|
Habs ersetzt und den error_log gelöscht.
Zitat
Sofern das funktioniert und ausreichen sollte (höchsten vll. noch die PHP7-Sache unten) wäre das eigentliche Problem gelöst, oder?;o |
Na wenn man den bedenkenlos weglassen kann ist das eine wunderbar pragmatische Lösung ^^
Zitat
Aber wenn einige Änderungen mit drin sind ist es vielleicht besser diese hochzuladen, hier anhängen oder direkt hier in den Code/PHP-BBCode posten |
Die bbcode.php ist mit in der ZIP oder direkt hier:
Hier klicken zum aufklappen 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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 | | PHP-Quelltext <?php
# PHPKIT WCMS | Web Content Management System
#
#
# YOU ARE NOT AUTHORISED TO CREATE ILLEGAL COPIES OF THIS
# FILE AND/OR TO REMOVE THIS INFORMATION
#
# SIE SIND NICHT BERECHTIGT, UNRECHTMÄSSIGE KOPIEN DIESER
# DATEI ZU ERSTELLEN UND/ODER DIESE INFORMATIONEN ZU ENTFERNEN
#
# This file / the PHPKIT software is no freeware! For further
# information please visit our website or contact us via email:
#
# Diese Datei / die PHPKIT Software ist keine Freeware! Für weitere
# Informationen besuchen Sie bitte unsere Website oder kontaktieren uns per E-Mail:
#
# email : info@phpkit.com
# website : http://www.phpkit.com
# licence : http://www.phpkit.com/licence
# copyright : Copyright (c) 2002-2012 mxbyte gbr | http://www.mxbyte.com
class pkBbcode
{
/**
*
* @var NULL|array
*/
static protected $_censor = NULL;
protected $text = '';
var $urldetect=1;
var $urlcut=1;
var $urlmaxwidth=60;
var $urlwidth1=50;
var $urlwidth2=-10;
#Multi Video Station kit-coding.de ANFANG
var $count=1;
#Multi Video Station kit-coding.de ENDE
#Code Parser der KNW Community ANFANG
var $codecount=0;
var $phpcodecount=1;
#Code Parser der KNW Community ENDE
var $censoruse=1;
var $imageresize=0;
var $textmaxlength=0;
protected $parse_bbcode = 1;
protected $parse_smilies = 1;
protected $parse_html = 0;
protected $parse_images = 1;
protected $smilies_search = array();
protected $smilies_replace = array();
protected $censorreplace = '*';
protected $censor_badword_hash = array();
var $bbhash='';
var $smiliehash='';
/**************************************** FSK HACK Anfang ****************************************/
var $fsktag=array('tag'=>'fsk','html'=>'{text}');
/**************************************** FSK HACK Ende ****************************************/
protected $urldetect_search = array(
# '#(? ?<!http://|https://|ftp://|ftps://)(www\.([^\s]*)))#iuS', #not working cause every char is allowed in urls
// BBCode '#(? ?<!img]|mgl]|mgr]|url]|lightbox]|url=|[url|ef="|rc="|on="])((ht|f)tp(s?)://([^\s]*)))#iuS', #clean except links as linktext
// BBCode [url] Fix by PimpYourKiT.de & Lightbox BBCode by PimpYourKiT.de
);
protected $urldetect_replace = array(
# '\\1', #not working cause every char is allowed in urls
'[url]\\1" class="hidelink" target="_blank"> Fix by PimpYourKiT.de & Lightbox BBCode by PimpYourKiT.de
'#(? ?<!img]|mgl]|mgr]|url]|lightbox]|url=|[url|ef="|rc="|on="])((ht|f)tp(s?)://([^\s]*)))#iuS', #clean except links as linktext
// BBCode [url] Fix by PimpYourKiT.de & Lightbox BBCode by PimpYourKiT.de
);
protected $urldetect_replace = array(
# '\\1', #not working cause every char is allowed in urls
'[url]\\1',
);
#@Method: __construct
#@Access: public
#@Param: void
#@Return: void
#@Desc: Constructor. Predefines smilies, bbcodes, and censor words.
public function __construct()
{
$this->_initCensor();
$this->bbhash = pkCfgData('bbcode');
// IMG URL BBCode by PimpYourKiT.de
$this->replace_img_url($options,$text);
// IMG URL BBCode by PimpYourKiT.de
#censorlist
$badwords = pkGetConfig('censor_badword');
$badwords = is_string($badwords) ? $badwords : '';
$badwords = explode("\n", $badwords);
$this->censor_badword_hash = $badwords;
}
/**
*
* @param void
* @return array
*/
public function getCensor()
{
return self::$_censor;
}
#@Method: parse
#@Access: public
#@Param: string text
#@Param: bool html
#@Param: bool bb
#@Param: bool smilies
#@Param: bool images
#@Param: bool censor
#@Param: bool imageresize
#@Param: bool textmaxlength
#@Return: string
#@Desc: Primary method to parses texts.
public function parse($text='',$html=0,$bb=0,$smilies=0,$images=0,$censor=0,$imageresize=0,$textmaxlength=0)
{
if(empty($text))
{
return '';
}
$this->text = ' '.$text.' '; #s simple solution for smiles and other tags at the beginning to be parsed when containing a leading blank-space
$this->imageresize = $imageresize;
$this->textmaxlength = $textmaxlength;
$this->urlmaxwidth = $textmaxlength;
$this->urlmaxwidth ? NULL : $this->urlcut=0;
$this->parse_bbcode = $bb ? 1 : 0;
$this->parse_smilies = $smilies ? 1 : 0;
$this->parse_images = $images ? 1 : 0;
$this->parse_html = $html ? 1 : 0;
// Smilie Klammer Fix by PimpYourKiT.de
#smilies
$obj = new smilies;
$array = $obj->getSmilieCache();
$array = is_array($array) ? $array : array();
foreach($array as $smilie)
{
$this->smilies_search[] = $this->parse_html == 1 ? $smilie['smilie_code'] : pkEntities($smilie['smilie_code']);
$this->smilies_replace[] = '<img src="'.$smilie['smilie_path'].'" alt="'.$smilie['smilie_title'].'" />';
}
// Smilie Klammer Fix by PimpYourKiT.de
#should be removed in the future, sessions ID are not visible anymore
$this->text = pkRemoveSessionId($this->text);
#censor
if($censor)
{
$this->textcensor();
}
#urldetect - not when html is active
if($this->urldetect && !$this->parse_html)
{
$this->urldetect();
}
$this->text = $this->parse_html ? $this->prepare_html($this->text) : pkEntities($this->text);
if(!$this->parse_images)
{
$this->remove_images();
}
if($this->parse_bbcode)
{
$this->parse_bbcode();
}
if($this->parse_smilies)
{
$this->parse_smilies();
}
$this->text = nl2br($this->text);
// Multi Video Station kit-coding.de ANFANG
$this->text=$this->videoparse($this->text);
// Multi Video Station kit-coding.de ANFANG
#html allowed
if($this->parse_html)
{
$this->text = str_replace('"','"',$this->text);
}
else
{
$this->text = preg_replace("/(vb|java)script:/i","\\1 script:",$this->text);
}
/**************************************** FSK HACK Anfang ****************************************/
$this->text=$this->fskparse($this->text);
/**************************************** FSK HACK Ende ****************************************/
if($this->textmaxlength)
{
$this->text = pk::txtwrap($this->text,$this->textmaxlength);
}
#remove not need whitespaces
$this->text = trim($this->text);
return $this->text;
}
#@END Method: parse
#@Method: prepare_html
#@Access: protected
#@Param: string text
#@Return: string
#@Desc:
// Tabellenfreiraum Fix by PimpYourKiT.de
function prepare_html($text='')
{
$tags_array = array('table','tr','td','th','tbody','div','p');
for($i=0;$i<count($tags_array);$i++)
{
if(isset($tags) && $tags != '')
$tags .= '|';
$tags .= $tags_array[$i];
}
eval("\$text=preg_replace(\"#<(".$tags."){1,}(.*)>([\\r|\\n])[\\s]{1,}#iUs\",\"<\\\\1\\\\2>\",\$text);");
eval("\$text=preg_replace(\"#</(".$tags."){1,}>([\\r|\\n])[\\s]{1,}#iUs\",\"</\\\\1>\",\$text);");
return str_replace('"',""",$text);
}
// Tabellenfreiraum Fix by PimpYourKiT.de
#@END Method: prepare_html
#@Method: urldetect
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function urldetect()
{
$this->text = preg_replace($this->urldetect_search,$this->urldetect_replace,$this->text);
}
#@END Method: urldetect
#@Method: parse_bbcode
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function parse_bbcode()
{
$text = &$this->text;#reference - for a smarter use
#search & replace standard bbcodes
foreach($this->bbhash as $code)
{
switch($code['type'])
{
case 'single' :
$text = preg_replace("#\[".$code['tag']."\]#isuSU",$code['html'],$text);
break; #END case single
case 'double' :
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU";
$text = preg_replace($pattern,"\$this->replace_bbcode('$code[html]','\\3','\\2')",$text);
break; #END case double
// Lightbox BBCode by PimpYourKiT.de
case 'lightbox' :
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->lightbox('\\2','\\3')",$text);
break;
// Lightbox BBCode by PimpYourKiT.de
// HTML BBCode by PimpYourKiT.de
case 'htmlcode' :
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->htmlcode('\\2','\\3')",$text);
break;
// HTML BBCode by PimpYourKiT.de
/* PDF BBCode by pimpyourkit.de */
case 'pdf' :
$text = preg_replace("#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU","\$this->pdf('\\2','\\2')",$text);
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->pdf('\\2','\\3')",$text);
break;
/* PDF BBCode by pimpyourkit.de */
// Edit BBCode by PimpYourKiT.de
case 'edit' :
$text = preg_replace("#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU","\$this->edit('\\2')",$text);
break;
// Edit BBCode by PimpYourKiT.de
// Spoiler BBCode by PimpYourKiT.de
case 'spoiler' :
$text = preg_replace("#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU","\$this->spoiler('\\3','\\2')",$text);
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->spoiler('\\2','\\3')",$text);
break;
// Spoiler BBCode by PimpYourKiT.de
case 'img' :
if($this->parse_images)
{
// IMG URL BBCode by PimpYourKiT.de
$text = preg_replace("#\[(".$code['tag'].")=(.*)\]([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))([\s]?)\[/\\1\]#eisuSU","\$this->replace_img_url('\\2','\\3')",$text);
// IMG URL BBCode by PimpYourKiT.de
$pattern = "#\[(".$code['tag'].")]([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))([\s]?)\[\/\\1\]#eiU";
$text = preg_replace($pattern,"\$this->replace_image('$code[html]','\\2')",$text);
}
break; #END case img
case 'url' :
$func = 'replace_url';
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU"; #format: link
$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2')",$text);
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU"; #format text
$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2','\\3')",$text);
break; #END case url
#Code Parser der KNW Community ANFANG
case 'parser' :
$func = 'highlight_phpcode';
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU";
$text = preg_replace($pattern,"\$this->$func('\\2','\\1')",$text);
break;
#Code Parser der KNW Community ENDE
case 'list' :
default :
$func = 'replace_bbcode';
$func = $code['type']=='list' ? 'replace_list' : $func;
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU";
while(preg_match($pattern,$text))
{
$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2')",$text);
}
break; #END default
}#END switch
}#END foreach bbhash
}
#@END Method: parse_bbcode
#@Method: parse_smilies
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function parse_smilies()
{
$this->text = str_replace($this->smilies_search,$this->smilies_replace,$this->text);
}
#@END Method: parse_smilies
/* IMG URL BBCode by PimpYourKiT.de */
#@Method: replace_img_url
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: img to url
protected function replace_img_url($options,$text = '')
{
$link = str_replace(','',$text);
$this->urldetect = 0;
if($this->imageresize)
$link = pkLinkFx('rsimg','src='.base64_encode($link));
return $this->text = '<a href="'.$options.'" target="_blank"><img src="'.$link.'" border="0" alt="" title="" /></a>';
}
#@END Method: replace_img_url
/* IMG URL BBCode by PimpYourKiT.de */
// Lightbox BBCode by PimpYourKiT.de
#@Method: lightbox
#@Access: protected
#@Param: string text
#@Param: string text
#@Return: string
#@Desc: JQuery prettyPhoto lightbox
protected function lightbox($options,$text = '')
{
define('LBOXH',210); //--> Max. Hˆhe des Thumbnails (Standard 210 )
define('LBOXW',250); //--> Max. Breite des Thumbnails (Standard 250 )
define('LBOXMH',FALSE); //--> ( TRUE => max. Hˆhe aktiviert || FALSE => max. Hˆhe nicht aktiviert )
if(preg_match('/(jpg|png|gif|jpeg)/i',$options))
{
$this->text = $text ? $text : $options;
$this->imagesize = @getimagesize($options);
$this->width = (LBOXW < $this->imagesize[0]) ? 'width="'.LBOXW.'"' : 'width="'.$this->imagesize[0].'"';
$this->height = (LBOXH < $this->imagesize[1]) ? 'height="'.LBOXH.'"' : 'height="'.$this->imagesize[1].'"';
$this->height = LBOXMH === TRUE ? $this->height : NULL;
return '<a href="'.$options.'" rel="prettyPhoto[pp_gal]" title="'.$this->text.'"><img '.$this->width.$this->height.' src="'.$options.'" alt="" title="" /></a>';
}
elseif(preg_match('/(http|www)/i',$options))
{
$this->text = $text ? $text : $options;
return '<a href="'.$options.'?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" title="'.$this->text.'">'.$this->text.'</a>';
}
else
{
$this->rid = rand(1,1000);
$this->text = $text ? $text : 'Inline Lightbox Text';
return '<a href="#inline-'.$this->rid.'" rel="prettyPhoto" title="'.$this->text.'">'.$this->text.'</a>
<div id="inline-'.$this->rid.'" class="hide">
<p>'.$options.'</p>
</div>';
}
}
#@END Method: lightbox
// Lightbox BBCode by PimpYourKiT.de
// HTML BBCode by PimpYourKiT.de
#@Method: htmlcode
#@Access: protected
#@Param: int
#@Param: string text
#@Return: string
#@Desc: allows html code
protected function htmlcode($options,$text = '')
{
define('SECURITYHTML',battleonx24);
$this->text = str_replace(array("\r\n","\r","\n","\t"),'',$text);
if($options == SECURITYHTML)
return html_entity_decode($this->text);
return $this->text;
}
#@END Method: htmlcode
// HTML BBCode by PimpYourKiT.de
/* PDF BBCode by pimpyourkit.de */
#@Method: pdf
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: create embedded pdf documents
protected function pdf($options= '',$text = '')
{
/* definitions */
define('PDFMAXWIDTH', 550);
define('PDFMAXHEIGHT', 1500);
define('PDFMINWIDTH', 300);
define('PDFMINHEIGHT', 300);
define('PDFSTANDARDWIDTH', 400);
define('PDFSTANDARDWIDTH', 400);
$this->text = preg_replace("/\[url\](.*)\[\/url\]/",'$1',$text);
$this->split = explode(',',$options);
if(!strpos($text,'.pdf'))
return '<span style="padding: 10px; color: #C00; border: 1px solid #C00; background-color: #FEE;">Das PDF Dokument konnte nicht geladen werden.</span>';
if($this->split[1] && (($this->split[0] <= PDFMAXWIDTH && $this->split[1] <= PDFMAXHEIGHT) && ($this->split[0] >= PDFMINWIDTH && $this->split[1] >= PDFMINHEIGHT)))
{
$this->width = $this->split[0];
$this->height = $this->split[1];
}
else
{
$this->width = PDFSTANDARDWIDTH;
$this->height = PDFSTANDARDWIDTH;
}
$this->text = '<img src="fx/default/bbcode/pdf.gif" alt="" title="" /> <span style="font-weight: bold; font-size: 14px;">PDF Dokument</span><iframe src="http://docs.google.com/gview?url='.$this->text.'&embedded=true" style="margin: 10px; padding: 10px; background: #EBEBEB; border: 1px solid #CCC; width: '.$this->width.'px; height: '.$this->height.'px;" frameborder="0"></iframe>';
return $this->text;
}
#@END Method: pdf
/* PDF BBCode by pimpyourkit.de */
// Edit BBCode by PimpYourKiT.de
#@Method: edit
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: shows div container boxes
protected function edit($text = '')
{
global $SQL, $forumthread, $forumpost;
$result = $SQL->fetch_array($SQL->query("SELECT
forumpost_autorid,
forumpost_autor,
forumpost_edittime,
forumpost_editautor
FROM ".pkSQLTAB_FORUM_POST."
WHERE forumpost_threadid= '".$SQL->i($forumthread['forumthread_id'])."' AND forumpost_id='".$SQL->i($forumpost['forumpost_id'])."' LIMIT 1"));
$this->timeedit = date("d.m.y - H:i",$result['forumpost_edittime'] + 3600);
$userresult = $SQL->fetch_array($SQL->query("SELECT
user_id,
user_nick
FROM ".pkSQLTAB_USER."
WHERE user_nick='".$SQL->f($result['forumpost_editautor'])."' LIMIT 1"));
return '<img src="fx/default/bbcode/edit/edit.png" border="0" alt="Editiert" title="Editiert" /> <span style="color:#CC0000; font-style:italic; font-weight:bold;"> Thema wurde am '.$this->timeedit.' Uhr von <a href="?path=userinfo&id='.$userresult['user_id'].'">'.$userresult['user_nick'].'</a> editiert:</span><div style="padding-top: 10px;">'.$text.'</div>';
}
#@END Method: edit
// Edit BBCode by PimpYourKiT.de
// Spoiler BBCode by PimpYourKiT.de
#@Method: spoiler
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: shows spoiler
protected function spoiler($options = '',$text = '')
{
$this->users = array('admin','mod','vip','member','user','guest');
$this->split = explode(',',$options);
$this->split[0] = $this->split[0] && in_array($this->split[0],$this->users) ? $this->split[0] : 'guest';
$this->headtext = $this->split[1]? 'Spoiler: '.$this->split[1]: 'Spoiler';
$this->randomid = mt_rand();
if(getrights($this->split[0]))
{
return '<table class="data-table"><tr class="head"><td><img src="./../fx/default/bbcode/spoiler/spoiler.png" style="display: inline; vertical-align: middle;" alt="" title="" />'.$this->headtext.'</td></tr><tr class="even_info"><td><span class="textopen" id="colapse'.$this->randomid.'" style="cursor: pointer;"><img src="./../fx/default/bbcode/spoiler/plus.png" id="colapse'.$this->randomid.'img" alt="" title="Hier klicken zum aufklappen" style="border-style:none;" /> <span id="colapse'.$this->randomid.'text" style="text-decoration:underline;"><i>Hier klicken zum aufklappen</i></span></span><div id="colapse'.$this->randomid.'content" style="display:none;"><hr /><span style="padding: 15px 0;">'.$text.'</span><hr /></div></td></tr></table>';
}
return '<table class="data-table"><tr class="head"><td><img src="./../fx/default/bbcode/spoiler/spoiler.png" style="display: inline; vertical-align: middle;" alt="" title="" />Spoiler</td></tr><tr class="even_error"><td>Sie verfügen nicht über die benötigten Rechte zum anzeigen dieses Spoilers.</td></tr></table>';
}
#@END Method: spoiler
// Spoiler BBCode by PimpYourKiT.de
#@Method: replace_list
#@Access: protected
#@Param: string html
#@Param: string text
#@Param: string option
#@Return: string
#@Desc:
protected function replace_bbcode($html,$text,$option='')
{
$option = trim($option);
$option = empty($option) ? $text : $option;
$html = str_replace("{text}",$text,$html);
$html = str_replace("{option}",$option,$html);
return $html;
}
#@END Method: replace_bbcode
#@Method: replace_list
#@Access: protected
#@Param: string html
#@Param: string text
#@Return: string
#@Desc:
protected function replace_list($html,$text)
{
#need trim here to avoid empty cols between list-elements
#text should contains some li/* elements
$text = trim($text);
#empty list-tags (ul,ol,dl) arnt allowed - so return an empty string in this case
if(empty($text))
{
return '';
}
#replace correctly with <li></li> without linebreaks
$pattern = "#\[(li)\](.*)\[/\\1\]#isuSU";
$text = preg_replace($pattern,'<li>\\2</li>',$text);
#do we have simple sinlge tags?
if(strstr($text,'<li>'))
{
#split by the simple single tag <li>
$matches = explode('<li>',$text);
foreach($matches as $i=>$str)
{
$str = trim($str);#empty lines will be removed
if(empty($str))
{
unset($matches[$i]);
continue;
}
$matches[$i] = '<li>'.$str.'</li>';
}
$text = implode('',$matches);
}#END simple single tags
#created the whole list and clean it up
$text = str_replace("{text}",$text,$html);
$text = preg_replace("#(\/li|ul|ol type="a"|ol type="1")>(.*)*<(li|\/ol|\/ul){1}>#sSU",'\\1><\\3>',$text);#removes everything between list related tags
$text = $text==str_replace("{text}",'',$html) ? '' : $text; # if the list is now empty nothing will be displayed, otherwise it wouldnt not be valid XHTML
return $text;
}
#@END Method: replace_list
#@Method: replace_url
#@Access: protected
#@Param: string html
#@Param: string url
#@Param: [string text]
function replace_url($html,$url,$text='')
{
$url = trim($url);
$text = empty($text) ? $url : $text;
$text = trim($text);
if($this->urlcut && strlen($text)>$this->urlmaxwidth && !preg_match("/[><\[\]]/",$text))
{
$text = substr($text,0,$this->urlwidth1)."...".substr($text,$this->urlwidth2);
}
#prevent double-links when imageresize is on
if($this->imageresize && preg_match("/\<a (.*)<\/a>/i",$text))
{
return str_replace("\\"",""",$text);
}
// Interne URL Erkennung by PimpYourKiT.de
$url = preg_match('/http:\/\//i',$url) ? 'href="'.$url.'" target="_blank"' : 'href="'.$url.'" target="_self"';
// Interne URL Erkennung by PimpYourKiT.de
$str = str_replace("{text}",$text,$html);
$str = str_replace("{option}",$url,$str);
$str = str_replace("\\"",""",$str);
return $str;
}
#@END Method: replace_url
/**************************************** FSK HACK Anfang ****************************************/
function fskparse($text='') {
$code=$this->fsktag;
$text=preg_replace("#\[".$code['tag']."=(.*)\](.*)\[/".$code['tag']."\]#esiU","\$this->fskrewrite('\\1','\\2')",$text);
$text=str_replace("\\"",""",$text);
return $text;
}
function fskrewrite($age='', $text='') {
global $SQL;
if(!is_numeric($age)) return $text='<font><span style="color:#e00012;">Es sind bei BBCode_FSK nur Zahlen erlaubt</span></font>';
if(pkGetUservalue('id')=='') return $text='<font><span style="color:#e00012;">Um auf diesen Inhalt zuzugreifen, müssen Sie sich erst registrieren und Ihr Geburtsdatum angeben.</span></font>';
if($age=='6' OR $age=='12' OR $age=='16' OR $age=='18') {
$age_check=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_USER."` WHERE `user_id`='".intval(pkGetUservalue('id'))."' LIMIT 1"));
if($age_check['user_bd_day']>0 AND $age_check['user_bd_month']>0 AND $age_check['user_bd_year']>0)
$alter=getAge($age_check['user_bd_day'],$age_check['user_bd_month'],$age_check['user_bd_year']);
if(empty($alter)) return $text='<font><span style="color:#e00012;">Bitte geben Sie Ihr Geburtsdatum in Ihrem Profil an</span></font>';
if($age_check['user_change_age']>1) return $text='<font><span style="color:#e00012;">Sie haben Ihr Geburtstag bereits 1 x editiert. Bitte kontaktieren Sie einen Admin um Ihren Counter wieder auf Null zu setzen.</span></font>';
if($age=='6' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 6ten Lebensjahr zugreifen</span></font>';
elseif($age=='12' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 12ten Lebensjahr zugreifen</span></font>';
elseif($age=='16' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 16ten Lebensjahr zugreifen</span></font>';
elseif($age=='18' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 18ten Lebensjahr zugreifen</span></font>';
return $text='<table align="center" width="100%" class="standard" cellspacing="1" cellpadding="2"><tr><td class="heads"><font><span style="color:#cdb682;">Sie sind über '.$age.' Jahre alt und dürfen diesen Inhalt lesen.</span></font></td></tr><tr><td class="odd">'.$text.'</td></tr></table>';
} else return $text='<font><span style="color:#e00012;">Die Angabe '.age.' im BBCode ist ungültig.</span></font>';
}
/**************************************** FSK HACK Ende ****************************************/
#@Method: replace_ images
#@Access: protected
#@Param: string html
#@Param: string link
#@Return: string
#@Desc:
protected function replace_image($html,$link)
{
if($this->imageresize)
{
$html = '<a href="'.$link.'" target="_blank">'.$html.'</a>';
$link = pkLinkFx('rsimg','src='.base64_encode($link));
}
$str = str_replace("{image}",$link,$html);
return $str;
}
#@END Method: replace_image
#@Method: remove_images
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function remove_images()
{
$pattern = "#\[(/?)(img|imgr|imgl)\]#i";
$this->text = preg_replace($pattern,'[\\1url]',$this->text);
}
#@END Method: remove_images
#@Method: textcensor
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function textcensor()
{
$replacer = $this->censorreplace;
$censorlist = $this->getCensor();
if( empty( $censorlist ) || $this->censoruse != 1 )
{
return;
}
foreach( $censorlist as $badword )
{
$badword = trim( $badword );
if( empty( $badword ) )
{
continue;
}
// badword length
$len = strlen( $badword );
$replace = '';
// exact match
if( preg_match( "#\{(.*)\}#isU", $badword ) )
{
$len = $len - 2;
$replace = str_repeat( $replacer, $len );
$this->text = str_replace( $badword, " " . $replace . " ", $this->text );
}
else
{
$replace = str_repeat( $replacer, $len );
$this->text = str_replace( $badword, $replace, $this->text );
}
}
}
/**
*
* @param void
* @return object|self|PHPKIT_Frontend_Model_BBCode
*/
protected function _initCensor()
{
if( self::$_censor === NULL )
{
$badwords = pkGetConfig( 'censor_badword' );
$badwords = is_string( $badwords ) ? $badwords : '';
$badwords = explode( "\n", $badwords );
self::$_censor = $badwords;
}
return $this;
}
#Code Parser der KNW Community ANFANG
function highlight_phpcode($code,$tag){
if(strtolower($tag)=='php'){
$headlineS='PHP-Code Anfang:';
$headlineE='PHP-Code ENDE:';
$DivbgColor='FFF';
$DivTextColor='000';
$BorderColorDiv='FF7F00';
$TextColorHeadlines='FF7F00';
}else{
ini_set('highlight.comment','#FFFFFF');
ini_set('highlight.default','#FFFFFF');
ini_set('highlight.keyword','#FF7F00');
ini_set('highlight.string','#FF3333');
ini_set('highlight.html','#FFFFFF');
$headlineS='Shell Code Anfang:';
$headlineE='Shell ENDE:';
$DivbgColor='030303';
$DivTextColor='fff';
$BorderColorDiv='FFF';
$TextColorHeadlines='FF3333';
}
#Config
$CounterColor='FFF';
$LinkColor='FFF';
$trans = get_html_translation_table(HTML_ENTITIES);
$code =
strtr(
strip_tags(
str_replace("&","&",
str_replace("$","$",
str_replace("(","(",
str_replace(")",")",
str_replace("[","[",
str_replace("]","]",
str_replace("'",chr(39),
str_replace('\n',"<br />",
str_replace("[url]","",
str_replace("" class="hidelink" target="_blank">','',$text);
$this->urldetect = 0;
if($this->imageresize)
$link = pkLinkFx('rsimg','src='.base64_encode($link));
return $this->text = '<a href="'.$options.'" target="_blank"><img src="'.$link.'" border="0" alt="" title="" /></a>';
}
#@END Method: replace_img_url
/* IMG URL BBCode by PimpYourKiT.de */
// Lightbox BBCode by PimpYourKiT.de
#@Method: lightbox
#@Access: protected
#@Param: string text
#@Param: string text
#@Return: string
#@Desc: JQuery prettyPhoto lightbox
protected function lightbox($options,$text = '')
{
define('LBOXH',210); //--> Max. Hˆhe des Thumbnails (Standard 210 )
define('LBOXW',250); //--> Max. Breite des Thumbnails (Standard 250 )
define('LBOXMH',FALSE); //--> ( TRUE => max. Hˆhe aktiviert || FALSE => max. Hˆhe nicht aktiviert )
if(preg_match('/(jpg|png|gif|jpeg)/i',$options))
{
$this->text = $text ? $text : $options;
$this->imagesize = @getimagesize($options);
$this->width = (LBOXW < $this->imagesize[0]) ? 'width="'.LBOXW.'"' : 'width="'.$this->imagesize[0].'"';
$this->height = (LBOXH < $this->imagesize[1]) ? 'height="'.LBOXH.'"' : 'height="'.$this->imagesize[1].'"';
$this->height = LBOXMH === TRUE ? $this->height : NULL;
return '<a href="'.$options.'" rel="prettyPhoto[pp_gal]" title="'.$this->text.'"><img '.$this->width.$this->height.' src="'.$options.'" alt="" title="" /></a>';
}
elseif(preg_match('/(http|www)/i',$options))
{
$this->text = $text ? $text : $options;
return '<a href="'.$options.'?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" title="'.$this->text.'">'.$this->text.'</a>';
}
else
{
$this->rid = rand(1,1000);
$this->text = $text ? $text : 'Inline Lightbox Text';
return '<a href="#inline-'.$this->rid.'" rel="prettyPhoto" title="'.$this->text.'">'.$this->text.'</a>
<div id="inline-'.$this->rid.'" class="hide">
<p>'.$options.'</p>
</div>';
}
}
#@END Method: lightbox
// Lightbox BBCode by PimpYourKiT.de
// HTML BBCode by PimpYourKiT.de
#@Method: htmlcode
#@Access: protected
#@Param: int
#@Param: string text
#@Return: string
#@Desc: allows html code
protected function htmlcode($options,$text = '')
{
define('SECURITYHTML',battleonx24);
$this->text = str_replace(array("\r\n","\r","\n","\t"),'',$text);
if($options == SECURITYHTML)
return html_entity_decode($this->text);
return $this->text;
}
#@END Method: htmlcode
// HTML BBCode by PimpYourKiT.de
/* PDF BBCode by pimpyourkit.de */
#@Method: pdf
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: create embedded pdf documents
protected function pdf($options= '',$text = '')
{
/* definitions */
define('PDFMAXWIDTH', 550);
define('PDFMAXHEIGHT', 1500);
define('PDFMINWIDTH', 300);
define('PDFMINHEIGHT', 300);
define('PDFSTANDARDWIDTH', 400);
define('PDFSTANDARDWIDTH', 400);
$this->text = preg_replace("/\[url\](.*)\[\/url\]/",'$1',$text);
$this->split = explode(',',$options);
if(!strpos($text,'.pdf'))
return '<span style="padding: 10px; color: #C00; border: 1px solid #C00; background-color: #FEE;">Das PDF Dokument konnte nicht geladen werden.</span>';
if($this->split[1] && (($this->split[0] <= PDFMAXWIDTH && $this->split[1] <= PDFMAXHEIGHT) && ($this->split[0] >= PDFMINWIDTH && $this->split[1] >= PDFMINHEIGHT)))
{
$this->width = $this->split[0];
$this->height = $this->split[1];
}
else
{
$this->width = PDFSTANDARDWIDTH;
$this->height = PDFSTANDARDWIDTH;
}
$this->text = '<img src="fx/default/bbcode/pdf.gif" alt="" title="" /> <span style="font-weight: bold; font-size: 14px;">PDF Dokument</span><iframe src="http://docs.google.com/gview?url='.$this->text.'&embedded=true" style="margin: 10px; padding: 10px; background: #EBEBEB; border: 1px solid #CCC; width: '.$this->width.'px; height: '.$this->height.'px;" frameborder="0"></iframe>';
return $this->text;
}
#@END Method: pdf
/* PDF BBCode by pimpyourkit.de */
// Edit BBCode by PimpYourKiT.de
#@Method: edit
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: shows div container boxes
protected function edit($text = '')
{
global $SQL, $forumthread, $forumpost;
$result = $SQL->fetch_array($SQL->query("SELECT
forumpost_autorid,
forumpost_autor,
forumpost_edittime,
forumpost_editautor
FROM ".pkSQLTAB_FORUM_POST."
WHERE forumpost_threadid= '".$SQL->i($forumthread['forumthread_id'])."' AND forumpost_id='".$SQL->i($forumpost['forumpost_id'])."' LIMIT 1"));
$this->timeedit = date("d.m.y - H:i",$result['forumpost_edittime'] + 3600);
$userresult = $SQL->fetch_array($SQL->query("SELECT
user_id,
user_nick
FROM ".pkSQLTAB_USER."
WHERE user_nick='".$SQL->f($result['forumpost_editautor'])."' LIMIT 1"));
return '<img src="fx/default/bbcode/edit/edit.png" border="0" alt="Editiert" title="Editiert" /> <span style="color:#CC0000; font-style:italic; font-weight:bold;"> Thema wurde am '.$this->timeedit.' Uhr von <a href="?path=userinfo&id='.$userresult['user_id'].'">'.$userresult['user_nick'].'</a> editiert:</span><div style="padding-top: 10px;">'.$text.'</div>';
}
#@END Method: edit
// Edit BBCode by PimpYourKiT.de
// Spoiler BBCode by PimpYourKiT.de
#@Method: spoiler
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: shows spoiler
protected function spoiler($options = '',$text = '')
{
$this->users = array('admin','mod','vip','member','user','guest');
$this->split = explode(',',$options);
$this->split[0] = $this->split[0] && in_array($this->split[0],$this->users) ? $this->split[0] : 'guest';
$this->headtext = $this->split[1]? 'Spoiler: '.$this->split[1]: 'Spoiler';
$this->randomid = mt_rand();
if(getrights($this->split[0]))
{
return '<table class="data-table"><tr class="head"><td><img src="./../fx/default/bbcode/spoiler/spoiler.png" style="display: inline; vertical-align: middle;" alt="" title="" />'.$this->headtext.'</td></tr><tr class="even_info"><td><span class="textopen" id="colapse'.$this->randomid.'" style="cursor: pointer;"><img src="./../fx/default/bbcode/spoiler/plus.png" id="colapse'.$this->randomid.'img" alt="" title="Hier klicken zum aufklappen" style="border-style:none;" /> <span id="colapse'.$this->randomid.'text" style="text-decoration:underline;"><i>Hier klicken zum aufklappen</i></span></span><div id="colapse'.$this->randomid.'content" style="display:none;"><hr /><span style="padding: 15px 0;">'.$text.'</span><hr /></div></td></tr></table>';
}
return '<table class="data-table"><tr class="head"><td><img src="./../fx/default/bbcode/spoiler/spoiler.png" style="display: inline; vertical-align: middle;" alt="" title="" />Spoiler</td></tr><tr class="even_error"><td>Sie verfügen nicht über die benötigten Rechte zum anzeigen dieses Spoilers.</td></tr></table>';
}
#@END Method: spoiler
// Spoiler BBCode by PimpYourKiT.de
#@Method: replace_list
#@Access: protected
#@Param: string html
#@Param: string text
#@Param: string option
#@Return: string
#@Desc:
protected function replace_bbcode($html,$text,$option='')
{
$option = trim($option);
$option = empty($option) ? $text : $option;
$html = str_replace("{text}",$text,$html);
$html = str_replace("','',$text);
$this->urldetect = 0;
if($this->imageresize)
$link = pkLinkFx('rsimg','src='.base64_encode($link));
return $this->text = '<a href="'.$options.'" target="_blank"><img src="'.$link.'" border="0" alt="" title="" /></a>';
}
#@END Method: replace_img_url
/* IMG URL BBCode by PimpYourKiT.de */
// Lightbox BBCode by PimpYourKiT.de
#@Method: lightbox
#@Access: protected
#@Param: string text
#@Param: string text
#@Return: string
#@Desc: JQuery prettyPhoto lightbox
protected function lightbox($options,$text = '')
{
define('LBOXH',210); //--> Max. Hˆhe des Thumbnails (Standard 210 )
define('LBOXW',250); //--> Max. Breite des Thumbnails (Standard 250 )
define('LBOXMH',FALSE); //--> ( TRUE => max. Hˆhe aktiviert || FALSE => max. Hˆhe nicht aktiviert )
if(preg_match('/(jpg|png|gif|jpeg)/i',$options))
{
$this->text = $text ? $text : $options;
$this->imagesize = @getimagesize($options);
$this->width = (LBOXW < $this->imagesize[0]) ? 'width="'.LBOXW.'"' : 'width="'.$this->imagesize[0].'"';
$this->height = (LBOXH < $this->imagesize[1]) ? 'height="'.LBOXH.'"' : 'height="'.$this->imagesize[1].'"';
$this->height = LBOXMH === TRUE ? $this->height : NULL;
return '<a href="'.$options.'" rel="prettyPhoto[pp_gal]" title="'.$this->text.'"><img '.$this->width.$this->height.' src="'.$options.'" alt="" title="" /></a>';
}
elseif(preg_match('/(http|www)/i',$options))
{
$this->text = $text ? $text : $options;
return '<a href="'.$options.'?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" title="'.$this->text.'">'.$this->text.'</a>';
}
else
{
$this->rid = rand(1,1000);
$this->text = $text ? $text : 'Inline Lightbox Text';
return '<a href="#inline-'.$this->rid.'" rel="prettyPhoto" title="'.$this->text.'">'.$this->text.'</a>
<div id="inline-'.$this->rid.'" class="hide">
<p>'.$options.'</p>
</div>';
}
}
#@END Method: lightbox
// Lightbox BBCode by PimpYourKiT.de
// HTML BBCode by PimpYourKiT.de
#@Method: htmlcode
#@Access: protected
#@Param: int
#@Param: string text
#@Return: string
#@Desc: allows html code
protected function htmlcode($options,$text = '')
{
define('SECURITYHTML',battleonx24);
$this->text = str_replace(array("\r\n","\r","\n","\t"),'',$text);
if($options == SECURITYHTML)
return html_entity_decode($this->text);
return $this->text;
}
#@END Method: htmlcode
// HTML BBCode by PimpYourKiT.de
/* PDF BBCode by pimpyourkit.de */
#@Method: pdf
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: create embedded pdf documents
protected function pdf($options= '',$text = '')
{
/* definitions */
define('PDFMAXWIDTH', 550);
define('PDFMAXHEIGHT', 1500);
define('PDFMINWIDTH', 300);
define('PDFMINHEIGHT', 300);
define('PDFSTANDARDWIDTH', 400);
define('PDFSTANDARDWIDTH', 400);
$this->text = preg_replace("/\[url\](.*)\[\/url\]/",'$1',$text);
$this->split = explode(',',$options);
if(!strpos($text,'.pdf'))
return '<span style="padding: 10px; color: #C00; border: 1px solid #C00; background-color: #FEE;">Das PDF Dokument konnte nicht geladen werden.</span>';
if($this->split[1] && (($this->split[0] <= PDFMAXWIDTH && $this->split[1] <= PDFMAXHEIGHT) && ($this->split[0] >= PDFMINWIDTH && $this->split[1] >= PDFMINHEIGHT)))
{
$this->width = $this->split[0];
$this->height = $this->split[1];
}
else
{
$this->width = PDFSTANDARDWIDTH;
$this->height = PDFSTANDARDWIDTH;
}
$this->text = '<img src="fx/default/bbcode/pdf.gif" alt="" title="" /> <span style="font-weight: bold; font-size: 14px;">PDF Dokument</span><iframe src="http://docs.google.com/gview?url='.$this->text.'&embedded=true" style="margin: 10px; padding: 10px; background: #EBEBEB; border: 1px solid #CCC; width: '.$this->width.'px; height: '.$this->height.'px;" frameborder="0"></iframe>';
return $this->text;
}
#@END Method: pdf
/* PDF BBCode by pimpyourkit.de */
// Edit BBCode by PimpYourKiT.de
#@Method: edit
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: shows div container boxes
protected function edit($text = '')
{
global $SQL, $forumthread, $forumpost;
$result = $SQL->fetch_array($SQL->query("SELECT
forumpost_autorid,
forumpost_autor,
forumpost_edittime,
forumpost_editautor
FROM ".pkSQLTAB_FORUM_POST."
WHERE forumpost_threadid= '".$SQL->i($forumthread['forumthread_id'])."' AND forumpost_id='".$SQL->i($forumpost['forumpost_id'])."' LIMIT 1"));
$this->timeedit = date("d.m.y - H:i",$result['forumpost_edittime'] + 3600);
$userresult = $SQL->fetch_array($SQL->query("SELECT
user_id,
user_nick
FROM ".pkSQLTAB_USER."
WHERE user_nick='".$SQL->f($result['forumpost_editautor'])."' LIMIT 1"));
return '<img src="fx/default/bbcode/edit/edit.png" border="0" alt="Editiert" title="Editiert" /> <span style="color:#CC0000; font-style:italic; font-weight:bold;"> Thema wurde am '.$this->timeedit.' Uhr von <a href="?path=userinfo&id='.$userresult['user_id'].'">'.$userresult['user_nick'].'</a> editiert:</span><div style="padding-top: 10px;">'.$text.'</div>';
}
#@END Method: edit
// Edit BBCode by PimpYourKiT.de
// Spoiler BBCode by PimpYourKiT.de
#@Method: spoiler
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: shows spoiler
protected function spoiler($options = '',$text = '')
{
$this->users = array('admin','mod','vip','member','user','guest');
$this->split = explode(',',$options);
$this->split[0] = $this->split[0] && in_array($this->split[0],$this->users) ? $this->split[0] : 'guest';
$this->headtext = $this->split[1]? 'Spoiler: '.$this->split[1]: 'Spoiler';
$this->randomid = mt_rand();
if(getrights($this->split[0]))
{
return '<table class="data-table"><tr class="head"><td><img src="./../fx/default/bbcode/spoiler/spoiler.png" style="display: inline; vertical-align: middle;" alt="" title="" />'.$this->headtext.'</td></tr><tr class="even_info"><td><span class="textopen" id="colapse'.$this->randomid.'" style="cursor: pointer;"><img src="./../fx/default/bbcode/spoiler/plus.png" id="colapse'.$this->randomid.'img" alt="" title="Hier klicken zum aufklappen" style="border-style:none;" /> <span id="colapse'.$this->randomid.'text" style="text-decoration:underline;"><i>Hier klicken zum aufklappen</i></span></span><div id="colapse'.$this->randomid.'content" style="display:none;"><hr /><span style="padding: 15px 0;">'.$text.'</span><hr /></div></td></tr></table>';
}
return '<table class="data-table"><tr class="head"><td><img src="./../fx/default/bbcode/spoiler/spoiler.png" style="display: inline; vertical-align: middle;" alt="" title="" />Spoiler</td></tr><tr class="even_error"><td>Sie verfügen nicht über die benötigten Rechte zum anzeigen dieses Spoilers.</td></tr></table>';
}
#@END Method: spoiler
// Spoiler BBCode by PimpYourKiT.de
#@Method: replace_list
#@Access: protected
#@Param: string html
#@Param: string text
#@Param: string option
#@Return: string
#@Desc:
protected function replace_bbcode($html,$text,$option='')
{
$option = trim($option);
$option = empty($option) ? $text : $option;
$html = str_replace("{text}",$text,$html);
$html = str_replace("{option}",$option,$html);
return $html;
}
#@END Method: replace_bbcode
#@Method: replace_list
#@Access: protected
#@Param: string html
#@Param: string text
#@Return: string
#@Desc:
protected function replace_list($html,$text)
{
#need trim here to avoid empty cols between list-elements
#text should contains some li/* elements
$text = trim($text);
#empty list-tags (ul,ol,dl) arnt allowed - so return an empty string in this case
if(empty($text))
{
return '';
}
#replace correctly with <li></li> without linebreaks
$pattern = "#\[(li)\](.*)\[/\\1\]#isuSU";
$text = preg_replace($pattern,'<li>\\2</li>',$text);
#do we have simple sinlge tags?
if(strstr($text,'<li>'))
{
#split by the simple single tag <li>
$matches = explode('<li>',$text);
foreach($matches as $i=>$str)
{
$str = trim($str);#empty lines will be removed
if(empty($str))
{
unset($matches[$i]);
continue;
}
$matches[$i] = '<li>'.$str.'</li>';
}
$text = implode('',$matches);
}#END simple single tags
#created the whole list and clean it up
$text = str_replace("{text}",$text,$html);
$text = preg_replace("#(\/li|ul|ol type="a"|ol type="1")>(.*)*<(li|\/ol|\/ul){1}>#sSU",'\\1><\\3>',$text);#removes everything between list related tags
$text = $text==str_replace("{text}",'',$html) ? '' : $text; # if the list is now empty nothing will be displayed, otherwise it wouldnt not be valid XHTML
return $text;
}
#@END Method: replace_list
#@Method: replace_url
#@Access: protected
#@Param: string html
#@Param: string url
#@Param: [string text]
function replace_url($html,$url,$text='')
{
$url = trim($url);
$text = empty($text) ? $url : $text;
$text = trim($text);
if($this->urlcut && strlen($text)>$this->urlmaxwidth && !preg_match("/[><\[\]]/",$text))
{
$text = substr($text,0,$this->urlwidth1)."...".substr($text,$this->urlwidth2);
}
#prevent double-links when imageresize is on
if($this->imageresize && preg_match("/\<a (.*)<\/a>/i",$text))
{
return str_replace("\\"",""",$text);
}
// Interne URL Erkennung by PimpYourKiT.de
$url = preg_match('/http:\/\//i',$url) ? 'href="'.$url.'" target="_blank"' : 'href="'.$url.'" target="_self"';
// Interne URL Erkennung by PimpYourKiT.de
$str = str_replace("{text}",$text,$html);
$str = str_replace("{option}",$url,$str);
$str = str_replace("\\"",""",$str);
return $str;
}
#@END Method: replace_url
/**************************************** FSK HACK Anfang ****************************************/
function fskparse($text='') {
$code=$this->fsktag;
$text=preg_replace("#\[".$code['tag']."=(.*)\](.*)\[/".$code['tag']."\]#esiU","\$this->fskrewrite('\\1','\\2')",$text);
$text=str_replace("\\"",""",$text);
return $text;
}
function fskrewrite($age='', $text='') {
global $SQL;
if(!is_numeric($age)) return $text='<font><span style="color:#e00012;">Es sind bei BBCode_FSK nur Zahlen erlaubt</span></font>';
if(pkGetUservalue('id')=='') return $text='<font><span style="color:#e00012;">Um auf diesen Inhalt zuzugreifen, müssen Sie sich erst registrieren und Ihr Geburtsdatum angeben.</span></font>';
if($age=='6' OR $age=='12' OR $age=='16' OR $age=='18') {
$age_check=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_USER."` WHERE `user_id`='".intval(pkGetUservalue('id'))."' LIMIT 1"));
if($age_check['user_bd_day']>0 AND $age_check['user_bd_month']>0 AND $age_check['user_bd_year']>0)
$alter=getAge($age_check['user_bd_day'],$age_check['user_bd_month'],$age_check['user_bd_year']);
if(empty($alter)) return $text='<font><span style="color:#e00012;">Bitte geben Sie Ihr Geburtsdatum in Ihrem Profil an</span></font>';
if($age_check['user_change_age']>1) return $text='<font><span style="color:#e00012;">Sie haben Ihr Geburtstag bereits 1 x editiert. Bitte kontaktieren Sie einen Admin um Ihren Counter wieder auf Null zu setzen.</span></font>';
if($age=='6' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 6ten Lebensjahr zugreifen</span></font>';
elseif($age=='12' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 12ten Lebensjahr zugreifen</span></font>';
elseif($age=='16' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 16ten Lebensjahr zugreifen</span></font>';
elseif($age=='18' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 18ten Lebensjahr zugreifen</span></font>';
return $text='<table align="center" width="100%" class="standard" cellspacing="1" cellpadding="2"><tr><td class="heads"><font><span style="color:#cdb682;">Sie sind über '.$age.' Jahre alt und dürfen diesen Inhalt lesen.</span></font></td></tr><tr><td class="odd">'.$text.'</td></tr></table>';
} else return $text='<font><span style="color:#e00012;">Die Angabe '.age.' im BBCode ist ungültig.</span></font>';
}
/**************************************** FSK HACK Ende ****************************************/
#@Method: replace_ images
#@Access: protected
#@Param: string html
#@Param: string link
#@Return: string
#@Desc:
protected function replace_image($html,$link)
{
if($this->imageresize)
{
$html = '<a href="'.$link.'" target="_blank">'.$html.'</a>';
$link = pkLinkFx('rsimg','src='.base64_encode($link));
}
$str = str_replace("{image}",$link,$html);
return $str;
}
#@END Method: replace_image
#@Method: remove_images
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function remove_images()
{
$pattern = "#\[(/?)(img|imgr|imgl)\]#i";
$this->text = preg_replace($pattern,'[\\1url]',$this->text);
}
#@END Method: remove_images
#@Method: textcensor
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function textcensor()
{
$replacer = $this->censorreplace;
$censorlist = $this->getCensor();
if( empty( $censorlist ) || $this->censoruse != 1 )
{
return;
}
foreach( $censorlist as $badword )
{
$badword = trim( $badword );
if( empty( $badword ) )
{
continue;
}
// badword length
$len = strlen( $badword );
$replace = '';
// exact match
if( preg_match( "#\{(.*)\}#isU", $badword ) )
{
$len = $len - 2;
$replace = str_repeat( $replacer, $len );
$this->text = str_replace( $badword, " " . $replace . " ", $this->text );
}
else
{
$replace = str_repeat( $replacer, $len );
$this->text = str_replace( $badword, $replace, $this->text );
}
}
}
/**
*
* @param void
* @return object|self|PHPKIT_Frontend_Model_BBCode
*/
protected function _initCensor()
{
if( self::$_censor === NULL )
{
$badwords = pkGetConfig( 'censor_badword' );
$badwords = is_string( $badwords ) ? $badwords : '';
$badwords = explode( "\n", $badwords );
self::$_censor = $badwords;
}
return $this;
}
#Code Parser der KNW Community ANFANG
function highlight_phpcode($code,$tag){
if(strtolower($tag)=='php'){
$headlineS='PHP-Code Anfang:';
$headlineE='PHP-Code ENDE:';
$DivbgColor='FFF';
$DivTextColor='000';
$BorderColorDiv='FF7F00';
$TextColorHeadlines='FF7F00';
}else{
ini_set('highlight.comment','#FFFFFF');
ini_set('highlight.default','#FFFFFF');
ini_set('highlight.keyword','#FF7F00');
ini_set('highlight.string','#FF3333');
ini_set('highlight.html','#FFFFFF');
$headlineS='Shell Code Anfang:';
$headlineE='Shell ENDE:';
$DivbgColor='030303';
$DivTextColor='fff';
$BorderColorDiv='FFF';
$TextColorHeadlines='FF3333';
}
#Config
$CounterColor='FFF';
$LinkColor='FFF';
$trans = get_html_translation_table(HTML_ENTITIES);
$code =
strtr(
strip_tags(
str_replace("&","&",
str_replace("$","$",
str_replace("(","(",
str_replace(")",")",
str_replace("[","[",
str_replace("]","]",
str_replace("'",chr(39),
str_replace('\n',"<br />",
str_replace("[url]","",
str_replace("",$option,$html);
return $html;
}
#@END Method: replace_bbcode
#@Method: replace_list
#@Access: protected
#@Param: string html
#@Param: string text
#@Return: string
#@Desc:
protected function replace_list($html,$text)
{
#need trim here to avoid empty cols between list-elements
#text should contains some li/* elements
$text = trim($text);
#empty list-tags (ul,ol,dl) arnt allowed - so return an empty string in this case
if(empty($text))
{
return '';
}
#replace correctly with <li></li> without linebreaks
$pattern = "#\[(li)\](.*)\[/\\1\]#isuSU";
$text = preg_replace($pattern,'<li>\\2</li>',$text);
#do we have simple sinlge tags?
if(strstr($text,'<li>'))
{
#split by the simple single tag <li>
$matches = explode('<li>',$text);
foreach($matches as $i=>$str)
{
$str = trim($str);#empty lines will be removed
if(empty($str))
{
unset($matches[$i]);
continue;
}
$matches[$i] = '<li>'.$str.'</li>';
}
$text = implode('',$matches);
}#END simple single tags
#created the whole list and clean it up
$text = str_replace("{text}",$text,$html);
$text = preg_replace("#(\/li|ul|ol type="a"|ol type="1")>(.*)*<(li|\/ol|\/ul){1}>#sSU",'\\1><\\3>',$text);#removes everything between list related tags
$text = $text==str_replace("{text}",'',$html) ? '' : $text; # if the list is now empty nothing will be displayed, otherwise it wouldnt not be valid XHTML
return $text;
}
#@END Method: replace_list
#@Method: replace_url
#@Access: protected
#@Param: string html
#@Param: string url
#@Param: [string text]
function replace_url($html,$url,$text='')
{
$url = trim($url);
$text = empty($text) ? $url : $text;
$text = trim($text);
if($this->urlcut && strlen($text)>$this->urlmaxwidth && !preg_match("/[><\[\]]/",$text))
{
$text = substr($text,0,$this->urlwidth1)."...".substr($text,$this->urlwidth2);
}
#prevent double-links when imageresize is on
if($this->imageresize && preg_match("/\<a (.*)<\/a>/i",$text))
{
return str_replace("\\"",""",$text);
}
// Interne URL Erkennung by PimpYourKiT.de
$url = preg_match('/http:\/\//i',$url) ? 'href="'.$url.'" target="_blank"' : 'href="'.$url.'" target="_self"';
// Interne URL Erkennung by PimpYourKiT.de
$str = str_replace("{text}",$text,$html);
$str = str_replace("','',$text);
$this->urldetect = 0;
if($this->imageresize)
$link = pkLinkFx('rsimg','src='.base64_encode($link));
return $this->text = '<a href="'.$options.'" target="_blank"><img src="'.$link.'" border="0" alt="" title="" /></a>';
}
#@END Method: replace_img_url
/* IMG URL BBCode by PimpYourKiT.de */
// Lightbox BBCode by PimpYourKiT.de
#@Method: lightbox
#@Access: protected
#@Param: string text
#@Param: string text
#@Return: string
#@Desc: JQuery prettyPhoto lightbox
protected function lightbox($options,$text = '')
{
define('LBOXH',210); //--> Max. Hˆhe des Thumbnails (Standard 210 )
define('LBOXW',250); //--> Max. Breite des Thumbnails (Standard 250 )
define('LBOXMH',FALSE); //--> ( TRUE => max. Hˆhe aktiviert || FALSE => max. Hˆhe nicht aktiviert )
if(preg_match('/(jpg|png|gif|jpeg)/i',$options))
{
$this->text = $text ? $text : $options;
$this->imagesize = @getimagesize($options);
$this->width = (LBOXW < $this->imagesize[0]) ? 'width="'.LBOXW.'"' : 'width="'.$this->imagesize[0].'"';
$this->height = (LBOXH < $this->imagesize[1]) ? 'height="'.LBOXH.'"' : 'height="'.$this->imagesize[1].'"';
$this->height = LBOXMH === TRUE ? $this->height : NULL;
return '<a href="'.$options.'" rel="prettyPhoto[pp_gal]" title="'.$this->text.'"><img '.$this->width.$this->height.' src="'.$options.'" alt="" title="" /></a>';
}
elseif(preg_match('/(http|www)/i',$options))
{
$this->text = $text ? $text : $options;
return '<a href="'.$options.'?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" title="'.$this->text.'">'.$this->text.'</a>';
}
else
{
$this->rid = rand(1,1000);
$this->text = $text ? $text : 'Inline Lightbox Text';
return '<a href="#inline-'.$this->rid.'" rel="prettyPhoto" title="'.$this->text.'">'.$this->text.'</a>
<div id="inline-'.$this->rid.'" class="hide">
<p>'.$options.'</p>
</div>';
}
}
#@END Method: lightbox
// Lightbox BBCode by PimpYourKiT.de
// HTML BBCode by PimpYourKiT.de
#@Method: htmlcode
#@Access: protected
#@Param: int
#@Param: string text
#@Return: string
#@Desc: allows html code
protected function htmlcode($options,$text = '')
{
define('SECURITYHTML',battleonx24);
$this->text = str_replace(array("\r\n","\r","\n","\t"),'',$text);
if($options == SECURITYHTML)
return html_entity_decode($this->text);
return $this->text;
}
#@END Method: htmlcode
// HTML BBCode by PimpYourKiT.de
/* PDF BBCode by pimpyourkit.de */
#@Method: pdf
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: create embedded pdf documents
protected function pdf($options= '',$text = '')
{
/* definitions */
define('PDFMAXWIDTH', 550);
define('PDFMAXHEIGHT', 1500);
define('PDFMINWIDTH', 300);
define('PDFMINHEIGHT', 300);
define('PDFSTANDARDWIDTH', 400);
define('PDFSTANDARDWIDTH', 400);
$this->text = preg_replace("/\[url\](.*)\[\/url\]/",'$1',$text);
$this->split = explode(',',$options);
if(!strpos($text,'.pdf'))
return '<span style="padding: 10px; color: #C00; border: 1px solid #C00; background-color: #FEE;">Das PDF Dokument konnte nicht geladen werden.</span>';
if($this->split[1] && (($this->split[0] <= PDFMAXWIDTH && $this->split[1] <= PDFMAXHEIGHT) && ($this->split[0] >= PDFMINWIDTH && $this->split[1] >= PDFMINHEIGHT)))
{
$this->width = $this->split[0];
$this->height = $this->split[1];
}
else
{
$this->width = PDFSTANDARDWIDTH;
$this->height = PDFSTANDARDWIDTH;
}
$this->text = '<img src="fx/default/bbcode/pdf.gif" alt="" title="" /> <span style="font-weight: bold; font-size: 14px;">PDF Dokument</span><iframe src="http://docs.google.com/gview?url='.$this->text.'&embedded=true" style="margin: 10px; padding: 10px; background: #EBEBEB; border: 1px solid #CCC; width: '.$this->width.'px; height: '.$this->height.'px;" frameborder="0"></iframe>';
return $this->text;
}
#@END Method: pdf
/* PDF BBCode by pimpyourkit.de */
// Edit BBCode by PimpYourKiT.de
#@Method: edit
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: shows div container boxes
protected function edit($text = '')
{
global $SQL, $forumthread, $forumpost;
$result = $SQL->fetch_array($SQL->query("SELECT
forumpost_autorid,
forumpost_autor,
forumpost_edittime,
forumpost_editautor
FROM ".pkSQLTAB_FORUM_POST."
WHERE forumpost_threadid= '".$SQL->i($forumthread['forumthread_id'])."' AND forumpost_id='".$SQL->i($forumpost['forumpost_id'])."' LIMIT 1"));
$this->timeedit = date("d.m.y - H:i",$result['forumpost_edittime'] + 3600);
$userresult = $SQL->fetch_array($SQL->query("SELECT
user_id,
user_nick
FROM ".pkSQLTAB_USER."
WHERE user_nick='".$SQL->f($result['forumpost_editautor'])."' LIMIT 1"));
return '<img src="fx/default/bbcode/edit/edit.png" border="0" alt="Editiert" title="Editiert" /> <span style="color:#CC0000; font-style:italic; font-weight:bold;"> Thema wurde am '.$this->timeedit.' Uhr von <a href="?path=userinfo&id='.$userresult['user_id'].'">'.$userresult['user_nick'].'</a> editiert:</span><div style="padding-top: 10px;">'.$text.'</div>';
}
#@END Method: edit
// Edit BBCode by PimpYourKiT.de
// Spoiler BBCode by PimpYourKiT.de
#@Method: spoiler
#@Access: protected
#@Param: string options
#@Param: string text
#@Return: string
#@Desc: shows spoiler
protected function spoiler($options = '',$text = '')
{
$this->users = array('admin','mod','vip','member','user','guest');
$this->split = explode(',',$options);
$this->split[0] = $this->split[0] && in_array($this->split[0],$this->users) ? $this->split[0] : 'guest';
$this->headtext = $this->split[1]? 'Spoiler: '.$this->split[1]: 'Spoiler';
$this->randomid = mt_rand();
if(getrights($this->split[0]))
{
return '<table class="data-table"><tr class="head"><td><img src="./../fx/default/bbcode/spoiler/spoiler.png" style="display: inline; vertical-align: middle;" alt="" title="" />'.$this->headtext.'</td></tr><tr class="even_info"><td><span class="textopen" id="colapse'.$this->randomid.'" style="cursor: pointer;"><img src="./../fx/default/bbcode/spoiler/plus.png" id="colapse'.$this->randomid.'img" alt="" title="Hier klicken zum aufklappen" style="border-style:none;" /> <span id="colapse'.$this->randomid.'text" style="text-decoration:underline;"><i>Hier klicken zum aufklappen</i></span></span><div id="colapse'.$this->randomid.'content" style="display:none;"><hr /><span style="padding: 15px 0;">'.$text.'</span><hr /></div></td></tr></table>';
}
return '<table class="data-table"><tr class="head"><td><img src="./../fx/default/bbcode/spoiler/spoiler.png" style="display: inline; vertical-align: middle;" alt="" title="" />Spoiler</td></tr><tr class="even_error"><td>Sie verfügen nicht über die benötigten Rechte zum anzeigen dieses Spoilers.</td></tr></table>';
}
#@END Method: spoiler
// Spoiler BBCode by PimpYourKiT.de
#@Method: replace_list
#@Access: protected
#@Param: string html
#@Param: string text
#@Param: string option
#@Return: string
#@Desc:
protected function replace_bbcode($html,$text,$option='')
{
$option = trim($option);
$option = empty($option) ? $text : $option;
$html = str_replace("{text}",$text,$html);
$html = str_replace("{option}",$option,$html);
return $html;
}
#@END Method: replace_bbcode
#@Method: replace_list
#@Access: protected
#@Param: string html
#@Param: string text
#@Return: string
#@Desc:
protected function replace_list($html,$text)
{
#need trim here to avoid empty cols between list-elements
#text should contains some li/* elements
$text = trim($text);
#empty list-tags (ul,ol,dl) arnt allowed - so return an empty string in this case
if(empty($text))
{
return '';
}
#replace correctly with <li></li> without linebreaks
$pattern = "#\[(li)\](.*)\[/\\1\]#isuSU";
$text = preg_replace($pattern,'<li>\\2</li>',$text);
#do we have simple sinlge tags?
if(strstr($text,'<li>'))
{
#split by the simple single tag <li>
$matches = explode('<li>',$text);
foreach($matches as $i=>$str)
{
$str = trim($str);#empty lines will be removed
if(empty($str))
{
unset($matches[$i]);
continue;
}
$matches[$i] = '<li>'.$str.'</li>';
}
$text = implode('',$matches);
}#END simple single tags
#created the whole list and clean it up
$text = str_replace("{text}",$text,$html);
$text = preg_replace("#(\/li|ul|ol type="a"|ol type="1")>(.*)*<(li|\/ol|\/ul){1}>#sSU",'\\1><\\3>',$text);#removes everything between list related tags
$text = $text==str_replace("{text}",'',$html) ? '' : $text; # if the list is now empty nothing will be displayed, otherwise it wouldnt not be valid XHTML
return $text;
}
#@END Method: replace_list
#@Method: replace_url
#@Access: protected
#@Param: string html
#@Param: string url
#@Param: [string text]
function replace_url($html,$url,$text='')
{
$url = trim($url);
$text = empty($text) ? $url : $text;
$text = trim($text);
if($this->urlcut && strlen($text)>$this->urlmaxwidth && !preg_match("/[><\[\]]/",$text))
{
$text = substr($text,0,$this->urlwidth1)."...".substr($text,$this->urlwidth2);
}
#prevent double-links when imageresize is on
if($this->imageresize && preg_match("/\<a (.*)<\/a>/i",$text))
{
return str_replace("\\"",""",$text);
}
// Interne URL Erkennung by PimpYourKiT.de
$url = preg_match('/http:\/\//i',$url) ? 'href="'.$url.'" target="_blank"' : 'href="'.$url.'" target="_self"';
// Interne URL Erkennung by PimpYourKiT.de
$str = str_replace("{text}",$text,$html);
$str = str_replace("{option}",$url,$str);
$str = str_replace("\\"",""",$str);
return $str;
}
#@END Method: replace_url
/**************************************** FSK HACK Anfang ****************************************/
function fskparse($text='') {
$code=$this->fsktag;
$text=preg_replace("#\[".$code['tag']."=(.*)\](.*)\[/".$code['tag']."\]#esiU","\$this->fskrewrite('\\1','\\2')",$text);
$text=str_replace("\\"",""",$text);
return $text;
}
function fskrewrite($age='', $text='') {
global $SQL;
if(!is_numeric($age)) return $text='<font><span style="color:#e00012;">Es sind bei BBCode_FSK nur Zahlen erlaubt</span></font>';
if(pkGetUservalue('id')=='') return $text='<font><span style="color:#e00012;">Um auf diesen Inhalt zuzugreifen, müssen Sie sich erst registrieren und Ihr Geburtsdatum angeben.</span></font>';
if($age=='6' OR $age=='12' OR $age=='16' OR $age=='18') {
$age_check=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_USER."` WHERE `user_id`='".intval(pkGetUservalue('id'))."' LIMIT 1"));
if($age_check['user_bd_day']>0 AND $age_check['user_bd_month']>0 AND $age_check['user_bd_year']>0)
$alter=getAge($age_check['user_bd_day'],$age_check['user_bd_month'],$age_check['user_bd_year']);
if(empty($alter)) return $text='<font><span style="color:#e00012;">Bitte geben Sie Ihr Geburtsdatum in Ihrem Profil an</span></font>';
if($age_check['user_change_age']>1) return $text='<font><span style="color:#e00012;">Sie haben Ihr Geburtstag bereits 1 x editiert. Bitte kontaktieren Sie einen Admin um Ihren Counter wieder auf Null zu setzen.</span></font>';
if($age=='6' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 6ten Lebensjahr zugreifen</span></font>';
elseif($age=='12' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 12ten Lebensjahr zugreifen</span></font>';
elseif($age=='16' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 16ten Lebensjahr zugreifen</span></font>';
elseif($age=='18' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 18ten Lebensjahr zugreifen</span></font>';
return $text='<table align="center" width="100%" class="standard" cellspacing="1" cellpadding="2"><tr><td class="heads"><font><span style="color:#cdb682;">Sie sind über '.$age.' Jahre alt und dürfen diesen Inhalt lesen.</span></font></td></tr><tr><td class="odd">'.$text.'</td></tr></table>';
} else return $text='<font><span style="color:#e00012;">Die Angabe '.age.' im BBCode ist ungültig.</span></font>';
}
/**************************************** FSK HACK Ende ****************************************/
#@Method: replace_ images
#@Access: protected
#@Param: string html
#@Param: string link
#@Return: string
#@Desc:
protected function replace_image($html,$link)
{
if($this->imageresize)
{
$html = '<a href="'.$link.'" target="_blank">'.$html.'</a>';
$link = pkLinkFx('rsimg','src='.base64_encode($link));
}
$str = str_replace("{image}",$link,$html);
return $str;
}
#@END Method: replace_image
#@Method: remove_images
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function remove_images()
{
$pattern = "#\[(/?)(img|imgr|imgl)\]#i";
$this->text = preg_replace($pattern,'[\\1url]',$this->text);
}
#@END Method: remove_images
#@Method: textcensor
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function textcensor()
{
$replacer = $this->censorreplace;
$censorlist = $this->getCensor();
if( empty( $censorlist ) || $this->censoruse != 1 )
{
return;
}
foreach( $censorlist as $badword )
{
$badword = trim( $badword );
if( empty( $badword ) )
{
continue;
}
// badword length
$len = strlen( $badword );
$replace = '';
// exact match
if( preg_match( "#\{(.*)\}#isU", $badword ) )
{
$len = $len - 2;
$replace = str_repeat( $replacer, $len );
$this->text = str_replace( $badword, " " . $replace . " ", $this->text );
}
else
{
$replace = str_repeat( $replacer, $len );
$this->text = str_replace( $badword, $replace, $this->text );
}
}
}
/**
*
* @param void
* @return object|self|PHPKIT_Frontend_Model_BBCode
*/
protected function _initCensor()
{
if( self::$_censor === NULL )
{
$badwords = pkGetConfig( 'censor_badword' );
$badwords = is_string( $badwords ) ? $badwords : '';
$badwords = explode( "\n", $badwords );
self::$_censor = $badwords;
}
return $this;
}
#Code Parser der KNW Community ANFANG
function highlight_phpcode($code,$tag){
if(strtolower($tag)=='php'){
$headlineS='PHP-Code Anfang:';
$headlineE='PHP-Code ENDE:';
$DivbgColor='FFF';
$DivTextColor='000';
$BorderColorDiv='FF7F00';
$TextColorHeadlines='FF7F00';
}else{
ini_set('highlight.comment','#FFFFFF');
ini_set('highlight.default','#FFFFFF');
ini_set('highlight.keyword','#FF7F00');
ini_set('highlight.string','#FF3333');
ini_set('highlight.html','#FFFFFF');
$headlineS='Shell Code Anfang:';
$headlineE='Shell ENDE:';
$DivbgColor='030303';
$DivTextColor='fff';
$BorderColorDiv='FFF';
$TextColorHeadlines='FF3333';
}
#Config
$CounterColor='FFF';
$LinkColor='FFF';
$trans = get_html_translation_table(HTML_ENTITIES);
$code =
strtr(
strip_tags(
str_replace("&","&",
str_replace("$","$",
str_replace("(","(",
str_replace(")",")",
str_replace("[","[",
str_replace("]","]",
str_replace("'",chr(39),
str_replace('\n',"<br />",
str_replace("[url]","",
str_replace("",$url,$str);
$str = str_replace("\\"",""",$str);
return $str;
}
#@END Method: replace_url
/**************************************** FSK HACK Anfang ****************************************/
function fskparse($text='') {
$code=$this->fsktag;
$text=preg_replace("#\[".$code['tag']."=(.*)\](.*)\[/".$code['tag']."\]#esiU","\$this->fskrewrite('\\1','\\2')",$text);
$text=str_replace("\\"",""",$text);
return $text;
}
function fskrewrite($age='', $text='') {
global $SQL;
if(!is_numeric($age)) return $text='<font><span style="color:#e00012;">Es sind bei BBCode_FSK nur Zahlen erlaubt</span></font>';
if(pkGetUservalue('id')=='') return $text='<font><span style="color:#e00012;">Um auf diesen Inhalt zuzugreifen, müssen Sie sich erst registrieren und Ihr Geburtsdatum angeben.</span></font>';
if($age=='6' OR $age=='12' OR $age=='16' OR $age=='18') {
$age_check=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_USER."` WHERE `user_id`='".intval(pkGetUservalue('id'))."' LIMIT 1"));
if($age_check['user_bd_day']>0 AND $age_check['user_bd_month']>0 AND $age_check['user_bd_year']>0)
$alter=getAge($age_check['user_bd_day'],$age_check['user_bd_month'],$age_check['user_bd_year']);
if(empty($alter)) return $text='<font><span style="color:#e00012;">Bitte geben Sie Ihr Geburtsdatum in Ihrem Profil an</span></font>';
if($age_check['user_change_age']>1) return $text='<font><span style="color:#e00012;">Sie haben Ihr Geburtstag bereits 1 x editiert. Bitte kontaktieren Sie einen Admin um Ihren Counter wieder auf Null zu setzen.</span></font>';
if($age=='6' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 6ten Lebensjahr zugreifen</span></font>';
elseif($age=='12' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 12ten Lebensjahr zugreifen</span></font>';
elseif($age=='16' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 16ten Lebensjahr zugreifen</span></font>';
elseif($age=='18' AND $alter<$age) return $text='<font><span style="color:#e00012;">Auf diesen Inhalt dürfen Sie erst ab Ihrem 18ten Lebensjahr zugreifen</span></font>';
return $text='<table align="center" width="100%" class="standard" cellspacing="1" cellpadding="2"><tr><td class="heads"><font><span style="color:#cdb682;">Sie sind über '.$age.' Jahre alt und dürfen diesen Inhalt lesen.</span></font></td></tr><tr><td class="odd">'.$text.'</td></tr></table>';
} else return $text='<font><span style="color:#e00012;">Die Angabe '.age.' im BBCode ist ungültig.</span></font>';
}
/**************************************** FSK HACK Ende ****************************************/
#@Method: replace_ images
#@Access: protected
#@Param: string html
#@Param: string link
#@Return: string
#@Desc:
protected function replace_image($html,$link)
{
if($this->imageresize)
{
$html = '<a href="'.$link.'" target="_blank">'.$html.'</a>';
$link = pkLinkFx('rsimg','src='.base64_encode($link));
}
$str = str_replace("{image}",$link,$html);
return $str;
}
#@END Method: replace_image
#@Method: remove_images
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function remove_images()
{
$pattern = "#\[(/?)(img|imgr|imgl)\]#i";
$this->text = preg_replace($pattern,'[\\1url]',$this->text);
}
#@END Method: remove_images
#@Method: textcensor
#@Access: protected
#@Param: void
#@Return: void
#@Desc:
protected function textcensor()
{
$replacer = $this->censorreplace;
$censorlist = $this->getCensor();
if( empty( $censorlist ) || $this->censoruse != 1 )
{
return;
}
foreach( $censorlist as $badword )
{
$badword = trim( $badword );
if( empty( $badword ) )
{
continue;
}
// badword length
$len = strlen( $badword );
$replace = '';
// exact match
if( preg_match( "#\{(.*)\}#isU", $badword ) )
{
$len = $len - 2;
$replace = str_repeat( $replacer, $len );
$this->text = str_replace( $badword, " " . $replace . " ", $this->text );
}
else
{
$replace = str_repeat( $replacer, $len );
$this->text = str_replace( $badword, $replace, $this->text );
}
}
}
/**
*
* @param void
* @return object|self|PHPKIT_Frontend_Model_BBCode
*/
protected function _initCensor()
{
if( self::$_censor === NULL )
{
$badwords = pkGetConfig( 'censor_badword' );
$badwords = is_string( $badwords ) ? $badwords : '';
$badwords = explode( "\n", $badwords );
self::$_censor = $badwords;
}
return $this;
}
#Code Parser der KNW Community ANFANG
function highlight_phpcode($code,$tag){
if(strtolower($tag)=='php'){
$headlineS='PHP-Code Anfang:';
$headlineE='PHP-Code ENDE:';
$DivbgColor='FFF';
$DivTextColor='000';
$BorderColorDiv='FF7F00';
$TextColorHeadlines='FF7F00';
}else{
ini_set('highlight.comment','#FFFFFF');
ini_set('highlight.default','#FFFFFF');
ini_set('highlight.keyword','#FF7F00');
ini_set('highlight.string','#FF3333');
ini_set('highlight.html','#FFFFFF');
$headlineS='Shell Code Anfang:';
$headlineE='Shell ENDE:';
$DivbgColor='030303';
$DivTextColor='fff';
$BorderColorDiv='FFF';
$TextColorHeadlines='FF3333';
}
#Config
$CounterColor='FFF';
$LinkColor='FFF';
$trans = get_html_translation_table(HTML_ENTITIES);
$code =
strtr(
strip_tags(
str_replace("&","&",
str_replace("$","$",
str_replace("(","(",
str_replace(")",")",
str_replace("[","[",
str_replace("]","]",
str_replace("'",chr(39),
str_replace('\n',"<br />",
str_replace("[url]","",
str_replace("","",
str_replace("SCRIPT","SCRIPT",
str_replace("script","script",
$code))))))))))))),
array_flip($trans));
#Convert Special Characters
$code = utf8_encode($code); #Umlaut Fix 1.6.5
$CodeToVisible=highlight_string("<?php\n".$code."\n?>",TRUE);
$CodeToVisible2 = explode('<br />', $CodeToVisible);
$xy = sizeof($CodeToVisible2)-2;
$textwidth = "95%";
$textsmallwidth = "30";
$textsmallheight = "12";
$countReal=1;
for($x=1; $x <= $xy; $x++) {
if(trim($CodeToVisible2[$x]) != '') {
$phpcodecount=$this->phpcodecount++;
if($x <> $xy) {
$text_zeilen .= ''.$countReal.' <br />';
$text_code .= ''.$CodeToVisible2[$x].'<br />';
} else {
$text_zeilen .= ''.$countReal.' ';
$text_code .= $CodeToVisible2[$x];
}
$countReal++;
}else{
$codecount++;
}
}
$xy=$xy-$codecount; # Nur echte Zeilen berechnen
$xy==1 ? $Lines='Zeile' : $Lines='Zeilen';
$textheight = $xy*$textsmallheight;
$textheight2 = $textheight+20;
$textwidth2 = $textwidth-$textsmallwidth-6;
$styleart1 = 'background-color: #'.$DivbgColor.'; font-size: 12px; font-family: Arial,Helvetica,sans-serif;line-height:12px;';
$styleart2 = 'font-size: 12px; font-family: Arial,Helvetica,sans-serif;line-height:12px;';
$text = '<table class="contentbody" border="0" width="'.$textwidth.'" cellpadding="2" cellspacing="3" align="center">';
$text .= ' <tr>';
$text .= ' <td class="highlight" width="100%">';
$text .= ' <table style="table-layout: fixed;" border="0" width="100%" cellpadding="0" cellspacing="1" align="center" class="contentbody">';
$text .= ' <tr>';
$text .= ' <td style="font-size:12px;vertical-align:middle;" height="21" width="5%" align="center" class="heads">';
$text .= ' <img src="'.pkDIRWWWROOT.'fx/default/bbcode/'.strtolower($tag).'.png" alt="'.strtoupper($tag).' Icon" title="'.strtoupper($tag).' Icon" />';
$text .= ' </td>';
$text .= ' <td class="heads" style="font-size:12px;vertical-align:middle;" width="95%">';
$text .= ' <span style="color:#'.$TextColorHeadlines.';"><b>'.$headlineS.'</b></span> <span style="color:#'.$LinkColor.';">(<b>'.$xy.'</b> '.$Lines.') | </span><a style="cursor: pointer;color:#'.$LinkColor.';" class="small" title="Code markieren" onclick="select_div_all(\'phpcode'.$phpcodecount.'\');"><b>Code markieren</b></a>';
$text .= ' </td>';
$text .= ' </tr>';
$text .= ' <tr>';
$text .= ' <td width="5%" style="vertical-align:top;">';
$text .= ' <table border="0" width="100%" cellpadding="0" cellspacing="0">';
$text .= ' <tr>';
$text .= ' <td style="'.$styleart2.'width: 5%;border-top:1px solid #'.$BorderColorDiv.';vertical-align:top;" align="right" nowrap="nowrap" class="highlight">';
$text .= ' <span style="color:#'.$CounterColor.';">';
$text .= $text_zeilen;
$text .= ' </span>';
$text .= ' </td>';
$text .= ' </tr>';
$text .= ' </table>';
$text .= ' </td>';
$text .= ' <td style="'.$styleart1.'background-color: #'.$DivbgColor.';white-space:nowrap;padding-right:2px;vertical-align:top;" width="95%">';
$text .= ' <div style="overflow: auto; width: 100%; height: '.$textheight2.'px; border: 1px solid #'.$BorderColorDiv.';">';
$text .= ' <div style="width:95%;" id="phpcode'.$phpcodecount.'">';
$text .= ' <span style="color: #'.$DivTextColor.';">';
$text_code = preg_replace("/\r/","",$text_code);
$text_code = preg_replace("/^<\/font>/","",$text_code);
if(!preg_match("/<\/font>$/",$text_code)) $text_code .= '</font>';
$text_code = str_replace("<font","<span",$text_code);
$text_code = str_replace("</font>","</span>",$text_code);
$text_code = str_replace("color:","color:",$text_code);
$text_code = str_replace('script',"script",$text_code);
$text_code = str_replace('SCRIPT',"SCRIPT",$text_code);
$text .= $text_code;
$text .= ' </div>';
$text .= ' </div>';
$text .= ' </td>';
$text .= ' </tr>';
$text .= ' <tr>';
$text .= ' <td class="heads" height="21" width="5%"> </td>';
$text .= ' <td class="heads" width="95%" style="font-size:12px;vertical-align:middle;" align="right">';
$text .= ' <span style="color:#'.$TextColorHeadlines.';"><b>'.$headlineE.'</b></span> <span style="color:#'.$LinkColor.';">(<b>'.$xy.'</b> '.$Lines.') | </span><a style="cursor: pointer;color:#'.$LinkColor.';" class="small" title="Code markieren" onclick="select_div_all(\'phpcode'.$phpcodecount.'\');"><b>Code markieren</b></a> ';
$text .= ' </td>';
$text .= ' </tr>';
$text .= ' </table>';
$text .= ' </td>';
$text .= ' </tr>';
$text .= '</table>';
$text = str_replace('valign="top" nowrap="nowrap"> </span>','valign="top" nowrap="nowrap">',$text);
$text = str_replace('</span></span>','</span>',$text);
$pattern = "/COLOR\=\"\#(.*)\"/esiU";
while (preg_match($pattern,$text)) {
$text=preg_replace($pattern,"\$this->color2style('\\1')",$text);
}
return $text;
}
function color2style($font_code) {
return 'style="color: #'.$font_code.';'.$styleart.'"';
}
#Code Parser der KNW Community ENDE
#Multi Video Station kit-coding.de ANFANG
function videoparse($text='') {
global $SQL;
#Import Videostreams
$ImportVars=$SQL->query("SELECT movie_type FROM `".pkSQLTAB_MOVIETYPES."`");
while($Import=$SQL->fetch_assoc($ImportVars)){
$text=preg_replace("#\[".$Import['movie_type']."\](.*)\[/".$Import['movie_type']."\]#esiU","\$this->movierewrite('\\1','$Import[movie_type]')",$text);
}
return $text;
}
function movierewrite($text='', $code='') {
pkLoadClass($MOVIE,'movie');
$rewritedmovie=$MOVIE->Create_BBcode($text,$code,$this->count);
$this->count++;
return $rewritedmovie;
}
#Multi Video Station kit-coding.de ENDE
}
?> | | |
LG
mono
|
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von mono - 21.01.2020 - 19:53 Uhr |
|
|
|
|
|
|
|
|
|
|
24.01.2020 - 14:10 Uhr |
|
|
|
Nabend,
konnte erst jetzt etwas zum Thema beitragen. Dazu sei gesagt, das wir wohl erstmal die ganzen Notice-Meldungen ignorieren.
Das hat folgenden Grund:
Beim probieren diese zu beheben kamen mir im Grunde auf jeder Seite mind. eine Notice-Meldung das irgendeine Variable irgendein Problem hat ( nicht gefunden, kein Index bla bla ).
Es sind Notice-Meldungen. Die sind eh für "Ohh, da ist ja was *Notice-Meldungen ausschalt*" ^^" PHP ist, was dies angeht, ne sehr lockere Sprache.
Und da eh ein sehr großer Teil in der ErrorLog irgendwelche Notice-Meldungen waren, und jetzt ja eigentlich deaktiviert sein sollten, sollte die Datei nicht mehr sooo groß werden.
--
Gehen wir erstmal das Problem was irgendwann mit PHP 7 kommen wird: die bbcode.php
Ich pack die Datei als Anhang sowie hier nochmal im Post - der Formhalber ;o
Hier klicken zum aufklappen- pkinc/class/bbcode.php
- Suche o.g. Datei und suche das:
| PHP-Quelltext $pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU";
$text = preg_replace($pattern,"\$this->replace_bbcode('$code[html]','\\3','\\2')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU";
$text = preg_replace($pattern,"\$this->replace_bbcode('$code[html]','\\3','\\2')",$text);
*/
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->replace_bbcode($code['html'],$match[3],$match[2]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->lightbox('\\2','\\3')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->lightbox('\\2','\\3')",$text);
*/
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->lightbox($match[2],$match[3]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->htmlcode('\\2','\\3')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->htmlcode('\\2','\\3')",$text);
*/
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->htmlcode($match[2],$match[3]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $text = preg_replace("#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU","\$this->pdf('\\2','\\2')",$text);
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->pdf('\\2','\\3')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text = preg_replace("#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU","\$this->pdf('\\2','\\2')",$text);
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->pdf('\\2','\\3')",$text);
*/
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->pdf($match[2],$match[3]); }, $text);
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->pdf($match[2],$match[3]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $text = preg_replace("#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU","\$this->edit('\\2')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text = preg_replace("#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU","\$this->edit('\\2')",$text);
*/
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->edit($match[2]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $text = preg_replace("#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU","\$this->spoiler('\\3','\\2')",$text);
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->spoiler('\\2','\\3')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text = preg_replace("#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU","\$this->spoiler('\\3','\\2')",$text);
$text = preg_replace("#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU","\$this->spoiler('\\2','\\3')",$text);
*/
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->spoiler($match[3],$match[2]); }, $text);
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->spoiler($match[2],$match[3]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $text = preg_replace("#\[(".$code['tag'].")=(.*)\]([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))([\s]?)\[/\\1\]#eisuSU","\$this->replace_img_url('\\2','\\3')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text = preg_replace("#\[(".$code['tag'].")=(.*)\]([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))([\s]?)\[/\\1\]#eisuSU","\$this->replace_img_url('\\2','\\3')",$text);
*/
$pattern = "#\[(".$code['tag'].")=(.*)\]([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))([\s]?)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->replace_img_url($match[2],$match[3]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $pattern = "#\[(".$code['tag'].")]([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))([\s]?)\[\/\\1\]#eiU";
$text = preg_replace($pattern,"\$this->replace_image('$code[html]','\\2')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$pattern = "#\[(".$code['tag'].")]([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))([\s]?)\[\/\\1\]#eiU";
$text = preg_replace($pattern,"\$this->replace_image('$code[html]','\\2')",$text);
*/
$pattern = "#\[(".$code['tag'].")]([^\"\?\&]*\.(gif|jpg|jpeg|bmp|png))([\s]?)\[\/\\1\]#iU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->replace_image($code['html'],$match[2]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU"; #format: link
$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2')",$text);
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU"; #format text
$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2','\\3')",$text); | | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU"; #format: link
$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2')",$text);
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU"; #format text
$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2','\\3')",$text);
*/
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#isuSU"; #format: link
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->$func($code['html'],$match[2]); }, $text);
$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#isuSU"; #format text
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->$func($code['html'],$match[2],$match[3]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU";
$text = preg_replace($pattern,"\$this->$func('\\2','\\1')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU";
$text = preg_replace($pattern,"\$this->$func('\\2','\\1')",$text);
*/
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#isuSU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->$func($match[2],$match[1]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU";
while(preg_match($pattern,$text))
{
$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2')",$text);
} | |
Und mache daraus das:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | | PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU";
while(preg_match($pattern,$text))
{
$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2')",$text);
}
*/
$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#isuSU";
while(preg_match($pattern,$text))
{
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->$func($code['html'],$match[2]); }, $text);
}
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $text=preg_replace("#\[".$code['tag']."=(.*)\](.*)\[/".$code['tag']."\]#esiU","\$this->fskrewrite('\\1','\\2')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text=preg_replace("#\[".$code['tag']."=(.*)\](.*)\[/".$code['tag']."\]#esiU","\$this->fskrewrite('\\1','\\2')",$text);
*/
$pattern = "#\[".$code['tag']."=(.*)\](.*)\[/".$code['tag']."\]#siU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->fskrewrite($match[1],$match[2]); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $pattern = "/COLOR\=\"\#(.*)\"/esiU";
while (preg_match($pattern,$text)) {
$text=preg_replace($pattern,"\$this->color2style('\\1')",$text);
} | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$pattern = "/COLOR\=\"\#(.*)\"/esiU";
while (preg_match($pattern,$text)) {
$text=preg_replace($pattern,"\$this->color2style('\\1')",$text);
}
*/
$pattern = "/COLOR\=\"\#(.*)\"/siU";
while (preg_match($pattern,$text)) {
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->color2style($match[1]); }, $text);
}
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
- suche weiter:
| PHP-Quelltext $text=preg_replace("#\[".$Import['movie_type']."\](.*)\[/".$Import['movie_type']."\]#esiU","\$this->movierewrite('\\1','$Import[movie_type]')",$text); | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text=preg_replace("#\[".$Import['movie_type']."\](.*)\[/".$Import['movie_type']."\]#esiU","\$this->movierewrite('\\1','$Import[movie_type]')",$text);
*/
$pattern = "#\[".$Import['movie_type']."\](.*)\[/".$Import['movie_type']."\]#siU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->movierewrite($match[1],$Import['movie_type']); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
--
Ach ja, laut ErrorLog gibt es noch eine Deprecated-Meldung in der pkinc/public/guestbook.php
Laut Original-Datei gibt es 3 Stellen, wo die veraltete ( aber noch nutzbar in PHP 5 ) Funktion ereg() zu finden ist:
| Quellcode Line 116: if(ereg("http://",$gbookinfo['gbook_hpage']))
Line 533: if(ereg("http://",$userinfo['user_hpage']))
Line 555: if(ereg("http://",$gbookinfo['gbook_hpage'])) | |
Das müssten wir dann auch nochmal durchgucken ( kann da grad nicht gucken wie wo was zu ändern ist ). Sowie die Sache mit der Zeitzone - zumindest einen Workarround ( Zeitzone sollte GMT +1 Berlin etc. ja reichen ).
|
|
|
|
|
|
|
|
|
|
27.01.2020 - 18:41 Uhr |
|
|
|
Naben (:
Merci! Hab die bbcode.php mit der aus dem Anhang ersetzt und mal nachgeschaut was der error_log macht, der ist bei knapp über 200 MB also können wir uns Zeit lassen
|
|
|
|
|
|
|
|
|
|
28.01.2020 - 16:51 Uhr |
|
|
|
Nabend,
ich hatte gestern, nachdem ich die bbcode.php ersetzt habe, nicht mehr nachgeschaut aber jetzt gesehen, dass die Seite mit der neuen bbcode.php nicht mehr erreichbar war. Hab jetzt wieder die alte bbcode.php on.
LG
mono
|
|
|
|
|
|
|
|
|
|
30.01.2020 - 04:38 Uhr |
|
|
|
Nabend,
Numero 1:
- public/class/bbcode.php
Ich glaub, ich weis wo das Problem liegen könnte. Ich mach das mal jetzt nur so, da es eh nur eine Stelle ist.
- Öffne o.g. Datei und suche das (ganz unten):
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text=preg_replace("#\[".$Import['movie_type']."\](.*)\[/".$Import['movie_type']."\]#esiU","\$this->movierewrite('\\1','$Import[movie_type]')",$text);
*/
$pattern = "#\[".$Import['movie_type']."\](.*)\[/".$Import['movie_type']."\]#siU";
$text = preg_replace_callback($pattern, function($match) use ($code) { return $this->movierewrite($match[1],$Import['movie_type']); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | | |
Und mache daraus das:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
$text=preg_replace("#\[".$Import['movie_type']."\](.*)\[/".$Import['movie_type']."\]#esiU","\$this->movierewrite('\\1','$Import[movie_type]')",$text);
*/
$pattern = "#\[".$Import['movie_type']."\](.*)\[/".$Import['movie_type']."\]#siU";
$text = preg_replace_callback($pattern, function($match) use ($Import) { return $this->movierewrite($match[1],$Import['movie_type']); }, $text);
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
Es ist im Grunde nur diese Stelle:
| PHP-Quelltext use ($code) | |
die zu das wird:
| PHP-Quelltext use ($Import) | |
Ansonsten müsste man jede stelle einfach mal als Kommentar setzen und Stück für Stück wieder als Code rückgängig machen. Dann wüsste man zumindest an welcher Stelle es lag ^^""
Sofern also obige Code-Änderung nicht helfen sollte, und du das Stück für Stück testen magst:
Einfach folgende Stellen suchen:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
alter Code
*/
$pattern =
$text =
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
Damit der Code nicht mehr wirkt einfach vor dem $pattern und $text eine Raute (#) setzen:
| PHP-Quelltext # PHP 5.5.0 - Suchmuster-Modifikatoren-FIX
# --------- Old Code
/*
alter Code
*/
#$pattern =
#$text =
# PHP 5.5.0 - Suchmuster-Modifikatoren-FIX | |
Dann ist die ganze Zeile als Kommentar markiert und wird nicht ausgeführt.
--
Nummer 2:
- public/public/guestbook.php
Hier gab es ja laut ErrorLog 3 Stellen wo veraltete Funktionen genutzt werden.
| Quellcode Line 116: if(ereg("http://",$gbookinfo['gbook_hpage']))
Line 533: if(ereg("http://",$userinfo['user_hpage']))
Line 555: if(ereg("http://",$gbookinfo['gbook_hpage'])) | |
- Also öffne o.g. Datei und suche das (Zeile 116):
| PHP-Quelltext if(ereg("http://",$gbookinfo['gbook_hpage'])) | |
Und mache daraus das:
| PHP-Quelltext if(StrIPos($gbookinfo['gbook_hpage'], "http://")) | |
- Suche weiter (Zeile 533):
| PHP-Quelltext if(ereg("http://",$userinfo['user_hpage'])) | |
Und mache daraus das:
| PHP-Quelltext if(StrIPos($userinfo['user_hpage'], "http://")) | |
- Suche weiter (Zeile 555):
| PHP-Quelltext if(ereg("http://",$gbookinfo['gbook_hpage'])) | |
Und mache daraus das:
| PHP-Quelltext if(StrIPos($gbookinfo['gbook_hpage'], "http://")) | |
Bei den stellen brauchen wir kein ereg() (veraltet und ab PHP7 entfernt). Hier reicht diese einfache Abfrage mit der Funktion StrIPos.
--
Nummer 3:
- public/main.php
Die ErrorLog ist ja jetzt so eingestellt, das Notice- und Deprecated-Meldungen ignoriert werden. Letzteres sollte ruhig weiter gelogt werden, da diese doch zu Problemem führen können ( im Bezug auf PHP7 und spätere Versionen ).
- Also öffne o.g. Datei und suche das:
| PHP-Quelltext else
{
#@error_reporting(0);
@error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
@ini_set( 'display_errors', 0 );
} | |
Und mache daraus das:
| PHP-Quelltext else
{
#@error_reporting(0);
@error_reporting(E_ALL & ~E_NOTICE);
@ini_set( 'display_errors', 0 );
} | |
--
Nummer 4:
- public/main.php
Bzgl. der TimeZone-Meldungen .. Probier es mal so:
- Öffne o.g. Datei und suche das:
| PHP-Quelltext // set some constants
define('pkMICROTIME', microtime()); | |
Und füge DARÜBER das ein
| PHP-Quelltext If (!ini_get('date.timezone'))
{
date_default_timezone_set('Europe/Berlin');
} | |
Theoretisch sollte, sofern noch keine Zeitzone bestimmt wurde, auf Europa/Berlin gestellt werden. Das ist jetzt ein fixer Wert, aber da wir ja in DE leben sollte das passen
|
|
|
|
|
|
|
|
|
|
31.01.2020 - 13:36 Uhr |
|
|
|
Moinsen,
Dankeschön, bin das ganze einmal druchgegangen:
1. Hab ($code) durch ($Import) ersetzt, hat allerdings nicht gefunzt. Danach habe ich die Änderungen wie beschrieben einzeln ausgeklammert, aber keine der Ausklammerungen führte dazu, dass die Seite angezeigt wird. Vielleicht sind es mehrere Stellen, allerdings hat es wenig Sinn wenn ich komplett ohne inhaltlichen Kontext verschiedenste Variationen durchgehe, daher habe ich da nicht weiter herumexperimentiert ^^
Ach ja: unter public/class/bbcode.php habe ich keine bbcode.php gefunden, daher bin ich davon ausgegangen das pkinc/class/bbcode.php gemeint ist.
2. Check
Hier habe ich den Pfad pkinc/public/guestbook.php benutzt.
3. Check
Hier habe ich den Pfad pkinc/main.php benutzt.
4. Check
Hier habe ich ebenfalls den Pfad pkinc/main.php benutzt.
Den error_log habe ich jetzt noch einmal gelöscht, der lag aktuell bei 370 MB.
LG
mono
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von mono - 31.01.2020 - 13:37 Uhr |
|
|
|
|
|
|
|
|
|
|
|
Ähnliche Themen |
|
|
|
|
|
|
|
|