Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/article2/article.inc.php
<?php
	// +----------------------------------------------------------------------+
	// | article.inc.php                                                      |
	// +----------------------------------------------------------------------+
	// | Copyright (c) 1997-2003 The C*B Development Group                    |
	// +----------------------------------------------------------------------+
	// | This source file is subject to version 1.0 of the CB license,        |
	// | that is bundled with this package in the file license.txt            |
	// | If you did not receive a copy of the PHP license please send a       |
	// | note to hide@address.com so we can mail you            |
	// | a copy immediately.                                                  |
	// +----------------------------------------------------------------------+
	// | Authors: Jörg Stöber <hide@address.com>                |
	// |          Michael Pfannkuchen <hide@address.com>                |
	// | $Id: article.inc.php,v 1.2 2004/09/19 19:33:11 cb_fog Exp $
	// +----------------------------------------------------------------------+

	define("ART_OPTION_PRINT", 1 << 0);
	
	define("ART_SORT_DATE",          1 << 0);
	define("ART_SORT_NUMERIC",       1 << 1);
	define("ART_SORT_MONTH_NUMERIC", 1 << 2);
	define("ART_SORT_DAY_NUMERIC",   1 << 3);
	
    include_once($cbDirLib."CB_sext_rp.class.php");
	include_once($cbDirLib."CB_xmldocument.class.php");
    include("editors.config.php");
    include($pluginLocation."/prepareFunctions.php");
    include($pluginLocation."/dirwalk.php");

	#require_once("DB_NestedSet/NestedSet.php");
	require_once($cbDirLib."CB_NestedSet.class.php");
	
	/* 
	* Rechte Klasse inkludieren 
	*/
	require_once($cbDirLib."CB_permission2.class.php");
	
	/*
	* Rechte Objekt initialisieren. Es wird die User ID übergeben und die System Rechte
	* Palette. Das Objekt fragt anhand der User ID alle User Gruppen ab und speichert 
	* alle Rubriken, in die der User schreiben darf
	*/
	$restrictArr = array (
		'userID'  => $cbUserID,
		'cbPerms' => $cbPerms
	);
	
	$articlePerms = CB_permission::factory("article", $restrictArr);
	
	/* 
	* NeSe Updates:
	* UPDATE cms_art_general SET rootID = ide;
	* UPDATE cms_art_general SET level = 1;
	* UPDATE cms_art_general SET leftID = 1, rightID = 2;
	*/
	/* 
	* Initialisierung der NeSet Array's für das 
	* Article Nested Set Objekt 
	*/
	$params = array (
		'table'  => TABLE.'_art_general',
		'id'     => 'ide',
		'parent' => 'parentID',
		'root'   => 'rootID',
		'l'      => 'leftID',
		'r'      => 'rightID',
		'level'  => 'level',
		'norder' => 'order_num'
	);
	
	$additional = array (
		'fid'      => 'folderID',
		'user'     => 'userID',
		'media'    => 'mediaID',
		'icon'     => 'iconID',
		'title'    => 'title',
		'datetime' => 'datetime',
		'pFrom'    => 'publishFrom',
		'pTo'      => 'publishTo',
		'stage'    => 'stage',
		'parse'    => 'parse',
		'options'  => 'options',
		'lang'     => 'languages'
	);
	
	$nestedSet = CB_NestedSet::factory($params, $additional);
	
	/* 
	* Initialisierung der NeSet Array's für das 
	* Folder Nested Set Objekt 
	*/
	$folderParams = array (
		'table'  => TABLE.'_columns',
		'id'     => 'fid',
		'parent' => 'mfolder',
		'root'   => 'rootID',
		'l'      => 'leftID',
		'r'      => 'rightID',
		'level'  => 'level',
		'norder' => 'order_num'
	);
	
	$folderAdditional = array (
		'name'          => 'fname',
		'writestatus'   => 'writestatus',
		'description'   => 'describt',
		'loadurl'       => 'loadurl',
		'usersallowed'  => 'usersallowed',
		'groupsAllowed' => 'groupsAllowed'
	);
	
	$nestedSet_folder = CB_NestedSet::factory($folderParams, $folderAdditional);
	
	/*
	* Article Perm Objekt kann das Nested Set auch gut gebrauchen
	*/
	$articlePerms->setNestedSetObject($nestedSet_folder);
		
	/* Include of Language Files */
	if(file_exists($lang_path.$lang_pf."/plugin/article2.lang.php")) {
		include($lang_path.$lang_pf."/plugin/article2.lang.php");
	} else {
		include($lang_path."en/plugin/article2.lang.php");
	}
	
	$tpl->assign("articleMessages", $amText);
	$tpl->assign("messageListWidth", "100%");
	
	include($pluginLocation."/plugin.config");
	
	if($articlePerms->hasAccess()) {
		/*
		* Workaround zur Abschaffung der artLanguages.inc.php zur globalen languages.inc.php
		*/
		$artLangArr = $supportedLangArr;
		
		//Ableitung des Article Option Objektes
		$artOption = new CBOption();
		$artOption->setModule("art");
		$artOption->getOptionList();
		
		$myMedia   = new MediaManagement();
		$myMedia->userID = $HTTP_SESSION_VARS[user];
		$myMedia->setOptionObject($cbOption);
		
		switch($sub) {
			case "artAdd":
				  include($pluginLocation."/artAdd1.inc.php");
				  break;
	
			case "artAdd2":
				  include($pluginLocation."/artAdd2.inc.php");
				  break;
	
			case "artAdd3":
				  include($pluginLocation."/artAdd3.inc.php");
				  break;
	
			case "artModHead":
				  include($pluginLocation."/artModHead.inc.php");
				  break;
				  
			case "artMove":
				  include($pluginLocation."/artMove.inc.php");
				  break;
			
			case "artMultipleFolder":
				  include($pluginLocation."/artMultipleFolder.inc.php");
				  break;
			
			case "manageMedia":
				  include($pluginLocation."/artMedia.inc.php");
				  break;
	
			case "artModify":
				  $mod = true;
				  include($pluginLocation."/artAdd3.inc.php");
				  break;
				  
			case "headlineManager":
				  include($pluginLocation."/headlineManager.inc.php");
				  break;
	
			case "commentManager":
				  if(!isset($id)) {
					  include($pluginLocation."/commentManager.inc.php");
				  } else {
					  include($pluginLocation."/showComments.inc.php");
				  }
				  break;
	
			case "listXml":
				  if(isset($id)) {
					  include($pluginLocation."/listXmlFiles.inc.php");
				  } else {
					  include($pluginLocation."/artOverview.inc.php");
				  }
				  break;
	
			default:
				  include($pluginLocation."/artOverview.inc.php");
				  break;
		}
	} else {
		
	}
	
	$menuSubNav[] = "";
	$menuEntry[]  = $amText["artOverview"];
	$menuPrefix[] = '<img src="'.$cbDirGfx.'moarrow.gif" width="8" align="middle" height="11" border="0" alt="arrow">&nbsp;';
	
	#### Sub Navigation ####
	if(ADMIN & $cbPerms) {
		$menuSubNav[] = "&sub=artAdd";
		$menuEntry[]  = $amText["add_article"];
		$menuPrefix[] = '&nbsp;|&nbsp;';
	
		$menuSubNav[] = "&sub=headlineManager";
		$menuEntry[]  = $amText["headline_manager"];
		$menuPrefix[] = '<br><img src="'.$cbDirGfx.'moarrow.gif" width="8" align="middle" height="11" border="0" alt="arrow">&nbsp;';
	
		if($cbOption->getSingleOption("comment") == 1) {
			$menuSubNav[] = "&sub=commentManager";
			$menuEntry[]  = $amText["comment_manager"];
			$menuPrefix[] = '&nbsp;|&nbsp;';
		}
	
	} else {
		if($articlePerms->hasEditPermission(false, array("type" => "column"))) {
			$menuSubNav[] = "&sub=artAdd";
			$menuEntry[]  = $amText["add_article"];
			$menuPrefix[] = '&nbsp;|&nbsp;';
		}
		if((HEAD_NEWS & $cbPerms) || (HEAD_NEWS_ALL & $cbPerms)) {
			$menuSubNav[] = "&sub=headlineManager";
			$menuEntry[]  = $amText["headline_manager"];
			$menuPrefix[] = '&nbsp;|&nbsp;';
		}
	}
		
	$tpl->assign("plugin_menu_data",
		array ( "PRE"       => $menuPrefix,
				"SUBNAV"    => $menuSubNav,
				"MENUENTRY" => $menuEntry
		)
	);
		
	$tpl->assign("pluginContent", $mainPluginContent);
	$tpl->assign("messageContent", $mainMessageContent);
	$tpl->display($config['templates']."plugin.template");
	
?>
Return current item: Content*Builder