Dieser Commit ist enthalten in:
o.pinke 2022-05-23 19:07:57 +02:00
Ursprung d482a362af
Commit ad3edca025
12 geänderte Dateien mit 1007 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,2 @@
/local
/localhost

Datei anzeigen

@ -0,0 +1 @@

Datei anzeigen

@ -0,0 +1,52 @@
<?php
/**
* Project:
* Contenido Content Management System
*
* Description:
* Configuration File
*
* Requirements:
* @con_php_req 5
*
*
* @package ContenidoBackendArea
* @version 0.1
* @author unknown
* @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 unknown
* modified 2008-07-03, bilal arslan, added security fix
*
* $Id$:
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
// Relative path to contenido directory, for all inclusions, in most cases: "../contenido/"
$contenido_path = "../conlite/";
// If language isn't specified, set this client and language (ID)
$load_lang = "1";
$load_client = "1";
/* Various debugging options */
$frontend_debug["container_display"] = false;
$frontend_debug["module_display"] = false;
$frontend_debug["module_timing"] = false;
$frontend_debug["module_timing_summary"]= false;
/* Set to 1 to brute-force module regeneration */
$force = 0;
?>

19
conlite/external/frontend/environment.php vendored Normale Datei
Datei anzeigen

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

BIN
conlite/external/frontend/favicon.ico vendored Normale Datei

Binäre Datei nicht angezeigt.

Nachher

Breite:  |  Höhe:  |  Größe: 28 KiB

Datei anzeigen

@ -0,0 +1,85 @@
<?php
/**
* Project:
* Contenido Content Management System
*
* Description:
* Recursive loop over given category for building a frontend navigation
*
* @package Frontend
* @subpackage Navigation
* @version 1.0.0
* @author Rudi Bieller
* @copyright four for business AG <www.4fb.de>
*
* $Id$
*/
class Contenido_NavMain_Util {
/**
* Recursive Loop over all (sub)categories.
* Each level will be assigned a css class navmainStandardLevel_x
*
* @param Contenido_Category $oCategory
* @param Contenido_FrontendNavigation $oFrontendNavigation
* @param Template $oTpl
* @param string $sUrlStyle
* @param array $aCfg
* @param int $iLang
* @param array $aLevelInfo Information for marking active cat per levels
* @param array $aDepthInfo Info on level depth / where to stop. Format: array(iCurrentLoopCount, iMaxLoopCount)
* @return void
*/
public static function loopCats(Contenido_Category $oCategory, Contenido_FrontendNavigation $oFrontendNavigation, Template $oTpl, array $aCfg, $iLang, array $aLevelInfo, $iCurrentPageIdcat, array $aDepthInfo = array()) {
$aDepthInfo[0] = isset($aDepthInfo[0]) ? $aDepthInfo[0] + 1 : 1;
$aDepthInfo[1] = isset($aDepthInfo[1]) ? $aDepthInfo[1] : 1;
// display current item
$iItemLevel = $oFrontendNavigation->getLevel($oCategory->getIdCat());
if (!isset($aLevelInfo[$oCategory->getIdCat()])) {
$aLevelInfo[$oCategory->getIdCat()] = array();
}
$oCurrentSubcategories = $oFrontendNavigation->getSubCategories($oCategory->getIdCat());
$aLevelInfo[$oCategory->getIdCat()]['has_children'] = $oCurrentSubcategories->count() > 0;
$aLevelInfo[$oCategory->getIdCat()]['first_child_item'] = -1;
$aLevelInfo[$oCategory->getIdCat()]['last_child_item'] = -1;
$bMarkActive = $oCategory->getIdCat() == $iCurrentPageIdcat || $oFrontendNavigation->isInPathToRoot($oCategory->getIdCat(), $iCurrentPageIdcat);
if ($oCurrentSubcategories->count() > 0) {
$aLevelInfo[$oCategory->getIdCat()]['first_child_item'] = $oCurrentSubcategories[0]->getIdCat();
$aLevelInfo[$oCategory->getIdCat()]['last_child_item'] = $oCurrentSubcategories[$oCurrentSubcategories->count()-1]->getIdCat();
}
// this is just for sample client - modify to your needs!
if (($aCfg['url_builder']['name'] == 'front_content') || ($aCfg['url_builder']['name'] == 'MR')) {
$aParams = array('lang' => $iLang, 'idcat' => $oCategory->getIdCat());
} else {
$aParams = array('a' => $oCategory->getIdCat(),
'idcat' => $oCategory->getIdCat(), // needed to build category path
'lang' => $iLang, // needed to build category path
'level' => 1); // needed to build category path
}
// fill template with values
$oTpl->set('d', 'name', $oCategory->getCategoryLanguage()->getName());
$oTpl->set('d', 'css_level', $iItemLevel);
$oTpl->set('d', 'css_first_item', ($aLevelInfo[$oCategory->getIdParent()]['first_child_item'] == $oCategory->getIdCat() ? ' first' : ''));
$oTpl->set('d', 'css_last_item', ($aLevelInfo[$oCategory->getIdParent()]['last_child_item'] == $oCategory->getIdCat() ? ' last' : ''));
$oTpl->set('d', 'css_active_item', ($bMarkActive === true ? ' active' : ''));
try {
$oTpl->set('d', 'url', Contenido_Url::getInstance()->build($aParams));
} catch (InvalidArgumentException $e) {
$oTpl->set('d', 'url', '#');
}
$oTpl->next();
// continue until max level depth
if ($aDepthInfo[1] > $aDepthInfo[0]) {
// check if current item has sub-items to be displayed
$bShowFollowUps = ($oCategory->getIdCat() == $iCurrentPageIdcat || $oFrontendNavigation->isInPathToRoot($oCategory->getIdCat(), $iCurrentPageIdcat))
? true : false;
if ($bShowFollowUps === true && $oCurrentSubcategories->count() > 0) {
$oSubCategories = $oCurrentSubcategories;
foreach ($oSubCategories as $oSubCategory) {
self::loopCats($oSubCategory, $oFrontendNavigation, $oTpl, $aCfg, $iLang, $aLevelInfo, $iCurrentPageIdcat, $aDepthInfo);
}
}
}
}
}
?>

Datei anzeigen

@ -0,0 +1,66 @@
<?php
/**
* Project:
* Contenido Content Management System
*
* Description:
* Recursive loop over given category for building a sitemap navigation
*
* @package Frontend
* @subpackage Navigation
* @version 1.0.0
* @author Rudi Bieller
* @copyright four for business AG <www.4fb.de>
*
* $Id$
*/
class Contenido_Sitemap_Util {
/**
* Recursive Loop over all (sub)categories.
* Each level will be assigned a css class sitemapStandardLevel_x
*
* @param Contenido_Category $oCategory
* @param Contenido_FrontendNavigation $oFrontendNavigation
* @param Template $oTpl
* @param string $sUrlStyle
* @param array $aCfg
* @param int $iLang
* @param array $aDepthInfo Info on level depth / where to stop. Format: array(iCurrentLoopCount, iMaxLoopCount)
* @return void
*/
public static function loopCats(Contenido_Category $oCategory, Contenido_FrontendNavigation $oFrontendNavigation, Template $oTpl, $sUrlStyle, array $aCfg, $iLang, array $aDepthInfo = array()) {
$aDepthInfo[0] = isset($aDepthInfo[0]) ? $aDepthInfo[0] + 1 : 1;
$aDepthInfo[1] = isset($aDepthInfo[1]) ? $aDepthInfo[1] : 1;
// display current item
$iItemLevel = $oFrontendNavigation->getLevel($oCategory->getIdCat());
// this is just for sample client - modify to your needs!
if (($aCfg['url_builder']['name'] == 'front_content') || ($aCfg['url_builder']['name'] == 'MR')) {
$aParams = array('lang' => $iLang, 'idcat' => $oCategory->getIdCat());
} else {
$aParams = array('a' => $oCategory->getIdCat(),
'idcat' => $oCategory->getIdCat(), // needed to build category path
'lang' => $iLang, // needed to build category path
'level' => 1); // needed to build category path
}
// fill template with values
$oTpl->set('d', 'name', $oCategory->getCategoryLanguage()->getName());
$oTpl->set('d', 'css_level', $iItemLevel);
try {
$oTpl->set('d', 'url', Contenido_Url::getInstance()->build($aParams));
} catch (InvalidArgumentException $e) {
$oTpl->set('d', 'url', '#');
}
$oTpl->next();
// continue until max level depth
if ($aDepthInfo[1] > $aDepthInfo[0]) {
// check if current item has sub-items
$oSubCategories = $oFrontendNavigation->getSubCategories($oCategory->getIdCat());
if ($oSubCategories->count() > 0) {
foreach ($oSubCategories as $oSubCategory) {
self::loopCats($oSubCategory, $oFrontendNavigation, $oTpl, $sUrlStyle, $aCfg, $iLang, $aDepthInfo);
}
}
}
}
}
?>

Datei anzeigen

@ -0,0 +1,40 @@
<?php
/**
* Project:
* Contenido Content Management System
*
* Description:
*
*
* @package Frontend
* @subpackage Functions
* @version $Rev$
* @author unknown
* @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');
}
function getTeaserImage ($text,$return = 'path') {
$regEx = "/<img[^>]*?>.*?/i";
$match = array();
preg_match($regEx, $text, $match);
$regEx = "/(src)(=)(['\"]?)([^\"']*)(['\"]?)/i";
$img = array();
preg_match($regEx, $match[0], $img);
if ($return == 'path') {
return $img[4];
} else {
return $match[0];
}
}
?>

Datei anzeigen

@ -0,0 +1,521 @@
<?php
/**
* Project:
* Contenido Content Management System
*
* Description:
*
*
* @package Frontend
* @subpackage Functions
* @version $Rev$
* @author unknown
* @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');
}
// create Navigation array for one level
function createNavigationArray($start_id, $db) {
global $user, $cfg, $client, $lang, $auth;
$navigation = array();
$FrontendPermissionCollection = new FrontendPermissionCollection;
// SECURITY-FIX
$sql = "SELECT
A.idcat,
C.name,
C.public,
C.idcatlang
FROM
" . $cfg["tab"]["cat_tree"] . " AS A,
" . $cfg["tab"]["cat"] . " AS B,
" . $cfg["tab"]["cat_lang"] . " AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND
C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND
C.visible = '1' AND
B.parentid = '" . Contenido_Security::escapeDB($start_id, $db) . "'
ORDER BY
A.idtree";
$db->query($sql);
while ($db->next_record()) {
$cat_id = $db->f("idcat");
$cat_idlang = $db->f("idcatlang");
$visible = false;
if ($db->f("public") != 0) {
$visible = true;
} 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");
}
}
if (count($groups) > 0) {
for ($i = 0; $i < count($groups); $i++) {
if ($FrontendPermissionCollection->checkPerm($groups[$i], 'category', 'access', $cat_idlang, true)) {
$visible = true;
}
}
}
if ($visible) {
$navigation[$cat_id] = array("idcat" => $cat_id,
"name" => $db->f("name"),
"target" => '_self', # you can not call getTarget($cat_id, &$db) at this point with the same db instance!
"public" => $db->f("public"));
}
} // end while
$db->free();
return $navigation;
}
/**
* Return target of a given category id
*
* @deprecated
*/
function getTarget($cat_id, $db) {
global $cfg, $client, $lang;
// SECURITY-FIX
$sql = "SELECT
a.external_redirect AS ext
FROM
" . $cfg["tab"]["art_lang"] . " AS a,
" . $cfg["tab"]["cat_art"] . " AS b,
" . $cfg["tab"]["cat"] . " AS c
WHERE
b.idcat = '" . Contenido_Security::escapeDB($cat_id, $db) . "' AND
c.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND
c.idcat = b.idcat AND
a.idart = b.idart AND
a.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "'";
$db->query($sql);
$db->next_record();
$target = ( $db->f('ext') == 0 ) ? '_self' : '_blank';
$db->free();
return $target;
}
/**
* Return true if $parentid is parent of $catid
*/
function isParent($parentid, $catid, $db) {
global $cfg, $client, $lang;
// SECURITY-FIX
$sql = "SELECT
a.parentid
FROM
" . $cfg["tab"]["cat"] . " AS a,
" . $cfg["tab"]["cat_lang"] . " AS b
WHERE
a.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND
b.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND
a.idcat = b.idcat AND
a.idcat = '" . Contenido_Security::escapeDB($catid, $db) . "'";
$db->query($sql);
$db->next_record();
$pre = $db->f("parentid");
if ($parentid == $pre) {
return true;
} else {
return false;
}
}
function getParent($preid, &$db) {
global $cfg, $client, $lang;
// SECURITY-FIX
$sql = "SELECT
a.parentid
FROM
" . $cfg["tab"]["cat"] . " AS a,
" . $cfg["tab"]["cat_lang"] . " AS b
WHERE
a.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND
b.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND
a.idcat = b.idcat AND
a.idcat = '" . Contenido_Security::escapeDB($preid, $db) . "'";
$db->query($sql);
if ($db->next_record()) {
return $db->f("parentid");
} else {
return false;
}
}
function getLevel($catid, &$db) {
global $cfg, $client, $lang;
// SECURITY-FIX
$sql = "SELECT
level
FROM
" . $cfg["tab"]["cat_tree"] . "
WHERE
idcat = '" . Contenido_Security::escapeDB($catid, $db) . "' ";
$db->query($sql);
if ($db->next_record()) {
return $db->f("level");
} else {
return false;
}
}
/**
* Return path of a given category up to a certain level
*/
function getCategoryPath($cat_id, $level, $reverse = true, &$db) {
$root_path = array();
array_push($root_path, $cat_id);
$parent_id = $cat_id;
while (getLevel($parent_id, $db) != false AND getLevel($parent_id, $db) > $level AND getLevel($parent_id, $db) >= 0) {
$parent_id = getParent($parent_id, $db);
if ($parent_id != false) {
array_push($root_path, $parent_id);
}
}
if ($reverse == true) {
$root_path = array_reverse($root_path);
}
return $root_path;
}
/**
* Return location string of a given category
*/
function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sTextStyleClass, $fullweblink = false, $reverse = true, $mod_rewrite = true, $db) {
global $sess, $cfgClient, $client;
$aCatPath = getCategoryPath($iStartCat, $level, $reverse, $db);
if (is_array($aCatPath) AND count($aCatPath) > 0) {
$aLocation = array();
foreach ($aCatPath as $value) {
if (!$fullweblink) {
if ($mod_rewrite == true) {
$linkUrl = $sess->url("index-a-$value.html");
} else {
$linkUrl = $sess->url("front_content.php?idcat=$value");
}
} else {
if ($mod_rewrite == true) {
$linkUrl = $sess->url($cfgClient[$client]["path"]["htmlpath"] . "index-a-$value.html");
} else {
$linkUrl = $sess->url($cfgClient[$client]["path"]["htmlpath"] . "front_content.php?idcat=$value");
}
}
$name = getCategoryName($value, $db);
$aLocation[] = '<a href="' . $linkUrl . '" class="' . $sLinkStyleClass . '"><nobr>' . $name . '</nobr></a>';
}
}
$sLocation = implode($seperator, $aLocation);
$sLocation = '<span class="' . $sTextStyleClass . '">' . $sLocation . '</span>';
return $sLocation;
}
/**
*
* get subtree by a given id
*
* @param int $idcat Id of category
* @return array Array with all deeper categories
*
* @copyright four for business AG <www.4fb.de>
*/
function getSubTree($idcat_start, $db) {
global $client, $cfg;
// SECURITY-FIX
$sql = "SELECT
B.idcat, A.level
FROM
" . $cfg["tab"]["cat_tree"] . " AS A,
" . $cfg["tab"]["cat"] . " AS B
WHERE
A.idcat = B.idcat AND
idclient = '" . Contenido_Security::escapeDB($client, $db) . "'
ORDER BY
idtree";
$db->query($sql);
$subCats = false;
$curLevel = 0;
while ($db->next_record()) {
if ($db->f("idcat") == $idcat_start) {
$curLevel = $db->f("level");
$subCats = true;
} else if ($db->f("level") <= $curLevel) { // ending part of tree
$subCats = false;
}
if ($subCats == true) { //echo "true"; echo $db->f("idcat"); echo "<br>";
$deeper_cats[] = $db->f("idcat");
}
}
return $deeper_cats;
}
function getTeaserDeeperCategories($iIdcat, $db) {
global $client, $cfg, $lang;
// SECURITY-FIX
$sql = "SELECT
B.parentid, B.idcat
FROM
" . $cfg["tab"]["cat_tree"] . " AS A,
" . $cfg["tab"]["cat"] . " AS B,
" . $cfg["tab"]["cat_lang"] . " AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND
C.visible = '1' AND
B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "'
ORDER BY
idtree";
$db->query($sql);
$subCats = false;
$curLevel = 0;
while ($db->next_record()) {
if ($db->f("idcat") == $iIdcat) {
$curLevel = $db->f("level");
$subCats = true;
} else if ($curLevel == $db->f("level")) { // ending part of tree
$subCats = false;
}
if ($subCats == true) {
$deeper_cats[] = $db->f("idcat");
}
}
return $deeper_cats;
}
/**
*
* get subtree by a given id, without protected and invisible categories
*
* @param int $idcat Id of category
* @return array Array with all deeper categories
*
* @copyright four for business AG <www.4fb.de>
*/
function getProtectedSubTree($idcat_start, $db) {
global $client, $cfg, $lang;
// SECURITY-FIX
$sql = "SELECT
B.parentid, B.idcat
FROM
" . $cfg["tab"]["cat_tree"] . " AS A,
" . $cfg["tab"]["cat"] . " AS B,
" . $cfg["tab"]["cat_lang"] . " AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND
C.visible = '1' AND
C.public = '1' AND
B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "'
ORDER BY
idtree";
$db->query($sql);
$subCats = false;
$curLevel = 0;
while ($db->next_record()) {
if ($db->f("idcat") == $idcat_start) {
$curLevel = $db->f("level");
$subCats = true;
} else if ($curLevel == $db->f("level")) { // ending part of tree
$subCats = false;
}
if ($subCats == true) { //echo "true"; echo $db->f("idcat"); echo "<br>";
$deeper_cats[] = $db->f("idcat");
}
}
return $deeper_cats;
}
/**
* Return category name
*/
function getCategoryName($cat_id, &$db) {
global $cfg, $client, $lang;
// SECURITY-FIX
$sql = "SELECT
*
FROM
" . $cfg["tab"]["cat"] . " AS A,
" . $cfg["tab"]["cat_lang"] . " AS B
WHERE
A.idcat = B.idcat AND
A.idcat = '" . Contenido_Security::escapeDB($cat_id, $db) . "' AND
A.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND
B.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "'
";
$db->query($sql);
if ($db->next_record()) {
$cat_name = $db->f("name");
return $cat_name;
} else {
return '';
}
}
// end function
// get direct subcategories of a given category
function getSubCategories($parent_id, $db) {
$subcategories = array();
global $cfg, $client, $lang;
// SECURITY-FIX
$sql = "SELECT
A.idcat
FROM
" . $cfg["tab"]["cat_tree"] . " AS A,
" . $cfg["tab"]["cat"] . " AS B,
" . $cfg["tab"]["cat_lang"] . " AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND
C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND
C.visible = '1' AND
C.public = '1' AND
B.parentid = '" . Contenido_Security::escapeDB($parent_id, $db) . "'
ORDER BY
A.idtree";
$db->query($sql);
while ($db->next_record()) {
$subcategories[] = $db->f("idcat");
} // end while
return $subcategories;
}
// end function
// get direct subcategories with protected categories
function getProtectedSubCategories($parent_id, $db) {
$subcategories = array();
unset($subcategories);
global $cfg, $client, $lang;
// SECURITY-FIX
$sql = "SELECT
A.idcat
FROM
" . $cfg["tab"]["cat_tree"] . " AS A,
" . $cfg["tab"]["cat"] . " AS B,
" . $cfg["tab"]["cat_lang"] . " AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND
C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND
B.parentid = '" . Contenido_Security::escapeDB($parent_id, $db) . "'
ORDER BY
A.idtree";
$db->query($sql);
while ($db->next_record()) {
$subcategories[] = $db->f("idcat");
} // end while
return $subcategories;
}
// end function
function checkCatPermission($idcatlang, $public) {
#Check if current user has permissions to access cat
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");
}
}
if (count($groups) > 0) {
for ($i = 0; $i < count($groups); $i++) {
if ($FrontendPermissionCollection->checkPerm($groups[$i], 'category', 'access', $idcatlang, true)) {
$visible = true;
}
}
}
return $visible;
}

Datei anzeigen

@ -0,0 +1,59 @@
<?php
function myfile($url) {
// URL zerlegen
$parsedurl = @parse_url($url);
// Host ermitteln, ungültigen Aufruf abfangen
if (empty($parsedurl['host'])) {
return null;
}
$host = $parsedurl['host'];
// Pfadangabe ermitteln
if (empty($parsedurl['path'])) {
$documentpath = '/';
} else {
$documentpath = $parsedurl['path'];
}
// Parameter ermitteln
if (!empty($parsedurl['query'])) {
$documentpath .= '?' . $parsedurl['query'];
}
// Port ermitteln
if (!empty($parsedurl['port'])) {
$port = $parsedurl['port'];
} else {
$port = 80;
}
// Socket öffnen
$fp = @fsockopen($host, $port, $errno, $errstr, 30);
if (!$fp) {
return null;
}
// Request senden
fputs ($fp, "GET {$documentpath} HTTP/1.0\r\nHost: {$host}\r\n\r\n");
// Header auslesen
do {
$line = chop(fgets($fp));
} while ((!empty($line)) && (!feof($fp)));
// Daten auslesen
$result = Array();
while (!feof($fp)) {
$result[] = fgets($fp);
}
// Socket schliessen
fclose($fp);
// Ergebnis-Array zurückgeben
return $result;
}
function prepareStringForOutput($sIn, $sCode = 'ISO-8859-1') {
global $encoding, $lang;
if ((strtoupper($sCode) == 'UTF-8') && (strtoupper($encoding[$lang]) != 'UTF-8')) {
$sOut = utf8_decode($sIn);
} elseif ((strtoupper($encoding[$lang]) == 'UTF-8') && (strtoupper($sCode) != 'UTF-8')) {
$sOut = utf8_encode($sIn);
} else {
$sOut = $sIn;
}
return $sOut;
}
?>

Datei anzeigen

@ -0,0 +1,160 @@
<?php
/*
RSS_PHP - the PHP DOM based RSS Parser
Author: <rssphp.net>
Published: 200801 :: blacknet :: via rssphp.net
RSS_PHP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
Usage:
See the documentation at http://rssphp.net/documentation
Examples:
Can be found online at http://rssphp.net/examples
*/
class rss_php {
public $document;
public $channel;
public $items;
/****************************
public load methods
***/
# load RSS by URL
public function load($url=false, $unblock=true) {
if($url) {
if($unblock) {
$this->loadParser(file_get_contents($url, false, $this->randomContext()));
} else {
$this->loadParser(file_get_contents($url));
}
}
}
# load raw RSS data
public function loadRSS($rawxml=false) {
if($rawxml) {
$this->loadParser($rawxml);
}
}
/****************************
public load methods
@param $includeAttributes BOOLEAN
return array;
***/
# return full rss array
public function getRSS($includeAttributes=false) {
if($includeAttributes) {
return $this->document;
}
return $this->valueReturner();
}
# return channel data
public function getChannel($includeAttributes=false) {
if($includeAttributes) {
return $this->channel;
}
return $this->valueReturner($this->channel);
}
# return rss items
public function getItems($includeAttributes=false) {
if($includeAttributes) {
return $this->items;
}
return $this->valueReturner($this->items);
}
/****************************
internal methods
***/
private function loadParser($rss=false) {
if($rss) {
$this->document = array();
$this->channel = array();
$this->items = array();
$DOMDocument = new DOMDocument;
$DOMDocument->strictErrorChecking = false;
$DOMDocument->loadXML($rss);
$this->document = $this->extractDOM($DOMDocument->childNodes);
}
}
private function valueReturner($valueBlock=false) {
if(!$valueBlock) {
$valueBlock = $this->document;
}
foreach($valueBlock as $valueName => $values) {
if(isset($values['value'])) {
$values = $values['value'];
}
if(is_array($values)) {
$valueBlock[$valueName] = $this->valueReturner($values);
} else {
$valueBlock[$valueName] = $values;
}
}
return $valueBlock;
}
private function extractDOM($nodeList,$parentNodeName=false) {
$itemCounter = 0;
foreach($nodeList as $values) {
if(substr($values->nodeName,0,1) != '#') {
if($values->nodeName == 'item') {
$nodeName = $values->nodeName.':'.$itemCounter;
$itemCounter++;
} else {
$nodeName = $values->nodeName;
}
$tempNode[$nodeName] = array();
if($values->attributes) {
for($i=0;$values->attributes->item($i);$i++) {
$tempNode[$nodeName]['properties'][$values->attributes->item($i)->nodeName] = $values->attributes->item($i)->nodeValue;
}
}
if(!$values->firstChild) {
$tempNode[$nodeName]['value'] = $values->textContent;
} else {
$tempNode[$nodeName]['value'] = $this->extractDOM($values->childNodes, $values->nodeName);
}
if(in_array($parentNodeName, array('channel','rdf:RDF'))) {
if($values->nodeName == 'item') {
$this->items[] = $tempNode[$nodeName]['value'];
} elseif(!in_array($values->nodeName, array('rss','channel'))) {
$this->channel[$values->nodeName] = $tempNode[$nodeName];
}
}
} elseif(substr($values->nodeName,1) == 'text') {
$tempValue = trim(preg_replace('/\s\s+/',' ',str_replace("\n",' ', $values->textContent)));
if($tempValue) {
$tempNode = $tempValue;
}
} elseif(substr($values->nodeName,1) == 'cdata-section'){
$tempNode = $values->textContent;
}
}
return $tempNode;
}
private function randomContext() {
$headerstrings = array();
$headerstrings['User-Agent'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.'.rand(0,2).'; en-US; rv:1.'.rand(2,9).'.'.rand(0,4).'.'.rand(1,9).') Gecko/2007'.rand(10,12).rand(10,30).' Firefox/2.0.'.rand(0,1).'.'.rand(1,9);
$headerstrings['Accept-Charset'] = rand(0,1) ? 'en-gb,en;q=0.'.rand(3,8) : 'en-us,en;q=0.'.rand(3,8);
$headerstrings['Accept-Language'] = 'en-us,en;q=0.'.rand(4,6);
$setHeaders = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'."\r\n".
'Accept-Charset: '.$headerstrings['Accept-Charset']."\r\n".
'Accept-Language: '.$headerstrings['Accept-Language']."\r\n".
'User-Agent: '.$headerstrings['User-Agent']."\r\n";
$contextOptions = array(
'http'=>array(
'method'=>"GET",
'header'=>$setHeaders
)
);
return stream_context_create($contextOptions);
}
}
?>

Datei anzeigen

@ -0,0 +1,2 @@
This folder is marked as deprecated and will be deleted in next versions of ConLite.
Please use folders in data-directory instead!