<?php
@session_start();
include("../../root.inc");
require_once("../../".$cbDirInclude."db.php");
include_once("../../".$cbDirInclude."config.ini");
include_once("../../".$cbDirLib."patTemplate.php" );
include_once("../../".$cbDirLib."CB_media.class.php" );
include_once("../../".$cbDirLib."CB_option.class.php" );
include_once("../../".$cbDirLib."CB_perm.class.php" );
include_once("../../".$cbDirLib."CB_plugin.class.php" );
/*
* Ableiten des Plugin Objekts zum verwalten der Plugins
*/
$cbPlugins = new CB_plugin();
include_once("plugin.config" );
$actualPlugin = $cbPlugins->getPluginByIdent("art2");
$query = mysql_query("SELECT * FROM ".TABLE."_user WHERE name = '$HTTP_SESSION_VARS[user]'");
$userChk = mysql_fetch_array($query);
if(empty($userChk)) {
trigger_error("test empty(\$userChk) bzgl. '".$HTTP_SESSION_VARS[user]."' positiv");
exit();
}
$cbUser = new CBPerm($userChk[userid]);
$cbUserID = $userChk[userid];
$cbPerms = $cbUser->getPattern();
if(!(ADMIN & $cbPerms)) {
if(!(ADD_ART & $cbPerms)) {
echo "Error: ".$error_msg["permission-denied"];
exit();
}
}
$cbOption = new CBOption();
$cbOption->setModule("system");
$cbOption->getOptionList();
$artOption = new CBOption();
$artOption->setModule("art");
$artOption->getOptionList();
if(!$cbOption->getSingleOption("skinDir")) {
$templateDir = "../../templates/default/";
} else {
$templateDir = "../../".$cbOption->getSingleOption("skinDir");
}
define("CB_TEMPLATE_DIR", $templateDir);
ob_start();
include(CB_TEMPLATE_DIR."style.css");
$cssDef = ob_get_contents();
ob_end_clean();
$tpl = new patTemplate;
$tpl->setBaseDir(CB_TEMPLATE_DIR);
$tpl->readTemplatesFromFile($actualPlugin->getValue("templates")."cblink.template");
$tpl->readTemplatesFromFile($actualPlugin->getValue("templates")."messages.template");
$tpl->addGlobalVar("TEMPLATE_DIR", CB_TEMPLATE_DIR);
$tpl->addGlobalVar("CSS_DEF", $cssDef);
$tpl->addGlobalVar("FIELD", $field);
$articleQuery = mysql_query("SELECT art.title, art.ide, art.datum, art.folder, col.fid, col.fname AS folderName FROM ".TABLE."_article AS art, ".TABLE."_columns AS col WHERE art.folder = col.fid ORDER BY art.datum DESC");
while($articleRow = mysql_fetch_object($articleQuery)) {
$articleTitle[] = $articleRow->title;
$articleFolder[] = $articleRow->folderName;
$articleIDE[] = $articleRow->ide;
}
$article2Query = mysql_query("SELECT art.ide, art.title, art.folderID, art.datetime, col.fname AS folderName, col.fid FROM ".TABLE."_art_general AS art, ".TABLE."_columns AS col WHERE art.folderID = col.fid ORDER BY art.datetime DESC");
while($article2Row = mysql_fetch_object($article2Query)) {
$article2Title[] = $article2Row->title;
$article2Folder[] = $article2Row->fname;
$article2IDE[] = $article2Row->ide;
}
$tpl->addvars("articleList", array (
"TITLE" => $articleTitle,
"FOLDER" => $articleFolder,
"IDE" => $articleIDE
));
$tpl->addvars("article2List", array (
"TITLE" => $article2Title,
"FOLDER" => $article2Folder,
"IDE" => $article2IDE
));
$tpl->displayParsedTemplate("article");
?>