Commits vergleichen

..

Keine gemeinsamen Commits. "develop" und "2.1/main" haben vollständig unterschiedliche Historien.

522 geänderte Dateien mit 33422 neuen und 37035 gelöschten Zeilen

4
.gitignore vendored
Datei anzeigen

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

3
.gitmodules vendored
Datei anzeigen

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

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

@ -14,35 +14,31 @@
<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" />
<path value="$PROJECT_DIR$/conlite/external/edit_area/plugins" />
<path value="$PROJECT_DIR$/conlite/external/frontend/cache" />
<path value="$PROJECT_DIR$/conlite/external/frontend/images" />
<path value="$PROJECT_DIR$/conlite/external/frontend/css" />
<path value="$PROJECT_DIR$/conlite/external/composer" />
<path value="$PROJECT_DIR$/conlite/external/frontend/data" />
<path value="$PROJECT_DIR$/conlite/external/frontend/upload" />
<path value="$PROJECT_DIR$/conlite/external/frontend/templates" />
<path value="$PROJECT_DIR$/conlite/external/phpmailer/phpmailer" />
<path value="$PROJECT_DIR$/conlite/external/edit_area/langs" />
<path value="$PROJECT_DIR$/conlite/external/frontend/js" />
<path value="$PROJECT_DIR$/conlite/external/frontend/includes" />
<path value="$PROJECT_DIR$/conlite/external/wysiwyg/tinymce3" />
<path value="$PROJECT_DIR$/conlite/external/edit_area/images" />
<path value="$PROJECT_DIR$/conlite/external/edit_area/reg_syntax" />
<path value="$PROJECT_DIR$/conlite/external/frontend/logs" />
<path value="$PROJECT_DIR$/conlite/external/endroid/qr-code" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
<component name="PhpProjectSharedConfiguration" php_language_level="7.4">
<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>

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

@ -3,9 +3,8 @@
<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" />
<option value="$PROJECT_DIR$/conlite/external/endroid/qr-code/tests" />
</list>
</option>
</component>

Datei anzeigen

@ -2,8 +2,6 @@
<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,16 +1,16 @@
This is the readme file for **ConLite 3.0.0**
This is the readme file for **ConLite 2.1.3**
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-API-Doc [http://conlite.conrepo.org/api/4.8.16CL](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
We tried to fix all known bugs of Contenido 4.8 and earlier but cannot give any garanties for that. So use
it on your own risk. If you find any bug or have any idea to enhance ConLite, feel free to visit our
bugtracker at [https://gitport.de/ConLite/ConLite/issues](https://gitport.de/ConLite/ConLite/issues)
Any help and ideas are welcome :)
@ -19,40 +19,40 @@ Any help and ideas are welcome :)
#### 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?
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?
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
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**

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,5 +1,5 @@
{
"name": "org.conlite/conlite",
"name": "vendor/conlite",
"description": "ConLite vendor libs",
"license": "GPL-3.0-or-later",
"authors": [
@ -8,19 +8,16 @@
"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": {
"endroid/qr-code": "1.9.*",
"phpmailer/phpmailer": "v5.2.*"
},
"autoload": {
"psr-4": {
"ConLite\\": "conlite/classes"
"Conlite\\External\\": "conlite/external"
}
}
}

2112
composer.lock generiert

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

Datei anzeigen

@ -185,8 +185,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;
}

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

@ -555,8 +555,8 @@ if (empty($where) || $iAffectedRows <= 0) {
#Check rights per cat
if (!$check_rights) {
//hotfix timo trautmann 2008-12-10 also check rights in associated groups
$aGroupsForUser = $perm->getGroupsForUser($auth->auth['uid']);
$aGroupsForUser[] = $auth->auth['uid'];
$aGroupsForUser = $perm->getGroupsForUser($auth->auth[uid]);
$aGroupsForUser[] = $auth->auth[uid];
$sTmpUserString = implode("','", $aGroupsForUser);
#Check if any rights are applied to current user or his groups

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

@ -5,7 +5,7 @@
*
* Description:
* Base Class for all cHTML Elements
*
*
* @category ConLite
* @package Core
* @subpackage cHTML
@ -20,7 +20,11 @@
// 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 +33,11 @@ $cHTMLIDCount = 0;
*
* @author Ortwin Pinke <o.pinke@conlite.org>
*/
class cHTML extends cHTML5Common
{
class cHTML extends cHTML5Common {
/**
* Storage of the open SGML tag template
* @var string
* @var string
*/
protected $_skeleton_open;
@ -58,15 +61,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 +79,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 +112,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 +163,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 +189,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 +198,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 +207,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 +220,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 +236,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 +246,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 +254,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 +268,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 +334,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 +355,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 +372,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 +465,8 @@ class cHTML extends cHTML5Common
* @param none
* @return string Rendered HTML
*/
public function render()
{
public function render() {
return $this->toHtml();
}
}
}
?>

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

@ -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").
@ -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();
}
}

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

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

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

@ -32,7 +32,7 @@ class cRegistry {
*/
public static function getBackendPath() {
$cfg = self::getConfig();
return $cfg['path']['conlite'];
return $cfg['path']['contenido'];
}
/**
@ -219,11 +219,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 +246,5 @@ class cRegistry {
return new $apiClassName($objectId);
}
}
}
?>

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

@ -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,12 +94,25 @@ 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
@ -120,9 +128,13 @@ 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["js"]["path"],
"tplfiles" => $cfgClient["tpl"]["path"],
"cssfiles" => $cfgClient["css"]["path"]
);
if (isset($cfg['dceModEdit']) && is_array($cfg['dceModEdit'])) {
$this->_aModFileEditConf['clientPath'] = $cfgClient["path"]["frontend"];
@ -133,9 +145,9 @@ class cApiModule extends Item {
}
}
$cApiClient = new cApiClient(cRegistry::getClientId());
$aClientProp = $cApiClient->getPropertiesByType('modfileedit');
if ($aClientProp !== []) {
$oClient = new cApiClient(cRegistry::getClientId());
$aClientProp = $oClient->getPropertiesByType('modfileedit');
if (count($aClientProp) > 0) {
$this->_aModFileEditConf = array_merge($this->_aModFileEditConf, $aClientProp);
}
@ -146,15 +158,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 +176,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 +187,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 +262,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 +272,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 +297,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 +309,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 +320,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 +337,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 +349,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 +379,21 @@ class cApiModule extends Item {
/**
* Checks if the module is a pre-4.3 module
* @return boolean true if this module is an old one
*
*
* @deprecated since version 2.0
*/
public function isOldModule() {
// Keywords to scan
$scanKeywords = ['$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 +402,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 +414,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 +429,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 +442,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 +481,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 +499,26 @@ class cApiModule extends Item {
private function _parseImportFile($sFile, $sType = "module", $sEncoding = "ISO-8859-1") {
global $_mImport;
$clXmlParser = new clXmlParser($sEncoding);
$oParser = new clXmlParser($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 +541,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 +586,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 +598,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 +610,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 +641,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 +657,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 +703,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 +742,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 +762,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 +798,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 +827,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 +854,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 +879,7 @@ class cApiModule extends Item {
/**
* Overridden parent method for hooking dceModFileEdit
*
*
* @return void
*/
protected function _onLoad() {
@ -877,7 +891,7 @@ class cApiModule extends Item {
/**
* Use a PHP-file, if present, for module output
*
*
* @return boolean
*/
private function _setOutputFromPhpFile() {
@ -890,7 +904,7 @@ class cApiModule extends Item {
/**
* Use a PHP-file, if present, for module input
*
*
* @return boolean
*/
private function _setInputFromPhpFile() {
@ -903,7 +917,7 @@ class cApiModule extends Item {
}
private function _displayNoteFromFile($bIsOldPath = FALSE) {
if (property_exists($this, '_bNoted') && $this->_bNoted !== null && $this->_bNoted === true) {
if (isset($this->_bNoted) && $this->_bNoted === true) {
return;
}
global $frame, $area;
@ -912,22 +926,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 +987,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 +1017,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";
@ -1034,7 +1057,7 @@ class cApiModule extends Item {
class cApiModuleTranslationCollection extends ItemCollection {
protected $_error;
protected $f_obj;
/**
@ -1053,8 +1076,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 +1133,21 @@ class cApiModuleTranslationCollection extends ItemCollection {
public function import($idmod, $idlang, $file) {
global $_mImport;
$clXmlParser = new clXmlParser("ISO-8859-1");
$parser = new clXmlParser("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 +1161,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 +1184,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,17 @@ abstract class ItemBaseAbstract
* @var string
*/
protected $_className;
protected $_bDebug;
/**
* Sets some common properties
*
* @param string $sTable Name of table
* @param string $sPrimaryKey Primary key of table
* @param string $sClassName Name of parent class
* @param int $iLifetime Lifetime of the object in seconds (NOT USED!)
* @throws 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 +104,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;
@ -163,4 +159,6 @@ abstract class ItemBaseAbstract
return $this->properties;
}
}
}
?>

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

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

@ -208,11 +208,7 @@ class Template {
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;

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")) {

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);
}
}
?>

25
conlite/external/autoload.php vendored Normale Datei
Datei anzeigen

@ -0,0 +1,25 @@
<?php
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit4710875e1096bb659e0da9fbf88400bb::getLoader();

Datei anzeigen

@ -92,7 +92,7 @@ if ($cfg["use_pseudocron"] == true) {
* PHPLIB application development toolkit
* @see http://sourceforge.net/projects/phplib
*/
if (isset($contenido)) {
if (!empty($contenido)) {
//Backend
page_open(array('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm'));
i18nInit($cfg["path"]["contenido"] . $cfg["path"]["locale"], $belang);
@ -130,6 +130,9 @@ if (isset($_GET['action']) && $_GET['action'] == 'get_compressed') {
exit();
}
// Call hook after plugins are loaded, added by Murat Purc, 2008-09-07
CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins');
if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) {
// get encodings of all languages
$encoding = array();
@ -238,7 +241,7 @@ $errsite = 'Location: ' . Contenido_Url::getInstance()->buildRedirect($aParams);
* Note: These variables can be set via http globals e.g. front_content.php?idcat=41&idart=34&idcatart=35&idartlang=42
* If not the values will be computed.
*/
if (!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);
@ -407,7 +410,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 */
@ -530,7 +533,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);
}
@ -607,11 +610,9 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p
/* If article is in use, display notification */
if (!empty($sHtmlInUseCss) && !empty($sHtmlInUseMessage)) {
$code = preg_replace("/<\/head>/i", "$sHtmlInUseCss\n</head>", $code, 1);
if(!preg_match("/(<body[^>]*)>.*/i", $code)) {
$code = preg_replace("/(<body[^>]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1);
$bInUseSet = true;
}
$code = preg_replace("/(<body[^>]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1);
}
/* Check if category is public */
$sql = "SELECT public FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'";
@ -650,7 +651,7 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p
WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = '" . Contenido_Security::escapeDB($user_id, $db2) . "' AND A.idcat = '" . Contenido_Security::toInteger($idcat) . "'
AND A.idarea = C.idarea AND B.idaction = A.idaction";
$db2 = new DB_ConLite();
$db2 = new DB_ConLite;
$db2->query($sql);
if ($db2->num_rows() > 0) {
@ -794,16 +795,12 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p
if (in_array(Contenido_Security::toInteger($idart), $aExclude)) {
eval("?>\n" . $code . "\n<?php\n");
} else {
chdir($cfgClient[$client]["path"]["frontend"]);
// write html output into output buffer and assign it to an variable
ob_start();
eval("?>\n" . $code . "\n<?php\n");
$htmlCode = ob_get_contents();
ob_end_clean();
if(!empty($sHtmlInUseMessage) && empty($bInUseSet)) {
$htmlCode = preg_replace("/(<body[^>]*)>/i", "\${1}> \n $sHtmlInUseMessage", $htmlCode, 1);
}
// process CEC to do some preparations before output
$htmlCode = CEC_Hook::executeAndReturn('Contenido.Frontend.HTMLCodeOutput', $htmlCode);

Datei anzeigen

@ -0,0 +1,18 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'EasyPeasyICS' => $vendorDir . '/phpmailer/phpmailer/extras/EasyPeasyICS.php',
'PHPMailer' => $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php',
'PHPMailerOAuth' => $vendorDir . '/phpmailer/phpmailer/class.phpmaileroauth.php',
'PHPMailerOAuthGoogle' => $vendorDir . '/phpmailer/phpmailer/class.phpmaileroauthgoogle.php',
'POP3' => $vendorDir . '/phpmailer/phpmailer/class.pop3.php',
'SMTP' => $vendorDir . '/phpmailer/phpmailer/class.smtp.php',
'ntlm_sasl_client_class' => $vendorDir . '/phpmailer/phpmailer/extras/ntlm_sasl_client.php',
'phpmailerException' => $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php',
);

Datei anzeigen

@ -2,8 +2,8 @@
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
return array(
);

Datei anzeigen

@ -0,0 +1,12 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
return array(
'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
'Endroid\\QrCode\\' => array($vendorDir . '/endroid/qr-code/src'),
'Conlite\\External\\' => array($vendorDir . ''),
);

Datei anzeigen

@ -0,0 +1,38 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit4710875e1096bb659e0da9fbf88400bb
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit4710875e1096bb659e0da9fbf88400bb', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit4710875e1096bb659e0da9fbf88400bb', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit4710875e1096bb659e0da9fbf88400bb::getInitializer($loader));
$loader->register(true);
return $loader;
}
}

Datei anzeigen

@ -0,0 +1,60 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit4710875e1096bb659e0da9fbf88400bb
{
public static $prefixLengthsPsr4 = array (
'S' =>
array (
'Symfony\\Component\\OptionsResolver\\' => 34,
),
'E' =>
array (
'Endroid\\QrCode\\' => 15,
),
'C' =>
array (
'Conlite\\External\\' => 17,
),
);
public static $prefixDirsPsr4 = array (
'Symfony\\Component\\OptionsResolver\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/options-resolver',
),
'Endroid\\QrCode\\' =>
array (
0 => __DIR__ . '/..' . '/endroid/qr-code/src',
),
'Conlite\\External\\' =>
array (
0 => __DIR__ . '/../../..' . '/conlite/external',
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'EasyPeasyICS' => __DIR__ . '/..' . '/phpmailer/phpmailer/extras/EasyPeasyICS.php',
'PHPMailer' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmailer.php',
'PHPMailerOAuth' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmaileroauth.php',
'PHPMailerOAuthGoogle' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmaileroauthgoogle.php',
'POP3' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.pop3.php',
'SMTP' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.smtp.php',
'ntlm_sasl_client_class' => __DIR__ . '/..' . '/phpmailer/phpmailer/extras/ntlm_sasl_client.php',
'phpmailerException' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmailer.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit4710875e1096bb659e0da9fbf88400bb::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4710875e1096bb659e0da9fbf88400bb::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit4710875e1096bb659e0da9fbf88400bb::$classMap;
}, null, ClassLoader::class);
}
}

240
conlite/external/composer/installed.json vendored Normale Datei
Datei anzeigen

@ -0,0 +1,240 @@
{
"packages": [
{
"name": "endroid/qr-code",
"version": "1.9.3",
"version_normalized": "1.9.3.0",
"source": {
"type": "git",
"url": "https://github.com/endroid/qr-code.git",
"reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/endroid/qr-code/zipball/c9644bec2a9cc9318e98d1437de3c628dcd1ef93",
"reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93",
"shasum": ""
},
"require": {
"ext-gd": "*",
"php": ">=5.4",
"symfony/options-resolver": "^2.3|^3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0|^5.0",
"sensio/framework-extra-bundle": "^3.0",
"symfony/browser-kit": "^2.3|^3.0",
"symfony/framework-bundle": "^2.3|^3.0",
"symfony/http-kernel": "^2.3|^3.0"
},
"time": "2017-04-08T09:13:59+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Endroid\\QrCode\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jeroen van den Enden",
"email": "info@endroid.nl",
"homepage": "http://endroid.nl/"
}
],
"description": "Endroid QR Code",
"homepage": "https://github.com/endroid/QrCode",
"keywords": [
"bundle",
"code",
"endroid",
"qr",
"qrcode",
"symfony"
],
"support": {
"issues": "https://github.com/endroid/qr-code/issues",
"source": "https://github.com/endroid/qr-code/tree/1.9.3"
},
"install-path": "../endroid/qr-code"
},
{
"name": "phpmailer/phpmailer",
"version": "v6.5.3",
"version_normalized": "6.5.3.0",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "baeb7cde6b60b1286912690ab0693c7789a31e71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/baeb7cde6b60b1286912690ab0693c7789a31e71",
"reference": "baeb7cde6b60b1286912690ab0693c7789a31e71",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"php": ">=5.0.0"
},
"require-dev": {
"doctrine/annotations": "1.2.*",
"jms/serializer": "0.16.*",
"phpdocumentor/phpdocumentor": "2.*",
"phpunit/phpunit": "4.8.*",
"symfony/debug": "2.8.*",
"symfony/filesystem": "2.8.*",
"symfony/translation": "2.8.*",
"symfony/yaml": "2.8.*",
"zendframework/zend-cache": "2.5.1",
"zendframework/zend-config": "2.5.1",
"zendframework/zend-eventmanager": "2.5.1",
"zendframework/zend-filter": "2.5.1",
"zendframework/zend-i18n": "2.5.1",
"zendframework/zend-json": "2.5.1",
"zendframework/zend-math": "2.5.1",
"zendframework/zend-serializer": "2.5.*",
"zendframework/zend-servicemanager": "2.5.*",
"zendframework/zend-stdlib": "2.5.1"
},
"suggest": {
"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
},
"time": "2021-11-25T16:34:11+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"class.phpmailer.php",
"class.phpmaileroauth.php",
"class.phpmaileroauthgoogle.php",
"class.smtp.php",
"class.pop3.php",
"extras/EasyPeasyICS.php",
"extras/ntlm_sasl_client.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
},
{
"name": "Brent R. Matzelle"
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.3"
},
"funding": [
{
"url": "https://marcus.bointon.com/donations/",
"type": "custom"
},
{
"url": "https://github.com/Synchro",
"type": "github"
},
{
"url": "https://www.patreon.com/marcusbointon",
"type": "patreon"
}
],
"install-path": "../phpmailer/phpmailer"
},
{
"name": "symfony/options-resolver",
"version": "v3.4.47",
"version_normalized": "3.4.47.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744",
"reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"time": "2020-10-24T10:57:07+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\OptionsResolver\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony OptionsResolver Component",
"homepage": "https://symfony.com",
"keywords": [
"config",
"configuration",
"options"
],
"support": {
"source": "https://github.com/symfony/options-resolver/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/options-resolver"
}
],
"dev": false,
"dev-package-names": []
}

59
conlite/external/composer/installed.php vendored Normale Datei
Datei anzeigen

@ -0,0 +1,59 @@
<?php return array(
'root' => array(
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
'reference' => 'eea9100b3e2c72ca8b239c6a9fcb2671780ef12f',
'name' => 'vendor/con-lite21',
'dev' => false,
),
'versions' => array(
'bacon/bacon-qr-code' => array(
'pretty_version' => '2.0.4',
'version' => '2.0.4.0',
'type' => 'library',
'install_path' => __DIR__ . '/../bacon/bacon-qr-code',
'aliases' => array(),
'reference' => 'f73543ac4e1def05f1a70bcd1525c8a157a1ad09',
'dev_requirement' => false,
),
'dasprid/enum' => array(
'pretty_version' => '1.0.3',
'version' => '1.0.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../dasprid/enum',
'aliases' => array(),
'reference' => '5abf82f213618696dda8e3bf6f64dd042d8542b2',
'dev_requirement' => false,
),
'endroid/qr-code' => array(
'pretty_version' => '4.2.2',
'version' => '4.2.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../endroid/qr-code',
'aliases' => array(),
'reference' => '53bfce79da95bf082484301fecbc1d77a3907f78',
'dev_requirement' => false,
),
'phpmailer/phpmailer' => array(
'pretty_version' => 'v6.5.3',
'version' => '6.5.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpmailer/phpmailer',
'aliases' => array(),
'reference' => 'baeb7cde6b60b1286912690ab0693c7789a31e71',
'dev_requirement' => false,
),
'vendor/con-lite21' => array(
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
'reference' => 'eea9100b3e2c72ca8b239c6a9fcb2671780ef12f',
'dev_requirement' => false,
),
),
);

Datei anzeigen

@ -4,8 +4,8 @@
$issues = array();
if (!(PHP_VERSION_ID >= 80000)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.0.0". You are running ' . PHP_VERSION . '.';
if (!(PHP_VERSION_ID >= 50509)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.5.9". You are running ' . PHP_VERSION . '.';
}
if ($issues) {

Datei anzeigen

@ -1,4 +1,4 @@
Copyright (c) 2015-present Fabien Potencier
Copyright (c) Jeroen van den Enden
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

45
conlite/external/endroid/qr-code/composer.json vendored Ausführbare Datei
Datei anzeigen

@ -0,0 +1,45 @@
{
"name": "endroid/qrcode",
"description": "Endroid QR Code",
"keywords": ["endroid", "qrcode", "qr", "code", "bundle", "symfony"],
"homepage": "https://github.com/endroid/QrCode",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Jeroen van den Enden",
"email": "info@endroid.nl",
"homepage": "http://endroid.nl/"
}
],
"require": {
"php": ">=5.4",
"ext-gd": "*",
"symfony/options-resolver": "^2.3|^3.0"
},
"require-dev": {
"symfony/browser-kit": "^2.3|^3.0",
"symfony/framework-bundle": "^2.3|^3.0",
"symfony/http-kernel": "^2.3|^3.0",
"sensio/framework-extra-bundle": "^3.0",
"phpunit/phpunit": "^4.0|^5.0"
},
"autoload": {
"psr-4": {
"Endroid\\QrCode\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Endroid\\QrCode\\Tests\\": "tests/"
}
},
"config": {
"bin-dir": "bin"
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
}
}

1591
conlite/external/endroid/qr-code/src/QrCode.php vendored Ausführbare Datei

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

Datei anzeigen

@ -0,0 +1,49 @@
<?php
/**
* PHPMailer SPL autoloader.
* PHP Version 5
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* PHPMailer SPL autoloader.
* @param string $classname The name of the class to load
*/
function PHPMailerAutoload($classname)
{
//Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) {
require $filename;
}
}
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true);
} else {
spl_autoload_register('PHPMailerAutoload');
}
} else {
/**
* Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load
*/
function __autoload($classname)
{
PHPMailerAutoload($classname);
}
}

Datei anzeigen

@ -0,0 +1 @@
5.2.28

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

Datei anzeigen

@ -0,0 +1,197 @@
<?php
/**
* PHPMailer - PHP email creation and transport class.
* PHP Version 5.4
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* PHPMailerOAuth - PHPMailer subclass adding OAuth support.
* @package PHPMailer
* @author @sherryl4george
* @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
*/
class PHPMailerOAuth extends PHPMailer
{
/**
* The OAuth user's email address
* @var string
*/
public $oauthUserEmail = '';
/**
* The OAuth refresh token
* @var string
*/
public $oauthRefreshToken = '';
/**
* The OAuth client ID
* @var string
*/
public $oauthClientId = '';
/**
* The OAuth client secret
* @var string
*/
public $oauthClientSecret = '';
/**
* An instance of the PHPMailerOAuthGoogle class.
* @var PHPMailerOAuthGoogle
* @access protected
*/
protected $oauth = null;
/**
* Get a PHPMailerOAuthGoogle instance to use.
* @return PHPMailerOAuthGoogle
*/
public function getOAUTHInstance()
{
if (!is_object($this->oauth)) {
$this->oauth = new PHPMailerOAuthGoogle(
$this->oauthUserEmail,
$this->oauthClientSecret,
$this->oauthClientId,
$this->oauthRefreshToken
);
}
return $this->oauth;
}
/**
* Initiate a connection to an SMTP server.
* Overrides the original smtpConnect method to add support for OAuth.
* @param array $options An array of options compatible with stream_context_create()
* @uses SMTP
* @access public
* @return bool
* @throws phpmailerException
*/
public function smtpConnect($options = array())
{
if (is_null($this->smtp)) {
$this->smtp = $this->getSMTPInstance();
}
if (is_null($this->oauth)) {
$this->oauth = $this->getOAUTHInstance();
}
// Already connected?
if ($this->smtp->connected()) {
return true;
}
$this->smtp->setTimeout($this->Timeout);
$this->smtp->setDebugLevel($this->SMTPDebug);
$this->smtp->setDebugOutput($this->Debugoutput);
$this->smtp->setVerp($this->do_verp);
$hosts = explode(';', $this->Host);
$lastexception = null;
foreach ($hosts as $hostentry) {
$hostinfo = array();
if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
// Not a valid host entry
continue;
}
// $hostinfo[2]: optional ssl or tls prefix
// $hostinfo[3]: the hostname
// $hostinfo[4]: optional port number
// The host string prefix can temporarily override the current setting for SMTPSecure
// If it's not specified, the default value is used
$prefix = '';
$secure = $this->SMTPSecure;
$tls = ($this->SMTPSecure == 'tls');
if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
$prefix = 'ssl://';
$tls = false; // Can't have SSL and TLS at the same time
$secure = 'ssl';
} elseif ($hostinfo[2] == 'tls') {
$tls = true;
// tls doesn't use a prefix
$secure = 'tls';
}
//Do we need the OpenSSL extension?
$sslext = defined('OPENSSL_ALGO_SHA1');
if ('tls' === $secure or 'ssl' === $secure) {
//Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
if (!$sslext) {
throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
}
}
$host = $hostinfo[3];
$port = $this->Port;
$tport = (integer)$hostinfo[4];
if ($tport > 0 and $tport < 65536) {
$port = $tport;
}
if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
try {
if ($this->Helo) {
$hello = $this->Helo;
} else {
$hello = $this->serverHostname();
}
$this->smtp->hello($hello);
//Automatically enable TLS encryption if:
// * it's not disabled
// * we have openssl extension
// * we are not already using SSL
// * the server offers STARTTLS
if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) {
$tls = true;
}
if ($tls) {
if (!$this->smtp->startTLS()) {
throw new phpmailerException($this->lang('connect_host'));
}
// We must resend HELO after tls negotiation
$this->smtp->hello($hello);
}
if ($this->SMTPAuth) {
if (!$this->smtp->authenticate(
$this->Username,
$this->Password,
$this->AuthType,
$this->Realm,
$this->Workstation,
$this->oauth
)
) {
throw new phpmailerException($this->lang('authenticate'));
}
}
return true;
} catch (phpmailerException $exc) {
$lastexception = $exc;
$this->edebug($exc->getMessage());
// We must have connected, but then failed TLS or Auth, so close connection nicely
$this->smtp->quit();
}
}
}
// If we get here, all connection attempts have failed, so close connection hard
$this->smtp->close();
// As we've caught all exceptions, just report whatever the last one was
if ($this->exceptions and !is_null($lastexception)) {
throw $lastexception;
}
return false;
}
}

Datei anzeigen

@ -0,0 +1,77 @@
<?php
/**
* PHPMailer - PHP email creation and transport class.
* PHP Version 5.4
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* PHPMailerOAuthGoogle - Wrapper for League OAuth2 Google provider.
* @package PHPMailer
* @author @sherryl4george
* @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
* @link https://github.com/thephpleague/oauth2-client
*/
class PHPMailerOAuthGoogle
{
private $oauthUserEmail = '';
private $oauthRefreshToken = '';
private $oauthClientId = '';
private $oauthClientSecret = '';
/**
* @param string $UserEmail
* @param string $ClientSecret
* @param string $ClientId
* @param string $RefreshToken
*/
public function __construct(
$UserEmail,
$ClientSecret,
$ClientId,
$RefreshToken
) {
$this->oauthClientId = $ClientId;
$this->oauthClientSecret = $ClientSecret;
$this->oauthRefreshToken = $RefreshToken;
$this->oauthUserEmail = $UserEmail;
}
private function getProvider()
{
return new League\OAuth2\Client\Provider\Google([
'clientId' => $this->oauthClientId,
'clientSecret' => $this->oauthClientSecret
]);
}
private function getGrant()
{
return new \League\OAuth2\Client\Grant\RefreshToken();
}
private function getToken()
{
$provider = $this->getProvider();
$grant = $this->getGrant();
return $provider->getAccessToken($grant, ['refresh_token' => $this->oauthRefreshToken]);
}
public function getOauth64()
{
$token = $this->getToken();
return base64_encode("user=" . $this->oauthUserEmail . "\001auth=Bearer " . $token . "\001\001");
}
}

Datei anzeigen

@ -0,0 +1,407 @@
<?php
/**
* PHPMailer POP-Before-SMTP Authentication Class.
* PHP Version 5
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* PHPMailer POP-Before-SMTP Authentication Class.
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
* Does not support APOP.
* @package PHPMailer
* @author Richard Davey (original author) <rich@corephp.co.uk>
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
*/
class POP3
{
/**
* The POP3 PHPMailer Version number.
* @var string
* @access public
*/
public $Version = '5.2.28';
/**
* Default POP3 port number.
* @var integer
* @access public
*/
public $POP3_PORT = 110;
/**
* Default timeout in seconds.
* @var integer
* @access public
*/
public $POP3_TIMEOUT = 30;
/**
* POP3 Carriage Return + Line Feed.
* @var string
* @access public
* @deprecated Use the constant instead
*/
public $CRLF = "\r\n";
/**
* Debug display level.
* Options: 0 = no, 1+ = yes
* @var integer
* @access public
*/
public $do_debug = 0;
/**
* POP3 mail server hostname.
* @var string
* @access public
*/
public $host;
/**
* POP3 port number.
* @var integer
* @access public
*/
public $port;
/**
* POP3 Timeout Value in seconds.
* @var integer
* @access public
*/
public $tval;
/**
* POP3 username
* @var string
* @access public
*/
public $username;
/**
* POP3 password.
* @var string
* @access public
*/
public $password;
/**
* Resource handle for the POP3 connection socket.
* @var resource
* @access protected
*/
protected $pop_conn;
/**
* Are we connected?
* @var boolean
* @access protected
*/
protected $connected = false;
/**
* Error container.
* @var array
* @access protected
*/
protected $errors = array();
/**
* Line break constant
*/
const CRLF = "\r\n";
/**
* Simple static wrapper for all-in-one POP before SMTP
* @param $host
* @param integer|boolean $port The port number to connect to
* @param integer|boolean $timeout The timeout value
* @param string $username
* @param string $password
* @param integer $debug_level
* @return boolean
*/
public static function popBeforeSmtp(
$host,
$port = false,
$timeout = false,
$username = '',
$password = '',
$debug_level = 0
) {
$pop = new POP3;
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
}
/**
* Authenticate with a POP3 server.
* A connect, login, disconnect sequence
* appropriate for POP-before SMTP authorisation.
* @access public
* @param string $host The hostname to connect to
* @param integer|boolean $port The port number to connect to
* @param integer|boolean $timeout The timeout value
* @param string $username
* @param string $password
* @param integer $debug_level
* @return boolean
*/
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
{
$this->host = $host;
// If no port value provided, use default
if (false === $port) {
$this->port = $this->POP3_PORT;
} else {
$this->port = (integer)$port;
}
// If no timeout value provided, use default
if (false === $timeout) {
$this->tval = $this->POP3_TIMEOUT;
} else {
$this->tval = (integer)$timeout;
}
$this->do_debug = $debug_level;
$this->username = $username;
$this->password = $password;
// Reset the error log
$this->errors = array();
// connect
$result = $this->connect($this->host, $this->port, $this->tval);
if ($result) {
$login_result = $this->login($this->username, $this->password);
if ($login_result) {
$this->disconnect();
return true;
}
}
// We need to disconnect regardless of whether the login succeeded
$this->disconnect();
return false;
}
/**
* Connect to a POP3 server.
* @access public
* @param string $host
* @param integer|boolean $port
* @param integer $tval
* @return boolean
*/
public function connect($host, $port = false, $tval = 30)
{
// Are we already connected?
if ($this->connected) {
return true;
}
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it cleanly instead
set_error_handler(array($this, 'catchWarning'));
if (false === $port) {
$port = $this->POP3_PORT;
}
// connect to the POP3 server
$this->pop_conn = fsockopen(
$host, // POP3 Host
$port, // Port #
$errno, // Error Number
$errstr, // Error Message
$tval
); // Timeout (seconds)
// Restore the error handler
restore_error_handler();
// Did we connect?
if (false === $this->pop_conn) {
// It would appear not...
$this->setError(array(
'error' => "Failed to connect to server $host on port $port",
'errno' => $errno,
'errstr' => $errstr
));
return false;
}
// Increase the stream time-out
stream_set_timeout($this->pop_conn, $tval, 0);
// Get the POP3 server response
$pop3_response = $this->getResponse();
// Check for the +OK
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
return true;
}
return false;
}
/**
* Log in to the POP3 server.
* Does not support APOP (RFC 2828, 4949).
* @access public
* @param string $username
* @param string $password
* @return boolean
*/
public function login($username = '', $password = '')
{
if (!$this->connected) {
$this->setError('Not connected to POP3 server');
}
if (empty($username)) {
$username = $this->username;
}
if (empty($password)) {
$password = $this->password;
}
// Send the Username
$this->sendString("USER $username" . self::CRLF);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
// Send the Password
$this->sendString("PASS $password" . self::CRLF);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
return true;
}
}
return false;
}
/**
* Disconnect from the POP3 server.
* @access public
*/
public function disconnect()
{
$this->sendString('QUIT');
//The QUIT command may cause the daemon to exit, which will kill our connection
//So ignore errors here
try {
@fclose($this->pop_conn);
} catch (Exception $e) {
//Do nothing
};
}
/**
* Get a response from the POP3 server.
* $size is the maximum number of bytes to retrieve
* @param integer $size
* @return string
* @access protected
*/
protected function getResponse($size = 128)
{
$response = fgets($this->pop_conn, $size);
if ($this->do_debug >= 1) {
echo "Server -> Client: $response";
}
return $response;
}
/**
* Send raw data to the POP3 server.
* @param string $string
* @return integer
* @access protected
*/
protected function sendString($string)
{
if ($this->pop_conn) {
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
echo "Client -> Server: $string";
}
return fwrite($this->pop_conn, $string, strlen($string));
}
return 0;
}
/**
* Checks the POP3 server response.
* Looks for for +OK or -ERR.
* @param string $string
* @return boolean
* @access protected
*/
protected function checkResponse($string)
{
if (substr($string, 0, 3) !== '+OK') {
$this->setError(array(
'error' => "Server reported an error: $string",
'errno' => 0,
'errstr' => ''
));
return false;
} else {
return true;
}
}
/**
* Add an error to the internal error store.
* Also display debug output if it's enabled.
* @param $error
* @access protected
*/
protected function setError($error)
{
$this->errors[] = $error;
if ($this->do_debug >= 1) {
echo '<pre>';
foreach ($this->errors as $error) {
print_r($error);
}
echo '</pre>';
}
}
/**
* Get an array of error messages, if any.
* @return array
*/
public function getErrors()
{
return $this->errors;
}
/**
* POP3 connection error handler.
* @param integer $errno
* @param string $errstr
* @param string $errfile
* @param integer $errline
* @access protected
*/
protected function catchWarning($errno, $errstr, $errfile, $errline)
{
$this->setError(array(
'error' => "Connecting to the POP3 server raised a PHP warning: ",
'errno' => $errno,
'errstr' => $errstr,
'errfile' => $errfile,
'errline' => $errline
));
}
}

Datei anzeigen

@ -0,0 +1,61 @@
{
"name": "phpmailer/phpmailer",
"type": "library",
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"authors": [
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
},
{
"name": "Brent R. Matzelle"
}
],
"require": {
"ext-ctype": "*",
"php": ">=5.0.0"
},
"require-dev": {
"doctrine/annotations": "1.2.*",
"jms/serializer": "0.16.*",
"phpdocumentor/phpdocumentor": "2.*",
"phpunit/phpunit": "4.8.*",
"symfony/debug": "2.8.*",
"symfony/filesystem": "2.8.*",
"symfony/translation": "2.8.*",
"symfony/yaml": "2.8.*",
"zendframework/zend-cache": "2.5.1",
"zendframework/zend-config": "2.5.1",
"zendframework/zend-eventmanager": "2.5.1",
"zendframework/zend-filter": "2.5.1",
"zendframework/zend-i18n": "2.5.1",
"zendframework/zend-json": "2.5.1",
"zendframework/zend-math": "2.5.1",
"zendframework/zend-serializer": "2.5.*",
"zendframework/zend-servicemanager": "2.5.*",
"zendframework/zend-stdlib": "2.5.1"
},
"suggest": {
"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
},
"autoload": {
"classmap": [
"class.phpmailer.php",
"class.phpmaileroauth.php",
"class.phpmaileroauthgoogle.php",
"class.smtp.php",
"class.pop3.php",
"extras/EasyPeasyICS.php",
"extras/ntlm_sasl_client.php"
]
},
"license": "LGPL-2.1"
}

3593
conlite/external/phpmailer/phpmailer/composer.lock generiert vendored Normale Datei

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

Datei anzeigen

@ -0,0 +1,38 @@
<?php
/**
* This example shows how to use DKIM message authentication with PHPMailer.
* There's more to using DKIM than just this code - check out this article:
* @link https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
* See also the DKIM code in the PHPMailer unit tests,
* which shows how to make a key pair from PHP.
*/
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer DKIM test';
//This should be the same as the domain of your From address
$mail->DKIM_domain = 'example.com';
//Path to your private key file
$mail->DKIM_private = 'dkim_private.pem';
//Set this to your own selector
$mail->DKIM_selector = 'phpmailer';
//If your private key has a passphrase, set it here
$mail->DKIM_passphrase = '';
//The identity you're signing as - usually your From address
$mail->DKIM_identity = $mail->From;
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

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