Commits vergleichen
227 Commits
feature/sc
...
develop
Autor | SHA1 | Datum |
---|---|---|
o.pinke | f8ac1fe90d | |
o.pinke | bdabf086af | |
o.pinke | 7dbcb40790 | |
o.pinke | 95444fed6a | |
o.pinke | 8e3c1d979b | |
o.pinke | 92181aba97 | |
o.pinke | 4d65fba9dc | |
o.pinke | a8f68477fa | |
o.pinke | 1e898500d3 | |
o.pinke | ca841298f4 | |
Ortwin Pinke | 28b037b0a5 | |
o.pinke | 12a87f3f4d | |
o.pinke | 754c174e9d | |
o.pinke | 24ba3bdb26 | |
o.pinke | 8c693ec00c | |
o.pinke | cfeb2c7bc3 | |
o.pinke | cb89e4477b | |
o.pinke | a6ee04a0bb | |
o.pinke | 910d246945 | |
o.pinke | 3be4baf751 | |
o.pinke | 96b264defa | |
o.pinke | 1eb4c86d57 | |
o.pinke | e99363f44a | |
o.pinke | ed6b5569fd | |
o.pinke | a34f26177e | |
o.pinke | ea2fbc499a | |
o.pinke | 824e1f1625 | |
o.pinke | 9adbbdd164 | |
o.pinke | 9d5af6dc52 | |
o.pinke | bbf4fe66b2 | |
Ortwin Pinke | 1f807f13ef | |
o.pinke | df76ce462a | |
o.pinke | 33e941aecf | |
Ortwin Pinke | 1419bbf701 | |
Ortwin Pinke | b185332a35 | |
o.pinke | 6b98e3a4f5 | |
Ortwin Pinke | 1c94d40e04 | |
o.pinke | f016933445 | |
o.pinke | 3a71ed5cf1 | |
o.pinke | 12e58c78ef | |
Ortwin Pinke | 449cc39cdc | |
o.pinke | 23538e80bb | |
o.pinke | 8987db8e69 | |
o.pinke | c883bd2060 | |
o.pinke | 4debd1559b | |
o.pinke | 63fb94db39 | |
o.pinke | a397b65fcd | |
o.pinke | 71e13f626e | |
o.pinke | 2c999a7048 | |
Ortwin Pinke | 6a28bd3eaf | |
o.pinke | dfdbecba7e | |
o.pinke | 95d401cb1e | |
o.pinke | 9d2f901385 | |
o.pinke | 881a247635 | |
Ortwin Pinke | 5b8e93788b | |
Ortwin Pinke | 10a1832a5a | |
Ortwin Pinke | 764991d239 | |
Ortwin Pinke | 8c65d7a755 | |
Ortwin Pinke | 9d934b81f9 | |
Ortwin Pinke | 68bcdc4c1d | |
Ortwin Pinke | 8f8553996e | |
Ortwin Pinke | 60c61a86f9 | |
o.pinke | ccff65a4e9 | |
o.pinke | a96777d29c | |
o.pinke | a8926c1723 | |
o.pinke | 513e575a41 | |
o.pinke | 53e6a7a47f | |
o.pinke | 8ec4add782 | |
o.pinke | 01255ad980 | |
o.pinke | c9eaa03cd0 | |
o.pinke | 5ccdc05e6b | |
o.pinke | 613c95ad70 | |
o.pinke | 210091ad9b | |
o.pinke | 680b5bad71 | |
o.pinke | 35fe2dd066 | |
o.pinke | 727cad0e1e | |
o.pinke | 28acb7f004 | |
o.pinke | 0b20d638f6 | |
o.pinke | dd79ad7e59 | |
o.pinke | 05327f3518 | |
o.pinke | 46c1c1c3c3 | |
o.pinke | 0de29ea0b6 | |
Ortwin Pinke | 2e386d7c41 | |
Ortwin Pinke | 70b845ca58 | |
Ortwin Pinke | 4b69f07b8f | |
Ortwin Pinke | 41c69d53fe | |
Ortwin Pinke | 629983db56 | |
Ortwin Pinke | 8798c805f6 | |
Ortwin Pinke | d491725779 | |
o.pinke | d589909e87 | |
o.pinke | 8909189c91 | |
o.pinke | cf0eecefb4 | |
o.pinke | 12637e8f24 | |
o.pinke | 88cfcbd342 | |
o.pinke | 068c042318 | |
o.pinke | a54fbde1c3 | |
o.pinke | 82dca3c1e2 | |
o.pinke | 57db5e9fde | |
o.pinke | aa34d49978 | |
Ortwin Pinke | b438f15708 | |
Ortwin Pinke | fcda0a460b | |
Ortwin Pinke | 219d52f739 | |
Ortwin Pinke | bf4c753342 | |
Ortwin Pinke | 1a3475b305 | |
Ortwin Pinke | 903dbf8d42 | |
o.pinke | 625c6ab405 | |
o.pinke | 7ecf03870a | |
o.pinke | fc6ea7746d | |
o.pinke | 606f48500f | |
o.pinke | 85d3f956e8 | |
o.pinke | dfcc174626 | |
o.pinke | 7c69afa326 | |
o.pinke | 6729446154 | |
o.pinke | 434b483fac | |
o.pinke | fa3c96b94d | |
o.pinke | 7638a62ace | |
o.pinke | 1ff067d615 | |
o.pinke | 90dbc01650 | |
o.pinke | 33dcc58748 | |
o.pinke | 4aba95edd1 | |
o.pinke | b199edaf8e | |
o.pinke | 6847130805 | |
o.pinke | 44382f8da0 | |
o.pinke | 965c7054f4 | |
o.pinke | 97a3370258 | |
o.pinke | 9367766e7d | |
o.pinke | d1528111e2 | |
o.pinke | 106f003bfa | |
o.pinke | 6f0385f4ba | |
o.pinke | 0589fd287e | |
o.pinke | c0e250a21f | |
o.pinke | efa03003be | |
o.pinke | d3e73bfe0a | |
o.pinke | af5bf9be94 | |
o.pinke | 3f15c205a0 | |
o.pinke | 7ca3bf10bb | |
o.pinke | 34d2c9ca2a | |
o.pinke | 3d1a930809 | |
o.pinke | a919480ca7 | |
o.pinke | 106f7bbcff | |
o.pinke | 81638e9b7e | |
o.pinke | d9a191eeab | |
o.pinke | 9b6a6268f0 | |
Ortwin Pinke | aa22765927 | |
Ortwin Pinke | ba6d871ec0 | |
Ortwin Pinke | b66c6fcf71 | |
Ortwin Pinke | ec6c0cb788 | |
Ortwin Pinke | 135238dc01 | |
Ortwin Pinke | 0a4330bbf0 | |
Ortwin Pinke | e7077870e3 | |
Ortwin Pinke | 1fea4e1eac | |
Ortwin Pinke | 5f1af41450 | |
Ortwin Pinke | 58b47350e1 | |
Ortwin Pinke | 10f55120eb | |
Ortwin Pinke | 102acd14f5 | |
Ortwin Pinke | f6c043ed76 | |
Ortwin Pinke | 53bd5fabf9 | |
Ortwin Pinke | 0c3b125735 | |
Ortwin Pinke | a4241a0681 | |
Ortwin Pinke | fd21c77299 | |
Ortwin Pinke | 7d3d3b7cbb | |
Ortwin Pinke | 82f6517398 | |
Ortwin Pinke | b409ba0915 | |
Ortwin Pinke | 5863b1e5e9 | |
Ortwin Pinke | 823022cb0a | |
o.pinke | b6ca65ede8 | |
Ortwin Pinke | 9bd6e1805b | |
Ortwin Pinke | 0f7310a6f5 | |
Ortwin Pinke | 9c71c7e48e | |
Ortwin Pinke | 823796a768 | |
Ortwin Pinke | 10725d7234 | |
Ortwin Pinke | 6a150745dd | |
o.pinke | ad3edca025 | |
o.pinke | d482a362af | |
o.pinke | 50553924d4 | |
o.pinke | 8a06c55f75 | |
o.pinke | 1c01dca90a | |
o.pinke | 59cb72faef | |
o.pinke | 10380f8a9e | |
o.pinke | af38d921c3 | |
Ortwin Pinke | 1ad477e427 | |
Ortwin Pinke | 461305119c | |
o.pinke | 100c60cc23 | |
o.pinke | b2f7798eee | |
o.pinke | f46d4fea20 | |
o.pinke | 47e3333a90 | |
o.pinke | bbad0ba0ab | |
o.pinke | 4fd28abfb2 | |
o.pinke | 885eec3df0 | |
o.pinke | f0aaecbded | |
o.pinke | 9aaecb27cd | |
o.pinke | 0233aead87 | |
Ortwin Pinke | d4a59c7504 | |
Ortwin Pinke | 52153f1199 | |
Ortwin Pinke | 7b5301b75c | |
Ortwin Pinke | a122b67aa4 | |
Ortwin Pinke | 04741dd66f | |
Ortwin Pinke | f6f95929dd | |
Ortwin Pinke | 56013aa610 | |
o.pinke | 4ff23df02e | |
o.pinke | 4b8c93b9ee | |
o.pinke | ebcabff316 | |
o.pinke | 0a7adbf0db | |
o.pinke | 007afbc4f9 | |
o.pinke | 6093e0a2c1 | |
o.pinke | 3b151533a3 | |
o.pinke | 9f7db302d8 | |
o.pinke | 0639611682 | |
o.pinke | ff178faf83 | |
o.pinke | 1123b91eb2 | |
o.pinke | 566585c559 | |
o.pinke | ce604ed05a | |
o.pinke | 85a5027880 | |
Ortwin Pinke | eea9100b3e | |
o.pinke | 2bb8aa3f6d | |
o.pinke | 2ee0a49edd | |
o.pinke | 50d0eb41d9 | |
o.pinke | 797bc023fe | |
o.pinke | 62aae45545 | |
o.pinke | 5a6dd07786 | |
o.pinke | 05eea0967a | |
o.pinke | 2682a4d1c7 | |
Ortwin Pinke | ad6b0f5bb5 | |
o.pinke | 60d3296537 | |
o.pinke | 7791ce27ee | |
o.pinke | 6c93d0cdce | |
o.pinke | 7724016e9c |
|
@ -1,4 +1,5 @@
|
|||
/nbproject/private/
|
||||
/.idea/workspace.xml
|
||||
/data/config/production/config.php
|
||||
/_dev/
|
||||
/conlite/plugins/pluginmanager/_src
|
||||
|
@ -15,3 +16,11 @@
|
|||
/conlite/includes/include.style_edit_form_1.php
|
||||
/cms/config.local.php
|
||||
/cms/dflip/
|
||||
/cms/js/firstlevel/
|
||||
/conlite/external/**/.git
|
||||
/conlite/logs/debug.log
|
||||
/cms/data/config/production/config.mod_rewrite.php
|
||||
/cms/data/config/production/config.local.php
|
||||
/cms/cache/*
|
||||
composer.phar
|
||||
/conlite/vendor/
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
[submodule "conlite/plugins/cl-newsletter"]
|
||||
path = conlite/plugins/cl-newsletter
|
||||
url = https://gitport.de/ConLite/cl-newsletter.git
|
||||
[submodule "conlite/plugins/cl-content-allocation"]
|
||||
path = conlite/plugins/cl-content-allocation
|
||||
url = https://gitport.de/ConLite/cl-content-allocation.git
|
10
.htaccess
10
.htaccess
|
@ -14,7 +14,11 @@
|
|||
# $Id: htaccess_simple.txt 145 2019-10-25 16:00:47Z oldperl $
|
||||
################################################################################
|
||||
|
||||
#SetEnv CONLITE_ENVIRONMENT development
|
||||
# easily set this enviroment variable to the config you want to use
|
||||
# add a config folder with the same name in data/config and cms/data/config
|
||||
# and use your custom config for development
|
||||
|
||||
#SetEnv CONLITE_ENVIRONMENT develop
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
|
@ -33,7 +37,7 @@
|
|||
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
|
||||
RewriteCond %{QUERY_STRING} ftp://.*$ [NC,OR]
|
||||
RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC]
|
||||
RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana
|
||||
RewriteRule ^.* - [F,L,DPI] # all matching conditions from above will end in nirvana
|
||||
|
||||
# Rewrite request to root to front_content.php
|
||||
RewriteRule ^$ front_content.php [QSA,L]
|
||||
|
@ -44,7 +48,7 @@
|
|||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^.*$ - [NC,L]
|
||||
RewriteRule ^.*$ - [NC,L,DPI]
|
||||
|
||||
# Pass other requests to front_content.php
|
||||
RewriteRule ^.*$ front_content.php [QSA,NC,L]
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external" isTestSource="false" packagePrefix="Conlite\External\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/endroid/qr-code/src" isTestSource="false" packagePrefix="Endroid\QrCode\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/endroid/qr-code/tests" isTestSource="true" packagePrefix="Endroid\QrCode\Tests\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/endroid/qr-code/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/phpmailer/phpmailer/src" isTestSource="false" packagePrefix="PHPMailer\PHPMailer\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/phpmailer/phpmailer/test" isTestSource="true" packagePrefix="PHPMailer\Test\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/phpmailer/phpmailer/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/edit_area/images" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/edit_area/langs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/edit_area/plugins" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/edit_area/reg_syntax" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/frontend/cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/frontend/css" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/frontend/data" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/frontend/images" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/frontend/includes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/frontend/js" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/frontend/logs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/frontend/templates" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/frontend/upload" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/myclabs/deep-copy" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/nikic/php-parser" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phar-io/manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phar-io/version" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpmailer/phpmailer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpqrcode/bindings" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpqrcode/tools" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpstan/phpstan" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpunit/php-code-coverage" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpunit/php-file-iterator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpunit/php-invoker" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpunit/php-text-template" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpunit/php-timer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/phpunit/phpunit" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/rector/rector" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/cli-parser" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/code-unit" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/code-unit-reverse-lookup" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/comparator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/complexity" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/diff" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/environment" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/exporter" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/global-state" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/lines-of-code" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/object-enumerator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/object-reflector" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/recursion-context" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/type" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/sebastian/version" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/theseer/tokenizer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/external/wysiwyg/tinymce3" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="uk.co.ben_gibson.git.link.SettingsState">
|
||||
<option name="host" value="e0f86390-1091-4871-8aeb-f534fbc99cf0" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/endroid/qr-code/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/phpmailer/phpmailer/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/classes" isTestSource="false" packagePrefix="ConLite\" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/vendor/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/vendor/phpmailer/phpmailer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/vendor/phpstan/phpstan" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/vendor/rector/rector" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpmailer/phpmailer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/plugins/de.ortwinpinke.soccer_betting_game/vendor/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/conlite/plugins/de.ortwinpinke.soccer_betting_game/vendor/rinvex/countries" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Codeception">
|
||||
<option name="configurations">
|
||||
<list>
|
||||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||
</Configuration>
|
||||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||
</Configuration>
|
||||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||
</Configuration>
|
||||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||
</Configuration>
|
||||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||
</Configuration>
|
||||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||
</Configuration>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="dev_clphp74@localhost" uuid="e4a121a5-564c-40f5-b527-e0a343539f90">
|
||||
<driver-ref>mariadb</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mariadb://localhost:3306/dev_clphp74</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData" serverName="clphp8" />
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/clphp8.iml" filepath="$PROJECT_DIR$/.idea/clphp8.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/conlite/external/phpqrcode/bindings" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/phpqrcode/tools" />
|
||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpmailer/phpmailer" />
|
||||
<path value="$PROJECT_DIR$/vendor/twig/twig" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/conlite/vendor/phpmailer/phpmailer" />
|
||||
<path value="$PROJECT_DIR$/conlite/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/conlite/vendor/rector/rector" />
|
||||
<path value="$PROJECT_DIR$/conlite/vendor/phpstan/phpstan" />
|
||||
<path value="$PROJECT_DIR$/conlite/plugins/de.ortwinpinke.soccer_betting_game/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/conlite/plugins/de.ortwinpinke.soccer_betting_game/vendor/rinvex/countries" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
<component name="PhpStan">
|
||||
<PhpStan_settings>
|
||||
<PhpStanConfiguration tool_path="$PROJECT_DIR$/conlite/external/bin/phpstan" />
|
||||
</PhpStan_settings>
|
||||
</component>
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpUnit">
|
||||
<phpunit_settings>
|
||||
<PhpUnitSettings custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" />
|
||||
</phpunit_settings>
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PHPSpec">
|
||||
<suites>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
</suites>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PHPUnit">
|
||||
<option name="directories">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/conlite/external/endroid/qr-code/tests" />
|
||||
<option value="$PROJECT_DIR$/conlite/external/phpmailer/phpmailer/tests" />
|
||||
<option value="$PROJECT_DIR$/tests" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/conlite/plugins/cl-content-allocation" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/conlite/plugins/cl-mod-rewrite" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/conlite/plugins/cl-newsletter" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
78
README.md
78
README.md
|
@ -1,71 +1,75 @@
|
|||
----------------------------------------------------------------------------------------------------
|
||||
This is the readme file for ConLite 2.1.2
|
||||
This is the readme file for **ConLite 3.0.0**
|
||||
|
||||
Any help you need you may find by visiting the following links.
|
||||
|
||||
CL-Portal http//conlite.org
|
||||
CL-Forum http://forum.conlite.org
|
||||
CL-Bugtracker http://bugs.conlite.org
|
||||
CL-API-Doc http://conlite.conrepo.org/api/4.8.16CL
|
||||
* CL-Portal [https://conlite.org](https://conlite.org)
|
||||
* CL-Forum [http://forum.conlite.org](http://forum.conlite.org)
|
||||
* CL-Bugtracker [https://gitport.de/ConLite/ConLite/issues](https://gitport.de/ConLite/ConLite/issues)
|
||||
* CL-API-Doc [https://api.conlite.org/CL3_0_0](https://api.conlite.org/CL3_0_0)
|
||||
|
||||
!!! Attention !!!
|
||||
We tried to fix all known bugs of Contenido 4.8 and earlier but cannot give any garanties for that. So use
|
||||
it on your own risk. If you find any bug or have any idea to enhance ConLite, feel free to visit our
|
||||
bugtracker and register at http://bugs.conlite.org
|
||||
### !!! Attention !!!
|
||||
|
||||
We tried to fix all known bugs of Contenido 4.8 and earlier but cannot give any garanties for that. So use
|
||||
it on your own risk. If you find any bug or have any idea to enhance ConLite, feel free to visit our
|
||||
bugtracker at [https://gitport.de/ConLite/ConLite/issues](https://gitport.de/ConLite/ConLite/issues)
|
||||
Any help and ideas are welcome :)
|
||||
|
||||
** Mini FAQ **
|
||||
### Mini FAQ
|
||||
|
||||
What is ConLite?
|
||||
#### What is ConLite?
|
||||
|
||||
CL (short for ConLite) is dedicated to close the gap between Contenido 4.8 and the version 4.10.
|
||||
In downloadable 4.8.20 (and former 4.8.15) are still a lot of bugs and some missing feautures and
|
||||
In downloadable 4.8.20 (and former 4.8.15) are still a lot of bugs and some missing feautures and
|
||||
enhancements so one cannot use the version without problems. Our goal is to give you a bugfixed and
|
||||
really stable version of Contenido till the 4.9 or 4.10 is stable. By the way, there are still a lot of big sides
|
||||
really stable version of Contenido till the 4.9 or 4.10 is stable. By the way, there are still a lot of big sides
|
||||
build with 4.8.x out there where upgrading to 4.10.x is not possible or cost a lot of money.
|
||||
|
||||
Why i have to use ConLite?
|
||||
#### Why i have to use ConLite?
|
||||
|
||||
You don't have to, but feel free to do it. ConLite will show you an easier way to upgrade step by step to Contenido
|
||||
You don't have to, but feel free to do it. ConLite will show you an easier way to upgrade step by step to Contenido
|
||||
4.10. The new version of Contenido has a lot of changes, so you have to do a lot of work
|
||||
with modules or custom plugins to adapt them to the new version. That's not what ConLite does nor will
|
||||
do in the future. ConLite will do changes step by step, or better version by version to adapt your
|
||||
4.8.x or higher installation to work with the new 4.9 of Contenido. And ConLite will try to give you a
|
||||
with modules or custom plugins to adapt them to the new version. That's not what ConLite does nor will
|
||||
do in the future. ConLite will do changes step by step, or better version by version to adapt your
|
||||
4.8.x or higher installation to work with the new 4.9 of Contenido. And ConLite will try to give you a
|
||||
stable and bugfixed Content-Management-System in the future.
|
||||
|
||||
Who are the people behind ConLite?
|
||||
#### Who are the people behind ConLite?
|
||||
|
||||
The Team behind the CL-version are some well known guys from CONTENIDO-forum, working since many years with
|
||||
and within CONTENIDO core or coding modules and plugins for CONTENIDO.
|
||||
and within CONTENIDO core or coding modules and plugins for CONTENIDO.
|
||||
And we love CONTENIDO :)
|
||||
|
||||
|
||||
** Copyright **
|
||||
### Copyright
|
||||
|
||||
The copyright for the code of CONTENIDO still remains to 4fb and the named coders for all codes coming
|
||||
The copyright for the code of CONTENIDO still remains to 4fb and the named coders for all codes coming
|
||||
from 4.8.15 and/or from svn- or git-repository of CONTENDIO.
|
||||
All ads, enhancements or new parts, coded by the CL-Team are copyright by their named coders or
|
||||
All ads, enhancements or new parts, coded by the CL-Team are copyright by their named coders or
|
||||
by CL-Team and conlite.org.
|
||||
|
||||
|
||||
** Know Bugs **
|
||||
### Know Bugs
|
||||
FS#25 - Collision with pre-installed AMR after Migration
|
||||
!!! Attention !!!
|
||||
If you want to upgrade with an installed AMR-plugin, uninstall AMR before upgrade.
|
||||
We will include a fix for that in one of the next versions of CL
|
||||
!!! Attention !!!
|
||||
If you want to upgrade with an installed AMR-plugin, uninstall AMR before upgrade.
|
||||
We will include a fix for that in one of the next versions of CL
|
||||
|
||||
### History / Changelog
|
||||
**ConLite 2.1.3**
|
||||
|
||||
** History / Changelog **
|
||||
ConLite 2.1.2
|
||||
ConLite 2.1.1
|
||||
ConLite 2.1.0
|
||||
* see https://gitport.de/ConLite/ConLite/milestones
|
||||
**ConLite 2.1.2**
|
||||
|
||||
ConLite 2.0
|
||||
ConLite 1.0
|
||||
**ConLite 2.1.1**
|
||||
|
||||
**ConLite 2.1.0**
|
||||
* see [https://gitport.de/ConLite/ConLite/milestones](https://gitport.de/ConLite/ConLite/milestones)
|
||||
|
||||
**ConLite 2.0**
|
||||
|
||||
**ConLite 1.0**
|
||||
* old svn history lost
|
||||
|
||||
CONTENIDO 4.8.16 CL
|
||||
**CONTENIDO 4.8.16 CL**
|
||||
* 20 Bug Report genericdb: urlencode() expects parameter 1 to be string ...
|
||||
* 16 Enhancement RSS-Reader austauschen/überarbeiten
|
||||
* 31 Optimization Test CL installation with newest PHP and SQL on XAMPP
|
||||
|
@ -80,4 +84,4 @@ CONTENIDO 4.8.16 CL
|
|||
* 13 Bug Report FEUser-Plugins valide_to and valide_from saving wrong t ...
|
||||
* 9 Enhancement Check all translations (i18n)
|
||||
* 8 Bug Report adapt genericdb from 4.8.17 CL
|
||||
* 5 Bug Report Buttontranslations missing or wrong
|
||||
* 5 Bug Report Buttontranslations missing or wrong
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -0,0 +1 @@
|
|||
/config.mod_rewrite.php
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
// Load environment config file
|
||||
$configEnv = str_replace('\\', '/', realpath(dirname(__FILE__) . '/')) . '/data/config/config.environment.php';
|
||||
if (file_exists($configEnv)) {
|
||||
include_once($configEnv);
|
||||
}
|
||||
|
||||
if (!defined('CL_ENVIRONMENT')) {
|
||||
if (getenv('CONLITE_ENVIRONMENT')) {
|
||||
define('CL_ENVIRONMENT', getenv('CONLITE_ENVIRONMENT'));
|
||||
} if (getenv('CONTENIDO_ENVIRONMENT')) {
|
||||
define('CL_ENVIRONMENT', getenv('CONTENIDO_ENVIRONMENT'));
|
||||
} else {
|
||||
define('CL_ENVIRONMENT', 'production');
|
||||
}
|
||||
}
|
||||
|
||||
//echo CL_ENVIRONMENT;
|
|
@ -48,11 +48,32 @@ if (!defined("CON_FRAMEWORK")) {
|
|||
}
|
||||
|
||||
$contenido_path = '';
|
||||
# include the config file of the frontend to init the Client and Language Id
|
||||
include_once ("config.php");
|
||||
|
||||
# Contenido startup process
|
||||
include_once ($contenido_path . 'includes/startup.php');
|
||||
// Set path to current frontend
|
||||
$frontend_path = str_replace('\\', '/', realpath(dirname(__FILE__) . '/')) . '/';
|
||||
|
||||
// Include the environment definer file
|
||||
include_once($frontend_path . 'environment.php');
|
||||
|
||||
if (defined('CL_ENVIRONMENT')) {
|
||||
include_once($frontend_path . 'data/config/' . CL_ENVIRONMENT . '/config.php');
|
||||
|
||||
if (file_exists($frontend_path . 'data/config/' . CL_ENVIRONMENT . '/config.local.php')) {
|
||||
@include($frontend_path . 'data/config/' . CL_ENVIRONMENT . '/config.local.php');
|
||||
}
|
||||
} else {
|
||||
if(file_exists($frontend_path.'config.php')) {
|
||||
include_once($frontend_path.'config.php');
|
||||
}
|
||||
if(file_exists($frontend_path.'config.local.php')) {
|
||||
include_once($frontend_path.'config.local.php');
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_file($contenido_path . 'includes/startup.php')) {
|
||||
die("<h1>Fatal Error</h1><br>Couldn't include ConLite startup.");
|
||||
}
|
||||
include_once($contenido_path . 'includes/startup.php');
|
||||
|
||||
cInclude("includes", "functions.con.php");
|
||||
cInclude("includes", "functions.con2.php");
|
||||
|
@ -72,7 +93,7 @@ if ($cfg["use_pseudocron"] == true) {
|
|||
* PHPLIB application development toolkit
|
||||
* @see http://sourceforge.net/projects/phplib
|
||||
*/
|
||||
if ($contenido) {
|
||||
if (!empty($contenido)) {
|
||||
//Backend
|
||||
page_open(array('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm'));
|
||||
i18nInit($cfg["path"]["contenido"] . $cfg["path"]["locale"], $belang);
|
||||
|
@ -81,33 +102,24 @@ if ($contenido) {
|
|||
page_open(array('sess' => 'Contenido_Frontend_Session', 'auth' => 'Contenido_Frontend_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Bugfix
|
||||
* @see http://contenido.org/forum/viewtopic.php?t=18291
|
||||
*
|
||||
* added by H. Librenz (2007-12-07)
|
||||
*/
|
||||
//includePluginConf();
|
||||
/**
|
||||
* fixed bugfix - using functions brokes variable scopes!
|
||||
*
|
||||
* added by H. Librenz (2007-12-21) based on an idea of A. Lindner
|
||||
*/
|
||||
require_once $cfg['path']['contenido'] . $cfg['path']['includes'] . 'functions.includePluginConf.php';
|
||||
|
||||
$db = new DB_Contenido;
|
||||
// Call hook after plugins are loaded, added by Murat Purc, 2008-09-07
|
||||
CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins');
|
||||
|
||||
$db = new DB_ConLite();
|
||||
|
||||
$sess->register("cfgClient");
|
||||
$sess->register("errsite_idcat");
|
||||
$sess->register("errsite_idart");
|
||||
$sess->register("encoding");
|
||||
|
||||
if ($cfgClient["set"] != "set") {
|
||||
if (empty($cfgClient["set"]) || $cfgClient["set"] != "set") {
|
||||
rereadClients();
|
||||
}
|
||||
|
||||
# Check if this request is for a compressed file
|
||||
if ($_GET['action'] == 'get_compressed') {
|
||||
if (isset($_GET['action']) && $_GET['action'] == 'get_compressed') {
|
||||
# Get the calling parameters
|
||||
$sFilename = ((isset($_GET['f'])) ? $_GET['f'] : $_GET['amp;f']);
|
||||
$sContentType = ((isset($_GET['c'])) ? $_GET['c'] : $_GET['amp;c']);
|
||||
|
@ -137,11 +149,9 @@ if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) {
|
|||
// @TODO: Should be outsourced into startup process but requires a better detection (frontend or backend)
|
||||
Contenido_Security::checkFrontendGlobals();
|
||||
|
||||
|
||||
// update urlbuilder set http base path
|
||||
Contenido_Url::getInstance()->getUrlBuilder()->setHttpBasePath($cfgClient[$client]['htmlpath']['frontend']);
|
||||
|
||||
|
||||
// Initialize language
|
||||
if (!isset($lang)) {
|
||||
|
||||
|
@ -227,13 +237,12 @@ $aParams = array(
|
|||
);
|
||||
$errsite = 'Location: ' . Contenido_Url::getInstance()->buildRedirect($aParams);
|
||||
|
||||
|
||||
/*
|
||||
* Try to initialize variables $idcat, $idart, $idcatart, $idartlang
|
||||
* Note: These variables can be set via http globals e.g. front_content.php?idcat=41&idart=34&idcatart=35&idartlang=42
|
||||
* If not the values will be computed.
|
||||
*/
|
||||
if ($idart && !$idcat && !$idcatart) {
|
||||
if (!empty($idart) && empty($idcat) && empty($idcatart)) {
|
||||
/* Try to fetch the first idcat */
|
||||
$sql = "SELECT idcat FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "'";
|
||||
$db->query($sql);
|
||||
|
@ -246,9 +255,9 @@ if ($idart && !$idcat && !$idcatart) {
|
|||
unset($code);
|
||||
unset($markscript);
|
||||
|
||||
if (!$idcatart) {
|
||||
if (!$idart) {
|
||||
if (!$idcat) {
|
||||
if (empty($idcatart)) {
|
||||
if (empty($idart)) {
|
||||
if (empty($idcat)) {
|
||||
# Note: In earlier Contenido versions the information if an article is startarticle of a category has been stored
|
||||
# in relation con_cat_art.
|
||||
if ($cfg["is_start_compatible"] == true) {
|
||||
|
@ -295,7 +304,7 @@ if (!$idcatart) {
|
|||
$idart = $db->f("idart");
|
||||
$idcat = $db->f("idcat");
|
||||
} else {
|
||||
if ($contenido) {
|
||||
if (!empty($contenido)) {
|
||||
cInclude("includes", "functions.i18n.php");
|
||||
die(i18n("No start article for this category"));
|
||||
} else {
|
||||
|
@ -402,7 +411,7 @@ if ($cfg["cache"]["disable"] != '1') {
|
|||
* The reason is to avoid cross-site scripting errors in the backend, if the backend domain differs from
|
||||
* the frontend domain.
|
||||
*/
|
||||
if ($contenido) {
|
||||
if (isset($contenido)) {
|
||||
$perm->load_permissions();
|
||||
|
||||
/* Change mode edit / view */
|
||||
|
@ -507,7 +516,7 @@ if ($contenido) {
|
|||
|
||||
|
||||
/* If mode is 'edit' and user has permission to edit articles in the current category */
|
||||
if ($inUse == false && $allow == true && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) {
|
||||
if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) {
|
||||
cInclude("includes", "functions.tpl.php");
|
||||
cInclude("includes", "functions.con.php");
|
||||
include ($cfg["path"]["contenido"] . $cfg["path"]["includes"] . "include.con_editcontent.php");
|
||||
|
@ -518,7 +527,7 @@ if ($inUse == false && $allow == true && $view == "edit" && ($perm->have_perm_ar
|
|||
##############################################
|
||||
|
||||
/* Mark submenuitem 'Preview' in the Contenido Backend (Area: Contenido --> Articles --> Preview) */
|
||||
if ($contenido) {
|
||||
if (isset($contenido)) {
|
||||
$markscript = markSubMenuItem(4, true);
|
||||
}
|
||||
|
||||
|
@ -588,10 +597,12 @@ if ($inUse == false && $allow == true && $view == "edit" && ($perm->have_perm_ar
|
|||
}
|
||||
|
||||
/* Add mark Script to code if user is in the backend */
|
||||
$code = preg_replace("/<\/head>/i", "$markscript\n</head>", $code, 1);
|
||||
if(!empty($markscript)) {
|
||||
$code = preg_replace("/<\/head>/i", "$markscript\n</head>", $code, 1);
|
||||
}
|
||||
|
||||
/* If article is in use, display notification */
|
||||
if ($sHtmlInUseCss && $sHtmlInUseMessage) {
|
||||
if (!empty($sHtmlInUseCss) && !empty($sHtmlInUseMessage)) {
|
||||
$code = preg_replace("/<\/head>/i", "$sHtmlInUseCss\n</head>", $code, 1);
|
||||
$code = preg_replace("/(<body[^>]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1);
|
||||
}
|
||||
|
@ -634,7 +645,7 @@ if ($inUse == false && $allow == true && $view == "edit" && ($perm->have_perm_ar
|
|||
WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = '" . Contenido_Security::escapeDB($user_id, $db2) . "' AND A.idcat = '" . Contenido_Security::toInteger($idcat) . "'
|
||||
AND A.idarea = C.idarea AND B.idaction = A.idaction";
|
||||
|
||||
$db2 = new DB_Contenido;
|
||||
$db2 = new DB_ConLite();
|
||||
$db2->query($sql);
|
||||
|
||||
if ($db2->num_rows() > 0) {
|
||||
|
@ -834,5 +845,4 @@ if (isset($savedlang)) {
|
|||
}
|
||||
|
||||
$db->disconnect();
|
||||
page_close();
|
||||
?>
|
||||
page_close();
|
|
@ -144,8 +144,7 @@ class cHTMLInputSelectElement extends cHTMLSelectElement {
|
|||
*
|
||||
* @return int Number of items added
|
||||
* */
|
||||
function addCategories($iMaxLevel = 0, $bColored = false, $bCatVisible = true, $bCatPublic = true,
|
||||
$bWithArt = false, $bArtOnline = true) {
|
||||
function addCategories($iMaxLevel = 0, $bColored = false, $bCatVisible = true, $bCatPublic = true, $bWithArt = false, $bArtOnline = true) {
|
||||
global $cfg, $client, $lang;
|
||||
|
||||
$oDB = new DB_Contenido;
|
||||
|
@ -259,27 +258,18 @@ class cHTMLInputSelectElement extends cHTMLSelectElement {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects specified elements as selected
|
||||
*
|
||||
* @param array $aElements Array with "values" of the cHTMLOptionElement to set
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function setSelected($aElements) {
|
||||
if (is_array($this->_options) && is_array($aElements)) {
|
||||
foreach ($this->_options as $sKey => $oOption) {
|
||||
if (in_array($oOption->getAttribute("value"), $aElements)) {
|
||||
$oOption->setSelected(true);
|
||||
$this->_options[$sKey] = $oOption;
|
||||
} else {
|
||||
$oOption->setSelected(false);
|
||||
$this->_options[$sKey] = $oOption;
|
||||
}
|
||||
}
|
||||
}
|
||||
public function addFiles($sPath) {
|
||||
$iCount = 0;
|
||||
$aFiles = cDirHandler::read($sPath);
|
||||
asort($aFiles);
|
||||
$iCounter = count($this->_options);
|
||||
foreach ($aFiles as $sValue) {
|
||||
$oOption = new cHTMLOptionElement($sValue, $sValue);
|
||||
$this->addOptionElement($iCounter, $oOption);
|
||||
$iCounter++;
|
||||
}
|
||||
return count($aFiles);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class UI_Config_Table {
|
||||
|
@ -302,16 +292,24 @@ class UI_Config_Table {
|
|||
var $_sColorLight;
|
||||
var $_sColorDark;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
protected $_iRowCnt = 0;
|
||||
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
$cfg = cRegistry::getConfig();
|
||||
|
||||
$this->_sPadding = 2;
|
||||
$this->_sBorder = 0;
|
||||
$this->_sBorderColor = $cfg['color']['table_border'];
|
||||
$this->_sTplCellCode = ' <td align="{ALIGN}" valign="{VALIGN}" class="{CLASS}" colspan="{COLSPAN}" style="{EXTRA}white-space:nowrap;" nowrap="nowrap">{CONTENT}</td>' . "\n";
|
||||
$this->_sBorderColor = cRegistry::getConfigValue('color', 'table_border');
|
||||
$this->_sTplCellCode = '<td align="{ALIGN}" valign="{VALIGN}" class="{CLASS}" colspan="{COLSPAN}" style="{EXTRA}white-space:nowrap;" nowrap="nowrap">' . "\n"
|
||||
. '{CONTENT}' . "\n"
|
||||
. '</td>' . "\n";
|
||||
$this->_sTplTableFile = $cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_list'];
|
||||
$this->_sColorLight = $cfg['color']['table_light'];
|
||||
$this->_sColorDark = $cfg['color']['table_dark'];
|
||||
$this->_sColorLight = cRegistry::getConfigValue('color', 'table_light');
|
||||
$this->_sColorDark = cRegistry::getConfigValue('color', 'table_dark');
|
||||
}
|
||||
|
||||
function setCellTemplate($sCode) {
|
||||
|
@ -417,8 +415,37 @@ class UI_Config_Table {
|
|||
return $sSkript;
|
||||
}
|
||||
|
||||
function render($bPrint = false) {
|
||||
$oTable = new Template;
|
||||
/**
|
||||
* increase row counter
|
||||
*/
|
||||
public function nextRow() {
|
||||
$this->_iRowCnt++;
|
||||
}
|
||||
|
||||
/**
|
||||
* get current row count
|
||||
*
|
||||
* @return int row count
|
||||
*/
|
||||
public function getRowCount() : int {
|
||||
return $this->_iRowCnt;
|
||||
}
|
||||
|
||||
public function setRowCell(int $iCell, $mContent) {
|
||||
$this->setCell($this->_iRowCnt, $iCell, $mContent);
|
||||
}
|
||||
|
||||
public function setRowBorder(string $sWhich = 'bottom') {
|
||||
$sStyle = '';
|
||||
switch ($sWhich) {
|
||||
case 'bottom':
|
||||
$this->setRowExtra($this->_iRowCnt, 'border-bottom: 1px solid silver;');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function render($bPrint = false) {
|
||||
$oTable = new Template();
|
||||
$oTable->reset();
|
||||
|
||||
$oTable->set('s', 'CELLPADDING', $this->_sPadding);
|
||||
|
@ -437,6 +464,8 @@ class UI_Config_Table {
|
|||
$iCount = 0;
|
||||
|
||||
foreach ($aCells as $sCell => $sData) {
|
||||
$sData = $this->_processContentData($sData);
|
||||
|
||||
$iCount++;
|
||||
$sTplCell = $this->_sTplCellCode;
|
||||
|
||||
|
@ -525,6 +554,57 @@ class UI_Config_Table {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* returns different types of content data as string
|
||||
* you can use
|
||||
* - string
|
||||
* - object, needs to have a render method
|
||||
* - array of objects and/or strings
|
||||
*
|
||||
* @author Ortwin Pinke
|
||||
* @since 2.3.0
|
||||
*
|
||||
*
|
||||
* @param mixed $mData
|
||||
* @return string
|
||||
*/
|
||||
protected function _processContentData($mData): string {
|
||||
if (is_string($mData)) {
|
||||
return $mData;
|
||||
}
|
||||
|
||||
?>
|
||||
$sData = '';
|
||||
|
||||
if (is_array($mData) && count($mData) > 0) {
|
||||
foreach ($mData as $mElement) {
|
||||
if (is_string($mElement)) {
|
||||
$sData .= $mElement;
|
||||
continue;
|
||||
}
|
||||
$sData .= $this->_renderObject($mElement);
|
||||
}
|
||||
} else {
|
||||
$sData = $this->_renderObject($mData);
|
||||
}
|
||||
|
||||
return $sData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an object using its render method
|
||||
*
|
||||
* @author Ortwin Pinke
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @param type $oObject
|
||||
* @return string rendered string from object | empty string
|
||||
*/
|
||||
protected function _renderObject($oObject): string {
|
||||
$sReturn = '';
|
||||
if (is_object($oObject) && method_exists($oObject, 'render')) {
|
||||
$sReturn = $oObject->render();
|
||||
}
|
||||
return $sReturn;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,9 +24,10 @@ if (!defined('CON_FRAMEWORK')) {
|
|||
|
||||
// create Navigation array for one level
|
||||
function createNavigationArray($start_id, $db) {
|
||||
global $user, $cfg, $client, $lang, $auth;
|
||||
global $cfg, $client, $lang, $auth;
|
||||
|
||||
$navigation = array();
|
||||
$groups = [];
|
||||
$navigation = [];
|
||||
$FrontendPermissionCollection = new FrontendPermissionCollection;
|
||||
|
||||
// SECURITY-FIX
|
||||
|
@ -61,7 +62,6 @@ function createNavigationArray($start_id, $db) {
|
|||
|
||||
$FrontendGroupMemberCollection->setWhere("idfrontenduser", $auth->auth['uid']);
|
||||
$FrontendGroupMemberCollection->query();
|
||||
$groups = array();
|
||||
while ($member = $FrontendGroupMemberCollection->next()) {
|
||||
$groups[] = $member->get("idfrontendgroup");
|
||||
}
|
||||
|
@ -74,10 +74,12 @@ function createNavigationArray($start_id, $db) {
|
|||
}
|
||||
}
|
||||
if ($visible) {
|
||||
$navigation[$cat_id] = array("idcat" => $cat_id,
|
||||
$navigation[$cat_id] = [
|
||||
"idcat" => $cat_id,
|
||||
"name" => $db->f("name"),
|
||||
"target" => '_self', # you can not call getTarget($cat_id, &$db) at this point with the same db instance!
|
||||
"public" => $db->f("public"));
|
||||
"target" => '_self',
|
||||
"public" => $db->f("public"),
|
||||
];
|
||||
}
|
||||
} // end while
|
||||
|
||||
|
@ -197,7 +199,7 @@ function getLevel($catid, &$db) {
|
|||
* Return path of a given category up to a certain level
|
||||
*/
|
||||
function getCategoryPath($cat_id, $level, $reverse = true, &$db) {
|
||||
$root_path = array();
|
||||
$root_path = [];
|
||||
|
||||
array_push($root_path, $cat_id);
|
||||
|
||||
|
@ -222,12 +224,13 @@ function getCategoryPath($cat_id, $level, $reverse = true, &$db) {
|
|||
* Return location string of a given category
|
||||
*/
|
||||
function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sTextStyleClass, $fullweblink = false, $reverse = true, $mod_rewrite = true, $db) {
|
||||
$aLocation = [];
|
||||
global $sess, $cfgClient, $client;
|
||||
|
||||
$aCatPath = getCategoryPath($iStartCat, $level, $reverse, $db);
|
||||
|
||||
if (is_array($aCatPath) AND count($aCatPath) > 0) {
|
||||
$aLocation = array();
|
||||
$aLocation = [];
|
||||
foreach ($aCatPath as $value) {
|
||||
if (!$fullweblink) {
|
||||
if ($mod_rewrite == true) {
|
||||
|
@ -265,6 +268,7 @@ function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sT
|
|||
*/
|
||||
function getSubTree($idcat_start, $db) {
|
||||
global $client, $cfg;
|
||||
$deeper_cats = [];
|
||||
|
||||
// SECURITY-FIX
|
||||
$sql = "SELECT
|
||||
|
@ -299,6 +303,7 @@ function getSubTree($idcat_start, $db) {
|
|||
|
||||
function getTeaserDeeperCategories($iIdcat, $db) {
|
||||
global $client, $cfg, $lang;
|
||||
$deeper_cats = [];
|
||||
|
||||
// SECURITY-FIX
|
||||
$sql = "SELECT
|
||||
|
@ -345,6 +350,7 @@ function getTeaserDeeperCategories($iIdcat, $db) {
|
|||
*/
|
||||
function getProtectedSubTree($idcat_start, $db) {
|
||||
global $client, $cfg, $lang;
|
||||
$deeper_cats = [];
|
||||
|
||||
// SECURITY-FIX
|
||||
$sql = "SELECT
|
||||
|
@ -416,10 +422,8 @@ function getCategoryName($cat_id, &$db) {
|
|||
|
||||
// get direct subcategories of a given category
|
||||
function getSubCategories($parent_id, $db) {
|
||||
|
||||
$subcategories = array();
|
||||
|
||||
global $cfg, $client, $lang;
|
||||
$subcategories = [];
|
||||
|
||||
// SECURITY-FIX
|
||||
$sql = "SELECT
|
||||
|
@ -453,11 +457,8 @@ function getSubCategories($parent_id, $db) {
|
|||
|
||||
// get direct subcategories with protected categories
|
||||
function getProtectedSubCategories($parent_id, $db) {
|
||||
|
||||
$subcategories = array();
|
||||
unset($subcategories);
|
||||
|
||||
global $cfg, $client, $lang;
|
||||
$subcategories = [];
|
||||
|
||||
// SECURITY-FIX
|
||||
$sql = "SELECT
|
||||
|
@ -488,23 +489,18 @@ function getProtectedSubCategories($parent_id, $db) {
|
|||
// end function
|
||||
|
||||
function checkCatPermission($idcatlang, $public) {
|
||||
#Check if current user has permissions to access cat
|
||||
|
||||
global $auth;
|
||||
$groups = [];
|
||||
|
||||
$oDB = new DB_ConLite();
|
||||
|
||||
$FrontendPermissionCollection = new FrontendPermissionCollection;
|
||||
$FrontendPermissionCollection = new FrontendPermissionCollection();
|
||||
$visible = false;
|
||||
|
||||
if ($public != 0) {
|
||||
$visible = true;
|
||||
$groups = array();
|
||||
} elseif (($auth->auth['uid'] != '') && ($auth->auth['uid'] != 'nobody')) {
|
||||
$FrontendGroupMemberCollection = new FrontendGroupMemberCollection;
|
||||
$FrontendGroupMemberCollection->setWhere("idfrontenduser", $auth->auth['uid']);
|
||||
$FrontendGroupMemberCollection->query();
|
||||
$groups = array();
|
||||
while ($member = $FrontendGroupMemberCollection->next()) {
|
||||
$groups[] = $member->get("idfrontendgroup");
|
||||
}
|
||||
|
@ -518,4 +514,4 @@ function checkCatPermission($idcatlang, $public) {
|
|||
}
|
||||
|
||||
return $visible;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,294 +1,294 @@
|
|||
/* Cookies Directive - The rewrite. Now a jQuery plugin
|
||||
* Version: 2.0.1
|
||||
* Author: Ollie Phillips
|
||||
* 24 October 2013
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
$.cookiesDirective = function(options) {
|
||||
|
||||
// Default Cookies Directive Settings
|
||||
var settings = $.extend({
|
||||
//Options
|
||||
explicitConsent: true,
|
||||
position: 'top',
|
||||
duration: 10,
|
||||
limit: 0,
|
||||
message: null,
|
||||
cookieScripts: null,
|
||||
privacyPolicyUri: 'privacy.html',
|
||||
inlineAction: false,
|
||||
scriptWrapper: function(){},
|
||||
// Styling
|
||||
fontFamily: 'helvetica',
|
||||
fontColor: '#FFFFFF',
|
||||
fontSize: '13px',
|
||||
backgroundColor: '#000000',
|
||||
backgroundOpacity: '80',
|
||||
linkColor: '#CA0000',
|
||||
// Messages
|
||||
multipleCookieScriptBeginningLabel: ' We use ',
|
||||
and: ' and ',
|
||||
multipleCookieScriptEndLabel: ' scripts, which all set cookies. ',
|
||||
singleCookieScriptBeginningLabel: ' We use a ',
|
||||
singleCookieScriptEndLabel: ' script which sets cookies.',
|
||||
explicitCookieDeletionWarning: 'You may delete and block all cookies from this site, but parts of the site will not work.',
|
||||
explicitFindOutMore: 'To find out more about cookies on this website, see our',
|
||||
privacyPolicyLinkText: ' privacy policy',
|
||||
explicitCheckboxLabel: 'You must tick the "I accept cookies from this site" box to accept',
|
||||
explicitCookieAcceptanceLabel: 'I accept cookies from this site',
|
||||
explicitCookieAcceptButtonText: 'Continue',
|
||||
impliedDisclosureText: ' More details can be found in our',
|
||||
impliedSubmitText: 'Do not show this message again',
|
||||
}, options);
|
||||
|
||||
// Perform consent checks
|
||||
if(!getCookie('cookiesDirective')) {
|
||||
if(settings.limit > 0) {
|
||||
// Display limit in force, record the view
|
||||
if(!getCookie('cookiesDisclosureCount')) {
|
||||
setCookie('cookiesDisclosureCount',1,1);
|
||||
} else {
|
||||
var disclosureCount = getCookie('cookiesDisclosureCount');
|
||||
disclosureCount ++;
|
||||
setCookie('cookiesDisclosureCount',disclosureCount,1);
|
||||
}
|
||||
|
||||
// Have we reached the display limit, if not make disclosure
|
||||
if(settings.limit >= getCookie('cookiesDisclosureCount')) {
|
||||
disclosure(settings);
|
||||
}
|
||||
} else {
|
||||
// No display limit
|
||||
disclosure(settings);
|
||||
}
|
||||
|
||||
// If we don't require explicit consent, load up our script wrapping function
|
||||
if(!settings.explicitConsent) {
|
||||
settings.scriptWrapper.call();
|
||||
}
|
||||
} else {
|
||||
// Cookies accepted, load script wrapping function
|
||||
settings.scriptWrapper.call();
|
||||
}
|
||||
};
|
||||
|
||||
// Used to load external javascript files into the DOM
|
||||
$.cookiesDirective.loadScript = function(options) {
|
||||
var settings = $.extend({
|
||||
uri: '',
|
||||
appendTo: 'body'
|
||||
}, options);
|
||||
|
||||
var elementId = String(settings.appendTo);
|
||||
var sA = document.createElement("script");
|
||||
sA.src = settings.uri;
|
||||
sA.type = "text/javascript";
|
||||
sA.onload = sA.onreadystatechange = function() {
|
||||
if ((!sA.readyState || sA.readyState == "loaded" || sA.readyState == "complete")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
switch(settings.appendTo) {
|
||||
case 'head':
|
||||
$('head').append(sA);
|
||||
break;
|
||||
case 'body':
|
||||
$('body').append(sA);
|
||||
break;
|
||||
default:
|
||||
$('#' + elementId).append(sA);
|
||||
}
|
||||
}
|
||||
|
||||
// Helper scripts
|
||||
// Get cookie
|
||||
var getCookie = function(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set cookie
|
||||
var setCookie = function(name,value,days) {
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(days*24*60*60*1000));
|
||||
var expires = "; expires="+date.toGMTString();
|
||||
}
|
||||
else var expires = "";
|
||||
document.cookie = name+"="+value+expires+"; path=/";
|
||||
}
|
||||
|
||||
// Detect IE < 9
|
||||
var checkIE = function(){
|
||||
var version;
|
||||
if (navigator.appName == 'Microsoft Internet Explorer') {
|
||||
var ua = navigator.userAgent;
|
||||
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
|
||||
if (re.exec(ua) != null) {
|
||||
version = parseFloat(RegExp.$1);
|
||||
}
|
||||
if (version <= 8.0) {
|
||||
return true;
|
||||
} else {
|
||||
if(version == 9.0) {
|
||||
if(document.compatMode == "BackCompat") {
|
||||
// IE9 in quirks mode won't run the script properly, set to emulate IE8
|
||||
var mA = document.createElement("meta");
|
||||
mA.content = "IE=EmulateIE8";
|
||||
document.getElementsByTagName('head')[0].appendChild(mA);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Disclosure routines
|
||||
var disclosure = function(options) {
|
||||
var settings = options;
|
||||
settings.css = 'fixed';
|
||||
|
||||
// IE 9 and lower has issues with position:fixed, either out the box or in compatibility mode - fix that
|
||||
if(checkIE()) {
|
||||
settings.position = 'top';
|
||||
settings.css = 'absolute';
|
||||
}
|
||||
|
||||
// Any cookie setting scripts to disclose
|
||||
var scriptsDisclosure = '';
|
||||
if (settings.cookieScripts) {
|
||||
var scripts = settings.cookieScripts.split(',');
|
||||
var scriptsCount = scripts.length;
|
||||
var scriptDisclosureTxt = '';
|
||||
if(scriptsCount>1) {
|
||||
for(var t=0; t < scriptsCount - 1; t++) {
|
||||
scriptDisclosureTxt += scripts[t] + ', ';
|
||||
}
|
||||
|
||||
scriptsDisclosure = settings.multipleCookieScriptBeginningLabel + scriptDisclosureTxt.substring(0, scriptDisclosureTxt.length - 2) + settings.and + scripts[scriptsCount - 1] + settings.multipleCookieScriptEndLabel;
|
||||
} else {
|
||||
scriptsDisclosure = setting.singleCookieScriptBeginningLabel + scripts[0] + settings.singleCookieScriptEndLabel;
|
||||
}
|
||||
}
|
||||
|
||||
// Create overlay, vary the disclosure based on explicit/implied consent
|
||||
// Set our disclosure/message if one not supplied
|
||||
var html = '';
|
||||
html += '<div id="epd">';
|
||||
html += '<div id="cookiesdirective" style="position:'+ settings.css +';'+ settings.position + ':-300px;left:0px;width:100%;'
|
||||
html += 'height:auto;background:' + settings.backgroundColor + ';opacity:.' + settings.backgroundOpacity + ';';
|
||||
html += '-ms-filter: “alpha(opacity=' + settings.backgroundOpacity + ')”; filter: alpha(opacity=' + settings.backgroundOpacity + ');';
|
||||
html += '-khtml-opacity: .' + settings.backgroundOpacity + '; -moz-opacity: .' + settings.backgroundOpacity + ';';
|
||||
html += 'color:' + settings.fontColor + ';font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';';
|
||||
html += 'text-align:center;z-index:1000;">';
|
||||
html += '<div style="position:relative;height:auto;width:90%;padding:10px;margin-left:auto;margin-right:auto;">';
|
||||
|
||||
if(!settings.message) {
|
||||
if(settings.explicitConsent) {
|
||||
// Explicit consent message
|
||||
settings.message = 'This site uses cookies. Some of the cookies we ';
|
||||
settings.message += 'use are essential for parts of the site to operate and have already been set.';
|
||||
} else {
|
||||
// Implied consent message
|
||||
settings.message = 'We have placed cookies on your computer to help make this website better.';
|
||||
}
|
||||
}
|
||||
html += settings.message;
|
||||
|
||||
// Build the rest of the disclosure for implied and explicit consent
|
||||
if(settings.explicitConsent) {
|
||||
// Explicit consent disclosure
|
||||
html += scriptsDisclosure + settings.explicitCookieDeletionWarning;
|
||||
html += settings.explicitFindOutMore + '<a style="color:'+ settings.linkColor + ';font-weight:bold;';
|
||||
html += 'font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';" href="'+ settings.privacyPolicyUri + '">'+ settings.privacyPolicyLinkText +'</a>.';
|
||||
html += '<div id="epdnotick" style="color:#ca0000;display:none;margin:2px;"><span style="background:#cecece;padding:2px;">' + settings.explicitCheckboxLabel + '</span></div>'
|
||||
html += '<div style="margin-top:5px;';
|
||||
if(settings.inlineAction) {
|
||||
html += 'display:inline-block;margin-left:5px';
|
||||
}
|
||||
html += '">' + settings.explicitCookieAcceptanceLabel + '<input type="checkbox" name="epdagree" id="epdagree" /> ';
|
||||
html += '<input type="submit" name="explicitsubmit" id="explicitsubmit" value="' + settings.explicitCookieAcceptButtonText + '"/><br/></div></div>';
|
||||
|
||||
} else {
|
||||
// Implied consent disclosure
|
||||
html += scriptsDisclosure + settings.impliedDisclosureText + ' <a style="color:'+ settings.linkColor + ';';
|
||||
html += 'font-weight:bold;font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';" href="'+ settings.privacyPolicyUri + '">' + settings.privacyPolicyLinkText + '</a>.';
|
||||
html += '<div style="margin-top:5px;';
|
||||
if(settings.inlineAction) {
|
||||
html += 'display:inline-block;margin-left:5px';
|
||||
}
|
||||
html += '"><input type="submit" name="impliedsubmit" id="impliedsubmit" value="' + settings.impliedSubmitText + '"/></div></div>';
|
||||
}
|
||||
html += '</div></div>';
|
||||
$('body').append(html);
|
||||
|
||||
// Serve the disclosure, and be smarter about branching
|
||||
var dp = settings.position.toLowerCase();
|
||||
if(dp != 'top' && dp!= 'bottom') {
|
||||
dp = 'top';
|
||||
}
|
||||
var opts = new Array();
|
||||
if(dp == 'top') {
|
||||
opts['in'] = {'top':'0'};
|
||||
opts['out'] = {'top':'-300'};
|
||||
} else {
|
||||
opts['in'] = {'bottom':'0'};
|
||||
opts['out'] = {'bottom':'-300'};
|
||||
}
|
||||
|
||||
// Start animation
|
||||
$('#cookiesdirective').animate(opts['in'], 1000, function() {
|
||||
// Set event handlers depending on type of disclosure
|
||||
if(settings.explicitConsent) {
|
||||
// Explicit, need to check a box and click a button
|
||||
$('#explicitsubmit').click(function() {
|
||||
if($('#epdagree').is(':checked')) {
|
||||
// Set a cookie to prevent this being displayed again
|
||||
setCookie('cookiesDirective',1,365);
|
||||
// Close the overlay
|
||||
$('#cookiesdirective').animate(opts['out'],1000,function() {
|
||||
// Remove the elements from the DOM and reload page
|
||||
$('#cookiesdirective').remove();
|
||||
location.reload(true);
|
||||
});
|
||||
} else {
|
||||
// We need the box checked we want "explicit consent", display message
|
||||
$('#epdnotick').css('display', 'block');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Implied consent, just a button to close it
|
||||
$('#impliedsubmit').click(function() {
|
||||
// Set a cookie to prevent this being displayed again
|
||||
setCookie('cookiesDirective',1,365);
|
||||
// Close the overlay
|
||||
$('#cookiesdirective').animate(opts['out'],1000,function() {
|
||||
// Remove the elements from the DOM and reload page
|
||||
$('#cookiesdirective').remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Set a timer to remove the warning after 'settings.duration' seconds
|
||||
setTimeout(function(){
|
||||
$('#cookiesdirective').animate({
|
||||
opacity:'0'
|
||||
},2000, function(){
|
||||
$('#cookiesdirective').css(dp,'-300px');
|
||||
});
|
||||
}, settings.duration * 1000);
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
||||
/* Cookies Directive - The rewrite. Now a jQuery plugin
|
||||
* Version: 2.0.1
|
||||
* Author: Ollie Phillips test
|
||||
* 24 October 2013
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
$.cookiesDirective = function(options) {
|
||||
|
||||
// Default Cookies Directive Settings
|
||||
var settings = $.extend({
|
||||
//Options
|
||||
explicitConsent: true,
|
||||
position: 'top',
|
||||
duration: 10,
|
||||
limit: 0,
|
||||
message: null,
|
||||
cookieScripts: null,
|
||||
privacyPolicyUri: 'privacy.html',
|
||||
inlineAction: false,
|
||||
scriptWrapper: function(){},
|
||||
// Styling
|
||||
fontFamily: 'helvetica',
|
||||
fontColor: '#FFFFFF',
|
||||
fontSize: '13px',
|
||||
backgroundColor: '#000000',
|
||||
backgroundOpacity: '80',
|
||||
linkColor: '#CA0000',
|
||||
// Messages
|
||||
multipleCookieScriptBeginningLabel: ' We use ',
|
||||
and: ' and ',
|
||||
multipleCookieScriptEndLabel: ' scripts, which all set cookies. ',
|
||||
singleCookieScriptBeginningLabel: ' We use a ',
|
||||
singleCookieScriptEndLabel: ' script which sets cookies.',
|
||||
explicitCookieDeletionWarning: 'You may delete and block all cookies from this site, but parts of the site will not work.',
|
||||
explicitFindOutMore: 'To find out more about cookies on this website, see our',
|
||||
privacyPolicyLinkText: ' privacy policy',
|
||||
explicitCheckboxLabel: 'You must tick the "I accept cookies from this site" box to accept',
|
||||
explicitCookieAcceptanceLabel: 'I accept cookies from this site',
|
||||
explicitCookieAcceptButtonText: 'Continue',
|
||||
impliedDisclosureText: ' More details can be found in our',
|
||||
impliedSubmitText: 'Do not show this message again',
|
||||
}, options);
|
||||
|
||||
// Perform consent checks
|
||||
if(!getCookie('cookiesDirective')) {
|
||||
if(settings.limit > 0) {
|
||||
// Display limit in force, record the view
|
||||
if(!getCookie('cookiesDisclosureCount')) {
|
||||
setCookie('cookiesDisclosureCount',1,1);
|
||||
} else {
|
||||
var disclosureCount = getCookie('cookiesDisclosureCount');
|
||||
disclosureCount ++;
|
||||
setCookie('cookiesDisclosureCount',disclosureCount,1);
|
||||
}
|
||||
|
||||
// Have we reached the display limit, if not make disclosure
|
||||
if(settings.limit >= getCookie('cookiesDisclosureCount')) {
|
||||
disclosure(settings);
|
||||
}
|
||||
} else {
|
||||
// No display limit
|
||||
disclosure(settings);
|
||||
}
|
||||
|
||||
// If we don't require explicit consent, load up our script wrapping function
|
||||
if(!settings.explicitConsent) {
|
||||
settings.scriptWrapper.call();
|
||||
}
|
||||
} else {
|
||||
// Cookies accepted, load script wrapping function
|
||||
settings.scriptWrapper.call();
|
||||
}
|
||||
};
|
||||
|
||||
// Used to load external javascript files into the DOM
|
||||
$.cookiesDirective.loadScript = function(options) {
|
||||
var settings = $.extend({
|
||||
uri: '',
|
||||
appendTo: 'body'
|
||||
}, options);
|
||||
|
||||
var elementId = String(settings.appendTo);
|
||||
var sA = document.createElement("script");
|
||||
sA.src = settings.uri;
|
||||
sA.type = "text/javascript";
|
||||
sA.onload = sA.onreadystatechange = function() {
|
||||
if ((!sA.readyState || sA.readyState == "loaded" || sA.readyState == "complete")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
switch(settings.appendTo) {
|
||||
case 'head':
|
||||
$('head').append(sA);
|
||||
break;
|
||||
case 'body':
|
||||
$('body').append(sA);
|
||||
break;
|
||||
default:
|
||||
$('#' + elementId).append(sA);
|
||||
}
|
||||
}
|
||||
|
||||
// Helper scripts
|
||||
// Get cookie
|
||||
var getCookie = function(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set cookie
|
||||
var setCookie = function(name,value,days) {
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(days*24*60*60*1000));
|
||||
var expires = "; expires="+date.toGMTString();
|
||||
}
|
||||
else var expires = "";
|
||||
document.cookie = name+"="+value+expires+"; path=/";
|
||||
}
|
||||
|
||||
// Detect IE < 9
|
||||
var checkIE = function(){
|
||||
var version;
|
||||
if (navigator.appName == 'Microsoft Internet Explorer') {
|
||||
var ua = navigator.userAgent;
|
||||
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
|
||||
if (re.exec(ua) != null) {
|
||||
version = parseFloat(RegExp.$1);
|
||||
}
|
||||
if (version <= 8.0) {
|
||||
return true;
|
||||
} else {
|
||||
if(version == 9.0) {
|
||||
if(document.compatMode == "BackCompat") {
|
||||
// IE9 in quirks mode won't run the script properly, set to emulate IE8
|
||||
var mA = document.createElement("meta");
|
||||
mA.content = "IE=EmulateIE8";
|
||||
document.getElementsByTagName('head')[0].appendChild(mA);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Disclosure routines
|
||||
var disclosure = function(options) {
|
||||
var settings = options;
|
||||
settings.css = 'fixed';
|
||||
|
||||
// IE 9 and lower has issues with position:fixed, either out the box or in compatibility mode - fix that
|
||||
if(checkIE()) {
|
||||
settings.position = 'top';
|
||||
settings.css = 'absolute';
|
||||
}
|
||||
|
||||
// Any cookie setting scripts to disclose
|
||||
var scriptsDisclosure = '';
|
||||
if (settings.cookieScripts) {
|
||||
var scripts = settings.cookieScripts.split(',');
|
||||
var scriptsCount = scripts.length;
|
||||
var scriptDisclosureTxt = '';
|
||||
if(scriptsCount>1) {
|
||||
for(var t=0; t < scriptsCount - 1; t++) {
|
||||
scriptDisclosureTxt += scripts[t] + ', ';
|
||||
}
|
||||
|
||||
scriptsDisclosure = settings.multipleCookieScriptBeginningLabel + scriptDisclosureTxt.substring(0, scriptDisclosureTxt.length - 2) + settings.and + scripts[scriptsCount - 1] + settings.multipleCookieScriptEndLabel;
|
||||
} else {
|
||||
scriptsDisclosure = setting.singleCookieScriptBeginningLabel + scripts[0] + settings.singleCookieScriptEndLabel;
|
||||
}
|
||||
}
|
||||
|
||||
// Create overlay, vary the disclosure based on explicit/implied consent
|
||||
// Set our disclosure/message if one not supplied
|
||||
var html = '';
|
||||
html += '<div id="epd">';
|
||||
html += '<div id="cookiesdirective" style="position:'+ settings.css +';'+ settings.position + ':-300px;left:0px;width:100%;'
|
||||
html += 'height:auto;background:' + settings.backgroundColor + ';opacity:.' + settings.backgroundOpacity + ';';
|
||||
html += '-ms-filter: “alpha(opacity=' + settings.backgroundOpacity + ')”; filter: alpha(opacity=' + settings.backgroundOpacity + ');';
|
||||
html += '-khtml-opacity: .' + settings.backgroundOpacity + '; -moz-opacity: .' + settings.backgroundOpacity + ';';
|
||||
html += 'color:' + settings.fontColor + ';font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';';
|
||||
html += 'text-align:center;z-index:1000;">';
|
||||
html += '<div style="position:relative;height:auto;width:90%;padding:10px;margin-left:auto;margin-right:auto;">';
|
||||
|
||||
if(!settings.message) {
|
||||
if(settings.explicitConsent) {
|
||||
// Explicit consent message
|
||||
settings.message = 'This site uses cookies. Some of the cookies we ';
|
||||
settings.message += 'use are essential for parts of the site to operate and have already been set.';
|
||||
} else {
|
||||
// Implied consent message
|
||||
settings.message = 'We have placed cookies on your computer to help make this website better.';
|
||||
}
|
||||
}
|
||||
html += settings.message;
|
||||
|
||||
// Build the rest of the disclosure for implied and explicit consent
|
||||
if(settings.explicitConsent) {
|
||||
// Explicit consent disclosure
|
||||
html += scriptsDisclosure + settings.explicitCookieDeletionWarning;
|
||||
html += settings.explicitFindOutMore + '<a style="color:'+ settings.linkColor + ';font-weight:bold;';
|
||||
html += 'font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';" href="'+ settings.privacyPolicyUri + '">'+ settings.privacyPolicyLinkText +'</a>.';
|
||||
html += '<div id="epdnotick" style="color:#ca0000;display:none;margin:2px;"><span style="background:#cecece;padding:2px;">' + settings.explicitCheckboxLabel + '</span></div>'
|
||||
html += '<div style="margin-top:5px;';
|
||||
if(settings.inlineAction) {
|
||||
html += 'display:inline-block;margin-left:5px';
|
||||
}
|
||||
html += '">' + settings.explicitCookieAcceptanceLabel + '<input type="checkbox" name="epdagree" id="epdagree" /> ';
|
||||
html += '<input type="submit" name="explicitsubmit" id="explicitsubmit" value="' + settings.explicitCookieAcceptButtonText + '"/><br/></div></div>';
|
||||
|
||||
} else {
|
||||
// Implied consent disclosure
|
||||
html += scriptsDisclosure + settings.impliedDisclosureText + ' <a style="color:'+ settings.linkColor + ';';
|
||||
html += 'font-weight:bold;font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';" href="'+ settings.privacyPolicyUri + '">' + settings.privacyPolicyLinkText + '</a>.';
|
||||
html += '<div style="margin-top:5px;';
|
||||
if(settings.inlineAction) {
|
||||
html += 'display:inline-block;margin-left:5px';
|
||||
}
|
||||
html += '"><input type="submit" name="impliedsubmit" id="impliedsubmit" value="' + settings.impliedSubmitText + '"/></div></div>';
|
||||
}
|
||||
html += '</div></div>';
|
||||
$('body').append(html);
|
||||
|
||||
// Serve the disclosure, and be smarter about branching
|
||||
var dp = settings.position.toLowerCase();
|
||||
if(dp != 'top' && dp!= 'bottom') {
|
||||
dp = 'top';
|
||||
}
|
||||
var opts = new Array();
|
||||
if(dp == 'top') {
|
||||
opts['in'] = {'top':'0'};
|
||||
opts['out'] = {'top':'-300'};
|
||||
} else {
|
||||
opts['in'] = {'bottom':'0'};
|
||||
opts['out'] = {'bottom':'-300'};
|
||||
}
|
||||
|
||||
// Start animation
|
||||
$('#cookiesdirective').animate(opts['in'], 1000, function() {
|
||||
// Set event handlers depending on type of disclosure
|
||||
if(settings.explicitConsent) {
|
||||
// Explicit, need to check a box and click a button
|
||||
$('#explicitsubmit').click(function() {
|
||||
if($('#epdagree').is(':checked')) {
|
||||
// Set a cookie to prevent this being displayed again
|
||||
setCookie('cookiesDirective',1,365);
|
||||
// Close the overlay
|
||||
$('#cookiesdirective').animate(opts['out'],1000,function() {
|
||||
// Remove the elements from the DOM and reload page
|
||||
$('#cookiesdirective').remove();
|
||||
location.reload(true);
|
||||
});
|
||||
} else {
|
||||
// We need the box checked we want "explicit consent", display message
|
||||
$('#epdnotick').css('display', 'block');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Implied consent, just a button to close it
|
||||
$('#impliedsubmit').click(function() {
|
||||
// Set a cookie to prevent this being displayed again
|
||||
setCookie('cookiesDirective',1,365);
|
||||
// Close the overlay
|
||||
$('#cookiesdirective').animate(opts['out'],1000,function() {
|
||||
// Remove the elements from the DOM and reload page
|
||||
$('#cookiesdirective').remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Set a timer to remove the warning after 'settings.duration' seconds
|
||||
setTimeout(function(){
|
||||
$('#cookiesdirective').animate({
|
||||
opacity:'0'
|
||||
},2000, function(){
|
||||
$('#cookiesdirective').css(dp,'-300px');
|
||||
});
|
||||
}, settings.duration * 1000);
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<!-- developer design for file list -->
|
||||
<h3>{TITLE}</h3>
|
||||
<!--
|
||||
Possible place holders for entries:
|
||||
FILELINK, FILENAME, FILEEXTENSION, FILESIZE, FILESIZE_UNIT,
|
||||
FILECREATIONDATE, FILEMODIFYDATE, FILEDIRCTORY,
|
||||
FILEMETA_DESCRIPTION, FILEMETA_KEYWORDS, FILEMETA_MEDIANAME,
|
||||
FILEMETA_INTERNAL_NOTICE, FILEMETA_COPYRIGHT
|
||||
-->
|
||||
<!-- BEGIN:BLOCK -->
|
||||
<div style="float: left;margin-bottom: 20px;width:47%;padding-right:5px">
|
||||
<b><a href="{FILELINK}">{FILENAME}</a></b> ({FILEEXTENSION})<br />
|
||||
<span style="color: rgb(170, 170, 170);">{LABEL_FILESIZE}</span> {FILESIZE} {FILESIZE_UNIT}<br />
|
||||
<span style="color: rgb(170, 170, 170);">{LABEL_UPLOAD_DATE}</span> {FILECREATIONDATE}<br />
|
||||
{FILEMETA_DESCRIPTION}
|
||||
</div>
|
||||
<!-- END:BLOCK -->
|
||||
<!-- developer design for file list test -->
|
||||
<h3>{TITLE}</h3>
|
||||
<!--
|
||||
Possible place holders for entries:
|
||||
FILELINK, FILENAME, FILEEXTENSION, FILESIZE, FILESIZE_UNIT,
|
||||
FILECREATIONDATE, FILEMODIFYDATE, FILEDIRCTORY,
|
||||
FILEMETA_DESCRIPTION, FILEMETA_KEYWORDS, FILEMETA_MEDIANAME,
|
||||
FILEMETA_INTERNAL_NOTICE, FILEMETA_COPYRIGHT
|
||||
-->
|
||||
<!-- BEGIN:BLOCK -->
|
||||
<div style="float: left;margin-bottom: 20px;width:47%;padding-right:5px">
|
||||
<b><a href="{FILELINK}">{FILENAME}</a></b> ({FILEEXTENSION})<br />
|
||||
<span style="color: rgb(170, 170, 170);">{LABEL_FILESIZE}</span> {FILESIZE} {FILESIZE_UNIT}<br />
|
||||
<span style="color: rgb(170, 170, 170);">{LABEL_UPLOAD_DATE}</span> {FILECREATIONDATE}<br />
|
||||
{FILEMETA_DESCRIPTION}
|
||||
</div>
|
||||
<!-- END:BLOCK -->
|
||||
<br style="clear:both" />
|
|
@ -1,22 +1,26 @@
|
|||
{
|
||||
"name": "vendor/con-lite21",
|
||||
"description": "Description of project ConLite21.",
|
||||
"name": "org.conlite/conlite",
|
||||
"description": "ConLite vendor libs",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"authors": [
|
||||
{
|
||||
"name": "oldperl",
|
||||
"email": "ortwin.pinke@php-backoffice.de"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"vendor-dir": "conlite/external"
|
||||
},
|
||||
"require": {
|
||||
"phpmailer/phpmailer": "v6.5.*",
|
||||
"endroid/qr-code": "4.2.2"
|
||||
"php": "^8.0",
|
||||
"phpmailer/phpmailer": "v6.8.0",
|
||||
"twig/twig": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"rector/rector": "^0.15"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Conlite\\External\\": "conlite/external"
|
||||
"ConLite\\": "conlite/classes"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -92,6 +92,10 @@ class DB_Sql extends DB_Sql_Abstract {
|
|||
return null;
|
||||
}
|
||||
|
||||
// PHP 8.1 fix
|
||||
$driver = new mysqli_driver();
|
||||
$driver->report_mode = MYSQLI_REPORT_OFF;
|
||||
|
||||
$dbh = mysqli_init();
|
||||
//print_r($dbh);
|
||||
if (!$dbh) {
|
||||
|
@ -123,7 +127,7 @@ class DB_Sql extends DB_Sql_Abstract {
|
|||
$aCon['socket'] = null;
|
||||
}
|
||||
if (!isset($aCon['flags'])) {
|
||||
$aCon['flags'] = null;
|
||||
$aCon['flags'] = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT;
|
||||
}
|
||||
if (!isset($aCon['database'])) {
|
||||
$aCon['database'] = null;
|
||||
|
@ -134,10 +138,10 @@ class DB_Sql extends DB_Sql_Abstract {
|
|||
);
|
||||
|
||||
|
||||
if (isset($aCon['charset'])) {
|
||||
@mysqli_set_charset($dbh, $aCon['charset']);
|
||||
if (!empty($aCon['charset'])) {
|
||||
mysqli_set_charset($dbh, $aCon['charset']);
|
||||
} else {
|
||||
@mysqli_set_charset($dbh, 'utf8');
|
||||
mysqli_set_charset($dbh, 'utf8');
|
||||
}
|
||||
|
||||
//echo mysqli_character_set_name($dbh);
|
||||
|
@ -181,7 +185,8 @@ class DB_Sql extends DB_Sql_Abstract {
|
|||
/**
|
||||
* @see DB_Sql_Abstract::next_record()
|
||||
*/
|
||||
public function next_record() {
|
||||
public function next_record(): bool|int
|
||||
{
|
||||
if (!$this->Query_ID instanceof mysqli_result) {
|
||||
return false;
|
||||
}
|
||||
|
@ -326,30 +331,30 @@ class DB_Sql extends DB_Sql_Abstract {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see DB_Sql_Abstract::_metaData()
|
||||
* * Due to compatibility problems with Table we changed the behavior
|
||||
* of metadata();
|
||||
* depending on $full, metadata returns the following values:
|
||||
*
|
||||
* - full is false (default):
|
||||
* $result[]:
|
||||
* [0]["table"] table name
|
||||
* [0]["name"] field name
|
||||
* [0]["type"] field type
|
||||
* [0]["len"] field length
|
||||
* [0]["flags"] field flags
|
||||
*
|
||||
* - full is true
|
||||
* $result[]:
|
||||
* ["num_fields"] number of metadata records
|
||||
* [0]["table"] table name
|
||||
* [0]["name"] field name
|
||||
* [0]["type"] field type
|
||||
* [0]["len"] field length
|
||||
* [0]["flags"] field flags
|
||||
* ["meta"][field name] index of field named "field name"
|
||||
* This last one could be used if you have a field name, but no index.
|
||||
* Test: if (isset($result['meta']['myfield'])) { ...
|
||||
* @see DB_Sql_Abstract::_metaData()
|
||||
* * Due to compatibility problems with Table we changed the behavior
|
||||
* of metadata();
|
||||
* depending on $full, metadata returns the following values:
|
||||
*
|
||||
* - full is false (default):
|
||||
* $result[]:
|
||||
* [0]["table"] table name
|
||||
* [0]["name"] field name
|
||||
* [0]["type"] field type
|
||||
* [0]["len"] field length
|
||||
* [0]["flags"] field flags
|
||||
*
|
||||
* - full is true
|
||||
* $result[]:
|
||||
* ["num_fields"] number of metadata records
|
||||
* [0]["table"] table name
|
||||
* [0]["name"] field name
|
||||
* [0]["type"] field type
|
||||
* [0]["len"] field length
|
||||
* [0]["flags"] field flags
|
||||
* ["meta"][field name] index of field named "field name"
|
||||
* This last one could be used if you have a field name, but no index.
|
||||
* Test: if (isset($result['meta']['myfield'])) { ...
|
||||
*/
|
||||
protected function _metaData($table = '', $full = false) {
|
||||
$count = 0;
|
||||
|
@ -392,7 +397,7 @@ class DB_Sql extends DB_Sql_Abstract {
|
|||
|
||||
$count = 0;
|
||||
while ($finfo = $id->fetch_field()) {
|
||||
//rint_r($finfo);
|
||||
//rint_r($finfo);
|
||||
$res[$count]['table'] = $finfo->table;
|
||||
$res[$count]['name'] = $finfo->name;
|
||||
$res[$count]['type'] = $this->_aDataTypes[$finfo->type];
|
||||
|
@ -420,10 +425,13 @@ class DB_Sql extends DB_Sql_Abstract {
|
|||
* @see DB_Sql_Abstract::escape()
|
||||
*/
|
||||
public function escape($sString) {
|
||||
if(is_null($sString)) {
|
||||
$sString = '';
|
||||
}
|
||||
$sResult = '';
|
||||
if (is_resource($this->Link_ID) || $this->connect()) {
|
||||
$sResult = mysqli_real_escape_string($this->Link_ID, $sString);
|
||||
};
|
||||
}
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
|
@ -440,7 +448,7 @@ class DB_Sql extends DB_Sql_Abstract {
|
|||
$return[$i]['table_name'] = $info[0];
|
||||
$return[$i]['tablespace_name'] = $this->Database;
|
||||
$return[$i]['database'] = $this->Database;
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
mysqli_free_result($h);
|
||||
|
|
148
conlib/local.php
148
conlib/local.php
|
@ -41,6 +41,7 @@ if (!defined('CON_FRAMEWORK')) {
|
|||
* DB-class for all DB handling
|
||||
*/
|
||||
class DB_ConLite extends DB_Sql {
|
||||
protected bool $NoRecord;
|
||||
|
||||
/**
|
||||
* Constructor of database class.
|
||||
|
@ -58,13 +59,13 @@ class DB_ConLite extends DB_Sql {
|
|||
* - $options['enableProfiling'] (bool) Optional, flag to enable profiling
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $options = array()) {
|
||||
public function __construct(array $options = []) {
|
||||
global $cachemeta;
|
||||
|
||||
parent::__construct($options);
|
||||
|
||||
if (!is_array($cachemeta)) {
|
||||
$cachemeta = array();
|
||||
$cachemeta = [];
|
||||
}
|
||||
|
||||
// TODO check this out
|
||||
|
@ -79,16 +80,20 @@ class DB_ConLite extends DB_Sql {
|
|||
/**
|
||||
* Fetches the next recordset from result set
|
||||
*
|
||||
* @param bool
|
||||
* @deprecated since ConLite 2.3
|
||||
*/
|
||||
public function next_record() {
|
||||
global $cCurrentModule;
|
||||
// FIXME For what reason is NoRecord used???
|
||||
$this->NoRecord = false;
|
||||
public function next_record(): bool|int
|
||||
{
|
||||
return $this->nextRecord();
|
||||
}
|
||||
|
||||
public function nextRecord(): bool|int
|
||||
{
|
||||
$currentModule = cRegistry::getCurrentModule();
|
||||
|
||||
if (!$this->Query_ID) {
|
||||
$this->NoRecord = true;
|
||||
if ($cCurrentModule > 0) {
|
||||
$this->halt("next_record called with no query pending in Module ID $cCurrentModule.");
|
||||
if ($currentModule > 0) {
|
||||
$this->halt("next_record called with no query pending in Module ID $currentModule.");
|
||||
} else {
|
||||
$this->halt("next_record called with no query pending.");
|
||||
}
|
||||
|
@ -108,7 +113,7 @@ class DB_ConLite extends DB_Sql {
|
|||
*/
|
||||
public function copyResultToArray($sTable = '') {
|
||||
|
||||
$aValues = array();
|
||||
$aValues = [];
|
||||
|
||||
|
||||
$aMetadata = $this->metadata($sTable);
|
||||
|
@ -131,17 +136,8 @@ class DB_ConLite extends DB_Sql {
|
|||
*
|
||||
* @deprecated since version 2.0.0, use DB_ConLite instead
|
||||
*/
|
||||
class DB_Contenido extends DB_ConLite {
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated since version 2.0.0
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(array $options = array()) {
|
||||
parent::__construct($options);
|
||||
}
|
||||
|
||||
class DB_Contenido extends DB_ConLite
|
||||
{
|
||||
}
|
||||
|
||||
class Contenido_CT_Sql extends CT_Sql {
|
||||
|
@ -175,17 +171,12 @@ class Contenido_CT_Sql extends CT_Sql {
|
|||
* @param string $id The session id (hash)
|
||||
* @param string $name Name of the session
|
||||
* @param string $str The value to store
|
||||
* @return bool
|
||||
*/
|
||||
public function ac_store($id, $name, $str) {
|
||||
switch ($this->encoding_mode) {
|
||||
case 'slashes':
|
||||
$str = addslashes($name . ':' . $str);
|
||||
break;
|
||||
case 'base64':
|
||||
default:
|
||||
$str = base64_encode($name . ':' . $str);
|
||||
}
|
||||
public function ac_store($id, $name, $str): bool {
|
||||
$str = match ($this->encoding_mode) {
|
||||
'slashes' => addslashes($name . ':' . $str),
|
||||
default => base64_encode($name . ':' . $str),
|
||||
};
|
||||
|
||||
$name = addslashes($name);
|
||||
$now = date('YmdHis', time());
|
||||
|
@ -194,7 +185,7 @@ class Contenido_CT_Sql extends CT_Sql {
|
|||
"REPLACE INTO %s (sid, name, val, changed) VALUES ('%s', '%s', '%s', '%s')", $this->database_table, $id, $name, $str, $now
|
||||
);
|
||||
|
||||
return ($this->db->query($iquery)) ? true : false;
|
||||
return (bool) $this->db->query($iquery);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -279,14 +270,12 @@ class Contenido_CT_Shm extends CT_Shm {
|
|||
class Contenido_CT_Session extends CT_Session {
|
||||
|
||||
public function __construct() {
|
||||
$this->ac_start(array(
|
||||
$this->ac_start([
|
||||
'namespace' => 'contenido_ct_session_ns',
|
||||
'session.hash_function' => '1', // use sha-1 function
|
||||
'session.hash_bits_per_character' => '5', // and set 5 character to achieve 32 chars
|
||||
# 'session.save_path' => 'your path',
|
||||
# 'session.name' => 'your session name',
|
||||
# 'session.gc_maxlifetime' => 'your lifetime in seconds',
|
||||
));
|
||||
'session.hash_function' => '1',
|
||||
// use sha-1 function
|
||||
'session.hash_bits_per_character' => '5',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -320,8 +309,8 @@ class Contenido_Session extends Session {
|
|||
}
|
||||
|
||||
public function delete() {
|
||||
$oCol = new InUseCollection();
|
||||
$oCol->removeSessionMarks($this->id);
|
||||
$inUseCollection = new InUseCollection();
|
||||
$inUseCollection->removeSessionMarks($this->id);
|
||||
parent::delete();
|
||||
}
|
||||
|
||||
|
@ -435,6 +424,8 @@ class Contenido_Challenge_Auth extends Auth {
|
|||
}
|
||||
|
||||
public function auth_validatelogin() {
|
||||
$pass = null;
|
||||
$uid = null;
|
||||
global $username, $password, $challenge, $response, $timestamp;
|
||||
|
||||
if ($password == '') {
|
||||
|
@ -522,7 +513,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
|
|||
public function auth_loglogin($uid) {
|
||||
global $cfg, $client, $lang, $auth, $sess, $saveLoginTime;
|
||||
|
||||
$perm = new Contenido_Perm();
|
||||
$contenidoPerm = new Contenido_Perm();
|
||||
$timestamp = date('Y-m-d H:i:s');
|
||||
$idcatart = '0';
|
||||
|
||||
|
@ -539,7 +530,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
|
|||
$iTmpClient = $this->db->f('idclient');
|
||||
$iTmpLang = $this->db->f('idlang');
|
||||
|
||||
if ($perm->have_perm_client_lang($iTmpClient, $iTmpLang)) {
|
||||
if ($contenidoPerm->have_perm_client_lang($iTmpClient, $iTmpLang)) {
|
||||
$client = $iTmpClient;
|
||||
$lang = $iTmpLang;
|
||||
$bFound = true;
|
||||
|
@ -564,7 +555,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
|
|||
return;
|
||||
}
|
||||
|
||||
$idaction = $perm->getIDForAction('login');
|
||||
$idaction = $contenidoPerm->getIDForAction('login');
|
||||
$lastentry = $this->db->nextid($cfg['tab']['actionlog']);
|
||||
|
||||
$sql = "INSERT INTO
|
||||
|
@ -584,9 +575,12 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
|
|||
}
|
||||
|
||||
public function auth_validatelogin() {
|
||||
$uid = null;
|
||||
$perm = null;
|
||||
$pass = null;
|
||||
global $username, $password, $challenge, $response, $formtimestamp, $auth_handlers;
|
||||
|
||||
$gperm = array();
|
||||
$gperm = [];
|
||||
|
||||
if ($password == '') {
|
||||
return false;
|
||||
|
@ -621,11 +615,9 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
|
|||
$pass = $this->db->f('password'); ## Password is stored as a md5 hash
|
||||
|
||||
$bInMaintenance = false;
|
||||
if ($sMaintenanceMode == 'enabled') {
|
||||
#sysadmins are allowed to login every time
|
||||
if (!preg_match('/sysadmin/', $perm)) {
|
||||
$bInMaintenance = true;
|
||||
}
|
||||
#sysadmins are allowed to login every time
|
||||
if ($sMaintenanceMode == 'enabled' && !preg_match('/sysadmin/', $perm)) {
|
||||
$bInMaintenance = true;
|
||||
}
|
||||
|
||||
if ($bInMaintenance) {
|
||||
|
@ -634,14 +626,11 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
|
|||
unset($pass);
|
||||
}
|
||||
|
||||
if (is_array($auth_handlers) && !$bInMaintenance) {
|
||||
if (array_key_exists($pass, $auth_handlers)) {
|
||||
$success = call_user_func($auth_handlers[$pass], $username, $password);
|
||||
|
||||
if ($success) {
|
||||
$uid = md5($username);
|
||||
$pass = md5($password);
|
||||
}
|
||||
if (is_array($auth_handlers) && !$bInMaintenance && array_key_exists($pass, $auth_handlers)) {
|
||||
$success = call_user_func($auth_handlers[$pass], $username, $password);
|
||||
if ($success) {
|
||||
$uid = md5($username);
|
||||
$pass = md5($password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -663,9 +652,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
|
|||
$gperm[] = $this->db->f('perms');
|
||||
}
|
||||
|
||||
if (is_array($gperm)) {
|
||||
$perm = implode(',', $gperm);
|
||||
}
|
||||
$perm = implode(',', $gperm);
|
||||
|
||||
if ($response == '') { ## True when JS is disabled
|
||||
if (md5($password) != $pass) { ## md5 hash for non-JavaScript browsers
|
||||
|
@ -717,8 +704,6 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth {
|
|||
global $password;
|
||||
|
||||
if ($password == '') {
|
||||
/* Stay as nobody when an empty password is passed */
|
||||
$uid = $this->auth['uname'] = $this->auth['uid'] = 'nobody';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -735,13 +720,18 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth {
|
|||
}
|
||||
|
||||
public function auth_validatelogin() {
|
||||
$perm = null;
|
||||
$gperm = [];
|
||||
$pass = null;
|
||||
global $username, $password, $challenge, $response, $auth_handlers, $client;
|
||||
|
||||
$client = (int) $client;
|
||||
|
||||
if (isset($username)) {
|
||||
$this->auth['uname'] = $username; ## This provides access for 'loginform.ihtml'
|
||||
} else if ($this->nobody) { ## provides for 'default login cancel'
|
||||
$this->auth['uname'] = $username;
|
||||
## This provides access for 'loginform.ihtml'
|
||||
} elseif ($this->nobody) {
|
||||
## provides for 'default login cancel'
|
||||
$uid = $this->auth['uname'] = $this->auth['uid'] = 'nobody';
|
||||
return $uid;
|
||||
}
|
||||
|
@ -767,13 +757,11 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth {
|
|||
$perm = $this->db->f('perms');
|
||||
$pass = $this->db->f('password'); ## Password is stored as a md5 hash
|
||||
|
||||
if (is_array($auth_handlers)) {
|
||||
if (array_key_exists($pass, $auth_handlers)) {
|
||||
$success = call_user_func($auth_handlers[$pass], $username, $password);
|
||||
if ($success) {
|
||||
$uid = md5($username);
|
||||
$pass = md5($password);
|
||||
}
|
||||
if (is_array($auth_handlers) && array_key_exists($pass, $auth_handlers)) {
|
||||
$success = call_user_func($auth_handlers[$pass], $username, $password);
|
||||
if ($success) {
|
||||
$uid = md5($username);
|
||||
$pass = md5($password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -795,9 +783,7 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth {
|
|||
$gperm[] = $this->db->f('perms');
|
||||
}
|
||||
|
||||
if (is_array($gperm)) {
|
||||
$perm = implode(',', $gperm);
|
||||
}
|
||||
$perm = implode(',', $gperm);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -836,16 +822,16 @@ function register_auth_handler($aHandlers) {
|
|||
global $auth_handlers;
|
||||
|
||||
if (!is_array($auth_handlers)) {
|
||||
$auth_handlers = array();
|
||||
$auth_handlers = [];
|
||||
}
|
||||
|
||||
if (!is_array($aHandlers)) {
|
||||
$aHandlers = Array($aHandlers);
|
||||
$aHandlers = [$aHandlers];
|
||||
}
|
||||
|
||||
foreach ($aHandlers as $sHandler) {
|
||||
if (!in_array($sHandler, $auth_handlers)) {
|
||||
$auth_handlers[md5($sHandler)] = $sHandler;
|
||||
foreach ($aHandlers as $aHandler) {
|
||||
if (!in_array($aHandler, $auth_handlers)) {
|
||||
$auth_handlers[md5($aHandler)] = $aHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,8 +232,8 @@ class Contenido_Perm {
|
|||
return true;
|
||||
} elseif ($item_rights[$area] != "noright") {
|
||||
|
||||
$groupsForUser = $this->getGroupsForUser($auth->auth[uid]);
|
||||
$groupsForUser[] = $auth->auth[uid];
|
||||
$groupsForUser = $this->getGroupsForUser($auth->auth['uid']);
|
||||
$groupsForUser[] = $auth->auth['uid'];
|
||||
|
||||
$tmp_userstring = implode("','", $groupsForUser);
|
||||
|
||||
|
@ -596,8 +596,8 @@ class Contenido_Perm {
|
|||
}
|
||||
} elseif ($item_rights[$value] != "noright") {
|
||||
|
||||
$groupsForUser = $this->getGroupsForUser($auth->auth[uid]);
|
||||
$groupsForUser[] = $auth->auth[uid];
|
||||
$groupsForUser = $this->getGroupsForUser($auth->auth['uid']);
|
||||
$groupsForUser[] = $auth->auth['uid'];
|
||||
|
||||
//else search for rights for this user in this area
|
||||
$sql = "SELECT
|
||||
|
|
|
@ -35,8 +35,8 @@ if (!defined('CON_FRAMEWORK')) {
|
|||
die('Illegal call');
|
||||
}
|
||||
|
||||
$_PHPLIB = array();
|
||||
$_PHPLIB['libdir'] = str_replace ('\\', '/', dirname(__FILE__) . '/');
|
||||
$_PHPLIB = [];
|
||||
$_PHPLIB['libdir'] = str_replace ('\\', '/', __DIR__ . '/');
|
||||
|
||||
global $cfg;
|
||||
|
||||
|
|
|
@ -318,12 +318,12 @@ class cSession {
|
|||
break;
|
||||
case "object":
|
||||
## $$var is an object. Enumerate the slots and serialize them.
|
||||
eval("\$k = \$${var}->classname; \$l = reset(\$${var}->persistent_slots);");
|
||||
eval("\$k = \${$var}->classname; \$l = reset(\${$var}->persistent_slots);");
|
||||
$str.="\$$var = new $k; ";
|
||||
while ($l) {
|
||||
## Structural recursion.
|
||||
$this->serialize($var . "->" . $l, $str);
|
||||
eval("\$l = next(\$${var}->persistent_slots);");
|
||||
eval("\$l = next(\${$var}->persistent_slots);");
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -330,13 +330,9 @@ if( sizeof($_GET) == 0 && isset($_POST['save_search']) )
|
|||
// STORED SEARCH HAS BEEN CALLED
|
||||
elseif( sizeof($_GET) > 0)
|
||||
{
|
||||
$itemtypeReq = $_GET['itemtype'];
|
||||
$itemidReq = $_GET['itemid'];
|
||||
// Do we have the request parameters we need to fetch search values of stored search ?
|
||||
if( (isset($itemtypeReq) && strlen($itemtypeReq)>0) &&
|
||||
(isset($itemidReq) && strlen($itemidReq)>0)
|
||||
)
|
||||
{
|
||||
$itemtypeReq = (isset($itemtypeReq))?$_GET['itemtype']:'';
|
||||
$itemidReq = (isset($itemidReq))?$_GET['itemid']:'';
|
||||
if(strlen($itemtypeReq) > 0 && strlen($itemidReq) > 0) {
|
||||
$searchResults = getSearchResults($itemidReq, $itemtypeReq);
|
||||
$sSearchStr_tmp = $searchResults[$save_title];
|
||||
$iSearchID_tmp = $searchResults[$save_id];
|
||||
|
@ -403,13 +399,13 @@ if ($iSearchID_tmp > 0) {
|
|||
}
|
||||
// Date
|
||||
if ($sSearchStrDateType_tmp != 'n/a') {
|
||||
if (($sSearchStrDateFromDay_tmp > 0) && ($sSearchStrDateFromMonth_tmp > 0) && ($sSearchStrDateFromYear_tmp > 0)) {
|
||||
if (!empty($sSearchStrDateFromDay_tmp) && !empty($sSearchStrDateFromMonth_tmp) && !empty($sSearchStrDateFromYear_tmp)) {
|
||||
$sSearchStrDateFrom = $sSearchStrDateFromYear_tmp.'-'.$sSearchStrDateFromMonth_tmp.'-'.$sSearchStrDateFromDay_tmp.' 00:00:00';
|
||||
} else {
|
||||
$sSearchStrDateFrom = '';
|
||||
}
|
||||
|
||||
if (($sSearchStrDateToDay_tmp > 0) && ($sSearchStrDateToMonth_tmp > 0) && ($sSearchStrDateToYear_tmp > 0)) {
|
||||
if (!empty($sSearchStrDateToDay_tmp) && !empty($sSearchStrDateToMonth_tmp) && !empty($sSearchStrDateToYear_tmp)) {
|
||||
$sSearchStrDateTo = $sSearchStrDateToYear_tmp.'-'.$sSearchStrDateToMonth_tmp.'-'.$sSearchStrDateToDay_tmp.' 23:59:59';
|
||||
} else {
|
||||
$sSearchStrDateTo = '';
|
||||
|
@ -559,8 +555,8 @@ if (empty($where) || $iAffectedRows <= 0) {
|
|||
#Check rights per cat
|
||||
if (!$check_rights) {
|
||||
//hotfix timo trautmann 2008-12-10 also check rights in associated groups
|
||||
$aGroupsForUser = $perm->getGroupsForUser($auth->auth[uid]);
|
||||
$aGroupsForUser[] = $auth->auth[uid];
|
||||
$aGroupsForUser = $perm->getGroupsForUser($auth->auth['uid']);
|
||||
$aGroupsForUser[] = $auth->auth['uid'];
|
||||
$sTmpUserString = implode("','", $aGroupsForUser);
|
||||
|
||||
#Check if any rights are applied to current user or his groups
|
||||
|
@ -623,7 +619,9 @@ if (empty($where) || $iAffectedRows <= 0) {
|
|||
// fuer den ersten gefundenen Artikel die Werte fuer CategoryID und TemplateID merken
|
||||
if ($i == 0) {
|
||||
$iIDCat = $idcat;
|
||||
$iIDTpl = $idtpl;
|
||||
if(!empty($idtpl)) {
|
||||
$iIDTpl = $idtpl;
|
||||
}
|
||||
}
|
||||
|
||||
/* Funktion zum umwandeln in Startartikel/normale Artikel*/
|
||||
|
@ -637,8 +635,10 @@ if (empty($where) || $iAffectedRows <= 0) {
|
|||
}
|
||||
} else {
|
||||
if( $startidartlang == $idartlang ) {
|
||||
$sFlagTitle = i18n('Flag as normal article');
|
||||
$makeStartarticle = "<td nowrap=\"nowrap\" class=\"bordercell\"><img src=\"images/isstart1.gif\" border=\"0\" title=\"{$sFlagTitle}\" alt=\"{$sFlagTitle}\"></td>";
|
||||
} else {
|
||||
$sFlagTitle = i18n('Flag as start article');
|
||||
$makeStartarticle = "<td nowrap=\"nowrap\" class=\"bordercell\"><img src=\"images/isstart0.gif\" border=\"0\" title=\"{$sFlagTitle}\" alt=\"{$sFlagTitle}\"></td>";
|
||||
}
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ if (empty($where) || $iAffectedRows <= 0) {
|
|||
}
|
||||
|
||||
if ($perm->have_perm_area_action_item("con", "con_deleteart",$idcat)) {
|
||||
$delete = "<a href=\"javascript://\" onclick=\"box.confirm("$sDeleteArticle", "$sDeleteArticleQuestion:<br><br><b>$db->f('title')</b>", "deleteArticle($idart,$idcat)")\" title=\"$sDeleteArticle\"><img src=\"images/delete.gif\" title=\"$sDeleteArticle\" alt=\"$sDeleteArticle\" border=\"0\"></a>";
|
||||
$delete = "<a href=\"javascript://\" onclick=\"box.confirm("$sDeleteArticle", "$sDeleteArticleQuestion:<br><br><b>".$db->f('title')."</b>", "deleteArticle($idart,$idcat)")\" title=\"$sDeleteArticle\"><img src=\"images/delete.gif\" title=\"$sDeleteArticle\" alt=\"$sDeleteArticle\" border=\"0\"></a>";
|
||||
}else {
|
||||
$delete = "";
|
||||
}
|
||||
|
@ -717,8 +717,6 @@ if (empty($where) || $iAffectedRows <= 0) {
|
|||
<td nowrap=\"nowrap\" class=\"bordercell\">$sTemplateName</td>
|
||||
<td nowrap=\"nowrap\" class=\"bordercell\">
|
||||
<a id=\"m1\" onclick=\"javascript:window.open('main.php?subject=$todoListeSubject&area=todo&frame=1&itemtype=idart&itemid=$idart&contenido=$sSession', 'todo', 'scrollbars=yes, height=300, width=550');\" alt=\"$sReminder\" title=\"$sReminder\" href=\"#\"><img id=\"m2\" style=\"padding-left: 2px; padding-right: 2px;\" alt=\"$sReminder\" src=\"images/but_setreminder.gif\" border=\"0\"></a>
|
||||
$properties
|
||||
$tplconfig
|
||||
$duplicate
|
||||
$delete
|
||||
</td>
|
||||
|
@ -746,7 +744,7 @@ if (empty($where) || $iAffectedRows <= 0) {
|
|||
# Save Search Parameters
|
||||
###########################
|
||||
|
||||
if($bHit && sizeof($_GET) == 0 && isset($_POST) ) {
|
||||
if(!empty($bHit) && sizeof($_GET) == 0 && isset($_POST) ) {
|
||||
// Build form with hidden fields that contain all search parameters to be stored using generic db
|
||||
$searchForm = '<form id="save_search" target="right_bottom" method="post" action="backend_search.php">';
|
||||
// Meta for Contenido
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class Exception extends \Exception
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class FileNotFoundException extends RuntimeException
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class InvalidArgumentException extends LogicException
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class LogicException extends Exception
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class RuntimeException extends Exception
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Frontend\Navigation;
|
||||
|
||||
class FrontendNavigation
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\GenericDb\Driver;
|
||||
|
||||
class GenericDbDriver
|
||||
{
|
||||
public $_sEncoding;
|
||||
public $_oItemClassInstance;
|
||||
|
||||
public function setEncoding($sEncoding)
|
||||
{
|
||||
$this->_sEncoding = $sEncoding;
|
||||
}
|
||||
|
||||
public function setItemClassInstance($oInstance)
|
||||
{
|
||||
$this->_oItemClassInstance = $oInstance;
|
||||
}
|
||||
|
||||
public function buildJoinQuery($destinationTable, $destinationClass, $destinationPrimaryKey, $sourceClass, $primaryKey)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function buildOperator($sField, $sOperator, $sRestriction)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1,51 +1,32 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* MySQL Driver for GenericDB
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.12
|
||||
* @author Bjoern Behrens
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* {@internal
|
||||
* created 2006-05-10
|
||||
* modified 2008-05-23 Added Debug_DevNull and Debug_VisibleAdv
|
||||
*
|
||||
* $Id$
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
namespace ConLite\GenericDb\Driver\MySql;
|
||||
|
||||
class gdbMySQL extends gdbDriver {
|
||||
use cCharacterConverter;
|
||||
use ConLite\GenericDb\Driver\GenericDbDriver;
|
||||
use Contenido_Security;
|
||||
|
||||
function buildJoinQuery($destinationTable, $destinationClass, $destinationPrimaryKey, $sourceClass, $primaryKey) {
|
||||
class GenericDbDriverMySql extends GenericDbDriver
|
||||
{
|
||||
|
||||
|
||||
public $_oItemClassInstance;
|
||||
public $_sEncoding;
|
||||
function buildJoinQuery($destinationTable, $destinationClass, $destinationPrimaryKey, $sourceClass, $primaryKey)
|
||||
{
|
||||
// Build a regular LEFT JOIN
|
||||
$field = "$destinationClass.$destinationPrimaryKey";
|
||||
$tables = "";
|
||||
$join = "LEFT JOIN $destinationTable AS $destinationClass ON " .
|
||||
Contenido_Security::toString($sourceClass . "." . $primaryKey) . " = " .
|
||||
Contenido_Security::toString($destinationClass . "." . $primaryKey);
|
||||
Contenido_Security::toString($sourceClass . "." . $primaryKey) . " = " .
|
||||
Contenido_Security::toString($destinationClass . "." . $primaryKey);
|
||||
$where = "";
|
||||
|
||||
return array("field" => $field, "table" => $tables, "join" => $join, "where" => $where);
|
||||
return ["field" => $field, "table" => $tables, "join" => $join, "where" => $where];
|
||||
}
|
||||
|
||||
function buildOperator($sField, $sOperator, $sRestriction) {
|
||||
function buildOperator($sField, $sOperator, $sRestriction)
|
||||
{
|
||||
$sOperator = strtolower($sOperator);
|
||||
|
||||
$sWhereStatement = "";
|
||||
|
@ -88,14 +69,14 @@ class gdbMySQL extends gdbDriver {
|
|||
$GLOBALS["_cCharTable"] = new cCharacterConverter;
|
||||
}
|
||||
|
||||
$aliasSearch = array();
|
||||
$aliasSearch = [];
|
||||
|
||||
$metaCharacters = array("*", "[", "]", "^", '$', "\\", "*", "'", '"', '+');
|
||||
$metaCharacters = ["*", "[", "]", "^", '$', "\\", "*", "'", '"', '+'];
|
||||
|
||||
for ($i = 0; $i < strlen($sRestriction); $i ++) {
|
||||
for ($i = 0; $i < strlen($sRestriction); $i++) {
|
||||
$char = substr($sRestriction, $i, 1);
|
||||
|
||||
$aliases = array();
|
||||
$aliases = [];
|
||||
|
||||
$aliases = array_merge($aliases, $GLOBALS["_cCharTable"]->fetchDiacriticCharactersForNormalizedChar($this->_sEncoding, $char));
|
||||
$normalizedChars = $GLOBALS["_cCharTable"]->fetchNormalizedCharsForDiacriticCharacter($this->_sEncoding, $char);
|
||||
|
@ -106,9 +87,9 @@ class gdbMySQL extends gdbDriver {
|
|||
|
||||
$aliases = array_merge($aliases, $normalizedChars);
|
||||
|
||||
if (count($aliases) > 0) {
|
||||
if ($aliases !== []) {
|
||||
$aliases[] = $char;
|
||||
$allAliases = array();
|
||||
$allAliases = [];
|
||||
|
||||
foreach ($aliases as $alias) {
|
||||
$alias1 = $this->_oItemClassInstance->_inFilter($alias);
|
||||
|
@ -119,8 +100,7 @@ class gdbMySQL extends gdbDriver {
|
|||
$allAliases = array_unique($allAliases);
|
||||
$aliasSearch[] = "(" . implode("|", $allAliases) . ")";
|
||||
} else {
|
||||
$addChars = array();
|
||||
|
||||
$addChars = [];
|
||||
|
||||
|
||||
if (in_array($char, $metaCharacters)) {
|
||||
|
@ -131,11 +111,7 @@ class gdbMySQL extends gdbDriver {
|
|||
$vChar = $this->_oItemClassInstance->_inFilter($char);
|
||||
|
||||
if ($char != $vChar) {
|
||||
if (in_array($vChar, $metaCharacters)) {
|
||||
$addChars[] = "\\\\" . $vChar;
|
||||
} else {
|
||||
$addChars[] = $vChar;
|
||||
}
|
||||
$addChars[] = in_array($vChar, $metaCharacters) ? "\\\\" . $vChar : $vChar;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +120,7 @@ class gdbMySQL extends gdbDriver {
|
|||
}
|
||||
|
||||
$restriction = "'" . implode("", $aliasSearch) . "'";
|
||||
$sWhereStatement = implode(" ", array($sField, "REGEXP", $restriction));
|
||||
$sWhereStatement = implode(" ", [$sField, "REGEXP", $restriction]);
|
||||
|
||||
break;
|
||||
case "fulltext":
|
||||
|
@ -152,9 +128,9 @@ class gdbMySQL extends gdbDriver {
|
|||
break;
|
||||
case "in":
|
||||
if (is_array($sRestriction)) {
|
||||
$items = array();
|
||||
$items = [];
|
||||
|
||||
foreach ($sRestriction as $key => $sRestrictionItem) {
|
||||
foreach ($sRestriction as $sRestrictionItem) {
|
||||
$items[] = "'" . $this->_oItemClassInstance->_inFilter($sRestrictionItem) . "'";
|
||||
}
|
||||
|
||||
|
@ -163,14 +139,14 @@ class gdbMySQL extends gdbDriver {
|
|||
$sRestriction = "'" . $sRestriction . "'";
|
||||
}
|
||||
|
||||
$sWhereStatement = implode(" ", array($sField, "IN (", $sRestriction, ")"));
|
||||
$sWhereStatement = implode(" ", [$sField, "IN (", $sRestriction, ")"]);
|
||||
break;
|
||||
case "notin":
|
||||
if (is_array($sRestriction)) {
|
||||
$items = array();
|
||||
$items = [];
|
||||
|
||||
foreach ($sRestriction as $key => $sRestrictionItem) {
|
||||
$items[] = "'" . $this->_oItemClassInstance->_inFilter($sRestrictionItem) . "'";
|
||||
foreach ($sRestriction as $Restriction) {
|
||||
$items[] = "'" . $this->_oItemClassInstance->_inFilter($Restriction) . "'";
|
||||
}
|
||||
|
||||
$sRestriction = implode(", ", $items);
|
||||
|
@ -178,17 +154,15 @@ class gdbMySQL extends gdbDriver {
|
|||
$sRestriction = "'" . $sRestriction . "'";
|
||||
}
|
||||
|
||||
$sWhereStatement = implode(" ", array($sField, "NOT IN (", $sRestriction, ")"));
|
||||
$sWhereStatement = implode(" ", [$sField, "NOT IN (", $sRestriction, ")"]);
|
||||
break;
|
||||
default :
|
||||
$sRestriction = "'" . $this->_oItemClassInstance->_inFilter($sRestriction) . "'";
|
||||
|
||||
$sWhereStatement = implode(" ", array($sField, $sOperator, $sRestriction));
|
||||
$sWhereStatement = implode(" ", [$sField, $sOperator, $sRestriction]);
|
||||
}
|
||||
|
||||
return $sWhereStatement;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
|
@ -0,0 +1,515 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\GenericDb;
|
||||
|
||||
use stdClass;
|
||||
abstract class Item extends ItemBaseAbstract
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $_lastSQL;
|
||||
/**
|
||||
* Storage of the source table to use for the user informations
|
||||
* @var array
|
||||
*/
|
||||
public $values;
|
||||
|
||||
/**
|
||||
* Storage of the fields which were modified, where the keys are the
|
||||
* fieldnames and the values just simple booleans.
|
||||
* @var array
|
||||
*/
|
||||
protected $modifiedValues;
|
||||
|
||||
/**
|
||||
* Stores the old primary key, just in case somebody wants to change it
|
||||
* @var string
|
||||
*/
|
||||
protected $oldPrimaryKey;
|
||||
|
||||
/**
|
||||
* List of funcion names of the filters used when data is stored to the db.
|
||||
* @var array
|
||||
*/
|
||||
protected $_arrInFilters = ['urlencode', 'clHtmlSpecialChars', 'addslashes'];
|
||||
|
||||
/**
|
||||
* List of funcion names of the filtersused when data is retrieved from the db
|
||||
* @var array
|
||||
*/
|
||||
protected $_arrOutFilters = ['stripslashes', 'htmldecode', 'urldecode'];
|
||||
|
||||
/**
|
||||
* Class name of meta object
|
||||
* @var string
|
||||
*/
|
||||
protected $_metaObject;
|
||||
|
||||
/**
|
||||
* Constructor function
|
||||
*
|
||||
* @param string $sTable The table to use as information source
|
||||
* @param string $sPrimaryKey The primary key to use
|
||||
* @param int $iLifetime
|
||||
*/
|
||||
public function __construct($sTable = '', $sPrimaryKey = '', $iLifetime = 10)
|
||||
{
|
||||
parent::__construct($sTable, $sPrimaryKey, get_parent_class($this), $iLifetime);
|
||||
}
|
||||
|
||||
function __destruct()
|
||||
{
|
||||
//print_r(self::$_oCache);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an item by colum/field from the database.
|
||||
*
|
||||
* @param string $sField Specifies the field
|
||||
* @param mixed $mValue Specifies the value
|
||||
* @param bool $bSafe Use inFilter or not
|
||||
* @return bool True if the load was successful
|
||||
*/
|
||||
public function loadBy($sField, mixed $mValue, $bSafe = true): bool
|
||||
{
|
||||
if ($bSafe) {
|
||||
$mValue = $this->_inFilter($mValue);
|
||||
}
|
||||
if ($sField === $this->primaryKey) {
|
||||
$aRecordSet = self::$_oCache->getItem($this->table . "_" . $mValue);
|
||||
} else {
|
||||
$aRecordSet = self::$_oCache->getItemByProperty($this->table . "_" . $sField, $mValue);
|
||||
}
|
||||
|
||||
if ($aRecordSet) {
|
||||
// entry in cache found, load entry from cache
|
||||
$this->loadByRecordSet($aRecordSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
// SQL-Statement to select by field
|
||||
$sql = sprintf("SELECT * FROM `%s` WHERE %s = '%s'", $this->table, $sField, $mValue);
|
||||
//$sql = $this->db->prepare($sql, $this->table, $sField, $mValue);
|
||||
// Query the database
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_lastSQL = $sql;
|
||||
|
||||
if ($this->db->num_rows() > 1) {
|
||||
$sMsg = "Tried to load a single line with field $sField and value $mValue from "
|
||||
. $this->table . " but found more than one row";
|
||||
cWarning(__FILE__, __LINE__, $sMsg);
|
||||
}
|
||||
|
||||
// Advance to the next record, return false if nothing found
|
||||
if (!$this->db->next_record()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->loadByRecordSet($this->db->toArray());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an item by passed where clause from the database.
|
||||
* This function is expensive, since it executes allways a query to the database
|
||||
* to retrieve the primary key, even if the record set is aleady cached.
|
||||
* NOTE: Passed value has to be escaped before. This will not be done by this function.
|
||||
*
|
||||
* @param string $sWhere The where clause like 'idart = 123 AND idlang = 1'
|
||||
* @return bool True if the load was successful
|
||||
*/
|
||||
protected function _loadByWhereClause($sWhere)
|
||||
{
|
||||
// SQL-Statement to select by whee clause
|
||||
$sql = sprintf("SELECT %s AS pk FROM `%s` WHERE ", $this->primaryKey, $this->table) . $sWhere;
|
||||
//$sql = $this->db->prepare($sql, $this->primaryKey, $this->table);
|
||||
// Query the database
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_lastSQL = $sql;
|
||||
|
||||
if ($this->db->num_rows() > 1) {
|
||||
$sMsg = "Tried to load a single line with where clause '" . $sWhere . "' from "
|
||||
. $this->table . " but found more than one row";
|
||||
cWarning(__FILE__, __LINE__, $sMsg);
|
||||
}
|
||||
|
||||
// Advance to the next record, return false if nothing found
|
||||
if (!$this->db->next_record()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = $this->db->f('pk');
|
||||
return $this->loadByPrimaryKey($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an item by ID from the database.
|
||||
*
|
||||
* @param string $mValue Specifies the primary key value
|
||||
* @return bool True if the load was successful
|
||||
*/
|
||||
public function loadByPrimaryKey($mValue)
|
||||
{
|
||||
$bSuccess = $this->loadBy($this->primaryKey, $mValue);
|
||||
|
||||
if (($bSuccess == true) && method_exists($this, '_onLoad')) {
|
||||
$this->_onLoad();
|
||||
}
|
||||
return $bSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an item by it's recordset.
|
||||
*
|
||||
* @param array $aRecordSet The recordset of the item
|
||||
*/
|
||||
public function loadByRecordSet(array $aRecordSet)
|
||||
{
|
||||
$this->values = $aRecordSet;
|
||||
$this->oldPrimaryKey = $this->values[$this->primaryKey];
|
||||
$this->virgin = false;
|
||||
self::$_oCache->addItem($this->table . "_" . $this->oldPrimaryKey, $this->values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a the item is already loaded.
|
||||
* @return boolean
|
||||
*/
|
||||
public function isLoaded()
|
||||
{
|
||||
return !$this->virgin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function which is called whenever an item is loaded.
|
||||
* Inherited classes should override this function if desired.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _onLoad()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of a specific field.
|
||||
*
|
||||
* @param string $sField Specifies the field to retrieve
|
||||
* @return mixed Value of the field
|
||||
*/
|
||||
public function getField($sField)
|
||||
{
|
||||
if ($this->virgin == true) {
|
||||
$this->lasterror = 'No item loaded';
|
||||
return false;
|
||||
}
|
||||
return $this->_outFilter($this->values[$sField]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for getField (less to type).
|
||||
*
|
||||
* @param string $sField Specifies the field to retrieve
|
||||
* @return mixed Value of the field
|
||||
*/
|
||||
public function get($sField)
|
||||
{
|
||||
return $this->getField($sField);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of a specific field.
|
||||
*
|
||||
* @param string $sField Field name
|
||||
* @param string $mValue Value to set
|
||||
* @param bool $bSafe Flag to run defined inFilter on passed value
|
||||
*/
|
||||
public function setField($sField, $mValue, $bSafe = true): bool
|
||||
{
|
||||
if ($this->virgin == true) {
|
||||
$this->lasterror = 'No item loaded';
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->modifiedValues[$sField] = true;
|
||||
|
||||
if ($sField == $this->primaryKey) {
|
||||
$this->oldPrimaryKey = $this->values[$sField];
|
||||
}
|
||||
|
||||
$this->values[$sField] = $bSafe == true ? $this->_inFilter($mValue) : $mValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut to setField.
|
||||
*
|
||||
* @param string $sField Field name
|
||||
* @param string $mValue Value to set
|
||||
* @param bool $bSafe Flag to run defined inFilter on passed value
|
||||
*/
|
||||
public function set($sField, $mValue, $bSafe = true)
|
||||
{
|
||||
return $this->setField($sField, $mValue, $bSafe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the loaded and modified item to the database.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
if (!$this->isLoaded()) {
|
||||
$this->lasterror = 'No item loaded';
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE `' . $this->table . '` SET ';
|
||||
$first = true;
|
||||
|
||||
if (!is_array($this->modifiedValues)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (array_keys($this->modifiedValues) as $key) {
|
||||
if ($first == true) {
|
||||
$sql .= "`$key` = '" . $this->values[$key] . "'";
|
||||
$first = false;
|
||||
} else {
|
||||
$sql .= ", `$key` = '" . $this->values[$key] . "'";
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= " WHERE " . $this->primaryKey . " = '" . $this->oldPrimaryKey . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_lastSQL = $sql;
|
||||
|
||||
if ($this->db->affected_rows() > 0) {
|
||||
self::$_oCache->addItem($this->table . "_" . $this->oldPrimaryKey, $this->values);
|
||||
}
|
||||
|
||||
return $this->db->affected_rows() >= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current item data as an assoziative array.
|
||||
*/
|
||||
public function toArray(): array|false
|
||||
{
|
||||
if ($this->virgin == true) {
|
||||
$this->lasterror = 'No item loaded';
|
||||
return false;
|
||||
}
|
||||
|
||||
$aReturn = [];
|
||||
foreach (array_keys($this->values) as $field) {
|
||||
$aReturn[$field] = $this->getField($field);
|
||||
}
|
||||
return $aReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current item data as an object.
|
||||
*/
|
||||
public function toObject(): stdClass|false
|
||||
{
|
||||
$return = $this->toArray();
|
||||
return (false !== $return) ? (object)$return : $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a custom property.
|
||||
*
|
||||
* @param string $sType Specifies the type
|
||||
* @param string $sName Specifies the name
|
||||
* @param mixed $mValue Specifies the value
|
||||
* @return bool
|
||||
*/
|
||||
public function setProperty($sType, $sName, mixed $mValue)
|
||||
{
|
||||
// If this object wasn't loaded before, return false
|
||||
if ($this->virgin == true) {
|
||||
$this->lasterror = 'No item loaded';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the value
|
||||
$oProperties = $this->_getPropertiesCollectionInstance();
|
||||
return $oProperties->setValue(
|
||||
$this->primaryKey, $this->get($this->primaryKey), $sType, $sName, $mValue
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a custom property.
|
||||
*
|
||||
* @param string $sType Specifies the type
|
||||
* @param string $sName Specifies the name
|
||||
* @return mixed Value of the given property or false
|
||||
*/
|
||||
public function getProperty($sType, $sName)
|
||||
{
|
||||
// If this object wasn't loaded before, return false
|
||||
if ($this->virgin == true) {
|
||||
$this->lasterror = 'No item loaded';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return the value
|
||||
$oProperties = $this->_getPropertiesCollectionInstance();
|
||||
return $oProperties->getValue(
|
||||
$this->primaryKey, $this->get($this->primaryKey), $sType, $sName
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a custom property.
|
||||
*
|
||||
* @param string $sType Specifies the type
|
||||
* @param string $sName Specifies the name
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteProperty($sType, $sName)
|
||||
{
|
||||
// If this object wasn't loaded before, return false
|
||||
if ($this->virgin == true) {
|
||||
$this->lasterror = 'No item loaded';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Delete the value
|
||||
$oProperties = $this->_getPropertiesCollectionInstance();
|
||||
return $oProperties->deleteValue(
|
||||
$this->primaryKey, $this->get($this->primaryKey), $sType, $sName
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a custom property by its id.
|
||||
*
|
||||
* @param int $idprop Id of property
|
||||
* @return bool
|
||||
*/
|
||||
public function deletePropertyById($idprop)
|
||||
{
|
||||
$oProperties = $this->_getPropertiesCollectionInstance();
|
||||
return $oProperties->delete($idprop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the current item
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
// Method doesn't work, remove in future versions
|
||||
// function delete()
|
||||
// {
|
||||
// $this->_collectionInstance->delete($item->get($this->primaryKey));
|
||||
//}
|
||||
|
||||
/**
|
||||
* Define the filter functions used when data is being stored or retrieved
|
||||
* from the database.
|
||||
*
|
||||
* Examples:
|
||||
* <pre>
|
||||
* $obj->setFilters(array('addslashes'), array('stripslashes'));
|
||||
* $obj->setFilters(array('htmlencode', 'addslashes'), array('stripslashes', 'htmlencode'));
|
||||
* </pre>
|
||||
*
|
||||
* @param array $aInFilters Array with function names
|
||||
* @param array $aOutFilters Array with function names
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setFilters($aInFilters = [], $aOutFilters = [])
|
||||
{
|
||||
$this->_arrInFilters = $aInFilters;
|
||||
$this->_arrOutFilters = $aOutFilters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the passed data using the functions defines in the _arrInFilters array.
|
||||
*
|
||||
* @param mixed $mData Data to filter
|
||||
* @return mixed Filtered data
|
||||
* @see setFilters
|
||||
*
|
||||
* @todo This method is used from public scope, but it should be protected
|
||||
*
|
||||
*/
|
||||
public function _inFilter(mixed $mData)
|
||||
{
|
||||
if (is_numeric($mData) || is_array($mData)) {
|
||||
return $mData;
|
||||
}
|
||||
|
||||
if (is_null($mData)) {
|
||||
$mData = '';
|
||||
}
|
||||
|
||||
foreach ($this->_arrInFilters as $_arrInFilter) {
|
||||
if (function_exists($_arrInFilter)) {
|
||||
$mData = $_arrInFilter($mData);
|
||||
}
|
||||
}
|
||||
return $mData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the passed data using the functions defines in the _arrOutFilters array.
|
||||
*
|
||||
* @param mixed $mData Data to filter
|
||||
* @return mixed Filtered data
|
||||
* @see setFilters
|
||||
*
|
||||
*/
|
||||
protected function _outFilter(mixed $mData)
|
||||
{
|
||||
if (is_numeric($mData))
|
||||
return $mData;
|
||||
|
||||
foreach ($this->_arrOutFilters as $_arrOutFilter) {
|
||||
if (function_exists($_arrOutFilter)) {
|
||||
$mData = $_arrOutFilter($mData);
|
||||
}
|
||||
}
|
||||
return $mData;
|
||||
}
|
||||
|
||||
protected function _setMetaObject($sObjectName)
|
||||
{
|
||||
$this->_metaObject = $sObjectName;
|
||||
}
|
||||
|
||||
public function getMetaObject()
|
||||
{
|
||||
global $_metaObjectCache;
|
||||
|
||||
if (!is_array($_metaObjectCache)) {
|
||||
$_metaObjectCache = [];
|
||||
}
|
||||
|
||||
$sClassName = $this->_metaObject;
|
||||
$qclassname = strtolower($sClassName);
|
||||
|
||||
if (array_key_exists($qclassname, $_metaObjectCache) && is_object($_metaObjectCache[$qclassname])) {
|
||||
if (strtolower($_metaObjectCache[$qclassname]::class) === $qclassname) {
|
||||
$_metaObjectCache[$qclassname]->setPayloadObject($this);
|
||||
return $_metaObjectCache[$qclassname];
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists($sClassName)) {
|
||||
$_metaObjectCache[$qclassname] = new $sClassName($this);
|
||||
return $_metaObjectCache[$qclassname];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace ConLite\GenericDb;
|
||||
|
||||
// security check
|
||||
defined('CON_FRAMEWORK') or die('Illegal call');
|
||||
|
||||
abstract class cItemBaseAbstract {
|
||||
use DB_ConLite;
|
||||
use PropertyCollection;
|
||||
|
||||
abstract class ItemBaseAbstract
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Database instance, contains the database object
|
||||
|
@ -29,9 +33,9 @@ abstract class cItemBaseAbstract {
|
|||
|
||||
/**
|
||||
* Item cache instance
|
||||
* @var Contenido_ItemCache
|
||||
* @var ItemCache
|
||||
*/
|
||||
protected static $_oCache;
|
||||
protected static ItemCache $_oCache;
|
||||
|
||||
/**
|
||||
* GenericDB settings, see $cfg['sql']
|
||||
|
@ -85,17 +89,17 @@ abstract class cItemBaseAbstract {
|
|||
* @var string
|
||||
*/
|
||||
protected $_className;
|
||||
|
||||
|
||||
protected $_bDebug;
|
||||
|
||||
/**
|
||||
* Sets some common properties
|
||||
*
|
||||
* @param string $sTable Name of table
|
||||
* @param string $sPrimaryKey Primary key of table
|
||||
* @param string $sClassName Name of parent class
|
||||
* @param int $iLifetime Lifetime of the object in seconds (NOT USED!)
|
||||
* @throws Contenido_ItemException If table name or primary key is not set
|
||||
* @param string $sTable Name of table
|
||||
* @param string $sPrimaryKey Primary key of table
|
||||
* @param string $sClassName Name of parent class
|
||||
* @param int $iLifetime Lifetime of the object in seconds (NOT USED!)
|
||||
* @throws ItemException
|
||||
*/
|
||||
protected function __construct($sTable, $sPrimaryKey, $sClassName, $iLifetime = 10) {
|
||||
global $cfg;
|
||||
|
@ -104,17 +108,17 @@ abstract class cItemBaseAbstract {
|
|||
|
||||
if ($sTable == '') {
|
||||
$sMsg = "$sClassName: No table specified. Inherited classes *need* to set a table";
|
||||
throw new Contenido_ItemException($sMsg);
|
||||
throw new ItemException($sMsg);
|
||||
} elseif ($sPrimaryKey == '') {
|
||||
$sMsg = "No primary key specified. Inherited classes *need* to set a primary key";
|
||||
throw new Contenido_ItemException($sMsg);
|
||||
throw new ItemException($sMsg);
|
||||
}
|
||||
|
||||
$this->_settings = $cfg['sql'];
|
||||
|
||||
// instanciate caching
|
||||
$aCacheOpt = (isset($this->_settings['cache'])) ? $this->_settings['cache'] : array();
|
||||
self::$_oCache = cItemCache::getInstance($sTable, $aCacheOpt);
|
||||
self::$_oCache = ItemCache::getInstance($sTable, $aCacheOpt);
|
||||
|
||||
$this->table = $sTable;
|
||||
$this->primaryKey = $sPrimaryKey;
|
||||
|
@ -159,6 +163,4 @@ abstract class cItemBaseAbstract {
|
|||
return $this->properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
|
@ -1,30 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace ConLite\GenericDb;
|
||||
|
||||
// security check
|
||||
defined('CON_FRAMEWORK') or die('Illegal call');
|
||||
|
||||
class cItemCache {
|
||||
class ItemCache
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* List of self instances (Contenido_ItemCache)
|
||||
* @var array
|
||||
*/
|
||||
protected static $_oInstances = array();
|
||||
protected static $_oInstances = [];
|
||||
|
||||
/**
|
||||
* Assoziative cache array
|
||||
* @var array
|
||||
*/
|
||||
protected $_aItemsCache = array();
|
||||
|
||||
/**
|
||||
* Table name for current instance
|
||||
* @var string
|
||||
*/
|
||||
protected $_sTable = '';
|
||||
protected $_aItemsCache = [];
|
||||
|
||||
/**
|
||||
* Max number of items to cache
|
||||
|
@ -41,18 +36,17 @@ class cItemCache {
|
|||
|
||||
/**
|
||||
* Contructor of Contenido_ItemCache
|
||||
* @param string $sTable Table name
|
||||
* @param string $_sTable Table name
|
||||
* @param array $aOptions Options array as follows:
|
||||
* - $aOptions['max_items_to_cache'] = (int) Number of items to cache
|
||||
* - $aOptions['enable'] = (bool) Flag to enable caching
|
||||
*/
|
||||
protected function __construct($sTable, array $aOptions = array()) {
|
||||
$this->_sTable = $sTable;
|
||||
protected function __construct(protected $_sTable, array $aOptions = []) {
|
||||
if (isset($aOptions['max_items_to_cache']) && (int) $aOptions['max_items_to_cache'] > 0) {
|
||||
$this->_iMaxItemsToCache = (int) $aOptions['max_items_to_cache'];
|
||||
}
|
||||
if (isset($aOptions['enable']) && is_bool($aOptions['enable'])) {
|
||||
$this->_bEnable = (bool) $aOptions['enable'];
|
||||
$this->_bEnable = $aOptions['enable'];
|
||||
}
|
||||
|
||||
if (isset($_GET['frame']) && is_numeric($_GET['frame'])) {
|
||||
|
@ -62,13 +56,6 @@ class cItemCache {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent cloning
|
||||
*/
|
||||
protected function __clone() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns item cache instance, creates it, if not done before.
|
||||
* Works as a singleton for one specific table.
|
||||
|
@ -78,7 +65,7 @@ class cItemCache {
|
|||
* - $aOptions['max_items_to_cache'] = (int) Number of items to cache
|
||||
* - $aOptions['enable'] = (bool) Flag to enable caching
|
||||
*/
|
||||
public static function getInstance($sTable, array $aOptions = array()) {
|
||||
public static function getInstance($sTable, array $aOptions = []) {
|
||||
if (!isset(self::$_oInstances[$sTable])) {
|
||||
self::$_oInstances[$sTable] = new self($sTable, $aOptions);
|
||||
}
|
||||
|
@ -96,11 +83,8 @@ class cItemCache {
|
|||
|
||||
/**
|
||||
* Returns existing entry from cache by it's id.
|
||||
*
|
||||
* @param mixed $mId
|
||||
* @return array|null
|
||||
*/
|
||||
public function getItem($mId) {
|
||||
public function getItem(mixed $mId): ?array {
|
||||
if (!$this->_bEnable) {
|
||||
return null;
|
||||
}
|
||||
|
@ -114,19 +98,15 @@ class cItemCache {
|
|||
|
||||
/**
|
||||
* Returns existing entry from cache by matching propery value.
|
||||
*
|
||||
* @param mixed $mProperty
|
||||
* @param mixed $mValue
|
||||
* @return array|null
|
||||
*/
|
||||
public function getItemByProperty($mProperty, $mValue) {
|
||||
public function getItemByProperty(mixed $mProperty, mixed $mValue): ?array {
|
||||
if (!$this->_bEnable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// loop thru all cached entries and try to find a entry by it's property
|
||||
if (is_array($this->_aItemsCache[$this->_iFrame]) && count($this->_aItemsCache[$this->_iFrame]) > 0) {
|
||||
foreach ($this->_aItemsCache[$this->_iFrame] as $id => $aEntry) {
|
||||
if (is_array($this->_aItemsCache[$this->_iFrame]) && $this->_aItemsCache[$this->_iFrame] !== []) {
|
||||
foreach ($this->_aItemsCache[$this->_iFrame] as $aEntry) {
|
||||
if (isset($aEntry[$mProperty]) && $aEntry[$mProperty] == $mValue) {
|
||||
return $aEntry;
|
||||
}
|
||||
|
@ -139,28 +119,23 @@ class cItemCache {
|
|||
* Returns existing entry from cache by matching properties and their values.
|
||||
*
|
||||
* @param array $aProperties Assoziative key value pairs
|
||||
* @return array|null
|
||||
*/
|
||||
public function getItemByProperties(array $aProperties) {
|
||||
public function getItemByProperties(array $aProperties): ?array {
|
||||
if (!$this->_bEnable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// loop thru all cached entries and try to find a entry by it's property
|
||||
foreach ($this->_aItemsCache as $id => $aEntry) {
|
||||
foreach ($this->_aItemsCache as $_aItemCache) {
|
||||
$mFound = null;
|
||||
foreach ($aProperties as $key => $value) {
|
||||
if (isset($aEntry[$key]) && $aEntry[$key] == $value) {
|
||||
if (null === $mFound) {
|
||||
$mFound = true;
|
||||
}
|
||||
if (isset($_aItemCache[$key]) && $_aItemCache[$key] == $value) {
|
||||
$mFound = true;
|
||||
} else {
|
||||
$mFound = false;
|
||||
break;
|
||||
}
|
||||
if (true === $mFound) {
|
||||
return $aEntry;
|
||||
}
|
||||
return $_aItemCache;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -169,11 +144,10 @@ class cItemCache {
|
|||
/**
|
||||
* Adds passed item data to internal cache
|
||||
*
|
||||
* @param mixed $mId
|
||||
* @param array $aData Usually the recordset
|
||||
* @return void
|
||||
*/
|
||||
public function addItem($mId, array $aData) {
|
||||
public function addItem(mixed $mId, array $aData) {
|
||||
if (!$this->_bEnable) {
|
||||
return null;
|
||||
}
|
||||
|
@ -181,7 +155,7 @@ class cItemCache {
|
|||
if (isset($this->_aItemsCache[$this->_iFrame])) {
|
||||
$aTmpItemsArray = $this->_aItemsCache[$this->_iFrame];
|
||||
|
||||
if ($this->_iMaxItemsToCache == count($aTmpItemsArray)) {
|
||||
if ($this->_iMaxItemsToCache == (is_countable($aTmpItemsArray) ? count($aTmpItemsArray) : 0)) {
|
||||
// we have reached the maximum number of cached items, remove first entry
|
||||
$firstEntryKey = array_shift($aTmpItemsArray);
|
||||
if (is_array($firstEntryKey))
|
||||
|
@ -197,10 +171,9 @@ class cItemCache {
|
|||
/**
|
||||
* Removes existing cache entry by it's key
|
||||
*
|
||||
* @param mixed $mId
|
||||
* @return void
|
||||
*/
|
||||
public function removeItem($mId) {
|
||||
public function removeItem(mixed $mId) {
|
||||
if (!$this->_bEnable) {
|
||||
return null;
|
||||
}
|
||||
|
@ -211,4 +184,4 @@ class cItemCache {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\GenericDb;
|
||||
|
||||
use Exception;
|
||||
|
||||
class ItemException extends Exception {
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Html;
|
||||
|
||||
class Html extends HtmlCommon
|
||||
{
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Html;
|
||||
|
||||
abstract class HtmlCommon implements \ArrayAccess
|
||||
{
|
||||
|
||||
protected string|array|null $attributes = null;
|
||||
|
||||
public function __construct(array|string|null $attributes = null)
|
||||
{
|
||||
$this->attributes = $attributes;
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists(mixed $offset): bool
|
||||
{
|
||||
return isset($this->attributes[strtolower($offset)]);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet(mixed $offset)
|
||||
{
|
||||
return $this->getAttribute($offset);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (null !== $offset) {
|
||||
$this->setAttribute($offset, $value);
|
||||
} else {
|
||||
$this->setAttribute($value);
|
||||
}
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
$this->removeAttribute($offset);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,306 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Log;
|
||||
|
||||
use ConLite\Exceptions\InvalidArgumentException;
|
||||
use cString;
|
||||
use ReflectionClass;
|
||||
|
||||
class Log
|
||||
{
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const EMERG = 0;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const ALERT = 1;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CRIT = 2;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const ERR = 3;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const WARN = 4;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const NOTICE = 5;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const INFO = 6;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEBUG = 7;
|
||||
|
||||
protected $writer;
|
||||
|
||||
protected $shortcutHandlers = [];
|
||||
|
||||
protected $priorities = [];
|
||||
|
||||
protected $defaultPriorities = [];
|
||||
|
||||
protected $buffer = [];
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(LogWriter $writer = null)
|
||||
{
|
||||
$createWriter = false;
|
||||
|
||||
if(!$writer) {
|
||||
$createWriter = true;
|
||||
} elseif (!is_object($writer) || !($writer instanceof LogWriter)) {
|
||||
cWarning(__FILE__, __LINE__, 'The passed class is not a subclass of ConLite LogWriter. Creating new one.');
|
||||
$createWriter = true;
|
||||
}
|
||||
|
||||
if($createWriter) {
|
||||
$options = ['destination' => \cRegistry::getConfigValue('path', 'logs') . 'conlite.log'];
|
||||
$writer = LogWriter::factory('File', $options);
|
||||
}
|
||||
|
||||
$this->setWriter($writer);
|
||||
$this->setShortcutHandler('%date', [$this, 'shDate']);
|
||||
$this->setShortcutHandler('%level', [$this, 'shLevel']);
|
||||
$this->setShortcutHandler('%message', [$this, 'shMessage']);
|
||||
|
||||
$this->getWriter()->setOption('log_format', '[%date] [%level] %message', false);
|
||||
|
||||
$reflection = new ReflectionClass($this);
|
||||
$this->priorities = $this->defaultPriorities = array_flip($reflection->getConstants());
|
||||
}
|
||||
|
||||
public function getWriter() {
|
||||
return $this->writer;
|
||||
}
|
||||
|
||||
public function setWriter(LogWriter $writer): void
|
||||
{
|
||||
$this->writer = $writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function setShortcutHandler($shortcut, $handler): bool
|
||||
{
|
||||
if ($shortcut == '') {
|
||||
throw new InvalidArgumentException('The shortcut name must not be empty.');
|
||||
}
|
||||
|
||||
if (cString::getPartOfString($shortcut, 0, 1) == '%') {
|
||||
$shortcut = cString::getPartOfString($shortcut, 1);
|
||||
}
|
||||
|
||||
if (!is_callable($handler)) {
|
||||
throw new InvalidArgumentException('The specified shortcut handler does not exist.');
|
||||
}
|
||||
|
||||
if (array_key_exists($shortcut, $this->shortcutHandlers)) {
|
||||
throw new InvalidArgumentException('The shortcut ' . $shortcut . ' is already in use!');
|
||||
}
|
||||
|
||||
$this->shortcutHandlers[$shortcut] = $handler;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function unsetShortcutHandler($shortcut)
|
||||
{
|
||||
if(!in_array($shortcut, $this->shortcutHandlers)) {
|
||||
throw new InvalidArgumentException('The specified shortcut handler does not exist.');
|
||||
}
|
||||
|
||||
unset($this->shortcutHandlers[$shortcut]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function buffer(string $message, $priority = null): void
|
||||
{
|
||||
$this->buffer[] = [$message, $priority];
|
||||
}
|
||||
|
||||
public function commit(bool $clearBuffer = true)
|
||||
{
|
||||
if (count($this->buffer) == 0) {
|
||||
cWarning(__FILE__, __LINE__, 'There are no buffered messages to commit.');
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->buffer as $bufferInfo) {
|
||||
$this->log($bufferInfo[0], $bufferInfo[1]);
|
||||
}
|
||||
|
||||
if ($clearBuffer) {
|
||||
$this->clearBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
public function clearBuffer(): void
|
||||
{
|
||||
$this->buffer = [];
|
||||
}
|
||||
|
||||
public function log(string $message, $priority = null): void
|
||||
{
|
||||
if ($priority && !is_int($priority) && in_array($priority, $this->priorities)) {
|
||||
$priority = array_search($priority, $this->priorities);
|
||||
}
|
||||
|
||||
if ($priority === null || !array_key_exists($priority, $this->priorities)) {
|
||||
$priority = $this->getWriter()->getOption('default_priority');
|
||||
}
|
||||
|
||||
$logMessage = $this->getWriter()->getOption('log_format');
|
||||
$lineEnding = $this->getWriter()->getOption('line_ending');
|
||||
|
||||
foreach ($this->shortcutHandlers as $shortcut => $handler) {
|
||||
if (cString::getPartOfString($shortcut, 0, 1) != '%') {
|
||||
$shortcut = '%' . $shortcut;
|
||||
}
|
||||
|
||||
$info = [
|
||||
'message' => $message,
|
||||
'priority' => $priority
|
||||
];
|
||||
|
||||
$value = call_user_func($handler, $info);
|
||||
|
||||
$logMessage = str_replace($shortcut, $value, $logMessage);
|
||||
}
|
||||
|
||||
$this->getWriter()->write($logMessage . $lineEnding, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function addPriority(string $name, int $value): void
|
||||
{
|
||||
if ($name == '') {
|
||||
throw new InvalidArgumentException('Priority name must not be empty.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->priorities)) {
|
||||
throw new InvalidArgumentException('The given priority name already exists.');
|
||||
}
|
||||
|
||||
if (array_key_exists($value, $this->priorities)) {
|
||||
throw new InvalidArgumentException('The priority value already exists.');
|
||||
}
|
||||
|
||||
$this->priorities[$value] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function removePriority(string $name): void
|
||||
{
|
||||
if ($name == '') {
|
||||
throw new InvalidArgumentException('Priority name must not be empty.');
|
||||
}
|
||||
|
||||
if (!in_array($name, $this->priorities)) {
|
||||
throw new InvalidArgumentException('Priority name does not exist.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->defaultPriorities)) {
|
||||
throw new InvalidArgumentException('Removing default priorities is not allowed.');
|
||||
}
|
||||
|
||||
$priorityIndex = array_search($name, $this->priorities);
|
||||
|
||||
unset($this->priorities[$priorityIndex]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __call(string $method, array $arguments) {
|
||||
$priorityName = cString::toUpperCase($method);
|
||||
|
||||
if (!in_array($priorityName, $this->priorities)) {
|
||||
throw new InvalidArgumentException('The given priority ' . $priorityName . ' is not supported.');
|
||||
}
|
||||
|
||||
$priorityIndex = array_search($priorityName, $this->priorities);
|
||||
|
||||
$this->log($arguments[0], $priorityIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Date.
|
||||
* Returns the current date.
|
||||
*
|
||||
* @return string
|
||||
* The current date
|
||||
*/
|
||||
public function shDate(): string
|
||||
{
|
||||
return date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Level.
|
||||
* Returns the canonical name of the priority.
|
||||
* The canonical name is padded to 10 characters to achieve a better
|
||||
* formatting.
|
||||
*
|
||||
* @param array $info
|
||||
* @return string
|
||||
* The canonical log level
|
||||
*/
|
||||
public function shLevel(array $info): string
|
||||
{
|
||||
$logLevel = $info['priority'];
|
||||
return str_pad($this->priorities[$logLevel], 10, ' ', STR_PAD_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Message.
|
||||
* Returns the log message.
|
||||
*
|
||||
* @param array $info
|
||||
* @return string
|
||||
* The log message
|
||||
*/
|
||||
public function shMessage(array $info): string
|
||||
{
|
||||
return $info['message'];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Log;
|
||||
|
||||
use ConLite\Exceptions\InvalidArgumentException;
|
||||
|
||||
abstract class LogWriter
|
||||
{
|
||||
/**
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(
|
||||
protected array $options = []
|
||||
)
|
||||
{
|
||||
$this->setOptions($options);
|
||||
|
||||
$this->setOption('default_priority', Log::INFO, false);
|
||||
$this->setOption('line_ending', PHP_EOL, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws invalidArgumentException
|
||||
*/
|
||||
public static function factory($writerName, array $writerOptions): LogWriter
|
||||
{
|
||||
$logWriterClassName = __NAMESPACE__ . '\\LogWriter' . ucfirst($writerName);
|
||||
if(!class_exists($logWriterClassName)) {
|
||||
throw new InvalidArgumentException('Unknown ConLite LogWriter class: ' . $logWriterClassName);
|
||||
}
|
||||
|
||||
$writer = new $logWriterClassName($writerOptions);
|
||||
if(!($writer instanceof LogWriter)) {
|
||||
throw new InvalidArgumentException('Provided class is not an instance of ConLite LogWriter');
|
||||
}
|
||||
|
||||
return $writer;
|
||||
}
|
||||
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
public function getOption($option) {
|
||||
return $this->options[$option];
|
||||
}
|
||||
|
||||
public function setOptions(array $options): void
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
public function setOption($option, $value, $force = false) {
|
||||
if (!$force && isset($this->options[$option])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->options[$option] = $value;
|
||||
}
|
||||
public function removeOption($option) {
|
||||
unset($this->options[$option]);
|
||||
}
|
||||
|
||||
abstract function write($message, $priority);
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Log;
|
||||
|
||||
use ConLite\Exceptions\Exception;
|
||||
use ConLite\Exceptions\FileNotFoundException;
|
||||
use DirectoryIterator;
|
||||
|
||||
class LogWriterFile extends LogWriter
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $handle = NULL;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected int $maxLogFileSize = 1024;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected int $maxRotationFiles = 10;
|
||||
|
||||
|
||||
/**
|
||||
* @throws FileNotFoundException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(array $options = []) {
|
||||
|
||||
parent::__construct($options);
|
||||
|
||||
$logFileSize = (int) getEffectiveSetting('log', 'writer-file-size-' . basename($this->getOption('destination')), $this->getOption('logFileSize') ?? 0);
|
||||
|
||||
if($logFileSize > 0) {
|
||||
$this->maxLogFileSize = $logFileSize;
|
||||
}
|
||||
|
||||
$this->createHandle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param int $priority
|
||||
* @return bool
|
||||
*/
|
||||
public function write($message, $priority): bool
|
||||
{
|
||||
$this->rotateLog();
|
||||
return fwrite($this->handle, $message) != false;
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->closeHandle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
protected function createHandle(): void
|
||||
{
|
||||
$destination = $this->getOption('destination');
|
||||
if ($destination == '') {
|
||||
throw new Exception('No destination was specified.');
|
||||
}
|
||||
|
||||
if (($this->handle = fopen($destination, 'a')) === false) {
|
||||
throw new FileNotFoundException('Destination handle could not be created.');
|
||||
}
|
||||
}
|
||||
|
||||
protected function closeHandle(): void
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
protected function rotateLog()
|
||||
{
|
||||
$logfile = $this->getOption('destination');
|
||||
|
||||
if(!file_exists($logfile)) {
|
||||
cWarning(__FILE__, __LINE__, 'Logfile ' . $logfile . ' not found.');
|
||||
return false;
|
||||
} elseif (!is_readable($logfile)) {
|
||||
cWarning(__FILE__, __LINE__, 'Logfile ' . $logfile . ' not readable.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (filesize($logfile) >= $this->maxLogFileSize * 1024) {
|
||||
$pathInfo = pathinfo($logfile);
|
||||
$baseDirectory = $pathInfo['dirname'];
|
||||
$baseName = $pathInfo['basename'];
|
||||
$numMap = [];
|
||||
|
||||
foreach (new DirectoryIterator($baseDirectory) as $fileInfo) {
|
||||
if ($fileInfo->isDot() || !$fileInfo->isFile()) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/^' . $baseName . '\.?([0-9]*)$/', $fileInfo->getFilename(), $matches)) {
|
||||
$num = $matches[1];
|
||||
$file2move = $fileInfo->getFilename();
|
||||
if ($num == '') {
|
||||
$num = 0;
|
||||
}
|
||||
$numMap[$num] = $file2move;
|
||||
}
|
||||
}
|
||||
krsort($numMap);
|
||||
foreach ($numMap as $num => $file2move) {
|
||||
$targetN = $num + 1;
|
||||
if($targetN > $this->maxRotationFiles) {
|
||||
unlink($baseDirectory . DIRECTORY_SEPARATOR . $file2move);
|
||||
continue;
|
||||
}
|
||||
rename($baseDirectory . DIRECTORY_SEPARATOR . $file2move, $baseDirectory . DIRECTORY_SEPARATOR .$baseName . '.' . $targetN);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getMaxLogFileSize(): int
|
||||
{
|
||||
return $this->maxLogFileSize;
|
||||
}
|
||||
|
||||
public function setMaxLogFileSize(int $maxLogFileSize): void
|
||||
{
|
||||
$this->maxLogFileSize = $maxLogFileSize;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Log;
|
||||
|
||||
class ModuleLog extends Log
|
||||
{
|
||||
|
||||
}
|
|
@ -36,7 +36,7 @@ class cApiUploadCollection extends ItemCollection {
|
|||
public function sync($dir, $file) {
|
||||
global $client;
|
||||
|
||||
if (strstr(strtolower($_ENV["OS"]), 'windows') === FALSE) {
|
||||
if (!empty($_ENV["OS"]) && strstr(strtolower($_ENV["OS"]), 'windows') === FALSE) {
|
||||
#Unix style OS distinguish between lower and uppercase file names, i.e. test.gif is not the same as Test.gif
|
||||
$this->select("dirname = BINARY '$dir' AND filename = BINARY '$file' AND idclient = '$client'");
|
||||
} else {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Description:
|
||||
* Base Class for all cHTML Elements
|
||||
*
|
||||
*
|
||||
* @category ConLite
|
||||
* @package Core
|
||||
* @subpackage cHTML
|
||||
|
@ -17,13 +17,10 @@
|
|||
* @link http://www.conlite.org ConLite.org
|
||||
*/
|
||||
|
||||
|
||||
// security check
|
||||
defined('CON_FRAMEWORK') or die('Illegal call');
|
||||
|
||||
if (!class_exists("HTML_Common2")) {
|
||||
cInclude("pear", "HTML/Common2.php");
|
||||
}
|
||||
|
||||
/* Global ID counter */
|
||||
$cHTMLIDCount = 0;
|
||||
|
||||
|
@ -32,11 +29,12 @@ $cHTMLIDCount = 0;
|
|||
*
|
||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
||||
*/
|
||||
class cHTML extends HTML_Common2 {
|
||||
|
||||
class cHTML extends cHTML5Common
|
||||
{
|
||||
|
||||
/**
|
||||
* Storage of the open SGML tag template
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
protected $_skeleton_open;
|
||||
|
||||
|
@ -60,15 +58,15 @@ class cHTML extends HTML_Common2 {
|
|||
|
||||
/**
|
||||
* Defines the style definitions
|
||||
* @var string
|
||||
* @var array
|
||||
*/
|
||||
protected $_styledefs;
|
||||
protected $_styledefs = [];
|
||||
|
||||
/**
|
||||
* Defines all scripts which are required by the current element
|
||||
* @var array
|
||||
*/
|
||||
protected $_requiredScripts;
|
||||
protected $_requiredScripts = [];
|
||||
|
||||
/**
|
||||
* @var boolean Defines if the current tag is a contentless tag
|
||||
|
@ -78,31 +76,32 @@ class cHTML extends HTML_Common2 {
|
|||
/**
|
||||
* @var array Defines which JS events contain which scripts
|
||||
*/
|
||||
protected $_aEventDefinitions;
|
||||
protected $_aEventDefinitions = [];
|
||||
|
||||
/**
|
||||
* @var array Style definitions
|
||||
*/
|
||||
protected $_aStyleDefinitions;
|
||||
* @var array Style definitions
|
||||
*/
|
||||
protected $_aStyleDefinitions = [];
|
||||
|
||||
/**
|
||||
* @var string The content itself
|
||||
*/
|
||||
* @var string The content itself
|
||||
*/
|
||||
protected $_content;
|
||||
|
||||
|
||||
protected $_aCfg;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* Initializes the SGML open/close tags
|
||||
*
|
||||
* @param none
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
global $cfg;
|
||||
$this->_aCfg = $cfg;
|
||||
|
||||
* Constructor Function
|
||||
* Initializes the SGML open/close tags
|
||||
*
|
||||
* @param none
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->_aCfg = cRegistry::getConfig();
|
||||
|
||||
parent::__construct();
|
||||
$this->_skeleton_open = '<%s%s>';
|
||||
$this->_skeleton_close = '</%s>';
|
||||
|
@ -111,50 +110,52 @@ class cHTML extends HTML_Common2 {
|
|||
/* Cache the XHTML setting for performance reasons */
|
||||
if (!is_array($this->_aCfg) || !array_key_exists("generate_xhtml", $this->_aCfg)) {
|
||||
if (function_exists("getEffectiveSetting")) {
|
||||
$bXhtml = (getEffectiveSetting("generator", "xhtml") == 'true'
|
||||
|| getEffectiveSetting("generator", "xhtml") === TRUE)?true:false;
|
||||
$bXhtml = (getEffectiveSetting("generator", "xhtml") == 'true'
|
||||
|| getEffectiveSetting("generator", "xhtml") === TRUE) ? true : false;
|
||||
$this->_aCfg["generate_xhtml"] = $bXhtml;
|
||||
} else {
|
||||
$this->_aCfg["generate_xhtml"] = false;
|
||||
$this->_aCfg["generate_xhtml"] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if($this->_aCfg["generate_xhtml"] === true) {
|
||||
if ($this->_aCfg["generate_xhtml"] === true) {
|
||||
$this->_skeleton_single = '<%s%s />';
|
||||
} else {
|
||||
$this->_skeleton_single = '<%s%s>';
|
||||
}
|
||||
|
||||
$this->_styledefs = array ();
|
||||
$this->_aStyleDefinitions = array();
|
||||
$this->_styledefs = [];
|
||||
$this->_aStyleDefinitions = [];
|
||||
$this->setContentlessTag();
|
||||
|
||||
$this->advanceID();
|
||||
$this->_requiredScripts = array ();
|
||||
$this->_aEventDefinitions = array ();
|
||||
$this->_requiredScripts = [];
|
||||
$this->_aEventDefinitions = [];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $contentlessTag
|
||||
* @param type $contentlessTag
|
||||
*/
|
||||
public function setContentlessTag($contentlessTag = true) {
|
||||
public function setContentlessTag($contentlessTag = true)
|
||||
{
|
||||
$this->_contentlessTag = $contentlessTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* advances to the next ID available in the system.
|
||||
*
|
||||
*
|
||||
* This function is useful if you need to use HTML elements
|
||||
* in a loop, but don't want to re-create new objects each time.
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function advanceID() {
|
||||
public function advanceID()
|
||||
{
|
||||
global $cHTMLIDCount;
|
||||
|
||||
$cHTMLIDCount ++;
|
||||
$this->updateAttributes(array ("id" => "m".$cHTMLIDCount));
|
||||
$cHTMLIDCount++;
|
||||
$this->updateAttributes(array("id" => "m" . $cHTMLIDCount));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,24 +163,26 @@ class cHTML extends HTML_Common2 {
|
|||
*
|
||||
* @return string current ID
|
||||
*/
|
||||
public function getID() {
|
||||
public function getID()
|
||||
{
|
||||
return $this->getAttribute("id");
|
||||
}
|
||||
|
||||
/**
|
||||
* setAlt: sets the alt and title attributes
|
||||
*
|
||||
* Sets the "alt" and "title" tags. Usually, "alt" is used
|
||||
* Sets the "alt" and "title" tags. Usually, "alt" is used
|
||||
* for accessibility and "title" for mouse overs.
|
||||
*
|
||||
*
|
||||
* To set the text for all browsers for mouse over, set "alt"
|
||||
* and "title". IE behaves incorrectly and shows "alt" on
|
||||
* and "title". IE behaves incorrectly and shows "alt" on
|
||||
* mouse over. Mozilla browsers only show "title" as mouse over.
|
||||
*
|
||||
* @param string $alt Text to set as the "alt" attribute
|
||||
*/
|
||||
public function setAlt($alt) {
|
||||
$attributes = array ("alt" => $alt, "title" => $alt);
|
||||
public function setAlt($alt)
|
||||
{
|
||||
$attributes = array("alt" => $alt, "title" => $alt);
|
||||
$this->updateAttributes($attributes);
|
||||
}
|
||||
|
||||
|
@ -188,8 +191,9 @@ class cHTML extends HTML_Common2 {
|
|||
*
|
||||
* @param string $class Text to set as the "id"
|
||||
*/
|
||||
public function setID($id) {
|
||||
$this->updateAttributes(array ("id" => $id));
|
||||
public function setID($id)
|
||||
{
|
||||
$this->updateAttributes(array("id" => $id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,8 +201,9 @@ class cHTML extends HTML_Common2 {
|
|||
*
|
||||
* @param string $class Text to set as the "class" attribute
|
||||
*/
|
||||
public function setClass($class) {
|
||||
$this->updateAttributes(array ("class" => $class));
|
||||
public function setClass($class)
|
||||
{
|
||||
$this->updateAttributes(array("class" => $class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -206,8 +211,9 @@ class cHTML extends HTML_Common2 {
|
|||
*
|
||||
* @param $class string Text to set as the "style" attribute
|
||||
*/
|
||||
public function setStyle($style) {
|
||||
$this->updateAttributes(array ("style" => $style));
|
||||
public function setStyle($style)
|
||||
{
|
||||
$this->updateAttributes(array("style" => $style));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,11 +225,12 @@ class cHTML extends HTML_Common2 {
|
|||
* @param $event string Type of the event
|
||||
* @param $action string Function or action to call (JavaScript Code)
|
||||
*/
|
||||
public function setEvent($event, $action) {
|
||||
public function setEvent($event, $action)
|
||||
{
|
||||
if (substr($event, 0, 2) != "on") {
|
||||
$this->updateAttributes(array ("on".$event => $action));
|
||||
$this->updateAttributes(array("on" . $event => $action));
|
||||
} else {
|
||||
$this->updateAttributes(array ($event => $action));
|
||||
$this->updateAttributes(array($event => $action));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,9 +242,10 @@ class cHTML extends HTML_Common2 {
|
|||
*
|
||||
* @param $event string Type of the event
|
||||
*/
|
||||
public function unsetEvent($event) {
|
||||
public function unsetEvent($event)
|
||||
{
|
||||
if (substr($event, 0, 2) != "on") {
|
||||
$this->removeAttribute("on".$event);
|
||||
$this->removeAttribute("on" . $event);
|
||||
} else {
|
||||
$this->removeAttribute($event);
|
||||
}
|
||||
|
@ -245,7 +253,7 @@ class cHTML extends HTML_Common2 {
|
|||
|
||||
/**
|
||||
* fillSkeleton: Fills the open SGML tag skeleton
|
||||
*
|
||||
*
|
||||
* fillSkeleton fills the SGML opener tag with the
|
||||
* specified attributes. Attributes need to be passed
|
||||
* in the stringyfied variant.
|
||||
|
@ -253,11 +261,12 @@ class cHTML extends HTML_Common2 {
|
|||
* @param $attributes string Attributes to set
|
||||
* @return string filled SGML opener skeleton
|
||||
*/
|
||||
public function fillSkeleton($attributes) {
|
||||
public function fillSkeleton($attributes)
|
||||
{
|
||||
if ($this->_contentlessTag == true) {
|
||||
return sprintf($this->_skeleton_single, $this->_tag, $attributes);
|
||||
} else {
|
||||
return sprintf($this->_skeleton_open, $this->_tag, $attributes);
|
||||
return is_null($this->_skeleton_open) ? '' : sprintf($this->_skeleton_open, $this->_tag, $attributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,63 +276,68 @@ class cHTML extends HTML_Common2 {
|
|||
* @param none
|
||||
* @return string filled SGML closer skeleton
|
||||
*/
|
||||
public function fillCloseSkeleton() {
|
||||
return sprintf($this->_skeleton_close, $this->_tag);
|
||||
public function fillCloseSkeleton()
|
||||
{
|
||||
return is_null($this->_skeleton_close) ? '' : sprintf($this->_skeleton_close, $this->_tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* addStyleDefinition
|
||||
*
|
||||
* @deprecated name change, use attachStyleDefinition
|
||||
* @param $entity string Entity to define
|
||||
* @param $definition string Definition for the given entity
|
||||
* @param $definition string Definition for the given entity
|
||||
* @return string filled SGML closing skeleton
|
||||
* @deprecated name change, use attachStyleDefinition
|
||||
*/
|
||||
public function setStyleDefinition($entity, $definition) {
|
||||
public function setStyleDefinition($entity, $definition)
|
||||
{
|
||||
$this->_styledefs[$entity] = $definition;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* attachStyleDefinition: Attaches a style definition.
|
||||
*
|
||||
*
|
||||
* This function is not restricted to a single style, e.g.
|
||||
* you can set multiple style definitions as-is to the handler.
|
||||
*
|
||||
*
|
||||
* $example->attachStyle("myIdentifier",
|
||||
* "border: 1px solid black; white-space: nowrap");
|
||||
* "border: 1px solid black; white-space: nowrap");
|
||||
* $example->attachStyle("myIdentifier2",
|
||||
* "padding: 0px");
|
||||
*
|
||||
* "padding: 0px");
|
||||
*
|
||||
* Results in:
|
||||
*
|
||||
*
|
||||
* style="border: 1px solid black; white-space: nowrap; padding: 0px;"
|
||||
*
|
||||
* @param $sName string Name for a style definition
|
||||
* @param $sDefinition string Definition for the given entity
|
||||
* @param $sName string Name for a style definition
|
||||
* @param $sDefinition string Definition for the given entity
|
||||
* @return string filled SGML closing skeleton
|
||||
*/
|
||||
public function attachStyleDefinition($sName, $sDefinition) {
|
||||
public function attachStyleDefinition($sName, $sDefinition)
|
||||
{
|
||||
$this->_aStyleDefinitions[$sName] = $sDefinition;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param string $script
|
||||
*/
|
||||
public function addRequiredScript($script) {
|
||||
public function addRequiredScript($script)
|
||||
{
|
||||
if (!is_array($this->_requiredScripts)) {
|
||||
$this->_requiredScripts = array ();
|
||||
$this->_requiredScripts = [];
|
||||
}
|
||||
$this->_requiredScripts[] = $script;
|
||||
$this->_requiredScripts = array_unique($this->_requiredScripts);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param array $aAttributes
|
||||
* @return array
|
||||
*/
|
||||
public function updateAttributes($aAttributes) {
|
||||
public function updateAttributes($aAttributes)
|
||||
{
|
||||
return $this->mergeAttributes($aAttributes);
|
||||
}
|
||||
|
||||
|
@ -333,20 +347,21 @@ class cHTML extends HTML_Common2 {
|
|||
* @param $content string/object String with the content or an object to render.
|
||||
*
|
||||
*/
|
||||
public function _setContent($content) {
|
||||
public function _setContent($content)
|
||||
{
|
||||
$this->setContentlessTag(false);
|
||||
/* Is it an array? */
|
||||
if(is_array($content)) {
|
||||
if (is_array($content)) {
|
||||
unset ($this->_content);
|
||||
$this->_content = "";
|
||||
|
||||
foreach($content as $item) {
|
||||
if(is_object($item)) {
|
||||
if(method_exists($item, "render")) {
|
||||
|
||||
foreach ($content as $item) {
|
||||
if (is_object($item)) {
|
||||
if (method_exists($item, "render")) {
|
||||
$this->_content .= $item->render();
|
||||
}
|
||||
|
||||
if(count($item->_requiredScripts) > 0) {
|
||||
|
||||
if (count($item->_requiredScripts) > 0) {
|
||||
$this->_requiredScripts = array_merge($this->_requiredScripts, $item->_requiredScripts);
|
||||
}
|
||||
} else {
|
||||
|
@ -354,12 +369,12 @@ class cHTML extends HTML_Common2 {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if(is_object($content)) {
|
||||
if(method_exists($content, "render")) {
|
||||
if (is_object($content)) {
|
||||
if (method_exists($content, "render")) {
|
||||
$this->_content = $content->render();
|
||||
}
|
||||
|
||||
if(count($content->_requiredScripts) > 0) {
|
||||
|
||||
if (is_countable($content->_requiredScripts) && count($content->_requiredScripts) > 0) {
|
||||
$this->_requiredScripts = array_merge($this->_requiredScripts, $content->_requiredScripts);
|
||||
}
|
||||
return;
|
||||
|
@ -371,92 +386,95 @@ class cHTML extends HTML_Common2 {
|
|||
|
||||
/**
|
||||
* attachEventDefinition: Attaches the code for an event
|
||||
*
|
||||
*
|
||||
* Example to attach an onClick handler:
|
||||
* setEventDefinition("foo", "onClick", "alert('foo');");
|
||||
*
|
||||
*
|
||||
* @param $sName string defines the name of the event
|
||||
* @param $sEvent string defines the event (e.g. onClick)
|
||||
* @param $sCode string defines the code
|
||||
*/
|
||||
public function attachEventDefinition($sName, $sEvent, $sCode) {
|
||||
public function attachEventDefinition($sName, $sEvent, $sCode)
|
||||
{
|
||||
$this->_aEventDefinitions[strtolower($sEvent)][$sName] = $sCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* setAttribte: Sets a specific attribute
|
||||
*
|
||||
*
|
||||
* @param $sAttributeName string Name of the attribute
|
||||
* @param $sValue string Value of the attribute
|
||||
*/
|
||||
public function setAttribute($sAttributeName, $sValue = NULL) {
|
||||
public function setAttribute($sAttributeName, $sValue = NULL)
|
||||
{
|
||||
$sAttributeName = strtolower($sAttributeName);
|
||||
if (is_null($sValue)) {
|
||||
$sValue = $sAttributeName;
|
||||
}
|
||||
$this->updateAttributes(array ($sAttributeName => $sValue));
|
||||
$this->updateAttributes(array($sAttributeName => $sValue));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toHtml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the output
|
||||
* If the tag
|
||||
*/
|
||||
public function toHTML() {
|
||||
/* Fill style definition */
|
||||
$style = $this->getAttribute("style");
|
||||
|
||||
/* If the style doesn't end with a semicolon, append one */
|
||||
if(is_string($style)) {
|
||||
$style = trim($style);
|
||||
|
||||
if (substr($style, strlen($style) - 1) != ";") {
|
||||
$style .= ";";
|
||||
}
|
||||
}
|
||||
|
||||
foreach($this->_aStyleDefinitions as $sEntry) {
|
||||
$style .= $sEntry;
|
||||
|
||||
if (substr($style, strlen($style) - 1) != ";") {
|
||||
$style .= ";";
|
||||
}
|
||||
}
|
||||
|
||||
foreach($this->_aEventDefinitions as $sEventName => $sEntry) {
|
||||
$aFullCode = array();
|
||||
|
||||
foreach ($sEntry as $sName => $sCode) {
|
||||
$aFullCode[] = $sCode;
|
||||
}
|
||||
$this->setAttribute($sEventName, $this->getAttribute($sEventName).implode(" ", $aFullCode));
|
||||
}
|
||||
|
||||
/* Apply all stored styles */
|
||||
foreach ($this->_styledefs as $key => $value) {
|
||||
$style .= "$key: $value;";
|
||||
}
|
||||
|
||||
if ($style != "") {
|
||||
$this->setStyle($style);
|
||||
}
|
||||
|
||||
if ($this->_content != "" || $this->_contentlessTag == false) {
|
||||
$attributes = $this->getAttributes(true);
|
||||
return $this->fillSkeleton($attributes).$this->_content.$this->fillCloseSkeleton();
|
||||
} else {
|
||||
/* This is a single style tag */
|
||||
$attributes = $this->getAttributes(true);
|
||||
return $this->fillSkeleton($attributes);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Renders the output
|
||||
* If the tag
|
||||
*/
|
||||
public function toHTML()
|
||||
{
|
||||
/* Fill style definition */
|
||||
$style = $this->getAttribute("style");
|
||||
|
||||
/* If the style doesn't end with a semicolon, append one */
|
||||
if (!empty($style) && is_string($style)) {
|
||||
$style = trim($style);
|
||||
|
||||
if (substr($style, strlen($style) - 1) != ";") {
|
||||
$style .= ";";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->_aStyleDefinitions as $sKey => $sEntry) {
|
||||
$style .= $sKey . ': ' . $sEntry;
|
||||
|
||||
if (substr($style, strlen($style) - 1) != ";") {
|
||||
$style .= ";";
|
||||
}
|
||||
}
|
||||
/* Apply all stored styles */
|
||||
foreach ($this->_styledefs as $key => $value) {
|
||||
$style .= "$key: $value;";
|
||||
}
|
||||
|
||||
if ($style != "") {
|
||||
$this->setStyle($style);
|
||||
}
|
||||
|
||||
foreach ($this->_aEventDefinitions as $sEventName => $sEntry) {
|
||||
$aFullCode = [];
|
||||
|
||||
foreach ($sEntry as $sName => $sCode) {
|
||||
$aFullCode[] = $sCode;
|
||||
}
|
||||
$this->setAttribute($sEventName, $this->getAttribute($sEventName) . implode(" ", $aFullCode));
|
||||
}
|
||||
|
||||
if ($this->_content != "" || $this->_contentlessTag == false) {
|
||||
$attributes = $this->getAttributes(true);
|
||||
return $this->fillSkeleton($attributes) . $this->_content . $this->fillCloseSkeleton();
|
||||
} else {
|
||||
/* This is a single style tag */
|
||||
$attributes = $this->getAttributes(true);
|
||||
return $this->fillSkeleton($attributes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* render(): Alias for toHtml
|
||||
|
@ -464,8 +482,8 @@ class cHTML extends HTML_Common2 {
|
|||
* @param none
|
||||
* @return string Rendered HTML
|
||||
*/
|
||||
public function render() {
|
||||
public function render()
|
||||
{
|
||||
return $this->toHtml();
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -0,0 +1,584 @@
|
|||
<?php
|
||||
/**
|
||||
* @category ConLite
|
||||
* @package Core
|
||||
* @subpackage cHTML5
|
||||
* @since 2.2
|
||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
||||
* @copyright (c) 2022, conlite.org
|
||||
* @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version)
|
||||
* @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version)
|
||||
* @link http://www.conlite.org ConLite.org
|
||||
*/
|
||||
|
||||
/*
|
||||
* HTML_Common2: port of HTML_Common package to PHP5
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2004-2012, Alexey Borzov <avb@php.net>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_Common2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/package/HTML_Common2
|
||||
*/
|
||||
|
||||
/*
|
||||
* Base class for HTML classes
|
||||
*
|
||||
* Implements methods for working with HTML attributes, parsing and generating
|
||||
* attribute strings. Port of HTML_Common class for PHP4 originally written by
|
||||
* Adam Daniel with contributions from numerous other developers.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_Common2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version Release: 2.1.0
|
||||
* @link http://pear.php.net/package/HTML_Common2
|
||||
*/
|
||||
abstract class cHTML5Common implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
* Associative array of attributes
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = array();
|
||||
|
||||
/**
|
||||
* Changes to attributes in this list will be announced via onAttributeChange()
|
||||
* method rather than performed by HTML_Common2 class itself
|
||||
* @var array
|
||||
* @see onAttributeChange()
|
||||
*/
|
||||
protected $watchedAttributes = array();
|
||||
|
||||
/**
|
||||
* Indentation level of the element
|
||||
* @var int
|
||||
*/
|
||||
private $_indentLevel = 0;
|
||||
|
||||
/**
|
||||
* Comment associated with the element
|
||||
* @var string
|
||||
*/
|
||||
private $_comment = null;
|
||||
|
||||
/**
|
||||
* Global options for all elements generated by subclasses of HTML_Common2
|
||||
*
|
||||
* Preset options are
|
||||
* - 'charset': charset parameter used in htmlspecialchars() calls,
|
||||
* defaults to 'ISO-8859-1'
|
||||
* - 'indent': string used to indent HTML elements, defaults to "\11"
|
||||
* - 'linebreak': string used to indicate linebreak, defaults to "\12"
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_options = array(
|
||||
'charset' => 'ISO-8859-1',
|
||||
'indent' => "\11",
|
||||
'linebreak' => "\12"
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets global option(s)
|
||||
*
|
||||
* @param string|array $nameOrOptions Option name or array ('option name' => 'option value')
|
||||
* @param mixed $value Option value, if first argument is not an array
|
||||
*/
|
||||
public static function setOption($nameOrOptions, $value = null)
|
||||
{
|
||||
if (is_array($nameOrOptions)) {
|
||||
foreach ($nameOrOptions as $k => $v) {
|
||||
self::setOption($k, $v);
|
||||
}
|
||||
} else {
|
||||
$linebreaks = array('win' => "\15\12", 'unix' => "\12", 'mac' => "\15");
|
||||
if ('linebreak' == $nameOrOptions && isset($linebreaks[$value])) {
|
||||
$value = $linebreaks[$value];
|
||||
}
|
||||
self::$_options[$nameOrOptions] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns global option(s)
|
||||
*
|
||||
* @param string $name Option name
|
||||
*
|
||||
* @return mixed Option value, null if option does not exist,
|
||||
* array of all options if $name is not given
|
||||
*/
|
||||
public static function getOption($name = null)
|
||||
{
|
||||
if (null === $name) {
|
||||
return self::$_options;
|
||||
} else {
|
||||
return isset(self::$_options[$name])? self::$_options[$name]: null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the HTML attributes given as string
|
||||
*
|
||||
* @param string $attrString HTML attribute string
|
||||
*
|
||||
* @return array An associative array of attributes
|
||||
*/
|
||||
protected static function parseAttributes($attrString)
|
||||
{
|
||||
$attributes = array();
|
||||
if (preg_match_all(
|
||||
"/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" .
|
||||
"([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/",
|
||||
$attrString,
|
||||
$regs
|
||||
)) {
|
||||
for ($i = 0; $i < count($regs[1]); $i++) {
|
||||
$name = trim($regs[1][$i]);
|
||||
$check = trim($regs[0][$i]);
|
||||
$value = trim($regs[7][$i]);
|
||||
if ($name == $check) {
|
||||
$attributes[strtolower($name)] = strtolower($name);
|
||||
} else {
|
||||
if (!empty($value) && ($value[0] == '\'' || $value[0] == '"')) {
|
||||
$value = substr($value, 1, -1);
|
||||
}
|
||||
$attributes[strtolower($name)] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a valid attribute array from either a string or an array
|
||||
*
|
||||
* @param string|array $attributes Array of attributes or HTML attribute string
|
||||
*
|
||||
* @return array An associative array of attributes
|
||||
*/
|
||||
protected static function prepareAttributes($attributes)
|
||||
{
|
||||
$prepared = array();
|
||||
if (is_string($attributes)) {
|
||||
return self::parseAttributes($attributes);
|
||||
|
||||
} elseif (is_array($attributes)) {
|
||||
foreach ($attributes as $key => $value) {
|
||||
if (is_int($key)) {
|
||||
$key = strtolower($value);
|
||||
$prepared[$key] = $key;
|
||||
} else {
|
||||
$prepared[strtolower($key)] = (string)$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $prepared;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an attribute from an attribute array
|
||||
*
|
||||
* @param array &$attributes Attribute array
|
||||
* @param string $name Name of attribute to remove
|
||||
*/
|
||||
protected static function removeAttributeArray(array &$attributes, $name)
|
||||
{
|
||||
unset($attributes[strtolower($name)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates HTML attribute string from array
|
||||
*
|
||||
* @param array $attributes Attribute array
|
||||
*
|
||||
* @return string Attribute string
|
||||
*/
|
||||
protected static function getAttributesString(array $attributes)
|
||||
{
|
||||
$str = '';
|
||||
$charset = self::getOption('charset');
|
||||
foreach ($attributes as $key => $value) {
|
||||
$str .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES, $charset) . '"';
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class constructor, sets default attributes
|
||||
*
|
||||
* @param array|string $attributes Array of attribute 'name' => 'value' pairs
|
||||
* or HTML attribute string
|
||||
*/
|
||||
public function __construct($attributes = null)
|
||||
{
|
||||
$this->mergeAttributes($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the attribute
|
||||
*
|
||||
* @param string $name Attribute name
|
||||
* @param string $value Attribute value (will be set to $name if omitted)
|
||||
*
|
||||
* @return HTML_Common2
|
||||
*/
|
||||
public function setAttribute($name, $value = null)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
if (is_null($value)) {
|
||||
$value = $name;
|
||||
}
|
||||
if (in_array($name, $this->watchedAttributes)) {
|
||||
$this->onAttributeChange($name, $value);
|
||||
} else {
|
||||
$this->attributes[$name] = (string)$value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of an attribute
|
||||
*
|
||||
* @param string $name Attribute name
|
||||
*
|
||||
* @return string|null Attribute value, null if attribute does not exist
|
||||
*/
|
||||
public function getAttribute($name)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
return isset($this->attributes[$name])? $this->attributes[$name]: '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the attributes
|
||||
*
|
||||
* @param string|array $attributes Array of attribute 'name' => 'value' pairs
|
||||
* or HTML attribute string
|
||||
*
|
||||
* @return HTML_Common2
|
||||
*/
|
||||
public function setAttributes($attributes)
|
||||
{
|
||||
$attributes = self::prepareAttributes($attributes);
|
||||
$watched = array();
|
||||
foreach ($this->watchedAttributes as $watchedKey) {
|
||||
if (isset($attributes[$watchedKey])) {
|
||||
$this->setAttribute($watchedKey, $attributes[$watchedKey]);
|
||||
unset($attributes[$watchedKey]);
|
||||
} else {
|
||||
$this->removeAttribute($watchedKey);
|
||||
}
|
||||
if (isset($this->attributes[$watchedKey])) {
|
||||
$watched[$watchedKey] = $this->attributes[$watchedKey];
|
||||
}
|
||||
}
|
||||
$this->attributes = array_merge($watched, $attributes);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the attribute array or string
|
||||
*
|
||||
* @param bool $asString Whether to return attributes as string
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function getAttributes($asString = false)
|
||||
{
|
||||
if ($asString) {
|
||||
return self::getAttributesString($this->attributes);
|
||||
} else {
|
||||
return $this->attributes;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges the existing attributes with the new ones
|
||||
*
|
||||
* @param array|string $attributes Array of attribute 'name' => 'value' pairs
|
||||
* or HTML attribute string
|
||||
*
|
||||
* @return HTML_Common2
|
||||
*/
|
||||
public function mergeAttributes($attributes)
|
||||
{
|
||||
$attributes = self::prepareAttributes($attributes);
|
||||
foreach ($this->watchedAttributes as $watchedKey) {
|
||||
if (isset($attributes[$watchedKey])) {
|
||||
$this->onAttributeChange($watchedKey, $attributes[$watchedKey]);
|
||||
unset($attributes[$watchedKey]);
|
||||
}
|
||||
}
|
||||
$this->attributes = array_merge($this->attributes, $attributes);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an attribute
|
||||
*
|
||||
* @param string $attribute Name of attribute to remove
|
||||
*
|
||||
* @return HTML_Common2
|
||||
*/
|
||||
public function removeAttribute($attribute)
|
||||
{
|
||||
if (in_array(strtolower($attribute), $this->watchedAttributes)) {
|
||||
$this->onAttributeChange(strtolower($attribute), null);
|
||||
} else {
|
||||
self::removeAttributeArray($this->attributes, $attribute);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the indentation level
|
||||
*
|
||||
* @param int $level Indentation level
|
||||
*
|
||||
* @return HTML_Common2
|
||||
*/
|
||||
public function setIndentLevel($level)
|
||||
{
|
||||
$level = intval($level);
|
||||
if (0 <= $level) {
|
||||
$this->_indentLevel = $level;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the indentation level
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIndentLevel()
|
||||
{
|
||||
return $this->_indentLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string to indent the element
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getIndent()
|
||||
{
|
||||
return str_repeat(self::getOption('indent'), $this->getIndentLevel());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the comment for the element
|
||||
*
|
||||
* @param string $comment String to output as HTML comment
|
||||
*
|
||||
* @return HTML_Common2
|
||||
*/
|
||||
public function setComment($comment)
|
||||
{
|
||||
$this->_comment = $comment;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the comment associated with the element
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getComment()
|
||||
{
|
||||
return $this->_comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the element has given CSS class
|
||||
*
|
||||
* @param string $class CSS Class name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasClass($class)
|
||||
{
|
||||
$regex = '/(^|\s)' . preg_quote($class, '/') . '(\s|$)/';
|
||||
return (bool)preg_match($regex, $this->getAttribute('class'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given CSS class(es) to the element
|
||||
*
|
||||
* @param string|array $class Class name, multiple class names separated by
|
||||
* whitespace, array of class names
|
||||
*
|
||||
* @return HTML_Common2
|
||||
*/
|
||||
public function addClass($class)
|
||||
{
|
||||
if (!is_array($class)) {
|
||||
$class = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
$curClass = preg_split(
|
||||
'/\s+/', $this->getAttribute('class'), null, PREG_SPLIT_NO_EMPTY
|
||||
);
|
||||
foreach ($class as $c) {
|
||||
if (!in_array($c, $curClass)) {
|
||||
$curClass[] = $c;
|
||||
}
|
||||
}
|
||||
$this->setAttribute('class', implode(' ', $curClass));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the given CSS class(es) from the element
|
||||
*
|
||||
* @param string|array $class Class name, multiple class names separated by
|
||||
* whitespace, array of class names
|
||||
*
|
||||
* @return HTML_Common2
|
||||
*/
|
||||
public function removeClass($class)
|
||||
{
|
||||
if (!is_array($class)) {
|
||||
$class = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
$curClass = array_diff(
|
||||
preg_split(
|
||||
'/\s+/', $this->getAttribute('class'), null, PREG_SPLIT_NO_EMPTY
|
||||
),
|
||||
$class
|
||||
);
|
||||
if (0 == count($curClass)) {
|
||||
$this->removeAttribute('class');
|
||||
} else {
|
||||
$this->setAttribute('class', implode(' ', $curClass));
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTML representation of the element
|
||||
*
|
||||
* This magic method allows using the instances of HTML_Common2 in string
|
||||
* contexts
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function __toString();
|
||||
|
||||
/**
|
||||
* Called if trying to change an attribute with name in $watchedAttributes
|
||||
*
|
||||
* This method is called for each attribute whose name is in the
|
||||
* $watchedAttributes array and which is being changed by setAttribute(),
|
||||
* setAttributes() or mergeAttributes() or removed via removeAttribute().
|
||||
* Note that the operation for the attribute is not carried on after calling
|
||||
* this method, it is the responsibility of this method to change or remove
|
||||
* (or not) the attribute.
|
||||
*
|
||||
* @param string $name Attribute name
|
||||
* @param string $value Attribute value, null if attribute is being removed
|
||||
*/
|
||||
protected function onAttributeChange($name, $value = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not an offset (HTML attribute) exists
|
||||
*
|
||||
* @param string $offset An offset to check for.
|
||||
*
|
||||
* @return boolean Returns true on success or false on failure.
|
||||
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->attributes[strtolower($offset)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value at specified offset (i.e. attribute name)
|
||||
*
|
||||
* @param string $offset The offset to retrieve.
|
||||
*
|
||||
* @return string|null
|
||||
* @link http://php.net/manual/en/arrayaccess.offsetget.php
|
||||
* @see getAttribute()
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->getAttribute($offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns a value to the specified offset (i.e. attribute name)
|
||||
*
|
||||
* @param string $offset The offset to assign the value to
|
||||
* @param string $value The value to set
|
||||
*
|
||||
* @return void
|
||||
* @link http://php.net/manual/en/arrayaccess.offsetset.php
|
||||
* @see setAttribute()
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if (null !== $offset) {
|
||||
$this->setAttribute($offset, $value);
|
||||
} else {
|
||||
// handles $foo[] = 'disabled';
|
||||
$this->setAttribute($value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets an offset (i.e. removes an attribute)
|
||||
*
|
||||
* @param string $offset The offset to unset
|
||||
*
|
||||
* @return void
|
||||
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
|
||||
* @see removeAttribute
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
$this->removeAttribute($offset);
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ class cArticleCollector implements SeekableIterator, Countable {
|
|||
protected $_aStartArticles = array();
|
||||
protected $_aOptions = array();
|
||||
protected $_aOptionsDefault = array();
|
||||
private $_bAsObject = TRUE;
|
||||
private $_bAsObject = true;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -65,14 +65,12 @@ class cArticleCollector implements SeekableIterator, Countable {
|
|||
}
|
||||
|
||||
if (count($this->_aStartArticles) > 0) {
|
||||
print_r($this->_aStartArticles);
|
||||
if ($this->_aOptions['start'] == false) {
|
||||
$oArtLangColl->setWhere("cApiArticleLanguageCollection.idartlang", $this->_aStartArticles, "NOTIN");
|
||||
//$sqlStartArticles = "a.idartlang NOT IN ('" . implode("','", $this->_startArticles) . "') AND ";
|
||||
}
|
||||
|
||||
if ($this->_aOptions['startonly'] == true) {
|
||||
echo "startonly";
|
||||
$oArtLangColl->setWhere("cApiArticleLanguageCollection.idartlang", $this->_aStartArticles, "IN");
|
||||
//$sqlStartArticles = "a.idartlang IN ('" . implode("','", $this->_startArticles) . "') AND ";
|
||||
}
|
||||
|
@ -89,7 +87,6 @@ class cArticleCollector implements SeekableIterator, Countable {
|
|||
$oArtLangColl->setWhere("cApiArticleLanguageCollection.idlang", $this->_aOptions['lang']);
|
||||
|
||||
$oArtLangColl->query();
|
||||
echo $oArtLangColl->_lastSQL;
|
||||
if ($oArtLangColl->count() > 0) {
|
||||
$aTable = $oArtLangColl->fetchTable();
|
||||
//echo $oArtLangColl->_lastSQL;
|
||||
|
@ -97,7 +94,6 @@ class cArticleCollector implements SeekableIterator, Countable {
|
|||
foreach ($aTable as $aItem) {
|
||||
$this->_aArticles[] = $aItem['idartlang'];
|
||||
}
|
||||
print_r($this->_aArticles);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +158,7 @@ class cArticleCollector implements SeekableIterator, Countable {
|
|||
*
|
||||
* @return cApiArticleLanguage|int returns article language object or idartlang
|
||||
*/
|
||||
public function current() {
|
||||
public function current() :cApiArticleLanguage|int{
|
||||
$iIdartlang = $this->_aArticles[$this->_iCurrentPosition];
|
||||
if ($this->_bAsObject) {
|
||||
$oArticle = new cApiArticleLanguage($iIdartlang);
|
||||
|
|
|
@ -247,9 +247,11 @@ class Article extends Item
|
|||
* @param string Property name
|
||||
* @return mixed Property value
|
||||
*/
|
||||
public function getField($name)
|
||||
{
|
||||
return urldecode($this->values[$name]);
|
||||
public function getField($name) {
|
||||
if(!is_null($name) && !empty($this->values[$name])) {
|
||||
return urldecode($this->values[$name]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -283,7 +285,7 @@ class Article extends Item
|
|||
*/
|
||||
public function getContent($type, $id = NULL)
|
||||
{
|
||||
if ($type == '') {
|
||||
if (empty($type)) {
|
||||
return 'Class ' . get_class($this) . ': content-type must be specified!';
|
||||
}
|
||||
|
||||
|
@ -295,7 +297,7 @@ class Article extends Item
|
|||
|
||||
if (is_null($id)) {
|
||||
// return Array
|
||||
return $this->content[$type];
|
||||
return (empty($this->content[$type]))?'':$this->content[$type];
|
||||
}
|
||||
|
||||
// return String
|
||||
|
|
|
@ -238,7 +238,7 @@ class cAutoload {
|
|||
* @return (string|null) Path and filename or null
|
||||
*/
|
||||
private static function _getContenidoClassFile($className) {
|
||||
$file = isset(self::$_includeFiles[$className]) ? self::$_conRootPath . self::$_includeFiles[$className] : null;
|
||||
$file = isset(self::$_includeFiles[$className]) ? self::$_conRootPath . self::$_includeFiles[$className] : '';
|
||||
return self::_validateClassAndFile($className, $file);
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ class cAutoload {
|
|||
*
|
||||
* @param string $className
|
||||
* @param string $filePathName
|
||||
* @return (string|null) The file if validation was successfull, otherwhise null
|
||||
* @return (string) The file if validation was successfull, otherwhise empty
|
||||
*/
|
||||
private static function _validateClassAndFile($className, $filePathName) {
|
||||
if (class_exists($className)) {
|
||||
|
@ -256,14 +256,14 @@ class cAutoload {
|
|||
'file' => str_replace(self::$_conRootPath, '', $filePathName),
|
||||
'error' => self::ERROR_CLASS_EXISTS
|
||||
);
|
||||
return null;
|
||||
return '';
|
||||
} elseif (!is_file($filePathName)) {
|
||||
self::$_errors[] = array(
|
||||
'class' => $className,
|
||||
'file' => str_replace(self::$_conRootPath, '', $filePathName),
|
||||
'error' => self::ERROR_FILE_NOT_FOUND
|
||||
);
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
return $filePathName;
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
* Description:
|
||||
* Contenido XML Parser
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido_XML
|
||||
* @version 1.0.9
|
||||
|
@ -19,79 +16,17 @@
|
|||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-06-30, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for parsing XML documents using SAX
|
||||
*
|
||||
* This class is a abstraction class for the PHP Expat XML functions.
|
||||
*
|
||||
* You can define handler functions/objects for start, end, PI and data sections (1.) or
|
||||
* your can define path which will trigger the defined event when encountered (2.)
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* 1.) $parser->setEvents(array("startElement"=> "myFunction",
|
||||
* "endElement"=> "myFunction",
|
||||
* "characterData"=> "myFunction",
|
||||
* "processingInstruction" => "myFunction");
|
||||
*
|
||||
* The value can also be an array with the object reference and the method to call.
|
||||
* i.e. "startElement"=>array(&$myObj, "myMethod") instead of "startelement"=>"myFunction"
|
||||
*
|
||||
* 2.) $parser->setEvents(array("/root/foo/bar"=>"myFunction"));
|
||||
*
|
||||
* Valid array keys are: 'startElement', 'endElement', 'characterData', 'processingInstruction' and paths
|
||||
* folowing the scheme '/root/element'. The path MUST begin from the root element and MUST start with '/'.
|
||||
*
|
||||
* The value can also be an array with the object reference and the method to call.
|
||||
* i.e. "/foo/bar"=>array(&$myObj, "myMethod") instead of "/foo/bar"=>"myFunction"
|
||||
*
|
||||
* It has 3 public methods:
|
||||
*
|
||||
* setEventHandlers - Set specific handlers for the xml parser
|
||||
* parseFile - Used to parse a XML file
|
||||
* parse - Used to parse a XML string
|
||||
*
|
||||
* A small example:
|
||||
*
|
||||
* include ("class.xmlparser.php");
|
||||
*
|
||||
* // The XML String
|
||||
* $xml = '
|
||||
* <?xml version="1.0"?>
|
||||
* <foo>
|
||||
* <bar>some text</bar>
|
||||
* <bar>another text</bar>
|
||||
* </foo>';
|
||||
*
|
||||
* function myHandler($name, $attribs, $content)
|
||||
* {
|
||||
* echo "<b style='color:red'>HIT</b>: [ <b>$name</b> ] [ $content ]<br/>";
|
||||
* }
|
||||
*
|
||||
* $parser = new XmlParser; // Parser instance
|
||||
* $parser->setEventHandlers(array("/foo/bar"=>"myHandler")); // Define our handler
|
||||
* $parser->parse($xml); // Parse the XML string
|
||||
*
|
||||
* Report bugs to: jan.lengowski@4fb.de
|
||||
*
|
||||
/**
|
||||
* @author Jan Lengowski <Jan.Lengowski@4fb.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @version 1.0
|
||||
*/
|
||||
class XmlParser {
|
||||
class clXmlParser {
|
||||
|
||||
/**
|
||||
* XML Parser autofree
|
|
@ -382,7 +382,8 @@ class DBFSItem extends Item {
|
|||
parent::store();
|
||||
}
|
||||
|
||||
public function setField($field, $value, $safe = true) {
|
||||
public function setField($field, $value, $safe = true): bool
|
||||
{
|
||||
if ($field == "dirname" || $field == "filename" || $field == "mimetype") {
|
||||
// Don't do safe encoding
|
||||
$safe = false;
|
||||
|
@ -391,7 +392,7 @@ class DBFSItem extends Item {
|
|||
$value = str_replace('"', "", $value);
|
||||
}
|
||||
|
||||
parent::setField($field, $value, $safe);
|
||||
return parent::setField($field, $value, $safe);
|
||||
}
|
||||
|
||||
}
|
|
@ -157,12 +157,12 @@ class FrontendUser extends Item
|
|||
* @param string $field Specifies the field to set
|
||||
* @param string $value Specifies the value to set
|
||||
*/
|
||||
public function setField($field, $value, $safe = true)
|
||||
public function setField($field, $value, $safe = true): bool
|
||||
{
|
||||
if ($field == "password") {
|
||||
parent::setField($field, md5($value), $safe);
|
||||
return parent::setField($field, md5($value), $safe);
|
||||
} else {
|
||||
parent::setField($field, $value, $safe);
|
||||
return parent::setField($field, $value, $safe);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -57,8 +57,7 @@ class cHTMLFormElement extends cHTML {
|
|||
if (is_string($id) && !empty($id)) {
|
||||
$this->updateAttributes(array("id" => $id));
|
||||
}
|
||||
|
||||
$this->setClass("text_medium"); // TODO: Remove this...
|
||||
|
||||
$this->setDisabled($disabled);
|
||||
$this->setTabindex($tabindex);
|
||||
$this->setAccessKey($accesskey);
|
||||
|
@ -594,7 +593,7 @@ class cHTMLSelectElement extends cHTMLFormElement {
|
|||
* All cHTMLOptionElements
|
||||
* @var array
|
||||
*/
|
||||
var $_options;
|
||||
var $_options = [];
|
||||
|
||||
/**
|
||||
* Constructor. Creates an HTML select field (aka "DropDown").
|
||||
|
@ -672,7 +671,7 @@ class cHTMLSelectElement extends cHTMLFormElement {
|
|||
*/
|
||||
function setDefault($lvalue) {
|
||||
$bSet = false;
|
||||
|
||||
$lvalue = cString::nullToString($lvalue);
|
||||
if (is_array($this->_options)) {
|
||||
foreach ($this->_options as $key => $value) {
|
||||
if (strcmp($value->getAttribute("value"), $lvalue) == 0) {
|
||||
|
@ -867,6 +866,7 @@ class cHTMLRadiobutton extends cHTMLFormElement {
|
|||
* @access private
|
||||
*/
|
||||
var $_value;
|
||||
protected string $_labelText;
|
||||
|
||||
/**
|
||||
* Constructor. Creates an HTML radio button element.
|
||||
|
@ -931,7 +931,7 @@ class cHTMLRadiobutton extends cHTMLFormElement {
|
|||
*/
|
||||
function toHtml($renderLabel = true) {
|
||||
$attributes = $this->getAttributes(true);
|
||||
|
||||
//print_r($attributes);
|
||||
if ($renderLabel == false) {
|
||||
return $this->fillSkeleton($attributes);
|
||||
}
|
||||
|
@ -1029,37 +1029,30 @@ class cHTMLCheckbox extends cHTMLFormElement {
|
|||
* @return string Rendered HTML
|
||||
*/
|
||||
function toHtml($renderlabel = true) {
|
||||
$attributes = $this->getAttributes(true);
|
||||
|
||||
if ($renderlabel == false) {
|
||||
return $this->fillSkeleton($attributes);
|
||||
}
|
||||
|
||||
$id = $this->getAttribute("id");
|
||||
|
||||
$renderedLabel = "";
|
||||
|
||||
if ($renderlabel == true) {
|
||||
if ($id != "") {
|
||||
$label = new cHTMLLabel($this->_value, $this->getAttribute("id"));
|
||||
if ($id != "") {
|
||||
$label = new cHTMLLabel($this->_value, $this->getAttribute("id"));
|
||||
|
||||
$label->setClass($this->getAttribute("class"));
|
||||
|
||||
if ($this->_labelText != "") {
|
||||
$label->setLabelText($this->_labelText);
|
||||
}
|
||||
|
||||
$renderedLabel = $label->toHtml();
|
||||
} else {
|
||||
|
||||
$renderedLabel = $this->_value;
|
||||
|
||||
if ($this->_labelText != "") {
|
||||
$label = new cHTMLLabel($this->_value, $this->getAttribute("id"));
|
||||
$label->setLabelText($this->_labelText);
|
||||
$renderedLabel = $label->toHtml();
|
||||
}
|
||||
if ($this->_labelText != "") {
|
||||
$label->setLabelText($this->_labelText);
|
||||
}
|
||||
|
||||
return '<table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap="nowrap">' . parent::toHTML() . '</td><td nowrap="nowrap">' . $renderedLabel . '</td></tr></table>';
|
||||
$renderedLabel = $label->toHtml();
|
||||
} else {
|
||||
return parent::toHTML();
|
||||
$renderedLabel = $this->_value;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->fillSkeleton($attributes) . $renderedLabel;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1162,6 +1155,8 @@ class cHTMLLink extends cHTML {
|
|||
|
||||
/* Stores the custom entries */
|
||||
var $_custom;
|
||||
|
||||
protected $_type;
|
||||
|
||||
/**
|
||||
* Constructor. Creates an HTML link.
|
||||
|
@ -1449,6 +1444,9 @@ class cHTMLImage extends cHTML {
|
|||
* @access private
|
||||
*/
|
||||
var $_height;
|
||||
|
||||
protected $_border;
|
||||
protected $_type;
|
||||
|
||||
/**
|
||||
* Constructor. Creates an HTML IMG element.
|
||||
|
|
|
@ -130,12 +130,7 @@ class cI18n {
|
|||
|
||||
// Is emulator to use?
|
||||
if (!$cfg['native_i18n']) {
|
||||
$ret = self::emulateGettext($string, $domain);
|
||||
// hopefully a proper replacement for
|
||||
// mb_convert_encoding($string, 'HTML-ENTITIES', 'utf-8');
|
||||
// see http://stackoverflow.com/q/11974008
|
||||
$ret = htmlspecialchars_decode(utf8_decode(conHtmlentities($ret, ENT_COMPAT, 'utf-8', false)));
|
||||
return $ret;
|
||||
return self::emulateGettext($string, $domain);
|
||||
}
|
||||
|
||||
// Try to use native gettext implementation
|
||||
|
|
|
@ -255,7 +255,7 @@ class InUseCollection extends ItemCollection
|
|||
}
|
||||
|
||||
if (!is_object($notification)) {
|
||||
$notification = new Contenido_Notification;
|
||||
$notification = new Contenido_Notification();
|
||||
}
|
||||
|
||||
$noti = $notification->messageBox("warning", $message.$override, 0);
|
||||
|
@ -293,6 +293,4 @@ class InUseItem extends Item
|
|||
$this->loadByPrimaryKey($mId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
|
@ -447,7 +447,7 @@ class PropertyItem extends Item
|
|||
* @param string $value
|
||||
* @param bool $safe Flag to run filter on passed value
|
||||
*/
|
||||
public function setField($field, $value, $safe = true)
|
||||
public function setField($field, $value, $safe = true): bool
|
||||
{
|
||||
if (array_key_exists($field, $this->maximumLength)) {
|
||||
if (strlen($value) > $this->maximumLength[$field]) {
|
||||
|
@ -455,7 +455,7 @@ class PropertyItem extends Item
|
|||
}
|
||||
}
|
||||
|
||||
parent::setField($field, $value, $safe);
|
||||
return parent::setField($field, $value, $safe);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -225,13 +225,13 @@ class Index extends SearchBaseAbstract {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
var $cms_type = array();
|
||||
protected static $_cms_type = [];
|
||||
|
||||
/**
|
||||
* the suffix of all available cms types
|
||||
* @var array
|
||||
*/
|
||||
var $cms_type_suffix = array();
|
||||
protected static $_cms_type_suffix = [];
|
||||
|
||||
/**
|
||||
* Constructor, set object properties
|
||||
|
@ -270,6 +270,8 @@ class Index extends SearchBaseAbstract {
|
|||
$this->idart = $idart;
|
||||
}
|
||||
|
||||
$this->_debug('Start Index for ', $this->idart);
|
||||
|
||||
$this->place = $place;
|
||||
$this->keycode = $aContent;
|
||||
$this->setStopwords($aStopwords);
|
||||
|
@ -283,7 +285,14 @@ class Index extends SearchBaseAbstract {
|
|||
$old_keys = array_keys($this->keywords_old);
|
||||
|
||||
$this->keywords_del = array_diff($old_keys, $new_keys);
|
||||
|
||||
/*
|
||||
echo '<pre>';
|
||||
print_r($new_keys);
|
||||
print_r($old_keys);
|
||||
print_r($this->keywords_del);
|
||||
echo '</pre>';
|
||||
*
|
||||
*/
|
||||
if (count($this->keywords_del) > 0) {
|
||||
$this->deleteKeywords();
|
||||
}
|
||||
|
@ -312,7 +321,7 @@ class Index extends SearchBaseAbstract {
|
|||
foreach ($this->keycode as $idtype => $data) {
|
||||
if ($this->checkCmsType($idtype)) {
|
||||
foreach ($data as $typeid => $code) {
|
||||
$this->_debug('code', $code);
|
||||
$this->_debug('createKeywords: raw code from data array', $code);
|
||||
|
||||
$code = stripslashes($code); // remove backslash
|
||||
$code = str_ireplace(array('<br>', '<br />'), "\n", $code); // replace HTML line breaks with newlines
|
||||
|
@ -320,13 +329,18 @@ class Index extends SearchBaseAbstract {
|
|||
if (strlen($code) > 0) {
|
||||
$code = clHtmlEntityDecode($code);
|
||||
}
|
||||
$this->_debug('code', $code);
|
||||
$this->_debug('createKeywords: code after clean', $code);
|
||||
|
||||
$tmp_keys = preg_split('/[\s,]+/', trim($code)); // split content by any number of commas or space characters
|
||||
$this->_debug('tmp_keys', $tmp_keys);
|
||||
$this->_debug('createKeywords: tmp_keys', $tmp_keys);
|
||||
|
||||
foreach ($tmp_keys as $value) {
|
||||
$value = strtolower($value); // index terms are stored with lower case
|
||||
$value = preg_replace('/[^\w]+/u', '', $value);
|
||||
|
||||
if (empty(trim($value))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!in_array($value, $this->stopwords)) {
|
||||
// eliminate stopwords
|
||||
|
@ -335,6 +349,7 @@ class Index extends SearchBaseAbstract {
|
|||
if (strlen($value) > 1) {
|
||||
// do not index single characters
|
||||
$this->keywords[$value] = $this->keywords[$value] . $idtype . '-' . $typeid . ' ';
|
||||
$this->_debug('createKeywords: entry array keywords', $this->keywords);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +360,7 @@ class Index extends SearchBaseAbstract {
|
|||
}
|
||||
}
|
||||
|
||||
$this->_debug('keywords', $this->keywords);
|
||||
$this->_debug('createKeywords: keywords returned', $this->keywords);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -357,9 +372,10 @@ class Index extends SearchBaseAbstract {
|
|||
$tmp_count = array();
|
||||
|
||||
foreach ($this->keywords as $keyword => $count) {
|
||||
$bProceed = true;
|
||||
$this->_debug('keyword', $keyword);
|
||||
$tmp_count = preg_split('/[\s]/', trim($count));
|
||||
$this->_debug('tmp_count', $tmp_count);
|
||||
|
||||
$occurrence = count($tmp_count);
|
||||
$tmp_count = array_unique($tmp_count);
|
||||
$cms_types = implode(',', $tmp_count);
|
||||
|
@ -376,8 +392,12 @@ class Index extends SearchBaseAbstract {
|
|||
('" . Contenido_Security::escapeDB($keyword, $this->db) . "', '" . Contenido_Security::escapeDB($index_string, $this->db) . "', " . Contenido_Security::toInteger($this->lang) . ", " . Contenido_Security::toInteger($nextid) . ")";
|
||||
} else {
|
||||
// if keyword allready exists, create new index_string
|
||||
if (preg_match("/&$this->idart=/", $this->keywords_old[$keyword])) {
|
||||
$index_string = preg_replace("/&$this->idart=[0-9]+\([\w-,]+\)/", $index_string, $this->keywords_old[$keyword]);
|
||||
if (preg_match("/&" . $this->idart . "=/", $this->keywords_old[$keyword])) {
|
||||
$index_string = preg_replace("/&" . $this->idart . "=[0-9]+\([,\w-]+\)/", $index_string, $this->keywords_old[$keyword]);
|
||||
if ($index_string === $this->keywords_old[$keyword]) {
|
||||
$bProceed = false;
|
||||
$this->_debug('db update', 'no update needed');
|
||||
}
|
||||
} else {
|
||||
$index_string = $this->keywords_old[$keyword] . $index_string;
|
||||
}
|
||||
|
@ -386,9 +406,11 @@ class Index extends SearchBaseAbstract {
|
|||
SET " . $this->place . " = '" . $index_string . "'
|
||||
WHERE idlang='" . Contenido_Security::toInteger($this->lang) . "' AND keyword='" . Contenido_Security::escapeDB($keyword, $this->db) . "'";
|
||||
}
|
||||
$this->_debug('sql', $sql);
|
||||
|
||||
$this->db->query($sql);
|
||||
if ($bProceed) {
|
||||
$this->_debug('sql', $sql);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -431,7 +453,7 @@ class Index extends SearchBaseAbstract {
|
|||
idlang=" . Contenido_Security::toInteger($this->lang) . " AND
|
||||
(keyword IN ('" . $keys . "') OR " . $this->place . " REGEXP '&" . Contenido_Security::toInteger($this->idart) . "=')";
|
||||
|
||||
$this->_debug('sql', $sql);
|
||||
$this->_debug('getKeywords: sql', $sql);
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
|
@ -440,6 +462,8 @@ class Index extends SearchBaseAbstract {
|
|||
while ($this->db->next_record()) {
|
||||
$this->keywords_old[$this->db->f('keyword')] = $this->db->f($place);
|
||||
}
|
||||
|
||||
$this->_debug('getKeywords: array keywords_old', $this->keywords_old);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -448,6 +472,7 @@ class Index extends SearchBaseAbstract {
|
|||
* @return $key
|
||||
*/
|
||||
function removeSpecialChars($key) {
|
||||
|
||||
$aSpecialChars = array(
|
||||
"-", "_", "'", ".", "!", "\"", "#", "$", "%", "&", "(", ")", "*", "+", ",", "/",
|
||||
":", ";", "<", "=", ">", "?", "@", "[", "\\", "]", "^", "`", "{", "|", "}", "~"
|
||||
|
@ -461,6 +486,7 @@ class Index extends SearchBaseAbstract {
|
|||
// a client and should not be treated in this method.
|
||||
// modified 2007-10-01, H. Librenz - added as hotfix for encoding problems (doesn't find any words with
|
||||
// umlaut vowels in it since you turn on UTF-8 as language encoding)
|
||||
|
||||
$sEncoding = getEncodingByLanguage($this->db, $this->lang, $this->cfg);
|
||||
|
||||
if (strtolower($sEncoding) != 'iso-8859-2') {
|
||||
|
@ -486,6 +512,9 @@ class Index extends SearchBaseAbstract {
|
|||
$key = clHtmlEntityDecode($key);
|
||||
$key = str_replace($aSpecialChars, '', $key);
|
||||
|
||||
ini_set('mbstring.substitute_character', "none");
|
||||
$key = mb_convert_encoding($key, 'UTF-8', 'UTF-8');
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
|
@ -516,6 +545,21 @@ class Index extends SearchBaseAbstract {
|
|||
return $key;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array array with arrays of type and typesuffix
|
||||
*/
|
||||
public function getContentTypes(): array {
|
||||
if (empty(self::$_cms_type)) {
|
||||
$this->setContentTypes();
|
||||
}
|
||||
|
||||
return array(
|
||||
'cms_type' => self::$_cms_type,
|
||||
'cms_type_suffix' => self::$_cms_type_suffix
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* set the array of stopwords which should not be indexed
|
||||
* @param array $aStopwords
|
||||
|
@ -537,8 +581,8 @@ class Index extends SearchBaseAbstract {
|
|||
$this->_debug('sql', $sql);
|
||||
$this->db->query($sql);
|
||||
while ($this->db->next_record()) {
|
||||
$this->cms_type[$this->db->f('type')] = $this->db->f('idtype');
|
||||
$this->cms_type_suffix[$this->db->f('idtype')] = substr($this->db->f('type'), 4, strlen($this->db->f('type')));
|
||||
self::$_cms_type[$this->db->f('type')] = $this->db->f('idtype');
|
||||
self::$_cms_type_suffix[$this->db->f('idtype')] = substr($this->db->f('type'), 4, strlen($this->db->f('type')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -554,11 +598,11 @@ class Index extends SearchBaseAbstract {
|
|||
|
||||
if (strlen($opt) > 0) {
|
||||
if (!stristr($opt, 'cms_')) {
|
||||
if (in_array($opt, $this->cms_type_suffix)) {
|
||||
if (in_array($opt, $this->getContentTypes()['cms_type_suffix'])) {
|
||||
$this->cms_options[$opt] = 'CMS_' . $opt;
|
||||
}
|
||||
} else {
|
||||
if (array_key_exists($opt, $this->cms_type)) {
|
||||
if (array_key_exists($opt, $this->getContentTypes()['cms_type'])) {
|
||||
$this->cms_options[$opt] = $opt;
|
||||
}
|
||||
}
|
||||
|
@ -788,8 +832,8 @@ class Search extends SearchBaseAbstract {
|
|||
|
||||
$this->index = new Index($oDB);
|
||||
|
||||
$this->cms_type = $this->index->cms_type;
|
||||
$this->cms_type_suffix = $this->index->cms_type_suffix;
|
||||
$this->cms_type = $this->index->getContentTypes()['cms_type'];
|
||||
$this->cms_type_suffix = $this->index->getContentTypes()['cms_type_suffix'];
|
||||
|
||||
$this->search_option = (array_key_exists('db', $options)) ? strtolower($options['db']) : 'regexp';
|
||||
$this->search_combination = (array_key_exists('combine', $options)) ? strtolower($options['combine']) : 'or';
|
||||
|
@ -1339,11 +1383,11 @@ class SearchResult extends SearchBaseAbstract {
|
|||
$cms_type = strtoupper($cms_type);
|
||||
if (strlen($cms_type) > 0) {
|
||||
if (!stristr($cms_type, 'cms_')) {
|
||||
if (in_array($cms_type, $this->index->cms_type_suffix)) {
|
||||
if (in_array($cms_type, $this->index->getContentTypes()['cms_type'])) {
|
||||
$cms_type = 'CMS_' . $cms_type;
|
||||
}
|
||||
} else {
|
||||
if (!array_key_exists($cms_type, $this->index->cms_type)) {
|
||||
if (!array_key_exists($cms_type, $this->index->getContentTypes()['cms_type_suffix'])) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -715,4 +715,19 @@ class cString extends cStringMultiByteWrapper {
|
|||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert null string to empty string
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function nullToString($string) {
|
||||
//var_dump($string);
|
||||
if(empty($string) || is_null($string)) {
|
||||
$string = '';
|
||||
}
|
||||
//var_dump($string);
|
||||
return $string;
|
||||
}
|
||||
}
|
|
@ -174,10 +174,10 @@ class UI_Menu {
|
|||
|
||||
foreach ($this->link as $key => $value) {
|
||||
if ($value != NULL) {
|
||||
if ($this->imagewidth[$key] != 0) {
|
||||
if (!empty($this->imagewidth[$key]) && !empty ($this->image[$key])) {
|
||||
$value->setContent('<img border="0" src="' . $this->image[$key] . '" width="' . $this->imagewidth[$key] . '">');
|
||||
$img = $value->render();
|
||||
} else {
|
||||
} else if(!empty ($this->image[$key])) {
|
||||
$value->setContent('<img border="0" src="' . $this->image[$key] . '">');
|
||||
$img = $value->render();
|
||||
}
|
||||
|
@ -186,14 +186,12 @@ class UI_Menu {
|
|||
} else {
|
||||
$link = $this->title[$key];
|
||||
|
||||
if ($this->image[$key] != "") {
|
||||
if (!empty($this->image[$key])) {
|
||||
if ($this->imagewidth[$key] != 0) {
|
||||
$img = '<img border="0" src="' . $this->image[$key] . '" width="' . $this->imagewidth[$key] . '">';
|
||||
} else {
|
||||
$img = '<img border="0" src="' . $this->image[$key] . '">';
|
||||
}
|
||||
} else {
|
||||
$img = " ";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,21 +210,24 @@ class UI_Menu {
|
|||
$bgColor = $cfg["color"]["table_light_active"];
|
||||
}
|
||||
|
||||
if ($this->extra[$key] == 'id="marked" ') {
|
||||
if (!empty($this->extra[$key]) && $this->extra[$key] == 'id="marked" ') {
|
||||
$bgColor = $cfg["color"]["table_light_active"];
|
||||
}
|
||||
}
|
||||
|
||||
$tpl->set('d', 'NAME', $link);
|
||||
|
||||
if ($this->image[$key] == "") {
|
||||
if (empty($this->image[$key])) {
|
||||
$tpl->set('d', 'ICON', '');
|
||||
} else {
|
||||
$tpl->set('d', 'ICON', $img);
|
||||
}
|
||||
|
||||
if ($this->extra[$key] != "" || $this->rowmark == true) {
|
||||
if (!empty($this->extra[$key]) || $this->rowmark == true) {
|
||||
$extraadd = "";
|
||||
if(empty($this->extra[$key])) {
|
||||
$this->extra[$key] = '';
|
||||
}
|
||||
|
||||
if ($this->rowmark == true) {
|
||||
$extraadd = 'onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)"';
|
||||
|
@ -439,7 +440,7 @@ class UI_Table_Form {
|
|||
|
||||
if (is_array($this->items)) {
|
||||
foreach ($this->items as $key => $value) {
|
||||
if ($this->itemType[$key] == 'subheader') {
|
||||
if (isset($this->itemType[$key]) && $this->itemType[$key] == 'subheader') {
|
||||
$subheader = '<tr class="text_medium" style="background-color: ' . $cfg["color"]["table_header"] . ';">';
|
||||
$subheader .= '<td colspan="2" valign="top" style="border: 0px;border-top: 0px; border-bottom:0px; border-right:1px;border-color: ' . $cfg["color"]["table_border"] . '; border-style: solid;">' . $this->captions[$key] . '</td></tr>';
|
||||
|
||||
|
@ -703,6 +704,7 @@ class UI_Page {
|
|||
|
||||
class Link {
|
||||
|
||||
var $alt = '';
|
||||
var $link;
|
||||
var $title;
|
||||
var $targetarea;
|
||||
|
@ -770,7 +772,8 @@ class Link {
|
|||
|
||||
function render() {
|
||||
global $sess, $cfg;
|
||||
|
||||
$custom = '';
|
||||
$attributes = '';
|
||||
if ($this->alt != "") {
|
||||
$alt = 'alt="' . $this->alt . '" title="' . $this->alt . '" ';
|
||||
} else {
|
||||
|
@ -819,7 +822,7 @@ class Link {
|
|||
break;
|
||||
}
|
||||
|
||||
if ($this->images == '') {
|
||||
if (empty($this->images)) {
|
||||
return ($link . $this->content . "</a>");
|
||||
} else {
|
||||
list($this->img_width, $this->img_height, $this->img_type, $this->img_attr) = getimagesize($cfg['path']['contenido'] . $this->images);
|
||||
|
@ -910,6 +913,7 @@ class UI_List {
|
|||
$colcount = 0;
|
||||
|
||||
if (is_array($this->cells)) {
|
||||
$dark = true;
|
||||
foreach ($this->cells as $row => $cells) {
|
||||
$thefont = '';
|
||||
$unne = '';
|
||||
|
@ -928,7 +932,7 @@ class UI_List {
|
|||
$bgColor = $cfg["color"]["table_light"];
|
||||
}
|
||||
|
||||
if ($this->bgcolor[$row] != "") {
|
||||
if (!empty($this->bgcolor[$row])) {
|
||||
$bgColor = $this->bgcolor[$row];
|
||||
}
|
||||
|
||||
|
@ -936,7 +940,7 @@ class UI_List {
|
|||
$count = 0;
|
||||
|
||||
foreach ($cells as $key => $value) {
|
||||
$thefontDispl = $thefont . $this->extra[$row][$key];
|
||||
$thefontDispl = $thefont . (empty($this->extra[$row][$key]))?'':$this->extra[$row][$key];
|
||||
$count++;
|
||||
$tpl2->reset();
|
||||
|
||||
|
@ -966,7 +970,7 @@ class UI_List {
|
|||
$tpl2->set('s', 'ALIGN', 'left');
|
||||
}
|
||||
|
||||
if ($this->cellvalignment[$row][$key] != "") {
|
||||
if (!empty($this->cellvalignment[$row][$key])) {
|
||||
$tpl2->set('s', 'VALIGN', $this->cellvalignment[$row][$key]);
|
||||
} else {
|
||||
$tpl2->set('s', 'VALIGN', 'top');
|
||||
|
@ -1027,10 +1031,10 @@ class cScrollList {
|
|||
var $listStart;
|
||||
|
||||
/**
|
||||
* sortable flag
|
||||
* @var string
|
||||
* sortable array
|
||||
* @var array
|
||||
*/
|
||||
var $sortable;
|
||||
protected $_aSortable;
|
||||
|
||||
/**
|
||||
* sortlink
|
||||
|
@ -1080,7 +1084,7 @@ class cScrollList {
|
|||
|
||||
$this->resultsPerPage = 0;
|
||||
$this->listStart = 1;
|
||||
$this->sortable = false;
|
||||
$this->_aSortable = [];
|
||||
|
||||
$this->objTable = new cHTMLTable();
|
||||
if ($defaultstyle == true) {
|
||||
|
@ -1126,7 +1130,7 @@ class cScrollList {
|
|||
* @param $sortable boolean true or false
|
||||
*/
|
||||
function setSortable($key, $sortable) {
|
||||
$this->sortable[$key] = $sortable;
|
||||
$this->_aSortable[$key] = $sortable;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1298,8 +1302,7 @@ class cScrollList {
|
|||
|
||||
$this->sortkey = $field;
|
||||
$this->sortmode = $order;
|
||||
|
||||
$field = $field + 1;
|
||||
$field = intval($field) + 1;
|
||||
$this->data = array_csort($this->data, "$field", $order);
|
||||
}
|
||||
|
||||
|
@ -1330,8 +1333,8 @@ class cScrollList {
|
|||
|
||||
/* Render header */
|
||||
foreach ($this->header as $key => $value) {
|
||||
if (is_array($this->sortable)) {
|
||||
if (array_key_exists($key, $this->sortable) && $this->sortable[$key] == true) {
|
||||
if (is_array($this->_aSortable)) {
|
||||
if (array_key_exists($key, $this->_aSortable) && $this->_aSortable[$key] == true) {
|
||||
$this->sortlink->setContent($value);
|
||||
$this->sortlink->setCustom("sortby", $key);
|
||||
|
||||
|
|
|
@ -508,23 +508,47 @@ class Contenido_UpdateNotifier {
|
|||
$response = false;
|
||||
|
||||
if ($this->_bUseCurl) {
|
||||
if ($bCheckCon) {
|
||||
$ch = $this->_checkCon2Host($sHost);
|
||||
} else {
|
||||
$ch = curl_init("http://" . $sHost);
|
||||
}
|
||||
if (is_resource($ch)) {
|
||||
curl_setopt($ch, CURLOPT_URL, "http://" . $sHost . $sFile);
|
||||
$sUrl = "https://" . $sHost . $sFile;
|
||||
$ch = $this->_checkCon2Host($sUrl);
|
||||
|
||||
if ($ch !== false) {
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
$response = curl_exec($ch);
|
||||
|
||||
//Check for errors.
|
||||
if (curl_errno($ch)) {
|
||||
throw new Exception(curl_error($ch));
|
||||
}
|
||||
curl_close($ch);
|
||||
}
|
||||
/*
|
||||
if ($bCheckCon) {
|
||||
$ch = $this->_checkCon2Host($sHost);
|
||||
} else {
|
||||
$ch = curl_init("https://" . $sHost);
|
||||
}
|
||||
if (is_resource($ch)) {
|
||||
curl_setopt($ch, CURLOPT_URL, "https://" . $sHost . $sFile);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
} */
|
||||
} else {
|
||||
$source = file_get_contents("http://" . $sHost . $sFile);
|
||||
if ($source !== false AND ! empty($source)) {
|
||||
$arrContextOptions = array(
|
||||
"ssl" => array(
|
||||
"verify_peer" => false,
|
||||
"verify_peer_name" => false,
|
||||
)
|
||||
);
|
||||
|
||||
$source = file_get_contents("https://" . $sHost . $sFile, false, stream_context_create($arrContextOptions));
|
||||
|
||||
if ($source !== false AND !empty($source)) {
|
||||
$response = $source;
|
||||
}
|
||||
}
|
||||
|
@ -539,13 +563,12 @@ class Contenido_UpdateNotifier {
|
|||
* @param string $sHost
|
||||
* @return obj|boolean curl object or false
|
||||
*/
|
||||
protected function _checkCon2Host($sHost) {
|
||||
$ch = curl_init("http://" . $sHost);
|
||||
if (!is_resource($ch)) {
|
||||
protected function _checkCon2Host($sUrl) {
|
||||
$ch = curl_init($sUrl);
|
||||
if ($ch === false) {
|
||||
$sErrorMessage = i18n('Unable to check for updates!') . " "
|
||||
. sprintf(i18n('Connection to %s failed!'), $sHost);
|
||||
$this->sErrorOutput = $this->renderOutput($sErrorMessage);
|
||||
return false;
|
||||
}
|
||||
return $ch;
|
||||
}
|
||||
|
@ -700,7 +723,7 @@ class Contenido_UpdateNotifier {
|
|||
if (strlen($sText) > 150) {
|
||||
$sText = capiStrTrimAfterWord($sText, 150) . '...';
|
||||
}
|
||||
//echo $aItem->title;
|
||||
//echo $aItem->title;
|
||||
$oTpl->set("d", "NEWS_DATE", $aItem->pubDate);
|
||||
$oTpl->set("d", "NEWS_TITLE", utf8_decode($aItem->title));
|
||||
$oTpl->set("d", "NEWS_TEXT", $sText);
|
||||
|
|
|
@ -377,6 +377,10 @@ class User {
|
|||
*/
|
||||
function getUserProperty($type, $name, $group = false) {
|
||||
global $cfg, $perm;
|
||||
|
||||
if(empty($this->values)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_object($perm)) {
|
||||
$perm = new Contenido_Perm();
|
||||
|
|
|
@ -32,7 +32,7 @@ class cRegistry {
|
|||
*/
|
||||
public static function getBackendPath() {
|
||||
$cfg = self::getConfig();
|
||||
return $cfg['path']['contenido'];
|
||||
return $cfg['path']['conlite'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ class cRegistry {
|
|||
public static function getFrontendPath() {
|
||||
$cfgClient = self::getClientConfig();
|
||||
$client = self::getClientId();
|
||||
return $cfgClient[$client]['path']['frontend'];
|
||||
return (empty($cfgClient))?'':$cfgClient[$client]['path']['frontend'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,6 +219,11 @@ class cRegistry {
|
|||
return self::_fetchGlobalVariable('edit', FALSE);
|
||||
}
|
||||
|
||||
public static function getCurrentModule()
|
||||
{
|
||||
return self::_fetchGlobalVariable('cCurrentModule', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the global variable requested.
|
||||
* If variable is not set, the default value is returned.
|
||||
|
@ -246,5 +251,4 @@ class cRegistry {
|
|||
|
||||
return new $apiClassName($objectId);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* File:
|
||||
* class.articlelanguage.php
|
||||
|
@ -18,14 +19,12 @@
|
|||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
class cApiArticleLanguageCollection extends ItemCollection {
|
||||
|
||||
|
||||
public function __construct($select = false) {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["art_lang"], "idartlang");
|
||||
|
@ -36,26 +35,26 @@ class cApiArticleLanguageCollection extends ItemCollection {
|
|||
$this->select($select);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getIdArtLang($iIdart, $iIdlang) {
|
||||
$this->setWhere('idart', Contenido_Security::toInteger($iIdart));
|
||||
$this->setWhere('idlang', Contenido_Security::toInteger($iIdlang));
|
||||
if($this->query() && $this->count() > 0) {
|
||||
if ($this->query() && $this->count() > 0) {
|
||||
return $this->next()->get('idartlang');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class cApiArticleLanguage extends Item {
|
||||
|
||||
class cApiArticleLanguage extends Item
|
||||
{
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param mixed $mId Specifies the ID of item to load
|
||||
*
|
||||
* @global type $cfg
|
||||
* @param type $mId
|
||||
*/
|
||||
public function __construct($mId = false)
|
||||
{
|
||||
public function __construct($mId = false) {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["art_lang"], "idartlang");
|
||||
$this->setFilters(array(), array());
|
||||
|
@ -63,24 +62,23 @@ class cApiArticleLanguage extends Item
|
|||
$this->loadByPrimaryKey($mId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function loadByArticleAndLanguageId($idart, $idlang) {
|
||||
$result = true;
|
||||
if (!$this->isLoaded()) {
|
||||
if (!$this->isLoaded()) {
|
||||
$idartlang = $this->_getIdArtLang($idart, $idlang);
|
||||
$result = $this->loadByPrimaryKey($idartlang);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function _getIdArtLang($idart, $idlang) {
|
||||
$sql = sprintf('SELECT idartlang FROM `%s` WHERE idart = %d AND idlang = %d', cRegistry::getConfigValue('tab', 'art_lang'), $idart, $idlang);
|
||||
$this->db->query($sql);
|
||||
$this->db->next_record();
|
||||
return $this->db->f('idartlang');
|
||||
}
|
||||
|
||||
|
||||
public function getContent($type = '', $id = NULL) {
|
||||
if (NULL === $this->content) {
|
||||
$this->_loadArticleContent();
|
||||
|
@ -108,16 +106,16 @@ class cApiArticleLanguage extends Item
|
|||
// return String
|
||||
return (isset($this->content[$type][$id])) ? $this->content[$type][$id] : '';
|
||||
}
|
||||
|
||||
|
||||
protected function _loadArticleContent() {
|
||||
if (NULL !== $this->content) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = "SELECT b.type, a.typeid, a.value FROM `".cRegistry::getConfigValue('tab', 'content')
|
||||
."` AS a, `".cRegistry::getConfigValue('tab', 'type')
|
||||
."` AS b WHERE a.idartlang = ".$this->get('idartlang')
|
||||
." AND b.idtype = a.idtype ORDER BY a.idtype, a.typeid";
|
||||
$sql = "SELECT b.type, a.typeid, a.value FROM `" . cRegistry::getConfigValue('tab', 'content')
|
||||
. "` AS a, `" . cRegistry::getConfigValue('tab', 'type')
|
||||
. "` AS b WHERE a.idartlang = " . $this->get('idartlang')
|
||||
. " AND b.idtype = a.idtype ORDER BY a.idtype, a.typeid";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
|
@ -126,5 +124,7 @@ class cApiArticleLanguage extends Item
|
|||
$this->content[strtolower($this->db->f('type'))][$this->db->f('typeid')] = urldecode($this->db->f('value'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -52,6 +52,4 @@ class cApiCategory extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
|
@ -51,17 +51,18 @@ class cApiCategoryLanguage extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
public function setField($field, $value, $bSafe = true) {
|
||||
public function setField($field, $value, $bSafe = true): bool
|
||||
{
|
||||
switch ($field) {
|
||||
case "name":
|
||||
$this->setField("urlname", $value);
|
||||
self::setField("urlname", $value, $bSafe);
|
||||
break;
|
||||
case "urlname":
|
||||
$value = clHtmlSpecialChars(capiStrCleanURLCharacters($value), ENT_QUOTES);
|
||||
break;
|
||||
}
|
||||
|
||||
parent::setField($field, $value);
|
||||
return parent::setField($field, $value, $bSafe);
|
||||
}
|
||||
|
||||
public function assignTemplate($idtpl) {
|
||||
|
|
|
@ -69,7 +69,7 @@ class cApiLayout extends Item {
|
|||
* @param mixed $mId Specifies the ID of item to load
|
||||
*/
|
||||
public function __construct($mId = false) {
|
||||
global $cfg;
|
||||
$cfg = cRegistry::getConfig();
|
||||
parent::__construct($cfg["tab"]["lay"], "idlay");
|
||||
$this->setFilters(array(), array());
|
||||
|
||||
|
@ -78,7 +78,7 @@ class cApiLayout extends Item {
|
|||
$this->_setLayPath();
|
||||
}
|
||||
|
||||
$oClient = new cApiClient($client);
|
||||
$oClient = new cApiClient(cRegistry::getClientId());
|
||||
$aClientProp = $oClient->getPropertiesByType('layfileedit');
|
||||
if(count($aClientProp) > 0) {
|
||||
$this->_aLayFileEditConf = array_merge($this->_aLayFileEditConf, $aClientProp);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* Description:
|
||||
* cApi class
|
||||
*
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage cApi
|
||||
* @version $Rev$
|
||||
|
@ -16,9 +16,13 @@
|
|||
* @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version)
|
||||
* @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version)
|
||||
* @link http://www.conlite.org ConLite.org
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
use ConLite\Log\LogWriter;
|
||||
use ConLite\Log\Log;
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
@ -57,10 +61,8 @@ class cApiModuleCollection extends ItemCollection {
|
|||
$oMod = $this->_itemClassInstance;
|
||||
$oMod->_bNoted = TRUE;
|
||||
$oMod->loadByPrimaryKey($iIdMod);
|
||||
if ($oMod->isLoaded()) {
|
||||
if ($oMod->hasModuleFolder()) {
|
||||
$oMod->deleteModuleFolder();
|
||||
}
|
||||
if ($oMod->isLoaded() && $oMod->hasModuleFolder()) {
|
||||
$oMod->deleteModuleFolder();
|
||||
}
|
||||
unset($oMod);
|
||||
return parent::delete($iIdMod);
|
||||
|
@ -73,6 +75,12 @@ class cApiModuleCollection extends ItemCollection {
|
|||
*/
|
||||
class cApiModule extends Item {
|
||||
|
||||
public $_oldumask;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $_sModAliasOld;
|
||||
public $_bNoted;
|
||||
protected $_error;
|
||||
|
||||
/**
|
||||
|
@ -83,10 +91,7 @@ class cApiModule extends Item {
|
|||
protected $_bOutputFromFile = false;
|
||||
protected $_bInputFromFile = false;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $aUsedTemplates = array();
|
||||
private array $aUsedTemplates = [];
|
||||
|
||||
/**
|
||||
* Configuration Array of ModFileEdit
|
||||
|
@ -94,32 +99,20 @@ class cApiModule extends Item {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_aModFileEditConf = array(
|
||||
'use' => false,
|
||||
'modFolderName' => 'data/modules'
|
||||
);
|
||||
private $_aModFileEditConf = ['use' => false, 'modFolderName' => 'data/modules'];
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_sModAlias;
|
||||
private ?string $_sModAlias = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_sModPath;
|
||||
private $_aModDefaultStruct = array(
|
||||
'css', 'js', 'php', 'template', 'image', 'lang', 'xml'
|
||||
);
|
||||
private ?string $_sModPath = null;
|
||||
private array $_aModDefaultStruct = ['css', 'js', 'php', 'template', 'image', 'lang', 'xml'];
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param mixed $mId Specifies the ID of item to load
|
||||
*/
|
||||
public function __construct($mId = false) {
|
||||
global $cfg, $cfgClient, $client;
|
||||
$cfg = cRegistry::getConfig();
|
||||
$cfgClient = cRegistry::getClientConfig(cRegistry::getClientId());
|
||||
|
||||
parent::__construct($cfg["tab"]["mod"], "idmod");
|
||||
|
||||
|
@ -127,24 +120,22 @@ class cApiModule extends Item {
|
|||
// That's why you don't have to stripslashes values if you store them
|
||||
// using ->set. You have to add slashes, if you store data directly
|
||||
// (data not from a form field)
|
||||
$this->setFilters(array(), array());
|
||||
$this->setFilters([], []);
|
||||
|
||||
$this->_packageStructure = array("jsfiles" => $cfgClient[$client]["js"]["path"],
|
||||
"tplfiles" => $cfgClient[$client]["tpl"]["path"],
|
||||
"cssfiles" => $cfgClient[$client]["css"]["path"]);
|
||||
$this->_packageStructure = ["jsfiles" => $cfgClient["js"]["path"], "tplfiles" => $cfgClient["tpl"]["path"], "cssfiles" => $cfgClient["css"]["path"]];
|
||||
|
||||
if (isset($cfg['dceModEdit']) && is_array($cfg['dceModEdit'])) {
|
||||
$this->_aModFileEditConf['clientPath'] = $cfgClient[$client]["path"]["frontend"];
|
||||
$this->_aModFileEditConf['clientPath'] = $cfgClient["path"]["frontend"];
|
||||
$this->_aModFileEditConf = array_merge($this->_aModFileEditConf, $cfg['dceModEdit']);
|
||||
if (!isset($cfg['dceModEdit']['modPath']) || empty($cfg['dceModEdit']['modPath'])) {
|
||||
$this->_aModFileEditConf['modPath'] = $cfgClient[$client]["path"]["frontend"]
|
||||
$this->_aModFileEditConf['modPath'] = $cfgClient["path"]["frontend"]
|
||||
. $this->_aModFileEditConf['modFolderName'] . "/";
|
||||
}
|
||||
}
|
||||
|
||||
$oClient = new cApiClient($client);
|
||||
$aClientProp = $oClient->getPropertiesByType('modfileedit');
|
||||
if (count($aClientProp) > 0) {
|
||||
$cApiClient = new cApiClient(cRegistry::getClientId());
|
||||
$aClientProp = $cApiClient->getPropertiesByType('modfileedit');
|
||||
if ($aClientProp !== []) {
|
||||
$this->_aModFileEditConf = array_merge($this->_aModFileEditConf, $aClientProp);
|
||||
}
|
||||
|
||||
|
@ -155,15 +146,15 @@ class cApiModule extends Item {
|
|||
|
||||
public function createModuleFolder() {
|
||||
//echo $this->_aModFileEditConf['modPath'];
|
||||
$sPathErrorLog = cRegistry::getConfigValue('path', 'logs').'errorlog.txt';
|
||||
|
||||
$sPathErrorLog = cRegistry::getConfigValue('path', 'logs') . 'errorlog.txt';
|
||||
|
||||
if (is_writable($this->_aModFileEditConf['clientPath']) && !file_exists($this->_aModFileEditConf['modPath'])) {
|
||||
try {
|
||||
mkdir($this->_aModFileEditConf['modPath'], 0777, true);
|
||||
} catch (Exception $ex) {
|
||||
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
|
||||
$oLog = new cLog($oWriter);
|
||||
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
|
||||
$writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$log = new Log($writer);
|
||||
$log->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), Log::WARN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,9 +164,9 @@ class cApiModule extends Item {
|
|||
try {
|
||||
mkdir($this->getModulePath(), 0777);
|
||||
} catch (Exception $ex) {
|
||||
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
|
||||
$oLog = new cLog($oWriter);
|
||||
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
|
||||
$writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$log = new Log($writer);
|
||||
$log->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), Log::WARN);
|
||||
}
|
||||
|
||||
if (is_writable($this->getModulePath())) {
|
||||
|
@ -184,18 +175,16 @@ class cApiModule extends Item {
|
|||
umask($this->_oldumask);
|
||||
}
|
||||
} else {
|
||||
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
|
||||
$oLog = new cLog($oWriter);
|
||||
$oLog->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), cLog::WARN);
|
||||
$writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$log = new Log($writer);
|
||||
$log->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), Log::WARN);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public function deleteModuleFolder() {
|
||||
if ($this->_aModFileEditConf['use'] == TRUE && is_writable($this->_aModFileEditConf['modPath'])) {
|
||||
if (is_dir($this->getModulePath())) {
|
||||
return $this->_recursiveRemoveDirectory($this->getModulePath());
|
||||
}
|
||||
if ($this->_aModFileEditConf['use'] == TRUE && is_writable($this->_aModFileEditConf['modPath']) && is_dir($this->getModulePath())) {
|
||||
return $this->_recursiveRemoveDirectory($this->getModulePath());
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -259,7 +248,9 @@ class cApiModule extends Item {
|
|||
*
|
||||
* @return array Found strings for this module
|
||||
*/
|
||||
public function parseModuleForStrings() {
|
||||
public function parseModuleForStrings(): bool|array
|
||||
{
|
||||
global $cfg;
|
||||
if ($this->virgin == true) {
|
||||
return false;
|
||||
}
|
||||
|
@ -269,12 +260,12 @@ class cApiModule extends Item {
|
|||
$code .= $this->get("input");
|
||||
|
||||
// Initialize array
|
||||
$strings = array();
|
||||
$strings = [];
|
||||
|
||||
// Split the code into mi18n chunks
|
||||
$varr = preg_split('/mi18n([\s]*)\(([\s]*)"/', $code, -1);
|
||||
|
||||
if (count($varr) > 1) {
|
||||
if ((is_countable($varr) ? count($varr) : 0) > 1) {
|
||||
foreach ($varr as $key => $value) {
|
||||
// Search first closing
|
||||
$closing = strpos($value, '")');
|
||||
|
@ -294,7 +285,7 @@ class cApiModule extends Item {
|
|||
preg_match_all('/mi18n([\s]*)\("(.*)"\)/', $varr[$key], $results);
|
||||
|
||||
// Append to strings array if there are any results
|
||||
if (is_array($results[1]) && count($results[2]) > 0) {
|
||||
if (is_array($results[1]) && (is_countable($results[2]) ? count($results[2]) : 0) > 0) {
|
||||
$strings = array_merge($strings, $results[2]);
|
||||
}
|
||||
|
||||
|
@ -306,7 +297,7 @@ class cApiModule extends Item {
|
|||
// adding dynamically new module translations by content types
|
||||
// this function was introduced with contenido 4.8.13
|
||||
// checking if array is set to prevent crashing the module translation page
|
||||
if (is_array($cfg['translatable_content_types']) && count($cfg['translatable_content_types']) > 0) {
|
||||
if (is_array($cfg['translatable_content_types']) && $cfg['translatable_content_types'] !== []) {
|
||||
// iterate over all defines cms content types
|
||||
foreach ($cfg['translatable_content_types'] as $sContentType) {
|
||||
// check if the content type exists and include his class file
|
||||
|
@ -317,7 +308,7 @@ class cApiModule extends Item {
|
|||
// add the additional translations for the module
|
||||
if (class_exists($sContentType) && method_exists($sContentType, 'addModuleTranslations') && preg_match('/' . strtoupper($sContentType) . '\[\d+\]/', $code)) {
|
||||
|
||||
$strings = call_user_func(array($sContentType, 'addModuleTranslations'), $strings);
|
||||
$strings = call_user_func([$sContentType, 'addModuleTranslations'], $strings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -334,7 +325,7 @@ class cApiModule extends Item {
|
|||
public function moduleInUse($module, $bSetData = false) {
|
||||
global $cfg;
|
||||
|
||||
$db = new DB_ConLite();
|
||||
$dbConLite = new DB_ConLite();
|
||||
|
||||
$sql = "SELECT
|
||||
c.idmod, c.idtpl, t.name
|
||||
|
@ -346,17 +337,17 @@ class cApiModule extends Item {
|
|||
t.idtpl=c.idtpl
|
||||
GROUP BY c.idtpl
|
||||
ORDER BY t.name";
|
||||
$db->query($sql);
|
||||
$dbConLite->query($sql);
|
||||
|
||||
if ($db->nf() == 0) {
|
||||
if ($dbConLite->nf() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
$i = 0;
|
||||
// save the datas of used templates in array
|
||||
if ($bSetData === true) {
|
||||
while ($db->next_record()) {
|
||||
$this->aUsedTemplates[$i]['tpl_name'] = $db->f('name');
|
||||
$this->aUsedTemplates[$i]['tpl_id'] = (int) $db->f('idmod');
|
||||
while ($dbConLite->next_record()) {
|
||||
$this->aUsedTemplates[$i]['tpl_name'] = $dbConLite->f('name');
|
||||
$this->aUsedTemplates[$i]['tpl_id'] = (int) $dbConLite->f('idmod');
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
@ -376,19 +367,21 @@ class cApiModule extends Item {
|
|||
/**
|
||||
* Checks if the module is a pre-4.3 module
|
||||
* @return boolean true if this module is an old one
|
||||
*
|
||||
* @deprecated since version 2.0
|
||||
*/
|
||||
public function isOldModule() {
|
||||
// Keywords to scan
|
||||
$scanKeywords = array('$cfgTab', 'idside', 'idsidelang');
|
||||
$scanKeywords = ['$cfgTab', 'idside', 'idsidelang'];
|
||||
|
||||
$input = $this->get("input");
|
||||
$output = $this->get("output");
|
||||
|
||||
foreach ($scanKeywords as $keyword) {
|
||||
if (strstr($input, $keyword)) {
|
||||
foreach ($scanKeywords as $scanKeyword) {
|
||||
if (strstr($input, $scanKeyword)) {
|
||||
return true;
|
||||
}
|
||||
if (strstr($output, $keyword)) {
|
||||
if (strstr($output, $scanKeyword)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -397,11 +390,8 @@ class cApiModule extends Item {
|
|||
public function getField($field) {
|
||||
$value = parent::getField($field);
|
||||
|
||||
switch ($field) {
|
||||
case "name":
|
||||
if ($value == "") {
|
||||
$value = i18n("- Unnamed Module -");
|
||||
}
|
||||
if ($field === "name" && $value == "") {
|
||||
$value = i18n("- Unnamed Module -");
|
||||
}
|
||||
return ($value);
|
||||
}
|
||||
|
@ -409,7 +399,7 @@ class cApiModule extends Item {
|
|||
public function store($bJustStore = false) {
|
||||
global $cfg;
|
||||
/* dceModFileEdit (c)2009-2011 www.dceonline.de */
|
||||
if ($this->_aModFileEditConf['use'] == true && ($this->_aModFileEditConf['allModsFromFile'] == true || in_array($this->get('idmod'), $this->_aModFileEditConf['modsFromFile']))) {
|
||||
if ($this->_aModFileEditConf['use'] == true && ($this->_aModFileEditConf['allModsFromFile'] == true || (is_array($this->_aModFileEditConf['modsFromFile']) && in_array($this->get('idmod'), $this->_aModFileEditConf['modsFromFile'])))) {
|
||||
$this->modifiedValues['output'] = true;
|
||||
$this->modifiedValues['input'] = true;
|
||||
}
|
||||
|
@ -424,11 +414,9 @@ class cApiModule extends Item {
|
|||
|
||||
conGenerateCodeForAllArtsUsingMod($this->get("idmod"));
|
||||
|
||||
if ($this->_shouldStoreToFile()) {
|
||||
if ($this->_makeFileDirectoryStructure()) {
|
||||
$sRootPath = $cfg['path']['contenido'] . $cfg['path']['modules'] . $this->get("idclient") . "/";
|
||||
file_put_contents($sRootPath . $this->get("idmod") . ".xml", $this->export($this->get("idmod") . ".xml", true));
|
||||
}
|
||||
if ($this->_shouldStoreToFile() && $this->_makeFileDirectoryStructure()) {
|
||||
$sRootPath = $cfg['path']['contenido'] . $cfg['path']['modules'] . $this->get("idclient") . "/";
|
||||
file_put_contents($sRootPath . $this->get("idmod") . ".xml", $this->export($this->get("idmod") . ".xml", true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -437,7 +425,7 @@ class cApiModule extends Item {
|
|||
return $this->_aModFileEditConf;
|
||||
}
|
||||
|
||||
protected function _recursiveRemoveDirectory($directory) {
|
||||
protected function _recursiveRemoveDirectory($directory): bool {
|
||||
foreach (glob("{$directory}/*") as $file) {
|
||||
if (is_dir($file)) {
|
||||
$this->_recursiveRemoveDirectory($file);
|
||||
|
@ -476,6 +464,14 @@ class cApiModule extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->_error;
|
||||
}
|
||||
|
||||
protected function _shouldLoadFromFiles() {
|
||||
if (getSystemProperty("modules", "loadfromfiles") == "true") {
|
||||
return true;
|
||||
|
@ -494,26 +490,23 @@ class cApiModule extends Item {
|
|||
private function _parseImportFile($sFile, $sType = "module", $sEncoding = "ISO-8859-1") {
|
||||
global $_mImport;
|
||||
|
||||
$oParser = new XmlParser($sEncoding);
|
||||
$clXmlParser = new clXmlParser($sEncoding);
|
||||
|
||||
if ($sType == "module") {
|
||||
$oParser->setEventHandlers(array("/module/name" => "cHandler_ModuleData",
|
||||
"/module/description" => "cHandler_ModuleData",
|
||||
"/module/type" => "cHandler_ModuleData",
|
||||
"/module/input" => "cHandler_ModuleData",
|
||||
"/module/output" => "cHandler_ModuleData"));
|
||||
$clXmlParser->setEventHandlers(["/module/name" => "cHandler_ModuleData", "/module/description" => "cHandler_ModuleData", "/module/type" => "cHandler_ModuleData", "/module/input" => "cHandler_ModuleData", "/module/output" => "cHandler_ModuleData"]);
|
||||
} else {
|
||||
$aHandler = array("/modulepackage/guid" => "cHandler_ModuleData",
|
||||
$aHandler = [
|
||||
"/modulepackage/guid" => "cHandler_ModuleData",
|
||||
#"/modulepackage/repository_guid" => "cHandler_ModuleData",
|
||||
"/modulepackage/module/name" => "cHandler_ModuleData",
|
||||
"/modulepackage/module/description" => "cHandler_ModuleData",
|
||||
"/modulepackage/module/type" => "cHandler_ModuleData",
|
||||
"/modulepackage/module/input" => "cHandler_ModuleData",
|
||||
"/modulepackage/module/output" => "cHandler_ModuleData",
|
||||
"/modulepackage/module/input" => "cHandler_ModuleData");
|
||||
"/modulepackage/module/input" => "cHandler_ModuleData",
|
||||
];
|
||||
|
||||
// Add file handler (e.g. js, css, templates)
|
||||
foreach ($this->_packageStructure As $sFileType => $sFilePath) {
|
||||
foreach (array_keys($this->_packageStructure) As $sFileType) {
|
||||
// Note, that $aHandler["/modulepackage/" . $sFileType] and using
|
||||
// a handler which uses the node name (here: FileType) doesn't work,
|
||||
// as the event handler for the filetype node will be fired
|
||||
|
@ -536,13 +529,13 @@ class cApiModule extends Item {
|
|||
$aHandler["/modulepackage/translations/string/original"] = "cHandler_ItemName";
|
||||
$aHandler["/modulepackage/translations/string/translation"] = "cHandler_Translation";
|
||||
|
||||
$oParser->setEventHandlers($aHandler);
|
||||
$clXmlParser->setEventHandlers($aHandler);
|
||||
}
|
||||
|
||||
if ($oParser->parseFile($sFile)) {
|
||||
if ($clXmlParser->parseFile($sFile)) {
|
||||
return true;
|
||||
} else {
|
||||
$this->_error = $oParser->error;
|
||||
$this->_error = $clXmlParser->error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -581,8 +574,8 @@ class cApiModule extends Item {
|
|||
* @param $return boolean if false, the result is immediately sent to the browser
|
||||
*/
|
||||
public function export($filename, $return = false) {
|
||||
$tree = new XmlTree('1.0', 'ISO-8859-1');
|
||||
$root = & $tree->addRoot('module');
|
||||
$xmlTree = new XmlTree('1.0', 'ISO-8859-1');
|
||||
$root = & $xmlTree->addRoot('module');
|
||||
|
||||
$root->appendChild("name", clHtmlSpecialChars($this->get("name")));
|
||||
$root->appendChild("description", clHtmlSpecialChars($this->get("description")));
|
||||
|
@ -593,11 +586,11 @@ class cApiModule extends Item {
|
|||
if ($return == false) {
|
||||
ob_end_clean();
|
||||
header("Content-Type: text/xml");
|
||||
header("Etag: " . md5(mt_rand()));
|
||||
header("Etag: " . md5(random_int(0, mt_getrandmax())));
|
||||
header("Content-Disposition: attachment;filename=\"$filename\"");
|
||||
$tree->dump(false);
|
||||
$xmlTree->dump(false);
|
||||
} else {
|
||||
return stripslashes($tree->dump(true));
|
||||
return stripslashes($xmlTree->dump(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -605,13 +598,13 @@ class cApiModule extends Item {
|
|||
global $_mImport;
|
||||
|
||||
if ($this->_parseImportFile($sFile, "package")) {
|
||||
$aData = array();
|
||||
$aData = [];
|
||||
$aData["guid"] = $_mImport["module"]["guid"];
|
||||
$aData["repository_guid"] = $_mImport["module"]["repository_guid"];
|
||||
$aData["name"] = $_mImport["module"]["name"];
|
||||
|
||||
// Files
|
||||
foreach ($this->_packageStructure as $sFileType => $sFilePath) {
|
||||
foreach (array_keys($this->_packageStructure) as $sFileType) {
|
||||
if (is_array($_mImport["items"][$sFileType])) {
|
||||
$aData[$sFileType] = array_keys($_mImport["items"][$sFileType]);
|
||||
}
|
||||
|
@ -636,8 +629,8 @@ class cApiModule extends Item {
|
|||
/**
|
||||
* Imports a module package from a XML file Uses xmlparser and callbacks
|
||||
*
|
||||
* @param string $sFile Filename of data file (including path)
|
||||
* @param array $aOptions Optional. An array of arrays specifying, how the items
|
||||
* @param string $sFile Filename of data file (including path)
|
||||
* @param array $aOptions Optional. An array of arrays specifying, how the items
|
||||
* of the xml file will be imported. If specified, has to
|
||||
* contain an array of this structure:
|
||||
*
|
||||
|
@ -652,26 +645,27 @@ class cApiModule extends Item {
|
|||
*
|
||||
* @return bool Returns true, if import has been successfully finished
|
||||
*/
|
||||
public function importPackage($sFile, $aOptions = array()) {
|
||||
public function importPackage($sFile, $aOptions = []) {
|
||||
$bStore = null;
|
||||
global $_mImport, $client;
|
||||
|
||||
cInclude("includes", "functions.file.php");
|
||||
cInclude("includes", "functions.lay.php"); // You won't believe the code in there (or what is missing in class.layout.php...)
|
||||
// Ensure correct options structure
|
||||
foreach ($this->_packageStructure as $sFileType => $sFilePath) {
|
||||
foreach (array_keys($this->_packageStructure) as $sFileType) {
|
||||
if (!is_array($aOptions["items"][$sFileType])) {
|
||||
$aOptions["items"][$sFileType] = array();
|
||||
$aOptions["items"][$sFileType] = [];
|
||||
}
|
||||
}
|
||||
|
||||
// Layouts
|
||||
if (!is_array($aOptions["items"]["layouts"])) {
|
||||
$aOptions["items"]["layouts"] = array();
|
||||
$aOptions["items"]["layouts"] = [];
|
||||
}
|
||||
|
||||
// Translations
|
||||
if (!is_array($aOptions["translations"])) {
|
||||
$aOptions["translations"] = array();
|
||||
$aOptions["translations"] = [];
|
||||
}
|
||||
|
||||
// Parse file
|
||||
|
@ -698,7 +692,7 @@ class cApiModule extends Item {
|
|||
createFile($sFileName, $sFilePath);
|
||||
}
|
||||
fileEdit($sFileName, $aContent["content"], $sFilePath);
|
||||
} else if ($aOptions["items"][$sFileType][clHtmlSpecialChars($sFileName)] == "append") {
|
||||
} elseif ($aOptions["items"][$sFileType][clHtmlSpecialChars($sFileName)] == "append") {
|
||||
$sOriginalContent = getFileContent($sFileName, $sFilePath);
|
||||
fileEdit($sFileName, $sOriginalContent . $aContent["content"], $sFilePath);
|
||||
}
|
||||
|
@ -737,13 +731,13 @@ class cApiModule extends Item {
|
|||
|
||||
// Translations
|
||||
if (is_array($_mImport["translations"])) {
|
||||
$oTranslations = new cApiModuleTranslationCollection();
|
||||
$cApiModuleTranslationCollection = new cApiModuleTranslationCollection();
|
||||
$iID = $this->get($this->primaryKey);
|
||||
|
||||
foreach ($_mImport["translations"] as $sPackageLang => $aTranslations) {
|
||||
foreach (array_keys($_mImport["translations"]) as $sPackageLang) {
|
||||
if (array_key_exists($sPackageLang, $aOptions["translations"])) {
|
||||
foreach ($_mImport["translations"][$sPackageLang] as $sOriginal => $sTranslation) {
|
||||
$oTranslations->create($iID, $aOptions["translations"][$sPackageLang], $sOriginal, $sTranslation);
|
||||
$cApiModuleTranslationCollection->create($iID, $aOptions["translations"][$sPackageLang], $sOriginal, $sTranslation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -757,33 +751,33 @@ class cApiModule extends Item {
|
|||
/**
|
||||
* Exports the specified module and attached files to a file
|
||||
*
|
||||
* @param string $sPackageFileName Filename to return
|
||||
* @param bool $bReturn if false, the result is immediately sent to the browser
|
||||
* @param string $sPackageFileName Filename to return
|
||||
* @param bool $bReturn if false, the result is immediately sent to the browser
|
||||
*/
|
||||
public function exportPackage($sPackageFileName, $bReturn = false) {
|
||||
global $cfgClient, $client;
|
||||
|
||||
cInclude("includes", "functions.file.php");
|
||||
|
||||
$oTree = new XmlTree('1.0', 'ISO-8859-1');
|
||||
$oRoot = & $oTree->addRoot('modulepackage');
|
||||
$xmlTree = new XmlTree('1.0', 'ISO-8859-1');
|
||||
$oRoot = & $xmlTree->addRoot('modulepackage');
|
||||
|
||||
$oRoot->appendChild("package_guid", $this->get("package_guid"));
|
||||
$oRoot->appendChild("package_data", $this->get("package_data")); // This is serialized and more or less informal data
|
||||
|
||||
$aData = unserialize($this->get("package_data"));
|
||||
if (!is_array($aData)) {
|
||||
$aData = array();
|
||||
$aData = [];
|
||||
$aData["repository_guid"] = "";
|
||||
$aData["jsfiles"] = array();
|
||||
$aData["tplfiles"] = array();
|
||||
$aData["cssfiles"] = array();
|
||||
$aData["layouts"] = array();
|
||||
$aData["translations"] = array();
|
||||
$aData["jsfiles"] = [];
|
||||
$aData["tplfiles"] = [];
|
||||
$aData["cssfiles"] = [];
|
||||
$aData["layouts"] = [];
|
||||
$aData["translations"] = [];
|
||||
}
|
||||
|
||||
// Export basic module
|
||||
$oNodeModule = & $oRoot->appendChild("module");
|
||||
$oNodeModule = &$oRoot->appendChild("module");
|
||||
$oNodeModule->appendChild("name", clHtmlSpecialChars($this->get("name")));
|
||||
$oNodeModule->appendChild("description", clHtmlSpecialChars($this->get("description")));
|
||||
$oNodeModule->appendChild("type", clHtmlSpecialChars($this->get("type")));
|
||||
|
@ -793,27 +787,25 @@ class cApiModule extends Item {
|
|||
// Export files (e.g. js, css, templates)
|
||||
foreach ($this->_packageStructure As $sFileType => $sFilePath) {
|
||||
$oNodeFiles = & $oRoot->appendChild($sFileType);
|
||||
if (count($aData[$sFileType]) > 0) {
|
||||
foreach ($aData[$sFileType] as $sFileName) {
|
||||
if (is_readable($sFilePath . $sFileName)) {
|
||||
$sContent = getFileContent($sFileName, $sFilePath);
|
||||
$oNodeFiles->appendChild("area", clHtmlSpecialChars($sFileType));
|
||||
$oNodeFiles->appendChild("name", clHtmlSpecialChars($sFileName));
|
||||
$oNodeFiles->appendChild("content", clHtmlSpecialChars($sContent));
|
||||
}
|
||||
foreach ($aData[$sFileType] as $sFileName) {
|
||||
if (is_readable($sFilePath . $sFileName)) {
|
||||
$sContent = getFileContent($sFileName, $sFilePath);
|
||||
$oNodeFiles->appendChild("area", clHtmlSpecialChars($sFileType));
|
||||
$oNodeFiles->appendChild("name", clHtmlSpecialChars($sFileName));
|
||||
$oNodeFiles->appendChild("content", clHtmlSpecialChars($sContent));
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($sContent);
|
||||
|
||||
// Export layouts
|
||||
$oNodeLayouts = & $oRoot->appendChild("layouts");
|
||||
$oNodeLayouts = &$oRoot->appendChild("layouts");
|
||||
|
||||
$oLayouts = new cApiLayoutCollection;
|
||||
$oLayouts->setWhere("idclient", $client);
|
||||
$oLayouts->query();
|
||||
$cApiLayoutCollection = new cApiLayoutCollection;
|
||||
$cApiLayoutCollection->setWhere("idclient", $client);
|
||||
$cApiLayoutCollection->query();
|
||||
|
||||
while ($oLayout = $oLayouts->next()) {
|
||||
while ($oLayout = $cApiLayoutCollection->next()) {
|
||||
if (in_array($oLayout->get($oLayout->primaryKey), $aData["layouts"])) {
|
||||
$oNodeLayouts->appendChild("area", "layouts");
|
||||
$oNodeLayouts->appendChild("name", clHtmlSpecialChars($oLayout->get("name")));
|
||||
|
@ -822,24 +814,23 @@ class cApiModule extends Item {
|
|||
}
|
||||
}
|
||||
unset($oLayout);
|
||||
unset($oLayouts);
|
||||
unset($cApiLayoutCollection);
|
||||
|
||||
// Export translations
|
||||
$oLangs = new cApiLanguageCollection();
|
||||
$oLangs->setOrder("idlang");
|
||||
$oLangs->query();
|
||||
$cApiLanguageCollection = new cApiLanguageCollection();
|
||||
$cApiLanguageCollection->setOrder("idlang");
|
||||
$cApiLanguageCollection->query();
|
||||
|
||||
if ($oLangs->count() > 0) {
|
||||
if ($cApiLanguageCollection->count() > 0) {
|
||||
$iIDMod = $this->get($this->primaryKey);
|
||||
while ($oLang = $oLangs->next()) {
|
||||
while ($oLang = $cApiLanguageCollection->next()) {
|
||||
$iID = $oLang->get($oLang->primaryKey);
|
||||
|
||||
if (in_array($iID, $aData["translations"])) {
|
||||
$oNodeTrans = & $oRoot->appendChild("translations");
|
||||
$oNodeTrans = &$oRoot->appendChild("translations");
|
||||
// This is nice, but it doesn't help so much,
|
||||
// as this data is available too late on import ...
|
||||
$oNodeTrans->setNodeAttribs(array("origin-language-id" => $iID,
|
||||
"origin-language-name" => clHtmlSpecialChars($oLang->get("name"))));
|
||||
$oNodeTrans->setNodeAttribs(["origin-language-id" => $iID, "origin-language-name" => clHtmlSpecialChars($oLang->get("name"))]);
|
||||
// ... so we store the important information with the data
|
||||
$oNodeTrans->appendChild("language", clHtmlSpecialChars($oLang->get("name")));
|
||||
|
||||
|
@ -849,24 +840,24 @@ class cApiModule extends Item {
|
|||
$oTranslations->query();
|
||||
|
||||
while ($oTranslation = $oTranslations->next()) {
|
||||
$oNodeString = & $oNodeTrans->appendChild("string");
|
||||
$oNodeString = &$oNodeTrans->appendChild("string");
|
||||
$oNodeString->appendChild("original", clHtmlSpecialChars($oTranslation->get("original")));
|
||||
$oNodeString->appendChild("translation", clHtmlSpecialChars($oTranslation->get("translation")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($oLangs);
|
||||
unset($cApiLanguageCollection);
|
||||
unset($oLang);
|
||||
|
||||
if ($bReturn == false) {
|
||||
ob_end_clean();
|
||||
header("Content-Type: text/xml");
|
||||
header("Etag: " . md5(mt_rand()));
|
||||
header("Etag: " . md5(random_int(0, mt_getrandmax())));
|
||||
header("Content-Disposition: attachment;filename=\"$sPackageFileName\"");
|
||||
$oTree->dump(false);
|
||||
$xmlTree->dump(false);
|
||||
} else {
|
||||
return stripslashes($oTree->dump(true));
|
||||
return stripslashes($xmlTree->dump(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -874,7 +865,7 @@ class cApiModule extends Item {
|
|||
|
||||
/**
|
||||
* Overridden parent method for hooking dceModFileEdit
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _onLoad() {
|
||||
|
@ -886,7 +877,7 @@ class cApiModule extends Item {
|
|||
|
||||
/**
|
||||
* Use a PHP-file, if present, for module output
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function _setOutputFromPhpFile() {
|
||||
|
@ -899,7 +890,7 @@ class cApiModule extends Item {
|
|||
|
||||
/**
|
||||
* Use a PHP-file, if present, for module input
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function _setInputFromPhpFile() {
|
||||
|
@ -912,7 +903,7 @@ class cApiModule extends Item {
|
|||
}
|
||||
|
||||
private function _displayNoteFromFile($bIsOldPath = FALSE) {
|
||||
if ($this->_bNoted === true) {
|
||||
if (property_exists($this, '_bNoted') && $this->_bNoted !== null && $this->_bNoted === true) {
|
||||
return;
|
||||
}
|
||||
global $frame, $area;
|
||||
|
@ -921,23 +912,22 @@ class cApiModule extends Item {
|
|||
if ($bIsOldPath) {
|
||||
$sAddMess .= "<br>" . i18n("Using old CamelCase for name of modulefolder. You may lowercase the name for modulefolder");
|
||||
}
|
||||
$oNote = new Contenido_Notification();
|
||||
$oNote->displayNotification('warning', i18n("Module uses Output- and/or InputFromFile. Editing and Saving may not be possible in backend.") . $sAddMess);
|
||||
$contenidoNotification = new Contenido_Notification();
|
||||
$contenidoNotification->displayNotification('warning', i18n("Module uses Output- and/or InputFromFile. Editing and Saving may not be possible in backend.") . $sAddMess);
|
||||
$this->_bNoted = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* read file and set an object field
|
||||
*
|
||||
* @param string $sFile
|
||||
*
|
||||
* @param string $sFile
|
||||
* @param string $sField
|
||||
* @return boolean
|
||||
*/
|
||||
private function _setFieldFromFile($sField, $sFile) {
|
||||
private function _setFieldFromFile($sField, $sFile): bool {
|
||||
$bIsOldPath = TRUE;
|
||||
$sFile = strtolower($sFile);
|
||||
if (FALSE === strstr($sFile, $this->_aModFileEditConf['modPath'])) {
|
||||
if (!str_contains($sFile, $this->_aModFileEditConf['modPath'])) {
|
||||
$sFile = $this->_aModFileEditConf['modPath'] . $sFile;
|
||||
}
|
||||
// check for new struct since CL 2.0
|
||||
|
@ -982,17 +972,12 @@ class cApiModule extends Item {
|
|||
}
|
||||
|
||||
public function isLoadedFromFile($sWhat = "all") {
|
||||
switch ($sWhat) {
|
||||
case "all":
|
||||
return (($this->_bOutputFromFile || $this->_bInputFromFile) ? TRUE : FALSE);
|
||||
break;
|
||||
case "output":
|
||||
return $this->_bOutputFromFile;
|
||||
case "input":
|
||||
return $this->_bInputFromFile;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return match ($sWhat) {
|
||||
"all" => $this->_bOutputFromFile || $this->_bInputFromFile,
|
||||
"output" => $this->_bOutputFromFile,
|
||||
"input" => $this->_bInputFromFile,
|
||||
default => false,
|
||||
};
|
||||
}
|
||||
|
||||
/* End dceModFileEdit (c)2009-2012 www.dceonline.de */
|
||||
|
@ -1012,10 +997,7 @@ class cApiModule extends Item {
|
|||
|
||||
private function _createModulePhpFiles() {
|
||||
$sPath = $this->_sModPath . "php/";
|
||||
$aFileTpl = array(
|
||||
'output' => "<?php\n\n?>",
|
||||
'input' => "?><?php\n\n?><?php"
|
||||
);
|
||||
$aFileTpl = ['output' => "<?php\n\n?>", 'input' => "?><?php\n\n?><?php"];
|
||||
|
||||
if (is_writable($sPath)) {
|
||||
$sOutputFile = $sPath . $this->_sModAlias . "_output.php";
|
||||
|
@ -1053,6 +1035,8 @@ class cApiModuleTranslationCollection extends ItemCollection {
|
|||
|
||||
protected $_error;
|
||||
|
||||
protected $f_obj;
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param none
|
||||
|
@ -1069,8 +1053,8 @@ class cApiModuleTranslationCollection extends ItemCollection {
|
|||
public function create($idmod, $idlang, $original, $translation = false) {
|
||||
// Check if the original already exists. If it does,
|
||||
// update the translation if passed
|
||||
$mod = new cApiModuleTranslation();
|
||||
$sorg = $mod->_inFilter($original);
|
||||
$cApiModuleTranslation = new cApiModuleTranslation();
|
||||
$sorg = $cApiModuleTranslation->_inFilter($original);
|
||||
|
||||
$this->select("idmod = '$idmod' AND idlang = '$idlang' AND original = '$sorg'");
|
||||
|
||||
|
@ -1126,21 +1110,20 @@ class cApiModuleTranslationCollection extends ItemCollection {
|
|||
public function import($idmod, $idlang, $file) {
|
||||
global $_mImport;
|
||||
|
||||
$parser = new XmlParser("ISO-8859-1");
|
||||
$clXmlParser = new clXmlParser("ISO-8859-1");
|
||||
|
||||
$parser->setEventHandlers(array("/module/translation/string/original" => "cHandler_ItemName",
|
||||
"/module/translation/string/translation" => "cHandler_Translation"));
|
||||
$clXmlParser->setEventHandlers(["/module/translation/string/original" => "cHandler_ItemName", "/module/translation/string/translation" => "cHandler_Translation"]);
|
||||
|
||||
$_mImport["current_item_area"] = "current"; // Pre-specification, as this won't be set from the XML file (here)
|
||||
|
||||
if ($parser->parseFile($file)) {
|
||||
if ($clXmlParser->parseFile($file)) {
|
||||
foreach ($_mImport["translations"]["current"] as $sOriginal => $sTranslation) {
|
||||
$this->create($idmod, $idlang, $sOriginal, $sTranslation);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
$this->_error = $parser->error;
|
||||
$this->_error = $clXmlParser->error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1154,21 +1137,20 @@ class cApiModuleTranslationCollection extends ItemCollection {
|
|||
* @param $return boolean if false, the result is immediately sent to the browser
|
||||
*/
|
||||
public function export($idmod, $idlang, $filename, $return = false) {
|
||||
$langobj = new cApiLanguage($idlang);
|
||||
$cApiLanguage = new cApiLanguage($idlang);
|
||||
|
||||
#$langstring = $langobj->get("name") . ' ('.$idlang.')';
|
||||
|
||||
$translations = new cApiModuleTranslationCollection;
|
||||
$translations->select("idmod = '$idmod' AND idlang='$idlang'");
|
||||
$cApiModuleTranslationCollection = new cApiModuleTranslationCollection;
|
||||
$cApiModuleTranslationCollection->select("idmod = '$idmod' AND idlang='$idlang'");
|
||||
|
||||
$tree = new XmlTree('1.0', 'ISO-8859-1');
|
||||
$root = & $tree->addRoot('module');
|
||||
$xmlTree = new XmlTree('1.0', 'ISO-8859-1');
|
||||
$root = &$xmlTree->addRoot('module');
|
||||
|
||||
$translation = & $root->appendChild('translation');
|
||||
$translation->setNodeAttribs(array("origin-language-id" => $idlang,
|
||||
"origin-language-name" => $langobj->get("name")));
|
||||
$translation = &$root->appendChild('translation');
|
||||
$translation->setNodeAttribs(["origin-language-id" => $idlang, "origin-language-name" => $cApiLanguage->get("name")]);
|
||||
|
||||
while ($otranslation = $translations->next()) {
|
||||
while ($otranslation = $cApiModuleTranslationCollection->next()) {
|
||||
$string = &$translation->appendChild("string");
|
||||
|
||||
$string->appendChild("original", clHtmlSpecialChars($otranslation->get("original")));
|
||||
|
@ -1177,11 +1159,11 @@ class cApiModuleTranslationCollection extends ItemCollection {
|
|||
|
||||
if ($return == false) {
|
||||
header("Content-Type: text/xml");
|
||||
header("Etag: " . md5(mt_rand()));
|
||||
header("Etag: " . md5(random_int(0, mt_getrandmax())));
|
||||
header("Content-Disposition: attachment;filename=\"$filename\"");
|
||||
$tree->dump(false);
|
||||
$xmlTree->dump(false);
|
||||
} else {
|
||||
return $tree->dump(true);
|
||||
return $xmlTree->dump(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.3
|
||||
* @author Timo Hummel
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
class gdbDriver {
|
||||
|
||||
var $_sEncoding;
|
||||
var $_oItemClassInstance;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function setEncoding($sEncoding) {
|
||||
$this->_sEncoding = $sEncoding;
|
||||
}
|
||||
|
||||
public function setItemClassInstance($oInstance) {
|
||||
$this->_oItemClassInstance = $oInstance;
|
||||
}
|
||||
|
||||
public function buildJoinQuery($destinationTable, $destinationClass, $destinationPrimaryKey, $sourceClass, $primaryKey) {
|
||||
|
||||
}
|
||||
|
||||
public function buildOperator($sField, $sOperator, $sRestriction) {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,8 +0,0 @@
|
|||
This directory contains driver classes for use with Contenido's GenericDB. These
|
||||
drivers are responsible for building joins and handling database metadata, but
|
||||
NOT for sending queries and returning results.
|
||||
|
||||
Dieses Verzeichnis enthält Treiberklassen für die Verwendung mit der Contenido
|
||||
GenericDB. Diese Treiber sind ausschließlich dafür da, um Joins aufzubauen und
|
||||
um die Metadaten zu verwalten. Sie sind NICHT für das Senden von Queries oder
|
||||
das zurückgeben von Query-Ergebnissen zuständig.
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* File:
|
||||
* class.frontend.navigation.abstract.php
|
||||
*
|
||||
* Description:
|
||||
* Abstract Class for Frontend Navigations
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Frontend
|
||||
* @version $Rev$
|
||||
* @since 2.0
|
||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
||||
* @copyright (c) 2016, conlite.org
|
||||
* @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version)
|
||||
* @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version)
|
||||
* @link http://www.conlite.org ConLite.org
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
// security check
|
||||
defined('CON_FRAMEWORK') or die('Illegal call');
|
||||
|
||||
class cFrontendNavigationAbstract {
|
||||
|
||||
/**
|
||||
*
|
||||
* @var DB_ConLite
|
||||
*/
|
||||
protected $_oDB;
|
||||
|
||||
public function __construct() {
|
||||
;
|
||||
}
|
||||
|
||||
protected function _getDB() {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* File:
|
||||
* class.frontend.navigation.php
|
||||
*
|
||||
* Description:
|
||||
* Helper Class for Frontend Navigations
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Frontend
|
||||
* @version $Rev$
|
||||
* @since 2.0
|
||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
||||
* @copyright (c) 2016, conlite.org
|
||||
* @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version)
|
||||
* @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version)
|
||||
* @link http://www.conlite.org ConLite.org
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
// security check
|
||||
defined('CON_FRAMEWORK') or die('Illegal call');
|
||||
|
||||
class cFrontendNavigation extends cFrontendNavigationAbstract {
|
||||
//put your code here
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
class cGuiFileList {
|
||||
|
||||
protected $_sPath;
|
||||
protected $_mFileExt;
|
||||
protected $_iScanDepth;
|
||||
protected $_aDirItems;
|
||||
protected $_bWritable;
|
||||
protected $_oTpl;
|
||||
|
||||
public function __construct($sPath, $mFileExt = null) {
|
||||
|
||||
if (!empty($mFileExt) && is_string($mFileExt)) {
|
||||
$mFileExt = [strtolower($mFileExt)];
|
||||
}
|
||||
$this->_sPath = $sPath;
|
||||
$this->_mFileExt = $mFileExt;
|
||||
$this->_iScanDepth = 3;
|
||||
$this->_oTpl = new Template();
|
||||
}
|
||||
|
||||
public function scanDir() {
|
||||
if (empty($this->_sPath) || !is_readable($this->_sPath)) {
|
||||
return false;
|
||||
}
|
||||
$this->_bWritable = (!is_writable($this->_sPath)) ? true : false;
|
||||
|
||||
$this->_aDirItems = $this->_assetsMap($this->_sPath, $this->_iScanDepth);
|
||||
asort($this->_aDirItems, SORT_STRING | SORT_FLAG_CASE | SORT_NATURAL);
|
||||
}
|
||||
|
||||
public function renderList($sTpl = null, $bReturn = false) {
|
||||
global $sess, $area;
|
||||
$sList = '<ul id="treeData" style="display: none;">' . "\n";
|
||||
foreach ($this->_aDirItems as $key => $item) {
|
||||
if (is_array($item)) {
|
||||
$sList .= $this->_getSubItems($key, $item, $this->_sPath);
|
||||
} else {
|
||||
$sAddClass = (is_writable($this->_sPath . $item)) ? '' : ' notwritable';
|
||||
$sList .= '<li class="file' . $sAddClass . '" data-filepath="' . $item . '">' . $item . '</li>' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$sList .= '</ul>' . "\n";
|
||||
$this->_oTpl->set('s', 'item_list', $sList);
|
||||
|
||||
$this->_oTpl->set('s', 'multilink1', $sess->url("main.php?area=$area&frame=3&file=\${file}"));
|
||||
$this->_oTpl->set('s', 'multilink2', $sess->url("main.php?area=$area&frame=4&action=js_edit&file=\${file}&tmp_file=\${file}"));
|
||||
|
||||
$this->_oTpl->generate(cRegistry::getConfigValue('path', 'contenido') . cRegistry::getConfigValue('path', 'templates') . "html5/file_list.html", $bReturn);
|
||||
}
|
||||
|
||||
protected function _getSubItems($sName, $aItems, $sPathToItem) {
|
||||
$sPathToItem = $sPathToItem . $sName . DIRECTORY_SEPARATOR;
|
||||
$sItemListEntry = '<li class="folder directory">' . $sName . "\n\t";
|
||||
if (is_array($aItems) && count($aItems) > 0) {
|
||||
$sItemListEntry .= '<ul data-filepath="' . $sPathToItem . '">' . "\n\t";
|
||||
foreach ($aItems as $key => $item) {
|
||||
if (is_array($item)) {
|
||||
$sItemListEntry .= $this->_getSubItems($key, $item, $sPathToItem);
|
||||
} else {
|
||||
$sAddClass = (is_writable($sPathToItem . $item)) ? '' : ' notwritable';
|
||||
$sItemListEntry .= '<li class="file' . $sAddClass . '" data-filepath="' . str_replace($this->_sPath, '', $sPathToItem . $item) . '">' . $item . '</li>' . "\n";
|
||||
}
|
||||
}
|
||||
$sItemListEntry .= '</ul>' . "\n";
|
||||
}
|
||||
$sItemListEntry .= '</li>' . "\n";
|
||||
return $sItemListEntry;
|
||||
}
|
||||
|
||||
protected function _assetsMap($source_dir, $directory_depth = 0, $hidden = false) {
|
||||
if ($fp = @opendir($source_dir)) {
|
||||
$filedata = array();
|
||||
$new_depth = $directory_depth - 1;
|
||||
$source_dir = rtrim($source_dir, '/') . '/';
|
||||
|
||||
while (FALSE !== ($file = readdir($fp))) {
|
||||
// Remove '.', '..', and hidden files [optional]
|
||||
if (!trim($file, '.') OR ($hidden == false && $file[0] == '.')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (($directory_depth < 1 OR $new_depth > 0) && is_dir($source_dir . $file)) {
|
||||
$aTmp = $this->_assetsMap($source_dir . $file . '/', $new_depth, $hidden);
|
||||
if (!empty($aTmp)) {
|
||||
asort($aTmp, SORT_STRING | SORT_FLAG_CASE | SORT_NATURAL);
|
||||
$filedata[$file] = $aTmp;
|
||||
}
|
||||
unset($aTmp);
|
||||
} else {
|
||||
$sFileExt = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
if (!empty($this->_mFileExt) && in_array($sFileExt, $this->_mFileExt)) {
|
||||
$filedata[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir($fp);
|
||||
return $filedata;
|
||||
}
|
||||
echo 'can not open dir';
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
|
||||
|
||||
|
||||
class cGuiPage {
|
||||
|
||||
|
||||
public function __construct($sPageName, $sPluginName = '', $sSubMenu = '') {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,393 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file contains the log class.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
* @version SVN Revision $Rev$
|
||||
*
|
||||
* @author Dominik Ziegler
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
|
||||
|
||||
/**
|
||||
* This class contains the main functionalities for the logging in CONTENIDO.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* $writer = cLogWriter::factory("File", array('destination' => 'contenido.log'));
|
||||
* $log = new cLog($writer);
|
||||
*
|
||||
* $log->addPriority("CONTENIDO", 10);
|
||||
* $log->log("Contenido Log Message.", "CONTENIDO");
|
||||
* $log->contenido("Same log entry in short notation.");
|
||||
* $log->removePriority("CONTENIDO");
|
||||
*
|
||||
* $log->emerg("System down.");
|
||||
*
|
||||
* $log->log('Notice Log Message', cLog::NOTICE);
|
||||
*
|
||||
* $log->buffer('Buffered Log Message', cLog::WARN);
|
||||
* $log->commit();
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
*/
|
||||
class cLog {
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const EMERG = 0;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const ALERT = 1;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const CRIT = 2;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const ERR = 3;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const WARN = 4;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const NOTICE = 5;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const INFO = 6;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const DEBUG = 7;
|
||||
|
||||
/**
|
||||
* @var cLogWriter Contains the local log writer instance.
|
||||
*/
|
||||
protected $_writer;
|
||||
|
||||
/**
|
||||
* @var array Contains all shortcut handlers
|
||||
*/
|
||||
protected $_shortcutHandlers = array();
|
||||
|
||||
/**
|
||||
* @var array Contains all available priorities
|
||||
*/
|
||||
protected $_priorities = array();
|
||||
|
||||
/**
|
||||
* @var array Contains all default priorities
|
||||
*/
|
||||
protected $_defaultPriorities = array();
|
||||
|
||||
/**
|
||||
* @var array Contains all buffered messages
|
||||
*/
|
||||
protected $_buffer = array();
|
||||
|
||||
/**
|
||||
* Creates a new instance of the CONTENIDO Log mechanism.
|
||||
*
|
||||
* The log format interface of cLog is capable of being extended by subclasses. See the note about
|
||||
* the log shortcuts below.
|
||||
*
|
||||
*
|
||||
* About Log Shortcuts
|
||||
* -------------------
|
||||
* Log shortcuts are placeholders which are replaced when a log entry is created. Placeholders start with a
|
||||
* percentage sign (%) and contain one or more characters. Each placeholder is handled by an own function which
|
||||
* decides what to do.
|
||||
*
|
||||
* @param mixed $writer Writer object (any subclass of cLogWriter), or false if cLog should handle the writer creation
|
||||
*/
|
||||
public function __construct($writer = false) {
|
||||
$cfg = cRegistry::getConfig();
|
||||
|
||||
$createWriter = false;
|
||||
|
||||
if ($writer == false) {
|
||||
$createWriter = true;
|
||||
} else if (!is_object($writer) || ($writer instanceof cLogWriter) == false) {
|
||||
cWarning(__FILE__, __LINE__, "The passed class is not a subclass of cLogWriter. Creating new one.");
|
||||
$createWriter = true;
|
||||
}
|
||||
|
||||
if ($createWriter == true) {
|
||||
$options = array(
|
||||
'destination' => cRegistry::getConfigValue('path', 'contenido')
|
||||
.cRegistry::getConfigValue('path', 'logs')
|
||||
.'contenido.log');
|
||||
$writer = cLogWriter::factory("File", $options);
|
||||
}
|
||||
|
||||
$this->setWriter($writer);
|
||||
$this->setShortcutHandler("%date", array($this, "shDate"));
|
||||
$this->setShortcutHandler("%level", array($this, "shLevel"));
|
||||
$this->setShortcutHandler("%message", array($this, "shMessage"));
|
||||
|
||||
$this->getWriter()->setOption('log_format', '[%date] [%level] %message', false);
|
||||
|
||||
$reflection = new ReflectionClass($this);
|
||||
$this->_priorities = $this->_defaultPriorities = array_flip($reflection->getConstants());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local writer instance.
|
||||
* @return cLogWriter
|
||||
*/
|
||||
public function getWriter() {
|
||||
return $this->_writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the local writer instance.
|
||||
*
|
||||
* @param cLogWriter $writer Writer instacne
|
||||
*/
|
||||
public function setWriter(cLogWriter $writer) {
|
||||
$this->_writer = $writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a custom shortcut handler.
|
||||
*
|
||||
* Each shortcut handler receives an array with the
|
||||
* message and the priority of the entry.
|
||||
*
|
||||
* @param string $shortcut Shortcut name
|
||||
* @param string $handler Name of the function to call
|
||||
* @throws cInvalidArgumentException if the given shortcut is empty or
|
||||
* already in use or if the handler is not callable
|
||||
* @return bool True if setting was successful
|
||||
*/
|
||||
public function setShortcutHandler($shortcut, $handler) {
|
||||
if ($shortcut == '') {
|
||||
throw new Exception('The shortcut name must not be empty.');
|
||||
}
|
||||
|
||||
if (substr($shortcut, 0, 1) == "%") {
|
||||
$shortcut = substr($shortcut, 1);
|
||||
}
|
||||
|
||||
if (is_callable($handler) == false) {
|
||||
throw new Exception('The specified shortcut handler does not exist.');
|
||||
}
|
||||
|
||||
if (array_key_exists($shortcut, $this->_shortcutHandlers)) {
|
||||
throw new Exception('The shortcut ' . $shortcut . ' is already in use!');
|
||||
}
|
||||
|
||||
$this->_shortcutHandlers[$shortcut] = $handler;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets a specific shortcut handler.
|
||||
*
|
||||
* @param string $shortcut Name of the shortcut
|
||||
* @throws cInvalidArgumentException if the given shortcut handler does not
|
||||
* exist
|
||||
* @return boolean
|
||||
*/
|
||||
public function unsetShortcutHandler($shortcut) {
|
||||
if (!in_array($shortcut, $this->_shortcutHandlers)) {
|
||||
throw new Exception('The specified shortcut handler does not exist.');
|
||||
}
|
||||
|
||||
unset($this->_shortcutHandlers[$shortcut]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buffers a log message for committing them on a later moment.
|
||||
*
|
||||
* @param string $message Message to buffer
|
||||
* @param mixed $priority Priority of the log entry (optional)
|
||||
*/
|
||||
public function buffer($message, $priority = NULL) {
|
||||
$this->_buffer[] = array($message, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Commits all buffered messages and empties the message buffer if parameter is not false.
|
||||
*
|
||||
* @param boolean $revoke Flag, whether the buffer is cleared or not (optional, default: true)
|
||||
*/
|
||||
public function commit($revoke = true) {
|
||||
if (count($this->_buffer) == 0) {
|
||||
cWarning(__FILE__, __LINE__, "There are no buffered messages to commit.");
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->_buffer as $bufferInfo) {
|
||||
$this->log($bufferInfo[0], $bufferInfo[1]);
|
||||
}
|
||||
|
||||
if ($revoke == true) {
|
||||
$this->revoke();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Empties the message buffer.
|
||||
*/
|
||||
public function revoke() {
|
||||
$this->_buffer = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a message using the local writer instance
|
||||
*
|
||||
* @param string $message Message to log
|
||||
* @param mixed $priority Priority of the log entry (optional)
|
||||
*/
|
||||
public function log($message, $priority = NULL) {
|
||||
if ($priority && is_int($priority) == false && in_array($priority, $this->_priorities)) {
|
||||
$priority = array_search($priority, $this->_priorities);
|
||||
}
|
||||
|
||||
if ($priority === NULL || array_key_exists($priority, $this->_priorities) == false) {
|
||||
$priority = $this->getWriter()->getOption('default_priority');
|
||||
}
|
||||
|
||||
$logMessage = $this->getWriter()->getOption('log_format');
|
||||
$lineEnding = $this->getWriter()->getOption('line_ending');
|
||||
|
||||
foreach ($this->_shortcutHandlers as $shortcut => $handler) {
|
||||
if (substr($shortcut, 0, 1) != "%") {
|
||||
$shortcut = "%" . $shortcut;
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'message' => $message,
|
||||
'priority' => $priority
|
||||
);
|
||||
|
||||
$value = call_user_func($handler, $info);
|
||||
|
||||
$logMessage = str_replace($shortcut, $value, $logMessage);
|
||||
}
|
||||
|
||||
$this->getWriter()->write($logMessage . $lineEnding, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new priority to the log.
|
||||
*
|
||||
* @param string $name Name of the log priority
|
||||
* @param int $value Index value of the log priority
|
||||
* @throws cInvalidArgumentException if the given name is empty, already
|
||||
* exists or the value already exists
|
||||
*/
|
||||
public function addPriority($name, $value) {
|
||||
if ($name == '') {
|
||||
throw new Exception('Priority name must not be empty.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->_priorities)) {
|
||||
throw new Exception('The given priority name already exists.');
|
||||
}
|
||||
|
||||
if (array_key_exists($value, $this->_priorities)) {
|
||||
throw new Exception('The priority value already exists.');
|
||||
}
|
||||
|
||||
$this->_priorities[$value] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a priority from log.
|
||||
* Default properties can not be removed.
|
||||
*
|
||||
* @param string $name Name of the log priority to remove
|
||||
* @throws cInvalidArgumentException if the given name is empty, does not
|
||||
* exist or is a default priority
|
||||
*/
|
||||
public function removePriority($name) {
|
||||
if ($name == '') {
|
||||
throw new Exception('Priority name must not be empty.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->_priorities) == false) {
|
||||
throw new Exception('Priority name does not exist.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->_defaultPriorities) == true) {
|
||||
throw new Exception('Removing default priorities is not allowed.');
|
||||
}
|
||||
|
||||
$priorityIndex = array_search($name, $this->_priorities);
|
||||
|
||||
unset($this->_priorities[$priorityIndex]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic call method for direct priority named calls.
|
||||
*
|
||||
* @param string $method Name of the method
|
||||
* @param array $arguments Array with the method arguments
|
||||
* @throws cInvalidArgumentException if the given priority is not supported
|
||||
*/
|
||||
public function __call($method, $arguments) {
|
||||
$priorityName = strtoupper($method);
|
||||
|
||||
if (in_array($priorityName, $this->_priorities) == false) {
|
||||
throw new Exception('The given priority ' . $priorityName . ' is not supported.');
|
||||
}
|
||||
|
||||
$priorityIndex = array_search($priorityName, $this->_priorities);
|
||||
|
||||
return $this->log($arguments[0], $priorityIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Date.
|
||||
* Returns the current date
|
||||
* @return string The current date
|
||||
*/
|
||||
public function shDate() {
|
||||
return date("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Level.
|
||||
* Returns the canonical name of the priority.
|
||||
* The canonical name is padded to 10 characters to achieve a better formatting.
|
||||
* @return string The canonical log level
|
||||
*/
|
||||
public function shLevel($info) {
|
||||
$logLevel = $info['priority'];
|
||||
return str_pad($this->_priorities[$logLevel], 10, " ", STR_PAD_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Message.
|
||||
* Returns the log message.
|
||||
* @return string The log message
|
||||
*/
|
||||
public function shMessage($info) {
|
||||
return $info['message'];
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file contains the log file writer class.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
* @version SVN Revision $Rev$
|
||||
*
|
||||
* @author Dominik Ziegler
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
|
||||
|
||||
/**
|
||||
* This class contains the file writer class for the logging mechanism.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
*/
|
||||
class cLogWriterFile extends cLogWriter {
|
||||
/**
|
||||
* @var resource Destination handle
|
||||
*/
|
||||
protected $_handle = NULL;
|
||||
|
||||
/**
|
||||
* Constructor of the writer instance.
|
||||
* @param array $options Array with options for the writer instance (optional)
|
||||
*/
|
||||
public function __construct($options = array()) {
|
||||
parent::__construct($options);
|
||||
|
||||
$this->_createHandle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks destination and creates the handle for the write process.
|
||||
*
|
||||
* @throws cException if not destination is specified
|
||||
* @throws cFileNotFoundException if the destination file could not be read
|
||||
*/
|
||||
protected function _createHandle() {
|
||||
$destination = $this->getOption('destination');
|
||||
if ($destination == '') {
|
||||
throw new Exception('No destination was specified.');
|
||||
}
|
||||
|
||||
if (($this->_handle = fopen($destination, 'a')) === false) {
|
||||
throw new Exception('Destination handle could not be created.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the content to file handle.
|
||||
*
|
||||
* @param string $message Message to write
|
||||
* @param int $priority Priority of the log entry
|
||||
* @return boolean State of the write process
|
||||
*/
|
||||
public function write($message, $priority) {
|
||||
return (fwrite($this->_handle, $message) != false);
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file contains the abstract log writer class.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
* @version SVN Revision $Rev$
|
||||
*
|
||||
* @author Dominik Ziegler
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
|
||||
|
||||
/**
|
||||
* This class contains the main functionalities for the logging writer in CONTENIDO.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
*/
|
||||
abstract class cLogWriter {
|
||||
/**
|
||||
* @var array Contains all options of the current writer instance.
|
||||
*/
|
||||
protected $_options = array();
|
||||
|
||||
/**
|
||||
* Constructor of the writer instance.
|
||||
* @param array $options Array with options for the writer instance (optional)
|
||||
*/
|
||||
public function __construct($options = array()) {
|
||||
$this->setOptions($options);
|
||||
|
||||
// Set all default options if they were not set already
|
||||
$this->setOption('default_priority', cLog::INFO, false);
|
||||
$this->setOption('line_ending', PHP_EOL, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for a new writer instance.
|
||||
*
|
||||
* @param string $writerName Name of the writer
|
||||
* @param array $writerOptions Options array for the writer instance
|
||||
* @throws cInvalidArgumentException if the writer class with the given name
|
||||
* does not exist or is not an instance of clogWriter
|
||||
* @return cLogWriter Log writer instance
|
||||
*/
|
||||
public static function factory($writerName, array $writerOptions) {
|
||||
$logWriterClassName = 'cLogWriter' . ucfirst($writerName);
|
||||
if (!class_exists($logWriterClassName)) {
|
||||
throw new Exception('Unknown writer class: ' . $writerName);
|
||||
}
|
||||
|
||||
$writer = new $logWriterClassName($writerOptions);
|
||||
if (($writer instanceof cLogWriter) == false) {
|
||||
throw new Exception('Provided class is not an instance of cLogWriter');
|
||||
}
|
||||
|
||||
return $writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the whole options array.
|
||||
*
|
||||
* @param array $options Array with options
|
||||
*/
|
||||
public function setOptions(array $options) {
|
||||
$this->_options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all options.
|
||||
* @return array Array with all options
|
||||
*/
|
||||
public function getOptions() {
|
||||
return $this->_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a option. If option was set previously, it must be forced to overwrite the value.
|
||||
*
|
||||
* @param string $option Name of the option
|
||||
* @param mixed $value Value of the option
|
||||
* @param boolean $force Flag to force setting the option value (optional, default: false)
|
||||
*/
|
||||
public function setOption($option, $value, $force = false) {
|
||||
if ($force == false && isset($this->_options[$option]) == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_options[$option] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of an option entry.
|
||||
*
|
||||
* @param string $option Name of the option
|
||||
*
|
||||
* @return mixed Value of the option entry
|
||||
*/
|
||||
public function getOption($option) {
|
||||
return $this->_options[$option];
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an option entry.
|
||||
*
|
||||
* @param string $option Name of the option
|
||||
*/
|
||||
public function removeOption($option) {
|
||||
unset($this->_options[$option]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract function for the write process.
|
||||
* This method must be implemented in the specific writer.
|
||||
*
|
||||
* @param string $message Message to write
|
||||
* @param int $priority Priority of the log entry
|
||||
*
|
||||
* @return boolean State of the write process
|
||||
*/
|
||||
abstract function write($message, $priority);
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file contains the module log class.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
* @version SVN Revision $Rev$
|
||||
*
|
||||
* @author Dominik Ziegler
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
|
||||
|
||||
/**
|
||||
* This class contains the main functionalities for the module logging in
|
||||
* CONTENIDO.
|
||||
* The funcationality is almost the same like normal logging with the exception,
|
||||
* that log entries contains an additional information about the used module.
|
||||
*
|
||||
* Example:
|
||||
* $writer = cLogWriter::factory("File", array('destination' =>
|
||||
* 'contenido.log'));
|
||||
*
|
||||
* $log = new cModuleLog($writer);
|
||||
* $log->setModule(1);
|
||||
* $log->log("Anything you want to log.");
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
*/
|
||||
class cModuleLog extends cLog {
|
||||
|
||||
/**
|
||||
* @var cApiModule instance of module model
|
||||
*/
|
||||
private $_module;
|
||||
|
||||
/**
|
||||
* Constructor of the module log.
|
||||
*
|
||||
* @param mixed $writer Writer object (any subclass of cLogWriter), or false
|
||||
* if cLog should handle the writer creation
|
||||
*
|
||||
*/
|
||||
public function __construct($writer = false) {
|
||||
parent::__construct($writer);
|
||||
|
||||
$this->setShortcutHandler('module', array(
|
||||
$this,
|
||||
'shModule'
|
||||
));
|
||||
$this->getWriter()->setOption("log_format", "[%date] [%level] [%module] %message", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the module to use.
|
||||
*
|
||||
* setModule automatically buffers basic module information to the log to
|
||||
* assist the developer in debugging his modules.
|
||||
*
|
||||
* @param int $idmod The module ID to use
|
||||
* @throws cException if the module with the given idmod could not be loaded
|
||||
*/
|
||||
public function setModule($idmod) {
|
||||
$this->_module = new cApiModule($idmod);
|
||||
if ($this->_module->isLoaded() == false) {
|
||||
throw new Exception('Could not load module information.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Module.
|
||||
* Returns the ID and the name of the module.
|
||||
*
|
||||
* @return string ID and name of the module
|
||||
*/
|
||||
public function shModule() {
|
||||
if ($this->_module->isLoaded() == false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->_module->get("idmod") . ": " . $this->_module->get("name");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -184,7 +184,6 @@ class Template {
|
|||
global $cCurrentModule;
|
||||
|
||||
$cfg = cRegistry::getConfig();
|
||||
$aCfgClient = cRegistry::getClientConfig(cRegistry::getClientId());
|
||||
$bModTplUsed = FALSE;
|
||||
|
||||
if (isset($cCurrentModule) && $cfg['dceModEdit']['use']) {
|
||||
|
@ -201,15 +200,19 @@ class Template {
|
|||
}
|
||||
}
|
||||
|
||||
if (is_file("templates/" . $template) && !$bModTplUsed) {
|
||||
$template = "templates/" . $template;
|
||||
if (is_file(cRegistry::getFrontendPath() . "templates/" . $template) && !$bModTplUsed) {
|
||||
$template = cRegistry::getFrontendPath() . "templates/" . $template;
|
||||
}
|
||||
|
||||
//check if the template is a file or a string
|
||||
if (!is_file($template)) {
|
||||
$content = & $template; //template is a string (it is a reference to save memory!!!)
|
||||
} else {
|
||||
$content = implode("", file($template)); //template is a file
|
||||
if(cFileHandler::readable($template)) {
|
||||
$content = implode("", file($template)); //template is a file
|
||||
} else {
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
|
||||
$content = (($note) ? "<!-- Generated by ConLite " . $cfg['version'] . "-->\n" : "") . $content;
|
||||
|
|
|
@ -320,8 +320,12 @@ class cPage extends cHTML {
|
|||
}
|
||||
|
||||
$meta = '';
|
||||
if ($this->_encoding != "" && !$this->_isHtml5) {
|
||||
$meta .= '<meta http-equiv="Content-type" content="text/html;charset=' . $this->_encoding . '">' . "\n";
|
||||
if(!empty($this->_encoding)) {
|
||||
if($this->_isHtml5) {
|
||||
$meta .= '<meta charset="' . $this->_encoding . '">' . "\n";
|
||||
} else {
|
||||
$meta .= '<meta http-equiv="Content-type" content="text/html;charset=' . $this->_encoding . '">' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->_object !== false && method_exists($this->_object, "render")) {
|
||||
|
|
|
@ -25,27 +25,26 @@ if (!defined("CON_FRAMEWORK")) {
|
|||
// Contenido startup process
|
||||
include_once ('../includes/startup.php');
|
||||
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.con.php');
|
||||
$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes');
|
||||
$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes');
|
||||
|
||||
include_once ($classPath . 'class.user.php');
|
||||
include_once ($classPath . 'class.xml.php');
|
||||
include_once ($classPath . 'class.navigation.php');
|
||||
include_once ($classPath . 'template/class.template.php');
|
||||
include_once ($classPath . 'class.backend.php');
|
||||
include_once ($classPath . 'class.table.php');
|
||||
include_once ($classPath . 'class.notification.php');
|
||||
include_once ($classPath . 'class.area.php');
|
||||
include_once ($classPath . 'class.layout.php');
|
||||
include_once ($classPath . 'class.client.php');
|
||||
include_once ($classPath . 'class.cat.php');
|
||||
include_once ($classPath . 'class.treeitem.php');
|
||||
include_once ($includesPath . 'cfg_language_de.inc.php');
|
||||
include_once ($includesPath . 'functions.con.php');
|
||||
|
||||
if(!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") {
|
||||
|
||||
$db = new DB_ConLite;
|
||||
|
||||
conFlagOnOffline();
|
||||
|
||||
conMoveArticles();
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -25,20 +25,23 @@ if (!defined("CON_FRAMEWORK")) {
|
|||
// Contenido startup process
|
||||
include_once ('../includes/startup.php');
|
||||
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.stat.php');
|
||||
$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes');
|
||||
$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes');
|
||||
|
||||
include_once ($classPath . 'class.user.php');
|
||||
include_once ($classPath . 'class.xml.php');
|
||||
include_once ($classPath . 'class.navigation.php');
|
||||
include_once ($classPath . 'template/class.template.php');
|
||||
include_once ($classPath . 'class.backend.php');
|
||||
include_once ($classPath . 'class.table.php');
|
||||
include_once ($classPath . 'class.notification.php');
|
||||
include_once ($classPath . 'class.area.php');
|
||||
include_once ($classPath . 'class.layout.php');
|
||||
include_once ($classPath . 'class.client.php');
|
||||
include_once ($classPath . 'class.cat.php');
|
||||
include_once ($classPath . 'class.treeitem.php');
|
||||
include_once ($includesPath . 'cfg_language_de.inc.php');
|
||||
include_once ($includesPath . 'functions.stat.php');
|
||||
|
||||
if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs")
|
||||
{
|
||||
|
@ -57,5 +60,4 @@ if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs")
|
|||
|
||||
statsArchive(sprintf("%04d%02d",$year,$month));
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -25,37 +25,41 @@ if (!defined("CON_FRAMEWORK")) {
|
|||
// Contenido startup process
|
||||
include_once ('../includes/startup.php');
|
||||
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.stat.php');
|
||||
$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes');
|
||||
$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes');
|
||||
|
||||
include_once ($classPath . 'class.user.php');
|
||||
include_once ($classPath . 'class.xml.php');
|
||||
include_once ($classPath . 'class.navigation.php');
|
||||
include_once ($classPath . 'template/class.template.php');
|
||||
include_once ($classPath . 'class.backend.php');
|
||||
include_once ($classPath . 'class.table.php');
|
||||
include_once ($classPath . 'class.notification.php');
|
||||
include_once ($classPath . 'class.area.php');
|
||||
include_once ($classPath . 'class.layout.php');
|
||||
include_once ($classPath . 'class.client.php');
|
||||
include_once ($classPath . 'class.cat.php');
|
||||
include_once ($classPath . 'class.treeitem.php');
|
||||
include_once ($includesPath . 'cfg_language_de.inc.php');
|
||||
include_once ($includesPath . 'functions.stat.php');
|
||||
|
||||
global $cfg;
|
||||
|
||||
if(!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") {
|
||||
$db = new DB_ConLite;
|
||||
|
||||
foreach ($cfg["tab"] as $key => $value)
|
||||
$tables = cRegistry::getConfigValue('tab');
|
||||
|
||||
foreach ($tables as $key => $value)
|
||||
{
|
||||
$sql = "OPTIMIZE TABLE ".$value;
|
||||
$db->query($sql);
|
||||
|
||||
}
|
||||
|
||||
if ($cfg["statistics_heap_table"]) {
|
||||
$sHeapTable = $cfg['tab']['stat_heap_table'];
|
||||
if (cRegistry::getConfigValue('statistics_heap_table')) {
|
||||
$sHeapTable = cRegistry::getConfigValue('tab', 'stat_heap_table');
|
||||
|
||||
buildHeapTable ($sHeapTable, $db);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Description:
|
||||
* Job to set frontendusers active / inactive depending on the date entered in BE
|
||||
*
|
||||
*
|
||||
* @package Backend
|
||||
* @subpackage Cronjobs
|
||||
* @version $Rev$
|
||||
|
@ -23,38 +23,33 @@ if (!defined("CON_FRAMEWORK")) {
|
|||
}
|
||||
|
||||
// Contenido startup process
|
||||
include_once ('../includes/startup.php');
|
||||
include_once('../includes/startup.php');
|
||||
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.inuse.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.stat.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.user.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.xml.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.navigation.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'template/class.template.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.backend.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.table.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.notification.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.area.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.layout.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.client.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.cat.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.treeitem.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["classes"] . 'class.inuse.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["includes"] . 'cfg_language_de.inc.php');
|
||||
include_once($cfg['path']['contenido'] . $cfg["path"]["includes"] . 'functions.stat.php');
|
||||
|
||||
require_once($cfg['path']['contenido'].$cfg["path"]["includes"] . 'pseudo-cron.inc.php');
|
||||
require_once($cfg['path']['contenido'] . $cfg["path"]["includes"] . 'pseudo-cron.inc.php');
|
||||
|
||||
if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs")
|
||||
{
|
||||
$db = new DB_ConLite();
|
||||
if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") {
|
||||
$db = new DB_ConLite();
|
||||
|
||||
$sSql = "UPDATE " . $cfg['tab']['frontendusers'] . "
|
||||
$sSql = "UPDATE " . $cfg['tab']['frontendusers'] . "
|
||||
SET active = 0
|
||||
WHERE
|
||||
(valid_to < NOW() AND valid_to != '1000-01-01')
|
||||
OR
|
||||
(valid_from > NOW() AND valid_from != '1000-01-01')";
|
||||
//echo $sSql;
|
||||
$db->query($sSql);
|
||||
WHERE (UNIX_TIMESTAMP(valid_to) <> 0 AND valid_to < NOW() AND valid_to != '1000-01-01 00:00:00')
|
||||
OR (UNIX_TIMESTAMP(valid_from) <> 0 AND valid_from > NOW() AND valid_from != '1000-01-01 00:00:00')";
|
||||
|
||||
}
|
||||
?>
|
||||
$db->query($sSql);
|
||||
}
|
|
@ -1,504 +0,0 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer SPL autoloader.
|
||||
* PHP Version 5
|
||||
* @package PHPMailer
|
||||
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Brent R. Matzelle (original founder)
|
||||
* @copyright 2012 - 2014 Marcus Bointon
|
||||
* @copyright 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPMailer SPL autoloader.
|
||||
* @param string $classname The name of the class to load
|
||||
*/
|
||||
function PHPMailerAutoload($classname)
|
||||
{
|
||||
//Can't use __DIR__ as it's only in PHP 5.3+
|
||||
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
|
||||
if (is_readable($filename)) {
|
||||
require $filename;
|
||||
}
|
||||
}
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
|
||||
//SPL autoloading was introduced in PHP 5.1.2
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||
spl_autoload_register('PHPMailerAutoload', true, true);
|
||||
} else {
|
||||
spl_autoload_register('PHPMailerAutoload');
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* Fall back to traditional autoload for old PHP versions
|
||||
* @param string $classname The name of the class to load
|
||||
*/
|
||||
function __autoload($classname)
|
||||
{
|
||||
PHPMailerAutoload($classname);
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
5.2.23
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -1,197 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer - PHP email creation and transport class.
|
||||
* PHP Version 5.4
|
||||
* @package PHPMailer
|
||||
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Brent R. Matzelle (original founder)
|
||||
* @copyright 2012 - 2014 Marcus Bointon
|
||||
* @copyright 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPMailerOAuth - PHPMailer subclass adding OAuth support.
|
||||
* @package PHPMailer
|
||||
* @author @sherryl4george
|
||||
* @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class PHPMailerOAuth extends PHPMailer
|
||||
{
|
||||
/**
|
||||
* The OAuth user's email address
|
||||
* @var string
|
||||
*/
|
||||
public $oauthUserEmail = '';
|
||||
|
||||
/**
|
||||
* The OAuth refresh token
|
||||
* @var string
|
||||
*/
|
||||
public $oauthRefreshToken = '';
|
||||
|
||||
/**
|
||||
* The OAuth client ID
|
||||
* @var string
|
||||
*/
|
||||
public $oauthClientId = '';
|
||||
|
||||
/**
|
||||
* The OAuth client secret
|
||||
* @var string
|
||||
*/
|
||||
public $oauthClientSecret = '';
|
||||
|
||||
/**
|
||||
* An instance of the PHPMailerOAuthGoogle class.
|
||||
* @var PHPMailerOAuthGoogle
|
||||
* @access protected
|
||||
*/
|
||||
protected $oauth = null;
|
||||
|
||||
/**
|
||||
* Get a PHPMailerOAuthGoogle instance to use.
|
||||
* @return PHPMailerOAuthGoogle
|
||||
*/
|
||||
public function getOAUTHInstance()
|
||||
{
|
||||
if (!is_object($this->oauth)) {
|
||||
$this->oauth = new PHPMailerOAuthGoogle(
|
||||
$this->oauthUserEmail,
|
||||
$this->oauthClientSecret,
|
||||
$this->oauthClientId,
|
||||
$this->oauthRefreshToken
|
||||
);
|
||||
}
|
||||
return $this->oauth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a connection to an SMTP server.
|
||||
* Overrides the original smtpConnect method to add support for OAuth.
|
||||
* @param array $options An array of options compatible with stream_context_create()
|
||||
* @uses SMTP
|
||||
* @access public
|
||||
* @return bool
|
||||
* @throws phpmailerException
|
||||
*/
|
||||
public function smtpConnect($options = array())
|
||||
{
|
||||
if (is_null($this->smtp)) {
|
||||
$this->smtp = $this->getSMTPInstance();
|
||||
}
|
||||
|
||||
if (is_null($this->oauth)) {
|
||||
$this->oauth = $this->getOAUTHInstance();
|
||||
}
|
||||
|
||||
// Already connected?
|
||||
if ($this->smtp->connected()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->smtp->setTimeout($this->Timeout);
|
||||
$this->smtp->setDebugLevel($this->SMTPDebug);
|
||||
$this->smtp->setDebugOutput($this->Debugoutput);
|
||||
$this->smtp->setVerp($this->do_verp);
|
||||
$hosts = explode(';', $this->Host);
|
||||
$lastexception = null;
|
||||
|
||||
foreach ($hosts as $hostentry) {
|
||||
$hostinfo = array();
|
||||
if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
|
||||
// Not a valid host entry
|
||||
continue;
|
||||
}
|
||||
// $hostinfo[2]: optional ssl or tls prefix
|
||||
// $hostinfo[3]: the hostname
|
||||
// $hostinfo[4]: optional port number
|
||||
// The host string prefix can temporarily override the current setting for SMTPSecure
|
||||
// If it's not specified, the default value is used
|
||||
$prefix = '';
|
||||
$secure = $this->SMTPSecure;
|
||||
$tls = ($this->SMTPSecure == 'tls');
|
||||
if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
|
||||
$prefix = 'ssl://';
|
||||
$tls = false; // Can't have SSL and TLS at the same time
|
||||
$secure = 'ssl';
|
||||
} elseif ($hostinfo[2] == 'tls') {
|
||||
$tls = true;
|
||||
// tls doesn't use a prefix
|
||||
$secure = 'tls';
|
||||
}
|
||||
//Do we need the OpenSSL extension?
|
||||
$sslext = defined('OPENSSL_ALGO_SHA1');
|
||||
if ('tls' === $secure or 'ssl' === $secure) {
|
||||
//Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
|
||||
if (!$sslext) {
|
||||
throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
|
||||
}
|
||||
}
|
||||
$host = $hostinfo[3];
|
||||
$port = $this->Port;
|
||||
$tport = (integer)$hostinfo[4];
|
||||
if ($tport > 0 and $tport < 65536) {
|
||||
$port = $tport;
|
||||
}
|
||||
if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
|
||||
try {
|
||||
if ($this->Helo) {
|
||||
$hello = $this->Helo;
|
||||
} else {
|
||||
$hello = $this->serverHostname();
|
||||
}
|
||||
$this->smtp->hello($hello);
|
||||
//Automatically enable TLS encryption if:
|
||||
// * it's not disabled
|
||||
// * we have openssl extension
|
||||
// * we are not already using SSL
|
||||
// * the server offers STARTTLS
|
||||
if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) {
|
||||
$tls = true;
|
||||
}
|
||||
if ($tls) {
|
||||
if (!$this->smtp->startTLS()) {
|
||||
throw new phpmailerException($this->lang('connect_host'));
|
||||
}
|
||||
// We must resend HELO after tls negotiation
|
||||
$this->smtp->hello($hello);
|
||||
}
|
||||
if ($this->SMTPAuth) {
|
||||
if (!$this->smtp->authenticate(
|
||||
$this->Username,
|
||||
$this->Password,
|
||||
$this->AuthType,
|
||||
$this->Realm,
|
||||
$this->Workstation,
|
||||
$this->oauth
|
||||
)
|
||||
) {
|
||||
throw new phpmailerException($this->lang('authenticate'));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (phpmailerException $exc) {
|
||||
$lastexception = $exc;
|
||||
$this->edebug($exc->getMessage());
|
||||
// We must have connected, but then failed TLS or Auth, so close connection nicely
|
||||
$this->smtp->quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
// If we get here, all connection attempts have failed, so close connection hard
|
||||
$this->smtp->close();
|
||||
// As we've caught all exceptions, just report whatever the last one was
|
||||
if ($this->exceptions and !is_null($lastexception)) {
|
||||
throw $lastexception;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren