Merge pull request 'Increase develop-branch to PHP8' (#47) from dev_php82 into develop
Reviewed-on: #47
Dieser Commit ist enthalten in:
Commit
1c94d40e04
497 geänderte Dateien mit 35586 neuen und 31587 gelöschten Zeilen
3
.gitignore
gevendort
3
.gitignore
gevendort
|
@ -17,8 +17,9 @@
|
|||
/cms/dflip/
|
||||
/cms/js/firstlevel/
|
||||
/conlite/external/**/.git
|
||||
/dievino/
|
||||
/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/
|
||||
|
|
3
.gitmodules
gevendort
3
.gitmodules
gevendort
|
@ -1,6 +1,3 @@
|
|||
[submodule "conlite/plugins/cl-mod-rewrite"]
|
||||
path = conlite/plugins/cl-mod-rewrite
|
||||
url = https://gitport.de/ConLite/cl-mod-rewrite.git
|
||||
[submodule "conlite/plugins/cl-newsletter"]
|
||||
path = conlite/plugins/cl-newsletter
|
||||
url = https://gitport.de/ConLite/cl-newsletter.git
|
||||
|
|
64
.idea/ConLite.iml
Normale Datei
64
.idea/ConLite.iml
Normale Datei
|
@ -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>
|
6
.idea/GitLink.xml
Normale Datei
6
.idea/GitLink.xml
Normale Datei
|
@ -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>
|
35
.idea/clphp8.iml
Normale Datei
35
.idea/clphp8.iml
Normale Datei
|
@ -0,0 +1,35 @@
|
|||
<?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$/spec" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/myclabs/deep-copy/fixtures" isTestSource="true" packagePrefix="DeepCopy\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/myclabs/deep-copy/src/DeepCopy" isTestSource="false" packagePrefix="DeepCopy\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/myclabs/deep-copy/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/myclabs/deep-copy/tests/DeepCopyTest" isTestSource="true" packagePrefix="DeepCopyTest\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/nikic/php-parser/lib/PhpParser" isTestSource="false" packagePrefix="PhpParser\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/nikic/php-parser/test/PhpParser" isTestSource="true" packagePrefix="PhpParser\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/nikic/php-parser/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/phpunit/php-file-iterator/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/sebastian/cli-parser/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/sebastian/code-unit-reverse-lookup/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/sebastian/comparator/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/sebastian/complexity/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/conlite/external/sebastian/object-enumerator/tests" isTestSource="true" />
|
||||
<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" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
24
.idea/codeception.xml
Normale Datei
24
.idea/codeception.xml
Normale Datei
|
@ -0,0 +1,24 @@
|
|||
<?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>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
4
.idea/deployment.xml
Normale Datei
4
.idea/deployment.xml
Normale Datei
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData" serverName="clphp8" />
|
||||
</project>
|
8
.idea/modules.xml
Normale Datei
8
.idea/modules.xml
Normale Datei
|
@ -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>
|
|
@ -14,31 +14,29 @@
|
|||
<include_path>
|
||||
<path value="$PROJECT_DIR$/conlite/external/phpqrcode/bindings" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/phpqrcode/tools" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/edit_area/plugins" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/frontend/cache" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/frontend/images" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/frontend/css" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/composer" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/frontend/data" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/frontend/upload" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/frontend/templates" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/phpmailer/phpmailer" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/edit_area/langs" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/frontend/js" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/frontend/includes" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/wysiwyg/tinymce3" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/edit_area/images" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/edit_area/reg_syntax" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/frontend/logs" />
|
||||
<path value="$PROJECT_DIR$/conlite/external/endroid/qr-code" />
|
||||
<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" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.4">
|
||||
<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>
|
||||
|
|
22
.idea/phpspec.xml
Normale Datei
22
.idea/phpspec.xml
Normale Datei
|
@ -0,0 +1,22 @@
|
|||
<?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>
|
||||
</suites>
|
||||
</component>
|
||||
</project>
|
|
@ -3,8 +3,9 @@
|
|||
<component name="PHPUnit">
|
||||
<option name="directories">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/conlite/external/phpmailer/phpmailer/tests" />
|
||||
<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>
|
||||
|
|
236
.idea/workspace.xml
Normale Datei
236
.idea/workspace.xml
Normale Datei
|
@ -0,0 +1,236 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="8eedb38c-41ce-4f3c-a016-df6a207a4233" name="Changes" comment="gitadmin" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ComposerConfigs">
|
||||
<option name="configs">
|
||||
<option value="$PROJECT_DIR$/conlite/external/endroid/qr-code/composer.json" />
|
||||
<option value="$PROJECT_DIR$/conlite/external/rector/rector/composer.json" />
|
||||
<option value="$PROJECT_DIR$/conlite/external/phpstan/phpstan/composer.json" />
|
||||
<option value="$PROJECT_DIR$/conlite/external/symfony/options-resolver/composer.json" />
|
||||
<option value="$PROJECT_DIR$/cms/securimage/composer.json" />
|
||||
</option>
|
||||
</component>
|
||||
<component name="ComposerSettings" synchronizationState="SYNCHRONIZE">
|
||||
<pharConfigPath>$PROJECT_DIR$/composer.json</pharConfigPath>
|
||||
<execution>
|
||||
<executable path="composer" />
|
||||
</execution>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="dev_php82" />
|
||||
<entry key="$PROJECT_DIR$/cms/secureimage" value="master" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
<option name="ROOT_SYNC" value="DONT_SYNC" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="PhpWorkspaceProjectConfiguration" interpreter_name="/usr/bin/php">
|
||||
<include_path>
|
||||
<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" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="ProjectId" id="2OsnK7aTqPj8IgMHzGyLAOICLU1" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"last_opened_file_path": "/var/www/html/clphp8/cms/data/modules/cl_contactform/php",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/cms/data/modules/cl_contactform/php" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Rector.cl_contactform_output.php">
|
||||
<configuration name="cl_contactform_output.php" type="RectorRunConfigurationType" factoryName="RectorRunConfigurationType" temporary="true" nameIsGenerated="true">
|
||||
<option name="pathsToProcess">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/cms/data/modules/cl_contactform/php/cl_contactform_output.php" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="rectorConfigPath" value="$PROJECT_DIR$/rector.php" />
|
||||
<option name="pathsToProcess">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/cms/data/modules/cl_contactform/php/cl_contactform_output.php" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="rectorConfigPath" value="$PROJECT_DIR$/rector.php" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="xtcdynspryform0.9.2" type="RectorRunConfigurationType" factoryName="RectorRunConfigurationType" temporary="true" nameIsGenerated="true">
|
||||
<option name="pathsToProcess">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/cms/data/modules/xtcdynspryform0.9.2" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="rectorConfigPath" value="$PROJECT_DIR$/rector.php" />
|
||||
<option name="pathsToProcess">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/cms/data/modules/xtcdynspryform0.9.2" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="rectorConfigPath" value="$PROJECT_DIR$/rector.php" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="xtcdynspryform0.9.2_input.php" type="RectorRunConfigurationType" factoryName="RectorRunConfigurationType" temporary="true" nameIsGenerated="true">
|
||||
<option name="pathsToProcess">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/cms/data/modules/xtcdynspryform0.9.2/php/xtcdynspryform0.9.2_input.php" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="rectorConfigPath" value="$PROJECT_DIR$/rector.php" />
|
||||
<option name="pathsToProcess">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/cms/data/modules/xtcdynspryform0.9.2/php/xtcdynspryform0.9.2_input.php" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="rectorConfigPath" value="$PROJECT_DIR$/rector.php" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Rector.cl_contactform_output.php" />
|
||||
<item itemvalue="Rector.xtcdynspryform0.9.2_input.php" />
|
||||
<item itemvalue="Rector.xtcdynspryform0.9.2" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="8eedb38c-41ce-4f3c-a016-df6a207a4233" name="Changes" comment="" />
|
||||
<created>1682358089636</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1682358089636</updated>
|
||||
<workItem from="1682358110742" duration="8528000" />
|
||||
<workItem from="1682512199591" duration="40000" />
|
||||
<workItem from="1682512266209" duration="329000" />
|
||||
<workItem from="1682512610923" duration="100000" />
|
||||
<workItem from="1682512717674" duration="523000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="move composer vendor folder">
|
||||
<created>1682442332378</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682442332378</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00002" summary="add rector.php">
|
||||
<created>1682442467699</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682442467700</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00003" summary="gitadmin">
|
||||
<created>1682442642783</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682442642783</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00004" summary="updates for php8">
|
||||
<created>1682445298959</created>
|
||||
<option name="number" value="00004" />
|
||||
<option name="presentableId" value="LOCAL-00004" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682445298959</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00005" summary="documentation and cleaning code">
|
||||
<created>1682445879204</created>
|
||||
<option name="number" value="00005" />
|
||||
<option name="presentableId" value="LOCAL-00005" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682445879204</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00006" summary="add module package xml">
|
||||
<created>1682446236100</created>
|
||||
<option name="number" value="00006" />
|
||||
<option name="presentableId" value="LOCAL-00006" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682446236100</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00007" summary="updated doc-blocks and module package">
|
||||
<created>1682446918410</created>
|
||||
<option name="number" value="00007" />
|
||||
<option name="presentableId" value="LOCAL-00007" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682446918410</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00008" summary="gitadmin">
|
||||
<created>1682450834252</created>
|
||||
<option name="number" value="00008" />
|
||||
<option name="presentableId" value="LOCAL-00008" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682450834252</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00009" summary="gitadmin">
|
||||
<created>1682513087275</created>
|
||||
<option name="number" value="00009" />
|
||||
<option name="presentableId" value="LOCAL-00009" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682513087275</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="10" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="move composer vendor folder" />
|
||||
<MESSAGE value="add rector.php" />
|
||||
<MESSAGE value="updates for php8" />
|
||||
<MESSAGE value="documentation and cleaning code" />
|
||||
<MESSAGE value="add module package xml" />
|
||||
<MESSAGE value="updated doc-blocks and module package" />
|
||||
<MESSAGE value="gitadmin" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="gitadmin" />
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
</project>
|
48
README.md
48
README.md
|
@ -1,22 +1,21 @@
|
|||
This is the readme file for **ConLite 2.1.3**
|
||||
This is the readme file for ConLite 2.2.0 beta
|
||||
|
||||
Any help you need you may find by visiting the following links.
|
||||
|
||||
* 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 [http://conlite.conrepo.org/api/4.8.16CL](http://conlite.conrepo.org/api/4.8.16CL)
|
||||
|
||||
### !!! Attention !!!
|
||||
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
|
||||
|
||||
!!! 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)
|
||||
bugtracker and register at http://bugs.conlite.org
|
||||
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
|
||||
|
@ -24,7 +23,7 @@ enhancements so one cannot use the version without problems. Our goal is to give
|
|||
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
|
||||
4.10. The new version of Contenido has a lot of changes, so you have to do a lot of work
|
||||
|
@ -33,14 +32,14 @@ do in the future. ConLite will do changes step by step, or better version by ver
|
|||
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 we love CONTENIDO :)
|
||||
|
||||
|
||||
### Copyright
|
||||
** Copyright **
|
||||
|
||||
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.
|
||||
|
@ -48,28 +47,27 @@ All ads, enhancements or new parts, coded by the CL-Team are copyright by their
|
|||
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
|
||||
|
||||
### History / Changelog
|
||||
**ConLite 2.1.3**
|
||||
|
||||
**ConLite 2.1.2**
|
||||
** History / Changelog **
|
||||
ConLite 2.2.0 beta
|
||||
|
||||
**ConLite 2.1.1**
|
||||
ConLite 2.1.3
|
||||
ConLite 2.1.2
|
||||
ConLite 2.1.1
|
||||
ConLite 2.1.0
|
||||
* see https://gitport.de/ConLite/ConLite/milestones
|
||||
|
||||
**ConLite 2.1.0**
|
||||
* see [https://gitport.de/ConLite/ConLite/milestones](https://gitport.de/ConLite/ConLite/milestones)
|
||||
|
||||
**ConLite 2.0**
|
||||
|
||||
**ConLite 1.0**
|
||||
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
|
||||
|
|
|
@ -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,5 +1,5 @@
|
|||
{
|
||||
"name": "vendor/conlite",
|
||||
"name": "org.conlite/conlite",
|
||||
"description": "ConLite vendor libs",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"authors": [
|
||||
|
@ -8,16 +8,19 @@
|
|||
"email": "ortwin.pinke@php-backoffice.de"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"vendor-dir": "conlite/external"
|
||||
},
|
||||
"require": {
|
||||
"endroid/qr-code": "1.9.*",
|
||||
"phpmailer/phpmailer": "v5.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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2087
composer.lock
generiert
2087
composer.lock
generiert
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
128
conlib/local.php
128
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
|
||||
|
@ -108,7 +109,7 @@ class DB_ConLite extends DB_Sql {
|
|||
*/
|
||||
public function copyResultToArray($sTable = '') {
|
||||
|
||||
$aValues = array();
|
||||
$aValues = [];
|
||||
|
||||
|
||||
$aMetadata = $this->metadata($sTable);
|
||||
|
@ -131,17 +132,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 +167,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 +181,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 +266,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 +305,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 +420,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 +509,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 +526,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 +551,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 +571,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 +611,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 +622,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 +648,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 +700,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 +716,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 +753,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 +779,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 +818,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;
|
||||
|
|
|
@ -555,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
|
||||
|
|
8
conlite/classes/Frontend/Navigation/FrontendNavigation.php
Normale Datei
8
conlite/classes/Frontend/Navigation/FrontendNavigation.php
Normale Datei
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Frontend\Navigation;
|
||||
|
||||
class FrontendNavigation
|
||||
{
|
||||
|
||||
}
|
29
conlite/classes/GenericDb/Driver/GenericDbDriver.php
Normale Datei
29
conlite/classes/GenericDb/Driver/GenericDbDriver.php
Normale Datei
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
515
conlite/classes/GenericDb/Item.php
Normale Datei
515
conlite/classes/GenericDb/Item.php
Normale Datei
|
@ -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 {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
1231
conlite/classes/GenericDb/ItemCollection.php
Normale Datei
1231
conlite/classes/GenericDb/ItemCollection.php
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
9
conlite/classes/GenericDb/ItemException.php
Normale Datei
9
conlite/classes/GenericDb/ItemException.php
Normale Datei
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\GenericDb;
|
||||
|
||||
use Exception;
|
||||
|
||||
class ItemException extends Exception {
|
||||
|
||||
}
|
7
conlite/classes/Html/Html.php
Normale Datei
7
conlite/classes/Html/Html.php
Normale Datei
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Html;
|
||||
|
||||
class Html extends HtmlCommon
|
||||
{
|
||||
}
|
42
conlite/classes/Html/HtmlCommon.php
Normale Datei
42
conlite/classes/Html/HtmlCommon.php
Normale Datei
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Description:
|
||||
* Base Class for all cHTML Elements
|
||||
*
|
||||
*
|
||||
* @category ConLite
|
||||
* @package Core
|
||||
* @subpackage cHTML
|
||||
|
@ -20,11 +20,7 @@
|
|||
|
||||
// security check
|
||||
defined('CON_FRAMEWORK') or die('Illegal call');
|
||||
/*
|
||||
if (!class_exists("HTML_Common2")) {
|
||||
cInclude("pear", "HTML/Common2.php");
|
||||
}
|
||||
*/
|
||||
|
||||
/* Global ID counter */
|
||||
$cHTMLIDCount = 0;
|
||||
|
||||
|
@ -33,11 +29,12 @@ $cHTMLIDCount = 0;
|
|||
*
|
||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
||||
*/
|
||||
class cHTML extends cHTML5Common {
|
||||
|
||||
class cHTML extends cHTML5Common
|
||||
{
|
||||
|
||||
/**
|
||||
* Storage of the open SGML tag template
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
protected $_skeleton_open;
|
||||
|
||||
|
@ -61,15 +58,15 @@ class cHTML extends cHTML5Common {
|
|||
|
||||
/**
|
||||
* 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
|
||||
|
@ -79,31 +76,32 @@ class cHTML extends cHTML5Common {
|
|||
/**
|
||||
* @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>';
|
||||
|
@ -112,50 +110,52 @@ class cHTML extends cHTML5Common {
|
|||
/* 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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,24 +163,26 @@ class cHTML extends cHTML5Common {
|
|||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -189,8 +191,9 @@ class cHTML extends cHTML5Common {
|
|||
*
|
||||
* @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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -198,8 +201,9 @@ class cHTML extends cHTML5Common {
|
|||
*
|
||||
* @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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,8 +211,9 @@ class cHTML extends cHTML5Common {
|
|||
*
|
||||
* @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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -220,11 +225,12 @@ class cHTML extends cHTML5Common {
|
|||
* @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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,9 +242,10 @@ class cHTML extends cHTML5Common {
|
|||
*
|
||||
* @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);
|
||||
}
|
||||
|
@ -246,7 +253,7 @@ class cHTML extends cHTML5Common {
|
|||
|
||||
/**
|
||||
* 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.
|
||||
|
@ -254,11 +261,12 @@ class cHTML extends cHTML5Common {
|
|||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,63 +276,68 @@ class cHTML extends cHTML5Common {
|
|||
* @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);
|
||||
}
|
||||
|
||||
|
@ -334,20 +347,21 @@ class cHTML extends cHTML5Common {
|
|||
* @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 {
|
||||
|
@ -355,12 +369,12 @@ class cHTML extends cHTML5Common {
|
|||
}
|
||||
}
|
||||
} 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;
|
||||
|
@ -372,92 +386,95 @@ class cHTML extends cHTML5Common {
|
|||
|
||||
/**
|
||||
* 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
|
||||
|
@ -465,8 +482,8 @@ class cHTML extends cHTML5Common {
|
|||
* @param none
|
||||
* @return string Rendered HTML
|
||||
*/
|
||||
public function render() {
|
||||
public function render()
|
||||
{
|
||||
return $this->toHtml();
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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").
|
||||
|
@ -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
|
@ -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);
|
||||
|
|
|
@ -32,7 +32,7 @@ class cRegistry {
|
|||
*/
|
||||
public static function getBackendPath() {
|
||||
$cfg = self::getConfig();
|
||||
return $cfg['path']['contenido'];
|
||||
return $cfg['path']['conlite'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
|
@ -57,10 +57,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 +71,12 @@ class cApiModuleCollection extends ItemCollection {
|
|||
*/
|
||||
class cApiModule extends Item {
|
||||
|
||||
public $_oldumask;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $_sModAliasOld;
|
||||
public $_bNoted;
|
||||
protected $_error;
|
||||
|
||||
/**
|
||||
|
@ -83,10 +87,7 @@ class cApiModule extends Item {
|
|||
protected $_bOutputFromFile = false;
|
||||
protected $_bInputFromFile = false;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $aUsedTemplates = array();
|
||||
private array $aUsedTemplates = [];
|
||||
|
||||
/**
|
||||
* Configuration Array of ModFileEdit
|
||||
|
@ -94,25 +95,12 @@ 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
|
||||
|
@ -128,13 +116,9 @@ 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["js"]["path"],
|
||||
"tplfiles" => $cfgClient["tpl"]["path"],
|
||||
"cssfiles" => $cfgClient["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["path"]["frontend"];
|
||||
|
@ -145,9 +129,9 @@ class cApiModule extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
$oClient = new cApiClient(cRegistry::getClientId());
|
||||
$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);
|
||||
}
|
||||
|
||||
|
@ -164,7 +148,7 @@ class cApiModule extends Item {
|
|||
try {
|
||||
mkdir($this->_aModFileEditConf['modPath'], 0777, true);
|
||||
} catch (Exception $ex) {
|
||||
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
|
||||
$oWriter = cLogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$oLog = new cLog($oWriter);
|
||||
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
|
||||
}
|
||||
|
@ -176,7 +160,7 @@ class cApiModule extends Item {
|
|||
try {
|
||||
mkdir($this->getModulePath(), 0777);
|
||||
} catch (Exception $ex) {
|
||||
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
|
||||
$oWriter = cLogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$oLog = new cLog($oWriter);
|
||||
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
|
||||
}
|
||||
|
@ -187,7 +171,7 @@ class cApiModule extends Item {
|
|||
umask($this->_oldumask);
|
||||
}
|
||||
} else {
|
||||
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
|
||||
$oWriter = cLogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$oLog = new cLog($oWriter);
|
||||
$oLog->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), cLog::WARN);
|
||||
}
|
||||
|
@ -195,10 +179,8 @@ class cApiModule extends Item {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -263,6 +245,7 @@ class cApiModule extends Item {
|
|||
* @return array Found strings for this module
|
||||
*/
|
||||
public function parseModuleForStrings() {
|
||||
global $cfg;
|
||||
if ($this->virgin == true) {
|
||||
return false;
|
||||
}
|
||||
|
@ -272,12 +255,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, '")');
|
||||
|
@ -297,7 +280,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]);
|
||||
}
|
||||
|
||||
|
@ -309,7 +292,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
|
||||
|
@ -320,7 +303,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +320,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
|
||||
|
@ -349,17 +332,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++;
|
||||
}
|
||||
}
|
||||
|
@ -384,16 +367,16 @@ class cApiModule extends Item {
|
|||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -402,11 +385,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);
|
||||
}
|
||||
|
@ -414,7 +394,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;
|
||||
}
|
||||
|
@ -429,11 +409,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -442,7 +420,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);
|
||||
|
@ -481,6 +459,14 @@ class cApiModule extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->_error;
|
||||
}
|
||||
|
||||
protected function _shouldLoadFromFiles() {
|
||||
if (getSystemProperty("modules", "loadfromfiles") == "true") {
|
||||
return true;
|
||||
|
@ -499,26 +485,23 @@ class cApiModule extends Item {
|
|||
private function _parseImportFile($sFile, $sType = "module", $sEncoding = "ISO-8859-1") {
|
||||
global $_mImport;
|
||||
|
||||
$oParser = new clXmlParser($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
|
||||
|
@ -541,13 +524,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;
|
||||
}
|
||||
}
|
||||
|
@ -586,8 +569,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")));
|
||||
|
@ -598,11 +581,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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,13 +593,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]);
|
||||
}
|
||||
|
@ -657,26 +640,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
|
||||
|
@ -703,7 +687,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);
|
||||
}
|
||||
|
@ -742,13 +726,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -770,21 +754,21 @@ class cApiModule extends Item {
|
|||
|
||||
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
|
||||
|
@ -798,14 +782,12 @@ 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -814,11 +796,11 @@ class cApiModule extends Item {
|
|||
// Export 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")));
|
||||
|
@ -827,24 +809,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");
|
||||
// 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")));
|
||||
|
||||
|
@ -861,17 +842,17 @@ class cApiModule extends Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -917,7 +898,7 @@ class cApiModule extends Item {
|
|||
}
|
||||
|
||||
private function _displayNoteFromFile($bIsOldPath = FALSE) {
|
||||
if (isset($this->_bNoted) && $this->_bNoted === true) {
|
||||
if (property_exists($this, '_bNoted') && $this->_bNoted !== null && $this->_bNoted === true) {
|
||||
return;
|
||||
}
|
||||
global $frame, $area;
|
||||
|
@ -926,23 +907,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 $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
|
||||
|
@ -987,17 +967,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 */
|
||||
|
@ -1017,10 +992,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";
|
||||
|
@ -1076,8 +1048,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'");
|
||||
|
||||
|
@ -1133,21 +1105,20 @@ class cApiModuleTranslationCollection extends ItemCollection {
|
|||
public function import($idmod, $idlang, $file) {
|
||||
global $_mImport;
|
||||
|
||||
$parser = new clXmlParser("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;
|
||||
}
|
||||
}
|
||||
|
@ -1161,21 +1132,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->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")));
|
||||
|
@ -1184,11 +1154,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
|
||||
}
|
|
@ -208,7 +208,11 @@ class Template {
|
|||
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")) {
|
||||
|
|
|
@ -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);
|
||||
}
|
25
conlite/external/autoload.php
gevendort
25
conlite/external/autoload.php
gevendort
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, $err);
|
||||
} elseif (!headers_sent()) {
|
||||
echo $err;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
$err,
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit4710875e1096bb659e0da9fbf88400bb::getLoader();
|
25
conlite/external/backendedit/front_content.php
gevendort
25
conlite/external/backendedit/front_content.php
gevendort
|
@ -92,7 +92,7 @@ if ($cfg["use_pseudocron"] == true) {
|
|||
* PHPLIB application development toolkit
|
||||
* @see http://sourceforge.net/projects/phplib
|
||||
*/
|
||||
if (!empty($contenido)) {
|
||||
if (isset($contenido)) {
|
||||
//Backend
|
||||
page_open(array('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm'));
|
||||
i18nInit($cfg["path"]["contenido"] . $cfg["path"]["locale"], $belang);
|
||||
|
@ -130,9 +130,6 @@ if (isset($_GET['action']) && $_GET['action'] == 'get_compressed') {
|
|||
exit();
|
||||
}
|
||||
|
||||
// Call hook after plugins are loaded, added by Murat Purc, 2008-09-07
|
||||
CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins');
|
||||
|
||||
if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) {
|
||||
// get encodings of all languages
|
||||
$encoding = array();
|
||||
|
@ -241,7 +238,7 @@ $errsite = 'Location: ' . Contenido_Url::getInstance()->buildRedirect($aParams);
|
|||
* 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);
|
||||
|
@ -410,7 +407,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 */
|
||||
|
@ -533,7 +530,7 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p
|
|||
##############################################
|
||||
|
||||
/* Mark submenuitem 'Preview' in the Contenido Backend (Area: Contenido --> Articles --> Preview) */
|
||||
if ($contenido) {
|
||||
if (isset($contenido)) {
|
||||
$markscript = markSubMenuItem(4, true);
|
||||
}
|
||||
|
||||
|
@ -610,9 +607,11 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p
|
|||
/* If article is in use, display notification */
|
||||
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);
|
||||
if(!preg_match("/(<body[^>]*)>.*/i", $code)) {
|
||||
$code = preg_replace("/(<body[^>]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1);
|
||||
$bInUseSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if category is public */
|
||||
$sql = "SELECT public FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'";
|
||||
|
||||
|
@ -651,7 +650,7 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p
|
|||
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_ConLite;
|
||||
$db2 = new DB_ConLite();
|
||||
$db2->query($sql);
|
||||
|
||||
if ($db2->num_rows() > 0) {
|
||||
|
@ -795,12 +794,16 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p
|
|||
if (in_array(Contenido_Security::toInteger($idart), $aExclude)) {
|
||||
eval("?>\n" . $code . "\n<?php\n");
|
||||
} else {
|
||||
chdir($cfgClient[$client]["path"]["frontend"]);
|
||||
// write html output into output buffer and assign it to an variable
|
||||
ob_start();
|
||||
eval("?>\n" . $code . "\n<?php\n");
|
||||
$htmlCode = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
if(!empty($sHtmlInUseMessage) && empty($bInUseSet)) {
|
||||
$htmlCode = preg_replace("/(<body[^>]*)>/i", "\${1}> \n $sHtmlInUseMessage", $htmlCode, 1);
|
||||
}
|
||||
// process CEC to do some preparations before output
|
||||
$htmlCode = CEC_Hook::executeAndReturn('Contenido.Frontend.HTMLCodeOutput', $htmlCode);
|
||||
|
||||
|
|
18
conlite/external/composer/autoload_classmap.php
gevendort
18
conlite/external/composer/autoload_classmap.php
gevendort
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname(dirname($vendorDir));
|
||||
|
||||
return array(
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
'EasyPeasyICS' => $vendorDir . '/phpmailer/phpmailer/extras/EasyPeasyICS.php',
|
||||
'PHPMailer' => $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php',
|
||||
'PHPMailerOAuth' => $vendorDir . '/phpmailer/phpmailer/class.phpmaileroauth.php',
|
||||
'PHPMailerOAuthGoogle' => $vendorDir . '/phpmailer/phpmailer/class.phpmaileroauthgoogle.php',
|
||||
'POP3' => $vendorDir . '/phpmailer/phpmailer/class.pop3.php',
|
||||
'SMTP' => $vendorDir . '/phpmailer/phpmailer/class.smtp.php',
|
||||
'ntlm_sasl_client_class' => $vendorDir . '/phpmailer/phpmailer/extras/ntlm_sasl_client.php',
|
||||
'phpmailerException' => $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php',
|
||||
);
|
12
conlite/external/composer/autoload_psr4.php
gevendort
12
conlite/external/composer/autoload_psr4.php
gevendort
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname(dirname($vendorDir));
|
||||
|
||||
return array(
|
||||
'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
|
||||
'Endroid\\QrCode\\' => array($vendorDir . '/endroid/qr-code/src'),
|
||||
'Conlite\\External\\' => array($vendorDir . ''),
|
||||
);
|
38
conlite/external/composer/autoload_real.php
gevendort
38
conlite/external/composer/autoload_real.php
gevendort
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit4710875e1096bb659e0da9fbf88400bb
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit4710875e1096bb659e0da9fbf88400bb', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit4710875e1096bb659e0da9fbf88400bb', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit4710875e1096bb659e0da9fbf88400bb::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
60
conlite/external/composer/autoload_static.php
gevendort
60
conlite/external/composer/autoload_static.php
gevendort
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit4710875e1096bb659e0da9fbf88400bb
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'S' =>
|
||||
array (
|
||||
'Symfony\\Component\\OptionsResolver\\' => 34,
|
||||
),
|
||||
'E' =>
|
||||
array (
|
||||
'Endroid\\QrCode\\' => 15,
|
||||
),
|
||||
'C' =>
|
||||
array (
|
||||
'Conlite\\External\\' => 17,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Symfony\\Component\\OptionsResolver\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/options-resolver',
|
||||
),
|
||||
'Endroid\\QrCode\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/endroid/qr-code/src',
|
||||
),
|
||||
'Conlite\\External\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../../..' . '/conlite/external',
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
'EasyPeasyICS' => __DIR__ . '/..' . '/phpmailer/phpmailer/extras/EasyPeasyICS.php',
|
||||
'PHPMailer' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmailer.php',
|
||||
'PHPMailerOAuth' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmaileroauth.php',
|
||||
'PHPMailerOAuthGoogle' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmaileroauthgoogle.php',
|
||||
'POP3' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.pop3.php',
|
||||
'SMTP' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.smtp.php',
|
||||
'ntlm_sasl_client_class' => __DIR__ . '/..' . '/phpmailer/phpmailer/extras/ntlm_sasl_client.php',
|
||||
'phpmailerException' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmailer.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit4710875e1096bb659e0da9fbf88400bb::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit4710875e1096bb659e0da9fbf88400bb::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit4710875e1096bb659e0da9fbf88400bb::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
240
conlite/external/composer/installed.json
gevendort
240
conlite/external/composer/installed.json
gevendort
|
@ -1,240 +0,0 @@
|
|||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "endroid/qr-code",
|
||||
"version": "1.9.3",
|
||||
"version_normalized": "1.9.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/endroid/qr-code.git",
|
||||
"reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/endroid/qr-code/zipball/c9644bec2a9cc9318e98d1437de3c628dcd1ef93",
|
||||
"reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-gd": "*",
|
||||
"php": ">=5.4",
|
||||
"symfony/options-resolver": "^2.3|^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0|^5.0",
|
||||
"sensio/framework-extra-bundle": "^3.0",
|
||||
"symfony/browser-kit": "^2.3|^3.0",
|
||||
"symfony/framework-bundle": "^2.3|^3.0",
|
||||
"symfony/http-kernel": "^2.3|^3.0"
|
||||
},
|
||||
"time": "2017-04-08T09:13:59+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Endroid\\QrCode\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeroen van den Enden",
|
||||
"email": "info@endroid.nl",
|
||||
"homepage": "http://endroid.nl/"
|
||||
}
|
||||
],
|
||||
"description": "Endroid QR Code",
|
||||
"homepage": "https://github.com/endroid/QrCode",
|
||||
"keywords": [
|
||||
"bundle",
|
||||
"code",
|
||||
"endroid",
|
||||
"qr",
|
||||
"qrcode",
|
||||
"symfony"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/endroid/qr-code/issues",
|
||||
"source": "https://github.com/endroid/qr-code/tree/1.9.3"
|
||||
},
|
||||
"install-path": "../endroid/qr-code"
|
||||
},
|
||||
{
|
||||
"name": "phpmailer/phpmailer",
|
||||
"version": "v6.5.3",
|
||||
"version_normalized": "6.5.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
||||
"reference": "baeb7cde6b60b1286912690ab0693c7789a31e71"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/baeb7cde6b60b1286912690ab0693c7789a31e71",
|
||||
"reference": "baeb7cde6b60b1286912690ab0693c7789a31e71",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-ctype": "*",
|
||||
"php": ">=5.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/annotations": "1.2.*",
|
||||
"jms/serializer": "0.16.*",
|
||||
"phpdocumentor/phpdocumentor": "2.*",
|
||||
"phpunit/phpunit": "4.8.*",
|
||||
"symfony/debug": "2.8.*",
|
||||
"symfony/filesystem": "2.8.*",
|
||||
"symfony/translation": "2.8.*",
|
||||
"symfony/yaml": "2.8.*",
|
||||
"zendframework/zend-cache": "2.5.1",
|
||||
"zendframework/zend-config": "2.5.1",
|
||||
"zendframework/zend-eventmanager": "2.5.1",
|
||||
"zendframework/zend-filter": "2.5.1",
|
||||
"zendframework/zend-i18n": "2.5.1",
|
||||
"zendframework/zend-json": "2.5.1",
|
||||
"zendframework/zend-math": "2.5.1",
|
||||
"zendframework/zend-serializer": "2.5.*",
|
||||
"zendframework/zend-servicemanager": "2.5.*",
|
||||
"zendframework/zend-stdlib": "2.5.1"
|
||||
},
|
||||
"suggest": {
|
||||
"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
|
||||
},
|
||||
"time": "2021-11-25T16:34:11+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"class.phpmailer.php",
|
||||
"class.phpmaileroauth.php",
|
||||
"class.phpmaileroauthgoogle.php",
|
||||
"class.smtp.php",
|
||||
"class.pop3.php",
|
||||
"extras/EasyPeasyICS.php",
|
||||
"extras/ntlm_sasl_client.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-2.1"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marcus Bointon",
|
||||
"email": "phpmailer@synchromedia.co.uk"
|
||||
},
|
||||
{
|
||||
"name": "Jim Jagielski",
|
||||
"email": "jimjag@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Andy Prevost",
|
||||
"email": "codeworxtech@users.sourceforge.net"
|
||||
},
|
||||
{
|
||||
"name": "Brent R. Matzelle"
|
||||
}
|
||||
],
|
||||
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
|
||||
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://marcus.bointon.com/donations/",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/Synchro",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/marcusbointon",
|
||||
"type": "patreon"
|
||||
}
|
||||
],
|
||||
"install-path": "../phpmailer/phpmailer"
|
||||
},
|
||||
{
|
||||
"name": "symfony/options-resolver",
|
||||
"version": "v3.4.47",
|
||||
"version_normalized": "3.4.47.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/options-resolver.git",
|
||||
"reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744",
|
||||
"reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8"
|
||||
},
|
||||
"time": "2020-10-24T10:57:07+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\OptionsResolver\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony OptionsResolver Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"config",
|
||||
"configuration",
|
||||
"options"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/options-resolver/tree/v3.4.47"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/options-resolver"
|
||||
}
|
||||
],
|
||||
"dev": false,
|
||||
"dev-package-names": []
|
||||
}
|
59
conlite/external/composer/installed.php
gevendort
59
conlite/external/composer/installed.php
gevendort
|
@ -1,59 +0,0 @@
|
|||
<?php return array(
|
||||
'root' => array(
|
||||
'pretty_version' => 'dev-develop',
|
||||
'version' => 'dev-develop',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../../',
|
||||
'aliases' => array(),
|
||||
'reference' => 'eea9100b3e2c72ca8b239c6a9fcb2671780ef12f',
|
||||
'name' => 'vendor/con-lite21',
|
||||
'dev' => false,
|
||||
),
|
||||
'versions' => array(
|
||||
'bacon/bacon-qr-code' => array(
|
||||
'pretty_version' => '2.0.4',
|
||||
'version' => '2.0.4.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../bacon/bacon-qr-code',
|
||||
'aliases' => array(),
|
||||
'reference' => 'f73543ac4e1def05f1a70bcd1525c8a157a1ad09',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'dasprid/enum' => array(
|
||||
'pretty_version' => '1.0.3',
|
||||
'version' => '1.0.3.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../dasprid/enum',
|
||||
'aliases' => array(),
|
||||
'reference' => '5abf82f213618696dda8e3bf6f64dd042d8542b2',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'endroid/qr-code' => array(
|
||||
'pretty_version' => '4.2.2',
|
||||
'version' => '4.2.2.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../endroid/qr-code',
|
||||
'aliases' => array(),
|
||||
'reference' => '53bfce79da95bf082484301fecbc1d77a3907f78',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'phpmailer/phpmailer' => array(
|
||||
'pretty_version' => 'v6.5.3',
|
||||
'version' => '6.5.3.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpmailer/phpmailer',
|
||||
'aliases' => array(),
|
||||
'reference' => 'baeb7cde6b60b1286912690ab0693c7789a31e71',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'vendor/con-lite21' => array(
|
||||
'pretty_version' => 'dev-develop',
|
||||
'version' => 'dev-develop',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../../',
|
||||
'aliases' => array(),
|
||||
'reference' => 'eea9100b3e2c72ca8b239c6a9fcb2671780ef12f',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
),
|
||||
);
|
45
conlite/external/endroid/qr-code/composer.json
gevendort
45
conlite/external/endroid/qr-code/composer.json
gevendort
|
@ -1,45 +0,0 @@
|
|||
{
|
||||
"name": "endroid/qrcode",
|
||||
"description": "Endroid QR Code",
|
||||
"keywords": ["endroid", "qrcode", "qr", "code", "bundle", "symfony"],
|
||||
"homepage": "https://github.com/endroid/QrCode",
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeroen van den Enden",
|
||||
"email": "info@endroid.nl",
|
||||
"homepage": "http://endroid.nl/"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"ext-gd": "*",
|
||||
"symfony/options-resolver": "^2.3|^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/browser-kit": "^2.3|^3.0",
|
||||
"symfony/framework-bundle": "^2.3|^3.0",
|
||||
"symfony/http-kernel": "^2.3|^3.0",
|
||||
"sensio/framework-extra-bundle": "^3.0",
|
||||
"phpunit/phpunit": "^4.0|^5.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Endroid\\QrCode\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Endroid\\QrCode\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
1591
conlite/external/endroid/qr-code/src/QrCode.php
gevendort
1591
conlite/external/endroid/qr-code/src/QrCode.php
gevendort
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -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
conlite/external/phpmailer/phpmailer/VERSION
gevendort
1
conlite/external/phpmailer/phpmailer/VERSION
gevendort
|
@ -1 +0,0 @@
|
|||
5.2.28
|
4064
conlite/external/phpmailer/phpmailer/class.phpmailer.php
gevendort
4064
conlite/external/phpmailer/phpmailer/class.phpmailer.php
gevendort
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;
|
||||
}
|
||||
}
|
|
@ -1,77 +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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPMailerOAuthGoogle - Wrapper for League OAuth2 Google provider.
|
||||
* @package PHPMailer
|
||||
* @author @sherryl4george
|
||||
* @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
|
||||
* @link https://github.com/thephpleague/oauth2-client
|
||||
*/
|
||||
class PHPMailerOAuthGoogle
|
||||
{
|
||||
private $oauthUserEmail = '';
|
||||
private $oauthRefreshToken = '';
|
||||
private $oauthClientId = '';
|
||||
private $oauthClientSecret = '';
|
||||
|
||||
/**
|
||||
* @param string $UserEmail
|
||||
* @param string $ClientSecret
|
||||
* @param string $ClientId
|
||||
* @param string $RefreshToken
|
||||
*/
|
||||
public function __construct(
|
||||
$UserEmail,
|
||||
$ClientSecret,
|
||||
$ClientId,
|
||||
$RefreshToken
|
||||
) {
|
||||
$this->oauthClientId = $ClientId;
|
||||
$this->oauthClientSecret = $ClientSecret;
|
||||
$this->oauthRefreshToken = $RefreshToken;
|
||||
$this->oauthUserEmail = $UserEmail;
|
||||
}
|
||||
|
||||
private function getProvider()
|
||||
{
|
||||
return new League\OAuth2\Client\Provider\Google([
|
||||
'clientId' => $this->oauthClientId,
|
||||
'clientSecret' => $this->oauthClientSecret
|
||||
]);
|
||||
}
|
||||
|
||||
private function getGrant()
|
||||
{
|
||||
return new \League\OAuth2\Client\Grant\RefreshToken();
|
||||
}
|
||||
|
||||
private function getToken()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$grant = $this->getGrant();
|
||||
return $provider->getAccessToken($grant, ['refresh_token' => $this->oauthRefreshToken]);
|
||||
}
|
||||
|
||||
public function getOauth64()
|
||||
{
|
||||
$token = $this->getToken();
|
||||
return base64_encode("user=" . $this->oauthUserEmail . "\001auth=Bearer " . $token . "\001\001");
|
||||
}
|
||||
}
|
407
conlite/external/phpmailer/phpmailer/class.pop3.php
gevendort
407
conlite/external/phpmailer/phpmailer/class.pop3.php
gevendort
|
@ -1,407 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* PHP Version 5
|
||||
* @package PHPMailer
|
||||
* @link https://github.com/PHPMailer/PHPMailer/
|
||||
* @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 POP-Before-SMTP Authentication Class.
|
||||
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
|
||||
* Does not support APOP.
|
||||
* @package PHPMailer
|
||||
* @author Richard Davey (original author) <rich@corephp.co.uk>
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
*/
|
||||
class POP3
|
||||
{
|
||||
/**
|
||||
* The POP3 PHPMailer Version number.
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $Version = '5.2.28';
|
||||
|
||||
/**
|
||||
* Default POP3 port number.
|
||||
* @var integer
|
||||
* @access public
|
||||
*/
|
||||
public $POP3_PORT = 110;
|
||||
|
||||
/**
|
||||
* Default timeout in seconds.
|
||||
* @var integer
|
||||
* @access public
|
||||
*/
|
||||
public $POP3_TIMEOUT = 30;
|
||||
|
||||
/**
|
||||
* POP3 Carriage Return + Line Feed.
|
||||
* @var string
|
||||
* @access public
|
||||
* @deprecated Use the constant instead
|
||||
*/
|
||||
public $CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* Debug display level.
|
||||
* Options: 0 = no, 1+ = yes
|
||||
* @var integer
|
||||
* @access public
|
||||
*/
|
||||
public $do_debug = 0;
|
||||
|
||||
/**
|
||||
* POP3 mail server hostname.
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $host;
|
||||
|
||||
/**
|
||||
* POP3 port number.
|
||||
* @var integer
|
||||
* @access public
|
||||
*/
|
||||
public $port;
|
||||
|
||||
/**
|
||||
* POP3 Timeout Value in seconds.
|
||||
* @var integer
|
||||
* @access public
|
||||
*/
|
||||
public $tval;
|
||||
|
||||
/**
|
||||
* POP3 username
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* POP3 password.
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $password;
|
||||
|
||||
/**
|
||||
* Resource handle for the POP3 connection socket.
|
||||
* @var resource
|
||||
* @access protected
|
||||
*/
|
||||
protected $pop_conn;
|
||||
|
||||
/**
|
||||
* Are we connected?
|
||||
* @var boolean
|
||||
* @access protected
|
||||
*/
|
||||
protected $connected = false;
|
||||
|
||||
/**
|
||||
* Error container.
|
||||
* @var array
|
||||
* @access protected
|
||||
*/
|
||||
protected $errors = array();
|
||||
|
||||
/**
|
||||
* Line break constant
|
||||
*/
|
||||
const CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* Simple static wrapper for all-in-one POP before SMTP
|
||||
* @param $host
|
||||
* @param integer|boolean $port The port number to connect to
|
||||
* @param integer|boolean $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param integer $debug_level
|
||||
* @return boolean
|
||||
*/
|
||||
public static function popBeforeSmtp(
|
||||
$host,
|
||||
$port = false,
|
||||
$timeout = false,
|
||||
$username = '',
|
||||
$password = '',
|
||||
$debug_level = 0
|
||||
) {
|
||||
$pop = new POP3;
|
||||
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate with a POP3 server.
|
||||
* A connect, login, disconnect sequence
|
||||
* appropriate for POP-before SMTP authorisation.
|
||||
* @access public
|
||||
* @param string $host The hostname to connect to
|
||||
* @param integer|boolean $port The port number to connect to
|
||||
* @param integer|boolean $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param integer $debug_level
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
||||
{
|
||||
$this->host = $host;
|
||||
// If no port value provided, use default
|
||||
if (false === $port) {
|
||||
$this->port = $this->POP3_PORT;
|
||||
} else {
|
||||
$this->port = (integer)$port;
|
||||
}
|
||||
// If no timeout value provided, use default
|
||||
if (false === $timeout) {
|
||||
$this->tval = $this->POP3_TIMEOUT;
|
||||
} else {
|
||||
$this->tval = (integer)$timeout;
|
||||
}
|
||||
$this->do_debug = $debug_level;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
// Reset the error log
|
||||
$this->errors = array();
|
||||
// connect
|
||||
$result = $this->connect($this->host, $this->port, $this->tval);
|
||||
if ($result) {
|
||||
$login_result = $this->login($this->username, $this->password);
|
||||
if ($login_result) {
|
||||
$this->disconnect();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// We need to disconnect regardless of whether the login succeeded
|
||||
$this->disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a POP3 server.
|
||||
* @access public
|
||||
* @param string $host
|
||||
* @param integer|boolean $port
|
||||
* @param integer $tval
|
||||
* @return boolean
|
||||
*/
|
||||
public function connect($host, $port = false, $tval = 30)
|
||||
{
|
||||
// Are we already connected?
|
||||
if ($this->connected) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
|
||||
//Rather than suppress it with @fsockopen, capture it cleanly instead
|
||||
set_error_handler(array($this, 'catchWarning'));
|
||||
|
||||
if (false === $port) {
|
||||
$port = $this->POP3_PORT;
|
||||
}
|
||||
|
||||
// connect to the POP3 server
|
||||
$this->pop_conn = fsockopen(
|
||||
$host, // POP3 Host
|
||||
$port, // Port #
|
||||
$errno, // Error Number
|
||||
$errstr, // Error Message
|
||||
$tval
|
||||
); // Timeout (seconds)
|
||||
// Restore the error handler
|
||||
restore_error_handler();
|
||||
|
||||
// Did we connect?
|
||||
if (false === $this->pop_conn) {
|
||||
// It would appear not...
|
||||
$this->setError(array(
|
||||
'error' => "Failed to connect to server $host on port $port",
|
||||
'errno' => $errno,
|
||||
'errstr' => $errstr
|
||||
));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Increase the stream time-out
|
||||
stream_set_timeout($this->pop_conn, $tval, 0);
|
||||
|
||||
// Get the POP3 server response
|
||||
$pop3_response = $this->getResponse();
|
||||
// Check for the +OK
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// The connection is established and the POP3 server is talking
|
||||
$this->connected = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log in to the POP3 server.
|
||||
* Does not support APOP (RFC 2828, 4949).
|
||||
* @access public
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @return boolean
|
||||
*/
|
||||
public function login($username = '', $password = '')
|
||||
{
|
||||
if (!$this->connected) {
|
||||
$this->setError('Not connected to POP3 server');
|
||||
}
|
||||
if (empty($username)) {
|
||||
$username = $this->username;
|
||||
}
|
||||
if (empty($password)) {
|
||||
$password = $this->password;
|
||||
}
|
||||
|
||||
// Send the Username
|
||||
$this->sendString("USER $username" . self::CRLF);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// Send the Password
|
||||
$this->sendString("PASS $password" . self::CRLF);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the POP3 server.
|
||||
* @access public
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
$this->sendString('QUIT');
|
||||
//The QUIT command may cause the daemon to exit, which will kill our connection
|
||||
//So ignore errors here
|
||||
try {
|
||||
@fclose($this->pop_conn);
|
||||
} catch (Exception $e) {
|
||||
//Do nothing
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a response from the POP3 server.
|
||||
* $size is the maximum number of bytes to retrieve
|
||||
* @param integer $size
|
||||
* @return string
|
||||
* @access protected
|
||||
*/
|
||||
protected function getResponse($size = 128)
|
||||
{
|
||||
$response = fgets($this->pop_conn, $size);
|
||||
if ($this->do_debug >= 1) {
|
||||
echo "Server -> Client: $response";
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send raw data to the POP3 server.
|
||||
* @param string $string
|
||||
* @return integer
|
||||
* @access protected
|
||||
*/
|
||||
protected function sendString($string)
|
||||
{
|
||||
if ($this->pop_conn) {
|
||||
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
|
||||
echo "Client -> Server: $string";
|
||||
}
|
||||
return fwrite($this->pop_conn, $string, strlen($string));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the POP3 server response.
|
||||
* Looks for for +OK or -ERR.
|
||||
* @param string $string
|
||||
* @return boolean
|
||||
* @access protected
|
||||
*/
|
||||
protected function checkResponse($string)
|
||||
{
|
||||
if (substr($string, 0, 3) !== '+OK') {
|
||||
$this->setError(array(
|
||||
'error' => "Server reported an error: $string",
|
||||
'errno' => 0,
|
||||
'errstr' => ''
|
||||
));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an error to the internal error store.
|
||||
* Also display debug output if it's enabled.
|
||||
* @param $error
|
||||
* @access protected
|
||||
*/
|
||||
protected function setError($error)
|
||||
{
|
||||
$this->errors[] = $error;
|
||||
if ($this->do_debug >= 1) {
|
||||
echo '<pre>';
|
||||
foreach ($this->errors as $error) {
|
||||
print_r($error);
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of error messages, if any.
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* POP3 connection error handler.
|
||||
* @param integer $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param integer $errline
|
||||
* @access protected
|
||||
*/
|
||||
protected function catchWarning($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
$this->setError(array(
|
||||
'error' => "Connecting to the POP3 server raised a PHP warning: ",
|
||||
'errno' => $errno,
|
||||
'errstr' => $errstr,
|
||||
'errfile' => $errfile,
|
||||
'errline' => $errline
|
||||
));
|
||||
}
|
||||
}
|
61
conlite/external/phpmailer/phpmailer/composer.json
gevendort
61
conlite/external/phpmailer/phpmailer/composer.json
gevendort
|
@ -1,61 +0,0 @@
|
|||
{
|
||||
"name": "phpmailer/phpmailer",
|
||||
"type": "library",
|
||||
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marcus Bointon",
|
||||
"email": "phpmailer@synchromedia.co.uk"
|
||||
},
|
||||
{
|
||||
"name": "Jim Jagielski",
|
||||
"email": "jimjag@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Andy Prevost",
|
||||
"email": "codeworxtech@users.sourceforge.net"
|
||||
},
|
||||
{
|
||||
"name": "Brent R. Matzelle"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"ext-ctype": "*",
|
||||
"php": ">=5.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/annotations": "1.2.*",
|
||||
"jms/serializer": "0.16.*",
|
||||
"phpdocumentor/phpdocumentor": "2.*",
|
||||
"phpunit/phpunit": "4.8.*",
|
||||
"symfony/debug": "2.8.*",
|
||||
"symfony/filesystem": "2.8.*",
|
||||
"symfony/translation": "2.8.*",
|
||||
"symfony/yaml": "2.8.*",
|
||||
"zendframework/zend-cache": "2.5.1",
|
||||
"zendframework/zend-config": "2.5.1",
|
||||
"zendframework/zend-eventmanager": "2.5.1",
|
||||
"zendframework/zend-filter": "2.5.1",
|
||||
"zendframework/zend-i18n": "2.5.1",
|
||||
"zendframework/zend-json": "2.5.1",
|
||||
"zendframework/zend-math": "2.5.1",
|
||||
"zendframework/zend-serializer": "2.5.*",
|
||||
"zendframework/zend-servicemanager": "2.5.*",
|
||||
"zendframework/zend-stdlib": "2.5.1"
|
||||
},
|
||||
"suggest": {
|
||||
"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"class.phpmailer.php",
|
||||
"class.phpmaileroauth.php",
|
||||
"class.phpmaileroauthgoogle.php",
|
||||
"class.smtp.php",
|
||||
"class.pop3.php",
|
||||
"extras/EasyPeasyICS.php",
|
||||
"extras/ntlm_sasl_client.php"
|
||||
]
|
||||
},
|
||||
"license": "LGPL-2.1"
|
||||
}
|
3593
conlite/external/phpmailer/phpmailer/composer.lock
generiert
gevendort
3593
conlite/external/phpmailer/phpmailer/composer.lock
generiert
gevendort
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows how to use DKIM message authentication with PHPMailer.
|
||||
* There's more to using DKIM than just this code - check out this article:
|
||||
* @link https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
|
||||
* See also the DKIM code in the PHPMailer unit tests,
|
||||
* which shows how to make a key pair from PHP.
|
||||
*/
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
//Set an alternative reply-to address
|
||||
$mail->addReplyTo('replyto@example.com', 'First Last');
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer DKIM test';
|
||||
//This should be the same as the domain of your From address
|
||||
$mail->DKIM_domain = 'example.com';
|
||||
//Path to your private key file
|
||||
$mail->DKIM_private = 'dkim_private.pem';
|
||||
//Set this to your own selector
|
||||
$mail->DKIM_selector = 'phpmailer';
|
||||
//If your private key has a passphrase, set it here
|
||||
$mail->DKIM_passphrase = '';
|
||||
//The identity you're signing as - usually your From address
|
||||
$mail->DKIM_identity = $mail->From;
|
||||
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
|
@ -1,604 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* A web form that both generates and uses PHPMailer code.
|
||||
* revised, updated and corrected 27/02/2013
|
||||
* by matt.sturdy@gmail.com
|
||||
*/
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
$CFG['smtp_debug'] = 2; //0 == off, 1 for client output, 2 for client and server
|
||||
$CFG['smtp_debugoutput'] = 'html';
|
||||
$CFG['smtp_server'] = 'localhost';
|
||||
$CFG['smtp_port'] = '25';
|
||||
$CFG['smtp_authenticate'] = false;
|
||||
$CFG['smtp_username'] = 'name@example.com';
|
||||
$CFG['smtp_password'] = 'yourpassword';
|
||||
$CFG['smtp_secure'] = 'None';
|
||||
|
||||
$from_name = (isset($_POST['From_Name'])) ? $_POST['From_Name'] : '';
|
||||
$from_email = (isset($_POST['From_Email'])) ? $_POST['From_Email'] : '';
|
||||
$to_name = (isset($_POST['To_Name'])) ? $_POST['To_Name'] : '';
|
||||
$to_email = (isset($_POST['To_Email'])) ? $_POST['To_Email'] : '';
|
||||
$cc_email = (isset($_POST['cc_Email'])) ? $_POST['cc_Email'] : '';
|
||||
$bcc_email = (isset($_POST['bcc_Email'])) ? $_POST['bcc_Email'] : '';
|
||||
$subject = (isset($_POST['Subject'])) ? $_POST['Subject'] : '';
|
||||
$message = (isset($_POST['Message'])) ? $_POST['Message'] : '';
|
||||
$test_type = (isset($_POST['test_type'])) ? $_POST['test_type'] : 'smtp';
|
||||
$smtp_debug = (isset($_POST['smtp_debug'])) ? $_POST['smtp_debug'] : $CFG['smtp_debug'];
|
||||
$smtp_server = (isset($_POST['smtp_server'])) ? $_POST['smtp_server'] : $CFG['smtp_server'];
|
||||
$smtp_port = (isset($_POST['smtp_port'])) ? $_POST['smtp_port'] : $CFG['smtp_port'];
|
||||
$smtp_secure = strtolower((isset($_POST['smtp_secure'])) ? $_POST['smtp_secure'] : $CFG['smtp_secure']);
|
||||
$smtp_authenticate = (isset($_POST['smtp_authenticate'])) ?
|
||||
$_POST['smtp_authenticate'] : $CFG['smtp_authenticate'];
|
||||
$authenticate_password = (isset($_POST['authenticate_password'])) ?
|
||||
$_POST['authenticate_password'] : $CFG['smtp_password'];
|
||||
$authenticate_username = (isset($_POST['authenticate_username'])) ?
|
||||
$_POST['authenticate_username'] : $CFG['smtp_username'];
|
||||
|
||||
// storing all status output from the script to be shown to the user later
|
||||
$results_messages = array();
|
||||
|
||||
// $example_code represents the "final code" that we're using, and will
|
||||
// be shown to the user at the end.
|
||||
$example_code = "\nrequire_once '../PHPMailerAutoload.php';";
|
||||
$example_code .= "\n\n\$results_messages = array();";
|
||||
|
||||
$mail = new PHPMailer(true); //PHPMailer instance with exceptions enabled
|
||||
$mail->CharSet = 'utf-8';
|
||||
ini_set('default_charset', 'UTF-8');
|
||||
$mail->Debugoutput = $CFG['smtp_debugoutput'];
|
||||
$example_code .= "\n\n\$mail = new PHPMailer(true);";
|
||||
$example_code .= "\n\$mail->CharSet = 'utf-8';";
|
||||
$example_code .= "\nini_set('default_charset', 'UTF-8');";
|
||||
|
||||
class phpmailerAppException extends phpmailerException
|
||||
{
|
||||
}
|
||||
|
||||
$example_code .= "\n\nclass phpmailerAppException extends phpmailerException {}";
|
||||
$example_code .= "\n\ntry {";
|
||||
|
||||
// Convert a string to its JavaScript representation.
|
||||
function JSString($s) {
|
||||
static $from = array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"');
|
||||
static $to = array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\\"');
|
||||
return is_null($s)? 'null': '"' . str_replace($from, $to, "$s") . '"';
|
||||
}
|
||||
|
||||
try {
|
||||
if (isset($_POST["submit"]) && $_POST['submit'] == "Submit") {
|
||||
$to = $to_email;
|
||||
if (!PHPMailer::validateAddress($to)) {
|
||||
throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!");
|
||||
}
|
||||
|
||||
$example_code .= "\n\$to = '" . addslashes($to_email) . "';";
|
||||
$example_code .= "\nif(!PHPMailer::validateAddress(\$to)) {";
|
||||
$example_code .= "\n throw new phpmailerAppException(\"Email address \" . " .
|
||||
"\$to . \" is invalid -- aborting!\");";
|
||||
$example_code .= "\n}";
|
||||
|
||||
switch ($test_type) {
|
||||
case 'smtp':
|
||||
$mail->isSMTP(); // telling the class to use SMTP
|
||||
$mail->SMTPDebug = (integer)$smtp_debug;
|
||||
$mail->Host = $smtp_server; // SMTP server
|
||||
$mail->Port = (integer)$smtp_port; // set the SMTP port
|
||||
if ($smtp_secure) {
|
||||
$mail->SMTPSecure = strtolower($smtp_secure);
|
||||
}
|
||||
$mail->SMTPAuth = array_key_exists('smtp_authenticate', $_POST); // enable SMTP authentication?
|
||||
if (array_key_exists('smtp_authenticate', $_POST)) {
|
||||
$mail->Username = $authenticate_username; // SMTP account username
|
||||
$mail->Password = $authenticate_password; // SMTP account password
|
||||
}
|
||||
|
||||
$example_code .= "\n\$mail->isSMTP();";
|
||||
$example_code .= "\n\$mail->SMTPDebug = " . (integer) $smtp_debug . ";";
|
||||
$example_code .= "\n\$mail->Host = \"" . addslashes($smtp_server) . "\";";
|
||||
$example_code .= "\n\$mail->Port = \"" . addslashes($smtp_port) . "\";";
|
||||
$example_code .= "\n\$mail->SMTPSecure = \"" . addslashes(strtolower($smtp_secure)) . "\";";
|
||||
$example_code .= "\n\$mail->SMTPAuth = " . (array_key_exists(
|
||||
'smtp_authenticate',
|
||||
$_POST
|
||||
) ? 'true' : 'false') . ";";
|
||||
if (array_key_exists('smtp_authenticate', $_POST)) {
|
||||
$example_code .= "\n\$mail->Username = \"" . addslashes($authenticate_username) . "\";";
|
||||
$example_code .= "\n\$mail->Password = \"" . addslashes($authenticate_password) . "\";";
|
||||
}
|
||||
break;
|
||||
case 'mail':
|
||||
$mail->isMail(); // telling the class to use PHP's mail()
|
||||
$example_code .= "\n\$mail->isMail();";
|
||||
break;
|
||||
case 'sendmail':
|
||||
$mail->isSendmail(); // telling the class to use Sendmail
|
||||
$example_code .= "\n\$mail->isSendmail();";
|
||||
break;
|
||||
case 'qmail':
|
||||
$mail->isQmail(); // telling the class to use Qmail
|
||||
$example_code .= "\n\$mail->isQmail();";
|
||||
break;
|
||||
default:
|
||||
throw new phpmailerAppException('Invalid test_type provided');
|
||||
}
|
||||
|
||||
try {
|
||||
if ($_POST['From_Name'] != '') {
|
||||
$mail->addReplyTo($from_email, $from_name);
|
||||
$mail->setFrom($from_email, $from_name);
|
||||
|
||||
$example_code .= "\n\$mail->addReplyTo(\"" .
|
||||
addslashes($from_email) . "\", \"" . addslashes($from_name) . "\");";
|
||||
$example_code .= "\n\$mail->setFrom(\"" .
|
||||
addslashes($from_email) . "\", \"" . addslashes($from_name) . "\");";
|
||||
} else {
|
||||
$mail->addReplyTo($from_email);
|
||||
$mail->setFrom($from_email, $from_email);
|
||||
|
||||
$example_code .= "\n\$mail->addReplyTo(\"" . addslashes($from_email) . "\");";
|
||||
$example_code .= "\n\$mail->setFrom(\"" .
|
||||
addslashes($from_email) . "\", \"" . addslashes($from_email) . "\");";
|
||||
}
|
||||
|
||||
if ($_POST['To_Name'] != '') {
|
||||
$mail->addAddress($to, $to_name);
|
||||
$example_code .= "\n\$mail->addAddress(\"$to\", \"" . addslashes($to_name) . "\");";
|
||||
} else {
|
||||
$mail->addAddress($to);
|
||||
$example_code .= "\n\$mail->addAddress(\"$to\");";
|
||||
}
|
||||
|
||||
if ($_POST['bcc_Email'] != '') {
|
||||
$indiBCC = explode(" ", $bcc_email);
|
||||
foreach ($indiBCC as $key => $value) {
|
||||
$mail->addBCC($value);
|
||||
$example_code .= "\n\$mail->addBCC(\"" . addslashes($value) . "\");";
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['cc_Email'] != '') {
|
||||
$indiCC = explode(" ", $cc_Email);
|
||||
foreach ($indiCC as $key => $value) {
|
||||
$mail->addCC($value);
|
||||
$example_code .= "\n\$mail->addCC(\"" . addslashes($value) . "\");";
|
||||
}
|
||||
}
|
||||
} catch (phpmailerException $e) { //Catch all kinds of bad addressing
|
||||
throw new phpmailerAppException($e->getMessage());
|
||||
}
|
||||
$mail->Subject = $subject . ' (PHPMailer test using ' . strtoupper($test_type) . ')';
|
||||
$example_code .= "\n\$mail->Subject = \"" . addslashes($subject) .
|
||||
' (PHPMailer test using ' . addslashes(strtoupper($test_type)) . ')";';
|
||||
|
||||
if ($_POST['Message'] == '') {
|
||||
$body = file_get_contents('contents.html');
|
||||
} else {
|
||||
$body = $message;
|
||||
}
|
||||
|
||||
$example_code .= "\n\$body = <<<'EOT'\n$body\nEOT;";
|
||||
|
||||
$mail->WordWrap = 78; // set word wrap to the RFC2822 limit
|
||||
$mail->msgHTML($body, dirname(__FILE__), true); //Create message bodies and embed images
|
||||
|
||||
$example_code .= "\n\$mail->WordWrap = 78;";
|
||||
$example_code .= "\n\$mail->msgHTML(\$body, dirname(__FILE__), true); //Create message bodies and embed images";
|
||||
|
||||
$mail->addAttachment('images/phpmailer_mini.png', 'phpmailer_mini.png'); // optional name
|
||||
$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name
|
||||
$example_code .= "\n\$mail->addAttachment('images/phpmailer_mini.png'," .
|
||||
"'phpmailer_mini.png'); // optional name";
|
||||
$example_code .= "\n\$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name";
|
||||
|
||||
$example_code .= "\n\ntry {";
|
||||
$example_code .= "\n \$mail->send();";
|
||||
$example_code .= "\n \$results_messages[] = \"Message has been sent using " .
|
||||
addslashes(strtoupper($test_type)) . "\";";
|
||||
$example_code .= "\n}";
|
||||
$example_code .= "\ncatch (phpmailerException \$e) {";
|
||||
$example_code .= "\n throw new phpmailerAppException('Unable to send to: ' . \$to. ': '.\$e->getMessage());";
|
||||
$example_code .= "\n}";
|
||||
|
||||
try {
|
||||
$mail->send();
|
||||
$results_messages[] = "Message has been sent using " . strtoupper($test_type);
|
||||
} catch (phpmailerException $e) {
|
||||
throw new phpmailerAppException("Unable to send to: " . $to . ': ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
} catch (phpmailerAppException $e) {
|
||||
$results_messages[] = $e->errorMessage();
|
||||
}
|
||||
$example_code .= "\n}";
|
||||
$example_code .= "\ncatch (phpmailerAppException \$e) {";
|
||||
$example_code .= "\n \$results_messages[] = \$e->errorMessage();";
|
||||
$example_code .= "\n}";
|
||||
$example_code .= "\n\nif (count(\$results_messages) > 0) {";
|
||||
$example_code .= "\n echo \"<h2>Run results</h2>\\n\";";
|
||||
$example_code .= "\n echo \"<ul>\\n\";";
|
||||
$example_code .= "\nforeach (\$results_messages as \$result) {";
|
||||
$example_code .= "\n echo \"<li>\$result</li>\\n\";";
|
||||
$example_code .= "\n}";
|
||||
$example_code .= "\necho \"</ul>\\n\";";
|
||||
$example_code .= "\n}";
|
||||
?><!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>PHPMailer Test Page</title>
|
||||
<script type="text/javascript" src="scripts/shCore.js"></script>
|
||||
<script type="text/javascript" src="scripts/shBrushPhp.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="styles/shCore.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css">
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 1em;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 0 auto;
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.column {
|
||||
border-collapse: collapse;
|
||||
background-color: #FFFFFF;
|
||||
padding: 0.5em;
|
||||
width: 35em;
|
||||
}
|
||||
|
||||
td {
|
||||
font-size: 1em;
|
||||
padding: 0.1em 0.25em;
|
||||
-moz-border-radius: 1em;
|
||||
-webkit-border-radius: 1em;
|
||||
border-radius: 1em;
|
||||
}
|
||||
|
||||
td.colleft {
|
||||
text-align: right;
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
td.colrite {
|
||||
text-align: left;
|
||||
width: 65%;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
padding: 1em 1em 1em 1em;
|
||||
margin: 0 2em;
|
||||
border-radius: 1.5em;
|
||||
-webkit-border-radius: 1em;
|
||||
-moz-border-radius: 1em;
|
||||
}
|
||||
|
||||
fieldset.inner {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
fieldset:hover, tr:hover {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
legend {
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
div.column-left {
|
||||
float: left;
|
||||
width: 45em;
|
||||
height: 31em;
|
||||
}
|
||||
|
||||
div.column-right {
|
||||
display: inline;
|
||||
width: 45em;
|
||||
max-height: 31em;
|
||||
}
|
||||
|
||||
input.radio {
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.radio {
|
||||
padding: 0.2em;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
|
||||
SyntaxHighlighter.all();
|
||||
|
||||
function startAgain() {
|
||||
var post_params = {
|
||||
"From_Name": <?php echo JSString($from_name); ?>,
|
||||
"From_Email": <?php echo JSString($from_email); ?>,
|
||||
"To_Name": <?php echo JSString($to_name); ?>,
|
||||
"To_Email": <?php echo JSString($to_email); ?>,
|
||||
"cc_Email": <?php echo JSString($cc_email); ?>,
|
||||
"bcc_Email": <?php echo JSString($bcc_email); ?>,
|
||||
"Subject": <?php echo JSString($subject); ?>,
|
||||
"Message": <?php echo JSString($message); ?>,
|
||||
"test_type": <?php echo JSString($test_type); ?>,
|
||||
"smtp_debug": <?php echo JSString($smtp_debug); ?>,
|
||||
"smtp_server": <?php echo JSString($smtp_server); ?>,
|
||||
"smtp_port": <?php echo JSString($smtp_port); ?>,
|
||||
"smtp_secure": <?php echo JSString($smtp_secure); ?>,
|
||||
"smtp_authenticate": <?php echo JSString($smtp_authenticate); ?>,
|
||||
"authenticate_username": <?php echo JSString($authenticate_username); ?>,
|
||||
"authenticate_password": <?php echo JSString($authenticate_password); ?>
|
||||
};
|
||||
|
||||
var resetForm = document.createElement("form");
|
||||
resetForm.setAttribute("method", "POST");
|
||||
resetForm.setAttribute("path", "index.php");
|
||||
|
||||
for (var k in post_params) {
|
||||
var h = document.createElement("input");
|
||||
h.setAttribute("type", "hidden");
|
||||
h.setAttribute("name", k);
|
||||
h.setAttribute("value", post_params[k]);
|
||||
resetForm.appendChild(h);
|
||||
}
|
||||
|
||||
document.body.appendChild(resetForm);
|
||||
resetForm.submit();
|
||||
}
|
||||
|
||||
function showHideDiv(test, element_id) {
|
||||
var ops = {"smtp-options-table": "smtp"};
|
||||
|
||||
if (test == ops[element_id]) {
|
||||
document.getElementById(element_id).style.display = "block";
|
||||
} else {
|
||||
document.getElementById(element_id).style.display = "none";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
if (version_compare(PHP_VERSION, '5.0.0', '<')) {
|
||||
echo 'Current PHP version: ' . phpversion() . "<br>";
|
||||
echo exit("ERROR: Wrong PHP version. Must be PHP 5 or above.");
|
||||
}
|
||||
|
||||
if (count($results_messages) > 0) {
|
||||
echo '<h2>Run results</h2>';
|
||||
echo '<ul>';
|
||||
foreach ($results_messages as $result) {
|
||||
echo "<li>$result</li>";
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
if (isset($_POST["submit"]) && $_POST["submit"] == "Submit") {
|
||||
echo "<button type=\"submit\" onclick=\"startAgain();\">Start Over</button><br>\n";
|
||||
echo "<br><span>Script:</span>\n";
|
||||
echo "<pre class=\"brush: php;\">\n";
|
||||
echo htmlentities($example_code);
|
||||
echo "\n</pre>\n";
|
||||
echo "\n<hr style=\"margin: 3em;\">\n";
|
||||
}
|
||||
?>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div>
|
||||
<div class="column-left">
|
||||
<fieldset>
|
||||
<legend>Mail Details</legend>
|
||||
<table border="1" class="column">
|
||||
<tr>
|
||||
<td class="colleft">
|
||||
<label for="From_Name"><strong>From</strong> Name</label>
|
||||
</td>
|
||||
<td class="colrite">
|
||||
<input type="text" id="From_Name" name="From_Name" value="<?php echo htmlentities($from_name); ?>"
|
||||
style="width:95%;" autofocus placeholder="Your Name">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft">
|
||||
<label for="From_Email"><strong>From</strong> Email Address</label>
|
||||
</td>
|
||||
<td class="colrite">
|
||||
<input type="text" id="From_Email" name="From_Email" value="<?php echo htmlentities($from_email); ?>"
|
||||
style="width:95%;" required placeholder="Your.Email@example.com">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft">
|
||||
<label for="To_Name"><strong>To</strong> Name</label>
|
||||
</td>
|
||||
<td class="colrite">
|
||||
<input type="text" id="To_Name" name="To_Name" value="<?php echo htmlentities($to_name); ?>"
|
||||
style="width:95%;" placeholder="Recipient's Name">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft">
|
||||
<label for="To_Email"><strong>To</strong> Email Address</label>
|
||||
</td>
|
||||
<td class="colrite">
|
||||
<input type="text" id="To_Email" name="To_Email" value="<?php echo htmlentities($to_email); ?>"
|
||||
style="width:95%;" required placeholder="Recipients.Email@example.com">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft">
|
||||
<label for="cc_Email"><strong>CC Recipients</strong><br>
|
||||
<small>(separate with commas)</small>
|
||||
</label>
|
||||
</td>
|
||||
<td class="colrite">
|
||||
<input type="text" id="cc_Email" name="cc_Email" value="<?php echo htmlentities($cc_email); ?>"
|
||||
style="width:95%;" placeholder="cc1@example.com, cc2@example.com">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft">
|
||||
<label for="bcc_Email"><strong>BCC Recipients</strong><br>
|
||||
<small>(separate with commas)</small>
|
||||
</label>
|
||||
</td>
|
||||
<td class="colrite">
|
||||
<input type="text" id="bcc_Email" name="bcc_Email" value="<?php echo htmlentities($bcc_email); ?>"
|
||||
style="width:95%;" placeholder="bcc1@example.com, bcc2@example.com">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft">
|
||||
<label for="Subject"><strong>Subject</strong></label>
|
||||
</td>
|
||||
<td class="colrite">
|
||||
<input type="text" name="Subject" id="Subject" value="<?php echo htmlentities($subject); ?>"
|
||||
style="width:95%;" placeholder="Email Subject">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft">
|
||||
<label for="Message"><strong>Message</strong><br>
|
||||
<small>If blank, will use content.html</small>
|
||||
</label>
|
||||
</td>
|
||||
<td class="colrite">
|
||||
<textarea name="Message" id="Message" style="width:95%;height:5em;"
|
||||
placeholder="Body of your email"><?php echo htmlentities($message); ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="margin:1em 0;">Test will include two attachments.</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="column-right">
|
||||
<fieldset class="inner"> <!-- SELECT TYPE OF MAIL -->
|
||||
<legend>Mail Test Specs</legend>
|
||||
<table border="1" class="column">
|
||||
<tr>
|
||||
<td class="colleft">Test Type</td>
|
||||
<td class="colrite">
|
||||
<div class="radio">
|
||||
<label for="radio-mail">Mail()</label>
|
||||
<input class="radio" type="radio" name="test_type" value="mail" id="radio-mail"
|
||||
onclick="showHideDiv(this.value, 'smtp-options-table');"
|
||||
<?php echo ($test_type == 'mail') ? 'checked' : ''; ?>
|
||||
required>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label for="radio-sendmail">Sendmail</label>
|
||||
<input class="radio" type="radio" name="test_type" value="sendmail" id="radio-sendmail"
|
||||
onclick="showHideDiv(this.value, 'smtp-options-table');"
|
||||
<?php echo ($test_type == 'sendmail') ? 'checked' : ''; ?>
|
||||
required>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label for="radio-qmail">Qmail</label>
|
||||
<input class="radio" type="radio" name="test_type" value="qmail" id="radio-qmail"
|
||||
onclick="showHideDiv(this.value, 'smtp-options-table');"
|
||||
<?php echo ($test_type == 'qmail') ? 'checked' : ''; ?>
|
||||
required>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label for="radio-smtp">SMTP</label>
|
||||
<input class="radio" type="radio" name="test_type" value="smtp" id="radio-smtp"
|
||||
onclick="showHideDiv(this.value, 'smtp-options-table');"
|
||||
<?php echo ($test_type == 'smtp') ? 'checked' : ''; ?>
|
||||
required>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="smtp-options-table" style="margin:1em 0 0 0;
|
||||
<?php if ($test_type != 'smtp') {
|
||||
echo "display: none;";
|
||||
} ?>">
|
||||
<span style="margin:1.25em 0; display:block;"><strong>SMTP Specific Options:</strong></span>
|
||||
<table border="1" class="column">
|
||||
<tr>
|
||||
<td class="colleft"><label for="smtp_debug">SMTP Debug ?</label></td>
|
||||
<td class="colrite">
|
||||
<select size="1" id="smtp_debug" name="smtp_debug">
|
||||
<option <?php echo ($smtp_debug == '0') ? 'selected' : ''; ?> value="0">
|
||||
0 - Disabled
|
||||
</option>
|
||||
<option <?php echo ($smtp_debug == '1') ? 'selected' : ''; ?> value="1">
|
||||
1 - Client messages
|
||||
</option>
|
||||
<option <?php echo ($smtp_debug == '2') ? 'selected' : ''; ?> value="2">
|
||||
2 - Client and server messages
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft"><label for="smtp_server">SMTP Server</label></td>
|
||||
<td class="colrite">
|
||||
<input type="text" id="smtp_server" name="smtp_server"
|
||||
value="<?php echo htmlentities($smtp_server); ?>" style="width:95%;"
|
||||
placeholder="smtp.server.com">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft" style="width: 5em;"><label for="smtp_port">SMTP Port</label></td>
|
||||
<td class="colrite">
|
||||
<input type="text" name="smtp_port" id="smtp_port" size="3"
|
||||
value="<?php echo htmlentities($smtp_port); ?>" placeholder="Port">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft"><label for="smtp_secure">SMTP Security</label></td>
|
||||
<td>
|
||||
<select size="1" name="smtp_secure" id="smtp_secure">
|
||||
<option <?php echo ($smtp_secure == 'none') ? 'selected' : '' ?>>None</option>
|
||||
<option <?php echo ($smtp_secure == 'tls') ? 'selected' : '' ?>>TLS</option>
|
||||
<option <?php echo ($smtp_secure == 'ssl') ? 'selected' : '' ?>>SSL</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft"><label for="smtp-authenticate">SMTP Authenticate?</label></td>
|
||||
<td class="colrite">
|
||||
<input type="checkbox" id="smtp-authenticate"
|
||||
name="smtp_authenticate"
|
||||
<?php if ($smtp_authenticate != '') {
|
||||
echo "checked";
|
||||
} ?>
|
||||
value="true">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft"><label for="authenticate_username">Authenticate Username</label></td>
|
||||
<td class="colrite">
|
||||
<input type="text" id="authenticate_username" name="authenticate_username"
|
||||
value="<?php echo htmlentities($authenticate_username); ?>" style="width:95%;"
|
||||
placeholder="SMTP Server Username">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="colleft"><label for="authenticate_password">Authenticate Password</label></td>
|
||||
<td class="colrite">
|
||||
<input type="password" name="authenticate_password" id="authenticate_password"
|
||||
value="<?php echo htmlentities($authenticate_password); ?>" style="width:95%;"
|
||||
placeholder="SMTP Server Password">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<br style="clear:both;">
|
||||
|
||||
<div style="margin-left:2em; margin-bottom:5em; float:left;">
|
||||
<div style="margin-bottom: 1em; ">
|
||||
<input type="submit" value="Submit" name="submit">
|
||||
</div>
|
||||
<?php echo 'Current PHP version: ' . phpversion(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows how to handle a simple contact form.
|
||||
*/
|
||||
|
||||
$msg = '';
|
||||
//Don't run this unless we're handling a form submission
|
||||
if (array_key_exists('email', $_POST)) {
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
//Tell PHPMailer to use SMTP - requires a local mail server
|
||||
//Faster and safer than using mail()
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'localhost';
|
||||
$mail->Port = 25;
|
||||
|
||||
//Use a fixed address in your own domain as the from address
|
||||
//**DO NOT** use the submitter's address here as it will be forgery
|
||||
//and will cause your messages to fail SPF checks
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
//Send the message to yourself, or whoever should receive contact for submissions
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
//Put the submitter's address in a reply-to header
|
||||
//This will fail if the address provided is invalid,
|
||||
//in which case we should ignore the whole request
|
||||
if ($mail->addReplyTo($_POST['email'], $_POST['name'])) {
|
||||
$mail->Subject = 'PHPMailer contact form';
|
||||
//Keep it simple - don't use HTML
|
||||
$mail->isHTML(false);
|
||||
//Build a simple message body
|
||||
$mail->Body = <<<EOT
|
||||
Email: {$_POST['email']}
|
||||
Name: {$_POST['name']}
|
||||
Message: {$_POST['message']}
|
||||
EOT;
|
||||
//Send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
//The reason for failing to send will be in $mail->ErrorInfo
|
||||
//but you shouldn't display errors to users - process the error, log it on your server.
|
||||
$msg = 'Sorry, something went wrong. Please try again later.';
|
||||
} else {
|
||||
$msg = 'Message sent! Thanks for contacting us.';
|
||||
}
|
||||
} else {
|
||||
$msg = 'Invalid email address, message ignored.';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Contact form</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Contact us</h1>
|
||||
<?php if (!empty($msg)) {
|
||||
echo "<h2>$msg</h2>";
|
||||
} ?>
|
||||
<form method="POST">
|
||||
<label for="name">Name: <input type="text" name="name" id="name"></label><br>
|
||||
<label for="email">Email address: <input type="email" name="email" id="email"></label><br>
|
||||
<label for="message">Message: <textarea name="message" id="message" rows="8" cols="20"></textarea></label><br>
|
||||
<input type="submit" value="Send">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1,17 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>PHPMailer Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
|
||||
<h1>This is a test of PHPMailer.</h1>
|
||||
<div align="center">
|
||||
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
|
||||
</div>
|
||||
<p>This example uses <strong>HTML</strong>.</p>
|
||||
<p>ISO-8859-1 text: éèîüçÅñæß</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,21 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>PHPMailer Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
|
||||
<h1>This is a test of PHPMailer.</h1>
|
||||
<div align="center">
|
||||
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
|
||||
</div>
|
||||
<p>This example uses <strong>HTML</strong>.</p>
|
||||
<p>Chinese text: 郵件內容為空</p>
|
||||
<p>Russian text: Пустое тело сообщения</p>
|
||||
<p>Armenian text: Հաղորդագրությունը դատարկ է</p>
|
||||
<p>Czech text: Prázdné tělo zprávy</p>
|
||||
<p>Emoji: <span style="font-size: 48px">😂 🦄 💥 📤 📧</span></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows how to make use of PHPMailer's exceptions for error handling.
|
||||
*/
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
//Passing true to the constructor enables the use of exceptions for error handling
|
||||
$mail = new PHPMailer(true);
|
||||
try {
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
//Set an alternative reply-to address
|
||||
$mail->addReplyTo('replyto@example.com', 'First Last');
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer Exceptions test';
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//and convert the HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = 'This is a plain-text message body';
|
||||
//Attach an image file
|
||||
$mail->addAttachment('images/phpmailer_mini.png');
|
||||
//send the message
|
||||
//Note that we don't need check the response from this because it will throw an exception if it has trouble
|
||||
$mail->send();
|
||||
echo "Message sent!";
|
||||
} catch (phpmailerException $e) {
|
||||
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(); //Boring error messages from anything else!
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows settings to use when sending via Google's Gmail servers.
|
||||
* The IMAP section shows how to save this message to the 'Sent Mail' folder using IMAP commands.
|
||||
*/
|
||||
|
||||
//SMTP needs accurate times, and the PHP time zone MUST be set
|
||||
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
|
||||
//Tell PHPMailer to use SMTP
|
||||
$mail->isSMTP();
|
||||
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = client and server messages
|
||||
$mail->SMTPDebug = 2;
|
||||
|
||||
//Ask for HTML-friendly debug output
|
||||
$mail->Debugoutput = 'html';
|
||||
|
||||
//Set the hostname of the mail server
|
||||
$mail->Host = 'smtp.gmail.com';
|
||||
// use
|
||||
// $mail->Host = gethostbyname('smtp.gmail.com');
|
||||
// if your network does not support SMTP over IPv6
|
||||
|
||||
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
|
||||
$mail->Port = 587;
|
||||
|
||||
//Set the encryption system to use - ssl (deprecated) or tls
|
||||
$mail->SMTPSecure = 'tls';
|
||||
|
||||
//Whether to use SMTP authentication
|
||||
$mail->SMTPAuth = true;
|
||||
|
||||
//Username to use for SMTP authentication - use full email address for gmail
|
||||
$mail->Username = "username@gmail.com";
|
||||
|
||||
//Password to use for SMTP authentication
|
||||
$mail->Password = "yourpassword";
|
||||
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
|
||||
//Set an alternative reply-to address
|
||||
$mail->addReplyTo('replyto@example.com', 'First Last');
|
||||
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer GMail SMTP test';
|
||||
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//convert HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = 'This is a plain-text message body';
|
||||
|
||||
//Attach an image file
|
||||
$mail->addAttachment('images/phpmailer_mini.png');
|
||||
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
//Section 2: IMAP
|
||||
//Uncomment these to save your message in the 'Sent Mail' folder.
|
||||
#if (save_mail($mail)) {
|
||||
# echo "Message saved!";
|
||||
#}
|
||||
}
|
||||
|
||||
//Section 2: IMAP
|
||||
//IMAP commands requires the PHP IMAP Extension, found at: https://php.net/manual/en/imap.setup.php
|
||||
//Function to call which uses the PHP imap_*() functions to save messages: https://php.net/manual/en/book.imap.php
|
||||
//You can use imap_getmailboxes($imapStream, '/imap/ssl') to get a list of available folders or labels, this can
|
||||
//be useful if you are trying to get this working on a non-Gmail IMAP server.
|
||||
function save_mail($mail) {
|
||||
//You can change 'Sent Mail' to any other folder or tag
|
||||
$path = "{imap.gmail.com:993/imap/ssl}[Gmail]/Sent Mail";
|
||||
|
||||
//Tell your server to open an IMAP connection using the same username and password as you used for SMTP
|
||||
$imapStream = imap_open($path, $mail->Username, $mail->Password);
|
||||
|
||||
$result = imap_append($imapStream, $path, $mail->getSentMIMEMessage());
|
||||
imap_close($imapStream);
|
||||
|
||||
return $result;
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows settings to use when sending via Google's Gmail servers.
|
||||
*/
|
||||
|
||||
//SMTP needs accurate times, and the PHP time zone MUST be set
|
||||
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Load dependencies from composer
|
||||
//If this causes an error, run 'composer install'
|
||||
require '../vendor/autoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailerOAuth;
|
||||
|
||||
//Tell PHPMailer to use SMTP
|
||||
$mail->isSMTP();
|
||||
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = client and server messages
|
||||
$mail->SMTPDebug = 0;
|
||||
|
||||
//Ask for HTML-friendly debug output
|
||||
$mail->Debugoutput = 'html';
|
||||
|
||||
//Set the hostname of the mail server
|
||||
$mail->Host = 'smtp.gmail.com';
|
||||
|
||||
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
|
||||
$mail->Port = 587;
|
||||
|
||||
//Set the encryption system to use - ssl (deprecated) or tls
|
||||
$mail->SMTPSecure = 'tls';
|
||||
|
||||
//Whether to use SMTP authentication
|
||||
$mail->SMTPAuth = true;
|
||||
|
||||
//Set AuthType
|
||||
$mail->AuthType = 'XOAUTH2';
|
||||
|
||||
//User Email to use for SMTP authentication - user who gave consent to our app
|
||||
$mail->oauthUserEmail = "from@gmail.com";
|
||||
|
||||
//Obtained From Google Developer Console
|
||||
$mail->oauthClientId = "RANDOMCHARS-----duv1n2.apps.googleusercontent.com";
|
||||
|
||||
//Obtained From Google Developer Console
|
||||
$mail->oauthClientSecret = "RANDOMCHARS-----lGyjPcRtvP";
|
||||
|
||||
//Obtained By running get_oauth_token.php after setting up APP in Google Developer Console.
|
||||
//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
|
||||
// eg: http://localhost/phpmail/get_oauth_token.php
|
||||
$mail->oauthRefreshToken = "RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0";
|
||||
|
||||
//Set who the message is to be sent from
|
||||
//For gmail, this generally needs to be the same as the user you logged in as
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer GMail SMTP test';
|
||||
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//convert HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = 'This is a plain-text message body';
|
||||
|
||||
//Attach an image file
|
||||
$mail->addAttachment('images/phpmailer_mini.png');
|
||||
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
Binäre Datei nicht angezeigt.
Vorher Breite: | Höhe: | Größe: 5,7 KiB |
Binäre Datei nicht angezeigt.
Vorher Breite: | Höhe: | Größe: 1,8 KiB |
|
@ -1,48 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>PHPMailer Examples</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>PHPMailer code examples<a href="https://github.com/PHPMailer/PHPMailer"><img src="images/phpmailer.png" style="float:right; border:0;" alt="PHPMailer logo"></a></h1>
|
||||
<p>This folder contains a collection of examples of using <a href="https://github.com/PHPMailer/PHPMailer">PHPMailer</a>.</p>
|
||||
<h2>About testing email sending</h2>
|
||||
<p>When working on email sending code you'll find yourself worrying about what might happen if all these test emails got sent to your mailing list. The solution is to use a fake mail server, one that acts just like the real thing, but just doesn't actually send anything out. Some offer web interfaces, feedback, logging, the ability to return specific error codes, all things that are useful for testing error handling, authentication etc. Here's a selection of mail testing tools you might like to try:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/Nilhcem/FakeSMTP">FakeSMTP</a>, a Java desktop app with the ability to show an SMTP log and save messages to a folder. </li>
|
||||
<li><a href="https://github.com/isotoma/FakeEmail">FakeEmail</a>, a Python-based fake mail server with a web interface.</li>
|
||||
<li><a href="http://www.postfix.org/smtp-sink.1.html">smtp-sink</a>, part of the Postfix mail server, so you probably already have this installed. This is used in the Travis-CI configuration to run PHPMailer's unit tests.</li>
|
||||
<li><a href="http://smtp4dev.codeplex.com">smtp4dev</a>, a dummy SMTP server for Windows.</li>
|
||||
<li><a href="https://github.com/PHPMailer/PHPMailer/blob/master/test/fakesendmail.sh">fakesendmail.sh</a>, part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.</li>
|
||||
<li><a href="http://tools.ietf.org/tools/msglint/">msglint</a>, not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.</li>
|
||||
</ul>
|
||||
<div style="padding: 8px; color: #333333; background-color: #dc8b92">
|
||||
<h2>Security note</h2>
|
||||
<p>Before running these examples you'll need to rename them with '.php' extensions. They are supplied as '.phps' files which will usually be displayed with syntax highlighting by PHP instead of running them. This prevents potential security issues with running potential spam-gateway code if you happen to deploy these code examples on a live site - <em>please don't do that!</em> Similarly, don't leave your passwords in these files as they will be visible to the world!</p>
|
||||
</div>
|
||||
<h2><a href="code_generator.phps">code_generator.phps</a></h2>
|
||||
<p>This script is a simple code generator - fill in the form and hit submit, and it will use when you entered to email you a message, and will also generate PHP code using your settings that you can copy and paste to use in your own apps. If you need to get going quickly, this is probably the best place to start.</p>
|
||||
<h2><a href="mail.phps">mail.phps</a></h2>
|
||||
<p>This script is a basic example which creates an email message from an external HTML file, creates a plain text body, sets various addresses, adds an attachment and sends the message. It uses PHP's built-in mail() function which is the simplest to use, but relies on the presence of a local mail server, something which is not usually available on Windows. If you find yourself in that situation, either install a local mail server, or use a remote one and send using SMTP instead.</p>
|
||||
<h2><a href="exceptions.phps">exceptions.phps</a></h2>
|
||||
<p>The same as the mail example, but shows how to use PHPMailer's optional exceptions for error handling.</p>
|
||||
<h2><a href="smtp.phps">smtp.phps</a></h2>
|
||||
<p>A simple example sending using SMTP with authentication.</p>
|
||||
<h2><a href="smtp_no_auth.phps">smtp_no_auth.phps</a></h2>
|
||||
<p>A simple example sending using SMTP without authentication.</p>
|
||||
<h2><a href="sendmail.phps">sendmail.phps</a></h2>
|
||||
<p>A simple example using sendmail. Sendmail is a program (usually found on Linux/BSD, OS X and other UNIX-alikes) that can be used to submit messages to a local mail server without a lengthy SMTP conversation. It's probably the fastest sending mechanism, but lacks some error reporting features. There are sendmail emulators for most popular mail servers including postfix, qmail, exim etc.</p>
|
||||
<h2><a href="gmail.phps">gmail.phps</a></h2>
|
||||
<p>Submitting email via Google's Gmail service is a popular use of PHPMailer. It's much the same as normal SMTP sending, just with some specific settings, namely using TLS encryption, authentication is enabled, and it connects to the SMTP submission port 587 on the smtp.gmail.com host. This example does all that.</p>
|
||||
<h2><a href="pop_before_smtp.phps">pop_before_smtp.phps</a></h2>
|
||||
<p>Before effective SMTP authentication mechanisms were available, it was common for ISPs to use POP-before-SMTP authentication. As it implies, you authenticate using the POP3 protocol (an older protocol now mostly replaced by the far superior IMAP), and then the SMTP server will allow send access from your IP address for a short while, usually 5-15 minutes. PHPMailer includes a POP3 protocol client, so it can carry out this sequence - it's just like a normal SMTP conversation (without authentication), but connects via POP first.</p>
|
||||
<h2><a href="mailing_list.phps">mailing_list.phps</a></h2>
|
||||
<p>This is a somewhat naïve example of sending similar emails to a list of different addresses. It sets up a PHPMailer instance using SMTP, then connects to a MySQL database to retrieve a list of recipients. The code loops over this list, sending email to each person using their info and marks them as sent in the database. It makes use of SMTP keepalive which saves reconnecting and re-authenticating between each message.</p>
|
||||
<hr>
|
||||
<h2><a href="smtp_check.phps">smtp_check.phps</a></h2>
|
||||
<p>This is an example showing how to use the SMTP class by itself (without PHPMailer) to check an SMTP connection.</p>
|
||||
<hr>
|
||||
<p>Most of these examples use the 'example.com' domain. This domain is reserved by IANA for illustrative purposes, as documented in <a href="http://tools.ietf.org/html/rfc2606">RFC 2606</a>. Don't use made-up domains like 'mydomain.com' or 'somedomain.com' in examples as someone, somewhere, probably owns them!</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows sending a message using PHP's mail() function.
|
||||
*/
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
//Set an alternative reply-to address
|
||||
$mail->addReplyTo('replyto@example.com', 'First Last');
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer mail() test';
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//convert HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = 'This is a plain-text message body';
|
||||
//Attach an image file
|
||||
$mail->addAttachment('images/phpmailer_mini.png');
|
||||
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
error_reporting(E_STRICT | E_ALL);
|
||||
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
$mail = new PHPMailer;
|
||||
|
||||
$body = file_get_contents('contents.html');
|
||||
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'smtp.example.com';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead
|
||||
$mail->Port = 25;
|
||||
$mail->Username = 'yourname@example.com';
|
||||
$mail->Password = 'yourpassword';
|
||||
$mail->setFrom('list@example.com', 'List manager');
|
||||
$mail->addReplyTo('list@example.com', 'List manager');
|
||||
|
||||
$mail->Subject = "PHPMailer Simple database mailing list test";
|
||||
|
||||
//Same body for all messages, so set this before the sending loop
|
||||
//If you generate a different body for each recipient (e.g. you're using a templating system),
|
||||
//set it inside the loop
|
||||
$mail->msgHTML($body);
|
||||
//msgHTML also sets AltBody, but if you want a custom one, set it afterwards
|
||||
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
|
||||
|
||||
//Connect to the database and select the recipients from your mailing list that have not yet been sent to
|
||||
//You'll need to alter this to match your database
|
||||
$mysql = mysqli_connect('localhost', 'username', 'password');
|
||||
mysqli_select_db($mysql, 'mydb');
|
||||
$result = mysqli_query($mysql, 'SELECT full_name, email, photo FROM mailinglist WHERE sent = false');
|
||||
|
||||
foreach ($result as $row) { //This iterator syntax only works in PHP 5.4+
|
||||
$mail->addAddress($row['email'], $row['full_name']);
|
||||
if (!empty($row['photo'])) {
|
||||
$mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); //Assumes the image data is stored in the DB
|
||||
}
|
||||
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />';
|
||||
break; //Abandon sending
|
||||
} else {
|
||||
echo "Message sent to :" . $row['full_name'] . ' (' . str_replace("@", "@", $row['email']) . ')<br />';
|
||||
//Mark it as sent in the DB
|
||||
mysqli_query(
|
||||
$mysql,
|
||||
"UPDATE mailinglist SET sent = true WHERE email = '" .
|
||||
mysqli_real_escape_string($mysql, $row['email']) . "'"
|
||||
);
|
||||
}
|
||||
// Clear all addresses and attachments for next loop
|
||||
$mail->clearAddresses();
|
||||
$mail->clearAttachments();
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows how to use POP-before-SMTP for authentication.
|
||||
*/
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Authenticate via POP3.
|
||||
//After this you should be allowed to submit messages over SMTP for a while.
|
||||
//Only applies if your host supports POP-before-SMTP.
|
||||
$pop = POP3::popBeforeSmtp('pop3.example.com', 110, 30, 'username', 'password', 1);
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
//Passing true to the constructor enables the use of exceptions for error handling
|
||||
$mail = new PHPMailer(true);
|
||||
try {
|
||||
$mail->isSMTP();
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = client and server messages
|
||||
$mail->SMTPDebug = 2;
|
||||
//Ask for HTML-friendly debug output
|
||||
$mail->Debugoutput = 'html';
|
||||
//Set the hostname of the mail server
|
||||
$mail->Host = "mail.example.com";
|
||||
//Set the SMTP port number - likely to be 25, 465 or 587
|
||||
$mail->Port = 25;
|
||||
//Whether to use SMTP authentication
|
||||
$mail->SMTPAuth = false;
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
//Set an alternative reply-to address
|
||||
$mail->addReplyTo('replyto@example.com', 'First Last');
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer POP-before-SMTP test';
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//and convert the HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = 'This is a plain-text message body';
|
||||
//Attach an image file
|
||||
$mail->addAttachment('images/phpmailer_mini.png');
|
||||
//send the message
|
||||
//Note that we don't need check the response from this because it will throw an exception if it has trouble
|
||||
$mail->send();
|
||||
echo "Message sent!";
|
||||
} catch (phpmailerException $e) {
|
||||
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(); //Boring error messages from anything else!
|
||||
}
|
|
@ -1,664 +0,0 @@
|
|||
// XRegExp 1.5.1
|
||||
// (c) 2007-2012 Steven Levithan
|
||||
// MIT License
|
||||
// <http://xregexp.com>
|
||||
// Provides an augmented, extensible, cross-browser implementation of regular expressions,
|
||||
// including support for additional syntax, flags, and methods
|
||||
|
||||
var XRegExp;
|
||||
|
||||
if (XRegExp) {
|
||||
// Avoid running twice, since that would break references to native globals
|
||||
throw Error("can't load XRegExp twice in the same frame");
|
||||
}
|
||||
|
||||
// Run within an anonymous function to protect variables and avoid new globals
|
||||
(function (undefined) {
|
||||
|
||||
//---------------------------------
|
||||
// Constructor
|
||||
//---------------------------------
|
||||
|
||||
// Accepts a pattern and flags; returns a new, extended `RegExp` object. Differs from a native
|
||||
// regular expression in that additional syntax and flags are supported and cross-browser
|
||||
// syntax inconsistencies are ameliorated. `XRegExp(/regex/)` clones an existing regex and
|
||||
// converts to type XRegExp
|
||||
XRegExp = function (pattern, flags) {
|
||||
var output = [],
|
||||
currScope = XRegExp.OUTSIDE_CLASS,
|
||||
pos = 0,
|
||||
context, tokenResult, match, chr, regex;
|
||||
|
||||
if (XRegExp.isRegExp(pattern)) {
|
||||
if (flags !== undefined)
|
||||
throw TypeError("can't supply flags when constructing one RegExp from another");
|
||||
return clone(pattern);
|
||||
}
|
||||
// Tokens become part of the regex construction process, so protect against infinite
|
||||
// recursion when an XRegExp is constructed within a token handler or trigger
|
||||
if (isInsideConstructor)
|
||||
throw Error("can't call the XRegExp constructor within token definition functions");
|
||||
|
||||
flags = flags || "";
|
||||
context = { // `this` object for custom tokens
|
||||
hasNamedCapture: false,
|
||||
captureNames: [],
|
||||
hasFlag: function (flag) {return flags.indexOf(flag) > -1;},
|
||||
setFlag: function (flag) {flags += flag;}
|
||||
};
|
||||
|
||||
while (pos < pattern.length) {
|
||||
// Check for custom tokens at the current position
|
||||
tokenResult = runTokens(pattern, pos, currScope, context);
|
||||
|
||||
if (tokenResult) {
|
||||
output.push(tokenResult.output);
|
||||
pos += (tokenResult.match[0].length || 1);
|
||||
} else {
|
||||
// Check for native multicharacter metasequences (excluding character classes) at
|
||||
// the current position
|
||||
if (match = nativ.exec.call(nativeTokens[currScope], pattern.slice(pos))) {
|
||||
output.push(match[0]);
|
||||
pos += match[0].length;
|
||||
} else {
|
||||
chr = pattern.charAt(pos);
|
||||
if (chr === "[")
|
||||
currScope = XRegExp.INSIDE_CLASS;
|
||||
else if (chr === "]")
|
||||
currScope = XRegExp.OUTSIDE_CLASS;
|
||||
// Advance position one character
|
||||
output.push(chr);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
regex = RegExp(output.join(""), nativ.replace.call(flags, flagClip, ""));
|
||||
regex._xregexp = {
|
||||
source: pattern,
|
||||
captureNames: context.hasNamedCapture ? context.captureNames : null
|
||||
};
|
||||
return regex;
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------
|
||||
// Public properties
|
||||
//---------------------------------
|
||||
|
||||
XRegExp.version = "1.5.1";
|
||||
|
||||
// Token scope bitflags
|
||||
XRegExp.INSIDE_CLASS = 1;
|
||||
XRegExp.OUTSIDE_CLASS = 2;
|
||||
|
||||
|
||||
//---------------------------------
|
||||
// Private variables
|
||||
//---------------------------------
|
||||
|
||||
var replacementToken = /\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g,
|
||||
flagClip = /[^gimy]+|([\s\S])(?=[\s\S]*\1)/g, // Nonnative and duplicate flags
|
||||
quantifier = /^(?:[?*+]|{\d+(?:,\d*)?})\??/,
|
||||
isInsideConstructor = false,
|
||||
tokens = [],
|
||||
// Copy native globals for reference ("native" is an ES3 reserved keyword)
|
||||
nativ = {
|
||||
exec: RegExp.prototype.exec,
|
||||
test: RegExp.prototype.test,
|
||||
match: String.prototype.match,
|
||||
replace: String.prototype.replace,
|
||||
split: String.prototype.split
|
||||
},
|
||||
compliantExecNpcg = nativ.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
|
||||
compliantLastIndexIncrement = function () {
|
||||
var x = /^/g;
|
||||
nativ.test.call(x, "");
|
||||
return !x.lastIndex;
|
||||
}(),
|
||||
hasNativeY = RegExp.prototype.sticky !== undefined,
|
||||
nativeTokens = {};
|
||||
|
||||
// `nativeTokens` match native multicharacter metasequences only (including deprecated octals,
|
||||
// excluding character classes)
|
||||
nativeTokens[XRegExp.INSIDE_CLASS] = /^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/;
|
||||
nativeTokens[XRegExp.OUTSIDE_CLASS] = /^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/;
|
||||
|
||||
|
||||
//---------------------------------
|
||||
// Public methods
|
||||
//---------------------------------
|
||||
|
||||
// Lets you extend or change XRegExp syntax and create custom flags. This is used internally by
|
||||
// the XRegExp library and can be used to create XRegExp plugins. This function is intended for
|
||||
// users with advanced knowledge of JavaScript's regular expression syntax and behavior. It can
|
||||
// be disabled by `XRegExp.freezeTokens`
|
||||
XRegExp.addToken = function (regex, handler, scope, trigger) {
|
||||
tokens.push({
|
||||
pattern: clone(regex, "g" + (hasNativeY ? "y" : "")),
|
||||
handler: handler,
|
||||
scope: scope || XRegExp.OUTSIDE_CLASS,
|
||||
trigger: trigger || null
|
||||
});
|
||||
};
|
||||
|
||||
// Accepts a pattern and flags; returns an extended `RegExp` object. If the pattern and flag
|
||||
// combination has previously been cached, the cached copy is returned; otherwise the newly
|
||||
// created regex is cached
|
||||
XRegExp.cache = function (pattern, flags) {
|
||||
var key = pattern + "/" + (flags || "");
|
||||
return XRegExp.cache[key] || (XRegExp.cache[key] = XRegExp(pattern, flags));
|
||||
};
|
||||
|
||||
// Accepts a `RegExp` instance; returns a copy with the `/g` flag set. The copy has a fresh
|
||||
// `lastIndex` (set to zero). If you want to copy a regex without forcing the `global`
|
||||
// property, use `XRegExp(regex)`. Do not use `RegExp(regex)` because it will not preserve
|
||||
// special properties required for named capture
|
||||
XRegExp.copyAsGlobal = function (regex) {
|
||||
return clone(regex, "g");
|
||||
};
|
||||
|
||||
// Accepts a string; returns the string with regex metacharacters escaped. The returned string
|
||||
// can safely be used at any point within a regex to match the provided literal string. Escaped
|
||||
// characters are [ ] { } ( ) * + ? - . , \ ^ $ | # and whitespace
|
||||
XRegExp.escape = function (str) {
|
||||
return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||
};
|
||||
|
||||
// Accepts a string to search, regex to search with, position to start the search within the
|
||||
// string (default: 0), and an optional Boolean indicating whether matches must start at-or-
|
||||
// after the position or at the specified position only. This function ignores the `lastIndex`
|
||||
// of the provided regex in its own handling, but updates the property for compatibility
|
||||
XRegExp.execAt = function (str, regex, pos, anchored) {
|
||||
var r2 = clone(regex, "g" + ((anchored && hasNativeY) ? "y" : "")),
|
||||
match;
|
||||
r2.lastIndex = pos = pos || 0;
|
||||
match = r2.exec(str); // Run the altered `exec` (required for `lastIndex` fix, etc.)
|
||||
if (anchored && match && match.index !== pos)
|
||||
match = null;
|
||||
if (regex.global)
|
||||
regex.lastIndex = match ? r2.lastIndex : 0;
|
||||
return match;
|
||||
};
|
||||
|
||||
// Breaks the unrestorable link to XRegExp's private list of tokens, thereby preventing
|
||||
// syntax and flag changes. Should be run after XRegExp and any plugins are loaded
|
||||
XRegExp.freezeTokens = function () {
|
||||
XRegExp.addToken = function () {
|
||||
throw Error("can't run addToken after freezeTokens");
|
||||
};
|
||||
};
|
||||
|
||||
// Accepts any value; returns a Boolean indicating whether the argument is a `RegExp` object.
|
||||
// Note that this is also `true` for regex literals and regexes created by the `XRegExp`
|
||||
// constructor. This works correctly for variables created in another frame, when `instanceof`
|
||||
// and `constructor` checks would fail to work as intended
|
||||
XRegExp.isRegExp = function (o) {
|
||||
return Object.prototype.toString.call(o) === "[object RegExp]";
|
||||
};
|
||||
|
||||
// Executes `callback` once per match within `str`. Provides a simpler and cleaner way to
|
||||
// iterate over regex matches compared to the traditional approaches of subverting
|
||||
// `String.prototype.replace` or repeatedly calling `exec` within a `while` loop
|
||||
XRegExp.iterate = function (str, regex, callback, context) {
|
||||
var r2 = clone(regex, "g"),
|
||||
i = -1, match;
|
||||
while (match = r2.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.)
|
||||
if (regex.global)
|
||||
regex.lastIndex = r2.lastIndex; // Doing this to follow expectations if `lastIndex` is checked within `callback`
|
||||
callback.call(context, match, ++i, str, regex);
|
||||
if (r2.lastIndex === match.index)
|
||||
r2.lastIndex++;
|
||||
}
|
||||
if (regex.global)
|
||||
regex.lastIndex = 0;
|
||||
};
|
||||
|
||||
// Accepts a string and an array of regexes; returns the result of using each successive regex
|
||||
// to search within the matches of the previous regex. The array of regexes can also contain
|
||||
// objects with `regex` and `backref` properties, in which case the named or numbered back-
|
||||
// references specified are passed forward to the next regex or returned. E.g.:
|
||||
// var xregexpImgFileNames = XRegExp.matchChain(html, [
|
||||
// {regex: /<img\b([^>]+)>/i, backref: 1}, // <img> tag attributes
|
||||
// {regex: XRegExp('(?ix) \\s src=" (?<src> [^"]+ )'), backref: "src"}, // src attribute values
|
||||
// {regex: XRegExp("^http://xregexp\\.com(/[^#?]+)", "i"), backref: 1}, // xregexp.com paths
|
||||
// /[^\/]+$/ // filenames (strip directory paths)
|
||||
// ]);
|
||||
XRegExp.matchChain = function (str, chain) {
|
||||
return function recurseChain (values, level) {
|
||||
var item = chain[level].regex ? chain[level] : {regex: chain[level]},
|
||||
regex = clone(item.regex, "g"),
|
||||
matches = [], i;
|
||||
for (i = 0; i < values.length; i++) {
|
||||
XRegExp.iterate(values[i], regex, function (match) {
|
||||
matches.push(item.backref ? (match[item.backref] || "") : match[0]);
|
||||
});
|
||||
}
|
||||
return ((level === chain.length - 1) || !matches.length) ?
|
||||
matches : recurseChain(matches, level + 1);
|
||||
}([str], 0);
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------
|
||||
// New RegExp prototype methods
|
||||
//---------------------------------
|
||||
|
||||
// Accepts a context object and arguments array; returns the result of calling `exec` with the
|
||||
// first value in the arguments array. the context is ignored but is accepted for congruity
|
||||
// with `Function.prototype.apply`
|
||||
RegExp.prototype.apply = function (context, args) {
|
||||
return this.exec(args[0]);
|
||||
};
|
||||
|
||||
// Accepts a context object and string; returns the result of calling `exec` with the provided
|
||||
// string. the context is ignored but is accepted for congruity with `Function.prototype.call`
|
||||
RegExp.prototype.call = function (context, str) {
|
||||
return this.exec(str);
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------
|
||||
// Overridden native methods
|
||||
//---------------------------------
|
||||
|
||||
// Adds named capture support (with backreferences returned as `result.name`), and fixes two
|
||||
// cross-browser issues per ES3:
|
||||
// - Captured values for nonparticipating capturing groups should be returned as `undefined`,
|
||||
// rather than the empty string.
|
||||
// - `lastIndex` should not be incremented after zero-length matches.
|
||||
RegExp.prototype.exec = function (str) {
|
||||
var match, name, r2, origLastIndex;
|
||||
if (!this.global)
|
||||
origLastIndex = this.lastIndex;
|
||||
match = nativ.exec.apply(this, arguments);
|
||||
if (match) {
|
||||
// Fix browsers whose `exec` methods don't consistently return `undefined` for
|
||||
// nonparticipating capturing groups
|
||||
if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
|
||||
r2 = RegExp(this.source, nativ.replace.call(getNativeFlags(this), "g", ""));
|
||||
// Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
|
||||
// matching due to characters outside the match
|
||||
nativ.replace.call((str + "").slice(match.index), r2, function () {
|
||||
for (var i = 1; i < arguments.length - 2; i++) {
|
||||
if (arguments[i] === undefined)
|
||||
match[i] = undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
// Attach named capture properties
|
||||
if (this._xregexp && this._xregexp.captureNames) {
|
||||
for (var i = 1; i < match.length; i++) {
|
||||
name = this._xregexp.captureNames[i - 1];
|
||||
if (name)
|
||||
match[name] = match[i];
|
||||
}
|
||||
}
|
||||
// Fix browsers that increment `lastIndex` after zero-length matches
|
||||
if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
|
||||
this.lastIndex--;
|
||||
}
|
||||
if (!this.global)
|
||||
this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
|
||||
return match;
|
||||
};
|
||||
|
||||
// Fix browser bugs in native method
|
||||
RegExp.prototype.test = function (str) {
|
||||
// Use the native `exec` to skip some processing overhead, even though the altered
|
||||
// `exec` would take care of the `lastIndex` fixes
|
||||
var match, origLastIndex;
|
||||
if (!this.global)
|
||||
origLastIndex = this.lastIndex;
|
||||
match = nativ.exec.call(this, str);
|
||||
// Fix browsers that increment `lastIndex` after zero-length matches
|
||||
if (match && !compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
|
||||
this.lastIndex--;
|
||||
if (!this.global)
|
||||
this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
|
||||
return !!match;
|
||||
};
|
||||
|
||||
// Adds named capture support and fixes browser bugs in native method
|
||||
String.prototype.match = function (regex) {
|
||||
if (!XRegExp.isRegExp(regex))
|
||||
regex = RegExp(regex); // Native `RegExp`
|
||||
if (regex.global) {
|
||||
var result = nativ.match.apply(this, arguments);
|
||||
regex.lastIndex = 0; // Fix IE bug
|
||||
return result;
|
||||
}
|
||||
return regex.exec(this); // Run the altered `exec`
|
||||
};
|
||||
|
||||
// Adds support for `${n}` tokens for named and numbered backreferences in replacement text,
|
||||
// and provides named backreferences to replacement functions as `arguments[0].name`. Also
|
||||
// fixes cross-browser differences in replacement text syntax when performing a replacement
|
||||
// using a nonregex search value, and the value of replacement regexes' `lastIndex` property
|
||||
// during replacement iterations. Note that this doesn't support SpiderMonkey's proprietary
|
||||
// third (`flags`) parameter
|
||||
String.prototype.replace = function (search, replacement) {
|
||||
var isRegex = XRegExp.isRegExp(search),
|
||||
captureNames, result, str, origLastIndex;
|
||||
|
||||
// There are too many combinations of search/replacement types/values and browser bugs that
|
||||
// preclude passing to native `replace`, so don't try
|
||||
//if (...)
|
||||
// return nativ.replace.apply(this, arguments);
|
||||
|
||||
if (isRegex) {
|
||||
if (search._xregexp)
|
||||
captureNames = search._xregexp.captureNames; // Array or `null`
|
||||
if (!search.global)
|
||||
origLastIndex = search.lastIndex;
|
||||
} else {
|
||||
search = search + ""; // Type conversion
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(replacement) === "[object Function]") {
|
||||
result = nativ.replace.call(this + "", search, function () {
|
||||
if (captureNames) {
|
||||
// Change the `arguments[0]` string primitive to a String object which can store properties
|
||||
arguments[0] = new String(arguments[0]);
|
||||
// Store named backreferences on `arguments[0]`
|
||||
for (var i = 0; i < captureNames.length; i++) {
|
||||
if (captureNames[i])
|
||||
arguments[0][captureNames[i]] = arguments[i + 1];
|
||||
}
|
||||
}
|
||||
// Update `lastIndex` before calling `replacement` (fix browsers)
|
||||
if (isRegex && search.global)
|
||||
search.lastIndex = arguments[arguments.length - 2] + arguments[0].length;
|
||||
return replacement.apply(null, arguments);
|
||||
});
|
||||
} else {
|
||||
str = this + ""; // Type conversion, so `args[args.length - 1]` will be a string (given nonstring `this`)
|
||||
result = nativ.replace.call(str, search, function () {
|
||||
var args = arguments; // Keep this function's `arguments` available through closure
|
||||
return nativ.replace.call(replacement + "", replacementToken, function ($0, $1, $2) {
|
||||
// Numbered backreference (without delimiters) or special variable
|
||||
if ($1) {
|
||||
switch ($1) {
|
||||
case "$": return "$";
|
||||
case "&": return args[0];
|
||||
case "`": return args[args.length - 1].slice(0, args[args.length - 2]);
|
||||
case "'": return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
|
||||
// Numbered backreference
|
||||
default:
|
||||
// What does "$10" mean?
|
||||
// - Backreference 10, if 10 or more capturing groups exist
|
||||
// - Backreference 1 followed by "0", if 1-9 capturing groups exist
|
||||
// - Otherwise, it's the string "$10"
|
||||
// Also note:
|
||||
// - Backreferences cannot be more than two digits (enforced by `replacementToken`)
|
||||
// - "$01" is equivalent to "$1" if a capturing group exists, otherwise it's the string "$01"
|
||||
// - There is no "$0" token ("$&" is the entire match)
|
||||
var literalNumbers = "";
|
||||
$1 = +$1; // Type conversion; drop leading zero
|
||||
if (!$1) // `$1` was "0" or "00"
|
||||
return $0;
|
||||
while ($1 > args.length - 3) {
|
||||
literalNumbers = String.prototype.slice.call($1, -1) + literalNumbers;
|
||||
$1 = Math.floor($1 / 10); // Drop the last digit
|
||||
}
|
||||
return ($1 ? args[$1] || "" : "$") + literalNumbers;
|
||||
}
|
||||
// Named backreference or delimited numbered backreference
|
||||
} else {
|
||||
// What does "${n}" mean?
|
||||
// - Backreference to numbered capture n. Two differences from "$n":
|
||||
// - n can be more than two digits
|
||||
// - Backreference 0 is allowed, and is the entire match
|
||||
// - Backreference to named capture n, if it exists and is not a number overridden by numbered capture
|
||||
// - Otherwise, it's the string "${n}"
|
||||
var n = +$2; // Type conversion; drop leading zeros
|
||||
if (n <= args.length - 3)
|
||||
return args[n];
|
||||
n = captureNames ? indexOf(captureNames, $2) : -1;
|
||||
return n > -1 ? args[n + 1] : $0;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (isRegex) {
|
||||
if (search.global)
|
||||
search.lastIndex = 0; // Fix IE, Safari bug (last tested IE 9.0.5, Safari 5.1.2 on Windows)
|
||||
else
|
||||
search.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// A consistent cross-browser, ES3 compliant `split`
|
||||
String.prototype.split = function (s /* separator */, limit) {
|
||||
// If separator `s` is not a regex, use the native `split`
|
||||
if (!XRegExp.isRegExp(s))
|
||||
return nativ.split.apply(this, arguments);
|
||||
|
||||
var str = this + "", // Type conversion
|
||||
output = [],
|
||||
lastLastIndex = 0,
|
||||
match, lastLength;
|
||||
|
||||
// Behavior for `limit`: if it's...
|
||||
// - `undefined`: No limit
|
||||
// - `NaN` or zero: Return an empty array
|
||||
// - A positive number: Use `Math.floor(limit)`
|
||||
// - A negative number: No limit
|
||||
// - Other: Type-convert, then use the above rules
|
||||
if (limit === undefined || +limit < 0) {
|
||||
limit = Infinity;
|
||||
} else {
|
||||
limit = Math.floor(+limit);
|
||||
if (!limit)
|
||||
return [];
|
||||
}
|
||||
|
||||
// This is required if not `s.global`, and it avoids needing to set `s.lastIndex` to zero
|
||||
// and restore it to its original value when we're done using the regex
|
||||
s = XRegExp.copyAsGlobal(s);
|
||||
|
||||
while (match = s.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.)
|
||||
if (s.lastIndex > lastLastIndex) {
|
||||
output.push(str.slice(lastLastIndex, match.index));
|
||||
|
||||
if (match.length > 1 && match.index < str.length)
|
||||
Array.prototype.push.apply(output, match.slice(1));
|
||||
|
||||
lastLength = match[0].length;
|
||||
lastLastIndex = s.lastIndex;
|
||||
|
||||
if (output.length >= limit)
|
||||
break;
|
||||
}
|
||||
|
||||
if (s.lastIndex === match.index)
|
||||
s.lastIndex++;
|
||||
}
|
||||
|
||||
if (lastLastIndex === str.length) {
|
||||
if (!nativ.test.call(s, "") || lastLength)
|
||||
output.push("");
|
||||
} else {
|
||||
output.push(str.slice(lastLastIndex));
|
||||
}
|
||||
|
||||
return output.length > limit ? output.slice(0, limit) : output;
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------
|
||||
// Private helper functions
|
||||
//---------------------------------
|
||||
|
||||
// Supporting function for `XRegExp`, `XRegExp.copyAsGlobal`, etc. Returns a copy of a `RegExp`
|
||||
// instance with a fresh `lastIndex` (set to zero), preserving properties required for named
|
||||
// capture. Also allows adding new flags in the process of copying the regex
|
||||
function clone (regex, additionalFlags) {
|
||||
if (!XRegExp.isRegExp(regex))
|
||||
throw TypeError("type RegExp expected");
|
||||
var x = regex._xregexp;
|
||||
regex = XRegExp(regex.source, getNativeFlags(regex) + (additionalFlags || ""));
|
||||
if (x) {
|
||||
regex._xregexp = {
|
||||
source: x.source,
|
||||
captureNames: x.captureNames ? x.captureNames.slice(0) : null
|
||||
};
|
||||
}
|
||||
return regex;
|
||||
}
|
||||
|
||||
function getNativeFlags (regex) {
|
||||
return (regex.global ? "g" : "") +
|
||||
(regex.ignoreCase ? "i" : "") +
|
||||
(regex.multiline ? "m" : "") +
|
||||
(regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
|
||||
(regex.sticky ? "y" : "");
|
||||
}
|
||||
|
||||
function runTokens (pattern, index, scope, context) {
|
||||
var i = tokens.length,
|
||||
result, match, t;
|
||||
// Protect against constructing XRegExps within token handler and trigger functions
|
||||
isInsideConstructor = true;
|
||||
// Must reset `isInsideConstructor`, even if a `trigger` or `handler` throws
|
||||
try {
|
||||
while (i--) { // Run in reverse order
|
||||
t = tokens[i];
|
||||
if ((scope & t.scope) && (!t.trigger || t.trigger.call(context))) {
|
||||
t.pattern.lastIndex = index;
|
||||
match = t.pattern.exec(pattern); // Running the altered `exec` here allows use of named backreferences, etc.
|
||||
if (match && match.index === index) {
|
||||
result = {
|
||||
output: t.handler.call(context, match, scope),
|
||||
match: match
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
throw err;
|
||||
} finally {
|
||||
isInsideConstructor = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function indexOf (array, item, from) {
|
||||
if (Array.prototype.indexOf) // Use the native array method if available
|
||||
return array.indexOf(item, from);
|
||||
for (var i = from || 0; i < array.length; i++) {
|
||||
if (array[i] === item)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------
|
||||
// Built-in tokens
|
||||
//---------------------------------
|
||||
|
||||
// Augment XRegExp's regular expression syntax and flags. Note that when adding tokens, the
|
||||
// third (`scope`) argument defaults to `XRegExp.OUTSIDE_CLASS`
|
||||
|
||||
// Comment pattern: (?# )
|
||||
XRegExp.addToken(
|
||||
/\(\?#[^)]*\)/,
|
||||
function (match) {
|
||||
// Keep tokens separated unless the following token is a quantifier
|
||||
return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
|
||||
}
|
||||
);
|
||||
|
||||
// Capturing group (match the opening parenthesis only).
|
||||
// Required for support of named capturing groups
|
||||
XRegExp.addToken(
|
||||
/\((?!\?)/,
|
||||
function () {
|
||||
this.captureNames.push(null);
|
||||
return "(";
|
||||
}
|
||||
);
|
||||
|
||||
// Named capturing group (match the opening delimiter only): (?<name>
|
||||
XRegExp.addToken(
|
||||
/\(\?<([$\w]+)>/,
|
||||
function (match) {
|
||||
this.captureNames.push(match[1]);
|
||||
this.hasNamedCapture = true;
|
||||
return "(";
|
||||
}
|
||||
);
|
||||
|
||||
// Named backreference: \k<name>
|
||||
XRegExp.addToken(
|
||||
/\\k<([\w$]+)>/,
|
||||
function (match) {
|
||||
var index = indexOf(this.captureNames, match[1]);
|
||||
// Keep backreferences separate from subsequent literal numbers. Preserve back-
|
||||
// references to named groups that are undefined at this point as literal strings
|
||||
return index > -1 ?
|
||||
"\\" + (index + 1) + (isNaN(match.input.charAt(match.index + match[0].length)) ? "" : "(?:)") :
|
||||
match[0];
|
||||
}
|
||||
);
|
||||
|
||||
// Empty character class: [] or [^]
|
||||
XRegExp.addToken(
|
||||
/\[\^?]/,
|
||||
function (match) {
|
||||
// For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S].
|
||||
// (?!) should work like \b\B, but is unreliable in Firefox
|
||||
return match[0] === "[]" ? "\\b\\B" : "[\\s\\S]";
|
||||
}
|
||||
);
|
||||
|
||||
// Mode modifier at the start of the pattern only, with any combination of flags imsx: (?imsx)
|
||||
// Does not support x(?i), (?-i), (?i-m), (?i: ), (?i)(?m), etc.
|
||||
XRegExp.addToken(
|
||||
/^\(\?([imsx]+)\)/,
|
||||
function (match) {
|
||||
this.setFlag(match[1]);
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
// Whitespace and comments, in free-spacing (aka extended) mode only
|
||||
XRegExp.addToken(
|
||||
/(?:\s+|#.*)+/,
|
||||
function (match) {
|
||||
// Keep tokens separated unless the following token is a quantifier
|
||||
return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
|
||||
},
|
||||
XRegExp.OUTSIDE_CLASS,
|
||||
function () {return this.hasFlag("x");}
|
||||
);
|
||||
|
||||
// Dot, in dotall (aka singleline) mode only
|
||||
XRegExp.addToken(
|
||||
/\./,
|
||||
function () {return "[\\s\\S]";},
|
||||
XRegExp.OUTSIDE_CLASS,
|
||||
function () {return this.hasFlag("s");}
|
||||
);
|
||||
|
||||
|
||||
//---------------------------------
|
||||
// Backward compatibility
|
||||
//---------------------------------
|
||||
|
||||
// Uncomment the following block for compatibility with XRegExp 1.0-1.2:
|
||||
/*
|
||||
XRegExp.matchWithinChain = XRegExp.matchChain;
|
||||
RegExp.prototype.addFlags = function (s) {return clone(this, s);};
|
||||
RegExp.prototype.execAll = function (s) {var r = []; XRegExp.iterate(s, this, function (m) {r.push(m);}); return r;};
|
||||
RegExp.prototype.forEachExec = function (s, f, c) {return XRegExp.iterate(s, this, f, c);};
|
||||
RegExp.prototype.validate = function (s) {var r = RegExp("^(?:" + this.source + ")$(?!\\s)", getNativeFlags(this)); if (this.global) this.lastIndex = 0; return s.search(r) === 0;};
|
||||
*/
|
||||
|
||||
})();
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
(function() {
|
||||
|
||||
var sh = SyntaxHighlighter;
|
||||
|
||||
/**
|
||||
* Provides functionality to dynamically load only the brushes that a needed to render the current page.
|
||||
*
|
||||
* There are two syntaxes that autoload understands. For example:
|
||||
*
|
||||
* SyntaxHighlighter.autoloader(
|
||||
* [ 'applescript', 'Scripts/shBrushAppleScript.js' ],
|
||||
* [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ]
|
||||
* );
|
||||
*
|
||||
* or a more easily comprehendable one:
|
||||
*
|
||||
* SyntaxHighlighter.autoloader(
|
||||
* 'applescript Scripts/shBrushAppleScript.js',
|
||||
* 'actionscript3 as3 Scripts/shBrushAS3.js'
|
||||
* );
|
||||
*/
|
||||
sh.autoloader = function()
|
||||
{
|
||||
var list = arguments,
|
||||
elements = sh.findElements(),
|
||||
brushes = {},
|
||||
scripts = {},
|
||||
all = SyntaxHighlighter.all,
|
||||
allCalled = false,
|
||||
allParams = null,
|
||||
i
|
||||
;
|
||||
|
||||
SyntaxHighlighter.all = function(params)
|
||||
{
|
||||
allParams = params;
|
||||
allCalled = true;
|
||||
};
|
||||
|
||||
function addBrush(aliases, url)
|
||||
{
|
||||
for (var i = 0; i < aliases.length; i++)
|
||||
brushes[aliases[i]] = url;
|
||||
};
|
||||
|
||||
function getAliases(item)
|
||||
{
|
||||
return item.pop
|
||||
? item
|
||||
: item.split(/\s+/)
|
||||
;
|
||||
}
|
||||
|
||||
// create table of aliases and script urls
|
||||
for (i = 0; i < list.length; i++)
|
||||
{
|
||||
var aliases = getAliases(list[i]),
|
||||
url = aliases.pop()
|
||||
;
|
||||
|
||||
addBrush(aliases, url);
|
||||
}
|
||||
|
||||
// dynamically add <script /> tags to the document body
|
||||
for (i = 0; i < elements.length; i++)
|
||||
{
|
||||
var url = brushes[elements[i].params.brush];
|
||||
|
||||
if(url && scripts[url] === undefined)
|
||||
{
|
||||
if(elements[i].params['html-script'] === 'true')
|
||||
{
|
||||
if(scripts[brushes['xml']] === undefined) {
|
||||
loadScript(brushes['xml']);
|
||||
scripts[url] = false;
|
||||
}
|
||||
}
|
||||
|
||||
scripts[url] = false;
|
||||
loadScript(url);
|
||||
}
|
||||
}
|
||||
|
||||
function loadScript(url)
|
||||
{
|
||||
var script = document.createElement('script'),
|
||||
done = false
|
||||
;
|
||||
|
||||
script.src = url;
|
||||
script.type = 'text/javascript';
|
||||
script.language = 'javascript';
|
||||
script.onload = script.onreadystatechange = function()
|
||||
{
|
||||
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete'))
|
||||
{
|
||||
done = true;
|
||||
scripts[url] = true;
|
||||
checkAll();
|
||||
|
||||
// Handle memory leak in IE
|
||||
script.onload = script.onreadystatechange = null;
|
||||
script.parentNode.removeChild(script);
|
||||
}
|
||||
};
|
||||
|
||||
// sync way of adding script tags to the page
|
||||
document.body.appendChild(script);
|
||||
};
|
||||
|
||||
function checkAll()
|
||||
{
|
||||
for(var url in scripts)
|
||||
if (scripts[url] == false)
|
||||
return;
|
||||
|
||||
if (allCalled)
|
||||
SyntaxHighlighter.highlight(allParams);
|
||||
};
|
||||
};
|
||||
|
||||
})();
|
|
@ -1,72 +0,0 @@
|
|||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var funcs = 'abs acos acosh addcslashes addslashes ' +
|
||||
'array_change_key_case array_chunk array_combine array_count_values array_diff '+
|
||||
'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
|
||||
'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
|
||||
'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
|
||||
'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
|
||||
'array_push array_rand array_reduce array_reverse array_search array_shift '+
|
||||
'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
|
||||
'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
|
||||
'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
|
||||
'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
|
||||
'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
|
||||
'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
|
||||
'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
|
||||
'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
|
||||
'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
|
||||
'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
|
||||
'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
|
||||
'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
|
||||
'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
|
||||
'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
|
||||
'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
|
||||
'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
|
||||
'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
|
||||
'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
|
||||
'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
|
||||
'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
|
||||
'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
|
||||
'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+
|
||||
'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
|
||||
'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
|
||||
'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
|
||||
'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
|
||||
'strtoupper strtr strval substr substr_compare';
|
||||
|
||||
var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' +
|
||||
'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' +
|
||||
'function global goto if implements include include_once interface instanceof insteadof namespace new ' +
|
||||
'old_function or private protected public return require require_once static switch ' +
|
||||
'trait throw try use var while xor ';
|
||||
|
||||
var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: /\$\w+/g, css: 'variable' }, // variables
|
||||
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions
|
||||
{ regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['php'];
|
||||
|
||||
SyntaxHighlighter.brushes.Php = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist
|
@ -1,140 +0,0 @@
|
|||
var dp = {
|
||||
SyntaxHighlighter : {}
|
||||
};
|
||||
|
||||
dp.SyntaxHighlighter = {
|
||||
parseParams: function(
|
||||
input,
|
||||
showGutter,
|
||||
showControls,
|
||||
collapseAll,
|
||||
firstLine,
|
||||
showColumns
|
||||
)
|
||||
{
|
||||
function getValue(list, name)
|
||||
{
|
||||
var regex = new XRegExp('^' + name + '\\[(?<value>\\w+)\\]$', 'gi'),
|
||||
match = null
|
||||
;
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
if ((match = regex.exec(list[i])) != null)
|
||||
return match.value;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function defaultValue(value, def)
|
||||
{
|
||||
return value != null ? value : def;
|
||||
}
|
||||
|
||||
function asString(value)
|
||||
{
|
||||
return value != null ? value.toString() : null;
|
||||
}
|
||||
|
||||
var parts = input.split(':'),
|
||||
brushName = parts[0],
|
||||
options = {},
|
||||
straight = { 'true' : true },
|
||||
reverse = { 'true' : false },
|
||||
defaults = SyntaxHighlighter.defaults
|
||||
;
|
||||
|
||||
for (var i in parts)
|
||||
options[parts[i]] = 'true';
|
||||
|
||||
showGutter = asString(defaultValue(showGutter, defaults.gutter));
|
||||
showControls = asString(defaultValue(showControls, defaults.toolbar));
|
||||
collapseAll = asString(defaultValue(collapseAll, defaults.collapse));
|
||||
showColumns = asString(defaultValue(showColumns, defaults.ruler));
|
||||
firstLine = asString(defaultValue(firstLine, defaults['first-line']));
|
||||
|
||||
return {
|
||||
brush : brushName,
|
||||
gutter : defaultValue(reverse[options.nogutter], showGutter),
|
||||
toolbar : defaultValue(reverse[options.nocontrols], showControls),
|
||||
collapse : defaultValue(straight[options.collapse], collapseAll),
|
||||
// ruler : defaultValue(straight[options.showcolumns], showColumns),
|
||||
'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine)
|
||||
};
|
||||
},
|
||||
|
||||
HighlightAll: function(
|
||||
name,
|
||||
showGutter /* optional */,
|
||||
showControls /* optional */,
|
||||
collapseAll /* optional */,
|
||||
firstLine /* optional */,
|
||||
showColumns /* optional */
|
||||
)
|
||||
{
|
||||
function findValue()
|
||||
{
|
||||
var a = arguments;
|
||||
|
||||
for (var i = 0; i < a.length; i++)
|
||||
{
|
||||
if (a[i] === null)
|
||||
continue;
|
||||
|
||||
if (typeof(a[i]) == 'string' && a[i] != '')
|
||||
return a[i] + '';
|
||||
|
||||
if (typeof(a[i]) == 'object' && a[i].value != '')
|
||||
return a[i].value + '';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function findTagsByName(list, name, tagName)
|
||||
{
|
||||
var tags = document.getElementsByTagName(tagName);
|
||||
|
||||
for (var i = 0; i < tags.length; i++)
|
||||
if (tags[i].getAttribute('name') == name)
|
||||
list.push(tags[i]);
|
||||
}
|
||||
|
||||
var elements = [],
|
||||
highlighter = null,
|
||||
registered = {},
|
||||
propertyName = 'innerHTML'
|
||||
;
|
||||
|
||||
// for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name...
|
||||
findTagsByName(elements, name, 'pre');
|
||||
findTagsByName(elements, name, 'textarea');
|
||||
|
||||
if (elements.length === 0)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < elements.length; i++)
|
||||
{
|
||||
var element = elements[i],
|
||||
params = findValue(
|
||||
element.attributes['class'], element.className,
|
||||
element.attributes['language'], element.language
|
||||
),
|
||||
language = ''
|
||||
;
|
||||
|
||||
if (params === null)
|
||||
continue;
|
||||
|
||||
params = dp.SyntaxHighlighter.parseParams(
|
||||
params,
|
||||
showGutter,
|
||||
showControls,
|
||||
collapseAll,
|
||||
firstLine,
|
||||
showColumns
|
||||
);
|
||||
|
||||
SyntaxHighlighter.highlight(params, element);
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer simple file upload and send example
|
||||
*/
|
||||
$msg = '';
|
||||
if (array_key_exists('userfile', $_FILES)) {
|
||||
// First handle the upload
|
||||
// Don't trust provided filename - same goes for MIME types
|
||||
// See http://php.net/manual/en/features.file-upload.php#114004 for more thorough upload validation
|
||||
$uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name']));
|
||||
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
|
||||
// Upload handled successfully
|
||||
// Now create a message
|
||||
// This should be somewhere in your include_path
|
||||
require '../PHPMailerAutoload.php';
|
||||
$mail = new PHPMailer;
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
$mail->Subject = 'PHPMailer file sender';
|
||||
$mail->Body = 'My message body';
|
||||
// Attach the uploaded file
|
||||
$mail->addAttachment($uploadfile, 'My uploaded file');
|
||||
if (!$mail->send()) {
|
||||
$msg .= "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
$msg .= "Message sent!";
|
||||
}
|
||||
} else {
|
||||
$msg .= 'Failed to move file to ' . $uploadfile;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>PHPMailer Upload</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php if (empty($msg)) { ?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="userfile" type="file">
|
||||
<input type="submit" value="Send File">
|
||||
</form>
|
||||
<?php } else {
|
||||
echo $msg;
|
||||
} ?>
|
||||
</body>
|
||||
</html>
|
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer multiple files upload and send example
|
||||
*/
|
||||
$msg = '';
|
||||
if (array_key_exists('userfile', $_FILES)) {
|
||||
|
||||
// Create a message
|
||||
// This should be somewhere in your include_path
|
||||
require '../PHPMailerAutoload.php';
|
||||
$mail = new PHPMailer;
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
$mail->Subject = 'PHPMailer file sender';
|
||||
$mail->Body = 'My message body';
|
||||
//Attach multiple files one by one
|
||||
for ($ct = 0; $ct < count($_FILES['userfile']['tmp_name']); $ct++) {
|
||||
$uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name'][$ct]));
|
||||
$filename = $_FILES['userfile']['name'][$ct];
|
||||
if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) {
|
||||
$mail->addAttachment($uploadfile, $filename);
|
||||
} else {
|
||||
$msg .= 'Failed to move file to ' . $uploadfile;
|
||||
}
|
||||
}
|
||||
if (!$mail->send()) {
|
||||
$msg .= "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
$msg .= "Message sent!";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>PHPMailer Upload</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php if (empty($msg)) { ?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
|
||||
Select one or more files:
|
||||
<input name="userfile[]" type="file" multiple="multiple">
|
||||
<input type="submit" value="Send Files">
|
||||
</form>
|
||||
<?php } else {
|
||||
echo $msg;
|
||||
} ?>
|
||||
</body>
|
||||
</html>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows sending a message using a local sendmail binary.
|
||||
*/
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
// Set PHPMailer to use the sendmail transport
|
||||
$mail->isSendmail();
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
//Set an alternative reply-to address
|
||||
$mail->addReplyTo('replyto@example.com', 'First Last');
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer sendmail test';
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//convert HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = 'This is a plain-text message body';
|
||||
//Attach an image file
|
||||
$mail->addAttachment('images/phpmailer_mini.png');
|
||||
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows signing a message and then sending it via the mail() function of PHP.
|
||||
*
|
||||
* Before you can sign the mail certificates are needed.
|
||||
*
|
||||
*
|
||||
* STEP 1 - Creating a certificate:
|
||||
* You can either use a self signed certificate, pay for a signed one or use free alternatives such as StartSSL/Comodo etc.
|
||||
* Check out this link for more providers: http://kb.mozillazine.org/Getting_an_SMIME_certificate
|
||||
* In this example I am using Comodo.
|
||||
* The form is directly available via https://secure.comodo.com/products/frontpage?area=SecureEmailCertificate
|
||||
* Fill it out and you'll get an email with a link to download your certificate.
|
||||
* Usually the certificate will be directly installed into your browser (FireFox/Chrome).
|
||||
*
|
||||
*
|
||||
* STEP 2 - Exporting the certificate
|
||||
* This is specific to your browser, however, most browsers will give you the option to export your recently added certificate in PKCS12 (.pfx)
|
||||
* Include your private key if you are asked for it.
|
||||
* Set up a password to protect your exported file.
|
||||
*
|
||||
* STEP 3 - Splitting the .pfx into a private key and the certificate.
|
||||
* I use openssl for this. You only need two commands. In my case the certificate file is called 'exported-cert.pfx'
|
||||
* To create the private key do the following:
|
||||
*
|
||||
* openssl pkcs12 -in exported-cert.pfx -nocerts -out cert.key
|
||||
*
|
||||
* Of course the way you name your file (-out) is up to you.
|
||||
* You will be asked for a password for the Import password. This is the password you just set while exporting the certificate into the pfx file.
|
||||
* Afterwards, you can password protect your private key (recommended)
|
||||
* Also make sure to set the permissions to a minimum level and suitable for your application.
|
||||
* To create the certificate file use the following command:
|
||||
*
|
||||
* openssl pkcs12 -in exported-cert.pfx -clcerts -nokeys -out cert.crt
|
||||
*
|
||||
* Again, the way you name your certificate is up to you. You will be also asked for the Import Password.
|
||||
* To create the certificate-chain file use the following command:
|
||||
*
|
||||
* openssl pkcs12 -in exported-cert.pfx -cacerts -out certchain.pem
|
||||
*
|
||||
* Again, the way you name your chain file is up to you. You will be also asked for the Import Password.
|
||||
*
|
||||
*
|
||||
* STEP 3 - Code
|
||||
*/
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer();
|
||||
//Set who the message is to be sent from
|
||||
//IMPORTANT: This must match the email address of your certificate.
|
||||
//Although the certificate will be valid, an error will be thrown since it cannot be verified that the sender and the signer are the same person.
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
//Set an alternative reply-to address
|
||||
$mail->addReplyTo('replyto@example.com', 'First Last');
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer mail() test';
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//Convert HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = 'This is a plain-text message body';
|
||||
//Attach an image file
|
||||
$mail->addAttachment('images/phpmailer_mini.png');
|
||||
|
||||
//Configure message signing (the actual signing does not occur until sending)
|
||||
$mail->sign(
|
||||
'/path/to/cert.crt', //The location of your certificate file
|
||||
'/path/to/cert.key', //The location of your private key file
|
||||
'yourSecretPrivateKeyPassword', //The password you protected your private key with (not the Import Password! may be empty but parameter must not be omitted!)
|
||||
'/path/to/certchain.pem' //The location of your chain file
|
||||
);
|
||||
|
||||
//Send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
||||
|
||||
/**
|
||||
* REMARKS:
|
||||
* If your email client does not support S/MIME it will most likely just show an attachment smime.p7s which is the signature contained in the email.
|
||||
* Other clients, such as Thunderbird support S/MIME natively and will validate the signature automatically and report the result in some way.
|
||||
*/
|
||||
?>
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows making an SMTP connection with authentication.
|
||||
*/
|
||||
|
||||
//SMTP needs accurate times, and the PHP time zone MUST be set
|
||||
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
//Tell PHPMailer to use SMTP
|
||||
$mail->isSMTP();
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = client and server messages
|
||||
$mail->SMTPDebug = 2;
|
||||
//Ask for HTML-friendly debug output
|
||||
$mail->Debugoutput = 'html';
|
||||
//Set the hostname of the mail server
|
||||
$mail->Host = "mail.example.com";
|
||||
//Set the SMTP port number - likely to be 25, 465 or 587
|
||||
$mail->Port = 25;
|
||||
//Whether to use SMTP authentication
|
||||
$mail->SMTPAuth = true;
|
||||
//Username to use for SMTP authentication
|
||||
$mail->Username = "yourname@example.com";
|
||||
//Password to use for SMTP authentication
|
||||
$mail->Password = "yourpassword";
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
//Set an alternative reply-to address
|
||||
$mail->addReplyTo('replyto@example.com', 'First Last');
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer SMTP test';
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//convert HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = 'This is a plain-text message body';
|
||||
//Attach an image file
|
||||
$mail->addAttachment('images/phpmailer_mini.png');
|
||||
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This uses the SMTP class alone to check that a connection can be made to an SMTP server,
|
||||
* authenticate, then disconnect
|
||||
*/
|
||||
|
||||
//SMTP needs accurate times, and the PHP time zone MUST be set
|
||||
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new SMTP instance
|
||||
$smtp = new SMTP;
|
||||
|
||||
//Enable connection-level debug output
|
||||
$smtp->do_debug = SMTP::DEBUG_CONNECTION;
|
||||
|
||||
try {
|
||||
//Connect to an SMTP server
|
||||
if (!$smtp->connect('mail.example.com', 25)) {
|
||||
throw new Exception('Connect failed');
|
||||
}
|
||||
//Say hello
|
||||
if (!$smtp->hello(gethostname())) {
|
||||
throw new Exception('EHLO failed: ' . $smtp->getError()['error']);
|
||||
}
|
||||
//Get the list of ESMTP services the server offers
|
||||
$e = $smtp->getServerExtList();
|
||||
//If server can do TLS encryption, use it
|
||||
if (is_array($e) && array_key_exists('STARTTLS', $e)) {
|
||||
$tlsok = $smtp->startTLS();
|
||||
if (!$tlsok) {
|
||||
throw new Exception('Failed to start encryption: ' . $smtp->getError()['error']);
|
||||
}
|
||||
//Repeat EHLO after STARTTLS
|
||||
if (!$smtp->hello(gethostname())) {
|
||||
throw new Exception('EHLO (2) failed: ' . $smtp->getError()['error']);
|
||||
}
|
||||
//Get new capabilities list, which will usually now include AUTH if it didn't before
|
||||
$e = $smtp->getServerExtList();
|
||||
}
|
||||
//If server supports authentication, do it (even if no encryption)
|
||||
if (is_array($e) && array_key_exists('AUTH', $e)) {
|
||||
if ($smtp->authenticate('username', 'password')) {
|
||||
echo "Connected ok!";
|
||||
} else {
|
||||
throw new Exception('Authentication failed: ' . $smtp->getError()['error']);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo 'SMTP error: ' . $e->getMessage(), "\n";
|
||||
}
|
||||
//Whatever happened, close the connection.
|
||||
$smtp->quit(true);
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows making an SMTP connection without using authentication.
|
||||
*/
|
||||
|
||||
//SMTP needs accurate times, and the PHP time zone MUST be set
|
||||
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require_once '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
//Tell PHPMailer to use SMTP
|
||||
$mail->isSMTP();
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = client and server messages
|
||||
$mail->SMTPDebug = 2;
|
||||
//Ask for HTML-friendly debug output
|
||||
$mail->Debugoutput = 'html';
|
||||
//Set the hostname of the mail server
|
||||
$mail->Host = "mail.example.com";
|
||||
//Set the SMTP port number - likely to be 25, 465 or 587
|
||||
$mail->Port = 25;
|
||||
//Whether to use SMTP authentication
|
||||
$mail->SMTPAuth = false;
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
//Set an alternative reply-to address
|
||||
$mail->addReplyTo('replyto@example.com', 'First Last');
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer SMTP without auth test';
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//convert HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = 'This is a plain-text message body';
|
||||
//Attach an image file
|
||||
$mail->addAttachment('images/phpmailer_mini.png');
|
||||
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example shows settings to use when sending over SMTP with TLS and custom connection options.
|
||||
*/
|
||||
|
||||
//SMTP needs accurate times, and the PHP time zone MUST be set
|
||||
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
|
||||
//Tell PHPMailer to use SMTP
|
||||
$mail->isSMTP();
|
||||
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = client and server messages
|
||||
$mail->SMTPDebug = 2;
|
||||
|
||||
//Ask for HTML-friendly debug output
|
||||
$mail->Debugoutput = 'html';
|
||||
|
||||
//Set the hostname of the mail server
|
||||
$mail->Host = 'smtp.example.com';
|
||||
|
||||
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
|
||||
$mail->Port = 587;
|
||||
|
||||
//Set the encryption system to use - ssl (deprecated) or tls
|
||||
$mail->SMTPSecure = 'tls';
|
||||
|
||||
//Custom connection options
|
||||
$mail->SMTPOptions = array (
|
||||
'ssl' => array(
|
||||
'verify_peer' => true,
|
||||
'verify_depth' => 3,
|
||||
'allow_self_signed' => true,
|
||||
'peer_name' => 'smtp.example.com',
|
||||
'cafile' => '/etc/ssl/ca_cert.pem',
|
||||
)
|
||||
);
|
||||
|
||||
//Whether to use SMTP authentication
|
||||
$mail->SMTPAuth = true;
|
||||
|
||||
//Username to use for SMTP authentication - use full email address for gmail
|
||||
$mail->Username = "username@example.com";
|
||||
|
||||
//Password to use for SMTP authentication
|
||||
$mail->Password = "yourpassword";
|
||||
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom('from@example.com', 'First Last');
|
||||
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||
|
||||
//Set the subject line
|
||||
$mail->Subject = 'PHPMailer SMTP options test';
|
||||
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//convert HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
echo "Mailer Error: " . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo "Message sent!";
|
||||
}
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden …
In neuem Issue referenzieren