Subversion Repositories personal-webbase

Rev

Rev 3 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 10
Line 4... Line 4...
4
 
4
 
5
//////////////////////////////////////////////////////////////////////////////
5
//////////////////////////////////////////////////////////////////////////////
6
// CODIERUNGSFUNKTIONEN                                                     //
6
// CODIERUNGSFUNKTIONEN                                                     //
7
//////////////////////////////////////////////////////////////////////////////
7
//////////////////////////////////////////////////////////////////////////////
8
 
8
 
-
 
9
function wb_htmlentities($x) {
-
 
10
        return htmlentities($x, ENT_COMPAT, 'iso-8859-1');
-
 
11
}
-
 
12
 
9
function encode_critical_html_characters($inp)
13
function encode_critical_html_characters($inp)
10
{
14
{
11
        $inp = str_replace('&', '&', $inp);
15
        $inp = str_replace('&', '&', $inp);
12
        //$inp = str_replace('"', '"', $inp);
16
        //$inp = str_replace('"', '"', $inp);
13
        $inp = str_replace('<', '&lt;', $inp);
17
        $inp = str_replace('<', '&lt;', $inp);
Line 27... Line 31...
27
}
31
}
28
 
32
 
29
function executable_html_code($inp)
33
function executable_html_code($inp)
30
{
34
{
31
        // Wenn der Benutzer z.B. ä im HTML-Formular eingegeben hat, würde hier aufgrund von Unicode quatsch rauskommen
35
        // Wenn der Benutzer z.B. ä im HTML-Formular eingegeben hat, würde hier aufgrund von Unicode quatsch rauskommen
32
        $inp = htmlentities($inp, ENT_COMPAT, 'UTF-8');
36
        $inp = wb_htmlentities($inp, ENT_COMPAT, 'UTF-8');
33
 
37
 
34
        $inp = decode_critical_html_characters($inp);
38
        $inp = decode_critical_html_characters($inp);
35
 
39
 
36
        $trans = get_html_translation_table(HTML_ENTITIES);
40
        $trans = get_html_translation_table(HTML_ENTITIES);
37
        foreach ($trans as $m1 => $m2)
41
        foreach ($trans as $m1 => $m2)
Line 305... Line 309...
305
        }
309
        }
306
        unset ($client_ip, $x_forwarded_for, $remote_addr, $ip_expl);
310
        unset ($client_ip, $x_forwarded_for, $remote_addr, $ip_expl);
307
        return $return;
311
        return $return;
308
}
312
}
309
 
313
 
310
function my_htmlentities($inp, $charset = 'utf-8')
314
function my_wb_htmlentities($inp, $charset = 'utf-8')
311
{
315
{
312
        // http://www.php.net/manual/de/function.htmlspecialchars.php
316
        // http://www.php.net/manual/de/function.htmlspecialchars.php
313
        // PHP-Version wird nicht kontrolliert...
317
        // PHP-Version wird nicht kontrolliert...
314
        $cs = 'utf-8';
318
        $cs = 'utf-8';
315
 
319
 
Line 340... Line 344...
340
        if (strtolower($charset) == 'sjis') $cs = 'Shift_JIS';
344
        if (strtolower($charset) == 'sjis') $cs = 'Shift_JIS';
341
        if (strtolower($charset) == '932') $cs = 'Shift_JIS';
345
        if (strtolower($charset) == '932') $cs = 'Shift_JIS';
342
        if (strtolower($charset) == 'euc-jp') $cs = 'EUC-JP';
346
        if (strtolower($charset) == 'euc-jp') $cs = 'EUC-JP';
343
        if (strtolower($charset) == 'eucjp') $cs = 'EUC-JP';
347
        if (strtolower($charset) == 'eucjp') $cs = 'EUC-JP';
344
 
348
 
345
        return @htmlentities($inp, ENT_NOQUOTES, $cs);
349
        return @wb_htmlentities($inp, ENT_NOQUOTES, $cs);
346
}
350
}
347
 
351
 
348
function check_email($email_adresse)
352
function check_email($email_adresse)
349
{
353
{
350
        if(eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$",$email_adresse))
354
        if(preg_match("|^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$|ismU",$email_adresse))
351
                return true;
355
                return true;
352
        else
356
        else
353
                return false;
357
                return false;
354
}
358
}
355
 
359
 
Line 529... Line 533...
529
        else if (file_exists('modules/'.$titelzeile_modul.'/images/menu/32.png'))
533
        else if (file_exists('modules/'.$titelzeile_modul.'/images/menu/32.png'))
530
                $g = 'modules/'.$titelzeile_modul.'/images/menu/32.png';
534
                $g = 'modules/'.$titelzeile_modul.'/images/menu/32.png';
531
        else
535
        else
532
                $g = 'designs/spacer.gif';
536
                $g = 'designs/spacer.gif';
533
 
537
 
534
        return "javascript:oop('".$modul."', '".$seite."', '".htmlentities($module_information->caption)."', '".$g."');";
538
        return "javascript:oop('".$modul."', '".$seite."', '".wb_htmlentities($module_information->caption)."', '".$g."');";
535
}
539
}
536
 
540
 
537
function wb_list_items($modul, $table, $append, $dir = 0)
541
function wb_list_items($modul, $table, $append, $dir = 0)
538
{
542
{
539
        global $benutzer;
543
        global $benutzer;
Line 678... Line 682...
678
 
682
 
679
//////////////////////////////////////////////////////////////////////////////
683
//////////////////////////////////////////////////////////////////////////////
680
// FUNKTIONEN FÜR MODUL-XML UND DESIGN-XML                                                                                                                                      //
684
// FUNKTIONEN FÜR MODUL-XML UND DESIGN-XML                                                                                                                                      //
681
//////////////////////////////////////////////////////////////////////////////
685
//////////////////////////////////////////////////////////////////////////////
682
 
686
 
-
 
687
class WebBase_Module_Info
-
 
688
{
-
 
689
        private $f_name;
-
 
690
        private $f_author;
-
 
691
        private $f_version;
-
 
692
        private $f_language;
-
 
693
 
-
 
694
        // 0 = Public Freeware
-
 
695
        // 1 = Public Shareware
-
 
696
        // 2 = Private Secured
-
 
697
        // 3 = Personal WebBase-Core
-
 
698
        // 4 = Personal WebBase-Enclosure
-
 
699
        private $f_license;
-
 
700
 
-
 
701
        function name() {
-
 
702
                return $this->f_name;
-
 
703
        }
-
 
704
 
-
 
705
        function author() {
-
 
706
                return $this->f_author;
-
 
707
        }
-
 
708
 
-
 
709
        function version() {
-
 
710
                return $this->f_version;
-
 
711
        }
-
 
712
 
-
 
713
        function language() {
-
 
714
                return $this->f_language;
-
 
715
        }
-
 
716
 
-
 
717
        function license() {
-
 
718
                return $this->f_license;
-
 
719
        }
-
 
720
 
-
 
721
        function WebBase_Module_Info($name, $author, $version, $language, $license) {
-
 
722
                $this->f_name = $name;
-
 
723
                $this->f_author = $author;
-
 
724
                $this->f_version = $version;
-
 
725
                $this->f_language = $language;
-
 
726
                $this->f_license = $license;
-
 
727
        }
-
 
728
};
-
 
729
 
683
require 'includes/WBModulHandler.class.php';
730
class WBModuleHandler {
-
 
731
 
-
 
732
        private static $cache_module_information = Array();
-
 
733
 
-
 
734
        function get_module_information($modulename)
-
 
735
        {
-
 
736
                if (isset(self::$cache_module_information[$modulename])) {
-
 
737
                        return self::$cache_module_information[$modulename];
-
 
738
                }
-
 
739
 
-
 
740
                if (function_exists('getmicrotime')) $ss = getmicrotime();
-
 
741
 
-
 
742
                $xml = new xml();
-
 
743
 
-
 
744
                if ((!strpos($modulename, '..')) && (file_exists('modules/'.$modulename.'/info.xml')))
-
 
745
                {
-
 
746
                        $object = $xml->xml_file_to_object('modules/'.$modulename.'/info.xml');
-
 
747
 
-
 
748
                        if ($object->name == 'moduleinfo')
-
 
749
                        {
-
 
750
                                $v_expected_name = '';
-
 
751
                                $v_author = '';
-
 
752
                                $v_version = '';
-
 
753
                                $v_language = '';
-
 
754
                                $v_license = '';
-
 
755
 
-
 
756
                                foreach ($object->children as $m1 => $m2)
-
 
757
                                {
-
 
758
                                        if ($object->children[$m1]->name == 'expected_name') $v_expected_name = $object->children[$m1]->content;
-
 
759
                                        if ($object->children[$m1]->name == 'author') $v_author = $object->children[$m1]->content;
-
 
760
                                        if ($object->children[$m1]->name == 'version') $v_version = $object->children[$m1]->content;
-
 
761
                                        if ($object->children[$m1]->name == 'language') $v_language = $object->children[$m1]->content;
-
 
762
                                        if ($object->children[$m1]->name == 'license') $v_license = $object->children[$m1]->content;
-
 
763
                                }
-
 
764
 
-
 
765
                                $output = new WebBase_Module_Info($v_expected_name, $v_author, $v_version, $v_language, $v_license);
-
 
766
 
-
 
767
                                if ($output->caption == '') $output->caption = $modulename;
-
 
768
 
-
 
769
                                if (function_exists('getmicrotime')) {
-
 
770
                                        $ee = getmicrotime();
-
 
771
                                        global $xml_time;
-
 
772
                                        $xml_time += $ee-$ss;
-
 
773
                                        global $xml_count;
-
 
774
                                        $xml_count++;
-
 
775
                                }
-
 
776
 
-
 
777
                                self::$cache_module_information[$modulename] = $output;
-
 
778
 
-
 
779
                                return $output;
-
 
780
                        }
-
 
781
                        else
-
 
782
                        {
-
 
783
                                return NULL;
-
 
784
                        }
-
 
785
                }
-
 
786
                else
-
 
787
                {
-
 
788
                        return NULL;
-
 
789
                }
-
 
790
        }
684
 
791
 
-
 
792
}
-
 
793
 
-
 
794
class WebBase_Design_Info
-
 
795
{
-
 
796
        private $f_name;
-
 
797
        private $f_author;
-
 
798
        private $f_version;
-
 
799
 
-
 
800
        // 0 = Third-Party-Product
-
 
801
        // 1 = Official Product
-
 
802
        private $f_license;
-
 
803
 
-
 
804
        function name() {
-
 
805
                return $this->f_name;
-
 
806
        }
-
 
807
 
-
 
808
        function author() {
-
 
809
                return $this->f_author;
-
 
810
        }
-
 
811
 
-
 
812
        function version() {
-
 
813
                return $this->f_version;
-
 
814
        }
-
 
815
 
-
 
816
        function license() {
-
 
817
                return $this->f_license;
-
 
818
        }
-
 
819
 
-
 
820
        function WebBase_Design_Info($name, $author, $version, $license) {
-
 
821
                $this->f_name = $name;
-
 
822
                $this->f_author = $author;
-
 
823
                $this->f_version = $version;
-
 
824
                $this->f_license = $license;
-
 
825
        }
-
 
826
};
-
 
827
 
-
 
828
class WBModuleHandler {
-
 
829
 
-
 
830
        private static $cache_design_information = Array();
-
 
831
 
-
 
832
        function get_design_information($designname)
-
 
833
        {
-
 
834
                if (isset(self::$cache_design_information[$designname])) {
685
require 'includes/WBDesignHandler.class.php';
835
                        return self::$cache_design_information[$designname];
-
 
836
                }
-
 
837
 
-
 
838
                if (function_exists('getmicrotime')) $ss = getmicrotime();
-
 
839
 
-
 
840
                $xml = new xml();
-
 
841
 
-
 
842
                if ((!strpos($designname, '..')) && (file_exists('designs/'.$designname.'/info.xml')))
-
 
843
                {
-
 
844
                        $object = $xml->xml_file_to_object('designs/'.$designname.'/info.xml');
-
 
845
 
-
 
846
                        if ($object->name == 'designinfo')
-
 
847
                        {
-
 
848
                                $v_name = '';
-
 
849
                                $v_author = '';
-
 
850
                                $v_version = '';
-
 
851
                                $v_license = '';
-
 
852
 
-
 
853
                                foreach ($object->children as $m1 => $m2)
-
 
854
                                {
-
 
855
                                        if ($object->children[$m1]->name == 'name') $v_name = $object->children[$m1]->content;
-
 
856
                                        if ($object->children[$m1]->name == 'author') $v_author = $object->children[$m1]->content;
-
 
857
                                        if ($object->children[$m1]->name == 'version') $v_version = $object->children[$m1]->content;
-
 
858
                                        if ($object->children[$m1]->name == 'license') $v_license = $object->children[$m1]->content;
-
 
859
                                }
-
 
860
 
-
 
861
                                $output = new WebBase_Design_Info($v_name, $v_author, $v_version, $v_license);
-
 
862
 
-
 
863
                                if ($output->name == '') $output->name = $designname;
-
 
864
 
-
 
865
                                if (function_exists('getmicrotime')) {
-
 
866
                                        $ee = getmicrotime();
-
 
867
                                        global $xml_time;
-
 
868
                                        $xml_time += $ee-$ss;
-
 
869
                                        global $xml_count;
-
 
870
                                        $xml_count++;
-
 
871
                                }
-
 
872
 
-
 
873
                                self::$cache_design_information[$designname] = $output;
-
 
874
 
-
 
875
                                return $output;
-
 
876
                        }
-
 
877
                        else
-
 
878
                        {
-
 
879
                                return NULL;
-
 
880
                        }
-
 
881
                }
-
 
882
                else
-
 
883
                {
-
 
884
                        return NULL;
-
 
885
                }
-
 
886
        }
-
 
887
}
686
 
888
 
687
/* Konstanten */
889
/* Konstanten */
688
 
890
 
689
define('RELATIVE_DIR', dir_add_trailing_backslash(dirname($_SERVER['PHP_SELF'])));
891
define('RELATIVE_DIR', dir_add_trailing_backslash(dirname($_SERVER['PHP_SELF'])));
690
 
892