Commits vergleichen

..

11 Commits

Autor SHA1 Nachricht Datum
o.pinke 0ebf3dfabf add using strings to prepare Query
add edit_area to source_editor for testing
2021-09-04 10:16:14 +02:00
o.pinke 022eb6d401 add check for file create if file already exists 2021-08-25 14:02:45 +02:00
o.pinke c684277786 add check for php-mbstring extension
fix typos
2021-08-25 13:57:35 +02:00
o.pinke e3a04c543b fixed bugs 2021-08-24 20:11:10 +02:00
o.pinke 030acf0d00 copy ui style files to new folder 2021-08-24 19:25:50 +02:00
o.pinke 6b373d96c7 additional functions for fancytree and context menu 2021-08-23 20:21:45 +02:00
o.pinke 4752241bd2 adding codemirror for testing - init 2021-08-23 20:21:44 +02:00
o.pinke cac2476447 make prepare method public (has to be recoded with new db driver) 2021-08-23 20:21:44 +02:00
o.pinke 60e5ebd69d init classfile and add to autoloader 2021-08-23 20:21:44 +02:00
o.pinke 16838dc528 add new class cGuiPage to Autoloader 2021-08-23 20:21:44 +02:00
o.pinke 66d45f4064 add fancytree js, recode overview in js-area using fancytree
first steps to new class clFileList to build different directory tree views
2021-08-23 20:21:44 +02:00
1138 geänderte Dateien mit 103516 neuen und 38665 gelöschten Zeilen

8
.gitignore vendored
Datei anzeigen

@ -1,5 +1,4 @@
/nbproject/private/
/.idea/workspace.xml
/data/config/production/config.php
/_dev/
/conlite/plugins/pluginmanager/_src
@ -17,10 +16,3 @@
/cms/config.local.php
/cms/dflip/
/cms/js/firstlevel/
/conlite/external/**/.git
/conlite/logs/debug.log
/cms/data/config/production/config.mod_rewrite.php
/cms/data/config/production/config.local.php
/cms/cache/*
composer.phar
/conlite/vendor/

6
.gitmodules vendored
Datei anzeigen

@ -1,6 +0,0 @@
[submodule "conlite/plugins/cl-newsletter"]
path = conlite/plugins/cl-newsletter
url = https://gitport.de/ConLite/cl-newsletter.git
[submodule "conlite/plugins/cl-content-allocation"]
path = conlite/plugins/cl-content-allocation
url = https://gitport.de/ConLite/cl-content-allocation.git

Datei anzeigen

@ -14,11 +14,7 @@
# $Id: htaccess_simple.txt 145 2019-10-25 16:00:47Z oldperl $
################################################################################
# easily set this enviroment variable to the config you want to use
# add a config folder with the same name in data/config and cms/data/config
# and use your custom config for development
#SetEnv CONLITE_ENVIRONMENT develop
#SetEnv CONLITE_ENVIRONMENT development
<IfModule mod_rewrite.c>
@ -37,7 +33,7 @@
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} ftp://.*$ [NC,OR]
RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC]
RewriteRule ^.* - [F,L,DPI] # all matching conditions from above will end in nirvana
RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana
# Rewrite request to root to front_content.php
RewriteRule ^$ front_content.php [QSA,L]
@ -48,7 +44,7 @@
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L,DPI]
RewriteRule ^.*$ - [NC,L]
# Pass other requests to front_content.php
RewriteRule ^.*$ front_content.php [QSA,NC,L]

8
.idea/.gitignore vendored
Datei anzeigen

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

Datei anzeigen

@ -1,64 +0,0 @@
<?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>

Datei anzeigen

@ -1,6 +0,0 @@
<?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>

Datei anzeigen

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/conlite/external/endroid/qr-code/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/conlite/external/phpmailer/phpmailer/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/conlite/classes" isTestSource="false" packagePrefix="ConLite\" />
<excludeFolder url="file://$MODULE_DIR$/conlite/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/conlite/vendor/phpmailer/phpmailer" />
<excludeFolder url="file://$MODULE_DIR$/conlite/vendor/phpstan/phpstan" />
<excludeFolder url="file://$MODULE_DIR$/conlite/vendor/rector/rector" />
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpmailer/phpmailer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
<excludeFolder url="file://$MODULE_DIR$/conlite/plugins/de.ortwinpinke.soccer_betting_game/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/conlite/plugins/de.ortwinpinke.soccer_betting_game/vendor/rinvex/countries" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Datei anzeigen

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Codeception">
<option name="configurations">
<list>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
</list>
</option>
</component>
</project>

Datei anzeigen

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="dev_clphp74@localhost" uuid="e4a121a5-564c-40f5-b527-e0a343539f90">
<driver-ref>mariadb</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mariadb://localhost:3306/dev_clphp74</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

Datei anzeigen

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" serverName="clphp8" />
</project>

Datei anzeigen

@ -1,8 +0,0 @@
<?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>

Datei anzeigen

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpIncludePathManager">
<include_path>
<path value="$PROJECT_DIR$/conlite/external/phpqrcode/bindings" />
<path value="$PROJECT_DIR$/conlite/external/phpqrcode/tools" />
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/phpmailer/phpmailer" />
<path value="$PROJECT_DIR$/vendor/twig/twig" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/conlite/vendor/phpmailer/phpmailer" />
<path value="$PROJECT_DIR$/conlite/vendor/composer" />
<path value="$PROJECT_DIR$/conlite/vendor/rector/rector" />
<path value="$PROJECT_DIR$/conlite/vendor/phpstan/phpstan" />
<path value="$PROJECT_DIR$/conlite/plugins/de.ortwinpinke.soccer_betting_game/vendor/composer" />
<path value="$PROJECT_DIR$/conlite/plugins/de.ortwinpinke.soccer_betting_game/vendor/rinvex/countries" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStan">
<PhpStan_settings>
<PhpStanConfiguration tool_path="$PROJECT_DIR$/conlite/external/bin/phpstan" />
</PhpStan_settings>
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PhpUnit">
<phpunit_settings>
<PhpUnitSettings custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" />
</phpunit_settings>
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

Datei anzeigen

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PHPSpec">
<suites>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
</suites>
</component>
</project>

Datei anzeigen

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PHPUnit">
<option name="directories">
<list>
<option value="$PROJECT_DIR$/conlite/external/endroid/qr-code/tests" />
<option value="$PROJECT_DIR$/conlite/external/phpmailer/phpmailer/tests" />
<option value="$PROJECT_DIR$/tests" />
</list>
</option>
</component>
</project>

Datei anzeigen

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/conlite/plugins/cl-content-allocation" vcs="Git" />
<mapping directory="$PROJECT_DIR$/conlite/plugins/cl-mod-rewrite" vcs="Git" />
<mapping directory="$PROJECT_DIR$/conlite/plugins/cl-newsletter" vcs="Git" />
</component>
</project>

Datei anzeigen

@ -1,75 +1,71 @@
This is the readme file for **ConLite 3.0.0**
----------------------------------------------------------------------------------------------------
This is the readme file for ConLite 2.1.2
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 [https://api.conlite.org/CL3_0_0](https://api.conlite.org/CL3_0_0)
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)
!!! Attention !!!
We tried to fix all known bugs of Contenido 4.8 and earlier but cannot give any garanties for that. So use
it on your own risk. If you find any bug or have any idea to enhance ConLite, feel free to visit our
bugtracker and register at http://bugs.conlite.org
Any help and ideas are welcome :)
### Mini FAQ
** Mini FAQ **
#### What is ConLite?
What is ConLite?
CL (short for ConLite) is dedicated to close the gap between Contenido 4.8 and the version 4.10.
In downloadable 4.8.20 (and former 4.8.15) are still a lot of bugs and some missing feautures and
In downloadable 4.8.20 (and former 4.8.15) are still a lot of bugs and some missing feautures and
enhancements so one cannot use the version without problems. Our goal is to give you a bugfixed and
really stable version of Contenido till the 4.9 or 4.10 is stable. By the way, there are still a lot of big sides
really stable version of Contenido till the 4.9 or 4.10 is stable. By the way, there are still a lot of big sides
build with 4.8.x out there where upgrading to 4.10.x is not possible or cost a lot of money.
#### Why i have to use ConLite?
Why i have to use ConLite?
You don't have to, but feel free to do it. ConLite will show you an easier way to upgrade step by step to Contenido
You don't have to, but feel free to do it. ConLite will show you an easier way to upgrade step by step to Contenido
4.10. The new version of Contenido has a lot of changes, so you have to do a lot of work
with modules or custom plugins to adapt them to the new version. That's not what ConLite does nor will
do in the future. ConLite will do changes step by step, or better version by version to adapt your
4.8.x or higher installation to work with the new 4.9 of Contenido. And ConLite will try to give you a
with modules or custom plugins to adapt them to the new version. That's not what ConLite does nor will
do in the future. ConLite will do changes step by step, or better version by version to adapt your
4.8.x or higher installation to work with the new 4.9 of Contenido. And ConLite will try to give you a
stable and bugfixed Content-Management-System in the future.
#### Who are the people behind ConLite?
Who are the people behind ConLite?
The Team behind the CL-version are some well known guys from CONTENIDO-forum, working since many years with
and within CONTENIDO core or coding modules and plugins for CONTENIDO.
and within CONTENIDO core or coding modules and plugins for CONTENIDO.
And we love CONTENIDO :)
### Copyright
** Copyright **
The copyright for the code of CONTENIDO still remains to 4fb and the named coders for all codes coming
The copyright for the code of CONTENIDO still remains to 4fb and the named coders for all codes coming
from 4.8.15 and/or from svn- or git-repository of CONTENDIO.
All ads, enhancements or new parts, coded by the CL-Team are copyright by their named coders or
All ads, enhancements or new parts, coded by the CL-Team are copyright by their named coders or
by CL-Team and conlite.org.
### Know Bugs
** Know Bugs **
FS#25 - Collision with pre-installed AMR after Migration
!!! Attention !!!
If you want to upgrade with an installed AMR-plugin, uninstall AMR before upgrade.
We will include a fix for that in one of the next versions of CL
!!! Attention !!!
If you want to upgrade with an installed AMR-plugin, uninstall AMR before upgrade.
We will include a fix for that in one of the next versions of CL
### History / Changelog
**ConLite 2.1.3**
**ConLite 2.1.2**
** History / Changelog **
ConLite 2.1.2
ConLite 2.1.1
ConLite 2.1.0
* see https://gitport.de/ConLite/ConLite/milestones
**ConLite 2.1.1**
**ConLite 2.1.0**
* see [https://gitport.de/ConLite/ConLite/milestones](https://gitport.de/ConLite/ConLite/milestones)
**ConLite 2.0**
**ConLite 1.0**
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
@ -84,4 +80,4 @@ We will include a fix for that in one of the next versions of CL
* 13 Bug Report FEUser-Plugins valide_to and valide_from saving wrong t ...
* 9 Enhancement Check all translations (i18n)
* 8 Bug Report adapt genericdb from 4.8.17 CL
* 5 Bug Report Buttontranslations missing or wrong
* 5 Bug Report Buttontranslations missing or wrong

4
cms/cache/.gitignore vendored Normale Datei
Datei anzeigen

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -1 +0,0 @@
/config.mod_rewrite.php

Datei anzeigen

@ -1,19 +0,0 @@
<?php
// Load environment config file
$configEnv = str_replace('\\', '/', realpath(dirname(__FILE__) . '/')) . '/data/config/config.environment.php';
if (file_exists($configEnv)) {
include_once($configEnv);
}
if (!defined('CL_ENVIRONMENT')) {
if (getenv('CONLITE_ENVIRONMENT')) {
define('CL_ENVIRONMENT', getenv('CONLITE_ENVIRONMENT'));
} if (getenv('CONTENIDO_ENVIRONMENT')) {
define('CL_ENVIRONMENT', getenv('CONTENIDO_ENVIRONMENT'));
} else {
define('CL_ENVIRONMENT', 'production');
}
}
//echo CL_ENVIRONMENT;

Datei anzeigen

@ -48,32 +48,11 @@ if (!defined("CON_FRAMEWORK")) {
}
$contenido_path = '';
# include the config file of the frontend to init the Client and Language Id
include_once ("config.php");
// Set path to current frontend
$frontend_path = str_replace('\\', '/', realpath(dirname(__FILE__) . '/')) . '/';
// Include the environment definer file
include_once($frontend_path . 'environment.php');
if (defined('CL_ENVIRONMENT')) {
include_once($frontend_path . 'data/config/' . CL_ENVIRONMENT . '/config.php');
if (file_exists($frontend_path . 'data/config/' . CL_ENVIRONMENT . '/config.local.php')) {
@include($frontend_path . 'data/config/' . CL_ENVIRONMENT . '/config.local.php');
}
} else {
if(file_exists($frontend_path.'config.php')) {
include_once($frontend_path.'config.php');
}
if(file_exists($frontend_path.'config.local.php')) {
include_once($frontend_path.'config.local.php');
}
}
if (!is_file($contenido_path . 'includes/startup.php')) {
die("<h1>Fatal Error</h1><br>Couldn't include ConLite startup.");
}
include_once($contenido_path . 'includes/startup.php');
# Contenido startup process
include_once ($contenido_path . 'includes/startup.php');
cInclude("includes", "functions.con.php");
cInclude("includes", "functions.con2.php");
@ -93,7 +72,7 @@ if ($cfg["use_pseudocron"] == true) {
* PHPLIB application development toolkit
* @see http://sourceforge.net/projects/phplib
*/
if (!empty($contenido)) {
if ($contenido) {
//Backend
page_open(array('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm'));
i18nInit($cfg["path"]["contenido"] . $cfg["path"]["locale"], $belang);
@ -102,24 +81,33 @@ if (!empty($contenido)) {
page_open(array('sess' => 'Contenido_Frontend_Session', 'auth' => 'Contenido_Frontend_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm'));
}
/**
* Bugfix
* @see http://contenido.org/forum/viewtopic.php?t=18291
*
* added by H. Librenz (2007-12-07)
*/
//includePluginConf();
/**
* fixed bugfix - using functions brokes variable scopes!
*
* added by H. Librenz (2007-12-21) based on an idea of A. Lindner
*/
require_once $cfg['path']['contenido'] . $cfg['path']['includes'] . 'functions.includePluginConf.php';
// Call hook after plugins are loaded, added by Murat Purc, 2008-09-07
CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins');
$db = new DB_ConLite();
$db = new DB_Contenido;
$sess->register("cfgClient");
$sess->register("errsite_idcat");
$sess->register("errsite_idart");
$sess->register("encoding");
if (empty($cfgClient["set"]) || $cfgClient["set"] != "set") {
if ($cfgClient["set"] != "set") {
rereadClients();
}
# Check if this request is for a compressed file
if (isset($_GET['action']) && $_GET['action'] == 'get_compressed') {
if ($_GET['action'] == 'get_compressed') {
# Get the calling parameters
$sFilename = ((isset($_GET['f'])) ? $_GET['f'] : $_GET['amp;f']);
$sContentType = ((isset($_GET['c'])) ? $_GET['c'] : $_GET['amp;c']);
@ -149,9 +137,11 @@ if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) {
// @TODO: Should be outsourced into startup process but requires a better detection (frontend or backend)
Contenido_Security::checkFrontendGlobals();
// update urlbuilder set http base path
Contenido_Url::getInstance()->getUrlBuilder()->setHttpBasePath($cfgClient[$client]['htmlpath']['frontend']);
// Initialize language
if (!isset($lang)) {
@ -237,12 +227,13 @@ $aParams = array(
);
$errsite = 'Location: ' . Contenido_Url::getInstance()->buildRedirect($aParams);
/*
* Try to initialize variables $idcat, $idart, $idcatart, $idartlang
* Note: These variables can be set via http globals e.g. front_content.php?idcat=41&idart=34&idcatart=35&idartlang=42
* If not the values will be computed.
*/
if (!empty($idart) && empty($idcat) && empty($idcatart)) {
if ($idart && !$idcat && !$idcatart) {
/* Try to fetch the first idcat */
$sql = "SELECT idcat FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "'";
$db->query($sql);
@ -255,9 +246,9 @@ if (!empty($idart) && empty($idcat) && empty($idcatart)) {
unset($code);
unset($markscript);
if (empty($idcatart)) {
if (empty($idart)) {
if (empty($idcat)) {
if (!$idcatart) {
if (!$idart) {
if (!$idcat) {
# Note: In earlier Contenido versions the information if an article is startarticle of a category has been stored
# in relation con_cat_art.
if ($cfg["is_start_compatible"] == true) {
@ -304,7 +295,7 @@ if (empty($idcatart)) {
$idart = $db->f("idart");
$idcat = $db->f("idcat");
} else {
if (!empty($contenido)) {
if ($contenido) {
cInclude("includes", "functions.i18n.php");
die(i18n("No start article for this category"));
} else {
@ -411,7 +402,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 (isset($contenido)) {
if ($contenido) {
$perm->load_permissions();
/* Change mode edit / view */
@ -516,7 +507,7 @@ if (isset($contenido)) {
/* If mode is 'edit' and user has permission to edit articles in the current category */
if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) {
if ($inUse == false && $allow == true && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) {
cInclude("includes", "functions.tpl.php");
cInclude("includes", "functions.con.php");
include ($cfg["path"]["contenido"] . $cfg["path"]["includes"] . "include.con_editcontent.php");
@ -527,7 +518,7 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p
##############################################
/* Mark submenuitem 'Preview' in the Contenido Backend (Area: Contenido --> Articles --> Preview) */
if (isset($contenido)) {
if ($contenido) {
$markscript = markSubMenuItem(4, true);
}
@ -597,12 +588,10 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p
}
/* Add mark Script to code if user is in the backend */
if(!empty($markscript)) {
$code = preg_replace("/<\/head>/i", "$markscript\n</head>", $code, 1);
}
$code = preg_replace("/<\/head>/i", "$markscript\n</head>", $code, 1);
/* If article is in use, display notification */
if (!empty($sHtmlInUseCss) && !empty($sHtmlInUseMessage)) {
if ($sHtmlInUseCss && $sHtmlInUseMessage) {
$code = preg_replace("/<\/head>/i", "$sHtmlInUseCss\n</head>", $code, 1);
$code = preg_replace("/(<body[^>]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1);
}
@ -645,7 +634,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_Contenido;
$db2->query($sql);
if ($db2->num_rows() > 0) {
@ -845,4 +834,5 @@ if (isset($savedlang)) {
}
$db->disconnect();
page_close();
page_close();
?>

Datei anzeigen

@ -144,7 +144,8 @@ 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;
@ -258,18 +259,27 @@ class cHTMLInputSelectElement extends cHTMLSelectElement {
}
}
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);
/**
* 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;
}
}
}
}
}
class UI_Config_Table {
@ -292,24 +302,16 @@ class UI_Config_Table {
var $_sColorLight;
var $_sColorDark;
/**
*
* @var type
*/
protected $_iRowCnt = 0;
function __construct() {
$cfg = cRegistry::getConfig();
global $cfg;
$this->_sPadding = 2;
$this->_sBorder = 0;
$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->_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->_sTplTableFile = $cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_list'];
$this->_sColorLight = cRegistry::getConfigValue('color', 'table_light');
$this->_sColorDark = cRegistry::getConfigValue('color', 'table_dark');
$this->_sColorLight = $cfg['color']['table_light'];
$this->_sColorDark = $cfg['color']['table_dark'];
}
function setCellTemplate($sCode) {
@ -415,37 +417,8 @@ class UI_Config_Table {
return $sSkript;
}
/**
* 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();
function render($bPrint = false) {
$oTable = new Template;
$oTable->reset();
$oTable->set('s', 'CELLPADDING', $this->_sPadding);
@ -464,8 +437,6 @@ class UI_Config_Table {
$iCount = 0;
foreach ($aCells as $sCell => $sData) {
$sData = $this->_processContentData($sData);
$iCount++;
$sTplCell = $this->_sTplCellCode;
@ -554,57 +525,6 @@ 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;
}
}
?>

Datei anzeigen

@ -24,10 +24,9 @@ if (!defined('CON_FRAMEWORK')) {
// create Navigation array for one level
function createNavigationArray($start_id, $db) {
global $cfg, $client, $lang, $auth;
global $user, $cfg, $client, $lang, $auth;
$groups = [];
$navigation = [];
$navigation = array();
$FrontendPermissionCollection = new FrontendPermissionCollection;
// SECURITY-FIX
@ -62,6 +61,7 @@ function createNavigationArray($start_id, $db) {
$FrontendGroupMemberCollection->setWhere("idfrontenduser", $auth->auth['uid']);
$FrontendGroupMemberCollection->query();
$groups = array();
while ($member = $FrontendGroupMemberCollection->next()) {
$groups[] = $member->get("idfrontendgroup");
}
@ -74,12 +74,10 @@ function createNavigationArray($start_id, $db) {
}
}
if ($visible) {
$navigation[$cat_id] = [
"idcat" => $cat_id,
$navigation[$cat_id] = array("idcat" => $cat_id,
"name" => $db->f("name"),
"target" => '_self',
"public" => $db->f("public"),
];
"target" => '_self', # you can not call getTarget($cat_id, &$db) at this point with the same db instance!
"public" => $db->f("public"));
}
} // end while
@ -199,7 +197,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 = [];
$root_path = array();
array_push($root_path, $cat_id);
@ -224,13 +222,12 @@ 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 = [];
$aLocation = array();
foreach ($aCatPath as $value) {
if (!$fullweblink) {
if ($mod_rewrite == true) {
@ -268,7 +265,6 @@ function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sT
*/
function getSubTree($idcat_start, $db) {
global $client, $cfg;
$deeper_cats = [];
// SECURITY-FIX
$sql = "SELECT
@ -303,7 +299,6 @@ function getSubTree($idcat_start, $db) {
function getTeaserDeeperCategories($iIdcat, $db) {
global $client, $cfg, $lang;
$deeper_cats = [];
// SECURITY-FIX
$sql = "SELECT
@ -350,7 +345,6 @@ function getTeaserDeeperCategories($iIdcat, $db) {
*/
function getProtectedSubTree($idcat_start, $db) {
global $client, $cfg, $lang;
$deeper_cats = [];
// SECURITY-FIX
$sql = "SELECT
@ -422,8 +416,10 @@ 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
@ -457,8 +453,11 @@ 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
@ -489,18 +488,23 @@ function getProtectedSubCategories($parent_id, $db) {
// end function
function checkCatPermission($idcatlang, $public) {
global $auth;
$groups = [];
#Check if current user has permissions to access cat
$FrontendPermissionCollection = new FrontendPermissionCollection();
global $auth;
$oDB = new DB_ConLite();
$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");
}
@ -514,4 +518,4 @@ function checkCatPermission($idcatlang, $public) {
}
return $visible;
}
}

Datei anzeigen

@ -1,294 +1,294 @@
/* Cookies Directive - The rewrite. Now a jQuery plugin
* Version: 2.0.1
* Author: Ollie Phillips test
* 24 October 2013
*/
;(function($) {
$.cookiesDirective = function(options) {
// Default Cookies Directive Settings
var settings = $.extend({
//Options
explicitConsent: true,
position: 'top',
duration: 10,
limit: 0,
message: null,
cookieScripts: null,
privacyPolicyUri: 'privacy.html',
inlineAction: false,
scriptWrapper: function(){},
// Styling
fontFamily: 'helvetica',
fontColor: '#FFFFFF',
fontSize: '13px',
backgroundColor: '#000000',
backgroundOpacity: '80',
linkColor: '#CA0000',
// Messages
multipleCookieScriptBeginningLabel: ' We use ',
and: ' and ',
multipleCookieScriptEndLabel: ' scripts, which all set cookies. ',
singleCookieScriptBeginningLabel: ' We use a ',
singleCookieScriptEndLabel: ' script which sets cookies.',
explicitCookieDeletionWarning: 'You may delete and block all cookies from this site, but parts of the site will not work.',
explicitFindOutMore: 'To find out more about cookies on this website, see our',
privacyPolicyLinkText: ' privacy policy',
explicitCheckboxLabel: 'You must tick the "I accept cookies from this site" box to accept',
explicitCookieAcceptanceLabel: 'I accept cookies from this site',
explicitCookieAcceptButtonText: 'Continue',
impliedDisclosureText: ' More details can be found in our',
impliedSubmitText: 'Do not show this message again',
}, options);
// Perform consent checks
if(!getCookie('cookiesDirective')) {
if(settings.limit > 0) {
// Display limit in force, record the view
if(!getCookie('cookiesDisclosureCount')) {
setCookie('cookiesDisclosureCount',1,1);
} else {
var disclosureCount = getCookie('cookiesDisclosureCount');
disclosureCount ++;
setCookie('cookiesDisclosureCount',disclosureCount,1);
}
// Have we reached the display limit, if not make disclosure
if(settings.limit >= getCookie('cookiesDisclosureCount')) {
disclosure(settings);
}
} else {
// No display limit
disclosure(settings);
}
// If we don't require explicit consent, load up our script wrapping function
if(!settings.explicitConsent) {
settings.scriptWrapper.call();
}
} else {
// Cookies accepted, load script wrapping function
settings.scriptWrapper.call();
}
};
// Used to load external javascript files into the DOM
$.cookiesDirective.loadScript = function(options) {
var settings = $.extend({
uri: '',
appendTo: 'body'
}, options);
var elementId = String(settings.appendTo);
var sA = document.createElement("script");
sA.src = settings.uri;
sA.type = "text/javascript";
sA.onload = sA.onreadystatechange = function() {
if ((!sA.readyState || sA.readyState == "loaded" || sA.readyState == "complete")) {
return;
}
}
switch(settings.appendTo) {
case 'head':
$('head').append(sA);
break;
case 'body':
$('body').append(sA);
break;
default:
$('#' + elementId).append(sA);
}
}
// Helper scripts
// Get cookie
var getCookie = function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
// Set cookie
var setCookie = function(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
// Detect IE < 9
var checkIE = function(){
var version;
if (navigator.appName == 'Microsoft Internet Explorer') {
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
version = parseFloat(RegExp.$1);
}
if (version <= 8.0) {
return true;
} else {
if(version == 9.0) {
if(document.compatMode == "BackCompat") {
// IE9 in quirks mode won't run the script properly, set to emulate IE8
var mA = document.createElement("meta");
mA.content = "IE=EmulateIE8";
document.getElementsByTagName('head')[0].appendChild(mA);
return true;
} else {
return false;
}
}
return false;
}
} else {
return false;
}
}
// Disclosure routines
var disclosure = function(options) {
var settings = options;
settings.css = 'fixed';
// IE 9 and lower has issues with position:fixed, either out the box or in compatibility mode - fix that
if(checkIE()) {
settings.position = 'top';
settings.css = 'absolute';
}
// Any cookie setting scripts to disclose
var scriptsDisclosure = '';
if (settings.cookieScripts) {
var scripts = settings.cookieScripts.split(',');
var scriptsCount = scripts.length;
var scriptDisclosureTxt = '';
if(scriptsCount>1) {
for(var t=0; t < scriptsCount - 1; t++) {
scriptDisclosureTxt += scripts[t] + ', ';
}
scriptsDisclosure = settings.multipleCookieScriptBeginningLabel + scriptDisclosureTxt.substring(0, scriptDisclosureTxt.length - 2) + settings.and + scripts[scriptsCount - 1] + settings.multipleCookieScriptEndLabel;
} else {
scriptsDisclosure = setting.singleCookieScriptBeginningLabel + scripts[0] + settings.singleCookieScriptEndLabel;
}
}
// Create overlay, vary the disclosure based on explicit/implied consent
// Set our disclosure/message if one not supplied
var html = '';
html += '<div id="epd">';
html += '<div id="cookiesdirective" style="position:'+ settings.css +';'+ settings.position + ':-300px;left:0px;width:100%;'
html += 'height:auto;background:' + settings.backgroundColor + ';opacity:.' + settings.backgroundOpacity + ';';
html += '-ms-filter: “alpha(opacity=' + settings.backgroundOpacity + ')”; filter: alpha(opacity=' + settings.backgroundOpacity + ');';
html += '-khtml-opacity: .' + settings.backgroundOpacity + '; -moz-opacity: .' + settings.backgroundOpacity + ';';
html += 'color:' + settings.fontColor + ';font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';';
html += 'text-align:center;z-index:1000;">';
html += '<div style="position:relative;height:auto;width:90%;padding:10px;margin-left:auto;margin-right:auto;">';
if(!settings.message) {
if(settings.explicitConsent) {
// Explicit consent message
settings.message = 'This site uses cookies. Some of the cookies we ';
settings.message += 'use are essential for parts of the site to operate and have already been set.';
} else {
// Implied consent message
settings.message = 'We have placed cookies on your computer to help make this website better.';
}
}
html += settings.message;
// Build the rest of the disclosure for implied and explicit consent
if(settings.explicitConsent) {
// Explicit consent disclosure
html += scriptsDisclosure + settings.explicitCookieDeletionWarning;
html += settings.explicitFindOutMore + '<a style="color:'+ settings.linkColor + ';font-weight:bold;';
html += 'font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';" href="'+ settings.privacyPolicyUri + '">'+ settings.privacyPolicyLinkText +'</a>.';
html += '<div id="epdnotick" style="color:#ca0000;display:none;margin:2px;"><span style="background:#cecece;padding:2px;">' + settings.explicitCheckboxLabel + '</span></div>'
html += '<div style="margin-top:5px;';
if(settings.inlineAction) {
html += 'display:inline-block;margin-left:5px';
}
html += '">' + settings.explicitCookieAcceptanceLabel + '<input type="checkbox" name="epdagree" id="epdagree" />&nbsp;';
html += '<input type="submit" name="explicitsubmit" id="explicitsubmit" value="' + settings.explicitCookieAcceptButtonText + '"/><br/></div></div>';
} else {
// Implied consent disclosure
html += scriptsDisclosure + settings.impliedDisclosureText + ' <a style="color:'+ settings.linkColor + ';';
html += 'font-weight:bold;font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';" href="'+ settings.privacyPolicyUri + '">' + settings.privacyPolicyLinkText + '</a>.';
html += '<div style="margin-top:5px;';
if(settings.inlineAction) {
html += 'display:inline-block;margin-left:5px';
}
html += '"><input type="submit" name="impliedsubmit" id="impliedsubmit" value="' + settings.impliedSubmitText + '"/></div></div>';
}
html += '</div></div>';
$('body').append(html);
// Serve the disclosure, and be smarter about branching
var dp = settings.position.toLowerCase();
if(dp != 'top' && dp!= 'bottom') {
dp = 'top';
}
var opts = new Array();
if(dp == 'top') {
opts['in'] = {'top':'0'};
opts['out'] = {'top':'-300'};
} else {
opts['in'] = {'bottom':'0'};
opts['out'] = {'bottom':'-300'};
}
// Start animation
$('#cookiesdirective').animate(opts['in'], 1000, function() {
// Set event handlers depending on type of disclosure
if(settings.explicitConsent) {
// Explicit, need to check a box and click a button
$('#explicitsubmit').click(function() {
if($('#epdagree').is(':checked')) {
// Set a cookie to prevent this being displayed again
setCookie('cookiesDirective',1,365);
// Close the overlay
$('#cookiesdirective').animate(opts['out'],1000,function() {
// Remove the elements from the DOM and reload page
$('#cookiesdirective').remove();
location.reload(true);
});
} else {
// We need the box checked we want "explicit consent", display message
$('#epdnotick').css('display', 'block');
}
});
} else {
// Implied consent, just a button to close it
$('#impliedsubmit').click(function() {
// Set a cookie to prevent this being displayed again
setCookie('cookiesDirective',1,365);
// Close the overlay
$('#cookiesdirective').animate(opts['out'],1000,function() {
// Remove the elements from the DOM and reload page
$('#cookiesdirective').remove();
});
});
}
// Set a timer to remove the warning after 'settings.duration' seconds
setTimeout(function(){
$('#cookiesdirective').animate({
opacity:'0'
},2000, function(){
$('#cookiesdirective').css(dp,'-300px');
});
}, settings.duration * 1000);
});
}
})(jQuery);
/* Cookies Directive - The rewrite. Now a jQuery plugin
* Version: 2.0.1
* Author: Ollie Phillips
* 24 October 2013
*/
;(function($) {
$.cookiesDirective = function(options) {
// Default Cookies Directive Settings
var settings = $.extend({
//Options
explicitConsent: true,
position: 'top',
duration: 10,
limit: 0,
message: null,
cookieScripts: null,
privacyPolicyUri: 'privacy.html',
inlineAction: false,
scriptWrapper: function(){},
// Styling
fontFamily: 'helvetica',
fontColor: '#FFFFFF',
fontSize: '13px',
backgroundColor: '#000000',
backgroundOpacity: '80',
linkColor: '#CA0000',
// Messages
multipleCookieScriptBeginningLabel: ' We use ',
and: ' and ',
multipleCookieScriptEndLabel: ' scripts, which all set cookies. ',
singleCookieScriptBeginningLabel: ' We use a ',
singleCookieScriptEndLabel: ' script which sets cookies.',
explicitCookieDeletionWarning: 'You may delete and block all cookies from this site, but parts of the site will not work.',
explicitFindOutMore: 'To find out more about cookies on this website, see our',
privacyPolicyLinkText: ' privacy policy',
explicitCheckboxLabel: 'You must tick the "I accept cookies from this site" box to accept',
explicitCookieAcceptanceLabel: 'I accept cookies from this site',
explicitCookieAcceptButtonText: 'Continue',
impliedDisclosureText: ' More details can be found in our',
impliedSubmitText: 'Do not show this message again',
}, options);
// Perform consent checks
if(!getCookie('cookiesDirective')) {
if(settings.limit > 0) {
// Display limit in force, record the view
if(!getCookie('cookiesDisclosureCount')) {
setCookie('cookiesDisclosureCount',1,1);
} else {
var disclosureCount = getCookie('cookiesDisclosureCount');
disclosureCount ++;
setCookie('cookiesDisclosureCount',disclosureCount,1);
}
// Have we reached the display limit, if not make disclosure
if(settings.limit >= getCookie('cookiesDisclosureCount')) {
disclosure(settings);
}
} else {
// No display limit
disclosure(settings);
}
// If we don't require explicit consent, load up our script wrapping function
if(!settings.explicitConsent) {
settings.scriptWrapper.call();
}
} else {
// Cookies accepted, load script wrapping function
settings.scriptWrapper.call();
}
};
// Used to load external javascript files into the DOM
$.cookiesDirective.loadScript = function(options) {
var settings = $.extend({
uri: '',
appendTo: 'body'
}, options);
var elementId = String(settings.appendTo);
var sA = document.createElement("script");
sA.src = settings.uri;
sA.type = "text/javascript";
sA.onload = sA.onreadystatechange = function() {
if ((!sA.readyState || sA.readyState == "loaded" || sA.readyState == "complete")) {
return;
}
}
switch(settings.appendTo) {
case 'head':
$('head').append(sA);
break;
case 'body':
$('body').append(sA);
break;
default:
$('#' + elementId).append(sA);
}
}
// Helper scripts
// Get cookie
var getCookie = function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
// Set cookie
var setCookie = function(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
// Detect IE < 9
var checkIE = function(){
var version;
if (navigator.appName == 'Microsoft Internet Explorer') {
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
version = parseFloat(RegExp.$1);
}
if (version <= 8.0) {
return true;
} else {
if(version == 9.0) {
if(document.compatMode == "BackCompat") {
// IE9 in quirks mode won't run the script properly, set to emulate IE8
var mA = document.createElement("meta");
mA.content = "IE=EmulateIE8";
document.getElementsByTagName('head')[0].appendChild(mA);
return true;
} else {
return false;
}
}
return false;
}
} else {
return false;
}
}
// Disclosure routines
var disclosure = function(options) {
var settings = options;
settings.css = 'fixed';
// IE 9 and lower has issues with position:fixed, either out the box or in compatibility mode - fix that
if(checkIE()) {
settings.position = 'top';
settings.css = 'absolute';
}
// Any cookie setting scripts to disclose
var scriptsDisclosure = '';
if (settings.cookieScripts) {
var scripts = settings.cookieScripts.split(',');
var scriptsCount = scripts.length;
var scriptDisclosureTxt = '';
if(scriptsCount>1) {
for(var t=0; t < scriptsCount - 1; t++) {
scriptDisclosureTxt += scripts[t] + ', ';
}
scriptsDisclosure = settings.multipleCookieScriptBeginningLabel + scriptDisclosureTxt.substring(0, scriptDisclosureTxt.length - 2) + settings.and + scripts[scriptsCount - 1] + settings.multipleCookieScriptEndLabel;
} else {
scriptsDisclosure = setting.singleCookieScriptBeginningLabel + scripts[0] + settings.singleCookieScriptEndLabel;
}
}
// Create overlay, vary the disclosure based on explicit/implied consent
// Set our disclosure/message if one not supplied
var html = '';
html += '<div id="epd">';
html += '<div id="cookiesdirective" style="position:'+ settings.css +';'+ settings.position + ':-300px;left:0px;width:100%;'
html += 'height:auto;background:' + settings.backgroundColor + ';opacity:.' + settings.backgroundOpacity + ';';
html += '-ms-filter: “alpha(opacity=' + settings.backgroundOpacity + ')”; filter: alpha(opacity=' + settings.backgroundOpacity + ');';
html += '-khtml-opacity: .' + settings.backgroundOpacity + '; -moz-opacity: .' + settings.backgroundOpacity + ';';
html += 'color:' + settings.fontColor + ';font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';';
html += 'text-align:center;z-index:1000;">';
html += '<div style="position:relative;height:auto;width:90%;padding:10px;margin-left:auto;margin-right:auto;">';
if(!settings.message) {
if(settings.explicitConsent) {
// Explicit consent message
settings.message = 'This site uses cookies. Some of the cookies we ';
settings.message += 'use are essential for parts of the site to operate and have already been set.';
} else {
// Implied consent message
settings.message = 'We have placed cookies on your computer to help make this website better.';
}
}
html += settings.message;
// Build the rest of the disclosure for implied and explicit consent
if(settings.explicitConsent) {
// Explicit consent disclosure
html += scriptsDisclosure + settings.explicitCookieDeletionWarning;
html += settings.explicitFindOutMore + '<a style="color:'+ settings.linkColor + ';font-weight:bold;';
html += 'font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';" href="'+ settings.privacyPolicyUri + '">'+ settings.privacyPolicyLinkText +'</a>.';
html += '<div id="epdnotick" style="color:#ca0000;display:none;margin:2px;"><span style="background:#cecece;padding:2px;">' + settings.explicitCheckboxLabel + '</span></div>'
html += '<div style="margin-top:5px;';
if(settings.inlineAction) {
html += 'display:inline-block;margin-left:5px';
}
html += '">' + settings.explicitCookieAcceptanceLabel + '<input type="checkbox" name="epdagree" id="epdagree" />&nbsp;';
html += '<input type="submit" name="explicitsubmit" id="explicitsubmit" value="' + settings.explicitCookieAcceptButtonText + '"/><br/></div></div>';
} else {
// Implied consent disclosure
html += scriptsDisclosure + settings.impliedDisclosureText + ' <a style="color:'+ settings.linkColor + ';';
html += 'font-weight:bold;font-family:' + settings.fontFamily + ';font-size:' + settings.fontSize + ';" href="'+ settings.privacyPolicyUri + '">' + settings.privacyPolicyLinkText + '</a>.';
html += '<div style="margin-top:5px;';
if(settings.inlineAction) {
html += 'display:inline-block;margin-left:5px';
}
html += '"><input type="submit" name="impliedsubmit" id="impliedsubmit" value="' + settings.impliedSubmitText + '"/></div></div>';
}
html += '</div></div>';
$('body').append(html);
// Serve the disclosure, and be smarter about branching
var dp = settings.position.toLowerCase();
if(dp != 'top' && dp!= 'bottom') {
dp = 'top';
}
var opts = new Array();
if(dp == 'top') {
opts['in'] = {'top':'0'};
opts['out'] = {'top':'-300'};
} else {
opts['in'] = {'bottom':'0'};
opts['out'] = {'bottom':'-300'};
}
// Start animation
$('#cookiesdirective').animate(opts['in'], 1000, function() {
// Set event handlers depending on type of disclosure
if(settings.explicitConsent) {
// Explicit, need to check a box and click a button
$('#explicitsubmit').click(function() {
if($('#epdagree').is(':checked')) {
// Set a cookie to prevent this being displayed again
setCookie('cookiesDirective',1,365);
// Close the overlay
$('#cookiesdirective').animate(opts['out'],1000,function() {
// Remove the elements from the DOM and reload page
$('#cookiesdirective').remove();
location.reload(true);
});
} else {
// We need the box checked we want "explicit consent", display message
$('#epdnotick').css('display', 'block');
}
});
} else {
// Implied consent, just a button to close it
$('#impliedsubmit').click(function() {
// Set a cookie to prevent this being displayed again
setCookie('cookiesDirective',1,365);
// Close the overlay
$('#cookiesdirective').animate(opts['out'],1000,function() {
// Remove the elements from the DOM and reload page
$('#cookiesdirective').remove();
});
});
}
// Set a timer to remove the warning after 'settings.duration' seconds
setTimeout(function(){
$('#cookiesdirective').animate({
opacity:'0'
},2000, function(){
$('#cookiesdirective').css(dp,'-300px');
});
}, settings.duration * 1000);
});
}
})(jQuery);

Datei anzeigen

@ -1,18 +1,18 @@
<!-- developer design for file list test -->
<h3>{TITLE}</h3>
<!--
Possible place holders for entries:
FILELINK, FILENAME, FILEEXTENSION, FILESIZE, FILESIZE_UNIT,
FILECREATIONDATE, FILEMODIFYDATE, FILEDIRCTORY,
FILEMETA_DESCRIPTION, FILEMETA_KEYWORDS, FILEMETA_MEDIANAME,
FILEMETA_INTERNAL_NOTICE, FILEMETA_COPYRIGHT
-->
<!-- BEGIN:BLOCK -->
<div style="float: left;margin-bottom: 20px;width:47%;padding-right:5px">
<b><a href="{FILELINK}">{FILENAME}</a></b> ({FILEEXTENSION})<br />
<span style="color: rgb(170, 170, 170);">{LABEL_FILESIZE}</span> {FILESIZE} {FILESIZE_UNIT}<br />
<span style="color: rgb(170, 170, 170);">{LABEL_UPLOAD_DATE}</span> {FILECREATIONDATE}<br />
{FILEMETA_DESCRIPTION}
</div>
<!-- END:BLOCK -->
<!-- developer design for file list -->
<h3>{TITLE}</h3>
<!--
Possible place holders for entries:
FILELINK, FILENAME, FILEEXTENSION, FILESIZE, FILESIZE_UNIT,
FILECREATIONDATE, FILEMODIFYDATE, FILEDIRCTORY,
FILEMETA_DESCRIPTION, FILEMETA_KEYWORDS, FILEMETA_MEDIANAME,
FILEMETA_INTERNAL_NOTICE, FILEMETA_COPYRIGHT
-->
<!-- BEGIN:BLOCK -->
<div style="float: left;margin-bottom: 20px;width:47%;padding-right:5px">
<b><a href="{FILELINK}">{FILENAME}</a></b> ({FILEEXTENSION})<br />
<span style="color: rgb(170, 170, 170);">{LABEL_FILESIZE}</span> {FILESIZE} {FILESIZE_UNIT}<br />
<span style="color: rgb(170, 170, 170);">{LABEL_UPLOAD_DATE}</span> {FILECREATIONDATE}<br />
{FILEMETA_DESCRIPTION}
</div>
<!-- END:BLOCK -->
<br style="clear:both" />

Datei anzeigen

@ -1,26 +1,22 @@
{
"name": "org.conlite/conlite",
"description": "ConLite vendor libs",
"license": "GPL-3.0-or-later",
"name": "vendor/con-lite21",
"description": "Description of project ConLite21.",
"authors": [
{
"name": "oldperl",
"email": "ortwin.pinke@php-backoffice.de"
}
],
"require": {
"php": "^8.0",
"phpmailer/phpmailer": "v6.8.0",
"twig/twig": "^3.0"
"config": {
"vendor-dir": "conlite/external"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.0",
"rector/rector": "^0.15"
"require": {
"phpmailer/phpmailer": "v6.5.*",
"endroid/qr-code": "4.2.2"
},
"autoload": {
"psr-4": {
"ConLite\\": "conlite/classes"
"Conlite\\External\\": "conlite/external"
}
}
}

2189
composer.lock generiert

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -92,10 +92,6 @@ class DB_Sql extends DB_Sql_Abstract {
return null;
}
// PHP 8.1 fix
$driver = new mysqli_driver();
$driver->report_mode = MYSQLI_REPORT_OFF;
$dbh = mysqli_init();
//print_r($dbh);
if (!$dbh) {
@ -127,7 +123,7 @@ class DB_Sql extends DB_Sql_Abstract {
$aCon['socket'] = null;
}
if (!isset($aCon['flags'])) {
$aCon['flags'] = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT;
$aCon['flags'] = null;
}
if (!isset($aCon['database'])) {
$aCon['database'] = null;
@ -138,10 +134,10 @@ class DB_Sql extends DB_Sql_Abstract {
);
if (!empty($aCon['charset'])) {
mysqli_set_charset($dbh, $aCon['charset']);
if (isset($aCon['charset'])) {
@mysqli_set_charset($dbh, $aCon['charset']);
} else {
mysqli_set_charset($dbh, 'utf8');
@mysqli_set_charset($dbh, 'utf8');
}
//echo mysqli_character_set_name($dbh);
@ -185,8 +181,7 @@ class DB_Sql extends DB_Sql_Abstract {
/**
* @see DB_Sql_Abstract::next_record()
*/
public function next_record(): bool|int
{
public function next_record() {
if (!$this->Query_ID instanceof mysqli_result) {
return false;
}
@ -331,30 +326,30 @@ class DB_Sql extends DB_Sql_Abstract {
}
/**
* @see DB_Sql_Abstract::_metaData()
* * Due to compatibility problems with Table we changed the behavior
* of metadata();
* depending on $full, metadata returns the following values:
*
* - full is false (default):
* $result[]:
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["flags"] field flags
*
* - full is true
* $result[]:
* ["num_fields"] number of metadata records
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["flags"] field flags
* ["meta"][field name] index of field named "field name"
* This last one could be used if you have a field name, but no index.
* Test: if (isset($result['meta']['myfield'])) { ...
* @see DB_Sql_Abstract::_metaData()
* * Due to compatibility problems with Table we changed the behavior
* of metadata();
* depending on $full, metadata returns the following values:
*
* - full is false (default):
* $result[]:
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["flags"] field flags
*
* - full is true
* $result[]:
* ["num_fields"] number of metadata records
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["flags"] field flags
* ["meta"][field name] index of field named "field name"
* This last one could be used if you have a field name, but no index.
* Test: if (isset($result['meta']['myfield'])) { ...
*/
protected function _metaData($table = '', $full = false) {
$count = 0;
@ -397,7 +392,7 @@ class DB_Sql extends DB_Sql_Abstract {
$count = 0;
while ($finfo = $id->fetch_field()) {
//rint_r($finfo);
//rint_r($finfo);
$res[$count]['table'] = $finfo->table;
$res[$count]['name'] = $finfo->name;
$res[$count]['type'] = $this->_aDataTypes[$finfo->type];
@ -425,13 +420,10 @@ class DB_Sql extends DB_Sql_Abstract {
* @see DB_Sql_Abstract::escape()
*/
public function escape($sString) {
if(is_null($sString)) {
$sString = '';
}
$sResult = '';
if (is_resource($this->Link_ID) || $this->connect()) {
$sResult = mysqli_real_escape_string($this->Link_ID, $sString);
}
};
return $sResult;
}
@ -448,7 +440,7 @@ class DB_Sql extends DB_Sql_Abstract {
$return[$i]['table_name'] = $info[0];
$return[$i]['tablespace_name'] = $this->Database;
$return[$i]['database'] = $this->Database;
$i++;
$i ++;
}
mysqli_free_result($h);

Datei anzeigen

@ -416,12 +416,32 @@ abstract class DB_Sql_Abstract {
* </pre>
* @return string
*/
protected function _prepareQueryf($sQuery, array $aArgs) {
public function _prepareQueryf($sQuery, array $aArgs) {
var_dump($sQuery);
print_r($aArgs);
if (count($aArgs) > 0) {
$aArgs = array_map(array($this, 'escape'), $aArgs);
array_unshift($aArgs, $sQuery);
$sQuery = call_user_func_array('sprintf', $aArgs);
if (count(array_filter(array_keys($aArgs), 'is_string')) > 0) {
foreach ($aArgs as $key => $value) {
$param = ':' . $key;
$statement = $sQuery;
if (cSecurity::isInteger($value)) {
$statement = preg_replace('/' . $param . '/', cSecurity::toInteger($value), $statement);
$statement = preg_replace('/\'' . $param . '\'/', '\'' . cSecurity::toInteger($value) . '\'', $statement);
} else {
$param = cSecurity::toString($param);
$statement = preg_replace('/' . $param . '/', cSecurity::escapeString($value), $statement);
$statement = preg_replace('/\'' . $param . '\'/', '\'' . cSecurity::escapeString($value) . '\'', $statement);
$statement = preg_replace('/`' . $param . '`/', '`' . cSecurity::escapeString($value) . '`', $statement);
}
$sQuery = $statement;
}
} else {
$aArgs = array_map(array($this, 'escape'), $aArgs);
array_unshift($aArgs, $sQuery);
$sQuery = call_user_func_array('sprintf', $aArgs);
}
}
var_dump($sQuery);
return $sQuery;
}
@ -755,9 +775,9 @@ abstract class DB_Sql_Abstract {
self::$_aProfileData[] = array(
'time' => $fEndTime - $fStartTime,
'query' => $sQuery
/*,
'ErrNo' => static::_getErrorNumber(),
'ErrMess' => static::_getErrorMessage()*/
/* ,
'ErrNo' => static::_getErrorNumber(),
'ErrMess' => static::_getErrorMessage() */
);
}
@ -783,21 +803,21 @@ abstract class DB_Sql_Abstract {
printf("<pre>" . $sMsg . "</pre>\n");
}
}
/**
* returns info about db-server
*
* return string
*/
abstract public function getServerInfo();
/**
* returns client encoding
*
* return string
*/
abstract public function getClientEncoding();
/**
* returns client info
*

Datei anzeigen

@ -41,7 +41,6 @@ if (!defined('CON_FRAMEWORK')) {
* DB-class for all DB handling
*/
class DB_ConLite extends DB_Sql {
protected bool $NoRecord;
/**
* Constructor of database class.
@ -59,13 +58,13 @@ class DB_ConLite extends DB_Sql {
* - $options['enableProfiling'] (bool) Optional, flag to enable profiling
* @return void
*/
public function __construct(array $options = []) {
public function __construct(array $options = array()) {
global $cachemeta;
parent::__construct($options);
if (!is_array($cachemeta)) {
$cachemeta = [];
$cachemeta = array();
}
// TODO check this out
@ -80,20 +79,16 @@ class DB_ConLite extends DB_Sql {
/**
* Fetches the next recordset from result set
*
* @deprecated since ConLite 2.3
* @param bool
*/
public function next_record(): bool|int
{
return $this->nextRecord();
}
public function nextRecord(): bool|int
{
$currentModule = cRegistry::getCurrentModule();
public function next_record() {
global $cCurrentModule;
// FIXME For what reason is NoRecord used???
$this->NoRecord = false;
if (!$this->Query_ID) {
if ($currentModule > 0) {
$this->halt("next_record called with no query pending in Module ID $currentModule.");
$this->NoRecord = true;
if ($cCurrentModule > 0) {
$this->halt("next_record called with no query pending in Module ID $cCurrentModule.");
} else {
$this->halt("next_record called with no query pending.");
}
@ -113,7 +108,7 @@ class DB_ConLite extends DB_Sql {
*/
public function copyResultToArray($sTable = '') {
$aValues = [];
$aValues = array();
$aMetadata = $this->metadata($sTable);
@ -136,8 +131,17 @@ class DB_ConLite extends DB_Sql {
*
* @deprecated since version 2.0.0, use DB_ConLite instead
*/
class DB_Contenido extends DB_ConLite
{
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 Contenido_CT_Sql extends CT_Sql {
@ -171,12 +175,17 @@ 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): bool {
$str = match ($this->encoding_mode) {
'slashes' => addslashes($name . ':' . $str),
default => base64_encode($name . ':' . $str),
};
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);
}
$name = addslashes($name);
$now = date('YmdHis', time());
@ -185,7 +194,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 (bool) $this->db->query($iquery);
return ($this->db->query($iquery)) ? true : false;
}
}
@ -270,12 +279,14 @@ class Contenido_CT_Shm extends CT_Shm {
class Contenido_CT_Session extends CT_Session {
public function __construct() {
$this->ac_start([
$this->ac_start(array(
'namespace' => 'contenido_ct_session_ns',
'session.hash_function' => '1',
// use sha-1 function
'session.hash_bits_per_character' => '5',
]);
'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',
));
}
}
@ -309,8 +320,8 @@ class Contenido_Session extends Session {
}
public function delete() {
$inUseCollection = new InUseCollection();
$inUseCollection->removeSessionMarks($this->id);
$oCol = new InUseCollection();
$oCol->removeSessionMarks($this->id);
parent::delete();
}
@ -424,8 +435,6 @@ class Contenido_Challenge_Auth extends Auth {
}
public function auth_validatelogin() {
$pass = null;
$uid = null;
global $username, $password, $challenge, $response, $timestamp;
if ($password == '') {
@ -513,7 +522,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
public function auth_loglogin($uid) {
global $cfg, $client, $lang, $auth, $sess, $saveLoginTime;
$contenidoPerm = new Contenido_Perm();
$perm = new Contenido_Perm();
$timestamp = date('Y-m-d H:i:s');
$idcatart = '0';
@ -530,7 +539,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
$iTmpClient = $this->db->f('idclient');
$iTmpLang = $this->db->f('idlang');
if ($contenidoPerm->have_perm_client_lang($iTmpClient, $iTmpLang)) {
if ($perm->have_perm_client_lang($iTmpClient, $iTmpLang)) {
$client = $iTmpClient;
$lang = $iTmpLang;
$bFound = true;
@ -555,7 +564,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
return;
}
$idaction = $contenidoPerm->getIDForAction('login');
$idaction = $perm->getIDForAction('login');
$lastentry = $this->db->nextid($cfg['tab']['actionlog']);
$sql = "INSERT INTO
@ -575,12 +584,9 @@ 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 = [];
$gperm = array();
if ($password == '') {
return false;
@ -615,9 +621,11 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
$pass = $this->db->f('password'); ## Password is stored as a md5 hash
$bInMaintenance = false;
#sysadmins are allowed to login every time
if ($sMaintenanceMode == 'enabled' && !preg_match('/sysadmin/', $perm)) {
$bInMaintenance = true;
if ($sMaintenanceMode == 'enabled') {
#sysadmins are allowed to login every time
if (!preg_match('/sysadmin/', $perm)) {
$bInMaintenance = true;
}
}
if ($bInMaintenance) {
@ -626,11 +634,14 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
unset($pass);
}
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);
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);
}
}
}
}
@ -652,7 +663,9 @@ class Contenido_Challenge_Crypt_Auth extends Auth {
$gperm[] = $this->db->f('perms');
}
$perm = implode(',', $gperm);
if (is_array($gperm)) {
$perm = implode(',', $gperm);
}
if ($response == '') { ## True when JS is disabled
if (md5($password) != $pass) { ## md5 hash for non-JavaScript browsers
@ -704,6 +717,8 @@ 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;
}
@ -720,18 +735,13 @@ 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'
} elseif ($this->nobody) {
## provides for 'default login cancel'
$this->auth['uname'] = $username; ## This provides access for 'loginform.ihtml'
} else if ($this->nobody) { ## provides for 'default login cancel'
$uid = $this->auth['uname'] = $this->auth['uid'] = 'nobody';
return $uid;
}
@ -757,11 +767,13 @@ 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) && 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)) {
if (array_key_exists($pass, $auth_handlers)) {
$success = call_user_func($auth_handlers[$pass], $username, $password);
if ($success) {
$uid = md5($username);
$pass = md5($password);
}
}
}
}
@ -783,7 +795,9 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth {
$gperm[] = $this->db->f('perms');
}
$perm = implode(',', $gperm);
if (is_array($gperm)) {
$perm = implode(',', $gperm);
}
}
}
@ -822,16 +836,16 @@ function register_auth_handler($aHandlers) {
global $auth_handlers;
if (!is_array($auth_handlers)) {
$auth_handlers = [];
$auth_handlers = array();
}
if (!is_array($aHandlers)) {
$aHandlers = [$aHandlers];
$aHandlers = Array($aHandlers);
}
foreach ($aHandlers as $aHandler) {
if (!in_array($aHandler, $auth_handlers)) {
$auth_handlers[md5($aHandler)] = $aHandler;
foreach ($aHandlers as $sHandler) {
if (!in_array($sHandler, $auth_handlers)) {
$auth_handlers[md5($sHandler)] = $sHandler;
}
}
}

Datei anzeigen

@ -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

Datei anzeigen

@ -35,8 +35,8 @@ if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
$_PHPLIB = [];
$_PHPLIB['libdir'] = str_replace ('\\', '/', __DIR__ . '/');
$_PHPLIB = array();
$_PHPLIB['libdir'] = str_replace ('\\', '/', dirname(__FILE__) . '/');
global $cfg;

Datei anzeigen

@ -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;

Datei anzeigen

@ -330,9 +330,13 @@ if( sizeof($_GET) == 0 && isset($_POST['save_search']) )
// STORED SEARCH HAS BEEN CALLED
elseif( sizeof($_GET) > 0)
{
$itemtypeReq = (isset($itemtypeReq))?$_GET['itemtype']:'';
$itemidReq = (isset($itemidReq))?$_GET['itemid']:'';
if(strlen($itemtypeReq) > 0 && strlen($itemidReq) > 0) {
$itemtypeReq = $_GET['itemtype'];
$itemidReq = $_GET['itemid'];
// Do we have the request parameters we need to fetch search values of stored search ?
if( (isset($itemtypeReq) && strlen($itemtypeReq)>0) &&
(isset($itemidReq) && strlen($itemidReq)>0)
)
{
$searchResults = getSearchResults($itemidReq, $itemtypeReq);
$sSearchStr_tmp = $searchResults[$save_title];
$iSearchID_tmp = $searchResults[$save_id];
@ -399,13 +403,13 @@ if ($iSearchID_tmp > 0) {
}
// Date
if ($sSearchStrDateType_tmp != 'n/a') {
if (!empty($sSearchStrDateFromDay_tmp) && !empty($sSearchStrDateFromMonth_tmp) && !empty($sSearchStrDateFromYear_tmp)) {
if (($sSearchStrDateFromDay_tmp > 0) && ($sSearchStrDateFromMonth_tmp > 0) && ($sSearchStrDateFromYear_tmp > 0)) {
$sSearchStrDateFrom = $sSearchStrDateFromYear_tmp.'-'.$sSearchStrDateFromMonth_tmp.'-'.$sSearchStrDateFromDay_tmp.' 00:00:00';
} else {
$sSearchStrDateFrom = '';
}
if (!empty($sSearchStrDateToDay_tmp) && !empty($sSearchStrDateToMonth_tmp) && !empty($sSearchStrDateToYear_tmp)) {
if (($sSearchStrDateToDay_tmp > 0) && ($sSearchStrDateToMonth_tmp > 0) && ($sSearchStrDateToYear_tmp > 0)) {
$sSearchStrDateTo = $sSearchStrDateToYear_tmp.'-'.$sSearchStrDateToMonth_tmp.'-'.$sSearchStrDateToDay_tmp.' 23:59:59';
} else {
$sSearchStrDateTo = '';
@ -555,8 +559,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
@ -619,9 +623,7 @@ if (empty($where) || $iAffectedRows <= 0) {
// fuer den ersten gefundenen Artikel die Werte fuer CategoryID und TemplateID merken
if ($i == 0) {
$iIDCat = $idcat;
if(!empty($idtpl)) {
$iIDTpl = $idtpl;
}
$iIDTpl = $idtpl;
}
/* Funktion zum umwandeln in Startartikel/normale Artikel*/
@ -635,10 +637,8 @@ if (empty($where) || $iAffectedRows <= 0) {
}
} else {
if( $startidartlang == $idartlang ) {
$sFlagTitle = i18n('Flag as normal article');
$makeStartarticle = "<td nowrap=\"nowrap\" class=\"bordercell\"><img src=\"images/isstart1.gif\" border=\"0\" title=\"{$sFlagTitle}\" alt=\"{$sFlagTitle}\"></td>";
} else {
$sFlagTitle = i18n('Flag as start article');
$makeStartarticle = "<td nowrap=\"nowrap\" class=\"bordercell\"><img src=\"images/isstart0.gif\" border=\"0\" title=\"{$sFlagTitle}\" alt=\"{$sFlagTitle}\"></td>";
}
}
@ -703,7 +703,7 @@ if (empty($where) || $iAffectedRows <= 0) {
}
if ($perm->have_perm_area_action_item("con", "con_deleteart",$idcat)) {
$delete = "<a href=\"javascript://\" onclick=\"box.confirm(&quot;$sDeleteArticle&quot;, &quot;$sDeleteArticleQuestion:<br><br><b>".$db->f('title')."</b>&quot;, &quot;deleteArticle($idart,$idcat)&quot;)\" title=\"$sDeleteArticle\"><img src=\"images/delete.gif\" title=\"$sDeleteArticle\" alt=\"$sDeleteArticle\" border=\"0\"></a>";
$delete = "<a href=\"javascript://\" onclick=\"box.confirm(&quot;$sDeleteArticle&quot;, &quot;$sDeleteArticleQuestion:<br><br><b>$db->f('title')</b>&quot;, &quot;deleteArticle($idart,$idcat)&quot;)\" title=\"$sDeleteArticle\"><img src=\"images/delete.gif\" title=\"$sDeleteArticle\" alt=\"$sDeleteArticle\" border=\"0\"></a>";
}else {
$delete = "";
}
@ -717,6 +717,8 @@ if (empty($where) || $iAffectedRows <= 0) {
<td nowrap=\"nowrap\" class=\"bordercell\">$sTemplateName</td>
<td nowrap=\"nowrap\" class=\"bordercell\">
<a id=\"m1\" onclick=\"javascript:window.open('main.php?subject=$todoListeSubject&amp;area=todo&amp;frame=1&amp;itemtype=idart&amp;itemid=$idart&amp;contenido=$sSession', 'todo', 'scrollbars=yes, height=300, width=550');\" alt=\"$sReminder\" title=\"$sReminder\" href=\"#\"><img id=\"m2\" style=\"padding-left: 2px; padding-right: 2px;\" alt=\"$sReminder\" src=\"images/but_setreminder.gif\" border=\"0\"></a>
$properties
$tplconfig
$duplicate
$delete
</td>
@ -744,7 +746,7 @@ if (empty($where) || $iAffectedRows <= 0) {
# Save Search Parameters
###########################
if(!empty($bHit) && sizeof($_GET) == 0 && isset($_POST) ) {
if($bHit && sizeof($_GET) == 0 && isset($_POST) ) {
// Build form with hidden fields that contain all search parameters to be stored using generic db
$searchForm = '<form id="save_search" target="right_bottom" method="post" action="backend_search.php">';
// Meta for Contenido

Datei anzeigen

@ -1,8 +0,0 @@
<?php
namespace ConLite\Exceptions;
class Exception extends \Exception
{
}

Datei anzeigen

@ -1,8 +0,0 @@
<?php
namespace ConLite\Exceptions;
class FileNotFoundException extends RuntimeException
{
}

Datei anzeigen

@ -1,8 +0,0 @@
<?php
namespace ConLite\Exceptions;
class InvalidArgumentException extends LogicException
{
}

Datei anzeigen

@ -1,8 +0,0 @@
<?php
namespace ConLite\Exceptions;
class LogicException extends Exception
{
}

Datei anzeigen

@ -1,8 +0,0 @@
<?php
namespace ConLite\Exceptions;
class RuntimeException extends Exception
{
}

Datei anzeigen

@ -1,8 +0,0 @@
<?php
namespace ConLite\Frontend\Navigation;
class FrontendNavigation
{
}

Datei anzeigen

@ -1,29 +0,0 @@
<?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)
{
}
}

Datei anzeigen

@ -1,515 +0,0 @@
<?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];
}
}
}

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -1,9 +0,0 @@
<?php
namespace ConLite\GenericDb;
use Exception;
class ItemException extends Exception {
}

Datei anzeigen

@ -1,7 +0,0 @@
<?php
namespace ConLite\Html;
class Html extends HtmlCommon
{
}

Datei anzeigen

@ -1,42 +0,0 @@
<?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);
}
}

Datei anzeigen

@ -1,306 +0,0 @@
<?php
namespace ConLite\Log;
use ConLite\Exceptions\InvalidArgumentException;
use cString;
use ReflectionClass;
class Log
{
/**
* logging level
*
* @var int
*/
const EMERG = 0;
/**
* logging level
*
* @var int
*/
const ALERT = 1;
/**
* logging level
*
* @var int
*/
const CRIT = 2;
/**
* logging level
*
* @var int
*/
const ERR = 3;
/**
* logging level
*
* @var int
*/
const WARN = 4;
/**
* logging level
*
* @var int
*/
const NOTICE = 5;
/**
* logging level
*
* @var int
*/
const INFO = 6;
/**
* logging level
*
* @var int
*/
const DEBUG = 7;
protected $writer;
protected $shortcutHandlers = [];
protected $priorities = [];
protected $defaultPriorities = [];
protected $buffer = [];
/**
* @throws InvalidArgumentException
*/
public function __construct(LogWriter $writer = null)
{
$createWriter = false;
if(!$writer) {
$createWriter = true;
} elseif (!is_object($writer) || !($writer instanceof LogWriter)) {
cWarning(__FILE__, __LINE__, 'The passed class is not a subclass of ConLite LogWriter. Creating new one.');
$createWriter = true;
}
if($createWriter) {
$options = ['destination' => \cRegistry::getConfigValue('path', 'logs') . 'conlite.log'];
$writer = LogWriter::factory('File', $options);
}
$this->setWriter($writer);
$this->setShortcutHandler('%date', [$this, 'shDate']);
$this->setShortcutHandler('%level', [$this, 'shLevel']);
$this->setShortcutHandler('%message', [$this, 'shMessage']);
$this->getWriter()->setOption('log_format', '[%date] [%level] %message', false);
$reflection = new ReflectionClass($this);
$this->priorities = $this->defaultPriorities = array_flip($reflection->getConstants());
}
public function getWriter() {
return $this->writer;
}
public function setWriter(LogWriter $writer): void
{
$this->writer = $writer;
}
/**
* @throws InvalidArgumentException
*/
public function setShortcutHandler($shortcut, $handler): bool
{
if ($shortcut == '') {
throw new InvalidArgumentException('The shortcut name must not be empty.');
}
if (cString::getPartOfString($shortcut, 0, 1) == '%') {
$shortcut = cString::getPartOfString($shortcut, 1);
}
if (!is_callable($handler)) {
throw new InvalidArgumentException('The specified shortcut handler does not exist.');
}
if (array_key_exists($shortcut, $this->shortcutHandlers)) {
throw new InvalidArgumentException('The shortcut ' . $shortcut . ' is already in use!');
}
$this->shortcutHandlers[$shortcut] = $handler;
return true;
}
public function unsetShortcutHandler($shortcut)
{
if(!in_array($shortcut, $this->shortcutHandlers)) {
throw new InvalidArgumentException('The specified shortcut handler does not exist.');
}
unset($this->shortcutHandlers[$shortcut]);
return true;
}
public function buffer(string $message, $priority = null): void
{
$this->buffer[] = [$message, $priority];
}
public function commit(bool $clearBuffer = true)
{
if (count($this->buffer) == 0) {
cWarning(__FILE__, __LINE__, 'There are no buffered messages to commit.');
return false;
}
foreach ($this->buffer as $bufferInfo) {
$this->log($bufferInfo[0], $bufferInfo[1]);
}
if ($clearBuffer) {
$this->clearBuffer();
}
}
public function clearBuffer(): void
{
$this->buffer = [];
}
public function log(string $message, $priority = null): void
{
if ($priority && !is_int($priority) && in_array($priority, $this->priorities)) {
$priority = array_search($priority, $this->priorities);
}
if ($priority === null || !array_key_exists($priority, $this->priorities)) {
$priority = $this->getWriter()->getOption('default_priority');
}
$logMessage = $this->getWriter()->getOption('log_format');
$lineEnding = $this->getWriter()->getOption('line_ending');
foreach ($this->shortcutHandlers as $shortcut => $handler) {
if (cString::getPartOfString($shortcut, 0, 1) != '%') {
$shortcut = '%' . $shortcut;
}
$info = [
'message' => $message,
'priority' => $priority
];
$value = call_user_func($handler, $info);
$logMessage = str_replace($shortcut, $value, $logMessage);
}
$this->getWriter()->write($logMessage . $lineEnding, $priority);
}
/**
* @throws InvalidArgumentException
*/
public function addPriority(string $name, int $value): void
{
if ($name == '') {
throw new InvalidArgumentException('Priority name must not be empty.');
}
if (in_array($name, $this->priorities)) {
throw new InvalidArgumentException('The given priority name already exists.');
}
if (array_key_exists($value, $this->priorities)) {
throw new InvalidArgumentException('The priority value already exists.');
}
$this->priorities[$value] = $name;
}
/**
* @throws InvalidArgumentException
*/
public function removePriority(string $name): void
{
if ($name == '') {
throw new InvalidArgumentException('Priority name must not be empty.');
}
if (!in_array($name, $this->priorities)) {
throw new InvalidArgumentException('Priority name does not exist.');
}
if (in_array($name, $this->defaultPriorities)) {
throw new InvalidArgumentException('Removing default priorities is not allowed.');
}
$priorityIndex = array_search($name, $this->priorities);
unset($this->priorities[$priorityIndex]);
}
/**
* @throws InvalidArgumentException
*/
public function __call(string $method, array $arguments) {
$priorityName = cString::toUpperCase($method);
if (!in_array($priorityName, $this->priorities)) {
throw new InvalidArgumentException('The given priority ' . $priorityName . ' is not supported.');
}
$priorityIndex = array_search($priorityName, $this->priorities);
$this->log($arguments[0], $priorityIndex);
}
/**
* Shortcut Handler Date.
* Returns the current date.
*
* @return string
* The current date
*/
public function shDate(): string
{
return date('Y-m-d H:i:s');
}
/**
* Shortcut Handler Level.
* Returns the canonical name of the priority.
* The canonical name is padded to 10 characters to achieve a better
* formatting.
*
* @param array $info
* @return string
* The canonical log level
*/
public function shLevel(array $info): string
{
$logLevel = $info['priority'];
return str_pad($this->priorities[$logLevel], 10, ' ', STR_PAD_BOTH);
}
/**
* Shortcut Handler Message.
* Returns the log message.
*
* @param array $info
* @return string
* The log message
*/
public function shMessage(array $info): string
{
return $info['message'];
}
}

Datei anzeigen

@ -1,66 +0,0 @@
<?php
namespace ConLite\Log;
use ConLite\Exceptions\InvalidArgumentException;
abstract class LogWriter
{
/**
* @param array $options
*/
public function __construct(
protected array $options = []
)
{
$this->setOptions($options);
$this->setOption('default_priority', Log::INFO, false);
$this->setOption('line_ending', PHP_EOL, false);
}
/**
* @throws invalidArgumentException
*/
public static function factory($writerName, array $writerOptions): LogWriter
{
$logWriterClassName = __NAMESPACE__ . '\\LogWriter' . ucfirst($writerName);
if(!class_exists($logWriterClassName)) {
throw new InvalidArgumentException('Unknown ConLite LogWriter class: ' . $logWriterClassName);
}
$writer = new $logWriterClassName($writerOptions);
if(!($writer instanceof LogWriter)) {
throw new InvalidArgumentException('Provided class is not an instance of ConLite LogWriter');
}
return $writer;
}
public function getOptions(): array
{
return $this->options;
}
public function getOption($option) {
return $this->options[$option];
}
public function setOptions(array $options): void
{
$this->options = $options;
}
public function setOption($option, $value, $force = false) {
if (!$force && isset($this->options[$option])) {
return;
}
$this->options[$option] = $value;
}
public function removeOption($option) {
unset($this->options[$option]);
}
abstract function write($message, $priority);
}

Datei anzeigen

@ -1,135 +0,0 @@
<?php
namespace ConLite\Log;
use ConLite\Exceptions\Exception;
use ConLite\Exceptions\FileNotFoundException;
use DirectoryIterator;
class LogWriterFile extends LogWriter
{
/**
* @var resource
*/
protected $handle = NULL;
/**
* @var int
*/
protected int $maxLogFileSize = 1024;
/**
* @var int
*/
protected int $maxRotationFiles = 10;
/**
* @throws FileNotFoundException
* @throws Exception
*/
public function __construct(array $options = []) {
parent::__construct($options);
$logFileSize = (int) getEffectiveSetting('log', 'writer-file-size-' . basename($this->getOption('destination')), $this->getOption('logFileSize') ?? 0);
if($logFileSize > 0) {
$this->maxLogFileSize = $logFileSize;
}
$this->createHandle();
}
/**
* @param string $message
* @param int $priority
* @return bool
*/
public function write($message, $priority): bool
{
$this->rotateLog();
return fwrite($this->handle, $message) != false;
}
public function __destruct()
{
$this->closeHandle();
}
/**
* @throws Exception
* @throws FileNotFoundException
*/
protected function createHandle(): void
{
$destination = $this->getOption('destination');
if ($destination == '') {
throw new Exception('No destination was specified.');
}
if (($this->handle = fopen($destination, 'a')) === false) {
throw new FileNotFoundException('Destination handle could not be created.');
}
}
protected function closeHandle(): void
{
fclose($this->handle);
}
protected function rotateLog()
{
$logfile = $this->getOption('destination');
if(!file_exists($logfile)) {
cWarning(__FILE__, __LINE__, 'Logfile ' . $logfile . ' not found.');
return false;
} elseif (!is_readable($logfile)) {
cWarning(__FILE__, __LINE__, 'Logfile ' . $logfile . ' not readable.');
return false;
}
if (filesize($logfile) >= $this->maxLogFileSize * 1024) {
$pathInfo = pathinfo($logfile);
$baseDirectory = $pathInfo['dirname'];
$baseName = $pathInfo['basename'];
$numMap = [];
foreach (new DirectoryIterator($baseDirectory) as $fileInfo) {
if ($fileInfo->isDot() || !$fileInfo->isFile()) {
continue;
}
if (preg_match('/^' . $baseName . '\.?([0-9]*)$/', $fileInfo->getFilename(), $matches)) {
$num = $matches[1];
$file2move = $fileInfo->getFilename();
if ($num == '') {
$num = 0;
}
$numMap[$num] = $file2move;
}
}
krsort($numMap);
foreach ($numMap as $num => $file2move) {
$targetN = $num + 1;
if($targetN > $this->maxRotationFiles) {
unlink($baseDirectory . DIRECTORY_SEPARATOR . $file2move);
continue;
}
rename($baseDirectory . DIRECTORY_SEPARATOR . $file2move, $baseDirectory . DIRECTORY_SEPARATOR .$baseName . '.' . $targetN);
}
return true;
}
return false;
}
public function getMaxLogFileSize(): int
{
return $this->maxLogFileSize;
}
public function setMaxLogFileSize(int $maxLogFileSize): void
{
$this->maxLogFileSize = $maxLogFileSize;
}
}

Datei anzeigen

@ -1,8 +0,0 @@
<?php
namespace ConLite\Log;
class ModuleLog extends Log
{
}

Datei anzeigen

@ -36,7 +36,7 @@ class cApiUploadCollection extends ItemCollection {
public function sync($dir, $file) {
global $client;
if (!empty($_ENV["OS"]) && strstr(strtolower($_ENV["OS"]), 'windows') === FALSE) {
if (strstr(strtolower($_ENV["OS"]), 'windows') === FALSE) {
#Unix style OS distinguish between lower and uppercase file names, i.e. test.gif is not the same as Test.gif
$this->select("dirname = BINARY '$dir' AND filename = BINARY '$file' AND idclient = '$client'");
} else {

Datei anzeigen

@ -5,7 +5,7 @@
*
* Description:
* Base Class for all cHTML Elements
*
*
* @category ConLite
* @package Core
* @subpackage cHTML
@ -17,10 +17,13 @@
* @link http://www.conlite.org ConLite.org
*/
// security check
defined('CON_FRAMEWORK') or die('Illegal call');
if (!class_exists("HTML_Common2")) {
cInclude("pear", "HTML/Common2.php");
}
/* Global ID counter */
$cHTMLIDCount = 0;
@ -29,12 +32,11 @@ $cHTMLIDCount = 0;
*
* @author Ortwin Pinke <o.pinke@conlite.org>
*/
class cHTML extends cHTML5Common
{
class cHTML extends HTML_Common2 {
/**
* Storage of the open SGML tag template
* @var string
* @var string
*/
protected $_skeleton_open;
@ -58,15 +60,15 @@ class cHTML extends cHTML5Common
/**
* Defines the style definitions
* @var array
* @var string
*/
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
@ -76,32 +78,31 @@ 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()
{
$this->_aCfg = cRegistry::getConfig();
* Constructor Function
* Initializes the SGML open/close tags
*
* @param none
* @return void
*/
public function __construct() {
global $cfg;
$this->_aCfg = $cfg;
parent::__construct();
$this->_skeleton_open = '<%s%s>';
$this->_skeleton_close = '</%s>';
@ -110,52 +111,50 @@ 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 = [];
$this->_aStyleDefinitions = [];
$this->_styledefs = array ();
$this->_aStyleDefinitions = array();
$this->setContentlessTag();
$this->advanceID();
$this->_requiredScripts = [];
$this->_aEventDefinitions = [];
$this->_requiredScripts = array ();
$this->_aEventDefinitions = array ();
}
/**
*
* @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,26 +162,24 @@ 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);
}
@ -191,9 +188,8 @@ 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));
}
/**
@ -201,9 +197,8 @@ 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));
}
/**
@ -211,9 +206,8 @@ 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));
}
/**
@ -225,12 +219,11 @@ 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));
}
}
@ -242,10 +235,9 @@ 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);
}
@ -253,7 +245,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.
@ -261,12 +253,11 @@ 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 is_null($this->_skeleton_open) ? '' : sprintf($this->_skeleton_open, $this->_tag, $attributes);
return sprintf($this->_skeleton_open, $this->_tag, $attributes);
}
}
@ -276,68 +267,63 @@ class cHTML extends cHTML5Common
* @param none
* @return string filled SGML closer skeleton
*/
public function fillCloseSkeleton()
{
return is_null($this->_skeleton_close) ? '' : sprintf($this->_skeleton_close, $this->_tag);
public function fillCloseSkeleton() {
return sprintf($this->_skeleton_close, $this->_tag);
}
/**
* addStyleDefinition
*
* @param $entity string Entity to define
* @param $definition string Definition for the given entity
* @return string filled SGML closing skeleton
* @deprecated name change, use attachStyleDefinition
* @param $entity string Entity to define
* @param $definition string Definition for the given entity
* @return string filled SGML closing skeleton
*/
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 = [];
$this->_requiredScripts = array ();
}
$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);
}
@ -347,21 +333,20 @@ 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 {
@ -369,12 +354,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 (is_countable($content->_requiredScripts) && count($content->_requiredScripts) > 0) {
if(count($content->_requiredScripts) > 0) {
$this->_requiredScripts = array_merge($this->_requiredScripts, $content->_requiredScripts);
}
return;
@ -386,95 +371,92 @@ 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 (!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);
}
}
/**
* 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);
}
}
/**
* render(): Alias for toHtml
@ -482,8 +464,8 @@ class cHTML extends cHTML5Common
* @param none
* @return string Rendered HTML
*/
public function render()
{
public function render() {
return $this->toHtml();
}
}
}
?>

Datei anzeigen

@ -1,584 +0,0 @@
<?php
/**
* @category ConLite
* @package Core
* @subpackage cHTML5
* @since 2.2
* @author Ortwin Pinke <o.pinke@conlite.org>
* @copyright (c) 2022, conlite.org
* @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version)
* @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version)
* @link http://www.conlite.org ConLite.org
*/
/*
* HTML_Common2: port of HTML_Common package to PHP5
*
* PHP version 5
*
* LICENSE:
*
* Copyright (c) 2004-2012, Alexey Borzov <avb@php.net>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @category HTML
* @package HTML_Common2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version SVN: $Id$
* @link http://pear.php.net/package/HTML_Common2
*/
/*
* Base class for HTML classes
*
* Implements methods for working with HTML attributes, parsing and generating
* attribute strings. Port of HTML_Common class for PHP4 originally written by
* Adam Daniel with contributions from numerous other developers.
*
* @category HTML
* @package HTML_Common2
* @author Alexey Borzov <avb@php.net>
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 2.1.0
* @link http://pear.php.net/package/HTML_Common2
*/
abstract class cHTML5Common implements ArrayAccess
{
/**
* Associative array of attributes
* @var array
*/
protected $attributes = array();
/**
* Changes to attributes in this list will be announced via onAttributeChange()
* method rather than performed by HTML_Common2 class itself
* @var array
* @see onAttributeChange()
*/
protected $watchedAttributes = array();
/**
* Indentation level of the element
* @var int
*/
private $_indentLevel = 0;
/**
* Comment associated with the element
* @var string
*/
private $_comment = null;
/**
* Global options for all elements generated by subclasses of HTML_Common2
*
* Preset options are
* - 'charset': charset parameter used in htmlspecialchars() calls,
* defaults to 'ISO-8859-1'
* - 'indent': string used to indent HTML elements, defaults to "\11"
* - 'linebreak': string used to indicate linebreak, defaults to "\12"
*
* @var array
*/
private static $_options = array(
'charset' => 'ISO-8859-1',
'indent' => "\11",
'linebreak' => "\12"
);
/**
* Sets global option(s)
*
* @param string|array $nameOrOptions Option name or array ('option name' => 'option value')
* @param mixed $value Option value, if first argument is not an array
*/
public static function setOption($nameOrOptions, $value = null)
{
if (is_array($nameOrOptions)) {
foreach ($nameOrOptions as $k => $v) {
self::setOption($k, $v);
}
} else {
$linebreaks = array('win' => "\15\12", 'unix' => "\12", 'mac' => "\15");
if ('linebreak' == $nameOrOptions && isset($linebreaks[$value])) {
$value = $linebreaks[$value];
}
self::$_options[$nameOrOptions] = $value;
}
}
/**
* Returns global option(s)
*
* @param string $name Option name
*
* @return mixed Option value, null if option does not exist,
* array of all options if $name is not given
*/
public static function getOption($name = null)
{
if (null === $name) {
return self::$_options;
} else {
return isset(self::$_options[$name])? self::$_options[$name]: null;
}
}
/**
* Parses the HTML attributes given as string
*
* @param string $attrString HTML attribute string
*
* @return array An associative array of attributes
*/
protected static function parseAttributes($attrString)
{
$attributes = array();
if (preg_match_all(
"/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" .
"([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/",
$attrString,
$regs
)) {
for ($i = 0; $i < count($regs[1]); $i++) {
$name = trim($regs[1][$i]);
$check = trim($regs[0][$i]);
$value = trim($regs[7][$i]);
if ($name == $check) {
$attributes[strtolower($name)] = strtolower($name);
} else {
if (!empty($value) && ($value[0] == '\'' || $value[0] == '"')) {
$value = substr($value, 1, -1);
}
$attributes[strtolower($name)] = $value;
}
}
}
return $attributes;
}
/**
* Creates a valid attribute array from either a string or an array
*
* @param string|array $attributes Array of attributes or HTML attribute string
*
* @return array An associative array of attributes
*/
protected static function prepareAttributes($attributes)
{
$prepared = array();
if (is_string($attributes)) {
return self::parseAttributes($attributes);
} elseif (is_array($attributes)) {
foreach ($attributes as $key => $value) {
if (is_int($key)) {
$key = strtolower($value);
$prepared[$key] = $key;
} else {
$prepared[strtolower($key)] = (string)$value;
}
}
}
return $prepared;
}
/**
* Removes an attribute from an attribute array
*
* @param array &$attributes Attribute array
* @param string $name Name of attribute to remove
*/
protected static function removeAttributeArray(array &$attributes, $name)
{
unset($attributes[strtolower($name)]);
}
/**
* Creates HTML attribute string from array
*
* @param array $attributes Attribute array
*
* @return string Attribute string
*/
protected static function getAttributesString(array $attributes)
{
$str = '';
$charset = self::getOption('charset');
foreach ($attributes as $key => $value) {
$str .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES, $charset) . '"';
}
return $str;
}
/**
* Class constructor, sets default attributes
*
* @param array|string $attributes Array of attribute 'name' => 'value' pairs
* or HTML attribute string
*/
public function __construct($attributes = null)
{
$this->mergeAttributes($attributes);
}
/**
* Sets the value of the attribute
*
* @param string $name Attribute name
* @param string $value Attribute value (will be set to $name if omitted)
*
* @return HTML_Common2
*/
public function setAttribute($name, $value = null)
{
$name = strtolower($name);
if (is_null($value)) {
$value = $name;
}
if (in_array($name, $this->watchedAttributes)) {
$this->onAttributeChange($name, $value);
} else {
$this->attributes[$name] = (string)$value;
}
return $this;
}
/**
* Returns the value of an attribute
*
* @param string $name Attribute name
*
* @return string|null Attribute value, null if attribute does not exist
*/
public function getAttribute($name)
{
$name = strtolower($name);
return isset($this->attributes[$name])? $this->attributes[$name]: '';
}
/**
* Sets the attributes
*
* @param string|array $attributes Array of attribute 'name' => 'value' pairs
* or HTML attribute string
*
* @return HTML_Common2
*/
public function setAttributes($attributes)
{
$attributes = self::prepareAttributes($attributes);
$watched = array();
foreach ($this->watchedAttributes as $watchedKey) {
if (isset($attributes[$watchedKey])) {
$this->setAttribute($watchedKey, $attributes[$watchedKey]);
unset($attributes[$watchedKey]);
} else {
$this->removeAttribute($watchedKey);
}
if (isset($this->attributes[$watchedKey])) {
$watched[$watchedKey] = $this->attributes[$watchedKey];
}
}
$this->attributes = array_merge($watched, $attributes);
return $this;
}
/**
* Returns the attribute array or string
*
* @param bool $asString Whether to return attributes as string
*
* @return array|string
*/
public function getAttributes($asString = false)
{
if ($asString) {
return self::getAttributesString($this->attributes);
} else {
return $this->attributes;
}
}
/**
* Merges the existing attributes with the new ones
*
* @param array|string $attributes Array of attribute 'name' => 'value' pairs
* or HTML attribute string
*
* @return HTML_Common2
*/
public function mergeAttributes($attributes)
{
$attributes = self::prepareAttributes($attributes);
foreach ($this->watchedAttributes as $watchedKey) {
if (isset($attributes[$watchedKey])) {
$this->onAttributeChange($watchedKey, $attributes[$watchedKey]);
unset($attributes[$watchedKey]);
}
}
$this->attributes = array_merge($this->attributes, $attributes);
return $this;
}
/**
* Removes an attribute
*
* @param string $attribute Name of attribute to remove
*
* @return HTML_Common2
*/
public function removeAttribute($attribute)
{
if (in_array(strtolower($attribute), $this->watchedAttributes)) {
$this->onAttributeChange(strtolower($attribute), null);
} else {
self::removeAttributeArray($this->attributes, $attribute);
}
return $this;
}
/**
* Sets the indentation level
*
* @param int $level Indentation level
*
* @return HTML_Common2
*/
public function setIndentLevel($level)
{
$level = intval($level);
if (0 <= $level) {
$this->_indentLevel = $level;
}
return $this;
}
/**
* Gets the indentation level
*
* @return int
*/
public function getIndentLevel()
{
return $this->_indentLevel;
}
/**
* Returns the string to indent the element
*
* @return string
*/
protected function getIndent()
{
return str_repeat(self::getOption('indent'), $this->getIndentLevel());
}
/**
* Sets the comment for the element
*
* @param string $comment String to output as HTML comment
*
* @return HTML_Common2
*/
public function setComment($comment)
{
$this->_comment = $comment;
return $this;
}
/**
* Returns the comment associated with the element
*
* @return string
*/
public function getComment()
{
return $this->_comment;
}
/**
* Checks whether the element has given CSS class
*
* @param string $class CSS Class name
*
* @return bool
*/
public function hasClass($class)
{
$regex = '/(^|\s)' . preg_quote($class, '/') . '(\s|$)/';
return (bool)preg_match($regex, $this->getAttribute('class'));
}
/**
* Adds the given CSS class(es) to the element
*
* @param string|array $class Class name, multiple class names separated by
* whitespace, array of class names
*
* @return HTML_Common2
*/
public function addClass($class)
{
if (!is_array($class)) {
$class = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY);
}
$curClass = preg_split(
'/\s+/', $this->getAttribute('class'), null, PREG_SPLIT_NO_EMPTY
);
foreach ($class as $c) {
if (!in_array($c, $curClass)) {
$curClass[] = $c;
}
}
$this->setAttribute('class', implode(' ', $curClass));
return $this;
}
/**
* Removes the given CSS class(es) from the element
*
* @param string|array $class Class name, multiple class names separated by
* whitespace, array of class names
*
* @return HTML_Common2
*/
public function removeClass($class)
{
if (!is_array($class)) {
$class = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY);
}
$curClass = array_diff(
preg_split(
'/\s+/', $this->getAttribute('class'), null, PREG_SPLIT_NO_EMPTY
),
$class
);
if (0 == count($curClass)) {
$this->removeAttribute('class');
} else {
$this->setAttribute('class', implode(' ', $curClass));
}
return $this;
}
/**
* Returns the HTML representation of the element
*
* This magic method allows using the instances of HTML_Common2 in string
* contexts
*
* @return string
*/
abstract public function __toString();
/**
* Called if trying to change an attribute with name in $watchedAttributes
*
* This method is called for each attribute whose name is in the
* $watchedAttributes array and which is being changed by setAttribute(),
* setAttributes() or mergeAttributes() or removed via removeAttribute().
* Note that the operation for the attribute is not carried on after calling
* this method, it is the responsibility of this method to change or remove
* (or not) the attribute.
*
* @param string $name Attribute name
* @param string $value Attribute value, null if attribute is being removed
*/
protected function onAttributeChange($name, $value = null)
{
}
/**
* Whether or not an offset (HTML attribute) exists
*
* @param string $offset An offset to check for.
*
* @return boolean Returns true on success or false on failure.
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->attributes[strtolower($offset)]);
}
/**
* Returns the value at specified offset (i.e. attribute name)
*
* @param string $offset The offset to retrieve.
*
* @return string|null
* @link http://php.net/manual/en/arrayaccess.offsetget.php
* @see getAttribute()
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->getAttribute($offset);
}
/**
* Assigns a value to the specified offset (i.e. attribute name)
*
* @param string $offset The offset to assign the value to
* @param string $value The value to set
*
* @return void
* @link http://php.net/manual/en/arrayaccess.offsetset.php
* @see setAttribute()
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
if (null !== $offset) {
$this->setAttribute($offset, $value);
} else {
// handles $foo[] = 'disabled';
$this->setAttribute($value);
}
}
/**
* Unsets an offset (i.e. removes an attribute)
*
* @param string $offset The offset to unset
*
* @return void
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
* @see removeAttribute
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$this->removeAttribute($offset);
}
}

Datei anzeigen

@ -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,12 +65,14 @@ 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 ";
}
@ -87,6 +89,7 @@ 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;
@ -94,6 +97,7 @@ class cArticleCollector implements SeekableIterator, Countable {
foreach ($aTable as $aItem) {
$this->_aArticles[] = $aItem['idartlang'];
}
print_r($this->_aArticles);
}
}
@ -158,7 +162,7 @@ class cArticleCollector implements SeekableIterator, Countable {
*
* @return cApiArticleLanguage|int returns article language object or idartlang
*/
public function current() :cApiArticleLanguage|int{
public function current() {
$iIdartlang = $this->_aArticles[$this->_iCurrentPosition];
if ($this->_bAsObject) {
$oArticle = new cApiArticleLanguage($iIdartlang);

Datei anzeigen

@ -247,11 +247,9 @@ class Article extends Item
* @param string Property name
* @return mixed Property value
*/
public function getField($name) {
if(!is_null($name) && !empty($this->values[$name])) {
return urldecode($this->values[$name]);
}
public function getField($name)
{
return urldecode($this->values[$name]);
}
/**
@ -285,7 +283,7 @@ class Article extends Item
*/
public function getContent($type, $id = NULL)
{
if (empty($type)) {
if ($type == '') {
return 'Class ' . get_class($this) . ': content-type must be specified!';
}
@ -297,7 +295,7 @@ class Article extends Item
if (is_null($id)) {
// return Array
return (empty($this->content[$type]))?'':$this->content[$type];
return $this->content[$type];
}
// return String

Datei anzeigen

@ -238,7 +238,7 @@ class cAutoload {
* @return (string|null) Path and filename or null
*/
private static function _getContenidoClassFile($className) {
$file = isset(self::$_includeFiles[$className]) ? self::$_conRootPath . self::$_includeFiles[$className] : '';
$file = isset(self::$_includeFiles[$className]) ? self::$_conRootPath . self::$_includeFiles[$className] : null;
return self::_validateClassAndFile($className, $file);
}
@ -247,7 +247,7 @@ class cAutoload {
*
* @param string $className
* @param string $filePathName
* @return (string) The file if validation was successfull, otherwhise empty
* @return (string|null) The file if validation was successfull, otherwhise null
*/
private static function _validateClassAndFile($className, $filePathName) {
if (class_exists($className)) {
@ -256,14 +256,14 @@ class cAutoload {
'file' => str_replace(self::$_conRootPath, '', $filePathName),
'error' => self::ERROR_CLASS_EXISTS
);
return '';
return null;
} elseif (!is_file($filePathName)) {
self::$_errors[] = array(
'class' => $className,
'file' => str_replace(self::$_conRootPath, '', $filePathName),
'error' => self::ERROR_FILE_NOT_FOUND
);
return '';
return null;
}
return $filePathName;

Datei anzeigen

@ -382,8 +382,7 @@ class DBFSItem extends Item {
parent::store();
}
public function setField($field, $value, $safe = true): bool
{
public function setField($field, $value, $safe = true) {
if ($field == "dirname" || $field == "filename" || $field == "mimetype") {
// Don't do safe encoding
$safe = false;
@ -392,7 +391,7 @@ class DBFSItem extends Item {
$value = str_replace('"', "", $value);
}
return parent::setField($field, $value, $safe);
parent::setField($field, $value, $safe);
}
}

Datei anzeigen

@ -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): bool
public function setField($field, $value, $safe = true)
{
if ($field == "password") {
return parent::setField($field, md5($value), $safe);
parent::setField($field, md5($value), $safe);
} else {
return parent::setField($field, $value, $safe);
parent::setField($field, $value, $safe);
}
}

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -57,7 +57,8 @@ 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);
@ -593,7 +594,7 @@ class cHTMLSelectElement extends cHTMLFormElement {
* All cHTMLOptionElements
* @var array
*/
var $_options = [];
var $_options;
/**
* Constructor. Creates an HTML select field (aka "DropDown").
@ -671,7 +672,7 @@ class cHTMLSelectElement extends cHTMLFormElement {
*/
function setDefault($lvalue) {
$bSet = false;
$lvalue = cString::nullToString($lvalue);
if (is_array($this->_options)) {
foreach ($this->_options as $key => $value) {
if (strcmp($value->getAttribute("value"), $lvalue) == 0) {
@ -866,7 +867,6 @@ 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,30 +1029,37 @@ 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 ($id != "") {
$label = new cHTMLLabel($this->_value, $this->getAttribute("id"));
if ($renderlabel == true) {
if ($id != "") {
$label = new cHTMLLabel($this->_value, $this->getAttribute("id"));
if ($this->_labelText != "") {
$label->setLabelText($this->_labelText);
$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();
}
}
$renderedLabel = $label->toHtml();
return '<table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap="nowrap">' . parent::toHTML() . '</td><td nowrap="nowrap">' . $renderedLabel . '</td></tr></table>';
} else {
$renderedLabel = $this->_value;
return parent::toHTML();
}
return $this->fillSkeleton($attributes) . $renderedLabel;
}
}
/**
@ -1155,8 +1162,6 @@ class cHTMLLink extends cHTML {
/* Stores the custom entries */
var $_custom;
protected $_type;
/**
* Constructor. Creates an HTML link.
@ -1444,9 +1449,6 @@ class cHTMLImage extends cHTML {
* @access private
*/
var $_height;
protected $_border;
protected $_type;
/**
* Constructor. Creates an HTML IMG element.

Datei anzeigen

@ -130,7 +130,12 @@ class cI18n {
// Is emulator to use?
if (!$cfg['native_i18n']) {
return self::emulateGettext($string, $domain);
$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;
}
// Try to use native gettext implementation

Datei anzeigen

@ -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,4 +293,6 @@ class InUseItem extends Item
$this->loadByPrimaryKey($mId);
}
}
}
}
?>

Datei anzeigen

@ -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): bool
public function setField($field, $value, $safe = true)
{
if (array_key_exists($field, $this->maximumLength)) {
if (strlen($value) > $this->maximumLength[$field]) {
@ -455,7 +455,7 @@ class PropertyItem extends Item
}
}
return parent::setField($field, $value, $safe);
parent::setField($field, $value, $safe);
}
}

Datei anzeigen

@ -225,13 +225,13 @@ class Index extends SearchBaseAbstract {
*
* @var array
*/
protected static $_cms_type = [];
var $cms_type = array();
/**
* the suffix of all available cms types
* @var array
*/
protected static $_cms_type_suffix = [];
var $cms_type_suffix = array();
/**
* Constructor, set object properties
@ -270,8 +270,6 @@ class Index extends SearchBaseAbstract {
$this->idart = $idart;
}
$this->_debug('Start Index for ', $this->idart);
$this->place = $place;
$this->keycode = $aContent;
$this->setStopwords($aStopwords);
@ -285,14 +283,7 @@ 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();
}
@ -321,7 +312,7 @@ class Index extends SearchBaseAbstract {
foreach ($this->keycode as $idtype => $data) {
if ($this->checkCmsType($idtype)) {
foreach ($data as $typeid => $code) {
$this->_debug('createKeywords: raw code from data array', $code);
$this->_debug('code', $code);
$code = stripslashes($code); // remove backslash
$code = str_ireplace(array('<br>', '<br />'), "\n", $code); // replace HTML line breaks with newlines
@ -329,18 +320,13 @@ class Index extends SearchBaseAbstract {
if (strlen($code) > 0) {
$code = clHtmlEntityDecode($code);
}
$this->_debug('createKeywords: code after clean', $code);
$this->_debug('code', $code);
$tmp_keys = preg_split('/[\s,]+/', trim($code)); // split content by any number of commas or space characters
$this->_debug('createKeywords: tmp_keys', $tmp_keys);
$this->_debug('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
@ -349,7 +335,6 @@ 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);
}
}
}
@ -360,7 +345,7 @@ class Index extends SearchBaseAbstract {
}
}
$this->_debug('createKeywords: keywords returned', $this->keywords);
$this->_debug('keywords', $this->keywords);
}
/**
@ -372,10 +357,9 @@ 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);
@ -392,12 +376,8 @@ 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 ($index_string === $this->keywords_old[$keyword]) {
$bProceed = false;
$this->_debug('db update', 'no update needed');
}
if (preg_match("/&$this->idart=/", $this->keywords_old[$keyword])) {
$index_string = preg_replace("/&$this->idart=[0-9]+\([\w-,]+\)/", $index_string, $this->keywords_old[$keyword]);
} else {
$index_string = $this->keywords_old[$keyword] . $index_string;
}
@ -406,11 +386,9 @@ 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);
if ($bProceed) {
$this->_debug('sql', $sql);
$this->db->query($sql);
}
$this->db->query($sql);
}
}
@ -453,7 +431,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('getKeywords: sql', $sql);
$this->_debug('sql', $sql);
$this->db->query($sql);
@ -462,8 +440,6 @@ 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);
}
/**
@ -472,7 +448,6 @@ class Index extends SearchBaseAbstract {
* @return $key
*/
function removeSpecialChars($key) {
$aSpecialChars = array(
"-", "_", "'", ".", "!", "\"", "#", "$", "%", "&", "(", ")", "*", "+", ",", "/",
":", ";", "<", "=", ">", "?", "@", "[", "\\", "]", "^", "`", "{", "|", "}", "~"
@ -486,7 +461,6 @@ 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') {
@ -512,9 +486,6 @@ 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;
}
@ -545,21 +516,6 @@ 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
@ -581,8 +537,8 @@ class Index extends SearchBaseAbstract {
$this->_debug('sql', $sql);
$this->db->query($sql);
while ($this->db->next_record()) {
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')));
$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')));
}
}
@ -598,11 +554,11 @@ class Index extends SearchBaseAbstract {
if (strlen($opt) > 0) {
if (!stristr($opt, 'cms_')) {
if (in_array($opt, $this->getContentTypes()['cms_type_suffix'])) {
if (in_array($opt, $this->cms_type_suffix)) {
$this->cms_options[$opt] = 'CMS_' . $opt;
}
} else {
if (array_key_exists($opt, $this->getContentTypes()['cms_type'])) {
if (array_key_exists($opt, $this->cms_type)) {
$this->cms_options[$opt] = $opt;
}
}
@ -832,8 +788,8 @@ class Search extends SearchBaseAbstract {
$this->index = new Index($oDB);
$this->cms_type = $this->index->getContentTypes()['cms_type'];
$this->cms_type_suffix = $this->index->getContentTypes()['cms_type_suffix'];
$this->cms_type = $this->index->cms_type;
$this->cms_type_suffix = $this->index->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';
@ -1383,11 +1339,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->getContentTypes()['cms_type'])) {
if (in_array($cms_type, $this->index->cms_type_suffix)) {
$cms_type = 'CMS_' . $cms_type;
}
} else {
if (!array_key_exists($cms_type, $this->index->getContentTypes()['cms_type_suffix'])) {
if (!array_key_exists($cms_type, $this->index->cms_type)) {
return array();
}
}

Datei anzeigen

@ -35,7 +35,7 @@ class Contenido_Security_Exception extends Exception {
* @static
* @var boolean
*/
protected static $_logging = false;
protected static $_logging = true;
/**
* @see Exception::__construct()
@ -45,7 +45,12 @@ class Contenido_Security_Exception extends Exception {
// check if logging is enabled
if (self::$_logging == true) {
$sLogFile = realpath(dirname(__FILE__) . '/../logs/') . '/security.txt';
$sPath = realpath(dirname(__FILE__) . '/../../data/logs');
if(is_writable($sPath)) {
$sLogFile = $sPath . '/security.txt';
} else {
$sLogFile = realpath(dirname(__FILE__) . '/../') . '/security.txt';
}
$sFileContent = '---------' . PHP_EOL;
$sFileContent .= "Invalid call caused by parameter '" . $sParamName . "' at " . date("c") . PHP_EOL;
@ -355,7 +360,7 @@ class cSecurity {
public static function checkRequestSession() {
if (isset($_REQUEST['contenido']) && !preg_match('/^[0-9a-f]{32}$/', $_REQUEST['contenido'])) {
if ($_REQUEST['contenido'] != '') {
throw new Contenido_Security_Exception('Invalid call', 'contenido');
throw new Contenido_Security_Exception('Invalid call', 'conlite');
}
}
return true;

1065
conlite/classes/class.smtp.php Normale Datei

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -715,19 +715,4 @@ class cString extends cStringMultiByteWrapper {
return $string;
}
/**
* Convert null string to empty string
*
* @param string $string
* @return string
*/
public static function nullToString($string) {
//var_dump($string);
if(empty($string) || is_null($string)) {
$string = '';
}
//var_dump($string);
return $string;
}
}

Datei anzeigen

@ -174,10 +174,10 @@ class UI_Menu {
foreach ($this->link as $key => $value) {
if ($value != NULL) {
if (!empty($this->imagewidth[$key]) && !empty ($this->image[$key])) {
if ($this->imagewidth[$key] != 0) {
$value->setContent('<img border="0" src="' . $this->image[$key] . '" width="' . $this->imagewidth[$key] . '">');
$img = $value->render();
} else if(!empty ($this->image[$key])) {
} else {
$value->setContent('<img border="0" src="' . $this->image[$key] . '">');
$img = $value->render();
}
@ -186,12 +186,14 @@ class UI_Menu {
} else {
$link = $this->title[$key];
if (!empty($this->image[$key])) {
if ($this->image[$key] != "") {
if ($this->imagewidth[$key] != 0) {
$img = '<img border="0" src="' . $this->image[$key] . '" width="' . $this->imagewidth[$key] . '">';
} else {
$img = '<img border="0" src="' . $this->image[$key] . '">';
}
} else {
$img = "&nbsp;";
}
}
@ -210,24 +212,21 @@ class UI_Menu {
$bgColor = $cfg["color"]["table_light_active"];
}
if (!empty($this->extra[$key]) && $this->extra[$key] == 'id="marked" ') {
if ($this->extra[$key] == 'id="marked" ') {
$bgColor = $cfg["color"]["table_light_active"];
}
}
$tpl->set('d', 'NAME', $link);
if (empty($this->image[$key])) {
if ($this->image[$key] == "") {
$tpl->set('d', 'ICON', '');
} else {
$tpl->set('d', 'ICON', $img);
}
if (!empty($this->extra[$key]) || $this->rowmark == true) {
if ($this->extra[$key] != "" || $this->rowmark == true) {
$extraadd = "";
if(empty($this->extra[$key])) {
$this->extra[$key] = '';
}
if ($this->rowmark == true) {
$extraadd = 'onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)"';
@ -440,7 +439,7 @@ class UI_Table_Form {
if (is_array($this->items)) {
foreach ($this->items as $key => $value) {
if (isset($this->itemType[$key]) && $this->itemType[$key] == 'subheader') {
if ($this->itemType[$key] == 'subheader') {
$subheader = '<tr class="text_medium" style="background-color: ' . $cfg["color"]["table_header"] . ';">';
$subheader .= '<td colspan="2" valign="top" style="border: 0px;border-top: 0px; border-bottom:0px; border-right:1px;border-color: ' . $cfg["color"]["table_border"] . '; border-style: solid;">' . $this->captions[$key] . '</td></tr>';
@ -704,7 +703,6 @@ class UI_Page {
class Link {
var $alt = '';
var $link;
var $title;
var $targetarea;
@ -772,8 +770,7 @@ class Link {
function render() {
global $sess, $cfg;
$custom = '';
$attributes = '';
if ($this->alt != "") {
$alt = 'alt="' . $this->alt . '" title="' . $this->alt . '" ';
} else {
@ -822,7 +819,7 @@ class Link {
break;
}
if (empty($this->images)) {
if ($this->images == '') {
return ($link . $this->content . "</a>");
} else {
list($this->img_width, $this->img_height, $this->img_type, $this->img_attr) = getimagesize($cfg['path']['contenido'] . $this->images);
@ -913,7 +910,6 @@ class UI_List {
$colcount = 0;
if (is_array($this->cells)) {
$dark = true;
foreach ($this->cells as $row => $cells) {
$thefont = '';
$unne = '';
@ -932,7 +928,7 @@ class UI_List {
$bgColor = $cfg["color"]["table_light"];
}
if (!empty($this->bgcolor[$row])) {
if ($this->bgcolor[$row] != "") {
$bgColor = $this->bgcolor[$row];
}
@ -940,7 +936,7 @@ class UI_List {
$count = 0;
foreach ($cells as $key => $value) {
$thefontDispl = $thefont . (empty($this->extra[$row][$key]))?'':$this->extra[$row][$key];
$thefontDispl = $thefont . $this->extra[$row][$key];
$count++;
$tpl2->reset();
@ -970,7 +966,7 @@ class UI_List {
$tpl2->set('s', 'ALIGN', 'left');
}
if (!empty($this->cellvalignment[$row][$key])) {
if ($this->cellvalignment[$row][$key] != "") {
$tpl2->set('s', 'VALIGN', $this->cellvalignment[$row][$key]);
} else {
$tpl2->set('s', 'VALIGN', 'top');
@ -1031,10 +1027,10 @@ class cScrollList {
var $listStart;
/**
* sortable array
* @var array
* sortable flag
* @var string
*/
protected $_aSortable;
var $sortable;
/**
* sortlink
@ -1084,7 +1080,7 @@ class cScrollList {
$this->resultsPerPage = 0;
$this->listStart = 1;
$this->_aSortable = [];
$this->sortable = false;
$this->objTable = new cHTMLTable();
if ($defaultstyle == true) {
@ -1130,7 +1126,7 @@ class cScrollList {
* @param $sortable boolean true or false
*/
function setSortable($key, $sortable) {
$this->_aSortable[$key] = $sortable;
$this->sortable[$key] = $sortable;
}
/**
@ -1302,7 +1298,8 @@ class cScrollList {
$this->sortkey = $field;
$this->sortmode = $order;
$field = intval($field) + 1;
$field = $field + 1;
$this->data = array_csort($this->data, "$field", $order);
}
@ -1333,8 +1330,8 @@ class cScrollList {
/* Render header */
foreach ($this->header as $key => $value) {
if (is_array($this->_aSortable)) {
if (array_key_exists($key, $this->_aSortable) && $this->_aSortable[$key] == true) {
if (is_array($this->sortable)) {
if (array_key_exists($key, $this->sortable) && $this->sortable[$key] == true) {
$this->sortlink->setContent($value);
$this->sortlink->setCustom("sortby", $key);

Datei anzeigen

@ -508,47 +508,23 @@ class Contenido_UpdateNotifier {
$response = false;
if ($this->_bUseCurl) {
$sUrl = "https://" . $sHost . $sFile;
$ch = $this->_checkCon2Host($sUrl);
if ($ch !== false) {
if ($bCheckCon) {
$ch = $this->_checkCon2Host($sHost);
} else {
$ch = curl_init("http://" . $sHost);
}
if (is_resource($ch)) {
curl_setopt($ch, CURLOPT_URL, "http://" . $sHost . $sFile);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
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);
//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 {
$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)) {
$source = file_get_contents("http://" . $sHost . $sFile);
if ($source !== false AND ! empty($source)) {
$response = $source;
}
}
@ -563,12 +539,13 @@ class Contenido_UpdateNotifier {
* @param string $sHost
* @return obj|boolean curl object or false
*/
protected function _checkCon2Host($sUrl) {
$ch = curl_init($sUrl);
if ($ch === false) {
protected function _checkCon2Host($sHost) {
$ch = curl_init("http://" . $sHost);
if (!is_resource($ch)) {
$sErrorMessage = i18n('Unable to check for updates!') . " "
. sprintf(i18n('Connection to %s failed!'), $sHost);
$this->sErrorOutput = $this->renderOutput($sErrorMessage);
return false;
}
return $ch;
}
@ -723,7 +700,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);

Datei anzeigen

@ -377,10 +377,6 @@ class User {
*/
function getUserProperty($type, $name, $group = false) {
global $cfg, $perm;
if(empty($this->values)) {
return false;
}
if (!is_object($perm)) {
$perm = new Contenido_Perm();

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -26,186 +27,182 @@
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class VersionFile extends Version {
class VersionFile extends Version {
/**
* Content code of current file.
* @access public
*/
public $sCode;
* Content code of current file.
* @access public
*/
public $sCode;
/**
* Description folder of history sub nav.
* Its not required to use it.
* @access protected
*/
public $sDescripion;
/**
* The path of style file.
* @access public
*/
public $sPath;
/**
* The id of Type.
* @access public
*/
public $sFileName;
/**
* The class versionStyle object constructor, initializes class variables
*
* @param string $iIdOfType The name of style file
* @param array $aFileInfo Get FileInformation from table file_information
* @param array $aCfg
* @param array $aCfgClient
* @param object $oDB
* @param integer $iClient
* @param object $sArea
* @param object $iFrame
*
* @return void its only initialize class members
*/
public function __construct($iIdOfType, $aFileInfo, $sFileName, $sTypeContent, $aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame, $sVersionFileName = '') {
* Description folder of history sub nav.
* Its not required to use it.
* @access protected
*/
public $sDescripion;
/**
* The path of style file.
* @access public
*/
public $sPath;
/**
* The id of Type.
* @access public
*/
public $sFileName;
/**
* The class versionStyle object constructor, initializes class variables
*
* @param string $iIdOfType The name of style file
* @param array $aFileInfo Get FileInformation from table file_information
* @param array $aCfg
* @param array $aCfgClient
* @param object $oDB
* @param integer $iClient
* @param object $sArea
* @param object $iFrame
*
* @return void its only initialize class members
*/
public function __construct($iIdOfType, $aFileInfo, $sFileName, $sTypeContent, $aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame, $sVersionFileName = '') {
// Set globals in super class constructer
parent::__construct($aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame);
parent::__construct($aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame);
// Folder name is css or js ...
$this->sType = $sTypeContent;
$this->sType = $sTypeContent;
// File Name for xml node
$this->sFileName = $sFileName;
$this->sFileName = $sFileName;
// File Information, set for class Version to generate head xml nodes
$this->sDescripion = $aFileInfo["description"];
$this->sAuthor = $aFileInfo["author"];
$this->dLastModified = $aFileInfo["lastmodified"];
$this->dCreated = $aFileInfo["created"];
$this->sDescripion = $aFileInfo["description"];
$this->sAuthor = $aFileInfo["author"];
$this->dLastModified = $aFileInfo["lastmodified"];
$this->dCreated = $aFileInfo["created"];
// Frontendpath to files
if($sTypeContent == "templates"){
$sTypeContent = "tpl";
}
if ($sTypeContent == "templates") {
$sTypeContent = "tpl";
}
$this->sPath = $this->aCfgClient[$this->iClient][$sTypeContent]["path"];
// Identity the Id of Content Type
$this->iIdentity = $iIdOfType;
// This function looks if maximum number of stored versions is achieved
// Identity the Id of Content Type
$this->iIdentity = $iIdOfType;
//This function looks if maximum number of stored versions is achieved
$this->prune();
// Take revision files if exists
$this->initRevisions();
// Get code of style
$this->initFileContent();
// Set Layout Table Iformation, currently not in use!
#$this->setLayoutTable();
//Take revision files if exists
$this->initRevisions();
//Get code of style
$this->initFileContent();
// Set Layout Table Iformation, currently not in use!
#$this->setLayoutTable();
if ($sVersionFileName == '') {
$sVersionFileName = $this->sFileName;
}
// Create Body Node of Xml File
$this->setData("name", $sVersionFileName);
$this->setData("code", $this->sCode);
$this->setData("description", $this->sDescripion);
}
/**
* This function init the class member sCode with current file content
*
* @return void only init sCode
*/
$this->setData("name", $sVersionFileName);
$this->setData("code", $this->sCode);
$this->setData("description", $this->sDescripion);
}
/**
* This function init the class member sCode with current file content
*
* @return void only init sCode
*/
protected function initFileContent() {
if (file_exists($this->sPath.$this->sFileName)) {
if (!$handle = fopen( $this->sPath.$this->sFileName, "rb")) {
print i18n("Can not open file "). $this->sPath.$this->sFileName;
return;
} do {
$_data = fread($handle, 4096);
if (strlen($_data) == 0) {
break;
}
$this->sCode .= $_data;
} while(true);
fclose($handle);
}else{
echo "<br>File not exists " . $this->sPath.$this->sFileName;
}
if (file_exists($this->sPath . $this->sFileName)) {
if (!$handle = fopen($this->sPath . $this->sFileName, "rb")) {
print i18n("Can not open file ") . $this->sPath . $this->sFileName;
return;
} do {
$_data = fread($handle, 4096);
if (strlen($_data) == 0) {
break;
}
$this->sCode .= $_data;
} while (true);
fclose($handle);
} else {
echo "<br>File not exists " . $this->sPath . $this->sFileName;
}
}
/**
* This function read an xml file nodes
*
* @param string $sPath Path to file
*
* @return {array} returns array width nodes
*/
/**
* This function read an xml file nodes
*
* @param string $sPath Path to file
*
* @return {array} returns array width nodes
*/
public function initXmlReader($sPath) {
$aResult = array();
if($sPath !=""){
// Output this xml file
$sXML = simplexml_load_file($sPath);
if ($sXML) {
foreach ($sXML->body as $oBodyValues) {
// if choose xml file read value an set it
$aResult["name"] = $oBodyValues->name;
$aResult["desc"] = $oBodyValues->description;
$aResult["code"] = $oBodyValues->code;
}
}
}
return $aResult;
$aResult = array();
if ($sPath != "") {
// Output this xml file
$sXML = simplexml_load_file($sPath);
if ($sXML) {
foreach ($sXML->body as $oBodyValues) {
// if choose xml file read value an set it
$aResult["name"] = $oBodyValues->name;
$aResult["desc"] = $oBodyValues->description;
$aResult["code"] = $oBodyValues->code;
}
}
}
return $aResult;
}
/**
* This function reads the path of file
*
* @param string $sPath Path to file
*
* @return string the path of file
*/
/**
* This function reads the path of file
*
* @param string $sPath Path to file
*
* @return string the path of file
*/
public function getPathFile() {
return $this->sPath;
return $this->sPath;
}
/**
* Function returns javascript which refreshes contenido frames for file list an subnavigation.
* This is neccessary, if filenames where changed, when a history entry is restored
*
* @param integer $iIdClient - id of client which contains this file
* @param string $sArea - name of contenido area in which this procedure should be done
* @param string $sFilename - new filename of file which should be updated in other frames
* @param object $sess - Contenido session object
*
* @return string - Javascript for refrehing frames
*/
/**
* Function returns javascript which refreshes contenido frames for file list an subnavigation.
* This is neccessary, if filenames where changed, when a history entry is restored
*
* @param integer $iIdClient - id of client which contains this file
* @param string $sArea - name of contenido area in which this procedure should be done
* @param string $sFilename - new filename of file which should be updated in other frames
* @param object $sess - Contenido session object
*
* @return string - Javascript for refrehing frames
*/
public function renderReloadScript($sArea, $sFilename, $sess) {
$sReloadScript = "<script type=\"text/javascript\">
var right_top = top.content.right.right_top;
var left_bottom = top.content.left.left_bottom;
if (right_top) {
var href = '".$sess->url("main.php?area=$sArea&frame=3&file=$sFilename&history=true")."';
var href = '" . $sess->url("main.php?area=$sArea&frame=3&file=$sFilename&history=true") . "';
right_top.location.href = href;
}
if(left_bottom){
var href = '".$sess->url("main.php?area=$sArea&frame=2&file=$sFilename")."';
var href = '" . $sess->url("main.php?area=$sArea&frame=2&file=$sFilename") . "';
left_bottom.location.href = href;
}
@ -213,5 +210,7 @@ if(!defined('CON_FRAMEWORK')) {
return $sReloadScript;
}
} // end of class
}
// end of class
?>

Datei anzeigen

@ -7,6 +7,9 @@
* Description:
* Contenido XML Parser
*
* Requirements:
* @con_php_req 5.0
*
*
* @package Contenido_XML
* @version 1.0.9
@ -16,17 +19,79 @@
* @link http://www.4fb.de
* @link http://www.contenido.org
* @since file available since contenido release <= 4.6
*
* {@internal
* created unknown
* modified 2008-06-30, Dominik Ziegler, add security fix
*
* $Id$:
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
/**
/**
* Class for parsing XML documents using SAX
*
* This class is a abstraction class for the PHP Expat XML functions.
*
* You can define handler functions/objects for start, end, PI and data sections (1.) or
* your can define path which will trigger the defined event when encountered (2.)
*
* Example:
*
* 1.) $parser->setEvents(array("startElement"=> "myFunction",
* "endElement"=> "myFunction",
* "characterData"=> "myFunction",
* "processingInstruction" => "myFunction");
*
* The value can also be an array with the object reference and the method to call.
* i.e. "startElement"=>array(&$myObj, "myMethod") instead of "startelement"=>"myFunction"
*
* 2.) $parser->setEvents(array("/root/foo/bar"=>"myFunction"));
*
* Valid array keys are: 'startElement', 'endElement', 'characterData', 'processingInstruction' and paths
* folowing the scheme '/root/element'. The path MUST begin from the root element and MUST start with '/'.
*
* The value can also be an array with the object reference and the method to call.
* i.e. "/foo/bar"=>array(&$myObj, "myMethod") instead of "/foo/bar"=>"myFunction"
*
* It has 3 public methods:
*
* setEventHandlers - Set specific handlers for the xml parser
* parseFile - Used to parse a XML file
* parse - Used to parse a XML string
*
* A small example:
*
* include ("class.xmlparser.php");
*
* // The XML String
* $xml = '
* <?xml version="1.0"?>
* <foo>
* <bar>some text</bar>
* <bar>another text</bar>
* </foo>';
*
* function myHandler($name, $attribs, $content)
* {
* echo "<b style='color:red'>HIT</b>: [ <b>$name</b> ] [ $content ]<br/>";
* }
*
* $parser = new XmlParser; // Parser instance
* $parser->setEventHandlers(array("/foo/bar"=>"myHandler")); // Define our handler
* $parser->parse($xml); // Parse the XML string
*
* Report bugs to: jan.lengowski@4fb.de
*
* @author Jan Lengowski <Jan.Lengowski@4fb.de>
* @copyright four for business AG <www.4fb.de>
* @version 1.0
*/
class clXmlParser {
class XmlParser {
/**
* XML Parser autofree

Datei anzeigen

@ -23,6 +23,95 @@
defined('CON_FRAMEWORK') or die('Illegal call');
class cRegistry {
/**
* Container for application variables.
* Meant to set and get application wide variables as an alternative to
* store them in global scope.
*
* @var array
*/
protected static $_appVars = array();
/**
* Container for ok messages.
*
* @author frederic.schneider
* @var array
*/
protected static $_okMessages = array();
/**
* Container for information messages.
*
* @author konstantinos.katikakis
* @var array
*/
protected static $_infoMessages = array();
/**
* Container for error messages.
*
* @author konstantinos.katikakis
* @var array
*/
protected static $_errMessages = array();
/**
* Container for warning messages.
*
* @author konstantinos.katikakis
* @var array
*/
protected static $_warnMessages = array();
/**
* Returns the auth object stored in the global variable "auth".
*
* @return cAuth
*/
public static function getAuth() {
return self::_fetchGlobalVariable('auth');
}
/**
* Returns the permission object stored in the global variable "perm".
*
* @return cPermission
*/
public static function getPerm() {
return self::_fetchGlobalVariable('perm');
}
/**
* Returns the area stored in the global variable "area".
*
* @author thomas.stauer
* @return string
*/
public static function getArea() {
return self::_fetchGlobalVariable('area');
}
/**
* Returns the current frame id stored in the global variable "frame".
*
* @author thomas.stauer
* @return string
*/
public static function getFrame() {
return self::_fetchGlobalVariable('frame', '');
}
/**
* Returns the action stored in the global variable "action".
*
* @author jann.diekmann
* @return string
*/
public static function getAction() {
return self::_fetchGlobalVariable('action');
}
/**
* Function wich returns path after the last possible place changing via
@ -32,7 +121,7 @@ class cRegistry {
*/
public static function getBackendPath() {
$cfg = self::getConfig();
return $cfg['path']['conlite'];
return $cfg['path']['contenido'];
}
/**
@ -58,7 +147,7 @@ class cRegistry {
public static function getFrontendPath() {
$cfgClient = self::getClientConfig();
$client = self::getClientId();
return (empty($cfgClient))?'':$cfgClient[$client]['path']['frontend'];
return $cfgClient[$client]['path']['frontend'];
}
/**
@ -219,11 +308,6 @@ class cRegistry {
return self::_fetchGlobalVariable('edit', FALSE);
}
public static function getCurrentModule()
{
return self::_fetchGlobalVariable('cCurrentModule', 0);
}
/**
* Fetches the global variable requested.
* If variable is not set, the default value is returned.
@ -251,4 +335,75 @@ class cRegistry {
return new $apiClassName($objectId);
}
/**
* Return an array with ok message
*
* @author frederic.schneider
* @return array
*/
public static function getOkMessages() {
return self::$_okMessages;
}
/**
* Returns an array with information messages.
*
* @author konstantinos.katikakis
* @return array
*/
public static function getInfoMessages() {
return self::$_infoMessages;
}
/**
* Returns an array with error messages.
*
* @author konstantinos.katikakis
* @return array
*/
public static function getErrorMessages() {
return self::$_errMessages;
}
/**
* Returns an array with warning messages.
*
* @author konstantinos.katikakis
* @return array
*/
public static function getWarningMessages() {
return self::$_warnMessages;
}
/**
* Returns the CONTENIDO Session ID stored in the global variable
* "contenido".
*
* @return string
*/
public static function getBackendSessionId() {
return self::_fetchGlobalVariable('contenido');
}
/**
* Returns the CONTENIDO backend language stored in the global variable
* "belang"
*
* @return string
*/
public static function getBackendLanguage() {
return self::_fetchGlobalVariable('belang');
}
/**
* Returns the loaded cApiLanguage object for the current language.
*
* @return cApiLanguage
*
* @throws cInvalidArgumentException
*/
public static function getLanguage() {
return self::_fetchItemObject('cApiLanguage', self::getLanguageId());
}
}

Datei anzeigen

@ -1,5 +1,4 @@
<?php
/**
* File:
* class.articlelanguage.php
@ -19,12 +18,14 @@
*
* $Id$
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cApiArticleLanguageCollection extends ItemCollection {
class cApiArticleLanguageCollection extends ItemCollection {
public function __construct($select = false) {
global $cfg;
parent::__construct($cfg["tab"]["art_lang"], "idartlang");
@ -35,26 +36,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
{
/**
*
* @global type $cfg
* @param type $mId
* Constructor Function
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false) {
public function __construct($mId = false)
{
global $cfg;
parent::__construct($cfg["tab"]["art_lang"], "idartlang");
$this->setFilters(array(), array());
@ -62,23 +63,24 @@ 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();
@ -106,16 +108,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);
@ -124,7 +126,5 @@ class cApiArticleLanguage extends Item {
$this->content[strtolower($this->db->f('type'))][$this->db->f('typeid')] = urldecode($this->db->f('value'));
}
}
}
?>

Datei anzeigen

@ -52,4 +52,6 @@ class cApiCategory extends Item {
}
}
}
}
?>

Datei anzeigen

@ -51,18 +51,17 @@ class cApiCategoryLanguage extends Item {
}
}
public function setField($field, $value, $bSafe = true): bool
{
public function setField($field, $value, $bSafe = true) {
switch ($field) {
case "name":
self::setField("urlname", $value, $bSafe);
$this->setField("urlname", $value);
break;
case "urlname":
$value = clHtmlSpecialChars(capiStrCleanURLCharacters($value), ENT_QUOTES);
break;
}
return parent::setField($field, $value, $bSafe);
parent::setField($field, $value);
}
public function assignTemplate($idtpl) {

Datei anzeigen

@ -0,0 +1,85 @@
<?php
/**
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cApiFileInformationCollection extends ItemCollection {
public function __construct() {
parent::__construct(cRegistry::getConfigValue('tab', 'file_information'), 'idsfi');
$this->_setItemClass("cApiFileInformation");
}
public function create($sFilename, $sType, $sDescription = '') {
$iClient = cRegistry::getClientId();
$oAuth = cRegistry::getAuth();
$oItem = new cApiFileInformation();
$oItem->loadByMany(array(
'idclient' => $iClient,
'type' => $sType,
'filename' => $sFilename
));
if (!$oItem->isLoaded()) {
$oItem = $this->createNewItem();
$oItem->set('idclient', $iClient);
$oItem->set('type', $sType);
$oItem->set('filename', $sFilename);
$oItem->set('created', date('Y-m-d H:i:s'));
$oItem->set('lastmodified', date('Y-m-d H:i:s'));
$oItem->set('author', $oAuth->auth['uid']);
$oItem->set('modifiedby', $oAuth->auth['uid']);
$oItem->set('description', $sDescription);
$oItem->store();
return $oItem;
} else {
return $this->update($sFilename, $sType, $sDescription);
}
}
public function update($sFilename, $sType, $sDescription = '', $sNewFilename = '', $sAuthor = '') {
$oAuth = cRegistry::getAuth();
$iClient = cRegistry::getClientId();
$oItem = new cApiFileInformation();
$oItem->loadByMany(array(
'idclient' => $iClient,
'type' => $sType,
'filename' => $sFilename
));
$iId = $oItem->get('idsfi');
if ($oItem->isLoaded()) {
$oItem->set('idsfi', $iId);
$oItem->set('lastmodified', date('Y-m-d H:i:s'));
$oItem->set('description', $sDescription);
$oItem->set('modifiedby', $oAuth->auth['uid']);
if (!empty($sNewFilename)) {
$oItem->set('filename', $sNewFilename);
}
if (!empty($sAuthor)) {
$oItem->set('author', $sAuthor);
}
$oItem->store();
}
return $oItem;
}
}
class cApiFileInformation extends Item {
public function __construct($mId = false) {
parent::__construct(cRegistry::getConfigValue('tab', 'file_information'), 'idsfi');
if ($mId !== false) {
$this->loadByPrimaryKey($mId);
}
}
}

Datei anzeigen

@ -69,7 +69,7 @@ class cApiLayout extends Item {
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false) {
$cfg = cRegistry::getConfig();
global $cfg;
parent::__construct($cfg["tab"]["lay"], "idlay");
$this->setFilters(array(), array());
@ -78,7 +78,7 @@ class cApiLayout extends Item {
$this->_setLayPath();
}
$oClient = new cApiClient(cRegistry::getClientId());
$oClient = new cApiClient($client);
$aClientProp = $oClient->getPropertiesByType('layfileedit');
if(count($aClientProp) > 0) {
$this->_aLayFileEditConf = array_merge($this->_aLayFileEditConf, $aClientProp);

Datei anzeigen

@ -6,7 +6,7 @@
*
* Description:
* cApi class
*
*
* @package Core
* @subpackage cApi
* @version $Rev$
@ -16,13 +16,9 @@
* @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version)
* @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version)
* @link http://www.conlite.org ConLite.org
*
*
* $Id$
*/
use ConLite\Log\LogWriter;
use ConLite\Log\Log;
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -61,8 +57,10 @@ class cApiModuleCollection extends ItemCollection {
$oMod = $this->_itemClassInstance;
$oMod->_bNoted = TRUE;
$oMod->loadByPrimaryKey($iIdMod);
if ($oMod->isLoaded() && $oMod->hasModuleFolder()) {
$oMod->deleteModuleFolder();
if ($oMod->isLoaded()) {
if ($oMod->hasModuleFolder()) {
$oMod->deleteModuleFolder();
}
}
unset($oMod);
return parent::delete($iIdMod);
@ -75,12 +73,6 @@ class cApiModuleCollection extends ItemCollection {
*/
class cApiModule extends Item {
public $_oldumask;
/**
* @var mixed
*/
public $_sModAliasOld;
public $_bNoted;
protected $_error;
/**
@ -91,7 +83,10 @@ class cApiModule extends Item {
protected $_bOutputFromFile = false;
protected $_bInputFromFile = false;
private array $aUsedTemplates = [];
/**
* @var array
*/
private $aUsedTemplates = array();
/**
* Configuration Array of ModFileEdit
@ -99,20 +94,32 @@ class cApiModule extends Item {
*
* @var array
*/
private $_aModFileEditConf = ['use' => false, 'modFolderName' => 'data/modules'];
private $_aModFileEditConf = array(
'use' => false,
'modFolderName' => 'data/modules'
);
private ?string $_sModAlias = null;
/**
*
* @var string
*/
private $_sModAlias;
private ?string $_sModPath = null;
private array $_aModDefaultStruct = ['css', 'js', 'php', 'template', 'image', 'lang', 'xml'];
/**
*
* @var string
*/
private $_sModPath;
private $_aModDefaultStruct = array(
'css', 'js', 'php', 'template', 'image', 'lang', 'xml'
);
/**
* Constructor Function
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false) {
$cfg = cRegistry::getConfig();
$cfgClient = cRegistry::getClientConfig(cRegistry::getClientId());
global $cfg, $cfgClient, $client;
parent::__construct($cfg["tab"]["mod"], "idmod");
@ -120,22 +127,24 @@ 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([], []);
$this->setFilters(array(), array());
$this->_packageStructure = ["jsfiles" => $cfgClient["js"]["path"], "tplfiles" => $cfgClient["tpl"]["path"], "cssfiles" => $cfgClient["css"]["path"]];
$this->_packageStructure = array("jsfiles" => $cfgClient[$client]["js"]["path"],
"tplfiles" => $cfgClient[$client]["tpl"]["path"],
"cssfiles" => $cfgClient[$client]["css"]["path"]);
if (isset($cfg['dceModEdit']) && is_array($cfg['dceModEdit'])) {
$this->_aModFileEditConf['clientPath'] = $cfgClient["path"]["frontend"];
$this->_aModFileEditConf['clientPath'] = $cfgClient[$client]["path"]["frontend"];
$this->_aModFileEditConf = array_merge($this->_aModFileEditConf, $cfg['dceModEdit']);
if (!isset($cfg['dceModEdit']['modPath']) || empty($cfg['dceModEdit']['modPath'])) {
$this->_aModFileEditConf['modPath'] = $cfgClient["path"]["frontend"]
$this->_aModFileEditConf['modPath'] = $cfgClient[$client]["path"]["frontend"]
. $this->_aModFileEditConf['modFolderName'] . "/";
}
}
$cApiClient = new cApiClient(cRegistry::getClientId());
$aClientProp = $cApiClient->getPropertiesByType('modfileedit');
if ($aClientProp !== []) {
$oClient = new cApiClient($client);
$aClientProp = $oClient->getPropertiesByType('modfileedit');
if (count($aClientProp) > 0) {
$this->_aModFileEditConf = array_merge($this->_aModFileEditConf, $aClientProp);
}
@ -146,15 +155,15 @@ class cApiModule extends Item {
public function createModuleFolder() {
//echo $this->_aModFileEditConf['modPath'];
$sPathErrorLog = cRegistry::getConfigValue('path', 'logs') . 'errorlog.txt';
$sPathErrorLog = cRegistry::getConfigValue('path', 'logs').'errorlog.txt';
if (is_writable($this->_aModFileEditConf['clientPath']) && !file_exists($this->_aModFileEditConf['modPath'])) {
try {
mkdir($this->_aModFileEditConf['modPath'], 0777, true);
} catch (Exception $ex) {
$writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
$log = new Log($writer);
$log->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), Log::WARN);
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
$oLog = new cLog($oWriter);
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
}
}
@ -164,9 +173,9 @@ class cApiModule extends Item {
try {
mkdir($this->getModulePath(), 0777);
} catch (Exception $ex) {
$writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
$log = new Log($writer);
$log->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), Log::WARN);
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
$oLog = new cLog($oWriter);
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
}
if (is_writable($this->getModulePath())) {
@ -175,16 +184,18 @@ class cApiModule extends Item {
umask($this->_oldumask);
}
} else {
$writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
$log = new Log($writer);
$log->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), Log::WARN);
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
$oLog = new cLog($oWriter);
$oLog->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), cLog::WARN);
}
return FALSE;
}
public function deleteModuleFolder() {
if ($this->_aModFileEditConf['use'] == TRUE && is_writable($this->_aModFileEditConf['modPath']) && is_dir($this->getModulePath())) {
return $this->_recursiveRemoveDirectory($this->getModulePath());
if ($this->_aModFileEditConf['use'] == TRUE && is_writable($this->_aModFileEditConf['modPath'])) {
if (is_dir($this->getModulePath())) {
return $this->_recursiveRemoveDirectory($this->getModulePath());
}
}
return FALSE;
}
@ -248,9 +259,7 @@ class cApiModule extends Item {
*
* @return array Found strings for this module
*/
public function parseModuleForStrings(): bool|array
{
global $cfg;
public function parseModuleForStrings() {
if ($this->virgin == true) {
return false;
}
@ -260,12 +269,12 @@ class cApiModule extends Item {
$code .= $this->get("input");
// Initialize array
$strings = [];
$strings = array();
// Split the code into mi18n chunks
$varr = preg_split('/mi18n([\s]*)\(([\s]*)"/', $code, -1);
if ((is_countable($varr) ? count($varr) : 0) > 1) {
if (count($varr) > 1) {
foreach ($varr as $key => $value) {
// Search first closing
$closing = strpos($value, '")');
@ -285,7 +294,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]) && (is_countable($results[2]) ? count($results[2]) : 0) > 0) {
if (is_array($results[1]) && count($results[2]) > 0) {
$strings = array_merge($strings, $results[2]);
}
@ -297,7 +306,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']) && $cfg['translatable_content_types'] !== []) {
if (is_array($cfg['translatable_content_types']) && count($cfg['translatable_content_types']) > 0) {
// 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
@ -308,7 +317,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([$sContentType, 'addModuleTranslations'], $strings);
$strings = call_user_func(array($sContentType, 'addModuleTranslations'), $strings);
}
}
}
@ -325,7 +334,7 @@ class cApiModule extends Item {
public function moduleInUse($module, $bSetData = false) {
global $cfg;
$dbConLite = new DB_ConLite();
$db = new DB_ConLite();
$sql = "SELECT
c.idmod, c.idtpl, t.name
@ -337,17 +346,17 @@ class cApiModule extends Item {
t.idtpl=c.idtpl
GROUP BY c.idtpl
ORDER BY t.name";
$dbConLite->query($sql);
$db->query($sql);
if ($dbConLite->nf() == 0) {
if ($db->nf() == 0) {
return false;
} else {
$i = 0;
// save the datas of used templates in array
if ($bSetData === true) {
while ($dbConLite->next_record()) {
$this->aUsedTemplates[$i]['tpl_name'] = $dbConLite->f('name');
$this->aUsedTemplates[$i]['tpl_id'] = (int) $dbConLite->f('idmod');
while ($db->next_record()) {
$this->aUsedTemplates[$i]['tpl_name'] = $db->f('name');
$this->aUsedTemplates[$i]['tpl_id'] = (int) $db->f('idmod');
$i++;
}
}
@ -367,21 +376,19 @@ class cApiModule extends Item {
/**
* Checks if the module is a pre-4.3 module
* @return boolean true if this module is an old one
*
* @deprecated since version 2.0
*/
public function isOldModule() {
// Keywords to scan
$scanKeywords = ['$cfgTab', 'idside', 'idsidelang'];
$scanKeywords = array('$cfgTab', 'idside', 'idsidelang');
$input = $this->get("input");
$output = $this->get("output");
foreach ($scanKeywords as $scanKeyword) {
if (strstr($input, $scanKeyword)) {
foreach ($scanKeywords as $keyword) {
if (strstr($input, $keyword)) {
return true;
}
if (strstr($output, $scanKeyword)) {
if (strstr($output, $keyword)) {
return true;
}
}
@ -390,8 +397,11 @@ class cApiModule extends Item {
public function getField($field) {
$value = parent::getField($field);
if ($field === "name" && $value == "") {
$value = i18n("- Unnamed Module -");
switch ($field) {
case "name":
if ($value == "") {
$value = i18n("- Unnamed Module -");
}
}
return ($value);
}
@ -399,7 +409,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 || (is_array($this->_aModFileEditConf['modsFromFile']) && in_array($this->get('idmod'), $this->_aModFileEditConf['modsFromFile'])))) {
if ($this->_aModFileEditConf['use'] == true && ($this->_aModFileEditConf['allModsFromFile'] == true || in_array($this->get('idmod'), $this->_aModFileEditConf['modsFromFile']))) {
$this->modifiedValues['output'] = true;
$this->modifiedValues['input'] = true;
}
@ -414,9 +424,11 @@ class cApiModule extends Item {
conGenerateCodeForAllArtsUsingMod($this->get("idmod"));
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));
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));
}
}
}
}
@ -425,7 +437,7 @@ class cApiModule extends Item {
return $this->_aModFileEditConf;
}
protected function _recursiveRemoveDirectory($directory): bool {
protected function _recursiveRemoveDirectory($directory) {
foreach (glob("{$directory}/*") as $file) {
if (is_dir($file)) {
$this->_recursiveRemoveDirectory($file);
@ -464,14 +476,6 @@ class cApiModule extends Item {
}
}
/**
* @return mixed
*/
public function getError()
{
return $this->_error;
}
protected function _shouldLoadFromFiles() {
if (getSystemProperty("modules", "loadfromfiles") == "true") {
return true;
@ -490,23 +494,26 @@ class cApiModule extends Item {
private function _parseImportFile($sFile, $sType = "module", $sEncoding = "ISO-8859-1") {
global $_mImport;
$clXmlParser = new clXmlParser($sEncoding);
$oParser = new XmlParser($sEncoding);
if ($sType == "module") {
$clXmlParser->setEventHandlers(["/module/name" => "cHandler_ModuleData", "/module/description" => "cHandler_ModuleData", "/module/type" => "cHandler_ModuleData", "/module/input" => "cHandler_ModuleData", "/module/output" => "cHandler_ModuleData"]);
$oParser->setEventHandlers(array("/module/name" => "cHandler_ModuleData",
"/module/description" => "cHandler_ModuleData",
"/module/type" => "cHandler_ModuleData",
"/module/input" => "cHandler_ModuleData",
"/module/output" => "cHandler_ModuleData"));
} else {
$aHandler = [
"/modulepackage/guid" => "cHandler_ModuleData",
$aHandler = array("/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/output" => "cHandler_ModuleData",
"/modulepackage/module/input" => "cHandler_ModuleData",
];
"/modulepackage/module/output" => "cHandler_ModuleData",
"/modulepackage/module/input" => "cHandler_ModuleData");
// Add file handler (e.g. js, css, templates)
foreach (array_keys($this->_packageStructure) As $sFileType) {
foreach ($this->_packageStructure As $sFileType => $sFilePath) {
// 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
@ -529,13 +536,13 @@ class cApiModule extends Item {
$aHandler["/modulepackage/translations/string/original"] = "cHandler_ItemName";
$aHandler["/modulepackage/translations/string/translation"] = "cHandler_Translation";
$clXmlParser->setEventHandlers($aHandler);
$oParser->setEventHandlers($aHandler);
}
if ($clXmlParser->parseFile($sFile)) {
if ($oParser->parseFile($sFile)) {
return true;
} else {
$this->_error = $clXmlParser->error;
$this->_error = $oParser->error;
return false;
}
}
@ -574,8 +581,8 @@ class cApiModule extends Item {
* @param $return boolean if false, the result is immediately sent to the browser
*/
public function export($filename, $return = false) {
$xmlTree = new XmlTree('1.0', 'ISO-8859-1');
$root = & $xmlTree->addRoot('module');
$tree = new XmlTree('1.0', 'ISO-8859-1');
$root = & $tree->addRoot('module');
$root->appendChild("name", clHtmlSpecialChars($this->get("name")));
$root->appendChild("description", clHtmlSpecialChars($this->get("description")));
@ -586,11 +593,11 @@ class cApiModule extends Item {
if ($return == false) {
ob_end_clean();
header("Content-Type: text/xml");
header("Etag: " . md5(random_int(0, mt_getrandmax())));
header("Etag: " . md5(mt_rand()));
header("Content-Disposition: attachment;filename=\"$filename\"");
$xmlTree->dump(false);
$tree->dump(false);
} else {
return stripslashes($xmlTree->dump(true));
return stripslashes($tree->dump(true));
}
}
@ -598,13 +605,13 @@ class cApiModule extends Item {
global $_mImport;
if ($this->_parseImportFile($sFile, "package")) {
$aData = [];
$aData = array();
$aData["guid"] = $_mImport["module"]["guid"];
$aData["repository_guid"] = $_mImport["module"]["repository_guid"];
$aData["name"] = $_mImport["module"]["name"];
// Files
foreach (array_keys($this->_packageStructure) as $sFileType) {
foreach ($this->_packageStructure as $sFileType => $sFilePath) {
if (is_array($_mImport["items"][$sFileType])) {
$aData[$sFileType] = array_keys($_mImport["items"][$sFileType]);
}
@ -629,8 +636,8 @@ class cApiModule extends Item {
/**
* Imports a module package from a XML file Uses xmlparser and callbacks
*
* @param string $sFile Filename of data file (including path)
* @param array $aOptions Optional. An array of arrays specifying, how the items
* @param string $sFile Filename of data file (including path)
* @param array $aOptions Optional. An array of arrays specifying, how the items
* of the xml file will be imported. If specified, has to
* contain an array of this structure:
*
@ -645,27 +652,26 @@ class cApiModule extends Item {
*
* @return bool Returns true, if import has been successfully finished
*/
public function importPackage($sFile, $aOptions = []) {
$bStore = null;
public function importPackage($sFile, $aOptions = array()) {
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 (array_keys($this->_packageStructure) as $sFileType) {
foreach ($this->_packageStructure as $sFileType => $sFilePath) {
if (!is_array($aOptions["items"][$sFileType])) {
$aOptions["items"][$sFileType] = [];
$aOptions["items"][$sFileType] = array();
}
}
// Layouts
if (!is_array($aOptions["items"]["layouts"])) {
$aOptions["items"]["layouts"] = [];
$aOptions["items"]["layouts"] = array();
}
// Translations
if (!is_array($aOptions["translations"])) {
$aOptions["translations"] = [];
$aOptions["translations"] = array();
}
// Parse file
@ -692,7 +698,7 @@ class cApiModule extends Item {
createFile($sFileName, $sFilePath);
}
fileEdit($sFileName, $aContent["content"], $sFilePath);
} elseif ($aOptions["items"][$sFileType][clHtmlSpecialChars($sFileName)] == "append") {
} else if ($aOptions["items"][$sFileType][clHtmlSpecialChars($sFileName)] == "append") {
$sOriginalContent = getFileContent($sFileName, $sFilePath);
fileEdit($sFileName, $sOriginalContent . $aContent["content"], $sFilePath);
}
@ -731,13 +737,13 @@ class cApiModule extends Item {
// Translations
if (is_array($_mImport["translations"])) {
$cApiModuleTranslationCollection = new cApiModuleTranslationCollection();
$oTranslations = new cApiModuleTranslationCollection();
$iID = $this->get($this->primaryKey);
foreach (array_keys($_mImport["translations"]) as $sPackageLang) {
foreach ($_mImport["translations"] as $sPackageLang => $aTranslations) {
if (array_key_exists($sPackageLang, $aOptions["translations"])) {
foreach ($_mImport["translations"][$sPackageLang] as $sOriginal => $sTranslation) {
$cApiModuleTranslationCollection->create($iID, $aOptions["translations"][$sPackageLang], $sOriginal, $sTranslation);
$oTranslations->create($iID, $aOptions["translations"][$sPackageLang], $sOriginal, $sTranslation);
}
}
}
@ -751,33 +757,33 @@ class cApiModule extends Item {
/**
* Exports the specified module and attached files to a file
*
* @param string $sPackageFileName Filename to return
* @param bool $bReturn if false, the result is immediately sent to the browser
* @param string $sPackageFileName Filename to return
* @param bool $bReturn if false, the result is immediately sent to the browser
*/
public function exportPackage($sPackageFileName, $bReturn = false) {
global $cfgClient, $client;
cInclude("includes", "functions.file.php");
$xmlTree = new XmlTree('1.0', 'ISO-8859-1');
$oRoot = & $xmlTree->addRoot('modulepackage');
$oTree = new XmlTree('1.0', 'ISO-8859-1');
$oRoot = & $oTree->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 = [];
$aData = array();
$aData["repository_guid"] = "";
$aData["jsfiles"] = [];
$aData["tplfiles"] = [];
$aData["cssfiles"] = [];
$aData["layouts"] = [];
$aData["translations"] = [];
$aData["jsfiles"] = array();
$aData["tplfiles"] = array();
$aData["cssfiles"] = array();
$aData["layouts"] = array();
$aData["translations"] = array();
}
// Export basic module
$oNodeModule = &$oRoot->appendChild("module");
$oNodeModule = & $oRoot->appendChild("module");
$oNodeModule->appendChild("name", clHtmlSpecialChars($this->get("name")));
$oNodeModule->appendChild("description", clHtmlSpecialChars($this->get("description")));
$oNodeModule->appendChild("type", clHtmlSpecialChars($this->get("type")));
@ -787,25 +793,27 @@ class cApiModule extends Item {
// Export files (e.g. js, css, templates)
foreach ($this->_packageStructure As $sFileType => $sFilePath) {
$oNodeFiles = & $oRoot->appendChild($sFileType);
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));
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));
}
}
}
}
unset($sContent);
// Export layouts
$oNodeLayouts = &$oRoot->appendChild("layouts");
$oNodeLayouts = & $oRoot->appendChild("layouts");
$cApiLayoutCollection = new cApiLayoutCollection;
$cApiLayoutCollection->setWhere("idclient", $client);
$cApiLayoutCollection->query();
$oLayouts = new cApiLayoutCollection;
$oLayouts->setWhere("idclient", $client);
$oLayouts->query();
while ($oLayout = $cApiLayoutCollection->next()) {
while ($oLayout = $oLayouts->next()) {
if (in_array($oLayout->get($oLayout->primaryKey), $aData["layouts"])) {
$oNodeLayouts->appendChild("area", "layouts");
$oNodeLayouts->appendChild("name", clHtmlSpecialChars($oLayout->get("name")));
@ -814,23 +822,24 @@ class cApiModule extends Item {
}
}
unset($oLayout);
unset($cApiLayoutCollection);
unset($oLayouts);
// Export translations
$cApiLanguageCollection = new cApiLanguageCollection();
$cApiLanguageCollection->setOrder("idlang");
$cApiLanguageCollection->query();
$oLangs = new cApiLanguageCollection();
$oLangs->setOrder("idlang");
$oLangs->query();
if ($cApiLanguageCollection->count() > 0) {
if ($oLangs->count() > 0) {
$iIDMod = $this->get($this->primaryKey);
while ($oLang = $cApiLanguageCollection->next()) {
while ($oLang = $oLangs->next()) {
$iID = $oLang->get($oLang->primaryKey);
if (in_array($iID, $aData["translations"])) {
$oNodeTrans = &$oRoot->appendChild("translations");
$oNodeTrans = & $oRoot->appendChild("translations");
// This is nice, but it doesn't help so much,
// as this data is available too late on import ...
$oNodeTrans->setNodeAttribs(["origin-language-id" => $iID, "origin-language-name" => clHtmlSpecialChars($oLang->get("name"))]);
$oNodeTrans->setNodeAttribs(array("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")));
@ -840,24 +849,24 @@ class cApiModule extends Item {
$oTranslations->query();
while ($oTranslation = $oTranslations->next()) {
$oNodeString = &$oNodeTrans->appendChild("string");
$oNodeString = & $oNodeTrans->appendChild("string");
$oNodeString->appendChild("original", clHtmlSpecialChars($oTranslation->get("original")));
$oNodeString->appendChild("translation", clHtmlSpecialChars($oTranslation->get("translation")));
}
}
}
}
unset($cApiLanguageCollection);
unset($oLangs);
unset($oLang);
if ($bReturn == false) {
ob_end_clean();
header("Content-Type: text/xml");
header("Etag: " . md5(random_int(0, mt_getrandmax())));
header("Etag: " . md5(mt_rand()));
header("Content-Disposition: attachment;filename=\"$sPackageFileName\"");
$xmlTree->dump(false);
$oTree->dump(false);
} else {
return stripslashes($xmlTree->dump(true));
return stripslashes($oTree->dump(true));
}
}
@ -865,7 +874,7 @@ class cApiModule extends Item {
/**
* Overridden parent method for hooking dceModFileEdit
*
*
* @return void
*/
protected function _onLoad() {
@ -877,7 +886,7 @@ class cApiModule extends Item {
/**
* Use a PHP-file, if present, for module output
*
*
* @return boolean
*/
private function _setOutputFromPhpFile() {
@ -890,7 +899,7 @@ class cApiModule extends Item {
/**
* Use a PHP-file, if present, for module input
*
*
* @return boolean
*/
private function _setInputFromPhpFile() {
@ -903,7 +912,7 @@ class cApiModule extends Item {
}
private function _displayNoteFromFile($bIsOldPath = FALSE) {
if (property_exists($this, '_bNoted') && $this->_bNoted !== null && $this->_bNoted === true) {
if ($this->_bNoted === true) {
return;
}
global $frame, $area;
@ -912,22 +921,23 @@ class cApiModule extends Item {
if ($bIsOldPath) {
$sAddMess .= "<br>" . i18n("Using old CamelCase for name of modulefolder. You may lowercase the name for modulefolder");
}
$contenidoNotification = new Contenido_Notification();
$contenidoNotification->displayNotification('warning', i18n("Module uses Output- and/or InputFromFile. Editing and Saving may not be possible in backend.") . $sAddMess);
$oNote = new Contenido_Notification();
$oNote->displayNotification('warning', i18n("Module uses Output- and/or InputFromFile. Editing and Saving may not be possible in backend.") . $sAddMess);
$this->_bNoted = true;
}
}
/**
* read file and set an object field
*
* @param string $sFile
*
* @param string $sFile
* @param string $sField
* @return boolean
*/
private function _setFieldFromFile($sField, $sFile): bool {
private function _setFieldFromFile($sField, $sFile) {
$bIsOldPath = TRUE;
$sFile = strtolower($sFile);
if (!str_contains($sFile, $this->_aModFileEditConf['modPath'])) {
if (FALSE === strstr($sFile, $this->_aModFileEditConf['modPath'])) {
$sFile = $this->_aModFileEditConf['modPath'] . $sFile;
}
// check for new struct since CL 2.0
@ -972,12 +982,17 @@ class cApiModule extends Item {
}
public function isLoadedFromFile($sWhat = "all") {
return match ($sWhat) {
"all" => $this->_bOutputFromFile || $this->_bInputFromFile,
"output" => $this->_bOutputFromFile,
"input" => $this->_bInputFromFile,
default => false,
};
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;
}
}
/* End dceModFileEdit (c)2009-2012 www.dceonline.de */
@ -997,7 +1012,10 @@ class cApiModule extends Item {
private function _createModulePhpFiles() {
$sPath = $this->_sModPath . "php/";
$aFileTpl = ['output' => "<?php\n\n?>", 'input' => "?><?php\n\n?><?php"];
$aFileTpl = array(
'output' => "<?php\n\n?>",
'input' => "?><?php\n\n?><?php"
);
if (is_writable($sPath)) {
$sOutputFile = $sPath . $this->_sModAlias . "_output.php";
@ -1035,8 +1053,6 @@ class cApiModuleTranslationCollection extends ItemCollection {
protected $_error;
protected $f_obj;
/**
* Constructor Function
* @param none
@ -1053,8 +1069,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
$cApiModuleTranslation = new cApiModuleTranslation();
$sorg = $cApiModuleTranslation->_inFilter($original);
$mod = new cApiModuleTranslation();
$sorg = $mod->_inFilter($original);
$this->select("idmod = '$idmod' AND idlang = '$idlang' AND original = '$sorg'");
@ -1110,20 +1126,21 @@ class cApiModuleTranslationCollection extends ItemCollection {
public function import($idmod, $idlang, $file) {
global $_mImport;
$clXmlParser = new clXmlParser("ISO-8859-1");
$parser = new XmlParser("ISO-8859-1");
$clXmlParser->setEventHandlers(["/module/translation/string/original" => "cHandler_ItemName", "/module/translation/string/translation" => "cHandler_Translation"]);
$parser->setEventHandlers(array("/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 ($clXmlParser->parseFile($file)) {
if ($parser->parseFile($file)) {
foreach ($_mImport["translations"]["current"] as $sOriginal => $sTranslation) {
$this->create($idmod, $idlang, $sOriginal, $sTranslation);
}
return true;
} else {
$this->_error = $clXmlParser->error;
$this->_error = $parser->error;
return false;
}
}
@ -1137,20 +1154,21 @@ 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) {
$cApiLanguage = new cApiLanguage($idlang);
$langobj = new cApiLanguage($idlang);
#$langstring = $langobj->get("name") . ' ('.$idlang.')';
$cApiModuleTranslationCollection = new cApiModuleTranslationCollection;
$cApiModuleTranslationCollection->select("idmod = '$idmod' AND idlang='$idlang'");
$translations = new cApiModuleTranslationCollection;
$translations->select("idmod = '$idmod' AND idlang='$idlang'");
$xmlTree = new XmlTree('1.0', 'ISO-8859-1');
$root = &$xmlTree->addRoot('module');
$tree = new XmlTree('1.0', 'ISO-8859-1');
$root = & $tree->addRoot('module');
$translation = &$root->appendChild('translation');
$translation->setNodeAttribs(["origin-language-id" => $idlang, "origin-language-name" => $cApiLanguage->get("name")]);
$translation = & $root->appendChild('translation');
$translation->setNodeAttribs(array("origin-language-id" => $idlang,
"origin-language-name" => $langobj->get("name")));
while ($otranslation = $cApiModuleTranslationCollection->next()) {
while ($otranslation = $translations->next()) {
$string = &$translation->appendChild("string");
$string->appendChild("original", clHtmlSpecialChars($otranslation->get("original")));
@ -1159,11 +1177,11 @@ class cApiModuleTranslationCollection extends ItemCollection {
if ($return == false) {
header("Content-Type: text/xml");
header("Etag: " . md5(random_int(0, mt_getrandmax())));
header("Etag: " . md5(mt_rand()));
header("Content-Disposition: attachment;filename=\"$filename\"");
$xmlTree->dump(false);
$tree->dump(false);
} else {
return $xmlTree->dump(true);
return $tree->dump(true);
}
}

Datei anzeigen

@ -0,0 +1,46 @@
<?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) {
}
}
?>

Datei anzeigen

@ -0,0 +1,8 @@
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.

Datei anzeigen

@ -1,32 +1,51 @@
<?php
namespace ConLite\GenericDb\Driver\MySql;
/**
* 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');
}
use cCharacterConverter;
use ConLite\GenericDb\Driver\GenericDbDriver;
use Contenido_Security;
class gdbMySQL extends gdbDriver {
class GenericDbDriverMySql extends GenericDbDriver
{
public $_oItemClassInstance;
public $_sEncoding;
function buildJoinQuery($destinationTable, $destinationClass, $destinationPrimaryKey, $sourceClass, $primaryKey)
{
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 ["field" => $field, "table" => $tables, "join" => $join, "where" => $where];
return array("field" => $field, "table" => $tables, "join" => $join, "where" => $where);
}
function buildOperator($sField, $sOperator, $sRestriction)
{
function buildOperator($sField, $sOperator, $sRestriction) {
$sOperator = strtolower($sOperator);
$sWhereStatement = "";
@ -69,14 +88,14 @@ class GenericDbDriverMySql extends GenericDbDriver
$GLOBALS["_cCharTable"] = new cCharacterConverter;
}
$aliasSearch = [];
$aliasSearch = array();
$metaCharacters = ["*", "[", "]", "^", '$', "\\", "*", "'", '"', '+'];
$metaCharacters = array("*", "[", "]", "^", '$', "\\", "*", "'", '"', '+');
for ($i = 0; $i < strlen($sRestriction); $i++) {
for ($i = 0; $i < strlen($sRestriction); $i ++) {
$char = substr($sRestriction, $i, 1);
$aliases = [];
$aliases = array();
$aliases = array_merge($aliases, $GLOBALS["_cCharTable"]->fetchDiacriticCharactersForNormalizedChar($this->_sEncoding, $char));
$normalizedChars = $GLOBALS["_cCharTable"]->fetchNormalizedCharsForDiacriticCharacter($this->_sEncoding, $char);
@ -87,9 +106,9 @@ class GenericDbDriverMySql extends GenericDbDriver
$aliases = array_merge($aliases, $normalizedChars);
if ($aliases !== []) {
if (count($aliases) > 0) {
$aliases[] = $char;
$allAliases = [];
$allAliases = array();
foreach ($aliases as $alias) {
$alias1 = $this->_oItemClassInstance->_inFilter($alias);
@ -100,7 +119,8 @@ class GenericDbDriverMySql extends GenericDbDriver
$allAliases = array_unique($allAliases);
$aliasSearch[] = "(" . implode("|", $allAliases) . ")";
} else {
$addChars = [];
$addChars = array();
if (in_array($char, $metaCharacters)) {
@ -111,7 +131,11 @@ class GenericDbDriverMySql extends GenericDbDriver
$vChar = $this->_oItemClassInstance->_inFilter($char);
if ($char != $vChar) {
$addChars[] = in_array($vChar, $metaCharacters) ? "\\\\" . $vChar : $vChar;
if (in_array($vChar, $metaCharacters)) {
$addChars[] = "\\\\" . $vChar;
} else {
$addChars[] = $vChar;
}
}
}
@ -120,7 +144,7 @@ class GenericDbDriverMySql extends GenericDbDriver
}
$restriction = "'" . implode("", $aliasSearch) . "'";
$sWhereStatement = implode(" ", [$sField, "REGEXP", $restriction]);
$sWhereStatement = implode(" ", array($sField, "REGEXP", $restriction));
break;
case "fulltext":
@ -128,9 +152,9 @@ class GenericDbDriverMySql extends GenericDbDriver
break;
case "in":
if (is_array($sRestriction)) {
$items = [];
$items = array();
foreach ($sRestriction as $sRestrictionItem) {
foreach ($sRestriction as $key => $sRestrictionItem) {
$items[] = "'" . $this->_oItemClassInstance->_inFilter($sRestrictionItem) . "'";
}
@ -139,14 +163,14 @@ class GenericDbDriverMySql extends GenericDbDriver
$sRestriction = "'" . $sRestriction . "'";
}
$sWhereStatement = implode(" ", [$sField, "IN (", $sRestriction, ")"]);
$sWhereStatement = implode(" ", array($sField, "IN (", $sRestriction, ")"));
break;
case "notin":
if (is_array($sRestriction)) {
$items = [];
$items = array();
foreach ($sRestriction as $Restriction) {
$items[] = "'" . $this->_oItemClassInstance->_inFilter($Restriction) . "'";
foreach ($sRestriction as $key => $sRestrictionItem) {
$items[] = "'" . $this->_oItemClassInstance->_inFilter($sRestrictionItem) . "'";
}
$sRestriction = implode(", ", $items);
@ -154,15 +178,17 @@ class GenericDbDriverMySql extends GenericDbDriver
$sRestriction = "'" . $sRestriction . "'";
}
$sWhereStatement = implode(" ", [$sField, "NOT IN (", $sRestriction, ")"]);
$sWhereStatement = implode(" ", array($sField, "NOT IN (", $sRestriction, ")"));
break;
default :
$sRestriction = "'" . $this->_oItemClassInstance->_inFilter($sRestriction) . "'";
$sWhereStatement = implode(" ", [$sField, $sOperator, $sRestriction]);
$sWhereStatement = implode(" ", array($sField, $sOperator, $sRestriction));
}
return $sWhereStatement;
}
}
}
?>

Datei anzeigen

@ -0,0 +1,40 @@
<?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() {
}
}

Datei anzeigen

@ -0,0 +1,27 @@
<?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
}

Datei anzeigen

@ -1,16 +1,12 @@
<?php
namespace ConLite\GenericDb;
/**
*
*/
// security check
defined('CON_FRAMEWORK') or die('Illegal call');
use DB_ConLite;
use PropertyCollection;
abstract class ItemBaseAbstract
{
abstract class cItemBaseAbstract {
/**
* Database instance, contains the database object
@ -33,9 +29,9 @@ abstract class ItemBaseAbstract
/**
* Item cache instance
* @var ItemCache
* @var Contenido_ItemCache
*/
protected static ItemCache $_oCache;
protected static $_oCache;
/**
* GenericDB settings, see $cfg['sql']
@ -89,17 +85,18 @@ abstract class ItemBaseAbstract
* @var string
*/
protected $_className;
protected $_bDebug;
protected $_bLoaded;
/**
* 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 ItemException
* @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
*/
protected function __construct($sTable, $sPrimaryKey, $sClassName, $iLifetime = 10) {
global $cfg;
@ -108,17 +105,17 @@ abstract class ItemBaseAbstract
if ($sTable == '') {
$sMsg = "$sClassName: No table specified. Inherited classes *need* to set a table";
throw new ItemException($sMsg);
throw new Contenido_ItemException($sMsg);
} elseif ($sPrimaryKey == '') {
$sMsg = "No primary key specified. Inherited classes *need* to set a primary key";
throw new ItemException($sMsg);
throw new Contenido_ItemException($sMsg);
}
$this->_settings = $cfg['sql'];
// instanciate caching
$aCacheOpt = (isset($this->_settings['cache'])) ? $this->_settings['cache'] : array();
self::$_oCache = ItemCache::getInstance($sTable, $aCacheOpt);
self::$_oCache = cItemCache::getInstance($sTable, $aCacheOpt);
$this->table = $sTable;
$this->primaryKey = $sPrimaryKey;
@ -136,6 +133,28 @@ abstract class ItemBaseAbstract
public function escape($sString) {
return $this->db->escape($sString);
}
/**
* Checks if an object is loaded
* If it is true an object is loaded
* If it is false then no object is loaded and only load-functions are allowed to be used
* @return bool Whether an object has been loaded
*/
public function isLoaded() {
return (bool) $this->_bLoaded;
}
/**
* Sets loaded state of class
* If it is true an object is loaded
* If it is false then no object is loaded and only load-functions are allowed to be used
*
* @param bool $value
* Whether an object is loaded
*/
protected function _setLoaded($value) {
$this->_bLoaded = (bool) $value;
}
/**
* Returns the second database instance, usable to run additional statements
@ -163,4 +182,13 @@ abstract class ItemBaseAbstract
return $this->properties;
}
/**
* Resets class variables back to default
* This is handy in case a new item is tried to be loaded into this class instance.
*/
protected function _resetItem() {
$this->_setLoaded(false);
$this->properties = null;
$this->lasterror = '';
}
}

Datei anzeigen

@ -1,25 +1,30 @@
<?php
namespace ConLite\GenericDb;
/**
*
*/
// security check
defined('CON_FRAMEWORK') or die('Illegal call');
class ItemCache
{
class cItemCache {
/**
* List of self instances (Contenido_ItemCache)
* @var array
*/
protected static $_oInstances = [];
protected static $_oInstances = array();
/**
* Assoziative cache array
* @var array
*/
protected $_aItemsCache = [];
protected $_aItemsCache = array();
/**
* Table name for current instance
* @var string
*/
protected $_sTable = '';
/**
* Max number of items to cache
@ -36,17 +41,18 @@ class ItemCache
/**
* 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(protected $_sTable, array $aOptions = []) {
protected function __construct($sTable, array $aOptions = array()) {
$this->_sTable = $sTable;
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 = $aOptions['enable'];
$this->_bEnable = (bool) $aOptions['enable'];
}
if (isset($_GET['frame']) && is_numeric($_GET['frame'])) {
@ -56,6 +62,13 @@ class ItemCache
}
}
/**
* Prevent cloning
*/
protected function __clone() {
}
/**
* Returns item cache instance, creates it, if not done before.
* Works as a singleton for one specific table.
@ -65,7 +78,7 @@ class ItemCache
* - $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 = []) {
public static function getInstance($sTable, array $aOptions = array()) {
if (!isset(self::$_oInstances[$sTable])) {
self::$_oInstances[$sTable] = new self($sTable, $aOptions);
}
@ -83,8 +96,11 @@ class ItemCache
/**
* Returns existing entry from cache by it's id.
*
* @param mixed $mId
* @return array|null
*/
public function getItem(mixed $mId): ?array {
public function getItem($mId) {
if (!$this->_bEnable) {
return null;
}
@ -98,15 +114,19 @@ class ItemCache
/**
* Returns existing entry from cache by matching propery value.
*
* @param mixed $mProperty
* @param mixed $mValue
* @return array|null
*/
public function getItemByProperty(mixed $mProperty, mixed $mValue): ?array {
public function getItemByProperty($mProperty, $mValue) {
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]) && $this->_aItemsCache[$this->_iFrame] !== []) {
foreach ($this->_aItemsCache[$this->_iFrame] as $aEntry) {
if (is_array($this->_aItemsCache[$this->_iFrame]) && count($this->_aItemsCache[$this->_iFrame]) > 0) {
foreach ($this->_aItemsCache[$this->_iFrame] as $id => $aEntry) {
if (isset($aEntry[$mProperty]) && $aEntry[$mProperty] == $mValue) {
return $aEntry;
}
@ -119,23 +139,28 @@ class ItemCache
* 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): ?array {
public function getItemByProperties(array $aProperties) {
if (!$this->_bEnable) {
return null;
}
// loop thru all cached entries and try to find a entry by it's property
foreach ($this->_aItemsCache as $_aItemCache) {
foreach ($this->_aItemsCache as $id => $aEntry) {
$mFound = null;
foreach ($aProperties as $key => $value) {
if (isset($_aItemCache[$key]) && $_aItemCache[$key] == $value) {
$mFound = true;
if (isset($aEntry[$key]) && $aEntry[$key] == $value) {
if (null === $mFound) {
$mFound = true;
}
} else {
$mFound = false;
break;
}
return $_aItemCache;
if (true === $mFound) {
return $aEntry;
}
}
}
return null;
@ -144,10 +169,11 @@ class ItemCache
/**
* Adds passed item data to internal cache
*
* @param mixed $mId
* @param array $aData Usually the recordset
* @return void
*/
public function addItem(mixed $mId, array $aData) {
public function addItem($mId, array $aData) {
if (!$this->_bEnable) {
return null;
}
@ -155,7 +181,7 @@ class ItemCache
if (isset($this->_aItemsCache[$this->_iFrame])) {
$aTmpItemsArray = $this->_aItemsCache[$this->_iFrame];
if ($this->_iMaxItemsToCache == (is_countable($aTmpItemsArray) ? count($aTmpItemsArray) : 0)) {
if ($this->_iMaxItemsToCache == count($aTmpItemsArray)) {
// we have reached the maximum number of cached items, remove first entry
$firstEntryKey = array_shift($aTmpItemsArray);
if (is_array($firstEntryKey))
@ -171,9 +197,10 @@ class ItemCache
/**
* Removes existing cache entry by it's key
*
* @param mixed $mId
* @return void
*/
public function removeItem(mixed $mId) {
public function removeItem($mId) {
if (!$this->_bEnable) {
return null;
}
@ -184,4 +211,4 @@ class ItemCache
}
}
}
}

Datei anzeigen

@ -39,21 +39,35 @@ class cGuiFileList {
public function renderList($sTpl = null, $bReturn = false) {
global $sess, $area;
$sList = '<ul id="treeData" style="display: none;">' . "\n";
foreach ($this->_aDirItems as $key => $item) {
if (is_array($item)) {
$sList .= $this->_getSubItems($key, $item, $this->_sPath);
} else {
$sAddClass = (is_writable($this->_sPath . $item)) ? '' : ' notwritable';
$sList .= '<li class="file' . $sAddClass . '" data-filepath="' . $item . '">' . $item . '</li>' . "\n";
$sList .= '<li><a href="#">Root</a><ul>';
if (!empty($this->_aDirItems)) {
foreach ($this->_aDirItems as $key => $item) {
if (is_array($item)) {
$sList .= $this->_getSubItems($key, $item, $this->_sPath);
} else {
$sAddClass = (is_writable($this->_sPath . $item)) ? '' : ' notwritable';
$sList .= '<li class="file' . $sAddClass . '" data-filepath="' . $item . '">' . $item . '</li>' . "\n";
}
}
} else {
$sList .= '<li class="dir_empty" data-icon="unknown.gif">' . i18n("No files in directory.") . '</li>' . "\n";
}
$sList .= '</ul>' . "\n";
$sList .= '</ul></li></ul>' . "\n";
$this->_oTpl->set('s', 'item_list', $sList);
$this->_oTpl->set('s', 'multilinkf1', $sess->url("main.php?area=$area&frame=1"));
$this->_oTpl->set('s', 'multilinkf2', $sess->url("main.php?area=$area&frame=2"));
$this->_oTpl->set('s', 'multilinkf3', $sess->url("main.php?area=$area&frame=3"));
$this->_oTpl->set('s', 'multilinkf4', $sess->url("main.php?area=$area&frame=4"));
$this->_oTpl->set('s', 'multilink1', $sess->url("main.php?area=$area&frame=3&file=\${file}"));
$this->_oTpl->set('s', 'multilink2', $sess->url("main.php?area=$area&frame=4&action=js_edit&file=\${file}&tmp_file=\${file}"));
$this->_oTpl->set('s', 'multilink3', $sess->url("main.php?area=$area&frame=1&file=\${file}"));
$this->_oTpl->set('s', 'multilink4', $sess->url("main.php?area=$area&frame=2&action=file_delete&delfile=\${file}"));
$this->_oTpl->generate(cRegistry::getConfigValue('path', 'contenido') . cRegistry::getConfigValue('path', 'templates') . "html5/file_list.html", $bReturn);
}
@ -80,7 +94,7 @@ class cGuiFileList {
protected function _assetsMap($source_dir, $directory_depth = 0, $hidden = false) {
if ($fp = @opendir($source_dir)) {
$filedata = array();
$new_depth = $directory_depth - 1;
$new_depth = $directory_depth;
$source_dir = rtrim($source_dir, '/') . '/';
while (FALSE !== ($file = readdir($fp))) {

Datei anzeigen

@ -1,15 +1,563 @@
<?php
/**
*
*/
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
class cGuiPage {
protected $_pageName;
protected $_pluginName;
protected $_pageTemplate;
protected $_pageBase;
protected $_contentTemplate;
protected $_scripts;
protected $_uniqueScripts;
protected $_styles;
protected $_subnav;
protected $_markScript;
protected $_error;
protected $_warning;
protected $_info;
protected $_ok;
protected $_abort;
protected $_objects;
protected $_metaTags;
protected $_bodyClassNames;
protected $_filesDirectory;
protected $_skipTemplateCheck = false;
public function __construct($sPageName, $sPluginName = '', $sSubMenu = '') {
protected $_bHTML5 = false;
public function __construct($pageName, $pluginName = '', $subMenu = '') {
$this->_pageName = $pageName;
$this->_pluginName = $pluginName;
$this->_pageTemplate = new cTemplate();
$this->_contentTemplate = new cTemplate();
$this->_scripts = [];
$this->_uniqueScripts = [];
$this->_styles = [];
$this->_subnav = '';
$this->_markScript = '';
$this->_error = '';
$this->_warning = '';
$this->_info = '';
$this->_abort = false;
$this->_objects = [];
$this->_metaTags = [];
$this->_bodyClassNames = [];
$lang = cRegistry::getLanguageId();
$cfg = cRegistry::getConfig();
// Try to extract the current CONTENIDO language
$clang = new cApiLanguage($lang);
if ($clang->isLoaded()) {
$this->setEncoding($clang->get('encoding'));
}
// use default page base
$this->setPageBase();
$this->_pageTemplate->set('s', 'SUBMENU', $subMenu);
$this->_pageTemplate->set('s', 'PAGENAME', $pageName);
$pageid = str_replace('.', '_', $pageName);
$this->_pageTemplate->set('s', 'PAGENAME', $pageName);
$this->_pageTemplate->set('s', 'PAGEID', $pageid);
$this->addBodyClassName('page_generic');
$this->addBodyClassName('page_' . $pageid);
if ($pluginName != '') {
$this->_filesDirectory = '';
$scriptDir = cRegistry::getBackendPath() . $cfg['path']['plugins'] . $pluginName . '/' . $cfg['path']['scripts'];
$styleDir = cRegistry::getBackendPath() . $cfg['path']['plugins'] . $pluginName . '/' . $cfg['path']['styles'];
} else {
$this->_filesDirectory = 'includes/';
$scriptDir = $cfg['path']['scripts_includes'];
$styleDir = $cfg['path']['styles_includes'];
}
if (cFileHandler::exists($styleDir . $pageName . '.css')) {
$this->addStyle($this->_filesDirectory . $pageName . '.css');
}
/* @var $stylefile SplFileInfo */
if (cFileHandler::exists($styleDir)) {
foreach (new DirectoryIterator($styleDir) as $stylefile) {
if (cString::endsWith($stylefile->getFilename(), '.' . $pageName . '.css')) {
$this->addStyle($this->_filesDirectory . $stylefile->getFilename());
}
}
}
if (cFileHandler::exists($scriptDir . $pageName . '.js')) {
$this->addScript($this->_filesDirectory . $pageName . '.js');
}
/* @var $scriptfile SplFileInfo */
if (cFileHandler::exists($scriptDir)) {
foreach (new DirectoryIterator($scriptDir) as $scriptfile) {
if (cString::endsWith($scriptfile->getFilename(), '.' . $pageName . '.js')) {
$this->addScript($this->_filesDirectory . $scriptfile->getFilename());
}
}
}
}
}
public function addScript($script) {
global $currentuser;
$script = trim($script);
if (empty($script)) {
return;
}
$perm = cRegistry::getPerm();
$cfg = cRegistry::getConfig();
$backendUrl = cRegistry::getBackendUrl();
$backendPath = cRegistry::getBackendPath();
$filePathName = $this->_getRealFilePathName($script);
// Warning message for not existing resources
if ($perm->isSysadmin($currentuser) && cString::findFirstPos(trim($script), '<script') === false &&
((!empty($this->_pluginName) && !cFileHandler::exists($backendPath . $cfg['path']['plugins'] . $this->_pluginName . '/' . $cfg['path']['scripts'] . $script)) &&
(!cFileHandler::exists($backendPath . $cfg['path']['scripts'] . $filePathName)))) {
$this->displayWarning(i18n("The requested resource") . " <strong>" . $filePathName . "</strong> " . i18n("was not found"));
}
if (cString::findFirstPos(trim($script), 'http') === 0 || cString::findFirstPos(trim($script), '<script') === 0 || cString::findFirstPos(trim($script), '//') === 0) {
// the given script path is absolute
if (!in_array($script, $this->_scripts)) {
$this->_scripts[] = $script;
}
} else if (!empty($this->_pluginName) && cFileHandler::exists($backendPath . $cfg['path']['plugins'] . $this->_pluginName . '/' . $cfg['path']['scripts'] . $filePathName)) {
// the given script path is relative to the plugin scripts folder
$fullPath = $backendUrl . $cfg['path']['plugins'] . $this->_pluginName . '/' . $cfg['path']['scripts'] . $script;
if (!in_array($fullPath, $this->_scripts)) {
$this->_scripts[] = $fullPath;
}
} else if (cFileHandler::exists($backendPath . $cfg['path']['scripts'] . $filePathName)) {
// the given script path is relative to the CONTENIDO scripts folder
$fullPath = $backendUrl . $cfg['path']['scripts'] . $script;
if (!in_array($fullPath, $this->_scripts)) {
$this->_scripts[] = $fullPath;
}
}
}
public function addStyle($stylesheet) {
global $currentuser;
$stylesheet = trim($stylesheet);
if (empty($stylesheet)) {
return;
}
$perm = cRegistry::getPerm();
$cfg = cRegistry::getConfig();
$backendUrl = cRegistry::getBackendUrl();
$backendPath = cRegistry::getBackendPath();
$filePathName = $this->_getRealFilePathName($stylesheet);
// Warning message for not existing resources
if ($perm->isSysadmin($currentuser) && ((!empty($this->_pluginName) && !cFileHandler::exists($backendPath . $cfg['path']['plugins'] . $this->_pluginName . '/' . $cfg['path']['styles'] . $stylesheet))) ||
(empty($this->_pluginName) && !cFileHandler::exists($backendPath . $cfg['path']['styles'] . $filePathName))) {
$this->displayWarning(i18n("The requested resource") . " <strong>" . $filePathName . "</strong> " . i18n("was not found"));
}
if (cString::findFirstPos($stylesheet, 'http') === 0 || cString::findFirstPos($stylesheet, '//') === 0) {
// the given stylesheet path is absolute
if (!in_array($stylesheet, $this->_styles)) {
$this->_styles[] = $stylesheet;
}
} else if (!empty($this->_pluginName) && cFileHandler::exists($backendPath . $cfg['path']['plugins'] . $this->_pluginName . '/' . $cfg['path']['styles'] . $filePathName)) {
// the given stylesheet path is relative to the plugin stylesheets
// folder
$fullPath = $backendUrl . $cfg['path']['plugins'] . $this->_pluginName . '/' . $cfg['path']['styles'] . $stylesheet;
if (!in_array($fullPath, $this->_styles)) {
$this->_styles[] = $fullPath;
}
} else if (cFileHandler::exists($backendPath . $cfg['path']['styles'] . $filePathName)) {
// the given stylesheet path is relative to the CONTENIDO
// stylesheets folder
$fullPath = $backendUrl . $cfg['path']['styles'] . $stylesheet;
if (!in_array($fullPath, $this->_styles)) {
$this->_styles[] = $fullPath;
}
}
}
public function addMeta(array $meta) {
$allowedAttributes = [
'charset',
'content',
'http-equiv',
'name',
'itemprop'
];
foreach ($meta as $key => $value) {
if (!in_array($key, $allowedAttributes)) {
throw new cInvalidArgumentException('Unallowed attribute for meta tag given - meta tag will be ignored!');
}
}
$this->_metaTags[] = $meta;
}
public function addBodyClassName($className) {
if (!in_array($className, $this->_bodyClassNames)) {
$this->_bodyClassNames[] = $className;
}
}
public function setSubnav($additional = '', $aarea = '') {
$area = cRegistry::getArea();
$sess = cRegistry::getSession();
if ($aarea == '') {
$aarea = $area;
}
$this->_subnav = '
<script type="text/javascript">
Con.getFrame("right_top").location.href = "' . $sess->url("main.php?area={$aarea}&frame=3&{$additional}") . '";
</script>
';
}
public function setReload(array $parameters = []) {
$reloadParameters = count($parameters) > 0 ? json_encode($parameters) : '';
$this->_uniqueScripts['left_bottom'] = '
<script type="text/javascript">
(function(Con, $) {
Con.FrameLeftBottom.reload(' . $reloadParameters . ');
})(Con, Con.$);
</script>
';
}
public function reloadFrame($frameName, $updatedParameters = null) {
if (is_array($updatedParameters)) {
$reloadParameters = count($updatedParameters) > 0 ? json_encode($updatedParameters) : '{}';
$this->_uniqueScripts[$frameName] = '
<script type="text/javascript">
(function(Con, $) {
var frame = Con.getFrame("' . $frameName . '");
if (frame) {
frame.location.href = Con.UtilUrl.replaceParams(frame.location.href, ' . $reloadParameters . ');
}
})(Con, Con.$);
</script>
';
} else {
$this->_uniqueScripts[$frameName] = '
<script type="text/javascript">
(function(Con, $) {
var frame = Con.getFrame("' . $frameName . '");
if (frame) {
frame.location.href = "' . $updatedParameters .'";
}
})(Con, Con.$);
</script>
';
}
}
public function reloadLeftTopFrame($updatedParameters = null) {
if (is_array($updatedParameters) && !isset($updatedParameters['frame'])) {
$updatedParameters['frame'] = 1;
}
$this->reloadFrame('left_top', $updatedParameters);
}
public function reloadLeftBottomFrame($updatedParameters = null) {
if (is_array($updatedParameters) && !isset($updatedParameters['frame'])) {
$updatedParameters['frame'] = 2;
}
$this->reloadFrame('left_bottom', $updatedParameters);
}
public function reloadRightTopFrame($updatedParameters = null) {
if (is_array($updatedParameters) && !isset($updatedParameters['frame'])) {
$updatedParameters['frame'] = 3;
}
$this->reloadFrame('right_top', $updatedParameters);
}
public function reloadRightBottomFrame($updatedParameters = null) {
if (is_array($updatedParameters) && !isset($updatedParameters['frame'])) {
$updatedParameters['frame'] = 4;
}
$this->reloadFrame('right_bottom', $updatedParameters);
}
public function setMarkScript($item) {
$this->_markScript = markSubMenuItem($item, true);
}
public function setEncoding($encoding) {
if (empty($encoding)) {
return;
}
$this->_metaTags[] = [
'http-equiv' => 'Content-type',
'content' => 'text/html;charset=' . $encoding
];
}
public function set($type, $key, $value) {
$this->_contentTemplate->set($type, $key, $value);
}
public function setPageBase($filename = '') {
$sFolder = ($this->_bHTML5)?'html5/':'';
if ('' === $filename) {
$cfg = cRegistry::getConfig();
$this->_pageBase = $cfg['path']['templates']. $sFolder . $cfg['templates']['generic_page'];
} else {
$this->_pageBase = $sFolder.$filename;
}
}
public function next() {
$this->_contentTemplate->next();
}
public function abortRendering() {
$this->_abort = true;
}
public function displayCriticalError($msg) {
$this->_error = $msg;
$this->_abort = true;
}
public function displayError($msg) {
$this->_error .= $msg . '<br>';
}
public function displayWarning($msg) {
$this->_warning .= $msg . '<br>';
}
public function displayInfo($msg) {
$this->_info .= $msg . '<br>';
}
public function displayOk($msg) {
$this->_ok .= $msg . '<br>';
}
public function setContent($objects) {
if (!is_array($objects)) {
$objects = [
$objects
];
}
$this->_objects = $objects;
}
public function appendContent($objects) {
if (!is_array($objects)) {
$this->_objects[] = $objects;
} else {
$this->_objects = array_merge($this->_objects, $objects);
}
}
public function render($template = NULL, $return = false) {
if ($template == NULL) {
$template = $this->_contentTemplate;
}
// Render some parts like meta tags, scripts, styles, etc...
$this->_renderMetaTags();
$this->_renderScripts();
$this->_renderStyles();
// Set body class attribute values
$this->_pageTemplate->set('s', 'PAGECLASS', implode(' ', $this->_bodyClassNames));
// Get all messages for the content
$text = $this->_renderContentMessages();
if (cString::getStringLength(trim($text)) > 0) {
$this->_skipTemplateCheck = true;
}
if (!$this->_abort) {
if (count($this->_objects) == 0) {
$output = $this->_renderTemplate($template);
} else {
$output = $this->_renderObjects();
}
$this->_pageTemplate->set('s', 'CONTENT', $text . $output);
} else {
$this->_pageTemplate->set('s', 'CONTENT', $text);
}
return $this->_pageTemplate->generate($this->_pageBase, $return);
}
protected function _renderMetaTags() {
// render the meta tags
// NB! We don't produce xhtml in the backend
// $produceXhtml = getEffectiveSetting('generator', 'xhtml', 'false');
$produceXhtml = false;
$meta = '';
foreach ($this->_metaTags as $metaTag) {
$tag = '<meta';
foreach ($metaTag as $key => $value) {
$tag .= ' ' . $key . '="' . $value . '"';
}
if ($produceXhtml) {
$tag .= ' /';
}
$tag .= ">\n";
$meta .= $tag;
}
if (!empty($meta)) {
$this->_pageTemplate->set('s', 'META', $meta);
} else {
$this->_pageTemplate->set('s', 'META', '');
}
}
protected function _renderScripts() {
$scripts = $this->_subnav . "\n" . $this->_markScript . "\n";
$scripts .= implode("\n", $this->_uniqueScripts);
foreach ($this->_scripts as $script) {
if (cString::findFirstPos($script, 'http') === 0 || cString::findFirstPos($script, '//') === 0) {
$scripts .= '<script type="text/javascript" src="' . $script . '"></script>' . "\n";
} else if (cString::findFirstPos($script, '<script') === false) {
$scripts .= '<script type="text/javascript" src="scripts/' . $script . '"></script>' . "\n";
} else {
$scripts .= $script;
}
}
$this->_pageTemplate->set('s', 'SCRIPTS', $scripts);
}
protected function _renderStyles() {
$styles = '';
foreach ($this->_styles as $style) {
if (cString::findFirstPos($style, 'http') === 0 || cString::findFirstPos($style, '//') === 0) {
$styles .= '<link href="' . $style . '" type="text/css" rel="stylesheet">' . "\n";
} else {
$styles .= '<link href="styles/' . $style . '" type="text/css" rel="stylesheet">' . "\n";
}
}
$this->_pageTemplate->set('s', 'STYLES', $styles);
}
protected function _renderContentMessages() {
global $notification;
// Get messages from cRegistry
$okMessages = cRegistry::getOkMessages();
foreach ($okMessages as $message) {
$this->displayOk($message);
}
$infoMessages = cRegistry::getInfoMessages();
foreach ($infoMessages as $message) {
$this->displayInfo($message);
}
$errorMessages = cRegistry::getErrorMessages();
foreach ($errorMessages as $message) {
$this->displayError($message);
}
$warningMessages = cRegistry::getWarningMessages();
foreach ($warningMessages as $message) {
$this->displayWarning($message);
}
$text = '';
if ($this->_ok != '') {
$text .= $notification->returnNotification('ok', $this->_ok) . '<br>';
}
if ($this->_info != '') {
$text .= $notification->returnNotification('info', $this->_info) . '<br>';
}
if ($this->_warning != '') {
$text .= $notification->returnNotification('warning', $this->_warning) . '<br>';
}
if ($this->_error != '') {
$text .= $notification->returnNotification('error', $this->_error) . '<br>';
}
return $text;
}
protected function _renderObjects() {
$output = '';
foreach ($this->_objects as $obj) {
if (is_string($obj)) {
$output .= $obj;
}
if (!method_exists($obj, 'render')) {
continue;
}
// Ridiculous workaround because some objects return
// code if the parameter is true and some return the
// code if the parameter is false.
$oldOutput = $output;
// We don't want any code outside the body (in case the
// object outputs directly we will catch this output).
ob_start();
$output .= $obj->render(false);
// We get the code either directly or via the output
$output .= ob_get_contents();
if ($oldOutput == $output) {
cWarning(__FILE__, __LINE__, "Rendering this object (" . print_r($obj, true) . ") doesn't seem to have any effect.");
}
ob_end_clean();
}
return $output;
}
protected function _renderTemplate($template) {
global $currentuser, $notification;
$perm = cRegistry::getPerm();
$cfg = cRegistry::getConfig();
if ($this->_pluginName == '') {
$sHtml5 = ($this->_bHTML5)?'html5/':'';
$file = $cfg['path']['templates'] . $sHtml5 . 'template.' . $this->_pageName . '.html';
} else {
$file = $cfg['path']['plugins'] . $this->_pluginName . '/templates/template.' . $this->_pageName . '.html';
}
$output = '';
// Warning message for not existing resources
if (!$this->_skipTemplateCheck && $perm->isSysadmin($currentuser) && !cFileHandler::exists($file)) {
$output .= $notification->returnNotification('warning', i18n("The requested resource") . " <strong>template." . $this->_pageName . ".html</strong> " . i18n("was not found")) . '<br>';
}
if (cFileHandler::exists($file)) {
$output .= $template->generate($file, true);
} else {
$output .= '';
}
return $output;
}
protected function _getRealFilePathName($file) {
$tmp = explode('?', $file);
return $tmp[0];
}
function __destruct() {
$this->_bHTML5 = false;
}
}

Datei anzeigen

@ -0,0 +1,287 @@
<?php
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
class cGuiSourceEditor extends cGuiPage {
protected $_filename;
protected $_versionfilename;
protected $_filepath;
protected $_filetype;
protected $_codeMirror;
protected $_readOnly;
protected $_versioning;
public function __construct($filename, $versioning = true, $filetype = '', $filepath = '') {
global $belang, $cfgClient;
$cfg = cRegistry::getConfig();
$client = cRegistry::getClientId();
$perm = cRegistry::getPerm();
$area = cRegistry::getArea();
$action = cRegistry::getAction();
// call parent constructor
$this->_bHTML5 = true;
parent::__construct("generic_source_editor");
// check permissions
if (!$perm->have_perm_area_action($area, $action)) {
$this->displayCriticalError(i18n('Permission denied'));
}
// display empty page if no client is selected
if (!(int) $client > 0) {
$this->abortRendering();
}
// determine the filetype and path by using the area
if ($filetype == '') {
switch($_REQUEST['area']) {
case 'style':
$filepath = $cfgClient[$client]['css']['path'] . $filename;
$filetype = 'css';
break;
case 'js':
$filepath = $cfgClient[$client]['js']['path'] . $filename;
$filetype = 'js';
break;
case 'htmltpl':
$filepath = $cfgClient[$client]['tpl']['path'] . $filename;
$filetype = 'html';
break;
}
}
// assign variables
$this->_filetype = $filetype;
$this->_filepath = $filepath;
$this->_readOnly = (getEffectiveSetting("client", "readonly", "false") == "true");
if($this->_readOnly) {
cRegistry::addWarningMessage(i18n("This area is read only! The administrator disabled edits!"));
}
$this->_filename = $filename;
// include the class and create the codemirror instance
//cInclude('external', 'codemirror/class.codemirror.php');
//$this->_codeMirror = new CodeMirror('code', $this->_filetype, cString::getPartOfString(cString::toLowerCase($belang), 0, 2), true, $cfg, !$this->_readOnly);
// include the class and create the codemirror instance
cInclude('external', 'edit_area/class.edit_area.php');
$this->_codeMirror = new EditArea('code', $this->_filetype, cString::getPartOfString(cString::toLowerCase($belang), 0, 2), true, $cfg, !$this->_readOnly);
$this->_versioning = $versioning;
// update the edited file by using the super global _REQUEST
$this->update($_REQUEST);
}
protected function update($req) {
global $cfgClient;
$cfg = cRegistry::getConfig();
$client = cRegistry::getClientId();
$db = cRegistry::getDb();
$frame = cRegistry::getFrame();
$perm = cRegistry::getPerm();
$area = cRegistry::getArea();
$action = cRegistry::getAction();
// check permissions
if (!$perm->have_perm_area_action($area, $action)) {
$this->displayCriticalError(i18n('Permission denied'));
}
// if read only is activated or no data has been sent, skip the update step
if( ($this->_readOnly || ($req['status'] != 'send')) && $req['delfile'] == '') {
if($req['action'] == '') {
$this->abortRendering();
}
return;
}
// if magic quotes are on, strip slashes from the array
if(ini_get('magic_quotes_gpc')) {
foreach($req as $key => $value) {
$req[$key] = stripslashes($value);
}
}
// determine the file type for the file information table
$dbFileType = '';
switch($req['area']) {
case 'style':
$dbFileType = 'css';
break;
case 'js':
$dbFileType = 'js';
break;
case 'htmltpl':
$dbFileType = 'templates';
break;
}
// delete the specified file
if ($req['delfile'] != '') {
// check if it exists
if (cFileHandler::exists($this->_filepath . $req['delfile'])) {
// load information
$fileInfos = new cApiFileInformationCollection();
$fileInfos->select('filename = \'' . $req['delfile'] . '\'');
$fileInfo = $fileInfos->next();
// if there is information and if there are versioning files, delete them
if ($fileInfo != null) {
$idsfi = $fileInfo->get('idsfi');
if (cSecurity::isInteger($idsfi) && is_dir($cfgClient[$client]['version']['path'] . "$dbFileType/$idsfi")) {
cDirHandler::recursiveRmdir($cfgClient[$client]['version']['path'] . "$dbFileType/$idsfi");
}
}
// remove the file
cFileHandler::remove($this->_filepath . $req['delfile']);
// remove the file information
$fileInfos->removeFileInformation(array(
'filename' => $req['delfile']
));
// display the information and reload the frame
$this->displayOk(i18n('File deleted successfully!'));
$this->abortRendering();
$this->reloadLeftBottomFrame(['file' => null]);
}
return;
}
// Set version filename
$this->_versionfilename = $this->_filename;
// if the filename is empty, display an empty editor and create a new file
if (is_dir($this->_filepath) && cFileHandler::writeable($this->_filepath)) {
// validate the file name
if (!cFileHandler::validateFilename($req['file'], false)) {
$this->displayError(i18n('Not a valid filename!'));
return;
}
// check if the file exists already
if (cFileHandler::exists($this->_filepath . '/' . $req['file'])) {
$this->displayError(i18n('A file with this name exists already'));
return;
}
// set the variables and create the file. Reload frames
$this->_filepath = $this->_filepath . '/' . $req['file'];
$this->_filename = $req['file'];
cFileHandler::write($this->_filepath, '');
}
// save the old code and the old name
$oldCode = cFileHandler::read($this->_filepath);
$oldName = $this->_filename;
// load the file information and update the description
$fileInfos = new cApiFileInformationCollection();
$fileInfos->select('filename = \'' . $this->_filename . '\'');
$fileInfo = $fileInfos->next();
$oldDesc = '';
if ($fileInfo == null) {
// file information does not exist yet. Create the row
$fileInfo = $fileInfos->create($dbFileType, $this->_filename, $req['description']);
} else {
$oldDesc = $fileInfo->get('description');
if ($oldDesc != $req['description']) {
$fileInfo->set('description', $req['description']);
}
}
// rename the file
if ($req['file'] != $this->_filename) {
// validate the file name
if (!cFileHandler::validateFilename($req['file'], false)) {
$this->displayError(i18n('Not a valid filename!'));
} else {
// check if a file with that name exists already
if (!cFileHandler::exists(dirname($this->_filepath) . '/' . $req['file'])) {
// rename the file and set the variables accordingly
cFileHandler::rename($this->_filepath, $req['file']);
$this->_filepath = dirname($this->_filepath) . '/' . $req['file'];
$this->_filename = $req['file'];
// update the file information
$fileInfo->set('filename', $req['file']);
} else {
$this->displayError(i18n('Couldn\'t rename file. Does it exist already?'));
return;
}
}
}
// if the versioning should be updated and the code changed, create a versioning instance and update it
if ($this->_versioning && $oldCode != $req['code']) {
$fileInfoArray = $fileInfos->getFileInformation($this->_versionfilename, $dbFileType);
$oVersion = new cVersionFile($fileInfo->get('idsfi'), $fileInfoArray, $req['file'], $dbFileType, $cfg, $cfgClient, $db, $client, $area, $frame, $this->_versionfilename);
// Create new Layout Version in cms/version/css/ folder
$oVersion->createNewVersion();
}
// write the code changes and display an error message or success message
if (cFileHandler::write($this->_filepath, $req['code'])) {
// store the file information
$fileInfo->store();
$this->displayOk(i18n('Changes saved successfully!'));
} else {
$this->displayError(i18n('Couldn\'t save the changes! Check the file system permissions.'));
}
}
public function render($template = NULL, $return = false) {
$cfg = cRegistry::getConfig();
$area = cRegistry::getArea();
$action = cRegistry::getAction();
// load the file information
$fileInfos = new cApiFileInformationCollection();
$fileInfos->select('filename = \'' . $this->_filename . '\'');
$fileInfo = $fileInfos->next();
$desc = '';
if ($fileInfo != null) {
$desc = $fileInfo->get('description');
}
// assign description
$this->set('s', 'DESCRIPTION', $desc);
// assign the codemirror script, and other variables
$this->set('s', 'CODEMIRROR_SCRIPT', $this->_codeMirror->renderScript());
$this->set('s', 'AREA', $area);
$this->set('s', 'ACTION', $action);
$this->set('s', 'FILENAME', $this->_filename);
if (cFileHandler::readable($this->_filepath) && $this->_filename != '') {
$this->set('s', 'SOURCE', conHtmlentities(cFileHandler::read($this->_filepath)));
} else {
$this->set('s', 'SOURCE', '');
}
if ($this->_readOnly) {
// if the read only mode is activated, display a greyed out icon
$this->set('s', 'SAVE_BUTTON_IMAGE', $cfg['path']['images'] . 'but_ok_off.gif');
$this->set('s', 'SAVE_BUTTON_DESC', i18n('The administratos has disabled edits'));
} else {
$this->set('s', 'SAVE_BUTTON_IMAGE', $cfg['path']['images'] . 'but_ok.gif');
$this->set('s', 'SAVE_BUTTON_DESC', i18n('Save changes'));
}
if ($this->_filename) {
$this->reloadRightTopFrame(['file' => $this->_filename]);
$this->reloadLeftBottomFrame(['file' => $this->_filename]);
} else {
$this->reloadLeftBottomFrame(['file' => null]);
}
// call the render method of cGuiPage
parent::render();
}
}

Datei anzeigen

@ -0,0 +1,393 @@
<?php
/**
* This file contains the log class.
*
* @package Core
* @subpackage Log
* @version SVN Revision $Rev$
*
* @author Dominik Ziegler
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
/**
* This class contains the main functionalities for the logging in CONTENIDO.
*
* Examples:
*
* $writer = cLogWriter::factory("File", array('destination' => 'contenido.log'));
* $log = new cLog($writer);
*
* $log->addPriority("CONTENIDO", 10);
* $log->log("Contenido Log Message.", "CONTENIDO");
* $log->contenido("Same log entry in short notation.");
* $log->removePriority("CONTENIDO");
*
* $log->emerg("System down.");
*
* $log->log('Notice Log Message', cLog::NOTICE);
*
* $log->buffer('Buffered Log Message', cLog::WARN);
* $log->commit();
*
* @package Core
* @subpackage Log
*/
class cLog {
/**
* @var int logging level
*/
const EMERG = 0;
/**
* @var int logging level
*/
const ALERT = 1;
/**
* @var int logging level
*/
const CRIT = 2;
/**
* @var int logging level
*/
const ERR = 3;
/**
* @var int logging level
*/
const WARN = 4;
/**
* @var int logging level
*/
const NOTICE = 5;
/**
* @var int logging level
*/
const INFO = 6;
/**
* @var int logging level
*/
const DEBUG = 7;
/**
* @var cLogWriter Contains the local log writer instance.
*/
protected $_writer;
/**
* @var array Contains all shortcut handlers
*/
protected $_shortcutHandlers = array();
/**
* @var array Contains all available priorities
*/
protected $_priorities = array();
/**
* @var array Contains all default priorities
*/
protected $_defaultPriorities = array();
/**
* @var array Contains all buffered messages
*/
protected $_buffer = array();
/**
* Creates a new instance of the CONTENIDO Log mechanism.
*
* The log format interface of cLog is capable of being extended by subclasses. See the note about
* the log shortcuts below.
*
*
* About Log Shortcuts
* -------------------
* Log shortcuts are placeholders which are replaced when a log entry is created. Placeholders start with a
* percentage sign (%) and contain one or more characters. Each placeholder is handled by an own function which
* decides what to do.
*
* @param mixed $writer Writer object (any subclass of cLogWriter), or false if cLog should handle the writer creation
*/
public function __construct($writer = false) {
$cfg = cRegistry::getConfig();
$createWriter = false;
if ($writer == false) {
$createWriter = true;
} else if (!is_object($writer) || ($writer instanceof cLogWriter) == false) {
cWarning(__FILE__, __LINE__, "The passed class is not a subclass of cLogWriter. Creating new one.");
$createWriter = true;
}
if ($createWriter == true) {
$options = array(
'destination' => cRegistry::getConfigValue('path', 'contenido')
.cRegistry::getConfigValue('path', 'logs')
.'contenido.log');
$writer = cLogWriter::factory("File", $options);
}
$this->setWriter($writer);
$this->setShortcutHandler("%date", array($this, "shDate"));
$this->setShortcutHandler("%level", array($this, "shLevel"));
$this->setShortcutHandler("%message", array($this, "shMessage"));
$this->getWriter()->setOption('log_format', '[%date] [%level] %message', false);
$reflection = new ReflectionClass($this);
$this->_priorities = $this->_defaultPriorities = array_flip($reflection->getConstants());
}
/**
* Returns the local writer instance.
* @return cLogWriter
*/
public function getWriter() {
return $this->_writer;
}
/**
* Sets the local writer instance.
*
* @param cLogWriter $writer Writer instacne
*/
public function setWriter(cLogWriter $writer) {
$this->_writer = $writer;
}
/**
* Defines a custom shortcut handler.
*
* Each shortcut handler receives an array with the
* message and the priority of the entry.
*
* @param string $shortcut Shortcut name
* @param string $handler Name of the function to call
* @throws cInvalidArgumentException if the given shortcut is empty or
* already in use or if the handler is not callable
* @return bool True if setting was successful
*/
public function setShortcutHandler($shortcut, $handler) {
if ($shortcut == '') {
throw new Exception('The shortcut name must not be empty.');
}
if (substr($shortcut, 0, 1) == "%") {
$shortcut = substr($shortcut, 1);
}
if (is_callable($handler) == false) {
throw new Exception('The specified shortcut handler does not exist.');
}
if (array_key_exists($shortcut, $this->_shortcutHandlers)) {
throw new Exception('The shortcut ' . $shortcut . ' is already in use!');
}
$this->_shortcutHandlers[$shortcut] = $handler;
return true;
}
/**
* Unsets a specific shortcut handler.
*
* @param string $shortcut Name of the shortcut
* @throws cInvalidArgumentException if the given shortcut handler does not
* exist
* @return boolean
*/
public function unsetShortcutHandler($shortcut) {
if (!in_array($shortcut, $this->_shortcutHandlers)) {
throw new Exception('The specified shortcut handler does not exist.');
}
unset($this->_shortcutHandlers[$shortcut]);
return true;
}
/**
* Buffers a log message for committing them on a later moment.
*
* @param string $message Message to buffer
* @param mixed $priority Priority of the log entry (optional)
*/
public function buffer($message, $priority = NULL) {
$this->_buffer[] = array($message, $priority);
}
/**
* Commits all buffered messages and empties the message buffer if parameter is not false.
*
* @param boolean $revoke Flag, whether the buffer is cleared or not (optional, default: true)
*/
public function commit($revoke = true) {
if (count($this->_buffer) == 0) {
cWarning(__FILE__, __LINE__, "There are no buffered messages to commit.");
return false;
}
foreach ($this->_buffer as $bufferInfo) {
$this->log($bufferInfo[0], $bufferInfo[1]);
}
if ($revoke == true) {
$this->revoke();
}
}
/**
* Empties the message buffer.
*/
public function revoke() {
$this->_buffer = array();
}
/**
* Logs a message using the local writer instance
*
* @param string $message Message to log
* @param mixed $priority Priority of the log entry (optional)
*/
public function log($message, $priority = NULL) {
if ($priority && is_int($priority) == false && in_array($priority, $this->_priorities)) {
$priority = array_search($priority, $this->_priorities);
}
if ($priority === NULL || array_key_exists($priority, $this->_priorities) == false) {
$priority = $this->getWriter()->getOption('default_priority');
}
$logMessage = $this->getWriter()->getOption('log_format');
$lineEnding = $this->getWriter()->getOption('line_ending');
foreach ($this->_shortcutHandlers as $shortcut => $handler) {
if (substr($shortcut, 0, 1) != "%") {
$shortcut = "%" . $shortcut;
}
$info = array(
'message' => $message,
'priority' => $priority
);
$value = call_user_func($handler, $info);
$logMessage = str_replace($shortcut, $value, $logMessage);
}
$this->getWriter()->write($logMessage . $lineEnding, $priority);
}
/**
* Adds a new priority to the log.
*
* @param string $name Name of the log priority
* @param int $value Index value of the log priority
* @throws cInvalidArgumentException if the given name is empty, already
* exists or the value already exists
*/
public function addPriority($name, $value) {
if ($name == '') {
throw new Exception('Priority name must not be empty.');
}
if (in_array($name, $this->_priorities)) {
throw new Exception('The given priority name already exists.');
}
if (array_key_exists($value, $this->_priorities)) {
throw new Exception('The priority value already exists.');
}
$this->_priorities[$value] = $name;
}
/**
* Removes a priority from log.
* Default properties can not be removed.
*
* @param string $name Name of the log priority to remove
* @throws cInvalidArgumentException if the given name is empty, does not
* exist or is a default priority
*/
public function removePriority($name) {
if ($name == '') {
throw new Exception('Priority name must not be empty.');
}
if (in_array($name, $this->_priorities) == false) {
throw new Exception('Priority name does not exist.');
}
if (in_array($name, $this->_defaultPriorities) == true) {
throw new Exception('Removing default priorities is not allowed.');
}
$priorityIndex = array_search($name, $this->_priorities);
unset($this->_priorities[$priorityIndex]);
}
/**
* Magic call method for direct priority named calls.
*
* @param string $method Name of the method
* @param array $arguments Array with the method arguments
* @throws cInvalidArgumentException if the given priority is not supported
*/
public function __call($method, $arguments) {
$priorityName = strtoupper($method);
if (in_array($priorityName, $this->_priorities) == false) {
throw new Exception('The given priority ' . $priorityName . ' is not supported.');
}
$priorityIndex = array_search($priorityName, $this->_priorities);
return $this->log($arguments[0], $priorityIndex);
}
/**
* Shortcut Handler Date.
* Returns the current date
* @return string The current date
*/
public function shDate() {
return date("Y-m-d H:i:s");
}
/**
* Shortcut Handler Level.
* Returns the canonical name of the priority.
* The canonical name is padded to 10 characters to achieve a better formatting.
* @return string The canonical log level
*/
public function shLevel($info) {
$logLevel = $info['priority'];
return str_pad($this->_priorities[$logLevel], 10, " ", STR_PAD_BOTH);
}
/**
* Shortcut Handler Message.
* Returns the log message.
* @return string The log message
*/
public function shMessage($info) {
return $info['message'];
}
}
?>

Datei anzeigen

@ -0,0 +1,67 @@
<?php
/**
* This file contains the log file writer class.
*
* @package Core
* @subpackage Log
* @version SVN Revision $Rev$
*
* @author Dominik Ziegler
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
/**
* This class contains the file writer class for the logging mechanism.
*
* @package Core
* @subpackage Log
*/
class cLogWriterFile extends cLogWriter {
/**
* @var resource Destination handle
*/
protected $_handle = NULL;
/**
* Constructor of the writer instance.
* @param array $options Array with options for the writer instance (optional)
*/
public function __construct($options = array()) {
parent::__construct($options);
$this->_createHandle();
}
/**
* Checks destination and creates the handle for the write process.
*
* @throws cException if not destination is specified
* @throws cFileNotFoundException if the destination file could not be read
*/
protected function _createHandle() {
$destination = $this->getOption('destination');
if ($destination == '') {
throw new Exception('No destination was specified.');
}
if (($this->_handle = fopen($destination, 'a')) === false) {
throw new Exception('Destination handle could not be created.');
}
}
/**
* Writes the content to file handle.
*
* @param string $message Message to write
* @param int $priority Priority of the log entry
* @return boolean State of the write process
*/
public function write($message, $priority) {
return (fwrite($this->_handle, $message) != false);
}
}

Datei anzeigen

@ -0,0 +1,127 @@
<?php
/**
* This file contains the abstract log writer class.
*
* @package Core
* @subpackage Log
* @version SVN Revision $Rev$
*
* @author Dominik Ziegler
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
/**
* This class contains the main functionalities for the logging writer in CONTENIDO.
*
* @package Core
* @subpackage Log
*/
abstract class cLogWriter {
/**
* @var array Contains all options of the current writer instance.
*/
protected $_options = array();
/**
* Constructor of the writer instance.
* @param array $options Array with options for the writer instance (optional)
*/
public function __construct($options = array()) {
$this->setOptions($options);
// Set all default options if they were not set already
$this->setOption('default_priority', cLog::INFO, false);
$this->setOption('line_ending', PHP_EOL, false);
}
/**
* Factory method for a new writer instance.
*
* @param string $writerName Name of the writer
* @param array $writerOptions Options array for the writer instance
* @throws cInvalidArgumentException if the writer class with the given name
* does not exist or is not an instance of clogWriter
* @return cLogWriter Log writer instance
*/
public static function factory($writerName, array $writerOptions) {
$logWriterClassName = 'cLogWriter' . ucfirst($writerName);
if (!class_exists($logWriterClassName)) {
throw new Exception('Unknown writer class: ' . $writerName);
}
$writer = new $logWriterClassName($writerOptions);
if (($writer instanceof cLogWriter) == false) {
throw new Exception('Provided class is not an instance of cLogWriter');
}
return $writer;
}
/**
* Sets the whole options array.
*
* @param array $options Array with options
*/
public function setOptions(array $options) {
$this->_options = $options;
}
/**
* Returns an array with all options.
* @return array Array with all options
*/
public function getOptions() {
return $this->_options;
}
/**
* Sets a option. If option was set previously, it must be forced to overwrite the value.
*
* @param string $option Name of the option
* @param mixed $value Value of the option
* @param boolean $force Flag to force setting the option value (optional, default: false)
*/
public function setOption($option, $value, $force = false) {
if ($force == false && isset($this->_options[$option]) == true) {
return;
}
$this->_options[$option] = $value;
}
/**
* Returns the value of an option entry.
*
* @param string $option Name of the option
*
* @return mixed Value of the option entry
*/
public function getOption($option) {
return $this->_options[$option];
}
/**
* Removes an option entry.
*
* @param string $option Name of the option
*/
public function removeOption($option) {
unset($this->_options[$option]);
}
/**
* Abstract function for the write process.
* This method must be implemented in the specific writer.
*
* @param string $message Message to write
* @param int $priority Priority of the log entry
*
* @return boolean State of the write process
*/
abstract function write($message, $priority);
}

Datei anzeigen

@ -0,0 +1,90 @@
<?php
/**
* This file contains the module log class.
*
* @package Core
* @subpackage Log
* @version SVN Revision $Rev$
*
* @author Dominik Ziegler
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
/**
* This class contains the main functionalities for the module logging in
* CONTENIDO.
* The funcationality is almost the same like normal logging with the exception,
* that log entries contains an additional information about the used module.
*
* Example:
* $writer = cLogWriter::factory("File", array('destination' =>
* 'contenido.log'));
*
* $log = new cModuleLog($writer);
* $log->setModule(1);
* $log->log("Anything you want to log.");
*
* @package Core
* @subpackage Log
*/
class cModuleLog extends cLog {
/**
* @var cApiModule instance of module model
*/
private $_module;
/**
* Constructor of the module log.
*
* @param mixed $writer Writer object (any subclass of cLogWriter), or false
* if cLog should handle the writer creation
*
*/
public function __construct($writer = false) {
parent::__construct($writer);
$this->setShortcutHandler('module', array(
$this,
'shModule'
));
$this->getWriter()->setOption("log_format", "[%date] [%level] [%module] %message", true);
}
/**
* Sets the module to use.
*
* setModule automatically buffers basic module information to the log to
* assist the developer in debugging his modules.
*
* @param int $idmod The module ID to use
* @throws cException if the module with the given idmod could not be loaded
*/
public function setModule($idmod) {
$this->_module = new cApiModule($idmod);
if ($this->_module->isLoaded() == false) {
throw new Exception('Could not load module information.');
}
}
/**
* Shortcut Handler Module.
* Returns the ID and the name of the module.
*
* @return string ID and name of the module
*/
public function shModule() {
if ($this->_module->isLoaded() == false) {
return '';
}
return $this->_module->get("idmod") . ": " . $this->_module->get("name");
}
}
?>

Datei anzeigen

@ -184,6 +184,7 @@ class Template {
global $cCurrentModule;
$cfg = cRegistry::getConfig();
$aCfgClient = cRegistry::getClientConfig(cRegistry::getClientId());
$bModTplUsed = FALSE;
if (isset($cCurrentModule) && $cfg['dceModEdit']['use']) {
@ -200,23 +201,22 @@ class Template {
}
}
if (is_file(cRegistry::getFrontendPath() . "templates/" . $template) && !$bModTplUsed) {
$template = cRegistry::getFrontendPath() . "templates/" . $template;
if (is_file("templates/" . $template) && !$bModTplUsed) {
$template = "templates/" . $template;
}
//check if the template is a file or a string
if (!is_file($template)) {
$content = & $template; //template is a string (it is a reference to save memory!!!)
} else {
if(cFileHandler::readable($template)) {
$content = implode("", file($template)); //template is a file
} else {
return $template;
}
$content = implode("", file($template)); //template is a file
}
$content = (($note) ? "<!-- Generated by ConLite " . $cfg['version'] . "-->\n" : "") . $content;
// CEC for template pre processing
$content = CEC_Hook::executeAndReturn('Contenido.Template.BeforeParse', $content, $this);
$pieces = array();
//replace i18n strings before replacing other placeholders
$this->replacei18n($content, "i18n");
@ -332,5 +332,6 @@ class Template {
}
# end class
?>
class cTemplate extends Template {
}

Datei anzeigen

@ -320,12 +320,8 @@ class cPage extends cHTML {
}
$meta = '';
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->_encoding != "" && !$this->_isHtml5) {
$meta .= '<meta http-equiv="Content-type" content="text/html;charset=' . $this->_encoding . '">' . "\n";
}
if ($this->_object !== false && method_exists($this->_object, "render")) {
@ -344,6 +340,8 @@ class cPage extends cHTML {
$tpl->set('s', 'MARGIN', $this->_margin);
$tpl->set('s', 'EXTRA', $this->extra);
$tpl->set('s', 'SESSION_ID', $sess->id);
$tpl->set('s', 'STYLES', '');
if ($print == true) {
$tplRender = false;

Datei anzeigen

@ -25,26 +25,27 @@ if (!defined("CON_FRAMEWORK")) {
// Contenido startup process
include_once ('../includes/startup.php');
$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes');
$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes');
include_once ($classPath . 'class.user.php');
include_once ($classPath . 'class.xml.php');
include_once ($classPath . 'class.navigation.php');
include_once ($classPath . 'template/class.template.php');
include_once ($classPath . 'class.backend.php');
include_once ($classPath . 'class.table.php');
include_once ($classPath . 'class.notification.php');
include_once ($classPath . 'class.area.php');
include_once ($classPath . 'class.layout.php');
include_once ($classPath . 'class.client.php');
include_once ($classPath . 'class.cat.php');
include_once ($classPath . 'class.treeitem.php');
include_once ($includesPath . 'cfg_language_de.inc.php');
include_once ($includesPath . 'functions.con.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.con.php');
if(!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") {
$db = new DB_ConLite;
conFlagOnOffline();
conMoveArticles();
}
}
?>

Datei anzeigen

@ -25,23 +25,20 @@ if (!defined("CON_FRAMEWORK")) {
// Contenido startup process
include_once ('../includes/startup.php');
$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes');
$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes');
include_once ($classPath . 'class.user.php');
include_once ($classPath . 'class.xml.php');
include_once ($classPath . 'class.navigation.php');
include_once ($classPath . 'template/class.template.php');
include_once ($classPath . 'class.backend.php');
include_once ($classPath . 'class.table.php');
include_once ($classPath . 'class.notification.php');
include_once ($classPath . 'class.area.php');
include_once ($classPath . 'class.layout.php');
include_once ($classPath . 'class.client.php');
include_once ($classPath . 'class.cat.php');
include_once ($classPath . 'class.treeitem.php');
include_once ($includesPath . 'cfg_language_de.inc.php');
include_once ($includesPath . 'functions.stat.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.stat.php');
if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs")
{
@ -60,4 +57,5 @@ if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs")
statsArchive(sprintf("%04d%02d",$year,$month));
}
}
?>

Datei anzeigen

@ -25,41 +25,37 @@ if (!defined("CON_FRAMEWORK")) {
// Contenido startup process
include_once ('../includes/startup.php');
$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes');
$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes');
include_once ($classPath . 'class.user.php');
include_once ($classPath . 'class.xml.php');
include_once ($classPath . 'class.navigation.php');
include_once ($classPath . 'template/class.template.php');
include_once ($classPath . 'class.backend.php');
include_once ($classPath . 'class.table.php');
include_once ($classPath . 'class.notification.php');
include_once ($classPath . 'class.area.php');
include_once ($classPath . 'class.layout.php');
include_once ($classPath . 'class.client.php');
include_once ($classPath . 'class.cat.php');
include_once ($classPath . 'class.treeitem.php');
include_once ($includesPath . 'cfg_language_de.inc.php');
include_once ($includesPath . 'functions.stat.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.stat.php');
global $cfg;
if(!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") {
$db = new DB_ConLite;
$tables = cRegistry::getConfigValue('tab');
foreach ($tables as $key => $value)
foreach ($cfg["tab"] as $key => $value)
{
$sql = "OPTIMIZE TABLE ".$value;
$db->query($sql);
}
if (cRegistry::getConfigValue('statistics_heap_table')) {
$sHeapTable = cRegistry::getConfigValue('tab', 'stat_heap_table');
if ($cfg["statistics_heap_table"]) {
$sHeapTable = $cfg['tab']['stat_heap_table'];
buildHeapTable ($sHeapTable, $db);
}
}
}
?>

Datei anzeigen

@ -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,33 +23,38 @@ 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 (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')";
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);
$db->query($sSql);
}
}
?>

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen